summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/TAO_IDL')
-rw-r--r--TAO/TAO_IDL/.cvsignore1
-rw-r--r--TAO/TAO_IDL/ANNOUNCEMENT131
-rw-r--r--TAO/TAO_IDL/CHANGES122
-rw-r--r--TAO/TAO_IDL/COPYING.sun62
-rw-r--r--TAO/TAO_IDL/INSTALL.sun186
-rw-r--r--TAO/TAO_IDL/Makefile.am382
-rw-r--r--TAO/TAO_IDL/README.sun245
-rw-r--r--TAO/TAO_IDL/TAO_IDL.mwc7
-rw-r--r--TAO/TAO_IDL/ast/ast_argument.cpp153
-rw-r--r--TAO/TAO_IDL/ast/ast_array.cpp283
-rw-r--r--TAO/TAO_IDL/ast/ast_attribute.cpp323
-rw-r--r--TAO/TAO_IDL/ast/ast_check.cpp146
-rw-r--r--TAO/TAO_IDL/ast/ast_component.cpp240
-rw-r--r--TAO/TAO_IDL/ast/ast_component_fwd.cpp61
-rw-r--r--TAO/TAO_IDL/ast/ast_concrete_type.cpp106
-rw-r--r--TAO/TAO_IDL/ast/ast_constant.cpp318
-rw-r--r--TAO/TAO_IDL/ast/ast_decl.cpp1459
-rw-r--r--TAO/TAO_IDL/ast/ast_enum.cpp366
-rw-r--r--TAO/TAO_IDL/ast/ast_enum_val.cpp118
-rw-r--r--TAO/TAO_IDL/ast/ast_eventtype.cpp142
-rw-r--r--TAO/TAO_IDL/ast/ast_eventtype_fwd.cpp69
-rw-r--r--TAO/TAO_IDL/ast/ast_exception.cpp446
-rw-r--r--TAO/TAO_IDL/ast/ast_expression.cpp3187
-rw-r--r--TAO/TAO_IDL/ast/ast_factory.cpp351
-rw-r--r--TAO/TAO_IDL/ast/ast_field.cpp200
-rw-r--r--TAO/TAO_IDL/ast/ast_generator.cpp922
-rw-r--r--TAO/TAO_IDL/ast/ast_home.cpp252
-rw-r--r--TAO/TAO_IDL/ast/ast_interface.cpp1682
-rw-r--r--TAO/TAO_IDL/ast/ast_interface_fwd.cpp293
-rw-r--r--TAO/TAO_IDL/ast/ast_module.cpp1860
-rw-r--r--TAO/TAO_IDL/ast/ast_native.cpp65
-rw-r--r--TAO/TAO_IDL/ast/ast_operation.cpp595
-rw-r--r--TAO/TAO_IDL/ast/ast_predefined_type.cpp286
-rw-r--r--TAO/TAO_IDL/ast/ast_recursive.cpp223
-rw-r--r--TAO/TAO_IDL/ast/ast_redef.cpp117
-rw-r--r--TAO/TAO_IDL/ast/ast_root.cpp275
-rw-r--r--TAO/TAO_IDL/ast/ast_sequence.cpp264
-rw-r--r--TAO/TAO_IDL/ast/ast_string.cpp208
-rw-r--r--TAO/TAO_IDL/ast/ast_structure.cpp791
-rw-r--r--TAO/TAO_IDL/ast/ast_structure_fwd.cpp101
-rw-r--r--TAO/TAO_IDL/ast/ast_type.cpp565
-rw-r--r--TAO/TAO_IDL/ast/ast_typedef.cpp219
-rw-r--r--TAO/TAO_IDL/ast/ast_union.cpp1263
-rw-r--r--TAO/TAO_IDL/ast/ast_union_branch.cpp199
-rw-r--r--TAO/TAO_IDL/ast/ast_union_fwd.cpp65
-rw-r--r--TAO/TAO_IDL/ast/ast_union_label.cpp150
-rw-r--r--TAO/TAO_IDL/ast/ast_valuebox.cpp68
-rw-r--r--TAO/TAO_IDL/ast/ast_valuetype.cpp473
-rw-r--r--TAO/TAO_IDL/ast/ast_valuetype_fwd.cpp66
-rw-r--r--TAO/TAO_IDL/ast/ast_visitor.cpp16
-rw-r--r--TAO/TAO_IDL/be/be_argument.cpp91
-rw-r--r--TAO/TAO_IDL/be/be_array.cpp275
-rw-r--r--TAO/TAO_IDL/be/be_attribute.cpp164
-rw-r--r--TAO/TAO_IDL/be/be_codegen.cpp2436
-rw-r--r--TAO/TAO_IDL/be/be_component.cpp132
-rw-r--r--TAO/TAO_IDL/be/be_component_fwd.cpp84
-rw-r--r--TAO/TAO_IDL/be/be_constant.cpp68
-rw-r--r--TAO/TAO_IDL/be/be_decl.cpp967
-rw-r--r--TAO/TAO_IDL/be/be_enum.cpp92
-rw-r--r--TAO/TAO_IDL/be/be_enum_val.cpp69
-rw-r--r--TAO/TAO_IDL/be/be_eventtype.cpp143
-rw-r--r--TAO/TAO_IDL/be/be_eventtype_fwd.cpp87
-rw-r--r--TAO/TAO_IDL/be/be_exception.cpp96
-rw-r--r--TAO/TAO_IDL/be/be_expression.cpp95
-rw-r--r--TAO/TAO_IDL/be/be_factory.cpp75
-rw-r--r--TAO/TAO_IDL/be/be_field.cpp78
-rw-r--r--TAO/TAO_IDL/be/be_generator.cpp913
-rw-r--r--TAO/TAO_IDL/be/be_global.cpp2695
-rw-r--r--TAO/TAO_IDL/be/be_helper.cpp595
-rw-r--r--TAO/TAO_IDL/be/be_home.cpp143
-rw-r--r--TAO/TAO_IDL/be/be_init.cpp31
-rw-r--r--TAO/TAO_IDL/be/be_interface.cpp2657
-rw-r--r--TAO/TAO_IDL/be/be_interface_fwd.cpp99
-rw-r--r--TAO/TAO_IDL/be/be_interface_strategy.cpp1124
-rw-r--r--TAO/TAO_IDL/be/be_module.cpp68
-rw-r--r--TAO/TAO_IDL/be/be_native.cpp96
-rw-r--r--TAO/TAO_IDL/be/be_operation.cpp153
-rw-r--r--TAO/TAO_IDL/be/be_operation_strategy.cpp381
-rw-r--r--TAO/TAO_IDL/be/be_predefined_type.cpp240
-rw-r--r--TAO/TAO_IDL/be/be_produce.cpp220
-rw-r--r--TAO/TAO_IDL/be/be_root.cpp126
-rw-r--r--TAO/TAO_IDL/be/be_scope.cpp105
-rw-r--r--TAO/TAO_IDL/be/be_sequence.cpp760
-rw-r--r--TAO/TAO_IDL/be/be_stream_factory.cpp43
-rw-r--r--TAO/TAO_IDL/be/be_string.cpp150
-rw-r--r--TAO/TAO_IDL/be/be_structure.cpp109
-rw-r--r--TAO/TAO_IDL/be/be_structure_fwd.cpp72
-rw-r--r--TAO/TAO_IDL/be/be_sunsoft.cpp191
-rw-r--r--TAO/TAO_IDL/be/be_tmplinst.cpp15
-rw-r--r--TAO/TAO_IDL/be/be_type.cpp344
-rw-r--r--TAO/TAO_IDL/be/be_typedef.cpp131
-rw-r--r--TAO/TAO_IDL/be/be_union.cpp196
-rw-r--r--TAO/TAO_IDL/be/be_union_branch.cpp200
-rw-r--r--TAO/TAO_IDL/be/be_union_fwd.cpp78
-rw-r--r--TAO/TAO_IDL/be/be_union_label.cpp35
-rw-r--r--TAO/TAO_IDL/be/be_util.cpp58
-rw-r--r--TAO/TAO_IDL/be/be_valuebox.cpp96
-rw-r--r--TAO/TAO_IDL/be/be_valuetype.cpp942
-rw-r--r--TAO/TAO_IDL/be/be_valuetype_fwd.cpp84
-rw-r--r--TAO/TAO_IDL/be/be_visitor.cpp224
-rw-r--r--TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp858
-rw-r--r--TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp1258
-rw-r--r--TAO/TAO_IDL/be/be_visitor_arg_traits.cpp1165
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument.cpp61
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp455
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/argument.cpp98
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/invoke_cs.cpp681
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp695
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp237
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/post_upcall_ss.cpp133
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/upcall_ss.cpp424
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/vardecl_ss.cpp457
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array.cpp60
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/any_op_ch.cpp66
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/any_op_cs.cpp134
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/array.cpp236
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp349
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp366
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/array_cs.cpp358
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/cdr_op_ch.cpp159
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/cdr_op_cs.cpp795
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/serializer_op_ch.cpp166
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/serializer_op_cs.cpp1227
-rw-r--r--TAO/TAO_IDL/be/be_visitor_attribute.cpp41
-rw-r--r--TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp431
-rw-r--r--TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp1922
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component.cpp60
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/any_op_ch.cpp46
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/any_op_cs.cpp46
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/cdr_op_ch.cpp47
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/cdr_op_cs.cpp42
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/component.cpp359
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/component_ch.cpp279
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/component_ci.cpp71
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/component_cs.cpp335
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/component_ih.cpp42
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/component_is.cpp43
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/component_sh.cpp306
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/component_si.cpp44
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/component_ss.cpp44
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component_fwd.cpp35
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component_fwd/any_op_ch.cpp49
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component_fwd/cdr_op_ch.cpp48
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component_fwd/component_fwd_ch.cpp48
-rw-r--r--TAO/TAO_IDL/be/be_visitor_constant.cpp37
-rw-r--r--TAO/TAO_IDL/be/be_visitor_constant/constant_ch.cpp147
-rw-r--r--TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp139
-rw-r--r--TAO/TAO_IDL/be/be_visitor_context.cpp654
-rw-r--r--TAO/TAO_IDL/be/be_visitor_decl.cpp108
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum.cpp40
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum/any_op_ch.cpp67
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp118
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ch.cpp64
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum/cdr_op_cs.cpp80
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp121
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum/enum_cs.cpp70
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum/serializer_op_ch.cpp62
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum/serializer_op_cs.cpp76
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception.cpp58
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/any_op_ch.cpp177
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp293
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ch.cpp80
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/cdr_op_cs.cpp203
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/ctor_assign.cpp424
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/exception.cpp109
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp152
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/exception_ci.cpp59
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp361
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/exception_ctor.cpp462
-rw-r--r--TAO/TAO_IDL/be/be_visitor_factory.cpp144
-rw-r--r--TAO/TAO_IDL/be/be_visitor_field.cpp59
-rw-r--r--TAO/TAO_IDL/be/be_visitor_field/cdr_op_ch.cpp248
-rw-r--r--TAO/TAO_IDL/be/be_visitor_field/cdr_op_cs.cpp981
-rw-r--r--TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp607
-rw-r--r--TAO/TAO_IDL/be/be_visitor_field/field_ci.cpp162
-rw-r--r--TAO/TAO_IDL/be/be_visitor_field/field_cs.cpp205
-rw-r--r--TAO/TAO_IDL/be/be_visitor_field/serializer_op_ch.cpp249
-rw-r--r--TAO/TAO_IDL/be/be_visitor_field/serializer_op_cs.cpp1137
-rw-r--r--TAO/TAO_IDL/be/be_visitor_home.cpp37
-rw-r--r--TAO/TAO_IDL/be/be_visitor_home/home_ch.cpp80
-rw-r--r--TAO/TAO_IDL/be/be_visitor_home/home_cs.cpp64
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface.cpp96
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/amh_ch.cpp105
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/amh_rh_sh.cpp97
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/amh_rh_ss.cpp102
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp433
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/amh_si.cpp230
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp339
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/ami_interface_ch.cpp67
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp124
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp266
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/base_proxy_broker_ch.cpp81
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/base_proxy_impl_ch.cpp191
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp84
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp149
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp212
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_ss.cpp178
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface.cpp853
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp463
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp112
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp659
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp176
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp196
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp406
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp137
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp1079
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/proxy_brokers_ch.cpp72
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/proxy_impls_ch.cpp72
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_broker_ch.cpp94
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_broker_cs.cpp106
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_impl_ch.cpp169
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_ch.cpp203
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_cs.cpp359
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_sh.cpp95
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp131
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/tie_sh.cpp186
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/tie_si.cpp252
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface_fwd.cpp39
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface_fwd/any_op_ch.cpp126
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ch.cpp79
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface_fwd/interface_fwd_ch.cpp61
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module.cpp75
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module/any_op.cpp52
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module/cdr_op.cpp52
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module/module.cpp1231
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp93
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module/module_ih.cpp52
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module/module_sh.cpp87
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module/serializer_op.cpp52
-rw-r--r--TAO/TAO_IDL/be/be_visitor_native.cpp32
-rw-r--r--TAO/TAO_IDL/be/be_visitor_native/native_ch.cpp65
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation.cpp99
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/amh_rh_sh.cpp106
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp253
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp225
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp423
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/ami_ch.cpp111
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp319
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/ami_exception_holder_operation_cs.cpp48
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_ch.cpp84
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp461
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp196
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/argument.cpp221
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/argument_invoke.cpp170
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/argument_marshal.cpp287
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/base_proxy_impl_ch.cpp71
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp192
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp94
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/exceptlist_ss.cpp85
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation.cpp711
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp95
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp161
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_ih.cpp99
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_is.cpp111
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp121
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp345
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp63
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp144
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp406
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/rettype_return_cs.cpp247
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_ch.cpp102
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_cs.cpp172
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/tie_sh.cpp95
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/tie_si.cpp164
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/upcall_command_ss.cpp410
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root.cpp80
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/any_op.cpp69
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/cdr_op.cpp52
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root.cpp1738
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp84
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp53
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp54
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp55
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_is.cpp54
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_sh.cpp59
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_si.cpp68
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp70
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_sth.cpp183
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/serializer_op.cpp52
-rw-r--r--TAO/TAO_IDL/be/be_visitor_scope.cpp244
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence.cpp65
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/any_op_ch.cpp83
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp158
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp283
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp106
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp256
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp295
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp266
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp198
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/serializer_op_ch.cpp117
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/serializer_op_cs.cpp1337
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure.cpp45
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/any_op_ch.cpp155
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp241
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ch.cpp82
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/cdr_op_cs.cpp167
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/serializer_op_ch.cpp140
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/serializer_op_cs.cpp311
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/structure.cpp118
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/structure_ch.cpp105
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/structure_ci.cpp58
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/structure_cs.cpp96
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure_fwd.cpp32
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure_fwd/structure_fwd_ch.cpp55
-rw-r--r--TAO/TAO_IDL/be/be_visitor_traits.cpp488
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode.cpp62
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/alias_typecode.cpp94
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/enum_typecode.cpp98
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/objref_typecode.cpp93
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp218
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp163
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp818
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp224
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/value_typecode.cpp300
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef.cpp62
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef/any_op_ch.cpp293
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef/any_op_cs.cpp275
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_ch.cpp293
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_cs.cpp263
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef/serializer_op_ch.cpp294
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef/serializer_op_cs.cpp264
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef/typedef.cpp480
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef/typedef_ch.cpp649
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef/typedef_ci.cpp318
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef/typedef_cs.cpp146
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union.cpp54
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp152
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp240
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/cdr_op_ch.cpp81
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/cdr_op_cs.cpp212
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/discriminant_ch.cpp144
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp264
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/discriminant_cs.cpp78
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/serializer_op_ch.cpp92
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/serializer_op_cs.cpp468
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/union.cpp206
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp209
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/union_ci.cpp96
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp301
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch.cpp61
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ch.cpp214
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_cs.cpp1005
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp608
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp861
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/public_ch.cpp763
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp1252
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/public_cs.cpp182
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp542
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/serializer_op_ch.cpp215
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/serializer_op_cs.cpp1319
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_fwd.cpp32
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_fwd/union_fwd_ch.cpp53
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuebox.cpp57
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuebox/any_op_ch.cpp117
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuebox/any_op_cs.cpp206
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuebox/cdr_op_ch.cpp66
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuebox/cdr_op_cs.cpp91
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuebox/field_ch.cpp536
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuebox/field_ci.cpp614
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuebox/union_member_ci.cpp568
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuebox/valuebox.cpp40
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuebox/valuebox_ch.cpp863
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuebox/valuebox_ci.cpp879
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuebox/valuebox_cs.cpp653
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype.cpp104
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_ch.cpp72
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_cs.cpp67
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/any_op_ch.cpp125
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/any_op_cs.cpp214
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp303
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp103
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_cs.cpp170
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_ch.cpp216
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_cs.cpp974
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp821
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/field_ci.cpp233
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp1192
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/marshal_ch.cpp90
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp302
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/obv_module.cpp287
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp986
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp546
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp129
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp430
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init.cpp46
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp168
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp194
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ci.cpp37
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp165
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp313
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ci.cpp103
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp257
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_sh.cpp131
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_si.cpp51
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ss.cpp159
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype_fwd.cpp41
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype_fwd/any_op_ch.cpp135
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ch.cpp103
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ci.cpp97
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ch.cpp65
-rw-r--r--TAO/TAO_IDL/be_include/TAO_IDL_BE_Export.h40
-rw-r--r--TAO/TAO_IDL/be_include/be_argument.h54
-rw-r--r--TAO/TAO_IDL/be_include/be_array.h70
-rw-r--r--TAO/TAO_IDL/be_include/be_attribute.h85
-rw-r--r--TAO/TAO_IDL/be_include/be_codegen.h484
-rw-r--r--TAO/TAO_IDL/be_include/be_component.h67
-rw-r--r--TAO/TAO_IDL/be_include/be_component_fwd.h54
-rw-r--r--TAO/TAO_IDL/be_include/be_constant.h55
-rw-r--r--TAO/TAO_IDL/be_include/be_decl.h223
-rw-r--r--TAO/TAO_IDL/be_include/be_enum.h59
-rw-r--r--TAO/TAO_IDL/be_include/be_enum_val.h53
-rw-r--r--TAO/TAO_IDL/be_include/be_eventtype.h67
-rw-r--r--TAO/TAO_IDL/be_include/be_eventtype_fwd.h57
-rw-r--r--TAO/TAO_IDL/be_include/be_exception.h38
-rw-r--r--TAO/TAO_IDL/be_include/be_expression.h64
-rw-r--r--TAO/TAO_IDL/be_include/be_extern.h82
-rw-r--r--TAO/TAO_IDL/be_include/be_factory.h60
-rw-r--r--TAO/TAO_IDL/be_include/be_field.h53
-rw-r--r--TAO/TAO_IDL/be_include/be_generator.h268
-rw-r--r--TAO/TAO_IDL/be_include/be_global.h764
-rw-r--r--TAO/TAO_IDL/be_include/be_helper.h280
-rw-r--r--TAO/TAO_IDL/be_include/be_home.h61
-rw-r--r--TAO/TAO_IDL/be_include/be_interface.h463
-rw-r--r--TAO/TAO_IDL/be_include/be_interface_fwd.h67
-rw-r--r--TAO/TAO_IDL/be_include/be_interface_strategy.h416
-rw-r--r--TAO/TAO_IDL/be_include/be_module.h55
-rw-r--r--TAO/TAO_IDL/be_include/be_native.h66
-rw-r--r--TAO/TAO_IDL/be_include/be_operation.h90
-rw-r--r--TAO/TAO_IDL/be_include/be_operation_strategy.h210
-rw-r--r--TAO/TAO_IDL/be_include/be_predefined_type.h64
-rw-r--r--TAO/TAO_IDL/be_include/be_root.h68
-rw-r--r--TAO/TAO_IDL/be_include/be_scope.h73
-rw-r--r--TAO/TAO_IDL/be_include/be_sequence.h124
-rw-r--r--TAO/TAO_IDL/be_include/be_stream_factory.h61
-rw-r--r--TAO/TAO_IDL/be_include/be_string.h59
-rw-r--r--TAO/TAO_IDL/be_include/be_structure.h64
-rw-r--r--TAO/TAO_IDL/be_include/be_structure_fwd.h60
-rw-r--r--TAO/TAO_IDL/be_include/be_sunsoft.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_type.h110
-rw-r--r--TAO/TAO_IDL/be_include/be_typedef.h68
-rw-r--r--TAO/TAO_IDL/be_include/be_union.h72
-rw-r--r--TAO/TAO_IDL/be_include/be_union_branch.h65
-rw-r--r--TAO/TAO_IDL/be_include/be_union_fwd.h59
-rw-r--r--TAO/TAO_IDL/be_include/be_union_label.h27
-rw-r--r--TAO/TAO_IDL/be_include/be_util.h37
-rw-r--r--TAO/TAO_IDL/be_include/be_valuebox.h51
-rw-r--r--TAO/TAO_IDL/be_include/be_valuetype.h193
-rw-r--r--TAO/TAO_IDL/be_include/be_valuetype_fwd.h60
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor.h200
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_amh_pre_proc.h108
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_ami_pre_proc.h123
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_arg_traits.h91
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_argument.h37
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_argument/arglist.h114
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_argument/argument.h67
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_argument/invoke_cs.h109
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_argument/marshal_ss.h109
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_argument/paramlist.h53
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_argument/post_upcall_ss.h59
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_argument/upcall_ss.h106
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_argument/vardecl_ss.h107
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_array.h38
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_array/any_op_ch.h52
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_array/any_op_cs.h52
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_array/array.h96
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_array/array_ch.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_array/array_ci.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_array/array_cs.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_ch.h51
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_ci.h90
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_cs.h97
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_array/serializer_op_ch.h55
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_array/serializer_op_cs.h97
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_attribute.h28
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_attribute/attribute.h51
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h157
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component.h41
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/any_op_ch.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/any_op_cs.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/cdr_op_ch.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/cdr_op_cs.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/component.h57
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/component_ch.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/component_ci.h45
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/component_cs.h45
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/component_ih.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/component_is.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/component_sh.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/component_si.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/component_ss.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component_fwd.h31
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component_fwd/any_op_ch.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component_fwd/cdr_op_ch.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component_fwd/component_fwd_ch.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_constant.h29
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_constant/constant_ch.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_constant/constant_cs.h54
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_context.h292
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_decl.h57
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_enum.h35
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_enum/any_op_ch.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_enum/any_op_cs.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_enum/cdr_op_ch.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_enum/cdr_op_cs.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_enum/enum_ch.h56
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_enum/enum_cs.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_enum/serializer_op_ch.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_enum/serializer_op_cs.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_exception.h41
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_exception/any_op_ch.h60
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_exception/any_op_cs.h60
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_exception/cdr_op_ch.h50
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_exception/cdr_op_cs.h52
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_exception/ctor.h95
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_exception/ctor_assign.h94
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_exception/exception.h52
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_exception/exception_ch.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_exception/exception_ci.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_exception/exception_cs.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_exception/exception_ctor.h83
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_factory.h51
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_field.h35
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_ch.h65
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_cs.h96
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_field/field_ch.h101
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_field/field_ci.h64
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_field/field_cs.h67
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_field/serializer_op_ch.h66
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_field/serializer_op_cs.h93
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_home.h31
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_home/home_ch.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_home/home_cs.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface.h63
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/amh_ch.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/amh_rh_sh.h31
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/amh_rh_ss.h30
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/amh_sh.h45
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/amh_si.h31
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/amh_ss.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/ami_interface_ch.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/any_op_ch.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/any_op_cs.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/base_proxy_broker_ch.h44
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/base_proxy_impl_ch.h50
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/cdr_op_ch.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/cdr_op_cs.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/direct_proxy_impl_sh.h50
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/direct_proxy_impl_ss.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interface.h110
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interface_ch.h61
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interface_ci.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interface_cs.h59
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interface_ih.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interface_is.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interface_sh.h56
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interface_si.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interface_ss.h72
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/proxy_brokers_ch.h44
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/proxy_impls_ch.h44
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_broker_ch.h44
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_broker_cs.h44
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_impl_ch.h50
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/smart_proxy_ch.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/smart_proxy_cs.h45
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_sh.h44
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_ss.h50
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/tie_sh.h53
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/tie_si.h55
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h30
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface_fwd/any_op_ch.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface_fwd/cdr_op_ch.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface_fwd/interface_fwd_ch.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_module.h34
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_module/any_op.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_module/cdr_op.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_module/module.h106
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_module/module_ch.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_module/module_ih.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_module/module_sh.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_module/serializer_op.h50
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_native.h28
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_native/native_ch.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation.h62
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/amh_rh_sh.h36
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/amh_rh_ss.h38
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/amh_sh.h37
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/amh_ss.h41
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/ami_ch.h51
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/ami_cs.h61
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/ami_exception_holder_operation_cs.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_reply_stub_operation_ch.h51
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_reply_stub_operation_cs.h67
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/arglist.h56
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/argument.h56
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/argument_invoke.h66
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/argument_marshal.h88
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/base_proxy_impl_ch.h45
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/direct_proxy_impl_ss.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/exceptlist_cs.h51
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/exceptlist_ss.h54
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/operation.h105
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/operation_ch.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/operation_cs.h56
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/operation_ih.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/operation_is.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/operation_sh.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/operation_ss.h65
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/proxy_impl_xh.h45
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/remote_proxy_impl_cs.h58
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/rettype.h104
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/rettype_return_cs.h101
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/smart_proxy_ch.h51
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/smart_proxy_cs.h51
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/tie_sh.h50
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/tie_si.h50
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/upcall_command_ss.h53
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_root.h40
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_root/any_op.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_root/cdr_op.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_root/root.h111
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_root/root_ch.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_root/root_ci.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_root/root_cs.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_root/root_ih.h45
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_root/root_is.h45
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_root/root_sh.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_root/root_si.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_root/root_ss.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_root/root_sth.h59
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_root/serializer_op.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_scope.h71
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_sequence.h23
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_sequence/any_op_ch.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_sequence/any_op_cs.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_sequence/buffer_type.h72
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_sequence/cdr_op_ch.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_sequence/cdr_op_cs.h110
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_base.h106
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_ch.h52
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_cs.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_sequence/serializer_op_ch.h50
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_sequence/serializer_op_cs.h107
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_structure.h42
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_structure/any_op_ch.h58
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_structure/any_op_cs.h58
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_structure/cdr_op_ch.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_structure/cdr_op_cs.h52
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_structure/serializer_op_ch.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_structure/serializer_op_cs.h55
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_structure/structure.h52
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_structure/structure_ch.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_structure/structure_ci.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_structure/structure_cs.h47
-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_traits.h69
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode.h39
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode/alias_typecode.h58
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode/enum_typecode.h57
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode/objref_typecode.h68
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode/struct_typecode.h88
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_decl.h88
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h195
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode/union_typecode.h67
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode/value_typecode.h67
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typedef.h37
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typedef/any_op_ch.h69
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typedef/any_op_cs.h69
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_ch.h67
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_cs.h64
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typedef/serializer_op_ch.h67
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typedef/serializer_op_cs.h64
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typedef/typedef.h65
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_ch.h84
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_ci.h63
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_cs.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union/any_op_ch.h52
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union/any_op_cs.h52
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union/cdr_op_ch.h50
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union/cdr_op_cs.h52
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union/discriminant_ch.h55
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union/discriminant_ci.h55
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union/discriminant_cs.h51
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union/serializer_op_ch.h50
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union/serializer_op_cs.h52
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union/union.h52
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union/union_ch.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union/union_ci.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union/union_cs.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch.h38
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/cdr_op_ch.h66
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/cdr_op_cs.h67
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/private_ch.h91
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/public_assign_cs.h93
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ch.h90
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ci.h93
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/public_cs.h68
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/public_reset_cs.h90
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/serializer_op_ch.h67
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/serializer_op_cs.h64
-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_valuebox.h38
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuebox/any_op_ch.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuebox/any_op_cs.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuebox/cdr_op_ch.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuebox/cdr_op_cs.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuebox/field_ch.h104
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuebox/field_ci.h104
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuebox/union_member_ci.h101
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuebox/valuebox.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuebox/valuebox_ch.h105
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuebox/valuebox_ci.h102
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuebox/valuebox_cs.h82
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype.h55
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/ami_exception_holder_ch.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/ami_exception_holder_cs.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/any_op_ch.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/any_op_cs.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/arglist.h57
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/cdr_op_ch.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/cdr_op_ci.h57
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/cdr_op_cs.h55
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/field_cdr_ch.h68
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/field_cdr_cs.h132
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/field_ch.h100
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/field_ci.h72
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/field_cs.h104
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/marshal_ch.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/marshal_cs.h51
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/obv_module.h51
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype.h117
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_ch.h62
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_ci.h51
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_cs.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init.h52
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_arglist_ch.h56
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_ch.h53
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_ci.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_cs.h50
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_obv_ch.h56
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_obv_ci.h53
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_obv_cs.h58
-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.h31
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd/any_op_ch.h47
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd/cdr_op_ch.h52
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd/valuetype_fwd_ch.h47
-rw-r--r--TAO/TAO_IDL/docs/ANNOUNCEMENT131
-rw-r--r--TAO/TAO_IDL/docs/BUG_REPORT144
-rw-r--r--TAO/TAO_IDL/docs/CHANGES122
-rw-r--r--TAO/TAO_IDL/docs/CLI187
-rw-r--r--TAO/TAO_IDL/docs/COPYRIGHT57
-rw-r--r--TAO/TAO_IDL/docs/INSTALL229
-rw-r--r--TAO/TAO_IDL/docs/PROBLEMS132
-rw-r--r--TAO/TAO_IDL/docs/README233
-rw-r--r--TAO/TAO_IDL/docs/ROADMAP126
-rw-r--r--TAO/TAO_IDL/docs/WRITING_A_BE1350
-rw-r--r--TAO/TAO_IDL/driver/drv_args.cpp584
-rw-r--r--TAO/TAO_IDL/driver/drv_preproc.cpp1271
-rw-r--r--TAO/TAO_IDL/fe/fe_declarator.cpp209
-rw-r--r--TAO/TAO_IDL/fe/fe_extern.cpp127
-rw-r--r--TAO/TAO_IDL/fe/fe_global.cpp11
-rw-r--r--TAO/TAO_IDL/fe/fe_init.cpp785
-rw-r--r--TAO/TAO_IDL/fe/fe_interface_header.cpp1199
-rw-r--r--TAO/TAO_IDL/fe/fe_lookup.cpp195
-rw-r--r--TAO/TAO_IDL/fe/fe_private.cpp74
-rw-r--r--TAO/TAO_IDL/fe/idl.ll1090
-rw-r--r--TAO/TAO_IDL/fe/idl.yy5709
-rw-r--r--TAO/TAO_IDL/fe/keywords.dat76
-rw-r--r--TAO/TAO_IDL/fe/lex.yy.cpp3300
-rw-r--r--TAO/TAO_IDL/fe/lex.yy.cpp.diff121
-rw-r--r--TAO/TAO_IDL/fe/y.tab.cpp8237
-rw-r--r--TAO/TAO_IDL/fe/y.tab.cpp.diff38
-rw-r--r--TAO/TAO_IDL/fe/y.tab.h236
-rw-r--r--TAO/TAO_IDL/idl_specs/array.idl39
-rw-r--r--TAO/TAO_IDL/idl_specs/constant.idl31
-rw-r--r--TAO/TAO_IDL/idl_specs/dif2.idl50
-rw-r--r--TAO/TAO_IDL/idl_specs/inherit.idl19
-rw-r--r--TAO/TAO_IDL/idl_specs/module.idl22
-rw-r--r--TAO/TAO_IDL/idl_specs/primtypes.idl25
-rw-r--r--TAO/TAO_IDL/idl_specs/sequence.idl27
-rw-r--r--TAO/TAO_IDL/idl_specs/simple.idl18
-rw-r--r--TAO/TAO_IDL/idl_specs/simple2.idl28
-rw-r--r--TAO/TAO_IDL/idl_specs/struct.idl54
-rw-r--r--TAO/TAO_IDL/idl_specs/union.idl28
-rw-r--r--TAO/TAO_IDL/idl_specs/union2.idl23
-rw-r--r--TAO/TAO_IDL/include/TAO_IDL_FE_Export.h40
-rw-r--r--TAO/TAO_IDL/include/ast.h134
-rw-r--r--TAO/TAO_IDL/include/ast_argument.h122
-rw-r--r--TAO/TAO_IDL/include/ast_array.h153
-rw-r--r--TAO/TAO_IDL/include/ast_attribute.h134
-rw-r--r--TAO/TAO_IDL/include/ast_component.h88
-rw-r--r--TAO/TAO_IDL/include/ast_component_fwd.h35
-rw-r--r--TAO/TAO_IDL/include/ast_concrete_type.h97
-rw-r--r--TAO/TAO_IDL/include/ast_constant.h141
-rw-r--r--TAO/TAO_IDL/include/ast_decl.h378
-rw-r--r--TAO/TAO_IDL/include/ast_enum.h128
-rw-r--r--TAO/TAO_IDL/include/ast_enum_val.h99
-rw-r--r--TAO/TAO_IDL/include/ast_eventtype.h44
-rw-r--r--TAO/TAO_IDL/include/ast_eventtype_fwd.h35
-rw-r--r--TAO/TAO_IDL/include/ast_exception.h119
-rw-r--r--TAO/TAO_IDL/include/ast_expression.h337
-rw-r--r--TAO/TAO_IDL/include/ast_extern.h88
-rw-r--r--TAO/TAO_IDL/include/ast_factory.h151
-rw-r--r--TAO/TAO_IDL/include/ast_field.h150
-rw-r--r--TAO/TAO_IDL/include/ast_generator.h343
-rw-r--r--TAO/TAO_IDL/include/ast_home.h76
-rw-r--r--TAO/TAO_IDL/include/ast_interface.h236
-rw-r--r--TAO/TAO_IDL/include/ast_interface_fwd.h119
-rw-r--r--TAO/TAO_IDL/include/ast_module.h190
-rw-r--r--TAO/TAO_IDL/include/ast_native.h45
-rw-r--r--TAO/TAO_IDL/include/ast_operation.h191
-rw-r--r--TAO/TAO_IDL/include/ast_predefined_type.h137
-rw-r--r--TAO/TAO_IDL/include/ast_root.h113
-rw-r--r--TAO/TAO_IDL/include/ast_sequence.h136
-rw-r--r--TAO/TAO_IDL/include/ast_string.h120
-rw-r--r--TAO/TAO_IDL/include/ast_structure.h192
-rw-r--r--TAO/TAO_IDL/include/ast_structure_fwd.h50
-rw-r--r--TAO/TAO_IDL/include/ast_type.h190
-rw-r--r--TAO/TAO_IDL/include/ast_typedef.h133
-rw-r--r--TAO/TAO_IDL/include/ast_union.h202
-rw-r--r--TAO/TAO_IDL/include/ast_union_branch.h124
-rw-r--r--TAO/TAO_IDL/include/ast_union_fwd.h37
-rw-r--r--TAO/TAO_IDL/include/ast_union_label.h118
-rw-r--r--TAO/TAO_IDL/include/ast_valuebox.h41
-rw-r--r--TAO/TAO_IDL/include/ast_valuetype.h85
-rw-r--r--TAO/TAO_IDL/include/ast_valuetype_fwd.h35
-rw-r--r--TAO/TAO_IDL/include/ast_visitor.h196
-rw-r--r--TAO/TAO_IDL/include/drv_extern.h87
-rw-r--r--TAO/TAO_IDL/include/fe_declarator.h112
-rw-r--r--TAO/TAO_IDL/include/fe_extern.h108
-rw-r--r--TAO/TAO_IDL/include/fe_interface_header.h252
-rw-r--r--TAO/TAO_IDL/include/fe_private.h92
-rw-r--r--TAO/TAO_IDL/include/global_extern.h87
-rw-r--r--TAO/TAO_IDL/include/idl_defines.h98
-rw-r--r--TAO/TAO_IDL/include/idl_global.h703
-rw-r--r--TAO/TAO_IDL/include/idl_narrow.h270
-rw-r--r--TAO/TAO_IDL/include/idl_uns_long.h23
-rw-r--r--TAO/TAO_IDL/include/nr_extern.h79
-rw-r--r--TAO/TAO_IDL/include/utl_decllist.h117
-rw-r--r--TAO/TAO_IDL/include/utl_err.h345
-rw-r--r--TAO/TAO_IDL/include/utl_exceptlist.h112
-rw-r--r--TAO/TAO_IDL/include/utl_exprlist.h109
-rw-r--r--TAO/TAO_IDL/include/utl_identifier.h123
-rw-r--r--TAO/TAO_IDL/include/utl_idlist.h138
-rw-r--r--TAO/TAO_IDL/include/utl_indenter.h107
-rw-r--r--TAO/TAO_IDL/include/utl_labellist.h108
-rw-r--r--TAO/TAO_IDL/include/utl_list.h141
-rw-r--r--TAO/TAO_IDL/include/utl_namelist.h114
-rw-r--r--TAO/TAO_IDL/include/utl_scope.h477
-rw-r--r--TAO/TAO_IDL/include/utl_scoped_name.h77
-rw-r--r--TAO/TAO_IDL/include/utl_stack.h146
-rw-r--r--TAO/TAO_IDL/include/utl_string.h125
-rw-r--r--TAO/TAO_IDL/include/utl_strlist.h125
-rw-r--r--TAO/TAO_IDL/include/utl_tmpl/utl_decllist.h105
-rw-r--r--TAO/TAO_IDL/include/utl_tmpl/utl_exceptlist.h113
-rw-r--r--TAO/TAO_IDL/include/utl_tmpl/utl_exprlist.h106
-rw-r--r--TAO/TAO_IDL/include/utl_tmpl/utl_idlist.h105
-rw-r--r--TAO/TAO_IDL/include/utl_tmpl/utl_labellist.h101
-rw-r--r--TAO/TAO_IDL/include/utl_tmpl/utl_list.h140
-rw-r--r--TAO/TAO_IDL/include/utl_tmpl/utl_namelist.h103
-rw-r--r--TAO/TAO_IDL/include/utl_tmpl/utl_strlist.h109
-rw-r--r--TAO/TAO_IDL/narrow/narrow.cpp173
-rw-r--r--TAO/TAO_IDL/tao_idl.1272
-rw-r--r--TAO/TAO_IDL/tao_idl.cpp385
-rw-r--r--TAO/TAO_IDL/tao_idl.mpc185
-rw-r--r--TAO/TAO_IDL/util/utl_decllist.cpp157
-rw-r--r--TAO/TAO_IDL/util/utl_err.cpp1414
-rw-r--r--TAO/TAO_IDL/util/utl_exceptlist.cpp148
-rw-r--r--TAO/TAO_IDL/util/utl_exprlist.cpp125
-rw-r--r--TAO/TAO_IDL/util/utl_global.cpp1832
-rw-r--r--TAO/TAO_IDL/util/utl_identifier.cpp237
-rw-r--r--TAO/TAO_IDL/util/utl_idlist.cpp278
-rw-r--r--TAO/TAO_IDL/util/utl_indenter.cpp132
-rw-r--r--TAO/TAO_IDL/util/utl_labellist.cpp123
-rw-r--r--TAO/TAO_IDL/util/utl_list.cpp198
-rw-r--r--TAO/TAO_IDL/util/utl_namelist.cpp134
-rw-r--r--TAO/TAO_IDL/util/utl_scope.cpp2586
-rw-r--r--TAO/TAO_IDL/util/utl_stack.cpp255
-rw-r--r--TAO/TAO_IDL/util/utl_string.cpp271
-rw-r--r--TAO/TAO_IDL/util/utl_strlist.cpp236
-rw-r--r--TAO/TAO_IDL/util/utl_tmpl/utl_decllist.cpp107
-rw-r--r--TAO/TAO_IDL/util/utl_tmpl/utl_exceptlist.cpp106
-rw-r--r--TAO/TAO_IDL/util/utl_tmpl/utl_exprlist.cpp106
-rw-r--r--TAO/TAO_IDL/util/utl_tmpl/utl_idlist.cpp152
-rw-r--r--TAO/TAO_IDL/util/utl_tmpl/utl_labellist.cpp106
-rw-r--r--TAO/TAO_IDL/util/utl_tmpl/utl_list.cpp213
-rw-r--r--TAO/TAO_IDL/util/utl_tmpl/utl_namelist.cpp108
-rw-r--r--TAO/TAO_IDL/util/utl_tmpl/utl_strlist.cpp152
893 files changed, 187511 insertions, 0 deletions
diff --git a/TAO/TAO_IDL/.cvsignore b/TAO/TAO_IDL/.cvsignore
new file mode 100644
index 00000000000..65c93c3e85c
--- /dev/null
+++ b/TAO/TAO_IDL/.cvsignore
@@ -0,0 +1 @@
+tao_idl
diff --git a/TAO/TAO_IDL/ANNOUNCEMENT b/TAO/TAO_IDL/ANNOUNCEMENT
new file mode 100644
index 00000000000..870db6f6006
--- /dev/null
+++ b/TAO/TAO_IDL/ANNOUNCEMENT
@@ -0,0 +1,131 @@
+WHAT:
+
+SunSoft, Inc., Mountain View, California, has placed the source code to
+Project DOE's Interface Definition Language (IDL) compiler front end
+(CFE) on OMG's file server, making the implementation publicly
+available. This release is identified by the version number 1.3.
+
+Project DOE is SunSoft's corporate-wide development effort to integrate
+distributed object technology into the Solaris O/S. OMG (Object Management
+Group) is the industry wide body formed to create specifications for
+distributed object technology. It currently has more than 370 members. OMG
+IDL is part of OMG's CORBA 1.1 specification and provides a standardized
+way for defining object interfaces. OMG IDL forms the basis for distributed
+object interactionin Project DOE.
+
+The SunSoft OMG IDL CFE provides a complete framework for building
+CORBA 1.1-compliant preprocessors for OMG IDL. By using this standard
+implementation, developers of OMG IDL compilers will save many months
+of work and enhance the portability and interoperability of OMG
+IDL-interfaced objects.
+
+The SunSoft OMG IDL CFE allows convenient and fast integration of new back
+ends to the compiler. The release consists of a front end which converts
+OMG IDL to an intermediate format, a compiler framework driver, an example
+implementation of a compiler back end, and a set of protocols for
+interaction between the front and back ends. The SunSoft OMG IDL CFE
+parser uses components generated by yacc and lex.
+
+The SunSoft OMG IDL CFE is designed to allow easy extension of OMG IDL
+without impacting existing back-end implementations. As the CORBA
+specification evolves, any new updates to the IDE CFE will be placed
+by SunSoft on the OMG server.
+
+This release provides a directory with many examples of OMG IDL
+specifications to allow users to become familiar with the process of
+writing OMG IDL code.
+
+For more information send email to idl-cfe@sun.com.
+
+HOW:
+
+The SunSoft OMG IDL CFE is available at no charge through anonymous FTP
+in source form on the OMG file server, omg.org. Please retrieve the
+file OMG_IDL_CFE_1.3.tar.Z from the directory pub/OMG_IDL_CFE_1.3. Please
+let us know who you are if you retrieve the compiler front end using this
+method, by sending email to idl-cfe@sun.com.
+
+You can also retrieve the software by using the OMG mail server program.
+Send email with the subject 'help' to omg_idl@omg.org, and the mail server
+will respond with instructions on how to retrieve the software.
+
+WHEN:
+
+The SunSoft OMG IDL CFE is available now.
+
+CONTACT:
+
+Please let us know who you are if you decide to use this software, and how
+you use it. Please send email to:
+
+ idl-cfe@sun.com
+
+This address can also be used to report problems, bugs, suggestions and
+send general comments.
+
+We ask that if you make extensions or modifications to this source release,
+please make these extensions available to others using the OMG IDL compiler
+front end, by sending the modified sources to the above email address. This
+will help us evaluate your extensions for inclusion in a future version. It
+also ensures your investment in these extensions when new versions of the
+CFE are released.
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+COPYRIGHT NOTICE:
+
+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
diff --git a/TAO/TAO_IDL/CHANGES b/TAO/TAO_IDL/CHANGES
new file mode 100644
index 00000000000..ae6fca7bcea
--- /dev/null
+++ b/TAO/TAO_IDL/CHANGES
@@ -0,0 +1,122 @@
+CHANGES WHICH AFFECT BE WRITERS
+-=============================-
+
+INTRODUCTION
+
+This file describes changes that affect BE writers. It contains IMPORTANT
+INFORMATION for BE writers who wish to migrate a BE written to operate with
+release 1.2 to operate with release 1.3. It is likely that not following
+these instructions will result in a compilable but malfunctioning compiler.
+
+AST INHERITANCE CHANGES
+
+The AST has been reorganized so that AST_Union and AST_Exception now
+inherit from AST_Structure. This means that constructors of BE classes
+which inherit from AST_Union or AST_Exception now need to explicitly call
+an initializer for AST_Structure in their init section.
+
+We repeat below the information given in the file WRITING_A_BE, in the
+section entitled "WRITING A BE".
+
+AST_EXCEPTION
+
+The signature for constructors of classes inheriting from AST_Exception
+should now be:
+
+ BE_Exception::BE_Exception(UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Decl(AST_Decl::NT_except, n, p),
+ AST_Structure(AST_Decl::NT_except, n, p),
+ UTL_Scope(AST_Decl::NT_except)
+
+AST_UNION
+
+The signature for constructors of classes inheriting from AST_Union should
+now be:
+
+ BE_Union::BE_Union(AST_ConcreteType *dt,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Union(dt, n, p),
+ AST_Structure(AST_Decl::NT_union, n, p),
+ AST_Decl(AST_Decl::NT_union, n, p),
+ UTL_Scope(AST_Decl::NT_union)
+
+IDL_BOOL TYPE
+
+To increase portability and reduce dependency of the sources on POSIX
+compliance in targets of ports, IDL now provides its own boolean type which
+is named idl_bool. It provides two truth values, I_TRUE and I_FALSE.
+
+UTL_SCOPEDNAME TYPE
+
+The UTL_ScopedName type is now a list of Identifier nodes; in previous
+releases it used to be a list of String nodes. If your BE constructs scoped
+names this change will prevent recompilation until you modify your
+constructor calls to invoke constructors for Identifier instead of for
+String. The signature of the constructor is:
+
+ Identifier::Identifier(char *, long x=1, long y=0, long z=I_FALSE)
+
+The additional arguments which can be defaulted to the values indicated are
+included for future use.
+
+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.
diff --git a/TAO/TAO_IDL/COPYING.sun b/TAO/TAO_IDL/COPYING.sun
new file mode 100644
index 00000000000..fb7289a9820
--- /dev/null
+++ b/TAO/TAO_IDL/COPYING.sun
@@ -0,0 +1,62 @@
+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.
diff --git a/TAO/TAO_IDL/INSTALL.sun b/TAO/TAO_IDL/INSTALL.sun
new file mode 100644
index 00000000000..2b26b7fb597
--- /dev/null
+++ b/TAO/TAO_IDL/INSTALL.sun
@@ -0,0 +1,186 @@
+========================================
+
+This file contains the original INSTALL file that came with the
+SunSoft IDL compiler release. This information in this file is
+historical in nature and the much of the specific information probably
+is inaccurate with respect to the current state of TAO IDL. Please
+see the ../TAO-INSTALL.html documentation that comes with TAO for
+up-to-date information on the installation process.
+
+Specifically, some of the files referred to below have been renamed in
+TAO IDL.
+
+INTERFACE DEFINITION LANGUAGE INSTALLATION GUIDE
+-==============================================-
+
+INTRODUCTION
+
+This file describes the installation process for OMG_IDL_CFE version 1.3.
+This file explains how to:
+
+- install the source code
+- modify the sources to customize them for different configurations
+- modify the sources to implement your own back end
+
+TESTED CONFIGURATIONS
+
+This release has been tested and is believed to operate correctly on:
+- SunPro Sparcworks 2.x and 3.0 on SunOS 4.1.x
+- SunPro Sparcworks 2.x and 3.0 on Solaris 2.3
+- g++ 2.5.8 on SunOS 4.1.x
+- g++ 2.5.8 on Solaris 2.3
+
+This is the first release of OMG IDL CFE which is preconfigured to compile
+correctly for Solaris 2.x and with SunPro SparcWorks compilers.
+
+CUSTOMIZATION
+
+The release contains a file idl_make_vars in the current directory,
+which is included in each Makefile. This file defines all the
+customizable variables for the CFE.
+
+OSV should be set to a string denoting the operating system upon which
+you wish to build the CFE. The CFE as shipped is preconfigured to
+compile correctly on Solaris 2.x (OSV=SOLARIS2), and has also been
+tested on SunOS 4.1.x (OSV=SUNOS4). It contains code donated by HP
+which enables it to be compiled on Apollo Domain systems (OSV=apollo)
+and HPUX systems (OSV=hpux), but these two configurations have not
+been tested.
+
+C++ and CCC should be set to identify the C++ compiler you will use to
+compile this release. Their values should be identical. Both are set
+to address differences between various make programs - some predefine
+CCC, others use C++ to denote the C++ compiler. The possible values
+are CC (which uses the Sparcworks compilers on SunOS 4.1 and Solaris
+2.3) and g++, which uses the installed version of GNU C++.
+
+CCFLAGS should be set to a list of flags to pass to the C++
+compiler. As shipped, this list is -g. NOTE: We have not extensively
+tested the release with optimization turned on.
+
+CPP_FLAGS should be set to a list of flags to pass to the C++
+preprocessor. Use this variable to enable or disable specific
+customizations you make to the BE or CFE sources.
+
+YFLAGS should be set to a list of flags to pass to the Yacc
+program. As shipped, the list is -d -t, which causes Yacc to generate
+y.tab.h and y.tab.c files.
+
+LEXFLAGS should be set to a list of flags to pass to the Lex
+program. As shipped, the list -t.
+
+RANLIB should be set to the location of the ranlib program on your
+system. As shipped this is ranlib. If your system has no ranlib you
+can set this variable to ':' or /bin/true. As shipped the variable is
+preset to /bin/true since Solaris 2.x does not use ranlib.
+
+AR should be set to the location of the ar program on your system. As
+shipped this is ar. If your system has a different mechanism for
+creating libraries, you should modify the value of this variable
+accordingly.
+
+ARFLAGS should be set to the flags to be passed to the ar program. As
+shipped this is 'crv'.
+
+INSTALLATION
+
+a. Disk space requirements
+
+This distribution requires approximately 350 KBytes when
+compressed. When uncompressed, untarred and compiled, approximately 10
+MBytes of disk space are consumed on a Sun 4.
+
+b. Getting the software
+
+Use anonymous FTP to omg.org and supply your e-mail address as
+password. Change directories to pub/OMG_IDL_CFE_1.3, set bin and get
+the compressed tar file OMG_IDL_CFE_1.3.tar.Z.
+
+The distribution may, in the future, be made available from other
+archives on the Internet. However, omg.org will always have the most
+up-to-date version of this software.
+
+After transferring this file, uncompress it and untar it in a
+directory of your choice.
+
+c. Compiling it
+
+If you are using a Sparcstation running Solaris 2.x and have the
+SunPro Sparcworks compilers installed, you may directly install the
+software. If your hardware or operating system configurations are
+different, read and follow the instructions in the previous section
+first.
+
+At the root directory of the release, issue
+
+ % make
+
+or
+
+ % make all
+
+This will compile the provided sources and the sources found in the be
+directory. Executing this make target causes 'make all' to be invoked
+in each subdirectory, resulting in building the libraries for each
+component and finally a link step producing an executable IDL
+compiler.
+
+In order to make only the compiler front end components, without
+compiling the sources found in the be directory and without building
+an executable, issue
+
+ % make libs
+
+This will build the libraries in the ast, fe, util, driver and narrow
+directories. To build only the be, issue
+
+ % make be
+
+To build all libraries without creating an executable, issue
+
+ % make all_libs
+
+To remove all files created by the build process, issue
+
+ % make clean
+
+This will not remove any files created by Yacc and Lex, because you
+may be using the ones provided in the distribution (see below).
+
+d. Yacc and Lex
+
+Some installations may not have a C++ aware Yacc and Lex
+processor. For these installations, we have included the output of
+yacc and lex in the release. If you need to use these files to build
+the release because you don't have access to a C++ capable Yacc or
+Lex, go to the "fe" directory, issue the command:
+
+ % touch lex.yy.cc y.tab.cc y.tab.hh
+
+This will ensure that the processed files appear to be newer than the
+source files they were produced from and will cause "make" to skip
+their production.
+
+NOTE: The files provided in the distribution have been produced on
+Solaris 2.3 and may contain OS-specific #include directives. If you
+intend to use these files, you may have to edit them to make them work
+in your environment. The provided files are known to compile cleanly
+without modification with both SunPro Sparcworks compilers and GNU C++
+on both SunOS 4.1 and Solaris 2.3. We have not tested the grammar and
+lexer input files with bison or flex.
+
+IMPLEMENTING A BACK END
+
+To implement your own back end, you can start with the provided
+sources in the be directory and modify them. The Makefile understands
+the 'make all' target and will generate libbe.a in the demo_be
+directory. As set up, the variable CPP_FLAGS allows you to place
+include files either in the current directory or in the include
+directory. Alternatively, you can place your include files in a new
+directory and modify CPP_FLAGS to cause the C++ preprocessor to search
+this new directory for referenced include files, by adding a new -I
+directive.
+
+Additional detail on the structure and function of back ends, and on
+the protocol which a back end must implement, are found in the
+document entitled WRITING_A_BE.
diff --git a/TAO/TAO_IDL/Makefile.am b/TAO/TAO_IDL/Makefile.am
new file mode 100644
index 00000000000..9c3f6e976d0
--- /dev/null
+++ b/TAO/TAO_IDL/Makefile.am
@@ -0,0 +1,382 @@
+## Process this file with automake to create Makefile.in
+##
+## $Id$
+##
+## This file was generated by MPC. Any changes made directly to
+## this file will be lost the next time it is generated.
+##
+## MPC Command:
+## ../bin/mwc.pl -type automake -noreldefs TAO.mwc
+
+ACE_BUILDDIR = $(top_builddir)/..
+ACE_ROOT = $(top_srcdir)/..
+TAO_ROOT = $(top_srcdir)
+
+## Makefile.TAO_IDL_FE.am
+
+noinst_LTLIBRARIES = libTAO_IDL_FE.la
+
+libTAO_IDL_FE_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(srcdir)/include \
+ -I$(srcdir)/fe \
+ -DTAO_IDL_FE_BUILD_DLL
+
+libTAO_IDL_FE_la_SOURCES = \
+ ast/ast_argument.cpp \
+ ast/ast_array.cpp \
+ ast/ast_attribute.cpp \
+ ast/ast_check.cpp \
+ ast/ast_component.cpp \
+ ast/ast_component_fwd.cpp \
+ ast/ast_concrete_type.cpp \
+ ast/ast_constant.cpp \
+ ast/ast_decl.cpp \
+ ast/ast_enum.cpp \
+ ast/ast_enum_val.cpp \
+ ast/ast_eventtype.cpp \
+ ast/ast_eventtype_fwd.cpp \
+ ast/ast_exception.cpp \
+ ast/ast_expression.cpp \
+ ast/ast_factory.cpp \
+ ast/ast_field.cpp \
+ ast/ast_generator.cpp \
+ ast/ast_home.cpp \
+ ast/ast_interface.cpp \
+ ast/ast_interface_fwd.cpp \
+ ast/ast_module.cpp \
+ ast/ast_native.cpp \
+ ast/ast_operation.cpp \
+ ast/ast_predefined_type.cpp \
+ ast/ast_recursive.cpp \
+ ast/ast_redef.cpp \
+ ast/ast_root.cpp \
+ ast/ast_sequence.cpp \
+ ast/ast_string.cpp \
+ ast/ast_structure.cpp \
+ ast/ast_structure_fwd.cpp \
+ ast/ast_type.cpp \
+ ast/ast_typedef.cpp \
+ ast/ast_union.cpp \
+ ast/ast_union_branch.cpp \
+ ast/ast_union_fwd.cpp \
+ ast/ast_union_label.cpp \
+ ast/ast_valuebox.cpp \
+ ast/ast_valuetype.cpp \
+ ast/ast_valuetype_fwd.cpp \
+ ast/ast_visitor.cpp \
+ fe/fe_declarator.cpp \
+ fe/fe_extern.cpp \
+ fe/fe_global.cpp \
+ fe/fe_init.cpp \
+ fe/fe_interface_header.cpp \
+ fe/fe_lookup.cpp \
+ fe/fe_private.cpp \
+ fe/lex.yy.cpp \
+ fe/y.tab.cpp \
+ narrow/narrow.cpp \
+ util/utl_decllist.cpp \
+ util/utl_err.cpp \
+ util/utl_exceptlist.cpp \
+ util/utl_exprlist.cpp \
+ util/utl_global.cpp \
+ util/utl_identifier.cpp \
+ util/utl_idlist.cpp \
+ util/utl_indenter.cpp \
+ util/utl_labellist.cpp \
+ util/utl_list.cpp \
+ util/utl_namelist.cpp \
+ util/utl_scope.cpp \
+ util/utl_stack.cpp \
+ util/utl_string.cpp \
+ util/utl_strlist.cpp
+
+noinst_HEADERS = \
+ fe/y.tab.h \
+ include/TAO_IDL_FE_Export.h \
+ include/ast.h \
+ include/ast_argument.h \
+ include/ast_array.h \
+ include/ast_attribute.h \
+ include/ast_component.h \
+ include/ast_component_fwd.h \
+ include/ast_concrete_type.h \
+ include/ast_constant.h \
+ include/ast_decl.h \
+ include/ast_enum.h \
+ include/ast_enum_val.h \
+ include/ast_eventtype.h \
+ include/ast_eventtype_fwd.h \
+ include/ast_exception.h \
+ include/ast_expression.h \
+ include/ast_extern.h \
+ include/ast_factory.h \
+ include/ast_field.h \
+ include/ast_generator.h \
+ include/ast_home.h \
+ include/ast_interface.h \
+ include/ast_interface_fwd.h \
+ include/ast_module.h \
+ include/ast_native.h \
+ include/ast_operation.h \
+ include/ast_predefined_type.h \
+ include/ast_root.h \
+ include/ast_sequence.h \
+ include/ast_string.h \
+ include/ast_structure.h \
+ include/ast_structure_fwd.h \
+ include/ast_type.h \
+ include/ast_typedef.h \
+ include/ast_union.h \
+ include/ast_union_branch.h \
+ include/ast_union_fwd.h \
+ include/ast_union_label.h \
+ include/ast_valuebox.h \
+ include/ast_valuetype.h \
+ include/ast_valuetype_fwd.h \
+ include/ast_visitor.h \
+ include/drv_extern.h \
+ include/fe_declarator.h \
+ include/fe_extern.h \
+ include/fe_interface_header.h \
+ include/fe_private.h \
+ include/global_extern.h \
+ include/idl_defines.h \
+ include/idl_global.h \
+ include/idl_narrow.h \
+ include/idl_uns_long.h \
+ include/nr_extern.h \
+ include/utl_decllist.h \
+ include/utl_err.h \
+ include/utl_exceptlist.h \
+ include/utl_exprlist.h \
+ include/utl_identifier.h \
+ include/utl_idlist.h \
+ include/utl_indenter.h \
+ include/utl_labellist.h \
+ include/utl_list.h \
+ include/utl_namelist.h \
+ include/utl_scope.h \
+ include/utl_scoped_name.h \
+ include/utl_stack.h \
+ include/utl_string.h \
+ include/utl_strlist.h
+
+## Makefile.TAO_IDL_BE.am
+
+noinst_LTLIBRARIES += libTAO_IDL_BE.la
+
+libTAO_IDL_BE_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(srcdir)/include \
+ -I$(srcdir)/be_include \
+ -I$(srcdir)/fe \
+ -DTAO_IDL_BE_BUILD_DLL
+
+libTAO_IDL_BE_la_SOURCES = \
+ be/be_argument.cpp \
+ be/be_array.cpp \
+ be/be_attribute.cpp \
+ be/be_codegen.cpp \
+ be/be_component.cpp \
+ be/be_component_fwd.cpp \
+ be/be_constant.cpp \
+ be/be_decl.cpp \
+ be/be_enum.cpp \
+ be/be_enum_val.cpp \
+ be/be_eventtype.cpp \
+ be/be_eventtype_fwd.cpp \
+ be/be_exception.cpp \
+ be/be_expression.cpp \
+ be/be_factory.cpp \
+ be/be_field.cpp \
+ be/be_generator.cpp \
+ be/be_global.cpp \
+ be/be_helper.cpp \
+ be/be_home.cpp \
+ be/be_init.cpp \
+ be/be_interface.cpp \
+ be/be_interface_fwd.cpp \
+ be/be_interface_strategy.cpp \
+ be/be_module.cpp \
+ be/be_native.cpp \
+ be/be_operation.cpp \
+ be/be_operation_strategy.cpp \
+ be/be_predefined_type.cpp \
+ be/be_produce.cpp \
+ be/be_root.cpp \
+ be/be_scope.cpp \
+ be/be_sequence.cpp \
+ be/be_stream_factory.cpp \
+ be/be_string.cpp \
+ be/be_structure.cpp \
+ be/be_structure_fwd.cpp \
+ be/be_sunsoft.cpp \
+ be/be_tmplinst.cpp \
+ be/be_type.cpp \
+ be/be_typedef.cpp \
+ be/be_union.cpp \
+ be/be_union_branch.cpp \
+ be/be_union_fwd.cpp \
+ be/be_union_label.cpp \
+ be/be_util.cpp \
+ be/be_valuebox.cpp \
+ be/be_valuetype.cpp \
+ be/be_valuetype_fwd.cpp \
+ be/be_visitor.cpp \
+ be/be_visitor_amh_pre_proc.cpp \
+ be/be_visitor_ami_pre_proc.cpp \
+ be/be_visitor_arg_traits.cpp \
+ be/be_visitor_argument.cpp \
+ be/be_visitor_array.cpp \
+ be/be_visitor_attribute.cpp \
+ be/be_visitor_ccm_pre_proc.cpp \
+ be/be_visitor_component.cpp \
+ be/be_visitor_component_fwd.cpp \
+ be/be_visitor_constant.cpp \
+ be/be_visitor_context.cpp \
+ be/be_visitor_decl.cpp \
+ be/be_visitor_enum.cpp \
+ be/be_visitor_exception.cpp \
+ be/be_visitor_factory.cpp \
+ be/be_visitor_field.cpp \
+ be/be_visitor_home.cpp \
+ be/be_visitor_interface.cpp \
+ be/be_visitor_interface_fwd.cpp \
+ be/be_visitor_module.cpp \
+ be/be_visitor_native.cpp \
+ be/be_visitor_operation.cpp \
+ be/be_visitor_root.cpp \
+ be/be_visitor_scope.cpp \
+ be/be_visitor_sequence.cpp \
+ be/be_visitor_structure.cpp \
+ be/be_visitor_structure_fwd.cpp \
+ be/be_visitor_traits.cpp \
+ be/be_visitor_typecode.cpp \
+ be/be_visitor_typedef.cpp \
+ be/be_visitor_union.cpp \
+ be/be_visitor_union_branch.cpp \
+ be/be_visitor_union_fwd.cpp \
+ be/be_visitor_valuebox.cpp \
+ be/be_visitor_valuetype.cpp \
+ be/be_visitor_valuetype_fwd.cpp
+
+noinst_HEADERS += \
+ be_include/TAO_IDL_BE_Export.h \
+ be_include/be_argument.h \
+ be_include/be_array.h \
+ be_include/be_attribute.h \
+ be_include/be_codegen.h \
+ be_include/be_component.h \
+ be_include/be_component_fwd.h \
+ be_include/be_constant.h \
+ be_include/be_decl.h \
+ be_include/be_enum.h \
+ be_include/be_enum_val.h \
+ be_include/be_eventtype.h \
+ be_include/be_eventtype_fwd.h \
+ be_include/be_exception.h \
+ be_include/be_expression.h \
+ be_include/be_extern.h \
+ be_include/be_factory.h \
+ be_include/be_field.h \
+ be_include/be_generator.h \
+ be_include/be_global.h \
+ be_include/be_helper.h \
+ be_include/be_home.h \
+ be_include/be_interface.h \
+ be_include/be_interface_fwd.h \
+ be_include/be_interface_strategy.h \
+ be_include/be_module.h \
+ be_include/be_native.h \
+ be_include/be_operation.h \
+ be_include/be_operation_strategy.h \
+ be_include/be_predefined_type.h \
+ be_include/be_root.h \
+ be_include/be_scope.h \
+ be_include/be_sequence.h \
+ be_include/be_stream_factory.h \
+ be_include/be_string.h \
+ be_include/be_structure.h \
+ be_include/be_structure_fwd.h \
+ be_include/be_sunsoft.h \
+ be_include/be_type.h \
+ be_include/be_typedef.h \
+ be_include/be_union.h \
+ be_include/be_union_branch.h \
+ be_include/be_union_fwd.h \
+ be_include/be_union_label.h \
+ be_include/be_util.h \
+ be_include/be_valuebox.h \
+ be_include/be_valuetype.h \
+ be_include/be_valuetype_fwd.h \
+ be_include/be_visitor.h \
+ be_include/be_visitor_amh_pre_proc.h \
+ be_include/be_visitor_ami_pre_proc.h \
+ be_include/be_visitor_arg_traits.h \
+ be_include/be_visitor_argument.h \
+ be_include/be_visitor_array.h \
+ be_include/be_visitor_attribute.h \
+ be_include/be_visitor_ccm_pre_proc.h \
+ be_include/be_visitor_component.h \
+ be_include/be_visitor_component_fwd.h \
+ be_include/be_visitor_constant.h \
+ be_include/be_visitor_context.h \
+ be_include/be_visitor_decl.h \
+ be_include/be_visitor_enum.h \
+ be_include/be_visitor_exception.h \
+ be_include/be_visitor_factory.h \
+ be_include/be_visitor_field.h \
+ be_include/be_visitor_home.h \
+ be_include/be_visitor_interface.h \
+ be_include/be_visitor_interface_fwd.h \
+ be_include/be_visitor_module.h \
+ be_include/be_visitor_native.h \
+ be_include/be_visitor_operation.h \
+ be_include/be_visitor_root.h \
+ be_include/be_visitor_scope.h \
+ be_include/be_visitor_sequence.h \
+ be_include/be_visitor_structure.h \
+ be_include/be_visitor_structure_fwd.h \
+ be_include/be_visitor_traits.h \
+ be_include/be_visitor_typecode.h \
+ be_include/be_visitor_typedef.h \
+ be_include/be_visitor_union.h \
+ be_include/be_visitor_union_branch.h \
+ be_include/be_visitor_union_fwd.h \
+ be_include/be_visitor_valuebox.h \
+ be_include/be_visitor_valuetype.h \
+ be_include/be_visitor_valuetype_fwd.h
+
+## Makefile.TAO_IDL_EXE.am
+bin_PROGRAMS = tao_idl
+
+tao_idl_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(srcdir)/include \
+ -I$(srcdir)/be_include \
+ -I$(srcdir)/fe \
+ -I$(TAO_ROOT) \
+ -DTAO_IDL_INCLUDE_DIR="\"$(includedir)/tao\""
+
+tao_idl_SOURCES = \
+ driver/drv_args.cpp \
+ driver/drv_preproc.cpp \
+ tao_idl.cpp \
+ include/drv_extern.h
+
+tao_idl_LDADD = \
+ libTAO_IDL_BE.la \
+ libTAO_IDL_FE.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+## Clean up template repositories, etc.
+clean-local:
+ -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
+ -rm -f gcctemp.c gcctemp so_locations *.ics
+ -rm -rf cxx_repository ptrepository ti_files
+ -rm -rf templateregistry ir.out
+ -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/TAO/TAO_IDL/README.sun b/TAO/TAO_IDL/README.sun
new file mode 100644
index 00000000000..b2b6e20d3d5
--- /dev/null
+++ b/TAO/TAO_IDL/README.sun
@@ -0,0 +1,245 @@
+========================================
+
+This file contains the original README file that came with the SunSoft
+IDL compiler release. This information in this file is historical in
+nature and the much of the specific information probably is inaccurate
+with respect to the current state of TAO IDL. Please see the
+../docs/index.html documentation that comes with TAO for up-to-date
+information on TAO IDL compiler design and implementation.
+
+Specifically, some of the files referred to below have been renamed in
+TAO IDL.
+
+INTERFACE DEFINITION LANGUAGE COMPILER FRONT END
+-==============================================-
+
+INTRODUCTION
+
+Welcome to the publicly available source release of SunSoft's
+implementation of the compiler front end (CFE) for OMG Interface Definition
+Language! This is Release 1.3 of the CFE.
+
+The Interface Definition Language (IDL) implementation is divided into
+three parts:
+
+- A main program for driving the compilation process
+- A parser and attendant utilities
+- One or more back ends (BEs) for taking the processed input and producing
+ output in a target language and target format
+
+WARNINGS
+
+This is a preliminary version. This software is made available AS IS and
+WITH NO GUARANTEES. Please read the copyright notice attached at the
+bottom of this file.
+
+IMPORTANT NOTICE FOR USERS OF OMG IDL CFE VERSION 1.2.
+
+Please carefully read the file CHANGES to obtain IMPORTANT INFORMATION on
+changes in that may affect the manner in which a BE is constructed. You
+must follow instructions contained in the file CHANGES to obtain a
+functional BE if you are migrating an existing BE from OMG IDL CFE v. 1.2.
+
+TARGET AUDIENCE
+
+Who should use this release?
+
+- You can use this source release to create a stand alone parser for OMG
+ Interface Definition Language. This may be useful to verify the legality
+ of IDL input.
+- Developers of OMG Interface Definition Language compilers should use this
+ release as a basis for writing their back ends, to obtain a common
+ framework for their compiler and to provide portable and uniform
+ parsing of IDL input.
+
+HOW TO OBTAIN THIS SOFTWARE
+
+Please use anonymous FTP to omg.org and supply your e-mail address as the
+password. Then change directories to pub/OMG_IDL_CFE_1.3, set binary transfer
+and get the file OMG_IDL_CFE_1.3.TAR.Z. This file includes copies of all
+individual documentation files in the directory.
+
+Precompiled binaries constructed from the sources in this release will be
+made available shortly, in the directory pub/OMG_IDL_CFE_1.3/bin. These
+binaries are useful for parsing IDL source and for learning about the
+language. Precompiled binaries for Solaris 2.x and for SunOS 4.x will be
+provided.
+
+You can also use the mail server program to retrieve this software. Send
+email with the subject 'help' to omg_idl@omg.org, and the mail server will
+respond with instructions on how to retrieve the software.
+
+Copies of this software may be made available from archives other than
+omg.org. New versions made available by Sun will be placed on omg.org and a
+message will be sent to this newsgroup announcing its availability.
+
+Finally, the SunSoft OMG IDL CFE is also available on magnetic tape for a
+nominal media charge directly from SunSoft. Please refer to part number
+DIDL-100-STP when ordering.
+
+CONTACT POINT
+
+Please let us know who you are if you decide to use this software, and how
+you use it. Please send e-mail to:
+
+ idl-cfe@sun.com
+
+This address can also be used to report problems, bugs, suggestions and
+send general comments.
+
+WHAT IS PROVIDED IN THE RELEASE
+
+Provided in this release are:
+
+- A main program for driving an Interface Definition Language compiler
+- A parser for the Interface Definition Language grammar which builds an
+ internal representation of the input parsed. This internal
+ representation, named an Abstract Syntax Tree (AST), is used as input to
+ a back end
+- Some utility functions used by the parser
+- A demonstration back end (BE) which exercises the front end but produces
+ no translated output
+- Documentation of the public interfaces and of the contract between
+ the compiler front end and a back end
+
+OPERATION
+
+A complete compiler operates in two passes:
+
+- The first pass, provided in this release, parses the IDL input and
+ produces an internal representation, called an Abstract Syntax Tree (AST).
+ This pass also does a complete syntax and semantics check of the input
+ provided to ensure that exactly legal IDL input is accepted. If a syntax
+ or semantic error is discovered, the second pass is not invoked.
+- The second pass, provided by compiler developers, takes the AST and
+ produces output in the language and format of choice. A demonstration
+ back end is provided in the release.
+
+HOW TO USE THIS SOFTWARE
+
+To create a complete compiler from OMG Interface Definition Language to a
+target language, compiler developers will:
+
+- Write a back end (BE) to take the internal representation of the input
+ parsed and translate it to the target language and format. You will
+ probably want to replace the BE directory in this source tree with your
+ own BE directory
+- Link the BE with the sources provided here to produce a complete
+ compiler.
+
+DOCUMENTATION
+
+The OMG Interface Definition Language is fully described in the CORBA
+documentation, Chapter 4. This document may be obtained from OMG.
+
+This release also provides the following documents:
+
+- This README file, describing the release
+- INSTALL, describing installation of the software
+- WRITING_A_BE contains all the information needed to start writing a back
+ end for this distribution
+- CHANGES_IN_AST describes changes that affect migration of BEs written
+ against version 1.2 to version 1.3.
+- CLI, describing the command line interface to the CFE
+- ROADMAP, describing the directory structure for the source code. This
+ file will assist a developer in understanding the structure of the code
+ and navigating it
+- PROBLEMS, describing a list of issues that may be addressed in future
+ releases
+- BUG_REPORT, containing a form for use in reporting bugs and problems
+ with the IDL CFE
+
+ENVIRONMENT
+
+The INSTALL file explains how to customize the software for specific
+platforms. The source distribution expects the following environment:
+
+- Sparcstation 1, 2, or 10 hardware
+- SunPro SparcWorks 3.x or 4.0
+
+As preconfigured, it compiles on Solaris 2.x. It can be reconfigured to
+compile on SunOS 4.x, HPUX or Apollo Domain OS. As far as is known, no use
+is made of Sun Make-specific features, and the Makefiles should be usable
+with other make programs.
+
+This release has been tested and is believed to operate correctly with:
+- SunPro Sparcworks 2.x and 3.0 on SunOS 4.1.x
+- SunPro Sparcworks 2.x and 3.0 on Solaris 2.3
+- g++ 2.5.8 on SunOS 4.1.x
+- g++ 2.5.8 on Solaris 2.3
+
+INSTALLATION
+
+This release is targetted for Sun workstations running Solaris 2.x. The
+process of installing this software is described in detail in the file
+INSTALL in this directory. The INSTALL file also describes how to customize
+the release for your own environment if it is different.
+
+KNOWN PROBLEMS
+
+A list of known deficiencies is provided in the file PROBLEMS in this
+directory. If you find a problem which is not mentioned in it, please
+report it as described below. Please read this file now to be apprised of
+the problems found so far with this release.
+
+COPYRIGHT
+
+This copyright notice appears on all files. Please read it!
+
+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.
diff --git a/TAO/TAO_IDL/TAO_IDL.mwc b/TAO/TAO_IDL/TAO_IDL.mwc
new file mode 100644
index 00000000000..74d6b32b888
--- /dev/null
+++ b/TAO/TAO_IDL/TAO_IDL.mwc
@@ -0,0 +1,7 @@
+// -*- MPC -*-
+// $Id$
+
+// Many existing MPC builds rely on this workspace. It is not
+// necessary other than that.
+workspace {
+}
diff --git a/TAO/TAO_IDL/ast/ast_argument.cpp b/TAO/TAO_IDL/ast/ast_argument.cpp
new file mode 100644
index 00000000000..0847850d552
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_argument.cpp
@@ -0,0 +1,153 @@
+// $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.
+
+*/
+
+// AST_Argument nodes denote arguments to an operation. They
+// are AST_Fields with directions. Thus, they have a name
+// (an UTL_ScopedName) and a type (a subclass of AST_Type).
+// Additionally they have a direction field which takes values
+// from the enum AST_Argument::Direction.
+
+#include "ast_argument.h"
+#include "ast_visitor.h"
+
+ACE_RCSID (ast,
+ ast_argument,
+ "$Id$")
+
+// Static functions.
+
+// Convert an enum Direction value to a char *.
+static const char *
+direction_to_string (AST_Argument::Direction d)
+{
+ switch (d)
+ {
+ case AST_Argument::dir_IN:
+ return "in";
+ case AST_Argument::dir_OUT:
+ return "out";
+ case AST_Argument::dir_INOUT:
+ return "inout";
+ }
+
+ return 0;
+}
+
+AST_Argument::AST_Argument (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Field (),
+ pd_direction (dir_IN)
+{
+}
+
+AST_Argument::AST_Argument (Direction d,
+ AST_Type *ft,
+ UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_argument,
+ n),
+ AST_Field (AST_Decl::NT_argument,
+ ft,
+ n),
+ pd_direction (d)
+{
+}
+
+AST_Argument::~AST_Argument (void)
+{
+}
+
+// Dump this AST_Argument node to the ostream o.
+void
+AST_Argument::dump (ACE_OSTREAM_TYPE &o)
+{
+ this->dump_i (o, direction_to_string (pd_direction));
+ this->dump_i (o, " ");
+ AST_Field::dump (o);
+}
+
+int
+AST_Argument::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_argument (this);
+}
+
+void
+AST_Argument::destroy (void)
+{
+ this->AST_Field::destroy ();
+}
+
+AST_Argument::Direction
+AST_Argument::direction (void)
+{
+ return this->pd_direction;
+}
+
+// Narrowing operations.
+IMPL_NARROW_METHODS1(AST_Argument, AST_Field)
+IMPL_NARROW_FROM_DECL(AST_Argument)
diff --git a/TAO/TAO_IDL/ast/ast_array.cpp b/TAO/TAO_IDL/ast/ast_array.cpp
new file mode 100644
index 00000000000..9f602b8633a
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_array.cpp
@@ -0,0 +1,283 @@
+// $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.
+
+*/
+
+// AST_Array nodes denote array type and field modifiers.
+// AST_Array nodes have a list of dimensions (a UTL_ExprList)
+// a count of the number of dimensions and a base type (a
+// subtype of AST_ConcreteType. This means that we cannot have
+// arrays of AST_Interfaces???
+
+#include "ast_array.h"
+#include "ast_expression.h"
+#include "ast_visitor.h"
+#include "utl_exprlist.h"
+#include "utl_identifier.h"
+#include "ace/Log_Msg.h"
+#include "ace/OS_Memory.h"
+
+ACE_RCSID (ast,
+ ast_array,
+ "$Id$")
+
+// Constructor(s) and destructor.
+
+AST_Array::AST_Array (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType (),
+ pd_n_dims (0),
+ pd_dims (0),
+ pd_base_type (0),
+ owns_base_type_ (false)
+{
+}
+
+AST_Array::AST_Array (UTL_ScopedName *n,
+ unsigned long nd,
+ UTL_ExprList *ds,
+ bool local,
+ bool abstract)
+ : COMMON_Base (local,
+ abstract),
+ AST_Decl (AST_Decl::NT_array,
+ n,
+ true),
+ AST_Type (AST_Decl::NT_array,
+ n),
+ AST_ConcreteType (AST_Decl::NT_array,
+ n),
+ pd_n_dims (nd),
+ pd_base_type (0),
+ owns_base_type_ (false)
+{
+ this->pd_dims = this->compute_dims (ds,
+ nd);
+}
+
+AST_Array::~AST_Array (void)
+{
+}
+
+// Private operations.
+
+// Compute how many dimensions there are and collect their expressions
+// into an array.
+AST_Expression **
+AST_Array::compute_dims (UTL_ExprList *ds,
+ unsigned long nds)
+{
+ if (ds == 0)
+ {
+ return 0;
+ }
+
+ AST_Expression **result = 0;
+ ACE_NEW_RETURN (result,
+ AST_Expression *[nds],
+ 0);
+
+ UTL_ExprlistActiveIterator iter (ds);
+
+ for (unsigned long i = 0;
+ !iter.is_done () && i < nds;
+ iter.next (), i++)
+ {
+ AST_Expression *orig = iter.item ();
+ AST_Expression *copy = 0;
+ ACE_NEW_RETURN (copy,
+ AST_Expression (orig,
+ orig->ev ()->et),
+ 0);
+ result[i] = copy;
+ }
+
+ return result;
+}
+
+// Redefinition of inherited virtual operations.
+
+// Dump this AST_Array node to the ostream o.
+void
+AST_Array::dump (ACE_OSTREAM_TYPE &o)
+{
+ pd_base_type->dump (o);
+
+ this->dump_i (o, " ");
+
+ this->local_name ()->dump (o);
+
+ for (unsigned long i = 0; i < this->pd_n_dims; i++)
+ {
+ this->dump_i (o, "[");
+
+ pd_dims[i]->dump (o);
+
+ this->dump_i (o, "]");
+ }
+}
+
+int
+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 ());
+
+ this->has_constructor (type->has_constructor ());
+
+ return 0;
+}
+
+// Data accessors.
+unsigned long
+AST_Array::n_dims (void)
+{
+ return this->pd_n_dims;
+}
+
+AST_Expression **
+AST_Array::dims (void)
+{
+ return this->pd_dims;
+}
+
+AST_Type *
+AST_Array::base_type (void) const
+{
+ return this->pd_base_type;
+}
+
+void
+AST_Array::set_base_type (AST_Type *nbt)
+{
+ this->pd_base_type = nbt;
+
+ this->is_local_ = nbt->is_local ();
+
+ if (AST_Decl::NT_sequence == nbt->node_type ())
+ {
+ this->owns_base_type_ = true;
+ }
+}
+
+bool
+AST_Array::legal_for_primary_key (void) const
+{
+ return this->base_type ()->legal_for_primary_key ();
+}
+
+void
+AST_Array::destroy (void)
+{
+ if (this->owns_base_type_)
+ {
+ this->pd_base_type->destroy ();
+ delete this->pd_base_type;
+ this->pd_base_type = 0;
+ }
+
+ for (unsigned long i = 0; i < this->pd_n_dims; ++i)
+ {
+ this->pd_dims[i]->destroy ();
+ delete this->pd_dims[i];
+ this->pd_dims[i] = 0;
+ }
+
+ delete [] this->pd_dims;
+ this->pd_dims = 0;
+ this->pd_n_dims = 0;
+
+ this->AST_ConcreteType::destroy ();
+}
+
+void
+AST_Array::set_dims (AST_Expression **ds,
+ unsigned long nds)
+{
+ this->pd_dims = ds;
+ this->pd_n_dims = nds;
+}
+
+// Narrowing methods.
+IMPL_NARROW_METHODS1(AST_Array, AST_ConcreteType)
+IMPL_NARROW_FROM_DECL(AST_Array)
diff --git a/TAO/TAO_IDL/ast/ast_attribute.cpp b/TAO/TAO_IDL/ast/ast_attribute.cpp
new file mode 100644
index 00000000000..f85b62ed9fc
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_attribute.cpp
@@ -0,0 +1,323 @@
+// $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.
+
+*/
+
+// AST_Attribute nodes denote IDL attribute declarations.
+// AST_Attribute nodes are AST_Fields with a readonly indication.
+// Hence they have a name (an UTL_ScopedName), a type (a subtype
+// of AST_Type) and a boolean indicating whether the attribute is
+// readonly.
+
+#include "ast_attribute.h"
+#include "ast_exception.h"
+#include "ast_visitor.h"
+#include "utl_namelist.h"
+#include "utl_exceptlist.h"
+#include "utl_scope.h"
+#include "utl_err.h"
+#include "global_extern.h"
+
+ACE_RCSID (ast,
+ ast_attribute,
+ "$Id$")
+
+// Constructor(s) and destructor.
+AST_Attribute::AST_Attribute (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Field (),
+ pd_readonly (true),
+ pd_get_exceptions (0),
+ pd_set_exceptions (0)
+{
+}
+
+AST_Attribute::AST_Attribute (bool ro,
+ AST_Type *ft,
+ UTL_ScopedName *n,
+ bool local,
+ bool abstract)
+ : COMMON_Base (local,
+ abstract),
+ AST_Decl (AST_Decl::NT_attr,
+ n),
+ AST_Field (AST_Decl::NT_attr,
+ ft,
+ n),
+ pd_readonly (ro),
+ pd_get_exceptions (0),
+ pd_set_exceptions (0)
+{
+}
+
+AST_Attribute::~AST_Attribute (void)
+{
+}
+
+// Redefinition of inherited virtual operations.
+
+// Dump this AST_Attribute to the ostream o.
+void
+AST_Attribute::dump (ACE_OSTREAM_TYPE &o)
+{
+ this->dump_i (o, (this->pd_readonly == true ?
+ "readonly attribute " : "attribute "));
+ AST_Field::dump (o);
+}
+
+int
+AST_Attribute::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_attribute (this);
+}
+
+void
+AST_Attribute::destroy (void)
+{
+ // No need to delete our exception lists, the
+ // destroy() method does it. The UTL_ExceptList
+ // destroy() method does NOT delete the contained
+ // exception nodes.
+
+ if (this->pd_get_exceptions != 0)
+ {
+ this->pd_get_exceptions->destroy ();
+ this->pd_get_exceptions = 0;
+ }
+
+ if (this->pd_set_exceptions != 0)
+ {
+ this->pd_set_exceptions->destroy ();
+ this->pd_set_exceptions = 0;
+ }
+
+ this->AST_Field::destroy ();
+}
+
+UTL_ExceptList *
+AST_Attribute::be_add_get_exceptions (UTL_ExceptList *t)
+{
+ if (this->pd_get_exceptions != 0)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_RAISES,
+ this);
+ }
+ else
+ {
+ this->pd_get_exceptions = t;
+ }
+
+ return this->pd_get_exceptions;
+}
+
+UTL_ExceptList *
+AST_Attribute::be_add_set_exceptions (UTL_ExceptList *t)
+{
+ if (this->pd_set_exceptions != 0)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_RAISES,
+ this);
+ }
+ else
+ {
+ this->pd_set_exceptions = t;
+ }
+
+ return this->pd_set_exceptions;
+}
+
+// Data accessors.
+
+bool
+AST_Attribute::readonly (void) const
+{
+ return this->pd_readonly;
+}
+
+UTL_ExceptList *
+AST_Attribute::get_get_exceptions (void) const
+{
+ return this->pd_get_exceptions;
+}
+
+UTL_ExceptList *
+AST_Attribute::get_set_exceptions (void) const
+{
+ return this->pd_set_exceptions;
+}
+
+// NOTE: No attempt is made to ensure that exceptions are mentioned
+// only once..
+UTL_NameList *
+AST_Attribute::fe_add_get_exceptions (UTL_NameList *t)
+{
+ UTL_ScopedName *nl_n = 0;
+ AST_Exception *fe = 0;
+ AST_Decl *d = 0;
+
+ this->pd_get_exceptions = 0;
+
+ for (UTL_NamelistActiveIterator nl_i (t); !nl_i.is_done (); nl_i.next ())
+ {
+ nl_n = nl_i.item ();
+
+ d = this->defined_in ()->lookup_by_name (nl_n,
+ true);
+
+ if (d == 0 || d->node_type() != AST_Decl::NT_except)
+ {
+ idl_global->err ()->lookup_error (nl_n);
+ return 0;
+ }
+
+ fe = AST_Exception::narrow_from_decl (d);
+
+ if (fe == 0)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_RAISES,
+ this);
+ return 0;
+ }
+
+ if (this->pd_get_exceptions == 0)
+ {
+ ACE_NEW_RETURN (this->pd_get_exceptions,
+ UTL_ExceptList (fe,
+ 0),
+ 0);
+ }
+ else
+ {
+ UTL_ExceptList *el = 0;
+ ACE_NEW_RETURN (el,
+ UTL_ExceptList (fe,
+ 0),
+ 0);
+
+ this->pd_get_exceptions->nconc (el);
+ }
+ }
+
+ return t;
+}
+
+// NOTE: No attempt is made to ensure that exceptions are mentioned
+// only once..
+UTL_NameList *
+AST_Attribute::fe_add_set_exceptions (UTL_NameList *t)
+{
+ UTL_ScopedName *nl_n = 0;
+ AST_Exception *fe = 0;
+ AST_Decl *d = 0;
+
+ this->pd_set_exceptions = 0;
+
+ for (UTL_NamelistActiveIterator nl_i (t); !nl_i.is_done (); nl_i.next ())
+ {
+ nl_n = nl_i.item ();
+
+ d = this->defined_in ()->lookup_by_name (nl_n,
+ true);
+
+ if (d == 0 || d->node_type() != AST_Decl::NT_except)
+ {
+ idl_global->err ()->lookup_error (nl_n);
+ return 0;
+ }
+
+ fe = AST_Exception::narrow_from_decl (d);
+
+ if (fe == 0)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_RAISES,
+ this);
+ return 0;
+ }
+
+ if (this->pd_set_exceptions == 0)
+ {
+ ACE_NEW_RETURN (this->pd_set_exceptions,
+ UTL_ExceptList (fe,
+ 0),
+ 0);
+ }
+ else
+ {
+ UTL_ExceptList *el = 0;
+ ACE_NEW_RETURN (el,
+ UTL_ExceptList (fe,
+ 0),
+ 0);
+
+ this->pd_set_exceptions->nconc (el);
+ }
+ }
+
+ return t;
+}
+
+// Narrowing methods.
+IMPL_NARROW_METHODS1(AST_Attribute, AST_Field)
+IMPL_NARROW_FROM_DECL(AST_Attribute)
diff --git a/TAO/TAO_IDL/ast/ast_check.cpp b/TAO/TAO_IDL/ast/ast_check.cpp
new file mode 100644
index 00000000000..a4c1afcc73d
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_check.cpp
@@ -0,0 +1,146 @@
+// $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.
+
+*/
+
+// The check ensures that for every forward declared struct or union we also
+// saw a full definition.
+
+#include "global_extern.h"
+#include "utl_err.h"
+
+ACE_RCSID (ast,
+ ast_check,
+ "$Id$")
+
+// Static storage for remembering nodes.
+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 struct or union.
+void
+AST_record_fwd_decl (AST_Type *n)
+{
+ AST_Type **o_ast_fwds = 0;
+ long o_ast_n_fwds_alloc = 0;
+
+ // Make sure there's space to store one more.
+ if (ast_n_fwds_used == ast_n_fwds_alloc)
+ {
+ if (ast_n_fwds_alloc == 0)
+ {
+ ast_n_fwds_alloc = INCREMENT;
+ ACE_NEW (ast_fwds,
+ AST_Type *[ast_n_fwds_alloc]);
+ }
+ else
+ {
+ o_ast_fwds = ast_fwds;
+ o_ast_n_fwds_alloc = ast_n_fwds_alloc;
+
+ ast_n_fwds_alloc += INCREMENT;
+ ACE_NEW (ast_fwds,
+ AST_Type *[ast_n_fwds_alloc]);
+
+ for (long i = 0; i < o_ast_n_fwds_alloc; i++)
+ {
+ ast_fwds[i] = o_ast_fwds[i];
+ }
+
+ delete o_ast_fwds;
+ }
+ }
+
+ // Insert new node.
+ ast_fwds[ast_n_fwds_used++] = n;
+}
+
+// Check that all forward declared structs and unions were also defined.
+TAO_IDL_FE_Export void
+AST_check_fwd_decls (void)
+{
+ AST_Type *d = 0;
+
+ for (long i = 0; i < ast_n_fwds_used; ++i)
+ {
+ d = ast_fwds[i];
+
+ if (!d->is_defined ())
+ {
+ idl_global->err ()->fwd_decl_not_defined (d);
+ }
+ }
+
+ // This method is called once per file in the command line,
+ // in between which the elements of ast_fwds are destroyed,
+ // so we have to clean up.
+ delete [] ast_fwds;
+ ast_fwds = 0;
+ ast_n_fwds_alloc = 0;
+ ast_n_fwds_used = 0;
+}
diff --git a/TAO/TAO_IDL/ast/ast_component.cpp b/TAO/TAO_IDL/ast/ast_component.cpp
new file mode 100644
index 00000000000..6c9e2054984
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_component.cpp
@@ -0,0 +1,240 @@
+// $Id$
+
+#include "ast_component.h"
+#include "ast_attribute.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)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ UTL_Scope (),
+ AST_Interface (),
+ 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)
+ : COMMON_Base (false,
+ false),
+ AST_Decl (AST_Decl::NT_component,
+ n),
+ AST_Type (AST_Decl::NT_component,
+ n),
+ UTL_Scope (AST_Decl::NT_component),
+ AST_Interface (n,
+ supports,
+ n_supports,
+ supports_flat,
+ n_supports_flat,
+ false,
+ 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_Decl *
+AST_Component::look_in_inherited (UTL_ScopedName *e,
+ bool treat_as_ref)
+{
+ AST_Decl *d = 0;
+
+ if (this->pd_base_component != 0)
+ {
+ d = this->pd_base_component->lookup_by_name (e, treat_as_ref);
+ }
+
+ return d;
+}
+
+// Look through supported interface list.
+AST_Decl *
+AST_Component::look_in_supported (UTL_ScopedName *e,
+ bool treat_as_ref)
+{
+ AST_Decl *d = 0;
+ AST_Interface **is = 0;
+ long nis = -1;
+
+ // Can't look in an interface which was not yet defined.
+ if (!this->is_defined ())
+ {
+ idl_global->err ()->fwd_decl_lookup (this,
+ e);
+ return 0;
+ }
+
+ // OK, loop through supported interfaces.
+
+ // (Don't leave the inheritance hierarchy, no module or global ...)
+ // Find all and report ambiguous results as error.
+
+ for (nis = this->n_supports (), is = this->supports ();
+ nis > 0;
+ nis--, is++)
+ {
+ d = (*is)->lookup_by_name (e,
+ treat_as_ref,
+ 0 /* not in parent */);
+ if (d != 0)
+ {
+ break;
+ }
+ }
+
+ return d;
+}
+
+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::port_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)
+{
+ this->dump_i (o, "component ");
+
+ this->local_name ()->dump (o);
+
+ this->dump_i (o, " ");
+
+ if (this->pd_base_component != 0)
+ {
+ this->dump_i (o, ": ");
+ this->pd_base_component->local_name ()->dump (o);
+ }
+
+ if (this->pd_n_inherits > 0)
+ {
+ this->dump_i (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)
+ {
+ this->dump_i (o, ", ");
+ }
+ }
+ }
+
+ this->dump_i (o, " {\n");
+
+ UTL_Scope::dump (o);
+ idl_global->indent ()->skip_to (o);
+
+ this->dump_i (o, "}");
+}
+
+int
+AST_Component::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_component (this);
+}
+
+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..3f4a10f8a93
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_component_fwd.cpp
@@ -0,0 +1,61 @@
+// $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)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_InterfaceFwd ()
+{
+}
+
+AST_ComponentFwd::AST_ComponentFwd (AST_Interface *dummy,
+ UTL_ScopedName *n)
+ : COMMON_Base (true,
+ false),
+ AST_Decl (AST_Decl::NT_component_fwd,
+ n),
+ AST_Type (AST_Decl::NT_component_fwd,
+ n),
+ AST_InterfaceFwd (dummy,
+ n)
+{
+}
+
+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)
+{
+ this->dump_i (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
new file mode 100644
index 00000000000..ce30ecfff39
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_concrete_type.cpp
@@ -0,0 +1,106 @@
+// $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.
+
+*/
+
+// AST_ConcreteType nodes denote all non-interface types of IDL.
+// They are AST_Type nodes.
+
+#include "ast_concrete_type.h"
+
+ACE_RCSID (ast,
+ ast_concrete_type,
+ "$Id$")
+
+// Constructor(s) and destructor.
+AST_ConcreteType::AST_ConcreteType (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type ()
+{
+}
+
+AST_ConcreteType::AST_ConcreteType (AST_Decl::NodeType nt,
+ UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (nt,
+ n),
+ AST_Type (nt,
+ n)
+{
+}
+
+AST_ConcreteType::~AST_ConcreteType (void)
+{
+}
+
+void
+AST_ConcreteType::destroy (void)
+{
+ this->AST_Type::destroy ();
+}
+
+// Narrowing methods.
+IMPL_NARROW_METHODS1(AST_ConcreteType, AST_Type)
+IMPL_NARROW_FROM_DECL(AST_ConcreteType)
diff --git a/TAO/TAO_IDL/ast/ast_constant.cpp b/TAO/TAO_IDL/ast/ast_constant.cpp
new file mode 100644
index 00000000000..2ff7bad52cd
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_constant.cpp
@@ -0,0 +1,318 @@
+// $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.
+
+*/
+
+// AST_Constant nodes denote IDL constant declarations.
+// AST_Constants have a value (an AST_Expression) and a value type
+// (a value from the enum AST_Expression::ExprType).
+// AST_Constant has two constructors, one for use in creating constants
+// and the other for use in creating enumerators (see the class
+// AST_EnumVal).
+
+#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$")
+
+// Static functions.
+
+// Convert a value from the enum AST_Expression::ExprType to a char *.
+const char *
+AST_Constant::exprtype_to_string (AST_Expression::ExprType et)
+{
+ switch (et)
+ {
+ case AST_Expression::EV_short:
+ return "Short";
+ case AST_Expression::EV_ushort:
+ return "UShort";
+ case AST_Expression::EV_long:
+ return "Long";
+ case AST_Expression::EV_ulong:
+ return "ULong";
+ case AST_Expression::EV_float:
+ return "Float";
+ case AST_Expression::EV_double:
+ return "Double";
+ case AST_Expression::EV_char:
+ return "Char";
+ case AST_Expression::EV_octet:
+ return "Octet";
+ case AST_Expression::EV_bool:
+ return "Boolean";
+ case AST_Expression::EV_string:
+ return "Char*";
+ case AST_Expression::EV_ulonglong:
+ return "ULongLong";
+ case AST_Expression::EV_longlong:
+ return "LongLong";
+ case AST_Expression::EV_wchar:
+ return "Wchar";
+ case AST_Expression::EV_wstring:
+ return "Wchar*";
+ case AST_Expression::EV_longdouble:
+ return "LongDouble";
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+// Constructor(s) and destructor.
+
+// Default constructor.
+AST_Constant::AST_Constant (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ pd_constant_value (0),
+ pd_et (AST_Expression::EV_none),
+ ifr_added_ (0)
+{
+}
+
+// Used in constructing AST_EnumVal nodes.
+AST_Constant::AST_Constant (AST_Expression::ExprType t,
+ AST_Decl::NodeType nt,
+ AST_Expression *v,
+ UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (nt,
+ n),
+ pd_constant_value (v),
+ pd_et (t),
+ ifr_added_ (0)
+{
+}
+
+// Used when constructing AST_Constant nodes.
+AST_Constant::AST_Constant (AST_Expression::ExprType t,
+ AST_Expression *v,
+ UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_const,
+ n),
+ 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. Must also check that the input
+ // expression is of type double (indicates that we are being
+ // assigned from a literal). If v is of type float, it may be
+ // a constant-to-constant assignment - in any case the danger
+ // of truncation would not apply.
+ if (t == AST_Expression::EV_float && v->ev ()->et == AST_Expression::EV_double)
+ {
+ 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)
+{
+}
+
+// Redefinition of inherited virtual operations.
+
+// Dump this AST_Constant node to the ostream o.
+void
+AST_Constant::dump (ACE_OSTREAM_TYPE &o)
+{
+ this->dump_i (o, "const ");
+ this->dump_i (o, this->exprtype_to_string ());
+ this->dump_i (o, " ");
+
+ this->local_name ()->dump (o);
+
+ this->dump_i (o, " = ");
+
+ this->pd_constant_value->dump (o);
+}
+
+int
+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;
+ }
+
+ this->AST_Decl::destroy ();
+}
+
+// Data accessors.
+
+AST_Expression *
+AST_Constant::constant_value (void)
+{
+ return this->pd_constant_value;
+}
+
+AST_Expression::ExprType
+AST_Constant::et (void)
+{
+ return this->pd_et;
+}
+
+bool
+AST_Constant::ifr_added (void)
+{
+ return this->ifr_added_;
+}
+
+void
+AST_Constant::ifr_added (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_enum:
+ case AST_Expression::EV_longdouble:
+ case AST_Expression::EV_any:
+ case AST_Expression::EV_object:
+ 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
new file mode 100644
index 00000000000..4db72002251
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_decl.cpp
@@ -0,0 +1,1459 @@
+// $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.
+
+*/
+
+/*
+ * 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).
+ * Additionally AST_Decl nodes record the scope of definition, the
+ * file name in which they were defined, the line on which they were
+ * defined in that file, and a boolean denoting whether this is the
+ * main file or an #include'd file.
+ */
+
+#include "ast_interface.h"
+#include "ast_module.h"
+#include "ast_array.h"
+#include "ast_field.h"
+#include "ast_structure.h"
+#include "ast_sequence.h"
+#include "ast_string.h"
+#include "ast_typedef.h"
+#include "ast_visitor.h"
+#include "global_extern.h"
+#include "nr_extern.h"
+#include "utl_identifier.h"
+#include "utl_string.h"
+#include "utl_scope.h"
+#include "utl_err.h"
+#include "ace/OS_NS_stdio.h"
+
+// FUZZ: disable check_for_streams_include
+#include "ace/streams.h"
+
+ACE_RCSID (ast,
+ ast_decl,
+ "$Id$")
+
+COMMON_Base::COMMON_Base (bool local,
+ bool abstract)
+ : is_local_ (local),
+ is_abstract_ (abstract)
+{
+}
+
+bool
+COMMON_Base::is_local (void)
+{
+ return this->is_local_;
+}
+
+void
+COMMON_Base::is_local (bool val)
+{
+ this->is_local_ = val;
+}
+
+bool
+COMMON_Base::is_abstract (void) const
+{
+ return this->is_abstract_;
+}
+
+void
+COMMON_Base::is_abstract (bool val)
+{
+ this->is_abstract_ = val;
+}
+
+void
+COMMON_Base::destroy (void)
+{
+}
+
+// Constructor(s) and destructor.
+
+AST_Decl::AST_Decl (void)
+ : COMMON_Base (),
+ repoID_ (0),
+ flat_name_ (0),
+ contains_wstring_ (-1),
+ pd_imported (false),
+ pd_in_main_file (false),
+ pd_defined_in (0),
+ pd_node_type (NT_module),
+ pd_line (-1),
+ pd_local_name (0),
+ pd_original_local_name (0),
+ pd_added (false),
+ full_name_ (0),
+ prefix_ (0),
+ version_ (0),
+ anonymous_ (false),
+ typeid_set_ (false),
+ last_referenced_as_ (0),
+ prefix_scope_ (0)
+{
+}
+
+AST_Decl::AST_Decl (NodeType nt,
+ UTL_ScopedName *n,
+ bool anonymous)
+ : COMMON_Base (),
+ repoID_ (0),
+ flat_name_ (0),
+ contains_wstring_ (-1),
+ 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 ()
+ : 0),
+ pd_node_type (nt),
+ pd_line (idl_global->lineno ()),
+ pd_name (0),
+ pd_local_name (n == 0 ? 0 : n->last_component ()->copy ()),
+ pd_original_local_name (0),
+ pd_added (false),
+ full_name_ (0),
+ prefix_ (0),
+ version_ (0),
+ anonymous_ (anonymous),
+ typeid_set_ (false),
+ last_referenced_as_ (0),
+ prefix_scope_ (0)
+{
+ // If this is the root node, the filename won't have been set yet.
+ UTL_String *fn = idl_global->filename ();
+ this->pd_file_name = (fn != 0 ? fn->get_string () : "");
+
+ this->compute_full_name (n);
+
+ char *prefix = 0;
+ idl_global->pragma_prefixes ().top (prefix);
+
+ if (prefix == 0)
+ {
+ this->prefix_ = ACE::strnew ("");
+ }
+ else
+ {
+ this->prefix_ = ACE::strnew (prefix);
+ }
+
+ if (n != 0)
+ {
+ // The function body creates its own copy.
+ this->original_local_name (n->last_component ());
+ }
+
+ this->compute_repoID ();
+}
+
+AST_Decl::~AST_Decl (void)
+{
+}
+
+// Private operations.
+
+// Compute our private UTL_ScopedName member.
+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;
+
+ // Initialize this name to 0.
+ this->pd_name = 0;
+
+ // Global scope?
+ if (this->defined_in () == 0)
+ {
+ this->pd_name = (UTL_IdList *) n->copy ();
+ return;
+ }
+
+ // OK, not global. So copy name of containing scope, then
+ // smash last cdr of copy with new component
+ d = ScopeAsDecl (this->defined_in ());
+
+ if (d != 0)
+ {
+ cn = d->name ();
+ }
+
+ if (cn != 0)
+ {
+ this->pd_name = (UTL_IdList *) cn->copy ();
+ }
+
+ if (this->pd_local_name != 0)
+ {
+ if (this->pd_name == 0)
+ {
+ ACE_NEW (this->pd_name,
+ UTL_ScopedName (this->pd_local_name->copy (),
+ 0));
+ }
+ else
+ {
+ UTL_ScopedName *conc_name = 0;
+ ACE_NEW (conc_name,
+ UTL_ScopedName (this->pd_local_name->copy (),
+ 0));
+
+ this->pd_name->nconc (conc_name);
+ }
+ }
+}
+
+void
+AST_Decl::set_prefix_with_typeprefix_r (const char *value,
+ UTL_Scope *appeared_in)
+{
+ if (this->typeid_set_)
+ {
+ return;
+ }
+
+ if (this->prefix_scope_ != 0)
+ {
+ AST_Decl *decl = ScopeAsDecl (this->prefix_scope_);
+
+ bool const overridden =
+ decl->has_ancestor (ScopeAsDecl (appeared_in));
+
+ if (overridden)
+ {
+ return;
+ }
+ }
+
+ delete [] this->repoID_;
+ this->repoID_ = 0;
+ this->prefix (value);
+ this->prefix_scope_ = appeared_in;
+
+ UTL_Scope *s = DeclAsScope (this);
+
+ if (s != 0)
+ {
+ AST_Decl *tmp = 0;
+ UTL_Scope *s_tmp = 0;
+
+ for (UTL_ScopeActiveIterator i (s, UTL_Scope::IK_decls);
+ !i.is_done ();
+ i.next ())
+ {
+ tmp = i.item ();
+ s_tmp = DeclAsScope (tmp);
+
+ if (s_tmp == 0)
+ {
+ continue;
+ }
+
+ tmp->set_prefix_with_typeprefix_r (value,
+ appeared_in);
+ }
+ }
+
+ // This will recursively catch all previous openings of a module.
+ if (this->node_type () == AST_Decl::NT_module)
+ {
+ AST_Decl **d = 0;
+ AST_Module *m = AST_Module::narrow_from_decl (this);
+
+ for (ACE_Unbounded_Set_Iterator<AST_Decl *> iter (m->previous ());
+ !iter.done ();
+ iter.advance ())
+ {
+ iter.next (d);
+
+ if ((*d)->node_type () == AST_Decl::NT_pre_defined)
+ {
+ continue;
+ }
+
+ (*d)->set_prefix_with_typeprefix_r (value,
+ appeared_in);
+ }
+ }
+
+ this->compute_repoID ();
+}
+
+// Protected operations.
+
+// Compute stringified fully scoped name.
+void
+AST_Decl::compute_full_name (void)
+{
+ if (this->full_name_ != 0)
+ {
+ return;
+ }
+ else
+ {
+ size_t namelen = 0;
+ long first = true;
+ long second = false;
+ char *name = 0;
+
+ for (UTL_IdListActiveIterator i (this->name ());
+ !i.is_done ();
+ i.next ())
+ {
+ if (!first)
+ {
+ namelen += 2; // for "::"
+ }
+ else if (second)
+ {
+ first = second = false;
+ }
+
+ // Print the identifier.
+ name = i.item ()->get_string ();
+ namelen += ACE_OS::strlen (name);
+
+ if (first)
+ {
+ if (ACE_OS::strcmp (name, "") != 0)
+ {
+ // Does not start with a "".
+ first = false;
+ }
+ else
+ {
+ second = true;
+ }
+ }
+ }
+
+ ACE_NEW (this->full_name_,
+ char[namelen + 1]);
+
+ this->full_name_[0] = '\0';
+ first = true;
+ second = false;
+
+ for (UTL_IdListActiveIterator j (this->name ());
+ !j.is_done ();
+ j.next ())
+ {
+ if (!first)
+ {
+ ACE_OS::strcat (this->full_name_, "::");
+ }
+ else if (second)
+ {
+ first = second = false;
+ }
+
+ // Print the identifier.
+ name = j.item ()->get_string ();
+ ACE_OS::strcat (this->full_name_, name);
+
+ if (first)
+ {
+ if (ACE_OS::strcmp (name, "") != 0)
+ {
+ // Does not start with a "".
+ first = false;
+ }
+ else
+ {
+ second = true;
+ }
+ }
+ }
+ }
+}
+
+// Compute stringified repository ID.
+void
+AST_Decl::compute_repoID (void)
+{
+ if (this->repoID_ != 0)
+ {
+ return;
+ }
+
+ size_t namelen = 4; // for the prefix "IDL:"
+ long first = true;
+ long second = false;
+ char *name = 0;
+ const char *prefix = (this->prefix_ ? this->prefix_ : "");
+ UTL_Scope *scope = this->defined_in ();
+ const char *parent_prefix = 0;
+
+ // If our prefix is empty, we check to see if an ancestor has one.
+ while (ACE_OS::strcmp (prefix, "") == 0 && scope != 0)
+ {
+ AST_Decl *parent = ScopeAsDecl (scope);
+
+ if (parent->node_type () == AST_Decl::NT_root
+ && parent->imported ())
+ {
+ break;
+ }
+
+ parent_prefix = parent->prefix ();
+ prefix = (parent_prefix ? parent_prefix : "");
+ scope = parent->defined_in ();
+ }
+
+ // in the first loop compute the total length
+ namelen += ACE_OS::strlen (prefix) + 1;
+
+ const char *version = this->version_;
+ scope = this->defined_in ();
+
+ // If our version is has not bee set, we use the parent's, if any.
+ while (version == 0 && scope != 0)
+ {
+ AST_Decl *parent = ScopeAsDecl (scope);
+ version = parent->version_;
+ scope = parent->defined_in ();
+ }
+
+ if (version != 0)
+ {
+ // Version member string + ':'
+ namelen += ACE_OS::strlen (version) + 1;
+ }
+ else
+ {
+ // For ":1.0"
+ namelen += 4;
+ }
+
+ for (UTL_IdListActiveIterator i (this->name ());
+ !i.is_done ();
+ i.next ())
+ {
+ if (!first)
+ {
+ namelen += 1; // for "/"
+ }
+ else if (second)
+ {
+ first = second = false;
+ }
+
+ // Print the identifier.
+ name = i.item ()->get_string ();
+ size_t item_len = ACE_OS::strlen (name);
+
+ if (ACE_OS::strstr (name, "_cxx_") == name)
+ {
+ namelen += (item_len - ACE_OS::strlen ("_cxx_"));
+ }
+ else
+ {
+ namelen += item_len;
+ }
+
+ if (first)
+ {
+ if (ACE_OS::strcmp (name, "") != 0)
+ {
+ // Does not start with a "".
+ first = false;
+ }
+ else
+ {
+ second = true;
+ }
+ }
+ }
+
+ ACE_NEW (this->repoID_,
+ char[namelen + 1]);
+
+ this->repoID_[0] = '\0';
+
+ ACE_OS::sprintf (this->repoID_,
+ "%s",
+ "IDL:");
+
+ if (ACE_OS::strcmp (prefix, "") != 0)
+ {
+ ACE_OS::strcat (this->repoID_,
+ prefix);
+
+ ACE_OS::strcat (this->repoID_, "/");
+ }
+
+ first = true;
+ second = false;
+
+ for (UTL_IdListActiveIterator j (this->name ());
+ !j.is_done ();
+ j.next ())
+ {
+ if (!first)
+ {
+ ACE_OS::strcat (this->repoID_, "/");
+ }
+ else if (second)
+ {
+ first = second = false;
+ }
+
+ // Print the identifier.
+ name = j.item ()->get_string ();
+
+ if (ACE_OS::strstr (name, "_cxx_") == name)
+ {
+ ACE_OS::strcat (this->repoID_,
+ name + ACE_OS::strlen ("_cxx_"));
+ }
+ else
+ {
+ ACE_OS::strcat (this->repoID_,
+ name);
+ }
+
+ if (first)
+ {
+ if (ACE_OS::strcmp (name, "") != 0)
+ {
+ // Does not start with a "".
+ first = false;
+ }
+ else
+ {
+ second = true;
+ }
+ }
+ }
+
+ if (version != 0)
+ {
+ ACE_OS::strcat (this->repoID_,
+ ":");
+ ACE_OS::strcat (this->repoID_,
+ version);
+ }
+ else
+ {
+ ACE_OS::strcat (this->repoID_,
+ ":1.0");
+ }
+}
+
+// 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
+ {
+ size_t namelen = 0;
+ long first = true;
+ long second = 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 = 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 = false;
+ }
+ else
+ {
+ second = true;
+ }
+ }
+ }
+
+ ACE_NEW (this->flat_name_,
+ char[namelen + 1]);
+
+ this->flat_name_[0] = '\0';
+ first = true;
+ second = 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 = 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 = false;
+ }
+ else
+ {
+ second = true;
+ }
+ }
+ }
+ }
+}
+
+// Return TRUE if one of my ancestor scopes is "s"
+// and FALSE otherwise.
+bool
+AST_Decl::has_ancestor (AST_Decl *s)
+{
+ if (this == s)
+ {
+ return true;
+ }
+
+ if (s->node_type () == AST_Decl::NT_module)
+ {
+ UTL_Scope *enclosing = s->defined_in ();
+ AST_Decl *other_opening = s;
+
+ for (int index = 1; other_opening != 0; ++index)
+ {
+ if (this == other_opening)
+ {
+ return true;
+ }
+
+ other_opening = enclosing->lookup_by_name_local (s->local_name (),
+ index);
+ }
+ }
+
+ if (this->pd_defined_in == 0)
+ {
+ return false;
+ }
+
+ return ScopeAsDecl (this->pd_defined_in)->has_ancestor (s);
+}
+
+bool
+AST_Decl::is_child (AST_Decl *s)
+{
+ if (this->defined_in ())
+ {
+ AST_Decl *d = ScopeAsDecl (this->defined_in ());
+
+ if (d == 0)
+ {
+ return 0;
+ }
+
+ if (ACE_OS::strcmp (d->full_name (), s->full_name ()) == 0)
+ {
+ return 1;
+ }
+ }
+
+ return 0; // Not a child.
+}
+
+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 true;
+ }
+
+ return false;
+}
+
+// Dump this AST_Decl to the ostream o.
+void
+AST_Decl::dump (ACE_OSTREAM_TYPE &o)
+{
+ this->pd_local_name->dump (o);
+}
+
+void
+AST_Decl::dump_i (ACE_OSTREAM_TYPE &o, const char *s) const
+{
+ // Have to use ACE_CString here to avoid ambiguous overload error, see
+ // SString.h for an the overloaded operator << () methods.
+ o << ACE_CString(s);
+}
+
+int
+AST_Decl::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_decl (this);
+}
+
+void
+AST_Decl::destroy (void)
+{
+ // 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;
+ }
+
+ if (this->pd_local_name != 0)
+ {
+ this->pd_local_name->destroy ();
+ delete this->pd_local_name;
+ this->pd_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;
+ }
+
+ if (this->last_referenced_as_ != 0)
+ {
+ this->last_referenced_as_->destroy ();
+ delete this->last_referenced_as_;
+ this->last_referenced_as_ = 0;
+ }
+
+ delete [] this->full_name_;
+ this->full_name_ = 0;
+
+ delete [] this->repoID_;
+ this->repoID_ = 0;
+
+ delete [] this->prefix_;
+ this->prefix_ = 0;
+
+ delete [] this->version_;
+ this->version_ = 0;
+
+ delete [] this->flat_name_;
+ this->flat_name_ = 0;
+}
+
+// Data accessors.
+
+const char *
+AST_Decl::full_name (void)
+{
+ if (this->full_name_ == 0)
+ {
+ compute_full_name ();
+ }
+
+ return this->full_name_;
+}
+
+const char *
+AST_Decl::repoID (void)
+{
+ if (this->pd_node_type == NT_root)
+ {
+ delete [] this->repoID_;
+ this->repoID_ = ACE::strnew ("");
+ }
+
+ if (this->repoID_ == 0)
+ {
+ this->compute_repoID ();
+ }
+
+ return this->repoID_;
+}
+
+void
+AST_Decl::repoID (char *value)
+{
+ if (this->repoID_ != 0)
+ {
+ delete [] this->repoID_;
+ }
+
+ this->repoID_ = value;
+}
+
+const char *
+AST_Decl::prefix (void)
+{
+ return this->prefix_;
+}
+
+void
+AST_Decl::prefix (const char *value)
+{
+ delete [] this->prefix_;
+ this->prefix_ = ACE::strnew (value);
+}
+
+const char *
+AST_Decl::version (void)
+{
+ if (this->version_ == 0)
+ {
+ // Calling the method will compute if necessary.
+ const char *repo_id = this->repoID ();
+
+ // All forms of repo id should contain two colons, the
+ // version coming after the second one.
+ const char *tail1 = 0;
+ const char *tail2 = 0;
+
+ if (repo_id != 0)
+ {
+ tail1 = ACE_OS::strchr (repo_id,
+ ':');
+ }
+
+ if (tail1 != 0)
+ {
+ tail2 = ACE_OS::strchr (tail1 + 1,
+ ':');
+ }
+
+ if (! this->typeid_set_ && tail2 != 0)
+ {
+ this->version_ = ACE::strnew (tail2 + 1);
+ }
+ else
+ {
+ this->version_ = ACE::strnew ("1.0");
+ }
+ }
+
+ return this->version_;
+}
+
+void
+AST_Decl::version (char *value)
+{
+ // Previous #pragma version or #pragma id make this illegal.
+ if ((this->version_ == 0 || ACE_OS::strcmp (this->version_, value) == 0)
+ && ! this->typeid_set_)
+ {
+ delete [] this->version_;
+ this->version_ = value;
+
+ // Repo id is now computed eagerly, so a version set must update
+ // is as well.
+ if (this->repoID_ != 0)
+ {
+ ACE_CString tmp (this->repoID_);
+ ACE_CString::size_type const pos = tmp.rfind (':');
+
+ if (pos != ACE_CString::npos)
+ {
+ tmp = tmp.substr (0, pos + 1) + value;
+ delete [] this->repoID_;
+ this->repoID_ = ACE::strnew (tmp.fast_rep ());
+ }
+ }
+ }
+ else
+ {
+ idl_global->err ()->version_reset_error ();
+ }
+}
+
+bool
+AST_Decl::anonymous (void) const
+{
+ return this->anonymous_;
+}
+
+void
+AST_Decl::anonymous (bool val)
+{
+ this->anonymous_ = val;
+}
+
+bool
+AST_Decl::typeid_set (void) const
+{
+ return this->typeid_set_;
+}
+
+void
+AST_Decl::typeid_set (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_eventtype:
+ break;
+ default:
+ idl_global->err ()->error1 (UTL_Error::EIDL_INVALID_TYPEID,
+ this);
+
+ return;
+ }
+
+ delete [] this->repoID_;
+ this->repoID_ = 0;
+ this->repoID (ACE::strnew (value));
+ this->typeid_set_ = true;
+}
+
+void
+AST_Decl::set_prefix_with_typeprefix (const 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_valuetype:
+ case AST_Decl::NT_eventtype:
+ case AST_Decl::NT_struct:
+ case AST_Decl::NT_union:
+ case AST_Decl::NT_except:
+ break;
+ default:
+ idl_global->err ()->error1 (UTL_Error::EIDL_INVALID_TYPEPREFIX,
+ this);
+
+ return;
+ }
+
+ this->set_prefix_with_typeprefix_r (value,
+ DeclAsScope (this));
+}
+
+bool
+AST_Decl::imported (void)
+{
+ return this->pd_imported;
+}
+
+void
+AST_Decl::set_imported (bool is_it)
+{
+ this->pd_imported = is_it;
+}
+
+bool
+AST_Decl::in_main_file (void)
+{
+ return this->pd_in_main_file;
+}
+
+void
+AST_Decl::set_in_main_file (bool is_it)
+{
+ this->pd_in_main_file = is_it;
+}
+
+bool
+AST_Decl::added (void)
+{
+ return this->pd_added;
+}
+
+void
+AST_Decl::set_added (bool is_it)
+{
+ this->pd_added = is_it;
+}
+
+UTL_Scope *
+AST_Decl::defined_in (void)
+{
+ return this->pd_defined_in;
+}
+
+void
+AST_Decl::set_defined_in (UTL_Scope *s)
+{
+ this->pd_defined_in = s;
+}
+
+AST_Decl::NodeType
+AST_Decl::node_type (void)
+{
+ return this->pd_node_type;
+}
+
+long
+AST_Decl::line (void)
+{
+ return this->pd_line;
+}
+
+void
+AST_Decl::set_line (long l)
+{
+ this->pd_line = l;
+}
+
+ACE_CString
+AST_Decl::file_name (void)
+{
+ return this->pd_file_name;
+}
+
+void
+AST_Decl::set_file_name (ACE_CString s)
+{
+ this->pd_file_name = s;
+}
+
+UTL_ScopedName *
+AST_Decl::name (void)
+{
+ return this->pd_name;
+}
+
+// @@ Wherever compute_* are called, we should remember to delete them
+// after use.
+
+// Variation of the <name>. Computes scoped name string, applying
+// prefix and suffix to the local name component.
+UTL_ScopedName *
+AST_Decl::compute_name (const char *prefix,
+ const char *suffix)
+{
+ if (prefix == 0 || suffix == 0)
+ {
+ return 0;
+ }
+
+ UTL_ScopedName *result_name = 0;
+
+ // Prepare prefix_<local_name>_suffix string.
+
+ ACE_CString suffix_str (suffix);
+ ACE_CString local_str (this->local_name ()->get_string ());
+
+ ACE_CString result_local_str (prefix);
+ result_local_str += local_str;
+ result_local_str += suffix_str;
+
+ // Identifier for the resulting local name.
+ Identifier *result_local_id = 0;
+ ACE_NEW_RETURN (result_local_id,
+ Identifier (result_local_str.c_str ()),
+ 0);
+
+ // UTL_Scoped name for the resulting local name.
+ UTL_ScopedName *result_local_name = 0;
+ ACE_NEW_RETURN (result_local_name,
+ UTL_ScopedName (result_local_id,
+ 0),
+ 0);
+
+ // Global scope?
+ if (this->defined_in () == 0)
+ {
+ result_name = result_local_name;
+ }
+ else
+ {
+ // OK, not global. So copy name of containing scope, then
+ // smash last cdr of copy with new component.
+
+ AST_Decl *d = ScopeAsDecl (this->defined_in ());
+
+ if (d != 0)
+ {
+ UTL_ScopedName *cn = d->name ();
+
+ if (cn != 0)
+ {
+ result_name = (UTL_ScopedName *) cn->copy ();
+
+ if (result_name == 0)
+ {
+ result_name = result_local_name;
+ }
+ else
+ {
+ result_name->nconc (result_local_name);
+ }
+ }
+ }
+ }
+
+ return result_name;
+}
+
+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 != 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.
+ 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 ());
+ }
+}
+
+Identifier *
+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)
+{
+ if (prefix == 0 || suffix == 0)
+ {
+ return 0;
+ }
+
+ // Init the result with prefix.
+ ACE_CString result_str (prefix);
+
+ // Put local.
+ result_str += ACE_CString (this->local_name ()->get_string ());
+
+ // Put suffix.
+ result_str += ACE_CString (suffix);
+
+ // Identifier for the resulting local name.
+ Identifier *result_id = 0;
+ ACE_NEW_RETURN (result_id,
+ Identifier (result_str.c_str ()),
+ 0);
+
+ return result_id;
+}
+
+// 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_
+// prefix to the all the reserved keywords. But when we invoke the
+// operation remotely, we should be sending only the name with out
+// "_cxx_" prefix.
+void
+AST_Decl::original_local_name (Identifier *local_name)
+{
+ // Remove _cxx_ if it is present.
+ if (ACE_OS::strstr (local_name->get_string (),
+ "_cxx_")
+ == local_name->get_string ())
+ {
+ // CSting class is good to do this stuff.
+ ACE_CString name_str (local_name->get_string ());
+
+ // Remove _cxx_.
+ name_str = name_str.substr (ACE_OS::strlen ("_cxx_"));
+
+ // Assign to the Identifier variable.
+ ACE_NEW (this->pd_original_local_name,
+ Identifier (name_str.c_str ()));
+ }
+ else
+ {
+ this->pd_original_local_name = local_name->copy ();
+ }
+}
+
+Identifier *
+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)
+{
+ if (this->last_referenced_as_ != 0)
+ {
+ this->last_referenced_as_->destroy ();
+ }
+
+ delete this->last_referenced_as_;
+ this->last_referenced_as_ = n;
+}
+
+UTL_Scope *
+AST_Decl::prefix_scope (void)
+{
+ return this->prefix_scope_;
+}
+
+void
+AST_Decl::prefix_scope (UTL_Scope *s)
+{
+ this->prefix_scope_ = s;
+}
+
+// Container types will override this.
+int
+AST_Decl::contains_wstring (void)
+{
+ if (this->contains_wstring_ == -1)
+ {
+ switch (this->node_type ())
+ {
+ case AST_Decl::NT_array:
+ {
+ AST_Array *a = AST_Array::narrow_from_decl (this);
+ this->contains_wstring_ =
+ a->base_type ()->contains_wstring ();
+ break;
+ }
+ case AST_Decl::NT_except:
+ case AST_Decl::NT_struct:
+ case AST_Decl::NT_union:
+ {
+ AST_Structure *s = AST_Structure::narrow_from_decl (this);
+ this->contains_wstring_ =
+ s->contains_wstring ();
+ break;
+ }
+ case AST_Decl::NT_sequence:
+ {
+ AST_Sequence *s = AST_Sequence::narrow_from_decl (this);
+ this->contains_wstring_ =
+ s->base_type ()->contains_wstring ();
+ break;
+ }
+ case AST_Decl::NT_attr:
+ case AST_Decl::NT_field:
+ case AST_Decl::NT_union_branch:
+ {
+ AST_Field *f = AST_Field::narrow_from_decl (this);
+ this->contains_wstring_ =
+ f->field_type ()->contains_wstring ();
+ break;
+ }
+ case AST_Decl::NT_typedef:
+ {
+ AST_Typedef *td = AST_Typedef::narrow_from_decl (this);
+ this->contains_wstring_ =
+ td->primitive_base_type ()->contains_wstring ();
+ break;
+ }
+ case AST_Decl::NT_wstring:
+ this->contains_wstring_ = 1;
+ break;
+ default:
+ this->contains_wstring_ = 0;
+ break;
+ }
+ }
+
+ return this->contains_wstring_;
+}
+
+// Non-virtual - no need to override this one.
+void
+AST_Decl::contains_wstring (int val)
+{
+ this->contains_wstring_ = val;
+}
+
+//Narrowing methods for AST_Decl.
+IMPL_NARROW_METHODS0(AST_Decl)
+IMPL_NARROW_FROM_DECL(AST_Decl)
+
+// Narrowing methods for COMMON_Base.
+IMPL_NARROW_METHODS0(COMMON_Base)
diff --git a/TAO/TAO_IDL/ast/ast_enum.cpp b/TAO/TAO_IDL/ast/ast_enum.cpp
new file mode 100644
index 00000000000..37837f7e5a0
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_enum.cpp
@@ -0,0 +1,366 @@
+// $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.
+
+*/
+
+#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)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType (),
+ UTL_Scope (),
+ pd_enum_counter (0),
+ member_count_ (-1)
+{
+ this->size_type (AST_Type::FIXED);
+}
+
+AST_Enum::AST_Enum (UTL_ScopedName *n,
+ bool local,
+ bool abstract)
+ : COMMON_Base (local,
+ abstract),
+ AST_Decl (AST_Decl::NT_enum,
+ n),
+ AST_Type (AST_Decl::NT_enum,
+ n),
+ AST_ConcreteType (AST_Decl::NT_enum,
+ n),
+ UTL_Scope (AST_Decl::NT_enum),
+ pd_enum_counter (0),
+ member_count_ (-1)
+{
+ this->size_type (AST_Type::FIXED);
+}
+
+AST_Enum::~AST_Enum (void)
+{
+}
+
+// Return the member count.
+int
+AST_Enum::member_count (void)
+{
+ if (this->member_count_ == -1)
+ {
+ this->compute_member_count ();
+ }
+
+ return this->member_count_;
+}
+
+// Convert a numeric value to the string name
+UTL_ScopedName *
+AST_Enum::value_to_name (const unsigned long v)
+{
+ AST_EnumVal *item = 0;
+ AST_Decl *d = 0;
+
+ for (UTL_ScopeActiveIterator i (this, IK_decls);!i.is_done ();i.next ())
+ {
+ d = i.item ();
+ item = AST_EnumVal::narrow_from_decl (d);
+
+ if (item->constant_value ()->ev ()->u.ulval == v)
+ {
+ return item->name ();
+ }
+ }
+
+ return 0;
+}
+
+// Look up an enumerator by the value of the supplied expression.
+AST_EnumVal *
+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 ())
+ {
+ d = i.item ();
+ item = AST_EnumVal::narrow_from_decl (d);
+
+ if (item->constant_value () == v)
+ {
+ return item;
+ }
+ }
+
+ return 0;
+}
+
+// Compute the value to be assigned to the next enumerator. Bump the
+// counter.
+unsigned long
+AST_Enum::next_enum_val (void)
+{
+ unsigned long i = pd_enum_counter++;
+
+ return i;
+}
+
+// Static helper functions
+
+// Modify scoped name of an enumval so that it is scoped inside the scope
+// in which the enum is defined and not inside the enum itself
+static UTL_ScopedName *
+munge_name_for_enumval (UTL_ScopedName *n,
+ Identifier *last_component)
+{
+ long len = n->length ();
+ UTL_ScopedName *hold = n;
+
+ // Last three components are:
+ // - scope in which enum is defined
+ // - scope for enum
+ // - name of enumval
+
+ // We want to stop cdr'ing down the list when the head of the
+ // list is at the name for the scope in which the enum is defined.
+ while (len > 3)
+ {
+ len--;
+ n = (UTL_ScopedName *) n->tail ();
+ }
+
+ UTL_IdList *id = 0;
+ ACE_NEW_RETURN (id,
+ UTL_IdList (last_component->copy (),
+ 0),
+ 0);
+
+ n->set_tail (id);
+
+ return hold;
+}
+
+// Compute total number of members.
+int
+AST_Enum::compute_member_count (void)
+{
+ this->member_count_ = 0;
+
+ // If there are elements in this scope
+ if (this->nmembers () > 0)
+ {
+ for (UTL_ScopeActiveIterator i (this, IK_decls);
+ !i.is_done ();
+ i.next ())
+ {
+ // Get the next AST decl node.
+ ++this->member_count_;
+ }
+ }
+
+ return 0;
+}
+
+// Add an AST_EnumVal node to this scope.
+AST_EnumVal *
+AST_Enum::fe_add_enum_val (AST_EnumVal *t)
+{
+ AST_Decl *d = 0;
+ AST_EnumVal *t1 = 0;
+
+ if (t != 0)
+ {
+ AST_Expression::AST_ExprValue *ev =
+ t->constant_value ()->coerce (AST_Expression::EV_ulong);
+
+ t1 = idl_global->gen ()->create_enum_val (ev->u.ulval,
+ t->name ());
+
+ delete ev;
+ ev = 0;
+
+ UTL_ScopedName *sn =
+ munge_name_for_enumval ((UTL_IdList *) t->name ()->copy (),
+ t->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?
+ if ((d = this->lookup_for_add (t, 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,
+ false,
+ t->local_name ());
+
+ // Add it to enclosing scope.
+ idl_global->scopes ().next_to_top ()->fe_add_enum_val (t1);
+
+ return t;
+}
+
+// Redefinition of inherited virtual operations.
+
+// Dump this AST_Enum to the ostream o
+void
+AST_Enum::dump (ACE_OSTREAM_TYPE &o)
+{
+ AST_Decl *d = 0;
+
+ if (this->is_local ())
+ {
+ this->dump_i (o, "(local) ");
+ }
+ else if (this->is_abstract ())
+ {
+ this->dump_i (o, "(abstract) ");
+ }
+
+ this->dump_i (o, "enum ");
+
+ this->local_name ()->dump (o);
+
+ this->dump_i (o, " {\n");
+
+ // Must increment the iterator explicitly inside the loop.
+ for (UTL_ScopeActiveIterator i (this, IK_decls);!i.is_done ();)
+ {
+ d = i.item ();
+ d->local_name ()->dump (o);
+ i.next ();
+
+ if (!i.is_done ())
+ {
+ this->dump_i (o, ", ");
+ }
+ }
+
+ idl_global->indent ()->skip_to (o);
+
+ this->dump_i (o, "}");
+}
+
+int
+AST_Enum::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_enum (this);
+}
+
+void
+AST_Enum::destroy (void)
+{
+ this->UTL_Scope::destroy ();
+ this->AST_ConcreteType::destroy ();
+}
+
+
+// Narrowing methods
+IMPL_NARROW_METHODS2(AST_Enum, AST_ConcreteType, UTL_Scope)
+IMPL_NARROW_FROM_DECL(AST_Enum)
+IMPL_NARROW_FROM_SCOPE(AST_Enum)
diff --git a/TAO/TAO_IDL/ast/ast_enum_val.cpp b/TAO/TAO_IDL/ast/ast_enum_val.cpp
new file mode 100644
index 00000000000..cd8fc3a448b
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_enum_val.cpp
@@ -0,0 +1,118 @@
+// $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.
+
+*/
+
+// AST_EnumVals denote IDL enumerator declarations
+// AST_EnumVals are a subclass of AST_Constant
+// AST_EnumVals have no additional fields.
+
+#include "ast_enum_val.h"
+#include "ast_visitor.h"
+
+ACE_RCSID (ast,
+ ast_enum_val,
+ "$Id$")
+
+AST_EnumVal::AST_EnumVal (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Constant ()
+{
+}
+
+AST_EnumVal::AST_EnumVal (unsigned long v,
+ UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_enum_val,
+ n),
+ AST_Constant (AST_Expression::EV_ulong,
+ AST_Decl::NT_enum_val,
+ new AST_Expression (v),
+ n)
+{
+}
+
+AST_EnumVal::~AST_EnumVal (void)
+{
+}
+
+// Redefinition of inherited virtual operations.
+
+// Dump this AST_EnumVal to the ostream o.
+void
+AST_EnumVal::dump (ACE_OSTREAM_TYPE &o)
+{
+ AST_Constant::dump (o);
+}
+
+int
+AST_EnumVal::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_enum_val (this);
+}
+
+// Narrowing methods.
+IMPL_NARROW_METHODS1(AST_EnumVal, AST_Constant)
+IMPL_NARROW_FROM_DECL(AST_EnumVal)
diff --git a/TAO/TAO_IDL/ast/ast_eventtype.cpp b/TAO/TAO_IDL/ast/ast_eventtype.cpp
new file mode 100644
index 00000000000..7338bf6ef3d
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_eventtype.cpp
@@ -0,0 +1,142 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+#include "ast_eventtype.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+#include "utl_indenter.h"
+#include "global_extern.h"
+
+ACE_RCSID (ast,
+ ast_eventtype,
+ "$Id$")
+
+AST_EventType::AST_EventType (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ UTL_Scope (),
+ AST_Interface (),
+ AST_ValueType ()
+{
+}
+
+AST_EventType::AST_EventType (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,
+ bool abstract,
+ bool truncatable,
+ bool custom)
+ : COMMON_Base (false,
+ abstract),
+ AST_Decl (AST_Decl::NT_eventtype,
+ n),
+ AST_Type (AST_Decl::NT_eventtype,
+ n),
+ UTL_Scope (AST_Decl::NT_eventtype),
+ AST_Interface (n,
+ inherits,
+ n_inherits,
+ inherits_flat,
+ n_inherits_flat,
+ false,
+ abstract),
+ AST_ValueType (n,
+ inherits,
+ n_inherits,
+ inherits_concrete,
+ inherits_flat,
+ n_inherits_flat,
+ supports,
+ n_supports,
+ supports_concrete,
+ abstract,
+ truncatable,
+ custom)
+{
+}
+
+AST_EventType::~AST_EventType (void)
+{
+}
+
+void
+AST_EventType::destroy (void)
+{
+ this->AST_ValueType::destroy ();
+}
+
+void
+AST_EventType::dump (ACE_OSTREAM_TYPE &o)
+{
+ if (this->is_abstract ())
+ {
+ this->dump_i (o, "abstract ");
+ }
+ else if (this->pd_truncatable)
+ {
+ this->dump_i (o, "truncatable ");
+ }
+
+ this->dump_i (o, "eventtype ");
+
+ this->local_name ()->dump (o);
+ this->dump_i (o, " ");
+
+ if (this->pd_n_inherits > 0)
+ {
+ this->dump_i (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)
+ {
+ this->dump_i (o, ", ");
+ }
+ }
+ }
+
+ this->dump_i (o, "\n\n");
+
+ if (this->pd_n_supports > 0)
+ {
+ this->dump_i (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)
+ {
+ this->dump_i (o, ", ");
+ }
+ }
+ }
+
+ this->dump_i (o, " {\n");
+
+ UTL_Scope::dump (o);
+ idl_global->indent ()->skip_to (o);
+
+ this->dump_i (o, "}");
+}
+
+int
+AST_EventType::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_eventtype (this);
+}
+
+ // Narrowing.
+IMPL_NARROW_METHODS1(AST_EventType, AST_ValueType)
+IMPL_NARROW_FROM_DECL(AST_EventType)
+IMPL_NARROW_FROM_SCOPE(AST_EventType)
+
diff --git a/TAO/TAO_IDL/ast/ast_eventtype_fwd.cpp b/TAO/TAO_IDL/ast/ast_eventtype_fwd.cpp
new file mode 100644
index 00000000000..6bff9695525
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_eventtype_fwd.cpp
@@ -0,0 +1,69 @@
+// $Id$
+
+#include "ast_eventtype_fwd.h"
+#include "ast_interface.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+
+ACE_RCSID( ast,
+ ast_eventtype_fwd,
+ "$Id$")
+
+AST_EventTypeFwd::AST_EventTypeFwd (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_InterfaceFwd (),
+ AST_ValueTypeFwd ()
+{
+}
+
+AST_EventTypeFwd::AST_EventTypeFwd (AST_Interface *dummy,
+ UTL_ScopedName *n)
+ : COMMON_Base (false,
+ dummy->is_abstract ()),
+ AST_Decl (AST_Decl::NT_eventtype_fwd,
+ n),
+ AST_Type (AST_Decl::NT_eventtype_fwd,
+ n),
+ AST_InterfaceFwd (dummy,
+ n),
+ AST_ValueTypeFwd (dummy,
+ n)
+{
+}
+
+AST_EventTypeFwd::~AST_EventTypeFwd (void)
+{
+}
+
+// Redefinition of inherited virtual operations.
+
+// Dump this AST_InterfaceFwd node to the ostream o.
+void
+AST_EventTypeFwd::dump (ACE_OSTREAM_TYPE &o)
+{
+ if (this->is_abstract ())
+ {
+ this->dump_i (o, "abstract ");
+ }
+
+ this->dump_i (o, "eventtype ");
+
+ this->local_name ()->dump (o);
+}
+
+int
+AST_EventTypeFwd::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_eventtype_fwd (this);
+}
+
+void
+AST_EventTypeFwd::destroy (void)
+{
+}
+
+// Narrowing methods.
+IMPL_NARROW_METHODS1 (AST_EventTypeFwd, AST_ValueTypeFwd)
+IMPL_NARROW_FROM_DECL (AST_EventTypeFwd)
diff --git a/TAO/TAO_IDL/ast/ast_exception.cpp b/TAO/TAO_IDL/ast/ast_exception.cpp
new file mode 100644
index 00000000000..8f03d1bda61
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_exception.cpp
@@ -0,0 +1,446 @@
+// $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.
+
+*/
+
+// AST_Exceptions denote IDL exception declarations
+// AST_Exceptions are a subclass of AST_Decl (they are not types!)
+// and of UTL_Scope.
+
+#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$")
+
+AST_Exception::AST_Exception (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType (),
+ UTL_Scope (),
+ AST_Structure ()
+{
+}
+
+AST_Exception::AST_Exception (UTL_ScopedName *n,
+ bool local,
+ bool abstract)
+ : COMMON_Base (local,
+ abstract),
+ AST_Decl (AST_Decl::NT_except,
+ n),
+ AST_Type (AST_Decl::NT_except,
+ n),
+ AST_ConcreteType (AST_Decl::NT_except,
+ n),
+ UTL_Scope (AST_Decl::NT_except),
+ AST_Structure (AST_Decl::NT_except,
+ n,
+ local,
+ abstract)
+{
+}
+
+AST_Exception::~AST_Exception (void)
+{
+}
+
+// Public operations.
+
+// Are we or the parameter node involved in any recursion?
+bool
+AST_Exception::in_recursion (ACE_Unbounded_Queue<AST_Type *> &list)
+{
+ // Proceed if the number of members in our scope is greater than 0.
+ if (this->nmembers () > 0)
+ {
+ list.enqueue_tail (this);
+
+ // Continue until each element is visited.
+ for (UTL_ScopeActiveIterator i (this, IK_decls);!i.is_done ();i.next ())
+ {
+ AST_Field *field = AST_Field::narrow_from_decl (i.item ());
+
+ if (field == 0)
+ // This will be an enum value or other legitimate non-field
+ // member - in any case, no recursion.
+ {
+ continue;
+ }
+
+ AST_Type *type = field->field_type ();
+
+ if (type->node_type () == AST_Decl::NT_typedef)
+ {
+ AST_Typedef *td = AST_Typedef::narrow_from_decl (type);
+ type = td->primitive_base_type ();
+ }
+
+ if (type == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%N:%l) AST_Exception::")
+ ACE_TEXT ("in_recursion - ")
+ ACE_TEXT ("bad field type\n")),
+ 0);
+ }
+
+ if (type->in_recursion (list))
+ {
+ this->in_recursion_ = 1;
+ idl_global->recursive_type_seen_ = true;
+ return this->in_recursion_;
+ }
+ }
+ }
+
+ // Not in recursion.
+ this->in_recursion_ = 0;
+ return this->in_recursion_;
+}
+
+// Private operations.
+
+// Add this AST_Field node to the current scope.
+AST_Field *
+AST_Exception::fe_add_field (AST_Field *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, false)) != 0)
+ {
+ if (!can_be_redefined (d))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ this,
+ d);
+ return 0;
+ }
+
+ if (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,
+ 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,
+ false,
+ mru->first_component ());
+ }
+
+ this->fields_.enqueue_tail (t);
+
+ return t;
+}
+
+// Add this AST_Union (manifest type declaration) to the current scope.
+AST_Union *
+AST_Exception::fe_add_union (AST_Union *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, 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 local types.
+ this->add_to_local_types (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add this AST_Structure (manifest type declaration) to the current
+// scope.
+AST_Structure *
+AST_Exception::fe_add_structure (AST_Structure *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, false)) != 0)
+ {
+ if (!can_be_redefined (d))
+ {
+ idl_global->err ()->error2 (UTL_Error::EIDL_REDEF,
+ t,
+ this);
+ 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 local types.
+ this->add_to_local_types (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add this AST_Enum (manifest type declaration) to the current scope.
+AST_Enum *
+AST_Exception::fe_add_enum (AST_Enum *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, false)) != 0)
+ {
+ if (!can_be_redefined (d))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ this,
+ d);
+ return 0;
+ }
+
+ if (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 local types.
+ this->add_to_local_types (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add this AST_EnumVal (enumerator declaration) to the current 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_Exception::fe_add_enum_val (AST_EnumVal *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, false)) != 0)
+ {
+ if (!can_be_redefined (d))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ this,
+ d);
+ return 0;
+ }
+
+ if (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,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Dump this AST_Exception node to the ostream o.
+void
+AST_Exception::dump (ACE_OSTREAM_TYPE &o)
+{
+ this->dump_i (o, "exception ");
+ this->local_name ()->dump (o);
+ this->dump_i (o, " {\n");
+ UTL_Scope::dump (o);
+ idl_global->indent ()->skip_to (o);
+ this->dump_i (o, "}");
+}
+
+int
+AST_Exception::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_exception (this);
+}
+
+void
+AST_Exception::destroy (void)
+{
+ this->AST_Structure::destroy ();
+}
+
+// Narrowing methods.
+IMPL_NARROW_METHODS1(AST_Exception, AST_Structure)
+IMPL_NARROW_FROM_DECL(AST_Exception)
+IMPL_NARROW_FROM_SCOPE(AST_Exception)
diff --git a/TAO/TAO_IDL/ast/ast_expression.cpp b/TAO/TAO_IDL/ast/ast_expression.cpp
new file mode 100644
index 00000000000..2591325814a
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_expression.cpp
@@ -0,0 +1,3187 @@
+// $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.
+
+*/
+
+// AST_Expression nodes denote IDL expressions used in the IDL input.
+
+#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"
+
+// FUZZ: disable check_for_streams_include
+#include "ace/streams.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 ()
+ : 0 ;
+ this->pd_line = idl_global->lineno ();
+ this->pd_file_name = idl_global->filename ();
+}
+
+// Constructor(s) and destructor.
+
+// 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),
+ tdef (0)
+{
+ this->fill_definition_details ();
+}
+
+// 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),
+ tdef (0)
+{
+ this->fill_definition_details ();
+
+ // If we are here because one string constant has
+ // another one as its rhs, we must copy the UTL_String
+ // so both can be destroyed at cleanup.
+ if (EV_string == t)
+ {
+ ACE_NEW (this->pd_ev,
+ AST_ExprValue);
+
+ ACE_NEW (this->pd_ev->u.strval,
+ UTL_String (v->pd_ev->u.strval));
+
+ this->pd_ev->et = EV_string;
+ }
+ else if (EV_wstring == t)
+ {
+ ACE_NEW (this->pd_ev,
+ AST_ExprValue);
+
+ this->pd_ev->u.wstrval = ACE::strnew (v->pd_ev->u.wstrval);
+ this->pd_ev->et = EV_string;
+ }
+ else
+ {
+ this->pd_ev = v->coerce (t);
+
+ if (this->pd_ev == 0)
+ {
+ idl_global->err ()->coercion_error (v,
+ t);
+ }
+
+ if (0 != v->pd_n)
+ {
+ this->pd_n =
+ dynamic_cast<UTL_ScopedName *> (v->pd_n->copy ());
+ }
+ }
+}
+
+// An AST_Expression denoting a binary expression combination from
+// two other AST_Expressions.
+AST_Expression::AST_Expression (ExprComb c,
+ AST_Expression *ev1,
+ AST_Expression *ev2)
+ : pd_ec (c),
+ pd_ev (0),
+ pd_v1 (ev1),
+ pd_v2 (ev2),
+ pd_n (0),
+ tdef (0)
+{
+ this->fill_definition_details ();
+}
+
+// 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),
+ tdef (0)
+{
+ this->fill_definition_details ();
+
+ ACE_NEW (this->pd_ev,
+ AST_ExprValue);
+
+ this->pd_ev->et = EV_short;
+ this->pd_ev->u.sval = 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),
+ tdef (0)
+{
+ this->fill_definition_details ();
+
+ ACE_NEW (this->pd_ev,
+ AST_ExprValue);
+
+ this->pd_ev->et = EV_ushort;
+ this->pd_ev->u.usval = 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),
+ tdef (0)
+{
+ this->fill_definition_details ();
+
+ ACE_NEW (this->pd_ev,
+ AST_ExprValue);
+
+ this->pd_ev->et = EV_long;
+ this->pd_ev->u.lval = lv;
+}
+
+// An AST_Expression denoting a boolean.
+AST_Expression::AST_Expression (bool b)
+ : pd_ec (EC_none),
+ pd_ev (0),
+ pd_v1 (0),
+ pd_v2 (0),
+ pd_n (0),
+ tdef (0)
+{
+ this->fill_definition_details ();
+
+ ACE_NEW (this->pd_ev,
+ AST_ExprValue);
+
+ this->pd_ev->et = EV_bool;
+ this->pd_ev->u.bval = b;
+}
+
+// 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 (0),
+ tdef (0)
+{
+ this->fill_definition_details ();
+
+ ACE_NEW (this->pd_ev,
+ AST_ExprValue);
+
+ this->pd_ev->et = EV_ulong;
+ this->pd_ev->u.ulval = ulv;
+}
+
+// An AST_Expression denoting an unsigned long integer.
+AST_Expression::AST_Expression (idl_uns_long ulv,
+ ExprType t)
+ : pd_ec (EC_none),
+ pd_ev (0),
+ pd_v1 (0),
+ pd_v2 (0),
+ pd_n (0),
+ tdef (0)
+{
+ this->fill_definition_details ();
+
+ ACE_NEW (this->pd_ev,
+ AST_ExprValue);
+
+ this->pd_ev->et = t;
+#if defined (ACE_LACKS_LONGLONG_T)
+ this->pd_ev->u.ulval = ulv;
+#else
+ this->pd_ev->u.ullval = ulv;
+#endif
+}
+
+// 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),
+ tdef (0)
+{
+ this->fill_definition_details ();
+
+ ACE_NEW (this->pd_ev,
+ AST_ExprValue);
+
+ this->pd_ev->et = EV_float;
+ this->pd_ev->u.fval = 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 (0),
+ pd_n (0),
+ tdef (0)
+{
+ this->fill_definition_details ();
+
+ ACE_NEW (this->pd_ev,
+ AST_ExprValue);
+
+ this->pd_ev->et = EV_double;
+ this->pd_ev->u.dval = 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),
+ tdef (0)
+{
+ this->fill_definition_details ();
+
+ ACE_NEW (this->pd_ev,
+ AST_ExprValue);
+
+ this->pd_ev->et = EV_char;
+ this->pd_ev->u.cval = 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),
+ tdef (0)
+{
+ this->fill_definition_details ();
+
+ ACE_NEW (this->pd_ev,
+ AST_ExprValue);
+
+ this->pd_ev->et = EV_wchar;
+ this->pd_ev->u.wcval = wcv.val_;
+}
+
+// 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 (0),
+ tdef (0)
+{
+ this->fill_definition_details ();
+
+ ACE_NEW (this->pd_ev,
+ AST_ExprValue);
+
+ this->pd_ev->et = EV_octet;
+ this->pd_ev->u.oval = 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),
+ tdef (0)
+{
+ this->fill_definition_details ();
+
+ ACE_NEW (this->pd_ev,
+ AST_ExprValue);
+
+ UTL_String *new_str = 0;
+ ACE_NEW (new_str,
+ UTL_String (sv));
+
+ this->pd_ev->u.strval = new_str;
+ this->pd_ev->et = EV_string;
+}
+
+// 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),
+ tdef (0)
+{
+ this->fill_definition_details ();
+
+ ACE_NEW (this->pd_ev,
+ AST_ExprValue);
+
+ this->pd_ev->et = EV_wstring;
+ this->pd_ev->u.wstrval = sv;
+}
+
+AST_Expression::~AST_Expression (void)
+{
+}
+
+AST_Expression::AST_ExprValue::AST_ExprValue (void)
+{
+ this->u.ulval = 0UL;
+ this->et = AST_Expression::EV_none;
+}
+
+// Static operations.
+
+// Perform the coercion from the given AST_ExprValue to the requested
+// ExprType. Return an AST_ExprValue if successful, 0 if failed.
+static AST_Expression::AST_ExprValue *
+coerce_value (AST_Expression::AST_ExprValue *ev,
+ AST_Expression::ExprType t)
+{
+ if (ev == 0)
+ {
+ return 0;
+ }
+
+ switch (t)
+ {
+ case AST_Expression::EV_short:
+ switch (ev->et)
+ {
+ case AST_Expression::EV_short:
+ return ev;
+ case AST_Expression::EV_ushort:
+ if (ev->u.usval > (unsigned short) ACE_INT16_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.sval = (short) ev->u.usval;
+ ev->et = AST_Expression::EV_short;
+ return ev;
+ case AST_Expression::EV_long:
+ if (ev->u.lval > (long) ACE_INT16_MAX
+ || ev->u.lval < (long) ACE_INT16_MIN)
+ {
+ return 0;
+ }
+
+ ev->u.sval = (short) ev->u.lval;
+ ev->et = AST_Expression::EV_short;
+ return ev;
+ case AST_Expression::EV_ulong:
+ if (ev->u.ulval > (unsigned long) ACE_INT16_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.sval = (short) ev->u.ulval;
+ ev->et = AST_Expression::EV_short;
+ return ev;
+ case AST_Expression::EV_longlong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ if (ev->u.llval > (ACE_CDR::LongLong) ACE_INT16_MAX
+ || ev->u.llval < (ACE_CDR::LongLong) ACE_INT16_MIN)
+ {
+ return 0;
+ }
+
+ ev->u.sval = (short) ev->u.llval;
+ ev->et = AST_Expression::EV_short;
+ return ev;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_ulonglong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ if ((ev->u.ullval & ACE_INT16_MAX) != ev->u.ullval)
+ {
+ return 0;
+ }
+
+ ev->u.sval = (short) ev->u.ullval;
+ ev->et = AST_Expression::EV_short;
+ return ev;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_bool:
+ ev->u.sval = (short) ev->u.bval;
+ ev->et = AST_Expression::EV_short;
+ return ev;
+ case AST_Expression::EV_float:
+ if (ev->u.fval > (float) ACE_INT16_MAX
+ || ev->u.fval < (float) ACE_INT16_MIN)
+ {
+ return 0;
+ }
+
+ ev->u.sval = (short) ev->u.fval;
+ ev->et = AST_Expression::EV_short;
+ return ev;
+ case AST_Expression::EV_double:
+ if (ev->u.dval > (double) ACE_INT16_MAX
+ || ev->u.dval < (double) ACE_INT16_MIN)
+ {
+ return 0;
+ }
+
+ ev->u.sval = (short) ev->u.dval;
+ ev->et = AST_Expression::EV_short;
+ return ev;
+ case AST_Expression::EV_char:
+ ev->u.sval = (short) ev->u.cval;
+ ev->et = AST_Expression::EV_short;
+ return ev;
+ case AST_Expression::EV_wchar:
+ if (ev->u.wcval > (ACE_CDR::WChar) ACE_INT16_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.sval = (short) ev->u.wcval;
+ ev->et = AST_Expression::EV_short;
+ return ev;
+ case AST_Expression::EV_octet:
+ ev->u.sval = (short) ev->u.oval;
+ ev->et = AST_Expression::EV_short;
+ return ev;
+ case AST_Expression::EV_longdouble:
+ case AST_Expression::EV_string:
+ case AST_Expression::EV_wstring:
+ case AST_Expression::EV_enum:
+ case AST_Expression::EV_void:
+ case AST_Expression::EV_none:
+ case AST_Expression::EV_any:
+ case AST_Expression::EV_object:
+ return 0;
+ }
+ case AST_Expression::EV_ushort:
+ switch (ev->et)
+ {
+ case AST_Expression::EV_short:
+ if (ev->u.sval < 0)
+ {
+ return 0;
+ }
+
+ ev->u.usval = (unsigned short) ev->u.sval;
+ ev->et = AST_Expression::EV_ushort;
+ return ev;
+ case AST_Expression::EV_ushort:
+ return ev;
+ case AST_Expression::EV_long:
+ if (ev->u.lval > (long) ACE_UINT16_MAX
+ || ev->u.lval < 0)
+ {
+ return 0;
+ }
+
+ ev->u.usval = (unsigned short) ev->u.lval;
+ ev->et = AST_Expression::EV_ushort;
+ return ev;
+ case AST_Expression::EV_ulong:
+ if (ev->u.ulval > (unsigned long) ACE_UINT16_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.usval = (unsigned short) ev->u.ulval;
+ ev->et = AST_Expression::EV_ushort;
+ return ev;
+ case AST_Expression::EV_longlong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ if (ev->u.llval > (ACE_CDR::LongLong) ACE_UINT16_MAX
+ || ev->u.llval < 0)
+ {
+ return 0;
+ }
+
+ ev->u.usval = (unsigned short) ev->u.llval;
+ ev->et = AST_Expression::EV_ushort;
+ return ev;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_ulonglong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ if ((ev->u.ullval & ACE_UINT16_MAX) != ev->u.ullval)
+ {
+ return 0;
+ }
+
+ ev->u.usval = (unsigned short) ev->u.ullval;
+ ev->et = AST_Expression::EV_ushort;
+ return ev;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_bool:
+ ev->u.usval = (unsigned short) ev->u.bval;
+ ev->et = AST_Expression::EV_ushort;
+ return ev;
+ case AST_Expression::EV_float:
+ if (ev->u.fval < 0.0
+ || ev->u.fval > (float) ACE_UINT16_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.usval = (unsigned short) ev->u.fval;
+ ev->et = AST_Expression::EV_ushort;
+ return ev;
+ case AST_Expression::EV_double:
+ if (ev->u.dval < 0.0
+ || ev->u.dval > (double) ACE_UINT16_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.usval = (unsigned short) ev->u.dval;
+ ev->et = AST_Expression::EV_ushort;
+ return ev;
+ case AST_Expression::EV_char:
+ if ((signed char) ev->u.cval < 0)
+ {
+ return 0;
+ }
+
+ ev->u.usval = (unsigned short) ev->u.cval;
+ ev->et = AST_Expression::EV_ushort;
+ return ev;
+ case AST_Expression::EV_wchar:
+ ev->u.usval = (unsigned short) ev->u.wcval;
+ ev->et = AST_Expression::EV_ushort;
+ return ev;
+ case AST_Expression::EV_octet:
+ ev->u.usval = (unsigned short) ev->u.oval;
+ ev->et = AST_Expression::EV_ushort;
+ return ev;
+ case AST_Expression::EV_longdouble:
+ case AST_Expression::EV_wstring:
+ case AST_Expression::EV_string:
+ case AST_Expression::EV_enum:
+ case AST_Expression::EV_void:
+ case AST_Expression::EV_none:
+ case AST_Expression::EV_any:
+ case AST_Expression::EV_object:
+ return 0;
+ }
+ case AST_Expression::EV_long:
+ switch (ev->et)
+ {
+ case AST_Expression::EV_short:
+ ev->u.lval = (long) ev->u.sval;
+ ev->et = AST_Expression::EV_long;
+ return ev;
+ case AST_Expression::EV_ushort:
+ ev->u.lval = (long) ev->u.usval;
+ ev->et = AST_Expression::EV_long;
+ return ev;
+ case AST_Expression::EV_long:
+ return ev;
+ case AST_Expression::EV_ulong:
+ if (ev->u.ulval > (unsigned long) ACE_INT32_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.lval = (long) ev->u.ulval;
+ ev->et = AST_Expression::EV_long;
+ return ev;
+ case AST_Expression::EV_longlong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ if (ev->u.llval > (ACE_CDR::LongLong) ACE_INT32_MAX
+ || ev->u.llval < (ACE_CDR::LongLong) ACE_INT32_MIN)
+ {
+ return 0;
+ }
+ ev->u.lval = (long) ev->u.llval;
+ ev->et = AST_Expression::EV_long;
+ return ev;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_ulonglong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ if ((ev->u.ullval & ACE_INT32_MAX) != ev->u.ullval)
+ {
+ return 0;
+ }
+
+ ev->u.lval = (long) ev->u.ullval;
+ ev->et = AST_Expression::EV_long;
+ return ev;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_bool:
+ ev->u.lval = (long) ev->u.bval;
+ ev->et = AST_Expression::EV_long;
+ return ev;
+ case AST_Expression::EV_float:
+ if (ev->u.fval > (float) LONG_MAX
+ || ev->u.fval < (float) ACE_INT32_MIN)
+ {
+ return 0;
+ }
+
+ ev->u.lval = (long) ev->u.fval;
+ ev->et = AST_Expression::EV_long;
+ return ev;
+ case AST_Expression::EV_double:
+ if (ev->u.dval > (double) LONG_MAX
+ || ev->u.dval < (double) ACE_INT32_MIN)
+ {
+ return 0;
+ }
+
+ ev->u.lval = (long) ev->u.dval;
+ ev->et = AST_Expression::EV_long;
+ return ev;
+ case AST_Expression::EV_char:
+ ev->u.lval = (long) ev->u.cval;
+ ev->et = AST_Expression::EV_long;
+ return ev;
+ case AST_Expression::EV_wchar:
+ ev->u.lval = (long) ev->u.wcval;
+ ev->et = AST_Expression::EV_long;
+ return ev;
+ case AST_Expression::EV_octet:
+ ev->u.lval = (long) ev->u.oval;
+ ev->et = AST_Expression::EV_long;
+ return ev;
+ case AST_Expression::EV_longdouble:
+ case AST_Expression::EV_wstring:
+ case AST_Expression::EV_string:
+ case AST_Expression::EV_enum:
+ case AST_Expression::EV_void:
+ case AST_Expression::EV_none:
+ case AST_Expression::EV_any:
+ case AST_Expression::EV_object:
+ return 0;
+ }
+ case AST_Expression::EV_ulong:
+ switch (ev->et)
+ {
+ case AST_Expression::EV_short:
+ if (ev->u.sval < 0)
+ {
+ return 0;
+ }
+
+ ev->u.ulval = (unsigned long) ev->u.sval;
+ ev->et = AST_Expression::EV_ulong;
+ return ev;
+ case AST_Expression::EV_ushort:
+ ev->u.ulval = (unsigned long) ev->u.usval;
+ ev->et = AST_Expression::EV_ulong;
+ return ev;
+ case AST_Expression::EV_long:
+ if (ev->u.lval < 0)
+ {
+ return 0;
+ }
+
+ ev->u.ulval = (unsigned long) ev->u.lval;
+ ev->et = AST_Expression::EV_ulong;
+ return ev;
+ case AST_Expression::EV_ulong:
+ return ev;
+ case AST_Expression::EV_longlong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ if (ev->u.llval > (ACE_CDR::LongLong) ACE_UINT32_MAX
+ || ev->u.llval < 0)
+ {
+ return 0;
+ }
+
+ ev->u.ulval = (unsigned long) ev->u.llval;
+ ev->et = AST_Expression::EV_ulong;
+ return ev;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return NULL;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_ulonglong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ if ((ev->u.ullval & ACE_UINT32_MAX) != ev->u.ullval)
+ {
+ return 0;
+ }
+ ev->u.ulval = (unsigned long) ev->u.ullval;
+ ev->et = AST_Expression::EV_ulong;
+ return ev;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_bool:
+ ev->u.ulval = (unsigned long) ev->u.bval;
+ ev->et = AST_Expression::EV_ulong;
+ return ev;
+ case AST_Expression::EV_float:
+ if (ev->u.fval < 0.0
+ || ev->u.fval > (float) ACE_UINT32_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.ulval = (unsigned long) ev->u.fval;
+ ev->et = AST_Expression::EV_ulong;
+ return ev;
+ case AST_Expression::EV_double:
+ if (ev->u.dval < 0.0
+ || ev->u.dval > (double) ACE_UINT32_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.ulval = (unsigned long) ev->u.dval;
+ ev->et = AST_Expression::EV_ulong;
+ return ev;
+ case AST_Expression::EV_char:
+ if ((signed char) ev->u.cval < 0)
+ {
+ return 0;
+ }
+
+ ev->u.ulval = (unsigned long) ev->u.cval;
+ ev->et = AST_Expression::EV_ulong;
+ return ev;
+ case AST_Expression::EV_wchar:
+ ev->u.ulval = (unsigned long) ev->u.wcval;
+ ev->et = AST_Expression::EV_ulong;
+ return ev;
+ case AST_Expression::EV_octet:
+ ev->u.ulval = (unsigned long) ev->u.oval;
+ ev->et = AST_Expression::EV_ulong;
+ return ev;
+ case AST_Expression::EV_longdouble:
+ case AST_Expression::EV_wstring:
+ case AST_Expression::EV_string:
+ case AST_Expression::EV_enum:
+ case AST_Expression::EV_void:
+ case AST_Expression::EV_none:
+ case AST_Expression::EV_any:
+ case AST_Expression::EV_object:
+ return 0;
+ }
+ case AST_Expression::EV_longlong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ switch (ev->et)
+ {
+ case AST_Expression::EV_short:
+ ev->u.llval = (ACE_CDR::LongLong) ev->u.sval;
+ ev->et = AST_Expression::EV_longlong;
+ return ev;
+ case AST_Expression::EV_ushort:
+ ev->u.llval = (ACE_CDR::LongLong) ev->u.usval;
+ ev->et = AST_Expression::EV_longlong;
+ return ev;
+ case AST_Expression::EV_long:
+ ev->u.llval = (ACE_CDR::LongLong) ev->u.lval;
+ ev->et = AST_Expression::EV_longlong;
+ return ev;
+ case AST_Expression::EV_ulong:
+ ev->u.llval = (ACE_CDR::LongLong) ev->u.ulval;
+ ev->et = AST_Expression::EV_longlong;
+ return ev;
+ case AST_Expression::EV_longlong:
+ return ev;
+ case AST_Expression::EV_ulonglong:
+ if (ev->u.ullval > ACE_INT64_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.llval = (ACE_CDR::LongLong) ev->u.ullval;
+ ev->et = AST_Expression::EV_longlong;
+ return ev;
+ case AST_Expression::EV_bool:
+ ev->u.llval = (ACE_CDR::LongLong) ev->u.bval;
+ ev->et = AST_Expression::EV_longlong;
+ return ev;
+ case AST_Expression::EV_float:
+ if (ev->u.fval > (float) ACE_INT64_MAX
+ || ev->u.fval < (float) ACE_INT64_MIN)
+ {
+ return 0;
+ }
+
+ ev->u.llval = (ACE_CDR::LongLong) ev->u.fval;
+ ev->et = AST_Expression::EV_longlong;
+ return ev;
+ case AST_Expression::EV_double:
+ if (ev->u.dval > (double) ACE_INT64_MAX
+ || ev->u.dval < (double) ACE_INT64_MIN)
+ {
+ return 0;
+ }
+
+ ev->u.llval = (ACE_CDR::LongLong) ev->u.dval;
+ ev->et = AST_Expression::EV_longlong;
+ return ev;
+ case AST_Expression::EV_char:
+ ev->u.llval = (ACE_CDR::LongLong) ev->u.cval;
+ ev->et = AST_Expression::EV_longlong;
+ return ev;
+ case AST_Expression::EV_wchar:
+ ev->u.llval = (ACE_CDR::LongLong) ev->u.wcval;
+ ev->et = AST_Expression::EV_longlong;
+ return ev;
+ case AST_Expression::EV_octet:
+ ev->u.llval = (ACE_CDR::LongLong) ev->u.oval;
+ ev->et = AST_Expression::EV_longlong;
+ return ev;
+ case AST_Expression::EV_longdouble:
+ case AST_Expression::EV_wstring:
+ case AST_Expression::EV_string:
+ case AST_Expression::EV_enum:
+ case AST_Expression::EV_void:
+ case AST_Expression::EV_none:
+ case AST_Expression::EV_any:
+ case AST_Expression::EV_object:
+ return 0;
+ }
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_ulonglong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ switch (ev->et)
+ {
+ case AST_Expression::EV_short:
+ if (ev->u.sval < 0)
+ {
+ return 0;
+ }
+
+ ev->u.ullval = ev->u.sval;
+ ev->et = AST_Expression::EV_ulonglong;
+ return ev;
+ case AST_Expression::EV_ushort:
+ ev->u.ullval = ev->u.usval;
+ ev->et = AST_Expression::EV_ulonglong;
+ return ev;
+ case AST_Expression::EV_long:
+ if (ev->u.lval < 0)
+ {
+ return 0;
+ }
+
+ ev->u.ullval = ev->u.lval;
+ ev->et = AST_Expression::EV_ulonglong;
+ return ev;
+ case AST_Expression::EV_ulong:
+ ev->u.ullval = ev->u.ulval;
+ ev->et = AST_Expression::EV_ulonglong;
+ return ev;
+ case AST_Expression::EV_longlong:
+ if (ev->u.llval < 0)
+ {
+ return 0;
+ }
+
+ ev->u.ullval = (ACE_CDR::LongLong) ev->u.llval;
+ ev->et = AST_Expression::EV_ulonglong;
+ return ev;
+ case AST_Expression::EV_ulonglong:
+ return ev;
+ case AST_Expression::EV_bool:
+ ev->u.ullval = ev->u.bval;
+ ev->et = AST_Expression::EV_ulonglong;
+ return ev;
+ case AST_Expression::EV_float:
+#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
+ if (ev->u.fval < 0.0
+ || ev->u.fval > (float) ACE_INT64_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.ullval = static_cast<ACE_UINT32> (ev->u.fval);
+#else
+ if (ev->u.fval < 0.0
+ || ev->u.fval > (float) ACE_UINT64_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.ullval = static_cast<ACE_UINT64> (ev->u.fval);
+#endif
+
+ ev->et = AST_Expression::EV_ulonglong;
+ return ev;
+ case AST_Expression::EV_double:
+#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
+ if (ev->u.dval < 0.0
+ || ev->u.dval > (double) ACE_INT64_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.ullval = static_cast<ACE_UINT32> (ev->u.dval);
+#else
+ if (ev->u.dval < 0.0
+ || ev->u.dval > (double) ACE_UINT64_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.ullval = static_cast<ACE_UINT64> (ev->u.dval);
+#endif
+
+ ev->et = AST_Expression::EV_ulonglong;
+ return ev;
+ case AST_Expression::EV_char:
+ if ((signed char) ev->u.cval < 0)
+ {
+ return 0;
+ }
+
+ ev->u.ullval = ev->u.cval;
+ ev->et = AST_Expression::EV_ulonglong;
+ return ev;
+ case AST_Expression::EV_wchar:
+ ev->u.ullval = ev->u.wcval;
+ ev->et = AST_Expression::EV_ulonglong;
+ return ev;
+ case AST_Expression::EV_octet:
+ ev->u.ullval = ev->u.oval;
+ ev->et = AST_Expression::EV_ulonglong;
+ return ev;
+ case AST_Expression::EV_longdouble:
+ case AST_Expression::EV_wstring:
+ case AST_Expression::EV_string:
+ case AST_Expression::EV_enum:
+ case AST_Expression::EV_void:
+ case AST_Expression::EV_none:
+ case AST_Expression::EV_any:
+ case AST_Expression::EV_object:
+ return 0;
+ }
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_bool:
+ switch (ev->et)
+ {
+ case AST_Expression::EV_short:
+ ev->u.bval = (ev->u.sval == 0) ? false : true;
+ ev->et = AST_Expression::EV_bool;
+ return ev;
+ case AST_Expression::EV_ushort:
+ ev->u.bval = (ev->u.usval == 0) ? false : true;
+ ev->et = AST_Expression::EV_bool;
+ return ev;
+ case AST_Expression::EV_long:
+ ev->u.bval = (ev->u.lval == 0) ? false : true;
+ ev->et = AST_Expression::EV_bool;
+ return ev;
+ case AST_Expression::EV_ulong:
+ ev->u.bval = (ev->u.ulval == 0) ? false : true;
+ ev->et = AST_Expression::EV_bool;
+ return ev;
+ case AST_Expression::EV_longlong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ ev->u.bval = (ev->u.llval == 0) ? false : true;
+ ev->et = AST_Expression::EV_bool;
+ return ev;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_ulonglong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ ev->u.bval = (ev->u.ullval == 0) ? false : true;
+ ev->et = AST_Expression::EV_bool;
+ return ev;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_bool:
+ return ev;
+ case AST_Expression::EV_float:
+ ev->u.bval = (ev->u.fval == 0.0) ? false : true;
+ ev->et = AST_Expression::EV_bool;
+ return ev;
+ case AST_Expression::EV_double:
+ ev->u.bval = (ev->u.dval == 0.0) ? false : true;
+ ev->et = AST_Expression::EV_bool;
+ return ev;
+ case AST_Expression::EV_char:
+ ev->u.bval = (ev->u.cval == 0) ? false : true;
+ ev->et = AST_Expression::EV_bool;
+ return ev;
+ case AST_Expression::EV_wchar:
+ ev->u.bval = (ev->u.wcval == 0) ? false : true;
+ ev->et = AST_Expression::EV_bool;
+ return ev;
+ case AST_Expression::EV_octet:
+ ev->u.bval = (ev->u.oval == 0) ? false : true;
+ ev->et = AST_Expression::EV_bool;
+ return ev;
+ case AST_Expression::EV_longdouble:
+ case AST_Expression::EV_wstring:
+ case AST_Expression::EV_string:
+ case AST_Expression::EV_enum:
+ case AST_Expression::EV_void:
+ case AST_Expression::EV_none:
+ case AST_Expression::EV_any:
+ case AST_Expression::EV_object:
+ return 0;
+ }
+ case AST_Expression::EV_float:
+ switch (ev->et)
+ {
+ case AST_Expression::EV_short:
+ ev->u.fval = (float) ev->u.sval;
+ ev->et = AST_Expression::EV_float;
+ return ev;
+ case AST_Expression::EV_ushort:
+ ev->u.fval = (float) ev->u.usval;
+ ev->et = AST_Expression::EV_float;
+ return ev;
+ case AST_Expression::EV_long:
+ ev->u.fval = (float) ev->u.lval;
+ ev->et = AST_Expression::EV_float;
+ return ev;
+ case AST_Expression::EV_ulong:
+ ev->u.fval = (float) ev->u.ulval;
+ ev->et = AST_Expression::EV_float;
+ return ev;
+ case AST_Expression::EV_longlong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ if (ev->u.llval > FLT_MAX
+ || ev->u.llval < -(ACE_FLT_MAX))
+ {
+ return 0;
+ }
+ ev->u.fval = (float) ev->u.llval;
+ ev->et = AST_Expression::EV_float;
+ return ev;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_ulonglong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ ev->u.fval = (float) ((ACE_CDR::LongLong) ev->u.ullval);
+ ev->et = AST_Expression::EV_float;
+ return ev;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_bool:
+ ev->u.fval = (float) ((ev->u.bval == true) ? 1.0 : 0.0);
+ ev->et = AST_Expression::EV_float;
+ return ev;
+ case AST_Expression::EV_float:
+ return ev;
+ case AST_Expression::EV_double:
+ if (ev->u.dval > ACE_FLT_MAX
+ || ev->u.dval < -(ACE_FLT_MAX))
+ {
+ return 0;
+ }
+
+ ev->u.fval = (float) ev->u.dval;
+ ev->et = AST_Expression::EV_float;
+ return ev;
+ case AST_Expression::EV_char:
+ ev->u.fval = (float) ev->u.cval;
+ ev->et = AST_Expression::EV_float;
+ return ev;
+ case AST_Expression::EV_wchar:
+ ev->u.fval = (float) ev->u.wcval;
+ ev->et = AST_Expression::EV_float;
+ return ev;
+ case AST_Expression::EV_octet:
+ ev->u.fval = (float) ev->u.oval;
+ ev->et = AST_Expression::EV_float;
+ return ev;
+ case AST_Expression::EV_longdouble:
+ case AST_Expression::EV_wstring:
+ case AST_Expression::EV_string:
+ case AST_Expression::EV_enum:
+ case AST_Expression::EV_void:
+ case AST_Expression::EV_none:
+ case AST_Expression::EV_any:
+ case AST_Expression::EV_object:
+ return 0;
+ }
+ case AST_Expression::EV_double:
+ switch (ev->et)
+ {
+ case AST_Expression::EV_short:
+ ev->u.dval = (double) ev->u.sval;
+ ev->et = AST_Expression::EV_double;
+ return ev;
+ case AST_Expression::EV_ushort:
+ ev->u.dval = (double) ev->u.usval;
+ ev->et = AST_Expression::EV_double;
+ return ev;
+ case AST_Expression::EV_long:
+ ev->u.dval = (double) ev->u.lval;
+ ev->et = AST_Expression::EV_double;
+ return ev;
+ case AST_Expression::EV_ulong:
+ ev->u.dval = (double) ev->u.ulval;
+ ev->et = AST_Expression::EV_double;
+ return ev;
+ case AST_Expression::EV_longlong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ ev->u.dval = (double) ev->u.llval;
+ ev->et = AST_Expression::EV_double;
+ return ev;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_ulonglong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ // Some compilers don't implement unsigned 64-bit to double
+ // conversions, so we are stuck with the signed 64-bit max value.
+ if (ev->u.ullval > ACE_INT64_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.dval = (double) ((ACE_CDR::LongLong) ev->u.ullval);
+ ev->et = AST_Expression::EV_double;
+ return ev;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return NULL;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_bool:
+ ev->u.dval = (ev->u.bval == true) ? 1.0 : 0.0;
+ ev->et = AST_Expression::EV_double;
+ return ev;
+ case AST_Expression::EV_float:
+ ev->u.dval = (double) ev->u.fval;
+ ev->et = AST_Expression::EV_double;
+ return ev;
+ case AST_Expression::EV_double:
+ return ev;
+ case AST_Expression::EV_char:
+ ev->u.dval = (double) ev->u.cval;
+ ev->et = AST_Expression::EV_double;
+ return ev;
+ case AST_Expression::EV_wchar:
+ ev->u.dval = (double) ev->u.wcval;
+ ev->et = AST_Expression::EV_double;
+ return ev;
+ case AST_Expression::EV_octet:
+ ev->u.dval = (double) ev->u.oval;
+ ev->et = AST_Expression::EV_double;
+ return ev;
+ case AST_Expression::EV_longdouble:
+ case AST_Expression::EV_wstring:
+ case AST_Expression::EV_string:
+ case AST_Expression::EV_enum:
+ case AST_Expression::EV_void:
+ case AST_Expression::EV_none:
+ case AST_Expression::EV_any:
+ case AST_Expression::EV_object:
+ return 0;
+ }
+ case AST_Expression::EV_char:
+ switch (ev->et)
+ {
+ case AST_Expression::EV_short:
+ if (ev->u.sval > (short) ACE_CHAR_MAX
+ || ev->u.sval < (short) ACE_CHAR_MIN)
+ {
+ return 0;
+ }
+
+ ev->u.cval = (char) ev->u.sval;
+ ev->et = AST_Expression::EV_char;
+ return ev;
+ case AST_Expression::EV_ushort:
+ if (ev->u.usval > (unsigned short) ACE_CHAR_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.cval = (char) ev->u.usval;
+ ev->et = AST_Expression::EV_char;
+ return ev;
+ case AST_Expression::EV_long:
+ if (ev->u.lval > (long) ACE_CHAR_MAX
+ || ev->u.lval < (long) ACE_CHAR_MIN)
+ {
+ return 0;
+ }
+
+ ev->u.cval = (char) ev->u.lval;
+ ev->et = AST_Expression::EV_char;
+ return ev;
+ case AST_Expression::EV_ulong:
+ if (ev->u.ulval > (unsigned long) ACE_CHAR_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.cval = (char) ev->u.ulval;
+ ev->et = AST_Expression::EV_char;
+ return ev;
+ case AST_Expression::EV_longlong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ if (ev->u.llval > (ACE_CDR::LongLong) ACE_CHAR_MAX
+ || ev->u.llval < (ACE_CDR::LongLong) ACE_CHAR_MIN)
+ {
+ return 0;
+ }
+
+ ev->u.cval = (char) ev->u.llval;
+ ev->et = AST_Expression::EV_char;
+ return ev;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_ulonglong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ if (( ev->u.ullval & ACE_CHAR_MAX) != ev->u.ullval)
+ {
+ return 0;
+ }
+
+ ev->u.cval = (char) ev->u.ullval;
+ ev->et = AST_Expression::EV_char;
+ return ev;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_bool:
+ ev->u.cval = (char) ev->u.bval;
+ ev->et = AST_Expression::EV_char;
+ return ev;
+ case AST_Expression::EV_float:
+ if (ev->u.fval > (float) ACE_CHAR_MAX
+ || ev->u.fval < (float) ACE_CHAR_MIN)
+ {
+ return 0;
+ }
+
+ ev->u.cval = (char) ev->u.fval;
+ ev->et = AST_Expression::EV_char;
+ return ev;
+ case AST_Expression::EV_double:
+ if (ev->u.dval > (double) ACE_CHAR_MAX
+ || ev->u.dval < (double) ACE_CHAR_MIN)
+ {
+ return 0;
+ }
+
+ ev->u.cval = (char) ev->u.dval;
+ ev->et = AST_Expression::EV_char;
+ return ev;
+ case AST_Expression::EV_char:
+ return ev;
+ case AST_Expression::EV_wchar:
+ if (ev->u.wcval > (ACE_CDR::WChar) ACE_CHAR_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.cval = (char) ev->u.wcval;
+ ev->et = AST_Expression::EV_char;
+ return ev;
+ case AST_Expression::EV_octet:
+ if (ev->u.oval > (unsigned char) ACE_CHAR_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.cval = (char) ev->u.oval;
+ ev->et = AST_Expression::EV_char;
+ return ev;
+ case AST_Expression::EV_longdouble:
+ case AST_Expression::EV_wstring:
+ case AST_Expression::EV_string:
+ case AST_Expression::EV_enum:
+ case AST_Expression::EV_void:
+ case AST_Expression::EV_none:
+ case AST_Expression::EV_any:
+ case AST_Expression::EV_object:
+ return 0;
+ }
+ case AST_Expression::EV_wchar:
+ switch (ev->et)
+ {
+ case AST_Expression::EV_short:
+ if (ev->u.sval < 0)
+ {
+ return 0;
+ }
+
+ ev->u.wcval = (ACE_CDR::WChar) ev->u.sval;
+ ev->et = AST_Expression::EV_wchar;
+ return ev;
+ case AST_Expression::EV_ushort:
+ ev->u.wcval = (ACE_CDR::WChar) ev->u.usval;
+ ev->et = AST_Expression::EV_char;
+ return ev;
+ case AST_Expression::EV_long:
+ if (ev->u.lval < 0
+ || ev->u.lval > ACE_WCHAR_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.wcval = (ACE_CDR::WChar) ev->u.lval;
+ ev->et = AST_Expression::EV_wchar;
+ return ev;
+ case AST_Expression::EV_ulong:
+ if (ev->u.ulval > ACE_WCHAR_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.wcval = (ACE_CDR::WChar) ev->u.ulval;
+ ev->et = AST_Expression::EV_wchar;
+ return ev;
+ case AST_Expression::EV_longlong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ if (ev->u.llval > (ACE_CDR::LongLong) ACE_WCHAR_MAX
+ || ev->u.llval < 0)
+ {
+ return 0;
+ }
+
+ ev->u.wcval = (ACE_CDR::WChar) ev->u.llval;
+ ev->et = AST_Expression::EV_wchar;
+ return ev;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_ulonglong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ if ((ev->u.ullval & ACE_WCHAR_MAX) != ev->u.ullval )
+ {
+ return 0;
+ }
+
+ ev->u.wcval = (ACE_CDR::WChar) ev->u.ullval;
+ ev->et = AST_Expression::EV_wchar;
+ return ev;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_bool:
+ ev->u.wcval = (ACE_CDR::WChar) ev->u.bval;
+ ev->et = AST_Expression::EV_wchar;
+ return ev;
+ case AST_Expression::EV_float:
+ if (ev->u.fval > (float) ACE_WCHAR_MAX
+ || ev->u.fval < 0)
+ {
+ return 0;
+ }
+
+ ev->u.wcval = (ACE_CDR::WChar) ev->u.fval;
+ ev->et = AST_Expression::EV_wchar;
+ return ev;
+ case AST_Expression::EV_double:
+ if (ev->u.dval > (double) ACE_WCHAR_MAX
+ || ev->u.dval < 0)
+ {
+ return 0;
+ }
+
+ ev->u.wcval = (ACE_CDR::WChar) ev->u.dval;
+ ev->et = AST_Expression::EV_wchar;
+ return ev;
+ case AST_Expression::EV_char:
+ if ((signed char) ev->u.cval < 0)
+ {
+ return 0;
+ }
+
+ ev->u.wcval = (ACE_CDR::WChar) ev->u.cval;
+ ev->et = AST_Expression::EV_wchar;
+ return ev;
+ case AST_Expression::EV_wchar:
+ return ev;
+ case AST_Expression::EV_octet:
+ ev->u.wcval = (ACE_CDR::WChar) ev->u.oval;
+ ev->et = AST_Expression::EV_wchar;
+ return ev;
+ case AST_Expression::EV_longdouble:
+ case AST_Expression::EV_wstring:
+ case AST_Expression::EV_string:
+ case AST_Expression::EV_enum:
+ case AST_Expression::EV_void:
+ case AST_Expression::EV_none:
+ case AST_Expression::EV_any:
+ case AST_Expression::EV_object:
+ return 0;
+ }
+ case AST_Expression::EV_octet:
+ switch (ev->et)
+ {
+ case AST_Expression::EV_short:
+ if (ev->u.sval < 0
+ || ev->u.sval > (short) ACE_OCTET_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.oval = (unsigned char) ev->u.sval;
+ ev->et = AST_Expression::EV_octet;
+ return ev;
+ case AST_Expression::EV_ushort:
+ if (ev->u.usval > (unsigned short) ACE_OCTET_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.oval = (unsigned char) ev->u.usval;
+ ev->et = AST_Expression::EV_octet;
+ return ev;
+ case AST_Expression::EV_long:
+ if (ev->u.lval < 0
+ || ev->u.lval > (long) ACE_OCTET_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.oval = (unsigned char) ev->u.lval;
+ ev->et = AST_Expression::EV_octet;
+ return ev;
+ case AST_Expression::EV_ulong:
+ if (ev->u.ulval > (unsigned long) ACE_OCTET_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.oval = (unsigned char) ev->u.ulval;
+ ev->et = AST_Expression::EV_octet;
+ return ev;
+ case AST_Expression::EV_longlong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ if (ev->u.llval < 0
+ || ev->u.llval > (ACE_CDR::LongLong) ACE_OCTET_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.oval = (unsigned char) ev->u.llval;
+ ev->et = AST_Expression::EV_octet;
+ return ev;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_ulonglong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ if ((ev->u.ullval & ACE_OCTET_MAX) != ev->u.ullval)
+ {
+ return 0;
+ }
+
+ ev->u.oval = (unsigned char) ev->u.ullval;
+ ev->et = AST_Expression::EV_octet;
+ return ev;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EV_bool:
+ ev->u.oval = (unsigned char) ((ev->u.bval == false) ? 1 : 0);
+ ev->et = AST_Expression::EV_octet;
+ return ev;
+ case AST_Expression::EV_float:
+ if (ev->u.fval < 0.0
+ || ev->u.fval > (float) ACE_OCTET_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.oval = (unsigned char) ev->u.fval;
+ ev->et = AST_Expression::EV_octet;
+ return ev;
+ case AST_Expression::EV_double:
+ if (ev->u.dval < 0.0
+ || ev->u.dval > (double) ACE_OCTET_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.oval = (unsigned char) ev->u.dval;
+ ev->et = AST_Expression::EV_octet;
+ return ev;
+ case AST_Expression::EV_char:
+ if ((signed char) ev->u.cval < 0)
+ {
+ return 0;
+ }
+
+ ev->u.oval = (unsigned char) ev->u.cval;
+ ev->et = AST_Expression::EV_octet;
+ return ev;
+ case AST_Expression::EV_wchar:
+ if (ev->u.wcval > (ACE_CDR::WChar) ACE_OCTET_MAX)
+ {
+ return 0;
+ }
+
+ ev->u.oval = (unsigned char) ev->u.wcval;
+ ev->et = AST_Expression::EV_octet;
+ return ev;
+ case AST_Expression::EV_octet:
+ return ev;
+ case AST_Expression::EV_longdouble:
+ case AST_Expression::EV_wstring:
+ case AST_Expression::EV_string:
+ case AST_Expression::EV_enum:
+ case AST_Expression::EV_void:
+ case AST_Expression::EV_none:
+ case AST_Expression::EV_any:
+ case AST_Expression::EV_object:
+ return 0;
+ }
+ case AST_Expression::EV_enum:
+ switch (ev->et)
+ {
+ case AST_Expression::EV_enum:
+ case AST_Expression::EV_ulong:
+ return ev;
+ default:
+ return 0;
+ }
+ case AST_Expression::EV_void:
+ switch (ev->et)
+ {
+ case AST_Expression::EV_void:
+ return ev;
+ default:
+ return 0;
+ }
+ case AST_Expression::EV_none:
+ return 0;
+ case AST_Expression::EV_string:
+ switch (ev->et)
+ {
+ case AST_Expression::EV_string:
+ return ev;
+ default:
+ return 0;
+ }
+ case AST_Expression::EV_longdouble:
+ case AST_Expression::EV_wstring:
+ case AST_Expression::EV_any:
+ case AST_Expression::EV_object:
+ return 0;
+ }
+
+ return 0;
+}
+
+// Integer literals may not be assigned to floating point constants,
+// and vice versa.
+static 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
+// - EK_positive_int: The expression must further evaluate to a
+// positive integer
+
+// @@(JP) This just maps one enum to another. It's a temporary fix,
+// but AST_Expression::EvalKind should go eventually.
+static AST_Expression::AST_ExprValue *
+eval_kind (AST_Expression::AST_ExprValue *ev, AST_Expression::EvalKind ek)
+{
+ // Make a copy to simplify the memory management logic.
+ AST_Expression::AST_ExprValue *newval = 0;
+ ACE_NEW_RETURN (newval,
+ AST_Expression::AST_ExprValue,
+ 0);
+
+ if (ev != 0)
+ {
+ *newval = *ev;
+ }
+
+ AST_Expression::AST_ExprValue *retval = 0;
+
+ switch (ek)
+ {
+ case AST_Expression::EK_const:
+ retval = newval;
+ break;
+ case AST_Expression::EK_positive_int:
+ retval = coerce_value (newval, AST_Expression::EV_ulong);
+ break;
+ case AST_Expression::EK_short:
+ retval = coerce_value (newval, AST_Expression::EV_short);
+ break;
+ case AST_Expression::EK_ushort:
+ retval = coerce_value (newval, AST_Expression::EV_ushort);
+ break;
+ case AST_Expression::EK_long:
+ retval = coerce_value (newval, AST_Expression::EV_long);
+ break;
+ case AST_Expression::EK_ulong:
+ retval = coerce_value (newval, AST_Expression::EV_ulong);
+ break;
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ case AST_Expression::EK_longlong:
+ retval = coerce_value (newval, AST_Expression::EV_longlong);
+ break;
+ case AST_Expression::EK_ulonglong:
+ retval = coerce_value (newval, AST_Expression::EV_ulonglong);
+ break;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case AST_Expression::EK_octet:
+ retval = coerce_value (newval, AST_Expression::EV_octet);
+ break;
+ case AST_Expression::EK_bool:
+ retval = coerce_value (newval, AST_Expression::EV_bool);
+ break;
+ default:
+ break;
+ }
+
+ // Sometimes the call above to coerce_value() will return an
+ // evaluated newval, other times 0. But a heap-allocated
+ // ExprValue is not always passed to coerce_value(), so we
+ // have to manage it here, where we know it is always a 'new'.
+ if (retval != newval)
+ {
+ delete newval;
+ newval = 0;
+ }
+
+ return retval;
+}
+
+// Private operations.
+
+// @@@ (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 there are no checks here, only in coerce().
+
+// Apply binary operators to an AST_Expression after evaluating
+// its sub-expressions.
+// Operations supported: '+', '-', '*', '/'
+AST_Expression::AST_ExprValue *
+AST_Expression::eval_bin_op (AST_Expression::EvalKind ek)
+{
+ AST_ExprValue *retval = 0;
+
+ if (this->pd_v1 == 0 || this->pd_v2 == 0)
+ {
+ return 0;
+ }
+
+ this->pd_v1->set_ev (this->pd_v1->eval_internal (ek));
+ this->pd_v2->set_ev (this->pd_v2->eval_internal (ek));
+
+ if (this->pd_v1->ev () == 0 || this->pd_v2->ev () == 0)
+ {
+ return 0;
+ }
+
+ ACE_NEW_RETURN (retval,
+ AST_ExprValue,
+ 0);
+
+#if !defined (ACE_LACKS_LONGLONG_T)
+ if (ek == EK_ulonglong)
+ {
+ this->pd_v1->set_ev (this->pd_v1->coerce (EV_ulonglong));
+ this->pd_v2->set_ev (this->pd_v2->coerce (EV_ulonglong));
+ retval->et = EV_ulonglong;
+
+ switch (this->pd_ec)
+ {
+ case EC_add:
+ retval->u.ullval =
+ this->pd_v1->ev ()->u.ullval + this->pd_v2->ev ()->u.ullval;
+ break;
+ case EC_minus:
+ retval->u.ullval =
+ this->pd_v1->ev ()->u.ullval - this->pd_v2->ev ()->u.ullval;
+ break;
+ case EC_mul:
+ retval->u.ullval =
+ this->pd_v1->ev ()->u.ullval * this->pd_v2->ev ()->u.ullval;
+ break;
+ case EC_div:
+ if (this->pd_v2->ev ()->u.ullval == 0)
+ {
+ return 0;
+ }
+
+ retval->u.ullval =
+ this->pd_v1->ev ()->u.ullval / this->pd_v2->ev ()->u.ullval;
+ break;
+ default:
+ return 0;
+ }
+ }
+ else if (ek == EK_longlong)
+ {
+ this->pd_v1->set_ev (this->pd_v1->coerce (EV_longlong));
+ this->pd_v2->set_ev (this->pd_v2->coerce (EV_longlong));
+ retval->et = EV_longlong;
+
+ switch (this->pd_ec)
+ {
+ case EC_add:
+ retval->u.llval =
+ this->pd_v1->ev ()->u.llval + this->pd_v2->ev ()->u.llval;
+ break;
+ case EC_minus:
+ retval->u.llval =
+ this->pd_v1->ev ()->u.llval - this->pd_v2->ev ()->u.llval;
+ break;
+ case EC_mul:
+ retval->u.llval =
+ this->pd_v1->ev ()->u.llval * this->pd_v2->ev ()->u.llval;
+ break;
+ case EC_div:
+ if (this->pd_v2->ev ()->u.llval == 0)
+ {
+ return 0;
+ }
+
+ retval->u.llval =
+ this->pd_v1->ev ()->u.llval / this->pd_v2->ev ()->u.llval;
+ break;
+ default:
+ return 0;
+ }
+ }
+ else
+#endif
+ {
+ this->pd_v1->set_ev (this->pd_v1->coerce (EV_double));
+ this->pd_v2->set_ev (this->pd_v2->coerce (EV_double));
+ retval->et = EV_double;
+
+ switch (this->pd_ec)
+ {
+ case EC_add:
+ retval->u.dval =
+ this->pd_v1->ev ()->u.dval + this->pd_v2->ev ()->u.dval;
+ break;
+ case EC_minus:
+ retval->u.dval =
+ this->pd_v1->ev ()->u.dval - this->pd_v2->ev ()->u.dval;
+ break;
+ case EC_mul:
+ retval->u.dval =
+ this->pd_v1->ev ()->u.dval * this->pd_v2->ev ()->u.dval;
+ break;
+ case EC_div:
+ if (this->pd_v2->ev ()->u.dval == 0.0)
+ {
+ return 0;
+ }
+
+ retval->u.dval =
+ this->pd_v1->ev ()->u.dval / this->pd_v2->ev ()->u.dval;
+ break;
+ default:
+ return 0;
+ }
+ }
+
+ return retval;
+}
+// Apply binary operators to an AST_Expression after evaluating
+// its sub-expressions.
+// Operations supported: '%'
+AST_Expression::AST_ExprValue *
+AST_Expression::eval_mod_op (AST_Expression::EvalKind ek)
+{
+ AST_ExprValue *retval = 0;
+
+ if (this->pd_v1 == 0 || this->pd_v2 == 0)
+ {
+ return 0;
+ }
+
+ this->pd_v1->set_ev (this->pd_v1->eval_internal (ek));
+ this->pd_v2->set_ev (this->pd_v2->eval_internal (ek));
+
+ if (this->pd_v1->ev () == 0 || this->pd_v2->ev () == 0)
+ {
+ return 0;
+ }
+
+ ACE_NEW_RETURN (retval,
+ AST_ExprValue,
+ 0);
+
+#if !defined (ACE_LACKS_LONGLONG_T)
+ if (ek == EK_ulonglong)
+ {
+ this->pd_v1->set_ev (this->pd_v1->coerce (EV_ulonglong));
+ this->pd_v2->set_ev (this->pd_v2->coerce (EV_ulonglong));
+ retval->et = EV_ulonglong;
+
+ if (this->pd_v2->ev ()->u.ullval == 0)
+ {
+ return 0;
+ }
+
+ retval->u.ullval =
+ this->pd_v1->ev ()->u.ullval % this->pd_v2->ev ()->u.ullval;
+ }
+ else if (ek == EK_longlong)
+ {
+ this->pd_v1->set_ev (this->pd_v1->coerce (EV_longlong));
+ this->pd_v2->set_ev (this->pd_v2->coerce (EV_longlong));
+ retval->et = EV_longlong;
+
+ if (this->pd_v2->ev ()->u.llval == 0)
+ {
+ return 0;
+ }
+
+ retval->u.llval =
+ this->pd_v1->ev ()->u.llval % this->pd_v2->ev ()->u.llval;
+ }
+ else
+#endif
+ if (ek == EK_ulong)
+ {
+ this->pd_v1->set_ev (this->pd_v1->coerce (EV_ulong));
+ this->pd_v2->set_ev (this->pd_v2->coerce (EV_ulong));
+ retval->et = EV_ulong;
+
+ if (this->pd_v2->ev ()->u.ulval == 0)
+ {
+ return 0;
+ }
+
+ retval->u.ulval =
+ this->pd_v1->ev ()->u.ulval % this->pd_v2->ev ()->u.ulval;
+ }
+ else if (ek == EK_long)
+ {
+ this->pd_v1->set_ev (this->pd_v1->coerce (EV_long));
+ this->pd_v2->set_ev (this->pd_v2->coerce (EV_long));
+ retval->et = EV_long;
+
+ if (this->pd_v2->ev ()->u.lval == 0)
+ {
+ return 0;
+ }
+
+ retval->u.lval =
+ this->pd_v1->ev ()->u.lval % this->pd_v2->ev ()->u.lval;
+ }
+ else
+ {
+ return 0;
+ }
+
+ return retval;
+}
+
+// Apply bitwise operations to an AST_Expression after evaluating
+// its sub-expressions.
+// Operations supported: '%', '|', '&', '^', '<<', '>>'
+AST_Expression::AST_ExprValue *
+AST_Expression::eval_bit_op (AST_Expression::EvalKind ek)
+{
+ AST_Expression::AST_ExprValue *retval = 0;
+
+ if (this->pd_v1 == 0 || this->pd_v2 == 0)
+ {
+ return 0;
+ }
+
+ this->pd_v1->set_ev (this->pd_v1->eval_internal (ek));
+ this->pd_v2->set_ev (this->pd_v2->eval_internal (ek));
+
+ if (this->pd_v1->ev () == 0 || this->pd_v2->ev () == 0 )
+ {
+ return 0;
+ }
+
+ ACE_NEW_RETURN (retval,
+ AST_ExprValue,
+ 0);
+
+#if !defined (ACE_LACKS_LONGLONG_T)
+ if (ek == EK_ulonglong)
+ {
+ this->pd_v1->set_ev (this->pd_v1->coerce (EV_ulonglong));
+ this->pd_v2->set_ev (this->pd_v2->coerce (EV_ulonglong));
+ retval->et = EV_ulonglong;
+
+ switch (this->pd_ec)
+ {
+ case EC_or:
+ retval->u.ullval =
+ this->pd_v1->ev ()->u.ullval | this->pd_v2->ev ()->u.ullval;
+ break;
+ case EC_xor:
+ retval->u.ullval =
+ this->pd_v1->ev ()->u.ullval ^ this->pd_v2->ev ()->u.ullval;
+ break;
+ case EC_and:
+ retval->u.ullval =
+ this->pd_v1->ev ()->u.ullval & this->pd_v2->ev ()->u.ullval;
+ break;
+ case EC_left:
+ retval->u.ullval =
+ this->pd_v1->ev ()->u.ullval << this->pd_v2->ev ()->u.ullval;
+ break;
+ case EC_right:
+ retval->u.ullval =
+ this->pd_v1->ev ()->u.ullval >> this->pd_v2->ev ()->u.ullval;
+ break;
+ default:
+ return 0;
+ }
+ }
+ else if (ek == EK_longlong)
+ {
+ this->pd_v1->set_ev (this->pd_v1->coerce (EV_longlong));
+ this->pd_v2->set_ev (this->pd_v2->coerce (EV_longlong));
+ retval->et = EV_longlong;
+
+ switch (this->pd_ec)
+ {
+ case EC_or:
+ retval->u.llval =
+ this->pd_v1->ev ()->u.llval | this->pd_v2->ev ()->u.llval;
+ break;
+ case EC_xor:
+ retval->u.llval =
+ this->pd_v1->ev ()->u.llval ^ this->pd_v2->ev ()->u.llval;
+ break;
+ case EC_and:
+ retval->u.llval =
+ this->pd_v1->ev ()->u.llval & this->pd_v2->ev ()->u.llval;
+ break;
+ case EC_left:
+ retval->u.llval =
+ this->pd_v1->ev ()->u.llval << this->pd_v2->ev ()->u.llval;
+ break;
+ case EC_right:
+ retval->u.llval =
+ this->pd_v1->ev ()->u.llval >> this->pd_v2->ev ()->u.llval;
+ break;
+ default:
+ return 0;
+ }
+ }
+ else
+#endif
+ if (ek == EK_ulong)
+ {
+ this->pd_v1->set_ev (this->pd_v1->coerce (EV_ulong));
+ this->pd_v2->set_ev (this->pd_v2->coerce (EV_ulong));
+ retval->et = EV_ulong;
+
+ switch (this->pd_ec)
+ {
+ case EC_or:
+ retval->u.ulval =
+ this->pd_v1->ev ()->u.ulval | this->pd_v2->ev ()->u.ulval;
+ break;
+ case EC_xor:
+ retval->u.ulval =
+ this->pd_v1->ev ()->u.ulval ^ this->pd_v2->ev ()->u.ulval;
+ break;
+ case EC_and:
+ retval->u.ulval =
+ this->pd_v1->ev ()->u.ulval & this->pd_v2->ev ()->u.ulval;
+ break;
+ case EC_left:
+ retval->u.ulval =
+ this->pd_v1->ev ()->u.ulval << this->pd_v2->ev ()->u.ulval;
+ break;
+ case EC_right:
+ retval->u.ulval =
+ this->pd_v1->ev ()->u.ulval >> this->pd_v2->ev ()->u.ulval;
+ break;
+ default:
+ return 0;
+ }
+ }
+ else if (ek == EK_long)
+ {
+ this->pd_v1->set_ev (this->pd_v1->coerce (EV_long));
+ this->pd_v2->set_ev (this->pd_v2->coerce (EV_long));
+ retval->et = EV_long;
+
+ switch (this->pd_ec)
+ {
+ case EC_or:
+ retval->u.lval =
+ this->pd_v1->ev ()->u.lval | this->pd_v2->ev ()->u.lval;
+ break;
+ case EC_xor:
+ retval->u.lval =
+ this->pd_v1->ev ()->u.lval ^ this->pd_v2->ev ()->u.lval;
+ break;
+ case EC_and:
+ retval->u.lval =
+ this->pd_v1->ev ()->u.lval & this->pd_v2->ev ()->u.lval;
+ break;
+ case EC_left:
+ retval->u.lval =
+ this->pd_v1->ev ()->u.lval << this->pd_v2->ev ()->u.lval;
+ break;
+ case EC_right:
+ retval->u.lval =
+ this->pd_v1->ev ()->u.lval >> this->pd_v2->ev ()->u.lval;
+ break;
+ default:
+ return 0;
+ }
+ }
+ else if (ek == EK_bool)
+ {
+ this->pd_v1->set_ev (this->pd_v1->coerce (EV_bool));
+ this->pd_v2->set_ev (this->pd_v2->coerce (EV_bool));
+ retval->et = EV_bool;
+
+ switch (this->pd_ec)
+ {
+ case EC_or:
+ retval->u.bval =
+ this->pd_v1->ev ()->u.bval | this->pd_v2->ev ()->u.bval;
+ break;
+ case EC_xor:
+ retval->u.bval =
+ this->pd_v1->ev ()->u.bval ^ this->pd_v2->ev ()->u.bval;
+ break;
+ case EC_and:
+ retval->u.bval =
+ this->pd_v1->ev ()->u.bval & this->pd_v2->ev ()->u.bval;
+ break;
+ case EC_left:
+ retval->u.bval =
+ this->pd_v1->ev ()->u.ulval << this->pd_v2->ev ()->u.ulval;
+ break;
+ case EC_right:
+ retval->u.bval =
+ this->pd_v1->ev ()->u.ulval >> this->pd_v2->ev ()->u.ulval;
+ break;
+ default:
+ return 0;
+ }
+ }
+ else
+ {
+ return 0;
+ }
+
+ return retval;
+}
+
+// Apply unary operators to an AST_Expression after evaluating its
+// sub-expression.
+// Operations supported: '-', '+', '~'
+AST_Expression::AST_ExprValue *
+AST_Expression::eval_un_op (AST_Expression::EvalKind ek)
+{
+ AST_ExprValue *retval = 0;
+
+ if (this->pd_ev != 0)
+ {
+ return this->pd_ev;
+ }
+
+ if (this->pd_v1 == 0)
+ {
+ return 0;
+ }
+
+ this->pd_v1->set_ev (this->pd_v1->eval_internal (ek));
+
+ if (this->pd_v1->ev () == 0)
+ {
+ return 0;
+ }
+
+ ACE_NEW_RETURN (retval,
+ AST_ExprValue,
+ 0);
+
+ retval->et = EV_double;
+
+ switch (this->pd_ec)
+ {
+ case EC_u_plus:
+ this->pd_v1->set_ev (this->pd_v1->coerce (EV_double));
+
+ if (this->pd_v1->ev () == 0)
+ {
+ return 0;
+ }
+
+ retval->u.dval = this->pd_v1->ev ()->u.dval;
+ break;
+ case EC_u_minus:
+ this->pd_v1->set_ev (this->pd_v1->coerce (EV_double));
+
+ if (this->pd_v1->ev () == 0)
+ {
+ return 0;
+ }
+
+ retval->u.dval = -(this->pd_v1->ev ()->u.dval);
+ break;
+ case EC_bit_neg:
+ if (this->pd_v1->ev () == 0)
+ {
+ return 0;
+ }
+
+ switch (this->pd_v1->ev ()->et)
+ {
+ case EV_short:
+ retval->et = EV_short;
+ retval->u.sval = ~this->pd_v1->ev ()->u.sval;
+ break;
+ case EV_ushort:
+ retval->et = EV_ushort;
+ retval->u.usval = ~this->pd_v1->ev ()->u.usval;
+ break;
+ case EV_long:
+ retval->et = EV_long;
+ retval->u.lval = ~this->pd_v1->ev ()->u.lval;
+ break;
+ case EV_ulong:
+ retval->et = EV_ulong;
+ retval->u.ulval = ~this->pd_v1->ev ()->u.ulval;
+ break;
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ case EV_longlong:
+ retval->et = EV_longlong;
+ retval->u.llval = ~this->pd_v1->ev ()->u.llval;
+ break;
+ case EV_ulonglong:
+ retval->et = EV_ulonglong;
+ retval->u.ullval = ~this->pd_v1->ev ()->u.ullval;
+ break;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case EV_octet:
+ retval->et = EV_octet;
+ retval->u.oval = ~this->pd_v1->ev ()->u.oval;
+ break;
+ default:
+ return 0;
+ }
+
+ break;
+ default:
+ return 0;
+ }
+
+ return retval;
+}
+
+// Evaluate a symbolic AST_Expression by looking up the named
+// symbol.
+AST_Expression::AST_ExprValue *
+AST_Expression::eval_symbol (AST_Expression::EvalKind ek)
+{
+ UTL_Scope *s = 0;
+ AST_Decl *d = 0;
+ AST_Constant *c = 0;
+
+ // Is there a symbol stored?
+ if (this->pd_n == 0)
+ {
+ idl_global->err ()->eval_error (this);
+ return 0;
+ }
+
+ // Get current scope for lookup.
+ if (idl_global->scopes ().depth () > 0)
+ {
+ s = idl_global->scopes ().top_non_null ();
+ }
+
+ if (s == 0)
+ {
+ idl_global->err ()->lookup_error (this->pd_n);
+ return 0;
+ }
+
+ // Do lookup.
+ d = s->lookup_by_name (this->pd_n,
+ true);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (this->pd_n);
+ return 0;
+ }
+
+ // Is it a constant?
+ if (d->node_type () != AST_Decl::NT_const
+ && d->node_type () != AST_Decl::NT_enum_val)
+ {
+ idl_global->err ()->constant_expected (this->pd_n,
+ d);
+ return 0;
+ }
+
+ // OK, now evaluate the constant we just got, to produce its value.
+ c = AST_Constant::narrow_from_decl (d);
+
+ if (c == 0)
+ {
+ return 0;
+ }
+
+ return c->constant_value ()->eval_internal (ek);
+}
+
+bool
+AST_Expression::type_mismatch (AST_Expression::ExprType t)
+{
+ if (this->pd_ev != 0)
+ {
+ return incompatible_types (this->pd_ev->et, t);
+ }
+
+ bool v1_mismatch = 0;
+ 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->node_type () == AST_Decl::NT_typedef)
+ {
+ AST_Typedef *td = AST_Typedef::narrow_from_decl (d);
+ d = td->primitive_base_type ();
+ }
+
+ 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;
+ }
+
+ if (d != 0 && d->node_type () == AST_Decl::NT_typedef)
+ {
+ this->tdef = d;
+ }
+
+ 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.
+AST_Expression::AST_ExprValue *
+AST_Expression::coerce (AST_Expression::ExprType t)
+{
+ AST_ExprValue *tmp = 0;
+
+ // First, evaluate it, then try to coerce result type.
+ // If already evaluated, return the result.
+ switch (t)
+ {
+ case EV_short:
+ tmp = this->eval_internal (EK_short);
+ break;
+ case EV_ushort:
+ tmp = this->eval_internal (EK_ushort);
+ break;
+ case EV_long:
+ tmp = this->eval_internal (EK_long);
+ break;
+ case EV_ulong:
+ tmp = this->eval_internal (EK_ulong);
+ break;
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ case EV_longlong:
+ tmp = this->eval_internal (EK_longlong);
+ break;
+ case EV_ulonglong:
+ tmp = this->eval_internal (EK_ulonglong);
+ break;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case EV_octet:
+ tmp = this->eval_internal (EK_octet);
+ break;
+ case EV_bool:
+ tmp = this->eval_internal (EK_bool);
+ break;
+ default:
+ tmp = this->eval_internal (EK_const);
+ break;
+ }
+
+ if (tmp == 0)
+ {
+ return 0;
+ }
+ else
+ {
+ delete this->pd_ev;
+ this->pd_ev = tmp;
+ }
+
+ // Create a copy to contain coercion result.
+ AST_ExprValue *copy = 0;
+ ACE_NEW_RETURN (copy,
+ AST_ExprValue,
+ 0);
+
+ copy->et = this->pd_ev->et;
+
+ switch (this->pd_ev->et)
+ {
+ case EV_longdouble:
+ case EV_void:
+ case EV_none:
+ delete copy;
+ return 0;
+ case EV_enum:
+ copy->u.ulval = this->pd_ev->u.ulval;
+ break;
+ case EV_short:
+ copy->u.sval = this->pd_ev->u.sval;
+ break;
+ case EV_ushort:
+ copy->u.usval = this->pd_ev->u.usval;
+ break;
+ case EV_long:
+ copy->u.lval = this->pd_ev->u.lval;
+ break;
+ case EV_ulong:
+ copy->u.ulval = this->pd_ev->u.ulval;
+ break;
+ case EV_longlong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ copy->u.llval = this->pd_ev->u.llval;
+ break;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ delete copy;
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case EV_ulonglong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ copy->u.ullval = this->pd_ev->u.ullval;
+ break;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ delete copy;
+ return 0;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case EV_bool:
+ copy->u.bval = this->pd_ev->u.bval;
+ break;
+ case EV_float:
+ copy->u.fval = this->pd_ev->u.fval;
+ break;
+ case EV_double:
+ copy->u.dval = this->pd_ev->u.dval;
+ break;
+ case EV_char:
+ copy->u.cval = this->pd_ev->u.cval;
+ break;
+ case EV_wchar:
+ copy->u.wcval = this->pd_ev->u.wcval;
+ break;
+ case EV_octet:
+ copy->u.oval = this->pd_ev->u.oval;
+ break;
+ case EV_string:
+ copy->u.strval = this->pd_ev->u.strval;
+ break;
+ case EV_wstring:
+ copy->u.wstrval = this->pd_ev->u.wstrval;
+ break;
+ default:
+ break;
+ }
+
+ if (this->pd_ev->et == t)
+ {
+ return copy;
+ }
+ else
+ {
+ return coerce_value (copy,
+ t);
+ }
+}
+
+// Eval used internally.
+AST_Expression::AST_ExprValue *
+AST_Expression::eval_internal (AST_Expression::EvalKind ek)
+{
+ // Already evaluated?
+ if (this->pd_ev != 0)
+ {
+ return eval_kind (this->pd_ev,
+ ek);
+ }
+
+ if (ek == EK_bool || ek == EK_octet)
+ {
+ // Operators may be used only with integer or floating point types.
+ idl_global->err ()->illegal_infix ();
+ return 0;
+ }
+
+ // OK, must evaluate operator.
+ switch (this->pd_ec)
+ {
+ case EC_add:
+ case EC_minus:
+ case EC_mul:
+ case EC_div:
+ this->pd_ev = this->eval_bin_op (ek);
+ return eval_kind (this->pd_ev,
+ ek);
+ case EC_mod:
+ this->pd_ev = this->eval_mod_op (ek);
+ return eval_kind (this->pd_ev,
+ ek);
+ case EC_or:
+ case EC_xor:
+ case EC_and:
+ case EC_left:
+ case EC_right:
+ this->pd_ev = this->eval_bit_op (ek);
+ return eval_kind (this->pd_ev,
+ ek);
+ case EC_u_plus:
+ case EC_u_minus:
+ case EC_bit_neg:
+ this->pd_ev = this->eval_un_op (ek);
+ return eval_kind (this->pd_ev,
+ ek);
+ case EC_symbol:
+ this->pd_ev = this->eval_symbol (ek);
+ return eval_kind (this->pd_ev,
+ ek);
+ case EC_none:
+ return 0;
+ }
+
+ return 0;
+}
+
+// Public operations.
+
+// Evaluate "this", assigning the value to the pd_ev field.
+void
+AST_Expression::evaluate (EvalKind ek)
+{
+ AST_ExprValue *tmp = eval_kind (this->pd_ev, ek);
+ delete this->pd_ev;
+ this->pd_ev = tmp;
+}
+
+// Expression equality comparison operator.
+bool
+AST_Expression::operator== (AST_Expression *vc)
+{
+ if (this->pd_ec != vc->ec ())
+ {
+ return false;
+ }
+
+ this->evaluate (EK_const);
+ vc->evaluate (EK_const);
+
+ if (pd_ev == 0 || vc->ev() == 0)
+ {
+ return false;
+ }
+
+ if (this->pd_ev->et != vc->ev ()->et)
+ {
+ return false;
+ }
+
+ switch (pd_ev->et)
+ {
+ case EV_short:
+ return this->pd_ev->u.sval == vc->ev ()->u.sval ? true : false;
+ case EV_ushort:
+ return this->pd_ev->u.usval == vc->ev ()->u.usval ? true : false;
+ case EV_long:
+ return this->pd_ev->u.lval == vc->ev ()->u.lval ? true : false;
+ case EV_ulong:
+ return this->pd_ev->u.ulval == vc->ev()->u.ulval ? true : false;
+ case EV_float:
+ return this->pd_ev->u.fval == vc->ev ()->u.fval ? true : false;
+ case EV_double:
+ return this->pd_ev->u.dval == vc->ev ()->u.dval ? true : false;
+ case EV_char:
+ return this->pd_ev->u.cval == vc->ev ()->u.cval ? true : false;
+ case EV_wchar:
+ return this->pd_ev->u.wcval == vc->ev ()->u.wcval ? true : false;
+ case EV_octet:
+ return this->pd_ev->u.oval == vc->ev ()->u.oval ? true : false;
+ case EV_bool:
+ return this->pd_ev->u.lval == vc->ev ()->u.lval ? true : false;
+ case EV_string:
+ if (this->pd_ev->u.strval == 0)
+ {
+ if (vc->ev ()->u.strval == 0)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else if (vc->ev ()->u.strval == 0)
+ {
+ return false;
+ }
+ else
+ {
+ return this->pd_ev->u.strval == vc->ev ()->u.strval
+ ? true
+ : false;
+ }
+
+ case EV_longlong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ return pd_ev->u.llval == vc->ev ()->u.llval ? true : false;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return false;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case EV_ulonglong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ return pd_ev->u.ullval == vc->ev()->u.ullval ? true : false;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return false;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case EV_longdouble:
+ case EV_wstring:
+ case EV_enum:
+ case EV_void:
+ case EV_none:
+ case EV_any:
+ case EV_object:
+ return false;
+ }
+
+ return false;
+}
+
+long
+AST_Expression::compare (AST_Expression *vc)
+{
+ if (this->pd_ec != vc->ec ())
+ {
+ return false;
+ }
+
+ this->evaluate (EK_const);
+ vc->evaluate (EK_const);
+
+ if (this->pd_ev == 0 || vc->ev () == 0)
+ {
+ return false;
+ }
+
+ if (this->pd_ev->et != vc->ev ()->et)
+ {
+ return false;
+ }
+
+ switch (this->pd_ev->et)
+ {
+ case EV_short:
+ return this->pd_ev->u.sval == vc->ev ()->u.sval ? true : false;
+ case EV_ushort:
+ return this->pd_ev->u.usval == vc->ev ()->u.usval ? true : false;
+ case EV_long:
+ return this->pd_ev->u.lval == vc->ev ()->u.lval ? true : false;
+ case EV_ulong:
+ return this->pd_ev->u.ulval == vc->ev ()->u.ulval ? true : false;
+ case EV_float:
+ return this->pd_ev->u.fval == vc->ev ()->u.fval ? true : false;
+ case EV_double:
+ return this->pd_ev->u.dval == vc->ev ()->u.dval ? true : false;
+ case EV_char:
+ return this->pd_ev->u.cval == vc->ev ()->u.cval ? true : false;
+ case EV_wchar:
+ return this->pd_ev->u.wcval == vc->ev ()->u.wcval ? true : false;
+ case EV_octet:
+ return this->pd_ev->u.oval == vc->ev ()->u.oval ? true : false;
+ case EV_bool:
+ return this->pd_ev->u.lval == vc->ev ()->u.lval ? true : false;
+ case EV_string:
+ if (this->pd_ev->u.strval == 0)
+ {
+ if (vc->ev ()->u.strval == 0)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else if (vc->ev ()->u.strval == 0)
+ {
+ return false;
+ }
+ else
+ {
+ return this->pd_ev->u.strval == vc->ev ()->u.strval ? true : false;
+ }
+
+ case EV_longlong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ return this->pd_ev->u.llval == vc->ev ()->u.llval ? true : false;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return false;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case EV_ulonglong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ return this->pd_ev->u.ullval == vc->ev ()->u.ullval ? true : false;
+#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ return false;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ case EV_longdouble:
+ case EV_wstring:
+ case EV_enum:
+ case EV_void:
+ case EV_none:
+ case EV_any:
+ case EV_object:
+ return false;
+ }
+
+ return false;
+}
+
+AST_Decl *
+AST_Expression::get_tdef (void) const
+{
+ return this->tdef;
+}
+
+// Helper functions for expression dumpers.
+
+// Dump this binary AST_Expression node to the ostream o.
+static void
+dump_binary_expr (ACE_OSTREAM_TYPE &o,
+ const char *s,
+ AST_Expression *n1,
+ AST_Expression *n2)
+{
+ if (n1 != 0)
+ {
+ n1->dump (o);
+ }
+
+ o << " " << s << " ";
+
+ if (n2 != 0)
+ {
+ n2->dump (o);
+ }
+}
+
+// Dump this unary AST_Expression node to the ostream o.
+static void
+dump_unary_expr (ACE_OSTREAM_TYPE &o,
+ const char *s,
+ AST_Expression *e)
+{
+ o << s;
+ e->dump (o);
+}
+
+// Dump the supplied AST_ExprValue to the ostream o.
+static void
+dump_expr_val (ACE_OSTREAM_TYPE &o,
+ AST_Expression::AST_ExprValue *ev)
+{
+ switch (ev->et)
+ {
+ case AST_Expression::EV_short:
+ o << ev->u.sval;
+ break;
+ case AST_Expression::EV_ushort:
+ o << ev->u.usval;
+ break;
+ case AST_Expression::EV_long:
+ o << ev->u.lval;
+ break;
+ case AST_Expression::EV_ulong:
+ o << ev->u.ulval;
+ break;
+ case AST_Expression::EV_float:
+ o << ev->u.fval;
+ break;
+ case AST_Expression::EV_double:
+ o << ev->u.dval;
+ break;
+ case AST_Expression::EV_char:
+ o << ev->u.cval;
+ break;
+ case AST_Expression::EV_wchar:
+ o << ev->u.wcval;
+ break;
+ case AST_Expression::EV_octet:
+ o << ev->u.oval;
+ break;
+ case AST_Expression::EV_bool:
+ o << (ev->u.bval == true ? "TRUE" : "FALSE");
+ break;
+ case AST_Expression::EV_string:
+ if (ev->u.strval != 0)
+ ev->u.strval->dump(o);
+ case AST_Expression::EV_longlong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+// o << ev->u.llval;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ break;
+ case AST_Expression::EV_ulonglong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+// o << ev->u.ullval;
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ break;
+ case AST_Expression::EV_longdouble:
+ case AST_Expression::EV_wstring:
+ case AST_Expression::EV_enum:
+ case AST_Expression::EV_none:
+ case AST_Expression::EV_void:
+ case AST_Expression::EV_any:
+ case AST_Expression::EV_object:
+ break;
+ }
+}
+
+// Dump an AST_Expression node to the ostream o.
+void
+AST_Expression::dump (ACE_OSTREAM_TYPE &o)
+{
+ // See if it was a constant or was evaluated already.
+ if (this->pd_ev != 0)
+ {
+ dump_expr_val (o,
+ this->pd_ev);
+ return;
+ }
+
+ // OK, must print out an expression.
+ switch (this->pd_ec)
+ {
+ // Binary expressions:
+ case EC_add:
+ dump_binary_expr (o,
+ "+",
+ this->pd_v1,
+ this->pd_v2);
+ break;
+ case EC_minus:
+ dump_binary_expr (o,
+ "-",
+ this->pd_v1,
+ this->pd_v2);
+ break;
+ case EC_mul:
+ dump_binary_expr (o,
+ "*",
+ this->pd_v1,
+ this->pd_v2);
+ break;
+ case EC_div:
+ dump_binary_expr (o,
+ "/",
+ this->pd_v1,
+ this->pd_v2);
+ break;
+ case EC_mod:
+ dump_binary_expr (o,
+ "%",
+ this->pd_v1,
+ this->pd_v2);
+ break;
+ case EC_or:
+ dump_binary_expr (o,
+ "|",
+ this->pd_v1,
+ this->pd_v2);
+ break;
+ case EC_xor:
+ dump_binary_expr (o,
+ "^",
+ this->pd_v1,
+ this->pd_v2);
+ break;
+ case EC_and:
+ dump_binary_expr (o,
+ "&",
+ this->pd_v1,
+ this->pd_v2);
+ break;
+ case EC_left:
+ dump_binary_expr (o,
+ "<<",
+ this->pd_v1,
+ this->pd_v2);
+ break;
+ case EC_right:
+ dump_binary_expr (o,
+ ">>",
+ this->pd_v1,
+ this->pd_v2);
+ break;
+ // Unary expressions.
+ case EC_u_plus:
+ dump_unary_expr (o,
+ "+",
+ this->pd_v1);
+ break;
+ case EC_u_minus:
+ dump_unary_expr (o,
+ "-",
+ this->pd_v1);
+ break;
+ case EC_bit_neg:
+ dump_unary_expr (o,
+ "~",
+ this->pd_v1);
+ break;
+ // Unevaluated symbol.
+ case EC_symbol:
+ this->pd_n->dump (o);
+ break;
+ case EC_none:
+ break;
+ default:
+ o << ACE_TEXT ("unsupported dump mode for expression with ec == ")
+ << (int) this->pd_ec ;
+ break;
+ }
+}
+
+int
+AST_Expression::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_expression (this);
+}
+
+void
+AST_Expression::destroy (void)
+{
+ if (0 != this->pd_ev && EV_string == this->pd_ev->et)
+ {
+ this->pd_ev->u.strval->destroy ();
+ delete this->pd_ev->u.strval;
+ this->pd_ev->u.strval = 0;
+ }
+
+ delete this->pd_ev;
+ this->pd_ev = 0;
+
+ if (this->pd_v1 != 0)
+ {
+ this->pd_v1->destroy ();
+ }
+
+ if (this->pd_v2 != 0)
+ {
+ this->pd_v2->destroy ();
+ }
+
+ delete this->pd_v1;
+ this->pd_v1 = 0;
+
+ delete this->pd_v2;
+ this->pd_v2 = 0;
+
+ if (this->pd_n != 0)
+ {
+ this->pd_n->destroy ();
+ }
+
+ delete this->pd_n;
+ this->pd_n = 0;
+}
+
+// Data accessors.
+
+UTL_Scope *
+AST_Expression::defined_in (void)
+{
+ return this->pd_defined_in;
+}
+
+void
+AST_Expression::set_defined_in (UTL_Scope *d)
+{
+ this->pd_defined_in = d;
+}
+
+long
+AST_Expression::line (void)
+{
+ return this->pd_line;
+}
+
+void
+AST_Expression::set_line (long l)
+{
+ this->pd_line = l;
+}
+
+UTL_String *
+AST_Expression::file_name (void)
+{
+ return this->pd_file_name;
+}
+
+void
+AST_Expression::set_file_name (UTL_String *f)
+{
+ this->pd_file_name = f;
+}
+
+AST_Expression::ExprComb
+AST_Expression::ec (void)
+{
+ return this->pd_ec;
+}
+
+AST_Expression::AST_ExprValue *
+AST_Expression::ev (void)
+{
+ return this->pd_ev;
+}
+
+void
+AST_Expression::set_ev (AST_Expression::AST_ExprValue *new_ev)
+{
+ delete this->pd_ev;
+ this->pd_ev = new_ev;
+}
+
+AST_Expression *
+AST_Expression::v1 (void)
+{
+ return this->pd_v1;
+}
+
+void
+AST_Expression::set_v1 (AST_Expression *e)
+{
+ this->pd_v1 = e;
+}
+
+AST_Expression *
+AST_Expression::v2 (void)
+{
+ return this->pd_v2;
+}
+
+void
+AST_Expression::set_v2 (AST_Expression *e)
+{
+ this->pd_v2 = e;
+}
+
+UTL_ScopedName *
+AST_Expression::n (void)
+{
+ return this->pd_n;
+}
+
+void
+AST_Expression::set_n (UTL_ScopedName *new_n)
+{
+ this->pd_n = new_n;
+}
diff --git a/TAO/TAO_IDL/ast/ast_factory.cpp b/TAO/TAO_IDL/ast/ast_factory.cpp
new file mode 100644
index 00000000000..9d240c3025e
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_factory.cpp
@@ -0,0 +1,351 @@
+// $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.
+
+*/
+
+// AST_Factory nodes denote OBV factory construct declarations
+// 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 "ast_factory.h"
+#include "ast_argument.h"
+#include "ast_exception.h"
+#include "ast_visitor.h"
+#include "global_extern.h"
+#include "utl_err.h"
+#include "utl_identifier.h"
+#include "utl_exceptlist.h"
+#include "utl_namelist.h"
+
+ACE_RCSID (ast,
+ ast_factory,
+ "$Id$")
+
+AST_Factory::AST_Factory (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ UTL_Scope (),
+ pd_exceptions (0),
+ pd_n_exceptions (0),
+ argument_count_ (-1),
+ has_native_ (0)
+{
+}
+
+AST_Factory::AST_Factory (UTL_ScopedName *n)
+ : COMMON_Base (1,
+ 0), //@@ Always local, never abstract
+ AST_Decl (AST_Decl::NT_factory,
+ n),
+ UTL_Scope (AST_Decl::NT_factory),
+ pd_exceptions (0),
+ pd_n_exceptions (0),
+ argument_count_ (-1),
+ has_native_ (0)
+{
+}
+
+AST_Factory::~AST_Factory (void)
+{
+}
+
+// Public operations.
+
+UTL_ExceptList *
+AST_Factory::exceptions (void)
+{
+ return this->pd_exceptions;
+}
+
+int
+AST_Factory::n_exceptions (void)
+{
+ return this->pd_n_exceptions;
+}
+
+// Return the member count.
+int
+AST_Factory::argument_count (void)
+{
+ this->compute_argument_attr ();
+
+ return this->argument_count_;
+}
+
+// Return if any argument or the return type is a <native> type.
+int
+AST_Factory::has_native (void)
+{
+ this->compute_argument_attr ();
+
+ return this->has_native_;
+}
+
+void
+AST_Factory::destroy (void)
+{
+ if (0 != this->pd_exceptions)
+ {
+ this->pd_exceptions->destroy ();
+ this->pd_exceptions = 0;
+ }
+
+ this->AST_Decl::destroy ();
+ this->UTL_Scope::destroy ();
+}
+
+// Private operations.
+
+// Compute total number of members.
+int
+AST_Factory::compute_argument_attr (void)
+{
+ if (this->argument_count_ != -1)
+ {
+ return 0;
+ }
+
+ AST_Decl *d = 0;
+ AST_Type *type = 0;
+ AST_Argument *arg = 0;
+
+ this->argument_count_ = 0;
+
+ // If there are elements in this scope.
+ if (this->nmembers () > 0)
+ {
+ for (UTL_ScopeActiveIterator i (this, IK_decls);
+ !i.is_done ();
+ i.next ())
+ {
+ // Get the next AST decl node.
+ d = i.item ();
+
+ if (d->node_type () == AST_Decl::NT_argument)
+ {
+ this->argument_count_++;
+
+ arg = AST_Argument::narrow_from_decl (d);
+
+ type = AST_Type::narrow_from_decl (arg->field_type ());
+
+ if (type->node_type () == AST_Decl::NT_native)
+ {
+ this->has_native_ = 1;
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+// Add this AST_Argument node (an factory argument declaration)
+// to this scope.
+AST_Argument *
+AST_Factory::fe_add_argument (AST_Argument *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = lookup_by_name_local (t->local_name(), 0)) != 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,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+UTL_NameList *
+AST_Factory::fe_add_exceptions (UTL_NameList *t)
+{
+ UTL_ScopedName *nl_n = 0;
+ AST_Exception *fe = 0;
+ AST_Decl *d = 0;
+
+ this->pd_exceptions = 0;
+
+ for (UTL_NamelistActiveIterator nl_i (t); !nl_i.is_done (); nl_i.next ())
+ {
+ nl_n = nl_i.item ();
+
+ d = this->lookup_by_name (nl_n,
+ true);
+
+ if (d == 0 || d->node_type() != AST_Decl::NT_except)
+ {
+ idl_global->err ()->lookup_error (nl_n);
+ return 0;
+ }
+
+ fe = AST_Exception::narrow_from_decl (d);
+
+ if (fe == 0)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_RAISES,
+ this);
+ return 0;
+ }
+
+ if (this->pd_exceptions == 0)
+ {
+ ACE_NEW_RETURN (this->pd_exceptions,
+ UTL_ExceptList (fe,
+ 0),
+ 0);
+ }
+ else
+ {
+ UTL_ExceptList *el = 0;
+ ACE_NEW_RETURN (el,
+ UTL_ExceptList (fe,
+ 0),
+ 0);
+
+ this->pd_exceptions->nconc (el);
+ }
+
+ this->pd_n_exceptions++;
+ }
+
+ // This return value is never used, it's easier to
+ // destroy it here and return 0 than to destroy it
+ // each place it is passed in.
+ t->destroy ();
+ delete t;
+ t = 0;
+ return t;
+}
+
+// Dump this AST_Factory node (an OBV factory construct) to the ostream o.
+void
+AST_Factory::dump (ACE_OSTREAM_TYPE &o)
+{
+ AST_Decl *d = 0;
+
+ this->dump_i (o, "factory ");
+ this->local_name ()->dump (o);
+ this->dump_i (o, "(");
+
+ // Iterator must be explicitly advanced inside the loop.
+ for (UTL_ScopeActiveIterator i (this, IK_decls);
+ !i.is_done();)
+ {
+ d = i.item ();
+ d->dump (o);
+ i.next ();
+
+ if (!i.is_done())
+ {
+ this->dump_i (o, ", ");
+ }
+ }
+
+ this->dump_i (o, ")");
+
+}
+
+int
+AST_Factory::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_factory (this);
+}
+
+// Data accessors
+
+// Narrowing.
+IMPL_NARROW_METHODS2(AST_Factory, AST_Decl, UTL_Scope)
+IMPL_NARROW_FROM_DECL(AST_Factory)
+IMPL_NARROW_FROM_SCOPE(AST_Factory)
diff --git a/TAO/TAO_IDL/ast/ast_field.cpp b/TAO/TAO_IDL/ast/ast_field.cpp
new file mode 100644
index 00000000000..816fc654afc
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_field.cpp
@@ -0,0 +1,200 @@
+// $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.
+
+*/
+
+// AST_Fields denote fields in IDL structure, union and exception
+// declarations. AST_Field is also used as a superclass of AST_Argument
+// and AST_UnionBranch.
+// AST_Fields have a field type (a subclass of AST_Type) and a name
+// (a UTL_ScopedName).
+
+// AST_Field supplies two constructors, one to be used in constructing
+// AST_Field nodes, the other to be used in constructing AST_Argument
+// nodes and AST_UnionBranch nodes.
+
+#include "ast_field.h"
+#include "ast_type.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+
+ACE_RCSID (ast, ast_field, "$Id$")
+
+AST_Field::AST_Field (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ pd_field_type (0),
+ pd_visibility (vis_NA),
+ anonymous_type_ (false)
+{
+}
+
+// To be used when constructing an AST_Field node.
+AST_Field::AST_Field (AST_Type *ft,
+ UTL_ScopedName *n,
+ Visibility vis)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_field,
+ n),
+ pd_field_type (ft),
+ pd_visibility (vis),
+ anonymous_type_ (false)
+{
+ AST_Decl::NodeType fnt = ft->node_type ();
+
+ if (AST_Decl::NT_array == fnt || AST_Decl::NT_sequence == fnt)
+ {
+ this->anonymous_type_ = true;
+ }
+}
+
+// To be used when constructing a node of a subclass of AST_Field.
+AST_Field::AST_Field (AST_Decl::NodeType nt,
+ AST_Type *ft,
+ UTL_ScopedName *n,
+ Visibility vis)
+ : COMMON_Base (),
+ AST_Decl (nt,
+ n),
+ pd_field_type (ft),
+ pd_visibility (vis),
+ anonymous_type_ (false)
+{
+ AST_Decl::NodeType fnt = ft->node_type ();
+
+ if (AST_Decl::NT_array == fnt || AST_Decl::NT_sequence == fnt)
+ {
+ this->anonymous_type_ = true;
+ }
+}
+
+AST_Field::~AST_Field (void)
+{
+}
+
+// Dump this AST_Field node to the ostream o.
+void
+AST_Field::dump (ACE_OSTREAM_TYPE &o)
+{
+ switch (this->pd_visibility)
+ {
+ case vis_PRIVATE:
+ this->dump_i (o, "private ");
+
+ break;
+ case vis_PUBLIC:
+ this->dump_i (o, "public ");
+
+ break;
+ case vis_NA:
+ break;
+ }
+
+ this->pd_field_type->local_name ()->dump (o);
+
+ this->dump_i (o, " ");
+
+ this->local_name ()->dump (o);
+}
+
+int
+AST_Field::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_field (this);
+}
+
+void
+AST_Field::destroy (void)
+{
+ if (this->anonymous_type_)
+ {
+ this->pd_field_type->destroy ();
+ delete this->pd_field_type;
+ this->pd_field_type = 0;
+ }
+
+ this->AST_Decl::destroy ();
+}
+
+AST_Type *
+AST_Field::field_type (void) const
+{
+ return this->pd_field_type;
+}
+
+AST_Field::Visibility
+AST_Field::visibility (void)
+{
+ return this->pd_visibility;
+}
+
+int
+AST_Field::contains_wstring (void)
+{
+ return this->pd_field_type->contains_wstring ();
+}
+
+// Narrowing methods.
+IMPL_NARROW_METHODS1(AST_Field, AST_Decl)
+IMPL_NARROW_FROM_DECL(AST_Field)
diff --git a/TAO/TAO_IDL/ast/ast_generator.cpp b/TAO/TAO_IDL/ast/ast_generator.cpp
new file mode 100644
index 00000000000..bcfe904b83e
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_generator.cpp
@@ -0,0 +1,922 @@
+// $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.
+
+*/
+
+// The generator protocol is explained in detail in the IDL CFE
+// design document.
+// The AST_Generator class provides operations to instantiate any
+// of the AST nodes. It contains an operation for every constructor
+// of every AST class.
+
+#include "ast_root.h"
+#include "ast_valuebox.h"
+#include "ast_valuetype.h"
+#include "ast_valuetype_fwd.h"
+#include "ast_eventtype.h"
+#include "ast_eventtype_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 "ace/OS_NS_wchar.h"
+
+#include "ast_generator.h"
+
+ACE_RCSID (ast,
+ ast_generator,
+ "$Id$")
+
+AST_PredefinedType *
+AST_Generator::create_predefined_type (AST_PredefinedType::PredefinedType t,
+ UTL_ScopedName *n)
+{
+ AST_PredefinedType *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_PredefinedType (t,
+ n),
+ 0);
+
+ return retval;
+}
+
+AST_Module *
+AST_Generator::create_module (UTL_Scope *s,
+ UTL_ScopedName *n)
+{
+ // 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;
+ ACE_NEW_RETURN (retval,
+ AST_Module (n),
+ 0);
+
+ AST_Decl *d = 0;
+ AST_Module *m = 0;
+
+ UTL_ScopeActiveIterator iter (s,
+ UTL_Scope::IK_decls);
+
+ // Check for another module of the same name in this scope.
+ while (!iter.is_done ())
+ {
+ d = iter.item ();
+
+ if (d->node_type () == AST_Decl::NT_module)
+ {
+ // Does it have the same name as the one we're
+ // supposed to create.
+ if (d->local_name ()->compare (n->last_component ()))
+ {
+ m = AST_Module::narrow_from_decl (d);
+
+ // Get m's previous_ member, plus all it's decls,
+ // into the new modules's previous_ member.
+ retval->add_to_previous (m);
+ }
+ }
+
+ iter.next ();
+ }
+
+ // If this scope is itself a module, and has been previously
+ // opened, the previous opening may contain a previous opening
+ // of the module we're creating.
+ d = ScopeAsDecl (s);
+ AST_Decl::NodeType nt = d->node_type ();
+
+ if (nt == AST_Decl::NT_module || nt == AST_Decl::NT_root)
+ {
+ m = AST_Module::narrow_from_decl (d);
+
+ // AST_Module::previous_ is a set, so it contains each
+ // entry only once, but previous_ will contain the decls
+ // from all previous openings. See comment in
+ // AST_Module::add_to_previous() body.
+ d = m->look_in_previous (n->last_component ());
+
+ if (d != 0)
+ {
+ if (d->node_type () == AST_Decl::NT_module)
+ {
+ m = AST_Module::narrow_from_decl (d);
+
+ retval->add_to_previous (m);
+ }
+ }
+ }
+
+ return retval;
+}
+
+AST_Root *
+AST_Generator::create_root (UTL_ScopedName *n)
+{
+ AST_Root *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Root (n),
+ 0);
+
+ return retval;
+}
+
+AST_Interface *
+AST_Generator::create_interface (UTL_ScopedName *n,
+ AST_Interface **inherits,
+ long n_inherits,
+ AST_Interface **inherits_flat,
+ long n_inherits_flat,
+ bool is_local,
+ bool is_abstract)
+{
+ AST_Interface *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Interface (n,
+ inherits,
+ n_inherits,
+ inherits_flat,
+ n_inherits_flat,
+ is_local,
+ is_abstract),
+ 0);
+
+ return retval;
+}
+
+AST_InterfaceFwd *
+AST_Generator::create_interface_fwd (UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract)
+{
+ AST_Interface *full_defn = this->create_interface (n,
+ 0,
+ -1,
+ 0,
+ 0,
+ is_local,
+ is_abstract);
+
+ AST_InterfaceFwd *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_InterfaceFwd (full_defn,
+ n),
+ 0);
+
+ full_defn->fwd_decl (retval);
+ return retval;
+}
+
+AST_ValueType *
+AST_Generator::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_list,
+ long n_supports,
+ AST_Interface *supports_concrete,
+ bool is_abstract,
+ bool is_truncatable,
+ bool is_custom)
+{
+ AST_ValueType *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_ValueType (n,
+ inherits,
+ n_inherits,
+ inherits_concrete,
+ inherits_flat,
+ n_inherits_flat,
+ supports_list,
+ n_supports,
+ supports_concrete,
+ is_abstract,
+ is_truncatable,
+ is_custom),
+ 0);
+
+ // The following helps with OBV_ namespace generation.
+ AST_Module *m = AST_Module::narrow_from_scope (retval->defined_in ());
+
+ if (m != 0)
+ {
+ m->set_has_nested_valuetype ();
+ }
+
+ return retval;
+}
+
+AST_ValueTypeFwd *
+AST_Generator::create_valuetype_fwd (UTL_ScopedName *n,
+ bool is_abstract)
+{
+ AST_ValueType *full_defn = this->create_valuetype (n,
+ 0,
+ -1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ is_abstract,
+ false,
+ false);
+
+ AST_ValueTypeFwd *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_ValueTypeFwd (full_defn,
+ n),
+ 0);
+
+ full_defn->fwd_decl (retval);
+ return retval;
+}
+
+AST_EventType *
+AST_Generator::create_eventtype (UTL_ScopedName *n,
+ AST_Interface **inherits,
+ long n_inherits,
+ AST_ValueType *inherits_concrete,
+ AST_Interface **inherits_flat,
+ long n_inherits_flat,
+ AST_Interface **supports_list,
+ long n_supports,
+ AST_Interface *supports_concrete,
+ bool is_abstract,
+ bool is_truncatable,
+ bool is_custom)
+{
+ AST_EventType *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_EventType (n,
+ inherits,
+ n_inherits,
+ inherits_concrete,
+ inherits_flat,
+ n_inherits_flat,
+ supports_list,
+ n_supports,
+ supports_concrete,
+ is_abstract,
+ is_truncatable,
+ is_custom),
+ 0);
+
+ // The following helps with OBV_ namespace generation.
+ AST_Module *m = AST_Module::narrow_from_scope (retval->defined_in ());
+
+ if (m != 0)
+ {
+ m->set_has_nested_valuetype ();
+ }
+
+ return retval;
+}
+
+AST_EventTypeFwd *
+AST_Generator::create_eventtype_fwd (UTL_ScopedName *n,
+ bool is_abstract)
+{
+ AST_EventType *full_defn = this->create_eventtype (n,
+ 0,
+ -1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ is_abstract,
+ false,
+ false);
+
+ AST_EventTypeFwd *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_EventTypeFwd (full_defn,
+ n),
+ 0);
+
+ full_defn->fwd_decl (retval);
+ return retval;
+}
+
+AST_Component *
+AST_Generator::create_component (UTL_ScopedName *n,
+ AST_Component *base_component,
+ AST_Interface **supports_list,
+ long n_supports,
+ AST_Interface **supports_flat,
+ long n_supports_flat)
+{
+ AST_Component *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Component (n,
+ base_component,
+ supports_list,
+ n_supports,
+ supports_flat,
+ n_supports_flat),
+ 0);
+
+ return retval;
+}
+
+AST_ComponentFwd *
+AST_Generator::create_component_fwd (UTL_ScopedName *n)
+{
+ AST_Component *full_defn = this->create_component (n,
+ 0,
+ 0,
+ -1,
+ 0,
+ 0);
+
+ AST_ComponentFwd *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_ComponentFwd (full_defn,
+ n),
+ 0);
+
+ full_defn->fwd_decl (retval);
+ 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_list,
+ 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_list,
+ n_supports,
+ supports_flat,
+ n_supports_flat),
+ 0);
+
+ return retval;
+}
+
+AST_Exception *
+AST_Generator::create_exception (UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract)
+{
+ AST_Exception *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Exception (n,
+ is_local,
+ is_abstract),
+ 0);
+
+ return retval;
+}
+
+AST_Structure *
+AST_Generator::create_structure (UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract)
+{
+ AST_Structure *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Structure (n,
+ is_local,
+ is_abstract),
+ 0);
+
+ return retval;
+}
+
+AST_StructureFwd *
+AST_Generator::create_structure_fwd (UTL_ScopedName *n)
+{
+ AST_Structure *full_defn = this->create_structure (n,
+ false,
+ false);
+ AST_StructureFwd *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_StructureFwd (full_defn,
+ n),
+ 0);
+
+ full_defn->fwd_decl (retval);
+ return retval;
+}
+
+AST_Enum *
+AST_Generator::create_enum (UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract)
+{
+ AST_Enum *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Enum (n,
+ is_local,
+ is_abstract),
+ 0);
+
+ return retval;
+}
+
+AST_Operation *
+AST_Generator::create_operation (AST_Type *rt,
+ AST_Operation::Flags fl,
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract)
+{
+ AST_Operation *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Operation (rt,
+ fl,
+ n,
+ is_local,
+ is_abstract),
+ 0);
+
+ return retval;
+}
+
+AST_Field *
+AST_Generator::create_field (AST_Type *ft,
+ UTL_ScopedName *n,
+ AST_Field::Visibility vis)
+{
+ AST_Field *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Field (ft,
+ n,
+ vis),
+ 0);
+
+ return retval;
+}
+
+AST_Argument *
+AST_Generator::create_argument (AST_Argument::Direction d,
+ AST_Type *ft,
+ UTL_ScopedName *n)
+{
+ AST_Argument *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Argument (d,
+ ft,
+ n),
+ 0);
+
+ return retval;
+}
+
+AST_Attribute *
+AST_Generator::create_attribute (bool ro,
+ AST_Type *ft,
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract)
+{
+ AST_Attribute *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Attribute (ro,
+ ft,
+ n,
+ is_local,
+ is_abstract),
+ 0);
+
+ return retval;
+}
+
+AST_Union *
+AST_Generator::create_union (AST_ConcreteType *dt,
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract)
+{
+ AST_Union *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Union (dt,
+ n,
+ is_local,
+ is_abstract),
+ 0);
+
+ return retval;
+}
+
+AST_UnionFwd *
+AST_Generator::create_union_fwd (UTL_ScopedName *n)
+{
+ AST_Union *full_defn = this->create_union (0,
+ n,
+ false,
+ false);
+ AST_UnionFwd *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_UnionFwd (full_defn,
+ n),
+ 0);
+
+ full_defn->fwd_decl (retval);
+ return retval;
+}
+
+AST_UnionBranch *
+AST_Generator::create_union_branch (UTL_LabelList *ll,
+ AST_Type *ft,
+ UTL_ScopedName *n)
+{
+ AST_UnionBranch *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_UnionBranch (ll,
+ ft,
+ n),
+ 0);
+
+ return retval;
+}
+
+AST_UnionLabel *
+AST_Generator::create_union_label (AST_UnionLabel::UnionLabel ul,
+ AST_Expression *v)
+{
+ AST_UnionLabel *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_UnionLabel (ul,
+ v),
+ 0);
+
+ return retval;
+}
+
+AST_Constant *
+AST_Generator::create_constant (AST_Expression::ExprType et,
+ AST_Expression *ev,
+ UTL_ScopedName *n)
+{
+ AST_Constant *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Constant (et,
+ ev,
+ n),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+AST_Generator::create_expr (UTL_ScopedName *n)
+{
+ AST_Expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Expression (n),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+AST_Generator::create_expr (AST_Expression *v,
+ AST_Expression::ExprType t)
+{
+ AST_Expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Expression (v,
+ t),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+AST_Generator::create_expr (AST_Expression::ExprComb c,
+ AST_Expression *v1,
+ AST_Expression *v2)
+{
+ AST_Expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Expression (c,
+ v1,
+ v2),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+AST_Generator::create_expr (long v)
+{
+ AST_Expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Expression (v),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+AST_Generator::create_expr (bool b)
+{
+ AST_Expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Expression (b),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+AST_Generator::create_expr (idl_uns_long v,
+ AST_Expression::ExprType t)
+{
+ AST_Expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Expression (v,
+ t),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+AST_Generator::create_expr (UTL_String *s)
+{
+ AST_Expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Expression (s),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+AST_Generator::create_expr (char c)
+{
+ AST_Expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Expression (c),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+AST_Generator::create_expr (ACE_OutputCDR::from_wchar wc)
+{
+ AST_Expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Expression (wc),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+AST_Generator::create_expr (char *s)
+{
+ AST_Expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Expression (s),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+AST_Generator::create_expr (double d)
+{
+ AST_Expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Expression (d),
+ 0);
+
+ return retval;
+}
+
+AST_EnumVal *
+AST_Generator::create_enum_val (unsigned long v,
+ UTL_ScopedName *n)
+{
+ AST_EnumVal *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_EnumVal (v,
+ n),
+ 0);
+
+ return retval;
+}
+
+AST_Array *
+AST_Generator::create_array (UTL_ScopedName *n,
+ unsigned long ndims,
+ UTL_ExprList *dims,
+ bool is_local,
+ bool is_abstract)
+{
+ AST_Array *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Array (n,
+ ndims,
+ dims,
+ is_local,
+ is_abstract),
+ 0);
+
+ return retval;
+}
+
+AST_Sequence *
+AST_Generator::create_sequence (AST_Expression *ms,
+ AST_Type *bt,
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract)
+{
+ AST_Sequence *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Sequence (ms,
+ bt,
+ n,
+ is_local,
+ is_abstract),
+ 0);
+
+ return retval;
+}
+
+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 (AST_Decl::NT_string,
+ &n,
+ ms),
+ 0);
+
+ return retval;
+}
+
+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 (nt,
+ &n,
+ ms,
+ sizeof (ACE_OS::WChar)),
+ 0);
+
+ return retval;
+}
+
+AST_Typedef *
+AST_Generator::create_typedef (AST_Type *bt,
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract)
+{
+ AST_Typedef *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Typedef (bt,
+ n,
+ is_local,
+ is_abstract),
+ 0);
+
+ return retval;
+}
+
+AST_Native *
+AST_Generator::create_native (UTL_ScopedName *n)
+{
+ AST_Native *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Native (n),
+ 0);
+
+ return retval;
+}
+
+AST_Factory *
+AST_Generator::create_factory (UTL_ScopedName *n)
+{
+ AST_Factory *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Factory (n),
+ 0);
+
+ return retval;
+}
+
+AST_ValueBox *
+AST_Generator::create_valuebox (UTL_ScopedName *n,
+ AST_Type *boxed_type)
+{
+ AST_ValueBox *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_ValueBox (n, boxed_type),
+ 0);
+
+ return retval;
+}
diff --git a/TAO/TAO_IDL/ast/ast_home.cpp b/TAO/TAO_IDL/ast/ast_home.cpp
new file mode 100644
index 00000000000..fa65bd3e1a0
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_home.cpp
@@ -0,0 +1,252 @@
+// $Id$
+
+#include "ast_home.h"
+#include "ast_component.h"
+#include "ast_valuetype.h"
+#include "ast_operation.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_home,
+ "$Id$")
+
+AST_Home::AST_Home (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ UTL_Scope (),
+ AST_Interface (),
+ 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)
+ : COMMON_Base (false,
+ false),
+ AST_Decl (AST_Decl::NT_home,
+ n),
+ AST_Type (AST_Decl::NT_home,
+ n),
+ UTL_Scope (AST_Decl::NT_home),
+ AST_Interface (n,
+ supports,
+ n_supports,
+ supports_flat,
+ n_supports_flat,
+ false,
+ false),
+ pd_base_home (base_home),
+ pd_managed_component (managed_component),
+ pd_primary_key (primary_key)
+{
+ if (primary_key != 0)
+ {
+ idl_global->primary_keys ().enqueue_tail (primary_key);
+ }
+}
+
+AST_Home::~AST_Home (void)
+{
+}
+
+AST_Decl *
+AST_Home::look_in_inherited (UTL_ScopedName *e,
+ bool treat_as_ref)
+{
+ AST_Decl *d = 0;
+
+ if (this->pd_base_home != 0)
+ {
+ d = this->pd_base_home->lookup_by_name (e, treat_as_ref);
+ }
+
+ return d;
+}
+
+// Look through supported interface list.
+AST_Decl *
+AST_Home::look_in_supported (UTL_ScopedName *e,
+ bool treat_as_ref)
+{
+ AST_Decl *d = 0;
+ AST_Interface **is = 0;
+ long nis = -1;
+
+ // Can't look in an interface which was not yet defined.
+ if (!this->is_defined ())
+ {
+ idl_global->err ()->fwd_decl_lookup (this,
+ e);
+ return 0;
+ }
+
+ // OK, loop through supported interfaces.
+
+ // (Don't leave the inheritance hierarchy, no module or global ...)
+ // Find all and report ambiguous results as error.
+
+ for (nis = this->n_supports (), is = this->supports ();
+ nis > 0;
+ nis--, is++)
+ {
+ d = (*is)->lookup_by_name (e,
+ treat_as_ref,
+ 0 /* not in parent */);
+ if (d != 0)
+ {
+ break;
+ }
+ }
+
+ return d;
+}
+
+AST_Home *
+AST_Home::base_home (void) const
+{
+ return this->pd_base_home;
+}
+
+// These next two look ugly, but it is to keep from having to
+// create separate visitors for homes in the back end.
+
+AST_Interface **
+AST_Home::supports (void) const
+{
+ return this->pd_base_home ? this->inherits () + 1 : this->inherits ();
+}
+
+long
+AST_Home::n_supports (void) const
+{
+ return this->n_inherits ();
+}
+
+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)
+{
+ // We have to go through these conniptions to destroy
+ // a home because its decls (for which there are no
+ // copy constructors) are assigned to the scope
+ // of the equivalent interface, which will destroy
+ // them. But we still have to destroy the containers
+ // for those references, which may be private or
+ // protected.
+
+ delete [] this->inherits ();
+ delete [] this->inherits_flat ();
+
+ delete [] this->pd_decls;
+ this->pd_decls = 0;
+ this->pd_decls_allocated = 0;
+ this->pd_decls_used = 0;
+
+ delete [] this->pd_referenced;
+ this->pd_referenced = 0;
+ this->pd_referenced_allocated = 0;
+ this->pd_referenced_used = 0;
+
+ // These are stored by copying the Identifier.
+ for (long i = 0; i < this->pd_name_referenced_used; ++i)
+ {
+ this->pd_name_referenced[i]->destroy ();
+ delete this->pd_name_referenced[i];
+ this->pd_name_referenced[i] = 0;
+ }
+
+ delete [] this->pd_name_referenced;
+ this->pd_name_referenced = 0;
+ this->pd_name_referenced_allocated = 0;
+ this->pd_name_referenced_used = 0;
+
+ // Skip AST_Interface, since the home's decls
+ // are added to the equivalent interface, and
+ // they should get destroyed there.
+ this->AST_Type::destroy ();
+}
+
+void
+AST_Home::dump (ACE_OSTREAM_TYPE &o)
+{
+ this->dump_i (o, "home ");
+
+ this->local_name ()->dump (o);
+
+ this->dump_i (o, " ");
+
+ if (this->pd_base_home != 0)
+ {
+ this->dump_i (o, ": ");
+ this->pd_base_home->local_name ()->dump (o);
+ }
+
+ if (this->pd_managed_component != 0)
+ {
+ this->dump_i (o, "\n");
+ this->dump_i (o, "manages ");
+ this->pd_managed_component->local_name ()->dump (o);
+ }
+
+ if (this->pd_primary_key != 0)
+ {
+ this->dump_i (o, "\n");
+ this->dump_i (o, "primary key ");
+ this->pd_primary_key->local_name ()->dump (o);
+ }
+
+ this->dump_i (o, " {\n");
+
+ UTL_Scope::dump (o);
+ idl_global->indent ()->skip_to (o);
+
+ this->dump_i (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
new file mode 100644
index 00000000000..64bb76d9e96
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_interface.cpp
@@ -0,0 +1,1682 @@
+// $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.
+
+*/
+
+// AST_Interfaces denote IDL interface definitions
+// AST_Interfaces are subclasses of AST_Type and UTL_Scope
+// AST_Interfaces have an array of inherited interfaces and
+// a count of the number of inherited interfaces. This count
+// represents the total number of unique (recursively) inherited
+// interfaces.
+
+#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 "utl_string.h"
+#include "global_extern.h"
+#include "nr_extern.h"
+
+#include "ace/streams.h"
+
+ACE_RCSID (ast,
+ ast_interface,
+ "$Id$")
+
+AST_Interface::AST_Interface (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ UTL_Scope (),
+ pd_inherits (0),
+ pd_n_inherits (0),
+ pd_inherits_flat (0),
+ pd_n_inherits_flat (0),
+ home_equiv_ (false),
+ fwd_decl_ (0)
+{
+ this->size_type (AST_Type::VARIABLE); // Always the case.
+ this->has_constructor (true); // Always the case.
+}
+
+AST_Interface::AST_Interface (UTL_ScopedName *n,
+ AST_Interface **ih,
+ long nih,
+ AST_Interface **ih_flat,
+ long nih_flat,
+ bool local,
+ bool abstract)
+ : COMMON_Base (local,
+ abstract),
+ AST_Decl (AST_Decl::NT_interface,
+ n),
+ AST_Type (AST_Decl::NT_interface,
+ n),
+ UTL_Scope (AST_Decl::NT_interface),
+ pd_inherits (ih),
+ pd_n_inherits (nih),
+ pd_inherits_flat (ih_flat),
+ pd_n_inherits_flat (nih_flat),
+ home_equiv_ (false),
+ fwd_decl_ (0)
+{
+ this->size_type (AST_Type::VARIABLE); // always the case
+ this->has_constructor (true); // always the case
+}
+
+AST_Interface::~AST_Interface (void)
+{
+}
+
+void
+AST_Interface::be_replace_operation (AST_Decl *old_op,
+ AST_Decl *new_op)
+{
+ this->replace_scope (old_op,
+ new_op);
+
+ this->replace_referenced (old_op,
+ new_op);
+}
+
+AST_Operation *
+AST_Interface::be_add_operation (AST_Operation *op)
+{
+ return this->fe_add_operation (op);
+}
+
+bool
+AST_Interface::is_defined (void)
+{
+ // Each instance of a forward declared interface no
+ // longer has a redefined full definition, so we
+ // have to backtrack to the fwd decl is_defined(),
+ // which searches for the one that does. If one
+ // is found, then we are defined for code generation
+ // purposes. See AST_InterfaceFwd::destroy() to
+ // see the difference for cleanup purposes.
+ return (0 == this->fwd_decl_
+ ? this->pd_n_inherits >= 0
+ : this->fwd_decl_->is_defined ());
+}
+
+// Add an AST_Constant node (a constant declaration) to this scope.
+AST_Constant *
+AST_Interface::fe_add_constant (AST_Constant *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, 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,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add an AST_Exception node (an exception declaration) to this scope.
+AST_Exception *
+AST_Interface::fe_add_exception (AST_Exception *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, 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,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add an AST_Attribute node (an attribute declaration) to this scope.
+AST_Attribute *
+AST_Interface::fe_add_attribute (AST_Attribute *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, false)) != 0)
+ {
+ if (!can_be_redefined (d))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ this,
+ d);
+ return 0;
+ }
+
+ if (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,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add this AST_Field node (a field declaration) to this scope
+// (only for valuetypes).
+AST_Field *
+AST_Interface::fe_add_field (AST_Field *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, 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,
+ 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,
+ false,
+ mru->first_component ());
+ }
+
+ return t;
+}
+
+// Add an AST_Operation node (an operation declaration) to this scope.
+AST_Operation *
+AST_Interface::fe_add_operation (AST_Operation *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, 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;
+ }
+ }
+ else if ((d = this->look_in_inherited (t->name (), 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);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add an AST_Structure (a struct declaration) to this scope.
+AST_Structure *
+AST_Interface::fe_add_structure (AST_Structure *t)
+{
+ AST_Decl *predef = 0;
+ AST_StructureFwd *fwd = 0;
+
+ if ((predef = this->lookup_for_add (t, 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 ())
+ {
+ 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,
+ 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;
+ }
+ }
+
+ // Add it to scope.
+ this->add_to_scope (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ 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, 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,
+ 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)
+{
+ 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, 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,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add an AST_Union (a union declaration) to this scope.
+AST_Union *
+AST_Interface::fe_add_union (AST_Union *t)
+{
+ AST_Decl *predef = 0;
+ AST_UnionFwd *fwd = 0;
+
+ if ((predef = this->lookup_for_add (t, false)) != 0)
+ {
+ // 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 ())
+ {
+ 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,
+ 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;
+ }
+ }
+
+ // Add it to scope.
+ this->add_to_scope (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ return 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;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, 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_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,
+ 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_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;
+
+ // 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, 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,
+ false,
+ t->local_name ());
+
+ return 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;
+
+ // 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, 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,
+ 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,
+ false,
+ mru->first_component ()
+ );
+ }
+
+ return t;
+}
+
+// Add an AST_Native (a native declaration) to this scope.
+AST_Native *
+AST_Interface::fe_add_native (AST_Native *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, 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,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Dump this AST_Interface node to the ostream o.
+void
+AST_Interface::dump (ACE_OSTREAM_TYPE &o)
+{
+ if (this->is_abstract ())
+ {
+ this->dump_i (o, "abstract ");
+ }
+ else if (this->is_local ())
+ {
+ this->dump_i (o, "local ");
+ }
+
+ this->dump_i (o, "interface ");
+
+ this->local_name ()->dump (o);
+ this->dump_i (o, " ");
+
+ if (this->pd_n_inherits > 0)
+ {
+ this->dump_i (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)
+ {
+ this->dump_i (o, ", ");
+ }
+ }
+ }
+
+ this->dump_i (o, " {\n");
+
+ UTL_Scope::dump (o);
+ idl_global->indent ()->skip_to (o);
+
+ this->dump_i (o, "}");
+}
+
+// This serves for interfaces, valuetypes, components and eventtypes.
+void
+AST_Interface::fwd_redefinition_helper (AST_Interface *&i,
+ UTL_Scope *s)
+{
+ if (i == 0)
+ {
+ return;
+ }
+
+ UTL_Scope *scope = i->defined_in ();
+ const char *prefix_holder = 0;
+
+ // If our prefix is empty, we check to see if an ancestor has one.
+ while (ACE_OS::strcmp (i->prefix (), "") == 0 && scope != 0)
+ {
+ AST_Decl *parent = ScopeAsDecl (scope);
+ prefix_holder = parent->prefix ();
+
+ // We have reached global scope.
+ if (prefix_holder == 0)
+ {
+ break;
+ }
+
+ i->prefix (const_cast<char *> (prefix_holder));
+ scope = parent->defined_in ();
+ }
+
+ // Fwd redefinition should be in the same scope, so local
+ // lookup is all that's needed.
+ AST_Decl *d = s->lookup_by_name_local (i->local_name (),
+ 0);
+
+ AST_Interface *fd = 0;
+
+ if (d != 0)
+ {
+ scope = d->defined_in ();
+
+ // If the lookup prefix is empty, we check to see if an ancestor has one.
+ while (ACE_OS::strcmp (d->prefix (), "") == 0 && scope != 0)
+ {
+ AST_Decl *parent = ScopeAsDecl (scope);
+ prefix_holder = parent->prefix ();
+
+ // We have reached global scope.
+ if (prefix_holder == 0)
+ {
+ break;
+ }
+
+ d->prefix (const_cast<char *> (prefix_holder));
+ scope = parent->defined_in ();
+ }
+
+ // (JP) This could give a bogus error, since typeprefix can
+ // appear any time after the corresponding declaration.
+ // The right way to do this is with a separate traversal
+ // after the entire AST is built.
+ /*
+ if (ACE_OS::strcmp (i->prefix (), d->prefix ()) != 0)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_PREFIX_CONFLICT,
+ i);
+
+ return;
+ }
+ */
+
+ fd = AST_Interface::narrow_from_decl (d);
+
+ // Successful?
+ if (fd == 0)
+ {
+ // Should we give an error here?
+ // No, look in fe_add_interface.
+ }
+ // If it is a forward declared interface..
+ else if (!fd->is_defined ())
+ {
+ // Check if redefining in same scope. If a module is reopened,
+ // 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
+ && i->name ()->compare (fd->name ()) != 0)
+ {
+ idl_global->err ()->error2 (UTL_Error::EIDL_SCOPE_CONFLICT,
+ i,
+ fd);
+ }
+ // 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_nt != fd_nt
+ || i->is_abstract () != fd->is_abstract ()
+ )
+ {
+ idl_global->err ()->error2 (UTL_Error::EIDL_REDEF,
+ i,
+ fd);
+ return;
+ }
+
+ fd->redefine (i);
+
+ // Use full definition node.
+ i->destroy ();
+ delete i;
+ i = fd;
+ }
+ }
+ }
+}
+
+void
+AST_Interface::redef_clash_populate_r (AST_Interface *t)
+{
+ if (this->insert_non_dup (t, 0) == 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]);
+ }
+ }
+}
+
+bool
+AST_Interface::home_equiv (void) const
+{
+ return this->home_equiv_;
+}
+
+void
+AST_Interface::home_equiv (bool val)
+{
+ this->home_equiv_ = val;
+}
+
+AST_InterfaceFwd *
+AST_Interface::fwd_decl (void) const
+{
+ return this->fwd_decl_;
+}
+
+void
+AST_Interface::fwd_decl (AST_InterfaceFwd *node)
+{
+ this->fwd_decl_ = node;
+}
+
+int
+AST_Interface::insert_non_dup (AST_Interface *t,
+ bool abstract_paths_only)
+{
+ // Now check if the dequeued element has any ancestors. If yes, insert
+ // them inside the queue making sure that there are no duplicates.
+ // If we are doing a component, the inheritance list is actually a
+ // supports list.
+ for (long i = 0; i < t->n_inherits (); ++i)
+ {
+ // Retrieve the next parent from which the dequeued element inherits.
+ AST_Interface *parent = t->inherits ()[i];
+
+ if (abstract_paths_only && ! parent->is_abstract ())
+ {
+ continue;
+ }
+
+ (void) this->insert_non_dup (parent, abstract_paths_only);
+ } // end of for loop
+
+ 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. It is overridden for valuetypes,
+// components and eventtypes.
+void
+AST_Interface::redefine (AST_Interface *from)
+{
+ // 'this' is the full_definition member of a forward
+ // declared interface. 'from' is the actual full
+ // 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->pd_n_inherits = from->pd_n_inherits;
+ unsigned long i = 0;
+
+ unsigned long array_size =
+ static_cast<unsigned long> (from->pd_n_inherits);
+ ACE_NEW (this->pd_inherits,
+ AST_Interface *[array_size]);
+
+ for (i = 0; i < array_size; ++i)
+ {
+ this->pd_inherits[i] = from->pd_inherits[i];
+ }
+
+ this->pd_n_inherits_flat = from->pd_n_inherits_flat;
+ array_size =
+ static_cast<unsigned long> (from->pd_n_inherits_flat);
+ ACE_NEW (this->pd_inherits_flat,
+ AST_Interface *[array_size]);
+
+ for (i = 0; i < array_size; ++i)
+ {
+ this->pd_inherits_flat[i] = from->pd_inherits_flat[i];
+ }
+
+ // We've already checked for inconsistent prefixes.
+ this->prefix (from->prefix ());
+
+ this->set_defined_in (from->defined_in ());
+ this->set_imported (idl_global->imported ());
+ this->set_in_main_file (idl_global->in_main_file ());
+ this->set_line (idl_global->lineno ());
+ this->set_file_name (idl_global->filename ()->get_string ());
+ this->ifr_added_ = from->ifr_added_;
+ this->ifr_fwd_added_ = from->ifr_fwd_added_;
+}
+
+// Data accessors.
+
+AST_Interface **
+AST_Interface::inherits (void) const
+{
+ return this->pd_inherits;
+}
+
+long
+AST_Interface::n_inherits (void) const
+{
+ return this->pd_n_inherits;
+}
+
+AST_Interface **
+AST_Interface::inherits_flat (void) const
+{
+ return this->pd_inherits_flat;
+}
+
+long
+AST_Interface::n_inherits_flat (void) const
+{
+ return pd_n_inherits_flat;
+}
+
+ACE_Unbounded_Queue<AST_Interface *> &
+AST_Interface::get_insert_queue (void)
+{
+ return this->insert_queue;
+}
+
+ACE_Unbounded_Queue<AST_Interface *> &
+AST_Interface::get_del_queue (void)
+{
+ return this->del_queue;
+}
+
+bool
+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)
+ {
+ // Queue element.
+ (void) group1_iter.next (group1_member);
+
+ for (UTL_ScopeActiveIterator group1_member_items (
+ DeclAsScope (*group1_member),
+ UTL_Scope::IK_decls
+ );
+ !group1_member_items.is_done ();
+ group1_member_items.next ())
+ {
+ group1_member_item = group1_member_items.item ();
+ AST_Decl::NodeType nt1 = group1_member_item->node_type ();
+
+ // 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;
+ }
+
+ Identifier *pid1 = group1_member_item->local_name ();
+ int j = 0;
+
+ for (ACE_Unbounded_Queue_Iterator<AST_Interface *> group2_iter (
+ this->insert_queue
+ );
+ !group2_iter.done ();
+ (void) group2_iter.advance ())
+ {
+ // 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);
+
+ for (UTL_ScopeActiveIterator group2_member_items (
+ DeclAsScope (*group2_member),
+ UTL_Scope::IK_decls
+ );
+ !group2_member_items.is_done ();
+ group2_member_items.next ())
+ {
+ group2_member_item = group2_member_items.item ();
+ AST_Decl::NodeType nt2 = group2_member_item->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)
+ {
+ continue;
+ }
+
+ Identifier *pid2 = group2_member_item->local_name ();
+
+ if (pid1->compare (pid2) == 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) == true)
+ {
+ if (idl_global->case_diff_error ())
+ {
+ idl_global->err ()->error3 (
+ UTL_Error::EIDL_NAME_CASE_ERROR,
+ *group1_member,
+ group1_member_item,
+ group2_member_item
+ );
+ }
+ else
+ {
+ idl_global->err ()->warning3 (
+ UTL_Error::EIDL_NAME_CASE_WARNING,
+ *group1_member,
+ group1_member_item,
+ group2_member_item
+ );
+ }
+
+ return 1;
+ }
+ } // end of FOR (group2_member_items)
+ } // end of FOR (group2_iter)
+ } // end of FOR (group1_member_items)
+ } // end of FOR (group1_iter)
+
+ return 0;
+}
+
+// Look through inherited interfaces.
+AST_Decl *
+AST_Interface::look_in_inherited (UTL_ScopedName *e,
+ bool treat_as_ref)
+{
+ AST_Decl *d = 0;
+ AST_Decl *d_before = 0;
+ AST_Interface **is = 0;
+ long nis = -1;
+
+ // Can't look in an interface which was not yet defined.
+ if (!this->is_defined ())
+ {
+ return 0;
+ }
+
+ // OK, loop through inherited interfaces.
+
+ // (Don't leave the inheritance hierarchy, no module or global ...)
+ // Find all and report ambiguous results as error.
+
+ for (nis = this->n_inherits (), is = this->inherits ();
+ nis > 0;
+ nis--, is++)
+ {
+ d = (*is)->lookup_by_name (e,
+ treat_as_ref,
+ 0 /* not in parent */);
+ if (d != 0)
+ {
+ if (d_before == 0)
+ {
+ // First result found.
+ d_before = d;
+ }
+ else
+ {
+ // Conflict against further results?
+ if (d != d_before)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "warning in %s line %d: ",
+ idl_global->filename ()->get_string (),
+ idl_global->lineno ()));
+
+ e->dump (*ACE_DEFAULT_LOG_STREAM);
+
+ ACE_ERROR ((LM_ERROR,
+ " is ambiguous in scope.\n"
+ "Found "));
+
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+
+ ACE_ERROR ((LM_ERROR,
+ " and "));
+
+ d_before->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+
+ ACE_ERROR ((LM_ERROR,
+ ".\n"));
+ }
+ }
+ }
+ }
+
+ return d_before;
+}
+
+AST_Decl *
+AST_Interface::lookup_for_add (AST_Decl *d,
+ bool /* treat_as_ref */)
+{
+ if (d == 0)
+ {
+ return 0;
+ }
+
+ Identifier *id = d->local_name ();
+ AST_Decl *prev = 0;
+ AST_Decl::NodeType nt = NT_root;
+ long nis = -1;
+ AST_Interface **is = 0;
+
+ if (this->idl_keyword_clash (id) != 0)
+ {
+ 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)
+ {
+ return prev;
+ }
+ }
+
+ for (nis = this->n_inherits_flat (), is = this->inherits_flat ();
+ nis > 0;
+ nis--, is++)
+ {
+ prev = (*is)->lookup_by_name_local (id,
+ 0);
+
+ if (prev != 0)
+ {
+ nt = prev->node_type ();
+
+ if (nt == AST_Decl::NT_op || nt == AST_Decl::NT_attr)
+ {
+ return prev;
+ }
+ }
+ }
+
+ return 0;
+}
+
+bool
+AST_Interface::legal_for_primary_key (void) const
+{
+ return false;
+}
+
+void
+AST_Interface::destroy (void)
+{
+ delete [] this->pd_inherits;
+ this->pd_inherits = 0;
+ this->pd_n_inherits = 0;
+
+ delete [] this->pd_inherits_flat;
+ this->pd_inherits_flat = 0;
+ this->pd_n_inherits_flat = 0;
+
+ this->UTL_Scope::destroy ();
+ this->AST_Type::destroy ();
+}
+
+int
+AST_Interface::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_interface (this);
+}
+
+// Narrowing methods.
+IMPL_NARROW_METHODS2(AST_Interface, AST_Type, UTL_Scope)
+IMPL_NARROW_FROM_DECL(AST_Interface)
+IMPL_NARROW_FROM_SCOPE(AST_Interface)
diff --git a/TAO/TAO_IDL/ast/ast_interface_fwd.cpp b/TAO/TAO_IDL/ast/ast_interface_fwd.cpp
new file mode 100644
index 00000000000..7d9c2e78a1b
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_interface_fwd.cpp
@@ -0,0 +1,293 @@
+// $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.
+
+*/
+
+// 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 "ast_interface_fwd.h"
+#include "ast_interface.h"
+#include "ast_module.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+
+ACE_RCSID( ast,
+ ast_interface_fwd,
+ "$Id$")
+
+AST_InterfaceFwd::AST_InterfaceFwd (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ pd_full_definition (0),
+ is_defined_ (false)
+{
+}
+
+AST_InterfaceFwd::AST_InterfaceFwd (AST_Interface *dummy,
+ UTL_ScopedName *n)
+ : COMMON_Base (dummy->is_local (),
+ dummy->is_abstract ()),
+ AST_Decl (AST_Decl::NT_interface_fwd,
+ n),
+ AST_Type (AST_Decl::NT_interface_fwd,
+ n),
+ is_defined_ (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.
+ this->pd_full_definition = dummy;
+}
+
+AST_InterfaceFwd::~AST_InterfaceFwd (void)
+{
+}
+
+// Private operations.
+
+bool
+AST_InterfaceFwd::is_local (void)
+{
+ return this->full_definition ()->is_local ();
+}
+
+bool AST_InterfaceFwd::is_valuetype (void)
+{
+ return this->full_definition ()->node_type () == AST_Decl::NT_valuetype;
+}
+
+bool
+AST_InterfaceFwd::is_abstract_valuetype (void)
+{
+ return (this->full_definition ()->is_abstract ()
+ && this->is_valuetype ());
+}
+
+bool
+AST_InterfaceFwd::full_def_seen (void)
+{
+ UTL_Scope *s = this->defined_in ();
+ AST_Interface *i = 0;
+
+ // If a full definition is seen in a previous module opening
+ // or anywhere in the current scope (before or after our
+ // declaration, reture TRUE.
+
+ if (AST_Decl::NT_module == s->scope_node_type ())
+ {
+ AST_Module *m = AST_Module::narrow_from_scope (s);
+ AST_Decl *d = m->look_in_previous (this->local_name (), false);
+
+ if (0 != d)
+ {
+ i = AST_Interface::narrow_from_decl (d);
+
+ if (0 != i && i->is_defined ())
+ {
+ return true;
+ }
+ }
+ }
+
+ for (UTL_ScopeActiveIterator iter (s, UTL_Scope::IK_decls);
+ !iter.is_done ();
+ iter.next ())
+ {
+ i = AST_Interface::narrow_from_decl (iter.item ());
+
+ if (0 != i && this->local_name ()->compare (i->local_name ()))
+ {
+ if (i->is_defined ())
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+// Redefinition of inherited virtual operations.
+
+// Dump this AST_InterfaceFwd node to the ostream o.
+void
+AST_InterfaceFwd::dump (ACE_OSTREAM_TYPE &o)
+{
+ if (this->is_abstract ())
+ {
+ this->dump_i (o, "abstract ");
+ }
+ else if (this->is_local ())
+ {
+ this->dump_i (o, "local ");
+ }
+
+ this->dump_i (o, "interface ");
+
+ this->local_name ()->dump (o);
+}
+
+int
+AST_InterfaceFwd::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_interface_fwd (this);
+}
+
+// Data accessors.
+
+AST_Interface *
+AST_InterfaceFwd::full_definition (void)
+{
+ return this->pd_full_definition;
+}
+
+void
+AST_InterfaceFwd::set_full_definition (AST_Interface *nfd)
+{
+ delete this->pd_full_definition;
+ this->pd_full_definition = 0;
+ this->pd_full_definition = nfd;
+}
+
+bool
+AST_InterfaceFwd::is_defined (void)
+{
+ // Look for the one instance of the fwd decl
+ // that may have a full definition.
+ if (!this->is_defined_)
+ {
+ AST_Module *m =
+ AST_Module::narrow_from_scope (this->defined_in ());
+
+ if (0 != m)
+ {
+ AST_Decl *d = m->look_in_previous (this->local_name ());
+
+ if (0 != d)
+ {
+ // We could be looking at a superfluous forward decl
+ // of an interface already defined.
+ AST_Interface *full = AST_Interface::narrow_from_decl (d);
+
+ if (0 != full)
+ {
+ this->is_defined_ = true;
+ }
+
+ AST_InterfaceFwd *fwd =
+ AST_InterfaceFwd::narrow_from_decl (d);
+
+ // Since fwd_redefinition_helper() is called
+ // before fe_add_interface(), we can't check
+ // n_inherits() or is_defined(), but added()
+ // is a sufficient way to tell if our full
+ // definition has already gone through the
+ // add_to_scope process.
+ if (0 != fwd && fwd->full_definition ()->added ())
+ {
+ this->is_defined_ = true;
+ }
+ }
+ }
+ }
+
+ return this->is_defined_;
+}
+
+void
+AST_InterfaceFwd::set_as_defined (void)
+{
+ this->is_defined_ = true;
+}
+
+void
+AST_InterfaceFwd::destroy (void)
+{
+ // The implementation of is_defined() accomodates
+ // code generation issues and doesn't have the
+ // correct semantics here. The older implementation
+ // of is_defined is used in the IF block below to
+ // check if our full definition allocation must be
+ // destroyed.
+ if (!this->is_defined_)
+ {
+ // If our full definition is not defined, it
+ // means that there was no full definition
+ // for us in this compilation unit, so we
+ // have to destroy this allocation.
+ this->pd_full_definition->destroy ();
+ delete this->pd_full_definition;
+ this->pd_full_definition = 0;
+ }
+
+ this->AST_Type::destroy ();
+}
+
+// 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
new file mode 100644
index 00000000000..4bb08eddfb8
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_module.cpp
@@ -0,0 +1,1860 @@
+// $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.
+
+*/
+
+// AST_Modules denote IDL module declarations
+// AST_Modules are subclasses of AST_Decl (they are not a type!) and
+// of UTL_Scope.
+
+#include "ast_module.h"
+#include "ast_predefined_type.h"
+#include "ast_valuebox.h"
+#include "ast_valuetype.h"
+#include "ast_valuetype_fwd.h"
+#include "ast_eventtype.h"
+#include "ast_eventtype_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)
+ : AST_Decl (),
+ UTL_Scope (),
+ pd_has_nested_valuetype (0)
+{
+}
+
+AST_Module::AST_Module (UTL_ScopedName *n)
+ : AST_Decl (AST_Decl::NT_module,
+ n),
+ UTL_Scope (AST_Decl::NT_module),
+ pd_has_nested_valuetype (0)
+{
+}
+
+AST_Module::~AST_Module (void)
+{
+}
+
+// Add this AST_PredefinedType node (a predefined type declaration) to
+// this scope.
+
+AST_PredefinedType *
+AST_Module::fe_add_predefined_type (AST_PredefinedType *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, 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,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add this AST_Module node (a module declaration) to this scope.
+AST_Module *
+AST_Module::fe_add_module (AST_Module *t)
+{
+ AST_Decl *d;
+ AST_Module *m = 0;
+
+ UTL_Scope *scope = t->defined_in ();
+ const char *prefix_holder = 0;
+
+ // If our prefix is empty, we check to see if an ancestor has one.
+ while (ACE_OS::strcmp (t->prefix (), "") == 0 && scope != 0)
+ {
+ AST_Decl *parent = ScopeAsDecl (scope);
+ prefix_holder = parent->prefix ();
+
+ // We have reached global scope.
+ if (prefix_holder == 0)
+ {
+ break;
+ }
+
+ t->prefix (const_cast<char *> (prefix_holder));
+ scope = parent->defined_in ();
+ }
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, false)) != 0)
+ {
+ if (!can_be_redefined (d))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ this,
+ d);
+ return 0;
+ }
+
+ m = AST_Module::narrow_from_decl (d);
+
+ // has_ancestor() returns TRUE if both nodes are the same.
+ if (t != m)
+ {
+ if (t->has_ancestor (d))
+ {
+ idl_global->err ()->redefinition_in_scope (t,
+ d);
+ return 0;
+ }
+ }
+
+ const char *prev_prefix = d->prefix ();
+ const char *this_prefix = t->prefix ();
+
+ if (ACE_OS::strcmp (this_prefix, "") == 0)
+ {
+ t->prefix (const_cast<char *> (prev_prefix));
+ }
+ else
+ {
+ if (ACE_OS::strcmp (prev_prefix, "") == 0)
+ {
+ d->prefix (const_cast<char *> (this_prefix));
+ }
+ // (JP) This could give a bogus error, since typeprefix can
+ // appear any time after the corresponding declaration.
+ // The right way to do this is with a separate traversal
+ // after the entire AST is built.
+ /*
+ else
+ {
+ if (ACE_OS::strcmp (this_prefix, prev_prefix) != 0)
+ {
+ idl_global->err ()->error2 (UTL_Error::EIDL_PREFIX_CONFLICT,
+ this,
+ d);
+
+ return 0;
+ }
+ }
+ */
+ }
+ }
+
+ // If this node is not a reopened module, add it to scope and referenced.
+ if (m == 0 || t != m)
+ {
+ // Add it to scope.
+ this->add_to_scope (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+ }
+
+ return t;
+}
+
+// Add this AST_Interface node (an interface declaration) to this scope.
+AST_Interface *
+AST_Module::fe_add_interface (AST_Interface *t)
+{
+ if (t->redef_clash ())
+ {
+ return 0;
+ }
+
+ AST_Decl *predef = 0;
+ AST_Interface *fwd = 0;
+
+ // Already defined?
+ if ((predef = this->lookup_for_add (t, false)) != 0)
+ {
+ // Treat fwd declared interfaces specially
+ if (predef->node_type () == AST_Decl::NT_interface)
+ {
+ fwd = AST_Interface::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);
+
+ // We do this for interfaces, valuetypes and components in
+ // a different place than we do for structs and unions,
+ // since fwd declared structs and unions must be defined in
+ // the same translation unit.
+ AST_InterfaceFwd *fd = t->fwd_decl ();
+
+ if (0 != fd)
+ {
+ fd->set_as_defined ();
+ }
+
+ // Add it to set of locally referenced symbols
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+ return t;
+}
+
+
+// Add this AST_ValueBox node (a value type declaration) to this scope.
+AST_ValueBox *
+AST_Module::fe_add_valuebox (AST_ValueBox *t)
+{
+ AST_Decl *predef = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((predef = this->lookup_for_add (t, false)) != 0)
+ {
+ 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 ()))
+ {
+ 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,
+ false,
+ t->local_name ());
+ 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, 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);
+
+ // We do this for interfaces, valuetypes and components in
+ // a different place than we do for structs and unions,
+ // since fwd declared structs and unions must be defined in
+ // the same translation unit.
+ AST_InterfaceFwd *fd = t->fwd_decl ();
+
+ if (0 != fd)
+ {
+ fd->set_as_defined ();
+ }
+
+ // Add it to set of locally referenced symbols
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+ return t;
+}
+
+// Add this AST_EventType node (an event type declaration) to this scope.
+AST_EventType *
+AST_Module::fe_add_eventtype (AST_EventType *t)
+{
+ if (t->redef_clash ())
+ {
+ return 0;
+ }
+
+ AST_Decl *predef = 0;
+ AST_EventType *fwd = 0;
+
+ // Already defined?
+ if ((predef = this->lookup_for_add (t, false)) != 0)
+ {
+ // Treat fwd declared interfaces specially
+ if (predef->node_type () == AST_Decl::NT_eventtype)
+ {
+ fwd = AST_EventType::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,
+ 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, 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);
+
+ // We do this for interfaces, valuetypes and components in
+ // a different place than we do for structs and unions,
+ // since fwd declared structs and unions must be defined in
+ // the same translation unit.
+ AST_InterfaceFwd *fd = t->fwd_decl ();
+
+ if (0 != fd)
+ {
+ fd->set_as_defined ();
+ }
+
+ // Add it to set of locally referenced symbols
+ this->add_to_referenced (t,
+ 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, 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);
+
+ // The home's local name is not added to the referenced list, since
+ // the name will later be mangled to allow a creation of an
+ // equivalent interface with the original name.
+
+ return t;
+}
+
+// Add this AST_InterfaceFwd node (a forward declaration of an IDL
+// interface) to this scope.
+AST_InterfaceFwd *
+AST_Module::fe_add_interface_fwd (AST_InterfaceFwd *i)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (i, false)) != 0)
+ {
+ AST_Decl::NodeType nt = d->node_type ();
+/*
+ if (nt == AST_Decl::NT_interface_fwd)
+ {
+ AST_InterfaceFwd *ifwd = AST_InterfaceFwd::narrow_from_decl (d);
+ i->set_full_definition (ifwd->full_definition ());
+ }
+*/
+ // 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_interface)
+ {
+ AST_Interface *itf = AST_Interface::narrow_from_decl (d);
+
+ if (itf == 0)
+ {
+ return 0;
+ }
+
+ if (i->added () == 0)
+ {
+ i->set_added (1);
+ this->add_to_scope (i);
+ }
+
+ // @@ Redefinition of forward. Type check not implemented.
+// i->set_full_definition (itf); // @@ Memory leak.
+ return i;
+ }
+
+ if (!can_be_redefined (d)) {
+
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ i,
+ this,
+ d);
+ return 0;
+ }
+
+ // No need to call referenced() for forward declared interafces,
+ // they can be redeclared after referencing.
+
+ if (i->has_ancestor (d))
+ {
+ idl_global->err ()->redefinition_in_scope (i,
+ d);
+ return 0;
+ }
+ }
+
+ // Add it to scope
+ this->add_to_scope (i);
+
+ // Add it to set of locally referenced symbols
+ this->add_to_referenced (i,
+ false,
+ i->local_name ());
+
+ 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;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (v, false)) != 0)
+ {
+ AST_Decl::NodeType nt = d->node_type ();
+
+ if (nt == AST_Decl::NT_valuetype_fwd)
+ {
+ AST_ValueTypeFwd *vfwd = AST_ValueTypeFwd::narrow_from_decl (d);
+ v->set_full_definition (vfwd->full_definition ());
+ }
+
+ // 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_valuetype)
+ {
+ AST_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,
+ false,
+ v->local_name ());
+
+ return v;
+}
+
+// Add this AST_EventTypeFwd node (a forward declaration of an IDL
+// event type) to this scope.
+AST_EventTypeFwd *
+AST_Module::fe_add_eventtype_fwd (AST_EventTypeFwd *v)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (v, false)) != 0)
+ {
+ AST_Decl::NodeType nt = d->node_type ();
+
+ if (nt == AST_Decl::NT_eventtype_fwd)
+ {
+ AST_EventTypeFwd *efwd = AST_EventTypeFwd::narrow_from_decl (d);
+ v->set_full_definition (efwd->full_definition ());
+ }
+
+ // 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_eventtype)
+ {
+ AST_EventType *vtf = AST_EventType::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,
+ 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;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (c, false)) != 0)
+ {
+ AST_Decl::NodeType nt = d->node_type ();
+
+ if (nt == AST_Decl::NT_component_fwd)
+ {
+ AST_ComponentFwd *cfwd = AST_ComponentFwd::narrow_from_decl (d);
+ c->set_full_definition (cfwd->full_definition ());
+ }
+
+ // 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_component)
+ {
+ AST_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,
+ 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)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, 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,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add this AST_Exception node (an exception declaration) to this scope
+AST_Exception *
+AST_Module::fe_add_exception (AST_Exception *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, 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,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add this AST_Union node (a union declaration) to this scope
+AST_Union *
+AST_Module::fe_add_union (AST_Union *t)
+{
+ AST_UnionFwd *fwd = 0;
+ AST_Decl *predef = this->lookup_for_add (t, false);
+
+ if (predef != 0)
+ {
+ // 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,
+ 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;
+ }
+ }
+
+ // Add it to scope.
+ this->add_to_scope (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ return 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, false)) != 0)
+ {
+ AST_Decl::NodeType nt = d->node_type ();
+
+ if (nt == AST_Decl::NT_union_fwd)
+ {
+ AST_UnionFwd *ufwd = AST_UnionFwd::narrow_from_decl (d);
+ t->set_full_definition (ufwd->full_definition ());
+ }
+
+ // 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)
+ {
+ 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,
+ 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, 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,
+ 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;
+ }
+ }
+
+ // Add it to scope.
+ this->add_to_scope (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ 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, false)) != 0)
+ {
+ AST_Decl::NodeType nt = d->node_type ();
+
+ if (nt == AST_Decl::NT_struct_fwd)
+ {
+ AST_StructureFwd *sfwd = AST_StructureFwd::narrow_from_decl (d);
+ t->set_full_definition (sfwd->full_definition ());
+ }
+
+ // 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)
+ {
+ 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,
+ 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)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, 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,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add this AST_EnumVal node (an enumerator declaration) 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_Module::fe_add_enum_val (AST_EnumVal *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add(t, 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,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add this AST_Typedef node (a typedef) to this scope.
+AST_Typedef *
+AST_Module::fe_add_typedef (AST_Typedef *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add(t, 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,
+ 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,
+ false,
+ mru->first_component ());
+ }
+
+ return t;
+}
+
+// Add an AST_Native (a native declaration) to this scope.
+AST_Native *
+AST_Module::fe_add_native (AST_Native *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, 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,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Dump this AST_Module node to the ostream o.
+void
+AST_Module::dump (ACE_OSTREAM_TYPE &o)
+{
+ this->dump_i (o, "module ");
+ this->local_name ()->dump (o);
+ this->dump_i (o, " {\n");
+ UTL_Scope::dump (o);
+ idl_global->indent ()->skip_to (o);
+ this->dump_i (o, "}");
+}
+
+
+// Involved in OBV_ namespace generation.
+void
+AST_Module::set_has_nested_valuetype (void)
+{
+ UTL_Scope *parent = this->defined_in ();
+
+ if (!this->pd_has_nested_valuetype && parent)
+ {
+ AST_Module *pm = AST_Module::narrow_from_scope (parent);
+
+ if (pm != 0)
+ {
+ pm->set_has_nested_valuetype ();
+ }
+ }
+
+ this->pd_has_nested_valuetype = 1;
+}
+
+bool
+AST_Module::has_nested_valuetype (void)
+{
+ return this->pd_has_nested_valuetype;
+}
+
+int
+AST_Module::be_add_interface (AST_Interface *i,
+ AST_Interface *ix)
+{
+ // Add it to scope.
+ this->add_to_scope (i,
+ ix);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (i,
+ false,
+ i->local_name (),
+ ix);
+
+ return 0;
+}
+
+// Has this node been referenced here before?
+bool
+AST_Module::referenced (AST_Decl *e,
+ Identifier *id)
+{
+ bool refd = this->UTL_Scope::referenced (e, id);
+
+ if (refd)
+ {
+ return true;
+ }
+
+ AST_Decl *d = this->look_in_previous (e->local_name (), true);
+
+ if (0 == d)
+ {
+ return false;
+ }
+
+ AST_Type *t = AST_Type::narrow_from_decl (d);
+ return 0 == t || t->is_defined ();
+}
+
+void
+AST_Module::add_to_previous (AST_Module *m)
+{
+ // Here, we depend on the scope iterator in
+ // be_generator::create_module (which calls this function)
+ // to return items in the order they were declared or included.
+ // That means that the last module returned that matches the name
+ // of this one will have all the decls from all previous
+ // reopenings in its previous_ member.
+ this->previous_ = m->previous_;
+
+ AST_Decl *d = 0;
+
+ for (UTL_ScopeActiveIterator iter (DeclAsScope (m), IK_decls);
+ !iter.is_done ();
+ iter.next ())
+ {
+ d = iter.item ();
+
+ // Add all the previous opening's decls (except
+ // for the predefined types) to the 'previous' list
+ // of this one.
+ if (d->node_type () == AST_Decl::NT_pre_defined)
+ {
+ AST_PredefinedType *pdt = AST_PredefinedType::narrow_from_decl (d);
+
+ if (pdt->pt () != AST_PredefinedType::PT_pseudo)
+ {
+ continue;
+ }
+ }
+ else if (d->node_type () == AST_Decl::NT_interface_fwd)
+ {
+ AST_InterfaceFwd *f = AST_InterfaceFwd::narrow_from_decl (d);
+ AST_Interface *i = f->full_definition ();
+
+ // If i is defined, it means that the interface was forward
+ // declared AFTER it was defined, perhaps in a subsequent
+ // opening of the same module - legal, but superfluous.
+ // Adding d to previous_ in that case can only bung up the
+ // results of look_in_previous() later, so we skip it.
+ if (i->is_defined ())
+ {
+ continue;
+ }
+ }
+
+ this->previous_.insert (d);
+ }
+}
+
+AST_Decl *
+AST_Module::look_in_previous (Identifier *e, bool ignore_fwd)
+{
+ AST_Decl **d = 0;
+ AST_Decl *retval = 0;
+
+ // If there are more than two openings of this module, we want
+ // to get the last one - the one that will have the decls from
+ // all the previous openings added to previous_.
+ for (ACE_Unbounded_Set_Iterator<AST_Decl *> iter (this->previous_);
+ !iter.done ();
+ iter.advance ())
+ {
+ iter.next (d);
+
+ if (ignore_fwd)
+ {
+ AST_Decl::NodeType nt = (*d)->node_type ();
+
+ if (nt == AST_Decl::NT_interface_fwd
+ || nt == AST_Decl::NT_eventtype_fwd
+ || nt == AST_Decl::NT_component_fwd
+ || nt == AST_Decl::NT_struct_fwd
+ || nt == AST_Decl::NT_union_fwd
+ || nt == AST_Decl::NT_valuetype_fwd)
+ {
+ continue;
+ }
+ }
+
+ if (e->case_compare ((*d)->local_name ()))
+ {
+ retval = *d;
+ }
+ }
+
+ return retval;
+}
+
+ACE_Unbounded_Set<AST_Decl *> &
+AST_Module::previous (void)
+{
+ return this->previous_;
+}
+
+void
+AST_Module::destroy (void)
+{
+ this->UTL_Scope::destroy ();
+ this->AST_Decl::destroy ();
+}
+
+int
+AST_Module::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_module (this);
+}
+
+// Narrowing methods
+IMPL_NARROW_METHODS2(AST_Module, AST_Decl, UTL_Scope)
+IMPL_NARROW_FROM_DECL(AST_Module)
+IMPL_NARROW_FROM_SCOPE(AST_Module)
diff --git a/TAO/TAO_IDL/ast/ast_native.cpp b/TAO/TAO_IDL/ast/ast_native.cpp
new file mode 100644
index 00000000000..c8f5b6625c1
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_native.cpp
@@ -0,0 +1,65 @@
+// $Id$
+
+#include "ast_native.h"
+#include "ast_visitor.h"
+
+ACE_RCSID (ast,
+ ast_native,
+ "$Id$")
+
+AST_Native::AST_Native (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType (),
+ UTL_Scope (),
+ AST_Structure (),
+ AST_Exception ()
+{
+}
+
+AST_Native::AST_Native (UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_native,
+ n),
+ AST_Type (AST_Decl::NT_native,
+ n),
+ AST_ConcreteType (AST_Decl::NT_native,
+ n),
+ UTL_Scope (AST_Decl::NT_native),
+ AST_Structure (AST_Decl::NT_native,
+ n,
+ true,
+ false),
+ AST_Exception (n,
+ true,
+ false)
+{
+}
+
+AST_Native::~AST_Native (void)
+{
+}
+
+void
+AST_Native::destroy (void)
+{
+ this->AST_Exception::destroy ();
+}
+
+// Dump this AST_Native node to the ostream o.
+void
+AST_Native::dump (ACE_OSTREAM_TYPE &o)
+{
+ AST_Decl::dump (o);
+}
+
+int
+AST_Native::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_native (this);
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS1(AST_Native, AST_Exception)
+IMPL_NARROW_FROM_DECL(AST_Native)
diff --git a/TAO/TAO_IDL/ast/ast_operation.cpp b/TAO/TAO_IDL/ast/ast_operation.cpp
new file mode 100644
index 00000000000..4efe7f6a6a6
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_operation.cpp
@@ -0,0 +1,595 @@
+// $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.
+
+*/
+
+// AST_Operation nodes denote IDL operation declarations
+// AST_Operations are a subclass of AST_Decl (they are not a type!)
+// and of UTL_Scope (the arguments are managed in a scope).
+// AST_Operations have a return type (a subclass of AST_Type),
+// a bitfield for denoting various properties of the operation (the
+// values are ORed together from constants defined in the enum
+// AST_Operation::FLags), a name (a UTL_ScopedName), a context
+// (implemented as a list of Strings, a UTL_StrList), and a raises
+// clause (implemented as an array of AST_Exceptions).
+
+#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)
+ : COMMON_Base (),
+ AST_Decl(),
+ UTL_Scope(),
+ pd_return_type (0),
+ pd_flags (OP_noflags),
+ pd_context (0),
+ pd_exceptions (0),
+ argument_count_ (-1),
+ has_native_ (0)
+{
+}
+
+AST_Operation::AST_Operation (AST_Type *rt,
+ Flags fl,
+ UTL_ScopedName *n,
+ bool local,
+ bool abstract)
+ : COMMON_Base (local,
+ abstract),
+ AST_Decl(AST_Decl::NT_op,
+ n),
+ UTL_Scope(AST_Decl::NT_op),
+ pd_return_type (rt),
+ pd_flags (fl),
+ pd_context (0),
+ pd_exceptions (0),
+ argument_count_ (-1),
+ has_native_ (0)
+{
+ AST_PredefinedType *pdt = 0;
+
+ // Check that if the operation is oneway, the return type must be void.
+ if (rt != 0 && pd_flags == OP_oneway)
+ {
+ if (rt->node_type () != AST_Decl::NT_pre_defined)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_NONVOID_ONEWAY,
+ this);
+ }
+ else
+ {
+ pdt = AST_PredefinedType::narrow_from_decl (rt);
+
+ if (pdt == 0 || pdt->pt () != AST_PredefinedType::PT_void)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_NONVOID_ONEWAY,
+ this);
+ }
+ }
+ }
+}
+
+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)
+{
+ this->compute_argument_attr ();
+
+ return this->argument_count_;
+}
+
+int
+AST_Operation::count_arguments_with_direction (int direction_mask)
+{
+ int count = 0;
+
+ for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ AST_Argument *arg =
+ AST_Argument::narrow_from_decl (si.item ());
+
+ if ((arg->direction () & direction_mask) != 0)
+ {
+ ++count;
+ }
+ }
+
+ return count;
+}
+
+
+// Return if any argument or the return type is a <native> type.
+int
+AST_Operation::has_native (void)
+{
+ this->compute_argument_attr ();
+
+ return this->has_native_;
+}
+
+void
+AST_Operation::destroy (void)
+{
+ // No need to delete our exception list, the
+ // destroy() method does it. The UTL_ExceptList
+ // destroy() method does NOT delete the contained
+ // exception nodes.
+
+ if (this->pd_exceptions != 0)
+ {
+ this->pd_exceptions->destroy ();
+ this->pd_exceptions = 0;
+ }
+
+ this->UTL_Scope::destroy ();
+ this->AST_Decl::destroy ();
+}
+
+// Private operations.
+
+// Compute total number of members.
+int
+AST_Operation::compute_argument_attr (void)
+{
+ if (this->argument_count_ != -1)
+ {
+ return 0;
+ }
+
+ AST_Decl *d = 0;
+ AST_Type *type = 0;
+ AST_Argument *arg = 0;
+
+ this->argument_count_ = 0;
+
+ // If there are elements in this scope.
+ if (this->nmembers () > 0)
+ {
+ // Instantiate a scope iterator.
+ for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ // Get the next AST decl node.
+ d = si.item ();
+
+ if (d->node_type () == AST_Decl::NT_argument)
+ {
+ this->argument_count_++;
+
+ arg = AST_Argument::narrow_from_decl (d);
+
+ type = AST_Type::narrow_from_decl (arg->field_type ());
+
+ if (type->node_type () == AST_Decl::NT_native)
+ {
+ this->has_native_ = 1;
+ }
+ }
+ }
+ }
+
+ type = AST_Type::narrow_from_decl (this->return_type ());
+
+ if (type->node_type () == AST_Decl::NT_native)
+ {
+ this->has_native_ = 1;
+ }
+
+ return 0;
+}
+
+// Add this context (a UTL_StrList) to this scope.
+UTL_StrList *
+AST_Operation::fe_add_context (UTL_StrList *t)
+{
+ this->pd_context = t;
+
+ return t;
+}
+
+UTL_ExceptList *
+AST_Operation::be_add_exceptions (UTL_ExceptList *t)
+{
+ if (this->pd_exceptions != 0)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_RAISES,
+ this);
+ }
+ else
+ {
+ this->pd_exceptions = 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;
+}
+
+int
+AST_Operation::be_insert_exception (AST_Exception *ex)
+{
+ UTL_ExceptList *new_list = 0;
+ ACE_NEW_RETURN (new_list,
+ UTL_ExceptList (ex,
+ this->pd_exceptions),
+ -1);
+ this->pd_exceptions = new_list;
+ return 0;
+}
+
+// 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
+// exceptions that this operation can raise.
+
+// NOTE: No attempt is made to ensure that exceptions are mentioned
+// only once..
+UTL_NameList *
+AST_Operation::fe_add_exceptions (UTL_NameList *t)
+{
+ if (0 == t)
+ {
+ return 0;
+ }
+
+ UTL_ScopedName *nl_n = 0;
+ AST_Exception *fe = 0;
+ AST_Decl *d = 0;
+
+ this->pd_exceptions = 0;
+
+ for (UTL_NamelistActiveIterator nl_i (t); !nl_i.is_done (); nl_i.next ())
+ {
+ nl_n = nl_i.item ();
+ d = this->lookup_by_name (nl_n, true);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (nl_n);
+ return 0;
+ }
+
+ bool oneway_op = (this->flags () == AST_Operation::OP_oneway);
+ fe = AST_Exception::narrow_from_decl (d);
+
+ if (oneway_op && fe != 0)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_RAISES,
+ this);
+ }
+
+ if (fe == 0)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_RAISES,
+ this);
+ return 0;
+ }
+
+ if (this->pd_exceptions == 0)
+ {
+ ACE_NEW_RETURN (this->pd_exceptions,
+ UTL_ExceptList (fe,
+ 0),
+ 0);
+ }
+ else
+ {
+ UTL_ExceptList *el = 0;
+ ACE_NEW_RETURN (el,
+ UTL_ExceptList (fe,
+ 0),
+ 0);
+
+ this->pd_exceptions->nconc (el);
+ }
+ }
+
+ // This return value is never used, it's easier to
+ // destroy it here and return 0 than to destroy it
+ // each place it is passed in.
+ t->destroy ();
+ delete t;
+ t = 0;
+ return 0;
+}
+
+// Add this AST_Argument node (an operation argument declaration)
+// to this scope.
+AST_Argument *
+AST_Operation::fe_add_argument (AST_Argument *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = lookup_by_name_local (t->local_name(), 0)) != 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;
+ }
+ }
+
+ // Cannot add OUT or INOUT argument to oneway operation.
+ if ((t->direction () == AST_Argument::dir_OUT
+ || t->direction() == AST_Argument::dir_INOUT)
+ && pd_flags == OP_oneway)
+ {
+ idl_global->err ()->error2 (UTL_Error::EIDL_ONEWAY_CONFLICT,
+ t,
+ this);
+ return 0;
+ }
+
+ AST_Type *arg_type = t->field_type ();
+
+ // This error is not caught in y.tab.cpp so we check for it here.
+ if (arg_type->node_type () == AST_Decl::NT_array
+ && arg_type->anonymous () == true)
+ {
+ idl_global->err ()->syntax_error (idl_global->parse_state ());
+ }
+
+ // Add it to scope.
+ this->add_to_scope (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ UTL_ScopedName *mru = arg_type->last_referenced_as ();
+
+ if (mru != 0)
+ {
+ this->add_to_referenced (arg_type,
+ false,
+ mru->first_component ());
+ }
+
+ return t;
+}
+
+// Dump this AST_Operation node (an operation) to the ostream o.
+void
+AST_Operation::dump (ACE_OSTREAM_TYPE &o)
+{
+ AST_Decl *d = 0;
+ AST_Exception *e = 0;
+ UTL_String *s = 0;
+
+ if (this->pd_flags == OP_oneway)
+ {
+ this->dump_i (o, "oneway ");
+ }
+ else if (this->pd_flags == OP_idempotent)
+ {
+ this->dump_i (o, "idempotent ");
+ }
+
+ this->pd_return_type->name ()->dump (o);
+ this->dump_i (o, " ");
+ this->local_name ()->dump (o);
+ this->dump_i (o, "(");
+
+ // Must advance the iterator explicity inside the loop.
+ for (UTL_ScopeActiveIterator i (this, IK_decls); !i.is_done ();)
+ {
+ d = i.item ();
+ d->dump (o);
+ i.next ();
+
+ if (!i.is_done())
+ {
+ this->dump_i (o, ", ");
+ }
+ }
+
+ this->dump_i (o, ")");
+
+ if (this->pd_exceptions != 0)
+ {
+ this->dump_i (o, " raises(");
+
+ // Must advance the iterator explicity inside the loop.
+ for (UTL_ExceptlistActiveIterator ei (this->pd_exceptions);
+ !ei.is_done ();)
+ {
+ e = ei.item ();
+ ei.next ();
+ e->local_name ()->dump (o);
+
+ if (!ei.is_done())
+ {
+ this->dump_i (o, ", ");
+ }
+ }
+
+ this->dump_i (o, ")");
+ }
+
+ if (this->pd_context != 0)
+ {
+ this->dump_i (o, " context(");
+
+ // Must advance the iterator explicity inside the loop.
+ for (UTL_StrlistActiveIterator si (this->pd_context); !si.is_done();)
+ {
+ s = si.item ();
+ si.next ();
+ this->dump_i (o, s->get_string ());
+
+ if (!si.is_done())
+ {
+ this->dump_i (o, ", ");
+ }
+ }
+
+ this->dump_i (o, ")");
+ }
+}
+
+int
+AST_Operation::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_operation (this);
+}
+
+// Data accessors
+
+AST_Type *
+AST_Operation::return_type (void)
+{
+ return this->pd_return_type;
+}
+
+AST_Operation::Flags
+AST_Operation::flags (void)
+{
+ return this->pd_flags;
+}
+
+UTL_StrList *
+AST_Operation::context (void)
+{
+ return this->pd_context;
+}
+
+UTL_ExceptList *
+AST_Operation::exceptions (void)
+{
+ return this->pd_exceptions;
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS2(AST_Operation, AST_Decl, UTL_Scope)
+IMPL_NARROW_FROM_DECL(AST_Operation)
+IMPL_NARROW_FROM_SCOPE(AST_Operation)
diff --git a/TAO/TAO_IDL/ast/ast_predefined_type.cpp b/TAO/TAO_IDL/ast/ast_predefined_type.cpp
new file mode 100644
index 00000000000..e98a2486abf
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_predefined_type.cpp
@@ -0,0 +1,286 @@
+// $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.
+
+*/
+
+// AST_PredefinedType nodes denote the various predefined types such
+// as long, short, etc. that are available in IDL. Each AST_PredefinedType
+// node has a field (the value of this field is from the enum
+// AST_PredefinedType::PredefinedType) which denotes the specific predefined
+// type that this node represents. There is only one node in the entire
+// AST which represents each predefined type, such as long etc.
+
+#include "ast_predefined_type.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+#include "global_extern.h"
+#include "ace/Log_Msg.h"
+#include "ace/OS_NS_stdio.h"
+
+ACE_RCSID (ast,
+ ast_predefined_type,
+ "$Id$")
+
+AST_PredefinedType::AST_PredefinedType (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType (),
+ pd_pt (PT_long)
+{
+}
+
+AST_PredefinedType::AST_PredefinedType (PredefinedType t,
+ UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_pre_defined,
+ n,
+ true),
+ AST_Type (AST_Decl::NT_pre_defined,
+ n),
+ AST_ConcreteType (AST_Decl::NT_pre_defined,
+ n),
+ 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_value:
+ ACE_NEW (id,
+ Identifier ("ValueBase"));
+ 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);
+ }
+
+ // The repo id computation in the AST_Decl constructor can't
+ // be easily modified to work for predefined types.
+ ACE_CString repo_id = ACE_CString ("IDL:omg.org/CORBA/")
+ + id->get_string ()
+ + ":"
+ + this->version ();
+ delete [] this->repoID_;
+ size_t len = repo_id.length ();
+ ACE_NEW (this->repoID_,
+ char[len + 1]);
+ this->repoID_[0] = '\0';
+ ACE_OS::sprintf (this->repoID_,
+ "%s",
+ repo_id.c_str ());
+ this->repoID_[len] = '\0';
+
+ this->set_name (new_name);
+}
+
+AST_PredefinedType::~AST_PredefinedType (void)
+{
+}
+
+// Redefinition of inherited virtual operations.
+
+// Dump this AST_PredefinedType node to the ostream o.
+void
+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)
+{
+ switch (this->pd_pt)
+ {
+ case AST_PredefinedType::PT_any:
+ case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
+ this->size_type (AST_Type::VARIABLE);
+ break;
+ default:
+ this->size_type (AST_Type::FIXED);
+ break;
+ }
+
+ return 0;
+}
+
+int
+AST_PredefinedType::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_predefined_type (this);
+}
+
+void
+AST_PredefinedType::destroy (void)
+{
+ this->AST_ConcreteType::destroy ();
+}
+
+// Data accessors.
+
+AST_PredefinedType::PredefinedType
+AST_PredefinedType::pt (void)
+{
+ return this->pd_pt;
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS1(AST_PredefinedType, AST_ConcreteType)
+IMPL_NARROW_FROM_DECL(AST_PredefinedType)
diff --git a/TAO/TAO_IDL/ast/ast_recursive.cpp b/TAO/TAO_IDL/ast/ast_recursive.cpp
new file mode 100644
index 00000000000..1603b184a0b
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_recursive.cpp
@@ -0,0 +1,223 @@
+// $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.
+
+*/
+
+// EXPLANATION: The CORBA spec says that the only legal use of recursive types is
+// in a manifest sequence declared inside a struct or union whose base type is
+// the struct or union.
+
+// ALGORITHM FOR CHECK:
+// Sequences push a NULL on the scope stack to mark where in the scope nesting
+// they appear.
+
+// - If the type is not a struct or union, return FALSE (legal use of type).
+// - Otherwise check up the scope stack, looking for this base type. If we
+// find a NULL return FALSE (legal use of type, since it is inside some
+// sequence). If we find the type on the stack, return TRUE (illegal use
+// 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 "ast_union.h"
+#include "utl_stack.h"
+#include "global_extern.h"
+#include "nr_extern.h"
+
+ACE_RCSID (ast,
+ ast_recursive,
+ "$Id$")
+
+bool
+AST_illegal_interface_recursion (AST_Decl *t)
+{
+ // Can't be 0 since we know we have an interface or valuetype.
+ AST_Decl *d = 0;
+
+ // If we encounter the argument in an enclosing scope, it's illegal.
+ for (UTL_ScopeStackActiveIterator i (idl_global->scopes ());
+ !i.is_done ();
+ i.next ())
+ {
+ d = ScopeAsDecl (i.item ());
+
+ // Exceptions cannot be recursive, but may contain a reference
+ // to the interface they are defined in.
+ if (d->node_type () == AST_Decl::NT_except)
+ {
+ return false;
+ }
+
+ if (d == t)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool
+AST_illegal_recursive_type (AST_Decl *t)
+{
+ if (t == 0)
+ {
+ return false;
+ }
+
+ AST_Decl::NodeType nt;
+ AST_Type *ut = AST_Type::narrow_from_decl (t);
+
+ if (ut != 0)
+ {
+ ut = ut->unaliased_type ();
+ nt = ut->node_type ();
+ }
+ else
+ {
+ nt = t->node_type ();
+ }
+
+ if (nt == AST_Decl::NT_interface)
+ {
+ // Check for interface->struct/union->....->interface nesting.
+// return AST_illegal_interface_recursion (t);
+ }
+ else if (nt != AST_Decl::NT_struct && nt != AST_Decl::NT_union)
+ {
+ // Structs and unions fall through to the check below.
+ return false; // NOT ILLEGAL.
+ }
+
+ bool check_for_struct = false;
+ bool check_for_union = false;
+ AST_Structure *st1 = 0;
+ AST_Union *un1 = 0;
+
+ // Narrow the type appropriately so comparison will work.
+ if (t->node_type () == AST_Decl::NT_struct)
+ {
+ check_for_struct = true;
+ st1 = AST_Structure::narrow_from_decl (t);
+
+ if (st1 == 0)
+ {
+ return false; // NOT ILLEGAL.
+ }
+ }
+ else if (t->node_type () == AST_Decl::NT_union)
+ {
+ check_for_union = true;
+ un1 = AST_Union::narrow_from_decl (t);
+
+ if (un1 == 0)
+ {
+ return false; // NOT ILLEGAL.
+ }
+ }
+
+ UTL_Scope *s = 0;
+ AST_Structure *st2 = 0;
+ AST_Union *un2 = 0;
+
+ // OK, iterate up the stack.
+ for (UTL_ScopeStackActiveIterator i (idl_global->scopes ());
+ !i.is_done ();
+ i.next ())
+ {
+ s = i.item ();
+
+ // If we hit a NULL we're done since it means that we're nested inside
+ // a sequence, where recursive types may be used.
+ if (s == 0)
+ {
+ return false; // NOT ILLEGAL.
+ }
+
+ // OK, must check this scope.
+ if (s->scope_node_type () == AST_Decl::NT_struct
+ && check_for_struct == true)
+ {
+ st2 = AST_Structure::narrow_from_scope (s);
+
+ if (st2 != 0 && st2 == st1)
+ {
+ return true; // ILLEGAL RECURSIVE TYPE USE.
+ }
+ }
+ else if (s->scope_node_type () == AST_Decl::NT_union
+ && check_for_union == true)
+ {
+ un2 = AST_Union::narrow_from_scope (s);
+
+ if (un2 != 0 && un2 == un1)
+ {
+ return true; // ILLEGAL RECURSIVE TYPE USE.
+ }
+ }
+ }
+
+ // No more scopes to check. This type was used legally.
+ return false; // NOT ILLEGAL.
+}
+
diff --git a/TAO/TAO_IDL/ast/ast_redef.cpp b/TAO/TAO_IDL/ast/ast_redef.cpp
new file mode 100644
index 00000000000..92043ccba80
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_redef.cpp
@@ -0,0 +1,117 @@
+// $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.
+
+*/
+
+#include "ast_decl.h"
+
+ACE_RCSID (ast,
+ ast_redef,
+ "$Id$")
+
+// Return TRUE if the node d represents an IDL construct whose name
+// can be redefined.
+bool
+can_be_redefined (AST_Decl *d)
+{
+ switch (d->node_type ())
+ {
+ 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_eventtype:
+ case AST_Decl::NT_eventtype_fwd:
+ case AST_Decl::NT_home:
+ case AST_Decl::NT_const:
+ case AST_Decl::NT_except:
+ case AST_Decl::NT_argument:
+ case AST_Decl::NT_enum_val:
+ case AST_Decl::NT_string:
+ case AST_Decl::NT_wstring:
+ 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:
+ case AST_Decl::NT_valuebox:
+ return true;
+
+ case AST_Decl::NT_union_branch:
+ case AST_Decl::NT_field:
+ case AST_Decl::NT_attr:
+ case AST_Decl::NT_op:
+ case AST_Decl::NT_pre_defined:
+ case AST_Decl::NT_factory:
+ default:
+ return false;
+ }
+}
+
diff --git a/TAO/TAO_IDL/ast/ast_root.cpp b/TAO/TAO_IDL/ast/ast_root.cpp
new file mode 100644
index 00000000000..5c87e1983e9
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_root.cpp
@@ -0,0 +1,275 @@
+// $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.
+
+*/
+
+// AST_Root nodes represent the roots of ASTs.
+// AST_Root is a subclass of AST_Module, and is defined to allow BEs
+// to subclass it to associate their own information with an entire
+// AST.
+
+#include "ast_root.h"
+#include "ast_sequence.h"
+#include "ast_string.h"
+#include "ast_array.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_Memory.h"
+
+ACE_RCSID (ast,
+ ast_root,
+ "$Id$")
+
+AST_Root::AST_Root (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ UTL_Scope (),
+ AST_Module ()
+{
+}
+
+AST_Root::AST_Root (UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_root,
+ n),
+ UTL_Scope (AST_Decl::NT_root),
+ AST_Module (n)
+{
+}
+
+AST_Root::~AST_Root (void)
+{
+}
+
+// Overrides the one in UTL_Scope - this one doesn't
+// count the predefined types.
+unsigned long
+AST_Root::nmembers (void)
+{
+ unsigned long retval = 0;
+
+ for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ if (si.item ()->node_type () == AST_Decl::NT_pre_defined)
+ {
+ continue;
+ }
+
+ ++retval;
+ }
+
+ return retval;
+}
+
+// Add this AST_Sequence to the locally defined types in this scope.
+AST_Sequence *
+AST_Root::fe_add_sequence (AST_Sequence *t)
+{
+ if (t == 0)
+ {
+ return 0;
+ }
+
+ Identifier *id = 0;
+ ACE_NEW_RETURN (id,
+ Identifier ("local type"),
+ 0);
+
+ UTL_ScopedName *sn = 0;
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (id,
+ 0),
+ 0);
+
+ t->set_name (sn);
+ this->add_to_local_types (t);
+ return t;
+}
+
+// Add this AST_String to the locally defined types in this scope.
+AST_String *
+AST_Root::fe_add_string (AST_String *t)
+{
+ if (t == 0)
+ {
+ return 0;
+ }
+
+ Identifier *id = 0;
+ ACE_NEW_RETURN (id,
+ Identifier ("local type"),
+ 0);
+
+ UTL_ScopedName *sn = 0;
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (id,
+ 0),
+ 0);
+
+ t->set_name (sn);
+ this->add_to_local_types (t);
+ return t;
+}
+
+// Add this AST_Array to the locally defined types in this scope.
+AST_Array *
+AST_Root::fe_add_array (AST_Array *t)
+{
+ if (t == 0)
+ {
+ return 0;
+ }
+
+ Identifier *id = 0;
+ ACE_NEW_RETURN (id,
+ Identifier ("local type"),
+ 0);
+
+ UTL_ScopedName *sn = 0;
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (id,
+ 0),
+ 0);
+
+ t->set_name (sn);
+ this->add_to_local_types (t);
+ return t;
+}
+
+// Redefinition of inherited virtual operations.
+
+// Dump this AST_Root node to the ostream o.
+void
+AST_Root::dump (ACE_OSTREAM_TYPE &o)
+{
+ UTL_Scope::dump (o);
+}
+
+int
+AST_Root::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_root (this);
+}
+
+void
+AST_Root::destroy ()
+{
+ long i = 0;
+ long j = 0;
+ AST_Decl *d = 0;
+
+ // Just destroy and delete the non-predefined types in the
+ // scope, in case we are processing multiple IDL files.
+ // Final cleanup will be done in fini().
+ for (i = this->pd_decls_used; i > 0; --i)
+ {
+ d = this->pd_decls[i - 1];
+
+ // We want to keep the predefined types we add to global
+ // scope around and not add them each time.
+ if (d->node_type () == AST_Decl::NT_pre_defined)
+ {
+ j = i;
+ break;
+ }
+
+ d->destroy ();
+ delete d;
+ d = 0;
+ --this->pd_decls_used;
+ }
+
+ // This array of pointers holds references, no need
+ // for destruction. The array itself will be cleaned
+ // up when AST_Root::fini() calls UTL_Scope::destroy ().
+ for (i = this->pd_referenced_used; i > j; --i)
+ {
+ this->pd_referenced[i - 1] = 0;
+ --this->pd_referenced_used;
+ }
+
+ for (i = this->pd_name_referenced_used; i > j; --i)
+ {
+ Identifier *id = this->pd_name_referenced[i - 1];
+ id->destroy ();
+ delete id;
+ id = 0;
+ --this->pd_name_referenced_used;
+ }
+}
+
+void
+AST_Root::fini (void)
+{
+ this->UTL_Scope::destroy ();
+ this->AST_Decl::destroy ();
+}
+
+// Narrowing methods.
+IMPL_NARROW_METHODS1(AST_Root, AST_Module)
+IMPL_NARROW_FROM_DECL(AST_Root)
+IMPL_NARROW_FROM_SCOPE(AST_Root)
diff --git a/TAO/TAO_IDL/ast/ast_sequence.cpp b/TAO/TAO_IDL/ast/ast_sequence.cpp
new file mode 100644
index 00000000000..6389a8b6f0a
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_sequence.cpp
@@ -0,0 +1,264 @@
+// $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.
+
+*/
+
+// AST_Sequence nodes represent IDL sequence declarations.
+// AST_Sequence is a subclass of AST_ConcreteType.
+// AST_Sequence nodes have a maximum size (an AST_Expression which
+// must evaluate to a positive integer) and a base type (a subclass
+// of AST_Type).
+
+#include "ast_sequence.h"
+#include "ast_typedef.h"
+#include "ast_expression.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+#include "global_extern.h"
+#include "ace/Log_Msg.h"
+#include "ace/OS_Memory.h"
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (ast,
+ ast_sequence,
+ "$Id$")
+
+AST_Sequence::AST_Sequence (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType (),
+ pd_max_size (0),
+ pd_base_type (0),
+ owns_base_type_ (false)
+{
+ // 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,
+ bool local,
+ bool abstract)
+ : COMMON_Base (bt->is_local () || local,
+ abstract),
+ AST_Decl (AST_Decl::NT_sequence,
+ n,
+ true),
+ AST_Type (AST_Decl::NT_sequence,
+ n),
+ AST_ConcreteType (AST_Decl::NT_sequence,
+ n),
+ pd_max_size (ms),
+ pd_base_type (bt),
+ owns_base_type_ (false)
+{
+ // Check if we are bounded or unbounded. An expression value of 0 means
+ // unbounded.
+ if (ms->ev ()->u.ulval == 0)
+ {
+ this->unbounded_ = true;
+ }
+ else
+ {
+ this->unbounded_ = false;
+ }
+
+ // A sequence data type is always VARIABLE.
+ this->size_type (AST_Type::VARIABLE);
+
+ AST_Decl::NodeType nt = bt->node_type ();
+
+ if (AST_Decl::NT_array == nt || AST_Decl::NT_sequence == nt)
+ {
+ this->owns_base_type_ = true;
+ }
+}
+
+AST_Sequence::~AST_Sequence (void)
+{
+}
+
+// Public operations.
+
+bool
+AST_Sequence::in_recursion (ACE_Unbounded_Queue<AST_Type *> &list)
+{
+ // We should calculate this only once. If it has already been
+ // done, just return it.
+ if (this->in_recursion_ != -1)
+ {
+ return this->in_recursion_;
+ }
+
+ AST_Type *type = AST_Type::narrow_from_decl (this->base_type ());
+
+ if (!type)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%N:%l) AST_Sequence::")
+ ACE_TEXT ("in_recursion - ")
+ ACE_TEXT ("bad base type\n")),
+ 0);
+ }
+
+ if (type->node_type () == AST_Decl::NT_typedef)
+ {
+ AST_Typedef *td = AST_Typedef::narrow_from_decl (type);
+ type = td->primitive_base_type ();
+ AST_Decl::NodeType nt = type->node_type ();
+
+ if (nt != AST_Decl::NT_struct && nt != AST_Decl::NT_union)
+ {
+ return false;
+ }
+ }
+
+ if (this->match_names (type, list))
+ {
+ // They match.
+ this->in_recursion_ = 1;
+ idl_global->recursive_type_seen_ = true;
+ }
+ else
+ {
+ // Check the element type.
+ list.enqueue_tail (type);
+ this->in_recursion_ = type->in_recursion (list);
+
+ if (this->in_recursion_ == 1)
+ {
+ idl_global->recursive_type_seen_ = true;
+ }
+ }
+
+ return this->in_recursion_;
+}
+
+// Redefinition of inherited virtual operations.
+
+// Dump this AST_Sequence node to the ostream o.
+void
+AST_Sequence::dump (ACE_OSTREAM_TYPE &o)
+{
+ this->dump_i (o, "sequence <");
+ this->pd_base_type->dump (o);
+ this->dump_i (o, ", ");
+ this->pd_max_size->dump (o);
+ this->dump_i (o, ">");
+}
+
+int
+AST_Sequence::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_sequence (this);
+}
+
+// Data accessors.
+
+AST_Expression *
+AST_Sequence::max_size (void)
+{
+ return this->pd_max_size;
+}
+
+AST_Type *
+AST_Sequence::base_type (void) const
+{
+ return this->pd_base_type;
+}
+
+bool
+AST_Sequence::unbounded (void) const
+{
+ return this->unbounded_;
+}
+
+bool
+AST_Sequence::legal_for_primary_key (void) const
+{
+ return this->base_type ()->legal_for_primary_key ();
+}
+
+void
+AST_Sequence::destroy (void)
+{
+ if (this->owns_base_type_)
+ {
+ this->pd_base_type->destroy ();
+ delete this->pd_base_type;
+ this->pd_base_type = 0;
+ }
+
+ this->pd_max_size->destroy ();
+ delete this->pd_max_size;
+ this->pd_max_size = 0;
+
+ this->AST_ConcreteType::destroy ();
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS1(AST_Sequence, AST_ConcreteType)
+IMPL_NARROW_FROM_DECL(AST_Sequence)
diff --git a/TAO/TAO_IDL/ast/ast_string.cpp b/TAO/TAO_IDL/ast/ast_string.cpp
new file mode 100644
index 00000000000..35fed0da5a1
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_string.cpp
@@ -0,0 +1,208 @@
+// $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.
+
+*/
+
+// AST_String nodes represent IDL string declarations.
+// AST_String is a subclass of AST_ConcreteType.
+// AST_String nodes have a maximum size (an AST_Expression which must
+// evaluate to a positive integer).
+
+#include "ast_string.h"
+#include "ast_expression.h"
+#include "ast_visitor.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+#include "utl_identifier.h"
+#include "idl_defines.h"
+#include "global_extern.h"
+
+ACE_RCSID (ast,
+ ast_string,
+ "$Id$")
+
+AST_String::AST_String (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType (),
+ pd_max_size (0),
+ pd_width (sizeof (char))
+{
+ // Always the case.
+ this->size_type (AST_Type::VARIABLE);
+}
+
+AST_String::AST_String (AST_Decl::NodeType nt,
+ UTL_ScopedName *n,
+ AST_Expression *ms,
+ long wide)
+ : COMMON_Base (),
+ AST_Decl (nt,
+ n,
+ true),
+ AST_Type (nt,
+ n),
+ AST_ConcreteType (nt,
+ n),
+ pd_max_size (ms),
+ pd_width (wide)
+{
+ // Always the case.
+ this->size_type (AST_Type::VARIABLE);
+
+ Identifier *id = 0;
+ UTL_ScopedName *new_name = 0;
+ UTL_ScopedName *conc_name = 0;
+
+ ACE_NEW (id,
+ Identifier (this->width () == 1 ? "Char *" : "WChar *"));
+
+ ACE_NEW (conc_name,
+ UTL_ScopedName (id,
+ 0));
+
+ ACE_NEW (id,
+ Identifier ("CORBA"));
+
+ ACE_NEW (new_name,
+ UTL_ScopedName (id,
+ conc_name));
+
+ this->set_name (new_name);
+
+ unsigned long bound = ms->ev ()->u.ulval;
+
+ static char namebuf[NAMEBUFSIZE];
+ static char boundbuf[NAMEBUFSIZE];
+ ACE_OS::memset (namebuf,
+ '\0',
+ NAMEBUFSIZE);
+ ACE_OS::memset (boundbuf,
+ '\0',
+ NAMEBUFSIZE);
+
+ if (bound)
+ {
+ ACE_OS::sprintf (boundbuf,
+ "_%ld",
+ bound);
+ }
+
+ ACE_OS::sprintf (namebuf,
+ "CORBA_%sSTRING%s",
+ (wide == 1 ? "" : "W"),
+ boundbuf);
+
+ this->flat_name_ = ACE::strnew (namebuf);
+}
+
+AST_String::~AST_String (void)
+{
+}
+
+// Redefinition of inherited virtual operations.
+
+// Dump this AST_String node to the ostream o.
+void
+AST_String::dump (ACE_OSTREAM_TYPE &o)
+{
+ this->dump_i (o, "string <");
+ this->pd_max_size->dump (o);
+ this->dump_i (o, ">");
+}
+
+int
+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_ConcreteType::destroy ();
+}
+
+// Data accessors.
+
+AST_Expression *
+AST_String::max_size (void)
+{
+ return this->pd_max_size;
+}
+
+long
+AST_String::width (void)
+{
+ return this->pd_width;
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS1(AST_String, AST_ConcreteType)
+IMPL_NARROW_FROM_DECL(AST_String)
diff --git a/TAO/TAO_IDL/ast/ast_structure.cpp b/TAO/TAO_IDL/ast/ast_structure.cpp
new file mode 100644
index 00000000000..e5f83a1c0b8
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_structure.cpp
@@ -0,0 +1,791 @@
+// $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.
+
+*/
+
+// AST_Structure nodes denote IDL struct declarations.
+// AST_Structure is a subclass of AST_ConcreteType and of UTL_Scope (the
+// structure's fields are managed in a scope).
+
+#include "ast_union.h"
+#include "ast_structure_fwd.h"
+#include "ast_field.h"
+#include "ast_enum.h"
+#include "ast_enum_val.h"
+#include "ast_visitor.h"
+#include "utl_string.h"
+#include "utl_err.h"
+#include "utl_indenter.h"
+
+ACE_RCSID (ast,
+ ast_structure,
+ "$Id$")
+
+AST_Structure::AST_Structure (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType (),
+ UTL_Scope (),
+ member_count_ (-1),
+ local_struct_ (-1),
+ fwd_decl_ (0)
+{
+}
+
+AST_Structure::AST_Structure (UTL_ScopedName *n,
+ bool local,
+ bool abstract)
+ : COMMON_Base (local,
+ abstract),
+ AST_Decl (AST_Decl::NT_struct,
+ n),
+ AST_Type (AST_Decl::NT_struct,
+ n),
+ AST_ConcreteType (AST_Decl::NT_struct,
+ n),
+ UTL_Scope (AST_Decl::NT_struct),
+ member_count_ (-1),
+ local_struct_ (-1),
+ fwd_decl_ (0)
+{
+}
+
+AST_Structure::AST_Structure (AST_Decl::NodeType nt,
+ UTL_ScopedName *n,
+ bool local,
+ bool abstract)
+ : COMMON_Base (local,
+ abstract),
+ AST_Decl (nt,
+ n),
+ AST_Type (nt,
+ n),
+ AST_ConcreteType (nt,
+ n),
+ UTL_Scope (nt),
+ member_count_ (-1),
+ local_struct_ (-1),
+ fwd_decl_ (0)
+{
+}
+
+AST_Structure::~AST_Structure (void)
+{
+}
+
+// Are we or the parameter node involved in any recursion?
+bool
+AST_Structure::in_recursion (ACE_Unbounded_Queue<AST_Type *> &list)
+{
+ // We should calculate this only once. If it has already been
+ // done, just return it.
+ if (this->in_recursion_ != -1)
+ {
+ return this->in_recursion_;
+ }
+
+ // Proceed if the number of members in our scope is greater than 0.
+ if (this->nmembers () > 0)
+ {
+ ACE_Unbounded_Queue<AST_Type *> scope_list = list;
+ scope_list.enqueue_tail (this);
+
+ // Initialize an iterator to iterate over our scope.
+ // Continue until each element is visited.
+ for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ AST_Field *field = AST_Field::narrow_from_decl (si.item ());
+
+ if (field == 0)
+ // This will be an enum value or other legitimate non-field
+ // member - in any case, no recursion.
+ {
+ continue;
+ }
+
+ AST_Type *type = field->field_type ();
+
+ if (type->node_type () == AST_Decl::NT_typedef)
+ {
+ AST_Typedef *td = AST_Typedef::narrow_from_decl (type);
+ type = td->primitive_base_type ();
+ }
+
+ if (type == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%N:%l) AST_Structure::")
+ ACE_TEXT ("in_recursion - ")
+ ACE_TEXT ("bad field type\n")),
+ 0);
+ }
+
+ if (type->in_recursion (scope_list))
+ {
+ this->in_recursion_ = 1;
+ idl_global->recursive_type_seen_ = true;
+ return this->in_recursion_;
+ }
+ }
+ }
+
+ // Not in recursion.
+ this->in_recursion_ = 0;
+ return this->in_recursion_;
+}
+
+// Return the member count.
+int
+AST_Structure::member_count (void)
+{
+ if (this->member_count_ == -1)
+ {
+ this->compute_member_count ();
+ }
+
+ return this->member_count_;
+}
+
+size_t
+AST_Structure::nfields (void) const
+{
+ return this->fields_.size ();
+}
+
+int
+AST_Structure::field (AST_Field **&result,
+ size_t slot) const
+{
+ return this->fields_.get (result,
+ slot);
+}
+
+bool
+AST_Structure::is_local (void)
+{
+ if (this->local_struct_ == -1)
+ {
+ if (this->is_local_)
+ {
+ this->local_struct_ = this->is_local_;
+ }
+ else
+ {
+ this->local_struct_ = 0;
+
+ if (this->nmembers () > 0)
+ {
+ // Instantiate a scope iterator.
+ for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ if (si.item ()->is_local ())
+ {
+ this->local_struct_ = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return this->local_struct_;
+}
+
+int
+AST_Structure::contains_wstring (void)
+{
+ if (this->contains_wstring_ == -1)
+ {
+ for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ if (si.item ()->contains_wstring () == 1)
+ {
+ this->contains_wstring_ = 1;
+ return this->contains_wstring_;
+ }
+ }
+
+ this->contains_wstring_ = 0;
+ }
+
+ return this->contains_wstring_;
+}
+
+bool
+AST_Structure::is_defined (void)
+{
+ return 0 == this->fwd_decl_ || this->fwd_decl_->is_defined ();
+}
+
+bool
+AST_Structure::legal_for_primary_key (void) const
+{
+ bool retval = true;
+
+ if (!this->recursing_in_legal_pk_)
+ {
+ this->recursing_in_legal_pk_ = true;
+
+ for (UTL_ScopeActiveIterator si (const_cast<AST_Structure *> (this),
+ UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ AST_Field *f = AST_Field::narrow_from_decl (si.item ());
+
+ if (f != 0 && !f->field_type ()->legal_for_primary_key ())
+ {
+ retval = false;
+ break;
+ }
+ }
+
+ this->recursing_in_legal_pk_ = false;
+ }
+
+ return retval;
+}
+
+AST_StructureFwd *
+AST_Structure::fwd_decl (void) const
+{
+ return this->fwd_decl_;
+}
+
+void
+AST_Structure::fwd_decl (AST_StructureFwd *node)
+{
+ this->fwd_decl_ = node;
+}
+
+// Private operations.
+
+// Add this AST_Field node (a field declaration) to this scope.
+AST_Field *
+AST_Structure::fe_add_field (AST_Field *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, 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,
+ 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,
+ false,
+ mru->first_component ());
+ }
+
+ this->fields_.enqueue_tail (t);
+
+ return t;
+}
+
+// Add an AST_Structure node (a manifest struct type) to this scope.
+AST_Structure *
+AST_Structure::fe_add_structure (AST_Structure *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, 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 local types.
+ this->add_to_local_types (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add an AST_Union node (a manifest union type) to this scope.
+AST_Union *
+AST_Structure::fe_add_union (AST_Union *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, 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 local types.
+ this->add_to_local_types (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add this AST_Enum node (a manifest enum declaration) to this scope.
+AST_Enum *
+AST_Structure::fe_add_enum (AST_Enum *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, 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 local types.
+ this->add_to_local_types (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add this AST_EnumVal node (an enumerator declaration) 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_Structure::fe_add_enum_val (AST_EnumVal *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, 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,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Compute total number of members.
+int
+AST_Structure::compute_member_count (void)
+{
+ this->member_count_ = 0;
+
+ // If there are elements in this scope.
+ if (this->nmembers () > 0)
+ {
+ // Instantiate a scope iterator.
+ for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ ++this->member_count_;
+ }
+ }
+
+ return 0;
+}
+
+// Dump this AST_Structure node to the ostream o.
+void
+AST_Structure::dump (ACE_OSTREAM_TYPE &o)
+{
+ if (this->is_local ())
+ {
+ this->dump_i (o, "(local) ");
+ }
+
+ this->dump_i (o, "struct ");
+ AST_Decl::dump (o);
+ this->dump_i (o, " {\n");
+ UTL_Scope::dump (o);
+ idl_global->indent ()->skip_to (o);
+ this->dump_i (o, "}");
+}
+
+// This serves for structs and unions.
+void
+AST_Structure::fwd_redefinition_helper (AST_Structure *&i,
+ UTL_Scope *s)
+{
+ if (i == 0)
+ {
+ return;
+ }
+
+ // Fwd redefinition should be in the same scope, so local
+ // lookup is all that's needed.
+ AST_Decl *d = s->lookup_by_name_local (i->local_name (),
+ 0);
+
+ AST_Structure *fd = 0;
+
+ if (d != 0)
+ {
+ // Full definition must have the same prefix as the forward declaration.
+ if (ACE_OS::strcmp (i->prefix (), d->prefix ()) != 0)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_PREFIX_CONFLICT,
+ 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 (nt == AST_Decl::NT_struct_fwd
+ || nt == AST_Decl::NT_union_fwd)
+ {
+ AST_StructureFwd *fwd_def =
+ AST_StructureFwd::narrow_from_decl (d);
+
+ fd = fwd_def->full_definition ();
+ }
+ // In all other cases, the lookup will find an interface node.
+ else if (nt == AST_Decl::NT_struct
+ || nt == AST_Decl::NT_union)
+ {
+ fd = AST_Structure::narrow_from_decl (d);
+ }
+
+ // Successful?
+ if (fd == 0)
+ {
+ // Should we give an error here?
+ // No, look in fe_add_interface.
+ }
+ // If it is a forward declared interface..
+ else if (!fd->is_defined ())
+ {
+ // Check if redefining in same scope. If a module is reopened,
+ // 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
+ && i->name ()->compare (fd->name ()) != 0)
+ {
+ idl_global->err ()->error2 (UTL_Error::EIDL_SCOPE_CONFLICT,
+ i,
+ fd);
+ }
+ // 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_nt != fd_nt)
+ {
+ idl_global->err ()->error2 (UTL_Error::EIDL_REDEF,
+ i,
+ fd);
+ return;
+ }
+
+ fd->redefine (i);
+ AST_StructureFwd *fwd = fd->fwd_decl ();
+
+ if (0 != fwd)
+ {
+ // So the fwd decl won't destroy us at cleanup time.
+ // Unlike interfaces, valuetypes and components, it's
+ // ok to do this here, since fwd declared structs
+ // and unions must be defined in the same translation
+ // unit.
+ fwd->set_as_defined ();
+ }
+
+ // Use full definition node.
+ i->destroy ();
+ delete i;
+ i = fd;
+ }
+ }
+ }
+}
+
+// This serves only for structs. It is overridden for unions.
+void
+AST_Structure::redefine (AST_Structure *from)
+{
+ // We've already checked for inconsistent prefixes.
+ this->prefix (from->prefix ());
+
+ this->set_defined_in (from->defined_in ());
+ this->set_imported (idl_global->imported ());
+ this->set_in_main_file (idl_global->in_main_file ());
+ this->set_line (idl_global->lineno ());
+ this->set_file_name (idl_global->filename ()->get_string ());
+ this->ifr_added_ = from->ifr_added_;
+ this->ifr_fwd_added_ = from->ifr_fwd_added_;
+ this->fields_ = from->fields_;
+ this->member_count_ = from->member_count_;
+ this->local_struct_ = from->local_struct_;
+}
+
+// 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)
+{
+ return visitor->visit_structure (this);
+}
+
+void
+AST_Structure::destroy (void)
+{
+ this->AST_ConcreteType::destroy ();
+ this->UTL_Scope::destroy ();
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS2(AST_Structure, AST_ConcreteType, UTL_Scope)
+IMPL_NARROW_FROM_DECL(AST_Structure)
+IMPL_NARROW_FROM_SCOPE(AST_Structure)
+
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..f6b87046559
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_structure_fwd.cpp
@@ -0,0 +1,101 @@
+// $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)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ pd_full_definition (0),
+ is_defined_ (false)
+{
+}
+
+AST_StructureFwd::AST_StructureFwd (AST_Structure *full_defn,
+ UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_struct_fwd,
+ n),
+ AST_Type (AST_Decl::NT_struct_fwd,
+ n),
+ pd_full_definition (full_defn),
+ is_defined_ (false)
+{
+}
+
+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)
+{
+ this->dump_i (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)
+{
+ delete this->pd_full_definition;
+ this->pd_full_definition = 0;
+ this->pd_full_definition = nfd;
+}
+
+bool
+AST_StructureFwd::is_defined (void)
+{
+ return this->is_defined_;
+}
+
+void
+AST_StructureFwd::set_as_defined (void)
+{
+ this->is_defined_ = true;
+}
+
+void
+AST_StructureFwd::destroy (void)
+{
+ if (!this->is_defined_ && 0 != this->pd_full_definition)
+ {
+ this->pd_full_definition->destroy ();
+ delete this->pd_full_definition;
+ this->pd_full_definition = 0;
+ }
+
+ this->AST_Type::destroy ();
+}
+
+// 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
new file mode 100644
index 00000000000..58624791838
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_type.cpp
@@ -0,0 +1,565 @@
+// $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.
+
+*/
+
+// AST_Type is the base class for all AST classes which represent
+// IDL type constructs.
+
+#include "ast_type.h"
+#include "ast_typedef.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+#include "idl_defines.h"
+#include "nr_extern.h"
+#include "ace/Log_Msg.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_Memory.h"
+
+ACE_RCSID (ast,
+ ast_type,
+ "$Id$")
+
+AST_Type::AST_Type (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ ifr_added_ (0),
+ ifr_fwd_added_ (0),
+ size_type_ (AST_Type::SIZE_UNKNOWN),
+ has_constructor_ (0),
+ nested_type_name_ (0),
+ in_recursion_ (-1),
+ recursing_in_legal_pk_ (false)
+{
+}
+
+AST_Type::AST_Type (AST_Decl::NodeType nt,
+ UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (nt,
+ n),
+ ifr_added_ (0),
+ ifr_fwd_added_ (0),
+ size_type_ (AST_Type::SIZE_UNKNOWN),
+ has_constructor_ (0),
+ nested_type_name_ (0),
+ in_recursion_ (-1),
+ recursing_in_legal_pk_ (false)
+{
+}
+
+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;
+}
+
+bool
+AST_Type::in_recursion (ACE_Unbounded_Queue<AST_Type *> &)
+{
+ // By default we are not involved in recursion.
+ return 0;
+}
+
+bool
+AST_Type::is_defined (void)
+{
+ // AST_Interface, AST_Structure, and AST_Union will
+ // override this, as will AST_InterfaceFwd, etc.
+ return 1;
+}
+
+bool
+AST_Type::ifr_added (void)
+{
+ return this->ifr_added_;
+}
+
+void
+AST_Type::ifr_added (bool val)
+{
+ this->ifr_added_ = val;
+}
+
+bool
+AST_Type::ifr_fwd_added (void)
+{
+ return this->ifr_fwd_added_;
+}
+
+void
+AST_Type::ifr_fwd_added (bool val)
+{
+ this->ifr_fwd_added_ = val;
+}
+
+bool
+AST_Type::has_constructor (void)
+{
+ return this->has_constructor_;
+}
+
+void
+AST_Type::has_constructor (bool value)
+{
+ // Similarly to be_decl::size_type_, once this
+ // gets set to 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);
+}
+
+AST_Type *
+AST_Type::unaliased_type (void)
+{
+ AST_Type *t = this;
+ AST_Typedef *td = 0;
+ AST_Decl::NodeType nt = this->node_type ();
+
+ while (nt == AST_Decl::NT_typedef)
+ {
+ td = AST_Typedef::narrow_from_decl (t);
+ t = td->base_type ();
+ nt = t->node_type ();
+ }
+
+ return t;
+}
+
+bool
+AST_Type::legal_for_primary_key (void) const
+{
+ return true;
+}
+
+// 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 =
+ static_cast<int> (ACE_OS::strlen (def_curr)) -
+ static_cast<int> (ACE_OS::strlen (def_next));
+ }
+ else
+ {
+ len_to_match = static_cast<int> (ACE_OS::strlen (def_curr));
+ }
+
+ if (use_next != 0)
+ {
+ const int len =
+ static_cast<int> (ACE_OS::strlen (use_curr)) -
+ static_cast<int> (ACE_OS::strlen (use_next));
+
+ if (len > len_to_match)
+ {
+ len_to_match = len;
+ }
+ }
+ else
+ {
+ const int len = static_cast<int> (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)
+ {
+ // 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 =
+ static_cast<int> (ACE_OS::strlen (def_curr)) -
+ static_cast<int> (ACE_OS::strlen (def_next));
+ }
+ else
+ {
+ len_to_match = static_cast<int> (ACE_OS::strlen (def_curr));
+ }
+
+ if (use_next != 0)
+ {
+ int len =
+ static_cast<int> (ACE_OS::strlen (use_curr)) -
+ static_cast<int> (ACE_OS::strlen (use_next));
+
+ if (len > len_to_match)
+ {
+ len_to_match = len;
+ }
+ }
+ else
+ {
+ const int len = static_cast<int> (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);
+ }
+
+ 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_;
+}
+
+bool
+AST_Type::match_names (AST_Type *t, ACE_Unbounded_Queue<AST_Type *> &list)
+{
+ for (ACE_Unbounded_Queue_Iterator<AST_Type *> iter (list);
+ !iter.done ();
+ (void) iter.advance ())
+ {
+ // Queue element.
+ AST_Type **temp;
+
+ (void) iter.next (temp);
+
+ if (!ACE_OS::strcmp (t->full_name (),
+ (*temp)->full_name ()))
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+int
+AST_Type::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_type (this);
+}
+
+void
+AST_Type::destroy (void)
+{
+ delete [] this->nested_type_name_;
+ this->nested_type_name_ = 0;
+
+ 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
new file mode 100644
index 00000000000..515bebb07be
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_typedef.cpp
@@ -0,0 +1,219 @@
+// $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.
+
+*/
+
+// AST_Typedef nodes represent an IDL typedef statement.
+// AST_Typedef is a subclass of AST_Decl (it is not a type,
+// but instead is a type renaming).
+// AST_Typedef nodes have a base type (a subclass of AST_Type)
+// and a name (an UTL_ScopedName).
+
+#include "ast_typedef.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (ast,
+ ast_typedef,
+ "$Id$")
+
+AST_Typedef::AST_Typedef (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ pd_base_type (0),
+ owns_base_type_ (false)
+{
+}
+
+AST_Typedef::AST_Typedef (AST_Type *bt,
+ UTL_ScopedName *n,
+ bool local,
+ bool abstract)
+ : COMMON_Base (bt->is_local () || local,
+ abstract),
+ AST_Decl (AST_Decl::NT_typedef,
+ n),
+ AST_Type (AST_Decl::NT_typedef,
+ n),
+ pd_base_type (bt),
+ owns_base_type_ (false)
+{
+ AST_Decl::NodeType nt = bt->node_type ();
+
+ if (AST_Decl::NT_array == nt || AST_Decl::NT_sequence == nt)
+ {
+ this->owns_base_type_ = true;
+ }
+}
+
+AST_Typedef::~AST_Typedef (void)
+{
+}
+
+// Given a typedef node, traverse the chain of base types until they are no
+// more typedefs, and return that most primitive base type.
+AST_Type *
+AST_Typedef::primitive_base_type (void) const
+{
+ AST_Type *d = const_cast<AST_Typedef *> (this);
+ AST_Typedef *temp = 0;
+
+ while (d && d->node_type () == AST_Decl::NT_typedef)
+ {
+ temp = AST_Typedef::narrow_from_decl (d);
+ d = AST_Type::narrow_from_decl (temp->base_type ());
+ }
+
+ return d;
+}
+
+// Redefinition of inherited virtual operations.
+
+AST_Type *
+AST_Typedef::base_type (void) const
+{
+ return this->pd_base_type;
+}
+
+bool
+AST_Typedef::legal_for_primary_key (void) const
+{
+ return this->primitive_base_type ()->legal_for_primary_key ();
+}
+
+bool
+AST_Typedef::is_local (void)
+{
+ return this->pd_base_type->is_local ();
+}
+
+// Dump this AST_Typedef node to the ostream o.
+void
+AST_Typedef::dump (ACE_OSTREAM_TYPE&o)
+{
+ if (this->is_local ())
+ {
+ this->dump_i (o, "(local) ");
+ }
+ else
+ {
+ this->dump_i (o, "(abstract) ");
+ }
+
+ this->dump_i (o, "typedef ");
+ this->pd_base_type->dump (o);
+ this->dump_i (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)
+{
+ if (this->owns_base_type_)
+ {
+ this->pd_base_type->destroy ();
+ delete this->pd_base_type;
+ this->pd_base_type = 0;
+ }
+
+ this->AST_Type::destroy ();
+}
+
+// Data accessors.
+
+// Narrowing.
+IMPL_NARROW_METHODS1(AST_Typedef, AST_Type)
+IMPL_NARROW_FROM_DECL(AST_Typedef)
diff --git a/TAO/TAO_IDL/ast/ast_union.cpp b/TAO/TAO_IDL/ast/ast_union.cpp
new file mode 100644
index 00000000000..498fa278ac7
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_union.cpp
@@ -0,0 +1,1263 @@
+// $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.
+
+*/
+
+// AST_Union nodes represent IDL union declarations.
+// AST_Union is a subclass of AST_ConcreteType and of UTL_Scope (the
+// union branches are managed in a scope).
+// AST_Union nodes have a discriminator type (a subclass of AST_ConcreteType),
+// a name (an UTL_ScopedName) and a field denoting the discriminator type if
+// it is a primitive type (the value of this field is from the union
+// AST_Expression::ExprType and serves as a cache). This field is used
+// to compute coercions for labels based on the expected discriminator type.
+
+#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"
+
+// FUZZ: disable check_for_streams_include
+#include "ace/streams.h"
+
+ACE_RCSID (ast,
+ ast_union,
+ "$Id$")
+
+AST_Union::AST_Union (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType (),
+ UTL_Scope (),
+ AST_Structure (),
+ default_index_ (-2)
+{
+}
+
+AST_Union::AST_Union (AST_ConcreteType *dt,
+ UTL_ScopedName *n,
+ bool local,
+ bool abstract)
+ : COMMON_Base (local,
+ abstract),
+ AST_Decl (AST_Decl::NT_union,
+ n),
+ AST_Type (AST_Decl::NT_union,
+ n),
+ AST_ConcreteType (AST_Decl::NT_union,
+ n),
+ UTL_Scope (AST_Decl::NT_union),
+ AST_Structure (n,
+ local,
+ abstract),
+ default_index_ (-2)
+{
+ this->default_value_.computed_ = -2;
+
+ AST_PredefinedType *pdt = 0;
+
+ if (dt == 0)
+ {
+ this->pd_disc_type = 0;
+ this->pd_udisc_type = AST_Expression::EV_none;
+ return;
+ }
+
+ // If the discriminator type is a predefined type
+ // then install the equivalent coercion target type in
+ // the pd_udisc_type field.
+ if (dt->node_type () == AST_Decl::NT_pre_defined)
+ {
+ pdt = AST_PredefinedType::narrow_from_decl (dt);
+
+ if (pdt == 0)
+ {
+ this->pd_disc_type = 0;
+ this->pd_udisc_type = AST_Expression::EV_none;
+ return;
+ }
+
+ pd_disc_type = dt;
+
+ switch (pdt->pt ())
+ {
+ case AST_PredefinedType::PT_long:
+ this->pd_udisc_type = AST_Expression::EV_long;
+ break;
+ case AST_PredefinedType::PT_ulong:
+ this->pd_udisc_type = AST_Expression::EV_ulong;
+ break;
+ case AST_PredefinedType::PT_short:
+ this->pd_udisc_type = AST_Expression::EV_short;
+ break;
+ case AST_PredefinedType::PT_ushort:
+ this->pd_udisc_type = AST_Expression::EV_ushort;
+ break;
+ case AST_PredefinedType::PT_char:
+ this->pd_udisc_type = AST_Expression::EV_char;
+ break;
+ case AST_PredefinedType::PT_wchar:
+ this->pd_udisc_type = AST_Expression::EV_wchar;
+ break;
+ case AST_PredefinedType::PT_octet:
+ this->pd_udisc_type = AST_Expression::EV_octet;
+ break;
+ case AST_PredefinedType::PT_boolean:
+ this->pd_udisc_type = AST_Expression::EV_bool;
+ break;
+ default:
+ this->pd_udisc_type = AST_Expression::EV_none;
+ this->pd_disc_type = 0;
+ break;
+ }
+ }
+ else if (dt->node_type () == AST_Decl::NT_enum)
+ {
+ this->pd_udisc_type = AST_Expression::EV_enum;
+ this->pd_disc_type = dt;
+ }
+ else
+ {
+ this->pd_udisc_type = AST_Expression::EV_none;
+ this->pd_disc_type = 0;
+ }
+
+ if (this->pd_disc_type == 0)
+ {
+ idl_global->err ()->error2 (UTL_Error::EIDL_DISC_TYPE,
+ this,
+ dt);
+ }
+}
+
+AST_Union::~AST_Union (void)
+{
+}
+
+// Public operations.
+
+void
+AST_Union::redefine (AST_Structure *from)
+{
+ AST_Union *u = AST_Union::narrow_from_decl (from);
+
+ if (u == 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_Structure::redefine (from);
+
+ this->pd_disc_type = u->pd_disc_type;
+ this->pd_udisc_type = u->pd_udisc_type;
+ this->default_index_ = u->default_index_;
+ this->default_value_ = u->default_value_;
+}
+
+// Return the default_index.
+int
+AST_Union::default_index (void)
+{
+ if (this->default_index_ == -2)
+ {
+ this->compute_default_index ();
+ }
+
+ return this->default_index_;
+}
+
+// Are we or the parameter node involved in any recursion?
+bool
+AST_Union::in_recursion (ACE_Unbounded_Queue<AST_Type *> &list)
+{
+ // Proceed if the number of members in our scope is greater than 0.
+ if (this->nmembers () > 0)
+ {
+ ACE_Unbounded_Queue<AST_Type *> scope_list = list;
+ scope_list.enqueue_tail (this);
+
+ // Initialize an iterator to iterate thru our scope.
+ // Continue until each element is visited.
+ for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ AST_UnionBranch *field =
+ AST_UnionBranch::narrow_from_decl (si.item ());
+
+ if (field == 0)
+ // This will be an enum value or other legitimate non-field
+ // member - in any case, no recursion.
+ {
+ continue;
+ }
+
+ AST_Type *type = field->field_type ();
+
+ if (type->node_type () == AST_Decl::NT_typedef)
+ {
+ AST_Typedef *td = AST_Typedef::narrow_from_decl (type);
+ type = td->primitive_base_type ();
+ }
+
+ if (type == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%N:%l) AST_Union::")
+ ACE_TEXT ("in_recursion - ")
+ ACE_TEXT ("bad field type\n")),
+ 0);
+ }
+
+ if (type->in_recursion (scope_list))
+ {
+ this->in_recursion_ = 1;
+ idl_global->recursive_type_seen_ = true;
+ return this->in_recursion_;
+ }
+ }
+ }
+
+ // Not in recursion.
+ this->in_recursion_ = 0;
+ return this->in_recursion_;
+}
+
+// Look up the default branch in union.
+AST_UnionBranch *
+AST_Union::lookup_default (void)
+{
+ AST_UnionBranch *b = 0;
+ AST_Decl *d = 0;
+
+ for (UTL_ScopeActiveIterator i (this, UTL_Scope::IK_both);
+ !i.is_done();
+ i.next ())
+ {
+ d = i.item ();
+
+ if (d->node_type () == AST_Decl::NT_union_branch)
+ {
+ b = AST_UnionBranch::narrow_from_decl (d);
+
+ if (b == 0)
+ {
+ continue;
+ }
+
+ if (b->label () != 0
+ && b->label ()->label_kind () == AST_UnionLabel::UL_default)
+ {
+ idl_global->err ()->error2 (UTL_Error::EIDL_MULTIPLE_BRANCH,
+ this,
+ b);
+ return b;
+ }
+ }
+ }
+
+ return 0;
+}
+
+// Look up a branch by label.
+AST_UnionBranch *
+AST_Union::lookup_label (AST_UnionBranch *b)
+{
+ AST_UnionLabel *label = b->label ();
+ AST_Expression *lv = label->label_val ();
+
+ if (label->label_val () == 0)
+ {
+ return b;
+ }
+
+ AST_Decl *d = 0;
+ AST_UnionBranch *fb = 0;
+
+ lv->set_ev (lv->coerce (this->pd_udisc_type));
+
+ if (lv->ev () == 0)
+ {
+ idl_global->err ()->eval_error (lv);
+ return b;
+ }
+
+ for (UTL_ScopeActiveIterator i (this, UTL_Scope::IK_decls);
+ !i.is_done();
+ i.next ())
+ {
+ d = i.item ();
+
+ if (d->node_type () == AST_Decl::NT_union_branch)
+ {
+ fb = AST_UnionBranch::narrow_from_decl (d);
+
+ if (fb == 0)
+ {
+ continue;
+ }
+
+ if (fb->label() != 0
+ && fb->label ()->label_kind () == AST_UnionLabel::UL_label
+ && fb->label ()->label_val ()->compare (lv))
+ {
+ idl_global->err ()->error2 (UTL_Error::EIDL_MULTIPLE_BRANCH,
+ this,
+ b);
+ return b;
+ }
+ }
+ }
+
+ return 0;
+}
+
+// Look up a branch in an enum which is the discriminator type for this
+// union, based on the label value which must be an enumerator in that
+// enum.
+AST_UnionBranch *
+AST_Union::lookup_enum (AST_UnionBranch *b)
+{
+ AST_UnionLabel *label = b->label();
+ AST_Expression *lv = label->label_val ();
+ AST_Enum *e = AST_Enum::narrow_from_decl (this->pd_disc_type);
+ AST_Decl *d = 0;
+ AST_UnionBranch *fb = 0;
+
+ if (e == 0)
+ {
+ return 0;
+ }
+
+ if (lv == 0)
+ {
+ return b;
+ }
+
+ // Expecting a symbol label.
+ if (lv->ec () != AST_Expression::EC_symbol)
+ {
+ idl_global->err ()->enum_val_expected (this,
+ label);
+ return b;
+ }
+
+ // See if the symbol defines a constant in the discriminator enum.
+ UTL_ScopedName *sn = lv->n ();
+ d = e->lookup_by_name (sn,
+ true);
+
+ if (d == 0 || d->defined_in () != e)
+ {
+ idl_global->err ()->enum_val_lookup_failure (this,
+ e,
+ sn);
+ return b;
+ }
+
+ // OK, now see if this symbol is already used as the label of
+ // some other branch.
+ for (UTL_ScopeActiveIterator i (this, UTL_Scope::IK_decls);
+ !i.is_done();
+ i.next ())
+ {
+ d = i.item ();
+
+ if (d->node_type () == AST_Decl::NT_union_branch)
+ {
+ fb = AST_UnionBranch::narrow_from_decl (d);
+
+ if (fb == 0)
+ {
+ continue;
+ }
+
+ if (fb->label() != 0
+ && fb->label ()->label_kind () == AST_UnionLabel::UL_label
+ && fb->label ()->label_val ()->compare (lv))
+ {
+ idl_global->err ()->error2 (UTL_Error::EIDL_MULTIPLE_BRANCH,
+ this,
+ b);
+ return b;
+ }
+ }
+ }
+
+ return 0;
+}
+
+// Look up a branch by value. This is the top level branch label resolution
+// entry point. It dispatches to the right lookup function depending on the
+// union discriminator type.
+AST_UnionBranch *
+AST_Union::lookup_branch (AST_UnionBranch *branch)
+{
+ AST_UnionLabel *label = 0;
+
+ if (branch != 0)
+ {
+ label = branch->label ();
+ }
+
+ if (label != 0)
+ {
+ if (label->label_kind () == AST_UnionLabel::UL_default)
+ {
+ return this->lookup_default ();
+ }
+
+ if (this->pd_udisc_type == AST_Expression::EV_enum)
+ {
+ // CONVENTION: indicates enum discriminant.
+ return this->lookup_enum (branch);
+ }
+
+ return this->lookup_label (branch);
+ }
+
+ return 0;
+}
+
+// Return the default value.
+int
+AST_Union::default_value (AST_Union::DefaultValue &dv)
+{
+ if (this->default_value_.computed_ == -2)
+ {
+ // We need to compute it.
+ if (this->compute_default_value () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%N:%l) AST_Union::")
+ ACE_TEXT ("default_value - ")
+ ACE_TEXT ("Error computing ")
+ ACE_TEXT ("default value\n")),
+ -1);
+ }
+ }
+
+ dv = this->default_value_;
+ return 0;
+}
+
+// Determine the default value (if any).
+int
+AST_Union::compute_default_value (void)
+{
+ // Check if we really need a default value. This will be true if there is an
+ // explicit default case OR if an implicit default exists because not all
+ // values of the discriminant type are covered by the cases.
+
+ // Compute the total true "case" labels i.e., exclude the "default" case.
+ int total_case_members = 0;
+
+ // Instantiate a scope iterator.
+ for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ // Get the next AST decl node.
+ AST_UnionBranch *ub =
+ AST_UnionBranch::narrow_from_decl (si.item ());
+
+ if (ub != 0)
+ {
+ // If the label is a case label, increment by 1.
+ for (unsigned long i = 0; i < ub->label_list_length (); ++i)
+ {
+ if (ub->label (i)->label_kind () == AST_UnionLabel::UL_label)
+ {
+ ++total_case_members;
+ }
+ }
+ }
+ }
+
+ // Check if the total_case_members cover the entire
+ // range of values that are permitted by the discriminant type. If they do,
+ // then a default value is not necessary. However, if such an explicit
+ // default case is provided, it must be flagged off as an error. Our
+ // front-end is not able to handle such a case since it is a semantic error
+ // and not a syntax error. Such an error is caught here.
+
+ switch (this->udisc_type ())
+ {
+ case AST_Expression::EV_short:
+ case AST_Expression::EV_ushort:
+ if (total_case_members == ACE_UINT16_MAX + 1)
+ {
+ this->default_value_.computed_ = 0;
+ }
+
+ break;
+ case AST_Expression::EV_long:
+ case AST_Expression::EV_ulong:
+ if ((unsigned int) total_case_members > ACE_UINT32_MAX)
+ {
+ this->default_value_.computed_ = 0;
+ }
+
+ break;
+ case AST_Expression::EV_longlong:
+ case AST_Expression::EV_ulonglong:
+ // Error for now.
+ this->default_value_.computed_ = -1;
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ ACE_TEXT ("(%N:%l) AST_Union::compute_default_value ")
+ ACE_TEXT ("- unimplemented discriminant type ")
+ ACE_TEXT ("(longlong or ulonglong)\n")
+ ),
+ -1
+ );
+ ACE_NOTREACHED (break;)
+ case AST_Expression::EV_char:
+ if (total_case_members == ACE_OCTET_MAX + 1)
+ {
+ this->default_value_.computed_ = 0;
+ }
+
+ break;
+ case AST_Expression::EV_wchar:
+ if (total_case_members == ACE_WCHAR_MAX + 1)
+ {
+ this->default_value_.computed_ = 0;
+ }
+
+ break;
+ case AST_Expression::EV_bool:
+ if (total_case_members == 2)
+ {
+ this->default_value_.computed_ = 0;
+ }
+
+ break;
+ case AST_Expression::EV_enum:
+ // Has to be enum.
+ {
+ AST_Decl *d = AST_Decl::narrow_from_decl (this->disc_type ());
+
+ if (d->node_type () == AST_Decl::NT_typedef)
+ {
+ AST_Typedef *bt = AST_Typedef::narrow_from_decl (d);
+ d = bt->primitive_base_type ();
+ }
+
+ AST_Enum *en = AST_Enum::narrow_from_decl (d);
+
+ if (en != 0)
+ {
+ if (total_case_members == en->member_count ())
+ {
+ this->default_value_.computed_ = 0;
+ }
+ }
+ else
+ {
+ // Error.
+ this->default_value_.computed_ = -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%N:%l) AST_Union::")
+ ACE_TEXT ("compute_default_value ")
+ ACE_TEXT ("- disc type not an ENUM\n")),
+ -1);
+ }
+ }
+ break;
+ default:
+ // Error.
+ this->default_value_.computed_ = -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%N:%l) AST_Union::compute_default_value")
+ ACE_TEXT (" - Bad discriminant type\n")),
+ -1);
+ ACE_NOTREACHED (break;)
+ } // End of switch
+
+ // If we have determined that we don't have a default case and even then a
+ // default case was provided, flag this off as error.
+ if ((this->default_value_.computed_ == 0)
+ && (this->default_index () != -1))
+ {
+ // Error.
+ this->default_value_.computed_ = -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%N:%l) AST_Union::compute_default_value")
+ ACE_TEXT (" - default clause is invalid here\n")),
+ -1);
+ }
+
+ // Proceed only if necessary.
+ switch (this->default_value_.computed_)
+ {
+ case -1:
+ // Error. We should never be here because errors
+ // have already been caught
+ // above.
+ return -1;
+ case 0:
+ // Nothing more to do.
+ return 0;
+ default:
+ // Proceed further down.
+ break;
+ }
+
+ // Initialization of the default value data member.
+ switch (this->udisc_type ())
+ {
+ case AST_Expression::EV_short:
+ this->default_value_.u.short_val = ACE_INT16_MIN;
+ break;
+ case AST_Expression::EV_ushort:
+ this->default_value_.u.ushort_val = 0;
+ break;
+ case AST_Expression::EV_long:
+ // The +1 is to avert a warning on many compilers.
+ this->default_value_.u.long_val = ACE_INT32_MIN + 1;
+ break;
+ case AST_Expression::EV_ulong:
+ this->default_value_.u.ulong_val = 0;
+ break;
+ case AST_Expression::EV_char:
+ this->default_value_.u.char_val = 0;
+ break;
+ case AST_Expression::EV_wchar:
+ this->default_value_.u.wchar_val = 0;
+ break;
+ case AST_Expression::EV_bool:
+ this->default_value_.u.bool_val = 0;
+ break;
+ case AST_Expression::EV_enum:
+ this->default_value_.u.enum_val = 0;
+ break;
+ case AST_Expression::EV_longlong:
+ case AST_Expression::EV_ulonglong:
+ // Unimplemented.
+ default:
+ // Error caught earlier.
+ break;
+ }
+
+ // Proceed until we have found the appropriate default value.
+ while (this->default_value_.computed_ == -2)
+ {
+ int break_loop = 0;
+
+ // Instantiate a scope iterator.
+ for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
+ !si.is_done () && break_loop == 0;
+ si.next ())
+ {
+ // Get the next AST decl node
+ AST_UnionBranch *ub =
+ AST_UnionBranch::narrow_from_decl (si.item ());
+
+ if (ub != 0)
+ {
+ for (unsigned long i = 0;
+ i < ub->label_list_length () && !break_loop;
+ ++i)
+ {
+ if (ub->label (i)->label_kind () == AST_UnionLabel::UL_label)
+ {
+ // Not a default.
+ AST_Expression *expr = ub->label (i)->label_val ();
+
+ if (expr == 0)
+ {
+ // Error.
+ this->default_value_.computed_ = -1;
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ ACE_TEXT ("(%N:%l) AST_Union::")
+ ACE_TEXT ("compute_default_value - ")
+ ACE_TEXT ("Bad case label value\n")
+ ),
+ -1
+ );
+ }
+
+ switch (expr->ev ()->et)
+ {
+ // Check if they match in which case this
+ // cannot be the implicit default value. So
+ // start with a new value and try the whole loop
+ // again because our case labels may not be sorted.
+ case AST_Expression::EV_short:
+ if (this->default_value_.u.short_val
+ == expr->ev ()->u.sval)
+ {
+ this->default_value_.u.short_val++;
+ break_loop = 1;
+ }
+
+ break;
+ case AST_Expression::EV_ushort:
+ if (this->default_value_.u.ushort_val
+ == expr->ev ()->u.usval)
+ {
+ this->default_value_.u.ushort_val++;
+ break_loop = 1;
+ }
+
+ break;
+ case AST_Expression::EV_long:
+ if (this->default_value_.u.long_val
+ == expr->ev ()->u.lval)
+ {
+ this->default_value_.u.long_val++;
+ break_loop = 1;
+ }
+
+ break;
+ case AST_Expression::EV_ulong:
+ if (this->default_value_.u.ulong_val
+ == expr->ev ()->u.ulval)
+ {
+ this->default_value_.u.ulong_val++;
+ break_loop = 1;
+ }
+
+ break;
+ case AST_Expression::EV_char:
+ if (this->default_value_.u.char_val
+ == expr->ev ()->u.cval)
+ {
+ this->default_value_.u.char_val++;
+ break_loop = 1;
+ }
+
+ break;
+ case AST_Expression::EV_wchar:
+ if (this->default_value_.u.wchar_val
+ == expr->ev ()->u.wcval)
+ {
+ this->default_value_.u.wchar_val++;
+ break_loop = 1;
+ }
+
+ break;
+ case AST_Expression::EV_bool:
+ if (this->default_value_.u.bool_val
+ == expr->ev ()->u.bval)
+ {
+ this->default_value_.u.bool_val ^= true;
+ break_loop = 1;
+ }
+
+ break;
+ 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
+ == expr->ev ()->u.eval)
+ {
+ this->default_value_.u.enum_val++;
+ break_loop = 1;
+ }
+
+ break;
+ case AST_Expression::EV_longlong:
+ case AST_Expression::EV_ulonglong:
+ // Unimplemented. right now - flag as error.
+ default:
+ // Error.
+ break;
+ } // End of switch.
+ } // if label_Kind == label
+ } // End of for loop going thru all labels.
+ } // If valid union branch.
+ } // End of while scope iterator loop.
+
+ // We have not aborted the inner loops which means we have found the
+ // default value.
+ if (break_loop == 0)
+ {
+ this->default_value_.computed_ = 1;
+ }
+
+ } // End of outer while (default_value.computed == -2).
+
+ return 0;
+}
+
+// Private operations.
+
+// Compute the default index.
+int
+AST_Union::compute_default_index (void)
+{
+ AST_Decl *d = 0;
+ AST_UnionBranch *ub = 0;
+ int i = 0;
+
+ // If default case does not exist, it will have a value of -1 according to
+ // the spec.
+ this->default_index_ = -1;
+
+ // If there are elements in this scope...
+ if (this->nmembers () > 0)
+ {
+ // Instantiate a scope iterator.
+ for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ // 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);
+
+ for (unsigned long j = 0; j < ub->label_list_length (); ++j)
+ {
+ // Check if we are printing the default case.
+ AST_UnionLabel::UnionLabel ulk = ub->label ()->label_kind ();
+ if (ulk == AST_UnionLabel::UL_default)
+ {
+ // Zero based indexing.
+ this->default_index_ = i;
+ }
+ }
+
+ // TAO's Typecode class keeps only a member count (not
+ // a label count) so this increment has been moved
+ // out of the inner loop.
+ ++i;
+ }
+ }
+ }
+
+ return 0;
+}
+
+// Redefinition of inherited virtual operations
+
+// Add this AST_UnionBranch node (a node representing one branch in a
+// union declaration) to this scope
+AST_UnionBranch *
+AST_Union::fe_add_union_branch (AST_UnionBranch *t)
+{
+ AST_Decl *d = 0;
+
+ // If this is a malformed branch, don't do anything with it.
+ if (t == 0 || t->label() == 0)
+ {
+ return 0;
+ }
+
+ // If branch with that label already exists, complain.
+ if (lookup_branch (t) != 0)
+ {
+ idl_global->err ()->error2 (UTL_Error::EIDL_MULTIPLE_BRANCH,
+ this,
+ t);
+ return 0;
+ }
+
+ // If branch with same field name exists, complain.
+ if ((d = this->lookup_for_add (t, 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);
+
+ // If we have an enum discriminator, add the label names to
+ // the name_referenced list before we add the union branch,
+ // so a branch name clash with a label name will be caught.
+ if (this->pd_udisc_type == AST_Expression::EV_enum)
+ {
+ t->add_labels (this);
+ }
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ 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,
+ false,
+ mru->first_component ());
+ }
+
+ this->fields_.enqueue_tail (t);
+
+ return t;
+}
+
+// Add this AST_Union (manifest union type) to this scope.
+AST_Union *
+AST_Union::fe_add_union (AST_Union *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, 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 local types.
+ this->add_to_local_types (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add this AST_Structure node (manifest struct type) to this scope.
+AST_Structure *
+AST_Union::fe_add_structure (AST_Structure *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, 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 local types.
+ this->add_to_local_types (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add this AST_Enum node (manifest enum type) to this scope.
+AST_Enum *
+AST_Union::fe_add_enum (AST_Enum *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, 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 local types.
+ this->add_to_local_types (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add this AST_EnumVal node (enumerator declaration) 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_Union::fe_add_enum_val (AST_EnumVal *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, 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,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Dump this AST_Union node to the ostream o.
+void
+AST_Union::dump (ACE_OSTREAM_TYPE &o)
+{
+ o << "union ";
+ this->local_name ()->dump (o);
+ o << " switch (";
+ this->pd_disc_type->local_name ()->dump (o);
+ o << ") {\n";
+ UTL_Scope::dump (o);
+ idl_global->indent ()->skip_to (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)
+{
+ return visitor->visit_union (this);
+}
+
+// Data accessors.
+
+AST_ConcreteType *
+AST_Union::disc_type (void)
+{
+ return this->pd_disc_type;
+}
+
+AST_Expression::ExprType
+AST_Union::udisc_type (void)
+{
+ return this->pd_udisc_type;
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS1(AST_Union, AST_Structure)
+IMPL_NARROW_FROM_DECL(AST_Union)
+IMPL_NARROW_FROM_SCOPE(AST_Union)
diff --git a/TAO/TAO_IDL/ast/ast_union_branch.cpp b/TAO/TAO_IDL/ast/ast_union_branch.cpp
new file mode 100644
index 00000000000..8fff20afb86
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_union_branch.cpp
@@ -0,0 +1,199 @@
+// $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.
+
+*/
+
+// AST_UnionBranch nodes represent a single branch of an IDL union
+// declaration.
+// AST_UnionBranch is a subclass of AST_Field, adding a label (which
+// is a subclass of AST_UnionLabel).
+
+#include "ast_union_branch.h"
+#include "ast_union_label.h"
+#include "ast_union.h"
+#include "ast_visitor.h"
+#include "utl_labellist.h"
+
+ACE_RCSID(ast, ast_union_branch, "$Id$")
+
+AST_UnionBranch::AST_UnionBranch (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Field (),
+ pd_ll (0)
+{
+}
+
+AST_UnionBranch::AST_UnionBranch (UTL_LabelList *ll,
+ AST_Type *ft,
+ UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_union_branch,
+ n),
+ AST_Field (AST_Decl::NT_union_branch,
+ ft,
+ n),
+ pd_ll (ll)
+{
+}
+
+AST_UnionBranch::~AST_UnionBranch (void)
+{
+}
+
+// Redefinition of inherited virtual operations.
+
+// Dump this AST_UnionBranch node to the ostream o.
+void
+AST_UnionBranch::dump (ACE_OSTREAM_TYPE &o)
+{
+ for (unsigned long i = 0; i < this->label_list_length (); ++i)
+ {
+ this->dump_i (o, "case ");
+
+ AST_UnionLabel *ul = this->label (i);
+ ul->dump (o);
+
+ this->dump_i (o, ": \n");
+ }
+
+ AST_Field::dump (o);
+}
+
+int
+AST_UnionBranch::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_union_branch (this);
+}
+
+void
+AST_UnionBranch::destroy (void)
+{
+ this->pd_ll->destroy ();
+ delete this->pd_ll;
+ this->pd_ll = 0;
+
+ this->AST_Field::destroy ();
+}
+
+// Data accessors.
+
+AST_UnionLabel *
+AST_UnionBranch::label (unsigned long index)
+{
+ unsigned long i = 0;
+
+ for (UTL_LabellistActiveIterator iter (this->pd_ll);
+ !iter.is_done ();
+ iter.next ())
+ {
+ if (i == index)
+ {
+ return iter.item ();
+ }
+
+ ++i;
+ }
+
+ return 0;
+}
+
+unsigned long
+AST_UnionBranch::label_list_length (void)
+{
+ if (this->pd_ll)
+ {
+ return this->pd_ll->length ();
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+void
+AST_UnionBranch::add_labels (AST_Union *u)
+{
+ AST_UnionLabel *ul = 0;
+ AST_Expression *ex = 0;
+
+ for (UTL_LabellistActiveIterator i (this->pd_ll);
+ !i.is_done ();
+ i.next ())
+ {
+ ul = i.item ();
+
+ if (ul->label_kind () == AST_UnionLabel::UL_default)
+ {
+ return;
+ }
+
+ ex = ul->label_val ();
+ u->add_to_name_referenced (ex->n ()->first_component ());
+ }
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS1(AST_UnionBranch, AST_Field)
+IMPL_NARROW_FROM_DECL(AST_UnionBranch)
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..b1549dc0c16
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_union_fwd.cpp
@@ -0,0 +1,65 @@
+// $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)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_StructureFwd ()
+{
+}
+
+AST_UnionFwd::AST_UnionFwd (AST_Union *dummy,
+ UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_union_fwd,
+ n),
+ AST_Type (AST_Decl::NT_union_fwd,
+ n),
+ AST_StructureFwd (dummy,
+ n)
+{
+}
+
+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)
+{
+ this->dump_i (o, "union ");
+ this->local_name ()->dump (o);
+}
+
+int
+AST_UnionFwd::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_union_fwd (this);
+}
+
+void
+AST_UnionFwd::destroy (void)
+{
+ this->AST_StructureFwd::destroy ();
+}
+
+// Narrowing methods.
+IMPL_NARROW_METHODS1 (AST_UnionFwd, AST_StructureFwd)
+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
new file mode 100644
index 00000000000..37a2e337020
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_union_label.cpp
@@ -0,0 +1,150 @@
+// $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.
+
+*/
+// AST_UnionLabel denotes the label of a branch in an IDL union
+// declaration.
+// AST_UnionLabel nodes have a label kind (the values come from the
+// enum AST_UnionLabel::LabelKind) and a label value (which is a
+// subclass of AST_Expression).
+
+#include "ast_union_label.h"
+#include "ast_expression.h"
+#include "ast_visitor.h"
+
+// FUZZ: disable check_for_streams_include
+#include "ace/streams.h"
+
+ACE_RCSID (ast,
+ ast_union_label,
+ "$Id$")
+
+AST_UnionLabel::AST_UnionLabel (void)
+ : pd_label_kind (UL_default),
+ pd_label_val (0)
+{
+}
+
+AST_UnionLabel::AST_UnionLabel (UnionLabel lk,
+ AST_Expression *lv)
+ : pd_label_kind (lk),
+ pd_label_val (lv)
+{
+ if (lv != 0)
+ {
+ lv->evaluate (AST_Expression::EK_const);
+ }
+}
+
+AST_UnionLabel::~AST_UnionLabel (void)
+{
+}
+
+// Redefinition of inherited virtual operations.
+
+// Dump this AST_UnionLabel node to the ostream o.
+void
+AST_UnionLabel::dump (ACE_OSTREAM_TYPE &o)
+{
+ if (this->pd_label_kind == UL_default)
+ {
+ o << "default";
+ }
+ else
+ {
+ this->pd_label_val->dump (o);
+ }
+}
+
+int
+AST_UnionLabel::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_union_label (this);
+}
+
+void
+AST_UnionLabel::destroy (void)
+{
+ // Otherwise (default label) our label value is 0.
+ if (UL_label == this->pd_label_kind)
+ {
+ this->pd_label_val->destroy ();
+ delete this->pd_label_val;
+ this->pd_label_val = 0;
+ }
+}
+
+// Data accessors.
+
+AST_UnionLabel::UnionLabel
+AST_UnionLabel::label_kind (void)
+{
+ return this->pd_label_kind;
+}
+
+AST_Expression *
+AST_UnionLabel::label_val (void)
+{
+ return this->pd_label_val;
+}
diff --git a/TAO/TAO_IDL/ast/ast_valuebox.cpp b/TAO/TAO_IDL/ast/ast_valuebox.cpp
new file mode 100644
index 00000000000..0b687de22dc
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_valuebox.cpp
@@ -0,0 +1,68 @@
+// $Id$
+
+#include "ast_valuebox.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+
+ACE_RCSID (ast,
+ ast_valuebox,
+ "ast_valuebox.cpp,v 1.0 Exp")
+
+AST_ValueBox::AST_ValueBox (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType ()
+{
+}
+
+AST_ValueBox::AST_ValueBox (UTL_ScopedName *n,
+ AST_Type *boxed_type)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_valuebox,
+ n, true),
+ AST_Type (AST_Decl::NT_valuebox,
+ n),
+ AST_ConcreteType (AST_Decl::NT_valuebox, n),
+ pd_boxed_type (boxed_type)
+{
+}
+
+AST_ValueBox::~AST_ValueBox (void)
+{
+}
+
+AST_Type *
+AST_ValueBox::boxed_type (void) const
+{
+ return this->pd_boxed_type;
+}
+
+void
+AST_ValueBox::dump (ACE_OSTREAM_TYPE &o)
+{
+
+ this->dump_i (o, "valuetype ");
+
+ this->local_name ()->dump (o);
+ this->dump_i (o, " ");
+ this->pd_boxed_type->dump (o);
+}
+
+int
+AST_ValueBox::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_valuebox (this);
+}
+
+void
+AST_ValueBox::destroy (void)
+{
+ this->AST_ConcreteType::destroy ();
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS1(AST_ValueBox, AST_ConcreteType)
+IMPL_NARROW_FROM_DECL(AST_ValueBox)
+
+
diff --git a/TAO/TAO_IDL/ast/ast_valuetype.cpp b/TAO/TAO_IDL/ast/ast_valuetype.cpp
new file mode 100644
index 00000000000..459525d98b3
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_valuetype.cpp
@@ -0,0 +1,473 @@
+// 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 "ast_field.h"
+#include "utl_err.h"
+#include "utl_identifier.h"
+#include "utl_indenter.h"
+#include "utl_string.h"
+#include "global_extern.h"
+#include "nr_extern.h"
+
+#include "ace/streams.h"
+
+ACE_RCSID (ast,
+ ast_valuetype,
+ "$Id$")
+
+AST_ValueType::AST_ValueType (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ UTL_Scope (),
+ AST_Interface (),
+ pd_supports (0),
+ pd_n_supports (0),
+ pd_inherits_concrete (0),
+ pd_supports_concrete (0),
+ pd_truncatable (false),
+ pd_custom (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,
+ bool abstract,
+ bool truncatable,
+ bool custom)
+ : COMMON_Base (false,
+ abstract),
+ AST_Decl (AST_Decl::NT_valuetype,
+ n),
+ AST_Type (AST_Decl::NT_valuetype,
+ n),
+ UTL_Scope (AST_Decl::NT_valuetype),
+ AST_Interface (n,
+ inherits,
+ n_inherits,
+ inherits_flat,
+ n_inherits_flat,
+ false,
+ abstract),
+ pd_supports (supports),
+ pd_n_supports (n_supports),
+ pd_inherits_concrete (inherits_concrete),
+ pd_supports_concrete (supports_concrete),
+ pd_truncatable (truncatable),
+ pd_custom (custom)
+{
+}
+
+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;
+}
+
+bool
+AST_ValueType::truncatable (void) const
+{
+ return this->pd_truncatable;
+}
+
+bool
+AST_ValueType::custom (void) const
+{
+ return this->pd_custom;
+}
+
+bool
+AST_ValueType::will_have_factory (void)
+{
+ return false;
+}
+
+// Look through supported interface list.
+AST_Decl *
+AST_ValueType::look_in_supported (UTL_ScopedName *e,
+ bool treat_as_ref)
+{
+ AST_Decl *d = 0;
+ AST_Decl *d_before = 0;
+ AST_Interface **is = 0;
+ long nis = -1;
+
+ // Can't look in an interface which was not yet defined.
+ if (!this->is_defined ())
+ {
+// idl_global->err ()->fwd_decl_lookup (this,
+// e);
+ return 0;
+ }
+
+ // OK, loop through supported interfaces.
+
+ // (Don't leave the inheritance hierarchy, no module or global ...)
+ // Find all and report ambiguous results as error.
+
+ for (nis = this->n_supports (), is = this->supports ();
+ nis > 0;
+ nis--, is++)
+ {
+ d = (*is)->lookup_by_name (e,
+ treat_as_ref,
+ 0 /* not in parent */);
+ if (d != 0)
+ {
+ if (d_before == 0)
+ {
+ // First result found.
+ d_before = d;
+ }
+ else
+ {
+ // Conflict against further results?
+ if (d != d_before)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "warning in %s line %d: ",
+ idl_global->filename ()->get_string (),
+ idl_global->lineno ()));
+
+ e->dump (*ACE_DEFAULT_LOG_STREAM);
+
+ ACE_ERROR ((LM_ERROR,
+ " is ambiguous in scope.\n"
+ "Found "));
+
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+
+ ACE_ERROR ((LM_ERROR,
+ " and "));
+
+ d_before->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+
+ ACE_ERROR ((LM_ERROR,
+ ".\n"));
+ }
+ }
+ }
+ }
+
+ return d_before;
+}
+
+bool
+AST_ValueType::legal_for_primary_key (void) const
+{
+ AST_ValueType *pk_base = this->lookup_primary_key_base ();
+
+ if (!this->derived_from_primary_key_base (this, pk_base))
+ {
+ return false;
+ }
+
+ bool has_public_member = false;
+ bool retval = true;
+
+ if (!this->recursing_in_legal_pk_)
+ {
+ this->recursing_in_legal_pk_ = true;
+
+ for (UTL_ScopeActiveIterator i (const_cast<AST_ValueType *> (this),
+ UTL_Scope::IK_decls);
+ !i.is_done ();
+ i.next ())
+ {
+ AST_Field *f = AST_Field::narrow_from_decl (i.item ());
+
+ // We're not interested in any valuetype decls that aren't fields.
+ if (f == 0)
+ {
+ continue;
+ }
+
+ // Private members are not allowed in primary keys.
+ if (f->visibility () == AST_Field::vis_PRIVATE)
+ {
+ retval = false;
+ break;
+ }
+ else
+ {
+ // Returns false for interfaces, components, homes.
+ // Called recursively on valuetypes and on members of
+ // structs, unions, sequences, typedefs and arrays. Returns
+ // TRUE otherwise.
+ if (!f->field_type ()->legal_for_primary_key ())
+ {
+ retval = false;
+ break;
+ }
+
+ has_public_member = true;
+ }
+ }
+
+ this->recursing_in_legal_pk_ = false;
+ }
+
+ // Must have at least one public member, unless we are
+ // short-circuiting the test because we are in recursion.
+ return retval && (has_public_member || this->recursing_in_legal_pk_);
+}
+
+void
+AST_ValueType::destroy (void)
+{
+ delete [] this->pd_supports;
+ this->pd_supports = 0;
+ this->pd_n_supports = 0;
+
+ this->AST_Interface::destroy ();
+}
+
+void
+AST_ValueType::dump (ACE_OSTREAM_TYPE &o)
+{
+ if (this->is_abstract ())
+ {
+ this->dump_i (o, "abstract ");
+ }
+ else if (this->pd_truncatable)
+ {
+ this->dump_i (o, "truncatable ");
+ }
+
+ this->dump_i (o, "valuetype ");
+
+ this->local_name ()->dump (o);
+ this->dump_i (o, " ");
+
+ if (this->pd_n_inherits > 0)
+ {
+ this->dump_i (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)
+ {
+ this->dump_i (o, ", ");
+ }
+ }
+ }
+
+ this->dump_i (o, "\n\n");
+
+ if (this->pd_n_supports > 0)
+ {
+ this->dump_i (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)
+ {
+ this->dump_i (o, ", ");
+ }
+ }
+ }
+
+ this->dump_i (o, " {\n");
+
+ UTL_Scope::dump (o);
+ idl_global->indent ()->skip_to (o);
+
+ this->dump_i (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, 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,
+ false,
+ f->local_name ());
+
+ return f;
+}
+
+bool
+AST_ValueType::derived_from_primary_key_base (const AST_ValueType *node,
+ const AST_ValueType *pk_base) const
+{
+ if (0 == node)
+ {
+ return false;
+ }
+
+ if (node == pk_base)
+ {
+ return true;
+ }
+
+ AST_ValueType *concrete_parent = node->inherits_concrete ();
+
+ if (this->derived_from_primary_key_base (concrete_parent, pk_base))
+ {
+ return true;
+ }
+
+ AST_Interface **v = node->pd_inherits;
+
+ for (long i = 0; i < node->pd_n_inherits; ++i)
+ {
+ AST_ValueType *tmp = AST_ValueType::narrow_from_decl (v[i]);
+
+ if (this->derived_from_primary_key_base (tmp, pk_base))
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+AST_ValueType *
+AST_ValueType::lookup_primary_key_base (void) const
+{
+ AST_ValueType *retval = idl_global->primary_key_base ();
+
+ if (retval == 0)
+ {
+ Identifier local_id ("PrimaryKeyBase");
+ UTL_ScopedName local_name (&local_id, 0);
+
+ Identifier scope_name ("Components");
+ UTL_ScopedName pk_name (&scope_name, &local_name);
+ AST_Decl *d =
+ const_cast<AST_ValueType *> (this)->lookup_by_name (&pk_name, true);
+
+ local_id.destroy ();
+ scope_name.destroy ();
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (&pk_name);
+ return 0;
+ }
+
+ retval = AST_ValueType::narrow_from_decl (d);
+
+ if (retval == 0)
+ {
+ idl_global->err ()->valuetype_expected (d);
+ return 0;
+ }
+
+ idl_global->primary_key_base (retval);
+ }
+
+ return retval;
+}
+
+// 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..8f436fbcd21
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_valuetype_fwd.cpp
@@ -0,0 +1,66 @@
+// $Id$
+
+#include "ast_valuetype_fwd.h"
+#include "ast_interface.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+
+ACE_RCSID( ast,
+ ast_valuetype_fwd,
+ "$Id$")
+
+AST_ValueTypeFwd::AST_ValueTypeFwd (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_InterfaceFwd ()
+{
+}
+
+AST_ValueTypeFwd::AST_ValueTypeFwd (AST_Interface *dummy,
+ UTL_ScopedName *n)
+ : COMMON_Base (false,
+ dummy->is_abstract ()),
+ AST_Decl (AST_Decl::NT_valuetype_fwd,
+ n),
+ AST_Type (AST_Decl::NT_valuetype_fwd,
+ n),
+ AST_InterfaceFwd (dummy,
+ n)
+{
+}
+
+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 ())
+ {
+ this->dump_i (o, "abstract ");
+ }
+
+ this->dump_i (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
new file mode 100644
index 00000000000..35c8f8566f6
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_visitor.cpp
@@ -0,0 +1,16 @@
+// $Id$
+
+#include "ast_visitor.h"
+#include "ace/config-all.h"
+
+ACE_RCSID (ast,
+ ast_visitor,
+ "$Id$")
+
+ast_visitor::ast_visitor (void)
+{
+}
+
+ast_visitor::~ast_visitor (void)
+{
+}
diff --git a/TAO/TAO_IDL/be/be_argument.cpp b/TAO/TAO_IDL/be/be_argument.cpp
new file mode 100644
index 00000000000..c2c0774a91d
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_argument.cpp
@@ -0,0 +1,91 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_argument.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Argument that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_argument.h"
+#include "be_type.h"
+#include "be_visitor.h"
+#include "nr_extern.h"
+#include "global_extern.h"
+
+ACE_RCSID (be,
+ be_argument,
+ "$Id$")
+
+be_argument::be_argument (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Field (),
+ AST_Argument (),
+ be_decl ()
+{
+}
+
+be_argument::be_argument (AST_Argument::Direction d,
+ AST_Type *ft,
+ UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_argument,
+ n),
+ AST_Field (AST_Decl::NT_argument,
+ ft,
+ n),
+ AST_Argument (d,
+ ft,
+ n),
+ be_decl (AST_Decl::NT_argument,
+ n)
+{
+ AST_Decl *dcl = ScopeAsDecl (this->defined_in ());
+
+ // If there have been previous errors, dcl may be 0,
+ // and we don't want to crash, so we check for non-zero.
+ // Also, we don't want to set the bit if the operation is
+ // declared in an included file UNLESS the enclosing
+ // interface is abstract, in which case we regenerate the
+ // operation.
+ if (dcl != 0
+ && !dcl->is_local ()
+ && (idl_global->in_main_file () || dcl->is_abstract ()))
+ {
+ be_type *bt = be_type::narrow_from_decl (ft);
+ bt->seen_in_operation (true);
+ this->set_arg_seen_bit (bt);
+ idl_global->need_skeleton_includes_ = true;
+ }
+}
+
+
+int
+be_argument::accept (be_visitor *visitor)
+{
+ return visitor->visit_argument (this);
+}
+
+void
+be_argument::destroy (void)
+{
+ this->be_decl::destroy ();
+ this->AST_Argument::destroy ();
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS2 (be_argument, AST_Argument, be_decl)
+IMPL_NARROW_FROM_DECL (be_argument)
diff --git a/TAO/TAO_IDL/be/be_array.cpp b/TAO/TAO_IDL/be/be_array.cpp
new file mode 100644
index 00000000000..72042f19118
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_array.cpp
@@ -0,0 +1,275 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_array.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Array that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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"
+#include "global_extern.h"
+
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (be,
+ be_array,
+ "$Id$")
+
+be_array::be_array (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType (),
+ AST_Array (),
+ be_decl (),
+ be_type ()
+{
+}
+
+be_array::be_array (UTL_ScopedName *n,
+ unsigned long ndims,
+ UTL_ExprList *dims,
+ bool local,
+ bool abstract)
+ : COMMON_Base (local,
+ abstract),
+ AST_Decl (AST_Decl::NT_array,
+ n,
+ true),
+ AST_Type (AST_Decl::NT_array,
+ n),
+ AST_ConcreteType (AST_Decl::NT_array,
+ n),
+ AST_Array (n,
+ ndims,
+ dims,
+ local,
+ abstract),
+ be_decl (AST_Decl::NT_array,
+ n),
+ be_type (AST_Decl::NT_array,
+ n)
+{
+ if (!this->imported ())
+ {
+ idl_global->array_seen_ = true;
+ }
+}
+
+be_array::~be_array (void)
+{
+}
+
+int
+be_array::create_name (void)
+{
+ char namebuf [NAMEBUFSIZE];
+ unsigned long i;
+ UTL_ScopedName *n = 0;
+ be_decl *scope;
+
+ 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 ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "create_name - "
+ "bad base type\n"),
+ 0);
+ }
+
+ ACE_OS::sprintf (namebuf,
+ "_tao_array_%s",
+ bt->local_name ()->get_string ());
+
+ // Now append dimensions.
+ for (i = 0; i < this->n_dims (); ++i)
+ {
+ AST_Expression *expr = this->dims ()[i];
+
+ // Dimension value.
+ if ((expr == 0) || ((expr != 0) && (expr->ev () == 0)))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "create_name - "
+ "bad array dimension\n"),
+ -1);
+ }
+ if (expr->ev ()->et == AST_Expression::EV_ulong)
+ {
+ ACE_OS::sprintf (namebuf,
+ "%s_%d",
+ namebuf,
+ ((int)expr->ev ()->u.ulval));
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "create_name - "
+ "bad dimension value\n"),
+ -1);
+ }
+ }
+
+ // 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 ();
+
+ 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 (sn);
+ // Set the fully scoped name.
+ this->set_name (n);
+ }
+ else
+ {
+ // We better be not here because we must be inside some scope,
+ // at least the ROOT scope.
+ return -1;
+ }
+
+ return 0;
+}
+
+// Overriden method.
+void
+be_array::compute_tc_name (void)
+{
+ // Array TypeCodes can only be accessed through an alias
+ // TypeCode. Generate a TypeCode name that is meant for internal
+ // use alone.
+
+ Identifier * tao_id = 0;
+ ACE_NEW (tao_id,
+ Identifier ("TAO"));
+
+ ACE_NEW (this->tc_name_,
+ UTL_ScopedName (tao_id,
+ 0));
+
+ ACE_CString local_tc_name =
+ ACE_CString ("tc_")
+ + ACE_CString (this->flat_name ());
+
+ Identifier * typecode_scope = 0;
+ ACE_NEW (typecode_scope,
+ Identifier ("TypeCode"));
+
+ UTL_ScopedName * tc_scope_conc_name = 0;
+ ACE_NEW (tc_scope_conc_name,
+ UTL_ScopedName (typecode_scope,
+ 0));
+
+ this->tc_name_->nconc (tc_scope_conc_name);
+
+ Identifier * id = 0;
+ ACE_NEW (id,
+ Identifier (local_tc_name.c_str ()));
+
+ UTL_ScopedName * conc_name = 0;
+ ACE_NEW (conc_name,
+ UTL_ScopedName (id,
+ 0));
+
+ this->tc_name_->nconc (conc_name);
+}
+
+// Code generation.
+
+int
+be_array::gen_dimensions (TAO_OutStream *os,
+ unsigned short slice)
+{
+ // Loop index.
+ unsigned long i;
+
+ // Print our dimensions.
+ for (i = (slice ? 1 : 0); i < this->n_dims (); ++i)
+ {
+ // Retrieve the ith.
+ AST_Expression *expr = this->dims ()[i];
+
+ // Dimension value.
+ if ((expr == 0) || ((expr != 0) && (expr->ev () == 0)))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_dimensions - "
+ "bad array dimension\n"),
+ -1);
+ }
+
+ if (expr->ev ()->et == AST_Expression::EV_ulong)
+ {
+ *os << "[" << ((int)expr->ev ()->u.ulval) << "]";
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_dimensions - "
+ "bad dimension value\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_array::accept (be_visitor *visitor)
+{
+ return visitor->visit_array (this);
+}
+
+void
+be_array::destroy (void)
+{
+ this->be_type::destroy ();
+ this->AST_Array::destroy ();
+}
+
+// Narrowing
+IMPL_NARROW_METHODS2 (be_array, AST_Array, be_type)
+IMPL_NARROW_FROM_DECL (be_array)
diff --git a/TAO/TAO_IDL/be/be_attribute.cpp b/TAO/TAO_IDL/be/be_attribute.cpp
new file mode 100644
index 00000000000..ad32663ab16
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_attribute.cpp
@@ -0,0 +1,164 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_attribute.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Attribute that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_attribute.h"
+#include "be_type.h"
+#include "be_visitor.h"
+
+#include "global_extern.h"
+
+ACE_RCSID (be,
+ be_attribute,
+ "$Id$")
+
+be_attribute::be_attribute (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Field (),
+ AST_Attribute (),
+ be_decl ()
+{
+ be_operation_default_strategy *bods = 0;
+
+ ACE_NEW (bods,
+ be_operation_default_strategy (0));
+ this->get_strategy_ = bods;
+
+ ACE_NEW (bods,
+ be_operation_default_strategy (0));
+ this->set_strategy_ = bods;
+}
+
+be_attribute::be_attribute (bool ro,
+ AST_Type *ft,
+ UTL_ScopedName *n,
+ bool local,
+ bool abstract)
+ : COMMON_Base (local,
+ abstract),
+ AST_Decl (AST_Decl::NT_attr,
+ n),
+ AST_Field (AST_Decl::NT_attr,
+ ft,
+ n),
+ AST_Attribute (ro,
+ ft,
+ n,
+ local,
+ abstract),
+ be_decl (AST_Decl::NT_attr,
+ n)
+{
+ be_operation_default_strategy *bods = 0;
+
+ ACE_NEW (bods,
+ be_operation_default_strategy (0));
+ this->get_strategy_ = bods;
+
+ ACE_NEW (bods,
+ be_operation_default_strategy (0));
+ this->set_strategy_ = bods;
+
+ // TAO_IDL generated attribute methods currently have an exception
+ // specification containing CORBA::SystemException. Make sure we
+ // generate a "tao/SystemException.h" include directive.
+ idl_global->operation_seen_ = true;
+
+ if (!this->imported () && !this->is_local ())
+ {
+ // For the return types of the two operations
+ // generated from this attribute.
+ this->set_arg_seen_bit (be_type::narrow_from_decl (ft));
+ idl_global->basic_arg_seen_ = true;
+ }
+}
+
+
+
+int
+be_attribute::accept (be_visitor *visitor)
+{
+ return visitor->visit_attribute (this);
+}
+
+
+be_operation_strategy *
+be_attribute::set_set_strategy (be_operation_strategy *new_strategy)
+{
+ be_operation_strategy *old = this->set_strategy_;
+
+ if (new_strategy != 0)
+ {
+ this->set_strategy_ = new_strategy;
+ }
+
+ return old;
+}
+
+be_operation_strategy *
+be_attribute::set_get_strategy (be_operation_strategy *new_strategy)
+{
+ be_operation_strategy *old = this->get_strategy_;
+
+ if (new_strategy != 0)
+ {
+ this->get_strategy_ = new_strategy;
+ }
+
+ return old;
+}
+
+be_operation_strategy *
+be_attribute::get_set_strategy ()
+{
+ return this->set_strategy_;
+}
+
+be_operation_strategy *
+be_attribute::get_get_strategy ()
+{
+ return this->get_strategy_;
+}
+
+void
+be_attribute::destroy (void)
+{
+ if (0 != this->get_strategy_)
+ {
+ this->get_strategy_->destroy ();
+ delete this->get_strategy_;
+ this->get_strategy_ = 0;
+ }
+
+ if (0 != this->set_strategy_)
+ {
+ this->set_strategy_->destroy ();
+ delete this->set_strategy_;
+ this->set_strategy_ = 0;
+ }
+
+ this->be_decl::destroy ();
+ this->AST_Attribute::destroy ();
+}
+
+// Narrowing
+IMPL_NARROW_METHODS2 (be_attribute, AST_Attribute, be_decl)
+IMPL_NARROW_FROM_DECL (be_attribute)
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp
new file mode 100644
index 00000000000..2393171c558
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_codegen.cpp
@@ -0,0 +1,2436 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_codegen.cpp
+//
+// = DESCRIPTION
+// Code generation
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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"
+ #include "ace/os_include/os_ctype.h"
+
+ACE_RCSID (be,
+ be_codegen,
+ "$Id$")
+
+TAO_CodeGen * tao_cg = 0;
+
+TAO_CodeGen::TAO_CodeGen (void)
+ : client_header_ (0),
+ client_stubs_ (0),
+ client_inline_ (0),
+ server_header_ (0),
+ implementation_header_(0),
+ implementation_skeleton_(0),
+ server_template_header_ (0),
+ server_skeletons_ (0),
+ server_template_skeletons_ (0),
+ server_inline_ (0),
+ server_template_inline_ (0),
+ anyop_header_ (0),
+ anyop_source_ (0),
+ gperf_input_stream_ (0),
+ gperf_input_filename_ (0),
+ curr_os_ (0),
+ visitor_factory_ (0)
+{
+}
+
+// destructor
+TAO_CodeGen::~TAO_CodeGen (void)
+{
+}
+
+// visitor factory method
+be_visitor *
+TAO_CodeGen::make_visitor (be_visitor_context *ctx)
+{
+
+ if (this->visitor_factory_ == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO_CodeGen::make_visitor - ")
+ ACE_TEXT ("No Visitor Factory\n\n")),
+ 0);
+ }
+
+ return this->visitor_factory_->make_visitor (ctx);
+}
+
+// Change the string to all upper case.
+const char *
+TAO_CodeGen::upcase (const char *str)
+{
+ static char upcase_str [NAMEBUFSIZE];
+
+ ACE_OS::memset (upcase_str,
+ '\0',
+ NAMEBUFSIZE);
+
+ // Convert letters in str to upper case.
+ for (unsigned int i = 0; i < ACE_OS::strlen (str); ++i)
+ {
+ if (isalpha (str[i]))
+ {
+ upcase_str[i] = static_cast<char> (toupper (str[i]));
+ }
+ else
+ {
+ // Copy it as it is.
+ upcase_str[i] = str[i];
+ }
+ }
+
+ return upcase_str;
+}
+
+// Set the client header stream.
+int
+TAO_CodeGen::start_client_header (const char *fname)
+{
+ if (0 == fname)
+ {
+ // Bad file name.
+ return -1;
+ }
+
+ // @@ We are making use of "included_idl_files" that is in the
+ // idl_global. We need to make sure the validity of those files.
+ idl_global->validate_included_idl_files ();
+
+ // Retrieve the singleton instance to the outstream factory.
+ TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
+
+ // Clean up between multiple files.
+ delete this->client_header_;
+ this->client_header_ = factory->make_outstream ();
+
+ if (!this->client_header_)
+ {
+ return -1;
+ }
+
+ if (this->client_header_->open (fname, TAO_OutStream::TAO_CLI_HDR) == -1)
+ {
+ return -1;
+ }
+
+ *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_);
+
+ ACE_CString pidl_checker (idl_global->filename ()->get_string ());
+ bool got_pidl =
+ (pidl_checker.substr (pidl_checker.length () - 5) == ".pidl");
+
+ if (!got_pidl)
+ {
+ // Generate the #ifndef clause.
+ this->gen_ifndef_string (fname,
+ this->client_header_,
+ "_TAO_IDL_",
+ "_H_");
+ }
+ else
+ {
+ // Generate the #ifndef clause.
+ this->gen_ifndef_string (fname,
+ this->client_header_,
+ "_TAO_PIDL_",
+ "_H_");
+ }
+
+ if (be_global->pre_include () != 0)
+ {
+ *this->client_header_ << "#include /**/ \""
+ << be_global->pre_include ()
+ << "\"\n\n";
+ }
+
+ if (be_global->include_guard () != 0)
+ {
+ *this->client_header_ << "#ifndef "
+ << be_global->include_guard ()
+ << "\n";
+
+ *this->client_header_ << "#error "
+ << "You should not include " << fname;
+
+ if (be_global->safe_include () != 0)
+ {
+ *this->client_header_ << ", use " << be_global->safe_include ();
+ }
+
+ *this->client_header_ << "\n";
+
+ *this->client_header_ << "#endif /* "
+ << be_global->include_guard ()
+ << " */\n";
+ }
+
+ // To get ACE_UNUSED_ARGS
+ this->gen_standard_include (this->client_header_,
+ "ace/config-all.h");
+
+ // Some compilers don't optimize the #ifndef header include
+ // protection, but do optimize based on #pragma once.
+ *this->client_header_ << "\n\n#if !defined (ACE_LACKS_PRAGMA_ONCE)\n"
+ << "# pragma once\n"
+ << "#endif /* ACE_LACKS_PRAGMA_ONCE */";
+
+ *this->client_header_ << be_nl;
+
+ // Other include files.
+
+ if (be_global->stub_export_include () != 0)
+ {
+ *this->client_header_ << "\n#include \""
+ << be_global->stub_export_include ()
+ << "\"";
+ }
+
+ this->gen_stub_hdr_includes ();
+
+ size_t nfiles = idl_global->n_included_idl_files ();
+
+ if (nfiles > 0)
+ {
+ *this->client_header_ << "\n";
+ }
+
+ // We must include all the client headers corresponding to
+ // IDL files included by the current IDL file.
+ // We will use the included IDL file names as they appeared
+ // in the original main IDL file, not the one which went
+ // thru CC preprocessor.
+ for (size_t j = 0; j < nfiles; ++j)
+ {
+ char* idl_name = idl_global->included_idl_files ()[j];
+
+ // Make a String out of it.
+ UTL_String idl_name_str = idl_name;
+
+ // Make sure this file was actually got included, not
+ // ignored by some #if defined compiler directive.
+
+
+ // Get the clnt header from the IDL file name.
+ const char* client_hdr =
+ BE_GlobalData::be_get_client_hdr (&idl_name_str,
+ 1);
+
+ idl_name_str.destroy ();
+
+ // Sanity check and then print.
+ if (client_hdr != 0)
+ {
+ this->client_header_->print ("\n#include \"%s\"",
+ client_hdr);
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("\nERROR, invalid file '%s' included"),
+ idl_name),
+ -1);
+ }
+ }
+
+ // Generate the TAO_EXPORT_MACRO macro.
+ *this->client_header_ << "\n\n#if defined (TAO_EXPORT_MACRO)\n";
+ *this->client_header_ << "#undef TAO_EXPORT_MACRO\n";
+ *this->client_header_ << "#endif\n";
+ *this->client_header_ << "#define TAO_EXPORT_MACRO "
+ << be_global->stub_export_macro ();
+
+ // Begin versioned namespace support after initial headers have been
+ // included, but before the inline file and post include
+ // directives.
+ *this->client_header_ << be_global->versioning_begin ();
+
+ return 0;
+}
+
+// Get the client header stream.
+TAO_OutStream *
+TAO_CodeGen::client_header (void)
+{
+ return this->client_header_;
+}
+
+// Set the client stub stream.
+int
+TAO_CodeGen::start_client_stubs (const char *fname)
+{
+ // Retrieve the singleton instance to the outstream factory.
+ TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
+
+ // Clean up between multiple files.
+ delete this->client_stubs_;
+ this->client_stubs_ = factory->make_outstream ();
+
+ if (!this->client_stubs_)
+ {
+ return -1;
+ }
+
+ if (this->client_stubs_->open (fname, TAO_OutStream::TAO_CLI_IMPL) == -1)
+ {
+ return -1;
+ }
+
+ *this->client_stubs_ << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__
+ << be_nl << be_nl;
+
+ this->gen_stub_src_includes ();
+
+ // Generate the ident string, if any.
+ this->gen_ident_string (this->client_stubs_);
+
+ // Only when we generate a client inline file generate the include
+ if (be_global->gen_client_inline ())
+ {
+ // Generate the code that includes the inline file if not included in the
+ // header file.
+ *this->client_stubs_ << "\n\n#if !defined (__ACE_INLINE__)";
+ *this->client_stubs_ << "\n#include \""
+ << be_global->be_get_client_inline_fname (1)
+ << "\"";
+ *this->client_stubs_ << "\n#endif /* !defined INLINE */";
+ }
+
+ // Begin versioned namespace support after all headers have been
+ // included, but before any code is generated.
+ *this->client_stubs_ << be_global->versioning_begin ();
+
+ return 0;
+}
+
+// Get the client stubs stream.
+TAO_OutStream *
+TAO_CodeGen::client_stubs (void)
+{
+ return this->client_stubs_;
+}
+
+// Set the client inline stream.
+int
+TAO_CodeGen::start_client_inline (const char *fname)
+{
+ // Retrieve the singleton instance to the outstream factory.
+ TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
+
+ // Clean up between multiple files.
+ delete this->client_inline_;
+ this->client_inline_ = factory->make_outstream ();
+
+ if (!this->client_inline_)
+ {
+ return -1;
+ }
+
+ if (this->client_inline_->open (fname, TAO_OutStream::TAO_CLI_INL) == -1)
+ {
+ return -1;
+ }
+
+ // Generate the ident string, if any.
+ this->gen_ident_string (this->client_inline_);
+
+ // Begin versioned namespace support after initial headers, if any,
+ // have been included.
+ *this->client_inline_ << be_global->versioning_begin ();
+
+ return 0;
+}
+
+// Get the client inline stream.
+TAO_OutStream *
+TAO_CodeGen::client_inline (void)
+{
+ return this->client_inline_;
+}
+
+// Set the server header stream.
+int
+TAO_CodeGen::start_server_header (const char *fname)
+{
+ // Retrieve the singleton instance to the outstream factory.
+ TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
+
+ // Clean up between multiple files.
+ delete this->server_header_;
+ this->server_header_ = factory->make_outstream ();
+
+ if (!this->server_header_)
+ {
+ return -1;
+ }
+
+ if (this->server_header_->open (fname, TAO_OutStream::TAO_SVR_HDR) == -1)
+ {
+ return -1;
+ }
+
+ // If we are suppressing skel file generation, bail after generating the
+ // copyright text and an informative message.
+ if (!be_global->gen_skel_files ())
+ {
+ *this->server_header_ << be_nl
+ << "// Skeleton file generation suppressed with "
+ << "command line option -SS" << be_nl;
+
+ return 0;
+ }
+
+ *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_);
+
+ // Generate the #ifndef clause.
+ this->gen_ifndef_string (fname,
+ this->server_header_,
+ "_TAO_IDL_",
+ "_H_");
+
+ if (be_global->pre_include () != 0)
+ {
+ *this->server_header_ << "#include /**/ \""
+ << be_global->pre_include ()
+ << "\"\n";
+ }
+
+ // The server header should include the client header.
+ *this->server_header_ << "\n#include \""
+ << be_global->be_get_client_hdr_fname (1)
+ << "\"";
+
+ // We must include all the skeleton headers corresponding to
+ // IDL files included by the current IDL file.
+ // We will use the included IDL file names as they appeared
+ // in the original main IDL file, not the one which went
+ // thru CC preprocessor.
+ for (size_t j = 0;
+ j < idl_global->n_included_idl_files ();
+ ++j)
+ {
+ char* idl_name = idl_global->included_idl_files ()[j];
+
+ // String'ifying the name.
+ UTL_String idl_name_str (idl_name);
+
+ const char* server_hdr =
+ BE_GlobalData::be_get_server_hdr (&idl_name_str, 1);
+
+ idl_name_str.destroy ();
+
+ this->server_header_->print ("\n#include \"%s\"",
+ server_hdr);
+ }
+
+ // Some compilers don't optimize the #ifndef header include
+ // protection, but do optimize based on #pragma once.
+ *this->server_header_ << "\n\n#if !defined (ACE_LACKS_PRAGMA_ONCE)\n"
+ << "# pragma once\n"
+ << "#endif /* ACE_LACKS_PRAGMA_ONCE */\n";
+
+ // Include the definitions for the PortableServer namespace,
+ // this forces the application to link the POA library, a good
+ // thing, because we need the definitions there, it also
+ // registers the POA factory with the Service_Configurator, so
+ // the ORB can automatically find it.
+ if (idl_global->non_local_iface_seen_)
+ {
+ // Include the Messaging files if AMI is enabled.
+ if (be_global->ami_call_back () == true)
+ {
+ // Include Messaging skeleton file.
+ this->gen_standard_include (this->server_header_,
+ "tao/Messaging/MessagingS.h");
+ }
+
+ this->gen_standard_include (this->server_header_,
+ "tao/Collocation_Proxy_Broker.h");
+ this->gen_standard_include (this->server_header_,
+ "tao/PortableServer/PortableServer.h");
+ this->gen_standard_include (this->server_header_,
+ "tao/PortableServer/Servant_Base.h");
+
+ if (be_global->gen_amh_classes ())
+ {
+ this->gen_standard_include (this->server_header_,
+ "tao/Messaging/AMH_Response_Handler.h");
+ }
+ }
+
+ if (be_global->skel_export_include () != 0)
+ {
+ *this->server_header_ << "\n\n#include \""
+ << be_global->skel_export_include ()
+ << "\"";
+
+ // Generate the TAO_EXPORT_MACRO macro.
+ *this->server_header_ << "\n\n#if defined (TAO_EXPORT_MACRO)\n";
+ *this->server_header_ << "#undef TAO_EXPORT_MACRO\n";
+ *this->server_header_ << "#endif\n";
+ *this->server_header_ << "#define TAO_EXPORT_MACRO "
+ << be_global->skel_export_macro ();
+ }
+
+ // Begin versioned namespace support after initial headers have been
+ // included, but before the inline file and post include
+ // directives.
+ *this->server_header_ << be_global->versioning_begin ();
+
+ return 0;
+}
+
+// Get the server header stream.
+TAO_OutStream *
+TAO_CodeGen::server_header (void)
+{
+ return this->server_header_;
+}
+
+// Set the server header stream.
+int
+TAO_CodeGen::start_server_template_header (const char *fname)
+{
+ // Retrieve the singleton instance to the outstream factory.
+ TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
+
+ // Clean up between multiple files.
+ delete this->server_template_header_;
+ this->server_template_header_ = factory->make_outstream ();
+
+ if (!this->server_template_header_)
+ {
+ return -1;
+ }
+
+ if (this->server_template_header_->open (fname,
+ TAO_OutStream::TAO_SVR_TMPL_HDR)
+ == -1)
+ {
+ return -1;
+ }
+
+ *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_);
+
+ // Generate the #ifndef clause.
+ this->gen_ifndef_string (fname,
+ this->server_template_header_,
+ "_TAO_IDL_",
+ "_H_");
+
+ if (be_global->pre_include () != 0)
+ {
+ *this->server_template_header_ << "#include /**/ \""
+ << be_global->pre_include ()
+ << "\"";
+ }
+
+ // Begin versioned namespace support after initial headers have been
+ // included, but before the inline file and post include
+ // directives.
+ *this->server_template_header_ << be_global->versioning_begin ();
+
+ return 0;
+}
+
+// Get the server header stream.
+TAO_OutStream *
+TAO_CodeGen::server_template_header (void)
+{
+ return this->server_template_header_;
+}
+
+// Set the server skeletons stream.
+int
+TAO_CodeGen::start_server_skeletons (const char *fname)
+{
+ // Retrieve the singleton instance to the outstream factory.
+ TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
+
+ // Clean up between multiple files.
+ delete this->server_skeletons_;
+ this->server_skeletons_ = factory->make_outstream ();
+
+ if (!this->server_skeletons_)
+ {
+ return -1;
+ }
+
+ if (this->server_skeletons_->open (fname,
+ TAO_OutStream::TAO_SVR_IMPL)
+ == -1)
+ {
+ return -1;
+ }
+
+ *this->server_skeletons_ << be_nl << 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_);
+
+ // Generate the include statement for the precompiled header file.
+ if (be_global->pch_include ())
+ {
+ *this->server_skeletons_ << "#include \""
+ << be_global->pch_include ()
+ << "\"\n";
+ }
+
+ // Generate the #ifndef clause.
+ this->gen_ifndef_string (fname,
+ this->server_skeletons_,
+ "_TAO_IDL_",
+ "_CPP_");
+
+ // Generate the include statement for the server header.
+ *this->server_skeletons_
+ << "\n#include \""
+ << be_global->be_get_server_hdr_fname (1)
+ << "\"";
+
+ this->gen_skel_src_includes ();
+
+ // Only when we generate a server inline file generate the include
+ if (be_global->gen_server_inline ())
+ {
+ // Generate the code that includes the inline file if not included in the
+ // header file.
+ *this->server_skeletons_ << "\n\n#if !defined (__ACE_INLINE__)\n";
+ *this->server_skeletons_ << "#include \""
+ << be_global->be_get_server_inline_fname (1)
+ << "\"\n";
+ *this->server_skeletons_ << "#endif /* !defined INLINE */";
+ }
+
+ // Begin versioned namespace support after initial headers have been
+ // included, but before the inline file and post include
+ // directives.
+ *this->server_skeletons_ << be_global->versioning_begin ();
+
+ return 0;
+}
+
+// Get the server skeletons stream.
+TAO_OutStream *
+TAO_CodeGen::server_skeletons (void)
+{
+ return this->server_skeletons_;
+}
+
+// Start the server template skeleton stream.
+int
+TAO_CodeGen::start_server_template_skeletons (const char *fname)
+{
+ // Retrieve the singleton instance to the outstream factory.
+ TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
+
+ // Clean up between multiple files.
+ delete this->server_template_skeletons_;
+ this->server_template_skeletons_ = factory->make_outstream ();
+
+ if (!this->server_template_skeletons_)
+ {
+ return -1;
+ }
+
+ if (this->server_template_skeletons_->open (fname,
+ TAO_OutStream::TAO_SVR_TMPL_IMPL)
+ == -1)
+ {
+ return -1;
+ }
+
+ *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_);
+
+ // Generate the #ifndef clause.
+ this->gen_ifndef_string (fname,
+ this->server_template_skeletons_,
+ "_TAO_IDL_",
+ "_CPP_");
+
+ // Generate the include statement for the server header.
+ *this->server_template_skeletons_
+ << "#include \""
+ << be_global->be_get_server_template_hdr_fname (1)
+ << "\"";
+
+ // Generate the code that includes the inline file if not included in the
+ // header file.
+ *this->server_template_skeletons_ << "\n\n#if !defined (__ACE_INLINE__)";
+ *this->server_template_skeletons_
+ << "\n#include \""
+ << be_global->be_get_server_template_inline_fname (1)
+ << "\"";
+ *this->server_template_skeletons_ << "\n#endif /* !defined INLINE */\n\n";
+
+ // Begin versioned namespace support after initial headers have been
+ // included, but before the inline file and post include
+ // directives.
+ *this->server_template_skeletons_ << be_global->versioning_begin ();
+
+ return 0;
+}
+
+// Get the server template skeletons stream.
+TAO_OutStream *
+TAO_CodeGen::server_template_skeletons (void)
+{
+ return this->server_template_skeletons_;
+}
+
+// Set the server inline stream.
+int
+TAO_CodeGen::start_server_inline (const char *fname)
+{
+ // Retrieve the singleton instance to the outstream factory.
+ TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
+
+ // Clean up between multiple files.
+ delete this->server_inline_;
+ this->server_inline_ = factory->make_outstream ();
+
+ if (!this->server_inline_)
+ {
+ return -1;
+ }
+
+ if (this->server_inline_->open (fname, TAO_OutStream::TAO_SVR_INL) == -1)
+ {
+ return -1;
+ }
+
+ // Generate the ident string, if any.
+ this->gen_ident_string (this->server_inline_);
+
+ // Begin versioned namespace support after initial headers, if any, have been
+ // included.
+ *this->server_inline_ << be_global->versioning_begin ();
+
+ return 0;
+}
+
+// Get the server inline stream.
+TAO_OutStream *
+TAO_CodeGen::server_inline (void)
+{
+ return this->server_inline_;
+}
+
+// Set the server template inline stream.
+int
+TAO_CodeGen::start_server_template_inline (const char *fname)
+{
+ // Retrieve the singleton instance to the outstream factory.
+ TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
+
+ // Clean up between multiple files.
+ delete this->server_template_inline_;
+ this->server_template_inline_ = factory->make_outstream ();
+
+ if (!this->server_template_inline_)
+ {
+ return -1;
+ }
+
+ if (this->server_template_inline_->open (fname,
+ TAO_OutStream::TAO_SVR_INL)
+ == -1)
+ {
+ return -1;
+ }
+
+ // Generate the ident string, if any.
+ this->gen_ident_string (this->server_template_inline_);
+
+ // Begin versioned namespace support after initial headers have been
+ // included, but before the inline file and post include
+ // directives.
+ *this->server_template_inline_ << be_global->versioning_begin ();
+
+ return 0;
+}
+
+// Get the server template inline stream.
+TAO_OutStream *
+TAO_CodeGen::server_template_inline (void)
+{
+ return this->server_template_inline_;
+}
+
+int
+TAO_CodeGen::start_anyop_header (const char *fname)
+{
+ if (!be_global->gen_anyop_files ())
+ {
+ return 0;
+ }
+
+ // Retrieve the singleton instance to the outstream factory.
+ TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
+
+ // Clean up between multiple files.
+ delete this->anyop_header_;
+ this->anyop_header_ = factory->make_outstream ();
+
+ if (0 == this->anyop_header_)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "TAO_CodeGen::start_anyop_header - "
+ "Error creating file stream\n"),
+ -1);
+ }
+
+ if (this->anyop_header_->open (fname,
+ TAO_OutStream::TAO_CLI_HDR)
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "TAO_CodeGen::start_anyop_header - "
+ "Error opening file\n"),
+ -1);
+ }
+
+ *this->anyop_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->anyop_header_);
+
+ // Generate the #ifndef clause.
+ this->gen_ifndef_string (fname,
+ this->anyop_header_,
+ "_TAO_IDL_",
+ "_H_");
+
+ if (be_global->pre_include () != 0)
+ {
+ *this->anyop_header_ << "#include /**/ \""
+ << be_global->pre_include ()
+ << "\"\n";
+ }
+
+ // If anyop macro hasn't been set, default to stub macro.
+ if (be_global->anyop_export_include () != 0)
+ {
+ *this->anyop_header_ << "\n#include \""
+ << be_global->anyop_export_include ()
+ << "\"";
+ }
+ else if (be_global->stub_export_include () != 0)
+ {
+ *this->anyop_header_ << "\n#include \""
+ << be_global->stub_export_include ()
+ << "\"";
+ }
+
+ const char *tao_prefix = "";
+ ACE_CString pidl_checker (idl_global->filename ()->get_string ());
+ bool got_pidl =
+ (pidl_checker.substr (pidl_checker.length () - 5) == ".pidl");
+
+ // If we're here and we have a .pidl file, we need to generate
+ // the *A.h include from the AnyTypeCode library.
+ if (got_pidl)
+ {
+ tao_prefix = "tao/";
+ }
+
+ // Generate the include statement for the client header. We just
+ // need to put only the base names. Path info is not required.
+ *this->anyop_header_ << "\n#include \"" << tao_prefix
+ << be_global->be_get_client_hdr_fname ()
+ << "\"";
+
+ // If we have not suppressed Any operator generation and also
+ // are not generating the operators in a separate file, we
+ // need to include the *A.h file from all .pidl files here.
+ if (be_global->any_support ())
+ {
+ for (size_t j = 0; j < idl_global->n_included_idl_files (); ++j)
+ {
+ char* idl_name = idl_global->included_idl_files ()[j];
+
+ // Make a String out of it.
+ UTL_String idl_name_str = idl_name;
+
+ const char *anyop_hdr =
+ BE_GlobalData::be_get_anyop_header (&idl_name_str, 1);
+
+ idl_name_str.destroy ();
+
+ ACE_CString pidl_checker (idl_name);
+ bool got_pidl =
+ (pidl_checker.substr (pidl_checker.length () - 5) == ".pidl");
+
+ // If we're here and we have a .pidl file, we need to generate
+ // the *A.h include from the AnyTypeCode library.
+ if (got_pidl)
+ {
+ // Stripped off any scope in the name and add the
+ // AnyTypeCode prefix.
+ ACE_CString work_hdr (anyop_hdr);
+ ACE_CString final_hdr = "tao/AnyTypeCode/";
+ ACE_CString::size_type pos = work_hdr.rfind ('/');
+
+ if (pos != ACE_SString::npos)
+ {
+ ACE_CString scope (work_hdr.substr (0, pos - 1));
+
+ // If we find a '/' in the containing scope name, it
+ // means we are including a .pidl file from a
+ // subdirectory of $TAO_ROOT/tao, and so we should
+ // include the anyop_hdr string as is, and not strip
+ // off the scope name and prepend "tao/AnyTypeCode/".
+ // Only .pidl files in $TAO_ROOT/tao itself have
+ // their generated *A.* files moved to the AnyTypeCode
+ // library.
+ if (scope.find ('/') == ACE_SString::npos)
+ {
+ work_hdr = work_hdr.substr (pos + 1);
+ final_hdr += work_hdr;
+ }
+ else
+ {
+ final_hdr = work_hdr;
+ }
+ }
+
+ this->anyop_header_->print ("\n#include \"%s\"",
+ final_hdr.c_str ());
+ }
+ else
+ {
+ this->anyop_header_->print ("\n#include \"%s\"",
+ anyop_hdr);
+ }
+ }
+ }
+ *this->anyop_header_ << "\n";
+
+ // Begin versioned namespace support after initial headers have been
+ // included, but before the inline file and post include
+ // directives.
+ *this->anyop_header_ << be_global->versioning_begin ();
+
+ return 0;
+}
+
+int
+TAO_CodeGen::start_anyop_source (const char *fname)
+{
+ if (!be_global->gen_anyop_files ())
+ {
+ return 0;
+ }
+
+ // Retrieve the singleton instance to the outstream factory.
+ TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
+
+ // Clean up between multiple files.
+ delete this->anyop_source_;
+ this->anyop_source_ = factory->make_outstream ();
+
+ if (0 == this->anyop_source_)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "TAO_CodeGen::start_anyop_source - "
+ "Error creating file stream\n"),
+ -1);
+ }
+
+ if (this->anyop_source_->open (fname,
+ TAO_OutStream::TAO_CLI_IMPL)
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "TAO_CodeGen::start_anyop_source - "
+ "Error opening file\n"),
+ -1);
+ }
+
+ // Generate the include statement for the precompiled header file.
+ if (be_global->pch_include ())
+ {
+ *this->anyop_source_ << "#include \""
+ << be_global->pch_include ()
+ << "\"";
+ }
+
+ if (be_global->safe_include ())
+ {
+ // Generate the safe include if it is defined instead of the client header
+ // need to put only the base names. Path info is not required.
+ *this->anyop_source_ << "\n#include \""
+ << be_global->safe_include ()
+ << "\"";
+ }
+ else
+ {
+ // Generate the include statement for the client header. We just
+ // need to put only the base names. Path info is not required.
+ *this->anyop_source_ << "\n#include \""
+ << be_global->be_get_anyop_header_fname (1)
+ << "\"";
+ }
+
+ this->gen_typecode_includes (this->anyop_source_);
+
+ this->gen_any_file_includes (this->anyop_source_);
+
+ // Begin versioned namespace support after initial headers have been
+ // included, but before the inline file and post include
+ // directives.
+ *this->anyop_source_ << be_global->versioning_begin ();
+
+ return 0;
+}
+
+TAO_OutStream *
+TAO_CodeGen::anyop_header (void)
+{
+ return this->anyop_header_;
+}
+
+TAO_OutStream *
+TAO_CodeGen::anyop_source (void)
+{
+ return this->anyop_source_;
+}
+
+// Set the server header stream.
+int
+TAO_CodeGen::start_implementation_header (const char *fname)
+{
+ // Retrieve the singleton instance to the outstream factory.
+ TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
+
+ // Clean up between multiple files.
+ delete this->implementation_header_;
+ this->implementation_header_ = factory->make_outstream ();
+
+ if (!this->implementation_header_)
+ {
+ return -1;
+ }
+
+ if (this->implementation_header_->open (fname,
+ TAO_OutStream::TAO_IMPL_HDR)
+ == -1)
+ {
+ return -1;
+ }
+
+ *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_);
+
+ // Generate the #ifndef clause.
+ this->gen_ifndef_string (fname,
+ this->implementation_header_,
+ "",
+ "_H_");
+
+ const char* server_hdr = BE_GlobalData::be_get_server_hdr_fname (1);
+
+ *this->implementation_header_<< "#include \"" << server_hdr <<"\"";
+
+ *this->implementation_header_
+ << "\n\n#if !defined (ACE_LACKS_PRAGMA_ONCE)\n"
+ << "#pragma once\n"
+ << "#endif /* ACE_LACKS_PRAGMA_ONCE */\n\n";
+
+ if (idl_global->local_iface_seen_)
+ {
+ *this->implementation_header_ << "#include \"tao/LocalObject.h\"\n\n";
+ }
+
+ return 0;
+}
+
+
+// Get the implementation header stream.
+TAO_OutStream *
+TAO_CodeGen::implementation_header (void)
+{
+ return this->implementation_header_;
+}
+
+
+// Set the implementation skeleton stream.
+int
+TAO_CodeGen::start_implementation_skeleton (const char *fname)
+{
+ // Retrieve the singleton instance to the outstream factory.
+ TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
+
+ // Clean up between multiple files.
+ delete this->implementation_skeleton_;
+ this->implementation_skeleton_ = factory->make_outstream ();
+
+ if (!this->implementation_skeleton_)
+ {
+ return -1;
+ }
+
+ if (this->implementation_skeleton_->open (fname,
+ TAO_OutStream::TAO_IMPL_SKEL)
+ == -1)
+ {
+ return -1;
+ }
+
+ *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_);
+
+ const char* impl_hdr =
+ BE_GlobalData::be_get_implementation_hdr_fname ();
+
+ this->implementation_skeleton_->print ("#include \"%s\"\n\n",
+ impl_hdr);
+
+ return 0;
+}
+
+// Get the implementation header stream.
+TAO_OutStream *
+TAO_CodeGen::implementation_skeleton (void)
+{
+ return this->implementation_skeleton_;
+}
+
+// Put the last #endif in the client and server headers.
+int
+TAO_CodeGen::end_client_header (void)
+{
+ // Generate the <<= and >>= operators here.
+
+ *this->client_header_ << be_nl << be_nl << "// TAO_IDL - Generated from"
+ << be_nl << "// " << __FILE__ << ":" <<
+ __LINE__ << be_nl;
+
+ // End versioned namespace support before remaining include
+ // directives at end of file.
+ *this->client_header_ << be_global->versioning_end ();
+
+ // Only when we generate a client inline file generate the include
+ if (be_global->gen_client_inline ())
+ {
+ // Insert the code to include the inline file.
+ *this->client_header_ << "#if defined (__ACE_INLINE__)\n";
+ *this->client_header_ << "#include \""
+ << be_global->be_get_client_inline_fname (1)
+ << "\"\n";
+ *this->client_header_ << "#endif /* defined INLINE */\n\n";
+ }
+
+ // Code to put the last #endif.
+
+ if (be_global->post_include () != 0)
+ {
+ *this->client_header_ << "#include /**/ \""
+ << be_global->post_include ()
+ << "\"\n\n";
+ }
+
+ *this->client_header_ << "#endif /* ifndef */" << be_nl << be_nl;
+
+ return 0;
+}
+
+void
+TAO_CodeGen::end_client_inline (void)
+{
+ *this->client_inline_ << "\n";
+
+ // End versioned namespace support. Do not place include directives
+ // before this.
+ *this->client_inline_ << be_global->versioning_end ();
+}
+
+void
+TAO_CodeGen::end_client_stubs (void)
+{
+ *this->client_stubs_ << "\n";
+
+ // End versioned namespace support. Do not place include directives
+ // before this.
+ *this->client_stubs_ << be_global->versioning_end ();
+}
+
+int
+TAO_CodeGen::end_server_header (void)
+{
+ *this->server_header_ << be_nl << be_nl << "// TAO_IDL - Generated from "
+ << be_nl << "// " << __FILE__ << ":" << __LINE__
+ << be_nl << be_nl;
+
+ // End versioned namespace support. Do not place include directives
+ // before this.
+ *this->server_header_ << be_global->versioning_end ();
+
+ // Insert the template header.
+ if (be_global->gen_tie_classes ())
+ {
+ *this->server_header_ << "#include \""
+ << be_global->be_get_server_template_hdr_fname (1)
+ << "\"\n";
+ }
+
+ // Only when we generate a server inline file generate the include
+ if (be_global->gen_server_inline ())
+ {
+ // Insert the code to include the inline file.
+ *this->server_header_ << "\n#if defined (__ACE_INLINE__)\n";
+ *this->server_header_ << "#include \""
+ << be_global->be_get_server_inline_fname (1)
+ << "\"\n";
+ *this->server_header_ << "#endif /* defined INLINE */";
+ }
+
+ // Code to put the last #endif.
+ *this->server_header_ << "\n\n";
+
+ if (be_global->post_include () != 0)
+ {
+ *this->server_header_ << "#include /**/ \""
+ << be_global->post_include ()
+ << "\"\n";
+ }
+
+ *this->server_header_ << "#endif /* ifndef */\n";
+ return 0;
+}
+
+void
+TAO_CodeGen::end_server_inline (void)
+{
+ *this->server_inline_ << "\n";
+
+ // End versioned namespace support. Do not place include directives
+ // before this.
+ *this->server_inline_ << be_global->versioning_end ();
+}
+
+int
+TAO_CodeGen::end_implementation_header (const char *fname)
+{
+ char macro_name [NAMEBUFSIZE] = { 0 };
+
+ const char *suffix = ACE_OS::strrchr (fname, '.');
+
+ if (suffix == 0)
+ {
+ // File seems to have no extension, so let us take the name
+ // as it is.
+ if (fname == 0)
+ {
+ // Bad file name.
+ return -1;
+ }
+ else
+ {
+ suffix = fname;
+ }
+ }
+
+ // Convert letters in fname to upper case.
+ for (int i = 0; i < (suffix - fname); ++i)
+ {
+ if (isalpha (fname [i]))
+ {
+ macro_name[i] = static_cast<char> (toupper (fname [i]));
+ }
+ else if (isdigit (fname [i]))
+ {
+ macro_name[i] = fname[i];
+ }
+ else
+ {
+ macro_name[i] = '_';
+ }
+ }
+
+ ACE_OS::strcat (macro_name,
+ "_H_");
+
+ // Code to put the last #endif.
+ this->implementation_header_->print ("\n#endif /* %s */\n",
+ macro_name);
+ return 0;
+}
+
+int
+TAO_CodeGen::end_server_template_header (void)
+{
+ *this->server_template_header_ << be_nl << be_nl << "// TAO_IDL - Generated from "
+ << be_nl << "// "
+ << __FILE__ << ":" << __LINE__ << "\n";
+
+ // End versioned namespace support. Do not place include directives
+ // before this.
+ *this->server_template_header_ << be_global->versioning_end ();
+
+ // Insert the code to include the inline file.
+ *this->server_template_header_ << "#if defined (__ACE_INLINE__)";
+ *this->server_template_header_
+ << "\n#include \""
+ << be_global->be_get_server_template_inline_fname (1)
+ << "\"";
+ *this->server_template_header_ << "\n#endif /* defined INLINE */";
+
+ // Insert the code to include the template source file.
+ *this->server_template_header_
+ << "\n\n#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)";
+ *this->server_template_header_
+ << "\n#include \""
+ << be_global->be_get_server_template_skeleton_fname (1)
+ << "\"";
+ *this->server_template_header_ << "\n#endif /* defined REQUIRED SOURCE */";
+
+ // Insert the code to include the template pragma.
+ *this->server_template_header_
+ << "\n\n#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)";
+ *this->server_template_header_
+ << "\n#pragma implementation (\""
+ << be_global->be_get_server_template_skeleton_fname (1)
+ << "\")";
+ *this->server_template_header_ << "\n#endif /* defined REQUIRED PRAGMA */";
+
+ // Code to put the last #endif.
+ *this->server_template_header_ << "\n\n";
+
+ if (be_global->post_include () != 0)
+ {
+ *this->server_template_header_ << "#include /**/ \""
+ << be_global->post_include ()
+ << "\"\n";
+ }
+
+ *this->server_template_header_ << "#endif /* ifndef */\n";
+ return 0;
+}
+
+int
+TAO_CodeGen::end_server_template_inline (void)
+{
+ *this->server_template_inline_ << "\n";
+
+ // End versioned namespace support. Do not place include directives
+ // before this.
+ *this->server_template_inline_ << be_global->versioning_end ();
+
+ return 0;
+}
+
+int
+TAO_CodeGen::end_server_template_skeletons (void)
+{
+ // End versioned namespace support. Do not place include directives
+ // before this.
+ *this->server_template_skeletons_ << be_global->versioning_end ();
+
+ // Code to put the last #endif.
+ *this->server_template_skeletons_ << "\n#endif /* ifndef */\n";
+
+ return 0;
+}
+
+int
+TAO_CodeGen::end_server_skeletons (void)
+{
+ // End versioned namespace support. Do not place include directives
+ // before this.
+ *this->server_skeletons_ << be_global->versioning_end ();
+
+ // Code to put the last #endif.
+ *this->server_skeletons_ << "\n\n#endif /* ifndef */\n";
+
+ return 0;
+}
+
+int
+TAO_CodeGen::end_anyop_header (void)
+{
+ // End versioned namespace support. Do not place include directives
+ // before this.
+ *this->anyop_header_ << be_global->versioning_end ();
+
+
+ if (be_global->post_include () != 0)
+ {
+ *this->anyop_header_ << "\n\n#include /**/ \""
+ << be_global->post_include ()
+ << "\"";
+ }
+
+ // Code to put the last #endif.
+ *this->anyop_header_ << "\n\n#endif /* ifndef */\n";
+
+ return 0;
+}
+
+int
+TAO_CodeGen::end_anyop_source (void)
+{
+ // End versioned namespace support. Do not place include directives
+ // before this.
+ *this->anyop_source_ << be_global->versioning_end ();
+
+ *this->anyop_source_ << "\n";
+
+ return 0;
+}
+
+// We use the following helper functions to pass information. This class is the
+// best place to pass such information rather than passing information through
+// global variables spread everywhere. This class is a singleton and is
+// effectively a global.
+
+void
+TAO_CodeGen::gperf_input_stream (TAO_OutStream *os)
+{
+#if !defined (linux) && !defined (__QNX__) && !defined (__GLIBC__)
+ // This causes a seg fault on Linux RH 5.1. Let it leak . . .
+ delete this->gperf_input_stream_;
+#endif /* ! linux */
+ this->gperf_input_stream_ = os;
+}
+
+TAO_OutStream *
+TAO_CodeGen::gperf_input_stream (void)
+{
+ return this->gperf_input_stream_;
+}
+
+void
+TAO_CodeGen::gperf_input_filename (char *filename)
+{
+ delete [] this->gperf_input_filename_;
+ this->gperf_input_filename_ = filename;
+}
+
+char *
+TAO_CodeGen::gperf_input_filename (void)
+{
+ return this->gperf_input_filename_;
+}
+
+void
+TAO_CodeGen::outstream (TAO_OutStream *os)
+{
+ this->curr_os_ = os;
+}
+
+TAO_OutStream *
+TAO_CodeGen::outstream (void)
+{
+ return this->curr_os_;
+}
+
+void
+TAO_CodeGen::node (be_decl *n)
+{
+ this->node_ = n;
+}
+
+be_decl *
+TAO_CodeGen::node (void)
+{
+ return this->node_;
+}
+
+void
+TAO_CodeGen::config_visitor_factory (void)
+{
+ this->visitor_factory_ = TAO_VISITOR_FACTORY::instance ();
+}
+
+void
+TAO_CodeGen::gen_ident_string (TAO_OutStream *stream) const
+{
+ const char *str = idl_global->ident_string ();
+
+ if (str != 0)
+ {
+ *stream << "#" << str << be_nl << be_nl;
+ }
+}
+
+void
+TAO_CodeGen::gen_ifndef_string (const char *fname,
+ TAO_OutStream *stream,
+ const char *prefix,
+ const char *suffix)
+{
+ char macro_name [NAMEBUFSIZE] = { 0 };
+
+ const char *extension = ACE_OS::strrchr (fname, '.');
+
+ if (extension == 0)
+ {
+ // File seems to have no extension, so let us take the name
+ // as it is.
+ extension = fname;
+ }
+
+ ACE_OS::sprintf (macro_name, prefix);
+
+ size_t offset = ACE_OS::strlen (prefix);
+
+ // Convert letters in fname to upper case.
+ for (int i = 0; i < (extension - fname); i++)
+ {
+ if (isalpha (fname [i]))
+ {
+ macro_name[i + offset] = static_cast<char> (toupper (fname [i]));
+ }
+ else if (isdigit (fname [i]))
+ {
+ macro_name[i + offset] = fname[i];
+ }
+ else
+ {
+ macro_name[i + offset] = '_';
+ }
+ }
+
+ ACE_OS::strcat (macro_name, suffix);
+
+ // Generate the #ifndef ... #define statements.
+ stream->print ("#ifndef %s\n",
+ macro_name);
+ stream->print ("#define %s\n\n",
+ macro_name);
+}
+
+void
+TAO_CodeGen::gen_standard_include (TAO_OutStream *stream,
+ const char *included_file)
+{
+ // Switch between changing or non-changing standard include files
+ // include files, so that #include statements can be
+ // generated with ""s or <>s respectively, for the standard include
+ // files (e.g. tao/corba.h).
+
+ const char *start_delimiter = "\"";
+ const char *end_delimiter = "\"";
+
+ if (be_global->changing_standard_include_files () == 0)
+ {
+ start_delimiter = "<";
+ end_delimiter = ">";
+ }
+
+ *stream << "\n#include " << start_delimiter
+ << included_file
+ << end_delimiter;
+}
+
+void
+TAO_CodeGen::gen_stub_hdr_includes (void)
+{
+ // Include valuetype and Any/TypeCode headers before ORB core
+ // headers to make sure some things are parsed before some templates
+ // (e.g. TAO_Pseudo_{Var,Out}_T). Addresses issues with compilers
+ // that require all necessary non-dependent names be parsed prior to
+ // parsing templates that may use them (e.g. GNU g++ 3.4.x).
+
+ this->gen_cond_file_include (be_global->tc_support ()
+ && !be_global->gen_anyop_files (),
+ "tao/AnyTypeCode/AnyTypeCode_methods.h",
+ this->client_header_);
+
+ if (idl_global->abstract_iface_seen_)
+ {
+ // Include the AbstractBase file from the Valuetype library.
+ this->gen_standard_include (this->client_header_,
+ "tao/Valuetype/AbstractBase.h");
+
+ // Turn on generation of the rest of the Valuetype library includes.
+ idl_global->valuetype_seen_ = true;
+ }
+
+ if (idl_global->valuebase_seen_)
+ {
+ // Include files from the Valuetype library.
+ this->gen_standard_include (this->client_header_,
+ "tao/Valuetype/ValueBase.h");
+
+ // Valuebox needs CDR for _tao_marshal_v code in .inl file
+ this->gen_standard_include (this->client_header_,
+ "tao/CDR.h");
+ }
+
+ if (idl_global->valuetype_seen_)
+ {
+ // Don't want to generate this twice.
+ if (!idl_global->valuebase_seen_)
+ {
+ this->gen_standard_include (this->client_header_,
+ "tao/Valuetype/ValueBase.h");
+ }
+
+ this->gen_standard_include (this->client_header_,
+ "tao/Valuetype/Valuetype_Adapter_Factory_Impl.h");
+
+ // Check for setting this bit performed in y.tab.cpp, actual checking
+ // code is in be_valuetype.cpp.
+ this->gen_cond_file_include (
+ idl_global->valuefactory_seen_,
+ "tao/Valuetype/ValueFactory.h",
+ this->client_header_
+ );
+ }
+
+ // @note This header should not go first. See the discussion above
+ // regarding non-dependent template names.
+ this->gen_cond_file_include (
+ be_global->gen_orb_h_include (),
+ "tao/ORB.h",
+ this->client_header_
+ );
+
+ this->gen_cond_file_include (
+ idl_global->operation_seen_ || idl_global->valuefactory_seen_
+ || idl_global->valuebase_seen_,
+ "tao/SystemException.h",
+ this->client_header_
+ );
+
+ // For IDL exception, we need full knowledge of CORBA::UserException.
+ this->gen_cond_file_include (
+ idl_global->exception_seen_,
+ "tao/UserException.h",
+ this->client_header_
+ );
+
+ this->gen_standard_include (this->client_header_,
+ "tao/Environment.h");
+
+ // Conditionally included.
+
+ // DDS/DCPS marshaling.
+ this->gen_cond_file_include (
+ be_global->gen_dcps_type_support (),
+ "dds/DCPS/Serializer.h",
+ this->client_header_
+ );
+
+ // Non-abstract interface or keyword 'Object'.
+ this->gen_cond_file_include (
+ idl_global->non_local_iface_seen_
+ | idl_global->local_iface_seen_
+ | idl_global->base_object_seen_,
+ "tao/Object.h",
+ this->client_header_
+ );
+
+ // This is true if we have a typecode or TCKind in the IDL file.
+ // If not included here, it will appear in *C.cpp, if TCs not suppressed.
+ this->gen_cond_file_include (
+ idl_global->typecode_seen_
+ | idl_global->any_seen_,
+ "tao/AnyTypeCode/TypeCode.h",
+ this->client_header_
+ );
+
+ this->gen_cond_file_include (
+ idl_global->any_seen_
+ | idl_global->typecode_seen_,
+ "tao/AnyTypeCode/TypeCode_Constants.h",
+ this->client_header_);
+
+ // This is true if we have an 'any' in the IDL file.
+ // If not included here, it will appear in *C.cpp, if Anys not suppressed.
+ this->gen_cond_file_include (
+ idl_global->any_seen_,
+ "tao/AnyTypeCode/Any.h",
+ this->client_header_
+ );
+
+ // Generated if (w)string member of struct/union/exception/array/valuetype
+ // has been seen.
+ this->gen_cond_file_include (idl_global->string_member_seen_,
+ "tao/String_Manager_T.h",
+ this->client_header_);
+
+ // Include the Messaging library entry point, if AMI is enabled.
+ if (be_global->ami_call_back () == true)
+ {
+ // Include Messaging skeleton file.
+ this->gen_standard_include (this->client_header_,
+ "tao/Messaging/Messaging.h");
+ }
+
+ // Include the smart proxy base class if smart proxies are enabled.
+ if (be_global->gen_smart_proxies () == true)
+ {
+ this->gen_standard_include (this->client_header_,
+ "tao/SmartProxies/Smart_Proxies.h");
+ }
+
+ // If we have not suppressed Any operator generation and also
+ // are not generating the operators in a separate file, we
+ // need to include the *A.h file from all .pidl files here.
+ if (be_global->any_support () && !be_global->gen_anyop_files ())
+ {
+ for (size_t j = 0; j < idl_global->n_included_idl_files (); ++j)
+ {
+ char* idl_name = idl_global->included_idl_files ()[j];
+
+ ACE_CString pidl_checker (idl_name);
+ bool got_pidl =
+ (pidl_checker.substr (pidl_checker.length () - 5) == ".pidl")
+ && (pidl_checker.find ("IFR_Client") == ACE_CString::npos);
+ // We can't use the -GA option on IFR_Client .pidl files,
+ // because there are decls inside interfaces.
+
+ // If we're here and we have a .pidl file, we need to generate
+ // the *A.h include from the AnyTypeCode library.
+ if (got_pidl)
+ {
+ // Make a String out of it.
+ UTL_String idl_name_str = idl_name;
+
+ const char *anyop_hdr =
+ BE_GlobalData::be_get_anyop_header (&idl_name_str, 1);
+
+ idl_name_str.destroy ();
+
+ // Stripped off any scope in the name and add the
+ // AnyTypeCode prefix.
+ ACE_CString work_hdr (anyop_hdr);
+ ACE_CString final_hdr = "tao/AnyTypeCode/";
+ ACE_CString::size_type pos = work_hdr.rfind ('/');
+
+ if (pos != ACE_SString::npos)
+ {
+ ACE_CString scope (work_hdr.substr (0, pos));
+
+ // If we find a '/' in the containing scope name, it
+ // means we are including a .pidl file from a
+ // subdirectory of $TAO_ROOT/tao, and so we should
+ // include the anyop_hdr string as is, and not strip
+ // off the scope name and prepend "tao/AnyTypeCode/".
+ // Only .pidl files in $TAO_ROOT/tao itself have
+ // their generated *A.* files moved to the AnyTypeCode
+ // library.
+ if (scope.find ('/') == ACE_SString::npos)
+ {
+ work_hdr = work_hdr.substr (pos + 1);
+ final_hdr += work_hdr;
+ }
+ else
+ {
+ final_hdr = work_hdr;
+ }
+ }
+
+ this->client_header_->print ("\n#include \"%s\"",
+ final_hdr.c_str ());
+ }
+ }
+ }
+
+
+ // Must have knowledge of the base class.
+ this->gen_seq_file_includes ();
+
+ // _vars and _outs are typedefs of template class instantiations.
+ this->gen_var_file_includes ();
+
+ // Versioned namespace support.
+ this->gen_standard_include (this->client_header_,
+ "tao/Versioned_Namespace.h");
+}
+
+void
+TAO_CodeGen::gen_stub_src_includes (void)
+{
+ // Generate the include statement for the precompiled header file.
+ if (be_global->pch_include ())
+ {
+ *this->client_stubs_ << "#include \""
+ << be_global->pch_include ()
+ << "\"";
+ }
+
+ if (be_global->safe_include ())
+ {
+ // Generate the safe include if it is defined instead of the client header
+ // need to put only the base names. Path info is not required.
+ *this->client_stubs_ << "\n#include \""
+ << be_global->safe_include ()
+ << "\"";
+ }
+ else
+ {
+ // Generate the include statement for the client header. We just
+ // need to put only the base names. Path info is not required.
+ *this->client_stubs_ << "\n#include \""
+ << be_global->be_get_client_hdr_fname (1)
+ << "\"";
+ }
+
+ if (be_global->tc_support ()
+ && !be_global->gen_anyop_files ())
+ {
+ this->gen_typecode_includes (this->client_stubs_);
+ }
+
+ // Always generated.
+ this->gen_standard_include (this->client_stubs_,
+ "tao/CDR.h");
+
+ // Conditional includes.
+
+ if (idl_global->non_local_op_seen_)
+ {
+ this->gen_standard_include (this->client_stubs_,
+ "tao/Exception_Data.h");
+ }
+
+ // Operations for local interfaces are pure virtual.
+ if (idl_global->non_local_op_seen_)
+ {
+ this->gen_standard_include (this->client_stubs_,
+ "tao/Invocation_Adapter.h");
+ }
+
+ // Any abstract interface present will probably have an operation.
+ if (idl_global->abstract_iface_seen_)
+ {
+ this->gen_standard_include (
+ this->client_stubs_,
+ "tao/Valuetype/AbstractBase_Invocation_Adapter.h"
+ );
+
+ this->gen_standard_include (
+ this->client_stubs_,
+ "tao/Valuetype/AbstractBase_T.h"
+ );
+ }
+
+ if (be_global->ami_call_back () == true)
+ {
+ this->gen_standard_include (this->client_stubs_,
+ "tao/Messaging/Asynch_Invocation_Adapter.h");
+
+ this->gen_standard_include (this->client_stubs_,
+ "tao/Messaging/ExceptionHolder_i.h");
+ }
+
+ // If valuefactory_seen_ was set, this was generated in the stub header file,
+ // otherwise it needs to go here - used in _tao_unmarshal().
+ if (idl_global->valuetype_seen_
+ && !idl_global->valuefactory_seen_)
+ {
+ this->gen_standard_include (this->client_stubs_,
+ "tao/Valuetype/ValueFactory.h");
+ }
+
+ if (idl_global->non_local_iface_seen_)
+ {
+ // Needed for _narrow(), which is now template-based.
+ this->gen_standard_include (this->client_stubs_,
+ "tao/Object_T.h");
+ }
+
+ if (idl_global->octet_seq_seen_)
+ {
+ // Needed for the TAO_NO_COPY_OCTET_SEQUENCES optimization. Note that
+ // it is preferable to just refer to CORBA::OctetSeq in the IDL file.
+ this->gen_standard_include (this->client_stubs_,
+ "tao/ORB_Core.h");
+ }
+
+ // The UserException::_tao_{en,de}code() methods can throw a
+ // CORBA::MARSHAL exception so make sure that system exception is
+ // fully declared/defined by including "tao/SystemException.h".
+ // However, only include "tao/SystemException.h" if a user exception
+ // was encountered and if we're not already including it in the stub
+ // header.
+ if (idl_global->exception_seen_
+ && !idl_global->operation_seen_)
+ {
+ this->gen_standard_include (this->client_stubs_,
+ "tao/SystemException.h");
+ }
+
+ // Includes whatever Any template classes that may be needed.
+ if (!be_global->gen_anyop_files ())
+ {
+ this->gen_any_file_includes (this->client_stubs_);
+ }
+
+ // Includes whatever arg helper template classes that may be needed.
+ this->gen_stub_arg_file_includes (this->client_stubs_);
+
+ // strlen() for DCPS marshaling or
+ // strcmp() is used with interfaces and exceptions.
+ if ((be_global->gen_dcps_type_support ()
+ && (idl_global->string_seen_
+ || idl_global->string_seq_seen_
+ || idl_global->wstring_seq_seen_) )
+ || idl_global->interface_seen_
+ || idl_global->exception_seen_
+ || idl_global->union_seen_)
+ {
+ // Needed for _narrow(), which is now template-based.
+ this->gen_standard_include (this->client_stubs_,
+ "ace/OS_NS_string.h");
+ }
+
+ if (be_global->gen_amh_classes () == true)
+ {
+ // Necessary for the AIX compiler.
+ this->gen_standard_include (this->client_stubs_,
+ "ace/Auto_Ptr.h");
+ }
+}
+
+void
+TAO_CodeGen::gen_skel_src_includes (void)
+{
+ // Only non-local interfaces generate anything in the skeleton.
+ if (!(idl_global->non_local_iface_seen_
+ || idl_global->need_skeleton_includes_))
+ {
+ return;
+ }
+
+ switch (be_global->lookup_strategy ())
+ {
+ case BE_GlobalData::TAO_DYNAMIC_HASH:
+ {
+ this->gen_standard_include (this->server_skeletons_,
+ "tao/PortableServer/Operation_Table_Dynamic_Hash.h");
+ }
+ break;
+ case BE_GlobalData::TAO_LINEAR_SEARCH:
+ {
+ this->gen_standard_include (this->server_skeletons_,
+ "tao/PortableServer/Operation_Table_Linear_Search.h");
+ }
+ break;
+ case BE_GlobalData::TAO_BINARY_SEARCH:
+ {
+ this->gen_standard_include (this->server_skeletons_,
+ "tao/PortableServer/Operation_Table_Binary_Search.h");
+ }
+ break;
+ case BE_GlobalData::TAO_PERFECT_HASH:
+ {
+ this->gen_standard_include (this->server_skeletons_,
+ "tao/PortableServer/Operation_Table_Perfect_Hash.h");
+ }
+ break;
+ }
+
+ if (be_global->gen_direct_collocation ())
+ {
+ this->gen_standard_include (
+ this->server_skeletons_,
+ "tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h"
+ );
+ }
+
+ this->gen_standard_include (this->server_skeletons_,
+ "tao/PortableServer/Upcall_Command.h");
+ this->gen_standard_include (this->server_skeletons_,
+ "tao/PortableServer/Upcall_Wrapper.h");
+
+ this->gen_standard_include (this->server_skeletons_,
+ "tao/TAO_Server_Request.h");
+ this->gen_standard_include (this->server_skeletons_,
+ "tao/ORB_Core.h");
+ this->gen_standard_include (this->server_skeletons_,
+ "tao/Profile.h");
+ this->gen_standard_include (this->server_skeletons_,
+ "tao/Stub.h");
+ this->gen_standard_include (this->server_skeletons_,
+ "tao/IFR_Client_Adapter.h");
+ this->gen_standard_include (this->server_skeletons_,
+ "tao/Object_T.h");
+ this->gen_standard_include (this->server_skeletons_,
+ "tao/AnyTypeCode/TypeCode.h");
+ this->gen_standard_include (this->server_skeletons_,
+ "tao/AnyTypeCode/DynamicC.h");
+ this->gen_standard_include (this->server_skeletons_,
+ "tao/CDR.h");
+ this->gen_standard_include (this->server_skeletons_,
+ "tao/operation_details.h");
+ this->gen_standard_include (this->server_skeletons_,
+ "tao/PortableInterceptor.h");
+
+ this->gen_skel_arg_file_includes (this->server_skeletons_);
+
+ if (be_global->gen_thru_poa_collocation ()
+ || be_global->gen_direct_collocation ())
+ {
+ // Collocation skeleton code doesn't use "SArg" variants.
+ this->gen_stub_arg_file_includes (this->server_skeletons_);
+ }
+
+ // The following header must always be included.
+ if (be_global->gen_amh_classes ())
+ {
+ this->gen_standard_include (this->server_skeletons_,
+ "tao/Thread_Lane_Resources.h");
+ this->gen_standard_include (this->server_skeletons_,
+ "tao/Buffer_Allocator_T.h");
+ this->gen_standard_include (this->server_skeletons_,
+ "ace/Auto_Functor.h");
+ }
+
+ this->gen_standard_include (this->server_skeletons_,
+ "ace/Dynamic_Service.h");
+
+ // For Static_Allocator_Base
+ this->gen_standard_include (this->server_skeletons_,
+ "ace/Malloc_Allocator.h");
+}
+
+void
+TAO_CodeGen::gen_seq_file_includes (void)
+{
+ // @@@ (JP) These can get more specialized, after the TAO seq template
+ // files have been split up.
+
+ this->gen_cond_file_include (
+ idl_global->vt_seq_seen_,
+ "tao/Valuetype/Sequence_T.h",
+ this->client_header_
+ );
+
+ this->gen_cond_file_include (
+ idl_global->seq_seen_,
+ "tao/Sequence_T.h",
+ this->client_header_
+ );
+}
+
+void
+TAO_CodeGen::gen_any_file_includes (TAO_OutStream * stream)
+{
+ if (be_global->any_support ())
+ {
+ this->gen_standard_include (stream,
+ "tao/CDR.h");
+
+ // Any_Impl_T.cpp needs the full CORBA::Any type.
+ this->gen_cond_file_include (
+ idl_global->interface_seen_
+ | idl_global->valuetype_seen_,
+ "tao/AnyTypeCode/Any.h",
+ stream
+ );
+
+ this->gen_cond_file_include (
+ idl_global->interface_seen_
+ | idl_global->valuetype_seen_,
+ "tao/AnyTypeCode/Any_Impl_T.h",
+ stream
+ );
+
+ this->gen_cond_file_include (
+ idl_global->aggregate_seen_
+ | idl_global->seq_seen_
+ | idl_global->exception_seen_,
+ "tao/AnyTypeCode/Any_Dual_Impl_T.h",
+ stream
+ );
+
+ this->gen_cond_file_include (
+ idl_global->array_seen_,
+ "tao/AnyTypeCode/Any_Array_Impl_T.h",
+ stream
+ );
+
+ this->gen_cond_file_include (
+ idl_global->enum_seen_,
+ "tao/AnyTypeCode/Any_Basic_Impl_T.h",
+ stream
+ );
+ }
+}
+
+void
+TAO_CodeGen::gen_var_file_includes (void)
+{
+ this->gen_cond_file_include (
+ idl_global->valuetype_seen_
+ | idl_global->fwd_valuetype_seen_,
+ "tao/Valuetype/Value_VarOut_T.h",
+ this->client_header_
+ );
+
+ this->gen_cond_file_include (
+ idl_global->interface_seen_
+ | idl_global->fwd_iface_seen_,
+ "tao/Objref_VarOut_T.h",
+ this->client_header_
+ );
+
+ this->gen_cond_file_include (
+ idl_global->seq_seen_,
+ "tao/Seq_Var_T.h",
+ this->client_header_
+ );
+
+ this->gen_cond_file_include (
+ idl_global->seq_seen_,
+ "tao/Seq_Out_T.h",
+ this->client_header_
+ );
+
+ this->gen_cond_file_include (
+ idl_global->aggregate_seen_,
+ "tao/VarOut_T.h",
+ this->client_header_
+ );
+
+ this->gen_cond_file_include (
+ idl_global->array_seen_,
+ "tao/Array_VarOut_T.h",
+ this->client_header_
+ );
+}
+
+void
+TAO_CodeGen::gen_stub_arg_file_includes (TAO_OutStream * stream)
+{
+ this->gen_cond_file_include (
+ idl_global->basic_arg_seen_,
+ "tao/Basic_Arguments.h",
+ stream
+ );
+
+ this->gen_cond_file_include (
+ idl_global->bd_string_arg_seen_,
+ "tao/BD_String_Argument_T.h",
+ stream
+ );
+
+ // If we have a bound string and we have any generation enabled we must
+ // include Any.h to get the <<= operator for BD_String
+ this->gen_cond_file_include (
+ idl_global->bd_string_arg_seen_ && be_global->any_support (),
+ "tao/AnyTypeCode/Any.h",
+ stream
+ );
+
+ this->gen_cond_file_include (
+ idl_global->fixed_array_arg_seen_,
+ "tao/Fixed_Array_Argument_T.h",
+ stream
+ );
+
+ this->gen_cond_file_include (
+ idl_global->fixed_size_arg_seen_,
+ "tao/Fixed_Size_Argument_T.h",
+ stream
+ );
+
+ this->gen_cond_file_include (
+ idl_global->object_arg_seen_,
+ "tao/Object_Argument_T.h",
+ stream
+ );
+
+ this->gen_cond_file_include (
+ idl_global->special_basic_arg_seen_,
+ "tao/Special_Basic_Arguments.h",
+ stream
+ );
+
+ this->gen_cond_file_include (
+ idl_global->ub_string_arg_seen_,
+ "tao/UB_String_Arguments.h",
+ stream
+ );
+
+ this->gen_cond_file_include (
+ idl_global->var_array_arg_seen_,
+ "tao/Var_Array_Argument_T.h",
+ stream
+ );
+
+ this->gen_cond_file_include (
+ idl_global->var_size_arg_seen_,
+ "tao/Var_Size_Argument_T.h",
+ stream
+ );
+
+ this->gen_cond_file_include (
+ idl_global->any_arg_seen_,
+ "tao/AnyTypeCode/Any_Arg_Traits.h",
+ stream
+ );
+}
+
+
+void
+TAO_CodeGen::gen_skel_arg_file_includes (TAO_OutStream * stream)
+{
+ this->gen_cond_file_include (
+ idl_global->basic_arg_seen_,
+ "tao/PortableServer/Basic_SArguments.h",
+ stream
+ );
+
+ this->gen_cond_file_include (
+ idl_global->bd_string_arg_seen_,
+ "tao/PortableServer/BD_String_SArgument_T.h",
+ stream
+ );
+
+ // If we have a bound string and we have any generation enabled we must
+ // include Any.h to get the <<= operator for BD_String
+ this->gen_cond_file_include (
+ idl_global->bd_string_arg_seen_ && be_global->any_support (),
+ "tao/AnyTypeCode/Any.h",
+ stream
+ );
+
+ this->gen_cond_file_include (
+ idl_global->fixed_array_arg_seen_,
+ "tao/PortableServer/Fixed_Array_SArgument_T.h",
+ stream
+ );
+
+ this->gen_cond_file_include (
+ idl_global->fixed_size_arg_seen_,
+ "tao/PortableServer/Fixed_Size_SArgument_T.h",
+ stream
+ );
+
+ // Always needed for CORBA::Object handling in _component() skeleton
+ // code when an unconstrained (non-local) IDL interface is defined.
+ this->gen_cond_file_include (
+ idl_global->non_local_iface_seen_
+ || idl_global->object_arg_seen_,
+ "tao/PortableServer/Object_SArgument_T.h",
+ stream
+ );
+
+ // Always needed for CORBA::Boolean handling in _is_a() skeleton
+ // code when an unconstrained (non-local) IDL interface is defined.
+ this->gen_cond_file_include (
+ idl_global->non_local_iface_seen_
+ || idl_global->special_basic_arg_seen_,
+ "tao/PortableServer/Special_Basic_SArguments.h",
+ stream
+ );
+
+ // Always needed for string argument handling in _is_a() skeleton
+ // code when an unconstrained (non-local) IDL interface is defined.
+ this->gen_cond_file_include (
+ idl_global->non_local_iface_seen_
+ || idl_global->ub_string_arg_seen_,
+ "tao/PortableServer/UB_String_SArguments.h",
+ stream
+ );
+
+ this->gen_cond_file_include (
+ idl_global->var_array_arg_seen_,
+ "tao/PortableServer/Var_Array_SArgument_T.h",
+ stream
+ );
+
+ this->gen_cond_file_include (
+ idl_global->var_size_arg_seen_,
+ "tao/PortableServer/Var_Size_SArgument_T.h",
+ stream
+ );
+
+ this->gen_cond_file_include (
+ idl_global->any_arg_seen_,
+ "tao/PortableServer/Any_SArg_Traits.h",
+ stream
+ );
+
+ this->gen_standard_include (stream,
+ "tao/PortableServer/TypeCode_SArg_Traits.h");
+ this->gen_standard_include (stream,
+ "tao/PortableServer/Object_SArg_Traits.h");
+
+ if (be_global->gen_thru_poa_collocation ())
+ {
+ // Thru-POA/skeleton argument selection function templates.
+ this->gen_cond_file_include (idl_global->non_local_iface_seen_,
+ "tao/PortableServer/get_arg.h",
+ stream);
+
+ // We need the stub side argument templates when thru-POA
+ // collocation is enabled for type resolution.
+ // this->gen_stub_arg_file_includes (stream);
+
+ // Always needed for CORBA::Boolean handling in _is_a() skeleton
+ // code when an unconstrained (non-local) IDL interface is defined.
+ this->gen_cond_file_include (idl_global->non_local_iface_seen_,
+ "tao/Special_Basic_Arguments.h",
+ stream);
+
+ // Always needed for string argument handling in _is_a() skeleton
+ // code when an unconstrained (non-local) IDL interface is defined.
+ this->gen_cond_file_include (idl_global->non_local_iface_seen_,
+ "tao/UB_String_Arguments.h",
+ stream);
+ }
+}
+
+void
+TAO_CodeGen::gen_cond_file_include (bool condition_green,
+ const char *filepath,
+ TAO_OutStream *stream)
+{
+ if (condition_green)
+ {
+ this->gen_standard_include (stream,
+ filepath);
+ }
+}
+
+void
+TAO_CodeGen::gen_typecode_includes (TAO_OutStream * stream)
+{
+ this->gen_standard_include (stream,
+ "tao/AnyTypeCode/Null_RefCount_Policy.h");
+
+ this->gen_standard_include (stream,
+ "tao/AnyTypeCode/TypeCode_Constants.h");
+
+ // Just assume we're going to need alias TypeCodes since there is
+ // currently no alias_seen_ or typedef_seen_ flag in idl_global.
+ this->gen_standard_include (stream,
+ "tao/AnyTypeCode/Alias_TypeCode_Static.h");
+
+ this->gen_cond_file_include (idl_global->enum_seen_,
+ "tao/AnyTypeCode/Enum_TypeCode_Static.h",
+ stream);
+
+ this->gen_cond_file_include (idl_global->interface_seen_,
+ "tao/AnyTypeCode/Objref_TypeCode_Static.h",
+ stream);
+
+ this->gen_cond_file_include (idl_global->seq_seen_
+ | idl_global->array_seen_,
+ "tao/AnyTypeCode/Sequence_TypeCode_Static.h",
+ stream);
+
+ this->gen_cond_file_include (idl_global->string_seen_,
+ "tao/AnyTypeCode/String_TypeCode_Static.h",
+ stream);
+
+ this->gen_cond_file_include (
+ idl_global->exception_seen_
+ | idl_global->aggregate_seen_,
+ "tao/AnyTypeCode/Struct_TypeCode_Static.h",
+ stream);
+
+ this->gen_cond_file_include (
+ idl_global->exception_seen_
+ | idl_global->aggregate_seen_,
+ "tao/AnyTypeCode/TypeCode_Struct_Field.h",
+ stream);
+
+ this->gen_cond_file_include (idl_global->union_seen_,
+ "tao/AnyTypeCode/TypeCode_Case_T.h",
+ stream);
+
+ this->gen_cond_file_include (idl_global->union_seen_,
+ "tao/AnyTypeCode/Union_TypeCode_Static.h",
+ stream);
+
+ this->gen_cond_file_include (idl_global->valuetype_seen_,
+ "tao/AnyTypeCode/Value_TypeCode_Static.h",
+ stream);
+
+ this->gen_cond_file_include (idl_global->valuetype_seen_,
+ "tao/AnyTypeCode/TypeCode_Value_Field.h",
+ stream);
+
+ this->gen_cond_file_include (idl_global->recursive_type_seen_,
+ "tao/AnyTypeCode/Recursive_Type_TypeCode.h",
+ stream);
+}
+
+void
+TAO_CodeGen::destroy (void)
+{
+ delete this->client_header_;
+ delete this->server_header_;
+ delete this->implementation_header_;
+ delete this->implementation_skeleton_;
+ delete this->server_template_header_;
+ delete this->client_stubs_;
+ delete this->server_skeletons_;
+ delete this->server_template_skeletons_;
+ delete this->client_inline_;
+ delete this->server_inline_;
+ delete this->server_template_inline_;
+ delete this->anyop_source_;
+ delete this->anyop_header_;
+#if !defined (linux) && !defined (__QNX__) && !defined (__GLIBC__)
+ // 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;
+}
diff --git a/TAO/TAO_IDL/be/be_component.cpp b/TAO/TAO_IDL/be/be_component.cpp
new file mode 100644
index 00000000000..a19d6a27eb1
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_component.cpp
@@ -0,0 +1,132 @@
+// $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"
+
+#include "global_extern.h"
+#include "utl_err.h"
+
+ACE_RCSID (be,
+ be_component,
+ "$Id$")
+
+be_component::be_component (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ UTL_Scope (),
+ AST_Interface (),
+ AST_Component (),
+ be_scope (),
+ be_type (),
+ be_interface ()
+{
+ this->size_type (AST_Type::VARIABLE);
+ this->has_constructor (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)
+ : COMMON_Base (false,
+ false),
+ AST_Decl (AST_Decl::NT_component,
+ n),
+ AST_Type (AST_Decl::NT_component,
+ n),
+ UTL_Scope (AST_Decl::NT_component),
+ AST_Interface (n,
+ supports,
+ n_supports,
+ supports_flat,
+ n_supports_flat,
+ false,
+ false),
+ AST_Component (n,
+ base_component,
+ supports,
+ n_supports,
+ supports_flat,
+ n_supports_flat),
+ be_scope (AST_Decl::NT_component),
+ be_type (AST_Decl::NT_component,
+ n),
+ be_interface (n,
+ supports,
+ n_supports,
+ supports_flat,
+ n_supports_flat,
+ false,
+ false)
+{
+ this->size_type (AST_Type::VARIABLE);
+ this->has_constructor (true);
+}
+
+be_component::~be_component (void)
+{
+}
+
+void
+be_component::redefine (AST_Interface *from)
+{
+ be_component *bc = be_component::narrow_from_decl (from);
+ this->var_out_seq_decls_gen_ = bc->var_out_seq_decls_gen_;
+ AST_Component::redefine (from);
+}
+
+void
+be_component::destroy ()
+{
+ this->be_interface::destroy ();
+ this->AST_Component::destroy ();
+}
+
+int
+be_component::accept (be_visitor *visitor)
+{
+ if (idl_global->ignore_idl3 ())
+ {
+ idl_global->err ()->ignore_idl3_error (this);
+ return -1;
+ }
+
+ return visitor->visit_component (this);
+}
+
+AST_Structure *
+be_component::be_add_structure (AST_Structure *t)
+{
+ return this->fe_add_structure (t);
+}
+
+AST_Typedef *
+be_component::be_add_typedef (AST_Typedef *t)
+{
+ return this->fe_add_typedef (t);
+}
+
+// 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..17996631869
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_component_fwd.cpp
@@ -0,0 +1,84 @@
+// $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"
+#include "global_extern.h"
+#include "utl_err.h"
+
+ACE_RCSID (be,
+ be_component_fwd,
+ "$Id$")
+
+be_component_fwd::be_component_fwd (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_InterfaceFwd (),
+ AST_ComponentFwd (),
+ be_type (),
+ be_interface_fwd ()
+{
+ this->size_type (AST_Type::VARIABLE);
+}
+
+be_component_fwd::be_component_fwd (AST_Interface *dummy,
+ UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_component_fwd,
+ n),
+ AST_Type (AST_Decl::NT_component_fwd,
+ n),
+ AST_InterfaceFwd (dummy,
+ n),
+ AST_ComponentFwd (dummy,
+ n),
+ be_type (AST_Decl::NT_component_fwd,
+ n),
+ be_interface_fwd (dummy,
+ 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)
+{
+ if (idl_global->ignore_idl3 ())
+ {
+ idl_global->err ()->ignore_idl3_error (this);
+ return -1;
+ }
+
+ 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
new file mode 100644
index 00000000000..be495979757
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_constant.cpp
@@ -0,0 +1,68 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_constant.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Constant that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_constant.h"
+#include "be_visitor.h"
+#include "utl_scope.h"
+#include "nr_extern.h"
+
+ACE_RCSID (be,
+ be_constant,
+ "$Id$")
+
+be_constant::be_constant (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Constant (),
+ be_decl ()
+{
+}
+
+be_constant::be_constant (AST_Expression::ExprType et,
+ AST_Expression *v,
+ UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_const,
+ n),
+ AST_Constant (et,
+ v,
+ n),
+ be_decl (AST_Decl::NT_const,
+ n)
+{
+}
+
+int
+be_constant::accept (be_visitor *visitor)
+{
+ return visitor->visit_constant (this);
+}
+
+void
+be_constant::destroy (void)
+{
+ this->be_decl::destroy ();
+ this->AST_Constant::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
new file mode 100644
index 00000000000..81b23b7d59c
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_decl.cpp
@@ -0,0 +1,967 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_decl.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Decl that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_decl.h"
+#include "be_scope.h"
+#include "be_interface.h"
+#include "be_interface_fwd.h"
+#include "be_valuetype.h"
+#include "be_component.h"
+#include "be_eventtype.h"
+#include "be_home.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 "ast_structure_fwd.h"
+#include "ast_string.h"
+#include "utl_identifier.h"
+#include "global_extern.h"
+#include "ace/Log_Msg.h"
+#include "ace/String_Base.h"
+
+ACE_RCSID (be,
+ be_decl,
+ "$Id$")
+
+// Default Constructor
+be_decl::be_decl (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ cli_hdr_gen_ (false),
+ cli_stub_gen_ (false),
+ cli_inline_gen_ (false),
+ srv_hdr_gen_ (false),
+ impl_hdr_gen_ (false),
+ srv_skel_gen_ (false),
+ impl_skel_gen_ (false),
+ srv_inline_gen_ (false),
+ cli_hdr_any_op_gen_ (false),
+ cli_stub_any_op_gen_ (false),
+ cli_hdr_cdr_op_gen_ (false),
+ cli_stub_cdr_op_gen_ (false),
+ cli_inline_cdr_op_gen_ (false),
+ cli_inline_cdr_decl_gen_ (false),
+ cli_hdr_serializer_op_gen_ (false),
+ cli_stub_serializer_op_gen_ (false),
+ cli_inline_serializer_op_gen_ (false),
+ cli_inline_serializer_decl_gen_ (false),
+ cli_traits_gen_ (false),
+ cli_arg_traits_gen_ (false),
+ srv_arg_traits_gen_ (false),
+ srv_sarg_traits_gen_ (false),
+ cli_pragma_inst_gen_ (false),
+ cli_inarg_tmpl_class_gen_ (false),
+ cli_inarg_pragma_inst_gen_ (false),
+ cli_inoutarg_tmpl_class_gen_ (false),
+ cli_inoutarg_pragma_inst_gen_ (false),
+ cli_outarg_tmpl_class_gen_ (false),
+ cli_outarg_pragma_inst_gen_ (false),
+ cli_retarg_tmpl_class_gen_ (false),
+ cli_retarg_pragma_inst_gen_ (false),
+ srv_tmpl_class_gen_ (false),
+ srv_pragma_inst_gen_ (false),
+ srv_inarg_tmpl_class_gen_ (false),
+ srv_inarg_pragma_inst_gen_ (false),
+ srv_inoutarg_tmpl_class_gen_ (false),
+ srv_inoutarg_pragma_inst_gen_ (false),
+ srv_outarg_tmpl_class_gen_ (false),
+ srv_outarg_pragma_inst_gen_ (false),
+ srv_retarg_tmpl_class_gen_ (false),
+ srv_retarg_pragma_inst_gen_ (false),
+ ccm_pre_proc_gen_ (false)
+{
+}
+
+// Constructor
+be_decl::be_decl (AST_Decl::NodeType type,
+ UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (type,
+ n),
+ cli_hdr_gen_ (false),
+ cli_stub_gen_ (false),
+ cli_inline_gen_ (false),
+ srv_hdr_gen_ (false),
+ impl_hdr_gen_ (false),
+ srv_skel_gen_ (false),
+ impl_skel_gen_ (false),
+ srv_inline_gen_ (false),
+ cli_hdr_any_op_gen_ (false),
+ cli_stub_any_op_gen_ (false),
+ cli_hdr_cdr_op_gen_ (false),
+ cli_stub_cdr_op_gen_ (false),
+ cli_inline_cdr_op_gen_ (false),
+ cli_inline_cdr_decl_gen_ (false),
+ cli_hdr_serializer_op_gen_ (false),
+ cli_stub_serializer_op_gen_ (false),
+ cli_inline_serializer_op_gen_ (false),
+ cli_inline_serializer_decl_gen_ (false),
+ cli_traits_gen_ (false),
+ cli_arg_traits_gen_ (false),
+ srv_arg_traits_gen_ (false),
+ srv_sarg_traits_gen_ (false),
+ cli_pragma_inst_gen_ (false),
+ cli_inarg_tmpl_class_gen_ (false),
+ cli_inarg_pragma_inst_gen_ (false),
+ cli_inoutarg_tmpl_class_gen_ (false),
+ cli_inoutarg_pragma_inst_gen_ (false),
+ cli_outarg_tmpl_class_gen_ (false),
+ cli_outarg_pragma_inst_gen_ (false),
+ cli_retarg_tmpl_class_gen_ (false),
+ cli_retarg_pragma_inst_gen_ (false),
+ srv_tmpl_class_gen_ (false),
+ srv_pragma_inst_gen_ (false),
+ srv_inarg_tmpl_class_gen_ (false),
+ srv_inarg_pragma_inst_gen_ (false),
+ srv_inoutarg_tmpl_class_gen_ (false),
+ srv_inoutarg_pragma_inst_gen_ (false),
+ srv_outarg_tmpl_class_gen_ (false),
+ srv_outarg_pragma_inst_gen_ (false),
+ srv_retarg_tmpl_class_gen_ (false),
+ srv_retarg_pragma_inst_gen_ (false),
+ ccm_pre_proc_gen_ (false)
+{
+}
+
+// Destructor
+be_decl::~be_decl (void)
+{
+}
+
+void
+be_decl::compute_full_name (const char *prefix,
+ const char *suffix,
+ char *&name)
+{
+ if (prefix == 0 || suffix == 0)
+ {
+ return;
+ }
+
+ ACE_CString prefix_str (prefix);
+ ACE_CString suffix_str (suffix);
+ ACE_CString result_str;
+
+ // Get parent.
+ if (this->defined_in () == 0)
+ {
+ // Global scope.
+
+ // Prefix.
+ result_str = prefix_str;
+
+ // Local name.
+ result_str += ACE_CString (this->local_name ()->get_string ());
+
+ // Suffix.
+ result_str += suffix_str;
+ }
+ else
+ {
+ // Get scope name.
+ be_decl *parent =
+ be_scope::narrow_from_scope (this->defined_in ())->decl ();
+
+ if (parent == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) be_decl::"
+ "compute_full_name - "
+ "scope name is nil\n"));
+ }
+
+ // Parent name.
+ result_str = ACE_CString (parent->full_name ());
+
+ // _
+ if (ACE_OS::strcmp (parent->full_name (), "") != 0)
+ {
+ result_str += ACE_CString ("::");
+ }
+
+ // Prefix.
+ result_str += prefix_str;
+
+ // Local name.
+ result_str += ACE_CString (this->local_name ()->get_string ());
+
+ // Suffix.
+ result_str += suffix_str;
+ }
+
+ name = ACE_OS::strdup (result_str.fast_rep ());
+}
+
+void
+be_decl::compute_flat_name (const char *prefix,
+ const char *suffix,
+ char *&name)
+{
+ if (prefix == 0 || suffix == 0)
+ {
+ return;
+ }
+
+ ACE_CString prefix_str (prefix);
+ ACE_CString suffix_str (suffix);
+
+ ACE_CString result_str;
+
+ // Get parent.
+ if (this->defined_in () == 0)
+ {
+ // Global scope.
+
+ // Prefix.
+ result_str = prefix_str;
+
+ // Local name.
+ result_str += ACE_CString (this->local_name ()->get_string ());
+
+ // Suffix.
+ result_str += suffix_str;
+ }
+ else
+ {
+ // Get scope name.
+ be_decl *parent =
+ be_scope::narrow_from_scope (this->defined_in ())->decl ();
+ if (parent == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) be_decl::"
+ "compute_flat_name - "
+ "scope name is nil\n"));
+ }
+
+ // Parent name.
+ result_str = ACE_CString (parent->flat_name ());
+
+ // _
+ if (ACE_OS::strcmp (parent->flat_name (), "") != 0)
+ result_str += "_";
+
+ // Prefix.
+ result_str += prefix_str;
+
+ // Local name.
+ result_str += ACE_CString (this->local_name ()->get_string ());
+
+ // Suffix.
+ result_str += suffix_str;
+ }
+
+ name = ACE_OS::strdup (result_str.c_str ());
+}
+
+void
+be_decl::destroy (void)
+{
+}
+
+void
+be_decl::set_local (bool val)
+{
+ this->is_local_ = val;
+}
+
+// Return the scope created by this node (if one exists, else NULL).
+be_scope *
+be_decl::scope (void)
+{
+ be_decl *d = this;
+
+ switch (this->node_type ())
+ {
+ case AST_Decl::NT_interface_fwd:
+ // Resolve forward declared interface by looking at full_definition()
+ // field and iterating.
+ d =
+ be_interface::narrow_from_decl (
+ (be_interface_fwd::narrow_from_decl (this))->full_definition ()
+ );
+ // Fall through
+ case AST_Decl::NT_interface:
+ return be_interface::narrow_from_decl (d);
+ case AST_Decl::NT_module:
+ return be_module::narrow_from_decl (d);
+ case AST_Decl::NT_root:
+ return be_root::narrow_from_decl (d);
+ case AST_Decl::NT_except:
+ return be_exception::narrow_from_decl (d);
+ case AST_Decl::NT_union:
+ return be_union::narrow_from_decl (d);
+ case AST_Decl::NT_struct:
+ return be_structure::narrow_from_decl (d);
+ case AST_Decl::NT_enum:
+ return be_enum::narrow_from_decl (d);
+ case AST_Decl::NT_op:
+ return be_operation::narrow_from_decl (d);
+ case AST_Decl::NT_factory:
+ return be_factory::narrow_from_decl (d);
+ case AST_Decl::NT_sequence:
+ return be_sequence::narrow_from_decl (d);
+ case AST_Decl::NT_valuetype:
+ return be_valuetype::narrow_from_decl (d);
+ case AST_Decl::NT_component:
+ return be_component::narrow_from_decl (d);
+ case AST_Decl::NT_eventtype:
+ return be_eventtype::narrow_from_decl (d);
+ case AST_Decl::NT_home:
+ return be_home::narrow_from_decl (d);
+ default:
+ return (be_scope *)0;
+ }
+}
+
+// Boolean methods to test if code was already generated.
+bool
+be_decl::cli_hdr_gen (void)
+{
+ return this->cli_hdr_gen_;
+}
+
+bool
+be_decl::cli_stub_gen (void)
+{
+ return this->cli_stub_gen_;
+}
+
+bool
+be_decl::cli_hdr_any_op_gen (void)
+{
+ return this->cli_hdr_any_op_gen_;
+}
+
+bool
+be_decl::cli_stub_any_op_gen (void)
+{
+ return this->cli_stub_any_op_gen_;
+}
+
+bool
+be_decl::cli_hdr_cdr_op_gen (void)
+{
+ return this->cli_hdr_cdr_op_gen_;
+}
+
+bool
+be_decl::cli_stub_cdr_op_gen (void)
+{
+ return this->cli_stub_cdr_op_gen_;
+}
+
+bool
+be_decl::cli_inline_cdr_op_gen (void)
+{
+ return this->cli_inline_cdr_op_gen_;
+}
+
+bool
+be_decl::cli_inline_cdr_decl_gen (void)
+{
+ return this->cli_inline_cdr_decl_gen_;
+}
+
+bool
+be_decl::cli_hdr_serializer_op_gen (void)
+{
+ return this->cli_hdr_serializer_op_gen_;
+}
+
+bool
+be_decl::cli_stub_serializer_op_gen (void)
+{
+ return this->cli_stub_serializer_op_gen_;
+}
+
+bool
+be_decl::cli_inline_serializer_op_gen (void)
+{
+ return this->cli_inline_serializer_op_gen_;
+}
+
+bool
+be_decl::cli_inline_serializer_decl_gen (void)
+{
+ return this->cli_inline_cdr_decl_gen_;
+}
+
+bool
+be_decl::cli_traits_gen (void)
+{
+ return this->cli_traits_gen_;
+}
+
+bool
+be_decl::cli_arg_traits_gen (void)
+{
+ return this->cli_arg_traits_gen_;
+}
+
+bool
+be_decl::srv_arg_traits_gen (void)
+{
+ return this->srv_arg_traits_gen_;
+}
+
+bool
+be_decl::srv_sarg_traits_gen (void)
+{
+ return this->srv_sarg_traits_gen_;
+}
+
+bool
+be_decl::cli_pragma_inst_gen (void)
+{
+ return this->cli_pragma_inst_gen_;
+}
+
+bool
+be_decl::cli_inarg_tmpl_class_gen (void)
+{
+ return this->cli_inarg_tmpl_class_gen_;
+}
+
+bool
+be_decl::cli_inarg_pragma_inst_gen (void)
+{
+ return this->cli_inarg_pragma_inst_gen_;
+}
+
+bool
+be_decl::cli_inoutarg_tmpl_class_gen (void)
+{
+ return this->cli_inoutarg_tmpl_class_gen_;
+}
+
+bool
+be_decl::cli_inoutarg_pragma_inst_gen (void)
+{
+ return this->cli_inoutarg_pragma_inst_gen_;
+}
+
+bool
+be_decl::cli_outarg_tmpl_class_gen (void)
+{
+ return this->cli_outarg_tmpl_class_gen_;
+}
+
+bool
+be_decl::cli_outarg_pragma_inst_gen (void)
+{
+ return this->cli_outarg_pragma_inst_gen_;
+}
+
+bool
+be_decl::cli_retarg_tmpl_class_gen (void)
+{
+ return this->cli_retarg_tmpl_class_gen_;
+}
+
+bool
+be_decl::cli_retarg_pragma_inst_gen (void)
+{
+ return this->cli_retarg_pragma_inst_gen_;
+}
+
+bool
+be_decl::srv_tmpl_class_gen (void)
+{
+ return this->srv_tmpl_class_gen_;
+}
+
+bool
+be_decl::srv_pragma_inst_gen (void)
+{
+ return this->srv_pragma_inst_gen_;
+}
+
+bool
+be_decl::srv_inarg_tmpl_class_gen (void)
+{
+ return this->srv_inarg_tmpl_class_gen_;
+}
+
+bool
+be_decl::srv_inarg_pragma_inst_gen (void)
+{
+ return this->srv_inarg_pragma_inst_gen_;
+}
+
+bool
+be_decl::srv_inoutarg_tmpl_class_gen (void)
+{
+ return this->srv_inoutarg_tmpl_class_gen_;
+}
+
+bool
+be_decl::srv_inoutarg_pragma_inst_gen (void)
+{
+ return this->srv_inoutarg_pragma_inst_gen_;
+}
+
+bool
+be_decl::srv_outarg_tmpl_class_gen (void)
+{
+ return this->srv_outarg_tmpl_class_gen_;
+}
+
+bool
+be_decl::srv_outarg_pragma_inst_gen (void)
+{
+ return this->srv_outarg_pragma_inst_gen_;
+}
+
+bool
+be_decl::srv_retarg_tmpl_class_gen (void)
+{
+ return this->srv_retarg_tmpl_class_gen_;
+}
+
+bool
+be_decl::srv_retarg_pragma_inst_gen (void)
+{
+ return this->cli_retarg_pragma_inst_gen_;
+}
+
+bool
+be_decl::cli_inline_gen (void)
+{
+ return this->cli_inline_gen_;
+}
+
+bool
+be_decl::srv_hdr_gen (void)
+{
+ return this->srv_hdr_gen_;
+}
+
+bool
+be_decl::impl_hdr_gen (void)
+{
+ return this->impl_hdr_gen_;
+}
+
+bool
+be_decl::srv_skel_gen (void)
+{
+ return this->srv_skel_gen_;
+}
+
+bool
+be_decl::impl_skel_gen (void)
+{
+ return this->impl_skel_gen_;
+}
+
+bool
+be_decl::srv_inline_gen (void)
+{
+ return this->srv_inline_gen_;
+}
+
+bool
+be_decl::ccm_pre_proc_gen (void)
+{
+ return this->ccm_pre_proc_gen_;
+}
+
+// Set the flag indicating that code generation is done.
+void
+be_decl::cli_hdr_gen (bool val)
+{
+ this->cli_hdr_gen_ = val;
+}
+
+void
+be_decl::cli_stub_gen (bool val)
+{
+ this->cli_stub_gen_ = val;
+}
+
+void
+be_decl::cli_hdr_any_op_gen (bool val)
+{
+ this->cli_hdr_any_op_gen_ = val;
+}
+
+void
+be_decl::cli_stub_any_op_gen (bool val)
+{
+ this->cli_stub_any_op_gen_ = val;
+}
+
+void
+be_decl::cli_hdr_cdr_op_gen (bool val)
+{
+ this->cli_hdr_cdr_op_gen_ = val;
+}
+
+void
+be_decl::cli_stub_cdr_op_gen (bool val)
+{
+ this->cli_stub_cdr_op_gen_ = val;
+}
+
+void
+be_decl::cli_inline_cdr_op_gen (bool val)
+{
+ this->cli_inline_cdr_op_gen_ = val;
+}
+
+void
+be_decl::cli_inline_cdr_decl_gen (bool val)
+{
+ this->cli_inline_cdr_decl_gen_ = val;
+}
+
+void
+be_decl::cli_hdr_serializer_op_gen (bool val)
+{
+ this->cli_hdr_serializer_op_gen_ = val;
+}
+
+void
+be_decl::cli_stub_serializer_op_gen (bool val)
+{
+ this->cli_stub_serializer_op_gen_ = val;
+}
+
+void
+be_decl::cli_inline_serializer_op_gen (bool val)
+{
+ this->cli_inline_serializer_op_gen_ = val;
+}
+
+void
+be_decl::cli_inline_serializer_decl_gen (bool val)
+{
+ this->cli_inline_serializer_decl_gen_ = val;
+}
+
+void
+be_decl::cli_inline_gen (bool val)
+{
+ this->cli_inline_gen_ = val;
+}
+
+void
+be_decl::cli_traits_gen (bool val)
+{
+ this->cli_traits_gen_ = val;
+}
+
+void
+be_decl::cli_arg_traits_gen (bool val)
+{
+ this->cli_arg_traits_gen_ = val;
+}
+
+void
+be_decl::srv_arg_traits_gen (bool val)
+{
+ this->srv_arg_traits_gen_ = val;
+}
+
+void
+be_decl::srv_sarg_traits_gen (bool val)
+{
+ this->srv_sarg_traits_gen_ = val;
+}
+
+void
+be_decl::cli_pragma_inst_gen (bool val)
+{
+ this->cli_pragma_inst_gen_ = val;
+}
+
+void
+be_decl::cli_inarg_tmpl_class_gen (bool val)
+{
+ this->cli_inarg_tmpl_class_gen_ = val;
+}
+
+void
+be_decl::cli_inarg_pragma_inst_gen (bool val)
+{
+ this->cli_inarg_pragma_inst_gen_ = val;
+}
+
+void
+be_decl::cli_inoutarg_tmpl_class_gen (bool val)
+{
+ this->cli_inoutarg_tmpl_class_gen_ = val;
+}
+
+void
+be_decl::cli_inoutarg_pragma_inst_gen (bool val)
+{
+ this->cli_inoutarg_pragma_inst_gen_ = val;
+}
+
+void
+be_decl::cli_outarg_tmpl_class_gen (bool val)
+{
+ this->cli_outarg_tmpl_class_gen_ = val;
+}
+
+void
+be_decl::cli_outarg_pragma_inst_gen (bool val)
+{
+ this->cli_outarg_pragma_inst_gen_ = val;
+}
+
+void
+be_decl::cli_retarg_tmpl_class_gen (bool val)
+{
+ this->cli_retarg_tmpl_class_gen_ = val;
+}
+
+void
+be_decl::cli_retarg_pragma_inst_gen (bool val)
+{
+ this->cli_retarg_pragma_inst_gen_ = val;
+}
+
+void
+be_decl::srv_tmpl_class_gen (bool val)
+{
+ this->srv_tmpl_class_gen_ = val;
+}
+
+void
+be_decl::srv_pragma_inst_gen (bool val)
+{
+ this->srv_pragma_inst_gen_ = val;
+}
+
+void
+be_decl::srv_inarg_tmpl_class_gen (bool val)
+{
+ this->srv_inarg_tmpl_class_gen_ = val;
+}
+
+void
+be_decl::srv_inarg_pragma_inst_gen (bool val)
+{
+ this->srv_inarg_pragma_inst_gen_ = val;
+}
+
+void
+be_decl::srv_inoutarg_tmpl_class_gen (bool val)
+{
+ this->srv_inoutarg_tmpl_class_gen_ = val;
+}
+
+void
+be_decl::srv_inoutarg_pragma_inst_gen (bool val)
+{
+ this->srv_inoutarg_pragma_inst_gen_ = val;
+}
+
+void
+be_decl::srv_outarg_tmpl_class_gen (bool val)
+{
+ this->srv_outarg_tmpl_class_gen_ = val;
+}
+
+void
+be_decl::srv_outarg_pragma_inst_gen (bool val)
+{
+ this->srv_outarg_pragma_inst_gen_ = val;
+}
+
+void
+be_decl::srv_retarg_tmpl_class_gen (bool val)
+{
+ this->srv_retarg_tmpl_class_gen_ = val;
+}
+
+void
+be_decl::srv_retarg_pragma_inst_gen (bool val)
+{
+ this->srv_retarg_pragma_inst_gen_ = val;
+}
+
+void
+be_decl::srv_hdr_gen (bool val)
+{
+ this->srv_hdr_gen_ = val;
+}
+
+void
+be_decl::impl_hdr_gen (bool val)
+{
+ this->impl_hdr_gen_ = val;
+}
+
+
+void
+be_decl::srv_skel_gen (bool val)
+{
+ this->srv_skel_gen_ = val;
+}
+
+void
+be_decl::srv_inline_gen (bool val)
+{
+ this->srv_inline_gen_ = val;
+}
+
+void
+be_decl::ccm_pre_proc_gen (bool val)
+{
+ this->ccm_pre_proc_gen_ = val;
+}
+
+//==========================================
+
+int
+be_decl::accept (be_visitor *visitor)
+{
+ return visitor->visit_decl (this);
+}
+
+void
+be_decl::set_arg_seen_bit (be_type *bt)
+{
+ if (bt == 0)
+ {
+ return;
+ }
+
+ switch (bt->node_type ())
+ {
+ case NT_typedef:
+ {
+ AST_Typedef *td = AST_Typedef::narrow_from_decl (bt);
+ this->set_arg_seen_bit (
+ be_type::narrow_from_decl (td->primitive_base_type ())
+ );
+ break;
+ }
+ case NT_interface:
+ case NT_interface_fwd:
+ case NT_valuetype:
+ case NT_valuetype_fwd:
+ case NT_component:
+ case NT_component_fwd:
+ case NT_home:
+ case NT_eventtype:
+ case NT_eventtype_fwd:
+ idl_global->object_arg_seen_ = true;
+ break;
+ case NT_union:
+ case NT_struct:
+ if (bt->size_type () == AST_Type::FIXED)
+ {
+ idl_global->fixed_size_arg_seen_ = true;
+ }
+ else
+ {
+ idl_global->var_size_arg_seen_ = true;
+ }
+
+ break;
+ case NT_struct_fwd:
+ case NT_union_fwd:
+ {
+ AST_StructureFwd *fwd = AST_StructureFwd::narrow_from_decl (bt);
+ be_type *fd = be_type::narrow_from_decl (fwd->full_definition ());
+ this->set_arg_seen_bit (fd);
+ break;
+ }
+ case NT_enum:
+ case NT_enum_val:
+ idl_global->basic_arg_seen_ = true;
+ break;
+ case NT_string:
+ case NT_wstring:
+ {
+ AST_String *str = AST_String::narrow_from_decl (bt);
+
+ if (str->max_size ()->ev ()->u.ulval == 0)
+ {
+ idl_global->ub_string_arg_seen_ = true;
+ }
+ else
+ {
+ idl_global->bd_string_arg_seen_ = true;
+ }
+
+ break;
+ }
+ case NT_array:
+ if (bt->size_type () == AST_Type::FIXED)
+ {
+ idl_global->fixed_array_arg_seen_ = true;
+ }
+ else
+ {
+ idl_global->var_array_arg_seen_ = true;
+ }
+
+ break;
+ case NT_sequence:
+ idl_global->var_size_arg_seen_ = true;
+ break;
+ case NT_pre_defined:
+ {
+ AST_PredefinedType *pdt = AST_PredefinedType::narrow_from_decl (bt);
+
+ switch (pdt->pt ())
+ {
+ case AST_PredefinedType::PT_object:
+ case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_value:
+ idl_global->object_arg_seen_ = true;
+ break;
+ case AST_PredefinedType::PT_any:
+ idl_global->var_size_arg_seen_ = true;
+ idl_global->any_arg_seen_ = true;
+ break;
+ case AST_PredefinedType::PT_char:
+ case AST_PredefinedType::PT_wchar:
+ case AST_PredefinedType::PT_octet:
+ case AST_PredefinedType::PT_boolean:
+ idl_global->special_basic_arg_seen_ = true;
+ break;
+ default:
+ idl_global->basic_arg_seen_ = true;
+ break;
+ }
+ }
+ default:
+ break;
+ }
+}
+
+// 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
new file mode 100644
index 00000000000..4b5ccad4b10
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_enum.cpp
@@ -0,0 +1,92 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_enum.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Enum that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_enum.h"
+#include "be_visitor.h"
+
+#include "global_extern.h"
+
+ACE_RCSID (be,
+ be_enum,
+ "$Id$")
+
+be_enum::be_enum (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType (),
+ UTL_Scope (),
+ AST_Enum (),
+ be_scope (),
+ be_decl (),
+ be_type ()
+{
+}
+
+be_enum::be_enum (UTL_ScopedName *n,
+ bool local,
+ bool abstract)
+ : COMMON_Base (local,
+ abstract),
+ AST_Decl (AST_Decl::NT_enum,
+ n),
+ AST_Type (AST_Decl::NT_enum,
+ n),
+ AST_ConcreteType (AST_Decl::NT_enum,
+ n),
+ UTL_Scope (AST_Decl::NT_enum),
+ AST_Enum (n,
+ local,
+ abstract),
+ be_scope (AST_Decl::NT_enum),
+ be_decl (AST_Decl::NT_enum,
+ n),
+ be_type (AST_Decl::NT_enum,
+ n)
+{
+ if (!this->imported ())
+ {
+ idl_global->enum_seen_ = true;
+ }
+}
+
+void
+be_enum::destroy (void)
+{
+ // Call the destroy methods of our base classes.
+ // No need to call be_scope::destroy(). It has no
+ // allocated members, and AST_Enum::destroy() will
+ // call UTL_Scope::destroy().
+ this->be_type::destroy ();
+ this->be_scope::destroy ();
+ this->AST_Enum::destroy ();
+}
+
+int
+be_enum::accept (be_visitor *visitor)
+{
+ return visitor->visit_enum (this);
+}
+
+// Narrowing
+IMPL_NARROW_METHODS3 (be_enum, AST_Enum, be_scope, be_type)
+IMPL_NARROW_FROM_DECL (be_enum)
+IMPL_NARROW_FROM_SCOPE (be_enum)
diff --git a/TAO/TAO_IDL/be/be_enum_val.cpp b/TAO/TAO_IDL/be/be_enum_val.cpp
new file mode 100644
index 00000000000..32623c25452
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_enum_val.cpp
@@ -0,0 +1,69 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_enum_val.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_EnumVal that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_enum_val.h"
+#include "be_visitor.h"
+
+ACE_RCSID (be,
+ be_enum_val,
+ "$Id$")
+
+be_enum_val::be_enum_val (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Constant (),
+ AST_EnumVal (),
+ be_decl ()
+{
+}
+
+be_enum_val::be_enum_val (unsigned long v,
+ UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_enum_val,
+ n),
+ AST_Constant (AST_Expression::EV_ulong,
+ AST_Decl::NT_enum_val,
+ new AST_Expression (v),
+ n),
+ AST_EnumVal (v,
+ n),
+ be_decl (AST_Decl::NT_enum_val,
+ n)
+{
+}
+
+int
+be_enum_val::accept (be_visitor *visitor)
+{
+ return visitor->visit_enum_val (this);
+}
+
+void
+be_enum_val::destroy (void)
+{
+ this->AST_EnumVal::destroy ();
+ this->be_decl::destroy ();
+}
+
+// Narrowing
+IMPL_NARROW_METHODS2 (be_enum_val, AST_EnumVal, be_decl)
+IMPL_NARROW_FROM_DECL (be_enum_val)
diff --git a/TAO/TAO_IDL/be/be_eventtype.cpp b/TAO/TAO_IDL/be/be_eventtype.cpp
new file mode 100644
index 00000000000..75c484d39c3
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_eventtype.cpp
@@ -0,0 +1,143 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_eventtype.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_EventType and be_valuetype that provides
+// additional means for C++ mapping of an eventtype.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#include "be_eventtype.h"
+#include "be_visitor.h"
+
+ACE_RCSID (be,
+ be_eventtype,
+ "$Id$")
+
+// Default constructor.
+be_eventtype::be_eventtype (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ UTL_Scope (),
+ AST_Interface (),
+ be_scope (),
+ be_decl (),
+ be_type (),
+ be_interface (),
+ AST_ValueType (),
+ be_valuetype (),
+ AST_EventType ()
+{
+}
+
+// Constructor used to build the AST.
+be_eventtype::be_eventtype (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,
+ bool abstract,
+ bool truncatable,
+ bool custom)
+ : COMMON_Base (0,
+ abstract),
+ AST_Decl (AST_Decl::NT_eventtype,
+ n),
+ AST_Type (AST_Decl::NT_eventtype,
+ n),
+ UTL_Scope (AST_Decl::NT_eventtype),
+ AST_Interface (n,
+ inherits,
+ n_inherits,
+ inherits_flat,
+ n_inherits_flat,
+ 0,
+ abstract),
+ be_scope (AST_Decl::NT_eventtype),
+ be_decl (AST_Decl::NT_eventtype,
+ n),
+ be_type (AST_Decl::NT_eventtype,
+ n),
+ be_interface (n,
+ inherits,
+ n_inherits,
+ inherits_flat,
+ n_inherits_flat,
+ 0,
+ abstract),
+ AST_ValueType (n,
+ inherits,
+ n_inherits,
+ inherits_concrete,
+ inherits_flat,
+ n_inherits_flat,
+ supports,
+ n_supports,
+ supports_concrete,
+ abstract,
+ truncatable,
+ custom),
+ be_valuetype (n,
+ inherits,
+ n_inherits,
+ inherits_concrete,
+ inherits_flat,
+ n_inherits_flat,
+ supports,
+ n_supports,
+ supports_concrete,
+ abstract,
+ truncatable,
+ custom),
+ AST_EventType (n,
+ inherits,
+ n_inherits,
+ inherits_concrete,
+ inherits_flat,
+ n_inherits_flat,
+ supports,
+ n_supports,
+ supports_concrete,
+ abstract,
+ truncatable,
+ custom)
+{
+}
+
+be_eventtype::~be_eventtype (void)
+{
+}
+
+// The differences between valuetype and eventtype are too small
+// to warrant a separate set of visitors.
+int
+be_eventtype::accept (be_visitor *visitor)
+{
+ return visitor->visit_eventtype (this);
+}
+
+void
+be_eventtype::destroy (void)
+{
+ this->be_valuetype::destroy ();
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS2 (be_eventtype, be_valuetype, AST_EventType)
+IMPL_NARROW_FROM_DECL (be_eventtype)
+IMPL_NARROW_FROM_SCOPE (be_eventtype)
diff --git a/TAO/TAO_IDL/be/be_eventtype_fwd.cpp b/TAO/TAO_IDL/be/be_eventtype_fwd.cpp
new file mode 100644
index 00000000000..327e514624a
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_eventtype_fwd.cpp
@@ -0,0 +1,87 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_eventtype_fwd.h
+//
+// = DESCRIPTION
+// Extension of class be_valuetype_fwd that provides additional
+// means for C++ mapping of an eventtype.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+
+#include "be_eventtype_fwd.h"
+#include "be_visitor.h"
+#include "ast_interface.h"
+
+ACE_RCSID (be,
+ be_eventtype_fwd,
+ "$Id$")
+
+be_eventtype_fwd::be_eventtype_fwd (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_InterfaceFwd (),
+ be_decl (),
+ be_type (),
+ be_interface_fwd (),
+ AST_ValueTypeFwd (),
+ be_valuetype_fwd (),
+ AST_EventTypeFwd ()
+{
+}
+
+be_eventtype_fwd::be_eventtype_fwd (AST_Interface *dummy,
+ UTL_ScopedName *n)
+ : COMMON_Base (dummy->is_local (),
+ dummy->is_abstract ()),
+ AST_Decl (AST_Decl::NT_eventtype_fwd,
+ n),
+ AST_Type (AST_Decl::NT_eventtype_fwd,
+ n),
+ AST_InterfaceFwd (dummy,
+ n),
+ be_decl (AST_Decl::NT_eventtype_fwd,
+ n),
+ be_type (AST_Decl::NT_eventtype_fwd,
+ n),
+ be_interface_fwd (dummy,
+ n),
+ AST_ValueTypeFwd (dummy,
+ n),
+ be_valuetype_fwd (dummy,
+ n),
+ AST_EventTypeFwd (dummy,
+ n)
+{
+}
+
+be_eventtype_fwd::~be_eventtype_fwd (void)
+{
+}
+
+int
+be_eventtype_fwd::accept (be_visitor *visitor)
+{
+ return visitor->visit_eventtype_fwd (this);
+}
+
+void
+be_eventtype_fwd::destroy (void)
+{
+ this->be_valuetype_fwd::destroy ();
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS2 (be_eventtype_fwd, be_valuetype_fwd, AST_EventTypeFwd)
+IMPL_NARROW_FROM_DECL (be_eventtype_fwd)
+
diff --git a/TAO/TAO_IDL/be/be_exception.cpp b/TAO/TAO_IDL/be/be_exception.cpp
new file mode 100644
index 00000000000..3f8711549bc
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_exception.cpp
@@ -0,0 +1,96 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_exception.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Exception that provides additional means for C++
+// mapping of an interface.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+
+#include "be_exception.h"
+#include "be_visitor.h"
+
+#include "global_extern.h"
+
+ACE_RCSID (be,
+ be_exception,
+ "$Id$")
+
+be_exception::be_exception (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType (),
+ UTL_Scope (),
+ AST_Structure (),
+ be_scope (),
+ be_decl (),
+ be_type ()
+{
+ // Always the case.
+ this->size_type (AST_Type::VARIABLE);
+}
+
+be_exception::be_exception (UTL_ScopedName *n,
+ bool local,
+ bool abstract)
+ : COMMON_Base (local,
+ abstract),
+ AST_Decl (AST_Decl::NT_except,
+ n),
+ AST_Type (AST_Decl::NT_except,
+ n),
+ AST_ConcreteType (AST_Decl::NT_except,
+ n),
+ UTL_Scope (AST_Decl::NT_except),
+ AST_Structure (AST_Decl::NT_except,
+ n,
+ local,
+ abstract),
+ be_scope (AST_Decl::NT_except),
+ be_decl (AST_Decl::NT_except,
+ n),
+ be_type (AST_Decl::NT_except,
+ n)
+{
+ // Always the case.
+ this->size_type (AST_Type::VARIABLE);
+
+ if (!this->imported ())
+ {
+ idl_global->exception_seen_ = true;
+ }
+}
+
+void
+be_exception::destroy (void)
+{
+ // Call the destroy methods of our base classes.
+ this->be_scope::destroy ();
+ this->be_type::destroy ();
+ this->AST_Exception::destroy ();
+}
+
+int
+be_exception::accept (be_visitor *visitor)
+{
+ return visitor->visit_exception (this);
+}
+
+// Narrowing
+IMPL_NARROW_METHODS3 (be_exception, AST_Exception, be_scope, be_type)
+IMPL_NARROW_FROM_DECL (be_exception)
+IMPL_NARROW_FROM_SCOPE (be_exception)
diff --git a/TAO/TAO_IDL/be/be_expression.cpp b/TAO/TAO_IDL/be/be_expression.cpp
new file mode 100644
index 00000000000..40da1b84eea
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_expression.cpp
@@ -0,0 +1,95 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_expression.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Expression that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_expression.h"
+#include "be_visitor.h"
+
+ACE_RCSID (be,
+ be_expression,
+ "$Id$")
+
+be_expression::be_expression (UTL_ScopedName *n)
+ : AST_Expression (n)
+{
+}
+
+be_expression::be_expression (AST_Expression *b, AST_Expression::ExprType t)
+ : AST_Expression (b,
+ t)
+{
+}
+
+be_expression::be_expression (AST_Expression::ExprComb c,
+ AST_Expression *v1,
+ AST_Expression *v2)
+ : AST_Expression (c,
+ v1,
+ v2)
+{
+}
+
+be_expression::be_expression (long l)
+ : AST_Expression (l)
+{
+}
+
+be_expression::be_expression (bool b)
+ : AST_Expression (b)
+{
+}
+
+be_expression::be_expression (idl_uns_long l,
+ AST_Expression::ExprType t)
+ : AST_Expression (l,
+ t)
+{
+}
+
+be_expression::be_expression (UTL_String *s)
+ : AST_Expression (s)
+{
+}
+
+be_expression::be_expression (char *s)
+ : AST_Expression (s)
+{
+}
+
+be_expression::be_expression (char c)
+ : AST_Expression (c)
+{
+}
+
+be_expression::be_expression (ACE_OutputCDR::from_wchar wc)
+ : AST_Expression (wc)
+{
+}
+
+be_expression::be_expression (double d)
+ : AST_Expression (d)
+{
+}
+
+int
+be_expression::accept (be_visitor *visitor)
+{
+ return visitor->visit_expression (this);
+}
diff --git a/TAO/TAO_IDL/be/be_factory.cpp b/TAO/TAO_IDL/be/be_factory.cpp
new file mode 100644
index 00000000000..271648d6f6b
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_factory.cpp
@@ -0,0 +1,75 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_factory.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Factory that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Boris Kolpackov <bosk@ipmce.ru>
+//
+// ============================================================================
+
+#include "be_factory.h"
+#include "be_visitor.h"
+
+ACE_RCSID (be,
+ be_factory,
+ "$Id$")
+
+be_factory::be_factory (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ UTL_Scope (),
+ AST_Factory (),
+ be_scope (),
+ be_decl ()
+{
+}
+
+be_factory::be_factory (UTL_ScopedName *n)
+ : COMMON_Base (1,
+ 0), //@@ Always local, never abstract
+ AST_Decl (AST_Decl::NT_factory,
+ n),
+ UTL_Scope (AST_Decl::NT_factory),
+ AST_Factory (n),
+ be_scope (AST_Decl::NT_factory),
+ be_decl (AST_Decl::NT_factory,
+ n)
+{
+}
+
+be_factory::~be_factory (void)
+{
+}
+
+void
+be_factory::destroy (void)
+{
+ // Call the destroy methods of our base classes.
+ this->be_scope::destroy ();
+ this->be_decl::destroy ();
+
+ this->AST_Factory::destroy ();
+}
+
+int
+be_factory::accept (be_visitor *visitor)
+{
+ return visitor->visit_factory (this);
+}
+
+// Narrowing
+IMPL_NARROW_METHODS3 (be_factory, AST_Factory, be_scope, be_decl)
+IMPL_NARROW_FROM_DECL (be_factory)
+IMPL_NARROW_FROM_SCOPE (be_factory)
diff --git a/TAO/TAO_IDL/be/be_field.cpp b/TAO/TAO_IDL/be/be_field.cpp
new file mode 100644
index 00000000000..d33847bed01
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_field.cpp
@@ -0,0 +1,78 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_field.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Field that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_field.h"
+#include "be_visitor.h"
+#include "be_type.h"
+#include "global_extern.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (be,
+ be_field,
+ "$Id$")
+
+be_field::be_field (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Field (),
+ be_decl ()
+{
+}
+
+be_field::be_field (AST_Type *ft,
+ UTL_ScopedName *n,
+ Visibility vis)
+ : COMMON_Base (ft->is_local (),
+ ft->is_abstract ()),
+ AST_Decl (AST_Decl::NT_field,
+ n),
+ AST_Field (ft,
+ n,
+ vis),
+ be_decl (AST_Decl::NT_field,
+ n)
+{
+ // This covers valuetype fields as well, which is what we want.
+ AST_Decl::NodeType nt =
+ ft->unaliased_type ()->node_type ();
+
+ if (nt == AST_Decl::NT_string || nt == AST_Decl::NT_wstring)
+ {
+ idl_global->string_member_seen_ = true;
+ }
+}
+
+int
+be_field::accept (be_visitor *visitor)
+{
+ return visitor->visit_field (this);
+}
+
+void
+be_field::destroy (void)
+{
+ this->be_decl::destroy ();
+ this->AST_Field::destroy ();
+}
+
+// Narrowing
+IMPL_NARROW_METHODS2 (be_field, AST_Field, be_decl)
+IMPL_NARROW_FROM_DECL (be_field)
diff --git a/TAO/TAO_IDL/be/be_generator.cpp b/TAO/TAO_IDL/be/be_generator.cpp
new file mode 100644
index 00000000000..49dfc20a7ce
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_generator.cpp
@@ -0,0 +1,913 @@
+// $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.
+
+*/
+
+// Implementation of BE generator class.
+//
+// This implements the same protocol as AST_Generator but creates instances
+// of the BE-subclassed classes instead of of AST classes.
+
+#include "be_generator.h"
+#include "be_root.h"
+#include "be_predefined_type.h"
+#include "be_module.h"
+#include "be_valuebox.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_eventtype.h"
+#include "be_eventtype_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$")
+
+AST_Root *
+be_generator::create_root (UTL_ScopedName *n)
+{
+ be_root *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_root (n),
+ 0);
+
+ return retval;
+}
+
+AST_PredefinedType *
+be_generator::create_predefined_type (AST_PredefinedType::PredefinedType t,
+ UTL_ScopedName *n)
+{
+ be_predefined_type *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_predefined_type (t,
+ n),
+ 0);
+
+ return retval;
+}
+
+AST_Module *
+be_generator::create_module (UTL_Scope *s,
+ UTL_ScopedName *n)
+{
+ // 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;
+ ACE_NEW_RETURN (retval,
+ be_module (n),
+ 0);
+
+
+ // Check for another module of the same name in this scope.
+ for (UTL_ScopeActiveIterator iter (s, UTL_Scope::IK_decls);
+ !iter.is_done ();
+ iter.next ())
+ {
+ AST_Decl *d = iter.item ();
+
+ if (d->node_type () == AST_Decl::NT_module)
+ {
+ // Does it have the same name as the one we're
+ // supposed to create.
+ if (d->local_name ()->compare (n->last_component ()))
+ {
+ AST_Module *m = AST_Module::narrow_from_decl (d);
+
+ // Get m's previous_ member, plus all it's decls,
+ // into the new modules's previous_ member.
+ retval->add_to_previous (m);
+ retval->prefix (const_cast<char *> (m->prefix ()));
+ }
+ }
+ }
+
+ // If this scope is itself a module, and has been previously
+ // opened, the previous opening may contain a previous opening
+ // of the module we're creating.
+ AST_Decl *d = ScopeAsDecl (s);
+ AST_Decl::NodeType nt = d->node_type ();
+
+ if (nt == AST_Decl::NT_module || nt == AST_Decl::NT_root)
+ {
+ AST_Module *m = AST_Module::narrow_from_decl (d);
+
+ // AST_Module::previous_ is a set, so it contains each
+ // entry only once, but previous_ will contain the decls
+ // from all previous openings. See comment in
+ // AST_Module::add_to_previous() body.
+ d = m->look_in_previous (n->last_component ());
+
+ if (d != 0)
+ {
+ if (d->node_type () == AST_Decl::NT_module)
+ {
+ m = AST_Module::narrow_from_decl (d);
+
+ retval->add_to_previous (m);
+ }
+ }
+ }
+
+ return retval;
+}
+
+AST_Interface *
+be_generator::create_interface (UTL_ScopedName *n,
+ AST_Interface **ih,
+ long nih,
+ AST_Interface **ih_flat,
+ long nih_flat,
+ bool l,
+ bool a)
+{
+ be_interface *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_interface (n,
+ ih,
+ nih,
+ ih_flat,
+ nih_flat,
+ l,
+ a),
+ 0);
+
+ return retval;
+}
+
+AST_InterfaceFwd *
+be_generator::create_interface_fwd (UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract)
+{
+ AST_Interface *full_defn = this->create_interface (n,
+ 0,
+ -1,
+ 0,
+ 0,
+ is_local,
+ is_abstract);
+
+ be_interface_fwd *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_interface_fwd (full_defn,
+ n),
+ 0);
+
+ full_defn->fwd_decl (retval);
+ return retval;
+}
+
+AST_ValueBox *
+be_generator::create_valuebox (UTL_ScopedName *n,
+ AST_Type *boxed_type)
+{
+ be_valuebox *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_valuebox (boxed_type,
+ n),
+ 0);
+
+ return retval;
+}
+
+AST_ValueType *
+be_generator::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_list,
+ long n_supports,
+ AST_Interface *supports_concrete,
+ bool is_abstract,
+ bool is_truncatable,
+ bool is_custom)
+{
+ be_valuetype *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_valuetype (n,
+ inherits,
+ n_inherits,
+ inherits_concrete,
+ inherits_flat,
+ n_inherits_flat,
+ supports_list,
+ n_supports,
+ supports_concrete,
+ is_abstract,
+ is_truncatable,
+ is_custom),
+ 0);
+
+ return retval;
+}
+
+AST_ValueTypeFwd *
+be_generator::create_valuetype_fwd (UTL_ScopedName *n,
+ bool is_abstract)
+{
+ AST_ValueType *full_defn = this->create_valuetype (n,
+ 0,
+ -1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ is_abstract,
+ false,
+ false);
+
+ be_valuetype_fwd *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_valuetype_fwd (full_defn,
+ n),
+ 0);
+
+ full_defn->fwd_decl (retval);
+ return retval;
+}
+
+AST_EventType *
+be_generator::create_eventtype (UTL_ScopedName *n,
+ AST_Interface **inherits,
+ long n_inherits,
+ AST_ValueType *inherits_concrete,
+ AST_Interface **inherits_flat,
+ long n_inherits_flat,
+ AST_Interface **supports_list,
+ long n_supports,
+ AST_Interface *supports_concrete,
+ bool is_abstract,
+ bool is_truncatable,
+ bool is_custom)
+{
+ be_eventtype *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_eventtype (n,
+ inherits,
+ n_inherits,
+ inherits_concrete,
+ inherits_flat,
+ n_inherits_flat,
+ supports_list,
+ n_supports,
+ supports_concrete,
+ is_abstract,
+ is_truncatable,
+ is_custom),
+ 0);
+
+ return retval;
+}
+
+AST_EventTypeFwd *
+be_generator::create_eventtype_fwd (UTL_ScopedName *n,
+ bool is_abstract)
+{
+ AST_EventType *full_defn = this->create_eventtype (n,
+ 0,
+ -1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ is_abstract,
+ false,
+ false);
+
+ be_eventtype_fwd *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_eventtype_fwd (full_defn,
+ n),
+ 0);
+
+ full_defn->fwd_decl (retval);
+ return retval;
+}
+
+AST_Component *
+be_generator::create_component (UTL_ScopedName *n,
+ AST_Component *base_component,
+ AST_Interface **supports_list,
+ 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_list,
+ n_supports,
+ supports_flat,
+ n_supports_flat),
+ 0);
+
+ return retval;
+}
+
+AST_ComponentFwd *
+be_generator::create_component_fwd (UTL_ScopedName *n)
+{
+ AST_Component *full_defn = this->create_component (n,
+ 0,
+ 0,
+ -1,
+ 0,
+ 0);
+
+ be_component_fwd *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_component_fwd (full_defn,
+ n),
+ 0);
+
+ full_defn->fwd_decl (retval);
+ 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_list,
+ 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_list,
+ n_supports,
+ supports_flat,
+ n_supports_flat),
+ 0);
+
+ return retval;
+}
+
+AST_Exception *
+be_generator::create_exception (UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract)
+{
+ be_exception *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_exception (n,
+ is_local,
+ is_abstract),
+ 0);
+
+ return retval;
+}
+
+AST_Structure *
+be_generator::create_structure (UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract)
+{
+ be_structure *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_structure (n,
+ is_local,
+ is_abstract),
+ 0);
+
+ return retval;
+}
+
+AST_StructureFwd *
+be_generator::create_structure_fwd (UTL_ScopedName *n)
+{
+
+ AST_Structure *full_defn = this->create_structure (n,
+ false,
+ false);
+ be_structure_fwd *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_structure_fwd (full_defn,
+ n),
+ 0);
+
+ full_defn->fwd_decl (retval);
+ return retval;
+}
+
+AST_Enum *
+be_generator::create_enum (UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract)
+{
+ be_enum *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_enum (n,
+ is_local,
+ is_abstract),
+ 0);
+
+ return retval;
+}
+
+AST_Operation *
+be_generator::create_operation (AST_Type *rt,
+ AST_Operation::Flags fl,
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract)
+{
+ be_operation *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_operation (rt,
+ fl,
+ n,
+ is_local,
+ is_abstract),
+ 0);
+
+ return retval;
+}
+
+AST_Field *
+be_generator::create_field (AST_Type *ft,
+ UTL_ScopedName *n,
+ AST_Field::Visibility vis)
+{
+ be_field *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_field (ft,
+ n,
+ vis),
+ 0);
+
+ return retval;
+}
+
+AST_Argument *
+be_generator::create_argument (AST_Argument::Direction d,
+ AST_Type *ft,
+ UTL_ScopedName *n)
+{
+ be_argument *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_argument (d,
+ ft,
+ n),
+ 0);
+
+ return retval;
+}
+
+AST_Attribute *
+be_generator::create_attribute (bool ro,
+ AST_Type *ft,
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract)
+{
+ be_attribute *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_attribute (ro,
+ ft,
+ n,
+ is_local,
+ is_abstract),
+ 0);
+
+ return retval;
+}
+
+AST_Union *
+be_generator::create_union (AST_ConcreteType *dt,
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract)
+{
+ be_union *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_union (dt,
+ n,
+ is_local,
+ is_abstract),
+ 0);
+
+ return retval;
+}
+
+AST_UnionFwd *
+be_generator::create_union_fwd (UTL_ScopedName *n)
+{
+ AST_Union *full_defn = this->create_union (0,
+ n,
+ false,
+ false);
+ be_union_fwd *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_union_fwd (full_defn,
+ n),
+ 0);
+
+ full_defn->fwd_decl (retval);
+ return retval;
+}
+
+AST_UnionBranch *
+be_generator::create_union_branch (UTL_LabelList *ll,
+ AST_Type *ft,
+ UTL_ScopedName *n)
+{
+ be_union_branch *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_union_branch (ll,
+ ft,
+ n),
+ 0);
+
+ return retval;
+}
+
+AST_UnionLabel *
+be_generator::create_union_label (AST_UnionLabel::UnionLabel ul,
+ AST_Expression *lv)
+{
+ be_union_label *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_union_label (ul,
+ lv),
+ 0);
+
+ return retval;
+}
+
+AST_Constant *
+be_generator::create_constant (AST_Expression::ExprType et,
+ AST_Expression *ev,
+ UTL_ScopedName *n)
+{
+ be_constant *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_constant (et,
+ ev,
+ n),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+be_generator::create_expr (UTL_ScopedName *n)
+{
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (n),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+be_generator::create_expr (AST_Expression *b,
+ AST_Expression::ExprType t)
+{
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (b,
+ t),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+be_generator::create_expr (AST_Expression::ExprComb c,
+ AST_Expression *v1,
+ AST_Expression *v2)
+{
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (c,
+ v1,
+ v2),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+be_generator::create_expr (long l)
+{
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (l),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+be_generator::create_expr (bool b)
+{
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (b),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+be_generator::create_expr (idl_uns_long l,
+ AST_Expression::ExprType t)
+{
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (l,
+ t),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+be_generator::create_expr (UTL_String *s)
+{
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (s),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+be_generator::create_expr(char c)
+{
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (c),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+be_generator::create_expr (ACE_OutputCDR::from_wchar wc)
+{
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (wc),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+be_generator::create_expr (char *s)
+{
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (s),
+ 0);
+
+ return retval;
+}
+
+AST_Expression *
+be_generator::create_expr (double d)
+{
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (d),
+ 0);
+
+ return retval;
+}
+
+AST_EnumVal *
+be_generator::create_enum_val (unsigned long v,
+ UTL_ScopedName *n)
+{
+ be_enum_val *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_enum_val (v,
+ n),
+ 0);
+
+ return retval;
+}
+
+AST_Array *
+be_generator::create_array (UTL_ScopedName *n,
+ unsigned long ndims,
+ UTL_ExprList *dims,
+ bool is_local,
+ bool is_abstract)
+{
+ be_array *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_array (n,
+ ndims,
+ dims,
+ is_local,
+ is_abstract),
+ 0);
+
+ return retval;
+}
+
+AST_Sequence *
+be_generator::create_sequence (AST_Expression *v,
+ AST_Type *bt,
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract)
+{
+ be_sequence *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_sequence (v,
+ bt,
+ n,
+ is_local,
+ is_abstract),
+ 0);
+
+ return retval;
+}
+
+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 (AST_Decl::NT_string,
+ &n,
+ v,
+ 1),
+ 0);
+
+ return retval;
+}
+
+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 (nt,
+ &n,
+ v,
+ sizeof (ACE_CDR::WChar)),
+ 0);
+
+ return retval;
+}
+
+AST_Typedef *
+be_generator::create_typedef (AST_Type *bt,
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract)
+{
+ be_typedef *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_typedef (bt,
+ n,
+ is_local,
+ is_abstract),
+ 0);
+
+ return retval;
+}
+
+AST_Native *
+be_generator::create_native (UTL_ScopedName *n)
+{
+ be_native *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_native (n),
+ 0);
+
+ return retval;
+}
+
+AST_Factory *
+be_generator::create_factory (UTL_ScopedName *n)
+{
+ be_factory *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_factory (n),
+ 0);
+
+ return retval;
+}
diff --git a/TAO/TAO_IDL/be/be_global.cpp b/TAO/TAO_IDL/be/be_global.cpp
new file mode 100644
index 00000000000..261ed9f3850
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_global.cpp
@@ -0,0 +1,2695 @@
+// $Id$
+
+// ============================================================================
+//
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_global.cpp
+//
+// = DESCRIPTION
+// Stores global data specific to the compiler back end.
+//
+// = AUTHOR
+// Jeff Parsons <parsons@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "be_global.h"
+#include "be_codegen.h"
+#include "be_generator.h"
+#include "be_module.h"
+#include "be_valuetype.h"
+#include "be_interface.h"
+#include "ast_predefined_type.h"
+#include "utl_identifier.h"
+#include "utl_string.h"
+#include "global_extern.h"
+#include "idl_defines.h"
+#include "ace/ACE.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_sys_stat.h"
+#include "ace/os_include/os_ctype.h"
+
+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),
+ anyop_export_macro_ (0),
+ anyop_export_include_ (0),
+ pch_include_ (0),
+ pre_include_ (0),
+ post_include_ (0),
+ include_guard_ (0),
+ safe_include_ (0),
+ core_versioning_begin_ ("\nTAO_BEGIN_VERSIONED_NAMESPACE_DECL\n"),
+ core_versioning_end_ ("\nTAO_END_VERSIONED_NAMESPACE_DECL\n"),
+ versioning_begin_ (),
+ versioning_end_ (),
+ client_hdr_ending_ (ACE::strnew ("C.h")),
+ client_stub_ending_ (ACE::strnew ("C.cpp")),
+ client_inline_ending_ (ACE::strnew ("C.inl")),
+ 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.inl")),
+ server_template_inline_ending_ (ACE::strnew ("S_T.inl")),
+ anyop_hdr_ending_ (ACE::strnew ("A.h")),
+ anyop_src_ending_ (ACE::strnew ("A.cpp")),
+ output_dir_ (0),
+ skel_output_dir_ (0),
+ anyop_output_dir_ (0),
+ any_support_ (true),
+ tc_support_ (true),
+ obv_opt_accessor_ (0),
+ gen_impl_files_ (false),
+ gen_impl_debug_info_ (false),
+ gen_copy_ctor_ (false),
+ gen_assign_op_ (false),
+ gen_thru_poa_collocation_ (true), // Default is thru_poa.
+ gen_direct_collocation_ (false),
+#ifdef ACE_HAS_EXCEPTIONS
+ exception_support_ (true),
+#else
+ exception_support_ (false),
+#endif /* ACE_HAS_EXCEPTIONS */
+ use_raw_throw_ (false),
+ opt_tc_ (false),
+ ami_call_back_ (false),
+ gen_amh_classes_ (false),
+ gen_tie_classes_ (false),
+ gen_smart_proxies_ (false),
+ gen_inline_constants_ (true),
+ gen_dcps_type_support_ (false),
+ gen_orb_h_include_ (true),
+ lookup_strategy_ (TAO_PERFECT_HASH),
+ void_type_ (0),
+ ccmobject_ (0),
+ messaging_ (0),
+ messaging_exceptionholder_ (0),
+ exceptionholder_ (0),
+ messaging_replyhandler_ (0),
+ gen_anyop_files_ (false),
+ gen_skel_files_ (true),
+ gen_client_inline_ (true),
+ gen_server_inline_ (true),
+ gen_local_iface_anyops_ (true)
+{
+}
+
+BE_GlobalData::~BE_GlobalData (void)
+{
+}
+
+// To switch between changing or non-changing standard include files
+// include files, so that #include statements can be
+// generated with ""s or <>s respectively, for the standard include
+// files (e.g. tao/corba.h)
+void
+BE_GlobalData::changing_standard_include_files (size_t changing)
+{
+ this->changing_standard_include_files_ = changing;
+}
+
+size_t
+BE_GlobalData::changing_standard_include_files (void)
+{
+ return this->changing_standard_include_files_;
+}
+
+/************ Helper functions **************/
+static const char*
+be_change_idl_file_extension (UTL_String* idl_file,
+ const char *new_extension,
+ bool base_name_only = false,
+ bool for_anyop = false,
+ bool for_skel = false)
+{
+ // @@ This shouldn't happen anyway; but a better error handling
+ // mechanism is needed.
+ if (idl_file == 0 || new_extension == 0)
+ {
+ return 0;
+ }
+
+ static char fname[MAXPATHLEN];
+ ACE_OS::memset (fname, 0, MAXPATHLEN);
+
+ // Get the char* from the UTL_String.
+ const char* string = idl_file->get_string ();
+
+ // Get the base part of the filename, we try several extensions
+ // before giving up.
+ const char *base = 0;
+
+ static const char* extensions[] = {
+ ".idl",
+ ".pidl",
+ ".IDL",
+ ".PIDL"
+ };
+
+ static int nextensions = sizeof(extensions)/sizeof(extensions[0]);
+
+ for (int k = 0; k < nextensions; ++k)
+ {
+ base = ACE_OS::strstr (string, extensions[k]);
+
+ if (base != 0)
+ {
+ break;
+ }
+ }
+
+ if (base == 0)
+ {
+ return 0;
+ }
+
+ // Anyop * skel file output defaults to general output dir if not set.
+ const char *output_path = 0;
+
+ if (for_anyop && 0 != be_global->anyop_output_dir ())
+ {
+ output_path = be_global->anyop_output_dir ();
+ }
+ else if (for_skel && 0 != be_global->skel_output_dir ())
+ {
+ output_path = be_global->skel_output_dir ();
+ }
+ else
+ {
+ output_path = be_global->output_dir ();
+ }
+
+ if (!base_name_only && output_path != 0)
+ {
+ // Path info should also be added to fname.
+
+ // Add path and "/".
+ ACE_OS::sprintf (fname, "%s/", output_path);
+
+ // Append the base part to fname.
+ ACE_OS::strncpy (fname + strlen (fname), string, base - string);
+ }
+ else
+ {
+ // Base_name_only or no putput_dir specified by user. JUST put the
+ // base part to fname.
+ ACE_OS::strncpy (fname, string, base - string);
+ }
+
+ // Turn '\' and '\\' into '/'.
+ char* i = fname;
+
+ for (char* j = fname; *j != 0; ++i, ++j)
+ {
+ if (*j == '\\')
+ {
+ *i = '/';
+
+ if (*(j+1) == '\\')
+ {
+ ++j;
+ }
+ }
+ else
+ {
+ *i = *j;
+ }
+ }
+
+ *i = 0;
+
+ // Append the newextension.
+ ACE_OS::strcat (fname, new_extension);
+
+ return fname;
+}
+
+const char *
+BE_GlobalData::be_get_client_hdr (UTL_String *idl_file_name,
+ bool base_name_only)
+{
+ // User-defined file extensions don't apply to .pidl files.
+ ACE_CString fn (idl_file_name->get_string ());
+ ACE_CString fn_ext = fn.substr (fn.length () - 5);
+ bool orb_file = (fn_ext == ".pidl" || fn_ext == ".PIDL");
+
+ return be_change_idl_file_extension (idl_file_name,
+ orb_file
+ ? "C.h"
+ : be_global->client_hdr_ending (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_client_stub (UTL_String *idl_file_name)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->client_stub_ending ());
+}
+
+const char *
+BE_GlobalData::be_get_client_inline (UTL_String *idl_file_name,
+ bool base_name_only)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->client_inline_ending (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_server_hdr (UTL_String *idl_file_name,
+ bool base_name_only)
+{
+ // User-defined file extensions don't apply to .pidl files.
+ ACE_CString fn (idl_file_name->get_string ());
+ ACE_CString fn_ext = fn.substr (fn.length () - 5);
+ bool orb_file = (fn_ext == ".pidl" || fn_ext == ".PIDL");
+
+ return be_change_idl_file_extension (idl_file_name,
+ orb_file
+ ? "S.h"
+ : be_global->server_hdr_ending (),
+ base_name_only,
+ false,
+ true);
+}
+
+const char *
+BE_GlobalData::be_get_implementation_hdr (UTL_String *idl_file_name,
+ bool base_name_only)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->implementation_hdr_ending (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_implementation_skel (UTL_String *idl_file_name,
+ bool base_name_only)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->implementation_skel_ending (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_server_template_hdr (UTL_String *idl_file_name,
+ bool base_name_only)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->server_template_hdr_ending (),
+ base_name_only,
+ false,
+ true);
+}
+
+const char *
+BE_GlobalData::be_get_server_skeleton (UTL_String *idl_file_name)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->server_skeleton_ending (),
+ false,
+ false,
+ true);
+}
+
+const char *
+BE_GlobalData::be_get_server_template_skeleton (UTL_String *idl_file_name,
+ bool base_name_only)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->server_template_skeleton_ending (),
+ base_name_only,
+ false,
+ true);
+}
+
+const char *
+BE_GlobalData::be_get_server_inline (UTL_String *idl_file_name,
+ bool base_name_only)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->server_inline_ending (),
+ base_name_only,
+ false,
+ true);
+}
+
+const char *
+BE_GlobalData::be_get_server_template_inline (UTL_String *idl_file_name,
+ bool base_name_only)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->server_template_inline_ending (),
+ base_name_only,
+ false,
+ true);
+}
+
+const char *
+BE_GlobalData::be_get_anyop_header (UTL_String *idl_file_name,
+ bool base_name_only)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->anyop_header_ending (),
+ base_name_only,
+ true);
+}
+
+const char *
+BE_GlobalData::be_get_anyop_source (UTL_String *idl_file_name,
+ bool base_name_only)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->anyop_source_ending (),
+ base_name_only,
+ true);
+}
+
+const char *
+BE_GlobalData::be_get_client_hdr_fname (bool base_name_only)
+{
+ return be_get_client_hdr (idl_global->stripped_filename (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_client_stub_fname (void)
+{
+ return be_get_client_stub (idl_global->stripped_filename ());
+}
+
+const char *
+BE_GlobalData::be_get_client_inline_fname (bool base_name_only)
+{
+ return be_get_client_inline (idl_global->stripped_filename (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_server_hdr_fname (bool base_name_only)
+{
+ return be_get_server_hdr (idl_global->stripped_filename (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_implementation_hdr_fname (bool base_name_only)
+{
+ return be_get_implementation_hdr (idl_global->stripped_filename (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_implementation_skel_fname (bool base_name_only)
+{
+ return be_get_implementation_skel (idl_global->stripped_filename (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_server_template_hdr_fname (bool base_name_only)
+{
+ return be_get_server_template_hdr (idl_global->stripped_filename (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_server_skeleton_fname (void)
+{
+ return be_get_server_skeleton (idl_global->stripped_filename ());
+}
+
+const char *
+BE_GlobalData::be_get_implementation_skeleton_fname (void)
+{
+ return be_get_implementation_skel (idl_global->stripped_filename ());
+}
+
+const char *
+BE_GlobalData::be_get_server_template_skeleton_fname (bool base_name_only)
+{
+ return be_get_server_template_skeleton (idl_global->stripped_filename (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_server_inline_fname (bool base_name_only)
+{
+ return be_get_server_inline (idl_global->stripped_filename (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_server_template_inline_fname (bool base_name_only)
+{
+ return be_get_server_template_inline (idl_global->stripped_filename (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_anyop_source_fname (bool base_name_only)
+{
+ return be_get_anyop_source (idl_global->stripped_filename (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_anyop_header_fname (bool base_name_only)
+{
+ return be_get_anyop_header (idl_global->stripped_filename (),
+ base_name_only);
+}
+
+const char*
+BE_GlobalData::skel_export_macro (void) const
+{
+ if (this->skel_export_macro_ == 0)
+ {
+ return "";
+ }
+
+ return this->skel_export_macro_;
+}
+
+void
+BE_GlobalData::skel_export_macro (const char *s)
+{
+ this->skel_export_macro_ = ACE_OS::strdup (s);
+}
+
+const char*
+BE_GlobalData::skel_export_include (void) const
+{
+ return this->skel_export_include_;
+}
+
+void
+BE_GlobalData::skel_export_include (const char *s)
+{
+ this->skel_export_include_ = ACE_OS::strdup (s);
+}
+
+const char*
+BE_GlobalData::stub_export_macro (void) const
+{
+ if (this->stub_export_macro_ == 0)
+ {
+ return "";
+ }
+
+ return this->stub_export_macro_;
+}
+
+void
+BE_GlobalData::stub_export_macro (const char *s)
+{
+ this->stub_export_macro_ = ACE_OS::strdup (s);
+}
+
+const char*
+BE_GlobalData::stub_export_include (void) const
+{
+ return this->stub_export_include_;
+}
+
+void
+BE_GlobalData::stub_export_include (const char *s)
+{
+ this->stub_export_include_ = ACE_OS::strdup (s);
+}
+
+const char*
+BE_GlobalData::anyop_export_macro (void) const
+{
+ if (this->anyop_export_macro_ == 0)
+ {
+ return "";
+ }
+
+ return this->anyop_export_macro_;
+}
+
+void
+BE_GlobalData::anyop_export_macro (const char *s)
+{
+ this->anyop_export_macro_ = ACE_OS::strdup (s);
+}
+
+const char*
+BE_GlobalData::anyop_export_include (void) const
+{
+ return this->anyop_export_include_;
+}
+
+void
+BE_GlobalData::anyop_export_include (const char *s)
+{
+ this->anyop_export_include_ = ACE_OS::strdup (s);
+}
+
+const char*
+BE_GlobalData::pch_include (void) const
+{
+ return this->pch_include_;
+}
+
+void
+BE_GlobalData::pch_include (const char *s)
+{
+ this->pch_include_ = ACE_OS::strdup (s);
+}
+
+const char*
+BE_GlobalData::pre_include (void) const
+{
+ return this->pre_include_;
+}
+
+void
+BE_GlobalData::pre_include (const char *s)
+{
+ this->pre_include_ = ACE_OS::strdup (s);
+}
+
+const char*
+BE_GlobalData::post_include (void) const
+{
+ return this->post_include_;
+}
+
+void
+BE_GlobalData::post_include (const char *s)
+{
+ this->post_include_ = ACE_OS::strdup (s);
+}
+
+const char*
+BE_GlobalData::include_guard (void) const
+{
+ return this->include_guard_;
+}
+
+void
+BE_GlobalData::include_guard (const char *s)
+{
+ this->include_guard_ = ACE_OS::strdup (s);
+}
+
+const char*
+BE_GlobalData::safe_include (void) const
+{
+ return this->safe_include_;
+}
+
+void
+BE_GlobalData::safe_include (const char *s)
+{
+ this->safe_include_ = ACE_OS::strdup (s);
+}
+
+void
+BE_GlobalData::versioning_begin (const char * s)
+{
+ this->versioning_begin_ =
+ ACE_CString ("\n\n")
+ + ACE_CString (s)
+ + ACE_CString ("\n\n");
+
+ this->core_versioning_end_ += this->versioning_begin_; // Yes, "begin".
+}
+
+const char *
+BE_GlobalData::versioning_begin (void) const
+{
+ return this->versioning_begin_.c_str ();
+}
+
+const char *
+BE_GlobalData::core_versioning_begin (void) const
+{
+ return this->core_versioning_begin_.c_str ();
+}
+
+void
+BE_GlobalData::versioning_end (const char * s)
+{
+ this->versioning_end_ =
+ ACE_CString ("\n\n")
+ + ACE_CString (s)
+ + ACE_CString ("\n\n");
+
+ this->core_versioning_begin_ =
+ this->versioning_end_ // Yes, "end".
+ + this->core_versioning_begin_; // Initialized in constructor.
+}
+
+const char *
+BE_GlobalData::versioning_end (void) const
+{
+ return this->versioning_end_.c_str ();
+}
+
+const char *
+BE_GlobalData::core_versioning_end (void) const
+{
+ return this->core_versioning_end_.c_str ();
+}
+
+// Set the client_hdr_ending.
+void
+BE_GlobalData::client_hdr_ending (const char* s)
+{
+ delete [] this->client_hdr_ending_;
+ this->client_hdr_ending_ = ACE::strnew (s);
+}
+
+// Get the client_hdr_ending.
+const char*
+BE_GlobalData::client_hdr_ending (void) const
+{
+ return this->client_hdr_ending_;
+}
+
+void
+BE_GlobalData::client_inline_ending (const char* s)
+{
+ delete [] this->client_inline_ending_;
+ this->client_inline_ending_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::client_inline_ending (void) const
+{
+ return this->client_inline_ending_;
+}
+
+// Set the client_stub_ending.
+void
+BE_GlobalData::client_stub_ending (const char* s)
+{
+ delete [] this->client_stub_ending_;
+ this->client_stub_ending_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::client_stub_ending (void) const
+{
+ return this->client_stub_ending_;
+}
+
+void
+BE_GlobalData::server_hdr_ending (const char* s)
+{
+ delete [] this->server_hdr_ending_;
+ this->server_hdr_ending_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::server_hdr_ending (void) const
+{
+ return this->server_hdr_ending_;
+}
+
+void
+BE_GlobalData::implementation_hdr_ending (const char* s)
+{
+ delete [] this->implementation_hdr_ending_;
+ this->implementation_hdr_ending_ = ACE::strnew (s);
+}
+
+void
+BE_GlobalData::implementation_skel_ending (const char* s)
+{
+ delete [] this->implementation_skel_ending_;
+ this->implementation_skel_ending_ = ACE::strnew (s);
+}
+
+void
+BE_GlobalData::impl_class_prefix (const char* s)
+{
+ delete [] this->impl_class_prefix_;
+ this->impl_class_prefix_ = ACE::strnew (s);
+}
+
+void
+BE_GlobalData::impl_class_suffix (const char* s)
+{
+ delete [] this->impl_class_suffix_;
+ this->impl_class_suffix_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::impl_class_prefix (void) const
+{
+ return this->impl_class_prefix_;
+}
+
+const char*
+BE_GlobalData::implementation_hdr_ending (void) const
+{
+ return this->implementation_hdr_ending_;
+}
+
+const char*
+BE_GlobalData::impl_class_suffix (void) const
+{
+ return this->impl_class_suffix_;
+}
+
+const char*
+BE_GlobalData::implementation_skel_ending (void) const
+{
+ return this->implementation_skel_ending_;
+}
+
+void
+BE_GlobalData::server_template_hdr_ending (const char* s)
+{
+ delete [] this->server_template_hdr_ending_;
+ this->server_template_hdr_ending_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::server_template_hdr_ending (void) const
+{
+ return this->server_template_hdr_ending_;
+}
+
+void
+BE_GlobalData::server_skeleton_ending (const char* s)
+{
+ delete [] this->server_skeleton_ending_;
+ this->server_skeleton_ending_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::server_skeleton_ending (void) const
+{
+ return this->server_skeleton_ending_;
+}
+
+void
+BE_GlobalData::server_template_skeleton_ending (const char* s)
+{
+ delete [] this->server_template_skeleton_ending_;
+ this->server_template_skeleton_ending_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::server_template_skeleton_ending (void) const
+{
+ return this->server_template_skeleton_ending_;
+}
+
+void
+BE_GlobalData::server_inline_ending (const char* s)
+{
+ delete [] this->server_inline_ending_;
+ this->server_inline_ending_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::server_inline_ending (void) const
+{
+ return this->server_inline_ending_;
+}
+
+void
+BE_GlobalData::server_template_inline_ending (const char* s)
+{
+ delete [] this->server_template_inline_ending_;
+ this->server_template_inline_ending_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::server_template_inline_ending (void) const
+{
+ return this->server_template_inline_ending_;
+}
+
+void
+BE_GlobalData::anyop_header_ending (const char* s)
+{
+ delete [] this->anyop_hdr_ending_;
+ this->anyop_hdr_ending_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::anyop_header_ending (void) const
+{
+ return this->anyop_hdr_ending_;
+}
+
+void
+BE_GlobalData::anyop_source_ending (const char* s)
+{
+ delete [] this->anyop_src_ending_;
+ this->anyop_src_ending_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::anyop_source_ending (void) const
+{
+ return this->anyop_src_ending_;
+}
+
+void
+BE_GlobalData::output_dir (const char* s)
+{
+ delete [] this->output_dir_;
+ this->output_dir_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::output_dir (void) const
+{
+ return this->output_dir_;
+}
+
+void
+BE_GlobalData::skel_output_dir (const char* s)
+{
+ delete [] this->skel_output_dir_;
+ this->skel_output_dir_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::skel_output_dir (void) const
+{
+ return this->skel_output_dir_;
+}
+
+void
+BE_GlobalData::anyop_output_dir (const char* s)
+{
+ delete [] this->anyop_output_dir_;
+ this->anyop_output_dir_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::anyop_output_dir (void) const
+{
+ return this->anyop_output_dir_;
+}
+
+void
+BE_GlobalData::any_support (bool val)
+{
+ this->any_support_ = val;
+}
+
+bool
+BE_GlobalData::any_support (void) const
+{
+ return this->any_support_;
+}
+
+void
+BE_GlobalData::tc_support (bool val)
+{
+ this->tc_support_ = val;
+}
+
+bool
+BE_GlobalData::tc_support (void) const
+{
+ return this->tc_support_;
+}
+
+void
+BE_GlobalData::obv_opt_accessor (bool val)
+{
+ this->obv_opt_accessor_ = val;
+}
+
+bool
+BE_GlobalData::obv_opt_accessor (void) const
+{
+ return this->obv_opt_accessor_;
+}
+
+void
+BE_GlobalData::gen_impl_files (bool val)
+{
+ this->gen_impl_files_ = val;
+}
+
+bool
+BE_GlobalData::gen_impl_files (void) const
+{
+ return this->gen_impl_files_;
+}
+
+void
+BE_GlobalData::gen_impl_debug_info (bool val)
+{
+ this->gen_impl_debug_info_ = val;
+}
+
+bool
+BE_GlobalData::gen_impl_debug_info (void) const
+{
+ return this->gen_impl_debug_info_;
+}
+
+void
+BE_GlobalData::gen_copy_ctor (bool val)
+{
+ this->gen_copy_ctor_ = val;
+}
+
+bool
+BE_GlobalData::gen_copy_ctor (void) const
+{
+ return this->gen_copy_ctor_;
+}
+
+void
+BE_GlobalData::gen_assign_op (bool val)
+{
+ this->gen_assign_op_ = val;
+}
+
+bool
+BE_GlobalData::gen_assign_op (void) const
+{
+ return this->gen_assign_op_;
+}
+
+void
+BE_GlobalData::gen_thru_poa_collocation (bool val)
+{
+ this->gen_thru_poa_collocation_ = val;
+}
+
+bool
+BE_GlobalData::gen_thru_poa_collocation (void) const
+{
+ return this->gen_thru_poa_collocation_;
+}
+
+void
+BE_GlobalData::gen_direct_collocation (bool val)
+{
+ this->gen_direct_collocation_ = val;
+}
+
+bool
+BE_GlobalData::gen_direct_collocation (void) const
+{
+ return this->gen_direct_collocation_;
+}
+
+void
+BE_GlobalData::exception_support (bool val)
+{
+ this->exception_support_ = val;
+}
+
+bool
+BE_GlobalData::exception_support (void) const
+{
+ return this->exception_support_;
+}
+
+void
+BE_GlobalData::use_raw_throw (bool val)
+{
+ this->use_raw_throw_ = val;
+}
+
+bool
+BE_GlobalData::use_raw_throw (void) const
+{
+ return this->use_raw_throw_;
+}
+
+void
+BE_GlobalData::opt_tc (bool val)
+{
+ this->opt_tc_ = val;
+}
+
+bool
+BE_GlobalData::opt_tc (void) const
+{
+ return this->opt_tc_;
+}
+
+void
+BE_GlobalData::ami_call_back (bool val)
+{
+ this->ami_call_back_ = val;
+}
+
+bool
+BE_GlobalData::ami_call_back (void) const
+{
+ return this->ami_call_back_;
+}
+
+void
+BE_GlobalData::gen_amh_classes (bool val)
+{
+ this->gen_amh_classes_ = val;
+}
+
+bool
+BE_GlobalData::gen_amh_classes (void) const
+{
+ return this->gen_amh_classes_;
+}
+
+void
+BE_GlobalData::gen_tie_classes (bool val)
+{
+ this->gen_tie_classes_ = val;
+}
+
+bool
+BE_GlobalData::gen_tie_classes (void) const
+{
+ return this->gen_tie_classes_;
+}
+
+void
+BE_GlobalData::gen_smart_proxies (bool val)
+{
+ this->gen_smart_proxies_ = val;
+}
+
+bool
+BE_GlobalData::gen_smart_proxies (void) const
+{
+ return this->gen_smart_proxies_;
+}
+
+void
+BE_GlobalData::gen_inline_constants (bool val)
+{
+ this->gen_inline_constants_ = val;
+}
+
+bool
+BE_GlobalData::gen_inline_constants (void) const
+{
+ return this->gen_inline_constants_;
+}
+
+void
+BE_GlobalData::gen_dcps_type_support (bool val)
+{
+ this->gen_dcps_type_support_ = val;
+}
+
+bool
+BE_GlobalData::gen_dcps_type_support (void) const
+{
+ return this->gen_dcps_type_support_;
+}
+
+void
+BE_GlobalData::gen_orb_h_include (bool val)
+{
+ this->gen_orb_h_include_ = val;
+}
+
+bool
+BE_GlobalData::gen_orb_h_include (void) const
+{
+ return this->gen_orb_h_include_;
+}
+
+void
+BE_GlobalData::lookup_strategy (LOOKUP_STRATEGY s)
+{
+ this->lookup_strategy_ = s;
+}
+
+BE_GlobalData::LOOKUP_STRATEGY
+BE_GlobalData::lookup_strategy (void) const
+{
+ return this->lookup_strategy_;
+}
+
+void
+BE_GlobalData::destroy (void)
+{
+ ACE_OS::free (this->pch_include_);
+ this->pch_include_ = 0;
+
+ ACE_OS::free (this->pre_include_);
+ this->pre_include_ = 0;
+
+ ACE_OS::free (this->post_include_);
+ this->post_include_ = 0;
+
+ ACE_OS::free (this->include_guard_);
+ this->include_guard_ = 0;
+
+ ACE_OS::free (this->safe_include_);
+ this->safe_include_ = 0;
+
+ 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;
+
+ delete [] this->anyop_hdr_ending_;
+ this->anyop_hdr_ending_ = 0;
+
+ delete [] this->anyop_src_ending_;
+ this->anyop_src_ending_ = 0;
+
+ delete [] this->output_dir_;
+ this->output_dir_ = 0;
+
+ delete [] this->anyop_output_dir_;
+ this->anyop_output_dir_ = 0;
+
+ if (0 != this->messaging_)
+ {
+ this->messaging_->destroy ();
+ delete this->messaging_;
+ this->messaging_ = 0;
+ }
+
+ if (0 != this->messaging_exceptionholder_)
+ {
+ this->messaging_exceptionholder_->destroy ();
+ delete this->messaging_exceptionholder_;
+ this->messaging_exceptionholder_ = 0;
+ }
+
+ if (0 != this->messaging_replyhandler_)
+ {
+ this->messaging_replyhandler_->destroy ();
+ delete this->messaging_replyhandler_;
+ this->messaging_replyhandler_ = 0;
+ }
+
+ if (0 != tao_cg)
+ {
+ tao_cg->destroy ();
+ }
+}
+
+AST_PredefinedType *
+BE_GlobalData:: void_type (void)
+{
+ if (0 == this->void_type_)
+ {
+ AST_Decl *d =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ AST_Expression::EV_void
+ );
+ this->void_type_ = AST_PredefinedType::narrow_from_decl (d);
+ }
+
+ return this->void_type_;
+}
+
+be_interface *
+BE_GlobalData::ccmobject (void)
+{
+ if (0 == this->ccmobject_)
+ {
+ Identifier *local_id = 0;
+ ACE_NEW_RETURN (local_id,
+ Identifier ("CCMObject"),
+ 0);
+ UTL_ScopedName *local_name = 0;
+ ACE_NEW_RETURN (local_name,
+ UTL_ScopedName (local_id, 0),
+ 0);
+
+ Identifier *module_id = 0;
+ ACE_NEW_RETURN (module_id,
+ Identifier ("Components"),
+ 0);
+ UTL_ScopedName sn (module_id,
+ local_name);
+
+ AST_Decl *d =
+ idl_global->scopes ().top_non_null ()->lookup_by_name (&sn,
+ true);
+
+ sn.destroy ();
+
+ if (0 == d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_global::ccmobject - "
+ "lookup of CCMObject failed\n"),
+ 0);
+ }
+
+ this->ccmobject_ = be_interface::narrow_from_decl (d);
+ }
+
+ return this->ccmobject_;
+}
+
+be_module *
+BE_GlobalData::messaging (void)
+{
+ if (0 == this->messaging_)
+ {
+ Identifier *id = 0;
+ UTL_ScopedName *sn = 0;
+
+ ACE_NEW_RETURN (id,
+ Identifier ("Messaging"),
+ 0);
+
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (id,
+ 0),
+ 0);
+
+ ACE_NEW_RETURN (this->messaging_,
+ be_module (sn),
+ 0);
+
+ this->messaging_->set_name (sn);
+ }
+
+ return this->messaging_;
+}
+
+be_valuetype *
+BE_GlobalData::messaging_exceptionholder (void)
+{
+ if (0 == this->messaging_exceptionholder_)
+ {
+ Identifier *id = 0;
+ be_module *msg = this->messaging ();
+ idl_global->scopes ().push (msg);
+
+ ACE_NEW_RETURN (id,
+ Identifier ("Messaging"),
+ 0);
+
+ // Create a valuetype "ExceptionHolder"
+ // from which we inherit.
+ UTL_ScopedName *full_name = 0;
+ ACE_NEW_RETURN (full_name,
+ UTL_ScopedName (id,
+ 0),
+ 0);
+
+ ACE_NEW_RETURN (id,
+ Identifier ("ExceptionHolder"),
+ 0);
+
+ UTL_ScopedName *local_name = 0;
+ ACE_NEW_RETURN (local_name,
+ UTL_ScopedName (id,
+ 0),
+ 0);
+
+ full_name->nconc (local_name);
+
+ ACE_NEW_RETURN (this->messaging_exceptionholder_,
+ be_valuetype (full_name,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0),
+ 0);
+
+ this->messaging_exceptionholder_->set_name (full_name);
+
+ // Notice the valuetype "ExceptionHolder" that it is defined in the
+ // "Messaging" module
+ this->messaging_exceptionholder_->set_defined_in (msg);
+ this->messaging_exceptionholder_->set_prefix_with_typeprefix (
+ "omg.org"
+ );
+
+ idl_global->scopes ().pop ();
+
+ // Notice the interface "ReplyHandler" that it is defined in the
+ // "Messaging" module.
+ this->messaging_exceptionholder_->set_defined_in (msg);
+ }
+
+ return this->messaging_exceptionholder_;
+}
+
+be_valuetype *
+BE_GlobalData::exceptionholder (void) const
+{
+ return this->exceptionholder_;
+}
+
+void
+BE_GlobalData::exceptionholder (be_valuetype *val)
+{
+ this->exceptionholder_ = val;
+}
+
+be_interface *
+BE_GlobalData::messaging_replyhandler (void)
+{
+ if (0 == this->messaging_replyhandler_)
+ {
+ be_module *msg = this->messaging ();
+ idl_global->scopes ().push (msg);
+
+ Identifier *id = 0;
+ UTL_ScopedName *local_name = 0;
+
+ // Create a virtual module named "Messaging"
+ // "and an interface "ReplyHandler"
+ // from which we inherit.
+ ACE_NEW_RETURN (id,
+ Identifier ("Messaging"),
+ 0);
+
+ UTL_ScopedName *full_name = 0;
+ ACE_NEW_RETURN (full_name,
+ UTL_ScopedName (id,
+ 0),
+ 0);
+
+ ACE_NEW_RETURN (id,
+ Identifier ("ReplyHandler"),
+ 0);
+
+ ACE_NEW_RETURN (local_name,
+ UTL_ScopedName (id,
+ 0),
+ 0);
+
+ full_name->nconc (local_name);
+
+ ACE_NEW_RETURN (this->messaging_replyhandler_,
+ be_interface (full_name,
+ 0, // inherited interfaces
+ 0, // number of inherited interfaces
+ 0, // ancestors
+ 0, // number of ancestors
+ 0, // not local
+ 0), // not abstract
+ 0);
+
+ this->messaging_replyhandler_->set_name (full_name);
+ this->messaging_replyhandler_->set_prefix_with_typeprefix ("omg.org");
+
+ idl_global->scopes ().pop ();
+
+ // Notice the interface "ReplyHandler" that it is defined in the
+ // "Messaging" module.
+ this->messaging_replyhandler_->set_defined_in (msg);
+ }
+
+ return this->messaging_replyhandler_;
+}
+
+bool
+BE_GlobalData::gen_anyop_files (void) const
+{
+ return this->gen_anyop_files_;
+}
+
+void
+BE_GlobalData::gen_anyop_files (bool val)
+{
+ this->gen_anyop_files_ = val;
+}
+
+bool
+BE_GlobalData::gen_skel_files (void) const
+{
+ return this->gen_skel_files_;
+}
+
+void
+BE_GlobalData::gen_skel_files (bool val)
+{
+ this->gen_skel_files_ = val;
+}
+
+bool
+BE_GlobalData::gen_client_inline (void) const
+{
+ return this->gen_client_inline_;
+}
+
+void
+BE_GlobalData::gen_client_inline (bool val)
+{
+ this->gen_client_inline_ = val;
+}
+
+bool
+BE_GlobalData::gen_server_inline (void) const
+{
+ return this->gen_server_inline_;
+}
+
+void
+BE_GlobalData::gen_server_inline (bool val)
+{
+ this->gen_server_inline_ = val;
+}
+
+bool
+BE_GlobalData::gen_local_iface_anyops (void) const
+{
+ return this->gen_local_iface_anyops_;
+}
+
+void
+BE_GlobalData::gen_local_iface_anyops (bool val)
+{
+ this->gen_local_iface_anyops_ = val;
+}
+
+ACE_CString
+BE_GlobalData::spawn_options (void)
+{
+ return idl_global->idl_flags ();
+}
+
+void
+BE_GlobalData::parse_args (long &i, char **av)
+{
+ switch (av[i][1])
+ {
+ // = Various 'h'eader_file_name_endings.
+ case 'h':
+
+ // <-hc Client's header file name ending>
+ // Default is "C.h".
+ // <-hs Server's header file name ending>
+ // Default is "S.h".
+ // <-hT Server's template hdr file name ending>
+ // Default is "S_T.h".
+ // <-hI Server's implementation header file name ending>
+ // Default is "I.h".
+
+ if (av[i][2] == 'c')
+ {
+ // Client stub's header file ending.
+ // @@ No error handling done here.
+ idl_global->append_idl_flag (av[i + 1]);
+ be_global->client_hdr_ending (av[i + 1]);
+ ++i;
+ }
+ else if (av[i][2] == 's')
+ {
+ // Server skeleton's header file.
+ idl_global->append_idl_flag (av[i + 1]);
+ be_global->server_hdr_ending (av[i + 1]);
+ ++i;
+ }
+ else if (av[i][2] == 'T')
+ {
+ // Server template header ending.
+ idl_global->append_idl_flag (av[i + 1]);
+ be_global->server_template_hdr_ending (av[i + 1]);
+ ++i;
+ }
+ else if (av[i][2] == 'I')
+ {
+ // Server implementation header ending.
+ idl_global->append_idl_flag (av[i + 1]);
+ be_global->implementation_hdr_ending (av[i + 1]);
+ ++i;
+ }
+ else
+ {
+ // I expect 'c' or 's' or 'I' or 'T' after this.
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
+ av[i]
+ ));
+ }
+
+ break;
+ // = Various 'c'lient side stub file_name_endings.
+ case 'c':
+ // <-cs Client stub's file name ending>
+ // Default is "C.cpp".
+ // <-ci Client inline file name ending>
+ // Default is "C.inl".
+
+ if (av[i][2] == 's')
+ {
+ idl_global->append_idl_flag (av[i + 1]);
+ be_global->client_stub_ending (av[i + 1]);
+ i++;
+ }
+ else if (av[i][2] == 'i')
+ {
+ idl_global->append_idl_flag (av[i + 1]);
+ be_global->client_inline_ending (av[i + 1]);
+ i++;
+ }
+ else
+ {
+ // I expect 's' or 'i' after 'c'.
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
+ av[i]
+ ));
+ }
+
+ break;
+ // = Various 's'erver side skeleton file name endings.
+ case 's':
+ // <-ss Server's skeleton file name ending>
+ // Default is "S.cpp".
+ // <-sT Server's template skeleton file name ending>
+ // Default is "S_T.cpp".
+ // <-si Server's inline file name ending>
+ // Default is "S.inl".
+ // <-st Server's template inline file name ending>
+ // Default is "S_T.inl".
+ // <-sI Server's implementation skeleton file name ending>
+ // Default is "I.cpp".
+
+ if (av[i][2] == 's')
+ {
+ idl_global->append_idl_flag (av[i + 1]);
+ be_global->server_skeleton_ending (av[i + 1]);
+ ++i;
+ }
+ else if (av[i][2] == 'T')
+ {
+ idl_global->append_idl_flag (av[i + 1]);
+ be_global->server_template_skeleton_ending (av[i + 1]);
+ ++i;
+ }
+ else if (av[i][2] == 'i')
+ {
+ idl_global->append_idl_flag (av[i + 1]);
+ be_global->server_inline_ending (av[i + 1]);
+ ++i;
+ }
+ else if (av[i][2] == 't')
+ {
+ idl_global->append_idl_flag (av[i + 1]);
+ be_global->server_template_inline_ending (av[i + 1]);
+ ++i;
+ }
+ else if (av[i][2] == 'I')
+ {
+ idl_global->append_idl_flag (av[i + 1]);
+ be_global->implementation_skel_ending (av[i + 1]);
+ ++i;
+ }
+ else
+ {
+ // I expect 's' or 'T' or 'i' or 't' after 's'.
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
+ av[i]
+ ));
+ }
+
+ break;
+ // Operation lookup strategy.
+ // <perfect_hash>, <dynamic_hash> or <binary_search>
+ // Default is perfect.
+ case 'H':
+ idl_global->append_idl_flag (av[i + 1]);
+
+ if (av[i + 1] == 0 || av[i + 1][0] == '-')
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("no selection for -H option\n")));
+ }
+ else if (ACE_OS::strcmp (av[i+1], "dynamic_hash") == 0)
+ {
+ be_global->lookup_strategy (
+ BE_GlobalData::TAO_DYNAMIC_HASH
+ );
+ }
+ else if (ACE_OS::strcmp (av[i + 1], "perfect_hash") == 0)
+ {
+ be_global->lookup_strategy (
+ BE_GlobalData::TAO_PERFECT_HASH
+ );
+ }
+ else if (ACE_OS::strcmp (av[i + 1], "binary_search") == 0)
+ {
+ be_global->lookup_strategy (
+ BE_GlobalData::TAO_BINARY_SEARCH
+ );
+ }
+ else if (ACE_OS::strcmp (av[i + 1], "linear_search") == 0)
+ {
+ be_global->lookup_strategy (
+ BE_GlobalData::TAO_LINEAR_SEARCH
+ );
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("%s: unknown operation lookup <%s>\n"),
+ av[0],
+ av[i + 1]));
+ }
+
+ ++i;
+ break;
+ // Switching between ""s and <>s when we generate
+ // #include statements for the standard files (e.g. tao/corba.h)
+ case 'i':
+ if (av[i][2] == 'c')
+ {
+ be_global->changing_standard_include_files (1);
+ }
+ else if (av[i][2] == 'n')
+ {
+ be_global->changing_standard_include_files (0);
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
+ av[i]
+ ));
+ }
+
+ break;
+ // Path for the perfect hash generator(gperf) program. Default
+ // is $ACE_ROOT/bin/gperf.
+ case 'g':
+ if (av[i][2] == '\0')
+ {
+ idl_global->append_idl_flag (av[i + 1]);
+ ACE_CString tmp (av[i + 1], 0, 0);
+#if defined (ACE_WIN32)
+ // WIN32's CreateProcess needs the full executable name
+ // when the gperf path is modified, but not for the default
+ // path given above. Other platforms don't need the
+ // executable name at all.
+ tmp += "\\gperf.exe";
+#endif
+ idl_global->gperf_path (tmp.fast_rep ());
+ ++i;
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand")
+ ACE_TEXT (" the '%s' option\n"),
+ av[i]
+ ));
+ }
+
+ break;
+ // Directory where all the IDL-Compiler-Generated files are to
+ // be kept. Default is the current directory from which the
+ // <tao_idl> is called.
+ case 'o':
+ if (av[i][2] == '\0')
+ {
+ idl_global->append_idl_flag (av[i + 1]);
+ int result = ACE_OS::mkdir (av[i + 1]);
+
+ #if !defined (__BORLANDC__)
+ if (result != 0 && errno != EEXIST)
+ #else
+ // The Borland RTL doesn't give EEXIST back, only EACCES in case
+ // the directory exists, reported to Borland as QC 9495
+ if (result != 0 && errno != EEXIST && errno != EACCES)
+ #endif
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: unable to create directory %s")
+ ACE_TEXT (" specified by -o option\n"),
+ av[i + 1]
+ ));
+
+ break;
+ }
+
+ be_global->output_dir (av[i + 1]);
+ ++i;
+ }
+ else if (av[i][2] == 'A')
+ {
+ if (av[i][3] == '\0')
+ {
+ idl_global->append_idl_flag (av[i + 1]);
+ int result = ACE_OS::mkdir (av[i + 1]);
+
+ #if !defined (__BORLANDC__)
+ if (result != 0 && errno != EEXIST)
+ #else
+ // The Borland RTL doesn't give EEXIST back, only EACCES in
+ // case the directory exists, reported to Borland as QC 9495
+ if (result != 0 && errno != EEXIST && errno != EACCES)
+ #endif
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: unable to create directory %s")
+ ACE_TEXT (" specified by -oA option\n"),
+ av[i + 1]
+ ));
+
+ break;
+ }
+
+ be_global->anyop_output_dir (av[i + 1]);
+ ++i;
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand")
+ ACE_TEXT (" the '%s' option\n"),
+ av[i]
+ ));
+ }
+ }
+ else if (av[i][2] == 'S')
+ {
+ if (av[i][3] == '\0')
+ {
+ idl_global->append_idl_flag (av[i + 1]);
+ int result = ACE_OS::mkdir (av[i + 1]);
+
+ #if !defined (__BORLANDC__)
+ if (result != 0 && errno != EEXIST)
+ #else
+ // The Borland RTL doesn't give EEXIST back, only EACCES in
+ // case the directory exists, reported to Borland as QC 9495
+ if (result != 0 && errno != EEXIST && errno != EACCES)
+ #endif
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: unable to create directory %s")
+ ACE_TEXT (" specified by -oS option\n"),
+ av[i + 1]
+ ));
+
+ break;
+ }
+
+ be_global->skel_output_dir (av[i + 1]);
+ ++i;
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand")
+ ACE_TEXT (" the '%s' option\n"),
+ av[i]
+ ));
+ }
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand")
+ ACE_TEXT (" the '%s' option\n"),
+ av[i]
+ ));
+ }
+
+ break;
+ case 'G':
+ // Enable generation of ...
+ if (av[i][2] == 'C')
+ {
+ // AMI with Call back.
+ be_global->ami_call_back (true);
+ }
+ else if (av[i][2] == 'T')
+ {
+ // Generate tie classes and files
+ be_global->gen_tie_classes (true);
+ }
+ else if (av[i][2] == 'H')
+ {
+ // AMH classes.
+ be_global->gen_amh_classes (true);
+ }
+ else if (av[i][2] == 'A')
+ {
+ // TAO-team-only, undocumented option to generate
+ // Any operators into a separate set of files.
+ be_global->gen_anyop_files (true);
+ }
+ else if (av[i][2] == 'e')
+ {
+ idl_global->append_idl_flag (av[i + 1]);
+ int option = ACE_OS::atoi (av[i + 1]);
+
+ // Exception support.
+ be_global->exception_support (option == 0
+ || option == 2);
+
+ // Use of raw 'throw'.
+ be_global->use_raw_throw (option == 2);
+ ++i;
+ }
+ else if (av[i][2] == 's')
+ {
+ if (av[i][3] == 'p')
+ {
+ // Smart proxies.
+ be_global->gen_smart_proxies (true);
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand ")
+ ACE_TEXT ("the '%s' option\n"),
+ av[i]
+ ));
+ }
+
+ break;
+ }
+ else if (av[i][2] == 'u')
+ {
+ if (av[i][3] == 'c')
+ {
+ // Inline constants.
+ be_global->gen_inline_constants (false);
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand ")
+ ACE_TEXT ("the '%s' option\n"),
+ av[i]
+ ));
+ }
+
+ break;
+ }
+ else if (av[i][2] == 't')
+ {
+ // Optimized typecode generation.
+ be_global->opt_tc (1);
+ }
+ else if (av[i][2] == 'p')
+ {
+ // Generating Thru_POA collocated stubs.
+ be_global->gen_thru_poa_collocation (true);
+ }
+ else if (av[i][2] == 'd')
+ {
+ if (av[i][3] == 'c')
+ {
+ if (av[i][4] == 'p' && av[i][5] =='s' && '\0' == av[i][6])
+ {
+ // DDS DCSP type support.
+ be_global->gen_dcps_type_support (true);
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand ")
+ ACE_TEXT ("the '%s' option\n"),
+ av[i]
+ ));
+ }
+ }
+ else if ('\0' == av[i][3])
+ {
+ // Generating Direct collocated stubs.
+ be_global->gen_direct_collocation (true);
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand ")
+ ACE_TEXT ("the '%s' option\n"),
+ av[i]
+ ));
+ }
+ }
+ else if (av[i][2] == 'I')
+ {
+ size_t options = ACE_OS::strlen (av[i]) - 3;
+ size_t j;
+ size_t k = i;
+ // Generate implementation files.
+ be_global->gen_impl_files (1);
+
+ for (j = 0; j < options; ++j)
+ {
+ if (av[k][j + 3] == 's')
+ {
+ idl_global->append_idl_flag (av[i + 1]);
+ be_global->implementation_skel_ending (av[i + 1]);
+ ++i;
+ }
+ else if (av[k][j + 3] == 'h')
+ {
+ idl_global->append_idl_flag (av[i + 1]);
+ be_global->implementation_hdr_ending (av[i + 1]);
+ ++i;
+ }
+ else if (av[k][j + 3] == 'b')
+ {
+ idl_global->append_idl_flag (av[i + 1]);
+ be_global->impl_class_prefix (av[i + 1]);
+ ++i;
+ }
+ else if (av[k][j + 3] == 'e')
+ {
+ idl_global->append_idl_flag (av[i + 1]);
+ be_global->impl_class_suffix (av[i + 1]);
+ ++i;
+ }
+ else if (av[k][j + 3] == 'c')
+ {
+ be_global->gen_copy_ctor (true);
+ }
+ else if (av[k][j + 3] == 'a')
+ {
+ be_global->gen_assign_op (true);
+ }
+ else if (av[k][j + 3] == 'd')
+ {
+ be_global->gen_impl_debug_info (true);
+ }
+ else if (isalpha (av[k][j + 3] ))
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand")
+ ACE_TEXT (" the '%s' option\n"),
+ av[i]
+ ));
+
+ idl_global->set_compile_flags (
+ idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE
+ );
+ }
+ }
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
+ av[i]
+ ));
+ }
+
+ break;
+ case 'S':
+ // Suppress generation of...
+ if (av[i][2] == 'a')
+ {
+ if (av[i][3] == 'l')
+ {
+ // Suppress Any support for local interfaces.
+ be_global->gen_local_iface_anyops (false);
+ }
+ else
+ {
+ // Suppress all Any support.
+ be_global->any_support (false);
+ }
+ }
+ else if (av[i][2] == 'o' && av[i][3] == 'r' && av[i][4] =='b' && '\0' == av[i][5])
+ {
+ be_global->gen_orb_h_include (false);
+ }
+ else if (av[i][2] == 't')
+ {
+ // Suppress typecode generation
+ // Anys must be suppressed as well.
+ be_global->tc_support (false);
+ be_global->any_support (false);
+ }
+ else if (av[i][2] == 'p')
+ {
+ // Suppress generating Thru_POA collocated stubs.
+ be_global->gen_thru_poa_collocation (false);
+ }
+ else if (av[i][2] == 'd')
+ {
+ // sSppress generating Direct collocated stubs.
+ be_global->gen_direct_collocation (false);
+ }
+ else if (av[i][2] == 'c')
+ {
+ if (av[i][3] == 'i')
+ {
+ // No stub inline.
+ be_global->gen_client_inline (false);
+ }
+ }
+ else if (av[i][2] == 'm')
+ {
+ // Turn off ccm preprocessing.
+ idl_global->ignore_idl3 (true);
+ }
+ else if (av[i][2] == 'S')
+ {
+ // Disable skeleton file generation.
+ be_global->gen_skel_files (false);
+ }
+ else if (av[i][2] == 's')
+ {
+ if (av[i][3] == 'i')
+ {
+ // No skeleton inline.
+ be_global->gen_server_inline (false);
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
+ av[i]
+ ));
+ }
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
+ av[i]
+ ));
+ }
+
+ break;
+ default:
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
+ av[i]
+ ));
+
+ idl_global->set_compile_flags (idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE);
+ break;
+ }
+}
+
+// Prepare an argument for a BE
+void
+BE_GlobalData::prep_be_arg (char *s)
+{
+ static const char arg_macro[] = "export_macro=";
+ static const char arg_include[] = "export_include=";
+ static const char skel_arg_macro[] = "skel_export_macro=";
+ static const char skel_arg_include[] = "skel_export_include=";
+ static const char stub_arg_macro[] = "stub_export_macro=";
+ static const char stub_arg_include[] = "stub_export_include=";
+ static const char anyop_arg_macro[] = "anyop_export_macro=";
+ static const char anyop_arg_include[] = "anyop_export_include=";
+ static const char arg_pch_include[] = "pch_include=";
+ static const char arg_pre_include[] = "pre_include=";
+ static const char arg_post_include[] = "post_include=";
+ static const char arg_versioning_begin[] = "versioning_begin=";
+ static const char arg_versioning_end[] = "versioning_end=";
+ static const char obv_opt_accessor[] = "obv_opt_accessor";
+ static const char include_guard[] = "include_guard=";
+ static const char safe_include[] = "safe_include=";
+
+ char* last = 0;
+
+ for (char* arg = ACE_OS::strtok_r (s, ",", &last);
+ arg != 0;
+ arg = ACE_OS::strtok_r (0, ",", &last))
+ {
+ if (ACE_OS::strstr (arg, arg_macro) == arg)
+ {
+ char* val = arg + sizeof (arg_macro) - 1;
+ be_global->skel_export_macro (val);
+ be_global->stub_export_macro (val);
+ be_global->anyop_export_macro (val);
+ }
+ else if (ACE_OS::strstr (arg, arg_include) == arg)
+ {
+ char* val = arg + sizeof (arg_include) - 1;
+ be_global->stub_export_include (val);
+ }
+ else if (ACE_OS::strstr (arg, skel_arg_macro) == arg)
+ {
+ char* val = arg + sizeof (skel_arg_macro) - 1;
+ be_global->skel_export_macro (val);
+ }
+ else if (ACE_OS::strstr (arg, skel_arg_include) == arg)
+ {
+ char* val = arg + sizeof (skel_arg_include) - 1;
+ be_global->skel_export_include (val);
+ }
+ else if (ACE_OS::strstr (arg, stub_arg_macro) == arg)
+ {
+ char* val = arg + sizeof (stub_arg_macro) - 1;
+ be_global->stub_export_macro (val);
+ }
+ else if (ACE_OS::strstr (arg, stub_arg_include) == arg)
+ {
+ char* val = arg + sizeof (stub_arg_include) - 1;
+ be_global->stub_export_include (val);
+ }
+ else if (ACE_OS::strstr (arg, anyop_arg_macro) == arg)
+ {
+ char* val = arg + sizeof (anyop_arg_macro) - 1;
+ be_global->anyop_export_macro (val);
+ }
+ else if (ACE_OS::strstr (arg, anyop_arg_include) == arg)
+ {
+ char* val = arg + sizeof (anyop_arg_include) - 1;
+ be_global->anyop_export_include (val);
+ }
+ else if (ACE_OS::strstr (arg, arg_pch_include) == arg)
+ {
+ char* val = arg + sizeof (arg_pch_include) - 1;
+ be_global->pch_include (val);
+ }
+ else if (ACE_OS::strstr (arg, arg_pre_include) == arg)
+ {
+ char* val = arg + sizeof (arg_pre_include) - 1;
+ be_global->pre_include (val);
+ }
+ else if (ACE_OS::strstr (arg, arg_post_include) == arg)
+ {
+ char* val = arg + sizeof (arg_post_include) - 1;
+ be_global->post_include (val);
+ }
+ else if (ACE_OS::strstr (arg, include_guard) == arg)
+ {
+ char* val = arg + sizeof (include_guard) - 1;
+ be_global->include_guard (val);
+ }
+ else if (ACE_OS::strstr (arg, safe_include) == arg)
+ {
+ char* val = arg + sizeof (safe_include) - 1;
+ be_global->safe_include (val);
+ }
+ else if (ACE_OS::strstr (arg, obv_opt_accessor) == arg)
+ {
+ be_global->obv_opt_accessor (1);
+ }
+ else if (ACE_OS::strstr (arg, arg_versioning_begin) == arg)
+ {
+ char const * const val = arg + sizeof (arg_versioning_begin) - 1;
+ be_global->versioning_begin (val);
+ }
+ else if (ACE_OS::strstr (arg, arg_versioning_end) == arg)
+ {
+ char const * const val = arg + sizeof (arg_versioning_end) - 1;
+ be_global->versioning_end (val);
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("%s%s%s%s"),
+ idl_global->prog_name (),
+ ACE_TEXT (": invalid or unknown argument <"),
+ arg,
+ ACE_TEXT ("> to back end\n")));
+ }
+ }
+}
+
+void
+BE_GlobalData::arg_post_proc (void)
+{
+ // Let us try to use Perfect Hashing Operation Lookup Strategy. Let
+ // us check whether things are fine with GPERF.
+#if defined (ACE_HAS_GPERF)
+ // If Perfect Hashing or Binary Search or Linear Search strategies
+ // have been selected, let us make sure that it exists and will
+ // work.
+ if ((be_global->lookup_strategy () == BE_GlobalData::TAO_PERFECT_HASH) ||
+ (be_global->lookup_strategy () == BE_GlobalData::TAO_BINARY_SEARCH) ||
+ (be_global->lookup_strategy () == BE_GlobalData::TAO_LINEAR_SEARCH))
+ {
+ // Testing whether GPERF works or no.
+ int return_value = idl_global->check_gperf ();
+ if (return_value == -1)
+ {
+ // If gperf_path is an absolute path, try to call this
+ // again with
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT ("TAO_IDL: warning, GPERF could not be executed\n")
+ ACE_TEXT ("Perfect Hashing or Binary/Linear Search cannot be")
+ ACE_TEXT (" done without GPERF\n")
+ ACE_TEXT ("Now, using Dynamic Hashing..\n")
+ ACE_TEXT ("To use Perfect Hashing or Binary/Linear")
+ ACE_TEXT (" Search strategy\n")
+ ACE_TEXT ("\t-Build gperf at $ACE_ROOT/apps/gperf/src\n")
+ ACE_TEXT ("\t-Set the environment variable $ACE_ROOT")
+ ACE_TEXT (" appropriately or add $ACE_ROOT/bin to the PATH\n")
+ ACE_TEXT ("\t-Refer to Operation Lookup section in the TAO IDL")
+ ACE_TEXT (" User Guide ($TAO_ROOT/docs/compiler.html)")
+ ACE_TEXT (" for more details\n")
+ ));
+
+ // Switching over to Dynamic Hashing.
+ be_global->lookup_strategy (BE_GlobalData::TAO_DYNAMIC_HASH);
+ }
+ }
+#else /* Not ACE_HAS_GPERF */
+ // If GPERF is not there, we cannot use PERFECT_HASH strategy. Let
+ // us go for DYNAMIC_HASH.
+ if ((be_global->lookup_strategy () == BE_GlobalData::TAO_PERFECT_HASH) ||
+ (be_global->lookup_strategy () == BE_GlobalData::TAO_BINARY_SEARCH) ||
+ (be_global->lookup_strategy () == BE_GlobalData::TAO_LINEAR_SEARCH))
+ {
+ be_global->lookup_strategy (BE_GlobalData::TAO_DYNAMIC_HASH);
+ }
+#endif /* ACE_HAS_GPERF */
+
+ // Make sure that we are not suppressing TypeCode generation and asking for
+ // optimized typecode support at the same time.
+ if (!be_global->tc_support () && be_global->opt_tc ())
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Bad Combination -St and -Gt \n")));
+ }
+}
+
+void
+BE_GlobalData::usage (void) const
+{
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Wb,export_macro=<macro name>\t\t\tsets export macro ")
+ ACE_TEXT ("for all files\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Wb,export_include=<include path>\t\tsets export include ")
+ ACE_TEXT ("file for all files\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Wb,stub_export_macro=<macro name>\t\tsets export ")
+ ACE_TEXT ("macro for client files only\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Wb,stub_export_include=<include path>\t\tsets export ")
+ ACE_TEXT ("include file for client only\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Wb,skel_export_macro=<macro name>\t\tsets export ")
+ ACE_TEXT ("macro for server files only\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Wb,skel_export_include=<include path>\t\tsets export ")
+ ACE_TEXT ("include file for server only\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Wb,anyop_export_macro=<macro name>\t\tsets export macro ")
+ ACE_TEXT ("for typecode/Any operator files only, when -GA option ")
+ ACE_TEXT ("is used\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Wb,anyop_export_include=<include path>\tsets export ")
+ ACE_TEXT ("include file typecode/Any operator files only, when -GA ")
+ ACE_TEXT ("option is used\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Wb,pch_include=<include path>\t\t\tsets include ")
+ ACE_TEXT ("file for precompiled header mechanism\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Wb,pre_include=<include path>\t\t\tsets include ")
+ ACE_TEXT ("file generate before any other includes\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Wb,post_include=<include path>\t\tsets include ")
+ ACE_TEXT ("file generated at the end of the file\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Wb,include_guard=<include path>\t\tguard to prevent ")
+ ACE_TEXT ("the generated client header file\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Wb,safe_include=<include path>\t\tinclude that should ")
+ ACE_TEXT ("be used instead of the own generated client header file\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Wb,obv_opt_accessor\t\t\t\toptimizes access to base class ")
+ ACE_TEXT ("data in valuetypes\n")
+ ));
+#if (defined (ACE_HAS_VERSIONED_NAMESPACE) \
+ && ACE_HAS_VERSIONED_NAMESPACE == 1) \
+ || (defined (TAO_HAS_VERSIONED_NAMESPACE) \
+ && TAO_HAS_VERSIONED_NAMESPACE == 1)
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Wb,versioning_begin\t\t\tSet text that opens a ")
+ ACE_TEXT ("a \"versioned\" namespace\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Wb,versioning_end\t\t\tSet text that closes a ")
+ ACE_TEXT ("a \"versioned\" namespace\n")
+ ));
+#endif /* ACE_HAS_VERSIONED_NAMESPACE || TAO_HAS_VERSIONED_NAMESPACE */
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -ci\t\t\tClient inline file name ending. Default is C.inl\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -cs\t\t\tClient stub's file name ending.")
+ ACE_TEXT (" Default is C.cpp\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -g <gperf_path>\tPath for the GPERF program.")
+ ACE_TEXT (" Default is $ACE_ROOT/bin/gperf\n")));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -GC \t\t\tGenerate the AMI classes\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -GH \t\t\tGenerate the AMH classes\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Gd \t\t\tGenerate the code for direct collocation. Default ")
+ ACE_TEXT ("is thru-POA collocation\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Ge [0|1]\t\tDisable/Enable generation of")
+ ACE_TEXT (" CORBA::Environment arguments (disabled by default")
+ ACE_TEXT (" if ACE_HAS_EXCEPTIONS)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Ge 2\t\t\tUse raw throw instead of ACE_THROW macro")
+ ACE_TEXT (" (disabled by default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -GI[h|s|b|e|c|a|d]\tGenerate Implementation Files \n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" \t\t\th - Implementation header file name ending.")
+ ACE_TEXT (" Default is I.h \n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" \t\t\ts - Implementation skeleton file name ending.")
+ ACE_TEXT (" Default is I.cpp\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" \t\t\tb - Prefix to the implementation class names.")
+ ACE_TEXT (" Default is 'no prefix' \n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" \t\t\te - Suffix to the implementation class names.")
+ ACE_TEXT (" Default is _i\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" \t\t\tc - Generate copy constructors in the servant")
+ ACE_TEXT (" implementation template files (off by default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" \t\t\ta - Generate assignment operators in the servant")
+ ACE_TEXT (" implementation template files (off by default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" \t\t\td - Generate debug (source file/line#) information.")
+ ACE_TEXT (" (off by default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Gp \t\t\tGenerate the code for thru-POA collocation")
+ ACE_TEXT (" (default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Gsp\t\t\tGenerate the code for Smart Proxies\n")
+ ));
+ 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 (" -GT\t\t\tgenerate tie class (and file)")
+ ACE_TEXT (" generation (disabled by default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" \t\t\tNo effect if TypeCode generation is suppressed\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -GA\t\t\tgenerate Any operator and type code bodies in *A.cpp")
+ ACE_TEXT (" (generated in *C.cpp by default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Guc\t\t\tgenerate uninlined constant if declared ")
+ ACE_TEXT ("in a module")
+ ACE_TEXT (" (inlined 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")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -hs\t\t\tServer's header file name ending.")
+ ACE_TEXT (" Default is S.h\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -hT\t\t\tServer's template hdr file name ending.")
+ ACE_TEXT (" Default is S_T.h\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -H perfect_hash\tTo force perfect hashed operation")
+ ACE_TEXT (" lookup strategy (default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -H dynamic_hash\tTo force dynamic hashed operation")
+ ACE_TEXT (" lookup strategy. Default is perfect hashing\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -H linear_search\tTo force linear search operation")
+ ACE_TEXT (" lookup strategy\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -H binary_search\tTo force binary search operation")
+ ACE_TEXT (" lookup strategy\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -in \t\t\tTo generate <>s for standard #include'd")
+ ACE_TEXT (" files (non-changing files)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -ic \t\t\tTo generate \"\"s for standard #include'd")
+ ACE_TEXT (" files (changing files)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -o <output_dir>\tOutput directory for the generated files.")
+ ACE_TEXT (" Default is current directory\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -oS <output_dir>\tOutput directory for the generated ")
+ ACE_TEXT ("skeleton files. Default is -o value or current directory\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -oA <output_dir>\tOutput directory for the generated anyop")
+ ACE_TEXT ("files. Default is -o value or current directory\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -si\t\t\tServer's inline file name ending.")
+ ACE_TEXT (" Default is S.inl\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -ss\t\t\tServer's skeleton file name ending.")
+ ACE_TEXT (" Default is S.cpp\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -st\t\t\tServer's template inline file name ending.")
+ ACE_TEXT (" Default S_T.inl\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -sT\t\t\tServer's template skeleton file name ending.")
+ ACE_TEXT (" Default is S_T.cpp\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Sa\t\t\tsuppress Any support")
+ ACE_TEXT (" (support enabled by default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Sal\t\t\tsuppress Any support")
+ ACE_TEXT (" for local interfaces")
+ ACE_TEXT (" (support enabled by default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -St\t\t\tsuppress TypeCode support")
+ ACE_TEXT (" (support enabled by default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Sp\t\t\tsuppress generating Thru POA collocated")
+ ACE_TEXT (" stubs (enabled by default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Sd\t\t\tsuppress generating Direct collocated")
+ ACE_TEXT (" stubs (disable by default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Sm\t\t\tdisable IDL3 equivalent IDL preprocessing")
+ ACE_TEXT (" (enabled by default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -SS\t\t\tsuppress generating skeleton implementation")
+ ACE_TEXT (" and inline file (disabled by default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Sci\t\t\tsuppress generating client inline file")
+ ACE_TEXT (" (disabled by default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Ssi\t\t\tsuppress generating server inline file")
+ ACE_TEXT (" (disabled by default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Sorb\t\t\tsuppress generating include of ORB.h")
+ ACE_TEXT (" (disabled by default)\n")
+ ));
+}
+
+AST_Generator *
+BE_GlobalData::generator_init (void)
+{
+ tao_cg = TAO_CODEGEN::instance ();
+ tao_cg->config_visitor_factory ();
+
+ AST_Generator *gen = 0;
+ ACE_NEW_RETURN (gen,
+ be_generator,
+ 0);
+
+ return gen;
+}
diff --git a/TAO/TAO_IDL/be/be_helper.cpp b/TAO/TAO_IDL/be/be_helper.cpp
new file mode 100644
index 00000000000..65a0a7cc4b4
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_helper.cpp
@@ -0,0 +1,595 @@
+// $Id$
+
+// ============================================================================
+//
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_helper.cpp
+//
+// = DESCRIPTION
+// Provides helper classes to print generated code to the output
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// Improvements by Carlos O'Ryan
+//
+// ============================================================================
+
+#include "be_helper.h"
+#include "be_codegen.h"
+#include "be_extern.h"
+#include "idl_defines.h"
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (be,
+ be_helper,
+ "$Id$")
+
+static const char copyright[] =
+"// -*- C++ -*-\n"
+"//\n"
+"// $I" "d$\n\n"
+"// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****\n"
+"// TAO and the TAO IDL Compiler have been developed by:\n"
+"// Center for Distributed Object Computing\n"
+"// Washington University\n"
+"// St. Louis, MO\n"
+"// USA\n"
+"// http://www.cs.wustl.edu/~schmidt/doc-center.html\n"
+"// and\n"
+"// Distributed Object Computing Laboratory\n"
+"// University of California at Irvine\n"
+"// Irvine, CA\n"
+"// USA\n"
+"// http://doc.ece.uci.edu/\n"
+"// and\n"
+"// Institute for Software Integrated Systems\n"
+"// Vanderbilt University\n"
+"// Nashville, TN\n"
+"// USA\n"
+"// http://www.isis.vanderbilt.edu/\n"
+"//\n"
+"// Information about TAO is available at:\n"
+"// http://www.cs.wustl.edu/~schmidt/TAO.html";
+
+TAO_NL::TAO_NL (void)
+{
+ ACE_UNUSED_ARG (copyright);
+}
+
+TAO_INDENT::TAO_INDENT (int do_now)
+ : do_now_ (do_now)
+{
+}
+
+TAO_UNINDENT::TAO_UNINDENT (int do_now)
+ : do_now_ (do_now)
+{
+}
+
+const TAO_NL be_nl;
+const TAO_INDENT be_idt;
+const TAO_INDENT be_idt_nl (1);
+const TAO_UNINDENT be_uidt;
+const TAO_UNINDENT be_uidt_nl (1);
+
+TAO_ENV_ARG::TAO_ENV_ARG (bool with_defaults,
+ bool single,
+ bool arg,
+ bool not_used)
+ : with_defaults_ (with_defaults),
+ single_ (single),
+ arg_ (arg),
+ not_used_ (not_used)
+{
+}
+
+const TAO_ENV_ARG env_decl;
+const TAO_ENV_ARG env_dflts (true);
+const TAO_ENV_ARG env_sngl (false, true);
+const TAO_ENV_ARG env_sngl_dflts (true, true);
+const TAO_ENV_ARG env_not (false, false, false, true);
+const TAO_ENV_ARG env_sngl_not (false, true, false, true);
+const TAO_ENV_ARG env_arg (false, false, true);
+const TAO_ENV_ARG env_sngl_arg (false, true, true);
+
+TAO_ACE_CHECK::TAO_ACE_CHECK (const char *retval,
+ bool do_return)
+ : retval_ (retval),
+ do_return_ (retval != 0 || do_return)
+{
+}
+
+TAO_ACE_TRY_CHECK::TAO_ACE_TRY_CHECK (void)
+{
+}
+
+TAO_ACE_ENDTRY::TAO_ACE_ENDTRY (void)
+{
+}
+
+const TAO_ACE_TRY_CHECK ace_try_check;
+const TAO_ACE_ENDTRY ace_endtry;
+
+// Methods of the TAO_OutStream class.
+
+TAO_OutStream::TAO_OutStream (void)
+ : fp_ (0),
+ indent_level_ (0)
+{
+}
+
+TAO_OutStream::~TAO_OutStream (void)
+{
+ // Close the underlying I/O handle only if it exists.
+ if (this->fp_ != 0)
+ {
+ ACE_OS::fclose (this->fp_);
+ this->fp_ = 0;
+ }
+
+ indent_level_ = 0;
+}
+
+int
+TAO_OutStream::open (const char *fname,
+ TAO_OutStream::STREAM_TYPE st)
+{
+ if (fname != 0)
+ {
+ // File name exists, open an I/O file handle.
+ this->fp_ = ACE_OS::fopen (fname, "w");
+
+ if (this->fp_ != 0)
+ {
+ this->st_ = st;
+ // Put the copyright notice. Not for the gperf's temp input
+ // file.
+ if (st != TAO_OutStream::TAO_GPERF_INPUT)
+ {
+ ACE_OS::fprintf (this->fp_,
+ "%s\n",
+ copyright);
+
+ ACE_OS::fflush (this->fp_);
+ }
+
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+ }
+ else
+ {
+ return -1;
+ }
+}
+
+// Set and get the stream type.
+void
+TAO_OutStream::stream_type (TAO_OutStream::STREAM_TYPE st)
+{
+ this->st_ = st;
+}
+
+TAO_OutStream::STREAM_TYPE
+TAO_OutStream::stream_type (void)
+{
+ return this->st_;
+}
+
+// Return the underlying lowlevel file pointer.
+// indentation.
+FILE *
+TAO_OutStream::file (void)
+{
+ return this->fp_;
+}
+
+int
+TAO_OutStream::incr_indent (unsigned short flag)
+{
+ indent_level_++;
+
+ if (flag != 0)
+ {
+ return this->indent ();
+ }
+ else
+ {
+ // Do not indent output.
+ return 0;
+ }
+}
+
+// Indentation
+int
+TAO_OutStream::decr_indent (unsigned short flag)
+{
+ this->indent_level_--;
+ // Just in case somebody gets "unindent happy".
+ if (this->indent_level_ < 0)
+ {
+ // ACE_DEBUG ((LM_DEBUG, "negative indentation?\n"));
+ this->indent_level_ = 0;
+ }
+ if (flag != 0)
+ {
+ return this->indent ();
+ }
+ else
+ {
+ // Do not indent output.
+ return 0;
+ }
+}
+
+int
+TAO_OutStream::reset (void)
+{
+ this->indent_level_ = 0;
+ return 0;
+}
+
+// Indented print.
+int
+TAO_OutStream::indent (void)
+{
+ // Based on the current indentation level, leave appropriate number of blank
+ // spaces in the output.
+ if (this->indent_level_ > 0)
+ {
+ for (int i = 0; i < this->indent_level_; i++)
+ {
+ ACE_OS::fprintf (this->fp_, " ");
+#if !defined (ACE_OPENVMS)
+ ACE_OS::fflush (this->fp_);
+#endif
+ }
+ }
+
+ return 0;
+}
+
+int
+TAO_OutStream::nl (void)
+{
+ ACE_OS::fprintf (this->fp_, "\n");
+ this->indent ();
+ return 0;
+}
+
+// Macro generation.
+int
+TAO_OutStream::gen_ifdef_macro (const char *flat_name,
+ const char *suffix,
+ bool add_stream_type_suffix)
+{
+ static char macro [NAMEBUFSIZE];
+
+ ACE_OS::memset (macro,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::sprintf (macro,
+ "_%s_",
+ tao_cg->upcase (flat_name));
+ if (suffix != 0)
+ {
+ //ACE_OS::sprintf (macro, "%s_%s_", macro, cg->upcase (suffix));
+ // Can't have macro on both sides of sprintf
+ // I'm not sure if the first strcat of "_" should be here or
+ // not, but having it gives the same functionality as the old
+ // sprintf call...
+ ACE_OS::strcat (macro, "_");
+ ACE_OS::strcat (macro, tao_cg->upcase (suffix));
+ ACE_OS::strcat (macro, "_");
+ }
+
+ // Append a suffix representing the stream type.
+ if (add_stream_type_suffix)
+ switch (this->st_)
+ {
+ case TAO_OutStream::TAO_CLI_HDR:
+ ACE_OS::strcat (macro, "CH_");
+ break;
+ case TAO_OutStream::TAO_CLI_INL:
+ ACE_OS::strcat (macro, "CI_");
+ break;
+ case TAO_OutStream::TAO_CLI_IMPL:
+ ACE_OS::strcat (macro, "CS_");
+ break;
+ case TAO_OutStream::TAO_SVR_HDR:
+ ACE_OS::strcat (macro, "SH_");
+ break;
+ case TAO_OutStream::TAO_IMPL_HDR:
+ ACE_OS::strcat (macro, "IH_");
+ break;
+ case TAO_OutStream::TAO_IMPL_SKEL:
+ ACE_OS::strcat (macro, "IS_");
+ break;
+ case TAO_OutStream::TAO_SVR_INL:
+ ACE_OS::strcat (macro, "SI_");
+ break;
+ case TAO_OutStream::TAO_SVR_IMPL:
+ ACE_OS::strcat (macro, "SS_");
+ break;
+ default:
+ return -1;
+ }
+
+ *this << "\n\n#if !defined (" << macro << ")\n";
+ *this << "#define " << macro;
+
+ return 0;
+}
+
+int
+TAO_OutStream::gen_endif (void)
+{
+ *this << "\n\n#endif /* end #if !defined */";
+
+ return 0;
+}
+
+// Printf style variable argument print.
+int
+TAO_OutStream::print (const char *format, ...)
+{
+ int result = 0;
+ va_list ap;
+ va_start (ap, format);
+ ACE_OSCALL (::vfprintf (this->fp_,
+ format,
+ ap),
+ int,
+ -1,
+ result);
+#if !defined (ACE_OPENVMS)
+ ACE_OS::fflush (this->fp_);
+#endif
+ va_end (ap);
+
+ return result;
+}
+
+TAO_OutStream &
+TAO_OutStream::operator<< (const char *str)
+{
+ ACE_OS::fprintf (this->fp_, "%s", str);
+#if !defined (ACE_OPENVMS)
+ ACE_OS::fflush (this->fp_);
+#endif
+ return *this;
+}
+
+TAO_OutStream &
+TAO_OutStream::operator<< (const ACE_CDR::UShort num)
+{
+ ACE_OS::fprintf (this->fp_,
+ "%hu",
+ num);
+
+#if !defined (ACE_OPENVMS)
+ ACE_OS::fflush (this->fp_);
+#endif
+
+ return *this;
+}
+
+TAO_OutStream &
+TAO_OutStream::operator<< (const ACE_CDR::Short num)
+{
+ ACE_OS::fprintf (this->fp_,
+ "%hd",
+ num);
+
+#if !defined (ACE_OPENVMS)
+ ACE_OS::fflush (this->fp_);
+#endif
+
+ return *this;
+}
+
+TAO_OutStream &
+TAO_OutStream::operator<< (const ACE_CDR::ULong num)
+{
+ ACE_OS::fprintf (this->fp_,
+ "%lu",
+ (unsigned long) num);
+
+#if !defined (ACE_OPENVMS)
+ ACE_OS::fflush (this->fp_);
+#endif
+
+ return *this;
+}
+
+TAO_OutStream &
+TAO_OutStream::operator<< (const ACE_CDR::Long num)
+{
+ ACE_OS::fprintf (this->fp_,
+ "%ld",
+ (long) num);
+
+#if !defined (ACE_OPENVMS)
+ ACE_OS::fflush (this->fp_);
+#endif
+
+ return *this;
+}
+
+#if defined (ACE_WIN64)
+TAO_OutStream &
+TAO_OutStream::operator<< (const ACE_CDR::ULongLong num)
+{
+ ACE_OS::fprintf (this->fp_,
+ ACE_UINT64_FORMAT_SPECIFIER,
+ num);
+
+#if !defined (ACE_OPENVMS)
+ ACE_OS::fflush (this->fp_);
+#endif
+
+ return *this;
+}
+
+TAO_OutStream &
+TAO_OutStream::operator<< (const ACE_CDR::LongLong num)
+{
+ ACE_OS::fprintf (this->fp_,
+ ACE_INT64_FORMAT_SPECIFIER,
+ num);
+
+#if !defined (ACE_OPENVMS)
+ ACE_OS::fflush (this->fp_);
+#endif
+
+ return *this;
+}
+#endif /* ACE_WIN64 */
+
+TAO_OutStream &
+TAO_OutStream::operator<< (const unsigned long num)
+{
+ ACE_OS::fprintf (this->fp_,
+ "%lu",
+ num);
+
+#if !defined (ACE_OPENVMS)
+ ACE_OS::fflush (this->fp_);
+#endif
+
+ return *this;
+}
+
+TAO_OutStream &
+TAO_OutStream::operator<< (const long num)
+{
+ ACE_OS::fprintf (this->fp_,
+ "%ld",
+ num);
+
+#if !defined (ACE_OPENVMS)
+ ACE_OS::fflush (this->fp_);
+#endif
+
+ return *this;
+}
+
+TAO_OutStream &
+TAO_OutStream::operator<< (const TAO_NL&)
+{
+ ACE_OS::fprintf (this->fp_ ,
+ "\n");
+ this->indent ();
+
+ return *this;
+}
+
+TAO_OutStream &
+TAO_OutStream::operator<< (const TAO_INDENT& i)
+{
+ this->incr_indent (0);
+
+ if (i.do_now_)
+ {
+ this->nl ();
+ }
+
+ return *this;
+}
+
+TAO_OutStream &
+TAO_OutStream::operator<< (const TAO_UNINDENT& i)
+{
+ this->decr_indent (0);
+
+ if (i.do_now_)
+ {
+ this->nl ();
+ }
+
+ return *this;
+}
+
+TAO_OutStream &
+TAO_OutStream::operator<< (const TAO_ENV_ARG& i)
+{
+ if (!be_global->use_raw_throw ())
+ {
+ (*this) << be_nl
+ << "ACE_ENV_"
+ << (i.single_ ? "SINGLE_" : "")
+ << "ARG_"
+ << (i.arg_ ? "PARAMETER" : "DECL")
+ << (i.with_defaults_ ? "_WITH_DEFAULTS" : "")
+ << (i.not_used_ ? "_NOT_USED" : "");
+ }
+
+ return *this;
+}
+
+TAO_OutStream &
+TAO_OutStream::operator<< (const TAO_ACE_CHECK& i)
+{
+ if (!be_global->use_raw_throw ())
+ {
+ (*this) << be_nl
+ << "ACE_CHECK"
+ << (i.do_return_ ? "_RETURN (" : "")
+ << (i.retval_ ? i.retval_ : "")
+ << (i.do_return_ ? ")" : "")
+ << ";";
+ }
+
+ return *this;
+}
+
+TAO_OutStream &
+TAO_OutStream::operator<< (const TAO_ACE_TRY_CHECK&)
+{
+ if (!be_global->use_raw_throw ())
+ {
+ (*this) << be_nl
+ << "ACE_TRY_CHECK;";
+ }
+
+ return *this;
+}
+
+TAO_OutStream &
+TAO_OutStream::operator<< (const TAO_ACE_ENDTRY&)
+{
+ if (!be_global->use_raw_throw ())
+ {
+ (*this) << be_nl
+ << "ACE_ENDTRY;";
+ }
+
+ return *this;
+}
+
+TAO_OutStream &
+TAO_OutStream::operator<< (Identifier *id)
+{
+ return this->print (id);
+}
+
+TAO_OutStream &
+TAO_OutStream::operator<< (UTL_IdList *id)
+{
+ return this->print (id);
+}
+
+TAO_OutStream &
+TAO_OutStream::operator<< (AST_Expression *expr)
+{
+ return this->print (expr);
+}
diff --git a/TAO/TAO_IDL/be/be_home.cpp b/TAO/TAO_IDL/be/be_home.cpp
new file mode 100644
index 00000000000..f7ddaac8f5e
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_home.cpp
@@ -0,0 +1,143 @@
+// $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_component.h"
+#include "be_interface_strategy.h"
+#include "be_visitor.h"
+#include "global_extern.h"
+#include "utl_err.h"
+
+ACE_RCSID (be,
+ be_home,
+ "$Id$")
+
+be_home::be_home (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ UTL_Scope (),
+ AST_Interface (),
+ AST_Home (),
+ be_scope (),
+ be_type (),
+ be_interface ()
+{
+ 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)
+ : COMMON_Base (false,
+ false),
+ AST_Decl (AST_Decl::NT_home,
+ n),
+ AST_Type (AST_Decl::NT_home,
+ n),
+ UTL_Scope (AST_Decl::NT_home),
+ AST_Interface (n,
+ supports,
+ n_supports,
+ supports_flat,
+ n_supports_flat,
+ false,
+ false),
+ AST_Home (n,
+ base_home,
+ managed_component,
+ primary_key,
+ supports,
+ n_supports,
+ supports_flat,
+ n_supports_flat),
+ be_scope (AST_Decl::NT_home),
+ be_type (AST_Decl::NT_home,
+ n),
+ be_interface (n,
+ supports,
+ n_supports,
+ supports_flat,
+ n_supports_flat,
+ false,
+ false)
+{
+ this->size_type (AST_Type::VARIABLE);
+
+ // Some previous error may have caused a lookup failure, in which
+ // case we'll crash if we do the narrow below.
+ if (managed_component == 0)
+ {
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ return;
+ }
+
+ be_component *bt =
+ be_component::narrow_from_decl (managed_component);
+
+ bt->seen_in_operation (true);
+
+ idl_global->object_arg_seen_ = true;
+}
+
+be_home::~be_home (void)
+{
+}
+
+void
+be_home::destroy (void)
+{
+ // Skip be_interface, since our decls were added to
+ // the equivalent interface and will get destroyed
+ // there.
+ if (this->strategy_ != 0)
+ {
+ this->strategy_->destroy ();
+ delete this->strategy_;
+ this->strategy_ = 0;
+ }
+
+ this->be_scope::destroy ();
+ this->be_type::destroy ();
+
+ // This skips AST_Interface, for the reason above.
+ this->AST_Home::destroy ();
+}
+
+int
+be_home::accept (be_visitor *visitor)
+{
+ if (idl_global->ignore_idl3 ())
+ {
+ idl_global->err ()->ignore_idl3_error (this);
+ return -1;
+ }
+
+ 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_init.cpp b/TAO/TAO_IDL/be/be_init.cpp
new file mode 100644
index 00000000000..65fee2a4821
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_init.cpp
@@ -0,0 +1,31 @@
+// $Id$
+
+#include "global_extern.h"
+#include "be_extern.h"
+#include "../../tao/Version.h"
+
+TAO_IDL_BE_Export void
+BE_version (void)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ "%s %s\n",
+ ACE_TEXT ("TAO_IDL_BE, version"),
+ ACE_TEXT (TAO_VERSION)));
+}
+
+TAO_IDL_BE_Export int
+BE_init (int &, char *[])
+{
+ // Initialize BE global data object.
+ ACE_NEW_RETURN (be_global,
+ BE_GlobalData,
+ -1);
+
+ return 0;
+}
+
+TAO_IDL_BE_Export void
+BE_post_init (char *[], long)
+{
+}
+
diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp
new file mode 100644
index 00000000000..511abe72f82
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_interface.cpp
@@ -0,0 +1,2657 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_interface.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Interface that provides additional means for C++
+// mapping of an interface.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale,
+// Michael Kircher
+//
+// ============================================================================
+
+#include "be_interface.h"
+#include "be_interface_strategy.h"
+#include "be_attribute.h"
+#include "be_operation.h"
+#include "be_exception.h"
+#include "be_visitor.h"
+#include "be_helper.h"
+#include "be_stream_factory.h"
+#include "be_extern.h"
+#include "utl_identifier.h"
+#include "utl_exceptlist.h"
+#include "ast_generator.h"
+#include "ast_component.h"
+#include "global_extern.h"
+#include "idl_defines.h"
+#include "nr_extern.h"
+
+#include "ace/Process.h"
+#include "ace/OS_NS_time.h"
+#include "ace/OS_NS_unistd.h"
+#include "ace/OS_NS_fcntl.h"
+
+ACE_RCSID (be,
+ be_interface,
+ "$Id$")
+
+// Default constructor.
+be_interface::be_interface (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ UTL_Scope (),
+ AST_Interface (),
+ be_scope (),
+ be_type (),
+ var_out_seq_decls_gen_ (0),
+ skel_count_ (0),
+ in_mult_inheritance_ (-1),
+ strategy_ (0),
+ original_interface_ (0),
+ has_mixed_parentage_ (-1),
+ session_component_child_ (-1)
+{
+ ACE_NEW (this->strategy_,
+ be_interface_default_strategy (this));
+}
+
+// Constructor used to build the AST.
+be_interface::be_interface (UTL_ScopedName *n,
+ AST_Interface **ih,
+ long nih,
+ AST_Interface **ih_flat,
+ long nih_flat,
+ bool local,
+ bool abstract)
+ : COMMON_Base (local,
+ abstract),
+ AST_Decl (AST_Decl::NT_interface,
+ n),
+ AST_Type (AST_Decl::NT_interface,
+ n),
+ UTL_Scope (AST_Decl::NT_interface),
+ AST_Interface (n,
+ ih,
+ nih,
+ ih_flat,
+ nih_flat,
+ local,
+ abstract),
+ be_scope (AST_Decl::NT_interface),
+ be_type (AST_Decl::NT_interface,
+ n),
+ var_out_seq_decls_gen_ (0),
+ skel_count_ (0),
+ in_mult_inheritance_ (-1),
+ strategy_ (0),
+ original_interface_ (0),
+ has_mixed_parentage_ (-1),
+ session_component_child_ (-1)
+{
+ ACE_NEW (this->strategy_,
+ be_interface_default_strategy (this));
+
+ if (this->imported () || this->node_type () == AST_Decl::NT_valuetype)
+ {
+ return ;
+ }
+
+ if (this->is_defined ())
+ {
+ // Set the flag that says we have a interface in this IDL file.
+ idl_global->interface_seen_ = true;
+
+ if (abstract || this->has_mixed_parentage ())
+ {
+ // Set the flag for abstract interface seen in this IDL file.
+ idl_global->abstract_iface_seen_ = true;
+ }
+
+ if (local)
+ {
+ // Set the flag for local interface seen in this IDL file.
+ idl_global->local_iface_seen_ = true;
+ }
+ else
+ {
+ // Set the flag for non-local interface seen in this IDL file.
+ idl_global->non_local_iface_seen_ = true;
+ }
+ }
+ else
+ {
+ // Forward declared non-defined interface. Still gets a _var decl.
+ idl_global->fwd_iface_seen_ = true;
+ }
+}
+
+be_interface::~be_interface (void)
+{
+}
+
+be_interface_strategy *
+be_interface::set_strategy (be_interface_strategy *new_strategy)
+{
+ be_interface_strategy *old = this->strategy_;
+
+ if (new_strategy != 0)
+ {
+ this->strategy_ = new_strategy;
+ }
+
+ return old;
+}
+
+
+const char *
+be_interface::local_name (void) const
+{
+ // Return the local name.
+ return this->strategy_->local_name ();
+}
+
+const char *
+be_interface::full_name (void)
+{
+ return this->strategy_->full_name ();
+}
+
+const char *
+be_interface::flat_name (void)
+{
+ // Return the flattened full scoped name.
+ return this->strategy_->flat_name ();
+}
+
+const char *
+be_interface::repoID (void) const
+{
+ // Retrieve the repository ID.
+ return this->strategy_->repoID ();
+}
+
+const char *
+be_interface::full_skel_name (void) const
+{
+ // Retrieve the fully scoped skel class name.
+ return this->strategy_->full_skel_name ();
+}
+
+const char *
+be_interface::full_coll_name (int type) const
+{
+ // Retrieve the fully qualified collocated class name
+ return this->strategy_->full_coll_name (type);
+}
+
+const char *
+be_interface::local_coll_name (int type) const
+{
+ // Retrieve the fully qualified collocated class name.
+ return this->strategy_->local_coll_name (type);
+}
+
+const char *
+be_interface::relative_skel_name (const char *skel_name)
+{
+ // Relative skeleton name.
+ return this->strategy_->relative_skel_name (skel_name);
+}
+
+
+void
+be_interface::compute_full_skel_name (const char *prefix,
+ char *&skelname)
+{
+ if (skelname != 0)
+ {
+ return;
+ }
+ else
+ {
+ size_t namelen = ACE_OS::strlen (prefix);
+ long first = true;
+ long second = 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 += 2; // for "::"
+ }
+ else if (second)
+ {
+ first = second = false;
+ }
+
+ // Print the identifier.
+ item_name = i.item ()->get_string ();
+ namelen += ACE_OS::strlen (item_name);
+
+ // Additional 4 for the POA_ characters.
+ if (first)
+ {
+ if (ACE_OS::strcmp (item_name, "") != 0)
+ {
+ // Does not start with a "".
+ first = false;
+ }
+ else
+ {
+ second = true;
+ }
+ }
+ }
+
+ ACE_NEW (skelname,
+ char [namelen+1]);
+ skelname[0] = '\0';
+ first = true;
+ second = false;
+ ACE_OS::strcat (skelname, prefix);
+
+ for (UTL_IdListActiveIterator j (this->name ());
+ !j.is_done ();
+ j.next ())
+ {
+ if (!first)
+ {
+ ACE_OS::strcat (skelname, "::");
+ }
+ else if (second)
+ {
+ first = second = false;
+ }
+
+ // Print the identifier.
+ item_name = j.item ()->get_string ();
+ ACE_OS::strcat (skelname, item_name);
+
+ if (first)
+ {
+ if (ACE_OS::strcmp (item_name, "") != 0)
+ {
+ // Does not start with a "".
+ first = false;
+ }
+ else
+ {
+ second = true;
+ }
+ }
+ }
+ }
+}
+
+const char*
+be_interface::relative_name (const char *localname,
+ const char *othername)
+{
+ // 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. We have to emit just the partial name, relative to our
+ // "localname".
+
+ // 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.
+
+ static char macro [NAMEBUFSIZE];
+
+ // Hold the fully scoped name.
+ char def_name [NAMEBUFSIZE];
+ char use_name [NAMEBUFSIZE];
+
+ // These point to the curr and next component in the scope.
+ char *def_curr = def_name;
+ char *def_next;
+ char *use_curr = use_name;
+ char *use_next;
+
+ ACE_OS::memset (macro,
+ '\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.
+
+ ACE_OS::strcpy (def_name,
+ localname);
+ ACE_OS::strcpy (use_name,
+ othername);
+
+ 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)
+ {
+ *def_next = 0;
+ }
+
+ if (use_next)
+ {
+ *use_next = 0;
+ }
+
+ if (!ACE_OS::strcmp (def_curr, use_curr))
+ {
+ // They have same prefix, append to arg1.
+ def_curr = (def_next ? (def_next+2) : 0); // Skip the ::
+ use_curr = (use_next ? (use_next+2) : 0); // Skip the ::
+ }
+ else
+ {
+ // We had overwritten a ':' by a '\0' for string comparison. We
+ // revert back because we want the rest of the relative name to be
+ // used.
+ if (def_next)
+ {
+ *def_next = ':';
+ }
+
+ if (use_next)
+ {
+ *use_next = ':';
+ }
+
+ // 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.
+
+ // Copy the remaining def_name (if any left)
+ if (def_curr)
+ {
+ ACE_OS::strcat (macro,
+ def_curr);
+ }
+
+ return macro;
+}
+
+
+// Am I in some kind of a multiple inheritance?
+int
+be_interface::in_mult_inheritance (void)
+{
+ if (this->in_mult_inheritance_ == -1)
+ {
+ // Compute once for all.
+ // Determine if we are in some form of a multiple inheritance.
+ if (this->traverse_inheritance_graph (
+ be_interface::in_mult_inheritance_helper,
+ 0
+ ) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_interface::in_mult_inheritance "
+ "error determining mult inheritance\n"),
+ -1);
+ }
+ }
+
+ return this->in_mult_inheritance_;
+}
+
+void
+be_interface::in_mult_inheritance (int mi)
+{
+ if (this->in_mult_inheritance_ == -1)
+ {
+ this->in_mult_inheritance_ = mi;
+ }
+}
+
+void
+be_interface::redefine (AST_Interface *from)
+{
+ be_interface *bi = be_interface::narrow_from_decl (from);
+ this->var_out_seq_decls_gen_ = bi->var_out_seq_decls_gen_;
+ this->has_mixed_parentage_ = bi->has_mixed_parentage_;
+
+ if (bi->has_mixed_parentage_)
+ {
+ ACE_Unbounded_Queue<be_interface *> &q =
+ be_global->mixed_parentage_interfaces;
+ size_t slot = 0;
+ be_interface **t = 0;
+
+ // The queue of interfaces with mixed parentage must
+ // replace each interface that has been forward
+ // declared, since the pointer existing in the queue
+ // will be deleted after redefine() returns.
+ for (slot = 0; slot < q.size (); ++slot)
+ {
+ (void) q.get (t, slot);
+
+ if (*t == bi)
+ {
+ (void) q.set (this, slot);
+ break;
+ }
+ }
+ }
+
+ AST_Interface::redefine (from);
+}
+
+// Generate default constructors.
+void
+be_interface::gen_def_ctors (TAO_OutStream *os)
+{
+ this->traverse_inheritance_graph (
+ be_interface::gen_def_ctors_helper,
+ os
+ );
+
+ return;
+}
+
+
+int
+be_interface::gen_def_ctors_helper (be_interface* node,
+ be_interface* base,
+ TAO_OutStream *os)
+{
+
+ static int first = 0;
+
+ if (node != base)
+ {
+ if (first)
+ {
+ *os << be_global->impl_class_prefix () << base->flat_name ()
+ << be_global->impl_class_suffix () << " ()";
+
+ first = 0;
+ }
+ else
+ {
+ *os << ", " << be_global->impl_class_prefix () << base->flat_name ()
+ << be_global->impl_class_suffix () << " ()";
+ }
+ }
+ else
+ {
+ *os << ":";
+ first = 1;
+ }
+
+ return 1;
+}
+
+
+void
+be_interface::gen_stub_ctor (TAO_OutStream *os)
+{
+ // Generate the constructor from stub and servant.
+ if (!this->is_local ())
+ {
+ *os << be_nl << be_nl
+ << "ACE_INLINE" << be_nl;
+ *os << this->name () << "::"
+ << this->local_name () << " ("
+ << be_idt << be_idt_nl
+ << "TAO_Stub *objref," << be_nl
+ << "::CORBA::Boolean _tao_collocated," << be_nl
+ << "TAO_Abstract_ServantBase *servant," << be_nl
+ << "TAO_ORB_Core *oc" << be_uidt_nl
+ << ")" << be_nl
+ << ": ";
+
+ bool the_check =
+ (this->has_mixed_parentage_
+ && !this->is_abstract_
+ && this->pd_n_inherits > 0
+ && this->pd_inherits[0]->is_abstract ())
+ || this->is_abstract_;
+
+ if (this->has_mixed_parentage_)
+ {
+ *os << "::CORBA::"
+ << (the_check ? "AbstractBase" : "Object")
+ << " ("
+ << be_idt << be_idt << be_idt_nl
+ << "objref," << be_nl
+ << "_tao_collocated," << be_nl
+ << "servant"
+ << (the_check ? "" : ", oc") << be_uidt_nl
+ << ")" << be_uidt;
+
+ if (!the_check)
+ {
+ *os << "," << be_nl
+ << "::CORBA::AbstractBase ("
+ << be_idt << be_idt_nl
+ << "objref," << be_nl
+ << "_tao_collocated," << be_nl
+ << "servant"
+ << (the_check ? ", oc" : "") << be_uidt_nl
+ << ")" << be_uidt;
+ }
+
+ int status =
+ this->traverse_inheritance_graph (
+ be_interface::gen_abstract_init_helper,
+ os,
+ true
+ );
+
+ if (status == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "be_interface::gen_stub_ctor - "
+ "inheritance graph traversal failed\n"));
+ }
+ }
+ else
+ {
+ *os << be_idt;
+ }
+
+ if (the_check && !this->is_abstract_)
+ {
+ *os << "," << be_uidt_nl;
+ }
+
+ if (!this->is_abstract_
+ && (!this->has_mixed_parentage_ || the_check))
+ {
+ *os << "::CORBA::Object (objref, _tao_collocated, servant, oc)";
+ }
+
+ *os << "," << be_nl
+ << "the"<< this->base_proxy_broker_name () << "_ (0)"
+ << be_uidt << be_uidt;
+
+ *os << be_nl << "{" << be_idt_nl
+ << "this->" << this->flat_name ()
+ << "_setup_collocation ();";
+
+ if (this->is_abstract ())
+ {
+ *os << be_nl
+ << "ACE_UNUSED_ARG (oc);";
+ }
+
+ *os << be_uidt_nl
+ << "}";
+ }
+}
+
+// Generate the forward declarations and static methods used by the
+// interface _var and _out template classes, as well as by the
+// template sequence classes for object references.
+void
+be_interface:: gen_var_out_seq_decls (void)
+{
+ if (this->var_out_seq_decls_gen_ == 1)
+ {
+ return;
+ }
+
+ const char *lname = this->local_name ();
+ TAO_OutStream *os = tao_cg->client_header ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Generate the ifdefined macro for this interface.
+ os->gen_ifdef_macro (this->flat_name (),
+ "var_out");
+
+ *os << be_nl << be_nl
+ << "class " << lname << ";" << be_nl
+ << "typedef " << lname << " *" << lname << "_ptr;";
+
+ *os << be_nl << be_nl
+ << "typedef" << be_idt_nl
+ << "TAO_Objref_Var_T<" << be_idt << be_idt_nl
+ << lname << be_uidt_nl
+ << ">" << be_uidt_nl
+ << lname << "_var;" << be_uidt_nl << be_nl
+ << "typedef" << be_idt_nl
+ << "TAO_Objref_Out_T<" << be_idt << be_idt_nl
+ << lname << be_uidt_nl
+ << ">" << be_uidt_nl
+ << lname << "_out;" << be_uidt;
+
+ os->gen_endif ();
+
+ this->var_out_seq_decls_gen_ = 1;
+}
+
+// ****************************************************************
+
+TAO_IDL_Inheritance_Hierarchy_Worker::~TAO_IDL_Inheritance_Hierarchy_Worker (
+ void
+ )
+{
+}
+
+// =================================================================
+
+class TAO_IDL_Gen_OpTable_Worker
+ : public TAO_IDL_Inheritance_Hierarchy_Worker
+{
+public:
+ TAO_IDL_Gen_OpTable_Worker (const char *skeleton_name);
+
+ virtual int emit (be_interface *derived_interface,
+ TAO_OutStream *os,
+ be_interface *base_interface);
+
+private:
+ const char *skeleton_name_;
+};
+
+TAO_IDL_Gen_OpTable_Worker::TAO_IDL_Gen_OpTable_Worker (
+ const char *skeleton_name
+ )
+ : skeleton_name_ (skeleton_name)
+{
+}
+
+int
+TAO_IDL_Gen_OpTable_Worker::emit (be_interface *derived_interface,
+ TAO_OutStream *os,
+ be_interface *base_interface)
+{
+ // Generate entries for the derived class using the properties of its
+ // ancestors.
+ be_interface *bi = be_interface::narrow_from_decl (base_interface);
+ return bi->gen_optable_entries (derived_interface,
+ this->skeleton_name_,
+ os);
+}
+
+// =================================================================
+
+class Pure_Virtual_Regenerator
+ : public TAO_IDL_Inheritance_Hierarchy_Worker
+{
+public:
+ Pure_Virtual_Regenerator (be_visitor *visitor);
+
+ virtual int emit (be_interface *derived_interface,
+ TAO_OutStream *os,
+ be_interface *base_interface);
+
+private:
+ be_visitor *visitor_;
+};
+
+Pure_Virtual_Regenerator::Pure_Virtual_Regenerator (
+ be_visitor *visitor
+ )
+ : visitor_ (visitor)
+{
+}
+
+// We don't use the output stream in the signature but instead
+// pass the visitor member (which is always be_visitor_operation_ch)
+// to each iterator item, and (almost, see below) everything else
+// is automatic.
+int
+Pure_Virtual_Regenerator::emit (be_interface *derived_interface,
+ TAO_OutStream *,
+ be_interface *base_interface)
+{
+ if (derived_interface == base_interface)
+ {
+ return 0;
+ }
+
+ // If the parent is local, it will already have its operations declared
+ // as pure virtual, and if it's abstract, its operations will already
+ // be generated as pure virtual for the derived local interface.
+ if (base_interface->is_local () || base_interface->is_abstract ())
+ {
+ return 0;
+ }
+
+ be_decl *d = 0;
+
+ for (UTL_ScopeActiveIterator si (base_interface, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ d = be_decl::narrow_from_decl (si.item ());
+
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ // Hack to force the generation of the pure virtual ' = 0'
+ // at the end of the operation declaration.
+ d->set_local (true);
+
+ if (d->accept (this->visitor_) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) Pure_Virtual_Regenerator::emit - "
+ "visit base interface operation failed\n"),
+ -1);
+ }
+
+ d->set_local (false);
+ }
+ }
+
+ return 0;
+}
+
+// =================================================================
+
+int
+be_interface::gen_operation_table (const char *flat_name,
+ const char *skeleton_class_name)
+{
+ // Check out the op_lookup_strategy.
+ switch (be_global->lookup_strategy ())
+ {
+ case BE_GlobalData::TAO_DYNAMIC_HASH:
+ {
+ this->skel_count_ = 0;
+ // Init the outstream appropriately.
+ TAO_OutStream *os = this->strategy_->get_out_stream ();
+
+ // Start from current indentation level.
+ os->indent ();
+
+ // Start the table generation.
+ *os << be_nl << be_nl
+ << "static const TAO_operation_db_entry " << flat_name
+ << "_operations [] = {" << be_idt_nl;
+
+ // 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,
+ "(%N:%l) be_interface::gen_operation_table - "
+ "inheritance graph traversal failed\n"), -1);
+ }
+
+ // Generate the skeleton for the is_a method.
+ *os << "{\"_is_a\", &" << skeleton_class_name
+ << "::_is_a_skel, 0}," << be_nl;
+
+ this->skel_count_++;
+
+ *os << "{\"_non_existent\", &" << skeleton_class_name
+ << "::_non_existent_skel, 0}," << be_nl;
+
+ this->skel_count_++;
+
+ *os << "{\"_component\", &" << skeleton_class_name
+ << "::_component_skel, 0}," << be_nl;
+
+ this->skel_count_++;
+
+ *os << "{\"_interface\", &" << skeleton_class_name
+ << "::_interface_skel, 0}," << be_nl;
+
+ this->skel_count_++;
+
+ *os << "{\"_repository_id\", &" << skeleton_class_name
+ << "::_repository_id_skel, 0}" << be_uidt_nl;
+
+ this->skel_count_++;
+
+ *os << "};" << be_nl << be_nl;
+ *os << "static const ::CORBA::Long _tao_" << flat_name
+ << "_optable_size = sizeof (ACE_Hash_Map_Entry<const char *,"
+ << " TAO::Operation_Skeletons>) * (" << (3 * this->skel_count_)
+ << ");" << be_nl;
+ *os << "static char _tao_" << flat_name << "_optable_pool "
+ << "[_tao_" << flat_name << "_optable_size];" << be_nl;
+ *os << "static ACE_Static_Allocator_Base _tao_" << flat_name
+ << "_allocator (_tao_" << flat_name << "_optable_pool, "
+ << "_tao_" << flat_name << "_optable_size);" << be_nl;
+ *os << "static TAO_Dynamic_Hash_OpTable tao_"
+ << flat_name << "_optable " << "(" << be_idt << be_idt_nl
+ << flat_name << "_operations," << be_nl
+ << this->skel_count_ << "," << be_nl
+ << 2 * this->skel_count_ << "," << be_nl
+ << "&_tao_" << flat_name << "_allocator" << be_uidt_nl
+ << ");" << be_uidt_nl;
+ }
+ break;
+
+ case BE_GlobalData::TAO_LINEAR_SEARCH:
+ // For generating linear search also, we are calling GPERF
+ // only.
+ case BE_GlobalData::TAO_BINARY_SEARCH:
+ // For generating binary search also, we are calling GPERF
+ // only.
+ case BE_GlobalData::TAO_PERFECT_HASH:
+ // For each interface in the IDL, have a new temp file to
+ // collect the input for the gperf program.
+ {
+ // Temp file name.
+ // We must randomize this a bit in order to avoid problems with
+ // processing more than one idl file (in separate processes) with
+ // the same name (in different directories).
+ char *temp_file = 0;
+ ACE_NEW_RETURN (temp_file,
+ char [ACE_OS::strlen (idl_global->temp_dir ())
+ + 11 // The number of possible digits in
+ // a 32-bit number plus a dot
+ + ACE_OS::strlen (flat_name)
+ + ACE_OS::strlen (".gperf")
+ + 1],
+ -1);
+
+ // This degree of randomness is necessary because there was an
+ // obscure chance of even this arriving at colliding filenames
+ // on multiprocessor machines when the IDL compiler was run at
+ // exactly the same time.
+ ACE_RANDR_TYPE seed =
+ (static_cast<ACE_RANDR_TYPE> (ACE_OS::time())
+ + static_cast<ACE_RANDR_TYPE> (ACE_OS::getpid ()));
+ ACE_OS::sprintf (temp_file,
+ "%s%d.%s.gperf",
+ idl_global->temp_dir (),
+ ACE_OS::rand_r (seed),
+ flat_name);
+
+ // QNX can't handle individual file names (path components)
+ // longer than 48 characters.
+#if defined(__QNX__)
+ size_t temp_dir_len = ACE_OS::strlen (idl_global->temp_dir ());
+
+ if (ACE_OS::strlen (temp_file) > temp_dir_len + 47)
+ {
+ temp_file[temp_dir_len + 47] = 0;
+ }
+#endif /* defined(__QNX__) */
+
+ // Save this file name with the codegen singleton.
+ tao_cg->gperf_input_filename (temp_file);
+
+ // Make a new outstream to hold the gperf_temp_file for this
+ // interface.
+
+ // Retrieve the singleton instance to the outstream factory.
+ TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
+
+ // Get a new instance for the temp file.
+ TAO_OutStream *os = factory->make_outstream ();
+
+ if (os == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ss"
+ "::"
+ "visit_interface-"
+ "make_outstream failed\n"),
+ -1);
+ }
+
+ // Store the outstream with the codegen singleton.
+ tao_cg->gperf_input_stream (os);
+
+ // Open the temp file.
+ if (os->open (temp_file,
+ TAO_OutStream::TAO_GPERF_INPUT) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ss"
+ "::"
+ "visit_interface-"
+ "gperf_input.tmp file open failed\n"),
+ -1);
+ }
+
+ // 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,
+ "(%N:%l) be_interface::gen_operation_table - "
+ "inheritance graph traversal failed\n"),
+ -1);
+ }
+
+ *os << "_is_a,&"
+ << skeleton_class_name
+ << "::_is_a_skel, 0" << be_nl;
+
+ this->skel_count_++;
+
+ *os << "_non_existent,&"
+ << skeleton_class_name
+ << "::_non_existent_skel, 0" << be_nl;
+
+ this->skel_count_++;
+
+ *os << "_component,&"
+ << skeleton_class_name
+ << "::_component_skel, 0" << be_nl;
+ this->skel_count_++;
+
+ *os << "_interface,&"
+ << skeleton_class_name
+ << "::_interface_skel, 0" << be_nl;
+
+ this->skel_count_++;
+
+ *os << "_repository_id,&"
+ << skeleton_class_name
+ << "::_repository_id_skel, 0" << be_nl;
+ this->skel_count_++;
+
+ // Input to the gperf is ready. Run gperf and get things
+ // done. This method also unlinks the temp file that we used
+ // for the gperf.
+ this->gen_gperf_things (flat_name);
+ }
+ break;
+
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_interface"
+ "::"
+ "gen_operation_table"
+ "unknown op_lookup_strategy\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_interface::convert_parent_ops (be_visitor *visitor)
+{
+ // 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::convert_parent_ops - "
+ "error generating entries\n"),
+ -1);
+ }
+
+ // Traverse the graph.
+ Pure_Virtual_Regenerator worker (visitor);
+
+ if (this->traverse_inheritance_graph (worker, 0) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_interface::"
+ "convert_parent_ops - "
+ "codegen for base class operations failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+// Output the header (type declaration and %%) to the gperf's input
+// file.
+void
+be_interface::gen_gperf_input_header (TAO_OutStream *os)
+{
+ *os << "TAO_operation_db_entry {\n"
+ << "\tchar * opname;" << "\n"
+ << "\tTAO_Skeleton skel_ptr;" << "\n"
+ << "};" << "\n"
+ << "%%"
+ << "\n";
+}
+
+// we separate the generation of operation table entries from the
+// "gen_operation_table" method. This enables us to invoke generation of
+// entries for interfaces from which we inherit without any additional
+// code. The parameter "derived" is the one for which the entire operation
+// table is being built.
+int
+be_interface::gen_optable_entries (be_interface *derived_interface,
+ const char *full_skeleton_name,
+ TAO_OutStream *os)
+{
+ int lookup_strategy =
+ be_global->lookup_strategy ();
+
+ if (lookup_strategy == BE_GlobalData::TAO_DYNAMIC_HASH)
+ {
+ 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_op)
+ {
+ // We are an operation node.
+ *os << "{\"" << d->original_local_name () << "\", &"
+ << full_skeleton_name << "::"
+ << d->local_name () << "_skel,";
+
+ if (be_global->gen_direct_collocation ())
+ {
+ *os << " &"
+ << derived_interface->full_direct_proxy_impl_name ()
+ << "::" << d->local_name ();
+ }
+ else
+ {
+ *os << " 0";
+ }
+
+ *os << "}," << be_nl;
+
+ derived_interface->skel_count_++;
+ }
+ else if (d->node_type () == AST_Decl::NT_attr)
+ {
+ AST_Attribute *attr =
+ AST_Attribute::narrow_from_decl (d);
+
+ if (attr == 0)
+ return -1;
+
+ // Generate only the "get" entry if we are
+ // readonly.
+ *os << "{\"_get_" << d->original_local_name ()
+ << "\", &" << full_skeleton_name
+ << "::_get_" << d->local_name () << "_skel,";
+
+ if (be_global->gen_direct_collocation ())
+ {
+ *os << " &"
+ << derived_interface->full_direct_proxy_impl_name ()
+ << "::_get_" << d->local_name ();
+ }
+ else
+ {
+ *os << " 0";
+ }
+
+ *os << "}," << be_nl;
+
+ derived_interface->skel_count_++;
+
+ if (!attr->readonly ())
+ {
+ // The set method
+ *os << "{\"_set_" << d->original_local_name ()
+ << "\", &" << full_skeleton_name
+ << "::_set_" << d->local_name () << "_skel,";
+
+ if (be_global->gen_direct_collocation ())
+ {
+ *os << " &"
+ << derived_interface->full_direct_proxy_impl_name ()
+ << "::_set_" << d->local_name ();
+ }
+ else
+ {
+ *os << " 0";
+ }
+
+ *os << "}," << be_nl;
+
+ derived_interface->skel_count_++;
+ }
+ }
+ }
+ }
+ else if (lookup_strategy == BE_GlobalData::TAO_LINEAR_SEARCH
+ || lookup_strategy == BE_GlobalData::TAO_BINARY_SEARCH
+ || lookup_strategy == BE_GlobalData::TAO_PERFECT_HASH)
+ {
+ // We call GPERF for all these three strategies.
+ // Init the outstream.
+ // @@ We probably do no need to do this, the "right" <os>
+ // argument is passed down!!
+ os = tao_cg->gperf_input_stream ();
+
+ 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_op)
+ {
+ // Generate operation name.
+
+ // We are an operation node. We use the original
+ // operation name, not the one with _cxx_ in it.
+ *os << d->original_local_name () << ",&"
+ << full_skeleton_name << "::"
+ << d->local_name () << "_skel,";
+
+ if (be_global->gen_direct_collocation ())
+ {
+ *os << " &"
+ << derived_interface->full_direct_proxy_impl_name ();
+ *os << "::" << d->local_name ();
+ }
+ else
+ {
+ *os << " 0";
+ }
+
+ *os << "\n";
+
+ this->skel_count_++;
+ }
+ else if (d->node_type () == AST_Decl::NT_attr)
+ {
+ AST_Attribute *attr =
+ AST_Attribute::narrow_from_decl (d);
+
+ if (attr == 0)
+ {
+ return -1;
+ }
+
+ // Generate only the "get" entry if we are readonly.
+ *os << "_get_" << d->original_local_name () << ",&"
+ << full_skeleton_name << "::_get_"
+ << d->local_name () << "_skel,";
+
+ if (be_global->gen_direct_collocation ())
+ {
+ *os << " &"
+ << derived_interface->full_direct_proxy_impl_name ()
+ << "::_get_" << d->local_name ();
+ }
+ else
+ {
+ *os << " 0";
+ }
+
+ *os << "\n";
+
+ this->skel_count_++;
+
+ if (!attr->readonly ())
+ {
+ // The set method
+ *os << "_set_" << d->original_local_name () << ",&"
+ << full_skeleton_name << "::_set_"
+ << d->local_name () << "_skel,";
+
+ if (be_global->gen_direct_collocation ())
+ {
+ *os << " &"
+ << derived_interface->full_direct_proxy_impl_name ()
+ << "::_set_" << d->local_name ();
+ }
+ else
+ {
+ *os << " 0";
+ }
+
+ *os << "\n";
+
+ this->skel_count_++;
+ }
+ }
+ }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_interface::gen_optable_entries - "
+ "unknown op_lookup_strategy\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+void
+be_interface::gen_collocated_skel_body (be_interface *derived,
+ be_interface *ancestor,
+ AST_Decl *d,
+ const char *prefix,
+ bool /* direct */,
+ UTL_ExceptList *list,
+ TAO_OutStream *os)
+{
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Generate the static method corresponding to this method.
+ *os << be_nl << be_nl
+ << "ACE_INLINE void" << be_nl
+ << derived->full_direct_proxy_impl_name ()
+ << "::" << prefix << d->local_name () << " (" << be_idt << be_idt_nl
+ << "TAO_Abstract_ServantBase *servant," << be_nl
+ << "TAO::Argument ** args," << be_nl
+ << "int num_args" << env_decl << be_uidt_nl
+ << ")";
+
+ be_interface::gen_throw_spec (list, os);
+
+ *os << be_uidt_nl
+ << "{" << be_idt_nl
+ << ancestor->full_direct_proxy_impl_name ()
+ << "::" << prefix << d->local_name () << " (" << be_idt << be_idt_nl
+ << "servant," << be_nl
+ << "args," << be_nl
+ << "num_args" << env_arg << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}"<< be_nl;
+
+
+}
+
+void
+be_interface::analyze_parentage (void)
+{
+ if (this->has_mixed_parentage_ != -1)
+ {
+ return;
+ }
+
+ this->has_mixed_parentage_ = 0;
+
+ for (long i = 0; i < this->pd_n_inherits; ++i)
+ {
+ be_interface *parent =
+ be_interface::narrow_from_decl (this->pd_inherits[i]);
+
+ if (parent->is_abstract () || parent->has_mixed_parentage ())
+ {
+ this->has_mixed_parentage_ = 1;
+ break;
+ }
+ }
+
+ AST_Decl::NodeType nt = this->node_type ();
+ bool can_be_mixed = nt == AST_Decl::NT_interface
+ || nt == AST_Decl::NT_component
+ || nt == AST_Decl::NT_home;
+
+ if (this->has_mixed_parentage_ == 1 && can_be_mixed && this->is_defined ())
+ {
+ be_global->mixed_parentage_interfaces.enqueue_tail (this);
+ }
+}
+
+// ****************************************************************
+
+be_code_emitter_wrapper::
+be_code_emitter_wrapper (be_interface::tao_code_emitter emitter)
+ : emitter_ (emitter)
+{
+}
+
+int
+be_code_emitter_wrapper::emit (be_interface *derived_interface,
+ TAO_OutStream *output_stream,
+ be_interface *base_interface)
+{
+ return this->emitter_ (derived_interface,
+ base_interface,
+ output_stream);
+}
+
+// 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_interface::traverse_inheritance_graph (be_interface::tao_code_emitter gen,
+ TAO_OutStream *os,
+ bool abstract_paths_only)
+{
+ // 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::traverse_inheritance_graph - "
+ "error generating entries\n"),
+ -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,
+ bool abstract_paths_only
+ )
+{
+ AST_Interface *intf = 0; // element inside the queue
+
+ if (!this->insert_queue.is_empty ())
+ {
+ // Dequeue the element at the head of the queue.
+ if (this->insert_queue.dequeue_head (intf))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_interface::traverse_graph - "
+ "dequeue_head failed\n"),
+ -1);
+ }
+
+ // If we are doing a component, we check for a parent.
+ if (intf->node_type () == AST_Decl::NT_component)
+ {
+ (void) this->insert_non_dup (be_global->ccmobject ());
+
+ AST_Component *base =
+ AST_Component::narrow_from_decl (intf)->base_component ();
+
+ if (base != 0)
+ {
+ (void) this->insert_non_dup (base);
+
+ long n_supports = base->n_supports ();
+ AST_Interface **supports = base->supports ();
+
+ for (long j = 0; j < n_supports; ++j)
+ {
+ (void) this->insert_non_dup (supports[j],
+ abstract_paths_only);
+ }
+ }
+ }
+
+ (void) this->insert_non_dup (intf, abstract_paths_only);
+ }
+
+ // Do until queue is empty.
+ while (!this->insert_queue.is_empty ())
+ {
+ // 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.
+
+ // Dequeue the element at the head of the queue.
+ if (this->insert_queue.dequeue_head (intf))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_interface::traverse_graph - "
+ "dequeue_head failed\n"),
+ -1);
+ }
+
+ // Insert the dequeued element in the del_queue.
+ if (this->del_queue.enqueue_tail (intf) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_interface::traverse_graph - "
+ "enqueue_head failed\n"),
+ -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.
+ if (worker.emit (this, os, bi) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_interface::traverse_graph - "
+ "helper code gen failed\n"),
+ -1);
+ }
+ } // end of while queue not empty
+
+ return 0;
+}
+
+// Run GPERF and get the correct lookup and other operations
+// depending on which strategy we are using. Returns 0 on sucess, -1
+// on error.
+int
+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 << be_nl << be_nl << "// 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
+ // we are following.
+ switch (be_global->lookup_strategy ())
+ {
+ case BE_GlobalData::TAO_PERFECT_HASH:
+ // Output a class definition deriving from
+ // TAO_Perfect_Hash_OpTable.
+ this->gen_perfect_hash_class_definition (flat_name);
+
+ // Call GPERF and get the methods defined.
+ if (this->gen_gperf_lookup_methods (flat_name) == -1)
+ {
+ return -1;
+ }
+
+ // Create an instance of the correct class corresponding the
+ // operation lookup strategy we are following.
+ this->gen_perfect_hash_instance (flat_name);
+
+ break;
+
+ case BE_GlobalData::TAO_BINARY_SEARCH:
+ // Output a class definition deriving from
+ // TAO_Binary_Search_OpTable.
+ this->gen_binary_search_class_definition (flat_name);
+
+ // Call GPERF and get the methods defined.
+ if (gen_gperf_lookup_methods (flat_name) == -1)
+ {
+ return -1;
+ }
+
+ // Create an instance of the correct class corresponding the
+ // operation lookup strategy we are following.
+ this->gen_binary_search_instance (flat_name);
+
+ break;
+
+ case BE_GlobalData::TAO_LINEAR_SEARCH:
+ // Output a class definition deriving from
+ // TAO_Linear_Search_OpTable.
+ this->gen_linear_search_class_definition (flat_name);
+
+ // Call GPERF and get the methods defined.
+ if (this->gen_gperf_lookup_methods (flat_name) == -1)
+ {
+ return -1;
+ }
+
+ // Create an instance of the correct class corresponding the
+ // operation lookup strategy we are following.
+ this->gen_linear_search_instance (flat_name);
+
+ break;
+
+ default:
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "tao_idl:ERROR:%N:%l:Unknown Operation Lookup Strategy\n"
+ ),
+ -1
+ );
+ }
+
+ return 0;
+}
+
+
+// Outputs the class definition for the perfect hashing. This class
+// will inherit from the TAO_Perfect_Hash_OpTable.
+void
+be_interface::gen_perfect_hash_class_definition (const char *flat_name)
+{
+ // Outstream.
+ TAO_OutStream *os = this->strategy_->get_out_stream ();
+
+ *os << "class " << "TAO_" << flat_name << "_Perfect_Hash_OpTable"
+ << be_idt_nl
+ << ": public TAO_Perfect_Hash_OpTable" << be_uidt_nl
+ << "{" << be_nl
+ << "private:" << be_idt_nl
+ << "unsigned int hash (const char *str, unsigned int len);"
+ << be_uidt_nl << be_nl
+ << "public:" << be_idt_nl
+ << "const TAO_operation_db_entry * lookup "
+ << "(const char *str, unsigned int len);"
+ << be_uidt_nl
+ << "};\n\n";
+}
+
+// Outputs the class definition for the binary searching. This class
+// will inherit from the TAO_Binary_Seach_OpTable.
+void
+be_interface::gen_binary_search_class_definition (const char *flat_name)
+{
+ // Outstream.
+ TAO_OutStream *os = this->strategy_->get_out_stream ();
+
+ *os << "class " << "TAO_" << flat_name << "_Binary_Search_OpTable"
+ << be_idt_nl
+ << ": public TAO_Binary_Search_OpTable" << be_uidt_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl
+ << "const TAO_operation_db_entry * lookup (const char *str);"
+ << be_uidt_nl
+ << "};\n\n";
+}
+
+// Outputs the class definition for the linear search. This class
+// will inherit from the TAO_Linear_Search_OpTable.
+void
+be_interface::gen_linear_search_class_definition (const char *flat_name)
+{
+ // Outstream.
+ TAO_OutStream *ss = this->strategy_->get_out_stream ();
+
+ *ss << "class " << "TAO_" << flat_name << "_Linear_Search_OpTable"
+ << be_idt_nl
+ << ": public TAO_Linear_Search_OpTable" << be_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl
+ << "const TAO_operation_db_entry * lookup (const char *str);"
+ << be_uidt_nl
+ << "};\n\n";
+}
+
+// We have collected the input (Operations and the corresponding
+// skeleton pointers) for the gperf program. Now let us execute gperf
+// and get things done.
+// GPERF reads from our temp file and write to the Server Skeleton
+// file.
+int
+be_interface::gen_gperf_lookup_methods (const char *flat_name)
+{
+ // Using ACE_Process.
+ ACE_Process process;
+ ACE_Process_Options process_options;
+
+ // Adjust the offset of the underlying file pointer.
+ ACE_OS::rewind (tao_cg->gperf_input_stream ()->file ());
+
+ // Set the stdin and stdout appropriately for the gperf program.
+
+ // Stdin is our temp file. Close the temp file and open. We will use
+ // <open_temp_file> to open the file now, so that the file will get
+ // deleted once when we close the file.
+
+ // Close the file.
+ if (ACE_OS::fclose (tao_cg->gperf_input_stream ()->file ()) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p:File close failed on temp gperf's input file\n",
+ "fclose"),
+ -1);
+ }
+
+ // Open the temp file.
+#if defined (ACE_OPENVMS)
+ ACE_HANDLE input = ::open(tao_cg->gperf_input_filename(), O_RDONLY,
+ "shr=get,put,upd", "ctx=rec", "fop=dfw");
+#else
+ ACE_HANDLE input = ACE::open_temp_file (tao_cg->gperf_input_filename (),
+ O_RDONLY);
+#endif
+
+ if (input == ACE_INVALID_HANDLE)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p:File open failed on gperf's temp input file\n",
+ "open_temp_file"),
+ -1);
+ }
+
+ // Stdout is server skeleton. Do *not* close the file, just open
+ // again with <ACE_OS::open> with WRITE + APPEND option.. After
+ // this, remember to update the file offset to the correct location.
+
+#if defined (ACE_OPENVMS)
+ char* gperfOutput = tempnam(NULL, "idl_");
+ if (gperfOutput == NULL)
+ {
+ ACE_OS::close(input);
+ ACE_ERROR_RETURN ((LM_ERROR, "failed to allocate memory\n"), -1);
+ }
+ ACE_HANDLE output = ::open(gperfOutput, O_WRONLY | O_CREAT | O_EXCL,
+ ACE_DEFAULT_FILE_PERMS , "shr=get,put,upd", "ctx=rec", "fop=dfw");
+#else
+ ACE_HANDLE output = ACE_OS::open (this->strategy_->get_out_stream_fname (),
+ O_WRONLY | O_APPEND);
+#endif
+
+ if (output == ACE_INVALID_HANDLE)
+ {
+ ACE_OS::close (input);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p:File open failed on server skeleton file\n",
+ "open"),
+ -1);
+ }
+
+ // Seek to the end of the output file.
+ ACE_OS::lseek (output, 0, SEEK_END);
+
+ // Set the handles now in the process options.
+ process_options.set_handles (input, output);
+
+ int result = 0;
+
+ // Set the command line for the gperf program. Give the right
+ // arguments for the operation lookup strategy that we are using.
+ switch (be_global->lookup_strategy ())
+ {
+ // Perfect Hashing.
+ case BE_GlobalData::TAO_PERFECT_HASH:
+ process_options.command_line ("%s"
+ " "
+ "-m -M -J -c -C"
+ " "
+ "-D -E -T -f 0"
+ " "
+ "-F 0,0"
+ " "
+ "-a -o -t -p -K"
+ " "
+ "opname -L C++"
+ " "
+ "-Z TAO_%s_Perfect_Hash_OpTable"
+ " "
+ "-N lookup",
+ idl_global->gperf_path (),
+ flat_name);
+ break;
+
+ // Binary search methods from GPERF. Everythis and the -B flag.
+ case BE_GlobalData::TAO_BINARY_SEARCH:
+ process_options.command_line ("%s"
+ " "
+ "-B"
+ " "
+ "-m -M -J -c -C"
+ " "
+ "-D -E -T -f 0"
+ " "
+ "-F 0,0,0"
+ " "
+ "-a -o -t -p -K"
+ " "
+ "opname -L C++"
+ " "
+ "-Z TAO_%s_Binary_Search_OpTable"
+ " "
+ "-N lookup",
+ idl_global->gperf_path (),
+ flat_name);
+ break;
+
+ // Linear search methods from GPERF. Everything and the -Z flag.
+ case BE_GlobalData::TAO_LINEAR_SEARCH:
+ process_options.command_line ("%s"
+ " "
+ "-b"
+ " "
+ "-m -M -J -c -C"
+ " "
+ "-D -E -T -f 0"
+ " "
+ "-F 0,0"
+ " "
+ "-a -o -t -p -K"
+ " "
+ "opname -L C++"
+ " "
+ "-Z TAO_%s_Linear_Search_OpTable"
+ " "
+ "-N lookup",
+ idl_global->gperf_path (),
+ flat_name);
+ break;
+
+ default:
+ ACE_ERROR ((LM_ERROR,
+ "tao_idl:ERROR:%N:%l:Unknown Operation Lookup Strategy\n"));
+
+ result = -1;
+ }
+
+ if (result != -1)
+ {
+ // Spawn a process for gperf.
+ if (process.spawn (process_options) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "Error:%p:Couldnt spawn a process for gperf program\n",
+ "process.spawn"));
+
+ result = -1;
+ }
+
+ // Wait for gperf to complete.
+ else if (process.wait () == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "Error:%p:Error on waiting for completion of gperf program.\n",
+ "process.wait"));
+
+ result = -1;
+ }
+
+ // Adjust the file offset to the EOF for the server skeleton
+ // file.
+ ACE_OS::fseek (this->strategy_->get_out_stream()->file (),
+ 0,
+ SEEK_END);
+ }
+
+ ACE_OS::close (output);
+ ACE_OS::close (input);
+
+#if defined(ACE_OPENVMS)
+ ACE_OS::unlink(tao_cg->gperf_input_filename());
+ process_options.release_handles();
+ if (result != -1)
+ {
+ FILE* gperfOutputFile;
+ gperfOutputFile = ::fopen(gperfOutput, "r");
+ if (gperfOutputFile == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "Error:%p:Couldn't open gperf output file\n",
+ "fopen"));
+ result = -1;
+ }
+ else
+ {
+ FILE* out = this->strategy_->get_out_stream()->file();
+ int c;
+ while ((c = fgetc(gperfOutputFile)) != EOF)
+ {
+ fputc(c, out);
+ }
+ if (ferror(gperfOutputFile) || ferror(out))
+ {
+ ACE_ERROR ((LM_ERROR,
+ "Error:%p:Couldn't open gperf output file\n",
+ "get/put"));
+ result = -1;
+ }
+ fclose(gperfOutputFile);
+ }
+ }
+ ACE_OS::unlink(gperfOutput);
+ free(gperfOutput);
+#endif /* ACE_OPENVMS */
+
+ return result;
+}
+
+// Create an instance of this perfect hash table.
+void
+be_interface::gen_perfect_hash_instance (const char *flat_name)
+{
+ // Outstream.
+ TAO_OutStream *os = this->strategy_->get_out_stream ();
+
+ *os << be_nl
+ << "static TAO_" << flat_name << "_Perfect_Hash_OpTable"
+ << " "
+ << "tao_" << flat_name << "_optable;";
+}
+
+// Create an instance of the binary search optable.
+void
+be_interface::gen_binary_search_instance (const char *flat_name)
+{
+ // Outstream.
+ TAO_OutStream *os = this->strategy_->get_out_stream ();
+
+ *os << be_nl
+ << "static TAO_" << flat_name << "_Binary_Search_OpTable"
+ << " "
+ << "tao_" << flat_name << "_optable;";
+}
+
+
+// Create an instance of this perfect hash table.
+void
+be_interface::gen_linear_search_instance (const char *flat_name)
+{
+ // Outstream.
+ TAO_OutStream *os = this->strategy_->get_out_stream ();
+
+ *os << be_nl
+ << "static TAO_" << flat_name << "_Linear_Search_OpTable"
+ << " "
+ << "tao_" << flat_name << "_optable;";
+}
+
+int
+be_interface::is_a_helper (be_interface * /*derived*/,
+ be_interface *bi,
+ TAO_OutStream *os)
+{
+ // Emit the comparison code.
+ *os << "!ACE_OS::strcmp (" << be_idt << be_idt_nl
+ << "value," << be_nl
+ << "\"" << bi->repoID () << "\"" << be_uidt_nl
+ << ") ||" << be_uidt_nl;
+
+ return 0;
+}
+
+int
+be_interface::gen_skel_helper (be_interface *derived,
+ be_interface *ancestor,
+ TAO_OutStream *os)
+{
+ // If derived and ancestor are same, skip it.
+ if (derived == 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)
+ {
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl << be_nl;
+
+ if (os->stream_type () == TAO_OutStream::TAO_SVR_HDR)
+ {
+ // Generate the static method corresponding to this method.
+ *os << "static void" << be_nl
+ << d->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & server_request, " << be_nl
+ << "void * servant_upcall," << be_nl
+ << "void * servant" << env_dflts << be_uidt_nl
+ << ");" << be_uidt;
+ }
+ else
+ { // Generate code in the inline file.
+ // Generate the static method corresponding to this method.
+ *os << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << derived->full_skel_name () << "::"
+ << d->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & server_request," << be_nl
+ << "void * servant_upcall," << be_nl
+ << "void * servant" << env_decl << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ *os << ancestor->full_skel_name ()
+ << " * const impl = static_cast<"
+ << derived->full_skel_name ()
+ << " *> (servant);" << be_nl;
+
+ *os << ancestor->full_skel_name ()
+ << "::" << d->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "server_request," << be_nl
+ << "servant_upcall," << be_nl
+ << "impl" << env_arg << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}";
+ }
+ }
+ else if (d->node_type () == AST_Decl::NT_attr)
+ {
+ AST_Attribute *attr = AST_Attribute::narrow_from_decl (d);
+
+ if (attr == 0)
+ {
+ return -1;
+ }
+
+ *os << be_nl << be_nl;
+
+ if (os->stream_type () == TAO_OutStream::TAO_SVR_HDR)
+ {
+ // Generate the static method corresponding to this method.
+ *os << "static void" << be_nl
+ << "_get_" << d->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & server_request," << be_nl
+ << "void * servant_upcall," << be_nl
+ << "void * servant" << env_dflts << be_uidt_nl
+ << ");" << be_uidt;
+ }
+ else
+ { // Generate code in the inline file.
+ // Generate the static method corresponding to this method.
+ *os << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << derived->full_skel_name () << "::_get_"
+ << d->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & server_request," << be_nl
+ << "void * servant_upcall," << be_nl
+ << "void * servant" << env_decl << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ *os << ancestor->full_skel_name ()
+ << " * const impl = static_cast<"
+ << derived->full_skel_name ()
+ << " *> (servant);" << be_nl;
+
+ *os << ancestor->full_skel_name ()
+ << "::_get_" << d->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "server_request," << be_nl
+ << "servant_upcall," << be_nl
+ << "impl" << env_arg << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}";
+ }
+
+ if (!attr->readonly ())
+ {
+ *os << be_nl << be_nl;
+
+ if (os->stream_type () == TAO_OutStream::TAO_SVR_HDR)
+ {
+ // Generate the static method corresponding to
+ // this method.
+ *os << "static void" << be_nl
+ << "_set_" << d->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & server_request," << be_nl
+ << "void * servant_upcall," << be_nl
+ << "void * servant" << env_dflts << be_uidt_nl
+ << ");" << be_uidt;
+ }
+ else
+ { // Generate code in the inline file.
+ // Generate the static method corresponding to
+ // this method.
+ *os << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << derived->full_skel_name ()
+ << "::_set_" << d->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & server_request," << be_nl
+ << "void * servant_upcall," << be_nl
+ << "void * servant" << env_decl << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ *os << ancestor->full_skel_name ()
+ << " * const impl = static_cast<"
+ << derived->full_skel_name ()
+ << " *> (servant);" << be_nl;
+
+ *os << ancestor->full_skel_name ()
+ << "::_set_" << d->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "server_request," << be_nl
+ << "servant_upcall," << be_nl
+ << "impl" << env_arg << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}";
+ }
+ }
+ }
+ } // End of FOR.
+ }
+
+ return 0;
+}
+
+int
+be_interface::gen_colloc_op_decl_helper (be_interface *derived,
+ be_interface *ancestor,
+ TAO_OutStream *os)
+{
+ // If derived and ancestor are same, skip it.
+ if (derived == 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 () || ancestor->nmembers () == 0)
+ {
+ return 0;
+ }
+
+ UTL_ExceptList *list = 0;
+
+ 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)
+ {
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Generate the static method corresponding to this method.
+ *os << "static void" << be_nl
+ << d->local_name () << " (" << be_idt << be_idt_nl
+ << "TAO_Abstract_ServantBase *servant, " << be_nl
+ << "TAO::Argument ** args," << be_nl
+ << "int num_args" << env_dflts << be_uidt_nl
+ << ")";
+
+ list = be_operation::narrow_from_decl (d)->exceptions ();
+ be_interface::gen_throw_spec (list, os);
+
+ *os << ";";
+ }
+ else if (d->node_type () == AST_Decl::NT_attr)
+ {
+ AST_Attribute *attr = AST_Attribute::narrow_from_decl (d);
+
+ if (attr == 0)
+ {
+ return -1;
+ }
+
+ // Generate the static method corresponding to this method.
+ *os << "static void" << be_nl
+ << "_get_" << d->local_name () << " (" << be_idt << be_idt_nl
+ << "TAO_Abstract_ServantBase *servant, " << be_nl
+ << "TAO::Argument ** args," << be_nl
+ << "int num_args" << env_dflts << be_uidt_nl
+ << ")";
+
+ list = attr->get_get_exceptions ();
+ be_interface::gen_throw_spec (list, os);
+
+ *os << ";";
+
+ if (!attr->readonly ())
+ {
+ *os << be_nl << be_nl;
+
+ // Generate the static method corresponding to
+ // this method.
+ *os << "static void" << be_nl
+ << "_set_" << d->local_name () << " (" << be_idt << be_idt_nl
+ << "TAO_Abstract_ServantBase *servant, " << be_nl
+ << "TAO::Argument ** args," << be_nl
+ << "int num_args" << env_dflts << be_uidt_nl
+ << ")";
+
+ list = attr->get_set_exceptions ();
+ be_interface::gen_throw_spec (list, os);
+
+ *os << ";";
+ }
+ }
+ }
+
+ return 0;
+}
+
+int
+be_interface::gen_colloc_op_defn_helper (be_interface *derived,
+ be_interface *ancestor,
+ TAO_OutStream *os)
+{
+ // If derived and ancestor are same, skip it.
+ if (derived == 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 () || ancestor->nmembers () == 0)
+ {
+ return 0;
+ }
+
+ AST_Decl *d = 0;
+ be_operation *op = 0;
+
+ for (UTL_ScopeActiveIterator si (ancestor, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ // Get the next AST decl node
+ d = si.item ();
+
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ op = be_operation::narrow_from_decl (d);
+
+ if (be_global->gen_direct_collocation ())
+ {
+ be_interface::gen_collocated_skel_body (derived,
+ ancestor,
+ d,
+ "",
+ true,
+ op->exceptions (),
+ os);
+ }
+ }
+ else if (d->node_type () == AST_Decl::NT_attr)
+ {
+ AST_Attribute *attr = AST_Attribute::narrow_from_decl (d);
+
+ if (attr == 0)
+ {
+ return -1;
+ }
+
+ if (be_global->gen_direct_collocation ())
+ {
+ be_interface::gen_collocated_skel_body (
+ derived,
+ ancestor,
+ d,
+ "_get_",
+ true,
+ attr->get_get_exceptions (),
+ os
+ );
+ }
+
+ if (!attr->readonly ())
+ {
+ if (be_global->gen_direct_collocation ())
+ {
+ be_interface::gen_collocated_skel_body (
+ derived,
+ ancestor,
+ d,
+ "_set_",
+ true,
+ attr->get_set_exceptions (),
+ os
+ );
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+int
+be_interface::copy_ctor_helper (be_interface *derived,
+ be_interface *base,
+ TAO_OutStream *os)
+{
+ // 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;
+ }
+
+ *os << "," << be_idt_nl;
+
+ bool is_rh_base =
+ (ACE_OS::strcmp (base->flat_name (), "Messaging_ReplyHandler") == 0);
+
+ if (is_rh_base)
+ {
+ *os << "::POA_Messaging::ReplyHandler (rhs)";
+ }
+ else if (base->is_nested ())
+ {
+ be_decl *scope;
+ scope = be_scope::narrow_from_scope (base->defined_in ())->decl ();
+
+ *os << "POA_" << scope->name () << "::"
+ << base->local_name () << " (rhs)";
+ }
+ else
+ {
+ *os << base->full_skel_name () << " (rhs)";
+ }
+
+ *os << be_uidt;
+
+ return 0;
+}
+
+int
+be_interface::in_mult_inheritance_helper (be_interface *derived,
+ be_interface *base,
+ TAO_OutStream *)
+{
+ switch (derived->n_inherits ())
+ {
+ case 0:
+ // No parent.
+ derived->in_mult_inheritance (0);
+ break;
+ case 1:
+ if (derived == base)
+ {
+ // Prevent indefinite recursion.
+ derived->in_mult_inheritance (-1);
+ }
+ else
+ {
+ // One parent. We have the same characteristics as our base.
+ derived->in_mult_inheritance (base->in_mult_inheritance ());
+ }
+
+ break;
+ default:
+ // Direct multiple inheritance.
+ derived->in_mult_inheritance (1);
+ }
+
+ return 0;
+}
+
+int
+be_interface::gen_abstract_init_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os)
+{
+ if (node == base)
+ {
+ return 0;
+ }
+
+ *os << "," << be_nl;
+
+ if (base->is_nested ())
+ {
+ UTL_Scope *parent_scope = base->defined_in ();
+ AST_Decl *parent_decl = ScopeAsDecl (parent_scope);
+
+ *os << ""
+ << parent_decl->name () << "::"
+ << base->local_name ()<< " (" << be_idt << be_idt_nl;
+ }
+ else
+ {
+ *os << base->name () << " (" << be_idt << be_idt_nl;
+ }
+
+ *os << "objref," << be_nl
+ << "_tao_collocated," << be_nl
+ << "servant" << be_uidt_nl
+ << ")" << be_uidt;
+
+
+ return 0;
+}
+
+void
+be_interface::gen_throw_spec (UTL_ExceptList *list,
+ TAO_OutStream *os)
+{
+ const char *throw_spec_open = "throw (";
+ const char *throw_spec_close = ")";
+
+ if (!be_global->use_raw_throw ())
+ {
+ throw_spec_open = "ACE_THROW_SPEC ((";
+ throw_spec_close = "))";
+ }
+
+ *os << be_nl << throw_spec_open;
+ *os << be_idt_nl << "::CORBA::SystemException";
+
+ // Initialize an iterator to iterate thru the exception list.
+ for (UTL_ExceptlistActiveIterator ei (list);
+ !ei.is_done ();
+ ei.next ())
+ {
+ *os << "," << be_nl
+ << "::" << ei.item ()->name ();
+ }
+
+ *os << be_uidt_nl
+ << throw_spec_close << be_uidt;
+}
+
+void
+be_interface::destroy (void)
+{
+ // We know that it cannot be 0, but..
+ if (this->strategy_ != 0)
+ {
+ this->strategy_->destroy ();
+ delete this->strategy_;
+ this->strategy_ = 0;
+ }
+
+ // Call the destroy methods of our base classes.
+ this->AST_Interface::destroy ();
+ this->be_scope::destroy ();
+ this->be_type::destroy ();
+}
+
+int
+be_interface::accept (be_visitor *visitor)
+{
+ return visitor->visit_interface (this);
+}
+
+
+TAO_CodeGen::CG_STATE
+be_interface::next_state (TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state)
+{
+ return this->strategy_->next_state (current_state,
+ is_extra_state);
+}
+
+int
+be_interface::has_extra_code_generation (TAO_CodeGen::CG_STATE current_state)
+{
+ return this->strategy_->has_extra_code_generation (current_state);
+}
+
+void
+be_interface::original_interface (be_interface *original_interface)
+{
+ this->original_interface_ = original_interface;
+}
+
+be_interface *
+be_interface::original_interface ()
+{
+ return this->original_interface_;
+}
+
+be_interface *
+be_interface::replacement (void)
+{
+ return this->strategy_->replacement ();
+}
+
+int
+be_interface::has_mixed_parentage (void)
+{
+ if (this->is_abstract_)
+ {
+ return 0;
+ }
+
+ AST_Decl::NodeType nt = this->node_type ();
+
+ if (AST_Decl::NT_component == nt || AST_Decl::NT_home == nt)
+ {
+ return 0;
+ }
+
+ if (this->has_mixed_parentage_ == -1)
+ {
+ this->analyze_parentage ();
+ }
+
+ return this->has_mixed_parentage_;
+}
+
+int
+be_interface::session_component_child (void)
+{
+ if (this->session_component_child_ == -1)
+ {
+ // We are looking only for executor interfaces.
+ if (!this->is_local_)
+ {
+ this->session_component_child_ = 0;
+ return this->session_component_child_;
+ }
+
+ Identifier tail_id ("SessionComponent");
+ UTL_ScopedName tail (&tail_id, 0);
+ Identifier head_id ("Components");
+ UTL_ScopedName sn (&head_id, &tail);
+
+ AST_Decl *session_component =
+ const_cast<be_interface*> (this)->scope ()->lookup_by_name (&sn,
+ true);
+
+ tail_id.destroy ();
+ head_id.destroy ();
+
+ // If Components::SessionComponent is not in the AST, we are
+ // barking up the wrong tree.
+ if (session_component == 0)
+ {
+ this->session_component_child_ = 0;
+ return this->session_component_child_;
+ }
+
+ for (long i = 0; i < this->pd_n_inherits; ++i)
+ {
+ AST_Decl *tmp = this->pd_inherits[i];
+
+ if (tmp == session_component)
+ {
+ this->session_component_child_ = 1;
+ return this->session_component_child_;
+ }
+ }
+
+ this->session_component_child_ = 0;
+ }
+
+ return this->session_component_child_;
+}
+
+bool
+be_interface::is_event_consumer (void)
+{
+ return
+ this->pd_n_inherits == 1
+ && ACE_OS::strcmp (this->pd_inherits[0]->full_name (),
+ "Components::EventConsumerBase") == 0;
+}
+
+const char *
+be_interface::base_proxy_impl_name (void)
+{
+ return this->strategy_->base_proxy_impl_name ();
+}
+
+const char *
+be_interface::full_base_proxy_impl_name (void)
+{
+ return this->strategy_->full_base_proxy_impl_name ();
+}
+
+const char *
+be_interface::remote_proxy_impl_name (void)
+{
+ return this->strategy_->remote_proxy_impl_name ();
+}
+
+const char *
+be_interface::full_remote_proxy_impl_name (void)
+{
+ return this->strategy_->full_remote_proxy_impl_name ();
+}
+
+const char *
+be_interface::direct_proxy_impl_name (void)
+{
+ return this->strategy_->direct_proxy_impl_name ();
+}
+
+const char *
+be_interface::full_direct_proxy_impl_name (void)
+{
+ return this->strategy_->full_direct_proxy_impl_name ();
+}
+
+
+const char *
+be_interface::base_proxy_broker_name (void)
+{
+ return this->strategy_->base_proxy_broker_name ();
+}
+
+const char *
+be_interface::full_base_proxy_broker_name (void)
+{
+ return this->strategy_->full_base_proxy_broker_name ();
+}
+
+
+const char *
+be_interface::remote_proxy_broker_name (void)
+{
+ return this->strategy_->remote_proxy_broker_name ();
+}
+
+const char *
+be_interface::full_remote_proxy_broker_name (void)
+{
+ return this->strategy_->full_remote_proxy_broker_name ();
+}
+
+
+const char *
+be_interface::strategized_proxy_broker_name (void)
+{
+ return this->strategy_->strategized_proxy_broker_name ();
+}
+
+const char *
+be_interface::full_strategized_proxy_broker_name (void)
+{
+ return this->strategy_->full_strategized_proxy_broker_name ();
+}
+
+const char *
+be_interface::client_enclosing_scope (void)
+{
+ return this->strategy_->client_scope ();
+}
+
+const char *
+be_interface::flat_client_enclosing_scope (void)
+{
+ return this->strategy_->flat_client_scope ();
+}
+
+const char *
+be_interface::server_enclosing_scope (void)
+{
+ return this->strategy_->server_scope ();
+}
+
+
+// Narrowing
+IMPL_NARROW_METHODS3 (be_interface, AST_Interface, be_scope, be_type)
+IMPL_NARROW_FROM_DECL (be_interface)
+IMPL_NARROW_FROM_SCOPE (be_interface)
diff --git a/TAO/TAO_IDL/be/be_interface_fwd.cpp b/TAO/TAO_IDL/be/be_interface_fwd.cpp
new file mode 100644
index 00000000000..b5fe8edb8c8
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_interface_fwd.cpp
@@ -0,0 +1,99 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_interface_fwd.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_InterfaceFwd that provides additional means for C++
+// mapping of an interface.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_interface_fwd.h"
+#include "be_interface.h"
+#include "be_visitor.h"
+#include "ast_interface.h"
+
+ACE_RCSID (be,
+ be_interface_fwd,
+ "$Id$")
+
+be_interface_fwd::be_interface_fwd (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_InterfaceFwd (),
+ be_decl (),
+ be_type ()
+{
+ // Always the case.
+ this->size_type (AST_Type::VARIABLE);
+}
+
+be_interface_fwd::be_interface_fwd (AST_Interface *dummy,
+ UTL_ScopedName *n)
+ : COMMON_Base (dummy->is_local (),
+ dummy->is_abstract ()),
+ AST_Decl (AST_Decl::NT_interface_fwd,
+ n),
+ AST_Type (AST_Decl::NT_interface_fwd,
+ n),
+ AST_InterfaceFwd (dummy,
+ n),
+ be_decl (AST_Decl::NT_interface_fwd,
+ n),
+ be_type (AST_Decl::NT_interface_fwd,
+ n)
+{
+ // Always the case.
+ this->size_type (AST_Type::VARIABLE);
+}
+
+be_interface_fwd::~be_interface_fwd (void)
+{
+}
+
+void
+be_interface_fwd::seen_in_sequence (bool val)
+{
+ this->be_type::seen_in_sequence (val);
+ be_interface *fd =
+ be_interface::narrow_from_decl (this->full_definition ());
+ fd->seen_in_sequence (val);
+}
+
+void
+be_interface_fwd::seen_in_operation (bool val)
+{
+ this->be_type::seen_in_operation (val);
+ be_interface *fd =
+ be_interface::narrow_from_decl (this->full_definition ());
+ fd->seen_in_operation (val);
+}
+
+void
+be_interface_fwd::destroy (void)
+{
+ this->be_type::destroy ();
+ this->AST_InterfaceFwd::destroy ();
+}
+
+int
+be_interface_fwd::accept (be_visitor *visitor)
+{
+ return visitor->visit_interface_fwd (this);
+}
+
+// Narrowing
+IMPL_NARROW_METHODS2 (be_interface_fwd, AST_InterfaceFwd, be_type)
+IMPL_NARROW_FROM_DECL (be_interface_fwd)
diff --git a/TAO/TAO_IDL/be/be_interface_strategy.cpp b/TAO/TAO_IDL/be/be_interface_strategy.cpp
new file mode 100644
index 00000000000..29894b7e2ae
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_interface_strategy.cpp
@@ -0,0 +1,1124 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_interface_strategy.cpp
+//
+// = DESCRIPTION
+// A strategy to cover the differences between various variants
+// of an interface
+//
+// = AUTHOR
+// Michael Kircher
+//
+// ============================================================================
+
+#include "be_interface_strategy.h"
+#include "be_interface.h"
+#include "be_extern.h"
+#include "utl_identifier.h"
+
+ACE_RCSID (be,
+ be_interface_strategy,
+ "$Id$")
+
+
+be_interface_strategy::be_interface_strategy (be_interface *node,
+ Strategy_Kind strategy_type)
+ : local_name_(0),
+ full_name_(0),
+ flat_name_(0),
+ repoID_(0),
+ full_skel_name_(0),
+ full_coll_name_(0),
+ local_coll_name_(0),
+ relative_skel_name_(0),
+ node_ (node),
+ cached_type_ (-1),
+ strategy_type_ (strategy_type)
+{
+}
+
+be_interface_strategy::~be_interface_strategy (void)
+{
+}
+
+// Interface Type Strategy Base Class
+
+// Relative skeleton name.
+const char *
+be_interface_strategy::relative_skel_name (const char *skel_name)
+{
+ return be_interface::relative_name (this->full_skel_name (),
+ skel_name);
+}
+
+
+
+// Compute stringified fully qualified collocated class name.
+void
+be_interface_strategy::compute_coll_names (int type,
+ const char *prefix,
+ const char *suffix)
+{
+ if (type == this->cached_type_ && this->full_coll_name_ != 0)
+ {
+ return;
+ }
+ else
+ {
+ this->cached_type_ = type;
+ delete [] this->full_coll_name_;
+ delete [] this->local_coll_name_;
+ }
+
+ 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];
+
+ size_t name_len = ACE_OS::strlen (collocated)
+ + ACE_OS::strlen (poa)
+ + 1;
+
+ if (prefix)
+ {
+ name_len += ACE_OS::strlen (prefix);
+ }
+
+ if (suffix)
+ {
+ name_len += ACE_OS::strlen (suffix);
+ }
+
+ for (UTL_IdListActiveIterator i (this->node_->name ());
+ !i.is_done ();
+ i.next ())
+ {
+ // Reserve 2 characters for "::".
+ name_len += ACE_OS::strlen (i.item ()->get_string ()) + 2;
+ }
+
+ ACE_NEW (this->full_coll_name_,
+ char[name_len + 1]);
+
+ // Null terminate the string.
+ this->full_coll_name_[0] = 0;
+
+ // Only the first component get the "POA_" preffix.
+ int poa_added = 0;
+
+ // Iterate again.
+ // Must advance the iterator explicitly inside the loop.
+ for (UTL_IdListActiveIterator j (this->node_->name ());
+ !j.is_done ();)
+ {
+ const char *item = j.item ()->get_string ();
+
+ // Increase right away, so we can test for the final component
+ // in the loop.
+ j.next ();
+
+ // We add the POA_ preffix only if the first component is not
+ // the global scope...
+ if (ACE_OS::strcmp (item, "") != 0)
+ {
+ if (!j.is_done ())
+ {
+ // We only add the POA_ preffix if there are more than
+ // two components in the name, in other words, if the
+ // class is inside some scope.
+ if (!poa_added)
+ {
+ ACE_OS::strcat (this->full_coll_name_, poa);
+ poa_added = 1;
+ }
+ ACE_OS::strcat (this->full_coll_name_, item);
+ ACE_OS::strcat (this->full_coll_name_, "::");
+ }
+ else
+ {
+ ACE_OS::strcat (this->full_coll_name_, collocated);
+
+ if (prefix)
+ {
+ ACE_OS::strcat (this->full_coll_name_, prefix);
+ }
+
+ ACE_OS::strcat (this->full_coll_name_, item);
+
+ if (suffix)
+ {
+ ACE_OS::strcat (this->full_coll_name_, suffix);
+ }
+ }
+ }
+ }
+
+ // Compute the local name for the collocated class.
+ char *local_name = this->node_->AST_Interface::local_name ()->get_string ();
+ size_t local_len = ACE_OS::strlen (collocated)
+ + ACE_OS::strlen (local_name)
+ + 1;
+ if (prefix)
+ {
+ local_len += ACE_OS::strlen (prefix);
+ }
+
+ if (suffix)
+ {
+ local_len += ACE_OS::strlen (suffix);
+ }
+
+ ACE_NEW (this->local_coll_name_,
+ char[local_len]);
+
+ ACE_OS::strcpy (this->local_coll_name_,
+ collocated);
+
+ if (prefix)
+ {
+ ACE_OS::strcat (this->local_coll_name_,
+ prefix);
+ }
+
+ ACE_OS::strcat (this->local_coll_name_,
+ node_->AST_Interface::local_name ()->get_string ());
+
+ if (suffix)
+ {
+ ACE_OS::strcat (this->local_coll_name_, suffix);
+ }
+}
+
+
+void
+be_interface_strategy::compute_names (const char *name,
+ const char *prefix,
+ const char *suffix,
+ char *&new_name)
+{
+ if (!prefix || !suffix)
+ {
+ return;
+ }
+
+ size_t name_length = ACE_OS::strlen (name) +
+ ACE_OS::strlen (prefix) +
+ ACE_OS::strlen (suffix);
+
+ ACE_NEW (new_name,
+ char[name_length + 1]);
+
+ // Copy it in.
+ ACE_OS::strcpy (new_name, name);
+
+ const char *interface_name = 0;
+ size_t i = ACE_OS::strlen (name);
+
+ for (;i >= 1; i--)
+ {
+ if (name[i-1] == ':' && name[i] == ':')
+ {
+ interface_name = &name[i+1];
+ break;
+ }
+ else if (i >= 3)
+ {
+ if (name[i-3] == 'P' &&
+ name[i-2] == 'O' &&
+ name[i-1] == 'A' &&
+ name[i] == '_')
+ {
+ interface_name = &name[i+1];
+ break;
+ }
+ }
+ }
+
+ if (interface_name == 0)
+ {
+ interface_name = name;
+ }
+
+ ACE_OS::strcpy (&new_name[name_length
+ - ACE_OS::strlen (prefix)
+ - ACE_OS::strlen (interface_name)
+ - ACE_OS::strlen (suffix)],
+ prefix);
+
+ ACE_OS::strcpy (&new_name[name_length
+ - ACE_OS::strlen (interface_name)
+ - ACE_OS::strlen (suffix)],
+ interface_name);
+
+ ACE_OS::strcpy (&new_name[name_length
+ - ACE_OS::strlen(suffix)],
+ suffix);
+}
+
+
+TAO_OutStream *
+be_interface_strategy::get_out_stream (void)
+{
+ // Outstream.
+ return tao_cg->server_skeletons ();
+}
+
+const char *
+be_interface_strategy::get_out_stream_fname (void)
+{
+ return be_global->be_get_server_skeleton_fname ();
+}
+
+int
+be_interface_strategy::strategy_type (void)
+{
+ return strategy_type_;
+}
+
+TAO_CodeGen::CG_STATE
+be_interface_strategy::next_state (TAO_CodeGen::CG_STATE current_state,
+ int /* is_extra_state */)
+{
+ return current_state;
+}
+
+int
+be_interface_strategy::has_extra_code_generation (
+ TAO_CodeGen::CG_STATE /* current_state */
+ )
+{
+ return 0;
+}
+
+be_interface *
+be_interface_strategy::replacement (void)
+{
+ return 0;
+}
+
+void
+be_interface_strategy::destroy (void)
+{
+ if (this->local_name_ != 0)
+ {
+ delete [] this->local_name_;
+ this->local_name_ = 0;
+ }
+
+ if (this->full_name_ != 0)
+ {
+ delete [] this->full_name_;
+ this->full_name_ = 0;
+ }
+
+ if (this->flat_name_ != 0)
+ {
+ delete [] this->flat_name_;
+ this->flat_name_ = 0;
+ }
+
+ if (this->repoID_ != 0)
+ {
+ delete [] this->repoID_;
+ this->repoID_ = 0;
+ }
+
+ if (this->full_skel_name_ != 0)
+ {
+ delete [] this->full_skel_name_;
+ this->full_skel_name_ = 0;
+ }
+
+ if (this->full_coll_name_ != 0)
+ {
+ delete [] this->full_coll_name_;
+ this->full_coll_name_ = 0;
+ }
+
+ if (this->local_coll_name_ != 0)
+ {
+ delete [] this->local_coll_name_;
+ this->local_coll_name_ = 0;
+ }
+
+ if (this->relative_skel_name_ != 0)
+ {
+ delete [] this->relative_skel_name_;
+ this->relative_skel_name_ = 0;
+ }
+}
+
+// ****************************************************************
+// Default Strategy
+
+const char *be_interface_default_strategy::suffix_table_[] =
+{
+ "_Proxy_Impl",
+ "_Proxy_Broker"
+};
+
+const char *be_interface_default_strategy::tag_table_[] =
+{
+ "_Remote",
+ "_ThruPOA",
+ "_Direct",
+ "_Strategized",
+ "_TAO_"
+};
+
+
+be_interface_default_strategy::be_interface_default_strategy (
+ be_interface *node,
+ Strategy_Kind strategy_kind
+ )
+ : be_interface_strategy (node,
+ strategy_kind),
+ base_proxy_impl_name_ (0),
+ remote_proxy_impl_name_ (0),
+ direct_proxy_impl_name_ (0),
+ full_base_proxy_impl_name_ (0),
+ full_remote_proxy_impl_name_ (0),
+ full_direct_proxy_impl_name_ (0),
+ base_proxy_broker_ (0),
+ remote_proxy_broker_ (0),
+ strategized_proxy_broker_ (0),
+ full_base_proxy_broker_name_ (0),
+ full_remote_proxy_broker_name_ (0),
+ full_strategized_proxy_broker_name_(0),
+ client_scope_ (0),
+ flat_client_scope_ (0),
+ server_scope_ (0),
+ flat_server_scope_ (0)
+{
+}
+
+be_interface_default_strategy::~be_interface_default_strategy (void)
+{
+}
+
+const char *
+be_interface_default_strategy::full_name (void)
+{
+ if (this->full_name_ == 0)
+ {
+ size_t len = ACE_OS::strlen (node_->be_decl::full_name ());
+
+ ACE_NEW_RETURN (this->full_name_,
+ char[len + 1],
+ 0);
+
+ ACE_OS::strcpy (this->full_name_,
+ node_->be_decl::full_name ());
+ }
+
+ return this->full_name_;
+}
+
+const char *
+be_interface_default_strategy::local_name (void)
+{
+ if (!this->local_name_)
+ {
+ size_t len =
+ ACE_OS::strlen (node_->AST_Interface::local_name ()->get_string ());
+
+ ACE_NEW_RETURN (this->local_name_,
+ char[len + 1],
+ 0);
+
+ ACE_OS::strcpy (this->local_name_,
+ node_->AST_Interface::local_name ()->get_string ());
+ }
+
+ return this->local_name_;
+}
+
+const char *
+be_interface_default_strategy::flat_name (void)
+{
+ if (!this->flat_name_)
+ {
+ size_t len = ACE_OS::strlen (node_->be_decl::flat_name ());
+
+ ACE_NEW_RETURN (this->flat_name_,
+ char[len + 1],
+ 0);
+
+ ACE_OS::strcpy (this->flat_name_,
+ node_->be_decl::flat_name ());
+ }
+
+ return this->flat_name_;
+}
+
+const char *
+be_interface_default_strategy::repoID (void)
+{
+ if (this->repoID_ == 0)
+ {
+ size_t len = ACE_OS::strlen (node_->be_decl::repoID ());
+
+ ACE_NEW_RETURN (this->repoID_,
+ char[len + 1],
+ 0);
+
+ ACE_OS::strcpy (this->repoID_,
+ node_->be_decl::repoID ());
+ }
+
+ return this->repoID_;
+}
+
+const char *
+be_interface_default_strategy::full_skel_name (void)
+{
+ if (this->full_skel_name_ == 0)
+ {
+ // the following method is inherited from the base class
+ node_->compute_full_skel_name ("POA_",
+ this->full_skel_name_);
+ }
+
+ return this->full_skel_name_;
+}
+
+
+const char *
+be_interface_default_strategy::full_coll_name (int type)
+{
+ this->compute_coll_names (type,
+ 0, // prefix
+ 0); // suffix
+
+ return this->full_coll_name_;
+}
+
+const char *
+be_interface_default_strategy::local_coll_name (int type)
+{
+ this->compute_coll_names (type,
+ 0, // prefix
+ 0); // suffix
+
+ return this->local_coll_name_;
+}
+
+char *
+be_interface_default_strategy::create_with_prefix_suffix (
+ const char *prefix,
+ const char *str,
+ const char *suffix,
+ const char *separator
+ )
+{
+ char *cat_string = 0;
+ size_t length =
+ ACE_OS::strlen (str) +
+ ACE_OS::strlen (prefix) +
+ ACE_OS::strlen (suffix) +
+ ACE_OS::strlen (separator) +
+ 1; // The '/0'
+
+ ACE_NEW_RETURN (cat_string,
+ char[length],
+ 0);
+
+ ACE_OS::strcpy (cat_string, prefix);
+ ACE_OS::strcat (cat_string, str);
+ ACE_OS::strcat (cat_string, separator);
+ ACE_OS::strcat (cat_string, suffix);
+
+ return cat_string;
+}
+
+const char *
+be_interface_default_strategy::base_proxy_impl_name (void)
+{
+ if (this->base_proxy_impl_name_ != 0)
+ {
+ return this->base_proxy_impl_name_;
+ }
+
+ this->base_proxy_impl_name_ =
+ this->create_with_prefix_suffix (this->tag_table_[GC_PREFIX],
+ this->node_->local_name (),
+ this->suffix_table_[PROXY_IMPL]);
+
+ return this->base_proxy_impl_name_;
+}
+
+
+const char *
+be_interface_default_strategy::client_scope (void)
+{
+ if (this->client_scope_ != 0)
+ {
+ return this->client_scope_;
+ }
+
+ const char *full_name = this->full_name ();
+ const char *name = this->local_name ();
+
+ size_t offset = ACE_OS::strlen (name);
+ size_t length = ACE_OS::strlen (full_name) - offset;
+ ACE_NEW_RETURN (this->client_scope_,
+ char[length + 1],
+ 0);
+
+ ACE_OS::strncpy (this->client_scope_, full_name, length);
+ this->client_scope_[length] = '\0';
+
+ return this->client_scope_;
+}
+const char *
+be_interface_default_strategy::flat_client_scope (void)
+{
+ if (this->flat_client_scope_ != 0)
+ {
+ return this->flat_client_scope_;
+ }
+
+ const char *full_name = this->flat_name ();
+ const char *name = this->local_name ();
+
+ size_t offset = ACE_OS::strlen (name);
+ size_t length = ACE_OS::strlen (full_name) - offset;
+ 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';
+
+ return this->flat_client_scope_;
+}
+
+
+const char *
+be_interface_default_strategy::server_scope (void)
+{
+ if (this->server_scope_ != 0)
+ {
+ return this->server_scope_;
+ }
+
+ const char *full_name =
+ this->node_->full_coll_name (be_interface::DIRECT);
+
+ const char *name = this->node_->local_coll_name (be_interface::DIRECT);
+
+ size_t offset = ACE_OS::strlen (name);
+ size_t length = ACE_OS::strlen (full_name) - offset;
+ ACE_NEW_RETURN (this->server_scope_,
+ char[length + 1],
+ 0);
+
+ ACE_OS::strncpy (this->server_scope_, full_name, length);
+ this->server_scope_[length] = '\0';
+
+ return this->server_scope_;
+}
+
+const char *
+be_interface_default_strategy::flat_server_scope (void)
+{
+ if (this->flat_server_scope_ != 0)
+ {
+ return this->flat_server_scope_;
+ }
+
+ const char *full_name = this->flat_name ();
+ const char *name = this->local_name ();
+
+ size_t offset = ACE_OS::strlen (name);
+ size_t length = ACE_OS::strlen (full_name) - offset;
+ 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';
+
+ return this->flat_server_scope_;
+}
+
+
+
+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_;
+ }
+
+ const char *scope = this->client_scope ();
+ const char *base_name = this->base_proxy_impl_name ();
+ size_t length = ACE_OS::strlen (scope) + ACE_OS::strlen (base_name);
+ 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);
+
+ return this->full_base_proxy_impl_name_;
+}
+
+
+
+const char *
+be_interface_default_strategy::remote_proxy_impl_name (void)
+{
+ if (this->remote_proxy_impl_name_ != 0)
+ {
+ return this->remote_proxy_impl_name_;
+ }
+
+
+ this->remote_proxy_impl_name_ =
+ this->create_with_prefix_suffix (this->tag_table_[GC_PREFIX],
+ this->node_->local_name (),
+ this->suffix_table_[PROXY_IMPL],
+ this->tag_table_[REMOTE]);
+
+ return this->remote_proxy_impl_name_;
+}
+
+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_;
+ }
+
+ const char *scope = this->client_scope ();
+ const char *base_name = this->remote_proxy_impl_name ();
+ size_t length = ACE_OS::strlen (scope) + ACE_OS::strlen (base_name);
+ 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);
+
+ return this->full_remote_proxy_impl_name_;
+}
+
+const char *
+be_interface_default_strategy::direct_proxy_impl_name (void)
+{
+ if (this->direct_proxy_impl_name_ != 0)
+ {
+ return this->direct_proxy_impl_name_;
+ }
+
+ this->direct_proxy_impl_name_ =
+ this->create_with_prefix_suffix (this->tag_table_[GC_PREFIX],
+ this->node_->local_name (),
+ this->suffix_table_[PROXY_IMPL],
+ this->tag_table_[DIRECT]);
+
+ return this->direct_proxy_impl_name_;
+}
+
+
+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_;
+ }
+
+ const char *scope = this->server_scope ();
+ const char *base_name = this->direct_proxy_impl_name ();
+
+ size_t length = ACE_OS::strlen (scope) + ACE_OS::strlen (base_name);
+ 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);
+
+ return this->full_direct_proxy_impl_name_;
+}
+
+
+const char *
+be_interface_default_strategy::base_proxy_broker_name (void)
+{
+ if (this->base_proxy_broker_ != 0)
+ {
+ return this->base_proxy_broker_;
+ }
+
+ this->base_proxy_broker_ =
+ this->create_with_prefix_suffix (this->tag_table_[GC_PREFIX],
+ this->node_->local_name (),
+ this->suffix_table_[PROXY_BROKER]);
+
+ return this->base_proxy_broker_;
+}
+
+
+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_;
+ }
+
+ const char *scope = this->client_scope ();
+ const char *base_name = this->base_proxy_broker_name ();
+ size_t length = ACE_OS::strlen (scope) + ACE_OS::strlen (base_name);
+ 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);
+
+ return this->full_base_proxy_broker_name_;
+}
+
+const char *
+be_interface_default_strategy::remote_proxy_broker_name (void)
+{
+ if (this->remote_proxy_broker_ != 0)
+ {
+ return this->remote_proxy_broker_;
+ }
+
+ this->remote_proxy_broker_ =
+ this->create_with_prefix_suffix (this->tag_table_[GC_PREFIX],
+ this->node_->local_name (),
+ this->suffix_table_[PROXY_BROKER],
+ this->tag_table_[REMOTE]);
+
+ return this->remote_proxy_broker_;
+}
+
+
+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_;
+ }
+
+ const char *scope = this->client_scope ();
+ const char *base_name = this->remote_proxy_broker_name ();
+ size_t length = ACE_OS::strlen (scope) + ACE_OS::strlen (base_name);
+ 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);
+
+ return this->full_remote_proxy_broker_name_;
+}
+
+
+const char *
+be_interface_default_strategy::strategized_proxy_broker_name (void)
+{
+ if (this->strategized_proxy_broker_ != 0)
+ {
+ return this->strategized_proxy_broker_;
+ }
+
+ this->strategized_proxy_broker_ =
+ this->create_with_prefix_suffix (this->tag_table_[GC_PREFIX],
+ this->node_->local_name (),
+ this->suffix_table_[PROXY_BROKER],
+ this->tag_table_[STRATEGIZED]);
+
+ return this->strategized_proxy_broker_;
+}
+
+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_;
+ }
+
+ const char *scope = this->server_scope ();
+ const char *base_name = this->strategized_proxy_broker_name ();
+ size_t length = ACE_OS::strlen (scope) + ACE_OS::strlen (base_name);
+ 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);
+
+ return this->full_strategized_proxy_broker_name_;
+}
+
+void
+be_interface_default_strategy::destroy (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->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_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;
+ }
+
+ this->be_interface_strategy::destroy ();
+}
+
+// ****************************************************************
+// AMI Handler Strategy
+
+be_interface_ami_handler_strategy::be_interface_ami_handler_strategy (
+ be_interface *node
+ )
+ : be_interface_default_strategy (node,
+ AMI_HANDLER)
+{
+}
+
+be_interface_ami_handler_strategy::~be_interface_ami_handler_strategy (void)
+{
+}
+
+
+TAO_CodeGen::CG_STATE
+be_interface_ami_handler_strategy::next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int /*is_extra_state */
+ )
+{
+ return current_state;
+}
+
+
+// ****************************************************************
+// AMI Exception Holder Strategy
+
+be_interface_ami_exception_holder_strategy::
+be_interface_ami_exception_holder_strategy (be_interface *node)
+ : be_interface_default_strategy (node,
+ AMI_EXCEPTION_HOLDER)
+{
+}
+
+be_interface_ami_exception_holder_strategy
+::~be_interface_ami_exception_holder_strategy (void)
+{
+}
+
+
+TAO_CodeGen::CG_STATE
+be_interface_ami_exception_holder_strategy::next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state
+ )
+{
+ if (is_extra_state)
+ {
+ switch (current_state)
+ {
+ case TAO_CodeGen::TAO_VALUETYPE_OBV_CH:
+ return TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CH;
+ case TAO_CodeGen::TAO_VALUETYPE_OBV_CS:
+ return TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CS;
+ default:
+ return current_state;
+ }
+ }
+ else
+ {
+ return current_state;
+ }
+}
+
+
+int
+be_interface_ami_exception_holder_strategy::has_extra_code_generation (
+ TAO_CodeGen::CG_STATE current_state
+ )
+{
+ if (current_state == TAO_CodeGen::TAO_VALUETYPE_OBV_CH
+ || current_state == TAO_CodeGen::TAO_VALUETYPE_OBV_CS)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+
+// ****************************************************************
+// AMI Strategy
+
+be_interface_ami_strategy::be_interface_ami_strategy (be_interface *node,
+ be_interface *handler)
+ : be_interface_default_strategy (node,
+ AMI_INTERFACE),
+ handler_ (handler)
+{
+}
+
+be_interface_ami_strategy::~be_interface_ami_strategy (void)
+{
+}
+
+
+TAO_CodeGen::CG_STATE
+be_interface_ami_strategy::next_state (TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state)
+{
+ if (is_extra_state)
+ {
+ switch (current_state)
+ {
+ case TAO_CodeGen::TAO_AMI_INTERFACE_CH:
+ return TAO_CodeGen::TAO_INTERFACE_CH;
+ default:
+ return current_state;
+ }
+ }
+ else
+ {
+ switch (current_state)
+ {
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ return TAO_CodeGen::TAO_AMI_INTERFACE_CH;
+ default:
+ return current_state;
+ }
+ }
+}
+
+
+int
+be_interface_ami_strategy::has_extra_code_generation (
+ TAO_CodeGen::CG_STATE current_state
+ )
+{
+ if (current_state == TAO_CodeGen::TAO_AMI_INTERFACE_CH)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_interface *
+be_interface_ami_strategy::replacement (void)
+{
+ return handler_;
+}
+
diff --git a/TAO/TAO_IDL/be/be_module.cpp b/TAO/TAO_IDL/be/be_module.cpp
new file mode 100644
index 00000000000..363585e7d47
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_module.cpp
@@ -0,0 +1,68 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_module.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Module that provides additional means for C++
+// mapping of a module
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_module.h"
+#include "be_visitor.h"
+
+ACE_RCSID (be,
+ be_module,
+ "$Id$")
+
+be_module::be_module (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ UTL_Scope (),
+ be_scope (),
+ be_decl ()
+{
+}
+
+be_module::be_module (UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_module,
+ n),
+ UTL_Scope (AST_Decl::NT_module),
+ AST_Module (n),
+ be_scope (AST_Decl::NT_module),
+ be_decl (AST_Decl::NT_module,
+ n)
+{
+}
+
+void
+be_module::destroy (void)
+{
+ // Call the destroy methods of our base classes.
+ this->be_scope::destroy ();
+ this->be_decl::destroy ();
+ this->AST_Module::destroy ();
+}
+
+int
+be_module::accept (be_visitor *visitor)
+{
+ return visitor->visit_module (this);
+}
+
+// Narrowing
+IMPL_NARROW_METHODS3 (be_module, AST_Module, be_scope, be_decl)
+IMPL_NARROW_FROM_DECL (be_module)
+IMPL_NARROW_FROM_SCOPE (be_module)
diff --git a/TAO/TAO_IDL/be/be_native.cpp b/TAO/TAO_IDL/be/be_native.cpp
new file mode 100644
index 00000000000..5174efd0f5d
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_native.cpp
@@ -0,0 +1,96 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_native.cpp
+//
+// = DESCRIPTION
+// The native IDL type
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_native.h"
+#include "be_visitor.h"
+
+ACE_RCSID (be,
+ be_native,
+ "$Id$")
+
+
+be_native::be_native (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType (),
+ UTL_Scope (),
+ AST_Structure (),
+ AST_Native (),
+ be_scope (),
+ be_decl (),
+ be_type (),
+ be_exception ()
+{
+}
+
+be_native::be_native (UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_native,
+ n),
+ AST_Type (AST_Decl::NT_native,
+ n),
+ AST_ConcreteType (AST_Decl::NT_native,
+ n),
+ UTL_Scope (AST_Decl::NT_native),
+ AST_Structure (AST_Decl::NT_native,
+ n,
+ true,
+ false),
+ AST_Exception (n,
+ true,
+ false),
+ AST_Native (n),
+ be_decl (AST_Decl::NT_native,
+ n),
+ be_type (AST_Decl::NT_native,
+ n),
+ be_exception (n,
+ true,
+ false)
+{
+}
+
+int
+be_native::gen_typecode (void)
+{
+ return 0;
+}
+
+long
+be_native::tc_size (void)
+{
+ return 0;
+}
+
+void
+be_native::destroy (void)
+{
+ this->be_exception::destroy ();
+ this->AST_Native::destroy ();
+}
+
+int
+be_native::accept (be_visitor *visitor)
+{
+ return visitor->visit_native (this);
+}
+
+// Narrowing
+IMPL_NARROW_METHODS2(be_native, AST_Native, be_exception)
+IMPL_NARROW_FROM_DECL(be_native)
diff --git a/TAO/TAO_IDL/be/be_operation.cpp b/TAO/TAO_IDL/be/be_operation.cpp
new file mode 100644
index 00000000000..40e2f7bd36b
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_operation.cpp
@@ -0,0 +1,153 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_operation.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Operation that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_operation.h"
+#include "be_operation_strategy.h"
+#include "be_predefined_type.h"
+#include "be_argument.h"
+#include "be_visitor.h"
+#include "global_extern.h"
+
+ACE_RCSID (be,
+ be_operation,
+ "$Id$")
+
+be_operation::be_operation (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ UTL_Scope (),
+ AST_Operation (),
+ be_scope (),
+ be_decl ()
+{
+ ACE_NEW (this->strategy_,
+ be_operation_default_strategy (this));
+}
+
+be_operation::be_operation (AST_Type *rt,
+ AST_Operation::Flags fl,
+ UTL_ScopedName *n,
+ bool local,
+ bool abstract)
+ : COMMON_Base (local,
+ abstract),
+ AST_Decl (AST_Decl::NT_op,
+ n),
+ UTL_Scope (AST_Decl::NT_op),
+ AST_Operation (rt,
+ fl,
+ n,
+ local,
+ abstract),
+ be_scope (AST_Decl::NT_op),
+ be_decl (AST_Decl::NT_op,
+ n)
+{
+ ACE_NEW (this->strategy_,
+ be_operation_default_strategy (this));
+
+ if (this->imported ())
+ {
+ return;
+ }
+
+ idl_global->operation_seen_ = true;
+
+ if (!this->is_local ())
+ {
+ be_type *bt = be_type::narrow_from_decl (rt);
+ bt->seen_in_operation (true);
+ this->set_arg_seen_bit (bt);
+ idl_global->non_local_op_seen_ = true;
+ }
+}
+
+
+be_operation::~be_operation (void)
+{
+}
+
+void
+be_operation::destroy (void)
+{
+ if (0 != this->strategy_)
+ {
+ this->strategy_->destroy ();
+ delete this->strategy_;
+ this->strategy_ = 0;
+ }
+
+ // Call the destroy methods of our base classes.
+ this->be_scope::destroy ();
+ this->be_decl::destroy ();
+ this->AST_Operation::destroy ();
+}
+
+int
+be_operation::accept (be_visitor *visitor)
+{
+ return visitor->visit_operation (this);
+}
+
+be_operation_strategy *
+be_operation::set_strategy (be_operation_strategy *new_strategy)
+{
+ be_operation_strategy *old = this->strategy_;
+
+ if (new_strategy != 0)
+ {
+ this->strategy_ = new_strategy;
+ }
+
+ return old;
+}
+
+
+TAO_CodeGen::CG_STATE
+be_operation::next_state (TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state)
+{
+ return this->strategy_->next_state (current_state, is_extra_state);
+}
+
+int
+be_operation::has_extra_code_generation (TAO_CodeGen::CG_STATE current_state)
+{
+ return this->strategy_->has_extra_code_generation (current_state);
+}
+
+be_operation*
+be_operation::marshaling (void)
+{
+ return this->strategy_->marshaling ();
+}
+
+be_operation*
+be_operation::arguments (void)
+{
+ return this->strategy_->arguments ();
+}
+
+
+// Narrowing
+IMPL_NARROW_METHODS3 (be_operation, AST_Operation, be_scope, be_decl)
+IMPL_NARROW_FROM_DECL (be_operation)
+IMPL_NARROW_FROM_SCOPE (be_operation)
diff --git a/TAO/TAO_IDL/be/be_operation_strategy.cpp b/TAO/TAO_IDL/be/be_operation_strategy.cpp
new file mode 100644
index 00000000000..d4af00fa11b
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_operation_strategy.cpp
@@ -0,0 +1,381 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_operation_strategy.cpp
+//
+// = DESCRIPTION
+// A strategy to cover the differences between various variants
+// of an operations, e.g. AMI sendc_, AMI raise_
+//
+// = AUTHOR
+// Michael Kircher
+//
+// ============================================================================
+
+#include "be_operation_strategy.h"
+#include "be_operation.h"
+
+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 (void)
+{
+}
+
+int
+be_operation_strategy::strategy_type (void)
+{
+ return strategy_type_;
+}
+
+int
+be_operation_strategy::has_extra_code_generation (
+ TAO_CodeGen::CG_STATE /* current_state */
+ )
+{
+ return 0;
+}
+
+be_operation *
+be_operation_strategy::marshaling (void)
+{
+ return 0;
+}
+
+be_operation *
+be_operation_strategy::arguments (void)
+{
+ return 0;
+}
+
+be_operation_strategy *
+be_operation_strategy::copy (void)
+{
+ return 0;
+}
+
+void
+be_operation_strategy::destroy (void)
+{
+}
+
+// ****************************************************************
+// AMI sendc_ operation strategy
+
+be_operation_default_strategy::be_operation_default_strategy (
+ be_operation *node
+ )
+ : be_operation_strategy (node,
+ DEFAULT)
+{
+}
+
+be_operation_default_strategy::~be_operation_default_strategy (void)
+{
+}
+
+TAO_CodeGen::CG_STATE
+be_operation_default_strategy::next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int /* is_extra_state */
+ )
+{
+ return current_state;
+}
+
+be_operation_strategy *
+be_operation_default_strategy::copy (void)
+{
+ be_operation_default_strategy *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_operation_default_strategy (this->node_),
+ 0);
+ retval->strategy_type_ = this->strategy_type_;
+ return retval;
+}
+
+// ****************************************************************
+// AMI sendc_ operation strategy
+
+be_operation_ami_sendc_strategy::be_operation_ami_sendc_strategy (
+ be_operation *node,
+ be_operation *marshaling,
+ be_operation *arguments
+ )
+ : be_operation_strategy (node,
+ AMI_SENDC),
+ marshaling_ (marshaling),
+ arguments_ (arguments),
+ owns_operations_ (true)
+{
+}
+
+be_operation_ami_sendc_strategy::~be_operation_ami_sendc_strategy (void)
+{
+}
+
+TAO_CodeGen::CG_STATE
+be_operation_ami_sendc_strategy::next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state
+ )
+{
+ if (is_extra_state)
+ {
+ switch (current_state)
+ {
+ case TAO_CodeGen::TAO_OPERATION_CH:
+ return TAO_CodeGen::TAO_AMI_SENDC_OPERATION_CH;
+ case TAO_CodeGen::TAO_OPERATION_CS:
+ return TAO_CodeGen::TAO_AMI_SENDC_OPERATION_CS;
+ default:
+ return current_state;
+ }
+ }
+ else
+ {
+ return current_state;
+ }
+}
+
+int
+be_operation_ami_sendc_strategy::has_extra_code_generation (
+ TAO_CodeGen::CG_STATE current_state
+ )
+{
+ if (current_state == TAO_CodeGen::TAO_OPERATION_CH
+ || current_state == TAO_CodeGen::TAO_OPERATION_CS)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_operation*
+be_operation_ami_sendc_strategy::marshaling (void)
+{
+ return marshaling_;
+}
+
+
+be_operation*
+be_operation_ami_sendc_strategy::arguments (void)
+{
+ return arguments_;
+}
+
+be_operation_strategy *
+be_operation_ami_sendc_strategy::copy (void)
+{
+ be_operation_ami_sendc_strategy *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_operation_ami_sendc_strategy (this->node_,
+ this->marshaling_,
+ this->arguments_),
+ 0);
+ retval->strategy_type_ = this->strategy_type_;
+ retval->owns_operations_ = false;
+ return retval;
+}
+
+void
+be_operation_ami_sendc_strategy::destroy (void)
+{
+ if (this->owns_operations_)
+ {
+ this->marshaling_->destroy ();
+ delete this->marshaling_;
+ this->marshaling_ = 0;
+
+ this->arguments_->destroy ();
+ delete this->arguments_;
+ this->arguments_ = 0;
+ }
+
+ this->be_operation_strategy::destroy ();
+}
+
+// ****************************************************************
+// AMI ExceptionHolder raise_ operation strategy
+
+be_operation_ami_exception_holder_raise_strategy
+::be_operation_ami_exception_holder_raise_strategy (be_operation *node)
+ : be_operation_strategy (node,
+ AMI_EXCEPTION_HOLDER_RAISE)
+{
+}
+
+be_operation_ami_exception_holder_raise_strategy
+::~be_operation_ami_exception_holder_raise_strategy (void)
+{
+}
+
+
+TAO_CodeGen::CG_STATE
+be_operation_ami_exception_holder_raise_strategy::next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state
+ )
+{
+ if (!is_extra_state)
+ {
+ switch (current_state)
+ {
+ case TAO_CodeGen::TAO_OPERATION_CS:
+ return TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_RAISE_OPERATION_CS;
+ default:
+ return current_state;
+ }
+ }
+ else
+ {
+ return current_state;
+ }
+}
+
+be_operation_strategy *
+be_operation_ami_exception_holder_raise_strategy::copy (void)
+{
+ be_operation_ami_exception_holder_raise_strategy *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_operation_ami_exception_holder_raise_strategy (
+ this->node_
+ ),
+ 0);
+ retval->strategy_type_ = this->strategy_type_;
+ return retval;
+}
+
+// ****************************************************************
+// AMI Reply Handler reply stub operation strategy
+
+be_operation_ami_handler_reply_stub_strategy
+::be_operation_ami_handler_reply_stub_strategy (be_operation *node)
+ : be_operation_strategy (node,
+ AMI_EXCEPTION_HOLDER_RAISE)
+{
+}
+
+be_operation_ami_handler_reply_stub_strategy
+::~be_operation_ami_handler_reply_stub_strategy (void)
+{
+}
+
+TAO_CodeGen::CG_STATE
+be_operation_ami_handler_reply_stub_strategy::next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state
+ )
+{
+ if (is_extra_state)
+ {
+ switch (current_state)
+ {
+ case TAO_CodeGen::TAO_OPERATION_CH:
+ return TAO_CodeGen::TAO_AMI_HANDLER_REPLY_STUB_OPERATION_CH;
+
+ case TAO_CodeGen::TAO_OPERATION_CS:
+ return TAO_CodeGen::TAO_AMI_HANDLER_REPLY_STUB_OPERATION_CS;
+
+ default:
+ return current_state;
+ }
+ }
+ else
+ {
+ return current_state;
+ }
+}
+
+int
+be_operation_ami_handler_reply_stub_strategy::has_extra_code_generation (
+ TAO_CodeGen::CG_STATE current_state
+ )
+{
+ if (current_state == TAO_CodeGen::TAO_OPERATION_CH
+ || current_state == TAO_CodeGen::TAO_OPERATION_CS)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_operation_strategy *
+be_operation_ami_handler_reply_stub_strategy::copy (void)
+{
+ be_operation_ami_handler_reply_stub_strategy *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_operation_ami_handler_reply_stub_strategy (this->node_),
+ 0);
+ retval->strategy_type_ = this->strategy_type_;
+ return retval;
+}
+
+// ****************************************************************
+// AMH Strategy
+
+be_operation_amh_strategy::be_operation_amh_strategy (be_operation *node)
+ : be_operation_strategy (node, AMI_EXCEPTION_HOLDER_RAISE)
+{
+}
+
+be_operation_amh_strategy::~be_operation_amh_strategy (void)
+{
+}
+
+TAO_CodeGen::CG_STATE
+be_operation_amh_strategy::next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int /* is_extra_state */
+ )
+{
+// We don't know yet if we need extra state for AMH but
+// we''ll leave the placeholder code here anyway ...
+ return current_state;
+}
+
+be_operation*
+be_operation_amh_strategy::arguments (void)
+{
+ return arguments_;
+}
+
+int
+be_operation_amh_strategy::has_extra_code_generation (
+ TAO_CodeGen::CG_STATE
+ )
+{
+ return 0;
+}
+
+be_operation_strategy *
+be_operation_amh_strategy::copy (void)
+{
+ be_operation_amh_strategy *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_operation_amh_strategy (this->node_),
+ 0);
+ retval->arguments_ = this->arguments_;
+ retval->strategy_type_ = this->strategy_type_;
+ return retval;
+}
diff --git a/TAO/TAO_IDL/be/be_predefined_type.cpp b/TAO/TAO_IDL/be/be_predefined_type.cpp
new file mode 100644
index 00000000000..0d1c7a6b69b
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_predefined_type.cpp
@@ -0,0 +1,240 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_predefined_type.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_PredefinedType that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_predefined_type.h"
+#include "be_visitor.h"
+#include "utl_identifier.h"
+#include "global_extern.h"
+
+#include "ace/Log_Msg.h"
+#include "ace/ACE.h"
+#include "ace/OS_NS_stdio.h"
+
+ACE_RCSID (be,
+ be_predefined_type,
+ "$Id$")
+
+be_predefined_type::be_predefined_type (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType (),
+ AST_PredefinedType (),
+ be_decl (),
+ be_type ()
+{
+}
+
+be_predefined_type::be_predefined_type (AST_PredefinedType::PredefinedType t,
+ UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_pre_defined,
+ n,
+ true),
+ AST_Type (AST_Decl::NT_pre_defined,
+ n),
+ AST_ConcreteType (AST_Decl::NT_pre_defined,
+ n),
+ AST_PredefinedType (t,
+ n),
+ be_decl (AST_Decl::NT_pre_defined,
+ n),
+ be_type (AST_Decl::NT_pre_defined,
+ n)
+{
+ // Computes the repoID.
+ this->compute_repoID ();
+
+ // Computes the fully scoped typecode name.
+ this->compute_tc_name ();
+
+ // Compute the flattened fully scoped name.
+ this->AST_Decl::compute_flat_name ();
+
+ if (t == AST_PredefinedType::PT_object)
+ {
+ this->fwd_helper_name_ = "::CORBA::tao_Object";
+ }
+ else if (t == AST_PredefinedType::PT_value)
+ {
+ this->fwd_helper_name_ = "::CORBA::tao_ValueBase";
+ }
+
+ switch (t)
+ {
+ case AST_PredefinedType::PT_char:
+ case AST_PredefinedType::PT_wchar:
+ case AST_PredefinedType::PT_boolean:
+ case AST_PredefinedType::PT_octet:
+ idl_global->ambiguous_type_seen_ = true;
+ break;
+ case AST_PredefinedType::PT_any:
+ case AST_PredefinedType::PT_object:
+ case AST_PredefinedType::PT_value:
+ case AST_PredefinedType::PT_void:
+ case AST_PredefinedType::PT_pseudo:
+ break;
+ default:
+ idl_global->basic_type_seen_ = true;
+ break;
+ }
+}
+
+// Overriden method.
+void
+be_predefined_type::compute_tc_name (void)
+{
+ // Start with the head as the CORBA namespace.
+ Identifier *corba_id = 0;
+ ACE_NEW (corba_id,
+ Identifier ("CORBA"));
+
+ ACE_NEW (this->tc_name_,
+ UTL_ScopedName (corba_id,
+ 0));
+
+ Identifier *id = 0;
+ UTL_ScopedName *conc_name = 0;
+
+ switch (this->pt ())
+ {
+ case AST_PredefinedType::PT_void:
+ ACE_NEW (id,
+ Identifier ("_tc_void"));
+ break;
+ case AST_PredefinedType::PT_long:
+ ACE_NEW (id,
+ Identifier ("_tc_long"));
+ break;
+ case AST_PredefinedType::PT_longlong:
+ ACE_NEW (id,
+ Identifier ("_tc_longlong"));
+ break;
+ case AST_PredefinedType::PT_ulong:
+ ACE_NEW (id,
+ Identifier ("_tc_ulong"));
+ break;
+ case AST_PredefinedType::PT_ulonglong:
+ ACE_NEW (id,
+ Identifier ("_tc_ulonglong"));
+ break;
+ case AST_PredefinedType::PT_short:
+ ACE_NEW (id,
+ Identifier ("_tc_short"));
+ break;
+ case AST_PredefinedType::PT_ushort:
+ ACE_NEW (id,
+ Identifier ("_tc_ushort"));
+ break;
+ case AST_PredefinedType::PT_float:
+ ACE_NEW (id,
+ Identifier ("_tc_float"));
+ break;
+ case AST_PredefinedType::PT_double:
+ ACE_NEW (id,
+ Identifier ("_tc_double"));
+ break;
+ case AST_PredefinedType::PT_longdouble:
+ ACE_NEW (id,
+ Identifier ("_tc_longdouble"));
+ break;
+ case AST_PredefinedType::PT_char:
+ ACE_NEW (id,
+ Identifier ("_tc_char"));
+ break;
+ case AST_PredefinedType::PT_wchar:
+ ACE_NEW (id,
+ Identifier ("_tc_wchar"));
+ break;
+ case AST_PredefinedType::PT_octet:
+ ACE_NEW (id,
+ Identifier ("_tc_octet"));
+ break;
+ case AST_PredefinedType::PT_boolean:
+ ACE_NEW (id,
+ Identifier ("_tc_boolean"));
+ break;
+ case AST_PredefinedType::PT_any:
+ ACE_NEW (id,
+ Identifier ("_tc_any"));
+ break;
+ case AST_PredefinedType::PT_object:
+ ACE_NEW (id,
+ Identifier ("_tc_Object"));
+ break;
+ case AST_PredefinedType::PT_value:
+ ACE_NEW (id,
+ Identifier ("_tc_ValueBase"));
+ break;
+ case AST_PredefinedType::PT_pseudo:
+ {
+ char tcname [100];
+ ACE_OS::sprintf (tcname,
+ "_tc_%s",
+ this->name ()->last_component ()->get_string ());
+
+ ACE_NEW (id,
+ Identifier (tcname));
+ break;
+ }
+ default:
+ ACE_ERROR ((LM_WARNING, "Unknown or invalid predefined type"));
+ break;
+ }
+
+ ACE_NEW (conc_name,
+ UTL_ScopedName (id,
+ 0));
+
+ this->tc_name_->nconc (conc_name);
+}
+
+void
+be_predefined_type::compute_repoID (void)
+{
+ switch (this->pt ())
+ {
+ case AST_PredefinedType::PT_object:
+ ACE::strdelete (this->repoID_);
+ this->repoID_ = ACE::strnew ("IDL:omg.org/CORBA/Object:1.0");
+ break;
+ default:
+ AST_Decl::compute_repoID ();
+ break;
+ }
+}
+
+int
+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
new file mode 100644
index 00000000000..3e749b5c50c
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_produce.cpp
@@ -0,0 +1,220 @@
+// $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.
+
+*/
+
+#include "be_visitor_root.h"
+#include "be_visitor_ami_pre_proc.h"
+#include "be_visitor_amh_pre_proc.h"
+#include "be_visitor_ccm_pre_proc.h"
+#include "be_visitor_context.h"
+#include "be_root.h"
+#include "be_extern.h"
+#include "fe_extern.h"
+#include "global_extern.h"
+
+ACE_RCSID (be,
+ be_produce,
+ "$Id$")
+
+// Clean up before exit, whether successful or not.
+TAO_IDL_BE_Export void
+BE_cleanup (void)
+{
+ idl_global->destroy ();
+}
+
+// Abort this run of the BE.
+TAO_IDL_BE_Export void
+BE_abort (void)
+{
+ ACE_ERROR ((LM_ERROR,
+ "Fatal Error - Aborting\n"));
+
+ // BE_cleanup will be called after the exception is caught.
+ throw FE_Bailout ();
+}
+
+void
+BE_visit_root (be_visitor_decl &root_visitor, const char *which_pass)
+{
+ static be_root *root =
+ be_root::narrow_from_decl (idl_global->root ());
+
+ if (-1 == root->accept (&root_visitor))
+ {
+ ACE_ERROR ((LM_ERROR,
+ "BE_visit_root - %s for Root failed\n",
+ which_pass));
+ BE_abort ();
+ }
+
+ root_visitor.ctx ()->reset ();
+}
+
+// Do the work of this BE. This is the starting point for code generation.
+TAO_IDL_BE_Export void
+BE_produce (void)
+{
+ be_visitor_context ctx;
+
+ if (!idl_global->ignore_idl3 ())
+ {
+ be_visitor_ccm_pre_proc ccm_preproc_visitor (&ctx);
+ BE_visit_root (ccm_preproc_visitor, "CCM preprocessing");
+ }
+
+ if (be_global->ami_call_back ())
+ {
+ be_visitor_ami_pre_proc ami_preproc_visitor (&ctx);
+ BE_visit_root (ami_preproc_visitor, "AMI preprocessing");
+ }
+
+ if (be_global->gen_amh_classes ())
+ {
+ be_visitor_amh_pre_proc amh_pre_proc_visitor (&ctx);
+ BE_visit_root (amh_pre_proc_visitor, "AMH preprocessing");
+ }
+
+ const char *fname = be_global->be_get_anyop_header_fname ();
+
+ // No-op if the -GA wasn't on the command line.
+ if (-1 == tao_cg->start_anyop_header (fname))
+ {
+ BE_abort ();
+ }
+
+ ctx.state (TAO_CodeGen::TAO_ROOT_CH);
+ be_visitor_root_ch root_ch_visitor (&ctx);
+ BE_visit_root (root_ch_visitor, "client header");
+
+ // Initialize the anyop source stream, if the option is set.
+ // It has to be done after the stub header file generation,
+ // where checks for recursive types are done,
+ // and before stub source file generation, since
+ // generation of Any-related #includes may be redirected.
+ fname = be_global->be_get_anyop_source_fname ();
+
+ if (-1 == tao_cg->start_anyop_source (fname))
+ {
+ BE_abort ();
+ }
+
+ if (be_global->gen_client_inline ())
+ {
+ ctx.state (TAO_CodeGen::TAO_ROOT_CI);
+ be_visitor_root_ci root_ci_visitor (&ctx);
+ BE_visit_root (root_ci_visitor, "client inline");
+ }
+
+ ctx.state (TAO_CodeGen::TAO_ROOT_CS);
+ be_visitor_root_cs root_cs_visitor (&ctx);
+ BE_visit_root (root_cs_visitor, "client stub");
+
+ ctx.state (TAO_CodeGen::TAO_ROOT_SH);
+ be_visitor_root_sh root_sh_visitor (&ctx);
+ BE_visit_root (root_sh_visitor, "server header");
+
+ // If skeleton file generation is suppressed, we're done.
+ if (!be_global->gen_skel_files ())
+ {
+ BE_cleanup ();
+ return;
+ }
+
+ if (be_global->gen_server_inline ())
+ {
+ ctx.state (TAO_CodeGen::TAO_ROOT_SI);
+ be_visitor_root_si root_si_visitor (&ctx);
+ BE_visit_root (root_si_visitor, "server inline");
+ }
+
+ ctx.state (TAO_CodeGen::TAO_ROOT_SS);
+ be_visitor_root_ss root_ss_visitor (&ctx);
+ BE_visit_root (root_ss_visitor, "server skeleton");
+
+ // Inline and source files for tie classes are generated
+ // by the corresponding skeleton visitors.
+ if (be_global->gen_tie_classes ())
+ {
+ ctx.state (TAO_CodeGen::TAO_ROOT_TIE_SH);
+ be_visitor_root_sth sth_visitor (&ctx);
+ BE_visit_root (sth_visitor, "server template header");
+ }
+
+ if (be_global->gen_impl_files ())
+ {
+ ctx.state (TAO_CodeGen::TAO_ROOT_IH);
+ be_visitor_root_ih root_ih_visitor (&ctx);
+ BE_visit_root (root_ih_visitor, "implementation header");
+
+ ctx.state (TAO_CodeGen::TAO_ROOT_IS);
+ be_visitor_root_is root_is_visitor (&ctx);
+ BE_visit_root (root_is_visitor, "implementation skeleton");
+ }
+
+ // Done with this IDL file.
+ BE_cleanup ();
+}
+
diff --git a/TAO/TAO_IDL/be/be_root.cpp b/TAO/TAO_IDL/be/be_root.cpp
new file mode 100644
index 00000000000..7ccffd91e03
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_root.cpp
@@ -0,0 +1,126 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_root.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Root that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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$")
+
+// Default Constructor.
+be_root::be_root (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ UTL_Scope (),
+ AST_Root (),
+ be_scope (),
+ be_decl ()
+{
+}
+
+// Constructor used to build the root of the abstract syntax tree (AST).
+be_root::be_root (UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_root,
+ n),
+ UTL_Scope (AST_Decl::NT_root),
+ AST_Module (n),
+ AST_Root (n),
+ be_scope (AST_Decl::NT_root),
+ be_decl (AST_Decl::NT_root,
+ n)
+{
+}
+
+be_root::~be_root (void)
+{
+}
+
+// We had to provide these since the AST_Root::fe_* method was setting the
+// names of these three to "local type".
+
+// Add this AST_Sequence to the locally defined types in this scope.
+AST_Sequence *
+be_root::fe_add_sequence (AST_Sequence *t)
+{
+ if (t == 0)
+ {
+ return 0;
+ }
+
+ add_to_local_types (t);
+ return t;
+}
+
+// Add this AST_String to the locally defined types in this scope
+AST_String *
+be_root::fe_add_string (AST_String *t)
+{
+ if (t == 0)
+ {
+ return 0;
+ }
+
+ add_to_local_types (t);
+ return t;
+}
+
+// Add this AST_Array to the locally defined types in this scope
+AST_Array *
+be_root::fe_add_array (AST_Array *t)
+{
+ if (t == 0)
+ {
+ return 0;
+ }
+
+ add_to_local_types (t);
+ return t;
+}
+
+void
+be_root::destroy (void)
+{
+ // Call the destroy methods of our base classes.
+
+// The scope of the root is handled specially, since we may
+// be processing multiple IDL files and we want to keep
+// the predefined types around until we are all done.
+// be_scope::destroy ();
+// be_decl::destroy ();
+
+ AST_Root::destroy ();
+}
+
+int
+be_root::accept (be_visitor *visitor)
+{
+ return visitor->visit_root (this);
+}
+
+// Narrowing methods
+IMPL_NARROW_METHODS3 (be_root, AST_Root, be_scope, be_decl)
+IMPL_NARROW_FROM_DECL (be_root)
+IMPL_NARROW_FROM_SCOPE (be_root)
diff --git a/TAO/TAO_IDL/be/be_scope.cpp b/TAO/TAO_IDL/be/be_scope.cpp
new file mode 100644
index 00000000000..c335fee14c3
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_scope.cpp
@@ -0,0 +1,105 @@
+//
+// $Id$
+//
+#include "be_scope.h"
+#include "be_valuetype.h"
+#include "be_eventtype.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)
+ : UTL_Scope (),
+ comma_ (0)
+{
+}
+
+// Constructor.
+be_scope::be_scope (AST_Decl::NodeType type)
+ : UTL_Scope (type),
+ comma_ (0)
+{
+}
+
+be_scope::~be_scope (void)
+{
+}
+
+// Code generation methods.
+
+void
+be_scope::comma (unsigned short comma)
+{
+ this->comma_ = comma;
+}
+
+int
+be_scope::comma (void) const
+{
+ return this->comma_;
+}
+
+// Return the scope created by this node (if one exists, else NULL).
+be_decl *
+be_scope::decl (void)
+{
+ 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_eventtype:
+ return be_eventtype::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:
+ return be_root::narrow_from_scope (this);
+ case AST_Decl::NT_except:
+ return be_exception::narrow_from_scope (this);
+ case AST_Decl::NT_union:
+ return be_union::narrow_from_scope (this);
+ case AST_Decl::NT_struct:
+ return be_structure::narrow_from_scope (this);
+ case AST_Decl::NT_enum:
+ return be_enum::narrow_from_scope (this);
+ case AST_Decl::NT_op:
+ return be_operation::narrow_from_scope (this);
+ case AST_Decl::NT_factory:
+ return be_factory::narrow_from_scope (this);
+ default:
+ return (be_decl *)0;
+ }
+}
+
+void
+be_scope::destroy (void)
+{
+}
+
+int
+be_scope::accept (be_visitor *visitor)
+{
+ return visitor->visit_scope (this);
+}
+
+// Narrowing methods.
+IMPL_NARROW_METHODS1 (be_scope, UTL_Scope)
+IMPL_NARROW_FROM_SCOPE (be_scope)
diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp
new file mode 100644
index 00000000000..a724cbb35f1
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_sequence.cpp
@@ -0,0 +1,760 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_sequence.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Sequence that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_sequence.h"
+#include "be_typedef.h"
+#include "be_interface.h"
+#include "be_interface_fwd.h"
+#include "be_predefined_type.h"
+#include "be_field.h"
+#include "be_visitor.h"
+#include "be_helper.h"
+
+#include "utl_identifier.h"
+#include "idl_defines.h"
+#include "nr_extern.h"
+#include "global_extern.h"
+
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (be,
+ be_sequence,
+ "$Id$")
+
+be_sequence::be_sequence (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType (),
+ AST_Sequence (),
+ UTL_Scope (),
+ be_scope (),
+ be_decl (),
+ be_type (),
+ mt_ (be_sequence::MNG_UNKNOWN),
+ field_node_ (0)
+{
+ // Always the case.
+ this->has_constructor (true);
+}
+
+be_sequence::be_sequence (AST_Expression *v,
+ AST_Type *t,
+ UTL_ScopedName *n,
+ bool local,
+ bool abstract)
+ : COMMON_Base (t->is_local () || local,
+ abstract),
+ AST_Decl (AST_Decl::NT_sequence,
+ n,
+ true),
+ AST_Type (AST_Decl::NT_sequence,
+ n),
+ AST_ConcreteType (AST_Decl::NT_sequence,
+ n),
+ AST_Sequence (v,
+ t,
+ n,
+ t->is_local () || local,
+ abstract),
+ UTL_Scope (AST_Decl::NT_sequence),
+ be_scope (AST_Decl::NT_sequence),
+ be_decl (AST_Decl::NT_sequence,
+ n),
+ be_type (AST_Decl::NT_sequence,
+ n),
+ mt_ (be_sequence::MNG_UNKNOWN),
+ field_node_ (0)
+{
+ // Always the case.
+ this->has_constructor (true);
+
+ // Don't want to set any bits below for imported nodes.
+ if (this->imported ())
+ {
+ return;
+ }
+
+ // This one gets set for all sequences, in addition to any specialized
+ // one that may get set below.
+ idl_global->seq_seen_ = true;
+
+ // Don't need the return value - just set the member.
+ (void) this->managed_type ();
+
+ switch (this->mt_)
+ {
+ case MNG_OBJREF:
+ idl_global->iface_seq_seen_ = true;
+ break;
+ case MNG_PSEUDO:
+ idl_global->pseudo_seq_seen_ = true;
+ break;
+ case MNG_VALUE:
+ idl_global->vt_seq_seen_ = true;
+ break;
+ case MNG_STRING:
+ idl_global->string_seq_seen_ = true;
+ break;
+ case MNG_WSTRING:
+ idl_global->wstring_seq_seen_ = true;
+ break;
+ default:
+ break;
+ }
+
+ AST_Decl::NodeType nt = t->node_type ();
+ AST_Typedef *td = 0;
+ AST_Type *pbt = 0;
+
+ if (nt == AST_Decl::NT_typedef)
+ {
+ td = AST_Typedef::narrow_from_decl (t);
+ pbt = td->primitive_base_type ();
+ nt = pbt->node_type ();
+ }
+
+ if (nt == AST_Decl::NT_pre_defined)
+ {
+ AST_PredefinedType *pdt =
+ AST_PredefinedType::narrow_from_decl (pbt ? pbt : t);
+
+ switch (pdt->pt ())
+ {
+ case AST_PredefinedType::PT_octet:
+ idl_global->octet_seq_seen_ = true;
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+// Helper to create_name.
+char *
+be_sequence::gen_name (void)
+{
+ char namebuf [NAMEBUFSIZE];
+ be_type *bt = 0;
+
+ // Reset the buffer.
+ ACE_OS::memset (namebuf,
+ '\0',
+ NAMEBUFSIZE);
+
+ // Retrieve the base type.
+ bt = be_type::narrow_from_decl (this->base_type ());
+
+ if (bt == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_sequence::"
+ "gen_name - "
+ "bad base type\n"),
+ 0);
+ }
+
+ // If this is non-zero, add its local name to the generated name,
+ // for uniqueness.
+ be_field *fn = this->field_node_;
+
+ if (bt->node_type () == AST_Decl::NT_sequence)
+ {
+ // Our base type is an anonymous sequence.
+ be_sequence *seq = be_sequence::narrow_from_decl (bt);
+
+ if (seq == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_sequence::"
+ "gen_name - "
+ "error converting base type to sequence\n"),
+ 0);
+ }
+
+ // If the nested sequence were defined in
+ // the scope of the enclosing sequence, we would have to
+ // not only define the nested class in two places, but also
+ // deal with the fact that, for the template classes, the
+ // enclosing sequence's template type is a class defined
+ // inside it. So we define the nested sequence in the next
+ // scope up, and the existing code generation works for both
+ // template and non-template implementations of IDL sequences.
+ UTL_Scope *parent = this->defined_in ();
+ seq->set_defined_in (parent);
+ parent->add_sequence (seq);
+ char *seq_name = seq->gen_name ();
+
+ ACE_OS::sprintf (namebuf,
+ "_tao_seq_%s_%s",
+ seq_name,
+ fn ? fn->local_name ()->get_string () : "");
+ ACE::strdelete (seq_name);
+ }
+ else
+ {
+ ACE_OS::sprintf (namebuf,
+ "_tao_seq_%s_",
+ bt->flat_name ());
+ }
+
+ // Append the size (if any).
+ if (this->unbounded () == false)
+ {
+ char ulval_str [NAMEBUFSIZE];
+ ACE_OS::sprintf (ulval_str,
+ "_%lu",
+ this->max_size ()->ev ()->u.ulval);
+ ACE_OS::strcat (namebuf,
+ ulval_str);
+ }
+
+ return ACE::strnew (namebuf);
+}
+
+// Create a name for ourselves.
+int
+be_sequence::create_name (be_typedef *node)
+{
+ static char *namebuf = 0;
+ UTL_ScopedName *n = 0;
+
+ // Scope in which we are defined.
+ be_decl *scope = 0;
+
+ // If there is a typedef node, we use its name as our name.
+ if (node)
+ {
+ this->set_name (
+ dynamic_cast<UTL_ScopedName *> (node->name ()->copy ())
+ );
+ }
+ else
+ {
+ // Generate a local name.
+ namebuf = this->gen_name ();
+
+ // Now see if we have a fully scoped name and if so, generate one.
+ UTL_Scope *us = this->defined_in ();
+
+ scope = be_scope::narrow_from_scope (us)->decl ();
+
+ if (scope != 0)
+ {
+ // Make a copy of the enclosing scope's name.
+ n = (UTL_ScopedName *) scope->name ()->copy ();
+
+ Identifier *id = 0;
+ ACE_NEW_RETURN (id,
+ Identifier (namebuf),
+ -1);
+
+ UTL_ScopedName *conc_name = 0;
+ ACE_NEW_RETURN (conc_name,
+ UTL_ScopedName (id,
+ 0),
+ -1);
+
+ // Add our local name as the last component.
+ n->nconc (conc_name);
+
+ // Set the fully scoped name.
+ this->set_name (n);
+ }
+ else
+ {
+ // We better be not here because we must be inside some scope,
+ // at least the ROOT scope.
+ return -1;
+ }
+
+ ACE::strdelete (namebuf);
+ }
+
+ return 0;
+}
+
+// Does this sequence have a managed type sequence element?
+be_sequence::MANAGED_TYPE
+be_sequence::managed_type (void)
+{
+ if (this->mt_ == be_sequence::MNG_UNKNOWN) // Not calculated yet.
+ {
+ // Base types.
+ be_type *bt = 0;
+ be_type *prim_type = 0;
+
+ bt = be_type::narrow_from_decl (this->base_type ());
+
+ 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);
+ prim_type = t->primitive_base_type ();
+ }
+ else
+ {
+ prim_type = bt;
+ }
+
+ // Determine if we need a managed type and which one.
+ switch (prim_type->node_type ())
+ {
+ case AST_Decl::NT_interface:
+ case AST_Decl::NT_interface_fwd:
+ case AST_Decl::NT_component:
+ case AST_Decl::NT_component_fwd:
+ this->mt_ = be_sequence::MNG_OBJREF;
+ break;
+ case AST_Decl::NT_valuebox:
+ case AST_Decl::NT_valuetype:
+ case AST_Decl::NT_valuetype_fwd:
+ case AST_Decl::NT_eventtype:
+ case AST_Decl::NT_eventtype_fwd:
+ this->mt_ = be_sequence::MNG_VALUE;
+ break;
+ case AST_Decl::NT_string:
+ this->mt_ = be_sequence::MNG_STRING;
+ break;
+ case AST_Decl::NT_wstring:
+ this->mt_ = be_sequence::MNG_WSTRING;
+ break;
+ case AST_Decl::NT_pre_defined:
+ {
+ be_predefined_type *bpd =
+ be_predefined_type::narrow_from_decl (prim_type);
+ AST_PredefinedType::PredefinedType pt = bpd->pt ();
+
+ switch (pt)
+ {
+ case AST_PredefinedType::PT_pseudo:
+ this->mt_ = be_sequence::MNG_PSEUDO;
+ break;
+ case AST_PredefinedType::PT_object:
+ this->mt_ = be_sequence::MNG_PSEUDO;
+ break;
+ case AST_PredefinedType::PT_value:
+ this->mt_ = be_sequence::MNG_VALUE;
+ break;
+ default:
+ this->mt_ = be_sequence::MNG_NONE;
+ break;
+ }
+ }
+ break;
+ default:
+ this->mt_ = be_sequence::MNG_NONE;
+ }
+ }
+
+ return this->mt_;
+}
+
+// Add this be_sequence to the locally defined types in this scope
+AST_Sequence *
+be_sequence::fe_add_sequence (AST_Sequence *t)
+{
+ if (t == 0)
+ {
+ return 0;
+ }
+
+ this->add_to_local_types (t);
+ return t;
+}
+
+// Overridden method
+be_decl *
+be_sequence::decl (void)
+{
+ return this;
+}
+
+int
+be_sequence::accept (be_visitor *visitor)
+{
+ return visitor->visit_sequence (this);
+}
+
+
+const char *
+be_sequence::instance_name ()
+{
+ static char namebuf[NAMEBUFSIZE];
+ ACE_OS::memset (namebuf,
+ '\0',
+ NAMEBUFSIZE);
+
+ be_type *bt = 0;
+ bt = be_type::narrow_from_decl (this->base_type ());
+
+ if (bt == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_ch::"
+ "gen_instantiate_name - "
+ "Bad element type\n"));
+
+ return namebuf;
+ }
+
+ // Generate the class name.
+
+ // The base type after removing all the aliases.
+ be_type *prim_type = bt;
+
+ 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);
+ prim_type = t->primitive_base_type ();
+ }
+
+ // Generate the appropriate sequence type.
+ switch (this->managed_type ())
+ {
+ case be_sequence::MNG_PSEUDO:
+ case be_sequence::MNG_OBJREF:
+ if (this->unbounded ())
+ {
+ ACE_OS::sprintf (namebuf,
+ "_TAO_unbounded_object_reference_sequence_%s",
+ prim_type->local_name ()->get_string ());
+ }
+ else
+ {
+ ACE_OS::sprintf (namebuf,
+ "_TAO_bounded_object_reference_sequence_%s_%lu",
+ prim_type->local_name ()->get_string (),
+ this->max_size ()->ev ()->u.ulval);
+ }
+
+ break;
+ case be_sequence::MNG_VALUE:
+ if (this->unbounded ())
+ {
+ ACE_OS::sprintf (namebuf,
+ "_TAO_unbounded_valuetype_sequence_%s",
+ prim_type->local_name ()->get_string ());
+ }
+ else
+ {
+ ACE_OS::sprintf (namebuf,
+ "_TAO_bounded_valuetype_sequence_%s_%lu",
+ prim_type->local_name ()->get_string (),
+ this->max_size ()->ev ()->u.ulval);
+ }
+
+ break;
+ case be_sequence::MNG_STRING:
+ if (this->unbounded ())
+ {
+ ACE_OS::sprintf (namebuf,
+ "TAO::unbounded_string_sequence");
+ }
+ else
+ {
+ ACE_OS::sprintf (namebuf,
+ "_TAO_unbounded_string_sequence_%s",
+ prim_type->local_name ()->get_string ());
+ }
+
+ break;
+ case be_sequence::MNG_WSTRING:
+ if (this->unbounded ())
+ {
+ ACE_OS::sprintf (namebuf,
+ "TAO::unbounded_wstring_sequence");
+ }
+ else
+ {
+ ACE_OS::sprintf (namebuf,
+ "_TAO_bounded_wstring_sequence_%s",
+ prim_type->local_name ()->get_string ());
+ }
+
+ break;
+ default: // Not a managed type.
+ if (this->unbounded ())
+ {
+ // TAO provides extensions for octet sequences, first find out
+ // if the base type is an octet (or an alias for octet)
+ be_predefined_type *predef =
+ be_predefined_type::narrow_from_decl (prim_type);
+
+ if (predef != 0
+ && predef->pt() == AST_PredefinedType::PT_octet)
+ {
+ ACE_OS::sprintf (namebuf,
+ "TAO::unbounded_value_sequence<CORBA::Octet>");
+ }
+ else
+ {
+ ACE_OS::sprintf (namebuf,
+ "_TAO_unbounded_value_sequence_%s",
+ prim_type->local_name ()->get_string ());
+ }
+ }
+ else
+ {
+ ACE_OS::sprintf (namebuf,
+ "_TAO_bounded_value_sequence_%s_%lu",
+ prim_type->local_name ()->get_string (),
+ this->max_size ()->ev ()->u.ulval);
+ }
+
+ break;
+ }
+
+ return namebuf;
+}
+
+int
+be_sequence::gen_base_class_name (TAO_OutStream *os,
+ const char * linebreak,
+ AST_Decl *ctx_scope)
+{
+ be_type *elem = be_type::narrow_from_decl (this->base_type ());
+
+ // Generate the appropriate base class type.
+ switch (this->managed_type ())
+ {
+ case be_sequence::MNG_OBJREF:
+ case be_sequence::MNG_PSEUDO:
+ if (this->unbounded ())
+ {
+ *os << "TAO::unbounded_object_reference_sequence<" << linebreak
+ << be_idt << be_idt_nl
+ << elem->nested_type_name (ctx_scope) << "," << linebreak
+ << be_nl;
+ *os << elem->nested_type_name (ctx_scope, "_var") << linebreak
+ << be_uidt_nl
+ << ">" << be_uidt;
+ }
+ else
+ {
+ *os << "TAO::bounded_object_reference_sequence<" << linebreak
+ << be_idt << be_idt_nl
+ << elem->nested_type_name (ctx_scope) << "," << linebreak << be_nl;
+ *os << elem->nested_type_name (ctx_scope, "_var") << ","
+ << linebreak << be_nl;
+ *os << this->max_size ()->ev ()->u.ulval << linebreak << be_uidt_nl
+ << ">" << be_uidt;
+ }
+
+ break;
+ case be_sequence::MNG_VALUE:
+ if (this->unbounded ())
+ {
+ *os << "TAO::unbounded_valuetype_sequence<" << linebreak
+ << be_idt << be_idt_nl
+ << elem->nested_type_name (ctx_scope) << "," << linebreak
+ << be_nl;
+ *os << elem->nested_type_name (ctx_scope, "_var") << linebreak
+ << be_uidt_nl
+ << ">" << be_uidt;
+ }
+ else
+ {
+ *os << "TAO::bounded_valuetype_sequence<" << linebreak
+ << be_idt << be_idt_nl
+ << elem->nested_type_name (ctx_scope) << "," << linebreak
+ << be_nl;
+ *os << elem->nested_type_name (ctx_scope, "_var") << ","
+ << linebreak << be_nl
+ << this->max_size ()->ev ()->u.ulval << linebreak << be_uidt_nl
+ << ">" << be_uidt;
+ }
+
+ break;
+ case be_sequence::MNG_STRING:
+ if (this->unbounded ())
+ {
+ *os << "TAO::unbounded_string_sequence";
+ }
+ else
+ {
+ *os << "TAO::bounded_string_sequence<"
+ << this->max_size ()->ev ()->u.ulval << ">";
+ }
+
+ break;
+ case be_sequence::MNG_WSTRING:
+ if (this->unbounded ())
+ {
+ *os << "TAO::unbounded_wstring_sequence";
+ }
+ else
+ {
+ *os << "TAO::bounded_wstring_sequence<"
+ << this->max_size ()->ev ()->u.ulval << ">";
+ }
+
+ break;
+ default: // Not a managed type.
+ switch (elem->base_node_type ())
+ {
+ case AST_Decl::NT_array:
+ if (this->unbounded ())
+ {
+ *os << "TAO::unbounded_array_sequence<" << linebreak
+ << be_idt << be_idt_nl
+ << elem->nested_type_name (ctx_scope) << "," << linebreak
+ << be_nl;
+ *os << elem->nested_type_name (ctx_scope) << "_slice,"
+ << linebreak << be_nl
+ << elem->nested_type_name (ctx_scope) << "_tag"
+ << linebreak << be_uidt_nl
+ << ">" << be_uidt;
+ }
+ else
+ {
+ *os << "TAO::bounded_array_sequence<" << linebreak
+ << be_idt << be_idt_nl
+ << elem->nested_type_name (ctx_scope) << "," << linebreak
+ << be_nl;
+ *os << elem->nested_type_name (ctx_scope) << "_slice,"
+ << linebreak << be_nl
+ << elem->nested_type_name (ctx_scope) << "_tag,"
+ << linebreak << be_nl
+ << this->max_size ()->ev ()->u.ulval << linebreak
+ << be_uidt_nl
+ << ">" << be_uidt;
+ }
+
+ break;
+ default:
+ if (this->unbounded ())
+ {
+ *os << "TAO::unbounded_value_sequence<" << linebreak
+ << be_idt << be_idt_nl
+ << elem->nested_type_name (ctx_scope) << linebreak
+ << be_uidt_nl
+ << ">" << be_uidt;
+ }
+ else
+ {
+ *os << "TAO::bounded_value_sequence<" << linebreak
+ << be_idt << be_idt_nl
+ << elem->nested_type_name (ctx_scope) << "," << linebreak
+ << be_nl
+ << this->max_size ()->ev ()->u.ulval << linebreak
+ << be_uidt_nl
+ << ">" << be_uidt;
+ }
+
+ break;
+ }
+
+ break;
+ }
+
+ return 0;
+}
+
+be_field *
+be_sequence::field_node (void) const
+{
+ return this->field_node_;
+}
+
+void
+be_sequence::field_node (be_field *node)
+{
+ this->field_node_ = node;
+}
+
+// Overriden method.
+void
+be_sequence::compute_tc_name (void)
+{
+ // Sequence TypeCodes can only be accessed through an alias
+ // TypeCode. Generate a TypeCode name that is meant for internal
+ // use alone.
+
+ Identifier * tao_id = 0;
+ ACE_NEW (tao_id,
+ Identifier ("TAO"));
+
+ ACE_NEW (this->tc_name_,
+ UTL_ScopedName (tao_id,
+ 0));
+
+ char bound[30] = { 0 };
+
+ ACE_OS::sprintf (bound,
+ "_%lu",
+ this->max_size ()->ev ()->u.ulval);
+
+ ACE_CString local_tc_name =
+ ACE_CString ("tc_")
+ + ACE_CString (this->flat_name ())
+ + ACE_CString (bound);
+
+ Identifier * typecode_scope = 0;
+ ACE_NEW (typecode_scope,
+ Identifier ("TypeCode"));
+
+ UTL_ScopedName * tc_scope_conc_name = 0;
+ ACE_NEW (tc_scope_conc_name,
+ UTL_ScopedName (typecode_scope,
+ 0));
+
+ this->tc_name_->nconc (tc_scope_conc_name);
+
+ Identifier * id = 0;
+ ACE_NEW (id,
+ Identifier (local_tc_name.c_str ()));
+
+ UTL_ScopedName * conc_name = 0;
+ ACE_NEW (conc_name,
+ UTL_ScopedName (id,
+ 0));
+
+ this->tc_name_->nconc (conc_name);
+}
+
+const char *
+be_sequence::smart_fwd_helper_name (AST_Decl *ctx_scope,
+ be_type *elem)
+{
+ if (ScopeAsDecl (elem->defined_in ()) == ctx_scope)
+ {
+ ACE_CString retval = "tao_";
+ retval += elem->local_name ()->get_string ();
+ return retval.rep ();
+ }
+
+ return elem->fwd_helper_name ();
+}
+
+void
+be_sequence::destroy (void)
+{
+ // Call the destroy methods of our base classes.
+ this->be_scope::destroy ();
+ this->be_type::destroy ();
+ this->AST_Sequence::destroy ();
+}
+
+// Narrowing
+IMPL_NARROW_METHODS3 (be_sequence, AST_Sequence, be_scope, be_type)
+IMPL_NARROW_FROM_DECL (be_sequence)
diff --git a/TAO/TAO_IDL/be/be_stream_factory.cpp b/TAO/TAO_IDL/be/be_stream_factory.cpp
new file mode 100644
index 00000000000..ef327ecd30e
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_stream_factory.cpp
@@ -0,0 +1,43 @@
+// $Id$
+
+#include "be_stream_factory.h"
+#include "be_sunsoft.h"
+
+ACE_RCSID (be,
+ be_streamfactory,
+ "$Id$")
+
+// Constructor.
+TAO_OutStream_Factory::TAO_OutStream_Factory (void)
+ : strm_type_ (TAO_OutStream_Factory::TAO_SUNSOFT)
+{
+}
+
+// Destructor.
+TAO_OutStream_Factory::~TAO_OutStream_Factory (void)
+{
+}
+
+// Set the type of specialized output stream we want.
+int
+TAO_OutStream_Factory::set_stream_type
+(TAO_OutStream_Factory::TAO_OutStream_Type t)
+{
+ this->strm_type_ = t;
+ return 0;
+}
+
+// Factory method.
+TAO_OutStream *
+TAO_OutStream_Factory::make_outstream (void)
+{
+ switch (this->strm_type_)
+ {
+ case TAO_OutStream_Factory::TAO_SUNSOFT:
+ return new TAO_SunSoft_OutStream ();
+ case TAO_OutStream_Factory::TAO_FLICK:
+ return (TAO_OutStream *)0; // Not implemented as yet.
+ default:
+ return (TAO_OutStream *)0;
+ }
+}
diff --git a/TAO/TAO_IDL/be/be_string.cpp b/TAO/TAO_IDL/be/be_string.cpp
new file mode 100644
index 00000000000..aaaf8427a7a
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_string.cpp
@@ -0,0 +1,150 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_string.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_String that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_string.h"
+#include "be_visitor.h"
+
+#include "utl_identifier.h"
+#include "global_extern.h"
+
+ACE_RCSID (be,
+ be_string,
+ "$Id$")
+
+be_string::be_string (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_String (),
+ be_decl (),
+ be_type ()
+{
+ // Always the case.
+ this->size_type (AST_Type::VARIABLE);
+}
+
+be_string::be_string (AST_Decl::NodeType nt,
+ UTL_ScopedName * n,
+ AST_Expression * v,
+ long width)
+ : COMMON_Base (),
+ AST_Decl (nt,
+ n,
+ true),
+ AST_Type (nt,
+ n),
+ AST_String (nt,
+ n,
+ v,
+ width),
+ be_decl (nt,
+ n),
+ be_type (nt,
+ n)
+{
+ idl_global->string_seen_ = true;
+}
+
+// Overriden method.
+void
+be_string::compute_tc_name (void)
+{
+ Identifier * id = 0;
+
+ AST_Expression zero (static_cast<unsigned long> (0));
+
+ if (*this->max_size () == &zero)
+ {
+ // If the string is unbounded, use the string TypeCode
+ // constants.
+
+ // Start with the head as the CORBA namespace.
+ Identifier * corba_id = 0;
+ ACE_NEW (corba_id,
+ Identifier ("CORBA"));
+
+ ACE_NEW (this->tc_name_,
+ UTL_ScopedName (corba_id,
+ 0));
+
+ ACE_NEW (id,
+ Identifier (this->width () == 1
+ ? "_tc_string"
+ : "_tc_wstring"));
+ }
+ else
+ {
+ // We have a bounded string. Generate a TypeCode name that is
+ // meant for internal use alone.
+
+ Identifier * tao_id = 0;
+ ACE_NEW (tao_id,
+ Identifier ("TAO"));
+
+ ACE_NEW (this->tc_name_,
+ UTL_ScopedName (tao_id,
+ 0));
+
+ ACE_CString local_tc_name =
+ ACE_CString ("tc_")
+ + ACE_CString (this->flat_name ());
+
+ Identifier * typecode_scope = 0;
+ ACE_NEW (typecode_scope,
+ Identifier ("TypeCode"));
+
+ UTL_ScopedName * tc_scope_conc_name = 0;
+ ACE_NEW (tc_scope_conc_name,
+ UTL_ScopedName (typecode_scope,
+ 0));
+
+ this->tc_name_->nconc (tc_scope_conc_name);
+
+ ACE_NEW (id,
+ Identifier (local_tc_name.c_str ()));
+ }
+
+ zero.destroy ();
+
+ UTL_ScopedName *conc_name = 0;
+ ACE_NEW (conc_name,
+ UTL_ScopedName (id,
+ 0));
+
+ this->tc_name_->nconc (conc_name);
+}
+
+int
+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
new file mode 100644
index 00000000000..d26a250cebf
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_structure.cpp
@@ -0,0 +1,109 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_structure.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Structure that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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"
+#include "global_extern.h"
+
+ACE_RCSID (be,
+ be_structure,
+ "$Id$")
+
+be_structure::be_structure (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType (),
+ UTL_Scope (),
+ AST_Structure (),
+ be_scope (),
+ be_decl (),
+ be_type ()
+{
+}
+
+be_structure::be_structure (UTL_ScopedName *n,
+ bool local,
+ bool abstract)
+ : COMMON_Base (local,
+ abstract),
+ AST_Decl (AST_Decl::NT_struct,
+ n),
+ AST_Type (AST_Decl::NT_struct,
+ n),
+ AST_ConcreteType (AST_Decl::NT_struct,
+ n),
+ UTL_Scope (AST_Decl::NT_struct),
+ AST_Structure (n,
+ local,
+ abstract),
+ be_scope (AST_Decl::NT_struct),
+ be_decl (AST_Decl::NT_struct,
+ n),
+ be_type (AST_Decl::NT_struct,
+ n)
+{
+ if (!this->imported ())
+ {
+ idl_global->aggregate_seen_ = true;
+ }
+}
+
+void
+be_structure::redefine (AST_Structure *from)
+{
+ be_structure *bs = be_structure::narrow_from_decl (from);
+ this->common_varout_gen_ = bs->common_varout_gen_;
+ AST_Structure::redefine (from);
+}
+
+void
+be_structure::destroy (void)
+{
+ // Call the destroy methods of our base classes.
+ this->be_scope::destroy ();
+ this->be_type::destroy ();
+ this->AST_Structure::destroy ();
+}
+
+int
+be_structure::accept (be_visitor *visitor)
+{
+ return visitor->visit_structure (this);
+}
+
+AST_Field *
+be_structure::be_add_field (AST_Field *f)
+{
+ return this->fe_add_field (f);
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS3 (be_structure, AST_Structure, be_scope, be_type)
+IMPL_NARROW_FROM_DECL (be_structure)
+IMPL_NARROW_FROM_SCOPE (be_structure)
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..cfc33e9b28d
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_structure_fwd.cpp
@@ -0,0 +1,72 @@
+// $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)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_StructureFwd (),
+ be_decl (),
+ be_type ()
+{
+}
+
+be_structure_fwd::be_structure_fwd (AST_Structure *dummy,
+ UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_struct_fwd,
+ n),
+ AST_Type (AST_Decl::NT_struct_fwd,
+ n),
+ AST_StructureFwd (dummy,
+ n),
+ be_decl (AST_Decl::NT_struct_fwd,
+ n),
+ be_type (AST_Decl::NT_struct_fwd,
+ n)
+{
+}
+
+be_structure_fwd::~be_structure_fwd (void)
+{
+}
+
+void
+be_structure_fwd::destroy (void)
+{
+ this->be_type::destroy ();
+ this->AST_StructureFwd::destroy ();
+}
+
+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
new file mode 100644
index 00000000000..06be8962802
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_sunsoft.cpp
@@ -0,0 +1,191 @@
+// $Id$
+
+#include "be_sunsoft.h"
+#include "ast_expression.h"
+#include "utl_identifier.h"
+#include "utl_idlist.h"
+#include "utl_string.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+#include "ace/os_include/os_ctype.h"
+
+ACE_RCSID (be,
+ be_sunsoft,
+ "$Id$")
+
+TAO_SunSoft_OutStream::TAO_SunSoft_OutStream (void)
+ : TAO_OutStream ()
+{
+}
+
+TAO_SunSoft_OutStream::~TAO_SunSoft_OutStream (void)
+{
+}
+
+TAO_OutStream &
+TAO_SunSoft_OutStream::print (Identifier *id)
+{
+ ACE_OS::fprintf (this->fp_,
+ id->get_string ());
+
+ return *this;
+}
+
+TAO_OutStream &
+TAO_SunSoft_OutStream::print (UTL_IdList *idl)
+{
+ long first = true;
+ long second = false;
+ Identifier *id = 0;
+
+ for (UTL_IdListActiveIterator i (idl); !i.is_done (); i.next ())
+ {
+ if (!first)
+ {
+ *this << "::";
+ }
+ else if (second)
+ {
+ first = second = false;
+ }
+
+ // Print the identifier.
+ id = i.item ();
+ *this << id;
+
+ if (first)
+ {
+ if (ACE_OS::strcmp (id->get_string (), "") != 0)
+ {
+ // Does not start with a "".
+ first = false;
+ }
+ else
+ {
+ second = true;
+ }
+ }
+ }
+
+ return *this;
+}
+
+TAO_OutStream&
+TAO_SunSoft_OutStream::print (AST_Expression *expr)
+{
+ AST_Expression::AST_ExprValue *ev = expr->ev ();
+
+ if (ev)
+ {
+ switch (ev->et)
+ {
+ case AST_Expression::EV_short:
+ this->TAO_OutStream::print ("%hd", ev->u.sval);
+ break;
+ case AST_Expression::EV_ushort:
+ this->TAO_OutStream::print ("%hu%c", ev->u.usval, 'U');
+ break;
+ case AST_Expression::EV_long:
+ this->TAO_OutStream::print ("%ld", ev->u.lval);
+ break;
+ case AST_Expression::EV_ulong:
+ this->TAO_OutStream::print ("%u%c", ev->u.ulval, 'U');
+ break;
+ case AST_Expression::EV_longlong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ this->TAO_OutStream::print (ACE_INT64_FORMAT_SPECIFIER, ev->u.llval);
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ break;
+ case AST_Expression::EV_ulonglong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ this->TAO_OutStream::print ("ACE_UINT64_LITERAL (");
+ this->TAO_OutStream::print (ACE_UINT64_FORMAT_SPECIFIER,
+ ev->u.ullval);
+ this->TAO_OutStream::print (")");
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+ break;
+ case AST_Expression::EV_float:
+ this->TAO_OutStream::print ("%f%c", ev->u.fval, 'F');
+ break;
+ case AST_Expression::EV_double:
+ this->TAO_OutStream::print ("%24.16G", ev->u.dval);
+ break;
+ case AST_Expression::EV_longdouble:
+ break;
+ case AST_Expression::EV_char:
+ // isprint() sees \ and ' as printable characters
+ // so we have to test for them first.
+ if (ev->u.cval == '\\')
+ this->TAO_OutStream::print ("'\\\\'");
+ else if (ev->u.cval == '\'')
+ this->TAO_OutStream::print ("'\\''");
+
+ // This handles hex and octal escape sequences
+ // that would print out either as weird characters
+ // or as an unsigned number too large for a char.
+ else if ((unsigned char) ev->u.cval > ACE_CHAR_MAX)
+ this->TAO_OutStream::print ("%hd", ev->u.cval);
+ else if (isprint (ev->u.cval))
+ this->TAO_OutStream::print ("'%c'", ev->u.cval);
+ else if (iscntrl (ev->u.cval))
+ switch (ev->u.cval)
+ {
+ case '\n':
+ this->TAO_OutStream::print ("'\\n'");
+ break;
+ case '\t':
+ this->TAO_OutStream::print ("'\\t'");
+ break;
+ case '\r':
+ this->TAO_OutStream::print ("'\\r'");
+ break;
+ case '\v':
+ this->TAO_OutStream::print ("'\\v'");
+ break;
+ case '\f':
+ this->TAO_OutStream::print ("'\\f'");
+ break;
+ case '\b':
+ this->TAO_OutStream::print ("'\\b'");
+ break;
+ case '\a':
+ this->TAO_OutStream::print ("'\\a'");
+ break;
+ case '\?':
+ this->TAO_OutStream::print ("'?'");
+ break;
+ default:
+ this->TAO_OutStream::print ("'\\x%x'", ev->u.cval);
+ }
+ else
+ this->TAO_OutStream::print ("'\\x%x'", ev->u.cval);
+ break;
+ case AST_Expression::EV_wchar:
+ this->TAO_OutStream::print ("L'%lc'", ev->u.wcval);
+ break;
+ case AST_Expression::EV_octet:
+ this->TAO_OutStream::print ("%d", ev->u.oval);
+ break;
+ case AST_Expression::EV_bool:
+ this->TAO_OutStream::print ("%s", ev->u.bval ? "true" : "false");
+ break;
+ case AST_Expression::EV_string:
+ this->TAO_OutStream::print ("\"%s\"", ev->u.strval->get_string ());
+ break;
+ 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;
+ }
+ }
+ else
+ {
+ // XXXASG: need to add code here
+ }
+
+ return *this;
+}
diff --git a/TAO/TAO_IDL/be/be_tmplinst.cpp b/TAO/TAO_IDL/be/be_tmplinst.cpp
new file mode 100644
index 00000000000..0cbf0481478
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_tmplinst.cpp
@@ -0,0 +1,15 @@
+// $Id$
+
+#include "be_visitor_typecode/typecode_defn.h"
+#include "be_stream_factory.h"
+#include "be_visitor_factory.h"
+#include "ast_interface.h"
+#include "ace/Singleton.h"
+#include "ace/Synch.h"
+#include "ace/Unbounded_Queue.h"
+
+#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_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_Visitor_Factory,ACE_SYNCH_RECURSIVE_MUTEX>;
+#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */
diff --git a/TAO/TAO_IDL/be/be_type.cpp b/TAO/TAO_IDL/be/be_type.cpp
new file mode 100644
index 00000000000..8e4ca8254b3
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_type.cpp
@@ -0,0 +1,344 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_type.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Type that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_type.h"
+#include "be_scope.h"
+#include "be_visitor.h"
+#include "be_codegen.h"
+#include "be_helper.h"
+#include "utl_identifier.h"
+#include "idl_defines.h"
+#include "nr_extern.h"
+
+ACE_RCSID (be,
+ be_type,
+ "$Id$")
+
+be_type::be_type (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ be_decl (),
+ tc_name_ (0),
+ common_varout_gen_ (false),
+ seen_in_sequence_ (false),
+ seen_in_operation_ (false)
+{
+}
+
+be_type::be_type (AST_Decl::NodeType nt,
+ UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (nt,
+ n),
+ AST_Type (nt,
+ n),
+ be_decl (nt,
+ n),
+ tc_name_ (0),
+ common_varout_gen_ (false),
+ seen_in_sequence_ (false),
+ seen_in_operation_ (false)
+{
+ if (n != 0)
+ {
+ this->gen_fwd_helper_name ();
+ }
+}
+
+be_type::~be_type (void)
+{
+}
+
+// Compute the typecode name. The idea is to use the fully scoped name,
+// however, prepend a _tc_ to the last component. A slightly different approach
+// is required of the predefined types. Hence this method is overridden for
+// predefined types.
+
+void
+be_type::compute_tc_name (void)
+{
+ static char namebuf [NAMEBUFSIZE];
+ UTL_ScopedName *n = this->name ();
+
+ this->tc_name_ = 0;
+
+ ACE_OS::memset (namebuf,
+ '\0',
+ NAMEBUFSIZE);
+
+ while (n->tail () != 0)
+ {
+ // Does not exist.
+ if (this->tc_name_ == 0)
+ {
+ ACE_NEW (this->tc_name_,
+ UTL_ScopedName (n->head ()->copy (),
+ 0));
+ }
+ else
+ {
+ UTL_ScopedName *conc_name = 0;
+ ACE_NEW (conc_name,
+ UTL_ScopedName (n->head ()->copy (),
+ 0));
+
+ this->tc_name_->nconc (conc_name);
+ }
+
+ n = (UTL_ScopedName *)n->tail ();
+ }
+
+ ACE_OS::sprintf (namebuf,
+ "_tc_%s",
+ n->last_component ()->get_string ());
+
+ Identifier *id = 0;
+ ACE_NEW (id,
+ Identifier (namebuf));
+
+ // Does not exist.
+ if (this->tc_name_ == 0)
+ {
+ ACE_NEW (this->tc_name_,
+ UTL_ScopedName (id,
+ 0));
+ }
+ else
+ {
+ UTL_ScopedName *conc_name = 0;
+ ACE_NEW (conc_name,
+ UTL_ScopedName (id,
+ 0));
+
+ this->tc_name_->nconc (conc_name);
+ }
+}
+
+// Retrieve typecode name.
+UTL_ScopedName *
+be_type::tc_name (void)
+{
+ // Compute and init the member.
+ if (this->tc_name_ == 0)
+ {
+ this->compute_tc_name ();
+ }
+
+ return this->tc_name_;
+}
+
+// This works for the "special" names generated for smart proxy
+// classes. The form of these names is
+// scope'TAO_'+flat_name+'_Smart_Proxy_Base'.
+//
+// We can use the flat_name() method for the local_name parm but have
+// to construct the full name ourselves.
+const char *
+be_type::nested_sp_type_name (be_decl *use_scope,
+ const char *suffix,
+ const char *prefix)
+{
+ // Our defining scope.
+ be_decl *fu_scope = 0;
+
+ char fu_name [NAMEBUFSIZE];
+ char fl_name [NAMEBUFSIZE];
+
+ ACE_OS::memset (fu_name,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::memset (fl_name,
+ '\0',
+ NAMEBUFSIZE);
+
+ fu_scope = this->defined_in ()
+ ? be_scope::narrow_from_scope (this->defined_in ())->decl ()
+ : 0;
+
+ ACE_OS::strcat (fu_name,
+ fu_scope->full_name ());
+
+ ACE_OS::strcat (fu_name,
+ "::TAO_");
+
+ ACE_OS::strcat (fu_name,
+ this->flat_name());
+
+ ACE_OS::strcat (fl_name,
+ "TAO_");
+
+ ACE_OS::strcat (fl_name,
+ this->flat_name());
+
+ return this->nested_name (fl_name,
+ fu_name,
+ use_scope,
+ suffix,
+ prefix);
+}
+
+void
+be_type::gen_fwd_helper_name (void)
+{
+ AST_Decl *parent = ScopeAsDecl (this->defined_in ());
+ Identifier *segment = 0;
+ char *tmp = 0;
+ this->fwd_helper_name_.clear (1);
+
+ if (parent != 0 && parent->node_type () != AST_Decl::NT_root)
+ {
+ for (UTL_IdListActiveIterator i (parent->name ());
+ !i.is_done ();
+ i.next ())
+ {
+ segment = i.item ();
+ tmp = segment->get_string ();
+
+ if (ACE_OS::strcmp (tmp, "") == 0)
+ {
+ continue;
+ }
+
+ this->fwd_helper_name_ += tmp;
+ this->fwd_helper_name_ += "::";
+ }
+ }
+ else
+ {
+ this->fwd_helper_name_= "";
+ }
+
+ this->fwd_helper_name_ += "tao_";
+ this->fwd_helper_name_ += this->local_name ()->get_string ();
+}
+
+const char *
+be_type::fwd_helper_name (void) const
+{
+ return this->fwd_helper_name_.fast_rep ();
+}
+
+void
+be_type::fwd_helper_name (const char *name)
+{
+ this->fwd_helper_name_ = name;
+}
+
+void
+be_type::gen_common_varout (TAO_OutStream *os)
+{
+ if (this->common_varout_gen_ == 1)
+ {
+ return;
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ AST_Type::SIZE_TYPE st = this->size_type ();
+
+ *os << be_nl << be_nl
+ << (this->node_type () == AST_Decl::NT_struct ? "struct "
+ : "class ")
+ << this->local_name () << ";";
+
+ *os << be_nl << be_nl
+ << "typedef" << be_idt_nl
+ << (st == AST_Type::FIXED ? "TAO_Fixed_Var_T<"
+ : "TAO_Var_Var_T<")
+ << be_idt << be_idt_nl
+ << this->local_name () << be_uidt_nl
+ << ">" << be_uidt_nl
+ << this->local_name () << "_var;" << be_uidt_nl << be_nl;
+
+ if (st == AST_Type::FIXED)
+ {
+ *os << "typedef" << be_idt_nl
+ << this->local_name () << " &" << be_nl
+ << this->local_name () << "_out;" << be_uidt;
+ }
+ else
+ {
+ *os << "typedef" << be_idt_nl
+ << "TAO_Out_T<" << be_idt << be_idt_nl
+ << this->local_name () << be_uidt_nl
+ << ">" << be_uidt_nl
+ << this->local_name () << "_out;" << be_uidt;
+ }
+
+ this->common_varout_gen_ = 1;
+}
+
+bool
+be_type::seen_in_sequence (void) const
+{
+ return this->seen_in_sequence_;
+}
+
+void
+be_type::seen_in_sequence (bool val)
+{
+ this->seen_in_sequence_ = val;
+}
+
+bool
+be_type::seen_in_operation (void) const
+{
+ return this->seen_in_operation_;
+}
+
+void
+be_type::seen_in_operation (bool val)
+{
+ this->seen_in_operation_ = val;
+}
+
+AST_Decl::NodeType
+be_type::base_node_type (void) const
+{
+ return const_cast<be_type*> (this)->node_type ();
+}
+
+// Cleanup method
+void
+be_type::destroy (void)
+{
+ if (this->tc_name_ != 0)
+ {
+ this->tc_name_->destroy ();
+ delete this->tc_name_;
+ this->tc_name_ = 0;
+ }
+
+ this->be_decl::destroy ();
+}
+
+int
+be_type::accept (be_visitor *visitor)
+{
+ return visitor->visit_type (this);
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS2 (be_type, AST_Type, be_decl)
+IMPL_NARROW_FROM_DECL (be_type)
diff --git a/TAO/TAO_IDL/be/be_typedef.cpp b/TAO/TAO_IDL/be/be_typedef.cpp
new file mode 100644
index 00000000000..f33301349e5
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_typedef.cpp
@@ -0,0 +1,131 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_typedef.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Typedef that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_typedef.h"
+#include "be_visitor.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (be,
+ be_typedef,
+ "$Id$")
+
+be_typedef::be_typedef (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_Typedef (),
+ be_decl (),
+ be_type ()
+{
+}
+
+be_typedef::be_typedef (AST_Type *bt,
+ UTL_ScopedName *n,
+ bool local,
+ bool abstract)
+ : COMMON_Base (bt->is_local () || local,
+ abstract),
+ AST_Decl (AST_Decl::NT_typedef,
+ n),
+ AST_Type (AST_Decl::NT_typedef,
+ n),
+ AST_Typedef (bt,
+ n,
+ bt->is_local () || local,
+ abstract),
+ be_decl (AST_Decl::NT_typedef,
+ n),
+ be_type (AST_Decl::NT_typedef,
+ n)
+{
+ AST_Type *pbt = this->primitive_base_type ();
+ AST_Decl::NodeType nt = pbt->node_type ();
+
+ if (nt == AST_Decl::NT_sequence)
+ {
+ pbt->anonymous (false);
+ }
+}
+
+void
+be_typedef::seen_in_sequence (bool val)
+{
+ this->be_type::seen_in_sequence (val);
+ this->primitive_base_type ()->seen_in_sequence (val);
+}
+
+// Some compilers seems to have a problem with a function
+// that's both virtual and overloaded.
+bool
+be_typedef::seen_in_operation (void) const
+{
+ return this->be_type::seen_in_operation ();
+}
+
+void
+be_typedef::seen_in_operation (bool val)
+{
+ this->be_type::seen_in_operation (val);
+}
+
+// Given a typedef node, traverse the chain of base types until they are no
+// more typedefs, and return that most primitive base type.
+be_type *
+be_typedef::primitive_base_type (void)
+{
+ be_type *d = this;
+ be_typedef *temp = 0;
+
+ while (d && d->node_type () == AST_Decl::NT_typedef)
+ {
+ temp = be_typedef::narrow_from_decl (d);
+ d = be_type::narrow_from_decl (temp->base_type ());
+ }
+
+ return d;
+}
+
+AST_Decl::NodeType
+be_typedef::base_node_type (void) const
+{
+ be_typedef *td = const_cast<be_typedef *> (this);
+
+ be_type *base = be_type::narrow_from_decl (td->base_type ());
+
+ return base->base_node_type ();
+}
+
+void
+be_typedef::destroy (void)
+{
+ this->AST_Typedef::destroy ();
+ this->be_type::destroy ();
+}
+
+int
+be_typedef::accept (be_visitor *visitor)
+{
+ return visitor->visit_typedef (this);
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS2 (be_typedef, AST_Typedef, be_type)
+IMPL_NARROW_FROM_DECL (be_typedef)
diff --git a/TAO/TAO_IDL/be/be_union.cpp b/TAO/TAO_IDL/be/be_union.cpp
new file mode 100644
index 00000000000..7d23e07703d
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_union.cpp
@@ -0,0 +1,196 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_union.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Union that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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"
+#include "global_extern.h"
+
+ACE_RCSID (be,
+ be_union,
+ "$Id$")
+
+
+be_union::be_union (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType (),
+ UTL_Scope (),
+ AST_Structure (),
+ AST_Union (),
+ be_scope (),
+ be_decl (),
+ be_type ()
+{
+ // Always the case.
+ this->has_constructor (true);
+}
+
+be_union::be_union (AST_ConcreteType *dt,
+ UTL_ScopedName *n,
+ bool local,
+ bool abstract)
+ : COMMON_Base (local,
+ abstract),
+ AST_Decl (AST_Decl::NT_union,
+ n),
+ AST_Type (AST_Decl::NT_union,
+ n),
+ AST_ConcreteType (AST_Decl::NT_union,
+ n),
+ UTL_Scope (AST_Decl::NT_union),
+ AST_Structure (AST_Decl::NT_union,
+ n,
+ local,
+ abstract),
+ AST_Union (dt,
+ n,
+ local,
+ abstract),
+ be_scope (AST_Decl::NT_union),
+ be_decl (AST_Decl::NT_union,
+ n),
+ be_type (AST_Decl::NT_union,
+ n)
+{
+ // Always the case.
+ this->has_constructor (true);
+
+ if (!this->imported ())
+ {
+ idl_global->aggregate_seen_ = true;
+
+ idl_global->union_seen_ = true;
+ }
+}
+
+void
+be_union::redefine (AST_Structure *from)
+{
+ be_union *bu = be_union::narrow_from_decl (from);
+ this->common_varout_gen_ = bu->common_varout_gen_;
+ AST_Union::redefine (from);
+}
+
+bool
+be_union::has_duplicate_case_labels (void)
+{
+ for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ AST_Decl *d = si.item ();
+ AST_UnionBranch *ub =
+ AST_UnionBranch::narrow_from_decl (d);
+
+ if (ub->label_list_length () > 1)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void
+be_union::destroy (void)
+{
+ // Call the destroy methods of our base classes.
+ this->be_scope::destroy ();
+ this->be_type::destroy ();
+ this->AST_Union::destroy ();
+
+}
+
+// Visitor method.
+int
+be_union::accept (be_visitor *visitor)
+{
+ return visitor->visit_union (this);
+}
+
+bool
+be_union::gen_empty_default_label (void)
+{
+ // A non-empty explicit default label will be generated.
+ if (this->default_index () != -1)
+ {
+ return false;
+ }
+
+ AST_ConcreteType *disc = this->disc_type ();
+ AST_Decl::NodeType nt = disc->node_type ();
+
+ if (nt == AST_Decl::NT_enum)
+ {
+ return true;
+ }
+
+ AST_PredefinedType *pdt = AST_PredefinedType::narrow_from_decl (disc);
+
+ if (pdt == 0)
+ {
+ return true;
+ }
+
+ unsigned long n_labels = this->nlabels ();
+
+ if (pdt->pt () == AST_PredefinedType::PT_boolean && n_labels == 2)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+unsigned long
+be_union::nlabels (void)
+{
+ unsigned long retval = 0;
+
+ for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ AST_Decl *d = si.item ();
+ AST_UnionBranch *ub =
+ AST_UnionBranch::narrow_from_decl (d);
+
+ if (ub != 0)
+ {
+ retval += ub->label_list_length ();
+ }
+ }
+
+ return retval;
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS3 (be_union, AST_Union, be_scope, be_type)
+IMPL_NARROW_FROM_DECL (be_union)
+IMPL_NARROW_FROM_SCOPE (be_union)
diff --git a/TAO/TAO_IDL/be/be_union_branch.cpp b/TAO/TAO_IDL/be/be_union_branch.cpp
new file mode 100644
index 00000000000..22cd43f8a86
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_union_branch.cpp
@@ -0,0 +1,200 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_union_branch.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_UnionBranch that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (be,
+ be_union_branch,
+ "$Id$")
+
+be_union_branch::be_union_branch (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Field (),
+ AST_UnionBranch (),
+ be_decl ()
+{
+}
+
+be_union_branch::be_union_branch (UTL_LabelList *ll,
+ AST_Type *ft,
+ UTL_ScopedName *n)
+ : COMMON_Base (ft->is_local (),
+ ft->is_abstract ()),
+ AST_Decl (AST_Decl::NT_union_branch,
+ n),
+ AST_Field (AST_Decl::NT_union_branch,
+ ft,
+ n),
+ AST_UnionBranch (ll,
+ ft,
+ n),
+ be_decl (AST_Decl::NT_union_branch,
+ n)
+{
+}
+
+int
+be_union_branch::gen_label_value (TAO_OutStream *os, unsigned long index)
+{
+ AST_Expression *e = this->label (index)->label_val ();
+
+ if (e->ec () != AST_Expression::EC_symbol)
+ {
+ // Easy, just a number...
+ *os << e;
+ return 0;
+ }
+
+ // If the enum is not in the global scope we have to prefix it.
+ be_union *u =
+ be_union::narrow_from_scope (this->defined_in ());
+
+ if (u == 0)
+ {
+ return -1;
+ }
+
+ be_type* dt =
+ be_type::narrow_from_decl (u->disc_type ());
+
+ if (dt == 0)
+ {
+ return -1;
+ }
+
+ // Check if discriminator is a typedef of an integer. If so, and the
+ // first IF block in this function didn't catch it, then we
+ // are a constant of this type. We can't generate the constant's name,
+ // we must generate the underlying integer value for the
+ // label value.
+ if (dt->node_type () == AST_Decl::NT_pre_defined)
+ {
+ *os << e;
+ return 0;
+ }
+
+ // 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 << e->n ();
+ return 0;
+ }
+
+ // But if it was generated inside a module or something similar then
+ // we must prefix the enum value with something...
+ be_decl* decl = scope->decl ();
+
+ *os << decl->full_name () << "::" << e->n ()->last_component ();
+
+ return 0;
+}
+
+int
+be_union_branch::gen_default_label_value (TAO_OutStream *os,
+ be_union *bu)
+{
+ be_union::DefaultValue dv;
+
+ if (bu->default_value (dv) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch::"
+ "gen_default_label_value - "
+ "computing default value failed\n"),
+ -1);
+ }
+
+ 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);
+ break;
+ case AST_Expression::EV_bool:
+ *os << (dv.u.bool_val == 0 ? "false" : "true");
+ break;
+ 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.
+ {
+ AST_ConcreteType *act = bu->disc_type ();
+ be_enum *be = be_enum::narrow_from_decl (act);
+
+ // The function value_to_name() takes care of adding
+ // any necessary scoping to the output.
+ *os << be->value_to_name (dv.u.enum_val);
+ break;
+ }
+ case AST_Expression::EV_longlong:
+ case AST_Expression::EV_ulonglong:
+ // Unimplemented.
+ default:
+ // Error caught earlier.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch::"
+ "gen_default_label_value - "
+ "bad or unimplemented discriminant type\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_union_branch::accept (be_visitor *visitor)
+{
+ return visitor->visit_union_branch (this);
+}
+
+void
+be_union_branch::destroy (void)
+{
+ this->be_decl::destroy ();
+ this->AST_UnionBranch::destroy ();
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS2 (be_union_branch, AST_UnionBranch, be_decl)
+IMPL_NARROW_FROM_DECL (be_union_branch)
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..e695b8335e9
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_union_fwd.cpp
@@ -0,0 +1,78 @@
+// $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"
+#include "ast_union.h"
+
+ACE_RCSID (be,
+ be_union_fwd,
+ "$Id$")
+
+be_union_fwd::be_union_fwd (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_StructureFwd (),
+ AST_UnionFwd (),
+ be_decl (),
+ be_type (),
+ be_structure_fwd ()
+{
+}
+
+be_union_fwd::be_union_fwd (AST_Union *dummy,
+ UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_union_fwd,
+ n),
+ AST_Type (AST_Decl::NT_union_fwd,
+ n),
+ AST_StructureFwd (dummy,
+ n),
+ AST_UnionFwd (dummy,
+ n),
+ be_decl (AST_Decl::NT_union_fwd,
+ n),
+ be_type (AST_Decl::NT_union_fwd,
+ n),
+ be_structure_fwd (dummy,
+ n)
+{
+}
+
+be_union_fwd::~be_union_fwd (void)
+{
+}
+
+void
+be_union_fwd::destroy (void)
+{
+ this->be_structure_fwd::destroy ();
+}
+
+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
new file mode 100644
index 00000000000..2f1f63dc27b
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_union_label.cpp
@@ -0,0 +1,35 @@
+//
+// $Id$
+//
+
+#include "be_union_label.h"
+#include "be_visitor.h"
+
+ACE_RCSID (be,
+ be_union_label,
+ "$Id$")
+
+be_union_label::be_union_label (void)
+ : AST_UnionLabel ()
+{
+}
+
+be_union_label::be_union_label (AST_UnionLabel::UnionLabel ul,
+ AST_Expression *v)
+ : AST_UnionLabel (ul,
+ v)
+{
+}
+
+int
+be_union_label::accept (be_visitor *visitor)
+{
+ return visitor->visit_union_label (this);
+}
+
+void
+be_union_label::destroy (void)
+{
+ this->AST_UnionLabel::destroy ();
+}
+
diff --git a/TAO/TAO_IDL/be/be_util.cpp b/TAO/TAO_IDL/be/be_util.cpp
new file mode 100644
index 00000000000..fb257e3353e
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_util.cpp
@@ -0,0 +1,58 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_util.cpp
+//
+// = DESCRIPTION
+// Static helper methods used by multiple visitors.
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+#include "be_util.h"
+#include "utl_identifier.h"
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (be,
+ be_util,
+ "$Id$")
+
+void
+be_util::gen_nested_namespace_begin (TAO_OutStream *os, be_module *node)
+{
+ char *item_name = 0;
+
+ for (UTL_IdListActiveIterator i (node->name ()); !i.is_done (); i.next ())
+ {
+ item_name = i.item ()->get_string ();
+
+ if (ACE_OS::strcmp (item_name, "") != 0)
+ {
+ // Leave the outermost root scope.
+ *os << be_nl << "namespace " << item_name << be_nl
+ << "{" << be_idt_nl;
+ }
+ }
+}
+
+void
+be_util::gen_nested_namespace_end (TAO_OutStream *os, be_module *node)
+{
+ for (UTL_IdListActiveIterator i (node->name ()); !i.is_done (); i.next ())
+ {
+ if (ACE_OS::strcmp (i.item ()->get_string (), "") != 0)
+ {
+ // Leave the outermost root scope.
+ *os << be_uidt_nl << "}";
+ }
+ }
+
+ *os << be_nl << be_nl;
+}
diff --git a/TAO/TAO_IDL/be/be_valuebox.cpp b/TAO/TAO_IDL/be/be_valuebox.cpp
new file mode 100644
index 00000000000..0efd7f4df4a
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_valuebox.cpp
@@ -0,0 +1,96 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_valuebox.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Valuebox that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+#include "be_valuebox.h"
+#include "be_type.h"
+#include "be_visitor.h"
+#include "global_extern.h"
+
+ACE_RCSID (be,
+ be_valuebox,
+ "be_valuebox.cpp Exp")
+
+// Default constructor.
+be_valuebox::be_valuebox (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType (),
+ AST_ValueBox (),
+ be_decl (),
+ be_type ()
+{
+ // Always the case (according to C++ mapping specification).
+ this->size_type (AST_Type::VARIABLE);
+
+ // Set the flag that says we have a valuetype in this IDL file.
+ // This allows the correct #include to be generated (see be_codegen.cpp).
+ idl_global->valuebase_seen_ = true;
+
+ // Set the flag that says we have a valuetype in this IDL file.
+ // This allows the correct #include to be generated (see be_codegen.cpp).
+ idl_global->valuetype_seen_ = true;
+}
+
+be_valuebox::be_valuebox (AST_Type *boxed_type,
+ UTL_ScopedName *n)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_valuebox,
+ n),
+ AST_Type (AST_Decl::NT_valuebox,
+ n),
+ AST_ConcreteType (AST_Decl::NT_valuebox,
+ n),
+ AST_ValueBox (n,
+ boxed_type),
+ be_decl (AST_Decl::NT_valuebox,
+ n),
+ be_type (AST_Decl::NT_valuebox,
+ n)
+{
+ // Always the case (according to C++ mapping specification).
+ this->size_type (AST_Type::VARIABLE);
+
+ // Set the flag that says we have a valuetype in this IDL file.
+ // This allows the correct #include to be generated (see be_codegen.cpp).
+ idl_global->valuebase_seen_ = true;
+
+ // Set the flag that says we have a valuetype in this IDL file.
+ // This allows the correct #include to be generated (see be_codegen.cpp).
+ idl_global->valuetype_seen_ = true;
+}
+
+// Accept a visitor.
+int
+be_valuebox::accept (be_visitor *visitor)
+{
+ return visitor->visit_valuebox (this);
+}
+
+
+void
+be_valuebox::destroy (void)
+{
+ // Call the destroy methods of our base classes.
+ this->AST_Type::destroy ();
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS2 (be_valuebox, AST_ValueBox, be_type)
+IMPL_NARROW_FROM_DECL (be_valuebox)
diff --git a/TAO/TAO_IDL/be/be_valuetype.cpp b/TAO/TAO_IDL/be/be_valuetype.cpp
new file mode 100644
index 00000000000..6b81e89321f
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_valuetype.cpp
@@ -0,0 +1,942 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_valuetype.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Interface and be_interface that provides
+// additional means for C++ mapping of an valuetype.
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+// derived from be_interface.cpp
+//
+// ============================================================================
+
+#include "be_valuetype.h"
+#include "be_visitor.h"
+#include "be_extern.h"
+#include "be_helper.h"
+#include "ast_module.h"
+#include "utl_identifier.h"
+#include "idl_defines.h"
+#include "nr_extern.h"
+#include "global_extern.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (be,
+ be_valuetype,
+ "$Id$")
+
+// Default constructor.
+be_valuetype::be_valuetype (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ UTL_Scope (),
+ AST_Interface (),
+ be_scope (),
+ be_decl (),
+ be_type (),
+ be_interface (),
+ AST_ValueType (),
+ full_obv_skel_name_ (0)
+{
+ // Always the case.
+ this->size_type (AST_Type::VARIABLE);
+
+ AST_Module *m = AST_Module::narrow_from_scope (this->defined_in ());
+
+ if (m != 0)
+ {
+ m->set_has_nested_valuetype ();
+ }
+
+ // Always the case.
+ this->has_constructor (true);
+}
+
+// Constructor used to build the AST.
+be_valuetype::be_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,
+ bool abstract,
+ bool truncatable,
+ bool custom)
+ : COMMON_Base (0,
+ abstract),
+ AST_Decl (AST_Decl::NT_valuetype,
+ n),
+ AST_Type (AST_Decl::NT_valuetype,
+ n),
+ UTL_Scope (AST_Decl::NT_valuetype),
+ AST_Interface (n,
+ inherits,
+ n_inherits,
+ inherits_flat,
+ n_inherits_flat,
+ 0,
+ abstract),
+ be_scope (AST_Decl::NT_valuetype),
+ be_decl (AST_Decl::NT_valuetype,
+ n),
+ be_type (AST_Decl::NT_valuetype,
+ n),
+ be_interface (n,
+ inherits,
+ n_inherits,
+ inherits_flat,
+ n_inherits_flat,
+ 0,
+ abstract),
+ AST_ValueType (n,
+ inherits,
+ n_inherits,
+ inherits_concrete,
+ inherits_flat,
+ n_inherits_flat,
+ supports,
+ n_supports,
+ supports_concrete,
+ abstract,
+ truncatable,
+ custom),
+ full_obv_skel_name_ (0),
+ supports_abstract_ (0),
+ var_out_seq_decls_gen_ (0)
+{
+ // Check that redefine() copies all members.
+
+ // Always the case.
+ this->size_type (AST_Type::VARIABLE);
+
+ AST_Module *m = AST_Module::narrow_from_scope (this->defined_in ());
+
+ if (m != 0)
+ {
+ m->set_has_nested_valuetype ();
+ }
+
+ // Always the case.
+ this->has_constructor (true);
+
+ for (long i = 0; i < this->pd_n_supports; ++i)
+ {
+ be_interface *intf =
+ be_interface::narrow_from_decl (this->pd_supports[i]);
+
+ if (intf->has_mixed_parentage ())
+ {
+ this->supports_abstract_ = true;
+ break;
+ }
+ }
+
+ if (this->imported ())
+ {
+ return;
+ }
+
+ // Set the flag that says we have a valuetype in this IDL file.
+ if (this->is_defined ())
+ {
+ idl_global->valuetype_seen_ = true;
+ }
+ else
+ {
+ idl_global->fwd_valuetype_seen_ = true;
+ }
+}
+
+be_valuetype::~be_valuetype (void)
+{
+}
+
+void
+be_valuetype::redefine (AST_Interface *from)
+{
+ be_valuetype *bv = be_valuetype::narrow_from_decl (from);
+ bv->var_out_seq_decls_gen_ = bv->var_out_seq_decls_gen_;
+ this->AST_ValueType::redefine (from);
+}
+
+// Is true if non-virtual accessor and modifier should be generated
+// If #pragma TAO OBV opt_accessor (todo) is used or -Wb,obv_opt_accessor.
+bool
+be_valuetype::opt_accessor (void)
+{
+ return be_global->obv_opt_accessor ();
+}
+
+// Compute stringified fully scoped skeleton name (OBV_name).
+void
+be_valuetype::compute_fullobvskelname (void)
+{
+ this->compute_full_skel_name ("OBV_",
+ this->full_obv_skel_name_);
+}
+
+// Retrieve the fully scoped skeleton name.
+const char*
+be_valuetype::full_obv_skel_name (void)
+{
+ if (0 == this->full_obv_skel_name_)
+ {
+ compute_fullobvskelname ();
+ }
+
+ return this->full_obv_skel_name_;
+}
+
+const char *
+be_valuetype::fwd_helper_name (void) const
+{
+ return this->fwd_helper_name_.fast_rep ();
+}
+
+be_valuetype::FactoryStyle
+be_valuetype::determine_factory_style (void)
+{
+ FactoryStyle factory_style = FS_UNKNOWN;
+
+
+ if (this->is_abstract ())
+ {
+ return FS_NO_FACTORY;
+ }
+
+ // Check whether we have at least one operation or not.
+ bool have_operation = this->have_operation ();
+ bool have_factory = 0;
+
+ // Try only our own scope.
+ if (this->nmembers () > 0)
+ {
+ // Initialize an iterator to iterate thru our scope
+ // Continue until each element is visited.
+ for (UTL_ScopeActiveIterator si (this,
+ UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next())
+ {
+ AST_Decl *d = si.item ();
+
+ if (!d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_valuetype::"
+ "determine_factory_style"
+ "bad node in this scope\n"),
+ factory_style);
+
+ }
+
+ AST_Decl::NodeType node_type = d->node_type ();
+
+ if (node_type == AST_Decl::NT_factory)
+ {
+ have_factory = 1;
+ break;
+ }
+
+ } // end of for loop
+ } // end of if
+
+ if (!have_operation && !have_factory)
+ {
+ factory_style = FS_CONCRETE_FACTORY;
+ }
+ else if (have_operation && !have_factory)
+ {
+ factory_style = FS_NO_FACTORY;
+ }
+ else
+ {
+ factory_style = FS_ABSTRACT_FACTORY;
+ }
+
+ return factory_style;
+}
+
+bool
+be_valuetype::have_operation (void)
+{
+ // Check whatever scope we get for operations/attributes.
+
+ bool have_operation = false;
+
+ // Operations are either operations or attributes of:
+ // -its own
+ // -derived (abstract VT | VT | abstract iface | iface)
+ //
+
+ // First try our own scope.
+ if (this->nmembers () > 0)
+ {
+ // Initialize an iterator to iterate thru our scope
+ // Continue until each element is checked.
+ for (UTL_ScopeActiveIterator si (this,
+ UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next())
+ {
+ AST_Decl *d = si.item ();
+
+ if (!d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_valuetype::"
+ "has_operation"
+ "bad node in this scope\n"),
+ 0);
+
+ }
+
+ AST_Decl::NodeType nt = d->node_type();
+
+ if (nt == AST_Decl::NT_op || nt == AST_Decl::NT_attr)
+ {
+ have_operation = true;
+ break;
+ }
+ } // end of for loop
+ } // end of if
+
+ if (! have_operation)
+ {
+ // Now traverse inheritance tree.
+ long i; // loop index
+ long n_inherits = this->n_inherits ();
+ AST_Interface **inherits = this->inherits ();
+
+ for (i = 0; i < n_inherits; ++i)
+ {
+ be_valuetype *vt = be_valuetype::narrow_from_decl (inherits[i]);
+
+ if (vt != 0 && vt->have_operation ())
+ {
+ have_operation = true;
+ break;
+ }
+ }
+ }
+
+ if (! have_operation)
+ {
+ // Check for operations on supported interfaces
+ AST_Interface * supported = this->supports_concrete ();
+
+ if (supported != 0)
+ {
+ be_interface *intf = be_interface::narrow_from_decl (supported);
+
+ if (intf != 0)
+ {
+ have_operation = be_valuetype::have_supported_op (intf);
+ }
+ }
+ }
+
+ return have_operation;
+}
+
+bool
+be_valuetype::have_supported_op (be_interface * node)
+{
+
+ bool have_supported_op = 0;
+
+ if (node->nmembers () == 0)
+ {
+ return false;
+ }
+
+ // Initialize an iterator for supported interface elements
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ si.is_done ();
+ si.next())
+ {
+ AST_Decl *d = si.item ();
+
+ if (!d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_valuetype::"
+ "have_supported_op"
+ "bad node in this scope\n"),
+ 0);
+ }
+
+ AST_Decl::NodeType nt = d->node_type ();
+
+ // Check the type of each element in the supported interface
+ if (nt == AST_Decl::NT_op || nt == AST_Decl::NT_attr)
+ {
+ have_supported_op = 1;
+ break;
+ }
+ } // end for loop
+
+ if (! have_supported_op)
+ {
+ // Now traverse inheritance tree.
+ long i; // loop index
+ long n_inherits = node->n_inherits ();
+ AST_Interface **inherits = node->inherits ();
+ for (i = 0; i < n_inherits; ++i)
+ {
+ be_interface * intf = be_interface::narrow_from_decl (inherits[i]);
+
+ if (intf != 0)
+ {
+ have_supported_op = be_valuetype::have_supported_op (intf);
+
+ if (have_supported_op)
+ {
+ break;
+ }
+ }
+ }
+ }
+
+ return have_supported_op;
+}
+
+bool
+be_valuetype::will_have_factory (void)
+{
+ FactoryStyle fs = this->determine_factory_style ();
+
+ return (fs == FS_ABSTRACT_FACTORY || fs == FS_CONCRETE_FACTORY);
+}
+
+bool
+be_valuetype::has_member (void)
+{
+ AST_ValueType *parent = this->pd_inherits_concrete;
+
+ // We're looking for inherited members too.
+ if (parent != 0)
+ {
+ be_valuetype *be_parent =
+ be_valuetype::narrow_from_decl (parent);
+
+ if (be_parent->has_member ())
+ {
+ return true;
+ }
+ }
+
+ for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next())
+ {
+ if (si.item ()->node_type () == AST_Decl::NT_field)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+int
+be_valuetype::gen_helper_header (char *, char *)
+{
+ TAO_OutStream *os = tao_cg->client_header ();
+
+ *os << be_nl << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *os << "namespace CORBA" << be_nl
+ << "{"
+ << be_idt_nl
+ << "extern " << be_global->stub_export_macro () << " void add_ref ("
+ << this->full_name () << " *);" << be_nl
+ << "extern " << be_global->stub_export_macro () << " void remove_ref ("
+ << this->full_name () << " *);";
+
+ *os << be_uidt_nl
+ << "}";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ return 0;
+}
+
+int
+be_valuetype::gen_helper_inline (char *, char *)
+{
+ TAO_OutStream *os = tao_cg->client_inline ();
+
+ // There is a problem, here. Looks like the if defined __ACE_INLINE
+ // is not getting generated... Actually this is a much bigger
+ // problem. Just hacking it up for the timebeing..
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "#if defined (__ACE_INLINE__)" << be_nl << be_nl
+ << be_global->core_versioning_begin () << be_nl
+ << "namespace CORBA" << be_nl
+ << "{"
+ << be_idt_nl
+ << "extern " << be_global->stub_export_macro () << " void add_ref ("
+ << this->full_name () << " *);" << be_nl
+ << "extern " << be_global->stub_export_macro () << " void remove_ref ("
+ << this->full_name () << " *);"
+ << be_uidt_nl
+ << "}" << be_nl << be_nl
+ << be_global->core_versioning_end () << be_nl
+ << "#endif /*__ACE_INLINE__*/";
+
+ return 0;
+}
+
+
+int
+be_valuetype::gen_helper_stubs (char *, char *)
+{
+ TAO_OutStream *os = tao_cg->client_stubs ();
+
+ *os << be_nl << be_nl << "// 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_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_idt_nl
+ << "{" << be_idt_nl
+ << "vt->_remove_ref ();" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+// Generate the forward declarations and static methods used by the
+// interface _var and _out template classes, as well as by the
+// template sequence classes for object references.
+void
+be_valuetype:: gen_var_out_seq_decls (void)
+{
+ if (this->var_out_seq_decls_gen_ == 1)
+ {
+ return;
+ }
+
+ TAO_OutStream *os = tao_cg->client_header ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Generate the ifdefined macro for this interface.
+ os->gen_ifdef_macro (this->flat_name (),
+ "var_out");
+
+ const char *lname = this->local_name ();
+
+ *os << be_nl << be_nl
+ << "class " << lname << ";" << be_nl
+ << "typedef" << be_idt_nl
+ << "TAO_Value_Var_T<" << be_idt << be_idt_nl
+ << lname << be_uidt_nl
+ << ">" << be_uidt_nl
+ << lname << "_var;" << be_uidt_nl << be_nl
+ << "typedef" << be_idt_nl
+ << "TAO_Value_Out_T<" << be_idt << be_idt_nl
+ << lname << be_uidt_nl
+ << ">" << be_uidt_nl
+ << lname << "_out;" << be_uidt;
+
+ os->gen_endif ();
+
+ this->var_out_seq_decls_gen_ = 1;
+}
+
+// For building the pre and postfix of private data fields.
+const char *
+be_valuetype::field_pd_prefix (void)
+{
+ return "_pd_";
+}
+
+const char *
+be_valuetype::field_pd_postfix (void)
+{
+ return "";
+}
+
+be_valuetype *
+be_valuetype::statefull_inherit (void)
+{
+ if (this->pd_inherits_concrete != 0)
+ {
+ return be_valuetype::narrow_from_decl (this->pd_inherits_concrete);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+// Accept a visitor.
+int
+be_valuetype::accept (be_visitor *visitor)
+{
+ return visitor->visit_valuetype (this);
+}
+
+void
+be_valuetype::destroy (void)
+{
+ delete [] this->full_obv_skel_name_;
+ this->full_obv_skel_name_ = 0;
+
+ this->be_interface::destroy ();
+ this->AST_ValueType::destroy ();
+}
+
+ACE_CDR::ULong
+be_valuetype::data_members_count (AST_Field::Visibility vis)
+{
+ ACE_CDR::ULong count = 0;
+
+ for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next())
+ {
+ AST_Decl *d = si.item ();
+
+ if (!d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_valuetype::data_members_count - "
+ "bad node in this scope\n"), 0);
+ }
+
+ AST_Field *field = AST_Field::narrow_from_decl (d);
+
+ if (!field)
+ {
+ continue;
+ }
+
+ if (vis != AST_Field::vis_NA)
+ {
+ if (vis == field->visibility ()) ++count;
+ }
+ else
+ {
+ ++count;
+ }
+ } // end of for loop
+ return count;
+}
+
+bool
+be_valuetype::in_recursion (ACE_Unbounded_Queue<AST_Type *> &list)
+{
+ list.enqueue_tail (this);
+
+ for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next())
+ {
+ AST_Decl *d = si.item ();
+
+ if (!d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_valuetype::in_recursion - "
+ "bad node in this scope\n"),
+ 0);
+ }
+
+ AST_Field *field = AST_Field::narrow_from_decl (d);
+
+ if (!field)
+ {
+ continue;
+ }
+
+ AST_Type *type = field->field_type ();
+
+ // A valuetype may contain itself as a member. This will not
+ // cause a problem when checking if the valuetype itself is
+ // recursive, but if another valuetype contains a recursive
+ // one, the string compare below is not sufficient, and we
+ // will go into an infinite recursion of calls to in_recursion ;-).
+ // The check below will catch that use case.
+ if (this == type)
+ {
+ this->in_recursion_ = 1;
+ idl_global->recursive_type_seen_ = true;
+ return this->in_recursion_;
+ }
+
+ if (!type)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_valuetype::in_recursion - "
+ "bad base type\n"),
+ 0);
+ }
+
+ // IDL doesn't have such a feature as name reuse so
+ // just compare fully qualified names.
+ if (this->match_names (this, list))
+ {
+ this->in_recursion_ = 1;
+ idl_global->recursive_type_seen_ = true;
+ return this->in_recursion_;
+ }
+
+ if (type->node_type () == AST_Decl::NT_typedef)
+ {
+ AST_Typedef *td = AST_Typedef::narrow_from_decl (type);
+ type = td->primitive_base_type ();
+ }
+
+ // Now hand over to our field type.
+ if (type->in_recursion (list))
+ {
+ this->in_recursion_ = 1;
+ idl_global->recursive_type_seen_ = true;
+ return this->in_recursion_;
+ }
+
+ } // end of for loop
+
+ this->in_recursion_ = 0;
+ return this->in_recursion_;
+}
+
+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,
+ bool use_abstract_paths,
+ bool use_concrete_paths
+ )
+{
+ bool abstract_paths_only = use_abstract_paths && !use_concrete_paths;
+
+ 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 (! use_abstract_paths
+ && this->pd_supports[i]->is_abstract ())
+ {
+ continue;
+ }
+
+ if (! use_concrete_paths
+ && ! 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_list_graphs - "
+ "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 "
+ << base->name ();
+
+ 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" << env_dflts << 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" << env_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" << env_arg << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}\n";
+ }
+ }
+ } // End of scope iterator.
+ }
+
+ return 0;
+}
+
+// Narrowing.
+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
new file mode 100644
index 00000000000..2146482f54c
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_valuetype_fwd.cpp
@@ -0,0 +1,84 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_valuetype_fwd.h
+//
+// = DESCRIPTION
+// Extension of class be_interface_fwd that provides additional
+// means for C++ mapping of an valuetype.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+// changed for valuetypes by Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+//
+// ============================================================================
+
+
+#include "be_valuetype_fwd.h"
+#include "be_visitor.h"
+#include "ast_interface.h"
+
+ACE_RCSID (be,
+ be_valuetype_fwd,
+ "$Id$")
+
+be_valuetype_fwd::be_valuetype_fwd (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_InterfaceFwd (),
+ be_decl (),
+ be_type (),
+ be_interface_fwd (),
+ AST_ValueTypeFwd ()
+{
+}
+
+be_valuetype_fwd::be_valuetype_fwd (AST_Interface *dummy,
+ UTL_ScopedName *n)
+ : COMMON_Base (dummy->is_local (),
+ dummy->is_abstract ()),
+ AST_Decl (AST_Decl::NT_valuetype_fwd,
+ n),
+ AST_Type (AST_Decl::NT_valuetype_fwd,
+ n),
+ AST_InterfaceFwd (dummy,
+ n),
+ be_decl (AST_Decl::NT_valuetype_fwd,
+ n),
+ be_type (AST_Decl::NT_valuetype_fwd,
+ n),
+ be_interface_fwd (dummy,
+ n),
+ AST_ValueTypeFwd (dummy,
+ n)
+{
+}
+
+be_valuetype_fwd::~be_valuetype_fwd (void)
+{
+}
+
+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_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
new file mode 100644
index 00000000000..d5393a4c3af
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor.cpp
@@ -0,0 +1,224 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor.h
+//
+// = DESCRIPTION
+// Abstract class for back end visitors.
+//
+// = NOTES
+// This is not a pure abstract class
+//
+// = AUTHOR
+// Aniruddha Gokhale and Carlos O'Ryan
+//
+// ============================================================================
+
+#include "be_visitor.h"
+#include "ace/config-all.h"
+
+ACE_RCSID (be,
+ be_visitor,
+ "$Id$")
+
+be_visitor::be_visitor (void)
+{
+}
+
+be_visitor::~be_visitor (void)
+{
+}
+
+// all the visit methods. Concrete visitors will selectively override each one
+int be_visitor::visit_decl (be_decl *)
+{
+ return 0;
+}
+
+int be_visitor::visit_scope (be_scope *)
+{
+ return 0;
+}
+
+int be_visitor::visit_type (be_type *)
+{
+ return 0;
+}
+
+int be_visitor::visit_predefined_type (be_predefined_type *)
+{
+ return 0;
+}
+
+int be_visitor::visit_module (be_module *)
+{
+ return 0;
+}
+
+int be_visitor::visit_interface (be_interface *)
+{
+ return 0;
+}
+
+int be_visitor::visit_interface_fwd (be_interface_fwd *)
+{
+ return 0;
+}
+
+int be_visitor::visit_valuebox (be_valuebox *)
+{
+ return 0;
+}
+
+int be_visitor::visit_valuetype (be_valuetype *)
+{
+ return 0;
+}
+
+int be_visitor::visit_valuetype_fwd (be_valuetype_fwd *)
+{
+ return 0;
+}
+
+int be_visitor::visit_eventtype (be_eventtype *)
+{
+ return 0;
+}
+
+int be_visitor::visit_eventtype_fwd (be_eventtype_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;
+}
+
+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;
+}
+
+int be_visitor::visit_expression (be_expression *)
+{
+ return 0;
+}
+
+int be_visitor::visit_enum (be_enum *)
+{
+ return 0;
+}
+
+int be_visitor::visit_operation (be_operation *)
+{
+ return 0;
+}
+
+int be_visitor::visit_field (be_field *)
+{
+ return 0;
+}
+
+int be_visitor::visit_argument (be_argument *)
+{
+ return 0;
+}
+
+int be_visitor::visit_attribute (be_attribute *)
+{
+ return 0;
+}
+
+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;
+}
+
+int be_visitor::visit_union_label (be_union_label *)
+{
+ return 0;
+}
+
+int be_visitor::visit_constant (be_constant *)
+{
+ return 0;
+}
+
+int be_visitor::visit_enum_val (be_enum_val *)
+{
+ return 0;
+}
+
+int be_visitor::visit_array (be_array *)
+{
+ return 0;
+}
+
+int be_visitor::visit_sequence (be_sequence *)
+{
+ return 0;
+}
+
+int be_visitor::visit_string (be_string *)
+{
+ return 0;
+}
+
+int be_visitor::visit_typedef (be_typedef *)
+{
+ return 0;
+}
+
+int be_visitor::visit_root (be_root *)
+{
+ return 0;
+}
+
+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
new file mode 100644
index 00000000000..232bed31bea
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp
@@ -0,0 +1,858 @@
+/**
+ * @file be_visitor_amh_pre_proc.cpp
+ *
+ * $Id$
+ *
+ * This visitor creates for AMH implied IDL constructs the appropriate AST
+ * (Abstract Syntax Tree) node, sets the corresponding interface or operation
+ * strategy on it and enteres the nodes into the AST.
+*
+* @author Darrell Brunsch <brunsch@cs.wustl.edu>
+* @author Mayur Deshpande <mayur@ics.uci.edu>
+* @author Carlos O'Ryan <coryan@uci.edu>
+*/
+//=============================================================================
+
+#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 "be_extern.h"
+#include "utl_identifier.h"
+#include "utl_exceptlist.h"
+#include "global_extern.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (be,
+ be_visitor_amh_pre_proc,
+ "$Id$")
+
+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)
+{
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_amh_pre_proc::"
+ "visit_root - visit scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_amh_pre_proc::visit_module (be_module *node)
+{
+ if (!node->imported () && this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_amh_pre_proc::"
+ "visit_module - visit scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_amh_pre_proc::visit_interface (be_interface *node)
+{
+ // Do not generate AMH classes for any sort of implied IDL.
+ if (node->original_interface () != 0)
+ {
+ return 0;
+ }
+
+ // 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.
+
+ // (JP) Havinq AMH_* nodes inherit directly from AMH_* base classes
+ // is also a problem if the base interface is abstract, since at
+ // the moment, no AMH code is generated for such interfaces. It
+ // would be desirable to mimic the AMI design, where all AMI-related
+ // classes inherit from a single base class, no matter what the
+ // parentage of the IDL interface. Until we solve the problem of
+ // AMH for abstract interfaces, I'm disabling all AMH generation
+ // for interfaces having an abstract ancestor.
+ if (node->imported ()
+ || node->is_local ()
+ || node->is_abstract ()
+ || node->has_mixed_parentage ())
+ {
+ return 0;
+ }
+
+ // Create the exception holder, it needs to go before the response
+ // handler, because the response handler uses an exception holder as
+ // argument for some of its operations....
+ be_valuetype *excep_holder =
+ this->create_exception_holder (node);
+ excep_holder->set_defined_in (node->defined_in ());
+ excep_holder->original_interface (node);
+
+ AST_Module *module =
+ AST_Module::narrow_from_scope (node->defined_in ());
+ module->set_has_nested_valuetype ();
+
+ // Create the ResponseHandler class
+ be_interface *response_handler =
+ this->create_response_handler (node,
+ excep_holder);
+
+ if (response_handler == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_amh_pre_proc::"
+ "visit_interface - "
+ "creating the response handler failed\n"),
+ -1);
+ }
+ response_handler->set_defined_in (node->defined_in ());
+
+ // Insert the response handler after the node.
+ module->be_add_interface (response_handler,
+ node);
+
+ // Remember from whom we were cloned
+ response_handler->original_interface (node);
+
+ module->be_add_interface (excep_holder, node);
+
+ return 0;
+}
+
+be_interface *
+be_visitor_amh_pre_proc::create_response_handler (
+ be_interface *node,
+ be_valuetype *exception_holder
+ )
+{
+ // Generate 'AMH_InterfaceResponseHandler'
+ ACE_CString class_name;
+ class_name += "AMH_";
+ class_name += node->local_name ();
+ class_name += "ResponseHandler";
+
+ UTL_ScopedName *amh_name =
+ dynamic_cast<UTL_ScopedName*> (node->name ()->copy ());
+ Identifier *local_name = amh_name->last_component ();
+ local_name->replace_string (class_name.c_str ());
+
+ UTL_Scope *s = node->defined_in ();
+ idl_global->scopes ().push (s);
+
+ // @@ Mayur, you are not filling up the list of inherited classes,
+ // however, you *are* using that same list in the amh_rh_sh.cpp and
+ // amh_rh_sh.cpp file... you need to fill up the list, i.e. discover
+ // the inherited classes in the original interface, change their
+ // names and then use the symbol table to look up the
+ // AMH-response-handler nodes.
+ be_interface *response_handler = 0;
+ ACE_NEW_RETURN (response_handler,
+ be_interface (amh_name, // name
+ 0, // list of inherited
+ 0, // number of inherited
+ 0, // list of ancestors
+ 0, // number of ancestors
+ 1, // local
+ 0), // non-abstract
+ 0);
+
+ idl_global->scopes ().pop ();
+
+ response_handler->set_name (amh_name);
+ response_handler->set_defined_in (node->defined_in ());
+ response_handler->set_imported (node->imported ());
+ response_handler->set_line (node->line ());
+ response_handler->set_file_name (node->file_name ());
+ response_handler->gen_fwd_helper_name ();
+
+ this->add_rh_node_members (node, response_handler, exception_holder);
+
+ return response_handler;
+}
+
+int
+be_visitor_amh_pre_proc::add_rh_node_members ( be_interface *node,
+ be_interface *response_handler,
+ be_valuetype *exception_holder)
+{
+ // Now our customized valuetype is created, we have to
+ // add now the operations and attributes to the scope.
+
+ this->elem_number_ = 0;
+
+ // Initialize an iterator to iterate thru our scope.
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ AST_Decl *d = si.item ();
+
+ if (!d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_amh_pre_proc::"
+ "add_rh_node_members - "
+ "bad node in this scope\n"),
+ 0);
+ }
+
+ AST_Decl::NodeType nt = d->node_type ();
+ int status = 0;
+
+ if (nt == AST_Decl::NT_attr)
+ {
+ be_attribute *attr = be_attribute::narrow_from_decl (d);
+
+ if (attr != 0)
+ {
+ status =
+ this->create_response_handler_attribute (attr,
+ response_handler,
+ exception_holder);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_amh_pre_proc::"
+ "add_rh_node_members - "
+ "attribute creation failed\n"),
+ 0);
+ }
+ }
+ }
+ else if (nt == AST_Decl::NT_op)
+ {
+ be_operation* operation = be_operation::narrow_from_decl (d);
+
+ if (operation != 0)
+ {
+ status =
+ this->create_response_handler_operation (operation,
+ response_handler,
+ exception_holder);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_amh_pre_proc::"
+ "add_rh_node_members - "
+ "operation creation failed\n"),
+ 0);
+ }
+ }
+ }
+ else
+ {
+ continue;
+ }
+ }
+
+ return 1;
+}
+
+int
+be_visitor_amh_pre_proc::create_response_handler_operation (
+ be_operation *node,
+ be_interface *response_handler,
+ be_valuetype *exception_holder
+ )
+{
+ if (!node)
+ {
+ return -1;
+ }
+
+ if (this->add_normal_reply (node, response_handler) == -1)
+ {
+ return -1;
+ }
+
+ return this->add_exception_reply (node,
+ response_handler,
+ exception_holder);
+}
+
+int
+be_visitor_amh_pre_proc::create_response_handler_attribute (
+ be_attribute *node,
+ be_interface *response_handler,
+ be_valuetype *exception_holder
+ )
+{
+ // Temporarily generate the get operation.
+ be_operation *get_operation = this->generate_get_operation (node);
+
+ this->visit_operation (get_operation);
+
+ be_operation_default_strategy *default_strategy = 0;
+ ACE_NEW_RETURN (default_strategy,
+ be_operation_default_strategy (get_operation),
+ -1);
+
+ be_operation_strategy *get_operation_strategy =
+ get_operation->set_strategy (default_strategy);
+
+ if (0 != get_operation_strategy)
+ {
+ be_operation_strategy *gos =
+ node->set_get_strategy (get_operation_strategy);
+
+ if (0 != gos)
+ {
+ gos->destroy ();
+ delete gos;
+ gos = 0;
+ }
+ }
+
+ int status =
+ this->create_response_handler_operation (get_operation,
+ response_handler,
+ exception_holder);
+
+ get_operation->destroy ();
+ delete get_operation;
+ get_operation = 0;
+
+ if (status == -1)
+ {
+ return -1;
+ }
+
+ if (node->readonly ())
+ {
+ return 0;
+ }
+
+ // Temporarily generate the set operation.
+ be_operation *set_operation = this->generate_set_operation (node);
+
+ this->visit_operation (set_operation);
+
+ // Retrieve the strategy set by the visit operation.
+ ACE_NEW_RETURN (default_strategy,
+ be_operation_default_strategy (set_operation),
+ -1);
+
+ be_operation_strategy *set_operation_strategy =
+ set_operation->set_strategy (default_strategy);
+
+ // Assign it to the attribute as set_operation strategy.
+ if (0 != set_operation_strategy)
+ {
+ be_operation_strategy *sos =
+ node->set_set_strategy (set_operation_strategy);
+
+ if (0 != sos)
+ {
+ sos->destroy ();
+ delete sos;
+ sos = 0;
+ }
+ }
+
+ status =
+ this->create_response_handler_operation (set_operation,
+ response_handler,
+ exception_holder);
+
+ set_operation->destroy ();
+ delete set_operation;
+ set_operation = 0;
+
+ return status;
+}
+
+int
+be_visitor_amh_pre_proc::add_exception_reply (be_operation *node,
+ be_interface *response_handler,
+ be_valuetype *exception_holder)
+{
+ UTL_ScopedName *operation_name = node->compute_name ("",
+ "_excep");
+
+ be_operation *node_excep = 0;
+ ACE_NEW_RETURN (node_excep,
+ be_operation (be_global->void_type (),
+ AST_Operation::OP_noflags,
+ operation_name,
+ 1,
+ 0),
+ -1);
+
+ node_excep->set_name (operation_name);
+
+ Identifier *arg_id = 0;
+ ACE_NEW_RETURN (arg_id,
+ Identifier ("holder"),
+ -1);
+
+ UTL_ScopedName *arg_name = 0;
+ ACE_NEW_RETURN (arg_name,
+ UTL_ScopedName (arg_id, 0),
+ -1);
+
+ be_argument *argument = 0;
+ ACE_NEW_RETURN (argument,
+ be_argument (AST_Argument::dir_IN,
+ exception_holder,
+ arg_name),
+ -1);
+
+ argument->set_name (arg_name);
+ argument->set_defined_in (node_excep);
+ node_excep->be_add_argument (argument);
+
+ node_excep->set_defined_in (response_handler);
+
+ if (0 == response_handler->be_add_operation (node_excep))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_amh_pre_proc::add_normal_reply (be_operation *node,
+ be_interface *response_handler)
+{
+ Identifier *id = 0;
+ UTL_ScopedName *sn = 0;
+
+ ACE_CString original_op_name (
+ node->name ()->last_component ()->get_string ()
+ );
+
+ UTL_ScopedName *op_name =
+ static_cast<UTL_ScopedName *> (response_handler->name ()->copy ());
+
+ ACE_NEW_RETURN (id,
+ Identifier (original_op_name.c_str ()),
+ -1);
+
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (id,
+ 0),
+ -1);
+
+ op_name->nconc (sn);
+
+ // Create the operation
+ be_operation *operation = 0;
+ ACE_NEW_RETURN (operation,
+ be_operation (be_global->void_type (),
+ AST_Operation::OP_noflags,
+ op_name,
+ 1,
+ 0),
+ -1);
+
+ operation->set_name (op_name);
+
+ // If return type is non-void add it as first argument
+
+ if (!node->void_return_type ())
+ {
+ Identifier *arg_id = 0;
+ ACE_NEW_RETURN (arg_id,
+ Identifier ("return_value"),
+ -1);
+
+ UTL_ScopedName *arg_name = 0;
+ ACE_NEW_RETURN (arg_name,
+ UTL_ScopedName (arg_id, 0),
+ -1);
+
+ // Create the argument
+ be_argument *arg = 0;
+ ACE_NEW_RETURN (arg,
+ be_argument (AST_Argument::dir_IN,
+ node->return_type (),
+ arg_name),
+ -1);
+
+ arg->set_name (arg_name);
+
+ // Add the response handler to the argument list
+ operation->be_add_argument (arg);
+ }
+
+ // Iterate over the arguments and put all the out and inout arguments
+ // into the new method.
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ AST_Decl *d = si.item ();
+
+ if (!d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_amh_pre_proc::"
+ "add_normal_reply - "
+ "bad node in this scope\n"),
+ -1);
+
+ }
+
+ //be_decl *arg = be_decl::narrow_from_decl (d);
+ AST_Argument *original_arg = AST_Argument::narrow_from_decl (d);
+
+ if (original_arg->direction () == AST_Argument::dir_INOUT ||
+ original_arg->direction () == AST_Argument::dir_OUT)
+ {
+ // Create the argument
+ be_argument *arg = 0;
+ ACE_NEW_RETURN (arg,
+ be_argument (AST_Argument::dir_IN,
+ original_arg->field_type (),
+ original_arg->name ()),
+ -1);
+
+ operation->be_add_argument (arg);
+ }
+ }
+
+ operation->set_defined_in (response_handler);
+
+ // We do not copy the exceptions because the exceptions
+ // are delivered by the excep methods.
+
+ // After having generated the operation we insert it into the
+ // response handler interface.
+ if (0 == response_handler->be_add_operation (operation))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_amh_pre_proc::visit_operation (be_operation *node)
+{
+ // @@ Mayur, we do want to generate code for oneways! This is
+ // needed to support reliable oneways with the SYNC_WITH_TARGET
+ // policy.
+ // We do nothing for oneways!
+ if (node->flags () == AST_Operation::OP_oneway)
+ {
+ return 0;
+ }
+
+ // Set the proper strategy
+ be_operation_amh_strategy *strategy = 0;
+ ACE_NEW_RETURN (strategy,
+ be_operation_amh_strategy (node),
+ -1);
+
+ be_operation_strategy *old_strategy = node->set_strategy (strategy);
+
+ if (old_strategy)
+ {
+ old_strategy->destroy ();
+ delete old_strategy;
+ old_strategy = 0;
+ }
+
+ return 0;
+}
+
+be_valuetype *
+be_visitor_amh_pre_proc::create_exception_holder (be_interface *node)
+{
+ // AMH exception holders require both of these.
+ idl_global->valuetype_seen_ = true;
+
+ idl_global->valuefactory_seen_ = true;
+
+ const int inherit_count = 0;
+ AST_Interface **p_intf = 0;
+
+ UTL_ScopedName *excep_holder_name =
+ node->compute_name ("AMH_",
+ "ExceptionHolder");
+
+ UTL_Scope *s = node->defined_in ();
+ idl_global->scopes ().push (s);
+
+ be_valuetype *excep_holder = 0;
+ ACE_NEW_RETURN (excep_holder,
+ be_valuetype (excep_holder_name,
+ p_intf,
+ inherit_count,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0),
+ 0);
+
+ idl_global->scopes ().pop ();
+
+ excep_holder->set_name (excep_holder_name);
+ excep_holder->set_defined_in (node->defined_in ());
+ excep_holder->gen_fwd_helper_name ();
+
+ // Now our customized valuetype is created, we have to
+ // add now the operations and attributes to the scope.
+
+ // initialize an iterator to iterate thru our scope
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ AST_Decl *d = si.item ();
+
+ if (d == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_amh_pre_proc::"
+ "visit_interface - "
+ "bad node in this scope\n"),
+ 0);
+ }
+
+ be_decl *op = be_decl::narrow_from_decl (d);
+ AST_Decl::NodeType nt = d->node_type ();
+
+ if (nt == AST_Decl::NT_attr)
+ {
+ AST_Attribute *attribute = AST_Attribute::narrow_from_decl (d);
+
+ if (attribute == 0)
+ {
+ return 0;
+ }
+
+ this->create_raise_operation (op,
+ excep_holder,
+ GET_OPERATION);
+
+ if (!attribute->readonly ())
+ {
+ this->create_raise_operation (op,
+ excep_holder,
+ SET_OPERATION);
+ }
+ }
+ else if (nt == AST_Decl::NT_op)
+ {
+ this->create_raise_operation (op,
+ excep_holder,
+ NORMAL);
+ }
+ else
+ {
+ continue;
+ }
+ }
+
+ return excep_holder;
+}
+
+int
+be_visitor_amh_pre_proc::create_raise_operation (
+ be_decl *node,
+ be_valuetype *excep_holder,
+ Operation_Kind operation_kind
+ )
+{
+ Identifier *id = 0;
+ UTL_ScopedName *sn = 0;
+ be_operation *orig_op = 0;
+
+ if (operation_kind == NORMAL)
+ {
+ orig_op = be_operation::narrow_from_decl (node);
+ }
+
+ // Name the operation properly
+ UTL_ScopedName *op_name =
+ static_cast<UTL_ScopedName *> (excep_holder->name ()->copy ());
+
+ ACE_CString new_local_name ("raise_");
+
+ if (operation_kind == SET_OPERATION)
+ {
+ new_local_name += "set_";
+ }
+ else if (operation_kind == GET_OPERATION)
+ {
+ new_local_name += "get_";
+ }
+
+ new_local_name += node->name ()->last_component ()->get_string ();
+
+ ACE_NEW_RETURN (id,
+ Identifier (new_local_name.c_str ()),
+ -1);
+
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (id,
+ 0),
+ -1);
+
+ op_name->nconc (sn);
+
+ be_operation *operation = 0;
+ ACE_NEW_RETURN (operation,
+ be_operation (be_global->void_type (),
+ AST_Operation::OP_noflags,
+ op_name,
+ 0,
+ 0),
+ -1);
+
+ operation->set_name (op_name);
+ operation->set_defined_in (excep_holder);
+
+ if (operation_kind == NORMAL)
+ {
+ if (orig_op)
+ {
+ // Copy the exceptions.
+ UTL_ExceptList *exceptions = orig_op->exceptions ();
+
+ if (0 != exceptions)
+ {
+ operation->be_add_exceptions (exceptions->copy ());
+ }
+ }
+ }
+
+ // 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
+ );
+
+ be_operation_strategy *old_strategy =
+ operation->set_strategy (ehrs);
+
+ if (old_strategy)
+ {
+ old_strategy->destroy ();
+ delete old_strategy;
+ old_strategy = 0;
+ }
+
+ // After having generated the operation we insert it into the
+ // exceptionholder valuetype.
+ if (0 == excep_holder->be_add_operation (operation))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+
+int
+be_visitor_amh_pre_proc::generate_name (ACE_CString &destination,
+ const char *prefix,
+ const char *middle_name,
+ const char *suffix)
+{
+ destination = prefix;
+ destination += middle_name;
+ destination += suffix;
+ return 0;
+}
+
+
+
+be_operation *
+be_visitor_amh_pre_proc::generate_get_operation (be_attribute *node)
+{
+ ACE_CString original_op_name (
+ node->name ()->last_component ()->get_string ()
+ );
+ ACE_CString new_op_name = ACE_CString ("get_") + original_op_name;
+
+ UTL_ScopedName *get_name =
+ static_cast<UTL_ScopedName *> (node->name ()-> copy ());
+ get_name->last_component ()->replace_string (new_op_name.c_str ());
+
+ be_operation *operation = 0;
+ ACE_NEW_RETURN (operation,
+ be_operation (node->field_type (),
+ AST_Operation::OP_noflags,
+ get_name,
+ 1,
+ 0),
+ 0);
+
+ operation->set_name (get_name);
+ operation->set_defined_in (node->defined_in ());
+
+ return operation;
+}
+
+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 new_op_name = ACE_CString ("set_") + original_op_name;
+
+ UTL_ScopedName *set_op_name =
+ dynamic_cast<UTL_ScopedName *> (node->name ()-> copy ());
+ set_op_name->last_component ()->replace_string (new_op_name.c_str ());
+
+ // 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 (),
+ set_op_name),
+ 0);
+
+ arg->set_name (dynamic_cast<UTL_ScopedName *> (node->name ()->copy ()));
+
+ // create the operation
+ be_operation *operation = 0;
+ ACE_NEW_RETURN (operation,
+ be_operation (be_global->void_type (),
+ AST_Operation::OP_noflags,
+ set_op_name,
+ 0,
+ 0),
+ 0);
+
+ operation->set_name (set_op_name);
+ operation->set_defined_in (node->defined_in ());
+ 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
new file mode 100644
index 00000000000..36a98bc6df6
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp
@@ -0,0 +1,1258 @@
+//
+// $Id$
+//
+
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_ami_pre_proc.cpp
+//
+// = DESCRIPTION
+// This visitor creates for AMI implied IDL constructs
+// the appropriate AST (Abstract Syntax Tree) node,
+// sets the corresponding interface or operation strategy
+// on it and enteres the nodes into the AST.
+//
+// = AUTHOR
+// Michael Kircher <Michael.Kircher@mchp.siemens.de>
+//
+// ============================================================================
+
+#include "be_visitor_ami_pre_proc.h"
+#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 "be_global.h"
+#include "be_extern.h"
+#include "utl_identifier.h"
+#include "utl_exceptlist.h"
+#include "nr_extern.h"
+#include "global_extern.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (be,
+ be_visitor_ami_pre_proc,
+ "$Id$")
+
+
+be_visitor_ami_pre_proc::be_visitor_ami_pre_proc (be_visitor_context *ctx)
+ : be_visitor_scope (ctx)
+{
+
+}
+
+be_visitor_ami_pre_proc::~be_visitor_ami_pre_proc (void)
+{
+
+}
+
+int
+be_visitor_ami_pre_proc::visit_root (be_root *node)
+{
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ami_pre_proc::"
+ "visit_root - "
+ "visit scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ami_pre_proc::visit_module (be_module *node)
+{
+ // Skip this for now until we get AMI integrated with
+ // CIAO.
+ if (0 == ACE_OS::strcmp (node->local_name ()->get_string (), "Components"))
+ {
+ return 0;
+ }
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ami_pre_proc::"
+ "visit_module - "
+ "visit scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ami_pre_proc::visit_interface (be_interface *node)
+{
+ // We check for an imported node after generating the reply handler.
+ if (node->is_local () || node->is_abstract ())
+ {
+ return 0;
+ }
+
+ // The following 3 IF blocks are checks for CCM-related nodes, which
+ // we want to skip until we get AMI integrated with CIAO.
+
+ // Skip the *EventConsumer added for each eventtype.
+ if (node->is_event_consumer ())
+ {
+ return 0;
+ }
+
+ // Check for home equivalent interface. The lookup will find the
+ // home itself, which was declared first.
+ Identifier *node_lname = node->AST_Decl::local_name ();
+ AST_Decl *first_stored =
+ node->defined_in ()->lookup_by_name_local (node_lname, 0);
+
+ if (0 != first_stored && first_stored->node_type () == AST_Decl::NT_home)
+ {
+ return 0;
+ }
+
+ ACE_CString lname (node_lname->get_string ());
+
+ // Skip the *Explict and *Implicit interfaces added for a home.
+ if (lname.substr (lname.length () - 6) == "plicit")
+ {
+ UTL_Scope *s = node->defined_in ();
+ Identifier local_id (lname.substr (0, lname.length () - 8).c_str ());
+ AST_Decl *d = s->lookup_by_name_local (&local_id, 0);
+ local_id.destroy ();
+
+ if (0 != d)
+ {
+ return 0;
+ }
+ }
+
+ AST_Module *module =
+ AST_Module::narrow_from_scope (node->defined_in ());
+
+ 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 ());
+
+ // 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);
+
+ // If this was created for an imported node, it will be wrong
+ // unless we set it.
+ reply_handler->set_imported (node->imported ());
+ }
+ 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)
+ {
+ old_strategy->destroy ();
+ delete old_strategy;
+ old_strategy = 0;
+ }
+
+ 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;
+}
+
+int
+be_visitor_ami_pre_proc::visit_operation (be_operation *node)
+{
+ if (node->flags () == AST_Operation::OP_oneway)
+ {
+ // We do nothing for oneways!
+ return 0;
+ }
+
+ // If we're here, we're sure that the arg traits specialization
+ // for this will be needed.
+ be_global->messaging_exceptionholder ()->seen_in_operation (true);
+
+ be_operation *sendc_marshaling =
+ this->create_sendc_operation (node,
+ 0); // for arguments = FALSE
+
+ be_operation *sendc_arguments =
+ this->create_sendc_operation (node,
+ 1); // for arguments = TRUE
+
+ if (0 != sendc_marshaling && 0 != sendc_arguments)
+ {
+ sendc_marshaling->set_defined_in (node->defined_in ());
+
+ sendc_arguments->set_defined_in (node->defined_in ());
+
+ // We do not copy the exceptions because the exceptions
+ // are delivered by the excep methods.
+
+ // Set the proper strategy, and store the specialized
+ // marshaling and arguments operations in it.
+ be_operation_ami_sendc_strategy * boass = 0;
+ ACE_NEW_RETURN (boass,
+ be_operation_ami_sendc_strategy (node,
+ sendc_marshaling,
+ sendc_arguments),
+ -1);
+
+ be_operation_strategy *old_strategy = node->set_strategy (boass);
+
+ if (old_strategy)
+ {
+ old_strategy->destroy ();
+ delete old_strategy;
+ old_strategy = 0;
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ami_pre_proc::visit_attribute (be_attribute *node)
+{
+ // Temporerily generate the set operation.
+ be_operation *set_operation =
+ this->generate_set_operation (node);
+
+ this->visit_operation (set_operation);
+
+ // Retrieve the strategy set by the visit operation.
+ be_operation_default_strategy *bods = 0;
+ ACE_NEW_RETURN (bods,
+ be_operation_default_strategy (set_operation),
+ -1);
+
+ be_operation_strategy *set_operation_strategy =
+ set_operation->set_strategy (bods);
+
+ set_operation->destroy ();
+ delete set_operation;
+ set_operation = 0;
+
+ // Assign it to the attribute as set_operation strategy.
+ if (0 != set_operation_strategy)
+ {
+ be_operation_strategy *bos =
+ node->set_set_strategy (set_operation_strategy);
+
+ if (0 != bos)
+ {
+ bos->destroy ();
+ delete bos;
+ bos = 0;
+ }
+ }
+
+ // Temporerily generate the get operation.
+ be_operation *get_operation =
+ this->generate_get_operation (node);
+
+ this->visit_operation (get_operation);
+
+ // Retrieve the strategy set by the visit operation.
+ ACE_NEW_RETURN (bods,
+ be_operation_default_strategy (get_operation),
+ -1);
+
+ be_operation_strategy *get_operation_strategy =
+ get_operation->set_strategy (bods);
+
+ get_operation->destroy ();
+ delete get_operation;
+ get_operation = 0;
+
+ // Assign it to the attribute as get_operation strategy.
+ if (0 != get_operation_strategy)
+ {
+ be_operation_strategy *bos =
+ node->set_get_strategy (get_operation_strategy);
+
+ if (0 != bos)
+ {
+ bos->destroy ();
+ delete bos;
+ bos = 0;
+ }
+ }
+
+ return 0;
+}
+
+be_valuetype *
+be_visitor_ami_pre_proc::create_exception_holder (be_interface *)
+{
+ return be_global->messaging_exceptionholder ();
+}
+
+be_interface *
+be_visitor_ami_pre_proc::create_reply_handler (be_interface *node,
+ be_valuetype *excep_holder)
+{
+ // We're at global scope here so we need to fool the scope stack
+ // for a minute so the correct repo id can be calculated at
+ // interface construction time.
+ UTL_Scope *s = node->defined_in ();
+ idl_global->scopes ().push (s);
+
+ // Create the reply handler name.
+ ACE_CString reply_handler_local_name;
+ this->generate_name (reply_handler_local_name,
+ "AMI_",
+ node->name ()->last_component ()->get_string(),
+ "Handler");
+
+ UTL_ScopedName *reply_handler_name =
+ static_cast<UTL_ScopedName *> (node->name ()->copy ());
+ reply_handler_name->last_component ()->replace_string (
+ reply_handler_local_name.c_str ()
+ );
+
+ long n_parents = 0;
+ AST_Interface **p_intf = this->create_inheritance_list (node, n_parents);
+
+ be_interface *reply_handler = 0;
+ ACE_NEW_RETURN (reply_handler,
+ be_interface (reply_handler_name, // name
+ p_intf, // list of inherited
+ n_parents, // number of inherited
+ 0, // list of all ancestors
+ 0, // number of ancestors
+ 0, // non-local
+ 0), // non-abstract
+ 0);
+
+ // Back to reality.
+ idl_global->scopes ().pop ();
+
+ reply_handler->set_name (reply_handler_name);
+ reply_handler->set_defined_in (s);
+ reply_handler->gen_fwd_helper_name ();
+
+ // Now our customized reply handler is created, we have to
+ // add the operations and attributes to the scope.
+ // Imported nodes get admitted here, so they can get
+ // the reply handler operations added, in case they are
+ // needed in the inheritance graph traversal for a
+ // child reply handler. However, no exception holder
+ // stuff is executed for an imported node.
+ if (node->nmembers () > 0)
+ {
+ this->elem_number_ = 0;
+ // Initialize an iterator to iterate thru our scope.
+
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ AST_Decl *d = si.item ();
+
+ if (!d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ami_pre_proc::visit_interface - "
+ "bad node in this scope\n"),
+ 0);
+
+ }
+
+ if (d->node_type () == AST_Decl::NT_attr)
+ {
+ be_attribute *attribute = be_attribute::narrow_from_decl (d);
+
+ if (attribute == 0)
+ {
+ return 0;
+ }
+
+ be_operation *get_operation =
+ this->generate_get_operation (attribute);
+
+ this->create_reply_handler_operation (get_operation,
+ reply_handler);
+
+ this->create_excep_operation (get_operation,
+ reply_handler,
+ excep_holder);
+
+ get_operation->destroy ();
+ delete get_operation;
+ get_operation = 0;
+
+ if (!attribute->readonly ())
+ {
+ be_operation *set_operation =
+ this->generate_set_operation (attribute);
+
+ this->create_reply_handler_operation (set_operation,
+ reply_handler);
+
+ this->create_excep_operation (set_operation,
+ reply_handler,
+ excep_holder);
+
+ set_operation->destroy ();
+ delete set_operation;
+ set_operation = 0;
+ }
+ }
+ else
+ {
+ be_operation* operation = be_operation::narrow_from_decl (d);
+
+ if (operation)
+ {
+ this->create_reply_handler_operation (operation,
+ reply_handler);
+
+ this->create_excep_operation (operation,
+ reply_handler,
+ excep_holder);
+ }
+ }
+ } // end of while loop
+ } // end of if
+
+ return reply_handler;
+}
+
+int
+be_visitor_ami_pre_proc::create_raise_operation (
+ be_decl *node,
+ be_valuetype *excep_holder,
+ Operation_Kind operation_kind
+ )
+{
+ be_operation *orig_op = 0;
+
+ if (operation_kind == NORMAL)
+ {
+ orig_op = be_operation::narrow_from_decl (node);
+
+ if (orig_op)
+ {
+ if (orig_op->flags () == AST_Operation::OP_oneway)
+ {
+ // We do nothing for oneways!
+ return 0;
+ }
+ }
+ }
+
+ Identifier *id = 0;
+ UTL_ScopedName *sn = 0;
+
+ ACE_NEW_RETURN (id,
+ Identifier ("void"),
+ -1);
+
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (id,
+ 0),
+ -1);
+
+ // Create the return type, which is "void"
+ be_predefined_type *rt = 0;
+ ACE_NEW_RETURN (rt,
+ be_predefined_type (AST_PredefinedType::PT_void,
+ sn),
+ -1);
+
+ // Name the operation properly
+ UTL_ScopedName *op_name =
+ static_cast<UTL_ScopedName *> (excep_holder->name ()->copy ());
+
+ ACE_CString new_local_name ("raise_");
+
+ if (operation_kind == SET_OPERATION)
+ {
+ new_local_name += "set_";
+ }
+ else if (operation_kind == GET_OPERATION)
+ {
+ new_local_name += "get_";
+ }
+
+ new_local_name += node->name ()->last_component ()->get_string ();
+
+ ACE_NEW_RETURN (id,
+ Identifier (new_local_name.c_str ()),
+ -1);
+
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (id,
+ 0),
+ -1);
+
+ op_name->nconc (sn);
+
+ be_operation *operation = 0;
+ ACE_NEW_RETURN (operation,
+ be_operation (rt,
+ AST_Operation::OP_noflags,
+ op_name,
+ 0,
+ 0),
+ -1);
+
+ operation->set_name (op_name);
+ operation->set_defined_in (excep_holder);
+
+#if defined (TAO_HAS_DEPRECATED_EXCEPTION_HOLDER)
+ if (operation_kind == NORMAL)
+ {
+ if (orig_op)
+ {
+ // Copy the exceptions.
+ UTL_ExceptList *exceptions = orig_op->exceptions ();
+
+ if (0 != exceptions)
+ {
+ operation->be_add_exceptions (exceptions->copy ());
+ }
+ }
+ }
+#endif
+
+ // Set the proper strategy.
+ be_operation_ami_exception_holder_raise_strategy *boaehrs = 0;
+ ACE_NEW_RETURN (boaehrs,
+ be_operation_ami_exception_holder_raise_strategy (operation),
+ -1);
+
+ be_operation_strategy *old_strategy = operation->set_strategy (boaehrs);
+
+ if (old_strategy)
+ {
+ old_strategy->destroy ();
+ delete old_strategy;
+ old_strategy = 0;
+ }
+
+ // After having generated the operation we insert it into the
+ // exceptionholder valuetype.
+ if (0 == excep_holder->be_add_operation (operation))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+be_operation *
+be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node,
+ int for_arguments)
+{
+ if (node->flags () == AST_Operation::OP_oneway)
+ {
+ // We do nothing for oneways!
+ return 0;
+ }
+
+ Identifier *id = 0;
+ UTL_ScopedName *sn = 0;
+
+ // Create the new name
+ // Prepend "sendc_" to the name of the operation
+ ACE_CString original_op_name (
+ node->name ()->last_component ()->get_string ()
+ );
+ ACE_CString new_op_name = ACE_CString ("sendc_") + original_op_name;
+
+ UTL_ScopedName *op_name =
+ static_cast<UTL_ScopedName *> (node->name ()->copy ());
+ op_name->last_component ()->replace_string (new_op_name.c_str ());
+
+ // Create the operation
+ be_operation *op = 0;
+ ACE_NEW_RETURN (op,
+ be_operation (be_global->void_type (),
+ AST_Operation::OP_noflags,
+ op_name,
+ 0,
+ 0),
+ 0);
+
+ op->set_name (op_name);
+
+ // Create the first argument, which is a Reply Handler
+
+ if (for_arguments)
+ {
+ // Look up the field type.
+ UTL_Scope *s = node->defined_in ();
+ be_decl *parent = be_scope::narrow_from_scope (s)->decl ();
+
+ // Add the pre- and suffix
+ ACE_CString handler_local_name;
+ this->generate_name (handler_local_name,
+ "AMI_",
+ parent->name ()->last_component ()->get_string (),
+ "Handler");
+
+ UTL_ScopedName *field_name =
+ static_cast<UTL_ScopedName *> (parent->name ()->copy ());
+ field_name->last_component ()->replace_string (
+ handler_local_name.c_str ()
+ );
+
+ AST_Decl *d = s->lookup_by_name (field_name, true);
+ field_name->destroy ();
+ delete field_name;
+ field_name = 0;
+
+ if (0 == d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ami_pre_proc::"
+ "create_sendc_operation - "
+ "lookup of reply handler failed\n"),
+ 0);
+ }
+
+ be_interface *field_type = be_interface::narrow_from_decl (d);
+
+ // Create the argument.
+ ACE_NEW_RETURN (id,
+ Identifier ("ami_handler"),
+ 0);
+
+ UTL_ScopedName *tmp = 0;
+
+ ACE_NEW_RETURN (tmp,
+ UTL_ScopedName (id,
+ 0),
+ 0);
+
+ sn = (UTL_ScopedName *)op->name ()->copy ();
+ sn->nconc (tmp);
+
+ be_argument *arg = 0;
+ ACE_NEW_RETURN (arg,
+ be_argument (AST_Argument::dir_IN,
+ field_type, // is also a valuetype
+ sn),
+ 0);
+
+ arg->set_defined_in (op);
+ arg->set_name (sn);
+ op->be_add_argument (arg);
+
+ if (field_type->imported ())
+ {
+ field_type->seen_in_operation (false);
+ }
+ }
+
+ // Iterate over the arguments and put all the in and inout
+ // into the new method.
+ if (node->nmembers () > 0)
+ {
+ // initialize an iterator to iterate thru our scope
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ AST_Decl *d = si.item ();
+
+ if (!d)
+ {
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_ami_pre_proc::create_sendc_method - "
+ "bad node in this scope\n"
+ ),
+ 0
+ );
+
+ }
+
+ AST_Argument *original_arg = AST_Argument::narrow_from_decl (d);
+
+ if (original_arg->direction () == AST_Argument::dir_IN ||
+ original_arg->direction () == AST_Argument::dir_INOUT)
+ {
+ // Create the argument.
+ be_argument *arg = 0;
+ UTL_ScopedName *new_name =
+ (UTL_ScopedName *)original_arg->name ()->copy ();
+ ACE_NEW_RETURN (arg,
+ be_argument (AST_Argument::dir_IN,
+ original_arg->field_type (),
+ new_name),
+ 0);
+
+ arg->set_defined_in (op);
+ arg->set_name (new_name);
+ op->be_add_argument (arg);
+ }
+ } // end of while loop
+ } // end of if
+
+ return op;
+}
+
+int
+be_visitor_ami_pre_proc::create_reply_handler_operation (
+ be_operation *node,
+ be_interface *reply_handler
+ )
+{
+ if (!node)
+ {
+ return -1;
+ }
+
+ if (node->flags () == AST_Operation::OP_oneway)
+ {
+ // We do nothing for oneways!
+ return 0;
+ }
+
+ Identifier *id = 0;
+ UTL_ScopedName *sn = 0;
+
+ ACE_CString original_op_name (
+ node->name ()->last_component ()->get_string ()
+ );
+
+ UTL_ScopedName *op_name =
+ static_cast<UTL_ScopedName *> (reply_handler->name ()-> copy ());
+
+ ACE_NEW_RETURN (id,
+ Identifier (original_op_name.c_str ()),
+ -1);
+
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (id,
+ 0),
+ -1);
+
+ op_name->nconc (sn);
+
+ // Create the operation.
+ be_operation *operation = 0;
+ ACE_NEW_RETURN (operation,
+ be_operation (be_global->void_type (),
+ AST_Operation::OP_noflags,
+ op_name,
+ 0,
+ 0),
+ -1);
+
+ operation->set_name (op_name);
+
+ // If return type is non-void add it as first argument.
+
+ if (!node->void_return_type ())
+ {
+ ACE_NEW_RETURN (id,
+ Identifier ("ami_return_val"),
+ -1);
+
+ UTL_ScopedName *tmp = 0;
+
+ ACE_NEW_RETURN (tmp,
+ UTL_ScopedName (id,
+ 0),
+ -1);
+
+ sn = (UTL_ScopedName *)operation->name ()->copy ();
+ sn->nconc (tmp);
+
+ // Create the argument.
+ be_argument *arg = 0;
+ ACE_NEW_RETURN (arg,
+ be_argument (AST_Argument::dir_IN,
+ node->return_type (),
+ sn),
+ -1);
+
+ arg->set_defined_in (operation);
+ arg->set_name (sn);
+
+ // Add the reply handler to the argument list.
+ operation->be_add_argument (arg);
+ }
+
+ // Iterate over the arguments and put all the in and inout
+ // into the new method.
+ if (node->nmembers () > 0)
+ {
+ // Initialize an iterator to iterate thru our scope.
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ AST_Decl *d = si.item ();
+
+ if (d == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ami_pre_proc::"
+ "create_reply_handler_operation - "
+ "bad node in this scope\n"),
+ -1);
+
+ }
+
+ AST_Argument *original_arg = AST_Argument::narrow_from_decl (d);
+
+ if (original_arg->direction () == AST_Argument::dir_INOUT ||
+ original_arg->direction () == AST_Argument::dir_OUT)
+ {
+ // Create the argument.
+ be_argument *arg = 0;
+ UTL_ScopedName *new_name =
+ (UTL_ScopedName *)original_arg->name ()->copy ();
+ ACE_NEW_RETURN (arg,
+ be_argument (AST_Argument::dir_IN,
+ original_arg->field_type (),
+ new_name),
+ -1);
+
+ arg->set_defined_in (operation);
+ arg->set_name (new_name);
+ operation->be_add_argument (arg);
+ }
+ } // end of while loop
+ } // end of if
+
+ // Set the proper strategy.
+ be_operation_ami_handler_reply_stub_strategy *boahrss = 0;
+ ACE_NEW_RETURN (boahrss,
+ be_operation_ami_handler_reply_stub_strategy (operation),
+ -1);
+
+ be_operation_strategy *old_strategy = operation->set_strategy (boahrss);
+
+ if (old_strategy)
+ {
+ old_strategy->destroy ();
+ delete old_strategy;
+ old_strategy = 0;
+ }
+
+ operation->set_defined_in (reply_handler);
+
+#if !defined (TAO_HAS_DEPRECATED_EXCEPTION_HOLDER)
+ // Copy the exceptions.
+ if (node->exceptions ())
+ {
+ UTL_ExceptList *exceptions = node->exceptions ();
+
+ if (0 != exceptions)
+ {
+ operation->be_add_exceptions (exceptions->copy ());
+ }
+ }
+#endif
+
+ // After having generated the operation we insert it into the
+ // reply handler interface.
+ if (0 == reply_handler->be_add_operation (operation))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ami_pre_proc::create_excep_operation (be_operation *node,
+ be_interface *reply_handler,
+ be_valuetype *excep_holder)
+{
+ if (!node)
+ {
+ return -1;
+ }
+
+ if (node->flags () == AST_Operation::OP_oneway)
+ {
+ // We do nothing for oneways!
+ return 0;
+ }
+
+ // Create the return type, which is "void".
+ Identifier *id = 0;
+ UTL_ScopedName *sn = 0;
+
+ // Create the argument.
+ ACE_NEW_RETURN (id,
+ Identifier ("excep_holder"),
+ -1);
+
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (id,
+ 0),
+ -1);
+
+ be_argument *arg = 0;
+ ACE_NEW_RETURN (arg,
+ be_argument (AST_Argument::dir_IN,
+ excep_holder, // is also a valuetype
+ sn),
+ -1);
+
+ arg->set_name (sn);
+
+ UTL_ScopedName *tmp = (UTL_ScopedName *)sn->copy ();
+
+ // Create the new name
+ // Append _execp to the name of the operation
+ ACE_CString original_op_name (
+ node->name ()->last_component ()->get_string ()
+ );
+ ACE_CString new_op_name = original_op_name + ACE_CString ("_excep");
+
+ UTL_ScopedName *op_name =
+ static_cast<UTL_ScopedName *> (reply_handler->name ()->copy ());
+
+ ACE_NEW_RETURN (id,
+ Identifier (new_op_name.c_str ()),
+ -1);
+
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (id,
+ 0),
+ -1);
+
+ op_name->nconc (sn);
+
+ AST_PredefinedType *rt = be_global->void_type ();
+
+ // Create the operation.
+ be_operation *operation = 0;
+ ACE_NEW_RETURN (operation,
+ be_operation (rt,
+ AST_Operation::OP_noflags,
+ op_name,
+ 0,
+ 0),
+ -1);
+
+ operation->set_name (op_name);
+ operation->be_add_argument (arg);
+ operation->set_defined_in (reply_handler);
+
+ UTL_ScopedName *arg_name = (UTL_ScopedName *)op_name->copy ();
+ arg_name->nconc (tmp);
+ arg->set_name (arg_name);
+ arg->set_defined_in (operation);
+
+ // We do not copy the exceptions because the exceptions
+ // are delivered by the excep methods.
+
+ // After having generated the operation we insert it into the
+ // reply handler interface.
+ if (0 == reply_handler->be_add_operation (operation))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+// Visit the scope and its elements.
+int
+be_visitor_ami_pre_proc::visit_scope (be_scope *node)
+{
+ // proceed if the number of members in our scope is greater than 0
+ if (node->nmembers () > 0)
+ {
+ int number_of_elements = 0;
+
+ {
+ // initialize an iterator to iterate thru our scope
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ ++number_of_elements;
+ }
+ }
+
+ AST_Decl **elements;
+ ACE_NEW_RETURN (elements,
+ AST_Decl *[number_of_elements],
+ -1);
+
+ {
+ int position = 0;
+
+ // Initialize an iterator to iterate thru our scope.
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ elements[position++] = si.item ();
+ }
+ }
+
+ int elem_number = 0;
+
+ // Continue until each element is visited.
+ while (elem_number < number_of_elements)
+ {
+ AST_Decl *d = elements[elem_number];
+
+ if (!d)
+ {
+ delete [] elements;
+ elements = 0;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_scope::visit_scope - "
+ "bad node in this scope\n"),
+ -1);
+
+ }
+
+ be_decl *bd = be_decl::narrow_from_decl (d);
+
+ // 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.
+ this->ctx_->node (bd);
+ ++elem_number;
+
+
+ // Send the visitor.
+ if (bd == 0 || bd->accept (this) == -1)
+ {
+ delete [] elements;
+ elements = 0;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_scope::visit_scope - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+ } // end of while loop
+
+ delete [] elements;
+ elements = 0;
+ } // end of if
+
+ return 0;
+}
+
+// Helper methods
+
+int
+be_visitor_ami_pre_proc::generate_name (ACE_CString &destination,
+ const char *prefix,
+ const char *middle_name,
+ const char *suffix)
+{
+ destination = prefix;
+ destination += middle_name;
+ destination += suffix;
+ return 0;
+}
+
+be_operation *
+be_visitor_ami_pre_proc::generate_get_operation (be_attribute *node)
+{
+ ACE_CString original_op_name (
+ node->name ()->last_component ()->get_string ()
+ );
+ ACE_CString new_op_name = ACE_CString ("get_") + original_op_name;
+
+ UTL_ScopedName *get_name =
+ static_cast<UTL_ScopedName *> (node->name ()->copy ());
+ get_name->last_component ()->replace_string (new_op_name.c_str ());
+
+ be_operation *operation = 0;
+ ACE_NEW_RETURN (operation,
+ be_operation (node->field_type (),
+ AST_Operation::OP_noflags,
+ get_name,
+ 0,
+ 0),
+ 0);
+
+ operation->set_name (get_name);
+ operation->set_defined_in (node->defined_in ());
+
+ return operation;
+}
+
+be_operation *
+be_visitor_ami_pre_proc::generate_set_operation (be_attribute *node)
+{
+ 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 =
+ static_cast<UTL_ScopedName *> (node->name ()-> copy ());
+ set_name->last_component ()->replace_string (new_op_name.c_str ());
+
+ // 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 (),
+ set_name),
+ 0);
+
+ arg->set_name ((UTL_ScopedName *) node->name ()->copy ());
+
+ // Create the operation.
+ be_operation *operation = 0;
+ ACE_NEW_RETURN (operation,
+ be_operation (be_global->void_type (),
+ AST_Operation::OP_noflags,
+ set_name,
+ 0,
+ 0),
+ 0);
+
+ operation->set_name (set_name);
+ operation->set_defined_in (node->defined_in ());
+ operation->be_add_argument (arg);
+
+ return operation;
+}
+
+AST_Interface **
+be_visitor_ami_pre_proc::create_inheritance_list (be_interface *node,
+ long &n_rh_parents)
+{
+ AST_Interface **retval = 0;
+
+ long n_parents = node->n_inherits ();
+ AST_Interface **parents = node->inherits ();
+ AST_Interface *parent = 0;
+
+ for (long i = 0; i < n_parents; ++i)
+ {
+ parent = parents[i];
+
+ if (parent->is_abstract ())
+ {
+ continue;
+ }
+
+ ++n_rh_parents;
+ }
+
+ if (n_rh_parents == 0)
+ {
+ be_interface *inherit_intf = be_global->messaging_replyhandler ();
+
+ ACE_NEW_RETURN (retval,
+ AST_Interface *[1],
+ 0);
+
+ retval[0] = inherit_intf;
+ n_rh_parents = 1;
+ }
+ else
+ {
+ ACE_NEW_RETURN (retval,
+ AST_Interface *[n_rh_parents],
+ 0);
+
+ ACE_CString prefix ("AMI_");
+ ACE_CString suffix ("Handler");
+ long index = 0;
+
+ for (long j = 0; j < n_parents; ++j)
+ {
+ parent = parents[j];
+
+ if (parent->is_abstract ())
+ {
+ continue;
+ }
+
+ ACE_CString rh_local_name =
+ prefix + parent->local_name ()->get_string () + suffix;
+
+ UTL_ScopedName *rh_parent_name =
+ static_cast<UTL_ScopedName *> (parent->name ()->copy ());
+
+ rh_parent_name->last_component ()->replace_string (
+ rh_local_name.c_str ()
+ );
+
+ AST_Decl *d =
+ node->defined_in ()->lookup_by_name (rh_parent_name,
+ true);
+
+ if (d != 0)
+ {
+ retval[index++] = AST_Interface::narrow_from_decl (d);
+ }
+
+ rh_parent_name->destroy ();
+ delete rh_parent_name;
+ rh_parent_name = 0;
+ }
+
+ // Just a sanity check until we're sure this works in all use cases.
+ if (n_rh_parents != index)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "reply handler parent iteration mismatch\n"),
+ 0);
+ }
+ }
+
+ return retval;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp b/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp
new file mode 100644
index 00000000000..36f7a3cb20c
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp
@@ -0,0 +1,1165 @@
+//=============================================================================
+/**
+* @file be_visitor_arg_traits.cpp
+*
+* $Id$
+*
+* This visitor generates template specializations for argument traits classes.
+*
+* @author Jeff Parsons <j.parsons@vanderbilt.edu>
+*/
+//=============================================================================
+
+#include "be_visitor_arg_traits.h"
+#include "be_visitor_context.h"
+#include "be_root.h"
+#include "be_module.h"
+#include "be_interface.h"
+#include "be_valuebox.h"
+#include "be_valuetype.h"
+#include "be_interface_fwd.h"
+#include "be_valuetype_fwd.h"
+#include "be_component_fwd.h"
+#include "be_component.h"
+#include "be_home.h"
+#include "be_eventtype.h"
+#include "be_eventtype_fwd.h"
+#include "be_operation.h"
+#include "be_attribute.h"
+#include "be_argument.h"
+#include "be_array.h"
+#include "be_enum.h"
+#include "be_predefined_type.h"
+#include "be_sequence.h"
+#include "be_string.h"
+#include "be_structure.h"
+#include "be_field.h"
+#include "be_union.h"
+#include "be_union_branch.h"
+#include "be_typedef.h"
+#include "be_helper.h"
+#include "be_extern.h"
+#include "utl_identifier.h"
+#include "idl_defines.h"
+#include "ace/Log_Msg.h"
+
+#include <string>
+
+
+ACE_RCSID (be,
+ be_visitor_arg_traits,
+ "$Id$")
+
+be_visitor_arg_traits::be_visitor_arg_traits (const char *S,
+ be_visitor_context *ctx)
+ : be_visitor_scope (ctx),
+ S_ (ACE::strnew (S))
+{
+}
+
+be_visitor_arg_traits::~be_visitor_arg_traits (void)
+{
+ delete [] this->S_;
+}
+
+int
+be_visitor_arg_traits::visit_root (be_root *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl
+ << be_global->core_versioning_begin ();
+
+ *os << be_nl << be_nl
+ << "// Arg traits specializations." << be_nl
+ << "namespace TAO" << be_nl
+ << "{" << be_idt;
+
+ if (be_global->ami_call_back ())
+ {
+ int status =
+ this->visit_valuetype (be_global->messaging_exceptionholder ());
+
+ if (-1 == status)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_root - visit "
+ "Messaging::ExceptionHolder failed\n"),
+ -1);
+ }
+ }
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_root - visit scope failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl
+ << "}" << be_nl;
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_module (be_module *node)
+{
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_module - visit scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_interface (be_interface *node)
+{
+ if (this->generated (node))
+ {
+ return 0;
+ }
+
+ if (node->seen_in_operation ())
+ {
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ std::string guard_suffix =
+ std::string (this->S_) + std::string ("arg_traits");
+
+ // This should be generated even for imported nodes. The ifdef
+ // guard prevents multiple declarations.
+ os->gen_ifdef_macro (node->flat_name (), guard_suffix.c_str (), false);
+
+ *os << be_nl << be_nl
+ << "template<>" << be_nl
+ << "class "
+ << " " << this->S_ << "Arg_Traits<"
+ << node->name () << ">" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl
+ << "Object_" << this->S_ << "Arg_Traits_T<" << be_idt << be_idt_nl
+ << node->name () << "_ptr," << be_nl
+ << node->name () << "_var," << be_nl
+ << node->name () << "_out";
+
+ if (ACE_OS::strlen (this->S_) == 0)
+ {
+ *os << "," << be_nl
+ << "TAO::Objref_Traits<" << node->name () << ">";
+ }
+
+ *os << "," << be_nl << this->insert_policy() << " <"
+ << node->name () << "_ptr>" << be_uidt_nl
+ << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+
+ os->gen_endif ();
+ }
+
+ if (this->visit_scope (node) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_interface - visit scope failed\n"),
+ -1);
+ }
+
+ this->generated (node, true);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_interface_fwd (be_interface_fwd *node)
+{
+ // If a full definition with the same name in the same scope
+ // has been seen, then it will have gone through visit_interface()
+ // already.
+ if (this->generated (node))
+ {
+ return 0;
+ }
+
+ be_interface *fd =
+ be_interface::narrow_from_decl (node->full_definition ());
+
+ // The logic in visit_interface() should handle what gets generated
+ // and what doesn't.
+ if (this->visit_interface (fd) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_interface_fwd - code generation failed\n"),
+ -1);
+ }
+
+ this->generated (node, true);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_valuebox (be_valuebox *node)
+{
+ if (this->generated (node))
+ {
+ return 0;
+ }
+
+ if (node->seen_in_operation ())
+ {
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ os << be_nl << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ std::string guard_suffix =
+ std::string (this->S_) + std::string ("arg_traits");
+
+ // This should be generated even for imported nodes. The ifdef
+ // guard prevents multiple declarations.
+ os.gen_ifdef_macro (node->flat_name (), guard_suffix.c_str (), false);
+
+ os << be_nl << be_nl
+ << "template<>" << be_nl
+ << "class "
+ << this->S_ << "Arg_Traits<"
+ << node->name () << ">" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl
+ << "Object_" << this->S_ << "Arg_Traits_T<" << be_idt << be_idt_nl
+ << node->name () << " *," << be_nl
+ << node->name () << "_var," << be_nl
+ << node->name () << "_out";
+
+ // The SArgument classes don't need the traits parameter (yet?)
+ if (ACE_OS::strlen (this->S_) == 0)
+ {
+ os << "," << be_nl
+ << "TAO::Value_Traits<" << node->name () << ">";
+ }
+
+ os << "," << be_nl << this->insert_policy() << " <"
+ << node->name () << "*>" << be_uidt_nl
+ << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+
+ os.gen_endif ();
+ }
+
+ this->generated (node, true);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_valuetype (be_valuetype *node)
+{
+ if (this->generated (node))
+ {
+ return 0;
+ }
+
+ if (node->seen_in_operation ())
+ {
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ os << be_nl << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ std::string guard_suffix =
+ std::string (this->S_) + std::string ("arg_traits");
+
+ // This should be generated even for imported nodes. The ifdef
+ // guard prevents multiple declarations.
+ os.gen_ifdef_macro (node->flat_name (), guard_suffix.c_str (), false);
+
+ os << be_nl << be_nl
+ << "template<>" << be_nl
+ << "class "
+ << this->S_ << "Arg_Traits<"
+ << node->name () << ">" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl
+ << "Object_" << this->S_ << "Arg_Traits_T<" << be_idt << be_idt_nl
+ << node->name () << " *," << be_nl
+ << node->name () << "_var," << be_nl
+ << node->name () << "_out";
+
+ // The SArgument classes don't need the traits parameter (yet?)
+ if (ACE_OS::strlen (this->S_) == 0)
+ {
+ os << "," << be_nl
+ << "TAO::Value_Traits<" << node->name () << ">";
+ }
+
+ os << "," << be_nl << this->insert_policy() << " <"
+ << node->name () << "*>" << be_uidt_nl
+ << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+
+ os.gen_endif ();
+ }
+
+ if (this->visit_scope (node) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_valuetype - visit scope failed\n"),
+ -1);
+ }
+
+ this->generated (node, true);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ if (this->generated (node))
+ {
+ return 0;
+ }
+
+ be_valuetype *fd =
+ be_valuetype::narrow_from_decl (node->full_definition ());
+
+ // The logic in visit_valuetype() should handle what gets generated
+ // and what doesn't.
+ int status = this->visit_valuetype (fd);
+
+ if (status != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_valuetype_fwd - code generation failed\n"),
+ -1);
+ }
+
+ this->generated (node, true);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_arg_traits::visit_eventtype_fwd (be_eventtype_fwd *node)
+{
+ return this->visit_valuetype_fwd (node);
+}
+
+int
+be_visitor_arg_traits::visit_operation (be_operation *node)
+{
+ if (this->generated (node) || node->is_local () || node->imported ())
+ {
+ return 0;
+ }
+
+ AST_Type *rt = node->return_type ();
+ AST_Decl::NodeType nt = rt->node_type ();
+
+ // If our return type is an unaliased bounded (w)string, we create
+ // an empty struct using the operation's flat name for the type,
+ // and use this type as the Arg_Traits<> template parameter. All
+ // this is necessary because there could be any number of such
+ // return types, all identical, in the same interface, valuetype,
+ // translation unit, or build, and we need a unique type for the
+ // Arg_Traits<> template parameter.
+ if (nt == AST_Decl::NT_string || nt == AST_Decl::NT_wstring)
+ {
+ AST_String *str = AST_String::narrow_from_decl (rt);
+ unsigned long bound = str->max_size ()->ev ()->u.ulval;
+
+ if (bound > 0)
+ {
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ bool wide = (str->width () != 1);
+
+ *os << be_nl << be_nl;
+
+ bool const skel =
+ (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_SS);
+
+ // Avoid generating a duplicate structure in the skeleton
+ // when generating Arg_Traits<> for ThruPOA and direct
+ // collocation code.
+ if (!skel
+ || (skel && ACE_OS::strlen (this->S_) != 0))
+ {
+ *os << "struct " << node->flat_name () << " {};"
+ << be_nl << be_nl;
+ }
+
+ *os << "template<>" << be_nl
+ << "class "
+ << this->S_ << "Arg_Traits<"
+ << node->flat_name ()
+ << ">" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl
+ << "BD_String_" << this->S_ << "Arg_Traits_T<" << be_nl
+ << "CORBA::" << (wide ? "W" : "") << "String_var," << be_nl
+ << bound << "," << be_nl
+ << this->insert_policy() << " <" << be_idt_nl
+ << "ACE_OutputCDR::from_" << (wide ? "w" : "") << "string" << be_uidt_nl
+ << ">"
+ << be_uidt_nl
+ << ">"
+ << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+ }
+ }
+
+ // This will catch (in visit_argument() below) any parameters that
+ // are unaliased, bounded (w)strings.
+ if (this->visit_scope (node) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_operation - visit scope failed\n"),
+ -1);
+ }
+
+ this->generated (node, true);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_attribute (be_attribute *node)
+{
+ if (this->ctx_->alias () != 0 || this->generated (node))
+ {
+ return 0;
+ }
+
+ AST_String *st = AST_String::narrow_from_decl (node->field_type ());
+
+ if (st == 0)
+ {
+ return 0;
+ }
+
+ unsigned long bound = st->max_size ()->ev ()->u.ulval;
+
+ if (bound == 0)
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ bool wide = (st->width () != 1);
+
+ // It is legal IDL to declare a bounded (w)string as an operation
+ // parameter type. There could be any number of identical
+ // declarations in the same build, translation unit, or even in
+ // the same operation, so we use the argument's flat name to
+ // declare an empty struct, and use that struct as the template
+ // parameter for Arg_Traits<>.
+
+ *os << be_nl;
+
+ bool const skel =
+ (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_SS);
+
+ // Avoid generating a duplicate structure in the skeleton when
+ // generating Arg_Traits<> for ThruPOA and direct collocation code.
+ if (!skel
+ || (skel && ACE_OS::strlen (this->S_) != 0))
+ {
+ *os << "struct " << node->flat_name () << " {};"
+ << be_nl << be_nl;
+ }
+
+ *os << "template<>" << be_nl
+ << "class "
+ << this->S_ << "Arg_Traits<"
+ << node->flat_name ()
+ << ">" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl
+ << "BD_String_" << this->S_ << "Arg_Traits_T<" << be_nl
+ << "CORBA::" << (wide ? "W" : "") << "String_var," << be_nl
+ << bound << "," << be_nl
+ << this->insert_policy() << " <" << be_idt_nl
+ << "ACE_OutputCDR::from_" << (wide ? "w" : "") << "string" << be_uidt_nl
+ << ">"
+ << be_uidt_nl
+ << ">"
+ << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+
+ this->generated (node, true);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_argument (be_argument *node)
+{
+ if (this->ctx_->alias () != 0 || this->generated (node))
+ {
+ return 0;
+ }
+
+ AST_Type *bt = node->field_type ();
+ AST_Decl::NodeType nt = bt->node_type ();
+
+ // We are interested here only in unaliased, bounded
+ // (w)strings.
+
+ if (nt != AST_Decl::NT_string && nt != AST_Decl::NT_wstring)
+ {
+ return 0;
+ }
+
+ be_string *st = be_string::narrow_from_decl (bt);
+ unsigned long bound = st->max_size ()->ev ()->u.ulval;
+
+ if (bound == 0)
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ bool wide = (st->width () != 1);
+
+ // It is legal IDL to declare a bounded (w)string as an operation
+ // parameter type. There could be any number of identical
+ // declarations in the same build, translation unit, or even in
+ // the same operation, so we use the argument's flat name to
+ // declare an empty struct, and use that struct as the template
+ // parameter for Arg_Traits<>.
+ *os << be_nl << be_nl;
+
+ bool const skel =
+ (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_SS);
+
+ // Avoid generating a duplicate structure in the skeleton when
+ // generating Arg_Traits<> for ThruPOA and direct collocation code.
+ if (!skel
+ || (skel && ACE_OS::strlen (this->S_) != 0))
+ {
+ *os << "struct " << node->flat_name () << " {};"
+ << be_nl << be_nl;
+ }
+
+ *os << "template<>" << be_nl
+ << "class "
+ << this->S_ << "Arg_Traits<"
+ << node->flat_name ()
+ << ">" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl
+ << "BD_String_" << this->S_ << "Arg_Traits_T<" << be_nl
+ << "CORBA::" << (wide ? "W" : "") << "String_var," << be_nl
+ << bound << "," << be_nl
+ << this->insert_policy() << " <" << be_idt_nl
+ << "ACE_OutputCDR::from_" << (wide ? "w" : "") << "string" << be_uidt_nl
+ << ">"
+ << be_uidt_nl
+ << ">"
+ << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+
+ this->generated (node, true);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_sequence (be_sequence *node)
+{
+ if (this->generated (node) || !node->seen_in_operation ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_typedef *alias = this->ctx_->alias ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ std::string guard_suffix =
+ std::string (this->S_) + std::string ("arg_traits");
+
+ // This should be generated even for imported nodes. The ifdef
+ // guard prevents multiple declarations.
+ os->gen_ifdef_macro (alias->flat_name (), guard_suffix.c_str (), false);
+
+ *os << be_nl << be_nl
+ << "template<>" << be_nl
+ << "class "
+ << this->S_ << "Arg_Traits<"
+ << alias->name () << ">" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl
+ << "Var_Size_" << this->S_ << "Arg_Traits_T<" << be_idt << be_idt_nl
+ << alias->name () << "," << be_nl
+ << this->insert_policy() << " <" << alias->name () << ">" << be_uidt_nl
+ << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+
+ os->gen_endif ();
+
+ this->generated (node, true);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_string (be_string *node)
+{
+ if ((this->generated (node) && !this->ctx_->alias())
+ || !node->seen_in_operation ())
+ {
+ return 0;
+ }
+
+ unsigned long bound = node->max_size ()->ev ()->u.ulval;
+ be_type *alias = this->ctx_->alias ();
+
+ // Unbounded (w)string args are handled as a predefined type.
+ // Bounded (w)strings must come in as a typedef - they can't
+ // be used directly as arguments or return types.
+ if (bound == 0)
+ {
+ return 0;
+ }
+
+ bool wide = (node->width () != 1);
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ std::string guard_suffix =
+ std::string (this->S_) + std::string ("arg_traits");
+
+ // This should be generated even for imported nodes. The ifdef
+ // guard prevents multiple declarations.
+
+ if (alias == 0)
+ {
+ os->gen_ifdef_macro (node->flat_name(), guard_suffix.c_str (), false);
+ }
+ else
+ {
+ // Form a unique macro name using the local name and the bound.
+ unsigned long l = bound;
+ int num_digits = 0;
+ while (l > 0)
+ {
+ l /= 10 ;
+ ++num_digits ;
+ }
+ size_t bound_length = num_digits + 1;
+ char* bound_string = 0;
+ ACE_NEW_RETURN (bound_string, char[bound_length], -1) ;
+ ACE_OS::sprintf (bound_string, "%lu", bound);
+
+ size_t cat_length = ACE_OS::strlen (alias->local_name ()->get_string ()) +
+ ACE_OS::strlen (bound_string) +
+ 1;
+ char* cat_string = 0;
+ ACE_NEW_RETURN (cat_string, char[cat_length], -1) ;
+ ACE_OS::strcpy (cat_string, alias->local_name ()->get_string ()) ;
+ ACE_OS::strcat (cat_string, bound_string);
+
+ os->gen_ifdef_macro (cat_string, guard_suffix.c_str (), false);
+
+ delete [] cat_string;
+ delete [] bound_string;
+ }
+
+ bool const skel =
+ (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_SS);
+
+ // Avoid generating a duplicate structure in the skeleton when
+ // generating Arg_Traits<> for ThruPOA and direct collocation code.
+ if (!skel
+ || (skel && ACE_OS::strlen (this->S_) != 0))
+ {
+ // A workaround 'dummy' type, since bounded (w)strings are all
+ // generated as typedefs of (w)char *.
+ *os << be_nl << be_nl
+ << "struct ";
+
+ if (alias == 0)
+ {
+ *os << node->flat_name ();
+ }
+ else
+ {
+ *os << alias->local_name () << "_" << bound;
+ }
+
+ *os << " {};";
+ }
+
+ *os << be_nl << be_nl
+ << "template<>" << be_nl
+ << "class "
+ << this->S_ << "Arg_Traits<";
+
+ if (0 == alias)
+ {
+ *os << node->flat_name ();
+ }
+ else
+ {
+ *os << alias->local_name () << "_" << bound;
+ }
+
+ *os << ">" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl
+ << "BD_String_" << this->S_ << "Arg_Traits_T<"
+ << be_idt << be_idt_nl
+ << "CORBA::" << (wide ? "W" : "") << "String_var," << be_nl
+ << bound << "," << be_nl
+ << this->insert_policy() << " <" << be_idt << be_idt_nl
+ << "ACE_OutputCDR::from_" << (wide ? "w" : "") << "string" << be_uidt_nl
+ << ">"
+ << be_uidt << be_uidt_nl
+ << ">"
+ << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+
+ os->gen_endif ();
+
+ this->generated (node, true);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_array (be_array *node)
+{
+ if (this->generated (node) || !node->seen_in_operation ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // This should be generated even for imported nodes. The ifdef guard prevents
+ // multiple declarations.
+ ACE_CString suffix (this->S_);
+ suffix += "arg_traits";
+ os->gen_ifdef_macro (node->flat_name (), suffix.c_str (), false);
+
+ *os << be_nl << be_nl
+ << "template<>" << be_nl
+ << "class "
+ << this->S_ << "Arg_Traits<"
+ << node->name () << "_tag>" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl;
+
+ *os << (node->size_type () == AST_Type::FIXED ? "Fixed" : "Var")
+ << "_Array_" << this->S_ << "Arg_Traits_T<" << be_idt << be_idt_nl
+ << node->name ()
+ << (node->size_type () == AST_Type::VARIABLE ? "_out" : "_var")
+ << "," << be_nl;
+
+ *os << node->name () << "_forany";
+
+ *os << "," << be_nl << this->insert_policy() << " <" << node->name () << "_forany" << ">";
+
+ *os << be_uidt_nl
+ << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+
+ os->gen_endif ();
+
+ this->generated (node, true);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_enum (be_enum *node)
+{
+ if (this->generated (node) || !node->seen_in_operation ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ std::string guard_suffix =
+ std::string (this->S_) + std::string ("arg_traits");
+
+ // This should be generated even for imported nodes. The ifdef
+ // guard prevents multiple declarations.
+ os->gen_ifdef_macro (node->flat_name (), guard_suffix.c_str (), false);
+
+ *os << be_nl << be_nl
+ << "template<>" << be_nl
+ << "class "
+ << this->S_ << "Arg_Traits<"
+ << node->name () << ">" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl;
+
+ *os << "Basic_" << this->S_ << "Arg_Traits_T<" << be_idt << be_idt_nl
+ << node->name () << "," << be_nl
+ << this->insert_policy() << " <" << node->name () << ">" << be_uidt_nl
+ << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+
+ os->gen_endif ();
+
+ this->generated (node, true);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_structure (be_structure *node)
+{
+ if (this->generated (node) || !node->seen_in_operation ())
+ {
+ return 0;
+ }
+
+ // This should be generated even for imported nodes. The ifdef guard prevents
+ // multiple declarations.
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ std::string guard_suffix =
+ std::string (this->S_) + std::string ("arg_traits");
+
+ // This should be generated even for imported nodes. The ifdef
+ // guard prevents multiple declarations.
+ os->gen_ifdef_macro (node->flat_name (), guard_suffix.c_str (), false);
+
+ *os << be_nl << be_nl
+ << "template<>" << be_nl
+ << "class "
+ << this->S_ << "Arg_Traits<"
+ << node->name () << ">" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl;
+
+ *os << (node->size_type () == AST_Type::FIXED ? "Fixed" : "Var")
+ << "_Size_" << this->S_ << "Arg_Traits_T<" << be_idt << be_idt_nl;
+
+ *os << node->name () << "," << be_nl << this->insert_policy() << " <" << node->name () << ">" << be_uidt_nl
+ << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+
+ os->gen_endif ();
+
+ /* Set this before visiting the scope so things like
+
+ interface foo
+ {
+ struct bar
+ {
+ ....
+ foo foo_member;
+ };
+
+ void op (in bar inarg);
+ };
+
+ will not cause infinite recursion in this visitor.
+ */
+
+ this->generated (node, true);
+
+ if (this->visit_scope (node) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_structure - visit scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_arg_traits::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_arg_traits::"
+ "visit_field - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ // Valuetypes may not be *declared* in a field, so this will
+ // get handled elsewhere, and will also avoid nested valuetype
+ // recursion. So we set the field node as processed (the
+ // field *type* may not have been reached yet) and return.
+ if (bt->base_node_type () == AST_Decl::NT_valuetype)
+ {
+ node->cli_traits_gen (true);
+ return 0;
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_field - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ this->generated (node, true);
+ this->generated (bt, true);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_union (be_union *node)
+{
+ if (this->generated (node) || !node->seen_in_operation ())
+ {
+ return 0;
+ }
+
+ // This should be generated even for imported nodes. The ifdef guard prevents
+ // multiple declarations.
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ std::string guard_suffix =
+ std::string (this->S_) + std::string ("arg_traits");
+
+ // This should be generated even for imported nodes. The ifdef
+ // guard prevents multiple declarations.
+ os->gen_ifdef_macro (node->flat_name (), guard_suffix.c_str (), false);
+
+ *os << be_nl << be_nl
+ << "template<>" << be_nl
+ << "class "
+ << this->S_ << "Arg_Traits<"
+ << node->name () << ">" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl;
+
+ *os << (node->size_type () == AST_Type::FIXED ? "Fixed" : "Var")
+ << "_Size_" << this->S_ << "Arg_Traits_T<" << be_idt << be_idt_nl
+ << node->name () << "," << be_nl << this->insert_policy() << " <"
+ << node->name () << ">";
+
+ *os << be_uidt_nl
+ << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+
+ os->gen_endif ();
+
+ /* Set this before visiting the scope so things like
+
+ interface foo
+ {
+ struct bar
+ {
+ ....
+ foo foo_member;
+ };
+
+ void op (in bar inarg);
+ };
+
+ will not cause infinite recursion in this visitor.
+ */
+
+ this->generated (node, true);
+
+ int status = this->visit_scope (node);
+
+ if (status != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_union - visit scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_arg_traits::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_arg_traits::"
+ "visit_union_branch - "
+ "Bad union_branch type\n"),
+ -1);
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_union_branch - "
+ "codegen for union_branch type failed\n"),
+ -1);
+ }
+
+ this->generated (node, true);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_typedef (be_typedef *node)
+{
+ if (this->generated (node) || !node->seen_in_operation ())
+ {
+ return 0;
+ }
+
+ this->ctx_->alias (node);
+
+ // Make a decision based on the primitive base type.
+ be_type *bt = node->primitive_base_type ();
+
+ // We can't set seen_in_operation_ for the base type
+ // in the be_typedef operation, since valuetype OBV
+ // constructor code may reset it to FALSE, and the base
+ // type may be used unaliased in another arg somewhere.
+ // So we just set it to TRUE here, since we know it
+ // has to be TRUE at this point. We also set the
+ // 'generated' flag to false if the original value
+ // of 'seen_in_operation' was false, since the base
+ // type could have been processed already, as a member
+ // for example, before the typedef was seen, which
+ // would short-circuit things.
+ if (!bt->seen_in_operation ())
+ {
+ bt->seen_in_operation (true);
+ this->generated (bt, false);
+ }
+
+ if (!bt || (bt->accept (this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ this->generated (node, true);
+ return 0;
+}
+
+bool
+be_visitor_arg_traits::generated (be_decl *node) const
+{
+ if (ACE_OS::strcmp (this->S_, "") == 0)
+ {
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CS:
+ return node->cli_arg_traits_gen ();
+ case TAO_CodeGen::TAO_ROOT_SS:
+ return node->srv_arg_traits_gen ();
+ default:
+ return 0;
+ }
+ }
+
+ return node->srv_sarg_traits_gen ();
+}
+
+void
+be_visitor_arg_traits::generated (be_decl *node,
+ bool val)
+{
+ if (ACE_OS::strcmp (this->S_, "") == 0)
+ {
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CS:
+ node->cli_arg_traits_gen (val);
+ return;
+ case TAO_CodeGen::TAO_ROOT_SS:
+ node->srv_arg_traits_gen (val);
+ return;
+ default:
+ return;
+ }
+ }
+
+ node->srv_sarg_traits_gen (val);
+}
+
+int
+be_visitor_arg_traits::visit_component (be_component *node)
+{
+ return this->visit_interface (node);
+}
+
+int
+be_visitor_arg_traits::visit_component_fwd (be_component_fwd *node)
+{
+ return this->visit_interface_fwd (node);
+}
+
+int
+be_visitor_arg_traits::visit_home (be_home *node)
+{
+ return this->visit_interface (node);
+}
+
+const char *
+be_visitor_arg_traits::insert_policy (void)
+{
+ if (be_global->any_support ())
+ {
+ return "TAO::Any_Insert_Policy_Stream";
+ }
+ else
+ {
+ return "TAO::Any_Insert_Policy_Noop";
+ }
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_argument.cpp b/TAO/TAO_IDL/be/be_visitor_argument.cpp
new file mode 100644
index 00000000000..1024f14f6bd
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_argument.cpp
@@ -0,0 +1,61 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_args.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Argument
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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_component.h"
+#include "be_component_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_valuebox.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_eventtype.h"
+#include "be_eventtype_fwd.h"
+#include "be_home.h"
+#include "be_operation.h"
+#include "be_helper.h"
+#include "utl_identifier.h"
+#include "nr_extern.h"
+#include "ace/Log_Msg.h"
+
+#include "be_visitor_argument/arglist.cpp"
+#include "be_visitor_argument/argument.cpp"
+#include "be_visitor_argument/marshal_ss.cpp"
+#include "be_visitor_argument/post_upcall_ss.cpp"
+#include "be_visitor_argument/upcall_ss.cpp"
+#include "be_visitor_argument/vardecl_ss.cpp"
+#include "be_visitor_argument/invoke_cs.cpp"
+#include "be_visitor_argument/paramlist.cpp"
+
+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
new file mode 100644
index 00000000000..97293ddf2a3
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp
@@ -0,0 +1,455 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// arglist.cpp
+//
+// = DESCRIPTION
+// Visitor that generates the parameters in an Operation signature
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_argument,
+ arglist,
+ "$Id$")
+
+
+// ************************************************************
+// be_visitor_args_arglist for parameter list in method declarations and
+// definitions
+// ************************************************************
+
+be_visitor_args_arglist::be_visitor_args_arglist (be_visitor_context *ctx)
+ : be_visitor_args (ctx)
+{
+}
+
+be_visitor_args_arglist::~be_visitor_args_arglist (void)
+{
+}
+
+int be_visitor_args_arglist::visit_argument (be_argument *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ // Retrieve the type.
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_arglist::"
+ "visit_argument - "
+ "Bad argument type\n"),
+ -1);
+ }
+
+ // Different types have different mappings when used as in/out or
+ // inout parameters. Let this visitor deal with the type.
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_arglist::"
+ "visit_argument - "
+ "cannot accept visitor\n"),
+ -1);
+ }
+
+ *os << " " << node->local_name ();
+ return 0;
+}
+
+int be_visitor_args_arglist::visit_array (be_array *node)
+{
+ TAO_OutStream *os = this->ctx_->stream (); // get output stream
+
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "const " << this->type_name (node);
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << this->type_name (node);
+ break;
+ case AST_Argument::dir_OUT:
+ *os << this->type_name (node, "_out");
+ break;
+ }
+
+ return 0;
+}
+
+int be_visitor_args_arglist::visit_enum (be_enum *node)
+{
+ TAO_OutStream *os = this->ctx_->stream (); // get output stream
+
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << this->type_name (node);
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << this->type_name (node) << " &";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << this->type_name (node, "_out");
+ break;
+ }
+
+ return 0;
+}
+
+int be_visitor_args_arglist::visit_interface (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream (); // get output stream
+
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << this->type_name (node, "_ptr");
+ break;
+ case AST_Argument::dir_INOUT: // inout
+ *os << this->type_name (node, "_ptr") << " &";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << this->type_name (node, "_out");
+ break;
+ }
+
+ return 0;
+}
+
+int be_visitor_args_arglist::visit_interface_fwd (be_interface_fwd *node)
+{
+ TAO_OutStream *os = this->ctx_->stream (); // get output stream
+
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << this->type_name (node, "_ptr");
+ break;
+ case AST_Argument::dir_INOUT: // inout
+ *os << this->type_name (node, "_ptr") << " &";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << this->type_name (node, "_out");
+ break;
+ }
+
+ return 0;
+}
+
+int be_visitor_args_arglist::visit_component (be_component *node)
+{
+ return this->visit_interface (node);
+}
+
+int be_visitor_args_arglist::visit_component_fwd (be_component_fwd *node)
+{
+ return this->visit_interface_fwd (node);
+}
+
+int be_visitor_args_arglist::visit_native (be_native *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << this->type_name (node);
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << this->type_name (node) << " &";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << this->type_name (node) << " &";
+ break;
+ }
+
+ return 0;
+}
+
+int be_visitor_args_arglist::visit_predefined_type (be_predefined_type *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ AST_PredefinedType::PredefinedType pt = node->pt ();
+
+ if (pt == AST_PredefinedType::PT_any)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "const " << this->type_name (node) << " &";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << this->type_name (node) << " &";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << this->type_name (node, "_out");
+ break;
+ }
+ }
+ else if (pt == AST_PredefinedType::PT_value)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << this->type_name (node) << " *";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << this->type_name (node) << " *&";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << this->type_name (node, "_out");
+ break;
+ }
+ }
+ else if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ // The only PT_pseudo that doesn't take a _ptr suffix.
+ bool is_tckind =
+ (ACE_OS::strcmp (node->local_name ()->get_string (), "TCKind") == 0);
+
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ if (is_tckind)
+ {
+ *os << this->type_name (node);
+ }
+ else
+ {
+ *os << this->type_name (node, "_ptr");
+ }
+
+ break;
+ case AST_Argument::dir_INOUT:
+ if (is_tckind)
+ {
+ *os << this->type_name (node) << " &";
+ }
+ else
+ {
+ *os << this->type_name (node, "_ptr") << " &";
+ }
+
+ break;
+ case AST_Argument::dir_OUT:
+ *os << this->type_name (node, "_out");
+ break;
+ }
+ }
+ else
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << this->type_name (node);
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << this->type_name (node) << " &";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << this->type_name (node, "_out");
+ break;
+ }
+ }
+
+ return 0;
+}
+
+int be_visitor_args_arglist::visit_sequence (be_sequence *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "const " << this->type_name (node) << " &";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << this->type_name (node) << " &";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << this->type_name (node, "_out");
+ break;
+ }
+
+ return 0;
+}
+
+int be_visitor_args_arglist::visit_string (be_string *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (node->width () == (long) sizeof (char))
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "const char *";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << "char *&";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << "::CORBA::String_out";
+ break;
+ }
+ }
+ else
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "const ::CORBA::WChar *";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << "::CORBA::WChar *&";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << "::CORBA::WString_out";
+ break;
+ }
+ }
+
+ return 0;
+}
+
+int be_visitor_args_arglist::visit_structure (be_structure *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "const " << this->type_name (node) << " &";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << this->type_name (node) << " &";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << this->type_name (node, "_out");
+ break;
+ }
+
+ return 0;
+}
+
+int be_visitor_args_arglist::visit_union (be_union *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "const " << this->type_name (node) << " &";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << this->type_name (node) << " &";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << this->type_name (node, "_out");
+ break;
+ }
+
+ return 0;
+}
+
+int be_visitor_args_arglist::visit_typedef (be_typedef *node)
+{
+ this->ctx_->alias (node);
+
+ if (node->primitive_base_type ()->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_arglist::"
+ "visit_typedef - "
+ "accept on primitive type failed\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+
+int be_visitor_args_arglist::visit_valuetype (be_valuetype *node)
+{
+ return this->emit_common (node);
+}
+
+int be_visitor_args_arglist::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ TAO_OutStream *os = this->ctx_->stream (); // get the stream
+
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "const " << this->type_name (node) << " *";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << this->type_name (node) << " *&";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << this->type_name (node, "_out");
+ break;
+ }
+
+ return 0;
+}
+
+int be_visitor_args_arglist::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int be_visitor_args_arglist::visit_eventtype_fwd (be_eventtype_fwd *node)
+{
+ return this->visit_valuetype_fwd (node);
+}
+
+int
+be_visitor_args_arglist::visit_home (
+ be_home *node
+ )
+{
+ return this->visit_interface (node);
+}
+
+int be_visitor_args_arglist::visit_valuebox (be_valuebox *node)
+{
+ return this->emit_common (node);
+}
+
+
+int be_visitor_args_arglist::emit_common (be_type *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << this->type_name (node) << " *";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << this->type_name (node) << " *&";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << this->type_name (node, "_out");
+ break;
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/argument.cpp b/TAO/TAO_IDL/be/be_visitor_argument/argument.cpp
new file mode 100644
index 00000000000..7cabfbea573
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_argument/argument.cpp
@@ -0,0 +1,98 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// argument.cpp
+//
+// = DESCRIPTION
+// generic visitor for Argument node
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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_args::~be_visitor_args (void)
+{
+}
+
+int be_visitor_args::visit_argument (be_argument *)
+{
+ return -1;
+}
+
+// helper that returns the type name either as a nested type name (for header
+// files) or as a fully scoped name. In addition, we make sure that if the type
+// is an alias, we use that name
+const char *
+be_visitor_args::type_name (be_type *node,
+ const char *suffix)
+{
+ static char namebuf [NAMEBUFSIZE];
+ ACE_OS::memset (namebuf,
+ '\0',
+ NAMEBUFSIZE);
+
+ be_type *bt;
+
+ // Use the typedefed name if that is the one used in the IDL defn.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ ACE_OS::sprintf (namebuf,
+ "::%s",
+ bt->full_name ());
+
+ if (suffix)
+ {
+ ACE_OS::strcat (namebuf,
+ suffix);
+ }
+
+ return namebuf;
+}
+
+// helper that returns the direction type of the argument
+AST_Argument::Direction
+be_visitor_args::direction (void)
+{
+ if (this->fixed_direction_ != -1)
+ {
+ return AST_Argument::Direction (this->fixed_direction_);
+ }
+
+ // grab the argument node. We know that our context has stored the right
+ // argument node
+ be_argument *arg = this->ctx_->be_node_as_argument ();
+
+ ACE_ASSERT (arg != 0);
+ return arg->direction ();
+}
+
+void
+be_visitor_args::set_fixed_direction (AST_Argument::Direction direction)
+{
+ this->fixed_direction_ = direction;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/invoke_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/invoke_cs.cpp
new file mode 100644
index 00000000000..4001e6417e9
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_argument/invoke_cs.cpp
@@ -0,0 +1,681 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// invoke_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating the code that passes arguments to the CDR operators
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_argument,
+ invoke_cs,
+ "$Id$")
+
+
+// ****************************************************************************
+// visitor for arguments passing to the CDR operators.
+// ****************************************************************************
+
+be_visitor_args_invoke_cs::
+be_visitor_args_invoke_cs (be_visitor_context *ctx)
+ : be_visitor_args (ctx)
+{
+}
+
+be_visitor_args_invoke_cs::
+~be_visitor_args_invoke_cs (void)
+{
+}
+
+int be_visitor_args_invoke_cs::visit_argument (be_argument *node)
+{
+ this->ctx_->node (node); // save the argument node
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_invoke_cs::"
+ "visit_argument - "
+ "Bad argument type\n"),
+ -1);
+ }
+
+ // Different types have different mappings when used as in/out or
+ // inout parameters. Let this visitor deal with the type
+
+ TAO_OutStream *os = this->ctx_->stream (); // get output stream
+
+ if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ *os << "(_tao_out << ";
+ break;
+ case AST_Argument::dir_OUT:
+ break;
+ }
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ case AST_Argument::dir_OUT:
+ *os << "(_tao_in >> ";
+ break;
+ }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_invoke_cs::"
+ "visit_argument - "
+ "Bad substate\n"),
+ -1);
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_invoke_cs::"
+ "visit_argument - "
+ "cannot accept visitor\n"),
+ -1);
+ }
+
+ if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ *os << ")";
+ break;
+ case AST_Argument::dir_OUT:
+ break;
+ }
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ case AST_Argument::dir_OUT:
+ *os << ")";
+ break;
+ }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_invoke_cs::"
+ "visit_argument - "
+ "Bad substate\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int be_visitor_args_invoke_cs::visit_array (be_array *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)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << node->name () << "_forany ("
+ << "(" << node->name () << "_slice *)"
+ << arg->local_name () << ")";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << node->name () << "_forany ("
+ << arg->local_name () << ")";
+ break;
+ case AST_Argument::dir_OUT:
+ break;
+ }
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ case AST_Argument::dir_OUT:
+ *os << "_tao_argument_" << arg->local_name ();
+ break;
+ }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_invoke_cs::"
+ "visit_array - "
+ "Bad substate\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int be_visitor_args_invoke_cs::visit_enum (be_enum *)
+{
+ 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)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ *os << arg->local_name ();
+ break;
+ case AST_Argument::dir_OUT:
+ break;
+ }
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ case AST_Argument::dir_OUT:
+ *os << arg->local_name ();
+ break;
+ }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_invoke_cs::"
+ "visit_enum - "
+ "Bad substate\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int be_visitor_args_invoke_cs::visit_interface (be_interface *)
+{
+ return this->emit_common ();
+}
+
+int be_visitor_args_invoke_cs::visit_interface_fwd (be_interface_fwd *)
+{
+ return this->emit_common ();
+}
+
+int be_visitor_args_invoke_cs::visit_valuebox (be_valuebox *)
+{
+ return this->emit_common ();
+}
+
+int be_visitor_args_invoke_cs::visit_valuetype (be_valuetype *)
+{
+ return this->emit_common ();
+}
+
+int
+be_visitor_args_invoke_cs::visit_valuetype_fwd (be_valuetype_fwd *)
+{
+ return this->emit_common ();
+}
+
+int be_visitor_args_invoke_cs::visit_predefined_type (be_predefined_type *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)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ 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:
+ case AST_PredefinedType::PT_longlong:
+ case AST_PredefinedType::PT_ulonglong:
+ case AST_PredefinedType::PT_short:
+ case AST_PredefinedType::PT_ushort:
+ case AST_PredefinedType::PT_float:
+ case AST_PredefinedType::PT_double:
+ case AST_PredefinedType::PT_longdouble:
+ *os << arg->local_name ();
+ break;
+ case AST_PredefinedType::PT_char:
+ *os << "::ACE_OutputCDR::from_char (" << arg->local_name () << ")";
+ break;
+ case AST_PredefinedType::PT_wchar:
+ *os << "::ACE_OutputCDR::from_wchar (" << arg->local_name () << ")";
+ break;
+ case AST_PredefinedType::PT_boolean:
+ *os << "::ACE_OutputCDR::from_boolean (" << arg->local_name () << ")";
+ break;
+ case AST_PredefinedType::PT_octet:
+ *os << "::ACE_OutputCDR::from_octet (" << arg->local_name () << ")";
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_invoke_cs::"
+ "visit_predefined_type - "
+ "Bad predefined type\n"),
+ -1);
+ }
+ break;
+ case AST_Argument::dir_OUT:
+ break;
+ }
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ 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:
+ case AST_PredefinedType::PT_longlong:
+ case AST_PredefinedType::PT_ulonglong:
+ case AST_PredefinedType::PT_short:
+ case AST_PredefinedType::PT_ushort:
+ case AST_PredefinedType::PT_float:
+ case AST_PredefinedType::PT_double:
+ case AST_PredefinedType::PT_longdouble:
+ *os << arg->local_name ();
+ break;
+ case AST_PredefinedType::PT_char:
+ *os << "::ACE_InputCDR::to_char (" << arg->local_name () << ")";
+ break;
+ case AST_PredefinedType::PT_wchar:
+ *os << "::ACE_InputCDR::to_wchar (" << arg->local_name () << ")";
+ break;
+ case AST_PredefinedType::PT_boolean:
+ *os << "::ACE_InputCDR::to_boolean (" << arg->local_name () << ")";
+ break;
+ case AST_PredefinedType::PT_octet:
+ *os << "::ACE_InputCDR::to_octet (" << arg->local_name () << ")";
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_operation_rettype_compiled_marshal_cs::"
+ "visit_array - "
+ "Bad predefined type\n"),
+ -1);
+ }
+ break;
+ case AST_Argument::dir_OUT:
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
+ *os << arg->local_name () << ".ptr ()";
+ break;
+ case AST_PredefinedType::PT_any:
+ *os << "*" << arg->local_name () << ".ptr ()";
+ break;
+ 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_float:
+ case AST_PredefinedType::PT_double:
+ case AST_PredefinedType::PT_longdouble:
+ *os << arg->local_name ();
+ break;
+ case AST_PredefinedType::PT_char:
+ *os << "::ACE_InputCDR::to_char (" << arg->local_name () << ")";
+ break;
+ case AST_PredefinedType::PT_wchar:
+ *os << "::ACE_InputCDR::to_wchar (" << arg->local_name () << ")";
+ break;
+ case AST_PredefinedType::PT_boolean:
+ *os << "::ACE_InputCDR::to_boolean (" << arg->local_name () << ")";
+ break;
+ case AST_PredefinedType::PT_octet:
+ *os << "::ACE_InputCDR::to_octet (" << arg->local_name () << ")";
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_invoke_cs::"
+ "visit_array - "
+ "Bad predefined type\n"),
+ -1);
+ }
+ break;
+ }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_invoke_cs::"
+ "visit_array - "
+ "Bad substate\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int be_visitor_args_invoke_cs::visit_sequence (be_sequence *)
+{
+ 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)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ *os << arg->local_name ();
+ break;
+ case AST_Argument::dir_OUT:
+ break;
+ }
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << arg->local_name ();
+ break;
+ case AST_Argument::dir_OUT:
+ *os << "*" << arg->local_name () << ".ptr ()";
+ break;
+ }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_invoke_cs::"
+ "visit_interface - "
+ "Bad substate\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int be_visitor_args_invoke_cs::visit_string (be_string *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)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ *os << arg->local_name ();
+ break;
+ case AST_Argument::dir_OUT:
+ break;
+ }
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
+ {
+ // We need to make a distinction between bounded and unbounded strings.
+ if (node->max_size ()->ev ()->u.ulval == 0)
+ {
+ // Unbounded.
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << arg->local_name ();
+ break;
+ case AST_Argument::dir_OUT:
+ *os << arg->local_name () << ".ptr ()";
+ break;
+ }
+ }
+ else
+ {
+ // Bounded.
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "::ACE_InputCDR::to_string (";
+ }
+ else
+ {
+ *os << "::ACE_InputCDR::to_wstring (";
+ }
+
+ *os << arg->local_name () << ", "
+ << node->max_size ()->ev ()->u.ulval << ")";
+ break;
+ case AST_Argument::dir_OUT:
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "::ACE_InputCDR::to_string (";
+ }
+ else
+ {
+ *os << "::ACE_InputCDR::to_wstring (";
+ }
+
+ *os << arg->local_name () << ".ptr (), "
+ << node->max_size ()->ev ()->u.ulval << ")";
+ break;
+ }
+ }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_invoke_cs::"
+ "visit_interface - "
+ "Bad substate\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int be_visitor_args_invoke_cs::visit_structure (be_structure *node)
+{
+ return this->emit_common2 (node);
+}
+
+int be_visitor_args_invoke_cs::visit_union (be_union *node)
+{
+ return this->emit_common2 (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,
+ "be_visitor_args_invoke_cs::"
+ "visit_typedef - "
+ "accept on primitive type failed\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_args_invoke_cs::visit_component (
+ be_component *node
+ )
+{
+ return this->visit_interface (node);
+}
+
+int
+be_visitor_args_invoke_cs::visit_component_fwd (
+ be_component_fwd *node
+ )
+{
+ return this->visit_interface_fwd (node);
+}
+
+int
+be_visitor_args_invoke_cs::visit_eventtype (
+ be_eventtype *node
+ )
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_args_invoke_cs::visit_eventtype_fwd (
+ be_eventtype_fwd *node
+ )
+{
+ return this->visit_valuetype_fwd (node);
+}
+
+int
+be_visitor_args_invoke_cs::visit_home (
+ be_home *node
+ )
+{
+ return this->visit_interface (node);
+}
+
+
+int be_visitor_args_invoke_cs::emit_common (void)
+{
+ 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)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ *os << arg->local_name ();
+ break;
+ case AST_Argument::dir_OUT:
+ break;
+ }
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << arg->local_name ();
+ break;
+ case AST_Argument::dir_OUT:
+ *os << arg->local_name () << ".ptr ()";
+ break;
+ }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_invoke_cs::"
+ "emit_common - "
+ "Bad substate\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int be_visitor_args_invoke_cs::emit_common2 (be_type *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)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ *os << arg->local_name ();
+ break;
+ case AST_Argument::dir_OUT:
+ break;
+ }
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << arg->local_name ();
+ break;
+ case AST_Argument::dir_OUT:
+ if (node->size_type () == AST_Type::VARIABLE)
+ *os << "*" << arg->local_name () << ".ptr ()";
+ else
+ *os << arg->local_name ();
+ break;
+ }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_invoke_cs::"
+ "emit_common2 - "
+ "Bad substate\n"),
+ -1);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp
new file mode 100644
index 00000000000..39ea6f27f8c
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp
@@ -0,0 +1,695 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// marshal_ss.cpp
+//
+// = DESCRIPTION
+// Visitor that generates code that passes the argument variable to the
+// marshal operations.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_argument,
+ marshal_ss,
+ "$Id$")
+
+
+// ************************************************************************
+// Visitor to generate code for passing argument to the marshal/demarshal
+// routines
+// ************************************************************************
+
+be_visitor_args_marshal_ss::
+be_visitor_args_marshal_ss (be_visitor_context *ctx)
+ : be_visitor_args (ctx)
+{
+}
+
+be_visitor_args_marshal_ss::
+~be_visitor_args_marshal_ss (void)
+{
+}
+
+int be_visitor_args_marshal_ss::visit_argument (be_argument *node)
+{
+ this->ctx_->node (node);
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_marshal_ss::"
+ "visit_argument - "
+ "Bad argument type\n"),
+ -1);
+ }
+
+ // Different types have different mappings when used as in/out or
+ // inout parameters. Let this visitor deal with the type
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ *os << be_nl << "(_tao_in >> ";
+ break;
+ case AST_Argument::dir_OUT:
+ break;
+ }
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ case AST_Argument::dir_OUT:
+ *os << be_nl << "(_tao_out << ";
+ break;
+ }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_marshal_ss::"
+ "visit_argument - "
+ "Bad substate\n"),
+ -1);
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_marshal_ss::"
+ "visit_argument - "
+ "cannot accept visitor\n"),
+ -1);
+ }
+
+ if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ *os << ")";
+ break;
+ case AST_Argument::dir_OUT:
+ break;
+ }
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ case AST_Argument::dir_OUT:
+ *os << ")";
+ break;
+ }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_marshal_ss::"
+ "visit_argument - "
+ "Bad substate\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int be_visitor_args_marshal_ss::visit_array (be_array *)
+{
+ 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)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "_tao_forany_" << arg->local_name ();
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << "_tao_forany_" << arg->local_name ();
+ break;
+ case AST_Argument::dir_OUT:
+ break;
+ }
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << "_tao_forany_" << arg->local_name ();
+ break;
+ case AST_Argument::dir_OUT:
+ *os << "_tao_forany_" << arg->local_name ();
+ break;
+ }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_marshal_ss::"
+ "visit_array - "
+ "Bad substate\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int be_visitor_args_marshal_ss::visit_enum (be_enum *)
+{
+ 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)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ *os << arg->local_name ();
+ break;
+ case AST_Argument::dir_OUT:
+ break;
+ }
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ case AST_Argument::dir_OUT:
+ *os << arg->local_name ();
+ break;
+ }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_marshal_ss::"
+ "visit_enum - "
+ "Bad substate\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int be_visitor_args_marshal_ss::visit_interface (be_interface *)
+{
+ return this->emit_common ();
+}
+
+int be_visitor_args_marshal_ss::visit_interface_fwd (be_interface_fwd *)
+{
+ return this->emit_common ();
+}
+
+int be_visitor_args_marshal_ss::visit_valuebox (be_valuebox *)
+{
+ return this->emit_common ();
+}
+
+int be_visitor_args_marshal_ss::visit_valuetype (be_valuetype *)
+{
+ return this->emit_common ();
+}
+
+int be_visitor_args_marshal_ss::visit_valuetype_fwd (be_valuetype_fwd *)
+{
+ return this->emit_common ();
+}
+
+int be_visitor_args_marshal_ss::visit_predefined_type (
+ be_predefined_type *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)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
+ *os << arg->local_name () << ".out ()";
+ break;
+ case AST_PredefinedType::PT_any:
+ 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_float:
+ case AST_PredefinedType::PT_double:
+ case AST_PredefinedType::PT_longdouble:
+ *os << arg->local_name ();
+ break;
+ case AST_PredefinedType::PT_char:
+ *os << "::ACE_InputCDR::to_char (" << arg->local_name () << ")";
+ break;
+ case AST_PredefinedType::PT_wchar:
+ *os << "::ACE_InputCDR::to_wchar (" << arg->local_name () << ")";
+ break;
+ case AST_PredefinedType::PT_boolean:
+ *os << "::ACE_InputCDR::to_boolean (" << arg->local_name () << ")";
+ break;
+ case AST_PredefinedType::PT_octet:
+ *os << "::ACE_InputCDR::to_octet (" << arg->local_name () << ")";
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_marshal_ss::"
+ "visit_predefined_type - "
+ "Bad predefined type\n"),
+ -1);
+ }
+ break;
+ case AST_Argument::dir_OUT:
+ break;
+ }
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
+ *os << arg->local_name () << ".in ()";
+ break;
+ case AST_PredefinedType::PT_any:
+ *os << arg->local_name ();
+ break;
+ 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_float:
+ case AST_PredefinedType::PT_double:
+ case AST_PredefinedType::PT_longdouble:
+ *os << arg->local_name ();
+ break;
+ case AST_PredefinedType::PT_char:
+ *os << "::ACE_OutputCDR::from_char (" << arg->local_name () << ")";
+ break;
+ case AST_PredefinedType::PT_wchar:
+ *os << "::ACE_OutputCDR::from_wchar (" << arg->local_name () << ")";
+ break;
+ case AST_PredefinedType::PT_boolean:
+ *os << "::ACE_OutputCDR::from_boolean (" << arg->local_name () << ")";
+ break;
+ case AST_PredefinedType::PT_octet:
+ *os << "::ACE_OutputCDR::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);
+ }
+ break;
+ case AST_Argument::dir_OUT:
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
+ *os << arg->local_name () << ".in ()";
+ break;
+ case AST_PredefinedType::PT_any:
+ *os << arg->local_name () << ".in ()";
+ break;
+ 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_float:
+ case AST_PredefinedType::PT_double:
+ case AST_PredefinedType::PT_longdouble:
+ *os << arg->local_name ();
+ break;
+ case AST_PredefinedType::PT_char:
+ *os << "::ACE_OutputCDR::from_char (" << arg->local_name () << ")";
+ break;
+ case AST_PredefinedType::PT_wchar:
+ *os << "::ACE_OutputCDR::from_wchar (" << arg->local_name () << ")";
+ break;
+ case AST_PredefinedType::PT_boolean:
+ *os << "::ACE_OutputCDR::from_boolean (" << arg->local_name () << ")";
+ break;
+ case AST_PredefinedType::PT_octet:
+ *os << "::ACE_OutputCDR::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
+ );
+ }
+ break;
+ }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_marshal_ss::"
+ "visit_array - "
+ "Bad substate\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int be_visitor_args_marshal_ss::visit_sequence (be_sequence *)
+{
+ 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)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ *os << arg->local_name ();
+ break;
+ case AST_Argument::dir_OUT:
+ break;
+ }
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << arg->local_name ();
+ break;
+ case AST_Argument::dir_OUT:
+ *os << arg->local_name () << ".in ()";
+ break;
+ }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_marshal_ss::"
+ "visit_interface - "
+ "Bad substate\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int be_visitor_args_marshal_ss::visit_string (be_string *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)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ // we need to make a distinction between bounded and unbounded strings
+ if (node->max_size ()->ev ()->u.ulval == 0)
+ {
+ *os << arg->local_name () << ".out ()";
+ }
+ else
+ {
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "::ACE_InputCDR::to_string (";
+ }
+ else
+ {
+ *os << "::ACE_InputCDR::to_wstring (";
+ }
+
+ *os << arg->local_name () << ".out (), "
+ << node->max_size ()->ev ()->u.ulval
+ << ")";
+ }
+ break;
+ case AST_Argument::dir_OUT:
+ break;
+ }
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
+ {
+ // we need to make a distinction between bounded and unbounded strings
+ if (node->max_size ()->ev ()->u.ulval == 0)
+ {
+ // unbounded
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ case AST_Argument::dir_OUT:
+ *os << arg->local_name () << ".in ()";
+ break;
+ }
+ }
+ else
+ {
+ // bounded
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ case AST_Argument::dir_OUT:
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "::ACE_OutputCDR::from_string ((char *)";
+ }
+ else
+ {
+ *os << "::ACE_OutputCDR::from_wstring ((CORBA::WChar *)";
+ }
+
+ *os << arg->local_name () << ".in (), "
+ << node->max_size ()->ev ()->u.ulval << ")";
+ break;
+ }
+ }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_marshal_ss::"
+ "visit_string - "
+ "Bad substate\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int be_visitor_args_marshal_ss::visit_structure (be_structure *node)
+{
+ return this->emit_common2 (node);
+}
+
+int be_visitor_args_marshal_ss::visit_union (be_union *node)
+{
+ return this->emit_common2 (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,
+ "be_visitor_args_marshal_ss::"
+ "visit_typedef - "
+ "accept on primitive type failed\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_args_marshal_ss::visit_component (
+ be_component *node
+ )
+{
+ return this->visit_interface (node);
+}
+
+int
+be_visitor_args_marshal_ss::visit_component_fwd (
+ be_component_fwd *node
+ )
+{
+ return this->visit_interface_fwd (node);
+}
+
+int
+be_visitor_args_marshal_ss::visit_eventtype (
+ be_eventtype *node
+ )
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_args_marshal_ss::visit_eventtype_fwd (
+ be_eventtype_fwd *node
+ )
+{
+ return this->visit_valuetype_fwd (node);
+}
+
+int
+be_visitor_args_marshal_ss::visit_home (
+ be_home *node
+ )
+{
+ return this->visit_interface (node);
+}
+
+int
+be_visitor_args_marshal_ss::emit_common ()
+{
+ 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)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ *os << arg->local_name () << ".out ()";
+ break;
+ case AST_Argument::dir_OUT:
+ break;
+ }
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ case AST_Argument::dir_OUT:
+ *os << arg->local_name () << ".in ()";
+ break;
+ }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_marshal_ss::emit_common - "
+ "Bad substate\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+
+int
+be_visitor_args_marshal_ss::emit_common2 (be_type *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)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ *os << arg->local_name ();
+ break;
+ case AST_Argument::dir_OUT:
+ break;
+ }
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << arg->local_name ();
+ break;
+ case AST_Argument::dir_OUT:
+ if (node->size_type () == AST_Type::VARIABLE)
+ *os << arg->local_name () << ".in ()";
+ else
+ *os << arg->local_name ();
+ break;
+ }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_marshal_ss::emit_common2 - "
+ "Bad substate\n"),
+ -1);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp b/TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp
new file mode 100644
index 00000000000..e8f10292638
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp
@@ -0,0 +1,237 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// paramlist.cpp
+//
+// = DESCRIPTION
+// Visitor that generates the Dyanmic::ParameterList
+//
+// = AUTHOR
+// Kirthika Parameswaran <kirthika@cs.wustl.edu>
+// Ossama Othman <ossama@uci.edu>
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_argument,
+ paramlist,
+ "$Id$")
+
+
+// ************************************************************
+// be_visitor_args_paramlist for parameter list in method declarations and
+// definitions
+// ************************************************************
+
+be_visitor_args_paramlist::be_visitor_args_paramlist (be_visitor_context *ctx)
+ : be_visitor_args (ctx)
+{
+}
+
+be_visitor_args_paramlist::~be_visitor_args_paramlist (void)
+{
+}
+
+int be_visitor_args_paramlist::visit_argument (be_argument *node)
+{
+ // Get output stream.
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Save the argument node.
+ this->ctx_->node (node);
+
+ // We do not put "out" arguments into the arglist.
+ if (this->direction () == AST_Argument::dir_OUT)
+ {
+ return 0;
+ }
+
+ // Retrieve the type.
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ // If node is typedef'd, we must strip it off.
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ {
+ be_typedef *td = be_typedef::narrow_from_decl (bt);
+ bt = td->primitive_base_type ();
+ }
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_arglist::"
+ "visit_argument - "
+ "Bad argument type\n"),
+ -1);
+ }
+
+ // Generate valuetype check: this hack is needed as there is no
+ // available way to check for valuetype type.
+ // Any operators for valuetypes arent there so we dont add it to the
+ // paramlist.
+ if (bt->node_type () == AST_Decl::NT_interface)
+ {
+ be_valuetype *vt = be_valuetype::narrow_from_decl (node->field_type ());
+
+ // @@ NOTE: If this check is removed, and insertion operators
+ // for valuetypes are implemented, don't forget to also
+ // remove the same valuetype check in
+ // be_visitor_operation::count_non_out_parameters().
+
+ // If it is a valuetype just return.
+ if (vt)
+ {
+ return 0;
+ }
+ }
+
+ // Amazed by the zillion os operators below? Its just to combat
+ // side effects functions like type_name() have on the os stream.
+ // This was causing a problem with the stubs not been generated accurately
+ // on Linux using egcs.
+ if (bt->node_type () == AST_Decl::NT_array)
+ {
+ *os << this->type_name (bt, "_forany");
+ *os << " _tao_forany_" << node->local_name () << " (";
+ *os << this->type_name (bt, "_dup");
+ *os << " (";
+
+ if (this->direction () != AST_Argument::dir_IN)
+ {
+ *os << "(const ::" << bt->name () << "_slice *) ";
+ }
+
+ *os << "this->";
+ *os << node->local_name () << "_));" << be_nl;
+ *os << "(*parameter_list)[len].argument <<= _tao_forany_" ;
+ *os << node->local_name () << ";" << be_nl;
+ }
+ else
+ {
+ *os << "(*parameter_list)[len].argument <<= ";
+ // Insertion into an Any has some special cases which need to be
+ // dealt with.
+
+ switch (bt->node_type ())
+ {
+ case AST_Decl::NT_pre_defined:
+ case AST_Decl::NT_string:
+ case AST_Decl::NT_wstring:
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_paramlist::"
+ "visit_argument - "
+ "cannot accept visitor\n"),
+ -1);
+ }
+ break;
+
+ default:
+ *os << " this->" << node->local_name () << "_;";
+
+ }
+ }
+
+ *os << be_nl;
+
+ // Set the appropriate mode for each parameter.
+ switch (node->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "(*parameter_list)[len].mode = ::CORBA::PARAM_IN;" << be_nl;
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << "(*parameter_list)[len].mode = ::CORBA::PARAM_INOUT;" << be_nl;
+ break;
+ case AST_Argument::dir_OUT:
+ *os << "(*parameter_list)[len].mode = ::CORBA::PARAM_OUT;" << be_nl;
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_args_paramlist::"
+ "visit_argument - "
+ "Bad context\n"),
+ -1);
+ }
+
+ *os << "len++;" << be_nl;
+
+
+ return 0;
+}
+
+int
+be_visitor_args_paramlist::visit_string (be_string *node)
+{
+ // Get output stream.
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Get the argument.
+ be_argument *arg = this->ctx_->be_node_as_argument ();
+
+ // 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 << "::ACE_OutputCDR::from_string ((char *)";
+ }
+ else
+ {
+ *os << "::ACE_OutputCDR::from_wstring ((CORBA::WChar *)";
+ }
+
+ *os << arg->local_name () << "_, "
+ << node->max_size ()->ev ()->u.ulval
+ << ");";
+ }
+ else
+ {
+ *os << arg->local_name () <<"_;";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_args_paramlist::visit_predefined_type (be_predefined_type *node)
+{
+ // Get output stream.
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Get the argument.
+ be_argument *arg = this->ctx_->be_node_as_argument ();
+
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_boolean:
+ *os << "::ACE_OutputCDR::from_boolean (this->";
+ *os << arg->local_name () << "_);";
+ break;
+ case AST_PredefinedType::PT_char:
+ *os << "::ACE_OutputCDR::from_char (this->";
+ *os << arg->local_name () << "_);";
+ break;
+ case AST_PredefinedType::PT_wchar:
+ *os << "::ACE_OutputCDR::from_wchar (this->";
+ *os << arg->local_name () << "_);";
+ break;
+ case AST_PredefinedType::PT_octet:
+ *os << "::ACE_OutputCDR::from_octet (this->";
+ *os << arg->local_name () << "_);";
+ break;
+ default:
+ *os << arg->local_name () << "_;";
+ break;
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/post_upcall_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/post_upcall_ss.cpp
new file mode 100644
index 00000000000..41c9e5b9d10
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_argument/post_upcall_ss.cpp
@@ -0,0 +1,133 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// post_upcall_ss.cpp
+//
+// = DESCRIPTION
+// Visitor generating code to do post-processing of arguments following an
+// upcall.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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_scope (ctx)
+{
+}
+
+be_visitor_args_post_upcall_ss::~be_visitor_args_post_upcall_ss (void)
+{
+}
+
+int
+be_visitor_args_post_upcall_ss::visit_operation (be_operation *node)
+{
+ return this->visit_scope (node);
+}
+
+int be_visitor_args_post_upcall_ss::visit_argument (be_argument *node)
+{
+ this->ctx_->node (node); // save the argument node
+
+ // retrieve the type
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_post_upcall::"
+ "visit_argument - "
+ "Bad argument type\n"),
+ -1);
+ }
+
+ // Different types have different mappings when used as in/out or
+ // inout parameters. Let this visitor deal with the type
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_post_upcall::"
+ "visit_argument - "
+ "cannot accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int be_visitor_args_post_upcall_ss::visit_array (be_array *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
+
+ // if the current type is an alias, use that
+ be_type *bt = node;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+
+ switch (arg->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+ case AST_Argument::dir_INOUT:
+ break;
+ case AST_Argument::dir_OUT:
+ if (node->size_type () == be_type::VARIABLE)
+ {
+ *os << bt->name () << "_forany _tao_forany_"
+ << arg->local_name () << " (" << be_idt << be_idt_nl
+ << arg->local_name () << ".inout ()" << be_uidt_nl
+ << ");\n" << be_uidt;
+ }
+ else
+ {
+ *os << bt->name () << "_forany _tao_forany_"
+ << arg->local_name () << " (" << be_idt << be_idt_nl
+ << arg->local_name () << be_uidt_nl
+ << ");\n" << be_uidt;
+ }
+
+ break;
+ }
+ return 0;
+}
+
+int be_visitor_args_post_upcall_ss::visit_typedef (be_typedef *node)
+{
+ this->ctx_->alias (node);
+
+ if (node->primitive_base_type ()->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_post_upcall::"
+ "visit_typedef - "
+ "accept on primitive type failed\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/upcall_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/upcall_ss.cpp
new file mode 100644
index 00000000000..e5b9a0f45f5
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_argument/upcall_ss.cpp
@@ -0,0 +1,424 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// upcall_ss.cpp
+//
+// = DESCRIPTION
+// Visitor that generates code that passes argument variables to the
+// upcall.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_argument,
+ upcall_ss,
+ "$Id$")
+
+
+// ************************************************************************
+// visitor for passing arguments to the upcall
+// ************************************************************************
+
+be_visitor_args_upcall_ss::be_visitor_args_upcall_ss (be_visitor_context *ctx)
+ : be_visitor_args (ctx)
+{
+}
+
+be_visitor_args_upcall_ss::~be_visitor_args_upcall_ss (void)
+{
+}
+
+int be_visitor_args_upcall_ss::visit_argument (be_argument *node)
+{
+ this->ctx_->node (node);
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_upcall_ss::"
+ "visit_argument - "
+ "Bad argument type\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl;
+
+ // Different types have different mappings when used as in/out or
+ // inout parameters. Let this visitor deal with the type
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_upcall_ss::"
+ "visit_argument - "
+ "cannot accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int be_visitor_args_upcall_ss::visit_array (be_array *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
+
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ // This is to placate some compilers which have
+ // trouble with IN args that are multidimensional arrays.
+ if (node->n_dims () > 1)
+ {
+ *os << "(const ::" << node->name () << "_slice *) ";
+ }
+
+ *os << arg->local_name ();
+
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << arg->local_name ();
+
+ break;
+ case AST_Argument::dir_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 ();
+ }
+
+ break;
+ }
+
+ return 0;
+}
+
+int be_visitor_args_upcall_ss::visit_enum (be_enum *)
+{
+ 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:
+ case AST_Argument::dir_OUT:
+ *os << arg->local_name ();
+
+ break;
+ }
+
+ return 0;
+}
+
+int be_visitor_args_upcall_ss::visit_interface (be_interface *)
+{
+ return this->emit_common ();
+}
+
+int be_visitor_args_upcall_ss::visit_interface_fwd (be_interface_fwd *)
+{
+ return this->emit_common ();
+}
+
+int be_visitor_args_upcall_ss::visit_valuebox (be_valuebox *)
+{
+ return this->emit_common ();
+}
+
+int be_visitor_args_upcall_ss::visit_valuetype (be_valuetype *)
+{
+ return this->emit_common ();
+}
+
+int be_visitor_args_upcall_ss::visit_valuetype_fwd (be_valuetype_fwd *)
+{
+ return this->emit_common ();
+}
+
+int be_visitor_args_upcall_ss::visit_predefined_type (be_predefined_type *node)
+{
+ 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 ();
+ }
+ else
+ {
+ *os << arg->local_name () << ".out ()";
+ }
+
+ break;
+ }
+ }
+ 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 ();
+ }
+ else
+ {
+ *os << arg->local_name () << ".in ()";
+ }
+
+ break;
+ case AST_Argument::dir_INOUT:
+ if (this->ctx_->state ()
+ == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
+ {
+ *os << arg->local_name ();
+ }
+ else
+ {
+ *os << arg->local_name () << ".inout ()";
+ }
+
+ break;
+ case AST_Argument::dir_OUT:
+ if (this->ctx_->state ()
+ == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
+ {
+ *os << arg->local_name ();
+ }
+ else
+ {
+ *os << arg->local_name () << ".out ()";
+ }
+
+ break;
+ }
+ }
+ else
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ case AST_Argument::dir_OUT:
+ *os << arg->local_name ();
+
+ break;
+ } // end switch direction
+ } // end of else
+
+ return 0;
+}
+
+int be_visitor_args_upcall_ss::visit_sequence (be_sequence *)
+{
+ 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 ();
+ }
+ else
+ {
+ *os << arg->local_name () << ".out ()";
+ }
+
+ break;
+ }
+
+ return 0;
+}
+
+int be_visitor_args_upcall_ss::visit_string (be_string *)
+{
+ return this->emit_common ();
+}
+
+int be_visitor_args_upcall_ss::visit_structure (be_structure *node)
+{
+ return this->emit_common2 (node);
+}
+
+int be_visitor_args_upcall_ss::visit_union (be_union *node)
+{
+ return this->emit_common2 (node);
+}
+
+int be_visitor_args_upcall_ss::visit_typedef (be_typedef *node)
+{
+ this->ctx_->alias (node);
+
+ if (node->primitive_base_type ()->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_upcall_ss::"
+ "visit_typedef - "
+ "accept on primitive type failed\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_args_upcall_ss::visit_component (
+ be_component *node
+ )
+{
+ return this->visit_interface (node);
+}
+
+int
+be_visitor_args_upcall_ss::visit_component_fwd (
+ be_component_fwd *node
+ )
+{
+ return this->visit_interface_fwd (node);
+}
+
+int
+be_visitor_args_upcall_ss::visit_eventtype (
+ be_eventtype *node
+ )
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_args_upcall_ss::visit_eventtype_fwd (
+ be_eventtype_fwd *node
+ )
+{
+ return this->visit_valuetype_fwd (node);
+}
+
+int be_visitor_args_upcall_ss::emit_common (void)
+{
+ 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 ();
+ }
+ else
+ {
+ *os << arg->local_name () << ".in ()";
+ }
+
+ break;
+ case AST_Argument::dir_INOUT:
+ if (this->ctx_->state ()
+ == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
+ {
+ *os << arg->local_name ();
+ }
+ else
+ {
+ *os << arg->local_name () << ".inout ()";
+ }
+
+ break;
+ case AST_Argument::dir_OUT:
+ if (this->ctx_->state ()
+ == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
+ {
+ *os << arg->local_name ();
+ }
+ else
+ {
+ *os << arg->local_name () << ".out ()";
+ }
+
+ break;
+ }
+
+ return 0;
+}
+
+int be_visitor_args_upcall_ss::emit_common2 (be_type *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 () == 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 ();
+ }
+
+ break;
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/vardecl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/vardecl_ss.cpp
new file mode 100644
index 00000000000..2736db1b783
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_argument/vardecl_ss.cpp
@@ -0,0 +1,457 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// vardecl_ss.cpp
+//
+// = DESCRIPTION
+// Visitor that generates the variable declaration in the skeleton
+// corresponding to the Argument node
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+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);
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_vardecl_ss::"
+ "visit_argument - "
+ "Bad argument type\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl;
+
+ // Different types have different mappings when used as in/out or
+ // inout parameters. Let this visitor deal with the type
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_vardecl_ss::"
+ "visit_argument - "
+ "cannot accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int be_visitor_args_vardecl_ss::visit_array (be_array *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ *os << "::" << 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
+ << ");" << be_uidt;
+
+ break;
+ case AST_Argument::dir_OUT:
+ if (node->size_type () == be_type::VARIABLE)
+ {
+ *os << "::" << bt->name () << "_var " << arg->local_name ()
+ << ";";
+ }
+ else
+ {
+ *os << bt->name () << " " << arg->local_name ()
+ << ";";
+ }
+
+ break;
+ }
+
+ return 0;
+}
+
+int be_visitor_args_vardecl_ss::visit_enum (be_enum *node)
+{
+ 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 ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ case AST_Argument::dir_OUT:
+ *os << "::" << bt->name () << " " << arg->local_name () << ";";
+
+ break;
+ }
+
+ return 0;
+}
+
+int be_visitor_args_vardecl_ss::visit_interface (be_interface *node)
+{
+ return this->emit_common (node);
+}
+
+int be_visitor_args_vardecl_ss::visit_interface_fwd (be_interface_fwd *node)
+{
+ return this->emit_common (node);
+}
+
+
+int be_visitor_args_vardecl_ss::visit_valuebox (be_valuebox *node)
+{
+ return this->emit_common (node);
+}
+
+int be_visitor_args_vardecl_ss::visit_valuetype (be_valuetype *node)
+{
+ return this->emit_common (node);
+}
+
+int be_visitor_args_vardecl_ss::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ return this->emit_common (node);
+}
+
+int be_visitor_args_vardecl_ss::visit_predefined_type (be_predefined_type *node)
+{
+ 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 ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ AST_PredefinedType::PredefinedType pt = node->pt ();
+
+ *os << "::" << bt->name ();
+
+ if (pt == AST_PredefinedType::PT_any)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ *os << " ";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << "_var ";
+ break;
+ }
+
+ *os << arg->local_name () << ";";
+ }
+ else if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << "_var " << arg->local_name () << ";";
+ }
+ else
+ {
+ *os << " " << arg->local_name ();
+
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ break;
+
+ // @@@ (JP) This is a hack for VC7, which gets an internal
+ // compiler error if these not initialized.
+ // (02-12-09)
+ case AST_Argument::dir_INOUT:
+ case AST_Argument::dir_OUT:
+ switch (pt)
+ {
+ case AST_PredefinedType::PT_boolean:
+ case AST_PredefinedType::PT_short:
+ case AST_PredefinedType::PT_long:
+ case AST_PredefinedType::PT_ushort:
+ case AST_PredefinedType::PT_ulong:
+ case AST_PredefinedType::PT_ulonglong:
+ case AST_PredefinedType::PT_float:
+ case AST_PredefinedType::PT_double:
+ case AST_PredefinedType::PT_octet:
+ *os << " = 0";
+ break;
+ case AST_PredefinedType::PT_longlong:
+ *os << " = ACE_CDR_LONGLONG_INITIALIZER";
+ break;
+ case AST_PredefinedType::PT_longdouble:
+ *os << " = ACE_CDR_LONG_DOUBLE_INITIALIZER";
+ break;
+ default:
+ break;
+ }
+
+ break;
+ }
+
+ *os << ";";
+ }
+
+ return 0;
+}
+
+int be_visitor_args_vardecl_ss::visit_sequence (be_sequence *node)
+{
+ 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 ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ *os << "::" << bt->name () << " " << arg->local_name () << ";";
+
+ break;
+ case AST_Argument::dir_OUT:
+ *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 ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
+
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "::CORBA::String_var " << arg->local_name () << ";";
+ }
+ else
+ {
+ *os << "::CORBA::WString_var " << arg->local_name () << ";";
+ }
+
+ break;
+ case AST_Argument::dir_OUT:
+ if (node->width () == (long )sizeof (char))
+ {
+ *os << "::CORBA::String_var " << arg->local_name () << ";";
+ }
+ else
+ {
+ *os << "::CORBA::WString_var " << arg->local_name () << ";";
+ }
+
+ break;
+ }
+
+ return 0;
+}
+
+int be_visitor_args_vardecl_ss::visit_structure (be_structure *node)
+{
+ return this->emit_common2 (node);
+}
+
+int be_visitor_args_vardecl_ss::visit_union (be_union *node)
+{
+ return this->emit_common2 (node);
+}
+
+int be_visitor_args_vardecl_ss::visit_typedef (be_typedef *node)
+{
+ this->ctx_->alias (node);
+
+ if (node->primitive_base_type ()->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_vardecl_ss::"
+ "visit_typedef - "
+ "accept on primitive type failed\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_args_vardecl_ss::visit_component (
+ be_component *node
+ )
+{
+ return this->visit_interface (node);
+}
+
+int
+be_visitor_args_vardecl_ss::visit_component_fwd (
+ be_component_fwd *node
+ )
+{
+ return this->visit_interface_fwd (node);
+}
+
+int
+be_visitor_args_vardecl_ss::visit_eventtype (
+ be_eventtype *node
+ )
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_args_vardecl_ss::visit_eventtype_fwd (
+ be_eventtype_fwd *node
+ )
+{
+ return this->visit_valuetype_fwd (node);
+}
+
+
+int
+be_visitor_args_vardecl_ss::emit_common (be_type *node)
+{
+ 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 ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ *os << "::" << bt->name () << "_var " << arg->local_name () << ";";
+
+ break;
+ case AST_Argument::dir_OUT:
+ *os << "::" << bt->name () << "_var "
+ << arg->local_name () << ";";
+
+ break;
+ }
+
+ return 0;
+}
+
+
+
+int
+be_visitor_args_vardecl_ss::emit_common2 (be_type *node)
+{
+ 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 ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ case AST_Argument::dir_INOUT:
+ *os << "::" << bt->name () << " " << arg->local_name () << ";";
+
+ break;
+ case AST_Argument::dir_OUT:
+ if (node->size_type () == be_type::VARIABLE)
+ {
+ *os << "::" << bt->name () << "_var "
+ << arg->local_name () << ";";
+ }
+ else
+ {
+ *os << "::" << bt->name () << " " << arg->local_name () << ";";
+ }
+
+ break;
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_array.cpp b/TAO/TAO_IDL/be/be_visitor_array.cpp
new file mode 100644
index 00000000000..ced70b4b433
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_array.cpp
@@ -0,0 +1,60 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_array.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Array
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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_valuebox.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 "nr_extern.h"
+#include "ace/Log_Msg.h"
+
+#include "be_visitor_array.h"
+#include "be_visitor_context.h"
+#include "be_visitor_enum.h"
+#include "be_visitor_structure.h"
+#include "be_visitor_union.h"
+
+#include "be_visitor_array/array.cpp"
+#include "be_visitor_array/array_ch.cpp"
+#include "be_visitor_array/array_ci.cpp"
+#include "be_visitor_array/array_cs.cpp"
+#include "be_visitor_array/any_op_ch.cpp"
+#include "be_visitor_array/any_op_cs.cpp"
+#include "be_visitor_array/cdr_op_ch.cpp"
+#include "be_visitor_array/cdr_op_cs.cpp"
+#include "be_visitor_array/serializer_op_ch.cpp"
+#include "be_visitor_array/serializer_op_cs.cpp"
+
+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
new file mode 100644
index 00000000000..b3ec2642578
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_array/any_op_ch.cpp
@@ -0,0 +1,66 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor for code generation of Arrays for the Any operators in the client
+// header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_array,
+ any_op_ch,
+ "$Id$")
+
+// ***************************************************************************
+// Array visitor for generating Any operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_array_any_op_ch::be_visitor_array_any_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_array_any_op_ch::~be_visitor_array_any_op_ch (void)
+{
+}
+
+int
+be_visitor_array_any_op_ch::visit_array (be_array *node)
+{
+ if (node->cli_hdr_any_op_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ const char *macro = this->ctx_->export_macro ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *os << macro << " void operator<<= (::CORBA::Any &, const " << node->name ()
+ << "_forany &);" << be_nl;
+ *os << macro << " ::CORBA::Boolean operator>>= (const ::CORBA::Any &, "
+ << node->name () << "_forany &);";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ node->cli_hdr_any_op_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_array/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_array/any_op_cs.cpp
new file mode 100644
index 00000000000..facda38a048
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_array/any_op_cs.cpp
@@ -0,0 +1,134 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor for code generation of Arrays for the Any operators in the client
+// stubs.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_array,
+ any_op_cs,
+ "$Id$")
+
+
+// ***************************************************************************
+// Array visitor for generating Any operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_array_any_op_cs::be_visitor_array_any_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_array_any_op_cs::~be_visitor_array_any_op_cs (void)
+{
+}
+
+int
+be_visitor_array_any_op_cs::visit_array (be_array *node)
+{
+ if (node->cli_stub_any_op_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl
+ << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ // Since we don't generate CDR stream operators for types that
+ // explicitly contain a local interface (at some level), we
+ // must override these Any template class methods to avoid
+ // calling the non-existent operators. The zero return value
+ // will eventually cause CORBA::MARSHAL to be raised if this
+ // type is inserted into an Any and then marshaled.
+ if (node->is_local ())
+ {
+ *os << be_nl << be_nl
+ << "namespace TAO" << be_nl
+ << "{" << be_idt_nl
+ << "template<>" << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "Any_Array_Impl_T<" << be_idt << be_idt_nl
+ << node->name () << "_slice," << be_nl
+ << node->name () << "_forany" << be_uidt_nl
+ << ">::marshal_value (TAO_OutputCDR &)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "template<>" << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "Any_Array_Impl_T<" << be_idt << be_idt_nl
+ << node->name () << "_slice," << be_nl
+ << node->name () << "_forany" << be_uidt_nl
+ << ">::demarshal_value (TAO_OutputCDR &)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}";
+ }
+
+ *os << "void operator<<= (" << be_idt << be_idt_nl
+ << "::CORBA::Any &_tao_any," << be_nl
+ << "const " << node->name () << "_forany &_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "TAO::Any_Array_Impl_T<" << be_idt << be_idt_nl
+ << node->name () << "_slice," << be_nl
+ << node->name () << "_forany" << be_uidt_nl
+ << ">::insert ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->name () << "_forany::_tao_any_destructor," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "_tao_elem.nocopy ()" << be_idt_nl
+ << "? _tao_elem.ptr ()" << be_nl
+ << ": "
+ << node->name () << "_dup (_tao_elem.in ())" << be_uidt << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl
+ << "const ::CORBA::Any &_tao_any," << be_nl
+ << node->name () << "_forany &_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return" << be_idt_nl
+ << "TAO::Any_Array_Impl_T<" << be_idt << be_idt_nl
+ << node->name () << "_slice," << be_nl
+ << node->name () << "_forany" << be_uidt_nl
+ << ">::extract (" << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->name () << "_forany::_tao_any_destructor," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "_tao_elem.out ()" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "}";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ node->cli_stub_any_op_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_array/array.cpp b/TAO/TAO_IDL/be/be_visitor_array/array.cpp
new file mode 100644
index 00000000000..0ce6c5133ad
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_array/array.cpp
@@ -0,0 +1,236 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// array.cpp
+//
+// = DESCRIPTION
+// Generic visitor for code generation for Arrays
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_array,
+ array,
+ "$Id$")
+
+
+// ************************************************************************
+// generic visitor for array declaration
+// ************************************************************************
+
+be_visitor_array::be_visitor_array (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_array::~be_visitor_array (void)
+{
+}
+
+int be_visitor_array::visit_array (be_array *)
+{
+ // Must be overloaded by derived visitors.
+ return -1;
+}
+
+int
+be_visitor_array::visit_enum (be_enum *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array::visit_interface (be_interface *node)
+{
+ return this->emit_common (node);
+}
+
+int
+be_visitor_array::visit_interface_fwd (be_interface_fwd *node)
+{
+ return this->emit_common (node);
+}
+
+int
+be_visitor_array::visit_valuebox (be_valuebox *node)
+{
+ return this->emit_common (node);
+}
+
+int
+be_visitor_array::visit_valuetype (be_valuetype *node)
+{
+ return this->emit_common (node);
+}
+
+int
+be_visitor_array::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ return this->emit_common (node);
+}
+
+int
+be_visitor_array::visit_predefined_type (be_predefined_type *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ AST_PredefinedType::PredefinedType pt = node->pt ();
+
+ *os << "::";
+
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << node->name () << "_var";
+ }
+ else
+ {
+ *os << node->name ();
+ }
+
+ return 0;
+}
+
+int
+be_visitor_array::visit_sequence (be_sequence *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array::visit_string (be_string *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "TAO::String_Manager";
+ }
+ else
+ {
+ *os << "TAO::WString_Manager";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_array::visit_structure (be_structure *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array::visit_union (be_union *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array::visit_typedef (be_typedef *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ AST_Type *pbt = node->primitive_base_type ();
+ AST_Decl::NodeType nt = pbt->node_type ();
+ AST_PredefinedType::PredefinedType pt = AST_PredefinedType:: PT_void;
+ int result = 0;
+
+ // We check for these first, because in these cases, we replace the
+ // entire slice type with one of the strings below, instead of using
+ // the node's type name, possibly suffixed with '_var'.
+ if (nt == AST_Decl::NT_string)
+ {
+ *os << "TAO::String_Manager";
+
+ return 0;
+ }
+ else if (nt == AST_Decl::NT_wstring)
+ {
+ *os << "TAO::WString_Manager";
+
+ return 0;
+ }
+
+ result = this->visit_node (node);
+
+ if (nt == AST_Decl::NT_pre_defined)
+ {
+ AST_PredefinedType *pdt = AST_PredefinedType::narrow_from_decl (pbt);
+ pt = pdt->pt ();
+ }
+
+ // We must append a "_var" for typedefs of interfaces, CORBA::Objects or
+ // typecodes.
+ if (nt == AST_Decl::NT_interface
+ || nt == AST_Decl::NT_interface_fwd
+ || pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << "_var";
+ }
+
+ return result;
+}
+
+// helper
+int
+be_visitor_array::visit_node (be_type *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_ARRAY_CH)
+ {
+ *os << bt->nested_type_name (this->ctx_->scope ());
+ }
+ else
+ {
+ *os << bt->name ();
+ }
+
+ return 0;
+}
+
+int
+be_visitor_array::emit_common (be_type *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_ARRAY_CH)
+ {
+ *os << bt->nested_type_name (this->ctx_->scope (), "_var");
+ }
+ else
+ {
+ *os << bt->name () << "_var";
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp b/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp
new file mode 100644
index 00000000000..90d84dd5a39
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp
@@ -0,0 +1,349 @@
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// array_ch.cpp
+//
+// = DESCRIPTION
+// Visitor for Array code generation in client header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_array,
+ array_ch,
+ "$Id$")
+
+// ************************************************************************
+// visitor for array declaration in client header
+// ************************************************************************
+
+be_visitor_array_ch::be_visitor_array_ch (be_visitor_context *ctx)
+ : be_visitor_array (ctx)
+{
+}
+
+be_visitor_array_ch::~be_visitor_array_ch (void)
+{
+}
+
+int be_visitor_array_ch::visit_array (be_array *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_decl *scope = this->ctx_->scope ();
+
+ // Nothing to do if we are imported or code is already generated.
+ if (node->imported () || node->cli_hdr_gen ())
+ {
+ return 0;
+ }
+
+ this->ctx_->node (node);
+
+ // Retrieve the type.
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
+ AST_Decl::NodeType nt = bt->node_type ();
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_ch::"
+ "visit_array - "
+ "bad base type\n"),
+ -1);
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl
+ << "// " __FILE__ << ":" << __LINE__;
+
+ // Generate the ifdefined macro.
+ os->gen_ifdef_macro (node->flat_name ());
+
+ // If we contain an anonymous sequence,
+ // generate code for the sequence here.
+ if (nt == AST_Decl::NT_sequence)
+ {
+ if (this->gen_anonymous_base_type (bt,
+ TAO_CodeGen::TAO_ROOT_CH)
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_ch::"
+ "visit_array - "
+ "gen_anonymous_base_type failed\n"),
+ -1);
+ }
+ }
+
+ // If the array is an anonymous member and if its element type
+ // is a declaration (not a reference), we must generate code for
+ // the declaration.
+ if (this->ctx_->alias () == 0 // Not a typedef.
+ && bt->is_child (this->ctx_->scope ()))
+ {
+ int status = 0;
+ be_visitor_context ctx (*this->ctx_);
+
+ switch (nt)
+ {
+ case AST_Decl::NT_enum:
+ {
+ be_visitor_enum_ch ec_visitor (&ctx);
+ status = bt->accept (&ec_visitor);
+ break;
+ }
+ case AST_Decl::NT_struct:
+ {
+ be_visitor_structure_ch sc_visitor (&ctx);
+ status = bt->accept (&sc_visitor);
+ break;
+ }
+ case AST_Decl::NT_union:
+ {
+ be_visitor_union_ch uc_visitor (&ctx);
+ status = bt->accept (&uc_visitor);
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_ch::"
+ "visit_array - "
+ "array base type codegen failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_nl << be_nl
+ << "typedef ";
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_array_ch::"
+ "visit_array - "
+ "base type decl failed\n"),
+ -1);
+ }
+
+ *os << " ";
+
+ 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.
+ *os << "_";
+ }
+
+ *os << node->local_name ();
+
+ if (node->gen_dimensions (os) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_array_ch::"
+ "visit_array - "
+ "gen dimensions failed\n"),
+ -1);
+ }
+
+ *os << ";" << be_nl;
+
+ // Now define the slice type and other required operations
+ *os << "typedef ";
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_array_ch::"
+ "visit_array - "
+ "base type decl failed\n"),
+ -1);
+ }
+
+ *os << " ";
+
+ char anon_p [2];
+ ACE_OS::memset (anon_p,
+ '\0',
+ 2);
+
+ if (this->ctx_->tdef ())
+ {
+ anon_p[0] = '\0';
+ }
+ else
+ {
+ ACE_OS::sprintf (anon_p,
+ "_");
+ }
+
+ *os << anon_p << node->local_name () << "_slice";
+
+ if (node->gen_dimensions (os, 1) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_array_ch::"
+ "visit_array - "
+ "gen slice dimensions failed\n"),
+ -1);
+ }
+
+ *os << ";";
+
+ *os << be_nl
+ << "struct " << anon_p << node->nested_type_name (scope, "_tag")
+ << " {};" << be_nl;
+
+ // No _var or _out class for an anonymous (non-typedef'd) array.
+ if (td != 0)
+ {
+ // Generate _var class decl.
+ // An _out decl is generated only for a variable size array.
+ if (node->size_type () == AST_Type::VARIABLE)
+ {
+ *os << be_nl << be_nl
+ << "typedef" << be_idt_nl
+ << "TAO_VarArray_Var_T<" << be_idt << be_idt_nl
+ << node->local_name () << "," << be_nl
+ << node->local_name () << "_slice," << be_nl
+ << node->local_name () << "_tag" << be_uidt_nl
+ << ">" << be_uidt_nl
+ << node->local_name () << "_var;" << be_uidt;
+
+ *os << be_nl << be_nl
+ << "typedef" << be_idt_nl
+ << "TAO_Array_Out_T<" << be_idt << be_idt_nl
+ << node->local_name () << "," << be_nl
+ << node->local_name () << "_var," << be_nl
+ << node->local_name () << "_slice," << be_nl
+ << node->local_name () << "_tag" << be_uidt_nl
+ << ">" << be_uidt_nl
+ << node->local_name () << "_out;" << be_uidt;
+ }
+ else
+ {
+ *os << be_nl << be_nl
+ << "typedef" << be_idt_nl
+ << "TAO_FixedArray_Var_T<" << be_idt << be_idt_nl
+ << node->local_name () << "," << be_nl
+ << node->local_name () << "_slice," << be_nl
+ << node->local_name () << "_tag" << be_uidt_nl
+ << ">" << be_uidt_nl
+ << node->local_name () << "_var;" << be_uidt;
+
+ *os << be_nl << be_nl
+ << "typedef" << be_idt_nl << node->local_name () << be_nl
+ << node->local_name () << "_out;" << be_uidt;
+ }
+ }
+
+ // Generate _forany decl.
+ *os << be_nl << be_nl
+ << "typedef" << be_idt_nl
+ << "TAO_Array_Forany_T<" << be_idt << be_idt_nl
+ << anon_p << node->local_name () << "," << be_nl
+ << anon_p << node->local_name () << "_slice," << be_nl
+ << anon_p << node->local_name () << "_tag" << be_uidt_nl
+ << ">" << be_uidt_nl
+ << anon_p << node->local_name () << "_forany;" << be_uidt;
+
+ *os << be_nl << be_nl;
+
+ // The _alloc, _dup, copy, and free methods. If the node is nested, the
+ // methods become static
+ const char *storage_class = 0;
+
+ if (node->is_nested ())
+ {
+ if (scope->node_type () != AST_Decl::NT_module)
+ {
+ storage_class = "static ";
+ }
+ else
+ {
+ storage_class = "TAO_NAMESPACE_STORAGE_CLASS ";
+ }
+ }
+ else
+ {
+ storage_class = "TAO_EXPORT_MACRO ";
+ }
+
+ if (td != 0)
+ {
+ // Typedefed array.
+ *os << storage_class << node->nested_type_name (scope, "_slice")
+ << " *" << 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 << 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 << 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
+ << "const ";
+ *os << node->nested_type_name (scope, "_slice")
+ << " *_tao_from" << be_uidt_nl
+ << ");" << be_uidt << be_nl;
+ }
+ else
+ {
+ // Anonymous array.
+ *os << storage_class << node->nested_type_name (scope, "_slice", "_")
+ << " *" << 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 << 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 << 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
+ << "const ";
+ *os << node->nested_type_name (scope, "_slice", "_")
+ << " *_tao_from" << be_uidt_nl
+ << ");" << be_uidt;
+ }
+
+ // Generate the endif macro.
+ os->gen_endif ();
+
+ node->cli_hdr_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp b/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp
new file mode 100644
index 00000000000..821748d1328
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp
@@ -0,0 +1,366 @@
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// array_ci.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Arrays in the client inline.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_array,
+ array_ci,
+ "$Id$")
+
+
+// ************************************************************************
+// visitor for array declaration in client inline
+// ************************************************************************
+
+be_visitor_array_ci::be_visitor_array_ci (be_visitor_context *ctx)
+ : be_visitor_array (ctx)
+{
+}
+
+be_visitor_array_ci::~be_visitor_array_ci (void)
+{
+}
+
+int be_visitor_array_ci::visit_array (be_array *node)
+{
+ // Nothing to do if we are imported or code is already generated.
+ if (node->imported () || node->cli_inline_gen ())
+ {
+ return 0;
+ }
+
+ this->ctx_->node (node); // save the array node
+
+ // If we contain an anonymous sequence, generate code for it here.
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
+ AST_Decl::NodeType nt = bt->node_type ();
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_ci::"
+ "visit_array - "
+ "bad base type\n"),
+ -1);
+ }
+
+ if (nt == AST_Decl::NT_sequence)
+ {
+ if (this->gen_anonymous_base_type (bt,
+ TAO_CodeGen::TAO_ROOT_CI)
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_ci::"
+ "visit_array - "
+ "gen_anonymous_base_type failed\n"),
+ -1);
+ }
+ }
+
+ // If the array is an anonymous member and if its element type
+ // is a declaration (not a reference), we must generate code for
+ // the declaration.
+ if (this->ctx_->alias () == 0 // Not a typedef.
+ && bt->is_child (this->ctx_->scope ()))
+ {
+ int status = 0;
+ be_visitor_context ctx (*this->ctx_);
+
+ switch (nt)
+ {
+ case AST_Decl::NT_struct:
+ {
+ be_visitor_structure_ci sc_visitor (&ctx);
+ status = bt->accept (&sc_visitor);
+ break;
+ }
+ case AST_Decl::NT_union:
+ {
+ be_visitor_union_ci uc_visitor (&ctx);
+ status = bt->accept (&uc_visitor);
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_ch::"
+ "visit_array - "
+ "array base type codegen failed\n"),
+ -1);
+ }
+ }
+
+ // To hold the full and local.
+ char fname [NAMEBUFSIZE];
+ char lname [NAMEBUFSIZE];
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+ ACE_OS::memset (lname,
+ '\0',
+ NAMEBUFSIZE);
+
+ if (this->ctx_->tdef ())
+ {
+ // Typedefed node.
+ ACE_OS::sprintf (fname, "%s",
+ node->full_name ());
+ ACE_OS::sprintf (lname, "%s",
+ node->local_name ()->get_string ());
+ }
+ 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.
+ 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 (),
+ node->local_name ()->get_string ());
+ ACE_OS::sprintf (lname,
+ "_%s",
+ node->local_name ()->get_string ());
+ }
+ else
+ {
+ ACE_OS::sprintf (fname,
+ "_%s",
+ node->full_name ());
+ ACE_OS::sprintf (lname,
+ "_%s",
+ node->local_name ()->get_string ());
+ }
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Generate the array traits specialization definitions,
+ // guarded by #ifdef on unaliased array element type and length.
+
+ ACE_CString unique;
+
+ if (nt == AST_Decl::NT_typedef)
+ {
+ be_typedef *td = be_typedef::narrow_from_decl (bt);
+ unique = td->primitive_base_type ()->flat_name ();
+ }
+ else
+ {
+ unique = bt->flat_name ();
+ }
+
+ char buf[NAMEBUFSIZE];
+ unsigned long i;
+
+ for (i = 0; i < node->n_dims (); ++i)
+ {
+ ACE_OS::memset (buf,
+ '\0',
+ NAMEBUFSIZE);
+ ACE_OS::sprintf (buf,
+ "_%ld",
+ node->dims ()[i]->ev ()->u.ulval);
+ unique += buf;
+ }
+
+ unique += "_traits";
+
+ *os << be_nl << be_nl
+ << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << "TAO::Array_Traits<" << fname << "_forany>::free ("
+ << be_idt << be_idt_nl
+ << fname << "_slice * _tao_slice" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << fname << "_free (_tao_slice);" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "ACE_INLINE" << be_nl
+ << fname << "_slice *" << be_nl
+ << "TAO::Array_Traits<" << fname << "_forany>::dup ("
+ << be_idt << be_idt_nl
+ << "const " << fname << "_slice * _tao_slice" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return " << fname << "_dup (_tao_slice);" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << "TAO::Array_Traits<" << fname << "_forany>::copy ("
+ << be_idt << be_idt_nl
+ << fname << "_slice * _tao_to," << be_nl
+ << "const " << fname << "_slice * _tao_from" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << fname << "_copy (_tao_to, _tao_from);" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << "TAO::Array_Traits<" << fname << "_forany>::zero ("
+ << be_idt << be_idt_nl
+ << fname << "_slice * _tao_slice" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ unsigned long ndims = node->n_dims ();
+ be_array *primitive_type = 0;
+
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ {
+ // Base type of the array node is a typedef. We need to make sure that
+ // this typedef is not to another array type. If it is, then we cannot
+ // assign an array to another. We will have to invoke the underlying
+ // array type's copy method for every array dimension.
+
+ // There may be more than one level of typedef.
+ be_type *tmp = bt;
+
+ while (tmp->node_type () == AST_Decl::NT_typedef)
+ {
+ be_typedef *tdef = be_typedef::narrow_from_decl (tmp);
+ tmp = be_type::narrow_from_decl (tdef->base_type ());
+ }
+
+ primitive_type = be_array::narrow_from_decl (tmp);
+ }
+
+ *os << "// Zero each individual element." << be_nl;
+
+ // 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];
+
+ if ((expr == 0) || ((expr != 0) && (expr->ev () == 0)))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cs::"
+ "visit_array - "
+ "bad array dimension\n"),
+ -1);
+ }
+
+ if (expr->ev ()->et == AST_Expression::EV_ulong)
+ {
+ // Generate a loop for each dimension.
+ *os << "for ( ::CORBA::ULong i" << i << " = 0; i" << i << " < "
+ << expr->ev ()->u.ulval << "; ++i" << i << ")" << be_idt_nl
+ << "{" << be_idt_nl;
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cs::"
+ "visit_array - "
+ "bad array dimension value\n"),
+ -1);
+ }
+ }
+
+ if (primitive_type)
+ {
+ // The base type is a typedef to another array type, so
+ // we use the base type's copy method.
+ *os << "// call the underlying _zero" << be_nl;
+
+ * os << "TAO::Array_Traits< ";
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_array_cs::"
+ "visit_array - "
+ "base type decl failed\n"),
+ -1);
+ }
+
+ * os << "_forany";
+
+ * os << ">::";
+
+ *os << "zero (_tao_slice";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[i" << i << "]";
+ }
+
+ *os << ");";
+ }
+ else
+ {
+ // The base type is not a typedef to possibly another array type. In
+ // such a case, assign each element.
+
+ *os << "_tao_slice";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[i" << i << "]";
+ }
+
+ *os << " = ";
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_array_ch::"
+ "visit_array - "
+ "base type decl failed\n"),
+ -1);
+ }
+
+ *os << " ();";
+ }
+
+ for (i = 0; i < ndims; ++i)
+ {
+ // Add closing braces as many times as the number of dimensions.
+ *os << be_uidt_nl << "}" << be_uidt;
+ }
+ *os << be_uidt_nl << "}";
+
+ *os << be_nl << be_nl
+ << "ACE_INLINE" << be_nl
+ << fname << "_slice *" << be_nl
+ << "TAO::Array_Traits<" << fname << "_forany>::alloc (void)"
+ << be_idt << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return " << fname << "_alloc ();" << be_uidt_nl
+ << "}";
+
+ *os << be_nl;
+
+ node->cli_inline_gen (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_array/array_cs.cpp b/TAO/TAO_IDL/be/be_visitor_array/array_cs.cpp
new file mode 100644
index 00000000000..0dd7f2a54d2
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_array/array_cs.cpp
@@ -0,0 +1,358 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// array_cs.cpp
+//
+// = DESCRIPTION
+// Visitor for code generation of Arrays in the client stubs
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_array,
+ array_cs,
+ "$Id$")
+
+// ************************************************************************
+// visitor for array declaration in client stubs
+// ************************************************************************
+
+be_visitor_array_cs::be_visitor_array_cs (be_visitor_context *ctx)
+ : be_visitor_array (ctx)
+{
+}
+
+be_visitor_array_cs::~be_visitor_array_cs (void)
+{
+}
+
+int be_visitor_array_cs::visit_array (be_array *node)
+{
+ // Nothing to do if we are imported or code is already generated.
+ if (node->imported () || (node->cli_stub_gen ()))
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ unsigned long i;
+ this->ctx_->node (node);
+
+ // Retrieve the type.
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_array_cs::"
+ "visit_array - "
+ "Bad base type\n"),
+ -1);
+ }
+
+ // To hold the full and local.
+ char fname [NAMEBUFSIZE];
+ char lname [NAMEBUFSIZE];
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+ ACE_OS::memset (lname,
+ '\0',
+ NAMEBUFSIZE);
+
+ if (this->ctx_->tdef ())
+ {
+ // Typedefed node.
+ ACE_OS::sprintf (fname, "%s",
+ node->full_name ());
+ ACE_OS::sprintf (lname, "%s",
+ node->local_name ()->get_string ());
+ }
+ 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.
+ 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 (),
+ node->local_name ()->get_string ());
+ ACE_OS::sprintf (lname,
+ "_%s",
+ node->local_name ()->get_string ());
+ }
+ else
+ {
+ ACE_OS::sprintf (fname,
+ "_%s",
+ node->full_name ());
+ ACE_OS::sprintf (lname,
+ "_%s",
+ node->local_name ()->get_string ());
+ }
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << 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 =" << be_idt_nl
+ << fname << "_alloc ();" << be_uidt_nl << be_nl;
+ *os << "if (!_tao_dup_array)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return static_cast <" << 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 << "}" << be_nl << be_nl;
+
+ // alloc method.
+ *os << fname << "_slice *" << be_nl;
+ *os << fname << "_alloc (void)" << be_nl;
+ *os << "{" << be_idt_nl;
+ *os << fname << "_slice *retval = 0;" << be_nl;
+ *os << "ACE_NEW_RETURN (retval, ";
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_array_cs::"
+ "visit_array - "
+ "base type decl failed\n"),
+ -1);
+ }
+
+ if (node->gen_dimensions (os) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cs::"
+ "visit_array - "
+ "dimensions codegen failed\n"),
+ -1);
+ }
+
+ *os << ", 0);" << be_nl;
+ *os << "return retval;" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+
+ // free method.
+ *os << "void" << be_nl
+ << fname << "_free (" << be_idt << be_idt_nl
+ << fname << "_slice *_tao_slice" << be_uidt_nl
+ << ")" << be_uidt_nl;
+ *os << "{" << be_idt_nl;
+ *os << "delete [] _tao_slice;" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+
+ // copy method.
+ *os << "void " << 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;
+
+ unsigned long ndims = node->n_dims ();
+
+ // 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];
+
+ if ((expr == 0) || ((expr != 0) && (expr->ev () == 0)))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cs::"
+ "visit_array - "
+ "bad array dimension\n"),
+ -1);
+ }
+
+ if (expr->ev ()->et == AST_Expression::EV_ulong)
+ {
+ // Generate a loop for each dimension.
+ *os << "for ( ::CORBA::ULong i" << i << " = 0; i" << i << " < "
+ << expr->ev ()->u.ulval << "; ++i" << i << ")" << be_idt_nl
+ << "{" << be_idt_nl;
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cs::"
+ "visit_array - "
+ "bad array dimension value\n"),
+ -1);
+ }
+ }
+
+ // Now generate code such that every element of the array gets assigned
+ // inside the innermost level of the nested loops generated above.
+ be_array *primitive_type = 0;
+
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ {
+ // Base type of the array node is a typedef. We need to make sure that
+ // this typedef is not to another array type. If it is, then we cannot
+ // assign an array to another. We will have to invoke the underlying
+ // array type's copy method for every array dimension.
+
+ // There may be more than one level of typedef.
+ be_type *tmp = bt;
+
+ while (tmp->node_type () == AST_Decl::NT_typedef)
+ {
+ be_typedef *tdef = be_typedef::narrow_from_decl (tmp);
+ tmp = be_type::narrow_from_decl (tdef->base_type ());
+ }
+
+ primitive_type = be_array::narrow_from_decl (tmp);
+ }
+
+ if (primitive_type)
+ {
+ // The base type is a typedef to another array type, so
+ // we use the base type's copy method.
+ *os << "// call the underlying _copy" << be_nl;
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_array_cs::"
+ "visit_array - "
+ "base type decl failed\n"),
+ -1);
+ }
+
+ *os << "_copy (_tao_to";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[i" << i << "]";
+ }
+
+ *os << ", ";
+ *os << "_tao_from";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[i" << i << "]";
+ }
+
+ *os << ");";
+ }
+ else
+ {
+ // The base type is not a typedef to possibly another array type. In
+ // such a case, assign each element.
+
+ *os << "_tao_to";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[i" << i << "]";
+ }
+
+ *os << " = ";
+ *os << "_tao_from";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[i" << i << "]";
+ }
+
+ *os << ";";
+ }
+
+ for (i = 0; i < ndims; ++i)
+ {
+ // Add closing braces as many times as the number of dimensions.
+ *os << be_uidt_nl << "}" << be_uidt;
+ }
+
+ *os << be_uidt_nl << "}";
+
+ AST_Decl::NodeType nt = bt->node_type ();
+
+ // If we contain an anonymous sequence,
+ // generate code for the sequence here.
+ if (nt == AST_Decl::NT_sequence)
+ {
+ if (this->gen_anonymous_base_type (bt,
+ TAO_CodeGen::TAO_ROOT_CS)
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cs::"
+ "visit_array - "
+ "gen_anonymous_base_type failed\n"),
+ -1);
+ }
+ }
+
+ // If the member's element type
+ // is a declaration (not a reference), we must generate code for
+ // the declaration.
+ if (this->ctx_->alias () == 0 // Not a typedef.
+ && bt->is_child (this->ctx_->scope ()))
+ {
+ int status = 0;
+ be_visitor_context ctx (*this->ctx_);
+
+ switch (nt)
+ {
+ case AST_Decl::NT_enum:
+ {
+ be_visitor_enum_cs ec_visitor (&ctx);
+ status = bt->accept (&ec_visitor);
+ break;
+ }
+ case AST_Decl::NT_struct:
+ {
+ be_visitor_structure_cs sc_visitor (&ctx);
+ status = bt->accept (&sc_visitor);
+ break;
+ }
+ case AST_Decl::NT_union:
+ {
+ be_visitor_union_cs uc_visitor (&ctx);
+ status = bt->accept (&uc_visitor);
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_ch::"
+ "visit_array - "
+ "array base type codegen failed\n"),
+ -1);
+ }
+ }
+
+ node->cli_stub_gen (true);
+ 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
new file mode 100644
index 00000000000..f8dc7f1965e
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ch.cpp
@@ -0,0 +1,159 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor for code generation of Arrays for the Cdr operators in the client
+// header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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
+// ***************************************************************************
+
+be_visitor_array_cdr_op_ch::be_visitor_array_cdr_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_array_cdr_op_ch::~be_visitor_array_cdr_op_ch (void)
+{
+}
+
+int
+be_visitor_array_cdr_op_ch::visit_array (be_array *node)
+{
+ if (node->cli_hdr_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 ());
+ AST_Decl::NodeType nt = bt->node_type ();
+
+ // If the node is an array of anonymous sequence, we need to
+ // generate the sequence's cdr operator declaration here.
+ if (nt == AST_Decl::NT_sequence && bt->anonymous ())
+ {
+ be_visitor_sequence_cdr_op_ch visitor (this->ctx_);
+
+ if (bt->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_array_cdr_op_ch::"
+ "visit_array - "
+ "accept on anonymous base type failed\n"),
+ -1);
+ }
+ }
+
+ // If the array is an anonymous member and if its element type
+ // is a declaration (not a reference), we must generate code for
+ // the declaration.
+ if (this->ctx_->alias () == 0 && // Not a typedef.
+ bt->is_child (this->ctx_->scope ()))
+ {
+ int status = 0;
+ be_visitor_context ctx (*this->ctx_);
+
+ switch (nt)
+ {
+ case AST_Decl::NT_enum:
+ {
+ be_visitor_enum_cdr_op_ch ec_visitor (&ctx);
+ status = bt->accept (&ec_visitor);
+ break;
+ }
+ case AST_Decl::NT_struct:
+ {
+ be_visitor_structure_cdr_op_ch sc_visitor (&ctx);
+ status = bt->accept (&sc_visitor);
+ break;
+ }
+ case AST_Decl::NT_union:
+ {
+ be_visitor_union_cdr_op_ch uc_visitor (&ctx);
+ status = bt->accept (&uc_visitor);
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_ch::"
+ "visit_array - "
+ "array base type codegen failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ // Generate the CDR << and >> operator declarations.
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
+ << " operator<< (TAO_OutputCDR &strm, const ";
+
+ if (!this->ctx_->tdef ())
+ {
+ be_scope* scope = be_scope::narrow_from_scope (node->defined_in ());
+ be_decl* parent = scope->decl ();
+
+ *os << parent->full_name ()
+ << "::_" << node->local_name ()
+ << "_forany &_tao_array);" << be_nl;
+ }
+ else
+ {
+ *os << node->name () << "_forany &_tao_array);" << be_nl;
+ }
+
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator>> (TAO_InputCDR &, ";
+
+ if (!this->ctx_->tdef ())
+ {
+ be_scope* scope = be_scope::narrow_from_scope (node->defined_in ());
+ be_decl* parent = scope->decl ();
+
+ *os << parent->full_name ()
+ << "::_" << node->local_name ()
+ << "_forany &);";
+ }
+ else
+ {
+ *os << node->name () << "_forany &);";
+ }
+
+ *os << be_nl << be_global->core_versioning_end ();
+
+ node->cli_hdr_cdr_op_gen (1);
+ return 0;
+}
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
new file mode 100644
index 00000000000..262dce2236d
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_cs.cpp
@@ -0,0 +1,795 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor for code generation of Arrays for the CDR operators in the client
+// stubs.
+//
+// = AUTHOR
+// Jeff Parsons <parsons@cs.wustl.edu>
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_array,
+ cdr_op_cs,
+ "$Id$")
+
+// ***************************************************************************
+// Array visitor for generating CDR operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_array_cdr_op_cs::be_visitor_array_cdr_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_array_cdr_op_cs::~be_visitor_array_cdr_op_cs (void)
+{
+}
+
+int
+be_visitor_array_cdr_op_cs::visit_array (be_array *node)
+{
+ if (this->ctx_->alias ())
+ {
+ // We are here because we are visiting base type
+ // of the array node which is itself an
+ // array, i.e., this is a case of array of array.
+ return this->visit_node (node);
+ }
+
+ if (node->cli_stub_cdr_op_gen ()
+ || node->imported ()
+ || node->is_local ())
+ {
+ return 0;
+ }
+
+ // Retrieve the base type.
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
+ AST_Decl::NodeType nt = bt->node_type ();
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cdr_op_cs::"
+ "visit_array - "
+ "Bad base type\n"),
+ -1);
+ }
+
+ // If we contain an anonymous sequence,
+ // generate code for the sequence here.
+
+ if (nt == AST_Decl::NT_sequence)
+ {
+ if (this->gen_anonymous_base_type (bt,
+ TAO_CodeGen::TAO_ROOT_CDR_OP_CS)
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cdr_op_cs::"
+ "visit_array - "
+ "gen_anonymous_base_type failed\n"),
+ -1);
+ }
+ }
+
+ // If the array is an anonymous member and if its element type
+ // is a declaration (not a reference), we must generate code for
+ // the declaration.
+ if (this->ctx_->alias () == 0 // Not a typedef.
+ && bt->is_child (this->ctx_->scope ()))
+ {
+ int status = 0;
+ be_visitor_context ctx (*this->ctx_);
+
+ switch (nt)
+ {
+ case AST_Decl::NT_enum:
+ {
+ be_visitor_enum_cdr_op_cs ec_visitor (&ctx);
+ status = bt->accept (&ec_visitor);
+ break;
+ }
+ case AST_Decl::NT_struct:
+ {
+ be_visitor_structure_cdr_op_cs sc_visitor (&ctx);
+ status = bt->accept (&sc_visitor);
+ break;
+ }
+ case AST_Decl::NT_union:
+ {
+ be_visitor_union_cdr_op_cs uc_visitor (&ctx);
+ status = bt->accept (&uc_visitor);
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_ch::"
+ "visit_array - "
+ "array base type codegen failed\n"),
+ -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
+
+ // 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_->tdef ())
+ {
+ ACE_OS::sprintf (fname, "%s", node->full_name ());
+ }
+ 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.
+
+ 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 (),
+ node->local_name ()->get_string ());
+ }
+ else
+ {
+ ACE_OS::sprintf (fname,
+ "_%s",
+ node->full_name ());
+ }
+ }
+
+ // Generate the CDR << and >> operator defns.
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << 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 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)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_array_cdr_op_cs::"
+ "visit_array - "
+ "Base type codegen failed\n"),
+ -1);
+ }
+
+ *os << "}" << be_nl << be_nl;
+
+ this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_INPUT);
+ *os << "::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)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_array_cdr_op_cs::"
+ "visit_array - "
+ "Base type codegen failed\n"),
+ -1);
+ }
+
+ *os << "}";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ node->cli_stub_cdr_op_gen (1);
+ return 0;
+}
+
+// Handle all the base types.
+
+int
+be_visitor_array_cdr_op_cs::visit_enum (be_enum *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array_cdr_op_cs::visit_interface (be_interface *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array_cdr_op_cs::visit_interface_fwd (be_interface_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array_cdr_op_cs::visit_valuebox (be_valuebox *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array_cdr_op_cs::visit_valuetype (be_valuetype *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array_cdr_op_cs::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array_cdr_op_cs::visit_predefined_type (be_predefined_type *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
+ case AST_PredefinedType::PT_value:
+ 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_array_cdr_op_cs::"
+ "visit_predefined_type - "
+ "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 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.
+
+ unsigned long i;
+
+ // Grab the array node.
+ be_array *array = this->ctx_->be_node_as_array ();
+
+ if (!node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cdr_op_cs::"
+ "visit_predefined_type - "
+ "bad array node\n"),
+ -1);
+ }
+
+ // We generate optimized code based on an optimized interface available from
+ // the CDR class. These optimizations are applicable only to primitive
+ // types.
+ *os << "return" << be_idt_nl
+ << "strm.";
+
+ // 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:
+ *os << "read_";
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "write_";
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cdr_op_cs::"
+ "visit_predefined_type - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ // Determine what kind of array are we reading/writing.
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_long:
+ *os << "long_array";
+ break;
+ case AST_PredefinedType::PT_ulong:
+ *os << "ulong_array";
+ break;
+ case AST_PredefinedType::PT_short:
+ *os << "short_array";
+ break;
+ case AST_PredefinedType::PT_ushort:
+ *os << "ushort_array";
+ break;
+ case AST_PredefinedType::PT_octet:
+ *os << "octet_array";
+ break;
+ case AST_PredefinedType::PT_char:
+ *os << "char_array";
+ break;
+ case AST_PredefinedType::PT_wchar:
+ *os << "wchar_array";
+ break;
+ case AST_PredefinedType::PT_float:
+ *os << "float_array";
+ break;
+ case AST_PredefinedType::PT_double:
+ *os << "double_array";
+ break;
+ case AST_PredefinedType::PT_longlong:
+ *os << "longlong_array";
+ break;
+ case AST_PredefinedType::PT_ulonglong:
+ *os << "ulonglong_array";
+ break;
+ case AST_PredefinedType::PT_longdouble:
+ *os << "longdouble_array";
+ break;
+ case AST_PredefinedType::PT_boolean:
+ *os << "boolean_array";
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cdr_op_cs::"
+ "visit_predefined_type - "
+ "bad primitive type for optimized code gen\n"),
+ -1);
+ }
+
+ // Handle special case to avoid compiler errors.
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ *os << " (" << be_idt << be_idt_nl
+ << "reinterpret_cast <";
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << " (" << be_idt << be_idt_nl
+ << "reinterpret_cast <const ";
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cdr_op_cs::"
+ "visit_predefined_type - "
+ "bad substate in context\n"),
+ -1);
+ }
+
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_long:
+ *os << "ACE_CDR::Long";
+ break;
+ case AST_PredefinedType::PT_ulong:
+ *os << "ACE_CDR::ULong";
+ break;
+ case AST_PredefinedType::PT_short:
+ *os << "ACE_CDR::Short";
+ break;
+ case AST_PredefinedType::PT_ushort:
+ *os << "ACE_CDR::UShort";
+ break;
+ case AST_PredefinedType::PT_octet:
+ *os << "ACE_CDR::Octet";
+ break;
+ case AST_PredefinedType::PT_char:
+ *os << "ACE_CDR::Char";
+ break;
+ case AST_PredefinedType::PT_wchar:
+ *os << "ACE_CDR::WChar";
+ break;
+ case AST_PredefinedType::PT_float:
+ *os << "ACE_CDR::Float";
+ break;
+ case AST_PredefinedType::PT_double:
+ *os << "ACE_CDR::Double";
+ break;
+ case AST_PredefinedType::PT_longlong:
+ *os << "ACE_CDR::LongLong";
+ break;
+ case AST_PredefinedType::PT_ulonglong:
+ *os << "ACE_CDR::ULongLong";
+ break;
+ case AST_PredefinedType::PT_longdouble:
+ *os << "ACE_CDR::LongDouble";
+ break;
+ case AST_PredefinedType::PT_boolean:
+ *os << "ACE_CDR::Boolean";
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cdr_op_cs::"
+ "visit_predefined_type - "
+ "bad primitive type for optimized code gen\n"),
+ -1);
+ }
+
+ // Handle special case to avoid compiler errors.
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ *os << " *> (_tao_array.out ())," << be_nl;
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << " *> (_tao_array.in ())," << be_nl;
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cdr_op_cs::"
+ "visit_predefined_type - "
+ "bad substate in context\n"),
+ -1);
+ }
+
+ 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 == 0) || ((expr != 0) && (expr->ev () == 0)))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cdr_op_cs::"
+ "visit_predefined_type - "
+ "bad array dimension\n"),
+ -1);
+ }
+
+ if (i != 0)
+ {
+ // Do not generate the multiplication operator the first time in.
+ *os << "*";
+ }
+
+ if (expr->ev ()->et == AST_Expression::EV_ulong)
+ {
+ // Generate a loop for each dimension.
+ *os << expr->ev ()->u.ulval;
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cdr_op_cs::"
+ "visit_predefined_type - "
+ "bad array dimension value\n"),
+ -1);
+ }
+ }
+
+ *os << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl;
+
+ return 0;
+}
+
+int
+be_visitor_array_cdr_op_cs::visit_sequence (be_sequence *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array_cdr_op_cs::visit_string (be_string *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array_cdr_op_cs::visit_structure (be_structure *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array_cdr_op_cs::visit_union (be_union *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array_cdr_op_cs::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_array_cdr_op_cs::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+// Helper.
+int
+be_visitor_array_cdr_op_cs::visit_node (be_type *bt)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ unsigned long i;
+ be_array *node = this->ctx_->be_node_as_array ();
+ AST_Decl::NodeType nt = bt->node_type ();
+
+ if (!node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cdr_op_cs::"
+ "visit_node - "
+ "bad array node\n"),
+ -1);
+ }
+
+ // Initialize a boolean variable.
+ *os << "CORBA::Boolean _tao_marshal_flag = true;" << 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 < ndims; ++i)
+ {
+ // Retrieve the ith dimension value.
+ AST_Expression *expr = node->dims ()[i];
+
+ if ((expr == 0) || ((expr != 0) && (expr->ev () == 0)))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cdr_op_cs::"
+ "visit_node - "
+ "bad array dimension\n"),
+ -1);
+ }
+
+ 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 << " < "
+ << expr->ev ()->u.ulval << " && _tao_marshal_flag; ++i" << i
+ << ")" << be_idt_nl
+ << "{" << be_idt;
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cdr_op_cs::"
+ "visit_node - "
+ "bad array dimension value\n"),
+ -1);
+ }
+ }
+
+ // @@ (JP) Need to factor out some of this into method call(s).
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ *os << be_nl;
+
+ // Handle the array of array case, where we need to pass the
+ // forany type.
+ if (nt == AST_Decl::NT_array)
+ {
+ *os << bt->name () << "_forany tmp ("
+ << bt->name () << "_alloc ());" << be_nl;
+ *os << "_tao_marshal_flag = (strm >> tmp);" << be_nl;
+ *os << bt->name () << "_copy (_tao_array";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[i" << i << "]";
+ }
+
+ *os << ", tmp.in ());" << be_nl;
+ *os << bt->name () << "_free (tmp.inout ());";
+ }
+ else
+ {
+ *os << "_tao_marshal_flag = (strm >> ";
+ *os << "_tao_array ";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[i" << i << "]";
+ }
+
+ switch (bt->node_type ())
+ {
+ // The following have a _var type and must be
+ // handled in a special way.
+ case AST_Decl::NT_string:
+ case AST_Decl::NT_wstring:
+ case AST_Decl::NT_valuetype:
+ case AST_Decl::NT_valuetype_fwd:
+ case AST_Decl::NT_valuebox:
+ *os << ".out ()";
+ 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);
+
+ if (!pt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cdr_op_cs::"
+ "visit_node - "
+ "bad predefined type node\n"),
+ -1);
+ }
+
+ AST_PredefinedType::PredefinedType pdt = pt->pt ();
+
+ if (pdt == AST_PredefinedType::PT_pseudo
+ || pdt == AST_PredefinedType::PT_object)
+ {
+ *os << ".out ()";
+ }
+ }
+ default:
+ break;
+ }
+
+ *os << ");";
+ }
+
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << be_nl;
+
+ // Handle the array of array case, where we need to pass the
+ // forany type.
+ if (nt == AST_Decl::NT_array)
+ {
+ *os << bt->name () << "_var tmp_var ("
+ << bt->name () << "_dup (_tao_array";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[i" << i << "]";
+ }
+
+ *os << "));" << be_nl;
+ *os << bt->name () << "_forany tmp (tmp_var.inout ());" << be_nl;
+ *os << "_tao_marshal_flag = (strm << tmp);";
+ }
+ else if (nt == AST_Decl::NT_interface
+ || nt == AST_Decl::NT_interface_fwd)
+ {
+ *os << "_tao_marshal_flag = " << be_idt_nl
+ << "TAO::Objref_Traits<" << bt->name () << ">::"
+ << "marshal (_tao_array";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[i" << i << "]";
+ }
+
+ *os << ".in (), strm);" << be_uidt;
+ }
+ else
+ {
+ *os << "_tao_marshal_flag = (strm << ";
+ *os << "_tao_array ";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[i" << i << "]";
+ }
+
+ switch (bt->node_type ())
+ {
+ // The following have a _var type and must be
+ // handled in a special way.
+ case AST_Decl::NT_string:
+ case AST_Decl::NT_wstring:
+ case AST_Decl::NT_valuetype:
+ case AST_Decl::NT_valuetype_fwd:
+ case AST_Decl::NT_valuebox:
+ *os << ".in ()";
+ 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);
+
+ if (!pt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cdr_op_cs::"
+ "visit_node - "
+ "bad predefined type node\n"),
+ -1);
+ }
+
+ AST_PredefinedType::PredefinedType pdt = pt->pt ();
+
+ if (pdt == AST_PredefinedType::PT_pseudo
+ || pdt == AST_PredefinedType::PT_object)
+ {
+ *os << ".in ()";
+ }
+ }
+ default:
+ break;
+ }
+
+ *os << ");";
+ }
+
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cdr_op_cs::"
+ "visit_node - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ for (i = 0; i < ndims; ++i)
+ {
+ // Decrement indentation as many times as the number of dimensions.
+ *os << be_uidt_nl << "}" << be_uidt;
+ }
+
+ *os << be_nl << be_nl << "return _tao_marshal_flag;" << be_uidt_nl;
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_array/serializer_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_array/serializer_op_ch.cpp
new file mode 100644
index 00000000000..b08bb5db5bf
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_array/serializer_op_ch.cpp
@@ -0,0 +1,166 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor for code generation of Arrays for the
+// TAO::DCPS::Serializer operators in the client header.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_visitor_sequence/serializer_op_ch.h"
+
+ACE_RCSID (be_visitor_array,
+ serializer_op_ch,
+ "$Id$")
+
+// ***************************************************************************
+// Array visitor for generating Serializer operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_array_serializer_op_ch::be_visitor_array_serializer_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_array_serializer_op_ch::~be_visitor_array_serializer_op_ch (void)
+{
+}
+
+
+void
+be_visitor_array_serializer_op_ch::gen_arg_ref(be_array *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (!this->ctx_->tdef ())
+ {
+ be_scope* scope = be_scope::narrow_from_scope (node->defined_in ());
+ be_decl* parent = scope->decl ();
+
+ *os << parent->full_name ()
+ << "::_" << node->local_name ()
+ << "_forany &);" << be_nl;
+ }
+ else
+ {
+ *os << node->name () << "_forany &);" << be_nl;
+ }
+}
+
+int
+be_visitor_array_serializer_op_ch::visit_array (be_array *node)
+{
+ if (node->cli_hdr_serializer_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 ());
+ AST_Decl::NodeType nt = bt->node_type ();
+
+ // If the node is an array of anonymous sequence, we need to
+ // generate the sequence's Serializer operator declaration here.
+ if (nt == AST_Decl::NT_sequence && bt->anonymous ())
+ {
+ be_visitor_sequence_serializer_op_ch visitor (this->ctx_);
+
+ if (bt->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_array_serializer_op_ch::"
+ "visit_array - "
+ "accept on anonymous base type failed\n"),
+ -1);
+ }
+ }
+
+ // If the array is an anonymous member and if its element type
+ // is a declaration (not a reference), we must generate code for
+ // the declaration.
+ if (this->ctx_->alias () == 0 // Not a typedef.
+ && bt->is_child (this->ctx_->scope ()))
+ {
+ int status = 0;
+ be_visitor_context ctx (*this->ctx_);
+
+ switch (nt)
+ {
+ case AST_Decl::NT_enum:
+ {
+ be_visitor_enum_serializer_op_ch ec_visitor (&ctx);
+ status = bt->accept (&ec_visitor);
+ break;
+ }
+ case AST_Decl::NT_struct:
+ {
+ be_visitor_structure_serializer_op_ch sc_visitor (&ctx);
+ status = bt->accept (&sc_visitor);
+ break;
+ }
+ case AST_Decl::NT_union:
+ {
+ be_visitor_union_serializer_op_ch uc_visitor (&ctx);
+ status = bt->accept (&uc_visitor);
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_ch::"
+ "visit_array - "
+ "array base type codegen failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Set the sub state as generating code for the size method
+ *os << be_global->stub_export_macro ()
+ << " size_t _dcps_max_marshaled_size ("
+ << "const ";
+ this->gen_arg_ref(node);
+
+ *os << be_global->stub_export_macro ()
+ << " ::CORBA::Boolean _tao_is_bounded_size ("
+ << "const ";
+ this->gen_arg_ref(node);
+
+ *os << be_global->stub_export_macro ()
+ << " size_t _dcps_find_size ("
+ << "const ";
+ this->gen_arg_ref(node);
+
+ // Generate the Serializer << and >> operator declarations.
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator<< (TAO::DCPS::Serializer &, const ";
+ this->gen_arg_ref(node);
+
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator>> (TAO::DCPS::Serializer &, ";
+ this->gen_arg_ref(node);
+
+ node->cli_hdr_serializer_op_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_array/serializer_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_array/serializer_op_cs.cpp
new file mode 100644
index 00000000000..e5e8505c325
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_array/serializer_op_cs.cpp
@@ -0,0 +1,1227 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor for code generation of Arrays for the
+// TAO::DCPS::Serializer operators in the client stubs.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by
+// Jeff Parsons <parsons@cs.wustl.edu>
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_array,
+ serializer_op_cs,
+ "$Id$")
+
+// ***************************************************************************
+// Array visitor for generating Serializer operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_array_serializer_op_cs::be_visitor_array_serializer_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_array_serializer_op_cs::~be_visitor_array_serializer_op_cs (void)
+{
+}
+
+int
+be_visitor_array_serializer_op_cs::visit_array (be_array *node)
+{
+ if (this->ctx_->alias ())
+ {
+ // We are here because we are visiting base type
+ // of the array node which is itself an
+ // array, i.e., this is a case of array of array.
+ return this->visit_node (node);
+ }
+
+ if (node->cli_stub_serializer_op_gen ()
+ || node->imported ()
+ || node->is_local ())
+ {
+ return 0;
+ }
+
+ // Retrieve the base type.
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
+ AST_Decl::NodeType nt = bt->node_type ();
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_array - "
+ "Bad base type\n"),
+ -1);
+ }
+
+ // If we contain an anonymous sequence,
+ // generate code for the sequence here.
+
+ if (nt == AST_Decl::NT_sequence)
+ {
+ if (this->gen_anonymous_base_type (bt,
+ TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS)
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_array - "
+ "gen_anonymous_base_type failed\n"),
+ -1);
+ }
+ }
+
+ // If the array is an anonymous member and if its element type
+ // is a declaration (not a reference), we must generate code for
+ // the declaration.
+ if (this->ctx_->alias () == 0 // Not a typedef.
+ && bt->is_child (this->ctx_->scope ()))
+ {
+ int status = 0;
+ be_visitor_context ctx (*this->ctx_);
+
+ switch (nt)
+ {
+ case AST_Decl::NT_enum:
+ {
+ be_visitor_enum_serializer_op_cs ec_visitor (&ctx);
+ status = bt->accept (&ec_visitor);
+ break;
+ }
+ case AST_Decl::NT_struct:
+ {
+ be_visitor_structure_serializer_op_cs sc_visitor (&ctx);
+ status = bt->accept (&sc_visitor);
+ break;
+ }
+ case AST_Decl::NT_union:
+ {
+ be_visitor_union_serializer_op_cs uc_visitor (&ctx);
+ status = bt->accept (&uc_visitor);
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_ch::"
+ "visit_array - "
+ "array base type codegen failed\n"),
+ -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
+
+ // 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_->tdef ())
+ {
+ ACE_OS::sprintf (fname, "%s", node->full_name ());
+ }
+ 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.
+
+ 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 (),
+ node->local_name ()->get_string ());
+ }
+ else
+ {
+ ACE_OS::sprintf (fname,
+ "_%s",
+ node->full_name ());
+ }
+ }
+
+ // Generate the Serializer << and >> operator defns.
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Set the sub state as generating code for the size method
+ this->ctx_->sub_state (TAO_CodeGen::TAO_MAX_MARSHALED_SIZE);
+ *os << "size_t _dcps_max_marshaled_size (" << be_idt << be_idt_nl
+ << "const " << fname << "_forany &_tao_array" << be_uidt_nl
+ <<")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_array_serializer_op_cs::"
+ "visit_array - "
+ "Base type codegen failed\n"),
+ -1);
+ }
+
+ *os << "}" << be_nl << be_nl;
+
+ // Set the sub state as generating code for the size method
+ this->ctx_->sub_state (TAO_CodeGen::TAO_IS_BOUNDED_SIZE);
+ *os << "::CORBA::Boolean _tao_is_bounded_size (" << be_idt << be_idt_nl
+ << "const " << fname << "_forany &_tao_array" << be_uidt_nl
+ <<")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_array_serializer_op_cs::"
+ "visit_array - "
+ "Base type codegen failed\n"),
+ -1);
+ }
+
+ *os << "}" << be_nl << be_nl;
+
+ // Set the sub state as generating code for the size method
+ this->ctx_->sub_state (TAO_CodeGen::TAO_FIND_SIZE);
+ *os << "size_t _dcps_find_size (" << be_idt << be_idt_nl
+ << "const " << fname << "_forany &_tao_array" << be_uidt_nl
+ <<")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_array_serializer_op_cs::"
+ "visit_array - "
+ "Base type codegen failed\n"),
+ -1);
+ }
+
+ *os << "}" << 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 operator<< (" << be_idt << be_idt_nl
+ << "TAO::DCPS::Serializer &strm," << be_nl
+ << "const " << fname << "_forany &_tao_array" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_array_serializer_op_cs::"
+ "visit_array - "
+ "Base type codegen failed\n"),
+ -1);
+ }
+
+ *os << "}" << be_nl << be_nl;
+
+ this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_INPUT);
+ *os << "::CORBA::Boolean operator>> (" << be_idt << be_idt_nl
+ << "TAO::DCPS::Serializer &strm," << be_nl
+ << fname << "_forany &_tao_array" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_array_serializer_op_cs::"
+ "visit_array - "
+ "Base type codegen failed\n"),
+ -1);
+ }
+
+ *os << "}";
+
+ node->cli_stub_serializer_op_gen (1);
+ return 0;
+}
+
+// Handle all the base types.
+
+int
+be_visitor_array_serializer_op_cs::visit_enum (be_enum *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ unsigned long i;
+
+ // Grab the array node.
+ be_array *array = this->ctx_->be_node_as_array ();
+
+ if (!node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_predefined_type - "
+ "bad array node\n"),
+ -1);
+ }
+
+ // 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 ())
+ {
+ case TAO_CodeGen::TAO_IS_BOUNDED_SIZE:
+ *os << "ACE_UNUSED_ARG (_tao_array);" << be_nl
+ << "return true; // array of enum" << be_uidt_nl;
+ break;
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ {
+ *os << "ACE_UNUSED_ARG (_tao_array);" << be_nl;
+ *os << "// array of enum = sizeof ( ::CORBA::ULong) * array size" << be_nl
+ << "return _dcps_max_marshaled_size_ulong () * ";
+
+ 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 == 0) || ((expr != 0) && (expr->ev () == 0)))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_predefined_type - "
+ "bad array dimension\n"),
+ -1);
+ }
+
+ if (i != 0)
+ {
+ // Do not generate the multiplication operator the first time in.
+ *os << "*";
+ }
+
+ if (expr->ev ()->et == AST_Expression::EV_ulong)
+ {
+ // Generate a loop for each dimension.
+ *os << expr->ev ()->u.ulval;
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_predefined_type - "
+ "bad array dimension value\n"),
+ -1);
+ }
+ }
+
+ *os << ";" << be_uidt_nl;
+ }
+ break;
+
+ default:
+ return this->visit_node (node);
+ }
+ return 0;
+}
+
+int
+be_visitor_array_serializer_op_cs::visit_interface (be_interface *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array_serializer_op_cs::visit_interface_fwd (be_interface_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array_serializer_op_cs::visit_valuetype (be_valuetype *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array_serializer_op_cs::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array_serializer_op_cs::visit_predefined_type (
+ be_predefined_type *node
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
+ case AST_PredefinedType::PT_value:
+ 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_array_serializer_op_cs::"
+ "visit_predefined_type - "
+ "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 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.
+
+ unsigned long i;
+
+ // Grab the array node.
+ be_array *array = this->ctx_->be_node_as_array ();
+
+ if (!node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_predefined_type - "
+ "bad array node\n"),
+ -1);
+ }
+
+ // 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 ())
+ {
+ case TAO_CodeGen::TAO_IS_BOUNDED_SIZE:
+ // all predefined types are fixed size hence they are bounded.
+ *os << "ACE_UNUSED_ARG(_tao_array);" << be_nl;
+ *os << "return true;" << be_uidt_nl;
+ return 0; // all done - no need to get the array size
+ break;
+
+ // all predefined types are fixed size so
+ // _dcps_find_size() = _dcps_max_marshaled_size
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_octet:
+ *os << "ACE_UNUSED_ARG(_tao_array);" << be_nl;
+ *os << "return (_dcps_max_marshaled_size_octet () *";
+ break;
+ case AST_PredefinedType::PT_char:
+ *os << "ACE_UNUSED_ARG(_tao_array);" << be_nl;
+ *os << "return (_dcps_max_marshaled_size_char () *";
+ break;
+ case AST_PredefinedType::PT_wchar:
+ *os << "ACE_UNUSED_ARG(_tao_array);" << be_nl;
+ *os << "return (_dcps_max_marshaled_size_wchar () *";
+ break;
+ case AST_PredefinedType::PT_long:
+ case AST_PredefinedType::PT_ulong:
+ case AST_PredefinedType::PT_short:
+ case AST_PredefinedType::PT_ushort:
+ case AST_PredefinedType::PT_float:
+ case AST_PredefinedType::PT_double:
+ case AST_PredefinedType::PT_longlong:
+ case AST_PredefinedType::PT_ulonglong:
+ case AST_PredefinedType::PT_longdouble:
+ // array size = slice type size * length
+ // note: *(_tao_array.in ()) is the array's slice; hence base type
+ *os << "return (_dcps_max_marshaled_size (*(_tao_array.in ())) * ";
+ break;
+ break;
+ case AST_PredefinedType::PT_boolean:
+ *os << "ACE_UNUSED_ARG(_tao_array);" << be_nl;
+ *os << "return (_dcps_max_marshaled_size_boolean () *";
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_predefined_type - "
+ "bad primitive type for _dcps_max_marshaled_size code gen\n"),
+ -1);
+ }
+ break;
+
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ {
+ // We generate optimized code based on an optimized interface available from
+ // the Serializer class. These optimizations are applicable only to primitive
+ // types.
+ *os << " return strm.";
+
+ // 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:
+ *os << "read_";
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "write_";
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_predefined_type - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ // Determine what kind of array are we reading/writing.
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_long:
+ *os << "long_array";
+ break;
+ case AST_PredefinedType::PT_ulong:
+ *os << "ulong_array";
+ break;
+ case AST_PredefinedType::PT_short:
+ *os << "short_array";
+ break;
+ case AST_PredefinedType::PT_ushort:
+ *os << "ushort_array";
+ break;
+ case AST_PredefinedType::PT_octet:
+ *os << "octet_array";
+ break;
+ case AST_PredefinedType::PT_char:
+ *os << "char_array";
+ break;
+ case AST_PredefinedType::PT_wchar:
+ *os << "wchar_array";
+ break;
+ case AST_PredefinedType::PT_float:
+ *os << "float_array";
+ break;
+ case AST_PredefinedType::PT_double:
+ *os << "double_array";
+ break;
+ case AST_PredefinedType::PT_longlong:
+ *os << "longlong_array";
+ break;
+ case AST_PredefinedType::PT_ulonglong:
+ *os << "ulonglong_array";
+ break;
+ case AST_PredefinedType::PT_longdouble:
+ *os << "longdouble_array";
+ break;
+ case AST_PredefinedType::PT_boolean:
+ *os << "boolean_array";
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_predefined_type - "
+ "bad primitive type for optimized code gen\n"),
+ -1);
+ }
+
+ // Handle special case to avoid compiler errors.
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ *os << " ((";
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << " ((const ";
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_predefined_type - "
+ "bad substate in context\n"),
+ -1);
+ }
+
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_long:
+ *os << "ACE_CDR::Long *)";
+ break;
+ case AST_PredefinedType::PT_ulong:
+ *os << "ACE_CDR::ULong *)";
+ break;
+ case AST_PredefinedType::PT_short:
+ *os << "ACE_CDR::Short *)";
+ break;
+ case AST_PredefinedType::PT_ushort:
+ *os << "ACE_CDR::UShort *)";
+ break;
+ case AST_PredefinedType::PT_octet:
+ *os << "ACE_CDR::Octet *)";
+ break;
+ case AST_PredefinedType::PT_char:
+ *os << "ACE_CDR::Char *)";
+ break;
+ case AST_PredefinedType::PT_wchar:
+ *os << "ACE_CDR::WChar *)";
+ break;
+ case AST_PredefinedType::PT_float:
+ *os << "ACE_CDR::Float *)";
+ break;
+ case AST_PredefinedType::PT_double:
+ *os << "ACE_CDR::Double *)";
+ break;
+ case AST_PredefinedType::PT_longlong:
+ *os << "ACE_CDR::LongLong *)";
+ break;
+ case AST_PredefinedType::PT_ulonglong:
+ *os << "ACE_CDR::ULongLong *)";
+ break;
+ case AST_PredefinedType::PT_longdouble:
+ *os << "ACE_CDR::LongDouble *)";
+ break;
+ case AST_PredefinedType::PT_boolean:
+ *os << "ACE_CDR::Boolean *)";
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_predefined_type - "
+ "bad primitive type for optimized code gen\n"),
+ -1);
+ }
+
+ // Handle special case to avoid compiler errors.
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ *os << " _tao_array.out (), ";
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "_tao_array.in (), ";
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_predefined_type - "
+ "bad substate in context\n"),
+ -1);
+ }
+ } // end TAO_CDR_INPUT/OUTPUT specific code.
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // This is done in serializer_op_cs and hacked into *.i.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_predefined_type - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ 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 == 0) || ((expr != 0) && (expr->ev () == 0)))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_predefined_type - "
+ "bad array dimension\n"),
+ -1);
+ }
+
+ if (i != 0)
+ {
+ // Do not generate the multiplication operator the first time in.
+ *os << "*";
+ }
+
+ if (expr->ev ()->et == AST_Expression::EV_ulong)
+ {
+ // Generate a loop for each dimension.
+ *os << expr->ev ()->u.ulval;
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_predefined_type - "
+ "bad array dimension value\n"),
+ -1);
+ }
+ }
+
+ *os << ");" << be_uidt_nl;
+
+ return 0;
+}
+
+int
+be_visitor_array_serializer_op_cs::visit_sequence (be_sequence *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array_serializer_op_cs::visit_string (be_string *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array_serializer_op_cs::visit_structure (be_structure *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array_serializer_op_cs::visit_union (be_union *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array_serializer_op_cs::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_array_serializer_op_cs::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+// Helper.
+int
+be_visitor_array_serializer_op_cs::visit_node (be_type *bt)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ unsigned long i;
+ be_array *node = this->ctx_->be_node_as_array ();
+ AST_Decl::NodeType nt = bt->node_type ();
+
+ if (!node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_node - "
+ "bad array node\n"),
+ -1);
+ }
+
+ unsigned long ndims = node->n_dims ();
+
+ AST_Decl::NodeType bnt = bt->node_type ();
+
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_IS_BOUNDED_SIZE:
+ switch (bnt)
+ {
+ case AST_Decl::NT_string:
+ case AST_Decl::NT_wstring:
+ {
+ be_string *str =
+ be_string::narrow_from_decl (bt);
+
+ if (!str)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_node - "
+ "bad string node\n"),
+ -1);
+ }
+
+ *os << "ACE_UNUSED_ARG(_tao_array);" << be_nl;
+ if (0 == str->max_size ()->ev ()->u.ulval)
+ *os << "return false; // array of unbounded string";
+ else
+ *os << "return true; // array of bounded string ";
+ }
+ break;
+ case AST_Decl::NT_array:
+ *os << "// use ULong instead of literal to avoid overload ambiguity"
+ << be_nl << "::CORBA::ULong first = 0;" << be_nl
+ << "// must use forany instead of a slice to avoid overload ambiguity"
+ << be_nl
+ << bt->name () << "_var tmp_var ("
+ << bt->name () << "_dup (_tao_array";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[first]";
+ }
+
+ *os << "));" << be_nl;
+ *os << bt->name () << "_forany tmp (tmp_var.inout ());" << be_nl;
+ *os << "return _tao_is_bounded_size (tmp);";
+ break;
+ default:
+ *os << "return _tao_is_bounded_size (*(_tao_array.in ()));";
+ break;
+ }
+ *os << be_uidt_nl;
+ break;
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ {
+ switch (bnt)
+ {
+ case AST_Decl::NT_string:
+ case AST_Decl::NT_wstring:
+ {
+ be_string *str =
+ be_string::narrow_from_decl (bt);
+
+ if (!str)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_node - "
+ "bad string node\n"),
+ -1);
+ }
+ *os << "ACE_UNUSED_ARG(_tao_array);" << be_nl;
+ char buff[15];
+ ACE_OS::sprintf(buff, "%ld", str->max_size ()->ev ()->u.ulval);
+ *os << "return _dcps_max_marshaled_size_ulong () + (" << buff;
+ }
+ break;
+ case AST_Decl::NT_array:
+ *os << "// use ULong instead of literal to avoid overload ambiguity"
+ << be_nl << "::CORBA::ULong first = 0;" << be_nl
+ << "// must use forany instead of a slice to avoid overload ambiguity"
+ << be_nl
+ << bt->name () << "_var tmp_var ("
+ << bt->name () << "_dup (_tao_array";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[first]";
+ }
+
+ *os << "));" << be_nl;
+ *os << bt->name () << "_forany tmp (tmp_var.inout ());" << be_nl;
+ *os << "return (_dcps_max_marshaled_size (tmp)";
+ break;
+ default:
+ // array size = slice type size * length
+ // note: *(_tao_array.in ()) is the array's slice; hence base type
+ *os << "return (_dcps_max_marshaled_size (*(_tao_array.in ()))";
+ break;
+ }
+ *os << " * ";
+
+ //SHH - TBD - this array dim size code could be common
+ // 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 = node->dims ()[i];
+
+ if ((expr == 0) || ((expr != 0) && (expr->ev () == 0)))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_node - "
+ "bad array dimension\n"),
+ -1);
+ }
+
+ if (i != 0)
+ {
+ // Do not generate the multiplication operator the first time in.
+ *os << "*";
+ }
+
+ if (expr->ev ()->et == AST_Expression::EV_ulong)
+ {
+ // Generate a loop for each dimension.
+ *os << expr->ev ()->u.ulval;
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_node - "
+ "bad array dimension value\n"),
+ -1);
+ }
+ }
+
+ *os << ");" << be_uidt_nl;
+
+ }
+ break;
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ {
+ if (TAO_CodeGen::TAO_FIND_SIZE == this->ctx_->sub_state ())
+ {
+ *os << "//iterate over the array to find the current size" << be_nl
+ << "size_t the_length = 0;" << be_nl;
+ }
+ else
+ {
+ // Initialize a boolean variable.
+ *os << "::CORBA::Boolean _tao_marshal_flag = true;" << 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 < ndims; ++i)
+ {
+ // Retrieve the ith dimension value.
+ AST_Expression *expr = node->dims ()[i];
+
+ if ((expr == 0) || ((expr != 0) && (expr->ev () == 0)))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_node - "
+ "bad array dimension\n"),
+ -1);
+ }
+
+ 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 << " < "
+ << expr->ev ()->u.ulval;
+
+ if (TAO_CodeGen::TAO_FIND_SIZE != this->ctx_->sub_state ())
+ *os << " && _tao_marshal_flag";
+
+ *os << "; i" << i
+ << "++)" << be_idt_nl
+ << "{" << be_idt;
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_node - "
+ "bad array dimension value\n"),
+ -1);
+ }
+ }
+
+ // @@ (JP) Need to factor out some of this into method call(s).
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ {
+ *os << be_nl;
+ if (AST_Decl::NT_array == bnt)
+ {
+ *os << bt->name () << "_var tmp_var ("
+ << bt->name () << "_dup (_tao_array";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[i" << i << "]";
+ }
+
+ *os << "));" << be_nl;
+ *os << bt->name () << "_forany tmp (tmp_var.inout ());" << be_nl;
+ *os << "the_length += _dcps_find_size (tmp);";
+ }
+ else
+ {
+ if (AST_Decl::NT_string == bnt ||
+ AST_Decl::NT_wstring == bnt )
+ *os << "the_length += _dcps_max_marshaled_size_ulong() + "
+ << "ACE_OS::strlen(_tao_array";
+ else
+ *os << "the_length += _dcps_find_size (_tao_array";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[i" << i << "]";
+ }
+ if (AST_Decl::NT_string == bnt ||
+ AST_Decl::NT_wstring == bnt )
+ *os << ".in()";
+
+ *os << ");";
+ }
+ }
+ break;
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ *os << be_nl;
+
+ // Handle the array of array case, where we need to pass the
+ // forany type.
+ if (nt == AST_Decl::NT_array)
+ {
+ *os << bt->name () << "_forany tmp ("
+ << bt->name () << "_alloc ());" << be_nl;
+ *os << "_tao_marshal_flag = (strm >> tmp);" << be_nl;
+ *os << bt->name () << "_copy (_tao_array";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[i" << i << "]";
+ }
+
+ *os << ", tmp.in ());" << be_nl;
+ *os << bt->name () << "_free (tmp.inout ());";
+ }
+ else
+ {
+ *os << "_tao_marshal_flag = (strm >> ";
+ *os << "_tao_array ";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[i" << i << "]";
+ }
+
+ switch (bt->node_type ())
+ {
+ // The following have a _var type and must be
+ // handled in a special way.
+ case AST_Decl::NT_string:
+ case AST_Decl::NT_wstring:
+ case AST_Decl::NT_valuetype:
+ case AST_Decl::NT_valuetype_fwd:
+ *os << ".out ()";
+ 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);
+
+ if (!pt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_node - "
+ "bad predefined type node\n"),
+ -1);
+ }
+
+ AST_PredefinedType::PredefinedType pdt = pt->pt ();
+
+ if (pdt == AST_PredefinedType::PT_pseudo
+ || pdt == AST_PredefinedType::PT_object)
+ {
+ *os << ".out ()";
+ }
+ }
+ default:
+ break;
+ }
+
+ *os << ");";
+ }
+
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << be_nl;
+
+ // Handle the array of array case, where we need to pass the
+ // forany type.
+ if (nt == AST_Decl::NT_array)
+ {
+ *os << bt->name () << "_var tmp_var ("
+ << bt->name () << "_dup (_tao_array";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[i" << i << "]";
+ }
+
+ *os << "));" << be_nl;
+ *os << bt->name () << "_forany tmp (tmp_var.inout ());" << be_nl;
+ *os << "_tao_marshal_flag = (strm << tmp);";
+ }
+ else if (nt == AST_Decl::NT_interface
+ || nt == AST_Decl::NT_interface_fwd)
+ {
+ *os << "_tao_marshal_flag = " << be_idt_nl;
+
+ if (bt->is_defined ())
+ {
+ *os << "_tao_array";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[i" << i << "]";
+ }
+
+ *os << ".in ()->marshal (strm);" << be_uidt;
+ }
+ else
+ {
+
+ AST_Decl *parent =
+ ScopeAsDecl (bt->defined_in ());
+
+ if (parent != 0 && parent->node_type () != AST_Decl::NT_root)
+ {
+ *os << parent->name () << "::";
+ }
+
+ *os << "TAO::Objref_Traits<" << bt->name () << ">::"
+ << "tao_marshal (_tao_array";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[i" << i << "]";
+ }
+
+ *os << ".in (), strm);" << be_uidt;
+ }
+ }
+ else
+ {
+ *os << "_tao_marshal_flag = (strm << ";
+ *os << "_tao_array ";
+
+ for (i = 0; i < ndims; ++i)
+ {
+ *os << "[i" << i << "]";
+ }
+
+ switch (bt->node_type ())
+ {
+ // The following have a _var type and must be
+ // handled in a special way.
+ case AST_Decl::NT_string:
+ case AST_Decl::NT_wstring:
+ case AST_Decl::NT_valuetype:
+ case AST_Decl::NT_valuetype_fwd:
+ *os << ".in ()";
+ 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);
+
+ if (!pt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_node - "
+ "bad predefined type node\n"),
+ -1);
+ }
+
+ AST_PredefinedType::PredefinedType pdt = pt->pt ();
+
+ if (pdt == AST_PredefinedType::PT_pseudo
+ || pdt == AST_PredefinedType::PT_object)
+ {
+ *os << ".in ()";
+ }
+ }
+ default:
+ break;
+ }
+
+ *os << ");";
+ }
+
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_node - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ for (i = 0; i < ndims; ++i)
+ {
+ // Decrement indentation as many times as the number of dimensions.
+ *os << be_uidt_nl << "}" << be_uidt;
+ }
+
+ if (TAO_CodeGen::TAO_FIND_SIZE == this->ctx_->sub_state ())
+ {
+ *os << be_nl << be_nl << "return the_length;" << be_uidt_nl;
+ }
+ else
+ {
+ *os << be_nl << be_nl << "return _tao_marshal_flag;" << be_uidt_nl;
+ }
+
+ } // end INPUT/OUTPUT_CDR case
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_node outter- "
+ "bad sub state\n"),
+ -1);
+ } // end outer switch
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_attribute.cpp b/TAO/TAO_IDL/be/be_visitor_attribute.cpp
new file mode 100644
index 00000000000..2e0ff1dc96c
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_attribute.cpp
@@ -0,0 +1,41 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_attribute.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Attribute
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_attribute.h"
+#include "be_operation.h"
+#include "be_predefined_type.h"
+#include "be_argument.h"
+
+#include "be_visitor_attribute.h"
+#include "be_visitor_context.h"
+#include "be_visitor_operation.h"
+
+#include "ast_generator.h"
+#include "utl_identifier.h"
+#include "utl_exceptlist.h"
+#include "global_extern.h"
+#include "ace/Log_Msg.h"
+
+#include "be_visitor_attribute/attribute.cpp"
+
+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
new file mode 100644
index 00000000000..93bcd6f9c2e
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp
@@ -0,0 +1,431 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// attribute.cpp
+//
+// = DESCRIPTION
+// Visitor for generation of code for Attribute
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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
+// attribute.
+//
+// code generation for attributes is achieved by mapping an attribute node to
+// a corresponding operation node. The reason is that we do not want to
+// duplicate the code. However, an attribute node and an operation node have
+// different interfaces. Hence we need some form of an adapter that can take us
+// from an attribute node to an operation node. The following paragraph
+// describes how this is accomplished.
+//
+// For a "get" operation on the attribute, we create an operation node with the
+// same name as the attribute and a return type which is the same as the type
+// of the attribute. This operation has no arguments.
+//
+// For a "set" operation on the attribute (if it is not readonly), we create an
+// operation node with a "void" return type and an "in" parameter of the same
+// type as the attribute.
+
+// In both cases the context will hold sufficient information to indicate that
+// the operation node is really an attribute node.
+
+// *************************************************************************
+// primary visitor for "attribute". The context state decides the next state
+// *************************************************************************
+
+be_visitor_attribute::be_visitor_attribute (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_attribute::~be_visitor_attribute (void)
+{
+}
+
+int
+be_visitor_attribute::visit_attribute (be_attribute *node)
+{
+ this->ctx_->node (node);
+ this->ctx_->attribute (node);
+
+
+ // first the "get" operation
+ 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 ());
+
+ UTL_ExceptList *get_exceptions = node->get_get_exceptions ();
+
+ if (0 != get_exceptions)
+ {
+ get_op.be_add_exceptions (get_exceptions->copy ());
+ }
+
+ // Get the strategy from the attribute and hand it over
+ // to the operation.
+ be_operation_strategy *old_strategy =
+ get_op.set_strategy (node->get_get_strategy ()->copy ());
+
+ if (0 != old_strategy)
+ {
+ old_strategy->destroy ();
+ delete old_strategy;
+ old_strategy = 0;
+ }
+
+ be_visitor_context ctx (*this->ctx_);
+ int status = 1;
+
+ switch (this->ctx_->state ())
+ {
+ // These two cases are the only ones that could involved a strategy.
+ case TAO_CodeGen::TAO_ROOT_CH:
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ ctx.state (TAO_CodeGen::TAO_OPERATION_CH);
+ break;
+ case TAO_CodeGen::TAO_ROOT_CS:
+ ctx.state (TAO_CodeGen::TAO_OPERATION_CS);
+ break;
+ case TAO_CodeGen::TAO_ROOT_SH:
+ {
+ be_visitor_operation_sh visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_IH:
+ {
+ be_visitor_operation_ih visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SS:
+ {
+ be_visitor_operation_ss visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_IS:
+ {
+ be_visitor_operation_is visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
+ {
+ be_visitor_operation_proxy_impl_xh visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS:
+ {
+ be_visitor_operation_direct_proxy_impl_ss visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
+ {
+ be_visitor_operation_smart_proxy_ch visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
+ {
+ be_visitor_operation_smart_proxy_cs visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_TIE_SH:
+ {
+ be_visitor_operation_tie_sh visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_TIE_SI:
+ {
+ be_visitor_operation_tie_si visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
+ default:
+ get_op.destroy ();
+ return 0;
+ }
+
+ if (status == -1)
+ {
+ get_op.destroy ();
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_attribute::"
+ "visit_attribute - "
+ "codegen for get_attribute failed\n"),
+ -1);
+ }
+ else if (status == 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 || (get_op.accept (visitor) == -1))
+ {
+ delete visitor;
+ visitor = 0;
+ get_op.destroy ();
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_attribute::"
+ "visit_attribute - "
+ "codegen for get_attribute failed\n"),
+ -1);
+ }
+
+ delete visitor;
+ visitor = 0;
+
+ 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;
+ visitor = 0;
+ get_op.destroy ();
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_attribute::"
+ "visit_attribute - "
+ "codegen for get_attribute failed\n"),
+ -1);
+ }
+
+ delete visitor;
+ visitor = 0;
+ }
+ }
+
+ get_op.destroy ();
+
+ // Do nothing for readonly attributes.
+ if (node->readonly ())
+ {
+ return 0;
+ }
+
+ status = 1;
+
+ // 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.
+ AST_Argument *arg =
+ idl_global->gen ()->create_argument (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);
+
+ UTL_ExceptList *set_exceptions = node->get_set_exceptions ();
+
+ if (0 != set_exceptions)
+ {
+ set_op.be_add_exceptions (set_exceptions->copy ());
+ }
+
+ // Get the strategy from the attribute and hand it over
+ // to the operation, thereby deleting the old one.
+ old_strategy =
+ set_op.set_strategy (node->get_set_strategy ()->copy ());
+
+ if (0 != old_strategy)
+ {
+ old_strategy->destroy ();
+ delete old_strategy;
+ old_strategy = 0;
+ }
+
+ ctx = *this->ctx_;
+ status = 1;
+
+ switch (this->ctx_->state ())
+ {
+ // These two cases are the only ones that could involved a strategy.
+ case TAO_CodeGen::TAO_ROOT_CH:
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ ctx.state (TAO_CodeGen::TAO_OPERATION_CH);
+ break;
+ case TAO_CodeGen::TAO_ROOT_CS:
+ ctx.state (TAO_CodeGen::TAO_OPERATION_CS);
+ break;
+ case TAO_CodeGen::TAO_ROOT_SH:
+ {
+ be_visitor_operation_sh visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_IH:
+ {
+ be_visitor_operation_ih visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SS:
+ {
+ be_visitor_operation_ss visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_IS:
+ {
+ be_visitor_operation_is visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
+ {
+ be_visitor_operation_proxy_impl_xh visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS:
+ {
+ be_visitor_operation_direct_proxy_impl_ss visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
+ {
+ be_visitor_operation_smart_proxy_ch visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
+ {
+ be_visitor_operation_smart_proxy_cs visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_TIE_SH:
+ {
+ be_visitor_operation_tie_sh visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_TIE_SI:
+ {
+ be_visitor_operation_tie_si visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
+ default:
+ // Error.
+ set_op.destroy ();
+ rt.destroy ();
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_attribute::"
+ "visit_attribute - "
+ "bad codegen state\n"),
+ -1);
+ }
+
+ if (status == 0)
+ {
+ set_op.destroy ();
+ rt.destroy ();
+ return 0;
+ }
+ else if (status == -1)
+ {
+ set_op.destroy ();
+ rt.destroy ();
+ 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 (set_op.next_state (ctx.state ()));
+ be_visitor *visitor = tao_cg->make_visitor (&ctx);
+
+ if (!visitor || (set_op.accept (visitor) == -1))
+ {
+ delete visitor;
+ visitor = 0;
+ set_op.destroy ();
+ rt.destroy ();
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_attribute::"
+ "visit_attribute - "
+ "codegen for set_attribute failed\n"),
+ -1);
+ }
+
+ delete visitor;
+ visitor = 0;
+
+ if (set_op.has_extra_code_generation (ctx.state ()))
+ {
+ // Change the state depending on the kind of node strategy
+ ctx.state (set_op.next_state (ctx.state (), 1));
+
+ visitor = tao_cg->make_visitor (&ctx);
+
+ if (!visitor || (set_op.accept (visitor) == -1))
+ {
+ delete visitor;
+ visitor = 0;
+ set_op.destroy ();
+ rt.destroy ();
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_attribute::"
+ "visit_attribute - "
+ "codegen for set_attribute failed\n"),
+ -1);
+ }
+
+ delete visitor;
+ visitor = 0;
+ }
+
+ set_op.destroy ();
+ rt.destroy ();
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
new file mode 100644
index 00000000000..a1268a29bec
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
@@ -0,0 +1,1922 @@
+/**
+ * @file be_visitor_ccm_pre_proc.cpp
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons
+ */
+//=============================================================================
+
+#include "be_visitor_ccm_pre_proc.h"
+#include "be_visitor_context.h"
+#include "be_root.h"
+#include "be_operation.h"
+#include "be_argument.h"
+#include "be_exception.h"
+#include "be_structure.h"
+#include "be_sequence.h"
+#include "be_valuetype.h"
+#include "be_module.h"
+#include "be_field.h"
+#include "be_typedef.h"
+#include "be_component.h"
+#include "be_eventtype.h"
+#include "be_eventtype_fwd.h"
+#include "be_home.h"
+#include "be_extern.h"
+#include "ast_generator.h"
+#include "utl_exceptlist.h"
+#include "utl_namelist.h"
+#include "utl_err.h"
+#include "fe_interface_header.h"
+#include "global_extern.h"
+#include "nr_extern.h"
+
+ACE_RCSID (be,
+ be_visitor_ccm_pre_proc,
+ "$Id$")
+
+const char *EXCEP_NAMES[] =
+ {
+ "AlreadyConnected",
+ "InvalidConnection",
+ "NoConnection",
+ "ExceededConnectionLimit",
+ "CreateFailure",
+ "RemoveFailure",
+ "FinderFailure",
+ "InvalidKey",
+ "UnknownKeyValue",
+ "DuplicateKeyValue",
+ "CreateFailure",
+ "FinderFailure"
+ };
+
+const int N_EXCEPS = sizeof (EXCEP_NAMES) / sizeof (char *);
+be_exception *EXCEPS[N_EXCEPS];
+
+be_visitor_ccm_pre_proc::be_visitor_ccm_pre_proc (be_visitor_context *ctx)
+ : be_visitor_scope (ctx),
+ module_id_ ("Components"),
+ cookie_ (0),
+ already_connected_ (0),
+ invalid_connection_ (0),
+ no_connection_ (0),
+ exceeded_connection_limit_ (0),
+ create_failure_ (0),
+ remove_failure_ (0),
+ finder_failure_ (0),
+ invalid_key_ (0),
+ unknown_key_value_ (0),
+ duplicate_key_value_ (0)
+{
+}
+
+be_visitor_ccm_pre_proc::~be_visitor_ccm_pre_proc (void)
+{
+ this->module_id_.destroy ();
+}
+
+int
+be_visitor_ccm_pre_proc::visit_root (be_root *node)
+{
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "visit_root - visit scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::visit_module (be_module *node)
+{
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "visit_module - visit scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::visit_component (be_component *node)
+{
+ if (this->lookup_cookie (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "visit_component - "
+ "Components::Cookie lookup failed\n"),
+ -1);
+ }
+
+ if (this->lookup_exceptions (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "visit_component - "
+ "component exception lookups failed\n"),
+ -1);
+ }
+
+ if (this->gen_provides (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "visit_component - "
+ "code generation for provides declarations failed\n"),
+ -1);
+ }
+
+ if (this->gen_uses (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "visit_component - "
+ "code generation for uses declarations failed\n"),
+ -1);
+ }
+
+ if (this->gen_emits (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "visit_component - "
+ "code generation for emits declarations failed\n"),
+ -1);
+ }
+
+ if (this->gen_publishes (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "visit_component - "
+ "code generation for publishes declarations failed\n"),
+ -1);
+ }
+
+ if (this->gen_consumes (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "visit_component - "
+ "code generation for consumes declarations failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::visit_home (be_home *node)
+{
+ AST_Interface *xplicit = this->create_explicit (node);
+
+ if (xplicit == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "visit_home - "
+ "code generation for explicit interface failed\n"),
+ -1);
+ }
+
+ AST_Interface *implicit = this->create_implicit (node);
+
+ if (implicit == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "visit_home - "
+ "code generation for implicit interface failed\n"),
+ -1);
+ }
+
+ if (this->gen_factories (node, xplicit) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "visit_home - "
+ "code generation for factories declarations failed\n"),
+ -1);
+ }
+
+ if (this->gen_finders (node, xplicit) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "visit_home - "
+ "code generation for finders declarations failed\n"),
+ -1);
+ }
+
+ if (this->gen_implicit_ops (node, implicit) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "visit_home - "
+ "code generation for primary key "
+ "operations failed\n"),
+ -1);
+ }
+
+ if (this->create_equivalent (node, xplicit, implicit) == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "visit_home - "
+ "code generation for equivalent interface failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::visit_eventtype (be_eventtype *node)
+{
+ if (node->ccm_pre_proc_gen ())
+ {
+ return 0;
+ }
+
+ if (this->create_event_consumer (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "visit_eventtype - "
+ "code generation for consumer failed\n"),
+ -1);
+ }
+
+ node->ccm_pre_proc_gen (true);
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::visit_eventtype_fwd (be_eventtype_fwd *node)
+{
+ be_eventtype *fd =
+ be_eventtype::narrow_from_decl (node->full_definition ());
+
+ return this->visit_eventtype (fd);
+}
+
+// ****************************************************************
+
+int
+be_visitor_ccm_pre_proc::gen_provides (be_component *node)
+{
+ ACE_Unbounded_Queue<AST_Component::port_description> &s = node->provides ();
+ AST_Component::port_description *pd = 0;
+ AST_Operation *provides_op = 0;
+
+ for (ACE_Unbounded_Queue_Iterator<AST_Component::port_description> iter (s);
+ ! iter.done ();
+ iter.advance ())
+ {
+ iter.next (pd);
+ UTL_ScopedName *op_name =
+ this->create_scoped_name ("provide_",
+ pd->id->get_string (),
+ 0,
+ node);
+ ACE_NEW_RETURN (provides_op,
+ be_operation (pd->impl,
+ AST_Operation::OP_noflags,
+ 0,
+ 0,
+ 0),
+ -1);
+ provides_op->set_defined_in (node);
+ provides_op->set_imported (node->imported ());
+ provides_op->set_name (op_name);
+
+ if (0 == node->be_add_operation (provides_op))
+ {
+ return -1;
+ }
+
+ // Might as well clean up here instead of putting 5 loops in
+ // AST_Component::destroy ().
+ pd->id->destroy ();
+ delete pd->id;
+ pd->id = 0;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_uses (be_component *node)
+{
+ ACE_Unbounded_Queue<AST_Component::port_description> &s = node->uses ();
+ AST_Component::port_description *pd = 0;
+
+ for (ACE_Unbounded_Queue_Iterator<AST_Component::port_description> iter (s);
+ ! iter.done ();
+ iter.advance ())
+ {
+ iter.next (pd);
+
+ if (pd->is_multiple == false)
+ {
+ if (this->gen_connect_single (node, pd) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_uses - "
+ "gen_connect_single failed\n"),
+ -1);
+ }
+
+ if (this->gen_disconnect_single (node, pd) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_uses - "
+ "gen_disconnect_single failed\n"),
+ -1);
+ }
+
+ if (this->gen_get_connection_single (node, pd) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_uses - "
+ "gen_get_connection_single failed\n"),
+ -1);
+ }
+ }
+ else
+ {
+ if (this->gen_connect_multiple (node, pd) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_uses - "
+ "gen_connect_multiple failed\n"),
+ -1);
+ }
+
+ if (this->gen_disconnect_multiple (node, pd) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_uses - "
+ "gen_disconnect_multiple failed\n"),
+ -1);
+ }
+
+ if (this->gen_get_connection_multiple (node, pd) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_uses - "
+ "gen_get_connection_single failed\n"),
+ -1);
+ }
+ }
+
+ // Might as well clean up here instead of putting 5 loops in
+ // AST_Component::destroy ().
+ pd->id->destroy ();
+ delete pd->id;
+ pd->id = 0;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_emits (be_component *node)
+{
+ ACE_Unbounded_Queue<AST_Component::port_description> &s = node->emits ();
+ AST_Component::port_description *pd = 0;
+
+ for (ACE_Unbounded_Queue_Iterator<AST_Component::port_description> iter (s);
+ ! iter.done ();
+ iter.advance ())
+ {
+ iter.next (pd);
+
+ if (this->gen_emits_connect (node, pd) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_emits - "
+ "gen_emits_connect failed\n"),
+ -1);
+ }
+
+ if (this->gen_emits_disconnect (node, pd) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_emits - "
+ "gen_emits_disconnect failed\n"),
+ -1);
+ }
+
+ // Might as well clean up here instead of putting 5 loops in
+ // AST_Component::destroy ().
+ pd->id->destroy ();
+ delete pd->id;
+ pd->id = 0;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_publishes (be_component *node)
+{
+ ACE_Unbounded_Queue<AST_Component::port_description> &s = node->publishes ();
+ AST_Component::port_description *pd = 0;
+
+ for (ACE_Unbounded_Queue_Iterator<AST_Component::port_description> iter (s);
+ ! iter.done ();
+ iter.advance ())
+ {
+ iter.next (pd);
+
+ if (this->gen_subscribe (node, pd) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_publishes - "
+ "gen_subscribe failed\n"),
+ -1);
+ }
+
+ if (this->gen_unsubscribe (node, pd) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_publishes - "
+ "gen_unsubscribe failed\n"),
+ -1);
+ }
+
+ // Might as well clean up here instead of putting 5 loops in
+ // AST_Component::destroy ().
+ pd->id->destroy ();
+ delete pd->id;
+ pd->id = 0;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_consumes (be_component *node)
+{
+ ACE_Unbounded_Queue<AST_Component::port_description> &s = node->consumes ();
+ AST_Component::port_description *pd = 0;
+
+ for (ACE_Unbounded_Queue_Iterator<AST_Component::port_description> iter (s);
+ ! iter.done ();
+ iter.advance ())
+ {
+ iter.next (pd);
+
+ if (this->gen_get_consumer (node, pd) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_consumes - "
+ "gen_consumes_get_connection failed\n"),
+ -1);
+ }
+
+ // Might as well clean up here instead of putting 5 loops in
+ // AST_Component::destroy ().
+ pd->id->destroy ();
+ delete pd->id;
+ pd->id = 0;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_factories (be_home *node,
+ AST_Interface *xplicit)
+{
+ AST_Operation **item = 0;
+
+ for (ACE_Unbounded_Queue_Iterator<AST_Operation *> i (node->factories ());
+ ! i.done ();
+ i.advance ())
+ {
+ i.next (item);
+ (*item)->set_defined_in (xplicit);
+ UTL_ScopedName *new_name =
+ this->create_scoped_name (0,
+ (*item)->local_name ()->get_string (),
+ 0,
+ xplicit);
+ (*item)->set_name (new_name);
+
+ if ((*item)->be_insert_exception (this->create_failure_) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_factories - "
+ "exception insertion failed\n"),
+ -1);
+ }
+
+ if (0 == xplicit->be_add_operation (*item))
+ {
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_finders (be_home *node,
+ AST_Interface *xplicit)
+{
+ AST_Operation **item = 0;
+
+ for (ACE_Unbounded_Queue_Iterator<AST_Operation *> i (node->finders ());
+ ! i.done ();
+ i.advance ())
+ {
+ i.next (item);
+ (*item)->set_defined_in (xplicit);
+ UTL_ScopedName *new_name =
+ this->create_scoped_name (0,
+ (*item)->local_name ()->get_string (),
+ 0,
+ xplicit);
+ (*item)->set_name (new_name);
+
+ if ((*item)->be_insert_exception (this->finder_failure_) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_factories - "
+ "exception insertion failed\n"),
+ -1);
+ }
+
+ if (0 == xplicit->be_add_operation (*item))
+ {
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_implicit_ops (be_home *node,
+ AST_Interface *implicit)
+{
+ if (this->gen_create (node, implicit) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_implicit_ops - "
+ "gen_create failed\n"),
+ -1);
+ }
+
+ AST_ValueType *pk = node->primary_key ();
+
+ if (pk == 0)
+ {
+ return 0;
+ }
+
+ if (this->gen_find_by_primary_key (node, implicit) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_implicit_ops - "
+ "gen_find_by_primary_key failed\n"),
+ -1);
+ }
+
+ if (this->gen_remove (node, implicit) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_implicit_ops - "
+ "gen_remove failed\n"),
+ -1);
+ }
+
+ if (this->gen_get_primary_key (node, implicit) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_implicit_ops - "
+ "gen_get_primary_key failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+// **************************************************************
+
+int
+be_visitor_ccm_pre_proc::gen_connect_single (
+ be_component *node,
+ AST_Component::port_description *pd
+ )
+{
+ if (pd == 0)
+ {
+ return -1;
+ }
+
+ UTL_ScopedName *op_full_name =
+ this->create_scoped_name ("connect_",
+ pd->id->get_string (),
+ 0,
+ node);
+ be_operation *op = 0;
+ ACE_NEW_RETURN (op,
+ be_operation (be_global->void_type (),
+ AST_Operation::OP_noflags,
+ 0,
+ 0,
+ 0),
+ -1);
+ op->set_defined_in (node);
+ op->set_imported (node->imported ());
+ op->set_name (op_full_name);
+ Identifier arg_id ("conxn");
+ UTL_ScopedName arg_name (&arg_id,
+ 0);
+ be_argument *arg = 0;
+ ACE_NEW_RETURN (arg,
+ be_argument (AST_Argument::dir_IN,
+ pd->impl,
+ &arg_name),
+ -1);
+ arg_id.destroy ();
+ op->be_add_argument (arg);
+
+ UTL_ExceptList *tail = 0;
+ ACE_NEW_RETURN (tail,
+ UTL_ExceptList (this->invalid_connection_,
+ 0),
+ -1);
+ UTL_ExceptList *connect_single = 0;
+ ACE_NEW_RETURN (connect_single,
+ UTL_ExceptList (this->already_connected_,
+ tail),
+ -1);
+ op->be_add_exceptions (connect_single);
+
+ if (0 == node->be_add_operation (op))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_disconnect_single (
+ be_component *node,
+ AST_Component::port_description *pd
+ )
+{
+ if (pd == 0)
+ {
+ return -1;
+ }
+
+ UTL_ScopedName *op_full_name =
+ this->create_scoped_name ("disconnect_",
+ pd->id->get_string (),
+ 0,
+ node);
+ be_operation *op = 0;
+ ACE_NEW_RETURN (op,
+ be_operation (pd->impl,
+ AST_Operation::OP_noflags,
+ 0,
+ 0,
+ 0),
+ -1);
+ op->set_name (op_full_name);
+ op->set_defined_in (node);
+ op->set_imported (node->imported ());
+ UTL_ExceptList *disconnect_single = 0;
+ ACE_NEW_RETURN (disconnect_single,
+ UTL_ExceptList (this->no_connection_,
+ 0),
+ -1);
+ op->be_add_exceptions (disconnect_single);
+
+ if (0 == node->be_add_operation (op))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_get_connection_single (
+ be_component *node,
+ AST_Component::port_description *pd
+ )
+{
+ if (pd == 0)
+ {
+ return -1;
+ }
+
+ UTL_ScopedName *op_full_name =
+ this->create_scoped_name ("get_connection_",
+ pd->id->get_string (),
+ 0,
+ node);
+ be_operation *op = 0;
+ ACE_NEW_RETURN (op,
+ be_operation (pd->impl,
+ AST_Operation::OP_noflags,
+ 0,
+ 0,
+ 0),
+ -1);
+ op->set_name (op_full_name);
+ op->set_defined_in (node);
+
+ if (0 == node->be_add_operation (op))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_connect_multiple (
+ be_component *node,
+ AST_Component::port_description *pd
+ )
+{
+ if (pd == 0)
+ {
+ return -1;
+ }
+
+ UTL_ScopedName *op_full_name =
+ this->create_scoped_name ("connect_",
+ pd->id->get_string (),
+ 0,
+ node);
+
+ be_operation *op = 0;
+ ACE_NEW_RETURN (op,
+ be_operation (this->cookie_,
+ AST_Operation::OP_noflags,
+ 0,
+ 0,
+ 0),
+ -1);
+ op->set_name (op_full_name);
+ op->set_defined_in (node);
+ op->set_imported (node->imported ());
+ Identifier arg_id ("connection");
+ UTL_ScopedName arg_name (&arg_id,
+ 0);
+ be_argument *arg = 0;
+ ACE_NEW_RETURN (arg,
+ be_argument (AST_Argument::dir_IN,
+ pd->impl,
+ &arg_name),
+ -1);
+ arg_id.destroy ();
+ op->be_add_argument (arg);
+ UTL_ExceptList *tail = 0;
+ ACE_NEW_RETURN (tail,
+ UTL_ExceptList (this->invalid_connection_,
+ 0),
+ -1);
+ UTL_ExceptList *connect_multiple = 0;
+ ACE_NEW_RETURN (connect_multiple,
+ UTL_ExceptList (this->exceeded_connection_limit_,
+ tail),
+ -1);
+ op->be_add_exceptions (connect_multiple);
+
+ if (0 == node->be_add_operation (op))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_disconnect_multiple (
+ be_component *node,
+ AST_Component::port_description *pd
+ )
+{
+ if (pd == 0)
+ {
+ return -1;
+ }
+
+ UTL_ScopedName *op_full_name =
+ this->create_scoped_name ("disconnect_",
+ pd->id->get_string (),
+ 0,
+ node);
+ be_operation *op = 0;
+ ACE_NEW_RETURN (op,
+ be_operation (pd->impl,
+ AST_Operation::OP_noflags,
+ 0,
+ 0,
+ 0),
+ -1);
+ op->set_name (op_full_name);
+ op->set_defined_in (node);
+ op->set_imported (node->imported ());
+ Identifier arg_id ("ck");
+ UTL_ScopedName arg_name (&arg_id,
+ 0);
+ be_argument *arg = 0;
+ ACE_NEW_RETURN (arg,
+ be_argument (AST_Argument::dir_IN,
+ this->cookie_,
+ &arg_name),
+ -1);
+ arg_id.destroy ();
+ op->be_add_argument (arg);
+ UTL_ExceptList *disconnect_multiple = 0;
+ ACE_NEW_RETURN (disconnect_multiple,
+ UTL_ExceptList (this->invalid_connection_,
+ 0),
+ -1);
+ op->be_add_exceptions (disconnect_multiple);
+
+ if (0 == node->be_add_operation (op))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_get_connection_multiple (
+ be_component *node,
+ AST_Component::port_description *pd
+ )
+{
+ if (pd == 0)
+ {
+ return -1;
+ }
+
+ UTL_ScopedName *op_full_name =
+ this->create_scoped_name ("get_connections_",
+ pd->id->get_string (),
+ 0,
+ node);
+
+ // Look up the implied IDL typedef created in the front end.
+ // It will be the return type of the created operation.
+ ACE_CString connections_string (pd->id->get_string ());
+ connections_string += "Connections";
+ Identifier connections_id (connections_string.c_str ());
+ UTL_ScopedName connections_name (&connections_id,
+ 0);
+ AST_Decl *d = node->lookup_by_name (&connections_name,
+ true);
+ be_typedef *td = be_typedef::narrow_from_decl (d);
+ connections_id.destroy ();
+
+ be_operation *op = 0;
+ ACE_NEW_RETURN (op,
+ be_operation (td,
+ AST_Operation::OP_noflags,
+ 0,
+ 0,
+ 0),
+ -1);
+ op->set_name (op_full_name);
+ op->set_defined_in (node);
+ op->set_imported (node->imported ());
+
+ if (0 == node->be_add_operation (op))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_push_op (be_eventtype *node,
+ AST_Interface *consumer)
+{
+ UTL_ScopedName *op_full_name =
+ this->create_scoped_name ("push_",
+ node->local_name (),
+ 0,
+ consumer);
+ be_operation *push_op = 0;
+ ACE_NEW_RETURN (push_op,
+ be_operation (be_global->void_type (),
+ AST_Operation::OP_noflags,
+ 0,
+ false,
+ false),
+ -1);
+ push_op->set_defined_in (consumer);
+ push_op->set_imported (node->imported ());
+ push_op->set_name (op_full_name);
+ ACE_CString arg_string ("the_",
+ 0,
+ 0);
+ arg_string += node->local_name ();
+ Identifier arg_id (arg_string.fast_rep ());
+ UTL_ScopedName arg_name (&arg_id,
+ 0);
+ be_argument *arg = 0;
+ ACE_NEW_RETURN (arg,
+ be_argument (AST_Argument::dir_IN,
+ node,
+ &arg_name),
+ -1);
+ arg_id.destroy ();
+ push_op->be_add_argument (arg);
+
+ if (0 == consumer->be_add_operation (push_op))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_subscribe (be_component *node,
+ AST_Component::port_description *pd)
+{
+ UTL_ScopedName *op_name =
+ this->create_scoped_name ("subscribe_",
+ pd->id->get_string (),
+ 0,
+ node);
+ be_operation *op = 0;
+ ACE_NEW_RETURN (op,
+ be_operation (this->cookie_,
+ AST_Operation::OP_noflags,
+ 0,
+ 0,
+ 0),
+ -1);
+ op->set_defined_in (node);
+ op->set_imported (node->imported ());
+ op->set_name (op_name);
+
+ AST_Interface *i = this->lookup_consumer (pd);
+
+ if (i == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_subscribe - "
+ "consumer lookup failed\n"),
+ -1);
+ }
+
+ Identifier arg_id ("consumer");
+ UTL_ScopedName arg_name (&arg_id,
+ 0);
+ be_argument *arg = 0;
+ ACE_NEW_RETURN (arg,
+ be_argument (AST_Argument::dir_IN,
+ i,
+ &arg_name),
+ -1);
+ op->be_add_argument (arg);
+ UTL_ExceptList *subscribe = 0;
+ ACE_NEW_RETURN (subscribe,
+ UTL_ExceptList (this->exceeded_connection_limit_,
+ 0),
+ -1);
+ op->be_add_exceptions (subscribe);
+
+ if (0 == node->be_add_operation (op))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_unsubscribe (be_component *node,
+ AST_Component::port_description *pd)
+{
+ AST_Interface *i = this->lookup_consumer (pd);
+
+ if (i == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_unsubscribe - "
+ "consumer lookup failed\n"),
+ -1);
+ }
+
+ UTL_ScopedName *op_name =
+ this->create_scoped_name ("unsubscribe_",
+ pd->id->get_string (),
+ 0,
+ node);
+ be_operation *op = 0;
+ ACE_NEW_RETURN (op,
+ be_operation (i,
+ AST_Operation::OP_noflags,
+ 0,
+ 0,
+ 0),
+ -1);
+ op->set_defined_in (node);
+ op->set_imported (node->imported ());
+ op->set_name (op_name);
+ Identifier arg_id ("ck");
+ UTL_ScopedName arg_name (&arg_id,
+ 0);
+ be_argument *arg = 0;
+ ACE_NEW_RETURN (arg,
+ be_argument (AST_Argument::dir_IN,
+ this->cookie_,
+ &arg_name),
+ -1);
+ op->be_add_argument (arg);
+ UTL_ExceptList *unsubscribe = 0;
+ ACE_NEW_RETURN (unsubscribe,
+ UTL_ExceptList (this->invalid_connection_,
+ 0),
+ -1);
+ op->be_add_exceptions (unsubscribe);
+
+ if (0 == node->be_add_operation (op))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_emits_connect (
+ be_component *node,
+ AST_Component::port_description *pd
+ )
+{
+ UTL_ScopedName *op_name =
+ this->create_scoped_name ("connect_",
+ pd->id->get_string (),
+ 0,
+ node);
+ be_operation *op = 0;
+ ACE_NEW_RETURN (op,
+ be_operation (be_global->void_type (),
+ AST_Operation::OP_noflags,
+ 0,
+ 0,
+ 0),
+ -1);
+ op->set_name (op_name);
+ op->set_defined_in (node);
+ op->set_imported (node->imported ());
+ AST_Interface *i = this->lookup_consumer (pd);
+
+ if (i == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_emits_connect - "
+ "consumer lookup failed\n"),
+ -1);
+ }
+
+ Identifier arg_id ("consumer");
+ UTL_ScopedName arg_name (&arg_id,
+ 0);
+ be_argument *arg = 0;
+ ACE_NEW_RETURN (arg,
+ be_argument (AST_Argument::dir_IN,
+ i,
+ &arg_name),
+ -1);
+ op->be_add_argument (arg);
+ UTL_ExceptList *emits_connect = 0;
+ ACE_NEW_RETURN (emits_connect,
+ UTL_ExceptList (this->already_connected_,
+ 0),
+ -1);
+ op->be_add_exceptions (emits_connect);
+
+ if (0 == node->be_add_operation (op))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_emits_disconnect (
+ be_component *node,
+ AST_Component::port_description *pd
+ )
+{
+ AST_Interface *i = this->lookup_consumer (pd);
+
+ if (i == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_emits_disconnect - "
+ "consumer lookup failed\n"),
+ -1);
+ }
+
+ UTL_ScopedName *op_name =
+ this->create_scoped_name ("disconnect_",
+ pd->id->get_string (),
+ 0,
+ node);
+ be_operation *op = 0;
+ ACE_NEW_RETURN (op,
+ be_operation (i,
+ AST_Operation::OP_noflags,
+ 0,
+ 0,
+ 0),
+ -1);
+ op->set_name (op_name);
+ op->set_defined_in (node);
+ op->set_imported (node->imported ());
+ UTL_ExceptList *emits_disconnect = 0;
+ ACE_NEW_RETURN (emits_disconnect,
+ UTL_ExceptList (this->no_connection_,
+ 0),
+ -1);
+ op->be_add_exceptions (emits_disconnect);
+
+ if (0 == node->be_add_operation (op))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_get_consumer (
+ be_component *node,
+ AST_Component::port_description *pd
+ )
+{
+ AST_Interface *i = this->lookup_consumer (pd);
+
+ if (i == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ccm_pre_proc::"
+ "gen_consumes_get_connection - "
+ "consumer lookup failed\n"),
+ -1);
+ }
+
+ UTL_ScopedName *op_name =
+ this->create_scoped_name ("get_consumer_",
+ pd->id->get_string (),
+ 0,
+ node);
+ be_operation *op = 0;
+ ACE_NEW_RETURN (op,
+ be_operation (i,
+ AST_Operation::OP_noflags,
+ 0,
+ 0,
+ 0),
+ -1);
+ op->set_name (op_name);
+ op->set_defined_in (node);
+ op->set_imported (node->imported ());
+
+ if (0 == node->be_add_operation (op))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_create (be_home *node,
+ AST_Interface *implicit)
+{
+ UTL_ScopedName *op_name = this->create_scoped_name (0,
+ "create",
+ 0,
+ implicit);
+ AST_Operation *op = 0;
+ ACE_NEW_RETURN (op,
+ be_operation (node->managed_component (),
+ AST_Operation::OP_noflags,
+ 0,
+ 0,
+ 0),
+ -1);
+ op->set_name (op_name);
+ AST_ValueType *pk = node->primary_key ();
+ UTL_ExceptList *exceps = 0;
+ ACE_NEW_RETURN (exceps,
+ UTL_ExceptList (this->create_failure_,
+ 0),
+ -1);
+
+ if (pk != 0)
+ {
+ Identifier arg_id ("key");
+ UTL_ScopedName arg_name (&arg_id,
+ 0);
+ AST_Argument *arg = 0;
+ ACE_NEW_RETURN (arg,
+ be_argument (AST_Argument::dir_IN,
+ pk,
+ &arg_name),
+ -1);
+ arg_id.destroy ();
+ op->be_add_argument (arg);
+ UTL_ExceptList *tail = 0;
+ ACE_NEW_RETURN (tail,
+ UTL_ExceptList (this->invalid_key_,
+ 0),
+ -1);
+ UTL_ExceptList *middle = 0;
+ ACE_NEW_RETURN (middle,
+ UTL_ExceptList (this->duplicate_key_value_,
+ tail),
+ -1);
+ exceps->nconc (middle);
+ }
+
+ op->be_add_exceptions (exceps);
+ op->set_defined_in (implicit);
+ op->set_imported (node->imported ());
+
+ if (0 == implicit->be_add_operation (op))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_find_by_primary_key (be_home *node,
+ AST_Interface *implicit)
+{
+ UTL_ScopedName *op_name = this->create_scoped_name (0,
+ "find_by_primary_key",
+ 0,
+ implicit);
+ AST_Operation *op = 0;
+ ACE_NEW_RETURN (op,
+ be_operation (node->managed_component (),
+ AST_Operation::OP_noflags,
+ 0,
+ 0,
+ 0),
+ -1);
+ op->set_name (op_name);
+ AST_ValueType *pk = node->primary_key ();
+ Identifier arg_id ("key");
+ UTL_ScopedName arg_name (&arg_id,
+ 0);
+ AST_Argument *arg = 0;
+ ACE_NEW_RETURN (arg,
+ be_argument (AST_Argument::dir_IN,
+ pk,
+ &arg_name),
+ -1);
+ arg_id.destroy ();
+ op->be_add_argument (arg);
+ UTL_ExceptList *tail = 0;
+ ACE_NEW_RETURN (tail,
+ UTL_ExceptList (this->invalid_key_,
+ 0),
+ -1);
+ UTL_ExceptList *middle = 0;
+ ACE_NEW_RETURN (middle,
+ UTL_ExceptList (this->unknown_key_value_,
+ tail),
+ -1);
+ UTL_ExceptList *exceps = 0;
+ ACE_NEW_RETURN (exceps,
+ UTL_ExceptList (this->finder_failure_,
+ middle),
+ -1);
+ op->be_add_exceptions (exceps);
+ op->set_defined_in (implicit);
+ op->set_imported (node->imported ());
+
+ if (0 == implicit->be_add_operation (op))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_remove (be_home *node,
+ AST_Interface *implicit)
+{
+ UTL_ScopedName *op_name = this->create_scoped_name (0,
+ "remove",
+ 0,
+ implicit);
+ AST_Operation *op = 0;
+ ACE_NEW_RETURN (op,
+ be_operation (be_global->void_type (),
+ AST_Operation::OP_noflags,
+ 0,
+ 0,
+ 0),
+ -1);
+ op->set_name (op_name);
+ AST_ValueType *pk = node->primary_key ();
+ Identifier arg_id ("key");
+ UTL_ScopedName arg_name (&arg_id,
+ 0);
+ AST_Argument *arg = 0;
+ ACE_NEW_RETURN (arg,
+ be_argument (AST_Argument::dir_IN,
+ pk,
+ &arg_name),
+ -1);
+ arg_id.destroy ();
+ op->be_add_argument (arg);
+ UTL_ExceptList *tail = 0;
+ ACE_NEW_RETURN (tail,
+ UTL_ExceptList (this->invalid_key_,
+ 0),
+ -1);
+ UTL_ExceptList *middle = 0;
+ ACE_NEW_RETURN (middle,
+ UTL_ExceptList (this->unknown_key_value_,
+ tail),
+ -1);
+ UTL_ExceptList *exceps = 0;
+ ACE_NEW_RETURN (exceps,
+ UTL_ExceptList (this->remove_failure_,
+ middle),
+ -1);
+ op->be_add_exceptions (exceps);
+ op->set_defined_in (implicit);
+ op->set_imported (node->imported ());
+
+ if (0 == implicit->be_add_operation (op))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::gen_get_primary_key (be_home *node,
+ AST_Interface *implicit)
+{
+ UTL_ScopedName *op_name = this->create_scoped_name (0,
+ "get_primary_key",
+ 0,
+ implicit);
+ AST_Operation *op = 0;
+ ACE_NEW_RETURN (op,
+ be_operation (node->primary_key (),
+ AST_Operation::OP_noflags,
+ 0,
+ 0,
+ 0),
+ -1);
+ op->set_name (op_name);
+ Identifier arg_id ("comp");
+ UTL_ScopedName arg_name (&arg_id,
+ 0);
+ AST_Argument *arg = 0;
+ ACE_NEW_RETURN (arg,
+ be_argument (AST_Argument::dir_IN,
+ node->managed_component (),
+ &arg_name),
+ -1);
+ arg_id.destroy ();
+ op->be_add_argument (arg);
+ op->set_defined_in (implicit);
+ op->set_imported (node->imported ());
+
+ if (0 == implicit->be_add_operation (op))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+// ********************************************************************
+
+int
+be_visitor_ccm_pre_proc::lookup_cookie (be_component *node)
+{
+ if (this->cookie_ == 0)
+ {
+ Identifier local_id ("Cookie");
+ UTL_ScopedName local_name (&local_id,
+ 0);
+ UTL_ScopedName cookie_name (&this->module_id_,
+ &local_name);
+ AST_Decl *d = node->lookup_by_name (&cookie_name,
+ true);
+ local_id.destroy ();
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (&cookie_name);
+ return -1;
+ }
+
+ this->cookie_ = be_valuetype::narrow_from_decl (d);
+
+ if (this->cookie_ == 0)
+ {
+ idl_global->err ()->valuetype_expected (d);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::lookup_exceptions (be_component *node)
+{
+ int status = 0;
+
+ for (int i = 0; i < N_EXCEPS; ++i)
+ {
+ status = this->lookup_one_exception (node,
+ EXCEP_NAMES[i],
+ EXCEPS[i]);
+
+ if (status == -1)
+ {
+ return -1;
+ }
+ }
+
+ this->already_connected_ = EXCEPS[0];
+ this->invalid_connection_ = EXCEPS[1];
+ this->no_connection_ = EXCEPS[2];
+ this->exceeded_connection_limit_ = EXCEPS[3];
+ this->create_failure_ = EXCEPS[4];
+ this->remove_failure_ = EXCEPS[5];
+ this->finder_failure_ = EXCEPS[6];
+ this->invalid_key_ = EXCEPS[7];
+ this->unknown_key_value_ = EXCEPS[8];
+ this->duplicate_key_value_ = EXCEPS[9];
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::lookup_one_exception (be_component *node,
+ const char *name,
+ be_exception *&result)
+{
+ Identifier id (name);
+ UTL_ScopedName local_name (&id,
+ 0);
+ UTL_ScopedName scoped_name (&this->module_id_,
+ &local_name);
+ AST_Decl *d = node->lookup_by_name (&scoped_name,
+ true);
+ id.destroy ();
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (&scoped_name);
+ return -1;
+ }
+
+ result = be_exception::narrow_from_decl (d);
+
+ if (result == 0)
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::create_event_consumer (be_eventtype *node)
+{
+ AST_Interface *event_consumer = 0;
+ UTL_Scope *s = node->defined_in ();
+ AST_Module *m = AST_Module::narrow_from_scope (s);
+
+ UTL_ScopedName *consumer_name =
+ this->create_scoped_name (0,
+ node->local_name (),
+ "Consumer",
+ ScopeAsDecl (node->defined_in ()));
+
+ // We're at global scope here so we need to fool the scope stack
+ // for a minute so the correct repo id can be calculated at
+ // interface construction time.
+ idl_global->scopes ().push (s);
+
+ Identifier parent_id ("EventConsumerBase");
+ UTL_ScopedName parent_local_name (&parent_id,
+ 0);
+ UTL_ScopedName parent_full_name (&this->module_id_,
+ &parent_local_name);
+ UTL_NameList parent_list (&parent_full_name,
+ 0);
+ FE_InterfaceHeader header (consumer_name,
+ &parent_list,
+ false,
+ false,
+ true);
+ ACE_NEW_RETURN (event_consumer,
+ be_interface (header.name (),
+ header.inherits (),
+ header.n_inherits (),
+ header.inherits_flat (),
+ header.n_inherits_flat (),
+ false,
+ false),
+ -1);
+ parent_id.destroy ();
+
+ // Back to reality.
+ idl_global->scopes ().pop ();
+
+ event_consumer->set_defined_in (s);
+ event_consumer->set_imported (node->imported ());
+ event_consumer->set_name (consumer_name);
+
+ // Set repo id to 0, so it will be recomputed on the next access,
+ // and set the prefix to the eventtype's prefix. All this is
+ // necessary in case the eventtype's prefix was modified after
+ // its declaration. We assume 'implied IDL' means that the
+ // derived event consumer interface should have the same prefix.
+ event_consumer->repoID (0);
+ event_consumer->prefix (const_cast<char*> (node->prefix ()));
+
+ be_type::narrow_from_decl (event_consumer)->gen_fwd_helper_name ();
+ m->be_add_interface (event_consumer);
+ return this->gen_push_op (node,
+ event_consumer);
+}
+
+AST_Interface *
+be_visitor_ccm_pre_proc::lookup_consumer (AST_Component::port_description *pd)
+{
+ ACE_CString rettype_string (pd->impl->local_name ()->get_string ());
+ rettype_string += "Consumer";
+ Identifier rettype_id (rettype_string.fast_rep ());
+ AST_Decl *d = pd->impl->defined_in ()->lookup_by_name_local (&rettype_id,
+ 0);
+ rettype_id.destroy ();
+
+ if (d == 0)
+ {
+ return 0;
+ }
+
+ AST_Interface *i = AST_Interface::narrow_from_decl (d);
+
+ if (i == 0)
+ {
+ idl_global->err ()->interface_expected (d);
+ return 0;
+ }
+
+ return i;
+}
+
+AST_Interface *
+be_visitor_ccm_pre_proc::create_explicit (be_home *node)
+{
+ UTL_NameList *parent_list = this->compute_inheritance (node);
+ FE_InterfaceHeader header (0,
+ parent_list,
+ false,
+ false,
+ true);
+
+ // We're at global scope here so we need to fool the scope stack
+ // for a minute so the correct repo id can be calculated at
+ // interface construction time.
+ idl_global->scopes ().push (node->defined_in ());
+
+ UTL_ScopedName *explicit_name =
+ this->create_scoped_name (0,
+ node->local_name (),
+ "Explicit",
+ ScopeAsDecl (node->defined_in ()));
+
+ AST_Interface *i = 0;
+ ACE_NEW_RETURN (i,
+ be_interface (explicit_name,
+ header.inherits (),
+ header.n_inherits (),
+ header.inherits_flat (),
+ header.n_inherits_flat (),
+ false,
+ false),
+ 0);
+
+ // Back to reality.
+ idl_global->scopes ().pop ();
+
+ i->set_name (explicit_name);
+ i->set_defined_in (node->defined_in ());
+ i->set_imported (node->imported ());
+ be_interface::narrow_from_decl (i)->gen_fwd_helper_name ();
+
+ // Reuse the home's decls in the explicit interface. No need
+ // to check for name clashes, redefinition, etc. because it
+ // has already been done in the home and the explicit interface
+ // is empty at this point. Later addition of factory and finder
+ // operations will do these checks to make sure they don't
+ // clash with the other decls.
+ for (UTL_ScopeActiveIterator iter (node, UTL_Scope::IK_decls);
+ ! iter.is_done ();
+ iter.next ())
+ {
+ AST_Decl *d = iter.item ();
+ d->set_defined_in (i);
+ UTL_ScopedName *new_name =
+ this->create_scoped_name (0,
+ d->local_name ()->get_string (),
+ 0,
+ i);
+ d->set_name (new_name);
+ i->add_to_scope (d);
+ }
+
+ header.destroy ();
+ parent_list->destroy ();
+ delete parent_list;
+ parent_list = 0;
+
+ AST_Module *m = AST_Module::narrow_from_scope (node->defined_in ());
+ m->be_add_interface (i);
+ return i;
+}
+
+AST_Interface *
+be_visitor_ccm_pre_proc::create_implicit (be_home *node)
+{
+ Identifier *parent_id = 0;
+ ACE_NEW_RETURN (parent_id,
+ Identifier ("KeylessCCMHome"),
+ 0);
+
+ UTL_ScopedName *parent_local_name = 0;
+ ACE_NEW_RETURN (parent_local_name,
+ UTL_ScopedName (parent_id, 0),
+ 0);
+
+ UTL_ScopedName *parent_full_name = 0;
+ ACE_NEW_RETURN (parent_full_name,
+ UTL_ScopedName (this->module_id_.copy (),
+ parent_local_name),
+ 0);
+
+ UTL_NameList parent_list (parent_full_name, 0);
+
+ UTL_NameList *parent_list_ptr = 0;
+
+ if (node->primary_key () == 0)
+ {
+ parent_list_ptr = &parent_list;
+ }
+
+ FE_InterfaceHeader header (0,
+ parent_list_ptr,
+ false,
+ false,
+ true);
+
+ // We're at global scope here so we need to fool the scope stack
+ // for a minute so the correct repo id can be calculated at
+ // interface construction time.
+ idl_global->scopes ().push (node->defined_in ());
+
+ UTL_ScopedName *implicit_name =
+ this->create_scoped_name (0,
+ node->local_name (),
+ "Implicit",
+ ScopeAsDecl (node->defined_in ()));
+
+ AST_Interface *i = 0;
+ ACE_NEW_RETURN (i,
+ be_interface (implicit_name,
+ header.inherits (),
+ header.n_inherits (),
+ header.inherits_flat (),
+ header.n_inherits_flat (),
+ false,
+ false),
+ 0);
+
+ // Back to reality.
+ idl_global->scopes ().pop ();
+
+ header.destroy ();
+ parent_list.destroy ();
+
+ i->set_name (implicit_name);
+ i->set_defined_in (node->defined_in ());
+ i->set_imported (node->imported ());
+
+ be_interface::narrow_from_decl (i)->gen_fwd_helper_name ();
+ AST_Module *m = AST_Module::narrow_from_scope (node->defined_in ());
+ m->be_add_interface (i);
+
+ return i;
+}
+
+AST_Interface *
+be_visitor_ccm_pre_proc::create_equivalent (be_home *node,
+ AST_Interface *xplicit,
+ AST_Interface *implicit)
+{
+ UTL_Scope *s = node->defined_in ();
+ UTL_ScopedName *equiv_name =
+ this->create_scoped_name (0,
+ node->local_name (),
+ 0,
+ ScopeAsDecl (s));
+ UTL_NameList tail (implicit->name (),
+ 0);
+ UTL_NameList parent_list (xplicit->name (),
+ &tail);
+ FE_InterfaceHeader header (0,
+ &parent_list,
+ false,
+ false,
+ true);
+
+ // We're at global scope here so we need to fool the scope stack
+ // for a minute so the correct repo id can be calculated at
+ // interface construction time.
+ idl_global->scopes ().push (node->defined_in ());
+
+ AST_Interface *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_interface (equiv_name,
+ header.inherits (),
+ header.n_inherits (),
+ header.inherits_flat (),
+ header.n_inherits_flat (),
+ false,
+ false),
+ 0);
+
+ // Back to reality.
+ idl_global->scopes ().pop ();
+
+ // So we can skip typecode generation.
+ retval->home_equiv (true);
+
+ retval->set_name (equiv_name);
+ retval->set_defined_in (s);
+ retval->set_imported (node->imported ());
+ be_interface::narrow_from_decl (retval)->gen_fwd_helper_name ();
+ UTL_ScopedName *unmangled_name =
+ static_cast<UTL_ScopedName *> (node->name ()->copy ());
+ UTL_ScopedName *mangled_name =
+ this->create_scoped_name (0,
+ node->local_name (),
+ "_tao_home_name_extension",
+ ScopeAsDecl (s));
+ node->set_name (mangled_name);
+ AST_Module *m = AST_Module::narrow_from_scope (s);
+ m->be_add_interface (retval);
+ node->set_name (unmangled_name);
+ return retval;
+}
+
+UTL_ScopedName *
+be_visitor_ccm_pre_proc::create_scoped_name (const char *prefix,
+ const char *local_name,
+ const char *suffix,
+ AST_Decl *parent)
+{
+ ACE_CString local_string (prefix,
+ 0,
+ 0);
+ local_string += local_name;
+ local_string += suffix;
+ Identifier *local_id = 0;
+ ACE_NEW_RETURN (local_id,
+ Identifier (local_string.fast_rep ()),
+ 0);
+ UTL_ScopedName *last_segment = 0;
+ ACE_NEW_RETURN (last_segment,
+ UTL_ScopedName (local_id,
+ 0),
+ 0);
+ UTL_ScopedName *full_name =
+ static_cast<UTL_ScopedName *> (parent->name ()->copy ());
+ full_name->nconc (last_segment);
+ return full_name;
+}
+
+UTL_NameList *
+be_visitor_ccm_pre_proc::compute_inheritance (be_home *node)
+{
+ UTL_NameList *retval = 0;
+
+ if (node->base_home () == 0)
+ {
+ Identifier *local_id = 0;
+ ACE_NEW_RETURN (local_id,
+ Identifier ("CCMHome"),
+ 0);
+ UTL_ScopedName *local_name = 0;
+ ACE_NEW_RETURN (local_name,
+ UTL_ScopedName (local_id,
+ 0),
+ 0);
+ UTL_ScopedName *full_name = 0;
+ ACE_NEW_RETURN (full_name,
+ UTL_ScopedName (this->module_id_.copy (),
+ local_name),
+ 0);
+ ACE_NEW_RETURN (retval,
+ UTL_NameList (full_name,
+ 0),
+ 0);
+
+ }
+ else
+ {
+ ACE_CString new_local (
+ node->base_home ()->local_name ()->get_string ()
+ );
+ new_local += "Explicit";
+ UTL_ScopedName *parent_name =
+ static_cast<UTL_ScopedName *> (node->base_home ()->name ()->copy ());
+ parent_name->last_component ()->replace_string (new_local.c_str ());
+ ACE_NEW_RETURN (retval,
+ UTL_NameList (parent_name,
+ 0),
+ 0);
+ }
+
+ long n_supports = node->n_inherits ();
+ UTL_ScopedName *supported_name = 0;
+ UTL_NameList *conc_value = 0;
+
+ for (long i = 0; i < n_supports; ++i)
+ {
+ supported_name =
+ static_cast<UTL_ScopedName *> (node->inherits ()[i]->name ()->copy ());
+ ACE_NEW_RETURN (conc_value,
+ UTL_NameList (supported_name,
+ 0),
+ 0);
+ retval->nconc (conc_value);
+ }
+
+ return retval;
+}
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..ced6d9ed486
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component.cpp
@@ -0,0 +1,60 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_component.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Component.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#include "be_component.h"
+#include "be_attribute.h"
+#include "be_typedef.h"
+#include "be_operation.h"
+#include "be_structure.h"
+#include "be_typedef.h"
+#include "ast_argument.h"
+
+#include "be_visitor_component.h"
+#include "be_visitor_attribute.h"
+#include "be_visitor_operation.h"
+#include "be_visitor_interface.h"
+#include "be_visitor_structure.h"
+#include "be_visitor_typedef.h"
+#include "be_visitor_typecode.h"
+#include "be_visitor_context.h"
+#include "be_helper.h"
+#include "be_extern.h"
+#include "idl_defines.h"
+#include "nr_extern.h"
+#include "ace/Log_Msg.h"
+
+#include "be_visitor_component/component.cpp"
+#include "be_visitor_component/component_ch.cpp"
+#include "be_visitor_component/component_ci.cpp"
+#include "be_visitor_component/component_cs.cpp"
+#include "be_visitor_component/component_sh.cpp"
+#include "be_visitor_component/component_si.cpp"
+#include "be_visitor_component/component_ss.cpp"
+#include "be_visitor_component/component_ih.cpp"
+#include "be_visitor_component/component_is.cpp"
+#include "be_visitor_component/any_op_ch.cpp"
+#include "be_visitor_component/any_op_cs.cpp"
+#include "be_visitor_component/cdr_op_ch.cpp"
+#include "be_visitor_component/cdr_op_cs.cpp"
+
+ACE_RCSID (be,
+ be_visitor_component,
+ "$Id$")
+
diff --git a/TAO/TAO_IDL/be/be_visitor_component/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_component/any_op_ch.cpp
new file mode 100644
index 00000000000..ff140c4ab35
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/any_op_ch.cpp
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Any operators for an Component in the client
+// header.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_component,
+ any_op_ch,
+ "$Id$")
+
+// ***************************************************************************
+// Interface visitor for generating Any operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_component_any_op_ch::be_visitor_component_any_op_ch
+(be_visitor_context *ctx)
+ : be_visitor_component (ctx)
+{
+}
+
+be_visitor_component_any_op_ch::~be_visitor_component_any_op_ch (void)
+{
+}
+
+int
+be_visitor_component_any_op_ch::visit_component (be_component *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_interface_any_op_ch visitor (&ctx);
+ return visitor.visit_interface (node);
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_component/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_component/any_op_cs.cpp
new file mode 100644
index 00000000000..9abc8f02047
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/any_op_cs.cpp
@@ -0,0 +1,46 @@
+// $id: any_op_cs.cpp,v 1.12 1998/10/30 19:46:55 levine Exp $
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Any operators for Component in the stubs
+// file.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_component,
+ any_op_cs,
+ "$Id$")
+
+// ***************************************************************************
+// Interface visitor for generating Any operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_component_any_op_cs::be_visitor_component_any_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_component (ctx)
+{
+}
+
+be_visitor_component_any_op_cs::~be_visitor_component_any_op_cs (void)
+{
+}
+
+int
+be_visitor_component_any_op_cs::visit_component (be_component *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_interface_any_op_cs visitor (&ctx);
+ return visitor.visit_interface (node);
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_component/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_component/cdr_op_ch.cpp
new file mode 100644
index 00000000000..eba4a289938
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/cdr_op_ch.cpp
@@ -0,0 +1,47 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for CDR operators for components. This uses
+// compiled marshaling.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_component,
+ cdr_op_ch,
+ "$Id$")
+
+// ***************************************************************************
+// Interface visitor for generating CDR operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_component_cdr_op_ch::be_visitor_component_cdr_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_component (ctx)
+{
+}
+
+be_visitor_component_cdr_op_ch::~be_visitor_component_cdr_op_ch (void)
+{
+}
+
+int
+be_visitor_component_cdr_op_ch::visit_component (be_component *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_interface_cdr_op_ch visitor (&ctx);
+ return visitor.visit_interface (node);
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_component/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_component/cdr_op_cs.cpp
new file mode 100644
index 00000000000..d69ae7b8a06
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/cdr_op_cs.cpp
@@ -0,0 +1,42 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for CDR operators for components
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_component,
+ cdr_op_cs,
+ "$Id$")
+
+be_visitor_component_cdr_op_cs::be_visitor_component_cdr_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_component (ctx)
+{
+}
+
+be_visitor_component_cdr_op_cs::~be_visitor_component_cdr_op_cs (void)
+{
+}
+
+int
+be_visitor_component_cdr_op_cs::visit_component (be_component *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_interface_cdr_op_cs visitor (&ctx);
+ return visitor.visit_interface (node);
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_component/component.cpp b/TAO/TAO_IDL/be/be_visitor_component/component.cpp
new file mode 100644
index 00000000000..70b53838e1f
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/component.cpp
@@ -0,0 +1,359 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Components. This is a generic visitor.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_component,
+ component,
+ "$Id$")
+
+// ******************************************************
+// Generic Component visitor
+// ******************************************************
+
+be_visitor_component::be_visitor_component (be_visitor_context *ctx)
+ : be_visitor_interface (ctx)
+{
+}
+
+be_visitor_component::~be_visitor_component (void)
+{
+}
+
+int
+be_visitor_component::visit_attribute (be_attribute *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ case TAO_CodeGen::TAO_ROOT_CS:
+ case TAO_CodeGen::TAO_ROOT_SH:
+ case TAO_CodeGen::TAO_ROOT_IH:
+ case TAO_CodeGen::TAO_ROOT_SS:
+ case TAO_CodeGen::TAO_ROOT_IS:
+ break;
+ default:
+ return 0; // nothing to be done
+ }
+
+ // Same visitor for all the above cases where an action is taken.
+ be_visitor_attribute visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_component::"
+ "visit_attribute - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_component::visit_operation (be_operation *node)
+{
+ // 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);
+ 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;
+ case TAO_CodeGen::TAO_ROOT_CS:
+ ctx.state (TAO_CodeGen::TAO_OPERATION_CS);
+ break;
+ case TAO_CodeGen::TAO_ROOT_SH:
+ {
+ be_visitor_operation_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_IH:
+ {
+ be_visitor_operation_ih visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SS:
+ {
+ be_visitor_operation_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_IS:
+ {
+ be_visitor_operation_is 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:
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ case TAO_CodeGen::TAO_ROOT_CI:
+ case TAO_CodeGen::TAO_ROOT_SI:
+ return 0; // nothing to be done
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_component::"
+ "visit_operation - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ if (status == 0)
+ {
+ return 0;
+ }
+ else if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_component::"
+ "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.
+ be_visitor *visitor = tao_cg->make_visitor (&ctx);
+
+ if (!visitor)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_component::"
+ "visit_operation - "
+ "NUL visitor\n"),
+ -1);
+ }
+
+ if (node->accept (visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_component::"
+ "visit_operation - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ delete visitor;
+ visitor = 0;
+
+ // Do additional code generation is necessary.
+ // Note, this call is delegated to the strategy connected to
+ // the node.
+ 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));
+
+ // Grab the appropriate visitor.
+ visitor = tao_cg->make_visitor (&ctx);
+
+ if (!visitor)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_component::"
+ "visit_operation - "
+ "NUL visitor\n"),
+ -1);
+ }
+
+ if (node->accept (visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_component::"
+ "visit_operation - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ delete visitor;
+ visitor = 0;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_component::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);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ {
+ be_visitor_structure_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_structure_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_structure_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_structure_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_structure_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_structure_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_structure_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_component::"
+ "visit_structure - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_component::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);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ {
+ be_visitor_typedef_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_typedef_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_typedef_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_typedef_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_typedef_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_typedef_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_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_IH:
+ case TAO_CodeGen::TAO_ROOT_IS:
+ case TAO_CodeGen::TAO_ROOT_SI:
+ case TAO_CodeGen::TAO_ROOT_SS:
+ return 0; // nothing to be done
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_component::"
+ "visit_typedef - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_component::"
+ "visit_typedef - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_ch.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_ch.cpp
new file mode 100644
index 00000000000..2c7bcb664d0
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/component_ch.cpp
@@ -0,0 +1,279 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Components in the client header.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_component,
+ component_ch,
+ "$Id$")
+
+// ******************************************************
+// Component visitor for client header
+// ******************************************************
+
+be_visitor_component_ch::be_visitor_component_ch (be_visitor_context *ctx)
+ : be_visitor_component (ctx)
+{
+}
+
+be_visitor_component_ch::~be_visitor_component_ch (void)
+{
+}
+
+int
+be_visitor_component_ch::visit_component (be_component *node)
+{
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ // This will be a no-op if it has already been done by a forward
+ // declaration.
+ node->gen_var_out_seq_decls ();
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Now the interface definition itself.
+ os->gen_ifdef_macro (node->flat_name ());
+
+ if (!node->is_local () && !node->is_abstract ())
+ {
+ // Forward class declarations.
+ *os << be_nl << 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 generate the class definition.
+ *os << "class " << be_global->stub_export_macro ()
+ << " " << node->local_name () << be_idt_nl
+ << ": public virtual ::" ;
+
+ AST_Component *parent = node->base_component ();
+
+ if (parent != 0)
+ {
+ *os << parent->name ();
+ }
+ else
+ {
+ *os << "Components::CCMObject";
+ }
+
+ long nsupports = node->n_inherits ();
+
+ if (nsupports > 0)
+ {
+ *os << be_idt;
+
+ for (long i = 0; i < nsupports; ++i)
+ {
+ *os << ", " << be_nl
+ << "public virtual ::" << node->supports()[i]->name ();
+ }
+
+ *os << be_uidt;
+ }
+
+ *os << be_uidt_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl
+
+ << "friend class TAO::Narrow_Utils<"
+ << node->local_name () << ">;" << be_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
+ << "typedef " << node->local_name () << "_out _out_type;"
+ << 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" << env_dflts << 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 static_cast<" << node->local_name ()
+ << "_ptr> (0);" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+
+ if (be_global->any_support ())
+ {
+ *os << "static void _tao_any_destructor (void *);";
+ }
+
+ // 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_component_ch::"
+ "visit_component - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ if (! node->is_abstract ())
+ {
+ node->analyze_parentage ();
+ }
+
+ // If we inherit from both CORBA::Object and CORBA::AbstractBase,
+ // we have to override _add_ref() to avoid ambiguity. A comopnent
+ // can have mixed parentage if it supports an abstract or mixed-
+ // parentage interface.
+ if (node->has_mixed_parentage ())
+ {
+ *os << be_nl << be_nl
+ << "virtual void _add_ref (void);";
+ }
+
+ *os << be_nl << be_nl
+ << "virtual ::CORBA::Boolean _is_a (" << be_idt << be_idt_nl
+ << "const char *type_id" << env_dflts << be_uidt_nl
+ << ");" << be_uidt;
+
+ // The _interface_repository_id method.
+ *os << be_nl << be_nl
+ << "virtual const char* _interface_repository_id (void) const;";
+
+ // The virtual marshal method, to prevent marshal of local iterfaces.
+ *os << be_nl << "virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr);";
+
+ // Add the Proxy Broker member variable.
+ *os << be_uidt_nl << be_nl
+ << "private:" << be_idt_nl
+ << "TAO::Collocation_Proxy_Broker *"
+ << "the" << node->base_proxy_broker_name ()
+ << "_;";
+
+ *os << be_uidt_nl << be_nl
+ << "protected:" << be_idt;
+
+ // Generate the "protected" constructor so that users cannot
+ // instantiate us.
+
+ *os << be_nl
+ << node->local_name () << " (void);";
+
+ *os << be_nl << be_nl
+ << "// 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 (void);";
+
+ *os << be_nl << be_nl
+ << node->local_name () << " (" << be_idt << be_idt_nl
+ << "IOP::IOR *ior," << be_nl
+ << "TAO_ORB_Core *orb_core = 0" << be_uidt_nl
+ << ");" << be_uidt;
+
+ *os << be_nl << be_nl
+ << 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_nl
+ << "TAO_ORB_Core *oc = 0" << be_uidt_nl
+ << ");" << be_uidt;
+
+ // Friends declarations.
+ *os << be_nl << be_nl
+ << "friend class " << node->remote_proxy_impl_name () << ";"
+ << be_nl
+ << "friend class " << node->direct_proxy_impl_name () << ";";
+
+ // Protected destructor.
+ *os << be_nl << be_nl
+ << "virtual ~" << node->local_name () << " (void);";
+
+ // Private copy constructor and assignment operator. These are not
+ // allowed, hence they are private.
+ *os << be_uidt_nl << be_nl
+ << "private:" << be_idt_nl;
+ *os << node->local_name () << " (const "
+ << node->local_name () << " &);"
+ << be_nl
+ << "void operator= (const " << node->local_name () << " &);";
+
+ *os << be_uidt_nl
+ << "};" << be_nl << be_nl;
+
+ // List that generates proxy broker factory function pointer.
+ be_global->non_local_interfaces.enqueue_tail (node);
+
+ be_visitor_context ctx (*this->ctx_);
+ if (be_global->gen_smart_proxies ())
+ {
+ *os << be_nl << be_nl;
+ // 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_component_ch::"
+ "visit_component - "
+ "codegen for smart proxy classes failed\n"),
+ -1);
+ }
+ }
+
+ os->gen_endif ();
+
+ if (be_global->tc_support ())
+ {
+ be_visitor_typecode_decl td_visitor (&ctx);
+
+ if (node->accept (&td_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_component_ch::"
+ "visit_component - "
+ "TypeCode declaration failed\n"),
+ -1);
+ }
+ }
+
+ node->cli_hdr_gen (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_ci.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_ci.cpp
new file mode 100644
index 00000000000..4b485a558af
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/component_ci.cpp
@@ -0,0 +1,71 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component_ci.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Components in the client inline.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_component,
+ component_ci,
+ "$Id$")
+
+// ******************************************************
+// Component visitor for client inline
+// ******************************************************
+
+be_visitor_component_ci::be_visitor_component_ci (be_visitor_context *ctx)
+ : be_visitor_component (ctx)
+{
+}
+
+be_visitor_component_ci::~be_visitor_component_ci (void)
+{
+}
+
+int
+be_visitor_component_ci::visit_component (be_component *node)
+{
+ if (node->imported () || node->cli_inline_gen ())
+ {
+ return 0;
+ }
+
+ 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);
+
+ *os << be_nl << be_nl
+ << "ACE_INLINE" << be_nl;
+ *os << node->name () << "::"
+ << node->local_name () << " ("
+ << be_idt << be_idt_nl
+ << "IOP::IOR *ior," << be_nl
+ << "TAO_ORB_Core *oc" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << ": ::CORBA::Object (ior, oc)" << be_uidt_nl
+ << "{" << be_nl
+ << "}" ;
+
+ os->gen_endif ();
+ node->cli_inline_gen (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_cs.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_cs.cpp
new file mode 100644
index 00000000000..4e8cc346e23
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/component_cs.cpp
@@ -0,0 +1,335 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Components in the client stub.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_component,
+ component_cs,
+ "$Id$")
+
+// ******************************************************
+// Component visitor for client stub
+// ******************************************************
+
+be_visitor_component_cs::be_visitor_component_cs (be_visitor_context *ctx)
+ : be_visitor_component (ctx)
+{
+}
+
+be_visitor_component_cs::~be_visitor_component_cs (void)
+{
+}
+
+int
+be_visitor_component_cs::visit_component (be_component *node)
+{
+ if (node->cli_stub_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ be_type *bt;
+
+ // Set the right type.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ if (node->is_defined ())
+ {
+ *os << be_nl << be_nl
+ << "// Traits specializations for " << node->name () << ".";
+
+ *os << be_nl << be_nl
+ << node->name () << "_ptr" << be_nl
+ << "TAO::Objref_Traits<" << node->name () << ">::duplicate ("
+ << be_idt << be_idt_nl
+ << node->name () << "_ptr p" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return " << node->name () << "::_duplicate (p);" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "void" << be_nl
+ << "TAO::Objref_Traits<" << node->name () << ">::release ("
+ << be_idt << be_idt_nl
+ << node->name () << "_ptr p" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::release (p);" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << node->name () << "_ptr" << be_nl
+ << "TAO::Objref_Traits<" << node->name () << ">::nil (void)"
+ << be_nl
+ << "{" << be_idt_nl
+ << "return " << node->name () << "::_nil ();" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "TAO::Objref_Traits<" << node->name () << ">::marshal ("
+ << be_idt << be_idt_nl
+ << "const " << node->name () << "_ptr p," << be_nl
+ << "TAO_OutputCDR & cdr" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return cdr << p;" << be_uidt_nl
+ << "}";
+ }
+
+ if (node->has_mixed_parentage ())
+ {
+ *os << be_nl << be_nl
+ << "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
+ << "}";
+
+ *os << be_nl << be_nl
+ << "::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
+ << "}";
+ }
+
+ // Generate the proxy broker factory function pointer definition.
+ *os << be_nl << be_nl
+ << "// Function pointer for collocation factory initialization."
+ << be_nl
+ << "TAO::Collocation_Proxy_Broker * " << be_nl
+ << "(*" << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_function_pointer) ("
+ << be_idt << be_idt_nl
+ << "::CORBA::Object_ptr obj" << be_uidt_nl
+ << ") = 0;" << be_uidt;
+
+ // Generate the destructor and default constructor.
+ *os << be_nl << be_nl
+ << node->name () << "::~" << node->local_name ()
+ << " (void)" << be_nl;
+ *os << "{}" << be_nl << be_nl;
+
+ *os << node->name () << "::" << node->local_name ()
+ << " (void)" << be_nl
+ << "{" << be_idt_nl
+ << "this->" << node->flat_name ()
+ << "_setup_collocation ();" << be_uidt_nl
+ << be_uidt << "}" << be_nl << be_nl;
+
+ // Collocation setup method.
+ *os << "void" << be_nl
+ << node->name () << "::" << node->flat_name ()
+ << "_setup_collocation (void)" << be_nl
+ << "{" << be_idt_nl
+ << "if ("<< "::" << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_function_pointer)" << 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;
+
+ AST_Component *base = node->base_component ();
+
+ if (base != 0)
+ {
+ *os << be_nl
+ << "this->" << base->flat_name ()
+ << "_setup_collocation" << " ();";
+ }
+
+ *os << be_uidt_nl << "}" << be_nl << be_nl;
+
+ if (be_global->any_support ())
+ {
+ *os << "void " << be_nl
+ << node->name ()
+ << "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
+ << "{" << be_idt_nl
+ << node->local_name () << " *_tao_tmp_pointer = static_cast<"
+ << node->local_name () << " *> (_tao_void_pointer);" << be_nl
+ << "::CORBA::release (_tao_tmp_pointer);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+
+ if (node->has_mixed_parentage ())
+ {
+ *os << "void" << be_nl
+ << node->name () << "::_add_ref (void)" << be_nl
+ << "{" << be_idt_nl
+ << "this->::CORBA::Object::_add_ref ();"
+ << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+
+ // The _narrow method.
+ *os << node->full_name () << "_ptr" << be_nl << node->full_name ()
+ << "::_narrow (" << be_idt << be_idt_nl
+ << "::CORBA::Object_ptr"
+ << " _tao_objref" << env_decl << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ *os << "return" << be_idt_nl
+ << "TAO::Narrow_Utils<"
+ << node->local_name () << ">::narrow (";
+
+ *os << be_idt << be_idt_nl
+ << "_tao_objref," << be_nl
+ << "\"" << node->repoID () << "\"," << be_nl
+ << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_function_pointer" << env_arg << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // The _duplicate method
+ *os << node->full_name () << "_ptr" << be_nl
+ << node->full_name () << "::_duplicate ("
+ << bt->nested_type_name (this->ctx_->scope ())
+ << "_ptr obj)" << be_nl
+ << "{" << 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;
+
+ // The is_a method.
+ *os << "::CORBA::Boolean" << be_nl
+ << node->full_name () << "::_is_a (" << be_idt << be_idt_nl
+ << "const char *value" << env_decl << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "if (" << be_idt << be_idt_nl;
+
+ AST_Component *ancestor = node;
+
+ while (ancestor != 0)
+ {
+ *os << "!ACE_OS::strcmp (" << be_idt << be_idt_nl
+ << "(char *)value," << be_nl
+ << "\"" << ancestor->repoID () << "\"" << be_uidt_nl
+ << ") ||" << be_uidt_nl;
+
+ ancestor = ancestor->base_component ();
+ }
+
+ *os << "!ACE_OS::strcmp (" << be_idt << be_idt_nl
+ << "(char *)value," << be_nl
+ << "\"IDL:omg.org/Components/CCMObject:1.0\"" << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << " )" << be_nl
+ << "{" << be_idt_nl
+ << "return true; // success using local knowledge" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "else" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return this->::CORBA::Object::_is_a ("
+ << be_idt << be_idt_nl
+ << "value" << env_arg << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "const char*" << be_nl
+ << node->full_name ()
+ << "::_interface_repository_id (void) const"
+ << be_nl
+ << "{" << be_idt_nl
+ << "return \"" << node->repoID ()
+ << "\";" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << node->name () << "::marshal (TAO_OutputCDR &cdr)" << be_nl
+ << "{" << be_idt_nl
+ << "return (cdr << this);" << be_uidt_nl
+ << "}";
+
+ // Generate code for the elements of the component.
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_component_cs::"
+ "visit_component - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ be_visitor_context ctx (*this->ctx_);
+
+ // Smart Proxy classes.
+ if (be_global->gen_smart_proxies ())
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS);
+ be_visitor_interface_smart_proxy_cs isp_visitor (&ctx);
+
+ if (node->accept (&isp_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_component_cs::"
+ "visit_component - "
+ "codegen for smart proxy classes failed\n"),
+ -1);
+ }
+ }
+
+ if (be_global->tc_support ())
+ {
+ // ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
+ TAO::be_visitor_objref_typecode tc_visitor (&ctx);
+
+ if (node->accept (&tc_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_component_cs::"
+ "visit_component - "
+ "TypeCode definition failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_ih.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_ih.cpp
new file mode 100644
index 00000000000..9b710986475
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/component_ih.cpp
@@ -0,0 +1,42 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component_ih.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Interfaces in the implementation header
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_component,
+ component_ih,
+ "$Id$")
+
+// ************************************************************
+// Interface visitor for implementation header.
+// ************************************************************
+
+be_visitor_component_ih::be_visitor_component_ih (be_visitor_context *ctx)
+ : be_visitor_component (ctx)
+{
+}
+
+be_visitor_component_ih::~be_visitor_component_ih (void)
+{
+}
+
+int
+be_visitor_component_ih::visit_component (be_component *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_interface_ih visitor (&ctx);
+ return visitor.visit_interface (node);
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_is.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_is.cpp
new file mode 100644
index 00000000000..5acd37d6a98
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/component_is.cpp
@@ -0,0 +1,43 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component_is.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Components
+// in the implementation skeletons file.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+// ************************************************************
+// Component visitor for implementation skeletons.
+// ************************************************************
+
+ACE_RCSID (be_visitor_component,
+ component_is,
+ "$Id$")
+
+be_visitor_component_is::be_visitor_component_is (be_visitor_context *ctx)
+ : be_visitor_component (ctx)
+{
+}
+
+be_visitor_component_is::~be_visitor_component_is (void)
+{
+}
+
+int
+be_visitor_component_is::visit_component (be_component *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_interface_is visitor (&ctx);
+ return visitor.visit_interface (node);
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_sh.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_sh.cpp
new file mode 100644
index 00000000000..f08209f25a7
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/component_sh.cpp
@@ -0,0 +1,306 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component_sh.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Components in the server header.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_component,
+ component_sh,
+ "$Id$")
+
+// ******************************************************
+// Component visitor for server header
+// ******************************************************
+
+be_visitor_component_sh::be_visitor_component_sh (be_visitor_context *ctx)
+ : be_visitor_component (ctx)
+{
+}
+
+be_visitor_component_sh::~be_visitor_component_sh (void)
+{
+}
+
+int
+be_visitor_component_sh::visit_component (be_component *node)
+{
+ if (node->srv_hdr_gen ()
+ || node->imported ()
+ || node->is_abstract ())
+ {
+ return 0;
+ }
+
+ if (be_global->gen_amh_classes ())
+ {
+ be_visitor_amh_interface_sh amh_intf (this->ctx_);
+
+ if (amh_intf.visit_interface (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_component_sh::"
+ "visit_component - "
+ "codegen for AMH classes failed\n"),
+ -1);
+ }
+ }
+
+ if (this->generate_amh_classes (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_sh::"
+ "visit_interface - "
+ "codegen for AMH classes failed\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ 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 << be_nl << be_nl
+ << "// 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 << be_nl;
+
+ if (be_global->gen_direct_collocation ())
+ {
+ *os << "class " << node->direct_proxy_impl_name () << ";" << be_nl;
+ }
+
+ if (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;
+
+ AST_Component *base = node->base_component ();
+
+ if (base != 0)
+ {
+ *os << "public virtual POA_" << base->name ();
+ }
+ else
+ {
+ *os << "public virtual POA_Components::CCMObject";
+ }
+
+ long nsupports = node->n_inherits ();
+ AST_Interface **supports = node->supports ();
+ AST_Interface *supported = 0;
+
+ for (long i = 0; i < nsupports; ++i)
+ {
+ supported = supports[i];
+
+ if (supported->is_abstract ())
+ {
+ continue;
+ }
+
+ *os << "," << be_nl;
+ *os << "public virtual POA_" << supported->name ();
+ }
+
+ *os << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "protected:" << be_idt_nl;
+
+ // Default constructor.
+ *os << class_name.c_str () << " (void);" << be_uidt_nl << be_nl
+ << "public:" << be_idt_nl;
+
+ // Some useful typedefs.
+ *os << "// Useful for template programming." << be_nl
+ << "typedef ::" << node->name () << " _stub_type;" << be_nl
+ << "typedef ::" << node->name () << "_ptr _stub_ptr_type;" << be_nl
+ << "typedef ::" << node->name () << "_var _stub_var_type;"
+ << be_nl << be_nl;
+
+ // Copy constructor and destructor.
+ *os << class_name.c_str () << " (const "
+ << class_name.c_str () << "& rhs);" << be_nl
+ << "virtual ~" << class_name.c_str () << " (void);" << be_nl << be_nl;
+
+ // _is_a
+ *os << "virtual ::CORBA::Boolean _is_a (" << be_idt << be_idt_nl
+ << "const char* logical_type_id" << env_dflts << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // Add a skeleton for our _is_a method.
+ *os << "static void _is_a_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest &req," << be_nl
+ << "void *servant," << be_nl
+ << "void *servant_upcall" << env_decl << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // Add a skeleton for our _non_existent method.
+ *os << "static void _non_existent_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest &req," << be_nl
+ << "void *servant," << be_nl
+ << "void *servant_upcall" << env_decl << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // Add a skeleton for our _interface method.
+ *os << "static void _interface_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest &req," << be_nl
+ << "void *servant," << be_nl
+ << "void *servant_upcall" << env_decl << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // Add a skeleton for our _component method.
+ *os << "static void _component_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest &req," << be_nl
+ << "void *obj," << be_nl
+ << "void *servant_upcall" << env_decl << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // Add a skeleton for our _repository_id method.
+ *os << "static void _repository_id_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest &req," << be_nl
+ << "void *servant," << be_nl
+ << "void *servant_upcall" << env_decl << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // Add the dispatch method.
+ *os << "virtual void _dispatch (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest &req," << be_nl
+ << "void *_servant_upcall" << env_decl << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // _this
+ *os << "::" << node->full_name () << " *_this (" << be_idt << be_idt
+ << env_dflts << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // _interface_repository_id
+ *os << "virtual const char* _interface_repository_id "
+ << "(void) const;";
+
+ // Generate code for elements in the scope (e.g., operations).
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_component_sh::"
+ "visit_component - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ // Generate skeletons for operations of our base classes. These
+ // skeletons just cast the pointer to the appropriate type
+ // before invoking the call.
+ int status =
+ node->traverse_inheritance_graph (
+ be_interface::gen_skel_helper,
+ os
+ );
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_component_sh::"
+ "visit_component - "
+ "inheritance graph traversal failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl << "};" << be_nl << be_nl;
+
+ be_visitor_context ctx (*this->ctx_);
+
+ if (be_global->gen_direct_collocation ())
+ {
+ ctx = *this->ctx_;
+ // Generate strategized proxy broker.
+ be_visitor_interface_strategized_proxy_broker_sh ispb_visitor (&ctx);
+
+ if (node->accept (&ispb_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "be_visitor_component_sh::"
+ "visit_component - "
+ "codegen for collocated class failed\n"
+ ),
+ -1
+ );
+ }
+ }
+
+ ctx = *this->ctx_;
+
+ // Generate the collocated class.
+
+ ctx = *this->ctx_;
+
+ if (be_global->gen_direct_collocation ())
+ {
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH);
+ be_visitor_interface_direct_proxy_impl_sh idpi_visitor (&ctx);
+
+ if (node->accept (&idpi_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "be_visitor_component_sh::"
+ "visit_component - "
+ "codegen for direct collocated class failed\n"
+ ),
+ -1
+ );
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_component_sh::generate_amh_classes (be_component *node)
+{
+ if (be_global->gen_amh_classes ())
+ {
+ 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_component/component_si.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_si.cpp
new file mode 100644
index 00000000000..1e54cc1218e
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/component_si.cpp
@@ -0,0 +1,44 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component_si.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Components in the server inline.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_component,
+ component_si,
+ "$Id$")
+
+// ******************************************************
+// Component visitor for server inline
+// ******************************************************
+
+be_visitor_component_si::be_visitor_component_si (be_visitor_context *ctx)
+ : be_visitor_component (ctx)
+{
+}
+
+be_visitor_component_si::~be_visitor_component_si (void)
+{
+}
+
+int
+be_visitor_component_si::visit_component (be_component *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_interface_si visitor (&ctx);
+ return visitor.visit_interface (node);
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_ss.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_ss.cpp
new file mode 100644
index 00000000000..e318af98c75
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/component_ss.cpp
@@ -0,0 +1,44 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component_si.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Components in the server skeleton.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_component,
+ component_ss,
+ "$Id$")
+
+// ******************************************************
+// Component visitor for server skeleton
+// ******************************************************
+
+be_visitor_component_ss::be_visitor_component_ss (be_visitor_context *ctx)
+ : be_visitor_component (ctx)
+{
+}
+
+be_visitor_component_ss::~be_visitor_component_ss (void)
+{
+}
+
+int
+be_visitor_component_ss::visit_component (be_component *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_interface_ss visitor (&ctx);
+ return visitor.visit_interface (node);
+}
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..baf29faad36
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component_fwd.cpp
@@ -0,0 +1,35 @@
+//
+// $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_component_fwd.h"
+#include "be_helper.h"
+
+#include "be_visitor_component_fwd.h"
+#include "be_visitor_interface_fwd.h"
+#include "be_visitor_context.h"
+
+#include "be_visitor_component_fwd/component_fwd_ch.cpp"
+#include "be_visitor_component_fwd/any_op_ch.cpp"
+#include "be_visitor_component_fwd/cdr_op_ch.cpp"
+
+ACE_RCSID (be,
+ be_visitor_component_fwd,
+ "$Id$")
+
diff --git a/TAO/TAO_IDL/be/be_visitor_component_fwd/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_component_fwd/any_op_ch.cpp
new file mode 100644
index 00000000000..bfa9474be87
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component_fwd/any_op_ch.cpp
@@ -0,0 +1,49 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Any operators for a forward declared
+// component in the client header.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_component_fwd,
+ any_op_ch,
+ "$Id$")
+
+// ***************************************************************************
+// Generates Any operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_component_fwd_any_op_ch::be_visitor_component_fwd_any_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_component_fwd_any_op_ch::~be_visitor_component_fwd_any_op_ch (void)
+{
+}
+
+int
+be_visitor_component_fwd_any_op_ch::visit_component_fwd (
+ be_component_fwd *node
+ )
+{
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_interface_fwd_any_op_ch visitor (&ctx);
+ return visitor.visit_interface_fwd (node);
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_component_fwd/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_component_fwd/cdr_op_ch.cpp
new file mode 100644
index 00000000000..b532b2f8248
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component_fwd/cdr_op_ch.cpp
@@ -0,0 +1,48 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for CDR operators for forward declared
+// components. This uses compiled marshaling.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_component_fwd,
+ cdr_op_ch,
+ "$Id$")
+
+// ***************************************************************************
+// Forward declared component visitor for generating CDR operator declarations
+// in the client header. Called if this node is not later defined in the file.
+// ***************************************************************************
+
+be_visitor_component_fwd_cdr_op_ch::be_visitor_component_fwd_cdr_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_component_fwd_cdr_op_ch::~be_visitor_component_fwd_cdr_op_ch (void)
+{
+}
+
+int
+be_visitor_component_fwd_cdr_op_ch::visit_component_fwd (be_component_fwd *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_interface_fwd_cdr_op_ch visitor (&ctx);
+ return visitor.visit_interface_fwd (node);
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_component_fwd/component_fwd_ch.cpp b/TAO/TAO_IDL/be/be_visitor_component_fwd/component_fwd_ch.cpp
new file mode 100644
index 00000000000..8e3336853b4
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component_fwd/component_fwd_ch.cpp
@@ -0,0 +1,48 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component_fwd_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Component_Fwd node in the client header.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_component_fwd,
+ component_fwd_ch,
+ "$Id$")
+
+// ********************************************************************
+// Visitor implementation for the Component_Fwd type
+// This one for the client header file
+// ********************************************************************
+
+be_visitor_component_fwd_ch::be_visitor_component_fwd_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_component_fwd_ch::~be_visitor_component_fwd_ch (void)
+{
+}
+
+// Visit the component_fwd_ch node and its scope.
+int
+be_visitor_component_fwd_ch::visit_component_fwd (be_component_fwd *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_interface_fwd_ch visitor (&ctx);
+ return visitor.visit_interface_fwd (node);
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_constant.cpp b/TAO/TAO_IDL/be/be_visitor_constant.cpp
new file mode 100644
index 00000000000..31fe34ea8fc
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_constant.cpp
@@ -0,0 +1,37 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_constant.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Constant
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_constant.h"
+#include "be_module.h"
+#include "be_helper.h"
+#include "be_extern.h"
+#include "be_typedef.h"
+#include "utl_identifier.h"
+
+#include "be_visitor_constant.h"
+#include "be_visitor_context.h"
+
+#include "be_visitor_constant/constant_ch.cpp"
+#include "be_visitor_constant/constant_cs.cpp"
+
+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
new file mode 100644
index 00000000000..87eb012138e
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_constant/constant_ch.cpp
@@ -0,0 +1,147 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// constant_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the Constant node in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_constant,
+ constant_ch,
+ "$Id$")
+
+
+// ********************************************************************
+// Visitor implementation for the Constant type
+// This one for the client header file
+// ********************************************************************
+
+be_visitor_constant_ch::be_visitor_constant_ch (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_constant_ch::~be_visitor_constant_ch (void)
+{
+}
+
+// Visit the Constant node and its scope.
+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 ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // 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.
+
+ AST_Decl::NodeType nt = AST_Decl::NT_pre_defined;
+ AST_Decl *tdef = node->constant_value ()->get_tdef ();
+ AST_Decl::NodeType bnt = AST_Decl::NT_pre_defined;
+ AST_Expression::ExprType etype = node->et ();
+ AST_Decl::NodeType snt = node->defined_in ()->scope_node_type ();
+
+ if (tdef != 0)
+ {
+ nt = tdef->node_type ();
+ be_typedef *td = be_typedef:: narrow_from_decl (tdef);
+ bnt = td->base_node_type ();
+ }
+
+ *os << be_nl << be_nl;
+
+ if (! node->is_nested ())
+ {
+ *os << "const ";
+
+ if (etype == AST_Expression::EV_enum)
+ {
+ *os << node->enum_full_name ();
+ }
+ else if (nt == AST_Decl::NT_typedef)
+ {
+ *os << tdef->name ();
+ }
+ else
+ {
+ *os << node->exprtype_to_string ();
+ }
+
+ *os << " " << node->local_name ();
+ }
+ // We are nested inside an interface or a valuetype.
+ else
+ {
+ if (snt != AST_Decl::NT_module)
+ {
+ *os << "static ";
+ }
+ else if (!be_global->gen_inline_constants ())
+ {
+ *os << "TAO_NAMESPACE_STORAGE_CLASS ";
+ }
+
+ *os << "const ";
+
+ if (etype == AST_Expression::EV_enum)
+ {
+ *os << node->enum_full_name ();
+ }
+ else if (nt == AST_Decl::NT_typedef)
+ {
+ if (bnt == AST_Decl::NT_string || bnt == AST_Decl::NT_wstring)
+ {
+ *os << node->exprtype_to_string ();
+ }
+ else
+ {
+ *os << tdef->name ();
+ }
+ }
+ else
+ {
+ *os << node->exprtype_to_string ();
+ }
+
+ *os << " " << node->local_name ();
+ }
+
+ // If this is true, can't generate inline constants.
+ bool forbidden_in_class = (snt != AST_Decl::NT_root
+ && snt != AST_Decl::NT_module
+ && (etype == AST_Expression::EV_string
+ || etype == AST_Expression::EV_wstring
+ || etype == AST_Expression::EV_float
+ || etype == AST_Expression::EV_double
+ || etype == AST_Expression::EV_longdouble));
+
+ if (!node->is_nested ()
+ || (be_global->gen_inline_constants () && !forbidden_in_class))
+ {
+ *os << " = " << node->constant_value ();
+ }
+
+ *os << ";";
+
+ node->cli_hdr_gen (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp b/TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp
new file mode 100644
index 00000000000..7323ebf54b6
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp
@@ -0,0 +1,139 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// constant_cs.cpp
+//
+// = DESCRIPTION
+// Visitor for code generation of Constant code in the client stubs file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_constant,
+ constant_cs,
+ "$Id$")
+
+
+// ********************************************************************
+// Visitor implementation for the Constant type
+// This one for the client stubs file
+// ********************************************************************
+
+be_visitor_constant_cs::be_visitor_constant_cs (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_constant_cs::~be_visitor_constant_cs (void)
+{
+}
+
+// visit the Constant_cs node and its scope
+int
+be_visitor_constant_cs::visit_constant (be_constant *node)
+{
+
+ if (node->cli_stub_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ AST_Expression::ExprType etype = node->et ();
+ AST_Decl::NodeType snt = node->defined_in ()->scope_node_type ();
+
+ // If this is true, can't generate inline constants.
+ bool forbidden_in_class = (snt != AST_Decl::NT_root
+ && snt != AST_Decl::NT_module
+ && (etype == AST_Expression::EV_string
+ || etype == AST_Expression::EV_wstring
+ || etype == AST_Expression::EV_float
+ || etype == AST_Expression::EV_double
+ || etype == AST_Expression::EV_longdouble));
+
+ if (!node->is_nested ()
+ || (be_global->gen_inline_constants () && !forbidden_in_class))
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (node->is_nested ())
+ {
+ // For those constants not defined in the outermost scope,
+ // or in a module, they get assigned to their values in the source file.
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl << be_nl
+ << "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 ()
+ << ";";
+ }
+
+ node->cli_stub_gen (true);
+ return 0;
+}
+
+// The following needs to be done until the MSVC++ compiler fixes its
+// broken handling of namespaces (hopefully forthcoming in version 7).
+int
+be_visitor_constant_cs::gen_nested_namespace_begin (be_module *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ char *item_name = 0;
+
+ for (UTL_IdListActiveIterator i (node->name ()); !i.is_done (); i.next ())
+ {
+ item_name = i.item ()->get_string ();
+
+ if (ACE_OS::strcmp (item_name, "") != 0)
+ {
+ // leave the outermost root scope.
+ *os << "namespace " << item_name << be_nl
+ << "{" << be_nl;
+ }
+ }
+
+ return 0;
+}
+
+// The following needs to be done until the MSVC++ compiler fixes its
+// broken handling of namespaces (hopefully forthcoming in version 7).
+int
+be_visitor_constant_cs::gen_nested_namespace_end (be_module *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ for (UTL_IdListActiveIterator i (node->name ()); !i.is_done (); i.next ())
+ {
+ if (ACE_OS::strcmp (i.item ()->get_string (), "") != 0)
+ {
+ // leave the outermost root scope.
+ *os << "}" << be_nl;
+ }
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_context.cpp b/TAO/TAO_IDL/be/be_visitor_context.cpp
new file mode 100644
index 00000000000..d0bf0cd1a4b
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_context.cpp
@@ -0,0 +1,654 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_context.cpp
+//
+// = DESCRIPTION
+// Maintains the context information for visitors
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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_extern.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
+be_visitor_context::be_visitor_context (void)
+ : state_ (TAO_CodeGen::TAO_INITIAL),
+ sub_state_ (TAO_CodeGen::TAO_SUB_STATE_UNKNOWN),
+ os_ (0),
+ scope_ (0),
+ node_ (0),
+ alias_ (0),
+ tdef_ (0),
+ attr_ (0),
+ exception_ (0),
+ comma_ (0),
+ interface_ (0)
+{
+}
+
+be_visitor_context::be_visitor_context (const be_visitor_context &ctx)
+ : state_ (ctx.state_),
+ sub_state_ (ctx.sub_state_),
+ os_ (ctx.os_),
+ scope_ (ctx.scope_),
+ node_ (ctx.node_),
+ alias_ (ctx.alias_),
+ tdef_ (ctx.tdef_),
+ attr_ (ctx.attr_),
+ exception_ (ctx.exception_),
+ comma_ (ctx.comma_),
+ interface_ (ctx.interface_)
+{
+}
+
+be_visitor_context &
+be_visitor_context::operator= (const be_visitor_context &ctx)
+{
+ this->state_ = ctx.state_;
+ this->sub_state_ = ctx.sub_state_;
+ this->os_ = ctx.os_;
+ this->scope_ = ctx.scope_;
+ this->node_ = ctx.node_;
+ this->alias_ = ctx.alias_;
+ this->tdef_ = ctx.tdef_;
+ this->attr_ = ctx.attr_;
+ this->exception_ = ctx.exception_;
+ this->comma_ = ctx.comma_;
+ this->interface_ = ctx.interface_;
+
+ return *this;
+}
+
+be_visitor_context::~be_visitor_context (void)
+{
+ // we do not own anything
+}
+
+//= helpers
+
+void
+be_visitor_context::reset (void)
+{
+ this->state_ = TAO_CodeGen::TAO_INITIAL;
+ this->sub_state_ = TAO_CodeGen::TAO_SUB_STATE_UNKNOWN;
+ this->os_ = 0;
+ this->scope_ = 0;
+ this->node_ = 0;
+ this->alias_ = 0;
+ this->tdef_ = 0;
+ this->attr_ = 0;
+ this->exception_ = 0;
+ this->comma_ = 0;
+}
+
+void
+be_visitor_context::stream (TAO_OutStream *os)
+{
+ this->os_ = os;
+}
+
+TAO_OutStream *
+be_visitor_context::stream (void)
+{
+ return this->os_;
+}
+
+void
+be_visitor_context::scope (be_decl *s)
+{
+ this->scope_ = s;
+}
+
+be_decl *
+be_visitor_context::scope (void)
+{
+ return this->scope_;
+}
+
+void
+be_visitor_context::node (be_decl *n)
+{
+ this->node_ = n;
+}
+
+be_decl *
+be_visitor_context::node (void)
+{
+ return this->node_;
+}
+
+void
+be_visitor_context::state (TAO_CodeGen::CG_STATE st)
+{
+ this->state_ = st;
+}
+
+TAO_CodeGen::CG_STATE
+be_visitor_context::state (void)
+{
+ return this->state_;
+}
+
+void
+be_visitor_context::sub_state (TAO_CodeGen::CG_SUB_STATE st)
+{
+ this->sub_state_ = st;
+}
+
+TAO_CodeGen::CG_SUB_STATE
+be_visitor_context::sub_state (void)
+{
+ return this->sub_state_;
+}
+
+void
+be_visitor_context::tdef (be_typedef *node)
+{
+ this->tdef_ = node;
+}
+
+be_typedef *
+be_visitor_context::tdef (void)
+{
+ return this->tdef_;
+}
+
+void
+be_visitor_context::alias (be_typedef *node)
+{
+ this->alias_ = node;
+}
+
+be_typedef *
+be_visitor_context::alias (void)
+{
+ return this->alias_;
+}
+
+void
+be_visitor_context::attribute (be_attribute *node)
+{
+ this->attr_ = node;
+}
+
+be_attribute *
+be_visitor_context::attribute (void)
+{
+ return this->attr_;
+}
+
+void
+be_visitor_context::exception (bool ib)
+{
+ this->exception_ = ib;
+}
+
+bool
+be_visitor_context::exception (void)
+{
+ return this->exception_;
+}
+
+void
+be_visitor_context::comma (bool ib)
+{
+ this->comma_ = ib;
+}
+
+bool
+be_visitor_context::comma (void)
+{
+ return this->comma_;
+}
+
+void
+be_visitor_context::interface (be_interface *interface)
+{
+ this->interface_ = interface;
+}
+
+be_interface *
+be_visitor_context::interface (void) const
+{
+ return this->interface_;
+}
+
+// ****************************************************************
+
+be_argument *
+be_visitor_context::be_node_as_argument (void)
+{
+ if (this->node_ != 0)
+ {
+ return be_argument::narrow_from_decl (this->node_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_array *
+be_visitor_context::be_node_as_array (void)
+{
+ if (this->node_ != 0)
+ {
+ return be_array::narrow_from_decl (this->node_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_attribute *
+be_visitor_context::be_node_as_attribute (void)
+{
+ if (this->node_ != 0)
+ {
+ return be_attribute::narrow_from_decl (this->node_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_constant *
+be_visitor_context::be_node_as_constant (void)
+{
+ if (this->node_ != 0)
+ {
+ return be_constant::narrow_from_decl (this->node_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_enum *
+be_visitor_context::be_node_as_enum (void)
+{
+ if (this->node_ != 0)
+ {
+ return be_enum::narrow_from_decl (this->node_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_enum_val *
+be_visitor_context::be_node_as_enum_val (void)
+{
+ if (this->node_ != 0)
+ {
+ return be_enum_val::narrow_from_decl (this->node_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_exception *
+be_visitor_context::be_node_as_exception (void)
+{
+ if (this->node_ != 0)
+ {
+ return be_exception::narrow_from_decl (this->node_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_field *
+be_visitor_context::be_node_as_field (void)
+{
+ if (this->node_ != 0)
+ {
+ return be_field::narrow_from_decl (this->node_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_interface *
+be_visitor_context::be_node_as_interface (void)
+{
+ if (this->node_ != 0)
+ {
+ return be_interface::narrow_from_decl (this->node_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_interface_fwd *
+be_visitor_context::be_node_as_interface_fwd (void)
+{
+ if (this->node_ != 0)
+ {
+ return be_interface_fwd::narrow_from_decl (this->node_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_module *
+be_visitor_context::be_node_as_module (void)
+{
+ if (this->node_ != 0)
+ {
+ return be_module::narrow_from_decl (this->node_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_operation *
+be_visitor_context::be_node_as_operation (void)
+{
+ if (this->node_ != 0)
+ {
+ return be_operation::narrow_from_decl (this->node_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_predefined_type *
+be_visitor_context::be_node_as_predefined_type (void)
+{
+ if (this->node_ != 0)
+ {
+ return be_predefined_type::narrow_from_decl (this->node_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_root *
+be_visitor_context::be_node_as_root (void)
+{
+ if (this->node_ != 0)
+ {
+ return be_root::narrow_from_decl (this->node_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_sequence *
+be_visitor_context::be_node_as_sequence (void)
+{
+ if (this->node_ != 0)
+ {
+ return be_sequence::narrow_from_decl (this->node_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_string *
+be_visitor_context::be_node_as_string (void)
+{
+ if (this->node_ != 0)
+ {
+ return be_string::narrow_from_decl (this->node_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_structure *
+be_visitor_context::be_node_as_structure (void)
+{
+ if (this->node_ != 0)
+ {
+ return be_structure::narrow_from_decl (this->node_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_typedef *
+be_visitor_context::be_node_as_typedef (void)
+{
+ if (this->node_ != 0)
+ {
+ return be_typedef::narrow_from_decl (this->node_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_union *
+be_visitor_context::be_node_as_union (void)
+{
+ if (this->node_ != 0)
+ {
+ return be_union::narrow_from_decl (this->node_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_union_branch *
+be_visitor_context::be_node_as_union_branch (void)
+{
+ if (this->node_ != 0)
+ {
+ return be_union_branch::narrow_from_decl (this->node_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_enum *
+be_visitor_context::be_scope_as_enum (void)
+{
+ if (this->scope_ != 0)
+ {
+ return be_enum::narrow_from_decl (this->scope_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_exception *
+be_visitor_context::be_scope_as_exception (void)
+{
+ if (this->scope_ != 0)
+ {
+ return be_exception::narrow_from_decl (this->scope_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_interface *
+be_visitor_context::be_scope_as_interface (void)
+{
+ if (this->scope_ != 0)
+ {
+ return be_interface::narrow_from_decl (this->scope_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_module *
+be_visitor_context::be_scope_as_module (void)
+{
+ if (this->scope_ != 0)
+ {
+ return be_module::narrow_from_decl (this->scope_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_operation *
+be_visitor_context::be_scope_as_operation (void)
+{
+ if (this->scope_ != 0)
+ {
+ return be_operation::narrow_from_decl (this->scope_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_root *
+be_visitor_context::be_scope_as_root (void)
+{
+ if (this->scope_ != 0)
+ {
+ return be_root::narrow_from_decl (this->scope_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_structure *
+be_visitor_context::be_scope_as_structure (void)
+{
+ if (this->scope_ != 0)
+ {
+ return be_structure::narrow_from_decl (this->scope_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_union *
+be_visitor_context::be_scope_as_union (void)
+{
+ if (this->scope_ != 0)
+ {
+ return be_union::narrow_from_decl (this->scope_);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+const char *
+be_visitor_context::export_macro (void) const
+{
+ switch (this->state_)
+ {
+ // If -GA is used, but the anyop macro hasn't been set,
+ // default to the stub macro.
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ return (be_global->gen_anyop_files ()
+ ? this->non_null_export_macro ()
+ : be_global->stub_export_macro ());
+ case TAO_CodeGen::TAO_ARRAY_CH:
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
+ case TAO_CodeGen::TAO_AMI_INTERFACE_CH:
+ case TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CH:
+ case TAO_CodeGen::TAO_ROOT_CH:
+ return be_global->stub_export_macro ();
+ case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
+ case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH:
+ case TAO_CodeGen::TAO_ROOT_SH:
+ return be_global->skel_export_macro ();
+ default:
+ return "";
+ }
+}
+
+const char *
+be_visitor_context::non_null_export_macro (void) const
+{
+ const char *anyop_export = be_global->anyop_export_macro ();
+
+ return (ACE_OS::strcmp (anyop_export, "") == 0
+ ? be_global->stub_export_macro ()
+ : anyop_export);
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_decl.cpp b/TAO/TAO_IDL/be/be_visitor_decl.cpp
new file mode 100644
index 00000000000..379d71a67c8
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_decl.cpp
@@ -0,0 +1,108 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_decl.cpp
+//
+// = DESCRIPTION
+// Visitor for the base be_decl node. This serves to maintain the current
+// state (context) of code generation for the derived visitor.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_visitor_decl.h"
+#include "be_visitor_sequence.h"
+#include "be_visitor_context.h"
+#include "be_typedef.h"
+#include "be_type.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (be,
+ be_visitor_decl,
+ "$Id$")
+
+// Root visitor for client header
+be_visitor_decl::be_visitor_decl (be_visitor_context *ctx)
+ : ctx_ (ctx)
+{
+}
+
+be_visitor_decl::~be_visitor_decl (void)
+{
+}
+
+be_visitor_context *
+be_visitor_decl::ctx (void)
+{
+ return this->ctx_;
+}
+
+int
+be_visitor_decl::gen_anonymous_base_type (be_type *bt,
+ TAO_CodeGen::CG_STATE cg_state)
+{
+ be_typedef *tdef = be_typedef::narrow_from_decl (bt);
+
+ if (!tdef)
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (cg_state);
+
+ // In case our container was typedef'd.
+ ctx.tdef (0);
+
+ int status = 0;
+
+ switch (cg_state)
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_sequence_ch visitor (&ctx);
+ status = bt->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_sequence_cs visitor (&ctx);
+ status = bt->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_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 context state\n"),
+ -1);
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_decl::"
+ "gen_anonymous_base_type - "
+ "anonymous base type codegen failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_enum.cpp b/TAO/TAO_IDL/be/be_visitor_enum.cpp
new file mode 100644
index 00000000000..be1a2adce3d
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_enum.cpp
@@ -0,0 +1,40 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_enum.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Enum
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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 "be_visitor_enum/enum_ch.cpp"
+#include "be_visitor_enum/enum_cs.cpp"
+#include "be_visitor_enum/any_op_ch.cpp"
+#include "be_visitor_enum/any_op_cs.cpp"
+#include "be_visitor_enum/cdr_op_ch.cpp"
+#include "be_visitor_enum/cdr_op_cs.cpp"
+#include "be_visitor_enum/serializer_op_ch.cpp"
+#include "be_visitor_enum/serializer_op_cs.cpp"
+
+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
new file mode 100644
index 00000000000..4b815165473
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_enum/any_op_ch.cpp
@@ -0,0 +1,67 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Enums for the Any operators
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_enum,
+ any_op_ch,
+ "$Id$")
+
+// ***************************************************************************
+// Enum visitor for generating Any operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_enum_any_op_ch::be_visitor_enum_any_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_enum_any_op_ch::~be_visitor_enum_any_op_ch (void)
+{
+}
+
+int
+be_visitor_enum_any_op_ch::visit_enum (be_enum *node)
+{
+ if (node->cli_hdr_any_op_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ const char *macro = this->ctx_->export_macro ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ // Generate the Any <<= and >>= operators.
+ *os << be_nl << be_nl
+ << macro << " void operator<<= (::CORBA::Any &, " << node->name ()
+ << ");" << be_nl;
+ *os << macro << " ::CORBA::Boolean operator>>= (const ::CORBA::Any &, "
+ << node->name () << " &);";
+
+ *os << be_global->core_versioning_end () << 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
new file mode 100644
index 00000000000..effcd2e15ce
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp
@@ -0,0 +1,118 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Enum for the Any operators
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_enum,
+ any_op_cs,
+ "$Id$")
+
+// ***************************************************************************
+// Enum visitor for generating Any operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_enum_any_op_cs::be_visitor_enum_any_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_enum_any_op_cs::~be_visitor_enum_any_op_cs (void)
+{
+}
+
+int
+be_visitor_enum_any_op_cs::visit_enum (be_enum *node)
+{
+ if (node->cli_stub_any_op_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ // Since we don't generate CDR stream operators for types that
+ // explicitly contain a local interface (at some level), we
+ // must override these Any template class methods to avoid
+ // calling the non-existent operators. The zero return value
+ // will eventually cause CORBA::MARSHAL to be raised if this
+ // type is inserted into an Any and then marshaled.
+ if (node->is_local ())
+ {
+ *os << "namespace TAO" << be_nl
+ << "{" << be_idt_nl
+ << "template<>" << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "Any_Basic_Impl_T<" << node->name ()
+ << ">::marshal_value (TAO_OutputCDR &)" << be_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "template<>" << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "Any_Basic_Impl_T<" << node->name ()
+ << ">::demarshal_value (TAO_InputCDR &)" << be_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+
+ // Generate the Any <<= and >>= operator declarations
+ // Any <<= and >>= operators.
+ *os << "void operator<<= (" << be_idt << be_idt_nl
+ << "::CORBA::Any &_tao_any," << be_nl
+ << node->name () << " _tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "TAO::Any_Basic_Impl_T<" << node->name () << ">::insert ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl
+ << "const ::CORBA::Any &_tao_any," << be_nl
+ << node->name () << " &_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return" << be_idt_nl
+ << "TAO::Any_Basic_Impl_T<" << node->name () << ">::extract ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "_tao_elem " << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ node->cli_stub_any_op_gen (1);
+ return 0;
+}
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
new file mode 100644
index 00000000000..2ea107d883b
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ch.cpp
@@ -0,0 +1,64 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Enums for the CDR operators
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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_decl (ctx)
+{
+}
+
+be_visitor_enum_cdr_op_ch::~be_visitor_enum_cdr_op_ch (void)
+{
+}
+
+int
+be_visitor_enum_cdr_op_ch::visit_enum (be_enum *node)
+{
+ if (node->cli_hdr_cdr_op_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ // generate the CDR << and >> operators
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator<< (TAO_OutputCDR &strm, " << node->name () << " _tao_enumerator);" << be_nl;
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator>> (TAO_InputCDR &strm, " << node->name () << " &_tao_enumerator);";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ node->cli_hdr_cdr_op_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_cs.cpp
new file mode 100644
index 00000000000..25de2c55f4b
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_cs.cpp
@@ -0,0 +1,80 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Enum for the CDR operators
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_enum,
+ cdr_op_cs,
+ "$Id$")
+
+
+// ***************************************************************************
+// Enum visitor for generating CDR operator declarations in the client
+// stubs file.
+// ***************************************************************************
+
+be_visitor_enum_cdr_op_cs::be_visitor_enum_cdr_op_cs (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_enum_cdr_op_cs::~be_visitor_enum_cdr_op_cs (void)
+{
+}
+
+int
+be_visitor_enum_cdr_op_cs::visit_enum (be_enum *node)
+{
+ if (node->cli_stub_cdr_op_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *os << "::CORBA::Boolean operator<< (TAO_OutputCDR &strm, "
+ << node->name () << " _tao_enumerator)" << be_nl
+ << "{" << be_idt_nl
+ << "return strm << static_cast< ::CORBA::ULong> (_tao_enumerator);"
+ << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "::CORBA::Boolean operator>> (TAO_InputCDR &strm, "
+ << node->name () << " & _tao_enumerator)" << be_nl
+ << "{" << be_idt_nl
+ << "::CORBA::ULong _tao_temp = 0;" << be_nl
+ << "::CORBA::Boolean const _tao_success = strm >> _tao_temp;" << be_nl
+ << be_nl
+ << "if (_tao_success)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_enumerator = static_cast<" << node->name ()
+ << "> (_tao_temp);" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "return _tao_success;" << be_uidt_nl
+ << "}";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ node->cli_stub_cdr_op_gen (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp b/TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp
new file mode 100644
index 00000000000..583b177c659
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp
@@ -0,0 +1,121 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// enum_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Enums in the client header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_visitor_typecode/typecode_decl.h"
+
+ACE_RCSID (be_visitor_enum,
+ enum_ch,
+ "$Id$")
+
+
+// ********************************************************************
+// Visitor implementation for the Enum type
+// This one for the client header file
+// ********************************************************************
+
+be_visitor_enum_ch::be_visitor_enum_ch (be_visitor_context *ctx)
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_enum_ch::~be_visitor_enum_ch (void)
+{
+}
+
+// Visit the enum_ch node and its scope.
+int
+be_visitor_enum_ch::visit_enum (be_enum *node)
+{
+ 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);
+
+ *os << be_nl << be_nl << "// 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;";
+
+ if (be_global->tc_support ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_typecode_decl visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_enum_ch::"
+ "visit_enum - "
+ "TypeCode declaration failed\n"
+ ),
+ -1);
+ }
+ }
+
+ node->cli_hdr_gen (true);
+ return 0;
+}
+
+int
+be_visitor_enum_ch::post_process (be_decl *bd)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Am I the last one?
+ if (!this->last_node (bd))
+ {
+ *os << "," << be_nl;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_enum_ch::visit_enum_val (be_enum_val *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << node->local_name ();
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_enum/enum_cs.cpp b/TAO/TAO_IDL/be/be_visitor_enum/enum_cs.cpp
new file mode 100644
index 00000000000..452cfeb3a7a
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_enum/enum_cs.cpp
@@ -0,0 +1,70 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// enum_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Enums in the client stubs
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_visitor_typecode/enum_typecode.h"
+
+ACE_RCSID (be_visitor_enum,
+ enum_cs,
+ "$Id$")
+
+
+// ********************************************************************
+// Visitor implementation for the Enum type
+// This one for the client stubs file
+// ********************************************************************
+
+be_visitor_enum_cs::be_visitor_enum_cs (be_visitor_context *ctx)
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_enum_cs::~be_visitor_enum_cs (void)
+{
+}
+
+// visit the Enum_cs node and its scope
+int
+be_visitor_enum_cs::visit_enum (be_enum *node)
+{
+ if (node->cli_stub_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ if (be_global->tc_support ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+ // ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
+ TAO::be_visitor_enum_typecode visitor (&ctx);
+
+ if (visitor.visit_enum (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_enum_cs::"
+ "visit_enum - "
+ "TypeCode definition failed\n"),
+ -1);
+ }
+ }
+
+ node->cli_stub_gen (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_enum/serializer_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_enum/serializer_op_ch.cpp
new file mode 100644
index 00000000000..fa543f76d59
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_enum/serializer_op_ch.cpp
@@ -0,0 +1,62 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Enums for the TAO::DCPS::Serializer operators
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_enum,
+ serializer_op_ch,
+ "$Id$")
+
+
+// ***************************************************************************
+// Enum visitor for generating Serializer operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_enum_serializer_op_ch::be_visitor_enum_serializer_op_ch (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_enum_serializer_op_ch::~be_visitor_enum_serializer_op_ch (void)
+{
+}
+
+int
+be_visitor_enum_serializer_op_ch::visit_enum (be_enum *node)
+{
+ if (node->cli_hdr_serializer_op_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // generate the Serializer << and >> operators
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator<< (TAO::DCPS::Serializer &, const " << node->name ()
+ << " &);" << be_nl;
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator>> (TAO::DCPS::Serializer &, "
+ << node->name () << " &);";
+
+ node->cli_hdr_serializer_op_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_enum/serializer_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_enum/serializer_op_cs.cpp
new file mode 100644
index 00000000000..8ee3eab7b30
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_enum/serializer_op_cs.cpp
@@ -0,0 +1,76 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Enum for the
+// TAO::DCPS::Serializer operators
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_enum,
+ serializer_op_cs,
+ "$Id$")
+
+
+// ***************************************************************************
+// Enum visitor for generating Serializer operator declarations in the client
+// stubs file.
+// ***************************************************************************
+
+be_visitor_enum_serializer_op_cs::be_visitor_enum_serializer_op_cs (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_enum_serializer_op_cs::~be_visitor_enum_serializer_op_cs (void)
+{
+}
+
+int
+be_visitor_enum_serializer_op_cs::visit_enum (be_enum *node)
+{
+ if (node->cli_stub_serializer_op_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "::CORBA::Boolean operator<< (TAO::DCPS::Serializer &strm, "
+ << "const " << node->name () << " &_tao_enumval)" << be_nl
+ << "{" << be_idt_nl
+ << "::CORBA::ULong _tao_temp = _tao_enumval;" << be_nl
+ << "return strm << _tao_temp;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "::CORBA::Boolean operator>> (TAO::DCPS::Serializer &strm, "
+ << node->name () << " &_tao_enumval)" << be_nl
+ << "{" << be_idt_nl
+ << "::CORBA::ULong _tao_temp = 0;" << be_nl
+ << "::CORBA::Boolean _tao_result = strm >> _tao_temp;" << be_nl << be_nl
+ << "if (_tao_result == 1)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_enumval = static_cast<" << node->name ()
+ << "> (_tao_temp);" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "return _tao_result;" << be_uidt_nl
+ << "}";
+
+ node->cli_stub_serializer_op_gen (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_exception.cpp b/TAO/TAO_IDL/be/be_visitor_exception.cpp
new file mode 100644
index 00000000000..b1abf086343
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_exception.cpp
@@ -0,0 +1,58 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_exception.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Exception
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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_valuebox.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 "be_visitor_typecode.h"
+#include "ace/Log_Msg.h"
+
+#include "be_visitor_exception/exception.cpp"
+#include "be_visitor_exception/exception_ch.cpp"
+#include "be_visitor_exception/exception_ci.cpp"
+#include "be_visitor_exception/exception_cs.cpp"
+#include "be_visitor_exception/exception_ctor.cpp"
+#include "be_visitor_exception/ctor_assign.cpp"
+#include "be_visitor_exception/any_op_ch.cpp"
+#include "be_visitor_exception/any_op_cs.cpp"
+#include "be_visitor_exception/cdr_op_ch.cpp"
+#include "be_visitor_exception/cdr_op_cs.cpp"
+
+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
new file mode 100644
index 00000000000..3682ee0670d
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_exception/any_op_ch.cpp
@@ -0,0 +1,177 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the Any operators for Exceptions
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_exception,
+ any_op_ch,
+ "$Id$")
+
+// ***************************************************************************
+// Exception visitor for generating Any operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_exception_any_op_ch::be_visitor_exception_any_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_exception_any_op_ch::~be_visitor_exception_any_op_ch (void)
+{
+}
+
+int
+be_visitor_exception_any_op_ch::visit_exception (be_exception *node)
+{
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ const char *macro = this->ctx_->export_macro ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *os << be_nl << be_nl
+ << macro << " void operator<<= (::CORBA::Any &, const " << node->name ()
+ << " &); // copying version" << be_nl;
+ *os << macro << " void operator<<= (::CORBA::Any &, " << node->name ()
+ << "*); // noncopying version" << be_nl;
+ *os << macro << " ::CORBA::Boolean operator>>= (const ::CORBA::Any &, "
+ << node->name () << " *&); // deprecated\n";
+ *os << macro << " ::CORBA::Boolean operator>>= (const ::CORBA::Any &, const "
+ << node->name () << " *&);";
+
+ *os << be_global->core_versioning_end () << 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_exception::visit_exception - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ node->cli_hdr_any_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_exception_any_op_ch::visit_field (be_field *node)
+{
+ // 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_exception_any_op_ch::"
+ "visit_field - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_any_op_ch::"
+ "visit_field - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_exception_any_op_ch::visit_enum (be_enum *node)
+{
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ be_visitor_enum_any_op_ch visitor (this->ctx_);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_any_op_ch::"
+ "visit_enum - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_exception_any_op_ch::visit_structure (be_structure *node)
+{
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ be_visitor_structure_any_op_ch visitor (this->ctx_);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_any_op_ch::"
+ "visit_structure - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_exception_any_op_ch::visit_union (be_union *node)
+{
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ be_visitor_union_any_op_ch visitor (this->ctx_);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_any_op_ch::"
+ "visit_union - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp
new file mode 100644
index 00000000000..f432f30d54a
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp
@@ -0,0 +1,293 @@
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the Any operators for Exceptions.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_exception,
+ any_op_cs,
+ "$Id$")
+
+// ***************************************************************************
+// Exception visitor for generating Any operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_exception_any_op_cs::be_visitor_exception_any_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_exception_any_op_cs::~be_visitor_exception_any_op_cs (void)
+{
+}
+
+int
+be_visitor_exception_any_op_cs::visit_exception (be_exception *node)
+{
+ if (node->cli_stub_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl
+ << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ if (!node->is_local ())
+ {
+ *os << be_nl << be_nl
+ << "namespace TAO" << be_nl
+ << "{" << be_idt_nl
+ << "template<>" << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "Any_Dual_Impl_T<" << node->name ()
+ << ">::demarshal_value (" << be_idt << be_idt_nl
+ << "TAO_InputCDR & cdr" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::String_var id;" << be_nl << be_nl
+ << "if (!(cdr >> id.out ()))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << (be_global->use_raw_throw () ? "try" :"ACE_TRY_NEW_ENV")
+ << be_idt_nl
+ << "{" << be_idt_nl
+ << "this->value_->_tao_decode (cdr"
+ << (be_global->use_raw_throw () ? "" : " ACE_ENV_ARG_PARAMETER")
+ << ");" << ace_try_check << be_uidt_nl
+ << "}" << be_uidt_nl
+ << (be_global->use_raw_throw ()
+ ? "catch ( ::CORBA::Exception &)"
+ : "ACE_CATCHANY")
+ << be_idt_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_uidt
+ << ace_endtry << be_nl << be_nl
+ << "return true;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}";
+ }
+ // Since we don't generate CDR stream operators for types that
+ // explicitly contain a local interface (at some level), we
+ // must override these Any template class methods to avoid
+ // calling the non-existent operators. The zero return value
+ // will eventually cause CORBA::MARSHAL to be raised if this
+ // type is inserted into an Any and then marshaled.
+ else
+ {
+ *os << be_nl << be_nl
+ << "namespace TAO" << be_nl
+ << "{" << be_idt_nl
+ << "template<>" << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "Any_Dual_Impl_T<" << node->name ()
+ << ">::marshal_value (TAO_OutputCDR &)" << be_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "template<>" << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "Any_Dual_Impl_T<" << node->name ()
+ << ">::demarshal_value (TAO_InputCDR &)" << be_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}";
+ }
+
+ // Copying insertion operator.
+
+ *os << be_nl << be_nl
+ << "// Copying insertion." << be_nl
+ << "void operator<<= (" << be_idt << be_idt_nl
+ << "::CORBA::Any &_tao_any," << be_nl
+ << "const " << node->name () << " &_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "TAO::Any_Dual_Impl_T<" << node->name () << ">::insert_copy ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Non-copying insertion operator."
+ *os << "// Non-copying insertion." << be_nl
+ << "void operator<<= (" << be_idt << be_idt_nl
+ << "::CORBA::Any &_tao_any," << be_nl
+ << node->name () << " *_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "TAO::Any_Dual_Impl_T<" << node->name () << ">::insert ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Extraction to non-const pointer operator.
+ *os << "// Extraction to non-const pointer (deprecated)." << be_nl
+ << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl
+ << "const ::CORBA::Any &_tao_any," << be_nl
+ << node->name () << " *&_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return _tao_any >>= const_cast<" << be_idt << be_idt_nl
+ << "const " << node->name () << " *&> (" << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Extraction to const pointer operator.
+ *os << "// Extraction to const pointer." << be_nl
+ << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl
+ << "const ::CORBA::Any &_tao_any," << be_nl
+ << "const " << node->name () << " *&_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return" << be_idt_nl
+ << "TAO::Any_Dual_Impl_T<" << node->name () << ">::extract ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}";
+
+ *os << be_global->core_versioning_end () << 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_exception::visit_exception - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ node->cli_stub_any_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_exception_any_op_cs::visit_field (be_field *node)
+{
+ // 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_exception_any_op_cs::"
+ "visit_field - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_any_op_cs::"
+ "visit_field - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_exception_any_op_cs::visit_enum (be_enum *node)
+{
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ be_visitor_enum_any_op_cs visitor (this->ctx_);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_any_op_cs::"
+ "visit_enum - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_exception_any_op_cs::visit_structure (be_structure *node)
+{
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ be_visitor_structure_any_op_cs visitor (this->ctx_);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_any_op_cs::"
+ "visit_structure - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_exception_any_op_cs::visit_union (be_union *node)
+{
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ be_visitor_union_any_op_cs visitor (this->ctx_);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_any_op_cs::"
+ "visit_union - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
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
new file mode 100644
index 00000000000..920e14412e7
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ch.cpp
@@ -0,0 +1,80 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for CDR operators for exceptions. This uses
+// compiled marshaling.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+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;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *os << be_nl << be_nl
+ << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator<< (TAO_OutputCDR &, const " << node->name ()
+ << " &);" << be_nl;
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator>> (TAO_InputCDR &, "
+ << node->name () << " &);";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ // Set the substate as generating code for the types defined in our scope.
+ this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
+
+ 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);
+ }
+
+ node->cli_hdr_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
new file mode 100644
index 00000000000..ce9d86f8d83
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_cs.cpp
@@ -0,0 +1,203 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for CDR operators for exceptions
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+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;
+ }
+
+ this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
+
+ 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);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ // Set the sub state as generating code for the output operator.
+ this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_OUTPUT);
+
+ *os << be_nl << 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 (*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_idt_nl
+ << "{" << be_idt_nl
+ << "// Now marshal the members (if any)." << be_nl
+ << "return (" << be_idt_nl;
+
+ 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);
+ }
+
+ *os << be_uidt_nl << " );" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "else" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl;
+ }
+ else
+ {
+ // No members.
+ *os << "// Marshal the repository ID." << be_nl
+ << "return (strm << _tao_aggregate._rep_id ());" << be_uidt_nl;
+ }
+
+ *os << "}" << 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 operator>> (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &";
+
+ if (node->nmembers () > 0)
+ {
+ *os << "strm," << be_nl
+ << node->name () << " &_tao_aggregate" << be_uidt_nl
+ << ")" << be_uidt_nl;
+ }
+ else
+ {
+ *os << "," << be_nl
+ << node->name () << "&" << be_uidt_nl
+ << ")" << be_uidt_nl;
+ }
+
+ *os << "{" << be_idt_nl;
+
+ // WARNING: This method is not symmetric with respect to the
+ // encoding function!
+ // Exceptions are strange.... the repository ID is retrieved by the
+ // caller, and they invoke this method only to demarshal the
+ // members. While the marshaling method encodes both...
+
+ // Do we have any members?
+ if (node->nmembers () > 0)
+ {
+ 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 << "// Demarshal the members." << be_nl
+ << "return (" << be_idt_nl;
+
+ 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);
+ }
+
+ *os << be_uidt_nl << ");" << be_uidt_nl;
+ }
+ else
+ {
+ *os << "return true;" << be_uidt_nl;
+ }
+
+ *os << "}";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ node->cli_stub_cdr_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_exception_cdr_op_cs::post_process (be_decl *bd)
+{
+ // This checks for members of an enum 'non-scope' declared inside
+ // the exception. If an enum val is actually a member, it will
+ // have node type NT_field.
+ if (bd->node_type () == AST_Decl::NT_enum_val)
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (!this->last_node (bd))
+ {
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ *os << " &&" << be_nl;
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ default:
+ break;
+ };
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/ctor_assign.cpp b/TAO/TAO_IDL/be/be_visitor_exception/ctor_assign.cpp
new file mode 100644
index 00000000000..ea3c3fbdda0
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_exception/ctor_assign.cpp
@@ -0,0 +1,424 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// ctor_assign.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the special CTOR and assignment operator for
+// Exceptions.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_exception,
+ ctor_assign,
+ "$Id$")
+
+// ************************************************************************
+// Used for the body of the assignment operator and the copy constructor.
+// ************************************************************************
+
+be_visitor_exception_ctor_assign::be_visitor_exception_ctor_assign (
+ be_visitor_context *ctx
+ )
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_exception_ctor_assign::~be_visitor_exception_ctor_assign (void)
+{
+}
+
+int
+be_visitor_exception_ctor_assign::visit_exception (be_exception *node)
+{
+ // Save the argument node.
+ this->ctx_->node (node);
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_exception_ctor_assign::"
+ "visit_exception - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_exception_ctor_assign::visit_field (be_field *node)
+{
+ // Save the argument node.
+ this->ctx_->node (node);
+
+ // Retrieve the type.
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_exception_ctor_assign::"
+ "visit_field - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ // Different types have different mappings when used as in/out or
+ // inout parameters. Let this visitor deal with the type.
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_exception_ctor_assign::"
+ "visit_field - "
+ "cannot accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_exception_ctor_assign::visit_array (be_array *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_decl *bd = this->ctx_->node ();
+
+ *os << be_nl;
+
+ if (ACE_OS::strcmp (bd->flat_name (), node->flat_name ()) != 0)
+ {
+ // We are typedef'd.
+ *os << node->name ();
+ }
+ else
+ {
+ // We are anonymous.
+ *os << "_" << bd->local_name ();
+ }
+
+ if (this->ctx_->exception ())
+ {
+ // Constructor from member args.
+ *os << "_copy (this->" << bd->local_name ()
+ << ", _tao_" << bd->local_name () << ");";
+ }
+ else
+ {
+ // Copy constructor and assignment operator.
+ *os << "_copy (this->" << bd->local_name ()
+ << ", _tao_excp." << bd->local_name () << ");";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_exception_ctor_assign::visit_enum (be_enum *)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_decl *bd = this->ctx_->node ();
+
+ *os << be_nl;
+
+ if (this->ctx_->exception ()) // Special constructor.
+ {
+ *os << "this->" << bd->local_name () << " = _tao_"
+ << bd->local_name () << ";";
+ }
+ else
+ {
+ *os << "this->" << bd->local_name () << " = _tao_excp."
+ << bd->local_name () << ";";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_exception_ctor_assign::visit_interface (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_decl *bd = this->ctx_->node ();
+
+ *os << be_nl;
+
+ if (this->ctx_->exception ()) // Special constructor.
+ {
+ *os << "this->" << bd->local_name () << " = TAO::Objref_Traits<"
+ << node->name () << ">::duplicate (_tao_"
+ << bd->local_name () << ");";
+ }
+ else
+ {
+ *os << "this->" << bd->local_name () << " = TAO::Objref_Traits<"
+ << node->name () << ">::duplicate (_tao_excp."
+ << bd->local_name () << ".in ());";
+ }
+
+ return 0;
+}
+
+int be_visitor_exception_ctor_assign::visit_interface_fwd (
+ be_interface_fwd *node
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_decl *bd = this->ctx_->node ();
+
+ *os << be_nl;
+
+ if (this->ctx_->exception ()) // Special constructor.
+ {
+ *os << "this->" << bd->local_name () << " = " << node->name ()
+ << "::_duplicate (_tao_" << bd->local_name () << ");";
+ }
+ else
+ {
+ *os << "this->" << bd->local_name () << " = " << node->name ()
+ << "::_duplicate (_tao_excp." << bd->local_name () << ".in ());";
+ }
+ return 0;
+}
+
+int
+be_visitor_exception_ctor_assign::visit_valuebox (be_valuebox *node)
+{
+ return this->emit_valuetype_common (node);
+}
+
+int
+be_visitor_exception_ctor_assign::visit_valuetype (be_valuetype *node)
+{
+ return this->emit_valuetype_common (node);
+}
+
+int be_visitor_exception_ctor_assign::visit_valuetype_fwd (
+ be_valuetype_fwd *node
+ )
+{
+ return this->emit_valuetype_common (node);
+}
+
+int be_visitor_exception_ctor_assign::visit_predefined_type (
+ be_predefined_type *node
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_decl *bd = this->ctx_->node ();
+ AST_PredefinedType::PredefinedType pt = node->pt ();
+
+ *os << be_nl;
+
+ // Check if the type is an any.
+ if (pt == AST_PredefinedType::PT_any)
+ {
+ if (this->ctx_->exception ()) // Special constructor.
+ {
+ *os << "this->" << bd->local_name () << " = _tao_"
+ << bd->local_name () << ";";
+ }
+ else
+ {
+ *os << "this->" << bd->local_name () << " = _tao_excp."
+ << bd->local_name () << ";";
+ }
+ }
+ 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 () << ");";
+ }
+ else
+ {
+ *os << "this->" << bd->local_name () << " = "
+ << node->name () << "::_duplicate (_tao_excp."
+ << bd->local_name () << ".in ());";
+ }
+ }
+ else // Simple predefined types.
+ {
+ if (this->ctx_->exception ()) // Special constructor.
+ {
+ *os << "this->" << bd->local_name () << " = _tao_"
+ << bd->local_name () << ";";
+ }
+ else
+ {
+ *os << "this->" << bd->local_name () << " = _tao_excp."
+ << bd->local_name () << ";";
+ }
+ }
+
+ return 0;
+}
+
+int be_visitor_exception_ctor_assign::visit_sequence (be_sequence *)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_decl *bd = this->ctx_->node ();
+
+ *os << be_nl;
+
+ if (this->ctx_->exception ()) // Special constructor.
+ {
+ *os << "this->" << bd->local_name () << " = _tao_" << bd->local_name ()
+ << ";";
+ }
+ else
+ {
+ *os << "this->" << bd->local_name () << " = _tao_excp."
+ << bd->local_name () << ";";
+ }
+
+ return 0;
+}
+
+int be_visitor_exception_ctor_assign::visit_string (be_string *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_decl *bd = this->ctx_->node ();
+
+ *os << be_nl;
+
+ if (this->ctx_->exception ()) // Special constructor.
+ {
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "this->" << bd->local_name ()
+ << " = ::CORBA::string_dup (_tao_"
+ << bd->local_name () << ");";
+ }
+ else
+ {
+ *os << "this->" << bd->local_name ()
+ << " = ::CORBA::wstring_dup (_tao_"
+ << bd->local_name () << ");";
+ }
+ }
+ else
+ {
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "this->" << bd->local_name ()
+ << " = ::CORBA::string_dup (_tao_excp."
+ << bd->local_name () << ".in ());";
+ }
+ else
+ {
+ *os << "this->" << bd->local_name ()
+ << " = ::CORBA::wstring_dup (_tao_excp."
+ << bd->local_name () << ".in ());";
+ }
+ }
+
+ return 0;
+}
+
+int be_visitor_exception_ctor_assign::visit_structure (be_structure *)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_decl *bd = this->ctx_->node ();
+
+ *os << be_nl;
+
+ if (this->ctx_->exception ()) // Special constructor.
+ {
+ *os << "this->" << bd->local_name () << " = _tao_" << bd->local_name ()
+ << ";";
+ }
+ else
+ {
+ *os << "this->" << bd->local_name () << " = _tao_excp."
+ << bd->local_name () << ";";
+ }
+
+ return 0;
+}
+
+int be_visitor_exception_ctor_assign::visit_union (be_union *)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_decl *bd = this->ctx_->node ();
+
+ *os << be_nl;
+
+ if (this->ctx_->exception ()) // Special constructor.
+ {
+ *os << "this->" << bd->local_name () << " = _tao_" << bd->local_name ()
+ << ";";
+ }
+ else
+ {
+ *os << "this->" << bd->local_name () << " = _tao_excp."
+ << bd->local_name () << ";";
+ }
+
+ return 0;
+}
+
+int be_visitor_exception_ctor_assign::visit_typedef (be_typedef *node)
+{
+ this->ctx_->alias (node);
+
+ if (node->primitive_base_type ()->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_exception_ctor_assign::"
+ "visit_typedef - "
+ "accept on primitive type failed\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_exception_ctor_assign::emit_valuetype_common (be_type *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
+ << "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
+ << "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;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/exception.cpp b/TAO/TAO_IDL/be/be_visitor_exception/exception.cpp
new file mode 100644
index 00000000000..b805b899cf1
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_exception/exception.cpp
@@ -0,0 +1,109 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// .cpp
+//
+// = DESCRIPTION
+// Generic visitor generating code for Exceptions.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_exception,
+ exception,
+ "$Id$")
+
+
+// Generic exception visitor.
+be_visitor_exception::be_visitor_exception (be_visitor_context *ctx)
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_exception::~be_visitor_exception (void)
+{
+}
+
+// Visit the Exception node and its scope.
+int
+be_visitor_exception::visit_exception (be_exception *)
+{
+ // 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.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ // This switch is acceptable rather than having derived visitors overriding
+ // this method and differing only in what state they set
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ {
+ be_visitor_field_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_field_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_field_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_field_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_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);
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception::"
+ "visit_field - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp b/TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp
new file mode 100644
index 00000000000..0bfdc169d89
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp
@@ -0,0 +1,152 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// exception_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Exception in the client header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_visitor_typecode/typecode_decl.h"
+#include "global_extern.h"
+#include "utl_err.h"
+
+ACE_RCSID (be_visitor_exception,
+ exception_ch,
+ "$Id$")
+
+// ******************************************************
+// For client header.
+// ******************************************************
+
+be_visitor_exception_ch::be_visitor_exception_ch (be_visitor_context *ctx)
+ : be_visitor_exception (ctx)
+{
+}
+
+be_visitor_exception_ch::~be_visitor_exception_ch (void)
+{
+}
+
+// Visit the Exception node and its scope.
+int be_visitor_exception_ch::visit_exception (be_exception *node)
+{
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ os->gen_ifdef_macro (node->flat_name ());
+
+ *os << be_nl << be_nl << "class " << be_global->stub_export_macro ()
+ << " " << node->local_name ()
+ << " : public ::CORBA::UserException" << be_nl;
+ *os << "{" << be_nl
+ << "public:" << be_idt_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 << 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;
+
+ // Assignment operator.
+ *os << node->local_name () << " &operator= (const "
+ << node->local_name () << " &);" << be_nl << be_nl;
+
+ if (be_global->any_support ())
+ {
+ *os << "static void _tao_any_destructor (void *);" << be_nl << be_nl;
+ }
+
+
+ *os << "static " << node->local_name ()
+ << " *_downcast ( ::CORBA::Exception *);" << be_nl
+ << "static const " << node->local_name ()
+ << " *_downcast ( ::CORBA::Exception const *);" << be_nl << be_nl;
+
+ *os << "static ::CORBA::Exception *_alloc (void);" << be_nl << be_nl;
+
+ *os << "virtual ::CORBA::Exception *"
+ << "_tao_duplicate (void) const;\n" << be_nl
+ << "virtual void _raise (void) const;\n" << be_nl
+ << "virtual void _tao_encode (" << be_idt << be_idt_nl
+ << "TAO_OutputCDR &cdr" << env_decl << be_uidt_nl
+ << ") const;" << be_uidt_nl << be_nl
+ << "virtual void _tao_decode (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &cdr" << env_decl << be_uidt_nl
+ << ");" << be_uidt;
+
+ // 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)
+ {
+ 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 << be_nl
+ << "virtual ::CORBA::TypeCode_ptr _tao_type (void) const;";
+ }
+
+ *os << be_uidt_nl << "};";
+
+ if (be_global->tc_support ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_typecode_decl visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_ch::"
+ "visit_exception - "
+ "TypeCode declaration failed\n"),
+ -1);
+ }
+ }
+
+ os->gen_endif ();
+ node->cli_hdr_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/exception_ci.cpp b/TAO/TAO_IDL/be/be_visitor_exception/exception_ci.cpp
new file mode 100644
index 00000000000..25edecd0bac
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_ci.cpp
@@ -0,0 +1,59 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// exception_ci.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Exception in the inline file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_exception,
+ exception_ci,
+ "$Id$")
+
+
+// ******************************************************
+// for client inline
+// ******************************************************
+
+be_visitor_exception_ci::be_visitor_exception_ci (be_visitor_context *ctx)
+ : be_visitor_exception (ctx)
+{
+}
+
+be_visitor_exception_ci::~be_visitor_exception_ci (void)
+{
+}
+
+// visit the Exception node and its scope
+int be_visitor_exception_ci::visit_exception (be_exception *node)
+{
+ if (node->cli_inline_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ // Generate inline code required of any anonymous types of members.
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception::"
+ "visit_exception -"
+ "code for inline failed\n"),
+ -1);
+ }
+
+ node->cli_inline_gen (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp b/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp
new file mode 100644
index 00000000000..376e6244a6a
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp
@@ -0,0 +1,361 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// exception_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Exception in the stubs file
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_visitor_typecode/typecode_defn.h"
+
+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)
+{
+}
+
+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)
+{
+ if (node->cli_stub_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ os->indent ();
+
+ // Generate stub 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 stub failed\n"),
+ -1);
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Default constructor.
+ *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 << node->name () << "::~" << node->local_name ()
+ << " (void)" << be_nl;
+ *os << "{" << be_nl;
+ *os << "}" << be_nl << be_nl;
+
+ // Copy constructor.
+ *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_);
+
+ if (node->nmembers () > 0)
+ {
+ *os << be_idt;
+
+ // 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_cs::"
+ "visit_exception -"
+ "codegen for scope failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Assignment operator.
+ *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);";
+
+ // Assign each individual member.
+ ctx = *this->ctx_;
+ be_visitor_exception_ctor_assign ca_visitor (&ctx);
+
+ if (node->accept (&ca_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_cs::"
+ "visit_exception -"
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ *os << be_nl
+ << "return *this;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ if (be_global->any_support ())
+ {
+ *os << "void "
+ << node->name ()
+ << "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
+ << "{" << be_idt_nl
+ << node->local_name () << " *_tao_tmp_pointer =" << be_idt_nl
+ << "static_cast<"
+ << node->local_name () << " *> (_tao_void_pointer);" << be_uidt_nl
+ << "delete _tao_tmp_pointer;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+
+ // Non-const downcast method.
+ *os << node->name () << " *" << be_nl;
+ *os << node->name () << "::_downcast ( ::CORBA::Exception *_tao_excp)" << be_nl;
+ *os << "{" << be_idt_nl;
+ *os << "return dynamic_cast<" << node->local_name ()
+ << " *> (_tao_excp);" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+
+ // Const downcast method.
+ *os << "const " << node->name () << " *" << be_nl;
+ *os << node->name () << "::_downcast ( ::CORBA::Exception const *_tao_excp)"
+ << be_nl;
+ *os << "{" << be_idt_nl;
+ *os << "return dynamic_cast<const " << node->local_name ()
+ << " *> (_tao_excp);" << 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 = 0;" << 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
+ << "}" << be_nl << be_nl;
+
+ *os << "void " << node->name () << "::_raise (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "TAO_RAISE (*this);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "void " << node->name ()
+ << "::_tao_encode (" << be_idt << be_idt_nl;
+
+ if (!node->is_local ())
+ {
+ *os << "TAO_OutputCDR &cdr" << env_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;
+ }
+ else
+ {
+ *os << "TAO_OutputCDR &" << env_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 << "void " << node->name ()
+ << "::_tao_decode (" << be_idt << be_idt_nl;
+
+ if (!node->is_local ())
+ {
+ *os << "TAO_InputCDR &cdr" << env_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;
+ }
+ else
+ {
+ *os << "TAO_InputCDR &" << env_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;
+ }
+
+ // 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)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception::"
+ "visit_exception - "
+ "codegen for ctor failed\n"),
+ -1);
+ }
+
+ *os << be_idt_nl
+ << ": ::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_idt;
+
+ // Assign each individual member. We need yet another state.
+ ctx = *this->ctx_;
+
+ // 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)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_cs::"
+ "visit_exception -"
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl << "}" << be_nl << be_nl;
+ }
+
+ // Switch streams to the *A.cpp file if we are using this option.
+ if (be_global->gen_anyop_files ())
+ {
+ os = tao_cg->anyop_source ();
+ *os << be_nl << be_nl;
+ }
+
+ if (be_global->tc_support ())
+ {
+ *os << "// TAO extension - the virtual _type method." << be_nl;
+ *os << "::CORBA::TypeCode_ptr " << node->name ()
+ << "::_tao_type (void) const" << be_nl;
+ *os << "{" << be_idt_nl;
+ *os << "return ::" << node->tc_name () << ";" << be_uidt_nl;
+ *os << "}";
+ }
+
+ // Make sure we are generating to *C.cpp regardless of the above.
+ os = tao_cg->client_stubs ();
+
+ if (be_global->tc_support ())
+ {
+ ctx = *this->ctx_;
+ TAO::be_visitor_struct_typecode 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);
+ }
+ }
+
+ node->cli_stub_gen (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/exception_ctor.cpp b/TAO/TAO_IDL/be/be_visitor_exception/exception_ctor.cpp
new file mode 100644
index 00000000000..28303432bdf
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_ctor.cpp
@@ -0,0 +1,462 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// exception_ctor.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the special constructor for Exceptions
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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_scope (ctx)
+{
+}
+
+be_visitor_exception_ctor::~be_visitor_exception_ctor (void)
+{
+}
+
+int
+be_visitor_exception_ctor::post_process (be_decl *bd)
+{
+ // This checks for members of an enum 'non-scope' declared inside
+ // the exception. If an enum val is actually a member, it will
+ // have node type NT_field.
+ if (bd->node_type () == AST_Decl::NT_enum_val)
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream (); // get output stream
+
+ if (!this->last_node (bd))
+ {
+ *os << "," << be_nl;
+ }
+
+ return 0;
+}
+
+int be_visitor_exception_ctor::visit_exception (be_exception *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl << be_nl;
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
+ {
+ *os << node->local_name ();
+ }
+ else
+ {
+ *os << node->name () << "::" << node->local_name ();
+ }
+
+ *os << " (" << be_idt << be_idt_nl;
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_exception_ctor_assign::"
+ "visit_exception - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
+ {
+ *os << be_uidt_nl << ");" << be_uidt;
+ }
+ else
+ {
+ *os << be_uidt_nl << ")" << be_uidt;
+ }
+
+ return 0;
+}
+
+int be_visitor_exception_ctor::visit_field (be_field *node)
+{
+ TAO_OutStream *os = this->ctx_->stream (); // get output stream
+
+ // Retrieve the type.
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_exception_ctor::"
+ "visit_exception - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_exception_ctor::"
+ "visit_field - "
+ "cannot accept visitor\n"),
+ -1);
+ }
+
+ *os << " _tao_" << node->local_name ();
+
+ return 0;
+}
+
+int be_visitor_exception_ctor::visit_array (be_array *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ *os << "const ";
+
+ be_typedef *tdef = be_typedef::narrow_from_decl (bt);
+
+ if (this->ctx_->state () != TAO_CodeGen::TAO_EXCEPTION_CTOR_CH
+ && !tdef)
+ {
+ *os << this->ctx_->scope ()->full_name () << "::";
+ }
+
+ if (!tdef)
+ {
+ *os << "_";
+ }
+
+ *os << bt->nested_type_name (this->ctx_->scope ());
+
+ return 0;
+}
+
+int be_visitor_exception_ctor::visit_enum (be_enum *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_EXCEPTION_CTOR_CH)
+ {
+ *os << bt->nested_type_name (this->ctx_->scope ());
+ }
+ else
+ {
+ *os << bt->name ();
+ }
+
+ return 0;
+}
+
+int be_visitor_exception_ctor::visit_interface (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ 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";
+ }
+
+ return 0;
+}
+
+int be_visitor_exception_ctor::visit_interface_fwd (be_interface_fwd *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
+ {
+ *os << "const " << bt->nested_type_name (this->ctx_->scope (), "_ptr");
+ }
+ else
+ {
+ *os << "const " << bt->name () << "_ptr";
+ }
+
+ return 0;
+}
+
+int be_visitor_exception_ctor::visit_valuebox (be_valuebox *node)
+{
+ return this->emit_common (node);
+}
+
+int be_visitor_exception_ctor::visit_valuetype (be_valuetype *node)
+{
+ return this->emit_common (node);
+}
+
+int be_visitor_exception_ctor::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ return this->emit_common (node);
+}
+
+int be_visitor_exception_ctor::visit_predefined_type (be_predefined_type *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+ be_typedef *td = this->ctx_->alias ();
+
+ if (td != 0)
+ {
+ bt = td;
+ }
+ else
+ {
+ bt = node;
+ }
+
+ AST_PredefinedType::PredefinedType pt = node->pt ();
+ const char *no_td_global = (td == 0 ? "::" : "");
+
+ if (pt == AST_PredefinedType::PT_any)
+ {
+ if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
+ {
+ *os << "const " << no_td_global
+ << bt->nested_type_name (this->ctx_->scope ());
+ }
+ else
+ {
+ *os << "const ::" << bt->name ();
+ }
+
+ *os << " &";
+
+ return 0;
+ }
+ else if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
+ {
+ *os << "const " << no_td_global
+ << bt->nested_type_name (this->ctx_->scope (), "_ptr ");
+ }
+ else
+ {
+ *os << "const ::" << bt->name () << "_ptr ";
+ }
+ }
+ else
+ {
+ if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
+ {
+ *os << no_td_global << bt->nested_type_name (this->ctx_->scope ());
+ }
+ else
+ {
+ *os << "::" << bt->name ();
+ }
+ }
+
+ return 0;
+}
+
+int be_visitor_exception_ctor::visit_sequence (be_sequence *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_EXCEPTION_CTOR_CH)
+ {
+ *os << "const " << bt->nested_type_name (this->ctx_->scope ());
+ }
+ else
+ {
+ *os << "const " << bt->name ();
+ }
+
+ *os << " &";
+
+ return 0;
+}
+
+int be_visitor_exception_ctor::visit_string (be_string *node)
+{
+ TAO_OutStream *os = this->ctx_->stream (); // get output stream
+
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "const char *";
+ }
+ else
+ {
+ *os << "const ::CORBA::WChar *";
+ }
+
+ return 0;
+}
+
+int be_visitor_exception_ctor::visit_structure (be_structure *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_EXCEPTION_CTOR_CH)
+ {
+ *os << "const " << bt->nested_type_name (this->ctx_->scope ());
+ }
+ else
+ {
+ *os << "const " << bt->name ();
+ }
+
+ *os << " &";
+
+ return 0;
+}
+
+int be_visitor_exception_ctor::visit_union (be_union *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
+ {
+ *os << "const " << bt->nested_type_name (this->ctx_->scope ());
+ }
+ else
+ {
+ *os << "const " << bt->name ();
+ }
+
+ *os << " &";
+
+ return 0;
+}
+
+int be_visitor_exception_ctor::visit_typedef (be_typedef *node)
+{
+ this->ctx_->alias (node);
+
+ if (node->primitive_base_type ()->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_exception_ctor::"
+ "visit_typedef - "
+ "accept on primitive type failed\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int be_visitor_exception_ctor::emit_common (be_type *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
+ {
+ *os << "const " << bt->nested_type_name (this->ctx_->scope (), " *");
+ }
+ else
+ {
+ *os << "const " << bt->name () << " *";
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_factory.cpp b/TAO/TAO_IDL/be/be_visitor_factory.cpp
new file mode 100644
index 00000000000..2a228ffe01d
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_factory.cpp
@@ -0,0 +1,144 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL Backend
+//
+// = FILENAME
+// be_visitor_factory.cpp
+//
+// = DESCRIPTION
+// Defines a factory that returns a specialized visitor object based on the
+// 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 "ast_argument.h"
+
+#include "be_visitor_factory.h"
+#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)
+{
+}
+
+TAO_Visitor_Factory::~TAO_Visitor_Factory (void)
+{
+}
+
+be_visitor *
+TAO_Visitor_Factory::make_visitor (be_visitor_context *ctx)
+{
+ be_visitor *retval = 0;
+
+ switch (ctx->state ())
+ {
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ ACE_NEW_RETURN (retval,
+ be_visitor_interface_ch (ctx),
+ 0);
+ break;
+ case TAO_CodeGen::TAO_VALUETYPE_OBV_CH:
+ ACE_NEW_RETURN (retval,
+ be_visitor_valuetype_obv_ch (ctx),
+ 0);
+ break;
+ case TAO_CodeGen::TAO_VALUETYPE_OBV_CS:
+ ACE_NEW_RETURN (retval,
+ be_visitor_valuetype_obv_cs (ctx),
+ 0);
+ break;
+ case TAO_CodeGen::TAO_OPERATION_CH:
+ ACE_NEW_RETURN (retval,
+ be_visitor_operation_ch (ctx),
+ 0);
+ break;
+ case TAO_CodeGen::TAO_OPERATION_CS:
+ ACE_NEW_RETURN (retval,
+ be_visitor_operation_cs (ctx),
+ 0);
+ break;
+ case TAO_CodeGen::TAO_AMI_INTERFACE_CH:
+ ACE_NEW_RETURN (retval,
+ be_visitor_ami_interface_ch (ctx),
+ 0);
+ break;
+ case TAO_CodeGen::TAO_AMI_HANDLER_REPLY_STUB_OPERATION_CH:
+ 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:
+ ACE_NEW_RETURN (
+ retval,
+ be_visitor_operation_ami_handler_reply_stub_operation_cs (ctx),
+ 0
+ );
+ break;
+ case TAO_CodeGen::TAO_AMI_SENDC_OPERATION_CH:
+ ACE_NEW_RETURN (retval,
+ be_visitor_operation_ami_ch (ctx),
+ 0);
+ break;
+ case TAO_CodeGen::TAO_AMI_SENDC_OPERATION_CS:
+ ACE_NEW_RETURN (retval,
+ be_visitor_operation_ami_cs (ctx),
+ 0);
+ break;
+ case TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_RAISE_OPERATION_CS:
+ ACE_NEW_RETURN (
+ retval,
+ be_visitor_operation_ami_exception_holder_operation_cs (ctx),
+ 0
+ );
+ break;
+ case TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CH:
+ ACE_NEW_RETURN (retval,
+ be_visitor_valuetype_ami_exception_holder_ch (ctx),
+ 0);
+ break;
+ case TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CS:
+ ACE_NEW_RETURN (retval,
+ be_visitor_valuetype_ami_exception_holder_cs (ctx),
+ 0);
+ break;
+ default:
+ // 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
new file mode 100644
index 00000000000..1d3606b754e
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_field.cpp
@@ -0,0 +1,59 @@
+//
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_field.cpp
+//
+// = DESCRIPTION
+// Concrete visitor for the base "BE_Field" node
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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_valuebox.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_component.h"
+#include "be_component_fwd.h"
+#include "be_eventtype.h"
+#include "be_eventtype_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 "ace/Log_Msg.h"
+
+#include "be_visitor_field/field_ch.cpp"
+#include "be_visitor_field/field_ci.cpp"
+#include "be_visitor_field/field_cs.cpp"
+#include "be_visitor_field/cdr_op_ch.cpp"
+#include "be_visitor_field/cdr_op_cs.cpp"
+#include "be_visitor_field/serializer_op_ch.cpp"
+#include "be_visitor_field/serializer_op_cs.cpp"
+
+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
new file mode 100644
index 00000000000..05f0fb84746
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_field/cdr_op_ch.cpp
@@ -0,0 +1,248 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating CDR operator declarator for field in the client header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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"
+
+ACE_RCSID (be_visitor_field,
+ cdr_op_ch,
+ "$Id$")
+
+
+// **********************************************
+// Visitor for field in the client header file.
+// **********************************************
+
+// Constructor.
+be_visitor_field_cdr_op_ch::be_visitor_field_cdr_op_ch (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+// Destructor.
+be_visitor_field_cdr_op_ch::~be_visitor_field_cdr_op_ch (void)
+{
+}
+
+// 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);
+ }
+
+ 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);
+ }
+
+ return 0;
+}
+
+// Visit operations on all possible data types that a field can be.
+
+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 (!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);
+
+ // First generate the array declaration.
+ 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);
+ }
+ }
+
+ return 0;
+}
+
+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.
+ && 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 enum declaration.
+ 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::"
+ "visit_enum - "
+ "codegen failed\n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
+
+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 (!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 sequence declaration.
+ 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::"
+ "visit_sequence - "
+ "codegen failed\n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_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
+ && 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
+ 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::"
+ "visit_struct - "
+ "codegen failed\n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_cdr_op_ch::visit_typedef (be_typedef *node)
+{
+ // Save the node for use in code generation and
+ // indicate that the field of the field 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_field_cdr_op_ch::"
+ "visit_typedef - "
+ "Bad primitive type\n"
+ ), -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+// visit union type
+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 (!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 enum declaration.
+ 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::"
+ "visit_enum - "
+ "codegen failed\n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
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
new file mode 100644
index 00000000000..80e7dbe755f
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_field/cdr_op_cs.cpp
@@ -0,0 +1,981 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_cdr_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Field in the client stubs file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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"
+
+ACE_RCSID (be_visitor_field,
+ cdr_op_cs,
+ "$Id$")
+
+
+// **********************************************
+// visitor for field in the client stubs file
+// **********************************************
+
+be_visitor_field_cdr_op_cs::be_visitor_field_cdr_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_field_cdr_op_cs::~be_visitor_field_cdr_op_cs (void)
+{
+}
+
+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);
+ }
+
+ 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);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_cdr_op_cs::visit_array (be_array *node)
+{
+ // If the array is defined in this scope, we must generate
+ // CDR stream operators for the array itself.
+ if (!this->ctx_->alias ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ // Now generate the (de)marshaling code for the array as a
+ // field.
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_field *f = this->ctx_->be_node_as_field ();
+
+ if (f == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_cdr_op_cs::"
+ "visit_array - "
+ "cannot retrieve field node\n"),
+ -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];
+
+ // 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 () == 0 // Not a typedef.
+ && node->is_child (this->ctx_->scope ()))
+ {
+ // 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.
+ 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 (),
+ node->local_name ()->get_string ());
+ }
+ else
+ {
+ ACE_OS::sprintf (fname,
+ "_%s",
+ node->full_name ());
+ }
+ }
+ else
+ {
+ // Typedefed node.
+ ACE_OS::sprintf (fname,
+ "%s",
+ node->full_name ());
+ }
+
+ // 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 ())
+ {
+ 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.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_cdr_op_cs::"
+ "visit_array - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_cdr_op_cs::visit_enum (be_enum *node)
+{
+ // If we are defined inside this scope, we must generate the
+ /// CDR stream operators for us here.
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_enum_cdr_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_cdr_op_cs::"
+ "visit_enum - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ 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_cs::"
+ "visit_enum - "
+ "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 () << ")";
+
+ 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.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_cdr_op_cs::"
+ "visit_enum - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_cdr_op_cs::visit_interface (be_interface *node)
+{
+ 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_cs::"
+ "visit_interface - "
+ "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:
+ if (node->is_defined ())
+ {
+ if (f->is_abstract ())
+ {
+ *os << "(strm << _tao_aggregate."
+ << f->local_name () << ".in ())";
+ }
+ else
+ {
+ *os << "::CORBA::Object::marshal (" << be_idt << be_idt_nl
+ << "_tao_aggregate." << f->local_name () << ".in ()," << be_nl
+ << "strm" << be_uidt_nl
+ << ")" << be_uidt;
+ }
+ }
+ else
+ {
+ *os << "TAO::Objref_Traits<" << node->name () << ">::marshal ("
+ << be_idt << be_idt_nl
+ << "_tao_aggregate." << f->local_name () << ".in ()," << be_nl
+ << "strm" << be_uidt_nl
+ << ")" << be_uidt;
+ }
+
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done because an interface cannot be declared inside a
+ // structure.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_cdr_op_cs::"
+ "visit_interface - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_cdr_op_cs::visit_component (be_component *node)
+{
+ return this->visit_interface (node);
+}
+
+int
+be_visitor_field_cdr_op_cs::visit_interface_fwd (be_interface_fwd *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_cs::"
+ "visit_interface_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:
+ if (node->is_defined ())
+ {
+ if (f->is_abstract ())
+ {
+ *os << "(strm << _tao_aggregate."
+ << f->local_name () << ".in ())";
+ }
+ else
+ {
+ *os << "::CORBA::Object::marshal (" << be_idt << be_idt_nl
+ << "_tao_aggregate." << f->local_name () << ".in ()," << be_nl
+ << "strm" << be_uidt_nl
+ << ")" << be_uidt;
+ }
+ }
+ else
+ {
+ AST_Decl *parent = ScopeAsDecl (node->defined_in ());
+
+ if (parent != 0 && parent->node_type () != AST_Decl::NT_root)
+ {
+ *os << parent->name () << "::";
+ }
+
+ *os << "TAO::Objref_Traits<" << node->name () << ">::marshal ("
+ << be_idt << be_idt_nl
+ << "_tao_aggregate." << f->local_name () << ".in ()," << be_nl
+ << "strm" << be_uidt_nl
+ << ")" << be_uidt;
+ }
+
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done because an interface cannot be declared inside a
+ // structure.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_cdr_op_cs::"
+ "visit_interface_fwd - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_cdr_op_cs::visit_component_fwd (be_component_fwd *node)
+{
+ return this->visit_interface_fwd (node);
+}
+
+int
+be_visitor_field_cdr_op_cs::visit_valuebox (be_valuebox *)
+{
+ return this->emit_valuetype_common ();
+}
+
+int
+be_visitor_field_cdr_op_cs::visit_valuetype (be_valuetype *)
+{
+ return this->emit_valuetype_common ();
+}
+
+int
+be_visitor_field_cdr_op_cs::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_field_cdr_op_cs::visit_valuetype_fwd (be_valuetype_fwd *)
+{
+ return this->emit_valuetype_common ();
+}
+
+int
+be_visitor_field_cdr_op_cs::visit_eventtype_fwd (be_eventtype_fwd *node)
+{
+ return this->visit_valuetype_fwd (node);
+}
+
+
+int
+be_visitor_field_cdr_op_cs::emit_valuetype_common (void)
+{
+ 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_cs::"
+ "emit_common - "
+ "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_cs::"
+ "emit_common - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+
+// Visit predefined type.
+int
+be_visitor_field_cdr_op_cs::visit_predefined_type (be_predefined_type *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_cs::"
+ "visit_predefined_type - "
+ "cannot retrieve field node\n"),
+ -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_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << "(strm >> _tao_aggregate." << f->local_name ()
+ << ".out ())";
+ }
+ else if (pt == AST_PredefinedType::PT_char)
+ {
+ *os << "(strm >> ::ACE_InputCDR::to_char (_tao_aggregate."
+ << f->local_name () << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_wchar)
+ {
+ *os << "(strm >> ::ACE_InputCDR::to_wchar (_tao_aggregate."
+ << f->local_name () << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_octet)
+ {
+ *os << "(strm >> ::ACE_InputCDR::to_octet (_tao_aggregate."
+ << f->local_name () << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_boolean)
+ {
+ *os << "(strm >> ::ACE_InputCDR::to_boolean (_tao_aggregate."
+ << f->local_name () << "))";
+ }
+ else
+ {
+ *os << "(strm >> _tao_aggregate." << f->local_name () << ")";
+ }
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << "(strm << _tao_aggregate." << f->local_name () << ".in ())";
+ }
+ else if (pt == AST_PredefinedType::PT_char)
+ {
+ *os << "(strm << ::ACE_OutputCDR::from_char (_tao_aggregate."
+ << f->local_name () << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_wchar)
+ {
+ *os << "(strm << ::ACE_OutputCDR::from_wchar (_tao_aggregate."
+ << f->local_name () << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_octet)
+ {
+ *os << "(strm << ::ACE_OutputCDR::from_octet (_tao_aggregate."
+ << f->local_name () << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_boolean)
+ {
+ *os << "(strm << ::ACE_OutputCDR::from_boolean (_tao_aggregate."
+ << f->local_name () << "))";
+ }
+ else
+ {
+ *os << "(strm << _tao_aggregate." << f->local_name () << ")";
+ }
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_cdr_op_cs::"
+ "visit_array - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_cdr_op_cs::visit_sequence (be_sequence *node)
+{
+ // If the sequence is defined in this scope, generate its
+ // CDR stream operators here.
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ // How generate the marshaling code for the sequence as a field.
+
+ 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_cs::"
+ "visit_sequence - "
+ "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 () << ")";
+
+ 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.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_cdr_op_cs::"
+ "visit_sequence - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_cdr_op_cs::visit_string (be_string *)
+{
+ 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_cs::"
+ "visit_string - "
+ "cannot retrieve field node\n"),
+ -1);
+ }
+
+ // check what is the code generation's 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.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_cdr_op_cs::"
+ "visit_array - "
+ "bad substate\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_cdr_op_cs::visit_structure (be_structure *node)
+{
+ // If the struct is defined in this scope, generate its CDR stream
+ // operators here.
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ // How generate the marshaling code for the struct as a field.
+
+ 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_cs::"
+ "visit_structure - "
+ "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 () << ")";
+
+ 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.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_cdr_op_cs::"
+ "visit_structure - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_cdr_op_cs::visit_typedef (be_typedef *node)
+{
+ 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_field_cdr_op_cs::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_field_cdr_op_cs::visit_union (be_union *node)
+{
+ // If the union is defined in this scope, generate its CDR stream
+ // operators here.
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ // Now generate marshaling code for the union as a field.
+
+ 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_cs::"
+ "visit_union - "
+ "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 () << ")";
+
+ 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.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_cdr_op_cs::"
+ "visit_union - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+// ****************************************************************
+
+be_visitor_cdr_op_field_decl::be_visitor_cdr_op_field_decl (
+ be_visitor_context *ctx
+ )
+ : be_visitor_scope (ctx)
+{
+}
+
+// This is a field, but the action depends on the type of the field,
+// use this visitor to detect the type of the field.
+// Notice that this is why the parent visitor (who create us) cannot
+// do the job, because it may have another purpose for some or all of
+// the visit_* methods; in other words, while running a visitor to
+// generate CDR operators for structures we cannot use that one to
+// generate the code of each field, because visit_struct already has a
+// meaning in that visitor.
+int
+be_visitor_cdr_op_field_decl::visit_field (be_field *node)
+{
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (bt == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_cdr_op_field_decl::"
+ "visit_field - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ // @@ Shouldn't this be saved in the visitor and not the context?!
+ this->ctx_->node (node);
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_cdr_op_field_decl::"
+ "visit_field - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_cdr_op_field_decl::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)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_cdr_op_field_decl::"
+ "visit_array - "
+ "cannot retrieve field node\n"),
+ -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];
+
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+
+ if (this->ctx_->alias () == 0 // Not a typedef.
+ && node->is_child (this->ctx_->scope ()))
+ {
+ // 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 (node->is_nested ())
+ {
+ 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 ());
+ }
+ }
+ else
+ {
+ // Typedefed node.
+ ACE_OS::sprintf (fname,
+ "%s",
+ node->full_name ());
+ }
+
+ // 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 ())
+ {
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << fname << "_forany "
+ << "_tao_aggregate_" << f->local_name () << be_idt << be_idt_nl
+ << "(const_cast<" << be_idt << be_idt_nl
+ << fname << "_slice*> (" << be_nl
+ << "_tao_aggregate." << f->local_name () << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ");" << be_uidt_nl;
+
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_cdr_op_field_decl::"
+ "visit_array - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+
+int
+be_visitor_cdr_op_field_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.
+ be_type *bt = node->primitive_base_type ();
+
+ if (bt == 0 || bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_cdr_op_field_decl::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ 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
new file mode 100644
index 00000000000..710f8b1c8b8
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp
@@ -0,0 +1,607 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Field node in the client header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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.
+// **********************************************
+
+be_visitor_field_ch::be_visitor_field_ch (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_field_ch::~be_visitor_field_ch (void)
+{
+}
+
+int
+be_visitor_field_ch::visit_field (be_field *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_ch::"
+ "visit_field - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ this->ctx_->node (node);
+
+ *os << be_nl;
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_ch::"
+ "visit_field - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ // Now output the field name.
+ *os << " " << node->local_name () << ";";
+
+ return 0;
+}
+
+// Visit operations on all possible data types that a field can be.
+
+int
+be_visitor_field_ch::visit_array (be_array *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ // If not a typedef and we are defined in the use scope, we must be defined.
+ if (!this->ctx_->alias ()
+ && 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 array declaration
+ ctx.state (TAO_CodeGen::TAO_ARRAY_CH);
+ be_visitor_array_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_ch::"
+ "visit_array - "
+ "codegen failed\n"),
+ -1);
+ }
+
+ ctx.state (TAO_CodeGen::TAO_ROOT_CH);
+
+ // Having defined all array type and its supporting operations, now
+ // generate the actual variable that is a field of the structure.
+ *os << be_nl << be_nl << "_" << bt->local_name ();
+ }
+ else
+ {
+ // 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->nested_type_name (this->ctx_->scope ());
+ }
+ else
+ {
+ *os << bt->name ();
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_ch::visit_enum (be_enum *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ // If not a typedef and we are defined in the use scope, we must be defined.
+ if (!this->ctx_->alias () // not a typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+
+ // First generate the enum declaration.
+ be_visitor_enum_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_ch::"
+ "visit_enum - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ // 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->nested_type_name (this->ctx_->scope ());
+ }
+ else
+ {
+ *os << bt->name ();
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_ch::visit_interface (be_interface *node)
+{
+ return this->emit_common (node);
+}
+
+int
+be_visitor_field_ch::visit_interface_fwd (be_interface_fwd *node)
+{
+ return this->emit_common (node);
+}
+
+int
+be_visitor_field_ch::visit_valuebox (be_valuebox *node)
+{
+ return this->emit_common (node);
+}
+
+int
+be_visitor_field_ch::visit_valuetype (be_valuetype *node)
+{
+ return this->emit_common (node);
+}
+
+int
+be_visitor_field_ch::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ return this->emit_common (node);
+}
+
+
+int
+be_visitor_field_ch::emit_common (be_type *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ // 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->nested_type_name (this->ctx_->scope (), "_var");
+ }
+ else
+ {
+ *os << bt->name () << "_var";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_ch::visit_predefined_type (be_predefined_type *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+ be_typedef *td = this->ctx_->alias ();
+
+ if (td != 0)
+ {
+ bt = td;
+ }
+ else
+ {
+ bt = node;
+ }
+
+ // If we are a typedef of a basic type, ACE_NESTED_CLASS might
+ // be emitted as part of the type name, in which case the '::'
+ // would be incorrect for certain expansions of the macro.
+ if (td == 0)
+ {
+ *os << "::";
+ }
+
+ if (node->pt () == AST_PredefinedType::PT_object)
+ {
+ *os << bt->name () << "_var";
+ }
+ else if (node->pt () == AST_PredefinedType::PT_value)
+ {
+ *os << bt->name () << " *";
+ }
+ else if (node->pt () == AST_PredefinedType::PT_pseudo)
+ {
+ // 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->nested_type_name (this->ctx_->scope (), "_var");
+ }
+ else
+ {
+ *os << bt->name () << "_var";
+ }
+ }
+ else
+ {
+ // 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->nested_type_name (this->ctx_->scope ());
+ }
+ else
+ {
+ // All the predefined types are in the CORBA namespace,
+ // so we go ahead and add the global :: qualifier.
+ *os << bt->name ();
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_ch::visit_sequence (be_sequence *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!this->ctx_->alias ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ // Put the field node into the (anonymous) sequence node, to be
+ // used later for unique name generation.
+ be_field *member_node =
+ be_field::narrow_from_decl (this->ctx_->node ());
+ node->field_node (member_node);
+
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+
+ // First generate the sequence declaration.
+ be_visitor_sequence_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_ch::"
+ "visit_sequence - "
+ "codegen failed\n"),
+ -1);
+ }
+
+ // 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_valuetype)
+ {
+ // Generate the anonymous sequence member typedef.
+ be_decl *bs = this->ctx_->scope ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "typedef " << bt->nested_type_name (bs)
+ << " _" << this->ctx_->node ()->local_name ()
+ << "_seq;" << be_nl;
+ }
+ }
+
+ // ACE_NESTED_CLASS macro generated by nested_type_name
+ // is not necessary in all cases.
+ be_typedef *tdef = be_typedef::narrow_from_decl (bt);
+
+ // 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
+ || !tdef)
+ {
+ *os << bt->nested_type_name (this->ctx_->scope ());
+ }
+ else
+ {
+ *os << bt->name ();
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_ch::visit_string (be_string *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "TAO::String_Manager";
+ }
+ else
+ {
+ *os << "TAO::WString_Manager";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_ch::visit_structure (be_structure *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!this->ctx_->alias () // not a typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+
+ be_visitor_structure_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_ch::"
+ "visit_struct - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ // 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->nested_type_name (this->ctx_->scope ());
+ }
+ else
+ {
+ *os << bt->name ();
+ }
+
+ return 0;
+}
+
+// Visit typedefed type.
+int
+be_visitor_field_ch::visit_typedef (be_typedef *node)
+{
+ 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_field_ch::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ // Reset the alias.
+ this->ctx_->alias (0);
+ return 0;
+}
+
+// visit union type
+int
+be_visitor_field_ch::visit_union (be_union *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!this->ctx_->alias ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+
+ be_visitor_union_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_ch::"
+ "visit_union - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_nl << be_nl;
+
+ // 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->nested_type_name (this->ctx_->scope ());
+ }
+ else
+ {
+ *os << bt->name ();
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_ch::visit_component (
+ be_component *node
+ )
+{
+ return this->visit_interface (node);
+}
+
+int
+be_visitor_field_ch::visit_component_fwd (
+ be_component_fwd *node
+ )
+{
+ return this->visit_interface_fwd (node);
+}
+
+int
+be_visitor_field_ch::visit_eventtype (
+ be_eventtype *node
+ )
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_field_ch::visit_eventtype_fwd (
+ be_eventtype_fwd *node
+ )
+{
+ return this->visit_valuetype_fwd (node);
+}
+
+
diff --git a/TAO/TAO_IDL/be/be_visitor_field/field_ci.cpp b/TAO/TAO_IDL/be/be_visitor_field/field_ci.cpp
new file mode 100644
index 00000000000..9e753d25833
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_field/field_ci.cpp
@@ -0,0 +1,162 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_ci.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Field in the client inline file
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_visitor_array/array_ci.h"
+#include "be_visitor_structure/structure_ci.h"
+#include "be_visitor_union/union_ci.h"
+
+ACE_RCSID (be_visitor_field,
+ field_ci,
+ "$Id$")
+
+
+be_visitor_field_ci::be_visitor_field_ci (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_field_ci::~be_visitor_field_ci (void)
+{
+}
+
+int
+be_visitor_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_ci::"
+ "visit_field - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ 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);
+ }
+
+ return 0;
+}
+
+// Visit operations on all possible data types that a field can be
+
+int
+be_visitor_field_ci::visit_array (be_array *node)
+{
+ if (!this->ctx_->alias ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_ci::visit_sequence (be_sequence *)
+{
+ return 0;
+}
+
+int
+be_visitor_field_ci::visit_structure (be_structure *node)
+{
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_ci::visit_typedef (be_typedef *node)
+{
+ 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);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_field_ci::visit_union (be_union *node)
+{
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_field/field_cs.cpp b/TAO/TAO_IDL/be/be_visitor_field/field_cs.cpp
new file mode 100644
index 00000000000..ba5b6dc0d68
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_field/field_cs.cpp
@@ -0,0 +1,205 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Field in the client stubs file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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"
+
+ACE_RCSID (be_visitor_field,
+ field_cs,
+ "$Id$")
+
+
+// **********************************************
+// Visitor for field in the client stubs file.
+// **********************************************
+
+be_visitor_field_cs::be_visitor_field_cs (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_field_cs::~be_visitor_field_cs (void)
+{
+}
+
+int
+be_visitor_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);
+ }
+
+ 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);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_cs::visit_array (be_array *node)
+{
+ if (!this->ctx_->alias ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_cs::visit_enum (be_enum *node)
+{
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_cs::visit_sequence (be_sequence *node)
+{
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_cs::visit_structure (be_structure *node)
+{
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_cs::visit_typedef (be_typedef *node)
+{
+ 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);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_field_cs::visit_union (be_union *node)
+{
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_field/serializer_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_field/serializer_op_ch.cpp
new file mode 100644
index 00000000000..098301bb4c0
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_field/serializer_op_ch.cpp
@@ -0,0 +1,249 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating TAO::DCPS::Serializer operator declarator for field
+// in the client header
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_visitor_array/serializer_op_ch.h"
+#include "be_visitor_enum/serializer_op_ch.h"
+#include "be_visitor_sequence/serializer_op_ch.h"
+#include "be_visitor_structure/structure.h"
+#include "be_visitor_structure/serializer_op_ch.h"
+#include "be_visitor_union/union.h"
+#include "be_visitor_union/serializer_op_ch.h"
+
+ACE_RCSID (be_visitor_field,
+ serializer_op_ch,
+ "$Id$")
+
+
+// **********************************************
+// Visitor for field in the client header file.
+// **********************************************
+
+// Constructor.
+be_visitor_field_serializer_op_ch::be_visitor_field_serializer_op_ch (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+// Destructor.
+be_visitor_field_serializer_op_ch::~be_visitor_field_serializer_op_ch (void)
+{
+}
+
+// Visit the field node.
+int
+be_visitor_field_serializer_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_serializer_op_ch::"
+ "visit_field - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ this->ctx_->node (node);
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_ch::"
+ "visit_field - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+// Visit operations on all possible data types that a field can be.
+
+int
+be_visitor_field_serializer_op_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 ()
+ && 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);
+
+ // First generate the array declaration.
+ be_visitor_array_serializer_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_ch::"
+ "visit_array - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_serializer_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.
+ && 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 enum declaration.
+ be_visitor_enum_serializer_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_ch::"
+ "visit_enum - "
+ "codegen failed\n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_serializer_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
+ && 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.
+ be_visitor_sequence_serializer_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_ch::"
+ "visit_sequence - "
+ "codegen failed\n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_serializer_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
+ && 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
+ be_visitor_structure_serializer_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_ch::"
+ "visit_struct - "
+ "codegen failed\n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_serializer_op_ch::visit_typedef (be_typedef *node)
+{
+ // Save the node for use in code generation and
+ // indicate that the field of the field 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_field_serializer_op_ch::"
+ "visit_typedef - "
+ "Bad primitive type\n"
+ ), -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+// visit union type
+int
+be_visitor_field_serializer_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
+ && 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 enum declaration.
+ be_visitor_union_serializer_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_ch::"
+ "visit_enum - "
+ "codegen failed\n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_field/serializer_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_field/serializer_op_cs.cpp
new file mode 100644
index 00000000000..e599cc1c088
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_field/serializer_op_cs.cpp
@@ -0,0 +1,1137 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_serializer_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating TAO::DCPS::Serializer operators code for Field in
+// the client stubs file.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_visitor_array/serializer_op_cs.h"
+#include "be_visitor_sequence/serializer_op_cs.h"
+#include "be_visitor_structure/serializer_op_cs.h"
+#include "be_visitor_union/serializer_op_cs.h"
+
+ACE_RCSID (be_visitor_field,
+ serializer_op_cs,
+ "$Id$")
+
+
+// **********************************************
+// visitor for field in the client stubs file
+// **********************************************
+
+be_visitor_field_serializer_op_cs::be_visitor_field_serializer_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_field_serializer_op_cs::~be_visitor_field_serializer_op_cs (void)
+{
+}
+
+int
+be_visitor_field_serializer_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_serializer_op_cs::"
+ "visit_field - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ this->ctx_->node (node);
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_cs::"
+ "visit_field - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_serializer_op_cs::visit_array (be_array *node)
+{
+ // If the array is defined in this scope, we must generate
+ // CDR stream operators for the array itself.
+ if (!this->ctx_->alias ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_array_serializer_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_cs::"
+ "visit_array - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ // Now generate the (de)marshaling code for the array as a
+ // field.
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_field *f = this->ctx_->be_node_as_field ();
+
+ if (f == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_cs::"
+ "visit_array - "
+ "cannot retrieve field node\n"),
+ -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];
+
+ // 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 () == 0 // Not a typedef.
+ && node->is_child (this->ctx_->scope ()))
+ {
+ // 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.
+ 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 (),
+ node->local_name ()->get_string ());
+ }
+ else
+ {
+ ACE_OS::sprintf (fname,
+ "_%s",
+ node->full_name ());
+ }
+ }
+ else
+ {
+ // Typedefed node.
+ ACE_OS::sprintf (fname,
+ "%s",
+ node->full_name ());
+ }
+
+ // 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 ())
+ {
+ case TAO_CodeGen::TAO_IS_BOUNDED_SIZE:
+ *os << "_tao_is_bounded_size (_tao_aggregate_" << f->local_name ()
+ << ")";
+ break;
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ // get the size of an array typedef
+ *os << "_dcps_max_marshaled_size (_tao_aggregate_" << f->local_name ()
+ << ")";
+ break;
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ // get the size of an array typedef
+ *os << "_dcps_find_size (_tao_aggregate_" << f->local_name ()
+ << ")";
+ break;
+ 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 serializer_op_cs and hacked into *.i.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_cs::"
+ "visit_array - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_serializer_op_cs::visit_enum (be_enum *node)
+{
+ // If we are defined inside this scope, we must generate the
+ /// Serializer stream operators for us here.
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_enum_serializer_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_cs::"
+ "visit_enum - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ 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_serializer_op_cs::"
+ "visit_enum - "
+ "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_IS_BOUNDED_SIZE:
+ *os << " true /* enum */";
+ break;
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ // enums are serialized as CORBA::ULong
+ *os << "_dcps_max_marshaled_size_ulong () /* enum */";
+ break;
+ 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.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_cs::"
+ "visit_enum - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_serializer_op_cs::visit_interface (be_interface *node)
+{
+ 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_serializer_op_cs::"
+ "visit_interface - "
+ "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:
+ if (node->is_defined ())
+ {
+ if (f->is_abstract ())
+ {
+ *os << "(strm << _tao_aggregate."
+ << f->local_name () << ".in ())";
+ }
+ else
+ {
+ *os << "::CORBA::Object::marshal (" << be_idt << be_idt_nl
+ << "_tao_aggregate." << f->local_name () << ".in ()," << be_nl
+ << "strm" << be_uidt_nl
+ << ")" << be_uidt;
+ }
+ }
+ else
+ {
+ *os << "TAO::Objref_Traits<" << node->name () << ">::marshal ("
+ << be_idt << be_idt_nl
+ << "_tao_aggregate." << f->local_name () << ".in ()," << be_nl
+ << "strm" << be_uidt_nl
+ << ")" << be_uidt;
+ }
+
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done because an interface cannot be declared inside a
+ // structure.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_cs::"
+ "visit_interface - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_serializer_op_cs::visit_component (be_component *node)
+{
+ return this->visit_interface (node);
+}
+
+int
+be_visitor_field_serializer_op_cs::visit_interface_fwd (be_interface_fwd *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_serializer_op_cs::"
+ "visit_interface_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:
+ if (node->is_defined ())
+ {
+ if (f->is_abstract ())
+ {
+ *os << "(strm << _tao_aggregate."
+ << f->local_name () << ".in ())";
+ }
+ else
+ {
+ *os << "::CORBA::Object::marshal (" << be_idt << be_idt_nl
+ << "_tao_aggregate." << f->local_name () << ".in ()," << be_nl
+ << "strm" << be_uidt_nl
+ << ")" << be_uidt;
+ }
+ }
+ else
+ {
+ AST_Decl *parent = ScopeAsDecl (node->defined_in ());
+
+ if (parent != 0 && parent->node_type () != AST_Decl::NT_root)
+ {
+ *os << parent->name () << "::";
+ }
+
+ *os << "TAO::Objref_Traits<" << node->name () << ">::marshal ("
+ << be_idt << be_idt_nl
+ << "_tao_aggregate." << f->local_name () << ".in ()," << be_nl
+ << "strm" << be_uidt_nl
+ << ")" << be_uidt;
+ }
+
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done because an interface cannot be declared inside a
+ // structure.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_cs::"
+ "visit_interface_fwd - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_serializer_op_cs::visit_component_fwd (be_component_fwd *node)
+{
+ return this->visit_interface_fwd (node);
+}
+
+int
+be_visitor_field_serializer_op_cs::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_serializer_op_cs::"
+ "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_serializer_op_cs::"
+ "visit_valuetype - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_serializer_op_cs::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_field_serializer_op_cs::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_serializer_op_cs::"
+ "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_serializer_op_cs::"
+ "visit_valuetype_fwd - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_serializer_op_cs::visit_eventtype_fwd (be_eventtype_fwd *node)
+{
+ return this->visit_valuetype_fwd (node);
+}
+
+// Visit predefined type.
+int
+be_visitor_field_serializer_op_cs::visit_predefined_type (be_predefined_type *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_serializer_op_cs::"
+ "visit_predefined_type - "
+ "cannot retrieve field node\n"),
+ -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_IS_BOUNDED_SIZE:
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_cs::"
+ "visit_predefined_type - TAO_IS_BOUNDED_SIZE "
+ "object and psuedo are not supported by DDS\n"),
+ -1);
+ }
+
+ else
+ {
+ *os << " true "; // all predefined types are bounded
+ }
+ break;
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ case TAO_CodeGen::TAO_FIND_SIZE: // the max and current sizes are the same for predefined types
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_cs::"
+ "visit_predefined_type - TAO_MAX_MARSHALED_SIZE "
+ "object and psuedo are not supported by DDS\n"),
+ -1);
+ }
+ else if (pt == AST_PredefinedType::PT_char)
+ {
+ *os << "_dcps_max_marshaled_size (::ACE_OutputCDR::from_char (_tao_aggregate."
+ << f->local_name () << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_wchar)
+ {
+ *os << "_dcps_max_marshaled_size (::ACE_OutputCDR::from_wchar (_tao_aggregate."
+ << f->local_name () << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_octet)
+ {
+ *os << "_dcps_max_marshaled_size (::ACE_OutputCDR::from_octet (_tao_aggregate."
+ << f->local_name () << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_boolean)
+ {
+ *os << "_dcps_max_marshaled_size (::ACE_OutputCDR::from_boolean (_tao_aggregate."
+ << f->local_name () << "))";
+ }
+ else
+ {
+ *os << "_dcps_max_marshaled_size (_tao_aggregate." << f->local_name () << ")";
+ }
+ break;
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << "(strm >> _tao_aggregate." << f->local_name ()
+ << ".out ())";
+ }
+ else if (pt == AST_PredefinedType::PT_char)
+ {
+ *os << "(strm >> ::ACE_InputCDR::to_char (_tao_aggregate."
+ << f->local_name () << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_wchar)
+ {
+ *os << "(strm >> ::ACE_InputCDR::to_wchar (_tao_aggregate."
+ << f->local_name () << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_octet)
+ {
+ *os << "(strm >> ::ACE_InputCDR::to_octet (_tao_aggregate."
+ << f->local_name () << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_boolean)
+ {
+ *os << "(strm >> ::ACE_InputCDR::to_boolean (_tao_aggregate."
+ << f->local_name () << "))";
+ }
+ else
+ {
+ *os << "(strm >> _tao_aggregate." << f->local_name () << ")";
+ }
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << "(strm << _tao_aggregate." << f->local_name () << ".in ())";
+ }
+ else if (pt == AST_PredefinedType::PT_char)
+ {
+ *os << "(strm << ::ACE_OutputCDR::from_char (_tao_aggregate."
+ << f->local_name () << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_wchar)
+ {
+ *os << "(strm << ::ACE_OutputCDR::from_wchar (_tao_aggregate."
+ << f->local_name () << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_octet)
+ {
+ *os << "(strm << ::ACE_OutputCDR::from_octet (_tao_aggregate."
+ << f->local_name () << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_boolean)
+ {
+ *os << "(strm << ::ACE_OutputCDR::from_boolean (_tao_aggregate."
+ << f->local_name () << "))";
+ }
+ else
+ {
+ *os << "(strm << _tao_aggregate." << f->local_name () << ")";
+ }
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_cs::"
+ "visit_predefined_type - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_serializer_op_cs::visit_sequence (be_sequence *node)
+{
+ // If the sequence is defined in this scope, generate its
+ // Serializer stream operators here.
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_sequence_serializer_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_cs::"
+ "visit_sequence - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ // How generate the marshaling code for the sequence as a field.
+
+ 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_serializer_op_cs::"
+ "visit_sequence - "
+ "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_IS_BOUNDED_SIZE:
+ *os << "_tao_is_bounded_size (_tao_aggregate." << f->local_name ()
+ << ")";
+ break;
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ *os << "_dcps_max_marshaled_size (_tao_aggregate." << f->local_name ()
+ << ")";
+ break;
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ *os << "_dcps_find_size (_tao_aggregate." << f->local_name ()
+ << ")";
+ break;
+ 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.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_cs::"
+ "visit_sequence - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_serializer_op_cs::visit_string (be_string *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_serializer_op_cs::"
+ "visit_string - "
+ "cannot retrieve field node\n"),
+ -1);
+ }
+
+ // check what is the code generation's 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_IS_BOUNDED_SIZE:
+ if (0 == node->max_size ()->ev ()->u.ulval)
+ *os << "false /* unbounded string */";
+ else
+ *os << "true /* bounded string */";
+ break;
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ char buff[15];
+ ACE_OS::sprintf(buff, "%ld", node->max_size ()->ev ()->u.ulval);
+ *os << "_dcps_max_marshaled_size_ulong () + " << buff;
+ break;
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ *os << "_dcps_max_marshaled_size_ulong() + "
+ << "ACE_OS::strlen(_tao_aggregate."
+ << f->local_name () << ".in ())";
+ break;
+ 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.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_cs::"
+ "visit_array - "
+ "bad substate\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_serializer_op_cs::visit_structure (be_structure *node)
+{
+ // If the struct is defined in this scope, generate its Serializer stream
+ // operators here.
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_structure_serializer_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_cs::"
+ "visit_struct - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ // How generate the marshaling code for the struct as a field.
+
+ 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_serializer_op_cs::"
+ "visit_structure - "
+ "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_IS_BOUNDED_SIZE:
+ *os << "_tao_is_bounded_size (_tao_aggregate." << f->local_name ()
+ << ")";
+ break;
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ *os << "_dcps_max_marshaled_size (_tao_aggregate." << f->local_name ()
+ << ")";
+ break;
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ *os << "_dcps_find_size (_tao_aggregate." << f->local_name ()
+ << ")";
+ break;
+ 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.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_cs::"
+ "visit_structure - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_field_serializer_op_cs::visit_typedef (be_typedef *node)
+{
+ 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_field_serializer_op_cs::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_field_serializer_op_cs::visit_union (be_union *node)
+{
+ // If the union is defined in this scope, generate its Serializer stream
+ // operators here.
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_union_serializer_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_cs::"
+ "visit_union - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ // Now generate marshaling code for the union as a field.
+
+ 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_serializer_op_cs::"
+ "visit_union - "
+ "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_IS_BOUNDED_SIZE:
+ *os << "_tao_is_bounded_size (_tao_aggregate." << f->local_name ()
+ << ")";
+ break;
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ *os << "_dcps_max_marshaled_size (_tao_aggregate." << f->local_name ()
+ << ")";
+ break;
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ *os << "_dcps_find_size (_tao_aggregate." << f->local_name ()
+ << ")";
+ break;
+ 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.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_serializer_op_cs::"
+ "visit_union - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+// ****************************************************************
+
+be_visitor_serializer_op_field_decl::be_visitor_serializer_op_field_decl (
+ be_visitor_context *ctx
+ )
+ : be_visitor_scope (ctx)
+{
+}
+
+// This is a field, but the action depends on the type of the field,
+// use this visitor to detect the type of the field.
+// Notice that this is why the parent visitor (who create us) cannot
+// do the job, because it may have another purpose for some or all of
+// the visit_* methods; in other words, while running a visitor to
+// generate TAO::DCPS::Serializer operators for structures we cannot use that one to
+// generate the code of each field, because visit_struct already has a
+// meaning in that visitor.
+int
+be_visitor_serializer_op_field_decl::visit_field (be_field *node)
+{
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (bt == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_serializer_op_field_decl::"
+ "visit_field - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ // @@ Shouldn't this be saved in the visitor and not the context?!
+ this->ctx_->node (node);
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_serializer_op_field_decl::"
+ "visit_field - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_serializer_op_field_decl::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)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_serializer_op_field_decl::"
+ "visit_array - "
+ "cannot retrieve field node\n"),
+ -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];
+
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+
+ if (this->ctx_->alias () == 0 // Not a typedef.
+ && node->is_child (this->ctx_->scope ()))
+ {
+ // 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 (node->is_nested ())
+ {
+ 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 ());
+ }
+ }
+ else
+ {
+ // Typedefed node.
+ ACE_OS::sprintf (fname,
+ "%s",
+ node->full_name ());
+ }
+
+ // 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 ())
+ {
+ case TAO_CodeGen::TAO_IS_BOUNDED_SIZE:
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << fname << "_forany "
+ << "_tao_aggregate_" << f->local_name () << be_idt << be_idt_nl
+ << "(const_cast<" << be_idt << be_idt_nl
+ << fname << "_slice*> (" << be_nl
+ << "_tao_aggregate." << f->local_name () << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ");" << be_uidt_nl;
+
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_serializer_op_field_decl::"
+ "visit_array - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+
+int
+be_visitor_serializer_op_field_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.
+ be_type *bt = node->primitive_base_type ();
+
+ if (bt == 0 || bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_serializer_op_field_decl::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ 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..b3c720138a7
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_home.cpp
@@ -0,0 +1,37 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_home.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for a component home.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#include "be_home.h"
+
+#include "be_visitor_home.h"
+#include "be_visitor_typecode/typecode_defn.h"
+#include "be_visitor_typecode/objref_typecode.h"
+#include "be_visitor_context.h"
+#include "be_helper.h"
+#include "be_extern.h"
+#include "ace/Log_Msg.h"
+
+#include "be_visitor_home/home_ch.cpp"
+#include "be_visitor_home/home_cs.cpp"
+
+ACE_RCSID (be,
+ be_visitor_home,
+ "$Id$")
+
diff --git a/TAO/TAO_IDL/be/be_visitor_home/home_ch.cpp b/TAO/TAO_IDL/be/be_visitor_home/home_ch.cpp
new file mode 100644
index 00000000000..cbe0a71da1e
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_home/home_ch.cpp
@@ -0,0 +1,80 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// home_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Component Home node in the client header.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_home,
+ home_ch,
+ "$Id$")
+
+be_visitor_home_ch::be_visitor_home_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_home_ch::~be_visitor_home_ch (void)
+{
+}
+
+int
+be_visitor_home_ch::visit_home (be_home *node)
+{
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // All we do in this is generate a forward declaration of the class.
+ *os << be_nl << be_nl << "class " << node->local_name () << ";";
+
+ // Generate the ifdefined macro for the _ptr type.
+ os->gen_ifdef_macro (node->flat_name (), "_ptr");
+
+ // Generate the _ptr typedef.
+ *os << be_nl << be_nl
+ << "typedef " << node->local_name () << " *" << node->local_name ()
+ << "_ptr;";
+
+ os->gen_endif ();
+
+ if (be_global->tc_support ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_typecode_decl tc_visitor (&ctx);
+
+ if (node->accept (&tc_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_home_ch::"
+ "visit_home - "
+ "TypeCode definition failed\n"),
+ -1);
+ }
+ }
+
+ node->cli_hdr_gen (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_home/home_cs.cpp b/TAO/TAO_IDL/be/be_visitor_home/home_cs.cpp
new file mode 100644
index 00000000000..d57f034cc09
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_home/home_cs.cpp
@@ -0,0 +1,64 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// home_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Component Home node in the client source.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_home,
+ home_cs,
+ "$Id$")
+
+be_visitor_home_cs::be_visitor_home_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_home_cs::~be_visitor_home_cs (void)
+{
+}
+
+int
+be_visitor_home_cs::visit_home (be_home *node)
+{
+ if (node->cli_stub_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ if (be_global->tc_support ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ TAO::be_visitor_objref_typecode tc_visitor (&ctx);
+
+ // No double dispatch here so the objref_typecode visitor
+ // can dynamic_cast the node to tell it's a home.
+ if (tc_visitor.visit_interface (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_home_cs::"
+ "visit_home - "
+ "TypeCode definition failed\n"),
+ -1);
+ }
+ }
+
+ node->cli_stub_gen (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface.cpp
new file mode 100644
index 00000000000..bab1d145dd5
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface.cpp
@@ -0,0 +1,96 @@
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_interface.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Interface
+//
+// = AUTHOR
+// Aniruddha Gokhale and Carlos O'Ryan
+//
+// ============================================================================
+
+#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_module.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_component.h"
+#include "be_helper.h"
+#include "be_extern.h"
+#include "be_util.h"
+#include "be_native.h"
+#include "utl_identifier.h"
+#include "utl_exceptlist.h"
+#include "nr_extern.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_typecode.h"
+#include "be_visitor_context.h"
+#include "be_visitor_native.h"
+#include "ace/Auto_Ptr.h"
+
+#include "be_visitor_interface/interface.cpp"
+#include "be_visitor_interface/interface_ch.cpp"
+#include "be_visitor_interface/interface_ci.cpp"
+#include "be_visitor_interface/interface_cs.cpp"
+#include "be_visitor_interface/interface_sh.cpp"
+#include "be_visitor_interface/interface_ih.cpp"
+#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/tie_sh.cpp"
+#include "be_visitor_interface/tie_si.cpp"
+#include "be_visitor_interface/any_op_ch.cpp"
+#include "be_visitor_interface/any_op_cs.cpp"
+#include "be_visitor_interface/cdr_op_ch.cpp"
+#include "be_visitor_interface/cdr_op_cs.cpp"
+#include "be_visitor_interface/smart_proxy_ch.cpp"
+#include "be_visitor_interface/smart_proxy_cs.cpp"
+#include "be_visitor_interface/ami_interface_ch.cpp"
+
+// Proxy Brokers
+#include "be_visitor_interface/strategized_proxy_broker_sh.cpp"
+#include "be_visitor_interface/strategized_proxy_broker_ss.cpp"
+
+// Proxy Impls
+#include "be_visitor_interface/direct_proxy_impl_sh.cpp"
+#include "be_visitor_interface/direct_proxy_impl_ss.cpp"
+
+// AMH
+#include "be_visitor_interface/amh_ch.cpp"
+#include "be_visitor_interface/amh_ss.cpp"
+#include "be_visitor_interface/amh_si.cpp"
+#include "be_visitor_interface/amh_sh.cpp"
+#include "be_visitor_interface/amh_rh_ss.cpp"
+#include "be_visitor_interface/amh_rh_sh.cpp"
+
+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
new file mode 100644
index 00000000000..8e9ca518f55
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_ch.cpp
@@ -0,0 +1,105 @@
+//=============================================================================
+/**
+* @file amh_ch.cpp
+*
+* $Id$
+*
+* Specialized interface visitor for AMH-RH generates code that is
+* specific to AMH interfaces.
+*
+* @author Mayur Deshpande <mayur@ics.uci.edu>
+*/
+//=============================================================================
+
+ACE_RCSID (be_visitor_interface,
+ amh_ch,
+ "$Id$")
+
+be_visitor_amh_interface_ch::be_visitor_amh_interface_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_interface (ctx)
+{
+}
+
+be_visitor_amh_interface_ch::~be_visitor_amh_interface_ch (void)
+{
+}
+
+int
+be_visitor_amh_interface_ch::visit_interface (be_interface *node)
+{
+ // If not already generated and not imported.
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ // This will be a no-op if it has already been done by a forward
+ // declaration.
+ node->gen_var_out_seq_decls ();
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // 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 interface inherits from other interfaces.
+ if (node->n_inherits () > 0)
+ {
+ *os << be_idt;
+
+ for (int i = 0; i < node->n_inherits (); i++)
+ {
+ *os << "public virtual "
+ << node->inherits ()[i]->name ();
+
+ if (i < node->n_inherits () - 1)
+ {
+ // Node has multiple inheritance, so put a comma.
+ *os << "," << be_nl;
+ }
+ }
+
+ *os << be_uidt << be_uidt_nl;
+ }
+ else
+ {
+ // We do not inherit from anybody, hence we do so from the base
+ // CORBA::Object class.
+ *os << "public virtual ::CORBA::Object" << be_uidt_nl;
+ }
+
+ // Generate the body.
+
+ *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
+ << "typedef " << node->local_name () << "_out _out_type;"
+ << 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);
+ }
+
+ node->cli_hdr_gen (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
new file mode 100644
index 00000000000..b2bd001d7b0
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_sh.cpp
@@ -0,0 +1,97 @@
+//=============================================================================
+/**
+* @file amh_rh_sh.cpp
+*
+* $Id$
+*
+* Specialized interface visitor for AMH-RH that generates code
+* for RH interfaces in skeleton source files
+*
+* @author Darrell Brunsch <brunsch@cs.wustl.edu>
+*/
+//=============================================================================
+
+ACE_RCSID (be_visitor_interface,
+ amh_rh_sh,
+ "$Id$")
+
+be_visitor_amh_rh_interface_sh::be_visitor_amh_rh_interface_sh (
+ be_visitor_context *ctx
+ )
+ : be_visitor_interface_sh (ctx)
+{
+}
+
+be_visitor_amh_rh_interface_sh::~be_visitor_amh_rh_interface_sh (void)
+{
+}
+
+int
+be_visitor_amh_rh_interface_sh::visit_operation (be_operation *node)
+{
+ be_visitor_amh_rh_operation_sh amh_rh_op (this->ctx_);
+ return amh_rh_op.visit_operation (node);
+}
+
+int
+be_visitor_amh_rh_interface_sh::visit_interface (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Generate the skeleton class name, use the AMH-node name as a
+ // basis, this is AMH_<InterfaceName>ResponseHandler...
+ 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_";
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ rh_skel_class_name += rh_base_class_name.c_str ();
+
+ *os << "class " << rh_skel_class_name.c_str () << ";" << be_nl;
+
+ // Generate the _ptr declaration.
+ *os << "typedef " << rh_skel_class_name.c_str () << " *"
+ << rh_skel_class_name.c_str()
+ << "_ptr;" << be_nl << be_nl;
+
+ ACE_CString inherit_client_parent = node->client_enclosing_scope ();
+ inherit_client_parent += rh_base_class_name;
+
+ ACE_CString inherit_tao_parent = "TAO_AMH_Response_Handler";
+
+ // Now generate the class definition
+ *os << "class " << be_global->skel_export_macro ()
+ << " " << rh_skel_class_name.c_str () << be_idt_nl
+ << ": public " << inherit_tao_parent.c_str () << "," << be_idt_nl
+ << "public ::" << inherit_client_parent.c_str () << be_uidt << be_uidt;
+
+ *os << be_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl
+ << rh_skel_class_name.c_str () << " (void);" << be_nl
+ << "virtual ~" << rh_skel_class_name.c_str () << " (void);";
+
+ // Generate code for elements in the scope (e.g., operations).
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_sh::"
+ "visit_interface - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl
+ << "};";
+
+ 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
new file mode 100644
index 00000000000..dd51983df52
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_ss.cpp
@@ -0,0 +1,102 @@
+//=============================================================================
+/**
+* @file amh_rh_ss.cpp
+*
+* $Id$
+*
+* Specialized interface visitor for AMH-ResponseHandler that generates code for
+* RH in the skeleton source files.
+*
+* @author Mayur Deshpande <mayur@ics.uci.edu>
+*/
+//=============================================================================
+
+ACE_RCSID (be_visitor_interface,
+ amh_rh_ss,
+ "$Id$")
+
+be_visitor_amh_rh_interface_ss::be_visitor_amh_rh_interface_ss (
+ be_visitor_context *ctx
+ )
+ : be_visitor_interface_ss (ctx)
+{
+}
+
+be_visitor_amh_rh_interface_ss::~be_visitor_amh_rh_interface_ss (void)
+{
+}
+
+int
+be_visitor_amh_rh_interface_ss::visit_operation (be_operation *node)
+{
+ be_visitor_amh_rh_operation_ss amh_rh_op (this->ctx_);
+ return amh_rh_op.visit_operation (node);
+}
+
+int
+be_visitor_amh_rh_interface_ss::visit_interface (be_interface *node)
+{
+ if (node->srv_skel_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // @@ Mayur, the exact same code is duplicated in amh_rh_sh.cpp,
+ // need to fix that...
+ // Generate the skeleton class name, use the AMH-node name as a
+ // basis, this is AMH_<InterfaceName>ResponseHandler...
+ ACE_CString rh_skel_prefix = "TAO_";
+
+ char *buf;
+ node->compute_full_name (rh_skel_prefix.c_str(), "", buf);
+ ACE_CString rh_skel_full_scope_name ("POA_");
+ rh_skel_full_scope_name += buf;
+ // buf was allocated by ACE_OS::strdup, so we need to use free instead
+ // of delete.
+ ACE_OS::free (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_";
+ }
+
+ ACE_CString rh_skel_class_name (rh_skel_class_name_prefix);
+ rh_skel_class_name += node->local_name ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << rh_skel_full_scope_name.c_str ()
+ << "::" << rh_skel_class_name.c_str () << " (void)" << be_nl
+ << ": TAO_AMH_Response_Handler ()," << be_idt_nl
+ << "::" << node->full_name () << " ()" << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "}" << be_nl << be_nl;
+
+ *os << rh_skel_full_scope_name.c_str ()
+ << "::~" << rh_skel_class_name.c_str ()
+ << " (void)" << be_nl;
+ *os << "{" << be_nl;
+ *os << "}";
+
+
+ // 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)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ss::"
+ "visit_interface - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp
new file mode 100644
index 00000000000..19e7340f37c
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp
@@ -0,0 +1,433 @@
+//=============================================================================
+/**
+* @file amh_sh.cpp
+*
+* $Id$
+*
+* Specialized interface visitor for AMH generates code that is
+* specific to AMH interfaces.
+*
+* @author Darrell Brunsch <brunsch@cs.wustl.edu>
+*/
+//=============================================================================
+
+ACE_RCSID (be_visitor_interface,
+ amh_sh,
+ "$Id$")
+
+be_visitor_amh_interface_sh::be_visitor_amh_interface_sh (
+ be_visitor_context *ctx
+ )
+ : be_visitor_interface_sh (ctx)
+{
+}
+
+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'.
+
+int
+be_visitor_amh_interface_sh::visit_interface (be_interface *node)
+{
+ if (node->srv_hdr_gen () || node->imported () || node->is_local ())
+ {
+ return 0;
+ }
+
+ // Do not generate AMH classes for any sort of implied IDL.
+ if (node->original_interface () != 0)
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ ACE_CString class_name;
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // We shall have a POA_ prefix only if we are at the topmost level.
+ if (!node->is_nested ())
+ {
+ // We are outermost.
+ class_name += "POA_AMH_";
+ class_name += node->local_name ();
+ }
+ else
+ {
+ class_name += "AMH_";
+ class_name += node->local_name ();
+ }
+
+ // 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 << be_nl;
+
+ // Now generate the class definition.
+ *os << "class " << be_global->skel_export_macro ()
+ << " " << class_name.c_str () << be_idt_nl << ": " << be_idt;
+
+ long n_parents = node->n_inherits ();
+
+ if (n_parents > 0)
+ {
+ for (int i = 0; i < n_parents; ++i)
+ {
+ ACE_CString amh_name ("POA_");
+
+ // @@ The following code is *NOT* exception-safe.
+ char *buf = 0;
+ be_interface *base =
+ be_interface::narrow_from_decl (node->inherits ()[i]);
+ base->compute_full_name ("AMH_", "", buf);
+ amh_name += buf;
+ // buf was allocated by ACE_OS::strdup, so we need to use free
+ // instead of delete.
+ ACE_OS::free (buf);
+
+ if (i != 0)
+ {
+ *os << ", ";
+ }
+
+ *os << "public virtual "
+ << amh_name.c_str ()
+ << be_nl;
+ }
+ }
+ else
+ {
+ // We don't inherit from another user defined object, hence our
+ // base class is the ServantBase class.
+ *os << "public virtual PortableServer::ServantBase";
+ }
+
+ *os << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "protected:" << be_idt_nl
+ << class_name.c_str () << " (void);" << be_uidt_nl << be_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);\n\n"
+ << be_nl
+ << "virtual ::CORBA::Boolean _is_a (" << be_idt << be_idt_nl
+ << "const char* logical_type_id" << env_dflts << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+// *os << "virtual void* _downcast (" << be_idt << be_idt_nl
+// << "const char* logical_type_id" << be_uidt_nl
+// << ");" << be_uidt_nl << be_nl;
+
+ // Add a skeleton for our _is_a method.
+ *os << "static void _is_a_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest &req," << be_nl
+ << "void *obj," << be_nl
+ << "void *servant_upcall" << env_decl << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // Add a skeleton for our _non_existent method.
+ *os << "static void _non_existent_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest &req," << be_nl
+ << "void *obj," << be_nl
+ << "void *servant_upcall" << env_decl << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // Add a skeleton for our _interface method.
+ *os << "static void _interface_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest &req," << be_nl
+ << "void *obj," << be_nl
+ << "void *servant_upcall" << env_decl << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // Add a skeleton for our _component method.
+ *os << "static void _component_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest &req," << be_nl
+ << "void *obj," << be_nl
+ << "void *servant_upcall" << env_decl << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // Add a skeleton for our _repository_id method.
+ *os << "static void _repository_id_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest &req," << be_nl
+ << "void *obj," << be_nl
+ << "void *servant_upcall" << env_decl << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // Add the dispatch method.
+ *os << "virtual void _dispatch (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest &req," << be_nl
+ << "void *_servant_upcall" << env_decl << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ this->this_method (node);
+
+ // The _interface_repository_id method.
+ *os << be_nl
+ << "virtual const char* _interface_repository_id "
+ << "(void) const;";
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_amh_interface_sh::"
+ "visit_interface - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ // Generate skeletons for operations of our base classes. These
+ // skeletons just cast the pointer to the appropriate type
+ // before invoking the call.
+ if (node->traverse_inheritance_graph (be_interface::gen_skel_helper, os) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_amh_interface_sh::"
+ "visit_interface - "
+ "inheritance graph traversal failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl
+ << "};";
+
+ return 0;
+}
+
+int
+be_visitor_amh_interface_sh::visit_operation (be_operation *node)
+{
+ be_visitor_amh_operation_sh visitor (this->ctx_);
+ return visitor.visit_operation (node);
+}
+
+int
+be_visitor_amh_interface_sh::visit_attribute (be_attribute *node)
+{
+ be_visitor_amh_operation_sh visitor (this->ctx_);
+ return visitor.visit_attribute (node);
+}
+
+int
+be_visitor_amh_interface_sh::add_original_members (be_interface *node,
+ be_interface *amh_node)
+{
+ if (!node || !amh_node)
+ {
+ return -1;
+ }
+
+ this->elem_number_ = 0;
+
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ AST_Decl *d = si.item ();
+
+ if (!d)
+ {
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_amh_pre_proc::visit_interface - "
+ "bad node in this scope\n"
+ ),
+ 0
+ );
+ }
+
+ if (d->node_type () == AST_Decl::NT_attr)
+ {
+ be_attribute *attribute = be_attribute::narrow_from_decl (d);
+
+ if (!attribute)
+ {
+ return 0;
+ }
+ }
+ else
+ {
+ be_operation* operation = be_operation::narrow_from_decl (d);
+
+ if (operation)
+ {
+ this->add_amh_operation (operation, amh_node);
+ }
+ }
+ }
+
+ return 0;
+}
+
+
+int
+be_visitor_amh_interface_sh::add_amh_operation (be_operation *node,
+ be_interface *amh_node)
+{
+ if (!node || !amh_node)
+ {
+ return -1;
+ }
+
+ // We do nothing for oneways!
+ if (node->flags () == AST_Operation::OP_oneway)
+ {
+ return 0;
+ }
+
+ Identifier *id = 0;
+ UTL_ScopedName *sn = 0;
+
+ ACE_NEW_RETURN (id,
+ Identifier ("void"),
+ -1);
+
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (id,
+ 0),
+ -1);
+
+ // Create the return type, which is "void"
+ be_predefined_type *rt = 0;
+ ACE_NEW_RETURN (rt,
+ be_predefined_type (AST_PredefinedType::PT_void,
+ sn),
+ -1);
+
+ ACE_CString original_op_name (
+ node->name ()->last_component ()->get_string ()
+ );
+
+ UTL_ScopedName *op_name =
+ static_cast<UTL_ScopedName *> (amh_node->name ()->copy ());
+
+ ACE_NEW_RETURN (id,
+ Identifier (original_op_name.rep ()),
+ -1);
+
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (id,
+ 0),
+ -1);
+
+ op_name->nconc (sn);
+
+ // Create the operation
+ be_operation *operation = 0;
+ ACE_NEW_RETURN (operation,
+ be_operation (rt, //node->return_type (),
+ AST_Operation::OP_noflags,
+ op_name,
+ 0,
+ 0),
+ -1);
+
+ operation->set_name (op_name);
+
+ // Iterate over the arguments and put all the in and inout
+ // into the new method.
+ if (node->nmembers () > 0)
+ {
+ // Initialize an iterator to iterate thru our scope.
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ AST_Decl *d = si.item ();
+
+ if (!d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_amh_pre_proc::"
+ "create_response_handler_operation - "
+ "bad node in this scope\n"),
+ -1);
+
+ }
+
+ AST_Argument *original_arg =
+ AST_Argument::narrow_from_decl (d);
+
+ if (original_arg->direction () == AST_Argument::dir_INOUT ||
+ original_arg->direction () == AST_Argument::dir_IN)
+ {
+ // Create the argument.
+ be_argument *arg = 0;
+ ACE_NEW_RETURN (arg,
+ be_argument (original_arg->direction (),
+ original_arg->field_type (),
+ original_arg->name ()),
+ -1);
+
+ operation->be_add_argument (arg);
+ }
+ }
+ }
+
+ operation->set_defined_in (amh_node);
+
+ // After having generated the operation we insert it into the
+ // AMH node interface.
+ if (0 == amh_node->be_add_operation (operation))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+
+be_interface *
+be_visitor_amh_interface_sh::create_amh_class (ACE_CString name)
+{
+ Identifier *id = 0;
+ ACE_NEW_RETURN (id,
+ Identifier (name.c_str ()),
+ 0);
+
+ UTL_ScopedName *amh_class_name = 0;
+ ACE_NEW_RETURN (amh_class_name,
+ UTL_ScopedName (id,
+ 0),
+ 0);
+
+ be_interface *amh_class = 0;
+ ACE_NEW_RETURN (amh_class,
+ be_interface (amh_class_name, // name
+ 0, // list of inherited
+ 0, // number of inherited
+ 0, // list of ancestors
+ 0, // number of ancestors
+ 0, // non-local
+ 0), // non-abstract
+ 0);
+
+ amh_class->set_name (amh_class_name);
+ return amh_class;
+}
+
+void
+be_visitor_amh_interface_sh::this_method (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ ACE_CString non_amh_name = node->client_enclosing_scope ();
+ non_amh_name += node->local_name ();
+
+ // Print out the _this() method. The _this() method for AMH
+ // interfaces is "special", because the returned type is not exactly
+ // the type of the class, but the original class that "implied" the
+ // AMH one.
+ *os << non_amh_name.c_str () << " *_this (" << be_idt << be_idt
+ << env_dflts << be_uidt_nl
+ << ");\n" << be_uidt;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_si.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_si.cpp
new file mode 100644
index 00000000000..10118851bcf
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_si.cpp
@@ -0,0 +1,230 @@
+//=============================================================================
+/**
+* @file amh_si.cpp
+*
+* $Id$
+*
+* Specialized interface visitor for AMH generates code that is
+* specific to AMH interfaces.
+*
+* @author Jeff Parsons <j.parsons@vanderbilt.edu>
+*/
+//=============================================================================
+
+ACE_RCSID (be_visitor_interface,
+ amh_si,
+ "$Id$")
+
+be_visitor_amh_interface_si::be_visitor_amh_interface_si (
+ be_visitor_context *ctx
+ )
+ : be_visitor_interface_si (ctx)
+{
+}
+
+be_visitor_amh_interface_si::~be_visitor_amh_interface_si (void)
+{
+}
+
+int
+be_visitor_amh_interface_si::visit_interface (be_interface *node)
+{
+ if (node->srv_inline_gen () || node->imported () || node->is_local ())
+ {
+ return 0;
+ }
+
+ // Do not generate AMH classes for any sort of implied IDL.
+ if (node->original_interface () != 0)
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ int status =
+ node->traverse_inheritance_graph (
+ be_visitor_amh_interface_si::gen_skel_helper,
+ os
+ );
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_amh_interface_si::"
+ "visit_interface - "
+ "inheritance graph traversal failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_amh_interface_si::gen_skel_helper (be_interface *derived,
+ be_interface *ancestor,
+ TAO_OutStream *os)
+{
+ // If derived and ancestor are same, skip it.
+ if (derived == 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.
+
+ ACE_CString ancestor_name ("POA_");
+ char *buf = 0;
+ ancestor->compute_full_name ("AMH_", "", buf);
+ ancestor_name += buf;
+ // buf was allocated by ACE_OS::strdup, so we need to use free instead
+ // of delete.
+ ACE_OS::free (buf);
+ buf = 0;
+
+ const char *ancestor_amh_name = ancestor_name.fast_rep ();
+
+ ACE_CString derived_name ("POA_");
+ derived->compute_full_name ("AMH_", "", buf);
+ derived_name += buf;
+ // buf was allocated by ACE_OS::strdup, so we need to use free instead
+ // of delete.
+ ACE_OS::free (buf);
+ buf = 0;
+
+ const char *derived_amh_name = derived_name.fast_rep ();
+
+ 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)
+ {
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl << be_nl;
+
+ // Generate code in the inline file.
+ // Generate the static method corresponding to this method.
+ *os << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << derived_amh_name << "::"
+ << d->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & req," << be_nl
+ << "void * context," << be_nl
+ << "void * obj" << env_decl << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+ *os << ancestor_amh_name
+ << "* const impl = static_cast<"
+ << derived_amh_name
+ << " *> (obj);" << be_nl;
+ *os << ancestor_amh_name
+ << "::" << d->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "req," << be_nl
+ << "context," << be_nl
+ << "impl" << env_arg << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}";
+ }
+ else if (d->node_type () == AST_Decl::NT_attr)
+ {
+ AST_Attribute *attr = AST_Attribute::narrow_from_decl (d);
+
+ if (attr == 0)
+ {
+ return -1;
+ }
+
+ *os << be_nl << be_nl;
+
+ // Generate code in the inline file.
+ // Generate the static method corresponding to this method.
+ *os << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << derived_amh_name << "::_get_"
+ << d->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & req," << be_nl
+ << "void * context," << be_nl
+ << "void * obj" << env_decl << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ *os << ancestor_amh_name
+ << "* const impl = static_cast<"
+ << derived_amh_name
+ << " *> (obj);" << be_nl;
+
+ *os << ancestor_amh_name
+ << "::_get_" << d->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "req," << be_nl
+ << "context," << be_nl
+ << "impl" << env_arg << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}";
+
+ if (!attr->readonly ())
+ {
+ *os << be_nl << be_nl;
+
+ // Generate code in the inline file.
+ // Generate the static method corresponding to
+ // this method.
+ *os << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << derived_amh_name
+ << "::_set_" << d->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & req," << be_nl
+ << "void * context," << be_nl
+ << "void * obj" << env_decl << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ *os << ancestor_amh_name
+ << "* const impl = static_cast<"
+ << derived_amh_name
+ << " *> (obj);" << be_nl;
+
+ *os << ancestor_amh_name
+ << "::_set_" << d->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "req," << be_nl
+ << "context," << be_nl
+ << "impl" << env_arg << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}";
+ }
+ }
+ } // End of FOR
+ }
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp
new file mode 100644
index 00000000000..3760418d94b
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp
@@ -0,0 +1,339 @@
+//=============================================================================
+/**
+* @file amh_ss.cpp
+*
+* $Id$
+*
+* Specialized interface visitor for AMH.
+*
+* @author Darrell Brunsch <brunsch@cs.wustl.edu>
+*/
+//=============================================================================
+
+ACE_RCSID (be_visitor_interface,
+ amh_ss,
+ "$Id$")
+
+be_visitor_amh_interface_ss::be_visitor_amh_interface_ss (
+ be_visitor_context *ctx
+ )
+ : be_visitor_interface_ss (ctx)
+{
+}
+
+be_visitor_amh_interface_ss::~be_visitor_amh_interface_ss (void)
+{
+}
+
+int
+be_visitor_amh_interface_ss::visit_operation (be_operation *node)
+{
+ be_visitor_amh_operation_ss visitor (this->ctx_);
+ return visitor.visit_operation (node);
+}
+
+int
+be_visitor_amh_interface_ss::visit_attribute (be_attribute *node)
+{
+ be_visitor_amh_operation_ss visitor (this->ctx_);
+ return visitor.visit_attribute (node);
+}
+
+int
+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 be_visitor_interface_ss::visit_interface (node);
+}
+
+void
+be_visitor_amh_interface_ss::this_method (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // the _this () operation
+ //const char *non_amh_name = node->full_name () + 4;
+ ACE_CString non_amh_name = "";
+ non_amh_name += node->client_enclosing_scope ();
+ non_amh_name += node->local_name ();
+
+ ACE_CString full_skel_name_holder =
+ this->generate_full_skel_name (node);
+ const char *full_skel_name = full_skel_name_holder.c_str ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << non_amh_name.c_str () << "*" << be_nl
+ << full_skel_name
+ << "::_this ("
+ << (be_global->use_raw_throw () ? "void" : "ACE_ENV_SINGLE_ARG_DECL")
+ << ")" << be_nl
+ << "{" << be_idt_nl
+ << "TAO_Stub *stub = this->_create_stub ("
+ << (be_global->use_raw_throw () ? "" : "ACE_ENV_SINGLE_ARG_PARAMETER")
+ << ");" << TAO_ACE_CHECK ("0") << be_nl << be_nl;
+
+ *os << "TAO_Stub_Auto_Ptr safe_stub (stub);" << be_nl
+ << "::CORBA::Object_ptr tmp = CORBA::Object::_nil ();" << be_nl
+ << be_nl
+ << "::CORBA::Boolean _tao_opt_colloc =" << be_idt_nl
+ << "stub->servant_orb_var ()->orb_core ()->"
+ << "optimize_collocation_objects ();" << be_uidt_nl << be_nl
+ << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "tmp," << be_nl
+ << "::CORBA::Object (stub, _tao_opt_colloc, this)," << be_nl
+ << "0" << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ *os << "::CORBA::Object_var obj = tmp;" << be_nl
+ << "(void) safe_stub.release ();" << be_nl << be_nl;
+
+ *os << "typedef ::" << node->name () << " STUB_SCOPED_NAME;" << be_nl
+ << "return" << be_idt_nl;
+
+ if (!node->is_abstract ())
+ {
+ *os << "TAO::Narrow_Utils<STUB_SCOPED_NAME>::unchecked_narrow (";
+ }
+ else
+ {
+ *os << "TAO::AbstractBase_Narrow_Utils<STUB_SCOPED_NAME>::unchecked_narrow (";
+ }
+ *os << be_idt << be_idt_nl
+ << "obj.in ()," << be_nl
+ << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_function_pointer" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}";
+
+}
+
+void
+be_visitor_amh_interface_ss::dispatch_method (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ ACE_CString full_skel_name_holder =
+ this->generate_full_skel_name (node);
+ const char *full_skel_name = full_skel_name_holder.c_str ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "void" << be_nl
+ << full_skel_name << "::_dispatch (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & req," << be_nl
+ << "void * context" << env_decl << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "this->asynchronous_upcall_dispatch (" << be_idt << be_idt_nl
+ << "req," << be_nl
+ << "context," << be_nl
+ << "this" << env_arg << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}";
+}
+
+void
+be_visitor_amh_interface_ss::generate_send_reply (TAO_OutStream * os)
+{
+ *os << be_nl << be_nl
+ << "server_request.tao_send_reply ();";
+}
+
+int
+be_visitor_amh_interface_ss::generate_amh_classes (be_interface *)
+{
+ // No AMH classes for the AMH classes... :-)
+ return 0;
+}
+
+int
+be_visitor_amh_interface_ss::generate_proxy_classes (be_interface *)
+{
+ // No Proxy or ProxyBrokers for the AMH classes
+ return 0;
+}
+
+// ****************************************************************
+
+class TAO_IDL_Downcast_Implementation_Worker
+ : public TAO_IDL_Inheritance_Hierarchy_Worker
+{
+public:
+ TAO_IDL_Downcast_Implementation_Worker ();
+
+ virtual int emit (be_interface *base,
+ TAO_OutStream *os,
+ be_interface *derived);
+};
+
+TAO_IDL_Downcast_Implementation_Worker::
+TAO_IDL_Downcast_Implementation_Worker (void)
+{
+}
+
+int
+TAO_IDL_Downcast_Implementation_Worker::
+emit (be_interface * /* derived */,
+ TAO_OutStream *os,
+ be_interface *base)
+{
+ // @@ This whole thing would be more efficient if we could pass the
+ // ACE_CString to compute_full_name, after all it uses that
+ // internally.
+ ACE_CString amh_name ("POA_");
+
+ // @@ The following code is *NOT* exception-safe.
+ char *buf = 0;
+ base->compute_full_name ("AMH_", "", buf);
+ amh_name += buf;
+ // buf was allocated using ACE_OS::strdup, so we must use free instead
+ // of delete.
+ ACE_OS::free (buf);
+
+ *os << "if (ACE_OS::strcmp (logical_type_id, \""
+ << base->repoID () << "\") == 0)" << be_idt_nl
+ << "return static_cast<"
+ << amh_name.c_str () << "*> (this);" << be_uidt_nl;
+
+ return 0;
+}
+
+// ****************************************************************
+
+class TAO_IDL_Copy_Ctor_Worker
+ : public TAO_IDL_Inheritance_Hierarchy_Worker
+{
+public:
+ TAO_IDL_Copy_Ctor_Worker (void);
+
+ virtual int emit (be_interface *base,
+ TAO_OutStream *os,
+ be_interface *derived);
+};
+
+TAO_IDL_Copy_Ctor_Worker::
+TAO_IDL_Copy_Ctor_Worker (void)
+{
+}
+
+int
+TAO_IDL_Copy_Ctor_Worker::
+emit (be_interface *derived,
+ TAO_OutStream *os,
+ be_interface *base)
+{
+ if (derived == base)
+ {
+ return 0;
+ }
+
+ *os << "," << be_idt_nl;
+
+ if (base->is_nested ())
+ {
+ be_decl *scope;
+ scope = be_scope::narrow_from_scope (base->defined_in ())->decl ();
+
+ *os << "POA_" << scope->name () << "::AMH_"
+ << base->local_name () << " (rhs)";
+ }
+ else
+ {
+ // @@ This whole thing would be more efficient if we could pass the
+ // ACE_CString to compute_full_name, after all it uses that
+ // internally.
+ ACE_CString amh_name ("POA_");
+
+ // @@ The following code is *NOT* exception-safe.
+ char *buf = 0;
+ base->compute_full_name ("AMH_", "", buf);
+ amh_name += buf;
+ // buf was allocated by ACE_OS::strdup, so we need to use free
+ // instead of delete.
+ ACE_OS::free (buf);
+
+ *os << amh_name.c_str () << " (rhs)";
+ }
+
+ *os << be_uidt;
+
+ return 0;
+}
+
+int
+be_visitor_amh_interface_ss::generate_copy_ctor (be_interface *node,
+ TAO_OutStream *os)
+{
+ // Make sure the queues are empty.
+ node->get_insert_queue ().reset ();
+ node->get_del_queue ().reset ();
+
+
+ // Insert ourselves in the queue.
+ if (node->get_insert_queue ().enqueue_tail (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_interface::traverse_inheritance_graph - "
+ "error generating entries\n"),
+ -1);
+ }
+
+ TAO_IDL_Copy_Ctor_Worker worker;
+ return node->traverse_inheritance_graph (worker, os);
+}
+
+// ****************************************************************
+
+ACE_CString
+be_visitor_amh_interface_ss::generate_flat_name (be_interface *node)
+{
+ // @@ The following code is *NOT* exception-safe.
+ char *buf = 0;
+ node->compute_flat_name ("AMH_", "", buf);
+
+ // @@ This whole thing would be more efficient if we could pass the
+ // ACE_CString to compute_flat_name, after all it uses that
+ // internally.
+ ACE_CString result (buf);
+ // buf was allocated using ACE_OS::strdup, so we must use free instead
+ // of delete.
+ ACE_OS::free (buf);
+
+ return result;
+}
+
+ACE_CString
+be_visitor_amh_interface_ss::generate_local_name (be_interface *node)
+{
+ ACE_CString local_name = "AMH_";
+ local_name += node->local_name ();
+ return local_name;
+}
+
+ACE_CString
+be_visitor_amh_interface_ss::generate_full_skel_name (be_interface *node)
+{
+ // @@ This whole thing would be more efficient if we could pass the
+ // ACE_CString to compute_full_name, after all it uses that
+ // internally.
+ ACE_CString result ("POA_");
+
+ // @@ The following code is *NOT* exception-safe.
+ char *buf = 0;
+ node->compute_full_name ("AMH_", "", buf);
+ result += buf;
+ // buf was allocated using ACE_OS::strdup, so we must use free instead
+ // of delete.
+ ACE_OS::free (buf);
+
+ return result;
+}
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
new file mode 100644
index 00000000000..ee0f4219ad8
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/ami_interface_ch.cpp
@@ -0,0 +1,67 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// ami_interface_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for AMI Interfaces in the client header
+//
+// = AUTHOR
+// Aniruddha Gokhale,
+// Michael Kircher
+//
+// ============================================================================
+
+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_interface (ctx)
+{
+}
+
+be_visitor_ami_interface_ch::~be_visitor_ami_interface_ch (void)
+{
+}
+
+int
+be_visitor_ami_interface_ch::visit_interface (be_interface *node)
+{
+ // No need to check for code already having been generated. This
+ // is a separate pass through the AST specific to AMI, and will
+ // happen only once.
+ if (node->imported () || node->is_local ())
+ {
+ return 0;
+ }
+
+ // Grab the stream.
+ TAO_OutStream *os = this->ctx_->stream ();
+ os->gen_ifdef_macro (node->replacement ()->flat_name (), "_ptr");
+
+ // Forward declaration.
+ *os << be_nl << be_nl
+ << "class " << node->replacement ()->local_name () << ";" << be_nl;
+
+ // Generate the _ptr declaration.
+ *os << "typedef " << node->replacement ()->local_name ()
+ << " *" << node->replacement ()->local_name ()
+ << "_ptr;";
+
+ 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
new file mode 100644
index 00000000000..0ac3043f090
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp
@@ -0,0 +1,124 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Any operators for an Interface in the client
+// header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_interface,
+ any_op_ch,
+ "$Id$")
+
+// ***************************************************************************
+// Interface visitor for generating Any operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_interface_any_op_ch::be_visitor_interface_any_op_ch
+(be_visitor_context *ctx)
+ : be_visitor_interface (ctx)
+{
+}
+
+be_visitor_interface_any_op_ch::~be_visitor_interface_any_op_ch (void)
+{
+}
+
+int
+be_visitor_interface_any_op_ch::visit_interface (be_interface *node)
+{
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ()
+ || (node->is_local () && !be_global->gen_local_iface_anyops ()))
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ const char *macro = this->ctx_->export_macro ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ be_module *module = 0;
+
+ if (node->is_nested () &&
+ node->defined_in ()->scope_node_type () == AST_Decl::NT_module)
+ {
+ module = be_module::narrow_from_scope (node->defined_in ());
+
+ if (!module)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_valuebox_any_op_ch::"
+ "visit_valuebox - "
+ "Error parsing nested name\n"),
+ -1);
+ }
+
+ // Some compilers handle "any" operators in a namespace
+ // corresponding to their module, others do not.
+ *os << "\n\n#if defined (ACE_ANY_OPS_USE_NAMESPACE)\n";
+
+ be_util::gen_nested_namespace_begin (os, module);
+
+ // emit nested variation of any operators
+ *os << macro << " void"
+ << " operator<<= ( ::CORBA::Any &, " << node->local_name ()
+ << "_ptr); // copying" << be_nl;
+ *os << macro << " void"
+ << " operator<<= ( ::CORBA::Any &, " << node->local_name ()
+ << "_ptr *); // non-copying" << be_nl;
+ *os << macro << " ::CORBA::Boolean"
+ << " operator>>= (const ::CORBA::Any &, "
+ << node->local_name () << "_ptr &);";
+
+ be_util::gen_nested_namespace_end (os, module);
+
+ // emit #else
+ *os << "#else\n\n";
+ }
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *os << macro << " void operator<<= (::CORBA::Any &, " << node->name ()
+ << "_ptr); // copying" << be_nl;
+ *os << macro << " void operator<<= (::CORBA::Any &, " << node->name ()
+ << "_ptr *); // non-copying" << be_nl;
+ *os << macro << " ::CORBA::Boolean operator>>= (const ::CORBA::Any &, "
+ << node->name () << "_ptr &);";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ if (module != 0)
+ {
+ *os << "\n\n#endif";
+ }
+
+ // 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_any_op_ch::"
+ "visit_interface - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+
+ node->cli_hdr_any_op_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp
new file mode 100644
index 00000000000..fe23f84f78c
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp
@@ -0,0 +1,266 @@
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Any operators for Interface in the stubs
+// file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_interface,
+ any_op_cs,
+ "$Id$")
+
+// ***************************************************************************
+// Interface visitor for generating Any operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_interface_any_op_cs::be_visitor_interface_any_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_interface (ctx)
+{
+}
+
+be_visitor_interface_any_op_cs::~be_visitor_interface_any_op_cs (void)
+{
+}
+
+int
+be_visitor_interface_any_op_cs::visit_interface (be_interface *node)
+{
+ if (node->cli_stub_any_op_gen ()
+ || node->imported ()
+ || (node->is_local () && !be_global->gen_local_iface_anyops ()))
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // All template specializations must be generated before the instantiations
+ // in the operators.
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ if (! node->is_abstract ())
+ {
+ *os << be_nl << be_nl
+ << "namespace TAO" << be_nl
+ << "{" << be_idt_nl
+ << "template<>" << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "Any_Impl_T<" << node->name () << ">::to_object ("
+ << be_idt << be_idt_nl
+ << "::CORBA::Object_ptr &_tao_elem" << be_uidt_nl
+ << ") const" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "_tao_elem = ::CORBA::Object::_duplicate (this->value_);" << be_nl
+ << "return true;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}";
+ }
+
+ if (node->is_abstract () || node->has_mixed_parentage ())
+ {
+ *os << be_nl << be_nl
+ << "namespace TAO" << be_nl
+ << "{" << be_idt_nl
+ << "template<>" << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "Any_Impl_T<" << node->name ()
+ << ">::to_abstract_base ("
+ << be_idt << be_idt_nl
+ << "::CORBA::AbstractBase_ptr &_tao_elem" << be_uidt_nl
+ << ") const" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "_tao_elem = ::CORBA::AbstractBase::_duplicate (this->value_);"
+ << be_nl
+ << "return true;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}";
+ }
+
+ // Since we don't generate CDR stream operators for types that
+ // explicitly contain a local interface (at some level), we
+ // must override these Any template class methods to avoid
+ // calling the non-existent operators. The zero return value
+ // will eventually cause CORBA::MARSHAL to be raised if this
+ // type is inserted into an Any and then marshaled.
+ if (node->is_local ())
+ {
+ *os << be_nl << be_nl
+ << "namespace TAO" << be_nl
+ << "{" << be_idt_nl
+ << "template<>" << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "Any_Impl_T<" << node->name ()
+ << ">::marshal_value (TAO_OutputCDR &)" << be_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "template<>" << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "Any_Impl_T<" << node->name ()
+ << ">::demarshal_value (TAO_InputCDR &)" << be_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}";
+ }
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ be_module *module = 0;
+
+ if (node->is_nested () &&
+ node->defined_in ()->scope_node_type () == AST_Decl::NT_module)
+ {
+ module = be_module::narrow_from_scope (node->defined_in ());
+
+ if (!module)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_valuebox_any_op_cs::"
+ "visit_valuebox - "
+ "Error parsing nested name\n"),
+ -1);
+ }
+
+ // Some compilers handle "any" operators in a namespace corresponding
+ // to their module, others do not.
+ *os << "\n\n#if defined (ACE_ANY_OPS_USE_NAMESPACE)\n";
+
+ be_util::gen_nested_namespace_begin (os, module);
+
+ // emit nested variation of any operators
+ *os << be_nl << be_nl
+ << "// Copying insertion." << be_nl
+ << "void" << be_nl
+ << "operator<<= (" << be_idt << be_idt_nl
+ << "::CORBA::Any &_tao_any," << be_nl
+ << node->local_name () << "_ptr _tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << node->local_name () << "_ptr _tao_objptr =" << be_idt_nl
+ << node->local_name () << "::_duplicate (_tao_elem);" << be_uidt_nl
+ << "_tao_any <<= &_tao_objptr;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "// Non-copying insertion." << be_nl
+ << "void" << be_nl
+ << "operator<<= (" << be_idt << be_idt_nl
+ << "::CORBA::Any &_tao_any," << be_nl
+ << node->local_name () << "_ptr *_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "TAO::Any_Impl_T<" << node->local_name () << ">::insert ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->local_name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name ()->last_component () << "," << be_nl
+ << "*_tao_elem" << 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->local_name () << "_ptr &_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return" << be_idt_nl
+ << "TAO::Any_Impl_T<" << node->local_name () << ">::extract ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->local_name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name ()->last_component () << "," << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}";
+
+ be_util::gen_nested_namespace_end (os, module);
+
+ // emit #else
+ *os << "#else\n";
+ }
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *os << be_nl << be_nl
+ << "// Copying insertion." << be_nl
+ << "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
+ << node->full_name () << "_ptr _tao_objptr =" << be_idt_nl
+ << node->full_name () << "::_duplicate (_tao_elem);" << be_uidt_nl
+ << "_tao_any <<= &_tao_objptr;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "// Non-copying insertion." << be_nl
+ << "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::Any_Impl_T<" << node->name () << ">::insert ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "*_tao_elem" << 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
+ << "return" << be_idt_nl
+ << "TAO::Any_Impl_T<" << node->name () << ">::extract ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ if (module != 0)
+ {
+ *os << "\n\n#endif";
+ }
+
+ // All we have to do is to visit the scope and generate code.
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface::visit_interface - "
+ "codegen for scope failed\n"), -1);
+ }
+
+ node->cli_stub_any_op_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/base_proxy_broker_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/base_proxy_broker_ch.cpp
new file mode 100644
index 00000000000..916f4cb041d
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/base_proxy_broker_ch.cpp
@@ -0,0 +1,81 @@
+//$Id$
+
+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 (ctx)
+{
+ // No-Op.
+}
+
+
+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
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << 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 << "class " << be_global->stub_export_macro () << " "
+ << node->base_proxy_broker_name () << be_nl << "{" << be_nl
+ << "public:"
+ << be_idt_nl; // idt = 1
+
+
+
+ // Destructor
+ *os << "virtual ~" << node->base_proxy_broker_name () << " (void);" << be_nl;
+
+ // Accessor Method
+ *os << "virtual " << node->base_proxy_impl_name () << " &"
+ << "select_proxy ("
+ << be_idt << be_idt_nl;
+
+ *os << node->local_name () << " *object" << env_dflts << be_uidt_nl
+ << ") = 0;"
+ << be_uidt_nl // idt = 1
+ << be_uidt_nl; // idt = 0
+
+ // Constructor
+ *os << "protected:" << be_idt_nl
+ << node->base_proxy_broker_name () << " (void);" << be_nl
+ << be_uidt_nl;
+
+ *os << "};" << be_nl << be_nl;
+
+ be_global->non_local_interfaces.enqueue_tail (node);
+
+ *os << "//" << be_nl
+ << "// End Base Proxy Broker Declaration " << be_nl
+ << "///////////////////////////////////////////////////////////////////////"
+ << be_nl << be_nl;
+
+ return 0;
+}
+
+int be_visitor_interface_base_proxy_broker_ch::visit_component (
+ be_component *node
+ )
+{
+ return this->visit_interface (node);
+}
+
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
new file mode 100644
index 00000000000..0958fa5e06d
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/base_proxy_impl_ch.cpp
@@ -0,0 +1,191 @@
+//
+// $Id$
+//
+
+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 (ctx)
+{
+ // No-Op.
+}
+
+
+be_visitor_interface_base_proxy_impl_ch::
+~be_visitor_interface_base_proxy_impl_ch (void)
+{
+ // No-Op.
+}
+
+int
+be_visitor_interface_base_proxy_impl_ch::visit_interface (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << 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
+ << ": ";
+
+ int has_concrete_parent = 0;
+
+ if (node->node_type () == AST_Decl::NT_component)
+ {
+ be_component *bc = be_component::narrow_from_decl (node);
+ AST_Component *ac_base = bc->base_component ();
+
+ if (ac_base != 0)
+ {
+ has_concrete_parent = 1;
+ be_component *bc_base = be_component::narrow_from_decl (ac_base);
+
+ *os << "public virtual "
+ << bc_base->full_base_proxy_impl_name ();
+ }
+ }
+
+ int n_parents = node->n_inherits ();
+
+ if (n_parents > 0)
+ {
+ *os << be_idt;
+
+ for (int i = 0; i < n_parents; ++i)
+ {
+ be_interface *inherited =
+ be_interface::narrow_from_decl (node->inherits ()[i]);
+
+ if (inherited->is_abstract ())
+ {
+ continue;
+ }
+
+ 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;
+ }
+
+ if (has_concrete_parent == 0)
+ {
+ *os << "public virtual TAO_Object_Proxy_Impl";
+ }
+
+ *os << be_uidt_nl << "{" << be_nl << "public:"
+ << be_idt_nl;
+
+ // Destructor Declaration.
+ *os << "virtual ~" << node->base_proxy_impl_name () << " (void) {}";
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_base_proxy_impl_ch::"
+ "visit_interface - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl << be_nl;
+
+ // Constructor Declaration.
+ *os << "protected:" << be_idt_nl // idt = 1
+ << node->base_proxy_impl_name () << " (void);"
+ << be_uidt_nl;
+
+ *os << "};" << be_nl << be_nl
+ << "//" << be_nl
+ << "// 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);
+
+ // We pass the node's is_abstract flag to the operation
+ // constructor so we will get the right generated operation
+ // body if we are regenerating an operation from an
+ // abstract interface in a concrete interface or component.
+ AST_Operation *op = AST_Operation::narrow_from_decl (d);
+ be_operation new_op (op->return_type (),
+ op->flags (),
+ &item_new_name,
+ op->is_local (),
+ node->is_abstract ());
+ new_op.set_defined_in (node);
+ be_visitor_interface::add_abstract_op_args (op,
+ new_op);
+ be_visitor_operation_base_proxy_impl_ch op_visitor (&ctx);
+ op_visitor.visit_operation (&new_op);
+ }
+ }
+
+ return 0;
+}
+
+int be_visitor_interface_base_proxy_impl_ch::visit_component (
+ be_component *node
+ )
+{
+ return this->visit_interface (node);
+}
+
+
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
new file mode 100644
index 00000000000..7f580e93811
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp
@@ -0,0 +1,84 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for CDR operators for interfaces. This uses
+// compiled marshaling.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+be_visitor_interface_cdr_op_ch::~be_visitor_interface_cdr_op_ch (void)
+{
+}
+
+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;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ // Generate the CDR << and >> operator declarations.
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean "
+ << "operator<< (TAO_OutputCDR &, const " << node->full_name ()
+ << "_ptr );" << be_nl;
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean "
+ << "operator>> (TAO_InputCDR &, "
+ << node->full_name () << "_ptr &);" << be_nl;
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ // Set the substate as generating code for the types defined in our scope.
+ this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_SCOPE);
+
+ 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);
+ }
+
+ this->ctx_->sub_state (TAO_CodeGen::TAO_SUB_STATE_UNKNOWN);
+ node->cli_hdr_cdr_op_gen (1);
+ return 0;
+}
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
new file mode 100644
index 00000000000..468e5c56e06
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp
@@ -0,0 +1,149 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for CDR operators for interfaces
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+be_visitor_interface_cdr_op_cs::~be_visitor_interface_cdr_op_cs (void)
+{
+}
+
+int
+be_visitor_interface_cdr_op_cs::visit_interface (be_interface *node)
+{
+ // No CDR operations for local interfaces.
+ // 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;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // 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)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_cdr_op_cs::"
+ "visit_interface - "
+ "codegen for scope failed\n"), -1);
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+
+ *os << be_global->core_versioning_begin () << 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 operator<< (" << be_idt << be_idt_nl
+ << "TAO_OutputCDR &strm," << be_nl
+ << "const " << node->full_name () << "_ptr _tao_objref" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (node->is_abstract ())
+ {
+ *os << "::CORBA::AbstractBase_ptr";
+ }
+ else if (node->node_type () == AST_Decl::NT_component)
+ {
+ *os << "Components::CCMObject_ptr";
+ }
+ else
+ {
+ *os << "::CORBA::Object_ptr";
+ }
+
+ *os << " _tao_corba_obj = _tao_objref;" << be_nl;
+ *os << "return (strm << _tao_corba_obj);" << 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 operator>> (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &strm," << be_nl
+ << node->full_name () << "_ptr &_tao_objref" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (node->is_abstract ())
+ {
+ *os << "::CORBA::AbstractBase_var obj;";
+ }
+ else if (node->node_type () == AST_Decl::NT_component)
+ {
+ *os << "Components::CCMObject_var obj;";
+ }
+ else
+ {
+ *os << "::CORBA::Object_var obj;";
+ }
+
+ *os << be_nl << be_nl
+ << "if (!(strm >> obj.inout ()))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "typedef ::" << node->name () << " RHS_SCOPED_NAME;"
+ << be_nl << be_nl
+ << "// Narrow to the right type." << be_nl;
+
+ *os << "_tao_objref =" << be_idt_nl;
+
+ if (!node->is_abstract ())
+ {
+ *os << "TAO::Narrow_Utils<RHS_SCOPED_NAME>::unchecked_narrow (";
+ }
+ else
+ {
+ *os << "TAO::AbstractBase_Narrow_Utils<RHS_SCOPED_NAME>::unchecked_narrow (";
+ }
+
+ *os << be_idt << be_idt_nl
+ << "obj.in ()," << be_nl
+ << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_function_pointer" << be_uidt_nl
+ << ");" << be_uidt_nl << be_uidt_nl;
+
+ *os << "return true;" << be_uidt_nl
+ << "}" << be_nl;
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ node->cli_stub_cdr_op_gen (1);
+ return 0;
+}
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
new file mode 100644
index 00000000000..f07aa96dbbb
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp
@@ -0,0 +1,212 @@
+//
+// $Id$
+//
+
+ACE_RCSID (be_visitor_interface,
+ direct_proxy_impl_sh,
+ "$Id$")
+
+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)
+{
+ // No-Op.
+}
+
+int
+be_visitor_interface_direct_proxy_impl_sh::visit_interface (
+ be_interface *node
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl
+ << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *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 ();
+
+ bool first_concrete = true;
+
+ if (node->n_inherits () > 0)
+ {
+ AST_Interface *parent = 0;
+
+ for (int i = 0; i < node->n_inherits (); ++i)
+ {
+ parent = node->inherits ()[i];
+
+ if (parent->is_abstract ())
+ {
+ continue;
+ }
+
+ be_interface *inherited =
+ be_interface::narrow_from_decl (parent);
+
+ if (first_concrete)
+ {
+ *os << be_nl
+ << " : " << be_idt << be_idt;
+ }
+ else
+ {
+ *os << "," << be_nl;
+ }
+
+ first_concrete = false;
+
+ *os << "public virtual ::"
+ << inherited->full_direct_proxy_impl_name ();
+ }
+
+ if (!first_concrete)
+ {
+ *os << be_uidt << be_uidt;
+ }
+ }
+
+ *os << be_nl
+ << "{" << be_nl << "public:" << be_idt_nl;
+
+ // Ctor
+ *os << node->direct_proxy_impl_name () << " (void);" << be_nl << be_nl;
+
+ // Dtor
+ *os << "virtual ~" << node->direct_proxy_impl_name () << " (void);";
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) direct_proxy_impl_sh::"
+ "visit_interface - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ // Generate static collocated operations for operations of our base
+ // classes.
+ int status =
+ node->traverse_inheritance_graph (
+ be_interface::gen_colloc_op_decl_helper,
+ os
+ );
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_direct_proxy_impl_sh::"
+ "visit_interface - "
+ "inheritance graph traversal failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl
+ << "};" << be_nl << be_nl
+ << "//" << be_nl
+ << "// Direct Proxy Impl. Declaration" << be_nl
+ << "///////////////////////////////////////////////////////////////////////"
+ << be_nl << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_interface_direct_proxy_impl_sh::gen_abstract_ops_helper (
+ be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os
+ )
+{
+ if (!base->is_abstract ())
+ {
+ return 0;
+ }
+
+ AST_Decl *d = 0;
+ be_visitor_context ctx;
+ ctx.stream (os);
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH);
+
+ 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::gen_abstract_ops_helper - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ UTL_ScopedName item_new_name (d->local_name (),
+ 0);
+
+ // We pass the node's is_abstract flag to the operation
+ // constructor so we will get the right generated operation
+ // body if we are regenerating an operation from an
+ // abstract interface in a concrete interface or component.
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ be_operation *op = be_operation::narrow_from_decl (d);
+ be_visitor_operation_proxy_impl_xh op_visitor (&ctx);
+ op_visitor.visit_operation (op);
+ }
+ else if (d->node_type () == AST_Decl::NT_attr)
+ {
+ AST_Attribute *attr = AST_Attribute::narrow_from_decl (d);
+ be_attribute new_attr (attr->readonly (),
+ attr->field_type (),
+ &item_new_name,
+ attr->is_local (),
+ attr->is_abstract ());
+ new_attr.set_defined_in (node);
+
+ UTL_ExceptList *get_exceptions = attr->get_get_exceptions ();
+
+ if (0 != get_exceptions)
+ {
+ new_attr.be_add_get_exceptions (get_exceptions->copy ());
+ }
+
+ UTL_ExceptList *set_exceptions = attr->get_set_exceptions ();
+
+ if (0 != set_exceptions)
+ {
+ new_attr.be_add_set_exceptions (set_exceptions->copy ());
+ }
+
+ be_visitor_attribute attr_visitor (&ctx);
+ attr_visitor.visit_attribute (&new_attr);
+ ctx.attribute (0);
+ new_attr.destroy ();
+ }
+ }
+
+ return 0;
+}
+
+int be_visitor_interface_direct_proxy_impl_sh::visit_component (
+ be_component *node
+ )
+{
+ return this->visit_interface (node);
+}
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
new file mode 100644
index 00000000000..97a20419a8c
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_ss.cpp
@@ -0,0 +1,178 @@
+//
+//$Id$
+//
+
+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 (ctx)
+{
+ // No-Op.
+}
+
+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
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ this->ctx_->node (node);
+
+ *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;
+
+ // Destructor 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,
+ "be_visitor_interface_direct_collocated_ss::"
+ "visit_scope - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ *os << be_nl << be_nl
+ << "//" << be_nl
+ << "// End Direct Proxy Implementation" << 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 (!base->is_abstract ())
+ {
+ return 0;
+ }
+
+ AST_Decl *d = 0;
+ be_visitor_context ctx;
+ ctx.stream (os);
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS);
+
+ 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::gen_abstract_ops_helper - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ AST_Decl::NodeType nt = d->node_type ();
+
+ UTL_ScopedName *item_new_name = 0;
+ UTL_ScopedName *new_name = 0;
+
+ if (AST_Decl::NT_op == nt || AST_Decl::NT_attr == nt)
+ {
+ ACE_NEW_RETURN (item_new_name,
+ UTL_ScopedName (d->local_name ()->copy (),
+ 0),
+ -1);
+
+ new_name = (UTL_ScopedName *) node->name ()->copy ();
+ new_name->nconc (item_new_name);
+ }
+ else
+ {
+ continue;
+ }
+
+ // We pass the node's is_abstract flag to the operation
+ // constructor so we will get the right generated operation
+ // body if we are regenerating an operation from an
+ // abstract interface in a concrete interface or component.
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ be_operation *op = be_operation::narrow_from_decl (d);
+ UTL_ScopedName *old_name =
+ (UTL_ScopedName *) op->name ()->copy ();
+ op->set_name (new_name);
+ op->set_defined_in (node);
+ op->is_abstract (node->is_abstract ());
+
+ be_visitor_operation_direct_proxy_impl_ss op_visitor (&ctx);
+ op_visitor.visit_operation (op);
+
+ op->set_name (old_name);
+ op->set_defined_in (base);
+ op->is_abstract (base->is_abstract ());
+ }
+ else if (d->node_type () == AST_Decl::NT_attr)
+ {
+ AST_Attribute *attr = AST_Attribute::narrow_from_decl (d);
+ be_attribute new_attr (attr->readonly (),
+ attr->field_type (),
+ 0,
+ attr->is_local (),
+ attr->is_abstract ());
+ new_attr.set_defined_in (node);
+ new_attr.set_name (new_name);
+
+ UTL_ExceptList *get_exceptions = attr->get_get_exceptions ();
+
+ if (0 != get_exceptions)
+ {
+ new_attr.be_add_get_exceptions (get_exceptions->copy ());
+ }
+
+ UTL_ExceptList *set_exceptions = attr->get_set_exceptions ();
+
+ if (0 != set_exceptions)
+ {
+ new_attr.be_add_set_exceptions (set_exceptions->copy ());
+ }
+
+ be_visitor_attribute attr_visitor (&ctx);
+ attr_visitor.visit_attribute (&new_attr);
+ ctx.attribute (0);
+ new_attr.destroy ();
+ }
+ }
+
+ return 0;
+}
+
+int be_visitor_interface_direct_proxy_impl_ss::visit_component (
+ be_component *node
+ )
+{
+ return this->visit_interface (node);
+}
+
+
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp
new file mode 100644
index 00000000000..6619f38955d
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp
@@ -0,0 +1,853 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Interfaces. This is a generic visitor.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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_interface::~be_visitor_interface (void)
+{
+}
+
+// This method must be overridden by the derived interface visitors.
+int
+be_visitor_interface::visit_interface (be_interface *)
+{
+ return -1;
+}
+
+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_ROOT_CS:
+ helper =
+ be_visitor_interface_cs::gen_abstract_ops_helper;
+ break;
+ case TAO_CodeGen::TAO_ROOT_SH:
+ helper =
+ be_visitor_interface_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_ROOT_SS:
+ helper =
+ be_visitor_interface_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;
+ default:
+ break;
+ }
+
+ if (helper == 0)
+ {
+ return 0;
+ }
+
+ // 'abstract_paths_only' arg is FALSE here because we want to traverse
+ // through concrete parents to get to all the abstract ones. The helper
+ // will do nothing unless the base interface passed to it is abstract.
+ int status =
+ intf->traverse_inheritance_graph (helper,
+ this->ctx_->stream (),
+ false);
+
+ 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;
+ }
+ }
+
+ return 0;
+}
+
+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);
+ }
+
+ UTL_ExceptList *excep_list = old_op->exceptions ();
+
+ if (0 != excep_list)
+ {
+ new_op.be_add_exceptions (excep_list->copy ());
+ }
+}
+
+// All common visit methods for interface visitor.
+
+int
+be_visitor_interface::visit_attribute (be_attribute *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+
+ // Same visitor for all the above cases where an action is taken.
+ be_visitor_attribute visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface::"
+ "visit_attribute - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_interface::visit_constant (be_constant *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ {
+ be_visitor_constant_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_constant_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface::"
+ "visit_constant - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_interface::visit_native (be_native *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:
+ {
+ be_visitor_native_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface::"
+ "visit_native - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_interface::visit_enum (be_enum *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ {
+ be_visitor_enum_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_enum_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_enum_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_enum_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_enum_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_enum_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface::"
+ "visit_enum - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+// visit an exception
+int
+be_visitor_interface::visit_exception (be_exception *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ {
+ be_visitor_exception_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_exception_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_exception_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_exception_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_exception_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_exception_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_exception_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface::"
+ "visit_exception - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+// visit an operation
+int
+be_visitor_interface::visit_operation (be_operation *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified ased on what type of node we are visiting
+ be_visitor_context ctx (*this->ctx_);
+ 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;
+ case TAO_CodeGen::TAO_ROOT_CS:
+ ctx.state (TAO_CodeGen::TAO_OPERATION_CS);
+ break;
+ case TAO_CodeGen::TAO_ROOT_SH:
+ {
+ be_visitor_operation_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_IH:
+ {
+ be_visitor_operation_ih visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SS:
+ {
+ be_visitor_operation_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_IS:
+ {
+ be_visitor_operation_is visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_TIE_SH:
+ {
+ be_visitor_operation_tie_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_TIE_SI:
+ {
+ be_visitor_operation_tie_si visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
+ {
+ be_visitor_operation_smart_proxy_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
+ {
+ be_visitor_operation_smart_proxy_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
+ {
+ be_visitor_operation_proxy_impl_xh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH:
+ {
+ be_visitor_amh_rh_operation_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SS:
+ {
+ be_visitor_amh_rh_operation_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS:
+ {
+ be_visitor_operation_direct_proxy_impl_ss 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:
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ case TAO_CodeGen::TAO_ROOT_CI:
+ case TAO_CodeGen::TAO_ROOT_SI:
+ return 0; // nothing to be done
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface::"
+ "visit_operation - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ 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.
+ 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);
+ }
+
+ if (node->accept (visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface::"
+ "visit_operation - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ delete visitor;
+ visitor = 0;
+
+ // Do additional code generation is necessary.
+ // Note, this call is delegated to the strategy connected to
+ // the node.
+ 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));
+
+ // 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);
+ }
+
+ if (node->accept (visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface::"
+ "visit_operation - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ delete visitor;
+ visitor = 0;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_interface::visit_structure (be_structure *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ {
+ be_visitor_structure_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_structure_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_structure_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_structure_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_structure_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_structure_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_structure_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface::"
+ "visit_structure - "
+ "failed to accept visitor\n"),
+ -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:
+ {
+ be_visitor_structure_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface::"
+ "visit_structure_fwd - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_interface::visit_union (be_union *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ {
+ be_visitor_union_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_union_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_union_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_union_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_union_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_union_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_union_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface::"
+ "visit_union - "
+ "failed to accept visitor\n"),
+ -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:
+ {
+ be_visitor_union_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface::"
+ "visit_union_fwd - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_interface::visit_typedef (be_typedef *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ {
+ be_visitor_typedef_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_typedef_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_typedef_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_typedef_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_typedef_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_typedef_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_typedef_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface::"
+ "visit_typedef - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
new file mode 100644
index 00000000000..56028c21bbe
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
@@ -0,0 +1,463 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Interfaces in the client header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_interface,
+ interface_ch,
+ "$Id$")
+
+// ******************************************************
+// Interface visitor for client header
+// ******************************************************
+
+be_visitor_interface_ch::be_visitor_interface_ch (be_visitor_context *ctx)
+ : be_visitor_interface (ctx)
+{
+}
+
+be_visitor_interface_ch::~be_visitor_interface_ch (void)
+{
+}
+
+int
+be_visitor_interface_ch::visit_interface (be_interface *node)
+{
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ // This will be a no-op if it has already been done by a forward
+ // declaration.
+ node->gen_var_out_seq_decls ();
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ long i;
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Now the interface definition itself.
+ os->gen_ifdef_macro (node->flat_name ());
+
+ // Now generate the class definition.
+ *os << be_nl << be_nl
+ << "class " << be_global->stub_export_macro ()
+ << " " << node->local_name () << be_idt_nl
+ << ": " ;
+
+ long nparents = node->n_inherits ();
+ int has_concrete_parent = 0;
+
+ // If node interface inherits from other interfaces.
+ if (nparents > 0)
+ {
+ *os << be_idt;
+
+ for (i = 0; i < nparents; ++i)
+ {
+ if (! node->inherits ()[i]->is_abstract ())
+ {
+ has_concrete_parent = 1;
+ }
+
+ *os << "public virtual ::"
+ << node->inherits ()[i]->name ();
+
+ if (i < nparents - 1)
+ {
+ // 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 if (! node->is_abstract ())
+ {
+ *os << "," << be_nl;
+ }
+ }
+
+ if (node->is_abstract () && nparents == 0)
+ {
+ *os << "public virtual ::CORBA::AbstractBase" << be_uidt_nl;
+ }
+
+ if (has_concrete_parent == 0 && ! node->is_abstract ())
+ {
+ *os << "public virtual ::CORBA::Object";
+
+ if (nparents > 0)
+ {
+ *os << be_uidt;
+ }
+
+ *os << be_uidt_nl;
+ }
+
+ // Generate the body.
+
+ *os << "{" << be_nl
+ << "public:" << be_idt_nl;
+
+ if (!node->is_local () && !node->is_abstract ())
+ {
+ *os << "friend class TAO::Narrow_Utils<"
+ << node->local_name () << ">;" << be_nl;
+ }
+ else if (!node->is_local () && node->is_abstract ())
+ {
+ *os << "friend class TAO::AbstractBase_Narrow_Utils<"
+ << node->local_name () << ">;" << be_nl;
+ }
+
+ *os << "typedef " << node->local_name () << "_ptr _ptr_type;"
+ << be_nl
+ << "typedef " << node->local_name () << "_var _var_type;"
+ << be_nl
+ << "typedef " << node->local_name () << "_out _out_type;"
+ << be_nl << be_nl;
+
+ // Generate the static _duplicate, _narrow, _unchecked_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 void _tao_release ("
+ << node->local_name () << "_ptr obj);" << be_nl << be_nl;
+
+ if (this->gen_xxx_narrow ("_narrow",
+ node,
+ os) == false)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%P|%t) Error in "
+ "be_visitor_interface_ch::"
+ "visit_interface while generating "
+ "_narrow () declaration \n"),
+ -1);
+ }
+
+ if (this->gen_xxx_narrow ("_unchecked_narrow",
+ node,
+ os) == false)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%P|%t) Error in "
+ "be_visitor_interface_ch::"
+ "visit_interface while generating "
+ "_unchecked_narrow () declaration \n"),
+ -1);
+ }
+
+ // This method is defined in the header file to workaround old
+ // g++ problems.
+ *os << "static " << node->local_name () << "_ptr _nil (void)"
+ << be_nl
+ << "{" << be_idt_nl
+ << "return static_cast<" << node->local_name ()
+ << "_ptr> (0);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ bool gen_any_destructor =
+ be_global->any_support ()
+ && (!node->is_local () || be_global->gen_local_iface_anyops ());
+
+ if (gen_any_destructor)
+ {
+ *os << "static void _tao_any_destructor (void *);";
+ }
+
+ // 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);
+ }
+
+ if (node->is_local ())
+ {
+ if (node->convert_parent_ops (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_ch::"
+ "visit_interface - "
+ "converting parent ops failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ if (node->session_component_child () == 1)
+ {
+ *os << "// These two are inherited from SessionComponent."
+ << be_nl << be_nl
+ << "virtual void ciao_preactivate (" << be_idt << be_idt
+ << env_sngl_dflts << be_uidt_nl
+ << ")" << be_nl
+ << "ACE_THROW_SPEC ((" << be_idt_nl
+ << "::CORBA::SystemException," << be_nl
+ << "::Components::CCMException" << be_uidt_nl
+ << "));" << be_uidt_nl << be_nl
+ << "virtual void ciao_postactivate (" << be_idt << be_idt
+ << env_sngl_dflts << be_uidt_nl
+ << ")" << be_nl
+ << "ACE_THROW_SPEC ((" << be_idt_nl
+ << "::CORBA::SystemException," << be_nl
+ << "::Components::CCMException" << be_uidt_nl
+ << "));" << be_uidt_nl << be_nl;
+ }
+
+ // If we inherit from both CORBA::Object and CORBA::AbstractBase,
+ // we have to override _add_ref() to avoid ambiguity.
+ if (node->has_mixed_parentage ())
+ {
+ *os << "virtual void _add_ref (void);" << be_nl << be_nl;
+ }
+
+ // The _is_a method
+ *os << "virtual ::CORBA::Boolean _is_a (" << be_idt << be_idt_nl
+ << "const char *type_id" << env_dflts << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // The _interface_repository_id method.
+ *os << "virtual const char* _interface_repository_id (void) const;";
+
+ // The virtual marshal method, to prevent marshal of local iterfaces.
+ *os << be_nl << "virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr);";
+
+ if (! node->is_local ())
+ {
+ // Add the Proxy Broker member variable.
+ *os << be_uidt_nl
+ << "private:" << be_idt_nl
+ << "TAO::Collocation_Proxy_Broker *"
+ << "the" << node->base_proxy_broker_name ()
+ << "_;";
+ }
+
+ *os << be_uidt_nl << be_nl
+ << "protected:" << be_idt_nl;
+
+ if (! node->is_local ())
+ {
+ // Generate the "protected" constructor so that users cannot
+ // instantiate us.
+
+ if (! node->is_abstract ())
+ {
+ *os << "// Concrete interface only." << be_nl
+ << node->local_name () << " (void);"
+ << 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 (void);" << be_nl << be_nl;
+ }
+
+ if (node->is_abstract () || node->is_local ())
+ {
+ // Protected default constructor for abstract interfaces.
+ *os << "// Abstract or local interface only." << be_nl
+ << node->local_name () << " (void);" << be_nl << be_nl;
+ }
+
+ if (node->is_abstract ())
+ {
+ // Protected copy constructor for abstract interfaces.
+ *os << "// Protected for abstract interfaces." << be_nl
+ << node->local_name () << " (const "
+ << node->local_name () << " &);" << be_nl << be_nl;
+ }
+
+
+ // Local interfaces don't support stub objects.
+ if (! node->is_local ())
+ {
+ if (! node->is_abstract ())
+ {
+ *os << "// Concrete non-local interface only." << be_nl
+ << node->local_name () << " (" << be_idt << be_idt_nl
+ << "IOP::IOR *ior," << be_nl
+ << "TAO_ORB_Core *orb_core = 0" << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+ }
+
+ *os << "// Non-local interface only." << be_nl
+ << 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_nl
+ << "TAO_ORB_Core *orb_core = 0" << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+ }
+
+ // Protected destructor.
+ *os << "virtual ~" << node->local_name () << " (void);";
+
+ // Private copy constructor and assignment operator. These are not
+ // allowed, hence they are private.
+ *os << be_uidt_nl << be_nl
+ << "private:" << be_idt_nl;
+
+ // Abstract interfaces have a *protected* copy constructor.
+ if (! node->is_abstract ())
+ {
+ *os << "// Private and unimplemented for concrete interfaces." << be_nl
+ << node->local_name () << " (const "
+ << node->local_name () << " &);" << be_nl << 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_context ctx (*this->ctx_);
+
+ ctx = *this->ctx_;
+
+ *os << be_uidt_nl;
+ *os << "};";
+
+ // Don't support smart proxies for local interfaces.
+ if (! node->is_local ())
+ {
+ // List that generates proxy broker factory function pointer.
+ be_global->non_local_interfaces.enqueue_tail (node);
+
+ if (be_global->gen_smart_proxies ())
+ {
+ *os << be_nl << be_nl;
+
+ // 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 smart proxy classes failed\n"),
+ -1);
+ }
+ }
+ }
+
+ os->gen_endif ();
+
+ if (be_global->tc_support () && !node->home_equiv ())
+ {
+ be_visitor_typecode_decl td_visitor (&ctx);
+
+ if (node->accept (&td_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_ch::"
+ "visit_interface - "
+ "TypeCode declaration failed\n"),
+ -1);
+ }
+ }
+
+ node->cli_hdr_gen (true);
+ return 0;
+}
+
+int
+be_visitor_interface_ch::gen_abstract_ops_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os)
+{
+ 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_interface::"
+ "gen_abstract_ops_helper - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+
+ be_operation *op = be_operation::narrow_from_decl (d);
+ op->set_local (node->is_local ());
+ ctx.state (TAO_CodeGen::TAO_OPERATION_CH);
+ be_visitor_operation_ch op_visitor (&ctx);
+ op_visitor.visit_operation (op);
+ op->set_local (base->is_local ());
+ }
+ }
+
+ return 0;
+}
+
+bool
+be_visitor_interface_ch::gen_xxx_narrow (const char *nar,
+ be_interface *node,
+ TAO_OutStream *os)
+{
+ *os << "static " << node->local_name () << "_ptr "
+ << nar << " (" << be_idt << be_idt_nl;
+
+ if (node->is_abstract ())
+ {
+ *os << "::CORBA::AbstractBase_ptr obj";
+ }
+ else
+ {
+ *os << "::CORBA::Object_ptr obj";
+ }
+
+ *os << env_dflts << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ return true;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp
new file mode 100644
index 00000000000..5f81239c45a
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp
@@ -0,0 +1,112 @@
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_ci.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Interfaces in the client inline file
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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)
+{
+}
+
+be_visitor_interface_ci::~be_visitor_interface_ci (void)
+{
+}
+
+int
+be_visitor_interface_ci::visit_interface (be_interface *node)
+{
+ if (node->imported ())
+ {
+ return 0;
+ }
+
+ // Generate inline methods for elements of our scope.
+ // This will always be done here for any non-imported node,
+ // whether the _var and _out code has been generated already
+ // at a forward declaration or not.
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_ci::"
+ "visit_interface - "
+ "codegen for scope failed\n"), -1);
+ }
+
+ // Nothing to generate for a local interface except from it scope.
+ if (node->is_local ())
+ {
+ node->cli_inline_gen (true);
+ return 0;
+ }
+
+ // A forward declared interface may have set this flag.
+ if (node->cli_inline_gen ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ os->gen_ifdef_macro (node->flat_name (), "");
+
+ if (node->is_abstract ())
+ {
+ *os << be_nl << be_nl
+ << "ACE_INLINE" << be_nl
+ << node->name () << "::" << node->local_name ()
+ << " (void)" << be_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
+ << "{}";
+ }
+
+ // Generate the constructor from stub and servant.
+ node->gen_stub_ctor (os);
+
+ if (!node->is_local () && !node->is_abstract ())
+ {
+ *os << be_nl << be_nl
+ << "ACE_INLINE" << be_nl;
+ *os << node->name () << "::"
+ << node->local_name () << " ("
+ << be_idt << be_idt_nl
+ << "IOP::IOR *ior," << be_nl
+ << "TAO_ORB_Core *oc" << be_uidt_nl
+ << ")" << be_nl;
+ *os << ": ::CORBA::Object (ior, oc)," << be_idt_nl
+ << "the"<< node->base_proxy_broker_name () << "_ (0)"
+ << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "}" ;
+ }
+
+ os->gen_endif ();
+ node->cli_inline_gen (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
new file mode 100644
index 00000000000..1ffea0d9e62
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
@@ -0,0 +1,659 @@
+//
+// $Id$
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Interfaces in the client stubs file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_interface,
+ interface_cs,
+ "$Id$")
+
+
+// ************************************************************
+// Interface visitor for client stubs
+// ************************************************************
+
+be_visitor_interface_cs::be_visitor_interface_cs (be_visitor_context *ctx)
+ : be_visitor_interface (ctx)
+{
+}
+
+be_visitor_interface_cs::~be_visitor_interface_cs (void)
+{
+}
+
+int
+be_visitor_interface_cs::visit_interface (be_interface *node)
+{
+ if (node->imported () || node->cli_stub_gen ())
+ {
+ return 0;
+ }
+
+ be_type *bt;
+
+ // Set the right type.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ if (node->is_defined ())
+ {
+ *os << be_nl << be_nl
+ << "// Traits specializations for " << node->name () << ".";
+
+ *os << be_nl << be_nl
+ << node->name () << "_ptr" << be_nl
+ << "TAO::Objref_Traits<" << node->name () << ">::duplicate ("
+ << be_idt << be_idt_nl
+ << node->name () << "_ptr p" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return " << node->name () << "::_duplicate (p);" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "void" << be_nl
+ << "TAO::Objref_Traits<" << node->name () << ">::release ("
+ << be_idt << be_idt_nl
+ << node->name () << "_ptr p" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::release (p);" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << node->name () << "_ptr" << be_nl
+ << "TAO::Objref_Traits<" << node->name () << ">::nil (void)"
+ << be_nl
+ << "{" << be_idt_nl
+ << "return " << node->name () << "::_nil ();" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "TAO::Objref_Traits<" << node->name () << ">::marshal ("
+ << be_idt << be_idt_nl
+ << "const " << node->name () << "_ptr p," << be_nl
+ << "TAO_OutputCDR & cdr" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return ";
+
+ if (node->is_abstract ())
+ {
+ *os << "cdr << p;";
+ }
+ else
+ {
+ *os << "::CORBA::Object::marshal (p, cdr);";
+ }
+
+ *os << be_uidt_nl
+ << "}";
+ }
+
+ if (node->has_mixed_parentage ())
+ {
+ *os << be_nl << be_nl
+ << "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
+ << "}";
+
+ *os << be_nl << be_nl
+ << "::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
+ << "}";
+ }
+
+ if (!node->is_local ())
+ {
+ // Generate the proxy broker factory function pointer definition.
+ *os << be_nl << be_nl
+ << "// Function pointer for collocation factory initialization."
+ << be_nl
+ << "TAO::Collocation_Proxy_Broker * " << be_nl
+ << "(*" << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_function_pointer) ("
+ << be_idt << be_idt_nl
+ << "::CORBA::Object_ptr obj" << be_uidt_nl
+ << ") = 0;" << be_uidt;
+ }
+
+ // Generate code for the elements of the interface.
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_cs::"
+ "visit_interface - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ if (node->is_local ())
+ {
+ *os << be_nl << be_nl
+ << node->name () << "::" << node->local_name ()
+ << " (void)" << be_nl
+ << "{}";
+ }
+
+ if (! node->is_abstract () && ! node->is_local ())
+ {
+ *os << be_nl << be_nl
+ << node->name () << "::" << node->local_name ()
+ << " (void)" << be_nl
+ << " : the" << node->base_proxy_broker_name () << "_ (0)" << be_nl
+ << "{" << be_idt_nl
+ << "this->" << node->flat_name ()
+ << "_setup_collocation ();" << be_uidt_nl
+ << be_uidt << "}";
+ }
+
+ if (! node->is_local ())
+ {
+ *os << be_nl << be_nl
+ << "void" << be_nl
+ << node->name () << "::" << node->flat_name ()
+ << "_setup_collocation ()" << be_nl
+ << "{" << be_idt_nl
+ << "if (" << "::"
+ << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_function_pointer";
+
+ // Right now (29-01-04) we don't support collocation for
+ // abstract interfaces, and the 'collocated' arg will always
+ // be 0. However, just to be safe, we add a
+ // check for non-zero collocation factory function pointer
+ // (which at present is also 0 for abstract interfaces),
+ // in case the logic is changed in the future.
+ if (node->is_abstract ())
+ {
+ *os << " && " << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_function_pointer";
+ }
+
+ *os << ")" << be_idt_nl
+ << "{" << 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 (";
+
+ if (node->is_abstract ())
+ {
+ *os << be_idt << be_idt_nl
+ << "this->equivalent_objref ()" << be_uidt_nl
+ << ");" << be_uidt;
+ }
+ else
+ {
+ *os << "this);";
+ }
+
+ *os << be_uidt << be_uidt_nl
+ << "}" << be_uidt;
+
+ // Now we setup the immediate parents.
+ long n_parents = node->n_inherits ();
+ int has_parent = 0;
+
+ if (n_parents > 0)
+ {
+ for (long i = 0; i < n_parents; ++i)
+ {
+ be_interface *inherited =
+ be_interface::narrow_from_decl (node->inherits ()[i]);
+
+ if (has_parent == 0)
+ {
+ *os << be_nl;
+ }
+
+ has_parent = 1;
+
+ *os << be_nl
+ << "this->" << inherited->flat_name ()
+ << "_setup_collocation" << " ();";
+ }
+ }
+
+ *os << be_uidt_nl << "}";
+ }
+
+ *os << be_nl << be_nl
+ << node->name () << "::~" << node->local_name ()
+ << " (void)" << be_nl;
+ *os << "{}" << be_nl << be_nl;
+
+ bool gen_any_destructor =
+ be_global->any_support ()
+ && (!node->is_local () || be_global->gen_local_iface_anyops ());
+
+ if (gen_any_destructor)
+ {
+ *os << "void " << be_nl
+ << node->name ()
+ << "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
+ << "{" << be_idt_nl
+ << node->local_name () << " *_tao_tmp_pointer =" << be_idt_nl
+ << "static_cast<"
+ << node->local_name () << " *> (_tao_void_pointer);" << be_uidt_nl
+ << "::CORBA::release (_tao_tmp_pointer);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+
+ if (node->has_mixed_parentage ())
+ {
+ *os << "void" << be_nl
+ << node->name () << "::_add_ref (void)" << be_nl
+ << "{" << be_idt_nl
+ << "this->::CORBA::Object::_add_ref ();"
+ << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+
+ // The _narrow method
+ if (this->gen_xxx_narrow ("narrow",
+ node) == false)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_cs::"
+ "visit_interface - "
+ "_narrow () method codegen failed\n"),
+ -1);
+ }
+
+ // The _unchecked_narrow method
+ if (this->gen_xxx_narrow ("unchecked_narrow",
+ node) == false)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_cs::"
+ "visit_interface - "
+ "_unchecked_narrow () method codegen"
+ " failed\n"),
+ -1);
+ }
+
+
+ // The _duplicate method
+ *os << node->full_name () << "_ptr" << be_nl
+ << node->full_name () << "::_duplicate ("
+ << bt->local_name ()
+ << "_ptr obj)" << be_nl
+ << "{" << 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;
+
+ // The _tao_release method
+ *os << "void" << be_nl
+ << node->full_name () << "::_tao_release ("
+ << bt->local_name ()
+ << "_ptr obj)" << be_nl
+ << "{" << be_idt_nl
+ << "::CORBA::release (obj);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+
+ // Empty implementations so the application can override or not.
+ if (node->session_component_child () == 1)
+ {
+ *os << "// These two are inherited from SessionComponent."
+ << be_nl << be_nl
+ << "void" << be_nl
+ << node->full_name () << "::ciao_preactivate ("
+ << be_idt << be_idt
+ << env_sngl_not << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "ACE_THROW_SPEC (( ::CORBA::SystemException," << be_nl
+ << " ::Components::CCMException))" << be_uidt_nl
+ << "{" << be_nl
+ << "}" << be_nl << be_nl
+ << "void" << be_nl
+ << node->full_name () << "::ciao_postactivate ("
+ << be_idt << be_idt
+ << env_sngl_not << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "ACE_THROW_SPEC (( ::CORBA::SystemException," << be_nl
+ << " ::Components::CCMException))" << be_uidt_nl
+ << "{" << be_nl
+ << "}" << be_nl << be_nl;
+ }
+
+ *os << "::CORBA::Boolean" << be_nl
+ << node->full_name () << "::_is_a (" << be_idt << be_idt_nl
+ << "const char *value";
+
+ if (node->is_local () || node->is_abstract ())
+ {
+ *os << env_not;
+ }
+ else
+ {
+ *os << env_decl;
+ }
+
+ *os << be_uidt_nl << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "if (" << be_idt << be_idt_nl;
+
+ int status =
+ node->traverse_inheritance_graph (be_interface::is_a_helper,
+ os);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_cs::"
+ "visit_interface - "
+ "_is_a method codegen failed\n"),
+ -1);
+ }
+
+ if (node->is_abstract () || node->has_mixed_parentage ())
+ {
+ *os << "!ACE_OS::strcmp (" << be_idt << be_idt_nl
+ << "value," << be_nl
+ << "\"IDL:omg.org/CORBA/AbstractBase:1.0\"" << be_uidt_nl
+ << ")";
+ }
+ else if (node->is_local ())
+ {
+ *os << "!ACE_OS::strcmp (" << be_idt << be_idt_nl
+ << "value," << be_nl
+ << "\"IDL:omg.org/CORBA/LocalObject:1.0\"" << be_uidt_nl
+ << ")";
+ }
+
+ if (node->has_mixed_parentage () || node->is_local ())
+ {
+ *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
+ << "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 true; // success using local knowledge" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "else" << be_idt_nl
+ << "{" << be_idt_nl;
+
+ if (node->is_abstract () || node->is_local ())
+ {
+ *os << "return false;" << be_uidt_nl;
+ }
+ else
+ {
+ *os << "return this->::CORBA::Object::_is_a ("
+ << be_idt << be_idt_nl
+ << "value" << env_arg << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
+ }
+
+ *os << "}" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "const char* " << node->full_name ()
+ << "::_interface_repository_id (void) const"
+ << be_nl
+ << "{" << be_idt_nl
+ << "return \"" << node->repoID ()
+ << "\";" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "::CORBA::Boolean" << be_nl;
+
+ if (node->is_local ())
+ {
+ *os << node->name () << "::marshal (TAO_OutputCDR &)" << be_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}";
+ }
+ else
+ {
+ *os << node->name () << "::marshal (TAO_OutputCDR &cdr)" << be_nl
+ << "{" << be_idt_nl
+ << "return (cdr << this);" << be_uidt_nl
+ << "}";
+ }
+
+ if (! node->is_abstract ())
+ {
+ // Smart Proxy classes.
+ if (! node->is_local () && be_global->gen_smart_proxies ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS);
+ be_visitor_interface_smart_proxy_cs isp_visitor (&ctx);
+
+ 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);
+ }
+ }
+ }
+
+ if (be_global->tc_support () && !node->home_equiv ())
+ {
+
+ be_visitor_context ctx = *this->ctx_;
+ // ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
+ TAO::be_visitor_objref_typecode tc_visitor (&ctx);
+
+ if (node->accept (&tc_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_cs::"
+ "visit_interface - "
+ "TypeCode definition failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+bool
+be_visitor_interface_cs::gen_xxx_narrow (const char *pre,
+ be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << node->full_name () << "_ptr" << be_nl
+ << node->full_name () << "::_" << pre << " ("
+ << be_idt << be_idt_nl;
+
+ if (node->is_abstract ())
+ {
+ *os << "::CORBA::AbstractBase_ptr";
+ }
+ else
+ {
+ *os << "::CORBA::Object_ptr";
+ }
+
+ *os << " _tao_objref"
+ << (node->is_local () ? env_not : env_decl)
+ << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (node->is_local ())
+ {
+ *os << "return " << node->local_name () << "::_duplicate ("
+ << be_idt << be_idt_nl
+ << "dynamic_cast<" << node->local_name () << "_ptr> (_tao_objref)"
+ << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ return true;
+ }
+ else if (be_global->gen_smart_proxies () &&
+ !node->is_abstract ())
+ {
+ *os << node->full_name () << " *proxy = 0;" << be_nl << be_nl
+ << "proxy = TAO::Narrow_Utils<"
+ << node->local_name () << ">::" << pre << " (";
+
+ *os << be_idt << be_idt_nl
+ << "_tao_objref," << be_nl
+ << "\"" << node->repoID () << "\"," << be_nl
+ << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_function_pointer" << env_arg << be_uidt_nl
+ << ");" << be_uidt << be_nl
+ << "return TAO_" << node->flat_name ()
+ << "_PROXY_FACTORY_ADAPTER::instance ()->create_proxy (proxy);"
+ << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+ else
+ {
+ *os << "return" << be_idt_nl;
+
+ if (!node->is_abstract ())
+ {
+ *os << "TAO::Narrow_Utils<"
+ << node->local_name () << ">::" << pre << " (";
+ }
+ else
+ {
+ *os << "TAO::AbstractBase_Narrow_Utils<"
+ << node->local_name () << ">::" << pre <<" (";
+ }
+
+ *os << be_idt << be_idt_nl
+ << "_tao_objref," << be_nl
+ << "\"" << node->repoID () << "\"," << be_nl
+ << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_function_pointer" << env_arg << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+
+ return true;
+}
+
+int
+be_visitor_interface_cs::gen_abstract_ops_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os)
+{
+ // If the derived interface is local, the abstract parent's operation
+ // was generated as pure virtual.
+ if (!base->is_abstract () || node->is_local ())
+ {
+ 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::"
+ "gen_abstract_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 *new_op_name =
+ (UTL_ScopedName *)node->name ()->copy ();
+ new_op_name->nconc (item_new_name);
+
+ be_operation *op = be_operation::narrow_from_decl (d);
+ UTL_ScopedName *old_op_name =
+ (UTL_ScopedName *) op->name ()->copy ();
+ op->set_name (new_op_name);
+ op->set_defined_in (node);
+ op->is_abstract (node->is_abstract ());
+
+ ctx.state (TAO_CodeGen::TAO_OPERATION_CS);
+ be_visitor_operation_cs op_visitor (&ctx);
+ op_visitor.visit_operation (op);
+
+ op->set_name (old_op_name);
+ op->set_defined_in (base);
+ op->is_abstract (base->is_abstract ());
+ }
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp
new file mode 100644
index 00000000000..d3f39e96cab
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp
@@ -0,0 +1,176 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_ih.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Interfaces in the implementation header
+//
+// = AUTHOR
+// Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_interface,
+ interface_ih,
+ "$Id$")
+
+// ************************************************************
+// Interface visitor for implementation header.
+// ************************************************************
+
+be_visitor_interface_ih::be_visitor_interface_ih (be_visitor_context *ctx)
+ : be_visitor_interface (ctx)
+{
+}
+
+be_visitor_interface_ih::~be_visitor_interface_ih (void)
+{
+}
+
+int
+be_visitor_interface_ih::visit_interface (be_interface *node)
+{
+ if (node->impl_hdr_gen () || node->imported () || node->is_abstract ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ static char namebuf [NAMEBUFSIZE];
+
+
+ ACE_OS::memset (namebuf,
+ '\0',
+ NAMEBUFSIZE);
+
+ // Generate the skeleton class name.
+
+ ACE_OS::sprintf (namebuf, "%s", node->flat_name ());
+
+ if (be_global->gen_impl_debug_info ())
+ {
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ }
+
+ // Now generate the class definition.
+ *os << "class " << be_global->stub_export_macro ()
+ << " " << be_global->impl_class_prefix () << namebuf
+ << be_global->impl_class_suffix () << be_idt_nl << ": public virtual ";
+
+ // Inherit from the base skeleton name, unless the interface
+ // is local.
+ if (node->is_local ())
+ {
+ *os << node->full_name ();
+ }
+ else
+ {
+ *os << node->full_skel_name ();
+ }
+
+ if (node->is_local ())
+ {
+ *os << "," << be_idt_nl
+ << "public virtual TAO_Local_RefCounted_Object"
+ << be_uidt;
+ }
+
+ *os << be_uidt_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl
+ << "// Constructor " << be_nl
+ << be_global->impl_class_prefix () << namebuf
+ << be_global->impl_class_suffix () << " (void);" << be_nl << be_nl;
+
+ if (be_global->gen_copy_ctor () && !node->is_local ())
+ {
+ *os << "// Copy Constructor"<<be_nl
+ << be_global->impl_class_prefix () << namebuf
+ << be_global->impl_class_suffix () << " (const "
+ << be_global->impl_class_prefix () << namebuf
+ << be_global->impl_class_suffix () << "&);" <<be_nl <<be_nl;
+ }
+
+ if (be_global->gen_assign_op ())
+ {
+ *os << "// Copy Assignment" << be_nl
+ << be_global->impl_class_prefix () << namebuf
+ << be_global->impl_class_suffix () << "& " << "operator=(const "
+ << be_global->impl_class_prefix () << namebuf
+ << be_global->impl_class_suffix () << "&);" << be_nl << be_nl;
+
+ }
+
+ *os << "// Destructor " << be_nl
+ << "virtual " << "~" << be_global->impl_class_prefix () << namebuf
+ << be_global->impl_class_suffix () << " (void);";
+
+
+ // Generate code for elements in the scope (e.g., operations).
+ if (this->visit_scope (node) == -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
+ );
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_tie_sh_ss::"
+ "visit_interface - "
+ "traversal of inhertance graph failed\n"),
+ -1);
+ }
+
+
+ *os << be_uidt_nl
+ << "};" << be_nl << be_nl;
+
+ return 0;
+}
+
+
+// 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)
+{
+
+ if (strcmp (derived->flat_name (), node->flat_name ()) != 0)
+ {
+ be_visitor_context ctx;
+ ctx.state (TAO_CodeGen::TAO_ROOT_IH);
+ ctx.interface (derived);
+ ctx.stream (os);
+ be_visitor_interface_ih visitor (&ctx);
+
+ if (visitor.visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_is::"
+ "method_helper\n"),
+ -1);
+ }
+ }
+
+ 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
new file mode 100644
index 00000000000..a7579c1a921
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp
@@ -0,0 +1,196 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_is.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Interfaces in the implementation skeletons file.
+//
+// = AUTHOR
+// Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
+//
+// ============================================================================
+
+// ************************************************************
+// Interface visitor for implementation skeletons.
+// ************************************************************
+
+ACE_RCSID (be_visitor_interface,
+ interface_is,
+ "$Id$")
+
+be_visitor_interface_is::be_visitor_interface_is (be_visitor_context *ctx)
+ : be_visitor_interface (ctx)
+{
+}
+
+be_visitor_interface_is::~be_visitor_interface_is (void)
+{
+}
+
+int
+be_visitor_interface_is::visit_interface (be_interface *node)
+{
+ if (node->impl_skel_gen () || node->imported () || node->is_abstract ())
+ {
+ return 0;
+ }
+
+ this->ctx_->interface (node);
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Generate the skeleton class name.
+
+ if (be_global->gen_impl_debug_info ())
+ {
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ }
+
+ *os << "// Implementation skeleton constructor" << be_nl;
+
+ // 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 ()
+ << be_global->impl_class_suffix ()
+ << " (void)" << be_nl;
+
+ *os << "{" << be_nl
+ << "}" << be_nl << be_nl;
+
+ os->indent ();
+ *os << "// Implementation skeleton destructor" << be_nl;
+
+ *os << be_global->impl_class_prefix () << node->flat_name ()
+ << be_global->impl_class_suffix () <<"::~"
+ << be_global->impl_class_prefix () << node->flat_name ()
+ << be_global->impl_class_suffix ()
+ << " (void)" << be_nl;
+
+ *os << "{" <<be_nl;
+ *os << "}" << be_nl << be_nl;
+
+ if (be_global->gen_copy_ctor () && !node->is_local ())
+ {
+ *os << "//Implementation Skeleton Copy Constructor" << be_nl;
+
+ *os << be_global->impl_class_prefix () << node->flat_name ()
+ << be_global->impl_class_suffix () <<"::"
+ << be_global->impl_class_prefix () << node->flat_name ()
+ << be_global->impl_class_suffix () << " (const "
+ << be_global->impl_class_prefix () << node->flat_name ()
+ << be_global->impl_class_suffix () << "& rhs)" << be_idt_nl
+ << ": TAO_Abstract_ServantBase (rhs)," << be_nl
+ << " TAO_ServantBase (rhs)";
+
+ if (node->traverse_inheritance_graph (be_interface::copy_ctor_helper,
+ os)
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_is::visit_interface - "
+ " copy ctor generation failed\n"),
+ -1);
+ }
+
+ if (!node->is_local ())
+ {
+ *os << "," << be_nl;
+
+ if (node->is_nested ())
+ {
+ be_decl *scope;
+ scope = be_scope::narrow_from_scope (node->defined_in ())->decl ();
+
+ *os << " POA_" << scope->name () << "::"
+ << node->local_name () << " (rhs)";
+ }
+ else
+ {
+ *os << " " << node->full_skel_name () << " (rhs)";
+ }
+ }
+
+ *os << be_uidt_nl
+ << "{" << be_nl
+ << "}" << be_nl << be_uidt_nl;
+ }
+
+ if (be_global->gen_assign_op ())
+ {
+ *os << "//Implementation Skeleton Copy Assignment" << be_nl;
+
+ *os << be_global->impl_class_prefix () << node->flat_name ()
+ << be_global->impl_class_suffix () << "& "
+ << be_global->impl_class_prefix () << node->flat_name ()
+ << be_global->impl_class_suffix () << "::operator=(const "
+ << be_global->impl_class_prefix () << node->flat_name ()
+ << be_global->impl_class_suffix () << "& t)" <<be_idt_nl
+ << "{" << be_idt_nl
+ << "return *this;" << be_uidt_nl
+ << "}" << be_nl << be_uidt_nl;
+ }
+
+ // Generate code for elements in the scope (e.g., operations).
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ss::"
+ "visit_interface - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ int status =
+ node->traverse_inheritance_graph (
+ be_visitor_interface_is::method_helper,
+ os
+ );
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "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.
+int
+be_visitor_interface_is::method_helper (be_interface *derived,
+ be_interface *node,
+ TAO_OutStream *os)
+{
+ if (ACE_OS::strcmp (derived->flat_name (), node->flat_name ()) != 0)
+ {
+ be_visitor_context ctx;
+ ctx.state (TAO_CodeGen::TAO_ROOT_IS);
+ ctx.interface (derived);
+ ctx.stream (os);
+ be_visitor_interface_is visitor (&ctx);
+
+ if (visitor.visit_scope (node) == -1)
+
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_is::"
+ "method_helper\n"),
+ -1);
+ }
+
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp
new file mode 100644
index 00000000000..82a0472a7ed
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp
@@ -0,0 +1,406 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_sh.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Interfaces in the server header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_interface,
+ interface_sh,
+ "$Id$")
+
+// ************************************************************
+// Interface visitor for server header.
+// ************************************************************
+
+be_visitor_interface_sh::be_visitor_interface_sh (be_visitor_context *ctx)
+ : be_visitor_interface (ctx)
+{
+}
+
+be_visitor_interface_sh::~be_visitor_interface_sh (void)
+{
+}
+
+int
+be_visitor_interface_sh::visit_interface (be_interface *node)
+{
+ 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.
+ be_visitor_amh_rh_interface_sh amh_rh_intf (this->ctx_);
+ amh_rh_intf.visit_interface (node);
+ }
+
+ return 0;
+ }
+
+ if (this->generate_amh_classes (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_sh::"
+ "visit_interface - "
+ "codegen for AMH classes failed\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ 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 << be_nl << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Generate the skeleton class name.
+ *os << be_nl << be_nl
+ << "class " << class_name.c_str () << ";" << be_nl;
+
+ // Generate the _ptr declaration.
+ *os << "typedef " << class_name.c_str () << " *" << class_name.c_str ()
+ << "_ptr;";
+
+
+ if (be_global->gen_direct_collocation ())
+ {
+ *os << be_nl << be_nl
+ << "class " << node->direct_proxy_impl_name () << ";" << be_nl
+ << "class " << node->strategized_proxy_broker_name () << ";";
+ }
+
+ // Now generate the class definition.
+ *os << be_nl << be_nl
+ << "class " << be_global->skel_export_macro ()
+ << " " << class_name.c_str () << be_idt_nl << ": " << be_idt;
+
+ long n_parents = node->n_inherits ();
+ AST_Interface *parent = 0;
+ int has_concrete_parent = 0;
+
+ for (int i = 0; i < n_parents; ++i)
+ {
+ parent = node->inherits ()[i];
+
+ if (parent->is_abstract ())
+ {
+ continue;
+ }
+
+ if (has_concrete_parent == 1)
+ {
+ *os << "," << be_nl;
+ }
+
+ *os << "public virtual " << "POA_"
+ << parent->name ();
+
+ has_concrete_parent = 1;
+ }
+
+ if (has_concrete_parent == 0)
+ {
+ // We don't inherit from another user defined object, hence our
+ // base class is the ServantBase class.
+ *os << "public virtual PortableServer::ServantBase";
+ }
+
+ *os << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "protected:" << be_idt_nl;
+
+ // Default constructor.
+ *os << class_name.c_str () << " (void);" << be_uidt_nl << be_nl
+ << "public:" << be_idt_nl;
+
+ // Some useful typedefs.
+ *os << "// Useful for template programming." << be_nl
+ << "typedef ::" << node->name () << " _stub_type;" << be_nl
+ << "typedef ::" << node->name () << "_ptr _stub_ptr_type;" << be_nl
+ << "typedef ::" << node->name () << "_var _stub_var_type;"
+ << be_nl << be_nl;
+
+ // Copy constructor and destructor.
+ *os << class_name.c_str () << " (const "
+ << class_name.c_str () << "& rhs);" << be_nl
+ << "virtual ~" << class_name.c_str () << " (void);" << be_nl << be_nl;
+
+ if (node->is_event_consumer ())
+ {
+ *os << "// Default implementation of CIAO-specific operation," << be_nl
+ << "// overridden in derived class generated by the CIDL compiler."
+ << be_nl
+ << "virtual ::CORBA::Boolean ciao_is_substitutable ("
+ << be_idt << be_idt_nl
+ << "const char *event_repo_id" << env_dflts << be_uidt_nl
+ << ")" << be_nl
+ << "ACE_THROW_SPEC (( ::CORBA::SystemException));"
+ << be_uidt_nl << be_nl;
+ }
+
+ // _is_a
+ *os << "virtual ::CORBA::Boolean _is_a (" << be_idt << be_idt_nl
+ << "const char* logical_type_id" << env_dflts << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // Add a skeleton for our _is_a method.
+ *os << "static void _is_a_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & req," << be_nl
+ << "void * servant_upcall," << be_nl
+ << "void * servant" << env_decl << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // Add a skeleton for our _non_existent method.
+ *os << "static void _non_existent_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & req," << be_nl
+ << "void * servant_upcall," << be_nl
+ << "void * servant" << env_decl << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // Add a skeleton for our _interface method.
+ *os << "static void _interface_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & req," << be_nl
+ << "void * servant_upcall," << be_nl
+ << "void * servant" << env_decl << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // Add a skeleton for our _component method.
+ *os << "static void _component_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & req," << be_nl
+ << "void * servant_upcall," << be_nl
+ << "void * servant" << env_decl << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // Add a skeleton for our _repository_id method.
+ *os << "static void _repository_id_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & req," << be_nl
+ << "void * servant_upcall," << be_nl
+ << "void * servant" << env_decl << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+
+ // Add the dispatch method.
+ *os << "virtual void _dispatch (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & req," << be_nl
+ << "void * servant_upcall" << env_decl << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ this->this_method (node);
+
+ // The _interface_repository_id method.
+ *os << be_nl
+ << "virtual const char* _interface_repository_id "
+ << "(void) const;";
+
+ // Generate code for elements in the scope (e.g., operations).
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_sh::"
+ "visit_interface - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ // Generate skeletons for operations of our base classes. These
+ // skeletons just cast the pointer to the appropriate type
+ // before invoking the call.
+ int status =
+ node->traverse_inheritance_graph (
+ be_interface::gen_skel_helper,
+ os
+ );
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_sh::"
+ "visit_interface - "
+ "inheritance graph traversal failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl << "};";
+
+ be_visitor_context ctx (*this->ctx_);
+
+ if (be_global->gen_direct_collocation ())
+ {
+ ctx = *this->ctx_;
+ // Generate strategized proxy broker.
+ 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 strategized proxy broker class failed\n"
+ ),
+ -1
+ );
+ }
+ }
+
+ ctx = *this->ctx_;
+
+ // Generate the collocated class.
+
+ ctx = *this->ctx_;
+
+ if (be_global->gen_direct_collocation ())
+ {
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH);
+ be_visitor_interface_direct_proxy_impl_sh idpi_visitor (&ctx);
+
+ if (node->accept (&idpi_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "be_visitor_interface_sh::"
+ "visit_interface - "
+ "codegen for direct collocated class failed\n"
+ ),
+ -1
+ );
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_interface_sh::gen_abstract_ops_helper (
+ be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os
+ )
+{
+ if (!base->is_abstract ())
+ {
+ return 0;
+ }
+
+ AST_Decl *d = 0;
+ be_visitor_context ctx;
+ ctx.stream (os);
+ ctx.state (TAO_CodeGen::TAO_ROOT_SH);
+
+ 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_sh::"
+ "gen_abstract_ops_helper - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ UTL_ScopedName item_new_name (d->local_name (),
+ 0);
+
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ be_operation *op = be_operation::narrow_from_decl (d);
+ be_visitor_operation_sh op_visitor (&ctx);
+ op_visitor.visit_operation (op);
+ }
+ else if (d->node_type () == AST_Decl::NT_attr)
+ {
+ AST_Attribute *attr = AST_Attribute::narrow_from_decl (d);
+ be_attribute new_attr (attr->readonly (),
+ attr->field_type (),
+ &item_new_name,
+ attr->is_local (),
+ attr->is_abstract ());
+ new_attr.set_defined_in (node);
+
+ UTL_ExceptList *get_exceptions = attr->get_get_exceptions ();
+
+ if (0 != get_exceptions)
+ {
+ new_attr.be_add_get_exceptions (get_exceptions->copy ());
+ }
+
+ UTL_ExceptList *set_exceptions = attr->get_set_exceptions ();
+
+ if (0 != set_exceptions)
+ {
+ new_attr.be_add_set_exceptions (set_exceptions->copy ());
+ }
+
+ be_visitor_attribute attr_visitor (&ctx);
+ attr_visitor.visit_attribute (&new_attr);
+ ctx.attribute (0);
+ new_attr.destroy ();
+ }
+ }
+
+ return 0;
+}
+
+void
+be_visitor_interface_sh::this_method (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Print out the _this() method.
+ *os << "::" << node->full_name () << " *_this (" << be_idt << be_idt_nl
+ << env_dflts << be_uidt_nl
+ << ");" << be_uidt << be_nl;
+}
+
+int
+be_visitor_interface_sh::generate_amh_classes (be_interface *node)
+{
+ // We have to check for any abstract ancestor until AMH is integrated
+ // with abstract interfaces. If the node itself is abstract, this
+ // visitor would not be created.
+ if (be_global->gen_amh_classes () && !node->has_mixed_parentage ())
+ {
+ 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
new file mode 100644
index 00000000000..1f140530861
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp
@@ -0,0 +1,137 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_si.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Interfaces in the server inline file
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_interface,
+ interface_si,
+ "$Id$")
+
+
+// ************************************************************************
+// Interface visitor for server inline
+// ************************************************************************
+
+be_visitor_interface_si::be_visitor_interface_si (be_visitor_context *ctx)
+ : be_visitor_interface (ctx)
+{
+}
+
+be_visitor_interface_si::~be_visitor_interface_si (void)
+{
+}
+
+int
+be_visitor_interface_si::visit_interface (be_interface *node)
+{
+ if (node->srv_inline_gen ()
+ || node->imported ()
+ || node->is_local ()
+ || node->is_abstract ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *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);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_si::visit_interface "
+ "error determining mult inheritance\n"),
+ -1);
+ }
+
+ // 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.
+ 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);
+ }
+
+ if (this->generate_amh_classes (node) == -1)
+ {
+ return -1;
+ }
+
+ if (be_global->gen_direct_collocation ())
+ {
+ status =
+ node->traverse_inheritance_graph (
+ be_interface::gen_colloc_op_defn_helper,
+ os
+ );
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_si::"
+ "visit_interface - "
+ "codegen for collocated base class "
+ "skeletons failed\n"),
+ -1);
+ }
+ }
+
+ if (be_global->gen_tie_classes ())
+ {
+ // Generate the TIE class.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_ROOT_TIE_SI);
+ ctx.stream (tao_cg->server_template_inline ());
+ be_visitor_interface_tie_si visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_sh::"
+ "visit_interface - "
+ "codegen for TIE class failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_interface_si::generate_amh_classes (be_interface *node)
+{
+ // We have to check for an abstract ancestor until AMH is integrated
+ // with abstract interfaces. If the node itself is abstract, this
+ // visitor would not be created.
+ if (be_global->gen_amh_classes () && !node->has_mixed_parentage ())
+ {
+ be_visitor_amh_interface_si amh_intf (this->ctx_);
+ return amh_intf.visit_interface (node);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
new file mode 100644
index 00000000000..7b52627a051
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
@@ -0,0 +1,1079 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_ss.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Interfaces in the server skeletons file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "global_extern.h"
+#include "ast_generator.h"
+#include "ast_string.h"
+
+
+ACE_RCSID (be_visitor_interface,
+ interface_ss,
+ "$Id$")
+
+
+// ************************************************************
+// Interface visitor for server skeletons.
+// ************************************************************
+
+be_visitor_interface_ss::be_visitor_interface_ss (be_visitor_context *ctx)
+ : be_visitor_interface (ctx)
+{
+}
+
+be_visitor_interface_ss::~be_visitor_interface_ss (void)
+{
+}
+
+int
+be_visitor_interface_ss::visit_interface (be_interface *node)
+{
+ if (node->srv_skel_gen () || node->imported () || node->is_abstract ())
+ {
+ return 0;
+ }
+
+ if (node->is_local ())
+ {
+ if (this->is_amh_rh_node (node))
+ {
+ // Create amh_rh_visitors.
+ be_visitor_amh_rh_interface_ss amh_rh_ss_intf (this->ctx_);
+ amh_rh_ss_intf.visit_interface (node);
+ }
+
+ return 0;
+ }
+
+ if (this->generate_amh_classes (node) == -1)
+ {
+ return -1;
+ }
+
+ 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 ();
+
+ int status = node->gen_operation_table (flat_name,
+ full_skel_name);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ss::"
+ "visit_interface - "
+ "codegen for operation table failed\n"),
+ -1);
+ }
+
+ if (this->generate_proxy_classes (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ss::"
+ "visit_interface - "
+ "codegen for proxy classes\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << 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_idt_nl;
+
+ *os << ": TAO_ServantBase ()" << be_uidt_nl;
+
+ // Default constructor body.
+ *os << "{" << be_idt_nl
+ << "this->optable_ = &tao_" << flat_name << "_optable;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // find if we are at the top scope or inside some module
+ *os << full_skel_name << "::"
+ << local_name_prefix << node_local_name << " ("
+ << "const " << local_name_prefix << node_local_name << "& rhs)";
+
+ *os << be_idt_nl
+ << ": TAO_Abstract_ServantBase (rhs)," << be_nl
+ << " TAO_ServantBase (rhs)";
+
+ if (this->generate_copy_ctor (node, os) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ss::visit_interface - "
+ " copy ctor generation failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl
+ << "{" << be_nl
+ << "}" << be_nl << be_nl;
+
+ *os << full_skel_name << "::~"
+ << local_name_prefix << node_local_name
+ << " (void)" << be_nl;
+ *os << "{" << be_nl;
+ *os << "}";
+
+ // Generate code for elements in the scope (e.g., operations).
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ss::"
+ "visit_interface - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Generate code for the _is_a skeleton.
+ {
+ be_predefined_type rt (AST_PredefinedType::PT_boolean, 0);
+ // @@ Cheat a little by placing a space before the operation name
+ // to prevent the IDL compiler from interpreting the leading
+ // underscore as an IDL escape.
+ Identifier op_name (" _is_a");
+ UTL_ScopedName scoped_name (&op_name, 0);
+ be_operation is_a (&rt,
+ AST_Operation::OP_noflags,
+ &scoped_name,
+ node->is_local (),
+ node->is_abstract ());
+ is_a.set_defined_in (node);
+
+ auto_ptr<AST_String> s (
+ idl_global->gen ()->create_string (
+ idl_global->gen ()->create_expr ((idl_uns_long) 0,
+ AST_Expression::EV_ulong)));
+
+ Identifier arg_name ("repository_id");
+ UTL_ScopedName scoped_arg_name (&arg_name, 0);
+ AST_Argument *repository_id =
+ idl_global->gen ()->create_argument (AST_Argument::dir_IN,
+ s.get (),
+ &scoped_arg_name);
+
+ is_a.be_add_argument (repository_id);
+
+ ACE_CString is_a_upcall_command_name =
+ "_is_a_" + ACE_CString (node_local_name) + "_Upcall_Command" ;
+
+ be_visitor_operation_upcall_command_ss upcall_command_visitor (this->ctx_);
+ upcall_command_visitor.visit (&is_a,
+ full_skel_name,
+ is_a_upcall_command_name.c_str ());
+
+ *os << be_nl << be_nl
+ << "void " << full_skel_name
+ << "::_is_a_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & server_request, " << be_nl
+ << "void * TAO_INTERCEPTOR (servant_upcall)," << be_nl
+ << "void * servant" << env_decl << be_uidt_nl
+ << ")" << be_uidt_nl;
+ *os << "{" << be_idt;
+
+ // Generate exception list.
+ be_visitor_operation_exceptlist_ss exception_list (this->ctx_);
+ exception_list.visit_operation (&is_a);
+
+ be_visitor_operation_ss op_visitor (this->ctx_);
+
+ *os << "TAO::SArg_Traits< ";
+
+ op_visitor.gen_arg_template_param_name (&is_a,
+ &rt,
+ os);
+
+ *os << ">::ret_val retval;";
+
+ op_visitor.gen_skel_body_arglist (&is_a,
+ os);
+
+ *os << be_nl << be_nl
+ << "TAO::Argument * const args[] =" << be_idt_nl
+ << "{" << be_idt_nl
+ << "&retval," << be_nl
+ << "&_tao_" << arg_name.get_string ()
+ << be_uidt_nl
+ << "};" << be_uidt_nl << be_nl;
+
+ *os << "static size_t const nargs = 2;" << be_nl << be_nl;
+
+ // Get the right object implementation.
+ *os << full_skel_name << " * const impl =" << be_idt_nl
+ << "static_cast<"
+ << full_skel_name << " *> (servant);"
+ << be_uidt_nl;
+
+ // Upcall_Command instantiation.
+ *os << be_nl
+ << is_a_upcall_command_name.c_str() << " command (" << be_idt_nl
+ << "impl";
+
+ if (!is_a.void_return_type ()
+ || is_a.argument_count () > 0)
+ {
+ // server_request.operation_details () will be non-zero in the
+ // thru-POA collocation case. Use them if available.
+ *os << "," << be_nl;
+
+ if (be_global->gen_thru_poa_collocation ())
+ *os << "server_request.operation_details ()," << be_nl;
+
+ *os << "args";
+ }
+
+ *os << ");" << be_uidt_nl << be_nl;
+
+ *os << "TAO::Upcall_Wrapper upcall_wrapper;" << be_nl
+ << "upcall_wrapper.upcall (server_request" << be_nl
+ << " , args" << be_nl
+ << " , nargs" << be_nl
+ << " , command"
+ << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl
+ << " , servant_upcall" << be_nl
+ << " , exceptions" << be_nl
+ << " , nexceptions"
+ << "\n#endif /* TAO_HAS_INTERCEPTORS == 1 */" << be_nl
+ << " "
+ << (be_global->use_raw_throw () ? "" : "ACE_ENV_ARG_PARAMETER")
+ << ");" << TAO_ACE_CHECK ();
+
+ this->generate_send_reply (os);
+
+ *os << be_uidt_nl
+ << "}";
+
+ is_a.destroy ();
+ rt.destroy ();
+ s.get ()->destroy ();
+ }
+
+ // Generate code for the _non_existent skeleton.
+ {
+ be_predefined_type rt (AST_PredefinedType::PT_boolean, 0);
+ // @@ Cheat a little by placing a space before the operation name
+ // to prevent the IDL compiler from interpreting the leading
+ // underscore as an IDL escape.
+ Identifier op_name (" _non_existent");
+ UTL_ScopedName scoped_name (&op_name, 0);
+ be_operation non_existent (&rt,
+ AST_Operation::OP_noflags,
+ &scoped_name,
+ node->is_local (),
+ node->is_abstract ());
+ non_existent.set_defined_in (node);
+
+ ACE_CString non_exist_upcall_command_name =
+ "_non_existent_" + ACE_CString (node_local_name) + "_Upcall_Command" ;
+
+ be_visitor_operation_upcall_command_ss upcall_command_visitor (this->ctx_);
+ upcall_command_visitor.visit (&non_existent,
+ full_skel_name,
+ non_exist_upcall_command_name.c_str ());
+
+ *os << be_nl << be_nl
+ << "void " << full_skel_name
+ << "::_non_existent_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & server_request, " << be_nl
+ << "void * TAO_INTERCEPTOR (servant_upcall)," << be_nl
+ << "void * servant" << env_decl << be_uidt_nl
+ << ")" << be_uidt_nl;
+ *os << "{" << be_idt;
+
+ // Generate exception list.
+ be_visitor_operation_exceptlist_ss exception_list (this->ctx_);
+ exception_list.visit_operation (&non_existent);
+
+ be_visitor_operation_ss op_visitor (this->ctx_);
+
+ *os << "TAO::SArg_Traits< ";
+
+ op_visitor.gen_arg_template_param_name (&non_existent,
+ &rt,
+ os);
+
+ *os << ">::ret_val retval;";
+
+ op_visitor.gen_skel_body_arglist (&non_existent,
+ os);
+
+ *os << be_nl << be_nl
+ << "TAO::Argument * const args[] =" << be_idt_nl
+ << "{" << be_idt_nl
+ << "&retval"
+ << be_uidt_nl
+ << "};" << be_uidt_nl << be_nl;
+
+ *os << "static size_t const nargs = 1;" << be_nl << be_nl;
+
+ // Get the right object implementation.
+ *os << full_skel_name << " * const impl =" << be_idt_nl
+ << "static_cast<"
+ << full_skel_name << " *> (servant);"
+ << be_uidt_nl;
+
+ // Upcall_Command instantiation.
+ *os << be_nl
+ << non_exist_upcall_command_name.c_str() << " command (" << be_idt_nl
+ << "impl";
+
+ if (!non_existent.void_return_type ()
+ || non_existent.argument_count () > 0)
+ {
+ // server_request.operation_details () will be non-zero in the
+ // thru-POA collocation case. Use them if available.
+ *os << "," << be_nl;
+
+ if (be_global->gen_thru_poa_collocation ())
+ *os << "server_request.operation_details ()," << be_nl;
+
+ *os << "args";
+ }
+
+ *os << ");" << be_uidt_nl << be_nl;
+
+ *os << "TAO::Upcall_Wrapper upcall_wrapper;" << be_nl
+ << "upcall_wrapper.upcall (server_request" << be_nl
+ << " , args" << be_nl
+ << " , nargs" << be_nl
+ << " , command"
+ << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl
+ << " , servant_upcall" << be_nl
+ << " , exceptions" << be_nl
+ << " , nexceptions"
+ << "\n#endif /* TAO_HAS_INTERCEPTORS == 1 */" << be_nl
+ << " "
+ << (be_global->use_raw_throw () ? "" : "ACE_ENV_ARG_PARAMETER")
+ << ");" << TAO_ACE_CHECK ();
+
+ this->generate_send_reply (os);
+
+ *os << be_uidt_nl
+ << "}";
+
+ non_existent.destroy ();
+ rt.destroy ();
+ }
+
+ // Generate code for the _repository_id skeleton.
+ {
+ auto_ptr<AST_String> s (
+ idl_global->gen ()->create_string (
+ idl_global->gen ()->create_expr ((idl_uns_long) 0,
+ AST_Expression::EV_ulong)));
+
+ // @@ Cheat a little by placing a space before the operation name
+ // to prevent the IDL compiler from interpreting the leading
+ // underscore as an IDL escape.
+ Identifier op_name (" _repository_id");
+ UTL_ScopedName scoped_name (&op_name, 0);
+ be_operation repository_id (s.get (),
+ AST_Operation::OP_noflags,
+ &scoped_name,
+ node->is_local (),
+ node->is_abstract ());
+ repository_id.set_defined_in (node);
+
+ ACE_CString repository_id_upcall_command_name =
+ "_repository_id_" + ACE_CString (node_local_name) + "_Upcall_Command" ;
+
+ be_visitor_operation_upcall_command_ss upcall_command_visitor (this->ctx_);
+ upcall_command_visitor.visit (&repository_id,
+ full_skel_name,
+ repository_id_upcall_command_name.c_str ());
+
+ *os << be_nl << be_nl
+ << "void " << full_skel_name
+ << "::_repository_id_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & server_request, " << be_nl
+ << "void * TAO_INTERCEPTOR (servant_upcall)," << be_nl
+ << "void * servant" << env_decl << be_uidt_nl
+ << ")" << be_uidt_nl;
+ *os << "{" << be_idt;
+
+ // Generate exception list.
+ be_visitor_operation_exceptlist_ss exception_list (this->ctx_);
+ exception_list.visit_operation (&repository_id);
+
+ be_visitor_operation_ss op_visitor (this->ctx_);
+
+ *os << "TAO::SArg_Traits< ";
+
+ op_visitor.gen_arg_template_param_name (&repository_id,
+ s.get (),
+ os);
+
+ *os << ">::ret_val retval;";
+
+ op_visitor.gen_skel_body_arglist (&repository_id,
+ os);
+
+ *os << be_nl << be_nl
+ << "TAO::Argument * const args[] =" << be_idt_nl
+ << "{" << be_idt_nl
+ << "&retval"
+ << be_uidt_nl
+ << "};" << be_uidt_nl << be_nl;
+
+ *os << "static size_t const nargs = 1;" << be_nl << be_nl;
+
+ // Get the right object implementation.
+ *os << full_skel_name << " * const impl =" << be_idt_nl
+ << "static_cast<"
+ << full_skel_name << " *> (servant);"
+ << be_uidt_nl;
+
+ // Upcall_Command instantiation.
+ *os << be_nl
+ << repository_id_upcall_command_name.c_str() << " command ("
+ << be_idt_nl << "impl";
+
+ if (!repository_id.void_return_type ()
+ || repository_id.argument_count () > 0)
+ {
+ // server_request.operation_details () will be non-zero in the
+ // thru-POA collocation case. Use them if available.
+ *os << "," << be_nl;
+
+ if (be_global->gen_thru_poa_collocation ())
+ *os << "server_request.operation_details ()," << be_nl;
+
+ *os << "args";
+ }
+
+ *os << ");" << be_uidt_nl << be_nl;
+
+ *os << "TAO::Upcall_Wrapper upcall_wrapper;" << be_nl
+ << "upcall_wrapper.upcall (server_request" << be_nl
+ << " , args" << be_nl
+ << " , nargs" << be_nl
+ << " , command"
+ << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl
+ << " , servant_upcall" << be_nl
+ << " , exceptions" << be_nl
+ << " , nexceptions"
+ << "\n#endif /* TAO_HAS_INTERCEPTORS == 1 */" << be_nl
+ << " "
+ << (be_global->use_raw_throw () ? "" : "ACE_ENV_ARG_PARAMETER")
+ << ");" << TAO_ACE_CHECK ();
+
+ this->generate_send_reply (os);
+
+ *os << be_uidt_nl
+ << "}";
+
+ repository_id.destroy ();
+ s.get ()->destroy ();
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl << be_nl
+ << "void " << full_skel_name
+ << "::_interface_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & server_request, " << be_nl
+ << "void * /* servant_upcall */," << be_nl
+ << "void * servant" << env_decl << be_uidt_nl
+ << ")" << be_uidt_nl;
+ *os << "{" << be_idt_nl;
+ *os << "TAO_IFR_Client_Adapter *_tao_adapter =" << be_idt_nl
+ << "ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance ("
+ << be_idt << be_idt_nl
+ << "TAO_ORB_Core::ifr_client_adapter_name ()" << be_uidt_nl
+ << ");" << be_uidt_nl << be_uidt_nl;
+ *os << "if (_tao_adapter == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "ACE_THROW ( ::CORBA::INTF_REPOS ( ::CORBA::OMGVMCID | 1,"
+ << be_nl
+ << " ::CORBA::COMPLETED_NO));"
+ << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+
+ // Get the right object implementation.
+ *os << full_skel_name << " * const impl =" << be_idt_nl
+ << "static_cast<"
+ << full_skel_name << " *> (servant);"
+ << be_uidt_nl;
+
+ *os << "::CORBA::InterfaceDef_ptr _tao_retval = " << be_idt_nl
+ << "impl->_get_interface ("
+ << (be_global->use_raw_throw ()
+ ? ""
+ : "ACE_ENV_SINGLE_ARG_PARAMETER")
+ << ");" << be_uidt
+ << TAO_ACE_CHECK () << be_nl << be_nl
+ << "server_request.init_reply ();" << be_nl
+ << "TAO_OutputCDR &_tao_out = *server_request.outgoing ();"
+ << be_nl << be_nl
+ << "::CORBA::Boolean const _tao_result =" << be_idt_nl
+ << "_tao_adapter->interfacedef_cdr_insert (" << be_idt << be_idt_nl
+ << "_tao_out," << be_nl
+ << "_tao_retval" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl << be_nl
+ << "_tao_adapter->dispose (_tao_retval);" << be_nl << be_nl;
+
+ *os << "if (_tao_result == false)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "ACE_THROW ( ::CORBA::MARSHAL ());" << be_uidt_nl
+ << "}" << be_uidt;
+
+ this->generate_send_reply (os);
+
+ *os << be_uidt_nl
+ << "}";
+
+
+ // Generate code for the _component skeleton.
+ {
+ be_predefined_type rt (AST_PredefinedType::PT_object, 0);
+ // @@ Cheat a little by placing a space before the operation name
+ // to prevent the IDL compiler from interpreting the leading
+ // underscore as an IDL escape.
+
+ // Yes, _get_component()
+ Identifier op_name (" _get_component");
+ UTL_ScopedName scoped_name (&op_name, 0);
+ be_operation get_component (&rt,
+ AST_Operation::OP_noflags,
+ &scoped_name,
+ node->is_local (),
+ node->is_abstract ());
+ get_component.set_defined_in (node);
+
+ ACE_CString get_component_upcall_command_name =
+ "_get_component_" + ACE_CString (node_local_name) + "_Upcall_Command" ;
+
+ be_visitor_operation_upcall_command_ss upcall_command_visitor (this->ctx_);
+ upcall_command_visitor.visit (&get_component,
+ full_skel_name,
+ get_component_upcall_command_name.c_str());
+
+ *os << be_nl << be_nl
+ << "void " << full_skel_name
+ << "::_component_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & server_request, " << be_nl
+ << "void * TAO_INTERCEPTOR (servant_upcall)," << be_nl
+ << "void * servant" << env_decl << be_uidt_nl
+ << ")" << be_uidt_nl;
+ *os << "{" << be_idt;
+
+ // Generate exception list.
+ be_visitor_operation_exceptlist_ss exception_list (this->ctx_);
+ exception_list.visit_operation (&get_component);
+
+ be_visitor_operation_ss operation_visitor (this->ctx_);
+
+ *os << "TAO::SArg_Traits< ";
+
+ operation_visitor.gen_arg_template_param_name (&get_component,
+ &rt,
+ os);
+
+ *os << ">::ret_val retval;";
+
+ *os << be_nl << be_nl
+ << "TAO::Argument * const args[] =" << be_idt_nl
+ << "{" << be_idt_nl
+ << "&retval"
+ << be_uidt_nl
+ << "};" << be_uidt_nl << be_nl;
+
+ *os << "static size_t const nargs = 1;" << be_nl << be_nl;
+
+ // Get the right object implementation.
+ *os << full_skel_name << " * const impl =" << be_idt_nl
+ << "static_cast<"
+ << full_skel_name << " *> (servant);"
+ << be_uidt_nl;
+
+ // Upcall_Command instantiation.
+ *os << be_nl
+ << get_component_upcall_command_name.c_str ()
+ << " command (" << be_idt_nl
+ << "impl";
+
+ if (!get_component.void_return_type ()
+ || get_component.argument_count () > 0)
+ {
+ // server_request.operation_details () will be non-zero in the
+ // thru-POA collocation case. Use them if available.
+ *os << "," << be_nl;
+
+ if (be_global->gen_thru_poa_collocation ())
+ *os << "server_request.operation_details ()," << be_nl;
+
+ *os << "args";
+ }
+
+ *os << ");" << be_uidt_nl << be_nl;
+
+
+ *os << "TAO::Upcall_Wrapper upcall_wrapper;" << be_nl
+ << "upcall_wrapper.upcall (server_request" << be_nl
+ << " , args" << be_nl
+ << " , nargs" << be_nl
+ << " , command"
+ << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl
+ << " , servant_upcall" << be_nl
+ << " , exceptions" << be_nl
+ << " , nexceptions"
+ << "\n#endif /* TAO_HAS_INTERCEPTORS == 1 */" << be_nl
+ << " "
+ << (be_global->use_raw_throw () ? "" : "ACE_ENV_ARG_PARAMETER")
+ << ");" << TAO_ACE_CHECK () << be_uidt_nl
+ << "}";
+
+ get_component.destroy ();
+ rt.destroy ();
+ }
+
+ // Generate code for the _is_a override.
+
+ *os << be_nl << be_nl
+ << "::CORBA::Boolean " << full_skel_name
+ << "::_is_a (" << be_idt << be_idt_nl
+ << "const char* value" << env_not << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return" << be_idt_nl
+ << "(" << be_idt_nl;
+
+ if (node->traverse_inheritance_graph (be_interface::is_a_helper, os) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ss::"
+ "visit_interface - "
+ "traversal of inhertance graph failed\n"),
+ -1);
+ }
+
+ *os << "!ACE_OS::strcmp (" << be_idt << be_idt_nl
+ << "value," << be_nl
+ << "\"IDL:omg.org/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:omg.org/CORBA/AbstractBase:1.0\"" << be_uidt_nl
+ << ")";
+ }
+
+ *os << be_uidt << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "const char* " << full_skel_name
+ << "::_interface_repository_id (void) const"
+ << be_nl;
+ *os << "{" << be_idt_nl;
+ *os << "return \"" << node->repoID () << "\";" << be_uidt_nl;
+ *os << "}";
+
+ if (node->is_event_consumer ())
+ {
+ *os << be_nl << be_nl
+ << "::CORBA::Boolean " << full_skel_name
+ << "::ciao_is_substitutable (" << be_idt << be_idt_nl
+ << "const char * /* event_repo_id */" << env_not << be_uidt_nl
+ << ")" << be_nl
+ << "ACE_THROW_SPEC (( ::CORBA::SystemException))" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return true;" << be_uidt_nl
+ << "}";
+ }
+
+ // Print out dispatch method.
+ this->dispatch_method (node);
+
+ this->this_method (node);
+
+ return 0;
+}
+
+int
+be_visitor_interface_ss::gen_abstract_ops_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os)
+{
+ if (!base->is_abstract ())
+ {
+ return 0;
+ }
+
+ AST_Decl *d = 0;
+ be_visitor_context ctx;
+ ctx.stream (os);
+ ctx.state (TAO_CodeGen::TAO_ROOT_SS);
+
+ 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::"
+ "gen_abstract_ops_helper - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ AST_Decl::NodeType nt = d->node_type ();
+
+ UTL_ScopedName *item_new_name = 0;
+ UTL_ScopedName *new_name = 0;
+
+ if (AST_Decl::NT_op == nt || AST_Decl::NT_attr == nt)
+ {
+ ACE_NEW_RETURN (item_new_name,
+ UTL_ScopedName (d->local_name ()->copy (),
+ 0),
+ -1);
+
+ new_name = (UTL_ScopedName *) node->name ()->copy ();
+ new_name->nconc (item_new_name);
+ }
+ else
+ {
+ continue;
+ }
+
+ // We pass the node's is_abstract flag to the operation
+ // constructor so we will get the right generated operation
+ // body if we are regenerating an operation from an
+ // abstract interface in a concrete interface or component.
+ if (AST_Decl::NT_op == nt)
+ {
+ be_operation *op = be_operation::narrow_from_decl (d);
+ UTL_ScopedName *old_name =
+ (UTL_ScopedName *) op->name ()->copy ();
+ op->set_name (new_name);
+ op->set_defined_in (node);
+ op->is_abstract (node->is_abstract ());
+
+ be_visitor_operation_ss op_visitor (&ctx);
+ op_visitor.visit_operation (op);
+
+ op->set_name (old_name);
+ op->set_defined_in (base);
+ op->is_abstract (base->is_abstract ());
+ }
+ else if (AST_Decl::NT_attr == nt)
+ {
+ AST_Attribute *attr = AST_Attribute::narrow_from_decl (d);
+ be_attribute new_attr (attr->readonly (),
+ attr->field_type (),
+ 0,
+ attr->is_local (),
+ attr->is_abstract ());
+ new_attr.set_defined_in (node);
+ new_attr.set_name (new_name);
+
+ UTL_ExceptList *get_exceptions = attr->get_get_exceptions ();
+
+ if (0 != get_exceptions)
+ {
+ new_attr.be_add_get_exceptions (get_exceptions->copy ());
+ }
+
+ UTL_ExceptList *set_exceptions = attr->get_set_exceptions ();
+
+ if (0 != set_exceptions)
+ {
+ new_attr.be_add_set_exceptions (set_exceptions->copy ());
+ }
+
+ be_visitor_attribute attr_visitor (&ctx);
+ attr_visitor.visit_attribute (&new_attr);
+ ctx.attribute (0);
+ new_attr.destroy ();
+ }
+ }
+
+ return 0;
+}
+
+void
+be_visitor_interface_ss::this_method (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// 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 ("
+ << (be_global->use_raw_throw () ? "void" : "ACE_ENV_SINGLE_ARG_DECL")
+ << ")" << be_nl
+ << "{" << be_idt_nl
+ << "TAO_Stub *stub = this->_create_stub ("
+ << (be_global->use_raw_throw () ? "" : "ACE_ENV_SINGLE_ARG_PARAMETER")
+ << ");"
+ << TAO_ACE_CHECK ("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
+ << "::CORBA::Boolean const _tao_opt_colloc =" << be_idt_nl
+ << "stub->servant_orb_var ()->orb_core ()->"
+ << "optimize_collocation_objects ();" << be_uidt_nl << be_nl
+ << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "tmp," << be_nl
+ << "::CORBA::Object (stub, _tao_opt_colloc, this)," << be_nl
+ << "0" << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ *os << "::CORBA::Object_var obj = tmp;" << be_nl
+ << "(void) safe_stub.release ();" << be_nl << be_nl
+ << "typedef ::" << node->name () << " STUB_SCOPED_NAME;" << be_nl
+ << "return" << be_idt_nl
+ << "TAO::Narrow_Utils<STUB_SCOPED_NAME>::unchecked_narrow ("
+ << be_idt << be_idt_nl
+ << "obj.in ()," << be_nl
+ << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_function_pointer" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}";
+}
+
+void
+be_visitor_interface_ss::generate_send_reply (TAO_OutStream *)
+{
+ // no-op for regular interfaces
+}
+
+void
+be_visitor_interface_ss::dispatch_method (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// 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
+ << "void * servant_upcall" << env_decl << be_uidt_nl
+ << ")" << be_uidt_nl;
+ *os << "{" << be_idt_nl;
+ *os << "this->synchronous_upcall_dispatch (req," << be_nl
+ << " servant_upcall," << be_nl
+ << " this" << be_nl
+ << " "
+ << (be_global->use_raw_throw () ? "" : "ACE_ENV_ARG_PARAMETER")
+ << ");"
+ << be_uidt_nl;
+ *os << "}";
+}
+
+int
+be_visitor_interface_ss::generate_amh_classes (be_interface *node)
+{
+ // We have to check for any abstract ancestor until AMH is integrated
+ // with abstract interfaces. If the node itself is abstract, this
+ // visitor would not be created.
+ if (be_global->gen_amh_classes () && !node->has_mixed_parentage ())
+ {
+ be_visitor_amh_interface_ss amh_intf (this->ctx_);
+ return amh_intf.visit_interface (node);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_interface_ss::generate_proxy_classes (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_visitor_context ctx = *this->ctx_;
+
+ // Strategized Proxy Broker Implementation.
+ if (be_global->gen_thru_poa_collocation ()
+ || be_global->gen_direct_collocation ())
+ {
+
+ // Do not generate strategized proxy broker for thru-POA case.
+ // It isn't necessary.
+ if (be_global->gen_direct_collocation ())
+ {
+ ctx = *this->ctx_;
+ be_visitor_interface_strategized_proxy_broker_ss ispb_visitor (&ctx);
+
+ if (node->accept (&ispb_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ss::"
+ "generate_proxy_classes - "
+ "codegen for Base Proxy Broker "
+ "class failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Proxy Broker Factory Function.
+ *os << be_nl << be_nl
+ << "TAO::Collocation_Proxy_Broker *" << be_nl
+ << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_function ( ::CORBA::Object_ptr)" << be_nl
+ << "{" << be_idt_nl
+ << "return";
+
+ if (be_global->gen_direct_collocation ())
+ {
+ *os << be_idt_nl
+ << "::"
+ << node->full_strategized_proxy_broker_name ()
+ << "::" <<"the"
+ << node->strategized_proxy_broker_name ()
+ << " ();" << be_uidt;
+ }
+ else
+ {
+ // @@ HACK!
+
+ // Dummy function pointer for the thru-POA case. It isn't
+ // used to call a function but it is used to determine if
+ // collocation is available.
+
+ // @todo Change the way TAO's ORB_Core detects collocation,
+ // or at least augment it so that we don't have to
+ // resort this hack.
+ *os << " reinterpret_cast<TAO::Collocation_Proxy_Broker *> (0xdead);"
+ << " // Dummy";
+ }
+
+ *os << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Proxy Broker Function Pointer Initializer.
+ *os << "int" << be_nl
+ << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_Initializer (size_t)" << be_nl
+ << "{" << be_idt_nl
+ << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_function_pointer = "
+ << be_idt_nl
+ << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_function;"
+ << be_uidt_nl
+ << be_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "static int" << be_nl
+ << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Stub_Factory_Initializer_Scarecrow =" << be_idt_nl
+ << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_Initializer (" << be_idt << be_idt_nl
+ << "reinterpret_cast<size_t> ("
+ << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_Initializer)" << be_uidt_nl
+ << ");" << be_uidt << be_uidt;
+ }
+
+ if (be_global->gen_direct_collocation ())
+ {
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS);
+ be_visitor_interface_direct_proxy_impl_ss idpi_visitor (&ctx);
+
+ if (node->accept (&idpi_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_cs::"
+ "generate_proxy_classes - "
+ "codegen for Base Proxy Broker class failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_interface_ss::generate_copy_ctor (be_interface *node,
+ TAO_OutStream *os)
+{
+ return node->traverse_inheritance_graph (be_interface::copy_ctor_helper,
+ os);
+}
+
+ACE_CString
+be_visitor_interface_ss::generate_flat_name (be_interface *node)
+{
+ return ACE_CString (node->flat_name ());
+}
+
+ACE_CString
+be_visitor_interface_ss::generate_local_name (be_interface *node)
+{
+ return ACE_CString (node->local_name ());
+}
+
+ACE_CString
+be_visitor_interface_ss::generate_full_skel_name (be_interface *node)
+{
+ return ACE_CString (node->full_skel_name ());
+}
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
new file mode 100644
index 00000000000..8b4a8415806
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/proxy_brokers_ch.cpp
@@ -0,0 +1,72 @@
+//
+// $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)
+{
+ // No-Op.
+}
+
+
+be_visitor_interface_proxy_brokers_ch::~be_visitor_interface_proxy_brokers_ch (
+ void
+ )
+{
+ // No-Op.
+}
+
+int
+be_visitor_interface_proxy_brokers_ch::visit_interface (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Generate Guards.
+
+ // Generate the class declaration.
+ *os << "// The Proxy Brokers are used by each interface to get" << be_nl
+ << "// the right proxy for performing a call. In the new " << be_nl
+ << "// collocation scheme, the proxy to be used can vary on" << be_nl
+ << "// a call by call basis." << be_nl;
+
+ // Code Generation for the proxy brokers base class.
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_interface_base_proxy_broker_ch bpb_visitor (&ctx);
+
+ if (node->accept (&bpb_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ch::"
+ "visit_interface - "
+ "codegen for Base Proxy Broker class failed\n"),
+ -1);
+ }
+
+ ctx = *this->ctx_;
+ be_visitor_interface_remote_proxy_broker_ch rpb_visitor (&ctx);
+
+ if (node->accept (&rpb_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ch::"
+ "visit_interface - "
+ "codegen for Remote Proxy Broker class failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int be_visitor_interface_proxy_brokers_ch::visit_component (
+ be_component *node
+ )
+{
+ return this->visit_interface (node);
+}
+
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
new file mode 100644
index 00000000000..ae043a1c56e
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/proxy_impls_ch.cpp
@@ -0,0 +1,72 @@
+//
+// $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 (ctx)
+{
+ // No-Op.
+}
+
+
+be_visitor_interface_proxy_impls_ch::~be_visitor_interface_proxy_impls_ch (
+ void
+ )
+{
+ // No-Op.
+}
+
+int
+be_visitor_interface_proxy_impls_ch::visit_interface (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Generate Guards.
+ *os << "// The Proxy Implementations are used by each interface to"
+ << be_nl
+ << "// perform a call. Each different implementation encapsulates"
+ << be_nl
+ << "// an invocation logic." << be_nl << be_nl;
+
+ // Code Generation for the proxy imlpementations base class.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_IMPL_CH);
+ be_visitor_interface_base_proxy_impl_ch bpi_visitor (&ctx);
+
+ if (node->accept (&bpi_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_proxy_impls_ch::"
+ "visit_interface - "
+ "codegen for Base Proxy Impl. class failed\n"),
+ -1);
+ }
+
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_IMPL_CH);
+ be_visitor_interface_remote_proxy_impl_ch rpi_visitor (&ctx);
+
+ if (node->accept (&rpi_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_proxy_impls_ch::"
+ "visit_interface - "
+ "codegen for Remote Proxy Broker class failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int be_visitor_interface_proxy_impls_ch::visit_component (
+ be_component *node
+ )
+{
+ return this->visit_interface (node);
+}
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
new file mode 100644
index 00000000000..12c8f672665
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_broker_ch.cpp
@@ -0,0 +1,94 @@
+//
+// $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 (ctx)
+{
+ // No-Op.
+}
+
+
+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
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Generate the class declaration.
+ os->indent ();
+
+ *os << 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 "
+ << node->base_proxy_broker_name () << be_uidt_nl
+ << "{" << be_nl
+ << "public: " << be_idt_nl;
+
+ // Constructor
+ *os << node->remote_proxy_broker_name () << " (void);" << be_nl << be_nl;
+
+ // Destructor
+ *os << "virtual ~" << node->remote_proxy_broker_name () << " (void);"
+ << be_nl << be_nl;
+
+ // Accessor Method
+ *os << "virtual " << node->base_proxy_impl_name () << " &"
+ << "select_proxy ("
+ << be_idt << be_idt_nl;
+
+ *os << node->local_name () << " *object" << env_decl << be_uidt_nl
+ << ");" << be_uidt_nl << be_uidt_nl;
+
+ *os << "private:" << be_idt_nl
+ << node->remote_proxy_impl_name () << " remote_proxy_impl_;"
+ << be_uidt_nl << be_nl;
+
+ *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
+ << "// interface." << be_nl
+ << "static " << node->remote_proxy_broker_name ()
+ << " *the" << node->remote_proxy_broker_name ()
+ << " (void);" << be_uidt_nl;
+
+ *os << "};" << be_nl << be_nl;
+
+ *os << "//" << be_nl
+ << "// End Remote Proxy Broker Declaration " << be_nl
+ << "///////////////////////////////////////////////////////////////////////";
+
+ return 0;
+}
+
+int be_visitor_interface_remote_proxy_broker_ch::visit_component (
+ be_component *node
+ )
+{
+ return this->visit_interface (node);
+}
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
new file mode 100644
index 00000000000..30d5a00dd13
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_broker_cs.cpp
@@ -0,0 +1,106 @@
+//
+// $Id$
+//
+
+ACE_RCSID (be_visitor_interface,
+ remote_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 (ctx)
+{
+ // No-Op.
+}
+
+
+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
+ )
+{
+ 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
+ << "// Remote & Base Proxy Broker Implementation" << be_nl
+ << "//" << be_nl << be_nl;
+
+ *os << node->full_base_proxy_broker_name () << "::"
+ << node->base_proxy_broker_name () << " (void)" << be_nl
+ << "{" << be_nl
+ << "}" << be_nl << be_nl;
+
+ *os << node->full_base_proxy_broker_name () << "::~"
+ << node->base_proxy_broker_name () << " (void)" << be_nl
+ << "{" << be_nl
+ << "}" << be_nl << be_nl;
+
+ // Generate the proxy broker factory function pointer definition.
+ *os << node->full_base_proxy_broker_name () << " * (*"
+ << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_function_pointer) ("
+ << be_idt << be_idt_nl
+ << "::CORBA::Object_ptr obj" << be_uidt_nl
+ << ") = 0;" << be_uidt_nl << be_nl;
+
+ *os << "// Factory Member function Implementation." << be_nl
+ << node->full_remote_proxy_broker_name () << " *" << be_nl
+ << node->full_remote_proxy_broker_name () << "::the"
+ << node->remote_proxy_broker_name ()
+ << " (void)" << be_nl
+ << "{" << be_idt_nl
+ << "static ::" << node->full_remote_proxy_broker_name ()
+ << " remote_proxy_broker;" << be_nl
+ << "return &remote_proxy_broker;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Ctor
+ *os << node->full_remote_proxy_broker_name () << "::"
+ << node->remote_proxy_broker_name () << " (void)" << be_nl
+ << "{" << be_nl
+ << "}" << be_nl << be_nl;
+
+ // Dtor
+ *os << node->full_remote_proxy_broker_name () << "::~"
+ << node->remote_proxy_broker_name () << " (void)" << be_nl
+ << "{" << be_nl
+ << "}" << be_nl << be_nl;
+
+ *os << node->full_base_proxy_impl_name () << "&" << be_nl
+ <<node->full_remote_proxy_broker_name () << "::"
+ << "select_proxy (" << be_idt << be_idt_nl
+ << "::" << node->full_name () << " *" << env_not << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl // idt = 1
+ << "return this->remote_proxy_impl_;"
+ << be_uidt_nl << "}";
+
+ *os << be_nl << be_nl
+ << "//" << be_nl
+ << "// End Remote & Base Proxy Broker Implementation" << be_nl
+ << "///////////////////////////////////////////////////////////////////////";
+
+ return 0;
+}
+
+int be_visitor_interface_remote_proxy_broker_cs::visit_component (
+ be_component *node
+ )
+{
+ return this->visit_interface (node);
+}
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
new file mode 100644
index 00000000000..6c83426fdee
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_impl_ch.cpp
@@ -0,0 +1,169 @@
+//
+// $Id$
+//
+
+ACE_RCSID (be_visitor_interface,
+ remote_proxy_impl_ch,
+ "$Id$")
+
+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)
+{
+ // No-Op.
+}
+
+int
+be_visitor_interface_remote_proxy_impl_ch::visit_interface (
+ be_interface *node
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl
+ << "///////////////////////////////////////////////////////////////////////"
+ << be_nl
+ << "// 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";
+
+ if (node->node_type () == AST_Decl::NT_component)
+ {
+ be_component *bc = be_component::narrow_from_decl (node);
+ AST_Component *ac_base = bc->base_component ();
+
+ if (ac_base != 0)
+ {
+ be_component *bc_base = be_component::narrow_from_decl (ac_base);
+
+ *os << "," << be_nl
+ << "public virtual "
+ << bc_base->full_remote_proxy_impl_name ();
+ }
+ }
+
+ int nparents = node->n_inherits ();
+
+ if (nparents > 0)
+ {
+ for (int i = 0; i < nparents; ++i)
+ {
+ be_interface *inherited =
+ be_interface::narrow_from_decl (node->inherits ()[i]);
+
+ if (inherited->is_abstract ())
+ {
+ continue;
+ }
+
+ *os << "," << be_nl;
+ *os << "public virtual ";
+ *os << inherited->full_remote_proxy_impl_name ();
+ }
+ }
+
+ *os << be_uidt << be_uidt_nl;
+ *os << "{" << be_nl << "public:" << be_idt_nl;
+
+ // Constructor Declaration.
+ *os << node->remote_proxy_impl_name () << " (void);"
+ << be_nl << be_nl;
+
+ // Destructor Declaration.
+ *os << "virtual ~" << node->remote_proxy_impl_name () << " (void) {}";
+
+ 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 << be_uidt_nl << "};" << be_nl;
+ *os << be_nl
+ << "//" << be_nl
+ << "// End Remote Proxy Impl. Declaration" << be_nl
+ << "///////////////////////////////////////////////////////////////////////"
+ << be_nl << be_nl;
+
+ 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);
+ be_visitor_operation_proxy_impl_xh op_visitor (&ctx);
+ op_visitor.visit_operation (&new_op);
+ }
+ }
+
+ return 0;
+}
+
+int be_visitor_interface_remote_proxy_impl_ch::visit_component (
+ be_component *node
+ )
+{
+ return this->visit_interface (node);
+}
+
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
new file mode 100644
index 00000000000..c55d08b839e
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_ch.cpp
@@ -0,0 +1,203 @@
+//
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// smart_proxy_ch.cpp
+//
+// = DESCRIPTION
+// This provides code generation for smart proxy classes for an
+// interface in the client header.
+//
+// = AUTHOR
+// Kirthika Parameswaran <kirthika@cs.wustl.edu>
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+be_visitor_interface_smart_proxy_ch::~be_visitor_interface_smart_proxy_ch (void)
+{
+}
+
+int be_visitor_interface_smart_proxy_ch::visit_interface (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ *os << be_nl << 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 ()
+ << "_Default_Proxy_Factory" << be_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl << be_nl
+ << "TAO_" << node->flat_name ()
+ << "_Default_Proxy_Factory (int permanent = 1);"
+ << be_nl
+ <<"// <permanent> signifies that the proxy factory will remain" <<be_nl
+ <<"// registered with the Proxy Factory Adapter until the program"<<be_nl
+ <<"// terminates. That is, it will be a one-shot factory for the "<<be_nl
+ <<"// interface. If this value is set to 0, then the factory will"<<be_nl
+ <<"// be unregistered after the first invocation providing the "<<be_nl
+ << "// flexibility of having a different smart proxy per object "<<be_nl
+ <<"// instead of per interface."<<be_nl<< be_nl
+ << "virtual ~TAO_" << node->flat_name ()
+ << "_Default_Proxy_Factory (void);" << be_nl << be_nl
+ << "virtual "<< node->local_name ()
+ << "_ptr create_proxy (" << be_idt << be_idt_nl
+ << node->local_name ()
+ << "_ptr proxy" << env_dflts << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "};\n\n";
+
+ *os << "class " << be_global->stub_export_macro ()<< " "
+ << "TAO_" << node->flat_name ()
+ << "_Proxy_Factory_Adapter" << be_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl << be_nl
+ << "friend class TAO_Singleton<TAO_" << node->flat_name ()
+ << "_Proxy_Factory_Adapter, TAO_SYNCH_RECURSIVE_MUTEX>;" << be_nl << be_nl
+ << "void register_proxy_factory (" << be_idt << be_idt_nl
+ << "TAO_" << node->flat_name () << "_Default_Proxy_Factory *df,"<< be_nl
+ << "int one_shot_factory = 1" << env_dflts << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl
+ << "void unregister_proxy_factory (" << be_idt << be_idt
+ << env_dflts << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl
+ << node->local_name ()
+ << "_ptr create_proxy (" << be_idt << be_idt_nl
+ << node->local_name () << "_ptr proxy" << env_dflts << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl << be_nl
+ << "protected:" << be_idt_nl
+ << "TAO_" << node->flat_name ()
+ << "_Proxy_Factory_Adapter (void);" << be_nl
+ << "~TAO_" << node->flat_name ()
+ << "_Proxy_Factory_Adapter (void);" << be_nl
+ << "TAO_" << node->flat_name ()
+ << "_Proxy_Factory_Adapter &operator= (" << be_idt << be_idt_nl
+ << "const TAO_" << node->flat_name ()
+ << "_Proxy_Factory_Adapter &" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "TAO_" << node->flat_name ()
+ << "_Default_Proxy_Factory *proxy_factory_;" << be_nl
+ << "int one_shot_factory_;" << be_nl
+ << "int disable_factory_;"<<be_nl
+ << "TAO_SYNCH_RECURSIVE_MUTEX lock_;" << be_uidt_nl
+ << "};";
+
+ *os << be_nl << be_nl
+ << "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;
+
+ *os << "class " << be_global->stub_export_macro ()<< " "
+ << "TAO_"<< node->flat_name ()
+ << "_Smart_Proxy_Base" << be_idt_nl
+ << ": public virtual "
+ << bt->nested_type_name (this->ctx_->scope ());
+
+
+ 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.
+ 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");
+ }
+ }
+ 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 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_nl
+// Another version of the above method..
+<< "virtual TAO_Stub *_stubobj (void);"
+ << be_uidt_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.
+ 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);
+ }
+
+ *os << "protected:" << be_idt_nl
+ << "::" << node->full_name ()
+ << "_ptr get_proxy (void);" << be_nl
+ << "::" << node->full_name () << "_var proxy_;"
+ << be_uidt_nl
+ << "};\n\n";
+
+ return 0;
+}
+
+int be_visitor_interface_smart_proxy_ch::visit_component (be_component *node)
+{
+ return this->visit_interface (node);
+}
+
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
new file mode 100644
index 00000000000..4c4c41b8013
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_cs.cpp
@@ -0,0 +1,359 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// smart_proxy_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for smart_proxy classes for an Interface in the
+// client proxy file.
+//
+// = AUTHOR
+// Kirthika Parameswaran <kirthika@cs.wustl.edu>
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+be_visitor_interface_smart_proxy_cs::~be_visitor_interface_smart_proxy_cs (
+ void
+ )
+{
+}
+
+int be_visitor_interface_smart_proxy_cs::visit_interface (be_interface *node)
+{
+
+ if (be_global->gen_smart_proxies ())
+ {
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ os->indent ();
+
+ // Its necessary to take care of the nested case. The smart proxy classes
+ // are in the same scope as the proxy.
+ be_decl* scope = be_scope::narrow_from_scope (node->defined_in ())->decl ();
+
+ *os << be_nl << be_nl
+ << scope->full_name ();
+
+ // Only if there exists any nesting "::" is needed!
+ if (node->is_nested ())
+ {
+ *os << "::";
+ }
+
+ *os <<"TAO_"<< node->flat_name () << "_Default_Proxy_Factory::";
+ *os << "TAO_"
+ << node->flat_name () << "_Default_Proxy_Factory (int permanent)"
+ << be_nl
+ << "{" << be_idt_nl
+ << "TAO_" << node->flat_name ()
+ << "_PROXY_FACTORY_ADAPTER::instance ()->register_proxy_factory (this, permanent);"<< be_uidt_nl
+ << "}\n\n";
+
+ os->indent ();
+
+ *os << scope->full_name ();
+
+ // Only if there exists any nesting "::" is needed!
+ if (node->is_nested ())
+ *os << "::";
+
+ *os << "TAO_"<< node->flat_name ()
+ << "_Default_Proxy_Factory::~";
+ *os <<"TAO_"
+ << node->flat_name () << "_Default_Proxy_Factory (void)"
+ << be_nl << be_uidt << be_uidt
+ << "{" << be_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << node->full_name () << "_ptr" << be_nl << be_uidt << be_uidt;
+ *os << scope->full_name ();
+
+ // Only if there exists any nesting "::" is needed!
+ if (node->is_nested ())
+ *os << "::";
+
+ *os << "TAO_" << node->flat_name ()
+ << "_Default_Proxy_Factory::create_proxy (" << be_idt << be_idt_nl
+ << "::" << node->full_name ()
+ << "_ptr proxy" << env_not << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return proxy;" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << scope->full_name ();
+
+ // Only if there exists any nesting "::" is needed!
+ if (node->is_nested ())
+ {
+ *os << "::";
+ }
+
+ *os << "TAO_" << node->flat_name () << "_Proxy_Factory_Adapter::";
+ *os << "TAO_"
+ << node->flat_name () << "_Proxy_Factory_Adapter (void)" << be_idt_nl
+ << ": proxy_factory_ (0)," << be_idt_nl
+ << "one_shot_factory_ (0)," << be_nl
+ << "disable_factory_ (0)" << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "}\n\n";
+
+ os->indent ();
+ *os << scope->full_name ();
+
+ // Only if there exists any nesting "::" is needed!
+ if (node->is_nested ())
+ {
+ *os << "::";
+ }
+
+ *os << "TAO_" << node->flat_name () << "_Proxy_Factory_Adapter::";
+ *os << "~TAO_"
+ << node->flat_name () << "_Proxy_Factory_Adapter (void)" << be_nl
+ << "{" << be_idt_nl
+ << "// Making sure the factory which the adapter"
+ << " has is destroyed with it."
+ << be_nl
+ << "if (this->proxy_factory_ != 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "delete this->proxy_factory_;" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}\n\n";
+
+ os->indent ();
+ *os << "void" << be_nl;
+ *os << scope->full_name ();
+
+ // Only if there exists any nesting "::" is needed!
+ if (node->is_nested ())
+ {
+ *os << "::";
+ }
+
+ *os << "TAO_" << node->flat_name ()
+ << "_Proxy_Factory_Adapter::register_proxy_factory (" << be_idt << be_idt_nl
+ << "TAO_" << node->flat_name ()
+ << "_Default_Proxy_Factory *df," << be_nl
+ << "int one_shot_factory" << env_decl << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << "{" << be_idt_nl
+ << "ACE_MT (" << be_idt << be_idt_nl
+ << "ACE_GUARD (" << be_idt << be_idt_nl
+ << "TAO_SYNCH_RECURSIVE_MUTEX," << be_nl
+ << "ace_mon," << be_nl
+ << "this->lock_" << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ");" <<be_uidt_nl << be_nl
+ << "// Remove any existing <proxy_factory_> and "
+ << "replace with the new one." << be_nl
+ << "this->unregister_proxy_factory ("
+ << (be_global->use_raw_throw ()
+ ? ""
+ : "ACE_ENV_SINGLE_ARG_PARAMETER")
+ << ");" << TAO_ACE_CHECK () << be_nl
+ << "this->proxy_factory_ = df;" << be_nl
+ << "this->one_shot_factory_ = one_shot_factory;" << be_uidt_nl
+ << "}\n\n";
+
+ os->indent ();
+ *os << "void" << be_nl;
+ *os << scope->full_name ();
+
+ // Only if there exists any nesting "::" is needed!
+ if (node->is_nested ())
+ *os << "::";
+
+ *os << "TAO_"<< node->flat_name ()
+ << "_Proxy_Factory_Adapter::unregister_proxy_factory ("
+ << be_idt << be_idt
+ << env_sngl_not << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "ACE_MT (" << be_idt << be_idt_nl
+ << "ACE_GUARD (" << be_idt << be_idt_nl
+ << "TAO_SYNCH_RECURSIVE_MUTEX," << be_nl
+ << "ace_mon," << be_nl
+ << "this->lock_" << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ");" <<be_uidt_nl << be_nl
+ << "if (this->one_shot_factory_ == 1)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "this->disable_factory_ = 1;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "if ("
+ << "this->one_shot_factory_ == 0 && this->proxy_factory_ != 0)"
+ << be_idt_nl
+ << "{" << be_idt_nl
+ << "delete "
+ << "this->proxy_factory_;" << be_nl
+ << "this->proxy_factory_ = 0;" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}\n\n";
+
+ os->indent ();
+ *os << node->full_name () << "_ptr" << be_nl;
+ *os << scope->full_name ();
+
+ // Only if there exists any nesting "::" is needed!
+ if (node->is_nested ())
+ *os << "::";
+
+ *os << "TAO_"<< node->flat_name ()
+ << "_Proxy_Factory_Adapter::create_proxy (" << be_idt << be_idt_nl
+ << "::" << node->full_name ()
+ << "_ptr proxy" << env_not << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << "{" << be_idt_nl
+ << "ACE_MT (ACE_GUARD_RETURN ("
+ << "TAO_SYNCH_RECURSIVE_MUTEX, ace_mon," << be_idt_nl
+ << "this->lock_, 0));" << be_uidt_nl << be_nl
+ << "// To take care of those <unchecked_narrow> methods where we " << be_nl
+ << "// want to override the smart proxy factory if there exists one." << be_nl
+ << "if (this->disable_factory_ == 1)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "this->disable_factory_ = 0;" << be_nl
+ << "return proxy;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "// Verify that an <proxy_factory_> is available else make one." << be_nl
+ << "if ("
+ <<"this->proxy_factory_ == 0)" << be_idt_nl
+ << "ACE_NEW_RETURN ("
+ << "this->proxy_factory_," << be_idt << be_idt_nl
+ << "TAO_" << node->flat_name ()
+ << "_Default_Proxy_Factory (0), " << be_nl
+ << " 0);" << be_uidt_nl << be_uidt_nl << be_uidt_nl
+ << "return "
+ << "this->proxy_factory_->create_proxy (proxy);"
+ << be_uidt << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << scope->full_name ();
+
+ // Only if there exists any nesting "::" is needed!
+ if (node->is_nested ())
+ *os << "::";
+
+ *os << "TAO_" << node->flat_name () << "_Smart_Proxy_Base::";
+ *os << "TAO_"
+ << node->flat_name () << "_Smart_Proxy_Base (void)" << be_uidt_nl
+ << "{" << be_nl
+ << "}" << be_nl << be_nl;
+
+ os->indent ();
+ *os << scope->full_name ();
+
+ // Only if there exists any nesting "::" is needed!
+ if (node->is_nested ())
+ *os << "::";
+
+ *os << "TAO_" << node->flat_name () << "_Smart_Proxy_Base::";
+ *os << "~TAO_"
+ << node->flat_name () << "_Smart_Proxy_Base (void)" <<be_nl
+ << "{" << be_nl
+ << "}\n\n";
+
+ // Implement the <stubobj> method of the base class
+ os->indent ();
+ *os << "TAO_Stub *"<<be_nl;
+ *os << scope->full_name ();
+
+ // Only if there exists any nesting "::" is needed!
+ if (node->is_nested ())
+ *os << "::";
+
+ *os << "TAO_" << node->flat_name () << "_Smart_Proxy_Base::";
+ *os << "_stubobj (void) const"<<be_nl
+ << "{" << be_idt_nl
+ << "return this->base_proxy_->_stubobj ();"<< be_uidt_nl
+ << "}"<< be_nl << be_nl;
+
+ // Implement the <stubobj> method of the base class
+ os->indent ();
+ *os << "TAO_Stub *"<<be_nl;
+ *os << scope->full_name ();
+
+ // Only if there exists any nesting "::" is needed!
+ if (node->is_nested ())
+ *os << "::";
+ *os << "TAO_" << node->flat_name () << "_Smart_Proxy_Base::";
+ *os << "_stubobj (void)"<<be_nl
+ << "{" << be_idt_nl
+ << "return this->base_proxy_->_stubobj ();"<< be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_smart_proxy_cs::"
+ "visit_scope - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+
+ os->indent ();
+
+ *os << node->full_name() << "_ptr" << be_nl;
+ *os << scope->full_name ();
+
+ // Only if there exists any nesting "::" is needed!
+ if (node->is_nested ())
+ *os << "::";
+
+ *os << "TAO_" << node->flat_name () << "_Smart_Proxy_Base::"
+ << "get_proxy (void)" << be_idt_nl
+ << be_uidt_nl;
+
+ *os << "{" << be_idt_nl
+ << "// Obtain the real proxy stored in <base_proxy_>" << be_nl
+ << "if (CORBA::is_nil (this->proxy_.in ()))" << be_idt_nl
+ << "{" << be_idt_nl
+ << " // Verify whether factory is one-shot, if so disable"<<be_nl
+ << " // factory temporarily or not else remove."<<be_nl
+ << "TAO_"<< node->flat_name ()
+ <<"_PROXY_FACTORY_ADAPTER::instance ()->unregister_proxy_factory ();"
+ << be_nl << "this->proxy_ = " << "::" << node->full_name ()
+ << "::_narrow (this->base_proxy_.in ());"
+ << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "return this->proxy_.in ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+ else
+ {
+ ACE_UNUSED_ARG (node);
+ }
+
+ return 0;
+}
+
+int be_visitor_interface_smart_proxy_cs::visit_component (
+ be_component *node
+ )
+{
+ return this->visit_interface (node);
+}
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
new file mode 100644
index 00000000000..baf3709e1b7
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_sh.cpp
@@ -0,0 +1,95 @@
+//
+// $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 (ctx)
+{
+ // No-Op.
+}
+
+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
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *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 () << be_idt_nl
+ << ": public virtual "
+ << "TAO::Collocation_Proxy_Broker" << be_uidt_nl << "{"
+ << be_nl
+ << "public: " << be_idt;
+
+ // Constructor
+ *os << be_nl
+ << node->strategized_proxy_broker_name () << " (void);";
+
+ // Destructor
+ *os << be_nl << be_nl
+ << "virtual ~" << node->strategized_proxy_broker_name () << " (void);";
+
+ *os << be_nl << be_nl
+ << "TAO::Collocation_Strategy" << be_nl
+ << "get_strategy (" << be_idt << be_idt_nl
+ << "::CORBA::Object_ptr obj" << env_decl << be_uidt_nl
+ << ")" << be_nl
+ << "ACE_THROW_SPEC (( ::CORBA::SystemException));" << be_uidt;
+
+ *os << be_nl << be_nl
+ << "void" << be_nl
+ << "dispatch (" << be_idt << be_idt_nl
+ << "::CORBA::Object_ptr obj," << be_nl
+ << "::CORBA::Object_out forward_obj," << be_nl
+ << "TAO::Argument ** args," << be_nl
+ << "int num_args," << be_nl
+ << "const char * op," << be_nl
+ << "size_t op_len," << be_nl
+ << "TAO::Collocation_Strategy strategy" << env_decl << be_uidt_nl
+ << ")" << be_nl
+ << "ACE_THROW_SPEC (( ::CORBA::Exception));";
+
+ *os << be_uidt_nl << be_nl
+ << "static " << node->strategized_proxy_broker_name ()
+ << " *" << be_nl
+ << "the" << node->strategized_proxy_broker_name ()
+ << " (void);" << be_uidt_nl;
+
+ *os << "};";
+
+ *os << be_nl << be_nl
+ << "//" << be_nl
+ << "// End Strategized Proxy Broker Declaration " << be_nl
+ << "///////////////////////////////////////////////////////////////////////"
+ << be_nl << be_nl;
+
+ return 0;
+}
+
+int be_visitor_interface_strategized_proxy_broker_sh::visit_component (
+ be_component *node
+ )
+{
+ return this->visit_interface (node);
+}
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
new file mode 100644
index 00000000000..80ce04b3f3f
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp
@@ -0,0 +1,131 @@
+//
+// $Id$
+//
+
+ACE_RCSID (be_visitor_interface,
+ strategized_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 (ctx)
+{
+ // No-Op.
+}
+
+
+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
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Generate the class declaration.
+ os->indent ();
+
+ *os << 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 ()
+ << " *" << be_nl
+ << node->full_strategized_proxy_broker_name () << "::the"
+ << node->strategized_proxy_broker_name ()
+ << " (void)" << be_nl
+ << "{" << be_idt_nl
+ << "static " << node->full_strategized_proxy_broker_name () << be_nl
+ << "strategized_proxy_broker;" << be_nl << be_nl
+ << "return &strategized_proxy_broker;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Constructor Implementation.
+ *os << node->full_strategized_proxy_broker_name () << "::"
+ << node->strategized_proxy_broker_name () << " (void)" << be_nl
+ << "{" << be_nl
+ << "}" << be_nl << be_nl;
+
+ // Destructor Implementation.
+ *os << node->full_strategized_proxy_broker_name () << "::~"
+ << node->strategized_proxy_broker_name () << " (void)" << be_nl
+ << "{" << be_nl
+ << "}" << be_nl << be_nl;
+
+ // get_strategy() impementation.
+ *os << "TAO::Collocation_Strategy" << be_nl
+ << node->full_strategized_proxy_broker_name () << "::"
+ << "get_strategy (" << be_idt << be_idt_nl
+ << "::CORBA::Object_ptr obj" << env_decl << be_uidt_nl
+ << ")" << be_nl
+ << "ACE_THROW_SPEC (( ::CORBA::SystemException))" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "TAO::Collocation_Strategy strategy =" << be_idt_nl
+ << "TAO_ORB_Core::collocation_strategy (obj"
+ << (be_global->use_raw_throw () ? "" : " ACE_ENV_ARG_PARAMETER")
+ << ");" << be_uidt
+ << TAO_ACE_CHECK ("TAO::TAO_CS_REMOTE_STRATEGY")
+ << be_nl << be_nl
+ << "return strategy;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // create_proxy implementation
+ *os << "void" << be_nl
+ << node->full_strategized_proxy_broker_name () << "::"
+ << "dispatch (" << be_idt << be_idt_nl
+ << "::CORBA::Object_ptr obj," << be_nl
+ << "::CORBA::Object_out forward_obj," << be_nl
+ << "TAO::Argument ** args," << be_nl
+ << "int num_args," << be_nl
+ << "const char * op," << be_nl
+ << "size_t op_len," << be_nl
+ << "TAO::Collocation_Strategy strategy" << env_decl << be_uidt_nl
+ << ")" << be_nl
+ << "ACE_THROW_SPEC (( ::CORBA::Exception))" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "TAO::Direct_Collocation_Upcall_Wrapper collocation_upcall_wrapper;" << be_nl
+ << "collocation_upcall_wrapper.upcall (" << be_idt_nl
+ << "obj," << be_nl
+ << "forward_obj," << be_nl
+ << "args," << be_nl
+ << "num_args," << be_nl
+ << "op," << be_nl
+ << "op_len," << be_nl
+ << "strategy" << env_arg
+ << ");" << be_uidt << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "//" << be_nl
+ << "// End Strategized Proxy Broker Implementation" << be_nl
+ << "///////////////////////////////////////////////////////////////////////";
+
+ return 0;
+}
+
+int
+be_visitor_interface_strategized_proxy_broker_ss::visit_component (
+ be_component *node
+ )
+{
+ return this->visit_interface (node);
+}
+
+void
+be_visitor_interface_strategized_proxy_broker_ss::gen_direct_operations (
+ be_interface *,
+ TAO_OutStream *
+ )
+{
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/tie_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/tie_sh.cpp
new file mode 100644
index 00000000000..d5d3c41885a
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/tie_sh.cpp
@@ -0,0 +1,186 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// tie_sh.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for TIE class for an Interface in the header
+// file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_interface,
+ tie_sh,
+ "$Id$")
+
+// ************************************************************
+// Interface visitor for server header.
+// ************************************************************
+
+be_visitor_interface_tie_sh::be_visitor_interface_tie_sh (
+ be_visitor_context *ctx
+ )
+ : be_visitor_interface (ctx)
+{
+}
+
+be_visitor_interface_tie_sh::~be_visitor_interface_tie_sh (void)
+{
+}
+
+int
+be_visitor_interface_tie_sh::visit_interface (be_interface *node)
+{
+ if (node->imported () || node->is_abstract ())
+ {
+ return 0;
+ }
+
+ static char namebuf [NAMEBUFSIZE];
+ static char tiename [NAMEBUFSIZE];
+
+ ACE_OS::memset (namebuf,
+ '\0',
+ NAMEBUFSIZE);
+ ACE_OS::memset (tiename,
+ '\0',
+ NAMEBUFSIZE);
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Generate the skeleton class name which will be used to determine the TIE
+ // class name.
+
+ // We shall have a POA_ prefix only if we are at the topmost level.
+ if (node->is_nested ())
+ {
+ ACE_OS::sprintf (namebuf,
+ "%s",
+ node->local_name ());
+ ACE_OS::sprintf (tiename,
+ "%s_tie",
+ node->local_name ());
+ }
+ else
+ {
+ // We are outermost.
+ ACE_OS::sprintf (namebuf,
+ "POA_%s",
+ node->local_name ());
+ ACE_OS::sprintf (tiename,
+ "POA_%s_tie",
+ node->local_name ());
+ }
+
+ // Now generate the class definition.
+ *os << be_nl << be_nl << "// 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;
+ *os << "{" << be_nl
+ << "public:" << be_idt_nl
+ << "/// the T& ctor" << be_nl
+ << tiename << " (T &t);" << be_nl
+ << "/// ctor taking a POA" << be_nl
+ << tiename << " (T &t, PortableServer::POA_ptr poa);" << be_nl
+ << "/// ctor taking pointer and an ownership flag" << be_nl
+ << tiename << " (T *tp, ::CORBA::Boolean release = true);" << be_nl
+ << "/// ctor with T*, ownership flag and a POA" << be_nl
+ << tiename << " (" << be_idt << be_idt_nl
+ << "T *tp," << be_nl
+ << "PortableServer::POA_ptr poa," << be_nl
+ << "::CORBA::Boolean release = true" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "/// dtor" << be_nl << be_nl
+ << "~" << tiename << " (void);" << be_nl
+ << "// TIE specific functions" << be_nl
+ << "/// return the underlying object" << be_nl
+ << "T *_tied_object (void);" << be_nl
+ << "/// set the underlying object" << be_nl
+ << "void _tied_object (T &obj);" << be_nl
+ << "/// set the underlying object and the ownership flag" << be_nl
+ << "void _tied_object (T *obj, ::CORBA::Boolean release = true);" << be_nl
+ << "/// do we own it" << be_nl
+ << "::CORBA::Boolean _is_owner (void);" << be_nl
+ << "/// set the ownership" << be_nl << be_nl
+ << "void _is_owner ( ::CORBA::Boolean b);" << be_nl
+ << "// overridden ServantBase operations" << be_nl
+ << "PortableServer::POA_ptr _default_POA (" << be_idt << be_idt
+ << env_sngl_dflts << be_uidt_nl
+ << ");" << be_uidt;
+
+ 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::"
+ "visit_interface - "
+ "traversal of inhertance graph failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl << be_nl
+ << "private:" << be_idt_nl
+ << "T *ptr_;" << be_nl
+ << "PortableServer::POA_var poa_;" << be_nl
+ << "::CORBA::Boolean rel_;" << be_nl << be_nl
+ << "// copy and assignment are not allowed" << be_nl
+ << tiename << " (const " << tiename << " &);" << be_nl
+ << "void operator= (const " << tiename << " &);" << be_uidt_nl
+ << "};";
+
+ return 0;
+}
+
+int
+be_visitor_interface_tie_sh::visit_component (be_component *node)
+{
+ return this->visit_interface (node);
+}
+
+int
+be_visitor_interface_tie_sh::method_helper (be_interface *,
+ 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_ROOT_TIE_SH);
+ ctx.stream (os);
+ be_visitor_interface_tie_sh visitor (&ctx);
+
+ if (visitor.visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_tie_sh::"
+ "method_helper\n"),
+ -1);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/tie_si.cpp b/TAO/TAO_IDL/be/be_visitor_interface/tie_si.cpp
new file mode 100644
index 00000000000..b92c0a98860
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/tie_si.cpp
@@ -0,0 +1,252 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// tie_si.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for TIE classes for the Interface node in the
+// inline file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+be_visitor_interface_tie_si::~be_visitor_interface_tie_si (void)
+{
+}
+
+int
+be_visitor_interface_tie_si::visit_interface (be_interface *node)
+{
+ if (node->srv_inline_gen ()
+ || node->imported ()
+ || node->is_abstract ())
+ {
+ return 0;
+ }
+
+ 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);
+
+ // Generate the skeleton class name which will be used to determine the TIE
+ // class name.
+
+ // We are outermost.
+ ACE_OS::sprintf (fulltiename,
+ "%s_tie",
+ node->full_skel_name ());
+
+ if (!node->is_nested ())
+ {
+ ACE_OS::sprintf (localskelname,
+ "POA_%s",
+ node->local_name ());
+ ACE_OS::sprintf (localtiename,
+ "POA_%s_tie",
+ node->local_name ());
+ }
+ else
+ {
+ ACE_OS::sprintf (localskelname,
+ "%s",
+ node->local_name ());
+ ACE_OS::sprintf (localtiename,
+ "%s_tie",
+ node->local_name ());
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "template <class T> ACE_INLINE" << be_nl
+ << fulltiename << "<T>::" << localtiename << " (T &t)" << be_nl
+ << "\t: ptr_ (&t)," << be_nl
+ << "\t poa_ (PortableServer::POA::_nil ())," << be_nl
+ << "\t rel_ (0)" << be_nl
+ << "{}" << be_nl << be_nl;
+
+ *os << "template <class T> ACE_INLINE" << be_nl
+ << fulltiename << "<T>::" << localtiename
+ << " (T &t, PortableServer::POA_ptr poa)" << be_nl
+ << "\t: ptr_ (&t)," << be_nl
+ << "\t poa_ (PortableServer::POA::_duplicate (poa))," << be_nl
+ << "\t rel_ (0)" << be_nl
+ << "{}" << be_nl << be_nl;
+
+ *os << "template <class T> ACE_INLINE" << be_nl
+ << fulltiename << "<T>::" << localtiename
+ << " (T *tp, ::CORBA::Boolean release)" << be_nl
+ << "\t: ptr_ (tp)," << be_nl
+ << "\t poa_ (PortableServer::POA::_nil ())," << be_nl
+ << "\t rel_ (release)" << be_nl
+ << "{}" << be_nl << be_nl;
+
+ *os << "template <class T> ACE_INLINE" << be_nl
+ << fulltiename << "<T>::" << localtiename
+ << " (T *tp, PortableServer::POA_ptr poa, ::CORBA::Boolean release)"
+ << be_nl
+ << "\t: ptr_ (tp)," << be_nl
+ << "\t poa_ (PortableServer::POA::_duplicate (poa))," << be_nl
+ << "\t rel_ (release)" << be_nl
+ << "{}" << be_nl << be_nl;
+
+ *os << "template <class T> ACE_INLINE" << be_nl
+ << fulltiename << "<T>::~" << localtiename << " (void)" << be_nl
+ << "{" << be_idt_nl
+ << "if (this->rel_)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "delete this->ptr_;" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "template <class T> ACE_INLINE T *" << be_nl
+ << fulltiename << "<T>::_tied_object (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return this->ptr_;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "template <class T> ACE_INLINE void" << be_nl
+ << fulltiename << "<T>::_tied_object (T &obj)" << be_nl
+ << "{" << be_idt_nl
+ << "if (this->rel_)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "delete this->ptr_;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "this->ptr_ = &obj;" << be_nl
+ << "this->rel_ = 0;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "template <class T> ACE_INLINE void" << be_nl
+ << fulltiename << "<T>::_tied_object (T *obj, "
+ << "::CORBA::Boolean release)" << be_nl
+ << "{" << be_idt_nl
+ << "if (this->rel_)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "delete this->ptr_;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "this->ptr_ = obj;" << be_nl
+ << "this->rel_ = release;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "template <class T> ACE_INLINE ::CORBA::Boolean" << be_nl
+ << fulltiename << "<T>::_is_owner (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return this->rel_;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "template <class T> ACE_INLINE void" << be_nl
+ << fulltiename << "<T>::_is_owner ( ::CORBA::Boolean b)" << be_nl
+ << "{" << be_idt_nl
+ << "this->rel_ = b;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "template <class T> ACE_INLINE "
+ << "PortableServer::POA_ptr" << be_nl
+ << fulltiename
+ << "<T>::_default_POA ("
+ << (be_global->use_raw_throw () ? "" : "ACE_ENV_SINGLE_ARG_DECL")
+ << ")" << be_nl
+ << "{" << be_idt_nl
+ << "if (! ::CORBA::is_nil (this->poa_.in ()))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return PortableServer::POA::_duplicate (this->poa_.in ());"
+ << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "return this->" << localskelname
+ << "::_default_POA ("
+ << (be_global->use_raw_throw () ? "" : "ACE_ENV_SINGLE_ARG_PARAMETER")
+ << ");" << be_uidt_nl
+ << "}";
+
+ 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::"
+ "visit_interface - "
+ "traversal of inhertance graph failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_interface_tie_si::visit_component (be_component *node)
+{
+ return this->visit_interface (node);
+}
+
+int
+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_ROOT_TIE_SI);
+ ctx.interface (derived);
+ ctx.stream (os);
+ be_visitor_interface_tie_si visitor (&ctx);
+
+ if (visitor.visit_scope (node) == -1)
+
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_tie_si::"
+ "method_helper\n"),
+ -1);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface_fwd.cpp b/TAO/TAO_IDL/be/be_visitor_interface_fwd.cpp
new file mode 100644
index 00000000000..1dc664073ea
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface_fwd.cpp
@@ -0,0 +1,39 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_interface_fwd.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Interface_Fwd
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_interface_fwd.h"
+#include "be_interface.h"
+#include "be_helper.h"
+#include "be_extern.h"
+
+#include "be_util.h"
+#include "be_module.h"
+
+#include "be_visitor_interface_fwd.h"
+#include "be_visitor_context.h"
+#include "ace/Log_Msg.h"
+
+#include "be_visitor_interface_fwd/interface_fwd_ch.cpp"
+#include "be_visitor_interface_fwd/cdr_op_ch.cpp"
+#include "be_visitor_interface_fwd/any_op_ch.cpp"
+
+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
new file mode 100644
index 00000000000..d08ba25559b
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface_fwd/any_op_ch.cpp
@@ -0,0 +1,126 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Any operators for a forward declared interface
+// in the client header.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_interface_fwd,
+ any_op_ch,
+ "$Id$")
+
+// ***************************************************************************
+// Generates Any operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_interface_fwd_any_op_ch::be_visitor_interface_fwd_any_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_interface_fwd_any_op_ch::~be_visitor_interface_fwd_any_op_ch (void)
+{
+}
+
+int
+be_visitor_interface_fwd_any_op_ch::visit_interface_fwd (
+ be_interface_fwd *node
+ )
+{
+ // Only a forward declared interface that is not defined in the same
+ // translation unit needs to have this generated here. The Any operators
+ // are needed by portable interceptor code if the interface is a
+ // parameter of an operation.
+ if (node->full_def_seen () || node->is_local ())
+ {
+ return 0;
+ }
+
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ const char *macro = this->ctx_->export_macro ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ be_module *module = 0;
+
+ if (node->is_nested () &&
+ node->defined_in ()->scope_node_type () == AST_Decl::NT_module)
+ {
+ module = be_module::narrow_from_scope (node->defined_in ());
+
+ if (0 == module)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_valuebox_any_op_ch::"
+ "visit_interface_fwd - "
+ "Error parsing nested name\n"),
+ -1);
+ }
+
+ // Some compilers handle "any" operators in a namespace
+ // corresponding to their module, others do not.
+ *os << "\n\n#if defined (ACE_ANY_OPS_USE_NAMESPACE)\n";
+
+ be_util::gen_nested_namespace_begin (os, module);
+
+ *os << macro << " void"
+ << " operator<<= ( ::CORBA::Any &, " << node->local_name ()
+ << "_ptr); // copying" << be_nl;
+ *os << macro << " void"
+ << " operator<<= ( ::CORBA::Any &, " << node->local_name ()
+ << "_ptr *); // non-copying" << be_nl;
+ *os << macro << " ::CORBA::Boolean"
+ << " operator>>= (const ::CORBA::Any &, "
+ << node->local_name () << " *&);";
+
+ be_util::gen_nested_namespace_end (os, module);
+
+ // emit #else
+ *os << "#else\n\n";
+ }
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *os << macro << " void"
+ << " operator<<= (::CORBA::Any &, " << node->name ()
+ << "_ptr); // copying" << be_nl;
+ *os << macro << " void"
+ << " operator<<= (::CORBA::Any &, " << node->name ()
+ << "_ptr *); // non-copying" << be_nl;
+ *os << macro << " ::CORBA::Boolean"
+ << " operator>>= (const ::CORBA::Any &, "
+ << node->name () << " *&);";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ if (module != 0)
+ {
+ *os << "\n\n#endif";
+ }
+
+ 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
new file mode 100644
index 00000000000..442d4bd54f0
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ch.cpp
@@ -0,0 +1,79 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for CDR operators for forward declared
+// interfaces. This uses compiled marshaling.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+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_decl (ctx)
+{
+}
+
+be_visitor_interface_fwd_cdr_op_ch::~be_visitor_interface_fwd_cdr_op_ch (void)
+{
+}
+
+int
+be_visitor_interface_fwd_cdr_op_ch::visit_interface_fwd (be_interface_fwd *node)
+{
+ // If this forward declared interface is defined later in the file,
+ // the CDR operator declaration (along with the corresponding
+ // declarations for members of the interface's scope) will be
+ // generated then.
+ if (node->full_def_seen () || node->is_local ())
+ {
+ return 0;
+ }
+
+ // No CDR operations for locality constraint interfaces.
+ if (node->cli_hdr_cdr_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean "
+ << "operator<< (TAO_OutputCDR &, const " << node->full_name ()
+ << "_ptr );" << be_nl;
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean "
+ << "operator>> (TAO_InputCDR &, "
+ << node->full_name () << "_ptr &);\n";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ node->cli_hdr_cdr_op_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface_fwd/interface_fwd_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface_fwd/interface_fwd_ch.cpp
new file mode 100644
index 00000000000..5985b56e260
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface_fwd/interface_fwd_ch.cpp
@@ -0,0 +1,61 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_fwd_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Interface_Fwd node in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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_decl (ctx)
+{
+}
+
+be_visitor_interface_fwd_ch::~be_visitor_interface_fwd_ch (void)
+{
+}
+
+// Visit the interface_fwd_ch node and its scope.
+int
+be_visitor_interface_fwd_ch::visit_interface_fwd (be_interface_fwd *node)
+{
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ AST_Interface *fd = node->full_definition ();
+ be_interface *bfd = be_interface::narrow_from_decl (fd);
+
+ // This will be a no-op if it has already been done for this node.
+ bfd->gen_var_out_seq_decls ();
+
+ // Copy the fwd helper name back to the forward declared interface node.
+ node->fwd_helper_name (bfd->fwd_helper_name ());
+
+ node->cli_hdr_gen (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_module.cpp b/TAO/TAO_IDL/be/be_visitor_module.cpp
new file mode 100644
index 00000000000..c36fb8a088f
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_module.cpp
@@ -0,0 +1,75 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_module.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Module
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_module.h"
+#include "be_constant.h"
+#include "be_enum.h"
+#include "be_exception.h"
+#include "be_native.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_valuebox.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_eventtype.h"
+#include "be_eventtype_fwd.h"
+#include "be_component.h"
+#include "be_component_fwd.h"
+#include "be_home.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_native.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_valuebox.h"
+#include "be_visitor_valuetype.h"
+#include "be_visitor_valuetype_fwd.h"
+#include "be_visitor_component.h"
+#include "be_visitor_component_fwd.h"
+#include "be_visitor_home.h"
+#include "be_visitor_context.h"
+
+#include "be_visitor_module/module.cpp"
+#include "be_visitor_module/module_ch.cpp"
+#include "be_visitor_module/module_sh.cpp"
+#include "be_visitor_module/module_ih.cpp"
+#include "be_visitor_module/any_op.cpp"
+#include "be_visitor_module/cdr_op.cpp"
+#include "be_visitor_module/serializer_op.cpp"
+
+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
new file mode 100644
index 00000000000..5819d998f17
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_module/any_op.cpp
@@ -0,0 +1,52 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Any operators for elements in the scope of
+// the Module.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_module,
+ any_op,
+ "$Id$")
+
+// ***************************************************************************
+// Module visitor for generating Any operator declarations in the client header
+// and stub
+// ***************************************************************************
+
+be_visitor_module_any_op::be_visitor_module_any_op (be_visitor_context *ctx)
+ : be_visitor_module (ctx)
+{
+}
+
+be_visitor_module_any_op::~be_visitor_module_any_op (void)
+{
+}
+
+int
+be_visitor_module_any_op::visit_module (be_module *node)
+{
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::visit_module - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_module/cdr_op.cpp b/TAO/TAO_IDL/be/be_visitor_module/cdr_op.cpp
new file mode 100644
index 00000000000..540057da455
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_module/cdr_op.cpp
@@ -0,0 +1,52 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the CDR operators for types defined in Module's
+// scope.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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
+// and stub
+// ***************************************************************************
+
+be_visitor_module_cdr_op::be_visitor_module_cdr_op (be_visitor_context *ctx)
+ : be_visitor_module (ctx)
+{
+}
+
+be_visitor_module_cdr_op::~be_visitor_module_cdr_op (void)
+{
+}
+
+int
+be_visitor_module_cdr_op::visit_module (be_module *node)
+{
+ 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);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_module/module.cpp b/TAO/TAO_IDL/be/be_visitor_module/module.cpp
new file mode 100644
index 00000000000..c366cbbb5e2
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_module/module.cpp
@@ -0,0 +1,1231 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// module.cpp
+//
+// = DESCRIPTION
+// Generic visitor generating code for Module
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_module,
+ module,
+ "$Id$")
+
+
+// ******************************************************
+// Generic Module visitor
+// ******************************************************
+
+be_visitor_module::be_visitor_module (be_visitor_context *ctx)
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_module::~be_visitor_module (void)
+{
+}
+
+int
+be_visitor_module::visit_module (be_module *node)
+{
+ if (node->nmembers () == 0)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_EMPTY_MODULE,
+ node);
+ }
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::visit_module - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+// All common visit methods for module visitor.
+
+int
+be_visitor_module::visit_constant (be_constant *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_constant_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_constant_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_constant - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_module::visit_native (be_native *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:
+ {
+ be_visitor_native_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::::"
+ "visit_native - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_module::visit_enum (be_enum *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_enum_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_enum_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_enum_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_enum_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_enum_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_enum_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ {
+ be_visitor_enum_serializer_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ be_visitor_enum_serializer_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_enum - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_module::visit_exception (be_exception *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_exception_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_exception_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_exception_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_exception_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_exception_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_exception_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_exception_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ return 0; // nothing to be done for DCPS
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_exception - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_module::visit_interface (be_interface *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 1;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ // This is the only context state involved in strategies.
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_CH);
+ break;
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_interface_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_interface_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SH:
+ {
+ be_visitor_interface_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_IH:
+ {
+ be_visitor_interface_ih visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SI:
+ {
+ be_visitor_interface_si visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SS:
+ {
+ be_visitor_interface_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_IS:
+ {
+ be_visitor_interface_is visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_interface_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_interface_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_interface_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_interface_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ return 0; // nothing to be done for DCPS
+ break;
+ }
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_interface - "
+ "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);
+ }
+
+ if (node->accept (visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_interface - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ delete visitor;
+ visitor = 0;
+
+ // Do additional code generation is necessary.
+ // Note, this call is delegated to the strategy connected to
+ // the node.
+ 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_interface - "
+ "NUL visitor\n"),
+ -1);
+ }
+
+ if (node->accept (visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_interface - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ delete visitor;
+ visitor = 0;
+ }
+
+ ctx.state (TAO_CodeGen::TAO_ROOT_CH);
+ return 0;
+}
+
+int
+be_visitor_module::visit_interface_fwd (be_interface_fwd *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_interface_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_interface_fwd_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_interface_fwd_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ {
+ return 0; // nothing to be done for DCPS
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_interface_fwd - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_module::visit_valuebox (be_valuebox *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:
+ {
+ be_visitor_valuebox_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_valuebox_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_valuebox_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_valuebox_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_valuebox_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_valuebox_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_valuebox_any_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:
+ {
+ break;
+ }
+ default:
+ return 0; // nothing to do.
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_valuebox - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_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);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_valuetype_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_valuetype_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_valuetype_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_valuetype_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_valuetype_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ return 0; // nothing to be done for DCPS
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_valuetype_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_valuetype_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SH:
+ {
+ be_visitor_valuetype_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SI:
+ {
+ be_visitor_valuetype_si visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SS:
+ {
+ be_visitor_valuetype_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to do.
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_valuetype - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+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.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_valuetype_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_valuetype_fwd_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_valuetype_fwd_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ {
+ return 0; // nothing to be done for DCPS
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_valuetype_fwd - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_module::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_module::visit_eventtype_fwd (be_eventtype_fwd *node)
+{
+ return this->visit_valuetype_fwd (node);
+}
+
+int
+be_visitor_module::visit_component (be_component *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:
+ {
+ be_visitor_component_ch visitor (&ctx);
+ // So we can pick up the abstract ops helpers.
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_CH);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_component_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_component_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_component_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_component_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ return 0; // nothing to be done for DCPS
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_component_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_component_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SH:
+ {
+ be_visitor_component_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SI:
+ {
+ be_visitor_component_si visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SS:
+ {
+ be_visitor_component_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_IH:
+ {
+ be_visitor_component_ih visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_IS:
+ {
+ be_visitor_component_is visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_component - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_component - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_module::visit_component_fwd (be_component_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:
+ {
+ be_visitor_component_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_component_fwd_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_component_fwd - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_module::visit_home (be_home *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:
+ {
+ be_visitor_home_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_home_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_home - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_module::visit_structure (be_structure *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_structure_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_structure_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_structure_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_structure_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_structure_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_structure_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_structure_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ {
+ be_visitor_structure_serializer_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ be_visitor_structure_serializer_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_structure - "
+ "failed to accept visitor\n"),
+ -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_ROOT_CH:
+ {
+ be_visitor_structure_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_structure_fwd - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_module::visit_union (be_union *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_union_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_union_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_union_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_union_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_union_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_union_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_union_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ {
+ be_visitor_union_serializer_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ be_visitor_union_serializer_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_union - "
+ "failed to accept visitor\n"),
+ -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_ROOT_CH:
+ {
+ be_visitor_union_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_union_fwd - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_module::visit_typedef (be_typedef *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_typedef_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_typedef_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_typedef_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_typedef_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_typedef_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_typedef_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_typedef_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ {
+ be_visitor_typedef_serializer_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ be_visitor_typedef_serializer_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_typedef - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp b/TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp
new file mode 100644
index 00000000000..11f1678c300
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp
@@ -0,0 +1,93 @@
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// module_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Module in the client header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_module,
+ module_ch,
+ "$Id$")
+
+// ******************************************************
+// Module visitor for client header
+// ******************************************************
+
+be_visitor_module_ch::be_visitor_module_ch (be_visitor_context *ctx)
+ : be_visitor_module (ctx)
+{
+}
+
+be_visitor_module_ch::~be_visitor_module_ch (void)
+{
+}
+
+int
+be_visitor_module_ch::visit_module (be_module *node)
+{
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ TAO_OutStream *aos = 0;
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "namespace " << node->local_name () << be_nl
+ << "{" << be_idt;
+
+ if (be_global->gen_anyop_files ())
+ {
+ aos = tao_cg->anyop_header ();
+
+ *aos << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *aos << "namespace " << node->local_name () << be_nl
+ << "{" << be_idt;
+ }
+
+ // Generate code for the module definition by traversing thru the
+ // elements of its scope. We depend on the front-end to have made sure
+ // that only legal syntactic elements appear in our scope.
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module_ch::"
+ "visit_module - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+
+ *os << be_nl
+ << "} // module " << node->name ();
+
+ if (be_global->gen_anyop_files ())
+ {
+ *aos << be_uidt_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+
+ *aos << be_nl
+ << "} // module " << node->name () << be_nl;
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_module/module_ih.cpp b/TAO/TAO_IDL/be/be_visitor_module/module_ih.cpp
new file mode 100644
index 00000000000..92eacef28aa
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_module/module_ih.cpp
@@ -0,0 +1,52 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// module_ih.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Module in the implementation header
+//
+// = AUTHOR
+// Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_module,
+ module_ih,
+ "$Id$")
+
+// ************************************************************
+// Module visitor for server header
+// ************************************************************
+
+be_visitor_module_ih::be_visitor_module_ih (be_visitor_context *ctx)
+ : be_visitor_module (ctx)
+{
+}
+
+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 ())
+ {
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module_ih::"
+ "visit_module - "
+ "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
new file mode 100644
index 00000000000..7466b7aa0f6
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_module/module_sh.cpp
@@ -0,0 +1,87 @@
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// module_sh.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Module in the server header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_module,
+ module_sh,
+ "$Id$")
+
+// ************************************************************
+// Module visitor for server header
+// ************************************************************
+
+be_visitor_module_sh::be_visitor_module_sh (be_visitor_context *ctx)
+ : be_visitor_module (ctx)
+{
+}
+
+be_visitor_module_sh::~be_visitor_module_sh (void)
+{
+}
+
+int
+be_visitor_module_sh::visit_module (be_module *node)
+{
+ // Not generated and not imported.
+ if (node->srv_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Generate the skeleton class name.
+
+ // Now generate the class definition. The prefix POA_ is prepended to our
+ // name only if we are the outermost module.
+ *os << "namespace ";
+
+ if (!node->is_nested ())
+ {
+ // We are outermost module.
+ *os << "POA_" << node->local_name () << be_nl;
+ }
+ else
+ {
+ // We are inside another module.
+ *os << node->local_name () << be_nl;
+ }
+
+ *os << "{" << be_idt_nl;
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module_sh::"
+ "visit_module - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "} // module "
+ << node->name ();
+
+ return 0;
+
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_module/serializer_op.cpp b/TAO/TAO_IDL/be/be_visitor_module/serializer_op.cpp
new file mode 100644
index 00000000000..46418fd81bb
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_module/serializer_op.cpp
@@ -0,0 +1,52 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the TAO::DCPS::Serializer operators
+// for types defined in Module's scope.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_module,
+ serializer_op,
+ "$Id: serializer_op.cpp,v 1.2 1999/05/28 02:16:43 coryan Exp ")
+
+// ***************************************************************************
+// Module visitor for generating Serializer operator declarations in the client header
+// and stub
+// ***************************************************************************
+
+be_visitor_module_serializer_op::be_visitor_module_serializer_op (be_visitor_context *ctx)
+ : be_visitor_module (ctx)
+{
+}
+
+be_visitor_module_serializer_op::~be_visitor_module_serializer_op (void)
+{
+}
+
+int
+be_visitor_module_serializer_op::visit_module (be_module *node)
+{
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module_serializer_op::visit_module - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_native.cpp b/TAO/TAO_IDL/be/be_visitor_native.cpp
new file mode 100644
index 00000000000..1f0b7a45424
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_native.cpp
@@ -0,0 +1,32 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_native.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for native
+//
+// = AUTHOR
+// Johnny Willemsen
+//
+// ============================================================================
+
+#include "be_native.h"
+#include "be_helper.h"
+#include "be_extern.h"
+
+#include "be_visitor_native.h"
+#include "be_visitor_context.h"
+
+#include "be_visitor_native/native_ch.cpp"
+
+ACE_RCSID (be,
+ be_visitor_native,
+ "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_native/native_ch.cpp b/TAO/TAO_IDL/be/be_visitor_native/native_ch.cpp
new file mode 100644
index 00000000000..b92c9828434
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_native/native_ch.cpp
@@ -0,0 +1,65 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// enum_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Native in the client header
+//
+// = AUTHOR
+// Johnny Willemsen
+//
+// ============================================================================
+
+#include "be_visitor_typecode/typecode_decl.h"
+
+ACE_RCSID (be_visitor_native,
+ native_ch,
+ "$Id$")
+
+
+// ********************************************************************
+// Visitor implementation for the Native type
+// This one for the client header file
+// ********************************************************************
+
+be_visitor_native_ch::be_visitor_native_ch (be_visitor_context *ctx)
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_native_ch::~be_visitor_native_ch (void)
+{
+}
+
+// Visit the native_ch node and its scope.
+int
+be_visitor_native_ch::visit_native (be_native *node)
+{
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ const char *node_name = node->full_name ();
+ if (ACE_OS::strcmp (node_name, "PortableServer::ServantLocator::Cookie") == 0)
+ *os << "typedef void *Cookie;" << be_nl;
+ else if (ACE_OS::strcmp (node_name, "CORBA::VoidData") == 0)
+ *os << "typedef void *VoidData;" << be_nl;
+
+ node->cli_hdr_gen (true);
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation.cpp
new file mode 100644
index 00000000000..6b5b8e35f33
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation.cpp
@@ -0,0 +1,99 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_operation.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Operation
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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_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_valuebox.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_component.h"
+#include "be_component_fwd.h"
+#include "be_eventtype.h"
+#include "be_eventtype_fwd.h"
+#include "be_home.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 "ace/Log_Msg.h"
+#include "ace/String_Base.h"
+
+#include "be_visitor_operation/operation.cpp"
+#include "be_visitor_operation/arglist.cpp"
+#include "be_visitor_operation/argument.cpp"
+#include "be_visitor_operation/argument_invoke.cpp"
+#include "be_visitor_operation/argument_marshal.cpp"
+#include "be_visitor_operation/exceptlist_cs.cpp"
+#include "be_visitor_operation/exceptlist_ss.cpp"
+#include "be_visitor_operation/operation_ch.cpp"
+#include "be_visitor_operation/operation_cs.cpp"
+#include "be_visitor_operation/operation_sh.cpp"
+#include "be_visitor_operation/operation_ih.cpp"
+#include "be_visitor_operation/operation_ss.cpp"
+#include "be_visitor_operation/operation_is.cpp"
+#include "be_visitor_operation/rettype.cpp"
+#include "be_visitor_operation/rettype_return_cs.cpp"
+#include "be_visitor_operation/tie_sh.cpp"
+#include "be_visitor_operation/tie_si.cpp"
+#include "be_visitor_operation/upcall_command_ss.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"
+
+// Collocation
+#include "be_visitor_operation/proxy_impl_xh.cpp"
+#include "be_visitor_operation/direct_proxy_impl_ss.cpp"
+
+// AMH
+#include "be_visitor_operation/amh_ss.cpp"
+#include "be_visitor_operation/amh_sh.cpp"
+#include "be_visitor_operation/amh_rh_ss.cpp"
+#include "be_visitor_operation/amh_rh_sh.cpp"
+
+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
new file mode 100644
index 00000000000..2bdca1eeb58
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_sh.cpp
@@ -0,0 +1,106 @@
+//
+// $Id$
+//
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// amh_rh_sh.cpp
+//
+// = DESCRIPTION
+// Visitor generating AMH-RH skeleton code for Operation node in the
+// skeleton header.
+//
+// = AUTHOR
+// Mayur Deshpande <mayur@ics.uci.edu>
+//
+// ============================================================================
+
+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_operation (ctx)
+{
+}
+
+be_visitor_amh_rh_operation_sh::~be_visitor_amh_rh_operation_sh (void)
+{
+}
+
+int
+be_visitor_amh_rh_operation_sh::visit_operation (be_operation *node)
+{
+ // Nothing to be done for oneway operations.
+ if (node->flags () == AST_Operation::OP_oneway)
+ {
+ return 0;
+ }
+
+ // Output stream.
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ be_interface *intf;
+ intf = this->ctx_->attribute ()
+ ? be_interface::narrow_from_scope (this->ctx_->attribute()->defined_in ())
+ : be_interface::narrow_from_scope (node->defined_in ());
+
+ if (!intf)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_amh_rh_operation_sh::"
+ "visit_operation - "
+ "bad interface scope\n"),
+ -1);
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "virtual void ";
+
+ // Step 2: Generate the method name
+ // Check if we are an attribute node in disguise.
+ if (this->ctx_->attribute ())
+ {
+ // Now check if we are a "get" or "set" operation.
+ if (node->nmembers () == 1)
+ {
+ *os << "set_";
+ }
+ else
+ {
+ *os << "get_";
+ }
+ }
+
+ *os << node->local_name();
+
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_operation_arglist visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_amh_rh_sh::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ *os << ";";
+
+ 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
new file mode 100644
index 00000000000..3983afa8dbd
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp
@@ -0,0 +1,253 @@
+//=============================================================================
+/**
+ * @file amh_rh_ss.cpp
+ *
+ * $Id$
+ *
+ * Creates code for AMH-RH operations.
+ *
+ * @author Mayur Deshpande <mayur@ics.uci.edu>
+ */
+//=============================================================================
+
+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
+ )
+ : be_visitor_operation (ctx)
+{
+}
+
+be_visitor_amh_rh_operation_ss::~be_visitor_amh_rh_operation_ss (void)
+{
+}
+
+int
+be_visitor_amh_rh_operation_ss::visit_operation (be_operation *node)
+{
+ // Nothing to be done for oneway operations.
+ if (node->flags () == AST_Operation::OP_oneway)
+ {
+ return 0;
+ }
+
+ // Output stream.
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ be_interface *intf =
+ be_interface::narrow_from_scope (node->defined_in ());
+
+ if (this->ctx_->attribute () != 0)
+ {
+ intf = be_interface::narrow_from_scope (
+ this->ctx_->attribute()->defined_in ()
+ );
+ }
+
+ if (!intf)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_amh_rh_operation_ss::"
+ "visit_operation - "
+ "bad interface scope\n"),
+ -1);
+ }
+
+ char *buf;
+ intf->compute_full_name ("TAO_", "", buf);
+ ACE_CString response_handler_implementation_name ("POA_");
+ response_handler_implementation_name += buf;
+ // buf was allocated by ACE_OS::strdup, so we need to use free instead
+ // of delete.
+ ACE_OS::free (buf);
+ buf = 0;
+
+ // Step 1 : Generate return type: always void
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "void" << be_nl
+ << response_handler_implementation_name.c_str () << "::";
+
+ // Check if we are an attribute node in disguise
+ if (this->ctx_->attribute ())
+ {
+ // now check if we are a "get" or "set" operation
+ if (node->nmembers () == 1) // set
+ {
+ *os << "_set_";
+ }
+ else
+ {
+ *os << "_get_";
+ }
+ }
+
+ *os << node->local_name ();
+
+ // Step 2 : Generate the params of the method
+ be_visitor_context ctx (*this->ctx_);
+
+ // Set the substate because response handler operations without
+ // parameters don't use the environment parameter in the body.
+ ctx.sub_state (TAO_CodeGen::TAO_AMH_RESPONSE_HANDLER_OPERATION);
+
+ be_visitor_operation_arglist visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_amh_rh_operation_ss::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ int is_an_exception_reply = 0;
+
+ // Find out if the operation is one of the *_excep() operations, the
+ // conditions are:
+ // 1) The local_name ends in _excep()
+ // 2) There is exactly one argument
+ // 3) The argument takes an implied valuetype generated from the
+ // original interface
+ // 4) The implied valuetype ends in ExceptionHolder
+ const char *last_underbar = ACE_OS::strrchr (node->full_name (), '_');
+
+ if (last_underbar != 0
+ && ACE_OS::strcmp (last_underbar, "_excep") == 0)
+ {
+ if (node->nmembers () == 1)
+ {
+ UTL_ScopeActiveIterator i (node,
+ UTL_Scope::IK_decls);
+
+ if (!i.is_done ())
+ {
+ be_argument *argument =
+ be_argument::narrow_from_decl (i.item ());
+ be_valuetype *vt =
+ be_valuetype::narrow_from_decl (argument->field_type ());
+
+ if (vt != 0
+ && vt->original_interface () == intf->original_interface ())
+ {
+ const char *last_E =
+ ACE_OS::strrchr (vt->full_name (), 'E');
+
+ if (last_E != 0
+ && ACE_OS::strcmp (last_E, "ExceptionHolder") == 0)
+ {
+ is_an_exception_reply = 1;
+ }
+ }
+ }
+ }
+ }
+
+ if (is_an_exception_reply)
+ {
+ // Remove the trailing '_excep' from the operation name, we know
+ // there is one from the checks above...
+ ACE_CString operation_name (node->local_name ()->get_string ());
+ ACE_CString::size_type const idx = operation_name.rfind ('_');
+ ACE_ASSERT (idx != ACE_CString::npos);
+ operation_name[idx] = '\0';
+
+ *os << be_nl << "{" << be_idt_nl
+ << (be_global->use_raw_throw () ? "try" : "ACE_TRY") << be_nl
+ << "{" << be_idt_nl
+ << "holder->raise_" << operation_name.c_str ()
+ << " ("
+ << (be_global->use_raw_throw ()
+ ? ""
+ : "ACE_ENV_SINGLE_ARG_PARAMETER")
+ << ");" << ace_try_check << be_uidt_nl
+ << "}" << be_nl
+ << (be_global->use_raw_throw ()
+ ? "catch ( ::CORBA::Exception& ex)"
+ : "ACE_CATCH ( ::CORBA::Exception, ex)")
+ << be_nl
+ << "{" << be_idt_nl
+ << "this->_tao_rh_send_exception (ex"
+ << (be_global->use_raw_throw () ? "" : " ACE_ENV_ARG_PARAMETER")
+ << ");" << TAO_ACE_CHECK () << be_uidt_nl
+ << "}" << ace_endtry << be_uidt_nl
+ << "}";
+ }
+ else
+ {
+ // Step 3: Generate actual code for the method
+ *os << be_nl << "{" << be_idt_nl
+ << "this->_tao_rh_init_reply ("
+ << (be_global->use_raw_throw ()
+ ? ""
+ : "ACE_ENV_SINGLE_ARG_PARAMETER")
+ << ");" << TAO_ACE_CHECK () << be_nl << be_nl;
+
+ this->marshal_params (node);
+
+ *os << be_nl
+ << "this->_tao_rh_send_reply ("
+ << (be_global->use_raw_throw ()
+ ? ""
+ : "ACE_ENV_SINGLE_ARG_PARAMETER")
+ << ");" << be_uidt_nl
+ << "}";
+ }
+
+ return 0;
+}
+
+
+int
+be_visitor_amh_rh_operation_ss::marshal_params (be_operation *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_visitor_context ctx;
+
+ // Now make sure that we have some in and inout parameters. Otherwise, there
+ // is nothing to be marshaled out.
+ if (this->has_param_type (node, AST_Argument::dir_IN) ||
+ this->has_param_type (node, AST_Argument::dir_INOUT))
+ {
+ // marshal the in and inout arguments
+ *os << "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 visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_amh_rh_operation_ss::"
+ "gen_demarshal_params - "
+ "codegen for demarshal failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl << "))" << be_nl
+ << "{" << be_idt_nl;
+
+ // If marshaling fails, raise exception.
+ if (this->gen_raise_exception (0,
+ "::CORBA::MARSHAL",
+ "") == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) gen_raise_exception failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl
+ << "}" << be_uidt_nl;
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp
new file mode 100644
index 00000000000..333063bd543
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp
@@ -0,0 +1,225 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// amh_sh.cpp
+//
+// = DESCRIPTION
+// Visitor generating AMH skeleton code for Operation node in the
+// skeleton header.
+//
+// = AUTHOR
+// Mayur Deshpande <mayur@ics.uci.edu>
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_operation,
+ amh_sh,
+ "$Id$")
+
+// ******************************************************
+// Visitor for generating AMH skeleton for "operation" in skeleton header.
+// ******************************************************
+
+be_visitor_amh_operation_sh::be_visitor_amh_operation_sh (
+ be_visitor_context *ctx
+ )
+ : be_visitor_operation (ctx)
+{
+}
+
+be_visitor_amh_operation_sh::~be_visitor_amh_operation_sh (void)
+{
+}
+
+int
+be_visitor_amh_operation_sh::visit_operation (be_operation *node)
+{
+ // If there is an argument of type "native", return immediately.
+ if (node->has_native ())
+ {
+ return 0;
+ }
+
+ // Output stream.
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ this->generate_shared_prologue (node, os, "");
+
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_args_arglist arglist_visitor (&ctx);
+ arglist_visitor.set_fixed_direction (AST_Argument::dir_IN);
+ ctx.scope (node);
+
+ for (UTL_ScopeActiveIterator i (node, UTL_Scope::IK_decls);
+ !i.is_done ();
+ i.next ())
+ {
+ be_argument *argument =
+ be_argument::narrow_from_decl (i.item ());
+
+ if (argument == 0
+ || argument->direction () == AST_Argument::dir_OUT)
+ {
+ continue;
+ }
+
+ *os << "," << be_nl;
+
+ if (arglist_visitor.visit_argument (argument) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_amh_operation_sh::"
+ "visit_operation - "
+ "codegen for upcall args failed\n"),
+ -1);
+ }
+ }
+
+ *os << env_decl << be_uidt_nl
+ << ")" << be_uidt_nl;
+
+ if (be_global->use_raw_throw ())
+ {
+ *os << "throw (";
+ }
+ else
+ {
+ *os << "ACE_THROW_SPEC ((";
+ }
+
+ *os << " ::CORBA::SystemException";
+
+ if (be_global->use_raw_throw ())
+ {
+ *os << ")";
+ }
+ else
+ {
+ *os << "))";
+ }
+
+ *os << " = 0;";
+
+ return 0;
+}
+
+int
+be_visitor_amh_operation_sh::visit_attribute (be_attribute *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->generate_shared_prologue (node, os, "_get_");
+
+ if (!be_global->exception_support ())
+ {
+ *os << env_decl;
+ }
+
+ *os << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "ACE_THROW_SPEC (( ::CORBA::SystemException)) = 0;" << be_nl;
+
+ if (node->readonly ())
+ {
+ return 0;
+ }
+
+ this->generate_shared_prologue (node, os, "_set_");
+
+ *os << "," << be_nl;
+
+ be_argument the_argument (AST_Argument::dir_IN,
+ node->field_type (),
+ node->name ());
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_args_arglist visitor (&ctx);
+
+ int status = visitor.visit_argument (&the_argument);
+
+ the_argument.destroy ();
+
+ if (-1 == status)
+ {
+ return -1;
+ }
+
+ if (!be_global->exception_support ())
+ {
+ *os << env_decl;
+ }
+
+ *os << be_uidt_nl << ")" << be_uidt_nl
+ << "ACE_THROW_SPEC (( ::CORBA::SystemException)) = 0;" << be_nl;
+
+ return 0;
+}
+
+void
+be_visitor_amh_operation_sh::generate_shared_prologue (
+ be_decl *node,
+ TAO_OutStream *os,
+ const char *skel_prefix
+ )
+{
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "static void " << skel_prefix
+ << node->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest &_tao_req," << be_nl
+ << "void *_tao_obj," << be_nl
+ << "void *_tao_servant_upcall" << env_decl << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // 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 =
+ be_interface::narrow_from_scope (node->defined_in ());
+
+ if (this->ctx_->attribute () != 0)
+ {
+ intf = be_interface::narrow_from_scope (
+ this->ctx_->attribute()->defined_in ()
+ );
+ }
+
+ if (intf == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) be_visitor_amh_operation_sh::"
+ "visit_operation - "
+ "bad interface scope\n"));
+ return;
+ }
+
+ // Step 1 : Generate return type: always void
+ *os << "virtual void ";
+
+ // Step 2: Generate the method name
+ *os << node->local_name() << " (" << be_idt << be_idt_nl;
+
+ // STEP 3: Generate the argument list with the appropriate
+ // mapping. For these we grab a visitor that generates the
+ // parameter listing. We also generate the ResponseHandler
+ // argument 'on the fly' and add it to the argument list
+
+ char *buf;
+ // @@ TODO this must be kept consistent with the code in
+ // be_visitor_interface/amh_sh.cpp
+ intf->compute_full_name ("AMH_", "ResponseHandler_ptr", buf);
+
+ *os << buf << " _tao_rh";
+ // buf was allocated by ACE_OS::strdup, so we must use free instead
+ // of delete.
+ ACE_OS::free (buf);
+ buf = 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
new file mode 100644
index 00000000000..909176025cf
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp
@@ -0,0 +1,423 @@
+//=============================================================================
+/**
+* @file amh_ss.cpp
+*
+* $Id$
+*
+* Creates code for AMH operations.
+*
+* @author Darrell Brunsch <brunsch@cs.wustl.edu>
+*/
+//=============================================================================
+
+ACE_RCSID (be_visitor_operation,
+ amh_ss,
+ "$Id$")
+
+#include "ace/SString.h"
+
+be_visitor_amh_operation_ss::be_visitor_amh_operation_ss (
+ be_visitor_context *ctx
+ )
+ : be_visitor_operation (ctx)
+{
+}
+
+be_visitor_amh_operation_ss::~be_visitor_amh_operation_ss (void)
+{
+}
+
+int
+be_visitor_amh_operation_ss::visit_operation (be_operation *node)
+{
+ // If there is an argument of type "native", return immediately.
+ if (node->has_native ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ if (this->generate_shared_prologue (node, os, "") == -1)
+ {
+ return -1;
+ }
+
+ int argument_count =
+ node->count_arguments_with_direction (AST_Argument::dir_IN
+ | AST_Argument::dir_INOUT);
+
+ if (argument_count != 0)
+ {
+ // Declare variables for arguments.
+ be_visitor_context vardecl_ctx = *this->ctx_;
+ vardecl_ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_DECL_SS);
+
+ be_visitor_args_vardecl_ss vardecl_visitor (&vardecl_ctx);
+ vardecl_visitor.set_fixed_direction (AST_Argument::dir_IN);
+
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ be_argument *argument =
+ be_argument::narrow_from_decl (si.item ());
+
+ if (argument == 0
+ || argument->direction () == AST_Argument::dir_OUT)
+ {
+ continue;
+ }
+
+ if (vardecl_visitor.visit_argument (argument) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_amh_operation_ss::"
+ "visit_operation - "
+ "codegen for return var decl failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_nl
+ << "TAO_InputCDR & _tao_in ="
+ << " *_tao_server_request.incoming ();" << be_nl << be_nl
+ << "if (!(" << be_idt << be_idt;
+
+ // Marshal each in and inout argument.
+ be_visitor_context marshal_ctx = *this->ctx_;
+ marshal_ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS);
+ marshal_ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT);
+
+ be_visitor_args_marshal_ss marshal_visitor (&marshal_ctx);
+ marshal_visitor.set_fixed_direction (AST_Argument::dir_IN);
+ int i = 0;
+
+ for (UTL_ScopeActiveIterator sj (node, UTL_Scope::IK_decls);
+ !sj.is_done ();
+ sj.next ())
+ {
+ be_argument *argument =
+ be_argument::narrow_from_decl (sj.item ());
+
+ if (argument == 0
+ || argument->direction () == AST_Argument::dir_OUT)
+ {
+ continue;
+ }
+
+ if (i++ != 0)
+ {
+ *os << " &&";
+ }
+
+ if (marshal_visitor.visit_argument (argument) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ss::"
+ "visit_operation - "
+ "codegen for demarshal failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_uidt_nl << "))" << be_nl;
+
+ // If marshaling fails, raise exception.
+ if (this->gen_raise_exception (0,
+ "::CORBA::MARSHAL",
+ "") == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) gen_raise_exception failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl;
+ }
+
+ if (this->generate_shared_section (node, os) == -1)
+ {
+ return -1;
+ }
+
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS);
+ be_visitor_args_upcall_ss visitor (&ctx);
+ visitor.set_fixed_direction (AST_Argument::dir_IN);
+
+ for (UTL_ScopeActiveIterator i (node, UTL_Scope::IK_decls);
+ !i.is_done ();)
+ {
+ be_argument *argument =
+ be_argument::narrow_from_decl (i.item ());
+
+ i.next ();
+
+ if (argument == 0
+ || argument->direction () == AST_Argument::dir_OUT)
+ {
+ continue;
+ }
+
+ *os << ",";
+
+ if (argument->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_amh_operation_ss::"
+ "visit_operation - "
+ "codegen for upcall args failed\n"),
+ -1);
+ }
+ }
+
+ *os << env_arg;
+ }
+
+ if (this->generate_shared_epilogue (os) == -1)
+ {
+ return -1;
+ }
+
+ return 0;
+
+}
+
+int
+be_visitor_amh_operation_ss::visit_attribute (be_attribute *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ if (this->generate_shared_prologue (node, os, "_get_") == -1)
+ {
+ return -1;
+ }
+
+ if (this->generate_shared_section (node, os) == -1)
+ {
+ return -1;
+ }
+
+ *os << env_arg;
+
+ if (this->generate_shared_epilogue (os) == -1)
+ {
+ return -1;
+ }
+
+ if (node->readonly ())
+ {
+ return 0;
+ }
+
+ if (this->generate_shared_prologue (node, os, "_set_") == -1)
+ {
+ return -1;
+ }
+
+ be_argument the_argument (AST_Argument::dir_IN,
+ node->field_type (),
+ node->name ());
+
+ int status = 0;
+
+ {
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_args_vardecl_ss vardecl_visitor (&ctx);
+
+ status = vardecl_visitor.visit_argument (&the_argument);
+
+ if (-1 == status)
+ {
+ the_argument.destroy ();
+ return -1;
+ }
+ }
+
+ *os << be_nl
+ << "TAO_InputCDR & _tao_in ="
+ << " *_tao_server_request.incoming ();"
+ << be_nl << be_nl
+ << "if (!(" << be_idt << be_idt;
+
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS);
+ ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT);
+ be_visitor_args_marshal_ss marshal_visitor (&ctx);
+
+ status = marshal_visitor.visit_argument (&the_argument);
+
+ if (-1 == status)
+ {
+ the_argument.destroy ();
+ return -1;
+ }
+ }
+
+ *os << be_uidt_nl << "))" << be_nl
+ << "{" << be_idt_nl;
+
+ // If marshaling fails, raise exception.
+ status = this->gen_raise_exception (0,
+ "::CORBA::MARSHAL",
+ "");
+ if (-1 == status)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) gen_raise_exception failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl
+ << "}" << be_uidt_nl;
+
+ if (-1 == this->generate_shared_section (node, os))
+ {
+ return -1;
+ }
+
+ *os << ",";
+
+ {
+ be_visitor_args_upcall_ss upcall_visitor (this->ctx_);
+ status = upcall_visitor.visit_argument (&the_argument);
+ the_argument.destroy ();
+
+ if (-1 == status)
+ {
+ return -1;
+ }
+ }
+
+ *os << env_arg;
+
+ if (-1 == this->generate_shared_epilogue (os))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_amh_operation_ss::generate_shared_prologue (be_decl *node,
+ TAO_OutStream *os,
+ const char *skel_prefix)
+{
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // 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 =
+ be_interface::narrow_from_scope (node->defined_in ());
+
+ if (intf == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ss::"
+ "visit_operation - "
+ "bad interface scope\n"),
+ -1);
+ }
+
+
+ char *buf;
+ intf->compute_full_name ("AMH_", "", buf);
+ ACE_CString amh_skel_name ("POA_");
+ amh_skel_name += buf;
+ // buf was allocated by ACE_OS::strdup, so we need to use free instead
+ // of delete.
+ ACE_OS::free (buf);
+ buf = 0;
+
+ *os << "void" << be_nl
+ << amh_skel_name.c_str () << "::"
+ << skel_prefix
+ << node->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & _tao_server_request," << be_nl
+ << "void * /* context */," << be_nl
+ << "void * _tao_servant" << env_decl << be_uidt_nl
+ << ")" << be_uidt_nl;
+
+ // Generate the actual code for the skeleton.
+ // last argument - is always ACE_ENV_ARG_PARAMETER.
+ *os << "{" << be_idt_nl;
+
+ // Get the right object implementation.
+ *os << amh_skel_name.c_str () << " * const _tao_impl =" << be_idt_nl
+ << "static_cast<" << amh_skel_name.c_str () << " *> ("
+ << "_tao_servant" << ");" << be_uidt_nl;
+
+ return 0;
+}
+
+int
+be_visitor_amh_operation_ss::generate_shared_section (be_decl *node,
+ TAO_OutStream *os)
+{
+ be_interface *intf =
+ be_interface::narrow_from_scope (node->defined_in ());
+
+ // Create the response handler
+ char *buf;
+ intf->compute_full_name ("TAO_AMH_", "ResponseHandler", buf);
+ ACE_CString response_handler_implementation_name ("POA_");
+ response_handler_implementation_name += buf;
+ // buf was allocated by ACE_OS::strdup, so we need to use free instead
+ // of delete.
+ ACE_OS::free (buf);
+ buf = 0;
+
+ *os << be_nl
+ << "TAO_ORB_Core *orb_core =" << be_idt_nl
+ << "_tao_server_request.orb ()->orb_core ();" << be_uidt_nl << be_nl
+ << "TAO_AMH_BUFFER_ALLOCATOR* amh_allocator =" << be_idt_nl
+ << "orb_core->lane_resources ().amh_response_handler_allocator ();"
+ << be_uidt_nl << be_nl
+ << "TAO::TAO_Buffer_Allocator<" << be_idt << be_idt_nl
+ << response_handler_implementation_name.c_str () << "," << be_nl
+ << "TAO_AMH_BUFFER_ALLOCATOR" << be_uidt_nl
+ << "> buffer_allocator (amh_allocator);"
+ << be_uidt_nl << be_nl
+ << response_handler_implementation_name.c_str ()
+ << "_ptr _tao_rh_ptr = "
+ << be_idt_nl
+ << "buffer_allocator.allocate();"
+ << be_uidt_nl << be_nl
+ << "if (!_tao_rh_ptr) " << be_idt_nl << "ACE_THROW ( ::CORBA::NO_MEMORY ());"
+ << be_uidt_nl;
+
+ // Initialize amh rh
+ *os << be_nl << "_tao_rh_ptr->init (_tao_server_request, amh_allocator);" << be_nl
+ << be_nl;
+
+ *os << "ACE_Utils::Auto_Functor <"
+ << response_handler_implementation_name.c_str ()
+ << ", TAO::ARH_Refcount_Functor> safe_rd_(_tao_rh_ptr);"
+ << be_nl;
+
+ // Make the upcall.
+ *os << be_nl << "_tao_impl->"
+ << node->local_name () << " (" << be_idt << be_idt_nl
+ << "safe_rd_.get ()";
+
+ return 0;
+}
+
+int
+be_visitor_amh_operation_ss::generate_shared_epilogue (TAO_OutStream *os)
+{
+ *os << be_uidt_nl << ");"
+ << be_uidt << be_uidt_nl
+ << "}";
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_ch.cpp
new file mode 100644
index 00000000000..499e8884793
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_ch.cpp
@@ -0,0 +1,111 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// ami_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating AMI stub code for Operation node in the
+// client header.
+//
+// = AUTHOR
+// Alexander Babu Arulanthu <alex@cs.wustl.edu>
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+be_visitor_operation_ami_ch::~be_visitor_operation_ami_ch (void)
+{
+}
+
+int
+be_visitor_operation_ami_ch::visit_operation (be_operation *node)
+{
+ // No sendc method for oneway operations.
+ if (node->flags () == AST_Operation::OP_oneway)
+ {
+ return 0;
+ }
+
+ // Output stream.
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Every operation is declared virtual in the client code.
+ *os << be_nl << be_nl
+ << "virtual ";
+
+ // STEP I: Return type is void.
+ *os << "void ";
+
+ // STEP 2: Generate the operation name.
+
+ // First the sendc prefix.
+ *os << "sendc_";
+
+ // 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)
+ {
+ *os << "set_";
+ }
+ else
+ {
+ *os << "get_";
+ }
+ }
+
+ *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.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_CH);
+ be_visitor_operation_arglist visitor (&ctx);
+ be_operation *arguments = node->arguments ();
+
+ // If a local node's parent has a sendc_* operation, we must
+ // regenerate it as pure virtual, so we temporarily set the
+ // strategy-related node to local, if necessary, and restore
+ // it after the visitor returns.
+ bool orig_local = arguments->is_local ();
+ arguments->set_local (node->is_local ());
+
+ if (node->arguments ()->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ami_ch::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ arguments->set_local (orig_local);
+ 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
new file mode 100644
index 00000000000..9601c14d2ca
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp
@@ -0,0 +1,319 @@
+//
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// ami_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Operation in the stubs file.
+//
+// = AUTHOR
+// Aniruddha Gokhale,
+// Alexander Babu Arulanthu <alex@cs.wustl.edu>
+// Michael Kircher
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+be_visitor_operation_ami_cs::~be_visitor_operation_ami_cs (void)
+{
+}
+
+// Processing to be done after every element in the scope is
+// processed.
+int
+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";
+ }
+
+ return 0;
+}
+
+int
+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;
+ }
+
+ be_visitor_context ctx;
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Generate the return type mapping. Return type is simply void.
+ *os << be_nl << be_nl
+ << "void" << be_nl;
+
+ // Generate the operation name.
+
+ // 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);
+ }
+
+ // Generate the scope::operation name.
+ *os << parent->full_name ()
+ << "::sendc_";
+
+ // 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)
+ {
+ *os << "set_";
+ }
+ else
+ {
+ *os << "get_";
+ }
+ }
+
+ *os << node->local_name ()->get_string ();
+
+ // Generate the argument list with the appropriate mapping (same as
+ // in the header file)
+ ctx = *this->ctx_;
+ be_visitor_operation_arglist oa_visitor (&ctx);
+
+ // Get the AMI version from the strategy class.
+ be_operation *ami_op = node->arguments ();
+
+ if (ami_op->accept (&oa_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ami_cs::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ // 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_nl << "{" << be_idt;
+
+ if (be_global->exception_support ())
+ {
+ *os << be_nl
+ << "ACE_DECLARE_NEW_CORBA_ENV;";
+ }
+
+ if (node->has_native ()) // native exists => no stub
+ {
+ be_predefined_type bpt (AST_PredefinedType::PT_void,
+ 0);
+
+ int status = this->gen_raise_exception (&bpt,
+ "::CORBA::MARSHAL",
+ "");
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ami_cs::"
+ "visit_operation - "
+ "codegen for has-native exception failed\n"),
+ -1);
+ }
+ }
+ else
+ {
+ *os << be_nl
+ << "if (!this->is_evaluated ())" << be_idt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::Object::tao_object_initialize (this);"
+ << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+
+ *os << "if (this->the_TAO_" << parent->local_name ()
+ << "_Proxy_Broker_ == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << parent->flat_name () << "_setup_collocation ("
+ << ");" << be_uidt_nl
+ << "}" << be_uidt;
+ }
+
+ *os << be_nl<< be_nl
+ << "TAO::Arg_Traits<void>::ret_val _tao_retval;";
+
+ // Declare the argument helper classes.
+ this->gen_stub_body_arglist (ami_op, os, true);
+
+ // Assemble the arg helper class pointer array.
+ *os << be_nl << be_nl
+ << "TAO::Argument *_the_tao_operation_signature [] =" << be_idt_nl
+ << "{" << be_idt_nl
+ << "&_tao_retval";
+
+ AST_Argument *arg = 0;
+ UTL_ScopeActiveIterator arg_list_iter (ami_op,
+ UTL_Scope::IK_decls);
+
+ // For a sendc_* operation, skip the reply handler (first argument).
+ arg_list_iter.next ();
+
+ for (; ! arg_list_iter.is_done (); arg_list_iter.next ())
+ {
+ arg = AST_Argument::narrow_from_decl (arg_list_iter.item ());
+
+ *os << "," << be_nl
+ << "&_tao_" << arg->local_name ();
+ }
+
+ *os << be_uidt_nl
+ << "};" << be_uidt;
+
+ be_interface *intf = be_interface::narrow_from_decl (parent);
+
+ // Includes the reply handler, but we have to add 1 for the retval anyway.
+ int nargs = ami_op->argument_count ();
+
+ const char *lname = node->local_name ()->get_string ();
+ size_t opname_len = ACE_OS::strlen (lname);
+ ACE_CString opname;
+
+ if (this->ctx_->attribute ())
+ {
+ // If we are a attribute node, add 5 for '_get_' or '_set_'.
+ opname_len += 5;
+
+ // Now check if we are a "get" or "set" operation.
+ if (node->nmembers () == 1)
+ {
+ opname = "_set_";
+ }
+ else
+ {
+ opname = "_get_";
+ }
+ }
+
+ opname += lname;
+
+ *os << be_nl << be_nl
+ << "TAO::Asynch_Invocation_Adapter _tao_call (" << be_idt << be_idt_nl
+ << "this," << be_nl
+ << "_the_tao_operation_signature," << be_nl
+ << nargs << "," << be_nl
+ << "\"" << opname.fast_rep () << "\"," << be_nl
+ << opname_len << "," << be_nl
+ << "this->the" << intf->base_proxy_broker_name () << "_"
+ << be_uidt_nl
+ << ");" << be_uidt;
+
+ *os << be_nl << be_nl
+ << "_tao_call.invoke (" << be_idt << be_idt_nl
+ << "ami_handler," << be_nl
+ << "&";
+
+ if (parent->is_nested ())
+ {
+ be_decl *gparent =
+ be_scope::narrow_from_scope (parent->defined_in ())->decl ();
+
+ *os << gparent->name () << "::";
+ }
+
+ *os << "AMI_" << parent->local_name () << "Handler::"
+ << opname.fast_rep () + (this->ctx_->attribute () != 0)
+ << "_reply_stub" << env_arg << be_uidt_nl
+ << ");" << be_uidt
+ << TAO_ACE_CHECK ();
+
+ *os << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+// This method is used to generate the ParamData table entry.
+int
+be_visitor_operation_ami_cs::visit_argument (be_argument *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt; // argument type
+
+ // Retrieve the type for this argument.
+ bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ami_cs::"
+ "visit_argument - "
+ "Bad argument type\n"),
+ -1);
+ }
+
+ os->indent ();
+ *os << "{" << bt->tc_name () << ", ";
+
+ switch (node->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "PARAM_IN, ";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << "PARAM_INOUT, ";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << "PARAM_OUT, ";
+ break;
+ }
+
+ *os << "0}";
+
+ return 0;
+}
+
+int
+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.
+ ACE_UNUSED_ARG (node);
+ ACE_UNUSED_ARG (bt);
+
+ return 0;
+}
+
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
new file mode 100644
index 00000000000..07a98139f2d
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_exception_holder_operation_cs.cpp
@@ -0,0 +1,48 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// ami_exception_holder_operation_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Operation in the stubs file.
+//
+// = AUTHOR
+// Michael Kircher <Michael.Kircher@mchp.siemens.de>
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_operation,
+ ami_exception_holder_operation_cs,
+ "$Id$")
+
+// ************************************************************
+// Operation visitor for client stubs
+// ************************************************************
+
+be_visitor_operation_ami_exception_holder_operation_cs::
+be_visitor_operation_ami_exception_holder_operation_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_operation (ctx)
+{
+}
+
+be_visitor_operation_ami_exception_holder_operation_cs::
+~be_visitor_operation_ami_exception_holder_operation_cs (void)
+{
+}
+
+int
+be_visitor_operation_ami_exception_holder_operation_cs::visit_operation (
+ be_operation *
+ )
+{
+ return 0;
+}
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
new file mode 100644
index 00000000000..75921685b61
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_ch.cpp
@@ -0,0 +1,84 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// ami_handler_reply_stub_operation_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for AMI Handler call back operation in
+// the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale and Alexander Babu Arulanthu
+// <alex@cs.wustl.edu>
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+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
+ )
+{
+ 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 << be_nl << be_nl
+ << "static void ";
+
+ // Check if we are an attribute node in disguise
+ if (this->ctx_->attribute ())
+ {
+ // Now check if we are a "get" or "set" operation.
+ if (node->nmembers () == 1)
+ {
+ *os << "_set_";
+ }
+ else
+ {
+ *os << "_get_";
+ }
+ }
+
+ *os << node->local_name ()
+ << "_reply_stub (" << be_idt << be_idt_nl;
+
+ *os << "TAO_InputCDR &_tao_reply_cdr," << be_nl
+ << "::Messaging::ReplyHandler_ptr _tao_reply_handler," << be_nl
+ << "::CORBA::ULong reply_status";
+
+ *os << env_dflts << be_uidt_nl
+ << ");" << be_uidt;
+ }
+
+ 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
new file mode 100644
index 00000000000..f2be62d4586
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp
@@ -0,0 +1,461 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// ami_handler_reply_stub_operation_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Operation in the stubs file.
+//
+// = AUTHOR
+// Alexander Babu Arulanthu <alex@cs.wustl.edu>
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_operation,
+ ami_handler_reply_stub_operation_cs,
+ "$Id$")
+
+// ************************************************************
+// 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 (ctx)
+{
+}
+
+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
+int
+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.
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (!this->last_node (bd))
+ {
+ *os << ",\n";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_operation_ami_handler_reply_stub_operation_cs::visit_operation (
+ be_operation *node
+ )
+{
+ be_type *bt;
+ be_visitor_context ctx;
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ // 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
+ );
+ }
+
+ // 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 ();
+
+ 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
+ );
+ }
+
+ // Genereate scope name.
+ *os << parent->full_name ();
+
+ // 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)
+ {
+ *os << "_set_";
+ }
+ else
+ {
+ *os << "_get_";
+ }
+ }
+
+ *os << node->local_name () << "_reply_stub (" << be_idt_nl;
+
+ // Generate the argument list.
+ *os << "TAO_InputCDR &_tao_in, " << be_nl
+ << "::Messaging::ReplyHandler_ptr _tao_reply_handler," << be_nl
+ << "::CORBA::ULong reply_status"
+ << env_decl << ")" << be_uidt << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ *os << "// Retrieve Reply Handler object." << be_nl;
+ *os << parent->full_name () << "_var "
+ << "_tao_reply_handler_object =" << be_idt_nl;
+
+ *os << parent->full_name ();
+ *os << "::_narrow (_tao_reply_handler"
+ << (be_global->use_raw_throw () ? "" : " ACE_ENV_ARG_PARAMETER")
+ << ");" << be_uidt
+ << TAO_ACE_CHECK () << be_nl << be_nl
+ << "// Exception handling" << be_nl
+ << "switch (reply_status)" << be_nl
+ << "{" << be_idt_nl
+ << "case TAO_AMI_REPLY_OK:" << be_nl
+ << "{" << be_idt << "\n";
+
+ // declare variables for arguments
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_DECL_SS);
+ be_visitor_operation_argument oad_visitor (&ctx);
+
+ if (node->accept (&oad_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) ami_handler_reply_stub_operation_cs::"
+ "visit_operation - "
+ "codegen for return var decl failed\n"),
+ -1);
+ }
+
+ // Demarshal parameters
+ if (this->gen_marshal_and_invoke (node, bt) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%1) ami_handler_reply_stub_operation_cs::"
+ "visit_operation - "
+ "gen_demarshal_params failed\n"),
+ -1);
+ }
+
+ *os << "break;" << be_uidt_nl
+ << "}" << be_nl
+ << "case TAO_AMI_REPLY_USER_EXCEPTION:" << be_nl
+ << "case TAO_AMI_REPLY_SYSTEM_EXCEPTION:" << be_nl
+ << "{" << be_idt_nl
+ << "const ACE_Message_Block* cdr = _tao_in.start ();" << be_nl ;
+
+ be_interface *original =
+ (be_interface::narrow_from_decl (parent))->original_interface ();
+
+ if (!original)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%1) ami_handler_reply_stub_operation_cs::"
+ "visit_operation - "
+ "original interface is not set\n"),
+ -1);
+ }
+
+ const char *exception_data_arg = "0";
+ const char *exception_count_arg = "0";
+
+ // Don't do anything if the exception list is empty.
+ if (node->exceptions ())
+ {
+ *os << be_nl << "static TAO::Exception_Data " << "exceptions_data [] = " << be_nl;
+ *os << "{" << be_idt_nl;
+
+ int excep_count = 0;
+
+ be_exception *ex = 0;
+
+ // Initialize an iterator to iterate thru the exception list.
+ // Continue until each element is visited.
+ // Iterator must be explicitly advanced inside the loop.
+ for (UTL_ExceptlistActiveIterator ei (node->exceptions ());
+ !ei.is_done ();)
+ {
+ ex = be_exception::narrow_from_decl (ei.item ());
+
+ *os << "{" << be_idt_nl
+ << "\"" << ex->repoID () << "\"," << be_nl;
+ // Allocator method.
+ *os << ex->name () << "::_alloc"
+ << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl;
+
+ if (be_global->tc_support ())
+ {
+ *os << ", " << ex->tc_name ();
+ }
+ else
+ {
+ *os << ", 0";
+ }
+
+ *os << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_uidt_nl
+ << "}";
+
+ ++excep_count;
+ ei.next ();
+
+ if (!ei.is_done ())
+ {
+ *os << "," << be_nl;
+ }
+
+ }
+
+ *os << be_uidt_nl << "};" << be_nl << be_nl;
+
+ *os << "::CORBA::ULong exceptions_count = "
+ << excep_count << ";\n" << be_nl;
+
+ exception_data_arg = "exceptions_data";
+ exception_count_arg = "exceptions_count";
+ }
+
+ *os << "::CORBA::OctetSeq "
+ << "_tao_marshaled_exception (" << be_idt << be_idt_nl
+ << "static_cast <CORBA::ULong> (cdr->length ())," << be_nl
+ << "static_cast <CORBA::ULong> (cdr->length ())," << be_nl
+ << "reinterpret_cast <unsigned char*> (cdr->rd_ptr ())," << be_nl
+ << "0" << be_uidt_nl
+ << ");" << be_uidt_nl;
+
+ *os << "::Messaging::ExceptionHolder* exception_holder_ptr = 0;" << be_nl
+ << "ACE_NEW (" << be_idt << be_idt_nl
+ << "exception_holder_ptr," << be_nl
+ << "::TAO::ExceptionHolder (" << be_idt_nl
+ << "(reply_status == TAO_AMI_REPLY_SYSTEM_EXCEPTION)," << be_nl
+ << "_tao_in.byte_order ()," << be_nl
+ << "_tao_marshaled_exception," << be_nl
+ << exception_data_arg << "," << be_nl
+ << exception_count_arg << ")" << be_uidt_nl
+ << ");" << be_uidt_nl << be_uidt_nl;
+
+ *os << "::Messaging::ExceptionHolder_var exception_holder_var = "
+ << "exception_holder_ptr;" << be_nl;
+
+ *os << "_tao_reply_handler_object->"
+ << node->local_name () << "_excep (" << be_idt << be_idt_nl
+ << "exception_holder_var";
+
+ if (!be_global->exception_support ())
+ {
+ *os << " ACE_ENV_ARG_PARAMETER";
+ }
+
+ *os << be_uidt_nl << ");" << be_uidt_nl;
+
+ if (!be_global->exception_support ())
+ {
+ *os << "ACE_CHECK;" << be_nl;
+ }
+
+ *os << "break;" << be_uidt_nl
+ << "}" << be_nl;
+
+ *os << "case TAO_AMI_REPLY_NOT_OK:" << be_idt_nl
+ << "// @@ Michael: Not even the spec mentions this case." << be_nl
+ << "// We have to think about this case." << be_nl
+ << "break;" << be_uidt << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+
+ 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
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ // 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
+ );
+ }
+
+ os->indent ();
+ *os << "{" << bt->tc_name () << ", ";
+ switch (node->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "PARAM_IN, ";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << "PARAM_INOUT, ";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << "PARAM_OUT, ";
+ break;
+ }
+ *os << "0}";
+
+ return 0;
+}
+
+int
+be_visitor_operation_ami_handler_reply_stub_operation_cs::gen_pre_stub_info (
+ be_operation *node,
+ be_type *
+ )
+{
+ // 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_;
+ be_visitor_operation_exceptlist_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -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
+ );
+ }
+ }
+
+ return 0;
+}
+
+int
+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_context ctx;
+
+ 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;
+
+ // demarshal each in and inout argument
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS);
+ ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT);
+ be_visitor_operation_argument_marshal visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ami_handler_reply_stub_operation_cs::"
+ "gen_marshal_params - "
+ "codegen for args failed\n"),
+ -1);
+ }
+
+ *os << be_uidt << be_uidt_nl
+ << " ))" << be_nl;
+
+ if (be_global->use_raw_throw ())
+ {
+ *os << "throw ::CORBA::MARSHAL ();" << be_uidt_nl << be_nl;
+ }
+ else
+ {
+ *os << "ACE_THROW ( ::CORBA::MARSHAL ());" << be_uidt_nl << be_nl;
+ }
+ }
+
+
+ // Invoke the callback method
+ *os << "// Invoke the call back method." << be_nl
+ << "_tao_reply_handler_object->";
+
+ // 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)
+ {
+ *os << "set_";
+ }
+ else
+ {
+ *os << "get_";
+ }
+ }
+
+ *os << node->local_name () << " (" << be_idt << be_idt_nl;
+
+
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS);
+ be_visitor_operation_argument oau_visitor (&ctx);
+
+ if (node->accept (&oau_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) ami_handler_reply_stub_operation_cs::"
+ "visit_operation - "
+ "codegen for making upcall failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl << ");" << be_uidt
+ << TAO_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
new file mode 100644
index 00000000000..5988f4c0049
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
@@ -0,0 +1,196 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// arglist.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the parameter list of the Operation signature.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_operation,
+ arglist,
+ "$Id$")
+
+// ************************************************************
+// operation visitor to generate the argument list.
+// We have separated code generation for this from the 4 main
+// visitors to avoid code duplication and tight coupling
+// ************************************************************
+
+be_visitor_operation_arglist::be_visitor_operation_arglist (
+ be_visitor_context *ctx
+ )
+ : be_visitor_operation (ctx)
+{
+}
+
+be_visitor_operation_arglist::~be_visitor_operation_arglist (void)
+{
+}
+
+int
+be_visitor_operation_arglist::visit_operation (be_operation *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << " (" << be_idt << be_idt_nl;
+
+ int arg_emitted = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XH:
+ case TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XS:
+ *os << "::CORBA::Object *_collocated_tao_target_";
+
+ if (node->argument_count () > 0)
+ {
+ *os << "," << be_nl;
+ }
+
+ arg_emitted = 1;
+ break;
+ default:
+ break;
+ }
+
+ // All we do is hand over code generation to our scope.
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_arglist::"
+ "visit_operation - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ if (this->gen_environment_decl (arg_emitted, node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_arglist::"
+ "visit_operation - "
+ "gen_environment_decl failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl
+ << ")";
+
+ // Now generate the throw specs.
+ if (this->gen_throw_spec (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%N:%l) be_visitor_operation_arglist")
+ ACE_TEXT ("::visit_operation - ")
+ ACE_TEXT ("Failed to generate throw spec\n")),
+ -1);
+ }
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_OPERATION_ARGLIST_CH:
+ case TAO_CodeGen::TAO_OPERATION_ARGLIST_COLLOCATED_SH:
+ case TAO_CodeGen::TAO_OPERATION_ARGLIST_IH:
+ if (node->is_local ())
+ {
+ *os << " = 0";
+ }
+
+ break;
+ case TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XH:
+ break;
+ case TAO_CodeGen::TAO_OPERATION_ARGLIST_SH:
+ *os << " = 0";
+ break;
+ default:
+ return 0;
+ }
+
+ *os << ";";
+
+ return 0;
+}
+
+int
+be_visitor_operation_arglist::visit_argument (be_argument *node)
+{
+ // Get the visitor that will dump the argument's mapping in the operation
+ // signature.
+ be_visitor_context ctx (*this->ctx_);
+
+ // First grab the interface definition inside which this operation is
+ // defined. We need this since argument types may very well be declared
+ // inside the scope of the interface node. In such cases, we would like to
+ // generate the appropriate relative scoped names.
+ be_operation *op = this->ctx_->be_scope_as_operation ();
+
+ if (!op)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arglist::"
+ "visit_argument - "
+ "Bad operation\n"),
+ -1);
+ }
+
+ // We need the interface node in which this operation was defined. However,
+ // if this operation node was an attribute node in disguise, we get this
+ // information from the context
+ be_interface *intf;
+ intf = this->ctx_->attribute ()
+ ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
+ : be_interface::narrow_from_scope (op->defined_in ());
+
+ if (!intf)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arglist::"
+ "visit_argument - "
+ "Bad interface\n"),
+ -1);
+ }
+
+ // Set new scope.
+ ctx.scope (intf);
+
+ // Create a visitor.
+ be_visitor_args_arglist visitor (&ctx);
+
+ if (visitor.visit_argument (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arglist::"
+ "visit_argument - "
+ "codegen for arglist failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_operation_arglist::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
+ // else decide if we are generating code to support true exceptions - in
+ // which case there will not be any CORBA::Environment parameter
+ if (!this->last_node (bd))
+ {
+ *os << "," << be_nl;
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp b/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp
new file mode 100644
index 00000000000..fcd2fa84244
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp
@@ -0,0 +1,221 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// argument.cpp
+//
+// = DESCRIPTION
+// Visitor that calls the visitor for arguments.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_operation,
+ argument,
+ "$Id$")
+
+// ************************************************************
+// 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 (ctx)
+{
+}
+
+be_visitor_operation_argument::~be_visitor_operation_argument (void)
+{
+}
+
+int
+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
+ // applicable for the upcalls or the call to (de)marshal that we use in the
+ // interpreted marshaling.
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS:
+ case TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS:
+ case TAO_CodeGen::TAO_OPERATION_ARG_MARSHAL_SS:
+ if (!this->last_node (bd))
+ {
+ *os << "," << be_nl;
+ }
+
+ break;
+ case TAO_CodeGen::TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS:
+ if (!this->last_node (bd))
+ {
+ *os << ",";
+ }
+
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+int
+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.
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_argument::"
+ "visit_operation - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ // 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.
+
+ // 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 << env_arg;
+ }
+ else
+ {
+ *os << env_sngl_arg;
+ }
+
+ break;
+ default:
+ break;
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_operation_argument::visit_argument (be_argument *node)
+{
+ // Get the visitor that will dump the argument's mapping in the operation
+ // signature.
+ be_visitor_context ctx (*this->ctx_);
+
+ // first grab the interface definition inside which this operation is
+ // defined. We need this since argument types may very well be declared
+ // inside the scope of the interface node. In such cases, we would like to
+ // generate the appropriate relative scoped names.
+ be_operation *op = this->ctx_->be_scope_as_operation ();
+
+ if (!op)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arglist::"
+ "visit_argument - "
+ "Bad operation\n"),
+ -1);
+ }
+
+ // We need the interface node in which this operation was defined. However,
+ // if this operation node was an attribute node in disguise, we get this
+ // information from the context.
+ be_interface *intf;
+ intf = this->ctx_->attribute ()
+ ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
+ : be_interface::narrow_from_scope (op->defined_in ());
+
+ if (!intf)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arglist::"
+ "visit_argument - "
+ "Bad interface\n"),
+ -1);
+ }
+
+ ctx.scope (intf);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_OPERATION_ARG_INVOKE_CS:
+ {
+ be_visitor_args_invoke_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_OPERATION_ARG_DECL_SS:
+ {
+ be_visitor_args_vardecl_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS:
+ {
+ be_visitor_args_marshal_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_OPERATION_ARG_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);
+ be_visitor_args_upcall_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS:
+ {
+ be_visitor_args_upcall_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_argument::"
+ "visit_argument - "
+ "Bad context\n"),
+ -1);
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_argument::"
+
+ "visit_argument - "
+ "codegen for argument failed\n"),
+ -1);
+ }
+
+ 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
new file mode 100644
index 00000000000..d222235b04d
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/argument_invoke.cpp
@@ -0,0 +1,170 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// argument_invoke.cpp
+//
+// = DESCRIPTION
+// Visitor to pass arguments to the CDR operators. This one helps in
+// generating the && and the , at the right place. This one is for the
+// client stub side.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_operation,
+ argument_invoke,
+ "$Id$")
+
+// ************************************************************
+// operation visitor to handle the passing of arguments to the CDR operators
+// ************************************************************
+
+be_visitor_operation_argument_invoke::be_visitor_operation_argument_invoke (
+ be_visitor_context
+ *ctx
+ )
+ : be_visitor_operation_argument (ctx),
+ last_arg_printed_ (be_visitor_operation_argument_invoke::TAO_ARG_NONE)
+{
+}
+
+be_visitor_operation_argument_invoke::~be_visitor_operation_argument_invoke (
+ void
+ )
+{
+}
+
+int
+be_visitor_operation_argument_invoke::pre_process (be_decl *bd)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ be_argument *arg = be_argument::narrow_from_decl (bd);
+
+ if (!arg)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) "
+ "be_visitor_operation_argument_invoke"
+ "::post_process - "
+ "Bad argument node\n"),
+ -1);
+ }
+
+ switch (arg->direction ())
+ {
+ case AST_Argument::dir_IN:
+ if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
+ {
+ if (this->last_arg_printed_ !=
+ be_visitor_operation_argument_invoke::TAO_ARG_NONE)
+ *os << " &&" << be_nl;
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
+ {
+ // nothing
+ }
+ break;
+ case AST_Argument::dir_INOUT:
+ if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
+ {
+ if (this->last_arg_printed_ !=
+ 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_visitor_operation_argument_invoke::TAO_ARG_NONE)
+ *os << " &&" << be_nl;
+ }
+ break;
+ case AST_Argument::dir_OUT:
+ if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
+ {
+ // nothing
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
+ {
+ if (this->last_arg_printed_ !=
+ be_visitor_operation_argument_invoke::TAO_ARG_NONE)
+ *os << " &&" << be_nl;
+ }
+ break;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_operation_argument_invoke::post_process (be_decl *bd)
+{
+ be_argument *arg = be_argument::narrow_from_decl (bd);
+
+ if (!arg)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) "
+ "be_visitor_operation_argument_invoke"
+ "::post_process - "
+ "Bad argument node\n"),
+ -1);
+ }
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ switch (arg->direction ())
+ {
+ case AST_Argument::dir_IN:
+ // only these arguments get printed
+ this->last_arg_printed_ =
+ be_visitor_operation_argument_invoke::TAO_ARG_IN;
+ break;
+ case AST_Argument::dir_INOUT:
+ // only these arguments get printed
+ this->last_arg_printed_ =
+ 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
+ break;
+ }
+ break;
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ switch (arg->direction ())
+ {
+ case AST_Argument::dir_IN:
+ // these arguments don't get printed for the >> on the stub
+ break;
+ case AST_Argument::dir_INOUT:
+ // only these arguments get printed
+ this->last_arg_printed_ =
+ be_visitor_operation_argument_invoke::TAO_ARG_INOUT;
+ break;
+ case AST_Argument::dir_OUT:
+ // only these arguments get printed
+ this->last_arg_printed_ =
+ be_visitor_operation_argument_invoke::TAO_ARG_OUT;
+ break;
+ }
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) "
+ "be_visitor_operation_argument_invoke"
+ "::post_process - "
+ "Bad sub state\n"),
+ -1);
+ }
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/argument_marshal.cpp b/TAO/TAO_IDL/be/be_visitor_operation/argument_marshal.cpp
new file mode 100644
index 00000000000..3ee13e69a64
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/argument_marshal.cpp
@@ -0,0 +1,287 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// argument_marshal.cpp
+//
+// = DESCRIPTION
+// Visitor to pass arguments to the CDR operators. This one helps in
+// generating the && and the , at the right place. This one is for the
+// skeleton side.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_operation,
+ argument_marshal,
+ "$Id$")
+
+// ************************************************************
+// operation visitor to handle the passing of arguments to the CDR operators
+// ************************************************************
+
+be_visitor_operation_argument_marshal::be_visitor_operation_argument_marshal (
+ be_visitor_context
+ *ctx
+ )
+ : be_visitor_operation_argument (ctx),
+ last_arg_printed_ (be_visitor_operation_argument_marshal::TAO_ARG_NONE)
+{
+}
+
+be_visitor_operation_argument_marshal::~be_visitor_operation_argument_marshal (
+ void
+ )
+{
+}
+
+int
+be_visitor_operation_argument_marshal::pre_process (be_decl *bd)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ be_argument *arg = be_argument::narrow_from_decl (bd);
+
+ if (!arg)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) "
+ "be_visitor_operation_argument_marshal"
+ "::post_process - "
+ "Bad argument node\n"),
+ -1);
+ }
+ switch (arg->direction ())
+ {
+ case AST_Argument::dir_IN:
+ if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
+ {
+ if (this->last_arg_printed_ !=
+ be_visitor_operation_argument_marshal::TAO_ARG_NONE)
+ *os << " &&";
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
+ {
+ // nothing
+ }
+ break;
+ case AST_Argument::dir_INOUT:
+ if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
+ {
+ if (this->last_arg_printed_ !=
+ be_visitor_operation_argument_marshal::TAO_ARG_NONE)
+ *os << " &&";
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
+ {
+ if (this->last_arg_printed_ !=
+ be_visitor_operation_argument_marshal::TAO_ARG_NONE)
+ *os << " &&";
+ }
+ break;
+ case AST_Argument::dir_OUT:
+ if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
+ {
+ // nothing
+ }
+ else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
+ {
+ if (this->last_arg_printed_ !=
+ be_visitor_operation_argument_marshal::TAO_ARG_NONE)
+ *os << " &&";
+ }
+ break;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_operation_argument_marshal::post_process (be_decl *bd)
+{
+ be_argument *arg = be_argument::narrow_from_decl (bd);
+
+ if (!arg)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) "
+ "be_visitor_operation_argument_marshal"
+ "::post_process - "
+ "Bad argument node\n"),
+ -1);
+ }
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ switch (arg->direction ())
+ {
+ case AST_Argument::dir_IN:
+ // only these arguments get printed
+ this->last_arg_printed_ =
+ be_visitor_operation_argument_marshal::TAO_ARG_IN;
+ break;
+ case AST_Argument::dir_INOUT:
+ // only these arguments get printed
+ this->last_arg_printed_ =
+ 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
+ break;
+ }
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ switch (arg->direction ())
+ {
+ case AST_Argument::dir_IN:
+ // these arguments don't get printed for the >> on the stub
+ break;
+ case AST_Argument::dir_INOUT:
+ // only these arguments get printed
+ this->last_arg_printed_ =
+ be_visitor_operation_argument_marshal::TAO_ARG_INOUT;
+ break;
+ case AST_Argument::dir_OUT:
+ // only these arguments get printed
+ this->last_arg_printed_ =
+ be_visitor_operation_argument_marshal::TAO_ARG_OUT;
+ break;
+ }
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) "
+ "be_visitor_operation_argument_marshal"
+ "::post_process - "
+ "Bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+// ****************************************************************
+
+be_visitor_args_decl::be_visitor_args_decl (be_visitor_context *ctx)
+ : be_visitor_scope (ctx)
+{
+}
+
+int
+be_visitor_args_decl::visit_operation (be_operation *node)
+{
+ return this->visit_scope (node);
+}
+
+int
+be_visitor_args_decl::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 ());
+
+ return bt->accept (this);
+}
+
+// visit array
+int
+be_visitor_args_decl::visit_array (be_array *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // retrieve the field node
+ be_argument *f = this->ctx_->be_node_as_argument ();
+
+ if (f == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_args_decl::"
+ "visit_array - "
+ "cannot retrieve argument node\n"),
+ -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);
+
+ 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
+ // 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 (),
+ node->local_name ()->get_string ());
+ }
+ else
+ {
+ ACE_OS::sprintf (fname,
+ "_%s",
+ node->full_name ());
+ }
+ }
+ else
+ {
+ // Typedefed node.
+ ACE_OS::sprintf (fname,
+ "%s",
+ node->full_name ());
+ }
+
+ if (f->direction () != AST_Argument::dir_IN)
+ {
+ *os << fname << "_forany "
+ << "_tao_argument_" << f->local_name () << " ("
+ << be_idt << be_idt_nl
+ << f->local_name ()
+ << be_uidt_nl << ");" << be_uidt_nl;
+ }
+
+ return 0;
+}
+
+// visit typedef type
+int
+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_args_decl::"
+ "visit_typedef - "
+ "Bad primitive type\n"
+ ),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 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
new file mode 100644
index 00000000000..04890bc1de8
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/base_proxy_impl_ch.cpp
@@ -0,0 +1,71 @@
+// $Id$
+
+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_scope (ctx)
+{
+}
+
+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 = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "virtual ";
+
+ // STEP I: generate the 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_sh::"
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
+ }
+
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_operation_rettype oro_visitor (&ctx);
+
+ if (bt->accept (&oro_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_sh::"
+ "visit_operation - "
+ "codegen for return type failed\n"),
+ -1);
+ }
+
+ // 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_BASE_PROXY_IMPL_CH);
+ be_visitor_operation_arglist oabpi_visitor (&ctx);
+
+ if (node->accept (&oabpi_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_sh::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ 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
new file mode 100644
index 00000000000..76b2b20752a
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp
@@ -0,0 +1,192 @@
+// $Id$
+
+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_operation (ctx)
+{
+}
+
+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
+ )
+{
+ 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 = this->ctx_->attribute ()
+ ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
+ : be_interface::narrow_from_scope (node->defined_in ());
+
+ if (!intf)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_direct_collocated_ss::"
+ "visit_operation - "
+ "bad interface scope\n"),
+ -1);
+ }
+
+ *os << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "void" << be_nl
+ << intf->full_direct_proxy_impl_name () << "::";
+
+ // Check if we are an attribute node in disguise.
+ if (this->ctx_->attribute ())
+ {
+ // Now check if we are a "get" or "set" operation.
+ if (node->nmembers () == 1)
+ {
+ *os << "_set_";
+ }
+ else
+ {
+ *os << "_get_";
+ }
+ }
+
+ *os << node->local_name () << " (" << be_idt << be_idt_nl
+ << "TAO_Abstract_ServantBase *servant," << be_nl
+ << "TAO::Argument **";
+
+ if (!node->void_return_type () || node->nmembers () > 0)
+ {
+ *os << " args";
+ }
+
+ *os << "," << be_nl
+ << "int" << env_decl << be_uidt_nl
+ << ")";
+
+ if (this->gen_throw_spec (node) != 0)
+ {
+ return -1;
+ }
+
+ *os << be_uidt_nl
+ << "{" << be_idt_nl;
+
+#if 0
+ << "TAO::Portable_Server::Servant_Upcall servant_upcall ("
+ << be_idt << be_idt_nl
+ << "obj->_stubobj ()"
+ << "->servant_orb_var ()->orb_core ()"
+ << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+#endif /*if 0*/
+
+ if (!node->void_return_type ())
+ {
+ *os << "((TAO::Arg_Traits< ";
+
+ this->gen_arg_template_param_name (node,
+ node->return_type (),
+ os);
+
+ *os << ">::ret_val *) args[0])->arg () =" << be_idt_nl;
+ }
+
+ *os << "dynamic_cast<" << be_idt
+ << intf->full_skel_name () << "_ptr>" << be_nl << "("
+ << "servant)" << be_uidt_nl;
+
+ be_visitor_context ctx;
+
+ if (this->gen_invoke (ctx, node) == -1)
+ {
+ return -1;
+ }
+
+ if (!node->void_return_type ())
+ {
+ *os << be_uidt;
+ }
+
+ *os << be_uidt << be_uidt_nl;
+
+ if (!be_global->exception_support ())
+ {
+ *os << "ACE_CHECK;";
+ }
+ *os << be_uidt_nl
+ << "}" << be_nl;
+
+ return 0;
+}
+
+
+
+int
+be_visitor_operation_direct_proxy_impl_ss::gen_invoke (
+ be_visitor_context & /*ctx*/,
+ be_operation *node
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "->" << node->local_name () << " ("
+ << be_idt << be_idt << be_idt;
+
+ UTL_ScopeActiveIterator si (node,
+ UTL_Scope::IK_decls);
+
+ if (si.is_done ())
+ {
+ *os << env_sngl_arg << be_uidt_nl
+ << ");";
+
+ return 0;
+ }
+
+ AST_Argument *arg = 0;
+ int index = 1;
+
+ for (; !si.is_done (); si.next (), ++index)
+ {
+ arg = AST_Argument::narrow_from_decl (si.item ());
+
+ *os << (index == 1 ? "" : ",") << be_nl
+ << "((TAO::Arg_Traits< ";
+
+ this->gen_arg_template_param_name (arg,
+ arg->field_type (),
+ os);
+
+ *os << ">::";
+
+ switch (arg->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "in";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << "inout";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << "out";
+ default:
+ break;
+ }
+
+ *os << "_arg_val *) args[" << index << "])->arg ()";
+ }
+
+ // End the upcall
+ *os << env_arg << be_uidt_nl
+ << ");";
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp
new file mode 100644
index 00000000000..e5526734133
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp
@@ -0,0 +1,94 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// exceptlist_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the list of exceptions that an operation
+// raises.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_operation,
+ exceptlist_cs,
+ "$Id$")
+
+// ****************************************************************************
+// visitor to generate the exception list for operations
+// ****************************************************************************
+
+be_visitor_operation_exceptlist_cs::be_visitor_operation_exceptlist_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_operation_exceptlist_cs::~be_visitor_operation_exceptlist_cs (void)
+{
+}
+
+int
+be_visitor_operation_exceptlist_cs::visit_operation (be_operation *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Don't do anything if the exception list is empty.
+ if (node->exceptions ())
+ {
+ *os << be_nl << be_nl
+ << "static TAO::Exception_Data" << be_nl
+ << "_tao_" << node->flat_name ()
+ << "_exceptiondata [] = " << be_idt_nl;
+ *os << "{" << be_idt_nl;
+
+ be_exception *ex = 0;
+
+ // Initialize an iterator to iterate thru the exception list.
+ // Continue until each element is visited.
+ // Iterator must be advanced explicitly inside the loop.
+ for (UTL_ExceptlistActiveIterator ei (node->exceptions ());
+ !ei.is_done ();)
+ {
+ ex = be_exception::narrow_from_decl (ei.item ());
+
+ *os << "{" << be_idt_nl
+ << "\"" << ex->repoID () << "\"," << be_nl
+ << ex->name () << "::_alloc"
+ << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl;
+
+ if (be_global->tc_support ())
+ {
+ *os << ", " << ex->tc_name ();
+ }
+ else
+ {
+ *os << ", 0";
+ }
+
+ *os << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_uidt_nl
+ << "}";
+
+ ei.next ();
+
+ if (!ei.is_done ())
+ {
+ *os << "," << be_nl << be_nl;
+ }
+ }
+
+ *os << be_uidt_nl << "};" << be_uidt;
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_ss.cpp
new file mode 100644
index 00000000000..1dcdda82daa
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_ss.cpp
@@ -0,0 +1,85 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// exceptlist_ss.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the list of exceptions that an operation
+// raises (skeleton/server side).
+//
+// = AUTHOR
+// Ossama Othman
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_operation,
+ exceptlist_ss,
+ "$Id$")
+
+// ****************************************************************************
+// visitor to generate the exception list for operations (skeleton/server_side)
+// ****************************************************************************
+
+be_visitor_operation_exceptlist_ss::be_visitor_operation_exceptlist_ss (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_operation_exceptlist_ss::~be_visitor_operation_exceptlist_ss (void)
+{
+}
+
+int
+be_visitor_operation_exceptlist_ss::visit_operation (be_operation * node)
+{
+ TAO_OutStream * const os = this->ctx_->stream ();
+
+ *os << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl;
+
+ // When there are exceptions and typecode support is enabled, then generate
+ // the typecodes of the user exceptions this operation can throw.
+ if (node->exceptions () && be_global->tc_support ())
+ {
+ *os << "static ::CORBA::TypeCode_ptr const exceptions[] = " << be_idt_nl;
+ *os << "{" << be_idt_nl;
+
+ // Initialize an iterator to iterate thru the exception list.
+ // Continue until each element is visited.
+ // Iterator must be advanced explicitly inside the loop.
+ for (UTL_ExceptlistActiveIterator ei (node->exceptions ());
+ !ei.is_done ();)
+ {
+ be_exception * ex = be_exception::narrow_from_decl (ei.item ());
+
+ *os << ex->tc_name ();
+
+ ei.next ();
+
+ if (!ei.is_done ())
+ {
+ *os << "," << be_nl;
+ }
+ }
+
+ *os << be_uidt_nl << "};" << be_uidt_nl
+ << "static ::CORBA::ULong const nexceptions = "
+ << node->exceptions()->length () << ";";
+ }
+ else
+ {
+ *os << "static ::CORBA::TypeCode_ptr const * const exceptions = 0;"
+ << be_nl
+ << "static ::CORBA::ULong const nexceptions = 0;";
+ }
+
+ *os << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_nl << be_nl;
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp
new file mode 100644
index 00000000000..82d2cbccd4a
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp
@@ -0,0 +1,711 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Operation in the stubs file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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_operation::~be_visitor_operation (void)
+{
+}
+
+// Is the operation return type void?
+int
+be_visitor_operation::void_return_type (be_type *bt)
+{
+ if (bt->node_type () == AST_Decl::NT_pre_defined)
+ {
+ AST_PredefinedType::PredefinedType pdt =
+ be_predefined_type::narrow_from_decl (bt)->pt ();
+
+ if (pdt == AST_PredefinedType::PT_void)
+ {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_operation::has_param_type (be_operation *node,
+ AST_Argument::Direction dir)
+{
+ return (node->count_arguments_with_direction (dir) != 0);
+}
+
+size_t
+be_visitor_operation::count_non_out_parameters (be_operation *node)
+{
+ // @@ Once the valuetype issue discussed below is fixed we can
+ // replace this routine with:
+ //
+ // return node->count_arguments_with_direction (AST_Argument::dir_IN
+ // | AST_Argument::dir_INOUT);
+ //
+ size_t count = 0;
+
+ // Initialize an iterator to iterate thru our scope.
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ be_argument *bd =
+ be_argument::narrow_from_decl (si.item ());
+
+ // We do not generate insertion operators for valuetypes
+ // yet. Do not include them in the count.
+ be_valuetype *vt =
+ be_valuetype::narrow_from_decl (bd->field_type ());
+
+ if (bd && (bd->direction () != AST_Argument::dir_OUT) && !vt)
+ {
+ ++count;
+ }
+ }
+
+ return count;
+}
+
+int
+be_visitor_operation::is_amh_exception_holder (be_interface *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, "be_visitor_operation: Passed second test of amh_excepholder \n"));
+ is_an_amh_exception_holder = 1;
+ }
+ }
+
+ return is_an_amh_exception_holder;
+}
+
+// Method to generate the throw specs for exceptions that are thrown by the
+// operation.
+int
+be_visitor_operation::gen_throw_spec (be_operation *node)
+{
+ TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+
+ const char *throw_spec_open = "throw (";
+ const char *throw_spec_close = ")";
+
+ if (!be_global->use_raw_throw ())
+ {
+ throw_spec_open = "ACE_THROW_SPEC ((";
+ throw_spec_close = "))";
+ }
+
+ UTL_Scope *scope = node->defined_in ();
+ be_interface *iface = be_interface::narrow_from_scope (scope);
+
+ /***************************************************************************/
+ // 2.6
+ // Generate the Right Throw Spec if it is an AMH ExceptionHolder
+ /***************************************************************************/
+ // Check if this is (IF and it's not VT) or (it is an AMH ExceptionHolder).
+ if (iface != 0)
+ {
+ int is_amh_exception_holder = this->is_amh_exception_holder (iface);
+ AST_Decl::NodeType nt = iface->node_type ();
+
+ if (nt != AST_Decl::NT_valuetype || is_amh_exception_holder)
+ {
+ *os << be_nl << throw_spec_open;
+ *os << be_idt_nl << "::CORBA::SystemException";
+
+ if (node->exceptions ())
+ {
+ // Initialize an iterator to iterate thru the exception list.
+ for (UTL_ExceptlistActiveIterator ei (node->exceptions ());
+ !ei.is_done ();
+ ei.next ())
+ {
+ be_exception *excp =
+ be_exception::narrow_from_decl (ei.item ());
+
+ if (excp == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation"
+ "gen_throw_spec - "
+ "bad exception node\n"),
+ -1);
+
+ }
+
+ *os << "," << be_nl
+ << "::" << excp->name ();
+ }
+ }
+
+ *os << be_uidt_nl << throw_spec_close << be_uidt;
+ }
+ }
+ /*******************************************************************************/
+ return 0;
+}
+
+int
+be_visitor_operation::gen_environment_decl (int argument_emitted,
+ be_operation *node)
+{
+ // Generate the CORBA::Environment parameter for the alternative mapping.
+ if (be_global->exception_support ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Use ACE_ENV_SINGLE_ARG_DECL or ACE_ENV_ARG_DECL depending on
+ // whether the operation node has parameters.
+ const char *env_decl = "ACE_ENV_SINGLE_ARG_DECL";
+
+ if (this->ctx_->sub_state ()
+ == TAO_CodeGen::TAO_AMH_RESPONSE_HANDLER_OPERATION
+ && node->argument_count () == 0)
+ {
+ // Response handler operations don't use the environment arg
+ // unless there are other args in the operation.
+ env_decl = "ACE_ENV_SINGLE_ARG_DECL";
+ this->ctx_->sub_state (TAO_CodeGen::TAO_SUB_STATE_UNKNOWN);
+ }
+ else if (argument_emitted || node->argument_count () > 0)
+ {
+ env_decl = "ACE_ENV_ARG_DECL";
+ }
+
+ TAO_CodeGen::CG_STATE cgs = this->ctx_->state ();
+
+ if (node->argument_count () > 0
+ || cgs == TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XH
+ || cgs == TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XS)
+ {
+ *os << be_nl;
+ }
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_OPERATION_ARGLIST_CH:
+ case TAO_CodeGen::TAO_OPERATION_ARGLIST_COLLOCATED_SH:
+ case TAO_CodeGen::TAO_OPERATION_ARGLIST_SH:
+ // Last argument is always CORBA::Environment.
+ *os << env_decl << "_WITH_DEFAULTS";
+ break;
+ default:
+ *os << env_decl;
+ break;
+ }
+
+ return 0;
+}
+
+// Method that returns the appropriate CORBA::Environment variable.
+const char *
+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 = "";
+
+ // Check if we are generating stubs/skeletons for
+ // true C++ exception support.
+ if (be_global->exception_support ())
+ {
+ return ace_try_env_decl;
+ }
+ else
+ {
+ return null_env_decl;
+ }
+}
+
+int
+be_visitor_operation::gen_raise_exception (be_type *return_type,
+ const char *exception_name,
+ const char *exception_arguments)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (be_global->use_raw_throw ())
+ {
+ *os << "throw "
+ << exception_name << "(" << exception_arguments << ");\n";
+ return 0;
+ }
+
+ int is_void =
+ return_type == 0 || this->void_return_type (return_type);
+
+ if (is_void)
+ {
+ *os << "ACE_THROW (";
+ }
+ else
+ {
+ *os << "ACE_THROW_RETURN (";
+ }
+
+ *os << exception_name << " (" << exception_arguments << ")";
+
+ if (is_void)
+ {
+ *os << ");";
+
+ return 0;
+ }
+
+ *os << ",";
+
+ // Non-void return type.
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_operation_rettype_return_cs visitor (&ctx);
+
+ if (return_type->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation::"
+ "gen_raise_exception - "
+ "codegen for return var failed\n"),
+ -1);
+ }
+
+ *os << ");";
+
+ return 0;
+}
+
+int
+be_visitor_operation::gen_stub_operation_body (
+ be_operation *node,
+ be_type *return_type
+ )
+{
+ be_interface *intf = this->ctx_->attribute ()
+ ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
+ : be_interface::narrow_from_scope (node->defined_in ());
+
+ if (!intf)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::"
+ "visit_operation - "
+ "bad interface scope\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_visitor_context ctx;
+
+ *os << be_nl << "{" << be_idt_nl;
+
+ 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_cs::"
+ "visit_operation - "
+ "codegen for native exception failed\n"
+ ),
+ -1
+ );
+ }
+
+ *os << be_uidt_nl << "}";
+
+ return 0;
+ }
+
+ if (!node->is_abstract ())
+ {
+ // If the object is lazily evaluated the proxy brker might well
+ // be null. Initialize it now.
+ *os << "if (!this->is_evaluated ())" << be_idt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::Object::tao_object_initialize (this);"
+ << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "if (this->the" << intf->base_proxy_broker_name () << "_ == 0)"
+ << be_idt_nl
+ << "{" << be_idt_nl
+ << intf->flat_name () << "_setup_collocation ();"
+ << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+ }
+
+ // Declare return type helper class.
+ *os << "TAO::Arg_Traits< ";
+
+ this->gen_arg_template_param_name (node,
+ return_type,
+ os);
+
+ *os << ">::ret_val _tao_retval;";
+
+ // Declare the argument helper classes.
+ this->gen_stub_body_arglist (node, os);
+
+ *os << be_nl << be_nl
+ << "TAO::Argument *_the_tao_operation_signature [] =" << be_idt_nl
+ << "{" << be_idt_nl
+ << "&_tao_retval";
+
+ AST_Argument *arg = 0;
+
+ for (UTL_ScopeActiveIterator arg_list_iter (node, UTL_Scope::IK_decls);
+ ! arg_list_iter.is_done ();
+ arg_list_iter.next ())
+ {
+ arg = AST_Argument::narrow_from_decl (arg_list_iter.item ());
+
+ *os << "," << be_nl
+ << "&_tao_" << arg->local_name ();
+ }
+
+ *os << be_uidt_nl
+ << "};" << be_uidt;
+
+ if (this->gen_pre_stub_info (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_cs::"
+ "visit_operation - "
+ "codegen for exceptiondata failed\n"),
+ -1);
+ }
+
+ // Use the name without the possible '_cxx_' here.
+ size_t tmp_len =
+ ACE_OS::strlen (node->original_local_name ()->get_string ());
+
+ *os << be_nl << be_nl
+ << "TAO::" << (node->is_abstract () ? "AbstractBase_" : "" )
+ << "Invocation_Adapter _tao_call (" << be_idt << be_idt_nl
+ << "this," << be_nl
+ << "_the_tao_operation_signature," << be_nl
+ << node->argument_count () + 1 << "," << be_nl
+ << "\"";
+
+ // Check if we are an attribute node in disguise.
+ if (this->ctx_->attribute ())
+ {
+ // If we are a attribute node, add th elength of the operation
+ // name.
+ tmp_len += 5;
+
+ // Now check if we are a "get" or "set" operation.
+ if (node->nmembers () == 1)
+ {
+ *os << "_set_";
+ }
+ else
+ {
+ *os << "_get_";
+ }
+ }
+
+ // original_local_name() strips off the leading '_cxx_' if any.
+ *os << node->original_local_name () << "\"," << be_nl
+ << tmp_len << "," << be_nl
+ << "this->the" << intf->base_proxy_broker_name () << "_";
+
+ if (node->flags () == AST_Operation::OP_oneway)
+ {
+ *os << "," << be_nl
+ << "TAO::TAO_ONEWAY_INVOCATION";
+ }
+
+ *os << be_uidt_nl
+ << ");" << be_uidt;
+
+ *os << be_nl << be_nl;
+
+ // Since oneways cannot raise user exceptions, we have that
+ // case covered as well.
+ if (node->exceptions ())
+ {
+ *os << "_tao_call.invoke (" << be_idt << be_idt_nl
+ << "_tao_" << node->flat_name ()
+ << "_exceptiondata," << be_nl
+ << node->exceptions ()->length () << env_arg << be_uidt_nl
+ << ");" << be_uidt;
+ }
+ else
+ {
+ *os << "_tao_call.invoke (0, 0"
+ << (be_global->use_raw_throw () ? "" : " ACE_ENV_ARG_PARAMETER")
+ << ");";
+ }
+
+ if (this->void_return_type (return_type))
+ {
+ *os << TAO_ACE_CHECK ();
+ }
+ else
+ {
+ *os << TAO_ACE_CHECK ("_tao_retval.excp ()");
+ }
+
+ if (!this->void_return_type (return_type))
+ {
+ *os << be_nl << be_nl
+ << "return _tao_retval.retn ();";
+ }
+
+ *os << be_uidt_nl << "}";
+
+ return 0;
+}
+
+int
+be_visitor_operation::gen_pre_stub_info (
+ be_operation *node
+ )
+{
+ be_visitor_context ctx = *this->ctx_;
+ 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_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;
+}
+
+void
+be_visitor_operation::gen_stub_body_arglist (be_operation *node,
+ TAO_OutStream *os,
+ bool ami)
+{
+ AST_Argument *arg = 0;
+ UTL_ScopeActiveIterator arg_decl_iter (node, UTL_Scope::IK_decls);
+
+ if (ami)
+ {
+ // Skip the reply handler (first argument).
+ arg_decl_iter.next ();
+ }
+
+ for (; ! arg_decl_iter.is_done (); arg_decl_iter.next ())
+ {
+ arg = AST_Argument::narrow_from_decl (arg_decl_iter.item ());
+
+ *os << be_nl
+ << "TAO::Arg_Traits< ";
+
+ this->gen_arg_template_param_name (arg,
+ arg->field_type (),
+ os);
+
+ *os << ">::";
+
+ switch (arg->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "in";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << "inout";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << "out";
+ default:
+ break;
+ }
+
+ *os << "_arg_val _tao_" << arg->local_name () << " ("
+ << arg->local_name () << ");";
+ }
+}
+
+void
+be_visitor_operation::gen_arg_template_param_name (AST_Decl *scope,
+ AST_Type *bt,
+ TAO_OutStream *os)
+{
+ AST_Typedef *alias = 0;
+
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ {
+ alias = AST_Typedef::narrow_from_decl (bt);
+ }
+
+ AST_Decl::NodeType nt = bt->unaliased_type ()->node_type ();
+
+ if (nt == AST_Decl::NT_string || nt == AST_Decl::NT_wstring)
+ {
+ AST_String *s = AST_String::narrow_from_decl (bt->unaliased_type ());
+ unsigned long bound = s->max_size ()->ev ()->u.ulval;
+
+ // If the (w)string is unbounded, code is generated below by the
+ // last line of this method, whether bt is a typedef or not.
+ if (bound > 0)
+ {
+ *os << "::TAO::";
+
+ if (alias != 0)
+ {
+ *os << alias->local_name () << "_" << bound;
+ }
+ else
+ {
+ // If we have an unaliased, bounded (w)string parameter,
+ // we know that be_visitor_arg_traits has used an empty
+ // struct of a type constructed from the flat name of
+ // the parameter's 'enclosing scope' (the parameter
+ // identifier for parameters, and the operation identifier
+ // for return types) to get a unique type for the
+ // Arg_Traits<> template parameter. So we generate it
+ // the same way here, using the 'scope' argument's
+ // flat name.
+ *os << scope->flat_name ();
+ }
+
+ return;
+ }
+ }
+
+ // We need the unaliased type name to make the code block below
+ // work correctly.
+ AST_Type *ut = bt->unaliased_type ();
+ nt = ut->node_type ();
+
+ // For the four predefined types below, we use the helper struct
+ // type, in order to disambiguate the template parameter.
+ if (nt == AST_Decl::NT_pre_defined)
+ {
+ AST_PredefinedType *pdt = AST_PredefinedType::narrow_from_decl (ut);
+
+ switch (pdt->pt ())
+ {
+ case AST_PredefinedType::PT_boolean:
+ *os << "::ACE_InputCDR::to_boolean";
+ return;
+ case AST_PredefinedType::PT_octet:
+ *os << "::ACE_InputCDR::to_octet";
+ return;
+ case AST_PredefinedType::PT_char:
+ *os << "::ACE_InputCDR::to_char";
+ return;
+ case AST_PredefinedType::PT_wchar:
+ *os << "::ACE_InputCDR::to_wchar";
+ return;
+ case AST_PredefinedType::PT_void:
+ break;
+ default:
+ *os << "::";
+ break;
+ }
+ }
+ else
+ {
+ *os << "::";
+ }
+ // For types other than the 4 above, don't unalias the type name
+ // in case it is a sequence or array.
+ *os << bt->name ();
+
+ if (nt == AST_Decl::NT_array)
+ {
+ *os << "_tag";
+ }
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp
new file mode 100644
index 00000000000..795c4a63cd4
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp
@@ -0,0 +1,95 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Operation node in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_operation,
+ operation_ch,
+ "$Id$")
+
+// ******************************************************
+// Primary visitor for "operation" in client header.
+// ******************************************************
+
+be_visitor_operation_ch::be_visitor_operation_ch (be_visitor_context *ctx)
+ : be_visitor_operation (ctx)
+{
+}
+
+be_visitor_operation_ch::~be_visitor_operation_ch (void)
+{
+}
+
+int
+be_visitor_operation_ch::visit_operation (be_operation *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ this->ctx_->node (node);
+
+ *os << be_nl << be_nl << "// 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.
+ be_type *bt = be_type::narrow_from_decl (node->return_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ch::"
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
+ }
+
+ // Grab the right visitor to generate the return type.
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_operation_rettype or_visitor (&ctx);
+
+ if (bt->accept (&or_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ch::"
+ "visit_operation - "
+ "codegen for return type failed\n"),
+ -1);
+ }
+
+ // 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);
+ be_visitor_operation_arglist oa_visitor (&ctx);
+
+ if (node->accept (&oa_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ch::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp
new file mode 100644
index 00000000000..f9304464aef
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp
@@ -0,0 +1,161 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Operation in the stubs file.
+//
+// = AUTHOR
+// Aniruddha Gokhale & Angelo Corsaro
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_operation,
+ operation_cs,
+ "$Id$")
+
+// ************************************************************
+// Operation visitor for client stubs
+// ************************************************************
+
+be_visitor_operation_cs::be_visitor_operation_cs (be_visitor_context *ctx)
+ : be_visitor_operation (ctx)
+{
+}
+
+be_visitor_operation_cs::~be_visitor_operation_cs (void)
+{
+}
+
+// Processing to be done after every element in the scope is processed.
+int
+be_visitor_operation_cs::post_process (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";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_operation_cs::visit_operation (be_operation *node)
+{
+ be_interface *intf = this->ctx_->attribute ()
+ ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
+ : be_interface::narrow_from_scope (node->defined_in ());
+
+ if (!intf)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_cs::"
+ "visit_operation - "
+ "bad interface scope\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node); // save the node for future use
+
+ if (node->is_local ())
+ {
+ return 0;
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // 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_cs::"
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
+ }
+
+ // Generate the return type mapping (same as in the header file)
+ be_visitor_context ctx = *this->ctx_;
+ be_visitor_operation_rettype rt_visitor = (&ctx);
+
+ if (bt->accept (&rt_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_cs::"
+ "visit_operation - "
+ "codegen for return type failed\n"),
+ -1);
+ }
+
+ // Generate the operation name
+ *os << " " << node->name ();
+
+ // Generate the argument list with the appropriate mapping (same as
+ // in the header file)
+ ctx = *this->ctx_;
+ be_visitor_operation_arglist al_visitor (&ctx);
+
+ if (node->accept (&al_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_cs::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ return this->gen_stub_operation_body (node,
+ bt);
+}
+
+int
+be_visitor_operation_cs::visit_argument (be_argument *node)
+{
+ // This method is used to generate the ParamData table entry.
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_cs::"
+ "visit_argument - "
+ "Bad argument type\n"),
+ -1);
+ }
+
+ os->indent ();
+ *os << "{" << bt->tc_name () << ", ";
+
+ switch (node->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "PARAM_IN, ";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << "PARAM_INOUT, ";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << "PARAM_OUT, ";
+ break;
+ }
+
+ *os << "0}";
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_ih.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_ih.cpp
new file mode 100644
index 00000000000..b9e49c20e28
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ih.cpp
@@ -0,0 +1,99 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_ih.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Operation in the implementation header
+//
+// = AUTHOR
+// Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_operation,
+ operation_ih,
+ "$Id$")
+
+// ************************************************************
+// Operation visitor for implementation header.
+// ************************************************************
+
+be_visitor_operation_ih::be_visitor_operation_ih (be_visitor_context *ctx)
+ : be_visitor_operation (ctx)
+{
+}
+
+be_visitor_operation_ih::~be_visitor_operation_ih (void)
+{
+}
+
+int
+be_visitor_operation_ih::visit_operation (be_operation *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ *os << be_nl << be_nl;
+
+ if (be_global->gen_impl_debug_info ())
+ {
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ }
+
+ // every operation is declared virtual in the client code
+ *os << "virtual" << be_nl;
+
+ // STEP I: generate the 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_sh::"
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
+ }
+
+ // grab the right visitor to generate the return type
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_operation_rettype oro_visitor (&ctx);
+
+ if (bt->accept (&oro_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ih::"
+ "visit_operation - "
+ "codegen for return type failed\n"),
+ -1);
+ }
+
+ // 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_IH);
+ be_visitor_operation_arglist oa_visitor (&ctx);
+
+ if (node->accept (&oa_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ih::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ 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
new file mode 100644
index 00000000000..e3390be880f
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_is.cpp
@@ -0,0 +1,111 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_is.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Operation in the implementation skeleton
+//
+// = AUTHOR
+// Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_operation,
+ operation_is,
+ "$Id$")
+
+// ************************************************************
+// Operation visitor for implementation skeleton
+// ************************************************************
+
+be_visitor_operation_is::be_visitor_operation_is (be_visitor_context *ctx)
+ : be_visitor_operation (ctx)
+{
+}
+
+be_visitor_operation_is::~be_visitor_operation_is (void)
+{
+}
+
+int
+be_visitor_operation_is::visit_operation (be_operation *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_interface *intf = this->ctx_->interface ();
+
+ this->ctx_->node (node); // save the node
+
+ // STEP I: generate the 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_is::"
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
+ }
+
+ if (be_global->gen_impl_debug_info ())
+ {
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ }
+
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_operation_rettype oro_visitor (&ctx);
+
+ if (bt->accept (&oro_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_is::"
+ "visit_operation - "
+ "codegen for return type failed\n"),
+ -1);
+ }
+
+ const char *classname = 0;
+
+ if (intf)
+ {
+ // If derived class/
+ classname = intf->flat_name ();
+ }
+ else
+ {
+ classname = ScopeAsDecl (node->defined_in ())->flat_name ();
+ }
+
+ // STEP 2: generate the operation name
+ *os << " " << be_global->impl_class_prefix () << classname
+ << be_global->impl_class_suffix () << "::" << 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_IS);
+ be_visitor_operation_arglist oa_visitor (&ctx);
+
+ if (node->accept (&oa_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_is::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ *os << be_nl << "{" << be_idt_nl;
+ *os << "// Add your implementation here" << be_uidt_nl;
+ *os << "}" << be_nl << be_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
new file mode 100644
index 00000000000..7bba7f41d3b
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp
@@ -0,0 +1,121 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_sh.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Operation in the server header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_operation,
+ operation_sh,
+ "$Id$")
+
+// ************************************************************
+// Operation visitor for server header
+// ************************************************************
+
+be_visitor_operation_sh::be_visitor_operation_sh (be_visitor_context *ctx)
+ : be_visitor_operation (ctx)
+{
+}
+
+be_visitor_operation_sh::~be_visitor_operation_sh (void)
+{
+}
+
+int
+be_visitor_operation_sh::visit_operation (be_operation *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "virtual ";
+
+ // STEP I: generate the 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_sh::"
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
+ }
+
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_operation_rettype oro_visitor (&ctx);
+
+ if (bt->accept (&oro_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_sh::"
+ "visit_operation - "
+ "codegen for return type failed\n"),
+ -1);
+ }
+
+ // STEP 2: generate the operation name
+ *os << " " << node->local_name ();
+
+ // STEP 3: generate the argument list with the appropriate mapping. For these
+ // we grab a visitor that generates the parameter listing
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_SH);
+ be_visitor_operation_arglist oa_visitor (&ctx);
+
+ if (node->accept (&oa_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_sh::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ // Generate the corresponding static skeleton method for this operation only
+ // if there was no "native" type.
+ if (!node->has_native ())
+ {
+ *os << be_nl << be_nl
+ << "static void ";
+
+ // Check if we are an attribute node in disguise.
+ if (this->ctx_->attribute ())
+ {
+ // Now check if we are a "get" or "set" operation
+ if (node->nmembers () == 1)
+ {
+ *os << "_set_";
+ }
+ else
+ {
+ *os << "_get_";
+ }
+ }
+
+ *os << node->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & server_request," << be_nl
+ << "void * servant_upcall," << be_nl
+ << "void * servant" << env_decl << be_uidt_nl
+ << ");" << be_uidt;
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp
new file mode 100644
index 00000000000..34adf67cb75
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp
@@ -0,0 +1,345 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_ss.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Operation in the server skeleton
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+
+ACE_RCSID (be_visitor_operation,
+ operation_ss,
+ "$Id$")
+
+// ************************************************************
+// Operation visitor for server skeletons
+// ************************************************************
+
+be_visitor_operation_ss::be_visitor_operation_ss (be_visitor_context *ctx)
+ : be_visitor_operation (ctx)
+{
+}
+
+be_visitor_operation_ss::~be_visitor_operation_ss (void)
+{
+}
+
+// // Processing to be done after every element in the scope is processed.
+// int
+// be_visitor_operation_ss::post_process (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";
+// }
+
+// return 0;
+// }
+
+int
+be_visitor_operation_ss::visit_operation (be_operation * node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt = 0;
+
+ this->ctx_->node (node);
+
+ os->indent ();
+
+ // If there is an argument of type "native", return immediately.
+ if (node->has_native ())
+ {
+ return 0;
+ }
+
+ // Retrieve the operation return type.
+ bt = be_type::narrow_from_decl (node->return_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ss::"
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
+ }
+
+ return this->gen_skel_operation_body (node, bt);
+}
+
+int
+be_visitor_operation_ss::visit_argument (be_argument *node)
+{
+ // This method is used to generate the ParamData table entry.
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the type for this argument.
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ss::"
+ "visit_argument - "
+ "Bad argument type\n"),
+ -1);
+ }
+
+ os->indent ();
+ *os << "{" << bt->tc_name () << ", ";
+ switch (node->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "::CORBA::ARG_IN, ";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << "::CORBA::ARG_INOUT, ";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << "::CORBA::ARG_OUT, ";
+ break;
+ }
+ *os << "0}";
+
+ return 0;
+}
+
+int
+be_visitor_operation_ss::gen_pre_skel_info (be_operation * node)
+{
+ be_visitor_context ctx = *this->ctx_;
+ be_visitor_operation_exceptlist_ss visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) "
+ "be_visitor_operation_ss::"
+ "gen_pre_skel_info - "
+ "Exception TypeCode list generation error\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_operation_ss::gen_skel_operation_body (be_operation * node,
+ be_type * return_type)
+{
+ TAO_OutStream * const 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 * const intf = this->ctx_->attribute ()
+ ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
+ : be_interface::narrow_from_scope (node->defined_in ());
+
+ if (!intf)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ss::"
+ "visit_operation - "
+ "bad interface scope\n"),
+ -1);
+ }
+
+ ACE_CString upcall_command_name =
+ ACE_CString (node->local_name ()->get_string()) + "_" +
+ ACE_CString (intf->local_name());
+
+ // Check if we are an attribute node in disguise.
+ if (this->ctx_->attribute ())
+ {
+ // Now check if we are a "get" or "set" operation.
+ if (node->nmembers () == 1)
+ {
+ upcall_command_name = "_set_" + upcall_command_name;
+ }
+ else
+ {
+ upcall_command_name = "_get_" + upcall_command_name;
+ }
+ }
+
+ // Generate the local class encapsulating the actual servant upcall
+ // command/invocation.
+ be_visitor_operation_upcall_command_ss upcall_command_visitor (this->ctx_);
+ upcall_command_visitor.visit (node,
+ intf->full_skel_name (),
+ upcall_command_name.c_str ());
+
+ *os << be_nl << be_nl << "// 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.
+ if (this->ctx_->attribute ())
+ {
+ // Now check if we are a "get" or "set" operation.
+ if (node->nmembers () == 1)
+ {
+ *os << "_set_";
+ }
+ else
+ {
+ *os << "_get_";
+ }
+ }
+
+ *os << node->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest & server_request," << be_nl
+ << "void * TAO_INTERCEPTOR (servant_upcall)," << be_nl
+ << "void * servant" << env_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
+ // last argument - is always CORBA::Environment.
+ *os << "{" << be_idt;
+
+ // Generate all the tables and other pre-skel info.
+ if (this->gen_pre_skel_info (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ss::"
+ "visit_operation - "
+ "gen_pre_skel_info failed\n"),
+ -1);
+ }
+
+ // Declare return type helper class.
+
+ *os << "TAO::SArg_Traits< ";
+
+ this->gen_arg_template_param_name (node,
+ return_type,
+ os);
+
+ *os << ">::ret_val retval;";
+
+ // Declare the argument helper classes.
+ this->gen_skel_body_arglist (node, os);
+
+ *os << be_nl << be_nl
+ << "TAO::Argument * const args[] =" << be_idt_nl
+ << "{" << be_idt_nl
+ << "&retval";
+
+ for (UTL_ScopeActiveIterator arg_list_iter (node, UTL_Scope::IK_decls);
+ ! arg_list_iter.is_done ();
+ arg_list_iter.next ())
+ {
+ AST_Argument * const arg =
+ AST_Argument::narrow_from_decl (arg_list_iter.item ());
+
+ *os << "," << be_nl
+ << "&_tao_" << arg->local_name ();
+ }
+
+ *os << be_uidt_nl
+ << "};" << be_uidt_nl << be_nl;
+
+ *os << "static size_t const nargs = "
+ << (node->argument_count () + 1) << ";" << be_nl << be_nl;
+
+ // Get the right object implementation.
+ *os << intf->full_skel_name () << " * const impl =" << be_idt_nl
+ << "static_cast<"
+ << intf->full_skel_name () << " *> (servant);" << be_uidt << be_uidt_nl;
+
+ // Upcall_Command instantiation.
+ *os << be_idt_nl
+ << upcall_command_name.c_str()
+ << " command (" << be_idt_nl
+ << "impl";
+
+ if (!node->void_return_type () || node->argument_count () > 0)
+ {
+ // server_request.operation_details () will be non-zero in the
+ // thru-POA collocation case. Use them if available.
+ *os << "," << be_nl;
+
+ if (be_global->gen_thru_poa_collocation ())
+ *os << "server_request.operation_details ()," << be_nl;
+
+ *os << "args";
+ }
+
+ *os << ");" << be_uidt_nl << be_nl;
+
+
+ *os << "TAO::Upcall_Wrapper upcall_wrapper;" << be_nl
+ << "upcall_wrapper.upcall (server_request" << be_nl
+ << " , args" << be_nl
+ << " , nargs" << be_nl
+ << " , command"
+ << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl
+ << " , servant_upcall" << be_nl
+ << " , exceptions" << be_nl
+ << " , nexceptions"
+ << "\n#endif /* TAO_HAS_INTERCEPTORS == 1 */" << be_nl
+ << " "
+ << (be_global->use_raw_throw () ? "" : "ACE_ENV_ARG_PARAMETER")
+ << ");" << TAO_ACE_CHECK () << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+void
+be_visitor_operation_ss::gen_skel_body_arglist (be_operation * node,
+ TAO_OutStream * os)
+{
+ for (UTL_ScopeActiveIterator arg_decl_iter (node, UTL_Scope::IK_decls);
+ ! arg_decl_iter.is_done ();
+ arg_decl_iter.next ())
+ {
+ AST_Argument * const arg =
+ AST_Argument::narrow_from_decl (arg_decl_iter.item ());
+
+ *os << be_nl
+ << "TAO::SArg_Traits< ";
+
+ this->gen_arg_template_param_name (arg,
+ arg->field_type (),
+ os);
+
+ *os << ">::";
+
+ switch (arg->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "in";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << "inout";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << "out";
+ default:
+ break;
+ }
+
+ *os << "_arg_val _tao_" << arg->local_name () << ";";
+ }
+}
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
new file mode 100644
index 00000000000..2990b9fde70
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp
@@ -0,0 +1,63 @@
+// $Id$
+
+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 (ctx)
+{
+}
+
+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 = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "static void" << be_nl;
+
+ // Check if we are an attribute node in disguise.
+ if (this->ctx_->attribute ())
+ {
+ // Now check if we are a "get" or "set" operation.
+ if (node->nmembers () == 1)
+ {
+ *os << "_set_";
+ }
+ else
+ {
+ *os << "_get_";
+ }
+ }
+
+ *os << node->local_name () << " (" << be_idt << be_idt_nl
+ << "TAO_Abstract_ServantBase *servant," << be_nl
+ << "TAO::Argument ** args," << be_nl
+ << "int num_args" << env_decl << be_uidt_nl
+ << ")";
+
+ if (this->gen_throw_spec (node) != 0)
+ {
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_operation_proxy_impl_xh::"
+ "visit_operation - "
+ "throw spec generation failed\n"
+ ),
+ -1
+ );
+ }
+
+ *os << ";";
+
+ 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
new file mode 100644
index 00000000000..49834dd76e3
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp
@@ -0,0 +1,144 @@
+// $Id$
+
+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)
+{
+}
+
+be_visitor_operation_remote_proxy_impl_cs::
+~be_visitor_operation_remote_proxy_impl_cs (void)
+{
+}
+
+// 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.
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (!this->last_node (bd))
+ {
+ *os << "," << be_nl;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_operation_remote_proxy_impl_cs::visit_operation (
+ be_operation *node
+ )
+{
+ if (node->is_local ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ // 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_remote_proxy_impl_cs::"
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Generate the return type mapping (same as in the header file)
+ be_visitor_context ctx = *this->ctx_;
+ be_visitor_operation_rettype ort_visitor (&ctx);
+
+ if (bt->accept (&ort_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);
+ }
+
+ // 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 ();
+
+ // Generate the argument list with the appropriate mapping (same as
+ // in the header file).
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XS);
+ be_visitor_operation_arglist arglist_visitor (&ctx);
+
+ if (node->accept (&arglist_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ // 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.
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ // 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_remote_proxy_impl_cs::"
+ "visit_argument - "
+ "Bad argument type\n"),
+ -1);
+ }
+
+ os->indent ();
+ *os << "{" << bt->tc_name () << ", ";
+
+ switch (node->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "PARAM_IN, ";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << "PARAM_INOUT, ";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << "PARAM_OUT, ";
+ break;
+ }
+ *os << "0}";
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp
new file mode 100644
index 00000000000..d638fcb6eea
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp
@@ -0,0 +1,406 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// rettype.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for return type of the Operation node
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_operation,
+ rettype,
+ "$Id$")
+
+
+// ****************************************************************************
+// Operation visitor for return types. This generates the mapping for a return
+// type in an operation signature
+// ****************************************************************************
+
+be_visitor_operation_rettype::be_visitor_operation_rettype (be_visitor_context
+ *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_operation_rettype::~be_visitor_operation_rettype (void)
+{
+}
+
+int
+be_visitor_operation_rettype::visit_array (be_array *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ // A typedefed return type.
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ *os << "::" << bt->name () << "_slice *";
+
+ return 0;
+}
+
+int
+be_visitor_operation_rettype::visit_enum (be_enum *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ // A typedefed return type.
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ *os << "::" << bt->name ();
+
+ return 0;
+}
+
+int
+be_visitor_operation_rettype::visit_interface (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ // A typedefed return type.
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ *os << "::" << bt->name () << "_ptr";
+
+ return 0;
+}
+
+int
+be_visitor_operation_rettype::visit_interface_fwd (be_interface_fwd *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ // A typedefed return type.
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ *os << "::" << bt->name () << "_ptr";
+
+ return 0;
+}
+
+int
+be_visitor_operation_rettype::visit_native (be_native *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ // A typedefed return type.
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ *os << "::" << bt->name ();
+
+ return 0;
+}
+
+int
+be_visitor_operation_rettype::visit_predefined_type (be_predefined_type *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ // A typedefed return type.
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ AST_PredefinedType::PredefinedType pt = node->pt ();
+
+ if (pt != AST_PredefinedType::PT_void)
+ {
+ *os << "::";
+ }
+
+ switch (pt)
+ {
+ case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
+ *os << bt->name ();
+
+ // 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";
+ }
+
+ break;
+ case AST_PredefinedType::PT_any:
+ case AST_PredefinedType::PT_value:
+ {
+ *os << bt->name () << " *";
+
+ break;
+ }
+ default:
+ {
+ *os << bt->name ();
+
+ break;
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_operation_rettype::visit_sequence (be_sequence *node)
+{
+ // We should never directly be here because anonymous sequence return types
+ // are not allowed.
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ // A typedefed return type.
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ *os << "::" << bt->name () << " *";
+
+ return 0;
+}
+
+int
+be_visitor_operation_rettype::visit_string (be_string *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "char *";
+ }
+ else
+ {
+ *os << "::CORBA::WChar *";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_operation_rettype::visit_structure (be_structure *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ // A typedefed return type.
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ 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 () == AST_Type::VARIABLE)
+ {
+ *os << " *";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_operation_rettype::visit_typedef (be_typedef *node)
+{
+ // Set the alias node.
+ this->ctx_->alias (node);
+
+ if (node->primitive_base_type ()->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_operation_rettype::"
+ "visit_typedef - "
+ "accept on primitive type failed\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_operation_rettype::visit_union (be_union *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ // A typedefed return type.
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ 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 () == AST_Type::VARIABLE)
+ {
+ *os << " *";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_operation_rettype::visit_valuetype (be_valuetype *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ // A typedefed return type.
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ *os << "::" << bt->name () << " *";
+
+ return 0;
+}
+
+int
+be_visitor_operation_rettype::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ // A typedefed return type.
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ *os << "::" << bt->name () << " *";
+
+ return 0;
+}
+
+int
+be_visitor_operation_rettype::visit_component (be_component *node)
+{
+ return this->visit_interface (node);
+}
+
+int
+be_visitor_operation_rettype::visit_component_fwd (be_component_fwd *node)
+{
+ return this->visit_interface_fwd (node);
+}
+
+int
+be_visitor_operation_rettype::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_operation_rettype::visit_eventtype_fwd (be_eventtype_fwd *node)
+{
+ return this->visit_valuetype_fwd (node);
+}
+
+int
+be_visitor_operation_rettype::visit_home (be_home *node)
+{
+ return this->visit_interface (node);
+}
+
+int
+be_visitor_operation_rettype::visit_valuebox (be_valuebox *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ // A typedefed return type.
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ *os << "::" << bt->name () << " *";
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_return_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_return_cs.cpp
new file mode 100644
index 00000000000..fa7e91171b3
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_return_cs.cpp
@@ -0,0 +1,247 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// rettype_return_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for returning the return type variable.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_operation,
+ rettype_return_cs,
+ "$Id$")
+
+// ************************************************************
+// be_visitor_operation_rettype_return_cs
+//
+// code to generate the return statement of the stub.
+// ************************************************************
+
+be_visitor_operation_rettype_return_cs::
+be_visitor_operation_rettype_return_cs (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_operation_rettype_return_cs::
+~be_visitor_operation_rettype_return_cs (void)
+{
+}
+
+int
+be_visitor_operation_rettype_return_cs::visit_array (be_array *)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "_tao_retval._retn ()";
+
+ return 0;
+}
+
+int
+be_visitor_operation_rettype_return_cs::visit_enum (be_enum *)
+{
+ 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 ();
+
+ *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 ();
+
+ *os << "_tao_retval";
+
+ return 0;
+}
+
+int
+be_visitor_operation_rettype_return_cs::visit_valuebox (be_valuebox *)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "_tao_retval._retn ()";
+
+ return 0;
+}
+
+int
+be_visitor_operation_rettype_return_cs::visit_valuetype (be_valuetype *)
+{
+ 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 ();
+
+ *os << "_tao_retval._retn ()";
+
+ return 0;
+}
+
+int
+be_visitor_operation_rettype_return_cs::visit_predefined_type (
+ be_predefined_type *node
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
+ *os << "_tao_retval._retn ()";
+
+ break;
+ case AST_PredefinedType::PT_any:
+ *os << "_tao_retval._retn ()";
+
+ 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 ();
+
+ *os << "_tao_retval._retn ()";
+
+ return 0;
+}
+
+int
+be_visitor_operation_rettype_return_cs::visit_string (be_string *)
+{
+ 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 ();
+
+ if (node->size_type () == AST_Type::VARIABLE)
+ {
+ *os << "_tao_retval._retn ()";
+ }
+ else
+ {
+ *os << "_tao_retval";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_operation_rettype_return_cs::visit_typedef (be_typedef *node)
+{
+ this->ctx_->alias (node);
+
+ if (node->primitive_base_type ()->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_operation_rettype_return_cs::"
+ "visit_typedef - "
+ "accept on primitive type failed\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_operation_rettype_return_cs::visit_union (be_union *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (node->size_type () == AST_Type::VARIABLE)
+ {
+ *os << "_tao_retval._retn ()";
+ }
+ else
+ {
+ *os << "_tao_retval";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_operation_rettype_return_cs::visit_component (be_component *node)
+{
+ return this->visit_interface (node);
+}
+
+int
+be_visitor_operation_rettype_return_cs::visit_component_fwd (
+ be_component_fwd *node
+ )
+{
+ return this->visit_interface_fwd (node);
+}
+
+int
+be_visitor_operation_rettype_return_cs::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_operation_rettype_return_cs::visit_eventtype_fwd (
+ be_eventtype_fwd *node
+ )
+{
+ return this->visit_valuetype_fwd (node);
+}
+
+int
+be_visitor_operation_rettype_return_cs::visit_home (be_home *node)
+{
+ return this->visit_interface (node);
+}
+
+
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
new file mode 100644
index 00000000000..1e34b2b8db5
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_ch.cpp
@@ -0,0 +1,102 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_smart_proxy_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Operation node in the client header.
+//
+// = AUTHOR
+// Kirthika Parameswaran <kirthika@cs.wustl.edu>
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_operation,
+ smart_proxy_ch,
+ "$Id$")
+
+// ******************************************************
+// 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_scope (ctx)
+{
+}
+
+be_visitor_operation_smart_proxy_ch::~be_visitor_operation_smart_proxy_ch (
+ void
+ )
+{
+}
+
+int
+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 ();
+
+ *os << "virtual ";
+
+ // STEP I: generate the 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_smart_proxy_ch::"
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
+ }
+
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_operation_rettype or_visitor (&ctx);
+
+ if (bt->accept (&or_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_smart_proxy_ch::"
+ "visit_operation - "
+ "codegen for return type failed\n"),
+ -1);
+ }
+
+ // 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);
+ be_visitor_operation_arglist oa_visitor (&ctx);
+
+ if (node->accept (&oa_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_smart_proxy_ch::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+ }
+ else
+ {
+ ACE_UNUSED_ARG (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
new file mode 100644
index 00000000000..984a49b9da8
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_cs.cpp
@@ -0,0 +1,172 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_smart_proxy_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Operation in the stubs file.
+//
+// = AUTHOR
+// Kirthika Parameswaran <kirthika@cs.wustl.edu>
+//
+// ============================================================================
+
+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_operation (ctx)
+{
+}
+
+be_visitor_operation_smart_proxy_cs::~be_visitor_operation_smart_proxy_cs (
+ void
+ )
+{
+}
+
+int be_visitor_operation_smart_proxy_cs::visit_operation (be_operation *node)
+{
+ if (be_global->gen_smart_proxies ())
+ {
+ 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 = this->ctx_->attribute ()
+ ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
+ : be_interface::narrow_from_scope (node->defined_in ());
+
+ if (!intf)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_smart_proxy_cs::"
+ "visit_operation - "
+ "bad interface scope\n"),
+ -1);
+ }
+
+ be_type *bt = be_type::narrow_from_decl (node->return_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_smart_proxy_cs::"
+ "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_);
+ be_visitor_operation_rettype oro_visitor (&ctx);
+
+ if (bt->accept (&oro_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_smart_proxy_cs::"
+ "visit_operation - "
+ "codegen for return type failed\n"),
+ -1);
+ }
+
+ // 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
+ // node (i.e the operation) is already in a scope lower than intf
+ // (i.e. be_interface), so for deciding the exact scope use intf.
+
+ be_decl* scope = be_scope::narrow_from_scope (intf->defined_in ())->decl ();
+
+ *os << " ";
+ *os << scope->full_name ();
+
+ // Only if there exists any nesting "::" is needed!
+ if (intf->is_nested ())
+ *os << "::";
+
+ *os << "TAO_" << intf->flat_name () <<"_Smart_Proxy_Base::";
+ *os << node->local_name () << " ";
+
+ // STEP 4: generate the argument list with the appropriate mapping (same as
+ // in the header file)
+ ctx = *this->ctx_;
+ be_visitor_operation_arglist oao_visitor (&ctx);
+
+ if (node->accept (&oao_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ss::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ *os << "{" << be_idt << "\n";
+
+ os->indent ();
+
+ // Simply make the call and leave everything to the layer
+ // above, i.e. the client code.
+ if (!this->void_return_type (bt))
+ {
+ *os << "return ";
+ }
+
+ *os << "this->get_proxy ()";
+
+ if (this->gen_invoke (ctx, node) == -1)
+ return -1;
+
+ *os << be_uidt_nl
+ << "}\n\n";
+ }
+ else
+ {
+ ACE_UNUSED_ARG (node);
+ }
+
+ return 0;
+}
+
+int be_visitor_operation_smart_proxy_cs::gen_invoke (be_visitor_context &ctx,
+ be_operation *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "->" << node->local_name () << " ("
+ << be_idt << be_idt << "\n";
+
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS);
+ be_visitor_operation_argument visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_smart_proxy_cs::"
+ "gen_invoke - "
+ "codegen for making upcall failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl
+ << ");\n" << be_uidt;
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/tie_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/tie_sh.cpp
new file mode 100644
index 00000000000..a0fc6da455e
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/tie_sh.cpp
@@ -0,0 +1,95 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// tie_sh.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for operations of the TIE class in the header
+// file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_operation,
+ tie_sh,
+ "$Id$")
+
+// ************************************************************
+// Operation visitor for server header for TIE class operations.
+// ************************************************************
+
+be_visitor_operation_tie_sh::be_visitor_operation_tie_sh (
+ be_visitor_context *ctx
+ )
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_operation_tie_sh::~be_visitor_operation_tie_sh (void)
+{
+}
+
+int
+be_visitor_operation_tie_sh::visit_operation (be_operation *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ // STEP I: generate the return type.
+ be_type *bt = be_type::narrow_from_decl (node->return_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_tie_sh::"
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_operation_rettype oro_visitor (&ctx);
+
+ if (bt->accept (&oro_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_tie_sh::"
+ "visit_operation - "
+ "codegen for return type failed\n"),
+ -1);
+ }
+
+ // STEP 2: generate the operation name.
+ *os << " " << node->local_name ();
+
+ // STEP 3: generate the argument list with the appropriate mapping. For these
+ // we grab a visitor that generates the parameter listing
+ ctx = *this->ctx_;
+ // we use the _CH state here because the _SH state produces pure virtual
+ // methods.
+ ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_CH);
+ be_visitor_operation_arglist oa_visitor (&ctx);
+
+ if (node->accept (&oa_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_tie_sh::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/tie_si.cpp b/TAO/TAO_IDL/be/be_visitor_operation/tie_si.cpp
new file mode 100644
index 00000000000..ffa3758d8c8
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/tie_si.cpp
@@ -0,0 +1,164 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// tie_si.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for operations for the TIE class.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_operation,
+ tie_si,
+ "$Id$")
+
+// ************************************************************
+// Operation visitor for server inline for TIE class operations.
+// ************************************************************
+
+be_visitor_operation_tie_si::be_visitor_operation_tie_si (
+ be_visitor_context *ctx
+ )
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_operation_tie_si::~be_visitor_operation_tie_si (void)
+{
+}
+
+int be_visitor_operation_tie_si::visit_operation (be_operation *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ be_interface *intf = this->ctx_->interface ();
+
+ if (!intf)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_tie_si::"
+ "visit_operation - "
+ "bad interface scope\n"),
+ -1);
+ }
+
+ // Retrieve the operation return type.
+ be_type *bt = be_type::narrow_from_decl (node->return_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_tie_si::"
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
+ }
+
+ // Although unlikely it is possible that the 'T' in 'template class<T>' will
+ // conflict with an argument name...
+ ACE_CString template_name ("T");
+ bool template_name_ok = false;
+
+ while (!template_name_ok)
+ {
+ template_name_ok = true;
+
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ ! si.is_done () && template_name_ok;
+ si.next ())
+ {
+ // Check for conflicts between the arg name and the proposed template
+ // class identifier
+ AST_Argument *arg =
+ AST_Argument::narrow_from_decl (si.item ());
+
+ if (! ACE_OS::strcmp (arg->local_name ()->get_string (),
+ template_name.c_str ()))
+ {
+ // clash !
+ template_name_ok = false;
+ }
+ }
+
+ if (! template_name_ok)
+ {
+ // We had a clash - postfix an underscore and try again
+ template_name += "_";
+ }
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "template <class " << template_name.c_str () << "> ACE_INLINE\n";
+
+ // Generate the return type mapping (same as in the header file).
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_operation_rettype oro_visitor (&ctx);
+
+ if (bt->accept (&oro_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_tie_si::"
+ "visit_operation - "
+ "codegen for return type failed\n"),
+ -1);
+ }
+
+ *os << " " << intf->full_skel_name () << "_tie<" << template_name.c_str () << ">::"
+ << node->local_name () << " ";
+
+ // STEP 4: generate the argument list with the appropriate mapping (same as
+ // in the header file)
+ ctx = *this->ctx_;
+ be_visitor_operation_arglist oao_visitor (&ctx);
+
+ if (node->accept (&oao_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_cs::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ *os << be_nl << "{" << be_idt_nl;
+
+ be_predefined_type *pdt = be_predefined_type::narrow_from_decl (bt);
+
+ if (pdt == 0 || pdt->pt () != AST_PredefinedType::PT_void)
+ {
+ *os << "return ";
+ }
+
+ *os << "this->ptr_->" << node->local_name () << " (" << be_idt;
+
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS);
+ be_visitor_operation_argument ocau_visitor (&ctx);
+
+ if (node->accept (&ocau_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ss::"
+ "visit_operation - "
+ "codegen for making upcall failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl;
+ *os << ");" << be_uidt_nl;
+ *os << "}";
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/upcall_command_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/upcall_command_ss.cpp
new file mode 100644
index 00000000000..bdf0aff984d
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/upcall_command_ss.cpp
@@ -0,0 +1,410 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// upcall_command_ss.cpp
+//
+// = DESCRIPTION
+// Visitor that generates operation-specific TAO::Upcall_Command
+// objects in skeletons.
+//
+// = AUTHOR
+// Ossama Othman
+//
+// ============================================================================
+
+
+ACE_RCSID (be_visitor_operation,
+ upcall_command_ss,
+ "$Id$")
+
+be_visitor_operation_upcall_command_ss
+::be_visitor_operation_upcall_command_ss (
+ be_visitor_context *ctx)
+ : be_visitor_operation (ctx)
+{
+}
+
+be_visitor_operation_upcall_command_ss
+::~be_visitor_operation_upcall_command_ss (void)
+{
+}
+
+// The following needs to be done to deal until the MSVC compiler's broken
+// handling of namespaces is fixed (hopefully forthcoming in version 7).
+int
+be_visitor_operation_upcall_command_ss
+::gen_nested_namespace_begin (be_module *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ char *item_name = 0;
+ bool first_level = true;
+
+ for (UTL_IdListActiveIterator i (node->name ()); !i.is_done (); i.next ())
+ {
+ item_name = i.item ()->get_string ();
+
+ if (ACE_OS::strcmp (item_name, "") != 0)
+ {
+ // Leave the outermost root scope.
+ *os << "namespace ";
+
+ if (first_level)
+ {
+ // We are outermost module.
+ *os << "POA_";
+ first_level = false;
+ }
+
+ *os << item_name << be_nl
+ << "{" << be_idt_nl;
+ }
+ }
+
+ return 0;
+}
+
+// The following needs to be done to deal until the MSVC compiler's broken
+// handling of namespaces is fixed (hopefully forthcoming in version 7).
+int
+be_visitor_operation_upcall_command_ss
+::gen_nested_namespace_end (be_module *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ for (UTL_IdListActiveIterator i (node->name ()); !i.is_done (); i.next ())
+ {
+ if (ACE_OS::strcmp (i.item ()->get_string (), "") != 0)
+ {
+ // Leave the outermost root scope.
+ *os << be_uidt_nl << "}" << be_nl;
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_operation_upcall_command_ss::visit (be_operation * node,
+ char const * full_skel_name,
+ char const * upcall_command_name)
+{
+ be_interface * const intf = this->ctx_->attribute ()
+ ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
+ : be_interface::narrow_from_scope (node->defined_in ());
+
+ be_module *module = 0;
+
+ // Is our enclosing scope a module? We need this check because for
+ // platforms that support namespaces, the typecode must be declared
+ // extern.
+ if (intf->is_nested () &&
+ intf->defined_in ()->scope_node_type () == AST_Decl::NT_module)
+ {
+ module = be_module::narrow_from_scope (intf->defined_in ());
+
+ if (!module || (this->gen_nested_namespace_begin (module) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_operation_upcall_command_ss::visit - "
+ "Error parsing nested name\n"),
+ -1);
+ }
+ }
+
+ be_visitor_context ctx (*this->ctx_);
+
+ // save the node.
+ this->ctx_->node (node);
+
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Generate the operation-specific TAO::Upcall_Command concrete class.
+
+ if (!intf)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_upcall_command_ss::"
+ "visit - "
+ "bad interface scope\n"),
+ -1);
+ }
+
+ // Generate an operation-specific concrete TAO::Upcall_Command
+ // class, an instance of which will be invoked by the
+ // TAO::Upcall_Wrapper object.
+
+ os << "class " << upcall_command_name << be_nl
+ << " : public TAO::Upcall_Command" << be_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl ;
+
+ // Generate constructor
+ os << "inline " << upcall_command_name
+ << " (" << be_idt_nl
+ << full_skel_name << " * servant";
+
+ // No need to accept an argument array parameter if the operation
+ // has no arguments.
+ if (!node->void_return_type () || node->argument_count () > 0)
+ {
+ os << "," << be_nl;
+
+ if (be_global->gen_thru_poa_collocation ())
+ os << "TAO_Operation_Details const * operation_details," << be_nl;
+
+ os << "TAO::Argument * const args[])" << be_nl;
+ }
+ else
+ {
+ os << ")" << be_nl;
+ }
+
+ os << ": servant_ (servant)";
+
+ // If the operation has no arguments don't generate a member
+ // initializer for the class argument array member/attribute.
+ if (!node->void_return_type () || node->argument_count () > 0)
+ {
+ os << be_idt_nl;
+
+ if (be_global->gen_thru_poa_collocation ())
+ {
+ os << ", operation_details_ (operation_details)" << be_nl;
+ }
+
+ os << ", args_ (args)" << be_uidt;
+ }
+
+ os << be_uidt_nl;
+
+ os << "{" << be_nl
+ << "}" << be_nl << be_nl;
+
+ // Generate execute() method.
+ os << "virtual void execute ("
+ << (be_global->use_raw_throw () ? "void" : "ACE_ENV_SINGLE_ARG_DECL")
+ << ")" << be_nl
+ << "{" << be_idt_nl;
+
+ if (!node->void_return_type ())
+ {
+ os << "TAO::SArg_Traits< ";
+
+
+ this->gen_arg_template_param_name (node,
+ node->return_type (),
+ &os);
+
+ os << ">::ret_arg_type retval =" << be_idt_nl;
+
+ if (be_global->gen_thru_poa_collocation ())
+ {
+ os << "TAO::Portable_Server::get_ret_arg< ";
+
+ this->gen_arg_template_param_name (node,
+ node->return_type (),
+ &os);
+
+ os << "> (" << be_idt_nl
+ << "this->operation_details_," << be_nl
+ << "this->args_);" << be_uidt;
+ }
+ else
+ {
+ os << "static_cast<TAO::SArg_Traits< ";
+
+ this->gen_arg_template_param_name (node,
+ node->return_type (),
+ &os);
+
+ os << ">::ret_val *> (this->args_[0])->arg ();";
+ }
+
+ os << be_uidt_nl << be_nl;
+ }
+
+ if (this->gen_upcall (node) == -1)
+ {
+ return -1;
+ }
+
+ os << "}" << be_uidt_nl << be_nl;
+
+ // Generate class attributes.
+ os << "private:" << be_idt_nl
+ << full_skel_name << " * const servant_;";
+
+ // Don't bother generating an argument array attribute if the
+ // operation has no arguments.
+ if (!node->void_return_type () || node->argument_count () > 0)
+ {
+ os << be_nl;
+
+ if (be_global->gen_thru_poa_collocation ())
+ os << "TAO_Operation_Details const * const operation_details_;" << be_nl;
+
+ os << "TAO::Argument * const * const args_;";
+ }
+
+ os << be_uidt_nl
+ << "};";
+
+ if (module != 0)
+ {
+ if (this->gen_nested_namespace_end (module) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_operation_upcall_command_ss::visit - "
+ "Error parsing nested name\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_operation_upcall_command_ss::gen_upcall (be_operation * node)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ UTL_ScopeActiveIterator si (node,
+ UTL_Scope::IK_decls);
+
+ unsigned int index = 1;
+
+ for (; !si.is_done (); si.next (), ++index)
+ {
+ AST_Argument * const arg =
+ AST_Argument::narrow_from_decl (si.item ());
+
+ os << "TAO::SArg_Traits< ";
+
+ this->gen_arg_template_param_name (arg,
+ arg->field_type (),
+ &os);
+
+ os << ">::";
+
+ switch (arg->direction ())
+ {
+ case AST_Argument::dir_IN:
+ os << "in";
+ break;
+ case AST_Argument::dir_INOUT:
+ os << "inout";
+ break;
+ case AST_Argument::dir_OUT:
+ os << "out";
+ default:
+ break;
+ }
+
+ os << "_arg_type arg_" << index << " =" << be_idt_nl;
+
+ if (be_global->gen_thru_poa_collocation ())
+ {
+ os << "TAO::Portable_Server::get_";
+
+ switch (arg->direction ())
+ {
+ case AST_Argument::dir_IN:
+ os << "in";
+ break;
+ case AST_Argument::dir_INOUT:
+ os << "inout";
+ break;
+ case AST_Argument::dir_OUT:
+ os << "out";
+ default:
+ break;
+ }
+
+ os << "_arg< ";
+
+ this->gen_arg_template_param_name (arg,
+ arg->field_type (),
+ &os);
+
+ os << "> (" << be_idt_nl
+ << "this->operation_details_," << be_nl
+ << "this->args_," << be_nl
+ << index << ");" << be_uidt_nl;
+ }
+ else
+ {
+ os << "static_cast<TAO::SArg_Traits< ";
+
+ this->gen_arg_template_param_name (arg,
+ arg->field_type (),
+ &os);
+
+ os << ">::";
+
+ switch (arg->direction ())
+ {
+ case AST_Argument::dir_IN:
+ os << "in";
+ break;
+ case AST_Argument::dir_INOUT:
+ os << "inout";
+ break;
+ case AST_Argument::dir_OUT:
+ os << "out";
+ default:
+ break;
+ }
+
+ os << "_arg_val *> (this->args_[" << index << "])->arg ();"
+ << be_nl;
+ }
+
+ os << be_uidt_nl;
+
+ }
+
+ if (!node->void_return_type ())
+ {
+ os << "retval =" << be_idt_nl;
+ }
+
+ os << "this->servant_->" << node->local_name () << " ("
+ << be_idt;
+
+ size_t const count = node->argument_count ();
+
+ for (unsigned int i = 0; i < count; ++i)
+ {
+ os << be_nl
+ << (i == 0 ? "" : ", ") << "arg_" << i + 1;
+ }
+
+ if (count > 0)
+ {
+ os << env_arg;
+ }
+ else
+ {
+ os << env_sngl_arg;
+ }
+
+ os << ");";
+
+ if (!node->void_return_type ())
+ {
+ os << be_uidt;
+ }
+
+ os << be_uidt
+ << TAO_ACE_CHECK () << be_uidt_nl;
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_root.cpp b/TAO/TAO_IDL/be/be_visitor_root.cpp
new file mode 100644
index 00000000000..3cee0de1265
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_root.cpp
@@ -0,0 +1,80 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_root.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Root
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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_valuebox.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_eventtype.h"
+#include "be_eventtype_fwd.h"
+#include "be_component.h"
+#include "be_component_fwd.h"
+#include "be_home.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_valuebox.h"
+#include "be_visitor_valuetype.h"
+#include "be_visitor_valuetype_fwd.h"
+#include "be_visitor_component.h"
+#include "be_visitor_component_fwd.h"
+#include "be_visitor_home.h"
+#include "be_visitor_traits.h"
+#include "be_visitor_arg_traits.h"
+#include "be_visitor_context.h"
+
+#include "be_visitor_root/root.cpp"
+#include "be_visitor_root/root_ch.cpp"
+#include "be_visitor_root/root_ci.cpp"
+#include "be_visitor_root/root_cs.cpp"
+#include "be_visitor_root/root_sh.cpp"
+#include "be_visitor_root/root_si.cpp"
+#include "be_visitor_root/root_ss.cpp"
+#include "be_visitor_root/root_sth.cpp"
+#include "be_visitor_root/root_is.cpp"
+#include "be_visitor_root/root_ih.cpp"
+#include "be_visitor_root/any_op.cpp"
+#include "be_visitor_root/cdr_op.cpp"
+#include "be_visitor_root/serializer_op.cpp"
+
+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
new file mode 100644
index 00000000000..9455e261b8a
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_root/any_op.cpp
@@ -0,0 +1,69 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the Any operators for types defined in Root's
+// scope.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_root,
+ any_op,
+ "$Id$")
+
+// ***************************************************************************
+// Root visitor for generating Any operator declarations in the client header
+// and stub
+// ***************************************************************************
+
+be_visitor_root_any_op::be_visitor_root_any_op (be_visitor_context *ctx)
+ : be_visitor_root (ctx)
+{
+}
+
+be_visitor_root_any_op::~be_visitor_root_any_op (void)
+{
+}
+
+int
+be_visitor_root_any_op::visit_root (be_root *node)
+{
+ if (be_global->gen_anyop_files ())
+ {
+ // Switch streams, ctx will be reassigned when this
+ // pass is done.
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ this->ctx_->stream (tao_cg->anyop_header ());
+ break;
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ this->ctx_->stream (tao_cg->anyop_source ());
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::visit_root - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_root/cdr_op.cpp b/TAO/TAO_IDL/be/be_visitor_root/cdr_op.cpp
new file mode 100644
index 00000000000..24bee065237
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_root/cdr_op.cpp
@@ -0,0 +1,52 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the CDR operators for types defined
+// in Root's scope.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_root,
+ cdr_op,
+ "$Id$")
+
+// ***************************************************************************
+// Root visitor for generating CDR operator declarations in the client header
+// and stub
+// ***************************************************************************
+
+be_visitor_root_cdr_op::be_visitor_root_cdr_op (be_visitor_context *ctx)
+ : be_visitor_root (ctx)
+{
+}
+
+be_visitor_root_cdr_op::~be_visitor_root_cdr_op (void)
+{
+}
+
+int
+be_visitor_root_cdr_op::visit_root (be_root *node)
+{
+ 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);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root.cpp b/TAO/TAO_IDL/be/be_visitor_root/root.cpp
new file mode 100644
index 00000000000..9c3ce0b4462
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_root/root.cpp
@@ -0,0 +1,1738 @@
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the Root node. This is a generic visitor.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+ACE_RCSID (be_visitor_root,
+ root,
+ "$Id$")
+
+// Generic Root visitor
+be_visitor_root::be_visitor_root (be_visitor_context *ctx)
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_root::~be_visitor_root (void)
+{
+}
+
+// This method must be overridden by the derived root visitors.
+int
+be_visitor_root::init (void)
+{
+ return -1;
+}
+
+int be_visitor_root::visit_root (be_root *node)
+{
+ // Open the appropriate output file based on what state we are in. The
+ // overridden "init" method of derived classes will do the job.
+ if (this->init () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::init - "
+ "failed to initialize context\n"),
+ -1);
+ }
+
+ // The SI and SS cases are caught in BE_produce()
+ if (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_SH
+ && !be_global->gen_skel_files ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream * const os = this->ctx_->stream ();
+
+ int status = 0;
+ be_visitor_context ctx = *this->ctx_;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_arg_traits arg_visitor ("", &ctx);
+ status = node->accept (&arg_visitor);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_root - "
+ "failed to generate stub arg traits\n"),
+ -1);
+ }
+ }
+
+ break;
+ case TAO_CodeGen::TAO_ROOT_SS:
+ {
+ be_visitor_arg_traits arg_visitor ("S", &ctx);
+ status = node->accept (&arg_visitor);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_root - "
+ "failed to generate skeleton arg traits\n"),
+ -1);
+ }
+
+ if (be_global->gen_thru_poa_collocation ()
+ || be_global->gen_direct_collocation ())
+ {
+ be_visitor_arg_traits arg_visitor ("", &ctx);
+ status = node->accept (&arg_visitor);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_root - "
+ "failed to generate collocated skeleton arg traits\n"),
+ -1);
+ }
+ }
+ }
+
+ break;
+ default:
+ break;
+ }
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::visit_root - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ // If we are generating the client header file, this is the place to
+ // generate the proxy broker factory function pointer declarations
+ // and the extern declarations for non-defined interfaces.
+ if (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_CH)
+ {
+ 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 << be_nl << be_nl
+ << "// Proxy Broker Factory function pointer declarations."
+ << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+ }
+
+ for (index = 0; index < size; ++index)
+ {
+ be_global->non_local_interfaces.dequeue_head (i);
+
+ *os << be_nl << be_nl
+ << "extern " << be_global->stub_export_macro () << be_nl
+ << "TAO::Collocation_Proxy_Broker *" << be_nl
+ << "(*" << i->flat_client_enclosing_scope ()
+ << i->base_proxy_broker_name ()
+ << "_Factory_function_pointer) ("
+ << be_idt << be_idt_nl
+ << "::CORBA::Object_ptr obj" << be_uidt_nl
+ << ");" << be_uidt;
+ }
+
+ size = be_global->non_defined_interfaces.size ();
+
+ if (size > 0)
+ {
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+ }
+
+ for (index = 0; index < size; ++index)
+ {
+ be_global->non_defined_interfaces.dequeue_head (ifwd);
+
+ *os << be_nl << be_nl;
+
+ if (ifwd->is_valuetype ())
+ {
+ *os << "// External declarations for undefined valuetype"
+ << be_nl << 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_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;
+ }
+ }
+
+ size = be_global->mixed_parentage_interfaces.size ();
+
+ if (size > 0)
+ {
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << 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
+ << "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
+ << "}";
+
+ *os << be_global->core_versioning_end () << be_nl;
+ }
+ }
+
+ // Make one more pass over the entire tree and generate the OBV_ namespaces
+ // and OBV_ classes.
+
+ bool obv = 1;
+ status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ ctx.state (TAO_CodeGen::TAO_MODULE_OBV_CH);
+ break;
+ case TAO_CodeGen::TAO_ROOT_CI:
+ ctx.state (TAO_CodeGen::TAO_MODULE_OBV_CI);
+ break;
+ case TAO_CodeGen::TAO_ROOT_CS:
+ ctx.state (TAO_CodeGen::TAO_MODULE_OBV_CS);
+ break;
+ default:
+ obv = 0;
+ break;
+ }
+
+ if (obv == 1)
+ {
+ be_visitor_obv_module visitor (&ctx);
+ status = visitor.visit_scope (node);
+ obv = 0;
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_root - "
+ "failed to generate OBV_ things\n"),
+ -1);
+ }
+ }
+
+ status = 0;
+ ctx = *this->ctx_;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_traits visitor (&ctx);
+ status = node->accept (&visitor);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_root - "
+ "failed to generate traits\n"),
+ -1);
+ }
+ }
+
+ break;
+ default:
+ break;
+ }
+
+ // 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.
+
+ ctx = *this->ctx_;
+ status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ 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);
+
+ // Conditional switch to the *A.h stream is done
+ // in the visitor constructor.
+ if (be_global->gen_anyop_files ())
+ {
+ (void) tao_cg->end_anyop_header ();
+ }
+ }
+
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ 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);
+
+ // Conditional switch to the *A.cpp stream is done
+ // in the visitor constructor.
+ if (be_global->gen_anyop_files ())
+ {
+ (void) tao_cg->end_anyop_source ();
+ }
+ }
+
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_IH:
+ case TAO_CodeGen::TAO_ROOT_SH:
+ case TAO_CodeGen::TAO_ROOT_CI:
+ case TAO_CodeGen::TAO_ROOT_IS:
+ case TAO_CodeGen::TAO_ROOT_SI:
+ case TAO_CodeGen::TAO_ROOT_SS:
+ case TAO_CodeGen::TAO_ROOT_TIE_SH:
+ break;
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_constant - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_root - "
+ "failed to generate Any operators\n"),
+ -1);
+ }
+
+ // Make another 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);
+ 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);
+ be_visitor_root_cdr_op visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ case TAO_CodeGen::TAO_ROOT_SH:
+ case TAO_CodeGen::TAO_ROOT_IH:
+ case TAO_CodeGen::TAO_ROOT_SI:
+ case TAO_CodeGen::TAO_ROOT_SS:
+ case TAO_CodeGen::TAO_ROOT_IS:
+ case TAO_CodeGen::TAO_ROOT_TIE_SH:
+ break; // nothing to be done
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_root - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ if (be_global->gen_dcps_type_support ())
+ {
+ // Make another pass over the entire tree and generate the
+ // Serializer operators.
+ ctx = *this->ctx_;
+ status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ ctx.state (TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH);
+ be_visitor_root_cdr_op visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ ctx.state (TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS);
+ be_visitor_root_cdr_op visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ case TAO_CodeGen::TAO_ROOT_SH:
+ case TAO_CodeGen::TAO_ROOT_IH:
+ case TAO_CodeGen::TAO_ROOT_SI:
+ case TAO_CodeGen::TAO_ROOT_SS:
+ case TAO_CodeGen::TAO_ROOT_IS:
+ case TAO_CodeGen::TAO_ROOT_TIE_SH:
+ break; // nothing to be done
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_root - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_root - "
+ "failed to generate CDR operators\n"),
+ -1);
+ }
+
+ // Generate any final code such as #endifs and/or EOF newlines.
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ (void) tao_cg->end_client_header ();
+ break;
+ case TAO_CodeGen::TAO_ROOT_CI:
+ tao_cg->end_client_inline ();
+ break;
+ case TAO_CodeGen::TAO_ROOT_CS:
+ tao_cg->end_client_stubs ();
+ break;
+ case TAO_CodeGen::TAO_ROOT_SH:
+ (void) tao_cg->end_server_header ();
+ break;
+ case TAO_CodeGen::TAO_ROOT_IS:
+ break;
+ case TAO_CodeGen::TAO_ROOT_IH:
+ (void) tao_cg->end_implementation_header (
+ be_global->be_get_implementation_hdr_fname (0)
+ );
+ break;
+ case TAO_CodeGen::TAO_ROOT_SI:
+ if (be_global->gen_tie_classes ())
+ {
+ (void) tao_cg->end_server_template_inline ();
+ }
+
+ tao_cg->end_server_inline ();
+ break;
+ case TAO_CodeGen::TAO_ROOT_SS:
+ if (be_global->gen_tie_classes ())
+ {
+ (void) tao_cg->end_server_template_skeletons ();
+ }
+
+ (void) tao_cg->end_server_skeletons ();
+ break;
+ case TAO_CodeGen::TAO_ROOT_TIE_SH:
+ if (be_global->gen_tie_classes ())
+ {
+ (void) tao_cg->end_server_template_header ();
+ }
+
+ break;
+ default:
+ break;
+ }
+
+ // Make sure each file ends with a newline.
+ *os << "\n";
+
+ return 0;
+}
+
+// All common visit methods for root visitor.
+
+int
+be_visitor_root::visit_constant (be_constant *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_constant_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_constant_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_constant - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_root::visit_enum (be_enum *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_enum_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_enum_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_enum_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_enum_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_enum_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_enum_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ {
+ be_visitor_enum_serializer_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ be_visitor_enum_serializer_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_enum - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_root::visit_exception (be_exception *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_exception_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_exception_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_exception_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_exception_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_exception_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_exception_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_exception_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ return 0; // nothing to be done for DCPS
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_exception - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+// visit an interface
+int
+be_visitor_root::visit_interface (be_interface *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 1;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_CH);
+ break;
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_interface_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_interface_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SH:
+ {
+ be_visitor_interface_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_IH:
+ {
+ be_visitor_interface_ih visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SI:
+ {
+ be_visitor_interface_si visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SS:
+ {
+ be_visitor_interface_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_IS:
+ {
+ be_visitor_interface_is visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_interface_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_interface_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_interface_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_interface_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ return 0; // nothing to be done for DCPS
+ break;
+ }
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_interface - "
+ "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);
+ }
+
+ if (node->accept (visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_interface - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ delete visitor;
+ visitor = 0;
+
+ // Do additional code generation is necessary.
+ // Note, this call is delegated to the strategy connected to
+ // the node.
+ 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));
+
+ 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);
+ }
+
+ if (node->accept (visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_interface - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ delete visitor;
+ visitor = 0;
+ }
+
+ ctx.state (TAO_CodeGen::TAO_ROOT_CH);
+ return 0;
+}
+
+int
+be_visitor_root::visit_interface_fwd (be_interface_fwd *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_interface_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_interface_fwd_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_interface_fwd_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ {
+ return 0; // nothing to be done for DCPS
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_interface_fwd - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_root::visit_valuebox (be_valuebox *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:
+ {
+ be_visitor_valuebox_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_valuebox_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_valuebox_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_valuebox_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_valuebox_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_valuebox_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_valuebox_any_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:
+ {
+ break;
+ }
+ default:
+ return 0; // nothing to do.
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_valuebox - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+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.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_valuetype_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_valuetype_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_valuetype_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_valuetype_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_valuetype_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ return 0; // nothing to be done for DCPS
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_valuetype_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_valuetype_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SH:
+ {
+ be_visitor_valuetype_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SI:
+ {
+ be_visitor_valuetype_si visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SS:
+ {
+ be_visitor_valuetype_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to do.
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_valuetype - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+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.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_valuetype_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_valuetype_fwd_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_valuetype_fwd_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ {
+ return 0; // nothing to be done
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_valuetype_fwd - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_root::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_root::visit_eventtype_fwd (be_eventtype_fwd *node)
+{
+ return this->visit_valuetype_fwd (node);
+}
+
+int
+be_visitor_root::visit_component (be_component *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:
+ {
+ be_visitor_component_ch visitor (&ctx);
+ // This is the only context state involved in strategies.
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_CH);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_component_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_component_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_component_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_component_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ return 0; // nothing to be done for DCPS
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_component_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_component_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SH:
+ {
+ be_visitor_component_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SI:
+ {
+ be_visitor_component_si visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SS:
+ {
+ be_visitor_component_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to do.
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_component - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_root::visit_component_fwd (be_component_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:
+ {
+ be_visitor_component_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_component_fwd_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_component_fwd_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ {
+ return 0; // nothing to be done for DCPS
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_component_fwd - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_root::visit_home (be_home *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:
+ {
+ be_visitor_home_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_home_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_home - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_root::visit_module (be_module *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_module_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_module visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_module visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SH:
+ {
+ be_visitor_module_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SI:
+ case TAO_CodeGen::TAO_ROOT_SS:
+ case TAO_CodeGen::TAO_ROOT_IS:
+ {
+ be_visitor_module visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_IH:
+ {
+ be_visitor_module_ih visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_module_any_op visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_module_cdr_op visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ be_visitor_module_serializer_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);
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_module - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_root::visit_structure (be_structure *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_structure_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_structure_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_structure_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_structure_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_structure_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_structure_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_structure_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ {
+ be_visitor_structure_serializer_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ be_visitor_structure_serializer_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_structure - "
+ "failed to accept visitor\n"),
+ -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:
+ {
+ be_visitor_structure_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_structure_fwd - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_root::visit_union (be_union *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_union_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_union_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_union_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_union_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_union_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_union_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_union_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ {
+ be_visitor_union_serializer_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ be_visitor_union_serializer_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_union - "
+ "failed to accept visitor\n"),
+ -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:
+ {
+ be_visitor_union_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_interface_fwd - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_root::visit_typedef (be_typedef *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_typedef_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_typedef_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_typedef_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_typedef_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_typedef_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_typedef_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_typedef_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ {
+ be_visitor_typedef_serializer_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ be_visitor_typedef_serializer_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_typedef - "
+ "failed to accept visitor"),
+ -1);
+ }
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp
new file mode 100644
index 00000000000..26ab72be1cc
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp
@@ -0,0 +1,84 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Root in the client header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_root,
+ root_ch,
+ "$Id$")
+
+// ********************************
+// Root visitor for client header
+// ********************************
+
+be_visitor_root_ch::be_visitor_root_ch (be_visitor_context *ctx)
+ : be_visitor_root (ctx)
+{
+}
+
+be_visitor_root_ch::~be_visitor_root_ch (void)
+{
+}
+
+int
+be_visitor_root_ch::init (void)
+{
+ // First open the client-side header file for writing
+ if (tao_cg->start_client_header (be_global->be_get_client_hdr_fname ())
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root_ch::init - "
+ "Error opening client header file\n"),
+ -1);
+ }
+
+ // Initialize the stream.
+ this->ctx_->stream (tao_cg->client_header ());
+
+ // If this IDL file contains an non local interface declaration, generated a
+ // forward declaration of the proxy broker for a possible collocated call.
+ if (idl_global->non_local_iface_seen_)
+ {
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl
+ << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *os << be_nl << be_nl
+ << "namespace TAO" << be_nl
+ << "{" << be_idt_nl;
+
+ *os << "class Collocation_Proxy_Broker;" << be_nl;
+
+ if (idl_global->abstract_iface_seen_)
+ {
+ *os << "template<typename T> class AbstractBase_Narrow_Utils;" << be_nl;
+ }
+
+ *os << "template<typename T> class Narrow_Utils;" << be_uidt_nl
+ << "}" ;
+
+ *os << be_global->core_versioning_end () << be_nl;
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp
new file mode 100644
index 00000000000..4a6001866d6
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp
@@ -0,0 +1,53 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root_ci.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the Root in the client inline
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_root,
+ root_ci,
+ "$Id$")
+
+// *********************************
+// Root visitor for client inline
+// *********************************
+
+be_visitor_root_ci::be_visitor_root_ci (be_visitor_context *ctx)
+ : be_visitor_root (ctx)
+{
+}
+
+be_visitor_root_ci::~be_visitor_root_ci (void)
+{
+}
+
+int
+be_visitor_root_ci::init (void)
+{
+ // first open the client-side inline file for writing
+ if (tao_cg->start_client_inline (be_global->be_get_client_inline_fname ())
+ == -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 ());
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp
new file mode 100644
index 00000000000..2fcc8acd791
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp
@@ -0,0 +1,54 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Root in the client stubs file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_root,
+ root_cs,
+ "$Id$")
+
+// ***********************************
+// Root visitor for client stubs
+// ***********************************
+
+be_visitor_root_cs::be_visitor_root_cs (be_visitor_context *ctx)
+ : be_visitor_root (ctx)
+{
+}
+
+be_visitor_root_cs::~be_visitor_root_cs (void)
+{
+}
+
+int
+be_visitor_root_cs::init (void)
+{
+ // first open the file
+ if (tao_cg->start_client_stubs (be_global->be_get_client_stub_fname ())
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root_cs - "
+ "Error opening client stub file\n"),
+ -1);
+ }
+
+ // init stream
+ this->ctx_->stream (tao_cg->client_stubs ());
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp
new file mode 100644
index 00000000000..5ff8eea3403
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp
@@ -0,0 +1,55 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root_ih.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Root in the server implementation header
+//
+// = AUTHOR
+// Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_root,
+ root_ih,
+ "$Id$")
+
+// ***********************************
+// Root visitor for implementation header
+// ***********************************
+
+be_visitor_root_ih::be_visitor_root_ih (be_visitor_context *ctx)
+ : be_visitor_root (ctx)
+{
+}
+
+be_visitor_root_ih::~be_visitor_root_ih (void)
+{
+}
+
+int
+be_visitor_root_ih::init (void)
+{
+ if (tao_cg->start_implementation_header (
+ be_global->be_get_implementation_hdr_fname ()
+ )
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root_ih::init - "
+ "Error :%p: Unable to open implementation header file : %s\n",
+ "start_implementation_header",
+ be_global->be_get_implementation_hdr_fname ()),
+ -1);
+ }
+
+
+ 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
new file mode 100644
index 00000000000..82f3fe275c2
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_is.cpp
@@ -0,0 +1,54 @@
+//
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root_is.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the Root in the implementation skeletons file
+//
+// = AUTHOR
+// Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_root,
+ root_is,
+ "$Id$")
+
+// ******************************************************
+// Root visitor for implementation skeletons
+// ******************************************************
+
+be_visitor_root_is::be_visitor_root_is (be_visitor_context *ctx)
+ : be_visitor_root (ctx)
+{
+}
+
+be_visitor_root_is::~be_visitor_root_is (void)
+{
+}
+
+int
+be_visitor_root_is::init (void)
+{
+ // First open the file for writing.
+ if (tao_cg->start_implementation_skeleton (
+ be_global->be_get_implementation_skel_fname ()
+ )
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root_is::init - "
+ "Error opening implementation skeletons file\n"),
+ -1);
+ }
+
+ 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
new file mode 100644
index 00000000000..affeb35db6c
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_sh.cpp
@@ -0,0 +1,59 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root_sh.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Root in the server header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_root,
+ root_sh,
+ "$Id$")
+
+// ***********************************
+// Root visitor for server header
+// ***********************************
+
+be_visitor_root_sh::be_visitor_root_sh (be_visitor_context *ctx)
+ : be_visitor_root (ctx)
+{
+}
+
+be_visitor_root_sh::~be_visitor_root_sh (void)
+{
+}
+
+int
+be_visitor_root_sh::init (void)
+{
+ // open the file
+ if (tao_cg->start_server_header (be_global->be_get_server_hdr_fname ())
+ == -1)
+ {
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_root_sh::init - "
+ "Error :%p: Unable to open server header file : %s\n",
+ "start_server_header",
+ be_global->be_get_server_hdr_fname ()
+ ),
+ -1
+ );
+ }
+
+ // set the stream and the next state.
+ this->ctx_->stream (tao_cg->server_header ());
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp
new file mode 100644
index 00000000000..77cd9ceb807
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp
@@ -0,0 +1,68 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root_si.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the Root in the server inline file
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_root,
+ root_si,
+ "$Id$")
+
+// ***********************************************
+// Root visitor for server inline
+// ***********************************************
+
+be_visitor_root_si::be_visitor_root_si (be_visitor_context *ctx)
+ : be_visitor_root (ctx)
+{
+}
+
+be_visitor_root_si::~be_visitor_root_si (void)
+{
+}
+
+int
+be_visitor_root_si::init (void)
+{
+ // first open the file for writing
+ if (tao_cg->start_server_inline (be_global->be_get_server_inline_fname ())
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root_si::init - "
+ "server inline open failed\n"),
+ -1);
+ }
+
+ if (be_global->gen_tie_classes ())
+ {
+ if (tao_cg->start_server_template_inline (
+ be_global->be_get_server_template_inline_fname ()
+ )
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root_si::init - "
+ "Error opening server template inline file\n"),
+ -1);
+ }
+ }
+
+ // init stream
+ this->ctx_->stream (tao_cg->server_inline ());
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp
new file mode 100644
index 00000000000..fcaf4307fac
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp
@@ -0,0 +1,70 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root_ss.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the Root in the server skeletons file
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_root,
+ root_ss,
+ "$Id$")
+
+// ******************************************************
+// Root visitor for server skeletons
+// ******************************************************
+
+be_visitor_root_ss::be_visitor_root_ss (be_visitor_context *ctx)
+ : be_visitor_root (ctx)
+{
+}
+
+be_visitor_root_ss::~be_visitor_root_ss (void)
+{
+}
+
+int
+be_visitor_root_ss::init (void)
+{
+ // first open the file for writing
+ if (tao_cg->start_server_skeletons (
+ be_global->be_get_server_skeleton_fname ()
+ )
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root_ss::init - "
+ "Error opening server skeletons file\n"),
+ -1);
+ }
+
+ if (be_global->gen_tie_classes ())
+ {
+ if (tao_cg->start_server_template_skeletons (
+ be_global->be_get_server_template_skeleton_fname ()
+ )
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root_ss::init - "
+ "Error opening server template skeleton file\n"),
+ -1);
+ }
+ }
+
+ // set stream
+ this->ctx_->stream (tao_cg->server_skeletons ());
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_sth.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_sth.cpp
new file mode 100644
index 00000000000..c0d397965d0
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_sth.cpp
@@ -0,0 +1,183 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root_sth.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Root in the server template header
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_root,
+ root_sth,
+ "$Id$")
+
+// ****************************************
+// Root visitor for server template header
+// ****************************************
+
+be_visitor_root_sth::be_visitor_root_sth (be_visitor_context *ctx)
+ : be_visitor_root (ctx)
+{
+}
+
+be_visitor_root_sth::~be_visitor_root_sth (void)
+{
+}
+
+int
+be_visitor_root_sth::init (void)
+{
+ // Open the file.
+ if (tao_cg->start_server_template_header (
+ be_global->be_get_server_template_hdr_fname ()
+ )
+ == -1)
+ {
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_root_sth::init - "
+ "Error:Unable to open server template header file : %s\n",
+ be_global->be_get_server_template_hdr_fname ()
+ ),
+ -1
+ );
+ }
+
+ // Set the stream and the next state.
+ this->ctx_->stream (tao_cg->server_template_header ());
+ return 0;
+}
+
+int
+be_visitor_root_sth::visit_scope (be_scope *node)
+{
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ AST_Decl *d = si.item ();
+
+ if (d == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root_sth::visit_scope - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ be_decl *bd = be_decl::narrow_from_decl (d);
+
+ // 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.
+ this->ctx_->node (bd);
+
+ // Send the visitor.
+ if (bd == 0 || bd->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root_sth::visit_scope - "
+ "codegen for scope failed\n"),
+ -1);
+
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_root_sth::visit_module (be_module *node)
+{
+ if (node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = tao_cg->server_template_header ();
+
+ // Generate the skeleton class name.
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl
+ << "// " __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Now generate the class definition. The prefix POA_ is prepended to our
+ // name only if we are the outermost module.
+ *os << "namespace ";
+
+ if (node->is_nested ())
+ {
+ // We are inside another module.
+ *os << node->local_name () << be_nl;
+ }
+ else
+ {
+ // We are outermost module.
+ *os << "POA_" << node->local_name () << be_nl;
+ }
+
+ *os << "{" << be_idt;
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root_sth::"
+ "visit_module - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl << "} // module " << node->name ();
+
+ return 0;
+}
+
+int
+be_visitor_root_sth::visit_interface (be_interface *node)
+{
+ if (node->imported () || node->is_local ())
+ {
+ return 0;
+ }
+
+ // Generate the TIE class.
+
+ this->ctx_->state (TAO_CodeGen::TAO_ROOT_TIE_SH);
+ this->ctx_->node (node);
+
+ be_visitor_interface_tie_sh visitor (this->ctx_);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_root_sth::"
+ "visit_interface - "
+ "codegen for TIE class failed\n"),
+ -1);
+ }
+
+ this->ctx_->state (TAO_CodeGen::TAO_ROOT_TIE_SH);
+
+ return 0;
+}
+
+int
+be_visitor_root_sth::visit_component (be_component *node)
+{
+ return this->visit_interface (node);
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_root/serializer_op.cpp b/TAO/TAO_IDL/be/be_visitor_root/serializer_op.cpp
new file mode 100644
index 00000000000..09ee1429df7
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_root/serializer_op.cpp
@@ -0,0 +1,52 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the TAO::DCPS::Serializer operators
+// for types defined in Root's scope.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_root,
+ serializer_op,
+ "$Id$")
+
+// ***************************************************************************
+// Root visitor for generating Serializer operator declarations in the client header
+// and stub
+// ***************************************************************************
+
+be_visitor_root_serializer_op::be_visitor_root_serializer_op (be_visitor_context *ctx)
+ : be_visitor_root (ctx)
+{
+}
+
+be_visitor_root_serializer_op::~be_visitor_root_serializer_op (void)
+{
+}
+
+int
+be_visitor_root_serializer_op::visit_root (be_root *node)
+{
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root_serializer_op::visit_root - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_scope.cpp b/TAO/TAO_IDL/be/be_visitor_scope.cpp
new file mode 100644
index 00000000000..52504b81847
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_scope.cpp
@@ -0,0 +1,244 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_scope.cpp
+//
+// = DESCRIPTION
+// Visitor for the base be_scope node. This serves to maintain the current
+// state (context) of code generation for the derived visitor.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_argument.h"
+#include "be_scope.h"
+#include "be_visitor_scope.h"
+#include "be_visitor_context.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (be,
+ be_visitor_scope,
+ "$Id$")
+
+// ******************************************************
+// Generic visitor for a scope.
+// All elements that give rise to a scope inherit from
+// this class.
+// ******************************************************
+
+be_visitor_scope::be_visitor_scope (be_visitor_context *ctx)
+ : be_visitor_decl (ctx),
+ elem_number_ (0)
+{
+}
+
+be_visitor_scope::~be_visitor_scope (void)
+{
+}
+
+// Visit the scope and its elements.
+int
+be_visitor_scope::visit_scope (be_scope *node)
+{
+ // Proceed if the number of members in our scope is greater than 0.
+ this->elem_number_ = 0;
+
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ AST_Decl *d = si.item ();
+
+ if (d == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_scope::visit_scope - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ be_decl *bd = be_decl::narrow_from_decl (d);
+
+ // 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.
+ this->ctx_->node (bd);
+ this->elem_number_++;
+
+ // Do any pre processing using the next item info.
+ if (this->pre_process (bd) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_scope::visit_scope - "
+ "pre processing failed\n"),
+ -1);
+ }
+
+ // Send the visitor.
+ if (bd == 0 || bd->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_scope::visit_scope - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ // Do any post processing using this item info.
+ if (this->post_process (bd) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_scope::visit_scope - "
+ "post processing failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_scope::post_process (be_decl *)
+{
+ return 0;
+}
+
+int
+be_visitor_scope::pre_process (be_decl *)
+{
+ return 0;
+}
+
+int
+be_visitor_scope::elem_number (void)
+{
+ // Return the current element that we are working on.
+ return this->elem_number_;
+}
+
+// Find the element that succeeds "elem" in the list.
+int
+be_visitor_scope::next_elem (be_decl *elem,
+ be_decl *&successor)
+{
+ be_decl *ctx_scope = this->ctx_->scope ();
+ be_scope *node = 0;
+
+ if (ctx_scope != 0)
+ {
+ node = ctx_scope->scope ();
+ }
+
+ if (ctx_scope == 0 || node == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_scope::next_elem - "
+ "bad scope\n"),
+ -1);
+ }
+
+ successor = 0;
+
+ // Initialize an iterator to iterate thru our scope.
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ be_decl *bd = be_decl::narrow_from_decl (si.item ());
+
+ if (bd == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_scope::next_elem - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ if (bd != elem)
+ {
+ continue;
+ }
+
+ // Find who is next to me.
+ si.next ();
+
+ if (si.is_done ())
+ {
+ // Nobody left in the list.
+ return 0;
+ }
+
+ successor = be_decl::narrow_from_decl (si.item ());
+
+ if (successor == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_scope::next_elem - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ // Nothing else to do.
+ return 0;
+ }
+
+ return 0;
+}
+
+bool
+be_visitor_scope::last_node (be_decl *bd)
+{
+ be_decl *next = 0;
+ (void) this->next_elem (bd,
+ next);
+
+ if (next != 0)
+ {
+ // Not the last.
+ return 0;
+ }
+
+ // I am the last one.
+ return 1;
+}
+
+bool
+be_visitor_scope::last_inout_or_out_node (be_decl *)
+{
+ // Return true if we are the last inout or out argument.
+ be_decl *next = 0;
+ (void) this->next_elem (this->ctx_->node (),
+ next);
+
+ while (next != 0)
+ {
+ be_argument *arg = be_argument::narrow_from_decl (next);
+
+ if (arg->direction () == AST_Argument::dir_INOUT
+ || arg->direction () == AST_Argument::dir_OUT)
+ {
+ // Not the last.
+ return 0;
+ }
+
+ be_decl *next_next = 0;
+ this->next_elem (next,
+ next_next);
+
+ next = next_next;
+ }
+
+ // I am the last one.
+ return 1;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence.cpp b/TAO/TAO_IDL/be/be_visitor_sequence.cpp
new file mode 100644
index 00000000000..ef93fee6254
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_sequence.cpp
@@ -0,0 +1,65 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_sequence.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Sequence
+//
+// = AUTHOR
+// Aniruddha Gokhale and Carlos O'Ryan
+//
+// ============================================================================
+
+#include "be_array.h"
+#include "be_enum.h"
+#include "be_exception.h"
+#include "be_interface.h"
+#include "be_interface_fwd.h"
+#include "be_component.h"
+#include "be_component_fwd.h"
+#include "be_home.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_valuebox.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_eventtype.h"
+#include "be_eventtype_fwd.h"
+#include "be_helper.h"
+#include "be_extern.h"
+#include "ast_root.h"
+#include "utl_identifier.h"
+#include "nr_extern.h"
+#include "global_extern.h"
+
+#include "be_visitor_sequence.h"
+#include "be_visitor_context.h"
+#include "ace/Log_Msg.h"
+
+#include "be_visitor_sequence/any_op_ch.cpp"
+#include "be_visitor_sequence/any_op_cs.cpp"
+#include "be_visitor_sequence/cdr_op_ch.cpp"
+#include "be_visitor_sequence/cdr_op_cs.cpp"
+#include "be_visitor_sequence/serializer_op_ch.cpp"
+#include "be_visitor_sequence/serializer_op_cs.cpp"
+#include "be_visitor_sequence/buffer_type.cpp"
+#include "be_visitor_sequence/sequence_base.cpp"
+#include "be_visitor_sequence/sequence_ch.cpp"
+#include "be_visitor_sequence/sequence_cs.cpp"
+
+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
new file mode 100644
index 00000000000..9195f4c7d3e
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/any_op_ch.cpp
@@ -0,0 +1,83 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Any operators for the Sequence
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_sequence,
+ any_op_ch,
+ "$Id$")
+
+// ***************************************************************************
+// Sequence visitor for generating Any operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_sequence_any_op_ch::be_visitor_sequence_any_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_sequence_any_op_ch::~be_visitor_sequence_any_op_ch (void)
+{
+}
+
+int
+be_visitor_sequence_any_op_ch::visit_sequence (be_sequence *node)
+{
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ const char *macro = this->ctx_->export_macro ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ // Generate the Any <<= and >>= operators.
+ *os << macro;
+ *os << " void"
+ << " operator<<= ( ::CORBA::Any &, const ";
+ *os << node->name ();
+ *os << " &); // copying version" << be_nl;
+ *os << macro;
+ *os << " void"
+ << " operator<<= ( ::CORBA::Any &, ";
+ *os << node->name ();
+ *os << "*); // noncopying version" << be_nl;
+ *os << macro;
+ *os << " ::CORBA::Boolean"
+ << " operator>>= (const ::CORBA::Any &, ";
+ *os << node->name ();
+ *os << " *&); // deprecated" << be_nl;
+ *os << macro;
+ *os << " ::CORBA::Boolean"
+ << " operator>>= (const ::CORBA::Any &, const ";
+ *os << node->name ();
+ *os << " *&);";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ node->cli_hdr_any_op_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp
new file mode 100644
index 00000000000..a4699901a26
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp
@@ -0,0 +1,158 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Any operator for the Sequence node
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_sequence,
+ any_op_cs,
+ "$Id$")
+
+// ***************************************************************************
+// Sequence visitor for generating Any operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_sequence_any_op_cs::be_visitor_sequence_any_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_sequence_any_op_cs::~be_visitor_sequence_any_op_cs (void)
+{
+}
+
+int
+be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node)
+{
+ if (node->cli_stub_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl
+ << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ // Since we don't generate CDR stream operators for types that
+ // explicitly contain a local interface (at some level), we
+ // must override these Any template class methods to avoid
+ // calling the non-existent operators. The zero return value
+ // will eventually cause CORBA::MARSHAL to be raised if this
+ // type is inserted into an Any and then marshaled.
+ if (node->is_local ())
+ {
+ *os << "namespace TAO" << be_nl
+ << "{" << be_idt_nl
+ << "template<>" << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "Any_Dual_Impl_T<" << node->name ()
+ << ">::marshal_value (TAO_OutputCDR &)" << be_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "template<>" << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "Any_Dual_Impl_T<" << node->name ()
+ << ">::demarshal_value (TAO_InputCDR &)" << be_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}" << be_nl;
+ }
+
+ // Copying insertion.
+ *os << be_nl << "// Copying insertion." << be_nl
+ << "void operator<<= (" << be_idt << be_idt_nl
+ << "::CORBA::Any &_tao_any," << be_nl
+ << "const " << node->name () << " &_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+
+ << "if (0 == &_tao_elem) // Trying to de-reference NULL object" << be_idt_nl
+ << "_tao_any <<= static_cast<" << node->name () << " *>( 0 ); // Use non-copying insertion of a NULL" << be_uidt_nl
+ << "else" << be_idt_nl
+
+ << "TAO::Any_Dual_Impl_T<" << node->name () << ">::insert_copy ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Non-copying insertion.
+ *os << "// Non-copying insertion." << be_nl
+ << "void operator<<= (" << be_idt << be_idt_nl
+ << "::CORBA::Any &_tao_any," << be_nl
+ << node->name () << " *_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "TAO::Any_Dual_Impl_T<" << node->name () << ">::insert ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Extraction to non-const pointer (deprecated, just calls the other).
+ *os << "// Extraction to non-const pointer (deprecated)." << be_nl
+ << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl
+ << "const ::CORBA::Any &_tao_any," << be_nl
+ << node->name () << " *&_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return _tao_any >>= const_cast<" << be_idt << be_idt_nl
+ << "const " << node->name () << " *&> (" << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Extraction to const pointer.
+ *os << "// Extraction to const pointer." << be_nl
+ << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl
+ << "const ::CORBA::Any &_tao_any," << be_nl
+ << "const " << node->name () << " *&_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return" << be_idt_nl
+ << "TAO::Any_Dual_Impl_T<" << node->name () << ">::extract ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ node->cli_stub_any_op_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp
new file mode 100644
index 00000000000..9442ec63130
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp
@@ -0,0 +1,283 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// buffer_type.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the internal buffer type of the Sequence node
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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_decl (ctx)
+{
+}
+
+be_visitor_sequence_buffer_type::~be_visitor_sequence_buffer_type (void)
+{
+}
+
+// helper
+int
+be_visitor_sequence_buffer_type::visit_node (be_type *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_SEQUENCE_BUFFER_TYPE_CH)
+ {
+ *os << bt->nested_type_name (this->ctx_->scope ());
+ }
+ else
+ {
+ *os << bt->name ();
+ }
+
+ return 0;
+}
+
+int
+be_visitor_sequence_buffer_type::visit_predefined_type (be_predefined_type *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ AST_PredefinedType::PredefinedType pt = node->pt ();
+
+ *os << "::";
+
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << node->name () << "_ptr";
+ }
+ else if (pt == AST_PredefinedType::PT_value)
+ {
+ *os << node->name () << " *";
+ }
+ else
+ {
+ *os << node->name ();
+ }
+
+ return 0;
+}
+
+int
+be_visitor_sequence_buffer_type::visit_sequence (be_sequence *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_buffer_type::visit_interface (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_SEQUENCE_BUFFER_TYPE_CH)
+ {
+ *os << node->nested_type_name (this->ctx_->scope (), "_ptr");
+ }
+ else
+ {
+ *os << node->name () << "_ptr";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_sequence_buffer_type::visit_interface_fwd (be_interface_fwd *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_SEQUENCE_BUFFER_TYPE_CH)
+ {
+ *os << node->nested_type_name (this->ctx_->scope (), "_ptr");
+ }
+ else
+ {
+ *os << node->name () << "_ptr";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_sequence_buffer_type::visit_component (be_component *node)
+{
+ return this->visit_interface (node);
+}
+
+int
+be_visitor_sequence_buffer_type::visit_component_fwd (be_component_fwd *node)
+{
+ return this->visit_interface_fwd (node);
+}
+
+int
+be_visitor_sequence_buffer_type::visit_valuebox (be_valuebox *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 (), " *");
+ }
+ else
+ {
+ *os << node->name () << " *";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_sequence_buffer_type::visit_valuetype (be_valuetype *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 (), " *");
+ }
+ else
+ {
+ *os << node->name () << " *";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_sequence_buffer_type::visit_valuetype_fwd (be_valuetype_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 (), " *");
+ }
+ else
+ {
+ *os << node->name () << " *";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_sequence_buffer_type::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_sequence_buffer_type::visit_eventtype_fwd (be_eventtype_fwd *node)
+{
+ return this->visit_valuetype_fwd (node);
+}
+
+int
+be_visitor_sequence_buffer_type::visit_string (be_string *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "::CORBA::Char *";
+ }
+ else
+ {
+ *os << "::CORBA::WChar *";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_sequence_buffer_type::visit_structure (be_structure *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_buffer_type::visit_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);
+}
+
+int
+be_visitor_sequence_buffer_type::visit_exception (be_exception *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_buffer_type::visit_array (be_array *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_buffer_type::visit_typedef (be_typedef *node)
+{
+ this->ctx_->alias (node);
+
+ if (node->primitive_base_type ()->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_sequence_buffer_type::"
+ "visit_typedef - "
+ "accept on primitive type failed\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp
new file mode 100644
index 00000000000..5f7d08577c2
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp
@@ -0,0 +1,106 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for CDR operators for sequences. This uses
+// compiled marshaling.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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_decl (ctx)
+{
+}
+
+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;
+ }
+
+ be_type *base_type = be_type::narrow_from_decl (node->base_type ());
+
+ // If our base type is an anonymous sequence, generate code for it here.
+ if (base_type->node_type () == AST_Decl::NT_sequence)
+ {
+ if (base_type->accept (this) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_sequence_cdr_op_ch::visit_sequence -"
+ "codegen for nested anonymous sequence failed\n"),
+ -1);
+ }
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ be_type *bt = be_type::narrow_from_decl (node);
+ be_typedef *tdef = be_typedef::narrow_from_decl (bt);
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // If we're an anonymous sequence, we must protect against
+ // being declared more than once.
+ if (!tdef)
+ {
+ *os << "\n\n#if !defined _TAO_CDR_OP_"
+ << node->flat_name () << "_H_"
+ << "\n#define _TAO_CDR_OP_" << node->flat_name () << "_H_";
+ }
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *os << be_nl << be_nl
+ << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator<< (" << be_idt << be_idt_nl
+ << "TAO_OutputCDR &strm," << be_nl
+ << "const " << node->name () << " &_tao_sequence" << be_uidt_nl
+ << ");" << be_uidt_nl;
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator>> (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &strm," << be_nl
+ << node->name () << " &_tao_sequence" << be_uidt_nl
+ << ");" << be_uidt;
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ if (!tdef)
+ {
+ *os << "\n\n#endif /* _TAO_CDR_OP_"
+ << node->flat_name () << "_H_ */";
+ }
+
+ node->cli_hdr_cdr_op_gen (1);
+ return 0;
+}
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
new file mode 100644
index 00000000000..2b45fca1bbe
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp
@@ -0,0 +1,256 @@
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor for code generation of Sequences for the CDR operators
+// in the client stubs.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_sequence,
+ cdr_op_cs,
+ "$Id$")
+
+// ***************************************************************************
+// Sequence visitor for generating CDR operator declarations in the client
+// stubs file.
+// ***************************************************************************
+
+be_visitor_sequence_cdr_op_cs::be_visitor_sequence_cdr_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_sequence_cdr_op_cs::~be_visitor_sequence_cdr_op_cs (void)
+{
+}
+
+int
+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
+ // 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.
+ return this->visit_node (node);
+ }
+
+ 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,
+ "be_visitor_sequence_cdr_op_cs::"
+ "visit_sequence - "
+ "Bad base type\n"),
+ -1);
+ }
+
+ // Generate the CDR << and >> operator defns.
+
+ // Save the sequence node for further use.
+ this->ctx_->node (node);
+
+ // If our element type is an anonymous sequence, generate code for it here.
+ if (bt->node_type () == AST_Decl::NT_sequence)
+ {
+ int status =
+ this->gen_anonymous_base_type (
+ bt,
+ TAO_CodeGen::TAO_ROOT_CDR_OP_CS
+ );
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cdr_op_cs::"
+ "visit_sequence - "
+ "gen_anonymous_base_type failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+
+ *os << "#if !defined _TAO_CDR_OP_"
+ << node->flat_name () << "_CPP_" << be_nl
+ << "#define _TAO_CDR_OP_" << node->flat_name () << "_CPP_"
+ << be_nl;
+
+ *os << be_global->core_versioning_begin () << 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 operator<< (" << be_idt << be_idt_nl
+ << "TAO_OutputCDR &strm," << be_nl
+ << "const " << node->name ()
+ << " &_tao_sequence" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ *os << "return TAO::marshal_sequence(strm, _tao_sequence);"
+ << be_uidt_nl;
+
+ *os << "}" << be_nl << be_nl;
+
+ // Set the sub state as generating code for the input operator.
+ this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_INPUT);
+
+ *os << "::CORBA::Boolean operator>> (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &strm";
+
+ *os << "," << be_nl
+ << node->name () << " &_tao_sequence";
+
+ *os << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ *os << "return TAO::demarshal_sequence(strm, _tao_sequence);"
+ << be_uidt_nl;
+
+ *os << "}";
+
+ *os << be_nl << be_global->core_versioning_end ();
+
+ *os << be_nl
+ << "#endif /* _TAO_CDR_OP_"
+ << node->flat_name () << "_CPP_ */";
+
+ node->cli_stub_cdr_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_sequence_cdr_op_cs::visit_array (be_array *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_cdr_op_cs::visit_enum (be_enum *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_cdr_op_cs::visit_interface (be_interface *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_cdr_op_cs::visit_interface_fwd (be_interface_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_cdr_op_cs::visit_component (be_component *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_cdr_op_cs::visit_component_fwd (be_component_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_cdr_op_cs::visit_home (be_home *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_cdr_op_cs::visit_valuebox (be_valuebox *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_cdr_op_cs::visit_valuetype (be_valuetype *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_cdr_op_cs::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_cdr_op_cs::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_cdr_op_cs::visit_eventtype_fwd (be_eventtype_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_cdr_op_cs::visit_predefined_type (
+ be_predefined_type *node
+ )
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_cdr_op_cs::visit_string (be_string *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_cdr_op_cs::visit_structure (be_structure *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_cdr_op_cs::visit_union (be_union *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_cdr_op_cs::visit_typedef (be_typedef *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_cdr_op_cs::visit_node (be_type *)
+{
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp
new file mode 100644
index 00000000000..abf654712a0
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp
@@ -0,0 +1,295 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// sequence_base.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the base type of the Sequence
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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_decl (ctx)
+{
+}
+
+be_visitor_sequence_base::~be_visitor_sequence_base (void)
+{
+}
+
+
+int
+be_visitor_sequence_base::visit_predefined_type (be_predefined_type *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "::" << node->name ();
+
+ return 0;
+}
+
+// helper
+int
+be_visitor_sequence_base::visit_node (be_type *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_SEQUENCE_BASE_CH)
+ {
+ if (this->ctx_->sub_state ()
+ == TAO_CodeGen::TAO_ARRAY_SEQ_CH_TEMPLATE_VAR)
+ {
+ *os << bt->nested_type_name (this->ctx_->scope (), "_var");
+ }
+ else
+ {
+ *os << bt->nested_type_name (this->ctx_->scope ());
+ }
+ }
+ else
+ {
+ *os << bt->name ();
+ }
+
+ return 0;
+}
+
+int
+be_visitor_sequence_base::visit_sequence (be_sequence *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_base::visit_interface (be_interface *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_base::visit_interface_fwd (be_interface_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_base::visit_valuebox (be_valuebox *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_base::visit_valuetype (be_valuetype *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_base::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_base::visit_string (be_string *)
+{
+ // NO-OP, we have ad-hoc classes from strings.
+ return 0;
+}
+
+int
+be_visitor_sequence_base::visit_structure (be_structure *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_base::visit_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);
+}
+
+int
+be_visitor_sequence_base::visit_exception (be_exception *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_base::visit_array (be_array *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_base::visit_typedef (be_typedef *node)
+{
+ // Set the alias node.
+ this->ctx_->alias (node);
+
+ if (node->primitive_base_type ()->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_sequence_base::"
+ "visit_typedef - "
+ "accept on primitive type failed\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+be_visitor_sequence_base_template_args::
+be_visitor_sequence_base_template_args (be_visitor_context *ctx,
+ be_sequence *seq)
+ : be_visitor_sequence_base (ctx),
+ beseq_ (seq)
+{
+ // no-op
+}
+
+
+be_visitor_sequence_base_template_args::
+~be_visitor_sequence_base_template_args (void)
+{
+ //no-op
+}
+
+int
+be_visitor_sequence_base_template_args::visit_interface (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_SEQUENCE_BASE_CH)
+ {
+ *os << bt->nested_type_name (this->ctx_->scope ()) << ",";
+ *os << bt->nested_type_name (this->ctx_->scope (), "_var");
+ }
+ else
+ {
+ *os << bt->name () << ",";
+ *os << bt->name () << "_var";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_sequence_base_template_args::visit_interface_fwd (
+ be_interface_fwd *node
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_SEQUENCE_BASE_CH)
+ {
+ *os << bt->nested_type_name (this->ctx_->scope ()) << ",";
+ *os << bt->nested_type_name (this->ctx_->scope (), "_var");
+ }
+ else
+ {
+ *os << bt->name () << ",";
+ *os << bt->name () << "_var";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_sequence_base_template_args::visit_valuetype (be_valuetype *node)
+{
+ return this->visit_interface (node);
+}
+
+int
+be_visitor_sequence_base_template_args::visit_valuetype_fwd (
+ be_valuetype_fwd *node
+ )
+{
+ return this->visit_interface_fwd (node);
+}
+
+int
+be_visitor_sequence_base_template_args::visit_predefined_type (
+ be_predefined_type *node
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ *os << "::" << node->name ();
+
+ if (beseq_->managed_type () == be_sequence::MNG_PSEUDO
+ || beseq_->managed_type () == be_sequence::MNG_OBJREF)
+ {
+ *os << ", ::" << node->name () << "_var";
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp
new file mode 100644
index 00000000000..265e0b8261e
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp
@@ -0,0 +1,266 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// sequence_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Sequence in the client header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_sequence_ch::~be_visitor_sequence_ch (void)
+{
+}
+
+int be_visitor_sequence_ch::visit_sequence (be_sequence *node)
+{
+ if (node->defined_in () == 0)
+ {
+ // The node is a nested sequence, and has had no scope defined.
+ node->set_defined_in (DeclAsScope (this->ctx_->scope ()));
+ }
+
+ // First create a name for ourselves.
+ if (node->create_name (this->ctx_->tdef ()) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_ch::"
+ "visit_sequence - "
+ "failed creating name\n"),
+ -1);
+ }
+
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ be_type *bt = 0;
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // 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 == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_ch::"
+ "visit_sequence - "
+ "Bad element type\n"),
+ -1);
+ }
+
+ bt->seen_in_sequence (true);
+ AST_Decl::NodeType nt = bt->node_type ();
+
+ // If our base type is an anonymouse sequence, we must create a name
+ // and generate a class declaration for it as well.
+ if (nt == AST_Decl::NT_sequence)
+ {
+ // Temporarily make the context's tdef node 0 so the nested call
+ // to create_name will not get confused and give our anonymous
+ // sequence element type the same name as we have.
+ be_typedef *tmp = this->ctx_->tdef ();
+ this->ctx_->tdef (0);
+
+ if (bt->accept (this) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_ch::"
+ "visit_sequence - "
+ "codegen for anonymous base type failed\n"),
+ -1);
+ }
+
+ // Restore the tdef value.
+ this->ctx_->tdef (tmp);
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ os->gen_ifdef_macro (node->flat_name ());
+
+ if (this->ctx_->tdef () != 0)
+ {
+ *os << be_nl << be_nl
+ << "class " << node->local_name () << ";";
+ }
+
+ if (this->ctx_->tdef () != 0)
+ {
+ this->gen_varout_typedefs (node,
+ bt);
+ }
+
+ *os << be_nl << be_nl
+ << "class " << be_global->stub_export_macro () << " "
+ << node->local_name () << be_idt_nl
+ << ": public" << be_idt << be_idt_nl;
+
+ if (node->gen_base_class_name (os, "", this->ctx_->scope ()) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_ch::"
+ "visit_sequence - "
+ "Base class name generation failed\n"),
+ -1);
+ }
+
+ *os << be_uidt << be_uidt << be_uidt;
+
+ *os << be_nl
+ << "{" << be_nl
+ << "public:" << be_idt;
+
+ *os << be_nl
+ << node->local_name () << " (void);";
+
+ if (node->unbounded ())
+ {
+ *os << be_nl
+ << node->local_name () << " ( ::CORBA::ULong max);";
+ }
+
+ *os << be_nl
+ << node->local_name () << " (" << be_idt << be_idt;
+
+ if (node->unbounded ())
+ {
+ *os << be_nl
+ << "::CORBA::ULong max,";
+ }
+
+ *os << be_nl
+ << "::CORBA::ULong length," << be_nl;
+
+ // Generate the base type for the buffer.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_SEQUENCE_BUFFER_TYPE_CH);
+ be_visitor_sequence_buffer_type bt_visitor (&ctx);
+
+ if (bt->accept (&bt_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_ch::"
+ "visit_sequence - "
+ "base type visit failed\n"),
+ -1);
+ }
+
+ *os << "* buffer, " << be_nl
+ << "::CORBA::Boolean release = false" << be_uidt_nl
+ << ");" << be_uidt_nl;
+ *os << node->local_name () << " (const " << node->local_name ()
+ << " &);" << be_nl;
+ *os << "virtual ~" << node->local_name () << " (void);";
+
+ if (be_global->any_support () && !node->anonymous ())
+ {
+ *os << be_nl << be_nl
+ << "static void _tao_any_destructor (void *);";
+ }
+
+ // Generate the _var_type typedef (only if we are not anonymous).
+ if (this->ctx_->tdef () != 0)
+ {
+ *os << be_nl << be_nl
+ << "typedef " << node->local_name () << "_var _var_type;"
+ << be_nl
+ << "typedef " << node->local_name () << "_out _out_type;"
+ << be_nl << be_nl;
+ }
+
+ // TAO provides extensions for octet sequences, first find out 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 =
+ be_typedef::narrow_from_decl (bt);
+
+ if (alias == 0)
+ {
+ predef = be_predefined_type::narrow_from_decl (bt);
+ }
+ else
+ {
+ predef =
+ be_predefined_type::narrow_from_decl (
+ alias->primitive_base_type ()
+ );
+ }
+ }
+
+ // Now generate the extension...
+ if (predef != 0 && predef->pt () == AST_PredefinedType::PT_octet
+ && node->unbounded ())
+ {
+ *os << "\n\n#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)" << be_nl
+ << node->local_name () << " (" << be_idt << be_idt_nl
+ << "::CORBA::ULong length," << be_nl
+ << "const ACE_Message_Block* mb" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << " : TAO::unbounded_value_sequence< ::CORBA::Octet>"
+ << " (length, mb) {}" << "\n"
+ << "#endif /* TAO_NO_COPY_OCTET_SEQUENCE == 1 */";
+ }
+
+ *os << be_uidt_nl
+ << "};";
+
+ os->gen_endif ();
+
+ node->cli_hdr_gen (1);
+ return 0;
+}
+
+void
+be_visitor_sequence_ch::gen_varout_typedefs (be_sequence *node,
+ be_type *elem)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl;
+
+ AST_Type::SIZE_TYPE st = elem->size_type ();
+
+ *os << "typedef" << be_idt_nl
+ << (st == AST_Type::FIXED ? "TAO_FixedSeq_Var_T<"
+ : "TAO_VarSeq_Var_T<")
+ << be_idt << be_idt_nl
+ << node->local_name ();
+
+ *os << be_uidt_nl
+ << ">" << be_uidt_nl
+ << node->local_name () << "_var;" << be_uidt;
+
+ *os << be_nl << be_nl
+ << "typedef" << be_idt_nl
+ << "TAO_Seq_Out_T<" << be_idt << be_idt_nl
+ << node->local_name () << be_uidt_nl
+ << ">" << be_uidt_nl
+ << node->local_name () << "_out;" << be_uidt;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp
new file mode 100644
index 00000000000..c96fb72bab1
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp
@@ -0,0 +1,198 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// sequence_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Sequences in the client stubs file
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_sequence,
+ sequence_cs,
+ "$Id$")
+
+// ************************************************************
+// Root visitor for client stub class
+// ************************************************************
+
+be_visitor_sequence_cs::be_visitor_sequence_cs (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_sequence_cs::~be_visitor_sequence_cs (void)
+{
+}
+
+int be_visitor_sequence_cs::visit_sequence (be_sequence *node)
+{
+ if (node->imported () || node->cli_stub_gen ())
+ {
+ return 0;
+ }
+
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
+ AST_Decl::NodeType nt = bt->node_type ();
+
+ // If our base type is an anonymous sequence, generate code for it here.
+ if (nt == AST_Decl::NT_sequence)
+ {
+ if (bt->accept (this) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_cs::"
+ "visit_sequence - "
+ "codegen for anonymous base type failed\n"),
+ -1);
+ }
+
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl
+ << "// "__FILE__ << ":" << __LINE__;
+
+ os->gen_ifdef_macro (node->flat_name ());
+
+ // default constructor
+ *os << be_nl << be_nl
+ << node->name () << "::" << node->local_name () << " (void)" << be_nl
+ << "{}";
+
+ // for unbounded sequences, we have a different set of constructors
+ if (node->unbounded ())
+ {
+ *os << be_nl << be_nl
+ << node->name () << "::" << node->local_name () << " ("
+ << be_idt << be_idt_nl
+ << "::CORBA::ULong max" << be_uidt_nl
+ << ")" << be_nl
+ << ": " << be_idt;
+
+ // Pass it to the base constructor.
+ if (node->gen_base_class_name (os, "", this->ctx_->scope ()) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_cs::"
+ "visit_sequence - "
+ "codegen for base sequence class failed\n"),
+ -1);
+ }
+
+
+ *os << be_nl << "(max)" << be_uidt << be_uidt_nl
+ << "{}";
+ }
+
+ // constructor with the buffer
+ *os << be_nl << be_nl
+ << node->name () << "::" << node->local_name () << " ("
+ << be_idt << be_idt_nl;
+
+ if (node->unbounded ())
+ {
+ // Unbounded seq takes this extra parameter.
+ *os << "::CORBA::ULong max," << be_nl;
+ }
+
+ *os << "::CORBA::ULong length," << be_nl;
+
+ // generate the base type for the buffer
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_sequence_buffer_type bt_visitor (&ctx);
+
+ if (bt->accept (&bt_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_cs::"
+ "visit_sequence - "
+ "base type visit failed\n"),
+ -1);
+ }
+
+ *os << " * buffer," << be_nl
+ << "::CORBA::Boolean release" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << " : " << be_idt << be_idt;
+
+ // Pass it to the base constructor.
+ if (node->gen_base_class_name (os, "", this->ctx_->scope ()) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_cs::"
+ "visit_sequence - "
+ "codegen for base sequence class\n"),
+ -1);
+ }
+
+ *os << be_nl << "(";
+
+ if (node->unbounded ())
+ {
+ *os << "max, ";
+ }
+
+ *os << "length, buffer, release)" << be_uidt << be_uidt_nl
+ << "{}";
+
+ // Copy constructor.
+ *os << be_nl << be_nl
+ << node->name () << "::" << node->local_name ()
+ << " (" << be_idt << be_idt_nl
+ << "const " << node->local_name ()
+ << " &seq" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << " : " << be_idt << be_idt;
+
+ // Pass it to the base constructor.
+ if (node->gen_base_class_name (os, "", this->ctx_->scope ()) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_cs::"
+ "visit_sequence - "
+ "codegen for base sequence class\n"),
+ -1);
+ }
+
+ *os << be_nl << "(seq)" << be_uidt << be_uidt_nl
+ << "{}";
+
+ // Destructor.
+ *os << be_nl << be_nl
+ << node->name () << "::~" << node->local_name ()
+ << " (void)" << be_nl
+ << "{}";
+
+
+ if (be_global->any_support () && !node->anonymous ())
+ {
+ *os << be_nl << be_nl
+ << "void "
+ << node->name () << "::_tao_any_destructor (" << be_idt << be_idt_nl
+ << "void * _tao_void_pointer" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << node->local_name () << " * _tao_tmp_pointer =" << be_idt_nl
+ << "static_cast<" << node->local_name ()
+ << " *> (_tao_void_pointer);" << be_uidt_nl
+ << "delete _tao_tmp_pointer;" << be_uidt_nl
+ << "}";
+ }
+
+ os->gen_endif ();
+
+ node->cli_stub_gen (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/serializer_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/serializer_op_ch.cpp
new file mode 100644
index 00000000000..cc9216fa8fb
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/serializer_op_ch.cpp
@@ -0,0 +1,117 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for TAO::DCPS::Serializer operators for sequences.
+// This uses compiled marshaling.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_sequence,
+ serializer_op_ch,
+ "$Id$")
+
+// ***************************************************************************
+// Sequence visitor for generating Serializer operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_sequence_serializer_op_ch::be_visitor_sequence_serializer_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_sequence_serializer_op_ch::~be_visitor_sequence_serializer_op_ch (void)
+{
+}
+
+int
+be_visitor_sequence_serializer_op_ch::visit_sequence (be_sequence *node)
+{
+ if (node->cli_hdr_serializer_op_gen ()
+ || node->imported ()
+ || node->is_local ())
+ {
+ return 0;
+ }
+
+ be_type *base_type = be_type::narrow_from_decl (node->base_type ());
+
+ // If our base type is an anonymous sequence, generate code for it here.
+ if (base_type->node_type () == AST_Decl::NT_sequence)
+ {
+ if (base_type->accept (this) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_sequence_serializer_op_ch::visit_sequence -"
+ "codegen for nested anonymous sequence failed\n"),
+ -1);
+ }
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ be_type *bt = be_type::narrow_from_decl (node);
+ be_typedef *tdef = be_typedef::narrow_from_decl (bt);
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // If we're an anonymous sequence, we must protect against
+ // being declared more than once.
+ if (!tdef)
+ {
+ *os << "\n\n#if !defined _TAO_SERIALIZER_OP_"
+ << node->flat_name () << "_H_"
+ << "\n#define _TAO_SERIALIZER_OP_" << node->flat_name () << "_H_";
+ }
+
+ *os << be_nl << be_nl;
+
+ *os << be_global->stub_export_macro ()
+ << " ::CORBA::Boolean _tao_is_bounded_size (" << be_idt << be_idt_nl
+ << "const " << node->name () << " &" << be_uidt_nl
+ << ");" << be_uidt_nl;
+ *os << be_global->stub_export_macro ()
+ << " size_t _dcps_max_marshaled_size (" << be_idt << be_idt_nl
+ << "const " << node->name () << " &" << be_uidt_nl
+ << ");" << be_uidt_nl;
+ *os << be_global->stub_export_macro ()
+ << " size_t _dcps_find_size (" << be_idt << be_idt_nl
+ << "const " << node->name () << " &" << be_uidt_nl
+ << ");" << be_uidt_nl;
+
+ *os << be_nl << be_nl
+ << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator<< (" << be_idt << be_idt_nl
+ << "TAO::DCPS::Serializer &," << be_nl
+ << "const " << node->name () << " &" << be_uidt_nl
+ << ");" << be_uidt_nl;
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator>> (" << be_idt << be_idt_nl
+ << "TAO::DCPS::Serializer &," << be_nl
+ << node->name () << " &" << be_uidt_nl
+ << ");" << be_uidt;
+
+ if (!tdef)
+ {
+ *os << "\n\n#endif /* _TAO_SERIALIZER_OP_"
+ << node->flat_name () << "_H_ */";
+ }
+
+ node->cli_hdr_serializer_op_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/serializer_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/serializer_op_cs.cpp
new file mode 100644
index 00000000000..103a4281f78
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/serializer_op_cs.cpp
@@ -0,0 +1,1337 @@
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor for code generation of Sequences for the
+// TAO::DCPS::Serializer operators in the client stubs.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_sequence,
+ serializer_op_cs,
+ "$Id$")
+
+// ***************************************************************************
+// Sequence visitor for generating Serializer operator declarations in the client
+// stubs file.
+// ***************************************************************************
+
+be_visitor_sequence_serializer_op_cs::be_visitor_sequence_serializer_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_sequence_serializer_op_cs::~be_visitor_sequence_serializer_op_cs (void)
+{
+}
+
+int
+be_visitor_sequence_serializer_op_cs::visit_sequence (be_sequence *node)
+{
+ if (this->ctx_->alias ())
+ {
+ // 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.
+ return this->visit_node (node);
+ }
+
+ if (node->cli_stub_serializer_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,
+ "be_visitor_sequence_serializer_op_cs::"
+ "visit_sequence - "
+ "Bad base type\n"),
+ -1);
+ }
+
+ // Generate the Serializer << and >> operator defns.
+
+ // Save the sequence node for further use.
+ this->ctx_->node (node);
+
+ // If our element type is an anonymous sequence, generate code for it here.
+ if (bt->node_type () == AST_Decl::NT_sequence)
+ {
+ int status =
+ this->gen_anonymous_base_type (
+ bt,
+ TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS
+ );
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_sequence - "
+ "gen_anonymous_base_type failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "#if !defined _TAO_SERIALIZER_OP_"
+ << node->flat_name () << "_CPP_" << be_nl
+ << "#define _TAO_SERIALIZER_OP_" << node->flat_name () << "_CPP_"
+ << be_nl << be_nl;
+
+ // --- _tao_is_bounded_size ---
+ this->ctx_->sub_state (TAO_CodeGen::TAO_IS_BOUNDED_SIZE);
+
+ *os << "::CORBA::Boolean _tao_is_bounded_size (" << be_idt << be_idt_nl
+ << "const " << node->name ()
+ << " &_tao_sequence" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (bt->node_type () == AST_Decl::NT_sequence)
+ {
+ this->visit_node (node);
+ }
+ else
+ {
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_sequence_serializer_op_cs::"
+ "visit_sequence - "
+ "Base type codegen failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // --- _dcps_max_marshaled_size ---
+
+ this->ctx_->sub_state (TAO_CodeGen::TAO_MAX_MARSHALED_SIZE);
+
+ *os << "size_t _dcps_max_marshaled_size (" << be_idt << be_idt_nl
+ << "const " << node->name ()
+ << " &_tao_sequence" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (bt->node_type () == AST_Decl::NT_sequence)
+ {
+ this->visit_node (node);
+ }
+ else
+ {
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_sequence_serializer_op_cs::"
+ "visit_sequence - "
+ "Base type codegen failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // --- _dcps_find_size ---
+ this->ctx_->sub_state (TAO_CodeGen::TAO_FIND_SIZE);
+
+ *os << "size_t _dcps_find_size (" << be_idt << be_idt_nl
+ << "const " << node->name ()
+ << " &_tao_sequence" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (bt->node_type () == AST_Decl::NT_sequence)
+ {
+ this->visit_node (node);
+ }
+ else
+ {
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_sequence_serializer_op_cs::"
+ "visit_sequence - "
+ "Base type codegen failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+
+ // --- 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::DCPS::Serializer &strm," << be_nl
+ << "const " << node->name ()
+ << " &_tao_sequence" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ // First encode the sequence length.
+ *os << "const ::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;
+
+
+ if (bt->node_type () == AST_Decl::NT_sequence)
+ {
+ this->visit_node (node);
+ }
+ else
+ {
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_sequence_serializer_op_cs::"
+ "visit_sequence - "
+ "Base type codegen failed\n"),
+ -1);
+ }
+ }
+
+ *os << "}" << be_uidt_nl << be_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // --- operator>> ---
+
+ // Set the sub state as generating code for the input operator.
+ this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_INPUT);
+
+ *os << "::CORBA::Boolean operator>> (" << be_idt << be_idt_nl
+ << "TAO::DCPS::Serializer &";
+
+ if (! bt->is_local ())
+ {
+ *os << "strm";
+ }
+
+ *os << "," << be_nl
+ << node->name () << " &";
+
+ if (! bt->is_local ())
+ {
+ *os << "_tao_sequence";
+ }
+
+ *os << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (! bt->is_local ())
+ {
+ // 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;
+
+ // Now check if the length does not exceed the maximum. We do this only
+ // for bounded sequences
+ AST_Expression *expr = node->max_size ();
+
+ if (expr == 0 || (expr != 0 && expr->ev () == 0))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_sequence - "
+ "bad sequence dimension\n"),
+ -1);
+ }
+
+ if (expr->ev ()->et == AST_Expression::EV_ulong)
+ {
+ if (expr->ev ()->u.ulval > 0)
+ {
+ // We are dealing with a bounded sequence. Check if we are within
+ // bounds.
+ *os << "if (_tao_seq_len <= _tao_sequence.maximum ())" << be_idt_nl
+ << "{" << be_idt_nl;
+ }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_sequence - "
+ "bad sequence dimension value\n"),
+ -1);
+ }
+
+ *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.
+ *os << "// If length is 0 we return true." << be_nl;
+ *os << "if (0 >= _tao_seq_len) " << be_idt_nl
+ << "{" << be_idt_nl;
+ *os << "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+
+ *os << "// Retrieve all the elements." << be_nl;
+
+ if (bt->node_type () == AST_Decl::NT_sequence)
+ {
+ this->visit_node (node);
+ }
+ else
+ {
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_sequence_serializer_op_cs::"
+ "visit_sequence - "
+ "Base type codegen failed\n"),
+ -1);
+ }
+ }
+
+ if (expr->ev ()->u.ulval > 0)
+ {
+ // We are dealing with a bounded sequence.
+ *os << be_nl << "}" << be_uidt << be_uidt;
+ }
+
+ *os << be_nl << "}" << be_uidt_nl << be_nl;
+ }
+
+ *os << "return 0;" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "#endif /* _TAO_SERIALIZER_OP_"
+ << node->flat_name () << "_CPP_ */";
+
+ node->cli_stub_serializer_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_sequence_serializer_op_cs::visit_array (be_array *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_serializer_op_cs::visit_enum (be_enum *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // 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.
+
+ be_sequence *sequence = this->ctx_->be_node_as_sequence ();
+
+ if (!sequence)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_enum - "
+ "bad sequence node\n"),
+ -1);
+ }
+
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_IS_BOUNDED_SIZE:
+ *os << "ACE_UNUSED_ARG(_tao_sequence);" << be_nl;
+ if (sequence->unbounded ())
+ *os << "return false; /* unbounded enum sequence */";
+ else
+ *os << "return true; /* bounded enum sequence */";
+ break;
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ *os << "//enum types are fixed size so OK to call max_marshaled_size"
+ << be_nl;
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ *os << "//sequence of enum = ulong for length + ulong for enum * length"
+ << be_nl;
+ *os << "return _dcps_max_marshaled_size_ulong () + "
+ << "_dcps_max_marshaled_size_ulong () * "
+ << be_idt << be_idt_nl;
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ *os << "_tao_sequence.length();" << be_uidt << be_uidt;
+ break;
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ *os << "_tao_sequence.maximum();" << be_uidt << be_uidt;
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_enum - "
+ "bad sub_state for seq length\n"),
+ -1);
+ }
+ break;
+ default:
+ return this->visit_node (node);
+ }
+ return 0;
+}
+
+int
+be_visitor_sequence_serializer_op_cs::visit_interface (be_interface *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_serializer_op_cs::visit_interface_fwd (be_interface_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_serializer_op_cs::visit_component (be_component *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_serializer_op_cs::visit_component_fwd (be_component_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_serializer_op_cs::visit_home (be_home *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_serializer_op_cs::visit_valuetype (be_valuetype *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_serializer_op_cs::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_serializer_op_cs::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_serializer_op_cs::visit_eventtype_fwd (be_eventtype_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_serializer_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_value:
+ case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_any:
+ return this->visit_node (node);
+ case AST_PredefinedType::PT_void:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_predefined_type - "
+ "Bad primitive type\n"),
+ -1);
+ default:
+ break;
+ };
+
+ // 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.
+
+ be_sequence *sequence = this->ctx_->be_node_as_sequence ();
+
+ if (!sequence)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_predefined_type - "
+ "bad sequence node\n"),
+ -1);
+ }
+
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_IS_BOUNDED_SIZE:
+ *os << "ACE_UNUSED_ARG(_tao_sequence);" << be_nl;
+ if (sequence->unbounded ())
+ *os << "return false; /* seq<predef'd> */";
+ else
+ *os << "return true; /* seq<predef'd,N> */";
+ break;
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ *os << "//primitive types are fixed size so OK to call max_marshaled_size"
+ << be_nl;
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_octet:
+ *os << "return _dcps_max_marshaled_size_ulong () + "
+ << "_dcps_max_marshaled_size_octet ()"
+ << be_idt << be_idt_nl;
+ break;
+ case AST_PredefinedType::PT_char:
+ *os << "return _dcps_max_marshaled_size_ulong () + "
+ << "_dcps_max_marshaled_size_char ()"
+ << be_idt << be_idt_nl;
+ break;
+ case AST_PredefinedType::PT_wchar:
+ *os << "return _dcps_max_marshaled_size_ulong () + "
+ << "_dcps_max_marshaled_size_wchar ()"
+ << be_idt << be_idt_nl;
+ break;
+ case AST_PredefinedType::PT_long:
+ case AST_PredefinedType::PT_ulong:
+ case AST_PredefinedType::PT_short:
+ case AST_PredefinedType::PT_ushort:
+ case AST_PredefinedType::PT_float:
+ case AST_PredefinedType::PT_double:
+ case AST_PredefinedType::PT_longlong:
+ case AST_PredefinedType::PT_ulonglong:
+ case AST_PredefinedType::PT_longdouble:
+ *os << "//sequence is of a fixed sized predefined type = "
+ << "sizeof(ULong) + type size * length" << be_nl;
+ *os << node->name () << " a_base_value;" << be_nl;
+ *os << "return _dcps_max_marshaled_size_ulong () + "
+ << "_dcps_max_marshaled_size (a_base_value)"
+ << be_idt << be_idt_nl;
+ break;
+ break;
+ case AST_PredefinedType::PT_boolean:
+ *os << "return _dcps_max_marshaled_size_ulong () + "
+ << "_dcps_max_marshaled_size_boolean ()"
+ << be_idt << be_idt_nl;
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_predefined_type - "
+ "bad primitive type for _dcps_max_marshaled_size code gen\n"),
+ -1);
+ }
+
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ *os << " * _tao_sequence.length();" << be_uidt << be_uidt;
+ break;
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ *os << " * _tao_sequence.maximum();" << be_uidt << be_uidt;
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_serializer_op_cs::"
+ "visit_predefined_type - "
+ "bad sub_state for seq length\n"),
+ -1);
+ }
+ break;
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ {
+ /*
+ * Avoiding the work to make TAO::DCPS::Serializer handle the
+ * TAO_NO_COPY_OCTET_SEQUENCES optimization.
+ * TBD - support this optimization -- see corresponding CDR code.
+ */
+ *os << "return strm.";
+
+ // 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:
+ *os << "read_";
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "write_";
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_predefined_type - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ // Determine what kind of sequence are we reading/writing.
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_long:
+ *os << "long_array";
+ break;
+ case AST_PredefinedType::PT_ulong:
+ *os << "ulong_array";
+ break;
+ case AST_PredefinedType::PT_short:
+ *os << "short_array";
+ break;
+ case AST_PredefinedType::PT_ushort:
+ *os << "ushort_array";
+ break;
+ case AST_PredefinedType::PT_octet:
+ *os << "octet_array";
+ break;
+ case AST_PredefinedType::PT_char:
+ *os << "char_array";
+ break;
+ case AST_PredefinedType::PT_wchar:
+ *os << "wchar_array";
+ break;
+ case AST_PredefinedType::PT_float:
+ *os << "float_array";
+ break;
+ case AST_PredefinedType::PT_double:
+ *os << "double_array";
+ break;
+ case AST_PredefinedType::PT_longlong:
+ *os << "longlong_array";
+ break;
+ case AST_PredefinedType::PT_ulonglong:
+ *os << "ulonglong_array";
+ break;
+ case AST_PredefinedType::PT_longdouble:
+ *os << "longdouble_array";
+ break;
+ case AST_PredefinedType::PT_boolean:
+ *os << "boolean_array";
+ break;
+ default:
+ // error
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_predefined_type - "
+ "bad primitive type for optimized code gen\n"),
+ -1);
+ }
+
+ // Handle special case to avoid compiler errors.
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_char:
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ *os << " ((char *)_tao_sequence.get_buffer (), ";
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << " ((const char *)_tao_sequence.get_buffer (), ";
+ break;
+ default:
+ // error
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs"
+ "::visit_predefined_type - "
+ "bad codegen substate\n"),
+ -1);
+ }
+ break;
+ default:
+ *os << " (_tao_sequence.get_buffer (), ";
+ break;
+ }
+
+ *os << "_tao_sequence.length ());" << be_uidt_nl;
+
+ } // end TAO_CDR_INPUT/OUTPUT case
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_predefined_type - outter "
+ "bad sub state\n"),
+ -1);
+ } // end outter switch
+
+ return 0;
+}
+
+int
+be_visitor_sequence_serializer_op_cs::visit_string (be_string *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_serializer_op_cs::visit_structure (be_structure *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_serializer_op_cs::visit_union (be_union *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_serializer_op_cs::visit_typedef (be_typedef *node)
+{
+ 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_serializer_op_cs::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_sequence_serializer_op_cs::visit_node (be_type *bt)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_sequence *node = this->ctx_->be_node_as_sequence ();
+
+ if (!node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - "
+ "bad sequence node\n"),
+ -1);
+ }
+
+ be_visitor_context ctx (*this->ctx_);
+ 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.
+
+ AST_Expression *expr = node->max_size ();
+
+ if (expr == 0 || (expr != 0 && expr->ev () == 0))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - "
+ "bad sequence dimension\n"),
+ -1);
+ }
+
+ AST_Decl::NodeType nt = bt->node_type ();
+ be_typedef *td = 0;
+
+ if (nt == AST_Decl::NT_typedef)
+ {
+ td = be_typedef::narrow_from_decl (bt);
+ nt = td->base_node_type ();
+ }
+
+switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_IS_BOUNDED_SIZE:
+ if (node->unbounded ())
+ {
+ *os << "ACE_UNUSED_ARG(_tao_sequence);" << be_nl;
+ *os << "return false; /* unbounded sequence */";
+ }
+ else
+
+ switch (nt)
+ {
+ case AST_Decl::NT_enum:
+ *os << "ACE_UNUSED_ARG(_tao_sequence);" << be_nl;
+ *os << "return true; // bounded seqence of enums";
+ break;
+ case AST_Decl::NT_union:
+ *os << "ACE_UNUSED_ARG(_tao_sequence);" << be_nl;
+ *os << "// Always return false for a union because " << be_nl
+ << "// _dcps_max_marshaled_size may produce an access violation."
+ << be_nl
+ << "return false; // seq of union " << bt->name () << be_uidt;
+ break;
+ case AST_Decl::NT_sequence:
+ case AST_Decl::NT_struct:
+ // its a type that should be defined in the generated code.
+ *os << "ACE_UNUSED_ARG(_tao_sequence);" << be_nl;
+ *os << bt->name () << " a_base_value;" << be_nl;
+ *os << "return _tao_is_bounded_size (a_base_value);";
+ break;
+ case AST_Decl::NT_array:
+ *os << "ACE_UNUSED_ARG(_tao_sequence);" << be_nl;
+ *os << bt->name () << " a_base_value;" << be_nl;
+ *os << bt->name () << "_forany tmp(a_base_value);" << be_nl;
+ *os << "return _tao_is_bounded_size (tmp);" << be_uidt_nl;
+ break;
+ case AST_Decl::NT_string:
+ case AST_Decl::NT_wstring:
+ {
+ be_string *str =
+ be_string::narrow_from_decl (
+ td == 0 ? bt : td->primitive_base_type ()
+ );
+
+ if (!str)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - "
+ "bad string node\n"),
+ -1);
+ }
+
+ *os << "ACE_UNUSED_ARG(_tao_sequence);" << be_nl;
+ if (str->max_size ()->ev ()->u.ulval == 0)
+ {
+ // Unbounded string
+ *os << "return false; /* bounded seq of unbounded strings */";
+ }
+ else
+ {
+ *os << "return true; /* bounded seq of bounded strings */";
+ }
+ }
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - is_bounded_size - "
+ "unsupported sequence base type\n"),
+ -1);
+ break;
+ }
+ break;
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ switch (nt)
+ {
+ case AST_Decl::NT_enum:
+ *os << "// sequence of enums" << be_nl
+ << "return _dcps_max_marshaled_size_ulong () + " << be_idt_nl
+ << "_tao_sequence.maximum() * " << be_nl
+ << "_dcps_max_marshaled_size_ulong ();" << be_uidt;
+ break;
+ case AST_Decl::NT_union:
+ *os << "ACE_UNUSED_ARG(_tao_sequence);" << be_nl;
+ *os << "// do not try getting the _dcps_max_marshaled_size" << be_nl
+ << "// doing so may produce an access violation" << be_nl
+ << "return 100000; // seq of union " << bt->name () << be_uidt;
+ break;
+ case AST_Decl::NT_sequence:
+ case AST_Decl::NT_struct:
+ // its a type that should be defined in the generated code.
+ *os << bt->name () << " a_base_value;" << be_nl
+ << "return _dcps_max_marshaled_size_ulong () + " << be_idt_nl
+ << "_tao_sequence.maximum() * " << be_nl
+ << "_dcps_max_marshaled_size (a_base_value);" << be_uidt;
+ break;
+ case AST_Decl::NT_array:
+ *os << bt->name () << " a_base_value;" << be_nl;
+ *os << bt->name() << "_forany tmp(a_base_value);" << be_nl;
+ *os << "return _dcps_max_marshaled_size_ulong () + " << be_idt_nl
+ << "_tao_sequence.maximum() * " << be_nl;
+ *os << "_dcps_max_marshaled_size (tmp);" << be_uidt_nl;
+
+ break;
+ case AST_Decl::NT_string:
+ case AST_Decl::NT_wstring:
+ {
+ be_string *str =
+ be_string::narrow_from_decl (
+ td == 0 ? bt : td->primitive_base_type ()
+ );
+
+ if (!str)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - "
+ "bad string node\n"),
+ -1);
+ }
+
+ u_long max_size = str->max_size ()->ev ()->u.ulval;
+ if (max_size == 0)
+ *os << "// bounded seq of unbounded strings" << be_nl;
+ else
+ *os << "// bounded seq of bounded strings" << be_nl;
+
+ char buff[15];
+ ACE_OS::sprintf(buff, "%ld", max_size);
+ *os << "return _dcps_max_marshaled_size_ulong () + " << be_nl
+ << " _tao_sequence.maximum() * ";
+ *os << "(_dcps_max_marshaled_size_ulong () + " << buff << ");";
+
+ }
+ break;
+ case AST_Decl::NT_interface:
+ *os << "//DCPS - Sequence of interfaces is not supported" << be_nl;
+ *os << "return 77777;" << be_nl;
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - is_bounded_size - "
+ "unsupported sequence base type\n"),
+ -1);
+ break;
+ }
+ break;
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ {
+ *os << "//iterate over the sequence to find the current size" << be_nl
+ << "size_t the_length = _dcps_max_marshaled_size_ulong ();" << be_nl
+ << "for ( ::CORBA::ULong i = 0; i < _tao_sequence.length(); "
+ << "++i)" << be_idt_nl
+ << "{" << be_idt_nl;
+
+ switch (nt)
+ {
+ case AST_Decl::NT_enum:
+ *os << "the_length += _dcps_max_marshaled_size_ulong (); // enum" << be_uidt_nl;
+ break;
+ case AST_Decl::NT_union:
+ case AST_Decl::NT_sequence:
+ case AST_Decl::NT_struct:
+ // its a type that should be defined in the generated code.
+ *os << "the_length += _dcps_find_size (_tao_sequence[i]);" << be_uidt_nl;
+ break;
+ case AST_Decl::NT_array:
+ if (bt->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - "
+ "base type visit failed\n"),
+ -1);
+ }
+
+ *os << "_var tmp_var (" << be_idt << be_idt_nl;
+
+ if (bt->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - "
+ "base type visit failed\n"),
+ -1);
+ }
+
+ *os << "_dup (_tao_sequence[i])" << be_uidt_nl
+ << ");" << be_uidt_nl;
+
+ if (bt->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - "
+ "base type visit failed\n"),
+ -1);
+ }
+
+ *os << "_forany tmp (tmp_var.inout ());" << be_nl;
+ *os << "the_length += _dcps_find_size (tmp);" << be_uidt_nl;
+
+ break;
+ case AST_Decl::NT_string:
+ case AST_Decl::NT_wstring:
+ *os << "the_length += _dcps_max_marshaled_size_ulong () + "
+ << "ACE_OS::strlen (_tao_sequence[i]);" << be_uidt_nl;
+ break;
+ case AST_Decl::NT_interface:
+ *os << "//DCPS - Sequence of interfaces is not supported" << be_nl;
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - is_bounded_size - "
+ "unsupported sequence base type\n"),
+ -1);
+ break;
+ }
+
+
+ *os << "}" << be_uidt_nl
+ << "return the_length;";
+ }
+ break;
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ {
+ // Initialize a boolean variable.
+ *os << "::CORBA::Boolean _tao_marshal_flag = true;" << be_nl << be_nl;
+
+
+ if (expr->ev ()->et == AST_Expression::EV_ulong)
+ {
+ *os << "for ( ::CORBA::ULong i = 0; i < _tao_seq_len"
+ << " && _tao_marshal_flag; "
+ << "++i)" << be_idt_nl
+ << "{" << be_idt_nl;
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - "
+ "bad sequence dimension value\n"),
+ -1);
+ }
+
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ switch (nt)
+ {
+ case AST_Decl::NT_array:
+ if (bt->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - "
+ "base type visit failed\n"),
+ -1);
+ }
+
+ *os << "_forany tmp (";
+
+ if (bt->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - "
+ "base type visit failed\n"),
+ -1);
+ }
+
+ *os << "_alloc ());" << be_nl;
+ *os << "_tao_marshal_flag = (strm >> tmp);" << be_nl;
+
+ if (bt->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - "
+ "base type visit failed\n"),
+ -1);
+ }
+
+ *os << "_copy (_tao_sequence[i], tmp.in ());" << be_nl;
+
+ if (bt->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - "
+ "base type visit failed\n"),
+ -1);
+ }
+
+ *os << "_free (tmp.inout ());" << be_uidt_nl;
+
+ break;
+ case AST_Decl::NT_string:
+ case AST_Decl::NT_wstring:
+ {
+ be_string *str =
+ be_string::narrow_from_decl (
+ td == 0 ? bt : td->primitive_base_type ()
+ );
+
+ if (!str)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - "
+ "bad string node\n"),
+ -1);
+ }
+
+ if (str->max_size ()->ev ()->u.ulval == 0)
+ {
+ // Unbounded.
+ *os << node->name ()
+ << "::value_type * buffer = _tao_sequence.get_buffer();"
+ << be_idt_nl;;
+ *os << "_tao_marshal_flag = (strm >> buffer[i]);"
+ << be_uidt_nl;
+ }
+ else
+ {
+ if (str->width () == (long) sizeof (char))
+ {
+ *os << "_tao_marshal_flag = (strm >> "
+ << "::ACE_InputCDR::to_string (_tao_sequence[i].out (), ";
+ }
+ else
+ {
+ *os << "_tao_marshal_flag = (strm >> "
+ << "::ACE_InputCDR::to_wstring (_tao_sequence[i].out (), ";
+ }
+
+ *os << str->max_size ()->ev ()->u.ulval << "));"
+ << be_uidt_nl;
+ }
+ }
+ break;
+ case AST_Decl::NT_interface:
+ case AST_Decl::NT_interface_fwd:
+ case AST_Decl::NT_valuetype:
+ case AST_Decl::NT_valuetype_fwd:
+ *os << "//DCPS does not support interfaces and value types";
+
+ 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 (
+ td == 0 ? bt : td->primitive_base_type ()
+ );
+
+ if (!pt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - "
+ "bad predefined type node\n"),
+ -1);
+ }
+
+ switch (pt->pt ())
+ {
+ case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
+ case AST_PredefinedType::PT_value:
+ *os << "_tao_marshal_flag = (strm >> _tao_sequence[i].out ());";
+ break;
+ case AST_PredefinedType::PT_char:
+ *os << "_tao_marshal_flag =" << be_idt_nl
+ << "(strm >> ::ACE_InputCDR::to_char (_tao_sequence[i]));"
+ << be_uidt;
+ break;
+ case AST_PredefinedType::PT_wchar:
+ *os << "_tao_marshal_flag =" << be_idt_nl
+ << "(strm >> ::ACE_InputCDR::to_wchar (_tao_sequence[i]));"
+ << be_uidt;
+ break;
+ case AST_PredefinedType::PT_boolean:
+ *os << "_tao_marshal_flag =" << be_idt_nl
+ << "(strm >> ::ACE_InputCDR::to_boolean (_tao_sequence[i]));"
+ << be_uidt;
+ break;
+ case AST_PredefinedType::PT_octet:
+ *os << "_tao_marshal_flag =" << be_idt_nl
+ << "(strm >> ::ACE_InputCDR::to_octet (_tao_sequence[i]));"
+ << be_uidt;
+ break;
+ default:
+ *os << "_tao_marshal_flag = (strm >> _tao_sequence[i]);";
+ break;
+ }
+ }
+
+ break;
+ default:
+ *os << "_tao_marshal_flag = (strm >> _tao_sequence[i]);";
+
+ break;
+ }
+
+ *os << be_uidt_nl
+ << "}";
+
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ switch (nt)
+ {
+ case AST_Decl::NT_array:
+ if (bt->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - "
+ "base type visit failed\n"),
+ -1);
+ }
+
+ *os << "_var tmp_var (" << be_idt << be_idt_nl;
+
+ if (bt->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - "
+ "base type visit failed\n"),
+ -1);
+ }
+
+ *os << "_dup (_tao_sequence[i])" << be_uidt_nl
+ << ");" << be_uidt_nl;
+
+ if (bt->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - "
+ "base type visit failed\n"),
+ -1);
+ }
+
+ *os << "_forany tmp (tmp_var.inout ());" << be_nl;
+ *os << "_tao_marshal_flag = (strm << tmp);";
+
+ break;
+ case AST_Decl::NT_interface:
+ case AST_Decl::NT_interface_fwd:
+ *os << "//DCPS does not support interfaces";
+
+ break;
+ case AST_Decl::NT_string:
+ case AST_Decl::NT_wstring:
+ *os << "_tao_marshal_flag = (strm << _tao_sequence[i]);";
+ break;
+ case AST_Decl::NT_valuetype:
+ case AST_Decl::NT_valuetype_fwd:
+ *os << "//DCPS does not support value types";
+
+ break;
+ case AST_Decl::NT_pre_defined:
+ {
+ //SHH harris_s@ociweb.com - I am not sure you can every get here
+ // predefined types are handled by be_visitor_sequence_serializer_op_cs::visit_predefined_type
+ be_predefined_type *pt =
+ be_predefined_type::narrow_from_decl (
+ td == 0 ? bt : td->primitive_base_type ()
+ );
+
+ if (!pt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - "
+ "bad predefined type node\n"),
+ -1);
+ }
+
+ switch (pt->pt ())
+ {
+ case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
+ case AST_PredefinedType::PT_value:
+ *os << "_tao_marshal_flag = (strm << _tao_sequence[i].in ());";
+ break;
+ case AST_PredefinedType::PT_char:
+ *os << "_tao_marshal_flag =" << be_idt_nl
+ << "(strm << ::ACE_OutputCDR::from_char (_tao_sequence[i]));"
+ << be_uidt;
+ break;
+ case AST_PredefinedType::PT_wchar:
+ *os << "_tao_marshal_flag =" << be_idt_nl
+ << "(strm << ::ACE_OutputCDR::from_wchar (_tao_sequence[i]));"
+ << be_uidt;
+ break;
+ case AST_PredefinedType::PT_boolean:
+ *os << "_tao_marshal_flag =" << be_idt_nl
+ << "(strm << ::ACE_OutputCDR::from_boolean (_tao_sequence[i]));"
+ << be_uidt;
+ break;
+ case AST_PredefinedType::PT_octet:
+ *os << "_tao_marshal_flag =" << be_idt_nl
+ << "(strm << ::ACE_OutputCDR::from_octet (_tao_sequence[i]));"
+ << be_uidt;
+ break;
+ default:
+ *os << "_tao_marshal_flag = (strm << _tao_sequence[i]);";
+ break;
+ }
+ }
+
+ break;
+ default:
+ *os << "_tao_marshal_flag = (strm << _tao_sequence[i]);";
+
+ break;
+ }
+
+ *os << be_uidt_nl
+ << "}";
+
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl << be_nl;
+ *os << "return _tao_marshal_flag;" << be_uidt_nl;
+ }
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_serializer_op_cs::"
+ "visit_node - "
+ "bad sub state\n"),
+ -1);
+ break;
+} //outer switch
+
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_structure.cpp b/TAO/TAO_IDL/be/be_visitor_structure.cpp
new file mode 100644
index 00000000000..69d2b266c0b
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_structure.cpp
@@ -0,0 +1,45 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_structure.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Structure
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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 "ace/Log_Msg.h"
+
+#include "be_visitor_structure/structure.cpp"
+#include "be_visitor_structure/structure_ch.cpp"
+#include "be_visitor_structure/structure_ci.cpp"
+#include "be_visitor_structure/structure_cs.cpp"
+#include "be_visitor_structure/any_op_ch.cpp"
+#include "be_visitor_structure/any_op_cs.cpp"
+#include "be_visitor_structure/cdr_op_ch.cpp"
+#include "be_visitor_structure/cdr_op_cs.cpp"
+#include "be_visitor_structure/serializer_op_ch.cpp"
+#include "be_visitor_structure/serializer_op_cs.cpp"
+
+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
new file mode 100644
index 00000000000..3d30576a792
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_structure/any_op_ch.cpp
@@ -0,0 +1,155 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Any operators for structures
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_structure,
+ any_op_ch,
+ "$Id$")
+
+// ***************************************************************************
+// Structure visitor for generating Any operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_structure_any_op_ch::be_visitor_structure_any_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_structure (ctx)
+{
+}
+
+be_visitor_structure_any_op_ch::~be_visitor_structure_any_op_ch (void)
+{
+}
+
+int
+be_visitor_structure_any_op_ch::visit_structure (be_structure *node)
+{
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ const char *macro = this->ctx_->export_macro ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *os << macro << " void operator<<= (::CORBA::Any &, const " << node->name ()
+ << " &); // copying version" << be_nl;
+ *os << macro << " void operator<<= (::CORBA::Any &, " << node->name ()
+ << "*); // noncopying version" << be_nl;
+ *os << macro << " ::CORBA::Boolean operator>>= (const ::CORBA::Any &, "
+ << node->name () << " *&); // deprecated\n";
+ *os << macro << " ::CORBA::Boolean operator>>= (const ::CORBA::Any &, const "
+ << node->name () << " *&);";
+
+ *os << be_global->core_versioning_end () << 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_structure::visit_structure - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ node->cli_hdr_any_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_structure_any_op_ch::visit_field (be_field *node)
+{
+ be_type *bt;
+
+ // First generate the type information.
+ bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_any_op_ch::"
+ "visit_field - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_any_op_ch::"
+ "visit_field - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_structure_any_op_ch::visit_union (be_union *node)
+{
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ be_visitor_union_any_op_ch visitor (this->ctx_);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_any_op_ch::"
+ "visit_union - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_structure_any_op_ch::visit_enum (be_enum *node)
+{
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ be_visitor_enum_any_op_ch visitor (this->ctx_);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_any_op_ch::"
+ "visit_enum - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp
new file mode 100644
index 00000000000..ec9ee323817
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp
@@ -0,0 +1,241 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Any operators for structures
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_structure,
+ any_op_cs,
+ "$Id$")
+
+// ***************************************************************************
+// Structure visitor for generating Any operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_structure_any_op_cs::be_visitor_structure_any_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_structure (ctx)
+{
+}
+
+be_visitor_structure_any_op_cs::~be_visitor_structure_any_op_cs (void)
+{
+}
+
+int
+be_visitor_structure_any_op_cs::visit_structure (be_structure *node)
+{
+ if (node->cli_stub_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl
+ << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ // Since we don't generate CDR stream operators for types that
+ // explicitly contain a local interface (at some level), we
+ // must override these Any template class methods to avoid
+ // calling the non-existent operators. The zero return value
+ // will eventually cause CORBA::MARSHAL to be raised if this
+ // type is inserted into an Any and then marshaled.
+ if (node->is_local ())
+ {
+ *os << be_nl << be_nl
+ << "namespace TAO" << be_nl
+ << "{" << be_idt_nl
+ << "template<>" << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "Any_Dual_Impl_T<" << node->name ()
+ << ">::marshal_value (TAO_OutputCDR &)" << be_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "template<>" << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "Any_Dual_Impl_T<" << node->name ()
+ << ">::demarshal_value (TAO_InputCDR &)" << be_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}";
+ }
+
+ // Copying insertion.
+ *os << "// Copying insertion." << be_nl
+ << "void operator<<= (" << be_idt << be_idt_nl
+ << "::CORBA::Any &_tao_any," << be_nl
+ << "const " << node->name () << " &_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+
+ << "if (0 == &_tao_elem) // Trying to de-reference NULL object" << be_idt_nl
+ << "_tao_any <<= static_cast<" << node->name () << " *>( 0 ); // Use non-copying insertion of a NULL" << be_uidt_nl
+ << "else" << be_idt_nl
+
+ << "TAO::Any_Dual_Impl_T<" << node->name () << ">::insert_copy ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Non-copying insertion.
+ *os << "// Non-copying insertion." << be_nl
+ << "void operator<<= (" << be_idt << be_idt_nl
+ << "::CORBA::Any &_tao_any," << be_nl
+ << node->name () << " *_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "TAO::Any_Dual_Impl_T<" << node->name () << ">::insert ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Extraction to non-const pointer (deprecated, just calls the other).
+ *os << "// Extraction to non-const pointer (deprecated)." << be_nl
+ << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl
+ << "const ::CORBA::Any &_tao_any," << be_nl
+ << node->name () << " *&_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return _tao_any >>= const_cast<" << be_idt << be_idt_nl
+ << "const " << node->name () << " *&> (" << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Extraction to const pointer.
+ *os << "// Extraction to const pointer." << be_nl
+ << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl
+ << "const ::CORBA::Any &_tao_any," << be_nl
+ << "const " << node->name () << " *&_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return" << be_idt_nl
+ << "TAO::Any_Dual_Impl_T<" << node->name () << ">::extract ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}";
+
+ *os << be_global->core_versioning_end () << 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_structure::visit_structure - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ node->cli_stub_any_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_structure_any_op_cs::visit_field (be_field *node)
+{
+ // 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_structure_any_op_cs::"
+ "visit_field - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_any_op_cs::"
+ "visit_field - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_structure_any_op_cs::visit_union (be_union *node)
+{
+ if (node->cli_stub_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ be_visitor_union_any_op_cs visitor (this->ctx_);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_any_op_cs::"
+ "visit_union - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_structure_any_op_cs::visit_enum (be_enum *node)
+{
+ if (node->cli_stub_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ be_visitor_enum_any_op_cs visitor (this->ctx_);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_any_op_cs::"
+ "visit_enum - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
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
new file mode 100644
index 00000000000..8986fd0f56b
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ch.cpp
@@ -0,0 +1,82 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for CDR operators for structures. This uses
+// compiled marshaling.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+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;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator<< (TAO_OutputCDR &, const " << node->name ()
+ << " &);" << be_nl;
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator>> (TAO_InputCDR &, "
+ << node->name () << " &);";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ // Set the substate as generating code for the types defined in our scope.
+ this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
+
+ 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);
+ }
+
+
+ node->cli_hdr_cdr_op_gen (1);
+ 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
new file mode 100644
index 00000000000..2463764b749
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_cs.cpp
@@ -0,0 +1,167 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for CDR operators for structures
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+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;
+ }
+
+ // Set the substate as generating code for the types defined in our scope.
+ this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_SCOPE);
+
+ 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);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << 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 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 (*this->ctx_);
+ be_visitor_cdr_op_field_decl field_decl (&new_ctx);
+ field_decl.visit_scope (node);
+
+ *os << "return" << be_idt_nl;
+
+ 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);
+ }
+
+ *os << ";" << 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 operator>> (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &";
+
+ if (! node->is_local ())
+ {
+ *os << "strm";
+ }
+
+ *os << "," << be_nl
+ << node->name () << " &";
+
+ if (! node->is_local ())
+ {
+ *os << "_tao_aggregate";
+ }
+
+ *os << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (node->is_local ())
+ {
+ *os << "return false;";
+ }
+ else
+ {
+ new_ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT);
+ field_decl.visit_scope (node);
+
+ *os << "return" << be_idt_nl;
+
+ 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);
+ }
+
+ *os << ";" << be_uidt << be_uidt;
+ }
+
+ *os << be_uidt_nl << "}";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ node->cli_stub_cdr_op_gen (true);
+ return 0;
+}
+
+int
+be_visitor_structure_cdr_op_cs::post_process (be_decl *bd)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (!this->last_node (bd)
+ && bd->node_type () != AST_Decl::NT_enum_val)
+ {
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ *os << " &&" << be_nl;
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ default:
+ break;
+ };
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_structure/serializer_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_structure/serializer_op_ch.cpp
new file mode 100644
index 00000000000..7b5b502332b
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_structure/serializer_op_ch.cpp
@@ -0,0 +1,140 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for TAO::DCPS::Serializer operators for
+// structures. This uses compiled marshaling.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_structure,
+ serializer_op_ch,
+ "$Id$")
+
+#include "global_extern.h"
+
+// ***************************************************************************
+// Structure visitor for generating Serializer operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_structure_serializer_op_ch::be_visitor_structure_serializer_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_structure (ctx)
+{
+}
+
+be_visitor_structure_serializer_op_ch::~be_visitor_structure_serializer_op_ch (void)
+{
+}
+
+int
+be_visitor_structure_serializer_op_ch::visit_structure (be_structure *node)
+{
+ if (node->cli_hdr_serializer_op_gen ()
+ || node->imported ()
+ || node->is_local ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ IDL_GlobalData::DCPS_Data_Type_Info* info;
+ if (0 != (info = idl_global->is_dcps_type(node->name())))
+ {
+ *os << be_global->stub_export_macro ()
+ << " ::CORBA::Boolean _dcps_has_key(const "
+ << node->name() << "& val);" << be_nl;
+
+ *os << "// This structure supports use of std::map with a key" << be_nl
+ << "// defined by one or more #pragma DCPS_DATA_KEY lines." << be_nl
+ << "struct " << be_global->stub_export_macro () << " "
+ << node->name()->last_component() << "KeyLessThan " << be_nl
+ << "{" << be_idt_nl
+ << "bool operator() (" << be_idt << be_idt_nl
+ << "const " << node->name() << "& v1," << be_nl
+ << "const " << node->name() << "& v2) const" << be_uidt << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (info->key_list_.is_empty())
+ {
+ *os << "ACE_UNUSED_ARG(v1);" << be_nl;
+ *os << "ACE_UNUSED_ARG(v2);" << be_nl;
+ *os << "// if no DCPS_DATA_KEY values then return false" << be_nl
+ << "// to allow use of map with just one entry" << be_nl;
+ *os << "return false;" << be_nl;
+ }
+ else
+ {
+ *os << "return ";
+ IDL_GlobalData::DCPS_Data_Type_Info_Iter iter (info->key_list_);
+
+ for (ACE_CString *kp = 0;
+ iter.next (kp) != 0;
+ )
+ {
+ *os << "v1." << kp->c_str () << " < " << "v2." << kp->c_str ();
+ iter.advance ();
+ if (iter.done ())
+ *os << ";" << be_uidt_nl;
+ else
+ *os << " || " << be_nl;
+ }
+ }
+ *os << "}" << be_uidt_nl
+ << "};" << be_nl << be_nl;
+ }
+
+ //- _dcps_max_marshaled_size(type) method
+ *os << be_global->stub_export_macro ()
+ << " size_t _dcps_max_marshaled_size (const "
+ << node->name() << "& _tao_aggregate);" << be_nl;
+ //- _tao_is_bounded_size(type) method
+ *os << be_global->stub_export_macro ()
+ << " ::CORBA::Boolean _tao_is_bounded_size (const "
+ << node->name() << "& _tao_aggregate);" << be_nl;
+ //- _dcps_find_size(type) method
+ *os << be_global->stub_export_macro ()
+ << " size_t _dcps_find_size (const "
+ << node->name() << "& _tao_aggregate);" << be_nl;
+
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator<< (TAO::DCPS::Serializer &, const " << node->name ()
+ << " &);" << be_nl;
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator>> (TAO::DCPS::Serializer &, "
+ << node->name () << " &);";
+
+
+ // Set the substate as generating code for the types defined in our scope.
+ this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_serializer_op_ch::"
+ "visit_structure - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+
+ node->cli_hdr_serializer_op_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_structure/serializer_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_structure/serializer_op_cs.cpp
new file mode 100644
index 00000000000..f99dbf45b27
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_structure/serializer_op_cs.cpp
@@ -0,0 +1,311 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for TAO::DCPS::Serializer operators for structures
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_structure,
+ serializer_op_cs,
+ "$Id$")
+
+be_visitor_structure_serializer_op_cs::be_visitor_structure_serializer_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_structure (ctx)
+{
+}
+
+be_visitor_structure_serializer_op_cs::~be_visitor_structure_serializer_op_cs (void)
+{
+}
+
+int
+be_visitor_structure_serializer_op_cs::visit_structure (be_structure *node)
+{
+ if (node->cli_stub_serializer_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);
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_serializer_op_cs::"
+ "visit_structure - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ IDL_GlobalData::DCPS_Data_Type_Info* info;
+ if (0 != (info = idl_global->is_dcps_type(node->name())))
+ {
+ *os << "::CORBA::Boolean _dcps_has_key (const "
+ << node->name() << "& ) { " << be_idt_nl;
+ if (info->key_list_.is_empty())
+ *os << "return false;";
+ else
+ *os << "return true;";
+ *os << be_uidt_nl << "}" << be_nl;
+ }
+
+ //- _dcps_max_marshaled_size(type) method
+ this->ctx_->sub_state (TAO_CodeGen::TAO_MAX_MARSHALED_SIZE);
+ *os << "size_t "
+ << "_dcps_max_marshaled_size (const "
+ << node->name() << "& _tao_aggregate)" << be_nl
+ << "{" << be_idt_nl
+ << "ACE_UNUSED_ARG (_tao_aggregate);"
+ << " // sometimes not used - avoid warning" << be_nl;
+
+ {
+ be_visitor_context new_ctx (*this->ctx_);
+ be_visitor_serializer_op_field_decl field_decl (&new_ctx);
+ field_decl.visit_scope (node);
+#ifdef DCPS_DEBUG_IDL
+ *os << "size_t result = 0;" << be_nl;
+#else
+ *os << "return " << be_idt_nl;
+#endif
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_serializer_op_cs::"
+ "visit_structure - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+ }
+ *os << ";" << be_uidt << be_uidt_nl;
+#ifdef DCPS_DEBUG_IDL
+ *os << "return result;" << be_uidt_nl;
+#endif
+ *os << "}" << be_nl << be_nl;
+
+
+ //- _tao_is_bounded_size(type) method
+ this->ctx_->sub_state (TAO_CodeGen::TAO_IS_BOUNDED_SIZE);
+ *os << "::CORBA::Boolean _tao_is_bounded_size (const "
+ << node->name() << "& _tao_aggregate)" << be_nl
+ << "{" << be_idt_nl;
+
+ {
+ be_visitor_context new_ctx (*this->ctx_);
+ be_visitor_serializer_op_field_decl field_decl (&new_ctx);
+ field_decl.visit_scope (node);
+
+ *os << "ACE_UNUSED_ARG (_tao_aggregate);"
+ << " // often not used - avoid warning" << be_nl
+ << "return" << be_idt_nl;
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_serializer_op_cs::"
+ "visit_structure - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+ }
+ *os << ";" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ //- _dcps_find_size(type) method -- like max_marshaled_size but use len - not max.
+ this->ctx_->sub_state (TAO_CodeGen::TAO_FIND_SIZE);
+ *os << "size_t "
+ << "_dcps_find_size(const "
+ << node->name() << "& _tao_aggregate)" << be_nl
+ << "{" << be_idt_nl
+ << "ACE_UNUSED_ARG(_tao_aggregate);"
+ << " // sometimes not used - avoid warning" << be_nl;
+
+ {
+ be_visitor_context new_ctx (*this->ctx_);
+ be_visitor_serializer_op_field_decl field_decl (&new_ctx);
+ field_decl.visit_scope (node);
+#ifdef DCPS_DEBUG_IDL
+ *os << "size_t result = 0;" << be_nl;
+#else
+ *os << "return " << be_idt_nl;
+#endif
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_serializer_op_cs::"
+ "visit_structure - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+ }
+ *os << ";" << be_uidt << be_uidt_nl;
+#ifdef DCPS_DEBUG_IDL
+ *os << "return result;" << be_uidt_nl;
+#endif
+ *os << "}" << 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 operator<< (" << be_idt << be_idt_nl
+ << "TAO::DCPS::Serializer &strm," << be_nl
+ << "const " << node->name () << " &_tao_aggregate" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ be_visitor_context new_ctx (*this->ctx_);
+ be_visitor_serializer_op_field_decl field_decl (&new_ctx);
+ field_decl.visit_scope (node);
+
+ *os << "return" << be_idt_nl;
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_serializer_op_cs::"
+ "visit_structure - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ *os << ";" << 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 operator>> (" << be_idt << be_idt_nl
+ << "TAO::DCPS::Serializer &";
+
+ if (! node->is_local ())
+ {
+ *os << "strm";
+ }
+
+ *os << "," << be_nl
+ << node->name () << " &";
+
+ if (! node->is_local ())
+ {
+ *os << "_tao_aggregate";
+ }
+
+ *os << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (node->is_local ())
+ {
+ *os << "return 0;";
+ }
+ else
+ {
+ new_ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT);
+ field_decl.visit_scope (node);
+
+ *os << "return" << be_idt_nl;
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_serializer_op_cs"
+ "::visit_structure - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ *os << ";" << be_uidt << be_uidt;
+ }
+
+ *os << be_uidt_nl << "}";
+
+ node->cli_stub_serializer_op_gen (true);
+ return 0;
+}
+
+int
+be_visitor_structure_serializer_op_cs::post_process (be_decl *bd)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ case TAO_CodeGen::TAO_IS_BOUNDED_SIZE:
+ if (!this->last_node (bd))
+ {
+ *os << " &&" << be_nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ case TAO_CodeGen::TAO_FIND_SIZE:
+#ifdef DCPS_DEBUG_IDL
+ *os << ";" << be_nl;
+#else
+ if (!this->last_node (bd))
+ {
+ *os << " +" << be_nl;
+ }
+#endif
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ default:
+ break;
+ };
+
+ return 0;
+}
+
+int
+be_visitor_structure_serializer_op_cs::pre_process (be_decl *bd)
+{
+#ifdef DCPS_DEBUG_IDL
+ TAO_OutStream *os = this->ctx_->stream ();
+#else
+ ACE_UNUSED_ARG(bd);
+#endif
+
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_IS_BOUNDED_SIZE:
+ break;
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ case TAO_CodeGen::TAO_FIND_SIZE:
+#ifdef DCPS_DEBUG_IDL
+ *os << "result += ";
+#endif
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ default:
+ break;
+ };
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_structure/structure.cpp b/TAO/TAO_IDL/be/be_visitor_structure/structure.cpp
new file mode 100644
index 00000000000..7b766916e55
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_structure/structure.cpp
@@ -0,0 +1,118 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// structure.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Structures. This is a generic visitor.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_structure,
+ structure,
+ "$Id$")
+
+be_visitor_structure::be_visitor_structure (be_visitor_context *ctx)
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_structure::~be_visitor_structure (void)
+{
+}
+
+int
+be_visitor_structure::visit_structure (be_structure *)
+{
+ return -1; // Must be overriden.
+}
+
+int
+be_visitor_structure::visit_field (be_field *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ case TAO_CodeGen::TAO_UNION_PUBLIC_CH:
+ case TAO_CodeGen::TAO_UNION_PRIVATE_CH:
+ case TAO_CodeGen::TAO_ARRAY_CH:
+ {
+ be_visitor_field_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_field_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ case TAO_CodeGen::TAO_UNION_PUBLIC_CS:
+ {
+ be_visitor_field_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_field_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_field_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ {
+ be_visitor_field_serializer_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ be_visitor_field_serializer_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);
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure::"
+ "visit_field - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_structure/structure_ch.cpp b/TAO/TAO_IDL/be/be_visitor_structure/structure_ch.cpp
new file mode 100644
index 00000000000..180be301e35
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_structure/structure_ch.cpp
@@ -0,0 +1,105 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// structure_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Structure in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_structure,
+ structure_ch,
+ "$Id$")
+
+// ******************************************************
+// for client header
+// ******************************************************
+
+be_visitor_structure_ch::be_visitor_structure_ch (be_visitor_context *ctx)
+ : be_visitor_structure (ctx)
+{
+}
+
+be_visitor_structure_ch::~be_visitor_structure_ch (void)
+{
+}
+
+// Visit the Structure node and its scope.
+int be_visitor_structure_ch::visit_structure (be_structure *node)
+{
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ // Evaluate the member in time for the decision to generate
+ // the recursive typecode include in the stub source file.
+ ACE_Unbounded_Queue<AST_Type *> list;
+ (void) node->in_recursion (list);
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Generate the _var and _out typedefs.
+ node->gen_common_varout (os);
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl << be_nl
+ << "struct " << be_global->stub_export_macro () << " "
+ << node->local_name () << be_nl
+ << "{" << be_idt_nl;
+
+ // Generate the typedefs.
+ *os << "typedef " << node->local_name () << "_var _var_type;"
+ << be_nl
+ << "typedef " << node->local_name () << "_out _out_type;"
+ << be_nl << be_nl;
+
+ if (be_global->any_support ())
+ {
+ *os << "static void _tao_any_destructor (void *);";
+ }
+
+ // Generate code for field members.
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_ch::"
+ "visit_structure - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl;
+ *os << "};";
+
+ if (be_global->tc_support ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+ 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 (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_structure/structure_ci.cpp b/TAO/TAO_IDL/be/be_visitor_structure/structure_ci.cpp
new file mode 100644
index 00000000000..8feffbd15ea
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_structure/structure_ci.cpp
@@ -0,0 +1,58 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// structure_ci.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Structure in the inline file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_structure,
+ structure_ci,
+ "$Id$")
+
+// ******************************************************
+// for client inline
+// ******************************************************
+
+be_visitor_structure_ci::be_visitor_structure_ci (be_visitor_context *ctx)
+ : be_visitor_structure (ctx)
+{
+}
+
+be_visitor_structure_ci::~be_visitor_structure_ci (void)
+{
+}
+
+// visit the Structure node and its scope
+int be_visitor_structure_ci::visit_structure (be_structure *node)
+{
+ if (node->cli_inline_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ // All we have to do is to visit the scope.
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_ci::"
+ "visit_structure - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ node->cli_inline_gen (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_structure/structure_cs.cpp b/TAO/TAO_IDL/be/be_visitor_structure/structure_cs.cpp
new file mode 100644
index 00000000000..98c015f982e
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_structure/structure_cs.cpp
@@ -0,0 +1,96 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// structure_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Structures in the client stubs file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_structure,
+ structure_cs,
+ "$Id$")
+
+// ***************************************************************************
+// For client stubs.
+// ***************************************************************************
+
+be_visitor_structure_cs::be_visitor_structure_cs (be_visitor_context *ctx)
+ : be_visitor_structure (ctx)
+{
+}
+
+be_visitor_structure_cs::~be_visitor_structure_cs (void)
+{
+}
+
+int
+be_visitor_structure_cs::visit_structure (be_structure *node)
+{
+ if (node->cli_stub_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ if (be_global->tc_support ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+ // ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
+ TAO::be_visitor_struct_typecode visitor (&ctx);
+
+ if (visitor.visit_structure (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_cs::"
+ "visit_structure - "
+ "TypeCode definition failed\n"),
+ -1);
+ }
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl;
+ *os << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ if (be_global->any_support ())
+ {
+ *os << "void " << be_nl
+ << node->name ()
+ << "::_tao_any_destructor (" << be_idt << be_idt_nl
+ << "void *_tao_void_pointer" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << node->local_name () << " *_tao_tmp_pointer =" << be_idt_nl
+ << "static_cast<" << node->local_name ()
+ << " *> (_tao_void_pointer);" << be_uidt_nl
+ << "delete _tao_tmp_pointer;" << be_uidt_nl
+ << "}";
+ }
+
+ // Do any code generation required for the scope members
+ // all we have to do is to visit the scope.
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_cs::"
+ "visit_structure - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ node->cli_stub_gen (true);
+ 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..85cb72ef70f
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_structure_fwd.cpp
@@ -0,0 +1,32 @@
+//
+// $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_structure.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..0df96e7e10a
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_structure_fwd/structure_fwd_ch.cpp
@@ -0,0 +1,55 @@
+//
+// $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.
+int
+be_visitor_structure_fwd_ch::visit_structure_fwd (be_structure_fwd *node)
+{
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ be_structure *fd =
+ be_structure::narrow_from_decl (node->full_definition ());
+
+ // This will be a no-op if it has already been done for this node.
+ fd->gen_common_varout (os);
+
+ node->cli_hdr_gen (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_traits.cpp b/TAO/TAO_IDL/be/be_visitor_traits.cpp
new file mode 100644
index 00000000000..0d0156419b0
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_traits.cpp
@@ -0,0 +1,488 @@
+//=============================================================================
+/**
+* @file be_visitor_traits.cpp
+*
+* $Id$
+*
+* This visitor generates template specializations for traits of various
+* kinds for IDL declarations. These specialized template classes are then
+* used in other template classes in the ORB.
+*
+* @author Jeff Parsons <j.parsons@vanderbilt.edu>
+*/
+//=============================================================================
+
+#include "be_visitor_traits.h"
+#include "be_visitor_context.h"
+#include "be_root.h"
+#include "be_module.h"
+#include "be_interface.h"
+#include "be_valuebox.h"
+#include "be_valuetype.h"
+#include "be_valuebox.h"
+#include "be_interface_fwd.h"
+#include "be_valuetype_fwd.h"
+#include "be_eventtype.h"
+#include "be_eventtype_fwd.h"
+#include "be_component.h"
+#include "be_component_fwd.h"
+#include "be_field.h"
+#include "be_union_branch.h"
+#include "be_exception.h"
+#include "be_structure.h"
+#include "be_union.h"
+#include "be_array.h"
+#include "be_typedef.h"
+#include "be_helper.h"
+#include "be_extern.h"
+
+#include "utl_identifier.h"
+#include "idl_defines.h"
+
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (be,
+ be_visitor_traits,
+ "$Id$")
+
+be_visitor_traits::be_visitor_traits (be_visitor_context *ctx)
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_traits::~be_visitor_traits (void)
+{
+}
+
+int
+be_visitor_traits::visit_root (be_root *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl
+ << be_global->core_versioning_begin ();
+
+ *os << be_nl
+ << "// Traits specializations." << be_nl
+ << "namespace TAO" << be_nl
+ << "{" << be_idt;
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_traits::"
+ "visit_root - visit scope failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl
+ << "}";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_traits::visit_module (be_module *node)
+{
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_traits::"
+ "visit_module - visit scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_traits::visit_interface (be_interface *node)
+{
+ if (node->cli_traits_gen ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Since the three blocks below generate specialized (i.e., non-template)
+ // classes, we don't want to generate them unless it's necessary - thus
+ // the ifdef logic surrounding each one.
+
+ if (!node->imported ())
+ {
+ os->gen_ifdef_macro (node->flat_name (), "traits", false);
+
+ *os << be_nl << be_nl
+ << "template<>" << be_nl
+ << "struct " << be_global->stub_export_macro () << " Objref_Traits<"
+ << " ::" << node->name () << ">" << be_nl
+ << "{" << be_idt_nl
+ << "static ::" << node->name () << "_ptr duplicate ("
+ << be_idt << be_idt_nl
+ << "::" << node->name () << "_ptr" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "static void release (" << be_idt << be_idt_nl
+ << "::" << node->name () << "_ptr" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "static ::" << node->name () << "_ptr nil (void);" << be_nl
+ << "static ::CORBA::Boolean marshal (" << be_idt << be_idt_nl
+ << "const ::" << node->name () << "_ptr p," << be_nl
+ << "TAO_OutputCDR & cdr" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "};";
+
+ os->gen_endif ();
+ }
+
+ if (this->visit_scope (node) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_traits::"
+ "visit_interface - visit scope failed\n"),
+ -1);
+ }
+
+ node->cli_traits_gen (true);
+ return 0;
+}
+
+int
+be_visitor_traits::visit_interface_fwd (be_interface_fwd *node)
+{
+ if (node->cli_traits_gen ())
+ {
+ return 0;
+ }
+
+ be_interface *fd =
+ be_interface::narrow_from_decl (node->full_definition ());
+
+ // We want to generate just the declaration of the Arg_Traits<>
+ // specialization if the interface is forward declared but not defined.
+ if (!fd->is_defined () && this->visit_interface (fd) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_traits::"
+ "visit_interface_fwd - code generation failed\n"),
+ -1);
+ }
+
+ node->cli_traits_gen (true);
+ return 0;
+}
+
+int
+be_visitor_traits::visit_valuetype (be_valuetype *node)
+{
+ if (node->cli_traits_gen ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // I think we need to generate this only for non-defined forward
+ // declarations.
+ if (!node->imported ())
+ {
+ os->gen_ifdef_macro (node->flat_name (), "traits", false);
+
+ *os << be_nl << be_nl
+ << "template<>" << be_nl
+ << "struct " << be_global->stub_export_macro () << " Value_Traits<"
+ << node->name () << ">" << be_nl
+ << "{" << be_idt_nl
+ << "static void add_ref (" << node->name () << " *);" << be_nl
+ << "static void remove_ref (" << node->name () << " *);"
+ << be_nl
+ << "static void release (" << node->name () << " *);"
+ << be_uidt_nl
+ << "};";
+
+ os->gen_endif ();
+ }
+
+ int status = this->visit_scope (node);
+
+ if (status != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_traits::"
+ "visit_valuetype - visit scope failed\n"),
+ -1);
+ }
+
+ node->cli_traits_gen (true);
+ return 0;
+}
+
+int
+be_visitor_traits::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ if (node->cli_traits_gen ())
+ {
+ return 0;
+ }
+
+ be_valuetype *fd =
+ be_valuetype::narrow_from_decl (node->full_definition ());
+
+ // The logic in visit_valuetype() should handle what gets generated
+ // and what doesn't.
+ int status = this->visit_valuetype (fd);
+
+ if (status != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_traits::"
+ "visit_valuetype_fwd - code generation failed\n"),
+ -1);
+ }
+
+ node->cli_traits_gen (true);
+ return 0;
+}
+
+int
+be_visitor_traits::visit_valuebox (be_valuebox *node)
+{
+ if (node->cli_traits_gen ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // I think we need to generate this only for non-defined forward
+ // declarations.
+ if (!node->imported ())
+ {
+ os->gen_ifdef_macro (node->flat_name (), "traits", false);
+
+ *os << be_nl << be_nl
+ << "template<>" << be_nl
+ << "struct " << be_global->stub_export_macro () << " Value_Traits<"
+ << node->name () << ">" << be_nl
+ << "{" << be_idt_nl
+ << "static void add_ref (" << node->name () << " *);" << be_nl
+ << "static void remove_ref (" << node->name () << " *);"
+ << be_nl
+ << "static void release (" << node->name () << " *);"
+ << be_uidt_nl
+ << "};";
+
+ os->gen_endif ();
+ }
+
+ node->cli_traits_gen (true);
+ return 0;
+}
+
+int
+be_visitor_traits::visit_component (be_component *node)
+{
+ return this->visit_interface (node);
+}
+
+int
+be_visitor_traits::visit_component_fwd (be_component_fwd *node)
+{
+ return this->visit_interface_fwd (node);
+}
+
+int
+be_visitor_traits::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_traits::visit_eventtype_fwd (be_eventtype_fwd *node)
+{
+ return this->visit_valuetype_fwd (node);
+}
+
+int
+be_visitor_traits::visit_field (be_field *node)
+{
+ be_type *ft = be_type::narrow_from_decl (node->field_type ());
+ AST_Decl::NodeType nt = ft->node_type ();
+
+ // All we are trying to catch in here are anonymous array members.
+ if (nt != AST_Decl::NT_array)
+ {
+ return 0;
+ }
+
+ if (ft->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_traits::"
+ "visit_field - visit field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_traits::visit_union_branch (be_union_branch *node)
+{
+ be_type *ft = be_type::narrow_from_decl (node->field_type ());
+ AST_Decl::NodeType nt = ft->node_type ();
+
+ // All we are trying to catch in here are anonymous array members.
+ if (nt != AST_Decl::NT_array)
+ {
+ return 0;
+ }
+
+ if (ft->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_traits::"
+ "visit_union_branch - visit field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_traits::visit_exception (be_exception *node)
+{
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_traits::"
+ "visit_exception - visit scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_traits::visit_structure (be_structure *node)
+{
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_traits::"
+ "visit_struct - visit scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_traits::visit_union (be_union *node)
+{
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_traits::"
+ "visit_union - visit scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_traits::visit_array (be_array *node)
+{
+ if (node->imported () || node->cli_traits_gen ())
+ {
+ return 0;
+ }
+
+ ACE_CString name_holder;
+
+ if (node->is_nested ())
+ {
+ be_decl *parent =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+ name_holder = parent->full_name ();
+
+ name_holder += "::";
+
+ if (!this->ctx_->alias ())
+ {
+ name_holder += "_";
+ }
+
+ name_holder += node->local_name ()->get_string ();
+ }
+ else
+ {
+ name_holder = node->full_name ();
+ }
+
+ const char *name = name_holder.fast_rep ();
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl
+ << "template<>" << be_nl
+ << "struct " << be_global->stub_export_macro () << " Array_Traits<"
+ << be_idt << be_idt_nl
+ << name << "_forany" << be_uidt_nl
+ << ">" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "static void free (" << be_idt << be_idt_nl
+ << name << "_slice * _tao_slice"
+ << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "static " << name << "_slice * dup ("
+ << be_idt << be_idt_nl
+ << "const " << name << "_slice * _tao_slice"
+ << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "static void copy (" << be_idt << be_idt_nl
+ << name << "_slice * _tao_to," << be_nl
+ << "const " << name << "_slice * _tao_from"
+ << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "static " << name << "_slice * alloc (void);"
+ << be_nl
+ << "static void zero (" << be_idt << be_idt_nl
+ << name << "_slice * _tao_slice"
+ << be_uidt_nl
+ << ");" << be_uidt
+ << be_uidt_nl
+ << "};";
+
+ node->cli_traits_gen (true);
+ return 0;
+}
+
+int
+be_visitor_traits::visit_typedef (be_typedef *node)
+{
+ 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_traits::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ node->cli_traits_gen (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode.cpp
new file mode 100644
index 00000000000..e8802efb7a0
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typecode.cpp
@@ -0,0 +1,62 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_typecode.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for TypeCodes for various types
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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_component.h"
+#include "be_home.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_valuebox.h"
+#include "be_valuetype.h"
+#include "be_eventtype.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 "be_visitor_typecode/typecode_decl.cpp"
+#include "be_visitor_typecode/typecode_defn.cpp"
+
+#include "be_visitor_typecode/alias_typecode.cpp"
+#include "be_visitor_typecode/enum_typecode.cpp"
+#include "be_visitor_typecode/objref_typecode.cpp"
+#include "be_visitor_typecode/struct_typecode.cpp"
+#include "be_visitor_typecode/union_typecode.cpp"
+#include "be_visitor_typecode/value_typecode.cpp"
+
+
+ACE_RCSID (be,
+ be_visitor_typecode,
+ "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/alias_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/alias_typecode.cpp
new file mode 100644
index 00000000000..c922bca275c
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/alias_typecode.cpp
@@ -0,0 +1,94 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file alias_typecode.cpp
+ *
+ * $Id$
+ *
+ * Alias (typedef) TypeCode generation visitor.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+
+TAO::be_visitor_alias_typecode::be_visitor_alias_typecode (
+ be_visitor_context * ctx)
+ : be_visitor_typecode_defn (ctx)
+{
+}
+
+int
+TAO::be_visitor_alias_typecode::visit_typedef (be_typedef * node)
+{
+ be_type * const base = be_type::narrow_from_decl (node->base_type ());
+
+
+ return this->common (node, base, "tk_alias");
+
+}
+
+
+int
+TAO::be_visitor_alias_typecode::visit_valuebox (be_valuebox * node)
+{
+ be_type * const base = be_type::narrow_from_decl (node->boxed_type ());
+
+ return this->common (node, base, "tk_value_box");
+}
+
+int
+TAO::be_visitor_alias_typecode::common (be_type * node,
+ be_type * base,
+ const char * tctype)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ os << be_nl << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE_NESTED);
+
+ // Generate typecode for the base type, being careful to avoid doing
+ // so for a typedef since that could recursively cause multiple base
+ // type TypeCode definitions to be generated.
+ if (!base || (base->node_type () != AST_Decl::NT_typedef
+ && base->accept (this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%N:%l) be_visitor_alias_typecode")
+ ACE_TEXT ("::common) - ")
+ ACE_TEXT ("failed to generate base typecode\n")),
+ -1);
+ }
+
+ // Generate the alias TypeCode instantiation.
+ os
+ << "static TAO::TypeCode::Alias<char const *," << be_nl
+ << " ::CORBA::TypeCode_ptr const *," << be_nl
+ << " TAO::Null_RefCount_Policy>"
+ << be_idt_nl
+ << "_tao_tc_" << node->flat_name () << " (" << be_idt_nl
+ << "::CORBA::" << tctype << "," << be_nl
+ << "\"" << node->repoID () << "\"," << be_nl
+ << "\"" << node->original_local_name () << "\"," << be_nl
+ << "&";
+
+ if (this->gen_base_typecode_name (base) != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%N:%l) be_visitor_alias_typecode::")
+ ACE_TEXT ("common - problem generating base ")
+ ACE_TEXT ("TypeCode name.\n")),
+ -1);
+
+
+ os << ");" << be_uidt_nl
+ << be_uidt_nl;
+
+ if (this->gen_typecode_ptr (node) != 0)
+ return -1;
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/enum_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/enum_typecode.cpp
new file mode 100644
index 00000000000..2108aba8850
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/enum_typecode.cpp
@@ -0,0 +1,98 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file enum_typecode.cpp
+ *
+ * $Id$
+ *
+ * Enumeration TypeCode generation visitor.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+
+#include "utl_scope.h"
+
+#include <string>
+
+
+TAO::be_visitor_enum_typecode::be_visitor_enum_typecode (
+ be_visitor_context * ctx)
+ : be_visitor_typecode_defn (ctx)
+{
+}
+
+int
+TAO::be_visitor_enum_typecode::visit_enum (be_enum * node)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ os << be_nl << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+
+ static ACE_CString const tao_enumerators ("_tao_enumerators_");
+ ACE_CString const enumerators_name (tao_enumerators
+ + node->flat_name ());
+
+ // Generate array containing enum field characteristics.
+ os << "static char const * const "
+ << enumerators_name.c_str ()
+ << "[] =" << be_idt_nl
+ << "{" << be_idt_nl;
+
+ if (this->visit_members (node) != 0)
+ return -1;
+
+ os << be_uidt_nl
+ << "};" << be_uidt_nl << be_nl;
+
+ // Generate the TypeCode instantiation.
+ os
+ << "static TAO::TypeCode::Enum<char const *," << be_nl
+ << " char const * const *," << be_nl
+ << " TAO::Null_RefCount_Policy>"
+ << be_idt_nl
+ << "_tao_tc_" << node->flat_name () << " (" << be_idt_nl
+ << "\"" << node->repoID () << "\"," << be_nl
+ << "\"" << node->original_local_name () << "\"," << be_nl
+ << "_tao_enumerators_" << node->flat_name () << "," << be_nl
+ << node->member_count () << ");" << be_uidt_nl
+ << be_uidt_nl;
+
+ if (this->gen_typecode_ptr (node) != 0)
+ return -1;
+
+ return 0;
+}
+
+int
+TAO::be_visitor_enum_typecode::visit_members (be_enum * node)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ size_t const count = node->member_count ();
+ size_t n = 0;
+
+ for (UTL_ScopeActiveIterator i (node, UTL_Scope::IK_decls);
+ !i.is_done ();
+ i.next ())
+ {
+ AST_Decl * const d = i.item ();
+ AST_EnumVal * const item = AST_EnumVal::narrow_from_decl (d);
+
+ // os << item->name ();
+ os << "\"" << item->original_local_name () << "\"";
+
+ if (n < count - 1)
+ os << ",";
+
+ os << be_nl;
+
+ ++n;
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/objref_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/objref_typecode.cpp
new file mode 100644
index 00000000000..8df2556f997
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/objref_typecode.cpp
@@ -0,0 +1,93 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file objref_typecode.cpp
+ *
+ * $Id$
+ *
+ * Object reference TypeCode generation visitor.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+
+TAO::be_visitor_objref_typecode::be_visitor_objref_typecode (
+ be_visitor_context * ctx)
+ : be_visitor_typecode_defn (ctx)
+{
+}
+
+int
+TAO::be_visitor_objref_typecode::visit_interface (be_interface * node)
+{
+ if (!node->is_defined ())
+ return this->gen_forward_declared_typecode (node);
+
+ static char const abstract_interface[] = "abstract_interface";
+ static char const component[] = "component";
+ static char const home[] = "home";
+ static char const local_interface[] = "local_interface";
+ static char const objref[] = "objref";
+
+ char const * kind = 0;
+
+ if (dynamic_cast<be_component *> (node))
+ kind = component;
+ else if (dynamic_cast<be_home *> (node))
+ kind = home;
+ else if (node->is_abstract ())
+ kind = abstract_interface;
+ else if (node->is_local ())
+ kind = local_interface;
+ else
+ kind = objref;
+
+ return this->visit_i (kind,
+ node->flat_name (),
+ node->repoID (),
+ node->original_local_name ()->get_string (),
+ node);
+}
+
+int
+TAO::be_visitor_objref_typecode::visit_native (be_native * /* node */)
+{
+ return 0;
+// return this->visit_i ("native",
+// ,
+// ,
+// ,
+// node);
+}
+
+int
+TAO::be_visitor_objref_typecode::visit_i (char const * kind,
+ char const * flat_name,
+ char const * repository_id,
+ char const * original_local_name,
+ be_type * node)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ os << be_nl << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Generate the TypeCode instantiation.
+ os
+ << "static TAO::TypeCode::Objref<char const *," << be_nl
+ << " TAO::Null_RefCount_Policy>"
+ << be_idt_nl
+ << "_tao_tc_" << flat_name << " (" << be_idt_nl
+ << "::CORBA::tk_" << kind << "," << be_nl
+ << "\"" << repository_id << "\"," << be_nl
+ << "\"" << original_local_name << "\");" << be_uidt_nl
+ << be_uidt_nl;
+
+ if (this->gen_typecode_ptr (node) != 0)
+ return -1;
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp
new file mode 100644
index 00000000000..0ff1d7c32dd
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp
@@ -0,0 +1,218 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file struct_typecode.cpp
+ *
+ * $Id$
+ *
+ * Structure TypeCode generation visitor.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+
+#include <string>
+
+
+TAO::be_visitor_struct_typecode::be_visitor_struct_typecode (
+ be_visitor_context * ctx)
+ : be_visitor_typecode_defn (ctx)
+ , is_recursive_ (false)
+ , is_nested_ (false)
+{
+}
+
+int
+TAO::be_visitor_struct_typecode::visit_structure (be_structure * node)
+{
+ if (!node->is_defined ())
+ return this->gen_forward_declared_typecode (node);
+
+ // Check if we are repeated.
+ be_visitor_typecode_defn::QNode const * const qnode =
+ this->queue_lookup (this->tc_queue_, node);
+
+ ACE_Unbounded_Queue<AST_Type *> recursion_queue;
+ if (qnode
+ && node->in_recursion (recursion_queue))
+ {
+ this->is_recursive_ = true;
+
+ return 0;
+ }
+ else if (this->queue_insert (this->tc_queue_, node, 0) == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_struct_typecode::"
+ "visit_type - "
+ "queue insert failed\n"),
+ -1);
+ }
+
+ if (this->recursion_detect_ || this->is_nested_)
+ return 0;
+
+ static bool const is_exception = false;
+
+ return this->visit (node, is_exception);
+}
+
+int
+TAO::be_visitor_struct_typecode::visit_exception (be_exception * node)
+{
+ if (this->recursion_detect_)
+ return 0;
+
+ // No need to check for recursion since exceptions are never
+ // recursive.
+
+ static bool const is_exception = true;
+
+ return this->visit (node, is_exception);
+}
+
+int
+TAO::be_visitor_struct_typecode::visit (AST_Structure * node,
+ bool is_exception)
+{
+ this->is_nested_ = true;
+
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ os << be_nl << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ if (this->gen_member_typecodes (node) != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "TAO::be_visitor_struct_typecode::visit_structure - "
+ "Unable to generate structure/exception field "
+ "TypeCodes.\n"),
+ -1);
+
+ static ACE_CString const tao_fields ("_tao_fields_");
+ ACE_CString const fields_name (tao_fields
+ + node->flat_name ());
+
+ // Generate array containing struct field characteristics.
+ os << "static TAO::TypeCode::Struct_Field<char const *, ::CORBA::TypeCode_ptr const *> const ";
+
+ if (node->nfields () == 0)
+ {
+ // Should only be possible for user exceptions with no fields.
+
+ os << "* const " << fields_name.c_str () << " = 0;" << be_nl;
+ }
+ else
+ {
+ os << fields_name.c_str () << "[] =" << be_idt_nl
+ << "{" << be_idt_nl;
+
+ if (this->visit_members (node) != 0)
+ return -1;
+
+ os << be_uidt_nl
+ << "};" << be_uidt_nl;
+ }
+
+ static char const StringType[] = "char const *";
+ static char const TypeCodeType[] = "::CORBA::TypeCode_ptr const *";
+ static char const MemberArrayType[] =
+ "TAO::TypeCode::Struct_Field<char const *, "
+ "::CORBA::TypeCode_ptr const *> const *";
+
+ // Generate the TypeCode instantiation.
+ os << "static ";
+
+ if (this->is_recursive_)
+ {
+ os << "TAO::TypeCode::Recursive_Type<" << be_idt_nl;
+ }
+
+ // -- TypeCodeBase --
+ os
+ << "TAO::TypeCode::Struct<" << StringType << "," << be_nl
+ << " " << TypeCodeType << "," << be_nl
+ << " " << MemberArrayType << "," << be_nl
+ << " TAO::Null_RefCount_Policy>";
+
+ if (this->is_recursive_)
+ {
+ os << "," << be_nl
+ << TypeCodeType << "," << be_nl
+ << MemberArrayType << " >" << be_uidt_nl;
+ }
+
+ os
+ << be_idt_nl
+ << "_tao_tc_" << node->flat_name () << " (" << be_idt_nl
+ << "::CORBA::tk_" << (is_exception ? "except" : "struct") << ","
+ << be_nl
+ << "\"" << node->repoID () << "\"," << be_nl
+ << "\"" << node->original_local_name () << "\"," << be_nl
+ << "_tao_fields_" << node->flat_name () << "," << be_nl
+ << node->nfields () << ");" << be_uidt_nl
+ << be_uidt_nl;
+
+
+ if (this->gen_typecode_ptr (be_type::narrow_from_decl (node)) != 0)
+ return -1;
+
+ return 0;
+}
+
+int
+TAO::be_visitor_struct_typecode::gen_member_typecodes (AST_Structure * node)
+{
+ AST_Field ** member_ptr = 0;
+
+ size_t const count = node->nfields ();
+
+ for (size_t i = 0; i < count; ++i)
+ {
+ node->field (member_ptr, i);
+
+ be_type * const member_type =
+ be_type::narrow_from_decl ((*member_ptr)->field_type ());
+
+ if (this->is_typecode_generation_required (member_type))
+ member_type->accept (this);
+ }
+
+ return 0;
+}
+
+int
+TAO::be_visitor_struct_typecode::visit_members (AST_Structure * node)
+{
+ AST_Field ** member_ptr = 0;
+
+ size_t const count = node->nfields ();
+
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ for (size_t i = 0; i < count; ++i)
+ {
+ node->field (member_ptr, i);
+
+ be_decl * const member_decl =
+ be_decl::narrow_from_decl (*member_ptr);
+
+ be_type * const member_type =
+ be_type::narrow_from_decl ((*member_ptr)->field_type ());
+
+ os << "{ "
+ << "\"" << member_decl->original_local_name () << "\", "
+ << "&" << member_type->tc_name ()
+ << " }";
+
+ if (i < count - 1)
+ os << ",";
+
+ os << be_nl;
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp
new file mode 100644
index 00000000000..e29c13dc981
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp
@@ -0,0 +1,163 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// typecode_decl.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for TypeCode declaration for a type
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_typecode,
+ typecode_decl,
+ "$Id$")
+
+// ******************************************************
+// TypeCode declarations
+// ******************************************************
+
+be_visitor_typecode_decl::be_visitor_typecode_decl (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+ if (be_global->gen_anyop_files ())
+ {
+ // The context is always a copy, so this is ok.
+ this->ctx_->stream (tao_cg->anyop_header ());
+ }
+}
+
+be_visitor_typecode_decl::~be_visitor_typecode_decl (void)
+{
+}
+
+int
+be_visitor_typecode_decl::visit_type (be_type *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // If -GA is used but anyop macro isn't set, defaults to stub macro.
+ const char *export_macro = (be_global->gen_anyop_files ()
+ ? this->ctx_->non_null_export_macro ()
+ : be_global->stub_export_macro ());
+
+ if (node->is_nested ())
+ {
+ // We have a scoped name.
+ // Is our enclosing scope a module? We need this check because
+ // for platforms that support namespaces, the TypeCode must be
+ // declared extern.
+ if (node->defined_in ()->scope_node_type () == AST_Decl::NT_module)
+ {
+ *os << "extern " << export_macro << " ";
+ }
+ else
+ {
+ *os << "static ";
+ }
+
+ *os << "::CORBA::TypeCode_ptr const "
+ << node->tc_name ()->last_component ()
+ << ";";
+ }
+ else
+ {
+ // We are in the ROOT scope.
+ *os << "extern " << export_macro
+ << " ::CORBA::TypeCode_ptr const "
+ << node->tc_name ()->last_component ()
+ << ";";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typecode_decl::visit_array (be_array *node)
+{
+ return this->visit_type (node);
+}
+
+int
+be_visitor_typecode_decl::visit_enum (be_enum *node)
+{
+ return this->visit_type (node);
+}
+
+int
+be_visitor_typecode_decl::visit_exception (be_exception *node)
+{
+ return this->visit_type (node);
+}
+
+int
+be_visitor_typecode_decl::visit_interface (be_interface *node)
+{
+ return this->visit_type (node);
+}
+
+int
+be_visitor_typecode_decl::visit_component (be_component *node)
+{
+ return this->visit_type (node);
+}
+
+int
+be_visitor_typecode_decl::visit_home (be_home *node)
+{
+ return this->visit_type (node);
+}
+
+int
+be_visitor_typecode_decl::visit_sequence (be_sequence *node)
+{
+ return this->visit_type (node);
+}
+
+int
+be_visitor_typecode_decl::visit_structure (be_structure *node)
+{
+ return this->visit_type (node);
+}
+
+int
+be_visitor_typecode_decl::visit_typedef (be_typedef *node)
+{
+ return this->visit_type (node);
+}
+
+int
+be_visitor_typecode_decl::visit_union (be_union *node)
+{
+ return this->visit_type (node);
+}
+
+int
+be_visitor_typecode_decl::visit_valuebox (be_valuebox *node)
+{
+ return this->visit_type (node);
+}
+
+int
+be_visitor_typecode_decl::visit_valuetype (be_valuetype *node)
+{
+ return this->visit_type (node);
+}
+
+int
+be_visitor_typecode_decl::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_type (node);
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp
new file mode 100644
index 00000000000..bdf612eb97e
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp
@@ -0,0 +1,818 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// typecode_defn.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for TypeCode definitions for types.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_typecode,
+ typecode_defn,
+ "$Id$")
+
+#include "be_interface_fwd.h"
+
+// This is an implementation of C++ "scoped lock" idiom in order to
+// avoid repetitive code.
+class Scoped_Compute_Queue_Guard
+{
+public:
+ Scoped_Compute_Queue_Guard (be_visitor_typecode_defn* );
+ ~Scoped_Compute_Queue_Guard (void);
+
+private:
+ be_visitor_typecode_defn* customer_;
+};
+
+Scoped_Compute_Queue_Guard::Scoped_Compute_Queue_Guard (
+ be_visitor_typecode_defn* customer
+ )
+ :customer_ (customer)
+{
+ if (customer_ != 0)
+ {
+ // 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.
+ customer_->queue_reset (customer_->compute_queue_);
+ }
+}
+
+// ******************************************************
+// TypeCode Definitions
+// ******************************************************
+
+be_visitor_typecode_defn::be_visitor_typecode_defn (be_visitor_context * ctx)
+ : be_visitor_scope (ctx),
+ recursion_detect_ (false),
+ computed_tc_size_ (0),
+ computed_encap_len_ (0),
+ computed_scope_encap_len_ (0),
+ tc_offset_ (0),
+ index_ (-1)
+{
+ if (be_global->gen_anyop_files ())
+ {
+ // The context is always a copy, so this is ok.
+ this->ctx_->stream (tao_cg->anyop_source ());
+ }
+}
+
+be_visitor_typecode_defn::~be_visitor_typecode_defn (void)
+{
+ this->queue_reset (this->tc_queue_);
+ this->queue_reset (this->compute_queue_);
+}
+
+// The following needs to be done to deal until the MSVC compiler's broken
+// handling of namespaces is fixed (hopefully forthcoming in version 7).
+int
+be_visitor_typecode_defn::gen_nested_namespace_begin (be_module *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ char *item_name = 0;
+
+ for (UTL_IdListActiveIterator i (node->name ()); !i.is_done (); i.next ())
+ {
+ item_name = i.item ()->get_string ();
+
+ if (ACE_OS::strcmp (item_name, "") != 0)
+ {
+ // Leave the outermost root scope.
+ *os << "namespace " << item_name << be_nl
+ << "{" << be_idt_nl;
+ }
+ }
+
+ return 0;
+}
+
+// The following needs to be done to deal until the MSVC compiler's broken
+// handling of namespaces is fixed (hopefully forthcoming in version 7).
+int
+be_visitor_typecode_defn::gen_nested_namespace_end (be_module *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ for (UTL_IdListActiveIterator i (node->name ()); !i.is_done (); i.next ())
+ {
+ if (ACE_OS::strcmp (i.item ()->get_string (), "") != 0)
+ {
+ // Leave the outermost root scope.
+ *os << be_uidt_nl << "}";
+ }
+ }
+
+ *os << be_nl << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_typecode_defn::gen_typecode_ptr (be_type * node)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ if (node->node_type () == AST_Decl::NT_string
+ || node->node_type () == AST_Decl::NT_wstring
+ || node->node_type () == AST_Decl::NT_sequence)
+ {
+ // Don't bother generating a TypeCode_ptr for these types. They
+ // are accessible only through an alias TypeCode.
+
+ return 0;
+ }
+
+ // 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)
+ {
+ be_module * const module =
+ be_module::narrow_from_scope (node->defined_in ());
+
+ if (!module || (this->gen_nested_namespace_begin (module) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_typecode_defn::gen_typecode_ptr - "
+ "Error parsing nested name\n"),
+ -1);
+ }
+
+ os << "::CORBA::TypeCode_ptr const _tc_"
+ << node->local_name ()
+ << " =" << be_idt_nl
+ << "&_tao_tc_"
+ << node->flat_name () << ";"
+ << be_uidt;
+
+ if (this->gen_nested_namespace_end (module) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_typecode_defn::gen_typecode_ptr - "
+ "Error parsing nested name\n"),
+ -1);
+ }
+ }
+ else
+ {
+ // outermost scope.
+ os << "::CORBA::TypeCode_ptr const ";
+
+ // Tc name generation.
+ os << node->tc_name ();
+
+ os << " =" << be_idt_nl
+ << "&_tao_tc_";
+
+ // Flat name generation.
+ os << node->flat_name ();
+
+ os << ";" << be_uidt;
+ }
+
+ return 0;
+}
+
+
+int
+be_visitor_typecode_defn::gen_base_typecode_name (be_type * base)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ if (base->is_nested ()
+ && base->defined_in ()->scope_node_type () == AST_Decl::NT_module)
+ {
+ if (base->node_type () != AST_Decl::NT_string
+ && base->node_type () != AST_Decl::NT_wstring
+ && base->node_type () != AST_Decl::NT_sequence)
+ {
+ // Generate scope names only if types other than the ones
+ // listed above since the corresponding TypeCodes are at the
+ // file scope.
+ os << base->tc_name ();
+ }
+ else
+ {
+ // Internally used TypeCodes.
+ os << base->tc_name ();
+ }
+ }
+ else
+ {
+ os << base->tc_name ();
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typecode_defn::gen_forward_declared_typecode (be_type * node)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ // Generate an extern TypeCode declaration to make sure TypeCodes
+ // that refer to the corresponding TypeCode for the forward declared
+ // interface have a valid reference to it.
+
+ // 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)
+ {
+ be_module * const module =
+ be_module::narrow_from_scope (node->defined_in ());
+
+ if (!module || (this->gen_nested_namespace_begin (module) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_typecode_defn::"
+ "gen_forward_declared_typecode - "
+ "Error parsing nested name\n"),
+ -1);
+ }
+
+ os << "extern ::CORBA::TypeCode_ptr const _tc_"
+ << node->local_name () << ";";
+
+ if (this->gen_nested_namespace_end (module) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_typecode_defn::"
+ "gen_forward_declared_typecode - "
+ "Error parsing nested name\n"),
+ -1);
+ }
+ }
+ else
+ {
+ // outermost scope.
+ os << "extern ::CORBA::TypeCode_ptr const "
+ << node->tc_name () << ";" << be_uidt_nl;
+ }
+
+ return 0;
+}
+
+bool
+be_visitor_typecode_defn::is_typecode_generation_required (be_type * node)
+{
+ AST_Decl::NodeType const nt = node->node_type ();
+
+ if (nt == AST_Decl::NT_interface
+ || nt == AST_Decl::NT_interface_fwd
+ || nt == AST_Decl::NT_valuetype
+ || nt == AST_Decl::NT_valuetype_fwd)
+ {
+ // interfaces, valuetypes, eventtypes and components
+
+ be_interface * const intf =
+ be_interface::narrow_from_decl (node);
+
+ if (intf && intf->is_defined ())
+ {
+ return false;
+ }
+ }
+ else if (nt == AST_Decl::NT_struct
+ || nt == AST_Decl::NT_union)
+ {
+ // structures and unions
+
+ AST_Structure * const st =
+ AST_Structure::narrow_from_decl (node);
+
+ if (st && st->is_defined ())
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+void
+be_visitor_typecode_defn::gen_begin_NS_for_anon (void)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ os << "namespace TAO" << be_nl
+ << "{" << be_idt_nl
+ << "namespace TypeCode" << be_nl
+ << "{" << be_idt_nl
+ << "namespace" << be_nl
+ << "{" << be_idt_nl;
+}
+
+void
+be_visitor_typecode_defn::gen_end_NS_for_anon (void)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ os << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}" << be_nl;
+}
+
+int
+be_visitor_typecode_defn::visit_array (be_array *node)
+{
+ be_type * const base = be_type::narrow_from_decl (node->base_type ());
+
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ os << be_nl << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // generate typecode for the base type
+ this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE_NESTED);
+
+ // Generate typecode for the base type, being careful to avoid doing
+ // so for a typedef since that could recursively cause multiple base
+ // type TypeCode definitions to be generated.
+ if (!base || (base->node_type () != AST_Decl::NT_typedef
+ && base->accept (this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%N:%l) be_visitor_typecode_defn")
+ ACE_TEXT ("::visit_array) - ")
+ ACE_TEXT ("failed to generate base typecode\n")),
+ -1);
+ }
+
+ if (this->recursion_detect_)
+ {
+ return 0; // Nothing else to do.
+ }
+
+ // Multiple definition guards.
+ // @todo Can we automate duplicate detection within the IDL compiler
+ // itself?
+ os << "\n#ifndef _TAO_TYPECODE_" << node->flat_name () << "_GUARD"
+ << "\n#define _TAO_TYPECODE_" << node->flat_name () << "_GUARD"
+ << be_nl;
+
+ os << be_global->core_versioning_begin () << be_nl;
+
+ // Namespace begin.
+ this->gen_begin_NS_for_anon ();
+
+ unsigned long const ndims = node->n_dims ();
+
+ for (unsigned long i = 0; i < ndims; ++i)
+ {
+ os << "TAO::TypeCode::Sequence< ::CORBA::TypeCode_ptr const *," << be_nl
+ << " TAO::Null_RefCount_Policy>"
+ << be_idt_nl
+ << node->flat_name ();
+
+ unsigned long const inner_ndims = ndims - i - 1;
+
+ for (unsigned long j = inner_ndims; j < ndims; ++j)
+ {
+ os << "_" << node->dims ()[j]->ev ()->u.ulval;
+ }
+
+ os << " (" << be_idt_nl
+ << "::CORBA::tk_array," << be_nl
+ << "&";
+
+ if (i == 0)
+ {
+ if (this->gen_base_typecode_name (base) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_typecode_defn::")
+ ACE_TEXT ("visit_array - problem ")
+ ACE_TEXT ("generating base ")
+ ACE_TEXT ("TypeCode name.\n")),
+ -1);
+ }
+ }
+ else
+ {
+ os << "tc_" << node->flat_name ();
+
+ for (unsigned long j = inner_ndims + 1; j < ndims; ++j)
+ {
+ os << "_" << node->dims ()[j]->ev ()->u.ulval;
+ }
+
+ }
+
+ os << "," << be_nl
+ << node->dims ()[inner_ndims] << ");" << be_uidt_nl
+ << be_uidt_nl;
+
+ os << "::CORBA::TypeCode_ptr const tc_"
+ << node->flat_name ();
+
+ if (inner_ndims != 0)
+ {
+ // Only generate the array dimension sizes for the inner
+ // dimensions, not the outermost (leftmost) one.
+ for (unsigned long k = inner_ndims; k < ndims; ++k)
+ {
+ os << "_" << node->dims ()[k]->ev ()->u.ulval;
+ }
+ }
+
+ os << " ="
+ << be_idt_nl
+ << "&" << node->flat_name ();
+
+ for (unsigned long n = inner_ndims; n < ndims; ++n)
+ {
+ os << "_" << node->dims ()[n]->ev ()->u.ulval;
+ }
+
+ os << ";" << be_uidt;
+
+ if (i < ndims - 1)
+ {
+ os << be_nl << be_nl;
+ }
+ }
+
+ // Namespace end,
+ this->gen_end_NS_for_anon ();
+
+ os << be_global->core_versioning_end ();
+
+ os << "\n#endif /* _TAO_TYPECODE_" << node->flat_name () << "_GUARD */"
+ << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_typecode_defn::visit_interface (be_interface * node)
+{
+ // Only handle forward declared interfaces here. Defined interfaces
+ // have their own TypeCode visitor.
+ if (node->is_defined ())
+ {
+ return 0;
+ }
+
+ return this->gen_forward_declared_typecode (node);
+}
+
+int
+be_visitor_typecode_defn::visit_component (be_component *node)
+{
+ return this->visit_interface (node);
+}
+
+int
+be_visitor_typecode_defn::visit_interface_fwd (be_interface_fwd * node)
+{
+ return this->gen_forward_declared_typecode (node);
+}
+
+int
+be_visitor_typecode_defn::visit_sequence (be_sequence * node)
+{
+ be_type * const base = be_type::narrow_from_decl (node->base_type ());
+
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ os << be_nl << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // generate typecode for the base type
+ this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE_NESTED);
+
+ // Generate typecode for the base type, being careful to avoid doing
+ // so for a typedef since that could recursively cause multiple base
+ // type TypeCode definitions to be generated.
+ if (!base || (base->node_type () != AST_Decl::NT_typedef
+ && base->accept (this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%N:%l) be_visitor_typecode_defn")
+ ACE_TEXT ("::visit_sequence) - ")
+ ACE_TEXT ("failed to generate base typecode\n")),
+ -1);
+ }
+
+ if (this->recursion_detect_)
+ {
+ return 0; // Nothing else to do.
+ }
+
+ // Multiple definition guards.
+ // @todo Can we automate duplicate detection within the IDL compiler
+ // itself?
+ os << "\n#ifndef _TAO_TYPECODE_" << node->flat_name () << "_GUARD"
+ << "\n#define _TAO_TYPECODE_" << node->flat_name () << "_GUARD"
+ << be_nl;
+
+ // Namespace begin.
+
+ os << be_global->core_versioning_begin () << be_nl;
+
+ this->gen_begin_NS_for_anon ();
+
+ os << "TAO::TypeCode::Sequence< ::CORBA::TypeCode_ptr const *," << be_nl
+ << " TAO::Null_RefCount_Policy>"
+ << be_idt_nl
+ << node->flat_name () << "_" << node->max_size()->ev ()->u.ulval
+
+ << " (" << be_idt_nl
+ << "::CORBA::tk_sequence," << be_nl
+ << "&";
+
+ if (this->gen_base_typecode_name (base) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%N:%l) be_visitor_typecode_defn::")
+ ACE_TEXT ("visit_sequence - ")
+ ACE_TEXT ("problem generating base ")
+ ACE_TEXT ("TypeCode name.\n")),
+ -1);
+ }
+
+ os << "," << be_nl
+ << node->max_size () << ");" << be_uidt_nl
+ << be_uidt_nl;
+
+ os << "::CORBA::TypeCode_ptr const tc_"
+ << node->flat_name () << "_" << node->max_size()->ev ()->u.ulval << " ="
+ << be_idt_nl
+ << "&" << node->flat_name () << "_" << node->max_size()->ev ()->u.ulval
+ << ";" << be_uidt;
+
+ // Namespace end.
+ this->gen_end_NS_for_anon ();
+
+ os << be_global->core_versioning_end ();
+
+ os << "\n#endif /* _TAO_TYPECODE_" << node->flat_name () << "_GUARD */"
+ << be_nl << be_nl;
+
+ return 0; // this->gen_typecode_ptr (node);
+}
+
+int
+be_visitor_typecode_defn::visit_string (be_string * node)
+{
+ if (node->max_size ()->ev()->u.ulval == 0)
+ {
+ // No need to generate a TypeCode for unbounded strings. Just
+ // use the {w}string TypeCode constant.
+ return 0;
+ }
+
+ if (this->recursion_detect_)
+ {
+ return 0; // Nothing else to do.
+ }
+
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ os << be_nl << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Multiple definition guards.
+ // @todo Can we automate duplicate detection within the IDL compiler
+ // itself?
+ os << "\n#ifndef _TAO_TYPECODE_" << node->flat_name () << "_GUARD"
+ << "\n#define _TAO_TYPECODE_" << node->flat_name () << "_GUARD" << be_nl;
+
+ // Namespace begin.
+
+ os << be_global->core_versioning_begin () << be_nl;
+
+ this->gen_begin_NS_for_anon ();
+
+ // Generate the TypeCode instantiation.
+ os
+ << "TAO::TypeCode::String<TAO::Null_RefCount_Policy>"
+ << be_idt_nl
+ << node->flat_name () << " (" << be_idt_nl
+ << "::CORBA::tk_" << (node->width () == 1 ? "string" : "wstring") << ","
+ << be_nl
+ << node->max_size () << ");" << be_uidt_nl
+ << be_uidt_nl;
+
+ os << "::CORBA::TypeCode_ptr const tc_"
+ << node->flat_name () << " ="
+ << be_idt_nl
+ << "&" << node->flat_name () << ";" << be_uidt;
+
+ // Namespace end.
+ this->gen_end_NS_for_anon ();
+
+ os << be_global->core_versioning_end ();
+
+ os << "\n#endif /* _TAO_TYPECODE_" << node->flat_name () << "_GUARD */"
+ << be_nl << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_typecode_defn::visit_structure (be_structure * node)
+{
+ // Handle only forward declared structures here. Defined structures
+ // have their own TypeCode visitor.
+ if (node->is_defined ())
+ {
+ return 0;
+ }
+
+ return this->gen_forward_declared_typecode (node);
+}
+
+int
+be_visitor_typecode_defn::visit_typedef (be_typedef * node)
+{
+ // Only used for recursion detection.
+
+ // The only base types with no-op visitors that will be potentially
+ // visited are strings and sequences. All others have their own
+ // full-fledged visitors (e.g. objref_typecode, etc.)
+
+ be_type * const base = be_type::narrow_from_decl (node->base_type ());
+
+ this->recursion_detect_ = true;
+
+ // Generate typecode for the base type, being careful to avoid doing
+ // so a for a typedef since that could recursively cause multiple
+ // base type TypeCode definitions to be generated.
+ if (!base || (base->accept (this) == -1))
+ {
+ this->recursion_detect_ = false;
+
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%N:%l) be_visitor_typecode_defn")
+ ACE_TEXT ("::visit_typedef) - ")
+ ACE_TEXT ("failed to visit base typecode\n")),
+ -1);
+ }
+
+ this->recursion_detect_ = false;
+
+ return 0;
+}
+
+int
+be_visitor_typecode_defn::visit_union (be_union *node)
+{
+ // Only handle forward declared unions here. Defined unions
+ // have their own TypeCode visitor.
+ if (node->is_defined ())
+ {
+ return 0;
+ }
+
+ return this->gen_forward_declared_typecode (node);
+}
+
+int
+be_visitor_typecode_defn::visit_valuetype (be_valuetype * node)
+{
+ // Only handle forward declared valuetypes here. Defined valuetypes
+ // have their own TypeCode visitor.
+ if (node->is_defined ())
+ {
+ return 0;
+ }
+
+ return this->gen_forward_declared_typecode (node);
+}
+
+int
+be_visitor_typecode_defn::visit_eventtype (be_eventtype * node)
+{
+ return this->visit_valuetype (node);
+}
+
+// post processing
+int
+be_visitor_typecode_defn::post_process (be_decl *)
+{
+ if (this->ctx_->sub_state () == TAO_CodeGen::TAO_TC_DEFN_SCOPE_LEN)
+ {
+ this->computed_scope_encap_len_ += this->computed_encap_len_;
+ }
+
+ return 0;
+}
+
+// scope stack routines
+int
+be_visitor_typecode_defn::push (ACE_CDR::Long val)
+{
+ if (this->index_ >= TAO_BE_VISITOR_TYPECODE_DEFN_MAX_STACK_SIZE)
+ {
+ return -1;
+ }
+
+ this->scope_stack_ [++this->index_] = val;
+ return 0;
+}
+
+int
+be_visitor_typecode_defn::pop (ACE_CDR::Long &val)
+{
+ if (this->index_ < 0)
+ {
+ return -1;
+ }
+
+ val = this->scope_stack_[this->index_--];
+ return 0;
+}
+
+const be_visitor_typecode_defn::QNode *
+be_visitor_typecode_defn::queue_insert (
+ ACE_Unbounded_Queue <be_visitor_typecode_defn::QNode *> &queue,
+ be_type *node,
+ ACE_CDR::Long offset
+ )
+{
+ be_visitor_typecode_defn::QNode *qnode = 0;
+
+ ACE_NEW_RETURN (qnode, be_visitor_typecode_defn::QNode, 0);
+
+ qnode->node = node;
+ qnode->offset = offset;
+
+ if (queue.enqueue_tail (qnode) == -1)
+ {
+ delete qnode;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%N:%l) be_visitor_typecode_defn")
+ ACE_TEXT ("::queue_insert - failed\n")),
+ 0);
+ }
+
+ return qnode;
+}
+
+const be_visitor_typecode_defn::QNode *
+be_visitor_typecode_defn::queue_lookup (
+ ACE_Unbounded_Queue <be_visitor_typecode_defn::QNode *> &queue,
+ be_type *node
+ )
+{
+ for (ACE_Unbounded_Queue_Iterator<be_visitor_typecode_defn::QNode *>
+ iter (queue);
+ !iter.done ();
+ iter.advance ())
+ {
+ be_visitor_typecode_defn::QNode **addr, *item;
+ iter.next (addr);
+ item = *addr;
+
+ if (!ACE_OS::strcmp (item->node->full_name (),
+ node->full_name ()))
+ {
+ // Found.
+ return item;
+ }
+ }
+
+ return 0;
+}
+
+void
+be_visitor_typecode_defn::
+queue_reset (ACE_Unbounded_Queue <be_visitor_typecode_defn::QNode *> & queue)
+{
+ while (!queue.is_empty ())
+ {
+ be_visitor_typecode_defn::QNode * qnode = 0;
+ (void) queue.dequeue_head (qnode);
+ delete qnode;
+ }
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp
new file mode 100644
index 00000000000..fcc83155482
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp
@@ -0,0 +1,224 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file union_typecode.cpp
+ *
+ * $Id$
+ *
+ * Union TypeCode generation visitor.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+
+TAO::be_visitor_union_typecode::be_visitor_union_typecode (
+ be_visitor_context * ctx)
+ : be_visitor_typecode_defn (ctx)
+ , is_recursive_ (false)
+ , is_nested_ (false)
+{
+}
+
+int
+TAO::be_visitor_union_typecode::visit_union (be_union * node)
+{
+ if (!node->is_defined ())
+ return this->gen_forward_declared_typecode (node);
+
+ // Check if we are repeated.
+ be_visitor_typecode_defn::QNode const * const qnode =
+ this->queue_lookup (this->tc_queue_, node);
+
+ ACE_Unbounded_Queue<AST_Type *> recursion_queue;
+ if (qnode
+ && node->in_recursion (recursion_queue))
+ {
+ this->is_recursive_ = true;
+
+ return 0;
+ }
+ else if (this->queue_insert (this->tc_queue_, node, 0) == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_typecode::"
+ "visit_type - "
+ "queue insert failed\n"),
+ -1);
+ }
+
+ if (this->recursion_detect_ || this->is_nested_)
+ return 0;
+
+ this->is_nested_ = true;
+
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ os << be_nl << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ be_type * const discriminant_type =
+ be_type::narrow_from_decl (node->disc_type ());
+
+ ACE_ASSERT (discriminant_type != 0);
+
+ if (this->gen_case_typecodes (node) != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "TAO::be_visitor_union_typecode::visit_union - "
+ "Unable to generate union field "
+ "TypeCodes.\n"),
+ -1);
+
+ if (this->visit_cases (node) != 0)
+ return -1;
+
+ static char const StringType[] = "char const *";
+ static char const TypeCodeType[] = "::CORBA::TypeCode_ptr const *";
+ static char const MemberArrayType[] =
+ "TAO::TypeCode::Case<char const *, "
+ "::CORBA::TypeCode_ptr const *> const * const *";
+
+ // Generate the TypeCode instantiation.
+ os << "static ";
+
+ if (this->is_recursive_)
+ {
+ os << "TAO::TypeCode::Recursive_Type<" << be_idt_nl;
+ }
+
+ // -- TypeCodeBase --
+ os
+ << "TAO::TypeCode::Union<" << StringType << "," << be_nl
+ << " " << TypeCodeType << "," << be_nl
+ << " " << MemberArrayType << "," << be_nl
+ << " TAO::Null_RefCount_Policy>";
+
+ if (this->is_recursive_)
+ {
+ os << "," << be_nl
+ << TypeCodeType << "," << be_nl
+ << MemberArrayType << " >" << be_uidt_nl;
+ }
+
+ os
+ << be_idt_nl
+ << "_tao_tc_" << node->flat_name () << " (" << be_idt_nl
+ << "\"" << node->repoID () << "\"," << be_nl
+ << "\"" << node->original_local_name () << "\"," << be_nl
+ << "&" << discriminant_type->tc_name () << "," << be_nl
+ << "_tao_cases_" << node->flat_name () << "," << be_nl
+ << node->nfields () << ", "
+ << node->default_index () << ");" << be_uidt_nl
+ << be_uidt_nl;
+
+ if (this->gen_typecode_ptr (be_type::narrow_from_decl (node)) != 0)
+ return -1;
+
+ return 0;
+}
+
+int
+TAO::be_visitor_union_typecode::gen_case_typecodes (be_union * node)
+{
+ AST_Field ** member_ptr = 0;
+
+ size_t const count = node->nfields ();
+
+ for (size_t i = 0; i < count; ++i)
+ {
+ node->field (member_ptr, i);
+
+ be_type * const member_type =
+ be_type::narrow_from_decl ((*member_ptr)->field_type ());
+
+ if (this->is_typecode_generation_required (member_type))
+ member_type->accept (this);
+ }
+
+ return 0;
+}
+
+int
+TAO::be_visitor_union_typecode::visit_cases (be_union * node)
+{
+ // Generate array containing union case/branch characterstics.
+
+ be_type * const discriminant_type =
+ be_type::narrow_from_decl (node->disc_type ());
+
+ static ACE_CString tao_cases ("_tao_cases_");
+ ACE_CString const fields_name (tao_cases
+ + node->flat_name ());
+
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ // Start with static instances of each array element-to-be.
+ size_t const count = node->nfields ();
+
+ for (size_t i = 0; i < count; ++i)
+ {
+ AST_Field ** member_ptr = 0;
+
+ node->field (member_ptr, i);
+
+ be_type * const type =
+ be_type::narrow_from_decl ((*member_ptr)->field_type ());
+
+ be_union_branch * const branch =
+ be_union_branch::narrow_from_decl (*member_ptr);
+
+ ACE_ASSERT (branch != 0);
+
+ os << "static TAO::TypeCode::Case_T<"
+ << discriminant_type->full_name () << ", "
+ << "char const *, ::CORBA::TypeCode_ptr const *> const "
+ << fields_name.c_str () << "__" << i <<" (";
+
+ if (branch->label ()->label_kind () == AST_UnionLabel::UL_label)
+ {
+ // Non-default case.
+
+ // Generate the label value. Only the first label value is
+ // used in the case where multiple labels are used for the
+ // same union branch/case.
+ branch->gen_label_value (&os, 0);
+ }
+ else
+ {
+ // Default case.
+
+ ACE_ASSERT (branch->label ()->label_kind ()
+ == AST_UnionLabel::UL_default);
+
+ branch->gen_default_label_value (&os, node);
+ }
+
+ os << ", \"" << branch->original_local_name () << "\", "
+ << "&" << type->tc_name ()
+ << ");" << be_nl;
+ }
+
+ // Now generate the TAO::TypeCode::Case array.
+ os << be_nl
+ << "static TAO::TypeCode::Case<char const *, ::CORBA::TypeCode_ptr const *> const * const "
+ << fields_name.c_str ()
+ << "[] =" << be_idt_nl
+ << "{" << be_idt_nl;
+
+ for (size_t n = 0; n < count; ++n)
+ {
+ os << "&" << fields_name.c_str () << "__" << n;
+
+ if (n < count - 1)
+ os << ",";
+
+ os << be_nl;
+ }
+
+ os << be_uidt_nl
+ << "};" << be_uidt_nl << be_nl;
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/value_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/value_typecode.cpp
new file mode 100644
index 00000000000..14516069c35
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/value_typecode.cpp
@@ -0,0 +1,300 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file value_typecode.cpp
+ *
+ * $Id$
+ *
+ * Structure TypeCode generation visitor.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+TAO::be_visitor_value_typecode::be_visitor_value_typecode (
+ be_visitor_context * ctx)
+ : be_visitor_typecode_defn (ctx)
+ , is_recursive_ (false)
+ , is_nested_ (false)
+{
+}
+
+int
+TAO::be_visitor_value_typecode::visit_valuetype (be_valuetype * node)
+{
+ if (!node->is_defined ())
+ {
+ return this->gen_forward_declared_typecode (node);
+ }
+
+ // Check if we are repeated.
+ be_visitor_typecode_defn::QNode const * const qnode =
+ this->queue_lookup (this->tc_queue_, node);
+
+ ACE_Unbounded_Queue<AST_Type *> recursion_queue;
+ if (qnode
+ && node->in_recursion (recursion_queue))
+ {
+ this->is_recursive_ = true;
+
+ return 0;
+ }
+ else if (this->queue_insert (this->tc_queue_, node, 0) == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_value_typecode::"
+ "visit_type - "
+ "queue insert failed\n"),
+ -1);
+ }
+
+ if (this->recursion_detect_ || this->is_nested_)
+ {
+ return 0;
+ }
+
+ this->is_nested_ = true;
+
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ os << be_nl << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ if (this->gen_member_typecodes (node) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "TAO::be_visitor_value_typecode::visit_valuetype - "
+ "Unable to generate valuetype/eventtype field "
+ "TypeCodes.\n"),
+ -1);
+ }
+
+ size_t const count =
+ node->data_members_count (AST_Field::vis_PUBLIC)
+ + node->data_members_count (AST_Field::vis_PRIVATE);
+
+ ACE_CString const fields_name (ACE_CString ("_tao_fields_")
+ + node->flat_name ());
+
+ // Generate array containing value field characteristics.
+ os << "static TAO::TypeCode::Value_Field<char const *, "
+ << "::CORBA::TypeCode_ptr const *> const ";
+
+ if (count == 0)
+ {
+ os << "* const " << fields_name.c_str () << " = 0;" << be_nl;
+ }
+ else
+ {
+ os << fields_name.c_str () << "[] =" << be_idt_nl
+ << "{" << be_idt_nl;
+
+ if (this->visit_members (node) != 0)
+ {
+ return -1;
+ }
+
+ os << be_uidt_nl
+ << "};" << be_uidt_nl;
+ }
+
+ // Generate the TypeCode instantiation.
+
+ static char const StringType[] = "char const *";
+ static char const TypeCodeType[] = "::CORBA::TypeCode_ptr const *";
+ static char const MemberArrayType[] =
+ "TAO::TypeCode::Value_Field<char const *, "
+ "::CORBA::TypeCode_ptr const *> const *";
+
+ os << "static ";
+
+ if (this->is_recursive_)
+ {
+ os << "TAO::TypeCode::Recursive_Type<" << be_idt_nl;
+ }
+
+ // -- TypeCodeBase --
+ os
+ << "TAO::TypeCode::Value<" << StringType << "," << be_nl
+ << " " << TypeCodeType << "," << be_nl
+ << " " << MemberArrayType << "," << be_nl
+ << " TAO::Null_RefCount_Policy>";
+
+ if (this->is_recursive_)
+ {
+ os << "," << be_nl
+ << TypeCodeType << "," << be_nl
+ << MemberArrayType << " >" << be_uidt_nl;
+ }
+
+ os << be_idt_nl
+ << "_tao_tc_" << node->flat_name () << " (" << be_idt_nl
+ << "::CORBA::tk_"
+ << (dynamic_cast<be_eventtype *> (node) ? "event" : "value")
+ << "," << be_nl
+ << "\"" << node->repoID () << "\"," << be_nl
+ << "\"" << node->original_local_name () << "\"," << be_nl;
+
+ // ValueModifier
+ //
+ // TAO doesn't support CUSTOM or TRUNCATABLE valuetypes. Go
+ // with VM_NONE or VM_ABSTRACT.
+ os << "::CORBA::"
+ << (node->is_abstract () ? "VM_ABSTRACT" : "VM_NONE") << "," << be_nl;
+
+ // Concrete base type.
+ AST_ValueType * const concrete_base =
+ node->inherits_concrete ();
+
+ if (concrete_base)
+ {
+ be_type * const base_type =
+ be_type::narrow_from_decl (concrete_base);
+
+ ACE_ASSERT (base_type);
+
+ os << "&" << base_type->tc_name () << "," << be_nl;
+ }
+ else
+ {
+ // No concrete base.
+ os << "&::CORBA::_tc_null," << be_nl;
+ }
+
+ // Fields
+ os << "_tao_fields_" << node->flat_name () << "," << be_nl
+ << count << ");" << be_uidt_nl
+ << be_uidt_nl;
+
+ if (this->gen_typecode_ptr (be_type::narrow_from_decl (node)) != 0)
+ return -1;
+
+ return 0;
+}
+
+int
+TAO::be_visitor_value_typecode::gen_member_typecodes (be_valuetype * node)
+{
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next())
+ {
+ AST_Decl * const d = si.item ();
+
+ if (!d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_value_typecode::"
+ "gen_member_typecodes - "
+ "bad node in this scope\n"),
+ 0);
+ }
+
+ AST_Field * const field = AST_Field::narrow_from_decl (d);
+
+ if (!field
+ || field->visibility () == AST_Field::vis_NA)
+ {
+ continue;
+ }
+
+ be_type * const member_type =
+ be_type::narrow_from_decl (field->field_type ());
+
+ if (this->is_typecode_generation_required (member_type))
+ {
+ member_type->accept (this);
+ }
+ else if (member_type == static_cast<be_type *> (node))
+ {
+ this->is_recursive_ = true;
+ }
+ }
+
+ return 0;
+}
+
+int
+TAO::be_visitor_value_typecode::visit_members (be_valuetype * node)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ size_t const count =
+ node->data_members_count (AST_Field::vis_PUBLIC)
+ + node->data_members_count (AST_Field::vis_PRIVATE);
+
+ size_t i = 0;
+
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next())
+ {
+ AST_Decl * const d = si.item ();
+
+ if (!d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_value_typecode::"
+ "visit_members - "
+ "bad node in this scope\n"), 0);
+ }
+
+ AST_Field * const field = AST_Field::narrow_from_decl (d);
+
+ if (!field)
+ {
+ continue;
+ }
+
+ AST_Field::Visibility const vis = field->visibility ();
+
+ if (vis == AST_Field::vis_NA)
+ {
+ continue;
+ }
+
+ be_decl * const member_decl =
+ be_decl::narrow_from_decl (field);
+
+ be_type * const member_type =
+ be_type::narrow_from_decl (field->field_type ());
+
+ os << "{ "
+ << "\"" << member_decl->original_local_name () << "\", "
+ << "&" << member_type->tc_name () << ", ";
+
+ switch (vis)
+ {
+ case AST_Field::vis_PUBLIC:
+ os << "::CORBA::PUBLIC_MEMBER";
+ break;
+
+ case AST_Field::vis_PRIVATE:
+ os << "::CORBA::PRIVATE_MEMBER";
+ break;
+
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_value_typecode::"
+ "visit_members - "
+ "Unknown valuetype member visibility: %d.\n",
+ vis),
+ -1);
+ };
+
+ os << " }";
+
+ if (i < count - 1)
+ {
+ os << ",";
+ }
+
+ os << be_nl;
+
+ ++i;
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_typedef.cpp b/TAO/TAO_IDL/be/be_visitor_typedef.cpp
new file mode 100644
index 00000000000..1e3ebf45077
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typedef.cpp
@@ -0,0 +1,62 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_typedef.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Typedef
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "be_array.h"
+#include "be_enum.h"
+#include "be_interface.h"
+#include "be_interface_fwd.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_valuebox.h"
+#include "be_valuetype.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 "utl_identifier.h"
+#include "ace/Log_Msg.h"
+
+#include "be_visitor_typedef/typedef.cpp"
+#include "be_visitor_typedef/typedef_ch.cpp"
+#include "be_visitor_typedef/typedef_ci.cpp"
+#include "be_visitor_typedef/typedef_cs.cpp"
+#include "be_visitor_typedef/any_op_ch.cpp"
+#include "be_visitor_typedef/any_op_cs.cpp"
+#include "be_visitor_typedef/cdr_op_ch.cpp"
+#include "be_visitor_typedef/cdr_op_cs.cpp"
+#include "be_visitor_typedef/serializer_op_ch.cpp"
+#include "be_visitor_typedef/serializer_op_cs.cpp"
+
+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
new file mode 100644
index 00000000000..eff9fa07eb2
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typedef/any_op_ch.cpp
@@ -0,0 +1,293 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Any operators of a Typedef node
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+be_visitor_typedef_any_op_ch::~be_visitor_typedef_any_op_ch (void)
+{
+}
+
+int
+be_visitor_typedef_any_op_ch::visit_typedef (be_typedef *node)
+{
+ if (node->cli_hdr_any_op_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // generate the Any <<= and >>= operator declarations
+ // Any <<= and >>= operators
+ os->indent ();
+
+ // In general, we may have a chain of typedefs. i.e.,
+ // typedef sequence<long> X;
+ // typedef X Y;
+ // typedef Y Z; and so on
+ // The first time we will be in will be for node Z for which the code
+ // generation has to take place. However, it is not enough to just generate
+ // code that looks like -
+ // typedef Y Z;
+ // For different types (in this case we have a sequence), we will need
+ // typedefs for the _var and _out types for Z. If it had been an array, we
+ // will additionally have the _forany type as well as inlined *_alloc, _dup,
+ // and _free methods.
+ //
+ // Finally, we need to differentiate between the case where we were
+ // generating code for
+ // typedef sequence<long> X; and
+ // typedef Y Z; where Y was somehow aliased to the sequence. In the former
+ // case, we will need to generate all the code for sequence<long> or whatever
+ // the type maybe. In the latter, we just need typedefs for the type and all
+ // associated _var, _out, and other types.
+
+ be_type *bt; // base type
+
+ if (this->ctx_->tdef ())
+ {
+ // The fact that we are here indicates that we were generating code for a
+ // typedef node whose base type also happens to be another typedef-ed
+ // (i.e. an alias) node for another (possibly alias) node.
+
+ this->ctx_->alias (node); // save this alias
+
+ // Grab the most primitive base type in the chain to avoid recusrsively.
+ // going thru this visit method
+ bt = node->primitive_base_type ();
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_ch::"
+ "visit_typedef - "
+ "bad primitive base type\n"),
+ -1);
+ }
+
+ // accept on this base type, but generate code for the typedef node
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_ch::"
+ "visit_typedef - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+ this->ctx_->alias (0); // reset
+ }
+ else
+ {
+ // The context has not stored any "tdef" node. So we must be in here for
+ // the first time.
+ this->ctx_->tdef (node); // save the typedef node
+
+ // Grab the immediate base type node.
+ bt = node->primitive_base_type ();
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_ch::"
+ "visit_typedef - "
+ "bad base type\n"),
+ -1);
+ }
+
+ // Accept on this base type, but generate code for the typedef node.
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_ch::"
+ "visit_typedef - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ this->ctx_->tdef (0); // reset
+ }
+
+ node->cli_hdr_any_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_typedef_any_op_ch::visit_array (be_array *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!bt->imported () &&
+ bt->node_type () == AST_Decl::NT_array)
+ {
+ // Let the base class visitor handle this case.
+ if (this->be_visitor_typedef::visit_array (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_ch::"
+ "visit_array - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_any_op_ch::visit_enum (be_enum *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_enum)
+ {
+ // Let the base class visitor handle this case.
+ if (this->be_visitor_typedef::visit_enum (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_ch::"
+ "visit_enum - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_any_op_ch::visit_sequence (be_sequence *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_sequence)
+ {
+ // Let the base class visitor handle this case.
+ if (this->be_visitor_typedef::visit_sequence (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_ch::"
+ "visit_sequence - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_any_op_ch::visit_structure (be_structure *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_struct)
+ {
+ // Let the base class visitor handle this case.
+ if (this->be_visitor_typedef::visit_structure (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_ch::"
+ "visit_structure - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_any_op_ch::visit_union (be_union *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_union)
+ {
+ // Let the base class visitor handle this case.
+ if (this->be_visitor_typedef::visit_union (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_ch::"
+ "visit_union - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/any_op_cs.cpp
new file mode 100644
index 00000000000..9e01f31dc19
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typedef/any_op_cs.cpp
@@ -0,0 +1,275 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Any operators in the client stubs
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+be_visitor_typedef_any_op_cs::~be_visitor_typedef_any_op_cs (void)
+{
+}
+
+int
+be_visitor_typedef_any_op_cs::visit_typedef (be_typedef *node)
+{
+ if (node->cli_stub_any_op_gen () || node->imported ())
+ return 0;
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // generate the Any <<= and >>= operator declarations
+ // Any <<= and >>= operators
+ os->indent ();
+
+ // In general, we may have a chain of typedefs. i.e.,
+ // typedef sequence<long> X;
+ // typedef X Y;
+ // typedef Y Z; and so on
+ // The first time we will be in will be for node Z for which the code
+ // generation has to take place. However, it is not enough to just generate
+ // code that looks like -
+ // typedef Y Z;
+ // For different types (in this case we have a sequence), we will need
+ // typedefs for the _var and _out types for Z. If it had been an array, we
+ // will additionally have the _forany type as well as inlined *_alloc, _dup,
+ // and _free methods.
+ //
+ // Finally, we need to differentiate between the case where we were
+ // generating code for
+ // typedef sequence<long> X; and
+ // typedef Y Z; where Y was somehow aliased to the sequence. In the former
+ // case, we will need to generate all the code for sequence<long> or whatever
+ // the type maybe. In the latter, we just need typedefs for the type and all
+ // associated _var, _out, and other types.
+
+ be_type *bt; // base type
+
+ if (this->ctx_->tdef ())
+ {
+ // the fact that we are here indicates that we were generating code for a
+ // typedef node whose base type also happens to be another typedef-ed
+ // (i.e. an alias) node for another (possibly alias) node
+
+ this->ctx_->alias (node); // save this alias
+
+ // grab the most primitive base type in the chain to avoid recusrsively
+ // going thru this visit method
+ bt = node->primitive_base_type ();
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_cs::"
+ "visit_typedef - "
+ "bad primitive base type\n"
+ ), -1);
+ }
+
+ // accept on this base type, but generate code for the typedef node
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_cs::"
+ "visit_typedef - "
+ "failed to accept visitor\n"
+ ), -1);
+ }
+ this->ctx_->alias (0); // reset
+ }
+ else
+ {
+ // the context has not stored any "tdef" node. So we must be in here for
+ // the first time
+ this->ctx_->tdef (node); // save the typedef node
+
+ // grab the immediate base type node
+ bt = be_type::narrow_from_decl (node->base_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_cs::"
+ "visit_typedef - "
+ "bad base type\n"
+ ), -1);
+ }
+
+ // accept on this base type, but generate code for the typedef node
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_cs::"
+ "visit_typedef - "
+ "failed to accept visitor\n"
+ ), -1);
+ }
+
+ this->ctx_->tdef (0); // reset
+ }
+
+ node->cli_stub_any_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_typedef_any_op_cs::visit_array (be_array *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ()) // typedef of a typedef
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ if (!bt->imported () &&
+ bt->node_type () == AST_Decl::NT_array) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_array (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_cs::"
+ "visit_array - "
+ "base class visitor failed \n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_any_op_cs::visit_enum (be_enum *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ()) // typedef of a typedef
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ if (bt->node_type () == AST_Decl::NT_enum) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_enum (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_cs::"
+ "visit_enum - "
+ "base class visitor failed \n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_any_op_cs::visit_sequence (be_sequence *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ()) // typedef of a typedef
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ if (bt->node_type () == AST_Decl::NT_sequence) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_sequence (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_cs::"
+ "visit_sequence - "
+ "base class visitor failed \n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_any_op_cs::visit_structure (be_structure *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ()) // typedef of a typedef
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ if (bt->node_type () == AST_Decl::NT_struct) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_structure (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_cs::"
+ "visit_structure - "
+ "base class visitor failed \n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_any_op_cs::visit_union (be_union *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ()) // typedef of a typedef
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ if (bt->node_type () == AST_Decl::NT_union) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_union (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_cs::"
+ "visit_union - "
+ "base class visitor failed \n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_ch.cpp
new file mode 100644
index 00000000000..e27d1750d14
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_ch.cpp
@@ -0,0 +1,293 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Cdr operators of a Typedef node
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+be_visitor_typedef_cdr_op_ch::~be_visitor_typedef_cdr_op_ch (void)
+{
+}
+
+int
+be_visitor_typedef_cdr_op_ch::visit_typedef (be_typedef *node)
+{
+ if (node->cli_hdr_cdr_op_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Generate the CDR << and >> operator declarations.
+ os->indent ();
+
+ // In general, we may have a chain of typedefs. i.e.,
+ // typedef sequence<long> X;
+ // typedef X Y;
+ // typedef Y Z; and so on
+ // The first time we will be in will be for node Z for which the code
+ // generation has to take place. However, it is not enough to just generate
+ // code that looks like -
+ // typedef Y Z;
+ // For different types (in this case we have a sequence), we will need
+ // typedefs for the _var and _out types for Z. If it had been an array, we
+ // will additionally have the _forcdr type as well as inlined *_alloc, _dup,
+ // and _free methods.
+ //
+ // Finally, we need to differentiate between the case where we were
+ // generating code for
+ // typedef sequence<long> X; and
+ // typedef Y Z; where Y was somehow aliased to the sequence. In the former
+ // case, we will need to generate all the code for sequence<long> or whatever
+ // the type maybe. In the latter, we just need typedefs for the type and all
+ // associated _var, _out, and other types.
+
+ be_type *bt; // base type
+
+ if (this->ctx_->tdef ())
+ {
+ // The fact that we are here indicates that we were generating code for a
+ // typedef node whose base type also happens to be another typedef-ed
+ // (i.e. an alias) node for another (possibly alias) node.
+
+ this->ctx_->alias (node); // save this alias
+
+ // Grab the most primitive base type in the chain to avoid recusrsively
+ // going thru this visit method.
+ bt = node->primitive_base_type ();
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_cdr_op_ch::"
+ "visit_typedef - "
+ "bad primitive base type\n"),
+ -1);
+ }
+
+ // Accept on this base type, but generate code for the typedef node.
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_cdr_op_ch::"
+ "visit_typedef - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0); // reset
+ }
+ else
+ {
+ // The context has not stored cdr "tdef" node. So we must be in here for
+ // the first time.
+ this->ctx_->tdef (node); // save the typedef node
+
+ // Grab the immediate base type node.
+ bt = be_type::narrow_from_decl (node->base_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_cdr_op_ch::"
+ "visit_typedef - "
+ "bad base type\n"),
+ -1);
+ }
+
+ // Accept on this base type, but generate code for the typedef node.
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_cdr_op_ch::"
+ "visit_typedef - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ this->ctx_->tdef (0);
+ }
+
+ node->cli_hdr_cdr_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_typedef_cdr_op_ch::visit_array (be_array *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!bt->imported () &&
+ bt->node_type () == AST_Decl::NT_array)
+ {
+ // Let the base class visitor handle this case.
+ if (this->be_visitor_typedef::visit_array (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_cdr_op_ch::"
+ "visit_array - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_cdr_op_ch::visit_enum (be_enum *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_enum)
+ {
+ // 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_ch::"
+ "visit_enum - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_cdr_op_ch::visit_sequence (be_sequence *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_sequence)
+ {
+ // Let the base class visitor handle this case.
+ if (this->be_visitor_typedef::visit_sequence (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_cdr_op_ch::"
+ "visit_sequence - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_cdr_op_ch::visit_structure (be_structure *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_struct)
+ {
+ // Let the base class visitor handle this case.
+ if (this->be_visitor_typedef::visit_structure (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_cdr_op_ch::"
+ "visit_structure - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_cdr_op_ch::visit_union (be_union *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_union)
+ {
+ // Let the base class visitor handle this case.
+ if (this->be_visitor_typedef::visit_union (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_op_ch::"
+ "visit_union - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
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
new file mode 100644
index 00000000000..ba1e87f43be
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_cs.cpp
@@ -0,0 +1,263 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Cdr operators in the client stubs
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+be_visitor_typedef_cdr_op_cs::~be_visitor_typedef_cdr_op_cs (void)
+{
+}
+
+int
+be_visitor_typedef_cdr_op_cs::visit_typedef (be_typedef *node)
+{
+ if (node->cli_stub_cdr_op_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ // In general, we may have a chain of typedefs. i.e.,
+ // typedef sequence<long> X;
+ // typedef X Y;
+ // typedef Y Z; and so on
+ // The first time we will be in will be for node Z for which the code
+ // generation has to take place. However, it is not enough to just generate
+ // code that looks like -
+ // typedef Y Z;
+ // For different types (in this case we have a sequence), we will need
+ // typedefs for the _var and _out types for Z. If it had been an array, we
+ // will additionally have the _forcdr type as well as inlined *_alloc, _dup,
+ // and _free methods.
+ //
+ // Finally, we need to differentiate between the case where we were
+ // generating code for
+ // typedef sequence<long> X; and
+ // typedef Y Z; where Y was somehow aliased to the sequence. In the former
+ // case, we will need to generate all the code for sequence<long> or whatever
+ // the type maybe. In the latter, we just need typedefs for the type and all
+ // associated _var, _out, and other types.
+
+ be_type *bt; // base type
+
+ if (this->ctx_->tdef ())
+ {
+ // the fact that we are here indicates that we were generating code for a
+ // typedef node whose base type also happens to be another typedef-ed
+ // (i.e. an alias) node for another (possibly alias) node
+
+ this->ctx_->alias (node); // save this alias
+
+ // grab the most primitive base type in the chain to avoid recusrsively
+ // going thru this visit method
+ bt = node->primitive_base_type ();
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_cdr_op_cs::"
+ "visit_typedef - "
+ "bad primitive base type\n"),
+ -1);
+ }
+
+ // accept on this base type, but generate code for the typedef node
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_cdr_op_cs::"
+ "visit_typedef - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0); // reset
+ }
+ else
+ {
+ // the context has not stored cdr "tdef" node. So we must be in here for
+ // the first time
+ this->ctx_->tdef (node); // save the typedef node
+
+ // grab the immediate base type node
+ bt = be_type::narrow_from_decl (node->base_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_cdr_op_cs::"
+ "visit_typedef - "
+ "bad base type\n"),
+ -1);
+ }
+
+ // accept on this base type, but generate code for the typedef node
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_cdr_op_cs::"
+ "visit_typedef - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ this->ctx_->tdef (0); // reset
+ }
+
+ node->cli_stub_cdr_op_gen (1);
+ return 0;
+}
+
+int
+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 ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!bt->imported () &&
+ bt->node_type () == AST_Decl::NT_array) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_array (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_cdr_op_cs::"
+ "visit_array - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ 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;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_sequence) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_sequence (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_cdr_op_cs::"
+ "visit_sequence - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+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 ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_struct) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_structure (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_cdr_op_cs::"
+ "visit_structure - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+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 ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_union) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_union (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_cdr_op_cs::"
+ "visit_union - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/serializer_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/serializer_op_ch.cpp
new file mode 100644
index 00000000000..0c13f01a375
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typedef/serializer_op_ch.cpp
@@ -0,0 +1,294 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for TAO::DCPS::Serializer operators
+// of a Typedef node
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_typedef,
+ serializer_op_ch,
+ "$Id$")
+
+// ***************************************************************************
+// Typedef visitor for generating Serializer operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_typedef_serializer_op_ch::be_visitor_typedef_serializer_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_typedef (ctx)
+{
+}
+
+be_visitor_typedef_serializer_op_ch::~be_visitor_typedef_serializer_op_ch (void)
+{
+}
+
+int
+be_visitor_typedef_serializer_op_ch::visit_typedef (be_typedef *node)
+{
+ if (node->cli_hdr_serializer_op_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Generate the Serializer << and >> operator declarations.
+ os->indent ();
+
+ // In general, we may have a chain of typedefs. i.e.,
+ // typedef sequence<long> X;
+ // typedef X Y;
+ // typedef Y Z; and so on
+ // The first time we will be in will be for node Z for which the code
+ // generation has to take place. However, it is not enough to just generate
+ // code that looks like -
+ // typedef Y Z;
+ // For different types (in this case we have a sequence), we will need
+ // typedefs for the _var and _out types for Z. If it had been an array, we
+ // will additionally have the _forcdr type as well as inlined *_alloc, _dup,
+ // and _free methods.
+ //
+ // Finally, we need to differentiate between the case where we were
+ // generating code for
+ // typedef sequence<long> X; and
+ // typedef Y Z; where Y was somehow aliased to the sequence. In the former
+ // case, we will need to generate all the code for sequence<long> or whatever
+ // the type maybe. In the latter, we just need typedefs for the type and all
+ // associated _var, _out, and other types.
+
+ be_type *bt; // base type
+
+ if (this->ctx_->tdef ())
+ {
+ // The fact that we are here indicates that we were generating code for a
+ // typedef node whose base type also happens to be another typedef-ed
+ // (i.e. an alias) node for another (possibly alias) node.
+
+ this->ctx_->alias (node); // save this alias
+
+ // Grab the most primitive base type in the chain to avoid recusrsively
+ // going thru this visit method.
+ bt = node->primitive_base_type ();
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_serializer_op_ch::"
+ "visit_typedef - "
+ "bad primitive base type\n"),
+ -1);
+ }
+
+ // Accept on this base type, but generate code for the typedef node.
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_serializer_op_ch::"
+ "visit_typedef - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0); // reset
+ }
+ else
+ {
+ // The context has not stored cdr "tdef" node. So we must be in here for
+ // the first time.
+ this->ctx_->tdef (node); // save the typedef node
+
+ // Grab the immediate base type node.
+ bt = be_type::narrow_from_decl (node->base_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_serializer_op_ch::"
+ "visit_typedef - "
+ "bad base type\n"),
+ -1);
+ }
+
+ // Accept on this base type, but generate code for the typedef node.
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_serializer_op_ch::"
+ "visit_typedef - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ this->ctx_->tdef (0);
+ }
+
+ node->cli_hdr_serializer_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_typedef_serializer_op_ch::visit_array (be_array *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!bt->imported () &&
+ bt->node_type () == AST_Decl::NT_array)
+ {
+ // Let the base class visitor handle this case.
+ if (this->be_visitor_typedef::visit_array (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_serializer_op_ch::"
+ "visit_array - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_serializer_op_ch::visit_enum (be_enum *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_enum)
+ {
+ // 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_serializer_op_ch::"
+ "visit_enum - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_serializer_op_ch::visit_sequence (be_sequence *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_sequence)
+ {
+ // Let the base class visitor handle this case.
+ if (this->be_visitor_typedef::visit_sequence (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_serializer_op_ch::"
+ "visit_sequence - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_serializer_op_ch::visit_structure (be_structure *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_struct)
+ {
+ // Let the base class visitor handle this case.
+ if (this->be_visitor_typedef::visit_structure (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_serializer_op_ch::"
+ "visit_structure - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_serializer_op_ch::visit_union (be_union *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_union)
+ {
+ // Let the base class visitor handle this case.
+ if (this->be_visitor_typedef::visit_union (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_op_ch::"
+ "visit_union - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/serializer_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/serializer_op_cs.cpp
new file mode 100644
index 00000000000..345dc70a1f3
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typedef/serializer_op_cs.cpp
@@ -0,0 +1,264 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for TAO::DCPS::Serializer operators
+// in the client stubs
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_typedef,
+ serializer_op_cs,
+ "$Id$")
+
+// ***************************************************************************
+// Typedef visitor for generating Serializer operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_typedef_serializer_op_cs::be_visitor_typedef_serializer_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_typedef (ctx)
+{
+}
+
+be_visitor_typedef_serializer_op_cs::~be_visitor_typedef_serializer_op_cs (void)
+{
+}
+
+int
+be_visitor_typedef_serializer_op_cs::visit_typedef (be_typedef *node)
+{
+ if (node->cli_stub_serializer_op_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ // In general, we may have a chain of typedefs. i.e.,
+ // typedef sequence<long> X;
+ // typedef X Y;
+ // typedef Y Z; and so on
+ // The first time we will be in will be for node Z for which the code
+ // generation has to take place. However, it is not enough to just generate
+ // code that looks like -
+ // typedef Y Z;
+ // For different types (in this case we have a sequence), we will need
+ // typedefs for the _var and _out types for Z. If it had been an array, we
+ // will additionally have the _forcdr type as well as inlined *_alloc, _dup,
+ // and _free methods.
+ //
+ // Finally, we need to differentiate between the case where we were
+ // generating code for
+ // typedef sequence<long> X; and
+ // typedef Y Z; where Y was somehow aliased to the sequence. In the former
+ // case, we will need to generate all the code for sequence<long> or whatever
+ // the type maybe. In the latter, we just need typedefs for the type and all
+ // associated _var, _out, and other types.
+
+ be_type *bt; // base type
+
+ if (this->ctx_->tdef ())
+ {
+ // the fact that we are here indicates that we were generating code for a
+ // typedef node whose base type also happens to be another typedef-ed
+ // (i.e. an alias) node for another (possibly alias) node
+
+ this->ctx_->alias (node); // save this alias
+
+ // grab the most primitive base type in the chain to avoid recusrsively
+ // going thru this visit method
+ bt = node->primitive_base_type ();
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_serializer_op_cs::"
+ "visit_typedef - "
+ "bad primitive base type\n"),
+ -1);
+ }
+
+ // accept on this base type, but generate code for the typedef node
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_serializer_op_cs::"
+ "visit_typedef - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0); // reset
+ }
+ else
+ {
+ // the context has not stored cdr "tdef" node. So we must be in here for
+ // the first time
+ this->ctx_->tdef (node); // save the typedef node
+
+ // grab the immediate base type node
+ bt = be_type::narrow_from_decl (node->base_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_serializer_op_cs::"
+ "visit_typedef - "
+ "bad base type\n"),
+ -1);
+ }
+
+ // accept on this base type, but generate code for the typedef node
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_serializer_op_cs::"
+ "visit_typedef - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ this->ctx_->tdef (0); // reset
+ }
+
+ node->cli_stub_serializer_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_typedef_serializer_op_cs::visit_array (be_array *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ()) // typedef of a typedef
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!bt->imported () &&
+ bt->node_type () == AST_Decl::NT_array) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_array (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_serializer_op_cs::"
+ "visit_array - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_serializer_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_sequence) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_sequence (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_serializer_op_cs::"
+ "visit_sequence - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_serializer_op_cs::visit_structure (be_structure *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_struct) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_structure (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_serializer_op_cs::"
+ "visit_structure - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_serializer_op_cs::visit_union (be_union *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_union) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_union (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_serializer_op_cs::"
+ "visit_union - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/typedef.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/typedef.cpp
new file mode 100644
index 00000000000..001de4594ab
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typedef/typedef.cpp
@@ -0,0 +1,480 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// typedef.cpp
+//
+// = DESCRIPTION
+// Generic visitor generating code for Typedefs
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_typedef,
+ typedef,
+ "$Id$")
+
+// ******************************************************
+// Generic typedef visitor.
+// ******************************************************
+
+be_visitor_typedef::be_visitor_typedef (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_typedef::~be_visitor_typedef (void)
+{
+}
+
+int be_visitor_typedef::visit_typedef (be_typedef *)
+{
+ return -1; // Must be overridden.
+}
+
+// All common visit methods for typedef visitor.
+
+int
+be_visitor_typedef::visit_array (be_array *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ {
+ ctx.state (TAO_CodeGen::TAO_ARRAY_CH);
+ be_visitor_array_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ ctx.state (TAO_CodeGen::TAO_ROOT_CH);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_array_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_array_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_array_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_array_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_array_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_array_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ {
+ be_visitor_array_serializer_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ be_visitor_array_serializer_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);
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef::"
+ "visit_array - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef::visit_enum (be_enum *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ {
+ be_visitor_enum_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_enum_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_enum_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_enum_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_enum_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_enum_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ {
+ be_visitor_enum_serializer_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ be_visitor_enum_serializer_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ return 0; // nothing to be done
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef::"
+ "visit_enum - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef::"
+ "visit_enum - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef::visit_sequence (be_sequence *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ {
+ be_visitor_sequence_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_sequence_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_sequence_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_sequence_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_sequence_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_sequence_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ {
+ be_visitor_sequence_serializer_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ be_visitor_sequence_serializer_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);
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef::"
+ "visit_sequence - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ 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);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ {
+ be_visitor_structure_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_structure_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_structure_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_structure_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_structure_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_structure_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_structure_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ {
+ be_visitor_structure_serializer_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ be_visitor_structure_serializer_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);
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef::"
+ "visit_structure - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef::visit_union (be_union *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ {
+ be_visitor_union_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_union_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_union_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_union_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_union_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_union_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_union_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ {
+ be_visitor_union_serializer_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ be_visitor_union_serializer_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);
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef::"
+ "visit_union - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ch.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ch.cpp
new file mode 100644
index 00000000000..1b0731237b2
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ch.cpp
@@ -0,0 +1,649 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// typedef_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Typedef in the client header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID(be_visitor_typedef,
+ typedef_ch,
+ "$Id$")
+
+// ******************************************************
+// Typedef visitor for client header
+// ******************************************************
+
+be_visitor_typedef_ch::be_visitor_typedef_ch (be_visitor_context *ctx)
+ : be_visitor_typedef (ctx)
+{
+}
+
+be_visitor_typedef_ch::~be_visitor_typedef_ch (void)
+{
+}
+
+int
+be_visitor_typedef_ch::visit_typedef (be_typedef *node)
+{
+ // In general, we may have a chain of typedefs. i.e.,
+ // typedef sequence<long> X;
+ // typedef X Y;
+ // typedef Y Z; and so on
+ // The first time we will be in will be for node Z for which the code
+ // generation has to take place. However, it is not enough to just generate
+ // code that looks like -
+ // typedef Y Z;
+ // For different types (in this case we have a sequence), we will need
+ // typedefs for the _var and _out types for Z. If it had been an array, we
+ // will additionally have the _forany type as well as inlined *_alloc, _dup,
+ // and _free methods.
+ //
+ // Finally, we need to differentiate between the case where we were
+ // generating code for
+ // typedef sequence<long> X; and
+ // typedef Y Z; where Y was somehow aliased to the sequence. In the former
+ // case, we will need to generate all the code for sequence<long> or whatever
+ // the type maybe. In the latter, we just need typedefs for the type and all
+ // associated _var, _out, and other types.
+
+ be_type *bt;
+
+ if (this->ctx_->tdef ())
+ {
+ // The fact that we are here indicates that we were generating code for
+ // a typedef node whose base type also happens to be another typedefed
+ // (i.e. an alias) node for another (possibly alias) node.
+
+ this->ctx_->alias (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);
+ }
+
+ // Accept on this base type, but generate code for the typedef node.
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ch::"
+ "visit_typedef - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ }
+ else
+ {
+ // 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.
+ bt = be_type::narrow_from_decl (node->base_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ch::"
+ "visit_typedef - "
+ "bad base type\n"),
+ -1);
+ }
+
+ // accept on this base type, but generate code for the typedef node.
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ch::"
+ "visit_typedef - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ // Generate the typecode decl for this typedef node.
+ if (!node->imported () && be_global->tc_support ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_typecode_decl visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ch::"
+ "visit_typedef - "
+ "TypeCode declaration failed\n"),
+ -1);
+ }
+ }
+
+ this->ctx_->tdef (0);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_ch::visit_array (be_array *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_typedef *tdef = this->ctx_->tdef ();
+ be_decl *scope = this->ctx_->scope ();
+ be_type *bt;
+
+ // Is the base type an alias to an array node or an actual array node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ // Is our base type an array node? If so, generate code for that array node.
+ // In the first layer of typedef for an array, cli_hdr_gen() causes us to
+ // skip all the code reached from the first branch. Then the ELSE branch is
+ // skipped and we fail to generate any typedefs for that node. Adding the
+ // check for cli_hdr_gen() to the IF statement keeps it in. Subsequent
+ // layers of typedef, if any, assign the context alias to bt, so we go
+ // straight to the ELSE branch.
+ if (bt->node_type () == AST_Decl::NT_array && bt->cli_hdr_gen () == 0)
+ {
+ // Let the base class visitor handle this case.
+ if (this->be_visitor_typedef::visit_array (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ch::"
+ "visit_array - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+ else
+ {
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Base type is simply an alias to an array node. Simply output the
+ // required typedefs.
+
+ // Typedef the type and the _slice type.
+ *os << "typedef " << bt->nested_type_name (scope)
+ << " " << tdef->nested_type_name (scope) << ";" << be_nl;
+ *os << "typedef " << bt->nested_type_name (scope, "_slice")
+ << " " << tdef->nested_type_name (scope, "_slice") << ";" << be_nl;
+ // Typedef the _var, _out, _tag types.
+ *os << "typedef " << bt->nested_type_name (scope, "_var")
+ << " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl;
+ *os << "typedef " << bt->nested_type_name (scope, "_out")
+ << " " << tdef->nested_type_name (scope, "_out") << ";" << be_nl;
+ *os << "typedef " << bt->nested_type_name (scope, "_tag")
+ << " " << tdef->nested_type_name (scope, "_tag") << ";" << be_nl;
+ *os << "typedef " << bt->nested_type_name (scope, "_forany")
+ << " " << tdef->nested_type_name (scope, "_forany") << ";" << be_nl;
+
+ // The _alloc, _dup, copy, and free methods
+
+ // Since the function nested_type_name() contains a static buffer,
+ // we can have only one call to it from any instantiation per stream
+ // output statement.
+
+ const char *static_decl = "";
+ AST_Module *scope = AST_Module::narrow_from_scope (tdef->defined_in ());
+
+ // If the typedef is not declared globally or in a module, the
+ // associated array memory management function must be static.
+ if (scope == 0)
+ {
+ static_decl = "static ";
+ }
+
+ const char *td_name = tdef->nested_type_name (scope);
+
+ // If the array and the typedef are both declared inside
+ // an interface or valuetype, for example, nested_type_name()
+ // generates the scoped name, which, for the header file,
+ // causes problems with some compilers. If the array and
+ // the typedef are in different scopes of a reopened
+ // module, nested_type_name() will generate the local
+ // name for each, which is ok.
+ if (tdef->defined_in () == node->defined_in ())
+ {
+ td_name = tdef->local_name ()->get_string ();
+ }
+
+ // _alloc
+ *os << be_nl
+ << "ACE_INLINE " << static_decl << be_nl
+ << td_name << "_slice *" << be_nl
+ << td_name << "_alloc (void);" << be_nl;
+ // _dup
+ *os << be_nl
+ << "ACE_INLINE " << static_decl << be_nl
+ << td_name << "_slice *" << be_nl
+ << td_name << "_dup (" << be_idt << be_idt_nl
+ << "const " << td_name << "_slice *_tao_slice" << be_uidt_nl
+ << ");" << be_uidt_nl;
+ // _copy
+ *os << be_nl
+ << "ACE_INLINE " << static_decl << be_nl
+ << "void " << td_name << "_copy (" << be_idt << be_idt_nl
+ << td_name << "_slice *_tao_to," << be_nl
+ << "const " << td_name << "_slice *_tao_from" << be_uidt_nl
+ << ");" << be_uidt_nl;
+ // _free
+ *os << be_nl
+ << "ACE_INLINE " << static_decl << be_nl
+ << "void " << td_name << "_free (" << be_idt << be_idt_nl
+ << td_name << "_slice *_tao_slice" << be_uidt_nl
+ << ");" << be_uidt;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_ch::visit_enum (be_enum *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_typedef *tdef = this->ctx_->tdef ();
+ be_decl *scope = this->ctx_->scope ();
+ be_type *bt;
+
+ // Typedef of a typedef?
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_enum)
+ {
+ // Let the base class visitor handle this case.
+ if (this->be_visitor_typedef::visit_enum (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ch::"
+ "visit_enum - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // typedef the type and the _slice type.
+ *os << "typedef " << bt->nested_type_name (scope)
+ << " " << tdef->nested_type_name (scope) << ";" << be_nl;
+ // Typedef the _out
+ *os << "typedef " << bt->nested_type_name (scope, "_out")
+ << " " << tdef->nested_type_name (scope, "_out") << ";";
+
+ return 0;
+}
+
+int
+be_visitor_typedef_ch::visit_interface (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_typedef *tdef = this->ctx_->tdef ();
+ be_decl *scope = this->ctx_->scope ();
+ be_type *bt;
+
+ // Typedef of a typedef?
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Typedef the object.
+ *os << "typedef " << bt->nested_type_name (scope) << " "
+ << tdef->nested_type_name (scope) << ";" << be_nl;
+
+ // Typedef the _ptr.
+ *os << "typedef " << bt->nested_type_name (scope, "_ptr")
+ << " " << tdef->nested_type_name (scope, "_ptr") << ";" << be_nl;
+
+ // Typedef the _var.
+ *os << "typedef " << bt->nested_type_name (scope, "_var")
+ << " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl;
+
+ // typedef the _out
+ *os << "typedef " << bt->nested_type_name (scope, "_out")
+ << " " << tdef->nested_type_name (scope, "_out") << ";" << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_typedef_ch::visit_interface_fwd (be_interface_fwd *)
+{
+// be_interface *fd =
+// be_interface::narrow_from_decl (node->full_definition ());
+// return this->visit_interface (fd);
+ return 0;
+}
+
+int
+be_visitor_typedef_ch::visit_predefined_type (be_predefined_type *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_typedef *tdef = this->ctx_->tdef ();
+ be_decl *scope = this->ctx_->scope ();
+ be_type *bt;
+
+ // Typedef of a typedef?
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Typedef the type.
+ *os << "typedef " << bt->nested_type_name (scope)
+ << " " << tdef->nested_type_name (scope) << ";" << be_nl;
+
+ 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")
+ << " " << tdef->nested_type_name (scope, "_ptr") << ";" << be_nl;
+ *os << "typedef " << bt->nested_type_name (scope, "_var")
+ << " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl;
+ }
+
+ // Typedef the _out.
+ *os << "typedef " << bt->nested_type_name (scope, "_out")
+ << " " << tdef->nested_type_name (scope, "_out") << ";";
+
+ return 0;
+}
+
+int
+be_visitor_typedef_ch::visit_string (be_string *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_typedef *tdef = this->ctx_->tdef ();
+ be_decl *scope = this->ctx_->scope ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "typedef char *"
+ << " " << tdef->nested_type_name (scope) << ";" << be_nl;
+ // Typedef the _var and _out types.
+ *os << "typedef ::CORBA::String_var"
+ << " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl;
+ *os << "typedef ::CORBA::String_out"
+ << " " << tdef->nested_type_name (scope, "_out") << ";";
+ }
+ else
+ {
+ *os << "typedef ::CORBA::WChar *"
+ << " " << tdef->nested_type_name (scope) << ";" << be_nl;
+ // Typedef the _var and _out types.
+ *os << "typedef ::CORBA::WString_var"
+ << " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl;
+ *os << "typedef ::CORBA::WString_out"
+ << " " << tdef->nested_type_name (scope, "_out") << ";";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_ch::visit_sequence (be_sequence *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_typedef *tdef = this->ctx_->tdef ();
+ be_decl *scope = this->ctx_->scope ();
+ be_type *bt;
+
+ // Typedef of a typedef?
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_sequence)
+ {
+ // Let the base class visitor handle this case.
+ if (this->be_visitor_typedef::visit_sequence (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ch::"
+ "visit_sequence - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+ else
+ {
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Typedef the type.
+ *os << "typedef " << bt->nested_type_name (scope)
+ << " " << tdef->nested_type_name (scope) << ";" << be_nl;
+ // Typedef the _var and _out types.
+ *os << "typedef " << bt->nested_type_name (scope, "_var")
+ << " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl;
+ *os << "typedef " << bt->nested_type_name (scope, "_out")
+ << " " << tdef->nested_type_name (scope, "_out") << ";";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_ch::visit_structure (be_structure *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_typedef *tdef = this->ctx_->tdef ();
+ be_decl *scope = this->ctx_->scope ();
+ be_type *bt;
+
+ // Typedef of a typedef?
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_struct)
+ {
+ // Let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_structure (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ch::"
+ "visit_structure - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Typedef the type.
+ *os << "typedef " << bt->nested_type_name (scope)
+ << " " << tdef->nested_type_name (scope) << ";" << be_nl;
+ // typedef the _var and _out types.
+ *os << "typedef " << bt->nested_type_name (scope, "_var")
+ << " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl;
+ *os << "typedef " << bt->nested_type_name (scope, "_out")
+ << " " << tdef->nested_type_name (scope, "_out") << ";";
+
+ return 0;
+}
+
+int
+be_visitor_typedef_ch::visit_union (be_union *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_typedef *tdef = this->ctx_->tdef ();
+ be_decl *scope = this->ctx_->scope ();
+ be_type *bt;
+
+ // Typedef of a typedef?
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_union)
+ {
+ // Let the base class visitor handle this case.
+ if (this->be_visitor_typedef::visit_union (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ch::"
+ "visit_union - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Typedef the type.
+ *os << "typedef " << bt->nested_type_name (scope)
+ << " " << tdef->nested_type_name (scope) << ";" << be_nl;
+ // Typedef the _var and _out types.
+ *os << "typedef " << bt->nested_type_name (scope, "_var")
+ << " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl;
+ *os << "typedef " << bt->nested_type_name (scope, "_out")
+ << " " << tdef->nested_type_name (scope, "_out") << ";";
+
+ return 0;
+}
+
+int
+be_visitor_typedef_ch::visit_valuebox (be_valuebox *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_typedef *tdef = this->ctx_->tdef ();
+ be_decl *scope = this->ctx_->scope ();
+ be_type *bt;
+
+ // Typedef of a typedef?
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Typedef the object.
+ *os << "typedef " << bt->nested_type_name (scope) << " "
+ << tdef->nested_type_name (scope) << ";" << be_nl;
+
+ // Typedef the _var.
+ *os << "typedef " << bt->nested_type_name (scope, "_var")
+ << " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl;
+
+ // typedef the _out
+ *os << "typedef " << bt->nested_type_name (scope, "_out")
+ << " " << tdef->nested_type_name (scope, "_out") << ";" << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_typedef_ch::visit_valuetype (be_valuetype *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_typedef *tdef = this->ctx_->tdef ();
+ be_decl *scope = this->ctx_->scope ();
+ be_type *bt;
+
+ // Typedef of a typedef?
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Typedef the object.
+ *os << "typedef " << bt->nested_type_name (scope) << " "
+ << tdef->nested_type_name (scope) << ";" << be_nl;
+
+ // Typedef the _var.
+ *os << "typedef " << bt->nested_type_name (scope, "_var")
+ << " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl;
+
+ // typedef the _out
+ *os << "typedef " << bt->nested_type_name (scope, "_out")
+ << " " << tdef->nested_type_name (scope, "_out") << ";" << be_nl;
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ci.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ci.cpp
new file mode 100644
index 00000000000..15bffced400
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ci.cpp
@@ -0,0 +1,318 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// typedef_ci.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Typedefs in the client inline file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_typedef,
+ typedef_ci,
+ "$Id$")
+
+// ******************************************************
+// Typedef visitor for client inline
+// ******************************************************
+
+be_visitor_typedef_ci::be_visitor_typedef_ci (be_visitor_context *ctx)
+ : be_visitor_typedef (ctx)
+{
+}
+
+be_visitor_typedef_ci::~be_visitor_typedef_ci (void)
+{
+}
+
+int
+be_visitor_typedef_ci::visit_typedef (be_typedef *node)
+{
+ // In general, we may have a chain of typedefs. i.e.,
+ // typedef sequence<long> X;
+ // typedef X Y;
+ // typedef Y Z; and so on
+ // The first time we will be in will be for node Z for which the code
+ // generation has to take place. However, it is not enough to just generate
+ // code that looks like -
+ // typedef Y Z;
+ // For different types (in this case we have a sequence), we will need
+ // typedefs for the _var and _out types for Z. If it had been an array, we
+ // will additionally have the _forany type as well as inlined *_alloc
+ // methods.
+ //
+ // Finally, we need to differentiate between the case where we were
+ // generating code for
+ // typedef sequence<long> X; and
+ // typedef Y Z; where Y was somehow aliased to the sequence. In the former
+ // case, we will need to generate all the code for sequence<long> or whatever
+ // the type maybe. In the latter, we just need typedefs for the type and all
+ // associated _var, _out, and other types.
+
+ be_type *bt; // base type
+
+ if (this->ctx_->tdef ())
+ {
+ // the fact that we are here indicates that we were generating code for a
+ // typedef node whose base type also happens to be another typedef-ed
+ // (i.e. an alias) node for another (possibly alias) node
+
+ this->ctx_->alias (node); // save this alias
+
+ // grab the most primitive base type in the chain to avoid recusrsively
+ // going thru this visit method
+ bt = node->primitive_base_type ();
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ch::"
+ "visit_typedef - "
+ "bad primitive base type\n"),
+ -1);
+ }
+
+ // accept on this base type
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ch::"
+ "visit_typedef - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ }
+ else
+ {
+ // the context has not stored any "tdef" node. So we must be in here for
+ // the first time
+ this->ctx_->tdef (node); // save the typedef node
+
+ // grab the immediate base type node
+ bt = be_type::narrow_from_decl (node->base_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ch::"
+ "visit_typedef - "
+ "bad base type\n"),
+ -1);
+ }
+
+ // accept on this base type
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ch::"
+ "visit_typedef - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ this->ctx_->tdef (0);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_ci::visit_array (be_array *node)
+{
+ TAO_OutStream *os = this->ctx_->stream (); // output stream
+ be_typedef *tdef = this->ctx_->tdef (); // typedef node
+ be_type *bt;
+
+ // This doesn't catch 'typedef of a typedef' if the node is
+ // imported, so we check for that below before generating
+ // any code.
+ if (this->ctx_->alias ())
+ {
+ // Typedef of a typedef.
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ // Is our base type an array node? If so, generate code for that array node.
+ // In the first layer of typedef for an array, cli_hdr_gen() causes us to
+ // skip all the code reached from the first branch. Then the ELSE branch is
+ // skipped and we fail to generate any typedefs for that node. Adding the
+ // check for cli_hdr_gen() to the IF statement keeps it in. Subsequent
+ // layers of typedef, if any, assign the context alias to bt, so we go
+ // straight to the ELSE branch.
+ if (bt->node_type () == AST_Decl::NT_array && bt->cli_inline_gen () == 0)
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_array (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ci::"
+ "visit_array - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+ else
+ {
+ if ((bt->imported () && tdef->imported ()) || bt->cli_inline_gen())
+ {
+ // Code below is generated in another file.
+ return 0;
+ }
+
+ // generate the inline code for alloc, dup, copy, and free methods
+
+ // alloc method
+ *os << be_nl
+ << "ACE_INLINE " << be_nl
+ << tdef->name () << "_slice *" << be_nl;
+ *os << tdef->name () << "_alloc (void)" << be_nl;
+ *os << "{" << be_idt_nl;
+ *os << "return " << bt->name () << "_alloc ();" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+
+ // dup method
+ *os << "ACE_INLINE " << be_nl
+ << tdef->name () << "_slice *" << be_nl;
+ *os << tdef->name () << "_dup (" << be_idt << be_idt_nl
+ << "const " << tdef->name ()
+ << "_slice *_tao_src" << be_uidt_nl
+ << ")" << be_uidt_nl;
+ *os << "{" << be_idt_nl;
+ *os << "return " << bt->name () << "_dup (_tao_src);" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+
+ // copy method
+ *os << "ACE_INLINE" << be_nl
+ << "void" << be_nl;
+ *os << tdef->name () << "_copy (" << be_idt << be_idt_nl
+ << tdef->name ()
+ << "_slice *_tao_dest," << be_nl
+ << "const " << tdef->name () << "_slice *_tao_src" << be_uidt_nl
+ << ")" << be_uidt_nl;
+ *os << "{" << be_idt_nl;
+ *os << bt->name () << "_copy (_tao_dest, _tao_src);" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+
+ // free method
+ *os << "ACE_INLINE" << be_nl
+ << "void" << be_nl;
+ *os << tdef->name () << "_free (" << be_idt << be_idt_nl
+ << tdef->name () << "_slice *_tao_src" << be_uidt_nl
+ << ")" << be_uidt_nl;
+ *os << "{" << be_idt_nl;
+ *os << bt->name () << "_free (_tao_src);" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+ }
+
+ bt->cli_inline_gen (true);
+ return 0;
+}
+
+int
+be_visitor_typedef_ci::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_sequence) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_sequence (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ci::"
+ "visit_sequence - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_ci::visit_structure (be_structure *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ()) // typedef of a typedef
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_struct) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_structure (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ci::"
+ "visit_structure - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_ci::visit_union (be_union *node)
+{
+ be_type *bt;
+
+ if (this->ctx_->alias ()) // typedef of a typedef
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (bt->node_type () == AST_Decl::NT_union) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_union (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ci::"
+ "visit_union - "
+ "base class visitor failed \n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/typedef_cs.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/typedef_cs.cpp
new file mode 100644
index 00000000000..647a18ab3c1
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typedef/typedef_cs.cpp
@@ -0,0 +1,146 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// typedef_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Typedef in the client stubs
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_typedef,
+ typedef_cs,
+ "$Id$")
+
+// ******************************************************
+// Typedef visitor for client stubs
+// ******************************************************
+
+be_visitor_typedef_cs::be_visitor_typedef_cs (be_visitor_context *ctx)
+ : be_visitor_typedef (ctx)
+{
+}
+
+be_visitor_typedef_cs::~be_visitor_typedef_cs (void)
+{
+}
+
+int
+be_visitor_typedef_cs::visit_typedef (be_typedef *node)
+{
+ // In general, we may have a chain of typedefs. i.e.,
+ // typedef sequence<long> X;
+ // typedef X Y;
+ // typedef Y Z; and so on
+ // The first time we will be in will be for node Z for which the code
+ // generation has to take place. However, it is not enough to just generate
+ // code that looks like -
+ // typedef Y Z;
+ // For different types (in this case we have a sequence), we will need
+ // typedefs for the _var and _out types for Z. If it had been an array, we
+ // will additionally have the _forany type as well as inlined *_alloc
+ // methods.
+ //
+ // Finally, we need to differentiate between the case where we were
+ // generating code for
+ // typedef sequence<long> X; and
+ // typedef Y Z; where Y was somehow aliased to the sequence. In the former
+ // case, we will need to generate all the code for sequence<long> or whatever
+ // the type maybe. In the latter, we just need typedefs for the type and all
+ // associated _var, _out, and other types.
+
+ be_type *bt; // base type
+
+ if (this->ctx_->tdef ())
+ {
+ // The fact that we are here indicates that we were generating code for a
+ // typedef node whose base type also happens to be another typedef-ed
+ // (i.e. an alias) node for another (possibly alias) node.
+
+ this->ctx_->alias (node); // save this alias
+
+ // Grab the most primitive base type in the chain to avoid recusrsively
+ // going thru this visit method.
+ bt = node->primitive_base_type ();
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ch::"
+ "visit_typedef - "
+ "bad primitive base type\n"),
+ -1);
+ }
+
+ // Accept on this base type.
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ch::"
+ "visit_typedef - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ }
+ else
+ {
+ // The context has not stored any "tdef" node. So we must be in here for
+ // the first time.
+ this->ctx_->tdef (node);
+
+ // Grab the immediate base type node.
+ bt = be_type::narrow_from_decl (node->base_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ch::"
+ "visit_typedef - "
+ "bad base type\n"),
+ -1);
+ }
+
+ // Accept on this base type.
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_ch::"
+ "visit_typedef - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ if (!node->imported () && be_global->tc_support ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+ // ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
+ TAO::be_visitor_alias_typecode 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);
+ }
+
+ }
+
+ this->ctx_->tdef (0);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_union.cpp b/TAO/TAO_IDL/be/be_visitor_union.cpp
new file mode 100644
index 00000000000..dc35ee0b5c8
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union.cpp
@@ -0,0 +1,54 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_union.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Union
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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 "ace/Log_Msg.h"
+
+#include "be_visitor_union/discriminant_ch.cpp"
+#include "be_visitor_union/discriminant_ci.cpp"
+#include "be_visitor_union/discriminant_cs.cpp"
+#include "be_visitor_union/union.cpp"
+#include "be_visitor_union/union_ch.cpp"
+#include "be_visitor_union/union_ci.cpp"
+#include "be_visitor_union/union_cs.cpp"
+#include "be_visitor_union/any_op_ch.cpp"
+#include "be_visitor_union/any_op_cs.cpp"
+#include "be_visitor_union/cdr_op_ch.cpp"
+#include "be_visitor_union/cdr_op_cs.cpp"
+#include "be_visitor_union/serializer_op_ch.cpp"
+#include "be_visitor_union/serializer_op_cs.cpp"
+
+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
new file mode 100644
index 00000000000..897acca7ad6
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp
@@ -0,0 +1,152 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Any operators for Union.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union,
+ any_op_ch,
+ "$Id$")
+
+// ***************************************************************************
+// Union visitor for generating Any operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_union_any_op_ch::be_visitor_union_any_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_union (ctx)
+{
+}
+
+be_visitor_union_any_op_ch::~be_visitor_union_any_op_ch (void)
+{
+}
+
+int
+be_visitor_union_any_op_ch::visit_union (be_union *node)
+{
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ const char *macro = this->ctx_->export_macro ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *os << macro << " void operator<<= (::CORBA::Any &, const " << node->name ()
+ << " &); // copying version" << be_nl;
+ *os << macro << " void operator<<= (::CORBA::Any &, " << node->name ()
+ << "*); // noncopying version" << be_nl;
+ *os << macro << " ::CORBA::Boolean operator>>= (const ::CORBA::Any &, "
+ << node->name () << " *&); // deprecated\n";
+ *os << macro << " ::CORBA::Boolean operator>>= (const ::CORBA::Any &, const "
+ << node->name () << " *&);";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union::visit_union - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ node->cli_hdr_any_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_union_any_op_ch::visit_union_branch (be_union_branch *node)
+{
+ // 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_union_any_op_ch::"
+ "visit_union_branch - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_any_op_ch::"
+ "visit_field - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_any_op_ch::visit_enum (be_enum *node)
+{
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ be_visitor_enum_any_op_ch visitor (this->ctx_);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_any_op_ch::"
+ "visit_enum - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_any_op_ch::visit_structure (be_structure *node)
+{
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ be_visitor_structure_any_op_ch visitor (this->ctx_);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_any_op_ch::"
+ "visit_structure - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp
new file mode 100644
index 00000000000..b84932013c1
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp
@@ -0,0 +1,240 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Any operators for Union.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union,
+ any_op_cs,
+ "$Id$")
+
+// ***************************************************************************
+// Union visitor for generating Any operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_union_any_op_cs::be_visitor_union_any_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_union (ctx)
+{
+}
+
+be_visitor_union_any_op_cs::~be_visitor_union_any_op_cs (void)
+{
+}
+
+int
+be_visitor_union_any_op_cs::visit_union (be_union *node)
+{
+ if (node->cli_stub_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl
+ << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ // Since we don't generate CDR stream operators for types that
+ // explicitly contain a local interface (at some level), we
+ // must override these Any template class methods to avoid
+ // calling the non-existent operators. The zero return value
+ // will eventually cause CORBA::MARSHAL to be raised if this
+ // type is inserted into an Any and then marshaled.
+ if (node->is_local ())
+ {
+ *os << be_nl << be_nl
+ << "namespace TAO" << be_nl
+ << "{" << be_idt_nl
+ << "template<>" << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "Any_Dual_Impl_T<" << node->name ()
+ << ">::marshal_value (TAO_OutputCDR &)" << be_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "template<>" << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "Any_Dual_Impl_T<" << node->name ()
+ << ">::demarshal_value (TAO_InputCDR &)" << be_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}";
+ }
+
+ // Copying insertion.
+ *os << "// Copying insertion." << be_nl
+ << "void operator<<= (" << be_idt << be_idt_nl
+ << "::CORBA::Any &_tao_any," << be_nl
+ << "const " << node->name () << " &_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+
+ << "if (0 == &_tao_elem) // Trying to de-reference NULL object" << be_idt_nl
+ << "_tao_any <<= static_cast<" << node->name () << " *>( 0 ); // Use non-copying insertion of a NULL" << be_uidt_nl
+ << "else" << be_idt_nl
+
+ << "TAO::Any_Dual_Impl_T<" << node->name () << ">::insert_copy ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Non-copying insertion.
+ *os << "// Non-copying insertion." << be_nl
+ << "void operator<<= (" << be_idt << be_idt_nl
+ << "::CORBA::Any &_tao_any," << be_nl
+ << node->name () << " *_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "TAO::Any_Dual_Impl_T<" << node->name () << ">::insert ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Extraction to non-const pointer (deprecated, just calls the other).
+ *os << "// Extraction to non-const pointer (deprecated)." << be_nl
+ << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl
+ << "const ::CORBA::Any &_tao_any," << be_nl
+ << node->name () << " *&_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return _tao_any >>= const_cast<" << be_idt << be_idt_nl
+ << "const " << node->name () << " *&> (" << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Extraction to const pointer.
+ *os << "// Extraction to const pointer." << be_nl
+ << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl
+ << "const ::CORBA::Any &_tao_any," << be_nl
+ << "const " << node->name () << " *&_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return" << be_idt_nl
+ << "TAO::Any_Dual_Impl_T<" << node->name () << ">::extract ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}";
+
+ *os << be_global->core_versioning_end () << 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_union::visit_union - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ node->cli_stub_any_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_union_any_op_cs::visit_union_branch (be_union_branch *node)
+{
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_any_op_cs::"
+ "visit_union_branch - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_any_op_cs::"
+ "visit_union_branch - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_any_op_cs::visit_enum (be_enum *node)
+{
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ be_visitor_enum_any_op_cs visitor (this->ctx_);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_any_op_cs::"
+ "visit_enum - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_any_op_cs::visit_structure (be_structure *node)
+{
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ be_visitor_structure_any_op_cs visitor (this->ctx_);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_any_op_cs::"
+ "visit_structure - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
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
new file mode 100644
index 00000000000..f55a5c83d83
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ch.cpp
@@ -0,0 +1,81 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for CDR operators for unions. This uses
+// compiled marshaling.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+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;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator<< (TAO_OutputCDR &, const " << node->name ()
+ << " &);" << be_nl;
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator>> (TAO_InputCDR &, "
+ << node->name () << " &);";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ // Set the substate as generating code for the types defined in our scope.
+ this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_SCOPE);
+
+ 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);
+ }
+
+ node->cli_hdr_cdr_op_gen (1);
+ return 0;
+}
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
new file mode 100644
index 00000000000..59a621cf4b2
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union/cdr_op_cs.cpp
@@ -0,0 +1,212 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for CDR operators for unions
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+be_visitor_union_cdr_op_cs::~be_visitor_union_cdr_op_cs (void)
+{
+}
+
+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;
+ }
+
+ // Set the substate as generating code for the types defined in our scope
+ this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_SCOPE);
+
+ 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);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << 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 operator<< (" << be_idt << be_idt_nl
+ << "TAO_OutputCDR &strm," << be_nl
+ << "const " << node->name () << " &_tao_union" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ switch (node->udisc_type ())
+ {
+ case AST_Expression::EV_bool:
+ *os << "::ACE_OutputCDR::from_boolean tmp (_tao_union._d ());" << be_nl
+ << "if ( !(strm << tmp) )" << be_idt_nl;
+
+ break;
+ case AST_Expression::EV_char:
+ *os << "::ACE_OutputCDR::from_char tmp (_tao_union._d ());" << be_nl
+ << "if ( !(strm << tmp) )" << be_idt_nl;
+
+ break;
+ case AST_Expression::EV_wchar:
+ *os << "::ACE_OutputCDR::from_wchar tmp (_tao_union._d ());" << be_nl
+ << "if ( !(strm << tmp) )" << be_idt_nl;
+
+ break;
+ default:
+ *os << "if ( !(strm << _tao_union._d ()) )" << be_idt_nl;
+
+ break;
+ }
+
+ *os << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "::CORBA::Boolean result = true;" << be_nl << be_nl
+ << "switch (_tao_union._d ())" << be_nl
+ << "{" << be_idt;
+
+ 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);
+ }
+
+ // 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->gen_empty_default_label ())
+ {
+ *os << be_nl << "default:" << be_idt_nl;
+ *os << "break;"<< be_uidt;
+ }
+
+ *os << be_uidt_nl << "}" << be_nl << be_nl
+ << "return result;" << 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 operator>> (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &strm," << be_nl
+ << node->name () << " &_tao_union" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ be_type* disc_type =
+ be_type::narrow_from_decl (node->disc_type ());
+
+ // Generate a temporary to store the discriminant
+ *os << disc_type->full_name ()
+ << " " << "_tao_discriminant;" << be_nl;
+
+ switch (node->udisc_type ())
+ {
+ case AST_Expression::EV_bool:
+ *os << "::ACE_InputCDR::to_boolean tmp (_tao_discriminant);" << be_nl
+ << "if ( !(strm >> tmp) )" << be_idt_nl;
+
+ break;
+ case AST_Expression::EV_char:
+ *os << "::ACE_InputCDR::to_char tmp (_tao_discriminant);" << be_nl
+ << "if ( !(strm >> tmp) )" << be_idt_nl;
+
+ break;
+ case AST_Expression::EV_wchar:
+ *os << "::ACE_InputCDR::to_wchar tmp (_tao_discriminant);" << be_nl
+ << "if ( !(strm >> tmp) )" << be_idt_nl;
+
+ break;
+ default:
+ *os << "if ( !(strm >> _tao_discriminant) )" << be_idt_nl;
+
+ break;
+ }
+
+ *os << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "::CORBA::Boolean result = true;" << be_nl << be_nl
+ << "switch (_tao_discriminant)" << be_nl
+ << "{" << be_idt;
+
+ 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);
+ }
+
+ // 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->gen_empty_default_label ())
+ {
+ *os << be_nl;
+ *os << "default:" << be_idt_nl;
+ *os << "_tao_union._d (_tao_discriminant);" << be_nl;
+ *os << "break;" << be_uidt;
+ }
+
+ *os << be_uidt_nl
+ << "}" << be_nl << be_nl
+ << "return result;" << be_uidt_nl
+ << "}";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ node->cli_stub_cdr_op_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_union/discriminant_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union/discriminant_ch.cpp
new file mode 100644
index 00000000000..124845ab053
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union/discriminant_ch.cpp
@@ -0,0 +1,144 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// discriminant_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for discriminant of the Union
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union,
+ discriminant_ch,
+ "$Id$")
+
+// *************************************************************************
+// Visitor for discriminant in client header file.
+// *************************************************************************
+
+be_visitor_union_discriminant_ch::be_visitor_union_discriminant_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_union_discriminant_ch::~be_visitor_union_discriminant_ch (void)
+{
+}
+
+int
+be_visitor_union_discriminant_ch::visit_enum (be_enum *node)
+{
+ // Get the enclosing union backend.
+ be_union *bu = 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 ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Not a typedef and 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.
+ be_visitor_enum_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_discriminant_ch::"
+ "visit_enum - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // The set method.
+ *os << be_nl << be_nl
+ << "void _d (" << bt->nested_type_name (bu) << ");" << be_nl;
+ // The get method.
+ *os << bt->nested_type_name (bu) << " _d (void) const;";
+
+ return 0;
+}
+
+int
+be_visitor_union_discriminant_ch::visit_predefined_type (be_predefined_type
+ *node)
+{
+ // get the enclosing union backend.
+ be_union *bu = 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 ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // The set method.
+ *os << be_nl << be_nl
+ << "void _d ( ::" << bt->nested_type_name (bu) << ");" << be_nl;
+ // The get method.
+ *os << "::" << bt->nested_type_name (bu) << " _d (void) const;";
+
+ return 0;
+}
+
+int
+be_visitor_union_discriminant_ch::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_union_discriminant_ch::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp b/TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp
new file mode 100644
index 00000000000..2d3c9e0f119
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp
@@ -0,0 +1,264 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// discriminant_ci.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for discriminant of the union.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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_decl (ctx)
+{
+}
+
+be_visitor_union_discriminant_ci::~be_visitor_union_discriminant_ci (void)
+{
+}
+
+int
+be_visitor_union_discriminant_ci::visit_enum (be_enum *node)
+{
+ be_union *bu =
+ this->ctx_->be_node_as_union ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ 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,
+ "(%N:%l) be_visitor_union_discriminant_ci::"
+ "visit_enum - "
+ "computing default value failed\n"),
+ -1);
+ }
+
+ *os << be_nl << be_nl << "// 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 << "ACE_INLINE" << be_nl
+ << "void " << be_nl
+ << bu->name () << "::_default ()" << be_nl
+ << "{" << be_idt_nl
+ << "this->_reset ();" << be_nl
+ << "this->disc_ = ";
+
+ be_type* dt =
+ be_type::narrow_from_decl (bu->disc_type ());
+
+ if (dt == 0)
+ {
+ 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);
+ return 0;
+ }
+
+ // The function value_to_name() takes care of adding
+ // any necessary scoping to the output.
+ *os << node->value_to_name (dv.u.enum_val);
+ *os << ";" << be_uidt_nl << "}" << be_nl << be_nl;
+ }
+
+ // the set method
+ *os << "// Accessor to set the discriminant." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << bu->name () << "::_d (" << bt->name ()
+ << " discval)" << be_nl
+ << "{" << be_idt_nl
+ << "this->disc_ = discval;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // the get method
+ *os << "// Accessor to get the discriminant." << be_nl
+ << "ACE_INLINE" << be_nl
+ << bt->name () << be_nl
+ << bu->name () << "::_d (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->disc_;" << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+int
+be_visitor_union_discriminant_ci::visit_predefined_type (
+ be_predefined_type *node
+ )
+{
+ be_union *bu =
+ this->ctx_->be_node_as_union ();
+
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ 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,
+ "(%N:%l) be_visitor_union_discriminant_ci::"
+ "visit_enum - "
+ "computing default value failed\n"),
+ -1);
+ }
+
+ *os << be_nl << be_nl << "// 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 << "ACE_INLINE" << be_nl
+ << "void " << be_nl
+ << bu->name () << "::_default ()" << be_nl
+ << "{" << be_idt_nl
+ << "this->_reset ();" << be_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);
+ break;
+ case AST_Expression::EV_wchar:
+ os->print ("L'\\%d'", dv.u.wchar_val);
+ break;
+ case AST_Expression::EV_bool:
+ *os << (dv.u.bool_val == 0 ? "false" : "true");
+
+ break;
+ case AST_Expression::EV_longlong:
+ case AST_Expression::EV_ulonglong:
+ // Unimplemented.
+ default:
+ // 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 << "}";
+ }
+
+ // The set method.
+ *os << be_nl << be_nl
+ << "// Accessor to set the discriminant." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << bu->name () << "::_d ( ::" << bt->name ()
+ << " discval)" << be_nl
+ << "{" << be_idt_nl
+ << "this->disc_ = discval;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // The get method.
+ *os << "// Accessor to get the discriminant." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "::" << bt->name () << be_nl
+ << bu->name () << "::_d (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->disc_;" << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+int
+be_visitor_union_discriminant_ci::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_union_discriminant_ci::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_union/discriminant_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union/discriminant_cs.cpp
new file mode 100644
index 00000000000..e49c96162e9
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union/discriminant_cs.cpp
@@ -0,0 +1,78 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// discriminant_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for discriminant of the union
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union,
+ discriminant_cs,
+ "$Id$")
+
+// *************************************************************************
+// Visitor for discriminant in client stubs.
+// *************************************************************************
+
+be_visitor_union_discriminant_cs::be_visitor_union_discriminant_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_union_discriminant_cs::~be_visitor_union_discriminant_cs (void)
+{
+}
+
+int
+be_visitor_union_discriminant_cs::visit_enum (be_enum *node)
+{
+ be_union *bu =
+ this->ctx_->be_node_as_union (); // get the enclosing union backend
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = 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);
+
+ // generate the typecode for the enum
+ 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);
+ }
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_union/serializer_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union/serializer_op_ch.cpp
new file mode 100644
index 00000000000..4fcef2945ff
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union/serializer_op_ch.cpp
@@ -0,0 +1,92 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for TAO::DCPS::Serializer operators for unions.
+// This uses compiled marshaling.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union,
+ serializer_op_ch,
+ "$Id$")
+
+// ***************************************************************************
+// Union visitor for generating Serializer operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_union_serializer_op_ch::be_visitor_union_serializer_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_union (ctx)
+{
+}
+
+be_visitor_union_serializer_op_ch::~be_visitor_union_serializer_op_ch (void)
+{
+}
+
+int
+be_visitor_union_serializer_op_ch::visit_union (be_union *node)
+{
+ if (node->cli_hdr_serializer_op_gen ()
+ || node->imported ()
+ || node->is_local ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ //- _dcps_max_marshaled_size(type) method
+ *os << be_global->stub_export_macro ()
+ << " size_t _dcps_max_marshaled_size (const "
+ << node->name() << "& _tao_union);" << be_nl;
+ //- _tao_is_bounded_size(type) method
+ *os << be_global->stub_export_macro ()
+ << " ::CORBA::Boolean _tao_is_bounded_size (const "
+ << node->name() << "& _tao_union);" << be_nl;
+ //- _dcps_find_size(type) method
+ *os << be_global->stub_export_macro ()
+ << " size_t _dcps_find_size (const "
+ << node->name() << "& _tao_union);" << be_nl;
+
+
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator<< (TAO::DCPS::Serializer &, const " << node->name ()
+ << " &);" << be_nl;
+ *os << be_global->stub_export_macro () << " ::CORBA::Boolean"
+ << " operator>> (TAO::DCPS::Serializer &, "
+ << node->name () << " &);";
+
+
+ // Set the substate as generating code for the types defined in our scope.
+ this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_SCOPE);
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_serializer_op_ch::"
+ "visit_union - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ node->cli_hdr_serializer_op_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_union/serializer_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union/serializer_op_cs.cpp
new file mode 100644
index 00000000000..9befe5a698c
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union/serializer_op_cs.cpp
@@ -0,0 +1,468 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for TAO::DCPS::Serializer operators for unions
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union,
+ serializer_op_cs,
+ "$Id$")
+
+// ***************************************************************************
+// Union visitor for generating Serializer operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_union_serializer_op_cs::be_visitor_union_serializer_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_union (ctx)
+{
+}
+
+be_visitor_union_serializer_op_cs::~be_visitor_union_serializer_op_cs (void)
+{
+}
+
+int
+be_visitor_union_serializer_op_cs::visit_union (be_union *node)
+{
+ // already generated and/or we are imported. Don't do anything.
+ if (node->cli_stub_serializer_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);
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_serializer_op_cs"
+ "::visit_union - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ //---------------------------------------------------------------
+ // Set the sub state as generating code for _dcps_max_marshaled_size.
+ this->ctx_->sub_state(TAO_CodeGen::TAO_MAX_MARSHALED_SIZE);
+
+ *os << "size_t _dcps_max_marshaled_size (" << be_idt << be_idt_nl
+ << "const " << node->name () << " &" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ ;
+ *os << "// do not try getting the _dcps_max_marshaled_size" << be_nl
+ << "// doing so may produce an access violation" << be_nl
+ << "return 100000;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+/*
+ << "size_t max_size = 0;" << be_nl << be_nl;
+
+ *os << "// find the maximum field size." << be_nl;
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_serializer_op_cs::"
+ "visit_union - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ *os << be_nl << "// now add in the size of the discriminant" << be_nl;
+ switch (node->udisc_type ())
+ {
+ case AST_Expression::EV_bool:
+ *os << "max_size += _dcps_max_marshaled_size ("
+ << "ACE_OutputCDR::from_boolean (_tao_union._d ()));" << be_nl;
+ break;
+ case AST_Expression::EV_char:
+ *os << "max_size += _dcps_max_marshaled_size ("
+ << "ACE_OutputCDR::from_char (_tao_union._d ()));" << be_nl;
+
+ break;
+ case AST_Expression::EV_wchar:
+ *os << "max_size += _dcps_max_marshaled_size ("
+ << "ACE_OutputCDR::from_wchar (_tao_union._d ()));" << be_nl;
+
+ break;
+ default:
+ // no need to cast the other dicriminant types
+ *os << "max_size += _dcps_max_marshaled_size ("
+ << "_tao_union._d ());" << be_nl;
+
+ break;
+ }
+
+ *os << be_nl
+ << "return max_size;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+*/
+
+ //---------------------------------------------------------------
+ // Set the sub state as generating code for _tao_is_bounded_size.
+ this->ctx_->sub_state(TAO_CodeGen::TAO_IS_BOUNDED_SIZE);
+ *os << "::CORBA::Boolean _tao_is_bounded_size (" << be_idt << be_idt_nl
+ << "const " << node->name () << " &" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ ;
+ *os << "// Always return false for a union because " << be_nl
+ << "// _dcps_max_marshaled_size may produce an access violation."
+ << be_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+/*
+ << "CORBA::Boolean is_bounded = true;"
+ << " // all discrimenent types are bounded" << be_nl << be_nl;
+
+ *os << "// bounded if all branches are bounded." << be_nl;
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_serializer_op_cs::"
+ "visit_union - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ *os << be_nl
+ << "return is_bounded;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+*/
+
+ //---------------------------------------------------------------
+ // Set the sub state as generating code for _dcps_find_size.
+ this->ctx_->sub_state(TAO_CodeGen::TAO_FIND_SIZE);
+ *os << be_global->stub_export_macro ()
+ << " size_t _dcps_find_size (const "
+ << node->name() << "& _tao_union);" << be_nl;
+
+ *os << "size_t _dcps_find_size (" << be_idt << be_idt_nl
+ << "const " << node->name () << " &_tao_union" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "// all union discriminents are fixed size"
+ << "so OK to use _dcps_max_marshaled_size" << be_nl
+ << "size_t result = ";
+
+ switch (node->udisc_type ())
+ {
+ case AST_Expression::EV_bool:
+ *os << "_dcps_max_marshaled_size (::ACE_OutputCDR::from_boolean (_tao_union._d ()));" << be_nl;
+ break;
+ case AST_Expression::EV_char:
+ *os << "_dcps_max_marshaled_size (::ACE_OutputCDR::from_char (_tao_union._d ()));" << be_nl;
+ break;
+ case AST_Expression::EV_wchar:
+ *os << "_dcps_max_marshaled_size (::ACE_OutputCDR::from_wchar (_tao_union._d ()));" << be_nl;
+ break;
+ default:
+ *os << "_dcps_max_marshaled_size (_tao_union._d ());" << be_nl;
+ break;
+ }
+
+ *os << be_nl
+ << "switch (_tao_union._d ())" << be_nl
+ << "{" << be_idt;
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_serializer_op_cs::"
+ "visit_union - "
+ "codegen for scope 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->gen_empty_default_label ())
+ {
+ *os << be_nl << "default:" << be_idt_nl;
+ *os << "break;"<< be_uidt;
+ }
+
+ *os << be_uidt << be_uidt_nl << "}" << be_nl << be_nl
+ << "return result;" << be_uidt_nl
+ << "}" << 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 operator<< (" << be_idt << be_idt_nl
+ << "TAO::DCPS::Serializer &strm," << be_nl
+ << "const " << node->name () << " &_tao_union" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ switch (node->udisc_type ())
+ {
+ case AST_Expression::EV_bool:
+ *os << "::ACE_OutputCDR::from_boolean tmp (_tao_union._d ());" << be_nl
+ << "if ( !(strm << tmp) )" << be_idt_nl;
+
+ break;
+ case AST_Expression::EV_char:
+ *os << "::ACE_OutputCDR::from_char tmp (_tao_union._d ());" << be_nl
+ << "if ( !(strm << tmp) )" << be_idt_nl;
+
+ break;
+ case AST_Expression::EV_wchar:
+ *os << "::ACE_OutputCDR::from_wchar tmp (_tao_union._d ());" << be_nl
+ << "if ( !(strm << tmp) )" << be_idt_nl;
+
+ break;
+ default:
+ *os << "if ( !(strm << _tao_union._d ()) )" << be_idt_nl;
+
+ break;
+ }
+
+ *os << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "::CORBA::Boolean result = 1;" << be_nl << be_nl
+ << "switch (_tao_union._d ())" << be_nl
+ << "{" << be_idt;
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_serializer_op_cs::"
+ "visit_union - "
+ "codegen for scope 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->gen_empty_default_label ())
+ {
+ *os << be_nl << "default:" << be_idt_nl;
+ *os << "break;"<< be_uidt;
+ }
+
+ *os << be_uidt_nl << "}" << be_nl << be_nl
+ << "return result;" << 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 operator>> (" << be_idt << be_idt_nl
+ << "TAO::DCPS::Serializer &strm," << be_nl
+ << node->name () << " &_tao_union" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ be_type* disc_type =
+ be_type::narrow_from_decl (node->disc_type ());
+
+ // Generate a temporary to store the discriminant
+ *os << disc_type->full_name ()
+ << " " << "_tao_discriminant;" << be_nl;
+
+ switch (node->udisc_type ())
+ {
+ case AST_Expression::EV_bool:
+ *os << "::ACE_InputCDR::to_boolean tmp (_tao_discriminant);" << be_nl
+ << "if ( !(strm >> tmp) )" << be_idt_nl;
+
+ break;
+ case AST_Expression::EV_char:
+ *os << "::ACE_InputCDR::to_char tmp (_tao_discriminant);" << be_nl
+ << "if ( !(strm >> tmp) )" << be_idt_nl;
+
+ break;
+ case AST_Expression::EV_wchar:
+ *os << "::ACE_InputCDR::to_wchar tmp (_tao_discriminant);" << be_nl
+ << "if ( !(strm >> tmp) )" << be_idt_nl;
+
+ break;
+ default:
+ *os << "if ( !(strm >> _tao_discriminant) )" << be_idt_nl;
+
+ break;
+ }
+
+ *os << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "::CORBA::Boolean result = 1;" << be_nl << be_nl
+ << "switch (_tao_discriminant)" << be_nl
+ << "{" << be_idt;
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_serializer_op_cs::"
+ "visit_union - "
+ "codegen for scope 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->gen_empty_default_label ())
+ {
+ *os << be_nl;
+ *os << "default:" << be_idt_nl;
+ *os << "_tao_union._d (_tao_discriminant);" << be_nl;
+ *os << "break;" << be_uidt;
+ }
+
+ *os << be_uidt_nl
+ << "}" << be_nl << be_nl
+ << "return result;" << be_uidt_nl
+ << "}";
+
+ node->cli_stub_serializer_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_union_serializer_op_cs::pre_process (be_decl *bd)
+{
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ case TAO_CodeGen::TAO_IS_BOUNDED_SIZE:
+ return 0;
+ break;
+
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ {
+ // 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 =
+ be_union_branch::narrow_from_decl (bd);
+
+ *os << be_nl;
+
+ for (unsigned long i = 0; i < b->label_list_length (); ++i)
+ {
+ // check if we are printing the default case
+ if (b->label (i)->label_kind () == AST_UnionLabel::UL_default)
+ {
+ *os << "default:";
+ }
+ else
+ {
+ *os << "case ";
+
+ b->gen_label_value (os, i);
+
+ *os << ":";
+ }
+
+ if (i == (b->label_list_length () - 1))
+ {
+ *os << be_idt_nl;
+ }
+ else
+ {
+ *os << be_nl;
+ }
+ }
+
+ *os << "{" << be_idt_nl;
+ }
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_serializer_op_cs::"
+ "pre_process - "
+ "bad sub_state.\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_serializer_op_cs::post_process (be_decl *bd)
+{
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ case TAO_CodeGen::TAO_IS_BOUNDED_SIZE:
+ return 0;
+ break;
+
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ {
+
+ if (bd->node_type () == AST_Decl::NT_enum_val)
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_uidt_nl << "}" << be_nl
+ << "break;" << be_uidt;
+
+ }
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_serializer_op_cs::"
+ "pre_process - "
+ "bad sub_state.\n"),
+ -1);
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_union/union.cpp b/TAO/TAO_IDL/be/be_visitor_union/union.cpp
new file mode 100644
index 00000000000..30868bae313
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union/union.cpp
@@ -0,0 +1,206 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// union.cpp
+//
+// = DESCRIPTION
+// Generic visitor generating code for Unions
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union,
+ union,
+ "$Id$")
+
+be_visitor_union::be_visitor_union (be_visitor_context *ctx)
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_union::~be_visitor_union (void)
+{
+}
+
+int
+be_visitor_union::visit_union (be_union *)
+{
+ return -1; // Must be overriden.
+}
+
+int
+be_visitor_union::visit_union_branch (be_union_branch *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case 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:
+ {
+ be_visitor_union_branch_private_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_union_branch_public_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case 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:
+ {
+ be_visitor_union_branch_public_assign_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case 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_ROOT_CDR_OP_CH:
+ {
+ be_visitor_union_branch_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_union_branch_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH:
+ {
+ be_visitor_union_branch_serializer_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS:
+ {
+ be_visitor_union_branch_serializer_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);
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union::"
+ "visit_union_branch - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_cdr_op_cs::pre_process (be_decl *bd)
+{
+ if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_SCOPE)
+ {
+ 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 =
+ be_union_branch::narrow_from_decl (bd);
+
+ *os << be_nl;
+
+ for (unsigned long i = 0; i < b->label_list_length (); ++i)
+ {
+ // check if we are printing the default case
+ if (b->label (i)->label_kind () == AST_UnionLabel::UL_default)
+ {
+ *os << "default:";
+ }
+ else
+ {
+ *os << "case ";
+
+ b->gen_label_value (os, i);
+
+ *os << ":";
+ }
+
+ if (i == (b->label_list_length () - 1))
+ {
+ *os << be_idt_nl;
+ }
+ else
+ {
+ *os << be_nl;
+ }
+ }
+
+ *os << "{" << be_idt_nl;
+
+ return 0;
+}
+
+int
+be_visitor_union_cdr_op_cs::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
+ << "break;" << be_uidt;
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp
new file mode 100644
index 00000000000..c108d763bd5
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp
@@ -0,0 +1,209 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// union_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Unions in the client header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union,
+ union_ch,
+ "$Id$")
+
+// ******************************************************
+// For client header.
+// ******************************************************
+
+be_visitor_union_ch::be_visitor_union_ch (be_visitor_context *ctx)
+ : be_visitor_union (ctx)
+{
+}
+
+be_visitor_union_ch::~be_visitor_union_ch (void)
+{
+}
+
+int be_visitor_union_ch::visit_union (be_union *node)
+{
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ // Evaluate the member in time for the decision to generate
+ // the recursive typecode include in the stub source file.
+ ACE_Unbounded_Queue<AST_Type *> list;
+ (void) node->in_recursion (list);
+
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Generate _var and _out class typedefs.
+ node->gen_common_varout (os);
+
+ // Generate the ifdefined macro for the union type.
+ os->gen_ifdef_macro (node->flat_name ());
+
+ *os << be_nl << be_nl
+ << "class " << be_global->stub_export_macro () << " "
+ << node->local_name () << be_nl
+ << "{" << be_nl
+ << "public:" << be_idt_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;
+
+ if (be_global->any_support ())
+ {
+ *os << "static void _tao_any_destructor (void*);"
+ << be_nl << be_nl;
+ }
+
+ // Generate assignment operator.
+ *os << node->local_name () << " &operator= (const "
+ << node->local_name () << " &);";
+
+ // Retrieve the disriminant type.
+ be_type *bt = be_type::narrow_from_decl (node->disc_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_ch::"
+ "visit_union - "
+ "bad disciminant type\n"),
+ -1);
+ }
+
+ // The discriminant type may have to be defined here if it was an enum
+ // declaration inside of the union statement.
+
+ be_visitor_union_discriminant_ch ud_visitor (&ctx);
+
+ 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);
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Generate the typedefs.
+ *os << be_nl << be_nl
+ << "typedef " << node->local_name () << "_var _var_type;"
+ << be_nl
+ << "typedef " << node->local_name () << "_out _out_type;";
+
+ // 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);
+
+ 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 check if we need to generate the _default () method.
+ be_union::DefaultValue dv;
+
+ 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);
+ }
+
+ if ((dv.computed_ != 0) && (node->default_index () == -1))
+ {
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Only if all cases are not covered AND there is no explicit
+ // default, we get the _default () method.
+ *os << be_nl << be_nl
+ << "void _default (void);";
+ }
+
+ *os << be_uidt_nl;
+
+ // 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.
+
+ // The members are inside of a union.
+ *os << "union" << be_nl;
+ *os << "{" << be_idt;
+
+ this->ctx_->state (TAO_CodeGen::TAO_UNION_PRIVATE_CH);
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_ch::"
+ "visit_union - "
+ "codegen for private members of union\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl;
+ *os << "} u_;";
+
+ // The reset method (TAO extension).
+ *os << be_nl << be_nl
+ << "/// TAO extension - frees any allocated storage." << be_nl;
+ *os << "void _reset (void);";
+
+ *os << be_uidt_nl << "};";
+
+ if (be_global->tc_support ())
+ {
+ ctx = *this->ctx_;
+ be_visitor_typecode_decl tc_visitor (&ctx);
+
+ if (node->accept (&tc_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_ch::"
+ "visit_union - "
+ "TypeCode declaration failed\n"),
+ -1);
+ }
+ }
+
+ os->gen_endif ();
+
+ node->cli_hdr_gen (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_union/union_ci.cpp b/TAO/TAO_IDL/be/be_visitor_union/union_ci.cpp
new file mode 100644
index 00000000000..e0d5784c355
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union/union_ci.cpp
@@ -0,0 +1,96 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// union_ci.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Union in the client inline file
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union,
+ union_ci,
+ "$Id$")
+
+// ******************************************************
+// For client inline.
+// ******************************************************
+
+be_visitor_union_ci::be_visitor_union_ci (be_visitor_context *ctx)
+ : be_visitor_union (ctx)
+{
+}
+
+be_visitor_union_ci::~be_visitor_union_ci (void)
+{
+}
+
+int be_visitor_union_ci::visit_union (be_union *node)
+{
+ if (node->cli_inline_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// *************************************************************"
+ << be_nl;
+ *os << "// Inline operations for union " << node->name () << be_nl;
+ *os << "// *************************************************************";
+
+ // the discriminant type may have to be defined here if it was an enum
+ // declaration inside of the union statement.
+
+ 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);
+ }
+
+ 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);
+ }
+
+ // Now generate the implementation of the access methods for the
+ // union. For this set our state.
+ 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);
+ }
+
+ node->cli_inline_gen (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp
new file mode 100644
index 00000000000..3405d6c8fb9
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp
@@ -0,0 +1,301 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// union_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Unions in the client stubs
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union,
+ union_cs,
+ "$Id$")
+
+// ******************************************************
+// For client stubs.
+// ******************************************************
+
+be_visitor_union_cs::be_visitor_union_cs (be_visitor_context *ctx)
+ : be_visitor_union (ctx)
+{
+}
+
+be_visitor_union_cs::~be_visitor_union_cs (void)
+{
+}
+
+// Visit the Union_cs node and its scope.
+int be_visitor_union_cs::visit_union (be_union *node)
+{
+ if (node->cli_stub_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *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.
+
+ be_type *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);
+ }
+
+ be_visitor_union_discriminant_cs disc_visitor (&ctx);
+
+ 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);
+ }
+
+ // 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);
+
+ 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 << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Generate the copy constructor and the assignment operator here.
+ *os << be_nl << be_nl
+ << node->name () << "::" << node->local_name () << " (void)" << be_nl
+ << "{" << be_idt_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 ();
+
+ ub = be_union_branch::narrow_from_decl (d);
+ si.next ();
+ }
+
+ // Get the first label in its list.
+ AST_UnionLabel *ul = ub->label (0);
+ AST_Union::DefaultValue dv;
+
+ // This can indicate an error in the return value, but it is
+ // caught elsewhere.
+ (void) node->default_value (dv);
+
+ bool test = dv.computed_ == 0
+ && ul->label_kind () == AST_UnionLabel::UL_label;
+
+ if (test)
+ {
+ ub->gen_label_value (os);
+ }
+ else
+ {
+ ub->gen_default_label_value (os, node);
+ }
+
+ *os << ";";
+
+ *os << be_uidt_nl << "}" << be_nl << be_nl;
+
+ 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);
+
+ *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;
+
+ 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->gen_empty_default_label ())
+ {
+ *os << be_nl
+ << "default:" << be_nl
+ << "break;";
+ }
+
+ *os << be_uidt_nl << "}" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << node->name () << "::~" << node->local_name ()
+ << " (void)" << be_nl
+ << "{" << be_idt_nl
+ << "// Finalize." << be_nl
+ << "this->_reset ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ if (be_global->any_support ())
+ {
+ *os << "void "
+ << node->name ()
+ << "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
+ << "{" << be_idt_nl
+ << node->local_name () << " *tmp =" << be_idt_nl
+ << "static_cast<"
+ << node->local_name () << " *> (_tao_void_pointer);" << be_uidt_nl
+ << "delete tmp;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+
+ 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 << 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 ();" << 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;
+
+ 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);
+ }
+
+ // 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->gen_empty_default_label ())
+ {
+ *os << be_nl
+ << "default:" << be_nl
+ << "break;";
+ }
+
+ *os << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ *os << "return *this;" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+
+ // The reset method.
+ this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_RESET_CS);
+
+ *os << "/// Reset method to reset old values of a union." << be_nl;
+ *os << "void " << node->name () << "::_reset (void)" << 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->gen_empty_default_label ())
+ {
+ *os << be_nl
+ << "default:" << be_nl
+ << "break;";
+ }
+
+ *os << be_uidt_nl << "}" << be_uidt_nl
+ << "}";
+
+ if (be_global->tc_support ())
+ {
+ ctx = *this->ctx_;
+ // ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
+ TAO::be_visitor_union_typecode 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);
+ }
+ }
+
+ node->cli_stub_gen (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
new file mode 100644
index 00000000000..80aedbb4775
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch.cpp
@@ -0,0 +1,61 @@
+//
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_union_branch.cpp
+//
+// = DESCRIPTION
+// Concrete visitor for the base "BE_Union_Branch" node
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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_valuebox.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_helper.h"
+#include "ast_union_label.h"
+#include "utl_identifier.h"
+#include "nr_extern.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 "ace/Log_Msg.h"
+
+#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_ch.cpp"
+#include "be_visitor_union_branch/public_ci.cpp"
+#include "be_visitor_union_branch/public_cs.cpp"
+#include "be_visitor_union_branch/cdr_op_ch.cpp"
+#include "be_visitor_union_branch/cdr_op_cs.cpp"
+#include "be_visitor_union_branch/serializer_op_ch.cpp"
+#include "be_visitor_union_branch/serializer_op_cs.cpp"
+
+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
new file mode 100644
index 00000000000..6e6507eebe3
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ch.cpp
@@ -0,0 +1,214 @@
+
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating CDR operator declarator for union_branch in the client header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union_branch,
+ cdr_op_ch,
+ "$Id$")
+
+// **********************************************
+// Visitor for union_branch in the client header file.
+// **********************************************
+
+be_visitor_union_branch_cdr_op_ch::be_visitor_union_branch_cdr_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_union_branch_cdr_op_ch::~be_visitor_union_branch_cdr_op_ch (void)
+{
+}
+
+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);
+ }
+
+ 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);
+ }
+
+ return 0;
+}
+
+// Visit operations on all possible data types that a union_branch can be.
+
+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 (!this->ctx_->alias ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ // This is the case for anonymous arrays.
+
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+
+ 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);
+ }
+ }
+
+ return 0;
+}
+
+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 ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+
+ 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);
+ }
+ }
+
+ return 0;
+}
+
+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 ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
+
+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 ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_cdr_op_ch::visit_typedef (be_typedef *node)
+{
+ 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_cdr_op_ch::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+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 ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
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
new file mode 100644
index 00000000000..dd2990bacba
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_cs.cpp
@@ -0,0 +1,1005 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// union_branch_cdr_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Union_Branch in the client stubs file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union_branch,
+ cdr_op_cs,
+ "$Id$")
+
+// **********************************************
+// Visitor for union_branch in the client stubs file.
+// **********************************************
+
+be_visitor_union_branch_cdr_op_cs::be_visitor_union_branch_cdr_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_union_branch_cdr_op_cs::~be_visitor_union_branch_cdr_op_cs (void)
+{
+}
+
+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);
+ }
+
+ 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);
+ }
+
+ return 0;
+}
+
+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 (!this->ctx_->alias ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ 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_cs::"
+ "visit_array - "
+ "cannot retrieve union_branch node\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 (!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 underscore
+ // 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 (),
+ node->local_name ()->get_string ());
+ }
+ else
+ {
+ ACE_OS::sprintf (fname,
+ "_%s",
+ node->full_name ());
+ }
+ }
+ else
+ {
+ // Typedefed node.
+ ACE_OS::sprintf (fname, "%s", node->full_name ());
+ }
+
+ // 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 << fname << " _tao_union_tmp;" << be_nl
+ << fname << "_forany _tao_union_helper ("
+ << be_idt << be_idt_nl
+ << "_tao_union_tmp" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "result = strm >> _tao_union_helper;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name ()
+ << " (_tao_union_tmp);" << be_nl
+ << "_tao_union._d (_tao_discriminant);" << be_uidt_nl
+ << "}" << be_uidt;
+
+ return 0;
+
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << fname << "_forany _tao_union_tmp (" << be_idt << be_idt_nl
+ << "_tao_union."
+ << f->local_name () << " ()" << be_uidt_nl
+ <<");" << be_uidt_nl
+ << "result = strm << _tao_union_tmp;";
+ return 0;
+
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // This is done in cdr_op_cs.cpp and hacked into *.i.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_cdr_op_cs::"
+ "visit_array - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_cdr_op_cs::visit_enum (be_enum *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_cs::"
+ "visit_array - "
+ "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 () << " _tao_union_tmp =" << be_idt_nl
+ << "static_cast<" << node->name () << "> (0UL);" << be_uidt_nl
+ << "result = strm >> _tao_union_tmp;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name ()
+ << " (_tao_union_tmp);" << be_nl
+ << "_tao_union._d (_tao_discriminant);" << be_uidt_nl
+ << "}" << be_uidt;
+
+ return 0;
+
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "result = strm << _tao_union." << f->local_name () << " ();";
+ return 0;
+
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Proceed further.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_cdr_op_cs::"
+ "visit_enum - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ // Not a typedef and node is defined inside the union. Otherwise the cdr
+ // operator is generated elsewhere.
+ 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);
+ be_visitor_enum_cdr_op_cs visitor (&ctx);
+
+ if (visitor.visit_enum (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_cdr_op_cs::"
+ "visit_enum - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_cdr_op_cs::visit_interface (be_interface *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_cs::"
+ "visit_interface - "
+ "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:
+ if (node->is_local ())
+ {
+ *os << "result = false;";
+ }
+ else
+ {
+ *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 =" << be_idt_nl;
+
+ if (f->is_abstract ())
+ {
+ *os << "(strm << _tao_union."
+ << f->local_name () << " ());";
+ }
+ else
+ {
+ *os << "TAO::Objref_Traits<" << node->name () << ">::marshal ("
+ << be_idt << be_idt_nl
+ << "_tao_union." << f->local_name () << " ()," << be_nl
+ << "strm" << be_uidt_nl
+ << ");" << be_uidt;
+ }
+
+ *os << be_uidt;
+
+ 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_cs::"
+ "visit_interface - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_cdr_op_cs::visit_interface_fwd (be_interface_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_cs::"
+ "visit_interface_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:
+ if (node->is_local ())
+ {
+ *os << "result = false;";
+ }
+ else
+ {
+ *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 =" << be_idt_nl
+ << "TAO::Objref_Traits<" << node->name () << ">::marshal ("
+ << be_idt << be_idt_nl
+ << "_tao_union." << f->local_name () << " ()," << be_nl
+ << "strm" << be_uidt_nl
+ << ");" << be_uidt << be_uidt;
+ 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_cs::"
+ "visit_interface_fwd - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_cdr_op_cs::visit_valuebox (be_valuebox *node)
+{
+ return this->emit_valuetype_common (node);
+}
+
+int
+be_visitor_union_branch_cdr_op_cs::visit_valuetype (be_valuetype *node)
+{
+ return this->emit_valuetype_common (node);
+}
+
+int
+be_visitor_union_branch_cdr_op_cs::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ return this->emit_valuetype_common (node);
+}
+
+int
+be_visitor_union_branch_cdr_op_cs::emit_valuetype_common (be_type *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_cs::"
+ "emit_valuetype_common - "
+ "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_cs::"
+ "emit_valuetype_common - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_cdr_op_cs::visit_predefined_type (
+ be_predefined_type *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_cs::"
+ "visit_predefined_type - "
+ "cannot retrieve union_branch node\n"),
+ -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)
+ {
+ *os << "::CORBA::Object_var _tao_union_tmp;" << be_nl;
+
+ *os << "result = strm >> _tao_union_tmp.out ();" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name () << " (_tao_union_tmp.in ());";
+
+ }
+ else if (pt == AST_PredefinedType::PT_pseudo)
+ {
+ *os << "::CORBA::TypeCode_var _tao_union_tmp;" << be_nl
+ << "result = strm >> _tao_union_tmp.out ();" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name () << " (_tao_union_tmp.in ());";
+
+ }
+ else if (pt == AST_PredefinedType::PT_value)
+ {
+ *os << "::CORBA::ValueBase * _tao_union_tmp;" << be_nl
+ << "result = strm >> _tao_union_tmp;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name () << " (_tao_union_tmp);";
+
+ }
+ else if (pt == AST_PredefinedType::PT_char)
+ {
+ *os << "::CORBA::Char _tao_union_tmp;" << be_nl
+ << "::ACE_InputCDR::to_char _tao_union_helper "
+ << "(_tao_union_tmp);" << be_nl
+ << "result = strm >> _tao_union_helper;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name ()
+ << " (_tao_union_tmp);";
+ }
+ else if (pt == AST_PredefinedType::PT_wchar)
+ {
+ *os << "::CORBA::WChar _tao_union_tmp;" << be_nl
+ << "::ACE_InputCDR::to_wchar _tao_union_helper "
+ << "(_tao_union_tmp);" << be_nl
+ << "result = strm >> _tao_union_helper;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name ()
+ << " (_tao_union_tmp);";
+ }
+ else if (pt == AST_PredefinedType::PT_octet)
+ {
+ *os << "::CORBA::Octet _tao_union_tmp;" << be_nl
+ << "::ACE_InputCDR::to_octet _tao_union_helper "
+ << "(_tao_union_tmp);" << be_nl
+ << "result = strm >> _tao_union_helper;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name ()
+ << " (_tao_union_tmp);";
+ }
+ else if (pt == AST_PredefinedType::PT_boolean)
+ {
+ *os << "::CORBA::Boolean _tao_union_tmp;" << be_nl
+ << "::ACE_InputCDR::to_boolean _tao_union_helper "
+ << "(_tao_union_tmp);" << be_nl
+ << "result = strm >> _tao_union_helper;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name ()
+ << " (_tao_union_tmp);";
+ }
+ else
+ {
+ *os << node->name () << " _tao_union_tmp;" << be_nl
+ << "result = strm >> _tao_union_tmp;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name ()
+ << " (_tao_union_tmp);";
+ }
+
+ *os << be_nl;
+ *os << "_tao_union._d (_tao_discriminant);" << be_uidt_nl;
+ *os << "}" << be_uidt;
+
+ break;
+
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+
+ *os << "result = ";
+
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << "strm << _tao_union." << f->local_name () << " ();";
+ }
+ else if (pt == AST_PredefinedType::PT_char)
+ {
+ *os << "strm << ::ACE_OutputCDR::from_char (_tao_union."
+ << f->local_name () << " ());";
+ }
+ else if (pt == AST_PredefinedType::PT_wchar)
+ {
+ *os << "strm << ::ACE_OutputCDR::from_wchar (_tao_union."
+ << f->local_name () << " ());";
+ }
+ else if (pt == AST_PredefinedType::PT_octet)
+ {
+ *os << "strm << ::ACE_OutputCDR::from_octet (_tao_union."
+ << f->local_name () << " ());";
+ }
+ else if (pt == AST_PredefinedType::PT_boolean)
+ {
+ *os << "strm << ::ACE_OutputCDR::from_boolean (_tao_union."
+ << f->local_name () << " ());";
+ }
+ else
+ {
+ *os << "strm << _tao_union." << f->local_name () << " ();";
+ }
+
+ break;
+
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_cdr_op_cs::"
+ "visit_array - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_cdr_op_cs::visit_sequence (be_sequence *node)
+{
+ // If the sequence is defined in this scope, generate its CDR stream
+ // operators heree.
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ // Anonymous sequence
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ // Now generate the CDR stream operators for the sequence as a
+ // union branch.
+
+ 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_sequence - "
+ "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:
+ {
+ // If the typedef'd sequence is included from another
+ // file, node->name() won't work. The following works
+ // for all typedefs, external or not.
+ be_typedef *td = this->ctx_->alias ();
+
+ if (td)
+ {
+ *os << td->name ();
+ }
+ else
+ {
+ *os << node->name ();
+ }
+
+ *os << " _tao_union_tmp;" << be_nl
+ << "result = strm >> _tao_union_tmp;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union."
+ << f->local_name () << " (_tao_union_tmp);" << be_nl
+ << "_tao_union._d (_tao_discriminant);" << be_uidt_nl
+ << "}" << be_uidt;
+
+ return 0;
+ }
+
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "result = strm << _tao_union."
+ << f->local_name () << " ();";
+ return 0;
+
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Proceed further.
+ break;
+ default:
+ // Error
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_cdr_op_ci::"
+ "visit_sequence - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_cdr_op_cs::visit_string (be_string *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_string - "
+ "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:
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "::CORBA::String_var _tao_union_tmp;" << be_nl;
+ }
+ else
+ {
+ *os << "::CORBA::WString_var _tao_union_tmp;" << be_nl;
+ }
+
+ *os << "result = strm >> _tao_union_tmp.out ();" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union."
+ << f->local_name () << " (_tao_union_tmp);" << 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.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_cdr_op_ci::"
+ "visit_array - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_cdr_op_cs::visit_structure (be_structure *node)
+{
+ // If the structure is defined in this scope. generate its CDR
+ // stream operators here.
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ // How generate the CDR stream operators for the structure as
+ // a union branch.
+
+ 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_structure - "
+ "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 () << " _tao_union_tmp;" << be_nl
+ << "result = strm >> _tao_union_tmp;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name ()
+ << " (_tao_union_tmp);" << be_nl
+ << "_tao_union._d (_tao_discriminant);" << be_uidt_nl
+ << "}" << be_uidt;
+
+ return 0;
+
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "result = strm << _tao_union."
+ << f->local_name () << " ();";
+ return 0;
+
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Proceed further.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_cdr_op_ci::"
+ "visit_structure - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_cdr_op_cs::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_union_branch_public_ci::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_union_branch_cdr_op_cs::visit_union (be_union *node)
+{
+ // If the union is defined in this scope, generate its CDR
+ // stream operators here.
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ // Now generate the CDR stream operators for the union as
+ // a union branch.
+
+ 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_union - "
+ "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 () << " _tao_union_tmp"
+ << ";" << be_nl
+ << "result = strm >> _tao_union_tmp;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name ()
+ << " (_tao_union_tmp);" << be_nl
+ << "_tao_union._d (_tao_discriminant);" << be_uidt_nl
+ << "}" << be_uidt_nl;
+
+ return 0;
+
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "result = strm << _tao_union."
+ << f->local_name () << " ();";
+ return 0;
+
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Proceed further.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_cdr_op_ci::"
+ "visit_union - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_cdr_op_cs::explicit_default (void)
+{
+ be_union *bu = be_union::narrow_from_decl (this->ctx_->scope ());
+ int def_index = bu->default_index ();
+
+ if (def_index != -1)
+ {
+ be_union_branch *ub =
+ be_union_branch::narrow_from_decl (this->ctx_->node ());
+
+ int i = 0;
+
+ // Instantiate a scope iterator.
+ for (UTL_ScopeActiveIterator si (bu, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ be_union_branch *bub = 0; // union branch node
+
+ AST_Decl *d = si.item ();
+
+ if (!d->imported ())
+ {
+ bub = be_union_branch::narrow_from_decl (d);
+ }
+
+ if (bub == ub)
+ {
+ return (i == def_index);
+ }
+ else
+ {
+ ++i;
+ }
+ }
+ }
+
+ 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
new file mode 100644
index 00000000000..41b1fd747bb
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp
@@ -0,0 +1,608 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// private_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Union branch for the private part of the
+// class.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+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_decl (ctx)
+{
+}
+
+// Destructor.
+be_visitor_union_branch_private_ch::~be_visitor_union_branch_private_ch (void)
+{
+}
+
+// Visit the union_branch node.
+int
+be_visitor_union_branch_private_ch::visit_union_branch (be_union_branch *node)
+{
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_private_ch::"
+ "visit_union_branch - "
+ "Bad union_branch type\n"),
+ -1);
+ }
+
+ this->ctx_->node (node);
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_private_ch::"
+ "visit_union_branch - "
+ "codegen for union_branch type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_private_ch::visit_array (be_array *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_array - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl;
+
+ // Not a typedef and bt is defined inside the union.
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
+ {
+ // Case of anonymous array in union
+ *os << "_" << bt->local_name () << "_slice *" << ub->local_name ()
+ << "_;";
+ }
+ else
+ {
+ *os << bt->nested_type_name (bu, "_slice") << " *" << ub->local_name ()
+ << "_;";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_private_ch::visit_enum (be_enum *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_enum - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl;
+
+ *os << bt->nested_type_name (bu) << " " << ub->local_name ()
+ << "_;";
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_private_ch::visit_interface (be_interface *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 << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl;
+
+ *os << bt->nested_type_name (bu, "_var")
+ << " *" << ub->local_name () << "_;";
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_private_ch::visit_interface_fwd (be_interface_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);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl;
+
+ *os << bt->nested_type_name (bu, "_var")
+ << " *" << ub->local_name () << "_;";
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_private_ch::visit_valuebox (be_valuebox *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_valuebox - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl;
+
+ *os << bt->nested_type_name (bu, "_var")
+ << " *" << ub->local_name () << "_;";
+
+ 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 << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl;
+
+ *os << bt->nested_type_name (bu, "_var")
+ << " *" << ub->local_name () << "_;";
+
+ 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);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl;
+
+ *os << bt->nested_type_name (bu, "_var")
+ << " *" << ub->local_name () << "_;";
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_private_ch::visit_predefined_type (
+ be_predefined_type *node
+ )
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+ be_typedef *td = this->ctx_->alias ();
+
+ // Check if we are visiting this node via a visit to a typedef node
+ if (td != 0)
+ {
+ bt = td;
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_private_ch::"
+ "visit_predefined_type - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl
+ << (td == 0 ? "::" : "");
+
+ if (node->pt () == AST_PredefinedType::PT_object)
+ {
+ *os << bt->name () << "_var"
+ << " *" << ub->local_name () << "_;";
+ }
+ else if (node->pt () == AST_PredefinedType::PT_pseudo)
+ {
+ *os << bt->nested_type_name (bu, "_ptr")
+ << " " << ub->local_name () << "_;";
+ }
+ else if (node->pt () == AST_PredefinedType::PT_value)
+ {
+ *os << bt->nested_type_name (bu, " *")
+ << " " << ub->local_name () << "_;";
+ }
+ else if (node->pt () == AST_PredefinedType::PT_any)
+ {
+ // Cannot have an object inside of a union. In addition, an Any is a
+ // variable data type.
+ *os << bt->nested_type_name (bu) << " *" << ub->local_name ()
+ << "_;";
+ }
+ else
+ {
+ *os << bt->nested_type_name (bu) << " " << ub->local_name ()
+ << "_;";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_private_ch::visit_sequence (be_sequence *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_sequence - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl;
+
+ // C++ doesn't allow object instances inside unions, so we need a
+ // pointer.
+ *os << bt->nested_type_name (bu) << " *" << ub->local_name ()
+ << "_;";
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_private_ch::visit_string (be_string *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_private_ch::"
+ "visit_string - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl;
+
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "char *" << ub->local_name () << "_;";
+ }
+ else
+ {
+ *os << "::CORBA::WChar *" << ub->local_name () << "_;";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_private_ch::visit_structure (be_structure *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_structure - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl;
+
+ // If we are variable sized, we need a pointer type.
+ if (node->size_type () == AST_Type::VARIABLE
+ || node->has_constructor ())
+ {
+ *os << bt->nested_type_name (bu) << " *" << ub->local_name ()
+ << "_;";
+ }
+ else
+ {
+ *os << bt->nested_type_name (bu) << " " << ub->local_name ()
+ << "_;";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_private_ch::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_union_branch_private_ch::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_union_branch_private_ch::visit_union (be_union *node)
+{
+ 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_union - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl;
+
+ // C++ doesn't allow object instances inside unions, so we need a
+ // pointer.
+ *os << bt->nested_type_name (bu) << " *" << ub->local_name ()
+ << "_;";
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp
new file mode 100644
index 00000000000..202730f42c5
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp
@@ -0,0 +1,861 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// public_assign_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Union Branch for the assignment operator
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union_branch,
+ public_assign_cs,
+ "$Id$")
+
+// **********************************************
+// visitor for union_branch in the client stubs file generating the code for
+// the copy ctor and assignment operator
+// **********************************************
+
+// constructor
+be_visitor_union_branch_public_assign_cs::
+be_visitor_union_branch_public_assign_cs (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+// destructor
+be_visitor_union_branch_public_assign_cs::
+~be_visitor_union_branch_public_assign_cs (void)
+{
+}
+
+// visit the union_branch node
+int
+be_visitor_union_branch_public_assign_cs::visit_union_branch (
+ be_union_branch *node
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl;
+
+ // This visitor is used when we are generating the copy ctor and
+ // assignment operator for the union.
+ // Individual assignment of the members takes place inside a case
+ // statement because the type of member assigned is based on the value
+ // of the discriminant
+ 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:" << be_nl;
+ }
+ else
+ {
+ *os << "case ";
+ node->gen_label_value (os, i);
+ *os << ":" << be_nl;
+ }
+ }
+
+ *os << "{" << be_idt_nl;
+
+ // 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_union_branch_public_assign_cs::"
+ "visit_union_branch - "
+ "Bad union_branch type\n"
+ ), -1);
+ }
+
+ this->ctx_->node (node); // save the node
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_assign_cs::"
+ "visit_union_branch - "
+ "codegen for union_branch type failed\n"
+ ), -1);
+ }
+
+ *os << "}" << be_nl;
+ *os << "break;";
+
+ return 0;
+}
+
+// =visit operations on all possible data types that a union_branch can be
+
+int
+be_visitor_union_branch_public_assign_cs::visit_array (be_array *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_array - "
+ "bad context information\n"
+ ), -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // 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
+
+ // 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 ());
+ }
+
+ // set the discriminant to the appropriate label
+ *os << "// Make a deep copy." << be_nl;
+ *os << "this->u_." << ub->local_name ()
+ << "_ = " << be_idt_nl
+ << fname << "_dup (u.u_."
+ << ub->local_name () << "_);" << be_uidt << be_uidt_nl;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_assign_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_assign_cs::"
+ "visit_enum - "
+ "bad context information\n"
+ ), -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // set the discriminant to the appropriate label
+ // valid label
+ *os << "this->u_." << ub->local_name () << "_ = " << be_idt_nl
+ << "u.u_."
+ << ub->local_name () << "_;" << be_uidt << be_uidt_nl;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_assign_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_assign_cs::"
+ "visit_interface - "
+ "bad context information\n"
+ ), -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ 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;
+
+ 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;
+
+ if (bt_is_defined)
+ {
+ *os << "OBJECT_FIELD (" << be_idt << be_idt_nl
+ << bt->name () << "::_";
+ }
+ else
+ {
+ *os << "OBJECT_FIELD (" << be_idt << be_idt_nl
+ << "TAO::Objref_Traits<" << node->name () << ">::";
+ }
+
+ *os << "duplicate (" << be_idt << be_idt_nl
+ << "u.u_." << ub->local_name () << "_->in ()" << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl << ")" << be_uidt << 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;
+
+ if (bt_is_defined)
+ {
+ *os << "OBJECT_FIELD (" << be_idt << be_idt_nl
+ << bt->name () << "::_";
+ }
+ else
+ {
+ *os << "OBJECT_FIELD (" << be_idt << be_idt_nl
+ << "TAO::Objref_Traits<" << node->name () << ">::";
+ }
+
+ *os << "duplicate (" << be_idt << be_idt_nl
+ << "u.u_." << ub->local_name ()
+ << "_->in ()" << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl << ")," << be_uidt_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_interface_fwd (
+ be_interface_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_interface_fwd - "
+ "bad context information\n"
+ ), -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ 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;
+
+ if (bt_is_defined)
+ {
+ *os << "OBJECT_FIELD (" << be_idt << be_idt_nl
+ << bt->name () << "::_";
+ }
+ else
+ {
+ *os << "OBJECT_FIELD (" << be_idt << be_idt_nl
+ << "TAO::Objref_Traits<" << node->name () << ">::";
+ }
+
+ *os << "duplicate (" << be_idt << be_idt_nl
+ << "u.u_." << ub->local_name () << "_->in ()" << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl << ")" << be_uidt << 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;
+
+ if (bt_is_defined)
+ {
+ *os << "OBJECT_FIELD (" << be_idt << be_idt_nl
+ << bt->name () << "::_";
+ }
+ else
+ {
+ *os << "OBJECT_FIELD (" << be_idt << be_idt_nl
+ << "TAO::Objref_Traits<" << node->name () << ">::";
+ }
+
+ *os << "duplicate (" << be_idt << be_idt_nl
+ << "u.u_." << ub->local_name ()
+ << "_->in ()" << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl << ")," << be_uidt_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_valuebox (be_valuebox *node)
+{
+ return this->emit_valuetype_common (node);
+}
+
+int
+be_visitor_union_branch_public_assign_cs::visit_valuetype (be_valuetype *node)
+{
+ return this->emit_valuetype_common (node);
+}
+
+int
+be_visitor_union_branch_public_assign_cs::visit_valuetype_fwd (
+ be_valuetype_fwd *node
+ )
+{
+ return this->emit_valuetype_common (node);
+}
+
+int
+be_visitor_union_branch_public_assign_cs::emit_valuetype_common (be_type *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::"
+ "emit_valuetype_common - "
+ "bad context information\n"
+ ), -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *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 () << "_->in ())"
+ << 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 () << "_->in ()),"
+ << 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
+ )
+{
+ 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_predefined_type - "
+ "bad context information\n"
+ ), -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // set the discriminant to the appropriate label
+ switch (node->pt ())
+ {
+ 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)
+ {
+ // 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 ()
+ << "_->in ()))" << 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 ()
+ << "_->in ()))," << 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)
+ {
+ *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
+ << "ACE_NEW (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << bt->name () << " (*u.u_."
+ << ub->local_name () << "_)" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl;
+ }
+ else
+ {
+ *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
+ << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << bt->name () << " (*u.u_."
+ << ub->local_name () << "_)," << be_nl
+ << "*this" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl;
+ }
+
+ break;
+ case AST_PredefinedType::PT_void:
+ break;
+ default:
+ *os << "this->u_." << ub->local_name () << "_ = "
+ << "u.u_." << ub->local_name () << "_;" << be_uidt_nl;
+
+ break;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_assign_cs::visit_sequence (be_sequence *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_array - "
+ "bad context information\n"
+ ), -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (this->ctx_->sub_state () == TAO_CodeGen::TAO_UNION_COPY_CONSTRUCTOR)
+ {
+ *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
+ << "ACE_NEW (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << bt->name () << " (*u.u_."
+ << ub->local_name () << "_)" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl;
+ }
+ else
+ {
+ *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
+ << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << bt->name () << " (*u.u_."
+ << ub->local_name () << "_)," << be_nl
+ << "*this" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_assign_cs::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
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_assign_cs::"
+ "visit_array - "
+ "bad context information\n"
+ ), -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // set the discriminant to the appropriate label
+ *os << "this->u_." << ub->local_name () << "_ = ";
+
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "::CORBA::string_dup (u.u_.";
+ }
+ else
+ {
+ *os << "::CORBA::wstring_dup (u.u_.";
+ }
+
+ *os << ub->local_name () << "_);" << be_uidt_nl;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_assign_cs::visit_structure (be_structure *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_array - "
+ "bad context information\n"
+ ), -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (bt->size_type () == be_type::VARIABLE || node->has_constructor ())
+ {
+ if (this->ctx_->sub_state () == TAO_CodeGen::TAO_UNION_COPY_CONSTRUCTOR)
+ {
+ *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
+ << "ACE_NEW (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << bt->name () << " (*u.u_."
+ << ub->local_name () << "_)" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl;
+ }
+ else
+ {
+ *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
+ << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << bt->name () << " (*u.u_."
+ << ub->local_name () << "_)," << be_nl
+ << "*this" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl;
+ }
+ }
+ else
+ {
+ *os << "this->u_." << ub->local_name () << "_ = u.u_."
+ << ub->local_name () << "_;" << be_uidt_nl;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_assign_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_assign_cs::"
+ "visit_typedef - "
+ "Bad primitive type\n"
+ ), -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_assign_cs::visit_union (be_union *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_array - "
+ "bad context information\n"
+ ), -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (this->ctx_->sub_state () == TAO_CodeGen::TAO_UNION_COPY_CONSTRUCTOR)
+ {
+ *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
+ << "ACE_NEW (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << bt->name () << " (*u.u_."
+ << ub->local_name () << "_)" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl;
+ }
+ else
+ {
+ *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
+ << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << bt->name () << " (*u.u_."
+ << ub->local_name () << "_)," << be_nl
+ << "*this" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl;
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ch.cpp
new file mode 100644
index 00000000000..979a3c5f7c6
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ch.cpp
@@ -0,0 +1,763 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// public_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Union_branch in the public part.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union_branch,
+ public_ch,
+ "$Id$")
+
+// **********************************************
+// Visitor for union_branch in the client header file.
+// **********************************************
+
+be_visitor_union_branch_public_ch::be_visitor_union_branch_public_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_union_branch_public_ch::~be_visitor_union_branch_public_ch (void)
+{
+}
+
+int
+be_visitor_union_branch_public_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_public_ch::"
+ "visit_union_branch - "
+ "Bad union_branch type\n"
+ ),
+ -1);
+ }
+
+ this->ctx_->node (node);
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ch::"
+ "visit_union_branch - "
+ "codegen for union_branch type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+// Visit operations on all possible data types that a union_branch can be.
+
+int
+be_visitor_union_branch_public_ch::visit_array (be_array *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ch::"
+ "visit_array - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Not a typedef and bt is defined inside the union.
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
+ {
+ // This is the case of an anonymous array inside a union.
+
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ ctx.state (TAO_CodeGen::TAO_ARRAY_CH);
+ be_visitor_array_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ch::"
+ "visit_array - "
+ "codegen failed\n"
+ ),
+ -1);
+ }
+
+ ctx.state (TAO_CodeGen::TAO_ROOT_CH);
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Now use this array as a "type" for the subsequent declarator
+ // the set method.
+ *os << be_nl << be_nl
+ << "void " << ub->local_name () << " ("
+ << "_" << bt->local_name () << ");" << be_nl;
+ // The get method.
+ *os << "_" << bt->local_name () << "_slice * " << ub->local_name ()
+ << " (void) const; // get method";
+ }
+ else
+ {
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Now use this array as a "type" for the subsequent declarator
+ // the set method.
+ *os << be_nl << be_nl
+ << "void " << ub->local_name () << " ("
+ << bt->nested_type_name (bu) << ");"
+ << be_nl;
+ // The get method.
+ *os << bt->nested_type_name (bu, "_slice *") << " " << ub->local_name ()
+ << " (void) const;";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_ch::visit_enum (be_enum *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ch::"
+ "visit_enum - "
+ "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
+ && bt->is_child (bu))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_enum_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ch::"
+ "visit_enum - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Now use this enum as a "type" for the subsequent declarator
+ // the set method.
+ *os << be_nl << be_nl
+ << "void " << ub->local_name () << " ("
+ << bt->nested_type_name (bu) << ");"
+ << be_nl;
+ // the get method.
+ *os << bt->nested_type_name (bu) << " " << ub->local_name ()
+ << " (void) const;";
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_ch::visit_interface (be_interface *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ch::"
+ "visit_interface - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Set method.
+ *os << be_nl << be_nl
+ << "void " << ub->local_name () << " ("
+ << bt->nested_type_name (bu, "_ptr")
+ << ");" << be_nl;
+ // Get method.
+ *os << bt->nested_type_name (bu, "_ptr") << " " << ub->local_name ()
+ << " (void) const;";
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_ch::visit_interface_fwd (be_interface_fwd *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ch::"
+ "visit_interface_fwd - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Set method.
+ *os << be_nl << be_nl
+ << "void " << ub->local_name () << " ("
+ << bt->nested_type_name (bu, "_ptr")
+ << ");" << be_nl;
+ // Get method.
+ *os << bt->nested_type_name (bu, "_ptr") << " " << ub->local_name ()
+ << " (void) const;";
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_ch::visit_valuebox (be_valuebox *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ch::"
+ "visit_valuebox - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Set method.
+ *os << be_nl << be_nl
+ << "void " << ub->local_name () << " ("
+ << bt->nested_type_name (bu, "*")
+ << ");" << be_nl;
+ // Get method.
+ *os << bt->nested_type_name (bu, "*") << " " << ub->local_name ()
+ << " (void) const;";
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_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 via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ch::"
+ "visit_valuetype - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Set method.
+ *os << be_nl << be_nl
+ << "void " << ub->local_name () << " ("
+ << bt->nested_type_name (bu, "*")
+ << ");" << be_nl;
+ // Get method.
+ *os << bt->nested_type_name (bu, "*") << " " << ub->local_name ()
+ << " (void) const;";
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_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 via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ch::"
+ "visit_valuetype_fwd - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Set method.
+ *os << be_nl << be_nl
+ << "void " << ub->local_name () << " ("
+ << bt->nested_type_name (bu, "*")
+ << ")" << be_nl;
+ // Get method.
+ *os << bt->nested_type_name (bu, "*") << " " << ub->local_name ()
+ << " (void) const;";
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_ch::visit_predefined_type (be_predefined_type *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+ be_typedef *td = this->ctx_->alias ();
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (td != 0)
+ {
+ bt = td;
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ch::"
+ "visit_predefined_type - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ const char *no_td_global = (td == 0 ? "::" : "");
+
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
+ *os << be_nl << be_nl
+ << "void " << ub->local_name () << " (const " << no_td_global
+ << bt->nested_type_name (bu, "_ptr") << ");" << be_nl;
+ *os << no_td_global << bt->nested_type_name (bu, "_ptr") << " "
+ << ub->local_name () << " (void) const;";
+ break;
+ case AST_PredefinedType::PT_value:
+ *os << be_nl << be_nl
+ << "void " << ub->local_name () << " ( " << no_td_global
+ << bt->nested_type_name (bu, " *") << ");" << be_nl;
+ *os << no_td_global << bt->nested_type_name (bu, " *") << " "
+ << ub->local_name () << " (void) const;";
+ break;
+ case AST_PredefinedType::PT_any:
+ *os << be_nl << be_nl
+ << "void " << ub->local_name () << " (const " << no_td_global
+ << bt->nested_type_name (bu) << " &);" << be_nl;
+ *os << "const " << no_td_global<< bt->nested_type_name (bu) << " &"
+ << ub->local_name () << " (void) const;" << be_nl;
+ *os << no_td_global << bt->nested_type_name (bu) << " &"
+ << ub->local_name () << " (void);";
+ break;
+ case AST_PredefinedType::PT_void:
+ break;
+ default:
+ *os << be_nl << be_nl
+ << "void " << ub->local_name () << " ( " << no_td_global
+ << bt->nested_type_name (bu) << ");" << be_nl;
+ *os << no_td_global << bt->nested_type_name (bu) << " "
+ << ub->local_name () << " (void) const;";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_ch::visit_sequence (be_sequence *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ch::"
+ "visit_sequence - "
+ "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
+ && bt->is_child (bu))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_sequence_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ch::"
+ "visit_sequence - "
+ "codegen failed\n"),
+ -1);
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Generate the anonymous sequence member typedef.
+ // This provides a consistent name to use instead of the
+ // implementation-specific name.
+ *os << be_nl << be_nl
+ << "typedef " << bt->nested_type_name (bu)
+ << " _" << ub->local_name () << "_seq;";
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl << be_nl
+ << "void " << ub->local_name () << " (const "
+ << bt->nested_type_name (bu) << " &);" << be_nl;
+ *os << "const " << bt->nested_type_name (bu) << " &"
+ << ub->local_name () << " (void) const;"
+ << be_nl;
+ *os << bt->nested_type_name (bu) << " &" << ub->local_name ()
+ << " (void);";
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_ch::visit_string (be_string *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ch::"
+ "visit_string - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Three methods to set the string value
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << be_nl << be_nl
+ << "void " << ub->local_name () << " (char *);" << be_nl;
+ *os << "void " << ub->local_name () << " (const char *);"
+ << be_nl;
+ *os << "void " << ub->local_name () << " (const ::CORBA::String_var&);"
+ << be_nl;
+ *os << "const char *" << ub->local_name ()
+ << " (void) const;";
+ }
+ else
+ {
+ *os << be_nl << be_nl
+ << "void " << ub->local_name () << " ( ::CORBA::WChar *);" << be_nl;
+ *os << "void " << ub->local_name () << " (const ::CORBA::WChar *);"
+ << be_nl;
+ *os << "void " << ub->local_name () << " (const ::CORBA::WString_var&);"
+ << be_nl;
+ *os << "const ::CORBA::WChar *" << ub->local_name ()
+ << " (void) const;";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_ch::visit_structure (be_structure *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ch::"
+ "visit_structure - "
+ "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
+ && bt->is_child (bu))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_structure_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ch::"
+ "visit_structure - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl << be_nl
+ << "void " << ub->local_name () << " (const "
+ << bt->nested_type_name (bu) << " &);" << be_nl
+ << "const " << bt->nested_type_name (bu) << " &"
+ << ub->local_name () << " (void) const;"
+ << be_nl
+ << bt->nested_type_name (bu) << " &" << ub->local_name ()
+ << " (void);";
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_ch::visit_typedef (be_typedef *node)
+{
+ 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_spec_ch::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_ch::visit_union (be_union *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ch::"
+ "visit_union - "
+ "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
+ && bt->is_child (bu))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_union_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ch::"
+ "visit_union - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl << be_nl
+ << "void " << ub->local_name () << " (const "
+ << bt->nested_type_name (bu) << " &);" << be_nl
+ << "const " << bt->nested_type_name (bu) << " &"
+ << ub->local_name () << " (void) const;"
+ << be_nl
+ << bt->nested_type_name (bu) << " &" << ub->local_name ()
+ << " (void);";
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp
new file mode 100644
index 00000000000..afcf5ee165f
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp
@@ -0,0 +1,1252 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// public_ci.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Union Branch in the client inline file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union_branch,
+ public_ci,
+ "$Id$")
+
+// *****************************************************
+// Visitor for union_branch in the client inline file.
+// *****************************************************
+
+// constructor
+be_visitor_union_branch_public_ci::be_visitor_union_branch_public_ci (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+// destructor
+be_visitor_union_branch_public_ci::~be_visitor_union_branch_public_ci (void)
+{
+}
+
+// visit the union_branch node
+int
+be_visitor_union_branch_public_ci::visit_union_branch (be_union_branch *node)
+{
+ be_type *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);
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_cs::"
+ "visit_union_branch - "
+ "codegen for union_branch type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+// Visit operations on all possible data types that a union_branch can be.
+
+int
+be_visitor_union_branch_public_ci::visit_array (be_array *node)
+{
+ 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_enum - "
+ "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->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.
+ be_visitor_array_ci visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ci::"
+ "visit_array - "
+ "codegen failed\n"),
+ -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];
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+
+ // If bt is not a typedef and 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.
+
+ 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 ());
+ }
+
+ // Set method.
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// Accessor to set the member." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << bu->name () << "::" << ub->local_name () << " (" << fname
+ << " val)" << be_nl
+ << "{" << be_idt_nl
+ << "// Set the discriminant value." << be_nl
+ << "this->_reset ();" << be_nl
+ << "this->disc_ = ";
+
+ if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
+ {
+ ub->gen_label_value (os);
+ }
+ // Default label.
+ else
+ {
+ ub->gen_default_label_value (os, bu);
+ }
+
+ *os << ";" << 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
+ << "ACE_INLINE" << be_nl
+ << 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
+ << "}";
+
+ return 0;
+}
+
+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_type *bt;
+
+ // heck if we are visiting this node via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ci::"
+ "visit_enum - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Set method.
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "/// Accessor to set the member." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << bu->name () << "::" << ub->local_name () << " (" << bt->name ()
+ << " val)" << be_nl
+ << "{" << be_idt_nl
+ << "// Set the discriminant value." << be_nl
+ << "this->_reset ();" << be_nl
+ << "this->disc_ = ";
+
+ if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
+ {
+ ub->gen_label_value (os);
+ }
+ // Default label.
+ else
+ {
+ ub->gen_default_label_value (os, bu);
+ }
+
+ *os << ";" << 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
+ << "ACE_INLINE" << be_nl
+ << 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
+ << "}";
+
+ return 0;
+}
+
+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_type *bt;
+
+ // Check if we are visiting this node via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ci::"
+ "visit_interface - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Set method.
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "/// Accessor to set the member." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << bu->name () << "::" << ub->local_name () << " (" << bt->name ()
+ << "_ptr val)" << be_nl
+ << "{" << be_idt_nl
+ << "// Set the discriminant value." << be_nl
+ << "this->_reset ();" << be_nl
+ << "this->disc_ = ";
+
+ if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
+ {
+ ub->gen_label_value (os);
+ }
+ // Default label.
+ else
+ {
+ ub->gen_default_label_value (os, bu);
+ }
+
+ bool bt_is_defined = node->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 (" << be_idt << be_idt_nl
+ << bt->name () << "::_";
+ }
+ else
+ {
+ *os << "OBJECT_FIELD (" << be_idt << be_idt_nl
+ << "TAO::Objref_Traits<" << node->name () << ">::";
+ }
+
+ *os << "duplicate (val)" << be_uidt_nl << ")" << be_uidt << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Get method.
+ *os << "/// Retrieve the member." << be_nl
+ << "ACE_INLINE" << be_nl
+ << bt->name () << "_ptr " << be_nl
+ << bu->name () << "::" << ub->local_name () << " (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->u_." << ub->local_name () << "_->in ();" << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+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_type *bt;
+
+ // Check if we are visiting this node via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ci::"
+ "visit_interface_fwd - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Set method.
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "/// Accessor to set the member." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << bu->name () << "::" << ub->local_name () << " (" << bt->name ()
+ << "_ptr val)" << be_nl
+ << "{" << be_idt_nl
+ << "// Set the discriminant value." << be_nl
+ << "this->_reset ();" << be_nl
+ << "this->disc_ = ";
+
+ if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
+ {
+ ub->gen_label_value (os);
+ }
+ // Default label.
+ else
+ {
+ ub->gen_default_label_value (os, bu);
+ }
+
+ 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 (" << be_idt << be_idt_nl
+ << bt->name () << "::_";
+ }
+ else
+ {
+ *os << "OBJECT_FIELD (" << be_idt << be_idt_nl
+ << "TAO::Objref_Traits<" << node->name () << ">::";
+ }
+
+ *os << "duplicate (val)" << be_uidt_nl << ")" << be_uidt << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Get method.
+ *os << "/// Retrieve the member." << be_nl
+ << "ACE_INLINE" << be_nl
+ << bt->name () << "_ptr " << be_nl
+ << bu->name () << "::" << ub->local_name () << " (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->u_." << ub->local_name () << "_->in ();" << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_ci::visit_valuebox (be_valuebox *node)
+{
+ return this->emit_valuetype_common (node);
+}
+
+int
+be_visitor_union_branch_public_ci::visit_valuetype (be_valuetype *node)
+{
+ return this->emit_valuetype_common (node);
+}
+
+int
+be_visitor_union_branch_public_ci::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ return this->emit_valuetype_common (node);
+}
+
+int
+be_visitor_union_branch_public_ci::emit_valuetype_common (be_type *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::"
+ "emit_valuetype_common - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Set method.
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// Accessor to set the member." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << bu->name () << "::" << ub->local_name () << " (" << bt->name ()
+ << " *val)" << be_nl
+ << "{" << be_idt_nl
+ << "// Set the discriminant value." << be_nl
+ << "this->_reset ();" << be_nl
+ << "this->disc_ = ";
+
+ if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
+ {
+ ub->gen_label_value (os);
+ }
+ // Default label.
+ else
+ {
+ ub->gen_default_label_value (os, bu);
+ }
+
+ *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" << be_nl
+ << bt->name () << "* " << be_nl
+ << bu->name () << "::" << ub->local_name () << " (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->u_." << ub->local_name () << "_->in ();" << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+int
+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_type *bt;
+
+ // Check if we are visiting this node via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ci::"
+ "visit_interface - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Set method.
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// Accessor to set the member." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << bu->name () << "::" << ub->local_name () << " (";
+
+
+ AST_PredefinedType::PredefinedType pt = node->pt ();
+
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << "const ::" << bt->name () << "_ptr";
+ }
+ else if (pt == AST_PredefinedType::PT_value)
+ {
+ *os << "::" << bt->name () << " *";
+ }
+ else if (pt == AST_PredefinedType::PT_any)
+ {
+ *os << "const ::" << bt->name () << " &";
+ }
+ else
+ {
+ *os << bt->name ();
+ }
+
+ *os << " val)" << be_nl
+ << "{" << be_idt_nl
+ << "// Set the discriminant value." << be_nl
+ << "this->_reset ();" << be_nl
+ << "this->disc_ = ";
+
+ if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
+ {
+ ub->gen_label_value (os);
+ }
+ else
+ // We have an explicit default case.
+ {
+ ub->gen_default_label_value (os, bu);
+ }
+
+ *os << ";" << be_nl;
+
+ switch (pt)
+ {
+ 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_value:
+ *os << "::CORBA::add_ref (val);" << be_nl
+ << "this->u_." << ub->local_name ()
+ << "_ = 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;
+ case AST_PredefinedType::PT_void:
+ break;
+ default:
+ *os << "// Set the value." << be_nl
+ << "this->u_." << ub->local_name ()
+ << "_ = val;" << be_uidt_nl;
+
+ break;
+ }
+
+ *os << "}" << be_nl << be_nl;
+
+ switch (pt)
+ {
+ case AST_PredefinedType::PT_object:
+ // Get method.
+ *os << "/// Retrieve the member." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "::" << bt->name () << "_ptr" << be_nl
+ << bu->name () << "::" << ub->local_name ()
+ << " (void) const" << be_nl
+ << "{" << be_idt_nl;
+ *os << "return this->u_." << ub->local_name ()
+ << "_->in ();" << be_uidt_nl;
+ *os << "}";
+
+ break;
+ case AST_PredefinedType::PT_pseudo:
+ // Get method.
+ *os << "/// Retrieve the member." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "::" << 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 << "}";
+
+ break;
+ case AST_PredefinedType::PT_value:
+ // Get method.
+ *os << "/// Retrieve the member." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "::" << bt->name () << " *" << 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 << "}";
+
+ break;
+ case AST_PredefinedType::PT_any:
+ // Get method with read-only access.
+ *os << "/// Retrieve the member." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "const ::" << 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
+ << "}" << be_nl << be_nl;
+
+ // Get method with read/write access
+ *os << "/// Retrieve the member." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "::" << bt->name () << " &" << be_nl
+ << bu->name () << "::" << ub->local_name ()
+ << " (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return *this->u_." << ub->local_name () << "_;" << be_uidt_nl
+ << "}";
+ break;
+ case AST_PredefinedType::PT_void:
+ break;
+ default:
+ // Get method.
+ *os << "/// Retrieve the member." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "::" << 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
+ << "}";
+
+ break;
+ }
+
+ return 0;
+}
+
+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_type *bt;
+
+ // Check if we are visiting this node via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ci::"
+ "visit_sequence - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << 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
+ << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << bu->name () << "::" << ub->local_name ()
+ << " (const " << bt->name () << " &val)" << be_nl
+ << "{" << be_idt_nl
+ << "// Set the discriminant value." << be_nl
+ << "this->_reset ();" << be_nl
+ << "this->disc_ = ";
+
+ if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
+ {
+ ub->gen_label_value (os);
+ }
+ else
+ // We have an explicit default case.
+ {
+ ub->gen_default_label_value (os, bu);
+ }
+
+ *os << ";" << be_nl
+ << "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
+ << "}" << be_nl << be_nl;
+
+ // Readonly get method.
+ *os << "/// Readonly get method." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "const " << 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
+ << "}" << be_nl << be_nl;
+
+ // Read/write get method.
+ *os << "/// Read/write get method." << be_nl
+ << "ACE_INLINE" << be_nl
+ << bt->name () << " &" << be_nl
+ << bu->name () << "::" << ub->local_name () << " (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return *this->u_." << ub->local_name () << "_;" << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_ci::visit_string (be_string *node)
+{
+ 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);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Three methods to set the string value.
+
+ // (1) Set method from char* or wchar*.
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "/// Accessor to set the member." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "void" << be_nl;
+
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << bu->name () << "::" << ub->local_name () << " (char *val)";
+ }
+ else
+ {
+ *os << bu->name () << "::" << ub->local_name ()
+ << " ( ::CORBA::WChar *val)";
+ }
+
+ *os << be_nl
+ << "{" << be_idt_nl
+ << "// Set the discriminant value." << be_nl
+ << "this->_reset ();" << be_nl
+ << "this->disc_ = ";
+
+ if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
+ {
+ ub->gen_label_value (os);
+ }
+ else
+ // We have an explicit default case.
+ {
+ ub->gen_default_label_value (os, bu);
+ }
+
+ *os << ";" << be_nl
+ << "this->u_." << ub->local_name () << "_ = val;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // (2) Set method from const char * or const wchar *.
+ *os << "// Accessor to set the member." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << bu->name () << "::" << ub->local_name ();
+
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << " (const char *val)" << be_nl << "{" << be_idt_nl;
+ }
+ else
+ {
+ *os << " (const ::CORBA::WChar *val)" << be_nl << "{" << be_idt_nl;
+ }
+
+ *os << "// Set the discriminant value." << be_nl
+ << "this->_reset ();" << be_nl
+ << "this->disc_ = ";
+
+ if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
+ {
+ ub->gen_label_value (os);
+ }
+ else
+ // We have an explicit default case.
+ {
+ ub->gen_default_label_value (os, bu);
+ }
+
+ *os << ";" << be_nl
+ << "// Set the value." << be_nl
+ << "this->u_." << ub->local_name () << "_ = ";
+
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "::CORBA::string_dup (val);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+ else
+ {
+ *os << "::CORBA::wstring_dup (val);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+
+ // (3) Set from const String_var& or WString_var&
+ *os << "/// Accessor to set the member." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << bu->name () << "::" << ub->local_name ();
+
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << " (const ::CORBA::String_var &val)" << be_nl;
+ }
+ else
+ {
+ *os << " (const ::CORBA::WString_var &val)" << be_nl;
+ }
+
+ *os << "{" << be_idt_nl
+ << "// Set the discriminant value." << be_nl
+ << "this->_reset ();" << be_nl
+ << "this->disc_ = ";
+
+ if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
+ {
+ ub->gen_label_value (os);
+ }
+ else
+ // We have an explicit default case.
+ {
+ ub->gen_default_label_value (os, bu);
+ }
+
+ *os << ";" << be_nl
+ << "// Set the value." << be_nl;
+
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "::CORBA::String_var " << ub->local_name ();
+ }
+ else
+ {
+ *os << "::CORBA::WString_var " << ub->local_name ();
+ }
+
+ *os << "_var = val;" << be_nl
+ << "this->u_." << ub->local_name () << "_ = "
+ << ub->local_name () << "_var._retn ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "ACE_INLINE" << be_nl;
+
+ // Get method.
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "const char *" << be_nl;
+ }
+ else
+ {
+ *os << "const ::CORBA::WChar *" << be_nl;
+ }
+
+ *os << bu->name () << "::" << ub->local_name ()
+ << " (void) const // get method" << be_nl
+ << "{" << be_idt_nl
+ << "return this->u_." << ub->local_name () << "_;" << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+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_type *bt;
+
+ // Check if we are visiting this node via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ci::"
+ "visit_structure - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // 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 struct declaration
+ be_visitor_structure_ci visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ci::"
+ "visit_structure - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_nl << 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
+ << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << bu->name () << "::" << ub->local_name ()
+ << " (const " << bt->name () << " &val)" << be_nl
+ << "{" << be_idt_nl
+ << "// Set the discriminant value." << be_nl
+ << "this->_reset ();" << be_nl
+ << "this->disc_ = ";
+
+ if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
+ {
+ ub->gen_label_value (os);
+ }
+ else
+ // We have an explicit default case.
+ {
+ ub->gen_default_label_value (os, bu);
+ }
+
+ *os << ";" << be_nl;
+
+ if (bt->size_type () == be_type::VARIABLE
+ || node->has_constructor ())
+ {
+ *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;
+ }
+ else
+ {
+ *os << "this->u_." << ub->local_name () << "_ = val;" << be_uidt_nl;
+ }
+
+ *os << "}" << be_nl << be_nl;
+
+ // Readonly get method.
+ *os << "// Readonly get method." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "const " << bt->name () << " &" << be_nl
+ << bu->name () << "::" << ub->local_name () << " (void) const" << be_nl
+ << "{" << be_idt_nl;
+
+ if (bt->size_type () == be_type::VARIABLE
+ || node->has_constructor ())
+ {
+ *os << "return *this->u_." << ub->local_name () << "_;" << be_uidt_nl;
+ }
+ else
+ {
+ *os << "return this->u_." << ub->local_name () << "_;" << be_uidt_nl;
+ }
+
+ *os << "}" << be_nl << be_nl;
+
+ // Read/write get method.
+ *os << "// Read/write get method." << be_nl
+ << "ACE_INLINE" << be_nl
+ << bt->name () << " &" << be_nl
+ << bu->name () << "::" << ub->local_name () << " (void)" << be_nl
+ << "{" << be_idt_nl;
+
+ if (bt->size_type () == be_type::VARIABLE
+ || node->has_constructor ())
+ {
+ *os << "return *this->u_." << ub->local_name () << "_;" << be_uidt_nl;
+ }
+ else
+ {
+ *os << "return this->u_." << ub->local_name () << "_;" << be_uidt_nl;
+ }
+
+ *os << "}";
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_ci::visit_typedef (be_typedef *node)
+{
+ // Save the typedef node for use in code generation.
+ 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_union_branch_public_ci::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_ci::visit_union (be_union *node)
+{
+ 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_union - "
+ "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->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 union declaration.
+ be_visitor_union_ci visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ci::"
+ "visit_union - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_nl << 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
+ << "ACE_INLINE" << be_nl
+ << "void" << be_nl
+ << bu->name () << "::" << ub->local_name ()
+ << " (const " << bt->name () << " &val)" << be_nl
+ << "{" << be_idt_nl
+ << "// Set the discriminant value." << be_nl
+ << "this->_reset ();" << be_nl
+ << "this->disc_ = ";
+
+ if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
+ {
+ ub->gen_label_value (os);
+ }
+ else
+ // We have an explicit default case.
+ {
+ ub->gen_default_label_value (os, bu);
+ }
+
+ *os << ";" << be_nl
+ << "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
+ << "}" << be_nl << be_nl;
+
+ // Readonly get method.
+ *os << "// Readonly get method." << be_nl
+ << "ACE_INLINE" << be_nl
+ << "const " << 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
+ << "}" << be_nl << be_nl;
+
+ // Read/write get method.
+ *os << "// Read/write get method." << be_nl
+ << "ACE_INLINE" << be_nl
+ << bt->name () << " &" << be_nl
+ << bu->name () << "::" << ub->local_name () << " (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return *this->u_." << ub->local_name () << "_;" << be_uidt_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
new file mode 100644
index 00000000000..5e4507d8ca6
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_cs.cpp
@@ -0,0 +1,182 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// public_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Union Branch in the client stubs
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union_branch,
+ public_cs,
+ "$Id$")
+
+// **********************************************
+// Visitor for union_branch in the client stubs file.
+// **********************************************
+
+be_visitor_union_branch_public_cs::be_visitor_union_branch_public_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_union_branch_public_cs::~be_visitor_union_branch_public_cs (void)
+{
+}
+
+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);
+ }
+
+ 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);
+ }
+
+ return 0;
+}
+
+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 ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ // Anonymous array case.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_cs::visit_enum (be_enum *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+
+ return 0;
+}
+
+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 (!this->ctx_->alias ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ // Anonymous sequence case.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_cs::visit_string (be_string *)
+{
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_cs::visit_structure (be_structure *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_cs::visit_union (be_union *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+
+ 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
new file mode 100644
index 00000000000..37a40381b20
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp
@@ -0,0 +1,542 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// public_reset_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Union Branch in the client inline file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union_branch,
+ public_reset_cs,
+ "$Id$")
+
+// *****************************************************
+// visitor for union_branch in the client
+// stubs file for the reset method
+// *****************************************************
+
+be_visitor_union_branch_public_reset_cs::
+be_visitor_union_branch_public_reset_cs (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_union_branch_public_reset_cs::
+~be_visitor_union_branch_public_reset_cs (void)
+{
+}
+
+// visit the union_branch node
+int
+be_visitor_union_branch_public_reset_cs::visit_union_branch (
+ be_union_branch *node
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *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
+
+ *os << be_nl;
+
+ 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;
+}
+
+int
+be_visitor_union_branch_public_reset_cs::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_type *bt;
+
+ 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_reset_cs::"
+ "visit_enum - "
+ "bad context information\n"),
+ -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.
+
+ // 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
+ {
+ ACE_OS::sprintf (fname, "%s", bt->full_name ());
+ }
+
+ 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;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_reset_cs::visit_enum (be_enum *)
+{
+ 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_enum - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ *os << "break;" << be_uidt;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_reset_cs::visit_interface (be_interface *)
+{
+ 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_interface - "
+ "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;
+
+ return 0;
+}
+
+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 ();
+ 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_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;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_reset_cs::visit_valuebox (be_valuebox *)
+{
+ 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_valuebox - "
+ "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;
+
+ 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 ()
+ << "_ = 0;" << be_nl
+ << "break;" << be_uidt;
+
+ return 0;
+}
+
+int
+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 ();
+ 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_predefined_type - "
+ "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;
+
+ break;
+ case AST_PredefinedType::PT_pseudo:
+ *os << "::CORBA::release (this->u_."
+ << ub->local_name () << "_);" << be_nl;
+ *os << "this->u_." << ub->local_name ()
+ << "_ = 0;" << be_nl
+ << "break;" << be_uidt;
+
+ break;
+ case AST_PredefinedType::PT_any:
+ *os << "delete this->u_."
+ << ub->local_name () << "_;" << be_nl
+ << "this->u_." << ub->local_name ()
+ << "_ = 0;" << be_nl
+ << "break;" << be_uidt;
+
+ break;
+ case AST_PredefinedType::PT_void:
+ break;
+ default:
+ *os << "break;" << be_uidt;
+
+ break;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_reset_cs::visit_sequence (be_sequence *)
+{
+ 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_sequence - "
+ "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;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_reset_cs::visit_string (be_string *node)
+{
+ 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_string - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "::CORBA::string_free (this->u_.";
+ }
+ else
+ {
+ *os << "::CORBA::wstring_free (this->u_.";
+ }
+
+ *os << ub->local_name () << "_);" << be_nl
+ << "this->u_."
+ << ub->local_name ()
+ << "_ = 0;" << be_nl
+ << "break;" << be_uidt;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_reset_cs::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_type *bt;
+
+ 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_reset_cs::"
+ "visit_structure - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (bt->size_type () == be_type::VARIABLE
+ || node->has_constructor ())
+ {
+ *os << "delete this->u_." << ub->local_name ()
+ << "_;" << be_nl
+ << "this->u_."
+ << ub->local_name ()
+ << "_ = 0;" << be_nl;
+ }
+
+ *os << "break;" << be_uidt;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_reset_cs::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_union_branch_public_reset_cs::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_reset_cs::visit_union (be_union *)
+{
+ 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_union - "
+ "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;
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/serializer_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/serializer_op_ch.cpp
new file mode 100644
index 00000000000..5369b1d1d8a
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/serializer_op_ch.cpp
@@ -0,0 +1,215 @@
+
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating Serializer operator declarator for union_branch
+// in the client header
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union_branch,
+ serializer_op_ch,
+ "$Id$")
+
+// **********************************************
+// Visitor for union_branch in the client header file.
+// **********************************************
+
+be_visitor_union_branch_serializer_op_ch::be_visitor_union_branch_serializer_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_union_branch_serializer_op_ch::~be_visitor_union_branch_serializer_op_ch (void)
+{
+}
+
+int
+be_visitor_union_branch_serializer_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_serializer_op_ch::"
+ "visit_union_branch - "
+ "Bad union_branch type\n"),
+ -1);
+ }
+
+ this->ctx_->node (node);
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_serializer_op_ch::"
+ "visit_union_branch - "
+ "codegen for union_branch type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+// Visit operations on all possible data types that a union_branch can be.
+
+int
+be_visitor_union_branch_serializer_op_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 ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ // This is the case for anonymous arrays.
+
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+
+ be_visitor_array_serializer_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_serializer_op_ch::"
+ "visit_array - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_serializer_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 ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+
+ be_visitor_enum_serializer_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_serializer_op_ch::"
+ "visit_enum - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_serializer_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 ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_sequence_serializer_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_serializer_op_ch::"
+ "visit_sequence - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_serializer_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 ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_structure_serializer_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_serializer_op_ch::"
+ "visit_struct - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_serializer_op_ch::visit_typedef (be_typedef *node)
+{
+ 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_serializer_op_ch::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_union_branch_serializer_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 ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_union_serializer_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_serializer_op_ch::"
+ "visit_enum - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/serializer_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/serializer_op_cs.cpp
new file mode 100644
index 00000000000..41c4c88334e
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/serializer_op_cs.cpp
@@ -0,0 +1,1319 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// union_branch/serializer_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Union_Branch in the client stubs file.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union_branch,
+ serializer_op_cs,
+ "$Id$")
+
+// **********************************************
+// Visitor for union_branch in the client stubs file.
+// **********************************************
+
+be_visitor_union_branch_serializer_op_cs::be_visitor_union_branch_serializer_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_union_branch_serializer_op_cs::~be_visitor_union_branch_serializer_op_cs (void)
+{
+}
+
+int
+be_visitor_union_branch_serializer_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_serializer_op_cs::"
+ "visit_union_branch - "
+ "Bad union_branch type\n"),
+ -1);
+ }
+
+ this->ctx_->node (node);
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_serializer_op_cs::"
+ "visit_union_branch - "
+ "codegen for union_branch type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_serializer_op_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 ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_array_serializer_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_serializer_op_cs::"
+ "visit_array - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ 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_serializer_op_cs::"
+ "visit_array - "
+ "cannot retrieve union_branch node\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 (!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 underscore
+ // 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 (),
+ node->local_name ()->get_string ());
+ }
+ else
+ {
+ ACE_OS::sprintf (fname,
+ "_%s",
+ node->full_name ());
+ }
+ }
+ else
+ {
+ // Typedefed node.
+ ACE_OS::sprintf (fname, "%s", node->full_name ());
+ }
+
+ // 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_IS_BOUNDED_SIZE:
+ {
+ //SHH - TBD - could avoid the counter by enclosing in {}
+ // But this code is currently dead anyway because
+ // unions always return false for _dcps_is_bounded and a large
+ // number for _dcsp_max_marshaled_size.
+ // This note applies to multiple locations in this file.
+ static int tmp_counter = 0;
+ char tmp_val_name[30];
+ ACE_OS::sprintf(tmp_val_name, "tmp_array_val%d", tmp_counter++);
+ *os << fname << "_forany " << tmp_val_name << " (" << be_idt << be_idt_nl
+ << "_tao_union."
+ << f->local_name () << " ()" << be_uidt_nl
+ <<");" << be_uidt_nl;
+ *os << "is_bounded = is_bounded && "
+ << "_tao_is_bounded_size (" << tmp_val_name << ");"
+ << be_nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ {
+ static int tmp_counter = 0;
+ char tmp_size_name[30];
+ char tmp_val_name[30];
+ ACE_OS::sprintf(tmp_size_name, "tmp_array_size%d", tmp_counter);
+ ACE_OS::sprintf(tmp_val_name, "tmp_array_val%d", tmp_counter++);
+ *os << f->field_type ()->name() << "_forany " << tmp_val_name
+ << "; // is type of " << f->local_name () << be_nl;
+ *os << "size_t " << tmp_size_name
+ << " = _dcps_max_marshaled_size (" << tmp_val_name << ");" << be_nl
+ << "if (" << tmp_size_name << " > max_size) " << be_idt_nl
+ << "max_size = " << tmp_size_name << ";" << be_uidt_nl << be_nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ *os << fname << "_forany _tao_union_tmp (" << be_idt << be_idt_nl
+ << "_tao_union."
+ << f->local_name () << " ()" << be_uidt_nl
+ <<");" << be_uidt_nl;
+ *os << "result += _dcps_find_size (_tao_union_tmp);";
+ break;
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ *os << fname << " _tao_union_tmp;" << be_nl
+ << fname << "_forany _tao_union_helper ("
+ << be_idt << be_idt_nl
+ << "_tao_union_tmp" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "result = strm >> _tao_union_helper;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name ()
+ << " (_tao_union_tmp);" << be_nl
+ << "_tao_union._d (_tao_discriminant);" << be_uidt_nl
+ << "}" << be_uidt;
+
+ return 0;
+
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << fname << "_forany _tao_union_tmp (" << be_idt << be_idt_nl
+ << "_tao_union."
+ << f->local_name () << " ()" << be_uidt_nl
+ <<");" << be_uidt_nl
+ << "result = strm << _tao_union_tmp;";
+ return 0;
+
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // This is done in serializer_op_cs.cpp and hacked into *.i.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_serializer_op_cs::"
+ "visit_array - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_serializer_op_cs::visit_enum (be_enum *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_serializer_op_cs::"
+ "visit_array - "
+ "cannot retrieve union_branch node\n"),
+ -1);
+ }
+
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_IS_BOUNDED_SIZE:
+ *os << "// " << f->local_name ()
+ << " is of an enum type; hence is bounded" << be_nl;
+ return 0; // all done
+ break;
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ // enums are serialized as CORBA::ULong
+ *os << "result += _dcps_max_marshaled_size_ulong (); /* enum */"
+ << be_nl;
+ return 0; // all done
+ break;
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ // enums are serialized as CORBA::ULong
+ *os << "if (_dcps_max_marshaled_size_ulong () > max_size)" << be_idt_nl
+ << "max_size = _dcps_max_marshaled_size_ulong (); /* enum */"
+ << be_uidt_nl << be_nl;
+ return 0; // all done
+ break;
+ default:
+ // do code in the rest of this method.
+ break;
+ }
+
+ // 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 () << " _tao_union_tmp"
+ << ";" << be_nl
+ << "result = strm >> _tao_union_tmp;" << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name ()
+ << " (_tao_union_tmp);" << be_nl
+ << "_tao_union._d (_tao_discriminant);" << be_uidt_nl
+ << "}" << be_uidt;
+
+ return 0;
+
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "result = strm << _tao_union." << f->local_name () << " ();";
+ return 0;
+
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Proceed further.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_serializer_op_cs::"
+ "visit_enum - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ // Not a typedef and node is defined inside the union. Otherwise the
+ // Serializer operator is generated elsewhere.
+ 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);
+ be_visitor_enum_serializer_op_cs visitor (&ctx);
+
+ if (visitor.visit_enum (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_serializer_op_cs::"
+ "visit_enum - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_serializer_op_cs::visit_interface (be_interface *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_serializer_op_cs::"
+ "visit_interface - "
+ "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:
+ if (node->is_local ())
+ {
+ *os << "result = 0;";
+ }
+ else
+ {
+ *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:
+ if (node->is_defined ())
+ {
+ if (f->is_abstract ())
+ {
+ *os << "(strm << _tao_union."
+ << f->local_name () << " ());";
+ }
+ else
+ {
+ *os << "::CORBA::Object::marshal (" << be_idt << be_idt_nl
+ << "_tao_union." << f->local_name () << " ()," << be_nl
+ << "strm" << be_uidt_nl
+ << ");" << be_uidt;
+ }
+ }
+ else
+ {
+ *os << "result =" << be_idt_nl
+ << "TAO::Objref_Traits<" << node->name () << ">::marshal ("
+ << be_idt << be_idt_nl
+ << "_tao_union." << f->local_name () << " ()," << be_nl
+ << "strm" << be_uidt_nl
+ << ");" << be_uidt << be_uidt;
+ }
+
+ 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_serializer_op_cs::"
+ "visit_interface - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_serializer_op_cs::visit_interface_fwd (be_interface_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_serializer_op_cs::"
+ "visit_interface_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:
+ if (node->is_local ())
+ {
+ *os << "result = 0;";
+ }
+ else
+ {
+ *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 = _tao_union."
+ << f->local_name () << " ()->marshal (strm);";
+ 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_serializer_op_cs::"
+ "visit_interface_fwd - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_serializer_op_cs::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_serializer_op_cs::"
+ "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_serializer_op_cs::"
+ "visit_valuetype - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_serializer_op_cs::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_serializer_op_cs::"
+ "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_serializer_op_cs::"
+ "visit_valuetype_fwd - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_serializer_op_cs::visit_predefined_type (be_predefined_type *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_serializer_op_cs::"
+ "visit_predefined_type - "
+ "cannot retrieve union_branch node\n"),
+ -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_MAX_MARSHALED_SIZE:
+ {
+ static int tmp_counter = 0;
+ char tmp_name[10];
+ ACE_OS::sprintf(tmp_name, "tmp%d", tmp_counter++);
+
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << "PT_pseudo and PT_object not supported by -Gdcps";
+ *os << be_nl << be_nl << "// above error is from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ }
+ else if (pt == AST_PredefinedType::PT_char)
+ {
+ *os << "size_t " << tmp_name << " = _dcps_max_marshaled_size ("
+ << "::ACE_OutputCDR::from_char (_tao_union."
+ << f->local_name () << " ()));" << be_nl
+ << "if (" << tmp_name << " > max_size) max_size = "
+ << tmp_name << ";" << be_nl;
+ }
+ else if (pt == AST_PredefinedType::PT_wchar)
+ {
+ *os << "size_t " << tmp_name << " = _dcps_max_marshaled_size ("
+ << "::ACE_OutputCDR::from_wchar (_tao_union."
+ << f->local_name () << " ()));" << be_nl
+ << "if (" << tmp_name << " > max_size) max_size = "
+ << tmp_name << ";" << be_nl;
+ }
+ else if (pt == AST_PredefinedType::PT_octet)
+ {
+ *os << "size_t " << tmp_name << " = _dcps_max_marshaled_size ("
+ << "::ACE_OutputCDR::from_octet (_tao_union."
+ << f->local_name () << " ()));" << be_nl
+ << "if (" << tmp_name << " > max_size) max_size = "
+ << tmp_name << ";" << be_nl;
+ }
+ else if (pt == AST_PredefinedType::PT_boolean)
+ {
+ *os << "size_t " << tmp_name << " = _dcps_max_marshaled_size ("
+ << "::ACE_OutputCDR::from_boolean (_tao_union."
+ << f->local_name () << " ()));" << be_nl
+ << "if (" << tmp_name << " > max_size) max_size = "
+ << tmp_name << ";" << be_nl;
+ }
+ else
+ {
+ *os << "size_t " << tmp_name
+ << " = _dcps_max_marshaled_size (_tao_union."
+ << f->local_name () << " ());" << be_nl
+ << "if (" << tmp_name << " > max_size)" << be_idt_nl
+ << "max_size = "<< tmp_name << ";" << be_uidt_nl << be_nl;
+ }
+ }
+ break;
+
+ case TAO_CodeGen::TAO_IS_BOUNDED_SIZE:
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << "PT_pseudo and PT_object not supported by -Gdcps";
+ *os << be_nl << be_nl << "// above error is from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ }
+ else
+ {
+ *os << "// " << f->local_name ()
+ << " is of a predefined type; hence is bounded" << be_nl;
+ }
+ break;
+
+ case TAO_CodeGen::TAO_FIND_SIZE:
+
+ *os << "result += ";
+
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << "PT_pseudo and PT_object not supported by -Gdcps";
+ *os << be_nl << be_nl << "// above error is from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ }
+ else if (pt == AST_PredefinedType::PT_char)
+ {
+ *os << "_dcps_max_marshaled_size (::ACE_OutputCDR::from_char (_tao_union."
+ << f->local_name () << " ()));";
+ }
+ else if (pt == AST_PredefinedType::PT_wchar)
+ {
+ *os << "_dcps_max_marshaled_size (::ACE_OutputCDR::from_wchar (_tao_union."
+ << f->local_name () << " ()));";
+ }
+ else if (pt == AST_PredefinedType::PT_octet)
+ {
+ *os << "_dcps_max_marshaled_size (::ACE_OutputCDR::from_octet (_tao_union."
+ << f->local_name () << " ()));";
+ }
+ else if (pt == AST_PredefinedType::PT_boolean)
+ {
+ *os << "_dcps_max_marshaled_size (::ACE_OutputCDR::from_boolean (_tao_union."
+ << f->local_name () << " ()));";
+ }
+ else
+ {
+ // is predefined so _find_size = _dcps_max_marshaled_size
+ *os << "_dcps_max_marshaled_size (_tao_union." << f->local_name () << " ());";
+ }
+
+ break;
+
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ if (pt == AST_PredefinedType::PT_object)
+ {
+ *os << "::CORBA::Object_var _tao_union_tmp;" << be_nl;
+
+ *os << "result = strm >> _tao_union_tmp.out ();" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name () << " (_tao_union_tmp.in ());";
+
+ }
+ else if (pt == AST_PredefinedType::PT_pseudo)
+ {
+ *os << "::CORBA::TypeCode_var _tao_union_tmp;" << be_nl
+ << "result = strm >> _tao_union_tmp.out ();" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name () << " (_tao_union_tmp.in ());";
+
+ }
+ else if (pt == AST_PredefinedType::PT_value)
+ {
+ *os << "::CORBA::ValueBase * _tao_union_tmp;" << be_nl
+ << "result = strm >> _tao_union_tmp;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name () << " (_tao_union_tmp);";
+
+ }
+ else if (pt == AST_PredefinedType::PT_char)
+ {
+ *os << "::CORBA::Char _tao_union_tmp;" << be_nl
+ << "::ACE_InputCDR::to_char _tao_union_helper "
+ << "(_tao_union_tmp);" << be_nl
+ << "result = strm >> _tao_union_helper;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name ()
+ << " (_tao_union_tmp);";
+ }
+ else if (pt == AST_PredefinedType::PT_wchar)
+ {
+ *os << "::CORBA::WChar _tao_union_tmp;" << be_nl
+ << "::ACE_InputCDR::to_wchar _tao_union_helper "
+ << "(_tao_union_tmp);" << be_nl
+ << "result = strm >> _tao_union_helper;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name ()
+ << " (_tao_union_tmp);";
+ }
+ else if (pt == AST_PredefinedType::PT_octet)
+ {
+ *os << "::CORBA::Octet _tao_union_tmp;" << be_nl
+ << "::ACE_InputCDR::to_octet _tao_union_helper "
+ << "(_tao_union_tmp);" << be_nl
+ << "result = strm >> _tao_union_helper;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name ()
+ << " (_tao_union_tmp);";
+ }
+ else if (pt == AST_PredefinedType::PT_boolean)
+ {
+ *os << "::CORBA::Boolean _tao_union_tmp;" << be_nl
+ << "::ACE_InputCDR::to_boolean _tao_union_helper "
+ << "(_tao_union_tmp);" << be_nl
+ << "result = strm >> _tao_union_helper;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name ()
+ << " (_tao_union_tmp);";
+ }
+ else
+ {
+ *os << node->name () << " _tao_union_tmp;" << be_nl
+ << "result = strm >> _tao_union_tmp;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name ()
+ << " (_tao_union_tmp);";
+ }
+
+ *os << be_nl;
+ *os << "_tao_union._d (_tao_discriminant);" << be_uidt_nl;
+ *os << "}" << be_uidt;
+
+ break;
+
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+
+ *os << "result = ";
+
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << "strm << _tao_union." << f->local_name () << " ();";
+ }
+ else if (pt == AST_PredefinedType::PT_char)
+ {
+ *os << "strm << ::ACE_OutputCDR::from_char (_tao_union."
+ << f->local_name () << " ());";
+ }
+ else if (pt == AST_PredefinedType::PT_wchar)
+ {
+ *os << "strm << ::ACE_OutputCDR::from_wchar (_tao_union."
+ << f->local_name () << " ());";
+ }
+ else if (pt == AST_PredefinedType::PT_octet)
+ {
+ *os << "strm << ::ACE_OutputCDR::from_octet (_tao_union."
+ << f->local_name () << " ());";
+ }
+ else if (pt == AST_PredefinedType::PT_boolean)
+ {
+ *os << "strm << ::ACE_OutputCDR::from_boolean (_tao_union."
+ << f->local_name () << " ());";
+ }
+ else
+ {
+ *os << "strm << _tao_union." << f->local_name () << " ();";
+ }
+
+ break;
+
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_serializer_op_cs::"
+ "visit_array - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_serializer_op_cs::visit_sequence (be_sequence *node)
+{
+ // If the sequence is defined in this scope, generate its Serializer stream
+ // operators heree.
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ // Anonymous sequence
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_sequence_serializer_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_serializer_op_cs::"
+ "visit_sequence - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ // Now generate the Serializer stream operators for the sequence as a
+ // union branch.
+
+ 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_serializer_op_cs::"
+ "visit_sequence - "
+ "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_IS_BOUNDED_SIZE:
+ {
+ static int tmp_counter = 0;
+ char tmp_val_name[30];
+ ACE_OS::sprintf(tmp_val_name, "tmp_seq_val%d", tmp_counter++);
+ *os << f->field_type ()->name() << " " << tmp_val_name
+ << "; // is type of " << f->local_name () << be_nl;
+ *os << "is_bounded = is_bounded && "
+ << "_tao_is_bounded_size (" << tmp_val_name << ");"
+ << be_nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ {
+ static int tmp_counter = 0;
+ char tmp_size_name[30];
+ char tmp_val_name[30];
+ ACE_OS::sprintf(tmp_size_name, "tmp_seq_size%d", tmp_counter);
+ ACE_OS::sprintf(tmp_val_name, "tmp_seq_val%d", tmp_counter++);
+ *os << f->field_type ()->name() << " " << tmp_val_name
+ << "; // is type of " << f->local_name () << be_nl;
+ *os << "size_t " << tmp_size_name
+ << " = _dcps_max_marshaled_size (" << tmp_val_name << ");" << be_nl
+ << "if (" << tmp_size_name << " > max_size) " << be_idt_nl
+ << "max_size = " << tmp_size_name << ";" << be_uidt_nl << be_nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ //SHH - TBD - make sure this is a shallow copy.
+ // But this code is currently dead anyway because
+ // unions always return false for _dcps_is_bounded and a large
+ // number for _dcsp_max_marshaled_size.
+ // This note applies to multiple locations in this file.
+ *os << f->field_type ()->name() << " tmp (_tao_union."
+ << f->local_name () << " ());" << be_nl;
+ *os << "result += _dcps_find_size (tmp);" << be_nl;
+ break;
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ {
+ // If the typedef'd sequence is included from another
+ // file, node->name() won't work. The following works
+ // for all typedefs, external or not.
+ be_typedef *td = this->ctx_->alias ();
+
+ if (td)
+ {
+ *os << td->name ();
+ }
+ else
+ {
+ *os << node->name ();
+ }
+
+ *os << " _tao_union_tmp;" << be_nl
+ << "result = strm >> _tao_union_tmp;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union."
+ << f->local_name () << " (_tao_union_tmp);" << be_nl
+ << "_tao_union._d (_tao_discriminant);" << be_uidt_nl
+ << "}" << be_uidt;
+
+ return 0;
+ }
+
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "result = strm << _tao_union."
+ << f->local_name () << " ();";
+ return 0;
+
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Proceed further.
+ break;
+ default:
+ // Error
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_serializer_op_cs::"
+ "visit_sequence - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_serializer_op_cs::visit_string (be_string *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_serializer_op_cs::"
+ "visit_string - "
+ "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_IS_BOUNDED_SIZE:
+ if (0 == node->max_size ()->ev ()->u.ulval)
+ *os << "is_bounded = is_bounded && false; /* unbounded string */"
+ << be_nl;
+ else
+ *os << "// bounded string " << f->local_name ()
+ << be_nl;
+ break;
+ case TAO_CodeGen::TAO_MAX_MARSHALED_SIZE:
+ {
+ static int tmp_counter = 0;
+ char tmp_size_name[30];
+ ACE_OS::sprintf(tmp_size_name, "tmp_string_size%d", tmp_counter++);
+
+ char buff[15];
+ ACE_OS::sprintf(buff, "%ld", node->max_size ()->ev ()->u.ulval);
+ *os << "size_t " << tmp_size_name
+ << " = _dcps_max_marshaled_size_ulong () + " << buff << ";" << be_nl
+ << "if (" << tmp_size_name << ")" << be_idt_nl
+ << "max_size = " << tmp_size_name << ";" << be_uidt_nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ *os << "result += _dcps_max_marshaled_size_ulong() + " << be_idt_nl
+ << "ACE_OS::strlen(_tao_union."
+ << f->local_name () << " ());" << be_uidt_nl;
+ break;
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "::CORBA::String_var _tao_union_tmp;" << be_nl;
+ }
+ else
+ {
+ *os << "::CORBA::WString_var _tao_union_tmp;" << be_nl;
+ }
+
+ *os << "result = strm >> _tao_union_tmp.out ();" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union."
+ << f->local_name () << " (_tao_union_tmp);" << 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.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_serializer_op_cs::"
+ "visit_array - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_serializer_op_cs::visit_structure (be_structure *node)
+{
+ // If the structure is defined in this scope. generate its Serializer
+ // stream operators here.
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_structure_serializer_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_serializer_op_cs::"
+ "visit_struct - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ // How generate the Serializer stream operators for the structure as
+ // a union branch.
+
+ 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_serializer_op_cs::"
+ "visit_structure - "
+ "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_MAX_MARSHALED_SIZE:
+ {
+ static int tmp_counter = 0;
+ char tmp_size_name[30];
+ char tmp_val_name[30];
+ ACE_OS::sprintf(tmp_size_name, "tmp_struct_size%d", tmp_counter);
+ ACE_OS::sprintf(tmp_val_name, "tmp_struct_val%d", tmp_counter++);
+
+ *os << f->field_type ()->name() << " " << tmp_val_name
+ << "; // is type of " << f->local_name () << be_nl;
+ *os << "size_t " << tmp_size_name
+ << " = _dcps_max_marshaled_size (" << tmp_val_name << ");" << be_nl
+ << "if (" << tmp_size_name << " > max_size) " << be_idt_nl
+ << "max_size = " << tmp_size_name << ";" << be_uidt_nl << be_nl;
+ }
+ break;
+
+ case TAO_CodeGen::TAO_IS_BOUNDED_SIZE:
+ {
+ static int tmp_counter = 0;
+ char tmp_size_name[30];
+ char tmp_val_name[30];
+ ACE_OS::sprintf(tmp_size_name, "tmp_struct_size%d", tmp_counter);
+ ACE_OS::sprintf(tmp_val_name, "tmp_struct_val%d", tmp_counter++);
+
+ *os << f->field_type ()->name() << " " << tmp_val_name
+ << "; // is type of " << f->local_name () << be_nl;
+ *os << "is_bounded = is_bounded && _tao_is_bounded_size ("
+ << tmp_val_name << ");" << be_nl;
+ }
+ break;
+
+ case TAO_CodeGen::TAO_FIND_SIZE:
+ *os << "result += _dcps_find_size (_tao_union."
+ << f->local_name () << " ());" << be_nl;
+ break;
+
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ *os << node->name () << " _tao_union_tmp;" << be_nl
+ << "result = strm >> _tao_union_tmp;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name ()
+ << " (_tao_union_tmp);" << be_nl
+ << "_tao_union._d (_tao_discriminant);" << be_uidt_nl
+ << "}" << be_uidt;
+
+ return 0;
+
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "result = strm << _tao_union."
+ << f->local_name () << " ();";
+ return 0;
+
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Proceed further.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_serializer_op_cs::"
+ "visit_structure - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_serializer_op_cs::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_union_branch_public_ci::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_union_branch_serializer_op_cs::visit_union (be_union *node)
+{
+ // If the union is defined in this scope, generate its Serializer
+ // stream operators here.
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_union_serializer_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_serializer_op_cs::"
+ "visit_union - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ // Now generate the Serializer stream operators for the union as
+ // a union branch.
+
+ 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_serializer_op_cs::"
+ "visit_union - "
+ "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 () << " _tao_union_tmp"
+ << ";" << be_nl
+ << "result = strm >> _tao_union_tmp;" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name ()
+ << " (_tao_union_tmp);" << be_nl
+ << "_tao_union._d (_tao_discriminant);" << be_uidt_nl
+ << "}" << be_uidt_nl;
+
+ return 0;
+
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "result = strm << _tao_union."
+ << f->local_name () << " ();";
+ return 0;
+
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Proceed further.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_serializer_op_cs::"
+ "visit_union - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_serializer_op_cs::explicit_default (void)
+{
+ be_union *bu = be_union::narrow_from_decl (this->ctx_->scope ());
+ int def_index = bu->default_index ();
+
+ if (def_index != -1)
+ {
+ be_union_branch *ub =
+ be_union_branch::narrow_from_decl (this->ctx_->node ());
+
+ int i = 0;
+
+ // Instantiate a scope iterator.
+ for (UTL_ScopeActiveIterator si (bu, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ be_union_branch *bub = 0; // union branch node
+
+ AST_Decl *d = si.item ();
+
+ if (!d->imported ())
+ {
+ bub = be_union_branch::narrow_from_decl (d);
+ }
+
+ if (bub == ub)
+ {
+ return (i == def_index);
+ }
+ else
+ {
+ ++i;
+ }
+ }
+ }
+
+ return 0;
+}
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..e50944b28e9
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union_fwd.cpp
@@ -0,0 +1,32 @@
+//
+// $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_union.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..a589e8eb0c4
--- /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)
+{
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_union *fd = be_union::narrow_from_decl (node->full_definition ());
+
+ // This will be a no-op if it has already been done for this node.
+ fd->gen_common_varout (os);
+
+ node->cli_hdr_gen (true);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuebox.cpp b/TAO/TAO_IDL/be/be_visitor_valuebox.cpp
new file mode 100644
index 00000000000..c6d4bb2eaed
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuebox.cpp
@@ -0,0 +1,57 @@
+
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_valuebox.cpp
+//
+// = DESCRIPTION
+// Concrete visitor for the Valuebox class
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+#include "be_array.h"
+#include "be_enum.h"
+#include "be_extern.h"
+#include "be_field.h"
+#include "be_helper.h"
+#include "be_interface.h"
+#include "be_interface_fwd.h"
+#include "be_module.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_util.h"
+#include "be_valuebox.h"
+#include "utl_identifier.h"
+
+#include "be_visitor_context.h"
+#include "be_visitor_sequence.h"
+#include "be_visitor_typecode.h"
+#include "be_visitor_union.h"
+#include "be_visitor_valuebox.h"
+#include "ace/Log_Msg.h"
+
+#include "be_visitor_valuebox/valuebox.cpp"
+#include "be_visitor_valuebox/valuebox_ch.cpp"
+#include "be_visitor_valuebox/valuebox_ci.cpp"
+#include "be_visitor_valuebox/valuebox_cs.cpp"
+#include "be_visitor_valuebox/any_op_ch.cpp"
+#include "be_visitor_valuebox/any_op_cs.cpp"
+#include "be_visitor_valuebox/cdr_op_ch.cpp"
+#include "be_visitor_valuebox/cdr_op_cs.cpp"
+#include "be_visitor_valuebox/field_ch.cpp"
+#include "be_visitor_valuebox/field_ci.cpp"
+#include "be_visitor_valuebox/union_member_ci.cpp"
diff --git a/TAO/TAO_IDL/be/be_visitor_valuebox/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuebox/any_op_ch.cpp
new file mode 100644
index 00000000000..e763f9917c9
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuebox/any_op_ch.cpp
@@ -0,0 +1,117 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Any operators for a valuebox in the client
+// header.
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuebox,
+ any_op_ch,
+ "$Id$")
+
+// ***************************************************************************
+// Valuebox visitor for generating Any operator declarations.
+// ***************************************************************************
+
+be_visitor_valuebox_any_op_ch::be_visitor_valuebox_any_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_valuebox (ctx)
+{
+}
+
+be_visitor_valuebox_any_op_ch::~be_visitor_valuebox_any_op_ch (void)
+{
+}
+
+int
+be_visitor_valuebox_any_op_ch::visit_valuebox (be_valuebox *node)
+{
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ const char *macro = this->ctx_->export_macro ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ be_module *module = 0;
+
+ if (node->is_nested () &&
+ node->defined_in ()->scope_node_type () == AST_Decl::NT_module)
+ {
+ module = be_module::narrow_from_scope (node->defined_in ());
+
+ if (!module)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_valuebox_any_op_ch::"
+ "visit_valuebox - "
+ "Error parsing nested name\n"),
+ -1);
+ }
+
+ // Some compilers handle "any" operatorrs in a namespace
+ // corresponding to their module, others do not.
+ *os << "\n\n#if defined (ACE_ANY_OPS_USE_NAMESPACE)\n";
+
+ be_util::gen_nested_namespace_begin (os, module);
+
+ // emit nested variation of any operators
+ *os << macro << " void"
+ << " operator<<= ( ::CORBA::Any &, " << node->local_name ()
+ << " *); // copying" << be_nl;
+
+ *os << macro << " void"
+ << " operator<<= ( ::CORBA::Any &, " << node->local_name ()
+ << " **); // non-copying" << be_nl;
+
+ *os << macro << " ::CORBA::Boolean"
+ << " operator>>= (const ::CORBA::Any &, "
+ << node->local_name () << " *&);";
+
+ be_util::gen_nested_namespace_end (os, module);
+
+ // emit #else
+ *os << "#else\n\n";
+ }
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *os << macro << " void operator<<= (::CORBA::Any &, " << node->name ()
+ << " *); // copying" << be_nl;
+
+ *os << macro << " void operator<<= (::CORBA::Any &, " << node->name ()
+ << " **); // non-copying" << be_nl;
+
+ *os << macro << " ::CORBA::Boolean operator>>= (const ::CORBA::Any &, "
+ << node->name () << " *&);";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ if (module != 0)
+ {
+ *os << "\n\n#endif";
+ }
+
+ node->cli_hdr_any_op_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuebox/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuebox/any_op_cs.cpp
new file mode 100644
index 00000000000..3d62e15856b
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuebox/any_op_cs.cpp
@@ -0,0 +1,206 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Any operators for valueboxes in the stubs
+// file.
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuebox,
+ any_op_cs,
+ "$Id$")
+
+
+// ***************************************************************************
+// Valuebox visitor for generating Any operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_valuebox_any_op_cs::be_visitor_valuebox_any_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_valuebox (ctx)
+{
+}
+
+be_visitor_valuebox_any_op_cs::~be_visitor_valuebox_any_op_cs (void)
+{
+}
+
+int
+be_visitor_valuebox_any_op_cs::visit_valuebox (be_valuebox *node)
+{
+ if (node->cli_stub_any_op_gen ()
+ || node->imported ()
+ || node->is_local ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Generate the Any <<= and >>= operator declarations
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ // All template specializations must be generated before the instantiations
+ // in the operators.
+ *os << be_nl << be_nl
+ << "namespace TAO" << be_nl
+ << "{" << be_idt_nl
+ << "template<>" << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "Any_Impl_T<" << node->name () << ">::to_value ("
+ << be_idt << be_idt_nl
+ << "::CORBA::ValueBase *&_tao_elem" << be_uidt_nl
+ << ") const" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::add_ref (this->value_);" << be_nl
+ << "_tao_elem = this->value_;" << be_nl
+ << "return true;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ be_module *module = 0;
+
+ if (node->is_nested () &&
+ node->defined_in ()->scope_node_type () == AST_Decl::NT_module)
+ {
+ module = be_module::narrow_from_scope (node->defined_in ());
+
+ if (!module)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_valuebox_any_op_cs::"
+ "visit_valuebox - "
+ "Error parsing nested name\n"),
+ -1);
+ }
+
+ // Some compilers handle "any" operators in a namespace corresponding
+ // to their module, others do not.
+ *os << "\n\n#if defined (ACE_ANY_OPS_USE_NAMESPACE)\n";
+
+ be_util::gen_nested_namespace_begin (os, module);
+
+ // emit nested variation of any operators
+ *os << "// Copying insertion." << be_nl
+ << "void" << be_nl
+ << "operator<<= (" << be_idt << be_idt_nl
+ << "::CORBA::Any &_tao_any," << be_nl
+ << node->local_name () << " *_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::add_ref (_tao_elem);" << be_nl
+ << "_tao_any <<= &_tao_elem;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "// Non-copying insertion." << be_nl
+ << "void" << be_nl
+ << "operator<<= (" << be_idt << be_idt_nl
+ << "::CORBA::Any &_tao_any," << be_nl
+ << node->local_name () << " **_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "TAO::Any_Impl_T<" << node->local_name () << ">::insert ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->local_name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name ()->last_component () << "," << be_nl
+ << "*_tao_elem" << 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->local_name () << " *&_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return" << be_idt_nl
+ << "TAO::Any_Impl_T<" << node->local_name () << ">::extract ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->local_name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name ()->last_component () << "," << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ be_util::gen_nested_namespace_end (os, module);
+
+ // emit #else
+ *os << "#else\n\n";
+ }
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *os << "// Copying insertion." << be_nl
+ << "void" << be_nl
+ << "operator<<= (" << be_idt << be_idt_nl
+ << "::CORBA::Any &_tao_any," << be_nl
+ << node->full_name () << " *_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::add_ref (_tao_elem);" << be_nl
+ << "_tao_any <<= &_tao_elem;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "// Non-copying insertion." << be_nl
+ << "void" << be_nl
+ << "operator<<= (" << be_idt << be_idt_nl
+ << "::CORBA::Any &_tao_any," << be_nl
+ << node->full_name () << " **_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "TAO::Any_Impl_T<" << node->name () << ">::insert ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "*_tao_elem" << 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 () << " *&_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return" << be_idt_nl
+ << "TAO::Any_Impl_T<" << node->name () << ">::extract ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ if (module != 0)
+ {
+ *os << "\n\n#endif";
+ }
+
+ node->cli_stub_any_op_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuebox/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuebox/cdr_op_ch.cpp
new file mode 100644
index 00000000000..cd35ccf737b
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuebox/cdr_op_ch.cpp
@@ -0,0 +1,66 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.cpp
+//
+// = DESCRIPTION
+// Concrete visitor for valueboxes.
+// This one provides code generation for the CDR operators.
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuebox,
+ cdr_op_ch,
+ "$Id$")
+
+be_visitor_valuebox_cdr_op_ch::be_visitor_valuebox_cdr_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_valuebox (ctx)
+{
+}
+
+be_visitor_valuebox_cdr_op_ch::~be_visitor_valuebox_cdr_op_ch (void)
+{
+}
+
+int
+be_visitor_valuebox_cdr_op_ch::visit_valuebox (be_valuebox *node)
+{
+ if (node->imported ()
+ || node->cli_hdr_cdr_op_gen ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *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 () << " *&);";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ node->cli_hdr_cdr_op_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuebox/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuebox/cdr_op_cs.cpp
new file mode 100644
index 00000000000..42b42489d69
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuebox/cdr_op_cs.cpp
@@ -0,0 +1,91 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_cs.cpp
+//
+// = DESCRIPTION
+// Concrete visitor for valueboxes.
+// This one provides code generation for the CDR operators.
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuebox,
+ cdr_op_cs,
+ "$Id$")
+
+be_visitor_valuebox_cdr_op_cs::be_visitor_valuebox_cdr_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_valuebox (ctx)
+{
+}
+
+be_visitor_valuebox_cdr_op_cs::~be_visitor_valuebox_cdr_op_cs (void)
+{
+}
+
+int
+be_visitor_valuebox_cdr_op_cs::visit_valuebox (be_valuebox *node)
+{
+ // Already generated and/or we are imported. Don't do anything.
+ if (node->cli_stub_cdr_op_gen ()
+ || node->imported ()
+ || ! node->is_defined ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ node->cli_stub_cdr_op_gen (true);
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+*os << be_global->core_versioning_begin () << 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<< (" << be_idt << be_idt_nl
+ << "TAO_OutputCDR &strm, " << be_nl
+ << "const " << node->full_name ()
+ << " *_tao_valuebox" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+ *os << "return" << be_idt_nl
+ << "::CORBA::ValueBase::_tao_marshal (" << be_idt << be_idt_nl
+ << "strm," << be_nl
+ << "_tao_valuebox," << be_nl
+ << "reinterpret_cast<ptrdiff_t> (&"
+ << node->full_name () << "::_downcast)"
+ << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "::CORBA::Boolean" << be_nl
+ << "operator>> (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &strm," << be_nl
+ << node->full_name ()
+ << " *&_tao_valuebox" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+ *os << "return " << node->full_name ()
+ << "::_tao_unmarshal (strm, _tao_valuebox);"
+ << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuebox/field_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuebox/field_ch.cpp
new file mode 100644
index 00000000000..1ac3ef40268
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuebox/field_ch.cpp
@@ -0,0 +1,536 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_ch.cpp
+//
+// = DESCRIPTION
+// Visitor for the structure fields in valuebox class.
+// This one generates code for access to strucuture members
+// in the client header.
+//
+// Based on be_visitor_union_branch/public_ch. In general we
+// generate the same method signatures as that visitor but cannot
+// use it directly because a valuebox is not a scope and because
+// the structure is visited prior to visiting the valuebox.
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuebox,
+ field_ch,
+ "$Id$")
+
+
+be_visitor_valuebox_field_ch::be_visitor_valuebox_field_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_valuebox_field_ch::~be_visitor_valuebox_field_ch (void)
+{
+}
+
+int
+be_visitor_valuebox_field_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_valuebox_field_ch::"
+ "visit_field - "
+ "Bad field type\n"
+ ),
+ -1);
+ }
+
+ this->ctx_->node (node);
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_field_ch::"
+ "visit_union_branch - "
+ "codegen for valuebox field failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+// Visit operations on all possible data types that a union_branch can be.
+
+int
+be_visitor_valuebox_field_ch::visit_array (be_array *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!field)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_field_ch::"
+ "visit_array - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+
+ char fname [NAMEBUFSIZE];
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+
+ if (bt->node_type () != AST_Decl::NT_typedef)
+ {
+ // 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 (),
+ 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 << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "void " << field->local_name () << " (" << fname << ");" << be_nl;
+
+ *os << "const " << fname << "_slice *" << field->local_name ()
+ << " (void) const;" << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ch::visit_enum (be_enum *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!field)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_field_ch::"
+ "visit_enum - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_member_set (field, bt, "", "");
+ this->emit_member_get (field, bt, "", "", "const");
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ch::visit_interface (be_interface *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!field)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_field_ch::"
+ "visit_interface - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_member_set (field, bt, "", "_ptr");
+ this->emit_member_get (field, bt, "", "_ptr", "const");
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ch::visit_interface_fwd (be_interface_fwd *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!field)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_field_ch::"
+ "visit_interface_fwd - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_member_set (field, bt, "", "_ptr");
+ this->emit_member_get (field, bt, "", "_ptr", "const");
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ch::visit_valuetype (be_valuetype *)
+{
+ // Valuetype is not a valid component of a valuebox
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ch::visit_valuetype_fwd (be_valuetype_fwd *)
+{
+ // Valuetype is not a valid component of a valuebox
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ch::visit_predefined_type (be_predefined_type *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!field)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_field_ch::"
+ "visit_predefined_type - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
+ this->emit_member_set (field, bt, " ::", "_ptr");
+ this->emit_member_get (field, bt, " ::", "_ptr", "const");
+
+ break;
+ case AST_PredefinedType::PT_any:
+ this->emit_member_set (field, bt, "const ::", " &");
+ this->emit_member_get (field, bt, "const ::", " &", "const");
+ this->emit_member_get (field, bt, " ::", " &", "");
+ break;
+ case AST_PredefinedType::PT_void:
+ break;
+ default:
+ this->emit_member_set (field, bt, " ::", "");
+ this->emit_member_get (field, bt, " ::", "", "const");
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ch::visit_sequence (be_sequence *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!field)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_field_ch::"
+ "visit_sequence - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_member_set (field, bt, "const ", " &");
+ this->emit_member_get (field, bt, "const ", " &", "const");
+ this->emit_member_get (field, bt, "", " &", "");
+
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ch::visit_string (be_string *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!field)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_field_ch::"
+ "visit_string - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_member_set (field, bt, "", "");
+ this->emit_member_set (field, bt, "const ", "");
+
+ const char *string_type = "";
+ if (node->node_type () == AST_Decl::NT_string)
+ {
+ string_type = "String";
+ }
+ else if (node->node_type () == AST_Decl::NT_wstring)
+ {
+ string_type = "WString";
+ }
+
+ *os << "void " << field->local_name ()
+ << " (const ::CORBA::" << string_type << "_var &);" << be_nl;
+
+ this->emit_member_get (field, bt, "const ", "", "const");
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ch::visit_structure (be_structure *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!field)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_field_ch::"
+ "visit_structure - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_member_set (field, bt, "const ", " &");
+ this->emit_member_get (field, bt, "const ", " &", "const");
+ this->emit_member_get (field, bt, "", " &", "");
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ch::visit_typedef (be_typedef *node)
+{
+ 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_spec_ch::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ch::visit_union (be_union *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!field)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_field_ch::"
+ "visit_union - "
+ "bad context information\n"
+ ),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_member_set (field, bt, "const ", " &");
+ this->emit_member_get (field, bt, "const ", " &", "const");
+ this->emit_member_get (field, bt, "", " &", "");
+
+ return 0;
+}
+
+
+void
+be_visitor_valuebox_field_ch::emit_member_set (be_decl *field,
+ be_type *field_type,
+ const char *const_arg,
+ const char *arg_modifier)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "void " << field->local_name ()
+ << " (" << const_arg << field_type->name () << arg_modifier << ");"
+ << be_nl;
+
+}
+
+
+void
+be_visitor_valuebox_field_ch::emit_member_get (be_decl *field,
+ be_type *field_type,
+ const char *const_prefix,
+ const char *type_suffix,
+ const char *const_method)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << const_prefix << field_type->name () << type_suffix << " "
+ << field->local_name () << " (void) " << const_method << ";" << be_nl;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuebox/field_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuebox/field_ci.cpp
new file mode 100644
index 00000000000..c183b8ef2cc
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuebox/field_ci.cpp
@@ -0,0 +1,614 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_ci.cpp
+//
+// = DESCRIPTION
+// Visitor for the Valuebox class.
+// This one generates code for accessor and modifier functions of
+// for valuebox struct members.
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+ACE_RCSID (be_visitor_valuebox,
+ field_ci,
+ "$Id$")
+
+be_visitor_valuebox_field_ci::be_visitor_valuebox_field_ci (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_valuebox_field_ci::~be_visitor_valuebox_field_ci (void)
+{
+}
+
+int
+be_visitor_valuebox_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_valuebox_field_ci::"
+ "visit_field - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ this->ctx_->node (node);
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_field_ci::"
+ "visit_field - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+// Visit operations on all possible data types that a field can be
+
+int
+be_visitor_valuebox_field_ci::visit_array (be_array *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_valuebox *vb_node = be_valuebox::narrow_from_decl (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 (!field || !vb_node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_field_ci::"
+ "visit_array - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ char fname [NAMEBUFSIZE];
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+
+ if (bt->node_type () != AST_Decl::NT_typedef)
+ {
+ // 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 (),
+ 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 << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "/// Modifier to set the member." << be_nl;
+
+ *os << "ACE_INLINE void" << be_nl
+ << vb_node->name () << "::" << field->local_name ()
+ << " (" << fname << " val)" << be_nl
+ << "{" << be_idt_nl
+ << fname << "_copy ("
+ << "this->_pd_value->" << field->local_name ()
+ << ", val);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "/// Accessor to retrieve the member." << be_nl;
+
+ *os << "ACE_INLINE const " << fname << "_slice *" << be_nl
+ << vb_node->name () << "::" << field->local_name ()
+ << " (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value->" << field->local_name ()
+ << ";" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ci::visit_enum (be_enum *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_valuebox *vb_node = be_valuebox::narrow_from_decl (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 (!field || !vb_node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_field_ci::"
+ "visit_enum - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+
+ this->emit_member_set (vb_node, field, bt, "", "");
+ this->emit_member_get (vb_node, field, bt, "", "", "const", "");
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ci::visit_interface (be_interface *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_valuebox *vb_node = be_valuebox::narrow_from_decl (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 (!field || !vb_node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_field_ci::"
+ "visit_interface - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// Modifier to set the member." << be_nl;
+
+ *os << "ACE_INLINE void" << be_nl
+ << vb_node->name () << "::" << field->local_name ()
+ << " (" << bt->name () << "_ptr val)"
+ << be_nl << "{" << be_idt_nl
+ << "this->_pd_value->" << field->local_name ()
+ << " = " << "TAO::Objref_Traits< ::" << bt->name ()
+ << ">::duplicate (val);" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ this->emit_member_get (vb_node, field, bt, "", "_ptr", "const", ".in ()");
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ci::visit_interface_fwd (be_interface_fwd *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_valuebox *vb_node = be_valuebox::narrow_from_decl (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 (!field || !vb_node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_field_ci::"
+ "visit_interface_fwd - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// Modifier to set the member." << be_nl;
+
+ *os << "ACE_INLINE void" << be_nl
+ << vb_node->name () << "::" << field->local_name ()
+ << " (" << bt->name () << "_ptr val)"
+ << be_nl << "{" << be_idt_nl
+ << "this->_pd_value->" << field->local_name ()
+ << " = " << "TAO::Objref_Traits< ::" << bt->name ()
+ << ">::duplicate (val);" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ this->emit_member_get (vb_node, field, bt, "", "_ptr", "const", ".in ()");
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ci::visit_valuetype (be_valuetype *)
+{
+ // Valuetype is not a valid component of a valuebox
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ci::visit_eventtype (be_eventtype *)
+{
+ // Valuetype is not a valid component of a valuebox
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ci::visit_valuetype_fwd (be_valuetype_fwd *)
+{
+ // Valuetype is not a valid component of a valuebox
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ci::visit_eventtype_fwd (be_eventtype_fwd *)
+{
+ // Valuetype is not a valid component of a valuebox
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ci::visit_predefined_type (be_predefined_type *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_valuebox *vb_node = be_valuebox::narrow_from_decl (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 (!field || !vb_node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_field_ci::"
+ "visit_predefined_type - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
+ *os << "// Modifier to set the member." << be_nl;
+
+ *os << "ACE_INLINE void" << be_nl
+ << vb_node->name () << "::" << field->local_name ()
+ << " ( ::" << bt->name () << "_ptr val)"
+ << be_nl << "{" << be_idt_nl
+ << "this->_pd_value->" << field->local_name ()
+ << " = ::" << bt->name() << "::_duplicate (val);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ this->emit_member_get (vb_node, field, bt, " ::", "_ptr", "const",
+ ".in ()");
+ break;
+ case AST_PredefinedType::PT_any:
+ this->emit_member_set (vb_node, field, bt, "const ::", " &");
+ this->emit_member_get (vb_node, field, bt, "const ::", " &", "const", "");
+ this->emit_member_get (vb_node, field, bt, " ::", " &", "", "");
+ break;
+ case AST_PredefinedType::PT_void:
+ break;
+ default:
+ this->emit_member_set (vb_node, field, bt, " ::", "");
+ this->emit_member_get (vb_node, field, bt, " ::", "", "const", "");
+ break;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ci::visit_sequence (be_sequence *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_valuebox *vb_node = be_valuebox::narrow_from_decl (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 (!field || !vb_node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_field_ci::"
+ "visit_sequence - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_member_set (vb_node, field, bt, "const ", " &");
+ this->emit_member_get (vb_node, field, bt, "const ", " &", "const", "");
+ this->emit_member_get (vb_node, field, bt, "", " &", "", "");
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ci::visit_string (be_string *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_valuebox *vb_node = be_valuebox::narrow_from_decl (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 (!field || !vb_node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_field_ci::"
+ "visit_predefined_type - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_member_set (vb_node, field, bt, "", "");
+ this->emit_member_set (vb_node, field, bt, "const ", "");
+
+ *os << "// Modifier to set the member." << be_nl;
+
+ const char *string_type = "";
+ if (node->node_type () == AST_Decl::NT_string)
+ {
+ string_type = "String";
+ }
+ else if (node->node_type () == AST_Decl::NT_wstring)
+ {
+ string_type = "WString";
+ }
+
+ *os << "ACE_INLINE void" << be_nl
+ << vb_node->name () << "::" << field->local_name ()
+ << " (const ::CORBA::" << string_type << "_var & val)"
+ << be_nl << "{" << be_idt_nl
+ << "this->_pd_value->" << field->local_name ()
+ << " = val;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ this->emit_member_get (vb_node, field, bt, "const ", "", "const", "");
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ci::visit_structure (be_structure *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_valuebox *vb_node = be_valuebox::narrow_from_decl (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 (!field || !vb_node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_field_ci::"
+ "visit_structure - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_member_set (vb_node, field, bt, "const ", " &");
+ this->emit_member_get (vb_node, field, bt, "const ", " &", "const", "");
+ this->emit_member_get (vb_node, field, bt, "", " &", "", "");
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ci::visit_typedef (be_typedef *node)
+{
+ 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_valuebox_field_ci::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_valuebox_field_ci::visit_union (be_union *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_valuebox *vb_node = be_valuebox::narrow_from_decl (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 (!field || !vb_node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_field_ci::"
+ "visit_union - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_member_set (vb_node, field, bt, "const ", " &");
+ this->emit_member_get (vb_node, field, bt, "const ", " &", "const", "");
+ this->emit_member_get (vb_node, field, bt, "", " &", "", "");
+
+ return 0;
+}
+
+void
+be_visitor_valuebox_field_ci::emit_member_set (be_decl *vb_node,
+ be_decl *field,
+ be_type *field_type,
+ const char *const_arg,
+ const char *arg_modifier)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "// Modifier to set the member." << be_nl;
+
+ *os << "ACE_INLINE void" << be_nl
+ << vb_node->name () << "::" << field->local_name ()
+ << " (" << const_arg << field_type->name () << arg_modifier << " val)"
+ << be_nl << "{" << be_idt_nl
+ << "this->_pd_value->" << field->local_name ()
+ << " = val;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+}
+
+void
+be_visitor_valuebox_field_ci::emit_member_get (be_decl *vb_node,
+ be_decl *field,
+ be_type *field_type,
+ const char *const_prefix,
+ const char *type_suffix,
+ const char *const_method,
+ const char *access_modifier)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "/// Accessor to retrieve the member." << be_nl;
+
+ *os << "ACE_INLINE " << const_prefix << field_type->name () << type_suffix
+ << be_nl
+ << vb_node->name () << "::" << field->local_name ()
+ << " (void) " << const_method << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value->" << field->local_name () << access_modifier
+ << ";" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuebox/union_member_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuebox/union_member_ci.cpp
new file mode 100644
index 00000000000..792894f619a
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuebox/union_member_ci.cpp
@@ -0,0 +1,568 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// union_member_ci.cpp
+//
+// = DESCRIPTION
+// Visitor for the Valuebox class.
+// This one generates code for accessor and modifier functions of
+// for valuebox union members.
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+ACE_RCSID (be_visitor_valuebox,
+ union_member_ci,
+ "$Id$")
+
+be_visitor_valuebox_union_member_ci::be_visitor_valuebox_union_member_ci (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_valuebox_union_member_ci::~be_visitor_valuebox_union_member_ci (void)
+{
+}
+
+int
+be_visitor_valuebox_union_member_ci::visit_union_member (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_valuebox_union_member_ci::"
+ "visit_union_member - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ this->ctx_->node (node);
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_union_member_ci::"
+ "visit_union_member - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+// Visit operations on all possible data types that a union member can be
+
+int
+be_visitor_valuebox_union_member_ci::visit_array (be_array *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_valuebox *vb_node = be_valuebox::narrow_from_decl (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 (!field || !vb_node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_union_member_ci::"
+ "visit_array - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ char fname [NAMEBUFSIZE];
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+
+ if (bt->node_type () != AST_Decl::NT_typedef)
+ {
+ // 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 (),
+ 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 << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "/// Modifier to set the member." << be_nl;
+
+ *os << "ACE_INLINE void" << be_nl
+ << vb_node->name () << "::" << field->local_name ()
+ << " (" << fname << " val)" << be_nl
+ << "{" << be_idt_nl
+ << "this->_pd_value->" << field->local_name ()
+ << " (val);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "/// Accessor to retrieve the member." << be_nl;
+
+ *os << "ACE_INLINE const " << fname << "_slice *" << be_nl
+ << vb_node->name () << "::" << field->local_name ()
+ << " (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value->" << field->local_name ()
+ << " ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_union_member_ci::visit_enum (be_enum *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_valuebox *vb_node = be_valuebox::narrow_from_decl (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 (!field || !vb_node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_union_member_ci::"
+ "visit_enum - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+
+ this->emit_member_set (vb_node, field, bt, "", "");
+ this->emit_member_get (vb_node, field, bt, "", "", "const");
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_union_member_ci::visit_interface (be_interface *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_valuebox *vb_node = be_valuebox::narrow_from_decl (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 (!field || !vb_node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_union_member_ci::"
+ "visit_interface - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_member_set (vb_node, field, bt, "", "_ptr");
+ this->emit_member_get (vb_node, field, bt, "", "_ptr", "const");
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_union_member_ci::visit_interface_fwd (be_interface_fwd *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_valuebox *vb_node = be_valuebox::narrow_from_decl (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 (!field || !vb_node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_union_member_ci::"
+ "visit_interface_fwd - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_member_set (vb_node, field, bt, "", "_ptr");
+ this->emit_member_get (vb_node, field, bt, "", "_ptr", "const");
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_union_member_ci::visit_valuetype (be_valuetype *)
+{
+ // Valuetype is not a valid component of a valuebox
+ return 0;
+}
+
+int
+be_visitor_valuebox_union_member_ci::visit_valuetype_fwd (be_valuetype_fwd *)
+{
+ // Valuetype is not a valid component of a valuebox
+ return 0;
+}
+
+int
+be_visitor_valuebox_union_member_ci::visit_predefined_type (be_predefined_type *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_valuebox *vb_node = be_valuebox::narrow_from_decl (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 (!field || !vb_node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_union_member_ci::"
+ "visit_predefined_type - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
+ this->emit_member_set (vb_node, field, bt, " ::", "_ptr");
+ this->emit_member_get (vb_node, field, bt, " ::", "_ptr", "const");
+ break;
+ case AST_PredefinedType::PT_any:
+ this->emit_member_set (vb_node, field, bt, "const ::", " &");
+ this->emit_member_get (vb_node, field, bt, "const ::", " &", "const");
+ this->emit_member_get (vb_node, field, bt, "::", " &", "");
+ break;
+ case AST_PredefinedType::PT_void:
+ break;
+ default:
+ this->emit_member_set (vb_node, field, bt, " ::", "");
+ this->emit_member_get (vb_node, field, bt, " ::", "", "const");
+ break;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_union_member_ci::visit_sequence (be_sequence *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_valuebox *vb_node = be_valuebox::narrow_from_decl (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 (!field || !vb_node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_union_member_ci::"
+ "visit_sequence - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_member_set (vb_node, field, bt, "const ", " &");
+ this->emit_member_get (vb_node, field, bt, "const ", " &", "const");
+ this->emit_member_get (vb_node, field, bt, "", " &", "");
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_union_member_ci::visit_string (be_string *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_valuebox *vb_node = be_valuebox::narrow_from_decl (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 (!field || !vb_node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_union_member_ci::"
+ "visit_predefined_type - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_member_set (vb_node, field, bt, "", "");
+ this->emit_member_set (vb_node, field, bt, "const ", "");
+
+ *os << "// Modifier to set the member." << be_nl;
+
+ const char *string_type = "";
+ if (node->node_type () == AST_Decl::NT_string)
+ {
+ string_type = "String";
+ }
+ else if (node->node_type () == AST_Decl::NT_wstring)
+ {
+ string_type = "WString";
+ }
+
+ *os << "ACE_INLINE void" << be_nl
+ << vb_node->name () << "::" << field->local_name ()
+ << " (const ::CORBA::" << string_type << "_var & val)"
+ << be_nl << "{" << be_idt_nl
+ << "this->_pd_value->" << field->local_name ()
+ << " (val);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ this->emit_member_get (vb_node, field, bt, "const ", "", "const");
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_union_member_ci::visit_structure (be_structure *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_valuebox *vb_node = be_valuebox::narrow_from_decl (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 (!field || !vb_node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_union_member_ci::"
+ "visit_structure - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_member_set (vb_node, field, bt, "const ", " &");
+ this->emit_member_get (vb_node, field, bt, "const ", " &", "const");
+ this->emit_member_get (vb_node, field, bt, "", " &", "");
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_union_member_ci::visit_typedef (be_typedef *node)
+{
+ 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_valuebox_union_member_ci::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_valuebox_union_member_ci::visit_union (be_union *node)
+{
+ be_decl *field = this->ctx_->node ();
+ be_valuebox *vb_node = be_valuebox::narrow_from_decl (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 (!field || !vb_node)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_union_member_ci::"
+ "visit_union - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_member_set (vb_node, field, bt, "const ", " &");
+ this->emit_member_get (vb_node, field, bt, "const ", " &", "const");
+ this->emit_member_get (vb_node, field, bt, "", " &", "");
+
+ return 0;
+}
+
+void
+be_visitor_valuebox_union_member_ci::emit_member_set (be_decl *vb_node,
+ be_decl *field,
+ be_type *field_type,
+ const char *const_arg,
+ const char *arg_modifier)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "// Modifier to set the member." << be_nl;
+
+ *os << "ACE_INLINE void" << be_nl
+ << vb_node->name () << "::" << field->local_name ()
+ << " (" << const_arg << field_type->name () << arg_modifier << " val)"
+ << be_nl << "{" << be_idt_nl
+ << "this->_pd_value->" << field->local_name ()
+ << " (val);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+}
+
+void
+be_visitor_valuebox_union_member_ci::emit_member_get (be_decl *vb_node,
+ be_decl *field,
+ be_type *field_type,
+ const char *const_prefix,
+ const char *type_suffix,
+ const char *const_method)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "/// Accessor to retrieve the member." << be_nl;
+
+ *os << "ACE_INLINE " << const_prefix << field_type->name () << type_suffix
+ << be_nl
+ << vb_node->name () << "::" << field->local_name ()
+ << " (void) " << const_method << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value->" << field->local_name ()
+ << " ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuebox/valuebox.cpp b/TAO/TAO_IDL/be/be_visitor_valuebox/valuebox.cpp
new file mode 100644
index 00000000000..e114bb204e2
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuebox/valuebox.cpp
@@ -0,0 +1,40 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuebox.cpp
+//
+// = DESCRIPTION
+// Visitor for generation of code for valuebox
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuebox,
+ valuebox,
+ "$Id$")
+
+be_visitor_valuebox::be_visitor_valuebox (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_valuebox::~be_visitor_valuebox (void)
+{
+}
+
+// This method must be overridden by the derived valuebox visitors.
+int
+be_visitor_valuebox::visit_valuebox (be_valuebox *)
+{
+ return -1;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_valuebox/valuebox_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuebox/valuebox_ch.cpp
new file mode 100644
index 00000000000..b815e058f82
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuebox/valuebox_ch.cpp
@@ -0,0 +1,863 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuebox_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for valueboxes in the client header
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuebox,
+ valuebox_ch,
+ "$Id: valuebox_ch.cpp Exp")
+
+// ******************************************************
+// Valuebox visitor for client header
+// ******************************************************
+
+be_visitor_valuebox_ch::be_visitor_valuebox_ch (be_visitor_context *ctx)
+ : be_visitor_valuebox (ctx)
+{
+}
+
+be_visitor_valuebox_ch::~be_visitor_valuebox_ch (void)
+{
+}
+
+int
+be_visitor_valuebox_ch::visit_valuebox (be_valuebox *node)
+{
+ // Nothing to do if we are imported or code is already generated.
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ this->ctx_->node (node); // save the node
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ os->gen_ifdef_macro (node->flat_name ());
+
+ *os << be_nl << be_nl
+ << "class " << node->local_name () << ";" ;
+
+ // Generate the _var and _out template class declarations.
+ *os << be_nl << be_nl
+ << "typedef" << be_idt_nl
+ << "TAO_Value_Var_T<" << be_idt << be_idt_nl
+ << node->local_name () << be_uidt_nl
+ << ">" << be_uidt_nl
+ << node->local_name () << "_var;" << be_uidt_nl << be_nl
+ << "typedef" << be_idt_nl
+ << "TAO_Value_Out_T<" << be_idt << be_idt_nl
+ << node->local_name () << be_uidt_nl
+ << ">" << be_uidt_nl
+ << node->local_name () << "_out;" << be_uidt;
+
+ *os << be_nl << be_nl << "class " << be_global->stub_export_macro ()
+ << " " << node->local_name ();
+ *os << be_idt_nl <<": public virtual ::CORBA::DefaultValueRefCountBase";
+
+ *os << be_uidt << be_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl
+ << "typedef " << node->local_name () << " * _ptr_type;" << be_nl
+ << "typedef " << node->local_name () << "_var _var_type;" << be_nl
+ << "typedef " << node->local_name () << "_out _out_type;"
+ << be_nl << be_nl;
+
+ // _downcast method
+ *os << "static " << node->local_name () << "* "
+ << "_downcast ( ::CORBA::ValueBase *);" << be_nl;
+
+ // _copy_value method
+ *os << "::CORBA::ValueBase * _copy_value (void);" << be_nl << be_nl;
+
+ // repository id methods
+ *os << "virtual const char* "
+ << "_tao_obv_repository_id (void) const;"
+ << be_nl << be_nl
+ << "virtual void "
+ << "_tao_obv_truncatable_repo_ids (Repository_Id_List &) const;"
+ << be_nl << be_nl
+ << "static const char* "
+ << "_tao_obv_static_repository_id (void);" << be_nl << be_nl;
+
+ // unmarshal method
+ *os << "static ::CORBA::Boolean _tao_unmarshal (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &," << be_nl
+ << node->local_name () << " *&" << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ be_type *bt = be_type::narrow_from_decl (node->boxed_type ());
+
+ // Emit the type specific elements. The visit_* methods in this
+ // module do that work.
+ if (!bt || (bt->accept (this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%N:%l) be_visitor_valuebox_ch::visit_valuebox - "
+ "type-specific valuebox code generation failed\n"),
+ -1);
+ }
+
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Generate the "protected" destructor
+
+ *os << be_uidt_nl << be_nl << "protected:" << be_idt_nl;
+
+ *os << "virtual ~" << node->local_name () << " (void);" << be_nl;
+
+ // Methods for marshalling and unmarshalling the value
+ *os << "virtual ::CORBA::Boolean "
+ << "_tao_marshal_v (TAO_OutputCDR &) const;" << be_nl;
+ *os << "virtual ::CORBA::Boolean "
+ << "_tao_unmarshal_v (TAO_InputCDR &);" << be_nl;
+ *os << "virtual ::CORBA::Boolean "
+ << "_tao_match_formal_type (ptrdiff_t ) const;" << be_nl;
+
+ // Private unimplemented default assignment operator
+ *os << be_uidt_nl << "private:" << be_idt_nl;
+ *os << "void operator= (const " << node->local_name () << " & val);"
+ << be_nl;
+
+ *os << be_uidt_nl
+ << "};";
+
+ os->gen_endif ();
+
+ // Generate typecode declaration.
+ if (be_global->tc_support ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_typecode_decl visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_ch::"
+ "visit_valuebox - "
+ "TypeCode declaration failed\n"),
+ -1);
+ }
+ }
+
+ // Indicate that code is already generated for this node.
+ node->cli_hdr_gen (true);
+
+ return 0;
+}
+
+
+int
+be_visitor_valuebox_ch::visit_array (be_array *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+
+ this->emit_default_constructor();
+
+ // Public constructor that takes a const array argument
+ this->emit_constructor_one_arg (node, "", "const ", "");
+
+ // Public copy constructor
+ this->emit_copy_constructor ();
+
+ *os << be_nl << "// assignment operator" << be_nl;
+
+ // Public assignment operator that takes a const array argument
+ this->emit_assignment (node, "", "const ", "");
+
+ // Public accessor and modifier methods
+ *os << "// accessors and modifier" << be_nl;
+
+ *os << "const " << node->full_name () << "_slice* "
+ << "_value (void) const;" << be_nl;
+
+ *os << node->full_name () << "_slice* " << "_value (void);" << be_nl;
+
+ *os << "void" << " _value (const " << node->full_name () << " val);"
+ << be_nl << be_nl;
+
+ // Overloaded subscript operators
+ *os << "const " << node->full_name ()
+ << "_slice & operator[] ( ::CORBA::ULong index) const;" << be_nl;
+
+ *os << node->full_name ()
+ << "_slice & operator[] ( ::CORBA::ULong index);" << be_nl << be_nl;
+
+ // Explicit conversion functions
+ *os << "const " << node->full_name () << "_slice * _boxed_in (void) const;"
+ << be_nl;
+
+ *os << node->full_name () << "_slice * _boxed_inout (void);" << be_nl;
+
+ *os << node->full_name () << "_slice * _boxed_out (void);" << be_nl
+ << be_nl;
+
+ // Member variable of underlying type;
+ this->emit_boxed_member_var (node, "_var");
+
+ return 0;
+}
+
+
+int
+be_visitor_valuebox_ch::visit_enum (be_enum *node)
+{
+ return this->emit_for_predef_enum (node, "", false);
+}
+
+
+int
+be_visitor_valuebox_ch::visit_interface (be_interface *node)
+{
+ return this->emit_for_predef_enum (node, "_ptr", false);
+}
+
+
+int
+be_visitor_valuebox_ch::visit_predefined_type (be_predefined_type *node)
+{
+ return this->emit_for_predef_enum (node, "",
+ node->pt () == AST_PredefinedType::PT_any);
+}
+
+
+int
+be_visitor_valuebox_ch::visit_sequence (be_sequence *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ch.
+ be_decl * vb_node = this->ctx_->node ();
+
+ if (node->anonymous ())
+ { // Our sequence is anonymous so we must generate a declaration
+ // for it.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+
+ // First generate the sequence declaration.
+ be_visitor_sequence_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_ch::"
+ "visit_sequence - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ // Retrieve the base type since we will need to do some code
+ // generation for it.
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
+ if (bt == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_ch::"
+ "visit_sequence - "
+ "Bad element type\n"),
+ -1);
+ }
+
+ // Indicate that this type has been used as a sequence element.
+ bt->seen_in_sequence (true);
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ this->emit_default_constructor();
+
+ if (node->unbounded ())
+ {
+ // Public constructor with one argument of type ULong
+ *os << vb_node->local_name () << " ( ::CORBA::ULong max);" << be_nl;
+ }
+
+ // Public constructor for sequence with supplied buffer
+ *os << vb_node->local_name () << " (" << be_idt << be_idt;
+
+ if (node->unbounded ())
+ {
+ *os << be_nl << "::CORBA::ULong max,";
+ }
+
+ *os << be_nl << "::CORBA::ULong length," << be_nl;
+
+ // Generate the base type for the buffer.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_SEQUENCE_BUFFER_TYPE_CH);
+ be_visitor_sequence_buffer_type bt_visitor (&ctx);
+ if (bt->accept (&bt_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%N:%l) be_visitor_valuebox_ch::visit_sequence - "
+ "base type visit failed\n"),
+ -1);
+ }
+
+ *os << " * buf," << be_nl
+ << "::CORBA::Boolean release = false" << be_uidt_nl << ");" << be_uidt_nl;
+
+ // Public constructor with single argument of type const T&
+ this->emit_constructor_one_arg (node, "", "const ", "&");
+
+ // Public copy constructor
+ this->emit_copy_constructor ();
+
+ *os << be_nl << "// assignment operator" << be_nl;
+
+ // Public assignment operator with one argument of type const T&
+ this->emit_assignment (node, "", "const ", "&");
+
+ // Public accessor and modifier methods
+ this->emit_accessor_modifier (node);
+
+ // Access to the boxed value for method signatures
+ this->emit_boxed_access (node, "", "const ", "&", "*");
+
+ // Generate accessors
+
+ // Generate base type for sequence then remainder of operator []
+ if (bt->accept (&bt_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%N:%l) be_visitor_valuebox_ch::"
+ "visit_sequence - "
+ "base type visit failed\n"),
+ -1);
+ }
+ *os << "& operator[] ( ::CORBA::ULong index);" << be_nl;
+
+ // Generate base type for sequence then remainder of operator []
+ *os << "const ";
+ if (bt->accept (&bt_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%N:%l) be_visitor_valuebox_ch::"
+ "visit_sequence - "
+ "base type visit failed\n"),
+ -1);
+ }
+ *os << "& operator[] ( ::CORBA::ULong index) const;" << be_nl << be_nl;
+
+
+ *os << "::CORBA::ULong maximum (void) const;" << be_nl;
+
+ *os << "::CORBA::ULong length (void) const;" << be_nl;
+
+ *os << "void length ( ::CORBA::ULong len);" << be_nl << be_nl;
+
+ // Member variable of underlying type;
+ this->emit_boxed_member_var (node, "_var");
+
+ return 0;
+
+}
+
+
+int
+be_visitor_valuebox_ch::visit_string (be_string *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ const char *string_type;
+ const char *char_type;
+ if (node->node_type () == AST_Decl::NT_string)
+ {
+ string_type = "String";
+ char_type = "char";
+ }
+ else if (node->node_type () == AST_Decl::NT_wstring)
+ {
+ string_type = "WString";
+ char_type = "::CORBA::WChar";
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_ch::visit_string -"
+ "unexpected string node type=%d\n", node->node_type ()));
+ return -1;
+ }
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ch.
+ be_decl * vb_node = this->ctx_->node ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ this->emit_default_constructor();
+
+ this->emit_constructor_one_arg (node, "", "", "");
+
+ // Public constructor with one argument of type const char *
+ this->emit_constructor_one_arg (node, "", "const ", "");
+
+ // Public constructor with one argument of type const CORBA::String_var&
+ *os << vb_node->local_name () << " (const ::CORBA::" << string_type
+ << "_var& var);" << be_nl;
+
+ // Public copy constructor
+ this->emit_copy_constructor ();
+
+ *os << "// assignment operators" << be_nl;
+
+ // Public assignment operator with one argument of type char *
+ this->emit_assignment (node, "", "", "");
+
+ // Public assignment operator with one argument of type const char *
+ this->emit_assignment (node, "", "const ", "");
+
+ // Public assignment operator with one argument of type
+ // const CORBA::String_var&
+ *os << vb_node->local_name () << "& operator= (const ::CORBA::"
+ << string_type << "_var& var);" << be_nl << be_nl;
+
+ *os << "// accessor" << be_nl;
+
+ // Accessor function takes no arguments and returns a const char *
+ *os << "const " << node->full_name ()
+ << " _value (void) const;" << be_nl << be_nl;
+
+ *os << "// modifiers" << be_nl;
+
+ // Modifier function with one argument of type char *
+ *os << "void" << " _value (" << node->full_name () << " val);" << be_nl;
+
+ // Modifier function with one argument of type const char *
+ *os << "void" << " _value (const " << node->full_name () << " val);"
+ << be_nl;
+
+ // Modifier function with one argument of type const CORBA::String_var&
+ *os << "void" << " _value (const ::CORBA::" << string_type << "_var& var);"
+ << be_nl << be_nl;
+
+ // Access to the boxed value for method signatures
+ this->emit_boxed_access (node, "", "const ", "", "");
+
+ // Overloaded subscript operators
+ *os << "// allows access and modification using a slot." << be_nl;
+ *os << char_type << " & operator[] ( ::CORBA::ULong slot);" << be_nl << be_nl;
+
+ *os << "// allows only accessing thru a slot." << be_nl;
+ *os << char_type << " operator[] ( ::CORBA::ULong slot) const;" << be_nl;
+
+
+ // Member variable of underlying type;
+ *os << be_uidt_nl << "private:" << be_idt_nl;
+
+ *os << "::CORBA::" << string_type << "_var" << " _pd_value;" << be_nl;
+
+ return 0;
+}
+
+
+int
+be_visitor_valuebox_ch::visit_structure (be_structure *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ this->emit_default_constructor();
+
+ // Public constructor with one argument of const T&
+ this->emit_constructor_one_arg (node, "", "const ", "&");
+
+ // Public copy constructor
+ this->emit_copy_constructor ();
+
+ *os << be_nl << "// assignment operator" << be_nl;
+
+ // Public assignment operator with one argument of type const T&
+ this->emit_assignment (node, "", "const ", "&");
+
+ // Public accessor and modifier methods
+ this->emit_accessor_modifier (node);
+
+ // Access to the boxed value for method signatures
+ if (node->size_type() == AST_Type::FIXED)
+ {
+ this->emit_boxed_access (node, "", "const ", "&", "");
+ }
+ else
+ {
+ this->emit_boxed_access (node, "", "const ", "&", "*");
+ }
+
+ // Now generate the accessor and modifier functions for each struct
+ // member. These functions have the same signatures as
+ // acessor and modifier functions for union members.
+
+ AST_Decl *d;
+ AST_Field *field;
+ be_type *bt;
+ be_visitor_context ctx (*this->ctx_);
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ d = si.item ();
+
+ if (d == 0 || (field = AST_Field::narrow_from_decl (d)) == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_ch::visit_structure -"
+ "bad node in this scope\n"));
+ break;
+ }
+
+ bt = be_type::narrow_from_decl (field->field_type ());
+
+ // Set the node to be visited
+ ctx.node (be_decl::narrow_from_decl (d));
+
+ // Create a visitor and use that to process the type.
+ be_visitor_valuebox_field_ch visitor (&ctx);
+ if (bt->accept (&visitor) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_ch::visit_structure"
+ " - codegen for struct type failed\n"));
+ }
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Member variable of underlying type;
+ this->emit_boxed_member_var (node, "_var");
+
+ return 0;
+
+
+}
+
+
+int
+be_visitor_valuebox_ch::visit_typedef (be_typedef *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_valuebox_ch::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+
+int
+be_visitor_valuebox_ch::visit_union (be_union *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ this->emit_default_constructor();
+
+ // Public constructor with single argument of type const T&
+ this->emit_constructor_one_arg (node, "", "const ", "&");
+
+ // Public copy constructor
+ this->emit_copy_constructor ();
+
+ *os << be_nl << "// assignment operator" << be_nl;
+
+ // Public assignment operator with one argument of type const T&
+ this->emit_assignment (node, "", "const ", "&");
+
+ // Public accessor and modifier methods
+ this->emit_accessor_modifier (node);
+
+ // Access to the boxed value for method signatures
+ if (node->size_type() == AST_Type::FIXED)
+ {
+ this->emit_boxed_access (node, "", "const ", "&", "");
+ }
+ else
+ {
+ this->emit_boxed_access (node, "", "const ", "&", "*");
+ }
+
+ // Now generate the accessor and modifier functions for each union
+ // member.
+
+ AST_Decl *d;
+ AST_Field *field;
+ be_type *bt;
+ be_visitor_context ctx (*this->ctx_);
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ d = si.item ();
+
+ if (d == 0 || (field = AST_Field::narrow_from_decl (d)) == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_ch::visit_union -"
+ "bad node in this scope\n"));
+ break;
+ }
+
+ bt = be_type::narrow_from_decl (field->field_type ());
+
+ // Set the node to be visited
+ ctx.node (be_decl::narrow_from_decl (d));
+
+ // Create a visitor and use that to process the type.
+ be_visitor_valuebox_field_ch visitor (&ctx);
+ if (bt->accept (&visitor) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_ch::visit_union"
+ " - codegen for struct type failed\n"));
+ }
+ }
+
+ // Retrieve the disriminant type.
+ bt = be_type::narrow_from_decl (node->disc_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_ch::visit_union - "
+ "bad disciminant type\n"),
+ -1);
+ }
+
+ // The discriminant type may have to be defined here if it was an enum
+ // declaration inside of the union statement.
+
+ be_visitor_union_discriminant_ch ud_visitor (&ctx);
+
+ 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);
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+
+ // Member variable of underlying type;
+ this->emit_boxed_member_var (node, "_var");
+
+ return 0;
+}
+
+
+int
+be_visitor_valuebox_ch::emit_for_predef_enum(be_type *node,
+ const char * type_suffix,
+ bool is_any)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ this->emit_default_constructor ();
+
+ if (is_any)
+ {
+ this->emit_constructor_one_arg (node, "", "const ", "&");
+ }
+ else
+ { // Public constructor with one argument of underlying type
+ this->emit_constructor_one_arg (node, type_suffix, "", "");
+ }
+
+ // Public copy constructor
+ this->emit_copy_constructor ();
+
+ *os << be_nl << "// assignment operator" << be_nl;
+
+ if (is_any)
+ { // Public assignment operator with one argument of type const T&
+ this->emit_assignment (node, "", "const ::", "&");
+
+ this->emit_accessor_modifier (node);
+
+ // Access to the boxed value for method signatures
+ this->emit_boxed_access (node, "", "const ::", "&", "*");
+
+ // Member variable of underlying type;
+ this->emit_boxed_member_var (node, "_var");
+ }
+ else
+ { // Public assignment operator with one argument of underlying type
+ this->emit_assignment (node, type_suffix, "", "");
+
+ // Public accessor and modifier methods
+ *os << "// accessor and modifier" << be_nl;
+
+ *os << node->full_name () << type_suffix
+ << " _value (void) const;" << be_nl;
+
+ *os << "void" << " _value (" << node->full_name () << type_suffix
+ << " val);" << be_nl << be_nl;
+
+ // Access to the boxed value for method signatures
+ this->emit_boxed_access (node, type_suffix, "", "", "");
+
+ // Member variable of underlying type;
+ this->emit_boxed_member_var (node, type_suffix);
+ }
+
+ return 0;
+}
+
+void
+be_visitor_valuebox_ch::emit_default_constructor (void)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ch.
+ be_decl * vb_node = this->ctx_->node ();
+
+ *os << be_nl << be_nl << "// constructors" << be_nl;
+
+ // Public default constructor
+ *os << vb_node->local_name () << " (void);" << be_nl;
+}
+
+void
+be_visitor_valuebox_ch::emit_constructor_one_arg (be_decl *node,
+ const char * type_suffix,
+ const char * const_prefix,
+ const char * ref_modifier)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ch.
+ be_decl * vb_node = this->ctx_->node ();
+
+ // Public constructor with one argument of underlying type
+ *os << vb_node->local_name () << " (" << const_prefix << node->full_name ()
+ << type_suffix << ref_modifier << " val);" << be_nl;
+}
+
+void
+be_visitor_valuebox_ch::emit_copy_constructor (void)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ch.
+ be_decl * vb_node = this->ctx_->node ();
+
+ // Public Copy constructor
+ *os << vb_node->local_name ()
+ << " (const " << vb_node->local_name () << "& val);" << be_nl;
+}
+
+void
+be_visitor_valuebox_ch::emit_assignment (be_decl *node,
+ const char * type_suffix,
+ const char * const_prefix,
+ const char * ref_modifier)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ch.
+ be_decl * vb_node = this->ctx_->node ();
+
+ *os << vb_node->local_name () << "& operator= (" << const_prefix
+ << node->full_name () << type_suffix << ref_modifier << " val);"
+ << be_nl << be_nl;
+}
+
+
+void
+be_visitor_valuebox_ch::emit_boxed_access (be_decl *node,
+ const char * type_suffix,
+ const char *const_prefix,
+ const char *in_ref_modifier,
+ const char *out_ref_modifier)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "// access to the boxed value for method signatures" << be_nl;
+
+ // Access to the boxed value for method signatures
+ *os << const_prefix << node->full_name () << type_suffix << in_ref_modifier
+ << " _boxed_in (void) const;" << be_nl;
+
+ *os << node->full_name () << type_suffix << "&"
+ << " _boxed_inout (void);" << be_nl;
+
+ *os << node->full_name () << type_suffix << out_ref_modifier << "&"
+ << " _boxed_out (void);" << be_nl;
+
+}
+
+
+
+
+void
+be_visitor_valuebox_ch::emit_accessor_modifier (be_decl *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "// accessors and modifier" << be_nl;
+
+ // Public accessor method (const)
+ *os << "const " << node->full_name () << "& _value (void) const;" << be_nl;
+
+ // Public accessor method
+ *os << node->full_name () << "& _value (void);" << be_nl;
+
+ // Public modifier method
+ *os << "void" << " _value (const " << node->full_name () << "& val);"
+ << be_nl << be_nl;
+}
+
+
+void
+be_visitor_valuebox_ch::emit_boxed_member_var (be_decl *node,
+ const char * type_suffix)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Member variable of underlying type;
+ *os << be_uidt_nl << "private:" << be_idt_nl;
+
+ *os << node->full_name () << type_suffix << " _pd_value;" << be_nl;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuebox/valuebox_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuebox/valuebox_ci.cpp
new file mode 100644
index 00000000000..8cefbec6f19
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuebox/valuebox_ci.cpp
@@ -0,0 +1,879 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuebox_ci.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for valueboxes in the client inline file
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuebox,
+ valuebox_ci,
+ "$Id: valuebox_ci.cpp Exp")
+
+be_visitor_valuebox_ci::be_visitor_valuebox_ci (be_visitor_context *ctx)
+ : be_visitor_valuebox (ctx)
+{
+}
+
+be_visitor_valuebox_ci::~be_visitor_valuebox_ci (void)
+{
+}
+
+int
+be_visitor_valuebox_ci::visit_valuebox (be_valuebox *node)
+{
+ // Nothing to do if we are imported or code is already generated.
+ if (node->imported () || node->cli_inline_gen ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ this->ctx_->node (node); // save the node
+
+ be_type *bt = be_type::narrow_from_decl (node->boxed_type ());
+
+ // Emit the type specific elements. The visit_* methods in this
+ // module do that work.
+ if (!bt || (bt->accept (this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%N:%l) be_visitor_valuebox_ci::visit_valuebox - "
+ "type-specific valuebox code generation failed\n"),
+ -1);
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+
+ *os << "ACE_INLINE const char* " << be_nl
+ << node->name () << "::_tao_obv_static_repository_id ()" << be_nl
+ << "{" << be_idt_nl
+ << "return \"" << node->repoID () << "\";" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Indicate that code is already generated for this node.
+ node->cli_inline_gen (true);
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_ci::visit_array (be_array *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ch.
+ be_decl * vb_node = this->ctx_->node ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Public default constructor
+ *os << "ACE_INLINE" << be_nl
+ << vb_node->name () << "::" << vb_node->local_name () << " (void)"
+ << be_nl << "{" << be_idt_nl
+ << "this->_pd_value = " << node->full_name () << "_alloc ();"
+ << be_uidt_nl << "}" << be_nl << be_nl;
+
+ // Public constructor that takes a const array argument
+ *os << "ACE_INLINE" << be_nl
+ << vb_node->name () << "::" << vb_node->local_name () << " (const "
+ << node->full_name () << " val)" << be_nl
+ << "{" << be_idt_nl
+ << "this->_pd_value = " << node->full_name () << "_dup (val);"
+ << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Public copy constructor
+ *os << "ACE_INLINE" << be_nl
+ << vb_node->name () << "::" << vb_node->local_name () << " (const "
+ << vb_node->local_name () << "& val)" << be_idt_nl
+ << ": ::CORBA::ValueBase (val)," << be_nl
+ << " ::CORBA::DefaultValueRefCountBase (val)"
+ << be_uidt_nl
+ << "{" << be_idt_nl
+ << "this->_pd_value = " << node->full_name ()
+ << "_dup (val._pd_value.in ());" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Public assignment operator that takes a const array argument
+ *os << "ACE_INLINE " << vb_node->name () << " &" << be_nl
+ << vb_node->name () << "::operator= (const "
+ << node->full_name () << " val)" << be_nl
+ << "{" << be_idt_nl
+ << "this->_pd_value = " << node->full_name ()
+ << "_dup (val);" << be_nl
+ << "return *this;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Public accessor and modifier methods
+ *os << "ACE_INLINE const " << node->full_name () << "_slice*" << be_nl
+ << vb_node->name () << "::_value (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value.in ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "ACE_INLINE " << node->full_name () << "_slice*" << be_nl
+ << vb_node->name () << "::_value (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value.inout ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "ACE_INLINE void" << be_nl
+ << vb_node->name () << "::_value (const " << node->full_name ()
+ << " val)" << be_nl
+ << "{" << be_idt_nl
+ << "this->_pd_value = " << node->full_name () << "_dup (val);"
+ << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Overloaded subscript operators
+ *os << "ACE_INLINE const " << node->full_name () << "_slice &" << be_nl
+ << vb_node->name () << "::operator[] ( ::CORBA::ULong index) const"
+ << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value[index];" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "ACE_INLINE "<< node->full_name () << "_slice &" << be_nl
+ << vb_node->name () << "::operator[] ( ::CORBA::ULong index)" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value[index];" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Explicit conversion functions
+ *os << "ACE_INLINE const " << node->full_name () << "_slice *" << be_nl
+ << vb_node->name () << "::_boxed_in (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value.in ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "ACE_INLINE " << node->full_name () << "_slice *" << be_nl
+ << vb_node->name () << "::_boxed_inout (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value.inout ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "ACE_INLINE " << node->full_name () << "_slice *" << be_nl
+ << vb_node->name () << "::_boxed_out (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value.out ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_ci::visit_enum (be_enum *node)
+{
+ return this->emit_for_predef_enum (node, "", false);
+}
+
+int
+be_visitor_valuebox_ci::visit_interface (be_interface *node)
+{
+ return this->emit_for_predef_enum (node, "_ptr", false);
+}
+
+int
+be_visitor_valuebox_ci::visit_predefined_type (be_predefined_type *node)
+{
+ const char *marshal_arg;
+ bool is_any = false;
+
+ switch (node->pt())
+ {
+ case AST_PredefinedType::PT_boolean:
+ marshal_arg = "::ACE_OutputCDR::from_boolean (this->_pd_value)";
+ break;
+
+ case AST_PredefinedType::PT_char:
+ marshal_arg = "::ACE_OutputCDR::from_char (this->_pd_value)";
+ break;
+
+ case AST_PredefinedType::PT_wchar:
+ marshal_arg = "::ACE_OutputCDR::from_wchar (this->_pd_value)";
+ break;
+
+ case AST_PredefinedType::PT_octet:
+ marshal_arg = "::ACE_OutputCDR::from_octet (this->_pd_value)";
+ break;
+
+ case AST_PredefinedType::PT_any:
+ marshal_arg = "this->_pd_value.in ()";
+ is_any = true;
+ break;
+
+ default:
+ marshal_arg = "this->_pd_value";
+ break;
+ }
+
+ return this->emit_for_predef_enum (node, "", is_any);
+}
+
+int
+be_visitor_valuebox_ci::visit_sequence (be_sequence *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ch.
+ be_decl * vb_node = this->ctx_->node ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_default_constructor_alloc (node);
+ this->emit_constructor_one_arg_alloc (node);
+ this->emit_copy_constructor_alloc (node);
+ this->emit_assignment_alloc (node);
+ this->emit_accessor_modifier (node);
+ this->emit_boxed_access(node, "*");
+
+ // Generate maximum() accessor
+ *os << "ACE_INLINE ::CORBA::ULong " << be_nl
+ << vb_node->name () << "::maximum (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value->maximum ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Generate length() accessor
+ *os << "ACE_INLINE ::CORBA::ULong " << be_nl
+ << vb_node->name () << "::length (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value->length ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Generate length() setter
+ *os << "ACE_INLINE void " << be_nl
+ << vb_node->name () << "::length ( ::CORBA::ULong length)" << be_nl
+ << "{" << be_idt_nl
+ << "this->_pd_value->length (length);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_ci::visit_string (be_string *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ const char *string_type;
+ const char *char_type;
+ if (node->node_type () == AST_Decl::NT_string)
+ {
+ string_type = "String";
+ char_type = "::CORBA::Char";
+ }
+ else if (node->node_type () == AST_Decl::NT_wstring)
+ {
+ string_type = "WString";
+ char_type = "::CORBA::WChar";
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_ci::visit_string -"
+ "unexpected string node type=%d\n", node->node_type ()));
+ return -1;
+ }
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ch.
+ be_decl * vb_node = this->ctx_->node ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_default_constructor ();
+ this->emit_constructor_one_arg (node, "");
+ this->emit_copy_constructor ();
+ this->emit_assignment (node, "");
+
+ // Public constructor with one const argument of underlying type
+ *os << "ACE_INLINE " << be_nl
+ << vb_node->name () << "::" << vb_node->local_name () << " (const "
+ << node->full_name () << " val)" << be_nl
+ << "{" << be_idt_nl
+ << "this->_pd_value = val;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+
+ // Public constructor with one argument of type const CORBA::String_var&
+ *os << "ACE_INLINE" << be_nl
+ << vb_node->name () << "::" << vb_node->local_name ()
+ << " (const ::CORBA::" << string_type << "_var& var)" << be_nl
+ << "{" << be_idt_nl
+ << "this->_pd_value = var;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Public assignment operator with one argument of type const char *
+ *os << "ACE_INLINE " << vb_node->name () << " &" << be_nl
+ << vb_node->name () << "::operator= (const "
+ << node->full_name () << " val)" << be_nl
+ << "{" << be_idt_nl
+ << "this->_pd_value = val;" << be_nl
+ << "return *this;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Public assignment operator with one argument of type
+ // const CORBA::String_var&
+ *os << "ACE_INLINE " << vb_node->name () << " &" << be_nl
+ << vb_node->name () << "::operator= (const ::CORBA::"
+ << string_type << "_var& var)"
+ << be_nl
+ << "{" << be_idt_nl
+ << "this->_pd_value = var;" << be_nl
+ << "return *this;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Accessor function takes no arguments and returns a const char *
+ *os << "ACE_INLINE const " << node->full_name () << be_nl
+ << vb_node->name () << "::_value (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value.in ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Modifier function with one argument of type char *
+ *os << "ACE_INLINE void" << be_nl
+ << vb_node->name () << "::_value ("
+ << node->full_name () << " val)" << be_nl
+ << "{" << be_idt_nl
+ << "this->_pd_value = val;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Modifier function with one argument of type const char *
+ *os << "ACE_INLINE void" << be_nl
+ << vb_node->name () << "::_value (const "
+ << node->full_name () << " val)" << be_nl
+ << "{" << be_idt_nl
+ << "this->_pd_value = val;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Modifier function with one argument of type const CORBA::String_var&
+ *os << "ACE_INLINE void" << be_nl
+ << vb_node->name () << "::_value (const ::CORBA::" << string_type
+ << "_var& var)" << be_nl
+ << "{" << be_idt_nl
+ << "this->_pd_value = var;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Access to the boxed value for method signatures
+ *os << "ACE_INLINE const " << node->full_name () << be_nl
+ << vb_node->name () << "::_boxed_in (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value.in ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "ACE_INLINE " << node->full_name () << "&" << be_nl
+ << vb_node->name () << "::_boxed_inout (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value.inout ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "ACE_INLINE " << node->full_name () << "&" << be_nl
+ << vb_node->name () << "::_boxed_out (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value.out ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Overloaded subscript operators
+ *os << "ACE_INLINE " << char_type << " &" << be_nl
+ << vb_node->name () << "::operator[] ( ::CORBA::ULong slot)" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value[slot];" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "ACE_INLINE " << char_type << be_nl
+ << vb_node->name () << "::operator[] ( ::CORBA::ULong slot) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value[slot];" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_ci::visit_structure (be_structure *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ch.
+ be_decl * vb_node = this->ctx_->node ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_default_constructor_alloc (node);
+ this->emit_constructor_one_arg_alloc (node);
+ this->emit_copy_constructor_alloc (node);
+ this->emit_assignment_alloc (node);
+ this->emit_accessor_modifier (node);
+ // Access to the boxed value for method signatures
+ if (node->size_type() == AST_Type::FIXED)
+ {
+ this->emit_boxed_access (node, "");
+ }
+ else
+ {
+ this->emit_boxed_access (node, "*");
+ }
+
+ // Now generate the accessor and modifier functions for each struct
+ // member. These functions have the same signatures as
+ // acessor and modifier functions for union members.
+ AST_Decl *d;
+ be_field *field;
+ be_visitor_context ctx (*this->ctx_);
+ ctx.scope (vb_node);
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ d = si.item ();
+
+ if (d == 0 || (field = be_field::narrow_from_decl (d)) == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_cs::visit_structure -"
+ "bad node in this scope\n"));
+ break;
+ }
+
+ // Create a visitor and use that to process the field type.
+ be_visitor_valuebox_field_ci visitor (&ctx);
+ ctx.node (field);
+
+ if (visitor.visit_field (field) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_cs::visit_structure - "
+ "visit_field failed\n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_ci::visit_typedef (be_typedef *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_valuebox_ci::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_ci::visit_union (be_union *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ci.
+ be_decl * vb_node = this->ctx_->node ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_default_constructor_alloc (node);
+ this->emit_constructor_one_arg_alloc (node);
+ this->emit_copy_constructor_alloc (node);
+ this->emit_assignment_alloc (node);
+ this->emit_accessor_modifier (node);
+ if (node->size_type() == AST_Type::FIXED)
+ {
+ this->emit_boxed_access (node, "");
+ }
+ else
+ {
+ this->emit_boxed_access (node, "*");
+ }
+
+ // Now generate the accessor and modifier functions for each union
+ // member.
+ AST_Decl *d;
+ be_union_branch *member;
+ be_visitor_context ctx (*this->ctx_);
+ ctx.scope (vb_node);
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ d = si.item ();
+
+ if (d == 0 || (member = be_union_branch::narrow_from_decl (d)) == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_ci::visit_union -"
+ "bad node in this scope\n"));
+ break;
+ }
+
+ // Create a visitor and use that to process the union member type.
+ be_visitor_valuebox_union_member_ci visitor (&ctx);
+ ctx.node (member);
+
+ if (visitor.visit_union_member (member) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_cs::visit_structure - "
+ "visit_field failed\n"
+ ), -1);
+ }
+ }
+
+
+ // Retrieve the disriminant type.
+ be_type *bt;
+ bt = be_type::narrow_from_decl (node->disc_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_ci::visit_union - "
+ "bad disciminant type\n"),
+ -1);
+ }
+
+
+ // Generate modifier and accessor for discriminant
+ *os << "ACE_INLINE void " << be_nl
+ << vb_node->name () << "::_d (" << bt->nested_type_name (node) << " val)"
+ << be_nl
+ << "{" << be_idt_nl
+ << "this->_pd_value->_d (val);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "ACE_INLINE " << bt->nested_type_name (node) << be_nl
+ << vb_node->name () << "::_d (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value->_d ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ return 0;
+}
+
+
+
+int
+be_visitor_valuebox_ci::emit_for_predef_enum (be_type *node,
+ const char * type_suffix,
+ bool is_any)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ci.
+ be_decl * vb_node = this->ctx_->node ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ if (is_any)
+ {
+ this->emit_default_constructor_alloc (node);
+ this->emit_copy_constructor_alloc (node);
+ this->emit_constructor_one_arg_alloc (node);
+ this->emit_assignment_alloc (node);
+ this->emit_accessor_modifier (node);
+ this->emit_boxed_access (node, "*");
+ }
+ else
+ {
+ this->emit_default_constructor ();
+ this->emit_copy_constructor ();
+ this->emit_constructor_one_arg (node, type_suffix);
+ this->emit_assignment (node, type_suffix);
+
+ // Public accessor method
+ *os << "ACE_INLINE " << node->full_name () << type_suffix << be_nl
+ << vb_node->name () << "::_value (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Public modifier method
+ *os << "ACE_INLINE void" << be_nl
+ << vb_node->name () << "::_value ("
+ << node->full_name ()
+ << type_suffix << " val)" << be_nl
+ << "{" << be_idt_nl
+ << "this->_pd_value = val;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Explicit conversion functions
+ *os << "ACE_INLINE " << node->full_name () << type_suffix << be_nl
+ << vb_node->name () << "::_boxed_in (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "ACE_INLINE " << node->full_name () << type_suffix << "&" << be_nl
+ << vb_node->name () << "::_boxed_inout (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "ACE_INLINE " << node->full_name () << type_suffix << "&" << be_nl
+ << vb_node->name () << "::_boxed_out (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ }
+
+ return 0;
+}
+
+void
+be_visitor_valuebox_ci::emit_default_constructor (void)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ci.
+ be_decl * vb_node = this->ctx_->node ();
+
+ // Public default constructor
+ *os << "ACE_INLINE" << be_nl;
+ *os << vb_node->name () << "::" << vb_node->local_name ()
+ << " (void)" << be_nl;
+ *os << "{}" << be_nl << be_nl;
+}
+
+void
+be_visitor_valuebox_ci::emit_default_constructor_alloc (be_decl *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ci
+ be_decl * vb_node = this->ctx_->node ();
+ bool node_not_pod =
+ be_type::narrow_from_decl (node)->size_type () == AST_Type::VARIABLE;
+
+ // Public default constructor
+ *os << "ACE_INLINE " << be_nl
+ << vb_node->name () << "::" << vb_node->local_name () << " (void)"
+ << be_nl << "{" << be_idt_nl
+ << node->full_name () << "* p = 0;" << be_nl
+ << "ACE_NEW (" << be_idt_nl
+ << "p," << be_nl
+ << node->full_name ()
+ << (node_not_pod ? " ()" : "") << ");" << be_uidt_nl
+ << "this->_pd_value = p;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+}
+
+void
+be_visitor_valuebox_ci::emit_constructor_one_arg (be_decl *node,
+ const char * type_suffix)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ci.
+ be_decl * vb_node = this->ctx_->node ();
+
+ // Public constructor with one argument of underlying type
+ *os << "ACE_INLINE " << be_nl
+ << vb_node->name () << "::" << vb_node->local_name () << " ("
+ << node->full_name () << type_suffix << " val)" << be_nl
+ << "{" << be_idt_nl
+ << "this->_pd_value = val;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+}
+
+void
+be_visitor_valuebox_ci::emit_constructor_one_arg_alloc (be_decl *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ci.
+ be_decl * vb_node = this->ctx_->node ();
+
+ // Public constructor with single argument of type const T&
+ *os << "ACE_INLINE " << be_nl
+ << vb_node->name () << "::" << vb_node->local_name ()
+ << " (const " << node->full_name () << "& value)" << be_nl
+ << "{" << be_idt_nl
+ << node->full_name () << "* p = 0;" << be_nl
+ << "ACE_NEW (" << be_idt_nl
+ << "p," << be_nl
+ << node->full_name () << " (value));" << be_uidt_nl
+ << "this->_pd_value = p;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+}
+
+void
+be_visitor_valuebox_ci::emit_copy_constructor (void)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ci.
+ be_decl * vb_node = this->ctx_->node ();
+
+ // Public Copy constructor
+ *os << "ACE_INLINE " << be_nl
+ << vb_node->name () << "::" << vb_node->local_name ()
+ << " (const " << vb_node->full_name () << "& val)" << be_idt_nl
+ << ": ::CORBA::ValueBase (val)," << be_nl
+ << " ::CORBA::DefaultValueRefCountBase (val)"
+ << be_uidt_nl
+ << "{" << be_idt_nl
+ << "this->_pd_value = val._pd_value;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+}
+
+void
+be_visitor_valuebox_ci::emit_copy_constructor_alloc (be_decl *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ci.
+ be_decl * vb_node = this->ctx_->node ();
+
+ // Public copy constructor
+ *os << "ACE_INLINE " << be_nl
+ << vb_node->name () << "::" << vb_node->local_name () << " (const "
+ << vb_node->full_name () << "& val)" << be_idt_nl
+ << ": ::CORBA::ValueBase (val)," << be_nl
+ << " ::CORBA::DefaultValueRefCountBase (val)"
+ << be_uidt_nl
+ << "{" << be_idt_nl
+ << node->full_name () << "* p = 0;" << be_nl
+ << "ACE_NEW (" << be_idt_nl
+ << "p," << be_nl
+ << node->full_name () << " (val._pd_value.in ()));" << be_uidt_nl
+ << "this->_pd_value = p;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+}
+
+
+void
+be_visitor_valuebox_ci::emit_assignment (be_decl *node,
+ const char * type_suffix)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ci.
+ be_decl * vb_node = this->ctx_->node ();
+
+ // Public assignment operator with one argument of underlying type
+ *os << "ACE_INLINE " << vb_node->name () << " &" << be_nl
+ << vb_node->name () << "::operator= ("
+ << node->full_name () << type_suffix << " val)" << be_nl
+ << "{" << be_idt_nl
+ << "this->_pd_value = val;" << be_nl
+ << "return *this;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+}
+
+void
+be_visitor_valuebox_ci::emit_assignment_alloc (be_decl *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ci.
+ be_decl * vb_node = this->ctx_->node ();
+
+ // Public assignment operator with one argument of type const T&
+ *os << "ACE_INLINE " << vb_node->name () << " &" << be_nl
+ << vb_node->name () << "::operator= (const "
+ << node->full_name () << "& value)" << be_nl
+ << "{" << be_idt_nl
+ << node->full_name () << "* p = 0;" << be_nl
+ << "ACE_NEW_RETURN (" << be_idt_nl
+ << "p," << be_nl
+ << node->full_name () << " (value)," << be_nl
+ << "*this);" << be_uidt_nl << be_nl
+ << "this->_pd_value = p;" << be_nl
+ << "return *this;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+}
+
+
+void
+be_visitor_valuebox_ci::emit_accessor_modifier (be_decl *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ci.
+ be_decl * vb_node = this->ctx_->node ();
+
+ // Public accessor method (const)
+ *os << "ACE_INLINE const " << node->full_name () << " &" << be_nl
+ << vb_node->name () << "::_value (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value.in ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Public accessor method
+ *os << "ACE_INLINE " << node->full_name () << " &" << be_nl
+ << vb_node->name () << "::_value (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value.inout ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Public modifier method
+ *os << "ACE_INLINE void" << be_nl
+ << vb_node->name () << "::_value (const "
+ << node->full_name () << "& value)" << be_nl
+ << "{" << be_idt_nl
+ << node->full_name () << "* p = 0;" << be_nl
+ << "ACE_NEW (" << be_idt_nl
+ << "p," << be_nl
+ << node->full_name () << " (value));" << be_uidt_nl
+ << "this->_pd_value = p;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+}
+
+void
+be_visitor_valuebox_ci::emit_boxed_access (be_decl *node,
+ const char *out_ref_modifier)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_ci.
+ be_decl * vb_node = this->ctx_->node ();
+
+ // Access to the boxed value for method signatures
+ *os << "ACE_INLINE const " << node->full_name () << " &" << be_nl
+ << vb_node->name () << "::_boxed_in (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value.in ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "ACE_INLINE " << node->full_name () << "&" << be_nl
+ << vb_node->name () << "::_boxed_inout (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value.inout ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "ACE_INLINE " << node->full_name ()
+ << out_ref_modifier << "&" << be_nl
+ << vb_node->name () << "::_boxed_out (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_pd_value.out ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuebox/valuebox_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuebox/valuebox_cs.cpp
new file mode 100644
index 00000000000..f67657fbad5
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuebox/valuebox_cs.cpp
@@ -0,0 +1,653 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuebox_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for valueboxes in the client stub file
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuebox,
+ valuebox_cs,
+ "$Id: valuebox_cs.cpp Exp")
+
+be_visitor_valuebox_cs::be_visitor_valuebox_cs (be_visitor_context *ctx)
+ : be_visitor_valuebox (ctx)
+{
+}
+
+be_visitor_valuebox_cs::~be_visitor_valuebox_cs (void)
+{
+}
+
+int
+be_visitor_valuebox_cs::visit_valuebox (be_valuebox *node)
+{
+ // Nothing to do if we are imported or code is already generated.
+ if (node->cli_stub_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ if (be_global->tc_support ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+ TAO::be_visitor_alias_typecode visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_cs::"
+ "visit_valuebox - "
+ "TypeCode definition failed\n"),
+ -1);
+ }
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ this->ctx_->node (node); // save the node
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ if (node->is_defined ())
+ {
+ *os << be_nl << be_nl
+ << "void" << be_nl
+ << "TAO::Value_Traits<" << node->name () << ">::add_ref ("
+ << be_idt << be_idt_nl
+ << node->name () << " * p" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::add_ref (p);" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "void" << be_nl
+ << "TAO::Value_Traits<" << node->name () << ">::remove_ref ("
+ << be_idt << be_idt_nl
+ << node->name () << " * p" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::remove_ref (p);" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "void" << be_nl
+ << "TAO::Value_Traits<" << node->name () << ">::release ("
+ << be_idt << be_idt_nl
+ << node->name () << " * p" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::remove_ref (p);" << be_uidt_nl
+ << "}";
+ }
+
+ // The _downcast method.
+ *os << be_nl << be_nl
+ << node->name () << " *" << be_nl
+ << node->name () << "::_downcast ( ::CORBA::ValueBase *v)" << be_nl
+ << "{" << be_idt_nl
+ << "return dynamic_cast< ::" << node->name () << " * > (v);"
+ << be_uidt_nl << "}" << be_nl << be_nl;
+
+ // _copy_value method
+ *os << "::CORBA::ValueBase *" << be_nl
+ << node->name () << "::_copy_value (void)" << be_nl
+ << "{" << be_idt_nl
+ << "::CORBA::ValueBase *result = 0;" << be_nl
+ << "ACE_NEW_RETURN (" << be_idt_nl
+ << "result," << be_nl
+ << node->local_name () << " (*this)," << be_nl
+ << "0);" << be_nl << be_uidt_nl
+ << "return result;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // The _tao_obv_repository_id method.
+ *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;
+
+ *os << "void" << be_nl
+ << node->name () << "::_tao_obv_truncatable_repo_ids (Repository_Id_List& ids) const" << be_nl
+ << "{" << be_idt_nl
+ << "ids.push_back (this->_tao_obv_static_repository_id ());" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // _tao_match_formal_type method. Generated because ValueBase interface
+ // requires it. Since value boxes do not support inheritence, this can
+ // simply return true.
+ *os << "::CORBA::Boolean " << be_nl
+ << node->name ()
+ << "::_tao_match_formal_type (ptrdiff_t ) const" << be_nl
+ << "{" << be_idt_nl
+ << "return true;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ AST_Type * at = node->boxed_type()->unaliased_type();
+ be_type *bt = be_type::narrow_from_decl (at);
+ bool is_array = false;
+
+ const char * unmarshal_arg;
+ be_predefined_type *bpt = be_predefined_type::narrow_from_decl (bt);
+ if (bpt != 0)
+ {
+ switch (bpt->pt())
+ {
+ case AST_PredefinedType::PT_boolean:
+ unmarshal_arg = "::ACE_InputCDR::to_boolean (vb_object->_pd_value)";
+ break;
+
+ case AST_PredefinedType::PT_char:
+ unmarshal_arg = "::ACE_InputCDR::to_char (vb_object->_pd_value)";
+ break;
+
+ case AST_PredefinedType::PT_wchar:
+ unmarshal_arg = "::ACE_InputCDR::to_wchar (vb_object->_pd_value)";
+ break;
+
+ case AST_PredefinedType::PT_octet:
+ unmarshal_arg = "::ACE_InputCDR::to_octet (vb_object->_pd_value)";
+ break;
+
+ case AST_PredefinedType::PT_any:
+ // We need to help the ">>" operator for "any" because
+ // a conversion operator is not available.
+ unmarshal_arg = "vb_object->_pd_value.inout ()";
+ break;
+
+ default:
+ unmarshal_arg = "vb_object->_pd_value";
+ }
+ }
+ else if (be_array::narrow_from_decl (bt) != 0)
+ {
+ is_array = true;
+ unmarshal_arg = "temp";
+ }
+ else
+ {
+ unmarshal_arg = "vb_object->_pd_value";
+ }
+
+ // The _tao_unmarshal method.
+ *os << "::CORBA::Boolean " << be_nl
+ << node->name () << "::_tao_unmarshal (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &strm," << be_nl
+ << node->local_name () << " *&vb_object" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::Boolean is_null_object;" << be_nl
+ << "if ( ::CORBA::ValueBase::_tao_validate_box_type (" << be_idt
+ << be_idt << be_idt_nl
+ << "strm," << be_nl
+ << node->local_name () << "::_tao_obv_static_repository_id ()," << be_nl
+ << "is_null_object"
+ << be_uidt_nl
+ << ") == false)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "vb_object = 0;" << be_nl
+ << "if (is_null_object)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return true;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "ACE_NEW_RETURN (" << be_idt_nl
+ << "vb_object," << be_nl
+ << node->local_name () << "," << be_nl
+ << "false);" << be_nl << be_uidt_nl;
+
+ if (is_array)
+ {
+ *os << at->full_name() << "_forany temp (vb_object->_boxed_inout ());"
+ << be_nl;
+ }
+ *os << "return (strm >> " << unmarshal_arg << ");" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // _tao_unmarshal_v method. Generated because ValueBase interface
+ // requires it. But there is nothing for it to do in the valuebox
+ // case.
+ *os << "::CORBA::Boolean " << be_nl
+ << node->name ()
+ << "::_tao_unmarshal_v (TAO_InputCDR &)" << be_nl
+ << "{" << be_idt_nl
+ << "return true;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Emit the type specific elements. The visit_* methods in this
+ // module do that work.
+ if (!bt || (bt->accept (this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%N:%l) be_visitor_valuebox_cs::visit_valuebox - "
+ "type-specific valuebox code generation failed\n"),
+ -1);
+ }
+
+ // Indicate that code is already generated for this node.
+ node->cli_stub_gen (true);
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_cs::visit_array (be_array * node)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_cs.
+ be_decl * const vb_node = this->ctx_->node ();
+
+ os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_destructor ();
+
+ // _tao_marshal_v method
+ os << "::CORBA::Boolean " << be_nl
+ << vb_node->name ()
+ << "::_tao_marshal_v (TAO_OutputCDR & strm) const" << be_nl
+ << "{" << be_idt_nl
+ << node->name () << "_forany temp (this->_pd_value.ptr ());" << be_nl
+ << "return (strm << temp);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_cs::visit_enum (be_enum *)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_cs.
+ be_decl * const vb_node = this->ctx_->node ();
+
+ os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_destructor ();
+
+ static char const marshal_arg[] = "this->_pd_value";
+
+ // _tao_marshal_v method
+ os << "::CORBA::Boolean " << be_nl
+ << vb_node->name ()
+ << "::_tao_marshal_v (TAO_OutputCDR & strm) const" << be_nl
+ << "{" << be_idt_nl
+ << "return (strm << " << marshal_arg << ");" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ return 0;
+}
+
+
+int
+be_visitor_valuebox_cs::visit_interface (be_interface *)
+{
+ return this->emit_for_predef_enum ("this->_pd_value");
+}
+
+int
+be_visitor_valuebox_cs::visit_predefined_type (be_predefined_type * node)
+{
+ char const * marshal_arg;
+
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_boolean:
+ marshal_arg = "::ACE_OutputCDR::from_boolean (this->_pd_value)";
+ break;
+
+ case AST_PredefinedType::PT_char:
+ marshal_arg = "::ACE_OutputCDR::from_char (this->_pd_value)";
+ break;
+
+ case AST_PredefinedType::PT_wchar:
+ marshal_arg = "::ACE_OutputCDR::from_wchar (this->_pd_value)";
+ break;
+
+ case AST_PredefinedType::PT_octet:
+ marshal_arg = "::ACE_OutputCDR::from_octet (this->_pd_value)";
+ break;
+
+ case AST_PredefinedType::PT_any:
+ marshal_arg = "this->_pd_value.in ()";
+ break;
+
+ default:
+ marshal_arg = "this->_pd_value";
+ break;
+ }
+
+ return this->emit_for_predef_enum (marshal_arg);
+}
+
+int
+be_visitor_valuebox_cs::visit_sequence (be_sequence *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_cs.
+ be_decl * vb_node = this->ctx_->node ();
+
+ if (node->anonymous ())
+ { // Our sequence is anonymous so we must generate a declaration
+ // for it.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+
+ // First generate the sequence definition
+ be_visitor_sequence_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_cs::"
+ "visit_sequence - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ // Retrieve the base type since we will need to do some code
+ // generation for it.
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
+ if (bt == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_ch::"
+ "visit_sequence - "
+ "Bad element type\n"),
+ -1);
+ }
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_SEQUENCE_BUFFER_TYPE_CH);
+ be_visitor_sequence_buffer_type bt_visitor (&ctx);
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ if (node->unbounded ())
+ {
+ // Public constructor with one argument of type ULong
+ *os << vb_node->name () << "::" << vb_node->local_name ()
+ << " ( ::CORBA::ULong max)" << be_nl
+ << "{" << be_idt_nl
+ << node->full_name () << "* p;" << be_nl
+ << "ACE_NEW (" << be_idt_nl
+ << "p," << be_nl
+ << node->full_name () << " (max));" << be_uidt_nl
+ << "this->_pd_value = p;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+
+ // Public constructor for sequence with supplied buffer
+ *os << vb_node->name () << "::" << vb_node->local_name ()
+ << " (" << be_idt;
+
+ if (node->unbounded ())
+ {
+ *os << be_nl << "::CORBA::ULong max,";
+ }
+
+ *os << be_nl << "::CORBA::ULong length, " << be_nl;
+
+
+ if (bt->accept (&bt_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_cs::"
+ "visit_valuebox - "
+ "base type visit failed\n"),
+ -1);
+ }
+
+ *os << " * buf," << be_nl
+ << "::CORBA::Boolean release)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << node->full_name () << "* p;" << be_nl
+ << "ACE_NEW (" << be_idt_nl
+ << "p," << be_nl
+ << node->full_name () << " (";
+
+ if (node->unbounded ())
+ {
+ *os << "max, ";
+ }
+
+ *os << "length, buf, release));" << be_uidt_nl
+ << "this->_pd_value = p;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // end: Public constructor for sequence with supplied buffer
+
+ this->emit_destructor ();
+
+ // Accessor: non const
+ if (bt->accept (&bt_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_cs::"
+ "visit_valuebox - "
+ "base type visit failed\n"),
+ -1);
+ }
+
+ *os << " & " << be_nl
+ << vb_node->name () << "::operator[] ( ::CORBA::ULong index)" << be_nl
+ << "{" << be_idt_nl
+ << "return (";
+
+ if (bt->accept (&bt_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_cs::"
+ "visit_valuebox - "
+ "base type visit failed\n"),
+ -1);
+ }
+
+ *os << "&) this->_pd_value->operator[] (index);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Accessor: const
+ *os << "const ";
+ if (bt->accept (&bt_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_cs::"
+ "visit_sequence - "
+ "base type visit failed\n"),
+ -1);
+ }
+ *os << " &" << be_nl;
+ *os << vb_node->name ()
+ << "::operator[] ( ::CORBA::ULong index) const" << be_nl
+ << "{" << be_idt_nl;
+
+ switch (bt->node_type())
+ {
+ case AST_Decl::NT_wstring:
+ *os << "TAO_SeqElem_WString_Manager mgr = this->_pd_value->operator[] "
+ "(index); " << be_nl
+ << "return mgr._retn ();" << be_uidt_nl;
+ break;
+
+ case AST_Decl::NT_string:
+ *os << "TAO_SeqElem_String_Manager mgr = this->_pd_value->operator[] "
+ "(index); " << be_nl
+ << "return mgr._retn ();" << be_uidt_nl;
+ break;
+
+ default:
+ *os << "return (";
+
+ if (bt->accept (&bt_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuebox_cs::"
+ "visit_sequence - "
+ "base type visit failed\n"),
+ -1);
+ }
+
+ *os << "&) this->_pd_value->operator[] (index);" << be_uidt_nl;
+
+ }
+
+ *os << "}" << be_nl << be_nl;
+
+ // _tao_marshal_v method
+ *os << "::CORBA::Boolean " << be_nl
+ << vb_node->name ()
+ << "::_tao_marshal_v (TAO_OutputCDR & strm) const" << be_nl
+ << "{" << be_idt_nl
+ << "return (strm << this->_pd_value.in ());" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_cs::visit_string (be_string *)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_cs.
+ be_decl * const vb_node = this->ctx_->node ();
+
+ os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_destructor ();
+
+ // _tao_marshal_v method
+ os << "::CORBA::Boolean " << be_nl
+ << vb_node->name ()
+ << "::_tao_marshal_v (TAO_OutputCDR & strm) const" << be_nl
+ << "{" << be_idt_nl
+ << "return (strm << this->_pd_value);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_cs::visit_structure (be_structure *)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_cs.
+ be_decl * const vb_node = this->ctx_->node ();
+
+ os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_destructor ();
+
+ // _tao_marshal_v method
+ os << "::CORBA::Boolean " << be_nl
+ << vb_node->name ()
+ << "::_tao_marshal_v (TAO_OutputCDR & strm) const" << be_nl
+ << "{" << be_idt_nl
+ << "return (strm << this->_pd_value.in ());" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_cs::visit_typedef (be_typedef *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_valuebox_cs::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuebox_cs::visit_union (be_union *)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_cs.
+ be_decl * const vb_node = this->ctx_->node ();
+
+ os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_destructor ();
+
+ // _tao_marshal_v method
+ os << "::CORBA::Boolean " << be_nl
+ << vb_node->name ()
+ << "::_tao_marshal_v (TAO_OutputCDR & strm) const" << be_nl
+ << "{" << be_idt_nl
+ << "return (strm << this->_pd_value.in ());" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ return 0;
+}
+
+void
+be_visitor_valuebox_cs::emit_destructor (void)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_cs.
+ be_decl * const vb_node = this->ctx_->node ();
+
+ // Protected destructor
+ os << vb_node->name () << "::~" << vb_node->local_name () << " (void)"
+ << be_nl << "{" << be_nl << "}" << be_nl << be_nl;
+}
+
+int
+be_visitor_valuebox_cs::emit_for_predef_enum (char const * marshal_arg)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ // Retrieve the node being visited by this be_visitor_valuebox_cs.
+ be_decl * const vb_node = this->ctx_->node ();
+
+ os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ this->emit_destructor ();
+
+ // _tao_marshal_v method
+ os << "::CORBA::Boolean " << be_nl
+ << vb_node->name ()
+ << "::_tao_marshal_v (TAO_OutputCDR & strm) const" << be_nl
+ << "{" << be_idt_nl
+ << "return (strm << " << marshal_arg << ");" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype.cpp
new file mode 100644
index 00000000000..2db4462bc35
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype.cpp
@@ -0,0 +1,104 @@
+
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_valuetype.cpp
+//
+// = DESCRIPTION
+// Concrete visitor for the Valuetype class
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+//
+// ============================================================================
+
+#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_component.h"
+#include "be_component_fwd.h"
+#include "be_eventtype.h"
+#include "be_eventtype_fwd.h"
+#include "be_factory.h"
+#include "be_field.h"
+#include "be_generator.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_valuebox.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_helper.h"
+#include "be_extern.h"
+#include "utl_identifier.h"
+#include "utl_exceptlist.h"
+#include "be_util.h"
+
+#include "be_visitor_valuetype.h"
+#include "be_visitor_argument.h"
+#include "be_visitor_array.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/any_op_ch.cpp"
+#include "be_visitor_valuetype/any_op_cs.cpp"
+#include "be_visitor_valuetype/cdr_op_ch.cpp"
+#include "be_visitor_valuetype/cdr_op_cs.cpp"
+#include "be_visitor_valuetype/marshal_ch.cpp"
+#include "be_visitor_valuetype/marshal_cs.cpp"
+#include "be_visitor_valuetype/arglist.cpp"
+#include "be_visitor_valuetype/field_ch.cpp"
+#include "be_visitor_valuetype/field_ci.cpp"
+#include "be_visitor_valuetype/field_cs.cpp"
+#include "be_visitor_valuetype/field_cdr_ch.cpp"
+#include "be_visitor_valuetype/field_cdr_cs.cpp"
+#include "be_visitor_valuetype/obv_module.cpp"
+#include "be_visitor_valuetype/ami_exception_holder_ch.cpp"
+#include "be_visitor_valuetype/ami_exception_holder_cs.cpp"
+#include "be_visitor_valuetype/valuetype_init.cpp"
+#include "be_visitor_valuetype/valuetype_init_ch.cpp"
+#include "be_visitor_valuetype/valuetype_init_ci.cpp"
+#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
new file mode 100644
index 00000000000..84d1bd214c5
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_ch.cpp
@@ -0,0 +1,72 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// ami_exception_holder_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating exception holders for the AMI callback model.
+//
+// = AUTHOR
+// Michael Kircher <Michael.Kircher@mchp.siemens.de>
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ ami_exception_holder_ch,
+ "$Id$")
+
+// ******************************************************
+// 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 (ctx)
+{
+}
+
+be_visitor_valuetype_ami_exception_holder_ch::
+~be_visitor_valuetype_ami_exception_holder_ch (void)
+{
+}
+
+int
+be_visitor_valuetype_ami_exception_holder_ch::visit_operation (
+ be_operation *node
+ )
+{
+ be_visitor_context ctx (*this->ctx_);
+
+ // Using the implementation class visitor is strange, but we
+ // do it here because it's the only one that generates the
+ // environment variable in the operation signature without
+ // the trailing _WITH_DEFAULTS, which is what we want.
+ // For performance reasons, we would rather there be a
+ // compile error if the user does not pass an environment
+ // variable, than create a default one, which causes extra
+ // TSS activity.
+ be_visitor_operation_ih visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_"
+ "ami_exception_holder_ch::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_uidt;
+
+ 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
new file mode 100644
index 00000000000..726706a8ff1
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_cs.cpp
@@ -0,0 +1,67 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// ami_exception_holder_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for excpetion holders.
+//
+// = AUTHOR
+// Michael Kircher
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+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
+ )
+{
+ ACE_UNUSED_ARG (node);
+ return 0;
+}
+
+
+int
+be_visitor_valuetype_ami_exception_holder_cs::visit_operation (be_operation *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_RAISE_OPERATION_CS);
+ be_visitor_operation_ami_exception_holder_operation_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ami_exception_holder_ch::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ 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
new file mode 100644
index 00000000000..4d3b75db1e8
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_ch.cpp
@@ -0,0 +1,125 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Any operators for a valuetype in the client
+// header.
+//
+// = AUTHOR
+// Jeff Parsons <parsons@cs.wustl.edu>
+// Boris Kolpackov <bosk@ipmce.ru>
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ any_op_ch,
+ "$Id$")
+
+// ***************************************************************************
+// Valuetype visitor for generating Any operator declarations.
+// ***************************************************************************
+
+be_visitor_valuetype_any_op_ch::be_visitor_valuetype_any_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_valuetype (ctx)
+{
+}
+
+be_visitor_valuetype_any_op_ch::~be_visitor_valuetype_any_op_ch (void)
+{
+}
+
+int
+be_visitor_valuetype_any_op_ch::visit_valuetype (be_valuetype *node)
+{
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ const char *macro = this->ctx_->export_macro ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ be_module *module = 0;
+
+ if (node->is_nested () &&
+ node->defined_in ()->scope_node_type () == AST_Decl::NT_module)
+ {
+ module = be_module::narrow_from_scope (node->defined_in ());
+
+ if (!module)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_valuebox_any_op_ch::"
+ "visit_valuebox - "
+ "Error parsing nested name\n"),
+ -1);
+ }
+
+ // Some compilers handle "any" operators in a namespace
+ // corresponding to their module, others do not.
+ *os << "\n\n#if defined (ACE_ANY_OPS_USE_NAMESPACE)\n";
+
+ be_util::gen_nested_namespace_begin (os, module);
+
+ // emit nested variation of any operators
+ *os << macro << " void"
+ << " operator<<= ( ::CORBA::Any &, " << node->local_name ()
+ << " *); // copying" << be_nl;
+
+ *os << macro << " void"
+ << " operator<<= ( ::CORBA::Any &, " << node->local_name ()
+ << " **); // non-copying" << be_nl;
+
+ *os << macro << " ::CORBA::Boolean"
+ << " operator>>= (const ::CORBA::Any &, "
+ << node->local_name () << " *&);";
+
+ be_util::gen_nested_namespace_end (os, module);
+
+ // emit #else
+ *os << "#else\n\n";
+ }
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *os << macro << " void operator<<= (::CORBA::Any &, " << node->name ()
+ << " *); // copying" << be_nl;
+
+ *os << macro << " void operator<<= (::CORBA::Any &, " << node->name ()
+ << " **); // non-copying" << be_nl;
+
+ *os << macro << " ::CORBA::Boolean operator>>= (const ::CORBA::Any &, "
+ << node->name () << " *&);";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ if (module != 0)
+ {
+ *os << "\n\n#endif";
+ }
+
+ node->cli_hdr_any_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_valuetype_any_op_ch::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
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
new file mode 100644
index 00000000000..aa784e3a0e1
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_cs.cpp
@@ -0,0 +1,214 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Any operators for valuetypes in the stubs
+// file.
+//
+// = AUTHOR
+// Jeff Parsons <parsons@cs.wustl.edu>
+// Boris Kolpackov <bosk@ipmce.ru>
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ any_op_cs,
+ "$Id$")
+
+
+// ***************************************************************************
+// Valuetype visitor for generating Any operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_valuetype_any_op_cs::be_visitor_valuetype_any_op_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_valuetype (ctx)
+{
+}
+
+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 ()
+ || node->is_local ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Generate the Any <<= and >>= operator declarations
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ // All template specializations must be generated before the instantiations
+ // in the operators.
+ *os << be_nl << be_nl
+ << "namespace TAO" << be_nl
+ << "{" << be_idt_nl
+ << "template<>" << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << "Any_Impl_T<" << node->name () << ">::to_value ("
+ << be_idt << be_idt_nl
+ << "::CORBA::ValueBase *&_tao_elem" << be_uidt_nl
+ << ") const" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::add_ref (this->value_);" << be_nl
+ << "_tao_elem = this->value_;" << be_nl
+ << "return true;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ be_module *module = 0;
+
+ if (node->is_nested () &&
+ node->defined_in ()->scope_node_type () == AST_Decl::NT_module)
+ {
+ module = be_module::narrow_from_scope (node->defined_in ());
+
+ if (!module)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_valuebox_any_op_cs::"
+ "visit_valuebox - "
+ "Error parsing nested name\n"),
+ -1);
+ }
+
+ // Some compiler handle "any" operators in a namespace corresponding
+ // to their module, others do not.
+ *os << "\n\n#if defined (ACE_ANY_OPS_USE_NAMESPACE)\n";
+
+ be_util::gen_nested_namespace_begin (os, module);
+
+ // emit nested variation of any operators
+ *os << "// Copying insertion." << be_nl
+ << "void" << be_nl
+ << "operator<<= (" << be_idt << be_idt_nl
+ << "::CORBA::Any &_tao_any," << be_nl
+ << node->local_name () << " *_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::add_ref (_tao_elem);" << be_nl
+ << "_tao_any <<= &_tao_elem;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "// Non-copying insertion." << be_nl
+ << "void" << be_nl
+ << "operator<<= (" << be_idt << be_idt_nl
+ << "::CORBA::Any &_tao_any," << be_nl
+ << node->local_name () << " **_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "TAO::Any_Impl_T<" << node->local_name () << ">::insert ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->local_name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name ()->last_component () << "," << be_nl
+ << "*_tao_elem" << 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->local_name () << " *&_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return" << be_idt_nl
+ << "TAO::Any_Impl_T<" << node->local_name () << ">::extract ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->local_name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name ()->last_component () << "," << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ be_util::gen_nested_namespace_end (os, module);
+
+ // emit #else
+ *os << "#else\n";
+ }
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *os << "// Copying insertion." << be_nl
+ << "void" << be_nl
+ << "operator<<= (" << be_idt << be_idt_nl
+ << "::CORBA::Any &_tao_any," << be_nl
+ << node->full_name () << " *_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::add_ref (_tao_elem);" << be_nl
+ << "_tao_any <<= &_tao_elem;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "// Non-copying insertion." << be_nl
+ << "void" << be_nl
+ << "operator<<= (" << be_idt << be_idt_nl
+ << "::CORBA::Any &_tao_any," << be_nl
+ << node->full_name () << " **_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "TAO::Any_Impl_T<" << node->name () << ">::insert ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "*_tao_elem" << 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 () << " *&_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return" << be_idt_nl
+ << "TAO::Any_Impl_T<" << node->name () << ">::extract ("
+ << be_idt << be_idt_nl
+ << "_tao_any," << be_nl
+ << node->name () << "::_tao_any_destructor," << be_nl
+ << node->tc_name () << "," << be_nl
+ << "_tao_elem" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ if (module != 0)
+ {
+ *os << "\n\n#endif";
+ }
+
+ node->cli_stub_any_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_valuetype_any_op_cs::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp
new file mode 100644
index 00000000000..87186a23ea3
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp
@@ -0,0 +1,303 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// arglist.cpp
+//
+// = DESCRIPTION
+// Visitor generating the parameter list of operations
+// in the Valuetype class.
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+// based on code from Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ arglist,
+ "$Id$")
+
+// ************************************************************
+// Operation visitor to generate the argument list.
+// We have separated code generation for this from the 4 main
+// visitors to avoid code duplication and tight coupling.
+// ************************************************************
+
+be_visitor_obv_operation_arglist::be_visitor_obv_operation_arglist (
+ be_visitor_context *ctx
+ )
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_obv_operation_arglist::~be_visitor_obv_operation_arglist (void)
+{
+}
+
+bool
+be_visitor_obv_operation_arglist::is_amh_exception_holder (be_operation *node)
+{
+ UTL_Scope *scope = node->defined_in ();
+ be_interface *iface = be_interface::narrow_from_scope (scope);
+
+ if (iface != 0)
+ {
+ if (ACE_OS::strncmp (iface->local_name (), "AMH_", 4) == 0)
+ {
+ const char *last_E = ACE_OS::strrchr (iface->full_name (), 'E');
+
+ if (last_E != 0
+ && ACE_OS::strcmp (last_E, "ExceptionHolder") == 0)
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+int
+be_visitor_obv_operation_arglist::visit_operation (be_operation *node)
+{
+ bool amh_valuetype = this->is_amh_exception_holder (node);
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << " (";
+
+ if (!be_global->exception_support () || node->nmembers () > 0)
+ {
+ *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,
+ "(%N:%l) be_visitor_obv_operation_arglist::"
+ "visit_operation - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ // Generate the ACE_ENV_ARG_DECL parameter for the alternative mapping.
+ if (!be_global->exception_support ())
+ {
+ /***********************************************************/
+ // If it ian an AMHExceptionHolder we are going to generate the
+ // function definition "in-place" right here. Also all
+ // AMHExceptionHolder 'raise' methods do not take any
+ // parameters. So always declare
+ // ACE_ENV_SINGLE_ARG_DECL_NOT_USED when generating argument
+ // list for AMHExceptioHolders
+ /***********************************************************/
+ if (amh_valuetype)
+ {
+ *os << (be_global->use_raw_throw ()
+ ? ""
+ : "ACE_ENV_SINGLE_ARG_DECL");
+ }
+ /***********************************************************/
+ else
+ {
+ // 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 << (be_global->use_raw_throw ()
+ ? ""
+ : " ACE_ENV_SINGLE_ARG_DECL");
+ }
+ else
+ {
+ *os << (be_global->use_raw_throw ()
+ ? ""
+ : " ACE_ENV_ARG_DECL");
+ }
+ }
+
+ if (!amh_valuetype)
+ {
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CH:
+ // Last argument - is always ACE_ENV_ARG_DECL.
+ *os << (be_global->use_raw_throw ()
+ ? ""
+ : "_WITH_DEFAULTS");
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ *os << be_uidt_nl
+ << ")";
+ }
+ else
+ {
+ *os << "void)";
+ }
+
+ be_visitor_context ctx = *this->ctx_;
+ be_visitor_operation operation_visitor (&ctx);
+
+ if (operation_visitor.gen_throw_spec (node) == -1)
+ {
+ return -1;
+ }
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CH:
+ // Each method is pure virtual in the Valuetype class.
+ // BUT, not if it is an AMH ExceptionHolder!
+ if (amh_valuetype)
+ {
+ *os << ";" << be_uidt;
+ }
+ else
+ {
+ *os << " = 0;" << be_uidt;
+ }
+ break;
+ case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CS:
+ *os << be_uidt;
+ break;
+ case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IH:
+ case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IS:
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_obv_operation_arglist::visit_argument (be_argument *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+
+ // First grab the interface definition inside which this operation is
+ // defined. We need this since argument types may very well be declared
+ // inside the scope of the interface node. In such cases, we would like to
+ // generate the appropriate relative scoped names.
+ be_operation *op = this->ctx_->be_scope_as_operation ();
+
+ if (!op)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arglist::"
+ "visit_argument - "
+ "Bad operation\n"),
+ -1);
+ }
+
+ // We need the interface node in which this operation was defined. However,
+ // if this operation node was an attribute node in disguise, we get this
+ // information from the context.
+ // %! use AST_Interface
+ be_interface *intf = this->ctx_->attribute ()
+ ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
+ : be_interface::narrow_from_scope (op->defined_in ());
+
+ if (!intf)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arglist::"
+ "visit_argument - "
+ "Bad interface\n"),
+ -1);
+ }
+
+ ctx.scope (intf);
+ ctx.node (node); // save the argument node
+
+ // Retrieve the type.
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_arglist::"
+ "visit_argument - "
+ "Bad argument type\n"),
+ -1);
+ }
+
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CH:
+ {
+ be_visitor_args_arglist visitor (&ctx);
+ status = bt->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_SH:
+ case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IH:
+ case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IS:
+ {
+ be_visitor_args_arglist visitor (&ctx);
+ status = bt->accept (&visitor);
+ break;
+ }
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arglist::"
+ "visit_argument - "
+ "Bad context\n"),
+ -1);
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arglist::"
+ "visit_argument - "
+ "codegen for argument failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_obv_operation_arglist::post_process (be_decl *bd)
+// derived from be_visitor_operation_argument::post_process (be_decl *bd)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CH:
+ 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
+ {
+ *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
new file mode 100644
index 00000000000..2cfe3923843
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp
@@ -0,0 +1,103 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.cpp
+//
+// = DESCRIPTION
+// Concrete visitor for valuetypes.
+// This one provides code generation for the CDR operators.
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+// based on code from Aniruddha Gokhale
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+be_visitor_valuetype_cdr_op_ch::~be_visitor_valuetype_cdr_op_ch (void)
+{
+}
+
+int
+be_visitor_valuetype_cdr_op_ch::visit_valuetype (be_valuetype *node)
+{
+ if (node->imported ()
+ || node->cli_hdr_cdr_op_gen ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Generate helper functions declaration.
+ if (node->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);
+ }
+
+ *os << be_nl << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *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 () << " *&);";
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ // Set the substate as generating code for the types defined in our scope.
+ this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_SCOPE);
+
+ 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);
+ }
+
+ if (!node->is_abstract ())
+ {
+ // Functions that marshal state.
+ be_visitor_context new_ctx (*this->ctx_);
+ be_visitor_valuetype_marshal_ch visitor (&new_ctx);
+ visitor.visit_valuetype (node);
+ }
+
+ node->cli_hdr_cdr_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_valuetype_cdr_op_ch::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
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
new file mode 100644
index 00000000000..1b7ac0be4b3
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_cs.cpp
@@ -0,0 +1,170 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_cs.cpp
+//
+// = DESCRIPTION
+// Concrete visitor for valuetypes.
+// This one provides code generation for the CDR operators.
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+// based on code from Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+// based on code from Aniruddha Gokhale
+//
+// ============================================================================
+
+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 (ctx)
+{
+}
+
+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.
+ if (node->cli_stub_cdr_op_gen ()
+ || node->imported ()
+ || ! node->is_defined ())
+ {
+ return 0;
+ }
+
+ // Generate helper functions implementation.
+ if (node->gen_helper_stubs () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_cdr_op_cs::"
+ "visit_valuetype - "
+ "codegen for helper functions failed\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ node->cli_stub_cdr_op_gen (true);
+
+ 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);
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << 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<< (" << 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" << be_idt_nl
+ << "::CORBA::ValueBase::_tao_marshal (" << be_idt << be_idt_nl
+ << "strm," << be_nl
+ << "_tao_valuetype," << be_nl
+ << "reinterpret_cast<ptrdiff_t> (&"
+ << node->full_name () << "::_downcast)"
+ << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "::CORBA::Boolean" << be_nl
+ << "operator>> (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &strm," << be_nl
+ << node->full_name ()
+ << " *&_tao_valuetype" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+ *os << "return " << node->full_name ()
+ << "::_tao_unmarshal (strm, _tao_valuetype);"
+ << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ 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);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_cdr_op_cs::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+// @@@ (JP) The following three methods are a hack to get CDR
+// operators generated for anonymous array and sequence
+// valuetype members. This should be done like it is in structs,
+// but part of that mechanism is used by valuetypes for
+// generating code to marshal the state. Someday this should
+// be untangled and made consistent.
+
+int
+be_visitor_valuetype_cdr_op_cs::visit_field (be_field *node)
+{
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (bt == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_cdr_op_ci::"
+ "visit_field - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ // Save the node.
+ this->ctx_->node (node);
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_cdr_op_ci::"
+ "visit_field - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_cdr_op_cs::visit_sequence (be_sequence *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_sequence_cdr_op_cs visitor (&ctx);
+ return node->accept (&visitor);
+}
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
new file mode 100644
index 00000000000..a72fc8de0b5
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_ch.cpp
@@ -0,0 +1,216 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_cdr_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Field in the client header file.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ field_cdr_op_ch,
+ "$Id$")
+
+// **********************************************
+// Visitor for field in the client header file.
+// **********************************************
+
+be_visitor_valuetype_field_cdr_ch::be_visitor_valuetype_field_cdr_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx),
+ pre_ (""),
+ post_ ("")
+{
+}
+
+be_visitor_valuetype_field_cdr_ch::~be_visitor_valuetype_field_cdr_ch (void)
+{
+}
+
+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);
+ }
+
+ 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);
+ }
+
+ return 0;
+}
+
+// Visit operations on all possible data types that a field can be
+
+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 ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ // This is the case for anonymous arrays.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
+
+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 ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
+
+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 (!this->ctx_->alias () // not a typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
+
+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 ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cdr_ch::visit_typedef (be_typedef *node)
+{
+ // Save the node for use in code generation and
+ // indicate that the field of the field 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_valuetype_field_cdr_ch::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+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 ()
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_cs.cpp
new file mode 100644
index 00000000000..c89015e7bcd
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_cs.cpp
@@ -0,0 +1,974 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_cdr_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Field in the client stubs file.
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+// derived from be_visitor_field/cdr_op_cs.cpp
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ field_cdr_op_cs,
+ "$Id$")
+
+// **********************************************
+// Visitor for field in the client inline file.
+// **********************************************
+
+be_visitor_valuetype_field_cdr_cs::be_visitor_valuetype_field_cdr_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx),
+ pre_ (""),
+ post_ ("")
+{
+}
+
+be_visitor_valuetype_field_cdr_cs::~be_visitor_valuetype_field_cdr_cs (void)
+{
+}
+
+int
+be_visitor_valuetype_field_cdr_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_valuetype_field_cdr_cs::"
+ "visit_field - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ this->ctx_->node (node);
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cdr_cs::"
+ "visit_field - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cdr_cs::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)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cdr_cs::"
+ "visit_array - "
+ "cannot retrieve field node\n"),
+ -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];
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+
+ 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
+ // 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 (),
+ node->local_name ()->get_string ());
+ }
+ else
+ {
+ ACE_OS::sprintf (fname,
+ "_%s",
+ node->full_name ());
+ }
+ }
+ else
+ {
+ // Typedefed node.
+ ACE_OS::sprintf (fname,
+ "%s",
+ node->full_name ());
+ }
+
+ // 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 ())
+ {
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ *os << "(strm >> "
+ << "_tao_" << this->pre_ << f->local_name ()
+ << this->post_ << ")";
+ return 0;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "(strm << "
+ << "_tao_" << this->pre_ << f->local_name ()
+ << this->post_ << ")";
+ return 0;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Proceed further.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cdr_cs::"
+ "visit_array - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ // 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.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_array_cdr_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cdr_cs::"
+ "visit_array - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cdr_cs::visit_enum (be_enum *node)
+{
+ 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_valuetype_field_cdr_cs::"
+ "visit_array - "
+ "cannot retrieve field node\n"),
+ -1);
+ }
+
+ // 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 ())
+ {
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ *os << "(strm >> " << this->pre_ << f->local_name ()
+ << this->post_ << ")";
+ return 0;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "(strm << " << this->pre_ << f->local_name ()
+ << this->post_ << ")";
+ return 0;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Proceed further.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cdr_cs::"
+ "visit_enum - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_enum_cdr_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cdr_cs::"
+ "visit_enum - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cdr_cs::visit_interface (be_interface *node)
+{
+ 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_valuetype_field_cdr_cs::"
+ "visit_interface - "
+ "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 >> " << this->pre_ << f->local_name ()
+ << this->post_ << ".out ())";
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "TAO::Objref_Traits< ::" << node->name ()
+ << ">::marshal (" << be_idt << be_idt_nl
+ << this->pre_ << f->local_name ()
+ << this->post_ << ".in (), " << be_nl
+ << "strm" << be_uidt_nl
+ << ")" << be_uidt;
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done because an interface cannit be declared inside a
+ // structure.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cdr_cs::"
+ "visit_interface - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cdr_cs::visit_interface_fwd (be_interface_fwd *node)
+{
+ 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_valuetype_field_cdr_cs::"
+ "visit_interface_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 >> " << this->pre_ << f->local_name ()
+ << this->post_ << ").out ()";
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "TAO::Objref_Traits< ::" << node->name ()
+ << ">::marshal (" << be_idt << be_idt_nl
+ << this->pre_ << f->local_name ()
+ << this->post_ << ".in (), " << be_nl
+ << "strm" << be_uidt_nl
+ << ")" << be_uidt;
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done because an interface cannot be declared inside a
+ // structure.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cdr_cs::"
+ "visit_interface_fwd - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cdr_cs::visit_valuebox (be_valuebox * node)
+{
+ return this->valuetype_common (node);
+}
+
+int
+be_visitor_valuetype_field_cdr_cs::valuetype_common (be_type *)
+{
+ 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_valuetype_field_cdr_cs::"
+ "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 >> " << this->pre_ << f->local_name ()
+ << this->post_ << ".out ())";
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "(strm << " << this->pre_ << f->local_name ()
+ << this->post_ << ".in ())";
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done because a valuetype cannit be declared inside a
+ // structure.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cdr_cs::"
+ "visit_valuetype - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cdr_cs::visit_valuetype (be_valuetype * node)
+{
+ return this->valuetype_common (node);
+}
+
+int
+be_visitor_valuetype_field_cdr_cs::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)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cdr_cs::"
+ "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 >> " << this->pre_ << f->local_name ()
+ << this->post_ << ").out ()";
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "(strm << " << this->pre_ << f->local_name ()
+ << this->post_ << ").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_valuetype_field_cdr_cs::"
+ "visit_valuetype_fwd - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cdr_cs::visit_component (be_component *node)
+{
+ return this->visit_interface (node);
+}
+
+int
+be_visitor_valuetype_field_cdr_cs::visit_component_fwd (be_component_fwd *node)
+{
+ return this->visit_interface_fwd (node);
+}
+
+int
+be_visitor_valuetype_field_cdr_cs::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_valuetype_field_cdr_cs::visit_eventtype_fwd (be_eventtype_fwd *node)
+{
+ return this->visit_valuetype_fwd (node);
+}
+
+int
+be_visitor_valuetype_field_cdr_cs::visit_predefined_type (be_predefined_type *node)
+{
+ 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_valuetype_field_cdr_cs::"
+ "visit_predefined_type - "
+ "cannot retrieve field node\n"),
+ -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_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << "(strm >> " << this->pre_ << f->local_name ()
+ << this->post_ << ".out ())";
+ }
+ else if (pt == AST_PredefinedType::PT_char)
+ {
+ *os << "(strm >> ::ACE_InputCDR::to_char ("
+ << this->pre_ << f->local_name () << this->post_ << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_wchar)
+ {
+ *os << "(strm >> ::ACE_InputCDR::to_wchar ("
+ << this->pre_ << f->local_name () << this->post_ << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_octet)
+ {
+ *os << "(strm >> ::ACE_InputCDR::to_octet ("
+ << this->pre_ << f->local_name () << this->post_ << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_boolean)
+ {
+ *os << "(strm >> ::ACE_InputCDR::to_boolean ("
+ << this->pre_ << f->local_name () << this->post_ << "))";
+ }
+ else
+ {
+ *os << "(strm >> " << this->pre_ << f->local_name ()
+ << this->post_ << ")";
+ }
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << "(strm << " << this->pre_ << f->local_name ()
+ << this->post_ << ".in ())";
+ }
+ else if (pt == AST_PredefinedType::PT_char)
+ {
+ *os << "(strm << ::ACE_OutputCDR::from_char ("
+ << this->pre_ << f->local_name () << this->post_ << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_wchar)
+ {
+ *os << "(strm << ::ACE_OutputCDR::from_wchar ("
+ << this->pre_ << f->local_name () << this->post_ << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_octet)
+ {
+ *os << "(strm << ::ACE_OutputCDR::from_octet ("
+ << this->pre_ << f->local_name () << this->post_ << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_boolean)
+ {
+ *os << "(strm << ::ACE_OutputCDR::from_boolean ("
+ << this->pre_ << f->local_name () << this->post_ << "))";
+ }
+ else
+ {
+ *os << "(strm << " << this->pre_ << f->local_name ()
+ << this->post_ << ")";
+ }
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cdr_cs::"
+ "visit_array - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cdr_cs::visit_sequence (be_sequence *node)
+{
+ 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_valuetype_field_cdr_cs::"
+ "visit_sequence - "
+ "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 >> " << this->pre_ << f->local_name ()
+ << this->post_ << ")";
+ return 0;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "(strm << " << this->pre_ << f->local_name ()
+ << this->post_ << ")";
+ return 0;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Proceed further.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cdr_cs::"
+ "visit_sequence - "
+ "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 valuetype.
+ {
+ // Anonymous sequence.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_sequence_cdr_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cdr_cs::"
+ "visit_sequence - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cdr_cs::visit_string (be_string *)
+{
+ 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_valuetype_field_cdr_cs::"
+ "visit_string - "
+ "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 >> " << this->pre_ << f->local_name ()
+ << this->post_ << ".out ())";
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "(strm << " << this->pre_ << f->local_name ()
+ << this->post_ << ".in ())";
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cdr_cs::"
+ "visit_array - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cdr_cs::visit_structure (be_structure *node)
+{
+ 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_valuetype_field_cdr_cs::"
+ "visit_structure - "
+ "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 >> " << this->pre_ << f->local_name ()
+ << this->post_ << ")";
+ return 0;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "(strm << " << this->pre_ << f->local_name ()
+ << this->post_ << ")";
+ return 0;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Proceed further.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cdr_cs::"
+ "visit_structure - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_structure_cdr_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cdr_cs::"
+ "visit_struct - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cdr_cs::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_union_branch_public_cs::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cdr_cs::visit_union (be_union *node)
+{
+ 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_valuetype_field_cdr_cs::"
+ "visit_union - "
+ "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 >> " << this->pre_ << f->local_name ()
+ << this->post_ << ")";
+ return 0;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "(strm << " << this->pre_ << f->local_name ()
+ << this->post_ << ")";
+ return 0;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Proceed further.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cdr_cs::"
+ "visit_union - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_union_cdr_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cdr_cs::"
+ "visit_union - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+
+// ****************************************************************
+
+be_visitor_valuetype_field_cdr_decl::be_visitor_valuetype_field_cdr_decl (
+ be_visitor_context *ctx
+ )
+ : be_visitor_scope (ctx)
+{
+}
+
+// This is a field, but the action depends on the type of the field,
+// use this visitor to detect the type of the field.
+// Notice that this is why the parent visitor (who create us) cannot
+// do the job, because it may have another purpose for some or all of
+// the visit_* methods; in other words, while running a visitor to
+// generate CDR operators for structures we cannot use that one to
+// generate the code of each field, because visit_struct already has a
+// meaning in that visitor.
+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);
+ }
+
+ // @@ Shouldn't this be saved in the visitor and not the context?!
+ 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);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cdr_decl::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)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cdr_decl::"
+ "visit_array - "
+ "cannot retrieve field node\n"),
+ -1);
+ }
+
+ // 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);
+ }
+
+ // 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];
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+
+ 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
+ // prepended to our local name. This needs to be inserted after
+ // 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 (),
+ node->local_name ()->get_string ());
+ }
+ else
+ {
+ ACE_OS::sprintf (fname,
+ "_%s",
+ node->full_name ());
+ }
+ }
+ else
+ {
+ // Typedefed node.
+ ACE_OS::sprintf (fname,
+ "%s",
+ node->full_name ());
+ }
+
+ // 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 ())
+ {
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << fname << "_forany "
+ << "_tao_" << vt->field_pd_prefix () << f->local_name ()
+ << vt->field_pd_postfix () << be_idt << be_idt_nl
+ << "(const_cast<" << be_idt << be_idt_nl
+ << fname << "_slice*> (" << be_nl
+ << vt->field_pd_prefix () << f->local_name ()
+ << vt->field_pd_postfix () << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ");" << be_uidt_nl;
+ return 0;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cdr_decl::"
+ "visit_array - "),
+ -1);
+ }
+}
+
+int
+be_visitor_valuetype_field_cdr_decl::visit_typedef (be_typedef *node)
+{
+ 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);
+ }
+
+ this->ctx_->alias (0);
+ return 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
new file mode 100644
index 00000000000..5a245ed5c27
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp
@@ -0,0 +1,821 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating the accessor and modifier declarations
+// for valuetype fields in the valuetype class (header).
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+// derived from be_visitor_union_branch/public_ch.cpp
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ field_ch,
+ "$Id$")
+
+be_visitor_valuetype_field_ch::be_visitor_valuetype_field_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+ setenclosings ("", ";");
+}
+
+be_visitor_valuetype_field_ch::~be_visitor_valuetype_field_ch (void)
+{
+}
+
+int
+be_visitor_valuetype_field_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_ch::"
+ "visit_union_branch - "
+ "Bad type\n"),
+ -1);
+ }
+
+ this->ctx_->node (node); // save the node
+
+ this->visibility_ = node->visibility ();
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_ch::"
+ "visit_union_branch - "
+ "codegen failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+// Visit operations on all possible data types (valuetype state member).
+
+int
+be_visitor_valuetype_field_ch::visit_array (be_array *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_ch::"
+ "visit_array - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ 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);
+ ctx.state (TAO_CodeGen::TAO_ARRAY_CH);
+ be_visitor_array_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_ch::"
+ "visit_array - "
+ "codegen failed\n"),
+ -1);
+ }
+
+ ctx.state (TAO_CodeGen::TAO_ROOT_CH);
+
+ // 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 () << be_nl;
+ // The get method.
+ *os << pre_op () << "const _" << bt->local_name ()
+ << "_slice * " << ub->local_name ()
+ << " (void) const" << post_op () << be_nl;
+ *os << pre_op () << "_" << bt->local_name ()
+ << "_slice * " << ub->local_name ()
+ << " (void)" << post_op ();
+ }
+ else
+ {
+ // Now use this array as a "type" for the subsequent declarator.
+ // The set method.
+ *os << pre_op () << "void " << ub->local_name () << " (const "
+ << bt->name () << ")" << post_op () << be_nl;
+ // The get method.
+ *os << pre_op ()
+ << bt->name () << "_slice *" << ub->local_name ()
+ << " (void)" << post_op () << be_nl;
+ // The get (read/write) method.
+ *os << pre_op () << "const "
+ << bt->name () << "_slice *" << ub->local_name ()
+ << " (void) const" << post_op ();
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_ch::visit_enum (be_enum *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_ch::"
+ "visit_enum - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_enum_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_ch::"
+ "visit_enum - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ // 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 () << be_nl;
+ // The get method.
+ *os << pre_op () << bt->name () << " " << ub->local_name ()
+ << " (void) const" << post_op ();
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_ch::visit_interface (be_interface *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_ch::"
+ "visit_interface - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// 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() << be_nl;
+ // Get method.
+ *os << pre_op()
+ << bt->name () << "_ptr " << ub->local_name ()
+ << " (void) const" << post_op();
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_ch::visit_interface_fwd (be_interface_fwd *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_ch::"
+ "visit_interface_fwd - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// 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 () << be_nl;
+ // Get method.
+ *os << pre_op ()
+ << bt->name () << "_ptr " << ub->local_name ()
+ << " (void) const" << post_op ();
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_ch::visit_valuebox (be_valuebox *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_ch::"
+ "visit_valuebox - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// 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 () << be_nl;
+ // Get method.
+ *os << pre_op ()
+ << bt->name () << " *" << ub->local_name ()
+ << " (void) const" << post_op ();
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_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 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_valuetype_field_ch::"
+ "visit_valuetype - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// 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 () << be_nl;
+ // Get method.
+ *os << pre_op ()
+ << bt->name () << " *" << ub->local_name ()
+ << " (void) const" << post_op ();
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_ch::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_valuetype_field_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 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_valuetype_field_ch::"
+ "visit_valuetype_fwd - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// 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 () << be_nl;
+ // Get method.
+ *os << pre_op ()
+ << bt->name () << " *" << ub->local_name ()
+ << " (void) const" << post_op ();
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_ch::visit_eventtype_fwd (be_eventtype_fwd *node)
+{
+ return this->visit_valuetype_fwd (node);
+}
+
+int
+be_visitor_valuetype_field_ch::visit_predefined_type (be_predefined_type *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_ch::"
+ "visit_predefined_type - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
+ // Set method.
+ *os << pre_op () << "void " << ub->local_name () << " ( ::"
+ << bt->name () << "_ptr)"
+ << post_op () << be_nl;
+ // Get method.
+ *os << pre_op ()
+ << "::" << bt->name () << "_ptr " << ub->local_name ()
+ << " (void) const" << post_op ();
+ break;
+ case AST_PredefinedType::PT_any:
+ // Set method.
+ *os << pre_op () << "void " << ub->local_name ()
+ << " (const ::" << bt->name () << " &)"
+ << post_op () << be_nl;
+ // Get method (read-only).
+ *os << pre_op () << "const ::" << bt->name () << " &"
+ << ub->local_name () << " (void) const"
+ << post_op () << be_nl;
+ // Get method (read/write).
+ *os << pre_op () << "::" << bt->name () << " &"
+ << ub->local_name () << " (void)"
+ << post_op ();
+ break;
+ case AST_PredefinedType::PT_void:
+ break;
+ default:
+ // Set method.
+ *os << pre_op () << "void " << ub->local_name ()
+ << " (const ::" << bt->name () << ")"
+ << post_op () << be_nl;
+ // Get method.
+ *os << pre_op () << "::" << bt->name ()
+ << " " << ub->local_name ()
+ << " (void) const" << post_op ();
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_ch::visit_sequence (be_sequence *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_ch::"
+ "visit_sequence - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// 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))
+ {
+ be_field *member_node =
+ be_field::narrow_from_decl (this->ctx_->node ());
+ node->field_node (member_node);
+
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_sequence_ch visitor (&ctx);
+
+ if (this->visibility_ == AST_Field::vis_PRIVATE)
+ {
+ *os << be_uidt_nl << "public:" << be_idt_nl;
+ }
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_ch::"
+ "visit_sequence - "
+ "codegen failed\n"),
+ -1);
+ }
+
+ if (this->visibility_ == AST_Field::vis_PRIVATE)
+ {
+ *os << be_uidt_nl << be_nl << "protected:" << be_idt;
+ }
+
+ // Generate the anonymous sequence member typedef.
+ // This provides a consistent name to use instead of the
+ // implementation-specific name.
+ *os << be_nl << be_nl << "typedef " << bt->nested_type_name (bu)
+ << " _" << ub->local_name () << "_seq;" << be_nl;
+ }
+
+ // Set method.
+ *os << pre_op () << "void " << ub->local_name () << " (const "
+ << bt->name () << " &)"
+ << post_op () << be_nl;
+ // Read-only.
+ *os << pre_op () << "const " << bt->name () << " &"
+ << ub->local_name () << " (void) const"
+ << post_op () << be_nl;
+ // Read/write.
+ *os << pre_op () << bt->name () << " &" << ub->local_name ()
+ << " (void)"
+ << post_op ();
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_ch::visit_string (be_string *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_ch::"
+ "visit_string - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl<< "// 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 *val)"
+ << post_op () << be_nl;
+ *os << pre_op ()
+ << "void " << ub->local_name () << " (const char *val)"
+ << post_op () << be_nl;
+ *os << pre_op ()
+ << "void " << ub->local_name () << " (const ::CORBA::String_var &val)"
+ << post_op () << be_nl;
+ // Get method.
+ *os << pre_op () << "const char *" << ub->local_name ()
+ << " (void) const" << post_op ();
+ }
+ else
+ {
+ *os << pre_op ()
+ << "void " << ub->local_name () << " ( ::CORBA::WChar *val)"
+ << post_op () << be_nl;
+ *os << pre_op ()
+ << "void " << ub->local_name () << " (const ::CORBA::WChar *val)"
+ << post_op () << be_nl;
+ *os << pre_op ()
+ << "void " << ub->local_name () << " (const ::CORBA::WString_var &val)"
+ << post_op () << be_nl;
+ // Get method.
+ *os << pre_op() << "const ::CORBA::WChar *" << ub->local_name ()
+ << " (void) const" << post_op();
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_ch::visit_structure (be_structure *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_ch::"
+ "visit_structure - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl<< "// 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))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_structure_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_ch::"
+ "visit_structure - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ // Set method.
+ *os << pre_op () << "void " << ub->local_name () << " (const "
+ << bt->name () << " &)"
+ << post_op () << be_nl;
+ // Read-only.
+ *os << pre_op () << "const " << bt->name () << " &";
+ *os << ub->local_name () << " (void) const"
+ << post_op () << be_nl
+ // Read/write.
+ << pre_op () << bt->name () << " &" << ub->local_name ()
+ << " (void)" << post_op ();
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_ch::visit_typedef (be_typedef *node)
+{
+ 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_spec_ch::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_ch::visit_union (be_union *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+
+ // Check if we are visiting this via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_ch::"
+ "visit_union - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl<< "// 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))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_union_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_ch::"
+ "visit_union - "
+ "codegen failed\n"),
+ -1);
+ }
+ }
+
+ // Set method.
+ *os << pre_op () << "void " << ub->local_name () << " (const "
+ << bt->name () << " &)"
+ << post_op () << be_nl;
+ // Read-only.
+ *os << pre_op () << "const " << bt->name () << " &"
+ << ub->local_name () << " (void) const"
+ << post_op () << be_nl;
+ // Read/write.
+ *os << pre_op () << bt->name () << " &" << ub->local_name ()
+ << " (void)" << post_op ();
+
+ return 0;
+}
+
+void
+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 (void)
+{
+ return pre_op_;
+}
+
+const char*
+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
new file mode 100644
index 00000000000..9574e2bca3d
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/field_ci.cpp
@@ -0,0 +1,233 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_ci.cpp
+//
+// = DESCRIPTION
+// Visitor for the Valuetype class.
+// This one generates code for accessor and modifier functions of
+// valuetype state members (in the inline file).
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ field_ci,
+ "$Id$")
+
+be_visitor_valuetype_field_ci::be_visitor_valuetype_field_ci (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx),
+ in_obv_space_ (0)
+{
+ setenclosings ("");
+}
+
+be_visitor_valuetype_field_ci::~be_visitor_valuetype_field_ci (void)
+{
+}
+
+int
+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);
+ }
+
+ 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);
+ }
+
+ return 0;
+}
+
+// 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 ();
+ 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.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_ci::"
+ "visit_array - "
+ "bad context information\n"),
+ -1);
+ }
+
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_ci::visit_structure (be_structure *node)
+{
+ 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.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_ci::"
+ "visit_structure - "
+ "bad context information\n"),
+ -1);
+ }
+
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_ci::visit_union (be_union *node)
+{
+ 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.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_ci::"
+ "visit_union - "
+ "bad context information\n"),
+ -1);
+ }
+
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ return 0;
+}
+
+void
+be_visitor_valuetype_field_ci::setenclosings (const char *pre)
+{
+ this->pre_op_ = pre;
+}
+
+const char*
+be_visitor_valuetype_field_ci::pre_op ()
+{
+ return this->pre_op_;
+}
+
+// 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 ();
+ }
+ else
+ {
+ *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
new file mode 100644
index 00000000000..f5ae7a8e2de
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp
@@ -0,0 +1,1192 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_cs.cpp
+//
+// = DESCRIPTION
+// Visitor for the Valuetype class.
+// This one generates code for accessor and modifier functions of
+// valuetype state members (in the stub file).
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+// derived from be_visitor_union_branch/public_ci.cpp
+//
+// ============================================================================
+ACE_RCSID (be_visitor_valuetype,
+ field_cs,
+ "$Id$")
+
+be_visitor_valuetype_field_cs::be_visitor_valuetype_field_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx),
+ in_obv_space_ (0)
+{
+ setenclosings ("");
+}
+
+be_visitor_valuetype_field_cs::~be_visitor_valuetype_field_cs (void)
+{
+}
+
+int
+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);
+ }
+
+ 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);
+ }
+
+ return 0;
+}
+
+// Visit operations on all possible data types that a field can be
+
+int
+be_visitor_valuetype_field_cs::visit_array (be_array *node)
+{
+ 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.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cs::"
+ "visit_array - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ // 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];
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+
+ 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 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 (),
+ 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 << be_nl << 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 " << fname
+ << " val)" << be_nl
+ << "{" << be_idt_nl;
+ *os << fname << "_copy ("
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << ", val);" << be_uidt_nl;
+ *os << "}" << be_nl;
+
+ *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
+ << "}\n" << 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 << "}";
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cs::visit_enum (be_enum *node)
+{
+ 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.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cs::"
+ "visit_enum - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << 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 << "this->"
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << " = val;" << be_uidt_nl;
+
+ *os << "}" << be_nl;
+
+ *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
+ << "{" << be_idt_nl;
+
+ *os << "return this->"
+ << bu->field_pd_prefix() << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << ";" << be_uidt_nl;
+
+ *os << "}";
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cs::visit_interface (be_interface *node)
+{
+ 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.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cs::"
+ "visit_interface - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << 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 () << " =" << be_idt_nl
+ << "TAO::Objref_Traits< ::" << bt->name ()
+ << ">::duplicate (val);" << be_uidt << be_uidt_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);
+
+ *os << "::" << ub->local_name () << " () const"
+ << be_nl
+ << "{" << be_idt_nl;
+
+ *os << "return this->"
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << ".in ();" << be_uidt_nl;
+
+ *os << "}";
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cs::visit_interface_fwd (be_interface_fwd *node)
+{
+ 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.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cs::"
+ "visit_interface - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << 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 ()
+ << " = " << bt->name () << "::_duplicate (val);" << be_uidt_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);
+
+ *os << "::" << ub->local_name () << " () const"
+ << be_nl
+ << "{" << be_idt_nl;
+
+ *os << "return this->"
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << ".in ();" << be_uidt_nl;
+
+ *os << "}";
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cs::visit_valuebox (be_valuebox *node)
+{
+ return this->valuetype_common (node);
+}
+
+int
+be_visitor_valuetype_field_cs::valuetype_common (be_type *node)
+{
+ 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.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cs::"
+ "visit_interface - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << 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 ()
+ << " = val;" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+
+ *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
+ << "{" << be_idt_nl;
+
+ *os << "return this->"
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << ".in ();" << be_uidt_nl;
+
+ *os << "}";
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cs::visit_valuetype (be_valuetype *node)
+{
+ return this->valuetype_common (node);
+}
+
+int
+be_visitor_valuetype_field_cs::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_valuetype_field_cs::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ 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.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cs::"
+ "visit_interface - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << 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 ()
+ << " = val;" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+
+ *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
+ << "{" << be_idt_nl;
+
+ *os << "return this->"
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix
+ ()
+ << ".in ();" << be_uidt_nl;
+
+ *os << "}";
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cs::visit_eventtype_fwd (be_eventtype_fwd *node)
+{
+ return this->visit_valuetype_fwd (node);
+}
+
+int
+be_visitor_valuetype_field_cs::visit_predefined_type (be_predefined_type *node)
+{
+ 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.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cs::"
+ "visit_predef... - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << 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);
+
+ AST_PredefinedType::PredefinedType pt = node->pt ();
+ bool is_object = (pt == AST_PredefinedType::PT_object
+ || pt == AST_PredefinedType::PT_pseudo);
+
+ // IN parameter semantics call for 'const' qualifier except
+ // for interface types, which here are Object and TypeCode.
+ *os << "::" << ub->local_name ()
+ << " (" << (is_object ? "" : "const ") << bt->name ();
+
+ if (is_object)
+ {
+ *os << "_ptr";
+ }
+ else if (pt == AST_PredefinedType::PT_any)
+ {
+ *os << " &";
+ }
+
+ *os << " val)" << be_nl
+ << "{" << be_idt_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:
+ 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 ()
+ << ".in ();" << be_uidt_nl
+ << "}";
+
+ break;
+ case AST_PredefinedType::PT_any:
+ *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 ()
+ << ";" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *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 ()
+ << ";" << be_uidt_nl
+ << "}";
+
+ break;
+ case AST_PredefinedType::PT_void:
+ break;
+ default:
+ *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 ()
+ << ";" << be_uidt_nl
+ << "}";
+
+ break;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cs::visit_sequence (be_sequence *node)
+{
+ 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.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cs::"
+ "visit_sequence - "
+ "bad context information\n"),
+ -1);
+ }
+
+ 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
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ *os << be_nl << 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;
+
+ *os << "this->"
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << " = val;" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+
+ *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 ()
+ << ";" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *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()
+ << ";" << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cs::visit_string (be_string *node)
+{
+ 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);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Three methods to set the string value.
+
+ *os << be_nl << 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);
+
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "::" << ub->local_name () << " (char *val)";
+ }
+ else
+ {
+ *os << "::" << ub->local_name () << " ( ::CORBA::WChar *val)";
+ }
+
+ *os << be_nl
+ << "{" << be_idt_nl;
+ *os << "this->"
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << " = (val);" << be_uidt_nl
+ << "}" << be_nl << 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 ();
+
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << " (const char *val)" << be_nl;
+ }
+ else
+ {
+ *os << " (const ::CORBA::WChar *val)" << be_nl;
+ }
+
+ *os << "{" << be_idt_nl;
+
+ *os << "// Set the value." << be_nl
+ << "this->"
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << " = ";
+
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "::CORBA::string_dup (val);" << be_uidt_nl;
+ }
+ else
+ {
+ *os << "::CORBA::wstring_dup (val);" << be_uidt_nl;
+ }
+
+ *os << "}" << be_nl << 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))
+ {
+ *os << " (const ::CORBA::String_var &val)" << be_nl;
+ }
+ else
+ {
+ *os << " (const ::CORBA::WString_var &val)" << be_nl;
+ }
+
+ *os << "{" << be_idt_nl;
+
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << "::CORBA::String_var " << ub->local_name ();
+ }
+ else
+ {
+ *os << "::CORBA::WString_var " << ub->local_name ();
+ }
+
+ *os << "_var = val;" << be_nl
+ << "this->"
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << " = "
+ << ub->local_name () << "_var._retn ();" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+
+ if (node->width () == (long) sizeof (char))
+ {
+ *os << this->pre_op () << "const char *" << be_nl;
+ }
+ else
+ {
+ *os << this->pre_op () << "const ::CORBA::WChar *" << be_nl;
+ }
+
+ 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 ()
+ << ";" << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cs::visit_structure (be_structure *node)
+{
+ 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.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cs::"
+ "visit_structure - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ *os << be_nl << 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;
+
+ *os << "this->"
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << " = val;" << be_uidt_nl;
+
+ *os << "}" << be_nl;
+
+ *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;
+ *os << "return this->"
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << ";" << be_uidt_nl;
+ *os << "}" << be_nl;
+
+ *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;
+ *os << "return this->"
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << ";" << be_uidt_nl;
+ *os << "}";
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cs::visit_typedef (be_typedef *node)
+{
+ 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);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_valuetype_field_cs::visit_union (be_union *node)
+{
+ 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.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_field_cs::"
+ "visit_union - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ 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);
+ }
+ }
+
+ *os << be_nl << 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 << "this->" << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix () << " = val;" << be_uidt_nl;
+ *os << "}" << be_nl;
+
+ *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 ()
+ << ";" << be_uidt_nl
+ << "}" << be_nl;
+
+ *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 ()
+ << ";" << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+void
+be_visitor_valuetype_field_cs::setenclosings (const char *pre)
+{
+ this->pre_op_ = pre;
+}
+
+const char*
+be_visitor_valuetype_field_cs::pre_op ()
+{
+ return this->pre_op_;
+}
+
+// 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 ();
+ }
+ else
+ {
+ *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
new file mode 100644
index 00000000000..55aec2de444
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_ch.cpp
@@ -0,0 +1,90 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// marshal_ch.cpp
+//
+// = DESCRIPTION
+// Concrete visitor for valuetypes.
+// This one provides code generation for marshalling.
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+// based on code from Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ marshal_ch,
+ "$Id$")
+
+// ***************************************************************************
+// Structure visitor for generating declarations
+// ***************************************************************************
+
+be_visitor_valuetype_marshal_ch::be_visitor_valuetype_marshal_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_valuetype_marshal_ch::~be_visitor_valuetype_marshal_ch (void)
+{
+}
+
+int
+be_visitor_valuetype_marshal_ch::visit_valuetype (be_valuetype *node)
+{
+ this->elem_number_ = 0;
+
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next())
+ {
+ AST_Decl *d = si.item ();
+
+ if (!d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_scope::visit_scope - "
+ "bad node in this scope\n"),
+ -1);
+
+ }
+
+ be_field *field = be_field::narrow_from_decl (d);
+
+ if (field)
+ {
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_valuetype_field_cdr_ch visitor (&ctx);
+ visitor.pre_ = node->field_pd_prefix ();
+ visitor.post_ = node->field_pd_postfix ();
+
+ if (visitor.visit_field (field) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_marshal_ch::"
+ "visit_valuetype - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_marshal_ch::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp
new file mode 100644
index 00000000000..ef1bcb17051
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp
@@ -0,0 +1,302 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// marshal_cs.cpp
+//
+// = DESCRIPTION
+// Concrete visitor for valuetypes.
+// This one provides code generation for marshalling.
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ marshal_cs,
+ "$Id$")
+
+be_visitor_valuetype_marshal_cs::be_visitor_valuetype_marshal_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_valuetype_marshal_cs::~be_visitor_valuetype_marshal_cs (void)
+{
+}
+
+int
+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);
+
+ *os << "::_tao_marshal_state (TAO_OutputCDR &";
+
+ be_valuetype *inh = node->statefull_inherit ();
+
+ // If the valuetype has no fields, and no stateful inherit,
+ // the stream arg is unused.
+ if (inh != 0 || node->data_members_count () > 0)
+ {
+ *os << "strm";
+ }
+
+ *os << ", TAO_ChunkInfo&";
+ // If the valuetype has no fields, and no stateful inherit,
+ // the chunking helper arg is unused.
+ if (inh != 0 || node->data_members_count () > 0)
+ {
+ *os << "ci";
+ }
+
+ *os << ") const" << be_nl
+ << "{" << be_idt_nl;
+
+ if (inh)
+ {
+ *os << "if (! ci.start_chunk (strm))" << be_idt_nl;
+ *os << "return false;" << be_uidt_nl << be_nl;
+
+ if (inh->opt_accessor ())
+ {
+ *os << "if (!this->";
+
+ this->class_name (inh, os);
+
+ *os << "::_tao_marshal_state (strm, ci))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+ }
+ // Can access base class only via virtual function.
+ else
+ {
+ *os << "if (! this->_tao_marshal__"
+ << inh->flat_name ()
+ << " (strm, ci))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+ }
+ }
+
+ be_visitor_context new_ctx = *this->ctx_;
+ be_visitor_valuetype_field_cdr_decl field_out_cdr (&new_ctx);
+ field_out_cdr.visit_scope (node);
+
+ if (node->data_members_count () > 0)
+ {
+ *os << "if (! ci.start_chunk (strm))" << be_idt_nl;
+ *os << "return false;" << be_uidt_nl << be_nl;
+ *os << "CORBA::Boolean const ret = " << be_idt << be_idt_nl;
+
+ // All we have to do is to visit the scope and generate code.
+ this->gen_fields (node,
+ *this->ctx_);
+
+ *os << ";" << be_uidt << be_uidt_nl;
+
+ *os << "if ( ! ret) " << be_idt_nl;
+ *os << "return false; " << be_uidt_nl << be_nl;
+ *os << "if (! ci.end_chunk (strm))" << be_idt_nl;
+ *os << "return false;" << be_uidt_nl << be_nl;
+ }
+
+ if (inh)
+ {
+ *os << "if (! ci.end_chunk (strm))" << be_idt_nl;
+ *os << "return false;" << be_uidt_nl << be_nl;
+ }
+
+ *os << "return true;" << be_uidt_nl;
+ *os << "}" << 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;
+
+ this->class_name (node, os);
+
+ *os << "::_tao_unmarshal_state (TAO_InputCDR &";
+
+ // If the valuetype has no fields, and no stateful inherit,
+ // the stream arg is unused.
+ if (inh != 0 || node->data_members_count () > 0)
+ {
+ *os << "strm";
+ }
+
+ *os << ", TAO_ChunkInfo&";
+ // If the valuetype has no fields, and no stateful inherit,
+ // the chunking helper arg is unused.
+ if (inh != 0 || node->data_members_count () > 0)
+ {
+ *os << "ci";
+ }
+
+ *os << ")" << be_nl
+ << "{" << be_idt_nl;
+
+ if (inh)
+ {
+ *os << "if (! ci.handle_chunking (strm))" << be_idt_nl;
+ *os << "return false;" << be_uidt_nl << be_nl;
+
+ if (inh->opt_accessor ())
+ {
+ *os << "if (!this->";
+
+ this->class_name (inh, os);
+
+ *os << "::_tao_unmarshal_state (strm, ci))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+ }
+ else // only can access base class via virtual function
+ {
+ *os << "if (! this->_tao_unmarshal__"
+ << inh->flat_name ()
+ << " (strm, ci))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+ }
+ }
+
+ be_visitor_valuetype_field_cdr_decl field_in_cdr (&new_ctx);
+ field_in_cdr.visit_scope (node);
+
+ if (node->data_members_count () > 0)
+ {
+ *os << "if (! ci.handle_chunking (strm))" << be_idt_nl;
+ *os << "return false;" << be_uidt_nl << be_nl;
+ *os << "CORBA::Boolean const ret = " << be_idt << be_idt_nl;
+
+ // All we have to do is to visit the scope and generate code.
+ this->gen_fields (node,
+ *this->ctx_);
+
+ *os << ";" << be_uidt << be_uidt_nl;
+
+ *os << "if ( ! ret) " << be_idt_nl;
+ *os << "return false; " << be_uidt_nl << be_nl;
+ *os << "if (this->require_truncation_)" << be_idt_nl;
+ *os << "return ci.skip_chunks (strm);" << be_uidt_nl << be_nl;
+ *os << "else" << be_idt_nl;
+ *os << "return ci.handle_chunking (strm);" << be_uidt_nl << be_nl;
+ }
+ else
+ *os << "return true;";
+ *os << be_uidt_nl << "}" << be_nl << be_nl;
+
+ *os << "void" << be_nl;
+
+ this->class_name (node, os);
+
+ *os << "::truncation_hook (void)" << be_nl
+ << "{" << be_idt_nl
+ << "this->require_truncation_ = true;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_marshal_cs::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+void
+be_visitor_valuetype_marshal_cs::class_name (be_valuetype *node,
+ TAO_OutStream *os)
+{
+ if (node->opt_accessor ())
+ {
+ be_decl *scope =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+
+ *os << scope->name () << "::"
+ << node->local_name ();
+ }
+ else
+ {
+ *os << node->full_obv_skel_name ();
+ }
+}
+
+// Operations for field marshaling.
+int
+be_visitor_valuetype_marshal_cs::gen_fields (be_valuetype *node,
+ be_visitor_context &ctx)
+{
+ int n_processed = 0;
+ TAO_OutStream *os = ctx.stream ();
+ this->elem_number_ = 0;
+
+ // Initialize an iterator to iterate thru our scope.
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next())
+ {
+ AST_Decl *d = si.item ();
+
+ if (!d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_scope::visit_scope - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ be_field *field = be_field::narrow_from_decl (d);
+
+ if (field)
+ {
+ if (n_processed > 0)
+ {
+ *os << " &&" << be_nl;
+ }
+
+ ++n_processed;
+ be_visitor_valuetype_field_cdr_cs visitor (&ctx);
+ visitor.pre_ = node->field_pd_prefix ();
+ visitor.post_ = node->field_pd_postfix ();
+
+ if (visitor.visit_field (field) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_marshal_cs::"
+ "visit_valuetype - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+ }
+ }
+
+ if (n_processed == 0)
+ {
+ *os << "true";
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/obv_module.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/obv_module.cpp
new file mode 100644
index 00000000000..c69154e3dce
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/obv_module.cpp
@@ -0,0 +1,287 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// obv_module.cpp
+//
+// = DESCRIPTION
+// Concrete visitor for the Module class
+// This provides code generation for the module in the header
+// for the OBV_ namespace (see C++ mapping OMG 20.17)
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_obv_module,
+ obv_module,
+ "$Id$")
+
+// ************************************************************
+// OBV module visitor for server header.
+// ************************************************************
+
+be_visitor_obv_module::be_visitor_obv_module (be_visitor_context *ctx)
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_obv_module::~be_visitor_obv_module (void)
+{
+}
+
+int
+be_visitor_obv_module::visit_module (be_module *node)
+{
+ if (node->imported ())
+ {
+ return 0;
+ }
+
+ if (node->has_nested_valuetype ())
+ {
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_MODULE_OBV_CH)
+ {
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "namespace ";
+
+ if (!node->is_nested ())
+ {
+ // We are outermost module, so prepend.
+ *os << "OBV_" << node->local_name () << be_nl;
+ }
+ else
+ {
+ // We are inside another module.
+ *os << node->local_name () << be_nl;
+ }
+
+ *os << "{" << be_idt;
+ }
+
+ 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);
+ }
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_MODULE_OBV_CH)
+ {
+ *os << be_uidt_nl << "}";
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_obv_module::visit_valuetype (be_valuetype *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 1;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_MODULE_OBV_CH:
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_OBV_CH);
+ break;
+ case TAO_CodeGen::TAO_MODULE_OBV_CI:
+ {
+ // 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;
+ default:
+ return 0;
+ }
+
+ 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);
+ }
+
+ if (node->accept (visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_obv_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_obv_module::"
+ "visit_valuetype - "
+ "NUL visitor\n"),
+ -1);
+ }
+
+ if (node->accept (visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_obv_module::"
+ "visit_valuetype - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ delete visitor;
+ visitor = 0;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_obv_module::visit_eventtype (be_eventtype *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 1;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_MODULE_OBV_CH:
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_OBV_CH);
+ break;
+ case TAO_CodeGen::TAO_MODULE_OBV_CI:
+ {
+ // 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;
+ default:
+ return 0;
+ }
+
+ 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);
+ }
+
+ if (node->accept (visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_obv_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_obv_module::"
+ "visit_valuetype - "
+ "NUL visitor\n"),
+ -1);
+ }
+
+ if (node->accept (visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_obv_module::"
+ "visit_valuetype - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ delete visitor;
+ visitor = 0;
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp
new file mode 100644
index 00000000000..ebbbd55dca8
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp
@@ -0,0 +1,986 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Valuetypes. This is a generic visitor.
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+// based on interface.cpp from Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ valuetype,
+ "$Id$")
+
+be_visitor_valuetype::be_visitor_valuetype (be_visitor_context *ctx)
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_valuetype::~be_visitor_valuetype (void)
+{
+}
+
+int
+be_visitor_valuetype::visit_valuetype_scope (be_valuetype *node)
+{
+ this->elem_number_ = 0;
+
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next())
+ {
+ AST_Decl *d = si.item ();
+
+ if (!d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_scope::visit_scope - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ be_decl *bd = be_decl::narrow_from_decl (d);
+ // 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 ());
+ this->ctx_->node (bd);
+ this->elem_number_++;
+
+ AST_Field *field = AST_Field::narrow_from_decl (d);
+
+ if (field != 0 && field->visibility () == AST_Field::vis_PRIVATE)
+ {
+ this->begin_private ();
+ }
+ else
+ {
+ this->begin_public ();
+ }
+
+ if (bd == 0 || bd->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_scope::visit_scope - "
+ "codegen for scope failed\n"),
+ -1);
+
+ }
+ }
+
+ return 0;
+}
+
+// These two are called from visit_valuetype_scope()
+void
+be_visitor_valuetype::begin_public ()
+{
+ // In derived visitors print "public:" in class definition
+}
+
+void
+be_visitor_valuetype::begin_private ()
+{
+ // In derived visitors print "protected:" in class definition
+}
+
+// All common visit methods for valuetype visitor.
+
+int
+be_visitor_valuetype::visit_attribute (be_attribute *node)
+{
+ this->ctx_->node (node);
+ this->ctx_->attribute (node);
+
+ be_operation get_op (node->field_type (),
+ AST_Operation::OP_noflags,
+ node->name (),
+ 0,
+ 0);
+
+ get_op.set_name ((UTL_IdList *) node->name ()->copy ());
+
+ if (this->visit_operation (&get_op) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_attribute::"
+ "visit_attribute - "
+ "codegen for get_attribute failed\n"),
+ -1);
+ }
+
+ get_op.destroy ();
+
+ if (node->readonly ())
+ {
+ // Nothing else to do.
+ return 0;
+ }
+
+ Identifier id ("void");
+
+ UTL_ScopedName sn (&id,
+ 0);
+
+ be_predefined_type rt (AST_PredefinedType::PT_void,
+ &sn);
+
+ // Argument type is the same as the attribute type.
+ AST_Argument *arg =
+ idl_global->gen ()->create_argument (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 (),
+ 0,
+ 0);
+
+ set_op.set_name ((UTL_IdList *) node->name ()->copy ());
+ set_op.be_add_argument (arg);
+
+ if (this->visit_operation (&set_op) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_attribute::"
+ "visit_attribute - "
+ "codegen for set_attribute failed\n"),
+ -1);
+ }
+
+ set_op.destroy ();
+ rt.destroy ();
+
+ return 0;
+}
+
+
+int
+be_visitor_valuetype::visit_constant (be_constant *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_constant_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_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:
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ case TAO_CodeGen::TAO_ROOT_CI:
+ case TAO_CodeGen::TAO_ROOT_SH:
+ case TAO_CodeGen::TAO_ROOT_IH:
+ case TAO_CodeGen::TAO_ROOT_IS:
+ case TAO_CodeGen::TAO_ROOT_SI:
+ case TAO_CodeGen::TAO_ROOT_SS:
+ return 0; // Nothing to be done.
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype::"
+ "visit_constant - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype::"
+ "visit_constant - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype::visit_enum (be_enum *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_enum_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_enum_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_enum_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_enum_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_enum_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_enum_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:
+ case TAO_CodeGen::TAO_ROOT_CI:
+ case TAO_CodeGen::TAO_ROOT_SH:
+ case TAO_CodeGen::TAO_ROOT_IH:
+ case TAO_CodeGen::TAO_ROOT_IS:
+ case TAO_CodeGen::TAO_ROOT_SI:
+ case TAO_CodeGen::TAO_ROOT_SS:
+ return 0; // Nothing to be done.
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype::"
+ "visit_enum - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype::"
+ "visit_enum - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype::visit_exception (be_exception *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_exception_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_exception_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_exception_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_exception_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_exception_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_exception_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_exception_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // Nothing to be done.
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface::"
+ "visit_exception - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype::visit_structure (be_structure *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_structure_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_structure_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_structure_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_structure_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_structure_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_structure_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ {
+ be_visitor_structure_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // Nothing to be done.
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype::"
+ "visit_structure - "
+ "failed to accept visitor\n"),
+ -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_ROOT_CH:
+ {
+ be_visitor_structure_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype::"
+ "visit_structure_fwd - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype::visit_union (be_union *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_union_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_union_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_union_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_union_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_union_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_union_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_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:
+ case TAO_CodeGen::TAO_ROOT_SH:
+ case TAO_CodeGen::TAO_ROOT_IH:
+ case TAO_CodeGen::TAO_ROOT_IS:
+ case TAO_CodeGen::TAO_ROOT_SI:
+ case TAO_CodeGen::TAO_ROOT_SS:
+ return 0; // Nothing to be done.
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype::"
+ "visit_union - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype::"
+ "visit_union - "
+ "failed to accept visitor\n"),
+ -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_ROOT_CH:
+ {
+ be_visitor_union_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ default:
+ return 0; // nothing to be done
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype::"
+ "visit_union_fwd - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype::visit_typedef (be_typedef *node)
+{
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ be_visitor_typedef_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ {
+ be_visitor_typedef_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_typedef_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ {
+ be_visitor_typedef_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ {
+ be_visitor_typedef_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ be_visitor_typedef_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_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:
+ case TAO_CodeGen::TAO_ROOT_SH:
+ case TAO_CodeGen::TAO_ROOT_IH:
+ case TAO_CodeGen::TAO_ROOT_IS:
+ case TAO_CodeGen::TAO_ROOT_SI:
+ case TAO_CodeGen::TAO_ROOT_SS:
+ return 0; // Nothing to be done.
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype::"
+ "visit_typedef - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype::"
+ "visit_typedef - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype::visit_field (be_field *)
+{
+ // Is overridden in derived visitors.
+ return 0;
+}
+
+
+// Private data fields for scope.
+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);
+ !si.is_done ();
+ si.next())
+ {
+ AST_Decl *d = si.item ();
+
+ if (!d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_scope::visit_scope - "
+ "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.
+ this->ctx_->node (field);
+ this->elem_number_++;
+
+ if (this->gen_field_pd (field) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_scope::visit_scope - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+// Private data for field.
+int
+be_visitor_valuetype::gen_field_pd (be_field *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // First generate the type information.
+ 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)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_ch::"
+ "visit_field - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_field_ch visitor (&ctx);
+
+ *os << be_nl;
+
+ if (bt->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_ch::"
+ "visit_field - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ // Now output the field name.
+ *os << " " << vt->field_pd_prefix ()
+ << node->local_name ()
+ << vt->field_pd_postfix () << ";";
+
+ return 0;
+}
+
+void
+be_visitor_valuetype::gen_obv_init_constructor_args (be_valuetype *node,
+ unsigned long &index)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ AST_ValueType *parent = node->inherits_concrete ();
+
+ // Generate for inherited members first.
+ if (parent != 0)
+ {
+ be_valuetype *be_parent =
+ be_valuetype::narrow_from_decl (parent);
+ this->gen_obv_init_constructor_args (be_parent, index);
+ }
+
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_args_arglist visitor (&ctx);
+
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next())
+ {
+ be_field *f = be_field::narrow_from_decl (si.item ());
+
+ if (f == 0)
+ {
+ continue;
+ }
+
+ *os << (index++ != 0 ? "," : "") << be_nl;
+
+ ACE_CString arg_name ("_tao_init_");
+ arg_name += f->local_name ()->get_string ();
+ Identifier id (arg_name.c_str ());
+ UTL_ScopedName sn (&id, 0);
+ be_type *ft = be_type::narrow_from_decl (f->field_type ());
+ bool seen = ft->seen_in_operation ();
+
+ // This sets ft->seen_in_operation (true), so we have to
+ // restore the original value below.
+ be_argument arg (AST_Argument::dir_IN,
+ ft,
+ &sn);
+ ft->seen_in_operation (seen);
+ visitor.visit_argument (&arg);
+
+ // AST_Argument inherits from AST_Field, which will destroy
+ // its field type if it is anonymous - we don't want that.
+ arg.be_decl::destroy ();
+ arg.AST_Decl::destroy ();
+ id.destroy ();
+ }
+}
+
+// Generate the _init definition.
+int
+be_visitor_valuetype::gen_init_defn (be_valuetype *node)
+{
+ if (node->is_abstract ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "class " << be_global->stub_export_macro ()
+ << " " << node->local_name ()
+ << "_init : public ::CORBA::ValueFactoryBase" << be_nl;
+
+ // Generate the body.
+ *os << "{" << be_nl
+ << "public:" << be_idt_nl
+ << "virtual ~" << node->local_name () << "_init (void);" << be_nl;
+
+ *os << "virtual const char* tao_repository_id (void);\n" << be_nl;
+ *os << "// create () goes here" << be_nl;
+ *os << be_uidt_nl << "};" << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_valuetype::gen_init_impl (be_valuetype *node)
+{
+ if (node->is_abstract ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ os->indent ();
+
+ 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 (lname,
+ '\0',
+ NAMEBUFSIZE);
+ ACE_OS::sprintf (lname,
+ "%s_init",
+ node->local_name ());
+
+ // Destructor.
+ *os << fname << "::~" << lname << " (void)" << be_nl
+ << "{" << be_nl << "}\n\n";
+
+ *os << "const char* " << be_nl
+ << fname << "::tao_repository_id (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return " << node->local_name ()
+ << "::_tao_obv_static_repository_id ();"
+ << be_uidt_nl << "}\n\n";
+
+ return 0;
+}
+
+bool
+be_visitor_valuetype::obv_need_ref_counter (be_valuetype* node)
+{
+ // Go thru our base VTs and see if one has already.
+ for (int i = 0; i < node->n_inherits (); ++i)
+ {
+ be_valuetype *vt =
+ be_valuetype::narrow_from_decl (node->inherits ()[i]);
+
+ if (vt != 0)
+ {
+ if (be_visitor_valuetype::obv_have_ref_counter (vt))
+ {
+ return false;
+ }
+ }
+ }
+
+ // If we inherit from CORBA::Object and/or CORBA::AbstractBase
+ // (in addition to CORBA::ValueBase) we have to override _add_ref()
+ // and _remove_ref() by calling the one in DefaultValueRefCountBase
+ // to avoid ambiguity.
+ if (node->n_supports () > 0)
+ {
+ return true;
+ }
+
+ // VT needs RefCounter if it has concrete factory.
+ if (be_valuetype::FS_CONCRETE_FACTORY == node->determine_factory_style ())
+ {
+ return true;
+ }
+
+ return false;
+}
+
+bool
+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)
+ {
+ return false;
+ }
+
+ if (node->determine_factory_style () == be_valuetype::FS_CONCRETE_FACTORY)
+ {
+ return true;
+ }
+
+ // Now go thru our base VTs.
+ for (int i = 0; i < node->n_inherits (); ++i)
+ {
+ be_valuetype *vt = be_valuetype::narrow_from_decl (node->inherits ()[i]);
+
+ if (vt != 0)
+ {
+ if (be_visitor_valuetype::obv_have_ref_counter (vt))
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+bool
+be_visitor_valuetype::is_amh_exception_holder (be_valuetype *node)
+{
+ if (ACE_OS::strncmp (node->local_name (), "AMH_", 4) == 0)
+ {
+ const char *last_E =
+ ACE_OS::strrchr (node->full_name (), 'E');
+
+ if (last_E != 0
+ && ACE_OS::strcmp (last_E, "ExceptionHolder") == 0)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp
new file mode 100644
index 00000000000..fef8e7466a5
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp
@@ -0,0 +1,546 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Valuetypes in the client header
+// (see C++ mapping OMG 20.17)
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>,
+// based on interface_ch.cpp from Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_ch,
+ "$Id$")
+
+// ******************************************************
+// Valuetype visitor for client header
+// ******************************************************
+
+be_visitor_valuetype_ch::be_visitor_valuetype_ch (be_visitor_context *ctx)
+ : be_visitor_valuetype (ctx)
+{
+}
+
+be_visitor_valuetype_ch::~be_visitor_valuetype_ch (void)
+{
+}
+
+int
+be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node)
+{
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ // Evaluate the member in time for the decision to generate
+ // the recursive typecode include in the stub source file.
+ ACE_Unbounded_Queue<AST_Type *> list;
+ (void) node->in_recursion (list);
+
+ // This will be a no-op if it has alread by done by a forward
+ // declaration.
+ node->gen_var_out_seq_decls ();
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ int status = 0;
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // Now the valuetype definition itself.
+ os->gen_ifdef_macro (node->flat_name ());
+
+ if (node->node_type () == AST_Decl::NT_eventtype)
+ {
+ *os << be_nl << be_nl
+ << "class " << node->local_name () << "Consumer;" << be_nl
+ << "typedef " << node->local_name () << "Consumer *"
+ << node->local_name () << "Consumer_ptr;";
+ }
+
+ // Now generate the class definition.
+ *os << be_nl << be_nl << "class " << be_global->stub_export_macro ()
+ << " " << node->local_name ();
+
+ // Node valuetype inherits from other valuetypes (OMG 20.17.9)
+ // (ordinary (not abstract) interfaces ignored).
+
+ *os << be_idt_nl << ": " << be_idt;
+
+ long i; // loop index
+ be_valuetype *inherited = 0;
+ long n_inherits = node->n_inherits ();
+ int inherits_eventtype = 0;
+
+ if (n_inherits > 0)
+ {
+ for (i = 0; i < n_inherits; ++i)
+ {
+ inherited =
+ be_valuetype::narrow_from_decl (node->inherits ()[i]);
+
+ if (inherited->node_type () == AST_Decl::NT_eventtype)
+ {
+ inherits_eventtype = 1;
+ }
+
+ if (i > 0)
+ {
+ *os << "," << be_nl;
+ }
+
+ be_decl *scope = 0;
+
+ if (inherited->is_nested ())
+ {
+ // Inherited node is used in the scope of "node" node.
+ scope =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+ }
+
+ // Dump the scoped name.
+ *os << "public virtual ";
+ *os << inherited->nested_type_name (scope);
+ } // end of for loop
+ }
+
+ /***********************************************************************
+ ** 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
+ ** 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.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-abstract.
+ ** 2.6) Generate the right throw spec for the AMH ExceptionHolders
+ ************************************************************************/
+
+ /****************************************************************/
+ // 1) Find out if the ValueType is an AMH_*ExceptionHolder
+ bool is_an_amh_exception_holder = this->is_amh_exception_holder (node);
+
+ if (is_an_amh_exception_holder)
+ {
+ if (n_inherits > 0)
+ {
+ *os << "," << be_nl;
+ }
+
+ *os << "public virtual ::CORBA::DefaultValueRefCountBase";
+ }
+ else if (node->node_type () == AST_Decl::NT_eventtype)
+ {
+ if (inherits_eventtype == 0)
+ {
+ if (n_inherits > 0)
+ {
+ *os << "," << be_nl;
+ }
+
+ *os << "public virtual ::Components::EventBase";
+ }
+ }
+ else if (n_inherits == 0)
+ {
+ *os << "public virtual ::CORBA::ValueBase";
+ }
+
+ // Generate the supported interfaces.
+ for (i = 0; i < node->n_supports (); ++i)
+ {
+ *os << "," << be_nl
+ << "public virtual "
+ << node->supports ()[i]->name ();
+ }
+
+ // Generate the body.
+ *os << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl
+ << "typedef " << node->local_name () << " * _ptr_type;" << be_nl
+ << "typedef " << node->local_name () << "_var _var_type;"
+ << be_nl
+ << "typedef " << node->local_name () << "_out _out_type;"
+ << be_nl << be_nl;
+
+ if (is_an_amh_exception_holder)
+ {
+ // Generate the constructor and destructor.
+ *os << node->local_name () << " ( ::CORBA::Exception *ex)" << be_idt_nl
+ << ": exception (ex)" << be_uidt_nl
+ << "{}" << be_nl << be_nl
+ << "virtual ~" << node->local_name () << " (void);"
+ << be_nl << be_nl;
+ }
+
+ *os << "static " << node->local_name () << "* "
+ << "_downcast ( ::CORBA::ValueBase *v);" << be_nl
+ << be_nl
+ << "// (TAO extensions or internals)" << be_nl
+ << "static ::CORBA::Boolean _tao_unmarshal (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &strm," << be_nl
+ << node->local_name () << " *&new_object" << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl
+ << "virtual const char* "
+ << "_tao_obv_repository_id (void) const;"
+ << be_nl << be_nl
+ << "virtual void "
+ << "_tao_obv_truncatable_repo_ids (Repository_Id_List &) const;"
+ << be_nl << be_nl
+ << "static const char* "
+ << "_tao_obv_static_repository_id (void);" << be_nl << be_nl;
+
+ if (be_global->any_support ())
+ {
+ *os << "static void _tao_any_destructor (void *);";
+ }
+
+ // Generate code for the valuetype definition.
+ if (this->visit_valuetype_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ch::"
+ "visit_valuetype - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ // 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,
+ false,
+ true
+ );
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ch::"
+ "visit_valuetype - "
+ "traversal of supported interfaces failed\n"),
+ -1);
+ }
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // If we inherit from CORBA::Object and/or CORBA::AbstractBase
+ // (in addition to CORBA::ValueBase) we have to add these
+ // to avoid ambiguity.
+ if (node->n_supports () > 0)
+ {
+ *os << be_uidt_nl << be_nl << "public:" << be_idt_nl;
+ *os << be_nl << "virtual void _add_ref (void) = 0;" << be_nl;
+ *os << "virtual void _remove_ref (void) = 0;" << be_nl;
+ *os << "virtual ::CORBA::ValueBase *_tao_to_value (void);";
+ }
+
+ // Generate the "protected" constructor so that users cannot
+ // instantiate us.
+ *os << be_uidt_nl << be_nl << "protected:" << be_idt_nl
+ << node->local_name ()
+ << " (void);" << be_nl;
+
+ if (!is_an_amh_exception_holder)
+ {
+ *os << "virtual ~" << node->local_name () << " (void);"
+ << be_nl << be_nl;
+ }
+
+ // Support for marshalling.
+ if (!node->is_abstract () || is_an_amh_exception_holder)
+ {
+ *os << "virtual ::CORBA::Boolean "
+ << "_tao_marshal_v (TAO_OutputCDR &) const;" << be_nl;
+ *os << "virtual ::CORBA::Boolean "
+ << "_tao_unmarshal_v (TAO_InputCDR &);" << be_nl;
+ *os << "virtual ::CORBA::Boolean "
+ << "_tao_match_formal_type (ptrdiff_t ) const;" << be_nl;
+ }
+
+ // Private member:
+
+ // Private copy constructor and assignment operator. These are not
+ // allowed, hence they are private.
+ *os << be_uidt_nl << "private:" << be_idt_nl;
+ *os << node->local_name () << " (const " << node->local_name () << " &);"
+ << be_nl
+ << "void operator= (const " << node->local_name () << " &);"
+ << be_nl;
+
+ /*********************************************************/
+ // 2.4
+ if (is_an_amh_exception_holder)
+ {
+ *os << be_nl
+ << "::CORBA::Exception *exception;"
+ << be_nl;
+ }
+ /*********************************************************/
+
+
+ // Map fields to private data (if optimizing).
+ if (node->opt_accessor ())
+ {
+ *os << be_uidt_nl << "protected:" << be_idt_nl;
+ *os << "::CORBA::Boolean "
+ << "_tao_marshal_state (TAO_OutputCDR &) const;" << be_nl
+ << "::CORBA::Boolean "
+ << "_tao_unmarshal_state (TAO_InputCDR &);" << be_nl
+ << "virtual void "
+ << "truncation_hook (void);"
+ << 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 ())
+ {
+ *os << be_uidt_nl << "protected:" << be_idt_nl;
+
+ if (is_an_amh_exception_holder)
+ {
+ *os << "virtual ::CORBA::Boolean" << be_nl
+ << "_tao_marshal__" << node->flat_name ()
+ << " (TAO_OutputCDR &, TAO_ChunkInfo &) const;"
+ << be_nl << be_nl;
+ *os << "virtual ::CORBA::Boolean" << be_nl
+ << "_tao_unmarshal__" << node->flat_name ()
+ << " (TAO_InputCDR &, TAO_ChunkInfo &);";
+ }
+ else
+ {
+ *os << "virtual ::CORBA::Boolean" << be_nl
+ << "_tao_marshal__" << node->flat_name ()
+ << " (TAO_OutputCDR &, TAO_ChunkInfo &) const = 0;"
+ << be_nl << be_nl;
+ *os << "virtual ::CORBA::Boolean" << be_nl
+ << "_tao_unmarshal__" << node->flat_name ()
+ << " (TAO_InputCDR &, TAO_ChunkInfo &) = 0;";
+ }
+ }
+ }
+
+ *os << be_uidt_nl
+ << "};";
+
+ os->gen_endif ();
+
+ // Generate the _init -related declarations.
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_valuetype_init_ch visitor (&ctx);
+
+ if (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);
+ }
+
+ // Step last: generate typecode declaration.
+ if (be_global->tc_support ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_typecode_decl visitor (&ctx);
+
+ 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 (true);
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_ch::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_valuetype_ch::visit_operation (be_operation *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node); // save the node
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+
+ // Every operation is declared public and virtual in the client code.
+ *os << be_uidt_nl << "public:" << be_idt_nl << "virtual ";
+
+ be_type *bt = be_type::narrow_from_decl (node->return_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ch::"
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
+ }
+
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_operation_rettype or_visitor (&ctx);
+
+ if (bt->accept (&or_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ch::"
+ "visit_operation - "
+ "codegen for return type failed\n"),
+ -1);
+ }
+
+ *os << " " << node->local_name ();
+
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CH);
+ be_visitor_obv_operation_arglist ooa_visitor (&ctx);
+
+ if (node->accept (&ooa_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ch::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_ch::visit_field (be_field *node)
+{
+ be_valuetype *vt = be_valuetype::narrow_from_scope (node->defined_in ());
+
+ if (!vt)
+ {
+ return -1;
+ }
+
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_valuetype_field_ch visitor (&ctx);
+
+ if (vt->opt_accessor ())
+ {
+ visitor.setenclosings ("",";");
+ }
+ else
+ {
+ visitor.setenclosings ("virtual "," = 0;");
+ }
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_obv_ch::"
+ "visit_field - codegen failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+
+void
+be_visitor_valuetype_ch::begin_public (void)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_uidt_nl << be_nl << "public:"
+ << be_idt;
+}
+
+void
+be_visitor_valuetype_ch::begin_private (void)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_uidt_nl << be_nl << "protected:"
+ << be_idt;
+}
+
+int
+be_visitor_valuetype_ch::gen_supported_ops (be_interface *,
+ be_interface *base,
+ TAO_OutStream *os)
+{
+
+ 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
new file mode 100644
index 00000000000..eed0287f2ff
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp
@@ -0,0 +1,129 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_ci.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Valuetypes in the client inline file
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+// based on code from Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_ci,
+ "$Id$")
+
+// **************************************************
+// Valuetype visitor for client inline.
+// **************************************************
+
+be_visitor_valuetype_ci::be_visitor_valuetype_ci (be_visitor_context *ctx)
+ : be_visitor_valuetype (ctx),
+ opt_accessor_ (0)
+{
+}
+
+be_visitor_valuetype_ci::~be_visitor_valuetype_ci (void)
+{
+}
+
+int
+be_visitor_valuetype_ci::visit_valuetype (be_valuetype *node)
+{
+ if (node->cli_inline_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ if (node->opt_accessor ())
+ {
+ this->opt_accessor_ = 1;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "ACE_INLINE" << be_nl;
+ *os << node->name () << "::" << node->local_name () << " (void)" << be_nl;
+
+ if (node->truncatable())
+ {
+ *os << "{" << be_idt_nl
+ << "this->is_truncatable_ = true;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+ else
+ *os << "{}" << be_nl << be_nl;
+
+
+ *os << "ACE_INLINE const char* " << be_nl
+ << node->name () << "::_tao_obv_static_repository_id ()" << be_nl
+ << "{" << be_idt_nl
+ << "return \"" << node->repoID () << "\";" << be_uidt_nl
+ << "}";
+
+ 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);
+ }
+
+ // Generate the _init-related code.
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_valuetype_init_ci visitor (&ctx);
+
+ 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);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_ci::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_valuetype_ci::visit_field (be_field *node)
+{
+ if (opt_accessor_)
+ {
+ 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)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ci::"
+ "visit_field - "
+ "visit_field failed\n"),
+ -1);
+ }
+ }
+
+ 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
new file mode 100644
index 00000000000..8e577ec39bf
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp
@@ -0,0 +1,430 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Valuetypes in the client stubs file.
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+// based on code from Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_cs,
+ "$Id$")
+
+// ************************************************************
+// Valuetype visitor for client stubs.
+// ************************************************************
+
+be_visitor_valuetype_cs::be_visitor_valuetype_cs (be_visitor_context *ctx)
+ : be_visitor_valuetype (ctx)
+{
+}
+
+be_visitor_valuetype_cs::~be_visitor_valuetype_cs (void)
+{
+}
+
+int
+be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node)
+{
+ if (node->cli_stub_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ if (be_global->tc_support ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+ TAO::be_visitor_value_typecode tc_visitor (&ctx);
+
+ if (tc_visitor.visit_valuetype (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_cs::"
+ "visit_valuetype - "
+ "TypeCode definition failed\n"),
+ -1);
+ }
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ if (node->is_defined ())
+ {
+ *os << be_nl << be_nl
+ << "void" << be_nl
+ << "TAO::Value_Traits<" << node->name () << ">::add_ref ("
+ << be_idt << be_idt_nl
+ << node->name () << " * p" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::add_ref (p);" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "void" << be_nl
+ << "TAO::Value_Traits<" << node->name () << ">::remove_ref ("
+ << be_idt << be_idt_nl
+ << node->name () << " * p" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::remove_ref (p);" << be_uidt_nl
+ << "}";
+
+ *os << be_nl << be_nl
+ << "void" << be_nl
+ << "TAO::Value_Traits<" << node->name () << ">::release ("
+ << be_idt << be_idt_nl
+ << node->name () << " * p" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::remove_ref (p);" << be_uidt_nl
+ << "}";
+ }
+
+ // The _downcast method.
+ *os << be_nl << be_nl
+ << node->name () << " *" << be_nl << node->name ()
+ << "::_downcast ( ::CORBA::ValueBase *v)" << be_nl
+ << "{" << be_idt_nl
+ << "return dynamic_cast< ::" << node->name ()
+ << " * > (v);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // The _tao_obv_repository_id method.
+ *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;
+
+ *os << "void" << be_nl
+ << node->name () << "::_tao_obv_truncatable_repo_ids (Repository_Id_List& ids) const" << be_nl
+ << "{" << be_idt_nl
+ << "ids.push_back (this->_tao_obv_static_repository_id ());";
+
+ if (node->truncatable ())
+ {
+ *os << be_nl;
+ *os << node->inherits_concrete ()->name () << "::_tao_obv_truncatable_repo_ids (ids);" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+ }
+ else
+ *os << be_uidt_nl << "}" << be_nl << be_nl;
+
+ if (be_global->any_support ())
+ {
+ *os << "void" << be_nl
+ << node->name ()
+ << "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
+ << "{" << be_idt_nl
+ << node->local_name () << " *_tao_tmp_pointer =" << be_idt_nl
+ << "static_cast<" << be_idt
+ << node->local_name () << " *> ("
+ << "_tao_void_pointer);" << be_uidt << be_uidt_nl
+ << "::CORBA::remove_ref (_tao_tmp_pointer);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+
+ // Generate destructor.
+ //
+ // @@ Do not inline this destructor. It is virtual. Inlining
+ // virtual functions, including virtual destructors, wreaks havoc
+ // with g++ >= 4.0 RTTI support when the
+ // "-fvisibility-inlines-hidden" command line option is used.
+ *os << node->name () << "::~" << node->local_name () << " (void)" << be_nl;
+ *os << "{}\n" << be_nl;
+
+ bool is_an_amh_exception_holder =
+ this->is_amh_exception_holder (node);
+
+ // Nothing to marshal if abstract valuetype.
+ if (!node->is_abstract () && !is_an_amh_exception_holder)
+ {
+ // The virtual _tao_marshal_v method.
+ *os << "::CORBA::Boolean " << be_nl
+ << node->name ()
+ << "::_tao_marshal_v (TAO_OutputCDR & strm) const" << be_nl
+ << "{" << be_idt_nl
+ << "TAO_ChunkInfo ci(this->is_truncatable_ || this->chunking_);"
+ << be_nl
+ << "return ";
+
+ if (node->opt_accessor ())
+ {
+ be_decl *scope =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+
+ *os << scope->name () << "::"
+ << node->local_name ()
+ << "::_tao_marshal_state (strm, ci);" << be_uidt_nl;
+ }
+ else
+ {
+ *os << "this->_tao_marshal__" << node->flat_name ()
+ << " (strm, ci);" << be_uidt_nl;
+ }
+
+ *os << "}" << be_nl << be_nl;
+
+ // The virtual _tao_unmarshal_v method.
+ *os << "::CORBA::Boolean " << be_nl
+ << node->name ()
+ << "::_tao_unmarshal_v (TAO_InputCDR & strm)"
+ << be_nl
+ << "{" << be_idt_nl
+ << "TAO_ChunkInfo ci(this->is_truncatable_ || this->chunking_ ,1);"
+ << be_nl
+ << "return ";
+
+ if (node->opt_accessor ())
+ {
+ be_decl *scope =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+
+ *os << scope->name () << "::"
+ << node->local_name ()
+ <<"::_tao_unmarshal_state (strm,ci);" << be_uidt_nl;
+ }
+ else
+ {
+ *os << "this->_tao_unmarshal__" << node->flat_name ()
+ << " (strm,ci);" << be_uidt_nl;
+ }
+
+ *os << "}" << be_nl << be_nl;
+
+ *os << "::CORBA::Boolean " << be_nl
+ << node->name ()
+ << "::_tao_match_formal_type (ptrdiff_t formal_type_id) const"
+ << be_nl
+ << "{" << be_idt_nl
+ << "return formal_type_id == reinterpret_cast<ptrdiff_t> ("
+ << node->name() << "::_downcast);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ }
+ else if (is_an_amh_exception_holder)
+ {
+ // @@ Do not inline. They're virtual. Inlining virtual
+ // functions, including virtual destructors, wreaks havoc with
+ // g++ >= 4.0 RTTI support when the
+ // "-fvisibility-inlines-hidden" command line option is used.
+
+ // The virtual _tao_marshal_v method.
+ *os << "::CORBA::Boolean" << be_nl
+ << node->name () << "::_tao_marshal_v (TAO_OutputCDR &) const"
+ << be_nl
+ << "{" << be_idt_nl
+ << "return true;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // The virtual _tao_unmarshal_v method.
+ *os << "::CORBA::Boolean" << be_nl
+ << node->name () << "::_tao_unmarshal_v (TAO_InputCDR &)"
+ << be_nl
+ << "{" << be_idt_nl
+ << "return true;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // The virtual _tao_match_formal_type method.
+ *os << "::CORBA::Boolean " << be_nl
+ << node->name ()
+ << "::_tao_match_formal_type (ptrdiff_t ) const"
+ << be_nl
+ << "{" << be_idt_nl
+ << "return false;"<< be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+
+ if (!node->opt_accessor () && !node->is_abstract ())
+ {
+ *os << "::CORBA::Boolean" << be_nl
+ << node->name () << "::_tao_marshal__" << node->flat_name ()
+ << " (TAO_OutputCDR &, TAO_ChunkInfo&) const" << be_nl
+ << "{" << be_idt_nl
+ << "return true;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "::CORBA::Boolean" << be_nl
+ << node->name () << "::_tao_unmarshal__" << node->flat_name ()
+ << " (TAO_InputCDR &, TAO_ChunkInfo&)" << be_nl
+ << "{" << be_idt_nl
+ << "return true;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+ }
+
+ // The static T::_tao_unmarshal method
+
+ *os << "::CORBA::Boolean " << node->name()
+ << "::_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::Boolean retval =" << be_idt_nl
+ << "::CORBA::ValueBase::_tao_unmarshal_pre (" << be_idt << be_idt_nl
+ << "strm," << 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)" << be_idt_nl
+ << "return false;" << be_uidt_nl << be_nl
+ << "if (base != 0 && ! base->_tao_unmarshal_v (strm))" << be_idt_nl
+ << "return false;" << 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 true;" << be_uidt_nl
+ << "}";
+
+ // If we inherit from CORBA::Object and/or CORBA::AbstractBase
+ // (in addition to CORBA::ValueBase) we have to add these
+ // to avoid ambiguity.
+ if (node->n_supports () > 0)
+ {
+ *os << be_nl << be_nl
+ << "::CORBA::ValueBase *" << be_nl
+ << node->name () << "::_tao_to_value (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return this;" << be_uidt_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);
+ }
+
+ // Generate the _init-related code.
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_valuetype_init_cs vi_visitor (&ctx);
+
+ 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);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_cs::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_valuetype_cs::visit_operation (be_operation *node)
+{
+ if (node->cli_stub_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ be_valuetype *parent =
+ be_valuetype::narrow_from_scope (node->defined_in ());
+
+ if (parent == 0 || ! this->is_amh_exception_holder (parent))
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // STEP I: Generate the return type.
+ be_type *bt = be_type::narrow_from_decl (node->return_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_cs::"
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
+ }
+
+ // Grab the right visitor to generate the return type.
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_operation_rettype or_visitor (&ctx);
+
+ if (bt->accept (&or_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_cs::"
+ "visit_operation - "
+ "codegen for return type failed\n"),
+ -1);
+ }
+
+ // STEP 2: Generate the operation name.
+ *os << be_nl << parent->name () << "::" << 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_OBV_OPERATION_ARGLIST_CS);
+ be_visitor_obv_operation_arglist ooa_visitor (&ctx);
+
+ if (node->accept (&ooa_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_cs::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ // We need to throw an exceptions that was assigned in a
+ // different place (by the app-developer). ACE_THROW does
+ // not fit the bill since the ACE_THROW macro contructs the
+ // exception passed to it. Also exception->_raise() is
+ // ruled out since in platforms without native exception
+ // support, the _raise() function does not do anything. Below we
+ // explicitly take care of both cases (platforms with
+ // and without native exception support).
+ *os << be_nl
+ << "{" << be_nl
+ << "#if defined (TAO_HAS_EXCEPTIONS)" << be_idt_nl
+ << "auto_ptr< ::CORBA::Exception> safety (this->exception);" << be_nl
+ << "// Direct throw because we don't have the ACE_TRY_ENV." << be_nl
+ << "this->exception->_raise ();" << be_uidt_nl
+ << "#else" << be_idt_nl
+ << "// We can not use ACE_THROW here." << be_nl
+ << "ACE_TRY_ENV.exception (this->exception);" << be_uidt_nl
+ << "#endif" << be_nl
+ << "}"
+ << be_uidt_nl;
+
+ 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
new file mode 100644
index 00000000000..bc351d2fc65
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init.cpp
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_init.cpp
+//
+// = DESCRIPTION
+// Coomon visitor for valuetypes factory construct
+// (see IDL to C++ mapping). Based on ptc/00-01-02.
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+//
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_init,
+ "$Id$")
+
+be_visitor_valuetype_init::be_visitor_valuetype_init (
+ be_visitor_context *ctx
+ )
+ : be_visitor_valuetype (ctx)
+{
+}
+
+be_visitor_valuetype_init::~be_visitor_valuetype_init (void)
+{
+}
+
+void
+be_visitor_valuetype_init::begin_public (void)
+{
+}
+
+void
+be_visitor_valuetype_init::begin_private (void)
+{
+}
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
new file mode 100644
index 00000000000..ba41ba1371a
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp
@@ -0,0 +1,168 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_init_arglist_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the parameter list of the OBV factory
+// signature.
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+//
+// ============================================================================
+
+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_scope (ctx)
+{
+}
+
+be_visitor_valuetype_init_arglist_ch::~be_visitor_valuetype_init_arglist_ch (
+ void
+ )
+{
+}
+
+int
+be_visitor_valuetype_init_arglist_ch::visit_factory (be_factory *node)
+{
+ TAO_OutStream& os = *(this->ctx_->stream ());
+
+ os << " (";
+
+ if (node->nmembers () > 0)
+ {
+ 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,
+ "(%N:%l) be_visitor_valuetype_init_arglist_ch::"
+ "visit_factory - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ os << be_uidt_nl
+ << ")";
+ }
+ else
+ {
+ os << "void)" << be_idt;
+ }
+
+ // Now generate the throw specs.
+ if (this->gen_throw_spec (node) == -1)
+ {
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ ACE_TEXT ("(%N:%l) be_visitor_valuetype_init_arglist_ch")
+ ACE_TEXT ("::visit_factory - ")
+ ACE_TEXT ("Failed to generate throw spec\n")
+ ),
+ -1
+ );
+ }
+
+ return 0;
+}
+
+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
+ // signature.
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_args_arglist visitor (&ctx);
+ int status = node->accept (&visitor);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_init_arglist_ch::"
+ "visit_argument - "
+ "codegen for arglist failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+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 (!this->last_node (bd))
+ {
+ *os << "," << be_nl;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_init_arglist_ch::gen_throw_spec (be_factory *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (node->exceptions ())
+ {
+ const char *throw_spec_open = "throw (";
+ const char *throw_spec_close = ")";
+
+ if (!be_global->use_raw_throw ())
+ {
+ throw_spec_open = "ACE_THROW_SPEC ((";
+ throw_spec_close = "))";
+ }
+
+ *os << be_nl << throw_spec_open << be_idt;
+
+ bool first = true;
+
+ // Initialize an iterator to iterate thru the exception list.
+ for (UTL_ExceptlistActiveIterator ei (node->exceptions ());
+ !ei.is_done ();
+ ei.next ())
+ {
+ be_exception *excp =
+ be_exception::narrow_from_decl (ei.item ());
+
+ if (excp == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation"
+ "gen_throw_spec - "
+ "bad exception node\n"),
+ -1);
+
+ }
+
+ *os << (first ? "" : ",") << be_nl
+ << excp->name ();
+
+ first = false;
+ }
+
+ *os << be_uidt_nl << throw_spec_close << be_uidt;
+ }
+
+ return 0;
+}
+
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
new file mode 100644
index 00000000000..c68a18b7670
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp
@@ -0,0 +1,194 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_init_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Valuetypes factory in the client header
+// (see IDL to C++ mapping). Based on ptc/00-01-02.
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+//
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_init_ch,
+ "$Id$")
+
+be_visitor_valuetype_init_ch::be_visitor_valuetype_init_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_valuetype_init (ctx)
+{
+}
+
+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 ())
+ {
+ return 0;
+ }
+
+ // There are three possible situations.
+ // (1) If there is no initializers but at least one operation.
+ // In this case we don't need to bother about factory.
+ //
+ // (2) There are no (operations or initializers) (i.e. only state
+ // members) then we need a concrete type-specific factory
+ // class whose create_for_unmarshal creates OBV_ class.
+ //
+ // (3) There is at least one operation and at least one initializer.
+ // In this case we need to generate abstract factory class.
+
+ be_valuetype::FactoryStyle factory_style =
+ node->determine_factory_style ();
+
+ if (factory_style == be_valuetype::FS_NO_FACTORY)
+ {
+ // Nothing to do.
+ return 0;
+ }
+
+ TAO_OutStream& os = *(this->ctx_->stream ());
+
+ // Generate the ifdef macro for the _init class.
+ os.gen_ifdef_macro (node->flat_name (), "_init");
+
+ os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ //@@ 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.
+ os << "{" << be_nl
+ << "public:" << be_idt;
+
+ if (factory_style == be_valuetype::FS_CONCRETE_FACTORY)
+ {
+ // Public constructor.
+ os << be_nl
+ << node->local_name () << "_init (void);";
+ }
+
+ if (this->visit_valuetype_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_init_ch::"
+ "visit_valuetype - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ // Generate _downcast method.
+ os << be_nl << be_nl
+ << "static " << node->local_name () << "_init* "
+ << "_downcast ( ::CORBA::ValueFactoryBase *);";
+
+ if (factory_style == be_valuetype::FS_CONCRETE_FACTORY)
+ {
+ //@@ Boris: create_for_unmarshal is still public...
+ // generate create_for_unmarshal
+ os << be_nl << be_nl
+ << "virtual ::CORBA::ValueBase *" << be_nl
+ << "create_for_unmarshal ("
+ << be_idt << be_idt
+ << env_sngl_dflts << be_uidt_nl
+ << ");" << be_uidt;
+
+ if (node->supports_abstract ())
+ {
+ os << be_nl << be_nl
+ << "virtual ::CORBA::AbstractBase_ptr" << be_nl
+ << "create_for_unmarshal_abstract (" << be_idt << be_idt
+ << env_sngl_dflts << be_uidt_nl
+ << ");" << be_uidt;
+ }
+ }
+
+ os << be_nl << be_nl;
+
+ // Proprietary extensions.
+ os << "// TAO-specific extensions"
+ << be_uidt_nl
+ << "public:" << be_idt_nl;
+ os << "virtual const char* tao_repository_id (void);";
+
+ if (factory_style == be_valuetype::FS_ABSTRACT_FACTORY)
+ {
+ // Protected constructor.
+ os << be_uidt_nl << be_nl
+ << "protected:" << be_idt_nl;
+ os << node->local_name () << "_init (void);";
+ }
+
+ // Protected virtual destructor.
+ os << be_uidt_nl << be_nl << "protected:" << be_idt_nl;
+ os << "virtual ~" << node->local_name () << "_init (void);";
+
+ os << be_uidt_nl << "};";
+
+ // Generate the endif macro.
+ os.gen_endif ();
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_init_ch::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_valuetype_init_ch::visit_factory (be_factory *node)
+{
+
+ TAO_OutStream& os = *(this->ctx_->stream ());
+
+ be_valuetype *vt =
+ be_valuetype::narrow_from_decl (this->ctx_->scope ());
+
+
+ // STEP I: Generate preambule.
+ os << be_nl << be_nl
+ << "virtual " << vt->local_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.
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_valuetype_init_arglist_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_init_arglist__ch::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ // Make pure virtual.
+ os << " = 0;";
+
+ 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
new file mode 100644
index 00000000000..68e9b6f3bb1
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ci.cpp
@@ -0,0 +1,37 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_init_ci.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Valuetypes factory in the client header
+// (see IDL to C++ mapping)
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+//
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_init_ci,
+ "$Id$")
+
+be_visitor_valuetype_init_ci::be_visitor_valuetype_init_ci (
+ be_visitor_context *ctx
+ )
+ : be_visitor_valuetype_init (ctx)
+{
+}
+
+be_visitor_valuetype_init_ci::~be_visitor_valuetype_init_ci (void)
+{
+}
+
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
new file mode 100644
index 00000000000..07d27795d03
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp
@@ -0,0 +1,165 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_init_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Valuetypes factory in the client header
+// (see IDL to C++ mapping)
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+//
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_init_cs,
+ "$Id$")
+
+be_visitor_valuetype_init_cs::be_visitor_valuetype_init_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_valuetype_init (ctx)
+{
+}
+
+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 ())
+ {
+ return 0;
+ }
+
+ // There are three possible situations.
+ // (1) If there is no initializers but at least one operation.
+ // In this case we don't need to bother about factory.
+ //
+ // (2) There are no (operations or initializers) (i.e. only state
+ // members) then we need a concrete type-specific factory
+ // class whose create_for_unmarshal creates OBV_ class.
+ //
+ // (3) There is at least one operation and at least one initializer.
+ // In this case we need to generate abstract factory class.
+
+ be_valuetype::FactoryStyle factory_style =
+ node->determine_factory_style ();
+
+ if (factory_style == be_valuetype::FS_NO_FACTORY)
+ {
+ return 0;
+ }
+
+ 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 (lname,
+ '\0',
+ NAMEBUFSIZE);
+ ACE_OS::sprintf (lname,
+ "%s_init",
+ node->local_name ());
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // ctor
+ *os << be_nl << be_nl
+ << fname << "::" << lname << " (void)" << be_nl
+ << "{" << be_nl << "}";
+
+ // dtor
+ *os << be_nl << be_nl
+ << fname << "::~" << lname << " (void)" << be_nl
+ << "{" << be_nl << "}";
+
+ // The _downcast method.
+ *os << be_nl << be_nl
+ << node->name () << "_init *" << be_nl << node->name ()
+ << "_init::_downcast ( ::CORBA::ValueFactoryBase *v)" << be_nl
+ << "{" << be_idt_nl
+ << "return dynamic_cast< ::" << node->name ()
+ << "_init * > (v);" << be_uidt_nl
+ << "}";
+
+ // tao_repository_id
+ *os << be_nl << be_nl
+ << "const char* " << be_nl
+ << fname << "::tao_repository_id (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return ::" << node->full_name ()
+ << "::_tao_obv_static_repository_id ();"
+ << be_uidt_nl << "}";
+
+
+ if (factory_style == be_valuetype::FS_CONCRETE_FACTORY)
+ {
+ // generate create_for_unmarshal()
+ *os << be_nl << be_nl
+ << "::CORBA::ValueBase *" << be_nl
+ << fname << "::create_for_unmarshal" << " ("
+ << (be_global->use_raw_throw ()
+ ? "void"
+ : "ACE_ENV_SINGLE_ARG_DECL")
+ << ")" << be_nl
+ << "{" << be_idt_nl
+ << "::CORBA::ValueBase *ret_val = 0;" << be_nl
+ << "ACE_NEW_THROW_EX (" << be_idt << be_idt_nl
+ << "ret_val," << be_nl
+ << "OBV_" << node->full_name () << "," << be_nl
+ << "::CORBA::NO_MEMORY ()" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "return ret_val;"
+ << be_uidt_nl << "}";
+
+ if (node->supports_abstract ())
+ {
+ *os << be_nl << be_nl
+ << "::CORBA::AbstractBase_ptr" << be_nl
+ << fname << "::create_for_unmarshal_abstract ("
+ << (be_global->use_raw_throw ()
+ ? "void"
+ : "ACE_ENV_SINGLE_ARG_DECL")
+ << ")" << be_nl
+ << "{" << be_idt_nl
+ << "::CORBA::AbstractBase *ret_val = 0;" << be_nl
+ << "ACE_NEW_THROW_EX (" << be_idt << be_idt_nl
+ << "ret_val," << be_nl
+ << "OBV_" << node->full_name () << "," << be_nl
+ << "::CORBA::NO_MEMORY ()" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "return ret_val;"
+ << be_uidt_nl << "}";
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_init_cs::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
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
new file mode 100644
index 00000000000..3a04f825b06
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp
@@ -0,0 +1,313 @@
+
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_obv__ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Valuetypes in the client header
+// OBV_ class
+// (see C++ mapping OMG 20.17)
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>,
+// based on interface_ch.cpp from Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_obv_ch,
+ "$Id$")
+
+// ******************************************************
+// Valuetype visitor for client header
+// ******************************************************
+
+be_visitor_valuetype_obv_ch::be_visitor_valuetype_obv_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_valuetype (ctx)
+{
+}
+
+be_visitor_valuetype_obv_ch::~be_visitor_valuetype_obv_ch (void)
+{
+}
+
+
+// OBV_ class must be in OBV_ namespace.
+int
+be_visitor_valuetype_obv_ch::visit_valuetype (be_valuetype *node)
+{
+ // Only visit non-abstract non-imported valuetype.
+ if (node->is_abstract () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ ;
+
+ // OBV_ class maps only to a typedef if we are optimizing accessors.
+ if (node->opt_accessor ())
+ {
+ *os << be_nl << be_nl << "typedef " << node->full_name () << " ";
+
+ if (!node->is_nested ())
+ {
+ *os << "OBV_";
+ }
+
+ *os << node->local_name () << ";" << be_nl;
+ }
+ else
+ {
+ // STEP 1: Generate the class name and the class name we inherit.
+ os->gen_ifdef_macro (node->flat_name (), "_OBV");
+
+ *os << be_nl << be_nl << "// OBV_ class" << be_nl;
+ *os << "class " << be_global->stub_export_macro() << " ";;
+
+ if (!node->is_nested())
+ {
+ *os << "OBV_";
+ }
+
+ *os << node->local_name () << be_idt_nl
+ << ": public virtual "
+ << node->full_name ();
+
+ // STEP 1a (about which previous implementer forgot ):
+ // Generate inheritance from corresponding OBV_ classes.
+
+//------>>>
+
+ // Here we need to be careful. There are few cases to consider:
+ //
+ // (1) We have VT with concrete factory and no inhereted VT with
+ // concrete factory then we need to mix-in RefCounter
+ //
+ // (2) We have VT with concerete factory and inheretence from
+ // another (not abstract or empty abstract <would like to
+ // know how to go there>) then its OBV_ already has mix-in
+ //
+ // (3) We have VT that supports an abstract interface. In this case,
+ // we will add implementations of _add_ref and _remove_ref that
+ // call this->DefaultValueRefCountBase and so it must be mixed in
+ //
+ // (4) The rest. Don't need to bother about anything, just inherit
+ // whatever there is.
+ //
+
+ int i = 0;
+ AST_Interface *inherited = 0;
+
+ for (; i < node->n_inherits (); ++i)
+ {
+ inherited = node->inherits ()[i];
+
+ // We need only concrete valuetypes.
+ if (inherited->is_abstract ())
+ {
+ continue;
+ }
+
+ *os << "," << be_nl;
+
+ // dump the scoped name.
+ *os << " public virtual OBV_";
+ *os << inherited->full_name();
+ } // end of for loop
+
+ if (this->obv_need_ref_counter (node))
+ {
+ *os << "," << be_nl;
+
+ // dump the scoped name.
+ *os << " public virtual ::CORBA::DefaultValueRefCountBase";
+ }
+
+ *os << be_uidt_nl;
+
+//------>>>
+
+ // STEP 2: Generate the body ==
+
+ *os << "{";
+
+ // Generate code for the OBV_ class definition.
+ if (this->visit_valuetype_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_obv_ch::"
+ "visit_valuetype - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ // If we inherit from CORBA::Object and/or CORBA::AbstractBase
+ // (in addition to CORBA::ValueBase) we have to add these
+ // to avoid ambiguity.
+ if (node->n_supports () > 0)
+ {
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ ;
+
+ *os << be_nl << be_nl << "virtual void _add_ref (void);" << be_nl;
+ *os << "virtual void _remove_ref (void);";
+ }
+
+ if (node->have_operation ())
+ {
+ this->begin_private ();
+ }
+ else
+ {
+ this->begin_public ();
+ }
+
+ *os << be_nl;
+
+ // Default constructor.
+ if (! node->is_nested ())
+ {
+ *os << "OBV_";
+ }
+
+ *os << node->local_name () << " (void);";
+
+ // Initializing constructor.
+ if (node->has_member ())
+ {
+ *os << be_nl;
+
+ if (! node->is_nested ())
+ {
+ *os << "OBV_";
+ }
+
+ *os << node->local_name () << " (" << be_idt << be_idt;
+
+ unsigned long index = 0;
+ this->gen_obv_init_constructor_args (node, index);
+
+ *os << be_uidt_nl
+ << ");" << be_uidt;
+ }
+
+ // Virtual destructor.
+ *os << be_nl << "virtual ~";
+
+ if (! node->is_nested ())
+ {
+ *os << "OBV_";
+ }
+
+ *os << node->local_name () << " (void);";
+
+ // Map fields to private data.
+ if (!node->opt_accessor ())
+ {
+ *os << be_nl << be_uidt_nl << "protected:" << be_idt_nl;
+
+ *os << "virtual ::CORBA::Boolean" << be_nl
+ << "_tao_marshal__" << node->flat_name ()
+ << " (TAO_OutputCDR &, TAO_ChunkInfo &) const;" << be_nl << be_nl;
+
+ *os << "virtual ::CORBA::Boolean" << be_nl
+ << "_tao_unmarshal__" << node->flat_name ()
+ << " (TAO_InputCDR &, TAO_ChunkInfo &);" << be_nl << be_nl;
+
+ *os << "::CORBA::Boolean "
+ << "_tao_marshal_state (TAO_OutputCDR &, TAO_ChunkInfo &) const;"
+ << be_nl
+ << "::CORBA::Boolean "
+ << "_tao_unmarshal_state (TAO_InputCDR &, TAO_ChunkInfo &);"
+ << be_nl
+ << "virtual void "
+ << "truncation_hook (void);"
+ << be_uidt_nl << be_nl;
+
+ *os << "private:" << be_idt;
+
+ this->gen_pd (node);
+ }
+
+ *os << be_nl
+ << "CORBA::Boolean require_truncation_;" << be_uidt_nl
+ << "};";
+
+ os->gen_endif ();
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_obv_ch::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_valuetype_obv_ch::visit_field (be_field *node)
+{
+ be_valuetype *vt = be_valuetype::narrow_from_scope (node->defined_in ());
+
+ if (!vt)
+ {
+ return -1;
+ }
+
+ // Only in OBV_ class, if we are not optimizing accessors (and modifiers).
+ if (!vt->opt_accessor ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_valuetype_field_ch visitor (&ctx);
+
+ visitor.setenclosings ("virtual ",";");
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_obv_ch::"
+ "visit_field - codegen failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+void
+be_visitor_valuetype_obv_ch::begin_public (void)
+{
+ AST_Decl::NodeType nt = this->ctx_->node ()->node_type ();
+
+ // These types are skipped in the OBV class.
+ if (nt == AST_Decl::NT_attr || nt == AST_Decl::NT_op)
+ {
+ return;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ *os << be_uidt_nl << be_nl
+ << "public:" << be_idt;
+}
+
+void
+be_visitor_valuetype_obv_ch::begin_private (void)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ *os << be_uidt_nl << be_nl
+ << "protected:" << be_idt;
+}
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
new file mode 100644
index 00000000000..66750c54136
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ci.cpp
@@ -0,0 +1,103 @@
+
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_obv_ci.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Valuetypes
+// OBV_ class implementation
+// (see C++ mapping OMG 20.17)
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>,
+// based on interface_ch.cpp from Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_obv_ci,
+ "$Id$")
+
+// ******************************************************
+// Valuetype visitor for OBV_ class implementation
+// ******************************************************
+
+be_visitor_valuetype_obv_ci::be_visitor_valuetype_obv_ci (
+ be_visitor_context *ctx
+ )
+ : be_visitor_valuetype (ctx)
+{
+}
+
+be_visitor_valuetype_obv_ci::~be_visitor_valuetype_obv_ci (void)
+{
+}
+
+
+// OBV_ class must be in OBV_ namespace
+int
+be_visitor_valuetype_obv_ci::visit_valuetype (be_valuetype *node)
+{
+ // only visit non-abstract valuetype
+ if (node->is_abstract ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os; // output stream
+
+ os = this->ctx_->stream ();
+ os->indent ();
+
+ // OBV_ class is only a typedef if we are optimizing accessors
+ if (node->opt_accessor ())
+ {
+ }
+ else
+ {
+ 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);
+ }
+ } // if !opt_accessor ()
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_obv_ci::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_valuetype_obv_ci::visit_field (be_field *node)
+{
+ be_visitor_context new_ctx (*this->ctx_);
+ be_visitor_valuetype_field_ci visitor (&new_ctx);
+
+ visitor.in_obv_space_ = 1;
+
+ if (visitor.visit_field (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_obv_ci::"
+ "visit_field - "
+ "visit_field failed\n"),
+ -1);
+ }
+
+ return 0;
+}
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
new file mode 100644
index 00000000000..b5123ed6be4
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp
@@ -0,0 +1,257 @@
+
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_obv_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Valuetypes
+// OBV_ class implementation
+// (see C++ mapping OMG 20.17)
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>,
+// derived from interface_ch.cpp from Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_obv_cs,
+ "$Id$")
+
+// ******************************************************
+// Valuetype visitor for OBV_ class implementation
+// ******************************************************
+
+be_visitor_valuetype_obv_cs::be_visitor_valuetype_obv_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_valuetype (ctx)
+{
+}
+
+be_visitor_valuetype_obv_cs::~be_visitor_valuetype_obv_cs (void)
+{
+}
+
+
+// OBV_ class must be in OBV_ namespace
+int
+be_visitor_valuetype_obv_cs::visit_valuetype (be_valuetype *node)
+{
+ // only visit non-abstract non-imported valuetype
+ if (node->is_abstract () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Default constructor.
+ *os << node->full_obv_skel_name () << "::";
+
+ if (! node->is_nested ())
+ {
+ *os << "OBV_";
+ }
+
+ *os << node->local_name () << " (void)" << be_nl;
+ *os << ": require_truncation_ (false)" << be_nl
+ << "{}" << be_nl << be_nl;
+
+ // Initializing constructor.
+ if (node->has_member ())
+ {
+ *os << node->full_obv_skel_name () << "::";
+
+ if (! node->is_nested ())
+ {
+ *os << "OBV_";
+ }
+
+ *os << node->local_name () << " (" << be_idt << be_idt;
+
+ unsigned long index = 0;
+ this->gen_obv_init_constructor_args (node, index);
+
+ *os << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ": require_truncation_ (false)" << be_nl
+ << "{" << be_idt;
+
+ this->gen_obv_init_constructor_inits (node);
+
+ *os << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+
+ // Destructor.
+ *os << node->full_obv_skel_name () << "::~";
+
+ if (! node->is_nested ())
+ {
+ *os << "OBV_";
+ }
+
+ *os << node->local_name () << " (void)" << be_nl
+ << "{}";
+
+
+ // OBV_ class has no accessors or modifiers if we are optimizing
+ // or the valuetype is abstract.
+ if (!node->opt_accessor ())
+ {
+ *os << be_nl << be_nl << "::CORBA::Boolean" << be_nl
+ << node->full_obv_skel_name ()
+ << "::_tao_marshal__" << node->flat_name ()
+ << " (TAO_OutputCDR &strm, TAO_ChunkInfo& ci) const" << be_nl
+ << "{" << be_idt_nl
+ << "return _tao_marshal_state (strm, ci);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "::CORBA::Boolean" << be_nl
+ << node->full_obv_skel_name ()
+ << "::_tao_unmarshal__" << node->flat_name ()
+ << " (TAO_InputCDR &strm, TAO_ChunkInfo& ci)" << be_nl
+ << "{" << be_idt_nl
+ << "return _tao_unmarshal_state (strm, ci);" << be_uidt_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);
+ }
+
+ // If we inherit from CORBA::Object and/or CORBA::AbstractBase
+ // (in addition to CORBA::ValueBase) we have to add these
+ // to avoid ambiguity.
+ if (node->n_supports () > 0)
+ {
+ *os << be_nl << 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
+ << "}";
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_obv_cs::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_valuetype_obv_cs::visit_field (be_field *node)
+{
+ be_visitor_context ctx = (*this->ctx_);
+ be_visitor_valuetype_field_cs visitor (&ctx);
+ visitor.in_obv_space_ = 1;
+
+ if (visitor.visit_field (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_obv_cs::"
+ "visit_field - "
+ "visit_field failed\n"
+ ), -1);
+ }
+
+ return 0;
+}
+
+void
+be_visitor_valuetype_obv_cs::gen_obv_init_base_constructor_args (
+ be_valuetype *node,
+ unsigned long &index
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ AST_ValueType *parent = node->inherits_concrete ();
+
+ // Generate for inherited members first.
+ if (parent != 0)
+ {
+ be_valuetype *be_parent =
+ be_valuetype::narrow_from_decl (parent);
+ this->gen_obv_init_base_constructor_args (be_parent, index);
+ }
+
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next())
+ {
+ // be_attribute doesn't inherit from be_field (unlike the
+ // AST_* counterparts, so this screens attributes and operations.
+ be_field *f = be_field::narrow_from_decl (si.item ());
+
+ if (f == 0)
+ {
+ continue;
+ }
+
+ *os << (index++ != 0 ? "," : "") << be_nl
+ << "_tao_init_" << f->local_name ();
+ }
+}
+
+void
+be_visitor_valuetype_obv_cs::gen_obv_init_constructor_inits (
+ be_valuetype *node
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ AST_ValueType *parent = node->inherits_concrete ();
+
+ // Generate for inherited members first.
+ if (parent != 0)
+ {
+ be_valuetype *be_parent = be_valuetype::narrow_from_decl (parent);
+ this->gen_obv_init_constructor_inits (be_parent);
+ }
+
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next())
+ {
+ be_field *f = be_field::narrow_from_decl (si.item ());
+
+ // be_attribute doesn't inherit from be_field (unlike the
+ // AST_* counterparts, so this screens attributes and operations.
+ if (f == 0)
+ {
+ continue;
+ }
+
+ *os << be_nl
+ << f->local_name () << " (_tao_init_" << f->local_name ()
+ << ");";
+ }
+}
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..c17523bf982
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_sh.cpp
@@ -0,0 +1,131 @@
+//
+// $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_direct_collocation ())
+ {
+ *os << "class " << node->direct_proxy_impl_name () << ";" << be_nl;
+ }
+
+ if (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_nl << "public virtual " << "::" << node->full_name ();
+
+ *os << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "protected:" << be_idt_nl
+ << class_name.c_str () << " (void);" << be_uidt_nl << be_nl
+ << "public:" << be_idt_nl;
+
+ *os << "virtual ~" << class_name.c_str () << " (void);" << be_nl << be_uidt_nl;
+
+ // No copy constructor for locality constraint interface.
+ *os << "private:" << be_idt_nl
+ << class_name.c_str () << " (const " << class_name.c_str ()
+ << "& rhs);" << be_uidt_nl;
+
+
+ *os << "};" << be_nl << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_sh::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
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..34cd0b2f248
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_si.cpp
@@ -0,0 +1,51 @@
+//
+// $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 *)
+{
+ // Nothing needed for now, but the visitor is here just in case.
+ return 0;
+}
+
+int
+be_visitor_valuetype_si::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
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..65c98639643
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ss.cpp
@@ -0,0 +1,159 @@
+//
+// $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);
+
+ *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;
+
+// @@@ (JP) I'm commenting out the copy constructor for now. The
+// declaration in the skeleton header file has been made private. These
+// valuetypes (only if a concrete interface is supported) inherit
+// from the stub-side valuetype, which has a private umimplemented
+// copy constructor. This makes it impossible to call all the base
+// class copy constructors, which some compilers require. If there
+// is no fallout from this change, this code will be removed, if
+// there is a problem, we'll have to reevaluate the approach.
+/*
+ *os << full_skel_name << "::"
+ << local_name_prefix << node_local_name << " ("
+ << "const " << local_name_prefix << node_local_name << "& rhs)";
+
+ *os << be_idt_nl
+ << ": TAO_Abstract_ServantBase (rhs)," << be_nl
+ << " TAO_ServantBase (rhs)," << be_idt_nl;
+
+ if (concrete->is_nested ())
+ {
+ AST_Decl *scope = ScopeAsDecl (concrete->defined_in ());
+
+ *os << "POA_" << scope->name () << "::"
+ << concrete->local_name () << " (rhs)," << be_nl;
+ }
+ else
+ {
+ be_interface *bd = be_interface::narrow_from_decl (concrete);
+ *os << bd->full_skel_name () << " (rhs)," << be_nl;
+ }
+
+ *os << "ValueBase (rhs)" << be_uidt << be_uidt_nl
+ << "{}" << be_nl << be_nl;
+*/
+
+ *os << full_skel_name << "::~"
+ << local_name_prefix << node_local_name
+ << " (void)" << be_nl
+ << "{}";
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_ss::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+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
new file mode 100644
index 00000000000..2de72859f6d
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd.cpp
@@ -0,0 +1,41 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_valuetype_fwd.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Valuetype_Fwd
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+//
+// ============================================================================
+
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_eventtype.h"
+#include "be_eventtype_fwd.h"
+#include "be_extern.h"
+#include "be_helper.h"
+#include "be_module.h"
+#include "be_util.h"
+
+#include "be_visitor_valuetype_fwd.h"
+#include "be_visitor_context.h"
+#include "ace/Log_Msg.h"
+
+#include "be_visitor_valuetype_fwd/valuetype_fwd_ch.cpp"
+#include "be_visitor_valuetype_fwd/any_op_ch.cpp"
+#include "be_visitor_valuetype_fwd/cdr_op_ch.cpp"
+
+ACE_RCSID (be,
+ be_visitor_valuetype_fwd,
+ "$Id$")
+
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/any_op_ch.cpp
new file mode 100644
index 00000000000..ff1c24cacc4
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/any_op_ch.cpp
@@ -0,0 +1,135 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Any operators for a forward declared
+// valuetype in the client header.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype_fwd,
+ any_op_ch,
+ "$Id$")
+
+// ***************************************************************************
+// Generates Any operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_valuetype_fwd_any_op_ch::be_visitor_valuetype_fwd_any_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_valuetype_fwd_any_op_ch::~be_visitor_valuetype_fwd_any_op_ch (void)
+{
+}
+
+int
+be_visitor_valuetype_fwd_any_op_ch::visit_valuetype_fwd (
+ be_valuetype_fwd *node
+ )
+{
+ AST_Interface *fd = node->full_definition ();
+
+ // Only a forward declared interface that is not defined in the same file
+ // needs to have this generated here. The Any operators are needed by
+ // portable interceptor code if the interface is a parameter of an operation.
+ if (fd->is_defined () != 0)
+ {
+ return 0;
+ }
+
+ if (node->cli_hdr_any_op_gen ()
+ || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ const char *macro = this->ctx_->export_macro ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ be_module *module = 0;
+
+ if (node->is_nested () &&
+ node->defined_in ()->scope_node_type () == AST_Decl::NT_module)
+ {
+ module = be_module::narrow_from_scope (node->defined_in ());
+
+ if (!module)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_valuebox_any_op_ch::"
+ "visit_valuebox - "
+ "Error parsing nested name\n"),
+ -1);
+ }
+
+ // Some compilers handle "any" operators in a namespace
+ // corresponding to their module, others do not.
+ *os << "\n\n#if defined (ACE_ANY_OPS_USE_NAMESPACE)\n";
+
+ *os << be_global->core_versioning_begin () << be_nl;
+ be_util::gen_nested_namespace_begin (os, module);
+
+ // emit nested variation of any operators
+ *os << macro << " void"
+ << " operator<<= ( ::CORBA::Any &, " << node->local_name ()
+ << " *); // copying" << be_nl;
+ *os << macro << " void"
+ << " operator<<= ( ::CORBA::Any &, " << node->local_name ()
+ << " **); // non-copying" << be_nl;
+ *os << macro << " ::CORBA::Boolean"
+ << " operator>>= (const ::CORBA::Any &, "
+ << node->local_name () << " *&);";
+
+ be_util::gen_nested_namespace_end (os, module);
+ *os << be_global->core_versioning_end () << be_nl;
+ // emit #else
+ *os << "#else\n\n";
+ }
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *os << macro << " void"
+ << " operator<<= ( ::CORBA::Any &, " << node->name ()
+ << " *); // copying" << be_nl;
+ *os << macro << " void"
+ << " operator<<= ( ::CORBA::Any &, " << node->name ()
+ << " **); // non-copying" << be_nl;
+ *os << macro << " ::CORBA::Boolean"
+ << " operator>>= (const ::CORBA::Any &, "
+ << node->name () << " *&);";
+
+ *os << be_global->core_versioning_end () << be_nl;
+ if (module != 0)
+ {
+ *os << "\n\n#endif";
+ }
+
+ node->cli_hdr_any_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_valuetype_fwd_any_op_ch::visit_eventtype_fwd (be_eventtype_fwd *node)
+{
+ return this->visit_valuetype_fwd (node);
+}
+
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
new file mode 100644
index 00000000000..8c19388a325
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ch.cpp
@@ -0,0 +1,103 @@
+//
+// $Id$
+//
+
+// ================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_fwd_cdr_op_ci.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for CDR operators for forward
+// declarations of valuetypes. This uses compiled marshaling.
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+// base on code from Torsten Kuepper
+// based on code from Aniruddha Gokhale & Carlos O'Ryan (cdr_op_ci.cpp)
+//
+// ================================================================
+
+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
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_valuetype_fwd_cdr_op_ch::~be_visitor_valuetype_fwd_cdr_op_ch (void)
+{
+}
+
+int
+be_visitor_valuetype_fwd_cdr_op_ch::visit_valuetype_fwd (
+ be_valuetype_fwd *node
+ )
+{
+ AST_Interface *fd = node->full_definition ();
+ be_valuetype *bfd = be_valuetype::narrow_from_decl (fd);
+
+ // If this forward declared vt is defined later in the file,
+ // the CDR operator declaration (along with the corresponding
+ // declarations for members of the interface's scope) will be
+ // generated then.
+ if (fd->is_defined ())
+ {
+ return 0;
+ }
+
+ // Check if it's imported vt or CDR ops already generated.
+ if (node->cli_hdr_cdr_op_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ be_valuetype *fvd =
+ be_valuetype::narrow_from_decl (node->full_definition ());
+
+ if (fvd->gen_helper_header () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_fwd_cdr_op_ch::"
+ "visit_valuetype_fwd - "
+ "codegen for helper functions failed\n"),
+ -1);
+ }
+
+ // generate the CDR << and >> operator declarations (prototypes)
+
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << be_global->core_versioning_begin () << be_nl;
+
+ *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;
+
+ *os << be_global->core_versioning_end () << be_nl;
+
+ node->cli_hdr_cdr_op_gen (true);
+ bfd->cli_hdr_cdr_op_gen (true);
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_fwd_cdr_op_ch::visit_eventtype_fwd (be_eventtype_fwd *node)
+{
+ return this->visit_valuetype_fwd (node);
+}
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
new file mode 100644
index 00000000000..2b1638de626
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ci.cpp
@@ -0,0 +1,97 @@
+//
+// $Id$
+//
+
+// ================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ci.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for CDR operators for forward
+// declarations of valuetypes. This uses compiled marshaling.
+//
+// = AUTHOR
+// Torsten Kuepper based on code from
+// Aniruddha Gokhale & Carlos O'Ryan (cdr_op_ci.cpp)
+//
+// ================================================================
+
+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_decl (ctx)
+{
+}
+
+be_visitor_valuetype_fwd_cdr_op_ci::~be_visitor_valuetype_fwd_cdr_op_ci (
+ void
+ )
+{
+}
+
+int
+be_visitor_valuetype_fwd_cdr_op_ci::visit_valuetype_fwd (
+ be_valuetype_fwd *node
+ )
+{
+ AST_Interface *fd = node->full_definition ();
+ be_valuetype *bfd = be_valuetype::narrow_from_decl (fd);
+
+ // Check if it's imported vt or CDR ops already generated.
+ if (node->cli_inline_cdr_op_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ // Is we are defined leater then let the real VT to generate
+ // all this stuff.
+ if (bfd->is_defined ())
+ {
+ return 0;
+ }
+
+ // Generate helper functions declaration.
+ if (bfd->gen_helper_inline () == -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 << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__
+ << be_nl << be_nl;
+
+ //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 () << " *&);";
+
+ // Done with this.
+ node->cli_inline_cdr_op_gen (true);
+ return 0;
+}
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
new file mode 100644
index 00000000000..d5c8ecd8e5c
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ch.cpp
@@ -0,0 +1,65 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_fwd_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for ValueTypeFwd node in the client header.
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+// based on code from Torsten Kuepper
+// based on code from Aniruddha Gokhale (interface_fwd_ch.cpp)
+//
+// ============================================================================
+
+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)
+{
+}
+
+be_visitor_valuetype_fwd_ch::~be_visitor_valuetype_fwd_ch (void)
+{
+}
+
+// Visit the valuetype_fwd node and its scope.
+int
+be_visitor_valuetype_fwd_ch::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ AST_Interface *fd = node->full_definition ();
+ be_valuetype *bfd = be_valuetype::narrow_from_decl (fd);
+
+ // This will be a no-op if it has already been done for this node.
+ bfd->gen_var_out_seq_decls ();
+
+ // Copy the fwd helper name back to the forward declared interface node.
+ node->fwd_helper_name (bfd->fwd_helper_name ());
+
+ node->cli_hdr_gen (true);
+ return 0;
+}
+
+int
+be_visitor_valuetype_fwd_ch::visit_eventtype_fwd (be_eventtype_fwd *node)
+{
+ return this->visit_valuetype_fwd (node);
+}
+
diff --git a/TAO/TAO_IDL/be_include/TAO_IDL_BE_Export.h b/TAO/TAO_IDL/be_include/TAO_IDL_BE_Export.h
new file mode 100644
index 00000000000..a7bafee327f
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/TAO_IDL_BE_Export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_IDL_BE_EXPORT_H
+#define TAO_IDL_BE_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS)
+# if !defined (TAO_IDL_BE_HAS_DLL)
+# define TAO_IDL_BE_HAS_DLL 0
+# endif /* ! TAO_IDL_BE_HAS_DLL */
+#else
+# if !defined (TAO_IDL_BE_HAS_DLL)
+# define TAO_IDL_BE_HAS_DLL 1
+# endif /* ! TAO_IDL_BE_HAS_DLL */
+#endif
+
+#if defined (TAO_IDL_BE_HAS_DLL) && (TAO_IDL_BE_HAS_DLL == 1)
+# if defined (TAO_IDL_BE_BUILD_DLL)
+# define TAO_IDL_BE_Export ACE_Proper_Export_Flag
+# define TAO_IDL_BE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_IDL_BE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_IDL_BE_BUILD_DLL */
+# define TAO_IDL_BE_Export ACE_Proper_Import_Flag
+# define TAO_IDL_BE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_IDL_BE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_IDL_BE_BUILD_DLL */
+#else /* TAO_IDL_BE_HAS_DLL == 1 */
+# define TAO_IDL_BE_Export
+# define TAO_IDL_BE_SINGLETON_DECLARATION(T)
+# define TAO_IDL_BE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_IDL_BE_HAS_DLL == 1 */
+
+#endif /* TAO_IDL_BE_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/TAO_IDL/be_include/be_argument.h b/TAO/TAO_IDL/be_include/be_argument.h
new file mode 100644
index 00000000000..b000118841a
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_argument.h
@@ -0,0 +1,54 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_argument.h
+//
+// = DESCRIPTION
+// Extension of class AST_Argument that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef BE_ARGUMENT_H
+#define BE_ARGUMENT_H
+
+#include "be_decl.h"
+#include "ast_argument.h"
+
+class AST_Type;
+class be_visitor;
+
+class be_argument : public virtual AST_Argument,
+ public virtual be_decl
+{
+public:
+ // Default constructor.
+ be_argument (void);
+
+ // Constructor.
+ be_argument (AST_Argument::Direction d,
+ AST_Type *ft,
+ UTL_ScopedName *n);
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS2 (be_argument, AST_Argument, be_decl);
+ DEF_NARROW_FROM_DECL (be_argument);
+};
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_array.h b/TAO/TAO_IDL/be_include/be_array.h
new file mode 100644
index 00000000000..f5d5ffe7049
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_array.h
@@ -0,0 +1,70 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_array.h
+//
+// = DESCRIPTION
+// Extension of class AST_Array that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef BE_ARRAY_H
+#define BE_ARRAY_H
+
+#include "be_type.h"
+#include "ast_array.h"
+
+class UTL_ExprList;
+class TAO_OutStream;
+class be_visitor;
+
+class be_array : public virtual AST_Array,
+ public virtual be_type
+{
+public:
+ be_array (void);
+ // Default constructor.
+
+ be_array (UTL_ScopedName *n,
+ unsigned long ndims,
+ UTL_ExprList *dims,
+ bool local,
+ bool abstract);
+ // Constructor.
+
+ ~be_array (void);
+
+ int gen_dimensions (TAO_OutStream *os,
+ unsigned short slice = 0);
+ // Generate dimensions. If slice == 1, generate dimensions for the slice
+ // definition.
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS2 (be_array, AST_Array, be_type);
+ DEF_NARROW_FROM_DECL (be_array);
+
+protected:
+ virtual int create_name (void);
+ // Create a name for us.
+
+ virtual void compute_tc_name (void);
+};
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_attribute.h b/TAO/TAO_IDL/be_include/be_attribute.h
new file mode 100644
index 00000000000..ca78e671bea
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_attribute.h
@@ -0,0 +1,85 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_attribute.h
+//
+// = DESCRIPTION
+// Extension of class AST_Attribute that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef BE_ATTRIBUTE_H
+#define BE_ATTRIBUTE_H
+
+#include "ast_attribute.h"
+#include "be_decl.h"
+#include "be_operation_strategy.h"
+
+class AST_Type;
+class be_visitor;
+
+class be_attribute : public virtual AST_Attribute,
+ public virtual be_decl
+{
+public:
+ be_attribute (void);
+ // Default constructor.
+
+ be_attribute (bool ro,
+ AST_Type *ft,
+ UTL_ScopedName *n,
+ bool local,
+ bool abstract);
+ // Constructor.
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+
+ be_operation_strategy *set_get_strategy (
+ be_operation_strategy *new_strategy
+ );
+ // Set the get operation strategy.
+ // Note, that it is not actually used, the operation
+ // made out of the attribute is going to copy it.
+
+ be_operation_strategy *set_set_strategy (
+ be_operation_strategy *new_strategy
+ );
+ // Set the set operation strategy.
+ // Note, that it is not actually used, the operation
+ // made out of the attribute is going to copy it.
+
+ be_operation_strategy *get_get_strategy (void);
+ // Retrieve the underlying get_operation strategy.
+
+ be_operation_strategy *get_set_strategy (void);
+ // Retrieve the underlying set_operation strategy.
+
+ virtual void destroy (void);
+ // Cleanup.
+
+ // Narrowing
+ DEF_NARROW_METHODS2 (be_attribute, AST_Attribute, be_decl);
+ DEF_NARROW_FROM_DECL (be_attribute);
+
+private:
+ be_operation_strategy *get_strategy_;
+
+ be_operation_strategy *set_strategy_;
+ // Member for holding the strategy for covering
+ // differences between various operations, e.g. sendc_, raise_
+ // operations in the AMI spec.
+};
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h
new file mode 100644
index 00000000000..8f23dd35f83
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_codegen.h
@@ -0,0 +1,484 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// ================================================================
+//
+// = LIBRARY
+// TAO_IDL_BE
+//
+// = FILENAME
+// be_codegen.h
+//
+// = DESCRIPTION
+// The Code generator class
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ================================================================
+
+#ifndef TAO_BE_CODEGEN_H
+#define TAO_BE_CODEGEN_H
+
+#include "ace/Singleton.h"
+#include "ace/Synch_Traits.h"
+#include "TAO_IDL_BE_Export.h"
+
+class TAO_Visitor_Factory;
+class TAO_OutStream;
+class be_visitor_context;
+class be_visitor;
+class be_decl;
+
+class TAO_IDL_BE_Export TAO_CodeGen
+{
+ // = TITLE
+ // TAO_CodeGen
+ //
+ // = DESCRIPTION
+ // Holds global parameters for the Back End and
+ // generates the C++ mapping.
+ //
+public:
+
+ // Define all the code generation states.
+ // The first letter C/S of the suffix stands for client/server-side
+ // The second letter H/I/S stands for header/inline/impl file.
+ // These are used to denote the state or the context of code
+ // generation we are in and serves to produce the right kind of
+ // visitor for us.
+
+ enum CG_STATE
+ {
+ // Initial state.
+ TAO_INITIAL,
+
+ // Rest of the state in alphabetical order of the types.
+
+ // Emitting code for arguments of an operation. No distinction between
+ // headers, inlines, stubs.
+ TAO_ARGUMENT_COLLOCATED_UPCALL_SS, // passing argument
+ // variable to upcall
+
+ // Emitting code for array defn.
+ TAO_ARRAY_CH,
+
+ // Emitting code for exceptions.
+ TAO_EXCEPTION_CTOR_CH,
+ TAO_EXCEPTION_CTOR_CS,
+
+ // Emitting code for the interface.
+ TAO_INTERFACE_CH,
+ TAO_INTERFACE_SMART_PROXY_CH,
+ TAO_INTERFACE_SMART_PROXY_CS,
+
+ TAO_INTERFACE_DIRECT_PROXY_IMPL_SH,
+ TAO_INTERFACE_DIRECT_PROXY_IMPL_SS,
+
+ // Emitting code for the AMH ResponseHandlers.
+ TAO_INTERFACE_AMH_RH_SH,
+ TAO_INTERFACE_AMH_RH_SS,
+
+ // Emitting code for the valuetype.
+ TAO_VALUETYPE_OBV_CH, // OBV_ class
+ TAO_VALUETYPE_OBV_CI,
+ TAO_VALUETYPE_OBV_CS,
+
+ // Emitting code for the module,
+ TAO_MODULE_OBV_CH, // for OBV_ (cmp. POA_ namespace)
+ TAO_MODULE_OBV_CI,
+ TAO_MODULE_OBV_CS,
+
+ // Emitting code for an operation.
+ TAO_OPERATION_CH, // in client header
+ TAO_OPERATION_CS, // in client stubs
+
+ TAO_OPERATION_ARGLIST_CH, // parameter list in op signature
+ TAO_OPERATION_ARGLIST_SH, // ... for server header
+
+ TAO_OPERATION_ARGLIST_PROXY_IMPL_XH, // Proxy impl arg list generation
+ // in client/server header
+ TAO_OPERATION_ARGLIST_PROXY_IMPL_XS,
+
+
+ TAO_OPERATION_ARGLIST_IH, // ... for implementation header
+ TAO_OPERATION_ARGLIST_IS, // ... for implementation header
+ TAO_OPERATION_ARGLIST_COLLOCATED_SH, // ... for collocated server
+ // variable to do_static_call
+ TAO_OPERATION_ARG_INVOKE_CS, // passing argument variable to do_static_call
+ // after do_static_call
+ TAO_OPERATION_ARG_DECL_SS, // argument decl in skeleton
+ TAO_OPERATION_ARG_DEMARSHAL_SS, // and argument variables to the
+ TAO_OPERATION_ARG_MARSHAL_SS,
+ // variable
+ TAO_OPERATION_ARG_UPCALL_SS, // variables to upcall
+ TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS, // variables to upcall for
+ // collocated op
+
+ TAO_OBV_OPERATION_ARGLIST_CH, // parameter list in obv op signature
+ TAO_OBV_OPERATION_ARGLIST_CS, // used only for AMH exceptions
+ // ... for client header
+ TAO_OBV_OPERATION_ARGLIST_SH, // ... for server header
+ TAO_OBV_OPERATION_ARGLIST_IH, // ... for implementation header
+ TAO_OBV_OPERATION_ARGLIST_IS, // ... for implementation header
+
+ // AMI next generation states
+ TAO_AMI_INTERFACE_CH,
+ TAO_AMI_SENDC_OPERATION_CH,
+ TAO_AMI_SENDC_OPERATION_CS,
+ TAO_AMI_HANDLER_REPLY_STUB_OPERATION_CH,
+ TAO_AMI_HANDLER_REPLY_STUB_OPERATION_CS,
+ TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CH,
+ TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CS,
+ TAO_AMI_EXCEPTION_HOLDER_RAISE_OPERATION_CS,
+
+ // Emitting code for root.
+ TAO_ROOT_CH,
+ TAO_ROOT_CI,
+ TAO_ROOT_CS,
+ TAO_ROOT_SH,
+ TAO_ROOT_SI,
+ TAO_ROOT_SS,
+ TAO_ROOT_TIE_SH,
+ TAO_ROOT_TIE_SI,
+ TAO_ROOT_IH,
+ TAO_ROOT_IS,
+ TAO_ROOT_ANY_OP_CH,
+ TAO_ROOT_ANY_OP_CS,
+ TAO_ROOT_CDR_OP_CH,
+ TAO_ROOT_CDR_OP_CS,
+
+ TAO_ROOT_SERIALIZER_OP_CH,
+ TAO_ROOT_SERIALIZER_OP_CS,
+
+ // Emitting code for sequence base type.
+ TAO_SEQUENCE_BASE_CH,
+
+ // For special sequnce elements.
+ TAO_SEQELEM_RETTYPE_CH,
+
+ // For sequence buffer types.
+ TAO_SEQUENCE_BUFFER_TYPE_CH,
+
+ // Emitting code for the public members of the union.
+ TAO_UNION_PUBLIC_CH,
+ TAO_UNION_PUBLIC_CI,
+ TAO_UNION_PUBLIC_CS,
+ TAO_UNION_PUBLIC_ASSIGN_CS,
+ TAO_UNION_PUBLIC_RESET_CS,
+
+ // Emitting code for private members of the union.
+ TAO_UNION_PRIVATE_CH
+ };
+
+ enum LOOKUP_STRATEGY
+ {
+ // Various lookup strategies.
+ TAO_LINEAR_SEARCH,
+ TAO_DYNAMIC_HASH,
+ TAO_PERFECT_HASH,
+ TAO_BINARY_SEARCH
+ };
+
+ enum CG_SUB_STATE
+ {
+ // Sub states.
+
+ // These are for the CDR operators.
+ TAO_CDR_INPUT,
+ TAO_CDR_OUTPUT,
+ TAO_CDR_SCOPE,
+
+ // DDS DCPS Serializer support methods
+ TAO_MAX_MARSHALED_SIZE,
+ TAO_IS_BOUNDED_SIZE,
+ TAO_FIND_SIZE,
+
+ // These are for typecode generation.
+ TAO_TC_DEFN_TYPECODE, // top level typecode
+ TAO_TC_DEFN_TYPECODE_NESTED, // nested tc
+
+ TAO_TC_DEFN_ENCAPSULATION, // encapsulation
+
+ TAO_TC_DEFN_SCOPE, // scope
+ TAO_TC_DEFN_TC_SIZE, // tc size computation
+ TAO_TC_DEFN_ENCAP_LEN, // encap size computation
+ TAO_TC_DEFN_SCOPE_LEN, // scope size computation
+
+ // Means we are not generating the assignment operator.
+ TAO_UNION_COPY_CONSTRUCTOR,
+
+ // Generating the _var template parameter in sequence of arrays.
+ TAO_ARRAY_SEQ_CH_TEMPLATE_VAR,
+
+ // Generating an AMH response handler operation.
+ TAO_AMH_RESPONSE_HANDLER_OPERATION,
+
+ // Used to denote either error or don't care.
+ TAO_SUB_STATE_UNKNOWN
+ };
+
+ TAO_CodeGen (void);
+ // Constructor
+
+ ~TAO_CodeGen (void);
+ // Destructor
+
+ be_visitor *make_visitor (be_visitor_context *);
+ // Factory that makes the right visitor based on the contex. This
+ // delegates the task to its factory data member.
+
+ int gen_cplusplus_mapping (void);
+ // Generate the C++ mapping for CORBA IDL.
+
+ int start_client_header (const char *fname);
+ // Set the client header stream.
+
+ int start_client_inline (const char *fname);
+ // Set the client inline stream.
+
+ int start_client_stubs (const char *fname);
+ // Set the client stub stream.
+
+ int start_server_header (const char *fname);
+ // Set the server header stream.
+
+ int start_implementation_header (const char *fname);
+ // Set the implementation header stream.
+
+ int start_implementation_skeleton (const char *fname);
+ // Set the implementation skeleton stream.
+
+ int start_server_template_header (const char *fname);
+ // Set the server template header stream.
+
+ int start_server_inline (const char *fname);
+ // Set the server inline stream.
+
+ int start_server_template_inline (const char *fname);
+ // Set the server template inline stream.
+
+ int start_server_skeletons (const char *fname);
+ // Set the server skeletons stream.
+
+ int start_server_template_skeletons (const char *fname);
+ // Set the server template skeletons stream.
+
+ int start_anyop_header (const char *fname);
+ // Set the anyop header stream.
+
+ int start_anyop_source (const char *fname);
+ // Set the anyop source stream.
+
+ int end_client_header (void);
+ // Generate code at the end such as the <<= and >>= operators along
+ // with the ending #endif statement.
+
+ /// Generate necessary code at end of client inline file.
+ void end_client_inline (void);
+
+ /// Generate necessary code at end of client stub file.
+ void end_client_stubs (void);
+
+ int end_server_header (void);
+ // Put a last #endif in the server header.
+
+ /// Generate necessary code at end of server inline file.
+ void end_server_inline (void);
+
+ int end_implementation_header (const char *fname);
+ // Put a last #endif in the server header.
+
+ int end_implementation_skeleton (const char *fname);
+ // Put a last #endif in the server header.
+
+ int end_server_template_header (void);
+ // Put a last #endif in the server template header.
+
+ int end_server_template_inline (void);
+ // Put a last #endif in the server template header.
+
+ int end_server_template_skeletons (void);
+ // Put a last #endif in the server skeletons.
+
+ int end_server_skeletons (void);
+ // Put a last #endif in the server skeletons.
+
+ int end_anyop_header (void);
+ // Put a last #endif in the anyop header.
+
+ int end_anyop_source (void);
+ // Make sure we end with a newline.
+
+ TAO_OutStream *client_header (void);
+ // Get the client header stream.
+
+ TAO_OutStream *client_stubs (void);
+ // Get the client stubs stream.
+
+ TAO_OutStream *client_inline (void);
+ // Get the client inline stream.
+
+ TAO_OutStream *server_header (void);
+ // get the server header stream.
+
+ TAO_OutStream *implementation_header (void);
+ // Get the implementation header stream.
+
+ TAO_OutStream *implementation_skeleton (void);
+ // Get the implementation skeleton stream.
+
+ TAO_OutStream *server_template_header (void);
+ // Get the server header template stream.
+
+ TAO_OutStream *server_skeletons (void);
+ // Get the server skeletons stream.
+
+ TAO_OutStream *server_template_skeletons (void);
+ // Get the server template skeletons stream.
+
+ TAO_OutStream *server_inline (void);
+ // Get the server inline stream.
+
+ TAO_OutStream *server_template_inline (void);
+ // Get the server template inline stream.
+
+ TAO_OutStream *anyop_header (void);
+ // Get the anyop header stream.
+
+ TAO_OutStream *anyop_source (void);
+ // Get the anyop source stream.
+
+ void gperf_input_stream (TAO_OutStream *gperf_input);
+ // Set the gperf input file stream.
+
+ TAO_OutStream *gperf_input_stream (void);
+ // Retrieve the gperf input stream being used.
+
+ void gperf_input_filename (char *filename);
+ // Set the gperf input file name.
+
+ char *gperf_input_filename (void);
+ // Retrieve the gperf input file name being used.
+ // Name of the temp file used to collect the input for gperf
+ // program. This is needed coz I do ACE_OS::open on this when I need
+ // ACE_HANDLE for the file instead FILE*.
+
+ void outstream (TAO_OutStream *os);
+ // Set current out stream.
+
+ TAO_OutStream *outstream (void);
+ // Retrieve current out stream being used.
+
+ void config_visitor_factory (void);
+ // Set the visitor factory object. In this respect, this behaves as the
+ // "strategy" pattern in which the TAO_CodeGen object is the context and the
+ // visitor_factory is the strategy object.
+
+ void node (be_decl *n);
+ // Pass info.
+
+ be_decl *node (void);
+ // Retrieve passed info.
+
+ const char *upcase (const char *str);
+ // Convert input string to all upcase.
+
+ void gen_ident_string (TAO_OutStream *stream) const;
+ // Pass along the #ident string, if any, from the IDL file.
+
+ void destroy (void);
+ // Cleanup.
+
+private:
+ void gen_ifndef_string (const char *fname,
+ TAO_OutStream *stream,
+ const char *prefix,
+ const char *suffix);
+
+ void gen_standard_include (TAO_OutStream *stream,
+ const char *included_file);
+
+ // Utility methods for generating ORB file includes.
+ void gen_stub_hdr_includes (void);
+ void gen_stub_src_includes (void);
+ void gen_skel_src_includes (void);
+ void gen_seq_file_includes (void);
+ void gen_any_file_includes (TAO_OutStream * stream) ;
+ void gen_var_file_includes (void);
+ void gen_stub_arg_file_includes (TAO_OutStream * stream);
+ void gen_skel_arg_file_includes (TAO_OutStream * stream);
+ void gen_cond_file_include (bool condition_green,
+ const char *filepath,
+ TAO_OutStream *stream);
+ void gen_typecode_includes (TAO_OutStream * stream);
+
+private:
+ TAO_OutStream *client_header_;
+ // Client header stream.
+
+ TAO_OutStream *client_stubs_;
+ // Client stub file stream
+
+ TAO_OutStream *client_inline_;
+ // Client side inline definitions.
+
+ TAO_OutStream *server_header_;
+ // Server header stream.
+
+ TAO_OutStream *implementation_header_;
+ // Implementation header stream.
+
+ TAO_OutStream *implementation_skeleton_;
+ // Implementation skeleton stream.
+
+ TAO_OutStream *server_template_header_;
+ // Server header template stream.
+
+ TAO_OutStream *server_skeletons_;
+ // Server skeleton stream.
+
+ TAO_OutStream *server_template_skeletons_;
+ // Server skeleton template stream.
+
+ TAO_OutStream *server_inline_;
+ // Server side inline file.
+
+ TAO_OutStream *server_template_inline_;
+ // Server side template inline file.
+
+ TAO_OutStream *anyop_header_;
+ // Anyop header file.
+
+ TAO_OutStream *anyop_source_;
+ // Anyop source file.
+
+ TAO_OutStream *gperf_input_stream_;
+ // TAO_OutStream to collect the input for gperf program.
+
+ char *gperf_input_filename_;
+ // Name of the temp file used to collect the input for gperf
+ // program. This is needed coz I do ACE_OS::open on this when I need
+ // ACE_HANDLE for the file instead FILE*.
+
+ TAO_OutStream *curr_os_;
+ // Currently used out stream.
+
+ be_decl *node_;
+ // Save current node in this.
+
+ TAO_Visitor_Factory *visitor_factory_;
+ // Visitor factory object.
+
+ LOOKUP_STRATEGY strategy_;
+ // The enumerated value indicating the lookup strategy.
+};
+
+typedef ACE_Singleton<TAO_CodeGen, ACE_SYNCH_RECURSIVE_MUTEX> TAO_CODEGEN;
+// Singleton instance of the BE code generator.
+
+extern TAO_IDL_BE_Export TAO_CodeGen *tao_cg;
+// Code generator instance which is used everywhere.
+
+#endif /* if !defined */
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..6b36761bc1e
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_component.h
@@ -0,0 +1,67 @@
+/* -*- 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 redefine (AST_Interface *from);
+ // Catch BE-specific members before delegating to the base class.
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+
+ // Need for public access to fe_add_structure and fe_add_typedef,
+ // used to add implied IDL nodes created for 'uses multiple' declarations.
+ AST_Structure *be_add_structure (AST_Structure *t);
+ AST_Typedef *be_add_typedef (AST_Typedef *t);
+
+ // 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
new file mode 100644
index 00000000000..b23fbc2734c
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_constant.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_constant.h
+//
+// = DESCRIPTION
+// Extension of class AST_Constant that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef BE_CONSTANT_H
+#define BE_CONSTANT_H
+
+#include "be_decl.h"
+#include "ast_constant.h"
+
+class be_visitor;
+
+class be_constant : public virtual AST_Constant,
+ public virtual be_decl
+{
+public:
+ be_constant (void);
+ // Constructor.
+
+ be_constant (AST_Expression::ExprType et,
+ AST_Expression *v,
+ UTL_ScopedName *n);
+ // Constructor.
+
+ // 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);
+
+};
+
+#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_decl.h b/TAO/TAO_IDL/be_include/be_decl.h
new file mode 100644
index 00000000000..dde2fa8ece3
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_decl.h
@@ -0,0 +1,223 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_decl.h
+//
+// = DESCRIPTION
+// Extension of the AST_Decl class.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_DECL_H
+#define TAO_BE_DECL_H
+
+#include "ast_decl.h"
+
+class be_scope;
+class be_visitor;
+class be_type;
+
+class be_decl : public virtual AST_Decl
+{
+ // = TITLE
+ // be_decl
+ // = DESCRIPTION
+ // The back end extension of the AST_Decl class. Provides an abstract
+ // interface.
+ //
+public:
+ be_decl (void);
+ // Default constructor.
+
+ be_decl (AST_Decl::NodeType type,
+ UTL_ScopedName *n);
+ // Constructor that sets the node type.
+
+ ~be_decl (void);
+ // Destructor.
+
+ // Methods used by the interface type strategy.
+ void compute_full_name (const char *prefix,
+ const char *suffix,
+ char *&name);
+ // Both the arguments should be non-null!!!. Applies prefix and
+ // suffix to the local name and makes a flat name.
+
+ void compute_flat_name (const char *prefix,
+ const char *suffix,
+ char *& name);
+ // Both the arguments should be non-null!!!. Applies prefix and
+ // suffix to the local name and makes a flat name.
+
+ // End of Methods use by the interface type strategy.
+
+ virtual be_scope *scope (void);
+ // Return the scope created by this node (if one exists).
+
+ // Visiting
+ virtual int accept (be_visitor *visitor);
+
+ virtual void destroy (void);
+ // Cleanup function.
+
+ void set_local (bool val);
+ // Temporarily set this node's is_local_ flag.
+
+ // Boolean methods to test if code was already generated.
+ bool cli_hdr_gen (void);
+ bool cli_stub_gen (void);
+ bool cli_inline_gen (void);
+ bool srv_hdr_gen (void);
+ bool impl_hdr_gen (void);
+ bool srv_skel_gen (void);
+ bool impl_skel_gen (void);
+ bool srv_inline_gen (void);
+ bool cli_hdr_any_op_gen (void);
+ bool cli_stub_any_op_gen (void);
+ bool cli_hdr_cdr_op_gen (void);
+ bool cli_stub_cdr_op_gen (void);
+ bool cli_inline_cdr_op_gen (void);
+ bool cli_inline_cdr_decl_gen (void);
+ bool cli_hdr_serializer_op_gen (void);
+ bool cli_stub_serializer_op_gen (void);
+ bool cli_inline_serializer_op_gen (void);
+ bool cli_inline_serializer_decl_gen (void);
+
+ bool cli_traits_gen (void);
+ bool cli_arg_traits_gen (void);
+ bool srv_arg_traits_gen (void);
+ bool srv_sarg_traits_gen (void);
+ bool cli_pragma_inst_gen (void);
+ bool cli_inarg_tmpl_class_gen (void);
+ bool cli_inarg_pragma_inst_gen (void);
+ bool cli_inoutarg_tmpl_class_gen (void);
+ bool cli_inoutarg_pragma_inst_gen (void);
+ bool cli_outarg_tmpl_class_gen (void);
+ bool cli_outarg_pragma_inst_gen (void);
+ bool cli_retarg_tmpl_class_gen (void);
+ bool cli_retarg_pragma_inst_gen (void);
+ bool srv_tmpl_class_gen (void);
+ bool srv_pragma_inst_gen (void);
+ bool srv_inarg_tmpl_class_gen (void);
+ bool srv_inarg_pragma_inst_gen (void);
+ bool srv_inoutarg_tmpl_class_gen (void);
+ bool srv_inoutarg_pragma_inst_gen (void);
+ bool srv_outarg_tmpl_class_gen (void);
+ bool srv_outarg_pragma_inst_gen (void);
+ bool srv_retarg_tmpl_class_gen (void);
+ bool srv_retarg_pragma_inst_gen (void);
+ bool ccm_pre_proc_gen (void);
+
+ // Set the flag indicating that code generation is done.
+ void cli_hdr_gen (bool);
+ void cli_stub_gen (bool);
+ void cli_inline_gen (bool);
+ void srv_hdr_gen (bool);
+ void impl_hdr_gen (bool);
+ void srv_skel_gen (bool);
+ void impl_skel_gen (bool);
+ void srv_inline_gen (bool);
+ void cli_hdr_any_op_gen (bool);
+ void cli_stub_any_op_gen (bool);
+ void cli_hdr_cdr_op_gen (bool);
+ void cli_stub_cdr_op_gen (bool);
+ void cli_inline_cdr_op_gen (bool);
+ void cli_inline_cdr_decl_gen (bool);
+ void cli_hdr_serializer_op_gen (bool);
+ void cli_stub_serializer_op_gen (bool);
+ void cli_inline_serializer_op_gen (bool);
+ void cli_inline_serializer_decl_gen (bool);
+
+ void cli_traits_gen (bool);
+ void cli_arg_traits_gen (bool);
+ void srv_arg_traits_gen (bool);
+ void srv_sarg_traits_gen (bool);
+ void cli_pragma_inst_gen (bool);
+ void cli_inarg_tmpl_class_gen (bool);
+ void cli_inarg_pragma_inst_gen (bool);
+ void cli_inoutarg_tmpl_class_gen (bool);
+ void cli_inoutarg_pragma_inst_gen (bool);
+ void cli_outarg_tmpl_class_gen (bool);
+ void cli_outarg_pragma_inst_gen (bool);
+ void cli_retarg_tmpl_class_gen (bool);
+ void cli_retarg_pragma_inst_gen (bool);
+ void srv_tmpl_class_gen (bool);
+ void srv_pragma_inst_gen (bool);
+ void srv_inarg_tmpl_class_gen (bool);
+ void srv_inarg_pragma_inst_gen (bool);
+ void srv_inoutarg_tmpl_class_gen (bool);
+ void srv_inoutarg_pragma_inst_gen (bool);
+ void srv_outarg_tmpl_class_gen (bool);
+ void srv_outarg_pragma_inst_gen (bool);
+ void srv_retarg_tmpl_class_gen (bool);
+ void srv_retarg_pragma_inst_gen (bool);
+ void ccm_pre_proc_gen (bool);
+
+ // Narrowing
+ DEF_NARROW_METHODS1 (be_decl, AST_Decl);
+ DEF_NARROW_FROM_DECL (be_decl);
+
+protected:
+ // Called by be_operation (for the return type) and be_argument.
+ void set_arg_seen_bit (be_type *);
+
+private:
+ // Variables that indicate if the code generation for that node is already
+ // been done. This way we avoid regenerating same code.
+ bool cli_hdr_gen_;
+ bool cli_stub_gen_;
+ bool cli_inline_gen_;
+ bool srv_hdr_gen_;
+ bool impl_hdr_gen_;
+ bool srv_skel_gen_;
+ bool impl_skel_gen_;
+ bool srv_inline_gen_;
+ bool cli_hdr_any_op_gen_;
+ bool cli_stub_any_op_gen_;
+ bool cli_hdr_cdr_op_gen_;
+ bool cli_stub_cdr_op_gen_;
+ bool cli_inline_cdr_op_gen_;
+ bool cli_inline_cdr_decl_gen_;
+ bool cli_hdr_serializer_op_gen_;
+ bool cli_stub_serializer_op_gen_;
+ bool cli_inline_serializer_op_gen_;
+ bool cli_inline_serializer_decl_gen_;
+
+ bool cli_traits_gen_;
+ bool cli_arg_traits_gen_;
+ bool srv_arg_traits_gen_;
+ bool srv_sarg_traits_gen_;
+ bool cli_pragma_inst_gen_;
+ bool cli_inarg_tmpl_class_gen_;
+ bool cli_inarg_pragma_inst_gen_;
+ bool cli_inoutarg_tmpl_class_gen_;
+ bool cli_inoutarg_pragma_inst_gen_;
+ bool cli_outarg_tmpl_class_gen_;
+ bool cli_outarg_pragma_inst_gen_;
+ bool cli_retarg_tmpl_class_gen_;
+ bool cli_retarg_pragma_inst_gen_;
+ bool srv_tmpl_class_gen_;
+ bool srv_pragma_inst_gen_;
+ bool srv_inarg_tmpl_class_gen_;
+ bool srv_inarg_pragma_inst_gen_;
+ bool srv_inoutarg_tmpl_class_gen_;
+ bool srv_inoutarg_pragma_inst_gen_;
+ bool srv_outarg_tmpl_class_gen_;
+ bool srv_outarg_pragma_inst_gen_;
+ bool srv_retarg_tmpl_class_gen_;
+ bool srv_retarg_pragma_inst_gen_;
+ bool ccm_pre_proc_gen_;
+};
+
+#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_enum.h b/TAO/TAO_IDL/be_include/be_enum.h
new file mode 100644
index 00000000000..97994833b64
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_enum.h
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_enum.h
+//
+// = DESCRIPTION
+// Extension of class AST_Enum that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef BE_ENUM_H
+#define BE_ENUM_H
+
+#include "be_scope.h"
+#include "be_type.h"
+#include "ast_enum.h"
+
+class be_visitor;
+
+class be_enum : public virtual AST_Enum,
+ public virtual be_scope,
+ public virtual be_type
+{
+public:
+ be_enum (void);
+ // Default constructor.
+
+ be_enum (UTL_ScopedName *n,
+ bool local,
+ bool abstract);
+ // Constructor.
+
+ virtual void destroy (void);
+ // Cleanup method.
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+
+ // Narrowing.
+ DEF_NARROW_METHODS3 (be_enum, AST_Enum, be_scope, be_type);
+ DEF_NARROW_FROM_DECL (be_enum);
+ DEF_NARROW_FROM_SCOPE (be_enum);
+
+private:
+};
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_enum_val.h b/TAO/TAO_IDL/be_include/be_enum_val.h
new file mode 100644
index 00000000000..50d10e42068
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_enum_val.h
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_enum_val.h
+//
+// = DESCRIPTION
+// Extension of class AST_EnumVal that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef BE_ENUM_VAL_H
+#define BE_ENUM_VAL_H
+
+#include "be_decl.h"
+#include "ast_enum_val.h"
+
+class be_visitor;
+
+class be_enum_val : public virtual AST_EnumVal,
+ public virtual be_decl
+{
+public:
+ be_enum_val (void);
+ // Default constructor.
+
+ be_enum_val (unsigned long v,
+ UTL_ScopedName *n);
+ // Constructor.
+
+ // 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);
+};
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_eventtype.h b/TAO/TAO_IDL/be_include/be_eventtype.h
new file mode 100644
index 00000000000..65455fa64ba
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_eventtype.h
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_eventtype.h
+//
+// = DESCRIPTION
+// Extension of class AST_EventType and be_valuetype that provides
+// additional means for C++ mapping of an valuetype.
+//
+// ============================================================================
+
+#ifndef TAO_BE_EVENTTYPE_H
+#define TAO_BE_EVENTTYPE_H
+
+#include "be_valuetype.h"
+#include "ast_eventtype.h"
+
+class be_eventtype : public virtual be_valuetype,
+ public virtual AST_EventType
+{
+ // = TITLE
+ // Backend-class for eventtypes
+ //
+ // = DESCRIPTION
+ // Extends be_valuetype.
+ //
+public:
+ be_eventtype (void);
+ // Default constructor.
+
+ be_eventtype (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,
+ bool abstract,
+ bool truncatable,
+ bool custom);
+ // Constructor that sets its scoped name <n>, a list of inherited valuetypes
+ // and supported interfaces <ih>, and the number of inherited interfaces <nih>
+
+ ~be_eventtype (void);
+ // Destructor.
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS2 (be_eventtype, be_valuetype, AST_EventType);
+ DEF_NARROW_FROM_DECL (be_eventtype);
+ DEF_NARROW_FROM_SCOPE (be_eventtype);
+};
+
+#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_eventtype_fwd.h b/TAO/TAO_IDL/be_include/be_eventtype_fwd.h
new file mode 100644
index 00000000000..63499fe887e
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_eventtype_fwd.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_eventtype_fwd.h
+//
+// = DESCRIPTION
+// Extension of class AST_EventType_Fwd that provides additional
+// means for C++ mapping of an eventtype.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef BE_EVENTTYPE_FWD_H
+#define BE_EVENTTYPE_FWD_H
+
+#include "be_valuetype_fwd.h"
+#include "ast_eventtype_fwd.h"
+
+class be_eventtype_fwd : public virtual be_valuetype_fwd,
+ public virtual AST_EventTypeFwd
+{
+ // =TITLE
+ // be_valuetype_fwd
+ //
+ // =DESCRIPTION
+ // Extensions to the be_interface_fwd class
+public:
+ be_eventtype_fwd (void);
+ // Default constructor.
+
+ be_eventtype_fwd (AST_Interface *dummy,
+ UTL_ScopedName *n);
+ // Constructor.
+
+ virtual ~be_eventtype_fwd (void);
+ // Destructor.
+
+ // Visiting.
+ virtual int accept (be_visitor* visitor);
+
+ // Cleanup
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS2 (be_eventtype_fwd, be_valuetype_fwd, AST_EventTypeFwd);
+ DEF_NARROW_FROM_DECL (be_eventtype_fwd);
+};
+
+#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_exception.h b/TAO/TAO_IDL/be_include/be_exception.h
new file mode 100644
index 00000000000..67657b1e54b
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_exception.h
@@ -0,0 +1,38 @@
+// $Id$
+
+#ifndef BE_EXCEPTION_H
+#define BE_EXCEPTION_H
+
+#include "be_scope.h"
+#include "be_type.h"
+#include "ast_exception.h"
+
+class be_visitor;
+
+class be_exception : public virtual AST_Exception,
+ public virtual be_scope,
+ public virtual be_type
+
+{
+public:
+ be_exception (void);
+ // Default constructor.
+
+ be_exception (UTL_ScopedName *n,
+ bool local,
+ bool abstract);
+ // Constructor.
+
+ virtual void destroy (void);
+ // Cleanup function.
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+
+ // Narrowing.
+ DEF_NARROW_METHODS3 (be_exception, AST_Exception, be_scope, be_type);
+ DEF_NARROW_FROM_DECL (be_exception);
+ DEF_NARROW_FROM_SCOPE (be_exception);
+};
+
+#endif // end of if !defined (...)
diff --git a/TAO/TAO_IDL/be_include/be_expression.h b/TAO/TAO_IDL/be_include/be_expression.h
new file mode 100644
index 00000000000..405000f5649
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_expression.h
@@ -0,0 +1,64 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_expression.h
+//
+// = DESCRIPTION
+// Extension of class AST_Expression that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef BE_EXPRESSION_H
+#define BE_EXPRESSION_H
+
+#include "ast_expression.h"
+#include "idl_uns_long.h"
+
+class be_visitor;
+
+class be_expression : public virtual AST_Expression
+{
+public:
+ // Constructors.
+ be_expression (UTL_ScopedName *n);
+
+ be_expression (AST_Expression *b,
+ AST_Expression::ExprType t);
+
+ be_expression (AST_Expression::ExprComb c,
+ AST_Expression *v1,
+ AST_Expression *v2);
+
+ be_expression (long l);
+
+ be_expression (bool b);
+
+ be_expression (idl_uns_long l,
+ AST_Expression::ExprType t);
+
+ be_expression (UTL_String *s);
+
+ be_expression (char *s);
+
+ be_expression (char c);
+
+ be_expression (ACE_OutputCDR::from_wchar wc);
+
+ be_expression (double d);
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+};
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_extern.h b/TAO/TAO_IDL/be_include/be_extern.h
new file mode 100644
index 00000000000..2ec5afe4f79
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_extern.h
@@ -0,0 +1,82 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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_EXTERN_BE_EXTERN_HH
+#define _BE_EXTERN_BE_EXTERN_HH
+
+#include "TAO_IDL_BE_Export.h"
+#include "be_global.h"
+
+extern TAO_IDL_BE_Export BE_GlobalData *be_global;
+
+extern TAO_IDL_BE_Export int BE_init (int &, char*[]);
+extern TAO_IDL_BE_Export void BE_post_init (char *[], long);
+extern TAO_IDL_BE_Export void BE_version (void);
+extern TAO_IDL_BE_Export void BE_produce (void);
+extern TAO_IDL_BE_Export void BE_cleanup (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_factory.h b/TAO/TAO_IDL/be_include/be_factory.h
new file mode 100644
index 00000000000..a53e7f3d6b6
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_factory.h
@@ -0,0 +1,60 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_factory.h
+//
+// = DESCRIPTION
+// Extension of class AST_Factory that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Boris Kolpackov <bosk@ipmce.ru>
+//
+// ============================================================================
+
+#ifndef BE_FACTORY_H
+#define BE_FACTORY_H
+
+#include "be_scope.h"
+#include "be_decl.h"
+#include "ast_factory.h"
+
+class AST_Type;
+class UTL_StrList;
+class be_visitor;
+class be_argument;
+
+class be_factory : public virtual AST_Factory,
+ public virtual be_scope,
+ public virtual be_decl
+{
+public:
+ be_factory (void);
+ // Default constructor.
+
+ be_factory (UTL_ScopedName *n);
+ // Constructor
+
+ ~be_factory (void);
+ // Destructor.
+
+ virtual void destroy (void);
+ // Cleanup method.
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+
+ // Narrowing
+ DEF_NARROW_METHODS3 (be_factory, AST_Factory, be_scope, be_decl);
+ DEF_NARROW_FROM_DECL (be_factory);
+ DEF_NARROW_FROM_SCOPE (be_factory);
+};
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_field.h b/TAO/TAO_IDL/be_include/be_field.h
new file mode 100644
index 00000000000..75a17bb495b
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_field.h
@@ -0,0 +1,53 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_field.h
+//
+// = DESCRIPTION
+// Extension of class AST_Field that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef BE_FIELD_H
+#define BE_FIELD_H
+
+#include "be_decl.h"
+#include "ast_field.h"
+
+class be_visitor;
+
+class be_field : public virtual AST_Field,
+ public virtual be_decl
+{
+public:
+ be_field (void);
+ // Default constructor.
+
+ be_field (AST_Type *ft,
+ UTL_ScopedName *n,
+ Visibility vis = vis_NA);
+ // Constructor.
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS2 (be_field, AST_Field, be_decl);
+ DEF_NARROW_FROM_DECL (be_field);
+};
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_generator.h b/TAO/TAO_IDL/be_include/be_generator.h
new file mode 100644
index 00000000000..38c6003cb82
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_generator.h
@@ -0,0 +1,268 @@
+// $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_GENERATOR_BE_GENERATOR_HH
+#define _BE_GENERATOR_BE_GENERATOR_HH
+
+// Defines BE class for generator
+//
+// This defines the same protocol as the AST_Generator class but actually
+// 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
+{
+public:
+ // Create a node representing a module which is the root of an AST made
+ // up of BE nodes.
+ virtual AST_Root *create_root (UTL_ScopedName *n);
+
+ virtual AST_PredefinedType *create_predefined_type (
+ AST_PredefinedType::PredefinedType t,
+ UTL_ScopedName *n
+ );
+
+ virtual AST_Module *create_module (UTL_Scope *s,
+ UTL_ScopedName *n);
+
+ virtual AST_Interface *create_interface (UTL_ScopedName *n,
+ AST_Interface **ih,
+ long nih,
+ AST_Interface **ih_flat,
+ long nih_flat,
+ bool is_local,
+ bool is_abstract);
+
+ virtual AST_InterfaceFwd *create_interface_fwd (UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract);
+
+ // Create a node representing a boxed value type
+ virtual AST_ValueBox *create_valuebox (UTL_ScopedName *n,
+ AST_Type *boxed_type);
+
+ 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_list,
+ long n_supports,
+ AST_Interface *supports_concrete,
+ bool is_abstract,
+ bool is_truncatable,
+ bool is_custom);
+
+ virtual AST_ValueTypeFwd *create_valuetype_fwd (UTL_ScopedName *n,
+ bool abstract);
+
+ virtual AST_EventType *create_eventtype (UTL_ScopedName *n,
+ AST_Interface **inherits,
+ long n_inherits,
+ AST_ValueType *inherits_concrete,
+ AST_Interface **inherits_flat,
+ long n_inherits_flat,
+ AST_Interface **supports_list,
+ long n_supports,
+ AST_Interface *supports_concrete,
+ bool is_abstract,
+ bool is_truncatable,
+ bool is_custom);
+
+ virtual AST_EventTypeFwd *create_eventtype_fwd (UTL_ScopedName *n,
+ bool abstract);
+
+ virtual AST_Component *create_component (UTL_ScopedName *n,
+ AST_Component *base_component,
+ AST_Interface **supports_list,
+ long n_supports,
+ AST_Interface **supports_flat,
+ long n_supports_flat);
+
+ virtual AST_ComponentFwd *create_component_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_list,
+ long n_supports,
+ AST_Interface **supports_flat,
+ long n_supports_flat);
+
+ virtual AST_Exception *create_exception (UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract);
+
+ virtual AST_Structure *create_structure (UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract);
+
+ virtual AST_StructureFwd *create_structure_fwd (UTL_ScopedName *n);
+
+ virtual AST_Enum *create_enum (UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract);
+
+ virtual AST_Operation *create_operation (AST_Type *rt,
+ AST_Operation::Flags fl,
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract);
+
+ virtual AST_Field *create_field (AST_Type *ft, UTL_ScopedName *n,
+ AST_Field::Visibility vis =
+ AST_Field::vis_NA);
+
+ virtual AST_Argument *create_argument (AST_Argument::Direction d,
+ AST_Type *ft,
+ UTL_ScopedName *n);
+
+ virtual AST_Attribute *create_attribute (bool ro,
+ AST_Type *ft,
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract);
+
+ virtual AST_Union *create_union (AST_ConcreteType *dt,
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract);
+
+ virtual AST_UnionFwd *create_union_fwd (UTL_ScopedName *n);
+
+ virtual AST_UnionBranch *create_union_branch (UTL_LabelList *ll,
+ AST_Type *ft,
+ UTL_ScopedName *n);
+
+ virtual AST_UnionLabel *create_union_label (AST_UnionLabel::UnionLabel ul,
+ AST_Expression *lv);
+
+ virtual AST_Constant *create_constant (AST_Expression::ExprType et,
+ AST_Expression *ev,
+ UTL_ScopedName *n);
+
+ virtual AST_Expression *create_expr (UTL_ScopedName *n);
+
+ virtual AST_Expression *create_expr (AST_Expression *v,
+ AST_Expression::ExprType t);
+
+ virtual AST_Expression *create_expr (AST_Expression::ExprComb c,
+ AST_Expression *v1,
+ AST_Expression *v2);
+
+ virtual AST_Expression *create_expr (long v);
+
+ virtual AST_Expression *create_expr (bool b);
+
+ virtual AST_Expression *create_expr (idl_uns_long v,
+ AST_Expression::ExprType t);
+
+ virtual AST_Expression *create_expr( UTL_String *s);
+
+ virtual AST_Expression *create_expr (char *s);
+
+ virtual AST_Expression *create_expr (char c);
+
+ virtual AST_Expression *create_expr (ACE_OutputCDR::from_wchar wc);
+
+ virtual AST_Expression *create_expr (double d);
+
+ virtual AST_EnumVal *create_enum_val (unsigned long v,
+ UTL_ScopedName *n);
+
+ virtual AST_Array *create_array (UTL_ScopedName *n,
+ unsigned long ndims,
+ UTL_ExprList *dims,
+ bool is_local,
+ bool is_abstract);
+
+ virtual AST_Sequence *create_sequence (AST_Expression *v,
+ AST_Type *bt,
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract);
+
+ virtual AST_String *create_string (AST_Expression *v);
+
+ virtual AST_String *create_wstring (AST_Expression *v);
+
+ virtual AST_Typedef *create_typedef (AST_Type *bt,
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract);
+
+ // Create a node representing a native
+ virtual AST_Native *create_native (UTL_ScopedName *n);
+
+ // Create a node representing a OBV factory construct
+ virtual AST_Factory *create_factory (UTL_ScopedName *n);
+};
+
+#endif // _BE_GENERATOR_BE_GENERATOR_HH
diff --git a/TAO/TAO_IDL/be_include/be_global.h b/TAO/TAO_IDL/be_include/be_global.h
new file mode 100644
index 00000000000..a62e4470af4
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_global.h
@@ -0,0 +1,764 @@
+// -*- C++ -*-
+
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_global.h
+//
+// = DESCRIPTION
+// Header file for class containing compiler back end global data.
+//
+// = AUTHOR
+// Jeff Parsons <parsons@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef _BE_GLOBAL_H
+#define _BE_GLOBAL_H
+
+#include "TAO_IDL_BE_Export.h"
+
+#include "ace/Unbounded_Queue.h"
+#include "ace/SString.h"
+
+class be_interface;
+class be_valuetype;
+class be_module;
+class be_interface;
+class be_interface_fwd;
+class UTL_String;
+class AST_PredefinedType;
+class AST_Generator;
+
+// Defines a class containing all back end global data.
+
+class TAO_IDL_BE_Export BE_GlobalData
+{
+public:
+ // = TITLE
+ // BE_GlobalData
+ //
+ // = DESCRIPTION
+ // Storage of global data specific to the compiler back end
+ //
+ enum LOOKUP_STRATEGY
+ {
+ // various lookup strategies
+ TAO_LINEAR_SEARCH,
+ TAO_DYNAMIC_HASH,
+ TAO_PERFECT_HASH,
+ TAO_BINARY_SEARCH
+ };
+
+ // Constructor
+ BE_GlobalData (void);
+ // Destructor
+ virtual ~BE_GlobalData (void);
+
+ // To switch between changing or non-changing standard include
+ // files (e.g. tao/corba.h) so that #include statements can be
+ // generated with ""s or <>s respectively.
+ virtual void changing_standard_include_files (size_t changing);
+ virtual size_t changing_standard_include_files (void);
+
+ // Helper functions that generate the file names for the C++ mapping
+ // generated code.
+ // 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 (
+ bool base_name_only = 0
+ );
+ static const char *be_get_client_stub_fname (void);
+ static const char *be_get_client_inline_fname (
+ bool base_name_only = 0
+ );
+ static const char *be_get_server_hdr_fname (
+ bool base_name_only = 0
+ );
+ static const char *be_get_implementation_hdr_fname (
+ bool base_name_only = 0
+ );
+ static const char *be_get_implementation_skel_fname (
+ bool base_name_only = 0
+ );
+ static const char *be_get_server_template_hdr_fname (
+ bool 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 (
+ bool base_name_only = 0
+ );
+ static const char *be_get_server_inline_fname (
+ bool base_name_only = 0
+ );
+ static const char *be_get_server_template_inline_fname (
+ bool base_name_only = 0
+ );
+ static const char *be_get_anyop_source_fname (
+ bool base_name_only = 0
+ );
+ static const char *be_get_anyop_header_fname (
+ bool base_name_only = 0
+ );
+
+ // Helper functions: obtain the names of each generated file given
+ // the IDL file name.
+ // The parameter <base_name_only> set to 0 (no base name, but full
+ // name with output dir path, is useful, when I want just the
+ // base name to use in #include's etc.
+ static const char *be_get_client_hdr (UTL_String *idl_file_name,
+ bool base_name_only = 0);
+ static const char *be_get_client_stub (UTL_String *idl_file_name);
+ static const char *be_get_client_inline (UTL_String *idl_file_name,
+ bool base_name_only = 0);
+ static const char *be_get_server_hdr (UTL_String *idl_file_name,
+ bool base_name_only = 0);
+ static const char *be_get_implementation_hdr (UTL_String *idl_file_name,
+ bool base_name_only = 0);
+ static const char *be_get_implementation_skel (UTL_String *idl_file_name,
+ bool base_name_only = 0);
+ static const char *be_get_server_template_hdr (UTL_String *idl_file_name,
+ bool 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,
+ bool base_name_only = 0
+ );
+ static const char *be_get_server_inline (UTL_String *idl_file_name,
+ bool base_name_only = 0);
+ static const char *be_get_server_template_inline (UTL_String *idl_file_name,
+ bool base_name_only = 0);
+ static const char *be_get_anyop_header (UTL_String *idl_file_name,
+ bool base_name_only = 0);
+ static const char *be_get_anyop_source (UTL_String *idl_file_name,
+ bool base_name_only = 0);
+
+ const char* skel_export_macro (void) const;
+ // returns the macro name for exporting server side classes in Win32
+ // DLL.
+
+ void skel_export_macro (const char* s);
+ // set the macro name for export server side classes in Win32 DLL.
+
+ const char* skel_export_include (void) const;
+ // returns the name of the include file that contains the server
+ // side export macro definition.
+
+ void skel_export_include (const char* s);
+ // set the name of the include file that contains the server side
+ // export macro definition.
+
+ const char* stub_export_macro (void) const;
+ // returns the macro name for exporting client side classes in Win32
+ // DLL.
+
+ void stub_export_macro (const char* s);
+ // set the macro name for export client side classes in Win32 DLL.
+
+ const char* stub_export_include (void) const;
+ // returns the name of the include file that contains the client
+ // side export macro definition.
+
+ void stub_export_include (const char* s);
+ // set the name of the include file that contains the client side
+ // export macro definition.
+
+ const char* anyop_export_macro (void) const;
+ // returns the macro name for exporting client side classes in Win32
+ // DLL.
+
+ void anyop_export_macro (const char* s);
+ // set the macro name for export client side classes in Win32 DLL.
+
+ const char* anyop_export_include (void) const;
+ // returns the name of the include file that contains the client
+ // side export macro definition.
+
+ void anyop_export_include (const char* s);
+ // set the name of the include file that contains the client side
+ // export macro definition.
+
+ const char* pch_include (void) const;
+ // returns the name of the include file to be used for precompiled
+ // header support.
+
+ void pch_include (const char* s);
+ // set the name of the include file to be used for precompiled
+ // header support.
+
+ const char* pre_include (void) const;
+ // returns the name of the include file to be put at the top of
+ // every header file.
+
+ void pre_include (const char* s);
+ // set the name of the include file to be put at the top of every
+ // header file.
+
+ const char* post_include (void) const;
+ // returns the name of the include file to be put at the bottom of
+ // every header file.
+
+ void post_include (const char* s);
+ // set the name of the include file to be put at the bottom of every
+ // header file.
+
+ const char* include_guard (void) const;
+ // returns the guard that is placed in the client header file
+
+ void include_guard (const char* s);
+ // set the guard that is placed in the client header file
+
+ const char* safe_include (void) const;
+ // returns the name of the include file that is used instead of the own
+ // generated client header file
+
+ void safe_include (const char* s);
+ // set the name of the include file that is used instead of the own
+ // generated client header file
+
+ /// Set text that opens a "versioned" namespace.
+ void versioning_begin (const char* s);
+
+ /// Get text that opens a "versioned" namespace.
+ const char * versioning_begin (void) const;
+
+ /// Get text that opens a "versioned" namespace for core TAO/orbsvcs
+ /// related code.
+ const char * core_versioning_begin (void) const;
+
+ /// Set text that closes a "versioned" namespace.
+ void versioning_end (const char* s);
+
+ /// Get text that closes a "versioned" namespace.
+ const char * versioning_end (void) const;
+
+ /// Get text that closes a "versioned" namespace for core TAO/orbsvcs
+ /// related code.
+ const char * core_versioning_end (void) const;
+
+ // = Set and get methods for different file name endings.
+
+ void client_hdr_ending (const char* s);
+ // Set the client_hdr_ending.
+
+ const char* client_hdr_ending (void) const;
+ // Get the client_hdr_ending.
+
+ void client_inline_ending (const char* s);
+ // Set the client_inline_ending.
+
+ const char* client_inline_ending (void) const;
+ // Get the client_inline_ending.
+
+ void client_stub_ending (const char* s);
+ // Set the client_stub_ending.
+
+ const char* client_stub_ending (void) const;
+ // Get the client_stub_ending.
+
+ void server_hdr_ending (const char* s);
+ // Set the server_hdr_ending.
+
+ const char* server_hdr_ending (void) const;
+ // Get the server_hdr_ending.
+
+ void implementation_hdr_ending (const char* s);
+ // Set the implementation_hdr_ending.
+
+ void impl_class_prefix (const char* s);
+ // Set the implementation class prefix.
+
+ void impl_class_suffix (const char* s);
+ // Set the implementation class suffix.
+
+ void implementation_skel_ending (const char* s);
+ // Set the implementation_skel_ending.
+
+ const char* implementation_hdr_ending (void) const;
+ // Get the implementation_hdr_ending.
+
+ const char* impl_class_prefix (void) const;
+ //Get implementation class prefix
+
+ const char* impl_class_suffix (void) const;
+ //Get implementation class suffix
+
+ const char* implementation_skel_ending (void) const;
+ // Get the implementation_skel_ending.
+
+ void server_template_hdr_ending (const char* s);
+ // Set the server_template_hdr_ending.
+
+ const char* server_template_hdr_ending (void) const;
+ // Get the server_template_hdr_ending.
+
+ void server_skeleton_ending (const char* s);
+ // Set the server_skeleton_ending.
+
+ const char* server_skeleton_ending (void) const;
+ // Get the server_skeleton_ending.
+
+ void server_template_skeleton_ending (const char* s);
+ // Set the server_template_skeleton_ending.
+
+ const char* server_template_skeleton_ending (void) const;
+ // Get the server_template_skeleton_ending.
+
+ void server_inline_ending (const char* s);
+ // Set the server_inline_ending.
+
+ const char* server_inline_ending (void) const;
+ // Get the server_inline_ending.
+
+ void server_template_inline_ending (const char* s);
+ // Set the server_template_inline_ending.
+
+ const char* server_template_inline_ending (void) const;
+ // Get the server_template_inline_ending.
+
+ void anyop_header_ending (const char* s);
+ // Set the anyop_header_ending.
+
+ const char* anyop_header_ending (void) const;
+ // Get the anyop_header_ending.
+
+ void anyop_source_ending (const char* s);
+ // Set the anyop_source_ending.
+
+ const char* anyop_source_ending (void) const;
+ // Get the anyop_source_ending.
+
+ 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.
+
+ 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.
+
+ void skel_output_dir (const char* s);
+ // Set the directory where all the *S.* files are
+ // to be kept. Default is output_dir_.
+
+ const char* skel_output_dir (void) const;
+ // Get the directory where all the *S.* files are
+ // to be kept. Default is output_dir_.
+
+ void anyop_output_dir (const char* s);
+ // Set the directory where all the *A.* files are
+ // to be kept. Default is output_dir_.
+
+ const char* anyop_output_dir (void) const;
+ // Get the directory where all the *A.* files are
+ // to be kept. Default is output_dir_.
+
+ void any_support (bool);
+ // Set any support.
+
+ bool any_support (void) const;
+ // Check Any support.
+
+ void tc_support (bool);
+ // Set TypeCode support.
+
+ bool tc_support (void) const;
+ // Check TypeCode support
+
+ void obv_opt_accessor (bool);
+ // Set optimized valuetype member accessor generation.
+
+ bool obv_opt_accessor (void) const;
+ // Check optimized valuetype member accessor generation.
+
+ void gen_impl_files (bool);
+ // Set generation of implementation files.
+
+ bool gen_impl_files (void) const;
+ // Check if we want to generate implementation files.
+
+ void gen_impl_debug_info (bool);
+ // Set generation of source file and line number for implementation files.
+
+ bool gen_impl_debug_info (void) const;
+ // Check generation of source file and line number implementation files.
+
+ void gen_copy_ctor (bool);
+ // Set generation of copy constructor.
+
+ bool gen_copy_ctor (void) const;
+ // Check if we want to generate the copy constructor.
+
+ void gen_assign_op (bool);
+ // Set the generation of the assignment operator.
+
+ bool gen_assign_op (void) const;
+ // Check if we want to generate the assignment operator.
+
+ void gen_thru_poa_collocation (bool);
+ // Set whether we want to generate Thru_POA collocation stubs.
+
+ bool gen_thru_poa_collocation (void) const;
+ // Check if we want to generate Thru_POA collocation stubs.
+
+ void gen_direct_collocation (bool);
+ // Set whether we want to generate Direct collocation stubs.
+
+ bool gen_direct_collocation (void) const;
+ // Check if we want to generate Direct collocation stubs.
+
+ void exception_support (bool);
+ // Set real C++ exception support.
+
+ bool exception_support (void) const;
+ // Check if real C++ exception support is enabled.
+
+ void use_raw_throw (bool);
+ // Set replacement of 'ACE_THROW_SPEC' with 'throw'.
+
+ bool use_raw_throw (void) const;
+ // Check if raw 'throw' generation option is set.
+
+ void opt_tc (bool);
+ // Set optimized typecodes.
+
+ bool opt_tc (void) const;
+ // Check if TypeCodes are optimized.
+
+ void ami_call_back (bool value);
+ // To enable or disable AMI call back feature of the Messaging
+ // specification in the generated code.
+
+ bool ami_call_back (void) const;
+ // Return the flag.
+
+ void gen_amh_classes (bool value);
+ // To enable or disable AMH in the generated code.
+
+ bool gen_amh_classes (void) const;
+ // Return the flag.
+
+ void gen_tie_classes (bool value);
+ // Set the generation of tie classes and files.
+
+ bool gen_tie_classes (void) const;
+ // Return the flag.
+
+ void gen_smart_proxies (bool value);
+ // To enable or disable AMI call back feature of the Messaging
+ // specification in the generated code.
+
+ bool gen_smart_proxies (void) const;
+ // Return the flag.
+
+ void gen_inline_constants (bool value);
+ // Set the flag.
+
+ bool gen_inline_constants (void) const;
+ // Return the flag.
+
+ void gen_dcps_type_support (bool value);
+ // Set the flag.
+
+ bool gen_dcps_type_support (void) const;
+ // Return the flag.
+
+ void gen_orb_h_include (bool value);
+ // Set the flag.
+
+ bool gen_orb_h_include (void) const;
+ // Return the flag.
+
+ void lookup_strategy (LOOKUP_STRATEGY s);
+ // Set the lookup strategy.
+
+ BE_GlobalData::LOOKUP_STRATEGY lookup_strategy (void) const;
+ // Return the enumerated value for the lookup strategy. Default is
+ // perfect hashing.
+
+ void destroy (void);
+ // Cleanup function.
+
+ ACE_Unbounded_Queue<be_interface *> non_local_interfaces;
+ // Used in the generation of declarations for
+ // xxx_Proxy_Broker_Factory_function_pointer.
+
+ ACE_Unbounded_Queue<be_interface_fwd *> non_defined_interfaces;
+ // 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.
+
+ AST_PredefinedType *void_type (void);
+ // Accessor for the member, sets it on the first call.
+
+ be_interface *ccmobject (void);
+ // Accessor for the member, sets it on the first call.
+
+ be_module *messaging (void);
+ // Accessor for the member, sets it on the first call.
+
+ be_valuetype *messaging_exceptionholder (void);
+ // Accessor for the member, sets it on the first call.
+
+ be_valuetype *exceptionholder (void) const;
+ void exceptionholder (be_valuetype *val);
+ // Accessors for the member.
+
+ be_interface *messaging_replyhandler (void);
+ // Accessor for the member, sets it on the first call.
+
+ bool gen_anyop_files (void) const;
+ void gen_anyop_files (bool val);
+ // Accessors for the member.
+
+ bool gen_skel_files (void) const;
+ void gen_skel_files (bool val);
+ // Accessors for the member gen_skel_files_.
+
+ bool gen_client_inline (void) const;
+ void gen_client_inline (bool val);
+ // Accessors for the member gen_client_inline_.
+
+ bool gen_server_inline (void) const;
+ void gen_server_inline (bool val);
+ // Accessors for the member gen_server_inline_.
+
+ bool gen_local_iface_anyops (void) const;
+ void gen_local_iface_anyops (bool val);
+ // Accessors for the member gen_local_iface_anyops_.
+
+ ACE_CString spawn_options (void);
+ // Command line passed to ACE_Process::spawn. Different
+ // implementations in IDL and IFR backends.
+
+ void parse_args (long &i, char **av);
+ // Parse args that affect the backend.
+
+ void prep_be_arg (char *s);
+ // Special BE arg call factored out of DRV_args.
+
+ void arg_post_proc (void);
+ // Checks made after parsing args.
+
+ void usage (void) const;
+ // Display usage of BE-specific options.
+
+ AST_Generator *generator_init (void);
+ // Create an AST node generator.
+
+private:
+ size_t changing_standard_include_files_;
+ // To switch between changing or non-changing standard include
+ // files (e.g. tao/corba.h) so that #include statements can be
+ // generated with ""s or <>s respectively.
+
+ // Macros and includes used to export classes from generated code.
+ char* skel_export_macro_;
+ char* skel_export_include_;
+ char* stub_export_macro_;
+ char* stub_export_include_;
+
+ // Macro and include used on ORB .pidl files generating to the
+ // AnyTypeCode library.
+ char* anyop_export_macro_;
+ char* anyop_export_include_;
+
+ char* pch_include_;
+ char* pre_include_;
+ char* post_include_;
+ char* include_guard_;
+ char* safe_include_;
+
+ /// Text that opens a "versioned" namespace for core TAO and orbsvcs
+ /// related code.
+ ACE_CString core_versioning_begin_;
+
+ /// Text that closes a "versioned" namespace for core TAO and
+ /// orbsvcs related code.
+ ACE_CString core_versioning_end_;
+
+ /// Text that opens a "versioned" namepace.
+ ACE_CString versioning_begin_;
+
+ /// Text that closes a "versioned" namepace.
+ ACE_CString versioning_end_;
+
+ // Client's header file name ending. Default is "C.h".
+ char* client_hdr_ending_;
+
+ // Client's stub's file name ending. Default is "C.cpp".
+ char* client_stub_ending_;
+
+ // Client's inline file name ending. Default is "C.i".
+ char* client_inline_ending_;
+
+ // Server's hdr file name ending. Default is "S.h".
+ char* server_hdr_ending_;
+
+ // Implementation's hdr file name ending. Default is "I.h".
+ char* implementation_hdr_ending_;
+
+ // Implementation's skeleton file name ending. Default is "I.cpp".
+ char* implementation_skel_ending_;
+
+ //Implementaion class prefix
+ char* impl_class_prefix_;
+
+ //Implementation class suffix
+ char* impl_class_suffix_;
+
+ // Server's template hdr file name ending. Default is "S_T.h".
+ char* server_template_hdr_ending_;
+
+ // Server's skeleton file name ending. Default is "S.cpp".
+ char* server_skeleton_ending_;
+
+ // Server's template skeleton file name ending. Default is
+ // "S_T.cpp".
+ char* server_template_skeleton_ending_;
+
+ // Server's inline file name ending. Default is "S.i".
+ char* server_inline_ending_;
+
+ // Server's template inline file name ending. Default is "S_T.i".
+ char* server_template_inline_ending_;
+
+ // Anyop header file name ending. Default is "A.h".
+ char* anyop_hdr_ending_;
+
+ // Anyop source file name ending. Default is "A.cpp".
+ char* anyop_src_ending_;
+
+ char* output_dir_;
+ // Directory where all the IDL-Compiler-Generated files are to be
+ // kept. Default value is 0 for this string which means the current
+ // directory from which the <tao_idl> is called.
+
+ char* skel_output_dir_;
+ // Directory where all the *S.* files are to be
+ // kept. Default value is 0 for this string which means the
+ // value for output_dir_ is used.
+
+ char* anyop_output_dir_;
+ // Directory where all the *A.* files are to be
+ // kept. Default value is 0 for this string which means the
+ // value for output_dir_ is used.
+
+ bool any_support_;
+ // do we support Any operators?
+
+ bool tc_support_;
+ // do we support typecodes?
+
+ bool obv_opt_accessor_;
+ // do we optimize valuetype accessors?
+
+ bool gen_impl_files_;
+ // are we generating implementation files?
+
+ bool gen_impl_debug_info_;
+ // are we generating source file and line numbers for implementation files?
+
+ bool gen_copy_ctor_;
+ // are we generating the copy constructor?
+
+ bool gen_assign_op_;
+ // are we generating the assignment operator?
+
+ bool gen_thru_poa_collocation_;
+ // are we generating Thru_POA collocated stubs?
+
+ bool gen_direct_collocation_;
+ // are we generating Direct collocated stubs?
+
+ bool exception_support_;
+ // do we support real C++ exceptions (strict mapping) for stubs/skeletons?
+
+ bool use_raw_throw_;
+ // Another possible option if the above is TRUE.
+
+ bool opt_tc_;
+ // do we generate optimized typecodes?
+
+ bool ami_call_back_;
+ // Flag to indicate whether the AMI Call back feature of the
+ // Messaging specification should be enabled for the generated files
+ // or not.
+
+ bool gen_amh_classes_;
+ // Flag for generating AMH classes.
+
+ bool gen_tie_classes_;
+ // Flag to indicate whether we generate the tie classes and
+ // files or not.
+
+ bool gen_smart_proxies_;
+ // Flag to indicate whether smart proxies classes will be generated
+ // or not.
+
+ 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.
+
+ bool gen_dcps_type_support_;
+ // Flag to indicate whether we are supporting DDS DCPS type definitions.
+ // Includes Serializer operators (like TAO_Input/OutuptCDR).
+
+ bool gen_orb_h_include_;
+ // Flag to indicate whether ORB.h include should be generated, needed for
+ // regenerating the pidl files.
+
+ LOOKUP_STRATEGY lookup_strategy_;
+ // The enumerated value indicating the lookup strategy.
+
+ AST_PredefinedType *void_type_;
+ // Used for void operation return types.
+
+ be_interface *ccmobject_;
+ // Reference holder for component skeleton visitors.
+
+ be_module *messaging_;
+ // Storage for the messaging exceptions holder's virtual scope.
+
+ be_valuetype *messaging_exceptionholder_;
+ // Storage for exception holders' base class node.
+
+ be_valuetype *exceptionholder_;
+ // Reference holder for the exceptionholder.
+
+ be_interface *messaging_replyhandler_;
+ // Storage for the reply handlers' base class node.
+
+ bool gen_anyop_files_;
+ // Separate files for generated Any operators?
+
+ bool gen_skel_files_;
+ // True by default, but a command line option can turn this off so
+ // we generate only an empty *S.h file on the skeleton side.
+
+ bool gen_client_inline_;
+ // True by default, but a command line option can turn this off so
+ // that we don't generate a client inline file
+
+ bool gen_server_inline_;
+ // True by default, but a command line option can turn this off so
+ // that we don't generate a server inline file
+
+ bool gen_local_iface_anyops_;
+ // True by default, can be turned off by a command line option
+ // for regenerating internal ORB files.
+};
+
+#endif /* _BE_GLOBAL_H */
diff --git a/TAO/TAO_IDL/be_include/be_helper.h b/TAO/TAO_IDL/be_include/be_helper.h
new file mode 100644
index 00000000000..450d1c1a970
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_helper.h
@@ -0,0 +1,280 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_helper.h
+//
+// = DESCRIPTION
+// Defines the abstract class for outputting the C++ mapping. This is a
+// helper class to the singleton TAO_CodeGen class
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// Improvements by Carlos O'Ryan
+//
+// ============================================================================
+
+#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
+{
+ TAO_NL (void);
+};
+
+struct TAO_INDENT
+{
+ // = TITLE
+ // Operates like a manipulator, increasing the indentation level.
+ //
+ // = DESCRIPTION
+ // Increase the indentation level, if the "do_now" parameter is
+ // not zero then the <indent> method is called on the stream.
+ //
+ TAO_INDENT (int do_now = 0);
+
+ const int do_now_;
+};
+
+struct TAO_UNINDENT
+{
+ // = TITLE
+ // Operates like a manipulator, decreasing the indentation level.
+ //
+ // = DESCRIPTION
+ // Decrease the indentation level, if the "do_now" parameter is
+ // not zero then the <indent> method is called on the stream.
+ //
+ TAO_UNINDENT (int do_now = 0);
+
+ const int do_now_;
+};
+
+extern const TAO_NL be_nl;
+extern const TAO_INDENT be_idt;
+extern const TAO_INDENT be_idt_nl;
+extern const TAO_UNINDENT be_uidt;
+extern const TAO_UNINDENT be_uidt_nl;
+
+// A structure to inform TAO_OutStream's << operator to
+// conditionally output a newline and some form of "ACE_ENV_*".
+struct TAO_ENV_ARG
+{
+ TAO_ENV_ARG (bool with_defaults = false,
+ bool single = false,
+ bool arg = false,
+ bool not_used = false);
+
+ bool with_defaults_;
+ bool single_;
+ bool arg_;
+ bool not_used_;
+};
+
+extern const TAO_ENV_ARG env_decl;
+extern const TAO_ENV_ARG env_dflts;
+extern const TAO_ENV_ARG env_sngl;
+extern const TAO_ENV_ARG env_sngl_dflts;
+extern const TAO_ENV_ARG env_not;
+extern const TAO_ENV_ARG env_sngl_not;
+extern const TAO_ENV_ARG env_arg;
+extern const TAO_ENV_ARG env_sngl_arg;
+
+// A structure to inform TAO_OutStream's << operator to
+// conditionally output a newline and some form of "ACE_CHECK".
+struct TAO_ACE_CHECK
+{
+ TAO_ACE_CHECK (const char *retval = 0,
+ bool do_return = false);
+
+ const char *retval_;
+ bool do_return_;
+};
+
+// A dummy structure to inform TAO_OutStream's << operator to
+// conditionally output a newline and "ACE_TRY_CHECK".
+struct TAO_ACE_TRY_CHECK
+{
+ TAO_ACE_TRY_CHECK (void);
+};
+
+// A structure to inform TAO_OutStream's << operator to
+// conditionally output a newline and "ACE_ENDTRY.
+struct TAO_ACE_ENDTRY
+{
+ TAO_ACE_ENDTRY (void);
+};
+
+extern const TAO_ACE_TRY_CHECK ace_try_check;
+extern const TAO_ACE_ENDTRY ace_endtry;
+
+class TAO_OutStream
+{
+ // =TITLE
+ // TAO_OutStream
+ //
+ // =DESCRIPTION
+ // Defines an interface by which the backend code generator can
+ // print its output to the underlying I/O handle. This is a
+ // helper class that will be used by the TAO_CodeGen
+ // class. However, this is an abstract class and classes that
+ // understand specific front ends must derive from this class.
+public:
+
+ // Enumerated type to indicate the stream type
+ enum STREAM_TYPE
+ {
+ TAO_CLI_HDR,
+ TAO_CLI_INL,
+ TAO_CLI_IMPL,
+ TAO_SVR_HDR,
+ TAO_IMPL_HDR,
+ TAO_IMPL_SKEL,
+ TAO_SVR_TMPL_HDR,
+ TAO_SVR_INL,
+ TAO_SVR_TMPL_INL,
+ TAO_SVR_IMPL,
+ TAO_SVR_TMPL_IMPL,
+ TAO_GPERF_INPUT
+ };
+
+ TAO_OutStream (void);
+ // constructor.
+
+ virtual ~TAO_OutStream (void);
+ // destructor.
+
+ int open (const char *fname,
+ 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);
+ // set the stream type
+
+ TAO_OutStream::STREAM_TYPE stream_type (void);
+ // return the stream type
+
+ FILE *file (void);
+ // Return the underlying lowlevel file pointer.
+
+ 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);
+ // decrease the indentation level and by default actually indent the output
+ // accordingly
+
+ int reset (void);
+ // reset indentation level to 0
+
+ int indent (void);
+ // indent starting next line
+
+ int nl (void);
+ // put a newline and indent on the next line
+
+ int print (const char *format, ...);
+ // "printf" style variable argument print
+
+ int gen_ifdef_macro (const char *flat_name,
+ const char *suffix = 0,
+ bool add_stream_type_suffix = true);
+ // generate a #if !defined, #defined macro
+
+ int gen_endif (void);
+ // generate an endif statement
+
+ // =overloaded operators
+
+ TAO_OutStream &operator<< (const char *str);
+ // output the char string and return a reference to ourselves
+
+ TAO_OutStream &operator<< (const ACE_CDR::UShort num);
+ // output the integer and return a reference to ourselves
+
+ TAO_OutStream &operator<< (const ACE_CDR::Short num);
+ // output the integer and return a reference to ourselves
+
+ TAO_OutStream &operator<< (const ACE_CDR::ULong num);
+ // output the integer and return a reference to ourselves
+
+ TAO_OutStream &operator<< (const ACE_CDR::Long num);
+ // output the integer and return a reference to ourselves
+
+#if defined (ACE_WIN64)
+ TAO_OutStream &operator<< (const ACE_CDR::ULongLong num);
+ // output the integer and return a reference to ourselves
+
+ TAO_OutStream &operator<< (const ACE_CDR::LongLong num);
+ // output the integer and return a reference to ourselves
+#endif /* ACE_WIN64 */
+
+ TAO_OutStream &operator<< (const unsigned long num);
+ // output the integer and return a reference to ourselves
+
+ TAO_OutStream &operator<< (const long num);
+ // output the integer and return a reference to ourselves
+
+ // = MANIPULATORS
+
+ TAO_OutStream &operator<< (const TAO_NL& nl);
+ TAO_OutStream &operator<< (const TAO_INDENT& i);
+ TAO_OutStream &operator<< (const TAO_UNINDENT& i);
+
+ TAO_OutStream &operator<< (const TAO_ENV_ARG& i);
+ // Conditional and generic output for all forms of "ACE_ENV_*".
+
+ TAO_OutStream &operator<< (const TAO_ACE_CHECK& i);
+ // Conditional and generic output for all forms of "ACE_CHECK".
+
+ TAO_OutStream &operator<< (const TAO_ACE_TRY_CHECK& i);
+ // Conditional and generic output for all forms of "ACE_ENV_*".
+
+ TAO_OutStream &operator<< (const TAO_ACE_ENDTRY& i);
+ // Conditional and generic output for all forms of "ACE_CHECK".
+
+ // The following will be provided by specialized classes
+
+ TAO_OutStream &operator<< (Identifier *id);
+ // output an Identifier node
+
+ TAO_OutStream &operator<< (UTL_IdList *idl);
+ // output a scoped name
+
+ TAO_OutStream &operator<< (AST_Expression *expr);
+ // output an AST_Expression node
+
+ // provided by specialized classes
+ virtual TAO_OutStream &print (Identifier *id) = 0;
+
+ virtual TAO_OutStream &print (UTL_IdList *idl) = 0;
+
+ virtual TAO_OutStream &print (AST_Expression *idl) = 0;
+
+protected:
+ FILE *fp_;
+ // the underlying low-level I/O handle
+
+ TAO_OutStream::STREAM_TYPE st_;
+ // stream type
+
+ 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
new file mode 100644
index 00000000000..bde3d221124
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_interface.h
@@ -0,0 +1,463 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_interface.h
+//
+// = DESCRIPTION
+// Extension of class AST_Interface that provides additional means for C++
+// mapping of an interface.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale,
+// Michael Kircher
+//
+// ============================================================================
+
+#ifndef TAO_BE_INTERFACE_H
+#define TAO_BE_INTERFACE_H
+
+#include "be_scope.h"
+#include "be_type.h"
+#include "be_codegen.h"
+#include "ast_interface.h"
+
+class TAO_OutStream;
+class TAO_IDL_Inheritance_Hierarchy_Worker;
+class be_visitor;
+class be_interface_strategy;
+
+class UTL_ExceptList;
+
+class be_interface : public virtual AST_Interface,
+ public virtual be_scope,
+ public virtual be_type
+{
+ // = TITLE
+ // The back end extension of the AST_Interface class
+ //
+ // = DESCRIPTION
+ //
+public:
+ enum
+ {
+ THRU_POA = 0,
+ DIRECT = 1
+ };
+
+ // Used to pass functions to the template method.
+ typedef int (*tao_code_emitter) (be_interface *,
+ be_interface *,
+ TAO_OutStream *);
+
+ be_interface (void);
+ // Default constructor.
+
+ be_interface (UTL_ScopedName *n,
+ AST_Interface **ih,
+ long nih,
+ AST_Interface **ih_flat,
+ long nih_flat,
+ bool local,
+ bool abstract);
+ // Constructor that sets its scoped name <n>, a list of inherited interfaces
+ // <ih>, the number of inherited interfaces <nih>, and any prgmas <p>.
+
+ ~be_interface (void);
+ // Destructor.
+
+ be_interface_strategy *set_strategy (be_interface_strategy *new_strategy);
+ // Set the strategy to generate the names.
+
+ // Methods, which access the strategy.
+
+ const char *local_name (void) const;
+ // Return the local name.
+
+ virtual const char *full_name (void);
+ // Return the stringified full name.
+
+ virtual const char *flat_name (void);
+ // Return the flattened full scoped name.
+
+ virtual const char *repoID (void) const;
+ // Retrieve the repository ID.
+
+ const char *full_skel_name (void) const;
+ // Retrieve the fully scoped skel class name.
+
+ const char *full_coll_name (int) const;
+ // Retrieve the fully qualified collocated class name.
+
+ const char *local_coll_name (int) const;
+ // Retrieve the fully qualified collocated class name.
+
+ virtual const char *base_proxy_impl_name (void);
+ // retrieve the name of the base proxy implementation.
+
+ virtual const char *full_base_proxy_impl_name (void);
+ // retrieve the fully qualified name of the base proxy
+ // implementation.
+
+ virtual const char *remote_proxy_impl_name (void);
+ // retrieve the name of the remote proxy implementation.
+
+ virtual const char *full_remote_proxy_impl_name (void);
+ // retrieve the fully qualified name of the remote
+ // proxy implementation.
+
+ virtual const char *direct_proxy_impl_name (void);
+ // retrieve the name of the Directx proxy implementation.
+
+ virtual const char *full_direct_proxy_impl_name (void);
+ // retrieve the fully qualified name of the Directx proxy
+ // implementation.
+
+ virtual const char *base_proxy_broker_name (void);
+ // retrieve the name of the base proxy broker.
+
+ virtual const char *full_base_proxy_broker_name (void);
+ // retrieve the fully qualified name of the base proxy broker.
+
+ virtual const char *remote_proxy_broker_name (void);
+ // retrieve the name of the remote proxy broker implementation.
+
+ virtual const char *full_remote_proxy_broker_name (void);
+ // retrieve the fully qualified name of the remote proxy broker
+ // implementation.
+
+ virtual const char *strategized_proxy_broker_name (void);
+ // retrieve the name of the strategized proxy broker implementation.
+
+ virtual const char *full_strategized_proxy_broker_name (void);
+ // retrieve the fully qualified name of the strategized proxy broker
+ // implementation.
+
+ virtual const char *client_enclosing_scope (void);
+ // Return the client scope that encloses the interface.
+
+ virtual const char *flat_client_enclosing_scope (void);
+ // Return the "flattened" scope that encloses
+ // the interface.
+
+ virtual const char *server_enclosing_scope (void);
+ // Return the server scope that encloses the interface.
+
+ const char *relative_skel_name (const char *skel_name);
+ // Retrieve skeleton name.
+
+ void compute_full_skel_name (const char *prefix,
+ char *&skel_name);
+ // Build up the skeleton name.
+
+ static const char *relative_name (const char *localname,
+ const char *othername);
+
+ virtual void gen_def_ctors (TAO_OutStream* os);
+ // Call the default constructors of all the base classes.
+
+ virtual void gen_stub_ctor (TAO_OutStream* os);
+ // Generated the global hooks used for non-defined forward
+ // declared interfaces, and the contructor from stub object.
+
+ void gen_var_out_seq_decls (void);
+ // Generate the declarations used by the template _var, _out
+ // classes for interfaces, and by sequence template classes.
+
+ // Each interface (to fix names "T") also defines two help classes,
+ // the "collocated" class inherits from T, but delegates on the
+ // skeleton for T (usually POA_T or POA_ModuleName::T), in other
+ // words it is a Bridge from T to its implementation.
+ // The class is nested inside the skeleton class.
+ //
+ // The "stub" is a class defined on the client scope, it actually
+ // defines the stubs (all operations in T are pure virtual).
+ // @@ TODO currently the stub class is not implemented.
+ //
+
+ /// Iterate over the inheritance hierarchy and call the
+ /// worker->emit() method for each interface on it.
+ int traverse_inheritance_graph (
+ TAO_IDL_Inheritance_Hierarchy_Worker &worker,
+ TAO_OutStream *os,
+ bool abstract_paths_only = false
+ );
+
+ /// Wrap the @c gen parameter and call the generic version of
+ /// traverse_inheritance_graph()
+ int traverse_inheritance_graph (
+ tao_code_emitter gen,
+ TAO_OutStream *os,
+ bool abstract_paths_only = false
+ );
+
+ int in_mult_inheritance (void);
+ // Am I in some form of multiple inheritance
+ // -1 => error
+ // 0 => no
+ // 1 => yes
+
+ void in_mult_inheritance (int mi);
+ // Set a new value.
+
+ virtual void redefine (AST_Interface *from);
+ // Pass along BE-specific member values when redefining a fwd decl.
+
+ virtual void destroy (void);
+ // Cleanup function.
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+
+ // Narrowing.
+ DEF_NARROW_METHODS3 (be_interface, AST_Interface, be_scope, be_type);
+ DEF_NARROW_FROM_DECL (be_interface);
+ DEF_NARROW_FROM_SCOPE (be_interface);
+
+ static int is_a_helper (be_interface *,
+ be_interface *,
+ TAO_OutStream *os);
+ // Helper method passed to the template method that generates code for the
+ // is_a method.
+
+ static int ami_handler_gen_optable_helper (be_interface *,
+ be_interface *,
+ TAO_OutStream *os);
+ // Helper method passed to the template method to generate code for the
+ // operation table.
+
+ static int gen_skel_helper (be_interface *,
+ be_interface *,
+ TAO_OutStream *);
+ // Helper method passed to the template method to generate code for the
+ // skeletons in the header and inline files.
+
+ static int gen_colloc_op_decl_helper (be_interface *derived,
+ be_interface *ancestor,
+ TAO_OutStream *os);
+ // Helper method passed to the template method to generate code for the
+ // collocated functions in the header file.
+
+ static int gen_colloc_op_defn_helper (be_interface *derived,
+ be_interface *ancestor,
+ TAO_OutStream *os);
+ // Helper method passed to the template method to generate code for the
+ // collocated functions in the source file.
+
+ static int copy_ctor_helper (be_interface *,
+ be_interface *,
+ TAO_OutStream *os);
+ // Helper method passed to the template method to invoke ctors of all the
+ // base classes.
+
+ static int in_mult_inheritance_helper (be_interface *,
+ be_interface *,
+ TAO_OutStream *os);
+ // 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,
+ TAO_OutStream *os);
+
+ // Helper method to generate a call to the default
+ // 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 (const char *flat_name,
+ const char *skeleton_class_name);
+ // Generate the operation table including entries for inherited interfaces.
+
+ int gen_optable_entries (be_interface *derived_interface,
+ const char *full_skeleton_name,
+ TAO_OutStream *os);
+ // generate the operation table entries.
+
+ int convert_parent_ops (be_visitor *visitor);
+ // If we are local, regenerate non-local base class operations as
+ // pure virtual.
+
+ static void gen_collocated_skel_body (be_interface *derived,
+ be_interface *ancestor,
+ AST_Decl *d,
+ const char *prefix,
+ bool direct,
+ UTL_ExceptList *list,
+ TAO_OutStream *os);
+ // Common code called from gen_colloc_op_defn_helper().
+
+ void analyze_parentage (void);
+ // 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
+ // interfaces.
+
+ int has_extra_code_generation (TAO_CodeGen::CG_STATE current_state);
+ // Returns 1 if additional code needs to be generated, the behavior
+ // is driven by the strategy connected with this interface.
+
+ void original_interface (be_interface *original_interface);
+ // Sets the original interface from which this one was created,
+ // applies only to implied IDL.
+
+ be_interface *original_interface ();
+ // Returns the original interface from which this one was created,
+ // applies only to implied IDL
+
+ be_interface *replacement ();
+ // Returns an interface, which can be used instead.
+ // Needs to get set by the strategy.
+
+ int has_mixed_parentage (void);
+ // Do we have both abstract and concrete parents?
+
+ int session_component_child (void);
+ // Is Components::SessionComponent an immediate parent?
+
+ bool is_event_consumer (void);
+ // Is EventConsumerBase our parent?
+
+private:
+ void gen_gperf_input_header (TAO_OutStream *ss);
+ // Output the header (type declaration and %%) to the gperf's input
+ // file.
+
+ int gen_gperf_things (const char *flat_name);
+ // Run GPERF and get the correct lookup and other operations
+ // depending on which strategy we are using. Returns 0 on sucess, -1
+ // on error.
+
+ void gen_perfect_hash_class_definition (const char *flat_name);
+ // Outputs the class definition for the perfect hashing. This class
+ // will inherit from the TAO_Perfect_Hash_OpTable.
+
+ void gen_binary_search_class_definition (const char *flat_name);
+ // Outputs the class definition for the binary search . This class
+ // will inherit from the TAO_Binary_Search_OpTable.
+
+ void gen_linear_search_class_definition (const char *flat_name);
+ // Outputs the class defintion for the linear search. This class
+ // will inherit from the TAO_Linear_Search.
+
+ int gen_gperf_lookup_methods (const char *flat_name);
+ // This calls the GPERF program and gets the correct operation
+ // lookup methods for the current OpLookup strategy.
+
+ void gen_perfect_hash_instance (const char *flat_name);
+ // Create an instance of this perfect hash table.
+
+ void gen_binary_search_instance (const char *flat_name);
+ // Create an instance of the binary search optable.
+
+ void gen_linear_search_instance (const char *flat_name);
+ // Create an instance of the linear search optable.
+
+ static void gen_throw_spec (UTL_ExceptList *list,
+ TAO_OutStream *os);
+ // Helper for the helpers that generate collocated static
+ // base class methods.
+
+protected:
+ int var_out_seq_decls_gen_;
+ // Have these been done already?
+
+protected:
+ int skel_count_;
+ // Number of static skeletons in the operation table.
+
+ int in_mult_inheritance_;
+ // Am I directly or indirectly involved in a multiple inheritance. If the
+ // value is -1 => not computed yet.
+
+ be_interface_strategy *strategy_;
+ // 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
+
+ int has_mixed_parentage_;
+ // Do we have both abstract and concrete parents?
+
+ int session_component_child_;
+ // Are we a direct child of Components::SessionComponent?
+};
+
+/**
+ * @class TAO_IDL_Inheritance_Hierarcy_Worker
+ *
+ * @brief Implement the 'external form' of the iterator pattern for
+ * the interface inheritance hierarchy.
+ *
+ * Many components in the IDL compiler need to traverse the
+ * inheritance hierarchy for a particular interface, and generate code
+ * for each base class. The code to perform the traversal is
+ * encapsulated in be_interface, and this class defines the interface
+ * (in the C++ sense) that other IDL components must use to perform
+ * the work on each element on the hierarchy.
+ *
+ * This class is a relatively recent addition to the IDL compiler,
+ * originally just a pointer to function was used to customize the
+ * traversal algorithm. The class was added because we need to pass
+ * some state to some of the code emitters, thus a function is not
+ * good enough.
+ */
+class TAO_IDL_BE_Export TAO_IDL_Inheritance_Hierarchy_Worker
+{
+public:
+ /// Destructor
+ /**
+ * This is a no-op, simply put here to keep compilers happy.
+ */
+ virtual ~TAO_IDL_Inheritance_Hierarchy_Worker (void);
+
+ /// Define the method invoked during the inheritance traversal
+ /**
+ * This method is invoked for each base interface in the hierarchy.
+ *
+ * @param derived_interface Pointer to the most derived interface in
+ * the hierarchy, it remains constant during the complete traversal.
+ *
+ * @param output_stream The output stream that should be used to
+ * emit code.
+ *
+ * @param base_interface Pointer to the base interface in the
+ * hierarchy, it changes on each iteration.
+ *
+ * @return 0 if there was no error, -1 if there was one.
+ */
+ virtual int emit (be_interface *derived_interface,
+ TAO_OutStream *output_stream,
+ 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
new file mode 100644
index 00000000000..fd97a3329f3
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_interface_fwd.h
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_interface_fwd.h
+//
+// = DESCRIPTION
+// 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.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef BE_INTERFACE_FWD_H
+#define BE_INTERFACE_FWD_H
+
+#include "be_type.h"
+#include "ast_interface_fwd.h"
+
+class AST_Interface;
+class be_visitor;
+
+class be_interface_fwd : public virtual AST_InterfaceFwd,
+ public virtual be_type
+{
+ // =TITLE
+ // be_interface_fwd
+ //
+ // =DESCRIPTION
+ // Extensions to the AST_InterfaceFwd class
+public:
+ be_interface_fwd (void);
+ // Default constructor.
+
+ be_interface_fwd (AST_Interface *dummy,
+ UTL_ScopedName *n);
+ // Constructor.
+
+ virtual ~be_interface_fwd (void);
+ // Destructor.
+
+ virtual void seen_in_sequence (bool val);
+ virtual void seen_in_operation (bool val);
+ // Mutator overrides for be_type members. If we have been
+ // defined, we want the full definition to be set as well.
+
+ virtual void destroy (void);
+ // Cleanup function.
+
+ // Visiting.
+ virtual int accept (be_visitor* visitor);
+
+ // Narrowing.
+ DEF_NARROW_METHODS2 (be_interface_fwd, AST_InterfaceFwd, be_type);
+ DEF_NARROW_FROM_DECL (be_interface_fwd);
+};
+
+#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_interface_strategy.h b/TAO/TAO_IDL/be_include/be_interface_strategy.h
new file mode 100644
index 00000000000..b5c885ef3f7
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_interface_strategy.h
@@ -0,0 +1,416 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_interface_strategy.h
+//
+// = DESCRIPTION
+// Strategy to cover differences between operations, e.g.
+// the sendc_ and raise_ operations in the AMI spec.
+//
+// = AUTHOR
+// Michael Kircher
+//
+// ============================================================================
+
+#ifndef TAO_BE_INTERFACE_STRATEGY_H
+#define TAO_BE_INTERFACE_STRATEGY_H
+
+#include "be_codegen.h"
+
+class be_interface;
+
+// This class serves as a strategy base class for the differences
+// in generating e.g. ami reply handlers.
+
+class be_interface_strategy
+{
+public:
+ enum Strategy_Kind {
+ DEFAULT = 0,
+ AMI_INTERFACE,
+ AMI_HANDLER,
+ AMI_EXCEPTION_HOLDER
+ // AMH_INTERFACE
+ };
+
+ be_interface_strategy (be_interface *node,
+ Strategy_Kind strategy_type);
+
+ virtual ~be_interface_strategy (void);
+
+ virtual const char *local_name (void) = 0;
+ // return the local name
+
+ virtual const char *full_name (void) = 0;
+ // return the stringified full name
+
+ virtual const char *flat_name (void) = 0;
+ // return the flattened full scoped name.
+
+ virtual const char *repoID (void) = 0;
+ // retrieve the repository ID.
+
+ virtual const char *full_skel_name (void) = 0;
+ // retrieve the fully scoped skel class name.
+
+ virtual const char *full_coll_name (int) = 0;
+ // retrieve the fully qualified collocated class name
+
+ virtual const char *local_coll_name (int) = 0;
+ // retrieve the fully qualified collocated class name.
+
+ virtual const char *base_proxy_impl_name (void) = 0;
+ // retrieve the name of the base proxy implementation.
+
+ virtual const char *full_base_proxy_impl_name (void) = 0;
+ // retrieve the fully qualified name of the base proxy
+ // implementation.
+
+ virtual const char *remote_proxy_impl_name (void) = 0;
+ // retrieve the name of the remote proxy implementation.
+
+ virtual const char *full_remote_proxy_impl_name (void) = 0;
+ // retrieve the fully qualified name of the remote
+ // proxy implementation.
+
+ virtual const char *direct_proxy_impl_name (void) =0;
+ // retrieve the name of the Directx proxy implementation.
+
+ virtual const char *full_direct_proxy_impl_name (void) =0;
+ // retrieve the fully qualified name of the Directx proxy
+ // implementation.
+
+ virtual const char *base_proxy_broker_name (void) = 0;
+ // retrieve the name of the base proxy broker.
+
+ virtual const char *full_base_proxy_broker_name (void) = 0;
+ // retrieve the fully qualified name of the base proxy broker.
+
+ virtual const char *remote_proxy_broker_name (void) = 0;
+ // retrieve the name of the remote proxy broker implementation.
+
+ virtual const char *full_remote_proxy_broker_name (void) = 0;
+ // retrieve the fully qualified name of the remote proxy broker
+ // implementation.
+
+ virtual const char *strategized_proxy_broker_name (void) = 0;
+ // retrieve the name of the strategized proxy broker implementation.
+
+ virtual const char *full_strategized_proxy_broker_name (void) = 0;
+ // retrieve the fully qualified name of the strategized proxy broker
+ // implementation.
+
+ virtual const char *client_scope (void) = 0;
+ // Return the scope that encloses the client related
+ // interface.
+
+ virtual const char *flat_client_scope (void) = 0;
+ // Return the "flat" version of the scope
+ //that encloses the interface.
+
+ virtual const char *server_scope (void) = 0;
+ // Return the scope that encloses the server related
+ // interface.
+
+ virtual const char *flat_server_scope (void) = 0;
+ // Return the "flat" version of the scope
+ //that encloses the interface.
+
+
+ const char *relative_skel_name (const char *skel_name);
+ // relative skeleton name
+
+ const char* relative_name (const char *localname,
+ const char *othername);
+
+ void compute_names (const char* name,
+ const char* prefix,
+ const char* suffix,
+ char *&new_name);
+ // compute the names using the local prefix and suffix
+
+ void compute_coll_names (int type,
+ const char *prefix,
+ const char *suffix);
+ // compute the collocation names
+
+ virtual TAO_OutStream *get_out_stream (void);
+ // return the out stream depending on the strategy
+ // @@ Michael: Right now every strategy behaves
+ // the same way, but it might be in the future that we
+ // have to differentiate.
+
+ virtual const char *get_out_stream_fname (void);
+ // return the file name of the output stream.
+ // @@ Michael: Right now every strategy behaves the
+ // same way.
+
+ int strategy_type (void);
+ // Return the type of the strategy.
+
+ virtual TAO_CodeGen::CG_STATE next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state = 0
+ );
+ // Change the sate if necessary
+
+ virtual int has_extra_code_generation (
+ TAO_CodeGen::CG_STATE current_state
+ );
+
+ virtual be_interface *replacement (void);
+ // Returns the node, which is used instead of the original node,
+ // e.g. the reply handler to the actual node.
+
+ virtual void destroy (void);
+ // Cleanup.
+
+protected:
+ char *local_name_;
+
+ char *full_name_;
+
+ char *flat_name_;
+
+ char *repoID_;
+
+ char *full_skel_name_;
+
+ char *full_coll_name_;
+
+ char *local_coll_name_;
+
+ char *relative_skel_name_;
+
+ be_interface *node_;
+ // The node we strategize
+
+ int cached_type_;
+ // Current cached collocated name.
+
+ Strategy_Kind strategy_type_;
+ // The type of strategy
+};
+
+class be_interface_default_strategy
+ : public be_interface_strategy
+{
+public:
+ // begin overridden methods.
+ be_interface_default_strategy (be_interface *node,
+ Strategy_Kind strategy_type = DEFAULT);
+
+ virtual ~be_interface_default_strategy (void);
+
+ const char * local_name (void);
+ // return the local name
+
+ virtual const char *full_name (void);
+ // return the stringified full name
+
+ virtual const char *flat_name (void);
+ // return the flattened full scoped name.
+
+ virtual const char *repoID (void);
+ // retrieve the repository ID.
+
+ virtual const char *full_skel_name (void);
+ // retrieve the fully scoped skel class name.
+
+ virtual const char *full_coll_name (int);
+ // retrieve the fully qualified collocated class name
+
+ virtual const char *local_coll_name (int);
+ // retrieve the fully qualified collocated class name.
+
+ virtual const char *base_proxy_impl_name (void);
+ // retrieve the name of the base proxy implementation.
+
+ virtual const char *full_base_proxy_impl_name (void);
+ // retrieve the fully qualified name of the base proxy
+ // implementation.
+
+ virtual const char *remote_proxy_impl_name (void);
+ // retrieve the name of the remote proxy implementation.
+
+ virtual const char *full_remote_proxy_impl_name (void);
+ // retrieve the fully qualified name of the remote
+ // proxy implementation.
+
+ virtual const char *direct_proxy_impl_name (void);
+ // retrieve the name of the Directx proxy implementation.
+
+ virtual const char *full_direct_proxy_impl_name (void);
+ // retrieve the fully qualified name of the Directx proxy
+ // implementation.
+
+ virtual const char *base_proxy_broker_name (void);
+ // retrieve the name of the base proxy broker.
+
+ virtual const char *full_base_proxy_broker_name (void);
+ // retrieve the fully qualified name of the base proxy broker.
+
+ virtual const char *remote_proxy_broker_name (void);
+ // retrieve the name of the remote proxy broker implementation.
+
+ virtual const char *full_remote_proxy_broker_name (void);
+ // retrieve the fully qualified name of the remote proxy broker
+ // implementation.
+
+ virtual const char *strategized_proxy_broker_name (void);
+ // retrieve the name of the strategized proxy broker implementation.
+
+ virtual const char *full_strategized_proxy_broker_name (void);
+ // retrieve the fully qualified name of the strategized proxy broker
+ // implementation.
+
+ virtual const char *client_scope (void);
+ // Return the scope that encloses the client related
+ // interface.
+
+ virtual const char *flat_client_scope (void);
+ // Return the "flat" version of the scope
+ //that encloses the interface.
+
+ virtual const char *server_scope (void);
+ // Return the scope that encloses the server related
+ // interface.
+
+ virtual const char *flat_server_scope (void);
+ // Return the "flat" version of the scope
+ //that encloses the interface.
+
+ virtual void destroy (void);
+ // Cleanup.
+
+ // end of overridden methods
+
+protected:
+
+ char *create_with_prefix_suffix (const char *prefix,
+ const char *str,
+ const char *suffix,
+ const char *separator = "");
+ // create a new string made by the concatenation
+ // of "str" and "suffix" and using the
+ // "separator" to concatenate the two.
+
+
+
+protected:
+
+ enum Suffix_Code
+ {
+ PROXY_IMPL = 0,
+ PROXY_BROKER = 1
+ };
+
+ enum Tag_Code
+ {
+ REMOTE = 0,
+ THRU_POA = 1,
+ DIRECT = 2,
+ STRATEGIZED = 3,
+ GC_PREFIX = 4 // Prefix used for the generated class
+ // This prefix is used to avoid name conflicts
+ // with the user classes.
+ };
+
+
+
+ static const char *suffix_table_[];
+ static const char *tag_table_[];
+
+ // Proxy Implementation names.
+ char *base_proxy_impl_name_;
+ char *remote_proxy_impl_name_;
+ char *direct_proxy_impl_name_;
+
+ char *full_base_proxy_impl_name_;
+ char *full_remote_proxy_impl_name_;
+ char *full_direct_proxy_impl_name_;
+
+ // Proxy Broker Names.
+ char *base_proxy_broker_;
+ char *remote_proxy_broker_;
+ char *strategized_proxy_broker_;
+
+ char *full_base_proxy_broker_name_;
+ char *full_remote_proxy_broker_name_;
+ char *full_strategized_proxy_broker_name_;
+
+ char *client_scope_;
+ char *flat_client_scope_;
+
+ char *server_scope_;
+ char *flat_server_scope_;
+};
+
+
+class be_interface_ami_handler_strategy
+ : public be_interface_default_strategy
+{
+public:
+ be_interface_ami_handler_strategy (be_interface *node);
+
+ virtual ~be_interface_ami_handler_strategy (void);
+
+ // overridden methods.
+ virtual TAO_CodeGen::CG_STATE next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state = 0
+ );
+};
+
+
+class be_interface_ami_exception_holder_strategy
+ : public be_interface_default_strategy
+{
+public:
+ be_interface_ami_exception_holder_strategy (be_interface *node);
+
+ virtual ~be_interface_ami_exception_holder_strategy (void);
+
+ // overridden methods.
+ virtual 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
+ );
+};
+
+class be_interface_ami_strategy
+ : public be_interface_default_strategy
+{
+public:
+ be_interface_ami_strategy (be_interface *node,
+ be_interface *handler);
+
+ virtual ~be_interface_ami_strategy ();
+
+ // overridden methods.
+ virtual 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_interface *replacement (void);
+
+private:
+ be_interface *handler_;
+};
+
+#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_module.h b/TAO/TAO_IDL/be_include/be_module.h
new file mode 100644
index 00000000000..1c6801addef
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_module.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_module.h
+//
+// = DESCRIPTION
+// Extension of class AST_Module that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_MODULE_H
+#define _BE_MODULE_H
+
+#include "be_scope.h"
+#include "be_decl.h"
+#include "ast_module.h"
+
+class be_visitor;
+
+class be_module : public virtual AST_Module,
+ public virtual be_scope,
+ public virtual be_decl
+{
+public:
+ be_module (void);
+ // Default constructor.
+
+ be_module (UTL_ScopedName *n);
+ // Constructor.
+
+ virtual void destroy (void);
+ // Cleanup method.
+
+ // Visiting
+ virtual int accept (be_visitor *visitor);
+
+ // Narrowing.
+ DEF_NARROW_METHODS3 (be_module, AST_Module, be_scope, be_decl);
+ DEF_NARROW_FROM_DECL (be_module);
+ DEF_NARROW_FROM_SCOPE (be_module);
+};
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_native.h b/TAO/TAO_IDL/be_include/be_native.h
new file mode 100644
index 00000000000..453915d2aa5
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_native.h
@@ -0,0 +1,66 @@
+// $Id$
+
+// Id
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_native.h
+//
+// = DESCRIPTION
+// The native IDL type
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+
+#ifndef BE_NATIVE_H
+#define BE_NATIVE_H
+
+#include "be_exception.h"
+#include "ast_native.h"
+
+class be_visitor;
+
+// Representation of "native" IDL type. It may be used as a
+// return type, parameter type, or in an operation's
+// exception list. This last usage creates special problems
+// with both syntax checking and code generation. Letting
+// this class inherit from be_exception (similar to the
+// inheritance of AST_Native) is the most seamless
+// way to handle it, and does not affect the other use cases.
+class be_native : public virtual AST_Native,
+ public virtual be_exception
+{
+public:
+ be_native (void);
+ // Default constructor.
+
+ be_native (UTL_ScopedName *n);
+ // Constructor that initializes its scoped name.
+
+ virtual ~be_native (void) {}
+ // Destructor
+
+ virtual int gen_typecode (void);
+ // Generate the typecode description.
+
+ virtual long tc_size (void);
+ // Return typecode size.
+
+ virtual void destroy (void);
+ // Cleanup.
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+
+ // Narrowing.
+ DEF_NARROW_METHODS2(be_native, AST_Native, be_exception);
+ DEF_NARROW_FROM_DECL(be_native);
+};
+
+#endif /* BE_NATIVE_H */
diff --git a/TAO/TAO_IDL/be_include/be_operation.h b/TAO/TAO_IDL/be_include/be_operation.h
new file mode 100644
index 00000000000..49b837e3467
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_operation.h
@@ -0,0 +1,90 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_operation.h
+//
+// = DESCRIPTION
+// Extension of class AST_Operation that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef BE_OPERATION_H
+#define BE_OPERATION_H
+
+#include "be_scope.h"
+#include "be_decl.h"
+#include "be_codegen.h"
+#include "ast_operation.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,
+ public virtual be_decl
+{
+public:
+ be_operation (void);
+ // Default constructor.
+
+ be_operation (AST_Type *rt,
+ AST_Operation::Flags fl,
+ UTL_ScopedName *n,
+ bool local,
+ bool abstract);
+ // Constructor
+
+ ~be_operation (void);
+ // Destructor.
+
+ virtual void destroy (void);
+ // Cleanup method.
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+
+ be_operation_strategy *set_strategy (be_operation_strategy *new_strategy);
+
+ TAO_CodeGen::CG_STATE next_state (TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state = 0);
+ // Decide on the next state.
+
+ int has_extra_code_generation (TAO_CodeGen::CG_STATE current_state);
+ // Returns true if we have to genrate extra code.
+
+ 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.
+
+ 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.
+
+ // Narrowing
+ DEF_NARROW_METHODS3 (be_operation, AST_Operation, be_scope, be_decl);
+ DEF_NARROW_FROM_DECL (be_operation);
+ DEF_NARROW_FROM_SCOPE (be_operation);
+
+protected:
+ be_operation_strategy *strategy_;
+ // Member for holding the strategy for covering
+ // differences between various operations, e.g. sendc_, raise_
+ // operations in the AMI spec.
+};
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_operation_strategy.h b/TAO/TAO_IDL/be_include/be_operation_strategy.h
new file mode 100644
index 00000000000..fae1e18d483
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_operation_strategy.h
@@ -0,0 +1,210 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_operation_strategy.h
+//
+// = DESCRIPTION
+// Strategy to cover differences between operations, e.g.
+// the sendc_ and raise_ operations in the AMI spec.
+//
+// = AUTHOR
+// Michael Kircher
+//
+// ============================================================================
+
+#ifndef TAO_BE_OPERATION_STRATEGY_H
+#define TAO_BE_OPERATION_STRATEGY_H
+
+#include "be_codegen.h"
+
+class be_operation;
+
+// Base class for operation level strategies.
+class be_operation_strategy
+{
+public:
+ enum Strategy_Kind
+ {
+ DEFAULT = 0,
+ AMI_SENDC,
+ AMI_HANDLER_REPLY_STUB,
+ AMI_EXCEPTION_HOLDER_RAISE
+ };
+
+ be_operation_strategy (be_operation *node,
+ Strategy_Kind strategy_type);
+
+ virtual ~be_operation_strategy (void);
+
+ int strategy_type (void);
+ // 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 state if necessary.
+
+ virtual int has_extra_code_generation (TAO_CodeGen::CG_STATE current_state);
+ // Returns true if we have to genrate extra code.
+
+ 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 (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.
+
+ virtual be_operation_strategy *copy (void);
+ // Overrides return a deep copy.
+
+ virtual void destroy (void);
+ // Cleanup.
+
+protected:
+ be_operation *node_;
+ // The node we strategize.
+
+ Strategy_Kind strategy_type_;
+ // The type of strategy.
+};
+
+
+
+// Default (do nothing) strategy for operations.
+class be_operation_default_strategy
+ : public be_operation_strategy
+{
+public:
+ be_operation_default_strategy (be_operation *node);
+
+ virtual ~be_operation_default_strategy (void);
+
+ // Overridden methods.
+ TAO_CodeGen::CG_STATE next_state (TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state = 0);
+
+ virtual be_operation_strategy *copy (void);
+ // Returns a deep copy.
+};
+
+
+// Strategy to mark normal reply handler operations
+// in order to have them generate the reply stub
+// 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 (void);
+
+ // 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.
+
+ virtual be_operation_strategy *copy (void);
+ // Returns a deep copy.
+};
+
+
+// Strategy to mark normal sendc_ operations
+// in AMI mode.
+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 (void);
+
+ // 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.
+
+ 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 (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.
+
+ virtual be_operation_strategy *copy (void);
+ // Returns a deep copy.
+
+ virtual void destroy (void);
+ // Cleanup.
+
+private:
+ be_operation *marshaling_;
+ be_operation *arguments_;
+ bool owns_operations_;
+};
+
+
+// Strategy for raise operations in the AMI exception
+// holder valuetype.
+class be_operation_ami_exception_holder_raise_strategy
+ : public be_operation_strategy
+{
+public:
+ be_operation_ami_exception_holder_raise_strategy (be_operation *node);
+
+ 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
+ );
+
+ virtual be_operation_strategy *copy (void);
+ // Returns a deep copy.
+};
+
+
+// AMH strategy.
+class be_operation_amh_strategy
+ : public be_operation_strategy
+{
+public:
+ be_operation_amh_strategy (be_operation *node);
+
+ virtual ~be_operation_amh_strategy (void);
+
+ // 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 (void);
+
+ virtual be_operation_strategy *copy (void);
+ // Returns a deep copy.
+
+private:
+ be_operation *arguments_;
+};
+
+#endif // TAO_BE_OPERATION_STRATEGY_H
diff --git a/TAO/TAO_IDL/be_include/be_predefined_type.h b/TAO/TAO_IDL/be_include/be_predefined_type.h
new file mode 100644
index 00000000000..57ae1a7a62a
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_predefined_type.h
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_predefined_type.h
+//
+// = DESCRIPTION
+// Extension of class AST_PredefinedType that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_PREDEFINED_TYPE_H
+#define _BE_PREDEFINED_TYPE_H
+
+#include "be_type.h"
+#include "ast_predefined_type.h"
+
+class be_visitor;
+
+class be_predefined_type : public virtual AST_PredefinedType,
+ public virtual be_type
+{
+public:
+ be_predefined_type (void);
+ // Default constructor.
+
+ be_predefined_type (AST_PredefinedType::PredefinedType t,
+ UTL_ScopedName *n);
+ // Constructor.
+
+ // 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 void compute_tc_name (void);
+ // Overridden method.
+
+ // Compute and return the value.
+
+ virtual void compute_repoID (void);
+ // The object and TypeCode repository IDs have a mandatory omg.org
+ // prefix, but the default compute_repoID() uses the #pragma's to
+ // obtain prefixes.
+};
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_root.h b/TAO/TAO_IDL/be_include/be_root.h
new file mode 100644
index 00000000000..c9c01113bad
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_root.h
@@ -0,0 +1,68 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_root.h
+//
+// = DESCRIPTION
+// Extension of class AST_Root that provides the backend
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_ROOT_H
+#define TAO_BE_ROOT_H
+
+#include "be_decl.h"
+#include "be_scope.h"
+#include "ast_root.h"
+
+class be_visitor;
+
+class be_root : public virtual AST_Root,
+ public virtual be_scope,
+ public virtual be_decl
+{
+ // = TITLE
+ // The back end extension of the AST_Root class
+ //
+ // = DESCRIPTION
+ //
+public:
+ be_root (void);
+ // Default constructor.
+
+ be_root (UTL_ScopedName *n);
+ // Constructor that sets its scoped name <n>, and any pragmas <p>.
+
+ virtual ~be_root (void);
+
+ // Scope management functions that override the AST scope management methods
+ // since the AST methods set the names of the sequences, strings, and arrays
+ // to a fixed value which interferes with our back-end code generation.
+ AST_Sequence *fe_add_sequence (AST_Sequence *);
+ AST_String *fe_add_string (AST_String *);
+ AST_Array *fe_add_array (AST_Array *);
+
+ virtual void destroy (void);
+ // Cleanup method.
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+
+ // Narrowing.
+ DEF_NARROW_METHODS3 (be_root, AST_Root, be_scope, be_decl);
+ DEF_NARROW_FROM_DECL (be_root);
+ DEF_NARROW_FROM_SCOPE (be_root);
+};
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_scope.h b/TAO/TAO_IDL/be_include/be_scope.h
new file mode 100644
index 00000000000..c8fcaa78f7f
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_scope.h
@@ -0,0 +1,73 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_scope.h
+//
+// = DESCRIPTION
+// Extension of the UTL_Scope CFE class
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_SCOPE_H
+#define TAO_BE_SCOPE_H
+
+#include "utl_scope.h"
+#include "ast_decl.h"
+
+class be_decl;
+class be_visitor;
+
+class be_scope : public virtual UTL_Scope
+{
+ // = TITLE
+ // be_scope
+ //
+ // = DESCRIPTION
+ // The back end extension of the UTL_Scope class
+ //
+public:
+ be_scope (void);
+ // Default constructor.
+
+ be_scope (AST_Decl::NodeType nt);
+ // Constructor that sets the node type.
+
+ virtual ~be_scope (void);
+ // Destructor.
+
+ virtual void comma (unsigned short set);
+ // Set the comma producing state.
+
+ int comma (void) const;
+ // Get the comma producing state.
+
+ virtual be_decl *decl (void);
+ // Return the be_decl node corresponding to this scope node.
+
+ virtual void destroy (void);
+ // Recursively clean up scope members.
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1 (be_scope, UTL_Scope);
+ DEF_NARROW_FROM_SCOPE (be_scope);
+
+private:
+ unsigned short comma_;
+ // If set, generate a comma after every element is handled.
+};
+
+#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_sequence.h b/TAO/TAO_IDL/be_include/be_sequence.h
new file mode 100644
index 00000000000..8a4f21fb3d9
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_sequence.h
@@ -0,0 +1,124 @@
+// -*- C++ -*-
+
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_sequence.h
+//
+// = DESCRIPTION
+// Extension of class AST_Sequence that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef BE_SEQUENCE_H
+#define BE_SEQUENCE_H
+
+#include "be_scope.h"
+#include "be_type.h"
+#include "ast_sequence.h"
+
+class AST_Expression;
+class AST_Type;
+class be_visitor;
+class be_typedef;
+class be_field;
+
+// A sequence in OMG IDL does not define a scoping construct just as a struct
+// or union or an interface do. However, in the C++ mapping, a sequence becomes
+// a class. If the base type of a sequence is another anonymous sequence, then
+// the base type is defined in the scope of this sequence. Hence we define
+// be_sequence to possess the additional characteristics of a scope.
+class be_sequence : public virtual AST_Sequence,
+ public virtual be_scope,
+ public virtual be_type
+{
+public:
+ enum MANAGED_TYPE
+ {
+ MNG_UNKNOWN,
+ MNG_NONE,
+ MNG_STRING,
+ MNG_WSTRING,
+ MNG_OBJREF,
+ MNG_VALUE,
+ MNG_PSEUDO
+ };
+
+ be_sequence (void);
+ // Default constructor.
+
+ be_sequence (AST_Expression *v,
+ AST_Type *bt,
+ UTL_ScopedName *n,
+ bool local,
+ bool abstract);
+ // Constructor.
+
+ virtual int create_name (be_typedef *node);
+ // 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.
+
+ virtual MANAGED_TYPE managed_type (void);
+ // Return the managed type.
+
+ // Scope management functions.
+ virtual AST_Sequence *fe_add_sequence (AST_Sequence *);
+
+ virtual be_decl *decl (void);
+ // Overridden method on the be_scope class.
+
+ virtual void destroy (void);
+ // Cleanup method.
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+
+ // Narrowing.
+ DEF_NARROW_METHODS3 (be_sequence, AST_Sequence, be_scope, be_type);
+ DEF_NARROW_FROM_DECL (be_sequence);
+
+ const char *instance_name (void);
+ // Report the instance name for instantiation.
+
+ int gen_base_class_name (TAO_OutStream *os,
+ const char * linebreak,
+ AST_Decl *elem_scope);
+ // Common code for generating the name and parameters of our
+ // template sequence base class.
+
+ be_field *field_node (void) const;
+ void field_node (be_field *node);
+ // Accessors for the member.
+
+ virtual char *gen_name (void);
+ // Helper to create_name, also used by the traits visitor.
+
+protected:
+
+ virtual void compute_tc_name (void);
+ // Computes the fully scoped typecode name.
+
+private:
+ const char *smart_fwd_helper_name (AST_Decl *elem_scope,
+ be_type *elem);
+
+private:
+ MANAGED_TYPE mt_;
+ // Our managed type.
+
+ be_field *field_node_;
+ // Used if we are an anonymous member, to help generate a unique name.
+};
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_stream_factory.h b/TAO/TAO_IDL/be_include/be_stream_factory.h
new file mode 100644
index 00000000000..661342632c5
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_stream_factory.h
@@ -0,0 +1,61 @@
+// $Id$
+
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL Backend
+//
+// = FILENAME
+// be_factory.h
+//
+// = DESCRIPTION
+// Defines a factory that returns a specialized output stream object that
+// understands a specific Front End
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_FACTORY_H
+#define TAO_BE_FACTORY_H
+
+#include "ace/Singleton.h"
+#include "ace/Synch_Traits.h"
+
+class TAO_OutStream;
+
+class TAO_OutStream_Factory
+{
+ // =TITLE
+ // TAO_OutStream_Factory
+ // =DESCRIPTION
+ // factory to produce specialized instances of the output stream objects
+public:
+ enum TAO_OutStream_Type
+ {
+ TAO_SUNSOFT,
+ TAO_FLICK
+ };
+
+ TAO_OutStream_Factory (void);
+ // constructor
+
+ ~TAO_OutStream_Factory (void);
+ // destructor
+
+ TAO_OutStream *make_outstream (void);
+ // make the specialized out stream class
+
+ int set_stream_type (TAO_OutStream_Type t);
+ // set the stream type
+
+private:
+ TAO_OutStream_Type strm_type_;
+};
+
+typedef ACE_Singleton<TAO_OutStream_Factory, ACE_SYNCH_RECURSIVE_MUTEX> TAO_OUTSTREAM_FACTORY;
+// Singleton instance of the OutStream factory
+
+#endif /* if !defined _TAO_BE_FACTORY_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_string.h b/TAO/TAO_IDL/be_include/be_string.h
new file mode 100644
index 00000000000..b13c4218ded
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_string.h
@@ -0,0 +1,59 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_string.h
+//
+// = DESCRIPTION
+// Extension of class AST_String that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef BE_STRING_H
+#define BE_STRING_H
+
+#include "be_type.h"
+#include "ast_string.h"
+
+class AST_Expression;
+class be_visitor;
+
+class be_string : public virtual AST_String,
+ public virtual be_type
+{
+public:
+ be_string (void);
+ // Default constructor.
+
+ 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);
+
+protected:
+ virtual void compute_tc_name (void);
+ // Overridden method to compute typecode name.
+};
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_structure.h b/TAO/TAO_IDL/be_include/be_structure.h
new file mode 100644
index 00000000000..61e5646d95a
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_structure.h
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_structure.h
+//
+// = DESCRIPTION
+// Extension of class AST_Structure that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef BE_STRUCTURE_H
+#define BE_STRUCTURE_H
+
+#include "be_scope.h"
+#include "be_type.h"
+#include "ast_structure.h"
+
+class be_visitor;
+
+class be_structure : public virtual AST_Structure,
+ public virtual be_scope,
+ public virtual be_type
+{
+public:
+ be_structure (void);
+ // Default constructor.
+
+ be_structure (UTL_ScopedName *n,
+ bool local,
+ bool abstract);
+ // Constructor.
+
+ virtual void redefine (AST_Structure *from);
+ // Copy BE-specific values when redefining struct or union
+ // from a forward declaration.
+
+ virtual void destroy (void);
+ // Cleanup method.
+
+ virtual int accept (be_visitor *visitor);
+ // Visiting.
+
+ AST_Field *be_add_field (AST_Field *f);
+ // To access the protected base class method fe_add_field.
+
+ // Narrowing.
+ DEF_NARROW_METHODS3 (be_structure, AST_Structure, be_scope, be_type);
+ DEF_NARROW_FROM_DECL (be_structure);
+ DEF_NARROW_FROM_SCOPE (be_structure);
+};
+
+#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..f1fd43c0e99
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_structure_fwd.h
@@ -0,0 +1,60 @@
+/* -*- 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;
+
+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 (AST_Structure *dummy,
+ 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_sunsoft.h b/TAO/TAO_IDL/be_include/be_sunsoft.h
new file mode 100644
index 00000000000..a44633f5395
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_sunsoft.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_sunsoft.h
+//
+// = DESCRIPTION
+// SunSoft specific backend output generation
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_HELPER_H
+#define TAO_BE_HELPER_H
+
+#include "be_helper.h"
+
+class TAO_SunSoft_OutStream : public TAO_OutStream
+{
+ // =TITLE
+ // TAO_SunSoft_OutStream
+ // =DESCRIPTION
+ // Backend specific to SunSoft AST nodes
+public:
+ TAO_SunSoft_OutStream (void);
+ // constructor
+
+ ~TAO_SunSoft_OutStream (void);
+ // destuctor
+
+ virtual TAO_OutStream &print (Identifier *id);
+ // output the SunSoft IDL Identifier Node
+
+ virtual TAO_OutStream &print (UTL_IdList *idl);
+ // output the SunSoft IDL UTL_IdList Node which is usually used to maintain a
+ // scoped name
+
+ virtual TAO_OutStream &print (AST_Expression *expr);
+ // output the contents of the AST_Expression node
+};
+
+#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_type.h b/TAO/TAO_IDL/be_include/be_type.h
new file mode 100644
index 00000000000..01a4ad065c9
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_type.h
@@ -0,0 +1,110 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_type.h
+//
+// = DESCRIPTION
+// Extension of class AST_Type that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef BE_TYPE_H
+#define BE_TYPE_H
+
+#include "be_decl.h"
+#include "ast_type.h"
+
+#include "ace/SString.h"
+
+class TAO_OutStream;
+
+class be_type : public virtual AST_Type,
+ public virtual be_decl
+{
+public:
+ be_type (void);
+ // Default constructor.
+
+ be_type (AST_Decl::NodeType nt,
+ UTL_ScopedName *n);
+ // Constructor.
+
+ virtual ~be_type (void);
+ // Destructor.
+
+ UTL_ScopedName *tc_name (void);
+ // Return the typecode name. When both, the prefix and the suffix
+ // are non null, it computes and returns a tc name. Else, it also
+ // stores the result in a member variable.
+
+ virtual const char *nested_sp_type_name (be_decl *use_scope,
+ const char *suffix = 0,
+ const char *prefix = 0);
+ // Type name of a node used when generating declarations for smart
+ // proxies.
+
+ void gen_fwd_helper_name (void);
+
+ const char *fwd_helper_name (void) const;
+ void fwd_helper_name (const char *name);
+ // Accessor to the member.
+
+ void gen_common_varout (TAO_OutStream *os);
+ // Generate _var and _out typedefs for structs and unions.
+
+ bool seen_in_sequence (void) const;
+ virtual void seen_in_sequence (bool val);
+ // Accessors for the member.
+
+ bool seen_in_operation (void) const;
+ virtual void seen_in_operation (bool val);
+ // Accessors for the member.
+
+ virtual AST_Decl::NodeType base_node_type (void) const;
+ // Typedefs are tricky to handle, in many points their mapping
+ // depend on base type they are aliasing. Since typedefs can be
+ // recursive simply using "base_type->node_type()" will not work, so
+ // the most "unaliased" type is needed.
+
+ virtual void destroy (void);
+ // Clean up allocated members.
+
+ // Visiting.
+ virtual int accept (be_visitor* visitor);
+
+ // Narrowing.
+ DEF_NARROW_METHODS2 (be_type, AST_Type, be_decl);
+ DEF_NARROW_FROM_DECL (be_type);
+
+protected:
+ virtual void compute_tc_name (void);
+ // Computes the fully scoped typecode name.
+
+ UTL_ScopedName *tc_name_;
+ // Typecode name.
+
+ ACE_CString fwd_helper_name_;
+ // Used by interfaces, valuetypes and arrays to name helper structs.
+
+ bool common_varout_gen_;
+ // Have we generated our _var and _out class typedefs yet?
+
+ bool seen_in_sequence_;
+ // Has this declaration been used as a sequence element?
+
+ bool seen_in_operation_;
+ // Has this declaration been used as a return type or parameter?
+};
+
+#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
new file mode 100644
index 00000000000..4cd0dd7e029
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_typedef.h
@@ -0,0 +1,68 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_typedef.h
+//
+// = DESCRIPTION
+// Extension of class AST_typedef that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef BE_TYPEDEF_H
+#define BE_TYPEDEF_H
+
+#include "be_type.h"
+#include "ast_typedef.h"
+
+class be_visitor;
+
+class be_typedef : public virtual AST_Typedef,
+ public virtual be_type
+{
+public:
+ be_typedef (void);
+ // Default constructor.
+
+ be_typedef (AST_Type *bt,
+ UTL_ScopedName *n,
+ bool l,
+ bool a);
+ // Constructor.
+
+ virtual void seen_in_sequence (bool val);
+ virtual bool seen_in_operation (void) const;
+ virtual void seen_in_operation (bool val);
+ // Overrides for be_type members. If we have been
+ // defined, we want the underlying type to be set as well.
+
+ be_type *primitive_base_type (void);
+ // Return the most primitive base type by traversing the chain of typedefed
+ // base types.
+
+ virtual AST_Decl::NodeType base_node_type (void) const;
+ // Return the most "unaliased" type node for the base type (see
+ // be_type.h).
+
+ virtual void destroy (void);
+ // Cleanup function.
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+
+ // Narrowing.
+ DEF_NARROW_METHODS2 (be_typedef, AST_Typedef, be_type);
+ DEF_NARROW_FROM_DECL (be_typedef);
+};
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_union.h b/TAO/TAO_IDL/be_include/be_union.h
new file mode 100644
index 00000000000..7ebe974875a
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_union.h
@@ -0,0 +1,72 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_union.h
+//
+// = DESCRIPTION
+// Extension of class AST_Union that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef BE_UNION_H
+#define BE_UNION_H
+
+#include "be_type.h"
+#include "be_scope.h"
+#include "ast_union.h"
+
+class AST_ConcreteType;
+class be_visitor;
+
+class be_union : public virtual AST_Union,
+ public virtual be_scope,
+ public virtual be_type
+{
+public:
+ be_union (void);
+ // Default constructor.
+
+ be_union (AST_ConcreteType *dt,
+ UTL_ScopedName *n,
+ bool local,
+ bool abstract);
+ // Constructor.
+
+ virtual void redefine (AST_Structure *from);
+ // Catch BE-specific member values before delegating to the base class.
+
+ virtual bool has_duplicate_case_labels (void);
+ // Do we have at least one member with multiple case labels?
+
+ virtual void destroy (void);
+ // Cleanup function.
+
+ virtual int accept (be_visitor *visitor);
+ // Visiting.
+
+ bool gen_empty_default_label (void);
+ // Decides whether a default switch case label in the generated copy
+ // constructor, assignment operator, etc. is needed.
+
+ unsigned long nlabels (void);
+ // Returns total number of labels, useful when the union has
+ // multiple case labels.
+
+ // Narrowing.
+ DEF_NARROW_METHODS3 (be_union, AST_Union, be_scope, be_type);
+ DEF_NARROW_FROM_DECL(be_union);
+ DEF_NARROW_FROM_SCOPE(be_union);
+};
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_union_branch.h b/TAO/TAO_IDL/be_include/be_union_branch.h
new file mode 100644
index 00000000000..c5de60dd2c7
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_union_branch.h
@@ -0,0 +1,65 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_union_branch.h
+//
+// = DESCRIPTION
+// Extension of class AST_UnionBranch that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef BE_UNION_BRANCH_H
+#define BE_UNION_BRANCH_H
+
+#include "be_decl.h"
+#include "ast_union_branch.h"
+
+class UTL_LabelList;
+class AST_Type;
+class be_visitor;
+class TAO_OutStream;
+class be_union;
+
+class be_union_branch : public virtual AST_UnionBranch,
+ public virtual be_decl
+{
+public:
+ be_union_branch (void);
+ // default constructor.
+
+ be_union_branch (UTL_LabelList *ll,
+ AST_Type *ft,
+ UTL_ScopedName *n);
+ // Constructor.
+
+ int gen_label_value (TAO_OutStream *os,
+ unsigned long index = 0);
+ // Generate the label value (as in a switch/case statement).
+
+ int gen_default_label_value (TAO_OutStream *os,
+ be_union *bu);
+ // Generate the default label value (as in a switch/case statement).
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS2 (be_union_branch, AST_UnionBranch, be_decl);
+ DEF_NARROW_FROM_DECL (be_union_branch);
+};
+
+#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..1303e345e9d
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_union_fwd.h
@@ -0,0 +1,59 @@
+/* -*- 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_structure_fwd.h"
+#include "ast_union_fwd.h"
+
+class be_visitor;
+
+class be_union_fwd : public virtual AST_UnionFwd,
+ public virtual be_structure_fwd
+{
+ // =TITLE
+ // be_union_fwd
+ //
+ // =DESCRIPTION
+ // Extensions to the AST_UnionFwd class
+public:
+ be_union_fwd (void);
+ // Default constructor.
+
+ be_union_fwd (AST_Union *dummy,
+ 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_structure_fwd);
+ DEF_NARROW_FROM_DECL (be_union_fwd);
+};
+
+#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_union_label.h b/TAO/TAO_IDL/be_include/be_union_label.h
new file mode 100644
index 00000000000..f115041e10e
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_union_label.h
@@ -0,0 +1,27 @@
+// $Id$
+
+#ifndef BE_UNION_LABEL_H
+#define BE_UNION_LABEL_H
+
+#include "ast_union_label.h"
+
+class be_visitor;
+
+class be_union_label : public virtual AST_UnionLabel
+{
+public:
+ be_union_label (void);
+ // Default constructor.
+
+ be_union_label (AST_UnionLabel::UnionLabel ul,
+ AST_Expression *v);
+ // Constructor.
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
+};
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_util.h b/TAO/TAO_IDL/be_include/be_util.h
new file mode 100644
index 00000000000..f1ccf03a08f
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_util.h
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_util.h
+//
+// = DESCRIPTION
+// Static helper methods used by multiple visitors.
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+#ifndef TAO_BE_UTIL_H
+#define TAO_BE_UTIL_H
+
+#include "be_helper.h"
+#include "be_module.h"
+
+class be_util
+{
+ public:
+ static void gen_nested_namespace_begin (TAO_OutStream *os, be_module *node);
+
+ static void gen_nested_namespace_end (TAO_OutStream *os, be_module *node);
+
+};
+
+
+#endif // if !defined
+
diff --git a/TAO/TAO_IDL/be_include/be_valuebox.h b/TAO/TAO_IDL/be_include/be_valuebox.h
new file mode 100644
index 00000000000..e9d485438ec
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_valuebox.h
@@ -0,0 +1,51 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_valuebox.h
+//
+// = DESCRIPTION
+// Extension of class AST_Valuebox that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+#ifndef TAO_BE_VALUEBOX_H
+#define TAO_BE_VALUEBOX_H
+
+#include "ast_valuebox.h"
+#include "be_type.h"
+
+class AST_Type;
+class be_visitor;
+
+class be_valuebox : public virtual AST_ValueBox,
+ public virtual be_type
+{
+public:
+ be_valuebox (void);
+ // Default constructor.
+
+ be_valuebox ( AST_Type *boxed_type,
+ UTL_ScopedName *n );
+ // Constructor.
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+ // Narrowing
+ DEF_NARROW_METHODS2 (be_valuebox, AST_ValueBox, be_type);
+ DEF_NARROW_FROM_DECL (be_valuebox);
+};
+
+#endif /* TAO_BE_VALUEBOX_H */
diff --git a/TAO/TAO_IDL/be_include/be_valuetype.h b/TAO/TAO_IDL/be_include/be_valuetype.h
new file mode 100644
index 00000000000..9acbfe5ebb7
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_valuetype.h
@@ -0,0 +1,193 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_valuetype.h
+//
+// = DESCRIPTION
+// Extension of class AST_Interface and be_interface that provides
+// additional means for C++ mapping of an valuetype.
+//
+// ============================================================================
+
+#ifndef TAO_BE_VALUETYPE_H
+#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,
+ public virtual AST_ValueType
+{
+ // = TITLE
+ // Backend-class for valuetypes
+ //
+ // = DESCRIPTION
+ // Extends be_interface and overrides member functions for valuetype
+ // mapping.
+ //
+public:
+ be_valuetype (void);
+ // Default constructor.
+
+ be_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,
+ bool abstract,
+ bool truncatable,
+ bool custom);
+ // Constructor that sets its scoped name <n>, a list of inherited valuetypes
+ // and supported interfaces <ih>, and the number of inherited interfaces <nih>
+
+ ~be_valuetype (void);
+ // Destructor.
+
+ virtual void redefine (AST_Interface *from);
+
+ bool opt_accessor (void);
+ // Should generate optimized form?
+
+ virtual int gen_helper_header (char *local_name = 0,
+ char *full_name = 0);
+ // Generate the helper functions definition.
+
+ virtual int gen_helper_inline (char *local_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);
+ // Generate the helper functions implementation.
+
+ void gen_var_out_seq_decls (void);
+ // Generate the declarations used by the template _var, _out
+ // classes for valuetypes, and by sequence template classes.
+
+ const char *full_obv_skel_name (void);
+ // Retrieve the fully scoped skel class name.
+
+ const char *field_pd_prefix (void);
+
+ const char *field_pd_postfix (void);
+
+ // 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,
+ bool use_abstract_paths = true,
+ bool use_concrete_paths = true
+ );
+
+ /// 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
+ );
+
+ 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_METHODS2 (be_valuetype, be_interface, AST_ValueType);
+ DEF_NARROW_FROM_DECL (be_valuetype);
+ DEF_NARROW_FROM_SCOPE (be_valuetype);
+
+ void compute_fullobvskelname (void);
+ // Compute the fully scoped skel class name.
+
+ ACE_CDR::ULong data_members_count (
+ AST_Field::Visibility vis = AST_Field::vis_NA
+ );
+ // Compute the count of private/public/all data members.
+
+ virtual bool in_recursion (ACE_Unbounded_Queue<AST_Type *> &list);
+ // 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_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.
+
+ const char *fwd_helper_name (void) const;
+ // Accessor to the member.
+
+ // There are three possible situations.
+ // (1) If there is no initializers but at least one operation.
+ // In this case we don't need to bother about factory.
+ //
+ // (2) There are no (operations or initializers) (i.e. only state
+ // members) then we need a concrete type-specific factory
+ // class whose create_for_unmarshal creates OBV_ class.
+ //
+ // (3) There is at least one operation and at least one initializer.
+ // In this case we need to generate abstract factory class.
+ //
+ // Here I reflect these situations.
+ enum FactoryStyle
+ {
+ FS_UNKNOWN,
+ FS_NO_FACTORY,
+ FS_CONCRETE_FACTORY,
+ FS_ABSTRACT_FACTORY
+ };
+
+ FactoryStyle determine_factory_style (void);
+ // Determine what kind of factory needed.
+
+ bool have_operation (void);
+ // Recurse down the inheritance tree to determine
+ // if valuetype has at least one operation/attribute.
+
+ static bool have_supported_op (be_interface *node);
+ // Check if VT supports an interface with at least 1 operation.
+
+ virtual bool will_have_factory (void);
+ // Use the above enum and methods to determine this after the
+ // node's scope is visited but before code generation.
+
+ bool has_member (void);
+ // Decides whether to generate the initializing contstructor or not.
+
+private:
+ char *full_obv_skel_name_;
+
+ bool supports_abstract_;
+ // Do we support at least one abstract interface?
+
+ int var_out_seq_decls_gen_;
+ // Have these been done already?
+};
+
+#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
new file mode 100644
index 00000000000..ddefb273047
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_valuetype_fwd.h
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_valuetype_fwd.h
+//
+// = DESCRIPTION
+// Extension of class AST_Interface_Fwd that provides additional
+// means for C++ mapping of a valuetype.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Aniruddha Gokhale,
+// changed for valuetypes from Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+//
+// ============================================================================
+
+#ifndef BE_VALUETYPE_FWD_H
+#define BE_VALUETYPE_FWD_H
+
+#include "be_interface_fwd.h"
+#include "ast_valuetype_fwd.h"
+
+class be_valuetype_fwd : public virtual be_interface_fwd,
+ public virtual AST_ValueTypeFwd
+{
+ // =TITLE
+ // be_valuetype_fwd
+ //
+ // =DESCRIPTION
+ // Extensions to the be_interface_fwd class
+public:
+ be_valuetype_fwd (void);
+ // Default constructor.
+
+ be_valuetype_fwd (AST_Interface *dummy,
+ UTL_ScopedName *n);
+ // Constructor.
+
+ virtual ~be_valuetype_fwd (void);
+ // Destructor.
+
+ // Visiting.
+ virtual int accept (be_visitor* visitor);
+
+ // Cleanup
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS2 (be_valuetype_fwd, be_interface_fwd, AST_ValueTypeFwd);
+ DEF_NARROW_FROM_DECL (be_valuetype_fwd);
+};
+
+#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_visitor.h b/TAO/TAO_IDL/be_include/be_visitor.h
new file mode 100644
index 00000000000..7f33f3ad8a1
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor.h
@@ -0,0 +1,200 @@
+//
+// $Id$
+//
+
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor.h
+//
+// = DESCRIPTION
+// The abstract visitor class. The concrete classes are responsible for code
+// generation.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Carlos O'Ryan, Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_H
+#define TAO_BE_VISITOR_H
+
+class be_decl;
+class be_scope;
+class be_type;
+class be_predefined_type;
+class be_module;
+class be_interface;
+class be_interface_fwd;
+class be_valuebox;
+class be_valuetype;
+class be_valuetype_fwd;
+class be_eventtype;
+class be_eventtype_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;
+class be_operation;
+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;
+class be_enum_val;
+class be_array;
+class be_sequence;
+class be_string;
+class be_typedef;
+class be_root;
+class be_native;
+
+class be_visitor_context;
+class TAO_OutStream;
+
+class be_visitor
+{
+ //
+ // = TITLE
+ // Base class for visitors.
+ //
+ // = DESCRIPTION
+ // To implement code generation we use the "Visitor Pattern", this
+ // is the abstract "Visitor".
+ // The "visit" methods are not pure virtual to facilitate the
+ // implementation of simple visitors that only override a few.
+ //
+public:
+ virtual ~be_visitor (void);
+
+ virtual int visit_decl (be_decl *d);
+ // visit a decl node
+
+ virtual int visit_scope (be_scope *node);
+ // visit the scope
+
+ virtual int visit_type (be_type *node);
+ // visit the type
+
+ virtual int visit_predefined_type (be_predefined_type *node);
+ // visit the predefined type
+
+ virtual int visit_module (be_module *node);
+ // visit module
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit interface_fwd
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit valuebox
+
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit valuetype
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit valuetype_fwd
+
+ virtual int visit_eventtype (be_eventtype *node);
+ // visit eventtype
+
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+ // visit eventtype_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
+
+ virtual int visit_expression (be_expression *node);
+ // visit expression
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_operation (be_operation *node);
+ // visit an operation
+
+ virtual int visit_field (be_field *node);
+ // visit a field
+
+ virtual int visit_argument (be_argument *node);
+ // visit argument
+
+ virtual int visit_attribute (be_attribute *node);
+ // visit an attribute
+
+ virtual int visit_union (be_union *node);
+ // visit union
+
+ virtual int visit_union_fwd (be_union_fwd *node);
+ // visit union
+
+ virtual int visit_union_branch (be_union_branch *node);
+ // visit union branch
+
+ virtual int visit_union_label (be_union_label *node);
+ // visit union label
+
+ virtual int visit_constant (be_constant *node);
+ // visit a constant
+
+ virtual int visit_enum_val (be_enum_val *node);
+ // visit enum val
+
+ virtual int visit_array (be_array *node);
+ // visit an array
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit a sequence
+
+ virtual int visit_string (be_string *node);
+ // visit a string
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit a typedef
+
+ virtual int visit_root (be_root *node);
+ // visit a root
+
+ virtual int visit_native (be_native *node);
+ // visit a native
+
+protected:
+ be_visitor (void);
+ // constructor is protected
+};
+
+#endif // TAO_BE_VISITOR_H
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
new file mode 100644
index 00000000000..e362eb94d23
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_amh_pre_proc.h
@@ -0,0 +1,108 @@
+//=============================================================================
+/**
+* @file be_visitor_amh_pre_proc.h
+*
+* $Id$
+*
+* This visitor creates for AMH implied IDL constructs for the ResponseHandler,
+* the appropriate AST
+* (Abstract Syntax Tree) node, sets the corresponding interface or operation
+* strategy on it and enters the node into the AST.
+*
+* @author Darrell Brunsch <brunsch@cs.wustl.edu>
+* @author Mayur Deshpande <mayur@ics.uci.edu>
+* @author Carlos O'Ryan <coryan@uci.edu>
+*/
+//=============================================================================
+
+#ifndef TAO_BE_VISITOR_AMH_PRE_PROC_H
+#define TAO_BE_VISITOR_AMH_PRE_PROC_H
+
+#include "be_visitor_scope.h"
+#include "ace/SString.h"
+
+/**
+ * @class be_visitor_amh_pre_proc
+ *
+ * @brief Adds AMH implied IDL code into the AST
+ */
+class be_visitor_amh_pre_proc : public be_visitor_scope
+{
+private:
+ typedef enum
+ {
+ NORMAL,
+ GET_OPERATION,
+ SET_OPERATION
+ } Operation_Kind;
+
+public:
+ be_visitor_amh_pre_proc (be_visitor_context *ctx);
+
+ virtual ~be_visitor_amh_pre_proc (void);
+
+ virtual int visit_root (be_root *node);
+
+ virtual int visit_module (be_module *node);
+
+ virtual int visit_interface (be_interface *node);
+
+ virtual int visit_operation (be_operation *node);
+
+private:
+ /// Create the reponse handler interface
+ be_interface *create_response_handler (be_interface *node,
+ be_valuetype *exception_holder);
+
+ /// method to add memebers to the response handler interfaces
+ int add_rh_node_members (be_interface *node,
+ be_interface *response_handler,
+ be_valuetype *exception_holder);
+
+ /// Create an operation with return, OUT and INOUT arguments
+ int create_response_handler_operation (be_operation *node,
+ be_interface *response_handler,
+ be_valuetype *exception_holder);
+
+ /// Create the get_* operation associated with an attribute.
+ int create_response_handler_attribute (be_attribute *node,
+ be_interface *response_handler,
+ be_valuetype *exception_holder);
+
+ /// Add the normal reply handler for the @c node operation
+ int add_normal_reply (be_operation *node,
+ be_interface *response_handler);
+
+ /// Add the exception version of @c node
+ int add_exception_reply (be_operation *node,
+ be_interface *response_handler,
+ be_valuetype *exception_holder);
+
+ /// Create the exception holder valuetype
+ be_valuetype *create_exception_holder (be_interface *node);
+
+ /// And the concrete implemenation of the exception holder valuetype
+ // be_valuetype *create_exception_holder_concrete (be_valuetype *parent);
+
+ /// Creates a raise operation from node and inserts it in
+ /// excep_holder, while obeying if it is a normal operation
+ /// or a set or get attribute.
+ int create_raise_operation (be_decl *node,
+ be_valuetype *excep_holder,
+ Operation_Kind operation_kind);
+
+ /// Concatenate 3 strings into one.
+ int generate_name (ACE_CString &destination,
+ const char *prefix,
+ const char *middle_name,
+ const char *suffix);
+
+ /// Generate a get operation out of the attribute.
+ be_operation *generate_get_operation (be_attribute *node);
+
+ /// Generate a set operation out of the attribute.
+ be_operation *generate_set_operation (be_attribute *node);
+};
+
+
+#endif // TAO_BE_VISITOR_AMH_PRE_PROC_H
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
new file mode 100644
index 00000000000..bcf8907e25e
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_ami_pre_proc.h
@@ -0,0 +1,123 @@
+//
+// $Id$
+//
+
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_ami_pre_proc.h
+//
+// = DESCRIPTION
+// This visitor creates for AMI implied IDL constructs
+// the appropriate AST (Abstract Syntax Tree) node,
+// sets the corresponding interface or operation strategy
+// on it and enteres the nodes into the AST.
+//
+// = AUTHOR
+// Michael Kircher <Michael.Kircher@mchp.siemens.de>
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_AMI_PRE_PROC_H
+#define TAO_BE_VISITOR_AMI_PRE_PROC_H
+
+#include "be_visitor_scope.h"
+#include "ace/SString.h"
+
+class AST_Interface;
+
+class be_visitor_ami_pre_proc : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // AMI pre processor
+ //
+ // = DESCRIPTION
+ // Adds AMI implied IDL code to the AST
+ //
+private:
+ typedef enum
+ {
+ NORMAL,
+ GET_OPERATION,
+ SET_OPERATION
+ } Operation_Kind;
+
+public:
+ be_visitor_ami_pre_proc (be_visitor_context *ctx);
+
+ virtual ~be_visitor_ami_pre_proc (void);
+
+ virtual int visit_root (be_root *node);
+ // visit a root
+
+ virtual int visit_module (be_module *node);
+ // visit module
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface
+
+ virtual int visit_operation (be_operation *node);
+ // visit an operation
+
+ virtual int visit_attribute (be_attribute *node);
+ // visit an attribute
+
+private:
+ int create_raise_operation (be_decl *node,
+ be_valuetype *excep_holder,
+ Operation_Kind operation_kind);
+ // Creates a raise operation from node and inserts it in
+ // excep_holder, while obeying if it is a normal operation
+ // or a set or get attribute.
+
+ be_interface *create_reply_handler (be_interface *node,
+ be_valuetype *excep_holder);
+ // create the reply handler interface
+
+ be_valuetype *create_exception_holder (be_interface *node);
+ // create the exception holder valuetype
+
+ be_operation *create_sendc_operation (be_operation *node,
+ int for_arguments);
+ // create a method with "sendc_" prepended, if for_arguments
+ // equals one the sendc operation contains also the
+ // object reference to the reply handler as the first argument,
+ // but this should not be marhaled, therefor we need the switch
+
+ int create_excep_operation (be_operation *node,
+ be_interface *reply_handler,
+ be_valuetype *excep_holder);
+ // create a method with "_excep" appended
+
+ int create_reply_handler_operation (be_operation *node,
+ be_interface *reply_handler);
+ // create an operation with only the OUT and INOUT arguments
+
+ int visit_scope (be_scope *node);
+ // specialized visit_scope
+
+ int generate_name (ACE_CString &desintation,
+ const char *prefix,
+ const char *middle_name,
+ const char *suffix);
+ // concatenate the prefix, middle_name and suffix
+ // and store the result in desination.
+
+ be_operation *generate_get_operation (be_attribute *node);
+ // generate a get operation out of the attribute.
+
+ be_operation *generate_set_operation (be_attribute *node);
+ // generate a set operation out of the attribute.
+
+ AST_Interface **create_inheritance_list (be_interface *node,
+ long &n_parents);
+ // Create an inheritance list for the reply handler.
+};
+
+
+#endif // TAO_BE_VISITOR_AMI_PRE_PROC_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_arg_traits.h b/TAO/TAO_IDL/be_include/be_visitor_arg_traits.h
new file mode 100644
index 00000000000..8246fc5d7c4
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_arg_traits.h
@@ -0,0 +1,91 @@
+//=============================================================================
+/**
+* @file be_visitor_arg_traits.h
+*
+* $Id$
+*
+* This visitor generates template specializations for argument traits classes.
+*
+* @author Jeff Parsons <j.parsons@vanderbilt.edu>
+*/
+//=============================================================================
+#ifndef TAO_BE_VISITOR_ARG_TRAITS_H
+#define TAO_BE_VISITOR_ARG_TRAITS_H
+
+#include "be_visitor_scope.h"
+
+/**
+ * @class be_visitor_arg_traits
+ *
+ * @brief Generates specialized template argument traits declarations.
+ */
+class be_visitor_arg_traits : public be_visitor_scope
+{
+public:
+ be_visitor_arg_traits (const char *S,
+ be_visitor_context *ctx);
+
+ virtual ~be_visitor_arg_traits (void);
+
+ virtual int visit_root (be_root *node);
+
+ virtual int visit_module (be_module *node);
+
+ virtual int visit_array (be_array *node);
+
+ virtual int visit_enum (be_enum *node);
+
+ virtual int visit_interface (be_interface *node);
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+
+ virtual int visit_valuetype (be_valuetype *node);
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+
+ virtual int visit_eventtype (be_eventtype *node);
+
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+
+ virtual int visit_operation (be_operation *node);
+
+ virtual int visit_attribute (be_attribute *node);
+
+ virtual int visit_argument (be_argument *node);
+
+ virtual int visit_sequence (be_sequence *node);
+
+ virtual int visit_string (be_string *node);
+
+ virtual int visit_structure (be_structure *node);
+
+ virtual int visit_field (be_field *node);
+
+ virtual int visit_union (be_union *node);
+
+ virtual int visit_union_branch (be_union_branch *node);
+
+ virtual int visit_typedef (be_typedef *node);
+
+ virtual int visit_component (be_component *node);
+
+ virtual int visit_component_fwd (be_component_fwd *node);
+
+ virtual int visit_home (be_home *node);
+
+ virtual int visit_valuebox (be_valuebox *node);
+
+private:
+
+ bool generated (be_decl *node) const;
+ void generated (be_decl *node,
+ bool val);
+
+ const char *insert_policy (void);
+
+private:
+ char *S_;
+};
+
+
+#endif // TAO_BE_VISITOR_ARG_TRAITS_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument.h b/TAO/TAO_IDL/be_include/be_visitor_argument.h
new file mode 100644
index 00000000000..e379754d28d
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_argument.h
@@ -0,0 +1,37 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_args.h
+//
+// = DESCRIPTION
+// Visitors for generation of code for Arguments. These are used for the
+// interpretive styled stubs and skeletons
+//
+// = AUTHOR
+// Aniruddha Gokhale and Carlos O'Ryan
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ARGUMENT_H
+#define _BE_VISITOR_ARGUMENT_H
+
+#include "idl_defines.h"
+
+#include "be_visitor_scope.h"
+#include "be_visitor_argument/argument.h"
+#include "be_visitor_argument/arglist.h"
+#include "be_visitor_argument/vardecl_ss.h"
+#include "be_visitor_argument/upcall_ss.h"
+#include "be_visitor_argument/post_upcall_ss.h"
+#include "be_visitor_argument/marshal_ss.h"
+#include "be_visitor_argument/invoke_cs.h"
+#include "be_visitor_argument/paramlist.h"
+
+#endif /* _BE_VISITOR_ARGUMENT_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/arglist.h b/TAO/TAO_IDL/be_include/be_visitor_argument/arglist.h
new file mode 100644
index 00000000000..6aa736fd7b7
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_argument/arglist.h
@@ -0,0 +1,114 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// arglist.h
+//
+// = DESCRIPTION
+// Visitors for generation of code for Arguments as parameter lists in the
+// operation signature
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ARGUMENT_ARGLIST_H_
+#define _BE_VISITOR_ARGUMENT_ARGLIST_H_
+
+class be_visitor_args_arglist : public be_visitor_args
+{
+ //
+ // = TITLE
+ // Generates the code for arguments output.
+ //
+ // = DESCRIPTION
+ // At several stages in the code generation a node of type
+ // "be_operation" is visited, and the code for its arguments must
+ // be generated.
+ // Sometimes the argument declarations must be generated (such as
+ // in the class declaration), other the arguments names (such as
+ // in method invocations).
+ // This class implements the declaration output, in other words,
+ // it outputs both the arguments and their types.
+ //
+public:
+ be_visitor_args_arglist (be_visitor_context *ctx);
+ // constructor
+
+ virtual ~be_visitor_args_arglist (void);
+ // destructor
+
+ virtual int visit_argument (be_argument *node);
+ // visit the argument node
+
+ // =visit all the nodes that can be the types for the argument
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_enum (be_enum *node);
+ // visit the enum node
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit interface forward
+
+ virtual int visit_component (be_component *node);
+ // visit component
+
+ virtual int visit_component_fwd (be_component_fwd *node);
+ // visit component forward
+
+ virtual int visit_native (be_native *node);
+ // visit native node
+
+ virtual int visit_predefined_type (be_predefined_type *node);
+ // visit predefined type
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence type
+
+ virtual int visit_string (be_string *node);
+ // visit string type
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure type
+
+ virtual int visit_union (be_union *node);
+ // visit union type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit the typedef type
+
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit valuetype
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit valuetype_fwd
+
+ virtual int visit_eventtype (be_eventtype *node);
+ // visit eventtype
+
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+ // visit eventtype_fwd
+
+ virtual int visit_home (be_home *node);
+ // visit home
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit valuebox
+
+ private:
+ int emit_common (be_type *node);
+};
+
+#endif /* _BE_VISITOR_ARGUMENT_ARGLIST_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/argument.h b/TAO/TAO_IDL/be_include/be_visitor_argument/argument.h
new file mode 100644
index 00000000000..c5d61e09a04
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_argument/argument.h
@@ -0,0 +1,67 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// argument.h
+//
+// = DESCRIPTION
+// Visitors for generation of code for Arguments
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ARGUMENT_ARGUMENT_H_
+#define _BE_VISITOR_ARGUMENT_ARGUMENT_H_
+
+#include "ast_argument.h"
+
+class be_visitor_args : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // Generates the code for arguments output.
+ //
+ // = DESCRIPTION
+ // At several stages in the code generation a node of type
+ // "be_operation" is visited, and the code for its arguments must
+ // be generated.
+ // Sometimes the argument declarations must be generated (such as
+ // in the class declaration), other the arguments names (such as
+ // in method invocations).
+ // This class implements some common functionality required across all
+ // argument visitors
+ //
+public:
+ be_visitor_args (be_visitor_context *ctx);
+ // constructor
+
+ virtual ~be_visitor_args (void);
+ // destructor
+
+ //= helper
+ virtual const char *type_name (be_type *type,
+ const char *suffix = 0);
+ // helper that produces either a nested name for header files or full name
+ // for others
+
+ virtual AST_Argument::Direction direction (void);
+ // return the direction of the argument node
+
+ virtual int visit_argument (be_argument *node);
+ // must be overridden by derived classes
+
+ void set_fixed_direction (AST_Argument::Direction direction);
+
+private:
+ int fixed_direction_;
+};
+
+#endif /* _BE_VISITOR_ARGUMENT_ARGUMENT_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/invoke_cs.h b/TAO/TAO_IDL/be_include/be_visitor_argument/invoke_cs.h
new file mode 100644
index 00000000000..88a7c7f4c0c
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_argument/invoke_cs.h
@@ -0,0 +1,109 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// invoke_cs.h
+//
+// = DESCRIPTION
+// Visitors for generation of code for Arguments for passing the arguments
+// to the CDR << and >> operators
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ARGUMENT_INVOKE_CS_H_
+#define _BE_VISITOR_ARGUMENT_INVOKE_CS_H_
+
+// ************************************************************
+// class be_visitor_args_invoke_cs
+// ************************************************************
+
+class be_visitor_args_invoke_cs : public be_visitor_args
+{
+ //
+ // = TITLE
+ // be_visitor_args_invoke_cs
+ //
+ // = DESCRIPTION
+ // Code to be generated when making the invocation
+ //
+public:
+ be_visitor_args_invoke_cs (be_visitor_context *ctx);
+ // constructor
+
+ virtual ~be_visitor_args_invoke_cs (void);
+ // destructor
+
+ virtual int visit_argument (be_argument *node);
+ // visit the argument node
+
+ // =visit all the nodes that can be the types for the argument
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_enum (be_enum *node);
+ // visit the enum node
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit interface forward
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit valuebox
+
+ 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
+
+ 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
+ virtual int visit_component (be_component *node);
+ // visit a component node
+
+ virtual int visit_component_fwd (be_component_fwd *node);
+ // visit a forward declared component node
+
+ virtual int visit_eventtype (be_eventtype *node);
+ // visit an eventtype node
+
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+ // visit a forward declared eventtype node
+
+ virtual int visit_home (be_home *node);
+ // visit home
+
+ private:
+ int emit_common (void);
+ int emit_common2 (be_type *node);
+
+};
+
+#endif /* _BE_VISITOR_ARGUMENT_INVOKE_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/marshal_ss.h b/TAO/TAO_IDL/be_include/be_visitor_argument/marshal_ss.h
new file mode 100644
index 00000000000..80d2b051a08
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_argument/marshal_ss.h
@@ -0,0 +1,109 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// marshal_ss.h
+//
+// = DESCRIPTION
+// Visitors for generation of code for Arguments. This generates the
+// code to pass the arguments to the call to the marshaler/demarshaler
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ARGUMENT_MARSHAL_SS_H_
+#define _BE_VISITOR_ARGUMENT_MARSHAL_SS_H_
+
+// ************************************************************
+// class be_visitor_args_marshal_ss
+// ************************************************************
+
+class be_visitor_args_marshal_ss : public be_visitor_args
+{
+ //
+ // = TITLE
+ // be_visitor_args_marshal_ss
+ //
+ // = DESCRIPTION
+ // Code to be generated when making the invocation
+ //
+public:
+ be_visitor_args_marshal_ss (be_visitor_context *ctx);
+ // constructor
+
+ virtual ~be_visitor_args_marshal_ss (void);
+ // destructor
+
+ virtual int visit_argument (be_argument *node);
+ // visit the argument node
+
+ // =visit all the nodes that can be the types for the argument
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_enum (be_enum *node);
+ // visit the enum node
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit interface forward
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit valuebox
+
+ 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
+
+ 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
+
+ virtual int visit_component (be_component *node);
+ // visit a component node
+
+ virtual int visit_component_fwd (be_component_fwd *node);
+ // visit a forward declared component node
+
+ virtual int visit_eventtype (be_eventtype *node);
+ // visit an eventtype node
+
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+ // visit a forward declared eventtype node
+
+ virtual int visit_home (be_home *node);
+ // visit home
+
+ private:
+ int emit_common (void);
+ int emit_common2 (be_type *node);
+};
+
+#endif /* _BE_VISITOR_ARGUMENT_MARSHAL_SS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/paramlist.h b/TAO/TAO_IDL/be_include/be_visitor_argument/paramlist.h
new file mode 100644
index 00000000000..a41505d781c
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_argument/paramlist.h
@@ -0,0 +1,53 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// paramlist.h
+//
+// = DESCRIPTION
+// Visitors for generation of code for building Dynamic::ParamList
+//
+// = AUTHOR
+// Kirthika Parameswaran <kirthika@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ARGUMENT_PARAMLIST_H_
+#define _BE_VISITOR_ARGUMENT_PARAMLIST_H_
+
+class be_visitor_args_paramlist : public be_visitor_args
+{
+ //
+ // = TITLE
+ // Generates the code for arguments output.
+ //
+ // = DESCRIPTION
+ // At several stages in the code generation a node of type
+ // "be_operation" is visited, and the code for its arguments must
+ // be generated. Here the generationis to build the ParameterList
+ // on demand.
+
+public:
+ be_visitor_args_paramlist (be_visitor_context *ctx);
+ // constructor
+
+ virtual ~be_visitor_args_paramlist (void);
+ // destructor
+
+ virtual int visit_argument (be_argument *node);
+ // visit the argument node
+
+ virtual int visit_predefined_type (be_predefined_type *node);
+ // visit predefined types like boolean, char, octet, wchar.
+
+ virtual int visit_string (be_string *node);
+ // visit the string since insertion of string and w_string is special.
+};
+
+#endif /* _BE_VISITOR_ARGUMENT_PARAMLIST_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/post_upcall_ss.h b/TAO/TAO_IDL/be_include/be_visitor_argument/post_upcall_ss.h
new file mode 100644
index 00000000000..32ff63812a7
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_argument/post_upcall_ss.h
@@ -0,0 +1,59 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// post_upcall_ss.h
+//
+// = DESCRIPTION
+// Visitors for generation of code for Arguments. This generates the
+// code for post upcall processing of the arguments
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+
+#ifndef _BE_VISITOR_ARGUMENT_POST_UPCALL_SS_H_
+#define _BE_VISITOR_ARGUMENT_POST_UPCALL_SS_H_
+
+// ************************************************************
+// class be_visitor_args_post_upcall_ss
+// ************************************************************
+
+class be_visitor_args_post_upcall_ss : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_compiled_args_post_upcall
+ //
+ // = DESCRIPTION
+ // Visitor for post processing after upcall
+ //
+public:
+ be_visitor_args_post_upcall_ss (be_visitor_context *ctx);
+ // constructor
+
+ virtual ~be_visitor_args_post_upcall_ss (void);
+ // destructor
+
+ virtual int visit_argument (be_argument *node);
+ // visit the argument node
+
+ virtual int visit_operation (be_operation *node);
+ // visit operation node
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit the typedef type
+};
+
+#endif /* _BE_VISITOR_ARGUMENT_POST_UPCALL_SS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/upcall_ss.h b/TAO/TAO_IDL/be_include/be_visitor_argument/upcall_ss.h
new file mode 100644
index 00000000000..be2c2bf1515
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_argument/upcall_ss.h
@@ -0,0 +1,106 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// upcall_ss.h
+//
+// = DESCRIPTION
+// Visitors for generation of code for Arguments. This generates the
+// passing of arguments to the upcall.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ARGUMENT_UPCALL_SS_H_
+#define _BE_VISITOR_ARGUMENT_UPCALL_SS_H_
+
+// ************************************************************
+// class be_visitor_args_upcall_ss
+// ************************************************************
+
+class be_visitor_args_upcall_ss : public be_visitor_args
+{
+ //
+ // = TITLE
+ // be_visitor_args_upcall_ss
+ //
+ // = DESCRIPTION
+ // Visitor for passing argument to the upcall
+ //
+public:
+ be_visitor_args_upcall_ss (be_visitor_context *ctx);
+ // constructor
+
+ virtual ~be_visitor_args_upcall_ss (void);
+ // destructor
+
+ virtual int visit_argument (be_argument *node);
+ // visit the argument node
+
+ // =visit all the nodes that can be the types for the argument
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_enum (be_enum *node);
+ // visit the enum node
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit interface forward
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit valuebox
+
+ 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
+
+ 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
+
+ virtual int visit_component (be_component *node);
+ // visit a component node
+
+ virtual int visit_component_fwd (be_component_fwd *node);
+ // visit a forward declared component node
+
+ virtual int visit_eventtype (be_eventtype *node);
+ // visit an eventtype node
+
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+ // visit a forward declared eventtype node
+
+ private:
+ int emit_common (void);
+ int emit_common2 (be_type *node);
+};
+
+#endif /* _BE_VISITOR_ARGUMENT_UPCALL_SS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/vardecl_ss.h b/TAO/TAO_IDL/be_include/be_visitor_argument/vardecl_ss.h
new file mode 100644
index 00000000000..afb6f9e2f78
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_argument/vardecl_ss.h
@@ -0,0 +1,107 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// vardecl_ss.h
+//
+// = DESCRIPTION
+// Visitors for generation of code for Arguments. This generates the
+// variable declartion for the argument in the server-sde skeleton
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ARGUMENT_VARDECL_SS_H_
+#define _BE_VISITOR_ARGUMENT_VARDECL_SS_H_
+
+// ************************************************************
+// class be_visitor_args_vardecl_ss
+// ************************************************************
+
+class be_visitor_args_vardecl_ss : public be_visitor_args
+{
+ //
+ // = TITLE
+ // be_visitor_args_vardecl_ss
+ //
+ // = DESCRIPTION
+ // Visitor for variable declaration for argument
+ //
+public:
+ be_visitor_args_vardecl_ss (be_visitor_context *ctx);
+ // constructor
+
+ virtual ~be_visitor_args_vardecl_ss (void);
+ // destructor
+
+ virtual int visit_argument (be_argument *node);
+ // visit the argument node
+
+ // =visit all the nodes that can be the types for the argument
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_enum (be_enum *node);
+ // visit the enum node
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit interface forward
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit valuebox
+
+ 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
+
+ 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
+
+ virtual int visit_component (be_component *node);
+ // visit a component node
+
+ virtual int visit_component_fwd (be_component_fwd *node);
+ // visit a forward declared component node
+
+ virtual int visit_eventtype (be_eventtype *node);
+ // visit an eventtype node
+
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+ // visit a forward declared eventtype node
+
+ private:
+ int emit_common (be_type *node);
+ int emit_common2 (be_type *node);
+
+};
+
+#endif /* _BE_VISITOR_ARGUMENT_VARDECL_SS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_array.h b/TAO/TAO_IDL/be_include/be_visitor_array.h
new file mode 100644
index 00000000000..a5a4b92773a
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_array.h
@@ -0,0 +1,38 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_array.h
+//
+// = DESCRIPTION
+// Visitors for generation of code for Arrays
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_ARRAY_H
+#define TAO_BE_VISITOR_ARRAY_H
+
+#include "idl_defines.h"
+
+#include "be_visitor_decl.h"
+#include "be_visitor_array/array.h"
+#include "be_visitor_array/array_ch.h"
+#include "be_visitor_array/array_ci.h"
+#include "be_visitor_array/array_cs.h"
+#include "be_visitor_array/any_op_ch.h"
+#include "be_visitor_array/any_op_cs.h"
+#include "be_visitor_array/cdr_op_ch.h"
+#include "be_visitor_array/cdr_op_cs.h"
+#include "be_visitor_array/serializer_op_ch.h"
+#include "be_visitor_array/serializer_op_cs.h"
+
+#endif /* TAO_BE_VISITOR_ARRAY_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_array/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_array/any_op_ch.h
new file mode 100644
index 00000000000..8030e83f6cc
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_array/any_op_ch.h
@@ -0,0 +1,52 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.h
+//
+// = DESCRIPTION
+// Visitors for generation of code for Arrays in client header. This one
+// generates the Any operators.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ARRAY_ANY_OP_CH_H_
+#define _BE_VISITOR_ARRAY_ANY_OP_CH_H_
+
+// ************************************************************
+// class be_visitor_array_any_op_ch
+// ************************************************************
+
+class be_visitor_array_any_op_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_array_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for array that generates the Any operator
+ // declarations
+ //
+
+public:
+ be_visitor_array_any_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_array_any_op_ch (void);
+ // destructor
+
+ virtual int visit_array (be_array *node);
+ // visit array
+
+};
+
+#endif /* _BE_VISITOR_ARRAY_ANY_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_array/any_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_array/any_op_cs.h
new file mode 100644
index 00000000000..58b310587e2
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_array/any_op_cs.h
@@ -0,0 +1,52 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.h
+//
+// = DESCRIPTION
+// Visitors for generation of code for Arrays in client stubs. This one
+// generates the Any operators.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ARRAY_ANY_OP_CS_H_
+#define _BE_VISITOR_ARRAY_ANY_OP_CS_H_
+
+// ************************************************************
+// class be_visitor_array_cs
+// ************************************************************
+
+class be_visitor_array_any_op_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_array_any_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for array that generates the Any operator
+ // implementations
+ //
+
+public:
+ be_visitor_array_any_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_array_any_op_cs (void);
+ // destructor
+
+ virtual int visit_array (be_array *node);
+ // visit array
+
+};
+
+#endif /* _BE_VISITOR_ARRAY_ANY_OP_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_array/array.h b/TAO/TAO_IDL/be_include/be_visitor_array/array.h
new file mode 100644
index 00000000000..f106b205128
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_array/array.h
@@ -0,0 +1,96 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// array.h
+//
+// = DESCRIPTION
+// Visitors for generation of code for Arrays.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ARRAY_ARRAY_H_
+#define _BE_VISITOR_ARRAY_ARRAY_H_
+
+// ************************************************************
+// class be_visitor_array
+// ************************************************************
+
+class be_visitor_array : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_array
+ //
+ // = DESCRIPTION
+ // This is a generic visitor for arrays
+ //
+ //
+public:
+ be_visitor_array (be_visitor_context *ctx);
+ // Constructor
+
+ ~be_visitor_array (void);
+ // destructor
+
+ virtual int visit_array (be_array *);
+ // visit the array node
+
+ // = Visitor methods on array types
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit an interface forward node
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit a valuebox
+
+ 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
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence
+
+ virtual int visit_string (be_string *node);
+ // visit string
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef
+
+ virtual int visit_union (be_union *node);
+ // visit union
+
+protected:
+
+ int visit_node (be_type *);
+ // helper that does the common job
+
+ int emit_common (be_type *node);
+ // helper that does the common job
+
+};
+
+#endif /* _BE_VISITOR_ARRAY_ARRAY_H_*/
diff --git a/TAO/TAO_IDL/be_include/be_visitor_array/array_ch.h b/TAO/TAO_IDL/be_include/be_visitor_array/array_ch.h
new file mode 100644
index 00000000000..0d54e4efe0a
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_array/array_ch.h
@@ -0,0 +1,48 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// array_ch.h
+//
+// = DESCRIPTION
+// Visitors for generation of code for Arrays in client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ARRAY_CH_H_
+#define _BE_VISITOR_ARRAY_CH_H_
+
+// ************************************************************
+// class be_visitor_array_ch
+// ************************************************************
+
+class be_visitor_array_ch : public be_visitor_array
+{
+ //
+ // = TITLE
+ // be_visitor_array_ch
+ //
+ // = DESCRIPTION
+ // Code to be generated for arrays in the client header file
+ //
+public:
+ be_visitor_array_ch (be_visitor_context *ctx);
+ // constructor
+
+ virtual ~be_visitor_array_ch (void);
+ // destructor
+
+ virtual int visit_array (be_array *node);
+ // visit the array node
+};
+
+#endif /* _BE_VISITOR_ARRAY_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_array/array_ci.h b/TAO/TAO_IDL/be_include/be_visitor_array/array_ci.h
new file mode 100644
index 00000000000..b9f9e7c589d
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_array/array_ci.h
@@ -0,0 +1,48 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// array_ci.h
+//
+// = DESCRIPTION
+// Visitors for generation of code for Arrays in client inline.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ARRAY_CI_H_
+#define _BE_VISITOR_ARRAY_CI_H_
+
+// ************************************************************
+// class be_visitor_array_ci
+// ************************************************************
+
+class be_visitor_array_ci : public be_visitor_array
+{
+ //
+ // = TITLE
+ // be_visitor_array_ci
+ //
+ // = DESCRIPTION
+ // Code to be generated for arrays in the client inline file
+ //
+public:
+ be_visitor_array_ci (be_visitor_context *ctx);
+ // constructor
+
+ virtual ~be_visitor_array_ci (void);
+ // destructor
+
+ virtual int visit_array (be_array *node);
+ // visit the array node
+};
+
+#endif /* _BE_VISITOR_ARRAY_CI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_array/array_cs.h b/TAO/TAO_IDL/be_include/be_visitor_array/array_cs.h
new file mode 100644
index 00000000000..1a6509e579b
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_array/array_cs.h
@@ -0,0 +1,48 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// array_cs.h
+//
+// = DESCRIPTION
+// Visitors for generation of code for Arrays in client stubs.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ARRAY_CS_H_
+#define _BE_VISITOR_ARRAY_CS_H_
+
+// ************************************************************
+// class be_visitor_array_cs
+// ************************************************************
+
+class be_visitor_array_cs : public be_visitor_array
+{
+ //
+ // = TITLE
+ // be_visitor_array_cs
+ //
+ // = DESCRIPTION
+ // Code to be generated for arrays in the client stub file
+ //
+public:
+ be_visitor_array_cs (be_visitor_context *ctx);
+ // constructor
+
+ virtual ~be_visitor_array_cs (void);
+ // destructor
+
+ virtual int visit_array (be_array *node);
+ // visit the array node
+};
+
+#endif /* _BE_VISITOR_ARRAY_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_ch.h
new file mode 100644
index 00000000000..2a0d889efe5
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_ch.h
@@ -0,0 +1,51 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.h
+//
+// = DESCRIPTION
+// Visitors for generation of code for Arrays in client header. This one
+// generates the CDR operators.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ARRAY_CDR_OP_CH_H_
+#define _BE_VISITOR_ARRAY_CDR_OP_CH_H_
+
+// ************************************************************
+// class be_visitor_array_cdr_op_ch
+// ************************************************************
+
+class be_visitor_array_cdr_op_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_array_cdr_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for array that generates the CDR operator
+ // declarations
+ //
+
+public:
+ be_visitor_array_cdr_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_array_cdr_op_ch (void);
+ // destructor
+
+ 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
new file mode 100644
index 00000000000..437fbf15255
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_ci.h
@@ -0,0 +1,90 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ci.h
+//
+// = DESCRIPTION
+// Visitors for generation of code for Arrays in client stubs. This one
+// generates the CDR operators.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ARRAY_CDR_OP_CI_H_
+#define _BE_VISITOR_ARRAY_CDR_OP_CI_H_
+
+// ************************************************************
+// class be_visitor_array_cdr_op_ci
+// ************************************************************
+
+class be_visitor_array_cdr_op_ci : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_array_cdr_op_ci
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for array that generates the CDR operator
+ // implementations
+ //
+
+public:
+ be_visitor_array_cdr_op_ci (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_array_cdr_op_ci (void);
+ // destructor
+
+ virtual int visit_array (be_array *node);
+ // visit array
+
+ // = Visitor methods on array types
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit an interface forward node
+
+ virtual int visit_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
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence
+
+ virtual int visit_string (be_string *node);
+ // visit string
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef
+
+ virtual int visit_union (be_union *node);
+ // visit union
+
+protected:
+ int visit_node (be_type *);
+ // helper that does the common job
+};
+
+#endif /* _BE_VISITOR_ARRAY_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
new file mode 100644
index 00000000000..85d597071ec
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_cs.h
@@ -0,0 +1,97 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_cs.h
+//
+// = DESCRIPTION
+// The array's own CDR operators are generated in the .i file, but if the
+// array contains an anonymous sequence, those CDR operators will not
+// get generated on their own, and, since the sequence may contain a
+// recursive type, they must also be generated in the .cpp file. That is
+// the sole purpose of this visitor type.
+//
+// = AUTHOR
+// Jeff Parsons <parsons@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ARRAY_CDR_OP_CS_H_
+#define _BE_VISITOR_ARRAY_CDR_OP_CS_H_
+
+// ************************************************************
+// class be_visitor_array_cdr_op_cs
+// ************************************************************
+
+class be_visitor_array_cdr_op_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_array_cdr_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for array that generates the CDR operator
+ // implementations for the array's element type, if that type is
+ // an anonymous sequence.
+ //
+
+public:
+ be_visitor_array_cdr_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_array_cdr_op_cs (void);
+ // destructor
+
+ virtual int visit_array (be_array *node);
+ // visit array
+
+ // = Visitor methods on array types
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit an interface forward node
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit a valuebox
+
+ 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
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence
+
+ virtual int visit_string (be_string *node);
+ // visit string
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef
+
+ virtual int visit_union (be_union *node);
+ // visit union
+
+protected:
+ int visit_node (be_type *);
+ // helper that does the common job
+};
+
+#endif /* _BE_VISITOR_ARRAY_CDR_OP_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_array/serializer_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_array/serializer_op_ch.h
new file mode 100644
index 00000000000..4ed57472afa
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_array/serializer_op_ch.h
@@ -0,0 +1,55 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_ch.h
+//
+// = DESCRIPTION
+// Visitors for generation of TAO::DCPS::Serializer operators code
+// for Arrays in client header. This one
+// generates the TAO::DCPS::Serializer operators.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ARRAY_serializer_op_CH_H_
+#define _BE_VISITOR_ARRAY_serializer_op_CH_H_
+
+// ************************************************************
+// class be_visitor_array_serializer_op_ch
+// ************************************************************
+
+class be_visitor_array_serializer_op_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_array_serializer_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for array that generates the Serializer operator
+ // declarations
+ //
+
+public:
+ be_visitor_array_serializer_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_array_serializer_op_ch (void);
+ // destructor
+
+ void gen_arg_ref(be_array *node);
+ // helper - common code
+
+ virtual int visit_array (be_array *node);
+ // visit array
+};
+
+#endif /* _BE_VISITOR_ARRAY_serializer_op_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_array/serializer_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_array/serializer_op_cs.h
new file mode 100644
index 00000000000..f2f55211619
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_array/serializer_op_cs.h
@@ -0,0 +1,97 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_cs.h
+//
+// = DESCRIPTION
+// The array's own TAO::DCPS::Serializer operators are generated in
+// the .i file, but if the
+// array contains an anonymous sequence, those
+// TAO::DCPS::Serializer operators will not
+// get generated on their own, and, since the sequence may contain a
+// recursive type, they must also be generated in the .cpp file. That is
+// the sole purpose of this visitor type.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by
+// Jeff Parsons <parsons@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ARRAY_serializer_op_CS_H_
+#define _BE_VISITOR_ARRAY_serializer_op_CS_H_
+
+// ************************************************************
+// class be_visitor_array_serializer_op_cs
+// ************************************************************
+
+class be_visitor_array_serializer_op_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_array_serializer_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for array that generates the Serializer operator
+ // implementations for the array's element type, if that type is
+ // an anonymous sequence.
+ //
+
+public:
+ be_visitor_array_serializer_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_array_serializer_op_cs (void);
+ // destructor
+
+ virtual int visit_array (be_array *node);
+ // visit array
+
+ // = Visitor methods on array types
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit an interface forward node
+
+ virtual int visit_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
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence
+
+ virtual int visit_string (be_string *node);
+ // visit string
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef
+
+ virtual int visit_union (be_union *node);
+ // visit union
+
+protected:
+ int visit_node (be_type *);
+ // helper that does the common job
+};
+
+#endif /* _BE_VISITOR_ARRAY_serializer_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
new file mode 100644
index 00000000000..66ba0d3c30b
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_attribute.h
@@ -0,0 +1,28 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_attribute.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Attribute class
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_ATTRIBUTE_H
+#define TAO_BE_VISITOR_ATTRIBUTE_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
new file mode 100644
index 00000000000..39e0f8f08c8
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_attribute/attribute.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// attribute.h
+//
+// = DESCRIPTION
+// Visitor for the Attribute class.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ATTRIBUTE_ATTRIBUTE_H
+#define _BE_VISITOR_ATTRIBUTE_ATTRIBUTE_H
+
+// ************************************************************
+// Attribute visitor
+// ************************************************************
+
+class be_visitor_attribute : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_attribute
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate code for attributes. We have one
+ // class for mapping into the client and server.
+ //
+ //
+public:
+ be_visitor_attribute (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_attribute (void);
+ // destructor
+
+ virtual int visit_attribute (be_attribute *node);
+ // visit attribute. We provide code for this method in the derived class
+};
+
+#endif /* _BE_VISITOR_ATTRIBUTE_ATTRIBUTE_H*/
diff --git a/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h b/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h
new file mode 100644
index 00000000000..c2cdc4d4cd4
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h
@@ -0,0 +1,157 @@
+//
+// $Id$
+//
+
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_ccm_pre_proc.h
+//
+// = DESCRIPTION
+// This visitor creates for components the appropriate AST
+// (Abstract Syntax Tree) nodes, corresponding to provides, uses,
+// emits, publishes and consumes declarations,
+// and adds the nodes to the AST.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_CCM_PRE_PROC_H
+#define TAO_BE_VISITOR_CCM_PRE_PROC_H
+
+#include "be_visitor_scope.h"
+#include "ast_component.h"
+#include "utl_identifier.h"
+
+class be_valuetype;
+class be_exception;
+class UTL_ExceptList;
+
+class be_visitor_ccm_pre_proc : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_ccm_pre_proc
+ //
+ // = DESCRIPTION
+ // Adds CCM implied IDL code to the AST.
+ //
+public:
+ be_visitor_ccm_pre_proc (be_visitor_context *ctx);
+
+ virtual ~be_visitor_ccm_pre_proc (void);
+
+ virtual int visit_root (be_root *node);
+ // visit a root
+
+ virtual int visit_module (be_module *node);
+ // visit module
+
+ virtual int visit_component (be_component *node);
+ // visit component
+
+ virtual int visit_home (be_home *node);
+ // visit component home
+
+ virtual int visit_eventtype (be_eventtype *node);
+ // visit eventtype
+
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+ // visit eventtype_fwd
+
+private:
+ // Utility methods to handle the corresponding IDL declarations.
+ int gen_provides (be_component *node);
+ int gen_uses (be_component *node);
+ int gen_emits (be_component *node);
+ int gen_publishes (be_component *node);
+ int gen_consumes (be_component *node);
+ int gen_factories (be_home *node,
+ AST_Interface *xplicit);
+ int gen_finders (be_home *node,
+ AST_Interface *xplicit);
+ int gen_implicit_ops (be_home *node,
+ AST_Interface *implicit);
+
+ // Utility methods which generate individual operation nodes.
+ int gen_connect_single (be_component *node,
+ AST_Component::port_description *pd);
+ int gen_disconnect_single (be_component *node,
+ AST_Component::port_description *pd);
+ int gen_get_connection_single (be_component *node,
+ AST_Component::port_description *pd);
+ int gen_connect_multiple (be_component *node,
+ AST_Component::port_description *pd);
+ int gen_disconnect_multiple (be_component *node,
+ AST_Component::port_description *pd);
+ int gen_get_connection_multiple (be_component *node,
+ AST_Component::port_description *pd);
+ int gen_push_op (be_eventtype *node,
+ AST_Interface *consumer);
+ int gen_subscribe (be_component *node,
+ AST_Component::port_description *pd);
+ int gen_unsubscribe (be_component *node,
+ AST_Component::port_description *pd);
+ int gen_emits_connect (be_component *node,
+ AST_Component::port_description *pd);
+ int gen_emits_disconnect (be_component *node,
+ AST_Component::port_description *pd);
+ int gen_get_consumer (be_component *node,
+ AST_Component::port_description *pd);
+ int gen_create (be_home *node,
+ AST_Interface *implicit);
+ int gen_find_by_primary_key (be_home *node,
+ AST_Interface *implicit);
+ int gen_remove (be_home *node,
+ AST_Interface *implicit);
+ int gen_get_primary_key (be_home *node,
+ AST_Interface *implicit);
+
+ // Utility functions to create and destroy the various things
+ // needed by operations generated from CCM-related declarations.
+
+ int lookup_cookie (be_component *node);
+ int lookup_exceptions (be_component *node);
+ int lookup_one_exception (be_component *node,
+ const char *name,
+ be_exception *&result);
+
+ int create_event_consumer (be_eventtype *node);
+ AST_Interface *lookup_consumer (AST_Component::port_description *pd);
+ AST_Interface *create_explicit (be_home *node);
+ AST_Interface *create_implicit (be_home *node);
+ AST_Interface *create_equivalent (be_home *node,
+ AST_Interface *xplicit,
+ AST_Interface *implicit);
+ UTL_ScopedName *create_scoped_name (const char *prefix,
+ const char *local_name,
+ const char *suffix,
+ AST_Decl *parent);
+ UTL_NameList *compute_inheritance (be_home *node);
+
+private:
+ // These are created for operations implied by 'uses multiple' declarations.
+ Identifier module_id_;
+ be_valuetype *cookie_;
+
+ // Exceptions thrown by implied CCM operations.
+ be_exception *already_connected_;
+ be_exception *invalid_connection_;
+ be_exception *no_connection_;
+ be_exception *exceeded_connection_limit_;
+ be_exception *create_failure_;
+ be_exception *remove_failure_;
+ be_exception *finder_failure_;
+ be_exception *invalid_key_;
+ be_exception *unknown_key_value_;
+ be_exception *duplicate_key_value_;
+};
+
+
+#endif // TAO_BE_VISITOR_CCM_PRE_PROC_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..c3c0b2d0db4
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component.h
@@ -0,0 +1,41 @@
+/* -*- 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_interface.h"
+
+#include "be_visitor_component/component.h"
+#include "be_visitor_component/component_ch.h"
+#include "be_visitor_component/component_ci.h"
+#include "be_visitor_component/component_cs.h"
+#include "be_visitor_component/component_sh.h"
+#include "be_visitor_component/component_si.h"
+#include "be_visitor_component/component_ss.h"
+#include "be_visitor_component/component_ih.h"
+#include "be_visitor_component/component_is.h"
+#include "be_visitor_component/any_op_ch.h"
+#include "be_visitor_component/any_op_cs.h"
+#include "be_visitor_component/cdr_op_ch.h"
+#include "be_visitor_component/cdr_op_cs.h"
+
+#endif /* TAO_BE_VISITOR_COMPONENT_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_component/any_op_ch.h
new file mode 100644
index 00000000000..e5aec9e8f02
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/any_op_ch.h
@@ -0,0 +1,47 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component node.
+// This one provides code generation for the Any operators
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_ANY_OP_CH_H_
+#define _BE_COMPONENT_ANY_OP_CH_H_
+
+class be_visitor_component_any_op_ch : public be_visitor_component
+{
+ //
+ // = TITLE
+ // be_visitor_component_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for component that generates the Any
+ // operator declarations
+ //
+
+public:
+ be_visitor_component_any_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_component_any_op_ch (void);
+ // destructor
+
+ virtual int visit_component (be_component *node);
+ // visit interface
+};
+
+#endif /* _BE_COMPONENT_ANY_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/any_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_component/any_op_cs.h
new file mode 100644
index 00000000000..9d1c560a694
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/any_op_cs.h
@@ -0,0 +1,47 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component node.
+// This one provides code generation for the Any operators
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_ANY_OP_CS_H_
+#define _BE_COMPONENT_ANY_OP_CS_H_
+
+class be_visitor_component_any_op_cs : public be_visitor_component
+{
+ //
+ // = TITLE
+ // be_visitor_interface_any_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for interface that generates the Any operator
+ // implementations
+ //
+
+public:
+ be_visitor_component_any_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_component_any_op_cs (void);
+ // destructor
+
+ virtual int visit_component (be_component *node);
+ // visit interface
+};
+
+#endif /* _BE_COMPONENT_ANY_OP_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_component/cdr_op_ch.h
new file mode 100644
index 00000000000..ecb49788a08
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/cdr_op_ch.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component class
+// This one provides code generation for the CDR operators for the
+// component in the client header.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_COMPONENT_CDR_OP_CH_H_
+#define _BE_VISITOR_COMPONENT_CDR_OP_CH_H_
+
+class be_visitor_component_cdr_op_ch : public be_visitor_component
+{
+ //
+ // = TITLE
+ // be_visitor_component_cdr_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for component that generates the CDR operator
+ // declarations
+ //
+
+public:
+ be_visitor_component_cdr_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_component_cdr_op_ch (void);
+ // destructor
+
+ virtual int visit_component (be_component *node);
+ // visit component
+};
+
+#endif /* _BE_VISITOR_COMPONENT_CDR_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/cdr_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_component/cdr_op_cs.h
new file mode 100644
index 00000000000..02076baf649
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/cdr_op_cs.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component class
+// This one provides code generation for the CDR operators for the
+// component in the client stub.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_COMPONENT_CDR_OP_CS_H_
+#define _BE_VISITOR_COMPONENT_CDR_OP_CS_H_
+
+class be_visitor_component_cdr_op_cs : public be_visitor_component
+{
+ //
+ // = TITLE
+ // be_visitor_component_cdr_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for component that generates the CDR operator
+ // implementations
+ //
+
+public:
+ be_visitor_component_cdr_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_component_cdr_op_cs (void);
+ // destructor
+
+ virtual int visit_component (be_component *node);
+ // visit interface
+};
+
+#endif /* _BE_VISITOR_COMPONENT_CDR_OP_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/component.h b/TAO/TAO_IDL/be_include/be_visitor_component/component.h
new file mode 100644
index 00000000000..1bb54989a6a
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/component.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component.h
+//
+// = DESCRIPTION
+// Concrete visitor for components
+// This one provides the generic visitor for the be_component node.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_COMPONENT_COMPONENT_H_
+#define _BE_VISITOR_COMPONENT_COMPONENT_H_
+
+class be_visitor_component : public be_visitor_interface
+{
+ //
+ // = TITLE
+ // be_visitor_component
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for component
+ // that abstracts all common tasks.
+ //
+
+public:
+ be_visitor_component (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_component (void);
+ // destructor
+
+ virtual int visit_attribute (be_attribute *node);
+ // This is the only type of declaration a component may contain.
+
+ virtual int visit_operation (be_operation *node);
+ // Operations are created by the back end for 'provides', 'uses', 'emits',
+ // 'publishes' and 'consumes' declarations.
+
+ virtual int visit_structure (be_structure *node);
+ virtual int visit_typedef (be_typedef *node);
+ // Structs and sequences are created by the back end for 'uses multiple'
+ // declarations.
+};
+
+#endif /* _BE_VISITOR_MODULE_MODULE_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/component_ch.h b/TAO/TAO_IDL/be_include/be_visitor_component/component_ch.h
new file mode 100644
index 00000000000..bdfc0a964a0
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/component_ch.h
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component node.
+// This one provides code generation for components in the client header.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_COMPONENT_CH_H_
+#define _BE_COMPONENT_COMPONENT_CH_H_
+
+class be_visitor_component_ch : public be_visitor_component
+{
+ //
+ // = TITLE
+ // be_visitor_interface_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client header for component.
+ //
+ //
+public:
+ be_visitor_component_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_component_ch (void);
+ // destructor
+
+ virtual int visit_component (be_component *node);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_COMPONENT_COMPONENT_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/component_ci.h b/TAO/TAO_IDL/be_include/be_visitor_component/component_ci.h
new file mode 100644
index 00000000000..403aa52e474
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/component_ci.h
@@ -0,0 +1,45 @@
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component_ci.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component node.
+// This one provides code generation for components in the client inline.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_COMPONENT_CI_H_
+#define _BE_COMPONENT_COMPONENT_CI_H_
+
+class be_visitor_component_ci : public be_visitor_component
+{
+ //
+ // = TITLE
+ // be_visitor_interface_ci
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client header for component.
+ //
+ //
+public:
+ be_visitor_component_ci (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_component_ci (void);
+ // destructor
+
+ virtual int visit_component (be_component *node);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_COMPONENT_COMPONENT_CI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/component_cs.h b/TAO/TAO_IDL/be_include/be_visitor_component/component_cs.h
new file mode 100644
index 00000000000..e6acb03b7d2
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/component_cs.h
@@ -0,0 +1,45 @@
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component node.
+// This one provides code generation for components in the client stub.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_COMPONENT_CS_H_
+#define _BE_COMPONENT_COMPONENT_CS_H_
+
+class be_visitor_component_cs : public be_visitor_component
+{
+ //
+ // = TITLE
+ // be_visitor_component_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client stub for component.
+ //
+ //
+public:
+ be_visitor_component_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_component_cs (void);
+ // destructor
+
+ virtual int visit_component (be_component *node);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_COMPONENT_COMPONENT_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/component_ih.h b/TAO/TAO_IDL/be_include/be_visitor_component/component_ih.h
new file mode 100644
index 00000000000..938fbb08017
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/component_ih.h
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component_ih.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component node.
+// This provides for code generation in the implementation header
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_COMPONENT_IH_H_
+#define _BE_COMPONENT_COMPONENT_IH_H_
+
+class be_visitor_component_ih : public be_visitor_component
+{
+ //
+ // = TITLE
+ // be_visitor_component_ih
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate
+ // the implementation header for component
+ //
+ //
+public:
+ be_visitor_component_ih (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_component_ih (void);
+ // destructor
+
+ virtual int visit_component (be_component *node);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_COMPONENT_COMPONENT_IH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/component_is.h b/TAO/TAO_IDL/be_include/be_visitor_component/component_is.h
new file mode 100644
index 00000000000..dd3360448c5
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/component_is.h
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component_is.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component node.
+// This provides for code generation in the implementation skeleton
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_COMPONENT_IS_H_
+#define _BE_COMPONENT_COMPONENT_IS_H_
+
+class be_visitor_component_is : public be_visitor_component
+{
+ //
+ // = TITLE
+ // be_visitor_component_ih
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate
+ // the implementation skeleton for component
+ //
+ //
+public:
+ be_visitor_component_is (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_component_is (void);
+ // destructor
+
+ virtual int visit_component (be_component *node);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_COMPONENT_COMPONENT_IS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/component_sh.h b/TAO/TAO_IDL/be_include/be_visitor_component/component_sh.h
new file mode 100644
index 00000000000..011c1bc2888
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/component_sh.h
@@ -0,0 +1,48 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component_sh.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component node.
+// This provides for code generation in the server header
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_COMPONENT_SH_H_
+#define _BE_COMPONENT_COMPONENT_SH_H_
+
+class be_visitor_component_sh : public be_visitor_component
+{
+ //
+ // = TITLE
+ // be_visitor_component_sh
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the server header for component.
+ //
+ //
+public:
+ be_visitor_component_sh (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_component_sh (void);
+ // destructor
+
+ virtual int visit_component (be_component *node);
+ // set the right context and make a visitor
+protected:
+ virtual int generate_amh_classes (be_component *node);
+};
+
+#endif /* _BE_COMPONENT_COMPONENT_SH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/component_si.h b/TAO/TAO_IDL/be_include/be_visitor_component/component_si.h
new file mode 100644
index 00000000000..18df6aa2053
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/component_si.h
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component_si.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component node.
+// This provides for code generation in the server inline
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_COMPONENT_SI_H_
+#define _BE_COMPONENT_COMPONENT_SI_H_
+
+class be_visitor_component_si : public be_visitor_component
+{
+ //
+ // = TITLE
+ // be_visitor_component_sh
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the server header for component.
+ //
+ //
+public:
+ be_visitor_component_si (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_component_si (void);
+ // destructor
+
+ virtual int visit_component (be_component *node);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_COMPONENT_COMPONENT_SI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/component_ss.h b/TAO/TAO_IDL/be_include/be_visitor_component/component_ss.h
new file mode 100644
index 00000000000..05120e29ef6
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/component_ss.h
@@ -0,0 +1,47 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component_ss.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component node.
+// This provides for code generation in the server skeleton
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_COMPONENT_SS_H_
+#define _BE_COMPONENT_COMPONENT_SS_H_
+
+class be_visitor_component_ss : public be_visitor_component
+{
+ //
+ // = TITLE
+ // be_visitor_component_ss
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate
+ // the server skeleton for component.
+ //
+ //
+public:
+ be_visitor_component_ss (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_component_ss (void);
+ // destructor
+
+ virtual int visit_component (be_component *node);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_COMPONENT_COMPONENT_SS_H_ */
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..c496984f24e
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component_fwd.h
@@ -0,0 +1,31 @@
+/* -*- 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"
+
+#include "be_visitor_component_fwd/component_fwd_ch.h"
+#include "be_visitor_component_fwd/any_op_ch.h"
+#include "be_visitor_component_fwd/cdr_op_ch.h"
+
+#endif /* TAO_BE_VISITOR_COMPONENT_FWD_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component_fwd/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_component_fwd/any_op_ch.h
new file mode 100644
index 00000000000..a85a465160b
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component_fwd/any_op_ch.h
@@ -0,0 +1,47 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the forward declared Component node.
+// This one provides code generation for the Any operators.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_FWD_ANY_OP_CH_H_
+#define _BE_COMPONENT_FWD_ANY_OP_CH_H_
+
+class be_visitor_component_fwd_any_op_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_component_fwd_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for forward declared components that
+ // generates the Any operator declaration.
+ //
+
+public:
+ be_visitor_component_fwd_any_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_component_fwd_any_op_ch (void);
+ // destructor
+
+ virtual int visit_component_fwd (be_component_fwd *node);
+ // visit component_fwd
+};
+
+#endif /* _BE_COMPONENT_FWD_ANY_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component_fwd/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_component_fwd/cdr_op_ch.h
new file mode 100644
index 00000000000..1294a1f282c
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component_fwd/cdr_op_ch.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the ComponentFwd class
+// This one provides code generation for the CDR operators for the forward
+// declared component in the client header, if the node is not later defined
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_COMPONENT_FWD_CDR_OP_CH_H_
+#define _BE_VISITOR_COMPONENT_FWD_CDR_OP_CH_H_
+
+class be_visitor_component_fwd_cdr_op_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_component_fwd_cdr_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for forward declared component that generates
+ // the CDR operator declarations, if the node is not later defined.
+ //
+
+public:
+ be_visitor_component_fwd_cdr_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_component_fwd_cdr_op_ch (void);
+ // destructor
+
+ virtual int visit_component_fwd (be_component_fwd *node);
+ // visit forward declared component.
+};
+
+#endif /* _BE_VISITOR_COMPONENT_FWD_CDR_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component_fwd/component_fwd_ch.h b/TAO/TAO_IDL/be_include/be_visitor_component_fwd/component_fwd_ch.h
new file mode 100644
index 00000000000..6ce3f927239
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component_fwd/component_fwd_ch.h
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component_fwd_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component Forward node.
+// This one provides code generation for component forward node.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_COMPONENT_FWD_CH_H_
+#define _BE_COMPONENT_COMPONENT_FWD_CH_H_
+
+class be_visitor_component_fwd_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_component_fwd_ch
+ //
+ // = DESCRIPTION
+ // This is the visitor for component_fwd for the header file
+ //
+ //
+public:
+ be_visitor_component_fwd_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_component_fwd_ch (void);
+ // destructor
+
+ virtual int visit_component_fwd (be_component_fwd *node);
+ // visit interface_fwd.
+};
+
+#endif /* _BE_COMPONENT_COMPONENT_FWD_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_constant.h b/TAO/TAO_IDL/be_include/be_visitor_constant.h
new file mode 100644
index 00000000000..5b5d1e9f616
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_constant.h
@@ -0,0 +1,29 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_constant.h
+//
+// = DESCRIPTION
+// Concrete visitor for the constant class
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_CONSTANT_H
+#define TAO_BE_VISITOR_CONSTANT_H
+
+#include "be_visitor_decl.h"
+#include "be_visitor_constant/constant_ch.h"
+#include "be_visitor_constant/constant_cs.h"
+
+#endif // TAO_BE_VISITOR_CONSTANT_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_constant/constant_ch.h b/TAO/TAO_IDL/be_include/be_visitor_constant/constant_ch.h
new file mode 100644
index 00000000000..f902c16864d
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_constant/constant_ch.h
@@ -0,0 +1,46 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// constant_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the constant class generating code in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_CONSTANT_CONSTANT_CH_H_
+#define _BE_VISITOR_CONSTANT_CONSTANT_CH_H_
+
+class be_visitor_constant_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_constant_ch
+ //
+ // = DESCRIPTION
+ // This is the visitor for constant for the header file
+ //
+ //
+public:
+ be_visitor_constant_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_constant_ch (void);
+ // destructor
+
+ virtual int visit_constant (be_constant *node);
+ // visit constant.
+};
+
+#endif /* _BE_VISITOR_CONSTANT_CONSTANT_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_constant/constant_cs.h b/TAO/TAO_IDL/be_include/be_visitor_constant/constant_cs.h
new file mode 100644
index 00000000000..db2fccf96ca
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_constant/constant_cs.h
@@ -0,0 +1,54 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// constant_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the constant class generating code in the client stub.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_CONSTANT_CONSTANT_CS_H_
+#define _BE_VISITOR_CONSTANT_CONSTANT_CS_H_
+
+class be_visitor_constant_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_constant_cs
+ //
+ // = DESCRIPTION
+ // This is the visitor for constant for the impl file
+ //
+ //
+public:
+ be_visitor_constant_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_constant_cs (void);
+ // destructor
+
+ virtual int visit_constant (be_constant *node);
+ // visit constant
+
+ // = special methods
+
+ virtual int gen_nested_namespace_begin (be_module *node);
+ // generate the nested namespace begins
+
+ virtual int gen_nested_namespace_end (be_module *node);
+ // generate the nested namespace ends
+};
+
+#endif /* _BE_VISITOR_CONSTANT_CONSTANT_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_context.h b/TAO/TAO_IDL/be_include/be_visitor_context.h
new file mode 100644
index 00000000000..c2837eaec91
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_context.h
@@ -0,0 +1,292 @@
+//
+// $Id$
+//
+
+/* -*- C++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_context.h
+//
+// = DESCRIPTION
+// This class serves to provide all the necessary context information to the
+// visitor as it generates code. This may include the scope inside which the
+// code is generated, the output file that is being used, and others. This
+// context information will be passed to the abstract/concrete visitor
+// factory which in turn will use it to construct the right visitor.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_CONTEXT_H
+#define TAO_BE_VISITOR_CONTEXT_H
+
+#include "be_codegen.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;
+
+// When interface is defined as macro redefine it as aceinterface
+#if defined (interface)
+# define aceinterface interface
+# undef interface
+#endif /* interface */
+
+class be_visitor_context
+{
+public:
+ be_visitor_context (void);
+ // default constructor
+
+ be_visitor_context (const be_visitor_context &ctx);
+ // default constructor
+
+ ~be_visitor_context (void);
+ // destructor
+
+ be_visitor_context &operator= (const be_visitor_context &ctx);
+ // assignment operator
+
+ // =helpers
+
+ void reset (void);
+ // reset the context
+
+ void stream (TAO_OutStream *os);
+ // set the output stream
+
+ TAO_OutStream *stream (void);
+ // get the stream
+
+ void scope (be_decl *scope);
+ // set the scope
+
+ be_decl *scope (void);
+ // get the scope in which code will be generated
+
+ void node (be_decl *node);
+ // current node being visited
+
+ be_decl *node (void);
+ // node being visited
+
+ void state (TAO_CodeGen::CG_STATE);
+ // code generation state
+
+ TAO_CodeGen::CG_STATE state (void);
+ // return the code generation state
+
+ void sub_state (TAO_CodeGen::CG_SUB_STATE);
+ // code generation state
+
+ TAO_CodeGen::CG_SUB_STATE sub_state (void);
+ // return the code generation state
+
+ void alias (be_typedef *node);
+ // set the alias node (if any)
+
+ be_typedef *alias (void);
+ // return the aliased node (if any)
+
+ void tdef (be_typedef *node);
+ // set the typedef node (if any)
+
+ be_typedef *tdef (void);
+ // return the typedef node (if any)
+
+ void attribute (be_attribute *attr);
+ // set the attribute node if any
+
+ be_attribute *attribute (void);
+ // get the attribute node
+
+ void exception (bool);
+ // is it the special ctor for exceptions?
+
+ bool exception (void);
+ // is it the special ctor for exceptions?
+
+ void comma (bool);
+ // scope supoorts generation of comma after each element
+
+ bool comma (void);
+ // are we supposed to generate a comma?
+
+ 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
+ // example). This field is use to hold the interface where we are
+ // *generating* code, as opposed to the interfaces where the methods
+ // or structures are defined.
+
+ // = helpers
+
+ // visitors may need the actual type of the node stored in this context. We
+ // could have kept separate nodes but that would have increased the size of
+ // the context class by a large extent. So we will rely on the
+ // "narrow_from_decl" approach
+
+ // two types of helpers are provided here. One of them returns the node as
+ // the desired actual type. The other returns the scope as the desired type.
+
+ be_argument *be_node_as_argument (void);
+ // return the node as argument if possible
+
+ be_array *be_node_as_array (void);
+ // return the node as array if possible
+
+ be_attribute *be_node_as_attribute (void);
+ // return the node as attribute if possible
+
+ be_constant *be_node_as_constant (void);
+ // return the node as constant if possible
+
+ be_enum *be_node_as_enum (void);
+ // return the node as enum if possible
+
+ be_enum_val *be_node_as_enum_val (void);
+ // return the node as enum_val if possible
+
+ be_exception *be_node_as_exception (void);
+ // return the node as exception if possible
+
+ be_field *be_node_as_field (void);
+ // return the node as field if possible
+
+ be_interface *be_node_as_interface (void);
+ // return the node as interface if possible
+
+ be_interface_fwd *be_node_as_interface_fwd (void);
+ // return the node as interface_fwd if possible
+
+ be_module *be_node_as_module (void);
+ // return the node as module if possible
+
+ be_operation *be_node_as_operation (void);
+ // return the node as operation if possible
+
+ be_predefined_type *be_node_as_predefined_type (void);
+ // return the node as predefined_type if possible
+
+ be_root *be_node_as_root (void);
+ // return the node as root if possible
+
+ be_sequence *be_node_as_sequence (void);
+ // return the node as sequence if possible
+
+ be_string *be_node_as_string (void);
+ // return the node as string if possible
+
+ be_structure *be_node_as_structure (void);
+ // return the node as structure if possible
+
+ be_typedef *be_node_as_typedef (void);
+ // return the node as typedef if possible
+
+ be_union *be_node_as_union (void);
+ // return the node as union if possible
+
+ be_union_branch *be_node_as_union_branch (void);
+ // return the node as union_branch if possible
+
+ // for scope
+
+ be_enum *be_scope_as_enum (void);
+ // return the scope as enum if possible
+
+ be_exception *be_scope_as_exception (void);
+ // return the scope as exception if possible
+
+ be_interface *be_scope_as_interface (void);
+ // return the scope as interface if possible
+
+ be_module *be_scope_as_module (void);
+ // return the scope as module if possible
+
+ be_operation *be_scope_as_operation (void);
+ // return the scope as operation if possible
+
+ be_root *be_scope_as_root (void);
+ // return the scope as root if possible
+
+ be_structure *be_scope_as_structure (void);
+ // return the scope as structure if possible
+
+ be_union *be_scope_as_union (void);
+ // return the scope as union if possible
+
+ const char *export_macro (void) const;
+ // return the export macro currently in force
+
+ const char *non_null_export_macro (void) const;
+ // if anyop export macro is empty, check stub.
+
+private:
+ TAO_CodeGen::CG_STATE state_;
+ // code generation state
+
+ TAO_CodeGen::CG_SUB_STATE sub_state_;
+ // code generation state
+
+ TAO_OutStream *os_;
+ // current output stream
+
+ be_decl *scope_;
+ // current scope in which code is generated
+
+ be_decl *node_;
+ // current node
+
+ be_typedef *alias_;
+ // aliased node used as a scoped name to define IDL types.
+
+ be_typedef *tdef_;
+ // typedef node
+
+ be_attribute *attr_;
+ // attribute node stored here while generating its code
+
+ bool exception_;
+ // is it the special ctor for exceptions?
+
+ bool comma_;
+ // whether scope should generate a comma after every element
+
+ be_interface* interface_;
+ // See the method declaration above.
+};
+
+#if defined (interface)
+# define interface aceinterface
+#endif /* interface */
+
+#endif /* BE_VISITOR_CONTEXT_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_decl.h b/TAO/TAO_IDL/be_include/be_visitor_decl.h
new file mode 100644
index 00000000000..ca9132d486a
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_decl.h
@@ -0,0 +1,57 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_decl.h
+//
+// = DESCRIPTION
+// Concrete visitor for the base "BE_Decl" node
+//
+// = AUTHOR
+// Aniruddha Gokhale and Carlos O'Ryan
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_DECL_H
+#define TAO_BE_VISITOR_DECL_H
+
+#include "be_visitor.h"
+#include "be_codegen.h"
+
+class be_visitor_decl : public be_visitor
+{
+ //
+ // = TITLE
+ // be_visitor_decl
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for the be_decl node. Its only purpose is to
+ // maintain state information for the derived visitor
+ //
+public:
+ be_visitor_decl (be_visitor_context *ctx);
+
+ ~be_visitor_decl (void);
+
+ be_visitor_context *ctx (void);
+
+protected:
+ // Using a protected mechanism will allow derived visitors to access this
+ // information.
+
+ be_visitor_context *ctx_;
+ // Any context information required by the visitor.
+
+ int gen_anonymous_base_type (be_type *bt,
+ TAO_CodeGen::CG_STATE cg_state);
+ // Factors out common code used when one anonymous type is
+ // contained by another.
+};
+
+#endif // TAO_BE_VISITOR_DECL_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_enum.h b/TAO/TAO_IDL/be_include/be_visitor_enum.h
new file mode 100644
index 00000000000..130033f4fd8
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_enum.h
@@ -0,0 +1,35 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_enum.h
+//
+// = DESCRIPTION
+// Concrete visitor for the enum class
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_ENUM_H
+#define TAO_BE_VISITOR_ENUM_H
+
+#include "be_visitor_scope.h"
+#include "be_visitor_enum/enum_ch.h"
+#include "be_visitor_enum/enum_cs.h"
+#include "be_visitor_enum/any_op_ch.h"
+#include "be_visitor_enum/any_op_cs.h"
+#include "be_visitor_enum/cdr_op_ch.h"
+#include "be_visitor_enum/cdr_op_cs.h"
+#include "be_visitor_enum/serializer_op_ch.h"
+#include "be_visitor_enum/serializer_op_cs.h"
+
+#endif /* TAO_BE_VISITOR_ENUM_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_enum/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_enum/any_op_ch.h
new file mode 100644
index 00000000000..f9d25ecf81c
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_enum/any_op_ch.h
@@ -0,0 +1,47 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for Enums generating code for the Any operators
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ENUM_ANY_OP_CH_H_
+#define _BE_VISITOR_ENUM_ANY_OP_CH_H_
+
+class be_visitor_enum_any_op_ch : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_enum_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for enum that generates the Any operator
+ // declarations
+ //
+
+public:
+ be_visitor_enum_any_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_enum_any_op_ch (void);
+ // destructor
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum
+};
+
+#endif /* _BE_VISITOR_ENUM_ANY_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_enum/any_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_enum/any_op_cs.h
new file mode 100644
index 00000000000..f3db76c2be4
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_enum/any_op_cs.h
@@ -0,0 +1,47 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for Enums generating code for the Any operators
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ENUM_ANY_OP_CS_H_
+#define _BE_VISITOR_ENUM_ANY_OP_CS_H_
+
+class be_visitor_enum_any_op_cs : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_enum_any_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for enum that generates the Any operator
+ // implementations
+ //
+
+public:
+ be_visitor_enum_any_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_enum_any_op_cs (void);
+ // destructor
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum
+};
+
+#endif /* _BE_VISITOR_ENUM_ANY_OP_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_enum/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_enum/cdr_op_ch.h
new file mode 100644
index 00000000000..70880813b57
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_enum/cdr_op_ch.h
@@ -0,0 +1,47 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for Enums generating code for the CDR operators
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#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_decl
+{
+ //
+ // = TITLE
+ // be_visitor_enum_cdr_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for enum that generates the CDR operator
+ // declarations
+ //
+
+public:
+ be_visitor_enum_cdr_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_enum_cdr_op_ch (void);
+ // destructor
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum
+};
+
+#endif /* _BE_VISITOR_ENUM_CDR_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_enum/cdr_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_enum/cdr_op_cs.h
new file mode 100644
index 00000000000..7c4cdb6235d
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_enum/cdr_op_cs.h
@@ -0,0 +1,47 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for Enums generating code for the CDR operators
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ENUM_CDR_OP_CS_H_
+#define _BE_VISITOR_ENUM_CDR_OP_CS_H_
+
+class be_visitor_enum_cdr_op_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_enum_cdr_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for enum that generates the CDR operator
+ // implementations
+ //
+
+public:
+ be_visitor_enum_cdr_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_enum_cdr_op_cs (void);
+ // destructor
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum
+};
+
+#endif /* _BE_VISITOR_ENUM_CDR_OP_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_enum/enum_ch.h b/TAO/TAO_IDL/be_include/be_visitor_enum/enum_ch.h
new file mode 100644
index 00000000000..8a3f922dce4
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_enum/enum_ch.h
@@ -0,0 +1,56 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// enum_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for Enums generating code in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ENUM_ENUM_CH_H_
+#define _BE_VISITOR_ENUM_ENUM_CH_H_
+
+class be_visitor_enum_ch : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_enum_ch
+ //
+ // = DESCRIPTION
+ // This is the base visitor for enum for the header file
+ //
+ //
+public:
+ be_visitor_enum_ch (be_visitor_context *ctx);
+ // conenumor
+
+ ~be_visitor_enum_ch (void);
+ // deenumor
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum.
+
+ // =visit operations on syntactically valid elements in our scope
+
+ virtual int visit_enum_val (be_enum_val *node);
+ // visit enum_val
+
+ // = helper
+
+ virtual int post_process (be_decl *);
+ // generate a comma after each element is processed
+};
+
+#endif /* _BE_VISITOR_ENUM_ENUM_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_enum/enum_cs.h b/TAO/TAO_IDL/be_include/be_visitor_enum/enum_cs.h
new file mode 100644
index 00000000000..412842ed536
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_enum/enum_cs.h
@@ -0,0 +1,46 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// enum_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for Enums generating code in the client stubs.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ENUM_ENUM_CS_H_
+#define _BE_VISITOR_ENUM_ENUM_CS_H_
+
+class be_visitor_enum_cs : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_enum_cs
+ //
+ // = DESCRIPTION
+ // This is the visitor for enum for the impl file
+ //
+ //
+public:
+ be_visitor_enum_cs (be_visitor_context *ctx);
+ // conenumor
+
+ ~be_visitor_enum_cs (void);
+ // deenumor
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum and generate the typecode
+};
+
+#endif /* _BE_VISITOR_ENUM_ENUM_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_enum/serializer_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_enum/serializer_op_ch.h
new file mode 100644
index 00000000000..6619d36d274
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_enum/serializer_op_ch.h
@@ -0,0 +1,48 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for Enums generating code for the
+// TAO::DCPS::Serializer operators
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ENUM_serializer_op_CH_H_
+#define _BE_VISITOR_ENUM_serializer_op_CH_H_
+
+class be_visitor_enum_serializer_op_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_enum_serializer_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for enum that generates the Serializer operator
+ // declarations
+ //
+
+public:
+ be_visitor_enum_serializer_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_enum_serializer_op_ch (void);
+ // destructor
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum
+};
+
+#endif /* _BE_VISITOR_ENUM_serializer_op_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_enum/serializer_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_enum/serializer_op_cs.h
new file mode 100644
index 00000000000..0af226580d4
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_enum/serializer_op_cs.h
@@ -0,0 +1,48 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for Enums generating code for the
+// TAO::DCPS::Serializer operators
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ENUM_serializer_op_CS_H_
+#define _BE_VISITOR_ENUM_serializer_op_CS_H_
+
+class be_visitor_enum_serializer_op_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_enum_serializer_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for enum that generates the Serializer operator
+ // implementations
+ //
+
+public:
+ be_visitor_enum_serializer_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_enum_serializer_op_cs (void);
+ // destructor
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum
+};
+
+#endif /* _BE_VISITOR_ENUM_serializer_op_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception.h b/TAO/TAO_IDL/be_include/be_visitor_exception.h
new file mode 100644
index 00000000000..bc0d8c761ef
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_exception.h
@@ -0,0 +1,41 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_exception.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Exception class
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_EXCEPTION_H
+#define TAO_BE_VISITOR_EXCEPTION_H
+
+#include "be_visitor_scope.h"
+#include "be_visitor_enum.h"
+#include "be_visitor_structure.h"
+#include "be_visitor_union.h"
+
+#include "be_visitor_exception/exception.h"
+#include "be_visitor_exception/exception_ch.h"
+#include "be_visitor_exception/exception_ci.h"
+#include "be_visitor_exception/exception_cs.h"
+#include "be_visitor_exception/ctor.h"
+#include "be_visitor_exception/ctor_assign.h"
+#include "be_visitor_exception/any_op_ch.h"
+#include "be_visitor_exception/any_op_cs.h"
+#include "be_visitor_exception/cdr_op_ch.h"
+#include "be_visitor_exception/cdr_op_cs.h"
+
+#endif /* TAO_BE_VISITOR_EXCEPTION_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_exception/any_op_ch.h
new file mode 100644
index 00000000000..f027af57be9
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_exception/any_op_ch.h
@@ -0,0 +1,60 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.h
+//
+// = DESCRIPTION
+// Visitor for Exceptions.
+// For code generation of Any operator in client header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_EXCEPTION_ANY_OP_CH_H_
+#define _BE_VISITOR_EXCEPTION_ANY_OP_CH_H_
+
+class be_visitor_exception_any_op_ch : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_exception_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for exception that generates the Any operator
+ // declarations
+ //
+
+public:
+ be_visitor_exception_any_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_exception_any_op_ch (void);
+ // destructor
+
+ virtual int visit_exception (be_exception *node);
+ // visit exception
+
+ virtual int visit_field (be_field *node);
+ // visit field
+
+ virtual int visit_enum (be_enum *node);
+ // visit field
+
+ virtual int visit_structure (be_structure *node);
+ // visit field
+
+ virtual int visit_union (be_union *node);
+ // visit field
+};
+
+#endif /* _BE_VISITOR_EXCEPTION_ANY_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/any_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_exception/any_op_cs.h
new file mode 100644
index 00000000000..6055997d1cb
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_exception/any_op_cs.h
@@ -0,0 +1,60 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.h
+//
+// = DESCRIPTION
+// Visitor for Exceptions.
+// For code generation of Any operator in client stubs
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_EXCEPTION_ANY_OP_CS_H_
+#define _BE_VISITOR_EXCEPTION_ANY_OP_CS_H_
+
+class be_visitor_exception_any_op_cs : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_exception_any_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for exception that generates the Any operator
+ // implementations
+ //
+
+public:
+ be_visitor_exception_any_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_exception_any_op_cs (void);
+ // destructor
+
+ virtual int visit_exception (be_exception *node);
+ // visit exception
+
+ virtual int visit_field (be_field *node);
+ // visit field
+
+ virtual int visit_enum (be_enum *node);
+ // visit field
+
+ virtual int visit_structure (be_structure *node);
+ // visit field
+
+ virtual int visit_union (be_union *node);
+ // visit field
+};
+
+#endif /* _BE_VISITOR_EXCEPTION_ANY_OP_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_exception/cdr_op_ch.h
new file mode 100644
index 00000000000..dd5df6266e2
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_exception/cdr_op_ch.h
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Exception class
+// This one provides code generation for the CDR operators for the exception
+// in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_EXCEPTION_CDR_OP_CH_H_
+#define _BE_VISITOR_EXCEPTION_CDR_OP_CH_H_
+
+class be_visitor_exception_cdr_op_ch : public be_visitor_exception
+{
+ //
+ // = TITLE
+ // be_visitor_exception_cdr_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for exception that generates the CDR operator
+ // declarations
+ //
+
+public:
+ be_visitor_exception_cdr_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_exception_cdr_op_ch (void);
+ // destructor
+
+ virtual int visit_exception (be_exception *node);
+ // visit exception
+
+};
+
+#endif /* _BE_VISITOR_EXCEPTION_CDR_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/cdr_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_exception/cdr_op_cs.h
new file mode 100644
index 00000000000..a77f6c4bdf7
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_exception/cdr_op_cs.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Exception class
+// This one provides code generation for the CDR operators for the exception
+// in the client stub.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_EXCEPTION_CDR_OP_CS_H_
+#define _BE_VISITOR_EXCEPTION_CDR_OP_CS_H_
+
+class be_visitor_exception_cdr_op_cs : public be_visitor_exception
+{
+ //
+ // = TITLE
+ // be_visitor_exception_cdr_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for exception that generates the CDR operator
+ // implementations
+ //
+
+public:
+ be_visitor_exception_cdr_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_exception_cdr_op_cs (void);
+ // destructor
+
+ virtual int visit_exception (be_exception *node);
+ // visit exception
+
+ virtual int post_process (be_decl *);
+ // any post processing that needs to be done after a scope element is handled
+};
+
+#endif /* _BE_VISITOR_EXCEPTION_CDR_OP_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/ctor.h b/TAO/TAO_IDL/be_include/be_visitor_exception/ctor.h
new file mode 100644
index 00000000000..bdb52021a4e
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_exception/ctor.h
@@ -0,0 +1,95 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// ctor.h
+//
+// = DESCRIPTION
+// Visitor for Exceptions.
+// For code generation for the special constructor for exceptions
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_EXCEPTION_CTOR_H_
+#define _BE_VISITOR_EXCEPTION_CTOR_H_
+
+class be_visitor_exception_ctor : public be_visitor_scope
+{
+ // =TITLE
+ // be_visitor_exception_ctor
+ //
+ // =DESCRIPTION
+ // generation of the special constructor
+public:
+ be_visitor_exception_ctor (be_visitor_context *ctx);
+ // ctor
+
+ ~be_visitor_exception_ctor (void);
+ // dtor
+
+ virtual int post_process (be_decl *);
+ // post processing after each element
+
+ virtual int visit_exception (be_exception *node);
+ // visit exception. We provide code for this method in the derived class
+
+ virtual int visit_field (be_field *node);
+ // visit the argument node
+
+ // =visit all the nodes that can be the types for the field
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_enum (be_enum *node);
+ // visit the enum node
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit interface forward
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit valuebox
+
+ 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
+
+ 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
+
+private:
+ int emit_common (be_type *node);
+
+};
+
+#endif /* _BE_VISITOR_EXCEPTION_CTOR_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/ctor_assign.h b/TAO/TAO_IDL/be_include/be_visitor_exception/ctor_assign.h
new file mode 100644
index 00000000000..ab1e501afe8
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_exception/ctor_assign.h
@@ -0,0 +1,94 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// ctor_assign.h
+//
+// = DESCRIPTION
+// Visitor for Exceptions.
+// For code generation for the special constructor and assignment operator
+// for exceptions.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_EXCEPTION_CTOR_ASSIGN_H_
+#define _BE_VISITOR_EXCEPTION_CTOR_ASSIGN_H_
+
+class be_visitor_exception_ctor_assign : public be_visitor_scope
+{
+ // =TITLE
+ // be_visitor_exception_ctor_assign
+ //
+ // =DESCRIPTION
+ // generation of the assignment statements in
+public:
+ be_visitor_exception_ctor_assign (be_visitor_context *ctx);
+ // ctor
+
+ ~be_visitor_exception_ctor_assign (void);
+ // dtor
+
+ virtual int visit_exception (be_exception *node);
+ // visit exception.
+
+ virtual int visit_field (be_field *node);
+ // visit the field node
+
+ // =visit all the nodes that can be the types for the field
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_enum (be_enum *node);
+ // visit the enum node
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit interface forward
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit valuebox
+
+ 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
+
+ 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
+
+private:
+ int emit_valuetype_common (be_type *node);
+
+
+};
+
+#endif /* _BE_VISITOR_EXCEPTION_CTOR_ASSIGN_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/exception.h b/TAO/TAO_IDL/be_include/be_visitor_exception/exception.h
new file mode 100644
index 00000000000..c4be6b317dc
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_exception/exception.h
@@ -0,0 +1,52 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// exception.h
+//
+// = DESCRIPTION
+// Visitor for Exceptions.
+// This is the generic (common) visitor for all exceptions.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_EXCEPTION_EXCEPTION_H_
+#define _BE_VISITOR_EXCEPTION_EXCEPTION_H_
+
+class be_visitor_exception : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_exception
+ //
+ // = DESCRIPTION
+ // This is the base visitor for exception
+ //
+ //
+public:
+ be_visitor_exception (be_visitor_context *ctx);
+ // ctor
+
+ ~be_visitor_exception (void);
+ // dtor
+
+ virtual int visit_exception (be_exception *node);
+ // visit exception. We provide code for this method in the derived class
+
+ // =visit operations on syntactically valid elements in our scope
+
+ virtual int visit_field (be_field *node);
+ // visit field
+};
+
+#endif /* _BE_VISITOR_EXCEPTION_EXCEPTION_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/exception_ch.h b/TAO/TAO_IDL/be_include/be_visitor_exception/exception_ch.h
new file mode 100644
index 00000000000..c664d166593
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_exception/exception_ch.h
@@ -0,0 +1,48 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// exception_ch.h
+//
+// = DESCRIPTION
+// Visitor for Exceptions.
+// For code generation in client header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_EXCEPTION_EXCEPTION_CH_H_
+#define _BE_VISITOR_EXCEPTION_EXCEPTION_CH_H_
+
+class be_visitor_exception_ch : public be_visitor_exception
+{
+ //
+ // = TITLE
+ // be_visitor_exception_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client header for exception
+ //
+ //
+public:
+ be_visitor_exception_ch (be_visitor_context *ctx);
+ // constructureor
+
+ ~be_visitor_exception_ch (void);
+ // destructureor
+
+ virtual int visit_exception (be_exception *node);
+ // visit exception. We provide code for this method in the derived class
+
+};
+
+#endif /* _BE_VISITOR_EXCEPTION_EXCEPTION_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/exception_ci.h b/TAO/TAO_IDL/be_include/be_visitor_exception/exception_ci.h
new file mode 100644
index 00000000000..ccd48fbb07b
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_exception/exception_ci.h
@@ -0,0 +1,48 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// exception_ci.h
+//
+// = DESCRIPTION
+// Visitor for Exceptions.
+// For code generation in client inline.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_EXCEPTION_EXCEPTION_CI_H_
+#define _BE_VISITOR_EXCEPTION_EXCEPTION_CI_H_
+
+class be_visitor_exception_ci : public be_visitor_exception
+{
+ //
+ // = TITLE
+ // be_visitor_exception_ci
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client inline for exception
+ //
+ //
+public:
+ be_visitor_exception_ci (be_visitor_context *ctx);
+ // ctor
+
+ ~be_visitor_exception_ci (void);
+ // dtor
+
+ virtual int visit_exception (be_exception *node);
+ // visit exception.
+
+};
+
+#endif /* _BE_VISITOR_EXCEPTION_EXCEPTION_CI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/exception_cs.h b/TAO/TAO_IDL/be_include/be_visitor_exception/exception_cs.h
new file mode 100644
index 00000000000..a3d0c0e9c62
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_exception/exception_cs.h
@@ -0,0 +1,48 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// exception_cs.h
+//
+// = DESCRIPTION
+// Visitor for Exceptions.
+// For code generation in client stubs.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_EXCEPTION_EXCEPTION_CS_H_
+#define _BE_VISITOR_EXCEPTION_EXCEPTION_CS_H_
+
+class be_visitor_exception_cs : public be_visitor_exception
+{
+ //
+ // = TITLE
+ // be_visitor_exception_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client stubs for exception
+ //
+ //
+public:
+ be_visitor_exception_cs (be_visitor_context *ctx);
+ // ctor
+
+ ~be_visitor_exception_cs (void);
+ // dtor
+
+ virtual int visit_exception (be_exception *node);
+ // visit exception. We provide code for this method in the derived class
+
+};
+
+#endif /* _BE_VISITOR_EXCEPTION_EXCEPTION_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/exception_ctor.h b/TAO/TAO_IDL/be_include/be_visitor_exception/exception_ctor.h
new file mode 100644
index 00000000000..fd0ddf8ff0c
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_exception/exception_ctor.h
@@ -0,0 +1,83 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// exception_ctor.h
+//
+// = DESCRIPTION
+// Visitor for Exceptions.
+// For code generation for the special constructor for exceptions
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_EXCEPTION_EXCEPTION_CTOR_H_
+#define _BE_VISITOR_EXCEPTION_EXCEPTION_CTOR_H_
+
+class be_visitor_exception_ctor : public be_visitor_scope
+{
+ // =TITLE
+ // be_visitor_exception_ctor
+ //
+ // =DESCRIPTION
+ // generation of the special constructor
+public:
+ be_visitor_exception_ctor (be_visitor_context *ctx);
+ // ctor
+
+ ~be_visitor_exception_ctor (void);
+ // dtor
+
+ virtual int post_process (be_decl *);
+ // post processing after each element
+
+ virtual int visit_exception (be_exception *node);
+ // visit exception. We provide code for this method in the derived class
+
+ virtual int visit_field (be_field *node);
+ // visit the argument node
+
+ // =visit all the nodes that can be the types for the field
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_enum (be_enum *node);
+ // visit the enum node
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit interface forward
+
+ virtual int visit_predefined_type (be_predefined_type *node);
+ // visit predefined type
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence type
+
+ virtual int visit_string (be_string *node);
+ // visit string type
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure type
+
+ virtual int visit_union (be_union *node);
+ // visit union type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit the typedef type
+
+};
+
+#endif /* _BE_VISITOR_EXCEPTION_EXCEPTION_CTOR_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_factory.h b/TAO/TAO_IDL/be_include/be_visitor_factory.h
new file mode 100644
index 00000000000..2aa1f9e61d7
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_factory.h
@@ -0,0 +1,51 @@
+// $Id$
+
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL Backend
+//
+// = FILENAME
+// be_visitor_factory.h
+//
+// = DESCRIPTION
+// Define a visitor Factory which is a singleton.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_FACTORY_H
+#define TAO_BE_VISITOR_FACTORY_H
+
+#include "ace/Singleton.h"
+#include "ace/Synch_Traits.h"
+
+class be_visitor;
+class be_visitor_context;
+
+class TAO_Visitor_Factory
+{
+ // =TITLE
+ // TAO_Visitor_Factory
+ //
+ // =DESCRIPTION
+ // Visitor factory class
+
+public:
+
+ TAO_Visitor_Factory (void);
+
+ ~TAO_Visitor_Factory (void);
+
+ be_visitor *make_visitor (be_visitor_context *);
+ // Make a visitor.
+};
+
+// 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
new file mode 100644
index 00000000000..cf2fcec1cf2
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_field.h
@@ -0,0 +1,35 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_field.h
+//
+// = DESCRIPTION
+// Concrete visitor for the base "BE_Field" node
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_FIELD_H
+#define TAO_BE_VISITOR_FIELD_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"
+#include "be_visitor_field/cdr_op_ch.h"
+#include "be_visitor_field/cdr_op_cs.h"
+#include "be_visitor_field/serializer_op_ch.h"
+#include "be_visitor_field/serializer_op_cs.h"
+
+#endif /* TAO_BE_VISITOR_FIELD_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
new file mode 100644
index 00000000000..16cad59d193
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_ch.h
@@ -0,0 +1,65 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the base "BE_Field" node
+// This generates code for structure members in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_FIELD_CDR_OP_CH_H_
+#define _BE_VISITOR_FIELD_CDR_OP_CH_H_
+
+class be_visitor_field_cdr_op_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_cdr_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for the be_field node for the client header.
+ //
+public:
+ be_visitor_field_cdr_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_field_cdr_op_ch (void);
+ // destructor
+
+ virtual int visit_field (be_field *node);
+ // visit the field node
+
+ // =visit operations on all possible data types that a field can be
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum type
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence type
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedefed type
+
+ virtual int visit_union (be_union *node);
+ // visit union type
+};
+
+#endif /* _BE_VISITOR_FIELD_CDR_OP_CH_H_ */
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
new file mode 100644
index 00000000000..37b2f217116
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_cs.h
@@ -0,0 +1,96 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the base "BE_Field" node
+// This generates code for structure members in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_FIELD_CDR_OP_CS_H_
+#define _BE_VISITOR_FIELD_CDR_OP_CS_H_
+
+class be_visitor_field_cdr_op_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_field_cdr_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for the be_field node for the client header.
+ //
+public:
+ be_visitor_field_cdr_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_field_cdr_op_cs (void);
+ // destructor
+
+ virtual int visit_field (be_field *node);
+ // visit the field node
+
+ // =visit operations on all possible data types that a field can be
+
+ virtual int visit_array (be_array *node);
+ virtual int visit_enum (be_enum *node);
+ virtual int visit_interface (be_interface *node);
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ virtual int visit_component (be_component *node);
+ virtual int visit_component_fwd (be_component_fwd *node);
+ virtual int visit_valuebox (be_valuebox *node);
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ virtual int visit_eventtype (be_eventtype *node);
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+ virtual int visit_predefined_type (be_predefined_type *node);
+ virtual int visit_sequence (be_sequence *node);
+ virtual int visit_string (be_string *node);
+ virtual int visit_structure (be_structure *node);
+ virtual int visit_typedef (be_typedef *node);
+ virtual int visit_union (be_union *node);
+
+ private:
+ int emit_valuetype_common (void);
+};
+
+class be_visitor_cdr_op_field_decl : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_cdr_op_ci_field_decl
+ //
+ // = DESCRIPTION
+ // When generating CDR operators for fields of structures and/or
+ // unions it may be necessary to define some local variables (for
+ // instance to hold temporary T_forany objects); this visitor
+ // generates that code.
+ //
+public:
+ be_visitor_cdr_op_field_decl (be_visitor_context *ctx);
+ // constructor
+
+ virtual int visit_field (be_field *node);
+ // visit the field node
+
+ // = visit operations for data types that require a local variable.
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef type
+};
+
+#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
new file mode 100644
index 00000000000..5786bd19c6c
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_field/field_ch.h
@@ -0,0 +1,101 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the base "BE_Field" node
+// This generates code for structure members in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_FIELD_CH_H_
+#define _BE_VISITOR_FIELD_CH_H_
+
+class be_visitor_field_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_field_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for the be_field node for the client header.
+ //
+public:
+ be_visitor_field_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_field_ch (void);
+ // destructor
+
+ virtual int visit_field (be_field *node);
+ // visit the field node
+
+ // =visit operations on all possible data types that a field can be
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum type
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface type
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit interface forward type
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit valuebox type
+
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit valuetype type
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit valuetype 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
+
+ virtual int visit_component (be_component *node);
+ // visit a component node
+
+ virtual int visit_component_fwd (be_component_fwd *node);
+ // visit a forward declared component node
+
+ virtual int visit_eventtype (be_eventtype *node);
+ // visit an eventtype node
+
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+ // visit a forward declared eventtype node
+
+ private:
+ int emit_common (be_type *node);
+};
+
+#endif /* _BE_VISITOR_FIELD_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_field/field_ci.h b/TAO/TAO_IDL/be_include/be_visitor_field/field_ci.h
new file mode 100644
index 00000000000..583a6fd92c9
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_field/field_ci.h
@@ -0,0 +1,64 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_ci.h
+//
+// = DESCRIPTION
+// Concrete visitor for the base "BE_Field" node
+// This generates code for structure members in the client inline.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_FIELD_CI_H_
+#define _BE_VISITOR_FIELD_CI_H_
+
+class be_visitor_field_ci : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_field_ci
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for the be_field node for the client inline
+ // file
+ //
+public:
+ be_visitor_field_ci (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_field_ci (void);
+ // destructor
+
+ virtual int visit_field (be_field *node);
+ // visit the field node
+
+ // =visit operations on all possible data types that a field can be and for
+ // which inline code must be generated
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence type
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedefed type
+
+ virtual int visit_union (be_union *node);
+ // visit union type
+};
+
+#endif /* _BE_VISITOR_FIELD_CI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_field/field_cs.h b/TAO/TAO_IDL/be_include/be_visitor_field/field_cs.h
new file mode 100644
index 00000000000..787babe68f9
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_field/field_cs.h
@@ -0,0 +1,67 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the base "BE_Field" node
+// This generates code for structure members in the client stubs.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_FIELD_CS_H_
+#define _BE_VISITOR_FIELD_CS_H_
+
+class be_visitor_field_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_field_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for the be_field node for the client stubs
+ // file
+ //
+public:
+ be_visitor_field_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_field_cs (void);
+ // destructor
+
+ virtual int visit_field (be_field *node);
+ // visit the field node
+
+ // =visit operations on all possible data types that a field can be and impl
+ // code must be generated
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum type
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence type
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedefed type
+
+ virtual int visit_union (be_union *node);
+ // visit union type
+};
+
+#endif /* _BE_VISITOR_FIELD_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_field/serializer_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_field/serializer_op_ch.h
new file mode 100644
index 00000000000..ea3092716de
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_field/serializer_op_ch.h
@@ -0,0 +1,66 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the base "BE_Field" node
+// This generates TAO::DCPS::Serializer operators code for structure members
+// in the client header.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_FIELD_serializer_op_CH_H_
+#define _BE_VISITOR_FIELD_serializer_op_CH_H_
+
+class be_visitor_field_serializer_op_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_serializer_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for the be_field node for the client header.
+ //
+public:
+ be_visitor_field_serializer_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_field_serializer_op_ch (void);
+ // destructor
+
+ virtual int visit_field (be_field *node);
+ // visit the field node
+
+ // =visit operations on all possible data types that a field can be
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum type
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence type
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedefed type
+
+ virtual int visit_union (be_union *node);
+ // visit union type
+};
+
+#endif /* _BE_VISITOR_FIELD_serializer_op_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_field/serializer_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_field/serializer_op_cs.h
new file mode 100644
index 00000000000..79d679cc8e8
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_field/serializer_op_cs.h
@@ -0,0 +1,93 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the base "BE_Field" node
+// This generates TAO::DCPS::Serializer operators code for structure members
+// in the client header.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_FIELD_serializer_op_CS_H_
+#define _BE_VISITOR_FIELD_serializer_op_CS_H_
+
+class be_visitor_field_serializer_op_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_field_serializer_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for the be_field node for the client header.
+ //
+public:
+ be_visitor_field_serializer_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_field_serializer_op_cs (void);
+ // destructor
+
+ virtual int visit_field (be_field *node);
+ // visit the field node
+
+ // =visit operations on all possible data types that a field can be
+
+ virtual int visit_array (be_array *node);
+ virtual int visit_enum (be_enum *node);
+ virtual int visit_interface (be_interface *node);
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ virtual int visit_component (be_component *node);
+ virtual int visit_component_fwd (be_component_fwd *node);
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ virtual int visit_eventtype (be_eventtype *node);
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+ virtual int visit_predefined_type (be_predefined_type *node);
+ virtual int visit_sequence (be_sequence *node);
+ virtual int visit_string (be_string *node);
+ virtual int visit_structure (be_structure *node);
+ virtual int visit_typedef (be_typedef *node);
+ virtual int visit_union (be_union *node);
+};
+
+class be_visitor_serializer_op_field_decl : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_serializer_op_ci_field_decl
+ //
+ // = DESCRIPTION
+ // When generating TAO::DCPS::Serializer operators for fields of structures and/or
+ // unions it may be necessary to define some local variables (for
+ // instance to hold temporary T_forany objects); this visitor
+ // generates that code.
+ //
+public:
+ be_visitor_serializer_op_field_decl (be_visitor_context *ctx);
+ // constructor
+
+ virtual int visit_field (be_field *node);
+ // visit the field node
+
+ // = visit operations for data types that require a local variable.
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef type
+};
+
+#endif /* _BE_VISITOR_FIELD_serializer_op_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..f8fa355bcdd
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_home.h
@@ -0,0 +1,31 @@
+/* -*- 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_decl.h"
+#include "be_visitor_typecode/typecode_decl.h"
+
+#include "be_visitor_home/home_ch.h"
+#include "be_visitor_home/home_cs.h"
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_visitor_home/home_ch.h b/TAO/TAO_IDL/be_include/be_visitor_home/home_ch.h
new file mode 100644
index 00000000000..79fe815e178
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_home/home_ch.h
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// home_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component Home node.
+// This one provides code generation for component home node.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_HOME_CH_H_
+#define _BE_VISITOR_HOME_CH_H_
+
+class be_visitor_home_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_home_ch
+ //
+ // = DESCRIPTION
+ // This is the visitor for component home for the header file
+ //
+ //
+public:
+ be_visitor_home_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_home_ch (void);
+ // destructor
+
+ virtual int visit_home (be_home *node);
+ // visit home.
+};
+
+#endif /* _BE_VISITOR_HOME_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_home/home_cs.h b/TAO/TAO_IDL/be_include/be_visitor_home/home_cs.h
new file mode 100644
index 00000000000..77c1a60f7e6
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_home/home_cs.h
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// home_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component Home node.
+// This one provides code generation for component home node.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_HOME_CS_H_
+#define _BE_VISITOR_HOME_CS_H_
+
+class be_visitor_home_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_home_cs
+ //
+ // = DESCRIPTION
+ // This is the visitor for component home for the source file
+ //
+ //
+public:
+ be_visitor_home_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_home_cs (void);
+ // destructor
+
+ virtual int visit_home (be_home *node);
+ // visit home.
+};
+
+#endif /* _BE_VISITOR_HOME_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface.h b/TAO/TAO_IDL/be_include/be_visitor_interface.h
new file mode 100644
index 00000000000..996495375c7
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface.h
@@ -0,0 +1,63 @@
+
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_interface.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface class
+//
+// = AUTHOR
+// Carlos O'Ryan and Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_INTERFACE_H
+#define TAO_BE_VISITOR_INTERFACE_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"
+#include "be_visitor_interface/interface_cs.h"
+#include "be_visitor_interface/interface_sh.h"
+#include "be_visitor_interface/interface_ih.h"
+#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/any_op_ch.h"
+#include "be_visitor_interface/any_op_cs.h"
+#include "be_visitor_interface/cdr_op_ch.h"
+#include "be_visitor_interface/cdr_op_cs.h"
+#include "be_visitor_interface/tie_sh.h"
+#include "be_visitor_interface/tie_si.h"
+#include "be_visitor_interface/ami_interface_ch.h"
+#include "be_visitor_interface/smart_proxy_ch.h"
+#include "be_visitor_interface/smart_proxy_cs.h"
+
+// Proxy Brokers
+#include "be_visitor_interface/strategized_proxy_broker_sh.h"
+#include "be_visitor_interface/strategized_proxy_broker_ss.h"
+
+// Proxy Impls
+#include "be_visitor_interface/direct_proxy_impl_sh.h"
+#include "be_visitor_interface/direct_proxy_impl_ss.h"
+
+// AMH
+#include "be_visitor_interface/amh_ch.h"
+#include "be_visitor_interface/amh_sh.h"
+#include "be_visitor_interface/amh_si.h"
+#include "be_visitor_interface/amh_ss.h"
+#include "be_visitor_interface/amh_rh_sh.h"
+#include "be_visitor_interface/amh_rh_ss.h"
+
+#endif /* _BE_VISITOR_INTERFACE_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_ch.h
new file mode 100644
index 00000000000..35e5a07ca48
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_ch.h
@@ -0,0 +1,47 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// amh_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the AMH-RH Interface node.
+// This one provides code generation for interfaces in the client
+// header.
+//
+// = AUTHOR
+// Mayur Deshpande
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_AMH_INTERFACE_CH_H_
+#define _BE_INTERFACE_AMH_INTERFACE_CH_H_
+
+class be_visitor_amh_interface_ch : public be_visitor_interface
+{
+ //
+ // = TITLE
+ // be_visitor_amh_interface_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client header for
+ // AMH interface
+ //
+public:
+ be_visitor_amh_interface_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_amh_interface_ch (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_INTERFACE_AMH_INTERFACE_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_rh_sh.h b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_rh_sh.h
new file mode 100644
index 00000000000..c44129329d8
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_rh_sh.h
@@ -0,0 +1,31 @@
+//=============================================================================
+/**
+ * @file amh_rh_sh.h
+ *
+ * $Id$
+ *
+ * Specialized visitor for AMH ResponseHandler (RH) that generates
+ * code for the RH interface in the skeleton header
+ *
+ * @author Mayur Deshpande <mayur@ics.uci.edu>
+ */
+//=============================================================================
+
+#ifndef AMH_RH_SH_H_
+#define AMH_RH_SH_H_
+
+class be_visitor_amh_rh_interface_sh : public be_visitor_interface_sh
+{
+public:
+ be_visitor_amh_rh_interface_sh (void);
+
+ be_visitor_amh_rh_interface_sh (be_visitor_context *ctx);
+
+ ~be_visitor_amh_rh_interface_sh (void);
+
+ virtual int visit_interface (be_interface *node);
+
+ virtual int visit_operation (be_operation *node);
+};
+
+#endif /* AMH_RH_SH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_rh_ss.h b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_rh_ss.h
new file mode 100644
index 00000000000..54013f43791
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_rh_ss.h
@@ -0,0 +1,30 @@
+//=============================================================================
+/**
+ * @file amh_rh_ss.h
+ *
+ * $Id$
+ *
+ * Specialized visitor for AMH-ResponseHandler that generates code for the
+ * RH in the skeleton source file
+ *
+ * @author Mayur Deshpande <mayur@ics.uci.edu>
+ */
+//=============================================================================
+
+#ifndef AMH_RH_INTERFACE_SS_H
+#define AMH_RH_INTERFACE_SS_H
+
+
+class be_visitor_amh_rh_interface_ss : public be_visitor_interface_ss
+{
+public:
+ be_visitor_amh_rh_interface_ss (be_visitor_context *ctx);
+
+ int visit_interface (be_interface *node);
+
+ int visit_operation (be_operation *node);
+
+ ~be_visitor_amh_rh_interface_ss (void);
+};
+
+#endif /* AMH_RH_INTERFACE_SS_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_sh.h b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_sh.h
new file mode 100644
index 00000000000..8610ca7c579
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_sh.h
@@ -0,0 +1,45 @@
+//=============================================================================
+/**
+ * @file amh_sh.h
+ *
+ * $Id$
+ *
+ * Specialized interface visitor for AMH
+ *
+ * @author Darrell Brunsch <brunsch@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef AMH_SH_H_
+#define AMH_SH_H_
+
+class be_visitor_amh_interface_sh : public be_visitor_interface_sh
+{
+public:
+ be_visitor_amh_interface_sh (be_visitor_context *ctx);
+ ~be_visitor_amh_interface_sh (void);
+
+ int visit_interface (be_interface *node);
+ int visit_operation (be_operation *node);
+ int visit_attribute (be_attribute *node);
+
+protected:
+ virtual void this_method (be_interface *node);
+
+private:
+ /// Create an AMH node 'on the fly' from the
+ /// original interface node
+ be_interface* create_amh_class (ACE_CString name);
+
+ /// Add attributes and operations from original-interface
+ /// into the newly created AMH-node
+ int add_original_members (be_interface *node,
+ be_interface *amh_node);
+
+ /// For every operation in the original-interface, create
+ /// an AMH-operation and add it to the newly created AMH-node
+ int add_amh_operation (be_operation *orig_operation,
+ be_interface *amh_node);
+};
+
+#endif /* AMH_SH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_si.h b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_si.h
new file mode 100644
index 00000000000..bbd8e6723c4
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_si.h
@@ -0,0 +1,31 @@
+//=============================================================================
+/**
+ * @file amh_si.h
+ *
+ * $Id$
+ *
+ * Specialized interface visitor for AMH
+ *
+ * @author Jeff Parsons <j.parsons@vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef AMH_SH_I_
+#define AMH_SH_I_
+
+class be_visitor_amh_interface_si : public be_visitor_interface_si
+{
+public:
+ be_visitor_amh_interface_si (be_visitor_context *ctx);
+ ~be_visitor_amh_interface_si (void);
+
+ int visit_interface (be_interface *node);
+
+ static int gen_skel_helper (be_interface *,
+ be_interface *,
+ TAO_OutStream *);
+ // Helper method passed to the template method to generate code for the
+ // AMH skeletons in the inline files.
+};
+
+#endif /* AMH_SH_I_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_ss.h b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_ss.h
new file mode 100644
index 00000000000..c65578519df
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_ss.h
@@ -0,0 +1,47 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file amh_ss.h
+ *
+ * $Id$
+ *
+ * Specialized interface visitor for AMH
+ *
+ * @author Darrell Brunsch <brunsch@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef AMH_INTERFACE_SS_H
+#define AMH_INTERFACE_SS_H
+
+
+class be_visitor_amh_interface_ss : public be_visitor_interface_ss
+{
+public:
+ be_visitor_amh_interface_ss (be_visitor_context *ctx);
+
+ int visit_interface (be_interface *node);
+ int visit_operation (be_operation *node);
+ int visit_attribute (be_attribute *node);
+
+ ~be_visitor_amh_interface_ss (void);
+
+protected:
+ virtual void this_method (be_interface *node);
+ virtual void dispatch_method (be_interface *node);
+
+ virtual void generate_send_reply (TAO_OutStream * os);
+
+ virtual int generate_amh_classes (be_interface *node);
+ virtual int generate_proxy_classes (be_interface *node);
+// virtual int generate_downcast_implementation (be_interface *node,
+// TAO_OutStream *os);
+ virtual int generate_copy_ctor (be_interface *node,
+ TAO_OutStream *os);
+ virtual ACE_CString generate_flat_name (be_interface *node);
+ virtual ACE_CString generate_local_name (be_interface *node);
+ virtual ACE_CString generate_full_skel_name (be_interface *node);
+};
+
+#endif /* AMH_INTERFACE_SS_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/ami_interface_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface/ami_interface_ch.h
new file mode 100644
index 00000000000..2cd4ba82fab
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/ami_interface_ch.h
@@ -0,0 +1,49 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the AMI Interface node.
+// This one provides code generation for interfaces in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_AMI_INTERFACE_CH_H_
+#define _BE_INTERFACE_AMI_INTERFACE_CH_H_
+
+// we need derived interface visitors for the client and server header files. For
+// the others, they use the default interface visitor
+
+class be_visitor_ami_interface_ch : public be_visitor_interface
+{
+ //
+ // = TITLE
+ // be_visitor_interface_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client header for interface
+ //
+ //
+public:
+ be_visitor_ami_interface_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_ami_interface_ch (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_INTERFACE_AMI_INTERFACE_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface/any_op_ch.h
new file mode 100644
index 00000000000..0b25ff3f3be
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/any_op_ch.h
@@ -0,0 +1,47 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node.
+// This one provides code generation for the Any operators
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_ANY_OP_CH_H_
+#define _BE_INTERFACE_ANY_OP_CH_H_
+
+class be_visitor_interface_any_op_ch : public be_visitor_interface
+{
+ //
+ // = TITLE
+ // be_visitor_interface_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for interface that generates the Any operator
+ // declarations
+ //
+
+public:
+ be_visitor_interface_any_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_interface_any_op_ch (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface
+};
+
+#endif /* _BE_INTERFACE_ANY_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/any_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_interface/any_op_cs.h
new file mode 100644
index 00000000000..aa84f6fd2c9
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/any_op_cs.h
@@ -0,0 +1,47 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node.
+// This one provides code generation for the Any operators
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_ANY_OP_CS_H_
+#define _BE_INTERFACE_ANY_OP_CS_H_
+
+class be_visitor_interface_any_op_cs : public be_visitor_interface
+{
+ //
+ // = TITLE
+ // be_visitor_interface_any_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for interface that generates the Any operator
+ // implementations
+ //
+
+public:
+ be_visitor_interface_any_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_interface_any_op_cs (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface
+};
+
+#endif /* _BE_INTERFACE_ANY_OP_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/base_proxy_broker_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface/base_proxy_broker_ch.h
new file mode 100644
index 00000000000..5c4f36fdb1f
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/base_proxy_broker_ch.h
@@ -0,0 +1,44 @@
+//$Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// base_proxy_broker_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node. This
+// visitor generates the declaration for the base
+// ProxyBroker class.
+//
+// = AUTHOR
+// Angelo Corsaro <corsaro@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef BE_BASE_PROXY_BROKER_CH_H_
+#define BE_BASE_PROXY_BROKER_CH_H_
+
+class be_visitor_interface_base_proxy_broker_ch : public be_visitor_interface
+{
+ // = TITLE
+ // Generates the declaration for the base proxy
+ // broker class.
+
+public:
+ // -- Ctor/Dtor Decl. --
+ be_visitor_interface_base_proxy_broker_ch (be_visitor_context *ctx);
+
+ virtual ~be_visitor_interface_base_proxy_broker_ch (void);
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface
+
+ virtual int visit_component (be_component *node);
+ // This will just call the above method - no need to create
+ // another set of visitors for this stuff.
+};
+
+#endif /* BE_BASE_PROXY_BROKER_CH_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
new file mode 100644
index 00000000000..4df4ef8d872
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/base_proxy_impl_ch.h
@@ -0,0 +1,50 @@
+//$Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// base_proxy_impl_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node. This
+// visitor handle the generation of the proxy
+// implementations base clas.
+//
+// = AUTHOR
+// Angelo Corsaro <corsaro@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef BE_BASE_PROXY_IMPL_CH_H_
+#define BE_BASE_PROXY_IMPL_CH_H_
+
+class be_visitor_interface_base_proxy_impl_ch : public be_visitor_interface
+{
+ // = TITLE
+ // Generates the declaration for the base proxy
+ // implementation classes.
+
+public:
+ // -- Ctor/Dtor Decl. --
+ be_visitor_interface_base_proxy_impl_ch (be_visitor_context *ctx);
+
+ virtual ~be_visitor_interface_base_proxy_impl_ch (void);
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface
+
+ virtual int visit_component (be_component *node);
+ // This will just call the above method - no need to create
+ // another set of visitors for this stuff.
+
+ 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
new file mode 100644
index 00000000000..9d4a989f36d
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/cdr_op_ch.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface class
+// This one provides code generation for the CDR operators for the interface
+// in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_INTERFACE_CDR_OP_CH_H_
+#define _BE_VISITOR_INTERFACE_CDR_OP_CH_H_
+
+class be_visitor_interface_cdr_op_ch : public be_visitor_interface
+{
+ //
+ // = TITLE
+ // be_visitor_interface_cdr_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for interface that generates the CDR operator
+ // declarations
+ //
+
+public:
+ be_visitor_interface_cdr_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_interface_cdr_op_ch (void);
+ // destructor
+
+ 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_cs.h b/TAO/TAO_IDL/be_include/be_visitor_interface/cdr_op_cs.h
new file mode 100644
index 00000000000..9d684ff8e9d
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/cdr_op_cs.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface class
+// This one provides code generation for the CDR operators for the interface
+// in the client stub.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_INTERFACE_CDR_OP_CS_H_
+#define _BE_VISITOR_INTERFACE_CDR_OP_CS_H_
+
+class be_visitor_interface_cdr_op_cs : public be_visitor_interface
+{
+ //
+ // = TITLE
+ // be_visitor_interface_cdr_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for interface that generates the CDR operator
+ // implementations
+ //
+
+public:
+ be_visitor_interface_cdr_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_interface_cdr_op_cs (void);
+ // destructor
+
+ 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
new file mode 100644
index 00000000000..15f33e4bee7
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/direct_proxy_impl_sh.h
@@ -0,0 +1,50 @@
+//$Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// direct_proxy_impl_sh.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node. This
+// visitor handle the generation of the proxy
+// implementations Direct clas.
+//
+// = AUTHOR
+// Angelo Corsaro <corsaro@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef BE_DIRECT_PROXY_IMPL_SH_H_
+#define BE_DIRECT_PROXY_IMPL_SH_H_
+
+class be_visitor_interface_direct_proxy_impl_sh : public be_visitor_interface
+{
+ // = TITLE
+ // Generates the declaration for the Direct proxy
+ // implementation classes.
+
+public:
+ // -- Ctor/Dtor Decl. --
+ be_visitor_interface_direct_proxy_impl_sh (be_visitor_context *ctx);
+
+ virtual ~be_visitor_interface_direct_proxy_impl_sh (void);
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface
+
+ virtual int visit_component (be_component *node);
+ // This will just call the above method - no need to create
+ // another set of visitors for this stuff.
+
+ 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
new file mode 100644
index 00000000000..2fd30eaf71f
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/direct_proxy_impl_ss.h
@@ -0,0 +1,49 @@
+//$Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// direct_proxy_impl_ss.h
+//
+// = DESCRIPTION
+// Visitor that takes care of generation the implementation
+// for the direct proxy implementation.
+//
+// = AUTHOR
+// Angelo Corsaro
+//
+// ============================================================================
+
+#ifndef BE_DIRECT_PROXY_IMPL_SS_H_
+#define BE_DIRECT_PROXY_IMPL_SS_H_
+
+class be_visitor_interface_direct_proxy_impl_ss : public be_visitor_interface
+{
+ // = TITLE
+ // Generates the declaration for the Direct proxy
+ // implementation classes.
+
+public:
+ // -- Ctor/Dtor Decl. --
+ be_visitor_interface_direct_proxy_impl_ss (be_visitor_context *ctx);
+
+ virtual ~be_visitor_interface_direct_proxy_impl_ss (void);
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface
+
+ virtual int visit_component (be_component *node);
+ // This will just call the above method - no need to create
+ // another set of visitors for this stuff.
+
+ 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/interface.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interface.h
new file mode 100644
index 00000000000..1ceabc28c33
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface.h
@@ -0,0 +1,110 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node.
+// This one provides the generic visitor for interfaces from which others
+// will inherit.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_INTERFACE_H_
+#define _BE_INTERFACE_INTERFACE_H_
+
+// = DESCRIPTION
+// Interface code generation is complex, the client stubs require
+// two different class and the server also require other two.
+// Only one of them includes whatever nested typedefs, exceptions
+// and or structures are defined in the interface.
+// To break this complexity a different visitor is used for each
+// case.
+//
+// = NOTE
+// Visitors were added recently into the compiler, so some
+// code is still generated using the old "state oriented" approach;
+// notably only the _collocated class is actually generated using
+// the visitor, in the other cases (the interface class and the
+// skeleton class) we still call back the old code generation
+// methods.
+//
+
+class AST_Operation;
+
+class be_visitor_interface : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_interface
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for interface that abstracts all common tasks
+ //
+public:
+ be_visitor_interface (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_interface (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // visit the interface node
+
+ 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);
+ // visit attribute
+
+ virtual int visit_constant (be_constant *node);
+ // visit a constant
+
+ virtual int visit_native (be_native *node);
+ // visit an native
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_exception (be_exception *node);
+ // visit an exception
+
+ virtual int visit_operation (be_operation *node);
+ // visit operation
+
+ virtual int visit_structure (be_structure *node);
+ // visit a structure
+
+ virtual int visit_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
new file mode 100644
index 00000000000..ed30df9f941
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ch.h
@@ -0,0 +1,61 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node.
+// This one provides code generation for interfaces in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_INTERFACE_CH_H_
+#define _BE_INTERFACE_INTERFACE_CH_H_
+
+// we need derived interface visitors for the client and server header files. For
+// the others, they use the default interface visitor
+
+class be_visitor_interface_ch : public be_visitor_interface
+{
+ //
+ // = TITLE
+ // be_visitor_interface_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client header for interface
+ //
+ //
+public:
+ be_visitor_interface_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_interface_ch (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // set the right context and make a visitor
+
+ 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.
+private:
+ /// Helper to generate declarations for _narrow () and
+ /// _unchecked_narrow ()
+ bool gen_xxx_narrow (const char *n,
+ be_interface *node,
+ TAO_OutStream *os);
+};
+
+#endif /* _BE_INTERFACE_INTERFACE_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ci.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ci.h
new file mode 100644
index 00000000000..c9791f74cac
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ci.h
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_ci.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node.
+// This one provides code generation for interfaces in the client inline.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_INTERFACE_CI_H_
+#define _BE_INTERFACE_INTERFACE_CI_H_
+
+class be_visitor_interface_ci : public be_visitor_interface
+{
+ //
+ // = TITLE
+ // be_visitor_interface_ci
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client inline for interface
+ //
+ //
+public:
+ be_visitor_interface_ci (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_interface_ci (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_INTERFACE_INTERFACE_CI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_cs.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_cs.h
new file mode 100644
index 00000000000..2e65b5d2656
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_cs.h
@@ -0,0 +1,59 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node.
+// This one provides code generation for interfaces in the client stubs.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_INTERFACE_CS_H_
+#define _BE_INTERFACE_INTERFACE_CS_H_
+
+class be_visitor_interface_cs : public be_visitor_interface
+{
+ //
+ // = TITLE
+ // be_visitor_interface_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client stubs for interface
+ //
+ //
+public:
+ be_visitor_interface_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_interface_cs (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // set the right context and make a visitor
+
+ 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.
+
+private:
+ /// Helper method to generate _narrow and _unchecked_narrow. The
+ /// string <n> will contain the needed predicate that needs to be
+ /// generated.
+ bool gen_xxx_narrow (const char *n,
+ be_interface *node);
+};
+
+#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
new file mode 100644
index 00000000000..1c540eb905f
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ih.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_ih.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node.
+// This provides for code generation in the implementation header
+//
+// = AUTHOR
+// Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_INTERFACE_IH_H_
+#define _BE_INTERFACE_INTERFACE_IH_H_
+
+class be_visitor_interface_ih : public be_visitor_interface
+{
+ //
+ // = TITLE
+ // be_visitor_interface_ih
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the implementation header for interface
+ //
+ //
+public:
+ be_visitor_interface_ih (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_interface_ih (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // set the right context and make a visitor
+
+ 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
new file mode 100644
index 00000000000..7c59bf5d0ee
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_is.h
@@ -0,0 +1,49 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_is.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node.
+// This provides for code generation in the implementation skeleton
+//
+// = AUTHOR
+// Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_INTERFACE_IS_H_
+#define _BE_INTERFACE_INTERFACE_IS_H_
+
+class be_visitor_interface_is : public be_visitor_interface
+{
+ //
+ // = TITLE
+ // be_visitor_interface_is
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the implementation skeletons for interface
+ //
+ //
+public:
+ be_visitor_interface_is (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_interface_is (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // set the right context and make a visitor
+
+
+ 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
new file mode 100644
index 00000000000..f7fb788769b
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_sh.h
@@ -0,0 +1,56 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_sh.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node.
+// This provides for code generation in the server header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_INTERFACE_SH_H_
+#define _BE_INTERFACE_INTERFACE_SH_H_
+
+class be_visitor_interface_sh : public be_visitor_interface
+{
+ //
+ // = TITLE
+ // be_visitor_interface_sh
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the server header for interface
+ //
+ //
+public:
+ be_visitor_interface_sh (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_interface_sh (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // set the right context and make a visitor
+
+ 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_si.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_si.h
new file mode 100644
index 00000000000..61e055ad51e
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_si.h
@@ -0,0 +1,49 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_si.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node.
+// This provides for code generation in the server inline
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_INTERFACE_SI_H_
+#define _BE_INTERFACE_INTERFACE_SI_H_
+
+class be_visitor_interface_si : public be_visitor_interface
+{
+ //
+ // = TITLE
+ // be_visitor_interface_si
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the server inline for interface
+ //
+ //
+public:
+ be_visitor_interface_si (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_interface_si (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // set the right context and make a visitor
+
+protected:
+ virtual int generate_amh_classes (be_interface *node);
+};
+
+#endif /* _BE_INTERFACE_INTERFACE_SI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ss.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ss.h
new file mode 100644
index 00000000000..67642002063
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ss.h
@@ -0,0 +1,72 @@
+// -*- C++ -*-
+//
+// $Id$
+
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_ss.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node.
+// This provides for code generation in the server skeleton
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_INTERFACE_SS_H_
+#define _BE_INTERFACE_INTERFACE_SS_H_
+
+class be_visitor_interface_ss : public be_visitor_interface
+{
+ //
+ // = TITLE
+ // be_visitor_interface_ss
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the server skeletons for
+ // interface
+ //
+public:
+ be_visitor_interface_ss (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_interface_ss (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // set the right context and make a visitor
+
+ 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);
+
+ // Some AMH skeletons must explicitly send the reply, for regular
+ // classes the following function is empty, for AMH code it
+ // generates the explicit call.
+ virtual void generate_send_reply (TAO_OutStream * os);
+
+ virtual int generate_amh_classes (be_interface *node);
+ virtual int generate_proxy_classes (be_interface *node);
+// virtual int generate_downcast_implementation (be_interface *node,
+// TAO_OutStream *os);
+ virtual int generate_copy_ctor (be_interface *node,
+ TAO_OutStream *os);
+ virtual ACE_CString generate_flat_name (be_interface *node);
+ virtual ACE_CString generate_local_name (be_interface *node);
+ virtual ACE_CString generate_full_skel_name (be_interface *node);
+};
+
+#endif /* _BE_INTERFACE_INTERFACE_SS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/proxy_brokers_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface/proxy_brokers_ch.h
new file mode 100644
index 00000000000..9d9348a5645
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/proxy_brokers_ch.h
@@ -0,0 +1,44 @@
+//$Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// proxy_brokers_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node. This
+// visitor handle the generation of the proxy brokers
+// for the given interface.
+//
+// = AUTHOR
+// Angelo Corsaro <corsaro@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef BE_PROXY_BROKERS_CH_H_
+#define BE_PROXY_BROKERS_CH_H_
+
+class be_visitor_interface_proxy_brokers_ch : public be_visitor_interface
+{
+ // = TITLE
+ // Generates the declaration for the base proxy
+ // broker class.
+
+public:
+ // -- Ctor/Dtor Decl. --
+ be_visitor_interface_proxy_brokers_ch (be_visitor_context *ctx);
+
+ virtual ~be_visitor_interface_proxy_brokers_ch (void);
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface
+
+ virtual int visit_component (be_component *node);
+ // This will just call the above method - no need to create
+ // another set of visitors for this stuff.
+};
+
+#endif /* BE_PROXY_BROKERS_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/proxy_impls_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface/proxy_impls_ch.h
new file mode 100644
index 00000000000..b7b67bd306e
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/proxy_impls_ch.h
@@ -0,0 +1,44 @@
+//$Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// proxy_impls_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node. This
+// visitor handle the generation of the proxy
+// implementations class.
+//
+// = AUTHOR
+// Angelo Corsaro <corsaro@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef BE_PROXY_BROKER_IMPLS_CH_H_
+#define BE_PROXY_BROKER_IMPLS_CH_H_
+
+class be_visitor_interface_proxy_impls_ch : public be_visitor_interface
+{
+ // = TITLE
+ // Generates the declaration for the base proxy
+ // implementation classes.
+
+public:
+ // -- Ctor/Dtor Decl. --
+ be_visitor_interface_proxy_impls_ch (be_visitor_context *ctx);
+
+ virtual ~be_visitor_interface_proxy_impls_ch (void);
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface
+
+ virtual int visit_component (be_component *node);
+ // This will just call the above method - no need to create
+ // another set of visitors for this stuff.
+};
+
+#endif /* BE_PROXY_BROKER_IMPLS_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_broker_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_broker_ch.h
new file mode 100644
index 00000000000..3e7a9f4cd20
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_broker_ch.h
@@ -0,0 +1,44 @@
+//$Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// remote_proxy_broker_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node. This
+// visitor generates the declaration for the remote
+// ProxyBroker class.
+//
+// = AUTHOR
+// Angelo Corsaro <corsaro@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef BE_REMOTE_PROXY_BROKER_CH_H_
+#define BE_REMOTE_PROXY_BROKER_CH_H_
+
+class be_visitor_interface_remote_proxy_broker_ch : public be_visitor_interface
+{
+ // = TITLE
+ // Generates the declaration for the base proxy
+ // broker class.
+
+public:
+ // -- Ctor/Dtor Decl. --
+ be_visitor_interface_remote_proxy_broker_ch (be_visitor_context *ctx);
+
+ virtual ~be_visitor_interface_remote_proxy_broker_ch (void);
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface
+
+ virtual int visit_component (be_component *node);
+ // This will just call the above method - no need to create
+ // another set of visitors for this stuff.
+};
+
+#endif /* BE_REMOTE_PROXY_BROKER_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_broker_cs.h b/TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_broker_cs.h
new file mode 100644
index 00000000000..4b5aa1fe514
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_broker_cs.h
@@ -0,0 +1,44 @@
+//$Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// remote_proxy_broker_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node. This
+// visitor generates the declaration for the remote
+// ProxyBroker class.
+//
+// = AUTHOR
+// Angelo Corsaro <corsaro@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef BE_REMOTE_PROXY_BROKER_CS_H_
+#define BE_REMOTE_PROXY_BROKER_CS_H_
+
+class be_visitor_interface_remote_proxy_broker_cs : public be_visitor_interface
+{
+ // = TITLE
+ // Generates the implementation for the base proxy
+ // broker class.
+
+public:
+ // -- Ctor/Dtor Decl. --
+ be_visitor_interface_remote_proxy_broker_cs (be_visitor_context *ctx);
+
+ virtual ~be_visitor_interface_remote_proxy_broker_cs (void);
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface
+
+ virtual int visit_component (be_component *node);
+ // This will just call the above method - no need to create
+ // another set of visitors for this stuff.
+};
+
+#endif /* BE_REMOTE_PROXY_BROKER_CS_H_ */
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
new file mode 100644
index 00000000000..d07f234ae18
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_impl_ch.h
@@ -0,0 +1,50 @@
+//$Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// remote_proxy_impl_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node. This
+// visitor handle the generation of the proxy
+// implementations remote clas.
+//
+// = AUTHOR
+// Angelo Corsaro <corsaro@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef BE_REMOTE_PROXY_IMPL_CH_H_
+#define BE_REMOTE_PROXY_IMPL_CH_H_
+
+class be_visitor_interface_remote_proxy_impl_ch : public be_visitor_interface
+{
+ // = TITLE
+ // Generates the declaration for the remote proxy
+ // implementation classes.
+
+public:
+ // -- Ctor/Dtor Decl. --
+ be_visitor_interface_remote_proxy_impl_ch (be_visitor_context *ctx);
+
+ virtual ~be_visitor_interface_remote_proxy_impl_ch (void);
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface
+
+ virtual int visit_component (be_component *node);
+ // This will just call the above method - no need to create
+ // another set of visitors for this stuff.
+
+ 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/smart_proxy_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface/smart_proxy_ch.h
new file mode 100644
index 00000000000..8a1a97ec2cc
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/smart_proxy_ch.h
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// smart_proxy_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node.
+// This provides code generation for smart proxy classes for an
+// interface in the client header.
+//
+// = AUTHOR
+// Kirthika Parameswaran
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_SMART_PROXY_CH_H_
+#define _BE_INTERFACE_SMART_PROXY_CH_H_
+
+class be_visitor_interface_smart_proxy_ch : public be_visitor_interface
+{
+ // = TITLE
+ // Generate the "smart proxy" class declaration.
+
+public:
+ be_visitor_interface_smart_proxy_ch (be_visitor_context *ctx);
+ // constructor
+
+ virtual ~be_visitor_interface_smart_proxy_ch (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface
+
+ virtual int visit_component (be_component *node);
+ // This will just call the above method - no need to create
+ // another set of visitors for this stuff.
+};
+
+#endif /* _BE_INTERFACE_SMART_PROXY_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/smart_proxy_cs.h b/TAO/TAO_IDL/be_include/be_visitor_interface/smart_proxy_cs.h
new file mode 100644
index 00000000000..f0d12a2bd3d
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/smart_proxy_cs.h
@@ -0,0 +1,45 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// smart_proxy_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node.
+// This provides code generation for smart proxy classes in the client stub.
+//
+// = AUTHOR
+// Kirthika Parameswaran
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_SMART_PROXY_CS_H_
+#define _BE_INTERFACE_SMART_PROXY_CS_H_
+
+class be_visitor_interface_smart_proxy_cs : public be_visitor_interface
+{
+ // = TITLE
+ // Generate the "smart proxy" class declaration.
+
+public:
+ be_visitor_interface_smart_proxy_cs (be_visitor_context *ctx);
+ // constructor
+
+ virtual ~be_visitor_interface_smart_proxy_cs (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface
+
+ virtual int visit_component (be_component *node);
+ // This will just call the above method - no need to create
+ // another set of visitors for this stuff.
+};
+
+#endif /* _BE_INTERFACE_SMART_PROXY_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_sh.h b/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_sh.h
new file mode 100644
index 00000000000..b06651ac36b
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_sh.h
@@ -0,0 +1,44 @@
+//$Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// strategized_proxy_broker_sh.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node. This
+// visitor generates the declaration for the strategized
+// ProxyBroker class.
+//
+// = AUTHOR
+// Angelo Corsaro <corsaro@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef BE_STRATEGIZED_PROXY_BROKER_SH_H_
+#define BE_STRATEGIZED_PROXY_BROKER_SH_H_
+
+class be_visitor_interface_strategized_proxy_broker_sh : public be_visitor_interface
+{
+ // = TITLE
+ // Generates the declaration for the base proxy
+ // broker class.
+
+public:
+ // -- Ctor/Dtor Decl. --
+ be_visitor_interface_strategized_proxy_broker_sh (be_visitor_context *ctx);
+
+ virtual ~be_visitor_interface_strategized_proxy_broker_sh (void);
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface
+
+ virtual int visit_component (be_component *node);
+ // This will just call the above method - no need to create
+ // another set of visitors for this stuff.
+};
+
+#endif /* BE_STRATEGIZED_PROXY_BROKER_SH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_ss.h b/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_ss.h
new file mode 100644
index 00000000000..7130a5c3fc4
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_ss.h
@@ -0,0 +1,50 @@
+//$Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// strategized_proxy_broker_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node. This
+// visitor generates the declaration for the strategized
+// ProxyBroker class.
+//
+// = AUTHOR
+// Angelo Corsaro <corsaro@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef BE_STRATEGIZED_PROXY_BROKER_SS_H_
+#define BE_STRATEGIZED_PROXY_BROKER_SS_H_
+
+class be_visitor_interface_strategized_proxy_broker_ss
+ : public be_visitor_interface
+{
+ // = TITLE
+ // Generates the implementation for the base proxy
+ // broker class.
+
+public:
+ // -- Ctor/Dtor Decl. --
+ be_visitor_interface_strategized_proxy_broker_ss (be_visitor_context *ctx);
+
+ virtual ~be_visitor_interface_strategized_proxy_broker_ss (void);
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface
+
+ virtual int visit_component (be_component *node);
+ // This will just call the above method - no need to create
+ // another set of visitors for this stuff.
+
+private:
+
+ void gen_direct_operations (be_interface *node,
+ TAO_OutStream *os);
+};
+
+#endif /* BE_STRATEGIZED_PROXY_BROKER_SS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/tie_sh.h b/TAO/TAO_IDL/be_include/be_visitor_interface/tie_sh.h
new file mode 100644
index 00000000000..fd27d61c022
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/tie_sh.h
@@ -0,0 +1,53 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// tie_sh.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node.
+// This one provides the code generation for TIE classes
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_TIE_SH_H_
+#define _BE_INTERFACE_TIE_SH_H_
+
+class be_visitor_interface_tie_sh : public be_visitor_interface
+{
+ //
+ // = TITLE
+ // be_visitor_interface_tie_sh
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the server header for the TIE class
+ //
+ //
+public:
+ be_visitor_interface_tie_sh (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_interface_tie_sh (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // set the right context and make a visitor
+
+ virtual int visit_component (be_component *node);
+ // set the right context and make a visitor
+
+ static int method_helper (be_interface *,
+ be_interface *,
+ TAO_OutStream *os);
+};
+
+#endif /* _BE_INTERFACE_TIE_SH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/tie_si.h b/TAO/TAO_IDL/be_include/be_visitor_interface/tie_si.h
new file mode 100644
index 00000000000..b097b77be1a
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/tie_si.h
@@ -0,0 +1,55 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// tie_si.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node.
+// This one provides the code generation for TIE classes
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_TIE_SI_H_
+#define _BE_INTERFACE_TIE_SI_H_
+
+class be_visitor_interface_tie_si : public be_visitor_interface
+{
+ //
+ // = TITLE
+ // be_visitor_interface_tie_si
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the server inline for operations
+ // of the TIE class
+ //
+ //
+public:
+ be_visitor_interface_tie_si (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_interface_tie_si (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // set the right context and make a visitor
+
+ virtual int visit_component (be_component *node);
+ // set the right context and make a visitor
+
+ static int method_helper (be_interface *,
+ be_interface *,
+ TAO_OutStream *os);
+ // helper method to generate method declaration in the TIE classes.
+};
+
+#endif /* _BE_INTERFACE_TIE_SI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h
new file mode 100644
index 00000000000..91985c89078
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h
@@ -0,0 +1,30 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_interface_fwd.h
+//
+// = DESCRIPTION
+// Concrete visitor for the interface_fwd class
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_INTERFACE_FWD_H
+#define TAO_BE_VISITOR_INTERFACE_FWD_H
+
+#include "be_visitor_decl.h"
+#include "be_visitor_interface_fwd/interface_fwd_ch.h"
+#include "be_visitor_interface_fwd/cdr_op_ch.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/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd/any_op_ch.h
new file mode 100644
index 00000000000..2c53d3aabd6
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd/any_op_ch.h
@@ -0,0 +1,47 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the forward declared Interface node.
+// This one provides code generation for the Any operators.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_FWD_ANY_OP_CH_H_
+#define _BE_INTERFACE_FWD_ANY_OP_CH_H_
+
+class be_visitor_interface_fwd_any_op_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_interface_fwd_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for forward declared interfaces that
+ // generates the Any operator declaration.
+ //
+
+public:
+ be_visitor_interface_fwd_any_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_interface_fwd_any_op_ch (void);
+ // destructor
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit interface_fwd
+};
+
+#endif /* _BE_INTERFACE_FWD_ANY_OP_CH_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
new file mode 100644
index 00000000000..9a75dc8bdc6
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd/cdr_op_ch.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the InterfaceFwd class
+// This one provides code generation for the CDR operators for the forward
+// declared interface in the client header, if the node is not later defined
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_INTERFACE_FWD_CDR_OP_CH_H_
+#define _BE_VISITOR_INTERFACE_FWD_CDR_OP_CH_H_
+
+class be_visitor_interface_fwd_cdr_op_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_interface_fwd_cdr_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for forward declared interface that generates
+ // the CDR operator declarations, if the node is not later defined.
+ //
+
+public:
+ be_visitor_interface_fwd_cdr_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_interface_fwd_cdr_op_ch (void);
+ // destructor
+
+ 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/interface_fwd_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd/interface_fwd_ch.h
new file mode 100644
index 00000000000..71d37c0ee70
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd/interface_fwd_ch.h
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_fwd_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface Forward node.
+// This one provides code generation for interface forward node.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_INTERFACE_FWD_CH_H_
+#define _BE_INTERFACE_INTERFACE_FWD_CH_H_
+
+class be_visitor_interface_fwd_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_interface_fwd_ch
+ //
+ // = DESCRIPTION
+ // This is the visitor for interface_fwd for the header file
+ //
+ //
+public:
+ be_visitor_interface_fwd_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_interface_fwd_ch (void);
+ // destructor
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit interface_fwd.
+};
+
+#endif /* _BE_INTERFACE_INTERFACE_FWD_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_module.h b/TAO/TAO_IDL/be_include/be_visitor_module.h
new file mode 100644
index 00000000000..be863aa967f
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_module.h
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_module.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Module class
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_MODULE_H
+#define TAO_BE_VISITOR_MODULE_H
+
+#include "be_visitor_scope.h"
+#include "be_visitor_module/module.h"
+#include "be_visitor_module/module_ch.h"
+#include "be_visitor_module/module_sh.h"
+#include "be_visitor_module/module_ih.h"
+#include "be_visitor_module/any_op.h"
+#include "be_visitor_module/cdr_op.h"
+#include "be_visitor_module/serializer_op.h"
+
+#endif // TAO_BE_VISITOR_MODULE_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_module/any_op.h b/TAO/TAO_IDL/be_include/be_visitor_module/any_op.h
new file mode 100644
index 00000000000..a41fec48195
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_module/any_op.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Module class
+// This one provides visitors to generate the Any operators for elements in
+// the Module's scope.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_MODULE_ANY_OP_H_
+#define _BE_VISITOR_MODULE_ANY_OP_H_
+
+class be_visitor_module_any_op : public be_visitor_module
+{
+ //
+ // = TITLE
+ // be_visitor_module_any_op
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for module that generates the Any operator
+ // declarations and implementations
+ //
+
+public:
+ be_visitor_module_any_op (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_module_any_op (void);
+ // destructor
+
+ virtual int visit_module (be_module *node);
+ // visit module
+};
+
+#endif /* _BE_VISITOR_MODULE_ANY_OP_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_module/cdr_op.h b/TAO/TAO_IDL/be_include/be_visitor_module/cdr_op.h
new file mode 100644
index 00000000000..78a56a082f9
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_module/cdr_op.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Module class
+// This one provides visitors to generate the CDR operators for elements in
+// the Module's scope.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_MODULE_CDR_OP_H_
+#define _BE_VISITOR_MODULE_CDR_OP_H_
+
+class be_visitor_module_cdr_op : public be_visitor_module
+{
+ //
+ // = TITLE
+ // be_visitor_module_cdr_op
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for module that generates the CDR operator
+ // declarations and implementations
+ //
+
+public:
+ be_visitor_module_cdr_op (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_module_cdr_op (void);
+ // destructor
+
+ virtual int visit_module (be_module *node);
+ // visit module
+};
+
+#endif /* _BE_VISITOR_MODULE_CDR_OP_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_module/module.h b/TAO/TAO_IDL/be_include/be_visitor_module/module.h
new file mode 100644
index 00000000000..d1c045d3aed
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_module/module.h
@@ -0,0 +1,106 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// module.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Module class
+// This one provides the generic visitor for the Module node.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_MODULE_MODULE_H_
+#define _BE_VISITOR_MODULE_MODULE_H_
+
+class be_visitor_module : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_module
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for module that abstracts all common tasks.
+ //
+
+public:
+ be_visitor_module (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_module (void);
+ // destructor
+
+ // =visit methods on all elements syntactically valid in a Module scope
+
+ virtual int visit_constant (be_constant *node);
+ // visit a constant
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_native (be_native *node);
+ // visit a native
+
+ virtual int visit_exception (be_exception *node);
+ // visit an exception
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit a forward declared interface
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit the valuebox node
+
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit a valuetype
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit a forward declared valuetype
+
+ virtual int visit_eventtype (be_eventtype *node);
+ // visit an eventtype
+
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+ // visit a forward declared eventtype
+
+ virtual int visit_component (be_component *node);
+ // visit a component
+
+ virtual int visit_component_fwd (be_component_fwd *node);
+ // visit a forward declared component
+
+ virtual int visit_home (be_home *node);
+ // visit a home
+
+ virtual int visit_module (be_module *node);
+ // visit a module
+
+ 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
new file mode 100644
index 00000000000..da55a641498
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_module/module_ch.h
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// module_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Module class
+// This provides code generation for the module in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_MODULE_MODULE_CH_H_
+#define _BE_VISITOR_MODULE_MODULE_CH_H_
+
+class be_visitor_module_ch : public be_visitor_module
+{
+ //
+ // = TITLE
+ // be_visitor_module_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client header for module
+ //
+ //
+public:
+ be_visitor_module_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_module_ch (void);
+ // destructor
+
+ virtual int visit_module (be_module *node);
+ // visit module. We provide code for this method in the derived class
+};
+
+#endif /* _BE_VISITOR_MODULE_MODULE_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_module/module_ih.h b/TAO/TAO_IDL/be_include/be_visitor_module/module_ih.h
new file mode 100644
index 00000000000..40e1b9f351a
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_module/module_ih.h
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+// $Id$
+
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// module_ih.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Module class
+// This provides code generation for the module in the implementation header.
+//
+// = AUTHOR
+// Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_MODULE_MODULE_IH_H_
+#define _BE_VISITOR_MODULE_MODULE_IH_H_
+
+class be_visitor_module_ih : public be_visitor_module
+{
+ //
+ // = TITLE
+ // be_visitor_module_ih
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the implementation header for module
+ //
+ //
+public:
+ be_visitor_module_ih (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_module_ih (void);
+ // destructor
+
+ virtual int visit_module (be_module *node);
+ // visit module. We provide code for this method in the derived class
+};
+
+#endif /* _BE_VISITOR_MODULE_MODULE_SH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_module/module_sh.h b/TAO/TAO_IDL/be_include/be_visitor_module/module_sh.h
new file mode 100644
index 00000000000..b70f41e6f86
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_module/module_sh.h
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// module_sh.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Module class
+// This provides code generation for the module in the server header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_MODULE_MODULE_SH_H_
+#define _BE_VISITOR_MODULE_MODULE_SH_H_
+
+class be_visitor_module_sh : public be_visitor_module
+{
+ //
+ // = TITLE
+ // be_visitor_module_sh
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the server header for module
+ //
+ //
+public:
+ be_visitor_module_sh (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_module_sh (void);
+ // destructor
+
+ virtual int visit_module (be_module *node);
+ // visit module. We provide code for this method in the derived class
+};
+
+#endif /* _BE_VISITOR_MODULE_MODULE_SH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_module/serializer_op.h b/TAO/TAO_IDL/be_include/be_visitor_module/serializer_op.h
new file mode 100644
index 00000000000..54d83515334
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_module/serializer_op.h
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Module class
+// This one provides visitors to generate the
+// TAO::DCPS::Serializer operators for elements in
+// the Module's scope.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_MODULE_serializer_op_H_
+#define _BE_VISITOR_MODULE_serializer_op_H_
+
+class be_visitor_module_serializer_op : public be_visitor_module
+{
+ //
+ // = TITLE
+ // be_visitor_module_serializer_op
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for module that generates the Serializer operator
+ // declarations and implementations
+ //
+
+public:
+ be_visitor_module_serializer_op (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_module_serializer_op (void);
+ // destructor
+
+ virtual int visit_module (be_module *node);
+ // visit module
+};
+
+#endif /* _BE_VISITOR_MODULE_serializer_op_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_native.h b/TAO/TAO_IDL/be_include/be_visitor_native.h
new file mode 100644
index 00000000000..c3cc894dd9c
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_native.h
@@ -0,0 +1,28 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_native.h
+//
+// = DESCRIPTION
+// Concrete visitor for the native class
+//
+// = AUTHOR
+// Johnny Willemsen
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_NATIVE_H
+#define TAO_BE_VISITOR_NATIVE_H
+
+#include "be_visitor_scope.h"
+#include "be_visitor_native/native_ch.h"
+
+#endif /* TAO_BE_VISITOR_NATIVE_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_native/native_ch.h b/TAO/TAO_IDL/be_include/be_visitor_native/native_ch.h
new file mode 100644
index 00000000000..284fd66451c
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_native/native_ch.h
@@ -0,0 +1,46 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// native_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for Native generating code in the client header.
+//
+// = AUTHOR
+// Johnny Willemsen
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_NATIVE_NATIVE_CH_H_
+#define _BE_VISITOR_NATIVE_NATIVE_CH_H_
+
+class be_visitor_native_ch : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_native_ch
+ //
+ // = DESCRIPTION
+ // This is the base visitor for enum for the header file
+ //
+ //
+public:
+ be_visitor_native_ch (be_visitor_context *ctx);
+ // conenumor
+
+ ~be_visitor_native_ch (void);
+ // deenumor
+
+ virtual int visit_native (be_native *node);
+ // visit native.
+};
+
+#endif /* _BE_VISITOR_NATIVE_NATIVE_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation.h b/TAO/TAO_IDL/be_include/be_visitor_operation.h
new file mode 100644
index 00000000000..729617814ea
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation.h
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_operation.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Operation class
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_OPERATION_H
+#define TAO_BE_VISITOR_OPERATION_H
+
+#include "idl_defines.h"
+
+#include "be_visitor_scope.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/operation_sh.h"
+#include "be_visitor_operation/operation_ih.h"
+#include "be_visitor_operation/operation_ss.h"
+#include "be_visitor_operation/operation_is.h"
+#include "be_visitor_operation/tie_sh.h"
+#include "be_visitor_operation/tie_si.h"
+#include "be_visitor_operation/arglist.h"
+#include "be_visitor_operation/rettype.h"
+#include "be_visitor_operation/rettype_return_cs.h"
+#include "be_visitor_operation/exceptlist_cs.h"
+#include "be_visitor_operation/exceptlist_ss.h"
+#include "be_visitor_operation/argument.h"
+#include "be_visitor_operation/argument_invoke.h"
+#include "be_visitor_operation/argument_marshal.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"
+#include "be_visitor_operation/smart_proxy_ch.h"
+#include "be_visitor_operation/smart_proxy_cs.h"
+#include "be_visitor_operation/upcall_command_ss.h"
+#include "be_visitor_operation/proxy_impl_xh.h"
+#include "be_visitor_operation/direct_proxy_impl_ss.h"
+
+// AMH
+#include "be_visitor_operation/amh_sh.h"
+#include "be_visitor_operation/amh_ss.h"
+#include "be_visitor_operation/amh_rh_sh.h"
+#include "be_visitor_operation/amh_rh_ss.h"
+
+#endif // TAO_BE_VISITOR_OPERATION_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/amh_rh_sh.h b/TAO/TAO_IDL/be_include/be_visitor_operation/amh_rh_sh.h
new file mode 100644
index 00000000000..09c44875df7
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/amh_rh_sh.h
@@ -0,0 +1,36 @@
+//=============================================================================
+/**
+* @file amh_rh_sh.h
+*
+* $Id$
+*
+* Creates operation code for AMH-RH operations.
+*
+* @author Mayur Deshpande <mayur@ics.uci.edu>
+*/
+//=============================================================================
+
+#ifndef AMH_RH_OPERATION_SH_H
+#define AMH_RH_OPERATION_SH_H
+
+/**
+* @class be_visitor_operation_amh_rh_sh
+*
+* @brief This is a concrete visitor to generate the server header for
+* AMH operations
+*/
+
+#include "be_visitor_operation.h"
+
+class be_visitor_amh_rh_operation_sh : public be_visitor_operation
+{
+ public:
+ be_visitor_amh_rh_operation_sh (be_visitor_context *ctx);
+
+ ~be_visitor_amh_rh_operation_sh (void);
+
+ int visit_operation (be_operation *node);
+
+};
+
+#endif /* AMH_RH_OPERATION_SH_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/amh_rh_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/amh_rh_ss.h
new file mode 100644
index 00000000000..84dc944af6e
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/amh_rh_ss.h
@@ -0,0 +1,38 @@
+//=============================================================================
+/**
+* @file amh_rh_ss.h
+*
+* $Id$
+*
+* Creates code for AMH-RH operations.
+*
+* @author Darrell Brunsch <brunsch@cs.wustl.edu>
+*/
+//=============================================================================
+
+#ifndef AMH_RH_OPERATION_SS_H
+#define AMH_RH_OPERATION_SS_H
+
+/**
+ * @class be_visitor_operation_amh_rh_ss
+ *
+ * @brief This is a concrete visitor to generate the server source for
+ * AMH operations
+ */
+
+#include "be_visitor_operation.h"
+
+class be_visitor_amh_rh_operation_ss : public be_visitor_operation
+{
+ public:
+ be_visitor_amh_rh_operation_ss (be_visitor_context *ctx);
+
+ ~be_visitor_amh_rh_operation_ss (void);
+
+ int visit_operation (be_operation *node);
+
+ private:
+ int marshal_params (be_operation *node);
+};
+
+#endif /* AMH_RH_OPERATION_SS_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/amh_sh.h b/TAO/TAO_IDL/be_include/be_visitor_operation/amh_sh.h
new file mode 100644
index 00000000000..15368d492e3
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/amh_sh.h
@@ -0,0 +1,37 @@
+//=============================================================================
+/**
+* @file amh_sh.h
+*
+* $Id$
+*
+* Creates code for AMH operations.
+*
+* @author Mayur Deshpande <mayur@ics.uci.edu>
+*/
+//=============================================================================
+
+#ifndef AMH_OPERATION_SH_H
+#define AMH_OPERATION_SH_H
+
+/**
+* @class be_visitor_operation_amh_sh
+*
+* @brief This is a concrete visitor to generate the server header for
+* AMH operations
+*/
+class be_visitor_amh_operation_sh : public be_visitor_operation
+{
+public:
+ be_visitor_amh_operation_sh (be_visitor_context *ctx);
+ ~be_visitor_amh_operation_sh (void);
+
+ virtual int visit_operation (be_operation *node);
+ virtual int visit_attribute (be_attribute *node);
+
+private:
+ void generate_shared_prologue (be_decl *node,
+ TAO_OutStream *os,
+ const char *skel_prefix);
+};
+
+#endif /* AMH_OPERATION_SS_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/amh_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/amh_ss.h
new file mode 100644
index 00000000000..ee9855c6fbd
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/amh_ss.h
@@ -0,0 +1,41 @@
+//=============================================================================
+/**
+* @file amh_ss.h
+*
+* $Id$
+*
+* Creates code for AMH operations.
+*
+* @author Darrell Brunsch <brunsch@cs.wustl.edu>
+*/
+//=============================================================================
+
+#ifndef AMH_OPERATION_SS_H
+#define AMH_OPERATION_SS_H
+
+/**
+ * @class be_visitor_operation_amh_ss
+ *
+ * @brief This is a concrete visitor to generate the server source for
+ * AMH operations
+ */
+class be_visitor_amh_operation_ss : public be_visitor_operation
+{
+public:
+ be_visitor_amh_operation_ss (be_visitor_context *ctx);
+
+ ~be_visitor_amh_operation_ss (void);
+
+ virtual int visit_operation (be_operation *node);
+ virtual int visit_attribute (be_attribute *node);
+
+protected:
+ int generate_shared_prologue (be_decl *node,
+ TAO_OutStream *os,
+ const char *skel_prefix);
+ int generate_shared_section (be_decl *node,
+ TAO_OutStream *os);
+ int generate_shared_epilogue (TAO_OutStream *os);
+};
+
+#endif /* AMH_OPERATION_SS_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_ch.h b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_ch.h
new file mode 100644
index 00000000000..2c962022eca
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_ch.h
@@ -0,0 +1,51 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// ami_ch.h
+//
+// = DESCRIPTION
+// Visitor for generating AMI stub code for IDL operations in
+// client header.
+//
+// = AUTHOR
+// Alexander Babu Arulanthu <alex@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_AMI_CH_H_
+#define _BE_VISITOR_OPERATION_AMI_CH_H_
+
+// ************************************************************
+// Operation visitor to generate AMI stubs for client header
+// ************************************************************
+
+class be_visitor_operation_ami_ch : public be_visitor_operation
+{
+ //
+ // = TITLE
+ // be_visitor_operation_ami_ch.
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the AMI stubs in the
+ // client header for operation.
+ //
+ //
+public:
+ be_visitor_operation_ami_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_ami_ch (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+ // visit operation.
+};
+
+#endif /* _BE_VISITOR_OPERATION_AMI_CH_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
new file mode 100644
index 00000000000..287018111cc
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_cs.h
@@ -0,0 +1,61 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// ami_cs.h
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL operations in client stubs
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_AMI_CS_H_
+#define _BE_VISITOR_OPERATION_AMI_CS_H_
+
+// ************************************************************
+// Operation visitor for client stubs
+// ************************************************************
+
+class be_visitor_operation_ami_cs : public be_visitor_operation
+{
+ //
+ // = TITLE
+ // be_visitor_operation_ami_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client stubs for operation
+ //
+ //
+public:
+ be_visitor_operation_ami_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_ami_cs (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+ // visit operation.
+
+ virtual int visit_argument (be_argument *node);
+ // visit argument to generate ParamData entries
+
+ // = template methods
+ int gen_pre_stub_info (be_operation *node,
+ be_type *bt);
+ // generate any info before the actual code for the stub is generated
+
+ // =helper
+ virtual int post_process (be_decl *);
+ // stuff to output after every member of the scope is handled
+};
+
+#endif /* _BE_VISITOR_OPERATION_AMI_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_exception_holder_operation_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_exception_holder_operation_cs.h
new file mode 100644
index 00000000000..95511995658
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_exception_holder_operation_cs.h
@@ -0,0 +1,48 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_ami_exception_holder_operation_cs.h
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL operations in client stubs
+//
+// = AUTHOR
+// Michael Kircher <Michael.Kircher@mchp.siemens.de<
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_OPERATION_AMI_EXCEPTION_HOLDER_OPERATION_CS_H_
+#define _BE_VISITOR_OPERATION_OPERATION_AMI_EXCEPTION_HOLDER_OPERATION_CS_H_
+
+
+class be_visitor_operation_ami_exception_holder_operation_cs : public be_visitor_operation
+{
+ //
+ // = TITLE
+ // be_visitor_operation_ami_exception_holder_operation_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client stubs for operation
+ //
+ //
+public:
+ be_visitor_operation_ami_exception_holder_operation_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_ami_exception_holder_operation_cs (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+ // visit operation.
+};
+
+
+
+#endif /* _BE_VISITOR_OPERATION_OPERATION_AMI_EXCEPTION_HOLDER_OPERATION_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_reply_stub_operation_ch.h b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_reply_stub_operation_ch.h
new file mode 100644
index 00000000000..800641aa5d9
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_reply_stub_operation_ch.h
@@ -0,0 +1,51 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// ami_handler_reply_stub_operation_ch.h
+//
+// = DESCRIPTION
+// Visitor for generating code for AMI Handler call back operations
+// in client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale and Alexander Babu Arulanthu
+// <alex@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_ami_handler_reply_stub_operation_ch_H_
+#define _BE_VISITOR_OPERATION_ami_handler_reply_stub_operation_ch_H_
+
+// ************************************************************
+// Operation visitor for server header
+// ************************************************************
+
+class be_visitor_operation_ami_handler_reply_stub_operation_ch : public be_visitor_operation
+{
+ //
+ // = TITLE
+ // be_visitor_ami_handler_reply_stub_operation_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the server header for operation
+ //
+ //
+public:
+ be_visitor_operation_ami_handler_reply_stub_operation_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_ami_handler_reply_stub_operation_ch (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+ // visit operation.
+};
+
+#endif /* _BE_VISITOR_OPERATION_ami_handler_reply_stub_operation_ch_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
new file mode 100644
index 00000000000..5dac08ce2b8
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_reply_stub_operation_cs.h
@@ -0,0 +1,67 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_ami_handler_reply_stub_operation_cs.h
+//
+// = DESCRIPTION
+// Visitor for generating code skelton code for IDL operations
+// of AMI Reply Handlers.
+//
+// = AUTHOR
+// Michael Kircher
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_OPERATION_AMI_HANDLER_REPLY_STUB_OPERATION_CS_H_
+#define _BE_VISITOR_OPERATION_OPERATION_AMI_HANDLER_REPLY_STUB_OPERATION_CS_H_
+
+// ************************************************************
+// Operation visitor for client stubs
+// ************************************************************
+
+class be_visitor_operation_ami_handler_reply_stub_operation_cs : public be_visitor_operation
+{
+ //
+ // = TITLE
+ // be_visitor_operation_ami_handler_operation_cs
+ //
+ // = DESCRIPTION
+ // Visitor for generating code skelton code for IDL operations
+ // of AMI Reply Handlers.
+ //
+ //
+public:
+ be_visitor_operation_ami_handler_reply_stub_operation_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_ami_handler_reply_stub_operation_cs (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+ // visit operation.
+
+ virtual int visit_argument (be_argument *node);
+ // visit argument to generate ParamData entries
+
+ // = template methods
+ 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 *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
+};
+
+#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
new file mode 100644
index 00000000000..a37510cca05
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/arglist.h
@@ -0,0 +1,56 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// arglist.h
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL operations. This generates the
+// operation signature.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_ARGLIST_H_
+#define _BE_VISITOR_OPERATION_ARGLIST_H_
+
+// ******************************************************************************
+// Operation visitor for argument list - generates parameters in the signature
+// ******************************************************************************
+
+class be_visitor_operation_arglist : public be_visitor_operation
+{
+ //
+ // = TITLE
+ // be_visitor_operaion_arglist
+ //
+ // = DESCRIPTION
+ // This is a visitor to generate operation argument list
+ //
+ //
+public:
+ be_visitor_operation_arglist (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_arglist (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+ // visit the operation
+
+ virtual int visit_argument (be_argument *node);
+ // visit each argument
+
+ 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.h b/TAO/TAO_IDL/be_include/be_visitor_operation/argument.h
new file mode 100644
index 00000000000..06a7d315b10
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/argument.h
@@ -0,0 +1,56 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// argument.h
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL operations. This is a generic visitor
+// that calls visitors for the Argument class.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_ARGUMENT_H_
+#define _BE_VISITOR_OPERATION_ARGUMENT_H_
+
+// ************************************************************
+// generic operation visitor for docall, upcall, pre/post
+// ************************************************************
+
+class be_visitor_operation_argument : public be_visitor_operation
+{
+ //
+ // = TITLE
+ // be_visitor_operation_argument
+ //
+ // = DESCRIPTION
+ // This is a visitor to generate a variable declaration ofr an operation
+ // return type
+ //
+public:
+ be_visitor_operation_argument (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_argument (void);
+ // destructor
+
+ virtual int post_process (be_decl *);
+ // stuff to o/p after each element of the scope is handled
+
+ virtual int visit_operation (be_operation *node);
+ // visit the operation
+
+ virtual int visit_argument (be_argument *node);
+ // visit argument
+};
+
+#endif /* _BE_VISITOR_OPERATION_ARGUMENT_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/argument_invoke.h b/TAO/TAO_IDL/be_include/be_visitor_operation/argument_invoke.h
new file mode 100644
index 00000000000..47ed79ccfaa
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/argument_invoke.h
@@ -0,0 +1,66 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// argument_invoke.h
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL operations. This is a visitor for
+// passing arguments to the CDR operators in a compiled marshaling
+// stub/skeleton
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_ARGUMENT_INVOKE_H_
+#define _BE_VISITOR_OPERATION_ARGUMENT_INVOKE_H_
+
+// ************************************************************
+// generic operation visitor for docall, upcall, pre/post
+// ************************************************************
+
+class be_visitor_operation_argument_invoke
+ : public be_visitor_operation_argument
+{
+ //
+ // = TITLE
+ // be_compiled_visitor_operation_argument_invoke
+ //
+ // = DESCRIPTION
+ // This is a visitor to generate a variable declaration of an operation
+ // return type
+ //
+public:
+ be_visitor_operation_argument_invoke (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_argument_invoke (void);
+ // destructor
+
+ virtual int pre_process (be_decl *bd);
+ // stuff to o/p before each element of the scope is handled
+
+ virtual int post_process (be_decl *bd);
+ // stuff to o/p after each element of the scope is handled
+
+ enum LAST_ARG_PRINTED
+ {
+ TAO_ARG_NONE,
+ TAO_ARG_IN,
+ TAO_ARG_INOUT,
+ TAO_ARG_OUT
+ };
+
+private:
+ LAST_ARG_PRINTED last_arg_printed_;
+};
+
+#endif /* _BE_VISITOR_OPERATION_ARGUMENT_INVOKE_H_ */
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
new file mode 100644
index 00000000000..183b1baa7b3
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/argument_marshal.h
@@ -0,0 +1,88 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// argument_marshal.h
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL operations. This is a visitor for
+// passing arguments to the CDR operators in a compiled marshaling
+// stub/skeleton
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_ARGUMENT_MARSHAL_H_
+#define _BE_VISITOR_OPERATION_ARGUMENT_MARSHAL_H_
+
+// ************************************************************
+// generic operation visitor for docall, upcall, pre/post
+// ************************************************************
+
+class be_visitor_operation_argument_marshal
+ : public be_visitor_operation_argument
+{
+ //
+ // = TITLE
+ // be_compiled_visitor_operation_argument_marshal
+ //
+ // = DESCRIPTION
+ // This is a visitor to generate a variable declaration of an operation
+ // return type
+ //
+public:
+ be_visitor_operation_argument_marshal (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_argument_marshal (void);
+ // destructor
+
+ virtual int pre_process (be_decl *bd);
+ // stuff to o/p before each element of the scope is handled
+
+ virtual int post_process (be_decl *bd);
+ // stuff to o/p after each element of the scope is handled
+
+ enum LAST_ARG_PRINTED
+ {
+ TAO_ARG_NONE,
+ TAO_ARG_IN,
+ TAO_ARG_INOUT,
+ TAO_ARG_OUT
+ };
+
+private:
+ LAST_ARG_PRINTED last_arg_printed_;
+};
+
+// ****************************************************************
+
+class be_visitor_args_decl : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_compiled_args_decl
+ //
+ // = DESCRIPTION
+ // This is a visitor to generate variables declarations in the
+ // compiled marshaling stubs.
+ //
+public:
+ be_visitor_args_decl (be_visitor_context *ctx);
+ // constructor
+
+ int visit_array (be_array *node);
+ int visit_typedef (be_typedef *node);
+ int visit_argument (be_argument *node);
+ int visit_operation (be_operation *node);
+};
+
+#endif /* _BE_VISITOR_OPERATION_ARGUMENT_MARSHAL_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/base_proxy_impl_ch.h b/TAO/TAO_IDL/be_include/be_visitor_operation/base_proxy_impl_ch.h
new file mode 100644
index 00000000000..c8d2dd9158c
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/base_proxy_impl_ch.h
@@ -0,0 +1,45 @@
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// base_proxy_impl_ch.h
+//
+// = DESCRIPTION
+// Visitor for generating code for proxy implementations.
+//
+// = AUTHOR
+// Angelo Corsaro
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_BASE_PROXY_IMPL_CH_H_
+#define _BE_VISITOR_OPERATION_BASE_PROXY_IMPL_CH_H_
+
+
+class be_visitor_operation_base_proxy_impl_ch : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_operation_base_proxy_impl_ch
+ //
+ // = DESCRIPTION
+ // Concrete visitor that generates the code for the base class
+ // of Proxy Impls.
+ //
+ //
+public:
+ be_visitor_operation_base_proxy_impl_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_base_proxy_impl_ch (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+ // visit operation.
+};
+
+#endif /* _BE_VISITOR_OPERATION_BASE_PROXY_IMPL_CH_H_ */
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
new file mode 100644
index 00000000000..3bbb72d9107
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/direct_proxy_impl_ss.h
@@ -0,0 +1,48 @@
+//$Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// direct_proxy_impl_ss.h
+//
+// = DESCRIPTION
+// Visitor that generates the code for the operation
+// in the Direct Proxy Implementation.
+//
+// = AUTHOR
+// Angelo Corsaro
+//
+// ============================================================================
+
+#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_operation
+{
+ //
+ // = TITLE
+ // be_visitor_operation_direct_proxy_impl_ss
+ //
+ // = DESCRIPTION
+ // This visitor generates the code for the
+ // operation of the Direct Proxy Implementation.
+ //
+ //
+public:
+ be_visitor_operation_direct_proxy_impl_ss (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_direct_proxy_impl_ss (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+ // visit operation node.
+
+ virtual int gen_invoke (be_visitor_context &ctx, be_operation *node);
+ // A helper method to generate operation invocation code.
+};
+
+#endif /* _BE_VISITOR_OPERATION_DIRECT_PROXY_IMPL_SS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/exceptlist_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/exceptlist_cs.h
new file mode 100644
index 00000000000..1900c981438
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/exceptlist_cs.h
@@ -0,0 +1,51 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// exceptlist_cs.h
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL operations. This generates the tables
+// for the exceptions used by the stubs.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_EXCEPTIONLIST_CS_H_
+#define _BE_VISITOR_OPERATION_EXCEPTIONLIST_CS_H_
+
+// ******************************************************************************
+// Visitor for generating the exception list
+// ******************************************************************************
+
+class be_visitor_operation_exceptlist_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_operaion_exceptlist_cs
+ //
+ // = DESCRIPTION
+ // This is a visitor to generate operation exception list to be provided to
+ // the do_static_call
+ //
+ //
+public:
+ be_visitor_operation_exceptlist_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_exceptlist_cs (void);
+ // destructor
+
+ int visit_operation (be_operation *node);
+ // visit the operation
+};
+
+#endif /* _BE_VISITOR_OPERATION_EXCEPTIONLIST_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/exceptlist_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/exceptlist_ss.h
new file mode 100644
index 00000000000..7af7556bdd6
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/exceptlist_ss.h
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// exceptlist_ss.h
+//
+// = DESCRIPTION
+// Generates the array of user exception TypeCodes used by the
+// skeletons.
+//
+// = AUTHOR
+// Ossama Othman
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_EXCEPTIONLIST_SS_H_
+#define _BE_VISITOR_OPERATION_EXCEPTIONLIST_SS_H_
+
+// ***************************************************************************
+// Visitor for generating the user exception TypeCode list used by the
+// skeletons.
+// ***************************************************************************
+
+class be_visitor_operation_exceptlist_ss : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_operaion_exceptlist_ss
+ //
+ // = DESCRIPTION
+ // This is a visitor to generate operation exception TypeCode list
+ // to be used by the skeletons.
+ //
+ //
+public:
+
+ /// constructor
+ be_visitor_operation_exceptlist_ss (be_visitor_context * ctx);
+
+ /// destructor
+ ~be_visitor_operation_exceptlist_ss (void);
+
+ /// visit the operation
+ int visit_operation (be_operation * node);
+
+};
+
+#endif /* _BE_VISITOR_OPERATION_EXCEPTIONLIST_SS_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
new file mode 100644
index 00000000000..062923f54cd
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation.h
@@ -0,0 +1,105 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation.h
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL operations in client stubs
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_OPERATION_H_
+#define _BE_VISITOR_OPERATION_OPERATION_H_
+
+// ************************************************************
+// Generic Operation visitor with some helper methods
+// ************************************************************
+
+class be_visitor_operation : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_operation
+ //
+ // = DESCRIPTION
+ // This is a base helper visitor for operation node
+ //
+ //
+public:
+ be_visitor_operation (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation (void);
+ // destructor
+
+ // =helper
+
+ virtual int void_return_type (be_type *);
+ // is my return type void?
+
+ 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.
+ virtual size_t count_non_out_parameters (be_operation *node);
+
+ /// Special generation of throw_spec if it is an AMH ExceptionHolder
+ /// 0:false, 1:true
+ virtual int is_amh_exception_holder (be_interface *node);
+
+ virtual int gen_throw_spec (be_operation *node);
+ // generate the throw specification
+
+ virtual int gen_environment_decl (int argument_emitted,
+ be_operation *node);
+ // generate the ACE_ENV_ARG declaration, needs to know if there was
+ // at least one argument emitted to deal with all the commas.
+
+ virtual const char *gen_environment_var (void);
+ // generate the environment variable declaration
+
+ virtual int gen_raise_exception (be_type *return_type,
+ const char *exception_name,
+ const char *exception_arguments);
+ // helper that generates code for raising an exception
+
+ 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).
+
+ int gen_pre_stub_info (be_operation *node);
+ // generate any info before the actual code for the stub is generated
+
+ 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
+
+ void gen_stub_body_arglist (be_operation *node,
+ TAO_OutStream *os,
+ bool ami = false);
+
+ void gen_arg_template_param_name (AST_Decl *scope,
+ AST_Type *bt,
+ TAO_OutStream *os);
+};
+
+#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
new file mode 100644
index 00000000000..484a4d4dd34
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ch.h
@@ -0,0 +1,49 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_ch.h
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL operations in client header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_OPERATION_CH_H_
+#define _BE_VISITOR_OPERATION_OPERATION_CH_H_
+
+// ************************************************************
+// Operation visitor for client header
+// ************************************************************
+
+class be_visitor_operation_ch : public be_visitor_operation
+{
+ //
+ // = TITLE
+ // be_visitor_operation_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client header for operation
+ //
+ //
+public:
+ be_visitor_operation_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_ch (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+ // visit operation.
+};
+
+#endif /* _BE_VISITOR_OPERATION_OPERATION_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/operation_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_cs.h
new file mode 100644
index 00000000000..2a8faa405bc
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_cs.h
@@ -0,0 +1,56 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_cs.h
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL operations in client stubs
+//
+// = AUTHOR
+// Aniruddha Gokhale & Angelo Corsaro
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_OPERATION_CS_H_
+#define _BE_VISITOR_OPERATION_OPERATION_CS_H_
+
+// ************************************************************
+// Operation visitor for client stubs
+// ************************************************************
+
+class be_visitor_operation_cs : public be_visitor_operation
+{
+ //
+ // = TITLE
+ // be_visitor_operation_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client stubs for operation
+ //
+ //
+public:
+ be_visitor_operation_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_cs (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+ // visit operation.
+
+ virtual int visit_argument (be_argument *node);
+ // visit argument to generate ParamData entries
+
+ // =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
new file mode 100644
index 00000000000..55a3c1fd955
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ih.h
@@ -0,0 +1,47 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_ih.h
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL operations in implementation header
+//
+// = AUTHOR
+// Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_OPERATION_IH_H_
+#define _BE_VISITOR_OPERATION_OPERATION_IH_H_
+
+// ************************************************************
+// Operation visitor for implementation header
+// ************************************************************
+
+class be_visitor_operation_ih : public be_visitor_operation
+{
+ //
+ // = TITLE
+ // be_visitor_operation_ih
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the implementation header for operation
+ //
+ //
+public:
+ be_visitor_operation_ih (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_ih (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+ // visit operation. We provide code for this method in the derived class
+};
+
+#endif /* _BE_VISITOR_OPERATION_OPERATION_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
new file mode 100644
index 00000000000..aa5da748f19
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_is.h
@@ -0,0 +1,47 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_is.cpp
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL operations in implementation skeleton
+//
+// = AUTHOR
+// Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_OPERATION_IS_CPP_
+#define _BE_VISITOR_OPERATION_OPERATION_IS_CPP_
+
+// ************************************************************
+// Operation visitor for implementation skeleton
+// ************************************************************
+
+class be_visitor_operation_is : public be_visitor_operation
+{
+ //
+ // = TITLE
+ // be_visitor_operation_is
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the implementation skeleton for operation
+ //
+ //
+public:
+ be_visitor_operation_is (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_is (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+ // visit operation. We provide code for this method in the derived class
+};
+
+#endif /* _BE_VISITOR_OPERATION_OPERATION_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
new file mode 100644
index 00000000000..2074b69417e
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_sh.h
@@ -0,0 +1,49 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_sh.h
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL operations in server header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_OPERATION_SH_H_
+#define _BE_VISITOR_OPERATION_OPERATION_SH_H_
+
+// ************************************************************
+// Operation visitor for server header
+// ************************************************************
+
+class be_visitor_operation_sh : public be_visitor_operation
+{
+ //
+ // = TITLE
+ // be_visitor_operation_sh
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the server header for operation
+ //
+ //
+public:
+ be_visitor_operation_sh (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_sh (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+ // visit operation.
+};
+
+#endif /* _BE_VISITOR_OPERATION_OPERATION_SH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ss.h
new file mode 100644
index 00000000000..826d9912e6c
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ss.h
@@ -0,0 +1,65 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_ss.h
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL operations in server skeletons
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_OPERATION_SS_H_
+#define _BE_VISITOR_OPERATION_OPERATION_SS_H_
+
+// ************************************************************
+// Operation visitor for server skeletons
+// ************************************************************
+
+class be_visitor_operation_ss : public be_visitor_operation
+{
+ //
+ // = TITLE
+ // be_visitor_operation_ss
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the server skeletons for operation
+ //
+ //
+public:
+ be_visitor_operation_ss (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_ss (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+ // visit operation. We provide code for this method in the derived class
+
+ virtual int visit_argument (be_argument *node);
+ // visit argument to generate ParamData entries
+
+ // template methods
+
+ virtual int gen_pre_skel_info (be_operation *node);
+ // generate any pre skeleton code info
+
+ /// Generate the skeleton operation body.
+ int gen_skel_operation_body (be_operation * node,
+ be_type * return_type);
+
+ /// Generate the skeleton operation argument list.
+ void gen_skel_body_arglist (be_operation * node,
+ TAO_OutStream * os);
+};
+
+#endif /* _BE_VISITOR_OPERATION_OPERATION_SS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/proxy_impl_xh.h b/TAO/TAO_IDL/be_include/be_visitor_operation/proxy_impl_xh.h
new file mode 100644
index 00000000000..7c2716e32c3
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/proxy_impl_xh.h
@@ -0,0 +1,45 @@
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// proxy_impl_xh.h
+//
+// = DESCRIPTION
+// Visitor for generating code for proxy implementations.
+//
+// = AUTHOR
+// Angelo Corsaro
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_PROXY_IMPL_XH_H_
+#define _BE_VISITOR_OPERATION_PROXY_IMPL_XH_H_
+
+
+class be_visitor_operation_proxy_impl_xh : public be_visitor_operation
+{
+ //
+ // = TITLE
+ // be_visitor_operation_proxy_impl_xh
+ //
+ // = DESCRIPTION
+ // Concrete visitor that generates the code for the base class
+ // of Proxy Impls.
+ //
+ //
+public:
+ be_visitor_operation_proxy_impl_xh (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_proxy_impl_xh (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+ // visit operation.
+};
+
+#endif /* _BE_VISITOR_OPERATION_PROXY_IMPL_XH_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
new file mode 100644
index 00000000000..51b2b2340e4
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/remote_proxy_impl_cs.h
@@ -0,0 +1,58 @@
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_remote_proxy_impl_cs.h
+//
+// = DESCRIPTION
+// Visitor for generating code for remote proxy impls
+// in client stubs.
+//
+//
+// = AUTHOR
+// Aniruddha Gokhale & Angelo Corsaro
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_REMOTE_PROXY_IMPL_OPERATION_REMOTE_PROXY_IMPL_CS_H_
+#define _BE_VISITOR_OPERATION_REMOTE_PROXY_IMPL_OPERATION_REMOTE_PROXY_IMPL_CS_H_
+
+// ************************************************************
+// Operation_Remote_Proxy_Impl visitor for client stubs
+// ************************************************************
+
+class be_visitor_operation_remote_proxy_impl_cs : public be_visitor_operation
+{
+ //
+ // = TITLE
+ // be_visitor_operation_remote_proxy_impl_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client invocation
+ // code for the Remote Proxy Implementation.
+ //
+public:
+ be_visitor_operation_remote_proxy_impl_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_remote_proxy_impl_cs (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+ // visit operation_remote_proxy_impl.
+
+ virtual int visit_argument (be_argument *node);
+ // visit argument to generate ParamData entries
+
+ // = template methods
+
+ // =helper
+ virtual int post_process (be_decl *);
+ // stuff to output after every member of the scope is handled
+};
+
+#endif /* _BE_VISITOR_OPERATION_REMOTE_PROXY_IMPL_OPERATION_REMOTE_PROXY_IMPL_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype.h b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype.h
new file mode 100644
index 00000000000..056b90f6498
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype.h
@@ -0,0 +1,104 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// rettype.h
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL operations. This generates the return
+// type of the operation
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_RETTYPE_H_
+#define _BE_VISITOR_OPERATION_RETTYPE_H_
+
+// ***********************************************************************
+// Operation visitor for return types in the signature of the operation
+// ***********************************************************************
+
+class be_visitor_operation_rettype : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_operation_ch
+ //
+ // = DESCRIPTION
+ // This is a visitor to generate operation return types
+ //
+ //
+public:
+ be_visitor_operation_rettype (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_rettype (void);
+ // destructor
+
+ int visit_array (be_array *node);
+ // visit an array node
+
+ int visit_enum (be_enum *node);
+ // visit an enum node
+
+ int visit_interface (be_interface *node);
+ // visit an interface node
+
+ int visit_interface_fwd (be_interface_fwd *node);
+ // visit an interface node
+
+ int visit_native (be_native *node);
+ // visit native type
+
+ int visit_predefined_type (be_predefined_type *node);
+ // visit a predefined type node
+
+ int visit_sequence (be_sequence *node);
+ // visit a sequence node
+
+ int visit_string (be_string *node);
+ // visit a sequence node
+
+ int visit_structure (be_structure *node);
+ // visit a structure node
+
+ int visit_typedef (be_typedef *node);
+ // visit a typedef node
+
+ int visit_union (be_union *node);
+ // visit a union node
+
+ int visit_valuetype (be_valuetype *node);
+ // visit a valuetype node
+
+ int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit a forward declared valuetype node
+
+ int visit_component (be_component *node);
+ // visit a component node
+
+ int visit_component_fwd (be_component_fwd *node);
+ // visit a forward declared component node
+
+ int visit_eventtype (be_eventtype *node);
+ // visit an eventtype node
+
+ int visit_eventtype_fwd (be_eventtype_fwd *node);
+ // visit a forward declared eventtype node
+
+ int visit_home (be_home *node);
+ // visit a component home node
+
+ int visit_valuebox (be_valuebox *node);
+ // visit a valuebox node
+};
+
+#endif /* _BE_VISITOR_OPERATION_RETTYPE_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_return_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_return_cs.h
new file mode 100644
index 00000000000..eec65ea8f52
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_return_cs.h
@@ -0,0 +1,101 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// rettype_return_cs.h
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL operations. This generates the return
+// statement for returning the return type variable in the client stub.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_RETTYPE_RETURN_CS_H_
+#define _BE_VISITOR_OPERATION_RETTYPE_CS_H_
+
+// ************************************************************
+// Operation visitor for returning the return val
+// ************************************************************
+
+class be_visitor_operation_rettype_return_cs :public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_operation_rettype_return_cs
+ //
+ // = DESCRIPTION
+ // This is a visitor to generate a variable declaration ofr an operation
+ // return type
+ //
+public:
+ be_visitor_operation_rettype_return_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_rettype_return_cs (void);
+ // destructor
+
+ int visit_array (be_array *node);
+ // visit an array node
+
+ int visit_enum (be_enum *node);
+ // visit an enum node
+
+ int visit_interface (be_interface *node);
+ // visit an interface node
+
+ int visit_interface_fwd (be_interface_fwd *node);
+ // visit an interface node
+
+ int visit_valuebox (be_valuebox *node);
+ // visit a valuebox node
+
+ int visit_valuetype (be_valuetype *node);
+ // visit valuetype
+
+ int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit valuetype forward
+
+ int visit_predefined_type (be_predefined_type *node);
+ // visit a predefined type node
+
+ int visit_sequence (be_sequence *node);
+ // visit a sequence node
+
+ int visit_string (be_string *node);
+ // visit a sequence node
+
+ int visit_structure (be_structure *node);
+ // visit a structure node
+
+ int visit_typedef (be_typedef *node);
+ // visit a typedef node
+
+ int visit_union (be_union *node);
+ // visit a union node
+
+ int visit_component (be_component *node);
+ // visit component
+
+ int visit_component_fwd (be_component_fwd *node);
+ // visit component forward
+
+ int visit_eventtype (be_eventtype *node);
+ // visit eventtype
+
+ int visit_eventtype_fwd (be_eventtype_fwd *node);
+ // visit eventtype forward
+
+ int visit_home (be_home *node);
+ // visit component home
+};
+
+#endif /* _BE_VISITOR_OPERATION_RETTYPE_RETURN_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/smart_proxy_ch.h b/TAO/TAO_IDL/be_include/be_visitor_operation/smart_proxy_ch.h
new file mode 100644
index 00000000000..6dbe525cc45
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/smart_proxy_ch.h
@@ -0,0 +1,51 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// smart_proxy_ch.h
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL operations for the smart proxy case
+// inside of the client stubs header
+//
+// = AUTHOR
+// Kirthika Parameswaran <kirthika@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_SMART_PROXY_CH_H_
+#define _BE_VISITOR_OPERATION_SMART_PROXY_CH_H_
+
+// ************************************************************
+// Operation visitor for client header in the smart proxy class
+// ************************************************************
+
+class be_visitor_operation_smart_proxy_ch : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_operation_smart_proxy_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client header for operation
+ // in the smart proxy class
+ //
+ //
+public:
+ be_visitor_operation_smart_proxy_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_smart_proxy_ch (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+ // visit operation node.
+};
+
+#endif /* _BE_VISITOR_OPERATION_SMART_PROXY_CH_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
new file mode 100644
index 00000000000..8bbba1ab4ee
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/smart_proxy_cs.h
@@ -0,0 +1,51 @@
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_smart_proxy_cs.h
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL operations in client stubs
+//
+// = AUTHOR
+// Kirthika Parameswaran <kirthika@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_OPERATION_SMART_PROXY_CS_H_
+#define _BE_VISITOR_OPERATION_OPERATION_SMART_PROXY_CS_H_
+
+// ************************************************************
+// Operation visitor for client stubs
+// ************************************************************
+
+class be_visitor_operation_smart_proxy_cs : public be_visitor_operation
+{
+ //
+ // = TITLE
+ // be_visitor_operation_smart_proxy_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client stubs for operation
+ //
+ //
+public:
+ be_visitor_operation_smart_proxy_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_smart_proxy_cs (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+ // visit operation.
+
+ virtual int gen_invoke (be_visitor_context &ctx, be_operation *node);
+ // A helper method to generate operation invocation code.
+};
+
+#endif /* _BE_VISITOR_OPERATION_OPERATION_SMART_PROXY_CS_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/tie_sh.h b/TAO/TAO_IDL/be_include/be_visitor_operation/tie_sh.h
new file mode 100644
index 00000000000..14d0f2a4243
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/tie_sh.h
@@ -0,0 +1,50 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// tie_sh.h
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL operations for the TIE class inside
+// the server header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_TIE_SH_H_
+#define _BE_VISITOR_OPERATION_TIE_SH_H_
+
+// ***********************************************************************
+// Operation visitor for operation declaration inside the TIE class
+// ***********************************************************************
+
+class be_visitor_operation_tie_sh : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_operation_tie_sh
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the operaton inside a TIE class
+ //
+ //
+public:
+ be_visitor_operation_tie_sh (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_tie_sh (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_VISITOR_OPERATION_TIE_SH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/tie_si.h b/TAO/TAO_IDL/be_include/be_visitor_operation/tie_si.h
new file mode 100644
index 00000000000..e38012009a7
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/tie_si.h
@@ -0,0 +1,50 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// tie_si.h
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL operations for the TIE class inside
+// the server inline
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_TIE_SI_H_
+#define _BE_VISITOR_OPERATION_TIE_SI_H_
+
+// ***********************************************************************
+// Operation visitor for operation declaration inside the TIE class
+// ***********************************************************************
+
+class be_visitor_operation_tie_si : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_operation_tie_ss
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the operaton inside a TIE class
+ //
+ //
+public:
+ be_visitor_operation_tie_si (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_operation_tie_si (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_VISITOR_OPERATION_TIE_SI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/upcall_command_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/upcall_command_ss.h
new file mode 100644
index 00000000000..45124e346a1
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/upcall_command_ss.h
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// upcall_command_ss.cpp
+//
+// = DESCRIPTION
+// Visitor that generates operation-specific TAO::Upcall_Command
+// objects in skeletons.
+//
+// = AUTHOR
+// Ossama Othman
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OPERATION_UPCALL_COMMAND_SS_H_
+#define _BE_VISITOR_OPERATION_UPCALL_COMMAND_SS_H_
+
+class be_visitor_operation_upcall_command_ss
+ : public be_visitor_operation
+{
+public:
+
+ /// constructor
+ be_visitor_operation_upcall_command_ss (be_visitor_context * ctx);
+
+ /// destructor
+ ~be_visitor_operation_upcall_command_ss (void);
+
+ /// Same as visit_operation() but override full_skel_name and
+ /// upcall_command_name.
+ int visit (be_operation * node,
+ char const * full_skel_name,
+ char const * upcall_command_name);
+
+ int gen_nested_namespace_begin (be_module *node);
+
+ int gen_nested_namespace_end (be_module *node);
+
+private:
+
+ /// Generate the upcall.
+ int gen_upcall (be_operation * node);
+
+};
+
+#endif /* _BE_VISITOR_OPERATION_UPCALL_COMMAND_SS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_root.h b/TAO/TAO_IDL/be_include/be_visitor_root.h
new file mode 100644
index 00000000000..3ab0e4f4448
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_root.h
@@ -0,0 +1,40 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_root.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Root class
+//
+// = AUTHOR
+// Aniruddha Gokhale and Carlos O'Ryan
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_ROOT_H
+#define TAO_BE_VISITOR_ROOT_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"
+#include "be_visitor_root/root_cs.h"
+#include "be_visitor_root/root_sh.h"
+#include "be_visitor_root/root_si.h"
+#include "be_visitor_root/root_ss.h"
+#include "be_visitor_root/root_sth.h"
+#include "be_visitor_root/root_is.h"
+#include "be_visitor_root/root_ih.h"
+#include "be_visitor_root/any_op.h"
+#include "be_visitor_root/cdr_op.h"
+#include "be_visitor_root/serializer_op.h"
+
+#endif // TAO_BE_VISITOR_ROOT_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/any_op.h b/TAO/TAO_IDL/be_include/be_visitor_root/any_op.h
new file mode 100644
index 00000000000..e7c0ea72c0c
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_root/any_op.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Root class
+// This one provides code generation for the Any operators for elements of
+// the Root scope.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ROOT_ANY_OP_H_
+#define _BE_VISITOR_ROOT_ANY_OP_H_
+
+class be_visitor_root_any_op : public be_visitor_root
+{
+ //
+ // = TITLE
+ // be_visitor_root_any_op
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for root that generates the Any operator
+ // declarations and implementations
+ //
+
+public:
+ be_visitor_root_any_op (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_root_any_op (void);
+ // destructor
+
+ virtual int visit_root (be_root *node);
+ // visit root
+};
+
+#endif /* _BE_VISITOR_ROOT_ANY_OP_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/cdr_op.h b/TAO/TAO_IDL/be_include/be_visitor_root/cdr_op.h
new file mode 100644
index 00000000000..2df86ebcdfe
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_root/cdr_op.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Root class
+// This one provides code generation for the CDR operators for elements of
+// the Root scope.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ROOT_CDR_OP_H_
+#define _BE_VISITOR_ROOT_CDR_OP_H_
+
+class be_visitor_root_cdr_op : public be_visitor_root
+{
+ //
+ // = TITLE
+ // be_visitor_root_cdr_op
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for root that generates the CDR operator
+ // declarations and implementations
+ //
+
+public:
+ be_visitor_root_cdr_op (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_root_cdr_op (void);
+ // destructor
+
+ virtual int visit_root (be_root *node);
+ // visit root
+};
+
+#endif /* _BE_VISITOR_ROOT_CDR_OP_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root.h b/TAO/TAO_IDL/be_include/be_visitor_root/root.h
new file mode 100644
index 00000000000..2347c2f7af2
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_root/root.h
@@ -0,0 +1,111 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Root class
+// This one provides the generic visitor for the Root node.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ROOT_ROOT_H_
+#define _BE_VISITOR_ROOT_ROOT_H_
+
+class be_visitor_root : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_root
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for root that abstracts all common tasks
+ //
+
+public:
+ be_visitor_root (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_root (void);
+ // destructor
+
+ virtual int visit_root (be_root *node);
+ // visit root
+
+ // =visit methods on all elements syntactically valid in a Root scope
+
+ virtual int visit_constant (be_constant *node);
+ // visit a constant
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_exception (be_exception *node);
+ // visit an exception
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit a forward declared interface
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit a valuebox
+
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit a valuetype
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit a forward declared valuetype
+
+ virtual int visit_eventtype (be_eventtype *node);
+ // visit an eventtype
+
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+ // visit a forward declared eventtype
+
+ virtual int visit_component (be_component *node);
+ // visit a component
+
+ virtual int visit_component_fwd (be_component_fwd *node);
+ // visit a forward declared component
+
+ virtual int visit_home (be_home *node);
+ // visit a home
+
+ virtual int visit_module (be_module *node);
+ // visit a module
+
+ 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
+
+ // =helper. This is used by derived clases to set the right context
+
+ virtual int init (void);
+ // will be overridden by derived classes that set the appropriate context
+};
+
+#endif /* _BE_VISITOR_ROOT_ROOT_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_ch.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_ch.h
new file mode 100644
index 00000000000..c36cf7f5192
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_ch.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Root class
+// This one provides code generation for elements of the Root node in the
+// client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ROOT_ROOT_CH_H_
+#define _BE_VISITOR_ROOT_ROOT_CH_H_
+
+class be_visitor_root_ch : public be_visitor_root
+{
+ //
+ // = TITLE
+ // be_visitor_root_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client header for root
+ //
+ //
+public:
+ be_visitor_root_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_root_ch (void);
+ // destructor
+
+ virtual int init (void);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_VISITOR_ROOT_ROOT_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_ci.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_ci.h
new file mode 100644
index 00000000000..e39eab1ac4f
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_ci.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root_ci.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Root class
+// This one provides code generation for elements of the Root node in the
+// client inline.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ROOT_ROOT_CI_H_
+#define _BE_VISITOR_ROOT_ROOT_CI_H_
+
+class be_visitor_root_ci : public be_visitor_root
+{
+ //
+ // = TITLE
+ // be_visitor_root_ci
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client inline for root
+ //
+ //
+public:
+ be_visitor_root_ci (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_root_ci (void);
+ // destructor
+
+ virtual int init (void);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_VISITOR_ROOT_ROOT_CI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_cs.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_cs.h
new file mode 100644
index 00000000000..64b5df10792
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_cs.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Root class
+// This one provides code generation for elements of the Root node in the
+// client stubs.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ROOT_ROOT_CS_H_
+#define _BE_VISITOR_ROOT_ROOT_CS_H_
+
+class be_visitor_root_cs : public be_visitor_root
+{
+ //
+ // = TITLE
+ // be_visitor_root_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client stubs for root
+ //
+ //
+public:
+ be_visitor_root_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_root_cs (void);
+ // destructor
+
+ virtual int init (void);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_VISITOR_ROOT_ROOT_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_ih.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_ih.h
new file mode 100644
index 00000000000..004bc0f73d5
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_ih.h
@@ -0,0 +1,45 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root_ih.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Root class
+// This one provides code generation for elements of the Root node in the
+// implementation header.
+//
+// = AUTHOR
+// Yamuna Krishnamurthy
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ROOT_ROOT_IH_H_
+#define _BE_VISITOR_ROOT_ROOT_IH_H_
+
+class be_visitor_root_ih : public be_visitor_root
+{
+ //
+ // = TITLE
+ // be_visitor_root_ih
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the implementation header for root
+ //
+ //
+public:
+ be_visitor_root_ih (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_root_ih (void);
+ // destructor
+
+ virtual int init (void);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_VISITOR_ROOT_ROOT_IH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_is.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_is.h
new file mode 100644
index 00000000000..d39b16aeb8b
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_is.h
@@ -0,0 +1,45 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root_is.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Root class
+// This one provides code generation for elements of the Root node in the
+// implementation skeletons.
+//
+// = AUTHOR
+// Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ROOT_ROOT_IS_H_
+#define _BE_VISITOR_ROOT_ROOT_IS_H_
+
+class be_visitor_root_is : public be_visitor_root
+{
+ //
+ // = TITLE
+ // be_visitor_root_is
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the implementation skeletons for root
+ //
+ //
+public:
+ be_visitor_root_is (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_root_is (void);
+ // destructor
+
+ virtual int init (void);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_VISITOR_ROOT_ROOT_IS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_sh.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_sh.h
new file mode 100644
index 00000000000..d1c42ca580e
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_sh.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root_sh.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Root class
+// This one provides code generation for elements of the Root node in the
+// server header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ROOT_ROOT_SH_H_
+#define _BE_VISITOR_ROOT_ROOT_SH_H_
+
+class be_visitor_root_sh : public be_visitor_root
+{
+ //
+ // = TITLE
+ // be_visitor_root_sh
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the server header for root
+ //
+ //
+public:
+ be_visitor_root_sh (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_root_sh (void);
+ // destructor
+
+ virtual int init (void);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_VISITOR_ROOT_ROOT_SH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_si.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_si.h
new file mode 100644
index 00000000000..b615a08d69d
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_si.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root_si.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Root class
+// This one provides code generation for elements of the Root node in the
+// server inline.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ROOT_ROOT_SI_H_
+#define _BE_VISITOR_ROOT_ROOT_SI_H_
+
+class be_visitor_root_si : public be_visitor_root
+{
+ //
+ // = TITLE
+ // be_visitor_root_si
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the server inline for root
+ //
+ //
+public:
+ be_visitor_root_si (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_root_si (void);
+ // destructor
+
+ virtual int init (void);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_VISITOR_ROOT_ROOT_SI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_ss.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_ss.h
new file mode 100644
index 00000000000..0c75d137122
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_ss.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root_ss.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Root class
+// This one provides code generation for elements of the Root node in the
+// server skeletons.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ROOT_ROOT_SS_H_
+#define _BE_VISITOR_ROOT_ROOT_SS_H_
+
+class be_visitor_root_ss : public be_visitor_root
+{
+ //
+ // = TITLE
+ // be_visitor_root_ss
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the server skeletons for root
+ //
+ //
+public:
+ be_visitor_root_ss (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_root_ss (void);
+ // destructor
+
+ virtual int init (void);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_VISITOR_ROOT_ROOT_SS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_sth.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_sth.h
new file mode 100644
index 00000000000..e15265275c7
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_sth.h
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root_sth.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Root class
+// This one provides code generation for elements of the Root node in the
+// server template header.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ROOT_ROOT_STH_H_
+#define _BE_VISITOR_ROOT_ROOT_STH_H_
+
+class be_visitor_root_sth : public be_visitor_root
+{
+ //
+ // = TITLE
+ // be_visitor_root_sth
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the server template
+ // header for root.
+ //
+ //
+public:
+ be_visitor_root_sth (be_visitor_context *ctx);
+ // Constructor.
+
+ ~be_visitor_root_sth (void);
+ // Destructor.
+
+ virtual int init (void);
+ // Set the right context and make a visitor.
+
+ // Overrides of base class methods so we can skip unnecessary nodes.
+
+ virtual int visit_scope (be_scope *node);
+
+ virtual int visit_module (be_module *node);
+
+ virtual int visit_interface (be_interface *node);
+
+ virtual int visit_component (be_component *node);
+};
+
+#endif /* _BE_VISITOR_ROOT_ROOT_STH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/serializer_op.h b/TAO/TAO_IDL/be_include/be_visitor_root/serializer_op.h
new file mode 100644
index 00000000000..d0628c4b249
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_root/serializer_op.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Root class
+// This one provides code generation for the TAO::DCPS::Serializer operators
+// for elements of the Root scope.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_ROOT_serializer_op_H_
+#define _BE_VISITOR_ROOT_serializer_op_H_
+
+class be_visitor_root_serializer_op : public be_visitor_root
+{
+ //
+ // = TITLE
+ // be_visitor_root_serializer_op
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for root that generates the Serializer operator
+ // declarations and implementations
+ //
+
+public:
+ be_visitor_root_serializer_op (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_root_serializer_op (void);
+ // destructor
+
+ virtual int visit_root (be_root *node);
+ // visit root
+};
+
+#endif /* _BE_VISITOR_ROOT_serializer_op_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_scope.h b/TAO/TAO_IDL/be_include/be_visitor_scope.h
new file mode 100644
index 00000000000..061aa2c158f
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_scope.h
@@ -0,0 +1,71 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_scope.h
+//
+// = DESCRIPTION
+// Concrete visitor for the base "BE_Scope" node
+//
+// = AUTHOR
+// Aniruddha Gokhale and Carlos O'Ryan
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_SCOPE_H
+#define TAO_BE_VISITOR_SCOPE_H
+
+#include "be_visitor_decl.h"
+
+
+class be_visitor_scope : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_scope
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for the be_scope node. Its only purpose is to
+ // iterate over the elements of the scope
+ //
+public:
+ be_visitor_scope (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_scope (void);
+ // destructor
+
+ int visit_scope (be_scope *node);
+ // visit scope
+
+ virtual int post_process (be_decl *);
+ // do any processing after every element except the last one of the scope is
+ // processed
+
+ virtual int pre_process (be_decl *);
+ // do any processing prior to processing the element in the scope
+
+ virtual int elem_number (void);
+ // return the element number that is being processed
+
+ virtual int next_elem (be_decl *elem, be_decl *&);
+ // get the successor to elem
+
+ virtual bool last_node (be_decl *bd);
+ // Is bd the last node in the scope
+
+ bool last_inout_or_out_node (be_decl *bd);
+ // Is bd the last inout or out in the scope
+
+protected:
+ int elem_number_;
+};
+
+
+#endif // TAO_BE_VISITOR_SCOPE_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence.h b/TAO/TAO_IDL/be_include/be_visitor_sequence.h
new file mode 100644
index 00000000000..227df533003
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_sequence.h
@@ -0,0 +1,23 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+#ifndef TAO_BE_VISITOR_SEQUENCE_H
+#define TAO_BE_VISITOR_SEQUENCE_H
+
+#include "idl_defines.h"
+
+#include "be_visitor_decl.h"
+#include "be_visitor_sequence/sequence_ch.h"
+#include "be_visitor_sequence/sequence_cs.h"
+#include "be_visitor_sequence/sequence_base.h"
+#include "be_visitor_sequence/buffer_type.h"
+#include "be_visitor_sequence/any_op_ch.h"
+#include "be_visitor_sequence/any_op_cs.h"
+#include "be_visitor_sequence/cdr_op_ch.h"
+#include "be_visitor_sequence/cdr_op_cs.h"
+#include "be_visitor_sequence/serializer_op_ch.h"
+#include "be_visitor_sequence/serializer_op_cs.h"
+
+#endif /* TAO_BE_VISITOR_SEQUENCE_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/any_op_ch.h
new file mode 100644
index 00000000000..71cc3bf65c5
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/any_op_ch.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Sequence class
+// This one provides code generation for the Any operators for the Sequence
+// node in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_SEQUENCE_ANY_OP_CH_H_
+#define _BE_VISITOR_SEQUENCE_ANY_OP_CH_H_
+
+class be_visitor_sequence_any_op_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_sequence_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for sequence that generates the Any operator
+ // declarations
+ //
+
+public:
+ be_visitor_sequence_any_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_sequence_any_op_ch (void);
+ // destructor
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence
+};
+
+#endif /* _BE_VISITOR_SEQUENCE_ANY_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/any_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/any_op_cs.h
new file mode 100644
index 00000000000..fdb3e422d14
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/any_op_cs.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Sequence class
+// This one provides code generation for the Sequence node in the client
+// header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_SEQUENCE_ANY_OP_CS_H_
+#define _BE_VISITOR_SEQUENCE_ANY_OP_CS_H_
+
+class be_visitor_sequence_any_op_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_sequence_any_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for sequence that generates the Any operator
+ // implementations
+ //
+
+public:
+ be_visitor_sequence_any_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_sequence_any_op_cs (void);
+ // destructor
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence
+};
+
+#endif /* _BE_VISITOR_SEQUENCE_ANY_OP_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/buffer_type.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/buffer_type.h
new file mode 100644
index 00000000000..54c7bc051e1
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/buffer_type.h
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// buffer_type.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Sequence class
+// This one provides code generation for the buffer type of the Sequence
+// node.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_SEQUENCE_BUFFER_TYPE_H_
+#define _BE_VISITOR_SEQUENCE_BUFFER_TYPE_H_
+
+class be_visitor_sequence_buffer_type : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_sequence_buffer_type
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the buffer type
+ // for a TAO_*_Sequence instantiation.
+ //
+public:
+ be_visitor_sequence_buffer_type (be_visitor_context *ctx);
+ // Constructor
+
+ ~be_visitor_sequence_buffer_type (void);
+ // destructor
+
+ // = Visitor methods.
+ virtual int visit_predefined_type (be_predefined_type *node);
+ virtual int visit_interface (be_interface *node);
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ virtual int visit_component (be_component *node);
+ virtual int visit_component_fwd (be_component_fwd *node);
+ virtual int visit_valuebox (be_valuebox *node);
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ virtual int visit_eventtype (be_eventtype *node);
+ virtual int visit_eventtype_fwd (be_eventtype_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);
+ virtual int visit_typedef (be_typedef *node);
+
+protected:
+ int visit_node (be_type *);
+ // helper that does the common job
+
+};
+
+#endif /* _BE_VISITOR_SEQUENCE_BUFFER_TYPE_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/cdr_op_ch.h
new file mode 100644
index 00000000000..4e625f0656c
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/cdr_op_ch.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Sequence class
+// This one provides code generation for the CDR operators for the sequence
+// in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_SEQUENCE_CDR_OP_CH_H_
+#define _BE_VISITOR_SEQUENCE_CDR_OP_CH_H_
+
+class be_visitor_sequence_cdr_op_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_sequence_cdr_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for sequence that generates the CDR operator
+ // declarations
+ //
+
+public:
+ be_visitor_sequence_cdr_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_sequence_cdr_op_ch (void);
+ // destructor
+
+ 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/cdr_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/cdr_op_cs.h
new file mode 100644
index 00000000000..eecfd9d0a74
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/cdr_op_cs.h
@@ -0,0 +1,110 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_cs.h
+//
+// = DESCRIPTION
+// Visitors for generation of code for Sequences in client stubs. This one
+// generates the CDR operators.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_SEQUENCE_CDR_OP_CS_H_
+#define _BE_VISITOR_SEQUENCE_CDR_OP_CS_H_
+
+// ************************************************************
+// class be_visitor_sequence_cs
+// ************************************************************
+
+class be_visitor_sequence_cdr_op_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_sequence_cdr_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for sequence that generates the CDR operator
+ // implementations
+ //
+
+public:
+ be_visitor_sequence_cdr_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_sequence_cdr_op_cs (void);
+ // destructor
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence
+
+ // = Visitor methods on sequence types
+
+ virtual int visit_array (be_array *node);
+ // visit sequence
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit an interface forward node
+
+ virtual int visit_component (be_component *node);
+ // visit a component
+
+ virtual int visit_component_fwd (be_component_fwd *node);
+ // visit a component forward node
+
+ virtual int visit_home (be_home *node);
+ // visit a home
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit valuebox
+
+ 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_eventtype (be_eventtype *node);
+ // visit an eventtype
+
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+ // visit an eventtype forward node
+
+ virtual int visit_predefined_type (be_predefined_type *node);
+ // visit a predefined type node
+
+ virtual int visit_string (be_string *node);
+ // visit string
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef
+
+ virtual int visit_union (be_union *node);
+ // visit union
+
+protected:
+
+ int visit_node (be_type *);
+ // helper that does the common job
+
+};
+
+#endif /* _BE_VISITOR_SEQUENCE_CDR_OP_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_base.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_base.h
new file mode 100644
index 00000000000..5f8305d0492
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_base.h
@@ -0,0 +1,106 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// sequence_base.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Sequence class
+// This one provides code generation for the base typ of the Sequence node.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_SEQUENCE_SEQUENCE_BASE_H_
+#define _BE_VISITOR_SEQUENCE_SEQUENCE_BASE_H_
+
+class be_visitor_sequence_base : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_sequence_base
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the template parameters
+ // for a TAO_*_Sequence instantiation.
+ //
+ // = BUGS
+ // The class name is misleading, eventually this class could be
+ // used to generate code in other files, not only the client
+ // header.
+ // The visitor factory should provide a factory method that builds
+ // this class on the fly.
+ //
+public:
+ be_visitor_sequence_base (be_visitor_context *ctx);
+ // Constructor
+
+ ~be_visitor_sequence_base (void);
+ // destructor
+
+ // = Visitor methods.
+ virtual int visit_predefined_type (be_predefined_type *node);
+ virtual int visit_interface (be_interface *node);
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ virtual int visit_valuebox (be_valuebox *node);
+ 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);
+ virtual int visit_typedef (be_typedef *node);
+
+protected:
+ int visit_node (be_type *);
+ // helper that does the common job
+
+};
+
+class be_visitor_sequence_base_template_args: public be_visitor_sequence_base
+{
+ //
+ // =TITLE
+ // be_visitor_sequnce_base_template_args
+ //
+ // =Description
+ // This is a derived class just used to override the method
+ // visit_interface that generates the arguments for the
+ // templates. This is necessary as the same visitor was being used
+ // by the idl compiler to generate the template arguments and the
+ // return arguments for some of the methods.
+public:
+ be_visitor_sequence_base_template_args (be_visitor_context *ctx,
+ be_sequence *node );
+
+ ~be_visitor_sequence_base_template_args (void);
+ //Dtor
+
+ //= Visit methods
+ virtual int visit_interface (be_interface *node);
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+
+ virtual int visit_valuetype (be_valuetype *node);
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+
+ virtual int visit_predefined_type (be_predefined_type *node);
+private:
+ be_sequence *beseq_;
+};
+#endif /* _BE_VISITOR_SEQUENCE_SEQUENCE_BASE_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_ch.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_ch.h
new file mode 100644
index 00000000000..993e7c894ad
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_ch.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// sequence_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Sequence class
+// This one provides code generation for the Sequence node in the client
+// header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_SEQUENCE_SEQUENCE_CH_H_
+#define _BE_VISITOR_SEQUENCE_SEQUENCE_CH_H_
+
+class be_visitor_sequence_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_sequence_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client header for
+ // sequences
+ //
+public:
+ be_visitor_sequence_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_sequence_ch (void);
+ // destructor
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence node.
+
+ void gen_varout_typedefs (be_sequence *node,
+ be_type *elem);
+ // Generate the typedefs for our _var and _out template classes.
+};
+
+#endif /* _BE_VISITOR_SEQUENCE_SEQUENCE_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_cs.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_cs.h
new file mode 100644
index 00000000000..7bc66db48d5
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_cs.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// sequence_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Sequence class
+// This one provides code generation for the Sequence node in the client
+// stubs.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_SEQUENCE_SEQUENCE_CS_H_
+#define _BE_VISITOR_SEQUENCE_SEQUENCE_CS_H_
+
+class TAO_OutStream;
+class be_visitor_sequence_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_sequence_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client stubs for
+ // sequences
+ //
+public:
+ be_visitor_sequence_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_sequence_cs (void);
+ // destructor
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence node
+};
+
+#endif /* _BE_VISITOR_SEQUENCE_SEQUENCE_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/serializer_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/serializer_op_ch.h
new file mode 100644
index 00000000000..d27985b5879
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/serializer_op_ch.h
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Sequence class
+// This one provides code generation for the
+// TAO::DCPS::Serializer operators for the sequence
+// in the client header.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_SEQUENCE_serializer_op_CH_H_
+#define _BE_VISITOR_SEQUENCE_serializer_op_CH_H_
+
+class be_visitor_sequence_serializer_op_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_sequence_serializer_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for sequence that generates the Serializer operator
+ // declarations
+ //
+
+public:
+ be_visitor_sequence_serializer_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_sequence_serializer_op_ch (void);
+ // destructor
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence
+};
+
+#endif /* _BE_VISITOR_SEQUENCE_serializer_op_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/serializer_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/serializer_op_cs.h
new file mode 100644
index 00000000000..5102dd83686
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/serializer_op_cs.h
@@ -0,0 +1,107 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_cs.h
+//
+// = DESCRIPTION
+// Visitors for generation of code for Sequences in client stubs. This one
+// generates the TAO::DCPS::Serializer operators.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_SEQUENCE_serializer_op_CS_H_
+#define _BE_VISITOR_SEQUENCE_serializer_op_CS_H_
+
+// ************************************************************
+// class be_visitor_sequence_cs
+// ************************************************************
+
+class be_visitor_sequence_serializer_op_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_sequence_serializer_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for sequence that generates the Serializer operator
+ // implementations
+ //
+
+public:
+ be_visitor_sequence_serializer_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_sequence_serializer_op_cs (void);
+ // destructor
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence
+
+ // = Visitor methods on sequence types
+
+ virtual int visit_array (be_array *node);
+ // visit sequence
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit an interface forward node
+
+ virtual int visit_component (be_component *node);
+ // visit a component
+
+ virtual int visit_component_fwd (be_component_fwd *node);
+ // visit a component forward node
+
+ virtual int visit_home (be_home *node);
+ // visit a home
+
+ 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_eventtype (be_eventtype *node);
+ // visit an eventtype
+
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+ // visit an eventtype forward node
+
+ virtual int visit_predefined_type (be_predefined_type *node);
+ // visit a predefined type node
+
+ virtual int visit_string (be_string *node);
+ // visit string
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef
+
+ virtual int visit_union (be_union *node);
+ // visit union
+
+protected:
+
+ int visit_node (be_type *);
+ // helper that does the common job
+
+};
+
+#endif /* _BE_VISITOR_SEQUENCE_serializer_op_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure.h b/TAO/TAO_IDL/be_include/be_visitor_structure.h
new file mode 100644
index 00000000000..478de9e0641
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_structure.h
@@ -0,0 +1,42 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_structure.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Structure class
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_STRUCTURE_H
+#define TAO_BE_VISITOR_STRUCTURE_H
+
+#include "be_union.h"
+#include "be_enum.h"
+
+#include "be_visitor_scope.h"
+#include "be_visitor_enum.h"
+#include "be_visitor_union.h"
+#include "be_visitor_structure/structure.h"
+#include "be_visitor_structure/structure_ch.h"
+#include "be_visitor_structure/structure_ci.h"
+#include "be_visitor_structure/structure_cs.h"
+#include "be_visitor_structure/any_op_ch.h"
+#include "be_visitor_structure/any_op_cs.h"
+#include "be_visitor_structure/cdr_op_ch.h"
+#include "be_visitor_structure/cdr_op_cs.h"
+#include "be_visitor_structure/serializer_op_ch.h"
+#include "be_visitor_structure/serializer_op_cs.h"
+
+#endif // TAO_BE_VISITOR_STRUCTURE_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_structure/any_op_ch.h
new file mode 100644
index 00000000000..d62c610d4eb
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_structure/any_op_ch.h
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Structure class
+// This one provides code generation for the Any operators for the structure
+// in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_STRUCTURE_ANY_OP_CH_H_
+#define _BE_VISITOR_STRUCTURE_ANY_OP_CH_H_
+
+class be_visitor_structure_any_op_ch : public be_visitor_structure
+{
+ //
+ // = TITLE
+ // be_visitor_structure_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for structure that generates the Any operator
+ // declarations
+ //
+
+public:
+ be_visitor_structure_any_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_structure_any_op_ch (void);
+ // destructor
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure
+
+ virtual int visit_field (be_field *node);
+ // visit field
+
+ virtual int visit_union (be_union *node);
+ // visit union
+
+ virtual int visit_enum (be_enum *node);
+ // visit field
+};
+
+#endif /* _BE_VISITOR_STRUCTURE_ANY_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure/any_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_structure/any_op_cs.h
new file mode 100644
index 00000000000..217d8e611ba
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_structure/any_op_cs.h
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Structure class
+// This one provides code generation for the Any operators for the structure
+// in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_STRUCTURE_ANY_OP_CS_H_
+#define _BE_VISITOR_STRUCTURE_ANY_OP_CS_H_
+
+class be_visitor_structure_any_op_cs : public be_visitor_structure
+{
+ //
+ // = TITLE
+ // be_visitor_structure_any_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for structure that generates the Any operator
+ // implementations
+ //
+
+public:
+ be_visitor_structure_any_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_structure_any_op_cs (void);
+ // destructor
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure
+
+ virtual int visit_field (be_field *node);
+ // visit field
+
+ virtual int visit_union (be_union *node);
+ // visit field
+
+ virtual int visit_enum (be_enum *node);
+ // visit field
+};
+
+#endif /* _BE_VISITOR_STRUCTURE_ANY_OP_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
new file mode 100644
index 00000000000..5ab95eb05d4
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_structure/cdr_op_ch.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Structure class
+// This one provides code generation for the CDR operators for the structure
+// in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_STRUCTURE_CDR_OP_CH_H_
+#define _BE_VISITOR_STRUCTURE_CDR_OP_CH_H_
+
+class be_visitor_structure_cdr_op_ch : public be_visitor_structure
+{
+ //
+ // = TITLE
+ // be_visitor_structure_cdr_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for structure that generates the CDR operator
+ // declarations
+ //
+
+public:
+ be_visitor_structure_cdr_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_structure_cdr_op_ch (void);
+ // destructor
+
+ 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_cs.h b/TAO/TAO_IDL/be_include/be_visitor_structure/cdr_op_cs.h
new file mode 100644
index 00000000000..d8b6d13f64a
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_structure/cdr_op_cs.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Structure class
+// This one provides code generation for the CDR operators for the structure
+// in the client stub.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_STRUCTURE_CDR_OP_CS_H_
+#define _BE_VISITOR_STRUCTURE_CDR_OP_CS_H_
+
+class be_visitor_structure_cdr_op_cs : public be_visitor_structure
+{
+ //
+ // = TITLE
+ // be_visitor_structure_cdr_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for structure that generates the CDR operator
+ // implementations
+ //
+
+public:
+ be_visitor_structure_cdr_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_structure_cdr_op_cs (void);
+ // destructor
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure
+
+ 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_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure/serializer_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_structure/serializer_op_ch.h
new file mode 100644
index 00000000000..d933328a197
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_structure/serializer_op_ch.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Structure class
+// This one provides code generation for the TAO::DCPS::Serializer operators
+// for the structure in the client header.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_STRUCTURE_serializer_op_CH_H_
+#define _BE_VISITOR_STRUCTURE_serializer_op_CH_H_
+
+class be_visitor_structure_serializer_op_ch : public be_visitor_structure
+{
+ //
+ // = TITLE
+ // be_visitor_structure_serializer_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for structure that generates the Serializer operator
+ // declarations
+ //
+
+public:
+ be_visitor_structure_serializer_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_structure_serializer_op_ch (void);
+ // destructor
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure
+};
+
+#endif /* _BE_VISITOR_STRUCTURE_serializer_op_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure/serializer_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_structure/serializer_op_cs.h
new file mode 100644
index 00000000000..f4c8292fbf8
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_structure/serializer_op_cs.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Structure class
+// This one provides code generation for the TAO::DCPS::Serializer operators
+// for the structure in the client stub.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_STRUCTURE_serializer_op_CS_H_
+#define _BE_VISITOR_STRUCTURE_serializer_op_CS_H_
+
+class be_visitor_structure_serializer_op_cs : public be_visitor_structure
+{
+ //
+ // = TITLE
+ // be_visitor_structure_serializer_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for structure that generates the Serializer operator
+ // implementations
+ //
+
+public:
+ be_visitor_structure_serializer_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_structure_serializer_op_cs (void);
+ // destructor
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure
+
+ virtual int post_process (be_decl *);
+ // any post processing that needs to be done after a field is handled
+
+ virtual int pre_process (be_decl *bd);
+ // any preprocessing that needs to be done before a field is handled
+};
+
+#endif /* _BE_VISITOR_STRUCTURE_serializer_op_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure/structure.h b/TAO/TAO_IDL/be_include/be_visitor_structure/structure.h
new file mode 100644
index 00000000000..01a64e3f342
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_structure/structure.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// structure.h
+//
+// = DESCRIPTION
+// Concrete visitor for the STRUCTURE class
+// This one provides the generic visitor for the Structure node.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_STRUCTURE_STRUCTURE_H_
+#define _BE_VISITOR_STRUCTURE_STRUCTURE_H_
+
+class be_visitor_structure : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_structure
+ //
+ // = DESCRIPTION
+ // This is the base visitor for structure
+ //
+ //
+public:
+ be_visitor_structure (be_visitor_context *ctx);
+ // constructureor
+
+ ~be_visitor_structure (void);
+ // destructureor
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure. We provide code for this method in the derived class
+
+ // =visit operations on syntactically valid elements in our scope
+
+ virtual int visit_field (be_field *node);
+ // visit field
+};
+
+#endif /* _BE_VISITOR_STRUCTURE_STRUCTURE_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure/structure_ch.h b/TAO/TAO_IDL/be_include/be_visitor_structure/structure_ch.h
new file mode 100644
index 00000000000..1b19214ecc9
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_structure/structure_ch.h
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// structure_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Structure class
+// This one provides code generation for the structure in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_STRUCTURE_STRUCTURE_CH_H_
+#define _BE_VISITOR_STRUCTURE_STRUCTURE_CH_H_
+
+class be_visitor_structure_ch : public be_visitor_structure
+{
+ //
+ // = TITLE
+ // be_visitor_structure_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client header for structure
+ //
+ //
+public:
+ be_visitor_structure_ch (be_visitor_context *ctx);
+ // constructureor
+
+ ~be_visitor_structure_ch (void);
+ // destructureor
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure. We provide code for this method in the derived class
+};
+
+#endif /* _BE_VISITOR_STRUCTURE_STRUCTURE_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure/structure_ci.h b/TAO/TAO_IDL/be_include/be_visitor_structure/structure_ci.h
new file mode 100644
index 00000000000..313657b6bac
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_structure/structure_ci.h
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// structure_ci.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Structure class
+// This one provides code generation for the structure in the client inline.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_STRUCTURE_STRUCTURE_CI_H_
+#define _BE_VISITOR_STRUCTURE_STRUCTURE_CI_H_
+
+class be_visitor_structure_ci : public be_visitor_structure
+{
+ //
+ // = TITLE
+ // be_visitor_structure_ci
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client inline for structure
+ //
+ //
+public:
+ be_visitor_structure_ci (be_visitor_context *ctx);
+ // constructureor
+
+ ~be_visitor_structure_ci (void);
+ // destructureor
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure. We provide code for this method in the derived class
+};
+
+#endif /* _BE_VISITOR_STRUCTURE_STRUCTURE_CI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure/structure_cs.h b/TAO/TAO_IDL/be_include/be_visitor_structure/structure_cs.h
new file mode 100644
index 00000000000..24ebf61be18
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_structure/structure_cs.h
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// structure_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Structure class
+// This one provides code generation for the structure in the client stubs.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_STRUCTURE_STRUCTURE_CS_H_
+#define _BE_VISITOR_STRUCTURE_STRUCTURE_CS_H_
+
+class be_visitor_structure_cs : public be_visitor_structure
+{
+ //
+ // = TITLE
+ // be_visitor_structure_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client stubs for structure
+ //
+ //
+public:
+ be_visitor_structure_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_structure_cs (void);
+ // destructor
+
+ 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_traits.h b/TAO/TAO_IDL/be_include/be_visitor_traits.h
new file mode 100644
index 00000000000..939b0b6bf17
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_traits.h
@@ -0,0 +1,69 @@
+//=============================================================================
+/**
+* @file be_visitor_traits.h
+*
+* $Id$
+*
+* This visitor generates template specializations for traits of various
+* kinds for IDL declarations. These specialized template classes are then
+* used in other template classes in the ORB.
+*
+* @author Jeff Parsons <j.parsons@vanderbilt.edu>
+*/
+//=============================================================================
+#ifndef TAO_BE_VISITOR_TRAITS_H
+#define TAO_BE_VISITOR_TRAITS_H
+
+#include "be_visitor_scope.h"
+
+/**
+ * @class be_visitor_traits
+ *
+ * @brief Generates specialized template traits declarations.
+ */
+class be_visitor_traits : public be_visitor_scope
+{
+public:
+ be_visitor_traits (be_visitor_context *ctx);
+
+ virtual ~be_visitor_traits (void);
+
+ virtual int visit_root (be_root *node);
+
+ virtual int visit_module (be_module *node);
+
+ virtual int visit_interface (be_interface *node);
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+
+ virtual int visit_valuetype (be_valuetype *node);
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+
+ virtual int visit_valuebox (be_valuebox *node);
+
+ virtual int visit_component (be_component *node);
+
+ virtual int visit_component_fwd (be_component_fwd *node);
+
+ virtual int visit_eventtype (be_eventtype *node);
+
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+
+ virtual int visit_field (be_field *node);
+
+ virtual int visit_union_branch (be_union_branch *node);
+
+ virtual int visit_exception (be_exception *node);
+
+ virtual int visit_structure (be_structure *node);
+
+ virtual int visit_union (be_union *node);
+
+ virtual int visit_array (be_array *node);
+
+ virtual int visit_typedef (be_typedef *node);
+};
+
+
+#endif // TAO_BE_VISITOR_TRAITS_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode.h b/TAO/TAO_IDL/be_include/be_visitor_typecode.h
new file mode 100644
index 00000000000..ae49fe87a1f
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typecode.h
@@ -0,0 +1,39 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_typecode.h
+//
+// = DESCRIPTION
+// Concrete visitor to generate code for TypeCodes
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_TYPECODE_H
+#define TAO_BE_VISITOR_TYPECODE_H
+
+#include "idl_defines.h"
+
+#include "be_visitor_decl.h"
+#include "be_visitor_typecode/typecode_decl.h"
+#include "be_visitor_typecode/typecode_defn.h"
+
+#include "be_visitor_typecode/alias_typecode.h"
+#include "be_visitor_typecode/enum_typecode.h"
+#include "be_visitor_typecode/objref_typecode.h"
+#include "be_visitor_typecode/struct_typecode.h"
+#include "be_visitor_typecode/union_typecode.h"
+#include "be_visitor_typecode/value_typecode.h"
+
+
+#endif /* TAO_BE_VISITOR_TYPECODE_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode/alias_typecode.h b/TAO/TAO_IDL/be_include/be_visitor_typecode/alias_typecode.h
new file mode 100644
index 00000000000..6dffd3cb904
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/alias_typecode.h
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file alias_typecode.h
+ *
+ * $Id$
+ *
+ * Alias (typedef) TypeCode generation visitor.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_BE_VISITOR_ALIAS_TYPECODE_H
+#define TAO_BE_VISITOR_ALIAS_TYPECODE_H
+
+namespace TAO
+{
+
+ /**
+ * @class be_visitor_alias_typecode
+ *
+ * @brief Alias (typedef) TypeCode generation visitor.
+ *
+ * Alias (typedef) TypeCode generation visitor.
+ */
+ class be_visitor_alias_typecode
+ : public be_visitor_typecode_defn
+ {
+ public:
+
+ /// Constructor.
+ be_visitor_alias_typecode (be_visitor_context * ctx);
+
+ /// Visit a typedef.
+ /**
+ * @todo The legacy method name "@c visit_typedef()" is redundant
+ * since it is obvious from the argument what kind of
+ * TypeCode is being visited. It will be changed once the
+ * rest of the legacy method names and their call sites are
+ * updated accordingly.
+ */
+ virtual int visit_typedef (be_typedef * node);
+
+ /// Visit a valuebox.
+ virtual int visit_valuebox (be_valuebox * node);
+
+ private:
+ int common (be_type * node,
+ be_type * base,
+ const char * tctype);
+
+ };
+
+}
+
+#endif /* TAO_BE_VISITOR_ALIAS_TYPECODE_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode/enum_typecode.h b/TAO/TAO_IDL/be_include/be_visitor_typecode/enum_typecode.h
new file mode 100644
index 00000000000..1ad57b8aa5c
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/enum_typecode.h
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file enum_typecode.h
+ *
+ * $Id$
+ *
+ * Enumeration TypeCode generation visitor.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_BE_VISITOR_ENUM_TYPECODE_H
+#define TAO_BE_VISITOR_ENUM_TYPECODE_H
+
+#include "typecode_defn.h"
+
+namespace TAO
+{
+
+ /**
+ * @class be_visitor_enum_typecode
+ *
+ * @brief Enumeration TypeCode generation visitor.
+ *
+ * Enumeration TypeCode generation visitor.
+ */
+ class be_visitor_enum_typecode
+ : public be_visitor_typecode_defn
+ {
+ public:
+
+ /// Constructor.
+ be_visitor_enum_typecode (be_visitor_context * ctx);
+
+ /// Visit an enumeration.
+ /**
+ * @todo The legacy method name "@c visit_enum()" is
+ * redundant since it is obvious from the argument what kind
+ * of TypeCode is being visited. It will be changed once
+ * the rest of the legacy method names and their call sites
+ * are updated accordingly.
+ */
+ virtual int visit_enum (be_enum * node);
+
+ private:
+
+ /// Generate structure field related TypeCode code.
+ int visit_members (be_enum * node);
+
+ };
+
+}
+
+#endif /* TAO_BE_VISITOR_ENUM_TYPECODE_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode/objref_typecode.h b/TAO/TAO_IDL/be_include/be_visitor_typecode/objref_typecode.h
new file mode 100644
index 00000000000..b860807cbb4
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/objref_typecode.h
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file objref_typecode.h
+ *
+ * $Id$
+ *
+ * Object reference TypeCode generation visitor.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_BE_VISITOR_OBJREF_TYPECODE_H
+#define TAO_BE_VISITOR_OBJREF_TYPECODE_H
+
+namespace TAO
+{
+
+ /**
+ * @class be_visitor_objref_typecode
+ *
+ * @brief TypeCode generation visitor for types with a TypeCode
+ * format similar to an object reference / interface
+ * TypeCode.
+ *
+ * TypeCode generation visitor for types with a TypeCode format
+ * similar to an object reference / interface TypeCode.
+ */
+ class be_visitor_objref_typecode
+ : public be_visitor_typecode_defn
+ {
+ public:
+
+ /// Constructor.
+ be_visitor_objref_typecode (be_visitor_context * ctx);
+
+ /// Visit an object reference / interface.
+ /**
+ * @todo The legacy method name "@c visit_interface()" is redundant
+ * since it is obvious from the argument what kind of
+ * TypeCode is being visited. It will be changed once the
+ * rest of the legacy method names and their call sites are
+ * updated accordingly.
+ */
+ virtual int visit_interface (be_interface * node);
+
+ /// Visit a native.
+ /**
+ * @see visit_interface
+ */
+ virtual int visit_native (be_native * node);
+
+ private:
+
+ /// Generate TypeCode instance.
+ int visit_i (char const * kind,
+ char const * flat_name,
+ char const * repository_id,
+ char const * original_local_name,
+ be_type * node);
+
+ };
+
+}
+
+#endif /* TAO_BE_VISITOR_OBJREF_TYPECODE_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode/struct_typecode.h b/TAO/TAO_IDL/be_include/be_visitor_typecode/struct_typecode.h
new file mode 100644
index 00000000000..41fbb815706
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/struct_typecode.h
@@ -0,0 +1,88 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file struct_typecode.h
+ *
+ * $Id$
+ *
+ * Structure TypeCode generation visitor.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_BE_VISITOR_STRUCT_TYPECODE_H
+#define TAO_BE_VISITOR_STRUCT_TYPECODE_H
+
+namespace TAO
+{
+
+ /**
+ * @class be_visitor_struct_typecode
+ *
+ * @brief Structure TypeCode generation visitor.
+ *
+ * Structure TypeCode generation visitor.
+ */
+ class be_visitor_struct_typecode
+ : public be_visitor_typecode_defn
+ {
+ public:
+
+ /// Constructor.
+ be_visitor_struct_typecode (be_visitor_context * ctx);
+
+ /// Visit a structure.
+ /**
+ * @todo The legacy method name "@c visit_structure()" is
+ * redundant since it is obvious from the argument what kind
+ * of TypeCode is being visited. It will be changed once
+ * the rest of the legacy method names and their call sites
+ * are updated accordingly.
+ */
+ virtual int visit_structure (be_structure * node);
+
+ /// Visit an exception.
+ /**
+ * @todo The legacy method name "@c visit_exception()" is
+ * redundant since it is obvious from the argument what kind
+ * of TypeCode is being visited. It will be changed once
+ * the rest of the legacy method names and their call sites
+ * are updated accordingly.
+ */
+ virtual int visit_exception (be_exception * node);
+
+ private:
+
+ /// Underlying structure/exception visitor code.
+ /**
+ * @note Structure/exception TypeCode generation really starts in
+ * this method.
+ */
+ int visit (AST_Structure * node, bool is_exception);
+
+ /// Generate structure field TypeCode declarations, if necessary.
+ int gen_member_typecodes (AST_Structure * node);
+
+ /// Generate structure field related TypeCode code.
+ int visit_members (AST_Structure * node);
+
+ private:
+
+ /// @c true if the struct is recursive.
+ /**
+ * @note Only applies for struct TypeCodes. Exceptions cannot be
+ * recursive.
+ */
+ bool is_recursive_;
+
+ /// @c true if this visitor is already visiting an outer scope
+ /// struct or exception
+ bool is_nested_;
+
+ };
+
+}
+
+#endif /* TAO_BE_VISITOR_STRUCT_TYPECODE_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_decl.h b/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_decl.h
new file mode 100644
index 00000000000..e1d0504dc10
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_decl.h
@@ -0,0 +1,88 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// typecode_decl.h
+//
+// = DESCRIPTION
+// Concrete visitor for the generation of TypeCodes.
+// This one generates the declaration.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_TYPECODE_TYPECODE_DECL_H_
+#define _BE_VISITOR_TYPECODE_TYPECODE_DECL_H_
+
+class be_visitor_typecode_decl : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_typecode_decl
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for generating TypeCode declarations
+ //
+
+public:
+ be_visitor_typecode_decl (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_typecode_decl (void);
+ // destructor
+
+ virtual int visit_type (be_type *node);
+ // visit a generic be_type node
+
+ // =visit methods on all types. They call the generic visit_type
+
+ virtual int visit_array (be_array *node);
+ // visit a array
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_exception (be_exception *node);
+ // visit an enum
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface
+
+ virtual int visit_component (be_component *node);
+ // visit component
+
+ virtual int visit_home (be_home *node);
+ // visit home
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit a sequence
+
+ virtual int visit_structure (be_structure *node);
+ // visit a structure
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit a typedef
+
+ virtual int visit_union (be_union *node);
+ // visit a union
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit a valuetype
+
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit a valuetype
+
+ virtual int visit_eventtype (be_eventtype *node);
+ // visit a valuetype
+};
+
+#endif /* _BE_VISITOR_TYPECODE_TYPECODE_DECL_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h b/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h
new file mode 100644
index 00000000000..342f0576d81
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h
@@ -0,0 +1,195 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// typecode_defn.h
+//
+// = DESCRIPTION
+// Concrete visitor for the generation of TypeCodes.
+// This one generates the definitions.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_TYPECODE_TYPECODE_DEFN_H_
+#define _BE_VISITOR_TYPECODE_TYPECODE_DEFN_H_
+
+#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;
+
+class AST_Structure;
+class be_interface_fwd;
+
+class be_visitor_typecode_defn : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_typecode_defn
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for generating TypeCode definitions
+ //
+
+public:
+ be_visitor_typecode_defn (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_typecode_defn (void);
+ // destructor
+
+ virtual int visit_array (be_array *node);
+ // visit a array
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit interface
+
+ virtual int visit_component (be_component *node);
+ // visit component
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit a sequence
+
+ virtual int visit_string (be_string *node);
+ // visit a string
+
+ virtual int visit_structure (be_structure *node);
+ // visit a structure
+
+ // visit a typedef
+ virtual int visit_typedef (be_typedef *node);
+
+ virtual int visit_union (be_union *node);
+ // visit a union
+
+ virtual int visit_valuetype (be_valuetype * node);
+ // visit a valuetype
+
+ virtual int visit_eventtype (be_eventtype * node);
+ // visit a valuetype
+
+ // = special methods
+
+ virtual int gen_nested_namespace_begin (be_module *node);
+ // generate the nested namespace begins
+
+ virtual int gen_nested_namespace_end (be_module *node);
+ // generate the nested namespace ends
+
+ // processing for scopes
+
+ virtual int post_process (be_decl *);
+ // do any processing after every element except the last one of the scope is
+ // processed
+
+ // data structure for handling recursive and repeated typecodes
+
+ struct QNode
+ {
+ be_type *node;
+ ACE_CDR::Long offset;
+ };
+
+protected:
+
+ /// Generate the TypeCode_ptr.
+ /**
+ * Generate actual TypeCode instance/definition, not the supporting
+ * code, e.g. "static CORBA::TypeCode_ptr const Foo_ptr = ...".
+ */
+ int gen_typecode_ptr (be_type * node);
+
+ /// Generate the base type TypeCode name.
+ /**
+ * Generate the fully qualified base TypeCode name. Predominantly
+ * useful for TypeCodes that contain base/content TypeCodes
+ * (e.g. alias, sequence, etc).
+ */
+ int gen_base_typecode_name (be_type * base);
+
+ /// Generate a TypeCode forward declaration.
+ int gen_forward_declared_typecode (be_type * node);
+
+ /// Should a TypeCode be generated for the given type?
+ /**
+ * This method is meant for use by TypeCode visitors that may need
+ * to generate a TypeCode for its members or content type.
+ */
+ bool is_typecode_generation_required (be_type * node);
+
+ /// Generate nested namespaces for anonymous type typecodes.
+ /**
+ * Utility methods to generate enclosing namespaces for
+ * typecodes of bounded (w)strings, sequences and arrays.
+ */
+ void gen_begin_NS_for_anon (void);
+ void gen_end_NS_for_anon (void);
+
+protected:
+
+ /// Queue to keep nodes
+ ACE_Unbounded_Queue <QNode*> tc_queue_;
+
+ /// @c true if we are detecting recursion.
+ bool recursion_detect_;
+
+private:
+ //
+ friend class Scoped_Compute_Queue_Guard;
+
+ ACE_CDR::Long computed_tc_size_;
+ // the tc size of the node under consideration
+
+ ACE_CDR::Long computed_encap_len_;
+ // the encap length of the node under consideration
+
+ ACE_CDR::Long computed_scope_encap_len_;
+ // the encap length of the scope of the node under consideration
+
+ // the following are used for recursive and repeated typecodes
+
+ ACE_CDR::Long tc_offset_;
+ // current computed length of the typecode
+
+ ACE_Unbounded_Queue <QNode*> compute_queue_;
+ // queue to keep nodes
+
+ ACE_CDR::Long scope_stack_ [TAO_BE_VISITOR_TYPECODE_DEFN_MAX_STACK_SIZE];
+ // stores scope lens during computation
+
+ // scope related routines
+
+ int index_;
+
+ int push (ACE_CDR::Long);
+
+ int pop (ACE_CDR::Long &);
+
+protected:
+
+ // queue related routines
+
+ const QNode *queue_insert (ACE_Unbounded_Queue <QNode*> &,
+ be_type *node, ACE_CDR::Long offset);
+
+ const QNode *queue_lookup (ACE_Unbounded_Queue <QNode*> &, be_type *node);
+
+ void queue_reset (ACE_Unbounded_Queue <QNode*> &);
+
+};
+
+#endif /* _BE_VISITOR_TYPECODE_TYPECODE_DEFN_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode/union_typecode.h b/TAO/TAO_IDL/be_include/be_visitor_typecode/union_typecode.h
new file mode 100644
index 00000000000..9498461479f
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/union_typecode.h
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file union_typecode.h
+ *
+ * $Id$
+ *
+ * Union TypeCode generation visitor.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_BE_VISITOR_UNION_TYPECODE_H
+#define TAO_BE_VISITOR_UNION_TYPECODE_H
+
+namespace TAO
+{
+
+ /**
+ * @class be_visitor_union_typecode
+ *
+ * @brief Union TypeCode generation visitor.
+ *
+ * Union TypeCode generation visitor.
+ */
+ class be_visitor_union_typecode
+ : public be_visitor_typecode_defn
+ {
+ public:
+
+ /// Constructor.
+ be_visitor_union_typecode (be_visitor_context * ctx);
+
+ /// Visit a union.
+ /**
+ * @todo The legacy method name "@c visit_union()" is
+ * redundant since it is obvious from the argument what kind
+ * of TypeCode is being visited. It will be changed once
+ * the rest of the legacy method names and their call sites
+ * are updated accordingly.
+ */
+ virtual int visit_union (be_union * node);
+
+ private:
+
+ /// Generate union field TypeCode declarations, if necessary.
+ int gen_case_typecodes (be_union * node);
+
+ /// Generate union branch related TypeCode code.
+ int visit_cases (be_union * node);
+
+ private:
+
+ /// @c true if the union is recursive.
+ bool is_recursive_;
+
+ /// @c true if this visitor is already visiting an outer scope
+ /// struct or exception
+ bool is_nested_;
+
+ };
+
+}
+
+#endif /* TAO_BE_VISITOR_UNION_TYPECODE_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode/value_typecode.h b/TAO/TAO_IDL/be_include/be_visitor_typecode/value_typecode.h
new file mode 100644
index 00000000000..94f2c0afc60
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/value_typecode.h
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file value_typecode.h
+ *
+ * $Id$
+ *
+ * Structure TypeCode generation visitor.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_BE_VISITOR_VALUE_TYPECODE_H
+#define TAO_BE_VISITOR_VALUE_TYPECODE_H
+
+namespace TAO
+{
+
+ /**
+ * @class be_visitor_value_typecode
+ *
+ * @brief valuetype TypeCode generation visitor.
+ *
+ * Structure TypeCode generation visitor.
+ */
+ class be_visitor_value_typecode
+ : public be_visitor_typecode_defn
+ {
+ public:
+
+ /// Constructor.
+ be_visitor_value_typecode (be_visitor_context * ctx);
+
+ /// Visit a structure.
+ /**
+ * @todo The legacy method name "@c visit_valuetype()" is
+ * redundant since it is obvious from the argument what kind
+ * of TypeCode is being visited. It will be changed once
+ * the rest of the legacy method names and their call sites
+ * are updated accordingly.
+ */
+ virtual int visit_valuetype (be_valuetype * node);
+
+ private:
+
+ /// Generate valuetype field TypeCode declarations, if necessary.
+ int gen_member_typecodes (be_valuetype * node);
+
+ /// Generate valuetype field related TypeCode code.
+ int visit_members (be_valuetype * node);
+
+ private:
+
+ /// @c true if the valuetype or eventtype is recursive.
+ bool is_recursive_;
+
+ /// @c true if this visitor is already visiting an outer scope
+ /// struct or exception
+ bool is_nested_;
+
+ };
+
+}
+
+#endif /* TAO_BE_VISITOR_VALUE_TYPECODE_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef.h b/TAO/TAO_IDL/be_include/be_visitor_typedef.h
new file mode 100644
index 00000000000..82f6dd899d6
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typedef.h
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_typedef.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Typedef class
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_TYPEDEF_H
+#define TAO_BE_VISITOR_TYPEDEF_H
+
+#include "be_visitor_decl.h"
+#include "be_visitor_typedef/typedef.h"
+#include "be_visitor_typedef/typedef_ch.h"
+#include "be_visitor_typedef/typedef_ci.h"
+#include "be_visitor_typedef/typedef_cs.h"
+#include "be_visitor_typedef/any_op_ch.h"
+#include "be_visitor_typedef/any_op_cs.h"
+#include "be_visitor_typedef/cdr_op_ch.h"
+#include "be_visitor_typedef/cdr_op_cs.h"
+#include "be_visitor_typedef/serializer_op_ch.h"
+#include "be_visitor_typedef/serializer_op_cs.h"
+
+#endif // TAO_BE_VISITOR_TYPEDEF_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_typedef/any_op_ch.h
new file mode 100644
index 00000000000..a614a30f71a
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/any_op_ch.h
@@ -0,0 +1,69 @@
+
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Typedef class
+// This provides the code generation for the Any operators of the Typedef
+// class in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_TYPEDEF_ANY_OP_CH_H_
+#define _BE_VISITOR_TYPEDEF_ANY_OP_CH_H_
+
+class be_visitor_typedef_any_op_ch : public be_visitor_typedef
+{
+ //
+ // = TITLE
+ // be_visitor_typedef_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for typedef that generates the Any operator
+ // declarations and implementations
+ //
+
+public:
+ be_visitor_typedef_any_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_typedef_any_op_ch (void);
+ // destructor
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef
+
+ // =visit methods on all elements syntactically valid as types that can be
+ // typedefed.
+
+ virtual int visit_array (be_array *node);
+ // visit a array
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit a sequence
+
+ virtual int visit_structure (be_structure *node);
+ // visit a structure
+
+ virtual int visit_union (be_union *node);
+ // visit a union
+
+};
+
+#endif /* _BE_VISITOR_TYPEDEF_ANY_OP_CH_H_*/
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef/any_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_typedef/any_op_cs.h
new file mode 100644
index 00000000000..f99033d4f43
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/any_op_cs.h
@@ -0,0 +1,69 @@
+
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Typedef class
+// This provides the code generation for the Any operators of the Typedef
+// class in the client stubs.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_TYPEDEF_ANY_OP_CS_H_
+#define _BE_VISITOR_TYPEDEF_ANY_OP_CS_H_
+
+class be_visitor_typedef_any_op_cs : public be_visitor_typedef
+{
+ //
+ // = TITLE
+ // be_visitor_typedef_any_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for typedef that generates the Any operator
+ // declarations and implementations
+ //
+
+public:
+ be_visitor_typedef_any_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_typedef_any_op_cs (void);
+ // destructor
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef
+
+ // =visit methods on all elements syntactically valid as types that can be
+ // typedefed.
+
+ virtual int visit_array (be_array *node);
+ // visit a array
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit a sequence
+
+ virtual int visit_structure (be_structure *node);
+ // visit a structure
+
+ virtual int visit_union (be_union *node);
+ // visit a union
+
+};
+
+#endif /* _BE_VISITOR_TYPEDEF_ANY_OP_CS_H_*/
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_ch.h
new file mode 100644
index 00000000000..f832928c425
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_ch.h
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Typedef class
+// This provides the code generation for the CDR operators of the Typedef
+// class in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_TYPEDEF_CDR_OP_CH_H_
+#define _BE_VISITOR_TYPEDEF_CDR_OP_CH_H_
+
+class be_visitor_typedef_cdr_op_ch : public be_visitor_typedef
+{
+ //
+ // = TITLE
+ // be_visitor_typedef_cdr_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for typedef that generates the CDR operator
+ // declarations and implementations
+ //
+
+public:
+ be_visitor_typedef_cdr_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_typedef_cdr_op_ch (void);
+ // destructor
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef
+
+ // =visit methods on all elements syntactically valid as types that can be
+ // typedefed.
+
+ virtual int visit_array (be_array *node);
+ // visit a array
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit a sequence
+
+ virtual int visit_structure (be_structure *node);
+ // visit a structure
+
+ virtual int visit_union (be_union *node);
+ // visit a union
+};
+
+#endif /* _BE_VISITOR_TYPEDEF_CDR_OP_CH_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
new file mode 100644
index 00000000000..03af2ece923
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_cs.h
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Typedef class
+// This provides the code generation for the CDR operators of the Typedef
+// class in the client stubs.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_TYPEDEF_CDR_OP_CS_H_
+#define _BE_VISITOR_TYPEDEF_CDR_OP_CS_H_
+
+class be_visitor_typedef_cdr_op_cs : public be_visitor_typedef
+{
+ //
+ // = TITLE
+ // be_visitor_typedef_cdr_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for typedef that generates the CDR operator
+ // declarations and implementations
+ //
+
+public:
+ be_visitor_typedef_cdr_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_typedef_cdr_op_cs (void);
+ // destructor
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef
+
+ // =visit methods on all elements syntactically valid as types that can be
+ // typedefed.
+
+ virtual int visit_array (be_array *node);
+ // visit a array
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit a sequence
+
+ virtual int visit_structure (be_structure *node);
+ // visit a structure
+
+ virtual int visit_union (be_union *node);
+ // visit a union
+};
+
+#endif /* _BE_VISITOR_TYPEDEF_CDR_OP_CS_H_*/
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef/serializer_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_typedef/serializer_op_ch.h
new file mode 100644
index 00000000000..8e625e199b1
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/serializer_op_ch.h
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Typedef class
+// This provides the code generation for the TAO::DCPS::Serializer operators
+// of the Typedef class in the client header.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_TYPEDEF_serializer_op_CH_H_
+#define _BE_VISITOR_TYPEDEF_serializer_op_CH_H_
+
+class be_visitor_typedef_serializer_op_ch : public be_visitor_typedef
+{
+ //
+ // = TITLE
+ // be_visitor_typedef_serializer_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for typedef that generates the Serializer operator
+ // declarations and implementations
+ //
+
+public:
+ be_visitor_typedef_serializer_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_typedef_serializer_op_ch (void);
+ // destructor
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef
+
+ // =visit methods on all elements syntactically valid as types that can be
+ // typedefed.
+
+ virtual int visit_array (be_array *node);
+ // visit a array
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit a sequence
+
+ virtual int visit_structure (be_structure *node);
+ // visit a structure
+
+ virtual int visit_union (be_union *node);
+ // visit a union
+};
+
+#endif /* _BE_VISITOR_TYPEDEF_serializer_op_CH_H_*/
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef/serializer_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_typedef/serializer_op_cs.h
new file mode 100644
index 00000000000..e2ada3ffcb8
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/serializer_op_cs.h
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Typedef class
+// This provides the code generation for the TAO::DCPS::Serializer operators
+// of the Typedef class in the client stubs.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_TYPEDEF_serializer_op_CS_H_
+#define _BE_VISITOR_TYPEDEF_serializer_op_CS_H_
+
+class be_visitor_typedef_serializer_op_cs : public be_visitor_typedef
+{
+ //
+ // = TITLE
+ // be_visitor_typedef_serializer_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for typedef that generates the Serializer operator
+ // declarations and implementations
+ //
+
+public:
+ be_visitor_typedef_serializer_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_typedef_serializer_op_cs (void);
+ // destructor
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef
+
+ // =visit methods on all elements syntactically valid as types that can be
+ // typedefed.
+
+ virtual int visit_array (be_array *node);
+ // visit a array
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit a sequence
+
+ virtual int visit_structure (be_structure *node);
+ // visit a structure
+
+ virtual int visit_union (be_union *node);
+ // visit a union
+};
+
+#endif /* _BE_VISITOR_TYPEDEF_serializer_op_CS_H_*/
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef.h b/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef.h
new file mode 100644
index 00000000000..8a4a586917c
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef.h
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// typedef.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Typedef class
+// This provides the generic visitors for the Typedef class.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_TYPEDEF_TYPEDEF_H_
+#define _BE_VISITOR_TYPEDEF_TYPEDEF_H_
+
+class be_visitor_typedef : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_typedef
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for typedef that abstracts all common tasks
+ //
+
+public:
+ be_visitor_typedef (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_typedef (void);
+ // destructor
+
+ virtual int visit_typedef (be_typedef *node);
+ // must be overridden
+
+ // =visit methods on all elements syntactically valid as types that can be
+ // typedefed.
+
+ virtual int visit_array (be_array *node);
+ // visit a array
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit a sequence
+
+ virtual int visit_structure (be_structure *node);
+ // visit a structure
+
+ virtual int visit_union (be_union *node);
+ // visit a union
+};
+
+#endif /* _BE_VISITOR_TYPEDEF_TYPEDEF_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_ch.h b/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_ch.h
new file mode 100644
index 00000000000..e220629cac6
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_ch.h
@@ -0,0 +1,84 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// typedef_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Typedef class
+// This provides the code generation for the Typedef class in the client
+// header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_TYPEDEF_TYPEDEF_CH_H_
+#define _BE_VISITOR_TYPEDEF_TYPEDEF_CH_H_
+
+class be_visitor_typedef_ch : public be_visitor_typedef
+{
+ //
+ // = TITLE
+ // be_visitor_typedef_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client header for typedef
+ //
+ //
+public:
+ be_visitor_typedef_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_typedef_ch (void);
+ // destructor
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef. We provide code for this method in the derived class
+
+ // =visit methods on all elements syntactically valid as types that can be
+ // typedefed.
+
+ virtual int visit_array (be_array *node);
+ // visit a array
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_interface (be_interface *node);
+ // visit an interface;
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit an interface;
+
+ virtual int visit_predefined_type (be_predefined_type *node);
+ // visit predefined type node
+
+ virtual int visit_string (be_string *node);
+ // visit a typedef
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit a sequence
+
+ virtual int visit_structure (be_structure *node);
+ // visit a structure
+
+ virtual int visit_union (be_union *node);
+ // visit a union
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit a valuebox
+
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit a valuetype
+};
+
+#endif /* _BE_VISITOR_TYPEDEF_TYPEDEF_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_ci.h b/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_ci.h
new file mode 100644
index 00000000000..818bf9e91cc
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_ci.h
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// typedef_ci.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Typedef class
+// This provides the code generation for the Typedef class in the client
+// inline.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_TYPEDEF_TYPEDEF_CI_H_
+#define _BE_VISITOR_TYPEDEF_TYPEDEF_CI_H_
+
+class be_visitor_typedef_ci : public be_visitor_typedef
+{
+ //
+ // = TITLE
+ // be_visitor_typedef_sh
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the server header for typedef
+ //
+ //
+public:
+ be_visitor_typedef_ci (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_typedef_ci (void);
+ // destructor
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef. We provide code for this method in the derived class
+
+ // =visit methods on all elements syntactically valid as types that can be
+ // typedefed.
+
+ virtual int visit_array (be_array *node);
+ // visit a array
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit a sequence
+
+ virtual int visit_structure (be_structure *node);
+ // visit a structure
+
+ virtual int visit_union (be_union *node);
+ // visit a union
+};
+
+#endif /* _BE_VISITOR_TYPEDEF_TYPEDEF_CI_H_*/
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_cs.h b/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_cs.h
new file mode 100644
index 00000000000..6a48d19eaa1
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_cs.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// typedef_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Typedef class
+// This provides the code generation for the Typedef class in the client
+// stubs.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_TYPEDEF_TYPEDEF_CS_H_
+#define _BE_VISITOR_TYPEDEF_TYPEDEF_CS_H_
+
+class be_visitor_typedef_cs : public be_visitor_typedef
+{
+ //
+ // = TITLE
+ // be_visitor_typedef_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the server header for typedef
+ //
+ //
+public:
+ be_visitor_typedef_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_typedef_cs (void);
+ // destructor
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef. We provide code for this method in the derived class
+};
+
+#endif /* _BE_VISITOR_TYPEDEF_TYPEDEF_CS_H_*/
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union.h b/TAO/TAO_IDL/be_include/be_visitor_union.h
new file mode 100644
index 00000000000..7adc2f0418b
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union.h
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_union.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Union class
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_UNION_H
+#define TAO_BE_VISITOR_UNION_H
+
+#include "be_enum.h"
+#include "be_structure.h"
+
+#include "be_visitor_scope.h"
+#include "be_visitor_enum.h"
+#include "be_visitor_structure.h"
+
+#include "be_visitor_union/union.h"
+#include "be_visitor_union/union_ch.h"
+#include "be_visitor_union/union_ci.h"
+#include "be_visitor_union/union_cs.h"
+#include "be_visitor_union/discriminant_ch.h"
+#include "be_visitor_union/discriminant_ci.h"
+#include "be_visitor_union/discriminant_cs.h"
+#include "be_visitor_union/any_op_ch.h"
+#include "be_visitor_union/any_op_cs.h"
+#include "be_visitor_union/cdr_op_ch.h"
+#include "be_visitor_union/cdr_op_cs.h"
+#include "be_visitor_union/serializer_op_ch.h"
+#include "be_visitor_union/serializer_op_cs.h"
+
+#endif // TAO_BE_VISITOR_UNION_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_union/any_op_ch.h
new file mode 100644
index 00000000000..be2dae30ded
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union/any_op_ch.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.h
+//
+// = DESCRIPTION
+// Visitor for the Union class.
+// This one generates code for the Any operators for the Union in the client
+// header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_ANY_OP_CH_H_
+#define _BE_VISITOR_UNION_ANY_OP_CH_H_
+
+class be_visitor_union_any_op_ch : public be_visitor_union
+{
+ //
+ // = TITLE
+ // be_visitor_union_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for union that generates the Any operator
+ // declarations
+ //
+
+public:
+ be_visitor_union_any_op_ch (be_visitor_context *ctx);
+
+ ~be_visitor_union_any_op_ch (void);
+
+ virtual int visit_union (be_union *node);
+
+ virtual int visit_union_branch (be_union_branch *node);
+
+ virtual int visit_enum (be_enum *node);
+
+ virtual int visit_structure (be_structure *node);
+};
+
+#endif /* _BE_VISITOR_UNION_ANY_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/any_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union/any_op_cs.h
new file mode 100644
index 00000000000..6f7bef92ca0
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union/any_op_cs.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.h
+//
+// = DESCRIPTION
+// Visitor for the Union class.
+// This one generates code for the Any operators for the Union in the client
+// header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_ANY_OP_CS_H_
+#define _BE_VISITOR_UNION_ANY_OP_CS_H_
+
+class be_visitor_union_any_op_cs : public be_visitor_union
+{
+ //
+ // = TITLE
+ // be_visitor_union_any_op_compiled_cs
+ //
+ // = DESCRIPTION
+ // This is a visitor for unions that generates the Any
+ // operator implementations.
+ //
+
+public:
+ be_visitor_union_any_op_cs (be_visitor_context *ctx);
+
+ ~be_visitor_union_any_op_cs (void);
+
+ virtual int visit_union (be_union *node);
+
+ virtual int visit_union_branch (be_union_branch *node);
+
+ virtual int visit_enum (be_enum *node);
+
+ virtual int visit_structure (be_structure *node);
+};
+
+#endif /* _BE_VISITOR_UNION_ANY_OP_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_union/cdr_op_ch.h
new file mode 100644
index 00000000000..972dacf1335
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union/cdr_op_ch.h
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Union class
+// This one provides code generation for the CDR operators for the union
+// in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_CDR_OP_CH_H_
+#define _BE_VISITOR_UNION_CDR_OP_CH_H_
+
+class be_visitor_union_cdr_op_ch : public be_visitor_union
+{
+ //
+ // = TITLE
+ // be_visitor_union_cdr_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for union that generates the CDR operator
+ // declarations
+ //
+
+public:
+ be_visitor_union_cdr_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_cdr_op_ch (void);
+ // destructor
+
+ virtual int visit_union (be_union *node);
+ // visit union
+
+};
+
+#endif /* _BE_VISITOR_UNION_CDR_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/cdr_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union/cdr_op_cs.h
new file mode 100644
index 00000000000..800c43910f6
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union/cdr_op_cs.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Union class
+// This one provides code generation for the CDR operators for the union
+// in the client stub.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_CDR_OP_CS_H_
+#define _BE_VISITOR_UNION_CDR_OP_CS_H_
+
+class be_visitor_union_cdr_op_cs : public be_visitor_union
+{
+ //
+ // = TITLE
+ // be_visitor_union_cdr_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for union that generates the CDR operator
+ // implementations
+ //
+
+public:
+ be_visitor_union_cdr_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_cdr_op_cs (void);
+ // destructor
+
+ virtual int visit_union (be_union *node);
+ // visit union
+
+ virtual int pre_process (be_decl *);
+ virtual int post_process (be_decl *);
+};
+
+#endif /* _BE_VISITOR_UNION_CDR_OP_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/discriminant_ch.h b/TAO/TAO_IDL/be_include/be_visitor_union/discriminant_ch.h
new file mode 100644
index 00000000000..950deb597cd
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union/discriminant_ch.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// discriminant_ch.h
+//
+// = DESCRIPTION
+// Visitor for the Union class.
+// This one generates code for the discriminant of the Union in the client
+// header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_DISCRIMINANT_CH_H_
+#define _BE_VISITOR_UNION_DISCRIMINANT_CH_H_
+
+class be_visitor_union_discriminant_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_union_discriminant_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client header for union
+ // discriminant
+ //
+ //
+public:
+ be_visitor_union_discriminant_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_discriminant_ch (void);
+ // destructor
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_predefined_type (be_predefined_type *node);
+ // visit a predefined type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit a typedef node
+};
+
+#endif /* _BE_VISITOR_UNION_DISCRIMINANT_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/discriminant_ci.h b/TAO/TAO_IDL/be_include/be_visitor_union/discriminant_ci.h
new file mode 100644
index 00000000000..3e7619a939e
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union/discriminant_ci.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// discriminant_ci.h
+//
+// = DESCRIPTION
+// Visitor for the Union class.
+// This one generates code for the discriminant of the Union in the client
+// inline file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_DISCRIMINANT_CI_H_
+#define _BE_VISITOR_UNION_DISCRIMINANT_CI_H_
+
+class be_visitor_union_discriminant_ci : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_union_discriminant_ci
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client inline for union
+ // discriminant
+ //
+ //
+public:
+ be_visitor_union_discriminant_ci (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_discriminant_ci (void);
+ // destructor
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_predefined_type (be_predefined_type *node);
+ // visit a predefined type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit a typedef node
+};
+
+#endif /* _BE_VISITOR_UNION_DISCRIMINANT_CI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/discriminant_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union/discriminant_cs.h
new file mode 100644
index 00000000000..af61beb8b4d
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union/discriminant_cs.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// discriminant_cs.h
+//
+// = DESCRIPTION
+// Visitor for the Union class.
+// This one generates code for the discriminant of the Union in the client
+// stubs.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_DISCRIMINANT_CS_H_
+#define _BE_VISITOR_UNION_DISCRIMINANT_CS_H_
+
+class be_visitor_union_discriminant_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_union_discriminant_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client stubs for union
+ // discriminant
+ //
+ //
+public:
+ be_visitor_union_discriminant_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_discriminant_cs (void);
+ // destructor
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum. Required to generate the typecode for an enum definition
+ // appearing side the union
+
+};
+
+#endif /* _BE_VISITOR_UNION_DISCRIMINANT_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/serializer_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_union/serializer_op_ch.h
new file mode 100644
index 00000000000..01ff118c903
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union/serializer_op_ch.h
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Union class
+// This one provides code generation for the TAO::DCPS::Serializer operators
+// for the union in the client header.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_serializer_op_CH_H_
+#define _BE_VISITOR_UNION_serializer_op_CH_H_
+
+class be_visitor_union_serializer_op_ch : public be_visitor_union
+{
+ //
+ // = TITLE
+ // be_visitor_union_serializer_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for union that generates the Serializer operator
+ // declarations
+ //
+
+public:
+ be_visitor_union_serializer_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_serializer_op_ch (void);
+ // destructor
+
+ virtual int visit_union (be_union *node);
+ // visit union
+
+};
+
+#endif /* _BE_VISITOR_UNION_serializer_op_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/serializer_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union/serializer_op_cs.h
new file mode 100644
index 00000000000..f2a19231056
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union/serializer_op_cs.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Union class
+// This one provides code generation for the TAO::DCPS::Serializer operators
+// for the union in the client stub.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_serializer_op_CS_H_
+#define _BE_VISITOR_UNION_serializer_op_CS_H_
+
+class be_visitor_union_serializer_op_cs : public be_visitor_union
+{
+ //
+ // = TITLE
+ // be_visitor_union_serializer_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for union that generates the Serializer operator
+ // implementations
+ //
+
+public:
+ be_visitor_union_serializer_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_serializer_op_cs (void);
+ // destructor
+
+ virtual int visit_union (be_union *node);
+ // visit union
+
+ virtual int pre_process (be_decl *);
+ virtual int post_process (be_decl *);
+};
+
+#endif /* _BE_VISITOR_UNION_serializer_op_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/union.h b/TAO/TAO_IDL/be_include/be_visitor_union/union.h
new file mode 100644
index 00000000000..5e669ac9327
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union/union.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// union.h
+//
+// = DESCRIPTION
+// Visitor for the Union class.
+// This one is a generic visitor.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_UNION_H_
+#define _BE_VISITOR_UNION_UNION_H_
+
+class be_visitor_union : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_union
+ //
+ // = DESCRIPTION
+ // This is the base visitor for union
+ //
+ //
+public:
+ be_visitor_union (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union (void);
+ // destructor
+
+ virtual int visit_union (be_union *node);
+ // visit union. We provide code for this method in the derived class
+
+ // =visit operations on syntactically valid elements in our scope
+
+ virtual int visit_union_branch (be_union_branch *node);
+ // visit union_branch
+};
+
+#endif /* _BE_VISITOR_UNION_UNION_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/union_ch.h b/TAO/TAO_IDL/be_include/be_visitor_union/union_ch.h
new file mode 100644
index 00000000000..86813169ff1
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union/union_ch.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// union_ch.h
+//
+// = DESCRIPTION
+// Visitor for the Union class.
+// This one generates code in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_UNION_CH_H_
+#define _BE_VISITOR_UNION_UNION_CH_H_
+
+class be_visitor_union_ch : public be_visitor_union
+{
+ //
+ // = TITLE
+ // be_visitor_union_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client header for union
+ //
+ //
+public:
+ be_visitor_union_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_ch (void);
+ // destructor
+
+ virtual int visit_union (be_union *node);
+ // visit union. We provide code for this method in the derived class
+
+};
+
+#endif /* _BE_VISITOR_UNION_UNION_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/union_ci.h b/TAO/TAO_IDL/be_include/be_visitor_union/union_ci.h
new file mode 100644
index 00000000000..d0d138f583d
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union/union_ci.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// union_ci.h
+//
+// = DESCRIPTION
+// Visitor for the Union class.
+// This one generates code in the client inline file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_UNION_CI_H_
+#define _BE_VISITOR_UNION_UNION_CI_H_
+
+class be_visitor_union_ci : public be_visitor_union
+{
+ //
+ // = TITLE
+ // be_visitor_union_ci
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client inline for union
+ //
+ //
+public:
+ be_visitor_union_ci (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_ci (void);
+ // destructor
+
+ virtual int visit_union (be_union *node);
+ // visit union. We provide code for this method in the derived class
+
+};
+
+#endif /* _BE_VISITOR_UNION_UNION_CI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/union_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union/union_cs.h
new file mode 100644
index 00000000000..04783afa7d9
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union/union_cs.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// union_cs.h
+//
+// = DESCRIPTION
+// Visitor for the Union class.
+// This one generates code in the client stubs.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_UNION_CS_H_
+#define _BE_VISITOR_UNION_UNION_CS_H_
+
+class be_visitor_union_cs : public be_visitor_union
+{
+ //
+ // = TITLE
+ // be_visitor_union_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client stubs for union
+ //
+ //
+public:
+ be_visitor_union_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_cs (void);
+ // destructor
+
+ virtual int visit_union (be_union *node);
+ // visit union. We provide code for this method in the derived class
+
+};
+
+#endif /* _BE_VISITOR_UNION_UNION_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch.h
new file mode 100644
index 00000000000..3fffe3fa0cf
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch.h
@@ -0,0 +1,38 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_union_branch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the base "BE_Union_Branch" node
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_UNION_BRANCH_H
+#define TAO_BE_VISITOR_UNION_BRANCH_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/private_ch.h"
+#include "be_visitor_union_branch/cdr_op_ch.h"
+#include "be_visitor_union_branch/cdr_op_cs.h"
+#include "be_visitor_union_branch/serializer_op_ch.h"
+#include "be_visitor_union_branch/serializer_op_cs.h"
+
+#endif // TAO_BE_VISITOR_UNION_BRANCH_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/cdr_op_ch.h
new file mode 100644
index 00000000000..e325b41f912
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/cdr_op_ch.h
@@ -0,0 +1,66 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the base "BE_Union_Branch" node
+// This generates code for structure members in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_BRANCH_CDR_OP_CH_H_
+#define _BE_VISITOR_UNION_BRANCH_CDR_OP_CH_H_
+
+class be_visitor_union_branch_cdr_op_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_cdr_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for the be_union_branch node for the client header.
+ //
+public:
+ be_visitor_union_branch_cdr_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_branch_cdr_op_ch (void);
+ // destructor
+
+ virtual int visit_union_branch (be_union_branch *node);
+ // visit the union_branch node
+
+ // =visit operations on all possible data types that a union_branch can be
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum type
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence type
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedefed type
+
+ virtual int visit_union (be_union *node);
+ // visit union type
+
+};
+
+#endif /* _BE_VISITOR_UNION_BRANCH_CDR_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/cdr_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/cdr_op_cs.h
new file mode 100644
index 00000000000..65b415d8637
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/cdr_op_cs.h
@@ -0,0 +1,67 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the base "BE_Union_Branch" node
+// This generates code for structure members in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_BRANCH_CDR_OP_CS_H_
+#define _BE_VISITOR_UNION_BRANCH_CDR_OP_CS_H_
+
+class be_visitor_union_branch_cdr_op_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_union_branch_cdr_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for the be_union_branch node for the client header.
+ //
+public:
+ be_visitor_union_branch_cdr_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_branch_cdr_op_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);
+ virtual int visit_enum (be_enum *node);
+ virtual int visit_interface (be_interface *node);
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ virtual int visit_valuebox (be_valuebox *node);
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ virtual int visit_predefined_type (be_predefined_type *node);
+ virtual int visit_sequence (be_sequence *node);
+ virtual int visit_string (be_string *node);
+ virtual int visit_structure (be_structure *node);
+ virtual int visit_typedef (be_typedef *node);
+ virtual int visit_union (be_union *node);
+
+ virtual int explicit_default (void);
+ // extra code generation for an explicit default case
+
+ private:
+ int emit_valuetype_common (be_type *node);
+};
+
+#endif /* _BE_VISITOR_UNION_BRANCH_CDR_OP_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/private_ch.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/private_ch.h
new file mode 100644
index 00000000000..ed8ad92aba1
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/private_ch.h
@@ -0,0 +1,91 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// private_ch.h
+//
+// = DESCRIPTION
+// Visitor for the Union class.
+// This one generates code for private part of the union class for the union
+// members in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_BRANCH_PRIVATE_CH_H_
+#define _BE_VISITOR_UNION_BRANCH_PRIVATE_CH_H_
+
+class be_visitor_union_branch_private_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_union_branch_private_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for the be_union_branch node for the client
+ // header. This generates the code for the private section of the "union"
+ // class
+ //
+public:
+ be_visitor_union_branch_private_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_branch_private_ch (void);
+ // destructor
+
+ virtual int visit_union_branch (be_union_branch *node);
+ // visit the union_branch node
+
+ // =visit operations on all possible data types that a union_branch can be
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum type
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface type
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit interface forward type
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit valuebox 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
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence type
+
+ virtual int visit_string (be_string *node);
+ // visit string type
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedefed type
+
+ virtual int visit_union (be_union *node);
+ // visit union type
+
+};
+
+#endif /* _BE_VISITOR_UNION_BRANCH_PRIVATE_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_assign_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_assign_cs.h
new file mode 100644
index 00000000000..26316a18401
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_assign_cs.h
@@ -0,0 +1,93 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// public_assign_cs.h
+//
+// = DESCRIPTION
+// Visitor for the Union class.
+// This one generates code for the assignment operator of the union class
+// for the union members in the client stubs.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_BRANCH_PUBLIC_ASSIGN_CS_H_
+#define _BE_VISITOR_UNION_BRANCH_PUBLIC_ASSIGN_CS_H_
+
+class be_visitor_union_branch_public_assign_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_union_branch_public_assign_cs
+ //
+ // = DESCRIPTION
+ // This is used to generate the body of the assignment operator and the
+ // copy constructor of the union class
+ //
+public:
+ be_visitor_union_branch_public_assign_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_branch_public_assign_cs (void);
+ // destructor
+
+ virtual int visit_union_branch (be_union_branch *node);
+ // visit the union_branch node
+
+ // =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_valuebox (be_valuebox *node);
+ // visit valuebox 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
+
+ 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
+
+private:
+ int emit_valuetype_common (be_type *node);
+
+};
+
+#endif /* _BE_VISITOR_UNION_BRANCH_PUBLIC_ASSIGN_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ch.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ch.h
new file mode 100644
index 00000000000..393d36ae388
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ch.h
@@ -0,0 +1,90 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// public_ch.h
+//
+// = DESCRIPTION
+// Visitor for the Union class.
+// This one generates code for public part of the union class for the union
+// members in the client header.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_BRANCH_PUBLIC_CH_H_
+#define _BE_VISITOR_UNION_BRANCH_PUBLIC_CH_H_
+
+class be_visitor_union_branch_public_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_union_branch_public_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for the be_union_branch node for the client
+ // header. This generates the code for the public section of the "union"
+ // class
+ //
+public:
+ be_visitor_union_branch_public_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_branch_public_ch (void);
+ // destructor
+
+ virtual int visit_union_branch (be_union_branch *node);
+ // visit the union_branch node
+
+ // =visit operations on all possible data types that a union_branch can be
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum type
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface type
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit interface forward type
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit valuebox type
+
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit valuetype type
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit valuetype forward type
+
+ virtual int visit_predefined_type (be_predefined_type *node);
+ // visit predefined type
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence type
+
+ virtual int visit_string (be_string *node);
+ // visit string type
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedefed type
+
+ virtual int visit_union (be_union *node);
+ // visit union type
+};
+
+#endif /* _BE_VISITOR_UNION_BRANCH_PUBLIC_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ci.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ci.h
new file mode 100644
index 00000000000..47203786b7e
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ci.h
@@ -0,0 +1,93 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// public_ci.h
+//
+// = DESCRIPTION
+// Visitor for the Union class.
+// This one generates code for public part of the union class for the union
+// members in the client inline.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_BRANCI_PUBLIC_CI_H_
+#define _BE_VISITOR_UNION_BRANCI_PUBLIC_CI_H_
+
+class be_visitor_union_branch_public_ci : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_union_branch_public_ci
+ //
+ // = DESCRIPTION
+ // This visitor is used to generate the accessors for the members of the
+ // union
+ //
+public:
+ be_visitor_union_branch_public_ci (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_branch_public_ci (void);
+ // destructor
+
+ virtual int visit_union_branch (be_union_branch *node);
+ // visit the union_branch node
+
+ // =visit operations on all possible data types that a union_branch can be
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum type
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface type
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ // visit interface forward type
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit valuebox 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
+
+ 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
+
+private:
+ int emit_valuetype_common (be_type *node);
+
+};
+
+#endif /* _BE_VISITOR_UNION_BRANCI_PUBLIC_CI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_cs.h
new file mode 100644
index 00000000000..f079aeef154
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_cs.h
@@ -0,0 +1,68 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// public_cs.h
+//
+// = DESCRIPTION
+// Visitor for the Union class.
+// This one generates code for public part of the union class for the union
+// members in the client stubs.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_BRANCS_PUBLIC_CS_H_
+#define _BE_VISITOR_UNION_BRANCS_PUBLIC_CS_H_
+
+class be_visitor_union_branch_public_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_union_branch_public_cs
+ //
+ // = DESCRIPTION
+ // This visitor is used to generate implementation such as typecodes for
+ // constructed types
+ //
+public:
+ be_visitor_union_branch_public_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_branch_public_cs (void);
+ // destructor
+
+ virtual int visit_union_branch (be_union_branch *node);
+ // visit the union_branch node
+
+ // =visit operations on all possible data types that a union_branch can be
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum type
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence type
+
+ virtual int visit_string (be_string *node);
+ // visit string type
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure type
+
+ virtual int visit_union (be_union *node);
+ // visit union type
+};
+
+#endif /* _BE_VISITOR_UNION_BRANCS_PUBLIC_CS_H_ */
diff --git a/TAO/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
new file mode 100644
index 00000000000..9ef1c92d3f0
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_reset_cs.h
@@ -0,0 +1,90 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// public_reset_cs.h
+//
+// = DESCRIPTION
+// Visitor for the Union class.
+// This one generates code for the reset method of the union class
+// for the union members in the client stubs.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_BRANCH_PUBLIC_RESET_CS_H_
+#define _BE_VISITOR_UNION_BRANCH_PUBLIC_RESET_CS_H_
+
+class be_visitor_union_branch_public_reset_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_union_branch_public_reset_cs
+ //
+ // = DESCRIPTION
+ // This is used to generate the body of the resetment operator and the
+ // copy constructor of the union class
+ //
+public:
+ be_visitor_union_branch_public_reset_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_branch_public_reset_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_valuebox (be_valuebox *node);
+ // visit valuebox 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
+
+ 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_RESET_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/serializer_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/serializer_op_ch.h
new file mode 100644
index 00000000000..fa3e88b33ae
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/serializer_op_ch.h
@@ -0,0 +1,67 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the base "BE_Union_Branch" node
+// This generates TAO::DCPS::Serializer operators code for structure members
+// in the client header.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_BRANCH_serializer_op_CH_H_
+#define _BE_VISITOR_UNION_BRANCH_serializer_op_CH_H_
+
+class be_visitor_union_branch_serializer_op_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_serializer_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for the be_union_branch node for the client header.
+ //
+public:
+ be_visitor_union_branch_serializer_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_branch_serializer_op_ch (void);
+ // destructor
+
+ virtual int visit_union_branch (be_union_branch *node);
+ // visit the union_branch node
+
+ // =visit operations on all possible data types that a union_branch can be
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum type
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence type
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedefed type
+
+ virtual int visit_union (be_union *node);
+ // visit union type
+
+};
+
+#endif /* _BE_VISITOR_UNION_BRANCH_serializer_op_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/serializer_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/serializer_op_cs.h
new file mode 100644
index 00000000000..d03a521a842
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/serializer_op_cs.h
@@ -0,0 +1,64 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// serializer_op_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the base "BE_Union_Branch" node
+// This generates TAO::DCPS::Serializer operators code for structure members
+// in the client header.
+//
+// = AUTHOR
+// Scott Harris <harris_s@ociweb.com> based on code by Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_BRANCH_serializer_op_CS_H_
+#define _BE_VISITOR_UNION_BRANCH_serializer_op_CS_H_
+
+class be_visitor_union_branch_serializer_op_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_union_branch_serializer_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for the be_union_branch node for the client header.
+ //
+public:
+ be_visitor_union_branch_serializer_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_branch_serializer_op_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);
+ virtual int visit_enum (be_enum *node);
+ virtual int visit_interface (be_interface *node);
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ virtual int visit_predefined_type (be_predefined_type *node);
+ virtual int visit_sequence (be_sequence *node);
+ virtual int visit_string (be_string *node);
+ virtual int visit_structure (be_structure *node);
+ virtual int visit_typedef (be_typedef *node);
+ virtual int visit_union (be_union *node);
+
+ virtual int explicit_default (void);
+ // extra code generation for an explicit default case
+};
+
+#endif /* _BE_VISITOR_UNION_BRANCH_serializer_op_CS_H_ */
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_valuebox.h b/TAO/TAO_IDL/be_include/be_visitor_valuebox.h
new file mode 100644
index 00000000000..5c76c8bc01e
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuebox.h
@@ -0,0 +1,38 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_valuebox.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Valuebox class
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_VALUEBOX_H
+#define TAO_BE_VISITOR_VALUEBOX_H
+
+#include "be_visitor_decl.h"
+#include "be_visitor_valuebox/valuebox.h"
+#include "be_visitor_valuebox/valuebox_ch.h"
+#include "be_visitor_valuebox/valuebox_ci.h"
+#include "be_visitor_valuebox/valuebox_cs.h"
+#include "be_visitor_valuebox/any_op_ch.h"
+#include "be_visitor_valuebox/any_op_cs.h"
+#include "be_visitor_valuebox/cdr_op_ch.h"
+#include "be_visitor_valuebox/cdr_op_cs.h"
+#include "be_visitor_valuebox/field_ch.h"
+#include "be_visitor_valuebox/field_ci.h"
+#include "be_visitor_valuebox/union_member_ci.h"
+
+#endif /* TAO_BE_VISITOR_VALUEBOX_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuebox/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuebox/any_op_ch.h
new file mode 100644
index 00000000000..39c1d82a0a3
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuebox/any_op_ch.h
@@ -0,0 +1,47 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the valuebox node.
+// This one provides code generation for the Any operators
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+#ifndef _BE_VALUEBOX_ANY_OP_CH_H_
+#define _BE_VALUEBOX_ANY_OP_CH_H_
+
+class be_visitor_valuebox_any_op_ch : public be_visitor_valuebox
+{
+ //
+ // = TITLE
+ // be_visitor_valuebox_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for valueboxes that generates the Any
+ // operator declarations.
+ //
+
+public:
+ be_visitor_valuebox_any_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuebox_any_op_ch (void);
+ // destructor
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit valuebox
+};
+
+#endif /* _BE_VALUEBOX_ANY_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuebox/any_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_valuebox/any_op_cs.h
new file mode 100644
index 00000000000..997e9a7f1e2
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuebox/any_op_cs.h
@@ -0,0 +1,47 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the valuebox node.
+// This one provides code generation for the Any operators
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+#ifndef _BE_VALUEBOX_ANY_OP_CS_H_
+#define _BE_VALUEBOX_ANY_OP_CS_H_
+
+class be_visitor_valuebox_any_op_cs : public be_visitor_valuebox
+{
+ //
+ // = TITLE
+ // be_visitor_valuebox_any_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for valuebox that generates the Any
+ // operator implementations
+ //
+
+public:
+ be_visitor_valuebox_any_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuebox_any_op_cs (void);
+ // destructor
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit valuebox
+};
+
+#endif /* _BE_VALUEBOX_ANY_OP_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuebox/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuebox/cdr_op_ch.h
new file mode 100644
index 00000000000..845698d7d84
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuebox/cdr_op_ch.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for valueboxes.
+// This one provides code generation for the CDR operators.
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUEBOX_CDR_OP_CH_H_
+#define _BE_VISITOR_VALUEBOX_CDR_OP_CH_H_
+
+class be_visitor_valuebox_cdr_op_ch : public be_visitor_valuebox
+{
+ //
+ // = TITLE
+ // be_visitor_valuebox_cdr_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for valuebox that generates the CDR operator
+ // declarations
+ //
+
+public:
+ be_visitor_valuebox_cdr_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuebox_cdr_op_ch (void);
+ // destructor
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit valuebox
+};
+
+#endif /* _BE_VISITOR_VALUEBOX_CDR_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuebox/cdr_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_valuebox/cdr_op_cs.h
new file mode 100644
index 00000000000..5b3d301532b
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuebox/cdr_op_cs.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for valueboxes.
+// This one provides code generation for the CDR operators.
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUEBOX_CDR_OP_CS_H_
+#define _BE_VISITOR_VALUEBOX_CDR_OP_CS_H_
+
+class be_visitor_valuebox_cdr_op_cs : public be_visitor_valuebox
+{
+ //
+ // = TITLE
+ // be_visitor_valuebox_cdr_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for valuebox that generates the CDR operator
+ // implementations
+ //
+
+public:
+ be_visitor_valuebox_cdr_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuebox_cdr_op_cs (void);
+ // destructor
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit valuebox
+
+};
+
+#endif /* _BE_VISITOR_VALUEBOX_CDR_OP_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuebox/field_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuebox/field_ch.h
new file mode 100644
index 00000000000..d3fadf4d747
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuebox/field_ch.h
@@ -0,0 +1,104 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_ch.h
+//
+// = DESCRIPTION
+// Visitor for the structure fields in valuebox class.
+// This one generates code for access to strucuture members
+// in the client header.
+//
+// Based on be_visitor_union_branch/public_ch. In general we
+// generate the same method signatures as that visitor but cannot
+// use it directly because a valuebox is not a scope and because
+// the structure is visited prior to visiting the valuebox.
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUEBOX_FIELD_CH_H_
+#define _BE_VISITOR_VALUEBOX_FIELD_CH_H_
+
+class be_visitor_valuebox_field_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_valuebox_field_ch
+ //
+ // = DESCRIPTION This is a concrete visitor for the structure fields
+ // inside a valuebox for the client header. This generates the code
+ // for the public section of the "valuebox" class
+ //
+public:
+ be_visitor_valuebox_field_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuebox_field_ch (void);
+ // destructor
+
+ virtual int visit_field (be_field *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_valuetype (be_valuetype *node);
+ // visit valuetype type
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit valuetype 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
+
+private:
+ void emit_member_set (be_decl *field,
+ be_type *field_type,
+ const char *const_arg,
+ const char *arg_modifier);
+
+ void emit_member_get (be_decl *field,
+ be_type *field_type,
+ const char *const_prefix,
+ const char *type_suffix,
+ const char *const_method);
+
+};
+
+#endif /* _BE_VISITOR_VALUEBOX_FIELD_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuebox/field_ci.h b/TAO/TAO_IDL/be_include/be_visitor_valuebox/field_ci.h
new file mode 100644
index 00000000000..67cbd43222a
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuebox/field_ci.h
@@ -0,0 +1,104 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_ci.h
+//
+// = DESCRIPTION
+// Visitor for the Valuebox class.
+// This one generates code for accessor and modifier functions of
+// struct field members.
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUEBOX_FIELD_CI_H_
+#define _BE_VISITOR_VALUEBOX_FIELD_CI_H_
+
+class be_visitor_valuebox_field_ci : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_valuebox_field_ci
+ //
+ // = DESCRIPTION
+ // This visitor is used to generate the accessors and modifiers
+ // for valuebox struct members.
+ //
+public:
+ be_visitor_valuebox_field_ci (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuebox_field_ci (void);
+ // destructor
+
+ virtual int visit_field (be_field *node);
+ // visit the field 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_valuetype (be_valuetype *node);
+ virtual int visit_eventtype (be_eventtype *node);
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+
+ virtual int visit_predefined_type (be_predefined_type *node);
+ // visit predefined type
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence type
+
+ virtual int visit_string (be_string *node);
+ // visit string type
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedefed type
+
+ virtual int visit_union (be_union *node);
+ // visit union type
+
+private:
+ void emit_member_set (be_decl *vb_node,
+ be_decl *field,
+ be_type *field_type,
+ const char *const_arg,
+ const char *arg_modifier);
+
+ void emit_member_get (be_decl *vb_node,
+ be_decl *field,
+ be_type *field_type,
+ const char *const_prefix,
+ const char *type_suffix,
+ const char *const_method,
+ const char *access_modifier);
+
+
+};
+
+#endif /* _BE_VISITOR_VALUEBOX_FIELD_CI_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuebox/union_member_ci.h b/TAO/TAO_IDL/be_include/be_visitor_valuebox/union_member_ci.h
new file mode 100644
index 00000000000..f4c85cec230
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuebox/union_member_ci.h
@@ -0,0 +1,101 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// union_member_ci.h
+//
+// = DESCRIPTION
+// Visitor for the Valuebox class.
+// This one generates code for accessor and modifier functions of
+// union members.
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUEBOX_UNION_MEMBER_CI_H_
+#define _BE_VISITOR_VALUEBOX_UNION_MEMBER_CI_H_
+
+class be_visitor_valuebox_union_member_ci : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_valuebox_union_member_ci
+ //
+ // = DESCRIPTION
+ // This visitor is used to generate the accessors and modifiers
+ // for valuebox union members.
+ //
+public:
+ be_visitor_valuebox_union_member_ci (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuebox_union_member_ci (void);
+ // destructor
+
+ virtual int visit_union_member (be_union_branch *node);
+ // visit the field 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_valuetype (be_valuetype *node);
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+
+ virtual int visit_predefined_type (be_predefined_type *node);
+ // visit predefined type
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence type
+
+ virtual int visit_string (be_string *node);
+ // visit string type
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedefed type
+
+ virtual int visit_union (be_union *node);
+ // visit union type
+
+private:
+ void emit_member_set (be_decl *vb_node,
+ be_decl *field,
+ be_type *field_type,
+ const char *const_arg,
+ const char *arg_modifier);
+
+ void emit_member_get (be_decl *vb_node,
+ be_decl *field,
+ be_type *field_type,
+ const char *const_prefix,
+ const char *type_suffix,
+ const char *const_method);
+
+
+};
+
+#endif /* _BE_VISITOR_VALUEBOX_UNION_MEMBER_CI_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuebox/valuebox.h b/TAO/TAO_IDL/be_include/be_visitor_valuebox/valuebox.h
new file mode 100644
index 00000000000..ccdfa871776
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuebox/valuebox.h
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuebox.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Valuebox node.
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUEBOX_H_
+#define _BE_VISITOR_VALUEBOX_H_
+
+class be_visitor_valuebox : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_valuebox
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate code for valueboxes.
+ //
+ //
+public:
+ be_visitor_valuebox (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuebox (void);
+ // destructor
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit attribute. We provide code for this method in the derived class
+};
+
+#endif /* _BE_VISITOR_VALUEBOX_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuebox/valuebox_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuebox/valuebox_ch.h
new file mode 100644
index 00000000000..ca91c292b69
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuebox/valuebox_ch.h
@@ -0,0 +1,105 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuebox_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Valuebox node.
+// This provides code generation for valueboxes in the client header.
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUEBOX_CH_H_
+#define _BE_VISITOR_VALUEBOX_CH_H_
+
+class be_visitor_valuebox_ch : public be_visitor_valuebox
+{
+ //
+ // = TITLE
+ // be_visitor_valuebox_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client header for valuebox
+ //
+ //
+public:
+ be_visitor_valuebox_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuebox_ch (void);
+ // destructor
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit valuebox.
+
+ virtual int visit_array (be_array *node);
+ // visit array.
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum.
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface.
+
+ virtual int visit_predefined_type (be_predefined_type *node);
+ // visit predefined type.
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence.
+
+ virtual int visit_string (be_string *node);
+ // visit string.
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure.
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef.
+
+ virtual int visit_union (be_union *node);
+ // visit union.
+
+private:
+ int emit_for_predef_enum(be_type *node,
+ const char * type_suffix,
+ bool is_any);
+
+ void emit_default_constructor (void);
+
+ void emit_constructor_one_arg (be_decl *node,
+ const char * type_suffix,
+ const char * const_prefix,
+ const char * ref_modifier);
+
+ void emit_copy_constructor (void);
+
+ void emit_assignment (be_decl *node,
+ const char * type_suffix,
+ const char * const_prefix,
+ const char * ref_modifier);
+
+ void emit_boxed_access (be_decl *node,
+ const char * type_suffix,
+ const char *const_prefix,
+ const char *in_ref_modifier,
+ const char *out_ref_modifier);
+
+ void emit_accessor_modifier (be_decl *node);
+
+ void emit_boxed_member_var (be_decl *node,
+ const char * type_suffix);
+
+};
+
+#endif /* _BE_VISITOR_VALUEBOX_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuebox/valuebox_ci.h b/TAO/TAO_IDL/be_include/be_visitor_valuebox/valuebox_ci.h
new file mode 100644
index 00000000000..f51b7934c0b
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuebox/valuebox_ci.h
@@ -0,0 +1,102 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuebox_ci.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Valuebox node.
+// This provides code generation for valueboxes in the client inline.
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUEBOX_CI_H_
+#define _BE_VISITOR_VALUEBOX_CI_H_
+
+class be_visitor_valuebox_ci : public be_visitor_valuebox
+{
+ //
+ // = TITLE
+ // be_visitor_valuebox_ci
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client inline for valuebox
+ //
+ //
+public:
+ be_visitor_valuebox_ci (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuebox_ci (void);
+ // destructor
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit valuebox.
+
+ virtual int visit_array (be_array *node);
+ // visit array.
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum.
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface.
+
+ virtual int visit_predefined_type (be_predefined_type *node);
+ // visit predefined type.
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence.
+
+ virtual int visit_string (be_string *node);
+ // visit string.
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure.
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef.
+
+ virtual int visit_union (be_union *node);
+ // visit union.
+
+private:
+ int emit_for_predef_enum (be_type *node,
+ const char * type_suffix,
+ bool is_any);
+
+ void emit_default_constructor (void);
+
+ void emit_default_constructor_alloc (be_decl *node);
+
+ void emit_constructor_one_arg (be_decl *node,
+ const char * type_suffix);
+
+ void emit_constructor_one_arg_alloc (be_decl *node);
+
+ void emit_copy_constructor (void);
+
+ void emit_copy_constructor_alloc (be_decl *node);
+
+ void emit_assignment (be_decl *node,
+ const char * type_suffix);
+
+ void emit_assignment_alloc (be_decl *node);
+
+ void emit_accessor_modifier (be_decl *node);
+
+ void emit_boxed_access (be_decl *node, const char *out_ref_modifier);
+
+};
+
+#endif /* _BE_VISITOR_VALUEBOX_CI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuebox/valuebox_cs.h b/TAO/TAO_IDL/be_include/be_visitor_valuebox/valuebox_cs.h
new file mode 100644
index 00000000000..cfc363a37ca
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuebox/valuebox_cs.h
@@ -0,0 +1,82 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuebox_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Valuebox node.
+// This provides code generation for valueboxes in the client stubs.
+//
+// = AUTHOR
+// Gary Maxey
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUEBOX_CS_H_
+#define _BE_VISITOR_VALUEBOX_CS_H_
+
+class be_visitor_valuebox_cs : public be_visitor_valuebox
+{
+ //
+ // = TITLE
+ // be_visitor_valuebox_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client stubs for valuebox
+ //
+ //
+public:
+ be_visitor_valuebox_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuebox_cs (void);
+ // destructor
+
+ virtual int visit_valuebox (be_valuebox *node);
+ // visit valuebox.
+
+ virtual int visit_array (be_array *node);
+ // visit array.
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum.
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface.
+
+ virtual int visit_predefined_type (be_predefined_type *node);
+ // visit predefined type.
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence.
+
+ virtual int visit_string (be_string *node);
+ // visit string.
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure.
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef.
+
+ virtual int visit_union (be_union *node);
+ // visit union.
+
+private:
+
+ /// Generate virtual destructor.
+ void emit_destructor (void);
+
+ int emit_for_predef_enum (char const * marshal_arg);
+
+};
+
+#endif /* _BE_VISITOR_VALUEBOX_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype.h
new file mode 100644
index 00000000000..b0162d0c9bf
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype.h
@@ -0,0 +1,55 @@
+
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_valuetype.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Valuetype class
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_VALUETYPE_H
+#define TAO_BE_VISITOR_VALUETYPE_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"
+#include "be_visitor_valuetype/valuetype_obv_ci.h"
+#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"
+#include "be_visitor_valuetype/cdr_op_cs.h"
+#include "be_visitor_valuetype/marshal_ch.h"
+#include "be_visitor_valuetype/marshal_cs.h"
+#include "be_visitor_valuetype/arglist.h"
+#include "be_visitor_valuetype/field_ch.h"
+#include "be_visitor_valuetype/field_ci.h"
+#include "be_visitor_valuetype/field_cs.h"
+#include "be_visitor_valuetype/field_cdr_ch.h"
+#include "be_visitor_valuetype/field_cdr_cs.h"
+#include "be_visitor_valuetype/obv_module.h"
+#include "be_visitor_valuetype/ami_exception_holder_ch.h"
+#include "be_visitor_valuetype/ami_exception_holder_cs.h"
+#include "be_visitor_valuetype/valuetype_init.h"
+#include "be_visitor_valuetype/valuetype_init_ch.h"
+#include "be_visitor_valuetype/valuetype_init_ci.h"
+#include "be_visitor_valuetype/valuetype_init_cs.h"
+#include "be_visitor_valuetype/valuetype_init_arglist_ch.h"
+
+#endif /* TAO_BE_VISITOR_VALUETYPE_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/ami_exception_holder_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/ami_exception_holder_ch.h
new file mode 100644
index 00000000000..139d488f9ac
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/ami_exception_holder_ch.h
@@ -0,0 +1,48 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// ami_exception_holder_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface node.
+// This one provides code generation for AMI exception holders
+// in client headers.
+//
+// = AUTHOR
+// Michael Kircher <Michael.Kircher@mchp.siemens.de>
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUETYPE_AMI_EXCEPTION_HOLDER_CH_H_
+#define _BE_VISITOR_VALUETYPE_AMI_EXCEPTION_HOLDER_CH_H_
+
+
+class be_visitor_valuetype_ami_exception_holder_ch : public be_visitor_valuetype
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_ami_exception_holder_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client header for
+ // interface.
+ //
+public:
+ be_visitor_valuetype_ami_exception_holder_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_ami_exception_holder_ch (void);
+ // destructor
+
+ virtual int visit_operation (be_operation *node);
+
+};
+
+#endif /* _BE_VISITOR_VALUETYPE_AMI_EXCEPTIUON_HOLER_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/ami_exception_holder_cs.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/ami_exception_holder_cs.h
new file mode 100644
index 00000000000..88a77fdb288
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/ami_exception_holder_cs.h
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// ami_exception_holder_cs.h
+//
+// = DESCRIPTION
+// Visitor to generate code for exception holders.
+//
+// = AUTHOR
+// Michael Kircher <Michael.Kircher@mchp.siemens.de>
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUETYPE_AMI_EXCEPTION_HOLDER_CS_H_
+#define _BE_VISITOR_VALUETYPE_AMI_EXCEPTION_HOLDER_CS_H_
+
+class be_visitor_valuetype_ami_exception_holder_cs : public be_visitor_valuetype
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_ami_exception_holder_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client stubs for interface
+ //
+ //
+public:
+ be_visitor_valuetype_ami_exception_holder_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_ami_exception_holder_cs (void);
+ // destructor
+
+ virtual int visit_valuetype (be_valuetype *node);
+
+ virtual int visit_operation (be_operation *node);
+};
+
+#endif /* _BE_VISITOR_VALUETYPE_AMI_EXCEPTION_HOLDER_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/any_op_ch.h
new file mode 100644
index 00000000000..12a18d278f7
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/any_op_ch.h
@@ -0,0 +1,47 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the valuetype node.
+// This one provides code generation for the Any operators
+//
+// = AUTHOR
+// Jeff Parsons <parsons@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef _BE_VALUETYPE_ANY_OP_CH_H_
+#define _BE_VALUETYPE_ANY_OP_CH_H_
+
+class be_visitor_valuetype_any_op_ch : public be_visitor_valuetype
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for valuetypes that generates the Any
+ // operator declarations.
+ //
+
+public:
+ be_visitor_valuetype_any_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_any_op_ch (void);
+ // destructor
+
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_eventtype (be_eventtype *node);
+};
+
+#endif /* _BE_VALUETYPE_ANY_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/any_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/any_op_cs.h
new file mode 100644
index 00000000000..86b86ed0df2
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/any_op_cs.h
@@ -0,0 +1,47 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the valuetype node.
+// This one provides code generation for the Any operators
+//
+// = AUTHOR
+// Jeff Parsons <parsons@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef _BE_VALUETYPE_ANY_OP_CS_H_
+#define _BE_VALUETYPE_ANY_OP_CS_H_
+
+class be_visitor_valuetype_any_op_cs : public be_visitor_valuetype
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_any_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for valuetype that generates the Any
+ // operator implementations
+ //
+
+public:
+ be_visitor_valuetype_any_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_any_op_cs (void);
+ // destructor
+
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_eventtype (be_eventtype *node);
+};
+
+#endif /* _BE_VALUETYPE_ANY_OP_CS_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
new file mode 100644
index 00000000000..d407c637573
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/arglist.h
@@ -0,0 +1,57 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// arglist.h
+//
+// = DESCRIPTION
+// Visitor for generating code for IDL (valuetype) operations.
+// This generates the operation signature.
+//
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_OBV_OPERATION_ARGLIST_H_
+#define _BE_VISITOR_OBV_OPERATION_ARGLIST_H_
+
+// ******************************************************************************
+// Operation visitor for argument list - generates parameters in the signature
+// ******************************************************************************
+
+class be_visitor_obv_operation_arglist : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_operaion_arglist
+ //
+ // = DESCRIPTION
+ // This is a visitor to generate operation argument list
+ //
+ //
+public:
+ be_visitor_obv_operation_arglist (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_obv_operation_arglist (void);
+ // destructor
+
+ bool is_amh_exception_holder (be_operation *node);
+ // special arglist generation for amh_exceptionholders
+
+ int visit_operation (be_operation *node);
+ // visit the operation
+
+ int visit_argument (be_argument *node);
+ // visit each argument
+
+ 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/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/cdr_op_ch.h
new file mode 100644
index 00000000000..9555c9e0f15
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/cdr_op_ch.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for valuetypes.
+// This one provides code generation for the CDR operators.
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUETYPE_CDR_OP_CH_H_
+#define _BE_VISITOR_VALUETYPE_CDR_OP_CH_H_
+
+class be_visitor_valuetype_cdr_op_ch : public be_visitor_valuetype
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_cdr_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for valuetype that generates the CDR operator
+ // declarations
+ //
+
+public:
+ be_visitor_valuetype_cdr_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_cdr_op_ch (void);
+ // destructor
+
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_eventtype (be_eventtype *node);
+};
+
+#endif /* _BE_VISITOR_VALUETYPE_CDR_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/cdr_op_ci.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/cdr_op_ci.h
new file mode 100644
index 00000000000..4f7fa51bea4
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/cdr_op_ci.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_ci.h
+//
+// = DESCRIPTION
+// Concrete visitor for valuetypes.
+// This one provides code generation for the CDR operators.
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUETYPE_CDR_OP_CI_H_
+#define _BE_VISITOR_VALUETYPE_CDR_OP_CI_H_
+
+class be_visitor_valuetype_cdr_op_ci : public be_visitor_valuetype
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_cdr_op_ci
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for valuetype that generates the CDR operator
+ // implementations
+ //
+
+public:
+ be_visitor_valuetype_cdr_op_ci (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_cdr_op_ci (void);
+ // destructor
+
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit valuetype
+
+ virtual int visit_field (be_field *node);
+ // visit field
+
+ virtual int visit_array (be_array *node);
+ // visit array
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence
+};
+
+#endif /* _BE_VISITOR_VALUETYPE_CDR_OP_CI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/cdr_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/cdr_op_cs.h
new file mode 100644
index 00000000000..e45eb3cc4ed
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/cdr_op_cs.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// cdr_op_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for valuetypes.
+// This one provides code generation for the CDR operators.
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+// based on code from Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUETYPE_CDR_OP_CS_H_
+#define _BE_VISITOR_VALUETYPE_CDR_OP_CS_H_
+
+class be_visitor_valuetype_cdr_op_cs : public be_visitor_valuetype
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_cdr_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for valuetype that generates the CDR operator
+ // implementations
+ //
+
+public:
+ be_visitor_valuetype_cdr_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_cdr_op_cs (void);
+ // destructor
+
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_eventtype (be_eventtype *node);
+
+ virtual int visit_field (be_field *node);
+ // visit field
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence
+};
+
+#endif /* _BE_VISITOR_VALUETYPE_CDR_OP_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/field_cdr_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/field_cdr_ch.h
new file mode 100644
index 00000000000..04fc6447d39
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/field_cdr_ch.h
@@ -0,0 +1,68 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_cdr_ch.h
+//
+// = DESCRIPTION
+// Visitor generating code for Field in the client header file.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUETYPE_FIELD_CDR_CH_H_
+#define _BE_VISITOR_VALUETYPE_FIELD_CDR_CH_H_
+
+#include "be_visitor_scope.h"
+
+class be_visitor_valuetype_field_cdr_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_field_cdr_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for the be_field node for the client header.
+ //
+public:
+ be_visitor_valuetype_field_cdr_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_field_cdr_ch (void);
+ // destructor
+
+ virtual int visit_field (be_field *node);
+ // visit the field node
+
+ // =visit operations on all possible data types that a field can be
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum type
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence type
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedefed type
+
+ virtual int visit_union (be_union *node);
+ // visit union type
+
+ const char *pre_, *post_;
+};
+
+#endif /* _BE_VISITOR_VALUETYPE_FIELD_CDR_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/field_cdr_cs.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/field_cdr_cs.h
new file mode 100644
index 00000000000..628aeefb8ee
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/field_cdr_cs.h
@@ -0,0 +1,132 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_cdr_cs.h
+//
+// = DESCRIPTION
+// Visitor generating code for Field in the client stubs file.
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+// derived from be_visitor_field/cdr_op_cs.h
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUETYPE_FIELD_CDR_C_H_
+#define _BE_VISITOR_VALUETYPE_FIELD_CDR_CI_H_
+
+#include "be_visitor_scope.h"
+
+class be_visitor_valuetype_field_cdr_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_field_cdr_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for the be_field node for the client header.
+ //
+public:
+ be_visitor_valuetype_field_cdr_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_field_cdr_cs (void);
+ // destructor
+
+ virtual int visit_field (be_field *node);
+ // visit the field node
+
+ // =visit operations on all possible data types that a field can be
+
+ 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_valuebox (be_valuebox *node);
+ // visit valuebox type
+
+ virtual int visit_valuetype (be_valuetype *node);
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+
+ virtual int visit_component (be_component *node);
+ // visit component type
+
+ virtual int visit_component_fwd (be_component_fwd *node);
+ // visit interface forward type
+
+ virtual int visit_eventtype (be_eventtype *node);
+ // visit eventtype type
+
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+ // visit eventtype 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
+
+ const char *pre_, *post_;
+
+private:
+ int valuetype_common (be_type *);
+
+};
+
+class be_visitor_valuetype_field_cdr_decl : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_cdr_valuetype_field_cdr_decl
+ //
+ // = DESCRIPTION
+ // When generating CDR operators for fields of structures and/or
+ // unions it may be necessary to define some local variables (for
+ // instance to hold temporary T_forany objects); this visitor
+ // generates that code.
+ //
+public:
+ be_visitor_valuetype_field_cdr_decl (be_visitor_context *ctx);
+ // constructor
+
+ virtual int visit_field (be_field *node);
+ // visit the field node
+
+ // = visit operations for data types that require a local variable.
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef type
+};
+
+#endif /* _BE_VISITOR_VALUETYPE_FIELD_CDR_CI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/field_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/field_ch.h
new file mode 100644
index 00000000000..05ac5ba7e0c
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/field_ch.h
@@ -0,0 +1,100 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_ch.h
+//
+// = DESCRIPTION
+// Visitor generating code for valuetype fields in the valuetype class
+// (header).
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+// derived from be_visitor_union_branch/public_ch.h
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUETYPE_FIELD_CH_H_
+#define _BE_VISITOR_VALUETYPE_FIELD_CH_H_
+
+class be_visitor_valuetype_field_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_field_ch
+ //
+ // = DESCRIPTION
+ // Visitor generating code for valuetype fields in the valuetype class
+ // (header).
+ //
+public:
+ be_visitor_valuetype_field_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_field_ch (void);
+ // destructor
+
+ virtual int visit_field (be_field *node);
+ // visit the field node
+
+ // =visit operations on all possible data types that a valuetype
+ // state member 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_valuebox (be_valuebox *node);
+ // visit valuebox type
+
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_eventtype (be_eventtype *node);
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+
+ virtual int visit_predefined_type (be_predefined_type *node);
+ // visit predefined type
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence type
+
+ virtual int visit_string (be_string *node);
+ // visit string type
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedefed type
+
+ virtual int visit_union (be_union *node);
+ // visit union type
+
+ void setenclosings (const char *pre, const char *post);
+ const char *pre_op ();
+ const char *post_op ();
+ // print additional material around the field (e.g. virtual before)
+
+private:
+ const char *pre_op_;
+ const char *post_op_;
+ AST_Field::Visibility visibility_;
+};
+
+#endif /* _BE_VISITOR_VALUETYPE_FIELD_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/field_ci.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/field_ci.h
new file mode 100644
index 00000000000..4803e64cfee
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/field_ci.h
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_ci.h
+//
+// = DESCRIPTION
+// Visitor for the Valuetype class.
+// This one generates code for accessor and modifier functions of
+// valuetype state members (in the inline file).
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUETYPE_FIELD_CI_H_
+#define _BE_VISITOR_VALUETYPE_FIELD_CI_H_
+
+class be_visitor_valuetype_field_ci : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_field_ci
+ //
+ // = DESCRIPTION
+ // This visitor is used to generate the accessors and modifiers
+ // for the members of valuetype
+ //
+public:
+ be_visitor_valuetype_field_ci (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_field_ci (void);
+ // destructor
+
+ virtual int visit_field (be_field *node);
+ // visit the field 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_structure (be_structure *node);
+ // visit structure type
+
+ virtual int visit_union (be_union *node);
+ // visit union type
+
+ void setenclosings (const char *pre);
+ const char *pre_op ();
+ // print additional string before op (e.g. ACE_INLINE)
+
+ void op_name (be_valuetype *node, TAO_OutStream *os);
+ // if (in_obv_space_) print OBV_name else print name
+
+ bool in_obv_space_;
+
+private:
+ const char *pre_op_;
+};
+
+#endif /* _BE_VISITOR_VALUETYPE_FIELD_CI_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/field_cs.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/field_cs.h
new file mode 100644
index 00000000000..b8ce769a27b
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/field_cs.h
@@ -0,0 +1,104 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// field_cs.h
+//
+// = DESCRIPTION
+// Visitor for the Valuetype class.
+// This one generates code for accessor and modifier functions of
+// valuetype state members (in the stub file).
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+// derived from be_visitor_union_branch/public_ci.h
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUETYPE_FIELD_CS_H_
+#define _BE_VISITOR_VALUETYPE_FIELD_CS_H_
+
+class be_visitor_valuetype_field_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_field_cs
+ //
+ // = DESCRIPTION
+ // This visitor is used to generate the accessors and modifiers
+ // for the members of valuetype
+ //
+public:
+ be_visitor_valuetype_field_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_field_cs (void);
+ // destructor
+
+ virtual int visit_field (be_field *node);
+ // visit the field 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_valuebox (be_valuebox *node);
+ // visit valuebox type
+
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_eventtype (be_eventtype *node);
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+
+ virtual int visit_predefined_type (be_predefined_type *node);
+ // visit predefined type
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence type
+
+ virtual int visit_string (be_string *node);
+ // visit string type
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedefed type
+
+ virtual int visit_union (be_union *node);
+ // visit union type
+
+ void setenclosings (const char *pre);
+ const char *pre_op ();
+ // print additional string before op (e.g. ACE_INLINE)
+
+ void op_name (be_valuetype *node, TAO_OutStream *os);
+ // if (in_obv_space_) print OBV_name else print name
+
+ bool in_obv_space_;
+private:
+ const char *pre_op_;
+
+ int valuetype_common (be_type *node);
+};
+
+#endif /* _BE_VISITOR_VALUETYPE_FIELD_CS_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/marshal_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/marshal_ch.h
new file mode 100644
index 00000000000..997f267b315
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/marshal_ch.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// marshal_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for valuetypes.
+// This one provides code generation for marshalling.
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUETYPE_MARSHAL_CH_H_
+#define _BE_VISITOR_VALUETYPE_MARSHAL_CH_H_
+
+class be_visitor_valuetype_marshal_ch : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_marshal_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for interface that generates the CDR operator
+ // declarations
+ //
+
+public:
+ be_visitor_valuetype_marshal_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_marshal_ch (void);
+ // destructor
+
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_eventtype (be_eventtype *node);
+};
+
+#endif /* _BE_VISITOR_VALUETYPE_MARSHAL_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/marshal_cs.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/marshal_cs.h
new file mode 100644
index 00000000000..833658657d1
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/marshal_cs.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// marshal_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for valuetypes.
+// This one provides code generation for marshalling.
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUETYPE_MARSHAL_CS_H_
+#define _BE_VISITOR_VALUETYPE_MARSHAL_CS_H_
+
+class be_visitor_valuetype_marshal_cs : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_marshal_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for interface that generates the CDR operator
+ // declarations
+ //
+
+public:
+ be_visitor_valuetype_marshal_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_marshal_cs (void);
+ // destructor
+
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_eventtype (be_eventtype *node);
+
+ void class_name (be_valuetype *node, TAO_OutStream *os);
+ int gen_fields (be_valuetype *node, be_visitor_context &ctx);
+};
+
+#endif /* _BE_VISITOR_VALUETYPE_MARSHAL_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/obv_module.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/obv_module.h
new file mode 100644
index 00000000000..b4da292f1f1
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/obv_module.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// module_obv.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Module class
+// This provides code generation for the module in the header
+// for the OBV_ namespace
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUETYPE_OBV_MODULE_H_
+#define _BE_VISITOR_VALUETYPE_OBV_MODULE_H_
+
+class be_visitor_obv_module : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_obv_module
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the header for module
+ // OBV_ namespace
+ //
+public:
+ be_visitor_obv_module (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_obv_module (void);
+ // destructor
+
+ virtual int visit_module (be_module *node);
+
+ virtual int visit_valuetype (be_valuetype *node);
+
+ virtual int visit_eventtype (be_eventtype *node);
+};
+
+#endif /* _BE_VISITOR_VALUETYPE_OBV_MODULE_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
new file mode 100644
index 00000000000..e88c4509dfb
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype.h
@@ -0,0 +1,117 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Valuetype node.
+// This one provides the generic visitor for valuetypes from which others
+// will inherit.
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+// based on interface.h from Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VALUETYPE_VALUETYPE_H_
+#define _BE_VALUETYPE_VALUETYPE_H_
+
+
+class be_visitor_valuetype : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for valuetype that abstracts all common tasks
+ //
+
+public:
+
+ be_visitor_valuetype (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype (void);
+ // destructor
+
+public:
+ virtual int visit_valuetype_scope (be_valuetype *node);
+ // visit the scope of the valuetype node
+ // (in public/private field order)
+
+ virtual void begin_public ();
+ virtual void begin_private ();
+
+ // =visit methods on all elements syntactically valid in a Valuetype scope
+
+ virtual int visit_attribute (be_attribute *node);
+ // visit attribute
+
+ virtual int visit_constant (be_constant *node);
+ // visit a constant
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_exception (be_exception *node);
+ // visit 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
+
+ virtual int visit_field (be_field *node);
+ // visit a field
+
+ // =helper methods for generation of fields
+
+ int gen_pd (be_valuetype *node);
+ // private data fields for scope
+
+ int gen_field_pd (be_field *node);
+ // private data for field
+
+ virtual int gen_init_defn (be_valuetype *node);
+ // generate the _init class definition
+
+ virtual int gen_init_impl (be_valuetype *node);
+ // generate the _init implementation
+
+ void gen_obv_init_constructor_args (be_valuetype *node,
+ unsigned long &index);
+ // Recursively generate args for the initializing constuctor.
+
+protected:
+ static bool obv_need_ref_counter (be_valuetype *node);
+ // check is VT needs a RefCounter mix-in in OBV_ class
+ // suppose that we are deciding for this node
+
+ static bool obv_have_ref_counter (be_valuetype *node);
+ // recurse down the inheritance tree to see
+ // if node or one of its OBV_ base class already has RefCounter
+
+ bool is_amh_exception_holder (be_valuetype *node);
+ // Predicate common to _ch and _cs visitors.
+};
+
+#endif /* _BE_VALUETYPE_VALUETYPE_H_ */
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
new file mode 100644
index 00000000000..0af5bed92b0
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_ch.h
@@ -0,0 +1,62 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Valuetype node.
+// This one provides code generation for valuetypes in the (client) header.
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>,
+// based on code from Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VALUETYPE_VALUETYPE_CH_H_
+#define _BE_VALUETYPE_VALUETYPE_CH_H_
+
+// we need derived valuetype visitors for the client and server header files. For
+// the others, they use the default valuetype visitor
+
+class be_visitor_valuetype_ch : public be_visitor_valuetype
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client header for valuetype
+ //
+ //
+public:
+ be_visitor_valuetype_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_ch (void);
+ // destructor
+
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_eventtype (be_eventtype *node);
+
+ virtual int visit_operation (be_operation *node);
+ virtual int visit_field (be_field *node);
+
+ 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_ci.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_ci.h
new file mode 100644
index 00000000000..08d463d53f7
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_ci.h
@@ -0,0 +1,51 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_ci.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Valuetype node.
+// This one provides code generation for valuetypes in the client inline.
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+// based on code from Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VALUETYPE_VALUETYPE_CI_H_
+#define _BE_VALUETYPE_VALUETYPE_CI_H_
+
+class be_visitor_valuetype_ci : public be_visitor_valuetype
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_ci
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client inline for valuetype
+ //
+ //
+public:
+ be_visitor_valuetype_ci (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_ci (void);
+ // destructor
+
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_eventtype (be_eventtype *node);
+
+ virtual int visit_field (be_field *node);
+private:
+ bool opt_accessor_;
+};
+
+#endif /* _BE_VALUETYPE_VALUETYPE_CI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_cs.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_cs.h
new file mode 100644
index 00000000000..6035d3bc09d
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_cs.h
@@ -0,0 +1,48 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Valuetype node.
+// This one provides code generation for valuetypes in the client stubs.
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+// based on code from Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VALUETYPE_VALUETYPE_CS_H_
+#define _BE_VALUETYPE_VALUETYPE_CS_H_
+
+class be_visitor_valuetype_cs : public be_visitor_valuetype
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client stubs for valuetype
+ //
+ //
+public:
+ be_visitor_valuetype_cs (be_visitor_context *ctx);
+
+ ~be_visitor_valuetype_cs (void);
+
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_eventtype (be_eventtype *node);
+
+ virtual int visit_operation (be_operation *node);
+ // Called only by AMH exceptions.
+};
+
+#endif /* _BE_VALUETYPE_VALUETYPE_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init.h
new file mode 100644
index 00000000000..1c867521d14
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init.h
@@ -0,0 +1,52 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_init.h
+//
+// = DESCRIPTION
+// Coomon visitor for the Valuetype node.
+// This one provides code generation for valuetype factory construct.
+//
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+//
+//
+// ============================================================================
+
+#ifndef _BE_VALUETYPE_VALUETYPE_INIT_H_
+#define _BE_VALUETYPE_VALUETYPE_INIT_H_
+
+
+class be_visitor_valuetype_init : public be_visitor_valuetype
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_init
+ //
+ // = DESCRIPTION
+ // This is a common visitor to generate valuetype factory constructs.
+ //
+ //
+
+public:
+ be_visitor_valuetype_init (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_init (void);
+ // destructor
+
+public:
+
+ void begin_public (void);
+ void begin_private (void);
+};
+
+#endif /* _BE_VALUETYPE_VALUETYPE_INIT_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_arglist_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_arglist_ch.h
new file mode 100644
index 00000000000..1601886c5e7
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_arglist_ch.h
@@ -0,0 +1,56 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_init_arglist_ch.h
+//
+// = DESCRIPTION
+// Visitor for generating code for OBV factory. This generates the
+// operation signature.
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUETYPE_INIT_ARGLIST_CH_H_
+#define _BE_VISITOR_VALUETYPE_INIT_ARGLIST_CH_H_
+
+
+class be_visitor_valuetype_init_arglist_ch : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_init_arglist_ch
+ //
+ // = DESCRIPTION
+ // This is a visitor to generate factory argument list
+ //
+ //
+public:
+ be_visitor_valuetype_init_arglist_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_init_arglist_ch (void);
+ // destructor
+
+ virtual int visit_factory (be_factory *node);
+ // visit factory construct
+
+ virtual int visit_argument (be_argument *node);
+ // visit each argument
+
+ virtual int post_process (be_decl *);
+ // stuff to o/p after each element of the scope is handled
+
+ virtual int gen_throw_spec (be_factory *);
+ // IDL3 extension.
+};
+
+#endif /* _BE_VISITOR_VALUETYPE_INIT_ARGLIST_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_ch.h
new file mode 100644
index 00000000000..32508516a49
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_ch.h
@@ -0,0 +1,53 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_init_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Valuetype node.
+// This one provides code generation for valuetype factory
+// in the (client) header.
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+//
+//
+// ============================================================================
+
+#ifndef _BE_VALUETYPE_VALUETYPE_INIT_CH_H_
+#define _BE_VALUETYPE_VALUETYPE_INIT_CH_H_
+
+
+class be_visitor_valuetype_init_ch : public be_visitor_valuetype_init
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_init_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate valuetype factory in
+ // the client header
+ //
+ //
+public:
+ be_visitor_valuetype_init_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_init_ch (void);
+ // destructor
+
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_eventtype (be_eventtype *node);
+
+ virtual int visit_factory (be_factory *node);
+ // visit a factory
+};
+
+#endif /* _BE_VALUETYPE_VALUETYPE_INIT_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_ci.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_ci.h
new file mode 100644
index 00000000000..142b19ffdcf
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_ci.h
@@ -0,0 +1,47 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_init_ci.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Valuetype node.
+// This one provides code generation for valuetype factory
+// in the (client) inline.
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+//
+//
+// ============================================================================
+
+#ifndef _BE_VALUETYPE_VALUETYPE_INIT_CI_H_
+#define _BE_VALUETYPE_VALUETYPE_INIT_CI_H_
+
+
+class be_visitor_valuetype_init_ci : public be_visitor_valuetype_init
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_init_ci
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate valuetype factory in
+ // the client header
+ //
+ //
+public:
+ be_visitor_valuetype_init_ci (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_init_ci (void);
+ // destructor
+};
+
+#endif /* _BE_VALUETYPE_VALUETYPE_INIT_CI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_cs.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_cs.h
new file mode 100644
index 00000000000..c604b286fea
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_cs.h
@@ -0,0 +1,50 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_init_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Valuetype node.
+// This one provides code generation for valuetype factory
+// in the (client) source.
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+//
+//
+// ============================================================================
+
+#ifndef _BE_VALUETYPE_VALUETYPE_INIT_CS_H_
+#define _BE_VALUETYPE_VALUETYPE_INIT_CS_H_
+
+
+class be_visitor_valuetype_init_cs : public be_visitor_valuetype_init
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_init_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate valuetype factory in
+ // the client header
+ //
+ //
+public:
+ be_visitor_valuetype_init_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_init_cs (void);
+ // destructor
+
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_eventtype (be_eventtype *node);
+};
+
+#endif /* _BE_VALUETYPE_VALUETYPE_INIT_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_obv_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_obv_ch.h
new file mode 100644
index 00000000000..c2ff28d31ef
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_obv_ch.h
@@ -0,0 +1,56 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_obv_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Valuetype node.
+// This one provides code generation for valuetype OBV_ class
+// in the (client) header.
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>,
+// based on code from Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VALUETYPE_VALUETYPE_OBV_CH_H_
+#define _BE_VALUETYPE_VALUETYPE_OBV_CH_H_
+
+// we need derived valuetype visitors for the client and server header files. For
+// the others, they use the default valuetype visitor
+
+class be_visitor_valuetype_obv_ch : public be_visitor_valuetype
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_obv_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the header for valuetype
+ // OBV_ class
+ //
+public:
+ be_visitor_valuetype_obv_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_obv_ch (void);
+ // destructor
+
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_eventtype (be_eventtype *node);
+
+ virtual int visit_field (be_field *node);
+
+ void begin_public ();
+ void begin_private ();
+};
+
+#endif /* _BE_VALUETYPE_VALUETYPE_OBV_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_obv_ci.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_obv_ci.h
new file mode 100644
index 00000000000..47648bb9e74
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_obv_ci.h
@@ -0,0 +1,53 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_obv_ci.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Valuetype node.
+// This one provides code generation for valuetype OBV_ class
+// in the (client) header.
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>,
+// based on code from Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VALUETYPE_VALUETYPE_OBV_CI_H_
+#define _BE_VALUETYPE_VALUETYPE_OBV_CI_H_
+
+// we need derived valuetype visitors for the client and server header files. For
+// the others, they use the default valuetype visitor
+
+class be_visitor_valuetype_obv_ci : public be_visitor_valuetype
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_ci
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the implementation for valuetype
+ // OBV_ class
+ //
+public:
+ be_visitor_valuetype_obv_ci (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_obv_ci (void);
+ // destructor
+
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_eventtype (be_eventtype *node);
+
+ virtual int visit_field (be_field *node);
+};
+
+#endif /* _BE_VALUETYPE_VALUETYPE_OBV_CI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_obv_cs.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_obv_cs.h
new file mode 100644
index 00000000000..05d584190ef
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_obv_cs.h
@@ -0,0 +1,58 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_obv_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Valuetypes
+// OBV_ class implementation
+// (see C++ mapping OMG 20.17)
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>,
+// derived from interface_ch.cpp from Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VALUETYPE_VALUETYPE_OBV_CS_H_
+#define _BE_VALUETYPE_VALUETYPE_OBV_CS_H_
+
+class be_visitor_valuetype_obv_cs : public be_visitor_valuetype
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_obv_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the implementation for valuetype
+ // OBV_ class
+ //
+public:
+ be_visitor_valuetype_obv_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_obv_cs (void);
+ // destructor
+
+ virtual int visit_valuetype (be_valuetype *node);
+ virtual int visit_eventtype (be_eventtype *node);
+ virtual int visit_field (be_field *node);
+
+private:
+ void gen_obv_init_constructor_inits (be_valuetype *node);
+ // Generate member assignments for the initializing constructor.
+
+ void gen_obv_init_base_constructor_args (be_valuetype *node,
+ unsigned long &index);
+ // Called by method above to generate base class constructor call.
+};
+
+#endif /* _BE_VALUETYPE_VALUETYPE_OBV_CS_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..810bc4be474
--- /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);
+ virtual int visit_eventtype (be_eventtype *node);
+};
+
+#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..6c01a376559
--- /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);
+ virtual int visit_eventtype (be_eventtype *node);
+};
+
+#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..8392afce8e9
--- /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);
+ virtual int visit_eventtype (be_eventtype *node);
+
+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
new file mode 100644
index 00000000000..1ca6087d524
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd.h
@@ -0,0 +1,31 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_valuetype_fwd.h
+//
+// = DESCRIPTION
+// Concrete visitor for the valuetype_fwd class
+//
+// = AUTHOR
+// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+// based on code from Aniruddha Gokhale (be_visitor_interface_fwd.h)
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_VALUETYPE_FWD_H
+#define TAO_BE_VISITOR_VALUETYPE_FWD_H
+
+#include "be_visitor_decl.h"
+#include "be_visitor_valuetype_fwd/valuetype_fwd_ch.h"
+#include "be_visitor_valuetype_fwd/any_op_ch.h"
+#include "be_visitor_valuetype_fwd/cdr_op_ch.h"
+
+#endif /* TAO_BE_VISITOR_VALUETYPE_FWD_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd/any_op_ch.h
new file mode 100644
index 00000000000..099299c684f
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd/any_op_ch.h
@@ -0,0 +1,47 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// any_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the forward declared Valuetype node.
+// This one provides code generation for the Any operators.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_VALUETYPE_FWD_ANY_OP_CH_H_
+#define _BE_VALUETYPE_FWD_ANY_OP_CH_H_
+
+class be_visitor_valuetype_fwd_any_op_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_fwd_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for forward declared valuetypes that
+ // generates the Any operator declaration.
+ //
+
+public:
+ be_visitor_valuetype_fwd_any_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_fwd_any_op_ch (void);
+ // destructor
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+};
+
+#endif /* _BE_VALUETYPE_FWD_ANY_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd/cdr_op_ch.h
new file mode 100644
index 00000000000..5270f9ca665
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd/cdr_op_ch.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_fwd_cdr_op_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the valuetype_fwd class
+// This one provides code generation for the CDR operators
+// (actually just their declarations) for the valuetype forward
+// declaration in the client inline.
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+// based on code from Torsten Kuepper
+// based on code from Aniruddha Gokhale & Carlos O'Ryan
+//
+// ============================================================================
+
+#ifndef BE_VISITOR_VALUETYPE_FWD_CDR_OP_CH_H
+#define BE_VISITOR_VALUETYPE_FWD_CDR_OP_CH_H
+
+class be_visitor_valuetype_fwd_cdr_op_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_fwd_cdr_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for valuetype that generates the CDR
+ // operator forward declarations.
+ //
+
+public:
+ be_visitor_valuetype_fwd_cdr_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_fwd_cdr_op_ch (void);
+ // destructor
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+};
+
+#endif /* BE_VISITOR_VALUETYPE_FWD_CDR_OP_CH_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd/valuetype_fwd_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd/valuetype_fwd_ch.h
new file mode 100644
index 00000000000..428a645de1c
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd/valuetype_fwd_ch.h
@@ -0,0 +1,47 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_fwd_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Valuetype Forward node.
+// This one provides code generation for valuetype forward node.
+//
+// = AUTHOR
+// Torsten Kuepper
+// based on code from Aniruddha Gokhale
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_VALUETYPE_FWD_CH_H_
+#define _BE_VISITOR_VALUETYPE_FWD_CH_H_
+
+class be_visitor_valuetype_fwd_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_fwd_ch
+ //
+ // = DESCRIPTION
+ // This is the visitor for valuetype_fwd for the header file
+ //
+ //
+public:
+ be_visitor_valuetype_fwd_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_fwd_ch (void);
+ // destructor
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+};
+
+#endif /* _BE_VISITOR_VALUETYPE_FWD_CH_H_ */
diff --git a/TAO/TAO_IDL/docs/ANNOUNCEMENT b/TAO/TAO_IDL/docs/ANNOUNCEMENT
new file mode 100644
index 00000000000..870db6f6006
--- /dev/null
+++ b/TAO/TAO_IDL/docs/ANNOUNCEMENT
@@ -0,0 +1,131 @@
+WHAT:
+
+SunSoft, Inc., Mountain View, California, has placed the source code to
+Project DOE's Interface Definition Language (IDL) compiler front end
+(CFE) on OMG's file server, making the implementation publicly
+available. This release is identified by the version number 1.3.
+
+Project DOE is SunSoft's corporate-wide development effort to integrate
+distributed object technology into the Solaris O/S. OMG (Object Management
+Group) is the industry wide body formed to create specifications for
+distributed object technology. It currently has more than 370 members. OMG
+IDL is part of OMG's CORBA 1.1 specification and provides a standardized
+way for defining object interfaces. OMG IDL forms the basis for distributed
+object interactionin Project DOE.
+
+The SunSoft OMG IDL CFE provides a complete framework for building
+CORBA 1.1-compliant preprocessors for OMG IDL. By using this standard
+implementation, developers of OMG IDL compilers will save many months
+of work and enhance the portability and interoperability of OMG
+IDL-interfaced objects.
+
+The SunSoft OMG IDL CFE allows convenient and fast integration of new back
+ends to the compiler. The release consists of a front end which converts
+OMG IDL to an intermediate format, a compiler framework driver, an example
+implementation of a compiler back end, and a set of protocols for
+interaction between the front and back ends. The SunSoft OMG IDL CFE
+parser uses components generated by yacc and lex.
+
+The SunSoft OMG IDL CFE is designed to allow easy extension of OMG IDL
+without impacting existing back-end implementations. As the CORBA
+specification evolves, any new updates to the IDE CFE will be placed
+by SunSoft on the OMG server.
+
+This release provides a directory with many examples of OMG IDL
+specifications to allow users to become familiar with the process of
+writing OMG IDL code.
+
+For more information send email to idl-cfe@sun.com.
+
+HOW:
+
+The SunSoft OMG IDL CFE is available at no charge through anonymous FTP
+in source form on the OMG file server, omg.org. Please retrieve the
+file OMG_IDL_CFE_1.3.tar.Z from the directory pub/OMG_IDL_CFE_1.3. Please
+let us know who you are if you retrieve the compiler front end using this
+method, by sending email to idl-cfe@sun.com.
+
+You can also retrieve the software by using the OMG mail server program.
+Send email with the subject 'help' to omg_idl@omg.org, and the mail server
+will respond with instructions on how to retrieve the software.
+
+WHEN:
+
+The SunSoft OMG IDL CFE is available now.
+
+CONTACT:
+
+Please let us know who you are if you decide to use this software, and how
+you use it. Please send email to:
+
+ idl-cfe@sun.com
+
+This address can also be used to report problems, bugs, suggestions and
+send general comments.
+
+We ask that if you make extensions or modifications to this source release,
+please make these extensions available to others using the OMG IDL compiler
+front end, by sending the modified sources to the above email address. This
+will help us evaluate your extensions for inclusion in a future version. It
+also ensures your investment in these extensions when new versions of the
+CFE are released.
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+COPYRIGHT NOTICE:
+
+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
diff --git a/TAO/TAO_IDL/docs/BUG_REPORT b/TAO/TAO_IDL/docs/BUG_REPORT
new file mode 100644
index 00000000000..28c34ae141d
--- /dev/null
+++ b/TAO/TAO_IDL/docs/BUG_REPORT
@@ -0,0 +1,144 @@
+OMG IDL COMPILER FRONT END PROBLEM REPORT FORM
+-============================================-
+
+Checklist: Did you:
+- include configuration information?
+- include compiler version number (use -V to obtain)?
+- include script of run?
+- include IDL file causing problem?
+- make any changes to the CFE? If so, did you include a diff against
+ original version?
+
+PLEASE SEND THE COMPLETED BUG REPORT TO: idl-cfe@sun.com.
+
+THANK YOU FOR REPORTING THIS PROBLEM! THROUGH YOUR COLLABORATION, SUNSOFT
+WILL BE ABLE TO IMPROVE THE FUNCTIONALITY OF THIS PRODUCT. RECEIPT OF BUG
+REPORTS WILL BE ACKNOWLEDGED BUT NO OBLIGATION IS UNDERTAKEN BY SUNSOFT TO
+CORRECT THE REPORTED PROBLEM. SEE YOUR COPYRIGHT AND LICENSE INFORMATION.
+
+
+CONFIGURATION INFORMATION (describe your hardware platform, operating
+system and which compilers you used to compile the CFE):
+
+
+
+
+
+
+COMPILER VERSION INFORMATION (include output from idl -V here):
+
+
+
+
+
+
+
+PROBLEM DESCRIPTION (describe problem, include script if available):
+
+
+
+
+
+
+
+
+IDL INPUT CAUSING PROBLEM (include IDL input causing problem):
+
+
+
+
+
+
+
+
+
+DID YOU MAKE ANY CHANGES TO THE CFE? [Y] _ [N] _
+IF YES, INCLUDE A DIF OF YOUR VERSION AGAINST ORIGINAL VERSION:
+
+
+
+
+
+
+
+
+
+PROPOSED FIX (if you believe you know the cause of the problem, please
+include a proposed change to the software to correct it):
+
+
+
+
+
+
+
+
+ANY OTHER RELEVANT INPUT (include here any other information you believe
+may be relevant to the resolution of the problem you described):
+
+
+
+
+
+
+PLEASE SEND THIS PROBLEM REPORT TO idl-cfe@sun.com.
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+COPYRIGHT NOTICE:
+
+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
diff --git a/TAO/TAO_IDL/docs/CHANGES b/TAO/TAO_IDL/docs/CHANGES
new file mode 100644
index 00000000000..ae6fca7bcea
--- /dev/null
+++ b/TAO/TAO_IDL/docs/CHANGES
@@ -0,0 +1,122 @@
+CHANGES WHICH AFFECT BE WRITERS
+-=============================-
+
+INTRODUCTION
+
+This file describes changes that affect BE writers. It contains IMPORTANT
+INFORMATION for BE writers who wish to migrate a BE written to operate with
+release 1.2 to operate with release 1.3. It is likely that not following
+these instructions will result in a compilable but malfunctioning compiler.
+
+AST INHERITANCE CHANGES
+
+The AST has been reorganized so that AST_Union and AST_Exception now
+inherit from AST_Structure. This means that constructors of BE classes
+which inherit from AST_Union or AST_Exception now need to explicitly call
+an initializer for AST_Structure in their init section.
+
+We repeat below the information given in the file WRITING_A_BE, in the
+section entitled "WRITING A BE".
+
+AST_EXCEPTION
+
+The signature for constructors of classes inheriting from AST_Exception
+should now be:
+
+ BE_Exception::BE_Exception(UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Decl(AST_Decl::NT_except, n, p),
+ AST_Structure(AST_Decl::NT_except, n, p),
+ UTL_Scope(AST_Decl::NT_except)
+
+AST_UNION
+
+The signature for constructors of classes inheriting from AST_Union should
+now be:
+
+ BE_Union::BE_Union(AST_ConcreteType *dt,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Union(dt, n, p),
+ AST_Structure(AST_Decl::NT_union, n, p),
+ AST_Decl(AST_Decl::NT_union, n, p),
+ UTL_Scope(AST_Decl::NT_union)
+
+IDL_BOOL TYPE
+
+To increase portability and reduce dependency of the sources on POSIX
+compliance in targets of ports, IDL now provides its own boolean type which
+is named idl_bool. It provides two truth values, I_TRUE and I_FALSE.
+
+UTL_SCOPEDNAME TYPE
+
+The UTL_ScopedName type is now a list of Identifier nodes; in previous
+releases it used to be a list of String nodes. If your BE constructs scoped
+names this change will prevent recompilation until you modify your
+constructor calls to invoke constructors for Identifier instead of for
+String. The signature of the constructor is:
+
+ Identifier::Identifier(char *, long x=1, long y=0, long z=I_FALSE)
+
+The additional arguments which can be defaulted to the values indicated are
+included for future use.
+
+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.
diff --git a/TAO/TAO_IDL/docs/CLI b/TAO/TAO_IDL/docs/CLI
new file mode 100644
index 00000000000..a61c2bae365
--- /dev/null
+++ b/TAO/TAO_IDL/docs/CLI
@@ -0,0 +1,187 @@
+OMG INTERFACE DEFINITION LANGUAGE COMPILER FRONT END: COMMAND LINE INTERFACE
+-==========================================================================-
+
+INTRODUCTION
+
+This document describes general OMG Interface Definition Language compiler
+command line options. Options that are specific to a given back end, object
+adapter or language are not described here. These should be described in a
+document detailing the interface implemented by each specific back end.
+
+OMG INTERFACE DEFINITION LANGUAGE COMMAND LINE OPTIONS
+
+OMG Interface Definition Language compiler options are described below.
+Unless otherwise noted, only one occurrence of each option is allowed.
+The following conventions are used
+
+- Text in '[..]' is optional.
+- Text followed by '*' can be repeated zero or more times.
+- Text followed by '+' can be repeated once or more times.
+- '{' and '}' are used to group text to cause '+' or '*' to apply to
+ the entire grouped text.
+- 'aa|bb' means either 'aa' or 'bb'.
+
+COMMAND LINE SUMMARY
+
+ idl [flag | file-name]*
+
+Flags are command line words that start with a '-'. All other command line
+words are assumed to be file names. If no file names are given, input is
+taken from stdin.
+
+COMMAND LINE FLAGS
+
+-A[xyz] A local escape. This can be used to specify additional options that
+ are specific to a given implementation. More than one -A option is
+ allowed
+
+-Dname[=value]
+ Defines name and an optional value to be passed to a compliant C++
+ preprocessor, as if by #define. White space between the -D option
+ and the name is optional. More than one -D option is allowed.
+
+-d If no parse errors were found, prints out a representation of the
+ IDL input to stderr.
+
+-E Runs the C++ preprocessor on the OMG Interface Definition Language
+ input and sends the result to the standard output.
+
+-Idirectory
+ Causes directory to be added to the search path for include files.
+ More than one -I option is allowed. This option is processed by a
+ compliant C++ preprocessor.
+
+-Uname Undefines name, as if by #undef. White space between the -U option
+ and the name is optional. More than one -U option is allowed.
+
+-V Causes the version information of the CFE to be displayed. No other
+ work is done, regardless of any other options.
+
+-W[b|p][,arg]+
+ Hands off the arguments supplied to a specific portion of the OMG
+ Interface Definition Language compiler:
+
+ - -Wb arguments are handed to the loaded back end
+ - -Wp arguments are handed to a compliant C++ preprocessor
+
+-Yp,pathname
+ Specifies an alternate path for finding a C++ compliant
+ preprocessor. Specifiers other than 'p' may be defined in future
+ versions of the CFE. More than one -Y option may appear. The last
+ one specifying each component takes effect.
+
+ This option exists but currently does nothing. Instead, we use the
+ preprocessing facilities provided by invoking CC -E always.
+
+-bback_end
+ Causes the CFE to use a different compiler back end than the
+ default one (if dynamic loading is supported). Legal values for
+ this option and the default value are implementation specific.
+
+-u Prints a usage message from the CFE. All possible options are
+ shown. No other work is done regardless of any other options.
+
+-v Causes the CFE to produce informational output as the various
+ phases of the compiler execute.
+
+-w Suppresses IDL compiler warning messages.
+
+
+WHITESPACE
+
+All option arguments may be separated from their option letter by
+whitespace. For example, -D FOO is equivalent to -DFOO.
+
+UNKNOWN OPTIONS
+
+If an unknown option is passed to the CFE, the offending option is
+displayed to the user together with a usage message, and no compilation is
+performed.
+
+PASSING OPTIONS TO COMPILER PHASES
+
+The order in which options appear on the command line is preserved when
+they are passed to various compiler phases.
+
+MUTUALLY EXCLUSIVE OPTION COMBINATIONS
+
+Mutually exclusive or ambiguous option combinations are resolved by using
+the option that appears later on the command line. For example,
+
+ -DFOO -UFOO
+
+has no effect and leaves FOO undefined for the preprocessor.
+
+OPTION SCOPE
+
+All options are in effect for the entire IDL compilation run. If multiple
+IDL source file names are given on the command line, all options apply to
+each file. If different IDL source files require different sets of options
+for successfull compilation, they must be compiled separately.
+
+EXIT STATUS
+
+IDL Compilers exit with status equal to zero for successfull compilations.
+If errors were found by the CFE, the exit status is a count of the errors.
+The exit status for unsuccessfull compilations aborted by BEs is defined by
+each BE.
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+COPYRIGHT NOTICE:
+
+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
diff --git a/TAO/TAO_IDL/docs/COPYRIGHT b/TAO/TAO_IDL/docs/COPYRIGHT
new file mode 100644
index 00000000000..461ad949518
--- /dev/null
+++ b/TAO/TAO_IDL/docs/COPYRIGHT
@@ -0,0 +1,57 @@
+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.
diff --git a/TAO/TAO_IDL/docs/INSTALL b/TAO/TAO_IDL/docs/INSTALL
new file mode 100644
index 00000000000..6fcaa710042
--- /dev/null
+++ b/TAO/TAO_IDL/docs/INSTALL
@@ -0,0 +1,229 @@
+INTERFACE DEFINITION LANGUAGE INSTALLATION GUIDE
+-==============================================-
+
+INTRODUCTION
+
+This file describes the installation process for OMG_IDL_CFE version 1.3.
+This file explains how to:
+
+- install the source code
+- modify the sources to customize them for different configurations
+- modify the sources to implement your own back end
+
+TESTED CONFIGURATIONS
+
+This release has been tested and is believed to operate correctly on:
+- SunPro Sparcworks 2.x and 3.0 on SunOS 4.1.x
+- SunPro Sparcworks 2.x and 3.0 on Solaris 2.3
+- g++ 2.5.8 on SunOS 4.1.x
+- g++ 2.5.8 on Solaris 2.3
+
+This is the first release of OMG IDL CFE which is preconfigured to compile
+correctly for Solaris 2.x and with SunPro SparcWorks compilers.
+
+CUSTOMIZATION
+
+The release contains a file idl_make_vars in the current directory, which
+is included in each Makefile. This file defines all the customizable
+variables for the CFE.
+
+OSV should be set to a string denoting the operating system upon which you
+wish to build the CFE. The CFE as shipped is preconfigured to compile
+correctly on Solaris 2.x (OSV=SOLARIS2), and has also been tested on SunOS
+4.1.x (OSV=SUNOS4). It contains code donated by HP which enables it to be
+compiled on Apollo Domain systems (OSV=apollo) and HPUX systems (OSV=hpux),
+but these two configurations have not been tested.
+
+C++ and CCC should be set to identify the C++ compiler you will use to
+compile this release. Their values should be identical. Both are set to
+address differences between various make programs - some predefine CCC,
+others use C++ to denote the C++ compiler. The possible values are CC
+(which uses the Sparcworks compilers on SunOS 4.1 and Solaris 2.3) and g++,
+which uses the installed version of GNU C++.
+
+CCFLAGS should be set to a list of flags to pass to the C++ compiler. As
+shipped, this list is -g. NOTE: We have not extensively tested the release
+with optimization turned on.
+
+CPP_FLAGS should be set to a list of flags to pass to the C++ preprocessor.
+Use this variable to enable or disable specific customizations you make to
+the BE or CFE sources.
+
+YFLAGS should be set to a list of flags to pass to the Yacc program. As
+shipped, the list is -d -t, which causes Yacc to generate y.tab.h and
+y.tab.c files.
+
+LEXFLAGS should be set to a list of flags to pass to the Lex program. As
+shipped, the list -t.
+
+RANLIB should be set to the location of the ranlib program on your system.
+As shipped this is ranlib. If your system has no ranlib you can set this
+variable to ':' or /bin/true. As shipped the variable is preset to
+/bin/true since Solaris 2.x does not use ranlib.
+
+AR should be set to the location of the ar program on your system. As
+shipped this is ar. If your system has a different mechanism for creating
+libraries, you should modify the value of this variable accordingly.
+
+ARFLAGS should be set to the flags to be passed to the ar program. As
+shipped this is 'crv'.
+
+INSTALLATION
+
+a. Disk space requirements
+
+This distribution requires approximately 350 KBytes when compressed. When
+uncompressed, untarred and compiled, approximately 10 MBytes of disk space
+are consumed on a Sun 4.
+
+b. Getting the software
+
+Use anonymous FTP to omg.org and supply your e-mail address as password.
+Change directories to pub/OMG_IDL_CFE_1.3, set bin and get the compressed
+tar file OMG_IDL_CFE_1.3.tar.Z.
+
+The distribution may, in the future, be made available from other archives
+on the Internet. However, omg.org will always have the most up-to-date
+version of this software.
+
+After transferring this file, uncompress it and untar it in a directory of
+your choice.
+
+c. Compiling it
+
+If you are using a Sparcstation running Solaris 2.x and have the SunPro
+Sparcworks compilers installed, you may directly install the software. If
+your hardware or operating system configurations are different, read and
+follow the instructions in the previous section first.
+
+At the root directory of the release, issue
+
+ % make
+
+or
+
+ % make all
+
+This will compile the provided sources and the sources found in the be
+directory. Executing this make target causes 'make all' to be invoked in
+each subdirectory, resulting in building the libraries for each component
+and finally a link step producing an executable IDL compiler.
+
+In order to make only the compiler front end components, without compiling
+the sources found in the be directory and without building an executable,
+issue
+
+ % make libs
+
+This will build the libraries in the ast, fe, util, driver and narrow
+directories. To build only the be, issue
+
+ % make be
+
+To build all libraries without creating an executable, issue
+
+ % make all_libs
+
+To remove all files created by the build process, issue
+
+ % make clean
+
+This will not remove any files created by Yacc and Lex, because you may be
+using the ones provided in the distribution (see below).
+
+d. Yacc and Lex
+
+Some installations may not have a C++ aware Yacc and Lex processor. For
+these installations, we have included the output of yacc and lex in the
+release. If you need to use these files to build the release because you
+don't have access to a C++ capable Yacc or Lex, go to the "fe" directory,
+issue the command:
+
+ % touch lex.yy.cc y.tab.cc y.tab.hh
+
+This will ensure that the processed files appear to be newer than the
+source files they were produced from and will cause "make" to skip their
+production.
+
+NOTE: The files provided in the distribution have been produced on Solaris
+2.3 and may contain OS-specific #include directives. If you intend to use
+these files, you may have to edit them to make them work in your
+environment. The provided files are known to compile cleanly without
+modification with both SunPro Sparcworks compilers and GNU C++ on both
+SunOS 4.1 and Solaris 2.3. We have not tested the grammar and lexer input
+files with bison or flex.
+
+IMPLEMENTING A BACK END
+
+To implement your own back end, you can start with the provided sources in
+the be directory and modify them. The Makefile understands the 'make all'
+target and will generate libbe.a in the demo_be directory. As set up, the
+variable CPP_FLAGS allows you to place include files either in the current
+directory or in the include directory. Alternatively, you can place your
+include files in a new directory and modify CPP_FLAGS to cause the C++
+preprocessor to search this new directory for referenced include files, by
+adding a new -I directive.
+
+Additional detail on the structure and function of back ends, and on the
+protocol which a back end must implement, are found in the document
+entitled WRITING_A_BE.
+
+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.
diff --git a/TAO/TAO_IDL/docs/PROBLEMS b/TAO/TAO_IDL/docs/PROBLEMS
new file mode 100644
index 00000000000..65cfb6a1893
--- /dev/null
+++ b/TAO/TAO_IDL/docs/PROBLEMS
@@ -0,0 +1,132 @@
+OMG INTERFACE DEFINITION LANGUAGE COMPILER FRONT END: KNOWN PROBLEMS
+-==================================================================-
+
+INTRODUCTION
+
+This file describes what configurations are known to work correctly with
+this release, and what are the known problems with this release as shipped.
+Comments about future possible enhancements do not imply a commitment on
+the part of Sun or any of its subsidiaries to produce these enhancements.
+
+TESTED CONFIGURATIONS
+
+This release has been tested and is known to operate correctly on:
+
+- Sparcstation 2 running SunOS 4.1.2, when compiled with SparcWorks 3.0
+- Sparcstation 10 running Solaris 2.3, when compiled with SparcWorks 3.0.1
+- Sparcstation 10 running Solaris 2.3, when compiled with SparcWorks 4.0
+
+We are aware of a bug in GNU C++ (the latest version we tested was 2.5)
+which causes up-casting (changing the type of an instance from a base class
+to a more derived class, also known as "narrowing") to fail or cause a
+program crash.
+
+PROBLEMS:
+
+This is a list of known problems with the current version of the CFE:
+
+- The following syntax, although legal, is not accepted by the CFE:
+
+ .. sequence <string <10>> ..
+
+ This causes a parse error. The cause of this problem is that the '>>' is
+ read as a right shif operater and not as two '>'s. You can avoid this
+ problem by instead writing
+
+ .. sequence <string <10> > ..
+
+- The following syntax, although legal, is not accepted by the CFE:
+
+ const string foo = "abc" " and" " another" " string";
+
+ Instead, write:
+
+ const string foo = "abc and another string";
+
+- The printout produced by the -d option for dumping the AST is not always
+ perfect. Specifically, dumping of sequences and arrays is deficient.
+
+POSSIBLE FUTURE ENHANCEMENTS:
+
+This is a list of areas in which the code of the CFE may change in future
+releases:
+
+- The current release is restricted in its use of C++ because it must
+ be possible to compile it using C++ 2.1. However, we have also provided
+ files that depend on features which are only present in C++ 3.0, such as
+ templates. If your compiler supports templates and you wish to use them,
+ copy the files in include/utl_tmpl to include, and copy the files in
+ util/utl_tmpl to util. You will also need to make compiler dependent
+ modifications to Makefiles throughout the CFE directory hierarchy to
+ enable the use of templates.
+
+ The code using templates was donated by Steve Vinoski of HP.
+
+ In a future release of the CFE only the template code may be included,
+ and hence users will need to use a C++ 3.0 or higher compiler.
+
+- The UTL_list classes defined in the util directory are rudimentary. More
+ features may be added to make the functionality richer.
+
+- The UTL_String class may be rewritten or replaced by a standard ANSI C++
+ String implementation. Applications will be shielded from this change.
+
+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.
diff --git a/TAO/TAO_IDL/docs/README b/TAO/TAO_IDL/docs/README
new file mode 100644
index 00000000000..6d73554acce
--- /dev/null
+++ b/TAO/TAO_IDL/docs/README
@@ -0,0 +1,233 @@
+INTERFACE DEFINITION LANGUAGE COMPILER FRONT END
+-==============================================-
+
+INTRODUCTION
+
+Welcome to the publicly available source release of SunSoft's
+implementation of the compiler front end (CFE) for OMG Interface Definition
+Language! This is Release 1.3 of the CFE.
+
+The Interface Definition Language (IDL) implementation is divided into
+three parts:
+
+- A main program for driving the compilation process
+- A parser and attendant utilities
+- One or more back ends (BEs) for taking the processed input and producing
+ output in a target language and target format
+
+WARNINGS
+
+This is a preliminary version. This software is made available AS IS and
+WITH NO GUARANTEES. Please read the copyright notice attached at the
+bottom of this file.
+
+IMPORTANT NOTICE FOR USERS OF OMG IDL CFE VERSION 1.2.
+
+Please carefully read the file CHANGES to obtain IMPORTANT INFORMATION on
+changes in that may affect the manner in which a BE is constructed. You
+must follow instructions contained in the file CHANGES to obtain a
+functional BE if you are migrating an existing BE from OMG IDL CFE v. 1.2.
+
+TARGET AUDIENCE
+
+Who should use this release?
+
+- You can use this source release to create a stand alone parser for OMG
+ Interface Definition Language. This may be useful to verify the legality
+ of IDL input.
+- Developers of OMG Interface Definition Language compilers should use this
+ release as a basis for writing their back ends, to obtain a common
+ framework for their compiler and to provide portable and uniform
+ parsing of IDL input.
+
+HOW TO OBTAIN THIS SOFTWARE
+
+Please use anonymous FTP to omg.org and supply your e-mail address as the
+password. Then change directories to pub/OMG_IDL_CFE_1.3, set binary transfer
+and get the file OMG_IDL_CFE_1.3.TAR.Z. This file includes copies of all
+individual documentation files in the directory.
+
+Precompiled binaries constructed from the sources in this release will be
+made available shortly, in the directory pub/OMG_IDL_CFE_1.3/bin. These
+binaries are useful for parsing IDL source and for learning about the
+language. Precompiled binaries for Solaris 2.x and for SunOS 4.x will be
+provided.
+
+You can also use the mail server program to retrieve this software. Send
+email with the subject 'help' to omg_idl@omg.org, and the mail server will
+respond with instructions on how to retrieve the software.
+
+Copies of this software may be made available from archives other than
+omg.org. New versions made available by Sun will be placed on omg.org and a
+message will be sent to this newsgroup announcing its availability.
+
+Finally, the SunSoft OMG IDL CFE is also available on magnetic tape for a
+nominal media charge directly from SunSoft. Please refer to part number
+DIDL-100-STP when ordering.
+
+CONTACT POINT
+
+Please let us know who you are if you decide to use this software, and how
+you use it. Please send e-mail to:
+
+ idl-cfe@sun.com
+
+This address can also be used to report problems, bugs, suggestions and
+send general comments.
+
+WHAT IS PROVIDED IN THE RELEASE
+
+Provided in this release are:
+
+- A main program for driving an Interface Definition Language compiler
+- A parser for the Interface Definition Language grammar which builds an
+ internal representation of the input parsed. This internal
+ representation, named an Abstract Syntax Tree (AST), is used as input to
+ a back end
+- Some utility functions used by the parser
+- A demonstration back end (BE) which exercises the front end but produces
+ no translated output
+- Documentation of the public interfaces and of the contract between
+ the compiler front end and a back end
+
+OPERATION
+
+A complete compiler operates in two passes:
+
+- The first pass, provided in this release, parses the IDL input and
+ produces an internal representation, called an Abstract Syntax Tree (AST).
+ This pass also does a complete syntax and semantics check of the input
+ provided to ensure that exactly legal IDL input is accepted. If a syntax
+ or semantic error is discovered, the second pass is not invoked.
+- The second pass, provided by compiler developers, takes the AST and
+ produces output in the language and format of choice. A demonstration
+ back end is provided in the release.
+
+HOW TO USE THIS SOFTWARE
+
+To create a complete compiler from OMG Interface Definition Language to a
+target language, compiler developers will:
+
+- Write a back end (BE) to take the internal representation of the input
+ parsed and translate it to the target language and format. You will
+ probably want to replace the BE directory in this source tree with your
+ own BE directory
+- Link the BE with the sources provided here to produce a complete
+ compiler.
+
+DOCUMENTATION
+
+The OMG Interface Definition Language is fully described in the CORBA
+documentation, Chapter 4. This document may be obtained from OMG.
+
+This release also provides the following documents:
+
+- This README file, describing the release
+- INSTALL, describing installation of the software
+- WRITING_A_BE contains all the information needed to start writing a back
+ end for this distribution
+- CHANGES_IN_AST describes changes that affect migration of BEs written
+ against version 1.2 to version 1.3.
+- CLI, describing the command line interface to the CFE
+- ROADMAP, describing the directory structure for the source code. This
+ file will assist a developer in understanding the structure of the code
+ and navigating it
+- PROBLEMS, describing a list of issues that may be addressed in future
+ releases
+- BUG_REPORT, containing a form for use in reporting bugs and problems
+ with the IDL CFE
+
+ENVIRONMENT
+
+The INSTALL file explains how to customize the software for specific
+platforms. The source distribution expects the following environment:
+
+- Sparcstation 1, 2, or 10 hardware
+- SunPro SparcWorks 3.x or 4.0
+
+As preconfigured, it compiles on Solaris 2.x. It can be reconfigured to
+compile on SunOS 4.x, HPUX or Apollo Domain OS. As far as is known, no use
+is made of Sun Make-specific features, and the Makefiles should be usable
+with other make programs.
+
+This release has been tested and is believed to operate correctly with:
+- SunPro Sparcworks 2.x and 3.0 on SunOS 4.1.x
+- SunPro Sparcworks 2.x and 3.0 on Solaris 2.3
+- g++ 2.5.8 on SunOS 4.1.x
+- g++ 2.5.8 on Solaris 2.3
+
+INSTALLATION
+
+This release is targetted for Sun workstations running Solaris 2.x. The
+process of installing this software is described in detail in the file
+INSTALL in this directory. The INSTALL file also describes how to customize
+the release for your own environment if it is different.
+
+KNOWN PROBLEMS
+
+A list of known deficiencies is provided in the file PROBLEMS in this
+directory. If you find a problem which is not mentioned in it, please
+report it as described below. Please read this file now to be apprised of
+the problems found so far with this release.
+
+COPYRIGHT
+
+This copyright notice appears on all files. Please read it!
+
+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.
diff --git a/TAO/TAO_IDL/docs/ROADMAP b/TAO/TAO_IDL/docs/ROADMAP
new file mode 100644
index 00000000000..5da0d83823c
--- /dev/null
+++ b/TAO/TAO_IDL/docs/ROADMAP
@@ -0,0 +1,126 @@
+INTERFACE DEFINITION LANGUAGE SOURCE TREE ROADMAP
+-===============================================-
+
+INTRODUCTION
+
+This file provides an overview of the directory structure of the sources
+for the compiler front end for OMG Interface Definition Language. This will
+be of use in understanding the source structure and will aid developers of
+BEs.
+
+DIRECTORIES
+
+The following directories are present:
+
+- idl_specs: Contains many examples of IDL specifications, including the
+ IDL specifications of several Object Services, and several
+ files that somewhat exhaustively test features of the IDL
+ language
+- include: Contains all include (".hh") files
+- ast: Contains implementations for all classes comprising
+ the AST internal representation of the input parsed
+- fe: Contains the Yacc grammar and Lex specification for
+ the OMG Interface Definition Language, and some utilities
+- driver: Contains the main program which drives the compilation
+ process
+- util: Contains utility classes used throughout the CFE. These
+ classes may also be of use in writing a BE
+- narrow: Contains an implementation of a narrowing mechanism used
+ in the CFE. Since C++ does not provide compiler support
+ for narrowing, this is provided as an explicit service
+- demo_be: Contains a demonstration back end which subclasses all
+ the AST classes but adds no functionality
+
+NAMING CONVENTIONS
+
+The file names start with two or three characters identifying the component
+to which they belong:
+
+- idl_: This is the prefix for all files which contain global
+ elements of the CFE
+- ast_: This is the prefix for all files containing implementations
+ or definitions of the AST
+- fe_: This is the prefix for all files belonging to the parser
+- drv_: This is the prefix for all files belonging to the compiler
+ driver
+- utl_: This prefix is used to identify files belonging to the set of
+ utlities provided with the CFE
+- nr_: This prefix identifies files belonging to the narrowing mechanim
+- be_: This is the prefix for all files belonging to the back end
+
+All C++ files use the ".cc" extension, and all include files have the ".hh"
+extension. All make files are named Makefile. Each directory contains a
+make file. Lex input files have the ".ll" extension, and Yacc input files
+use the ".yy" extension. All files containing IDL specifications have a
+name ending with the ".idl" suffix.
+
+INCLUDE FILE HIERARCHY
+
+There are two main include files which must be included in all source
+files. These are idl.hh and idl_extern.hh. The idl.hh file includes the
+definitions for all the facilities provided by the CFE. The idl_extern.hh
+file declares globally accessible data and exported application programmer
+interface entry points.
+
+Each component has an include file for its own. Back end writers will want
+to modify be.hh and possibly be_extern.hh.
+
+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.
diff --git a/TAO/TAO_IDL/docs/WRITING_A_BE b/TAO/TAO_IDL/docs/WRITING_A_BE
new file mode 100644
index 00000000000..5c3c069f7a1
--- /dev/null
+++ b/TAO/TAO_IDL/docs/WRITING_A_BE
@@ -0,0 +1,1350 @@
+OMG INTERFACE DEFINITION LANGUAGE COMPILER FRONT END PROTOCOLS
+==============================================================
+
+INTRODUCTION
+------------
+
+Welcome to the publicly available source release of SunSoft's
+implementation of the compiler front end (CFE) for OMG Interface Definition
+Language!
+
+This document explains how to use the release to create a fully functional
+OMG Interface Definition Language to target language compiler for your
+selected target system configuration. The section OVERVIEW explains this
+document's structure.
+
+CONTEXT
+-------
+
+The implementation has three parts:
+
+1. A main program driving the compilation process
+2. A parser and attendant utilities for converting the IDL input into
+ an internal form
+3. One or more back ends which take as input the internal form representing
+ the IDL input, and which produce output in a target language and target
+ format
+
+The release contains components 1 and 2, and a demonstration implementation
+of component 3. To use this release, you
+
+- write a back end which takes the internal representation of the parsed input
+ and translates it to the target language and format. You may replace or
+ modify the demonstration back end provided.
+- link the back end with the provided main program and parser sources
+ to produce a complete compiler.
+
+OVERVIEW
+--------
+
+This document does not explain IDL nor does it introduce IDL features.
+For this information, refer to the OMG CORBA specification, available by
+anonymous FTP from omg.org.
+
+This document does not explain C++, except to demonstrate how it is
+used to construct the CFE. The ARM by Stroustrup and Ellis provides a
+thorough explanation of C++.
+
+This document consists of two independent parts. The first part
+s all CFE supported protocols and the required
+application programmer's interface entry points that a conformant
+BE must provide. The second part steps through the process of
+constructing a working BE.
+
+The first part describes:
+
+- The compilation process
+- The Abstract Syntax Tree (AST) internal representation of parsed IDL
+ input
+- How access to member data fields is managed
+- How the AST is generated from the IDL input (Generator protocol)
+- How definition scopes are nested and how name lookup works
+- The narrowing mechanism
+- How definition scopes are managed and how nodes are added to scopes
+- How BEs get control during the AST construction process (Add protocol)
+- The inheritance scheme used by the AST and how it affects BEs
+- How errors are handled and reported
+- How the CFE is initialized
+- How the command line arguments are parsed
+- What global variables and functions are provided
+- What API is required to be supported by a BE in order to link
+ with the CFE
+- What files must be included in each BE file
+
+The second part describes
+
+- The API to be supplied by each BE
+- How to subclass from the AST to add BE specific functionality
+- How to subclass from the Generator protocol to create BE specific
+ extended AST nodes
+- How to write constructors for the derived BE classes
+- How to use the Add protocol to store BE specific information
+- How to maintain BE specific information which applies to the entire
+ AST generated from the IDL input
+- How to use data members in your BE
+- How to build a complete compiler
+
+PART I. FEATURES OF THE CFE
+-=========================-
+
+THE COMPILATION PROCESS
+-----------------------
+
+The OMG IDL compiler operates as follows:
+
+- Parses command line arguments. If an option is directed at a
+ BE, an appropriate operation provided by the BE is invoked to process
+ the option.
+- Performs global initialization.
+- Forks a copy of the compiler for each file specified as input.
+- An ANSI-compatible preprocessor preprocesses the IDL input.
+- Parses the file using the CFE parser, and constructs an AST describing the
+ IDL input.
+- Prints the AST for verification, if requested.
+- Invokes the BE to process the AST and produce the output
+ characteristic of that BE.
+
+ABSTRACT SYNTAX TREE
+--------------------
+
+The AST (Abstract Syntax Tree) is the primary mechanism for communication
+between a BE and the CFE. It consists of a tree of instances of classes
+defined in the CFE or refinements of those classes as defined in a BE.
+The class hierarchy of the AST closely resembles the structure of the IDL
+syntax. Most AST classes have direct equivalents in IDL constructs.
+
+The UTL_Scope class defines common functionality for definition scope
+management and name lookup. This is explained in a following section.
+UTL_Scope is defined in include/utl_scope.hh and implemented in
+util/utl_scope.cc.
+
+The AST provides the following classes:
+
+AST_Decl Base of the AST class hierarchy. Each class in the AST
+ inherits from AST_Decl. Defined in include/ast_decl.hh
+ and implemented in ast/ast_decl.cc
+
+AST_Type Common base class for all classes which represent IDL
+ type constructs. Defined in include/ast_type.hh and
+ implemented in ast/ast_type.cc. Inherits from AST_Decl.
+
+AST_ConcreteType Common base class for all classes which represent IDL
+ types other than interfaces. Defined in the file
+ include/ast_concrete_type.hh and implemented in
+ ast/ast_concrete_type.cc. Inherits from AST_Type.
+
+AST_PredefinedType Instances of this class represent all predefined types
+ such as long, char and so forth. Defined in the file
+ include/ast_predefined_type.hh and implemented in
+ ast/ast_predefined_type.cc. Inherits from
+ AST_ConcreteType.
+
+AST_Module Represents the IDL module construct. Defined in the
+ file include/ast_module.hh and implemented in
+ ast/ast_module.cc. Inherits from AST_Decl and
+ UTL_Scope.
+
+AST_Root Represents the root of the abstract syntax tree being
+ constructed. Is a subclass of AST_Module. Can be
+ subclassed in BEs to store information associated with
+ the entire AST. Defined in the file include/ast_root.hh
+ and implemented in ast/ast_root.cc. Inherits from
+ AST_Module.
+
+AST_Interface Represents the IDL interface construct. Defined in
+ include/ast_interface.hh and implemented in the file
+ ast/ast_interface.cc. Inherits from AST_Type and
+ UTL_Scope.
+
+AST_InterfaceFwd Represents a forward declaration of an IDL interface.
+ Defined in include/ast_interface_fwd.hh and implemented
+ in ast/ast_interface_fwd.cc. Inherits from AST_Decl.
+
+AST_Attribute Represents an IDL attribute construct. Defined in
+ include/ast_attribute.hh and implemented in the file
+ ast/ast_attribute.cc. Inherits from AST_Decl.
+
+AST_Exception Represents an IDL exception construct. Defined in
+ include/ast_exception.hh and implemented in the file
+ ast/ast_exception.cc. Inherits from AST_Decl.
+
+AST_Structure Represents an IDL struct construct. Defined in the file
+ include/ast_structure.hh and implemented in the file
+ ast/ast_structure.cc. Inherits from AST_ConcreteType
+ and UTL_Scope.
+
+AST_Field Represents a field in an IDL struct or exception
+ construct. Defined in include/ast_field.hh and
+ implemented in ast/ast_field.cc. Inherits from
+ AST_Decl.
+
+AST_Operation Represents an IDL operation construct. Defined in the
+ file include/ast_operation.hh and implemented in
+ ast/ast_operation.cc. Inherits from AST_Decl and
+ UTL_Scope.
+
+AST_Argument Represents an argument to an IDL operation construct.
+ Defined in include/ast_argument.hh and implemented in
+ ast/ast_argument.cc. Inherits from AST_Field.
+
+AST_Union Represents an IDL union construct. Defined in
+ include/ast_union.hh and implemented in
+ ast/ast_union.cc. Inherits from AST_ConcreteType and
+ from UTL_Scope.
+
+AST_UnionBranch Represents an individual branch in an IDL union
+ construct. Defined in include/ast_union_branch.hh and
+ implemented in ast/ast_union_branch.cc. Inherits from
+ AST_Field.
+
+AST_UnionLabel Represents the label of an individual branch in an IDL
+ union construct. Defined in include/ast_union_label.hh
+ and implemented in ast/ast_union_label.cc
+
+AST_Constant Represents an IDL constant construct. Defined in
+ include/ast_constant.hh and implemented in the file
+ ast/ast_constant.cc. Inherits from AST_Decl.
+
+AST_Enum Represents an IDL enum construct. Defined in the file
+ include/ast_enum.hh and implemented in ast/ast_enum.cc.
+ Inherits from AST_ConcreteType and UTL_Scope.
+
+AST_EnumVal Represents an enumerator in an IDL enum construct.
+ Defined in include/ast_enum_val.hh and implemented in
+ ast/ast_enum_val.cc. Inherits from AST_Constant.
+
+AST_Sequence Represents an IDL sequence construct. Defined in
+ include/ast_sequence.hh and implemented in
+ ast/ast_sequence.cc. Inherits from AST_Decl.
+
+AST_String Represents an IDL string construct. Defined in the file
+ include/ast_string.hh and implemented in
+ ast/ast_string.cc. Inherits from AST_Decl.
+
+AST_Array Represents an array modifier to the type of an IDL
+ field or typedef declaration. Defined in the file
+ include/ast_array.hh and implemented in
+ ast/ast_array.cc. Inherits from AST_Decl.
+
+AST_Typedef Represents an IDL typedef construct. Defined in the file
+ include/ast_typedef.hh and implemented in
+ ast/ast_typedef.cc. Inherits from AST_Decl.
+
+AST_Expression Represents an IDL expression. Defined in the file
+ include/ast_expression.hh and implemented in
+ ast/ast_expression.cc.
+
+AST_Root A subclass of AST_Module, an instance of this class
+ is used to represent the distinguished root node of
+ the AST. Defined in include/ast_root.hh and implemented
+ in ast/ast_root.cc. Inherits from AST_Module.
+
+
+USING INSTANCE DATA
+-------------------
+
+The AST classes define member data fields in addition to defining
+operations on instances. These member data fields are all private, to allow
+only the instance in which they are stored direct access. Other objects
+(including other instances of the same class) can obtain access to the
+member data fields of an instance through accessor functions. These
+accessor functions allow retrieval of the data, and in some cases update
+functions are also provided to store new values.
+
+There are several reasons why this approach is taken. First, it hides the
+actual implementation of the member data fields from outside the class. For
+example, a Thermometer class would not expose whether its temperature
+reading is stored in Farenheit or Celsius units, and it could allow access
+through either unit method.
+
+Second, protecting access to member data in this manner restricts the
+ability to update it to the instance itself, save where update functions
+are explicitly provided. This makes for more reliable implementations,
+since the manipulation of the data is isolated in the class implementation
+itself.
+
+Third, wrapping a function call around access to member data allows such
+access and update operations to be protected in a multithreaded
+environment. While the CFE itself is not multithreaded and the access
+operations as currently defined do no special work to protect against
+mutliple conflicting access operations, this may be changed in a future
+version. Moving the CFE to a multithreaded environment without protecting
+access to member data in this manner would be extremely difficult.
+
+The protocol defined in the CFE is that member data fields are all private
+and have names which start with the prefix "pd_" (denoting Private Data).
+The access functions have names which are the same as the name of the field
+sans the prefix. For example, AST_Decl has a field pd_defined_in and an
+access function defined_in().
+
+The update functions have names starting with "set_" followed by the name
+of the corresponding access function. Thus, AST_Decl defines a function
+set_in_main_file(boolean) which sets the pd_in_main_file data member's
+value to the boolean provided.
+
+GENERATION OF THE AST
+---------------------
+
+The CFE generates the abstract syntax tree after parsing IDL
+input. The nodes of the AST are defined by classes introduced in the
+previous section, or by subclasses thereof as defined by each BE. In
+writing the CFE, we were faced with the following problem: how to generate
+the AST containing nodes of the derived classes as defined in each BE
+without knowledge of the types and conventions of these BE classes.
+
+One alternative was to define a naming scheme which predetermines the names
+of each subclass a BE can define. The AST would then be generated by
+calling an appropriate constructor on the BE derived class. This scheme
+suffers from some shortcomings:
+
+- It breaks the modularity of the compiler and imports knowledge about
+ types defined in a BE into the CFE, where this information does not belong.
+- It restricts a compiler to having only one BE loaded at a time because the
+ names of these classes can be in use in only one BE at a time.
+- It requires a BE to provide derived classes for all AST classes, even for
+ those classes where the BE adds no functionality.
+
+The mechanism we chose is different. We define the AST_Generator class
+which has an operation for each constructor defined on each AST class. The
+operation takes arguments appropriate to the constructor, invokes it and
+returns the created AST node, using the type known to the CFE. All such
+operations on the generator are declared virtual. The names of all
+operations start with "create_" and contain the name of the construct.
+Thus, an operation which invokes a constructor of an AST_Module is named
+create_module. AST_Generator is defined in include/ast_generator.hh and
+implemented in ast/ast_generator.cc.
+
+If a BE derives from any AST class, it must also derive from the
+AST_Generator class and redefine the relevant operations to invoke
+constructors of the BE provided class instead of the AST provided class.
+For example, if BE_Module is a subclass of AST_Module in a BE, the BE would
+also define BE_Generator and redefine create_module to call the constructor
+of BE_Module instead of that provided by AST_Module.
+
+During initialization, the CFE causes an instance of the BE derived
+generator to be created and saved. This is explained in the section on
+REQUIRED ENTRY POINTS SUPPLIED BY A BE. During parsing, actions in the Yacc
+grammar invoke operations on the saved instance to create new nodes for the
+AST as it is being built. These operations invoke constructors for BE
+derived classes or for AST provided classes if they were not overridden.
+
+DEFINITION SCOPES
+-----------------
+
+IDL is a nested scoped language. The scoping rules are defined by the CORBA
+spec and closely follow those of C++.
+
+Scope management is implemented in two classes provided in the utilities
+library, UTL_Scope and UTL_Stack. UTL_Scope manages associations between
+names and AST nodes, and UTL_Stack manages scope nesting and entry and exit
+from definition scopes as the parse is proceeding. UTL_Scope is defined in
+include/utl_scope.hh and implemented in util/utl_scope.cc. UTL_Stack is
+defined in include/utl_stack.hh and implemented in util/utl_stack.cc.
+
+During initialization, the CFE creates an instance of UTL_Stack and saves
+it. During parsing, as definition scopes are entered and exited, AST nodes
+are pushed onto, or popped from, the stack represented by the saved
+instances. Nodes on the stack are stored as instances of UTL_Scope. Section
+THE NARROWING MECHANISM explains how to obtain the real type of a node
+retrieved from the stack.
+
+All definition scopes are linked in a tree rooted in the distinguished AST
+root node. This linkage is implemented by UTL_Scope and AST_Decl. The
+linkage is a permanent record of the scope nesting while the stack is a
+dynamic record which at each instant represents the current state of the
+parse.
+
+The nesting information is used to do name lookup. IDL uses scoped names
+which are concatenations of definition scope names ending with individual
+construct names. For example, in
+
+ interface a {
+ struct b {
+ long c;
+ };
+ const long k = 23;
+ struct s {
+ long ar[k];
+ };
+ };
+
+the name a::b::c represents the long field in the struct b inside the
+interface a.
+
+Lookup is performed by searching down the linkage chain for the first component
+of the name, then, when found, recursively resolving the remaining
+components in the scope defined by the first component. Lookup is relative
+to the scope of use; in the above example, k could also have been referred to
+as a::k within the struct s.
+
+Nodes are stored in a definition scope as instances of AST_Decl. Thus, name
+lookup returns instances of AST_Decl. The next section, THE NARROWING
+MECHANISM, explains how to obtain the real type of a node retrieved from a
+definition scope.
+
+THE NARROWING MECHANISM
+-----------------------
+
+Here we give only a cursory explanation of how narrowing works. We
+concentrate on defining the problem and showing how to use our narrowing
+mechanism. The narrowing mechanism is defined in include/idl_narrow.hh.
+
+As explained above, nodes are stored on the scope stack as instances of
+UTL_Scope, and inside definition scopes as instances of AST_Decl. Also,
+nodes are linked in a nesting tree as instances of AST_Decl. Given a node
+retrieved from the stack or a definition scope, one is faced with the task
+of obtaining its real class. C++ does not currently provide an implicit
+mechanism for narrowing to a derived class, so the CFE defines its own
+mechanism. This mechanism requires some work on your part as BE implementor
+and requires some explicit code to be written when it is to be used.
+
+The class AST_Decl defines an enum whose members encode specific AST node
+classes. AST_Decl provides an accessor function, node_type(), which
+retrieves a member of the enum representing the AST type of the node. Thus,
+if an instance of AST_Decl really is an instance of AST_Module, the
+node_type() accessor returns AST_Decl::NT_module.
+
+The class UTL_Scope also provides an accessor function, scope_node_type(),
+which returns a member of the enum encoding the actual type of the node.
+Thus, given an UTL_Scope instance which is really an instance of
+AST_Operation, scope_node_type() would return AST_Decl::NT_op.
+
+Perusing the header files for classes provided by the AST, you will note
+the use of some macros defined in include/idl_narrow.hh. These macros
+define the explicit narrowing mechanism:
+
+DEF_NARROW_METHODSx(<class name>,<parent_x>) for x equal to 0,1,2 or 3,
+defines a narrowing method for the specified class which has 0,1,2 or 3
+immediate base classes from which it inherits. For example, ast_module.hh
+which defines AST_Module contains the following line:
+
+ DEF_NARROW_METHODS2(AST_Module, AST_Decl, UTL_Scope)
+
+This is because AST_Module inherits directly from AST_Decl and UTL_Scope.
+
+DEF_NARROW_FROM_DECL(<class name>) appears in class definitions for classes
+which are derived from AST_Decl and which can be stored in a definition
+scope. This macro declares a static operation narrow_from_decl(AST_Decl *)
+on the class in which it appears. The operation returns the provided
+instance as an instance of <class name> if it can be narrowed, or NULL.
+
+DEF_NARROW_FROM_SCOPE(<class name>) appears in class definitions of classes
+which are derived from UTL_Scope and which can be stored on the scope
+stack. This macro declares a static operation narrow_from_scope(UTL_Scope *)
+on the class in which it appears. The operation returns the provided
+instance as an instance of <class name> if it can be narrowed, or NULL.
+
+Now look in the files implementing these classes. You will note occurrences
+of the following macros:
+
+IMPL_NARROW_METHODSx(<class name>,<parent_x>) for x equal to 0,1,2 or 3,
+implements a narrowing method for the specified class which has 0,1,2 or 3
+immediate base classes from which it inherits. For example, ast_module.cc
+which implements AST_Module contains the following line:
+
+ IMPL_NARROW_METHODS2(AST_Module, AST_Decl, UTL_Scope)
+
+IMPL_NARROW_FROM_DECL(<class name>) implements a method to narrow from an
+instance of AST_Decl to an instance of <class name> as defined above.
+
+IMPL_NARROW_FROM_SCOPE(<class name>) implements a method to narrow from an
+instance of UTL_Scope to an instance of <class name> as defined above.
+
+To put it all together: In the file ast_module.hh, you will find:
+
+ // Narrowing
+ DEF_NARROW_METHODS2(AST_Module, AST_Decl, UTL_Scope);
+ DEF_NARROW_FROM_DECL(AST_Module);
+ DEF_NARROW_FROM_SCOPE(AST_Module);
+
+In the file ast_module.cc, you will see:
+
+/*
+ * Narrowing methods
+ */
+IMPL_NARROW_METHODS2(AST_Module, AST_Decl, UTL_Scope)
+IMPL_NARROW_FROM_DECL(AST_Module)
+IMPL_NARROW_FROM_SCOPE(AST_Module)
+
+The CFE uses narrowing internally to obtain the correct type of nodes in
+the AST. The CFE contains many code fragments such as the following:
+
+ AST_Decl *d = get_an_AST_Decl_from_somewhere();
+ AST_Module *m;
+ ...
+ if (d->node_type() == AST_Decl::NT_module) {
+ m = AST_Module::narrow(d);
+ if (m == NULL) { // Narrow failed
+ ...
+ } else { // Success, do normal processing
+ ...
+ }
+ }
+ ...
+
+Similar code implements narrowing instances of UTL_Scope to their actual
+types.
+
+In your BE classes which derive from UTL_Scope you must include a line
+defining how to narrow from a scope, so:
+
+ DEF_NARROW_FROM_SCOPE(<your BE class>)
+
+and similarly for your BE classes which derive from AST_Decl.
+
+The narrowing mechanism is defined only for narrowing from AST_Decl and
+UTL_Scope. If your BE class inherits directly from one or more classes
+which themselves are derived from AST_Decl and/or UTL_Scope, you must
+include a line
+
+ DEF_NARROW_METHODSx(<your class name>,<parent 1>,<parent 2>)
+
+To make this concrete, here is what you'd write in a definition of BE_union
+which inherits from AST_Union:
+
+ DEF_NARROW_METHODS1(BE_Union, AST_Union);
+ DEF_NARROW_FROM_DECL(BE_Union);
+ DEF_NARROW_FROM_SCOPE(BE_Union);
+
+and in the implementation file of BE_Union:
+
+/*
+ * Narrowing methods:
+ */
+IMPL_NARROW_METHODS1(BE_Union, AST_Union)
+IMPL_NARROW_FROM_DECL(BE_Union)
+IMPL_NARROW_FROM_SCOPE(BE_Union)
+
+Then, in BE code which expects to see an instance of your derived BE_Union
+class, you will write:
+
+ AST_Decl *d = get_an_AST_Decl_from_somewhere();
+ BE_Union *u;
+ ...
+ if (d->node_type() == AST_Decl::NT_union) {
+ u = BE_Union::narrow_from_decl(d);
+ if (u == NULL) { // Narrow failed
+ ...
+ } else { // Success, do normal processing
+ ...
+ }
+ }
+ ...
+
+
+SCOPE MANAGEMENT
+----------------
+
+Instances of classes which are derived from UTL_Scope implement definition
+scopes. A definition scope can contain any kind of AST node as long as it
+is derived from AST_Decl. However, specific kinds of definition scopes such
+as interfaces and unions can contain only a restricted subset of all AST
+node types.
+
+UTL_Scope provides operations to add instances of each AST provided class
+to a definition scope. The names of these operations are constructed by
+prepending the string "add_" to the name of the IDL construct. So, to add
+an interface to a definition scope, invoke the operation add_interface.
+The operations are all defined virtual and are intended to be overridden in
+classes derived from UTL_Scope.
+
+If the node was successfully added to the definition scope, the node is
+returned as the result. Otherwise the node is not added to the definition
+scope and NULL is returned.
+
+All add operation implementations in UTL_Scope return NULL. Thus,
+only the operations which implement legal additions to a specific kind of
+definition scope must be overridden in the implementation of that
+definition scope. For example, in AST_Module the add_interface operation is
+overridden to add the provided instance of AST_Interface to the scope and
+to return the provided instance if the addition was successful. Operations
+which were not overridden return NULL to indicate that the addition is
+illegal in this context. For example, in AST_Operation the definition of
+add_interface is not overridden since it is illegal to store an interface
+inside an operation definition scope.
+
+The add operations are invoked in the actions in the Yacc grammar. The
+following fragment is a representative example of code using the add
+operations:
+
+ AST_Constant *d = construct_a_new_constant();
+ ...
+ if (current_scope->add_constant(d) == NULL) { // Failed
+ ...
+ } else { // Succeeded
+ ...
+ }
+
+BE INTERACTION DURING THE PARSING PROCESS
+-----------------------------------------
+
+The add operations can be overridden in BE derived classes to let the BE
+perform additional house-keeping work during the process of constructing
+the AST. For example, a BE could keep separate lists of interfaces as they
+are being added to a module.
+
+If you override an add operation in your BE, you must invoke the overridden
+operation in the superclass of your derived class to allow the CFE to
+perform its own house-keeping tasks. A good rule is to invoke the operation
+on the superclass before you do your own processing; then, if the
+superclass operation returns NULL, this indicates that the addition failed
+and your own code should immediately return NULL. An example explains this:
+
+AST_Interface *
+BE_Module::add_interface(AST_Interface *i)
+{
+ if (AST_Module::add_interface(i) == NULL) // Failed, bail out!
+ return NULL;
+ ... // Do your own work here
+ return i; // Return success indication
+}
+
+We strongly advise you to only define add operations that override add
+operations provided by the AST classes. Add operations which
+do not override equivalent operations in the AST in effect
+extend the semantics of the language accepted by the compiler. For
+example, the CFE does not have an add_interface operation on
+AST_Operation. If you were to define one in your BE_Operation class,
+the resulting compiler would allow an interface to be
+stored in an operation definition scope. The current CORBA specification
+does not allow this.
+
+AST INHERITANCE SCHEME
+----------------------
+
+The AST classes all use public virtual inheritance to construct the
+inheritance tree. This ensures that a class may appear several times in the
+inheritance tree through different paths and the derived class's instances
+will have only one copy of the inherited class's data.
+
+The use of public virtual inheritance has several important effects on how
+a BE is constructed. We explain those effects below.
+
+First, you must define a default constructor for your BE class, since
+your class may be used as a virtual base class of some other class. In this
+case the compiler may want to call a default constructor for your class. It
+is a good idea to have a default constructor anyway, even if you do not
+plan to subclass your BE class, since for most C++ compilers this causes
+the code to be smaller. Your default constructor should initialize all
+constant data members. Additionally, it may initialize any non-constant
+data member whose value must be set before the first time the instance is
+used.
+
+Second, the constructor of your BE derived class must explicitly call all
+constructors of virtual base classes which perform useful work. For
+example, if a class in the AST from which your BE class inherits has an
+initializer for a data member, you must call that constructor. This rule is
+discussed in detail in the C++ ARM. An example may help here.
+
+Suppose you define a class BE_attribute which inherits from AST_Attribute.
+Its constructor should be as follows:
+
+ BE_Attribute::BE_Attribute(boolean ro,
+ AST_Type *ft,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Attribute(ro, ft, n, p),
+ AST_Field(ft, n, p),
+ AST_Decl(AST_Decl::NT_attr, n, p)
+ {
+ }
+
+The calls to the constructors of AST_Attribute, AST_Field and AST_Decl are
+needed because these constructors do useful initializations on their
+classes.
+
+Note that there is some redundancy in the data passed to these
+constructors. We chose to preserve this redundancy since it should be
+possible to create BEs which subclass only some of the classes supplied by
+the AST. This means that the constructors on each class provided by the AST
+should take arguments which are sufficient to construct the instance if
+the AST class is the most derived one.
+
+The code supplied with this release contains a demonstration BE which
+subclasses all the AST provided classes. The constructors for each class
+provided by the BE are found in the file be/be_classes.cc.
+
+INITIALIZATION
+--------------
+
+The following steps take place at initialization:
+
+- The global data instance is created, stored in idl_global and filled with
+ default values (in driver/drv_init.cc).
+- The command line arguments are parsed (in driver/drv_args.cc).
+- For each IDL input file, a copy of the compiler process is forked (in
+ driver/drv_fork.cc).
+- The IDL input is preprocessed (in driver/drv_preproc.cc).
+- FE initialization stage 1 is done: the scopes stack is created and stored
+ in the global data variable idl_global->scopes() field (in fe/fe_init.cc).
+- BE_init is called to create the generator instance and the returned
+ instance is stored in the global data variable idl_global->gen() field.
+- FE initialization stage 2 is done: the global scope is created, pushed on
+ the scopes stack and populated with predefined types (in fe/fe_init.cc).
+
+GLOBAL STATE AND ENTRY POINTS
+-----------------------------
+
+The CFE has one global variable named idl_global, which stores an instance
+of a class IDL_GlobalData as explained below:
+
+The CFE defines a class IDL_GlobalData which defines the global
+information used in a specific run of the compiler. IDL_GlobalData is
+defined in include/idl_global.hh and implemented in the file
+util/utl_global.cc.
+
+Initialization creates an instance of this class and stores it in the value
+of the global variable idl_global. Thus, the individual pieces of
+information stored in the instance are accessible everywhere.
+
+ERROR HANDLING
+--------------
+
+All error handling is defined by a class provided by the CFE, UTL_Error.
+This class is defined in include/utl_error.hh and implemented in the file
+util/utl_error.cc. The class provides several methods for reporting
+specific errors as well as generic error reporting methods taking zero to
+three arguments.
+
+The CFE instantiates the class and stores the instance as part of the
+global state, accessible as idl_global->err(). Thus, to cause an error
+report, you would write code similar to the following:
+
+ if (error condition found)
+ idl_global->err()->specific_error_message(arg1, ..);
+
+or
+
+ if (error condition found)
+ idl_global->err()->generic_error_message(flag, arg1, ..);
+
+The flag argument is one of the predefined error conditions found in the
+enum at the head of the UTL_Error class definition. The arguments to the
+specific error message routine are defined by the signature of that
+routine. The arguments to a generic error message routine are always
+instances of AST_Decl.
+
+The running count of errors is accessible as idl_global->err_count(). If
+the value returned by this operation is non-zero after the IDL input has
+been parsed, the BE is not invoked.
+
+HANDLING OF COMMAND LINE ARGUMENTS
+----------------------------------
+
+Defined command line arguments are specified in the document CLI, in this
+directory. The CFE calls the required BE API entry point BE_prep_arg to
+process arguments passed within a -Wb flag.
+
+REQUIRED ENTRY POINTS SUPPLIED BY A BE
+--------------------------------------
+
+The following API entry points must be supplied by a BE in order to
+successfully link with the CFE:
+
+extern "C" AST_Generator *BE_init();
+
+ Creates an instance of the generator object and returns it. Note
+ that the global scope is not yet set up and the scopes stack is
+ empty when this routine is called.
+
+extern "C" void BE_produce();
+
+ Called by the compiler main program after the IDL input has been
+ successfully parsed and processed. The job of this routine is to
+ carry out the specific function of the BE. The AST is accessible as
+ the value of idl_global->root().
+
+extern "C" void BE_prep_arg(char *, idl_bool);
+
+ Called to process an argument passed in with a -Wb flag. The boolean
+ will always be FALSE.
+
+extern "C" void BE_abort();
+
+ Called when the CFE decides to abort the compilation. Can be used in
+ a BE to clean up after itself, e.g. remove temporary files or
+ directories it created while the parse was in progress.
+
+extern "C" void BE_version();
+
+ Called when a -V argument is processed. This should produce a
+ message for the user identifying the BE that is loaded and its
+ version information.
+
+PART II. WRITING A BACK END
+-=========================-
+
+REQUIRED API THAT EACH BE MUST SUPPORT
+--------------------------------------
+
+Below are the API entry points that each BE must supply in order to use the
+CFE framework. This is a repeat of the BE API section:
+
+extern "C" AST_Generator *BE_init();
+
+ Creates an instance of the generator object and returns it. Note
+ that the scopes stack is still not set up at the time this routine
+ is called.
+
+extern "C" void BE_produce();
+
+ Called by the compiler main program after the IDL input has been
+ successfully parsed and processed. The job of this routine is to
+ carry out the specific function of the BE. The AST is accessible as
+ the value of idl_global->root().
+
+extern "C" void BE_prep_arg(char *, boolean);
+
+ Called to process an argument passed in with a -Wb flag. The boolean
+ will always be FALSE.
+
+extern "C" void BE_abort();
+
+ Called when the CFE decides to abort the compilation. Can be used in
+ a BE to clean up after itself, e.g. remove temporary files or
+ directories it created while the parse was in progress.
+
+extern "C" void BE_version();
+
+ Called when a -V argument is processed. This should produce a
+ message for the user identifying the BE that is loaded and its
+ version information.
+
+WHAT FILES TO INCLUDE
+---------------------
+
+To use the CFE, each implementation file of your BE must include the
+following two header files:
+
+#include <idl.hh>
+#include <idl_extern.hh>
+
+Following this, you can include any header files needed by your BE.
+
+HOW TO SUBCLASS THE AST
+-----------------------
+
+Your BE may subclass from any of the classes provided by the AST. Your
+class should use public virtual inheritance to ensure that only one copy of
+the class's data members is present in each instance. Read the section on
+HOW TO WRITE CONSTRUCTORS to learn about additional considerations that you
+must take into account when writing constructors for your BE classes.
+
+HOW TO SUBCLASS THE GENERATOR TO CREATE BE ENHANCED AST NODES
+-------------------------------------------------------------
+
+Your BE subclasses from classes provided by the AST. To ensure that
+instances of these classes are constructed when the AST is built, you must
+also subclass AST_Generator and return an instance of your subclass from
+the call to BE_init.
+
+The AST_Generator class provides operations to create instances of all
+classes defined in the AST. For example, the operation to create an
+AST_Attribute node is as follows:
+
+ AST_Attribute *
+ AST_Generator::create_attribute(...)
+ {
+ return new AST_Attribute(...);
+ }
+
+In your BE_Generator subclass of AST_Generator, you will override methods
+for creation of nodes of all AST classes which you have subclassed. Thus,
+if your BE has a class BE_Attribute which is a subclass of AST_Attribute,
+your BE_Generator class definition has to override the create_attribute
+method to ensure that instances of BE_Attribute are created.
+
+The definition of the overriden operations should call the constructor of
+the derived class and return the new node as an instance of the inherited
+class. Thus, the implementation of create_attribute is as follows:
+
+ AST_Attribute *
+ BE_Generator::create_attribute(...)
+ {
+ return new BE_Attribute(...);
+ }
+
+The Yacc grammar actions call create_xxx operations on the generator
+instance stored in the global variable idl_global->gen() field. By storing
+an instance of your derived generator class BE_Generator you ensure that
+instances of the BE classes you defined will be created.
+
+HOW TO WRITE CONSTRUCTORS FOR BE CLASSES
+----------------------------------------
+
+As mentioned above, the AST uses public virtual inheritance to derive the
+AST class hierarchy. This has two important effects on how you write a BE,
+specifically how you write constructors for derived BE classes.
+
+First, you must define a default constructor for your BE class, since
+your class may be used as a virtual base class of some other class. In that
+case the compiler may want to call a default constructor for your class. It
+is a good idea to have a default constructor anyway, even if you do not
+plan to subclass your BE class, since for most C++ compilers this causes
+the code to be smaller. Your default constructor should initialize all
+constant data members. Additionally, it may initialize any non-constant
+data member whose value must be set before the first time the instance is
+used.
+
+Second, the constructor for your BE class must explicitly call all
+constructors of virtual base classes which do some useful work. For
+example, if a class in the AST from which your BE class inherits, directly
+or indirectly, has an initializer for a data member, your BE class's
+constructor must call the AST class's constructor. This is discussed
+extensively in the C++ ARM.
+
+Below is a list showing how to write constructors for subclasses of each
+class provided by the BE. For each AST class we show a definition of a
+constructor for a derived class which calls all neccessary constructors on
+AST classes:
+
+AST_Argument:
+
+ BE_Argument::BE_Argument(AST_Argument::Direction d,
+ AST_Type *ft,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Argument(d, ft, n, p),
+ AST_Field(AST_Decl::NT_argument, ft, n, p),
+ AST_Decl(AST_Decl::NT_argument, n, p)
+ {
+ }
+
+AST_Array:
+
+ BE_Array::BE_Array(UTL_ScopedName *n,
+ unsigned long nd,
+ UTL_ExprList *ds)
+ : AST_Array(n, nd, ds),
+ AST_Decl(AST_Decl::NT_array, n, NULL)
+
+ {
+ }
+
+AST_Attribute:
+
+ BE_Attribute::BE_Attribute(boolean ro,
+ AST_Type *ft,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Attribute(ro, ft, n, p),
+ AST_Field(AST_Decl::NT_attr, ft, n, p),
+ AST_Decl(AST_Decl::NT_attr, n, p)
+ {
+ }
+
+AST_ConcreteType:
+
+ BE_ConcreteType::BE_ConcreteType(AST_Decl::NodeType nt,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Decl(nt, n, p)
+ {
+ }
+
+AST_Constant:
+
+ BE_Constant::BE_Constant(AST_Expression::ExprType t,
+ AST_Expression *v,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Constant(t, v, n, p),
+ AST_Decl(AST_Decl::NT_const, n, p)
+ {
+ }
+
+AST_Decl:
+
+ BE_Decl::BE_Decl(AST_Decl::NodeType nt,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Decl(nt, n, p)
+ {
+ }
+
+AST_Enum:
+
+ BE_Enum::BE_Enum(UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Enum(n, p),
+ AST_Decl(AST_Decl::NT_enum, n, p),
+ UTL_Scope(AST_Decl::NT_enum)
+ {
+ }
+
+AST_EnumVal:
+
+ BE_EnumVal::BE_EnumVal(unsigned long v,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_EnumVal(v, n, p),
+ AST_Constant(AST_Expression::EV_ulong,
+ AST_Decl::NT_enum_val,
+ new AST_Expression(v),
+ n,
+ p),
+ AST_Decl(AST_Decl::NT_enum_val, n, p)
+ {
+ }
+
+AST_Exception:
+
+ BE_Exception::BE_Exception(UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Decl(AST_Decl::NT_except, n, p),
+ AST_Structure(AST_Decl::NT_except, n, p),
+ UTL_Scope(AST_Decl::NT_except)
+ {
+ }
+
+AST_Field:
+
+ BE_Field::BE_Field(AST_Type *ft,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Field(ft, n, p),
+ AST_Decl(AST_Decl::NT_field, n, p)
+ {
+ }
+
+AST_Interface:
+
+ BE_Interface::BE_Interface(UTL_ScopedName *n,
+ AST_Interface **ih,
+ long nih,
+ UTL_StrList *p)
+ : AST_Interface(n, ih, nih, p),
+ AST_Decl(AST_Decl::NT_interface, n, p),
+ UTL_Scope(AST_Decl::NT_interface)
+ {
+ }
+
+AST_InterfaceFwd:
+
+ BE_InterfaceFwd::BE_InterfaceFwd(UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_InterfaceFwd(n, p),
+ AST_Decl(AST_Decl::NT_interface_fwd, n, p)
+ {
+ }
+
+AST_Module:
+
+ BE_Module::BE_Module(UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Decl(AST_Decl::NT_module, n, p),
+ UTL_Scope(AST_Decl::NT_module)
+ {
+ }
+
+AST_Operation:
+
+ BE_Operation::BE_Operation(AST_Type *rt,
+ AST_Operation::Flags fl,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Operation(rt, fl, n, p),
+ AST_Decl(AST_Decl::NT_op, n, p),
+ UTL_Scope(AST_Decl::NT_op)
+ {
+ }
+
+AST_PredefinedType:
+
+ BE_PredefinedType::BE_PredefinedType(
+ AST_PredefinedType::PredefinedType *pt,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_PredefinedType(pt, n, p),
+ AST_Decl(AST_Decl::NT_pre_defined, n, p)
+ {
+ }
+
+AST_Root:
+
+ BE_Root::BE_Root(UTL_ScopedName *n, UTL_StrList *p)
+ : AST_Module(n, p),
+ AST_Decl(AST_Decl::NT_module, n, p),
+ UTL_Scope(AST_Decl::NT_module)
+ {
+ }
+
+
+AST_Sequence:
+
+ BE_Sequence::BE_Sequence(AST_Expression *ms, AST_Type *bt)
+ : AST_Sequence(ms, bt),
+ AST_Decl(AST_Decl::NT_sequence,
+ new UTL_ScopedName(new String("sequence"), NULL),
+ NULL)
+ {
+ }
+
+AST_String:
+
+ BE_String::BE_String(AST_Expression *ms)
+ : AST_String(ms),
+ AST_Decl(AST_Decl::NT_string,
+ new UTL_ScopedName(new String("string"), NULL),
+ NULL)
+ {
+ }
+
+AST_Structure:
+
+ BE_Structure::BE_Structure(UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Decl(AST_Decl::NT_struct, n, p),
+ UTL_Scope(AST_Decl::NT_struct)
+ {
+ }
+
+AST_Type:
+
+ BE_Type::BE_Type(AST_Decl::NodeType nt,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Decl(nt, n, p)
+ {
+ }
+
+AST_Typedef:
+
+ BE_Typedef::BE_Typedef(AST_Type *bt,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Typedef(bt, n, p),
+ AST_Decl(AST_Decl::NT_typedef, n, p)
+ {
+ }
+
+AST_Union:
+
+ BE_Union::BE_Union(AST_ConcreteType *dt,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Union(dt, n, p),
+ AST_Structure(AST_Decl::NT_union, n, p),
+ AST_Decl(AST_Decl::NT_union, n, p),
+ UTL_Scope(AST_Decl::NT_union)
+ {
+ }
+
+AST_UnionBranch:
+
+ BE_UnionBranch::BE_UnionBranch(AST_UnionLabel *fl,
+ AST_Type *ft,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_UnionBranch(fl, ft, n, p),
+ AST_Field(ft, n, p),
+ AST_Decl(AST_Decl::NT_union_branch, n, p)
+ {
+ }
+
+AST_UnionLabel:
+
+ BE_UnionLabel::BE_UnionLabel(AST_UnionLabel::UnionLabel lk,
+ AST_Expression *lv)
+ : AST_UnionLabel(lk, lv)
+ {
+ }
+
+HOW TO USE THE ADD PROTOCOL
+---------------------------
+
+As explained the section SCOPE MANAGEMENT, the CFE manages scopes by
+calling type-specific functions to add new nodes to the scope to be
+augmented. These functions can be overridden in your BE classes to do work
+specific to your BE class. For example, in a BE_module class, you might
+override add_interface to do additional work.
+
+The protocol defined by the "add_" functions is that they return NULL to
+indicate failure. They return the node that was added (and which was given
+as an argument) if the operation succeeded. Your functions in your BE class
+should follow the same protocol.
+
+The "add_" functions defined in the BE must call the overridden function in
+the base class defind in the CFE in order for the CFE scope management
+mechanism to work. Otherwise, the CFE does not get an opportunity to
+augment its scopes with the new node to be added. It is good practice to
+call the overridden "add_" function as the first action in your BE
+function, because the success or failure of the CFE operation indicates
+whether your function should complete its task or abort early.
+
+Here is an example. Suppose you have defined a class BE_module which
+inherits from AST_Module. You may wish to override the add_interface
+function as follows:
+
+ class BE_Module : public virtual AST_Module
+ {
+ ....
+ /*
+ * ADD protocol
+ */
+ virtual AST_Interface *add_interface(AST_Interface *);
+ ...
+ };
+
+The implementation of this function would look something like the following:
+
+ AST_Interface *
+ BE_Module::add_interface(AST_Interface *new_in)
+ {
+ /*
+ * Check that the CFE operation succeeds. If it returns
+ * NULL, stop any further work
+ */
+ if (AST_Module::add_interface(new_in) == NULL)
+ return NULL;
+ /*
+ * OK, non-NULL, this means the BE can do its own work here
+ */
+ ...
+ /*
+ * Finally, don't forget to return the argument to indicate
+ * success
+ */
+ return new_in;
+ }
+
+HOW TO MAINTAIN BE SPECIFIC INFORMATION
+---------------------------------------
+
+The CFE provides a special class AST_Root, a subclass of AST_Module. An
+instance of the AST_Root class is used as the distinguished root of the
+abstract syntax tree built during a parse.
+
+Your BE can subclass BE_Root from AST_Root and override the create_root
+operation in your BE_Generator class derived from AST_Generator. This will
+cause the CFE to create an instance of your BE_Root class as the root of
+the tree being constructed.
+
+You can use the instance of the BE_Root class as a convenient place to
+store information specific to an individual tree. For example, you could
+add operations on the BE_Root class to count how many nodes of each class
+are created.
+
+HOW TO USE MEMBER DATA
+----------------------
+
+As explained above, the AST classes provide access and update functions for
+manipulating data members. Your BE classes must use these functions when
+they require access to data members defined in the AST classes, since the
+data members themselves are private.
+
+It is good practice to follow the same scheme in your BE classes. Make all
+data members private. Prepend the names of all such fields with "pd_".
+Define access functions with names equal to the name of the field without the
+prefix. Define update functions according to need by prepending the name of
+the access function with the prefix "set_".
+
+Using these techniques will allow your BE to enjoy the same benefits that
+are imparted onto the CFE. Your BE will be easier to move to a
+multithreaded environment and its data members will be better protected and
+hidden.
+
+HOW TO BUILD A COMPLETE COMPILER
+--------------------------------
+
+We now have all information needed to write a BE and to link it in with the
+CFE, to produce a complete IDL compiler.
+
+The following assumes that your BE will be stored in the "be" directory
+under the "release" directory. See the document ROADMAP for an explanation
+of the directory structure of the source release. If you decide to use a
+different directory to store your BE, you may have to modify the CPP_FLAGS in
+"idl_make_vars" in the top-level directory to allow your BE to find the
+include files it needs. You will also need to modify several targets in
+the Makefile in the top-level directory to correctly compile your BE into a
+library and to correctly link it in with the CFE to produce a complete
+compiler.
+
+You can get started quickly on writing your BE by modifying the sources
+found in the "demo_be" directory. The Makefile supports all the the targets
+that are needed to build a complete system and the maintenance target
+"clean" which assists in keeping the files and directories tidy. The files
+provided in the "demo_be" directory also provide all the API entry points
+that are mandated by this document.
+
+To build a complete compiler, invoke "make" or "make all" in the top-level
+directory. This will compile your BE and all the CFE sources, if this is
+the first invocation. On subsequent invocations this will recompile only
+the modified files. You will rarely if at all modify the CFE sources, so
+the overhead of compiling the CFE is incurred only the first time. To build
+just your BE, you can invoke "make all" or "make" in the "demo_be"
+directory. You can also, from the top-level directory, invoke "make
+demo_be/libbe.a".
+
+HOW TO OBTAIN ASSISTANCE
+------------------------
+
+First, read all the documents provided. If you have unanswered questions,
+mail them to
+
+ idl-cfe@sun.com
+
+Sun does not promise to support the IDL CFE source release in any manner.
+However, we will attempt to answer questions and correct problems as time
+allows.
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+COPYRIGHT NOTICE
+----------------
+
+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
diff --git a/TAO/TAO_IDL/driver/drv_args.cpp b/TAO/TAO_IDL/driver/drv_args.cpp
new file mode 100644
index 00000000000..fd584c8d756
--- /dev/null
+++ b/TAO/TAO_IDL/driver/drv_args.cpp
@@ -0,0 +1,584 @@
+// $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.
+
+*/
+
+// drv_args.cpp - Argument parsing for IDL compiler main driver
+
+#include "idl_defines.h"
+#include "global_extern.h"
+#include "drv_extern.h"
+#include "fe_extern.h"
+#include "be_global.h"
+#include "be_extern.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_unistd.h"
+#include "ace/os_include/os_ctype.h"
+
+ACE_RCSID (driver,
+ drv_args,
+ "$Id$")
+
+extern long DRV_nfiles;
+extern char *DRV_files[];
+
+// Push a file into the list of files to be processed
+void
+DRV_push_file (const char *s)
+{
+ // If filenames come from the command line, there is no
+ // need to duplicate the string, but some backends have
+ // an option to recurse over a directory and add all
+ // IDL files found. In this latter case we have to
+ // duplicate the file name string.
+ DRV_files[DRV_nfiles++] = ACE::strnew (s);
+}
+
+// Prepare a CPP argument
+static void
+DRV_prep_cpp_arg (char *s)
+{
+ char *newarg = 0;
+ ACE_NEW (newarg,
+ char[512]);
+ char *farg;
+
+ newarg[0] = '\0';
+
+ for (farg = ACE_OS::strtok (s, ",");
+ farg != 0;
+ farg = ACE_OS::strtok (0, ","))
+ {
+ ACE_OS::strcat (newarg,
+ farg);
+ }
+
+ DRV_cpp_putarg (newarg);
+}
+
+// Print a usage message and exit.
+void
+DRV_usage (void)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%s%s%s%s"),
+ idl_global->prog_name (),
+ ACE_TEXT (": usage: "),
+ idl_global->prog_name (),
+ ACE_TEXT (" [flag | file]*\n")));
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Legal flags:\n")));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -A...\t\t\tlocal implementation-specific escape\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Cw\t\t\tWarning if identifier spellings differ ")
+ ACE_TEXT ("only in case (default is error)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Ce\t\t\tError if identifier spellings differ ")
+ ACE_TEXT ("only in case (default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -d\t\t\tOutputs (to stdout) a dump of the AST\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Dname[=value]\t\tdefines name for preprocessor\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -E\t\t\truns preprocessor only, prints on stdout\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Idir\t\t\tincludes dir in search path for preprocessor\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -t\t\t\tTemporary directory to be used")
+ ACE_TEXT (" by the IDL compiler.\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -u\t\t\tprints usage message and exits\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Uname\t\t\tundefines name for preprocessor\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -v\t\t\ttraces compilation stages\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -V\t\t\tprints version info then exits\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -w\t\t\tsuppresses IDL compiler warning messages\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Wp,<arg1,...,argn>\t\t\t\tpasses args to preprocessor\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Yp,path\t\tdefines location of preprocessor\n")
+ ));
+
+ be_global->usage ();
+}
+
+// Parse arguments on command line
+void
+DRV_parse_args (long ac, char **av)
+{
+ ACE_CString buffer;
+ char *s = 0;
+ long i;
+ bool has_space = false;
+
+ FE_store_env_include_paths ();
+ DRV_cpp_init ();
+ idl_global->set_prog_name (av[0]);
+
+ for (i = 1; i < ac; i++)
+ {
+ if (av[i][0] == '-')
+ {
+ idl_global->append_idl_flag (av[i]);
+
+ switch (av[i][1])
+ {
+ case 0:
+ // One or more letters expected after the dash.
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: Space between dash and option ")
+ ACE_TEXT ("letters not allowed\n")
+ ));
+
+ ++i;
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ break;
+ case 'A':
+ if (av[i][2] == '\0')
+ {
+ if (i < ac - 1)
+ {
+ s = av[i + 1];
+ ++i;
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: incorrect use of ")
+ ACE_TEXT ("the -A option\n")
+ ));
+
+ idl_global->set_compile_flags (
+ idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE
+ );
+ break;
+ }
+ }
+ else
+ {
+ s = av[i] + 2;
+ }
+
+ ACE_OS::strcat (idl_global->local_escapes (), s);
+ ACE_OS::strcat (idl_global->local_escapes (), " ");
+ break;
+ // Temp directory for the IDL compiler to keep its files.
+ case 't':
+ if ((av[i][2] == '\0') && (i < ac - 1))
+ {
+ idl_global->append_idl_flag (av[i + 1]);
+ idl_global->temp_dir (av[i + 1]);
+ ++i;
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand")
+ ACE_TEXT (" the '%s' option\n"),
+ av[i]
+ ));
+
+ idl_global->set_compile_flags (
+ idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE
+ );
+ }
+
+ break;
+ case 'D':
+ case 'U':
+ case 'I':
+ if (av[i][2] == '\0')
+ {
+ if (i < ac - 1)
+ {
+ idl_global->append_idl_flag (av[i + 1]);
+ has_space = idl_global->hasspace (av[i + 1]);
+
+ // If the include path has a space, we need to
+ // add literal "s.
+ ACE_CString arg = av[i];
+ arg += (has_space ? "\"" : "");
+ arg += av[i + 1];
+ arg += (has_space ? "\"" : "");
+
+ DRV_cpp_putarg (arg.c_str ());
+ idl_global->add_include_path (arg.substr (2).c_str ());
+ ++i;
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand")
+ ACE_TEXT (" the '%s' option\n"),
+ av[i]
+ ));
+
+ idl_global->set_compile_flags (
+ idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE
+ );
+ break;
+ }
+ }
+ else
+ {
+ has_space = idl_global->hasspace (av[i]);
+
+ // If the include path has a space, we need to
+ // add literal "s.
+ ACE_CString arg (av[i], 2);
+ arg += (has_space ? "\"" : "");
+ arg += av[i] + 2;
+ arg += (has_space? "\"" : "");
+
+ idl_global->add_include_path (arg.substr (2).c_str ());
+ DRV_cpp_putarg (arg.c_str ());
+ }
+
+ break;
+ case 'E':
+ idl_global->set_compile_flags (idl_global->compile_flags () |
+ IDL_CF_ONLY_PREPROC);
+ break;
+ case 'V':
+ idl_global->set_compile_flags (idl_global->compile_flags () |
+ IDL_CF_VERSION);
+ break;
+ case 'W':
+ if (av[i][2] == '\0')
+ {
+ if (i < ac - 1)
+ {
+ s = av[i + 1];
+ ++i;
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand")
+ ACE_TEXT (" the '%s' option\n"),
+ av[i]
+ ));
+
+ idl_global->set_compile_flags (
+ idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE
+ );
+ break;
+ }
+ }
+ else
+ {
+ s = av[i] + 2;
+ }
+
+ switch (*s)
+ {
+ default:
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: Incorrect use of -W option\n")
+ ));
+
+ idl_global->set_compile_flags (
+ idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE
+ );
+ break;
+ case 'p':
+ if (*(s + 1) == ',')
+ {
+ DRV_prep_cpp_arg (s + 2);
+ }
+
+ break;
+ case 'b':
+ if (*(s + 1) == ',')
+ {
+ be_global->prep_be_arg (s + 2);
+ }
+
+ break;
+ }
+
+ break;
+ case 'Y':
+ if (av[i][2] == '\0')
+ {
+ if (i < ac - 1)
+ {
+ s = av[i + 1];
+ ++i;
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand")
+ ACE_TEXT (" the '%s' option\n"),
+ av[i]
+ ));
+
+ idl_global->set_compile_flags (
+ idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE
+ );
+ break;
+ }
+ }
+ else
+ {
+ s = av[i] + 2;
+ }
+
+ switch (*s)
+ {
+ case 'p':
+ if (*(s + 1) == ',')
+ {
+ idl_global->set_cpp_location (s + 2);
+ DRV_cpp_new_location (s + 2);
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand")
+ ACE_TEXT (" the '-Y' option\n")
+ ));
+
+ idl_global->set_compile_flags (
+ idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE
+ );
+ }
+
+ break;
+ default:
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I dont' understand the use of")
+ ACE_TEXT (" %s with the '-Y' option\n"),
+ s
+ ));
+
+ idl_global->set_compile_flags (
+ idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE
+ );
+ break;
+ }
+ break;
+ case 'd':
+ idl_global->set_compile_flags (idl_global->compile_flags ()
+ | IDL_CF_DUMP_AST);
+ break;
+ case 'u':
+ idl_global->set_compile_flags (idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE);
+ break;
+ case 'v':
+ idl_global->set_compile_flags (idl_global->compile_flags ()
+ | IDL_CF_INFORMATIVE);
+ break;
+ case 'w':
+ idl_global->set_compile_flags (idl_global->compile_flags ()
+ | IDL_CF_NOWARNINGS);
+ break;
+ case 'C':
+ // If identifiers in the same scope differ only by case...
+ if (av[i][2] == 'e')
+ {
+ // ...report an error.
+ idl_global->case_diff_error (true);
+ }
+ else if (av[i][2] == 'w')
+ {
+ // ...report a warning (default for now)
+ idl_global->case_diff_error (false);
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
+ av[i]
+ ));
+
+ idl_global->set_compile_flags (
+ idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE
+ );
+ }
+
+ break;
+ default:
+ be_global->parse_args (i, av);
+ break;
+ } // End of switch (av[i][1])
+ } // End of IF (av[i][0] == '-')
+ else
+ {
+ DRV_push_file (av[i]);
+ }
+ } // End of FOR (i = 1; i < ac; i++)
+
+ be_global->arg_post_proc ();
+
+ // Make sure the output directory is valid.
+ if (idl_global->temp_dir () == 0)
+ {
+ char tmpdir[MAXPATHLEN + 1];
+
+ if (ACE::get_temp_dir (tmpdir, MAXPATHLEN) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Temporary path too long, ")
+ ACE_TEXT ("defaulting to current directory\n")));
+
+ ACE_OS::strcpy (tmpdir, ".");
+ }
+
+#if defined(ACE_MVS)
+ if (ACE_OS::access (tmpdir, F_OK) == -1
+ || ACE_OS::access (tmpdir, R_OK) == -1
+ || ACE_OS::access (tmpdir, W_OK) == -1)
+#else
+ if (ACE_OS::access (tmpdir, F_OK | R_OK | W_OK) == -1)
+#endif /* ACE_MVS */
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("%s%s%s\n"),
+ ACE_TEXT ("Can't access temporary directory ("),
+ tmpdir,
+ ACE_TEXT ("), using current directory for temp files.")
+ ));
+
+ ACE_OS::strcpy (tmpdir, ".");
+#if defined(ACE_MVS)
+ if (ACE_OS::access (tmpdir, F_OK) == -1
+ || ACE_OS::access (tmpdir, R_OK) == -1
+ || ACE_OS::access (tmpdir, W_OK) == -1)
+#else
+ if (ACE_OS::access (tmpdir, F_OK | R_OK | W_OK) == -1)
+#endif /* ACE_MVS */
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%s%s\n",
+ ACE_TEXT ("Error: Can't access ")
+ ACE_TEXT ("temporary directory "),
+ tmpdir));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+ }
+
+ idl_global->temp_dir (tmpdir);
+ }
+
+ DRV_cpp_post_init ();
+}
diff --git a/TAO/TAO_IDL/driver/drv_preproc.cpp b/TAO/TAO_IDL/driver/drv_preproc.cpp
new file mode 100644
index 00000000000..1c53f961768
--- /dev/null
+++ b/TAO/TAO_IDL/driver/drv_preproc.cpp
@@ -0,0 +1,1271 @@
+// $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.
+
+*/
+
+// Pass an IDL file through the C preprocessor
+
+
+#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"
+#include "ace/UUID.h"
+#include "ace/Dirent.h"
+#include "ace/OS_NS_sys_stat.h"
+
+// FUZZ: disable check_for_streams_include
+#include "ace/streams.h"
+
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_unistd.h"
+#include "ace/OS_NS_fcntl.h"
+
+ACE_RCSID (driver,
+ drv_preproc,
+ "$Id$")
+
+// Storage for preprocessor args.
+const unsigned long DRV_MAX_ARGCOUNT = 128;
+unsigned long DRV_argcount = 0;
+const char *DRV_arglist[DRV_MAX_ARGCOUNT];
+
+static const char *output_arg_format = 0;
+static long output_arg_index = 0;
+
+const char *DIR_DOT = ".";
+const char *DIR_DOT_DOT = "..";
+
+// File names.
+static char tmp_file [MAXPATHLEN + 1] = { 0 };
+static char tmp_ifile[MAXPATHLEN + 1] = { 0 };
+
+// Lines can be 1024 chars long intially - it will expand as required.
+#define LINEBUF_SIZE 1024
+char* drv_line = 0;
+static size_t drv_line_size = LINEBUF_SIZE + 1;
+
+// Push the new CPP location if we got a -Yp argument.
+void
+DRV_cpp_new_location (char *new_loc)
+{
+ DRV_arglist[0] = new_loc;
+}
+
+// Push an argument into the DRV_arglist.
+void
+DRV_cpp_putarg (const char *str)
+{
+ if (DRV_argcount >= DRV_MAX_ARGCOUNT)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%s%s %d %s\n",
+ idl_global->prog_name (),
+ ": More than",
+ DRV_MAX_ARGCOUNT,
+ "arguments to preprocessor"));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+
+ DRV_arglist[DRV_argcount++] = ACE::strnew (str);
+}
+
+// Expand the output argument with the given filename.
+void
+DRV_cpp_expand_output_arg (const char *filename)
+{
+ if (output_arg_format != 0)
+ {
+ delete [] const_cast<char *> (DRV_arglist[output_arg_index]);
+ DRV_arglist[output_arg_index] = 0;
+
+ char *output_arg = 0;
+ ACE_NEW (output_arg,
+ char [ACE_OS::strlen (output_arg_format)
+ + ACE_OS::strlen (filename)
+ + 1]);
+
+ ACE_OS::sprintf (output_arg,
+ output_arg_format,
+ filename);
+
+ DRV_arglist[output_arg_index] = output_arg;
+ }
+}
+
+// Get a line from stdin.
+static bool
+DRV_get_line (FILE *f)
+{
+ char *l = fgets (drv_line,
+ drv_line_size,
+ f);
+
+ if (l == 0)
+ {
+ return false;
+ }
+
+ if (*l == '\0' && feof (f))
+ {
+ return false;
+ }
+
+ if (*l == '\0')
+ {
+ return true;
+ }
+
+ while (strchr (drv_line, '\n') == NULL)
+ {
+ // Haven't got to a newline yet.
+ // Create a bigger buffer and keep reading.
+ size_t temp_size;
+ temp_size = drv_line_size * 2;
+ char *temp = 0;
+ ACE_NEW_RETURN (temp,
+ char[temp_size],
+ false);
+ strcpy (temp, drv_line);
+ delete [] drv_line;
+ drv_line = temp;
+ drv_line_size = temp_size;
+
+ l = fgets (drv_line + strlen (drv_line),
+ drv_line_size - strlen(drv_line),
+ f);
+
+ if (l == 0 || *l == '\0')
+ {
+ break;
+ }
+ }
+
+ size_t i = strlen (drv_line) - 1;
+
+ if (drv_line[i] == '\n')
+ {
+ drv_line[i] = '\0';
+ }
+
+ return true;
+}
+
+// Initialize the cpp argument list.
+void
+DRV_cpp_init (void)
+{
+ // Create the line buffer.
+ // (JP) Deleting this at the end or DRV_pre_proc() causes
+ // Purify to output a Freeing Mismatched Memory warning.
+ // When it is not deleted (currently the case) there is no
+ // memory leak reported by Purify. I don't know why.
+ ACE_NEW (drv_line,
+ char [drv_line_size]);
+
+ const char *cpp_loc = FE_get_cpp_loc_from_env ();
+ DRV_cpp_putarg (cpp_loc);
+
+ // 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.
+ char version_option[128];
+ ACE_OS::sprintf (version_option,
+ "-D__TAO_IDL=0x%2.2d%2.2d%2.2d",
+ ACE_MAJOR_VERSION,
+ ACE_MINOR_VERSION,
+ ACE_BETA_VERSION);
+
+ DRV_cpp_putarg (version_option);
+ DRV_cpp_putarg ("-I.");
+
+ const char *platform_cpp_args = FE_get_cpp_args_from_env ();
+
+ if (platform_cpp_args == 0)
+ {
+ // If no cpp flag was defined by the user, we define some
+ // platform specific flags here.
+ char option1[BUFSIZ];
+ char option2[BUFSIZ];
+
+#if defined (TAO_IDL_PREPROCESSOR_ARGS)
+ platform_cpp_args = TAO_IDL_PREPROCESSOR_ARGS;
+#elif defined (ACE_CC_PREPROCESSOR_ARGS)
+ platform_cpp_args = ACE_CC_PREPROCESSOR_ARGS;
+#else
+ platform_cpp_args = "-E";
+#endif /* TAO_IDL_PREPROCESSOR_ARGS */
+
+ // So we can find OMG IDL files, such as `orb.idl'.
+
+ ACE_OS::strcpy (option1, "-I");
+ ACE_OS::strcpy (option2, "-I");
+ char* TAO_ROOT = ACE_OS::getenv ("TAO_ROOT");
+ size_t len = 0;
+
+ if (TAO_ROOT != 0)
+ {
+ len = ACE_OS::strlen (TAO_ROOT);
+
+ // Some compilers choke on "//" separators.
+ if (TAO_ROOT[len - 1] == '/')
+ {
+ TAO_ROOT[len - 1] = '\0';
+ }
+
+ ACE_OS::strcat (option1, TAO_ROOT);
+ ACE_OS::strcat (option2, TAO_ROOT);
+#if defined (ACE_WIN32)
+ ACE_OS::strcat (option2, "\\tao");
+#else
+ ACE_OS::strcat (option2, "/tao");
+#endif
+ }
+ else
+ {
+ char* ACE_ROOT = ACE_OS::getenv ("ACE_ROOT");
+
+ if (ACE_ROOT != 0)
+ {
+ len = ACE_OS::strlen (ACE_ROOT);
+
+ // Some compilers choke on "//" separators.
+ if (ACE_ROOT[len - 1] == '/')
+ {
+ ACE_ROOT[len - 1] = '\0';
+ }
+
+ ACE_OS::strcat (option1, ACE_ROOT);
+ ACE_OS::strcat (option2, ACE_ROOT);
+#if defined (ACE_WIN32)
+ ACE_OS::strcat (option1, "\\TAO");
+ ACE_OS::strcat (option2, "\\TAO\\tao");
+#else
+ ACE_OS::strcat (option1, "/TAO");
+ ACE_OS::strcat (option2, "/TAO/tao");
+#endif
+ }
+ else
+ {
+#if defined (TAO_IDL_INCLUDE_DIR)
+ // TAO_IDL_INCLUDE_DIR should be in quotes,
+ // e.g. "/usr/local/include/tao"
+ ACE_OS::strcat (option1, TAO_IDL_INCLUDE_DIR);
+ ACE_OS::strcat (option2, ".");
+#else
+ ACE_ERROR ((LM_WARNING,
+ "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 (option1, ".");
+#endif /* TAO_IDL_INCLUDE_DIR */
+ }
+ }
+
+ DRV_cpp_putarg (option1);
+ idl_global->add_include_path (ACE_CString (option1 + 2).c_str ());
+ DRV_cpp_putarg (option2);
+ idl_global->add_include_path (ACE_CString (option2 + 2).c_str ());
+ idl_global->tao_root (option1 + 2);
+ }
+
+ // Add any flags in platform_cpp_args to cpp's DRV_arglist.
+ ACE_ARGV platform_arglist (platform_cpp_args);
+
+ for (int i = 0; i < platform_arglist.argc (); ++i)
+ {
+ // Check for an argument that specifies the preprocessor's output file.
+ if (ACE_OS::strstr (platform_arglist[i], "%s") != 0
+ && output_arg_format == 0)
+ {
+ output_arg_format = ACE::strnew (platform_arglist[i]);
+ output_arg_index = DRV_argcount;
+ DRV_cpp_putarg (0);
+ }
+ else
+ {
+ DRV_cpp_putarg (platform_arglist[i]);
+ }
+ }
+}
+
+int
+DRV_sweep_dirs (const char *rel_path,
+ const char *base_path)
+{
+ // Zero rel_path means we're not using this option, and
+ // so we become a no-op.
+ if (rel_path == 0)
+ {
+ return 0;
+ }
+
+ if (ACE_OS::chdir (rel_path) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "DRV_sweep_dirs: chdir %s failed\n",
+ rel_path),
+ -1);
+ }
+
+ ACE_Dirent dir (DIR_DOT);
+ ACE_CString bname (base_path);
+ bname += (bname.length () > 0 ? "/" : "");
+ bname += rel_path;
+ bool include_added = false;
+
+ for (dirent *dir_entry; (dir_entry = dir.read ()) != 0;)
+ {
+ // Skip the ".." and "." files in each directory.
+ if (ACE_OS::strcmp (dir_entry->d_name, DIR_DOT) == 0
+ || ACE_OS::strcmp (dir_entry->d_name, DIR_DOT_DOT) == 0)
+ {
+ continue;
+ }
+
+ ACE_CString lname (dir_entry->d_name);
+ ACE_stat stat_buf;
+
+ if (ACE_OS::lstat (lname.c_str (), &stat_buf) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "DRV_sweep_dirs: ACE_OS::lstat (%s) failed\n",
+ lname.c_str ()),
+ -1);
+ }
+
+ size_t len = 0;
+
+ switch (stat_buf.st_mode & S_IFMT)
+ {
+ case S_IFREG: // Either a regular file or an executable.
+ len = lname.length ();
+
+ if (len > 4 && lname.substr (len - 4) == ".idl")
+ {
+ if (!include_added)
+ {
+ ACE_CString incl_arg ("-I");
+ incl_arg += bname;
+ DRV_cpp_putarg (incl_arg.c_str ());
+ include_added = true;
+ }
+
+ ACE_CString fname (bname);
+ fname += "/";
+ fname += lname;
+ DRV_push_file (fname.c_str ());
+ }
+
+ break;
+ case S_IFDIR: // Subdirectory.
+ DRV_sweep_dirs (lname.c_str (), bname.c_str ());
+ break;
+ case S_IFLNK: // Either a file link or directory link.
+ default: // Some other type of file (PIPE/FIFO/device).
+ break;
+ }
+ }
+
+ // Move back up a level.
+ if (ACE_OS::chdir (DIR_DOT_DOT) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "DRV_sweep_dirs: chdir .. (from %s) failed\n",
+ rel_path),
+ -1);
+ }
+
+ return 0;
+}
+
+// Adds additional include paths, but after parse_args() has
+// added user-defined include paths.
+void
+DRV_cpp_post_init (void)
+{
+ char option3[BUFSIZ];
+ char option4[BUFSIZ];
+ char option5[BUFSIZ];
+
+ ACE_OS::strcpy (option3, "-I");
+ ACE_OS::strcpy (option4, "-I");
+ ACE_OS::strcpy (option5, "-I");
+
+ char* TAO_ROOT = ACE_OS::getenv ("TAO_ROOT");
+ size_t len = 0;
+
+ if (TAO_ROOT != 0)
+ {
+ len = ACE_OS::strlen (TAO_ROOT);
+
+ // Some compilers choke on "//" separators.
+ if (TAO_ROOT[len - 1] == '/')
+ {
+ TAO_ROOT[len - 1] = '\0';
+ }
+
+ ACE_OS::strcat (option3, TAO_ROOT);
+ ACE_OS::strcat (option4, TAO_ROOT);
+ ACE_OS::strcat (option5, TAO_ROOT);
+#if defined (ACE_WIN32)
+ ACE_OS::strcat (option3, "\\orbsvcs");
+ ACE_OS::strcat (option4, "\\CIAO");
+ ACE_OS::strcat (option5, "\\CIAO\\ciao");
+#else
+ ACE_OS::strcat (option3, "/orbsvcs");
+ ACE_OS::strcat (option4, "/CIAO");
+ ACE_OS::strcat (option5, "/CIAO/ciao");
+#endif
+ }
+ else
+ {
+ char* ACE_ROOT = ACE_OS::getenv ("ACE_ROOT");
+
+ if (ACE_ROOT != 0)
+ {
+ len = ACE_OS::strlen (ACE_ROOT);
+
+ // Some compilers choke on "//" separators.
+ if (ACE_ROOT[len - 1] == '/')
+ {
+ ACE_ROOT[len - 1] = '\0';
+ }
+
+ ACE_OS::strcat (option3, ACE_ROOT);
+ ACE_OS::strcat (option4, ACE_ROOT);
+ ACE_OS::strcat (option5, ACE_ROOT);
+#if defined (ACE_WIN32)
+ ACE_OS::strcat (option3, "\\TAO\\orbsvcs");
+ ACE_OS::strcat (option4, "\\TAO\\CIAO");
+ ACE_OS::strcat (option5, "\\TAO\\CIAO\\ciao");
+#else
+ ACE_OS::strcat (option3, "/TAO/orbsvcs");
+ ACE_OS::strcat (option4, "/TAO/CIAO");
+ ACE_OS::strcat (option5, "/TAO/CIAO/ciao");
+#endif
+ }
+ else
+ {
+ ACE_OS::strcat (option3, ".");
+ ACE_OS::strcat (option4, ".");
+ ACE_OS::strcat (option5, ".");
+ }
+ }
+
+ DRV_cpp_putarg (option3);
+ DRV_cpp_putarg (option4);
+ DRV_cpp_putarg (option5);
+
+ idl_global->add_include_path (ACE_CString (option3 + 2).c_str ());
+ idl_global->add_include_path (ACE_CString (option4 + 2).c_str ());
+ idl_global->add_include_path (ACE_CString (option5 + 2).c_str ());
+
+ // Save path of current directory, in case the call to DRV_sweep_dirs()
+ // below is not a no-op - then the current working directory will
+ // have to be restored.
+ char cwd_path[MAXPATHLEN];
+ if (ACE_OS::getcwd (cwd_path, sizeof (cwd_path)) == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "DRV_cpp_post_init: ACE_OS::getcwd failed\n"));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+
+ // If first arg is non-zero, adds an include path and filename
+ // for every IDL file found in all subdirectories. This is a
+ // no-op for most backends.
+ if (DRV_sweep_dirs (idl_global->recursion_start (), "") == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "DRV_cpp_post_init: DRV_sweep_dirs (%s) failed\n",
+ idl_global->recursion_start ()));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+
+ // This is redundant for most backends, but not if the call to
+ // DRV_sweep_dirs() above is more than a no-op.
+ if (ACE_OS::chdir (cwd_path) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "DRV_cpp_post_init: ACE_OS::chdir (%s) failed\n",
+ cwd_path));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+}
+
+// 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 the tabs and spaces.
+ while (*r == ' ' || *r == '\t')
+ {
+ ++r;
+ }
+
+ // 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;
+
+ // We're not handling redirection from stdin.
+ if (*h == '\0')
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("IDL: No friggin' input files\n")));
+
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+
+ // Find the closing " or < character.
+ for (; *r != end_char; ++r)
+ {
+ continue;
+ }
+
+ // Copy the chars.
+ char incl_file[MAXPATHLEN + 1] = { 0 };
+ size_t fi = 0;
+
+ for (; h != r; ++fi, ++h)
+ {
+ incl_file [fi] = *h;
+ }
+
+ // Terminate the string.
+ incl_file [fi] = '\0';
+
+ // Put Microsoft-style pathnames into a canonical form.
+ size_t i = 0;
+
+ for (size_t j = 0; incl_file [j] != '\0'; ++i, ++j)
+ {
+ if (incl_file [j] == '\\' && incl_file [j + 1] == '\\')
+ {
+ j++;
+ }
+
+ incl_file [i] = incl_file [j];
+ }
+
+ // Terminate this string.
+ incl_file [i] = '\0';
+
+ size_t len = ACE_OS::strlen (incl_file);
+ ACE_CString name_str (incl_file);
+ ACE_CString simple ("orb.idl");
+ ACE_CString nix_path ("tao/orb.idl");
+ ACE_CString win_path ("tao\\orb.idl");
+
+ // Some backends pass this file through, others don't.
+ if (name_str == simple || name_str == nix_path || name_str == win_path)
+ {
+ if (idl_global->pass_orb_idl ())
+ {
+ idl_global->add_to_included_idl_files (incl_file);
+ }
+ else
+ {
+ DRV_get_orb_idl_includes ();
+ }
+ }
+ // We have special lookup for orb.idl (TAO_ROOT/tao) that
+ // also kicks in for .pidl files. If one of the latter is
+ // included as a local name only, we add the 'tao/' prefix
+ // so the generated C++ include files will be correct.
+ else if (ACE_OS::strcmp (incl_file + len - 5, ".pidl") == 0
+ && ACE_OS::strchr (incl_file, '/') == 0
+ && ACE_OS::strchr (incl_file, '\\') == 0)
+ {
+ ACE_CString fixed_name ("tao/");
+ fixed_name += incl_file;
+ idl_global->add_to_included_idl_files (fixed_name.rep ());
+ }
+ else
+ {
+ idl_global->add_to_included_idl_files (incl_file);
+ }
+}
+
+// This method turns a line like '#include "a.idl"' into the
+// line '#include <a.idl>'
+void
+DRV_convert_includes (const char* buf)
+{
+ // Remove constness
+ char* r = const_cast<char*> (buf);
+
+ // Skip the tabs and spaces.
+ while (*r == ' ' || *r == '\t')
+ {
+ ++r;
+ }
+
+ // 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 " character.
+ for (; (*r != '"'); ++r)
+ {
+ if (*r == '\n' || *r == '\0')
+ {
+ return;
+ }
+ }
+
+ // Replace the opening quote with an angle bracket.
+ *r = '<';
+
+ // We're not handling redirection from stdin.
+ if (*r == '\0')
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("IDL: No friggin' input files\n")));
+
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+
+ // Find the closing '"' character.
+ for (; *r != '"'; ++r)
+ {
+ continue;
+ }
+
+ // Swap it for a '>'
+ if (*r == '"')
+ {
+ *r = '>';
+ }
+}
+
+void
+DRV_get_orb_idl_includes (void)
+{
+ ACE_CString orb_idl_path (idl_global->tao_root ());
+ orb_idl_path += "/tao/orb.idl";
+ FILE *fd = ACE_OS::fopen (orb_idl_path.fast_rep (), "r");
+
+ if (fd == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%s%s",
+ orb_idl_path.fast_rep (),
+ ": cannot open input file\n"));
+
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+
+ while (DRV_get_line (fd))
+ {
+ // Find the included .pidl files and add them to
+ // the included IDL file list.
+ DRV_check_for_include (drv_line);
+ }
+
+ ACE_OS::fclose (fd);
+}
+
+// Copy to a file.
+static void
+DRV_copy_input (FILE *fin,
+ FILE *f,
+ const char *fn,
+ const char *orig_filename)
+{
+ if (f == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%s: cannot open temp file \"%s\" for writing\n",
+ idl_global->prog_name (),
+ fn));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+
+ if (fin == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%s%s",
+ idl_global->prog_name (),
+ ": cannot open input file\n"));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+
+#if !defined (ACE_WIN32)
+ fprintf (f,
+ "#line 1 \"%s\"\n",
+ orig_filename);
+#else
+ // Convert single \ into double \ otherwise MSVC++ pre-processor
+ // gets awfully confused.
+ char buf[2*MAXPATHLEN];
+ char *d = buf;
+
+ for (const char *s = orig_filename; *s != 0; ++s)
+ {
+ if (*s == '\\')
+ {
+ *d = '\\';
+ d++;
+ }
+
+ *d = *s;
+ d++;
+ }
+
+ *d = 0;
+ ACE_OS::fprintf (f,
+ "#line 1 \"%s\"\n",
+ buf);
+#endif /* ! ACE_WIN32 */
+
+ while (DRV_get_line (fin))
+ {
+ DRV_convert_includes (drv_line);
+
+ // Print the line to the temporary file.
+ ACE_OS::fprintf (f,
+ "%s\n",
+ drv_line);
+
+ // 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.
+ DRV_check_for_include (drv_line);
+ }
+
+ // Close the temporary file.
+ ACE_OS::fclose (f);
+}
+
+// Strip down a name to the last component,
+// i.e. everything after the last '/' or '\' character.
+static char *
+DRV_stripped_name (char *fn)
+{
+ char *n = fn;
+ size_t l;
+
+ if (n == 0)
+ {
+ return 0;
+ }
+
+ l = strlen (n);
+ int slash_found = 0;
+
+ for (n += l - 1; n >= fn && !slash_found; n--)
+ {
+ slash_found = (*n == '/' || *n == '\\');
+ }
+
+ n += 1;
+
+ if (slash_found)
+ {
+ n += 1;
+ }
+
+ return n;
+}
+
+// Pass input through preprocessor.
+void
+DRV_pre_proc (const char *myfile)
+{
+ const char* tmpdir = idl_global->temp_dir ();
+ static const char temp_file_extension[] = ".cpp";
+
+ static char const tao_idlf_template[] = "tao-idlf_XXXXXX";
+ static char const tao_idli_template[] = "tao-idli_XXXXXX";
+
+ size_t const tlen =
+ ACE_OS::strlen (tmpdir) + sizeof (temp_file_extension);
+
+ // Prevent a buffer overrun.
+ if (tlen + sizeof (tao_idlf_template) > sizeof (tmp_file)
+ || tlen + sizeof (tao_idli_template) > sizeof (tmp_ifile))
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%s: temporary path/filename length is greater than "
+ "length allowed by platform\n",
+ idl_global->prog_name ()));
+
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+
+ ACE_OS::strcpy (tmp_file, tmpdir);
+ ACE_OS::strcpy (tmp_ifile, tmpdir);
+
+ // Append temporary filename template to temporary directory.
+ ACE_OS::strcat (tmp_file, tao_idlf_template);
+ ACE_OS::strcat (tmp_ifile, tao_idli_template);
+
+ ACE_HANDLE const ti_fd = ACE_OS::mkstemp (tmp_ifile);
+ ACE_HANDLE const tf_fd = ACE_OS::mkstemp (tmp_file);
+
+ if (ti_fd == ACE_INVALID_HANDLE || tf_fd == ACE_INVALID_HANDLE)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%s: Unable to create temporary file: %m\n",
+ idl_global->prog_name ()));
+
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+
+ char tmp_cpp_file [MAXPATHLEN + 1] = { 0 };
+ char tmp_cpp_ifile[MAXPATHLEN + 1] = { 0 };
+
+ // Append C++ source file extension. Temporary files will be renamed
+ // to these filenames.
+ ACE_OS::strcpy (tmp_cpp_file, tmp_file);
+ ACE_OS::strcpy (tmp_cpp_ifile, tmp_ifile);
+ ACE_OS::strcat (tmp_cpp_file, temp_file_extension);
+ ACE_OS::strcat (tmp_cpp_ifile, temp_file_extension);
+
+ char * const t_file = tmp_cpp_file;
+ char * const t_ifile = tmp_cpp_ifile;
+
+ ACE_OS::close (tf_fd);
+
+ // Rename temporary files so that they have extensions accepted
+ // by the preprocessor.
+
+ FILE * const file = ACE_OS::fopen (myfile, "r");
+ DRV_copy_input (file,
+ ACE_OS::fdopen (ti_fd, "w"),
+ tmp_ifile,
+ myfile);
+ ACE_OS::fclose (file);
+
+ idl_global->set_main_filename (idl_global->utl_string_factory (myfile));
+
+ ACE_Auto_String_Free safety (ACE_OS::strdup (myfile));
+ UTL_String *tmp =
+ idl_global->utl_string_factory (DRV_stripped_name (safety.get ()));
+ idl_global->set_stripped_filename (tmp);
+
+ idl_global->set_real_filename (idl_global->utl_string_factory (t_ifile));
+
+ // We use ACE instead of the (low level) fork facilities, this also
+ // works on NT.
+ ACE_Process process;
+
+ // For complex builds, the default command line buffer size of 1024
+ // is sometimes not enough. We use 4096 here.
+ ACE_Process_Options cpp_options (1, // Inherit environment.
+ TAO_IDL_COMMAND_LINE_BUFFER_SIZE);
+
+ DRV_cpp_expand_output_arg (t_file);
+ DRV_cpp_putarg (t_ifile);
+ DRV_cpp_putarg (0); // Null terminate the DRV_arglist.
+
+ cpp_options.command_line (DRV_arglist);
+
+ // Rename temporary files so that they have extensions accepted
+ // by the preprocessor. Renaming is (supposed to be) an atomic
+ // operation so we shouldn't be susceptible to attack.
+ if (ACE_OS::rename (tmp_file, t_file) != 0
+ || ACE_OS::rename (tmp_ifile, t_ifile) != 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%s: Unable to rename temporary file: %m\n",
+ idl_global->prog_name ()));
+
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+
+ // Remove any existing output file.
+ (void) ACE_OS::unlink (t_file);
+
+ ACE_HANDLE fd = ACE_INVALID_HANDLE;
+
+ if (output_arg_format == 0)
+ {
+ // If the following open() fails, then we're either being hit with a
+ // symbolic link attack, or another process opened the file before
+ // us.
+#if defined (ACE_OPENVMS)
+ fd = ::open (t_file, O_WRONLY | O_CREAT | O_EXCL,
+ ACE_DEFAULT_FILE_PERMS, "shr=get,put,upd", "ctx=rec", "fop=dfw");
+#else
+ fd = ACE_OS::open (t_file,
+ O_WRONLY | O_CREAT | O_EXCL,
+ ACE_DEFAULT_FILE_PERMS);
+#endif
+
+ if (fd == ACE_INVALID_HANDLE)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%s: cannot open temp file \"%s\" for writing\n",
+ idl_global->prog_name (),
+ t_file));
+
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+
+ cpp_options.set_handles (ACE_INVALID_HANDLE, fd);
+ }
+
+ if (process.spawn (cpp_options) == ACE_INVALID_PID)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%s: spawn of \"%s\" failed\n",
+ idl_global->prog_name (),
+ DRV_arglist[0]));
+
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+
+ if (fd != ACE_INVALID_HANDLE)
+ {
+ // Close the output file on the parent process.
+ if (ACE_OS::close (fd) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%s: cannot close temp file \"%s\" on parent\n",
+ idl_global->prog_name (),
+ t_file));
+
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+ }
+
+ // Remove the null termination and the input file from the DRV_arglist,
+ // the next file will the previous args.
+ delete [] const_cast<char *> (DRV_arglist[DRV_argcount - 2]);
+
+ DRV_argcount -= 2;
+ ACE_exitcode status = 0;
+
+ if (process.wait (&status) == ACE_INVALID_PID)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%s: wait for child process failed\n",
+ idl_global->prog_name ()));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+
+ if (WIFEXITED ((status)))
+ {
+ // Child terminated normally?
+ if (WEXITSTATUS ((status)) != 0)
+ {
+ errno = WEXITSTATUS ((status));
+
+ ACE_ERROR ((LM_ERROR,
+ "%s: preprocessor \"%s\" returned with an error\n",
+ idl_global->prog_name (),
+ DRV_arglist[0]));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+ }
+ else
+ {
+ // Child didn't call exit(); perhaps it received a signal?
+ errno = EINTR;
+
+ ACE_ERROR ((LM_ERROR,
+ "%s: preprocessor \"%s\" appears "
+ "to have been interrupted\n",
+ idl_global->prog_name (),
+ DRV_arglist[0]));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+ // TODO: Manage problems in the pre-processor, in the previous
+ // version the current process would exit if the pre-processor
+ // returned with error.
+
+#if defined (ACE_OPENVMS)
+ cpp_options.release_handles();
+#endif
+
+ FILE * const yyin = ACE_OS::fopen (t_file, "r");
+
+ if (yyin == NULL)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%s: Could not open cpp output file: %p\n",
+ idl_global->prog_name (),
+ t_file));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+
+ FE_set_yyin (reinterpret_cast<File *> (yyin));
+
+ if (idl_global->compile_flags () & IDL_CF_ONLY_PREPROC)
+ {
+ FILE *preproc = ACE_OS::fopen (t_file, "r");
+ char buffer[ACE_MAXLOGMSGLEN];
+ size_t bytes;
+
+ if (preproc == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%s: Could not open cpp output file: %p\n",
+ idl_global->prog_name (),
+ t_file));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+
+ // ACE_DEBUG sends to stderr - we want stdout for this dump
+ // of the preprocessor output. So we modify the singleton that
+ // was created in this process. Since IDL_CF_ONLY_PREPROC causes
+ // an (almost) immediate exit below, we don't have to restore
+ // the singleton's default parameters.
+ ACE_Log_Msg *out = ACE_Log_Msg::instance ();
+ out->msg_ostream (&cout);
+ out->clr_flags (ACE_Log_Msg::STDERR);
+ out->set_flags (ACE_Log_Msg::OSTREAM);
+
+ while ((bytes = ACE_OS::fread (buffer,
+ sizeof (char),
+ ACE_MAXLOGMSGLEN - 1,
+ preproc))
+ != 0)
+ {
+ buffer[bytes] = 0;
+
+ ACE_DEBUG ((LM_DEBUG,
+ buffer));
+ }
+
+ ACE_OS::fclose (preproc);
+ }
+
+ if (ACE_OS::unlink (t_ifile) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%s: Could not remove cpp input file: %p\n",
+ idl_global->prog_name (),
+ t_ifile));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+
+#if !defined (ACE_WIN32) || defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)
+
+ if (ACE_OS::unlink (t_file) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%s: Could not remove cpp output file: %p\n",
+ idl_global->prog_name (),
+ t_file));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+#endif /* ACE_HAS_WINNT4 && ACE_HAS_WINNT4 != 0 */
+
+ if (idl_global->compile_flags () & IDL_CF_ONLY_PREPROC)
+ {
+ // Go straight to cleanup, exit normally.
+ throw FE_Bailout ();
+ }
+}
diff --git a/TAO/TAO_IDL/fe/fe_declarator.cpp b/TAO/TAO_IDL/fe/fe_declarator.cpp
new file mode 100644
index 00000000000..d2cd1dc777d
--- /dev/null
+++ b/TAO/TAO_IDL/fe/fe_declarator.cpp
@@ -0,0 +1,209 @@
+// $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.
+
+*/
+
+#include "fe_declarator.h"
+#include "ast_array.h"
+#include "ast_type.h"
+#include "utl_err.h"
+#include "global_extern.h"
+#include "nr_extern.h"
+#include "ace/config-all.h"
+
+ACE_RCSID (fe,
+ fe_declarator,
+ "$Id$")
+
+FE_Declarator::FE_Declarator (UTL_ScopedName *n,
+ DeclaratorType dt,
+ AST_Decl *cp)
+ : pd_complex_part (cp),
+ pd_decl_type (dt)
+{
+ this->pd_name = n;
+}
+
+// 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_Decl::NodeType nt = d->node_type ();
+
+ if (nt == AST_Decl::NT_struct_fwd || nt == AST_Decl::NT_union_fwd)
+ {
+ if (! AST_Type::narrow_from_decl (d)->is_defined ())
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_ADD,
+ d);
+
+ return 0;
+ }
+ }
+
+ AST_Array *arr = 0;
+ AST_Type *ct = 0;
+
+ ct = AST_Type::narrow_from_decl (d);
+
+ if (ct == 0)
+ {
+ idl_global->err ()->not_a_type (d);
+ return 0;
+ }
+
+ // All uses of forward declared types must
+ // not have a different prefix from the place of declaration.
+ if (!ct->is_defined ())
+ {
+ char *current_prefix = 0;
+ idl_global->pragma_prefixes ().top (current_prefix);
+
+ const char *original_prefix = d->prefix ();
+ AST_Decl *scope = d;
+
+ // Maybe the prefix hasn't been applied yet.
+ while (ACE_OS::strcmp (original_prefix, "") == 0)
+ {
+ scope = ScopeAsDecl (scope->defined_in ());
+
+ // Are we at global scope.8
+ if (scope == 0)
+ {
+ break;
+ }
+
+ original_prefix = scope->prefix ();
+ }
+
+ // Skip if the pointers are the same.
+ if (d->prefix () != original_prefix)
+ {
+ d->prefix (const_cast<char *> (original_prefix));
+ }
+
+ if (current_prefix != 0
+ && ACE_OS::strcmp (current_prefix, d->prefix ()) != 0)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_PREFIX_CONFLICT,
+ d);
+
+ return 0;
+ }
+ }
+
+ if (this->pd_decl_type == FD_simple || this->pd_complex_part == 0)
+ {
+ return ct;
+ }
+
+ if (this->pd_complex_part->node_type () == AST_Decl::NT_array)
+ {
+ arr = AST_Array::narrow_from_decl (this->pd_complex_part);
+
+ // The base type of an array isn't set until after the array
+ // has been created, so the check below gets done at this point.
+ arr->set_base_type (ct);
+ AST_Decl::NodeType nt = ct->unaliased_type ()->node_type ();
+
+ if (nt == AST_Decl::NT_string || nt == AST_Decl::NT_wstring)
+ {
+ idl_global->string_member_seen_ = true;
+ }
+
+ return arr;
+ }
+
+ // We shouldn't get here.
+ return 0;
+}
+
+void
+FE_Declarator::destroy (void)
+{
+ this->pd_name->destroy ();
+ delete this->pd_name;
+ this->pd_name = 0;
+}
+
+// Data accessors.
+
+AST_Decl *
+FE_Declarator::complex_part (void)
+{
+ return this->pd_complex_part;
+}
+
+UTL_ScopedName *
+FE_Declarator::name (void)
+{
+ return this->pd_name;
+}
+
+FE_Declarator::DeclaratorType
+FE_Declarator::decl_type (void)
+{
+ return this->pd_decl_type;
+}
diff --git a/TAO/TAO_IDL/fe/fe_extern.cpp b/TAO/TAO_IDL/fe/fe_extern.cpp
new file mode 100644
index 00000000000..3d5bf971689
--- /dev/null
+++ b/TAO/TAO_IDL/fe/fe_extern.cpp
@@ -0,0 +1,127 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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.
+
+ */
+
+/*
+ * fe_extern.cc - export FE interfaces to driver
+ */
+
+#include "fe_extern.h"
+#include "ast_root.h"
+#include "global_extern.h"
+#include "utl_err.h"
+#include "utl_indenter.h"
+#include "ace/UUID.h"
+
+ACE_RCSID (fe,
+ fe_extern,
+ "$Id$")
+
+extern int tao_yyparse (void);
+extern FILE *tao_yyin;
+
+int
+FE_yyparse (void)
+{
+ int const result = tao_yyparse ();
+
+ if (0 == idl_global->err_count ())
+ {
+ idl_global->root ()->call_add ();
+ }
+
+ return result;
+}
+
+void
+FE_set_yyin (File *f)
+{
+ tao_yyin = reinterpret_cast<FILE *> (f);
+}
+
+// Constructor interfaces.
+
+UTL_Error *
+FE_new_UTL_Error (void)
+{
+ UTL_Error *retval = 0;
+ ACE_NEW_RETURN (retval,
+ UTL_Error,
+ 0);
+
+ return retval;
+}
+
+UTL_Indenter *
+FE_new_UTL_Indenter (void)
+{
+ UTL_Indenter *retval = 0;
+ ACE_NEW_RETURN (retval,
+ UTL_Indenter,
+ 0);
+
+ return retval;
+}
diff --git a/TAO/TAO_IDL/fe/fe_global.cpp b/TAO/TAO_IDL/fe/fe_global.cpp
new file mode 100644
index 00000000000..f60767a0ac3
--- /dev/null
+++ b/TAO/TAO_IDL/fe/fe_global.cpp
@@ -0,0 +1,11 @@
+// $Id$
+
+#include "global_extern.h"
+
+
+ACE_RCSID (fe,
+ fe_global,
+ "$Id$")
+
+
+IDL_GlobalData *idl_global = 0;
diff --git a/TAO/TAO_IDL/fe/fe_init.cpp b/TAO/TAO_IDL/fe/fe_init.cpp
new file mode 100644
index 00000000000..8c42f299187
--- /dev/null
+++ b/TAO/TAO_IDL/fe/fe_init.cpp
@@ -0,0 +1,785 @@
+// $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.
+
+*/
+
+#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"
+#include "ace/Env_Value_T.h"
+#include "ace/UUID.h"
+
+ACE_RCSID (fe,
+ fe_init,
+ "$Id$")
+
+const size_t LOCAL_ESCAPES_BUFFER_SIZE = 1024;
+
+// Populate the global scope with all predefined entities.
+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,
+ 0
+ );
+ m->fe_add_predefined_type (pdt);
+
+ pdt =
+ idl_global->gen ()->create_predefined_type (
+ AST_PredefinedType::PT_ulong,
+ 0
+ );
+ m->fe_add_predefined_type (pdt);
+
+ pdt =
+ idl_global->gen ()->create_predefined_type (
+ AST_PredefinedType::PT_longlong,
+ 0
+ );
+ m->fe_add_predefined_type(pdt);
+
+ pdt =
+ idl_global->gen ()->create_predefined_type (
+ AST_PredefinedType::PT_ulonglong,
+ 0
+ );
+ m->fe_add_predefined_type (pdt);
+
+ pdt =
+ idl_global->gen ()->create_predefined_type (
+ AST_PredefinedType::PT_short,
+ 0
+ );
+ m->fe_add_predefined_type (pdt);
+
+ pdt =
+ idl_global->gen ()->create_predefined_type (
+ AST_PredefinedType::PT_ushort,
+ 0
+ );
+ m->fe_add_predefined_type (pdt);
+
+ pdt =
+ idl_global->gen ()->create_predefined_type (
+ AST_PredefinedType::PT_float,
+ 0
+ );
+ m->fe_add_predefined_type (pdt);
+
+ pdt =
+ idl_global->gen ()->create_predefined_type (
+ AST_PredefinedType::PT_double,
+ 0
+ );
+ m->fe_add_predefined_type (pdt);
+
+ pdt =
+ idl_global->gen ()->create_predefined_type (
+ AST_PredefinedType::PT_longdouble,
+ 0
+ );
+ m->fe_add_predefined_type (pdt);
+
+ pdt =
+ idl_global->gen ()->create_predefined_type (
+ AST_PredefinedType::PT_char,
+ 0
+ );
+ m->fe_add_predefined_type (pdt);
+
+ pdt =
+ idl_global->gen ()->create_predefined_type (
+ AST_PredefinedType::PT_wchar,
+ 0
+ );
+ m->fe_add_predefined_type (pdt);
+
+ pdt =
+ idl_global->gen ()->create_predefined_type (
+ AST_PredefinedType::PT_octet,
+ 0
+ );
+ m->fe_add_predefined_type (pdt);
+
+ pdt =
+ idl_global->gen ()->create_predefined_type (
+ AST_PredefinedType::PT_any,
+ 0
+ );
+ m->fe_add_predefined_type (pdt);
+
+ pdt =
+ idl_global->gen ()->create_predefined_type (
+ AST_PredefinedType::PT_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,
+ &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_object,
+ &Object_name
+ );
+ m->fe_add_predefined_type (pdt);
+
+// 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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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,
+ &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_value,
+ &ValueBase_name
+ );
+ m->fe_add_predefined_type (pdt);
+}
+
+// Populate idl_global's hash map with upper case versions of
+// all the IDL keywords
+void
+fe_populate_idl_keywords (void)
+{
+ static const char *keywords[] =
+ {
+ "ABSTRACT",
+ "ANY",
+ "ATTRIBUTE",
+ "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",
+ "SUPPORTS",
+ "SWITCH",
+ "TRUE",
+ "TRUNCATABLE",
+ "TYPEDEF",
+ "TYPEID",
+ "TYPEPREFIX",
+ "UNION",
+ "UNSIGNED",
+ "USES",
+ "VALUEBASE",
+ "VALUETYPE",
+ "VOID",
+ "WCHAR",
+ "WSTRING"
+ };
+
+ ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> &map =
+ idl_global->idl_keywords ();
+
+ u_long length = sizeof (keywords) / sizeof (char *);
+ ACE_CString ext_id;
+ int int_id = 0;
+
+ for (u_long i = 0; i < length; ++i)
+ {
+ ext_id.set (keywords[i],
+ 0);
+ (void) map.bind (ext_id,
+ int_id);
+ }
+}
+
+// FE initialization
+void
+FE_init (void)
+{
+ // 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 (true);
+ idl_global->set_in_main_file (false);
+ idl_global->set_lineno (-1);
+ idl_global->set_prog_name (0);
+
+ 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_compile_flags (0);
+ idl_global->set_include_file_names (0);
+ idl_global->set_n_include_file_names (0);
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ idl_global->preserve_cpp_keywords (false);
+
+ // Put an empty prefix on the stack for the global scope.
+ idl_global->pragma_prefixes ().push (ACE::strnew (""));
+}
+
+void
+FE_populate (void)
+{
+ AST_Root *r = 0;
+
+ // Check that the BE init created a generator object
+ if (idl_global->gen () == 0)
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: idl_global->gen() not initialized, exiting\n")
+ ));
+
+ throw FE_Bailout ();
+ }
+
+ // Create a global root for the AST. Note that the AST root has no 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)
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: FE init failed to create AST root, exiting\n")
+ ));
+
+ throw FE_Bailout ();
+ }
+
+ // Push it on the stack
+ idl_global->scopes ().push (idl_global->root ());
+
+ // Populate it with nodes for predefined types.
+ fe_populate_global_scope (idl_global->root ());
+
+ // Set flag to indicate we are processing the main file now.
+ idl_global->set_in_main_file (true);
+
+ // Populate the IDL keyword container, for checking local identifiers.
+ fe_populate_idl_keywords ();
+}
+
+// Store include paths from the environment variable, if any.
+void
+FE_store_env_include_paths (void)
+{
+ ACE_Env_Value<char*> incl_paths ("INCLUDE",
+ (char *) 0);
+ const char *aggr_str = incl_paths;
+
+ if (aggr_str != 0)
+ {
+ char separator;
+#if defined (ACE_WIN32)
+ separator = ';';
+#else
+ separator = ':';
+#endif
+ ACE_CString aggr_cstr (aggr_str);
+ ACE_CString::size_type pos;
+
+ do
+ {
+ pos = aggr_cstr.find (separator);
+ idl_global->add_include_path (aggr_cstr.substr (0, pos).fast_rep ());
+ aggr_cstr = aggr_cstr.substr (pos + 1);
+ } while (pos != ACE_CString::npos);
+ }
+}
+
+const char *
+FE_get_cpp_loc_from_env (void)
+{
+ const char *cpp_loc = 0;
+
+ // See if TAO_IDL_PREPROCESSOR is defined.
+ 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;
+ }
+ else
+ {
+ // Check for the deprecated CPP_LOCATION environment variable
+ ACE_Env_Value<char*> cpp_path ("CPP_LOCATION",
+ (char *) 0);
+
+ if (cpp_path != 0)
+ {
+ ACE_ERROR ((LM_WARNING,
+ "WARNING: The environment variable "
+ "CPP_LOCATION has been deprecated.\n"
+ " Please use TAO_IDL_PREPROCESSOR "
+ "instead.\n"));
+
+ cpp_loc = cpp_path;
+ }
+ else
+ {
+ cpp_loc = idl_global->cpp_location ();
+ }
+ }
+
+ return cpp_loc;
+}
+
+const char *
+FE_get_cpp_args_from_env (void)
+{
+ const char *cpp_args = 0;
+
+ // Added some customizable preprocessor options
+ ACE_Env_Value<char*> args1 ("TAO_IDL_PREPROCESSOR_ARGS",
+ (char *) 0);
+
+ if (args1 != 0)
+ {
+ cpp_args = args1;
+ }
+ else
+ {
+ // 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_WARNING,
+ "Warning: The environment variable "
+ "TAO_IDL_DEFAULT_CPP_FLAGS has been "
+ "deprecated.\n"
+ " Please use "
+ "TAO_IDL_PREPROCESSOR_ARGS instead.\n"));
+
+ cpp_args = args2;
+ }
+ }
+
+ return cpp_args;
+}
+
diff --git a/TAO/TAO_IDL/fe/fe_interface_header.cpp b/TAO/TAO_IDL/fe/fe_interface_header.cpp
new file mode 100644
index 00000000000..8095930cb8a
--- /dev/null
+++ b/TAO/TAO_IDL/fe/fe_interface_header.cpp
@@ -0,0 +1,1199 @@
+// $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.
+
+*/
+
+// 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_interface_fwd.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 "fe_extern.h"
+#include "global_extern.h"
+#include "nr_extern.h"
+
+ACE_RCSID (fe,
+ fe_interface_header,
+ "$Id$")
+
+#undef INCREMENT
+#define INCREMENT 512
+
+// Private storage used to store interfaces seen already in the
+// computation of the unique inheritance list.
+static AST_Interface **iseen = 0;
+static long iallocated = 0;
+static long iused = 0;
+
+// Same as above, but the list is flattened and
+// includes all ancestors, not just immediate ones.
+static AST_Interface **iseen_flat = 0;
+static long iallocated_flat = 0;
+static long iused_flat = 0;
+
+// Add an interface to an inheritance spec.
+static void
+add_inheritance (AST_Interface *i)
+{
+ AST_Interface **oiseen;
+
+ // Make sure there's space for one more.
+ if (iallocated == iused)
+ {
+ if (iallocated == 0)
+ {
+ iallocated = INCREMENT;
+
+ ACE_NEW (iseen,
+ AST_Interface *[iallocated]);
+ }
+ else
+ {
+ oiseen = iseen;
+ iallocated += INCREMENT;
+
+ ACE_NEW (iseen,
+ AST_Interface *[iallocated]);
+
+ for (long k = 0; k < iused; ++k)
+ {
+ iseen[k] = oiseen[k];
+ }
+
+ delete oiseen;
+ }
+ }
+
+ // OK, now insert it.
+ iseen[iused++] = i;
+}
+
+// Add an interface to the flat list.
+static void
+add_inheritance_flat (AST_Interface *i)
+{
+ AST_Interface **oiseen_flat;
+
+ // Make sure there's space for one more.
+ if (iallocated_flat == iused_flat)
+ {
+ if (iallocated_flat == 0)
+ {
+ iallocated_flat = INCREMENT;
+
+ ACE_NEW (iseen_flat,
+ AST_Interface *[iallocated_flat]);
+ }
+ else
+ {
+ oiseen_flat = iseen_flat;
+ iallocated_flat += INCREMENT;
+
+ ACE_NEW (iseen_flat,
+ AST_Interface *[iallocated_flat]);
+
+ for (long k = 0; k < iused_flat; k++)
+ {
+ iseen_flat[k] = oiseen_flat[k];
+ }
+
+ delete oiseen_flat;
+ }
+ }
+
+ // OK, now insert it.
+ iseen_flat[iused_flat++] = i;
+}
+
+// Have we already seen this interface?
+static long
+already_seen (AST_Interface *ip)
+{
+ for (long i = 0; i < iused; ++i)
+ {
+ if (iseen[i] == ip)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// Have we already seen this interface in the flat list?
+static long
+already_seen_flat (AST_Interface *ip)
+{
+ for (long i = 0; i < iused_flat; ++i)
+ {
+ if (iseen_flat[i] == ip)
+ {
+ return true;
+ }
+ }
+
+ return 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,
+ bool is_local,
+ bool is_abstract,
+ 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,
+ false);
+ }
+}
+
+FE_InterfaceHeader::~FE_InterfaceHeader (void)
+{
+}
+
+bool
+FE_InterfaceHeader::is_local (void) const
+{
+ return this->pd_is_local;
+}
+
+bool
+FE_InterfaceHeader::is_abstract (void) const
+{
+ return this->pd_is_abstract;
+}
+
+void
+FE_InterfaceHeader::destroy (void)
+{
+ if (0 != this->pd_interface_name)
+ {
+ this->pd_interface_name->destroy ();
+ delete this->pd_interface_name;
+ this->pd_interface_name = 0;
+ }
+}
+
+// Add this interface to the list of inherited if not already there.
+void
+FE_InterfaceHeader::compile_one_inheritance (AST_Interface *i)
+{
+ // Check for badly formed interface.
+ if (i == 0)
+ {
+ return;
+ }
+
+ // If we've seen it already then don't expand again.
+ if (already_seen (i))
+ {
+ return;
+ }
+
+ // OK, add i to the list of inherited interfaces.
+ add_inheritance (i);
+
+ // And add i to the flat list as well.
+ if (!already_seen_flat (i))
+ {
+ add_inheritance_flat (i);
+ }
+
+ // Add i's parents to the flat list.
+ AST_Interface **parents = i->inherits_flat ();
+ long num_parents = i->n_inherits_flat ();
+
+ for (long j = 0; j < num_parents; ++j)
+ {
+ AST_Interface *tmp = parents[j];
+
+ if (already_seen_flat (tmp))
+ {
+ continue;
+ }
+
+ add_inheritance_flat (tmp);
+ }
+}
+
+// Compute the list of top-level interfaces this one inherits from.
+void
+FE_InterfaceHeader::compile_inheritance (UTL_NameList *ifaces,
+ bool for_valuetype)
+{
+ if (ifaces == 0)
+ {
+ return;
+ }
+
+ AST_Decl *d = 0;
+ UTL_ScopedName *item = 0;;
+ AST_Interface *i = 0;
+ long j = 0;
+ long k = 0;
+ int inh_err = 0;
+
+ iused = 0;
+ iused_flat = 0;
+
+ // Compute expanded flattened non-repeating list of interfaces
+ // which this one inherits from.
+
+ for (UTL_NamelistActiveIterator l (ifaces); !l.is_done (); l.next ())
+ {
+ item = l.item ();
+
+ // Check that scope stack is valid.
+ if (idl_global->scopes ().top () == 0)
+ {
+ idl_global->err ()->lookup_error (item);
+
+ // This is probably the result of bad IDL.
+ // We will crash if we continue from here.
+ throw FE_Bailout ();
+ }
+
+ // Look it up.
+ UTL_Scope *s = idl_global->scopes ().top ();
+
+ d = s->lookup_by_name (item,
+ true,
+ true,
+ true); // full_def_only
+
+ // Undefined interface?
+ if (0 == d)
+ {
+ // If the lookup now succeeds, without the full_def_only
+ // constraint, it's an error.
+ d = s->lookup_by_name (item, true, true);
+
+ if (0 != d)
+ {
+ idl_global->err ()->inheritance_fwd_error (
+ this->pd_interface_name,
+ AST_Interface::narrow_from_decl (d)
+ );
+ break;
+ }
+ }
+
+ if (0 == d)
+ {
+ 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 (0 == d)
+ {
+ idl_global->err ()->lookup_error (item);
+
+ // This is probably the result of bad IDL.
+ // We will crash if we continue from here.
+ throw FE_Bailout ();
+ }
+
+ // Not an appropriate interface?
+ if (d->node_type () == AST_Decl::NT_typedef)
+ {
+ d = AST_Typedef::narrow_from_decl (d)->primitive_base_type ();
+ }
+
+ i = AST_Interface::narrow_from_decl (d);
+
+ if (i != 0)
+ {
+ inh_err = this->check_inherit (i,
+ for_valuetype);
+ }
+ else
+ {
+ inh_err = -1;
+ }
+
+ if (inh_err == -1)
+ {
+ idl_global->err ()->interface_expected (d);
+ break;
+ }
+
+ if (!for_valuetype && this->pd_is_abstract && !i->is_abstract ())
+ {
+ idl_global->err ()->abstract_inheritance_error (this->name (),
+ i->name ());
+ }
+
+ // 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).
+ if (iused_flat > 0)
+ {
+ 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;
+ }
+
+ // Then the list of immediate ancestors.
+ if (iused > 0)
+ {
+ ACE_NEW (this->pd_inherits,
+ AST_Interface *[iused]);
+
+ for (k = 0; k < iused; ++k)
+ {
+ this->pd_inherits[k] = iseen[k];
+ }
+
+ this->pd_n_inherits = iused;
+ }
+}
+
+int
+FE_InterfaceHeader::check_inherit (AST_Interface *i,
+ bool for_valuetype)
+{
+ // We use the narrow instead of node_type() here so we can get a
+ // match with both valuetypes and eventtypes.
+ bool is_valuetype = (AST_ValueType::narrow_from_decl (i) != 0);
+
+ 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;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+// Data accessors.
+
+UTL_ScopedName *
+FE_InterfaceHeader::name (void) const
+{
+ return this->pd_interface_name;
+}
+
+AST_Interface **
+FE_InterfaceHeader::inherits (void) const
+{
+ return this->pd_inherits;
+}
+
+long
+FE_InterfaceHeader::n_inherits (void) const
+{
+ return this->pd_n_inherits;
+}
+
+AST_Interface **
+FE_InterfaceHeader::inherits_flat (void) const
+{
+ return this->pd_inherits_flat;
+}
+
+long
+FE_InterfaceHeader::n_inherits_flat (void) const
+{
+ return this->pd_n_inherits_flat;
+}
+
+//************************************************************************
+
+FE_OBVHeader::FE_OBVHeader (UTL_ScopedName *n,
+ UTL_NameList *inherits,
+ UTL_NameList *supports,
+ bool truncatable,
+ bool is_eventtype)
+ : FE_InterfaceHeader (n,
+ inherits,
+ false,
+ false,
+ false),
+ pd_supports (0),
+ pd_n_supports (0),
+ pd_inherits_concrete (0),
+ pd_supports_concrete (0),
+ pd_truncatable (truncatable)
+{
+ this->compile_inheritance (inherits,
+ is_eventtype);
+
+ if (idl_global->err_count () == 0)
+ {
+ this->compile_supports (supports);
+ }
+}
+
+FE_OBVHeader::~FE_OBVHeader (void)
+{
+}
+
+AST_Interface **
+FE_OBVHeader::supports (void) const
+{
+ return this->pd_supports;
+}
+
+long
+FE_OBVHeader::n_supports (void) const
+{
+ return this->pd_n_supports;
+}
+
+AST_ValueType *
+FE_OBVHeader::inherits_concrete (void) const
+{
+ return this->pd_inherits_concrete;
+}
+
+AST_Interface *
+FE_OBVHeader::supports_concrete (void) const
+{
+ return this->pd_supports_concrete;
+}
+
+bool
+FE_OBVHeader::truncatable (void) const
+{
+ return this->pd_truncatable;
+}
+
+void
+FE_OBVHeader::compile_inheritance (UTL_NameList *vtypes,
+ bool is_eventtype)
+{
+ this->FE_InterfaceHeader::compile_inheritance (vtypes,
+ true);
+
+ if (this->pd_n_inherits > 0)
+ {
+ AST_Interface *iface = this->pd_inherits[0];
+ AST_ValueType *vt = AST_ValueType::narrow_from_decl (iface);
+
+ if (vt != 0
+ && vt->is_abstract () == false)
+ {
+ this->pd_inherits_concrete = vt;
+ }
+
+ if (! is_eventtype
+ && this->pd_inherits[0]->node_type () == AST_Decl::NT_eventtype)
+ {
+ idl_global->err ()->valuetype_expected (this->pd_inherits[0]);
+ }
+
+ 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 (! is_eventtype
+ && iface->node_type () == AST_Decl::NT_eventtype)
+ {
+ idl_global->err ()->valuetype_expected (iface);
+ }
+ }
+ }
+}
+
+void
+FE_OBVHeader::compile_supports (UTL_NameList *supports)
+{
+ if (supports == 0)
+ {
+ 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)
+ {
+ idl_global->err ()->lookup_error (item);
+
+ // This is probably the result of bad IDL.
+ // We will crash if we continue from here.
+ throw FE_Bailout ();
+ }
+
+ // Look it up.
+ UTL_Scope *s = idl_global->scopes ().top ();
+
+ d = s->lookup_by_name (item,
+ 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);
+
+ // This is probably the result of bad IDL.
+ // We will crash if we continue from here.
+ throw FE_Bailout ();
+ }
+
+ // 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;
+ }
+}
+
+bool
+FE_OBVHeader::check_concrete_supported_inheritance (AST_Interface *d)
+{
+ AST_ValueType *vt = 0;
+ AST_Interface *concrete = 0;
+ AST_Interface *ancestor = 0;
+
+ for (long i = 0; i < this->pd_n_inherits; ++i)
+ {
+ vt = AST_ValueType::narrow_from_decl (this->pd_inherits[i]);
+ concrete = vt->supports_concrete ();
+
+ if (0 == concrete)
+ {
+ return 0;
+ }
+
+ if (d == concrete)
+ {
+ return 0;
+ }
+
+ for (long j = 0; j < d->n_inherits_flat (); ++j)
+ {
+ ancestor = d->inherits_flat ()[j];
+
+ if (ancestor == concrete)
+ {
+ return 0;
+ }
+ }
+ }
+
+ return 1;
+}
+
+//************************************************************************
+
+FE_EventHeader::FE_EventHeader (UTL_ScopedName *n,
+ UTL_NameList *inherits,
+ UTL_NameList *supports,
+ bool truncatable)
+ : FE_OBVHeader (n,
+ inherits,
+ supports,
+ truncatable,
+ true)
+{
+}
+
+FE_EventHeader::~FE_EventHeader (void)
+{
+}
+
+//************************************************************************
+
+FE_ComponentHeader::FE_ComponentHeader (UTL_ScopedName *n,
+ UTL_ScopedName *base_component,
+ UTL_NameList *supports,
+ bool /* compile_now */)
+ : FE_InterfaceHeader (n,
+ supports,
+ false,
+ false,
+ false),
+ pd_base_component (0)
+{
+ if (base_component != 0 && supports != 0)
+ {
+ idl_global->err ()->derived_supports_error (n);
+ }
+ else
+ {
+ this->compile_inheritance (base_component);
+ this->compile_supports (supports);
+ }
+}
+
+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;
+}
+
+void
+FE_ComponentHeader::compile_inheritance (UTL_ScopedName *base_component)
+{
+ // 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;
+ }
+
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = s->lookup_by_name (base_component,
+ true);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (base_component);
+
+ // This is probably the result of bad IDL.
+ // We will crash if we continue from here.
+ throw FE_Bailout ();
+ }
+
+ if (d->node_type () == AST_Decl::NT_typedef)
+ {
+ d = AST_Typedef::narrow_from_decl (d)->primitive_base_type ();
+ }
+
+ 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
+ );
+ this->pd_base_component = 0;
+ }
+}
+
+void
+FE_ComponentHeader::compile_supports (UTL_NameList *supports)
+{
+ if (supports == 0)
+ {
+ return;
+ }
+
+ AST_Decl *d = 0;
+ UTL_ScopedName *item = 0;;
+ AST_Interface *i = 0;
+ long j = 0;
+ long k = 0;
+
+ iused = 0;
+ iused_flat = 0;
+
+ // Compute expanded flattened non-repeating list of interfaces
+ // which this one inherits from.
+
+ 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)
+ {
+ idl_global->err ()->lookup_error (item);
+
+ // This is probably the result of bad IDL.
+ // We will crash if we continue from here.
+ throw FE_Bailout ();
+ }
+
+ // Look it up.
+ UTL_Scope *s = idl_global->scopes ().top ();
+
+ d = s->lookup_by_name (item,
+ 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);
+
+ // This is probably the result of bad IDL.
+ // We will crash if we continue from here.
+ throw FE_Bailout ();
+ }
+
+ // Not an appropriate interface?
+ if (d->node_type () == AST_Decl::NT_typedef)
+ {
+ d = AST_Typedef::narrow_from_decl (d)->primitive_base_type ();
+ }
+
+ i = AST_Interface::narrow_from_decl (d);
+
+ // Not an interface?
+ if (i == 0 || i->node_type () != AST_Decl::NT_interface)
+ {
+ idl_global->err ()->interface_expected (d);
+ continue;
+ }
+
+ // Undefined interface?
+ if (!i->is_defined ())
+ {
+ idl_global->err ()->inheritance_fwd_error (this->pd_interface_name,
+ i);
+ continue;
+ }
+
+ // Local interface? (illegal for components to support).
+ if (i->is_local ())
+ {
+ idl_global->err ()->unconstrained_interface_expected (this->name (),
+ i->name ());
+ continue;
+ }
+
+ // 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).
+ if (iused_flat > 0)
+ {
+ 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;
+ }
+
+ // Then the list of immediate ancestors.
+ if (iused > 0)
+ {
+ ACE_NEW (this->pd_inherits,
+ AST_Interface *[iused]);
+
+ for (k = 0; k < iused; ++k)
+ {
+ this->pd_inherits[k] = iseen[k];
+ }
+
+ this->pd_n_inherits = iused;
+ }
+}
+
+//************************************************************************
+
+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,
+ 0,
+ supports,
+ false),
+ pd_base_home (0),
+ pd_primary_key (0)
+{
+ if (base_home != 0 && supports != 0)
+ {
+ idl_global->err ()->derived_supports_error (n);
+ }
+ else
+ {
+ // No need to call compile_supports(), it got done in
+ // the call to the base class FE_ComponentHeader.
+ this->compile_inheritance (base_home);
+ this->compile_managed_component (managed_component);
+ this->compile_primary_key (primary_key);
+ }
+}
+
+FE_HomeHeader::~FE_HomeHeader (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_managed_component;
+}
+
+AST_ValueType *
+FE_HomeHeader::primary_key (void) const
+{
+ return this->pd_primary_key;
+}
+
+void
+FE_HomeHeader::compile_inheritance (UTL_ScopedName *base_home)
+{
+ if (base_home == 0)
+ {
+ return;
+ }
+
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = s->lookup_by_name (base_home,
+ true);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (base_home);
+
+ // This is probably the result of bad IDL.
+ // We will crash if we continue from here.
+ throw FE_Bailout ();
+ }
+
+ if (d->node_type () == AST_Decl::NT_typedef)
+ {
+ d = AST_Typedef::narrow_from_decl (d)->primitive_base_type ();
+ }
+
+ this->pd_base_home = AST_Home::narrow_from_decl (d);
+
+ if (this->pd_base_home == 0)
+ {
+ idl_global->err ()->inheritance_error (this->name (),
+ d);
+ }
+}
+
+void
+FE_HomeHeader::compile_managed_component (UTL_ScopedName *managed_component)
+{
+ if (managed_component == 0)
+ {
+ return;
+ }
+
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = s->lookup_by_name (managed_component,
+ true);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (managed_component);
+
+ // This is probably the result of bad IDL.
+ // We will crash if we continue from here.
+ throw FE_Bailout ();
+ }
+
+ if (d->node_type () == AST_Decl::NT_typedef)
+ {
+ d = AST_Typedef::narrow_from_decl (d)->primitive_base_type ();
+ }
+
+ this->pd_managed_component = AST_Component::narrow_from_decl (d);
+
+ if (this->pd_managed_component == 0)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_USE,
+ d);
+ }
+}
+
+void
+FE_HomeHeader::compile_primary_key (UTL_ScopedName *primary_key)
+{
+ if (primary_key == 0)
+ {
+ return;
+ }
+
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = s->lookup_by_name (primary_key,
+ true);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (primary_key);
+
+ // This is probably the result of bad IDL.
+ // We will crash if we continue from here.
+ throw FE_Bailout ();
+ }
+
+ AST_Decl::NodeType nt = d->node_type ();
+
+ if (nt == AST_Decl::NT_typedef)
+ {
+ d = AST_Typedef::narrow_from_decl (d)->primitive_base_type ();
+ }
+
+ this->pd_primary_key = AST_ValueType::narrow_from_decl (d);
+
+ if (this->pd_primary_key == 0 || nt != AST_Decl::NT_valuetype)
+ {
+ idl_global->err ()->valuetype_expected (d);
+ }
+}
+
diff --git a/TAO/TAO_IDL/fe/fe_lookup.cpp b/TAO/TAO_IDL/fe/fe_lookup.cpp
new file mode 100644
index 00000000000..2adb243ee60
--- /dev/null
+++ b/TAO/TAO_IDL/fe/fe_lookup.cpp
@@ -0,0 +1,195 @@
+// $Id$
+
+#include "fe_private.h"
+#include "ace/OS_NS_string.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 */
+unsigned int
+TAO_IDL_CPP_Keyword_Table::hash (const char *str, unsigned int len)
+{
+ static const unsigned char asso_values[] =
+ {
+ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
+ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
+ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
+ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
+ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
+ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
+ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
+ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
+ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
+ 252, 252, 252, 252, 252, 252, 252, 15, 35, 65,
+ 0, 0, 35, 5, 0, 60, 252, 0, 30, 0,
+ 5, 5, 20, 50, 40, 20, 110, 0, 45, 35,
+ 95, 55, 252, 252, 252, 252, 252, 252,
+ };
+ return len + asso_values[(int) str[1]] + asso_values[(int) str[0]] + asso_values[(int) str[len - 1]];
+}
+
+const TAO_IDL_CPP_Keyword_Entry *
+TAO_IDL_CPP_Keyword_Table::lookup (const char *str, unsigned int len)
+{
+ enum
+ {
+ TOTAL_KEYWORDS = 74,
+ MIN_WORD_LENGTH = 2,
+ MAX_WORD_LENGTH = 16,
+ MIN_HASH_VALUE = 6,
+ MAX_HASH_VALUE = 251,
+ HASH_VALUE_RANGE = 246,
+ DUPLICATES = 0
+ };
+
+ static const TAO_IDL_CPP_Keyword_Entry wordlist[] =
+ {
+ {"",0}, {"",0}, {"",0}, {"",0}, {"",0}, {"",0},
+ {"delete", "_cxx_delete"},
+ {"mutable", "_cxx_mutable"},
+ {"",0},
+ {"enum", "_cxx_enum"},
+ {"",0},
+ {"double", "_cxx_double"},
+ {"do", "_cxx_do"},
+ {"unsigned", "_cxx_unsigned"},
+ {"",0},
+ {"union", "_cxx_union"},
+ {"",0}, {"",0}, {"",0},
+ {"goto", "_cxx_goto"},
+ {"",0}, {"",0}, {"",0},
+ {"and", "_cxx_and"},
+ {"auto", "_cxx_auto"},
+ {"",0}, {"",0}, {"",0}, {"",0},
+ {"namespace", "_cxx_namespace"},
+ {"using", "_cxx_using"},
+ {"",0}, {"",0}, {"",0},
+ {"else", "_cxx_else"},
+ {"",0}, {"",0}, {"",0},
+ {"asm", "_cxx_asm"},
+ {"",0},
+ {"while", "_cxx_while"},
+ {"",0}, {"",0},
+ {"new", "_cxx_new"},
+ {"long", "_cxx_long"},
+ {"",0}, {"",0}, {"",0}, {"",0}, {"",0}, {"",0},
+ {"return", "_cxx_return"},
+ {"",0}, {"",0},
+ {"void", "_cxx_void"},
+ {"false", "_cxx_false"},
+ {"",0}, {"",0},
+ {"volatile", "_cxx_volatile"},
+ {"",0}, {"",0},
+ {"switch", "_cxx_switch"},
+ {"",0}, {"",0}, {"",0}, {"",0},
+ {"not_eq", "_cxx_not_eq"},
+ {"private", "_cxx_private"},
+ {"",0},
+ {"protected", "_cxx_protected"},
+ {"",0},
+ {"inline", "_cxx_inline"},
+ {"",0},
+ {"operator", "_cxx_operator"},
+ {"bool", "_cxx_bool"},
+ {"",0},
+ {"and_eq", "_cxx_and_eq"},
+ {"",0},
+ {"continue", "_cxx_continue"},
+ {"",0},
+ {"break", "_cxx_break"},
+ {"friend", "_cxx_friend"},
+ {"",0},
+ {"for", "_cxx_for"},
+ {"case", "_cxx_case"},
+ {"catch", "_cxx_catch"},
+ {"signed", "_cxx_signed"},
+ {"or", "_cxx_or"},
+ {"register", "_cxx_register"},
+ {"",0}, {"",0},
+ {"public", "_cxx_public"},
+ {"",0}, {"",0}, {"",0}, {"",0}, {"",0}, {"",0}, {"",0}, {"",0},
+ {"or_eq", "_cxx_or_eq"},
+ {"bitand", "_cxx_bitand"},
+ {"",0}, {"",0}, {"",0},
+ {"compl", "_cxx_compl"},
+ {"extern", "_cxx_extern"},
+ {"",0}, {"",0},
+ {"char", "_cxx_char"},
+ {"",0}, {"",0}, {"",0}, {"",0}, {"",0}, {"",0}, {"",0},
+ {"default", "_cxx_default"},
+ {"template", "_cxx_template"},
+ {"",0},
+ {"class", "_cxx_class"},
+ {"sizeof", "_cxx_sizeof"},
+ {"",0},
+ {"not", "_cxx_not"},
+ {"",0}, {"",0}, {"",0}, {"",0}, {"",0}, {"",0}, {"",0}, {"",0},
+ {"if", "_cxx_if"},
+ {"",0},
+ {"this", "_cxx_this"},
+ {"short", "_cxx_short"},
+ {"",0}, {"",0}, {"",0}, {"",0},
+ {"bitor", "_cxx_bitor"},
+ {"",0},
+ {"virtual", "_cxx_virtual"},
+ {"xor", "_cxx_xor"},
+ {"",0}, {"",0}, {"",0}, {"",0}, {"",0}, {"",0},
+ {"throw", "_cxx_throw"},
+ {"",0}, {"",0}, {"",0},
+ {"true", "_cxx_true"},
+ {"",0},
+ {"xor_eq", "_cxx_xor_eq"},
+ {"",0}, {"",0}, {"",0}, {"",0}, {"",0}, {"",0}, {"",0}, {"",0}, {"",0},
+ {"reinterpret_cast", "_cxx_reinterpret_cast"},
+ {"",0}, {"",0}, {"",0}, {"",0},
+ {"typeid", "_cxx_typeid"},
+ {"",0},
+ {"typename", "_cxx_typename"},
+ {"",0}, {"",0}, {"",0},
+ {"dynamic_cast", "_cxx_dynamic_cast"},
+ {"int", "_cxx_int"},
+ {"",0},
+ {"float", "_cxx_float"},
+ {"",0}, {"",0}, {"",0}, {"",0},
+ {"const", "_cxx_const"},
+ {"",0}, {"",0}, {"",0}, {"",0},
+ {"const_cast", "_cxx_const_cast"},
+ {"",0}, {"",0}, {"",0}, {"",0}, {"",0}, {"",0}, {"",0}, {"",0}, {"",0},
+ {"",0},
+ {"static", "_cxx_static"},
+ {"",0}, {"",0}, {"",0}, {"",0}, {"",0},
+ {"typedef", "_cxx_typedef"},
+ {"try", "_cxx_try"},
+ {"",0}, {"",0},
+ {"export", "_cxx_export"},
+ {"",0},
+ {"explicit", "_cxx_explicit"},
+ {"",0}, {"",0}, {"",0},
+ {"wchar_t", "_cxx_wchar_t"},
+ {"",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},
+ {"struct", "_cxx_struct"},
+ {"",0}, {"",0}, {"",0}, {"",0},
+ {"static_cast", "_cxx_static_cast"},
+ };
+
+ if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
+ {
+ unsigned int key = hash (str, len);
+
+ if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE)
+ {
+ if (len == static_cast<unsigned int> (ACE_OS::strlen (wordlist[key].keyword_)))
+ {
+ const char *s = wordlist[key].keyword_;
+
+ if (*str == *s && !ACE_OS::strncmp (str + 1, s + 1, len - 1))
+ return &wordlist[key];
+ }
+ }
+ }
+ return 0;
+}
+/* ending time is 2:40:07 */
diff --git a/TAO/TAO_IDL/fe/fe_private.cpp b/TAO/TAO_IDL/fe/fe_private.cpp
new file mode 100644
index 00000000000..2df2edca523
--- /dev/null
+++ b/TAO/TAO_IDL/fe/fe_private.cpp
@@ -0,0 +1,74 @@
+// $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.
+
+*/
+
+#include "fe_private.h"
+#include "utl_strlist.h"
+
+ACE_RCSID (fe,
+ fe_private,
+ "$Id$")
+
+UTL_StrList *DRV_global_pragmas = 0;
diff --git a/TAO/TAO_IDL/fe/idl.ll b/TAO/TAO_IDL/fe/idl.ll
new file mode 100644
index 00000000000..79d43f00691
--- /dev/null
+++ b/TAO/TAO_IDL/fe/idl.ll
@@ -0,0 +1,1090 @@
+%{
+/* $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.
+
+IDL_INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
+IDL_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.
+
+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.
+
+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
+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.
+
+ */
+
+/*
+ * idl.ll - Lexical scanner for IDL 1.1
+ */
+
+#include "idl_uns_long.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 "ast_root.h"
+#include "fe_interface_header.h"
+#include "global_extern.h"
+#include "fe_private.h"
+#include "fe_extern.h"
+#include "nr_extern.h"
+#include "y.tab.h"
+
+static char * idl_wstring_escape_reader (char *);
+static ACE_CDR::WChar idl_wchar_escape_reader (char *);
+static char idl_escape_reader (char *);
+static double idl_atof (char *);
+static long idl_atoi (char *, long);
+static idl_uns_long idl_atoui (char *, long);
+static void idl_parse_line_and_file (char *);
+static void idl_store_pragma (char *);
+static char * idl_get_pragma_string (char *);
+static idl_bool idl_valid_version (char *);
+static AST_Decl * idl_find_node (char *);
+
+#define ace_yytext yytext
+
+%}
+
+/* SO we don't choke on files that use \r\n */
+NL [\r?\n]
+
+%array
+%option never-interactive
+
+%%
+
+any return IDL_ANY;
+Object return IDL_OBJECT;
+module return IDL_MODULE;
+raises return IDL_RAISES;
+readonly return IDL_READONLY;
+attribute return IDL_ATTRIBUTE;
+exception return IDL_EXCEPTION;
+context return IDL_CONTEXT;
+interface return IDL_INTERFACE;
+const return IDL_CONST;
+typedef return IDL_TYPEDEF;
+struct return IDL_STRUCT;
+enum return IDL_ENUM;
+string return IDL_STRING;
+wstring return IDL_WSTRING;
+sequence return IDL_SEQUENCE;
+union return IDL_UNION;
+fixed return IDL_FIXED;
+switch return IDL_SWITCH;
+case return IDL_CASE;
+default return IDL_DEFAULT;
+float return IDL_FLOAT;
+double return IDL_DOUBLE;
+long return IDL_LONG;
+short return IDL_SHORT;
+unsigned return IDL_UNSIGNED;
+char return IDL_CHAR;
+wchar return IDL_WCHAR;
+boolean return IDL_BOOLEAN;
+octet return IDL_OCTET;
+void return IDL_VOID;
+native return IDL_NATIVE;
+local return IDL_LOCAL;
+abstract return IDL_ABSTRACT;
+custom return IDL_CUSTOM;
+factory return IDL_FACTORY;
+private return IDL_PRIVATE;
+public return IDL_PUBLIC;
+supports return IDL_SUPPORTS;
+truncatable return IDL_TRUNCATABLE;
+valuetype return IDL_VALUETYPE;
+component return IDL_COMPONENT;
+consumes return IDL_CONSUMES;
+emits return IDL_EMITS;
+eventtype return IDL_EVENTTYPE;
+finder return IDL_FINDER;
+getraises return IDL_GETRAISES;
+home return IDL_HOME;
+import return IDL_IMPORT;
+multiple return IDL_MULTIPLE;
+primarykey return IDL_PRIMARYKEY;
+provides return IDL_PROVIDES;
+publishes return IDL_PUBLISHES;
+setraises return IDL_SETRAISES;
+typeid return IDL_TYPEID;
+typeprefix return IDL_TYPEPREFIX;
+uses return IDL_USES;
+manages return IDL_MANAGES;
+
+TRUE return IDL_TRUETOK;
+FALSE return IDL_FALSETOK;
+
+inout return IDL_INOUT;
+in return IDL_IN;
+out return IDL_OUT;
+oneway return IDL_ONEWAY;
+
+\<\< return IDL_LEFT_SHIFT;
+\>\> return IDL_RIGHT_SHIFT;
+\:\: {
+ yylval.strval = ACE::strnew ("::");
+ return IDL_SCOPE_DELIMITOR;
+ }
+
+[a-ij-rs-zA-IJ-RS-Z_][a-ij-rs-zA-IJ-RS-Z0-9_]* {
+ // 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++
+ // keyword and grab the mapping. BTW, the reason for the odd
+ // regular expression is to handle EBCDIC, as well as ASCII.
+
+ TAO_IDL_CPP_Keyword_Table cpp_key_tbl;
+ const TAO_IDL_CPP_Keyword_Entry *entry = 0;
+ if (!idl_global->preserve_cpp_keywords())
+ {
+ // This check will ensure that escaped C++ keywords will be
+ // caught and prepended with '_cxx' as non-escaped keywords
+ // are now prepended with '_cxx_'.
+ const char *tmp =
+ ace_yytext[0] == '_' ? ace_yytext + 1 : ace_yytext;
+
+ entry =
+ cpp_key_tbl.lookup (tmp,
+ static_cast<unsigned int> (ACE_OS::strlen (tmp)));
+ }
+
+ if (entry)
+ {
+ yylval.strval = ACE::strnew (entry->mapping_);
+ }
+ else
+ {
+ yylval.strval = ACE:strnew (ace_yytext);
+ }
+
+ return IDENTIFIER;
+}
+
+"-"?(([0-9]+"."[0-9]*)|("."[0-9]+))([eE][+-]?[0-9]+)?[lLfF]? {
+ yylval.dval = idl_atof(ace_yytext);
+ return IDL_FLOATING_PT_LITERAL;
+ }
+"-"?[0-9]+[eE][+-]?[0-9]+[lLfF]? {
+ yylval.dval = idl_atof(ace_yytext);
+ return IDL_FLOATING_PT_LITERAL;
+ }
+
+"-"[1-9][0-9]* {
+ yylval.ival = idl_atoi(ace_yytext, 10);
+ return IDL_INTEGER_LITERAL;
+ }
+[1-9][0-9]* {
+ yylval.uival = idl_atoui(ace_yytext, 10);
+ return IDL_UINTEGER_LITERAL;
+ }
+"-"0[xX][a-fA-F0-9]+ {
+ yylval.ival = idl_atoi(ace_yytext, 16);
+ return IDL_INTEGER_LITERAL;
+ }
+0[xX][a-fA-F0-9]+ {
+ yylval.uival = idl_atoui(ace_yytext, 16);
+ return IDL_UINTEGER_LITERAL;
+ }
+"-"0[0-7]* {
+ yylval.ival = idl_atoi(ace_yytext, 8);
+ return IDL_INTEGER_LITERAL;
+ }
+0[0-7]* {
+ yylval.uival = idl_atoui(ace_yytext, 8);
+ return IDL_UINTEGER_LITERAL;
+ }
+
+(\"([^\\\"]*|\\[ntvbrfax\\\?\'\"]|\\[0-7]{1,3})*\"[ \t]*)+ {
+ /* Skip the quotes */
+ char *tmp = ace_yytext;
+ for(int i = ACE_OS::strlen(tmp) - 1; i >= 0; --i) {
+ if (isspace(tmp[i])) {
+ tmp[i] = '\0';
+ }
+ else {
+ break;
+ }
+ }
+ tmp[ACE_OS::strlen (tmp) - 1] = '\0';
+ ACE_NEW_RETURN (yylval.sval,
+ UTL_String (tmp + 1),
+ IDL_STRING_LITERAL);
+ return IDL_STRING_LITERAL;
+ }
+(L\"([^\\\"]*|\\[ntvbrfax\\\?\'\"]|\\[0-7]{1,3}|\\u([0-9a-fA-F]{1,4}))*\"[ \t]*)+ {
+ /* Skip the bookends */
+ char *tmp = ACE_OS::strdup (ace_yytext);
+ for(int i = ACE_OS::strlen(tmp) - 1; i >= 0; --i) {
+ if (isspace(tmp[i])) {
+ tmp[i] = '\0';
+ }
+ else {
+ break;
+ }
+ }
+ tmp[ACE_OS::strlen (tmp) - 1] = '\0';
+ yylval.wsval = idl_wstring_escape_reader(tmp + 2);
+ return IDL_WSTRING_LITERAL;
+ }
+"'"."'" {
+ yylval.cval = ace_yytext [1];
+ return IDL_CHARACTER_LITERAL;
+ }
+"'"\\([0-7]{1,3})"'" {
+ // octal character constant
+ yylval.cval = idl_escape_reader(ace_yytext + 1);
+ return IDL_CHARACTER_LITERAL;
+ }
+"'"\\[xX]([0-9a-fA-F]{1,2})"'" {
+ // hexadecimal character constant
+ yylval.cval = idl_escape_reader(ace_yytext + 1);
+ return IDL_CHARACTER_LITERAL;
+ }
+"'"\\."'" {
+ yylval.cval = idl_escape_reader(ace_yytext + 1);
+ return IDL_CHARACTER_LITERAL;
+ }
+L"'"."'" {
+ // wide character constant
+ yylval.wcval = ace_yytext [2];
+ return IDL_WCHAR_LITERAL;
+ }
+L"'"\\u([0-9a-fA-F]{1,4})"'" {
+ // hexadecimal wide character constant
+ yylval.wcval = idl_wchar_escape_reader(ace_yytext + 2);
+ return IDL_WCHAR_LITERAL;
+ }
+^[ \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} {/* ignore file */
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ }
+^[ \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]*#[ \t]*[0-9]*" ""\""[^\"]*"\""{NL} |
+^\?\?=[ \t]*[0-9]*" ""\""[^\"]*"\""{NL} {
+ idl_parse_line_and_file(ace_yytext);
+ }
+^[ \t]*#line[ \t]*[0-9]+[ \t]*("\""[^\"]*"\"")?{NL} |
+^\?\?=line[ \t]*[0-9]*" ""\""[^\"]*"\""{NL} {
+ idl_parse_line_and_file(ace_yytext);
+ }
+^[ \t]*#[ \t]*[0-9]*{NL} |
+^\?\?=[ \t]*[0-9]*{NL} {
+ idl_parse_line_and_file(ace_yytext);
+ }
+^[ \t]*#[ \t]*ident[ \t].*{NL} |
+^\?\?=[ \t]*ident[ \t].*{NL} {
+ /* ignore cpp ident */
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ }
+\/\/.*{NL} {
+ /* ignore comments */
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ }
+"/*" {
+ for(;;) {
+ char c = yyinput();
+ if (c == '*') {
+ char next = yyinput();
+ if (next == '/')
+ break;
+ else
+ yyunput(c, NULL);
+ if (c == '\n')
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ }
+ }
+ }
+[ \t]* ;
+{NL} {
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ }
+. return ace_yytext [0];
+
+%%
+ /* subroutines */
+
+// Parse a #line statement generated by the C preprocessor
+static void
+idl_parse_line_and_file (char *buf)
+{
+ char *r = buf;
+ char *h = 0;
+ UTL_String *nm = 0;
+
+ // Skip initial '#'.
+ if (*r != '#')
+ {
+ return;
+ }
+ else
+ {
+ r++;
+ }
+
+ // Check to see if we're running under the screwy Microsoft scheme
+ // of putting #line num instead of #num.
+
+ if (ACE_OS::strncmp (r, "line", 4) == 0)
+ {
+ r += 5;
+ }
+
+ // Find line number.
+ while (isspace (*r))
+ {
+ r++;
+ }
+
+ h = r;
+
+ for (; isdigit (*r); r++)
+ {
+ continue;
+ }
+
+ *r++ = 0;
+ idl_global->set_lineno ((long) idl_atoui (h, 10));
+
+ // Find file name, if present.
+ for (; *r != '"'; r++)
+ {
+ if (*r == '\n' || *r == '\0')
+ {
+ return;
+ }
+ }
+
+ h = ++r;
+
+ for (; *r != '"'; r++)
+ {
+ continue;
+ }
+
+ *r = 0;
+ UTL_String *tmp = 0;
+
+ if (*h == '\0')
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("IDL: No input files\n")));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+ else
+ {
+ long i;
+ long j;
+
+ // Put Microsoft-style pathnames into a canonical form.
+ for (i = 0, j = 0; h[j] != '\0'; i++, j++)
+ {
+ if (h[j] == '\\' && h[j + 1] == '\\')
+ {
+ j++;
+ }
+
+ h[i] = h[j];
+ }
+
+ h[i] = '\0';
+ ACE_NEW (tmp,
+ UTL_String (h));
+ idl_global->update_prefix (tmp->get_string ());
+ idl_global->set_filename (tmp);
+ }
+
+ UTL_String *fname = idl_global->filename ();
+ idl_bool in_main_file = I_FALSE;
+ idl_bool is_real_filename = fname->compare (idl_global->real_filename ());
+ idl_bool is_main_filename = I_FALSE;
+
+ if (!is_real_filename)
+ {
+ is_main_filename = fname->compare (idl_global->main_filename ());
+ }
+
+ if (is_real_filename || is_main_filename)
+ {
+ in_main_file = I_TRUE;
+ }
+
+ idl_global->set_in_main_file (in_main_file);
+
+ // Strip off any command line -I prefix that may have been added
+ // by the preprocessor.
+ if (!(idl_global->in_main_file ()) && idl_global->import ())
+ {
+ ACE_NEW (
+ nm,
+ UTL_String (
+ idl_global->stripped_preproc_include (fname->get_string ())
+ )
+ );
+
+ // This call also manages the #pragma prefix.
+ idl_global->store_include_file_name (nm);
+ }
+}
+
+// Store a #pragma line into the list of pragmas
+static void
+idl_store_pragma (char *buf)
+{
+ char *sp = buf + 1;
+ int crunched = 0;
+
+ // Remove all the blanks between the '#' and the 'pragma'.
+ while (*sp != 'p')
+ {
+ ++sp;
+ ++crunched;
+ }
+
+ char *tp = buf + 1;
+
+ // This copies the crunched string back to the original, and
+ // also compensates for the behavior of the Sun preprocessor,
+ // which put spaces around the double colons of a non-quoted
+ // scoped name, a case which is possible in #pragma version.
+ // Also eats whitespace, which some preprocessors (for example
+ // Intel) don't automatically do.
+ while (*sp != '\n')
+ {
+ if (*sp == ' ' && (*(sp + 1) == ':' || *(sp + 1) == ' '))
+ {
+ ++crunched;
+ }
+ else if (*sp == ':' && *(sp + 1) == ' ')
+ {
+ *tp = *sp;
+ ++crunched;
+ ++sp;
+ ++tp;
+ }
+ else
+ {
+ *tp = *sp;
+ ++tp;
+ }
+
+ ++sp;
+ }
+
+ // The '\n' is still <crunched> spaces too far away, with
+ // garbage characters in between.
+ sp -= crunched;
+ *sp = '\0';
+
+ if (ACE_OS::strstr (buf + 8, "import") != 0)
+ {
+ idl_global->set_import (I_TRUE);
+ return;
+ }
+
+ if (ACE_OS::strstr (buf + 8, "include") != 0)
+ {
+ idl_global->set_import (I_FALSE);
+ return;
+ }
+
+ if (ACE_OS::strncmp (buf + 8, "prefix", 6) == 0)
+ {
+ char *new_prefix = idl_get_pragma_string (buf);
+
+ if (new_prefix != 0)
+ {
+ 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 ())
+ {
+ char *trash = 0;
+ idl_global->pragma_prefixes ().pop (trash);
+ delete [] trash;
+ }
+
+ UTL_Scope *top_scope = idl_global->scopes ().top ();
+
+ if (depth > 1)
+ {
+ top_scope->has_prefix (I_TRUE);
+ ScopeAsDecl (top_scope)->prefix_scope (top_scope);
+ }
+
+ idl_global->pragma_prefixes ().push (new_prefix);
+
+ if (idl_global->in_main_file ())
+ {
+ idl_global->root ()->prefix (new_prefix);
+ idl_global->root ()->set_imported (I_FALSE);
+ top_scope->has_prefix (I_TRUE);
+ }
+
+ ACE_CString ext_id;
+ ext_id.set (idl_global->filename ()->get_string (),
+ 0);
+ char *int_id = ACE::strnew (new_prefix);
+ (void) idl_global->file_prefixes ().rebind (ext_id,
+ int_id);
+ }
+ }
+ else if (ACE_OS::strncmp (buf + 8, "version", 7) == 0)
+ {
+ char *tmp = buf + 16;
+
+ while (*tmp == ' ' || *tmp == '\t')
+ {
+ ++tmp;
+ }
+
+ char *number = ACE_OS::strchr (tmp, ' ');
+
+ if (number == 0)
+ {
+ number = ACE_OS::strchr (tmp, '\t');
+ }
+
+ while (*number == ' ' || *number == '\t')
+ {
+ ++number;
+ }
+
+ size_t len = ACE_OS::strlen (number);
+
+ // For some reason, the SunCC preprocessor adds a trailing space, which
+ // messes with idl_valid_version() below, so we check and remove.
+ while (number[len - 1] == ' ')
+ {
+ number[len - 1] = '\0';
+ len = ACE_OS::strlen (number);
+ }
+
+ // This call adds a proper null terminator to tmp, so no need to
+ // do it here.
+ AST_Decl *d = idl_find_node (tmp);
+
+ if (d == 0)
+ {
+ return;
+ }
+
+ if (!idl_valid_version (number))
+ {
+ idl_global->err ()->version_number_error (number);
+ return;
+ }
+
+ d->version (ACE::strnew (number));
+ }
+ else if (ACE_OS::strncmp (buf + 8, "ident", 5) == 0)
+ {
+ idl_global->ident_string (buf + 8);
+ }
+ else if (ACE_OS::strncmp (buf + 8, "ID", 2) == 0)
+ {
+ char *tmp = buf + 11;
+
+ while (*tmp == ' ')
+ {
+ ++tmp;
+ }
+
+ AST_Decl *d = idl_find_node (tmp);
+
+ if (d == 0)
+ {
+ return;
+ }
+
+ char *new_id = idl_get_pragma_string (buf);
+
+ if (new_id != 0)
+ {
+ if (d->typeid_set ())
+ {
+ idl_global->err ()->id_reset_error (d->repoID (),
+ new_id);
+ return;
+ }
+
+ d->repoID (new_id);
+ d->typeid_set (I_TRUE);
+ }
+ }
+ else if (ACE_OS::strncmp (buf + 8, "DCPS_DATA_TYPE", 14) == 0)
+ {
+ char *foo_type = idl_get_pragma_string (buf);
+ idl_global->add_dcps_data_type(foo_type);
+ }
+ else if (ACE_OS::strncmp (buf + 8, "DCPS_DATA_KEY", 13) == 0)
+ {
+ char *tmp = idl_get_pragma_string (buf);
+
+ // split up data type and key strings
+ char *foo_type = tmp;
+ while (*tmp && !isspace(*tmp))
+ tmp++;
+ while (isspace(*tmp))
+ {
+ *tmp = '\0';
+ tmp++;
+ }
+ char *key = tmp;
+
+ if (!idl_global->add_dcps_data_key(foo_type, key))
+ {
+ ACE_ERROR((LM_ERROR, "DCPS_DATA_TYPE \"%s\" not found for key \"%s\"\n",
+ foo_type, key));
+ }
+ }
+}
+
+/*
+ * idl_atoi - Convert a string of digits into a negative integer according to base b
+ */
+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;
+}
+
+/*
+ * idl_atoui - Convert a string of digits into an unsigned integer according to base b
+ */
+static idl_uns_long
+idl_atoui(char *s, long b)
+{
+ idl_uns_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;
+}
+
+/*
+ * Convert a string to a float; atof doesn't seem to work, always.
+ */
+static double
+idl_atof (char *s)
+{
+ double d = 0.0;
+ double e, k;
+ long neg = 0, negexp = 0;
+
+ 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;
+ }
+
+ return d;
+}
+
+/*
+ * Convert (some) escaped characters into their ascii values
+ */
+static char
+idl_escape_reader(
+ char *str
+ )
+{
+ if (str[0] != '\\')
+ {
+ return str[0];
+ }
+
+ switch (str[1])
+ {
+ case 'n':
+ return '\n';
+ case 't':
+ return '\t';
+ case 'v':
+ return '\v';
+ case 'b':
+ return '\b';
+ case 'r':
+ return '\r';
+ case 'f':
+ return '\f';
+ case 'a':
+ return '\a';
+ case '\\':
+ return '\\';
+ case '\?':
+ return '?';
+ case '\'':
+ return '\'';
+ case '"':
+ 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;)
+ 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;)
+ }
+}
+/*
+ * Convert escaped hex digits into a wchar
+ */
+static ACE_CDR::WChar
+idl_wchar_escape_reader (char *str)
+{
+ if (str[0] != '\\' || str[1] != 'u')
+ {
+ return 0;
+ }
+
+ int i;
+ // get the hex digits
+ for (i = 2; str[i] != '\0' && isxdigit (str[i]); i++)
+ {
+ continue;
+ }
+ char save = str[i];
+ str[i] = '\0';
+ ACE_CDR::WChar out = (ACE_CDR::WChar) idl_atoui (&str[2], 16);
+ str[i] = save;
+ return out;
+}
+
+/*
+ * Checks wstring for validity
+ */
+static char *
+idl_wstring_escape_reader (char *str)
+{
+ return str;
+}
+
+static char *
+idl_get_pragma_string (char *pragma)
+{
+ // Get pointers to each end of the substring between the quotes.
+ const char *start = ACE_OS::strchr (pragma, '"') + 1;
+ const char *end = ACE_OS::strchr (start, '"');
+
+ if (end == 0)
+ {
+ idl_global->err ()->syntax_error (
+ IDL_GlobalData::PS_PragmaPrefixSyntax
+ );
+
+ return 0;
+ }
+
+ int len = end - start;
+ char *retval = 0;
+
+ ACE_NEW_RETURN (retval,
+ char[len + 1],
+ 0);
+
+ ACE_OS::strncpy (retval,
+ start,
+ len);
+
+ retval[len] = '\0';
+ return retval;
+}
+
+static idl_bool
+idl_valid_version (char *s)
+{
+ // Nothing preceding decimal point.
+ if (*s == '.')
+ {
+ return 0;
+ }
+
+ char *minor = ACE_OS::strchr (s, '.');
+ int i;
+
+ if (minor == 0)
+ {
+ // No decimal point.
+ return 0;
+ }
+
+ if (*(minor + 1) == '\0')
+ {
+ // Nothing following decimal point.
+ return 0;
+ }
+
+ char *tmp = minor + 1;
+
+ for (i = 0; tmp[i] != '\0'; ++i)
+ {
+ if (!isdigit (tmp[i]))
+ {
+ return 0;
+ }
+ }
+
+ int len = minor - s;
+
+ for (i = 0; i < len; ++i)
+ {
+ if (!isdigit (s[i]))
+ {
+ return 0;
+ }
+ }
+
+ // Major and minor version numbers must be unsigned shorts.
+ if (ACE_OS::atoi (minor + 1) > ACE_UINT16_MAX
+ || ACE_OS::atoi (s) > ACE_UINT16_MAX)
+ {
+ return 0;
+ }
+
+ return 1;
+}
+
+static AST_Decl *
+idl_find_node (char *s)
+{
+ UTL_ScopedName *node = idl_global->string_to_scoped_name (s);
+ AST_Decl *d = 0;
+
+ if (node != 0)
+ {
+ d = idl_global->scopes ().top_non_null ()->lookup_by_name (node,
+ I_TRUE);
+ }
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (node);
+ node->destroy ();
+ delete node;
+ node = 0;
+ }
+
+ return d;
+}
diff --git a/TAO/TAO_IDL/fe/idl.yy b/TAO/TAO_IDL/fe/idl.yy
new file mode 100644
index 00000000000..139048eb2be
--- /dev/null
+++ b/TAO/TAO_IDL/fe/idl.yy
@@ -0,0 +1,5709 @@
+/* $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 whichlong
+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.
+
+ */
+
+/*
+ * idl.yy - YACC grammar for IDL 1.1
+ */
+
+/* Declarations */
+
+%{
+#include "ast_argument.h"
+#include "ast_array.h"
+#include "ast_attribute.h"
+#include "ast_field.h"
+#include "ast_expression.h"
+#include "ast_operation.h"
+#include "ast_generator.h"
+#include "ast_module.h"
+#include "ast_valuebox.h"
+#include "ast_valuetype.h"
+#include "ast_valuetype_fwd.h"
+#include "ast_eventtype.h"
+#include "ast_eventtype_fwd.h"
+#include "ast_component.h"
+#include "ast_component_fwd.h"
+#include "ast_home.h"
+#include "ast_constant.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 "fe_declarator.h"
+#include "fe_interface_header.h"
+#include "utl_identifier.h"
+#include "utl_err.h"
+#include "utl_string.h"
+#include "utl_strlist.h"
+#include "utl_namelist.h"
+#include "utl_exprlist.h"
+#include "utl_labellist.h"
+#include "utl_decllist.h"
+#include "global_extern.h"
+#include "nr_extern.h"
+
+#if (defined(apollo) || defined(hpux)) && defined(__cplusplus)
+extern "C" int yywrap();
+#endif // (defined(apollo) || defined(hpux)) && defined(__cplusplus)
+
+
+void yyerror (const char *);
+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
+%}
+
+/*
+ * Declare the type of values in the grammar
+ */
+
+%union {
+ AST_Decl *dcval; /* Decl value */
+ UTL_StrList *slval; /* String list */
+ UTL_NameList *nlval; /* Name list */
+ UTL_ExprList *elval; /* Expression list */
+ UTL_LabelList *llval; /* Label list */
+ UTL_DeclList *dlval; /* Declaration list */
+ FE_InterfaceHeader *ihval; /* Interface header */
+ FE_OBVHeader *vhval; /* Valuetype header */
+ FE_EventHeader *ehval; /* Event 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 */
+ AST_Field::Visibility vival; /* N/A, pub or priv */
+ AST_Expression::ExprType etval; /* Expression type */
+ AST_Argument::Direction dival; /* Argument direction */
+ AST_Operation::Flags ofval; /* Operation flags */
+ FE_Declarator *deval; /* Declarator value */
+ bool bval; /* Boolean value */
+ long ival; /* Long value */
+ idl_uns_long uival; /* Unsigned long value */
+ double dval; /* Double value */
+ float fval; /* Float value */
+ char cval; /* Char value */
+ ACE_CDR::WChar wcval; /* WChar value */
+ UTL_String *sval; /* String value */
+ char *wsval; /* WString value */
+ char *strval; /* char * value */
+ Identifier *idval; /* Identifier */
+ UTL_IdList *idlist; /* Identifier list */
+}
+
+/*
+ * Token types: These are returned by the lexer
+ */
+
+%token <strval> IDENTIFIER
+
+%token IDL_CONST
+%token IDL_MODULE
+%token IDL_INTERFACE
+%token IDL_TYPEDEF
+%token IDL_LONG
+%token IDL_SHORT
+%token IDL_UNSIGNED
+%token IDL_DOUBLE
+%token IDL_FLOAT
+%token IDL_CHAR
+%token IDL_WCHAR
+%token IDL_OCTET
+%token IDL_BOOLEAN
+%token IDL_FIXED
+%token IDL_ANY
+%token IDL_OBJECT
+%token IDL_STRUCT
+%token IDL_UNION
+%token IDL_SWITCH
+%token IDL_ENUM
+%token IDL_SEQUENCE
+%token IDL_STRING
+%token IDL_WSTRING
+%token IDL_EXCEPTION
+%token IDL_CASE
+%token IDL_DEFAULT
+%token IDL_READONLY
+%token IDL_ATTRIBUTE
+%token IDL_ONEWAY
+%token IDL_IDEMPOTENT
+%token IDL_VOID
+%token IDL_IN
+%token IDL_OUT
+%token IDL_INOUT
+%token IDL_RAISES
+%token IDL_CONTEXT
+%token IDL_NATIVE
+%token IDL_LOCAL
+ /* OBV tokens */
+%token IDL_ABSTRACT
+%token IDL_CUSTOM
+%token IDL_FACTORY
+%token IDL_PRIVATE
+%token IDL_PUBLIC
+%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
+%token <sval> IDL_STRING_LITERAL
+%token <cval> IDL_CHARACTER_LITERAL
+%token <dval> IDL_FLOATING_PT_LITERAL
+%token IDL_TRUETOK
+%token IDL_FALSETOK
+
+%token <strval> IDL_SCOPE_DELIMITOR
+%token IDL_LEFT_SHIFT
+%token IDL_RIGHT_SHIFT
+%token <wcval> IDL_WCHAR_LITERAL
+%token <wsval> IDL_WSTRING_LITERAL
+
+/*
+ * These are production names:
+ */
+
+%type <dcval> type_spec simple_type_spec constructed_type_spec
+%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 <idlist> scoped_name interface_type component_inheritance_spec
+%type <idlist> home_inheritance_spec primary_key_spec
+
+%type <slval> opt_context at_least_one_string_literal
+%type <slval> string_literals
+
+%type <nlval> at_least_one_scoped_name scoped_names inheritance_spec
+%type <nlval> opt_raises opt_getraises opt_setraises supports_spec
+
+%type <elval> at_least_one_array_dim array_dims
+
+%type <llval> at_least_one_case_label case_labels
+
+%type <dlval> at_least_one_declarator declarators
+%type <dlval> at_least_one_simple_declarator simple_declarators
+
+%type <ihval> interface_header
+
+%type <vhval> value_header
+
+%type <chval> component_header
+
+%type <hhval> home_header
+
+%type <ehval> event_rest_of_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
+
+%type <ulval> case_label
+
+%type <ffval> element_spec
+
+%type <etval> const_type integer_type char_type boolean_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
+
+%type <ofval> opt_op_attribute
+
+%type <deval> declarator simple_declarator complex_declarator
+
+%type <bval> opt_truncatable opt_multiple
+
+%type <idval> interface_decl value_decl union_decl struct_decl id
+%type <idval> event_header event_plain_header event_custom_header
+%type <idval> event_abs_header
+
+%type <ival> type_dcl
+%%
+
+/*
+ * Production starts here.
+ */
+start : definitions ;
+
+definitions
+ : definitions definition
+ | /* empty */
+ ;
+
+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);
+ }
+ | 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
+ {
+// | 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;
+ }
+ ;
+
+module : IDL_MODULE
+ {
+// module : IDL_MODULE
+ idl_global->set_parse_state (IDL_GlobalData::PS_ModuleSeen);
+ }
+ IDENTIFIER
+ {
+// IDENTIFIER
+ Identifier id ($3);
+ ACE::strdelete ($3);
+ $3 = 0;
+ UTL_ScopedName n (&id,
+ 0);
+ AST_Module *m = 0;
+ 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);
+ }
+ /*
+ * Push it on the stack
+ */
+ 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.
+ */
+ idl_global->scopes ().pop ();
+ }
+ ;
+
+interface_def
+ : interface
+ | interface_forward
+ ;
+
+interface :
+ interface_header
+ {
+// 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.
+ */
+ 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->destroy ();
+ delete $1;
+ $1 = 0;
+ }
+
+ /*
+ * Push it on the scope stack.
+ */
+ 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 ();
+ }
+ ;
+
+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;
+ }
+ ;
+
+interface_header :
+ interface_decl inheritance_spec
+ {
+// interface_header : interface_decl inheritance_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
+
+ if ($2 != 0 && $2->truncatable ())
+ {
+ idl_global->err ()->syntax_error (
+ IDL_GlobalData::PS_InheritColonSeen
+ );
+ }
+
+ /*
+ * 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 = 0;
+ ACE_NEW_RETURN (n,
+ UTL_ScopedName ($1, 0),
+ 1);
+ ACE_NEW_RETURN ($$,
+ FE_InterfaceHeader (n,
+ $2,
+ false,
+ false,
+ true),
+ 1);
+
+ if (0 != $2)
+ {
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+ }
+ }
+ |
+ 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
+ */
+ UTL_ScopedName *n = 0;
+ ACE_NEW_RETURN (n,
+ UTL_ScopedName ($2, 0),
+ 1);
+ ACE_NEW_RETURN ($$,
+ FE_InterfaceHeader (n,
+ $3,
+ true,
+ false,
+ true),
+ 1);
+
+ if (0 != $3)
+ {
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+ }
+ }
+ |
+ IDL_ABSTRACT interface_decl inheritance_spec
+ {
+// | 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 = 0;
+ ACE_NEW_RETURN (n,
+ UTL_ScopedName ($2, 0),
+ 1);
+ ACE_NEW_RETURN ($$,
+ FE_InterfaceHeader (n,
+ $3,
+ false,
+ true,
+ true),
+ 1);
+
+ if (0 != $3)
+ {
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+ }
+ }
+ ;
+
+inheritance_spec
+ : ':' opt_truncatable
+ {
+// inheritance_spec : ':' opt_truncatable
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen);
+ }
+ at_least_one_scoped_name
+ {
+// at_least_one_scoped_name
+ $4->truncatable ($2);
+ $$ = $4;
+ }
+ | /* EMPTY */
+ {
+/* | EMPTY */
+ $$ = 0;
+ }
+ ;
+
+value_def
+ : valuetype
+ | value_abs_decl
+ | value_forward_decl
+ | value_box_decl
+ ;
+
+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 (),
+ idl_global->lineno ()));
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Sorry, I (TAO_IDL) can't handle")
+ ACE_TEXT (" custom yet\n")));
+ }
+ | value_concrete_decl
+ ;
+
+value_concrete_decl :
+ value_header
+ {
+// 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)
+ {
+ 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 (),
+ false,
+ $1->truncatable (),
+ 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);
+
+ // FE_OBVHeader is not automatically destroyed in the AST
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
+ }
+
+ /*
+ * Push it on the scope stack
+ */
+ idl_global->scopes ().push (v);
+ }
+ '{'
+ {
+// '{'
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSqSeen);
+ }
+ value_elements
+ {
+// value_elements
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeBodySeen);
+ }
+ '}'
+ {
+// '}'
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeQsSeen);
+
+ AST_ValueType *vt =
+ AST_ValueType::narrow_from_scope (
+ idl_global->scopes ().top_non_null ()
+ );
+
+ if (vt != 0 && vt->will_have_factory ())
+ {
+ idl_global->valuefactory_seen_ = true;
+ }
+
+ /*
+ * Done with this value type - pop it off the scopes stack
+ */
+ idl_global->scopes ().pop ();
+ }
+ ;
+
+value_abs_decl :
+ IDL_ABSTRACT
+ value_header
+ {
+// 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)
+ {
+ 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 (),
+ true,
+ false,
+ 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);
+ }
+
+ /*
+ * Push it on the scope stack.
+ */
+ idl_global->scopes ().push (v);
+ }
+ '{'
+ {
+// '{'
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSqSeen);
+ }
+ exports
+ {
+// exports
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeBodySeen);
+ }
+ '}'
+ {
+// '}'
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeQsSeen);
+
+ /*
+ * Done with this valuetype - pop it off the scopes stack.
+ */
+ idl_global->scopes ().pop ();
+ }
+ ;
+
+value_header :
+ value_decl
+ inheritance_spec
+ {
+// value_header : value_decl inheritance_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
+ }
+ supports_spec
+ {
+// 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,
+ $2,
+ $4,
+ $2 ? $2->truncatable () : false),
+ 1);
+
+ if (0 != $4)
+ {
+ $4->destroy ();
+ delete $4;
+ $4 = 0;
+ }
+
+ if (0 != $2)
+ {
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+ }
+ }
+ ;
+
+value_decl
+ : IDL_VALUETYPE
+ {
+// value_decl : IDL_VALUETYPE
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSeen);
+ }
+ id
+ {
+// id
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeIDSeen);
+ $$ = $3;
+ }
+ ;
+
+opt_truncatable :
+ IDL_TRUNCATABLE
+ {
+// opt_truncatable : IDL_TRUNCATABLE
+ $$ = true;
+ }
+ | /* EMPTY */
+ {
+/* | EMPTY */
+ $$ = false;
+ }
+ ;
+
+supports_spec :
+ 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
+ {
+// 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);
+
+ /*
+ * 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,
+ true);
+ (void) s->fe_add_valuetype_fwd (f);
+ }
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+ }
+ |
+ value_decl
+ {
+// | 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);
+
+ /*
+ * 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,
+ false);
+ (void) s->fe_add_valuetype_fwd (f);
+ }
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
+ }
+ ;
+
+value_box_decl
+ : value_decl type_spec /* in this order %!?*/
+ {
+// value_box_decl : value_decl type_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueBoxDeclSeen);
+
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n ($1,
+ 0);
+
+ if (s != 0 && $2 != 0)
+ {
+ /*
+ * Get the type_spec associated with the valuebox
+ */
+ AST_Type *tp = 0;
+ AST_Typedef *td
+ = AST_Typedef::narrow_from_decl ($2);
+
+ if (td == 0)
+ {
+ tp = AST_Type::narrow_from_decl ($2);
+ }
+ else
+ {
+ tp = td->primitive_base_type ();
+ }
+
+ if (tp == 0)
+ { // The <type_spec> given is a valid type
+ idl_global->err ()->not_a_type ($2);
+ }
+ else if (tp->node_type() == AST_Decl::NT_valuetype)
+ { // valuetype is not allowed as <type_spec> for boxed value
+ idl_global->err ()->error0 (
+ UTL_Error::EIDL_ILLEGAL_BOXED_TYPE
+ );
+ }
+ else
+ {
+ /*
+ * Add the valuebox to its definition scope
+ */
+ AST_ValueBox *vb = idl_global->gen ()->create_valuebox (&n,
+ tp);
+ (void) s->fe_add_valuebox (vb);
+ }
+ }
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
+ }
+ ;
+
+value_elements
+ : value_elements value_element
+ | /* EMPTY */
+ ;
+
+value_element
+ : state_member
+ | export
+ | init_decl
+ ';'
+ ;
+
+state_member
+ : IDL_PUBLIC
+ {
+// state_member : IDL_PUBLIC
+ /* is $0 to member_i */
+ $<vival>$ = AST_Field::vis_PUBLIC;
+ }
+ member_i
+ | IDL_PRIVATE
+ {
+// IDL_PRIVATE
+ /* is $0 to member_i */
+ $<vival>$ = AST_Field::vis_PRIVATE;
+ }
+ member_i
+ ;
+
+exports
+ : exports export
+ | /* EMPTY */
+ ;
+
+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;
+ }
+ ;
+
+at_least_one_scoped_name :
+ scoped_name scoped_names
+ {
+// at_least_one_scoped_name : scoped_name scoped_names
+ ACE_NEW_RETURN ($$,
+ UTL_NameList ($1,
+ $2),
+ 1);
+ }
+ ;
+
+scoped_names
+ : scoped_names
+ ','
+ {
+// scoped_names : scoped_names ','
+ idl_global->set_parse_state (IDL_GlobalData::PS_SNListCommaSeen);
+ }
+ scoped_name
+ {
+// scoped_name
+ idl_global->set_parse_state (IDL_GlobalData::PS_ScopedNameSeen);
+
+ if ($1 == 0)
+ {
+ 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;
+ }
+ ;
+
+scoped_name
+ : id
+ {
+// scoped_name : id
+ idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
+
+ 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
+ idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
+
+ Identifier *id = 0;
+ ACE_NEW_RETURN (id,
+ Identifier ($1),
+ 1);
+ ACE::strdelete ($1);
+ $1 = 0;
+ 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);
+
+ // This cleans up all the non-global "::"s in scoped names.
+ // If there is a global one, it gets put into the UTL_IdList,
+ // so we clean it up in the case above.
+ ACE::strdelete ($2);
+ $2 = 0;
+ }
+ id
+ {
+// id
+ idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
+
+ UTL_IdList *sn = 0;
+ ACE_NEW_RETURN (sn,
+ UTL_IdList ($4,
+ 0),
+ 1);
+ $1->nconc (sn);
+ $$ = $1;
+ }
+ ;
+
+id : IDENTIFIER
+ {
+// id: IDENTIFIER
+ ACE_NEW_RETURN ($$,
+ Identifier ($1),
+ 1);
+ ACE::strdelete ($1);
+ $1 = 0;
+ }
+ ;
+
+interface_forward :
+ interface_decl
+ {
+// interface_forward : interface_decl
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n ($1,
+ 0);
+
+ if (ACE_OS::strcmp ($1->get_string (),
+ "TypeCode") == 0
+ && !idl_global->in_main_file ())
+ {
+ AST_PredefinedType *pdt =
+ idl_global->gen ()->create_predefined_type (
+ AST_PredefinedType::PT_pseudo,
+ &n
+ );
+ (void) s->add_predefined_type (pdt);
+ s->add_to_scope (pdt);
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
+
+ break;
+ }
+
+ AST_InterfaceFwd *f = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceForwardSeen);
+
+ /*
+ * 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);
+ }
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
+ }
+ |
+ IDL_LOCAL interface_decl
+ {
+// | 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
+ );
+
+ /*
+ * 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);
+ }
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+ }
+ |
+ IDL_ABSTRACT interface_decl
+ {
+// | 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
+ );
+
+ /*
+ * 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);
+ }
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+ }
+ ;
+
+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
+ {
+// 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.
+ */
+ 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);
+ $9->destroy ();
+ delete $9;
+ $9 = 0;
+ }
+ else
+ {
+ c =
+ idl_global->gen ()->create_constant (
+ $3,
+ $9,
+ &n
+ );
+ (void) s->fe_add_constant (c);
+ delete result;
+ result = 0;
+ }
+
+ $5->destroy ();
+ delete $5;
+ $5 = 0;
+ }
+ }
+ ;
+
+const_type
+ : integer_type
+ | char_type
+ | octet_type
+ | boolean_type
+ | floating_pt_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
+ {
+// | scoped_name
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_PredefinedType *c = 0;
+ AST_Typedef *t = 0;
+
+ /*
+ * If the constant's type is a scoped name, it must resolve
+ * to a scalar constant type
+ */
+ AST_Decl *d =
+ s->lookup_by_name ($1,
+ true);
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
+
+ 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;
+ }
+ }
+ ;
+
+expression : const_expr ;
+
+const_expr : or_expr ;
+
+or_expr : xor_expr
+ | or_expr '|' xor_expr
+ {
+// or_expr : xor_expr
+// | or_expr '|' xor_expr
+ $$ =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_or,
+ $1,
+ $3
+ );
+ }
+ ;
+
+xor_expr
+ : and_expr
+ | xor_expr '^' and_expr
+ {
+// xor_expr : and_expr
+// | xor_expr '^' and_expr
+ $$ =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_xor,
+ $1,
+ $3
+ );
+ }
+ ;
+
+and_expr
+ : shift_expr
+ | and_expr '&' shift_expr
+ {
+// and_expr : shift_expr | and_expr '&' shift_expr
+ $$ =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_and,
+ $1,
+ $3
+ );
+ }
+ ;
+
+shift_expr
+ : add_expr
+ | shift_expr IDL_LEFT_SHIFT add_expr
+ {
+// 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
+ {
+// | shift_expr IDL_RIGHT_SHIFT add_expr
+ $$ =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_right,
+ $1,
+ $3
+ );
+ }
+ ;
+
+add_expr
+ : mult_expr
+ | add_expr '+' mult_expr
+ {
+// 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_minus,
+ $1,
+ $3
+ );
+ }
+ ;
+
+mult_expr
+ : unary_expr
+ | mult_expr '*' unary_expr
+ {
+// 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_div,
+ $1,
+ $3
+ );
+ }
+ | mult_expr '%' unary_expr
+ {
+// | mult_expr '%' unary_expr
+ $$ =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_mod,
+ $1,
+ $3
+ );
+ }
+ ;
+
+unary_expr
+ : primary_expr
+ | '+' primary_expr
+ {
+// unary_expr : primary_expr | '+' primary_expr
+ $$ =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_u_plus,
+ $2,
+ 0
+ );
+ }
+ | '-' primary_expr
+ {
+// | '-' primary_expr
+ $$ =
+ idl_global->gen()->create_expr (
+ AST_Expression::EC_u_minus,
+ $2,
+ 0
+ );
+ }
+ | '~' primary_expr
+ {
+// | '~' 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 ();
+ AST_Decl *d = s->lookup_by_name ($1,
+ true);
+
+ /*
+ * If the scoped name is an IDL constant, it may be used in an
+ * array dim, a string bound, or a sequence bound. If so, it
+ * must be unsigned and > 0. We assign the constant's value
+ * and type to the expression created here so we can check
+ * them later.
+ */
+ if (d != 0 && d->node_type () == AST_Decl::NT_const)
+ {
+ AST_Constant *c = AST_Constant::narrow_from_decl (d);
+ $$ =
+ idl_global->gen ()->create_expr (c->constant_value (),
+ c->et ());
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
+ }
+ else
+ {
+ $$ = idl_global->gen ()->create_expr ($1);
+ }
+ }
+ | literal
+ | '(' const_expr ')'
+ {
+// | literal
+// | '(' const_expr ')'
+ $$ = $2;
+ }
+ ;
+
+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,
+ AST_Expression::EV_ulonglong);
+ }
+ | IDL_STRING_LITERAL
+ {
+// | IDL_STRING_LITERAL
+ $$ = idl_global->gen ()->create_expr ($1);
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
+ }
+ | 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 (true);
+ }
+ | IDL_FALSETOK
+ {
+// | IDL_FALSETOK
+ $$ = idl_global->gen ()->create_expr (false);
+ }
+ ;
+
+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 ();
+
+ /*
+ * If const_expr is an enum value (AST_EnumVal inherits from
+ * AST_Constant), the AST_ExprValue will probably not be set,
+ * but there's no need to check anyway
+ */
+ if (ev != 0)
+ {
+ switch (ev->et)
+ {
+ case AST_Expression::EV_ushort:
+ if (ev->u.usval == 0)
+ {
+ good_expression = 0;
+ }
+
+ break;
+ case AST_Expression::EV_ulong:
+ if (ev->u.ulval == 0)
+ {
+ good_expression = 0;
+ }
+
+ break;
+#if !defined (ACE_LACKS_LONGLONG_T)
+ case AST_Expression::EV_ulonglong:
+ if (ev->u.ullval == 0)
+ {
+ good_expression = 0;
+ }
+
+ break;
+#endif
+ 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;
+ break;
+ }
+ }
+
+ if (good_expression)
+ {
+ $$ = $1;
+ }
+ else
+ {
+ idl_global->err ()->syntax_error (idl_global->parse_state ());
+ }
+ }
+ ;
+
+type_dcl
+ : IDL_TYPEDEF
+ {
+// 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
+ {
+// | 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);
+ }
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+ }
+ | 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
+ {
+// 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;
+ }
+
+ if (AST_Decl::NT_except == tp->node_type ())
+ {
+ idl_global->err ()->not_a_type (tp);
+ 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;
+ }
+ }
+ ;
+
+type_spec
+ : simple_type_spec
+ | constructed_type_spec
+ ;
+
+simple_type_spec
+ : base_type_spec
+ {
+// simple_type_spec : base_type_spec
+ $$ =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ $1
+ );
+ }
+ | template_type_spec
+ | scoped_name
+ {
+// | 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,
+ true);
+ }
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error ($1);
+ }
+ else
+ {
+ d->last_referenced_as ($1);
+ }
+
+
+ $$ = d;
+ }
+ ;
+
+base_type_spec
+ : integer_type
+ | floating_pt_type
+ | char_type
+ | boolean_type
+ | octet_type
+ | fixed_type
+ | any_type
+ | object_type
+ ;
+
+template_type_spec
+ : sequence_type_spec
+ | string_type_spec
+ | wstring_type_spec
+ ;
+
+constructed_type_spec
+ : struct_type
+ | union_type
+ | enum_type
+ ;
+
+constructed_forward_type_spec
+ : struct_forward_type
+ | union_forward_type
+ ;
+
+at_least_one_declarator :
+ declarator declarators
+ {
+// at_least_one_declarator : declarator declarators
+ ACE_NEW_RETURN ($$,
+ UTL_DeclList ($1,
+ $2),
+ 1);
+ }
+ ;
+
+declarators
+ : declarators
+ ','
+ {
+// declarators : declarators ','
+ idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen);
+ }
+ declarator
+ {
+// declarator
+ idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen);
+
+ if ($1 == 0)
+ {
+ 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;
+ }
+ ;
+
+declarator
+ : simple_declarator
+ | complex_declarator
+ ;
+
+at_least_one_simple_declarator :
+ simple_declarator simple_declarators
+ {
+// at_least_one_simple_declarator : simple_declarator simple_declarators
+ ACE_NEW_RETURN ($$,
+ UTL_DeclList ($1,
+ $2),
+ 1);
+ }
+ ;
+
+simple_declarators
+ : simple_declarators
+ ','
+ {
+// simple_declarators : simple_declarators ','
+ idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen);
+ }
+ simple_declarator
+ {
+// simple_declarator
+ idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen);
+
+ if ($1 == 0)
+ {
+ 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;
+ }
+ ;
+
+simple_declarator :
+ id
+ {
+// 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
+ {
+// 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);
+ }
+ ;
+
+integer_type
+ : signed_int
+ | unsigned_int
+ ;
+
+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;
+ }
+ ;
+
+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;
+ }
+ ;
+
+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;
+ }
+ ;
+
+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 (),
+ idl_global->lineno ()));
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Sorry, I (TAO_IDL) can't handle")
+ ACE_TEXT (" fixed types yet\n")));
+ }
+ ;
+
+char_type
+ : IDL_CHAR
+ {
+// char_type : IDL_CHAR
+ $$ = AST_Expression::EV_char;
+ }
+ | IDL_WCHAR
+ {
+// | IDL_WCHAR
+ $$ = AST_Expression::EV_wchar;
+ }
+ ;
+
+octet_type
+ : IDL_OCTET
+ {
+// octet_type : IDL_OCTET
+ $$ = AST_Expression::EV_octet;
+ }
+ ;
+
+boolean_type
+ : IDL_BOOLEAN
+ {
+// boolean_type : IDL_BOOLEAN
+ $$ = AST_Expression::EV_bool;
+ }
+ ;
+
+any_type
+ : IDL_ANY
+ {
+// any_type : IDL_ANY
+ $$ = AST_Expression::EV_any;
+ }
+ ;
+
+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
+ {
+// 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;
+
+ /*
+ * 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 ()
+ );
+ AST_Structure::fwd_redefinition_helper (d,
+ s);
+ (void) s->fe_add_structure (d);
+ }
+
+ /*
+ * Push the scope of the struct on the scopes stack.
+ */
+ idl_global->scopes ().push (d);
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
+ }
+ '{'
+ {
+// '{'
+ 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.
+ */
+ $$ = AST_Structure::narrow_from_scope (
+ idl_global->scopes ().top_non_null ()
+ );
+ idl_global->scopes ().pop ();
+ }
+ ;
+
+at_least_one_member : member members ;
+
+members
+ : members member
+ | /* EMPTY */
+ ;
+
+member :
+ {
+// member :
+ /* is $0 to member_i */
+ $<vival>$ = AST_Field::vis_NA;
+ }
+ 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 ();
+ FE_Declarator *d = 0;
+ AST_Field *f = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_MemberDeclsCompleted);
+
+ /*
+ * 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);
+ }
+ /*
+ * Create a node representing a struct or exception member
+ * 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);
+ }
+ }
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+ }
+ | error
+ {
+// | error
+ idl_global->err()->syntax_error (idl_global->parse_state ());
+ }
+ ';'
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ yyerrok;
+ }
+ ;
+
+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;
+ }
+ ;
+
+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 ($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 ($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 ());
+ }
+
+ AST_Structure *st = AST_Structure::narrow_from_decl (u);
+ AST_Structure::fwd_redefinition_helper (st,
+ s);
+ u = AST_Union::narrow_from_decl (st);
+ (void) s->fe_add_union (u);
+ }
+
+ /*
+ * Push the scope of the union on the scopes stack
+ */
+ idl_global->scopes ().push (u);
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
+ }
+ '{'
+ {
+// '{'
+ 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.
+ */
+ $$ = AST_Union::narrow_from_scope (
+ idl_global->scopes ().top_non_null ()
+ );
+
+ if ($$ != 0)
+ {
+ idl_global->scopes ().pop ();
+ }
+ }
+ ;
+
+switch_type_spec :
+ integer_type
+ {
+// switch_type_spec : integer_type
+ $$ =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ $1
+ );
+ }
+ | char_type
+ {
+// | 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
+ );
+ }
+ | octet_type
+ {
+// | octet_type
+ /* octets are not allowed. */
+ idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE);
+ $$ =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ $1
+ );
+ }
+ | boolean_type
+ {
+// | boolean_type
+ $$ =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ $1
+ );
+ }
+ | enum_type
+ | scoped_name
+ {
+// | 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;
+ bool found = 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.
+ */
+ d = s->lookup_by_name ($1,
+ true);
+
+ if (s != 0 && d != 0)
+ {
+ while (!found)
+ {
+ switch (d->node_type ())
+ {
+ case AST_Decl::NT_enum:
+ $$ = d;
+ found = 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 = 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 = true;
+ break;
+ default:
+ $$ = 0;
+ found = true;
+ break;
+ }
+ }
+ else
+ {
+ $$ = 0;
+ found = 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 = true;
+ break;
+ }
+ }
+ }
+ else
+ {
+ $$ = 0;
+ }
+
+ if ($$ == 0)
+ {
+ idl_global->err ()->lookup_error ($1);
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
+
+ /* If we don't return here, we'll crash later.*/
+ return 1;
+ }
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
+ }
+ ;
+
+at_least_one_case_branch : case_branch case_branches ;
+
+case_branches
+ : case_branches case_branch
+ | /* empty */
+ ;
+
+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 ();
+ 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 ()
+ );
+ (void) s->fe_add_union_branch (b);
+
+ // f has passed its field type to the union branch,
+ // but the rest still needs to be cleaned up.
+ f->AST_Decl::destroy ();
+ delete f;
+ f = 0;
+ }
+ }
+ | error
+ {
+// | error
+ idl_global->err()->syntax_error (idl_global->parse_state());
+ }
+ ';'
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ yyerrok;
+ }
+ ;
+
+at_least_one_case_label :
+ case_label case_labels
+ {
+// 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)
+ {
+ 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;
+ }
+ ;
+
+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 (
+ AST_UnionLabel::UL_default,
+ 0
+ );
+ }
+ | 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 (
+ AST_UnionLabel::UL_label,
+ $3
+ );
+ }
+ ;
+
+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);
+
+ $$ = 0;
+ }
+ /*
+ * Create a field in a union branch
+ */
+ else if ($1 == 0
+ || $3 == 0)
+ {
+ $$ = 0;
+ }
+ else
+ {
+ AST_Type *tp = $3->compose ($1);
+
+ if (tp == 0)
+ {
+ $$ = 0;
+ }
+ else
+ {
+ $$ = idl_global->gen ()->create_field (
+ tp,
+ $3->name ()
+ );
+ }
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+ }
+ }
+ ;
+
+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);
+ }
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
+ }
+ ;
+
+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);
+ }
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
+ }
+ ;
+
+enum_type :
+ IDL_ENUM
+ {
+// enum_type : IDL_ENUM
+ idl_global->set_parse_state (IDL_GlobalData::PS_EnumSeen);
+ }
+ id
+ {
+// 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.
+ */
+ 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.
+ */
+ idl_global->scopes ().push (e);
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+ }
+ '{'
+ {
+// '{'
+ 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.
+ */
+ if (idl_global->scopes ().top () == 0)
+ {
+ $$ = 0;
+ }
+ else
+ {
+ $$ = AST_Enum::narrow_from_scope (
+ idl_global->scopes ().top_non_null ()
+ );
+ idl_global->scopes ().pop ();
+ }
+ }
+ ;
+
+at_least_one_enumerator : enumerator enumerators ;
+
+enumerators
+ : enumerators
+ ','
+ {
+// enumerators : enumerators ','
+ idl_global->set_parse_state (IDL_GlobalData::PS_EnumCommaSeen);
+ }
+ enumerator
+ | /* EMPTY */
+ ;
+
+enumerator :
+ IDENTIFIER
+ {
+// enumerator : IDENTIFIER
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ Identifier id ($1);
+ ACE::strdelete ($1);
+ $1 = 0;
+ UTL_ScopedName n (&id,
+ 0);
+ AST_EnumVal *e = 0;
+ AST_Enum *c = 0;
+
+ /*
+ * 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);
+ }
+ }
+ ;
+
+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.
+ */
+ 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
+ */
+ AST_Expression::AST_ExprValue *ev = 0;
+
+ if ($4 != 0)
+ {
+ ev = $4->coerce (AST_Expression::EV_ulong);
+ }
+
+ if (0 == $4 || 0 == ev)
+ {
+ idl_global->err ()->coercion_error ($4,
+ AST_Expression::EV_ulong);
+ $$ = 0;
+ }
+ else if (0 == $1)
+ {
+ $$ = 0;
+ }
+ else
+ {
+ AST_Type *tp = AST_Type::narrow_from_decl ($1);
+
+ if (0 == tp)
+ {
+ ; // 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 ()
+ );
+ }
+ }
+
+ delete ev;
+ ev = 0;
+ }
+ | seq_head
+ '>'
+ {
+// | seq_head '>'
+ idl_global->set_parse_state (IDL_GlobalData::PS_SequenceQsSeen);
+
+ /*
+ * 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 ();
+
+ /*
+ * 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
+ {
+ Identifier id ("sequence");
+ UTL_ScopedName sn (&id,
+ 0);
+
+ $$ =
+ idl_global->gen ()->create_sequence (
+ idl_global->gen ()->create_expr (
+ (idl_uns_long) 0,
+ AST_Expression::EV_ulong
+ ),
+ tp,
+ &sn,
+ s->is_local (),
+ s->is_abstract ()
+ );
+ }
+ }
+ }
+ ;
+
+seq_head :
+ IDL_SEQUENCE
+ {
+// seq_head : IDL_SEQUENCE
+ idl_global->set_parse_state (IDL_GlobalData::PS_SequenceSeen);
+
+ /*
+ * Push a sequence marker on scopes stack.
+ */
+ 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;
+ }
+ ;
+
+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.
+ */
+ AST_Expression::AST_ExprValue *ev = 0;
+
+ if ($4 != 0)
+ {
+ ev = $4->coerce (AST_Expression::EV_ulong);
+ }
+
+ if (0 == $4 || 0 == ev)
+ {
+ 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 (
+ $$
+ )
+ );
+ }
+
+ delete ev;
+ ev = 0;
+ }
+ | string_head
+ {
+// | string_head
+ idl_global->set_parse_state (IDL_GlobalData::PS_StringCompleted);
+ /*
+ * Create a node representing a string.
+ */
+ $$ =
+ idl_global->gen ()->create_string (
+ idl_global->gen ()->create_expr ((idl_uns_long) 0,
+ AST_Expression::EV_ulong)
+ );
+ /*
+ * 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 :
+ IDL_STRING
+ {
+// string_head : IDL_STRING
+ idl_global->set_parse_state (IDL_GlobalData::PS_StringSeen);
+ }
+ ;
+
+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.
+ */
+ 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 wstring.
+ */
+ $$ =
+ idl_global->gen ()->create_wstring (
+ idl_global->gen ()->create_expr ((idl_uns_long) 0,
+ AST_Expression::EV_ulong)
+ );
+ /*
+ * 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 :
+ IDL_WSTRING
+ {
+// wstring_head : IDL_WSTRING
+ idl_global->set_parse_state (IDL_GlobalData::PS_StringSeen);
+ }
+ ;
+
+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.
+ */
+ if ($3 != 0)
+ {
+ UTL_ScopedName sn ($1,
+ 0);
+ $$ =
+ idl_global->gen ()->create_array (
+ &sn,
+ $3->length (),
+ $3,
+ 0,
+ 0
+ );
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
+ sn.destroy ();
+ }
+ }
+ ;
+
+at_least_one_array_dim :
+ array_dim array_dims
+ {
+// 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)
+ {
+ 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;
+ }
+ ;
+
+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.
+ */
+ AST_Expression::AST_ExprValue *ev = 0;
+
+ if ($3 != 0)
+ {
+ ev = $3->coerce (AST_Expression::EV_ulong);
+ }
+
+ if (0 == $3 || 0 == ev)
+ {
+ idl_global->err ()->coercion_error ($3,
+ AST_Expression::EV_ulong);
+ $$ = 0;
+ }
+ else
+ {
+ $$ = $3;
+ }
+
+ delete ev;
+ ev = 0;
+ }
+ ;
+
+attribute
+ : attribute_readonly
+ | attribute_readwrite
+ ;
+
+attribute_readonly :
+ IDL_READONLY
+ {
+// attribute_readonly : IDL_READONLY
+ idl_global->set_parse_state (IDL_GlobalData::PS_AttrROSeen);
+ }
+ IDL_ATTRIBUTE
+ {
+// 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
+ {
+// at_least_one_simple_declarator
+ idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclsSeen);
+ }
+ opt_raises
+ {
+// opt_raises
+ 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_OpRaiseCompleted);
+
+ /*
+ * Create nodes representing attributes and add them to the
+ * enclosing scope.
+ */
+ if (s != 0
+ && $5 != 0
+ && $7 != 0)
+ {
+ for (UTL_DecllistActiveIterator l ($7);
+ !l.is_done ();
+ l.next ())
+ {
+ d = l.item ();
+
+ if (d == 0)
+ {
+ continue;
+ }
+
+ AST_Type *tp = d->compose ($5);
+
+ if (tp == 0)
+ {
+ continue;
+ }
+
+ a =
+ idl_global->gen ()->create_attribute (
+ true,
+ tp,
+ d->name (),
+ s->is_local (),
+ s->is_abstract ()
+ );
+
+ if ($9 != 0)
+ {
+ (void) a->fe_add_get_exceptions ($9);
+
+ $9->destroy ();
+ delete $9;
+ $9 = 0;
+ }
+
+ (void) s->fe_add_attribute (a);
+ }
+ }
+
+ $7->destroy ();
+ delete $7;
+ $7 = 0;
+ }
+ ;
+
+attribute_readwrite :
+ IDL_ATTRIBUTE
+ {
+// attribute_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
+ {
+// at_least_one_simple_declarator
+ idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclsSeen);
+ }
+ opt_getraises
+ {
+// opt_getraises
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpGetRaiseCompleted);
+ }
+ opt_setraises
+ {
+// opt_setraises
+ 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_OpSetRaiseCompleted);
+
+ /*
+ * Create nodes representing attributes and add them to the
+ * enclosing scope.
+ */
+ if (s != 0
+ && $3 != 0
+ && $5 != 0)
+ {
+ for (UTL_DecllistActiveIterator l ($5);
+ !l.is_done ();
+ l.next ())
+ {
+ d = l.item ();
+
+ if (d == 0)
+ {
+ continue;
+ }
+
+ AST_Type *tp = d->compose ($3);
+
+ if (tp == 0)
+ {
+ continue;
+ }
+
+ a =
+ idl_global->gen ()->create_attribute (
+ false,
+ tp,
+ d->name (),
+ s->is_local (),
+ s->is_abstract ()
+ );
+
+ if ($7 != 0)
+ {
+ (void) a->fe_add_get_exceptions ($7);
+
+ $7->destroy ();
+ delete $7;
+ $7 = 0;
+ }
+
+ if ($9 != 0)
+ {
+ (void) a->fe_add_set_exceptions ($9);
+
+ $9->destroy ();
+ delete $9;
+ $9 = 0;
+ }
+
+ (void) s->fe_add_attribute (a);
+ }
+ }
+
+ $5->destroy ();
+ delete $5;
+ $5 = 0;
+ }
+ ;
+
+exception :
+ IDL_EXCEPTION
+ {
+// exception : IDL_EXCEPTION
+ idl_global->set_parse_state (IDL_GlobalData::PS_ExceptSeen);
+ }
+ id
+ {
+// 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.
+ */
+ 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.
+ */
+ idl_global->scopes ().push (e);
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+ }
+ '{'
+ {
+// '{'
+ 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.
+ */
+ idl_global->scopes ().pop ();
+ }
+ ;
+
+operation :
+ opt_op_attribute
+ op_type_spec
+ {
+// operation : opt_op_attribute op_type_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpTypeSeen);
+ }
+ IDENTIFIER
+ {
+// IDENTIFIER
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ Identifier id ($4);
+ ACE::strdelete ($4);
+ $4 = 0;
+
+ 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.
+ */
+ 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
+ {
+ AST_Decl *d = ScopeAsDecl (s);
+ AST_Decl::NodeType nt = d->node_type ();
+ bool local =
+ s->is_local ()
+ || nt == AST_Decl::NT_valuetype
+ || nt == AST_Decl::NT_eventtype;
+ o =
+ idl_global->gen ()->create_operation (tp,
+ $1,
+ &n,
+ local,
+ s->is_abstract ());
+ (void) s->fe_add_operation (o);
+ }
+ }
+
+ /*
+ * Push the operation scope onto the scopes stack.
+ */
+ 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
+ {
+// 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.
+ */
+ 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);
+ }
+ }
+
+ /*
+ * Done with this operation. Pop its scope from the scopes stack.
+ */
+ 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;
+ }
+ ;
+
+op_type_spec
+ : param_type_spec
+ | IDL_VOID
+ {
+// op_type_spec : param_type_spec | IDL_VOID
+ $$ =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ AST_Expression::EV_void
+ );
+ }
+ ;
+
+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 ();
+
+ 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 ()));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ }
+
+ Identifier id ($3);
+ ACE::strdelete ($3);
+ $3 = 0;
+
+ UTL_ScopedName n (&id,
+ 0);
+ AST_Factory *factory = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
+
+ /*
+ * Create a node representing an factory construct
+ * and add it to its enclosing scope
+ */
+ if (s != 0)
+ {
+ factory = idl_global->gen ()->create_factory (&n);
+ (void) s->fe_add_factory (factory);
+ }
+
+ /*
+ * Push the operation scope onto the scopes stack.
+ */
+ idl_global->scopes ().push (factory);
+ }
+ 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);
+
+ if ($7 != 0)
+ {
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Factory *f = AST_Factory::narrow_from_scope (s);
+ (void) f->fe_add_exceptions ($7);
+ }
+
+ 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 ')'
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
+ }
+ ;
+
+at_least_one_in_parameter : in_parameter in_parameters ;
+
+in_parameters
+ : in_parameters
+ ','
+ {
+// in_parameters : in_parameters ','
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen);
+ }
+ 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
+ {
+// 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).
+ */
+ if ($3 != 0
+ && $5 != 0 &&
+ s != 0)
+ {
+ AST_Type *tp = $5->compose ($3);
+
+ if (tp != 0)
+ {
+ a = idl_global->gen ()->create_argument (
+ AST_Argument::dir_IN,
+ tp,
+ $5->name ()
+ );
+
+ (void) s->fe_add_argument (a);
+ }
+ }
+
+ $5->destroy ();
+ delete $5;
+ $5 = 0;
+ }
+ ;
+
+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 ')'
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
+ }
+ ;
+
+at_least_one_parameter : parameter parameters ;
+
+parameters
+ : parameters
+ ','
+ {
+// parameters : parameters ','
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen);
+ }
+ 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
+ {
+// 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).
+ */
+ if ($3 != 0
+ && $5 != 0
+ && s != 0)
+ {
+ AST_Type *tp = $5->compose ($3);
+
+ if (tp != 0)
+ {
+ if (!s->is_local () && tp->is_local ())
+ {
+ idl_global->err ()->local_remote_mismatch (tp, s);
+ }
+ else
+ {
+ a =
+ idl_global->gen ()->create_argument (
+ $1,
+ tp,
+ $5->name ()
+ );
+ (void) s->fe_add_argument (a);
+ }
+ }
+ }
+
+ $5->destroy ();
+ delete $5;
+ $5 = 0;
+ }
+ ;
+
+param_type_spec
+ : base_type_spec
+ {
+// param_type_spec : base_type_spec
+ $$ =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ $1
+ );
+ }
+ | string_type_spec
+ | wstring_type_spec
+ | scoped_name
+ {
+// | 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,
+ true);
+ }
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error ($1);
+ }
+ else
+ {
+ d->last_referenced_as ($1);
+ AST_Decl::NodeType nt = d->node_type ();
+
+ if (nt == AST_Decl::NT_struct_fwd
+ || nt == AST_Decl::NT_union_fwd)
+ {
+ if (! AST_Type::narrow_from_decl (d)->is_defined ())
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_ADD,
+ d);
+
+ /* If we don't return here, we'll crash later.*/
+ return 1;
+ }
+ }
+ }
+
+
+ $$ = d;
+ }
+ ;
+
+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;
+ }
+ ;
+
+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_getraises
+ : IDL_GETRAISES
+ {
+// opt_getraises : IDL_GETRAISES
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpGetRaiseSeen);
+ }
+ '('
+ {
+// '('
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpGetRaiseSqSeen);
+ }
+ at_least_one_scoped_name
+ ')'
+ {
+// at_least_one_scoped_name ')'
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpGetRaiseQsSeen);
+ $$ = $5;
+ }
+ | /* EMPTY */
+ {
+ $$ = 0;
+/* | EMPTY */
+ }
+ ;
+
+opt_setraises
+ : IDL_SETRAISES
+ {
+// opt_setraises : IDL_SETRAISES
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpSetRaiseSeen);
+ }
+ '('
+ {
+// '('
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpSetRaiseSqSeen);
+ }
+ at_least_one_scoped_name
+ ')'
+ {
+// at_least_one_scoped_name ')'
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpSetRaiseQsSeen);
+ $$ = $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 ')'
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpContextQsSeen);
+ $$ = $5;
+ }
+ | /* EMPTY */
+ {
+/* | EMPTY */
+ $$ = 0;
+ }
+ ;
+
+at_least_one_string_literal :
+ IDL_STRING_LITERAL string_literals
+ {
+// at_least_one_string_literal : IDL_STRING_LITERAL string_literals
+ ACE_NEW_RETURN ($$,
+ UTL_StrList ($1,
+ $2),
+ 1);
+ }
+ ;
+
+string_literals
+ : string_literals
+ ','
+ {
+// string_literals : string_literals ','
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpContextCommaSeen);
+ }
+ IDL_STRING_LITERAL
+ {
+// IDL_STRING_LITERAL
+ if ($1 == 0)
+ {
+ 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,
+ true);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error ($2);
+ }
+ else
+ {
+ d->set_id_with_typeid (
+ $3->get_string ()
+ );
+ }
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+ }
+ ;
+
+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 = ScopeAsDecl (s);
+
+ // If we are in a module, we want to avoid a lookup unless the
+ // typeprefix is to be applied to some other scope, since we
+ // might get a previous opening of the module, and the prefix
+ // of this opening would never get checked or set.
+ if (d->name ()->compare ($2) != 0)
+ {
+ d = s->lookup_by_name ($2,
+ true);
+ }
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error ($2);
+ }
+ else
+ {
+ d->set_prefix_with_typeprefix (
+ $3->get_string ()
+ );
+ }
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+ }
+ ;
+
+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);
+ }
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+ }
+ ;
+
+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->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 = 0;
+ ACE_NEW_RETURN (n,
+ UTL_ScopedName ($2, 0),
+ 1);
+ ACE_NEW_RETURN ($$,
+ FE_ComponentHeader (n,
+ $4,
+ $6,
+ false),
+ 1);
+
+ if (0 != $6)
+ {
+ $6->destroy ();
+ delete $6;
+ $6 = 0;
+ }
+
+ if (0 != $4)
+ {
+ $4->destroy ();
+ delete $4;
+ $4 = 0;
+ }
+ }
+ ;
+
+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_Decl *d = s->lookup_by_name ($2,
+ true);
+ if (0 == d)
+ {
+ idl_global->err ()->lookup_error ($2);
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
+ break;
+ }
+ else if (d->node_type () != AST_Decl::NT_interface)
+ {
+ // Nothing else but CORBA::Object can have
+ // this identifier.
+ if (ACE_OS::strcmp (d->local_name ()->get_string (),
+ "Object")
+ != 0)
+ {
+ idl_global->err ()->interface_expected (d);
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
+ break;
+ }
+ }
+
+ AST_Type *interface_type =
+ AST_Type::narrow_from_decl (d);
+
+ AST_Component::port_description pd;
+ pd.id = $3;
+ pd.impl = interface_type;
+ c->provides ().enqueue_tail (pd);
+ }
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+ }
+ ;
+
+interface_type
+ : scoped_name
+ {
+// interface_type : scoped_name
+ // Lookups and checking are done where the 'interface_type'
+ // token is used, in 'provides_decl' and 'uses_decl'.
+ $$ = $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_Decl *d = s->lookup_by_name ($3,
+ true);
+
+ if (0 == d)
+ {
+ idl_global->err ()->lookup_error ($3);
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
+ $4->destroy ();
+ delete $4;
+ $4 = 0;
+
+ break;
+ }
+ else if (d->node_type () != AST_Decl::NT_interface)
+ {
+ if (ACE_OS::strcmp (d->local_name ()->get_string (),
+ "Object")
+ != 0)
+ {
+ idl_global->err ()->interface_expected (d);
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
+ $4->destroy ();
+ delete $4;
+ $4 = 0;
+
+ break;
+ }
+ }
+
+ AST_Type *interface_type = AST_Type::narrow_from_decl (d);
+ AST_Component *c = AST_Component::narrow_from_scope (s);
+
+ if (c != 0)
+ {
+ AST_Component::port_description ud;
+ ud.id = $4;
+ ud.impl = interface_type;
+ ud.is_multiple = $2;
+ c->uses ().enqueue_tail (ud);
+
+ if (ud.is_multiple == true
+ && !idl_global->using_ifr_backend ()
+ && !idl_global->ignore_idl3 ())
+ {
+ // These datatypes must be created in the
+ // front end so they can be looked up
+ // when compiling the generated executor IDL.
+ idl_global->create_uses_multiple_stuff (c, ud);
+ }
+ }
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+ }
+ ;
+
+opt_multiple
+ : IDL_MULTIPLE
+ {
+// opt_multiple : IDL_MULTIPLE
+ $$ = true;
+ }
+ | /* EMPTY */
+ {
+/* | EMPTY */
+ $$ = 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,
+ true);
+
+ if (0 == d)
+ {
+ idl_global->err ()->lookup_error ($2);
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
+ break;
+ }
+ else if (d->node_type () != AST_Decl::NT_eventtype)
+ {
+ idl_global->err ()->eventtype_expected (d);
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
+ break;
+ }
+ else
+ {
+ AST_Type *event_type = AST_Type::narrow_from_decl (d);
+ AST_Component *c = AST_Component::narrow_from_scope (s);
+
+ if (c != 0)
+ {
+ AST_Component::port_description pd;
+ pd.id = $3;
+ pd.impl = event_type;
+ c->emits ().enqueue_tail (pd);
+ }
+ }
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+ }
+ ;
+
+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,
+ true);
+
+ if (0 == d)
+ {
+ idl_global->err ()->lookup_error ($2);
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
+ break;
+ }
+ else if (d->node_type () != AST_Decl::NT_eventtype)
+ {
+ idl_global->err ()->eventtype_expected (d);
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
+ break;
+ }
+ else
+ {
+ AST_Type *event_type = AST_Type::narrow_from_decl (d);
+ AST_Component *c = AST_Component::narrow_from_scope (s);
+
+ if (c != 0)
+ {
+ AST_Component::port_description pd;
+ pd.id = $3;
+ pd.impl = event_type;
+ c->publishes ().enqueue_tail (pd);
+ }
+ }
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+ }
+ ;
+
+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,
+ true);
+
+ if (0 == d)
+ {
+ idl_global->err ()->lookup_error ($2);
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
+ break;
+ }
+ else if (d->node_type () != AST_Decl::NT_eventtype)
+ {
+ idl_global->err ()->eventtype_expected (d);
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
+ break;
+ }
+ else
+ {
+ AST_Type *event_type = AST_Type::narrow_from_decl (d);
+ AST_Component *c = AST_Component::narrow_from_scope (s);
+
+ if (c != 0)
+ {
+ AST_Component::port_description pd;
+ pd.id = $3;
+ pd.impl = event_type;
+ c->consumes ().enqueue_tail (pd);
+ }
+ }
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+ }
+ ;
+
+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->destroy ();
+ delete $1;
+ $1 = 0;
+ }
+
+ /*
+ * Push it on the scope stack.
+ */
+ idl_global->scopes ().push (h);
+ }
+ home_body
+ {
+// home_body
+ /*
+ * Done with this component - pop it off the scopes stack.
+ */
+ idl_global->scopes ().pop ();
+ }
+ ;
+
+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 = 0;
+ ACE_NEW_RETURN (n,
+ UTL_ScopedName ($3, 0),
+ 1);
+ ACE_NEW_RETURN ($$,
+ FE_HomeHeader (n,
+ $5,
+ $7,
+ $11,
+ $13),
+ 1);
+
+ $11->destroy ();
+ delete $11;
+ $11 = 0;
+
+ if (0 != $5)
+ {
+ $5->destroy ();
+ delete $5;
+ $5 = 0;
+ }
+
+ if (0 != $13)
+ {
+ $13->destroy ();
+ delete $13;
+ $13 = 0;
+ }
+
+ if (0 != $7)
+ {
+ $7->destroy ();
+ delete $7;
+ $7 = 0;
+ }
+ }
+ ;
+
+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);
+ o =
+ idl_global->gen ()->create_operation (
+ home->managed_component (),
+ AST_Operation::OP_noflags,
+ &n,
+ false,
+ false
+ );
+ home->factories ().enqueue_tail (o);
+ }
+
+ $2->destroy ();
+ delete $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
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Operation *o = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
+
+ /*
+ * 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 ($6 != 0 && o != 0)
+ {
+ (void) o->fe_add_exceptions ($6);
+ }
+ }
+
+ /*
+ * 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);
+ o =
+ idl_global->gen ()->create_operation (
+ home->managed_component (),
+ AST_Operation::OP_noflags,
+ &n,
+ false,
+ false
+ );
+ home->finders ().enqueue_tail (o);
+ }
+
+ $2->destroy ();
+ delete $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
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Operation *o = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
+
+ /*
+ * 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 ($6 != 0 && o != 0)
+ {
+ (void) o->fe_add_exceptions ($6);
+ }
+ }
+
+ /*
+ * 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_concrete_forward_decl : IDL_EVENTTYPE id
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n ($2,
+ 0);
+ AST_EventTypeFwd *f = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeForwardSeen);
+
+ /*
+ * Create a node representing a forward declaration of an
+ * eventtype. Store it in the enclosing scope
+ */
+ if (s != 0)
+ {
+ f = idl_global->gen ()->create_eventtype_fwd (&n,
+ false);
+ (void) s->fe_add_valuetype_fwd (f);
+ }
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+ }
+ ;
+
+event_abs_forward_decl :
+ IDL_ABSTRACT
+ IDL_EVENTTYPE
+ id
+ {
+// event_abs_forward_decl : IDL_ABSTRACT IDL_EVENTTYPE id
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n ($3,
+ 0);
+ AST_EventTypeFwd *f = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeForwardSeen);
+
+ /*
+ * Create a node representing a forward declaration of an
+ * eventtype. Store it in the enclosing scope
+ */
+ if (s != 0)
+ {
+ f = idl_global->gen ()->create_eventtype_fwd (&n,
+ true);
+ (void) s->fe_add_valuetype_fwd (f);
+ }
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+ }
+ ;
+
+event_abs_decl :
+ event_abs_header
+ event_rest_of_header
+ {
+// event_abs_decl : event_abs_header event_rest_of_header
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_EventType *e = 0;
+ AST_Interface *i = 0;
+
+ if (s != 0 && $1 != 0)
+ {
+ UTL_ScopedName sn ($1,
+ 0);
+ e =
+ idl_global->gen ()->create_eventtype (
+ &sn,
+ $2->inherits (),
+ $2->n_inherits (),
+ $2->inherits_concrete (),
+ $2->inherits_flat (),
+ $2->n_inherits_flat (),
+ $2->supports (),
+ $2->n_supports (),
+ $2->supports_concrete (),
+ true,
+ false,
+ false
+ );
+ i = AST_Interface::narrow_from_decl (e);
+ AST_Interface::fwd_redefinition_helper (i,
+ s);
+ /*
+ * Add the eventetype to its definition scope
+ */
+ e = AST_EventType::narrow_from_decl (i);
+ (void) s->fe_add_eventtype (e);
+ }
+
+ /*
+ * Push it on the scope stack.
+ */
+ idl_global->scopes ().push (e);
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
+ }
+ '{'
+ {
+// '{'
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeSqSeen);
+ }
+ exports
+ {
+// exports
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeBodySeen);
+ }
+ '}'
+ {
+// '}'
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeQsSeen);
+
+ /*
+ * Done with this eventtype - pop it off the scopes stack.
+ */
+ idl_global->scopes ().pop ();
+ }
+ ;
+
+event_abs_header :
+ IDL_ABSTRACT
+ IDL_EVENTTYPE
+ id
+ {
+// event_abs_header : IDL_ABSTRACT IDL_EVENTTYPE id
+ $$ = $3;
+ }
+ ;
+
+event_custom_header :
+ IDL_CUSTOM
+ IDL_EVENTTYPE
+ id
+ {
+// event_custom_header : IDL_CUSTOM IDL_EVENTTYPE id
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeIDSeen);
+
+ 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")
+ ACE_TEXT (" custom yet\n")));
+ $$ = 0;
+ }
+ ;
+
+event_plain_header :
+ IDL_EVENTTYPE
+ id
+ {
+// event_plain_header : IDL_EVENTTYPE id
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeIDSeen);
+
+ $$ = $2;
+ }
+ ;
+
+event_rest_of_header :
+ inheritance_spec
+ {
+// event_rest_of_header : inheritance_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
+ }
+ supports_spec
+ {
+// supports_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
+
+ ACE_NEW_RETURN ($$,
+ FE_EventHeader (
+ 0,
+ $1,
+ $3,
+ $1
+ ? $1->truncatable ()
+ : false
+ ),
+ 1);
+
+ if (0 != $3)
+ {
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+ }
+
+ if (0 != $1)
+ {
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
+ }
+ }
+ ;
+
+event_decl :
+ event_header
+ event_rest_of_header
+ {
+// event_decl : event_header event_rest_of_header
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_EventType *e = 0;
+ AST_Interface *i = 0;
+
+ if (s != 0 && $1 != 0)
+ {
+ // We create the scoped name here instead of with the
+ // FE_EventHeader because there is a token for it only here.
+ UTL_ScopedName sn ($1,
+ 0);
+ e =
+ idl_global->gen ()->create_eventtype (
+ &sn,
+ $2->inherits (),
+ $2->n_inherits (),
+ $2->inherits_concrete (),
+ $2->inherits_flat (),
+ $2->n_inherits_flat (),
+ $2->supports (),
+ $2->n_supports (),
+ $2->supports_concrete (),
+ false,
+ $2->truncatable (),
+ false
+ );
+ i = AST_Interface::narrow_from_decl (e);
+ AST_Interface::fwd_redefinition_helper (i,
+ s);
+ /*
+ * Add the eventetype to its definition scope
+ */
+ e = AST_EventType::narrow_from_decl (i);
+ (void) s->fe_add_eventtype (e);
+
+ // FE_EventHeader is not automatically destroyed in the AST
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ sn.destroy ();
+ }
+
+ /*
+ * Push it on the scope stack.
+ */
+ idl_global->scopes ().push (e);
+ }
+ '{'
+ {
+// '{'
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeSqSeen);
+ }
+ value_elements
+ {
+// value_elements
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeBodySeen);
+ }
+ '}'
+ {
+// '}'
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeQsSeen);
+
+ /*
+ * Done with this eventtype - pop it off the scopes stack.
+ */
+ idl_global->scopes ().pop ();
+ }
+ ;
+
+event_header
+ : event_custom_header
+ {
+// event_header : event_custom_header
+ $$ = $1;
+ }
+ | event_plain_header
+ {
+// event_header : event_plain_header
+ $$ = $1;
+ }
+ ;
+
+%%
+/* programs */
+
+/*
+ * ???
+ */
+int
+yywrap (void)
+{
+ return 1;
+}
+
+/*
+ * Report an error situation discovered in a production
+ */
+void
+yyerror (const char *msg)
+{
+ ACE_ERROR ((LM_ERROR,
+ "%s\n",
+ msg));
+}
diff --git a/TAO/TAO_IDL/fe/keywords.dat b/TAO/TAO_IDL/fe/keywords.dat
new file mode 100644
index 00000000000..e9c3a8b3be8
--- /dev/null
+++ b/TAO/TAO_IDL/fe/keywords.dat
@@ -0,0 +1,76 @@
+struct TAO_IDL_CPP_Keyword_Entry { const char *keyword_ ; const char *mapping_; };
+%%
+and, "_cxx_and"
+and_eq, "_cxx_and_eq"
+asm, "_cxx_asm"
+auto, "_cxx_auto"
+bitand, "_cxx_bitand"
+bitor, "_cxx_bitor"
+bool, "_cxx_bool"
+break, "_cxx_break"
+case, "_cxx_case"
+catch, "_cxx_catch"
+char, "_cxx_char"
+class, "_cxx_class"
+compl, "_cxx_compl"
+const, "_cxx_const"
+const_cast, "_cxx_const_cast"
+continue, "_cxx_continue"
+default, "_cxx_default"
+delete, "_cxx_delete"
+do, "_cxx_do"
+double, "_cxx_double"
+dynamic_cast, "_cxx_dynamic_cast"
+else, "_cxx_else"
+enum, "_cxx_enum"
+explicit, "_cxx_explicit"
+export, "_cxx_export"
+extern, "_cxx_extern"
+false, "_cxx_false"
+float, "_cxx_float"
+for, "_cxx_for"
+friend, "_cxx_friend"
+goto, "_cxx_goto"
+if, "_cxx_if"
+inline, "_cxx_inline"
+int, "_cxx_int"
+long, "_cxx_long"
+mutable, "_cxx_mutable"
+namespace, "_cxx_namespace"
+new, "_cxx_new"
+not, "_cxx_not"
+not_eq, "_cxx_not_eq"
+operator, "_cxx_operator"
+or, "_cxx_or"
+or_eq, "_cxx_or_eq"
+private, "_cxx_private"
+protected, "_cxx_protected"
+public, "_cxx_public"
+register, "_cxx_register"
+reinterpret_cast, "_cxx_reinterpret_cast"
+return, "_cxx_return"
+short, "_cxx_short"
+signed, "_cxx_signed"
+sizeof, "_cxx_sizeof"
+static, "_cxx_static"
+static_cast, "_cxx_static_cast"
+struct, "_cxx_struct"
+switch, "_cxx_switch"
+template, "_cxx_template"
+this, "_cxx_this"
+throw, "_cxx_throw"
+true, "_cxx_true"
+try, "_cxx_try"
+typedef, "_cxx_typedef"
+typeid, "_cxx_typeid"
+typename, "_cxx_typename"
+union, "_cxx_union"
+unsigned, "_cxx_unsigned"
+using, "_cxx_using"
+virtual, "_cxx_virtual"
+void, "_cxx_void"
+volatile, "_cxx_volatile"
+wchar_t, "_cxx_wchar_t"
+while, "_cxx_while"
+xor, "_cxx_xor"
+xor_eq, "_cxx_xor_eq"
diff --git a/TAO/TAO_IDL/fe/lex.yy.cpp b/TAO/TAO_IDL/fe/lex.yy.cpp
new file mode 100644
index 00000000000..0107c500285
--- /dev/null
+++ b/TAO/TAO_IDL/fe/lex.yy.cpp
@@ -0,0 +1,3300 @@
+/* A lexical scanner generated by flex */
+
+/* Scanner skeleton version:
+ * $Id$
+ */
+
+#define FLEX_SCANNER
+#define TAO_YY_FLEX_MAJOR_VERSION 2
+#define TAO_YY_FLEX_MINOR_VERSION 5
+
+#include "ace/os_include/os_stdio.h"
+#include "ace/os_include/os_ctype.h"
+
+
+/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
+#ifdef c_plusplus
+#ifndef __cplusplus
+#define __cplusplus
+#endif
+#endif
+
+
+#ifdef __cplusplus
+
+
+/* Use prototypes in function declarations. */
+#define TAO_YY_USE_PROTOS
+
+/* The "const" storage-class-modifier is valid. */
+#define TAO_YY_USE_CONST
+
+#else /* ! __cplusplus */
+
+#if __STDC__
+
+#define TAO_YY_USE_PROTOS
+#define TAO_YY_USE_CONST
+
+#endif /* __STDC__ */
+#endif /* ! __cplusplus */
+
+#ifdef __TURBOC__
+ #pragma warn -rch
+ #pragma warn -use
+#define TAO_YY_USE_CONST
+#define TAO_YY_USE_PROTOS
+#endif
+
+#ifdef TAO_YY_USE_CONST
+#define tao_yyconst const
+#else
+#define tao_yyconst
+#endif
+
+
+#ifdef TAO_YY_USE_PROTOS
+#define TAO_YY_PROTO(proto) proto
+#else
+#define TAO_YY_PROTO(proto) ()
+#endif
+
+/* Returned upon end-of-file. */
+#define TAO_YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index. If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define TAO_YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN tao_yy_start = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The TAO_YYSTATE alias is for lex
+ * compatibility.
+ */
+#define TAO_YY_START ((tao_yy_start - 1) / 2)
+#define TAO_YYSTATE TAO_YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define TAO_YY_STATE_EOF(state) (TAO_YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define TAO_YY_NEW_FILE tao_yyrestart( tao_yyin )
+
+#define TAO_YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#define TAO_YY_BUF_SIZE 16384
+
+typedef struct tao_yy_buffer_state *TAO_YY_BUFFER_STATE;
+
+extern int tao_yyleng;
+extern FILE *tao_yyin, *tao_yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+/* The funky do-while in the following #define is used to turn the definition
+ * 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();
+ *
+ * Prior to using the do-while the compiler would get upset at the
+ * "else" because it interpreted the "if" statement as being all
+ * done when it reached the ';' after the tao_yyless() call.
+ */
+
+/* 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 )
+
+#define unput(c) tao_yyunput( c, tao_yytext_ptr )
+
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ */
+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 static_cast<int> (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.
+ */
+#define TAO_YY_BUFFER_EOF_PENDING 2
+ };
+
+static TAO_YY_BUFFER_STATE tao_yy_current_buffer = 0;
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ */
+#define TAO_YY_CURRENT_BUFFER tao_yy_current_buffer
+
+
+/* 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 */
+
+
+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 */
+
+/* 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 ...
+ */
+static int tao_yy_did_buffer_switch_on_eof;
+
+void tao_yyrestart TAO_YY_PROTO(( FILE *input_file ));
+
+void tao_yy_switch_to_buffer TAO_YY_PROTO(( TAO_YY_BUFFER_STATE new_buffer ));
+void tao_yy_load_buffer_state TAO_YY_PROTO(( void ));
+TAO_YY_BUFFER_STATE tao_yy_create_buffer TAO_YY_PROTO(( FILE *file, int size ));
+void tao_yy_delete_buffer TAO_YY_PROTO(( TAO_YY_BUFFER_STATE b ));
+void tao_yy_init_buffer TAO_YY_PROTO(( TAO_YY_BUFFER_STATE b, FILE *file ));
+void tao_yy_flush_buffer TAO_YY_PROTO(( TAO_YY_BUFFER_STATE b ));
+#define TAO_YY_FLUSH_BUFFER tao_yy_flush_buffer( tao_yy_current_buffer )
+
+TAO_YY_BUFFER_STATE tao_yy_scan_buffer TAO_YY_PROTO(( char *base, tao_yy_size_t size ));
+TAO_YY_BUFFER_STATE tao_yy_scan_string TAO_YY_PROTO(( tao_yyconst char *tao_yy_str ));
+TAO_YY_BUFFER_STATE tao_yy_scan_bytes TAO_YY_PROTO(( tao_yyconst char *bytes, int len ));
+
+static void *tao_yy_flex_alloc TAO_YY_PROTO(( tao_yy_size_t ));
+static void *tao_yy_flex_realloc TAO_YY_PROTO(( void *, tao_yy_size_t ));
+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; \
+ }
+
+#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; \
+ }
+
+#define TAO_YY_AT_BOL() (tao_yy_current_buffer->tao_yy_at_bol)
+
+typedef unsigned char TAO_YY_CHAR;
+FILE *tao_yyin = (FILE *) 0, *tao_yyout = (FILE *) 0;
+typedef int tao_yy_state_type;
+extern char tao_yytext[];
+
+
+static tao_yy_state_type tao_yy_get_previous_state TAO_YY_PROTO(( void ));
+static tao_yy_state_type tao_yy_try_NUL_trans TAO_YY_PROTO(( tao_yy_state_type current_state ));
+static int tao_yy_get_next_buffer TAO_YY_PROTO(( void ));
+static void tao_yy_fatal_error TAO_YY_PROTO(( tao_yyconst char msg[] ));
+
+/* Done after the current pattern has been matched and before the
+ * 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 104
+#define TAO_YY_END_OF_BUFFER 105
+static tao_yyconst short int tao_yy_accept[558] =
+ { 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, 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, 0, 82,
+ 80, 0, 0, 73, 0, 69, 70, 68, 78, 0,
+ 0, 0, 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, 0, 80, 0, 81, 0,
+ 60, 0, 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, 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, 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] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+ 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 5, 1, 6, 7, 1, 1, 1, 8, 1,
+ 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, 28, 26,
+ 26, 29, 30, 31, 32, 26, 26, 33, 26, 26,
+ 1, 34, 1, 1, 26, 1, 35, 36, 37, 38,
+
+ 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,
+ 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, 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
+ } ;
+
+static tao_yyconst int tao_yy_meta[60] =
+ { 0,
+ 1, 1, 2, 1, 1, 3, 1, 4, 1, 1,
+ 1, 1, 1, 5, 5, 6, 1, 1, 1, 1,
+ 3, 6, 6, 6, 6, 7, 7, 7, 7, 7,
+ 7, 7, 7, 3, 5, 5, 6, 6, 6, 5,
+ 7, 7, 7, 7, 7, 7, 7, 8, 7, 7,
+ 7, 8, 7, 8, 9, 8, 7, 8, 7
+ } ;
+
+static tao_yyconst short int tao_yy_base[586] =
+ { 0,
+ 0, 58, 1094, 1095, 59, 1095, 1095, 56, 1059, 54,
+ 57, 65, 68, 73, 1075, 1073, 1070, 0, 1067, 69,
+ 1052, 1058, 45, 1037, 56, 37, 48, 67, 1046, 1035,
+ 61, 1034, 65, 1047, 79, 63, 82, 83, 71, 71,
+ 93, 92, 134, 144, 1060, 130, 97, 148, 129, 1072,
+ 147, 152, 158, 184, 210, 1095, 148, 161, 197, 203,
+ 229, 0, 239, 1095, 1095, 1095, 0, 1052, 151, 1044,
+ 1033, 1044, 1022, 1015, 1019, 1023, 1018, 1035, 116, 1016,
+ 1028, 1012, 1023, 1010, 1025, 1026, 1025, 123, 1012, 1006,
+ 1012, 1008, 129, 155, 1009, 1018, 1009, 1000, 999, 1013,
+
+ 997, 146, 1014, 1006, 1013, 150, 998, 994, 995, 1001,
+ 988, 992, 167, 1002, 994, 996, 996, 983, 226, 0,
+ 192, 1095, 1030, 243, 992, 996, 990, 980, 1012, 260,
+ 173, 180, 246, 1095, 1022, 1021, 259, 1020, 267, 0,
+ 272, 261, 1095, 286, 1095, 289, 0, 254, 287, 0,
+ 997, 196, 292, 284, 1018, 277, 986, 1000, 969, 0,
+ 970, 975, 981, 967, 968, 251, 963, 981, 979, 960,
+ 966, 964, 972, 956, 971, 969, 972, 954, 966, 955,
+ 948, 963, 966, 959, 964, 943, 943, 953, 956, 937,
+ 0, 253, 937, 946, 938, 952, 934, 936, 935, 186,
+
+ 936, 931, 936, 944, 933, 938, 927, 924, 940, 942,
+ 924, 969, 968, 927, 933, 923, 935, 338, 302, 1095,
+ 1095, 307, 961, 0, 309, 330, 1095, 944, 324, 961,
+ 314, 352, 0, 1095, 0, 929, 0, 913, 921, 924,
+ 0, 0, 913, 276, 922, 911, 904, 912, 904, 0,
+ 902, 905, 905, 914, 914, 897, 915, 0, 897, 894,
+ 895, 900, 0, 904, 898, 900, 886, 887, 905, 904,
+ 903, 894, 893, 896, 885, 894, 897, 877, 882, 892,
+ 879, 890, 889, 318, 877, 883, 0, 884, 0, 870,
+ 878, 914, 359, 880, 870, 878, 875, 869, 1095, 289,
+
+ 386, 871, 875, 869, 859, 331, 1095, 902, 1095, 901,
+ 0, 379, 408, 900, 853, 871, 869, 869, 855, 0,
+ 855, 843, 853, 853, 859, 0, 843, 842, 843, 842,
+ 0, 0, 850, 838, 0, 851, 0, 851, 850, 838,
+ 848, 0, 827, 833, 830, 845, 169, 829, 833, 832,
+ 836, 0, 837, 823, 824, 833, 839, 834, 834, 819,
+ 0, 822, 815, 0, 820, 1095, 394, 345, 813, 390,
+ 819, 859, 858, 817, 823, 813, 825, 343, 435, 1095,
+ 851, 0, 821, 802, 808, 816, 815, 799, 0, 798,
+ 0, 792, 807, 790, 0, 687, 0, 704, 670, 0,
+
+ 648, 0, 0, 632, 651, 635, 0, 620, 0, 614,
+ 621, 603, 0, 0, 601, 0, 600, 613, 0, 613,
+ 611, 589, 606, 462, 1095, 477, 408, 367, 423, 497,
+ 602, 629, 413, 590, 579, 575, 553, 505, 581, 534,
+ 521, 0, 526, 520, 0, 0, 509, 509, 0, 493,
+ 494, 0, 485, 477, 0, 464, 465, 436, 455, 451,
+ 436, 450, 0, 444, 425, 412, 0, 532, 432, 1095,
+ 465, 484, 504, 1095, 455, 369, 1095, 547, 377, 402,
+ 555, 407, 369, 433, 0, 401, 373, 0, 387, 373,
+ 367, 380, 0, 348, 0, 330, 0, 0, 320, 0,
+
+ 324, 295, 0, 295, 493, 1095, 512, 322, 535, 551,
+ 562, 1095, 577, 581, 450, 585, 601, 581, 283, 0,
+ 0, 0, 0, 0, 0, 254, 0, 0, 147, 130,
+ 0, 601, 1095, 605, 609, 607, 1095, 615, 617, 150,
+ 127, 521, 0, 55, 0, 628, 1095, 630, 61, 636,
+ 638, 0, 1095, 640, 1095, 642, 1095, 663, 672, 677,
+ 684, 692, 701, 706, 712, 721, 727, 729, 733, 742,
+ 748, 750, 752, 755, 761, 767, 773, 779, 785, 794,
+ 803, 812, 821, 830, 839
+ } ;
+
+static tao_yyconst short int tao_yy_def[586] =
+ { 0,
+ 557, 1, 557, 557, 557, 557, 557, 558, 559, 557,
+ 557, 557, 557, 557, 557, 557, 557, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 557, 557, 557, 557, 558, 557, 561, 557,
+ 562, 557, 557, 557, 557, 557, 563, 55, 557, 557,
+ 557, 564, 557, 557, 557, 557, 560, 560, 565, 566,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 557, 44,
+ 44, 557, 121, 557, 557, 557, 557, 557, 557, 557,
+ 558, 558, 558, 557, 557, 557, 557, 567, 557, 568,
+ 557, 557, 557, 563, 557, 563, 58, 557, 557, 564,
+ 560, 565, 557, 569, 557, 557, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 570, 557, 557, 557, 557, 557, 557, 558, 557,
+ 557, 557, 571, 568, 557, 557, 557, 560, 557, 557,
+ 565, 565, 572, 557, 573, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 570, 557, 557, 557, 557, 557, 218, 557, 218,
+
+ 557, 557, 557, 557, 557, 558, 557, 557, 557, 557,
+ 560, 565, 565, 574, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 557, 557, 557, 557, 557,
+ 557, 575, 557, 557, 557, 557, 557, 565, 313, 557,
+ 576, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 557, 557, 557, 577, 557, 557, 557,
+ 557, 575, 557, 557, 557, 557, 557, 313, 578, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 557, 577, 557,
+ 577, 579, 557, 557, 580, 557, 557, 557, 557, 557,
+ 557, 557, 565, 557, 560, 560, 560, 560, 560, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+
+ 560, 560, 560, 560, 579, 557, 579, 580, 557, 581,
+ 557, 557, 557, 582, 557, 557, 557, 557, 557, 560,
+ 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
+ 560, 581, 557, 581, 557, 582, 557, 582, 583, 584,
+ 557, 557, 560, 560, 560, 583, 557, 583, 584, 557,
+ 585, 560, 557, 585, 557, 585, 0, 557, 557, 557,
+ 557, 557, 557, 557, 557, 557, 557, 557, 557, 557,
+ 557, 557, 557, 557, 557, 557, 557, 557, 557, 557,
+ 557, 557, 557, 557, 557
+ } ;
+
+static tao_yyconst short int tao_yy_nxt[1155] =
+ { 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, 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, 550, 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, 552, 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, 540, 101, 46, 119, 108, 109, 119, 110,
+ 120, 116, 133, 133, 118, 121, 122, 122, 123, 130,
+ 145, 146, 130, 131, 136, 550, 153, 124, 124, 124,
+ 137, 137, 165, 166, 122, 55, 55, 55, 146, 58,
+ 175, 139, 139, 60, 147, 147, 147, 181, 48, 138,
+ 176, 61, 182, 125, 154, 48, 126, 545, 192, 127,
+ 140, 183, 544, 128, 193, 58, 61, 141, 141, 141,
+
+ 197, 153, 184, 198, 138, 407, 49, 61, 58, 205,
+ 59, 59, 60, 49, 58, 140, 60, 60, 60, 206,
+ 61, 408, 61, 55, 55, 55, 61, 119, 279, 154,
+ 119, 557, 120, 142, 143, 61, 143, 557, 148, 148,
+ 280, 61, 149, 149, 149, 122, 122, 213, 142, 143,
+ 58, 48, 63, 63, 63, 143, 124, 124, 124, 219,
+ 219, 130, 61, 122, 130, 131, 221, 149, 149, 149,
+ 225, 225, 222, 222, 226, 226, 226, 61, 58, 49,
+ 139, 139, 60, 58, 234, 141, 141, 141, 145, 146,
+ 61, 145, 146, 229, 372, 61, 229, 232, 232, 270,
+
+ 149, 149, 149, 244, 245, 61, 146, 48, 271, 146,
+ 61, 227, 543, 227, 307, 306, 306, 542, 230, 153,
+ 308, 308, 226, 226, 226, 229, 227, 509, 229, 320,
+ 321, 235, 227, 531, 557, 49, 48, 530, 233, 298,
+ 299, 299, 300, 226, 226, 226, 427, 154, 153, 427,
+ 230, 301, 301, 301, 143, 358, 143, 153, 299, 529,
+ 359, 366, 366, 367, 49, 312, 312, 360, 472, 143,
+ 510, 472, 528, 510, 153, 143, 154, 302, 514, 366,
+ 303, 514, 527, 304, 153, 154, 526, 305, 299, 299,
+ 373, 429, 378, 378, 429, 424, 425, 425, 424, 301,
+
+ 301, 301, 154, 430, 430, 430, 299, 426, 426, 426,
+ 470, 471, 154, 153, 425, 477, 477, 478, 525, 524,
+ 523, 379, 379, 379, 429, 522, 521, 429, 471, 379,
+ 379, 379, 379, 477, 470, 471, 430, 430, 430, 520,
+ 380, 154, 379, 379, 379, 379, 379, 379, 438, 438,
+ 438, 539, 471, 519, 539, 515, 438, 438, 438, 438,
+ 509, 504, 503, 424, 425, 425, 424, 470, 471, 438,
+ 438, 438, 438, 438, 438, 468, 468, 468, 424, 425,
+ 425, 424, 425, 502, 501, 471, 506, 507, 500, 499,
+ 426, 426, 426, 498, 497, 506, 507, 425, 473, 474,
+
+ 474, 473, 475, 496, 507, 473, 474, 474, 473, 475,
+ 430, 430, 430, 507, 506, 507, 495, 474, 483, 483,
+ 483, 494, 551, 493, 474, 551, 483, 483, 483, 483,
+ 492, 491, 507, 424, 425, 425, 424, 474, 474, 483,
+ 483, 483, 483, 483, 483, 468, 468, 468, 511, 512,
+ 512, 511, 425, 533, 534, 474, 516, 490, 489, 517,
+ 513, 513, 513, 511, 512, 512, 511, 512, 518, 518,
+ 518, 534, 488, 487, 486, 535, 535, 535, 511, 512,
+ 512, 511, 512, 537, 538, 541, 516, 485, 380, 517,
+ 513, 513, 513, 482, 518, 518, 518, 512, 518, 518,
+
+ 518, 538, 516, 533, 534, 517, 540, 533, 534, 537,
+ 538, 512, 512, 481, 518, 518, 518, 537, 538, 547,
+ 548, 534, 535, 535, 535, 534, 480, 538, 479, 512,
+ 547, 548, 547, 548, 433, 538, 476, 548, 553, 553,
+ 555, 556, 555, 556, 555, 556, 467, 466, 548, 465,
+ 548, 464, 463, 462, 461, 460, 553, 459, 556, 458,
+ 556, 457, 556, 47, 47, 47, 47, 47, 47, 47,
+ 47, 47, 50, 456, 50, 50, 50, 50, 50, 50,
+ 50, 67, 67, 67, 67, 67, 132, 132, 132, 455,
+ 454, 132, 135, 453, 135, 135, 135, 135, 135, 135,
+
+ 135, 144, 144, 144, 144, 144, 144, 144, 144, 144,
+ 150, 150, 152, 152, 152, 152, 152, 152, 152, 152,
+ 152, 155, 452, 155, 155, 155, 155, 155, 155, 155,
+ 223, 223, 223, 224, 224, 231, 231, 231, 451, 450,
+ 231, 231, 292, 292, 292, 292, 292, 292, 292, 292,
+ 292, 310, 310, 310, 313, 313, 314, 314, 381, 381,
+ 381, 432, 432, 432, 432, 432, 432, 432, 432, 432,
+ 439, 439, 439, 469, 469, 469, 469, 469, 469, 469,
+ 469, 469, 484, 484, 484, 505, 505, 505, 505, 505,
+ 505, 505, 505, 505, 508, 508, 508, 508, 508, 508,
+
+ 508, 508, 508, 532, 532, 532, 532, 532, 532, 532,
+ 532, 532, 536, 536, 536, 536, 536, 536, 536, 536,
+ 536, 546, 546, 546, 546, 546, 546, 546, 546, 546,
+ 549, 549, 549, 549, 549, 549, 549, 549, 549, 554,
+ 554, 554, 554, 554, 554, 554, 554, 554, 449, 448,
+ 447, 446, 445, 444, 443, 442, 441, 440, 380, 437,
+ 436, 435, 434, 372, 433, 431, 428, 423, 422, 421,
+ 420, 419, 418, 417, 416, 415, 414, 413, 412, 411,
+ 410, 409, 406, 405, 404, 403, 402, 401, 400, 399,
+ 398, 397, 396, 395, 394, 393, 392, 391, 390, 389,
+
+ 388, 387, 386, 385, 384, 383, 382, 380, 309, 307,
+ 377, 376, 375, 374, 557, 371, 370, 369, 368, 293,
+ 365, 364, 363, 362, 361, 357, 356, 355, 354, 353,
+ 352, 351, 350, 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, 319, 318, 317, 316, 315, 69, 311, 309, 297,
+ 296, 295, 294, 212, 293, 291, 290, 289, 288, 287,
+ 286, 285, 284, 283, 282, 281, 278, 277, 276, 275,
+ 274, 273, 272, 269, 268, 267, 266, 265, 264, 263,
+
+ 262, 261, 260, 259, 258, 257, 256, 255, 254, 253,
+ 252, 251, 250, 249, 248, 247, 246, 243, 242, 241,
+ 240, 239, 238, 237, 236, 234, 228, 220, 220, 220,
+ 218, 217, 216, 215, 214, 212, 211, 210, 209, 208,
+ 207, 204, 203, 202, 201, 200, 199, 196, 195, 194,
+ 191, 190, 189, 188, 187, 186, 185, 180, 179, 178,
+ 177, 174, 173, 172, 171, 170, 169, 168, 167, 164,
+ 163, 162, 161, 160, 159, 158, 157, 156, 151, 134,
+ 129, 98, 94, 91, 90, 76, 72, 71, 68, 66,
+ 65, 64, 51, 557, 3, 557, 557, 557, 557, 557,
+
+ 557, 557, 557, 557, 557, 557, 557, 557, 557, 557,
+ 557, 557, 557, 557, 557, 557, 557, 557, 557, 557,
+ 557, 557, 557, 557, 557, 557, 557, 557, 557, 557,
+ 557, 557, 557, 557, 557, 557, 557, 557, 557, 557,
+ 557, 557, 557, 557, 557, 557, 557, 557, 557, 557,
+ 557, 557, 557, 557
+ } ;
+
+static tao_yyconst short int tao_yy_chk[1155] =
+ { 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, 1, 1, 1, 2,
+ 5, 8, 2, 5, 2, 10, 549, 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, 544, 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, 541, 35, 46, 43, 38, 38, 43, 38,
+ 43, 41, 49, 49, 42, 44, 44, 44, 44, 48,
+ 57, 57, 48, 48, 51, 540, 69, 44, 44, 44,
+ 51, 51, 79, 79, 44, 52, 52, 52, 57, 53,
+ 88, 53, 53, 53, 58, 58, 58, 93, 131, 51,
+ 88, 53, 93, 44, 69, 132, 44, 530, 102, 44,
+ 53, 94, 529, 44, 102, 54, 53, 54, 54, 54,
+
+ 106, 152, 94, 106, 51, 347, 131, 54, 59, 113,
+ 59, 59, 59, 132, 60, 53, 60, 60, 60, 113,
+ 59, 347, 54, 55, 55, 55, 60, 119, 200, 152,
+ 119, 121, 119, 55, 55, 59, 55, 121, 61, 61,
+ 200, 60, 61, 61, 61, 124, 124, 124, 55, 55,
+ 63, 133, 63, 63, 63, 55, 124, 124, 124, 133,
+ 133, 130, 63, 124, 130, 130, 137, 148, 148, 148,
+ 142, 142, 137, 137, 142, 142, 142, 63, 139, 133,
+ 139, 139, 139, 141, 156, 141, 141, 141, 144, 144,
+ 139, 146, 146, 153, 300, 141, 153, 154, 154, 192,
+
+ 149, 149, 149, 166, 166, 139, 144, 219, 192, 146,
+ 141, 149, 526, 149, 222, 219, 219, 519, 153, 231,
+ 222, 222, 225, 225, 225, 229, 149, 508, 229, 244,
+ 244, 156, 149, 504, 300, 219, 306, 502, 154, 218,
+ 218, 218, 218, 226, 226, 226, 368, 231, 378, 368,
+ 229, 218, 218, 218, 226, 284, 226, 232, 218, 501,
+ 284, 293, 293, 293, 306, 232, 232, 284, 428, 226,
+ 476, 428, 499, 476, 483, 226, 378, 218, 479, 293,
+ 218, 479, 496, 218, 312, 232, 494, 218, 301, 301,
+ 301, 370, 312, 312, 370, 367, 367, 367, 367, 301,
+
+ 301, 301, 483, 370, 370, 370, 301, 367, 367, 367,
+ 427, 427, 312, 313, 367, 433, 433, 433, 492, 491,
+ 490, 313, 313, 313, 429, 489, 487, 429, 427, 313,
+ 313, 313, 313, 433, 469, 469, 429, 429, 429, 486,
+ 484, 313, 313, 313, 313, 313, 313, 313, 379, 379,
+ 379, 515, 469, 482, 515, 480, 379, 379, 379, 379,
+ 475, 466, 465, 424, 424, 424, 424, 471, 471, 379,
+ 379, 379, 379, 379, 379, 424, 424, 424, 426, 426,
+ 426, 426, 424, 464, 462, 471, 472, 472, 461, 460,
+ 426, 426, 426, 459, 458, 505, 505, 426, 430, 430,
+
+ 430, 430, 430, 457, 472, 473, 473, 473, 473, 473,
+ 430, 430, 430, 505, 507, 507, 456, 430, 438, 438,
+ 438, 454, 542, 453, 473, 542, 438, 438, 438, 438,
+ 451, 450, 507, 468, 468, 468, 468, 509, 509, 438,
+ 438, 438, 438, 438, 438, 468, 468, 468, 478, 478,
+ 478, 478, 468, 510, 510, 509, 481, 448, 447, 481,
+ 478, 478, 478, 511, 511, 511, 511, 478, 481, 481,
+ 481, 510, 444, 443, 441, 511, 511, 511, 513, 513,
+ 513, 513, 511, 514, 514, 518, 516, 440, 439, 516,
+ 513, 513, 513, 437, 518, 518, 518, 513, 516, 516,
+
+ 516, 514, 517, 532, 532, 517, 517, 534, 534, 536,
+ 536, 535, 535, 436, 517, 517, 517, 538, 538, 539,
+ 539, 532, 535, 535, 535, 534, 435, 536, 434, 535,
+ 546, 546, 548, 548, 432, 538, 431, 539, 550, 550,
+ 551, 551, 554, 554, 556, 556, 423, 422, 546, 421,
+ 548, 420, 418, 417, 415, 412, 550, 411, 551, 410,
+ 554, 408, 556, 558, 558, 558, 558, 558, 558, 558,
+ 558, 558, 559, 406, 559, 559, 559, 559, 559, 559,
+ 559, 560, 560, 560, 560, 560, 561, 561, 561, 405,
+ 404, 561, 562, 401, 562, 562, 562, 562, 562, 562,
+
+ 562, 563, 563, 563, 563, 563, 563, 563, 563, 563,
+ 564, 564, 565, 565, 565, 565, 565, 565, 565, 565,
+ 565, 566, 399, 566, 566, 566, 566, 566, 566, 566,
+ 567, 567, 567, 568, 568, 569, 569, 569, 398, 396,
+ 569, 569, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 571, 571, 571, 572, 572, 573, 573, 574, 574,
+ 574, 575, 575, 575, 575, 575, 575, 575, 575, 575,
+ 576, 576, 576, 577, 577, 577, 577, 577, 577, 577,
+ 577, 577, 578, 578, 578, 579, 579, 579, 579, 579,
+ 579, 579, 579, 579, 580, 580, 580, 580, 580, 580,
+
+ 580, 580, 580, 581, 581, 581, 581, 581, 581, 581,
+ 581, 581, 582, 582, 582, 582, 582, 582, 582, 582,
+ 582, 583, 583, 583, 583, 583, 583, 583, 583, 583,
+ 584, 584, 584, 584, 584, 584, 584, 584, 584, 585,
+ 585, 585, 585, 585, 585, 585, 585, 585, 394, 393,
+ 392, 390, 388, 387, 386, 385, 384, 383, 381, 377,
+ 376, 375, 374, 373, 372, 371, 369, 365, 363, 362,
+ 360, 359, 358, 357, 356, 355, 354, 353, 351, 350,
+ 349, 348, 346, 345, 344, 343, 341, 340, 339, 338,
+ 336, 334, 333, 330, 329, 328, 327, 325, 324, 323,
+
+ 322, 321, 319, 318, 317, 316, 315, 314, 310, 308,
+ 305, 304, 303, 302, 298, 297, 296, 295, 294, 292,
+ 291, 290, 288, 286, 285, 283, 282, 281, 280, 279,
+ 278, 277, 276, 275, 274, 273, 272, 271, 270, 269,
+ 268, 267, 266, 265, 264, 262, 261, 260, 259, 257,
+ 256, 255, 254, 253, 252, 251, 249, 248, 247, 246,
+ 245, 243, 240, 239, 238, 236, 230, 228, 223, 217,
+ 216, 215, 214, 213, 212, 211, 210, 209, 208, 207,
+ 206, 205, 204, 203, 202, 201, 199, 198, 197, 196,
+ 195, 194, 193, 190, 189, 188, 187, 186, 185, 184,
+
+ 183, 182, 181, 180, 179, 178, 177, 176, 175, 174,
+ 173, 172, 171, 170, 169, 168, 167, 165, 164, 163,
+ 162, 161, 159, 158, 157, 155, 151, 138, 136, 135,
+ 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, 557, 557, 557, 557, 557, 557,
+
+ 557, 557, 557, 557, 557, 557, 557, 557, 557, 557,
+ 557, 557, 557, 557, 557, 557, 557, 557, 557, 557,
+ 557, 557, 557, 557, 557, 557, 557, 557, 557, 557,
+ 557, 557, 557, 557, 557, 557, 557, 557, 557, 557,
+ 557, 557, 557, 557, 557, 557, 557, 557, 557, 557,
+ 557, 557, 557, 557
+ } ;
+
+static tao_yy_state_type tao_yy_last_accepting_state;
+static char *tao_yy_last_accepting_cpos;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define tao_yymore() tao_yymore_used_but_not_detected
+#define TAO_YY_MORE_ADJ 0
+#define TAO_YY_RESTORE_TAO_YY_MORE_OFFSET
+#ifndef TAO_YYLMAX
+#define TAO_YYLMAX 8192
+#endif
+
+char tao_yytext[TAO_YYLMAX];
+char *tao_yytext_ptr;
+#define INITIAL 0
+/* idl.ll,v 1.98 2005/07/07 19:55:08 gmaxey Exp
+
+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.
+
+IDL_INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
+IDL_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.
+
+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.
+
+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
+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.
+
+ */
+
+/*
+ * idl.ll - Lexical scanner for IDL 1.1
+ */
+
+#include "idl_uns_long.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 "ast_root.h"
+#include "fe_interface_header.h"
+#include "global_extern.h"
+#include "fe_private.h"
+#include "fe_extern.h"
+#include "nr_extern.h"
+#include "y.tab.h"
+
+static char * idl_wstring_escape_reader (char *);
+static ACE_CDR::WChar idl_wchar_escape_reader (char *);
+static char idl_escape_reader (char *);
+static double idl_atof (char *);
+static long idl_atoi (char *, long);
+static idl_uns_long idl_atoui (char *, long);
+static void idl_parse_line_and_file (char *);
+static void idl_store_pragma (char *);
+static char * idl_get_pragma_string (char *);
+static bool idl_valid_version (char *);
+static AST_Decl * idl_find_node (char *);
+
+#define ace_tao_yytext tao_yytext
+
+/* SO we don't choke on files that use \r\n */
+#define TAO_YY_NEVER_INTERACTIVE 1
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef TAO_YY_SKIP_TAO_YYWRAP
+#ifdef __cplusplus
+extern "C" int tao_yywrap TAO_YY_PROTO(( void ));
+#else
+extern int tao_yywrap TAO_YY_PROTO(( void ));
+#endif
+#endif
+
+#ifndef TAO_YY_NO_UNPUT
+static void tao_yyunput TAO_YY_PROTO(( int c, char *buf_ptr ));
+#endif
+
+#ifndef tao_yytext_ptr
+static void tao_yy_flex_strncpy TAO_YY_PROTO(( char *, tao_yyconst char *, int ));
+#endif
+
+#ifdef TAO_YY_NEED_STRLEN
+static int tao_yy_flex_strlen TAO_YY_PROTO(( tao_yyconst char * ));
+#endif
+
+#ifndef TAO_YY_NO_INPUT
+#ifdef __cplusplus
+static int tao_yyinput TAO_YY_PROTO(( void ));
+#else
+static int input TAO_YY_PROTO(( void ));
+#endif
+#endif
+
+#if TAO_YY_STACK_USED
+static int tao_yy_start_stack_ptr = 0;
+static int tao_yy_start_stack_depth = 0;
+static int *tao_yy_start_stack = 0;
+#ifndef TAO_YY_NO_PUSH_STATE
+static void tao_yy_push_state TAO_YY_PROTO(( int new_state ));
+#endif
+#ifndef TAO_YY_NO_POP_STATE
+static void tao_yy_pop_state TAO_YY_PROTO(( void ));
+#endif
+#ifndef TAO_YY_NO_TOP_STATE
+static int tao_yy_top_state TAO_YY_PROTO(( void ));
+#endif
+
+#else
+#define TAO_YY_NO_PUSH_STATE 1
+#define TAO_YY_NO_POP_STATE 1
+#define TAO_YY_NO_TOP_STATE 1
+#endif
+
+#ifdef TAO_YY_MALLOC_DECL
+TAO_YY_MALLOC_DECL
+#else
+#if __STDC__
+#ifndef __cplusplus
+#endif
+#else
+/* Just try to get by without declaring the routines. This will fail
+ * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
+ * or sizeof(void*) != sizeof(int).
+ */
+#endif
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef TAO_YY_READ_BUF_SIZE
+#define TAO_YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+
+#ifndef TAO_YY_ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define TAO_YY_ECHO (void) fwrite( tao_yytext, tao_yyleng, 1, tao_yyout )
+#endif
+
+/* Gets input and stuffs it into "buf". number of characters read, or TAO_YY_NULL,
+ * is returned in "result".
+ */
+#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 = static_cast<int> (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();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef tao_yyterminate
+#define tao_yyterminate() return TAO_YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef TAO_YY_START_STACK_INCR
+#define TAO_YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef TAO_YY_FATAL_ERROR
+#define TAO_YY_FATAL_ERROR(msg) tao_yy_fatal_error( msg )
+#endif
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef TAO_YY_DECL
+#define TAO_YY_DECL int tao_yylex TAO_YY_PROTO(( void ))
+#endif
+
+/* Code executed at the beginning of each rule, after tao_yytext and tao_yyleng
+ * have been set up.
+ */
+#ifndef TAO_YY_USER_ACTION
+#define TAO_YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef TAO_YY_BREAK
+#define TAO_YY_BREAK ACE_NOTREACHED (break;)
+#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
+
+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;
+
+
+
+
+ if ( tao_yy_init )
+ {
+ tao_yy_init = 0;
+
+#ifdef TAO_YY_USER_INIT
+ TAO_YY_USER_INIT;
+#endif
+
+ if ( ! tao_yy_start )
+ tao_yy_start = 1; /* first start state */
+
+ if ( ! tao_yyin )
+ tao_yyin = stdin;
+
+ 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 );
+
+ tao_yy_load_buffer_state();
+ }
+
+ 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;
+
+ /* 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_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 >= 558 )
+ 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] != 1095 );
+
+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_DO_BEFORE_ACTION;
+
+
+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;
+
+case 1:
+TAO_YY_RULE_SETUP
+return IDL_ANY;
+ TAO_YY_BREAK
+case 2:
+TAO_YY_RULE_SETUP
+return IDL_OBJECT;
+ TAO_YY_BREAK
+case 3:
+TAO_YY_RULE_SETUP
+return IDL_MODULE;
+ TAO_YY_BREAK
+case 4:
+TAO_YY_RULE_SETUP
+return IDL_RAISES;
+ TAO_YY_BREAK
+case 5:
+TAO_YY_RULE_SETUP
+return IDL_READONLY;
+ TAO_YY_BREAK
+case 6:
+TAO_YY_RULE_SETUP
+return IDL_ATTRIBUTE;
+ TAO_YY_BREAK
+case 7:
+TAO_YY_RULE_SETUP
+return IDL_EXCEPTION;
+ TAO_YY_BREAK
+case 8:
+TAO_YY_RULE_SETUP
+return IDL_CONTEXT;
+ TAO_YY_BREAK
+case 9:
+TAO_YY_RULE_SETUP
+return IDL_INTERFACE;
+ TAO_YY_BREAK
+case 10:
+TAO_YY_RULE_SETUP
+return IDL_CONST;
+ TAO_YY_BREAK
+case 11:
+TAO_YY_RULE_SETUP
+return IDL_TYPEDEF;
+ TAO_YY_BREAK
+case 12:
+TAO_YY_RULE_SETUP
+return IDL_STRUCT;
+ TAO_YY_BREAK
+case 13:
+TAO_YY_RULE_SETUP
+return IDL_ENUM;
+ TAO_YY_BREAK
+case 14:
+TAO_YY_RULE_SETUP
+return IDL_STRING;
+ TAO_YY_BREAK
+case 15:
+TAO_YY_RULE_SETUP
+return IDL_WSTRING;
+ TAO_YY_BREAK
+case 16:
+TAO_YY_RULE_SETUP
+return IDL_SEQUENCE;
+ TAO_YY_BREAK
+case 17:
+TAO_YY_RULE_SETUP
+return IDL_UNION;
+ TAO_YY_BREAK
+case 18:
+TAO_YY_RULE_SETUP
+return IDL_FIXED;
+ TAO_YY_BREAK
+case 19:
+TAO_YY_RULE_SETUP
+return IDL_SWITCH;
+ TAO_YY_BREAK
+case 20:
+TAO_YY_RULE_SETUP
+return IDL_CASE;
+ TAO_YY_BREAK
+case 21:
+TAO_YY_RULE_SETUP
+return IDL_DEFAULT;
+ TAO_YY_BREAK
+case 22:
+TAO_YY_RULE_SETUP
+return IDL_FLOAT;
+ TAO_YY_BREAK
+case 23:
+TAO_YY_RULE_SETUP
+return IDL_DOUBLE;
+ TAO_YY_BREAK
+case 24:
+TAO_YY_RULE_SETUP
+return IDL_LONG;
+ TAO_YY_BREAK
+case 25:
+TAO_YY_RULE_SETUP
+return IDL_SHORT;
+ TAO_YY_BREAK
+case 26:
+TAO_YY_RULE_SETUP
+return IDL_UNSIGNED;
+ TAO_YY_BREAK
+case 27:
+TAO_YY_RULE_SETUP
+return IDL_CHAR;
+ TAO_YY_BREAK
+case 28:
+TAO_YY_RULE_SETUP
+return IDL_WCHAR;
+ TAO_YY_BREAK
+case 29:
+TAO_YY_RULE_SETUP
+return IDL_BOOLEAN;
+ TAO_YY_BREAK
+case 30:
+TAO_YY_RULE_SETUP
+return IDL_OCTET;
+ TAO_YY_BREAK
+case 31:
+TAO_YY_RULE_SETUP
+return IDL_VOID;
+ TAO_YY_BREAK
+case 32:
+TAO_YY_RULE_SETUP
+return IDL_NATIVE;
+ TAO_YY_BREAK
+case 33:
+TAO_YY_RULE_SETUP
+return IDL_LOCAL;
+ TAO_YY_BREAK
+case 34:
+TAO_YY_RULE_SETUP
+return IDL_ABSTRACT;
+ TAO_YY_BREAK
+case 35:
+TAO_YY_RULE_SETUP
+return IDL_CUSTOM;
+ TAO_YY_BREAK
+case 36:
+TAO_YY_RULE_SETUP
+return IDL_FACTORY;
+ TAO_YY_BREAK
+case 37:
+TAO_YY_RULE_SETUP
+return IDL_PRIVATE;
+ TAO_YY_BREAK
+case 38:
+TAO_YY_RULE_SETUP
+return IDL_PUBLIC;
+ TAO_YY_BREAK
+case 39:
+TAO_YY_RULE_SETUP
+return IDL_SUPPORTS;
+ TAO_YY_BREAK
+case 40:
+TAO_YY_RULE_SETUP
+return IDL_TRUNCATABLE;
+ TAO_YY_BREAK
+case 41:
+TAO_YY_RULE_SETUP
+return IDL_VALUETYPE;
+ TAO_YY_BREAK
+case 42:
+TAO_YY_RULE_SETUP
+return IDL_COMPONENT;
+ TAO_YY_BREAK
+case 43:
+TAO_YY_RULE_SETUP
+return IDL_CONSUMES;
+ TAO_YY_BREAK
+case 44:
+TAO_YY_RULE_SETUP
+return IDL_EMITS;
+ TAO_YY_BREAK
+case 45:
+TAO_YY_RULE_SETUP
+return IDL_EVENTTYPE;
+ TAO_YY_BREAK
+case 46:
+TAO_YY_RULE_SETUP
+return IDL_FINDER;
+ TAO_YY_BREAK
+case 47:
+TAO_YY_RULE_SETUP
+return IDL_GETRAISES;
+ TAO_YY_BREAK
+case 48:
+TAO_YY_RULE_SETUP
+return IDL_HOME;
+ TAO_YY_BREAK
+case 49:
+TAO_YY_RULE_SETUP
+return IDL_IMPORT;
+ TAO_YY_BREAK
+case 50:
+TAO_YY_RULE_SETUP
+return IDL_MULTIPLE;
+ TAO_YY_BREAK
+case 51:
+TAO_YY_RULE_SETUP
+return IDL_PRIMARYKEY;
+ TAO_YY_BREAK
+case 52:
+TAO_YY_RULE_SETUP
+return IDL_PROVIDES;
+ TAO_YY_BREAK
+case 53:
+TAO_YY_RULE_SETUP
+return IDL_PUBLISHES;
+ TAO_YY_BREAK
+case 54:
+TAO_YY_RULE_SETUP
+return IDL_SETRAISES;
+ TAO_YY_BREAK
+case 55:
+TAO_YY_RULE_SETUP
+return IDL_TYPEID;
+ TAO_YY_BREAK
+case 56:
+TAO_YY_RULE_SETUP
+return IDL_TYPEPREFIX;
+ TAO_YY_BREAK
+case 57:
+TAO_YY_RULE_SETUP
+return IDL_USES;
+ TAO_YY_BREAK
+case 58:
+TAO_YY_RULE_SETUP
+return 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 = ACE::strnew ("::");
+ 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++
+ // keyword and grab the mapping. BTW, the reason for the odd
+ // regular expression is to handle EBCDIC, as well as ASCII.
+
+ TAO_IDL_CPP_Keyword_Table cpp_key_tbl;
+ const TAO_IDL_CPP_Keyword_Entry *entry = 0;
+ if (!idl_global->preserve_cpp_keywords())
+ {
+ // This check will ensure that escaped C++ keywords will be
+ // caught and prepended with '_cxx' as non-escaped keywords
+ // are now prepended with '_cxx_'.
+ const char *tmp =
+ ace_tao_yytext[0] == '_' ? ace_tao_yytext + 1 : ace_tao_yytext;
+
+ entry =
+ cpp_key_tbl.lookup (tmp,
+ static_cast<unsigned int> (ACE_OS::strlen (tmp)));
+ }
+
+ if (entry)
+ {
+ tao_yylval.strval = ACE::strnew (entry->mapping_);
+ }
+ else
+ {
+ tao_yylval.strval = ACE::strnew (ace_tao_yytext);
+ }
+
+ return IDENTIFIER;
+}
+ 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 70:
+TAO_YY_RULE_SETUP
+{
+ tao_yylval.dval = idl_atof(ace_tao_yytext);
+ return IDL_FLOATING_PT_LITERAL;
+ }
+ 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 72:
+TAO_YY_RULE_SETUP
+{
+ 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 74:
+TAO_YY_RULE_SETUP
+{
+ tao_yylval.uival = idl_atoui(ace_tao_yytext, 16);
+ 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 76:
+TAO_YY_RULE_SETUP
+{
+ 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;
+ for(int i = ACE_OS::strlen(tmp) - 1; i >= 0; --i) {
+ if (isspace(tmp[i])) {
+ tmp[i] = '\0';
+ }
+ else {
+ break;
+ }
+ }
+ tmp[ACE_OS::strlen (tmp) - 1] = '\0';
+ ACE_NEW_RETURN (tao_yylval.sval,
+ UTL_String (tmp + 1),
+ IDL_STRING_LITERAL);
+ return IDL_STRING_LITERAL;
+ }
+ TAO_YY_BREAK
+case 78:
+TAO_YY_RULE_SETUP
+{
+ /* Skip the bookends */
+ char *tmp = ACE_OS::strdup (ace_tao_yytext);
+ for(int i = ACE_OS::strlen(tmp) - 1; i >= 0; --i) {
+ if (isspace(tmp[i])) {
+ tmp[i] = '\0';
+ }
+ else {
+ break;
+ }
+ }
+ tmp[ACE_OS::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 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 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 82:
+TAO_YY_RULE_SETUP
+{
+ 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 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 85:
+case 86:
+TAO_YY_RULE_SETUP
+{/* remember pragma */
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ idl_store_pragma(ace_tao_yytext);
+ }
+ break;
+case 87:
+case 88:
+TAO_YY_RULE_SETUP
+{/* ignore file */
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ }
+ break;
+case 89:
+case 90:
+TAO_YY_RULE_SETUP
+{
+ idl_parse_line_and_file(ace_tao_yytext);
+ }
+ break;
+case 91:
+case 92:
+TAO_YY_RULE_SETUP
+{
+ 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 95:
+case 96:
+TAO_YY_RULE_SETUP
+{
+ 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 99:
+TAO_YY_RULE_SETUP
+{
+ /* 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, 0);
+ if (c == '\n')
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ }
+ }
+ }
+ break;
+case 101:
+TAO_YY_RULE_SETUP
+;
+ break;
+case 102:
+TAO_YY_RULE_SETUP
+{
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ }
+ break;
+case 103:
+TAO_YY_RULE_SETUP
+return ace_tao_yytext [0];
+ TAO_YY_BREAK
+case 104:
+TAO_YY_RULE_SETUP
+TAO_YY_ECHO;
+ break;
+case TAO_YY_STATE_EOF(INITIAL):
+ tao_yyterminate();
+
+ case TAO_YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int tao_yy_amount_of_matched_text = (int) (tao_yy_cp - tao_yytext_ptr) - 1;
+
+ /* Undo the effects of TAO_YY_DO_BEFORE_ACTION. */
+ *tao_yy_cp = tao_yy_hold_char;
+ TAO_YY_RESTORE_TAO_YY_MORE_OFFSET
+
+ if ( tao_yy_current_buffer->tao_yy_buffer_status == TAO_YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed tao_yyin at a new source and called
+ * tao_yylex(). If so, then we have to assure
+ * consistency between tao_yy_current_buffer and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ tao_yy_n_chars = tao_yy_current_buffer->tao_yy_n_chars;
+ tao_yy_current_buffer->tao_yy_input_file = tao_yyin;
+ tao_yy_current_buffer->tao_yy_buffer_status = TAO_YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for tao_yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since tao_yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ 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_state_type tao_yy_next_state;
+
+ tao_yy_c_buf_p = tao_yytext_ptr + tao_yy_amount_of_matched_text;
+
+ tao_yy_current_state = tao_yy_get_previous_state();
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * tao_yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ tao_yy_next_state = tao_yy_try_NUL_trans( tao_yy_current_state );
+
+ tao_yy_bp = tao_yytext_ptr + TAO_YY_MORE_ADJ;
+
+ if ( tao_yy_next_state )
+ {
+ /* Consume the NUL. */
+ tao_yy_cp = ++tao_yy_c_buf_p;
+ tao_yy_current_state = tao_yy_next_state;
+ goto tao_yy_match;
+ }
+
+ else
+ {
+ tao_yy_cp = tao_yy_c_buf_p;
+ goto tao_yy_find_action;
+ }
+ }
+
+ else switch ( tao_yy_get_next_buffer() )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ tao_yy_did_buffer_switch_on_eof = 0;
+
+ if ( tao_yywrap() )
+ {
+ /* Note: because we've taken care in
+ * tao_yy_get_next_buffer() to have set up
+ * tao_yytext, we can now set up
+ * tao_yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * TAO_YY_NULL, it'll still work - another
+ * TAO_YY_NULL will get returned.
+ */
+ tao_yy_c_buf_p = tao_yytext_ptr + TAO_YY_MORE_ADJ;
+
+ tao_yy_act = TAO_YY_STATE_EOF(TAO_YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! tao_yy_did_buffer_switch_on_eof )
+ TAO_YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ tao_yy_c_buf_p =
+ tao_yytext_ptr + tao_yy_amount_of_matched_text;
+
+ tao_yy_current_state = tao_yy_get_previous_state();
+
+ tao_yy_cp = tao_yy_c_buf_p;
+ tao_yy_bp = tao_yytext_ptr + TAO_YY_MORE_ADJ;
+ goto tao_yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ tao_yy_c_buf_p =
+ &tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars];
+
+ tao_yy_current_state = tao_yy_get_previous_state();
+
+ tao_yy_cp = tao_yy_c_buf_p;
+ tao_yy_bp = tao_yytext_ptr + TAO_YY_MORE_ADJ;
+ goto tao_yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ TAO_YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* 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
+ */
+
+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;
+ }
+ }
+
+ /* 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;
+
+ 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;
+
+ 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. */
+#ifdef TAO_YY_USES_REJECT
+ TAO_YY_FATAL_ERROR(
+"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
+#else
+
+ /* just a shorter name for the current buffer */
+ TAO_YY_BUFFER_STATE b = tao_yy_current_buffer;
+
+ int tao_yy_c_buf_p_offset =
+ (int) (tao_yy_c_buf_p - b->tao_yy_ch_buf);
+
+ if ( b->tao_yy_is_our_buffer )
+ {
+ int new_size = b->tao_yy_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->tao_yy_buf_size += b->tao_yy_buf_size / 8;
+ else
+ b->tao_yy_buf_size *= 2;
+
+ b->tao_yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ tao_yy_flex_realloc( (void *) b->tao_yy_ch_buf,
+ b->tao_yy_buf_size + 2 );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->tao_yy_ch_buf = 0;
+
+ if ( ! b->tao_yy_ch_buf )
+ TAO_YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ tao_yy_c_buf_p = &b->tao_yy_ch_buf[tao_yy_c_buf_p_offset];
+
+ num_to_read = tao_yy_current_buffer->tao_yy_buf_size -
+ number_to_move - 1;
+#endif
+ }
+
+ if ( num_to_read > TAO_YY_READ_BUF_SIZE )
+ num_to_read = TAO_YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ TAO_YY_INPUT( (&tao_yy_current_buffer->tao_yy_ch_buf[number_to_move]),
+ tao_yy_n_chars, num_to_read );
+
+ tao_yy_current_buffer->tao_yy_n_chars = tao_yy_n_chars;
+ }
+
+ if ( tao_yy_n_chars == 0 )
+ {
+ if ( number_to_move == TAO_YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ tao_yyrestart( tao_yyin );
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ tao_yy_current_buffer->tao_yy_buffer_status =
+ TAO_YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ tao_yy_n_chars += number_to_move;
+ tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars] = TAO_YY_END_OF_BUFFER_CHAR;
+ tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars + 1] = TAO_YY_END_OF_BUFFER_CHAR;
+
+ tao_yytext_ptr = &tao_yy_current_buffer->tao_yy_ch_buf[0];
+
+ 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 >= 558 )
+ 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 );
+ */
+
+#ifdef TAO_YY_USE_PROTOS
+static tao_yy_state_type tao_yy_try_NUL_trans( tao_yy_state_type tao_yy_current_state )
+#else
+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 >= 558 )
+ 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 == 557);
+
+ return tao_yy_is_jam ? 0 : tao_yy_current_state;
+ }
+
+
+#ifndef TAO_YY_NO_UNPUT
+#ifdef TAO_YY_USE_PROTOS
+static void tao_yyunput( int c, register char *tao_yy_bp )
+#else
+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" );
+ }
+
+ *--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 */
+
+
+#ifndef TAO_YY_NO_INPUT
+#ifdef __cplusplus
+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;
+#ifdef __cplusplus
+ return tao_yyinput();
+#else
+ return input();
+#endif
+ }
+
+ 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;
+
+ tao_yy_current_buffer->tao_yy_at_bol = (c == '\n');
+
+ return c;
+ }
+#endif /* TAO_YY_NO_INPUT */
+
+#ifdef TAO_YY_USE_PROTOS
+void tao_yyrestart( FILE *input_file )
+#else
+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 );
+
+ tao_yy_init_buffer( tao_yy_current_buffer, input_file );
+ tao_yy_load_buffer_state();
+ }
+
+
+#ifdef TAO_YY_USE_PROTOS
+void tao_yy_switch_to_buffer( TAO_YY_BUFFER_STATE new_buffer )
+#else
+void tao_yy_switch_to_buffer( new_buffer )
+TAO_YY_BUFFER_STATE new_buffer;
+#endif
+ {
+ if ( tao_yy_current_buffer == new_buffer )
+ return;
+
+ if ( tao_yy_current_buffer )
+ {
+ /* Flush out information for old buffer. */
+ *tao_yy_c_buf_p = tao_yy_hold_char;
+ tao_yy_current_buffer->tao_yy_buf_pos = tao_yy_c_buf_p;
+ tao_yy_current_buffer->tao_yy_n_chars = tao_yy_n_chars;
+ }
+
+ tao_yy_current_buffer = new_buffer;
+ tao_yy_load_buffer_state();
+
+ /* We don't actually know whether we did this switch during
+ * EOF (tao_yywrap()) processing, but the only time this flag
+ * is looked at is after tao_yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ 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;
+ }
+
+
+#ifdef TAO_YY_USE_PROTOS
+TAO_YY_BUFFER_STATE tao_yy_create_buffer( FILE *file, int size )
+#else
+TAO_YY_BUFFER_STATE tao_yy_create_buffer( file, size )
+FILE *file;
+int size;
+#endif
+ {
+ 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_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()" );
+
+ b->tao_yy_is_our_buffer = 1;
+
+ tao_yy_init_buffer( b, file );
+
+ return b;
+ }
+
+
+#ifdef TAO_YY_USE_PROTOS
+void tao_yy_delete_buffer( TAO_YY_BUFFER_STATE b )
+#else
+void tao_yy_delete_buffer( b )
+TAO_YY_BUFFER_STATE b;
+#endif
+ {
+ if ( ! b )
+ return;
+
+ 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 );
+
+ tao_yy_flex_free( (void *) b );
+ }
+
+
+
+#ifdef TAO_YY_USE_PROTOS
+void tao_yy_init_buffer( TAO_YY_BUFFER_STATE b, FILE *file )
+#else
+void tao_yy_init_buffer( b, file )
+TAO_YY_BUFFER_STATE b;
+FILE *file;
+#endif
+
+
+ {
+ tao_yy_flush_buffer( b );
+
+ b->tao_yy_input_file = file;
+ b->tao_yy_fill_buffer = 1;
+
+#if TAO_YY_ALWAYS_INTERACTIVE
+ b->tao_yy_is_interactive = 1;
+#else
+#if TAO_YY_NEVER_INTERACTIVE
+ b->tao_yy_is_interactive = 0;
+#else
+ b->tao_yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+#endif
+#endif
+ }
+
+
+#ifdef TAO_YY_USE_PROTOS
+void tao_yy_flush_buffer( TAO_YY_BUFFER_STATE b )
+#else
+void tao_yy_flush_buffer( b )
+TAO_YY_BUFFER_STATE b;
+#endif
+
+ {
+ if ( ! b )
+ return;
+
+ 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;
+
+ 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;
+
+ if ( b == tao_yy_current_buffer )
+ tao_yy_load_buffer_state();
+ }
+
+
+#ifndef TAO_YY_NO_SCAN_BUFFER
+#ifdef TAO_YY_USE_PROTOS
+TAO_YY_BUFFER_STATE tao_yy_scan_buffer( char *base, tao_yy_size_t size )
+#else
+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;
+ }
+#endif
+
+
+#ifndef TAO_YY_NO_SCAN_STRING
+#ifdef TAO_YY_USE_PROTOS
+TAO_YY_BUFFER_STATE tao_yy_scan_string( tao_yyconst char *tao_yy_str )
+#else
+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 )
+ ;
+
+ return tao_yy_scan_bytes( tao_yy_str, len );
+ }
+#endif
+
+
+#ifndef TAO_YY_NO_SCAN_BYTES
+#ifdef TAO_YY_USE_PROTOS
+TAO_YY_BUFFER_STATE tao_yy_scan_bytes( tao_yyconst char *bytes, int len )
+#else
+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;
+
+ /* 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];
+
+ 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()" );
+
+ /* 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;
+ }
+#endif
+
+
+#ifndef TAO_YY_NO_PUSH_STATE
+#ifdef TAO_YY_USE_PROTOS
+static void tao_yy_push_state( int new_state )
+#else
+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;
+
+ 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 );
+
+ 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" );
+ }
+
+ tao_yy_start_stack[tao_yy_start_stack_ptr++] = TAO_YY_START;
+
+ 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" );
+
+ 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];
+ }
+#endif
+
+#ifndef TAO_YY_EXIT_FAILURE
+#define TAO_YY_EXIT_FAILURE 2
+#endif
+
+#ifdef TAO_YY_USE_PROTOS
+static void tao_yy_fatal_error( tao_yyconst char msg[] )
+#else
+static void tao_yy_fatal_error( msg )
+char msg[];
+#endif
+ {
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( TAO_YY_EXIT_FAILURE );
+ }
+
+
+
+/* Redefine tao_yyless() so it works in section 3 code. */
+
+#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 )
+
+
+/* Internal utility routines. */
+
+#ifndef tao_yytext_ptr
+#ifdef TAO_YY_USE_PROTOS
+static void tao_yy_flex_strncpy( char *s1, tao_yyconst char *s2, int n )
+#else
+static void tao_yy_flex_strncpy( s1, s2, n )
+char *s1;
+tao_yyconst char *s2;
+int n;
+#endif
+ {
+ register int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+ }
+#endif
+
+#ifdef TAO_YY_NEED_STRLEN
+#ifdef TAO_YY_USE_PROTOS
+static int tao_yy_flex_strlen( tao_yyconst char *s )
+#else
+static int tao_yy_flex_strlen( s )
+tao_yyconst char *s;
+#endif
+ {
+ register int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+ }
+#endif
+
+
+#ifdef TAO_YY_USE_PROTOS
+static void *tao_yy_flex_alloc( tao_yy_size_t size )
+#else
+static void *tao_yy_flex_alloc( size )
+tao_yy_size_t size;
+#endif
+ {
+ return (void *) malloc( size );
+ }
+
+#ifdef TAO_YY_USE_PROTOS
+static void *tao_yy_flex_realloc( void *ptr, tao_yy_size_t size )
+#else
+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 );
+ }
+
+#ifdef TAO_YY_USE_PROTOS
+static void tao_yy_flex_free( void *ptr )
+#else
+static void tao_yy_flex_free( ptr )
+void *ptr;
+#endif
+ {
+ free( ptr );
+ }
+
+#if TAO_YY_MAIN
+int main()
+ {
+ tao_yylex();
+ return 0;
+ }
+#endif
+
+ /* subroutines */
+
+// Parse a #line statement generated by the C preprocessor
+static void
+idl_parse_line_and_file (char *buf)
+{
+ char *r = buf;
+ char *h = 0;
+ UTL_String *nm = 0;
+
+ // Skip initial '#'.
+ if (*r != '#')
+ {
+ return;
+ }
+ else
+ {
+ r++;
+ }
+
+ // Check to see if we're running under the screwy Microsoft scheme
+ // of putting #line num instead of #num.
+
+ if (ACE_OS::strncmp (r, "line", 4) == 0)
+ {
+ r += 5;
+ }
+
+ // Find line number.
+ while (isspace (*r))
+ {
+ r++;
+ }
+
+ h = r;
+
+ for (; isdigit (*r); r++)
+ {
+ continue;
+ }
+
+ *r++ = 0;
+ idl_global->set_lineno ((long) idl_atoui (h, 10));
+
+ // Find file name, if present.
+ for (; *r != '"'; r++)
+ {
+ if (*r == '\n' || *r == '\0')
+ {
+ return;
+ }
+ }
+
+ h = ++r;
+
+ for (; *r != '"'; r++)
+ {
+ continue;
+ }
+
+ *r = 0;
+ UTL_String *tmp = 0;
+
+ if (*h == '\0')
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("IDL: No input files\n")));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
+ else
+ {
+ long i;
+ long j;
+
+ // Put Microsoft-style pathnames into a canonical form.
+ for (i = 0, j = 0; h[j] != '\0'; i++, j++)
+ {
+ if (h[j] == '\\' && h[j + 1] == '\\')
+ {
+ j++;
+ }
+
+ h[i] = h[j];
+ }
+
+ h[i] = '\0';
+ ACE_NEW (tmp,
+ UTL_String (h));
+ idl_global->update_prefix (tmp->get_string ());
+ idl_global->set_filename (tmp);
+ }
+
+ UTL_String *fname = idl_global->filename ();
+ bool in_main_file = false;
+ bool is_real_filename = fname->compare (idl_global->real_filename ());
+ bool is_main_filename = false;
+
+ if (!is_real_filename)
+ {
+ is_main_filename = fname->compare (idl_global->main_filename ());
+ }
+
+ if (is_real_filename || is_main_filename)
+ {
+ in_main_file = true;
+ }
+
+ idl_global->set_in_main_file (in_main_file);
+
+ // Strip off any command line -I prefix that may have been added
+ // by the preprocessor.
+ if (!(idl_global->in_main_file ()) && idl_global->import ())
+ {
+ ACE_NEW (
+ nm,
+ UTL_String (
+ idl_global->stripped_preproc_include (fname->get_string ())
+ )
+ );
+
+ // This call also manages the #pragma prefix.
+ idl_global->store_include_file_name (nm);
+ }
+}
+
+// Store a #pragma line into the list of pragmas
+static void
+idl_store_pragma (char *buf)
+{
+ char *sp = buf + 1;
+ int crunched = 0;
+
+ // Remove all the blanks between the '#' and the 'pragma'.
+ while (*sp != 'p')
+ {
+ ++sp;
+ ++crunched;
+ }
+
+ char *tp = buf + 1;
+
+ // This copies the crunched string back to the original, and
+ // also compensates for the behavior of the Sun preprocessor,
+ // which put spaces around the double colons of a non-quoted
+ // scoped name, a case which is possible in #pragma version.
+ // Also eats whitespace, which some preprocessors (for example
+ // Intel) don't automatically do.
+ while (*sp != '\n')
+ {
+ if (*sp == ' ' && (*(sp + 1) == ':' || *(sp + 1) == ' '))
+ {
+ ++crunched;
+ }
+ else if (*sp == ':' && *(sp + 1) == ' ')
+ {
+ *tp = *sp;
+ ++crunched;
+ ++sp;
+ ++tp;
+ }
+ else
+ {
+ *tp = *sp;
+ ++tp;
+ }
+
+ ++sp;
+ }
+
+ // The '\n' is still <crunched> spaces too far away, with
+ // garbage characters in between.
+ sp -= crunched;
+ *sp = '\0';
+
+ if (ACE_OS::strstr (buf + 8, "import") != 0)
+ {
+ idl_global->set_import (true);
+ return;
+ }
+
+ if (ACE_OS::strstr (buf + 8, "include") != 0)
+ {
+ idl_global->set_import (false);
+ return;
+ }
+
+ if (ACE_OS::strncmp (buf + 8, "prefix", 6) == 0)
+ {
+ char *new_prefix = idl_get_pragma_string (buf);
+
+ if (new_prefix != 0)
+ {
+ 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 ())
+ {
+ char *trash = 0;
+ idl_global->pragma_prefixes ().pop (trash);
+ delete [] trash;
+ }
+
+ UTL_Scope *top_scope = idl_global->scopes ().top ();
+
+ if (depth > 1)
+ {
+ top_scope->has_prefix (true);
+ ScopeAsDecl (top_scope)->prefix_scope (top_scope);
+ }
+
+ idl_global->pragma_prefixes ().push (new_prefix);
+
+ if (idl_global->in_main_file ())
+ {
+ idl_global->root ()->prefix (new_prefix);
+ idl_global->root ()->set_imported (false);
+ top_scope->has_prefix (true);
+ }
+
+ char *ext_id = idl_global->filename ()->get_string ();
+ char *int_id = 0;
+ int status = idl_global->file_prefixes ().find (ext_id,
+ int_id);
+
+ if (status != 0)
+ {
+ ext_id = ACE::strnew (ext_id);
+ int_id = ACE::strnew (new_prefix);
+ (void) idl_global->file_prefixes ().bind (ext_id,
+ int_id);
+ }
+ }
+ }
+ else if (ACE_OS::strncmp (buf + 8, "version", 7) == 0)
+ {
+ char *tmp = buf + 16;
+
+ while (*tmp == ' ' || *tmp == '\t')
+ {
+ ++tmp;
+ }
+
+ char *number = ACE_OS::strchr (tmp, ' ');
+
+ if (number == 0)
+ {
+ number = ACE_OS::strchr (tmp, '\t');
+ }
+
+ while (*number == ' ' || *number == '\t')
+ {
+ ++number;
+ }
+
+ size_t len = ACE_OS::strlen (number);
+
+ // For some reason, the SunCC preprocessor adds a trailing space, which
+ // messes with idl_valid_version() below, so we check and remove.
+ while (number[len - 1] == ' ')
+ {
+ number[len - 1] = '\0';
+ len = ACE_OS::strlen (number);
+ }
+
+ // This call adds a proper null terminator to tmp, so no need to
+ // do it here.
+ AST_Decl *d = idl_find_node (tmp);
+
+ if (d == 0)
+ {
+ return;
+ }
+
+ if (!idl_valid_version (number))
+ {
+ idl_global->err ()->version_number_error (number);
+ return;
+ }
+
+ d->version (ACE::strnew (number));
+ }
+ else if (ACE_OS::strncmp (buf + 8, "ident", 5) == 0)
+ {
+ idl_global->ident_string (buf + 8);
+ }
+ else if (ACE_OS::strncmp (buf + 8, "ID", 2) == 0)
+ {
+ char *tmp = buf + 11;
+
+ while (*tmp == ' ')
+ {
+ ++tmp;
+ }
+
+ AST_Decl *d = idl_find_node (tmp);
+
+ if (d == 0)
+ {
+ return;
+ }
+
+ char *new_id = idl_get_pragma_string (buf);
+
+ if (new_id != 0)
+ {
+ if (d->typeid_set ())
+ {
+ idl_global->err ()->id_reset_error (d->repoID (),
+ new_id);
+ return;
+ }
+
+ d->repoID (new_id);
+ d->typeid_set (true);
+ }
+ }
+ else if (ACE_OS::strncmp (buf + 8, "DCPS_DATA_TYPE", 14) == 0)
+ {
+ char *foo_type = idl_get_pragma_string (buf);
+ idl_global->add_dcps_data_type(foo_type);
+ }
+ else if (ACE_OS::strncmp (buf + 8, "DCPS_DATA_KEY", 13) == 0)
+ {
+ char *tmp = idl_get_pragma_string (buf);
+
+ // split up data type and key strings
+ char *foo_type = tmp;
+ while (*tmp && !isspace(*tmp))
+ tmp++;
+ while (isspace(*tmp))
+ {
+ *tmp = '\0';
+ tmp++;
+ }
+ char *key = tmp;
+
+ if (!idl_global->add_dcps_data_key(foo_type, key))
+ {
+ ACE_ERROR((LM_ERROR, "DCPS_DATA_TYPE \"%s\" not found for key \"%s\"\n",
+ foo_type, key));
+ }
+ }
+}
+
+/*
+ * idl_atoi - Convert a string of digits into a negative integer according to base b
+ */
+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;
+}
+
+/*
+ * idl_atoui - Convert a string of digits into an unsigned integer according to base b
+ */
+static idl_uns_long
+idl_atoui(char *s, long b)
+{
+ idl_uns_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;
+}
+
+/*
+ * Convert a string to a float; atof doesn't seem to work, always.
+ */
+static double
+idl_atof (char *s)
+{
+ double d = 0.0;
+ double e, k;
+ long neg = 0, negexp = 0;
+
+ 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;
+ }
+
+ return d;
+}
+
+/*
+ * Convert (some) escaped characters into their ascii values
+ */
+static char
+idl_escape_reader(
+ char *str
+ )
+{
+ if (str[0] != '\\')
+ {
+ return str[0];
+ }
+
+ switch (str[1])
+ {
+ case 'n':
+ return '\n';
+ case 't':
+ return '\t';
+ case 'v':
+ return '\v';
+ case 'b':
+ return '\b';
+ case 'r':
+ return '\r';
+ case 'f':
+ return '\f';
+ case 'a':
+ return '\a';
+ case '\\':
+ return '\\';
+ case '\?':
+ return '?';
+ case '\'':
+ return '\'';
+ case '"':
+ 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;)
+ 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;)
+ }
+}
+/*
+ * Convert escaped hex digits into a wchar
+ */
+static ACE_CDR::WChar
+idl_wchar_escape_reader (char *str)
+{
+ if (str[0] != '\\' || str[1] != 'u')
+ {
+ return 0;
+ }
+
+ int i;
+ // get the hex digits
+ for (i = 2; str[i] != '\0' && isxdigit (str[i]); i++)
+ {
+ continue;
+ }
+ char save = str[i];
+ str[i] = '\0';
+ ACE_CDR::WChar out = (ACE_CDR::WChar) idl_atoui (&str[2], 16);
+ str[i] = save;
+ return out;
+}
+
+/*
+ * Checks wstring for validity
+ */
+static char *
+idl_wstring_escape_reader (char *str)
+{
+ return str;
+}
+
+static char *
+idl_get_pragma_string (char *pragma)
+{
+ // Get pointers to each end of the substring between the quotes.
+ const char *start = ACE_OS::strchr (pragma, '"') + 1;
+ const char *end = ACE_OS::strchr (start, '"');
+
+ if (end == 0)
+ {
+ idl_global->err ()->syntax_error (
+ IDL_GlobalData::PS_PragmaPrefixSyntax
+ );
+
+ return 0;
+ }
+
+ int len = end - start;
+ char *retval = 0;
+
+ ACE_NEW_RETURN (retval,
+ char[len + 1],
+ 0);
+
+ ACE_OS::strncpy (retval,
+ start,
+ len);
+
+ retval[len] = '\0';
+ return retval;
+}
+
+static bool
+idl_valid_version (char *s)
+{
+ // Nothing preceding decimal point.
+ if (*s == '.')
+ {
+ return 0;
+ }
+
+ char *minor = ACE_OS::strchr (s, '.');
+ int i;
+
+ if (minor == 0)
+ {
+ // No decimal point.
+ return 0;
+ }
+
+ if (*(minor + 1) == '\0')
+ {
+ // Nothing following decimal point.
+ return 0;
+ }
+
+ char *tmp = minor + 1;
+
+ for (i = 0; tmp[i] != '\0'; ++i)
+ {
+ if (!isdigit (tmp[i]))
+ {
+ return 0;
+ }
+ }
+
+ int len = minor - s;
+
+ for (i = 0; i < len; ++i)
+ {
+ if (!isdigit (s[i]))
+ {
+ return 0;
+ }
+ }
+
+ // Major and minor version numbers must be unsigned shorts.
+ if (ACE_OS::atoi (minor + 1) > ACE_UINT16_MAX
+ || ACE_OS::atoi (s) > ACE_UINT16_MAX)
+ {
+ return 0;
+ }
+
+ return 1;
+}
+
+static AST_Decl *
+idl_find_node (char *s)
+{
+ UTL_ScopedName *node = idl_global->string_to_scoped_name (s);
+ AST_Decl *d = 0;
+
+ if (node != 0)
+ {
+ d = idl_global->scopes ().top_non_null ()->lookup_by_name (node,
+ true);
+ }
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (node);
+ }
+
+ node->destroy ();
+ delete node;
+ node = 0;
+
+ return d;
+}
diff --git a/TAO/TAO_IDL/fe/lex.yy.cpp.diff b/TAO/TAO_IDL/fe/lex.yy.cpp.diff
new file mode 100644
index 00000000000..82b0b590534
--- /dev/null
+++ b/TAO/TAO_IDL/fe/lex.yy.cpp.diff
@@ -0,0 +1,121 @@
+--- lex.yy.cpp.orig 2005-07-07 11:05:08.066403000 -0700
++++ lex.yy.cpp 2005-07-07 10:51:41.804932200 -0700
+@@ -1134,7 +1134,7 @@
+ TAO_YY_DECL
+ {
+ register tao_yy_state_type tao_yy_current_state;
+- register char *tao_yy_cp, *tao_yy_bp;
++ register char *tao_yy_cp = 0, *tao_yy_bp = 0;
+ register int tao_yy_act;
+
+
+@@ -1664,42 +1664,42 @@
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ idl_store_pragma(ace_tao_yytext);
+ }
+- TAO_YY_BREAK
++ break;
+ case 87:
+ /* rule 87 can match eol */
+ case 88:
+ /* rule 88 can match eol */
+ TAO_YY_RULE_SETUP
+ {/* ignore file */
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ }
+- TAO_YY_BREAK
++ break;
+ case 89:
+ /* rule 89 can match eol */
+ case 90:
+ /* rule 90 can match eol */
+ TAO_YY_RULE_SETUP
+ {
+ idl_parse_line_and_file(ace_tao_yytext);
+ }
+- TAO_YY_BREAK
++ break;
+ case 91:
+ /* rule 91 can match eol */
+ case 92:
+ /* rule 92 can match eol */
+ TAO_YY_RULE_SETUP
+ {
+ idl_parse_line_and_file(ace_tao_yytext);
+ }
+- TAO_YY_BREAK
++ break;
+ case 93:
+ /* rule 93 can match eol */
+ case 94:
+ /* rule 94 can match eol */
+ TAO_YY_RULE_SETUP
+ {
+ idl_parse_line_and_file(ace_tao_yytext);
+ }
+- TAO_YY_BREAK
++ break;
+ case 95:
+ /* rule 95 can match eol */
+ case 96:
+ /* rule 96 can match eol */
+ TAO_YY_RULE_SETUP
+ {
+ idl_parse_line_and_file(ace_tao_yytext);
+ }
+- TAO_YY_BREAK
++ break;
+ case 97:
+ /* rule 97 can match eol */
+ case 98:
+ /* rule 98 can match eol */
+ TAO_YY_RULE_SETUP
+ {
+ /* ignore cpp ident */
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ }
+- TAO_YY_BREAK
++ break;
+ case 99:
+ /* rule 99 can match eol */
+ TAO_YY_RULE_SETUP
+ {
+ /* ignore comments */
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ }
+- TAO_YY_BREAK
++ 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, 0);
+ if (c == '\n')
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ }
+ }
+ }
+- TAO_YY_BREAK
++ break;
+ case 101:
+ TAO_YY_RULE_SETUP
+ ;
+- TAO_YY_BREAK
++ break;
+ case 102:
+ /* rule 102 can match eol */
+ TAO_YY_RULE_SETUP
+ {
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ }
+- TAO_YY_BREAK
++ break;
+ case 103:
+ TAO_YY_RULE_SETUP
+ return ace_tao_yytext [0];
diff --git a/TAO/TAO_IDL/fe/y.tab.cpp b/TAO/TAO_IDL/fe/y.tab.cpp
new file mode 100644
index 00000000000..60469041f98
--- /dev/null
+++ b/TAO/TAO_IDL/fe/y.tab.cpp
@@ -0,0 +1,8237 @@
+// $Id$
+/* A Bison parser, made by GNU Bison 1.875d. */
+
+/* Skeleton parser for Yacc-like parsing with Bison,
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/* As a special exception, when this file is copied by Bison into a
+ Bison output file, you may use that output file without restriction.
+ This special exception was added by the Free Software Foundation
+ in version 1.24 of Bison. */
+
+/* Written by Richard Stallman by simplifying the original so called
+ ``semantic'' parser. */
+
+/* All symbols defined below should begin with tao_yy or TAO_YY, to avoid
+ infringing on user name space. This should be done even for local
+ variables, as they might otherwise be expanded by user macros.
+ There are some unavoidable exceptions within include files to
+ define necessary library symbols; they are noted "INFRINGES ON
+ USER NAME SPACE" below. */
+
+/* Identify Bison output. */
+#define TAO_YYBISON 1
+
+/* Skeleton name. */
+#define TAO_YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers. */
+#define TAO_YYPURE 0
+
+/* Using locations. */
+#define TAO_YYLSP_NEEDED 0
+
+
+
+/* Tokens. */
+#ifndef TAO_YYTOKENTYPE
+# define TAO_YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum tao_yytokentype {
+ IDENTIFIER = 258,
+ IDL_CONST = 259,
+ IDL_MODULE = 260,
+ IDL_INTERFACE = 261,
+ IDL_TYPEDEF = 262,
+ IDL_LONG = 263,
+ IDL_SHORT = 264,
+ IDL_UNSIGNED = 265,
+ IDL_DOUBLE = 266,
+ IDL_FLOAT = 267,
+ IDL_CHAR = 268,
+ IDL_WCHAR = 269,
+ IDL_OCTET = 270,
+ IDL_BOOLEAN = 271,
+ IDL_FIXED = 272,
+ IDL_ANY = 273,
+ IDL_OBJECT = 274,
+ IDL_STRUCT = 275,
+ IDL_UNION = 276,
+ IDL_SWITCH = 277,
+ IDL_ENUM = 278,
+ IDL_SEQUENCE = 279,
+ IDL_STRING = 280,
+ IDL_WSTRING = 281,
+ IDL_EXCEPTION = 282,
+ IDL_CASE = 283,
+ IDL_DEFAULT = 284,
+ IDL_READONLY = 285,
+ IDL_ATTRIBUTE = 286,
+ IDL_ONEWAY = 287,
+ IDL_IDEMPOTENT = 288,
+ IDL_VOID = 289,
+ IDL_IN = 290,
+ IDL_OUT = 291,
+ IDL_INOUT = 292,
+ IDL_RAISES = 293,
+ IDL_CONTEXT = 294,
+ IDL_NATIVE = 295,
+ IDL_LOCAL = 296,
+ IDL_ABSTRACT = 297,
+ IDL_CUSTOM = 298,
+ IDL_FACTORY = 299,
+ IDL_PRIVATE = 300,
+ IDL_PUBLIC = 301,
+ IDL_SUPPORTS = 302,
+ IDL_TRUNCATABLE = 303,
+ IDL_VALUETYPE = 304,
+ IDL_COMPONENT = 305,
+ IDL_CONSUMES = 306,
+ IDL_EMITS = 307,
+ IDL_EVENTTYPE = 308,
+ IDL_FINDER = 309,
+ IDL_GETRAISES = 310,
+ IDL_HOME = 311,
+ IDL_IMPORT = 312,
+ IDL_MULTIPLE = 313,
+ IDL_PRIMARYKEY = 314,
+ IDL_PROVIDES = 315,
+ IDL_PUBLISHES = 316,
+ IDL_SETRAISES = 317,
+ IDL_TYPEID = 318,
+ IDL_TYPEPREFIX = 319,
+ IDL_USES = 320,
+ IDL_MANAGES = 321,
+ IDL_INTEGER_LITERAL = 322,
+ IDL_UINTEGER_LITERAL = 323,
+ IDL_STRING_LITERAL = 324,
+ IDL_CHARACTER_LITERAL = 325,
+ IDL_FLOATING_PT_LITERAL = 326,
+ IDL_TRUETOK = 327,
+ IDL_FALSETOK = 328,
+ IDL_SCOPE_DELIMITOR = 329,
+ IDL_LEFT_SHIFT = 330,
+ IDL_RIGHT_SHIFT = 331,
+ IDL_WCHAR_LITERAL = 332,
+ IDL_WSTRING_LITERAL = 333
+ };
+#endif
+#define IDENTIFIER 258
+#define IDL_CONST 259
+#define IDL_MODULE 260
+#define IDL_INTERFACE 261
+#define IDL_TYPEDEF 262
+#define IDL_LONG 263
+#define IDL_SHORT 264
+#define IDL_UNSIGNED 265
+#define IDL_DOUBLE 266
+#define IDL_FLOAT 267
+#define IDL_CHAR 268
+#define IDL_WCHAR 269
+#define IDL_OCTET 270
+#define IDL_BOOLEAN 271
+#define IDL_FIXED 272
+#define IDL_ANY 273
+#define IDL_OBJECT 274
+#define IDL_STRUCT 275
+#define IDL_UNION 276
+#define IDL_SWITCH 277
+#define IDL_ENUM 278
+#define IDL_SEQUENCE 279
+#define IDL_STRING 280
+#define IDL_WSTRING 281
+#define IDL_EXCEPTION 282
+#define IDL_CASE 283
+#define IDL_DEFAULT 284
+#define IDL_READONLY 285
+#define IDL_ATTRIBUTE 286
+#define IDL_ONEWAY 287
+#define IDL_IDEMPOTENT 288
+#define IDL_VOID 289
+#define IDL_IN 290
+#define IDL_OUT 291
+#define IDL_INOUT 292
+#define IDL_RAISES 293
+#define IDL_CONTEXT 294
+#define IDL_NATIVE 295
+#define IDL_LOCAL 296
+#define IDL_ABSTRACT 297
+#define IDL_CUSTOM 298
+#define IDL_FACTORY 299
+#define IDL_PRIVATE 300
+#define IDL_PUBLIC 301
+#define IDL_SUPPORTS 302
+#define IDL_TRUNCATABLE 303
+#define IDL_VALUETYPE 304
+#define IDL_COMPONENT 305
+#define IDL_CONSUMES 306
+#define IDL_EMITS 307
+#define IDL_EVENTTYPE 308
+#define IDL_FINDER 309
+#define IDL_GETRAISES 310
+#define IDL_HOME 311
+#define IDL_IMPORT 312
+#define IDL_MULTIPLE 313
+#define IDL_PRIMARYKEY 314
+#define IDL_PROVIDES 315
+#define IDL_PUBLISHES 316
+#define IDL_SETRAISES 317
+#define IDL_TYPEID 318
+#define IDL_TYPEPREFIX 319
+#define IDL_USES 320
+#define IDL_MANAGES 321
+#define IDL_INTEGER_LITERAL 322
+#define IDL_UINTEGER_LITERAL 323
+#define IDL_STRING_LITERAL 324
+#define IDL_CHARACTER_LITERAL 325
+#define IDL_FLOATING_PT_LITERAL 326
+#define IDL_TRUETOK 327
+#define IDL_FALSETOK 328
+#define IDL_SCOPE_DELIMITOR 329
+#define IDL_LEFT_SHIFT 330
+#define IDL_RIGHT_SHIFT 331
+#define IDL_WCHAR_LITERAL 332
+#define IDL_WSTRING_LITERAL 333
+
+
+
+
+/* Copy the first part of user declarations. */
+
+
+#include "ast_argument.h"
+#include "ast_array.h"
+#include "ast_attribute.h"
+#include "ast_field.h"
+#include "ast_expression.h"
+#include "ast_operation.h"
+#include "ast_generator.h"
+#include "ast_module.h"
+#include "ast_valuebox.h"
+#include "ast_valuetype.h"
+#include "ast_valuetype_fwd.h"
+#include "ast_eventtype.h"
+#include "ast_eventtype_fwd.h"
+#include "ast_component.h"
+#include "ast_component_fwd.h"
+#include "ast_home.h"
+#include "ast_constant.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 "fe_declarator.h"
+#include "fe_interface_header.h"
+#include "utl_identifier.h"
+#include "utl_err.h"
+#include "utl_string.h"
+#include "utl_strlist.h"
+#include "utl_namelist.h"
+#include "utl_exprlist.h"
+#include "utl_labellist.h"
+#include "utl_decllist.h"
+#include "global_extern.h"
+#include "nr_extern.h"
+
+#if (defined(apollo) || defined(hpux)) && defined(__cplusplus)
+extern "C" int tao_yywrap();
+#endif // (defined(apollo) || defined(hpux)) && defined(__cplusplus)
+
+
+void tao_yyerror (const char *);
+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
+
+
+/* Enabling traces. */
+#ifndef TAO_YYDEBUG
+# define TAO_YYDEBUG 0
+#endif
+
+/* Enabling verbose error messages. */
+#ifdef TAO_YYERROR_VERBOSE
+# undef TAO_YYERROR_VERBOSE
+# define TAO_YYERROR_VERBOSE 1
+#else
+# define TAO_YYERROR_VERBOSE 0
+#endif
+
+#if ! defined (TAO_YYSTYPE) && ! defined (TAO_YYSTYPE_IS_DECLARED)
+
+typedef union TAO_YYSTYPE {
+ AST_Decl *dcval; /* Decl value */
+ UTL_StrList *slval; /* String list */
+ UTL_NameList *nlval; /* Name list */
+ UTL_ExprList *elval; /* Expression list */
+ UTL_LabelList *llval; /* Label list */
+ UTL_DeclList *dlval; /* Declaration list */
+ FE_InterfaceHeader *ihval; /* Interface header */
+ FE_OBVHeader *vhval; /* Valuetype header */
+ FE_EventHeader *ehval; /* Event 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 */
+ AST_Field::Visibility vival; /* N/A, pub or priv */
+ AST_Expression::ExprType etval; /* Expression type */
+ AST_Argument::Direction dival; /* Argument direction */
+ AST_Operation::Flags ofval; /* Operation flags */
+ FE_Declarator *deval; /* Declarator value */
+ bool bval; /* Boolean value */
+ long ival; /* Long value */
+ idl_uns_long uival; /* Unsigned long value */
+ double dval; /* Double value */
+ float fval; /* Float value */
+ char cval; /* Char value */
+ ACE_CDR::WChar wcval; /* WChar value */
+ UTL_String *sval; /* String value */
+ char *wsval; /* WString value */
+ char *strval; /* char * value */
+ Identifier *idval; /* Identifier */
+ UTL_IdList *idlist; /* Identifier list */
+} TAO_YYSTYPE;
+/* Line 191 of yacc.c. */
+
+# define tao_yystype TAO_YYSTYPE /* obsolescent; will be withdrawn */
+# define TAO_YYSTYPE_IS_DECLARED 1
+# define TAO_YYSTYPE_IS_TRIVIAL 1
+#endif
+
+
+
+/* Copy the second part of user declarations. */
+
+
+/* Line 214 of yacc.c. */
+
+
+#if ! defined (tao_yyoverflow) || TAO_YYERROR_VERBOSE
+
+/* The parser invokes alloca or malloc; define the necessary symbols. */
+
+# ifdef TAO_YYSTACK_USE_ALLOCA
+# if TAO_YYSTACK_USE_ALLOCA
+# define TAO_YYSTACK_ALLOC alloca
+# endif
+# else
+# if defined (alloca) || defined (_ALLOCA_H)
+# define TAO_YYSTACK_ALLOC alloca
+# else
+# ifdef __GNUC__
+# define TAO_YYSTACK_ALLOC __builtin_alloca
+# endif
+# endif
+# endif
+
+# ifdef TAO_YYSTACK_ALLOC
+ /* Pacify GCC's `empty if-body' warning. */
+# define TAO_YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+# else
+# if defined (__STDC__) || defined (__cplusplus)
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# define TAO_YYSIZE_T size_t
+# endif
+# define TAO_YYSTACK_ALLOC malloc
+# define TAO_YYSTACK_FREE free
+# endif
+#endif /* ! defined (tao_yyoverflow) || TAO_YYERROR_VERBOSE */
+
+
+#if (! defined (tao_yyoverflow) \
+ && (! defined (__cplusplus) \
+ || (defined (TAO_YYSTYPE_IS_TRIVIAL) && TAO_YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member. */
+union tao_yyalloc
+{
+ short tao_yyss;
+ TAO_YYSTYPE tao_yyvs;
+ };
+
+/* The size of the maximum gap between one aligned stack and the next. */
+# define TAO_YYSTACK_GAP_MAXIMUM (sizeof (union tao_yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+ N elements. */
+# define TAO_YYSTACK_BYTES(N) \
+ ((N) * (sizeof (short) + sizeof (TAO_YYSTYPE)) \
+ + TAO_YYSTACK_GAP_MAXIMUM)
+
+/* Copy COUNT objects from FROM to TO. The source and destination do
+ not overlap. */
+# ifndef TAO_YYCOPY
+# if defined (__GNUC__) && 1 < __GNUC__
+# define TAO_YYCOPY(To, From, Count) \
+ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+# else
+# define TAO_YYCOPY(To, From, Count) \
+ do \
+ { \
+ register TAO_YYSIZE_T tao_yyi; \
+ for (tao_yyi = 0; tao_yyi < (Count); tao_yyi++) \
+ (To)[tao_yyi] = (From)[tao_yyi]; \
+ } \
+ while (0)
+# endif
+# endif
+
+/* Relocate STACK from its old location to the new one. The
+ local variables TAO_YYSIZE and TAO_YYSTACKSIZE give the old and new number of
+ elements in the stack, and TAO_YYPTR gives the new location of the
+ stack. Advance TAO_YYPTR to a properly aligned location for the next
+ stack. */
+# define TAO_YYSTACK_RELOCATE(Stack) \
+ do \
+ { \
+ TAO_YYSIZE_T tao_yynewbytes; \
+ TAO_YYCOPY (&tao_yyptr->Stack, Stack, tao_yysize); \
+ Stack = &tao_yyptr->Stack; \
+ tao_yynewbytes = tao_yystacksize * sizeof (*Stack) + TAO_YYSTACK_GAP_MAXIMUM; \
+ tao_yyptr += tao_yynewbytes / sizeof (*tao_yyptr); \
+ } \
+ while (0)
+
+#endif
+
+#if defined (__STDC__) || defined (__cplusplus)
+ typedef signed char tao_yysigned_char;
+#else
+ typedef short tao_yysigned_char;
+#endif
+
+/* TAO_YYFINAL -- State number of the termination state. */
+#define TAO_YYFINAL 3
+/* TAO_YYLAST -- Last index in TAO_YYTABLE. */
+#define TAO_YYLAST 1111
+
+/* TAO_YYNTOKENS -- Number of terminals. */
+#define TAO_YYNTOKENS 100
+/* TAO_YYNNTS -- Number of nonterminals. */
+#define TAO_YYNNTS 322
+/* TAO_YYNRULES -- Number of rules. */
+#define TAO_YYNRULES 477
+/* TAO_YYNRULES -- Number of states. */
+#define TAO_YYNSTATES 675
+
+/* TAO_YYTRANSLATE(TAO_YYLEX) -- Bison symbol number corresponding to TAO_YYLEX. */
+#define TAO_YYUNDEFTOK 2
+#define TAO_YYMAXUTOK 333
+
+#define TAO_YYTRANSLATE(TAO_YYX) \
+ ((unsigned int) (TAO_YYX) <= TAO_YYMAXUTOK ? tao_yytranslate[TAO_YYX] : TAO_YYUNDEFTOK)
+
+/* TAO_YYTRANSLATE[TAO_YYLEX] -- Bison symbol number corresponding to TAO_YYLEX. */
+static const unsigned char tao_yytranslate[] =
+{
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 92, 87, 2,
+ 94, 95, 90, 88, 83, 89, 2, 91, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 82, 79,
+ 97, 84, 96, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 98, 2, 99, 86, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 80, 85, 81, 93, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
+ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
+ 75, 76, 77, 78
+};
+
+#if TAO_YYDEBUG
+/* TAO_YYPRHS[TAO_YYN] -- Index of the first RHS symbol of rule number TAO_YYN in
+ TAO_YYRHS. */
+static const unsigned short tao_yyprhs[] =
+{
+ 0, 0, 3, 5, 8, 9, 10, 14, 15, 19,
+ 20, 24, 25, 29, 30, 34, 35, 39, 40, 44,
+ 45, 49, 50, 54, 55, 59, 60, 64, 65, 69,
+ 70, 71, 72, 73, 83, 85, 87, 88, 89, 90,
+ 98, 99, 103, 106, 110, 114, 115, 120, 121, 123,
+ 125, 127, 129, 132, 134, 135, 136, 137, 145, 146,
+ 147, 148, 157, 158, 163, 164, 168, 170, 171, 174,
+ 175, 178, 180, 183, 186, 187, 189, 191, 194, 195,
+ 199, 200, 204, 207, 208, 209, 213, 214, 218, 219,
+ 223, 224, 228, 229, 233, 234, 238, 239, 243, 244,
+ 248, 251, 252, 257, 258, 260, 261, 265, 266, 271,
+ 273, 275, 278, 281, 282, 283, 284, 285, 295, 297,
+ 299, 301, 303, 305, 307, 309, 311, 313, 315, 317,
+ 319, 323, 325, 329, 331, 335, 337, 341, 345, 347,
+ 351, 355, 357, 361, 365, 369, 371, 374, 377, 380,
+ 382, 384, 388, 390, 392, 394, 396, 398, 400, 402,
+ 404, 406, 408, 409, 413, 415, 417, 419, 422, 424,
+ 425, 429, 431, 433, 435, 437, 439, 441, 443, 445,
+ 447, 449, 451, 453, 455, 457, 459, 461, 463, 465,
+ 467, 469, 471, 474, 475, 480, 481, 483, 485, 488,
+ 489, 494, 495, 497, 499, 501, 503, 505, 508, 510,
+ 513, 517, 520, 522, 524, 527, 529, 531, 533, 535,
+ 537, 539, 541, 542, 546, 547, 548, 549, 557, 560,
+ 563, 564, 565, 568, 569, 570, 576, 577, 581, 582,
+ 586, 587, 588, 589, 590, 591, 592, 607, 609, 611,
+ 613, 615, 617, 619, 622, 625, 626, 627, 628, 634,
+ 635, 639, 642, 645, 646, 647, 651, 652, 653, 659,
+ 660, 664, 666, 668, 669, 670, 671, 672, 682, 685,
+ 686, 691, 692, 694, 695, 696, 703, 706, 707, 708,
+ 714, 715, 716, 723, 725, 727, 728, 729, 736, 738,
+ 740, 741, 745, 748, 751, 752, 753, 754, 760, 762,
+ 764, 765, 766, 767, 768, 778, 779, 780, 781, 782,
+ 792, 793, 794, 795, 796, 806, 807, 808, 809, 810,
+ 821, 823, 825, 826, 828, 830, 831, 832, 833, 841,
+ 842, 846, 847, 852, 855, 856, 861, 862, 863, 864,
+ 870, 871, 875, 876, 881, 884, 885, 890, 891, 892,
+ 893, 899, 901, 903, 905, 907, 909, 911, 913, 914,
+ 915, 922, 923, 924, 925, 932, 933, 934, 935, 942,
+ 943, 944, 945, 952, 953, 956, 957, 962, 963, 967,
+ 971, 973, 975, 978, 979, 980, 981, 989, 990, 991,
+ 998, 999, 1003, 1004, 1007, 1008, 1009, 1013, 1014, 1018,
+ 1019, 1023, 1024, 1028, 1029, 1033, 1034, 1038, 1042, 1044,
+ 1046, 1051, 1053, 1054, 1058, 1062, 1066, 1067, 1071, 1072,
+ 1073, 1074, 1075, 1076, 1077, 1091, 1092, 1096, 1097, 1100,
+ 1101, 1102, 1103, 1109, 1112, 1113, 1115, 1116, 1120, 1121,
+ 1125, 1126, 1127, 1134, 1135, 1136, 1143, 1145, 1147, 1149,
+ 1151, 1153, 1156, 1160, 1161, 1162, 1163, 1172, 1176, 1180,
+ 1183, 1184, 1188, 1189, 1190, 1191, 1200, 1202
+};
+
+/* TAO_YYRHS -- A `-1'-separated list of the rules' RHS. */
+static const short tao_yyrhs[] =
+{
+ 101, 0, -1, 102, -1, 102, 103, -1, -1, -1,
+ 190, 104, 79, -1, -1, 351, 105, 79, -1, -1,
+ 352, 106, 79, -1, -1, 172, 107, 79, -1, -1,
+ 300, 108, 79, -1, -1, 121, 109, 79, -1, -1,
+ 116, 110, 79, -1, -1, 131, 111, 79, -1, -1,
+ 353, 112, 79, -1, -1, 379, 113, 79, -1, -1,
+ 404, 114, 79, -1, -1, 1, 115, 79, -1, -1,
+ -1, -1, -1, 5, 117, 3, 118, 80, 119, 102,
+ 120, 81, -1, 122, -1, 171, -1, -1, -1, -1,
+ 128, 123, 80, 124, 154, 125, 81, -1, -1, 6,
+ 127, 170, -1, 126, 129, -1, 41, 126, 129, -1,
+ 42, 126, 129, -1, -1, 82, 145, 130, 164, -1,
+ -1, 132, -1, 137, -1, 147, -1, 148, -1, 43,
+ 133, -1, 133, -1, -1, -1, -1, 141, 134, 80,
+ 135, 149, 136, 81, -1, -1, -1, -1, 42, 141,
+ 138, 80, 139, 154, 140, 81, -1, -1, 143, 129,
+ 142, 146, -1, -1, 49, 144, 170, -1, 48, -1,
+ -1, 47, 164, -1, -1, 42, 143, -1, 143, -1,
+ 143, 194, -1, 149, 150, -1, -1, 151, -1, 155,
+ -1, 312, 79, -1, -1, 46, 152, 229, -1, -1,
+ 45, 153, 229, -1, 154, 155, -1, -1, -1, 190,
+ 156, 79, -1, -1, 351, 157, 79, -1, -1, 352,
+ 158, 79, -1, -1, 172, 159, 79, -1, -1, 300,
+ 160, 79, -1, -1, 289, 161, 79, -1, -1, 305,
+ 162, 79, -1, -1, 1, 163, 79, -1, 167, 165,
+ -1, -1, 165, 83, 166, 167, -1, -1, 170, -1,
+ -1, 74, 168, 170, -1, -1, 167, 74, 169, 170,
+ -1, 3, -1, 126, -1, 41, 126, -1, 42, 126,
+ -1, -1, -1, -1, -1, 4, 173, 177, 174, 170,
+ 175, 84, 176, 178, -1, 209, -1, 214, -1, 215,
+ -1, 216, -1, 212, -1, 213, -1, 274, -1, 278,
+ -1, 167, -1, 179, -1, 180, -1, 181, -1, 180,
+ 85, 181, -1, 182, -1, 181, 86, 182, -1, 183,
+ -1, 182, 87, 183, -1, 184, -1, 183, 75, 184,
+ -1, 183, 76, 184, -1, 185, -1, 184, 88, 185,
+ -1, 184, 89, 185, -1, 186, -1, 185, 90, 186,
+ -1, 185, 91, 186, -1, 185, 92, 186, -1, 187,
+ -1, 88, 187, -1, 89, 187, -1, 93, 187, -1,
+ 167, -1, 188, -1, 94, 179, 95, -1, 67, -1,
+ 68, -1, 69, -1, 78, -1, 70, -1, 77, -1,
+ 71, -1, 72, -1, 73, -1, 179, -1, -1, 7,
+ 191, 192, -1, 221, -1, 235, -1, 259, -1, 40,
+ 207, -1, 199, -1, -1, 194, 193, 200, -1, 195,
+ -1, 198, -1, 196, -1, 197, -1, 167, -1, 209,
+ -1, 212, -1, 214, -1, 216, -1, 215, -1, 213,
+ -1, 217, -1, 218, -1, 268, -1, 274, -1, 278,
+ -1, 221, -1, 235, -1, 259, -1, 257, -1, 258,
+ -1, 203, 201, -1, -1, 201, 83, 202, 203, -1,
+ -1, 207, -1, 208, -1, 207, 205, -1, -1, 205,
+ 83, 206, 207, -1, -1, 170, -1, 282, -1, 210,
+ -1, 211, -1, 8, -1, 8, 8, -1, 9, -1,
+ 10, 8, -1, 10, 8, 8, -1, 10, 9, -1,
+ 11, -1, 12, -1, 8, 11, -1, 17, -1, 13,
+ -1, 14, -1, 15, -1, 16, -1, 18, -1, 19,
+ -1, -1, 20, 220, 170, -1, -1, -1, -1, 219,
+ 222, 80, 223, 225, 224, 81, -1, 227, 226, -1,
+ 226, 227, -1, -1, -1, 228, 229, -1, -1, -1,
+ 194, 230, 200, 231, 79, -1, -1, 1, 232, 79,
+ -1, -1, 21, 234, 170, -1, -1, -1, -1, -1,
+ -1, -1, 233, 22, 236, 94, 237, 242, 238, 95,
+ 239, 80, 240, 243, 241, 81, -1, 209, -1, 214,
+ -1, 215, -1, 216, -1, 259, -1, 167, -1, 245,
+ 244, -1, 244, 245, -1, -1, -1, -1, 249, 246,
+ 255, 247, 79, -1, -1, 1, 248, 79, -1, 251,
+ 250, -1, 250, 251, -1, -1, -1, 29, 252, 82,
+ -1, -1, -1, 28, 253, 179, 254, 82, -1, -1,
+ 194, 256, 203, -1, 219, -1, 233, -1, -1, -1,
+ -1, -1, 23, 260, 170, 261, 80, 262, 264, 263,
+ 81, -1, 267, 265, -1, -1, 265, 83, 266, 267,
+ -1, -1, 3, -1, -1, -1, 271, 83, 269, 189,
+ 270, 96, -1, 271, 96, -1, -1, -1, 24, 272,
+ 97, 273, 195, -1, -1, -1, 277, 97, 275, 189,
+ 276, 96, -1, 277, -1, 25, -1, -1, -1, 281,
+ 97, 279, 189, 280, 96, -1, 281, -1, 26, -1,
+ -1, 170, 283, 284, -1, 286, 285, -1, 285, 286,
+ -1, -1, -1, -1, 98, 287, 189, 288, 99, -1,
+ 290, -1, 295, -1, -1, -1, -1, -1, 30, 291,
+ 31, 292, 334, 293, 204, 294, 336, -1, -1, -1,
+ -1, -1, 31, 296, 334, 297, 204, 298, 339, 299,
+ 342, -1, -1, -1, -1, -1, 27, 301, 170, 302,
+ 80, 303, 226, 304, 81, -1, -1, -1, -1, -1,
+ 310, 311, 306, 3, 307, 325, 308, 336, 309, 345,
+ -1, 32, -1, 33, -1, -1, 334, -1, 34, -1,
+ -1, -1, -1, 44, 313, 3, 314, 316, 315, 336,
+ -1, -1, 94, 317, 95, -1, -1, 94, 318, 319,
+ 95, -1, 322, 320, -1, -1, 320, 83, 321, 322,
+ -1, -1, -1, -1, 35, 323, 334, 324, 203, -1,
+ -1, 94, 326, 95, -1, -1, 94, 327, 328, 95,
+ -1, 331, 329, -1, -1, 329, 83, 330, 331, -1,
+ -1, -1, -1, 335, 332, 334, 333, 203, -1, 196,
+ -1, 274, -1, 278, -1, 167, -1, 35, -1, 36,
+ -1, 37, -1, -1, -1, 38, 337, 94, 338, 164,
+ 95, -1, -1, -1, -1, 55, 340, 94, 341, 164,
+ 95, -1, -1, -1, -1, 62, 343, 94, 344, 164,
+ 95, -1, -1, -1, -1, 39, 346, 94, 347, 348,
+ 95, -1, -1, 69, 349, -1, -1, 349, 83, 350,
+ 69, -1, -1, 63, 167, 69, -1, 64, 167, 69,
+ -1, 355, -1, 354, -1, 50, 170, -1, -1, -1,
+ -1, 359, 356, 80, 357, 364, 358, 81, -1, -1,
+ -1, 50, 170, 360, 362, 361, 146, -1, -1, 82,
+ 363, 167, -1, -1, 364, 365, -1, -1, -1, 372,
+ 366, 79, -1, -1, 374, 367, 79, -1, -1, 376,
+ 368, 79, -1, -1, 377, 369, 79, -1, -1, 378,
+ 370, 79, -1, -1, 289, 371, 79, -1, 60, 373,
+ 170, -1, 167, -1, 19, -1, 65, 375, 373, 170,
+ -1, 58, -1, -1, 52, 167, 170, -1, 61, 167,
+ 170, -1, 51, 167, 170, -1, -1, 381, 380, 391,
+ -1, -1, -1, -1, -1, -1, -1, 56, 382, 170,
+ 383, 388, 384, 146, 385, 66, 386, 167, 387, 390,
+ -1, -1, 82, 389, 167, -1, -1, 59, 167, -1,
+ -1, -1, -1, 80, 392, 394, 393, 81, -1, 394,
+ 395, -1, -1, 155, -1, -1, 398, 396, 79, -1,
+ -1, 401, 397, 79, -1, -1, -1, 44, 170, 399,
+ 316, 400, 336, -1, -1, -1, 54, 170, 402, 316,
+ 403, 336, -1, 417, -1, 408, -1, 405, -1, 407,
+ -1, 406, -1, 53, 170, -1, 42, 53, 170, -1,
+ -1, -1, -1, 412, 415, 409, 80, 410, 154, 411,
+ 81, -1, 42, 53, 170, -1, 43, 53, 170, -1,
+ 53, 170, -1, -1, 129, 416, 146, -1, -1, -1,
+ -1, 421, 415, 418, 80, 419, 149, 420, 81, -1,
+ 413, -1, 414, -1
+};
+
+/* TAO_YYRLINE[TAO_YYN] -- source line where rule number TAO_YYN was defined. */
+static const unsigned short tao_yyrline[] =
+{
+ 0, 320, 320, 323, 324, 329, 328, 339, 338, 349,
+ 348, 359, 358, 369, 368, 379, 378, 389, 388, 399,
+ 398, 409, 408, 419, 418, 429, 428, 439, 438, 452,
+ 457, 483, 488, 451, 504, 505, 510, 549, 554, 509,
+ 572, 571, 585, 623, 654, 688, 687, 699, 706, 707,
+ 708, 709, 713, 724, 729, 773, 778, 728, 807, 846,
+ 851, 805, 870, 868, 919, 918, 932, 938, 945, 952,
+ 959, 985, 1012, 1067, 1068, 1072, 1073, 1074, 1080, 1079,
+ 1087, 1086, 1096, 1097, 1102, 1101, 1112, 1111, 1122, 1121,
+ 1132, 1131, 1142, 1141, 1152, 1151, 1162, 1161, 1172, 1171,
+ 1185, 1198, 1196, 1226, 1233, 1244, 1243, 1271, 1269, 1296,
+ 1308, 1354, 1382, 1413, 1418, 1423, 1428, 1412, 1481, 1482,
+ 1483, 1484, 1485, 1486, 1487, 1499, 1504, 1579, 1581, 1583,
+ 1584, 1598, 1599, 1613, 1614, 1627, 1628, 1638, 1651, 1652,
+ 1662, 1675, 1676, 1686, 1696, 1709, 1710, 1720, 1730, 1743,
+ 1778, 1779, 1788, 1793, 1800, 1808, 1813, 1818, 1824, 1829,
+ 1834, 1842, 1914, 1913, 1923, 1928, 1933, 1938, 1965, 1974,
+ 1973, 2032, 2033, 2037, 2045, 2046, 2074, 2075, 2076, 2077,
+ 2078, 2079, 2080, 2081, 2085, 2086, 2087, 2091, 2092, 2093,
+ 2097, 2098, 2102, 2115, 2113, 2143, 2150, 2151, 2155, 2168,
+ 2166, 2196, 2203, 2220, 2239, 2240, 2244, 2249, 2254, 2262,
+ 2267, 2272, 2280, 2285, 2290, 2298, 2312, 2317, 2325, 2333,
+ 2341, 2349, 2358, 2357, 2373, 2407, 2412, 2372, 2431, 2434,
+ 2435, 2439, 2439, 2449, 2454, 2448, 2517, 2516, 2531, 2530,
+ 2545, 2550, 2555, 2560, 2607, 2612, 2544, 2636, 2644, 2658,
+ 2668, 2676, 2677, 2785, 2788, 2789, 2794, 2799, 2793, 2835,
+ 2834, 2848, 2859, 2881, 2889, 2888, 2904, 2909, 2903, 2926,
+ 2925, 2978, 3002, 3027, 3032, 3065, 3070, 3026, 3096, 3101,
+ 3099, 3106, 3110, 3147, 3152, 3145, 3219, 3274, 3284, 3273,
+ 3299, 3304, 3297, 3345, 3369, 3379, 3384, 3377, 3414, 3437,
+ 3446, 3445, 3481, 3492, 3514, 3522, 3527, 3521, 3564, 3565,
+ 3570, 3575, 3580, 3585, 3569, 3654, 3659, 3664, 3669, 3653,
+ 3747, 3752, 3782, 3787, 3746, 3805, 3810, 3863, 3868, 3803,
+ 3905, 3911, 3918, 3925, 3926, 3938, 3944, 3986, 3937, 4008,
+ 4007, 4018, 4017, 4030, 4035, 4033, 4040, 4045, 4050, 4044,
+ 4091, 4090, 4101, 4100, 4113, 4118, 4116, 4123, 4128, 4133,
+ 4127, 4180, 4188, 4189, 4190, 4233, 4238, 4243, 4252, 4257,
+ 4251, 4269, 4277, 4282, 4276, 4294, 4302, 4307, 4301, 4319,
+ 4327, 4332, 4326, 4344, 4351, 4364, 4362, 4390, 4397, 4426,
+ 4464, 4465, 4469, 4499, 4539, 4544, 4498, 4563, 4568, 4561,
+ 4610, 4609, 4620, 4627, 4628, 4633, 4632, 4643, 4642, 4653,
+ 4652, 4663, 4662, 4673, 4672, 4683, 4682, 4695, 4759, 4766,
+ 4791, 4864, 4870, 4877, 4935, 4993, 5052, 5051, 5101, 5106,
+ 5111, 5116, 5121, 5126, 5100, 5180, 5179, 5190, 5197, 5204,
+ 5212, 5217, 5211, 5229, 5230, 5234, 5236, 5235, 5246, 5245,
+ 5260, 5296, 5258, 5330, 5366, 5328, 5398, 5399, 5400, 5404,
+ 5405, 5409, 5437, 5468, 5513, 5518, 5466, 5535, 5545, 5564,
+ 5576, 5575, 5626, 5676, 5681, 5624, 5698, 5703
+};
+#endif
+
+#if TAO_YYDEBUG || TAO_YYERROR_VERBOSE
+/* TAO_YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+ First, the terminals, then, starting at TAO_YYNTOKENS, nonterminals. */
+static const char *const tao_yytname[] =
+{
+ "$end", "error", "$undefined", "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_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", "';'",
+ "'{'", "'}'", "':'", "','", "'='", "'|'", "'^'", "'&'", "'+'", "'-'",
+ "'*'", "'/'", "'%'", "'~'", "'('", "')'", "'>'", "'<'", "'['", "']'",
+ "$accept", "start", "definitions", "definition", "@1", "@2", "@3", "@4",
+ "@5", "@6", "@7", "@8", "@9", "@10", "@11", "@12", "module", "@13",
+ "@14", "@15", "@16", "interface_def", "interface", "@17", "@18", "@19",
+ "interface_decl", "@20", "interface_header", "inheritance_spec", "@21",
+ "value_def", "valuetype", "value_concrete_decl", "@22", "@23", "@24",
+ "value_abs_decl", "@25", "@26", "@27", "value_header", "@28",
+ "value_decl", "@29", "opt_truncatable", "supports_spec",
+ "value_forward_decl", "value_box_decl", "value_elements",
+ "value_element", "state_member", "@30", "@31", "exports", "export",
+ "@32", "@33", "@34", "@35", "@36", "@37", "@38", "@39",
+ "at_least_one_scoped_name", "scoped_names", "@40", "scoped_name", "@41",
+ "@42", "id", "interface_forward", "const_dcl", "@43", "@44", "@45",
+ "@46", "const_type", "expression", "const_expr", "or_expr", "xor_expr",
+ "and_expr", "shift_expr", "add_expr", "mult_expr", "unary_expr",
+ "primary_expr", "literal", "positive_int_expr", "type_dcl", "@47",
+ "type_declarator", "@48", "type_spec", "simple_type_spec",
+ "base_type_spec", "template_type_spec", "constructed_type_spec",
+ "constructed_forward_type_spec", "at_least_one_declarator",
+ "declarators", "@49", "declarator", "at_least_one_simple_declarator",
+ "simple_declarators", "@50", "simple_declarator", "complex_declarator",
+ "integer_type", "signed_int", "unsigned_int", "floating_pt_type",
+ "fixed_type", "char_type", "octet_type", "boolean_type", "any_type",
+ "object_type", "struct_decl", "@51", "struct_type", "@52", "@53", "@54",
+ "at_least_one_member", "members", "member", "@55", "member_i", "@56",
+ "@57", "@58", "union_decl", "@59", "union_type", "@60", "@61", "@62",
+ "@63", "@64", "@65", "switch_type_spec", "at_least_one_case_branch",
+ "case_branches", "case_branch", "@66", "@67", "@68",
+ "at_least_one_case_label", "case_labels", "case_label", "@69", "@70",
+ "@71", "element_spec", "@72", "struct_forward_type",
+ "union_forward_type", "enum_type", "@73", "@74", "@75", "@76",
+ "at_least_one_enumerator", "enumerators", "@77", "enumerator",
+ "sequence_type_spec", "@78", "@79", "seq_head", "@80", "@81",
+ "string_type_spec", "@82", "@83", "string_head", "wstring_type_spec",
+ "@84", "@85", "wstring_head", "array_declarator", "@86",
+ "at_least_one_array_dim", "array_dims", "array_dim", "@87", "@88",
+ "attribute", "attribute_readonly", "@89", "@90", "@91", "@92",
+ "attribute_readwrite", "@93", "@94", "@95", "@96", "exception", "@97",
+ "@98", "@99", "@100", "operation", "@101", "@102", "@103", "@104",
+ "opt_op_attribute", "op_type_spec", "init_decl", "@105", "@106", "@107",
+ "init_parameter_list", "@108", "@109", "at_least_one_in_parameter",
+ "in_parameters", "@110", "in_parameter", "@111", "@112",
+ "parameter_list", "@113", "@114", "at_least_one_parameter", "parameters",
+ "@115", "parameter", "@116", "@117", "param_type_spec", "direction",
+ "opt_raises", "@118", "@119", "opt_getraises", "@120", "@121",
+ "opt_setraises", "@122", "@123", "opt_context", "@124", "@125",
+ "at_least_one_string_literal", "string_literals", "@126", "typeid_dcl",
+ "typeprefix_dcl", "component", "component_forward_decl",
+ "component_decl", "@127", "@128", "@129", "component_header", "@130",
+ "@131", "component_inheritance_spec", "@132", "component_exports",
+ "component_export", "@133", "@134", "@135", "@136", "@137", "@138",
+ "provides_decl", "interface_type", "uses_decl", "opt_multiple",
+ "emits_decl", "publishes_decl", "consumes_decl", "home_decl", "@139",
+ "home_header", "@140", "@141", "@142", "@143", "@144", "@145",
+ "home_inheritance_spec", "@146", "primary_key_spec", "home_body", "@147",
+ "@148", "home_exports", "home_export", "@149", "@150", "factory_decl",
+ "@151", "@152", "finder_decl", "@153", "@154", "event",
+ "event_forward_decl", "event_concrete_forward_decl",
+ "event_abs_forward_decl", "event_abs_decl", "@155", "@156", "@157",
+ "event_abs_header", "event_custom_header", "event_plain_header",
+ "event_rest_of_header", "@158", "event_decl", "@159", "@160", "@161",
+ "event_header", 0
+};
+#endif
+
+# ifdef TAO_YYPRINT
+/* TAO_YYTOKNUM[TAO_YYLEX-NUM] -- Internal token number corresponding to
+ token TAO_YYLEX-NUM. */
+static const unsigned short tao_yytoknum[] =
+{
+ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
+ 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
+ 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
+ 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
+ 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
+ 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
+ 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
+ 325, 326, 327, 328, 329, 330, 331, 332, 333, 59,
+ 123, 125, 58, 44, 61, 124, 94, 38, 43, 45,
+ 42, 47, 37, 126, 40, 41, 62, 60, 91, 93
+};
+# endif
+
+/* TAO_YYR1[TAO_YYN] -- Symbol number of symbol that rule TAO_YYN derives. */
+static const unsigned short tao_yyr1[] =
+{
+ 0, 100, 101, 102, 102, 104, 103, 105, 103, 106,
+ 103, 107, 103, 108, 103, 109, 103, 110, 103, 111,
+ 103, 112, 103, 113, 103, 114, 103, 115, 103, 117,
+ 118, 119, 120, 116, 121, 121, 123, 124, 125, 122,
+ 127, 126, 128, 128, 128, 130, 129, 129, 131, 131,
+ 131, 131, 132, 132, 134, 135, 136, 133, 138, 139,
+ 140, 137, 142, 141, 144, 143, 145, 145, 146, 146,
+ 147, 147, 148, 149, 149, 150, 150, 150, 152, 151,
+ 153, 151, 154, 154, 156, 155, 157, 155, 158, 155,
+ 159, 155, 160, 155, 161, 155, 162, 155, 163, 155,
+ 164, 166, 165, 165, 167, 168, 167, 169, 167, 170,
+ 171, 171, 171, 173, 174, 175, 176, 172, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 178, 179, 180,
+ 180, 181, 181, 182, 182, 183, 183, 183, 184, 184,
+ 184, 185, 185, 185, 185, 186, 186, 186, 186, 187,
+ 187, 187, 188, 188, 188, 188, 188, 188, 188, 188,
+ 188, 189, 191, 190, 190, 190, 190, 190, 190, 193,
+ 192, 194, 194, 195, 195, 195, 196, 196, 196, 196,
+ 196, 196, 196, 196, 197, 197, 197, 198, 198, 198,
+ 199, 199, 200, 202, 201, 201, 203, 203, 204, 206,
+ 205, 205, 207, 208, 209, 209, 210, 210, 210, 211,
+ 211, 211, 212, 212, 212, 213, 214, 214, 215, 216,
+ 217, 218, 220, 219, 222, 223, 224, 221, 225, 226,
+ 226, 228, 227, 230, 231, 229, 232, 229, 234, 233,
+ 236, 237, 238, 239, 240, 241, 235, 242, 242, 242,
+ 242, 242, 242, 243, 244, 244, 246, 247, 245, 248,
+ 245, 249, 250, 250, 252, 251, 253, 254, 251, 256,
+ 255, 257, 258, 260, 261, 262, 263, 259, 264, 266,
+ 265, 265, 267, 269, 270, 268, 268, 272, 273, 271,
+ 275, 276, 274, 274, 277, 279, 280, 278, 278, 281,
+ 283, 282, 284, 285, 285, 287, 288, 286, 289, 289,
+ 291, 292, 293, 294, 290, 296, 297, 298, 299, 295,
+ 301, 302, 303, 304, 300, 306, 307, 308, 309, 305,
+ 310, 310, 310, 311, 311, 313, 314, 315, 312, 317,
+ 316, 318, 316, 319, 321, 320, 320, 323, 324, 322,
+ 326, 325, 327, 325, 328, 330, 329, 329, 332, 333,
+ 331, 334, 334, 334, 334, 335, 335, 335, 337, 338,
+ 336, 336, 340, 341, 339, 339, 343, 344, 342, 342,
+ 346, 347, 345, 345, 348, 350, 349, 349, 351, 352,
+ 353, 353, 354, 356, 357, 358, 355, 360, 361, 359,
+ 363, 362, 362, 364, 364, 366, 365, 367, 365, 368,
+ 365, 369, 365, 370, 365, 371, 365, 372, 373, 373,
+ 374, 375, 375, 376, 377, 378, 380, 379, 382, 383,
+ 384, 385, 386, 387, 381, 389, 388, 388, 390, 390,
+ 392, 393, 391, 394, 394, 395, 396, 395, 397, 395,
+ 399, 400, 398, 402, 403, 401, 404, 404, 404, 405,
+ 405, 406, 407, 409, 410, 411, 408, 412, 413, 414,
+ 416, 415, 418, 419, 420, 417, 421, 421
+};
+
+/* TAO_YYR2[TAO_YYN] -- Number of symbols composing right hand side of rule TAO_YYN. */
+static const unsigned char tao_yyr2[] =
+{
+ 0, 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, 4, 0, 1, 1,
+ 1, 1, 2, 1, 0, 0, 0, 7, 0, 0,
+ 0, 8, 0, 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, 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, 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, 1, 1,
+ 0, 0, 0, 0, 9, 0, 0, 0, 0, 9,
+ 0, 0, 0, 0, 9, 0, 0, 0, 0, 10,
+ 1, 1, 0, 1, 1, 0, 0, 0, 7, 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, 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, 0, 0, 0, 8, 3, 3, 2,
+ 0, 3, 0, 0, 0, 8, 1, 1
+};
+
+/* TAO_YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
+ STATE-NUM when TAO_YYTABLE doesn't specify something else to do. Zero
+ means the default is an error. */
+static const unsigned short tao_yydefact[] =
+{
+ 4, 0, 0, 1, 27, 113, 29, 40, 162, 222,
+ 238, 273, 320, 0, 0, 0, 0, 64, 0, 0,
+ 428, 0, 0, 3, 17, 15, 34, 47, 36, 19,
+ 48, 53, 49, 54, 47, 50, 51, 35, 11, 5,
+ 168, 224, 164, 272, 165, 190, 191, 166, 13, 7,
+ 9, 21, 391, 390, 393, 23, 426, 25, 458, 460,
+ 459, 457, 47, 476, 477, 456, 47, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 109, 202, 167, 47,
+ 0, 47, 58, 47, 0, 52, 47, 0, 397, 469,
+ 0, 105, 0, 104, 0, 0, 0, 67, 42, 0,
+ 0, 0, 206, 208, 0, 212, 213, 216, 217, 218,
+ 219, 215, 220, 221, 287, 294, 299, 62, 175, 72,
+ 171, 173, 174, 172, 176, 204, 205, 177, 181, 178,
+ 180, 179, 182, 183, 224, 187, 0, 188, 189, 184,
+ 0, 185, 293, 186, 298, 0, 0, 0, 240, 0,
+ 0, 0, 0, 0, 0, 0, 0, 470, 463, 472,
+ 28, 126, 114, 118, 122, 123, 119, 120, 121, 124,
+ 125, 30, 41, 163, 169, 223, 239, 274, 321, 43,
+ 467, 44, 0, 468, 65, 402, 429, 0, 388, 107,
+ 389, 18, 16, 66, 45, 37, 20, 55, 207, 214,
+ 209, 211, 0, 69, 283, 286, 290, 295, 12, 6,
+ 225, 0, 14, 8, 10, 22, 394, 24, 440, 427,
+ 26, 69, 0, 0, 0, 0, 0, 0, 0, 59,
+ 400, 398, 437, 106, 0, 0, 83, 74, 210, 288,
+ 0, 63, 0, 0, 0, 231, 241, 404, 444, 471,
+ 464, 473, 115, 31, 202, 170, 195, 196, 197, 203,
+ 275, 322, 83, 0, 69, 435, 430, 108, 46, 103,
+ 0, 0, 0, 68, 152, 153, 154, 156, 158, 159,
+ 160, 157, 155, 0, 0, 0, 0, 149, 161, 128,
+ 129, 131, 133, 135, 138, 141, 145, 150, 284, 291,
+ 296, 226, 230, 0, 0, 395, 0, 83, 74, 0,
+ 4, 0, 192, 0, 230, 0, 401, 399, 0, 69,
+ 100, 98, 310, 315, 330, 331, 0, 82, 90, 84,
+ 94, 308, 309, 92, 96, 0, 86, 88, 335, 80,
+ 78, 0, 73, 75, 76, 0, 289, 146, 147, 148,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 231, 236, 233, 232, 206,
+ 252, 247, 248, 249, 250, 242, 251, 0, 0, 0,
+ 0, 422, 415, 0, 403, 405, 407, 409, 411, 413,
+ 0, 0, 445, 0, 443, 446, 448, 0, 0, 116,
+ 0, 305, 301, 304, 193, 282, 276, 281, 231, 0,
+ 436, 431, 101, 0, 0, 0, 39, 0, 0, 0,
+ 0, 0, 334, 364, 361, 362, 363, 325, 333, 0,
+ 0, 0, 0, 0, 57, 77, 151, 130, 132, 134,
+ 136, 137, 139, 140, 142, 143, 144, 285, 292, 297,
+ 227, 229, 0, 0, 0, 0, 0, 419, 418, 0,
+ 0, 421, 0, 0, 396, 0, 0, 0, 0, 0,
+ 450, 453, 442, 0, 0, 0, 0, 0, 0, 0,
+ 302, 0, 0, 278, 0, 61, 0, 0, 99, 311,
+ 316, 91, 85, 95, 93, 97, 0, 87, 89, 336,
+ 81, 79, 237, 234, 243, 425, 423, 417, 424, 0,
+ 416, 406, 408, 410, 412, 414, 0, 0, 447, 449,
+ 466, 475, 117, 127, 33, 306, 303, 194, 277, 279,
+ 324, 432, 102, 0, 0, 326, 0, 0, 0, 420,
+ 339, 451, 454, 0, 0, 0, 312, 317, 201, 0,
+ 337, 235, 244, 0, 0, 371, 371, 307, 280, 433,
+ 0, 375, 198, 352, 327, 371, 0, 340, 347, 0,
+ 346, 368, 452, 455, 439, 313, 372, 318, 199, 0,
+ 0, 371, 338, 259, 266, 264, 245, 255, 256, 263,
+ 0, 342, 343, 0, 0, 434, 371, 0, 379, 0,
+ 351, 365, 366, 367, 0, 357, 358, 328, 0, 0,
+ 0, 0, 0, 0, 261, 348, 344, 369, 438, 314,
+ 373, 376, 319, 200, 353, 354, 0, 383, 260, 267,
+ 265, 246, 254, 269, 257, 262, 0, 0, 0, 0,
+ 0, 355, 359, 380, 329, 0, 0, 0, 349, 345,
+ 0, 0, 377, 0, 0, 0, 268, 270, 258, 370,
+ 374, 0, 356, 360, 381, 0, 0, 378, 387, 0,
+ 384, 382, 385, 0, 386
+};
+
+/* TAO_YYDEFGOTO[NTERM-NUM]. */
+static const short tao_yydefgoto[] =
+{
+ -1, 1, 2, 23, 146, 150, 151, 145, 149, 96,
+ 95, 100, 152, 154, 156, 67, 24, 69, 225, 310,
+ 478, 25, 26, 99, 236, 326, 27, 70, 28, 117,
+ 235, 29, 30, 31, 101, 237, 341, 32, 182, 262,
+ 409, 33, 203, 34, 87, 194, 241, 35, 36, 271,
+ 342, 343, 433, 432, 270, 327, 418, 429, 430, 417,
+ 420, 419, 421, 413, 268, 320, 487, 287, 187, 234,
+ 93, 37, 328, 68, 224, 309, 477, 162, 522, 288,
+ 289, 290, 291, 292, 293, 294, 295, 296, 297, 298,
+ 329, 71, 173, 226, 367, 120, 121, 122, 123, 40,
+ 255, 312, 481, 256, 547, 562, 599, 257, 258, 124,
+ 125, 126, 127, 128, 129, 130, 131, 132, 133, 41,
+ 72, 42, 147, 245, 364, 301, 365, 451, 303, 368,
+ 453, 537, 452, 43, 73, 44, 211, 304, 454, 538,
+ 566, 611, 375, 586, 612, 587, 613, 647, 608, 588,
+ 614, 589, 610, 609, 645, 634, 646, 45, 46, 47,
+ 74, 227, 313, 482, 406, 483, 544, 407, 139, 242,
+ 361, 140, 202, 272, 141, 243, 362, 142, 143, 244,
+ 363, 144, 259, 311, 402, 480, 403, 479, 543, 330,
+ 331, 414, 533, 560, 596, 332, 415, 534, 561, 598,
+ 333, 75, 228, 314, 484, 334, 496, 549, 581, 627,
+ 335, 427, 345, 431, 536, 565, 541, 553, 554, 569,
+ 592, 637, 570, 590, 636, 564, 579, 580, 604, 625,
+ 653, 605, 626, 654, 428, 606, 572, 593, 638, 577,
+ 597, 639, 622, 640, 661, 644, 655, 666, 669, 670,
+ 673, 336, 337, 51, 52, 53, 153, 247, 383, 54,
+ 185, 264, 231, 263, 305, 384, 465, 466, 467, 468,
+ 469, 463, 385, 459, 386, 462, 387, 388, 389, 55,
+ 155, 56, 90, 232, 319, 486, 545, 574, 266, 318,
+ 595, 219, 248, 393, 306, 394, 473, 474, 395, 516,
+ 555, 396, 517, 556, 57, 58, 59, 60, 61, 222,
+ 307, 475, 62, 63, 64, 158, 221, 65, 223, 308,
+ 476, 66
+};
+
+/* TAO_YYPACT[STATE-NUM] -- Index in TAO_YYTABLE of the portion describing
+ STATE-NUM. */
+#define TAO_YYPACT_NINF -483
+static const short tao_yypact[] =
+{
+ -483, 49, 1047, -483, -483, -483, -483, -483, -483, -483,
+ -483, -483, -483, 61, 60, 66, 68, -483, 61, 61,
+ -483, 40, 40, -483, -483, -483, -483, -45, -483, -483,
+ -483, -483, -483, -483, 70, -483, -483, -483, -483, -483,
+ -483, -4, -483, 88, -483, -483, -483, -483, -483, -483,
+ -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,
+ -483, -483, 10, -483, -483, -483, 10, 39, 221, 147,
+ 61, 467, 61, 61, 61, 61, -483, -483, -483, 48,
+ 61, 69, -483, 101, 61, -483, 10, 61, 75, 77,
+ 61, -483, -33, -483, -11, 79, 109, 72, -483, 118,
+ 131, 132, 185, -483, 91, -483, -483, -483, -483, -483,
+ -483, -483, -483, -483, -483, -483, -483, -483, 144, -483,
+ -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,
+ -483, -483, -483, -483, -483, -483, 88, -483, -483, -483,
+ -52, -483, 123, -483, 126, 160, 170, 172, -483, 181,
+ 188, 191, 194, 197, 200, 201, 203, -483, -483, -483,
+ -483, 144, -483, -483, -483, -483, -483, -483, -483, -483,
+ -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,
+ 205, -483, 216, -483, -483, 215, -483, 61, -483, -483,
+ -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,
+ 293, -483, 207, 255, -483, -483, -483, -483, -483, -483,
+ -483, 211, -483, -483, -483, -483, -483, -483, -483, -483,
+ -483, 255, 226, 229, 61, 231, 61, 233, 235, -483,
+ -483, -483, 234, -483, 61, 40, -483, -483, -483, -483,
+ 40, -483, 35, 35, 35, -483, -483, -483, -483, -483,
+ -483, -483, -483, -483, 220, -483, -483, -483, -483, -483,
+ -483, -483, -483, 40, 255, -483, -483, -483, -483, 144,
+ 866, 641, 494, -483, -483, -483, -483, -483, -483, -483,
+ -483, -483, -483, 65, 65, 65, 35, 144, -483, 237,
+ 239, 236, 106, 52, 110, -483, -483, -483, -483, -483,
+ -483, -483, -483, 152, 176, 238, 791, -483, -483, 240,
+ -483, 228, 248, 329, -483, 901, 144, -483, 40, 255,
+ 250, -483, -483, -483, -483, -483, 253, -483, -483, -483,
+ -483, -483, -483, -483, -483, 1009, -483, -483, -483, -483,
+ -483, 257, -483, -483, -483, 260, -483, -483, -483, -483,
+ 246, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 249, 251, 252, 261, 263, -483, -483, -483, 338,
+ 144, -483, -483, -483, -483, -483, -483, 40, 40, 37,
+ 40, 291, -483, 271, -483, -483, -483, -483, -483, -483,
+ 61, 61, -483, 272, -483, -483, -483, 976, 716, -483,
+ 287, -483, -483, -483, -483, -483, -483, -483, 275, 276,
+ 144, -483, -483, 279, 332, 377, -483, 285, 286, 288,
+ 290, 292, -483, 144, -483, -483, -483, -483, -483, 294,
+ 295, 363, 152, 152, -483, -483, -483, 239, 236, 106,
+ 52, 52, 110, 110, -483, -483, -483, -483, -483, -483,
+ -483, -483, 296, 61, 277, 42, 42, -483, 144, 61,
+ 42, -483, 37, 297, -483, 300, 302, 303, 304, 305,
+ -483, -483, -483, 319, 320, 289, 323, 35, 324, 35,
+ 228, 61, 325, 341, 344, -483, 360, 40, -483, -483,
+ -483, -483, -483, -483, -483, -483, 424, -483, -483, -483,
+ -483, -483, -483, -483, -483, -483, -483, -483, -483, 61,
+ -483, -483, -483, -483, -483, -483, 334, 334, -483, -483,
+ -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,
+ -483, -483, 144, 377, 61, -483, 334, 350, 351, -483,
+ 395, -483, -483, 333, 329, 40, -483, -483, -483, 339,
+ -483, -483, -483, 340, 399, 398, 398, -483, -483, 144,
+ 61, 382, 355, 353, -483, 398, 97, -483, -483, 354,
+ -483, -483, -483, -483, 380, -483, -483, -483, -483, 357,
+ 171, 398, -483, -483, -483, -483, -483, -483, -483, -483,
+ 377, -483, 362, 356, 40, -483, 398, 359, 392, 61,
+ -483, -483, -483, -483, 361, -483, -483, -483, 376, 35,
+ 375, 378, 41, 467, 117, -483, -483, -483, 144, -483,
+ -483, -483, -483, -483, -483, 379, 377, 419, -483, -483,
+ -483, -483, -483, -483, -483, -483, 61, 399, 40, 40,
+ 366, -483, -483, -483, -483, 381, 61, 385, -483, -483,
+ 370, 371, -483, 171, 61, 367, -483, -483, -483, -483,
+ -483, 40, -483, -483, -483, 372, 402, -483, -483, 394,
+ 391, -483, -483, 425, -483
+};
+
+/* TAO_YYPGOTO[NTERM-NUM]. */
+static const short tao_yypgoto[] =
+{
+ -483, -483, 189, -483, -483, -483, -483, -483, -483, -483,
+ -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,
+ -483, -483, -483, -483, -483, -483, 180, -483, -483, 182,
+ -483, -483, -483, 479, -483, -483, -483, -483, -483, -483,
+ -483, 483, -483, 199, -483, -483, -188, -483, -483, 192,
+ -483, -483, -483, -483, -210, -241, -483, -483, -483, -483,
+ -483, -483, -483, -483, -220, -483, -483, -18, -483, -483,
+ -13, -483, 11, -483, -483, -483, -483, -483, -483, -274,
+ -483, 150, 162, 163, -127, -114, -101, 36, -483, -217,
+ 20, -483, -483, -483, -24, 245, -314, -483, -483, -483,
+ 71, -483, -483, -449, -37, -483, -483, -12, -483, -53,
+ -483, -483, 457, 458, -51, -49, -40, -483, -483, -25,
+ -483, -23, -483, -483, -483, -483, 214, 298, -483, -167,
+ -483, -483, -483, -20, -483, -16, -483, -483, -483, -483,
+ -483, -483, -483, -483, -483, -81, -483, -483, -483, -483,
+ -483, -82, -483, -483, -483, -483, -483, -483, -483, -32,
+ -483, -483, -483, -483, -483, -483, -483, -10, -483, -483,
+ -483, -483, -483, -483, -61, -483, -483, -483, -60, -483,
+ -483, -483, -483, -483, -483, -483, 53, -483, -483, 230,
+ -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,
+ 21, -483, -483, -483, -483, -483, -483, -483, -483, -483,
+ -483, -483, -483, -483, -483, -483, -482, -483, -483, -483,
+ -483, -483, -100, -483, -483, -483, -483, -483, -483, -483,
+ -483, -117, -483, -483, -386, -483, -340, -483, -483, -483,
+ -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,
+ -483, 22, 23, -483, -483, -483, -483, -483, -483, -483,
+ -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,
+ -483, -483, -483, 76, -483, -483, -483, -483, -483, -483,
+ -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,
+ -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,
+ -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,
+ -483, -483, -483, -483, -483, 473, -483, -483, -483, -483,
+ -483, -483
+};
+
+/* TAO_YYTABLE[TAO_YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule which
+ number is the opposite. If zero, do what TAO_YYDEFACT says.
+ If TAO_YYTABLE_NINF, syntax error. */
+#define TAO_YYTABLE_NINF -475
+static const short tao_yytable[] =
+{
+ 77, 78, 138, 92, 94, 88, 89, 169, 170, 134,
+ 119, 135, 350, 38, 136, 163, 118, 166, 137, 167,
+ 273, 424, 39, 48, 49, 50, 299, 300, 168, 490,
+ 344, 204, 527, 249, -110, 542, 188, 97, 76, 138,
+ 76, 189, 583, 76, 205, 76, 134, 174, 135, 3,
+ 161, 136, 315, 118, 550, 137, 457, 172, 190, 175,
+ 176, 177, 178, 189, 76, 392, 7, 180, 76, 584,
+ 585, 183, 7, 76, 184, -271, 317, 186, 102, 103,
+ 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
+ 9, 10, 97, 11, 114, 115, 116, 397, 583, 200,
+ 201, 424, 274, 275, 276, 277, 278, 279, 280, 91,
+ 148, 91, 281, 282, 91, 17, 189, 17, 160, 80,
+ 193, 84, -253, 283, 284, 584, 585, -111, 285, 286,
+ 97, 411, 274, 275, 276, 277, 278, 279, 280, 91,
+ 356, 357, 281, 282, 91, 584, 585, 546, -112, -71,
+ 171, 97, 97, 366, -392, 76, -461, 344, 191, 286,
+ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
+ 112, 113, 9, 10, 233, 11, 114, 115, 116, 76,
+ -70, 354, 355, 97, 369, 103, 104, 648, 192, 107,
+ 108, 109, 110, 198, 79, 81, 199, 657, 195, 11,
+ 358, 359, 360, 523, 615, 663, 601, 602, 603, 98,
+ 196, 252, 197, 254, 83, 86, 573, 269, 189, 424,
+ 206, 267, 269, 207, 76, 582, 91, 440, 441, 102,
+ 103, 104, 105, 106, 107, 108, 109, 110, 111, 208,
+ 642, 607, 442, 443, 157, 316, 115, 116, 157, 209,
+ 91, 371, 210, 372, 118, 373, 619, 444, 445, 446,
+ 212, 179, 525, 181, 374, 500, 501, 213, 322, 323,
+ 214, 138, 376, 215, 425, 426, 424, 216, 134, 217,
+ 135, 218, 220, 136, -462, 118, 370, 137, 4, 377,
+ 378, 5, 6, 7, 8, 91, 229, 230, 379, 380,
+ 410, 238, 240, 381, 239, 246, 250, 9, 10, 251,
+ 11, 253, 424, 260, 12, 261, 265, 423, -300, 347,
+ 348, 349, 351, 353, 399, 352, 401, 13, 14, 15,
+ 16, 404, 405, 412, 416, 629, 17, 18, 434, 435,
+ 19, 436, 450, 20, -228, 447, 198, 448, 449, 461,
+ 21, 22, 464, 472, 425, 426, -323, 485, 488, 455,
+ 456, 458, 460, 489, 491, 492, 499, 493, -32, 494,
+ 520, 495, 504, 497, 498, 502, 510, 470, 471, 511,
+ 76, 512, 513, 514, 515, 102, 103, 104, 105, 106,
+ 107, 108, 109, 110, 111, 112, 113, 423, 518, 519,
+ 138, 138, 115, 116, 521, 524, 528, 134, 134, 135,
+ 135, 38, 136, 136, 118, 118, 137, 137, 650, 651,
+ 39, 48, 49, 50, 529, 530, 531, 535, 540, 551,
+ -341, 552, 557, 563, 568, 567, 571, 576, 578, 594,
+ 254, 665, 505, 506, 458, 616, 507, 508, -350, 591,
+ 617, 91, 600, 620, 621, 628, 624, 630, 643, 631,
+ 652, 664, 641, 656, 658, 659, 660, 667, 254, 532,
+ 76, 668, 425, 426, 672, 102, 103, 104, 105, 106,
+ 107, 108, 109, 110, 111, 112, 113, 9, 10, 671,
+ 11, 114, 115, 116, 674, 85, 539, 76, 82, 400,
+ 398, 437, 102, 103, 104, 105, 106, 107, 108, 109,
+ 110, 111, 112, 113, 438, 423, 439, 346, 114, 115,
+ 116, 77, 548, 575, 503, 164, 165, 559, 408, 425,
+ 426, 632, 635, 526, 558, 382, 662, 649, 509, 159,
+ 0, 91, 0, 302, 0, 0, 0, 77, 548, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 425, 426, 0, 91, 0,
+ 0, 0, 423, 0, 0, 0, 618, 0, 0, 0,
+ 0, 138, 0, 0, 0, 0, 77, 623, 134, 633,
+ 135, 0, 0, 136, 0, 118, 0, 137, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 423, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 269, 269, 0, 254, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 254, 0, 0, 0, 0, 0, 0,
+ 0, 254, 321, 269, -332, 5, 0, 0, 8, -332,
+ -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,
+ -332, 9, 10, 0, 11, 0, -332, -332, 12, 0,
+ 0, 322, 323, 324, 325, -332, 0, 0, 0, 0,
+ 0, 13, 0, 0, 0, 338, 339, 340, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 21, 22, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, -332, 0, 321, 0, -332,
+ 5, 0, -56, 8, -332, -332, -332, -332, -332, -332,
+ -332, -332, -332, -332, -332, -332, 9, 10, 0, 11,
+ 0, -332, -332, 12, 0, 0, 322, 323, 324, 325,
+ -332, 0, 0, 0, 0, 0, 13, 0, 0, 0,
+ 338, 339, 340, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 21,
+ 22, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -332, 0, 321, 0, -332, 5, 0, -474, 8, -332,
+ -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,
+ -332, 9, 10, 0, 11, 0, -332, -332, 12, 0,
+ 0, 322, 323, 324, 325, -332, 0, 0, 0, 0,
+ 0, 13, 0, 0, 0, 390, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 391, 0, 0, 0, 0,
+ 0, 0, 0, 0, 21, 22, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, -332, 0, 321, 0, -332,
+ 5, 0, -441, 8, -332, -332, -332, -332, -332, -332,
+ -332, -332, -332, -332, -332, -332, 9, 10, 0, 11,
+ 0, -332, -332, 12, 0, 0, 322, 323, 324, 325,
+ -332, 0, 321, 0, -332, 5, 13, 0, 8, -332,
+ -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,
+ -332, 9, 10, 0, 11, 0, -332, -332, 12, 21,
+ 22, 322, 323, 324, 325, -332, 0, 0, 0, 0,
+ -332, 13, 0, 0, 0, 0, 0, -38, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 21, 22, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, -332, 0, 321, 0, -332,
+ 5, 0, -60, 8, -332, -332, -332, -332, -332, -332,
+ -332, -332, -332, -332, -332, -332, 9, 10, 0, 11,
+ 0, -332, -332, 12, 0, 0, 322, 323, 324, 325,
+ -332, 0, 76, 0, 0, 0, 13, 102, 103, 104,
+ 105, 106, 107, 108, 109, 110, 111, 112, 113, 0,
+ 0, 0, 0, 0, 115, 116, 0, 0, 0, 21,
+ 22, 0, 0, 422, 0, 0, 0, -2, 4, 0,
+ -332, 5, 6, 7, 8, 0, 0, -465, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 9, 10, 0,
+ 11, 0, 0, 0, 12, 0, 0, 0, 0, 0,
+ 0, 0, 0, 91, 0, 0, 0, 13, 14, 15,
+ 16, 0, 0, 0, 0, 0, 17, 18, 0, 0,
+ 19, 0, 0, 20, 0, 0, 0, 0, 0, 0,
+ 21, 22
+};
+
+static const short tao_yycheck[] =
+{
+ 13, 13, 34, 21, 22, 18, 19, 68, 68, 34,
+ 34, 34, 286, 2, 34, 68, 34, 68, 34, 68,
+ 240, 335, 2, 2, 2, 2, 243, 244, 68, 415,
+ 271, 83, 481, 221, 79, 517, 69, 82, 3, 71,
+ 3, 74, 1, 3, 96, 3, 71, 71, 71, 0,
+ 68, 71, 262, 71, 536, 71, 19, 70, 69, 72,
+ 73, 74, 75, 74, 3, 306, 6, 80, 3, 28,
+ 29, 84, 6, 3, 87, 79, 264, 90, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 82, 23, 24, 25, 26, 307, 1, 8,
+ 9, 415, 67, 68, 69, 70, 71, 72, 73, 74,
+ 22, 74, 77, 78, 74, 49, 74, 49, 79, 53,
+ 48, 53, 81, 88, 89, 28, 29, 79, 93, 94,
+ 82, 319, 67, 68, 69, 70, 71, 72, 73, 74,
+ 88, 89, 77, 78, 74, 28, 29, 533, 79, 79,
+ 3, 82, 82, 1, 79, 3, 79, 398, 79, 94,
+ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ 18, 19, 20, 21, 187, 23, 24, 25, 26, 3,
+ 79, 75, 76, 82, 8, 9, 10, 636, 79, 13,
+ 14, 15, 16, 8, 14, 15, 11, 646, 80, 23,
+ 90, 91, 92, 477, 590, 654, 35, 36, 37, 27,
+ 79, 224, 80, 226, 15, 16, 556, 235, 74, 533,
+ 97, 234, 240, 97, 3, 565, 74, 354, 355, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16, 17, 79,
+ 626, 581, 356, 357, 62, 263, 25, 26, 66, 79,
+ 74, 304, 80, 304, 272, 304, 596, 358, 359, 360,
+ 79, 79, 479, 81, 304, 432, 433, 79, 30, 31,
+ 79, 303, 304, 79, 335, 335, 590, 80, 303, 79,
+ 303, 80, 79, 303, 79, 303, 304, 303, 1, 51,
+ 52, 4, 5, 6, 7, 74, 80, 82, 60, 61,
+ 318, 8, 47, 65, 97, 94, 80, 20, 21, 80,
+ 23, 80, 626, 80, 27, 80, 82, 335, 98, 283,
+ 284, 285, 85, 87, 84, 86, 98, 40, 41, 42,
+ 43, 83, 3, 83, 81, 609, 49, 50, 81, 79,
+ 53, 95, 81, 56, 81, 96, 8, 96, 96, 58,
+ 63, 64, 81, 81, 415, 415, 81, 81, 79, 377,
+ 378, 379, 380, 31, 79, 79, 3, 79, 81, 79,
+ 81, 79, 95, 79, 79, 79, 79, 390, 391, 79,
+ 3, 79, 79, 79, 79, 8, 9, 10, 11, 12,
+ 13, 14, 15, 16, 17, 18, 19, 415, 79, 79,
+ 432, 433, 25, 26, 81, 81, 81, 432, 433, 432,
+ 433, 400, 432, 433, 432, 433, 432, 433, 638, 639,
+ 400, 400, 400, 400, 83, 81, 66, 3, 94, 79,
+ 35, 80, 99, 94, 35, 95, 38, 55, 83, 59,
+ 453, 661, 455, 456, 462, 83, 459, 460, 95, 95,
+ 94, 74, 95, 94, 62, 79, 95, 82, 39, 81,
+ 94, 94, 83, 82, 79, 95, 95, 95, 481, 487,
+ 3, 69, 533, 533, 83, 8, 9, 10, 11, 12,
+ 13, 14, 15, 16, 17, 18, 19, 20, 21, 95,
+ 23, 24, 25, 26, 69, 16, 509, 3, 15, 310,
+ 308, 351, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 352, 533, 353, 272, 24, 25,
+ 26, 534, 534, 560, 453, 68, 68, 545, 314, 590,
+ 590, 612, 614, 480, 544, 305, 653, 637, 462, 66,
+ -1, 74, -1, 245, -1, -1, -1, 560, 560, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 626, 626, -1, 74, -1,
+ -1, -1, 590, -1, -1, -1, 594, -1, -1, -1,
+ -1, 613, -1, -1, -1, -1, 599, 599, 613, 613,
+ 613, -1, -1, 613, -1, 613, -1, 613, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 626, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 638, 639, -1, 636, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 646, -1, -1, -1, -1, -1, -1,
+ -1, 654, 1, 661, 3, 4, -1, -1, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, -1, 23, -1, 25, 26, 27, -1,
+ -1, 30, 31, 32, 33, 34, -1, -1, -1, -1,
+ -1, 40, -1, -1, -1, 44, 45, 46, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 63, 64, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 74, -1, 1, -1, 3,
+ 4, -1, 81, 7, 8, 9, 10, 11, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, -1, 23,
+ -1, 25, 26, 27, -1, -1, 30, 31, 32, 33,
+ 34, -1, -1, -1, -1, -1, 40, -1, -1, -1,
+ 44, 45, 46, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 63,
+ 64, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 74, -1, 1, -1, 3, 4, -1, 81, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, -1, 23, -1, 25, 26, 27, -1,
+ -1, 30, 31, 32, 33, 34, -1, -1, -1, -1,
+ -1, 40, -1, -1, -1, 44, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 54, -1, -1, -1, -1,
+ -1, -1, -1, -1, 63, 64, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 74, -1, 1, -1, 3,
+ 4, -1, 81, 7, 8, 9, 10, 11, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, -1, 23,
+ -1, 25, 26, 27, -1, -1, 30, 31, 32, 33,
+ 34, -1, 1, -1, 3, 4, 40, -1, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, -1, 23, -1, 25, 26, 27, 63,
+ 64, 30, 31, 32, 33, 34, -1, -1, -1, -1,
+ 74, 40, -1, -1, -1, -1, -1, 81, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 63, 64, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 74, -1, 1, -1, 3,
+ 4, -1, 81, 7, 8, 9, 10, 11, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, -1, 23,
+ -1, 25, 26, 27, -1, -1, 30, 31, 32, 33,
+ 34, -1, 3, -1, -1, -1, 40, 8, 9, 10,
+ 11, 12, 13, 14, 15, 16, 17, 18, 19, -1,
+ -1, -1, -1, -1, 25, 26, -1, -1, -1, 63,
+ 64, -1, -1, 34, -1, -1, -1, 0, 1, -1,
+ 74, 4, 5, 6, 7, -1, -1, 81, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 20, 21, -1,
+ 23, -1, -1, -1, 27, -1, -1, -1, -1, -1,
+ -1, -1, -1, 74, -1, -1, -1, 40, 41, 42,
+ 43, -1, -1, -1, -1, -1, 49, 50, -1, -1,
+ 53, -1, -1, 56, -1, -1, -1, -1, -1, -1,
+ 63, 64
+};
+
+/* TAO_YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
+static const unsigned short tao_yystos[] =
+{
+ 0, 101, 102, 0, 1, 4, 5, 6, 7, 20,
+ 21, 23, 27, 40, 41, 42, 43, 49, 50, 53,
+ 56, 63, 64, 103, 116, 121, 122, 126, 128, 131,
+ 132, 133, 137, 141, 143, 147, 148, 171, 172, 190,
+ 199, 219, 221, 233, 235, 257, 258, 259, 300, 351,
+ 352, 353, 354, 355, 359, 379, 381, 404, 405, 406,
+ 407, 408, 412, 413, 414, 417, 421, 115, 173, 117,
+ 127, 191, 220, 234, 260, 301, 3, 170, 207, 126,
+ 53, 126, 141, 143, 53, 133, 143, 144, 170, 170,
+ 382, 74, 167, 170, 167, 110, 109, 82, 129, 123,
+ 111, 134, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 24, 25, 26, 129, 167, 194,
+ 195, 196, 197, 198, 209, 210, 211, 212, 213, 214,
+ 215, 216, 217, 218, 219, 221, 233, 235, 259, 268,
+ 271, 274, 277, 278, 281, 107, 104, 222, 22, 108,
+ 105, 106, 112, 356, 113, 380, 114, 129, 415, 415,
+ 79, 167, 177, 209, 212, 213, 214, 215, 216, 274,
+ 278, 3, 170, 192, 194, 170, 170, 170, 170, 129,
+ 170, 129, 138, 170, 170, 360, 170, 168, 69, 74,
+ 69, 79, 79, 48, 145, 80, 79, 80, 8, 11,
+ 8, 9, 272, 142, 83, 96, 97, 97, 79, 79,
+ 80, 236, 79, 79, 79, 79, 80, 79, 80, 391,
+ 79, 416, 409, 418, 174, 118, 193, 261, 302, 80,
+ 82, 362, 383, 170, 169, 130, 124, 135, 8, 97,
+ 47, 146, 269, 275, 279, 223, 94, 357, 392, 146,
+ 80, 80, 170, 80, 170, 200, 203, 207, 208, 282,
+ 80, 80, 139, 363, 361, 82, 388, 170, 164, 167,
+ 154, 149, 273, 164, 67, 68, 69, 70, 71, 72,
+ 73, 77, 78, 88, 89, 93, 94, 167, 179, 180,
+ 181, 182, 183, 184, 185, 186, 187, 188, 189, 189,
+ 189, 225, 227, 228, 237, 364, 394, 410, 419, 175,
+ 119, 283, 201, 262, 303, 154, 167, 146, 389, 384,
+ 165, 1, 30, 31, 32, 33, 125, 155, 172, 190,
+ 289, 290, 295, 300, 305, 310, 351, 352, 44, 45,
+ 46, 136, 150, 151, 155, 312, 195, 187, 187, 187,
+ 179, 85, 86, 87, 75, 76, 88, 89, 90, 91,
+ 92, 270, 276, 280, 224, 226, 1, 194, 229, 8,
+ 167, 209, 214, 215, 216, 242, 259, 51, 52, 60,
+ 61, 65, 289, 358, 365, 372, 374, 376, 377, 378,
+ 44, 54, 155, 393, 395, 398, 401, 154, 149, 84,
+ 102, 98, 284, 286, 83, 3, 264, 267, 226, 140,
+ 167, 146, 83, 163, 291, 296, 81, 159, 156, 161,
+ 160, 162, 34, 167, 196, 274, 278, 311, 334, 157,
+ 158, 313, 153, 152, 81, 79, 95, 181, 182, 183,
+ 184, 184, 185, 185, 186, 186, 186, 96, 96, 96,
+ 81, 227, 232, 230, 238, 167, 167, 19, 167, 373,
+ 167, 58, 375, 371, 81, 366, 367, 368, 369, 370,
+ 170, 170, 81, 396, 397, 411, 420, 176, 120, 287,
+ 285, 202, 263, 265, 304, 81, 385, 166, 79, 31,
+ 334, 79, 79, 79, 79, 79, 306, 79, 79, 3,
+ 229, 229, 79, 200, 95, 170, 170, 170, 170, 373,
+ 79, 79, 79, 79, 79, 79, 399, 402, 79, 79,
+ 81, 81, 178, 179, 81, 189, 286, 203, 81, 83,
+ 81, 66, 167, 292, 297, 3, 314, 231, 239, 170,
+ 94, 316, 316, 288, 266, 386, 334, 204, 207, 307,
+ 316, 79, 80, 317, 318, 400, 403, 99, 267, 167,
+ 293, 298, 205, 94, 325, 315, 240, 95, 35, 319,
+ 322, 38, 336, 336, 387, 204, 55, 339, 83, 326,
+ 327, 308, 336, 1, 28, 29, 243, 245, 249, 251,
+ 323, 95, 320, 337, 59, 390, 294, 340, 299, 206,
+ 95, 35, 36, 37, 328, 331, 335, 336, 248, 253,
+ 252, 241, 244, 246, 250, 334, 83, 94, 167, 336,
+ 94, 62, 342, 207, 95, 329, 332, 309, 79, 179,
+ 82, 81, 245, 194, 255, 251, 324, 321, 338, 341,
+ 343, 83, 334, 39, 345, 254, 256, 247, 203, 322,
+ 164, 164, 94, 330, 333, 346, 82, 203, 79, 95,
+ 95, 344, 331, 203, 94, 164, 347, 95, 69, 348,
+ 349, 95, 83, 350, 69
+};
+
+#if ! defined (TAO_YYSIZE_T) && defined (__SIZE_TYPE__)
+# define TAO_YYSIZE_T __SIZE_TYPE__
+#endif
+#if ! defined (TAO_YYSIZE_T) && defined (size_t)
+# define TAO_YYSIZE_T size_t
+#endif
+#if ! defined (TAO_YYSIZE_T)
+# if defined (__STDC__) || defined (__cplusplus)
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# define TAO_YYSIZE_T size_t
+# endif
+#endif
+#if ! defined (TAO_YYSIZE_T)
+# define TAO_YYSIZE_T unsigned int
+#endif
+
+#define tao_yyerrok (tao_yyerrstatus = 0)
+#define tao_yyclearin (tao_yychar = TAO_YYEMPTY)
+#define TAO_YYEMPTY (-2)
+#define TAO_YYEOF 0
+
+#define TAO_YYACCEPT goto tao_yyacceptlab
+#define TAO_YYABORT goto tao_yyabortlab
+#define TAO_YYERROR goto tao_yyerrorlab
+
+
+/* Like TAO_YYERROR except do call tao_yyerror. This remains here temporarily
+ to ease the transition to the new meaning of TAO_YYERROR, for GCC.
+ Once GCC version 2 has supplanted version 1, this can go. */
+
+#define TAO_YYFAIL goto tao_yyerrlab
+
+#define TAO_YYRECOVERING() (!!tao_yyerrstatus)
+
+#define TAO_YYBACKUP(Token, Value) \
+do \
+ if (tao_yychar == TAO_YYEMPTY && tao_yylen == 1) \
+ { \
+ tao_yychar = (Token); \
+ tao_yylval = (Value); \
+ tao_yytoken = TAO_YYTRANSLATE (tao_yychar); \
+ TAO_YYPOPSTACK; \
+ goto tao_yybackup; \
+ } \
+ else \
+ { \
+ tao_yyerror ("syntax error: cannot back up");\
+ TAO_YYERROR; \
+ } \
+while (0)
+
+#define TAO_YYTERROR 1
+#define TAO_YYERRCODE 256
+
+/* TAO_YYLLOC_DEFAULT -- Compute the default location (before the actions
+ are run). */
+
+#ifndef TAO_YYLLOC_DEFAULT
+# define TAO_YYLLOC_DEFAULT(Current, Rhs, N) \
+ ((Current).first_line = (Rhs)[1].first_line, \
+ (Current).first_column = (Rhs)[1].first_column, \
+ (Current).last_line = (Rhs)[N].last_line, \
+ (Current).last_column = (Rhs)[N].last_column)
+#endif
+
+/* TAO_YYLEX -- calling `tao_yylex' with the right arguments. */
+
+#ifdef TAO_YYLEX_PARAM
+# define TAO_YYLEX tao_yylex (TAO_YYLEX_PARAM)
+#else
+# define TAO_YYLEX tao_yylex ()
+#endif
+
+/* Enable debugging if requested. */
+#if TAO_YYDEBUG
+
+# ifndef TAO_YYFPRINTF
+# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+# define TAO_YYFPRINTF fprintf
+# endif
+
+# define TAO_YYDPRINTF(Args) \
+do { \
+ if (tao_yydebug) \
+ TAO_YYFPRINTF Args; \
+} while (0)
+
+# define TAO_YYDSYMPRINT(Args) \
+do { \
+ if (tao_yydebug) \
+ tao_yysymprint Args; \
+} while (0)
+
+# define TAO_YYDSYMPRINTF(Title, Token, Value, Location) \
+do { \
+ if (tao_yydebug) \
+ { \
+ TAO_YYFPRINTF (stderr, "%s ", Title); \
+ tao_yysymprint (stderr, \
+ Token, Value); \
+ TAO_YYFPRINTF (stderr, "\n"); \
+ } \
+} while (0)
+
+/*------------------------------------------------------------------.
+| tao_yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included). |
+`------------------------------------------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+tao_yy_stack_print (short *bottom, short *top)
+#else
+static void
+tao_yy_stack_print (bottom, top)
+ short *bottom;
+ short *top;
+#endif
+{
+ TAO_YYFPRINTF (stderr, "Stack now");
+ for (/* Nothing. */; bottom <= top; ++bottom)
+ TAO_YYFPRINTF (stderr, " %d", *bottom);
+ TAO_YYFPRINTF (stderr, "\n");
+}
+
+# define TAO_YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (tao_yydebug) \
+ tao_yy_stack_print ((Bottom), (Top)); \
+} while (0)
+
+
+/*------------------------------------------------.
+| Report that the TAO_YYRULE is going to be reduced. |
+`------------------------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+tao_yy_reduce_print (int tao_yyrule)
+#else
+static void
+tao_yy_reduce_print (tao_yyrule)
+ int tao_yyrule;
+#endif
+{
+ int tao_yyi;
+ unsigned int tao_yylno = tao_yyrline[tao_yyrule];
+ TAO_YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
+ tao_yyrule - 1, tao_yylno);
+ /* Print the symbols being reduced, and their result. */
+ for (tao_yyi = tao_yyprhs[tao_yyrule]; 0 <= tao_yyrhs[tao_yyi]; tao_yyi++)
+ TAO_YYFPRINTF (stderr, "%s ", tao_yytname [tao_yyrhs[tao_yyi]]);
+ TAO_YYFPRINTF (stderr, "-> %s\n", tao_yytname [tao_yyr1[tao_yyrule]]);
+}
+
+# define TAO_YY_REDUCE_PRINT(Rule) \
+do { \
+ if (tao_yydebug) \
+ tao_yy_reduce_print (Rule); \
+} while (0)
+
+/* Nonzero means print parse trace. It is left uninitialized so that
+ multiple parsers can coexist. */
+int tao_yydebug;
+#else /* !TAO_YYDEBUG */
+# define TAO_YYDPRINTF(Args)
+# define TAO_YYDSYMPRINT(Args)
+# define TAO_YYDSYMPRINTF(Title, Token, Value, Location)
+# define TAO_YY_STACK_PRINT(Bottom, Top)
+# define TAO_YY_REDUCE_PRINT(Rule)
+#endif /* !TAO_YYDEBUG */
+
+
+/* TAO_YYINITDEPTH -- initial size of the parser's stacks. */
+#ifndef TAO_YYINITDEPTH
+# define TAO_YYINITDEPTH 200
+#endif
+
+/* TAO_YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+ if the built-in stack extension method is used).
+
+ Do not make this value too large; the results are undefined if
+ SIZE_MAX < TAO_YYSTACK_BYTES (TAO_YYMAXDEPTH)
+ evaluated with infinite-precision integer arithmetic. */
+
+#if defined (TAO_YYMAXDEPTH) && TAO_YYMAXDEPTH == 0
+# undef TAO_YYMAXDEPTH
+#endif
+
+#ifndef TAO_YYMAXDEPTH
+# define TAO_YYMAXDEPTH 10000
+#endif
+
+
+
+#if TAO_YYERROR_VERBOSE
+
+# ifndef tao_yystrlen
+# if defined (__GLIBC__) && defined (_STRING_H)
+# define tao_yystrlen strlen
+# else
+/* Return the length of TAO_YYSTR. */
+static TAO_YYSIZE_T
+# if defined (__STDC__) || defined (__cplusplus)
+tao_yystrlen (const char *tao_yystr)
+# else
+tao_yystrlen (tao_yystr)
+ const char *tao_yystr;
+# endif
+{
+ register const char *tao_yys = tao_yystr;
+
+ while (*tao_yys++ != '\0')
+ continue;
+
+ return tao_yys - tao_yystr - 1;
+}
+# endif
+# endif
+
+# ifndef tao_yystpcpy
+# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
+# define tao_yystpcpy stpcpy
+# else
+/* Copy TAO_YYSRC to TAO_YYDEST, returning the address of the terminating '\0' in
+ TAO_YYDEST. */
+static char *
+# if defined (__STDC__) || defined (__cplusplus)
+tao_yystpcpy (char *tao_yydest, const char *tao_yysrc)
+# else
+tao_yystpcpy (tao_yydest, tao_yysrc)
+ char *tao_yydest;
+ const char *tao_yysrc;
+# endif
+{
+ register char *tao_yyd = tao_yydest;
+ register const char *tao_yys = tao_yysrc;
+
+ while ((*tao_yyd++ = *tao_yys++) != '\0')
+ continue;
+
+ return tao_yyd - 1;
+}
+# endif
+# endif
+
+#endif /* !TAO_YYERROR_VERBOSE */
+
+
+
+#if TAO_YYDEBUG
+/*--------------------------------.
+| Print this symbol on TAO_YYOUTPUT. |
+`--------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+tao_yysymprint (FILE *tao_yyoutput, int tao_yytype, TAO_YYSTYPE *tao_yyvaluep)
+#else
+static void
+tao_yysymprint (tao_yyoutput, tao_yytype, tao_yyvaluep)
+ FILE *tao_yyoutput;
+ int tao_yytype;
+ TAO_YYSTYPE *tao_yyvaluep;
+#endif
+{
+ /* Pacify ``unused variable'' warnings. */
+ (void) tao_yyvaluep;
+
+ if (tao_yytype < TAO_YYNTOKENS)
+ {
+ TAO_YYFPRINTF (tao_yyoutput, "token %s (", tao_yytname[tao_yytype]);
+# ifdef TAO_YYPRINT
+ TAO_YYPRINT (tao_yyoutput, tao_yytoknum[tao_yytype], *tao_yyvaluep);
+# endif
+ }
+ else
+ TAO_YYFPRINTF (tao_yyoutput, "nterm %s (", tao_yytname[tao_yytype]);
+
+ TAO_YYFPRINTF (tao_yyoutput, ")");
+}
+
+#endif /* ! TAO_YYDEBUG */
+/*-----------------------------------------------.
+| Release the memory associated to this symbol. |
+`-----------------------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+tao_yydestruct (int tao_yytype, TAO_YYSTYPE *tao_yyvaluep)
+#else
+static void
+tao_yydestruct (tao_yytype, tao_yyvaluep)
+ int tao_yytype;
+ TAO_YYSTYPE *tao_yyvaluep;
+#endif
+{
+ /* Pacify ``unused variable'' warnings. */
+ (void) tao_yytype;
+ (void) tao_yyvaluep;
+
+}
+
+
+/* Prevent warnings from -Wmissing-prototypes. */
+
+#ifdef TAO_YYPARSE_PARAM
+# if defined (__STDC__) || defined (__cplusplus)
+int tao_yyparse (void *TAO_YYPARSE_PARAM);
+# else
+int tao_yyparse ();
+# endif
+#else /* ! TAO_YYPARSE_PARAM */
+#if defined (__STDC__) || defined (__cplusplus)
+int tao_yyparse (void);
+#else
+int tao_yyparse ();
+#endif
+#endif /* ! TAO_YYPARSE_PARAM */
+
+
+
+/* The lookahead symbol. */
+int tao_yychar;
+
+/* The semantic value of the lookahead symbol. */
+TAO_YYSTYPE tao_yylval;
+
+/* Number of syntax errors so far. */
+int tao_yynerrs;
+
+
+
+/*----------.
+| tao_yyparse. |
+`----------*/
+
+#ifdef TAO_YYPARSE_PARAM
+# if defined (__STDC__) || defined (__cplusplus)
+int tao_yyparse (void *TAO_YYPARSE_PARAM)
+# else
+int tao_yyparse (TAO_YYPARSE_PARAM)
+ void *TAO_YYPARSE_PARAM;
+# endif
+#else /* ! TAO_YYPARSE_PARAM */
+#if defined (__STDC__) || defined (__cplusplus)
+int
+tao_yyparse (void)
+#else
+int
+tao_yyparse ()
+
+#endif
+#endif
+{
+
+ register int tao_yystate;
+ register int tao_yyn;
+ int tao_yyresult;
+ /* Number of tokens to shift before error messages enabled. */
+ int tao_yyerrstatus;
+ /* Lookahead token as an internal (translated) token number. */
+ int tao_yytoken = 0;
+
+ /* Three stacks and their tools:
+ `tao_yyss': related to states,
+ `tao_yyvs': related to semantic values,
+ `tao_yyls': related to locations.
+
+ Refer to the stacks thru separate pointers, to allow tao_yyoverflow
+ to reallocate them elsewhere. */
+
+ /* The state stack. */
+ short tao_yyssa[TAO_YYINITDEPTH];
+ short *tao_yyss = tao_yyssa;
+ register short *tao_yyssp;
+
+ /* The semantic value stack. */
+ TAO_YYSTYPE tao_yyvsa[TAO_YYINITDEPTH];
+ TAO_YYSTYPE *tao_yyvs = tao_yyvsa;
+ register TAO_YYSTYPE *tao_yyvsp;
+
+
+
+#define TAO_YYPOPSTACK (tao_yyvsp--, tao_yyssp--)
+
+ TAO_YYSIZE_T tao_yystacksize = TAO_YYINITDEPTH;
+
+ /* The variables used to return semantic value and location from the
+ action routines. */
+ TAO_YYSTYPE tao_yyval;
+
+
+ /* When reducing, the number of symbols on the RHS of the reduced
+ rule. */
+ int tao_yylen;
+
+ TAO_YYDPRINTF ((stderr, "Starting parse\n"));
+
+ tao_yystate = 0;
+ tao_yyerrstatus = 0;
+ tao_yynerrs = 0;
+ tao_yychar = TAO_YYEMPTY; /* Cause a token to be read. */
+
+ /* Initialize stack pointers.
+ Waste one element of value and location stack
+ so that they stay on the same level as the state stack.
+ The wasted elements are never initialized. */
+
+ tao_yyssp = tao_yyss;
+ tao_yyvsp = tao_yyvs;
+
+ goto tao_yysetstate;
+
+/*------------------------------------------------------------.
+| tao_yynewstate -- Push a new state, which is found in tao_yystate. |
+`------------------------------------------------------------*/
+ tao_yynewstate:
+ /* In all cases, when you get here, the value and location stacks
+ have just been pushed. so pushing a state here evens the stacks.
+ */
+ tao_yyssp++;
+
+ tao_yysetstate:
+ *tao_yyssp = tao_yystate;
+
+ if (tao_yyss + tao_yystacksize - 1 <= tao_yyssp)
+ {
+ /* Get the current used size of the three stacks, in elements. */
+ TAO_YYSIZE_T tao_yysize = tao_yyssp - tao_yyss + 1;
+
+#ifdef tao_yyoverflow
+ {
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ TAO_YYSTYPE *tao_yyvs1 = tao_yyvs;
+ short *tao_yyss1 = tao_yyss;
+
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if tao_yyoverflow is a macro. */
+ tao_yyoverflow ("parser stack overflow",
+ &tao_yyss1, tao_yysize * sizeof (*tao_yyssp),
+ &tao_yyvs1, tao_yysize * sizeof (*tao_yyvsp),
+
+ &tao_yystacksize);
+
+ tao_yyss = tao_yyss1;
+ tao_yyvs = tao_yyvs1;
+ }
+#else /* no tao_yyoverflow */
+# ifndef TAO_YYSTACK_RELOCATE
+ goto tao_yyoverflowlab;
+# else
+ /* Extend the stack our own way. */
+ if (TAO_YYMAXDEPTH <= tao_yystacksize)
+ goto tao_yyoverflowlab;
+ tao_yystacksize *= 2;
+ if (TAO_YYMAXDEPTH < tao_yystacksize)
+ tao_yystacksize = TAO_YYMAXDEPTH;
+
+ {
+ short *tao_yyss1 = tao_yyss;
+ union tao_yyalloc *tao_yyptr =
+ (union tao_yyalloc *) TAO_YYSTACK_ALLOC (TAO_YYSTACK_BYTES (tao_yystacksize));
+ if (! tao_yyptr)
+ goto tao_yyoverflowlab;
+ TAO_YYSTACK_RELOCATE (tao_yyss);
+ TAO_YYSTACK_RELOCATE (tao_yyvs);
+
+# undef TAO_YYSTACK_RELOCATE
+ if (tao_yyss1 != tao_yyssa)
+ TAO_YYSTACK_FREE (tao_yyss1);
+ }
+# endif
+#endif /* no tao_yyoverflow */
+
+ tao_yyssp = tao_yyss + tao_yysize - 1;
+ tao_yyvsp = tao_yyvs + tao_yysize - 1;
+
+
+ TAO_YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+ (unsigned long int) tao_yystacksize));
+
+ if (tao_yyss + tao_yystacksize - 1 <= tao_yyssp)
+ TAO_YYABORT;
+ }
+
+ TAO_YYDPRINTF ((stderr, "Entering state %d\n", tao_yystate));
+
+ goto tao_yybackup;
+
+/*-----------.
+| tao_yybackup. |
+`-----------*/
+tao_yybackup:
+
+/* Do appropriate processing given the current state. */
+/* Read a lookahead token if we need one and don't already have one. */
+/* tao_yyresume: */
+
+ /* First try to decide what to do without reference to lookahead token. */
+
+ tao_yyn = tao_yypact[tao_yystate];
+ if (tao_yyn == TAO_YYPACT_NINF)
+ goto tao_yydefault;
+
+ /* Not known => get a lookahead token if don't already have one. */
+
+ /* TAO_YYCHAR is either TAO_YYEMPTY or TAO_YYEOF or a valid lookahead symbol. */
+ if (tao_yychar == TAO_YYEMPTY)
+ {
+ TAO_YYDPRINTF ((stderr, "Reading a token: "));
+ tao_yychar = TAO_YYLEX;
+ }
+
+ if (tao_yychar <= TAO_YYEOF)
+ {
+ tao_yychar = tao_yytoken = TAO_YYEOF;
+ TAO_YYDPRINTF ((stderr, "Now at end of input.\n"));
+ }
+ else
+ {
+ tao_yytoken = TAO_YYTRANSLATE (tao_yychar);
+ TAO_YYDSYMPRINTF ("Next token is", tao_yytoken, &tao_yylval, &tao_yylloc);
+ }
+
+ /* If the proper action on seeing token TAO_YYTOKEN is to reduce or to
+ detect an error, take that action. */
+ tao_yyn += tao_yytoken;
+ if (tao_yyn < 0 || TAO_YYLAST < tao_yyn || tao_yycheck[tao_yyn] != tao_yytoken)
+ goto tao_yydefault;
+ tao_yyn = tao_yytable[tao_yyn];
+ if (tao_yyn <= 0)
+ {
+ if (tao_yyn == 0 || tao_yyn == TAO_YYTABLE_NINF)
+ goto tao_yyerrlab;
+ tao_yyn = -tao_yyn;
+ goto tao_yyreduce;
+ }
+
+ if (tao_yyn == TAO_YYFINAL)
+ TAO_YYACCEPT;
+
+ /* Shift the lookahead token. */
+ TAO_YYDPRINTF ((stderr, "Shifting token %s, ", tao_yytname[tao_yytoken]));
+
+ /* Discard the token being shifted unless it is eof. */
+ if (tao_yychar != TAO_YYEOF)
+ tao_yychar = TAO_YYEMPTY;
+
+ *++tao_yyvsp = tao_yylval;
+
+
+ /* Count tokens shifted since error; after three, turn off error
+ status. */
+ if (tao_yyerrstatus)
+ tao_yyerrstatus--;
+
+ tao_yystate = tao_yyn;
+ goto tao_yynewstate;
+
+
+/*-----------------------------------------------------------.
+| tao_yydefault -- do the default action for the current state. |
+`-----------------------------------------------------------*/
+tao_yydefault:
+ tao_yyn = tao_yydefact[tao_yystate];
+ if (tao_yyn == 0)
+ goto tao_yyerrlab;
+ goto tao_yyreduce;
+
+
+/*-----------------------------.
+| tao_yyreduce -- Do a reduction. |
+`-----------------------------*/
+tao_yyreduce:
+ /* tao_yyn is the number of a rule to reduce with. */
+ tao_yylen = tao_yyr2[tao_yyn];
+
+ /* If TAO_YYLEN is nonzero, implement the default value of the action:
+ `$$ = $1'.
+
+ Otherwise, the following line sets TAO_YYVAL to garbage.
+ This behavior is undocumented and Bison
+ users should not rely upon it. Assigning to TAO_YYVAL
+ unconditionally makes the parser a bit smaller, and it avoids a
+ GCC warning that TAO_YYVAL may be used uninitialized. */
+ tao_yyval = tao_yyvsp[1-tao_yylen];
+
+
+ TAO_YY_REDUCE_PRINT (tao_yyn);
+ switch (tao_yyn)
+ {
+ case 5:
+
+ {
+// definition : type_dcl
+ idl_global->set_parse_state (IDL_GlobalData::PS_TypeDeclSeen);
+ }
+ break;
+
+ case 6:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 7:
+
+ {
+// | typeid_dcl
+ idl_global->set_parse_state (IDL_GlobalData::PS_TypeIdDeclSeen);
+ }
+ break;
+
+ case 8:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 9:
+
+ {
+// | typeprefix_dcl
+ idl_global->set_parse_state (IDL_GlobalData::PS_TypePrefixDeclSeen);
+ }
+ break;
+
+ case 10:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 11:
+
+ {
+// | const_dcl
+ idl_global->set_parse_state (IDL_GlobalData::PS_ConstDeclSeen);
+ }
+ break;
+
+ case 12:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 13:
+
+ {
+// | exception
+ idl_global->set_parse_state (IDL_GlobalData::PS_ExceptDeclSeen);
+ }
+ break;
+
+ case 14:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 15:
+
+ {
+// | interface_def
+ idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceDeclSeen);
+ }
+ break;
+
+ case 16:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 17:
+
+ {
+// | module
+ idl_global->set_parse_state (IDL_GlobalData::PS_ModuleDeclSeen);
+ }
+ break;
+
+ case 18:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 19:
+
+ {
+// | value_def
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeDeclSeen);
+ }
+ break;
+
+ case 20:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 21:
+
+ {
+// | component
+ idl_global->set_parse_state (IDL_GlobalData::PS_ComponentDeclSeen);
+ }
+ break;
+
+ case 22:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 23:
+
+ {
+// | home_decl
+ idl_global->set_parse_state (IDL_GlobalData::PS_HomeDeclSeen);
+ }
+ break;
+
+ case 24:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 25:
+
+ {
+// | event
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventDeclSeen);
+ }
+ break;
+
+ case 26:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 27:
+
+ {
+// | error
+ idl_global->err()->syntax_error (idl_global->parse_state());
+ }
+ break;
+
+ case 28:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ tao_yyerrok;
+ }
+ break;
+
+ case 29:
+
+ {
+// module : IDL_MODULE
+ idl_global->set_parse_state (IDL_GlobalData::PS_ModuleSeen);
+ }
+ break;
+
+ case 30:
+
+ {
+// IDENTIFIER
+ Identifier id (tao_yyvsp[0].strval);
+ ACE::strdelete (tao_yyvsp[0].strval);
+ tao_yyvsp[0].strval = 0;
+ UTL_ScopedName n (&id,
+ 0);
+ AST_Module *m = 0;
+ 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);
+ }
+ /*
+ * Push it on the stack
+ */
+ idl_global->scopes ().push (m);
+ }
+ break;
+
+ case 31:
+
+ {
+// '{'
+ idl_global->set_parse_state (IDL_GlobalData::PS_ModuleSqSeen);
+ }
+ break;
+
+ case 32:
+
+ {
+// definitions
+ idl_global->set_parse_state (IDL_GlobalData::PS_ModuleBodySeen);
+ }
+ break;
+
+ case 33:
+
+ {
+// '}'
+ idl_global->set_parse_state (IDL_GlobalData::PS_ModuleQsSeen);
+ /*
+ * Finished with this module - pop it from the scope stack.
+ */
+ idl_global->scopes ().pop ();
+ }
+ break;
+
+ case 36:
+
+ {
+// 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.
+ */
+ 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->destroy ();
+ delete tao_yyvsp[0].ihval;
+ tao_yyvsp[0].ihval = 0;
+ }
+
+ /*
+ * Push it on the scope stack.
+ */
+ idl_global->scopes ().push (i);
+ }
+ break;
+
+ case 37:
+
+ {
+// '{'
+ idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSqSeen);
+ }
+ break;
+
+ case 38:
+
+ {
+// exports
+ idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceBodySeen);
+ }
+ break;
+
+ case 39:
+
+ {
+// '}'
+ idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen);
+
+ /*
+ * Done with this interface - pop it off the scopes stack
+ */
+ idl_global->scopes ().pop ();
+ }
+ break;
+
+ case 40:
+
+ {
+// interface_decl : IDL_INTERFACE
+ idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSeen);
+ }
+ break;
+
+ case 41:
+
+ {
+// id
+ idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceIDSeen);
+ tao_yyval.idval = tao_yyvsp[0].idval;
+ }
+ break;
+
+ case 42:
+
+ {
+// interface_header : interface_decl inheritance_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
+
+ if (tao_yyvsp[0].nlval != 0 && tao_yyvsp[0].nlval->truncatable ())
+ {
+ idl_global->err ()->syntax_error (
+ IDL_GlobalData::PS_InheritColonSeen
+ );
+ }
+
+ /*
+ * 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 = 0;
+ ACE_NEW_RETURN (n,
+ UTL_ScopedName (tao_yyvsp[-1].idval, 0),
+ 1);
+ ACE_NEW_RETURN (tao_yyval.ihval,
+ FE_InterfaceHeader (n,
+ tao_yyvsp[0].nlval,
+ false,
+ false,
+ true),
+ 1);
+
+ if (0 != tao_yyvsp[0].nlval)
+ {
+ tao_yyvsp[0].nlval->destroy ();
+ delete tao_yyvsp[0].nlval;
+ tao_yyvsp[0].nlval = 0;
+ }
+ }
+ break;
+
+ case 43:
+
+ {
+// | 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
+ */
+ UTL_ScopedName *n = 0;
+ ACE_NEW_RETURN (n,
+ UTL_ScopedName (tao_yyvsp[-1].idval, 0),
+ 1);
+ ACE_NEW_RETURN (tao_yyval.ihval,
+ FE_InterfaceHeader (n,
+ tao_yyvsp[0].nlval,
+ true,
+ false,
+ true),
+ 1);
+
+ if (0 != tao_yyvsp[0].nlval)
+ {
+ tao_yyvsp[0].nlval->destroy ();
+ delete tao_yyvsp[0].nlval;
+ tao_yyvsp[0].nlval = 0;
+ }
+ }
+ break;
+
+ case 44:
+
+ {
+// | 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 = 0;
+ ACE_NEW_RETURN (n,
+ UTL_ScopedName (tao_yyvsp[-1].idval, 0),
+ 1);
+ ACE_NEW_RETURN (tao_yyval.ihval,
+ FE_InterfaceHeader (n,
+ tao_yyvsp[0].nlval,
+ false,
+ true,
+ true),
+ 1);
+
+ if (0 != tao_yyvsp[0].nlval)
+ {
+ tao_yyvsp[0].nlval->destroy ();
+ delete tao_yyvsp[0].nlval;
+ tao_yyvsp[0].nlval = 0;
+ }
+ }
+ break;
+
+ case 45:
+
+ {
+// inheritance_spec : ':' opt_truncatable
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen);
+ }
+ break;
+
+ case 46:
+
+ {
+// at_least_one_scoped_name
+ tao_yyvsp[0].nlval->truncatable (tao_yyvsp[-2].bval);
+ tao_yyval.nlval = tao_yyvsp[0].nlval;
+ }
+ break;
+
+ case 47:
+
+ {
+/* | EMPTY */
+ tao_yyval.nlval = 0;
+ }
+ break;
+
+ case 52:
+
+ {
+// valuetype : IDL_CUSTOM value_concrete_decl
+ 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")
+ ACE_TEXT (" custom yet\n")));
+ }
+ break;
+
+ case 54:
+
+ {
+// 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)
+ {
+ 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 (),
+ false,
+ tao_yyvsp[0].vhval->truncatable (),
+ 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);
+
+ // FE_OBVHeader is not automatically destroyed in the AST
+ tao_yyvsp[0].vhval->destroy ();
+ delete tao_yyvsp[0].vhval;
+ tao_yyvsp[0].vhval = 0;
+ }
+
+ /*
+ * Push it on the scope stack
+ */
+ idl_global->scopes ().push (v);
+ }
+ break;
+
+ case 55:
+
+ {
+// '{'
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSqSeen);
+ }
+ break;
+
+ case 56:
+
+ {
+// value_elements
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeBodySeen);
+ }
+ break;
+
+ case 57:
+
+ {
+// '}'
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeQsSeen);
+
+ AST_ValueType *vt =
+ AST_ValueType::narrow_from_scope (
+ idl_global->scopes ().top_non_null ()
+ );
+
+ if (vt != 0 && vt->will_have_factory ())
+ {
+ idl_global->valuefactory_seen_ = true;
+ }
+
+ /*
+ * Done with this value type - pop it off the scopes stack
+ */
+ idl_global->scopes ().pop ();
+ }
+ break;
+
+ case 58:
+
+ {
+// 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)
+ {
+ 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 (),
+ true,
+ false,
+ 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);
+ }
+
+ /*
+ * Push it on the scope stack.
+ */
+ idl_global->scopes ().push (v);
+ }
+ break;
+
+ case 59:
+
+ {
+// '{'
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSqSeen);
+ }
+ break;
+
+ case 60:
+
+ {
+// exports
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeBodySeen);
+ }
+ break;
+
+ case 61:
+
+ {
+// '}'
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeQsSeen);
+
+ /*
+ * Done with this valuetype - pop it off the scopes stack.
+ */
+ idl_global->scopes ().pop ();
+ }
+ break;
+
+ case 62:
+
+ {
+// value_header : value_decl inheritance_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
+ }
+ break;
+
+ case 63:
+
+ {
+// supports_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
+
+ UTL_ScopedName *sn = 0;
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (tao_yyvsp[-3].idval, 0),
+ 1);
+ ACE_NEW_RETURN (tao_yyval.vhval,
+ FE_OBVHeader (sn,
+ tao_yyvsp[-2].nlval,
+ tao_yyvsp[0].nlval,
+ tao_yyvsp[-2].nlval ? tao_yyvsp[-2].nlval->truncatable () : false),
+ 1);
+
+ if (0 != tao_yyvsp[0].nlval)
+ {
+ tao_yyvsp[0].nlval->destroy ();
+ delete tao_yyvsp[0].nlval;
+ tao_yyvsp[0].nlval = 0;
+ }
+
+ if (0 != tao_yyvsp[-2].nlval)
+ {
+ tao_yyvsp[-2].nlval->destroy ();
+ delete tao_yyvsp[-2].nlval;
+ tao_yyvsp[-2].nlval = 0;
+ }
+ }
+ break;
+
+ case 64:
+
+ {
+// value_decl : IDL_VALUETYPE
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSeen);
+ }
+ break;
+
+ case 65:
+
+ {
+// id
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeIDSeen);
+ tao_yyval.idval = tao_yyvsp[0].idval;
+ }
+ break;
+
+ case 66:
+
+ {
+// opt_truncatable : IDL_TRUNCATABLE
+ tao_yyval.bval = true;
+ }
+ break;
+
+ case 67:
+
+ {
+/* | EMPTY */
+ tao_yyval.bval = false;
+ }
+ break;
+
+ case 68:
+
+ {
+// supports_spec : IDL_SUPPORTS at_least_one_scoped_name
+ tao_yyval.nlval = tao_yyvsp[0].nlval;
+ }
+ break;
+
+ case 69:
+
+ {
+/* | EMPTY */
+ tao_yyval.nlval = 0;
+ }
+ break;
+
+ case 70:
+
+ {
+// 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);
+
+ /*
+ * 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,
+ true);
+ (void) s->fe_add_valuetype_fwd (f);
+ }
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+ }
+ break;
+
+ case 71:
+
+ {
+// | 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);
+
+ /*
+ * 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,
+ false);
+ (void) s->fe_add_valuetype_fwd (f);
+ }
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+ }
+ break;
+
+ case 72:
+
+ {
+// value_box_decl : value_decl type_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueBoxDeclSeen);
+
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n (tao_yyvsp[-1].idval,
+ 0);
+
+ if (s != 0 && tao_yyvsp[0].dcval != 0)
+ {
+ /*
+ * Get the type_spec associated with the valuebox
+ */
+ AST_Type *tp = 0;
+ AST_Typedef *td
+ = AST_Typedef::narrow_from_decl (tao_yyvsp[0].dcval);
+
+ if (td == 0)
+ {
+ tp = AST_Type::narrow_from_decl (tao_yyvsp[0].dcval);
+ }
+ else
+ {
+ tp = td->primitive_base_type ();
+ }
+
+ if (tp == 0)
+ { // The <type_spec> given is a valid type
+ idl_global->err ()->not_a_type (tao_yyvsp[0].dcval);
+ }
+ else if (tp->node_type() == AST_Decl::NT_valuetype)
+ { // valuetype is not allowed as <type_spec> for boxed value
+ idl_global->err ()->error0 (
+ UTL_Error::EIDL_ILLEGAL_BOXED_TYPE
+ );
+ }
+ else
+ {
+ /*
+ * Add the valuebox to its definition scope
+ */
+ AST_ValueBox *vb = idl_global->gen ()->create_valuebox (&n,
+ tp);
+ (void) s->fe_add_valuebox (vb);
+ }
+ }
+
+ tao_yyvsp[-1].idval->destroy ();
+ delete tao_yyvsp[-1].idval;
+ tao_yyvsp[-1].idval = 0;
+ }
+ break;
+
+ case 78:
+
+ {
+// state_member : IDL_PUBLIC
+ /* is $0 to member_i */
+ tao_yyval.vival = AST_Field::vis_PUBLIC;
+ }
+ break;
+
+ case 80:
+
+ {
+// IDL_PRIVATE
+ /* is $0 to member_i */
+ tao_yyval.vival = AST_Field::vis_PRIVATE;
+ }
+ break;
+
+ case 84:
+
+ {
+// export : type_dcl
+ idl_global->set_parse_state (IDL_GlobalData::PS_TypeDeclSeen);
+ }
+ break;
+
+ case 85:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 86:
+
+ {
+// | typeid_dcl
+ idl_global->set_parse_state (IDL_GlobalData::PS_TypeIdDeclSeen);
+ }
+ break;
+
+ case 87:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 88:
+
+ {
+// | typeprefix_dcl
+ idl_global->set_parse_state (IDL_GlobalData::PS_TypePrefixDeclSeen);
+ }
+ break;
+
+ case 89:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 90:
+
+ {
+// | const_dcl
+ idl_global->set_parse_state (IDL_GlobalData::PS_ConstDeclSeen);
+ }
+ break;
+
+ case 91:
+
+ {
+// ';'
+ idl_global->set_parse_state(IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 92:
+
+ {
+// | exception
+ idl_global->set_parse_state (IDL_GlobalData::PS_ExceptDeclSeen);
+ }
+ break;
+
+ case 93:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 94:
+
+ {
+// | attribute
+ idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclSeen);
+ }
+ break;
+
+ case 95:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 96:
+
+ {
+// | operation
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpDeclSeen);
+ }
+ break;
+
+ case 97:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 98:
+
+ {
+// | error
+ idl_global->err()->syntax_error (idl_global->parse_state());
+ }
+ break;
+
+ case 99:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ tao_yyerrok;
+ }
+ break;
+
+ case 100:
+
+ {
+// 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 101:
+
+ {
+// scoped_names : scoped_names ','
+ idl_global->set_parse_state (IDL_GlobalData::PS_SNListCommaSeen);
+ }
+ break;
+
+ case 102:
+
+ {
+// scoped_name
+ idl_global->set_parse_state (IDL_GlobalData::PS_ScopedNameSeen);
+
+ if (tao_yyvsp[-3].nlval == 0)
+ {
+ 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 103:
+
+ {
+/* | EMPTY */
+ tao_yyval.nlval = 0;
+ }
+ break;
+
+ case 104:
+
+ {
+// scoped_name : id
+ idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
+
+ ACE_NEW_RETURN (tao_yyval.idlist,
+ UTL_IdList (tao_yyvsp[0].idval,
+ 0),
+ 1);
+ }
+ break;
+
+ case 105:
+
+ {
+// | IDL_SCOPE_DELIMITOR
+ idl_global->set_parse_state (IDL_GlobalData::PS_ScopeDelimSeen);
+ }
+ break;
+
+ case 106:
+
+ {
+// id
+ idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
+
+ Identifier *id = 0;
+ ACE_NEW_RETURN (id,
+ Identifier (tao_yyvsp[-2].strval),
+ 1);
+ ACE::strdelete (tao_yyvsp[-2].strval);
+ tao_yyvsp[-2].strval = 0;
+ 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 107:
+
+ {
+// | scoped_name IDL_SCOPE_DELIMITOR
+ idl_global->set_parse_state (IDL_GlobalData::PS_ScopeDelimSeen);
+
+ // This cleans up all the non-global "::"s in scoped names.
+ // If there is a global one, it gets put into the UTL_IdList,
+ // so we clean it up in the case above.
+ ACE::strdelete (tao_yyvsp[0].strval);
+ tao_yyvsp[0].strval = 0;
+ }
+ break;
+
+ case 108:
+
+ {
+// id
+ idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
+
+ 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 109:
+
+ {
+// id: IDENTIFIER
+ ACE_NEW_RETURN (tao_yyval.idval,
+ Identifier (tao_yyvsp[0].strval),
+ 1);
+ ACE::strdelete (tao_yyvsp[0].strval);
+ tao_yyvsp[0].strval = 0;
+ }
+ break;
+
+ case 110:
+
+ {
+// interface_forward : interface_decl
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n (tao_yyvsp[0].idval,
+ 0);
+
+ if (ACE_OS::strcmp (tao_yyvsp[0].idval->get_string (),
+ "TypeCode") == 0
+ && !idl_global->in_main_file ())
+ {
+ AST_PredefinedType *pdt =
+ idl_global->gen ()->create_predefined_type (
+ AST_PredefinedType::PT_pseudo,
+ &n
+ );
+ (void) s->add_predefined_type (pdt);
+ s->add_to_scope (pdt);
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
+ break;
+ }
+
+ AST_InterfaceFwd *f = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceForwardSeen);
+
+ /*
+ * 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);
+ }
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+ }
+ break;
+
+ case 111:
+
+ {
+// | 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
+ );
+
+ /*
+ * 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);
+ }
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+ }
+ break;
+
+ case 112:
+
+ {
+// | 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
+ );
+
+ /*
+ * 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);
+ }
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+ }
+ break;
+
+ case 113:
+
+ {
+// const_dcl : IDL_CONST
+ idl_global->set_parse_state (IDL_GlobalData::PS_ConstSeen);
+ }
+ break;
+
+ case 114:
+
+ {
+// const_type
+ idl_global->set_parse_state (IDL_GlobalData::PS_ConstTypeSeen);
+ }
+ break;
+
+ case 115:
+
+ {
+// id
+ idl_global->set_parse_state (IDL_GlobalData::PS_ConstIDSeen);
+ }
+ break;
+
+ case 116:
+
+ {
+// '='
+ idl_global->set_parse_state (IDL_GlobalData::PS_ConstAssignSeen);
+ }
+ break;
+
+ case 117:
+
+ {
+// 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.
+ */
+ 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);
+ tao_yyvsp[0].exval->destroy ();
+ delete tao_yyvsp[0].exval;
+ tao_yyvsp[0].exval = 0;
+ }
+ else
+ {
+ c =
+ idl_global->gen ()->create_constant (
+ tao_yyvsp[-6].etval,
+ tao_yyvsp[0].exval,
+ &n
+ );
+ (void) s->fe_add_constant (c);
+ delete result;
+ result = 0;
+ }
+
+ tao_yyvsp[-4].idval->destroy ();
+ delete tao_yyvsp[-4].idval;
+ tao_yyvsp[-4].idval = 0;
+ }
+ }
+ break;
+
+ case 124:
+
+ {
+// 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 125:
+
+ {
+// | wstring_type_spec
+ tao_yyval.etval = AST_Expression::EV_wstring;
+ }
+ break;
+
+ case 126:
+
+ {
+// | scoped_name
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_PredefinedType *c = 0;
+ AST_Typedef *t = 0;
+
+ /*
+ * If the constant's type is a scoped name, it must resolve
+ * to a scalar constant type
+ */
+ AST_Decl *d =
+ s->lookup_by_name (tao_yyvsp[0].idlist,
+ true);
+
+ tao_yyvsp[0].idlist->destroy ();
+ delete tao_yyvsp[0].idlist;
+ tao_yyvsp[0].idlist = 0;
+
+ 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 130:
+
+ {
+// 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 132:
+
+ {
+// 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 134:
+
+ {
+// 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 136:
+
+ {
+// 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 137:
+
+ {
+// | 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 139:
+
+ {
+// 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 140:
+
+ {
+// | 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 142:
+
+ {
+// 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 143:
+
+ {
+// | 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 144:
+
+ {
+// | 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 146:
+
+ {
+// 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 147:
+
+ {
+// | '-' primary_expr
+ tao_yyval.exval =
+ idl_global->gen()->create_expr (
+ AST_Expression::EC_u_minus,
+ tao_yyvsp[0].exval,
+ 0
+ );
+ }
+ break;
+
+ case 148:
+
+ {
+// | '~' primary_expr
+ tao_yyval.exval =
+ idl_global->gen()->create_expr (
+ AST_Expression::EC_bit_neg,
+ tao_yyvsp[0].exval,
+ 0
+ );
+ }
+ break;
+
+ case 149:
+
+ {
+// 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 ();
+ AST_Decl *d = s->lookup_by_name (tao_yyvsp[0].idlist,
+ true);
+
+ /*
+ * If the scoped name is an IDL constant, it may be used in an
+ * array dim, a string bound, or a sequence bound. If so, it
+ * must be unsigned and > 0. We assign the constant's value
+ * and type to the expression created here so we can check
+ * them later.
+ */
+ if (d != 0 && d->node_type () == AST_Decl::NT_const)
+ {
+ AST_Constant *c = AST_Constant::narrow_from_decl (d);
+ tao_yyval.exval =
+ idl_global->gen ()->create_expr (c->constant_value (),
+ c->et ());
+
+ tao_yyvsp[0].idlist->destroy ();
+ delete tao_yyvsp[0].idlist;
+ tao_yyvsp[0].idlist = 0;
+ }
+ else
+ {
+ tao_yyval.exval = idl_global->gen ()->create_expr (tao_yyvsp[0].idlist);
+ }
+ }
+ break;
+
+ case 151:
+
+ {
+// | literal
+// | '(' const_expr ')'
+ tao_yyval.exval = tao_yyvsp[-1].exval;
+ }
+ break;
+
+ case 152:
+
+ {
+// literal : IDL_INTEGER_LITERAL
+ tao_yyval.exval = idl_global->gen ()->create_expr (tao_yyvsp[0].ival);
+ }
+ break;
+
+ case 153:
+
+ {
+// | IDL_UINTEGER_LITERAL
+ tao_yyval.exval =
+ idl_global->gen ()->create_expr (tao_yyvsp[0].uival,
+ AST_Expression::EV_ulonglong);
+ }
+ break;
+
+ case 154:
+
+ {
+// | IDL_STRING_LITERAL
+ tao_yyval.exval = idl_global->gen ()->create_expr (tao_yyvsp[0].sval);
+ tao_yyvsp[0].sval->destroy ();
+ delete tao_yyvsp[0].sval;
+ tao_yyvsp[0].sval = 0;
+ }
+ break;
+
+ case 155:
+
+ {
+// | IDL_WSTRING_LITERAL
+ tao_yyval.exval = idl_global->gen ()->create_expr (tao_yyvsp[0].wsval);
+ }
+ break;
+
+ case 156:
+
+ {
+// | IDL_CHARACTER_LITERAL
+ tao_yyval.exval = idl_global->gen ()->create_expr (tao_yyvsp[0].cval);
+ }
+ break;
+
+ case 157:
+
+ {
+// | IDL_WCHAR_LITERAL
+ ACE_OutputCDR::from_wchar wc (tao_yyvsp[0].wcval);
+ tao_yyval.exval = idl_global->gen ()->create_expr (wc);
+ }
+ break;
+
+ case 158:
+
+ {
+// | IDL_FLOATING_PT_LITERAL
+ tao_yyval.exval = idl_global->gen ()->create_expr (tao_yyvsp[0].dval);
+ }
+ break;
+
+ case 159:
+
+ {
+// | IDL_TRUETOK
+ tao_yyval.exval = idl_global->gen ()->create_expr (true);
+ }
+ break;
+
+ case 160:
+
+ {
+// | IDL_FALSETOK
+ tao_yyval.exval = idl_global->gen ()->create_expr (false);
+ }
+ break;
+
+ case 161:
+
+ {
+// 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 ();
+
+ /*
+ * If const_expr is an enum value (AST_EnumVal inherits from
+ * AST_Constant), the AST_ExprValue will probably not be set,
+ * but there's no need to check anyway
+ */
+ if (ev != 0)
+ {
+ switch (ev->et)
+ {
+ case AST_Expression::EV_ushort:
+ if (ev->u.usval == 0)
+ {
+ good_expression = 0;
+ }
+
+ break;
+ case AST_Expression::EV_ulong:
+ if (ev->u.ulval == 0)
+ {
+ good_expression = 0;
+ }
+
+ break;
+#if !defined (ACE_LACKS_LONGLONG_T)
+ case AST_Expression::EV_ulonglong:
+ if (ev->u.ullval == 0)
+ {
+ good_expression = 0;
+ }
+
+ break;
+#endif
+ 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;
+ break;
+ }
+ }
+
+ if (good_expression)
+ {
+ tao_yyval.exval = tao_yyvsp[0].exval;
+ }
+ else
+ {
+ idl_global->err ()->syntax_error (idl_global->parse_state ());
+ }
+ }
+ break;
+
+ case 162:
+
+ {
+// type_dcl : IDL_TYPEDEF
+ idl_global->set_parse_state (IDL_GlobalData::PS_TypedefSeen);
+ }
+ break;
+
+ case 163:
+
+ {
+// type_declarator
+ tao_yyval.ival = 0;
+ }
+ break;
+
+ case 164:
+
+ {
+// | struct_type
+ tao_yyval.ival = 0;
+ }
+ break;
+
+ case 165:
+
+ {
+// | union_type
+ tao_yyval.ival = 0;
+ }
+ break;
+
+ case 166:
+
+ {
+// | enum_type
+ tao_yyval.ival = 0;
+ }
+ break;
+
+ case 167:
+
+ {
+// | 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);
+ }
+
+ tao_yyvsp[0].deval->destroy ();
+ delete tao_yyvsp[0].deval;
+ tao_yyvsp[0].deval = 0;
+ }
+ break;
+
+ case 168:
+
+ {
+// | constructed_forward_type_spec
+ tao_yyval.ival = 0;
+ }
+ break;
+
+ case 169:
+
+ {
+// type_declarator : type_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_TypeSpecSeen);
+ }
+ break;
+
+ case 170:
+
+ {
+// 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;
+ }
+
+ if (AST_Decl::NT_except == tp->node_type ())
+ {
+ idl_global->err ()->not_a_type (tp);
+ 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 173:
+
+ {
+// simple_type_spec : base_type_spec
+ tao_yyval.dcval =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ tao_yyvsp[0].etval
+ );
+ }
+ break;
+
+ case 175:
+
+ {
+// | 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,
+ true);
+ }
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (tao_yyvsp[0].idlist);
+ }
+ else
+ {
+ d->last_referenced_as (tao_yyvsp[0].idlist);
+ }
+
+
+ tao_yyval.dcval = d;
+ }
+ break;
+
+ case 192:
+
+ {
+// 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 193:
+
+ {
+// declarators : declarators ','
+ idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen);
+ }
+ break;
+
+ case 194:
+
+ {
+// declarator
+ idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen);
+
+ if (tao_yyvsp[-3].dlval == 0)
+ {
+ 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 195:
+
+ {
+/* | EMPTY */
+ tao_yyval.dlval = 0;
+ }
+ break;
+
+ case 198:
+
+ {
+// 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 199:
+
+ {
+// simple_declarators : simple_declarators ','
+ idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen);
+ }
+ break;
+
+ case 200:
+
+ {
+// simple_declarator
+ idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen);
+
+ if (tao_yyvsp[-3].dlval == 0)
+ {
+ 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 201:
+
+ {
+/* | EMPTY */
+ tao_yyval.dlval = 0;
+ }
+ break;
+
+ case 202:
+
+ {
+// 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 203:
+
+ {
+// 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 206:
+
+ {
+// signed_int : IDL_LONG
+ tao_yyval.etval = AST_Expression::EV_long;
+ }
+ break;
+
+ case 207:
+
+ {
+// | IDL_LONG IDL_LONG
+ tao_yyval.etval = AST_Expression::EV_longlong;
+ }
+ break;
+
+ case 208:
+
+ {
+// | IDL_SHORT
+ tao_yyval.etval = AST_Expression::EV_short;
+ }
+ break;
+
+ case 209:
+
+ {
+// unsigned_int : IDL_UNSIGNED IDL_LONG
+ tao_yyval.etval = AST_Expression::EV_ulong;
+ }
+ break;
+
+ case 210:
+
+ {
+// | IDL_UNSIGNED IDL_LONG IDL_LONG
+ tao_yyval.etval = AST_Expression::EV_ulonglong;
+ }
+ break;
+
+ case 211:
+
+ {
+// | IDL_UNSIGNED IDL_SHORT
+ tao_yyval.etval = AST_Expression::EV_ushort;
+ }
+ break;
+
+ case 212:
+
+ {
+// floating_pt_type : IDL_DOUBLE
+ tao_yyval.etval = AST_Expression::EV_double;
+ }
+ break;
+
+ case 213:
+
+ {
+// | IDL_FLOAT
+ tao_yyval.etval = AST_Expression::EV_float;
+ }
+ break;
+
+ case 214:
+
+ {
+// | IDL_LONG IDL_DOUBLE
+ tao_yyval.etval = AST_Expression::EV_longdouble;
+ }
+ break;
+
+ case 215:
+
+ {
+// fixed_type : IDL_FIXED
+ 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")
+ ACE_TEXT (" fixed types yet\n")));
+ }
+ break;
+
+ case 216:
+
+ {
+// char_type : IDL_CHAR
+ tao_yyval.etval = AST_Expression::EV_char;
+ }
+ break;
+
+ case 217:
+
+ {
+// | IDL_WCHAR
+ tao_yyval.etval = AST_Expression::EV_wchar;
+ }
+ break;
+
+ case 218:
+
+ {
+// octet_type : IDL_OCTET
+ tao_yyval.etval = AST_Expression::EV_octet;
+ }
+ break;
+
+ case 219:
+
+ {
+// boolean_type : IDL_BOOLEAN
+ tao_yyval.etval = AST_Expression::EV_bool;
+ }
+ break;
+
+ case 220:
+
+ {
+// any_type : IDL_ANY
+ tao_yyval.etval = AST_Expression::EV_any;
+ }
+ break;
+
+ case 221:
+
+ {
+// object_type : IDL_OBJECT
+ tao_yyval.etval = AST_Expression::EV_object;
+ }
+ break;
+
+ case 222:
+
+ {
+// struct_decl : IDL_STRUCT
+ idl_global->set_parse_state (IDL_GlobalData::PS_StructSeen);
+ }
+ break;
+
+ case 223:
+
+ {
+// id
+ idl_global->set_parse_state (IDL_GlobalData::PS_StructIDSeen);
+ tao_yyval.idval = tao_yyvsp[0].idval;
+ }
+ break;
+
+ case 224:
+
+ {
+// 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;
+
+ /*
+ * 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 ()
+ );
+ AST_Structure::fwd_redefinition_helper (d,
+ s);
+ (void) s->fe_add_structure (d);
+ }
+
+ /*
+ * Push the scope of the struct on the scopes stack.
+ */
+ idl_global->scopes ().push (d);
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+ }
+ break;
+
+ case 225:
+
+ {
+// '{'
+ idl_global->set_parse_state (IDL_GlobalData::PS_StructSqSeen);
+ }
+ break;
+
+ case 226:
+
+ {
+// at_least_one_member
+ idl_global->set_parse_state (IDL_GlobalData::PS_StructBodySeen);
+ }
+ break;
+
+ case 227:
+
+ {
+// '}'
+ idl_global->set_parse_state (IDL_GlobalData::PS_StructQsSeen);
+
+ /*
+ * 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 ().pop ();
+ }
+ break;
+
+ case 231:
+
+ {
+// member :
+ /* is $0 to member_i */
+ tao_yyval.vival = AST_Field::vis_NA;
+ }
+ break;
+
+ case 233:
+
+ {
+// member_i : type_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_MemberTypeSeen);
+ }
+ break;
+
+ case 234:
+
+ {
+// at_least_one_declarator
+ idl_global->set_parse_state (IDL_GlobalData::PS_MemberDeclsSeen);
+ }
+ break;
+
+ case 235:
+
+ {
+// ';'
+ 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.
+ */
+ 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.
+ */
+ 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);
+ }
+ }
+
+ tao_yyvsp[-2].dlval->destroy ();
+ delete tao_yyvsp[-2].dlval;
+ tao_yyvsp[-2].dlval = 0;
+ }
+ break;
+
+ case 236:
+
+ {
+// | error
+ idl_global->err()->syntax_error (idl_global->parse_state ());
+ }
+ break;
+
+ case 237:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ tao_yyerrok;
+ }
+ break;
+
+ case 238:
+
+ {
+// union_decl : IDL_UNION
+ idl_global->set_parse_state (IDL_GlobalData::PS_UnionSeen);
+ }
+ break;
+
+ case 239:
+
+ {
+// id
+ idl_global->set_parse_state (IDL_GlobalData::PS_UnionIDSeen);
+ tao_yyval.idval = tao_yyvsp[0].idval;
+ }
+ break;
+
+ case 240:
+
+ {
+// union_type : union_decl IDL_SWITCH
+ idl_global->set_parse_state (IDL_GlobalData::PS_SwitchSeen);
+ }
+ break;
+
+ case 241:
+
+ {
+// '('
+ idl_global->set_parse_state (IDL_GlobalData::PS_SwitchOpenParSeen);
+ }
+ break;
+
+ case 242:
+
+ {
+// switch_type_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_SwitchTypeSeen);
+ }
+ break;
+
+ case 243:
+
+ {
+// ')'
+ 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 ());
+ }
+
+ AST_Structure *st = AST_Structure::narrow_from_decl (u);
+ AST_Structure::fwd_redefinition_helper (st,
+ s);
+ u = AST_Union::narrow_from_decl (st);
+ (void) s->fe_add_union (u);
+ }
+
+ /*
+ * Push the scope of the union on the scopes stack
+ */
+ idl_global->scopes ().push (u);
+
+ tao_yyvsp[-7].idval->destroy ();
+ delete tao_yyvsp[-7].idval;
+ tao_yyvsp[-7].idval = 0;
+ }
+ break;
+
+ case 244:
+
+ {
+// '{'
+ idl_global->set_parse_state (IDL_GlobalData::PS_UnionSqSeen);
+ }
+ break;
+
+ case 245:
+
+ {
+// at_least_one_case_branch
+ idl_global->set_parse_state (IDL_GlobalData::PS_UnionBodySeen);
+ }
+ break;
+
+ case 246:
+
+ {
+// '}'
+ idl_global->set_parse_state (IDL_GlobalData::PS_UnionQsSeen);
+
+ /*
+ * 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 ()
+ );
+
+ if (tao_yyval.dcval != 0)
+ {
+ idl_global->scopes ().pop ();
+ }
+ }
+ break;
+
+ case 247:
+
+ {
+// switch_type_spec : integer_type
+ tao_yyval.dcval =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ tao_yyvsp[0].etval
+ );
+ }
+ break;
+
+ case 248:
+
+ {
+// | 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
+ );
+ }
+ break;
+
+ case 249:
+
+ {
+// | 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
+ );
+ }
+ break;
+
+ case 250:
+
+ {
+// | boolean_type
+ tao_yyval.dcval =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ tao_yyvsp[0].etval
+ );
+ }
+ break;
+
+ case 252:
+
+ {
+// | 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;
+ bool found = 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.
+ */
+ d = s->lookup_by_name (tao_yyvsp[0].idlist,
+ true);
+
+ if (s != 0 && d != 0)
+ {
+ while (!found)
+ {
+ switch (d->node_type ())
+ {
+ case AST_Decl::NT_enum:
+ tao_yyval.dcval = d;
+ found = 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 = 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 = true;
+ break;
+ default:
+ tao_yyval.dcval = 0;
+ found = true;
+ break;
+ }
+ }
+ else
+ {
+ tao_yyval.dcval = 0;
+ found = 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 = true;
+ break;
+ }
+ }
+ }
+ else
+ {
+ tao_yyval.dcval = 0;
+ }
+
+ if (tao_yyval.dcval == 0)
+ {
+ idl_global->err ()->lookup_error (tao_yyvsp[0].idlist);
+
+ tao_yyvsp[0].idlist->destroy ();
+ delete tao_yyvsp[0].idlist;
+ tao_yyvsp[0].idlist = 0;
+
+ /* If we don't return here, we'll crash later.*/
+ return 1;
+ }
+
+ tao_yyvsp[0].idlist->destroy ();
+ delete tao_yyvsp[0].idlist;
+ tao_yyvsp[0].idlist = 0;
+ }
+ break;
+
+ case 256:
+
+ {
+// case_branch : at_least_one_case_label
+ idl_global->set_parse_state (IDL_GlobalData::PS_UnionLabelSeen);
+ }
+ break;
+
+ case 257:
+
+ {
+// element_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemSeen);
+ }
+ break;
+
+ case 258:
+
+ {
+// ';'
+ 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 ()
+ );
+ (void) s->fe_add_union_branch (b);
+
+ // f has passed its field type to the union branch,
+ // but the rest still needs to be cleaned up.
+ f->AST_Decl::destroy ();
+ delete f;
+ f = 0;
+ }
+ }
+ break;
+
+ case 259:
+
+ {
+// | error
+ idl_global->err()->syntax_error (idl_global->parse_state());
+ }
+ break;
+
+ case 260:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ tao_yyerrok;
+ }
+ break;
+
+ case 261:
+
+ {
+// 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 262:
+
+ {
+// case_labels : case_labels case_label
+ if (tao_yyvsp[-1].llval == 0)
+ {
+ 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 263:
+
+ {
+/* | EMPTY */
+ tao_yyval.llval = 0;
+ }
+ break;
+
+ case 264:
+
+ {
+// case_label : IDL_DEFAULT
+ idl_global->set_parse_state (IDL_GlobalData::PS_DefaultSeen);
+ }
+ break;
+
+ case 265:
+
+ {
+// ':'
+ idl_global->set_parse_state (IDL_GlobalData::PS_LabelColonSeen);
+
+ tao_yyval.ulval = idl_global->gen ()->create_union_label (
+ AST_UnionLabel::UL_default,
+ 0
+ );
+ }
+ break;
+
+ case 266:
+
+ {
+// | IDL_CASE
+ idl_global->set_parse_state (IDL_GlobalData::PS_CaseSeen);
+ }
+ break;
+
+ case 267:
+
+ {
+ idl_global->set_parse_state (IDL_GlobalData::PS_LabelExprSeen);
+ }
+ break;
+
+ case 268:
+
+ {
+// const_expr
+ idl_global->set_parse_state (IDL_GlobalData::PS_LabelColonSeen);
+
+ tao_yyval.ulval = idl_global->gen()->create_union_label (
+ AST_UnionLabel::UL_label,
+ tao_yyvsp[-2].exval
+ );
+ }
+ break;
+
+ case 269:
+
+ {
+// element_spec : type_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemTypeSeen);
+ }
+ break;
+
+ case 270:
+
+ {
+// 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);
+
+ tao_yyval.ffval = 0;
+ }
+ /*
+ * 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)
+ {
+ tao_yyval.ffval = 0;
+ }
+ else
+ {
+ tao_yyval.ffval = idl_global->gen ()->create_field (
+ tp,
+ tao_yyvsp[0].deval->name ()
+ );
+ }
+
+ tao_yyvsp[0].deval->destroy ();
+ delete tao_yyvsp[0].deval;
+ tao_yyvsp[0].deval = 0;
+ }
+ }
+ break;
+
+ case 271:
+
+ {
+// 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);
+ }
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+ }
+ break;
+
+ case 272:
+
+ {
+// 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);
+ }
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+ }
+ break;
+
+ case 273:
+
+ {
+// enum_type : IDL_ENUM
+ idl_global->set_parse_state (IDL_GlobalData::PS_EnumSeen);
+ }
+ break;
+
+ case 274:
+
+ {
+// 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.
+ */
+ 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.
+ */
+ idl_global->scopes ().push (e);
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+ }
+ break;
+
+ case 275:
+
+ {
+// '{'
+ idl_global->set_parse_state (IDL_GlobalData::PS_EnumSqSeen);
+ }
+ break;
+
+ case 276:
+
+ {
+// at_least_one_enumerator
+ idl_global->set_parse_state (IDL_GlobalData::PS_EnumBodySeen);
+ }
+ break;
+
+ case 277:
+
+ {
+// '}'
+ idl_global->set_parse_state (IDL_GlobalData::PS_EnumQsSeen);
+
+ /*
+ * 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 ();
+ }
+ }
+ break;
+
+ case 279:
+
+ {
+// enumerators : enumerators ','
+ idl_global->set_parse_state (IDL_GlobalData::PS_EnumCommaSeen);
+ }
+ break;
+
+ case 282:
+
+ {
+// enumerator : IDENTIFIER
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ Identifier id (tao_yyvsp[0].strval);
+ ACE::strdelete (tao_yyvsp[0].strval);
+ tao_yyvsp[0].strval = 0;
+ UTL_ScopedName n (&id,
+ 0);
+ AST_EnumVal *e = 0;
+ AST_Enum *c = 0;
+
+ /*
+ * 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);
+ }
+ }
+ break;
+
+ case 283:
+
+ {
+// sequence_type_spec : seq_head ','
+ idl_global->set_parse_state (IDL_GlobalData::PS_SequenceCommaSeen);
+ }
+ break;
+
+ case 284:
+
+ {
+// positive_int_expr
+ idl_global->set_parse_state (IDL_GlobalData::PS_SequenceExprSeen);
+ }
+ break;
+
+ case 285:
+
+ {
+// '>'
+ idl_global->set_parse_state (IDL_GlobalData::PS_SequenceQsSeen);
+
+ /*
+ * 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 ();
+
+ /*
+ * Create a node representing a sequence
+ */
+ AST_Expression::AST_ExprValue *ev = 0;
+
+ if (tao_yyvsp[-2].exval != 0)
+ {
+ ev = tao_yyvsp[-2].exval->coerce (AST_Expression::EV_ulong);
+ }
+
+ if (0 == tao_yyvsp[-2].exval || 0 == ev)
+ {
+ idl_global->err ()->coercion_error (tao_yyvsp[-2].exval,
+ AST_Expression::EV_ulong);
+ tao_yyval.dcval = 0;
+ }
+ else if (0 == tao_yyvsp[-5].dcval)
+ {
+ tao_yyval.dcval = 0;
+ }
+ else
+ {
+ AST_Type *tp = AST_Type::narrow_from_decl (tao_yyvsp[-5].dcval);
+
+ if (0 == tp)
+ {
+ ; // 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 ()
+ );
+ }
+ }
+
+ delete ev;
+ ev = 0;
+ }
+ break;
+
+ case 286:
+
+ {
+// | seq_head '>'
+ idl_global->set_parse_state (IDL_GlobalData::PS_SequenceQsSeen);
+
+ /*
+ * 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 ();
+
+ /*
+ * 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
+ {
+ Identifier id ("sequence");
+ UTL_ScopedName sn (&id,
+ 0);
+
+ tao_yyval.dcval =
+ idl_global->gen ()->create_sequence (
+ idl_global->gen ()->create_expr (
+ (idl_uns_long) 0,
+ AST_Expression::EV_ulong
+ ),
+ tp,
+ &sn,
+ s->is_local (),
+ s->is_abstract ()
+ );
+ }
+ }
+ }
+ break;
+
+ case 287:
+
+ {
+// seq_head : IDL_SEQUENCE
+ idl_global->set_parse_state (IDL_GlobalData::PS_SequenceSeen);
+
+ /*
+ * Push a sequence marker on scopes stack.
+ */
+ idl_global->scopes ().push (0);
+ }
+ break;
+
+ case 288:
+
+ {
+// '<'
+ idl_global->set_parse_state (IDL_GlobalData::PS_SequenceSqSeen);
+ }
+ break;
+
+ case 289:
+
+ {
+// simple_type_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_SequenceTypeSeen);
+ tao_yyval.dcval = tao_yyvsp[0].dcval;
+ }
+ break;
+
+ case 290:
+
+ {
+// string_type_spec : string_head '<'
+ idl_global->set_parse_state (IDL_GlobalData::PS_StringSqSeen);
+ }
+ break;
+
+ case 291:
+
+ {
+// positive_int_expr
+ idl_global->set_parse_state (IDL_GlobalData::PS_StringExprSeen);
+ }
+ break;
+
+ case 292:
+
+ {
+// '>'
+ idl_global->set_parse_state (IDL_GlobalData::PS_StringQsSeen);
+
+ /*
+ * Create a node representing a string.
+ */
+ AST_Expression::AST_ExprValue *ev = 0;
+
+ if (tao_yyvsp[-2].exval != 0)
+ {
+ ev = tao_yyvsp[-2].exval->coerce (AST_Expression::EV_ulong);
+ }
+
+ if (0 == tao_yyvsp[-2].exval || 0 == ev)
+ {
+ 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
+ )
+ );
+ }
+
+ delete ev;
+ ev = 0;
+ }
+ break;
+
+ case 293:
+
+ {
+// | string_head
+ idl_global->set_parse_state (IDL_GlobalData::PS_StringCompleted);
+ /*
+ * Create a node representing a string.
+ */
+ tao_yyval.dcval =
+ idl_global->gen ()->create_string (
+ idl_global->gen ()->create_expr ((idl_uns_long) 0,
+ AST_Expression::EV_ulong)
+ );
+ /*
+ * 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 294:
+
+ {
+// string_head : IDL_STRING
+ idl_global->set_parse_state (IDL_GlobalData::PS_StringSeen);
+ }
+ break;
+
+ case 295:
+
+ {
+// wstring_type_spec : wstring_head '<'
+ idl_global->set_parse_state (IDL_GlobalData::PS_StringSqSeen);
+ }
+ break;
+
+ case 296:
+
+ {
+// positive_int_expr
+ idl_global->set_parse_state (IDL_GlobalData::PS_StringExprSeen);
+ }
+ break;
+
+ case 297:
+
+ {
+// '>'
+ idl_global->set_parse_state (IDL_GlobalData::PS_StringQsSeen);
+
+ /*
+ * 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)
+ );
+ }
+ }
+ break;
+
+ case 298:
+
+ {
+// | wstring_head
+ idl_global->set_parse_state (IDL_GlobalData::PS_StringCompleted);
+
+ /*
+ * Create a node representing a wstring.
+ */
+ tao_yyval.dcval =
+ idl_global->gen ()->create_wstring (
+ idl_global->gen ()->create_expr ((idl_uns_long) 0,
+ AST_Expression::EV_ulong)
+ );
+ /*
+ * 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 299:
+
+ {
+// wstring_head : IDL_WSTRING
+ idl_global->set_parse_state (IDL_GlobalData::PS_StringSeen);
+ }
+ break;
+
+ case 300:
+
+ {
+// array_declarator : id
+ idl_global->set_parse_state (IDL_GlobalData::PS_ArrayIDSeen);
+ }
+ break;
+
+ case 301:
+
+ {
+// at_least_one_array_dim
+ idl_global->set_parse_state (IDL_GlobalData::PS_ArrayCompleted);
+
+ /*
+ * Create a node representing an array.
+ */
+ 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
+ );
+
+ tao_yyvsp[0].elval->destroy ();
+ delete tao_yyvsp[0].elval;
+ tao_yyvsp[0].elval = 0;
+
+ sn.destroy ();
+ }
+ }
+ break;
+
+ case 302:
+
+ {
+// 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 303:
+
+ {
+// array_dims : array_dims array_dim
+ if (tao_yyvsp[-1].elval == 0)
+ {
+ 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 304:
+
+ {
+/* | EMPTY */
+ tao_yyval.elval = 0;
+ }
+ break;
+
+ case 305:
+
+ {
+// array_dim : '['
+ idl_global->set_parse_state (IDL_GlobalData::PS_DimSqSeen);
+ }
+ break;
+
+ case 306:
+
+ {
+// positive_int_expr
+ idl_global->set_parse_state (IDL_GlobalData::PS_DimExprSeen);
+ }
+ break;
+
+ case 307:
+
+ {
+// ']'
+ idl_global->set_parse_state (IDL_GlobalData::PS_DimQsSeen);
+
+ /*
+ * Array dimensions are expressions which must be coerced to
+ * positive integers.
+ */
+ AST_Expression::AST_ExprValue *ev = 0;
+
+ if (tao_yyvsp[-2].exval != 0)
+ {
+ ev = tao_yyvsp[-2].exval->coerce (AST_Expression::EV_ulong);
+ }
+
+ if (0 == tao_yyvsp[-2].exval || 0 == ev)
+ {
+ 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;
+ }
+
+ delete ev;
+ ev = 0;
+ }
+ break;
+
+ case 310:
+
+ {
+// attribute_readonly : IDL_READONLY
+ idl_global->set_parse_state (IDL_GlobalData::PS_AttrROSeen);
+ }
+ break;
+
+ case 311:
+
+ {
+// IDL_ATTRIBUTE
+ idl_global->set_parse_state (IDL_GlobalData::PS_AttrSeen);
+ }
+ break;
+
+ case 312:
+
+ {
+// param_type_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_AttrTypeSeen);
+ }
+ break;
+
+ case 313:
+
+ {
+// at_least_one_simple_declarator
+ idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclsSeen);
+ }
+ break;
+
+ case 314:
+
+ {
+// opt_raises
+ 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_OpRaiseCompleted);
+
+ /*
+ * Create nodes representing attributes and add them to the
+ * enclosing scope.
+ */
+ 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;
+ }
+
+ a =
+ idl_global->gen ()->create_attribute (
+ true,
+ tp,
+ d->name (),
+ s->is_local (),
+ s->is_abstract ()
+ );
+
+ if (tao_yyvsp[0].nlval != 0)
+ {
+ (void) a->fe_add_get_exceptions (tao_yyvsp[0].nlval);
+
+ tao_yyvsp[0].nlval->destroy ();
+ delete tao_yyvsp[0].nlval;
+ tao_yyvsp[0].nlval = 0;
+ }
+
+ (void) s->fe_add_attribute (a);
+ }
+ }
+
+ tao_yyvsp[-2].dlval->destroy ();
+ delete tao_yyvsp[-2].dlval;
+ tao_yyvsp[-2].dlval = 0;
+ }
+ break;
+
+ case 315:
+
+ {
+// attribute_readonly : IDL_ATTRIBUTE
+ idl_global->set_parse_state (IDL_GlobalData::PS_AttrSeen);
+ }
+ break;
+
+ case 316:
+
+ {
+// param_type_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_AttrTypeSeen);
+ }
+ break;
+
+ case 317:
+
+ {
+// at_least_one_simple_declarator
+ idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclsSeen);
+ }
+ break;
+
+ case 318:
+
+ {
+// opt_getraises
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpGetRaiseCompleted);
+ }
+ break;
+
+ case 319:
+
+ {
+// opt_setraises
+ 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_OpSetRaiseCompleted);
+
+ /*
+ * Create nodes representing attributes and add them to the
+ * enclosing scope.
+ */
+ if (s != 0
+ && tao_yyvsp[-6].dcval != 0
+ && tao_yyvsp[-4].dlval != 0)
+ {
+ for (UTL_DecllistActiveIterator l (tao_yyvsp[-4].dlval);
+ !l.is_done ();
+ l.next ())
+ {
+ d = l.item ();
+
+ if (d == 0)
+ {
+ continue;
+ }
+
+ AST_Type *tp = d->compose (tao_yyvsp[-6].dcval);
+
+ if (tp == 0)
+ {
+ continue;
+ }
+
+ a =
+ idl_global->gen ()->create_attribute (
+ false,
+ tp,
+ d->name (),
+ s->is_local (),
+ s->is_abstract ()
+ );
+
+ if (tao_yyvsp[-2].nlval != 0)
+ {
+ (void) a->fe_add_get_exceptions (tao_yyvsp[-2].nlval);
+
+ tao_yyvsp[-2].nlval->destroy ();
+ delete tao_yyvsp[-2].nlval;
+ tao_yyvsp[-2].nlval = 0;
+ }
+
+ if (tao_yyvsp[0].nlval != 0)
+ {
+ (void) a->fe_add_set_exceptions (tao_yyvsp[0].nlval);
+
+ tao_yyvsp[0].nlval->destroy ();
+ delete tao_yyvsp[0].nlval;
+ tao_yyvsp[0].nlval = 0;
+ }
+
+ (void) s->fe_add_attribute (a);
+ }
+ }
+
+ tao_yyvsp[-4].dlval->destroy ();
+ delete tao_yyvsp[-4].dlval;
+ tao_yyvsp[-4].dlval = 0;
+ }
+ break;
+
+ case 320:
+
+ {
+// exception : IDL_EXCEPTION
+ idl_global->set_parse_state (IDL_GlobalData::PS_ExceptSeen);
+ }
+ break;
+
+ case 321:
+
+ {
+// 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.
+ */
+ 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.
+ */
+ idl_global->scopes ().push (e);
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+ }
+ break;
+
+ case 322:
+
+ {
+// '{'
+ idl_global->set_parse_state (IDL_GlobalData::PS_ExceptSqSeen);
+ }
+ break;
+
+ case 323:
+
+ {
+// members
+ idl_global->set_parse_state (IDL_GlobalData::PS_ExceptBodySeen);
+ }
+ break;
+
+ case 324:
+
+ {
+// '}'
+ idl_global->set_parse_state (IDL_GlobalData::PS_ExceptQsSeen);
+ /*
+ * Done with this exception. Pop its scope from the scope stack.
+ */
+ idl_global->scopes ().pop ();
+ }
+ break;
+
+ case 325:
+
+ {
+// operation : opt_op_attribute op_type_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpTypeSeen);
+ }
+ break;
+
+ case 326:
+
+ {
+// IDENTIFIER
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ Identifier id (tao_yyvsp[0].strval);
+ ACE::strdelete (tao_yyvsp[0].strval);
+ tao_yyvsp[0].strval = 0;
+
+ 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.
+ */
+ 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
+ {
+ AST_Decl *d = ScopeAsDecl (s);
+ AST_Decl::NodeType nt = d->node_type ();
+ bool local =
+ s->is_local ()
+ || nt == AST_Decl::NT_valuetype
+ || nt == AST_Decl::NT_eventtype;
+ o =
+ idl_global->gen ()->create_operation (tp,
+ tao_yyvsp[-3].ofval,
+ &n,
+ local,
+ s->is_abstract ());
+ (void) s->fe_add_operation (o);
+ }
+ }
+
+ /*
+ * Push the operation scope onto the scopes stack.
+ */
+ idl_global->scopes ().push (o);
+ }
+ break;
+
+ case 327:
+
+ {
+// parameter_list
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
+ }
+ break;
+
+ case 328:
+
+ {
+// opt_raises
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
+ }
+ break;
+
+ case 329:
+
+ {
+// 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.
+ */
+ 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);
+ }
+ }
+
+ /*
+ * Done with this operation. Pop its scope from the scopes stack.
+ */
+ idl_global->scopes ().pop ();
+ }
+ break;
+
+ case 330:
+
+ {
+// opt_op_attribute : IDL_ONEWAY
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpAttrSeen);
+ tao_yyval.ofval = AST_Operation::OP_oneway;
+ }
+ break;
+
+ case 331:
+
+ {
+// | IDL_IDEMPOTENT
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpAttrSeen);
+ tao_yyval.ofval = AST_Operation::OP_idempotent;
+ }
+ break;
+
+ case 332:
+
+ {
+/* | EMPTY */
+ tao_yyval.ofval = AST_Operation::OP_noflags;
+ }
+ break;
+
+ case 334:
+
+ {
+// op_type_spec : param_type_spec | IDL_VOID
+ tao_yyval.dcval =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ AST_Expression::EV_void
+ );
+ }
+ break;
+
+ case 335:
+
+ {
+// init_decl : IDL_FACTORY
+ //@@ PS_FactorySeen?
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpTypeSeen);
+ }
+ break;
+
+ case 336:
+
+ {
+// IDENTIFIER
+ 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 ()));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ }
+
+ Identifier id (tao_yyvsp[0].strval);
+ ACE::strdelete (tao_yyvsp[0].strval);
+ tao_yyvsp[0].strval = 0;
+
+ UTL_ScopedName n (&id,
+ 0);
+ AST_Factory *factory = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
+
+ /*
+ * Create a node representing an factory construct
+ * and add it to its enclosing scope
+ */
+ if (s != 0)
+ {
+ factory = idl_global->gen ()->create_factory (&n);
+ (void) s->fe_add_factory (factory);
+ }
+
+ /*
+ * Push the operation scope onto the scopes stack.
+ */
+ idl_global->scopes ().push (factory);
+ }
+ break;
+
+ case 337:
+
+ {
+// init_parameter_list
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
+ }
+ break;
+
+ case 338:
+
+ {
+// opt_raises
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
+
+ if (tao_yyvsp[0].nlval != 0)
+ {
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Factory *f = AST_Factory::narrow_from_scope (s);
+ (void) f->fe_add_exceptions (tao_yyvsp[0].nlval);
+ }
+
+ idl_global->scopes ().pop ();
+ }
+ break;
+
+ case 339:
+
+ {
+// init_parameter_list : '('
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
+ }
+ break;
+
+ case 340:
+
+ {
+// ')'
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
+ }
+ break;
+
+ case 341:
+
+ {
+// | '('
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
+ }
+ break;
+
+ case 342:
+
+ {
+// at_least_one_in_parameter ')'
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
+ }
+ break;
+
+ case 344:
+
+ {
+// in_parameters : in_parameters ','
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen);
+ }
+ break;
+
+ case 347:
+
+ {
+// in_parameter : IDL_IN
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpParDirSeen);
+ }
+ break;
+
+ case 348:
+
+ {
+// param_type_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpParTypeSeen);
+ }
+ break;
+
+ case 349:
+
+ {
+// 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).
+ */
+ 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 (
+ AST_Argument::dir_IN,
+ tp,
+ tao_yyvsp[0].deval->name ()
+ );
+
+ (void) s->fe_add_argument (a);
+ }
+ }
+
+ tao_yyvsp[0].deval->destroy ();
+ delete tao_yyvsp[0].deval;
+ tao_yyvsp[0].deval = 0;
+ }
+ break;
+
+ case 350:
+
+ {
+// parameter_list : '('
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
+ }
+ break;
+
+ case 351:
+
+ {
+// ')'
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
+ }
+ break;
+
+ case 352:
+
+ {
+// | '('
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
+ }
+ break;
+
+ case 353:
+
+ {
+// at_least_one_parameter ')'
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
+ }
+ break;
+
+ case 355:
+
+ {
+// parameters : parameters ','
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen);
+ }
+ break;
+
+ case 358:
+
+ {
+// parameter : direction
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpParDirSeen);
+ }
+ break;
+
+ case 359:
+
+ {
+// param_type_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpParTypeSeen);
+ }
+ break;
+
+ case 360:
+
+ {
+// 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).
+ */
+ 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 ())
+ {
+ idl_global->err ()->local_remote_mismatch (tp, s);
+ }
+ else
+ {
+ a =
+ idl_global->gen ()->create_argument (
+ tao_yyvsp[-4].dival,
+ tp,
+ tao_yyvsp[0].deval->name ()
+ );
+ (void) s->fe_add_argument (a);
+ }
+ }
+ }
+
+ tao_yyvsp[0].deval->destroy ();
+ delete tao_yyvsp[0].deval;
+ tao_yyvsp[0].deval = 0;
+ }
+ break;
+
+ case 361:
+
+ {
+// param_type_spec : base_type_spec
+ tao_yyval.dcval =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ tao_yyvsp[0].etval
+ );
+ }
+ break;
+
+ case 364:
+
+ {
+// | 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,
+ true);
+ }
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (tao_yyvsp[0].idlist);
+ }
+ else
+ {
+ d->last_referenced_as (tao_yyvsp[0].idlist);
+ AST_Decl::NodeType nt = d->node_type ();
+
+ if (nt == AST_Decl::NT_struct_fwd
+ || nt == AST_Decl::NT_union_fwd)
+ {
+ if (! AST_Type::narrow_from_decl (d)->is_defined ())
+ {
+ 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 365:
+
+ {
+// direction : IDL_IN
+ tao_yyval.dival = AST_Argument::dir_IN;
+ }
+ break;
+
+ case 366:
+
+ {
+// | IDL_OUT
+ tao_yyval.dival = AST_Argument::dir_OUT;
+ }
+ break;
+
+ case 367:
+
+ {
+// | IDL_INOUT
+ tao_yyval.dival = AST_Argument::dir_INOUT;
+ }
+ break;
+
+ case 368:
+
+ {
+// opt_raises : IDL_RAISES
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseSeen);
+ }
+ break;
+
+ case 369:
+
+ {
+// '('
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseSqSeen);
+ }
+ break;
+
+ case 370:
+
+ {
+// at_least_one_scoped_name ')'
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseQsSeen);
+ tao_yyval.nlval = tao_yyvsp[-1].nlval;
+ }
+ break;
+
+ case 371:
+
+ {
+ tao_yyval.nlval = 0;
+/* | EMPTY */
+ }
+ break;
+
+ case 372:
+
+ {
+// opt_getraises : IDL_GETRAISES
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpGetRaiseSeen);
+ }
+ break;
+
+ case 373:
+
+ {
+// '('
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpGetRaiseSqSeen);
+ }
+ break;
+
+ case 374:
+
+ {
+// at_least_one_scoped_name ')'
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpGetRaiseQsSeen);
+ tao_yyval.nlval = tao_yyvsp[-1].nlval;
+ }
+ break;
+
+ case 375:
+
+ {
+ tao_yyval.nlval = 0;
+/* | EMPTY */
+ }
+ break;
+
+ case 376:
+
+ {
+// opt_setraises : IDL_SETRAISES
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpSetRaiseSeen);
+ }
+ break;
+
+ case 377:
+
+ {
+// '('
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpSetRaiseSqSeen);
+ }
+ break;
+
+ case 378:
+
+ {
+// at_least_one_scoped_name ')'
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpSetRaiseQsSeen);
+ tao_yyval.nlval = tao_yyvsp[-1].nlval;
+ }
+ break;
+
+ case 379:
+
+ {
+ tao_yyval.nlval = 0;
+/* | EMPTY */
+ }
+ break;
+
+ case 380:
+
+ {
+// opt_context : IDL_CONTEXT
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpContextSeen);
+ }
+ break;
+
+ case 381:
+
+ {
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpContextSqSeen);
+// '('
+ }
+ break;
+
+ case 382:
+
+ {
+// at_least_one_string_literal ')'
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpContextQsSeen);
+ tao_yyval.slval = tao_yyvsp[-1].slval;
+ }
+ break;
+
+ case 383:
+
+ {
+/* | EMPTY */
+ tao_yyval.slval = 0;
+ }
+ break;
+
+ case 384:
+
+ {
+// 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 385:
+
+ {
+// string_literals : string_literals ','
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpContextCommaSeen);
+ }
+ break;
+
+ case 386:
+
+ {
+// IDL_STRING_LITERAL
+ if (tao_yyvsp[-3].slval == 0)
+ {
+ 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 387:
+
+ {
+/* | EMPTY */
+ tao_yyval.slval = 0;
+ }
+ break;
+
+ case 388:
+
+ {
+// 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,
+ 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 ()
+ );
+ }
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].sval->destroy ();
+ delete tao_yyvsp[0].sval;
+ tao_yyvsp[0].sval = 0;
+ }
+ break;
+
+ case 389:
+
+ {
+// typeprefix_dcl : IDL_TYPEPREFIX scoped_name IDL_STRING_LITERAL
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = ScopeAsDecl (s);
+
+ // If we are in a module, we want to avoid a lookup unless the
+ // typeprefix is to be applied to some other scope, since we
+ // might get a previous opening of the module, and the prefix
+ // of this opening would never get checked or set.
+ if (d->name ()->compare (tao_yyvsp[-1].idlist) != 0)
+ {
+ d = s->lookup_by_name (tao_yyvsp[-1].idlist,
+ 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 ()
+ );
+ }
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].sval->destroy ();
+ delete tao_yyvsp[0].sval;
+ tao_yyvsp[0].sval = 0;
+ }
+ break;
+
+ case 392:
+
+ {
+// 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);
+ }
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+ }
+ break;
+
+ case 393:
+
+ {
+// 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->destroy ();
+ delete tao_yyvsp[0].chval;
+ tao_yyvsp[0].chval = 0;
+ }
+
+ /*
+ * Push it on the scope stack.
+ */
+ idl_global->scopes ().push (c);
+ }
+ break;
+
+ case 394:
+
+ {
+// '{'
+ idl_global->set_parse_state (IDL_GlobalData::PS_ComponentSqSeen);
+ }
+ break;
+
+ case 395:
+
+ {
+// component_exports
+ idl_global->set_parse_state (IDL_GlobalData::PS_ComponentBodySeen);
+ }
+ break;
+
+ case 396:
+
+ {
+// '}'
+ 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 397:
+
+ {
+// id
+ idl_global->set_parse_state (IDL_GlobalData::PS_ComponentIDSeen);
+ }
+ break;
+
+ case 398:
+
+ {
+// component_inheritance_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
+ }
+ break;
+
+ case 399:
+
+ {
+// 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 = 0;
+ ACE_NEW_RETURN (n,
+ UTL_ScopedName (tao_yyvsp[-4].idval, 0),
+ 1);
+ ACE_NEW_RETURN (tao_yyval.chval,
+ FE_ComponentHeader (n,
+ tao_yyvsp[-2].idlist,
+ tao_yyvsp[0].nlval,
+ false),
+ 1);
+
+ if (0 != tao_yyvsp[0].nlval)
+ {
+ tao_yyvsp[0].nlval->destroy ();
+ delete tao_yyvsp[0].nlval;
+ tao_yyvsp[0].nlval = 0;
+ }
+
+ if (0 != tao_yyvsp[-2].idlist)
+ {
+ tao_yyvsp[-2].idlist->destroy ();
+ delete tao_yyvsp[-2].idlist;
+ tao_yyvsp[-2].idlist = 0;
+ }
+ }
+ break;
+
+ case 400:
+
+ {
+// component_inheritance_spec : ':'
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen);
+ }
+ break;
+
+ case 401:
+
+ {
+// scoped_name
+ tao_yyval.idlist = tao_yyvsp[0].idlist;
+ }
+ break;
+
+ case 402:
+
+ {
+/* | EMPTY */
+ tao_yyval.idlist = 0;
+ }
+ break;
+
+ case 405:
+
+ {
+// component_export : provides_decl
+ idl_global->set_parse_state (IDL_GlobalData::PS_ProvidesDeclSeen);
+ }
+ break;
+
+ case 406:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 407:
+
+ {
+// | uses_decl
+ idl_global->set_parse_state (IDL_GlobalData::PS_UsesDeclSeen);
+ }
+ break;
+
+ case 408:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 409:
+
+ {
+// | emits_decl
+ idl_global->set_parse_state (IDL_GlobalData::PS_EmitsDeclSeen);
+ }
+ break;
+
+ case 410:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 411:
+
+ {
+// | publishes_decl
+ idl_global->set_parse_state (IDL_GlobalData::PS_PublishesDeclSeen);
+ }
+ break;
+
+ case 412:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 413:
+
+ {
+// | consumes_decl
+ idl_global->set_parse_state (IDL_GlobalData::PS_ConsumesDeclSeen);
+ }
+ break;
+
+ case 414:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 415:
+
+ {
+// | attribute
+ idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclSeen);
+ }
+ break;
+
+ case 416:
+
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 417:
+
+ {
+// 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_Decl *d = s->lookup_by_name (tao_yyvsp[-1].idlist,
+ true);
+ if (0 == d)
+ {
+ idl_global->err ()->lookup_error (tao_yyvsp[-1].idlist);
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
+ break;
+ }
+ else if (d->node_type () != AST_Decl::NT_interface)
+ {
+ // Nothing else but CORBA::Object can have
+ // this identifier.
+ if (ACE_OS::strcmp (d->local_name ()->get_string (),
+ "Object")
+ != 0)
+ {
+ idl_global->err ()->interface_expected (d);
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
+ break;
+ }
+ }
+
+ AST_Type *interface_type =
+ AST_Type::narrow_from_decl (d);
+
+ AST_Component::port_description pd;
+ pd.id = tao_yyvsp[0].idval;
+ pd.impl = interface_type;
+ c->provides ().enqueue_tail (pd);
+ }
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+ }
+ break;
+
+ case 418:
+
+ {
+// interface_type : scoped_name
+ // Lookups and checking are done where the 'interface_type'
+ // token is used, in 'provides_decl' and 'uses_decl'.
+ tao_yyval.idlist = tao_yyvsp[0].idlist;
+ }
+ break;
+
+ case 419:
+
+ {
+// | 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 420:
+
+ {
+// uses_decl : IDL_USES opt_multiple interface_type id
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = s->lookup_by_name (tao_yyvsp[-1].idlist,
+ true);
+
+ if (0 == d)
+ {
+ idl_global->err ()->lookup_error (tao_yyvsp[-1].idlist);
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
+ break;
+ }
+ else if (d->node_type () != AST_Decl::NT_interface)
+ {
+ if (ACE_OS::strcmp (d->local_name ()->get_string (),
+ "Object")
+ != 0)
+ {
+ idl_global->err ()->interface_expected (d);
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
+ break;
+ }
+ }
+
+ AST_Type *interface_type = AST_Type::narrow_from_decl (d);
+ AST_Component *c = AST_Component::narrow_from_scope (s);
+
+ if (c != 0)
+ {
+ AST_Component::port_description ud;
+ ud.id = tao_yyvsp[0].idval;
+ ud.impl = interface_type;
+ ud.is_multiple = tao_yyvsp[-2].bval;
+ c->uses ().enqueue_tail (ud);
+
+ if (ud.is_multiple == true
+ && !idl_global->using_ifr_backend ()
+ && !idl_global->ignore_idl3 ())
+ {
+ // These datatypes must be created in the
+ // front end so they can be looked up
+ // when compiling the generated executor IDL.
+ idl_global->create_uses_multiple_stuff (c, ud);
+ }
+ }
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+ }
+ break;
+
+ case 421:
+
+ {
+// opt_multiple : IDL_MULTIPLE
+ tao_yyval.bval = true;
+ }
+ break;
+
+ case 422:
+
+ {
+/* | EMPTY */
+ tao_yyval.bval = false;
+ }
+ break;
+
+ case 423:
+
+ {
+// 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,
+ true);
+
+ if (0 == d)
+ {
+ idl_global->err ()->lookup_error (tao_yyvsp[-1].idlist);
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
+ break;
+ }
+ else if (d->node_type () != AST_Decl::NT_eventtype)
+ {
+ idl_global->err ()->eventtype_expected (d);
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
+ break;
+ }
+ else
+ {
+ AST_Type *event_type = AST_Type::narrow_from_decl (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 = event_type;
+ c->emits ().enqueue_tail (pd);
+ }
+ }
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+ }
+ break;
+
+ case 424:
+
+ {
+// 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,
+ true);
+
+ if (0 == d)
+ {
+ idl_global->err ()->lookup_error (tao_yyvsp[-1].idlist);
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
+ break;
+ }
+ else if (d->node_type () != AST_Decl::NT_eventtype)
+ {
+ idl_global->err ()->eventtype_expected (d);
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
+ break;
+ }
+ else
+ {
+ AST_Type *event_type = AST_Type::narrow_from_decl (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 = event_type;
+ c->publishes ().enqueue_tail (pd);
+ }
+ }
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+ }
+ break;
+
+ case 425:
+
+ {
+// 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,
+ true);
+
+ if (0 == d)
+ {
+ idl_global->err ()->lookup_error (tao_yyvsp[-1].idlist);
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
+ break;
+ }
+ else if (d->node_type () != AST_Decl::NT_eventtype)
+ {
+ idl_global->err ()->eventtype_expected (d);
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
+ break;
+ }
+ else
+ {
+ AST_Type *event_type = AST_Type::narrow_from_decl (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 = event_type;
+ c->consumes ().enqueue_tail (pd);
+ }
+ }
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+ }
+ break;
+
+ case 426:
+
+ {
+// 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->destroy ();
+ delete tao_yyvsp[0].hhval;
+ tao_yyvsp[0].hhval = 0;
+ }
+
+ /*
+ * Push it on the scope stack.
+ */
+ idl_global->scopes ().push (h);
+ }
+ break;
+
+ case 427:
+
+ {
+// home_body
+ /*
+ * Done with this component - pop it off the scopes stack.
+ */
+ idl_global->scopes ().pop ();
+ }
+ break;
+
+ case 428:
+
+ {
+// home_header : IDL_HOME
+ idl_global->set_parse_state (IDL_GlobalData::PS_HomeSeen);
+ }
+ break;
+
+ case 429:
+
+ {
+// id
+ idl_global->set_parse_state (IDL_GlobalData::PS_HomeIDSeen);
+ }
+ break;
+
+ case 430:
+
+ {
+// home_inheritance_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
+ }
+ break;
+
+ case 431:
+
+ {
+// supports_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
+ }
+ break;
+
+ case 432:
+
+ {
+// IDL_MANAGES
+ idl_global->set_parse_state (IDL_GlobalData::PS_ManagesSeen);
+ }
+ break;
+
+ case 433:
+
+ {
+// scoped_name
+ idl_global->set_parse_state (IDL_GlobalData::PS_ManagesIDSeen);
+ }
+ break;
+
+ case 434:
+
+ {
+// 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 = 0;
+ ACE_NEW_RETURN (n,
+ UTL_ScopedName (tao_yyvsp[-10].idval, 0),
+ 1);
+ 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);
+
+ tao_yyvsp[-2].idlist->destroy ();
+ delete tao_yyvsp[-2].idlist;
+ tao_yyvsp[-2].idlist = 0;
+
+ if (0 != tao_yyvsp[-8].idlist)
+ {
+ tao_yyvsp[-8].idlist->destroy ();
+ delete tao_yyvsp[-8].idlist;
+ tao_yyvsp[-8].idlist = 0;
+ }
+
+ if (0 != tao_yyvsp[0].idlist)
+ {
+ tao_yyvsp[0].idlist->destroy ();
+ delete tao_yyvsp[0].idlist;
+ tao_yyvsp[0].idlist = 0;
+ }
+
+ if (0 != tao_yyvsp[-6].nlval)
+ {
+ tao_yyvsp[-6].nlval->destroy ();
+ delete tao_yyvsp[-6].nlval;
+ tao_yyvsp[-6].nlval = 0;
+ }
+ }
+ break;
+
+ case 435:
+
+ {
+// home_inheritance_spec ':'
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen);
+ }
+ break;
+
+ case 436:
+
+ {
+// scoped_name
+ tao_yyval.idlist = tao_yyvsp[0].idlist;
+ }
+ break;
+
+ case 437:
+
+ {
+/* | EMPTY */
+ tao_yyval.idlist = 0;
+ }
+ break;
+
+ case 438:
+
+ {
+// primary_key_spec : IDL_PRIMARYKEY scoped_name
+ tao_yyval.idlist = tao_yyvsp[0].idlist;
+ }
+ break;
+
+ case 439:
+
+ {
+/* | EMPTY */
+ tao_yyval.idlist = 0;
+ }
+ break;
+
+ case 440:
+
+ {
+// home_body : '{'
+ idl_global->set_parse_state (IDL_GlobalData::PS_HomeSqSeen);
+ }
+ break;
+
+ case 441:
+
+ {
+// home_exports
+ idl_global->set_parse_state (IDL_GlobalData::PS_HomeBodySeen);
+ }
+ break;
+
+ case 442:
+
+ {
+// '}'
+ idl_global->set_parse_state (IDL_GlobalData::PS_HomeQsSeen);
+ }
+ break;
+
+ case 446:
+
+ {
+// home_export : factory_decl
+ idl_global->set_parse_state (IDL_GlobalData::PS_FactoryDeclSeen);
+ }
+ break;
+
+ case 447:
+
+ {
+// | ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 448:
+
+ {
+// | finder_decl
+ idl_global->set_parse_state (IDL_GlobalData::PS_FinderDeclSeen);
+ }
+ break;
+
+ case 449:
+
+ {
+// | ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ break;
+
+ case 450:
+
+ {
+// 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);
+ o =
+ idl_global->gen ()->create_operation (
+ home->managed_component (),
+ AST_Operation::OP_noflags,
+ &n,
+ false,
+ false
+ );
+ home->factories ().enqueue_tail (o);
+ }
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
+ /*
+ * Push the operation scope onto the scopes stack.
+ */
+ idl_global->scopes ().push (o);
+ }
+ break;
+
+ case 451:
+
+ {
+// init_parameter_list
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
+ }
+ break;
+
+ case 452:
+
+ {
+// opt_raises
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Operation *o = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
+
+ /*
+ * 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 (tao_yyvsp[0].nlval != 0 && o != 0)
+ {
+ (void) o->fe_add_exceptions (tao_yyvsp[0].nlval);
+ }
+ }
+
+ /*
+ * Done with this operation. Pop its scope from the scopes stack.
+ */
+ idl_global->scopes ().pop ();
+ }
+ break;
+
+ case 453:
+
+ {
+// 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);
+ o =
+ idl_global->gen ()->create_operation (
+ home->managed_component (),
+ AST_Operation::OP_noflags,
+ &n,
+ false,
+ false
+ );
+ home->finders ().enqueue_tail (o);
+ }
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
+ /*
+ * Push the operation scope onto the scopes stack.
+ */
+ idl_global->scopes ().push (o);
+ }
+ break;
+
+ case 454:
+
+ {
+// init_parameter_list
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
+ }
+ break;
+
+ case 455:
+
+ {
+// opt_raises
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Operation *o = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
+
+ /*
+ * 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 (tao_yyvsp[0].nlval != 0 && o != 0)
+ {
+ (void) o->fe_add_exceptions (tao_yyvsp[0].nlval);
+ }
+ }
+
+ /*
+ * Done with this operation. Pop its scope from the scopes stack.
+ */
+ idl_global->scopes ().pop ();
+ }
+ break;
+
+ case 461:
+
+ {
+// event_concrete_forward_decl : IDL_EVENTTYPE id
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n (tao_yyvsp[0].idval,
+ 0);
+ AST_EventTypeFwd *f = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeForwardSeen);
+
+ /*
+ * Create a node representing a forward declaration of an
+ * eventtype. Store it in the enclosing scope
+ */
+ if (s != 0)
+ {
+ f = idl_global->gen ()->create_eventtype_fwd (&n,
+ false);
+ (void) s->fe_add_valuetype_fwd (f);
+ }
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+ }
+ break;
+
+ case 462:
+
+ {
+// event_abs_forward_decl : IDL_ABSTRACT IDL_EVENTTYPE id
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n (tao_yyvsp[0].idval,
+ 0);
+ AST_EventTypeFwd *f = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeForwardSeen);
+
+ /*
+ * Create a node representing a forward declaration of an
+ * eventtype. Store it in the enclosing scope
+ */
+ if (s != 0)
+ {
+ f = idl_global->gen ()->create_eventtype_fwd (&n,
+ true);
+ (void) s->fe_add_valuetype_fwd (f);
+ }
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+ }
+ break;
+
+ case 463:
+
+ {
+// event_abs_decl : event_abs_header event_rest_of_header
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_EventType *e = 0;
+ AST_Interface *i = 0;
+
+ if (s != 0 && tao_yyvsp[-1].idval != 0)
+ {
+ UTL_ScopedName sn (tao_yyvsp[-1].idval,
+ 0);
+ e =
+ idl_global->gen ()->create_eventtype (
+ &sn,
+ tao_yyvsp[0].ehval->inherits (),
+ tao_yyvsp[0].ehval->n_inherits (),
+ tao_yyvsp[0].ehval->inherits_concrete (),
+ tao_yyvsp[0].ehval->inherits_flat (),
+ tao_yyvsp[0].ehval->n_inherits_flat (),
+ tao_yyvsp[0].ehval->supports (),
+ tao_yyvsp[0].ehval->n_supports (),
+ tao_yyvsp[0].ehval->supports_concrete (),
+ true,
+ false,
+ false
+ );
+ i = AST_Interface::narrow_from_decl (e);
+ AST_Interface::fwd_redefinition_helper (i,
+ s);
+ /*
+ * Add the eventetype to its definition scope
+ */
+ e = AST_EventType::narrow_from_decl (i);
+ (void) s->fe_add_eventtype (e);
+ }
+
+ /*
+ * Push it on the scope stack.
+ */
+ idl_global->scopes ().push (e);
+
+ tao_yyvsp[-1].idval->destroy ();
+ delete tao_yyvsp[-1].idval;
+ tao_yyvsp[-1].idval = 0;
+ }
+ break;
+
+ case 464:
+
+ {
+// '{'
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeSqSeen);
+ }
+ break;
+
+ case 465:
+
+ {
+// exports
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeBodySeen);
+ }
+ break;
+
+ case 466:
+
+ {
+// '}'
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeQsSeen);
+
+ /*
+ * Done with this eventtype - pop it off the scopes stack.
+ */
+ idl_global->scopes ().pop ();
+ }
+ break;
+
+ case 467:
+
+ {
+// event_abs_header : IDL_ABSTRACT IDL_EVENTTYPE id
+ tao_yyval.idval = tao_yyvsp[0].idval;
+ }
+ break;
+
+ case 468:
+
+ {
+// event_custom_header : IDL_CUSTOM IDL_EVENTTYPE id
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeIDSeen);
+
+ 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")
+ ACE_TEXT (" custom yet\n")));
+ tao_yyval.idval = 0;
+ }
+ break;
+
+ case 469:
+
+ {
+// event_plain_header : IDL_EVENTTYPE id
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeIDSeen);
+
+ tao_yyval.idval = tao_yyvsp[0].idval;
+ }
+ break;
+
+ case 470:
+
+ {
+// event_rest_of_header : inheritance_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
+
+ }
+ break;
+
+ case 471:
+
+ {
+// supports_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
+
+ ACE_NEW_RETURN (tao_yyval.ehval,
+ FE_EventHeader (
+ 0,
+ tao_yyvsp[-2].nlval,
+ tao_yyvsp[0].nlval,
+ tao_yyvsp[-2].nlval
+ ? tao_yyvsp[-2].nlval->truncatable ()
+ : false
+ ),
+ 1);
+
+ if (0 != tao_yyvsp[0].nlval)
+ {
+ tao_yyvsp[0].nlval->destroy ();
+ delete tao_yyvsp[0].nlval;
+ tao_yyvsp[0].nlval = 0;
+ }
+
+ if (0 != tao_yyvsp[-2].nlval)
+ {
+ tao_yyvsp[-2].nlval->destroy ();
+ delete tao_yyvsp[-2].nlval;
+ tao_yyvsp[-2].nlval = 0;
+ }
+ }
+ break;
+
+ case 472:
+
+ {
+// event_decl : event_header event_rest_of_header
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_EventType *e = 0;
+ AST_Interface *i = 0;
+
+ if (s != 0 && tao_yyvsp[-1].idval != 0)
+ {
+ // We create the scoped name here instead of with the
+ // FE_EventHeader because there is a token for it only here.
+ UTL_ScopedName sn (tao_yyvsp[-1].idval,
+ 0);
+ e =
+ idl_global->gen ()->create_eventtype (
+ &sn,
+ tao_yyvsp[0].ehval->inherits (),
+ tao_yyvsp[0].ehval->n_inherits (),
+ tao_yyvsp[0].ehval->inherits_concrete (),
+ tao_yyvsp[0].ehval->inherits_flat (),
+ tao_yyvsp[0].ehval->n_inherits_flat (),
+ tao_yyvsp[0].ehval->supports (),
+ tao_yyvsp[0].ehval->n_supports (),
+ tao_yyvsp[0].ehval->supports_concrete (),
+ false,
+ tao_yyvsp[0].ehval->truncatable (),
+ false
+ );
+ i = AST_Interface::narrow_from_decl (e);
+ AST_Interface::fwd_redefinition_helper (i,
+ s);
+ /*
+ * Add the eventetype to its definition scope
+ */
+ e = AST_EventType::narrow_from_decl (i);
+ (void) s->fe_add_eventtype (e);
+
+ // FE_EventHeader is not automatically destroyed in the AST
+ tao_yyvsp[0].ehval->destroy ();
+ delete tao_yyvsp[0].ehval;
+ tao_yyvsp[0].ehval = 0;
+
+ sn.destroy ();
+ }
+
+ /*
+ * Push it on the scope stack.
+ */
+ idl_global->scopes ().push (e);
+ }
+ break;
+
+ case 473:
+
+ {
+// '{'
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeSqSeen);
+ }
+ break;
+
+ case 474:
+
+ {
+// value_elements
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeBodySeen);
+ }
+ break;
+
+ case 475:
+
+ {
+// '}'
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeQsSeen);
+
+ /*
+ * Done with this eventtype - pop it off the scopes stack.
+ */
+ idl_global->scopes ().pop ();
+ }
+ break;
+
+ case 476:
+
+ {
+// event_header : event_custom_header
+ tao_yyval.idval = tao_yyvsp[0].idval;
+ }
+ break;
+
+ case 477:
+
+ {
+// event_header : event_plain_header
+ tao_yyval.idval = tao_yyvsp[0].idval;
+ }
+ break;
+
+
+ }
+
+/* Line 993 of yacc.c. */
+
+
+ tao_yyvsp -= tao_yylen;
+ tao_yyssp -= tao_yylen;
+
+
+ TAO_YY_STACK_PRINT (tao_yyss, tao_yyssp);
+
+ *++tao_yyvsp = tao_yyval;
+
+
+ /* Now `shift' the result of the reduction. Determine what state
+ that goes to, based on the state we popped back to and the rule
+ number reduced by. */
+
+ tao_yyn = tao_yyr1[tao_yyn];
+
+ tao_yystate = tao_yypgoto[tao_yyn - TAO_YYNTOKENS] + *tao_yyssp;
+ if (0 <= tao_yystate && tao_yystate <= TAO_YYLAST && tao_yycheck[tao_yystate] == *tao_yyssp)
+ tao_yystate = tao_yytable[tao_yystate];
+ else
+ tao_yystate = tao_yydefgoto[tao_yyn - TAO_YYNTOKENS];
+
+ goto tao_yynewstate;
+
+
+/*------------------------------------.
+| tao_yyerrlab -- here on detecting error |
+`------------------------------------*/
+tao_yyerrlab:
+ /* If not already recovering from an error, report this error. */
+ if (!tao_yyerrstatus)
+ {
+ ++tao_yynerrs;
+#if TAO_YYERROR_VERBOSE
+ tao_yyn = tao_yypact[tao_yystate];
+
+ if (TAO_YYPACT_NINF < tao_yyn && tao_yyn < TAO_YYLAST)
+ {
+ TAO_YYSIZE_T tao_yysize = 0;
+ int tao_yytype = TAO_YYTRANSLATE (tao_yychar);
+ const char* tao_yyprefix;
+ char *tao_yymsg;
+ int tao_yyx;
+
+ /* Start TAO_YYX at -TAO_YYN if negative to avoid negative indexes in
+ TAO_YYCHECK. */
+ int tao_yyxbegin = tao_yyn < 0 ? -tao_yyn : 0;
+
+ /* Stay within bounds of both tao_yycheck and tao_yytname. */
+ int tao_yychecklim = TAO_YYLAST - tao_yyn;
+ int tao_yyxend = tao_yychecklim < TAO_YYNTOKENS ? tao_yychecklim : TAO_YYNTOKENS;
+ int tao_yycount = 0;
+
+ tao_yyprefix = ", expecting ";
+ for (tao_yyx = tao_yyxbegin; tao_yyx < tao_yyxend; ++tao_yyx)
+ if (tao_yycheck[tao_yyx + tao_yyn] == tao_yyx && tao_yyx != TAO_YYTERROR)
+ {
+ tao_yysize += tao_yystrlen (tao_yyprefix) + tao_yystrlen (tao_yytname [tao_yyx]);
+ tao_yycount += 1;
+ if (tao_yycount == 5)
+ {
+ tao_yysize = 0;
+ break;
+ }
+ }
+ tao_yysize += (sizeof ("syntax error, unexpected ")
+ + tao_yystrlen (tao_yytname[tao_yytype]));
+ tao_yymsg = (char *) TAO_YYSTACK_ALLOC (tao_yysize);
+ if (tao_yymsg != 0)
+ {
+ char *tao_yyp = tao_yystpcpy (tao_yymsg, "syntax error, unexpected ");
+ tao_yyp = tao_yystpcpy (tao_yyp, tao_yytname[tao_yytype]);
+
+ if (tao_yycount < 5)
+ {
+ tao_yyprefix = ", expecting ";
+ for (tao_yyx = tao_yyxbegin; tao_yyx < tao_yyxend; ++tao_yyx)
+ if (tao_yycheck[tao_yyx + tao_yyn] == tao_yyx && tao_yyx != TAO_YYTERROR)
+ {
+ tao_yyp = tao_yystpcpy (tao_yyp, tao_yyprefix);
+ tao_yyp = tao_yystpcpy (tao_yyp, tao_yytname[tao_yyx]);
+ tao_yyprefix = " or ";
+ }
+ }
+ tao_yyerror (tao_yymsg);
+ TAO_YYSTACK_FREE (tao_yymsg);
+ }
+ else
+ tao_yyerror ("syntax error; also virtual memory exhausted");
+ }
+ else
+#endif /* TAO_YYERROR_VERBOSE */
+ tao_yyerror ("syntax error");
+ }
+
+
+
+ if (tao_yyerrstatus == 3)
+ {
+ /* If just tried and failed to reuse lookahead token after an
+ error, discard it. */
+
+ if (tao_yychar <= TAO_YYEOF)
+ {
+ /* If at end of input, pop the error token,
+ then the rest of the stack, then return failure. */
+ if (tao_yychar == TAO_YYEOF)
+ for (;;)
+ {
+ TAO_YYPOPSTACK;
+ if (tao_yyssp == tao_yyss)
+ TAO_YYABORT;
+ TAO_YYDSYMPRINTF ("Error: popping", tao_yystos[*tao_yyssp], tao_yyvsp, tao_yylsp);
+ tao_yydestruct (tao_yystos[*tao_yyssp], tao_yyvsp);
+ }
+ }
+ else
+ {
+ TAO_YYDSYMPRINTF ("Error: discarding", tao_yytoken, &tao_yylval, &tao_yylloc);
+ tao_yydestruct (tao_yytoken, &tao_yylval);
+ tao_yychar = TAO_YYEMPTY;
+
+ }
+ }
+
+ /* Else will try to reuse lookahead token after shifting the error
+ token. */
+ goto tao_yyerrlab1;
+
+
+/*---------------------------------------------------.
+| tao_yyerrorlab -- error raised explicitly by TAO_YYERROR. |
+`---------------------------------------------------*/
+tao_yyerrorlab:
+
+#if defined (__GNUC__) || defined (WIN32) || defined (__HP_aCC)
+ /* Pacify GCC when the user code never invokes TAO_YYERROR and the label
+ tao_yyerrorlab therefore never appears in user code. */
+ if (0)
+ goto tao_yyerrorlab;
+#endif
+
+ tao_yyvsp -= tao_yylen;
+ tao_yyssp -= tao_yylen;
+ tao_yystate = *tao_yyssp;
+ goto tao_yyerrlab1;
+
+
+/*-------------------------------------------------------------.
+| tao_yyerrlab1 -- common code for both syntax error and TAO_YYERROR. |
+`-------------------------------------------------------------*/
+tao_yyerrlab1:
+ tao_yyerrstatus = 3; /* Each real token shifted decrements this. */
+
+ for (;;)
+ {
+ tao_yyn = tao_yypact[tao_yystate];
+ if (tao_yyn != TAO_YYPACT_NINF)
+ {
+ tao_yyn += TAO_YYTERROR;
+ if (0 <= tao_yyn && tao_yyn <= TAO_YYLAST && tao_yycheck[tao_yyn] == TAO_YYTERROR)
+ {
+ tao_yyn = tao_yytable[tao_yyn];
+ if (0 < tao_yyn)
+ break;
+ }
+ }
+
+ /* Pop the current state because it cannot handle the error token. */
+ if (tao_yyssp == tao_yyss)
+ TAO_YYABORT;
+
+ TAO_YYDSYMPRINTF ("Error: popping", tao_yystos[*tao_yyssp], tao_yyvsp, tao_yylsp);
+ tao_yydestruct (tao_yystos[tao_yystate], tao_yyvsp);
+ TAO_YYPOPSTACK;
+ tao_yystate = *tao_yyssp;
+ TAO_YY_STACK_PRINT (tao_yyss, tao_yyssp);
+ }
+
+ if (tao_yyn == TAO_YYFINAL)
+ TAO_YYACCEPT;
+
+ TAO_YYDPRINTF ((stderr, "Shifting error token, "));
+
+ *++tao_yyvsp = tao_yylval;
+
+
+ tao_yystate = tao_yyn;
+ goto tao_yynewstate;
+
+
+/*-------------------------------------.
+| tao_yyacceptlab -- TAO_YYACCEPT comes here. |
+`-------------------------------------*/
+tao_yyacceptlab:
+ tao_yyresult = 0;
+ goto tao_yyreturn;
+
+/*-----------------------------------.
+| tao_yyabortlab -- TAO_YYABORT comes here. |
+`-----------------------------------*/
+tao_yyabortlab:
+ tao_yyresult = 1;
+ goto tao_yyreturn;
+
+#ifndef tao_yyoverflow
+/*----------------------------------------------.
+| tao_yyoverflowlab -- parser overflow comes here. |
+`----------------------------------------------*/
+tao_yyoverflowlab:
+ tao_yyerror ("parser stack overflow");
+ tao_yyresult = 2;
+ /* Fall through. */
+#endif
+
+tao_yyreturn:
+#ifndef tao_yyoverflow
+ if (tao_yyss != tao_yyssa)
+ TAO_YYSTACK_FREE (tao_yyss);
+#endif
+ return tao_yyresult;
+}
+
+
+
+
+/* programs */
+
+/*
+ * ???
+ */
+int
+tao_yywrap (void)
+{
+ return 1;
+}
+
+/*
+ * Report an error situation discovered in a production
+ */
+void
+tao_yyerror (const char *msg)
+{
+ ACE_ERROR ((LM_ERROR,
+ "%s\n",
+ msg));
+}
diff --git a/TAO/TAO_IDL/fe/y.tab.cpp.diff b/TAO/TAO_IDL/fe/y.tab.cpp.diff
new file mode 100644
index 00000000000..06b126a08d5
--- /dev/null
+++ b/TAO/TAO_IDL/fe/y.tab.cpp.diff
@@ -0,0 +1,38 @@
+--- y.tab.cpp.orig 2005-01-28 10:00:07.000000000 -0600
++++ y.tab.cpp 2005-01-28 10:07:56.000000000 -0600
+@@ -1759,11 +1759,6 @@
+ else
+ TAO_YYFPRINTF (tao_yyoutput, "nterm %s (", tao_yytname[tao_yytype]);
+
+- switch (tao_yytype)
+- {
+- default:
+- break;
+- }
+ TAO_YYFPRINTF (tao_yyoutput, ")");
+ }
+
+@@ -1778,14 +1778,9 @@
+ #endif
+ {
+ /* Pacify ``unused variable'' warnings. */
++ (void) tao_yytype;
+ (void) tao_yyvaluep;
+
+- switch (tao_yytype)
+- {
+-
+- default:
+- break;
+- }
+ }
+
+@@ -8147,7 +8147,7 @@
+ `---------------------------------------------------*/
+ tao_yyerrorlab:
+
+-#ifdef __GNUC__
++#if defined (__GNUC__) || defined (WIN32) || defined (__HP_aCC)
+ /* Pacify GCC when the user code never invokes TAO_YYERROR and the label
+ tao_yyerrorlab therefore never appears in user code. */
+ if (0)
diff --git a/TAO/TAO_IDL/fe/y.tab.h b/TAO/TAO_IDL/fe/y.tab.h
new file mode 100644
index 00000000000..283775bd192
--- /dev/null
+++ b/TAO/TAO_IDL/fe/y.tab.h
@@ -0,0 +1,236 @@
+// $Id$
+/* A Bison parser, made by GNU Bison 1.875c. */
+
+/* Skeleton parser for Yacc-like parsing with Bison,
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/* As a special exception, when this file is copied by Bison into a
+ Bison output file, you may use that output file without restriction.
+ This special exception was added by the Free Software Foundation
+ in version 1.24 of Bison. */
+
+/* Tokens. */
+#ifndef TAO_YYTOKENTYPE
+# define TAO_YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum tao_yytokentype {
+ IDENTIFIER = 258,
+ IDL_CONST = 259,
+ IDL_MODULE = 260,
+ IDL_INTERFACE = 261,
+ IDL_TYPEDEF = 262,
+ IDL_LONG = 263,
+ IDL_SHORT = 264,
+ IDL_UNSIGNED = 265,
+ IDL_DOUBLE = 266,
+ IDL_FLOAT = 267,
+ IDL_CHAR = 268,
+ IDL_WCHAR = 269,
+ IDL_OCTET = 270,
+ IDL_BOOLEAN = 271,
+ IDL_FIXED = 272,
+ IDL_ANY = 273,
+ IDL_OBJECT = 274,
+ IDL_STRUCT = 275,
+ IDL_UNION = 276,
+ IDL_SWITCH = 277,
+ IDL_ENUM = 278,
+ IDL_SEQUENCE = 279,
+ IDL_STRING = 280,
+ IDL_WSTRING = 281,
+ IDL_EXCEPTION = 282,
+ IDL_CASE = 283,
+ IDL_DEFAULT = 284,
+ IDL_READONLY = 285,
+ IDL_ATTRIBUTE = 286,
+ IDL_ONEWAY = 287,
+ IDL_IDEMPOTENT = 288,
+ IDL_VOID = 289,
+ IDL_IN = 290,
+ IDL_OUT = 291,
+ IDL_INOUT = 292,
+ IDL_RAISES = 293,
+ IDL_CONTEXT = 294,
+ IDL_NATIVE = 295,
+ IDL_LOCAL = 296,
+ IDL_ABSTRACT = 297,
+ IDL_CUSTOM = 298,
+ IDL_FACTORY = 299,
+ IDL_PRIVATE = 300,
+ IDL_PUBLIC = 301,
+ IDL_SUPPORTS = 302,
+ IDL_TRUNCATABLE = 303,
+ IDL_VALUETYPE = 304,
+ IDL_COMPONENT = 305,
+ IDL_CONSUMES = 306,
+ IDL_EMITS = 307,
+ IDL_EVENTTYPE = 308,
+ IDL_FINDER = 309,
+ IDL_GETRAISES = 310,
+ IDL_HOME = 311,
+ IDL_IMPORT = 312,
+ IDL_MULTIPLE = 313,
+ IDL_PRIMARYKEY = 314,
+ IDL_PROVIDES = 315,
+ IDL_PUBLISHES = 316,
+ IDL_SETRAISES = 317,
+ IDL_TYPEID = 318,
+ IDL_TYPEPREFIX = 319,
+ IDL_USES = 320,
+ IDL_MANAGES = 321,
+ IDL_INTEGER_LITERAL = 322,
+ IDL_UINTEGER_LITERAL = 323,
+ IDL_STRING_LITERAL = 324,
+ IDL_CHARACTER_LITERAL = 325,
+ IDL_FLOATING_PT_LITERAL = 326,
+ IDL_TRUETOK = 327,
+ IDL_FALSETOK = 328,
+ IDL_SCOPE_DELIMITOR = 329,
+ IDL_LEFT_SHIFT = 330,
+ IDL_RIGHT_SHIFT = 331,
+ IDL_WCHAR_LITERAL = 332,
+ IDL_WSTRING_LITERAL = 333
+ };
+#endif
+#define IDENTIFIER 258
+#define IDL_CONST 259
+#define IDL_MODULE 260
+#define IDL_INTERFACE 261
+#define IDL_TYPEDEF 262
+#define IDL_LONG 263
+#define IDL_SHORT 264
+#define IDL_UNSIGNED 265
+#define IDL_DOUBLE 266
+#define IDL_FLOAT 267
+#define IDL_CHAR 268
+#define IDL_WCHAR 269
+#define IDL_OCTET 270
+#define IDL_BOOLEAN 271
+#define IDL_FIXED 272
+#define IDL_ANY 273
+#define IDL_OBJECT 274
+#define IDL_STRUCT 275
+#define IDL_UNION 276
+#define IDL_SWITCH 277
+#define IDL_ENUM 278
+#define IDL_SEQUENCE 279
+#define IDL_STRING 280
+#define IDL_WSTRING 281
+#define IDL_EXCEPTION 282
+#define IDL_CASE 283
+#define IDL_DEFAULT 284
+#define IDL_READONLY 285
+#define IDL_ATTRIBUTE 286
+#define IDL_ONEWAY 287
+#define IDL_IDEMPOTENT 288
+#define IDL_VOID 289
+#define IDL_IN 290
+#define IDL_OUT 291
+#define IDL_INOUT 292
+#define IDL_RAISES 293
+#define IDL_CONTEXT 294
+#define IDL_NATIVE 295
+#define IDL_LOCAL 296
+#define IDL_ABSTRACT 297
+#define IDL_CUSTOM 298
+#define IDL_FACTORY 299
+#define IDL_PRIVATE 300
+#define IDL_PUBLIC 301
+#define IDL_SUPPORTS 302
+#define IDL_TRUNCATABLE 303
+#define IDL_VALUETYPE 304
+#define IDL_COMPONENT 305
+#define IDL_CONSUMES 306
+#define IDL_EMITS 307
+#define IDL_EVENTTYPE 308
+#define IDL_FINDER 309
+#define IDL_GETRAISES 310
+#define IDL_HOME 311
+#define IDL_IMPORT 312
+#define IDL_MULTIPLE 313
+#define IDL_PRIMARYKEY 314
+#define IDL_PROVIDES 315
+#define IDL_PUBLISHES 316
+#define IDL_SETRAISES 317
+#define IDL_TYPEID 318
+#define IDL_TYPEPREFIX 319
+#define IDL_USES 320
+#define IDL_MANAGES 321
+#define IDL_INTEGER_LITERAL 322
+#define IDL_UINTEGER_LITERAL 323
+#define IDL_STRING_LITERAL 324
+#define IDL_CHARACTER_LITERAL 325
+#define IDL_FLOATING_PT_LITERAL 326
+#define IDL_TRUETOK 327
+#define IDL_FALSETOK 328
+#define IDL_SCOPE_DELIMITOR 329
+#define IDL_LEFT_SHIFT 330
+#define IDL_RIGHT_SHIFT 331
+#define IDL_WCHAR_LITERAL 332
+#define IDL_WSTRING_LITERAL 333
+
+
+
+
+#if ! defined (TAO_YYSTYPE) && ! defined (TAO_YYSTYPE_IS_DECLARED)
+
+typedef union TAO_YYSTYPE {
+ AST_Decl *dcval; /* Decl value */
+ UTL_StrList *slval; /* String list */
+ UTL_NameList *nlval; /* Name list */
+ UTL_ExprList *elval; /* Expression list */
+ UTL_LabelList *llval; /* Label list */
+ UTL_DeclList *dlval; /* Declaration list */
+ FE_InterfaceHeader *ihval; /* Interface header */
+ FE_OBVHeader *vhval; /* Valuetype header */
+ FE_EventHeader *ehval; /* Event 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 */
+ AST_Field::Visibility vival; /* N/A, pub or priv */
+ AST_Expression::ExprType etval; /* Expression type */
+ AST_Argument::Direction dival; /* Argument direction */
+ AST_Operation::Flags ofval; /* Operation flags */
+ FE_Declarator *deval; /* Declarator value */
+ bool bval; /* Boolean value */
+ long ival; /* Long value */
+ idl_uns_long uival; /* Unsigned long value */
+ double dval; /* Double value */
+ float fval; /* Float value */
+ char cval; /* Char value */
+ ACE_CDR::WChar wcval; /* WChar value */
+ UTL_String *sval; /* String value */
+ char *wsval; /* WString value */
+ char *strval; /* char * value */
+ Identifier *idval; /* Identifier */
+ UTL_IdList *idlist; /* Identifier list */
+} TAO_YYSTYPE;
+/* Line 1275 of yacc.c. */
+
+# define tao_yystype TAO_YYSTYPE /* obsolescent; will be withdrawn */
+# define TAO_YYSTYPE_IS_DECLARED 1
+# define TAO_YYSTYPE_IS_TRIVIAL 1
+#endif
+
+extern TAO_YYSTYPE tao_yylval;
+
+
+
diff --git a/TAO/TAO_IDL/idl_specs/array.idl b/TAO/TAO_IDL/idl_specs/array.idl
new file mode 100644
index 00000000000..9a35397c1ba
--- /dev/null
+++ b/TAO/TAO_IDL/idl_specs/array.idl
@@ -0,0 +1,39 @@
+// $Id$
+
+typedef sequence<long,10> vec10;
+typedef char str22[22][2];
+typedef boolean boolarray[3][40];
+
+
+struct A {
+ long a1;
+ char a2[17];
+ char a3[10][2];
+// vec10 a3;
+};
+
+struct B {
+ long b1;
+ A b2;
+};
+
+struct C {
+ long c1;
+ long c2;
+};
+
+typedef A A_matrix[2][3][4];
+typedef B B_matrix[2][3][4];
+typedef C C_matrix[2][3][4];
+
+typedef A_matrix A_rmatrix[2][3][4][5];
+
+interface A_i {
+ A op(in A a1, inout A a2, out A a3);
+ str22 op2(in str22 a1, inout str22 a2, out str22 a3);
+ str22 op3(in short a1[3][4], inout short a2[3][4], out short a3[4][4]);
+ A_matrix op4(in A a1, inout A a2, out A a3);
+ attribute str22 attribute_array;
+ void foo(in any x[3], out any y[4], inout any z[3]);
+};
+
diff --git a/TAO/TAO_IDL/idl_specs/constant.idl b/TAO/TAO_IDL/idl_specs/constant.idl
new file mode 100644
index 00000000000..3ccded681e1
--- /dev/null
+++ b/TAO/TAO_IDL/idl_specs/constant.idl
@@ -0,0 +1,31 @@
+// $Id$
+
+const short l = 4;
+
+enum N { zero, un , deux, trois };
+
+exception E {
+ short cause ;
+ };
+
+module M {
+ const short l = 4;
+
+ enum N { zero, un , deux, trois };
+
+ exception E {
+ short cause ;
+ };
+
+ interface A {
+ const short l = 4;
+
+ enum N { zero, un , deux, trois };
+
+ exception E {
+ short cause ;
+ };
+ N foo(in N x, out N y, inout N z);
+ };
+};
+
diff --git a/TAO/TAO_IDL/idl_specs/dif2.idl b/TAO/TAO_IDL/idl_specs/dif2.idl
new file mode 100644
index 00000000000..b21c65d6d58
--- /dev/null
+++ b/TAO/TAO_IDL/idl_specs/dif2.idl
@@ -0,0 +1,50 @@
+// $Id$
+
+/* A test interface for DIF1 */
+
+interface ex1
+{
+ void op0();
+ float op1(in float f, out double d, inout long l);
+ double op2(in double d, out long l, inout short s);
+ long op3(in long l, out short s, inout unsigned long ul);
+ short op4(in short s, out unsigned long ul, inout unsigned short us);
+ unsigned long op5(inout unsigned long ul, in unsigned short us, out char c, in boolean b);
+ unsigned short op6(out unsigned short us, inout char c);
+};
+
+//interface ex3;
+
+interface ex2 : ex1
+{
+ // operations continued from ex1
+ char op7(in char c, out boolean b, inout octet o);
+ boolean op8(out boolean b, in octet o);
+ octet op9(inout octet o, out string s, in string <10> ls, inout long l);
+ string op10(in string s, out string <10> ls);
+ string <10> op11(inout string <10> ls, out long l);
+ long op12(in long l);
+// ex3 op13(Environment *ev);
+};
+
+interface ex3 : ex1
+{
+ // attributes
+ readonly attribute float float_attribute;
+ attribute double double_attribute;
+ readonly attribute long long_attribute;
+ attribute short short_attribute;
+ readonly attribute unsigned long unsigned_long_attribute;
+
+};
+
+interface ex4 : ex2, ex3
+{
+ attribute unsigned short unsigned_short_attribute;
+ readonly attribute char char_attribute;
+ attribute boolean boolean_attribute;
+ readonly attribute octet octet_attribute;
+ attribute string string_attribute;
+ readonly attribute string <10> limited_string_attribute;
+ readonly attribute ex4 an_object_attribute;
+};
diff --git a/TAO/TAO_IDL/idl_specs/inherit.idl b/TAO/TAO_IDL/idl_specs/inherit.idl
new file mode 100644
index 00000000000..390f8d7e98e
--- /dev/null
+++ b/TAO/TAO_IDL/idl_specs/inherit.idl
@@ -0,0 +1,19 @@
+// $Id$
+
+interface one {
+ void op_one();
+};
+interface two : one {
+ void op_two();
+};
+interface three : one {
+ void op_three();
+};
+interface four : two, three {
+ void op_four();
+};
+
+interface five : four, three, two {
+ void op_five();
+};
+
diff --git a/TAO/TAO_IDL/idl_specs/module.idl b/TAO/TAO_IDL/idl_specs/module.idl
new file mode 100644
index 00000000000..d40f45963a1
--- /dev/null
+++ b/TAO/TAO_IDL/idl_specs/module.idl
@@ -0,0 +1,22 @@
+// $Id$
+
+module mod1
+{
+ module mod2
+ {
+ interface ex1
+ {
+ attribute long l1;
+ readonly attribute long l2;
+
+ long m1(in long a);
+ };
+
+ interface ex2 : ex1
+ {
+ attribute long l3;
+
+ long m2(in long a, out long b);
+ };
+ };
+};
diff --git a/TAO/TAO_IDL/idl_specs/primtypes.idl b/TAO/TAO_IDL/idl_specs/primtypes.idl
new file mode 100644
index 00000000000..63c6a27d809
--- /dev/null
+++ b/TAO/TAO_IDL/idl_specs/primtypes.idl
@@ -0,0 +1,25 @@
+// $Id$
+
+interface ex1
+{
+ attribute long l1;
+ long m1(in long a);
+ ex1 mtypes(
+ in long a1, inout long a2, out long a3,
+ in unsigned long b1, inout unsigned long b2, out unsigned long b3,
+ in short c1,inout short c2, out short c3,
+ in unsigned short d1, inout unsigned short d2, out unsigned short d3,
+ in float e1, inout float e2, out float e3,
+ in double f1, inout double f2, out double f3,
+ in char g1, inout char g2, out char g3
+ );
+
+};
+
+interface ex2 : ex1
+{
+ readonly attribute long l2;
+
+ long m2(in long a, out long b);
+ void mv();
+};
diff --git a/TAO/TAO_IDL/idl_specs/sequence.idl b/TAO/TAO_IDL/idl_specs/sequence.idl
new file mode 100644
index 00000000000..7a86a2cf481
--- /dev/null
+++ b/TAO/TAO_IDL/idl_specs/sequence.idl
@@ -0,0 +1,27 @@
+// $Id$
+
+typedef sequence<long,10> vec10;
+typedef sequence<char,20> c20;
+typedef sequence<c20,23> cc23;
+typedef sequence<char,24> c24;
+typedef sequence< sequence<long,10>, 10> c30;
+struct TProgram {
+ string path;
+ sequence<string> argv;
+ sequence<string> envp;
+};
+
+struct foo {
+ long f1;
+ char f2;
+};
+
+typedef foo foo_ar[20];
+typedef sequence<foo> f_unbounded;
+typedef sequence<foo_ar> f_ar_unbounded;
+
+interface TestSeq {
+ attribute f_unbounded fattr;
+ typedef sequence<long,10> also_vec10;
+ vec10 op(in also_vec10 a, out vec10 b, inout sequence <long,10> c);
+};
diff --git a/TAO/TAO_IDL/idl_specs/simple.idl b/TAO/TAO_IDL/idl_specs/simple.idl
new file mode 100644
index 00000000000..b10cdd73668
--- /dev/null
+++ b/TAO/TAO_IDL/idl_specs/simple.idl
@@ -0,0 +1,18 @@
+// $Id$
+
+typedef sequence<long,10> vec10;
+
+exception simple_error {
+ long reason;
+};
+
+interface simple {
+ long op(in long a, out simple b, inout long c) raises (simple_error);
+};
+
+interface simple2 : simple {
+ exception simple2_error {
+ long reason2;
+ };
+ long op2(in long a, in simple b, out simple2 c) raises (simple2_error);
+};
diff --git a/TAO/TAO_IDL/idl_specs/simple2.idl b/TAO/TAO_IDL/idl_specs/simple2.idl
new file mode 100644
index 00000000000..8f9202f9485
--- /dev/null
+++ b/TAO/TAO_IDL/idl_specs/simple2.idl
@@ -0,0 +1,28 @@
+// $Id$
+
+#include "simple.idl"
+
+
+interface simple3 : simple2 {
+ exception OVERFLOW {
+ long a;
+ string msg;
+ };
+ exception UNDERFLOW {
+ long b;
+ string msg;
+ };
+ exception BADNUM {
+ vec10 c;
+ };
+ exception USERERROR {
+ any reason;
+ };
+ long op3(in long a, out simple3 b, out simple2 c, out simple d)
+ raises (OVERFLOW, UNDERFLOW, BADNUM);
+ any op4(in any x, inout any y, out any z)
+ raises(UNDERFLOW);
+
+ oneway void op5()
+ raises(USERERROR);
+};
diff --git a/TAO/TAO_IDL/idl_specs/struct.idl b/TAO/TAO_IDL/idl_specs/struct.idl
new file mode 100644
index 00000000000..a098efd9b12
--- /dev/null
+++ b/TAO/TAO_IDL/idl_specs/struct.idl
@@ -0,0 +1,54 @@
+// $Id$
+
+struct bar {
+ long b1;
+ long b2;
+ string<20> b3;
+};
+
+struct bar2 {
+ long b3;
+ bar b4;
+};
+
+struct bar3 {
+ long b1;
+ long b2;
+ long b3;
+};
+
+struct bar4 {
+ long b1;
+ bar2 b2;
+ long b3;
+ bar3 b4;
+ long b5;
+};
+
+
+interface foo {
+ long op(in bar a, out bar2 b);
+};
+interface foo2 : foo {
+ bar op2(in bar2 a);
+ long op3(in long a, out char b);
+};
+
+
+typedef unsigned short Coord;
+
+struct CellPos {
+ Coord row;
+ Coord col;
+};
+
+struct CellPos2 {
+ unsigned short row;
+ unsigned short col;
+};
+
+struct CellPos3 {
+ Coord row;
+ Coord col;
+ unsigned short col2;
+};
diff --git a/TAO/TAO_IDL/idl_specs/union.idl b/TAO/TAO_IDL/idl_specs/union.idl
new file mode 100644
index 00000000000..587dae3a9c9
--- /dev/null
+++ b/TAO/TAO_IDL/idl_specs/union.idl
@@ -0,0 +1,28 @@
+// $Id$
+
+struct Bar {
+ long b1;
+ char b2;
+};
+
+union Foo switch (long) {
+case 1: long x;
+case 2: Bar y;
+default: char z;
+};
+
+
+union Foo2 switch (char) {
+ case 'a': long x;
+ case 'b': Foo y;
+};
+
+interface a {
+ struct astruct {
+ Foo2 a1;
+ Foo a2;
+ Bar a3;
+ };
+ Foo2 opA(in astruct b);
+};
+
diff --git a/TAO/TAO_IDL/idl_specs/union2.idl b/TAO/TAO_IDL/idl_specs/union2.idl
new file mode 100644
index 00000000000..843980ac048
--- /dev/null
+++ b/TAO/TAO_IDL/idl_specs/union2.idl
@@ -0,0 +1,23 @@
+// $Id$
+
+enum FooDisc {
+ FOO1,
+ FOO2
+};
+union Foo switch (FooDisc) {
+case FOO1: long x;
+case FOO2: string y;
+default: char z;
+};
+
+
+struct Bar {
+ enum BarDisc {
+ BAR1,
+ BAR2
+ } kind;
+ union Foo switch (BarDisc) {
+ case BAR1: long x;
+ case BAR2: long y;
+ } addr;
+};
diff --git a/TAO/TAO_IDL/include/TAO_IDL_FE_Export.h b/TAO/TAO_IDL/include/TAO_IDL_FE_Export.h
new file mode 100644
index 00000000000..58b0d308ede
--- /dev/null
+++ b/TAO/TAO_IDL/include/TAO_IDL_FE_Export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_IDL_FE_EXPORT_H
+#define TAO_IDL_FE_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS)
+# if !defined (TAO_IDL_FE_HAS_DLL)
+# define TAO_IDL_FE_HAS_DLL 0
+# endif /* ! TAO_IDL_FE_HAS_DLL */
+#else
+# if !defined (TAO_IDL_FE_HAS_DLL)
+# define TAO_IDL_FE_HAS_DLL 1
+# endif /* ! TAO_IDL_FE_HAS_DLL */
+#endif
+
+#if defined (TAO_IDL_FE_HAS_DLL) && (TAO_IDL_FE_HAS_DLL == 1)
+# if defined (TAO_IDL_FE_BUILD_DLL)
+# define TAO_IDL_FE_Export ACE_Proper_Export_Flag
+# define TAO_IDL_FE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_IDL_FE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_IDL_FE_BUILD_DLL */
+# define TAO_IDL_FE_Export ACE_Proper_Import_Flag
+# define TAO_IDL_FE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_IDL_FE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_IDL_FE_BUILD_DLL */
+#else /* TAO_IDL_FE_HAS_DLL == 1 */
+# define TAO_IDL_FE_Export
+# define TAO_IDL_FE_SINGLETON_DECLARATION(T)
+# define TAO_IDL_FE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_IDL_FE_HAS_DLL == 1 */
+
+#endif /* TAO_IDL_FE_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/TAO_IDL/include/ast.h b/TAO/TAO_IDL/include/ast.h
new file mode 100644
index 00000000000..48036780f79
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast.h
@@ -0,0 +1,134 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _AST_AST_HH
+#define _AST_AST_HH
+
+// ast.h
+//
+// Defines the classes which constitute the agreement between the CFE
+// and BEs.
+
+/*
+** DEPENDENCIES: NONE
+**
+** USE: Included from idl.hh
+*/
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+#if defined(_MSC_VER)
+#pragma warning(push)
+# pragma warning (disable : 4250)
+#endif /* _MSC_VER */
+
+#include "ast_visitor.h" // abstract class ast_visitor
+
+#include "utl_scoped_name.h" // Define UTL_ScopedName
+
+#include "ast_decl.h" // class AST_Decl
+
+#include "ast_expression.h" // class AST_Expression
+
+#include "utl_scope.h" // class UTL_Scope
+
+#include "ast_type.h" // class AST_Type
+#include "ast_concrete_type.h" // class AST_ConcreteType
+#include "ast_predefined_type.h" // class AST_PredefinedType
+#include "ast_module.h" // class AST_Module
+#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
+#include "ast_operation.h" // class AST_Operation
+#include "ast_field.h" // class AST_Field
+#include "ast_argument.h" // class AST_Argument
+#include "ast_attribute.h" // class AST_Attribute
+#include "ast_union.h" // class AST_Union
+#include "ast_union_branch.h" // class AST_UnionBranch
+#include "ast_union_label.h" // class AST_UnionLabel
+#include "ast_constant.h" // class AST_Constant
+#include "ast_enum_val.h" // class AST_EnumVal
+#include "ast_array.h" // class AST_Array
+#include "ast_sequence.h" // class AST_Sequence
+#include "ast_string.h" // class AST_String
+#include "ast_typedef.h" // class AST_Typedef
+#include "ast_native.h" // class AST_Native
+#include "ast_factory.h" // class AST_Factory
+
+#include "utl_list.h" // class UTL_List
+#include "utl_strlist.h" // class UTL_StrList
+#include "utl_exprlist.h" // class UTL_ExprList
+
+#include "ast_generator.h" // class AST_Generator
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif // _AST_AST_HH
diff --git a/TAO/TAO_IDL/include/ast_argument.h b/TAO/TAO_IDL/include/ast_argument.h
new file mode 100644
index 00000000000..ef6fb1e66ef
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_argument.h
@@ -0,0 +1,122 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _AST_ARGUMENT_AST_ARGUMENT_HH
+#define _AST_ARGUMENT_AST_ARGUMENT_HH
+
+// Representation of argument to operation:
+// An argument is a field with a direction attached
+
+#include "ast_field.h"
+
+
+class TAO_IDL_FE_Export AST_Argument : public virtual AST_Field
+{
+public:
+ // Define enum with values denoting argument passing directions.
+ enum Direction
+ {
+ dir_IN = 0x01,
+ dir_OUT = 0x02,
+ dir_INOUT = 0x04
+ };
+
+ // Operations.
+
+ // Constructor(s).
+ AST_Argument (void);
+
+ AST_Argument (Direction direction,
+ AST_Type *ft,
+ UTL_ScopedName *n);
+
+ // Destructor.
+ virtual ~AST_Argument (void);
+
+ // Data Accessors.
+ Direction direction (void);
+
+ // Narrowing
+ DEF_NARROW_METHODS1(AST_Argument, AST_Field);
+ DEF_NARROW_FROM_DECL(AST_Argument);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+private:
+ // Data.
+
+ const Direction pd_direction;
+ // Argument direction
+};
+
+#endif // _AST_ARGUMENT_AST_ARGUMENT_HH
diff --git a/TAO/TAO_IDL/include/ast_array.h b/TAO/TAO_IDL/include/ast_array.h
new file mode 100644
index 00000000000..25985ee3a07
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_array.h
@@ -0,0 +1,153 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _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.
+
+class TAO_IDL_FE_Export AST_Array : public virtual AST_ConcreteType
+{
+public:
+ // Operations.
+
+ // Constructor(s).
+ AST_Array (void);
+
+ AST_Array (UTL_ScopedName *n,
+ unsigned long ndims,
+ UTL_ExprList *dims,
+ bool local,
+ bool abstract);
+
+ // Destructor.
+ virtual ~AST_Array (void);
+
+ // Data Accessors.
+
+ unsigned long n_dims (void);
+
+ AST_Expression **dims (void);
+ void set_dims (AST_Expression **,
+ unsigned long);
+
+ AST_Type *base_type (void) const;
+ void set_base_type (AST_Type *nbt);
+
+ // Recursively called on valuetype to check for legal use as
+ // a primary key. Overridden for valuetype, struct, sequence,
+ // union, array, typedef, and interface.
+ virtual bool legal_for_primary_key (void) const;
+
+ // Cleanup.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_Array, AST_ConcreteType);
+ DEF_NARROW_FROM_DECL(AST_Array);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // 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.
+
+ unsigned long pd_n_dims;
+ // How many dimensions?
+
+ AST_Expression **pd_dims;
+ // Their expressions.
+
+ AST_Type *pd_base_type;
+ // Base type of array.
+
+ bool owns_base_type_;
+ // If our base type is anonymous array or sequence, we're
+ // responsible for destroying it.
+
+private:
+
+ // Compute how many dimensions.
+ AST_Expression **compute_dims (UTL_ExprList *dims,
+ unsigned long ndims);
+};
+
+#endif // _AST_ARRAY_AST_ARRAY_HH
diff --git a/TAO/TAO_IDL/include/ast_attribute.h b/TAO/TAO_IDL/include/ast_attribute.h
new file mode 100644
index 00000000000..41b0f320e5b
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_attribute.h
@@ -0,0 +1,134 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _AST_ATTRIBUTE_AST_ATTRIBUTE_HH
+#define _AST_ATTRIBUTE_AST_ATTRIBUTE_HH
+
+#include "ast_field.h"
+#include "utl_scoped_name.h"
+
+class UTL_ExceptList;
+class UTL_NameList;
+
+class TAO_IDL_FE_Export AST_Attribute : public virtual AST_Field
+{
+public:
+ // Operations.
+
+ // Constructor(s).
+ AST_Attribute (void);
+
+ AST_Attribute (bool readonly,
+ AST_Type *ft,
+ UTL_ScopedName *n,
+ bool local,
+ bool abstract);
+
+ // Destructor.
+ virtual ~AST_Attribute (void);
+
+ // Data Accessors.
+
+ bool readonly (void) const;
+ UTL_ExceptList *get_get_exceptions (void) const;
+ UTL_ExceptList *get_set_exceptions (void) const;
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_Attribute, AST_Field);
+ DEF_NARROW_FROM_DECL(AST_Attribute);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+ // Methods to add exceptions directly, used when copying node.
+ UTL_ExceptList *be_add_get_exceptions (UTL_ExceptList *t);
+ UTL_ExceptList *be_add_set_exceptions (UTL_ExceptList *t);
+
+private:
+ // Data.
+
+ const bool pd_readonly;
+ // Is attribute read-only?
+
+ UTL_ExceptList *pd_get_exceptions;
+ UTL_ExceptList *pd_set_exceptions;
+
+ // Operations.
+
+ // Scope Management Protocol.
+
+ friend int tao_yyparse (void);
+ virtual UTL_NameList *fe_add_get_exceptions (UTL_NameList *e);
+ virtual UTL_NameList *fe_add_set_exceptions (UTL_NameList *e);
+};
+
+#endif // _AST_ATTRIBUTE_AST_ATTRIBUTE_HH
diff --git a/TAO/TAO_IDL/include/ast_component.h b/TAO/TAO_IDL/include/ast_component.h
new file mode 100644
index 00000000000..b3369adf483
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_component.h
@@ -0,0 +1,88 @@
+// 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);
+
+ // Extend lookup to the base component.
+ virtual AST_Decl *look_in_inherited (UTL_ScopedName *e,
+ bool treat_as_ref);
+
+ // Extend lookup to the supported interfaces.
+ virtual AST_Decl *look_in_supported (UTL_ScopedName *e,
+ bool treat_as_ref);
+
+ // Utility data structure for port declarations.
+ struct port_description
+ {
+ // Constructor.
+ port_description (void) : id (0), impl (0), is_multiple (false) {}
+
+ // Fields.
+ Identifier *id;
+ AST_Type *impl;
+ bool is_multiple;
+ };
+
+ // 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<port_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 bool redef_clash (void);
+
+private:
+ AST_Component *pd_base_component;
+ ACE_Unbounded_Queue<port_description> pd_provides;
+ ACE_Unbounded_Queue<port_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
new file mode 100644
index 00000000000..399ace99792
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_concrete_type.h
@@ -0,0 +1,97 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _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.
+
+class TAO_IDL_FE_Export AST_ConcreteType : public virtual AST_Type
+{
+public:
+ // Operations.
+
+ // Constructor(s).
+ AST_ConcreteType (void);
+
+ AST_ConcreteType (AST_Decl::NodeType nt,
+ UTL_ScopedName *n);
+
+ // Destructor.
+ virtual ~AST_ConcreteType (void);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_ConcreteType, AST_Type);
+ DEF_NARROW_FROM_DECL(AST_ConcreteType);
+};
+
+#endif // _AST_CONCRETE_TYPE_AST_CONCRETE_TYPE_HH
diff --git a/TAO/TAO_IDL/include/ast_constant.h b/TAO/TAO_IDL/include/ast_constant.h
new file mode 100644
index 00000000000..9ce723c00d8
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_constant.h
@@ -0,0 +1,141 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _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
+// the AST_Constant_val it received to the type denoted by
+// the ConstantType it received.
+//
+// NOTE: There are two constructors here, one that gets a NodeType
+// parameter. This constructor is used from AST_EnumVal, which is
+// just a glorified AST_Constant
+
+class TAO_IDL_FE_Export AST_Constant : public virtual AST_Decl
+{
+public:
+ AST_Constant (void);
+
+ AST_Constant (AST_Expression::ExprType et,
+ AST_Decl::NodeType nt,
+ AST_Expression *ev,
+ UTL_ScopedName *n);
+
+ AST_Constant (AST_Expression::ExprType et,
+ AST_Expression *ev,
+ UTL_ScopedName *n);
+
+ virtual ~AST_Constant (void);
+
+ // Data Accessors.
+ AST_Expression *constant_value (void);
+ AST_Expression::ExprType et (void);
+
+ // Accessors for the private member.
+ bool ifr_added (void);
+ void ifr_added (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);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+protected:
+ AST_Expression *pd_constant_value;
+ // The value.
+
+ AST_Expression::ExprType pd_et;
+ // Its expression type.
+
+ bool ifr_added_;
+ // Has this node been added to the IFR?
+};
+
+#endif // _AST_CONSTANT_AST_CONSTANT_HH
diff --git a/TAO/TAO_IDL/include/ast_decl.h b/TAO/TAO_IDL/include/ast_decl.h
new file mode 100644
index 00000000000..75425f06ac1
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_decl.h
@@ -0,0 +1,378 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _AST_DECL_AST_DECL_HH
+#define _AST_DECL_AST_DECL_HH
+
+// Rock bottom of AST class hierarchy
+//
+// This class is inherited by all classes which represent named entities
+// in IDL. It implements the line and file recording mechanism and also
+// 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.
+
+#include "utl_scoped_name.h"
+#include "idl_narrow.h"
+#include "ace/os_include/sys/os_types.h"
+#include "ace/SString.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
+// the hierarchy rooted in a single class, thereby eliminating the situation
+// that causes the bug to appear
+
+class TAO_IDL_FE_Export COMMON_Base
+{
+public:
+
+ COMMON_Base (bool local = false,
+ bool abstract = false);
+
+ virtual ~COMMON_Base (void) {}
+
+ // Accessor needs to get overridden for a few types.
+ virtual bool is_local (void);
+ void is_local (bool val);
+
+ bool is_abstract (void) const;
+ void is_abstract (bool val);
+
+ // A no-op, overridden in the child classes.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS0(COMMON_Base);
+
+protected:
+ bool is_local_;
+ bool is_abstract_;
+};
+
+class TAO_IDL_FE_Export AST_Decl : public virtual COMMON_Base
+{
+public:
+ // Enum defining the different kinds of AST nodes.
+ enum NodeType {
+ NT_module // Denotes a module
+ , 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
+ , NT_string // Denotes an IDL string
+ , NT_wstring // Denotes an IDL wstring
+ , NT_array // Denotes an IDL array
+ , NT_sequence // Denotes an IDL sequence
+ , NT_typedef // Denotes a typedef
+ , NT_pre_defined // Denotes a predefined type
+ , NT_native // Denotes a native type
+ // 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_eventtype // Denotes a CCM event source or sink
+ , NT_eventtype_fwd // Denotes a forward declared CCM event
+ , NT_valuebox // Denotes an value box
+ };
+
+ // Operations.
+
+ // Constructor(s).
+ AST_Decl (void);
+
+ AST_Decl (NodeType type,
+ UTL_ScopedName *n,
+ bool anonymous = false);
+
+ virtual ~AST_Decl (void);
+
+ // Data Accessors.
+
+ bool imported (void);
+ void set_imported (bool is_it);
+
+ bool in_main_file (void);
+ void set_in_main_file (bool is_it);
+
+ UTL_Scope *defined_in (void);
+ void set_defined_in (UTL_Scope *);
+
+ NodeType node_type (void);
+
+ long line (void);
+ void set_line (long l);
+
+ ACE_CString file_name (void);
+ void set_file_name (ACE_CString s);
+
+ UTL_ScopedName *name (void);
+
+ UTL_ScopedName *compute_name (const char *prefix,
+ const char *suffix);
+ // Variation of the <name>. Computes scoped name string, applying
+ // prefix and suffix to the local name component.
+
+ 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);
+ // Apply prefix and suffix to the local name and return.
+
+ virtual const char *full_name (void);
+ // Return the stringified full name.
+
+ virtual const char *flat_name (void);
+ // Return the flattened full scoped name.
+
+ const char *repoID (void);
+ void repoID (char *value);
+ // Accessors for the repository ID.
+
+ const char *prefix (void);
+ void prefix (const char *value);
+ // Accessors for the repository ID prefix.
+
+ const char *version (void);
+ void version (char *value);
+ // Accessors for the version_ member.
+
+ bool anonymous (void) const;
+ void anonymous (bool val);
+ // Accessors for the anonymous_ member.
+
+ bool typeid_set (void) const;
+ void typeid_set (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 (const 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_
+ // prefix to the all the reserved keywords. But when we invoke the
+ // operation remotely, we should be sending only the name with out
+ // "_cxx_" prefix.
+ //
+
+ Identifier *original_local_name (void);
+ void original_local_name (Identifier *);
+
+ bool added (void);
+ void set_added (bool is_it);
+
+ // Narrowing.
+ DEF_NARROW_METHODS0(AST_Decl);
+ DEF_NARROW_FROM_DECL(AST_Decl);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+ // Cleanup method.
+ virtual void destroy (void);
+
+ // Other operations
+
+ // Return TRUE if "this" has "s" as an ancestor.
+ bool has_ancestor (AST_Decl *s);
+
+ // Return TRUE if "this" is a child of "s".
+ bool is_child (AST_Decl *s);
+
+ 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);
+
+ // Accessors for the prefix_socpe_ member.
+ UTL_Scope *prefix_scope (void);
+ void prefix_scope (UTL_Scope *s);
+
+ // Useful for GIOP to know if a wstring is being marshaled.
+ virtual int contains_wstring (void);
+ void contains_wstring (int val);
+
+protected:
+ // These are not private because they're used by
+ // be_predefined_type' constructor.
+
+ char *repoID_;
+ // Repository ID.
+
+ char *flat_name_;
+ // Flattened fully scoped name.
+
+ int contains_wstring_;
+ // If we are a scope, do we contain a wstring at some level?
+
+protected:
+ void dump_i (ACE_OSTREAM_TYPE &o, const char *s) const ;
+
+ void compute_repoID (void);
+ // Computes the repoID.
+
+ void compute_full_name (void);
+ // Computes the stringified scoped name.
+
+ void compute_flat_name (void);
+ // Compute the flattened fully scoped name.
+
+private:
+ // Data
+
+ bool pd_imported;
+ // Imported?
+
+ bool pd_in_main_file;
+ // Defined in main file?
+
+ UTL_Scope *pd_defined_in;
+ // Scope.
+
+ NodeType pd_node_type;
+ // What kind of node.
+
+ long pd_line;
+ // Line defined in.
+
+ ACE_CString pd_file_name;
+ // What file defined in.
+
+ UTL_ScopedName *pd_name;
+
+ Identifier *pd_local_name;
+ // Name in scope.
+
+ Identifier *pd_original_local_name;
+ // _cxx_ removed if any.
+
+ bool pd_added;
+ // Already added.
+
+ char *full_name_;
+ // Our full scoped name.
+
+ char *prefix_;
+ // The repository ID prefix.
+
+ char *version_;
+ // Set by #pragma version.
+
+ bool anonymous_;
+ // Are we an anonymous (no repo ID) type?
+
+ bool typeid_set_;
+ // Has our repo id been set by a typeId declaration?
+
+ 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.
+
+ // The scope in which our prefix, if any, was assigned.
+ UTL_Scope *prefix_scope_;
+
+private:
+ void compute_full_name (UTL_ScopedName *n);
+ // Compute the full name of an AST node.
+
+ void set_prefix_with_typeprefix_r (const char *value,
+ UTL_Scope *appeared_in);
+ // 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
new file mode 100644
index 00000000000..9add0c75bc7
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_enum.h
@@ -0,0 +1,128 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _AST_ENUM_AST_ENUM_HH
+#define _AST_ENUM_AST_ENUM_HH
+
+#include "ast_concrete_type.h"
+#include "utl_scope.h"
+
+class AST_EnumVal;
+
+class TAO_IDL_FE_Export AST_Enum : public virtual AST_ConcreteType,
+ public virtual UTL_Scope
+{
+public:
+ AST_Enum (void);
+ AST_Enum (UTL_ScopedName *n,
+ bool local,
+ bool abstract);
+
+ virtual ~AST_Enum (void);
+
+ // Narrowing
+ DEF_NARROW_METHODS2(AST_Enum, AST_ConcreteType, UTL_Scope);
+ DEF_NARROW_FROM_DECL(AST_Enum);
+ DEF_NARROW_FROM_SCOPE(AST_Enum);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &);
+
+ // Look up an AST_EnumVal by value
+ AST_EnumVal *lookup_by_value (const AST_Expression *v);
+
+ // Get value to be assigned to next enumerator.
+ 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.
+ UTL_ScopedName *value_to_name (const unsigned long v);
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+private:
+ friend int tao_yyparse (void);
+
+ unsigned long pd_enum_counter;
+ // Value for next enumerator.
+
+ int member_count_;
+ // Number of members.
+
+ int compute_member_count (void);
+ // Count the number of members.
+
+ virtual AST_EnumVal *fe_add_enum_val (AST_EnumVal *v);
+ // Scope Management.
+};
+
+#endif // _AST_ENUM_AST_ENUM_HH
diff --git a/TAO/TAO_IDL/include/ast_enum_val.h b/TAO/TAO_IDL/include/ast_enum_val.h
new file mode 100644
index 00000000000..46b3ce331dd
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_enum_val.h
@@ -0,0 +1,99 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _AST_ENUM_VAL_AST_ENUM_VAL_HH
+#define _AST_ENUM_VAL_AST_ENUM_VAL_HH
+
+#include "ast_constant.h"
+
+// An enumerator is a constant of type unsigned long.
+
+class TAO_IDL_FE_Export AST_EnumVal : public virtual AST_Constant
+{
+public:
+ // Operations.
+
+ // Constructor(s).
+ AST_EnumVal (void);
+
+ AST_EnumVal (unsigned long v,
+ UTL_ScopedName *n);
+
+ // Destructor.
+ virtual ~AST_EnumVal (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_EnumVal, AST_Constant);
+ DEF_NARROW_FROM_DECL(AST_EnumVal);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+};
+
+#endif // _AST_ENUM_VAL_AST_ENUM_VAL_HH
diff --git a/TAO/TAO_IDL/include/ast_eventtype.h b/TAO/TAO_IDL/include/ast_eventtype.h
new file mode 100644
index 00000000000..d1fe9509207
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_eventtype.h
@@ -0,0 +1,44 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+#ifndef _AST_VALUETYPE_AST_EVENTTYPE_HH
+#define _AST_VALUETYPE_AST_EVENTTYPE_HH
+
+#include "ast_valuetype.h"
+
+class TAO_IDL_FE_Export AST_EventType : public virtual AST_ValueType
+{
+public:
+ AST_EventType (void);
+
+ AST_EventType (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,
+ bool abstract,
+ bool truncatable,
+ bool custom);
+
+ virtual ~AST_EventType (void);
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_EventType, AST_ValueType);
+ DEF_NARROW_FROM_DECL(AST_EventType);
+ DEF_NARROW_FROM_SCOPE(AST_EventType);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+};
+
+#endif // _AST_VALUETYPE_AST_EVENTTYPE_HH
diff --git a/TAO/TAO_IDL/include/ast_eventtype_fwd.h b/TAO/TAO_IDL/include/ast_eventtype_fwd.h
new file mode 100644
index 00000000000..c1533eec4c0
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_eventtype_fwd.h
@@ -0,0 +1,35 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+#ifndef _AST_VALUETYPE_FWD_AST_EVENTTYPE_FWD_HH
+#define _AST_VALUETYPE_FWD_AST_EVENTTYPE_FWD_HH
+
+#include "ast_valuetype_fwd.h"
+
+// Representation of a forward eventtype declaration.
+
+class TAO_IDL_FE_Export AST_EventTypeFwd : public virtual AST_ValueTypeFwd
+{
+public:
+ AST_EventTypeFwd (void);
+
+ AST_EventTypeFwd (AST_Interface *dummy,
+ UTL_ScopedName *n);
+
+ virtual ~AST_EventTypeFwd (void);
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_EventTypeFwd, AST_ValueTypeFwd);
+ DEF_NARROW_FROM_DECL(AST_EventTypeFwd);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+};
+
+#endif // _AST_VALUETYPE_FWD_AST_EVENTTYPE_FWD_HH
diff --git a/TAO/TAO_IDL/include/ast_exception.h b/TAO/TAO_IDL/include/ast_exception.h
new file mode 100644
index 00000000000..f84b7f9e29b
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_exception.h
@@ -0,0 +1,119 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _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.
+//
+// NOTE: add (AST_EnumValue *) is defined here because enums can
+// be defined manifest locally; the constants defined in these
+// enums are inserted in the enclosing scope. It is unlikely that
+// a BE writer will need to overload this function in AST_Exception.
+
+class TAO_IDL_FE_Export AST_Exception : public virtual AST_Structure
+{
+public:
+ AST_Exception (void);
+
+ AST_Exception (UTL_ScopedName *n,
+ bool local,
+ bool abstract);
+
+ virtual ~AST_Exception (void);
+
+ virtual bool in_recursion (ACE_Unbounded_Queue<AST_Type *> &list);
+ // Check if we or the parameter node is in recursion.
+
+ // Narrowing
+ DEF_NARROW_METHODS1(AST_Exception, AST_Structure);
+ DEF_NARROW_FROM_DECL(AST_Exception);
+ DEF_NARROW_FROM_SCOPE(AST_Exception);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+private:
+ friend int tao_yyparse (void);
+
+ // 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);
+ virtual AST_Enum *fe_add_enum (AST_Enum *e);
+ virtual AST_EnumVal *fe_add_enum_val (AST_EnumVal *v);
+};
+
+#endif // _AST_EXCEPTION_AST_EXCEPTION_HH
diff --git a/TAO/TAO_IDL/include/ast_expression.h b/TAO/TAO_IDL/include/ast_expression.h
new file mode 100644
index 00000000000..80b4a65c267
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_expression.h
@@ -0,0 +1,337 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _AST_EXPRESSION_AST_EXPRESSION_HH
+#define _AST_EXPRESSION_AST_EXPRESSION_HH
+
+#include "ace/CDR_Stream.h"
+#include "idl_uns_long.h"
+#include "utl_scoped_name.h"
+
+class UTL_String;
+class UTL_Scope;
+class ast_visitor;
+class AST_Decl;
+
+// Representation of expression values.
+
+// An expression (and maybe its value, if computed).
+class TAO_IDL_FE_Export AST_Expression
+{
+public:
+ // Enum to define all the different operators to combine expressions.
+ enum ExprComb
+ {
+ EC_add // '+'
+ , EC_minus // '-'
+ , EC_mul // '*'
+ , EC_div // '/'
+ , EC_mod // '%'
+ , EC_or // '|'
+ , EC_xor // '^'
+ , EC_and // '&'
+ , EC_left // '<<'
+ , EC_right // '>>'
+ , EC_u_plus // unary '+'
+ , EC_u_minus // unary '-'
+ , EC_bit_neg // '~'
+ , EC_none // No operator (missing).
+ , EC_symbol // A symbol (function or constant name).
+ };
+
+ // Enum to define the different kinds of evaluation possible
+ // Extend this for more kinds of evaluation as required.
+ enum EvalKind
+ {
+ EK_const // Must evaluate to constant.
+ , EK_positive_int // Must evaluate to positive integer.
+ // @@ (JP) I added these to get the ~ operator to work with all the
+ // relevant aritmetic types, but eventually, we should get rid of
+ // this whole enum.
+ , EK_bool
+ , EK_short
+ , EK_ushort
+ , EK_long
+ , EK_ulong
+ , EK_longlong
+ , EK_ulonglong
+ , EK_octet
+ , EK_floating_point
+ };
+
+ // Enum to define expression type.
+ enum ExprType
+ {
+ EV_short // Expression value is short.
+ , EV_ushort // Expression value is unsigned short.
+ , EV_long // Expression value is long.
+ , EV_ulong // Expression value is unsigned long.
+ , EV_longlong // Expression value is long long.
+ , EV_ulonglong // Expression value is unsigned long long.
+ , EV_float // Expression value is 32-bit float.
+ , EV_double // Expression value is 64-bit float.
+ , EV_longdouble // Expression value is 128-bit float.
+ , EV_char // Expression value is char.
+ , EV_wchar // Expression value is wide char.
+ , EV_octet // Expression value is unsigned char.
+ , EV_bool // Expression value is boolean.
+ , EV_string // Expression value is char *.
+ , EV_wstring // Expression value is wide string.
+ , 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.
+ };
+
+ // Structure to describe value of constant expression and its type.
+ struct AST_ExprValue
+ {
+ AST_ExprValue (void);
+
+ union
+ {
+ short sval; // Contains short expression value.
+ unsigned short usval; // Contains unsigned short expr value.
+ long lval; // Contains long expression value.
+ unsigned long ulval; // Contains unsigned long expr value.
+ bool bval; // Contains boolean expression value.
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ ACE_CDR::LongLong llval; // Contains long long expr value.
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T) && ! defined (ACE_LACKS_LONGLONG_T)
+ ACE_CDR::LongLong ullval; // Contains unsigned long long expr value
+#elif ! defined (ACE_LACKS_LONGLONG_T)
+ ACE_CDR::ULongLong ullval; // Contains unsigned long long expr value.
+#endif /* defined (ACE_LACKS_UNSIGNEDLONGLONG_T) && ! defined (ACE_LACKS_LONGLONG_T) */
+ float fval; // Contains 32-bit float expr value.
+ double dval; // Contains 64-bit float expr value.
+ char cval; // Contains char expression value.
+ ACE_CDR::WChar wcval; // Contains wchar expression value.
+ unsigned char oval; // Contains unsigned char expr value.
+ UTL_String *strval; // Contains String * expr value.
+ char *wstrval; // Contains wide string expr value.
+ unsigned long eval; // Contains enumeration value.
+ } u;
+
+ ExprType et;
+ };
+
+ // Operations.
+
+ // Constructor(s).
+ AST_Expression (AST_Expression *v,
+ ExprType t);
+
+ AST_Expression (ExprComb c,
+ AST_Expression *v1,
+ AST_Expression *v2);
+
+ AST_Expression (short s);
+
+ AST_Expression (unsigned short us);
+
+ AST_Expression (long l);
+
+ AST_Expression (bool b);
+
+ AST_Expression (unsigned long ul);
+
+ AST_Expression (idl_uns_long,
+ ExprType t);
+
+ AST_Expression (float f);
+
+ AST_Expression (double d);
+
+ AST_Expression (char c);
+
+ AST_Expression (ACE_OutputCDR::from_wchar wc);
+
+ AST_Expression (unsigned char uc);
+
+ AST_Expression (UTL_String *s);
+
+ AST_Expression (char *s);
+
+ AST_Expression (UTL_ScopedName *n);
+
+ // Destructor.
+ virtual ~AST_Expression (void);
+
+ // Data Accessors.
+ UTL_Scope *defined_in (void);
+ void set_defined_in (UTL_Scope *d);
+
+ long line (void);
+ void set_line (long l);
+
+ UTL_String *file_name (void);
+ void set_file_name (UTL_String *f);
+
+ ExprComb ec (void);
+
+ AST_ExprValue *ev (void);
+ void set_ev (AST_ExprValue *new_ev);
+
+ AST_Expression *v1 (void);
+ void set_v1 (AST_Expression *e);
+
+ AST_Expression *v2 (void);
+ void set_v2 (AST_Expression *e);
+
+ UTL_ScopedName *n (void);
+ void set_n (UTL_ScopedName *new_n);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+ // Other operations.
+
+ // Evaluation and value coercion.
+
+ 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.
+ void evaluate (EvalKind ek);
+
+ // Compare two AST_Expressions.
+
+ bool operator== (AST_Expression *vc);
+
+ long compare (AST_Expression *vc);
+
+ AST_Decl *get_tdef (void) const;
+
+protected:
+ // Evaluate different sets of operators.
+ AST_ExprValue *eval_bin_op (EvalKind ek);
+
+ AST_ExprValue *eval_mod_op (EvalKind ek);
+
+ AST_ExprValue *eval_bit_op (EvalKind ek);
+
+ AST_ExprValue *eval_un_op (EvalKind ek);
+
+ AST_ExprValue *eval_symbol (EvalKind ek);
+
+ bool type_mismatch (ExprType et);
+
+private:
+ UTL_Scope *pd_defined_in;
+ // Scope.
+
+ long pd_line;
+ // Line defined in.
+
+ UTL_String *pd_file_name;
+ // What file defined in.
+
+ ExprComb pd_ec;
+ // What combinator.
+
+ AST_ExprValue *pd_ev;
+ // Computed value.
+
+ AST_Expression *pd_v1;
+ // 1st sub-expression.
+
+ AST_Expression *pd_v2;
+ // 2nd sub-expression.
+
+ UTL_ScopedName *pd_n;
+ // Symbolic name (if any).
+
+ AST_Decl *tdef;
+ // Propagates aliased constant type.
+private:
+ // Fill out the lineno, filename and definition scope details.
+ void fill_definition_details (void);
+
+ // Internal evaluation.
+ virtual AST_ExprValue *eval_internal (EvalKind ek);
+};
+
+#endif // _AST_EXPR_VAL_AST_EXPR_VAL_HH
diff --git a/TAO/TAO_IDL/include/ast_extern.h b/TAO/TAO_IDL/include/ast_extern.h
new file mode 100644
index 00000000000..b58e8ed493f
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_extern.h
@@ -0,0 +1,88 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _AST_EXTERN_AST_EXTERN_HH
+#define _AST_EXTERN_AST_EXTERN_HH
+
+
+
+class AST_Type;
+class AST_Decl;
+
+// Declares all global functions for the AST
+
+// Two functions are provided for storing AST nodes representing fwd
+// 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 void AST_record_fwd_decl (AST_Type *i);
+extern TAO_IDL_FE_Export void AST_check_fwd_decls (void);
+extern bool AST_illegal_recursive_type (AST_Decl *t);
+extern bool AST_illegal_interface_recursion (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
new file mode 100644
index 00000000000..5d1f45a0b1e
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_factory.h
@@ -0,0 +1,151 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _AST_FACTORY_AST_FACTORY_HH
+#define _AST_FACTORY_AST_FACTORY_HH
+
+// Representation of OBV factory construct declaration.
+
+#include "ast_decl.h"
+#include "utl_scope.h"
+#include "utl_scoped_name.h"
+
+class UTL_ExceptList;
+
+class TAO_IDL_FE_Export AST_Factory : public virtual AST_Decl,
+ public virtual UTL_Scope
+{
+public:
+
+ // Constructor(s).
+ AST_Factory (void);
+
+ AST_Factory (UTL_ScopedName *n);
+
+ // Destructor.
+ virtual ~AST_Factory (void);
+
+ // Data Accessors.
+
+ // Public operations.
+
+ UTL_ExceptList *exceptions (void);
+ // Return exception list.
+
+ int n_exceptions (void);
+ // Return exception count.
+
+ virtual int argument_count (void);
+ // Return the count of members.
+
+ virtual int has_native (void);
+ // Any of the arguments or the return value is a <native> type.
+ // This is important because in that case no code should be
+ // generated for the stubs.
+
+ // Narrowing.
+ DEF_NARROW_METHODS2(AST_Factory, AST_Decl, UTL_Scope);
+ DEF_NARROW_FROM_DECL(AST_Factory);
+ DEF_NARROW_FROM_SCOPE(AST_Factory);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+private:
+ // Data.
+
+ UTL_ExceptList *pd_exceptions;
+ // Exceptions raised
+
+ int pd_n_exceptions;
+ // Exception count.
+
+ int argument_count_;
+ // Number of arguments.
+
+ int has_native_;
+ // Is any argument of type native.
+
+private:
+ // Operations.
+
+ int compute_argument_attr (void);
+ // Count the number of arguments.
+
+ // Scope Management Protocol.
+
+ friend int tao_yyparse (void);
+ virtual AST_Argument *fe_add_argument (AST_Argument *a);
+ virtual UTL_NameList *fe_add_exceptions (UTL_NameList *e);
+};
+
+#endif // _AST_FACTORY_AST_FACTORY_HH
diff --git a/TAO/TAO_IDL/include/ast_field.h b/TAO/TAO_IDL/include/ast_field.h
new file mode 100644
index 00000000000..d9434e0fb4e
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_field.h
@@ -0,0 +1,150 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _AST_FIELD_AST_FIELD_HH
+#define _AST_FIELD_AST_FIELD_HH
+
+// Representation of a generic field.
+
+// Used as member in structures, exceptions and unions, and as a base
+// type for attributes and arguments to operations
+//
+// NOTE: There are two constructors here, the first is used when field
+// is used directly inside a structure, the second when it is used as
+// the base type for attributes and operations.
+
+#include "ast_decl.h"
+#include "utl_scoped_name.h"
+
+class AST_Type;
+
+class TAO_IDL_FE_Export AST_Field : public virtual AST_Decl
+{
+public:
+ enum Visibility
+ {
+ vis_NA,
+ vis_PUBLIC,
+ vis_PRIVATE
+ };
+
+ // Operations.
+
+ // Constructor(s).
+ AST_Field (void);
+
+ AST_Field (AST_Type *field_type,
+ UTL_ScopedName *n,
+ Visibility vis = vis_NA);
+
+ AST_Field (AST_Decl::NodeType nt,
+ AST_Type *field_type,
+ UTL_ScopedName *n,
+ Visibility vis = vis_NA);
+
+ virtual ~AST_Field (void);
+
+ // Data Accessors.
+ AST_Type *field_type (void) const;
+
+ Visibility visibility (void);
+
+ // Are we or do we contain a wstring?
+ virtual int contains_wstring (void);
+
+ // Determine this bit of state after we have
+ // be added to our aggregate type and before
+ // we are destroyed.
+ void set_recursive_flag (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_Field, AST_Decl);
+ DEF_NARROW_FROM_DECL(AST_Field);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+private:
+ // Data.
+
+ AST_Type *pd_field_type;
+ // Base type for field.
+
+ Visibility pd_visibility;
+ // Used with valuetype and eventtype fields.
+
+ bool anonymous_type_;
+ // If our field type is anonymous array or sequence, we're
+ // responsible for destroying it.
+};
+
+#endif // _AST_FIELD_AST_FIELD_HH
diff --git a/TAO/TAO_IDL/include/ast_generator.h b/TAO/TAO_IDL/include/ast_generator.h
new file mode 100644
index 00000000000..37e34755e1c
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_generator.h
@@ -0,0 +1,343 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _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"
+#include "idl_uns_long.h"
+
+class UTL_LabelList;
+class UTL_ExprList;
+class AST_Root;
+class AST_EventType;
+class AST_EventTypeFwd;
+
+// Defines base class for node generators.
+
+class TAO_IDL_FE_Export AST_Generator
+{
+public:
+
+ virtual ~AST_Generator (void) {}
+
+ // Operations.
+
+ // Create a node representing a predefined type.
+ virtual AST_PredefinedType *create_predefined_type (
+ AST_PredefinedType::PredefinedType t,
+ UTL_ScopedName *n
+ );
+
+ // Create a node representing a module.
+ virtual AST_Module *create_module (UTL_Scope *s,
+ UTL_ScopedName *n);
+
+ // Create a node representing a module which is the root of an AST.
+ virtual AST_Root *create_root (UTL_ScopedName *n);
+
+ // Create a node representing an interface.
+ virtual AST_Interface *create_interface (
+ UTL_ScopedName *n,
+ AST_Interface **inherits,
+ long n_inherits,
+ AST_Interface **inherits_flat,
+ long n_inherits_flat,
+ bool is_local,
+ bool is_abstract
+ );
+
+ // Create a node representing a forward declaration of an interface.
+ virtual AST_InterfaceFwd *create_interface_fwd (
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract
+ );
+
+ // 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_list,
+ long n_supports,
+ AST_Interface *supports_concrete,
+ bool is_abstract,
+ bool is_truncatable,
+ bool is_custom
+ );
+
+ // Create a node representing a forward declaration of a valuetype.
+ virtual AST_ValueTypeFwd *create_valuetype_fwd (
+ UTL_ScopedName *n,
+ bool is_abstract
+ );
+
+ // Create a node representing an eventtype.
+ virtual AST_EventType *create_eventtype (
+ UTL_ScopedName *n,
+ AST_Interface **inherits,
+ long n_inherits,
+ AST_ValueType *inherits_concrete,
+ AST_Interface **inherits_flat,
+ long n_inherits_flat,
+ AST_Interface **supports_list,
+ long n_supports,
+ AST_Interface *supports_concrete,
+ bool is_abstract,
+ bool is_truncatable,
+ bool is_custom
+ );
+
+ // Create a node representing a forward declaration of an eventtype.
+ virtual AST_EventTypeFwd *create_eventtype_fwd (
+ UTL_ScopedName *n,
+ bool is_abstract
+ );
+
+ // Create a node representing a component.
+ virtual AST_Component *create_component (
+ UTL_ScopedName *n,
+ AST_Component *base_component,
+ AST_Interface **supports_list,
+ 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 component home.
+ virtual AST_Home *create_home (
+ UTL_ScopedName *n,
+ AST_Home *base_home,
+ AST_Component *managed_component,
+ AST_ValueType *primary_key,
+ AST_Interface **support_lists,
+ 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,
+ bool is_local,
+ bool is_abstract
+ );
+
+ // Create a node representing a structure.
+ virtual AST_Structure *create_structure (
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_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,
+ bool is_local,
+ bool is_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,
+ bool is_local,
+ bool is_abstract
+ );
+
+ // Create a node representing a field in a structure, exception or
+ // union.
+ virtual AST_Field *create_field (AST_Type *ft,
+ UTL_ScopedName *n,
+ AST_Field::Visibility vis =
+ 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
+ );
+
+ // Create a node representing an attribute.
+ virtual AST_Attribute *create_attribute (
+ bool ro,
+ AST_Type *ft,
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract
+ );
+
+ // Create a node representing a union.
+ virtual AST_Union *create_union (AST_ConcreteType *dt,
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_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
+ );
+
+ // 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);
+
+ // Create various kinds of nodes representing expressions.
+
+ virtual AST_Expression *create_expr (UTL_ScopedName *n);
+
+ virtual AST_Expression *create_expr (AST_Expression *v,
+ AST_Expression::ExprType t);
+
+ virtual AST_Expression *create_expr (AST_Expression::ExprComb c,
+ AST_Expression *v1,
+ AST_Expression *v2);
+
+ virtual AST_Expression *create_expr (long v);
+
+ virtual AST_Expression *create_expr (bool b);
+
+ virtual AST_Expression *create_expr (idl_uns_long v,
+ AST_Expression::ExprType t);
+
+ virtual AST_Expression *create_expr (UTL_String *s);
+
+ virtual AST_Expression *create_expr (char *s);
+
+ virtual AST_Expression *create_expr (char c);
+
+ virtual AST_Expression *create_expr (ACE_OutputCDR::from_wchar wc);
+
+ virtual AST_Expression *create_expr (double d);
+
+ // Create a node representing an enumerator.
+ virtual AST_EnumVal *create_enum_val (unsigned long v,
+ UTL_ScopedName *n);
+
+ // Create a node representing an array type.
+ virtual AST_Array *create_array (UTL_ScopedName *n,
+ unsigned long ndims,
+ UTL_ExprList *dims,
+ bool is_local,
+ bool is_abstract);
+
+ // Create a node representing a sequence type.
+ virtual AST_Sequence *create_sequence (AST_Expression *v,
+ AST_Type *bt,
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract);
+
+ // Create a node representing a string type.
+ virtual AST_String *create_string (AST_Expression *v);
+
+ // Create a node representing a wide string type.
+ virtual AST_String *create_wstring (AST_Expression *v);
+
+ // Create a node representing a type renaming (typedef).
+ virtual AST_Typedef*create_typedef (AST_Type *bt,
+ UTL_ScopedName *n,
+ bool is_local,
+ bool is_abstract);
+
+ // Create a node representing a native.
+ virtual AST_Native *create_native (UTL_ScopedName *n);
+
+ // Create a node representing an OBV factory construct.
+ virtual AST_Factory *create_factory (UTL_ScopedName *n);
+
+ // Create a node representing a valuebox.
+ virtual AST_ValueBox *create_valuebox (UTL_ScopedName *n,
+ AST_Type *boxed_type);
+};
+
+#endif // _AST_GENERATOR_AST_GENERATOR_HH
diff --git a/TAO/TAO_IDL/include/ast_home.h b/TAO/TAO_IDL/include/ast_home.h
new file mode 100644
index 00000000000..02456b18065
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_home.h
@@ -0,0 +1,76 @@
+// 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);
+
+ // Extend lookup to the base home.
+ virtual AST_Decl *look_in_inherited (UTL_ScopedName *e,
+ bool treat_as_ref);
+
+ // Extend lookup to the supported interfaces.
+ virtual AST_Decl *look_in_supported (UTL_ScopedName *e,
+ bool treat_as_ref);
+
+ // Accessors.
+
+ AST_Home *base_home (void) const;
+
+ AST_Interface **supports (void) const;
+
+ long n_supports (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
new file mode 100644
index 00000000000..b76bf719ca3
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_interface.h
@@ -0,0 +1,236 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _AST_INTERFACE_AST_INTERFACE_HH
+#define _AST_INTERFACE_AST_INTERFACE_HH
+
+// NOTE: add (AST_EnumValue *) is defined here because enums can
+// be defined manifest locally; the constants defined in these
+// enums are inserted in the enclosing scope.
+
+#include "ast_type.h"
+#include "utl_scope.h"
+#include "ace/Unbounded_Queue.h"
+
+class TAO_IDL_FE_Export AST_Interface : public virtual AST_Type,
+ public virtual UTL_Scope
+{
+public:
+ AST_Interface (void);
+
+ AST_Interface (UTL_ScopedName *n,
+ AST_Interface **ih,
+ long nih,
+ AST_Interface **ih_flat,
+ long nih_flat,
+ bool local,
+ bool abstract);
+
+ virtual ~AST_Interface (void);
+
+ // This serves for interfaces, value types, components, and eventtypes.
+ static void fwd_redefinition_helper (AST_Interface *&i,
+ UTL_Scope *s);
+
+ // Overridden for valuetypes, components, and eventtypes.
+ virtual void redefine (AST_Interface *from);
+
+ AST_Interface **inherits (void) const;
+
+ long n_inherits (void) const;
+
+ AST_Interface **inherits_flat (void) const;
+
+ long n_inherits_flat (void) const;
+
+ ACE_Unbounded_Queue<AST_Interface *> &get_insert_queue (void);
+ ACE_Unbounded_Queue<AST_Interface *> &get_del_queue (void);
+
+ AST_Operation *be_add_operation (AST_Operation *);
+
+ void be_replace_operation (AST_Decl *old_op,
+ AST_Decl *new_op);
+
+ // Is this interface defined? This predicate returns FALSE when an
+ // interface was forward declared but not defined yet, and TRUE in
+ // all other cases.
+ bool is_defined (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 bool redef_clash (void);
+
+ // Accessors for the member.
+ bool home_equiv (void) const;
+ void home_equiv (bool val);
+
+ // Accessors for the member.
+ AST_InterfaceFwd *fwd_decl (void) const;
+ void fwd_decl (AST_InterfaceFwd *node);
+
+ // Look through inherited interfaces.
+ virtual AST_Decl *look_in_inherited (UTL_ScopedName *e,
+ bool treat_as_ref);
+
+ // Recursively called on valuetype to check for legal use as
+ // a primary key. Overridden for valuetype, struct, sequence,
+ // union, array, typedef, and interface.
+ virtual bool legal_for_primary_key (void) const;
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS2(AST_Interface, AST_Type, UTL_Scope);
+ DEF_NARROW_FROM_DECL(AST_Interface);
+ DEF_NARROW_FROM_SCOPE(AST_Interface);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+protected:
+ // Data.
+
+ // Immediate ancestors.
+ AST_Interface **pd_inherits;
+ long pd_n_inherits;
+
+ // All ancestors.
+ 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;
+
+ // Are we the equivalent interface of a home?
+ bool home_equiv_;
+
+ // The forward declaration we may have been created from.
+ AST_InterfaceFwd *fwd_decl_;
+
+protected:
+ // Scope Management Protocol.
+ friend int tao_yyparse (void);
+ friend class IDL_GlobalData;
+
+ virtual AST_Constant *fe_add_constant (AST_Constant *c);
+
+ virtual AST_Exception *fe_add_exception (AST_Exception *e);
+
+ 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_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);
+
+ virtual AST_Typedef *fe_add_typedef (AST_Typedef *t);
+
+ virtual AST_Native *fe_add_native (AST_Native *n);
+
+ // 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,
+ 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,
+ bool abstract_paths_only = false);
+ // 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
new file mode 100644
index 00000000000..a23b5bcb319
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_interface_fwd.h
@@ -0,0 +1,119 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _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:
+ AST_InterfaceFwd (void);
+
+ AST_InterfaceFwd (AST_Interface *dummy,
+ UTL_ScopedName *n);
+
+ virtual ~AST_InterfaceFwd (void);
+
+ AST_Interface *full_definition (void);
+ void set_full_definition (AST_Interface *nfd);
+
+ virtual bool is_defined (void);
+ void set_as_defined (void);
+
+ virtual bool is_local (void);
+ virtual bool is_valuetype (void);
+ virtual bool is_abstract_valuetype (void);
+
+ bool full_def_seen (void);
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_InterfaceFwd, AST_Type);
+ DEF_NARROW_FROM_DECL(AST_InterfaceFwd);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+private:
+ AST_Interface *pd_full_definition;
+ // The interface this is a forward declaration of.
+
+ bool is_defined_;
+ // Checking the member above isn't good enough.
+};
+
+#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
new file mode 100644
index 00000000000..62afe2b1ff1
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_module.h
@@ -0,0 +1,190 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _AST_MODULE_AST_MODULE_HH
+#define _AST_MODULE_AST_MODULE_HH
+
+#include "ast_decl.h"
+#include "utl_scope.h"
+#include "ace/Unbounded_Set.h"
+
+// Representation of module.
+//
+// NOTE: add(AST_EnumValue *) is defined here because enums can
+// be defined manifest locally; the constants defined in these
+// enums are inserted in the enclosing scope.
+
+class TAO_IDL_FE_Export AST_Module : public virtual AST_Decl,
+ public virtual UTL_Scope
+{
+public:
+ // Operations.
+
+ // Constructor(s) and destructor.
+ AST_Module (void);
+
+ AST_Module (UTL_ScopedName *n);
+
+ virtual ~AST_Module (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS2(AST_Module, AST_Decl, UTL_Scope);
+ DEF_NARROW_FROM_DECL(AST_Module);
+ DEF_NARROW_FROM_SCOPE(AST_Module);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Involved in OBV_ namespace generation.
+ void set_has_nested_valuetype (void);
+ bool has_nested_valuetype (void);
+
+ // Allows adding an interface to a later point
+ // The interface i is inserted after interface ix, if
+ // ix is not null.
+ int be_add_interface (AST_Interface *i,
+ AST_Interface *ix = 0);
+
+ // Has this node been referenced here already?
+ // Override of method in UTL_Scope.
+ virtual bool referenced (AST_Decl *e,
+ Identifier *id = 0);
+
+ // Add decls from previous opening of this module to the
+ // 'previous' set of this module, along with the argument's
+ // own 'previous' set.
+ void add_to_previous (AST_Module *m);
+
+ // Called by lookup_by_name_local, to check for declaration
+ // in a previous opening of this module.
+ virtual AST_Decl *look_in_previous (Identifier *e, bool ignore_fwd = false);
+
+ // Accessor to the member.
+ ACE_Unbounded_Set<AST_Decl *> &previous (void);
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+private:
+ friend void fe_populate_global_scope (AST_Module *m);
+ friend int tao_yyparse (void);
+
+ // Scope Management Protocol
+
+ virtual AST_PredefinedType *fe_add_predefined_type (AST_PredefinedType *t);
+
+ virtual AST_Module *fe_add_module (AST_Module *m);
+
+ 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_EventType *fe_add_eventtype (AST_EventType *i);
+
+ virtual AST_EventTypeFwd *fe_add_eventtype_fwd (AST_EventTypeFwd *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);
+
+ virtual AST_Typedef *fe_add_typedef (AST_Typedef *t);
+
+ virtual AST_Native *fe_add_native (AST_Native *n);
+
+ virtual AST_ValueBox *fe_add_valuebox (AST_ValueBox *vb);
+
+ bool pd_has_nested_valuetype;
+
+ ACE_Unbounded_Set<AST_Decl *> previous_;
+ // Container for declaration from previous openings of this module.
+};
+
+#endif // _AST_MODULE_AST_MODULE_HH
diff --git a/TAO/TAO_IDL/include/ast_native.h b/TAO/TAO_IDL/include/ast_native.h
new file mode 100644
index 00000000000..5813d34d02a
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_native.h
@@ -0,0 +1,45 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+#ifndef _AST_NATIVE_H_
+#define _AST_NATIVE_H_
+
+#include "ast_exception.h"
+
+// Representation of "native" IDL type. It may be used as a
+// return type, parameter type, or in an operation's
+// exception list. This last usage creates special problems
+// with both syntax checking and code generation. Letting
+// this class inherit from AST_Exception is the most seamless
+// way to handle it, and does not affect the other use cases.
+class TAO_IDL_FE_Export AST_Native : public virtual AST_Exception
+{
+public:
+ // Operations.
+
+ // Constructor(s).
+
+ AST_Native (void);
+ // Default constructor.
+
+ AST_Native (UTL_ScopedName *n);
+ // Constructor that initializes the scoped name.
+
+ virtual ~AST_Native (void);
+ // Destructor.
+
+ virtual void destroy (void);
+ // Cleanup.
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_Native, AST_Exception);
+ DEF_NARROW_FROM_DECL(AST_Native);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+};
+
+#endif /* AST_NATIVE_H */
diff --git a/TAO/TAO_IDL/include/ast_operation.h b/TAO/TAO_IDL/include/ast_operation.h
new file mode 100644
index 00000000000..95f38818309
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_operation.h
@@ -0,0 +1,191 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _AST_OPERATION_AST_OPERATION_HH
+#define _AST_OPERATION_AST_OPERATION_HH
+
+#include "ast_decl.h"
+#include "utl_scope.h"
+
+class UTL_ExceptList;
+
+class TAO_IDL_FE_Export AST_Operation : public virtual AST_Decl,
+ public virtual UTL_Scope
+{
+public:
+ // Define enum with flags for operation attributes.
+ enum Flags
+ {
+ OP_noflags // No flags present.
+ , OP_oneway // Operation is oneway.
+ , OP_idempotent // Operation is idempotent.
+ };
+
+ // Constructor(s).
+ AST_Operation (void);
+
+ AST_Operation (AST_Type *return_type,
+ Flags flags,
+ UTL_ScopedName *n,
+ bool local,
+ bool abstract);
+
+ // Destructor.
+ virtual ~AST_Operation (void);
+
+ // Data Accessors.
+
+ AST_Type *return_type (void);
+
+ Flags flags (void);
+
+ UTL_StrList *context (void);
+
+ UTL_ExceptList *exceptions (void);
+
+ // 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);
+
+ /// Count the number of arguments of a certain type.
+ /**
+ * @param direction_mask limit the direction (IN, OUT or INOUT) of
+ * the arguments considered. Typically used as follows:
+ *
+ * int count =
+ * ast_operation->count_arguments_with_direction
+ * (AST_Argument::dir_IN
+ * | AST_Argument::dir_OUT);
+ */
+ int count_arguments_with_direction (int direction_mask);
+
+ virtual int has_native (void);
+ // Any of the arguments or the return value is a <native> type.
+ // This is important because in that case no code should be
+ // generated for the stubs.
+
+ // Narrowing.
+ DEF_NARROW_METHODS2(AST_Operation, AST_Decl, UTL_Scope);
+ DEF_NARROW_FROM_DECL(AST_Operation);
+ DEF_NARROW_FROM_SCOPE(AST_Operation);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Method to add exceptions
+ UTL_ExceptList *be_add_exceptions (UTL_ExceptList *t);
+
+ // Add an argument to the scope.
+ AST_Argument *be_add_argument (AST_Argument *arg);
+
+ // Insert an exception at the head of the list.
+ int be_insert_exception (AST_Exception *ex);
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+private:
+ // Data.
+
+ AST_Type *pd_return_type;
+ // Return type
+
+ Flags pd_flags;
+ // Operation flags
+
+ UTL_StrList *pd_context;
+ // Context
+
+ UTL_ExceptList *pd_exceptions;
+ // Exceptions raised
+
+ int argument_count_;
+ // Number of arguments.
+
+ int has_native_;
+ // Is any argument of type native.
+
+ // Operations.
+
+ int compute_argument_attr (void);
+ // Count the number of arguments.
+
+ // Scope Management Protocol.
+
+ friend int tao_yyparse (void);
+ virtual AST_Argument *fe_add_argument (AST_Argument *a);
+ virtual UTL_StrList *fe_add_context (UTL_StrList *c);
+ virtual UTL_NameList *fe_add_exceptions (UTL_NameList *e);
+};
+
+#endif // _AST_OPERATION_AST_OPERATION_HH
diff --git a/TAO/TAO_IDL/include/ast_predefined_type.h b/TAO/TAO_IDL/include/ast_predefined_type.h
new file mode 100644
index 00000000000..f4ae1f75d20
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_predefined_type.h
@@ -0,0 +1,137 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _AST_PREDEFINED_TYPE_AST_PREDEFINED_TYPE_HH
+#define _AST_PREDEFINED_TYPE_AST_PREDEFINED_TYPE_HH
+
+#include "ast_concrete_type.h"
+
+class ast_visitor;
+
+class TAO_IDL_FE_Export AST_PredefinedType : public virtual AST_ConcreteType
+{
+public:
+ // Enum for all the different predefined types.
+ enum PredefinedType
+ {
+ PT_long // Predefined type "long"
+ , PT_ulong // Predefined type "unsigned long"
+ , PT_longlong // Predefined type "long long"
+ , PT_ulonglong // Predefined type "unsigned long long"
+ , PT_short // Predefined type "short"
+ , PT_ushort // Predefined type "unsigned short"
+ , PT_float // Predefined type "float"
+ , PT_double // Predefined type "double"
+ , PT_longdouble // Predefined type "long double"
+ , PT_char // Predefined type "char"
+ , PT_wchar // Predefined type "CORBA::WChar"
+ , PT_boolean // Predefined type "boolean"
+ , PT_octet // Predefined type "octet"
+ , PT_any // Predefined type "CORBA::Any"
+ , PT_object // Predefined type "CORBA::Object"
+ , PT_value // Predefined type "CORBA::ValueBase"
+ , PT_void // Predefined type "void"
+ , PT_pseudo // Predefined type for pseudo objects
+ };
+
+ // Operations.
+
+ // Constructor(s).
+ AST_PredefinedType (void);
+
+ AST_PredefinedType (PredefinedType t,
+ UTL_ScopedName *n);
+
+ virtual ~AST_PredefinedType (void);
+
+ // Data Accessors.
+ PredefinedType pt (void);
+
+ // Narrowing
+ DEF_NARROW_METHODS1(AST_PredefinedType, AST_ConcreteType);
+ DEF_NARROW_FROM_DECL(AST_PredefinedType);
+
+ // AST Dumping
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // 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.
+
+ const PredefinedType pd_pt;
+ // The specific predefined type.
+};
+
+#endif // _AST_PREDEFINED_TYPE_AST_PREDEFINED_TYPE_HH
diff --git a/TAO/TAO_IDL/include/ast_root.h b/TAO/TAO_IDL/include/ast_root.h
new file mode 100644
index 00000000000..78e44b9e3dc
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_root.h
@@ -0,0 +1,113 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _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:
+ AST_Root (void);
+
+ AST_Root (UTL_ScopedName *n);
+
+ virtual ~AST_Root (void);
+
+ virtual unsigned long nmembers (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_Root, AST_Module);
+ DEF_NARROW_FROM_DECL(AST_Root);
+ DEF_NARROW_FROM_SCOPE(AST_Root);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy ();
+
+ // Final cleanup.
+ void fini (void);
+
+private:
+ friend class FE_Declarator;
+ friend int tao_yyparse (void);
+
+ // Add protocol.
+
+ virtual AST_Sequence *fe_add_sequence (AST_Sequence *s);
+ virtual AST_String *fe_add_string (AST_String *s);
+ virtual AST_Array *fe_add_array (AST_Array *a);
+};
+
+#endif // _AST_ROOT_AST_ROOT_HH
diff --git a/TAO/TAO_IDL/include/ast_sequence.h b/TAO/TAO_IDL/include/ast_sequence.h
new file mode 100644
index 00000000000..3f42238b91e
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_sequence.h
@@ -0,0 +1,136 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _AST_SEQUENCE_AST_SEQUENCE_HH
+#define _AST_SEQUENCE_AST_SEQUENCE_HH
+
+#include "ast_concrete_type.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:
+ AST_Sequence (void);
+
+ AST_Sequence (AST_Expression *max_size,
+ AST_Type *bt,
+ UTL_ScopedName *n,
+ bool local,
+ bool abstract);
+
+ virtual ~AST_Sequence (void);
+
+ virtual bool in_recursion (ACE_Unbounded_Queue<AST_Type *> &list);
+ // Are we or the node represented by node involved in recursion.
+
+ // Data Accessors.
+ AST_Expression *max_size (void);
+
+ AST_Type *base_type (void) const;
+
+ virtual bool unbounded (void) const;
+ // Is this sequence bounded or not.
+
+ // Recursively called on valuetype to check for legal use as
+ // a primary key. Overridden for valuetype, struct, sequence,
+ // union, array, typedef, and interface.
+ virtual bool legal_for_primary_key (void) const;
+
+ // Cleanup method.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_Sequence, AST_ConcreteType);
+ DEF_NARROW_FROM_DECL(AST_Sequence);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+private:
+ // Data.
+ AST_Expression *pd_max_size;
+ // Maximum sequence size.
+
+ AST_Type *pd_base_type;
+ // Sequence base type.
+
+ bool unbounded_;
+ // Whether we are bounded or unbounded.
+
+ bool owns_base_type_;
+ // If our base type is anonymous array or sequence, we're
+ // responsible for destroying it.
+};
+
+#endif // _AST_SEQUENCE_AST_SEQUENCE_HH
diff --git a/TAO/TAO_IDL/include/ast_string.h b/TAO/TAO_IDL/include/ast_string.h
new file mode 100644
index 00000000000..db5a89f1123
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_string.h
@@ -0,0 +1,120 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _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.
+
+class TAO_IDL_FE_Export AST_String : public virtual AST_ConcreteType
+{
+public:
+ // Operations.
+
+ // Constructor(s) and destructor
+ AST_String (void);
+
+ AST_String (AST_Decl::NodeType nt,
+ UTL_ScopedName *n,
+ AST_Expression *max_size,
+ long wide = 1);
+
+ virtual ~AST_String (void);
+
+ // Data Accessors.
+ AST_Expression *max_size (void);
+ long width (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_String, AST_ConcreteType);
+ DEF_NARROW_FROM_DECL(AST_String);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+private:
+ // Data.
+
+ AST_Expression *pd_max_size;
+ // String maximum size.
+
+ long pd_width;
+ // Width of string.
+};
+
+#endif // _AST_STRING_AST_STRING_HH
diff --git a/TAO/TAO_IDL/include/ast_structure.h b/TAO/TAO_IDL/include/ast_structure.h
new file mode 100644
index 00000000000..0bf38a9d74d
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_structure.h
@@ -0,0 +1,192 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _AST_STRUCTURE_AST_STRUCTURE_HH
+#define _AST_STRUCTURE_AST_STRUCTURE_HH
+
+// Representation of structure:
+//
+// NOTE: add (AST_ConcreteType *) is defined here because a structure
+// can contain locally defined types in addition to fields.
+//
+// NOTE: add (AST_EnumValue *) is defined here because enums can
+// be defined manifest locally; the constants defined in these
+// 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:
+ AST_Structure (void);
+
+ AST_Structure (UTL_ScopedName *n,
+ bool local,
+ bool abstract);
+
+ AST_Structure (AST_Decl::NodeType nt,
+ UTL_ScopedName *n,
+ bool local,
+ bool abstract);
+
+ virtual ~AST_Structure (void);
+
+ // This serves for both structs and unions.
+ static void fwd_redefinition_helper (AST_Structure *&i,
+ UTL_Scope *s);
+
+ // Overridden for unions.
+ virtual void redefine (AST_Structure *from);
+
+ // Narrowing.
+ DEF_NARROW_METHODS2(AST_Structure, AST_ConcreteType, UTL_Scope);
+ DEF_NARROW_FROM_DECL(AST_Structure);
+ DEF_NARROW_FROM_SCOPE(AST_Structure);
+
+ virtual int member_count (void);
+ // Return the count of members.
+
+ virtual size_t nfields (void) const;
+ // Return the count of actual fields.
+
+ virtual int field (AST_Field **&result,
+ size_t slot) const;
+ // Get an individual field node.
+
+ virtual bool is_local (void);
+ // Overwrite the is_local method.
+
+ virtual bool in_recursion (ACE_Unbounded_Queue<AST_Type *> &list);
+ // Are we or the node represented by node involved in recursion.
+
+ virtual int contains_wstring (void);
+ // Do we contain a wstring at some nesting level?
+
+ // Is this struct or union defined? This predicate returns FALSE when a
+ // forward declaration is not defined yet, and TRUE in
+ // all other cases.
+ virtual bool is_defined (void);
+
+ // Recursively called on valuetype to check for legal use as
+ // a primary key. Overridden for valuetype, struct, sequence,
+ // union, array, typedef, and interface.
+ virtual bool legal_for_primary_key (void) const;
+
+ // Accessors for the member.
+ AST_StructureFwd *fwd_decl (void) const;
+ void fwd_decl (AST_StructureFwd *node);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+protected:
+ friend int tao_yyparse (void);
+ // Scope Management Protocol.
+
+ virtual AST_Union *fe_add_union (AST_Union *u);
+
+ virtual AST_Structure *fe_add_structure (AST_Structure *s);
+
+ virtual AST_Field *fe_add_field (AST_Field *f);
+
+ virtual AST_Enum *fe_add_enum (AST_Enum *e);
+
+ virtual AST_EnumVal *fe_add_enum_val (AST_EnumVal *v);
+
+ 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
+ // in member_count, i.e., enum values of an enum declared inside
+ // the struct.
+
+private:
+ int compute_member_count (void);
+ // Count the number of members.
+
+ int member_count_;
+ // Number of members.
+
+ int local_struct_;
+ // We also need to determine whether we contain any local type.
+
+ AST_StructureFwd *fwd_decl_;
+ // The forward declaration we may have been created from.
+};
+
+#endif // _AST_STRUCTURE_AST_STRUCTURE_HH
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..5f82c6f485d
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_structure_fwd.h
@@ -0,0 +1,50 @@
+// 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 (AST_Structure *full_defn,
+ UTL_ScopedName *n);
+
+ virtual ~AST_StructureFwd (void);
+
+ AST_Structure *full_definition (void);
+ void set_full_definition (AST_Structure *nfd);
+
+ virtual bool is_defined (void);
+ void set_as_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.
+
+ bool is_defined_;
+ // Checking the member above isn't good enough.
+};
+
+#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
new file mode 100644
index 00000000000..e7c5967b92b
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_type.h
@@ -0,0 +1,190 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _AST_TYPE_AST_TYPE_HH
+#define _AST_TYPE_AST_TYPE_HH
+
+#include "ast_decl.h"
+
+#include "ace/Unbounded_Queue.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.
+
+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.
+
+ AST_Type (void);
+
+ AST_Type (AST_Decl::NodeType nt,
+ UTL_ScopedName *n);
+
+ virtual ~AST_Type (void);
+
+ virtual bool in_recursion (ACE_Unbounded_Queue<AST_Type *> &list);
+ // Determine if we are involved in some kind of limited recursion.
+ // Most types cannot be involved except structs and unions.
+ // If the parameter is 0, we are trying to determine this for ourselves.
+
+ // To be overridden by the subclasses interface, struct, union, and
+ // the corresponding forward declaration classes.
+ virtual 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.
+
+ bool has_constructor (void);
+ // Accessor for protected member.
+
+ void has_constructor (bool value);
+ // Mutator for protected member.
+
+ bool ifr_added (void);
+ void ifr_added (bool val);
+
+ bool ifr_fwd_added (void);
+ void ifr_fwd_added (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.
+
+ AST_Type *unaliased_type (void);
+ // Utility function to make sure we are using the unaliased type.
+
+ virtual bool legal_for_primary_key (void) const;
+ // Recursively called on valuetype to check for legal use as
+ // a primary key. Overridden for valuetype, struct, sequence,
+ // union, array, typedef, and interface.
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_Type, AST_Decl);
+ DEF_NARROW_FROM_DECL(AST_Type);
+
+ // 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.
+
+ bool match_names (AST_Type *t, ACE_Unbounded_Queue<AST_Type *> &list);
+
+protected:
+ // Has the full definition been added to the Interface Repository?
+ // Used for types which can have members and can be forward declared.
+ bool ifr_added_;
+
+ // Has this node been forward declared in this IDL file?
+ bool ifr_fwd_added_;
+
+ SIZE_TYPE size_type_;
+ // Whether we are fixed or variable size (by default fixed).
+
+ 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.
+
+ long in_recursion_;
+ // Storage once the value has been computed.
+
+ mutable bool recursing_in_legal_pk_;
+ // Node-specific flag to abort recursion in legal_for_primary_key().
+};
+
+#endif // _AST_TYPE_AST_TYPE_HH
diff --git a/TAO/TAO_IDL/include/ast_typedef.h b/TAO/TAO_IDL/include/ast_typedef.h
new file mode 100644
index 00000000000..d21987bce57
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_typedef.h
@@ -0,0 +1,133 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _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.
+
+class TAO_IDL_FE_Export AST_Typedef : public virtual AST_Type
+{
+public:
+ // Operations.
+
+ // Constructor(s) and destructor.
+ AST_Typedef (void);
+
+ AST_Typedef (AST_Type *base_type,
+ UTL_ScopedName *n,
+ bool local,
+ bool abstract);
+
+ virtual ~AST_Typedef (void);
+
+ AST_Type *primitive_base_type (void) const;
+ // Return the most primitive base type by traversing the chain of typedefed
+ // base types.
+
+ // Data Accessors.
+ AST_Type *base_type (void) const;
+
+ virtual bool legal_for_primary_key (void) const;
+ // Recursively called on valuetype to check for legal use as
+ // a primary key. Overridden for valuetype, struct, sequence,
+ // union, array, typedef, and interface.
+
+ virtual bool is_local (void);
+ // Override the base class method.
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_Typedef, AST_Type);
+ DEF_NARROW_FROM_DECL(AST_Typedef);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // 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.
+
+ AST_Type *pd_base_type;
+ // Typedef base type.
+
+ bool owns_base_type_;
+ // If our base type is anonymous array or sequence, we're
+ // responsible for destroying it.
+};
+
+#endif // _AST_TYPEDEF_AST_TYPEDEF_HH
diff --git a/TAO/TAO_IDL/include/ast_union.h b/TAO/TAO_IDL/include/ast_union.h
new file mode 100644
index 00000000000..e412e49ea60
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_union.h
@@ -0,0 +1,202 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _AST_UNION_AST_UNION_HH
+#define _AST_UNION_AST_UNION_HH
+
+#include "ast_structure.h"
+
+// NOTE: add (AST_ConcreteType *) is defined here because a union
+// can contain locally defined types in addition to fields.
+//
+// NOTE: add (AST_EnumValue *) is defined here because enums can
+// be defined manifest locally; the constants defined in these
+// enums are inserted in the enclosing scope. It is unlikely that
+// a BE writer will need to overload this function in AST_Union.
+
+class TAO_IDL_FE_Export AST_Union : public virtual AST_Structure
+{
+public:
+ // Operations.
+
+ // Constructor(s).
+ AST_Union (void);
+
+ AST_Union (AST_ConcreteType *disc_type,
+ UTL_ScopedName *n,
+ bool local,
+ bool abstract);
+
+ // Destructor.
+ virtual ~AST_Union (void);
+
+ // This also calls the base class version.
+ virtual void redefine (AST_Structure *from);
+
+ virtual bool in_recursion (ACE_Unbounded_Queue<AST_Type *> &list);
+ // Are we or the parameter node involved in some kind of recursion?
+
+ // Data Accessors.
+
+ AST_ConcreteType *disc_type (void);
+
+ AST_Expression::ExprType udisc_type (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_Union, AST_Structure);
+ DEF_NARROW_FROM_DECL(AST_Union);
+ DEF_NARROW_FROM_SCOPE(AST_Union);
+
+ struct DefaultValue
+ {
+ union PermittedTypes
+ {
+ char char_val;
+ ACE_CDR::WChar wchar_val;
+ bool bool_val;
+ ACE_INT16 short_val;
+ ACE_UINT16 ushort_val;
+ ACE_INT32 long_val;
+ ACE_UINT32 ulong_val;
+ ACE_UINT32 enum_val;
+ // TO-DO - handle (u)longlong types.
+ } u;
+ long computed_;
+ // computed == -1 => error condition
+ // == 0 => does not exist because all cases have been covered
+ // == 1 => already computed
+ // == -2 => initial value
+ };
+
+ int default_value (DefaultValue &);
+ // Get the default value.
+
+ virtual int default_index (void);
+ // Return the default index used.
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &);
+
+ // 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.
+
+ AST_ConcreteType *pd_disc_type;
+ // Discriminator type.
+
+ AST_Expression::ExprType pd_udisc_type;
+ // Its expression type.
+ // Convention: udisc_type == EV_enum denotes an enum value.
+
+ // Operations.
+
+ // Look up a branch by node pointer.
+ AST_UnionBranch *lookup_branch (AST_UnionBranch *branch);
+
+ // Look up the branch with the "default" label.
+ AST_UnionBranch *lookup_default (void);
+
+ // Look up a branch given a branch with a label. This is used to
+ // check for duplicate labels.
+ AST_UnionBranch *lookup_label (AST_UnionBranch *b);
+
+ // Look up a union branch given an enumerator. This is used to
+ // check for duplicate enum labels.
+ AST_UnionBranch *lookup_enum (AST_UnionBranch *b);
+
+ friend int tao_yyparse (void);
+ // Scope Management Protocol.
+
+ virtual AST_Union *fe_add_union (AST_Union *u);
+
+ virtual AST_UnionBranch *fe_add_union_branch (AST_UnionBranch *b);
+
+ virtual AST_Structure *fe_add_structure (AST_Structure *s);
+
+ virtual AST_Enum *fe_add_enum (AST_Enum *e);
+
+ virtual AST_EnumVal *fe_add_enum_val (AST_EnumVal *v);
+
+ virtual int compute_default_value (void);
+ // Compute the default value (if any).
+
+ int compute_default_index (void);
+ // Count the default index.
+
+ DefaultValue default_value_;
+ // Default value (if any).
+
+ int default_index_;
+ // Default label index (zero based indexing).
+};
+
+#endif // _AST_UNION_AST_UNION_HH
diff --git a/TAO/TAO_IDL/include/ast_union_branch.h b/TAO/TAO_IDL/include/ast_union_branch.h
new file mode 100644
index 00000000000..ed075ecbe45
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_union_branch.h
@@ -0,0 +1,124 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _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;
+class AST_Union;
+
+// Representation of union branch declaration.
+// A branch of a union is a field with a label.
+
+class TAO_IDL_FE_Export AST_UnionBranch : public virtual AST_Field
+{
+public:
+ // Operations.
+
+ // Constructor(s) and destructor.
+ AST_UnionBranch (void);
+
+ AST_UnionBranch (UTL_LabelList *ll,
+ AST_Type *ft,
+ UTL_ScopedName *n);
+
+ virtual ~AST_UnionBranch (void);
+
+ // Data Accessors.
+ AST_UnionLabel *label (unsigned long index = 0);
+
+ unsigned long label_list_length (void);
+
+ // Called if our labels are enum values - adds them the
+ // enclosing scope's name_referenced list.
+ void add_labels (AST_Union *u);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1 (AST_UnionBranch, AST_Field);
+ DEF_NARROW_FROM_DECL (AST_UnionBranch);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+private:
+ // Data.
+
+ UTL_LabelList *pd_ll;
+ // list of labels.
+};
+
+#endif // _AST_UNION_BRANCH_AST_UNION_BRAN_HH
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..6dab33c7429
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_union_fwd.h
@@ -0,0 +1,37 @@
+// 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_structure_fwd.h"
+
+class AST_Union;
+
+// Representation of a forward union declaration.
+
+class TAO_IDL_FE_Export AST_UnionFwd : public virtual AST_StructureFwd
+{
+public:
+ AST_UnionFwd (void);
+
+ AST_UnionFwd (AST_Union *dummy,
+ UTL_ScopedName *n);
+
+ virtual ~AST_UnionFwd (void);
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_UnionFwd, AST_StructureFwd);
+ DEF_NARROW_FROM_DECL(AST_UnionFwd);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+};
+
+#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
new file mode 100644
index 00000000000..580c90d2a2f
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_union_label.h
@@ -0,0 +1,118 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _AST_UNION_LABEL_AST_UNION_LABEL_HH
+#define _AST_UNION_LABEL_AST_UNION_LABEL_HH
+
+#include "TAO_IDL_FE_Export.h"
+#include "ace/iosfwd.h"
+
+class AST_Expression;
+class ast_visitor;
+
+// Defines labels for unions.
+
+class TAO_IDL_FE_Export AST_UnionLabel
+{
+public:
+ // Define kind of label.
+ enum UnionLabel
+ {
+ UL_default
+ , UL_label
+ };
+
+ AST_UnionLabel (void);
+
+ AST_UnionLabel (UnionLabel lk,
+ AST_Expression *lv);
+
+ virtual ~AST_UnionLabel (void);
+
+ UnionLabel label_kind (void);
+
+ AST_Expression *label_val (void);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+private:
+ // Data.
+
+ UnionLabel pd_label_kind;
+ // Label kind.
+
+ AST_Expression *pd_label_val;
+ // Label expression.
+};
+
+#endif // _AST_UNION_LABEL_AST_UNION_LABEL_HH
diff --git a/TAO/TAO_IDL/include/ast_valuebox.h b/TAO/TAO_IDL/include/ast_valuebox.h
new file mode 100644
index 00000000000..52f5e22a55f
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_valuebox.h
@@ -0,0 +1,41 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+#ifndef _AST_VALUEBOX_AST_VALUEBOX_HH
+#define _AST_VALUEBOX_AST_VALUEBOX_HH
+
+#include "ast_concrete_type.h"
+
+class TAO_IDL_FE_Export AST_ValueBox : public virtual AST_ConcreteType
+{
+public:
+
+ // Constructor(s) and destructor.
+ AST_ValueBox (void);
+
+ AST_ValueBox (UTL_ScopedName *n,
+ AST_Type *boxed_type);
+
+ virtual ~AST_ValueBox (void);
+
+ // Data Accessors.
+ AST_Type *boxed_type (void) const;
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_ValueBox, AST_ConcreteType);
+ DEF_NARROW_FROM_DECL(AST_ValueBox);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+protected:
+ AST_Type *pd_boxed_type;
+};
+
+#endif // _AST_VALUEBOX_AST_VALUEBOX_HH
diff --git a/TAO/TAO_IDL/include/ast_valuetype.h b/TAO/TAO_IDL/include/ast_valuetype.h
new file mode 100644
index 00000000000..8283d388664
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_valuetype.h
@@ -0,0 +1,85 @@
+// 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,
+ bool abstract,
+ bool truncatable,
+ bool custom);
+
+ 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;
+
+ bool truncatable (void) const;
+ bool custom (void) const;
+
+ virtual bool will_have_factory (void);
+ // Called from y.tab.cpp to set the factory decl seen bit.
+
+ // Look up a scoped name in the supported interface list.
+ virtual AST_Decl *look_in_supported (UTL_ScopedName *,
+ bool treat_as_ref);
+
+ // Recursively called on valuetype to check for legal use as
+ // a primary key. Overridden for valuetype, struct, sequence,
+ // union, array, typedef, and interface.
+ virtual bool legal_for_primary_key (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;
+
+ bool pd_truncatable;
+ bool pd_custom;
+
+protected:
+ virtual AST_Factory *fe_add_factory (AST_Factory *f);
+ bool derived_from_primary_key_base (const AST_ValueType *node,
+ const AST_ValueType *pk_base) const;
+ AST_ValueType *lookup_primary_key_base (void) const;
+};
+
+#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
new file mode 100644
index 00000000000..1fbb566a744
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_visitor.h
@@ -0,0 +1,196 @@
+// $Id$
+
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO_IDL_FE_DLL
+//
+// = FILENAME
+// ast_visitor.h
+//
+// = DESCRIPTION
+// The abstract AST visitor base class.
+//
+// = AUTHOR
+// Jeff Parsons <parsons@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef TAO_IDL_FE_DLL_AST_VISITOR_H
+#define TAO_IDL_FE_DLL_AST_VISITOR_H
+
+#include "TAO_IDL_FE_Export.h"
+
+class AST_Decl;
+class UTL_Scope;
+class AST_Type;
+class AST_PredefinedType;
+class AST_Module;
+class AST_Interface;
+class AST_InterfaceFwd;
+class AST_ValueBox;
+class AST_ValueType;
+class AST_ValueTypeFwd;
+class AST_Component;
+class AST_ComponentFwd;
+class AST_EventType;
+class AST_EventTypeFwd;
+class AST_Home;
+class AST_Factory;
+class AST_Structure;
+class AST_StructureFwd;
+class AST_Exception;
+class AST_Expression;
+class AST_Enum;
+class AST_Operation;
+class AST_Field;
+class AST_Argument;
+class AST_Attribute;
+class AST_Union;
+class AST_UnionFwd;
+class AST_UnionBranch;
+class AST_UnionLabel;
+class AST_Constant;
+class AST_EnumVal;
+class AST_Array;
+class AST_Sequence;
+class AST_String;
+class AST_Typedef;
+class AST_Root;
+class AST_Native;
+
+class TAO_IDL_FE_Export ast_visitor
+{
+ //
+ // = TITLE
+ // ast_visitor.
+ //
+ // = DESCRIPTION
+ // To implement BE processing we use the "Visitor Pattern", this
+ // is the abstract "Visitor". This class is the abstract base class
+ // for visitors that traverse the AST_<node> classes. Other abstract
+ // classes for C++ code generation, Java code generation, or IfR
+ // administration, for example, can be derived from this class and
+ // be the root of their own subtree of specialized visitor classes.
+ //
+public:
+ ast_visitor (void);
+ // Constructor.
+
+ virtual ~ast_visitor (void);
+ // Destructor.
+
+ virtual int visit_decl (AST_Decl *d) = 0;
+ // Visit a decl node.
+
+ virtual int visit_scope (UTL_Scope *node) = 0;
+ // Visit the scope
+
+ virtual int visit_type (AST_Type *node) = 0;
+ // Visit the type.
+
+ virtual int visit_predefined_type (AST_PredefinedType *node) = 0;
+ // Visit the predefined type.
+
+ virtual int visit_module (AST_Module *node) = 0;
+ // Visit module.
+
+ virtual int visit_interface (AST_Interface *node) = 0;
+ // Visit interface.
+
+ virtual int visit_interface_fwd (AST_InterfaceFwd *node) = 0;
+ // Visit interface_fwd
+
+ 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 component.
+
+ virtual int visit_home (AST_Home *node) = 0;
+ // Visit home.
+
+ virtual int visit_component_fwd (AST_ComponentFwd *node) = 0;
+ // Visit component_fwd
+
+ virtual int visit_eventtype (AST_EventType *node) = 0;
+ // Visit eventtype.
+
+ virtual int visit_eventtype_fwd (AST_EventTypeFwd *node) = 0;
+ // Visit eventtype_fwd
+
+ virtual int visit_factory (AST_Factory *node) = 0;
+ // Visit a OBV factory construct.
+
+ 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
+
+ virtual int visit_expression (AST_Expression *node) = 0;
+ // Visit expression.
+
+ virtual int visit_enum (AST_Enum *node) = 0;
+ // Visit an enum.
+
+ virtual int visit_operation (AST_Operation *node) = 0;
+ // Visit an operation.
+
+ virtual int visit_field (AST_Field *node) = 0;
+ // Visit a field.
+
+ virtual int visit_argument (AST_Argument *node) = 0;
+ // Visit argument.
+
+ virtual int visit_attribute (AST_Attribute *node) = 0;
+ // Visit an attribute.
+
+ 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.
+
+ virtual int visit_union_label (AST_UnionLabel *node) = 0;
+ // Visit union label.
+
+ virtual int visit_constant (AST_Constant *node) = 0;
+ // Visit a constant.
+
+ virtual int visit_enum_val (AST_EnumVal *node) = 0;
+ // Visit enum val.
+
+ virtual int visit_array (AST_Array *node) = 0;
+ // Visit an array.
+
+ virtual int visit_sequence (AST_Sequence *node) = 0;
+ // Visit a sequence.
+
+ virtual int visit_string (AST_String *node) = 0;
+ // Visit a string.
+
+ virtual int visit_typedef (AST_Typedef *node) = 0;
+ // Visit a typedef.
+
+ virtual int visit_root (AST_Root *node) = 0;
+ // Visit a root.
+
+ virtual int visit_native (AST_Native *node) = 0;
+ // Visit a native.
+
+ virtual int visit_valuebox (AST_ValueBox *node) = 0;
+ // Visit a valuebox.
+};
+
+#endif /* TAO_IDL_FE_DLL_AST_VISITOR_H */
diff --git a/TAO/TAO_IDL/include/drv_extern.h b/TAO/TAO_IDL/include/drv_extern.h
new file mode 100644
index 00000000000..6a4ec26b63b
--- /dev/null
+++ b/TAO/TAO_IDL/include/drv_extern.h
@@ -0,0 +1,87 @@
+// $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_EXTERN_DRV_EXTERN_HH
+#define _DRV_EXTERN_DRV_EXTERN_HH
+
+// The ACE_Process_Options default size of 1024 is sometimes not enough.
+const unsigned long TAO_IDL_COMMAND_LINE_BUFFER_SIZE = 4 * 1024;
+
+// 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_store_env_include_paths (void);
+extern void DRV_cpp_init (void);
+extern void DRV_cpp_post_init (void);
+extern void DRV_cpp_putarg (const char *str);
+extern void DRV_cpp_new_location (char *new_loc);
+extern void DRV_get_orb_idl_includes (void);
+
+// Not used by all backends.
+extern void DRV_push_file (const char *s);
+
+#endif // _DRV_EXTERN_DRV_EXTERN_HH
diff --git a/TAO/TAO_IDL/include/fe_declarator.h b/TAO/TAO_IDL/include/fe_declarator.h
new file mode 100644
index 00000000000..e34495f5d9e
--- /dev/null
+++ b/TAO/TAO_IDL/include/fe_declarator.h
@@ -0,0 +1,112 @@
+// $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 _FE_DECLARATOR_FE_DECLARATOR_HH
+#define _FE_DECLARATOR_FE_DECLARATOR_HH
+
+#include "utl_scoped_name.h"
+
+class AST_Decl;
+class AST_Type;
+
+class FE_Declarator
+{
+public:
+ // Enum to denote types of declarators.
+ enum DeclaratorType
+ {
+ FD_simple, // Simple declarator
+ FD_complex // Complex declarator (complex_part field used)
+ };
+
+ // Operations.
+
+ // Constructor and destructor.
+ FE_Declarator (UTL_ScopedName *n,
+ DeclaratorType dt,
+ AST_Decl *cp);
+ virtual ~FE_Declarator (void) {}
+
+ // Data Accessors.
+ AST_Decl *complex_part (void);
+ UTL_ScopedName *name (void);
+ DeclaratorType decl_type (void);
+
+ // Other Operations.
+
+ // 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.
+ AST_Decl *pd_complex_part; // If a complex declarator
+ UTL_ScopedName *pd_name; // The name if complex
+ DeclaratorType pd_decl_type; // Whether complex or simple
+};
+
+#endif // _FE_DECLARATOR_FE_DECLARATOR_HH
diff --git a/TAO/TAO_IDL/include/fe_extern.h b/TAO/TAO_IDL/include/fe_extern.h
new file mode 100644
index 00000000000..e75f5b90ca3
--- /dev/null
+++ b/TAO/TAO_IDL/include/fe_extern.h
@@ -0,0 +1,108 @@
+// $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 _FE_EXTERN_FE_EXTERN_HH
+#define _FE_EXTERN_FE_EXTERN_HH
+
+#include "TAO_IDL_FE_Export.h"
+#include "ace/SString.h"
+
+// Declares all global functions for the FE
+
+TAO_IDL_FE_Export void FE_init (void);
+TAO_IDL_FE_Export void FE_populate (void);
+TAO_IDL_FE_Export void FE_store_env_include_paths (void);
+TAO_IDL_FE_Export const char *FE_get_cpp_loc_from_env (void);
+TAO_IDL_FE_Export const char *FE_get_cpp_args_from_env (void);
+
+class File;
+
+TAO_IDL_FE_Export int
+FE_yyparse (void);
+
+TAO_IDL_FE_Export void
+FE_set_yyin (File *); // Set yyin
+
+// Interface to constructors for objects need by the driver
+
+class UTL_Error;
+class UTL_Indenter;
+
+TAO_IDL_FE_Export UTL_Error *
+FE_new_UTL_Error (void);
+
+TAO_IDL_FE_Export UTL_Indenter *
+FE_new_UTL_Indenter (void);
+
+// Exception thrown when exiting prematurely in the front end.
+// Also used when command line options limit the output to
+// usage, version or preprocessed files. Catch block is just
+// before front end cleanup and exit.
+class TAO_IDL_FE_Export FE_Bailout
+{
+};
+
+#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
new file mode 100644
index 00000000000..a3ecb1d9e9c
--- /dev/null
+++ b/TAO/TAO_IDL/include/fe_interface_header.h
@@ -0,0 +1,252 @@
+// $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 _FE_INTERFACE_HEADER_FE_INTERFACE_HH
+#define _FE_INTERFACE_HEADER_FE_INTERFACE_HH
+
+#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.
+//
+// FE_component_header
+// Internal class for FE to describe component headers.
+
+class TAO_IDL_FE_Export FE_InterfaceHeader
+{
+public:
+ FE_InterfaceHeader (UTL_ScopedName *n,
+ UTL_NameList *inherits,
+ bool is_local,
+ bool is_abstract,
+ bool compile_now);
+
+ virtual ~FE_InterfaceHeader (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;
+
+ bool is_local (void) const;
+ // See if we are a local interface.
+
+ bool is_abstract (void) const;
+ // See if we are an abstract interface.
+
+ void destroy (void);
+ // Destroy anything allocated for this class.
+
+ // Data.
+protected:
+ 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;
+ long pd_n_inherits_flat;
+
+ bool pd_is_local;
+ bool pd_is_abstract;
+
+ // Operations.
+
+ // Compile the flattened unique list of interfaces which this
+ // interface inherits from.
+protected:
+ void compile_inheritance (UTL_NameList *ifaces,
+ bool for_valuetype);
+
+ void compile_one_inheritance (AST_Interface *i);
+
+ // Called from compile_inheritance().
+ int check_inherit (AST_Interface *i,
+ bool for_valuetype);
+};
+
+class TAO_IDL_FE_Export FE_OBVHeader : public FE_InterfaceHeader
+{
+public:
+
+ FE_OBVHeader (UTL_ScopedName *n,
+ UTL_NameList *inherits,
+ UTL_NameList *supports,
+ bool truncatable,
+ bool is_eventtype = false);
+ 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;
+ 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.
+ bool pd_truncatable;
+
+protected:
+ void compile_inheritance (UTL_NameList *vtypes,
+ bool is_eventtype);
+ void compile_supports (UTL_NameList *supports);
+ bool check_concrete_supported_inheritance (AST_Interface *d);
+};
+
+class TAO_IDL_FE_Export FE_EventHeader : public FE_OBVHeader
+{
+public:
+
+ FE_EventHeader (UTL_ScopedName *n,
+ UTL_NameList *inherits,
+ UTL_NameList *supports,
+ bool truncatable);
+ virtual ~FE_EventHeader (void);
+};
+
+// 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 TAO_IDL_FE_Export FE_ComponentHeader : public FE_InterfaceHeader
+{
+public:
+
+ FE_ComponentHeader (UTL_ScopedName *n,
+ UTL_ScopedName *base_component,
+ UTL_NameList *supports,
+ 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:
+ void compile_inheritance (UTL_ScopedName *base_component);
+ void compile_supports (UTL_NameList *supports);
+
+protected:
+ AST_Component *pd_base_component;
+};
+
+// 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 TAO_IDL_FE_Export FE_HomeHeader : public FE_ComponentHeader
+{
+public:
+
+ 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.
+ AST_Home *base_home (void) const;
+ AST_Component *managed_component (void) const;
+ AST_ValueType *primary_key (void) const;
+
+protected:
+ AST_Home *pd_base_home;
+ AST_Component *pd_managed_component;
+ AST_ValueType *pd_primary_key;
+
+protected:
+ void compile_inheritance (UTL_ScopedName *base_home);
+ void compile_managed_component (UTL_ScopedName *managed_compoent);
+ void compile_primary_key (UTL_ScopedName *primary_key);
+};
+
+#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
new file mode 100644
index 00000000000..0c975ff65b2
--- /dev/null
+++ b/TAO/TAO_IDL/include/fe_private.h
@@ -0,0 +1,92 @@
+// $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 _FE_FE_HH
+#define _FE_FE_HH
+
+#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
+{
+ const char *keyword_;
+ const char *mapping_;
+};
+
+class TAO_IDL_FE_Export TAO_IDL_CPP_Keyword_Table
+{
+ // = TITLE
+ // 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);
+public:
+ 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
new file mode 100644
index 00000000000..1f10dabf63e
--- /dev/null
+++ b/TAO/TAO_IDL/include/global_extern.h
@@ -0,0 +1,87 @@
+// $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 _GLOBAL_EXTERN_GLOBAL_EXTERN_HH
+#define _GLOBAL_EXTERN_GLOBAL_EXTERN_HH
+
+#include "TAO_IDL_FE_Export.h"
+#include "idl_global.h"
+
+
+class AST_Decl;
+
+// global_extern.hh - Global data for the IDL compiler
+
+extern TAO_IDL_FE_Export IDL_GlobalData *idl_global;
+// Contains all "global" data
+
+// Global functions for the IDL compiler
+
+// Return TRUE when the name of this AST_Decl can be reused in
+// a definition in this scope
+extern bool can_be_redefined (AST_Decl *);
+
+#endif // _GLOBAL_EXTERN_GLOBAL_EXTERN_HH
diff --git a/TAO/TAO_IDL/include/idl_defines.h b/TAO/TAO_IDL/include/idl_defines.h
new file mode 100644
index 00000000000..ddc497d86a2
--- /dev/null
+++ b/TAO/TAO_IDL/include/idl_defines.h
@@ -0,0 +1,98 @@
+// $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_DEFINES_IDL_DEFINES_HH
+#define _IDL_DEFINES_IDL_DEFINES_HH
+
+#include "ace/os_include/os_limits.h"
+
+/*
+ * idl_defines.hh - Defines global compiler flags
+ */
+
+// This cannot be an enum since more than one value may be active at
+// a given time, hence bitflags are #define'd instead
+
+// HP-UX 64-bit warns that the result of '<<' is widened from an int to long.
+// They are assumed to be of type long within the tao_idl and IFR code.
+
+#define IDL_CF_VERSION (long)(1 << 0)
+#define IDL_CF_DUMP_AST (long)(1 << 1)
+#define IDL_CF_ONLY_PREPROC (long)(1 << 2)
+#define IDL_CF_ONLY_USAGE (long)(1 << 3)
+#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.
+
+#define SUN_IDL_FE_VERSION "1.3.0"
+
+#if !defined (NFILES)
+# define NFILES 1024
+#endif /* ! NFILES */
+
+#endif // _IDL_DEFINES_IDL_DEFINES_HH
diff --git a/TAO/TAO_IDL/include/idl_global.h b/TAO/TAO_IDL/include/idl_global.h
new file mode 100644
index 00000000000..ce7da6087c1
--- /dev/null
+++ b/TAO/TAO_IDL/include/idl_global.h
@@ -0,0 +1,703 @@
+// $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_GLOBAL_HH
+#define _IDL_IDL_GLOBAL_HH
+
+// May of them could be forward declared..
+#include "ace/SString.h"
+#include "ace/Hash_Map_Manager_T.h"
+#include "ace/Containers_T.h"
+#include "ace/Synch_Traits.h"
+#include "ace/Null_Mutex.h"
+
+#include "ast_expression.h"
+#include "ast_predefined_type.h"
+#include "ast_component.h"
+#include "utl_stack.h"
+
+class AST_Root;
+class AST_Generator;
+class UTL_Error;
+class UTL_String;
+class UTL_Indenter;
+
+// idl_global.hh
+//
+// Defines a class containing all front end global data.
+
+class TAO_IDL_FE_Export IDL_GlobalData
+{
+public:
+ // Types
+
+ // The ParseState type encodes the state of the Yacc parser so that
+ // better error messages can be produced, and for use by BEs in situations
+ // where context sensitive behavior is required
+ enum ParseState {
+ PS_NoState // No state
+ , 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_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_InterfaceForwardSeen // Forward interface decl seen
+ , PS_InterfaceSqSeen // '{' seen for interface
+ , PS_InterfaceQsSeen // '}' seen for interface
+ , PS_InterfaceBodySeen // Seen an interface body
+ , 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_EventTypeSeen // Seen a EVENTTYPE keyword
+ , PS_EventTypeForwardSeen // Forward eventtype decl seen
+ , PS_EventTypeIDSeen // Seen the eventtype ID
+ , PS_EventTypeSqSeen // '{' seen for event type
+ , PS_EventTypeQsSeen // '}' seen for event type
+ , PS_EventTypeBodySeen // Seen a event 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
+ , PS_ScopeDelimSeen // Seen a scope delim as party of a scoped name
+ , PS_ConstSeen // Seen a CONST keyword
+ , PS_ConstTypeSeen // Parsed the type of a constant
+ , PS_ConstIDSeen // Seen the constant ID
+ , PS_ConstAssignSeen // Seen the '='
+ , PS_ConstExprSeen // Seen the constant value expression
+ , PS_TypedefSeen // Seen a TYPEDEF keyword
+ , PS_TypeSpecSeen // Seen a complete type specification
+ , PS_DeclaratorsSeen // Seen a complete list of declarators
+ , PS_StructSeen // Seen a STRUCT keyword
+ , PS_StructIDSeen // Seen the struct ID
+ , 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
+ , PS_SwitchCloseParSeen // Seen the switch close par.
+ , PS_UnionSqSeen // '{' seen for union
+ , PS_UnionQsSeen // '}' seen for union
+ , PS_DefaultSeen // Seen DEFAULT keyword
+ , PS_UnionLabelSeen // Seen label of union element
+ , PS_LabelColonSeen // Seen ':' of union branch label
+ , PS_LabelExprSeen // Seen expression of union branch label
+ , PS_UnionElemSeen // Seen a union element
+ , PS_UnionElemCompleted // Completed one union member up to ';'
+ , PS_CaseSeen // Seen a CASE keyword
+ , PS_UnionElemTypeSeen // Seen type spec for union element
+ , PS_UnionElemDeclSeen // Seen declarator for union element
+ , PS_UnionBodySeen // Seen completed union body
+ , PS_EnumSeen // Seen an ENUM keyword
+ , PS_EnumIDSeen // Seen the enum ID
+ , PS_EnumSqSeen // Seen '{' for enum
+ , PS_EnumQsSeen // Seen '}' for enum
+ , PS_EnumBodySeen // Seen complete enum body
+ , PS_EnumCommaSeen // Seen ',' in list of enumerators
+ , PS_SequenceSeen // Seen a SEQUENCE keyword
+ , PS_SequenceSqSeen // Seen '<' for sequence
+ , PS_SequenceQsSeen // Seen '>' for sequence
+ , PS_SequenceTypeSeen // Seen type decl for sequence
+ , PS_SequenceCommaSeen // Seen comma for sequence
+ , PS_SequenceExprSeen // Seen size expression for sequence
+ , PS_StringSeen // Seen a STRING keyword
+ , PS_StringSqSeen // Seen '<' for string
+ , PS_StringQsSeen // Seen '>' for string
+ , PS_StringExprSeen // Seen size expression for string
+ , PS_StringCompleted // Seen a string decl without size spec
+ , PS_ArrayIDSeen // Seen array ID
+ , PS_ArrayCompleted // Seen completed array declaration
+ , PS_DimSqSeen // Seen '[' for array dimension
+ , PS_DimQsSeen // Seen ']' for array dimension
+ , PS_DimExprSeen // Seen size expression for array dimension
+ , PS_AttrROSeen // Seen READONLY keyword
+ , PS_AttrSeen // Seen ATTRIBUTE keyword
+ , PS_AttrTypeSeen // Seen type decl for attribute
+ , PS_AttrDeclsSeen // Seen declarators for attribute
+ , PS_AttrCompleted // Seen complete attribute declaration
+ , PS_ExceptSeen // Seen EXCEPTION keyword
+ , PS_ExceptIDSeen // Seen exception identifier
+ , PS_ExceptSqSeen // Seen '{' for exception
+ , PS_ExceptQsSeen // Seen '}' for exception
+ , PS_ExceptBodySeen // Seen complete exception body
+ , PS_OpAttrSeen // Seen operation attribute
+ , PS_OpTypeSeen // Seen operation return type
+ , PS_OpIDSeen // Seen operation ID
+ , PS_OpParsCompleted // Completed operation param list
+ , PS_OpRaiseCompleted // Completed operation except list
+ , PS_OpGetRaiseCompleted // Completed attribute get except list
+ , PS_OpSetRaiseCompleted // Completed attribute set except list
+ , PS_OpContextCompleted // Completed operation context spec
+ , PS_OpCompleted // Completed operation statement
+ , PS_OpSqSeen // Seen '(' for operation
+ , PS_OpQsSeen // Seen ')' for operation
+ , PS_OpParCommaSeen // Seen ',' in list of op params
+ , PS_OpParDirSeen // Seen parameter direction
+ , PS_OpParTypeSeen // Seen parameter type
+ , PS_OpParDeclSeen // Seen parameter declaration
+ , PS_OpRaiseSeen // Seen RAISES keyword
+ , PS_OpRaiseSqSeen // Seen '(' for RAISES
+ , PS_OpRaiseQsSeen // Seen ')' for RAISES
+ , PS_OpGetRaiseSeen // Seen GETRAISES keyword
+ , PS_OpGetRaiseSqSeen // Seen '(' for GETRAISES
+ , PS_OpGetRaiseQsSeen // Seen ')' for GETRAISES
+ , PS_OpSetRaiseSeen // Seen SETRAISES keyword
+ , PS_OpSetRaiseSqSeen // Seen '(' for SETRAISES
+ , PS_OpSetRaiseQsSeen // Seen ')' for SETRAISES
+ , PS_OpContextSeen // Seen CONTEXT keyword
+ , PS_OpContextSqSeen // Seen '(' for CONTEXT
+ , PS_OpContextQsSeen // Seen ')' for CONTEXT
+ , PS_OpContextCommaSeen // Seen ',' for CONTEXT
+ , PS_DeclsCommaSeen // Seen ',' in declarators list
+ , PS_DeclsDeclSeen // Seen complete decl in decls list
+ , PS_NativeSeen // Seen a native declaration
+ , PS_PragmaPrefixSyntax // Could not parse the #pragma prefix
+ , PS_ValueBoxDeclSeen // Seen complete valuebox declaration
+ };
+
+ // flags for types of declarations seen while parsing.
+ bool abstract_iface_seen_;
+ bool aggregate_seen_;
+ bool ambiguous_type_seen_;
+ bool any_arg_seen_;
+ bool any_seen_;
+ bool any_seq_seen_;
+ bool array_seen_;
+ bool array_seq_seen_;
+ bool base_object_seen_;
+ bool basic_arg_seen_;
+ bool basic_type_seen_;
+ bool bd_string_arg_seen_;
+ bool boolean_seq_seen_;
+ bool char_seq_seen_;
+ bool double_seq_seen_;
+ bool enum_seen_;
+ bool exception_seen_;
+ bool fixed_array_arg_seen_;
+ bool fixed_size_arg_seen_;
+ bool float_seq_seen_;
+ bool fwd_iface_seen_;
+ bool fwd_valuetype_seen_;
+ bool iface_seq_seen_;
+ bool interface_seen_;
+ bool local_iface_seen_;
+ bool long_seq_seen_;
+ bool longdouble_seq_seen_;
+ bool longlong_seq_seen_;
+ bool non_local_iface_seen_;
+ bool non_local_op_seen_;
+ bool object_arg_seen_;
+ bool octet_seq_seen_;
+ bool operation_seen_;
+ bool pseudo_seq_seen_;
+ bool recursive_type_seen_;
+ bool seq_seen_;
+ bool short_seq_seen_;
+ bool special_basic_arg_seen_;
+ bool string_seen_;
+ bool string_member_seen_;
+ bool string_seq_seen_;
+ bool typecode_seen_;
+ bool ub_string_arg_seen_;
+ bool ulong_seq_seen_;
+ bool ulonglong_seq_seen_;
+ bool union_seen_;
+ bool ushort_seq_seen_;
+ bool valuebase_seen_;
+ bool valuefactory_seen_;
+ bool valuetype_seen_;
+ bool var_array_arg_seen_;
+ bool var_size_arg_seen_;
+ bool vt_seq_seen_;
+ bool wchar_seq_seen_;
+ bool wstring_seq_seen_;
+
+ // flag to force generation of skeleton includes (see bug #2419).
+ bool need_skeleton_includes_;
+
+ // Constructor
+ IDL_GlobalData (void);
+ // Destructor
+ virtual ~IDL_GlobalData (void);
+
+ // Operations
+ virtual UTL_ScopeStack &scopes (void); // Scopes stack
+
+ virtual AST_Root *root (void); // Root of AST
+ virtual void set_root (AST_Root *); // Set it
+
+ virtual AST_Generator *gen (void); // Generator
+ virtual void set_gen (AST_Generator *); // Set it
+
+ virtual AST_ValueType *primary_key_base (void); // PrimaryKeyBase
+ virtual void primary_key_base (AST_ValueType *); // Set it
+
+ virtual UTL_Error *err (void); // Error reporter
+ virtual void set_err (UTL_Error *); // Set it
+
+ virtual int err_count (void); // How many errors?
+ virtual void set_err_count (int); // Set it
+
+ virtual long lineno (void); // Where in file?
+ virtual void set_lineno (long); // Set it
+
+ virtual UTL_String *filename (void); // What file?
+ virtual void set_filename (UTL_String *); // Set it
+
+ virtual UTL_String *main_filename (void); // What's the main
+ // file name?
+ virtual void set_main_filename (UTL_String *);
+ // Set it
+
+ virtual UTL_String *real_filename (void); // What's the real
+ // file name?
+ virtual void set_real_filename (UTL_String *);
+ // Set it
+
+ virtual UTL_String *stripped_filename (void); // Stripped filename
+ virtual void set_stripped_filename (UTL_String *); // Set it
+
+ virtual bool imported (void); // Are we imported?
+ virtual bool import (void); // Is import on?
+ virtual void set_import (bool); // Set it
+
+ virtual bool in_main_file (void); // Are we?
+ virtual void set_in_main_file (bool); // Set it
+
+ virtual const char *prog_name (void); // Invoked as..
+ virtual void set_prog_name (const char *); // Set it
+
+ virtual const char *cpp_location (void); // Where's CPP?
+ virtual void set_cpp_location (const char *);// Set it
+
+ virtual long compile_flags (void); // What flags are on?
+ virtual void set_compile_flags (long); // Turn some on or off
+
+ virtual char *local_escapes (void); // Get local escapes
+ virtual void set_local_escapes (const char *);// Set it
+
+ virtual UTL_Indenter *indent (void); // Get indenter
+ virtual void set_indent (UTL_Indenter *); // Set it
+
+ virtual void store_include_file_name (UTL_String *);
+
+ virtual UTL_String **include_file_names (void); // Array of file names
+ virtual void set_include_file_names (UTL_String **); // Set it
+
+ virtual unsigned long n_include_file_names (void); // How many
+ virtual void set_n_include_file_names (unsigned long n);
+
+ virtual void reset_flag_seen (void);
+
+ // = Methods supporting DDS DCPS data type/key definition (from #pragma)
+ typedef ACE_Unbounded_Queue<ACE_TString> DCPS_Key_List;
+ struct DCPS_Data_Type_Info {
+ UTL_ScopedName *name_;
+ DCPS_Key_List key_list_;
+ };
+ typedef ACE_Unbounded_Queue_Iterator<ACE_TString> DCPS_Data_Type_Info_Iter;
+
+ typedef ACE_Hash_Map_Manager_Ex< const char*,
+ DCPS_Data_Type_Info*,
+ ACE_Hash<char*>,
+ ACE_Equal_To<char*>,
+ ACE_Null_Mutex> DCPS_Type_Info_Map ;
+
+ // FE calls when #pragma DCPS_DATA_TYPE is processed
+ virtual void add_dcps_data_type(const char* id);
+ // FE calls when #pragma DCPS_DATA_KEY is processed
+ virtual bool add_dcps_data_key(const char* id, const char* key);
+ // returns null if not matching; otherwise pointer to the info
+ virtual DCPS_Data_Type_Info* is_dcps_type(UTL_ScopedName* target);
+
+ // = Access methods to deal with other IDL files included in the main
+ // IDL file. These IDL files are exactly the same strings that are
+ // "#include"d in the main IDL file, not the ones after CC
+ // preprocessor parsed the file.
+
+ // Just storing the pointer. No memory will be allocated.
+ virtual void add_to_included_idl_files (char* file_name);
+
+ // Get all the files.
+ virtual char** included_idl_files (void);
+
+ // The number of currently availabe include files.
+ virtual size_t n_included_idl_files (void);
+
+ // Set the number of included_idl_files. Use this carefully. This
+ // method is used when we validate all the #included idl files,
+ // against the ones that we get after preprocessing.
+ virtual void n_included_idl_files (size_t n);
+
+ // Validate the included idl files, somefiles might have been
+ // ignored by the preprocessor.
+ virtual void validate_included_idl_files (void);
+
+ virtual ParseState parse_state (void); // What state we're in
+ virtual void set_parse_state (ParseState s); // Set it
+
+ // Convert from a predefined type to an expression type
+ virtual AST_Expression::ExprType
+ PredefinedTypeToExprType (AST_PredefinedType::PredefinedType);
+
+ virtual UTL_String *idl_src_file (void);
+ // Returns the IDL source file being compiled.
+
+ virtual void idl_src_file (UTL_String *);
+ // Set the source IDL file that is being parsed.
+
+ virtual void temp_dir (const char *s);
+ // Set the directory where the IDL compiler can keep all its temp
+ // files. By default, IDL compiler looks for TEMP env variable and
+ // if it is not set, "/tmp/" is assigned.
+
+ virtual const char *temp_dir (void) const;
+ // Get the directory where the IDL compiler can keep all its temp
+ // files. By default, IDL compiler looks for TEMP env variable and
+ // if it is not set, "/tmp/" is assigned.
+
+ virtual void tao_root (const char *s);
+ // Set the path of TAO_ROOT.
+
+ virtual const char *tao_root (void) const;
+ // Get the path for TAO_ROOT.
+
+ virtual void gperf_path (const char *s);
+ // Set the path for the perfect hashing program (GPERF).
+
+ virtual const char *gperf_path (void) const;
+ // Get the path for the perfect hashing program (GPERF).
+
+ virtual void ident_string (const char *s);
+ // Set the value of the #ident string.
+
+ virtual const char *ident_string (void) const;
+ // Get the value of the #ident string.
+
+ virtual void case_diff_error (bool);
+ // report an error (1) for indentifiers in the same scope
+ // that differ only by case, or report a warning (0).
+
+ virtual bool case_diff_error (void);
+ // are we strict about case-only differences or not?
+
+ virtual void nest_orb (bool);
+ // Set on or off whether we are using the NEST ORB.
+
+ virtual bool nest_orb (void);
+ // are we beIng used with the NEST ORB?
+
+ virtual void destroy (void);
+ // Cleanup function.
+
+ virtual void append_idl_flag (const char *s);
+ // Save each flag passed to the IDL compiler.
+
+ virtual const char *idl_flags (void) const;
+ // Get a string representation of the flags passed to the idl compiler.
+
+ ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> &
+ idl_keywords (void);
+ // Accessor for the IDL keyword container.
+
+ ACE_Unbounded_Stack<char *> & pragma_prefixes (void);
+ // Accessor for the pragma prefix container.
+
+ void update_prefix (char *filename);
+ // Do repo id prefix bookkeeping when the file changes.
+
+ UTL_ScopedName *string_to_scoped_name (char *s);
+ // Parses a string with double colons.
+
+ long seen_include_file_before (char *);
+ // Seen this include before?
+
+ long last_seen_index (void) const;
+ void last_seen_index (long val);
+ // Accessors for last_seen_index_ member.
+
+ bool repeat_include (void) const;
+ void repeat_include (bool val);
+ // Accessors for repeat_include_ member.
+
+ const char *stripped_preproc_include (const char *name);
+ // Takes an #include filename generated by the preprocessor, and
+ // strips off any command line -I prefix that may have been
+ // prepended.
+
+ virtual bool preserve_cpp_keywords (void);
+ // Whether we should not mung idl element names that are
+ // C++ keywords e.g. delete, operator etc. with _cxx_ prefix.
+ // Should be true when being used by the IFR Service
+
+ virtual void preserve_cpp_keywords (bool);
+ // Set whether we should not mung idl element names that are C++
+ // keywords e.g. delete, operator etc. with _cxx_ prefix.
+ // Is set by the IFR Service.
+
+ void add_include_path (const char *s);
+ // Add another path to 'include_paths_'.
+
+ ACE_Hash_Map_Manager<char *, char *, ACE_Null_Mutex> &
+ file_prefixes (void);
+ // Accessor for the IDL file prefix container.
+
+ bool pass_orb_idl (void) const;
+ void pass_orb_idl (bool val);
+ // Accessor for the pass_orb_idl_ member.
+
+ bool using_ifr_backend (void) const;
+ void using_ifr_backend (bool val);
+ // Accessor for the using_ifr_backend_ member.
+
+ bool ignore_idl3 (void) const;
+ void ignore_idl3 (bool val);
+ // Accessor for the ignore_idl3_ member.
+
+ int check_gperf (void);
+ // Currently called only from IDL backend, but could be useful elsewhere.
+
+ void fini (void);
+ // Do final cleanup just before process exits.
+
+ void create_uses_multiple_stuff (AST_Component *c,
+ AST_Component::port_description &pd);
+ // We must do this in the front end since the executor
+ // mapping IDL will have these data types.
+
+ int path_cmp (const char *s, const char *t);
+ // Case insensitive for Windows, otherwise not.
+
+ bool hasspace (const char *s);
+ // To tell if we have to handle a Windows path with spaces.
+
+ ACE_Unbounded_Queue<AST_ValueType *> &primary_keys (void);
+ // Accessor for the member.
+
+ void check_primary_keys (void);
+ // Called affer yy_parse() returns - iterates over our list
+ // of primary keys. Must be called this late so that we can
+ // be sure that all forward declared stucts or unions that
+ // might be used in such a valuetype are fully defined.
+
+ const char *recursion_start (void) const;
+ void recursion_start (const char *val);
+ // Accessors for the member.
+
+ UTL_String *utl_string_factory (const char *str);
+ // Utility function to create UTL_String classes on the FE heap.
+
+private:
+ // Data
+ UTL_ScopeStack pd_scopes; // Store scopes stack
+ AST_Root *pd_root; // Store AST root
+ AST_Generator *pd_gen; // Store generator
+ AST_ValueType *pd_primary_key_base; // Store PrimaryKeyBase
+ UTL_Error *pd_err; // Error object
+ int pd_err_count; // Count of errors
+ long pd_lineno; // What line #
+ UTL_String *pd_filename; // What file
+ UTL_String *pd_main_filename; // What main filename
+ UTL_String *pd_real_filename; // What real filename
+ UTL_String *pd_stripped_filename; // Stripped filename
+ bool pd_import; // Is import on?
+ bool pd_in_main_file; // Are we in it?
+ const char *pd_prog_name; // Argv[0]
+ const char *pd_cpp_location; // Where to find CPP
+ long pd_compile_flags; // Compile flags
+ char *pd_local_escapes; // Trapdoor argument
+ UTL_Indenter *pd_indent; // Indent object
+ // as it's being built
+ UTL_String **pd_include_file_names;// Array of file names.
+ unsigned long pd_n_include_file_names;// How many.
+ unsigned long pd_n_alloced_file_names;// How many alloced.
+
+ char **included_idl_files_;
+ // IDL files that are "#include'd.
+
+ size_t n_included_idl_files_;
+ // The number of such idl files that are currently stored.
+
+ size_t n_allocated_idl_files_;
+ // For char*'s have been allocated for this.
+
+ ParseState pd_parse_state; // Parse state we're in.
+
+ UTL_String *pd_idl_src_file; // IDL source file.
+
+ char *tao_root_;
+ // Needed if orb.idl is included.
+
+ char *gperf_path_;
+ // Path for the perfect hash generator(gperf) program. Default
+ // is $ACE_ROOT/bin/gperf.
+
+ char *temp_dir_;
+ // Temp directory where which we can rewsolve in drv_preproc.cpp by
+ // checking for TEMP env variable otherwise we assign to /tmp/.
+
+ char *ident_string_;
+ // Holds a string that begins with #ident, to be passed from the IDL
+ // file to the generated files.
+
+ bool case_diff_error_;
+ // Do we report an error for indentifiers in the same scope that differ
+ // only by case? or just a warning?
+
+ bool nest_orb_;
+ // Is this front end being used for the NEST ORB?
+
+ ACE_CString idl_flags_;
+ // Concatenation of all the command line options.
+
+ ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> idl_keywords_;
+ // Container for all the IDL keywords so local names can be checked.
+
+ ACE_Unbounded_Stack<char *> pragma_prefixes_;
+ // Container for all the #pragma prefix declarations.
+
+ bool repeat_include_;
+ // Has this IDL file been included before?
+
+ bool preserve_cpp_keywords_;
+ // Do we allow C++ keywords as identifiers in the idl to stay as they are ?
+
+ ACE_Unbounded_Queue<char *> include_paths_;
+ // List of -I options passed to us.
+
+ ACE_Hash_Map_Manager<char *, char *, ACE_Null_Mutex> file_prefixes_;
+ // Associates a prefix with a file.
+
+ bool pass_orb_idl_;
+ // Treat orb.idl like any other included IDL file.
+
+ bool using_ifr_backend_;
+ // Set by the IFR backend itself.
+
+ bool ignore_idl3_;
+ // Need this for eventtypes left over after running idl3_to_idl2,
+ // we don't want to try to generate another event consumer.
+ DCPS_Type_Info_Map dcps_type_info_map_ ;
+ // Map of #pragma DCPS_DATA_TYPE and DCPS_DATA_KEY infomation.
+
+ ACE_Unbounded_Queue<AST_ValueType *>primary_keys_;
+ // List of valuetypes used as a primary key.
+
+ char *recursion_start_;
+ // Path to directory subtree we are iterating/recursing over.
+ // Not used by all backends.
+};
+
+
+#endif //_IDL_IDL_GLOBAL_HH
diff --git a/TAO/TAO_IDL/include/idl_narrow.h b/TAO/TAO_IDL/include/idl_narrow.h
new file mode 100644
index 00000000000..ac390241577
--- /dev/null
+++ b/TAO/TAO_IDL/include/idl_narrow.h
@@ -0,0 +1,270 @@
+// $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_NARROW_IDL_NARROW_HH
+#define _IDL_NARROW_IDL_NARROW_HH
+
+// idl_narrow.hh
+//
+// Implement IDL narrowing mechanism. Not intended to be read by humans..
+//
+// Logic:
+//
+// The DEF_xxx macros are used in class declarations.
+// The IMPL_xxx macros are used in class implementations.
+//
+// The DEF_xxx macros come in two flavors. The first one, DEF_NARROW_METHODSn,
+// defines the narrowing mechanism. It declares a static class function whose
+// address is used as the class identifier. Then, it declares a narrow op
+// with an implementation suitable for narrowing from exactly 'n' superclasses.
+// The names of the superclass types are given as arguments. The second flavor
+// implements specific narrowing mechanisms from AST_decl and from UTL_scope.
+// These macros are named DEF_NARROW_FROM_DECL and DEF_NARROW_FROM_SCOPE
+// respectively.
+//
+// The IMPL_xxx macros also come in two flavors, corresponding to the two
+// flavors of DEF_xxx macros. The IMPL_NARROW_METHODSn macros implement the
+// narrowing mechanism for classes which must be narrowed from 'n' ancestors.
+// The IMPL_NARROW_FROM_DECL and IMPL_NARROW_FROM_SCOPE macros implement
+// the narrowing mechanisms for narrowing from instances of AST_decl and
+// UTL_scope.
+//
+// IMPL_NARROW_METHODSn where n is 0,1,2 and 3 are provided.
+// DEF_NARROW_METHODSn where n is 0,1,2 and 3 are provided.
+
+extern char *type_id_to_string(long);
+
+#define DEF_NARROW_METHODS0(TYPE)\
+static int type_id(); \
+virtual void *narrow(size_t type_const)
+
+
+#define IMPL_NARROW_METHODS0(TYPE)\
+int \
+TYPE::type_id()\
+{\
+ return 0;\
+}\
+void * \
+TYPE::narrow(size_t type_const) {\
+ void *rval = NULL; \
+ size_t temp = (size_t) &TYPE::type_id; \
+ if (type_const == temp) \
+ rval = this; \
+ return rval; \
+}
+
+#define DEF_NARROW_METHODS1(TYPE,PARENT) \
+static int type_id(); \
+virtual void *narrow(size_t type_const)
+
+
+#define IMPL_NARROW_METHODS1(TYPE,PARENT) \
+int \
+TYPE::type_id() \
+{\
+ return 0;\
+}\
+void * \
+TYPE::narrow(size_t type_const) {\
+ void *rval = NULL; \
+ size_t temp = (size_t) &TYPE::type_id; \
+ if (type_const == temp) \
+ rval = this; \
+ if (rval == NULL) \
+ rval = PARENT::narrow(type_const);\
+ return rval;\
+}
+
+#define DEF_NARROW_METHODS2(TYPE,PARENT1,PARENT2) \
+static int type_id(); \
+virtual void *narrow(size_t type_const)
+
+
+#define IMPL_NARROW_METHODS2(TYPE,PARENT1,PARENT2) \
+int \
+TYPE::type_id() \
+{\
+ return 0;\
+}\
+void * \
+TYPE::narrow(size_t type_const) { \
+ void *rval = NULL; \
+ size_t temp = (size_t) &TYPE::type_id; \
+ if (type_const == temp) \
+ rval = this; \
+ if (rval == NULL) \
+ rval = PARENT1::narrow(type_const);\
+ if (rval == NULL) \
+ rval = PARENT2::narrow(type_const);\
+ return rval;\
+}
+
+#define DEF_NARROW_METHODS3(TYPE,PARENT1,PARENT2,PARENT3) \
+static int type_id(); \
+virtual void *narrow(size_t type_const)
+
+
+#define IMPL_NARROW_METHODS3(TYPE,PARENT1,PARENT2,PARENT3) \
+int \
+TYPE::type_id() \
+{\
+ return 0;\
+}\
+void * \
+TYPE::narrow(size_t type_const) {\
+ void *rval = NULL; \
+ size_t temp = (size_t) &TYPE::type_id; \
+ if (type_const == temp) \
+ rval = this; \
+ if (rval == NULL) \
+ rval = PARENT1::narrow(type_const);\
+ if (rval == NULL) \
+ rval = PARENT2::narrow(type_const);\
+ if (rval == NULL) \
+ rval = PARENT3::narrow(type_const);\
+ return rval;\
+}
+
+#define DEF_NARROW_METHODS4(TYPE,PARENT1,PARENT2,PARENT3,PARENT4) \
+static int type_id(); \
+virtual void *narrow(size_t type_const)
+
+
+#define IMPL_NARROW_METHODS4(TYPE,PARENT1,PARENT2,PARENT3,PARENT4) \
+int \
+TYPE::type_id() \
+{\
+ return 0;\
+}\
+void * \
+TYPE::narrow(size_t type_const) {\
+ void *rval = NULL; \
+ size_t temp = (size_t) &TYPE::type_id; \
+ if (type_const == temp) \
+ rval = this; \
+ if (rval == NULL) \
+ rval = PARENT1::narrow(type_const);\
+ if (rval == NULL) \
+ rval = PARENT2::narrow(type_const);\
+ if (rval == NULL) \
+ rval = PARENT3::narrow(type_const);\
+ if (rval == NULL) \
+ rval = PARENT4::narrow(type_const);\
+ return rval;\
+}
+
+#define DEF_NARROW_METHODS5(TYPE,PARENT1,PARENT2,PARENT3,PARENT4,PARENT5) \
+static int type_id(); \
+virtual void *narrow(size_t type_const)
+
+
+#define IMPL_NARROW_METHODS5(TYPE,PARENT1,PARENT2,PARENT3,PARENT4,PARENT5) \
+int \
+TYPE::type_id() \
+{\
+ return 0;\
+}\
+void * \
+TYPE::narrow(size_t type_const) {\
+ void *rval = NULL; \
+ size_t temp = (size_t) &TYPE::type_id; \
+ if (type_const == temp) \
+ rval = this; \
+ if (rval == NULL) \
+ rval = PARENT1::narrow(type_const);\
+ if (rval == NULL) \
+ rval = PARENT2::narrow(type_const);\
+ if (rval == NULL) \
+ rval = PARENT3::narrow(type_const);\
+ if (rval == NULL) \
+ rval = PARENT4::narrow(type_const);\
+ if (rval == NULL) \
+ rval = PARENT5::narrow(type_const);\
+ return rval;\
+}
+
+#define DEF_NARROW_FROM_DECL(TYPE)\
+static TYPE *narrow_from_decl(AST_Decl *t)
+
+
+#define IMPL_NARROW_FROM_DECL(TYPE)\
+TYPE * \
+TYPE::narrow_from_decl(AST_Decl *t) { \
+ return (TYPE *)t->narrow((size_t)&TYPE::type_id);\
+}
+
+#define DEF_NARROW_FROM_SCOPE(TYPE)\
+static TYPE *narrow_from_scope(UTL_Scope *t)
+
+
+#define IMPL_NARROW_FROM_SCOPE(TYPE)\
+TYPE * \
+TYPE::narrow_from_scope(UTL_Scope *t) { \
+ return (TYPE *)t->narrow((size_t)&TYPE::type_id);\
+}
+
+#endif // _IDL_NARROW_IDL_NARROW_HH
diff --git a/TAO/TAO_IDL/include/idl_uns_long.h b/TAO/TAO_IDL/include/idl_uns_long.h
new file mode 100644
index 00000000000..4a6cb03896a
--- /dev/null
+++ b/TAO/TAO_IDL/include/idl_uns_long.h
@@ -0,0 +1,23 @@
+// $Id$
+//
+// idl type usigned long
+//
+// Either an 'unsigned long long' or an 'unsigned long'.
+//
+
+#ifndef _IDL_UNS_LONG_H
+#define _IDL_UNS_LONG_H
+
+#include "ace/Basic_Types.h"
+
+#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
+ // Platform has "long long" but no unsigned long long. Use a long long
+ // for the container.
+ typedef long long idl_uns_long;
+#elif defined (ACE_LACKS_LONGLONG_T)
+ typedef unsigned long idl_uns_long;
+#else
+ typedef ACE_UINT64 idl_uns_long;
+#endif /* ACE_LACKS_LONGLONG_T */
+
+#endif /* _IDL_UNS_LONG_H */
diff --git a/TAO/TAO_IDL/include/nr_extern.h b/TAO/TAO_IDL/include/nr_extern.h
new file mode 100644
index 00000000000..0e9195b8d57
--- /dev/null
+++ b/TAO/TAO_IDL/include/nr_extern.h
@@ -0,0 +1,79 @@
+// $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 _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.
+extern TAO_IDL_FE_Export AST_Decl *ScopeAsDecl (UTL_Scope *s);
+extern TAO_IDL_FE_Export UTL_Scope *DeclAsScope (AST_Decl *d);
+
+#endif // _NR_EXTERN_NR_EXTERN_HH
diff --git a/TAO/TAO_IDL/include/utl_decllist.h b/TAO/TAO_IDL/include/utl_decllist.h
new file mode 100644
index 00000000000..45492f4dce7
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_decllist.h
@@ -0,0 +1,117 @@
+// $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 _UTL_DECLLIST_UTL_DECLLIST_HH
+#define _UTL_DECLLIST_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
+// 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.
+
+class FE_Declarator;
+
+class TAO_IDL_FE_Export UTL_DeclList : public UTL_List
+{
+public:
+ // Operations
+
+ // Constructor(s)
+ UTL_DeclList (FE_Declarator *s,
+ UTL_DeclList *cdr);
+
+ // Get element
+ FE_Declarator *head (void);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+private:
+ // Data
+ FE_Declarator *pd_car_data; // The element this list stores
+};
+
+// Active iterator fooor UTL_DeclList
+class TAO_IDL_FE_Export UTL_DecllistActiveIterator
+ : public UTL_ListActiveIterator
+{
+public:
+ // Operations
+
+ // Constructor(s)
+ UTL_DecllistActiveIterator (UTL_DeclList *s);
+
+ // Get current 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
new file mode 100644
index 00000000000..e7a6138fbbe
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_err.h
@@ -0,0 +1,345 @@
+// $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 _UTL_ERR_UTL_ERR_HH
+#define _UTL_ERR_UTL_ERR_HH
+
+#include "ast_expression.h"
+#include "idl_global.h"
+#include "utl_scoped_name.h"
+
+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
+{
+public:
+ enum ErrorCode {
+ EIDL_SYNTAX_ERROR, // Syntax error in IDL input
+ // More details will be gleaned from examining
+ // idl_global->parse_state()
+ EIDL_REDEF, // Redefinition
+ EIDL_REDEF_SCOPE, // Redefinition inside defining scope
+ EIDL_DEF_USE, // Definition after use
+ EIDL_MULTIPLE_BRANCH, // More than one union branch with this label
+ EIDL_COERCION_FAILURE, // Coercion failure
+ EIDL_SCOPE_CONFLICT, // Between fwd declare and full declare
+ EIDL_ONEWAY_CONFLICT, // Between op decl and argument direction
+ EIDL_PREFIX_CONFLICT, // Between prefixes at declaration and use
+ 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
+ EIDL_ILLEGAL_USE, // Illegal type used in expression
+ 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_PRIMARY_KEY_ERROR, // Does not inherit from primaryKeyBase
+ EIDL_CONSTANT_EXPECTED, // We got something else..
+ EIDL_INTERFACE_EXPECTED, // We got something else..
+ EIDL_VALUETYPE_EXPECTED, // We got something else..
+ EIDL_CONCRETE_VT_EXPECTED, // We got something else..
+ EIDL_ABSTRACT_EXPECTED, // We got something else..
+ EIDL_EVENTTYPE_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
+ EIDL_KEYWORD_WARNING, // Same as above, but only a warning
+ 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
+ EIDL_RECURSIVE_TYPE, // Illegal recursive use of type
+ EIDL_NONVOID_ONEWAY, // Non-void return type in oneway operation
+ EIDL_NOT_A_TYPE, // Not a type
+ EIDL_UNDERSCORE, // More than one leading underscore
+ EIDL_EMPTY_MODULE, // Empty modules not allowed in IDL.
+ EIDL_BACK_END, // Back end error
+ EIDL_ILLEGAL_INFIX, // Illegal infix operator in expression
+ EIDL_LOCAL_REMOTE_MISMATCH, // Local type used in remote operation
+ EIDL_IGNORE_IDL3_ERROR, // -Sm option used with component or home decl
+ EIDL_TC_SUPPRESSION_WARNING,// -St option used with exception decl
+ EIDL_ILLEGAL_BOXED_TYPE, // Valuetype not allowed for box value type
+ EIDL_ILLEGAL_PRIMARY_KEY, // Primary key doesn't meet spec constraints
+ EIDL_OK // No error
+ };
+
+ // Operations
+
+ // Report errors with varying numbers of arguments
+ void error0 (ErrorCode e);
+ void error1 (ErrorCode e,
+ AST_Decl *t);
+ void error2 (ErrorCode e,
+ AST_Decl *t1,
+ AST_Decl *t2);
+ void error3 (ErrorCode e,
+ AST_Decl *t1,
+ AST_Decl *t2,
+ AST_Decl *t3);
+
+ // Report warnings with varying numbers of arguments
+ void warning0 (ErrorCode e);
+ void warning1 (ErrorCode e,
+ AST_Decl *t);
+ void warning2 (ErrorCode e,
+ AST_Decl *t1,
+ AST_Decl *t2);
+ void warning3 (ErrorCode e,
+ AST_Decl *t1,
+ AST_Decl *t2,
+ AST_Decl *t3);
+
+ // Report a syntax error in IDL input
+ void syntax_error (IDL_GlobalData::ParseState ps);
+
+ // Report clash of declared and referenced indentifiers
+ void redef_error (char *n,
+ char *t);
+
+ // Report a name being used with different spellings
+ void name_case_error (char *n,
+ char *t);
+
+ // Same as above, but doesn't increment the error count.
+ void name_case_warning (char *n,
+ char *t);
+
+ // Differs from spelling of IDL keyword only by case.
+ void idl_keyword_error (char *n);
+
+ // Same as above, but doesn't increment the error count.
+ void idl_keyword_warning (char *n);
+
+ // Report an unsuccesful coercion attempt
+ void coercion_error (AST_Expression *v,
+ AST_Expression::ExprType t);
+
+ // Report a failed name lookup attempt.
+ void lookup_error (UTL_ScopedName *n);
+
+ // Report an illegal #pragma version.
+ void version_number_error (char *n);
+
+ // Repost an attempt to reset the version.
+ void version_reset_error (void);
+
+ // Report an attempt to change the id once set.
+ void id_reset_error (const char *o,
+ const char *n);
+
+ // Report an attempt to use a forward declared interface which
+ // hasn't been defined yet in an inheritance spec
+ void inheritance_fwd_error (UTL_ScopedName *n,
+ AST_Interface *f);
+
+ // Report an attempt to inherit from something other than an interface
+ void inheritance_error (UTL_ScopedName *n,
+ AST_Decl *d);
+
+ // 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 support something other than an interface
+ void supports_error (UTL_ScopedName *n,
+ AST_Decl *d);
+
+ // Report an attempt to have a derived component or home support something.
+ void derived_supports_error (UTL_ScopedName *n);
+
+ // 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 concrete type.
+ void abstract_support_error (UTL_ScopedName *v,
+ UTL_ScopedName *i);
+
+ // Report a situation where a non-local interface was expected but we got
+ // something else instead. This most likely is a case in a supports
+ // or inheritance list.
+ void unconstrained_interface_expected (UTL_ScopedName *c,
+ 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 a 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 a concrete value type was expected but we got
+ // something else instead. This most likely is a case where a valuetype
+ // inherits from something other than a concrete valuetype.
+ void concrete_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 event type was expected but we got
+ // something else instead. This is the case in an 'emits', 'publishes',
+ // or 'consumes' declaration in a component and it's not an event type.
+ void eventtype_expected (AST_Decl *d);
+
+ // Report a situation where a valuetype used as a primary key for a
+ // component home does not inherit directly or indirectly from
+ // Components::primaryKeyBase.
+ void primary_key_error (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
+ // not an enumerator in that enum
+ void enum_val_expected (AST_Union *t,
+ AST_UnionLabel *l);
+
+ // Report a failed enumerator lookup in an enum
+ void enum_val_lookup_failure (AST_Union *t,
+ AST_Enum *e,
+ UTL_ScopedName *n);
+
+ // Report an ambiguous name definition
+ void ambiguous (UTL_Scope *s,
+ AST_Decl *l,
+ AST_Decl *d);
+
+ // Report a forward declared interface which was never defined
+ void fwd_decl_not_defined (AST_Type *d);
+
+ // Report attempt to lookup in forward declared interface
+ void fwd_decl_lookup (AST_Interface *d,
+ UTL_ScopedName *n);
+
+ // Report a redefinition in scope
+ void redefinition_in_scope (AST_Decl *t,
+ AST_Decl *s);
+
+ // Report not a type error
+ void not_a_type (AST_Decl *d);
+
+ // Report back-end error
+ void back_end (long lineno,
+ UTL_String *s);
+
+ // Report illegal infix operator error (they can be used
+ // only with integer, floating point or fixed point expressions.
+ void illegal_infix (void);
+
+ // Report local type used in remote operation.
+ void local_remote_mismatch (AST_Decl *l,
+ UTL_Scope *s);
+
+ // Improper use of -Sm option.
+ void ignore_idl3_error (AST_Decl *d);
+
+ // Valuetype violates a spec-defined constraint on a
+ // valuetype used as a primary key.
+ void illegal_primary_key (AST_Decl *d);
+};
+
+#endif // _UTL_ERR_UTL_ERR_HH
diff --git a/TAO/TAO_IDL/include/utl_exceptlist.h b/TAO/TAO_IDL/include/utl_exceptlist.h
new file mode 100644
index 00000000000..5e36d5e2222
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_exceptlist.h
@@ -0,0 +1,112 @@
+// $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 _UTL_EXCEPTLIST_UTL_EXCEPTLIST_HH
+#define _UTL_EXCEPTLIST_UTL_EXCEPTLIST_HH
+
+#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.
+// 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.
+
+class TAO_IDL_FE_Export UTL_ExceptList : public UTL_List
+{
+public:
+ UTL_ExceptList (AST_Exception *s,
+ UTL_ExceptList *cdr);
+
+ // Get list item.
+ AST_Exception *head (void);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+ // Copies the UTL_ExceptList pointers but not the
+ // contained AST_Exceptions.
+ virtual UTL_ExceptList *copy (void);
+
+private:
+ // Data.
+ AST_Exception *pd_car_data;
+};
+
+// Active iterator for UTL_ExceptList.
+class TAO_IDL_FE_Export UTL_ExceptlistActiveIterator
+ : public UTL_ListActiveIterator
+{
+public:
+ UTL_ExceptlistActiveIterator (UTL_ExceptList *s);
+
+ // Get current 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
new file mode 100644
index 00000000000..4b8108bbb58
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_exprlist.h
@@ -0,0 +1,109 @@
+// $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 _UTL_EXPRLIST_UTL_EXPRLIST_HH
+#define _UTL_EXPRLIST_UTL_EXPRLIST_HH
+
+#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.
+// 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.
+
+class TAO_IDL_FE_Export UTL_ExprList : public UTL_List
+{
+public:
+ UTL_ExprList (AST_Expression *s,
+ UTL_ExprList *cdr);
+
+ // Get list item.
+ AST_Expression *head (void);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+private:
+ // Data.
+ AST_Expression *pd_car_data;
+};
+
+// Active iterator for UTL_ExprList.
+class UTL_ExprlistActiveIterator : public UTL_ListActiveIterator
+{
+public:
+ UTL_ExprlistActiveIterator (UTL_ExprList *s);
+
+ // 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
new file mode 100644
index 00000000000..57742738473
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_identifier.h
@@ -0,0 +1,123 @@
+// $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 _UTL_IDENTIFIER_UTL_IDENTIFIER_HH
+#define _UTL_IDENTIFIER_UTL_IDENTIFIER_HH
+
+#include "TAO_IDL_FE_Export.h"
+
+#include "ace/iosfwd.h"
+
+class TAO_IDL_FE_Export Identifier
+{
+public:
+ Identifier (void);
+ // Default Constructor.
+
+ Identifier (const char *s);
+ // Constructor.
+
+ virtual ~Identifier (void);
+ // Destructor.
+
+ // Operations
+
+ char *get_string (void);
+ // Get the underlying string.
+
+ void replace_string (const char * s);
+ // Replace the underlying string and free the old one.
+
+ bool compare (Identifier *other);
+ // Compare with other Identifier.
+
+ bool case_compare (Identifier *other);
+ // Also check for case-only difference.
+
+ bool case_compare_quiet (Identifier *other);
+ // Like the above but suppressing error or warning I/O
+
+ Identifier *copy (void);
+ // Create a deep copy.
+
+ bool escaped (void) const;
+ // Accessor for the member.
+
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+ // Dump to an ostream.
+
+ virtual void destroy (void);
+ // Cleanup function.
+
+private:
+ // Storage for data.
+ char *pv_string;
+
+ // Did the IDL string have a leading underscore?
+ bool escaped_;
+};
+
+#endif // _UTL_IDENTIFIER_UTL_IDENTIFIER_HH
diff --git a/TAO/TAO_IDL/include/utl_idlist.h b/TAO/TAO_IDL/include/utl_idlist.h
new file mode 100644
index 00000000000..a0f5149a793
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_idlist.h
@@ -0,0 +1,138 @@
+// $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 _UTL_IDLIST_UTL_IDLIST_HH
+#define _UTL_IDLIST_UTL_IDLIST_HH
+
+// List of Identifiers
+
+// 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.
+
+#include "utl_list.h"
+#include "ace/iosfwd.h"
+
+class Identifier;
+
+class TAO_IDL_FE_Export UTL_IdList : public UTL_List
+{
+ // =TITLE
+ // UTL_IdList
+ // =DESCRIPTION
+ // Used to maintain a list of identifiers. The primary usage of this class
+ // is to maintain a scoped name.
+public:
+ UTL_IdList (Identifier *car,
+ UTL_IdList *cdr);
+ // Constructor(s)
+
+ virtual ~UTL_IdList (void) {}
+ // destructor
+
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+ // Dump to ostream.
+
+ virtual void destroy (void);
+ // Cleanup function.
+
+ UTL_List *copy (void);
+ // Copy the list.
+
+ Identifier *head (void);
+ // Get element.
+
+ Identifier *last_component (void);
+ // 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.
+
+class TAO_IDL_FE_Export UTL_IdListActiveIterator
+ : public UTL_ListActiveIterator
+{
+ // =TITLE
+ // UTL_IdListActiveIterator
+ // =DESCRIPTION
+ // Iterator for the IDList
+public:
+ UTL_IdListActiveIterator (UTL_IdList *s);
+
+ 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
new file mode 100644
index 00000000000..029f66cc004
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_indenter.h
@@ -0,0 +1,107 @@
+// $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 _UTL_INDENTER_UTL_INDENTER_HH
+#define _UTL_INDENTER_UTL_INDENTER_HH
+
+#include "ace/iosfwd.h"
+
+// Utility class for control of indentation level during dumping
+// May also be useful for BEs that want to produce nicely formatted
+// output.
+
+class UTL_Indenter
+{
+ // =TITLE
+ // UTL_Indenter
+ // =DESCRIPTION
+ // useful in generating indented output
+public:
+ UTL_Indenter (void);
+
+ ~UTL_Indenter (void) {}
+
+ void reset (void);
+ // Reset indentation level to 0.
+
+ void increase (void);
+ // Increase indentation level.
+
+ void decrease (void);
+ // Decrease indentation level.
+
+ void skip_to (ACE_OSTREAM_TYPE &o);
+ // Skip to indentation level stop.
+
+ void skip_to (FILE *fp);
+ // skip to indentation level stop.
+
+private:
+ // 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
new file mode 100644
index 00000000000..299cadfe0d2
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_labellist.h
@@ -0,0 +1,108 @@
+// $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 _UTL_LABELLIST_UTL_LABELLIST_HH
+#define _UTL_LABELLIST_UTL_LABELLIST_HH
+
+#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.
+// 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.
+
+class TAO_IDL_FE_Export UTL_LabelList : public UTL_List
+{
+public:
+ UTL_LabelList (AST_UnionLabel *s,
+ UTL_LabelList *cdr);
+
+ // Get list item.
+ AST_UnionLabel *head (void);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+private:
+ AST_UnionLabel *pd_car_data;
+};
+
+// Active iterator for UTL_LabelList.
+class UTL_LabellistActiveIterator : public UTL_ListActiveIterator
+{
+public:
+ UTL_LabellistActiveIterator (UTL_LabelList *source);
+
+ // 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
new file mode 100644
index 00000000000..b91c98b5a1b
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_list.h
@@ -0,0 +1,141 @@
+// $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 _UTL_LIST_UTL_LIST_HH
+#define _UTL_LIST_UTL_LIST_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.
+// 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 "TAO_IDL_FE_Export.h"
+
+
+// Forward declare active iterator for UTL_List.
+class UTL_ListActiveIterator;
+
+class TAO_IDL_FE_Export UTL_List
+{
+public:
+ UTL_List (UTL_List *c);
+
+ virtual ~UTL_List (void);
+
+ // Smash last cdr pointer in "this" with l.
+ void nconc (UTL_List *l);
+
+ // Copy the list starting at "this".
+ virtual UTL_List *copy (void);
+
+ // Get next list.
+ UTL_List *tail (void);
+
+ // Set next list
+ void set_tail (UTL_List *l);
+
+ // How long is this list?
+ long length (void);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+private:
+ // The next list.
+ UTL_List *pd_cdr_data;
+
+ // Operations
+ long list_length (long n);
+
+ // Friend class.
+ friend class UTL_ListActiveIterator;
+ friend class UTL_ExceptList;
+};
+
+// Active iterator for lists.
+class TAO_IDL_FE_Export UTL_ListActiveIterator
+{
+public:
+
+ UTL_ListActiveIterator (UTL_List *s);
+
+ virtual ~UTL_ListActiveIterator (void) {}
+
+ // Get next list.
+ virtual void next (void);
+
+ // Are we at the end of this list?
+ virtual bool is_done (void);
+
+protected:
+ // 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
new file mode 100644
index 00000000000..56a4f764a22
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_namelist.h
@@ -0,0 +1,114 @@
+// $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 _UTL_NAMELIST_UTL_NAMELIST_HH
+#define _UTL_NAMELIST_UTL_NAMELIST_HH
+
+#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.
+// 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.
+
+class TAO_IDL_FE_Export UTL_NameList : public UTL_List
+{
+public:
+ UTL_NameList (UTL_ScopedName *s,
+ UTL_NameList *cdr);
+
+ // Get list item.
+ UTL_ScopedName *head (void);
+
+ // Accessors.
+ bool truncatable (void) const;
+ void truncatable (bool val);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+private:
+ // List item.
+ UTL_ScopedName *pd_car_data;
+
+ // Used only with valuetye inheritance list. Defualts to 0.
+ bool pd_truncatable;
+};
+
+// Active iterator for UTL_NameList.
+class UTL_NamelistActiveIterator : public UTL_ListActiveIterator
+{
+public:
+ UTL_NamelistActiveIterator (UTL_NameList *source);
+
+ // 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
new file mode 100644
index 00000000000..0b74e4422ad
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_scope.h
@@ -0,0 +1,477 @@
+// This may look like C, but it's really -*- C++ -*-
+// $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 _UTL_SCOPE_UTL_SCOPE_HH
+#define _UTL_SCOPE_UTL_SCOPE_HH
+
+// This is the base class for name scoping. Each entity which can
+// be directly contained in a naming scope has an add() function
+// defined for it. The functions defined on the base scoping class
+// all return FALSE. Each subclass of UTL_Scope should
+// define its own add() functions for those types which are legal
+// in that context. Then, for those types for which no local functions
+// have been defined the function on the base class will be called to
+// return FALSE.
+//
+// The "AST_" classes may redefine add() functions to implement any
+// name binding mechanisms needed for their own functionality. It is
+// the responsibility of those functions then to call the add()
+// function defined in the parent "AST_" class.
+
+#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_ValueBox;
+class AST_ValueType;
+class AST_ValueTypeFwd;
+class AST_EventType;
+class AST_EventTypeFwd;
+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;
+
+class TAO_IDL_FE_Export UTL_Scope : public virtual COMMON_Base
+{
+public:
+ // Enum to denote the kind of iteration desired.
+ enum ScopeIterationKind {
+ IK_both // Iterate through both decls and local types.
+ , IK_decls // Iterate only through decls.
+ , IK_localtypes // Iterate only through local types.
+ };
+
+ // Operations.
+
+ // Constructor(s).
+ UTL_Scope (void);
+ UTL_Scope (AST_Decl::NodeType nt);
+
+ // Destructor.
+ virtual ~UTL_Scope (void);
+
+ // Scope Management Protocol.
+ virtual AST_PredefinedType *add_predefined_type (AST_PredefinedType *t);
+
+ virtual AST_Module *add_module (AST_Module *m);
+
+ virtual AST_Interface *add_interface (AST_Interface *i);
+
+ 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_EventType *add_eventtype (AST_EventType *i);
+
+ virtual AST_EventTypeFwd *add_eventtype_fwd (AST_EventTypeFwd *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);
+
+ virtual AST_Attribute *add_attribute (AST_Attribute *a);
+
+ virtual AST_Operation *add_operation (AST_Operation *o);
+
+ virtual AST_Argument *add_argument (AST_Argument *a);
+
+ 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);
+
+ virtual AST_EnumVal *add_enum_val (AST_EnumVal *v);
+
+ virtual AST_Typedef *add_typedef (AST_Typedef *t);
+
+ virtual UTL_StrList *add_context (UTL_StrList *c);
+
+ virtual UTL_NameList *add_exceptions (UTL_NameList *e);
+
+ virtual AST_Sequence *add_sequence (AST_Sequence *s);
+
+ virtual AST_String *add_string (AST_String *s);
+
+ virtual AST_Array *add_array (AST_Array *a);
+
+ virtual AST_Native *add_native (AST_Native *n);
+
+ virtual AST_Factory *add_factory (AST_Factory *f);
+
+ // Call back end add_XXX functions for this scope.
+ virtual AST_Decl *call_add (void);
+
+ // Data Accessors.
+ AST_Decl::NodeType scope_node_type (void)
+ {
+ return pd_scope_node_type;
+ }
+
+ // Narrowing.
+ DEF_NARROW_METHODS0(UTL_Scope);
+ DEF_NARROW_FROM_SCOPE(UTL_Scope);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Other Operations.
+
+ // Name Lookup Mechanism
+ AST_Decl *lookup_by_name (UTL_ScopedName *,
+ bool treat_as_ref,
+ bool in_parent = true,
+ bool full_def_only = false);
+
+ // Look up the Identifier * specified only in the local scope.
+ AST_Decl *lookup_by_name_local (Identifier *,
+ long index,
+ bool full_def_only = false);
+
+ // Look up a predefined type by its ExprType.
+ AST_Decl *lookup_primitive_type (AST_Expression::ExprType);
+
+ // Look up one of the pseudo-object types.
+ AST_Decl *lookup_pseudo (Identifier *);
+
+ virtual AST_Decl *look_in_previous (Identifier *e,
+ bool ignore_fwd = false);
+
+ // How many entries are used?
+ virtual 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.
+ // This one is public because the case of a reopened
+ // module necessitates a call to this from
+ // be_generator::create_module().
+ void add_to_scope (AST_Decl *e,
+ AST_Decl *ex = 0);
+
+ // Add to name_referenced identifier list. It's public because
+ // a union needs to add its enum discriminator label names.
+ void add_to_name_referenced (Identifier *id);
+
+ // Accessors for the has_prefix_ member.
+ bool has_prefix (void);
+ void has_prefix (bool val);
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+protected:
+ // UTL_Scope protected addition protocol. This protocol is
+ // used from sub-classes of UTL_Scope to insert nodes directly
+ // into the specified node table (either decls or local_types)
+ // Additionally, UTL_Scope also maintains a record of what nodes
+ // defined elsewhere were referenced in this scope.
+
+ // Replace old_decl with new_decl.
+ void replace_scope (AST_Decl *old_decl,
+ AST_Decl *new_decl);
+
+ // Replace old_decl with new_decl.
+ void replace_referenced (AST_Decl *old_decl,
+ AST_Decl *new_decl);
+
+ // Add to referenced nodes set.
+ // If ex is not 0 'e' will be inserted at the position
+ // after ex, which is already in the list.
+ void add_to_referenced (AST_Decl *e,
+ bool recursive,
+ Identifier *id,
+ AST_Decl *ex = 0);
+
+ // Add to local types. Node represents a local manifest type.
+ void add_to_local_types (AST_Decl *e);
+
+ // Has this node been referenced here already?
+ virtual bool referenced (AST_Decl *e,
+ Identifier *id = 0);
+
+ // Look up a scoped name in the inherited list.
+ virtual AST_Decl *look_in_inherited (UTL_ScopedName *,
+ bool treat_as_ref);
+
+ // Look up a scoped name in the supported interface list.
+ virtual AST_Decl *look_in_supported (UTL_ScopedName *,
+ bool treat_as_ref);
+
+ // Lookup based on the local name.
+ AST_Decl *lookup_for_add (AST_Decl *d,
+ 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.
+ bool redef_clash (AST_Decl::NodeType new_nt,
+ AST_Decl::NodeType scope_elem_nt);
+
+ void check_for_predef_seq (AST_Decl *d);
+ // Set the appropriate *_seen_ flag if we are seeing a spec-defined
+ // sequence of a basic type.
+
+protected:
+ // Data.
+
+ // What type is this node? This is a cache of the information
+ // in AST_Decl
+ const AST_Decl::NodeType pd_scope_node_type;
+
+ // Storage for declarations in this scope.
+ AST_Decl **pd_decls; // Store declarations
+ long pd_decls_allocated; // How many allocated?
+ long pd_decls_used; // How many used?
+
+ // Storage for local manifest types in this scope.
+ AST_Decl **pd_local_types; // Store types
+ long pd_locals_allocated; // How many allocated?
+ long pd_locals_used; // How many used?
+
+ // Storage for referenced nodes in this scope.
+ AST_Decl **pd_referenced; // Store references
+ long pd_referenced_allocated; // How many allocated?
+ long pd_referenced_used; // How many used?
+
+ // Storage for identifiers used in this scope. CORBA 2.3 introduced
+ // stricter rules for clashes during name resolution, and the information
+ // in pd_referenced is not enough to catch them all.
+ Identifier **pd_name_referenced; // Store name references
+ long pd_name_referenced_allocated; // How many allocated?
+ long pd_name_referenced_used; // How many used?
+
+ // Have we seen a #pragma prefix declaration in this scope?
+ bool has_prefix_;
+
+ // Friend class UTL_ScopeActiveIterator defines active iterator for
+ // UTL_Scope. Definition follows below.
+ friend class UTL_ScopeActiveIterator;
+
+private:
+ friend int tao_yyparse (void);
+ friend class AST_Enum;
+ friend class IDL_GlobalData;
+
+ // Scope Management Protocol.
+ virtual AST_PredefinedType *fe_add_predefined_type (AST_PredefinedType *t);
+
+ virtual AST_Module *fe_add_module (AST_Module *m);
+
+ 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_EventType *fe_add_eventtype (AST_EventType *i);
+
+ virtual AST_EventTypeFwd *fe_add_eventtype_fwd (AST_EventTypeFwd *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);
+
+ virtual AST_Attribute *fe_add_attribute (AST_Attribute *a);
+
+ virtual AST_Operation *fe_add_operation (AST_Operation *o);
+
+ virtual AST_Argument *fe_add_argument (AST_Argument *a);
+
+ 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);
+
+ virtual AST_EnumVal *fe_add_enum_val (AST_EnumVal *v);
+
+ virtual AST_Typedef *fe_add_typedef (AST_Typedef *t);
+
+ virtual UTL_StrList *fe_add_context (UTL_StrList *c);
+
+ virtual UTL_NameList *fe_add_exceptions (UTL_NameList *e);
+
+ virtual AST_Sequence *fe_add_sequence (AST_Sequence *s);
+
+ virtual AST_String *fe_add_string (AST_String *s);
+
+ virtual AST_Array *fe_add_array (AST_Array *a);
+
+ virtual AST_Native *fe_add_native (AST_Native *n);
+
+ virtual AST_Factory *fe_add_factory (AST_Factory *f);
+
+ virtual AST_ValueBox *fe_add_valuebox (AST_ValueBox *vb);
+};
+
+// Active iterator for a UTL_Scope node
+class TAO_IDL_FE_Export UTL_ScopeActiveIterator
+{
+public:
+ // Operations.
+
+ // Constructor.
+ UTL_ScopeActiveIterator (UTL_Scope *s,
+ UTL_Scope::ScopeIterationKind ik);
+
+ // Advance to next item.
+ void next (void);
+
+ // Get current item.
+ AST_Decl *item (void);
+
+ // Have we iterated over entire scope?
+ bool is_done (void);
+
+ // What kind of iterator is this?
+ UTL_Scope::ScopeIterationKind iteration_kind (void);
+
+ // What stage are we in with this iterator?
+ UTL_Scope::ScopeIterationKind iteration_stage (void);
+
+private:
+ // Scope to iterate over.
+ UTL_Scope *iter_source;
+
+ // What kind of iteration?
+ UTL_Scope::ScopeIterationKind ik;
+
+ // What stage?
+ UTL_Scope::ScopeIterationKind 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
new file mode 100644
index 00000000000..9cb63b6d043
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_scoped_name.h
@@ -0,0 +1,77 @@
+// $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 _AST_SCOPED_NAME_AST_SCOPED_NAME_HH
+#define _AST_SCOPED_NAME_AST_SCOPED_NAME_HH
+
+#include "utl_idlist.h"
+
+// Define UTL_ScopedName as a list of strings.
+
+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
new file mode 100644
index 00000000000..e7084338265
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_stack.h
@@ -0,0 +1,146 @@
+// $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 _UTL_STACK_UTL_STACK_HH
+#define _UTL_STACK_UTL_STACK_HH
+
+#include "TAO_IDL_FE_Export.h"
+
+class UTL_Scope;
+
+// UTL_ScopeStack implements scope nesting.
+
+// Forward declaration of active iterator for UTL_ScopeStack.
+class UTL_ScopeStackActiveIterator;
+
+class TAO_IDL_FE_Export UTL_ScopeStack
+{
+public:
+ UTL_ScopeStack (void);
+ ~UTL_ScopeStack (void);
+
+ // Return top element.
+ UTL_Scope *top (void);
+
+ // Pop top element.
+ void pop (void);
+
+ // Clear entire stack.
+ void clear (void);
+
+ // Push an element on the stack and return stack.
+ UTL_ScopeStack *push (UTL_Scope *el);
+
+ // How deep is the stack now?
+ unsigned long depth (void);
+
+ // Return bottom element.
+ UTL_Scope *bottom (void);
+
+ // Return (top - 1) element.
+ UTL_Scope *next_to_top (void);
+
+ // return topmost non-NULL element.
+ UTL_Scope *top_non_null (void);
+
+private:
+ // Store scopes stack
+ UTL_Scope **pd_stack_data;
+
+ // 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.
+class TAO_IDL_FE_Export UTL_ScopeStackActiveIterator
+{
+public:
+ UTL_ScopeStackActiveIterator (UTL_ScopeStack &s);
+
+ // Advance to next element.
+ void next (void);
+
+ // Get current item.
+ UTL_Scope*item (void);
+
+ // Is the iteration finished?
+ long is_done (void);
+
+private:
+ // 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
new file mode 100644
index 00000000000..1c9f70ff95c
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_string.h
@@ -0,0 +1,125 @@
+// $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 _STRING_STRING_HH
+#define _STRING_STRING_HH
+
+#include "TAO_IDL_FE_Export.h"
+
+#include "ace/iosfwd.h"
+ /* Basic_Types.h are needed in QNX for size_t type. */
+#include "ace/Basic_Types.h"
+
+class TAO_IDL_FE_Export UTL_String
+{
+ // =TITLE
+ // UTL_String
+ // =DESCRIPTION
+ // string class to store identifiers
+public:
+ UTL_String (void);
+
+ UTL_String (const char *str);
+
+ UTL_String (UTL_String *s);
+
+ virtual ~UTL_String (void);
+
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+ // Dump to the ostream.
+
+ char *get_string (void);
+ // Get contents of utl_string.
+
+ char *get_canonical_rep (void);
+ // Get canonical representation. This is (implemented as) the all upper
+ // case corresponding string.
+
+ bool compare (UTL_String *s);
+ // Compare two UTL_String *
+
+ bool compare_quiet (UTL_String *s);
+ // Like the above but without error or warning message output.
+
+ virtual void destroy (void);
+ // Cleanup function.
+
+private:
+ // Data
+ char *p_str;
+ // Storage for characters.
+
+ char *c_str;
+ // Canonicalized string
+
+ size_t len;
+ // How long is string.
+
+ void canonicalize (void);
+ // Compute canonical representation.
+};
+
+#endif // _STRING_STRING_HH
diff --git a/TAO/TAO_IDL/include/utl_strlist.h b/TAO/TAO_IDL/include/utl_strlist.h
new file mode 100644
index 00000000000..a00d3f15325
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_strlist.h
@@ -0,0 +1,125 @@
+// $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 _UTL_STRLIST_UTL_STRLIST_HH
+#define _UTL_STRLIST_UTL_STRLIST_HH
+
+#include "utl_list.h"
+#include "ace/iosfwd.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.
+// 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.
+
+class TAO_IDL_FE_Export UTL_StrList : public UTL_List
+{
+public:
+ UTL_StrList (UTL_String *s,
+ UTL_StrList *cdr);
+
+ virtual ~UTL_StrList (void);
+
+ // AST Dumping
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Copy a list of strings
+ virtual UTL_List *copy (void);
+
+ // Cleanup method.
+ virtual void destroy (void);
+
+ // Get list element
+ UTL_String *head (void);
+
+ // Set the list element
+ void set_head (UTL_String *);
+
+ // Get last element in this list
+ UTL_String *last_component (void);
+
+private:
+ // The list item
+ UTL_String *pd_car_data;
+};
+
+// Active iterator for UTL_StrList
+class TAO_IDL_FE_Export UTL_StrlistActiveIterator
+ : public UTL_ListActiveIterator
+{
+public:
+ UTL_StrlistActiveIterator(UTL_StrList *s);
+
+ // Get current item.
+ UTL_String *item (void);
+};
+
+#endif // _UTL_STRLIST_UTL_STRLIST_HH
diff --git a/TAO/TAO_IDL/include/utl_tmpl/utl_decllist.h b/TAO/TAO_IDL/include/utl_tmpl/utl_decllist.h
new file mode 100644
index 00000000000..8de08c85725
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_tmpl/utl_decllist.h
@@ -0,0 +1,105 @@
+// $Id$
+
+/*
+ *======================================================================
+ *
+ *Copyright 1992 Sun Microsystems, Inc.
+ *
+ *The Interface Definition Language Compiler Front End (CFE) is made
+ *available for use provided that this legend is included on all media and
+ *documentation and as a part of the software program in whole or part.
+ *Users may copy and extend functionality (but may not remove
+ *functionality) of the Interface Definition Language CFE without charge,
+ *but are not authorized to license or distribute it to anyone else except
+ *as part of a product or program developed by the user or with the express
+ *written consent of Sun Microsystems, Inc.
+ *
+ *The names of Sun Microsystems, Inc. and any of its subsidiaries may not
+ *be used in advertising or publicity pertaining to distribution of
+ *Interface Definition Language CFE as permitted herein.
+ *
+ *The Interface Definition Language CFE may not be exported outside the
+ *United States without first obtaining the appropriate government
+ *approvals.
+ *
+ *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 Microsystems, Inc. or any of
+ *its subsidiaries or affiliates to assist in its use, correction,
+ *modification or enhancement.
+ *
+ *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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.
+ *
+ *SunSoft, Inc.
+ *2550 Garcia Avenue
+ *Mountain View, California 94043
+ *
+ *
+ *
+ *
+ *======================================================================
+ */
+
+#ifndef _UTL_DECLLIST_UTL_DECLLIST_HH
+#define _UTL_DECLLIST_UTL_DECLLIST_HH
+
+// utl_decllist.hh
+//
+// List of FE_Declarator nodes
+
+/*
+** DEPENDENCIES: utl_list.hh, fe_declarator.hh
+**
+** USE: Included from util.hh
+*/
+
+#include "ace/stdcpp.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "idl_fwd.h"
+#include "utl_list.h"
+#include "utl_idlist.h"
+#include "utl_scoped_name.h"
+#include "utl_identifier.h"
+#include "utl_string.h"
+#include "fe_declarator.h"
+
+
+class UTL_DeclList : public UTL_List<UTL_DeclList, FE_Declarator>
+{
+public:
+ // Operations
+
+ // Constructor(s)
+ UTL_DeclList(FE_Declarator *s, UTL_DeclList *cdr);
+ virtual ~UTL_DeclList() {}
+};
+
+// Active iterator for UTL_DeclList
+class UTL_DecllistActiveIterator :
+ public UTL_ListActiveIterator<UTL_DeclList, FE_Declarator>
+{
+public:
+ // Operations
+
+ // Constructor(s)
+ UTL_DecllistActiveIterator(UTL_DeclList *s);
+ virtual ~UTL_DecllistActiveIterator() {}
+};
+
+#endif // _UTL_DECLLIST_UTL_DECLLIST_HH
diff --git a/TAO/TAO_IDL/include/utl_tmpl/utl_exceptlist.h b/TAO/TAO_IDL/include/utl_tmpl/utl_exceptlist.h
new file mode 100644
index 00000000000..ea4f418a276
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_tmpl/utl_exceptlist.h
@@ -0,0 +1,113 @@
+// $Id$
+
+/*
+ *======================================================================
+ *
+ *Copyright 1992 Sun Microsystems, Inc.
+ *
+ *The Interface Definition Language Compiler Front End (CFE) is made
+ *available for use provided that this legend is included on all media and
+ *documentation and as a part of the software program in whole or part.
+ *Users may copy and extend functionality (but may not remove
+ *functionality) of the Interface Definition Language CFE without charge,
+ *but are not authorized to license or distribute it to anyone else except
+ *as part of a product or program developed by the user or with the express
+ *written consent of Sun Microsystems, Inc.
+ *
+ *The names of Sun Microsystems, Inc. and any of its subsidiaries may not
+ *be used in advertising or publicity pertaining to distribution of
+ *Interface Definition Language CFE as permitted herein.
+ *
+ *The Interface Definition Language CFE may not be exported outside the
+ *United States without first obtaining the appropriate government
+ *approvals.
+ *
+ *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 Microsystems, Inc. or any of
+ *its subsidiaries or affiliates to assist in its use, correction,
+ *modification or enhancement.
+ *
+ *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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.
+ *
+ *SunSoft, Inc.
+ *2550 Garcia Avenue
+ *Mountain View, California 94043
+ *
+ *
+ *
+ *
+ *======================================================================
+ */
+
+#ifndef _UTL_EXCEPTLIST_UTL_EXCEPTLIST_HH
+#define _UTL_EXCEPTLIST_UTL_EXCEPTLIST_HH
+
+// utl_exceptlist.hh
+//
+// List of AST_Exception nodes
+
+/*
+** DEPENDENCIES: utl_list.hh, ast_exception.hh
+**
+** USE: Included from util.hh
+*/
+
+#include "ace/stdcpp.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "idl_fwd.h"
+#include "utl_list.h"
+#include "utl_strlist.h"
+#include "utl_idlist.h"
+#include "utl_scoped_name.h"
+#include "utl_identifier.h"
+#include "utl_string.h"
+#include "ast_expression.h"
+#include "bool.h"
+#include "utl_scope.h"
+#include "ast_decl.h"
+#include "ast_type.h"
+#include "ast_concrete_type.h"
+#include "ast_structure.h"
+#include "ast_exception.h"
+
+
+class UTL_ExceptList : public UTL_List<UTL_ExceptList, AST_Exception>
+{
+public:
+ // Operations
+
+ // Constructor(s)
+ UTL_ExceptList(AST_Exception *s, UTL_ExceptList *cdr);
+ virtual ~UTL_ExceptList() {}
+};
+
+// Active iterator for UTL_ExceptList
+class UTL_ExceptlistActiveIterator :
+ public UTL_ListActiveIterator<UTL_ExceptList, AST_Exception>
+{
+public:
+ // Operations
+
+ // Constructor(s)
+ UTL_ExceptlistActiveIterator(UTL_ExceptList *s);
+ virtual ~UTL_ExceptlistActiveIterator() {}
+};
+
+#endif // _UTL_EXCEPTLIST_UTL_EXCEPTLIST_HH
diff --git a/TAO/TAO_IDL/include/utl_tmpl/utl_exprlist.h b/TAO/TAO_IDL/include/utl_tmpl/utl_exprlist.h
new file mode 100644
index 00000000000..84fbcd3957c
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_tmpl/utl_exprlist.h
@@ -0,0 +1,106 @@
+// $Id$
+
+/*
+ *======================================================================
+ *
+ *Copyright 1992 Sun Microsystems, Inc.
+ *
+ *The Interface Definition Language Compiler Front End (CFE) is made
+ *available for use provided that this legend is included on all media and
+ *documentation and as a part of the software program in whole or part.
+ *Users may copy and extend functionality (but may not remove
+ *functionality) of the Interface Definition Language CFE without charge,
+ *but are not authorized to license or distribute it to anyone else except
+ *as part of a product or program developed by the user or with the express
+ *written consent of Sun Microsystems, Inc.
+ *
+ *The names of Sun Microsystems, Inc. and any of its subsidiaries may not
+ *be used in advertising or publicity pertaining to distribution of
+ *Interface Definition Language CFE as permitted herein.
+ *
+ *The Interface Definition Language CFE may not be exported outside the
+ *United States without first obtaining the appropriate government
+ *approvals.
+ *
+ *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 Microsystems, Inc. or any of
+ *its subsidiaries or affiliates to assist in its use, correction,
+ *modification or enhancement.
+ *
+ *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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.
+ *
+ *SunSoft, Inc.
+ *2550 Garcia Avenue
+ *Mountain View, California 94043
+ *
+ *
+ *
+ *
+ *======================================================================
+ */
+
+#ifndef _UTL_EXPRLIST_UTL_EXPRLIST_HH
+#define _UTL_EXPRLIST_UTL_EXPRLIST_HH
+
+// utl_exprlist.hh
+//
+// List of strings
+
+/*
+** DEPENDENCIES: ast_expression.hh, utl_list.hh
+**
+** USE: Included from util.hh
+*/
+
+#include "ace/stdcpp.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "idl_fwd.h"
+#include "utl_list.h"
+#include "utl_strlist.h"
+#include "utl_idlist.h"
+#include "utl_scoped_name.h"
+#include "utl_identifier.h"
+#include "utl_string.h"
+#include "ast_expression.h"
+
+
+class UTL_ExprList : public UTL_List<UTL_ExprList, AST_Expression>
+{
+public:
+ // Operations
+
+ // Constructor(s)
+ UTL_ExprList(AST_Expression *s, UTL_ExprList *cdr);
+ virtual ~UTL_ExprList() {}
+};
+
+// Active iterator for UTL_ExprList
+class UTL_ExprlistActiveIterator :
+ public UTL_ListActiveIterator<UTL_ExprList, AST_Expression>
+{
+public:
+ // Operations
+
+ // Constructor(s)
+ UTL_ExprlistActiveIterator(UTL_ExprList *s);
+ virtual ~UTL_ExprlistActiveIterator() {}
+};
+
+#endif // _UTL_EXPRLIST_UTL_EXPRLIST_HH
diff --git a/TAO/TAO_IDL/include/utl_tmpl/utl_idlist.h b/TAO/TAO_IDL/include/utl_tmpl/utl_idlist.h
new file mode 100644
index 00000000000..76802a7f487
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_tmpl/utl_idlist.h
@@ -0,0 +1,105 @@
+// $Id$
+
+/*
+ *======================================================================
+ *
+ *Copyright 1992 Sun Microsystems, Inc.
+ *
+ *The Interface Definition Language Compiler Front End (CFE) is made
+ *available for use provided that this legend is included on all media and
+ *documentation and as a part of the software program in whole or part.
+ *Users may copy and extend functionality (but may not remove
+ *functionality) of the Interface Definition Language CFE without charge,
+ *but are not authorized to license or distribute it to anyone else except
+ *as part of a product or program developed by the user or with the express
+ *written consent of Sun Microsystems, Inc.
+ *
+ *The names of Sun Microsystems, Inc. and any of its subsidiaries may not
+ *be used in advertising or publicity pertaining to distribution of
+ *Interface Definition Language CFE as permitted herein.
+ *
+ *The Interface Definition Language CFE may not be exported outside the
+ *United States without first obtaining the appropriate government
+ *approvals.
+ *
+ *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 Microsystems, Inc. or any of
+ *its subsidiaries or affiliates to assist in its use, correction,
+ *modification or enhancement.
+ *
+ *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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.
+ *
+ *SunSoft, Inc.
+ *2550 Garcia Avenue
+ *Mountain View, California 94043
+ *
+ *
+ *
+ *
+ *======================================================================
+ */
+
+#ifndef _UTL_IDLIST_UTL_IDLIST_HH
+#define _UTL_IDLIST_UTL_IDLIST_HH
+
+// utl_idlist.hh
+//
+// List of Identifiers
+
+/*
+** DEPENDENCIES: utl_list.hh, utl_identifier.hh
+**
+** USE: Included from util.hh
+*/
+
+#include "ace/stdcpp.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "idl_fwd.h"
+#include "utl_list.h"
+#include "utl_identifier.h"
+#include "utl_string.h"
+
+class UTL_IdList : public UTL_List<UTL_IdList, Identifier>
+{
+ public:
+ // Constructor(s)
+ UTL_IdList(Identifier *car, UTL_IdList *cdr);
+ virtual ~UTL_IdList() {}
+
+ // AST Dumping
+ virtual void dump(ACE_OSTREAM_TYPE &o);
+
+ // Other operations
+
+ // Get last element in this list
+ Identifier *last_component();
+};
+
+// Active iterator for UTL_IdList
+
+class UTL_IdListActiveIterator :
+ public UTL_ListActiveIterator<UTL_IdList, Identifier>
+{
+ public:
+ // Constructor(s)
+ UTL_IdListActiveIterator(UTL_IdList *s);
+};
+
+#endif // _UTL_IDLIST_UTL_IDLIST_HH
diff --git a/TAO/TAO_IDL/include/utl_tmpl/utl_labellist.h b/TAO/TAO_IDL/include/utl_tmpl/utl_labellist.h
new file mode 100644
index 00000000000..b7ca1d38e43
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_tmpl/utl_labellist.h
@@ -0,0 +1,101 @@
+// $Id$
+
+/*
+ *======================================================================
+ *
+ *Copyright 1992 Sun Microsystems, Inc.
+ *
+ *The Interface Definition Language Compiler Front End (CFE) is made
+ *available for use provided that this legend is included on all media and
+ *documentation and as a part of the software program in whole or part.
+ *Users may copy and extend functionality (but may not remove
+ *functionality) of the Interface Definition Language CFE without charge,
+ *but are not authorized to license or distribute it to anyone else except
+ *as part of a product or program developed by the user or with the express
+ *written consent of Sun Microsystems, Inc.
+ *
+ *The names of Sun Microsystems, Inc. and any of its subsidiaries may not
+ *be used in advertising or publicity pertaining to distribution of
+ *Interface Definition Language CFE as permitted herein.
+ *
+ *The Interface Definition Language CFE may not be exported outside the
+ *United States without first obtaining the appropriate government
+ *approvals.
+ *
+ *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 Microsystems, Inc. or any of
+ *its subsidiaries or affiliates to assist in its use, correction,
+ *modification or enhancement.
+ *
+ *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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.
+ *
+ *SunSoft, Inc.
+ *2550 Garcia Avenue
+ *Mountain View, California 94043
+ *
+ *
+ *
+ *
+ *======================================================================
+ */
+
+#ifndef _UTL_LABELLIST_UTL_LABELLIST_HH
+#define _UTL_LABELLIST_UTL_LABELLIST_HH
+
+// utl_labellist.hh
+//
+// List of AST_UnionBranch nodes
+
+/*
+** DEPENDENCIES: utl_list.hh, ast_union_label.hh
+**
+** USE: Included from util.hh
+*/
+
+#include "ace/stdcpp.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "idl_fwd.h"
+#include "utl_list.h"
+#include "ast_union_label.h"
+
+
+class UTL_LabelList : public UTL_List<UTL_LabelList, AST_UnionLabel>
+{
+public:
+ // Operations
+
+ // Constructor(s)
+ UTL_LabelList(AST_UnionLabel *s, UTL_LabelList *cdr);
+ virtual ~UTL_LabelList() {}
+};
+
+// Active iterator for UTL_LabelList
+class UTL_LabellistActiveIterator :
+ public UTL_ListActiveIterator<UTL_LabelList, AST_UnionLabel>
+{
+public:
+ // Operations
+
+ // Constructor(s)
+ UTL_LabellistActiveIterator(UTL_LabelList *source);
+ virtual ~UTL_LabellistActiveIterator() {}
+};
+
+#endif // _UTL_LABELLIST_UTL_LABELLIST_HH
diff --git a/TAO/TAO_IDL/include/utl_tmpl/utl_list.h b/TAO/TAO_IDL/include/utl_tmpl/utl_list.h
new file mode 100644
index 00000000000..b300298b93d
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_tmpl/utl_list.h
@@ -0,0 +1,140 @@
+// $Id$
+
+/*
+ *======================================================================
+ *
+ *Copyright 1992 Sun Microsystems, Inc.
+ *
+ *The Interface Definition Language Compiler Front End (CFE) is made
+ *available for use provided that this legend is included on all media and
+ *documentation and as a part of the software program in whole or part.
+ *Users may copy and extend functionality (but may not remove
+ *functionality) of the Interface Definition Language CFE without charge,
+ *but are not authorized to license or distribute it to anyone else except
+ *as part of a product or program developed by the user or with the express
+ *written consent of Sun Microsystems, Inc.
+ *
+ *The names of Sun Microsystems, Inc. and any of its subsidiaries may not
+ *be used in advertising or publicity pertaining to distribution of
+ *Interface Definition Language CFE as permitted herein.
+ *
+ *The Interface Definition Language CFE may not be exported outside the
+ *United States without first obtaining the appropriate government
+ *approvals.
+ *
+ *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 Microsystems, Inc. or any of
+ *its subsidiaries or affiliates to assist in its use, correction,
+ *modification or enhancement.
+ *
+ *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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.
+ *
+ *SunSoft, Inc.
+ *2550 Garcia Avenue
+ *Mountain View, California 94043
+ *
+ *
+ *
+ *
+ *======================================================================
+ */
+
+#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
+*/
+
+// Forward declare active iterator for UTL_List
+template<class L, class T> class UTL_ListActiveIterator;
+
+template<class L, class T>
+class UTL_List
+{
+public:
+ // Operations
+
+ // Constructor(s)
+ UTL_List(T *c, L *l);
+ virtual ~UTL_List() {}
+
+ // Smash last cdr pointer in "this" with l
+ void nconc(L *l);
+
+ // Copy the list starting at "this"
+ L *copy();
+
+ // Get list element
+ T *head();
+
+ // Get next list
+ L *tail();
+
+ // Set the list element
+ void set_head(T *t);
+
+ // Set next list
+ void set_tail(L *l);
+
+ // How long is this list?
+ long length();
+
+private:
+ // Data
+ T *pd_car_data; // The next list
+ L *pd_cdr_data; // The next list
+
+ // Operations
+ long list_length(long n); // How long is it?
+
+ // Friend class
+ friend class UTL_ListActiveIterator<L, T>; // Friend class
+
+};
+
+// Active iterator for lists
+template<class L, class T>
+class UTL_ListActiveIterator
+{
+public:
+ // Operations
+
+ // Constructor(s)
+ UTL_ListActiveIterator(UTL_List<L, T> *s);
+ virtual ~UTL_ListActiveIterator() {}
+
+ // Get current item
+ T *item();
+
+ // Get next list
+ virtual void next();
+
+ // Are we at the end of this list?
+ virtual long is_done();
+
+protected:
+ // Data
+ UTL_List<L, T> *source; // On what to iterate?
+};
+
+#endif // _UTL_LIST_UTL_LIST_HH
diff --git a/TAO/TAO_IDL/include/utl_tmpl/utl_namelist.h b/TAO/TAO_IDL/include/utl_tmpl/utl_namelist.h
new file mode 100644
index 00000000000..bd79687f222
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_tmpl/utl_namelist.h
@@ -0,0 +1,103 @@
+// $Id$
+
+/*
+ *======================================================================
+ *
+ *Copyright 1992 Sun Microsystems, Inc.
+ *
+ *The Interface Definition Language Compiler Front End (CFE) is made
+ *available for use provided that this legend is included on all media and
+ *documentation and as a part of the software program in whole or part.
+ *Users may copy and extend functionality (but may not remove
+ *functionality) of the Interface Definition Language CFE without charge,
+ *but are not authorized to license or distribute it to anyone else except
+ *as part of a product or program developed by the user or with the express
+ *written consent of Sun Microsystems, Inc.
+ *
+ *The names of Sun Microsystems, Inc. and any of its subsidiaries may not
+ *be used in advertising or publicity pertaining to distribution of
+ *Interface Definition Language CFE as permitted herein.
+ *
+ *The Interface Definition Language CFE may not be exported outside the
+ *United States without first obtaining the appropriate government
+ *approvals.
+ *
+ *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 Microsystems, Inc. or any of
+ *its subsidiaries or affiliates to assist in its use, correction,
+ *modification or enhancement.
+ *
+ *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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.
+ *
+ *SunSoft, Inc.
+ *2550 Garcia Avenue
+ *Mountain View, California 94043
+ *
+ *
+ *
+ *
+ *======================================================================
+ */
+
+#ifndef _UTL_NAMELIST_UTL_NAMELIST_HH
+#define _UTL_NAMELIST_UTL_NAMELIST_HH
+
+// utl_namelist.hh
+//
+// List of UTL_ScopedName nodes
+
+/*
+** DEPENDENCIES: utl_list.hh, utl_scoped_name.hh
+**
+** USE: Included from util.hh
+*/
+
+#include "ace/stdcpp.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "idl_fwd.h"
+#include "utl_list.h"
+#include "utl_idlist.h"
+#include "utl_scoped_name.h"
+#include "utl_identifier.h"
+#include "utl_string.h"
+
+class UTL_NameList : public UTL_List<UTL_NameList, UTL_ScopedName>
+{
+public:
+ // Operations
+
+ // Constructor(s)
+ UTL_NameList(UTL_ScopedName *s, UTL_NameList *cdr);
+ virtual ~UTL_NameList() {}
+};
+
+// Active iterator for UTL_NameList
+class UTL_NamelistActiveIterator :
+ public UTL_ListActiveIterator<UTL_NameList, UTL_ScopedName>
+{
+public:
+ // Operations
+
+ // Constructor(s)
+ UTL_NamelistActiveIterator(UTL_NameList *source);
+ virtual ~UTL_NamelistActiveIterator() {}
+};
+
+#endif // _UTL_NAMELIST_UTL_NAMELIST_HH
diff --git a/TAO/TAO_IDL/include/utl_tmpl/utl_strlist.h b/TAO/TAO_IDL/include/utl_tmpl/utl_strlist.h
new file mode 100644
index 00000000000..1281df2ecd7
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_tmpl/utl_strlist.h
@@ -0,0 +1,109 @@
+// $Id$
+
+/*
+ *======================================================================
+ *
+ *Copyright 1992 Sun Microsystems, Inc.
+ *
+ *The Interface Definition Language Compiler Front End (CFE) is made
+ *available for use provided that this legend is included on all media and
+ *documentation and as a part of the software program in whole or part.
+ *Users may copy and extend functionality (but may not remove
+ *functionality) of the Interface Definition Language CFE without charge,
+ *but are not authorized to license or distribute it to anyone else except
+ *as part of a product or program developed by the user or with the express
+ *written consent of Sun Microsystems, Inc.
+ *
+ *The names of Sun Microsystems, Inc. and any of its subsidiaries may not
+ *be used in advertising or publicity pertaining to distribution of
+ *Interface Definition Language CFE as permitted herein.
+ *
+ *The Interface Definition Language CFE may not be exported outside the
+ *United States without first obtaining the appropriate government
+ *approvals.
+ *
+ *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 Microsystems, Inc. or any of
+ *its subsidiaries or affiliates to assist in its use, correction,
+ *modification or enhancement.
+ *
+ *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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.
+ *
+ *SunSoft, Inc.
+ *2550 Garcia Avenue
+ *Mountain View, California 94043
+ *
+ *
+ *
+ *
+ *======================================================================
+ */
+
+#ifndef _UTL_STRLIST_UTL_STRLIST_HH
+#define _UTL_STRLIST_UTL_STRLIST_HH
+
+// utl_strlist.hh
+//
+// List of String nodes
+
+/*
+** DEPENDENCIES: utl_list.hh, utl_string.hh
+**
+** USE: Included from util.hh
+*/
+
+#include "ace/stdcpp.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "idl_fwd.h"
+#include "utl_list.h"
+#include "utl_string.h"
+
+
+class UTL_StrList : public UTL_List<UTL_StrList, String>
+{
+public:
+ // Operations
+
+ // Constructor(s)
+ UTL_StrList(String *s, UTL_StrList *cdr);
+ virtual ~UTL_StrList() {}
+
+ // AST Dumping
+ virtual void dump(ACE_OSTREAM_TYPE &o);
+
+ // Other Operations
+
+ // Get last element in this list
+ String *last_component();
+};
+
+// Active iterator for UTL_StrList
+class UTL_StrlistActiveIterator :
+ public UTL_ListActiveIterator<UTL_StrList, String>
+{
+public:
+ // Operations
+
+ // Constructor(s)
+ UTL_StrlistActiveIterator(UTL_StrList *s);
+ virtual ~UTL_StrlistActiveIterator() {}
+};
+
+#endif // _UTL_STRLIST_UTL_STRLIST_HH
diff --git a/TAO/TAO_IDL/narrow/narrow.cpp b/TAO/TAO_IDL/narrow/narrow.cpp
new file mode 100644
index 00000000000..0421c880c58
--- /dev/null
+++ b/TAO/TAO_IDL/narrow/narrow.cpp
@@ -0,0 +1,173 @@
+// $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.
+
+ */
+
+#include "ast_module.h"
+#include "ast_root.h"
+#include "ast_valuetype.h"
+#include "ast_eventtype.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
+
+TAO_IDL_FE_Export AST_Decl *
+ScopeAsDecl (UTL_Scope *s)
+{
+ if (s == 0) return 0;
+
+ switch (s->scope_node_type ())
+ {
+ case AST_Decl::NT_module:
+ return AST_Module::narrow_from_scope (s);
+ case AST_Decl::NT_root:
+ 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_eventtype:
+ return AST_EventType::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:
+ return AST_Factory::narrow_from_scope (s);
+ case AST_Decl::NT_except:
+ return AST_Exception::narrow_from_scope (s);
+ case AST_Decl::NT_union:
+ return AST_Union::narrow_from_scope (s);
+ case AST_Decl::NT_struct:
+ return AST_Structure::narrow_from_scope (s);
+ case AST_Decl::NT_enum:
+ return AST_Enum::narrow_from_scope (s);
+ default:
+ return 0;
+ }
+}
+
+/*
+ * Convert an AST_Decl to a UTL_Scope if possible
+ */
+TAO_IDL_FE_Export UTL_Scope *
+DeclAsScope (AST_Decl *d)
+{
+ if (d == 0) return 0;
+
+ switch (d->node_type ())
+ {
+ case AST_Decl::NT_interface_fwd:
+ /*
+ * Resolve forward declared interface by looking at full_definition()
+ * field and iterating
+ */
+ d = (AST_InterfaceFwd::narrow_from_decl (d))->full_definition ();
+ /*
+ * Fall through
+ */
+ 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_eventtype:
+ return AST_EventType::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:
+ return AST_Root::narrow_from_decl (d);
+ case AST_Decl::NT_except:
+ return AST_Exception::narrow_from_decl (d);
+ case AST_Decl::NT_union:
+ return AST_Union::narrow_from_decl (d);
+ case AST_Decl::NT_struct:
+ return AST_Structure::narrow_from_decl (d);
+ case AST_Decl::NT_enum:
+ return AST_Enum::narrow_from_decl (d);
+ case AST_Decl::NT_op:
+ return AST_Operation::narrow_from_decl (d);
+ case AST_Decl::NT_factory:
+ return AST_Factory::narrow_from_decl (d);
+ default:
+ return 0;
+ }
+}
diff --git a/TAO/TAO_IDL/tao_idl.1 b/TAO/TAO_IDL/tao_idl.1
new file mode 100644
index 00000000000..73a21f3c203
--- /dev/null
+++ b/TAO/TAO_IDL/tao_idl.1
@@ -0,0 +1,272 @@
+.\" Process this file with
+.\" groff -man -Tascii tao_idl.1
+.\"
+.\" $Id$
+.\"
+.TH tao_idl 1 "DECEMBER 1998" "CORBA Tools" "User Manuals"
+.SH NAME
+tao_idl \- Compile IDL sources for use with the ACE ORB (TAO)
+.SH SYNOPSIS
+.B tao_idl
+.BI [ OPTION... ]
+.I filename
+.SH DESCRIPTION
+.B tao_idl
+is a program that is used to compile
+.I IDL
+source code. The IDL compiler generates 9 files from each .idl file,
+the file names are obtained by taking the IDL basename and appending
+C.h, C.inl, C.cpp, S.h, S.inl, S.cpp, S_T.h, S_T.inl, and S_T.cpp; the
+client stubs are declared in the C.h file, the skeletons in the S.h
+file. Please see the Options list on how to get different suffixes for
+these files.
+
+Both clients and servers should link against the object files for the stubs
+and skeletons, this is needed to transparently support collocated objects.
+
+The server skeleton can make use of different lookup strategies to match the
+incoming operation with the correct operation at the servant. Dynamic Hashing
+and Perfect Hashing are the two different operation lookup strategies that are
+currently supported in tao_idl. By default, tao_idl tries to use Perfect
+Hashing strategy. If supported and available, gperf generates the lookup
+methods for this strategy.
+.SH OPTIONS
+.TP
+.B \-u
+The compiler prints out the options that are given below and exits clean.
+.TP
+.B \-V
+the compiler printouts its version and exits
+.TP
+.BI "\-Wb," "option_list"
+pass options to the backend
+.IP
+.BI "skel_export_macro=" "macro_name"
+
+The compiler will emit macro_name right after each class or extern
+keyword in the generated skeleton code (S files,) this is needed for
+Windows/NT that requires special directives to export symbols from
+DLLs, usually the definition is just a space on unix platforms.
+.IP
+.BI "skel_export_include=" "include_path"
+
+The compiler will generate code to include include_path at the top of
+the generated server header, this is usually a good place to define
+the server side export macro.
+.IP
+.BI "stub_export_macro=" "macro_name"
+
+The compiler will emit macro_name right after each class or extern
+keyword in the generated stub code, this is needed for Windows/NT that
+requires special directives to export symbols from DLLs, usually the
+definition is just a space on unix platforms.
+.IP
+.BI "stub_export_include=" "include_path"
+
+The compiler will generate code to include include_path at the top of
+the client header, this is usually a good place to define the export
+macro.
+.IP
+.BI "export_macro=" "macro_name"
+
+The compiler will emit macro_name right after each class or extern keyword,
+this is needed for Windows/NT that requires special directives to export
+symbols from DLLs, usually the definition is just a space on unix platforms.
+.IP
+.BI "export_include=" "include_path"
+
+The compiler will generate code to include include_path at the top of the
+client header, this is usually a good place to define the export
+macro.
+.IP
+.BI "pch_include=" "include_path"
+
+The compiler will generate code to include include_path at the top of
+all TAO IDL compiler generated files. This can be used with a
+precompiled header mechanism, such as those provided by Borland
+C++Builder or MSVC++.
+.TP
+.B \-E
+only invoke the preprocessor
+.TP
+.BI "-Wp," "option_list"
+pass options to the preprocessor
+.TP
+.BI "\-D" "macro_definition"
+passed to the preprocessor
+.TP
+.BI "\-U" "macro_name"
+passed to the preprocessor
+.TP
+.BI "\-I" "include_path"
+passed to the preprocessor
+.TP
+.BI "\-A" "assertion"
+passed to the preprocessor
+.TP
+.B \-Y
+passed to the preprocessor
+.TP
+.B "\-H perfect_hash"
+To specify the IDL compiler to generate skelton code that uses perfect
+hashed operation lookup strategy, which is the default
+strategy. Perfect hashing uses gperf program, to generate lookup methods.
+.TP
+.B "\-H dynamic_hash"
+To specify the IDL compiler to generate skelton code that uses dynamic
+hashed operation lookup strategy.
+.TP
+.B "\-H binary_search"
+To specify the IDL compiler to generate skelton code that uses binary search
+based operation lookup strategy.
+.TP
+.B "\-H linear_search"
+To specify the IDL compiler to generate skelton code that uses linear search
+based operation lookup strategy.
+.TP
+.B "\-in"
+To generate #include statements with <>'s for the standard include
+files (e.g. tao/corba.h) indicating them as non-changing files
+.TP
+.B "\-ic"
+To generate #include statements with ""s for changing standard include
+files (e.g. tao/corba.h).
+.TP
+.B \-g
+To specify the path for the perfect hasing program (GPERF). Default is
+$ACE_ROOT/bin/gperf or whatever the ACE_GPERF macro was defined to be
+during compilation of TAO.
+.TP
+.B \-o
+To specify the output directory to IDL compiler as to where all the
+IDL\-compiler\-generated files are to be put. By default, all the files are
+put in the current directory from where
+.B tao_idl
+is called.
+.TP
+.B \-hc
+Client's header file name ending. Default is "C.h".
+.TP
+.B \-hs
+Server's header file name ending. Default is "S.h".
+.TP
+.B \-hT
+Server's template header file name ending. Default is "S_T.h".
+.TP
+.B \-cs
+Client stub's file name ending. Default is "C.cpp".
+.TP
+.B \-ci
+Client inline file name ending. Default is "C.inl".
+.TP
+.B \-ss
+Server skeleton file name ending. Default is "S.cpp".
+.TP
+.B \-sT
+Server template skeleton file name ending. Default is "S_T.cpp".
+.TP
+.B \-si
+Server inline skeleton file name ending. Default is "S.inl".
+.TP
+.B \-st
+Server's template inline file name ending. Default is "S_T.inl".
+.TP
+.B \-t
+Temporary directory to be used by the IDL compiler. Default : Resolve
+ACE_DEFAULT_TEMP_DIR_ENV. If it is not defined, choose /tmp/.
+.TP
+.B \-Cw
+Output a warning if two identifiers in the same scope differ in
+spelling only by case (default for now).
+.TP
+.B \-Ce
+Output an error if two indentifiers in the same scope differ in
+spelling only by case. Default output is warning (for now).
+
+Since there is at least one OMG IDL file (sfp.idl, part of the
+AVStreams specification) that is inconsistent with its own spelling
+rule, we have made a warning the default output until the issue is
+resolved.
+.TP
+.B \-Gc
+Generate stubs and skeletons using compiled marshaling.
+.TP
+.B \-Gi
+Generate stubs and skeletons using interpretive marshaling (default for now).
+.TP
+.BI "\-Ge " "flag"
+If the value of
+.I flag
+is 0,
+.B tao_idl
+will generate code that will use native C++ exceptions. If the value
+of
+.I flag
+is 1,
+.B tao_idl
+will generate code that will use environment variable for passing
+exceptions.
+.TP
+.B \-Gl
+.B For TAO Core developers only.
+Generate locality constrained interface implementation. This flag is
+not of general interests and should never be used by end-users.
+.TP
+.B \-Gp
+Generated collocated stubs that use Thru_POA collocation strategy.
+(default)
+.TP
+.B \-Gd
+Generated collocated stubs that use Direct collocation strategy.
+.TP
+.B \-Gt
+Generate optimized TypeCodes (unimplemented as yet).
+.TP
+.B \-Gv
+Generate code that supports Object-By-Value.
+.TP
+.B \-GI
+Generate templates files for the servant implementation.
+.TP
+.BI "\-GIh " "arg"
+Servant implemenation header file name ending.
+.TP
+.BI "\-GIs " "arg"
+Servant implemenation skeleton file name ending.
+.TP
+.BI "\-GIb " "arg"
+Prefix to the implementation class names.
+.TP
+.BI "\-GIe " "arg"
+Suffix to the implementation class names.
+.TP
+.BI "\-GIc " "arg"
+Generate copy constructors in the servant implementation template
+files.
+.TP
+.B \-Sa
+Suppress generation of the
+.I Any
+operators
+.TP
+.B \-Sp
+Suppress generation of collocated stubs that use Thru_POA collocation
+strategy.
+.TP
+.B \-Sd
+Suppress generation of collocated stubs that use Direct collocation
+strategy. (default)
+.TP
+.B \-St
+Suppress generation of the
+.I TypeCodes
+.SH BUGS
+None.
+.SH AUTHORS
+.IP
+Carlos O'Ryan <coryan@cs.wustl.edu>
+.IP
+Ossama Othman <othman@cs.wustl.edu>
+performed man page conversion from original HTML source
+.SH "SEE ALSO"
+.BR gperf (1)
diff --git a/TAO/TAO_IDL/tao_idl.cpp b/TAO/TAO_IDL/tao_idl.cpp
new file mode 100644
index 00000000000..fdc519cc7b1
--- /dev/null
+++ b/TAO/TAO_IDL/tao_idl.cpp
@@ -0,0 +1,385 @@
+// $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.
+
+*/
+
+#include "idl_defines.h"
+#include "be_extern.h"
+#include "global_extern.h"
+#include "fe_extern.h"
+#include "ast_root.h"
+#include "ast_extern.h"
+#include "utl_string.h"
+#include "utl_identifier.h"
+#include "drv_extern.h"
+#include "tao/Version.h"
+
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+// FUZZ: disable check_for_streams_include
+# include "ace/streams.h"
+#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
+
+ACE_RCSID (TAO_IDL,
+ tao_idl,
+ "$Id$")
+
+extern const char *DRV_arglist[];
+extern unsigned long DRV_argcount;
+
+char *DRV_files[NFILES];
+long DRV_nfiles = 0;
+long DRV_file_index = -1;
+
+void
+DRV_version (void)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ "%s\n"
+ "%s %s (%s %s)\n",
+ idl_global->prog_name (),
+ ACE_TEXT ("TAO_IDL_FE, version"),
+ ACE_TEXT (TAO_VERSION),
+ ACE_TEXT ("Based on Sun IDL FE, version"),
+ ACE_TEXT (SUN_IDL_FE_VERSION)));
+
+ BE_version ();
+}
+
+int
+DRV_init (int &argc, char *argv[])
+{
+ // Initialize front end.
+ FE_init ();
+
+ // Initialize driver private data
+ DRV_nfiles = 0;
+ DRV_file_index = 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 */
+
+ // Does nothing for IDL compiler, stores -ORB args, initializes
+ // ORB and IFR for IFR loader.
+ return BE_init (argc, argv);
+}
+
+void
+DRV_refresh (void)
+{
+ idl_global->set_err_count (0);
+ 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_lineno (-1);
+ idl_global->reset_flag_seen ();
+}
+
+void
+DRV_cleanup (void)
+{
+ // In case we got here via an init error or
+ // usage/version option - otherwise it's idempotent.
+ BE_cleanup ();
+
+ be_global->destroy ();
+ delete be_global;
+ be_global = 0;
+
+ idl_global->fini ();
+ delete idl_global;
+ idl_global = 0;
+
+ for (DRV_file_index = 0;
+ DRV_file_index < DRV_nfiles;
+ ++DRV_file_index)
+ {
+ ACE::strdelete (DRV_files[DRV_file_index]);
+ }
+
+ for (unsigned long i = 0; i < DRV_argcount; ++i)
+ {
+ delete [] (const_cast<char *> (DRV_arglist[i]));
+ }
+}
+
+/*
+** Drive the compilation
+**
+** LOGIC:
+**
+** 2. Initialize the BE. This builds an instance of the generator
+** 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
+** 6. Check for undefined forward declared interfaces. If any, exit now
+** 7. Check if asked to dump AST. If so, do.
+** 8. Invoke BE.
+*/
+
+void
+DRV_drive (const char *s)
+{
+ // Set the name of the IDL file we are parsing. This is useful to
+ // the backend when it generates C++ headers and files.
+ idl_global->idl_src_file (idl_global->utl_string_factory (s));
+
+ // Pass through CPP.
+ if (idl_global->compile_flags () & IDL_CF_INFORMATIVE)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "%s%s %s\n",
+ idl_global->prog_name (),
+ ACE_TEXT (": preprocessing"),
+ s));
+ }
+
+ DRV_pre_proc (s);
+
+ // Parse.
+ if (idl_global->compile_flags () & IDL_CF_INFORMATIVE)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "%s%s %s\n",
+ idl_global->prog_name (),
+ ACE_TEXT (": parsing"),
+ s));
+ }
+
+ // Return value not used - error count stored in idl_global
+ // and checked below.
+ (void) FE_yyparse ();
+
+ // We must do this as late as possible to make sure any
+ // forward declared structs or unions contained in a
+ // primary key at some level have been fully defined.
+ idl_global->check_primary_keys ();
+
+ // If there were any errors, stop.
+ if (idl_global->err_count () > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%s%s %s%s %d %s%s\n",
+ idl_global->prog_name (),
+ ACE_TEXT (":"),
+ s,
+ ACE_TEXT (": found"),
+ idl_global->err_count (),
+ ACE_TEXT ("error"),
+ ACE_TEXT ((idl_global->err_count () > 1
+ ? ACE_TEXT ("s")
+ : ACE_TEXT ("")))));
+
+ // Backend will be cleaned up after the exception is caught.
+ throw FE_Bailout ();
+ }
+
+ // Dump the code.
+ if ((idl_global->compile_flags () & IDL_CF_INFORMATIVE)
+ && (idl_global->compile_flags () & IDL_CF_DUMP_AST))
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "%s%s %s\n",
+ idl_global->prog_name (),
+ ACE_TEXT (": dump"),
+ s));
+ }
+
+ if (idl_global->compile_flags () & IDL_CF_DUMP_AST)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Dump of AST:\n")));
+
+ idl_global->root ()->dump (*ACE_DEFAULT_LOG_STREAM);
+ }
+
+ // Call the main entry point for the BE.
+ if (idl_global->compile_flags () & IDL_CF_INFORMATIVE)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "%s%s %s\n",
+ idl_global->prog_name (),
+ ACE_TEXT (": BE processing on"),
+ s));
+ }
+
+ // Make sure all forward declared structs and unions are defined
+ // before proceeding to code generation.
+ AST_check_fwd_decls ();
+
+ if (0 == idl_global->err_count ())
+ {
+ BE_produce ();
+ }
+ else
+ {
+ throw FE_Bailout ();
+ }
+
+ DRV_refresh ();
+}
+
+/*
+** LOGIC:
+**
+** 1. Initialize compiler driver
+** 2. Parse command line args
+** 3. If more than one file to parse, fork
+** 4. Otherwise, for the single file, invoke DRV_drive
+*/
+
+int
+main (int argc, char *argv[])
+{
+ // Return status.
+ int status = 0;
+
+ try
+ {
+ // Initialize driver and global variables.
+ status = DRV_init (argc, argv);
+
+ if (0 != status)
+ {
+ throw FE_Bailout ();
+ }
+
+ // Parse arguments.
+ DRV_parse_args (argc, argv);
+
+ // If a version message is requested, print it and exit.
+ if (idl_global->compile_flags () & IDL_CF_VERSION)
+ {
+ DRV_version ();
+ throw FE_Bailout ();
+ }
+
+ // If a usage message is requested, give it and exit.
+ if (idl_global->compile_flags () & IDL_CF_ONLY_USAGE)
+ {
+ DRV_usage ();
+ throw FE_Bailout ();
+ }
+
+ // If there are no input files, and we are not using the
+ // directory recursion option, there's no sense going any further.
+ if (0 == DRV_nfiles && 0 == idl_global->recursion_start ())
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("IDL: No input files\n")));
+
+ ++status;
+ throw FE_Bailout ();
+ }
+
+ AST_Generator *gen = be_global->generator_init ();
+
+ if (0 == gen)
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: DRV_generator_init() failed to create ")
+ ACE_TEXT ("generator, exiting\n")
+ ));
+
+ ++status;
+ throw FE_Bailout ();
+ }
+ else
+ {
+ idl_global->set_gen (gen);
+ }
+
+ // Initialize AST and load predefined types.
+ FE_populate ();
+
+ // Does various things in various backends.
+ BE_post_init (DRV_files, DRV_nfiles);
+
+ for (DRV_file_index = 0;
+ DRV_file_index < DRV_nfiles;
+ ++DRV_file_index)
+ {
+ DRV_drive (DRV_files[DRV_file_index]);
+ }
+ }
+ catch (FE_Bailout)
+ {
+ }
+
+ // Case 1: init error, status = 1, nothing added here.
+ // Case 2: other error(s), status = 0, error count added here.
+ status += idl_global->err_count ();
+
+ DRV_cleanup ();
+
+ return status;
+}
diff --git a/TAO/TAO_IDL/tao_idl.mpc b/TAO/TAO_IDL/tao_idl.mpc
new file mode 100644
index 00000000000..5266fc86a1c
--- /dev/null
+++ b/TAO/TAO_IDL/tao_idl.mpc
@@ -0,0 +1,185 @@
+// -*- MPC -*-
+// $Id$
+
+project(TAO_IDL_EXE) : aceexe, core, tao_output, crosscompile {
+ exename = tao_idl
+ libs += TAO_IDL_BE TAO_IDL_FE
+ install = $(ACE_ROOT)/bin
+ after += TAO_IDL_BE TAO_IDL_FE gperf
+
+ specific (automake) {
+ includes += $(srcdir)/include $(srcdir)/be_include $(srcdir)/fe $(TAO_ROOT)
+ macros += TAO_IDL_INCLUDE_DIR=\"\\"$(includedir)/tao\\"\"
+ } else {
+ includes += include be_include fe ..
+ }
+
+ specific {
+ // Override the template value for optimize. Building the exe
+ // with optimization turned on doesn't seem to work (at least not with
+ // vc6 or vc71). This is due to the use of addresses of static objecs
+ // within the code.
+ optimize =
+ }
+
+ verbatim(gnuace, local) {
+ ifeq ($(TAO_IDL_PREPROCESSOR),)
+ ifeq ($(ACE_CC_PREPROCESSOR),)
+ CPPFLAGS += -DTAO_IDL_PREPROCESSOR=\\\"$(strip $(CXX))\\\"
+ else
+ CPPFLAGS += -DACE_CC_PREPROCESSOR=\\\"$(subst \\,\\,$(ACE_CC_PREPROCESSOR))\\\"
+ endif
+ else
+ CPPFLAGS += -DTAO_IDL_PREPROCESSOR=\\\"$(subst \\,\\,$(TAO_IDL_PREPROCESSOR))\\\"
+ endif
+ }
+
+ Source_Files {
+ driver/drv_args.cpp
+ driver/drv_preproc.cpp
+ tao_idl.cpp
+ }
+
+ Header_Files {
+ include/drv_extern.h
+ }
+}
+
+
+project(TAO_IDL_BE) : acelib, conv_lib, tao_output, crosscompile {
+ sharedname = TAO_IDL_BE
+ libs += TAO_IDL_FE
+ dynamicflags = TAO_IDL_BE_BUILD_DLL
+ after += TAO_IDL_FE
+
+ specific (automake) {
+ includes += $(srcdir)/include $(srcdir)/be_include $(srcdir)/fe
+ } else {
+ includes += include be_include fe
+ }
+
+ specific {
+ // Override the template value for optimize. Building the backend
+ // with optimization turned on doesn't seem to work (at least not with
+ // vc6 or vc71). This is due to the use of addresses of static objecs
+ // within the code.
+ optimize =
+ }
+
+ Source_Files {
+ be
+ }
+
+ Header_Files {
+ be_include
+ }
+}
+
+
+project(TAO_IDL_FE) : acelib, conv_lib, tao_output, crosscompile {
+ sharedname = TAO_IDL_FE
+ dynamicflags = TAO_IDL_FE_BUILD_DLL
+
+ specific (automake) {
+ includes += $(srcdir)/include $(srcdir)/fe
+ } else {
+ includes += include fe
+ }
+
+ specific {
+ // Override the template value for optimize. Building the frontend
+ // with optimization turned on doesn't seem to work (at least not with
+ // vc6 or vc71). This is due to the use of addresses of static objecs
+ // within the code.
+ optimize =
+ }
+
+ Source_Files {
+ fe
+ ast
+ util
+ narrow
+ }
+
+ Header_Files {
+ include
+ }
+
+ verbatim(gnuace, local) {
+ fe/fe_lookup.cpp: fe/keywords.dat
+ " echo '\/\/ $$I''d$$' > $@"
+ " echo '' >> $@"
+ " echo '#include \"fe_private.h\"' >> $@"
+ " echo '#include \"ace/OS_NS_string.h\"' >> $@"
+ " echo '' >> $@"
+ " $(ACE_ROOT)/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,$$ $^ | \\"
+ " sed -e 's/,}/,0}/g' \\"
+ " -e 's/\\*str == \\*s && !strncmp/len == static_cast<unsigned int> (ACE_OS::strlen (s)) \\&\\& *str == *s \\&\\& !ACE_OS::strncmp/g' \\"
+ " >> $@"
+
+ fe/lex.yy.cpp: fe/idl.ll
+ " @echo 'WARNING: Potentially outdated $@'"
+ " @echo ' either touch(1) the file or explicitly'"
+ " @echo ' generate it using:'"
+ " @echo ' make lex.yy'"
+
+ .PHONY: lex.yy
+ lex.yy:
+ "ifeq ($(notdir $(LEX)), flex)"
+ " $(LEX) -L -t fe/idl.ll | \\"
+ " sed -e 's/yy/tao_yy/g' \\"
+ " -e 's/YY/TAO_YY/g' \\"
+ " -e 's/ NULL/ 0/g' \\"
+ " -e 's/ / /g' \\"
+ " -e 's/ *$$\/\/g' \\"
+ " -e 's/TAO_YY_BREAK break;/TAO_YY_BREAK ACE_NOTREACHED (break;)/g' \\"
+ " -e 's/ECHO/TAO_YY_ECHO/' \\"
+ " -e 's/fread\([^\)]*\)/static_cast<int> (&)/g' \\"
+ " -e 's/\\$$Hea''der.*\\$$/$$I''d$$/' \\"
+ " -e 's@#include <stdio\.h>@#include \"ace/os_include/os_stdio.h\"@' \\"
+ " -e 's@#include <unistd\.h>@#include \"ace/os_include/os_ctype.h\"@' \\"
+ " -e '/#include </d' \\"
+ " > fe/lex.yy.cpp"
+ " (cd fe; patch < lex.yy.cpp.diff)"
+ "else"
+ " @echo 'ERROR: You must use flex 2.5.4 or higher to process this file'"
+ " @/bin/false"
+ "endif"
+
+ fe/y.tab.cpp: fe/idl.yy
+ " @echo 'WARNING: Potentially outdated $@'"
+ " @echo ' either touch(1) the file or explicitly'"
+ " @echo ' generate it using:'"
+ " @echo ' make y.tab'"
+
+ .PHONY: y.tab
+ y.tab: fe/idl.yy
+ "ifeq ($(notdir $(YACC)), bison)"
+ " $(YACC) -y -l -d fe/idl.yy"
+ " sed -e 's/char \\*getenv/char *ace_foo/g' \\"
+ " -e 's/= getenv/= ACE_OS::getenv/g' \\"
+ " -e 's/int yynew_state,/int,/g' \\"
+ " -e 's/int yyold_state,/int,/g' \\"
+ " -e 's/int yyrule_num,/int,/g' \\"
+ " -e 's/\\(YYDEBUG_DISCARD_TOKEN.*int\\) yytoken_num/\\1/g' \\"
+ " -e 's/yynewerror:\/\/g' \\"
+ " -e 's/yy/tao_yy/g' \\"
+ " -e 's/YY/TAO_YY/g' \\"
+ " -e 's/ / /g' \\"
+ " -e 's/ *$$\/\/g' \\"
+ " -e 's/y\\.tab\\.c/y.tab.cpp/g' \\"
+ " -e 's%\\(#pragma ident\\)%\/\/ \\1%' < y.tab.c > /tmp/$(USER).Y"
+ " sed -e 's/yy/tao_yy/g' \\"
+ " -e 's/YY/TAO_YY/g' < y.tab.h > /tmp/$(USER).YH"
+ " echo '\/\/ $$I''d$$' > fe/y.tab.cpp"
+ " cat /tmp/$(USER).Y >> fe/y.tab.cpp"
+ " echo '\/\/ $$I''d$$' > fe/y.tab.h"
+ " cat /tmp/$(USER).YH >> fe/y.tab.h"
+ " $(RM) /tmp/$(USER).Y /tmp/$(USER).YH y.tab.c y.tab.h"
+ " (cd fe; patch < y.tab.cpp.diff)"
+ "else"
+ " @echo 'ERROR: You must use bison 1.875b or higher to process this file'"
+ " @/bin/false"
+ "endif"
+ }
+}
diff --git a/TAO/TAO_IDL/util/utl_decllist.cpp b/TAO/TAO_IDL/util/utl_decllist.cpp
new file mode 100644
index 00000000000..dd34ce2c344
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_decllist.cpp
@@ -0,0 +1,157 @@
+// $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.
+
+ */
+
+// utl_decllist.cc
+//
+// Implementation of a list of declarators
+
+// 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.
+
+#include "utl_decllist.h"
+#include "fe_declarator.h"
+
+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)
+{
+}
+
+/*
+ * Public operations
+ */
+
+// Get list item
+FE_Declarator *
+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
+ */
+
+// UTL_DeclList active iterator
+
+/*
+ * Constructor
+ */
+
+UTL_DecllistActiveIterator::UTL_DecllistActiveIterator (UTL_DeclList *s)
+ : UTL_ListActiveIterator (s)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Get current item
+FE_Declarator *
+UTL_DecllistActiveIterator::item (void)
+{
+ if (source == 0)
+ {
+ return 0;
+ }
+
+ return ((UTL_DeclList *) source)->head ();
+}
+
+/*
+ * Redefined inherited operations
+ */
+
diff --git a/TAO/TAO_IDL/util/utl_err.cpp b/TAO/TAO_IDL/util/utl_err.cpp
new file mode 100644
index 00000000000..f412e4c0d09
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_err.cpp
@@ -0,0 +1,1414 @@
+// $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.
+
+ */
+
+// utl_err.cc - Implementation of error reporting object for IDL
+// compiler program
+
+#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"
+#include "idl_defines.h"
+
+// FUZZ: disable check_for_streams_include
+#include "ace/streams.h"
+
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (util,
+ utl_err,
+ "$Id$")
+
+// Convert an error code into a const char *
+static const char *
+error_string (UTL_Error::ErrorCode c)
+{
+ switch (c)
+ {
+ case UTL_Error::EIDL_OK:
+ return "all is fine ";
+ case UTL_Error::EIDL_SYNTAX_ERROR:
+ return "";
+ case UTL_Error::EIDL_REDEF:
+ return "illegal redefinition ";
+ case UTL_Error::EIDL_DEF_USE:
+ return "redefinition after use, ";
+ case UTL_Error::EIDL_MULTIPLE_BRANCH:
+ return "union with duplicate branch label ";
+ case UTL_Error::EIDL_COERCION_FAILURE:
+ return "coercion failure ";
+ case UTL_Error::EIDL_SCOPE_CONFLICT:
+ return "definition scope is different than fwd declare scope, ";
+ case UTL_Error::EIDL_ONEWAY_CONFLICT:
+ return "oneway operation with OUT or INOUT parameters, ";
+ case UTL_Error::EIDL_PREFIX_CONFLICT:
+ return "prefix at declaration differs from prefix at definition or use, ";
+ case UTL_Error::EIDL_ILLEGAL_VERSION:
+ return "illegal version number, ";
+ case UTL_Error::EIDL_VERSION_RESET:
+ 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 "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:
+ return "error in or illegal use of raises(..) clause, ";
+ 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.
+ return "";
+ case UTL_Error::EIDL_SUPPORTS_FWD_ERROR:
+ // More intelligible message printed by error routine.
+ return "";
+ case UTL_Error::EIDL_PRIMARY_KEY_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_CONCRETE_VT_EXPECTED:
+ return "concrete value type expected: ";
+ case UTL_Error::EIDL_ABSTRACT_EXPECTED:
+ return "abstract type expected: ";
+ case UTL_Error::EIDL_EVENTTYPE_EXPECTED:
+ return "event 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:
+ return "Warning - identifier spellings differ only in case: ";
+ case UTL_Error::EIDL_KEYWORD_ERROR:
+ return "spelling differs from IDL keyword only in case: ";
+ case UTL_Error::EIDL_KEYWORD_WARNING:
+ return "Warning - spelling differs from IDL keyword only in case: ";
+ case UTL_Error::EIDL_ENUM_VAL_EXPECTED:
+ return "enumerator expected: ";
+ case UTL_Error::EIDL_ENUM_VAL_NOT_FOUND:
+ return "enumerator by this name not defined: ";
+ case UTL_Error::EIDL_AMBIGUOUS:
+ return "ambiguous definition: ";
+ case UTL_Error::EIDL_DECL_NOT_DEFINED:
+ return "forward declared but never defined: ";
+ case UTL_Error::EIDL_FWD_DECL_LOOKUP:
+ /* More intelligible message printed by error routine */
+ return "";
+ case UTL_Error::EIDL_RECURSIVE_TYPE:
+ return "illegal recursive use of type: ";
+ case UTL_Error::EIDL_NONVOID_ONEWAY:
+ return "non-void return type in oneway operation: ";
+ case UTL_Error::EIDL_REDEF_SCOPE:
+ return "redefinition inside defining scope: ";
+ case UTL_Error::EIDL_NOT_A_TYPE:
+ return "specified symbol is not a type: ";
+ case UTL_Error::EIDL_UNDERSCORE:
+ return "identifier has more than one leading underscore: ";
+ case UTL_Error::EIDL_EMPTY_MODULE:
+ return "module must contain at least one declaration: ";
+ case UTL_Error::EIDL_BACK_END:
+ return "back end: ";
+ case UTL_Error::EIDL_ILLEGAL_INFIX:
+ return "illegal infix operator in expression";
+ case UTL_Error::EIDL_LOCAL_REMOTE_MISMATCH:
+ return "";
+ case UTL_Error::EIDL_IGNORE_IDL3_ERROR:
+ return "improper use of -Sm option with ";
+ case UTL_Error::EIDL_TC_SUPPRESSION_WARNING:
+ /* More intelligible message printed by warning routine */
+ return "";
+ case UTL_Error::EIDL_ILLEGAL_BOXED_TYPE:
+ return "valuetype not allowed as type of boxed value type";
+ case UTL_Error::EIDL_ILLEGAL_PRIMARY_KEY:
+ return "illegal primary key";
+ }
+
+ return 0;
+}
+
+// Print out an error message header on cerr
+static void
+idl_error_header (UTL_Error::ErrorCode c,
+ long lineno,
+ ACE_CString s)
+{
+ ACE_ERROR ((LM_ERROR,
+ "%s: \"%s\", line %d: %s",
+ idl_global->prog_name (),
+ s.c_str (),
+ lineno == -1 ? idl_global->lineno () : lineno,
+ error_string (c)));
+}
+
+// Convert the type of an AST_Expression to a char *.
+static const char *
+exprtype_to_string (AST_Expression::ExprType t)
+{
+ switch (t) {
+ case AST_Expression::EV_short:
+ return "short";
+ case AST_Expression::EV_ushort:
+ return "unsigned short";
+ case AST_Expression::EV_long:
+ return "long";
+ case AST_Expression::EV_ulong:
+ return "unsigned long";
+ case AST_Expression::EV_float:
+ return "float";
+ case AST_Expression::EV_double:
+ return "double";
+ case AST_Expression::EV_char:
+ return "char";
+ case AST_Expression::EV_octet:
+ return "octet";
+ case AST_Expression::EV_bool:
+ return "boolean";
+ case AST_Expression::EV_string:
+ return "string";
+ case AST_Expression::EV_enum:
+ return "enum";
+ case AST_Expression::EV_void:
+ return "void";
+ case AST_Expression::EV_none:
+ return "none";
+ case AST_Expression::EV_wchar:
+ return "wchar";
+ case AST_Expression::EV_longlong:
+ case AST_Expression::EV_ulonglong:
+ case AST_Expression::EV_longdouble:
+ case AST_Expression::EV_wstring:
+ case AST_Expression::EV_any:
+ case AST_Expression::EV_object:
+ return 0;
+ }
+ return 0;
+}
+
+// Convert a parse state into a possible error message
+static const char *
+parse_state_to_error_message (IDL_GlobalData::ParseState ps)
+{
+ switch (ps)
+ {
+ case IDL_GlobalData::PS_NoState:
+ 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";
+ case IDL_GlobalData::PS_InterfaceDeclSeen:
+ return "Malformed interface declaration";
+ case IDL_GlobalData::PS_ValueTypeDeclSeen:
+ return "Malformed value type declaration";
+ case IDL_GlobalData::PS_ComponentDeclSeen:
+ return "Malformed component declaration";
+ case IDL_GlobalData::PS_HomeDeclSeen:
+ return "Malformed home declaration";
+ case IDL_GlobalData::PS_EventDeclSeen:
+ return "Malformed event type declaration";
+ case IDL_GlobalData::PS_ModuleDeclSeen:
+ return "Malformed module declaration";
+ case IDL_GlobalData::PS_AttrDeclSeen:
+ return "Malformed attribute declaration";
+ case IDL_GlobalData::PS_OpDeclSeen:
+ 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:
+ return "Missing '{' or illegal syntax following module identifier";
+ case IDL_GlobalData::PS_ModuleSqSeen:
+ return "Illegal syntax following module '{' opener";
+ case IDL_GlobalData::PS_ModuleQsSeen:
+ return "Illegal syntax following module '}' closer";
+ case IDL_GlobalData::PS_ModuleBodySeen:
+ return "Illegal syntax following module body statement(s)";
+ 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_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_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_EventTypeSeen:
+ return "Missing interface identifier following EVENTTYPE keyword";
+ case IDL_GlobalData::PS_EventTypeForwardSeen:
+ return "Missing ';' following forward event type declaration";
+ case IDL_GlobalData::PS_EventTypeIDSeen:
+ return "Missing '{' or illegal syntax following event type identifier";
+ case IDL_GlobalData::PS_EventTypeSqSeen:
+ return "Illegal syntax following event type '{' opener";
+ case IDL_GlobalData::PS_EventTypeQsSeen:
+ return "Illegal syntax following event type '}' closer";
+ case IDL_GlobalData::PS_EventTypeBodySeen:
+ return "Illegal syntax following event 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:
+ return "Missing ',' following scoped name in scoped name list";
+ case IDL_GlobalData::PS_SN_IDSeen:
+ return "Illegal component in scoped name";
+ case IDL_GlobalData::PS_ScopeDelimSeen:
+ return "Illegal component in scoped name following '::'";
+ case IDL_GlobalData::PS_ConstSeen:
+ return "Missing type or illegal syntax following CONST keyword";
+ case IDL_GlobalData::PS_ConstTypeSeen:
+ return "Missing identifier or illegal syntax following const type";
+ case IDL_GlobalData::PS_ConstIDSeen:
+ return "Missing '=' or illegal syntax after const identifier";
+ case IDL_GlobalData::PS_ConstAssignSeen:
+ return "Missing value expr or illegal syntax following '='";
+ case IDL_GlobalData::PS_ConstExprSeen:
+ return "Missing ';' or illegal syntax following value expr in const";
+ case IDL_GlobalData::PS_TypedefSeen:
+ return "Missing type or illegal syntax following TYPEDEF keyword";
+ case IDL_GlobalData::PS_TypeSpecSeen:
+ return "Missing declarators or illegal syntax following type spec";
+ case IDL_GlobalData::PS_DeclaratorsSeen:
+ return "Illegal syntax following declarators in TYPEDEF declaration";
+ case IDL_GlobalData::PS_StructSeen:
+ return "Missing struct identifier following STRUCT keyword";
+ case IDL_GlobalData::PS_StructIDSeen:
+ return "Missing '{' or illegal syntax following struct identifier";
+ case IDL_GlobalData::PS_StructSqSeen:
+ return "Illegal syntax following struct '{' opener";
+ case IDL_GlobalData::PS_StructQsSeen:
+ return "Illegal syntax following struct '}' closer";
+ case IDL_GlobalData::PS_StructBodySeen:
+ return "Illegal syntax following struct body statement(s)";
+ case IDL_GlobalData::PS_MemberTypeSeen:
+ return "Illegal syntax or missing identifier following member type";
+ case IDL_GlobalData::PS_MemberDeclsSeen:
+ return "Illegal syntax following member declarator(s)";
+ case IDL_GlobalData::PS_MemberDeclsCompleted:
+ return "Missing ',' between member decls of same type(?)";
+ case IDL_GlobalData::PS_UnionSeen:
+ return "Missing identifier following UNION keyword";
+ case IDL_GlobalData::PS_UnionIDSeen:
+ return "Illegal syntax following union identifier";
+ case IDL_GlobalData::PS_SwitchSeen:
+ return "Illegal syntax following SWITCH keyword";
+ case IDL_GlobalData::PS_SwitchOpenParSeen:
+ return "Illegal syntax following '(' in switch in union";
+ case IDL_GlobalData::PS_SwitchTypeSeen:
+ return "Illegal syntax following type decl in switch in union";
+ case IDL_GlobalData::PS_SwitchCloseParSeen:
+ return "Missing union '{' opener";
+ case IDL_GlobalData::PS_UnionSqSeen:
+ return "Illegal syntax following union '{' opener";
+ case IDL_GlobalData::PS_UnionQsSeen:
+ return "Illegal syntax following union '}' closer";
+ case IDL_GlobalData::PS_DefaultSeen:
+ return "Illegal syntax or missing ':' following DEFAULT keyword";
+ case IDL_GlobalData::PS_UnionLabelSeen:
+ return "Illegal syntax following branch label in union";
+ case IDL_GlobalData::PS_LabelColonSeen:
+ return "Illegal syntax following ':' in branch label in union";
+ case IDL_GlobalData::PS_LabelExprSeen:
+ return "Illegal syntax following label expression in union";
+ case IDL_GlobalData::PS_UnionElemSeen:
+ case IDL_GlobalData::PS_UnionElemCompleted:
+ return "Illegal syntax following union element";
+ case IDL_GlobalData::PS_CaseSeen:
+ return "Illegal syntax following CASE keyword in union";
+ case IDL_GlobalData::PS_UnionElemTypeSeen:
+ return "Illegal syntax following type decl in union element";
+ case IDL_GlobalData::PS_UnionElemDeclSeen:
+ return "Illegal syntax following declarator in union element";
+ case IDL_GlobalData::PS_UnionBodySeen:
+ return "Illegal syntax following union body statement(s)";
+ case IDL_GlobalData::PS_EnumSeen:
+ return "Illegal syntax or missing identifier following ENUM keyword";
+ case IDL_GlobalData::PS_EnumIDSeen:
+ return "Illegal syntax or missing '{' following enum identifier";
+ case IDL_GlobalData::PS_EnumSqSeen:
+ return "Illegal syntax following enum '{' opener";
+ case IDL_GlobalData::PS_EnumQsSeen:
+ return "Illegal syntax following enum '}' closer";
+ case IDL_GlobalData::PS_EnumBodySeen:
+ return "Illegal syntax following enum body statement(s)";
+ case IDL_GlobalData::PS_EnumCommaSeen:
+ return "Illegal syntax or missing identifier following ',' in enum";
+ case IDL_GlobalData::PS_SequenceSeen:
+ return "Illegal syntax or missing '<' following SEQUENCE keyword";
+ case IDL_GlobalData::PS_SequenceSqSeen:
+ return "Illegal syntax or missing type following '<' in sequence";
+ case IDL_GlobalData::PS_SequenceQsSeen:
+ return "Illegal syntax following '>' in sequence";
+ case IDL_GlobalData::PS_SequenceTypeSeen:
+ return "Illegal syntax following sequence type declaration";
+ case IDL_GlobalData::PS_SequenceCommaSeen:
+ return "Illegal syntax or missing size expr following ',' in sequence";
+ case IDL_GlobalData::PS_SequenceExprSeen:
+ return "Illegal syntax or missing '>' following size expr in sequence";
+ case IDL_GlobalData::PS_StringSeen:
+ return "Illegal syntax or missing '<' following STRING keyword";
+ case IDL_GlobalData::PS_StringSqSeen:
+ return "Illegal syntax or missing size expr following '<' in string";
+ case IDL_GlobalData::PS_StringQsSeen:
+ return "Illegal syntax following '>' in string";
+ case IDL_GlobalData::PS_StringExprSeen:
+ return "Illegal syntax or missing '>' after size expr in string";
+ case IDL_GlobalData::PS_StringCompleted:
+ return "Illegal syntax after string declaration";
+ case IDL_GlobalData::PS_ArrayIDSeen:
+ return "Illegal syntax or missing dimensions after array identifier";
+ case IDL_GlobalData::PS_ArrayCompleted:
+ return "Illegal syntax after array declaration";
+ case IDL_GlobalData::PS_DimSqSeen:
+ return "Illegal syntax or missing size expr after '[' in array declaration";
+ case IDL_GlobalData::PS_DimQsSeen:
+ return "Illegal syntax after ']' in array declaration";
+ case IDL_GlobalData::PS_DimExprSeen:
+ return "Illegal syntax or missing ']' after size expr in array declaration";
+ case IDL_GlobalData::PS_AttrROSeen:
+ return "Illegal syntax after READONLY keyword";
+ case IDL_GlobalData::PS_AttrSeen:
+ return "Illegal syntax after ATTRIBUTE keyword";
+ case IDL_GlobalData::PS_AttrTypeSeen:
+ return "Illegal syntax after type in attribute declaration";
+ case IDL_GlobalData::PS_AttrDeclsSeen:
+ return "Illegal syntax after attribute declarators";
+ case IDL_GlobalData::PS_AttrCompleted:
+ return "Illegal syntax after attribute declaration";
+ case IDL_GlobalData::PS_ExceptSeen:
+ return "Illegal syntax or missing identifier after EXCEPTION keyword";
+ case IDL_GlobalData::PS_ExceptIDSeen:
+ return "Illegal syntax or missing '{' after exception identifier";
+ case IDL_GlobalData::PS_ExceptSqSeen:
+ return "Illegal syntax after exception '{' opener";
+ case IDL_GlobalData::PS_ExceptQsSeen:
+ return "Illegal syntax after exception '}' closer";
+ case IDL_GlobalData::PS_ExceptBodySeen:
+ return "Illegal syntax after exception body statement(s)";
+ case IDL_GlobalData::PS_OpAttrSeen:
+ return "Illegal syntax or missing type after operation attribute";
+ case IDL_GlobalData::PS_OpTypeSeen:
+ return "Illegal syntax or missing identifier after operation type";
+ case IDL_GlobalData::PS_OpIDSeen:
+ return "Illegal syntax or missing '(' after operation identifier";
+ case IDL_GlobalData::PS_OpParsCompleted:
+ return "Illegal syntax after operation parameter list";
+ case IDL_GlobalData::PS_OpRaiseCompleted:
+ return "Illegal syntax after optional RAISES in operation declaration";
+ case IDL_GlobalData::PS_OpGetRaiseCompleted:
+ return "Illegal syntax after optional GETRAISES in operation declaration";
+ case IDL_GlobalData::PS_OpSetRaiseCompleted:
+ return "Illegal syntax after optional SETRAISES in operation declaration";
+ case IDL_GlobalData::PS_OpContextCompleted:
+ return "Illegal syntax after optional CONTEXT in operation declaration";
+ case IDL_GlobalData::PS_OpCompleted:
+ return "Illegal syntax after operation declaration";
+ case IDL_GlobalData::PS_OpSqSeen:
+ return "Illegal syntax after operation parameter list '(' opener";
+ case IDL_GlobalData::PS_OpQsSeen:
+ return "Illegal syntax after operation parameter list ')' closer";
+ case IDL_GlobalData::PS_OpParCommaSeen:
+ return "Illegal syntax or missing direction in parameter declaration";
+ case IDL_GlobalData::PS_OpParDirSeen:
+ return "Illegal syntax or missing type in parameter declaration";
+ case IDL_GlobalData::PS_OpParTypeSeen:
+ return "Illegal syntax or missing declarator in parameter declaration";
+ case IDL_GlobalData::PS_OpParDeclSeen:
+ return "Illegal syntax following parameter declarator";
+ case IDL_GlobalData::PS_OpRaiseSeen:
+ return "Illegal syntax or missing '(' after RAISES keyword";
+ case IDL_GlobalData::PS_OpRaiseSqSeen:
+ return "Illegal syntax after RAISES '(' opener";
+ case IDL_GlobalData::PS_OpRaiseQsSeen:
+ return "Illegal syntax after RAISES ')' closer";
+ case IDL_GlobalData::PS_OpGetRaiseSeen:
+ return "Illegal syntax or missing '(' after GETRAISES keyword";
+ case IDL_GlobalData::PS_OpGetRaiseSqSeen:
+ return "Illegal syntax after GETRAISES '(' opener";
+ case IDL_GlobalData::PS_OpGetRaiseQsSeen:
+ return "Illegal syntax after GETRAISES ')' closer";
+ case IDL_GlobalData::PS_OpSetRaiseSeen:
+ return "Illegal syntax or missing '(' after SETRAISES keyword";
+ case IDL_GlobalData::PS_OpSetRaiseSqSeen:
+ return "Illegal syntax after SETRAISES '(' opener";
+ case IDL_GlobalData::PS_OpSetRaiseQsSeen:
+ return "Illegal syntax after SETRAISES ')' closer";
+ case IDL_GlobalData::PS_OpContextSeen:
+ return "Illegal syntax or missing '(' after CONTEXT keyword";
+ case IDL_GlobalData::PS_OpContextSqSeen:
+ return "Illegal syntax after CONTEXT '(' opener";
+ case IDL_GlobalData::PS_OpContextQsSeen:
+ return "Illegal syntax after CONTEXT ')' closer";
+ case IDL_GlobalData::PS_OpContextCommaSeen:
+ return "Illegal syntax after ',' in CONTEXT in operation declaration";
+ case IDL_GlobalData::PS_DeclsCommaSeen:
+ return "Illegal syntax after ',' in declarators list";
+ case IDL_GlobalData::PS_DeclsDeclSeen:
+ return "Illegal syntax after declarator in declarators list";
+ case IDL_GlobalData::PS_PragmaPrefixSyntax:
+ return "Illegal syntax for #pragma prefix";
+ case IDL_GlobalData::PS_ValueBoxDeclSeen:
+ return "Missing boxed valuetype identifier following VALUETYPE keyword";
+ default:
+ return "Some syntax error";
+ }
+}
+
+// Public methods.
+
+// Report error messages with various numbers of arguments.
+
+void
+UTL_Error::syntax_error (IDL_GlobalData::ParseState ps)
+{
+ idl_error_header (EIDL_SYNTAX_ERROR,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ ACE_ERROR ((LM_ERROR,
+ "%s\n",
+ parse_state_to_error_message (ps)));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+void
+UTL_Error::error0 (UTL_Error::ErrorCode c)
+{
+ idl_error_header (c,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+void
+UTL_Error::error1 (UTL_Error::ErrorCode c,
+ AST_Decl *d)
+{
+ idl_error_header (c,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+void
+UTL_Error::error2 (UTL_Error::ErrorCode c,
+ AST_Decl *d1,
+ AST_Decl *d2)
+{
+ idl_error_header (c,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ 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);
+}
+
+void
+UTL_Error::error3 (UTL_Error::ErrorCode c,
+ AST_Decl *d1,
+ AST_Decl *d2,
+ AST_Decl *d3)
+{
+ idl_error_header (c,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ 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);
+}
+
+void
+UTL_Error::warning0 (UTL_Error::ErrorCode c)
+{
+ if (! (idl_global->compile_flags () & IDL_CF_NOWARNINGS))
+ {
+ idl_error_header (c,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ }
+}
+
+void
+UTL_Error::warning1 (UTL_Error::ErrorCode c,
+ AST_Decl *d)
+{
+ if (! (idl_global->compile_flags () & IDL_CF_NOWARNINGS))
+ {
+ idl_error_header (c,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ }
+}
+
+void
+UTL_Error::warning2 (UTL_Error::ErrorCode c,
+ AST_Decl *d1,
+ AST_Decl *d2)
+{
+ if (! (idl_global->compile_flags () & IDL_CF_NOWARNINGS))
+ {
+ idl_error_header (c,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ d1->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ ", "));
+ d2->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ }
+}
+
+void
+UTL_Error::warning3 (UTL_Error::ErrorCode c,
+ AST_Decl *d1,
+ AST_Decl *d2,
+ AST_Decl *d3)
+{
+ if (! (idl_global->compile_flags () & IDL_CF_NOWARNINGS))
+ {
+ idl_error_header (c,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ 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"));
+ }
+}
+
+// Report a failed coercion attempt.
+void
+UTL_Error::coercion_error (AST_Expression *v,
+ AST_Expression::ExprType t)
+{
+ idl_error_header (EIDL_COERCION_FAILURE,
+ v->line (),
+ v->file_name ()->get_string ());
+ 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);
+}
+
+// Report a failed name lookup attempt.
+void
+UTL_Error::lookup_error (UTL_ScopedName *n)
+{
+ idl_error_header (EIDL_LOOKUP_ERROR,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ n->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report an illegal version number assignment.
+void
+UTL_Error::version_number_error (char *n)
+{
+ idl_error_header (EIDL_ILLEGAL_VERSION,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ ACE_ERROR ((LM_ERROR,
+ "%s\n",
+ n));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report an attempt to set the version a second time.
+void
+UTL_Error::version_reset_error (void)
+{
+ idl_error_header (EIDL_VERSION_RESET,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report a reset of the id a second time to a different string.
+void
+UTL_Error::id_reset_error (const char *o,
+ const char *n)
+{
+ idl_error_header (EIDL_ID_RESET,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ ACE_ERROR ((LM_ERROR,
+ "%s, %s\n",
+ o,
+ n));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report an attempt to inherit from an interface which was only
+// declared forward but not yet defined.
+void
+UTL_Error::inheritance_fwd_error (UTL_ScopedName *n,
+ AST_Interface *f)
+{
+ idl_error_header (EIDL_INHERIT_FWD_ERROR,
+ f->line (),
+ f->file_name ());
+ ACE_ERROR ((LM_ERROR,
+ "interface "));
+ n->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ " cannot inherit from 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 inherit from something other than an interface.
+void
+UTL_Error::inheritance_error (UTL_ScopedName *n,
+ AST_Decl *d)
+{
+ idl_error_header (EIDL_CANT_INHERIT,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ n->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ " attempts to inherit from "));
+ d->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 an interface which was only
+// declared forward but not yet defined.
+void
+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 ()->get_string ());
+ 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 an attempt to have a derived component or home support something.
+void
+UTL_Error::derived_supports_error (UTL_ScopedName *n)
+{
+ idl_error_header (EIDL_CANT_SUPPORT,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ ACE_ERROR ((LM_ERROR,
+ "derived component or home "));
+ n->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ " may not directly support interfaces\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 ()->get_string ());
+ ACE_ERROR ((LM_ERROR,
+ " abstract valuetype "));
+ 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 ()->get_string ());
+ ACE_ERROR ((LM_ERROR,
+ " 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);
+}
+
+// Report illegal component or home support of local interface.
+void
+UTL_Error::unconstrained_interface_expected (UTL_ScopedName *c,
+ UTL_ScopedName *i)
+{
+ idl_error_header (EIDL_CANT_SUPPORT,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ ACE_ERROR ((LM_ERROR,
+ " component or home "));
+ c->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ " attempts to support a local interface: "));
+ 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 ()->get_string ());
+ 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
+UTL_Error::eval_error (AST_Expression *v)
+{
+ idl_error_header (EIDL_EVAL_ERROR,
+ v->line (),
+ v->file_name ()->get_string ());
+ 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 ()->get_string ());
+ v->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report a situation where a constant was expected but we
+// got something else. This may occur in a union when a label
+// evaluates to a non-constant.
+void
+UTL_Error::constant_expected (UTL_ScopedName *n,
+ AST_Decl *d)
+{
+ idl_error_header (EIDL_CONSTANT_EXPECTED,
+ d->line (),
+ d->file_name ());
+ n->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ " bound to "));
+ 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,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ 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,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ 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 a concrete value type was expected but we got
+// something else instead. This most likely is a case where a valuetype
+// inherits from something other than a concrete valuetype.
+void
+UTL_Error::concrete_valuetype_expected (AST_Decl *d)
+{
+ idl_error_header (EIDL_CONCRETE_VT_EXPECTED,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ 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,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ 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::eventtype_expected (AST_Decl *d)
+{
+ idl_error_header (EIDL_EVENTTYPE_EXPECTED,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ 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 a valuetype used as a primary key for a
+// component home does not inherit directly or indirectly from
+// Components::primaryKeyBase.
+void
+UTL_Error::primary_key_error (AST_Decl *d)
+{
+ idl_error_header (EIDL_PRIMARY_KEY_ERROR,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ ACE_ERROR ((LM_ERROR,
+ "primary key "));
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "does not have Components::primaryKeyBase as an ancestor\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report a situation where an enumerator was expected but we
+// got something else. This may occur in a union with an enum
+// discriminator where a label did not evaluate to a constant
+// enumerator.
+void
+UTL_Error::enum_val_expected (AST_Union *u,
+ AST_UnionLabel *l)
+{
+ idl_error_header (EIDL_ENUM_VAL_EXPECTED,
+ u->line (),
+ u->file_name ());
+ ACE_ERROR ((LM_ERROR,
+ " union %s, ",
+ u->local_name ()->get_string ()));
+ l->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 enumerator was received but we
+// could not find it (by name) in an enum. This occurs when
+// a union with an enum discriminator is being parsed, and a
+// label evaluates to an enumerator which is not a member of
+// the enum discriminator type.
+void
+UTL_Error::enum_val_lookup_failure (AST_Union *u,
+ AST_Enum *e,
+ UTL_ScopedName *n)
+{
+ idl_error_header (EIDL_ENUM_VAL_NOT_FOUND,
+ u->line (),
+ u->file_name ());
+ ACE_ERROR ((LM_ERROR,
+ " union %s, enum %s, enumerator ",
+ u->local_name ()->get_string (),
+ e->local_name ()->get_string ()));
+ n->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report clash between declared and referenced indentifiers.
+void
+UTL_Error::redef_error (char *b,
+ char *n)
+{
+ idl_error_header (EIDL_REDEF,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ ACE_ERROR ((LM_ERROR,
+ "\"%s\" and \"%s\"\n",
+ b,
+ n));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report two or more spellings for an identifier.
+void
+UTL_Error::name_case_error (char *b,
+ char *n)
+{
+ idl_error_header (EIDL_NAME_CASE_ERROR,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ ACE_ERROR ((LM_ERROR,
+ "\"%s\" and \"%s\"\n",
+ b,
+ n));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+void
+UTL_Error::name_case_warning (char *b,
+ char *n)
+{
+ if (! (idl_global->compile_flags () & IDL_CF_NOWARNINGS))
+ {
+ idl_error_header (EIDL_NAME_CASE_WARNING,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ ACE_ERROR ((LM_ERROR,
+ "\"%s\" and \"%s\"\n",
+ b,
+ n));
+ }
+}
+
+void
+UTL_Error::idl_keyword_error (char *n)
+{
+ idl_error_header (EIDL_KEYWORD_ERROR,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ ACE_ERROR ((LM_ERROR,
+ "\"%s\"\n",
+ n));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+void
+UTL_Error::idl_keyword_warning (char *n)
+{
+ if (! (idl_global->compile_flags () & IDL_CF_NOWARNINGS))
+ {
+ idl_error_header (EIDL_KEYWORD_WARNING,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ ACE_ERROR ((LM_ERROR,
+ "\"%s\"\n",
+ n));
+ }
+}
+
+// Report an ambiguous definition of a name.
+void
+UTL_Error::ambiguous (UTL_Scope *s,
+ AST_Decl *l,
+ AST_Decl *d)
+{
+ idl_error_header (EIDL_AMBIGUOUS,
+ d->line (),
+ d->file_name ());
+ ACE_ERROR ((LM_ERROR,
+ " scope: %s, collision: ",
+ (ScopeAsDecl (s))->local_name ()->get_string ()));
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ " vs. "));
+ l->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report a forward declared interface which was never defined.
+void
+UTL_Error::fwd_decl_not_defined (AST_Type *d)
+{
+ idl_error_header (EIDL_DECL_NOT_DEFINED,
+ d->line (),
+ d->file_name ());
+ ACE_ERROR ((LM_ERROR,
+ "interface "));
+ d->local_name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report lookup in undefined forward declared but undefined interface.
+void
+UTL_Error::fwd_decl_lookup (AST_Interface *d,
+ UTL_ScopedName *n)
+{
+ idl_error_header (EIDL_FWD_DECL_LOOKUP,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ ACE_ERROR ((LM_ERROR,
+ "trying to look up "));
+ n->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ " in undefined forward declared interface "));
+ d->local_name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report a redefinition inside its own scope.
+void
+UTL_Error::redefinition_in_scope (AST_Decl *d,
+ AST_Decl *s)
+{
+ idl_error_header (EIDL_REDEF_SCOPE,
+ d->line (),
+ d->file_name ());
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ ", "));
+ s->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report not a type error.
+void
+UTL_Error::not_a_type (AST_Decl *d)
+{
+ idl_error_header (EIDL_NOT_A_TYPE,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ if (d == 0 || d->name () == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "unknown symbol"));
+ }
+ else
+ {
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
+ }
+
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+void
+UTL_Error::back_end (long lineno,
+ UTL_String *s)
+{
+ idl_error_header (EIDL_BACK_END,
+ lineno,
+ s->get_string ());
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+void
+UTL_Error::illegal_infix (void)
+{
+ idl_error_header (EIDL_ILLEGAL_INFIX,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+void
+UTL_Error::local_remote_mismatch (AST_Decl *l,
+ UTL_Scope *s)
+{
+ AST_Decl *r = ScopeAsDecl (s);
+ idl_error_header (EIDL_LOCAL_REMOTE_MISMATCH,
+ r->line (),
+ r->file_name ());
+ ACE_ERROR ((LM_ERROR,
+ "local type "));
+ l->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ " used in remote operation "));
+ r->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+void
+UTL_Error::ignore_idl3_error (AST_Decl *d)
+{
+ idl_error_header (EIDL_IGNORE_IDL3_ERROR,
+ 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);
+}
+
+void
+UTL_Error::illegal_primary_key (AST_Decl *d)
+{
+ idl_error_header (EIDL_ILLEGAL_PRIMARY_KEY,
+ 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);
+}
+
diff --git a/TAO/TAO_IDL/util/utl_exceptlist.cpp b/TAO/TAO_IDL/util/utl_exceptlist.cpp
new file mode 100644
index 00000000000..67aa6a53fbf
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_exceptlist.cpp
@@ -0,0 +1,148 @@
+// $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.
+
+*/
+
+// utl_exceptlist.cc
+//
+// Implementation of a list of exceptions
+
+// 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.
+
+#include "utl_exceptlist.h"
+
+#include "ace/OS_Memory.h"
+
+ACE_RCSID (util,
+ utl_exceptlist,
+ "$Id$")
+
+UTL_ExceptList::UTL_ExceptList (AST_Exception *s,
+ UTL_ExceptList *cdr)
+ : UTL_List (cdr),
+ pd_car_data (s)
+{
+}
+
+// Get list item.
+AST_Exception *
+UTL_ExceptList::head (void)
+{
+ return this->pd_car_data;
+}
+
+// The two methods below make direct calls on the
+// cdr list (we have been made a friend of the base
+// class UTL_List's private member). This is so we
+// can avoid copying the contained quantity, an
+// AST_Exception.
+
+void
+UTL_ExceptList::destroy (void)
+{
+ if (this->pd_cdr_data != 0)
+ {
+ this->pd_cdr_data->destroy ();
+ }
+
+ delete this;
+}
+
+UTL_ExceptList *
+UTL_ExceptList::copy (void)
+{
+ UTL_ExceptList *retval = 0;
+ ACE_NEW_RETURN (retval,
+ UTL_ExceptList (
+ this->pd_car_data,
+ this->pd_cdr_data != 0
+ ? (UTL_ExceptList *) this->pd_cdr_data->copy ()
+ : 0
+ ),
+ 0);
+
+ return retval;
+}
+
+UTL_ExceptlistActiveIterator::UTL_ExceptlistActiveIterator (UTL_ExceptList *s)
+ : UTL_ListActiveIterator(s)
+{
+}
+
+// Get current item.
+AST_Exception *
+UTL_ExceptlistActiveIterator::item (void)
+{
+ if (source == 0)
+ {
+ return 0;
+ }
+
+ return ((UTL_ExceptList *) source)->head ();
+}
+
diff --git a/TAO/TAO_IDL/util/utl_exprlist.cpp b/TAO/TAO_IDL/util/utl_exprlist.cpp
new file mode 100644
index 00000000000..b92a47df701
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_exprlist.cpp
@@ -0,0 +1,125 @@
+// $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.
+
+*/
+
+// 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.
+// 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 "utl_exprlist.h"
+#include "ast_expression.h"
+
+ACE_RCSID (util,
+ utl_exprlist,
+ "$Id$")
+
+UTL_ExprList::UTL_ExprList (AST_Expression *s,
+ UTL_ExprList *cdr)
+ : UTL_List (cdr),
+ pd_car_data (s)
+{
+}
+
+// Get list item.
+AST_Expression *
+UTL_ExprList::head (void)
+{
+ return this->pd_car_data;
+}
+
+void
+UTL_ExprList::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 ();
+}
+
+UTL_ExprlistActiveIterator::UTL_ExprlistActiveIterator (UTL_ExprList *s)
+ : UTL_ListActiveIterator(s)
+{
+}
+
+// Get current item.
+AST_Expression *
+UTL_ExprlistActiveIterator::item (void)
+{
+ if (source == 0)
+ {
+ return 0;
+ }
+
+ return ((UTL_ExprList *) source)->head ();
+}
+
diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp
new file mode 100644
index 00000000000..d49fce7d015
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_global.cpp
@@ -0,0 +1,1832 @@
+// $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.
+
+*/
+
+#include "idl_global.h"
+#include "global_extern.h"
+#include "ast_root.h"
+#include "ast_generator.h"
+#include "ast_structure.h"
+#include "ast_sequence.h"
+#include "ast_valuetype.h"
+#include "utl_identifier.h"
+#include "utl_indenter.h"
+#include "utl_err.h"
+#include "utl_string.h"
+#include "nr_extern.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_unistd.h"
+#include "ace/OS_NS_strings.h"
+#include "ace/Process.h"
+#include "ace/OS_NS_ctype.h"
+
+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
+
+static long *pSeenOnce= 0;
+
+#if defined(ACE_OPENVMS)
+#include <unixlib.h>
+static char* translateName(const char* name)
+{
+ char* transName = (ACE_OS::strchr (name, '[') == 0
+ ? (char*)name : ::decc$translate_vms (name));
+ return (transName == 0 || ((int)transName) == -1 ) ? 0 : transName;
+}
+#endif
+
+IDL_GlobalData::IDL_GlobalData (void)
+ : pd_root (0),
+ pd_gen (0),
+ pd_primary_key_base (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 (false),
+ pd_in_main_file (false),
+ pd_prog_name (0),
+ pd_cpp_location (0),
+ pd_compile_flags (0),
+ pd_local_escapes (0),
+ pd_indent (0),
+ 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),
+ tao_root_ (0),
+ gperf_path_ (0),
+ temp_dir_ (0),
+ ident_string_ (0),
+ case_diff_error_ (true),
+ nest_orb_ (false),
+ idl_flags_ (""),
+ preserve_cpp_keywords_ (true),
+ pass_orb_idl_ (false),
+ using_ifr_backend_ (false),
+ ignore_idl3_ (false),
+ recursion_start_ (0) // Not used by all backends.
+{
+ // 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
+ // in the environment.
+ // Form the absolute pathname.
+ char* ace_root = ACE_OS::getenv ("ACE_ROOT");
+
+ if (ace_root == 0)
+ // This may not cause any problem if -g option is used to specify
+ // the correct path for the gperf program. Let us ignore this
+ // error here. It will be caught when we check the existence of
+ // the perfect hasher and at that time, we can switch over to some
+ // other scheme.
+ {
+#if defined (ACE_GPERF)
+ // The actual gperf program must be included in the definition of
+ // ACE_GPERF, not just the directory in which it is located.
+ const char ace_gperf[] = ACE_GPERF;
+ ACE_NEW (this->gperf_path_,
+ char [ACE_OS::strlen (ace_gperf) + 1]);
+ ACE_OS::sprintf (this->gperf_path_,
+ "%s",
+ ace_gperf);
+#else
+ this->gperf_path_ = 0;
+#endif
+ }
+ else
+ {
+#if defined (ACE_GPERF)
+ const char ace_gperf[] = ACE_GPERF;
+ ACE_NEW (this->gperf_path_,
+ char [ACE_OS::strlen (ace_root)
+ + ACE_OS::strlen ("/bin/")
+ + ACE_OS::strlen (ace_gperf)
+ + 1]);
+ ACE_OS::sprintf (this->gperf_path_,
+ "%s" ACE_DIRECTORY_SEPARATOR_STR "bin" ACE_DIRECTORY_SEPARATOR_STR "%s",
+ ace_root,
+ ace_gperf);
+#else /* Not ACE_GPERF */
+ // Set it to the default value.
+ ACE_NEW (this->gperf_path_,
+ char [ACE_OS::strlen (ace_root)
+ + ACE_OS::strlen ("/bin/gperf")
+ + 1]);
+ ACE_OS::sprintf (this->gperf_path_,
+ "%s" ACE_DIRECTORY_SEPARATOR_STR "bin" ACE_DIRECTORY_SEPARATOR_STR "gperf",
+ ace_root);
+#endif /* ACE_GPERF */
+ }
+
+ // ambiguous_type_seen_ and basic_type_seen_ are not reset between
+ // command line idl files, so do those here and then reset the rest.
+ this->ambiguous_type_seen_ = false;
+ this->basic_type_seen_ = false;
+ this->reset_flag_seen ();
+}
+
+IDL_GlobalData::~IDL_GlobalData (void)
+{
+}
+
+// When starting to process the next command line input idl file, reset.
+void
+IDL_GlobalData::reset_flag_seen (void)
+{
+ abstract_iface_seen_ = false;
+ aggregate_seen_ = false;
+//ambiguous_type_seen_
+ any_arg_seen_ = false;
+ any_seen_ = false;
+ any_seq_seen_ = false;
+ array_seen_ = false;
+ array_seq_seen_ = false;
+ base_object_seen_ = false;
+ basic_arg_seen_ = false;
+//basic_type_seen_
+ bd_string_arg_seen_ = false;
+ boolean_seq_seen_ = false;
+ char_seq_seen_ = false;
+ double_seq_seen_ = false;
+ enum_seen_ = false;
+ exception_seen_ = false;
+ fixed_array_arg_seen_ = false;
+ fixed_size_arg_seen_ = false;
+ float_seq_seen_ = false;
+ fwd_iface_seen_ = false;
+ fwd_valuetype_seen_ = false;
+ iface_seq_seen_ = false;
+ interface_seen_ = false;
+ local_iface_seen_ = false;
+ long_seq_seen_ = false;
+ longdouble_seq_seen_ = false;
+ longlong_seq_seen_ = false;
+ non_local_iface_seen_ = false;
+ non_local_op_seen_ = false;
+ object_arg_seen_ = false;
+ octet_seq_seen_ = false;
+ operation_seen_ = false;
+ pseudo_seq_seen_ = false;
+ recursive_type_seen_ = false;
+ seq_seen_ = false;
+ short_seq_seen_ = false;
+ special_basic_arg_seen_ = false;
+ string_seen_ = false;
+ string_member_seen_ = false;
+ string_seq_seen_ = false;
+ typecode_seen_ = false;
+ ub_string_arg_seen_ = false;
+ ulong_seq_seen_ = false;
+ ulonglong_seq_seen_ = false;
+ union_seen_ = false;
+ ushort_seq_seen_ = false;
+ valuebase_seen_ = false;
+ valuefactory_seen_ = false;
+ valuetype_seen_ = false;
+ var_array_arg_seen_ = false;
+ var_size_arg_seen_ = false;
+ vt_seq_seen_ = false;
+ wchar_seq_seen_ = false;
+ wstring_seq_seen_ = false;
+
+ need_skeleton_includes_ = false;
+}
+
+// Get or set scopes stack
+UTL_ScopeStack &
+IDL_GlobalData::scopes (void)
+{
+ return this->pd_scopes;
+}
+
+// Get or set root of AST
+AST_Root *
+IDL_GlobalData::root (void)
+{
+ return this->pd_root;
+}
+
+void
+IDL_GlobalData::set_root (AST_Root *r)
+{
+ this->pd_root = r;
+}
+
+// Get or set generator object
+AST_Generator *
+IDL_GlobalData::gen (void)
+{
+ return this->pd_gen;
+}
+
+void
+IDL_GlobalData::set_gen (AST_Generator *g)
+{
+ this->pd_gen = g;
+}
+
+// Get or set PrimaryKeyBase object
+AST_ValueType *
+IDL_GlobalData::primary_key_base (void)
+{
+ return this->pd_primary_key_base;
+}
+
+void
+IDL_GlobalData::primary_key_base (AST_ValueType *v)
+{
+ this->pd_primary_key_base = v;
+}
+
+// Get or set error object
+UTL_Error *
+IDL_GlobalData::err (void)
+{
+ return this->pd_err;
+}
+
+void
+IDL_GlobalData::set_err (UTL_Error *e)
+{
+ this->pd_err = e;
+}
+
+// Get or set error count
+int
+IDL_GlobalData::err_count (void)
+{
+ return this->pd_err_count;
+}
+
+void
+IDL_GlobalData::set_err_count (int c)
+{
+ this->pd_err_count = c;
+}
+
+// Get or set line number
+long
+IDL_GlobalData::lineno (void)
+{
+ return this->pd_lineno;
+}
+
+void
+IDL_GlobalData::set_lineno (long n)
+{
+ this->pd_lineno = n;
+}
+
+// Get or set file name being read now
+UTL_String *
+IDL_GlobalData::filename (void)
+{
+ return this->pd_filename;
+}
+
+void
+IDL_GlobalData::set_filename (UTL_String *s)
+{
+ if (this->pd_filename != 0)
+ {
+ this->pd_filename->destroy ();
+ delete this->pd_filename;
+ this->pd_filename = 0;
+ }
+
+ this->pd_filename = s;
+}
+
+// Get or set main file name
+UTL_String *
+IDL_GlobalData::main_filename (void)
+{
+ return this->pd_main_filename;
+}
+
+void
+IDL_GlobalData::set_main_filename (UTL_String *n)
+{
+ if (this->pd_main_filename != 0)
+ {
+ this->pd_main_filename->destroy ();
+ delete this->pd_main_filename;
+ this->pd_main_filename = 0;
+ }
+
+ this->pd_main_filename = n;
+}
+
+// Get or set real file name
+UTL_String *
+IDL_GlobalData::real_filename (void)
+{
+ return this->pd_real_filename;
+}
+
+void
+IDL_GlobalData::set_real_filename (UTL_String *n)
+{
+ if (this->pd_real_filename != 0)
+ {
+ this->pd_real_filename->destroy ();
+ delete this->pd_real_filename;
+ this->pd_real_filename = 0;
+ }
+
+ this->pd_real_filename = n;
+}
+
+// Get or set indicator whether import is on
+bool
+IDL_GlobalData::imported (void)
+{
+ return this->pd_in_main_file ? false : pd_import;
+}
+
+bool
+IDL_GlobalData::import (void)
+{
+ return this->pd_import;
+}
+
+void
+IDL_GlobalData::set_import (bool is_in)
+{
+ this->pd_import = is_in;
+}
+
+// Get or set indicator whether we're reading the main file now
+bool
+IDL_GlobalData::in_main_file (void)
+{
+ return this->pd_in_main_file;
+}
+
+void
+IDL_GlobalData::set_in_main_file (bool is_in)
+{
+ this->pd_in_main_file = is_in;
+}
+
+// Get or set stripped file name
+UTL_String *
+IDL_GlobalData::stripped_filename (void)
+{
+ return this->pd_stripped_filename;
+}
+
+void
+IDL_GlobalData::set_stripped_filename (UTL_String *nm)
+{
+ if (this->pd_stripped_filename != 0)
+ delete this->pd_stripped_filename;
+
+ this->pd_stripped_filename = nm;
+}
+
+// Get or set cache value for argv[0]
+const char *
+IDL_GlobalData::prog_name (void)
+{
+ return this->pd_prog_name;
+}
+
+void
+IDL_GlobalData::set_prog_name (const char *pn)
+{
+ this->pd_prog_name = pn;
+}
+
+// Get or set location to find C preprocessor
+const char *
+IDL_GlobalData::cpp_location (void)
+{
+ return this->pd_cpp_location;
+}
+
+void
+IDL_GlobalData::set_cpp_location (const char *l)
+{
+ this->pd_cpp_location = l;
+}
+
+// Get or set IDL compiler flags
+long
+IDL_GlobalData::compile_flags (void)
+{
+ return this->pd_compile_flags;
+}
+
+void
+IDL_GlobalData::set_compile_flags (long cf)
+{
+ this->pd_compile_flags = cf;
+}
+
+// Get or set local escapes string. This provides additional mechanism
+// to pass information to a BE.
+char *
+IDL_GlobalData::local_escapes (void)
+{
+ return this->pd_local_escapes;
+}
+
+void
+IDL_GlobalData::set_local_escapes (const char *e)
+{
+ if (this->pd_local_escapes != 0)
+ {
+ delete [] this->pd_local_escapes;
+ }
+
+ this->pd_local_escapes = ACE::strnew (e);
+}
+
+// Get or set indent object
+UTL_Indenter *
+IDL_GlobalData::indent (void)
+{
+ return this->pd_indent;
+}
+
+void
+IDL_GlobalData::set_indent (UTL_Indenter *i)
+{
+ this->pd_indent = i;
+}
+
+// Have we seen this #include file name before?
+long
+IDL_GlobalData::seen_include_file_before (char *n)
+{
+ unsigned long i;
+ char *incl = 0;
+ char *tmp = n;
+
+ for (i = 0; i < this->pd_n_include_file_names; ++i)
+ {
+ incl = this->pd_include_file_names[i]->get_string ();
+
+ if (ACE_OS::strcmp (tmp, incl) == 0)
+ {
+ return ++pSeenOnce[i];
+ }
+ }
+
+ return 0;
+}
+
+// Store the name of an #include file.
+void
+IDL_GlobalData::store_include_file_name (UTL_String *n)
+{
+ // Check if we need to store it at all or whether we've seen it already.
+ if (this->seen_include_file_before (n->get_string ()))
+ {
+ n->destroy ();
+ delete n; // Don't keep filenames we don't store!
+ return;
+ }
+
+ // OK, need to store. Make sure there's space for one more string
+ if (this->pd_n_include_file_names == this->pd_n_alloced_file_names)
+ {
+ // Allocating more space.
+ if (this->pd_n_alloced_file_names == 0)
+ {
+ this->pd_n_alloced_file_names = INCREMENT;
+ ACE_NEW (this->pd_include_file_names,
+ UTL_String *[this->pd_n_alloced_file_names]);
+ ACE_NEW (pSeenOnce, long [this->pd_n_alloced_file_names]);
+ }
+ else
+ {
+ UTL_String **o_include_file_names= this->pd_include_file_names;
+ unsigned long o_n_alloced_file_names= this->pd_n_alloced_file_names;
+ long *o_pSeenOnce= pSeenOnce;
+
+ this->pd_n_alloced_file_names += INCREMENT;
+ ACE_NEW (this->pd_include_file_names,
+ UTL_String *[this->pd_n_alloced_file_names]);
+ ACE_NEW (pSeenOnce, long [this->pd_n_alloced_file_names]);
+
+ for (unsigned long i = 0; i < o_n_alloced_file_names; ++i)
+ {
+ this->pd_include_file_names[i] = o_include_file_names[i];
+ pSeenOnce[i]= o_pSeenOnce[i];
+ }
+
+ delete [] o_include_file_names;
+ delete [] o_pSeenOnce;
+ }
+ }
+
+ // Store it.
+ pSeenOnce[this->pd_n_include_file_names] = 1;
+ this->pd_include_file_names[this->pd_n_include_file_names++] = n;
+}
+
+void
+IDL_GlobalData::set_include_file_names (UTL_String **ns)
+{
+ this->pd_include_file_names = ns;
+}
+
+UTL_String **
+IDL_GlobalData::include_file_names (void)
+{
+ return this->pd_include_file_names;
+}
+
+void
+IDL_GlobalData::set_n_include_file_names (unsigned long n)
+{
+ pd_n_include_file_names = n;
+}
+
+unsigned long
+IDL_GlobalData::n_include_file_names (void)
+{
+ return pd_n_include_file_names;
+}
+
+// Access methods to deal with other IDL files included in the main
+// IDL file.
+
+void
+IDL_GlobalData::add_to_included_idl_files (char *file_name)
+{
+ // Let's avoid duplicates.
+ for (size_t index = 0; index < this->n_included_idl_files_; ++index)
+ {
+ if (!ACE_OS::strcmp (file_name, this->included_idl_files_[index]))
+ {
+ return;
+ }
+ }
+
+ // Is there enough space there to store one more file.
+ if (this->n_included_idl_files_ == this->n_allocated_idl_files_)
+ {
+ // Allocating more space.
+ if (this->n_allocated_idl_files_ == 0)
+ {
+ // First time creation.
+ this->n_allocated_idl_files_ = INCREMENT;
+ ACE_NEW (this->included_idl_files_,
+ char *[this->n_allocated_idl_files_]);
+ }
+ else
+ {
+ // Adding more storage.
+ char** old_included_idl_files =
+ this->included_idl_files_;
+ size_t n_old_allocated_idl_files =
+ this->n_allocated_idl_files_;
+ 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];
+ }
+
+ delete [] old_included_idl_files;
+ }
+ }
+
+ // Store it.
+ this->included_idl_files_ [this->n_included_idl_files_++] =
+ ACE::strnew (file_name);
+}
+
+char**
+IDL_GlobalData::included_idl_files (void)
+{
+ return this->included_idl_files_;
+}
+
+size_t
+IDL_GlobalData::n_included_idl_files (void)
+{
+ return this->n_included_idl_files_;
+}
+
+// Set the number of included_idl_files. Use this carefully. This
+// method is used when we validate all the #included idl files,
+// against the ones that we get after preprocessing.
+void
+IDL_GlobalData::n_included_idl_files (size_t n)
+{
+ this->n_included_idl_files_ = n;
+}
+
+// Validate the included idl files, some files might have been
+// ignored by the preprocessor.
+void
+IDL_GlobalData::validate_included_idl_files (void)
+{
+ // Flag to make sure we don't repeat things.
+ static int already_done = 0;
+
+ if (already_done == 1)
+ {
+ return;
+ }
+
+ already_done = 1;
+
+ // New number of included_idl_files.
+ size_t newj = 0;
+ size_t n_found = 0;
+ size_t n_pre_preproc_includes = idl_global->n_included_idl_files ();
+ char **pre_preproc_includes = idl_global->included_idl_files ();
+ size_t n_post_preproc_includes = idl_global->n_include_file_names ();
+ UTL_String **post_preproc_includes = idl_global->include_file_names ();
+
+ char pre_abspath[MAXPATHLEN] = "";
+ char post_abspath[MAXPATHLEN] = "";
+ char **path_tmp = 0;
+ char *post_tmp = 0;
+ char *full_path = 0;
+
+ for (size_t j = 0; j < n_pre_preproc_includes; ++j)
+ {
+ // Check this name with the names list that we got from the
+ // preprocessor.
+ size_t valid_file = 0;
+#if defined (ACE_OPENVMS)
+ full_path = ACE_OS::realpath (translateName (pre_preproc_includes[j]),
+ pre_abspath);
+#else
+ full_path = ACE_OS::realpath (pre_preproc_includes[j],
+ pre_abspath);
+#endif
+
+ if (full_path != 0)
+ {
+ for (size_t ni = 0; ni < n_post_preproc_includes; ++ni)
+ {
+ post_tmp = post_preproc_includes[ni]->get_string ();
+#if defined (ACE_OPENVMS)
+ full_path = ACE_OS::realpath (translateName (post_tmp), post_abspath);
+#else
+ full_path = ACE_OS::realpath (post_tmp, post_abspath);
+#endif
+ if (full_path != 0
+ && this->path_cmp (pre_abspath, post_abspath) == 0)
+ {
+ FILE *test = ACE_OS::fopen (post_abspath, "r");
+
+ if (test == 0)
+ {
+ continue;
+ }
+
+ ACE_OS::fclose (test);
+
+ // This file name is valid.
+ valid_file = 1;
+ ++n_found;
+ break;
+ }
+ }
+ }
+
+ if (valid_file == 0)
+ {
+ for (ACE_Unbounded_Queue_Iterator<char *>iter (
+ this->include_paths_
+ );
+ !iter.done ();
+ iter.advance ())
+ {
+ iter.next (path_tmp);
+ ACE_CString pre_partial (*path_tmp);
+
+ // If the include path has literal "s (because of an include
+ // of a Windows path with spaces), we must remove them here.
+ if (this->hasspace (pre_partial.c_str ()))
+ {
+ pre_partial =
+ pre_partial.substr (1, pre_partial.length () - 2);
+ }
+
+ pre_partial += ACE_DIRECTORY_SEPARATOR_STR;
+ pre_partial += pre_preproc_includes[j];
+#if defined (ACE_OPENVMS)
+ full_path =
+ ACE_OS::realpath (translateName (pre_partial.c_str ()), pre_abspath);
+#else
+ full_path =
+ ACE_OS::realpath (pre_partial.c_str (), pre_abspath);
+#endif
+
+ if (full_path != 0)
+ {
+ for (size_t m = 0; m < n_post_preproc_includes; ++m)
+ {
+ post_tmp = post_preproc_includes[m]->get_string ();
+#if defined (ACE_OPENVMS)
+ full_path = ACE_OS::realpath (translateName (post_tmp), post_abspath);
+#else
+ full_path = ACE_OS::realpath (post_tmp, post_abspath);
+#endif
+
+ if (full_path != 0
+ && this->path_cmp (pre_abspath, post_abspath) == 0)
+ {
+ FILE *test = ACE_OS::fopen (post_abspath, "r");
+
+ if (test == 0)
+ {
+ continue;
+ }
+
+ ACE_OS::fclose (test);
+
+ // This file name is valid.
+ valid_file = 1;
+ ++n_found;
+ break;
+ }
+ }
+ }
+
+ if (valid_file == 1)
+ {
+ break;
+ }
+ }
+ }
+
+ // Remove the file, if it is not valid.
+ if (valid_file == 0)
+ {
+ delete [] pre_preproc_includes[j];
+ pre_preproc_includes[j] = 0;
+ }
+ else
+ {
+ // File is valid.
+
+ // Move it to new index if necessary.
+ if (j != newj)
+ {
+ // Move to the new index position.
+ pre_preproc_includes[newj] =
+ pre_preproc_includes[j];
+
+ // Make old position 0.
+ pre_preproc_includes[j] = 0;
+ }
+
+ // Increment the new index.
+ newj++;
+ }
+
+ if (n_found == n_post_preproc_includes)
+ {
+ break;
+ }
+ }
+
+ // Now adjust the count on the included_idl_files.
+ idl_global->n_included_idl_files (newj);
+}
+
+void
+IDL_GlobalData::set_parse_state(ParseState ps)
+{
+ pd_parse_state = ps;
+}
+
+IDL_GlobalData::ParseState
+IDL_GlobalData::parse_state()
+{
+ return pd_parse_state;
+}
+
+/*
+ * Convert a PredefinedType to an ExprType
+ */
+AST_Expression::ExprType
+IDL_GlobalData::PredefinedTypeToExprType (
+ AST_PredefinedType::PredefinedType pt
+ )
+{
+ switch (pt) {
+ case AST_PredefinedType::PT_long:
+ return AST_Expression::EV_long;
+ case AST_PredefinedType::PT_ulong:
+ return AST_Expression::EV_ulong;
+ case AST_PredefinedType::PT_short:
+ return AST_Expression::EV_short;
+ case AST_PredefinedType::PT_ushort:
+ return AST_Expression::EV_ushort;
+ case AST_PredefinedType::PT_longlong:
+ return AST_Expression::EV_longlong;
+ case AST_PredefinedType::PT_ulonglong:
+ return AST_Expression::EV_ulonglong;
+ case AST_PredefinedType::PT_float:
+ return AST_Expression::EV_float;
+ case AST_PredefinedType::PT_double:
+ return AST_Expression::EV_double;
+ case AST_PredefinedType::PT_longdouble:
+ return AST_Expression::EV_longdouble;
+ case AST_PredefinedType::PT_char:
+ return AST_Expression::EV_char;
+ case AST_PredefinedType::PT_wchar:
+ return AST_Expression::EV_wchar;
+ case AST_PredefinedType::PT_octet:
+ return AST_Expression::EV_octet;
+ case AST_PredefinedType::PT_boolean:
+ return AST_Expression::EV_bool;
+ case AST_PredefinedType::PT_void:
+ return AST_Expression::EV_void;
+ default:
+ return AST_Expression::EV_enum;
+ }
+}
+
+// returns the IDL source file being copiled
+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)
+{
+ this->pd_idl_src_file = s;
+}
+
+void
+IDL_GlobalData::temp_dir (const char *s)
+{
+ // Delete the old pointer.
+ delete [] this->temp_dir_;
+
+ // Allocate memory, 1 for the end of string.
+ ACE_NEW (this->temp_dir_,
+ char [ACE_OS::strlen (s) +
+ ACE_OS::strlen (ACE_DIRECTORY_SEPARATOR_STR) +
+ 1]);
+
+ // Copy the strings.
+ ACE_OS::sprintf (this->temp_dir_,
+ "%s%s",
+ s,
+ ACE_DIRECTORY_SEPARATOR_STR);
+}
+
+const char *
+IDL_GlobalData::temp_dir (void) const
+{
+ return this->temp_dir_;
+}
+
+void
+IDL_GlobalData::tao_root (const char *s)
+{
+ delete [] this->tao_root_;
+ this->tao_root_ = ACE::strnew (s);
+}
+
+const char *
+IDL_GlobalData::tao_root (void) const
+{
+ return this->tao_root_;
+}
+
+void
+IDL_GlobalData::gperf_path (const char *s)
+{
+ delete [] this->gperf_path_;
+ this->gperf_path_ = ACE::strnew (s);
+}
+
+const char *
+IDL_GlobalData::gperf_path (void) const
+{
+ return this->gperf_path_;
+}
+
+void
+IDL_GlobalData::ident_string (const char *s)
+{
+ delete [] this->ident_string_;
+ this->ident_string_ = ACE::strnew (s);
+}
+
+const char *
+IDL_GlobalData::ident_string (void) const
+{
+ return this->ident_string_;
+}
+
+void
+IDL_GlobalData::case_diff_error (bool val)
+{
+ this->case_diff_error_ = val;
+}
+
+bool
+IDL_GlobalData::case_diff_error (void)
+{
+ return this->case_diff_error_;
+}
+
+void
+IDL_GlobalData::nest_orb (bool val)
+{
+ this->nest_orb_ = val;
+}
+
+bool
+IDL_GlobalData::nest_orb (void)
+{
+ return this->nest_orb_;
+}
+
+void
+IDL_GlobalData::destroy (void)
+{
+ if (this->pd_filename != 0)
+ {
+ this->pd_filename->destroy ();
+ delete this->pd_filename;
+ this->pd_filename = 0;
+ }
+
+ if (this->pd_main_filename != 0)
+ {
+ this->pd_main_filename->destroy ();
+ delete this->pd_main_filename;
+ this->pd_main_filename = 0;
+ }
+
+ if (this->pd_real_filename != 0)
+ {
+ this->pd_real_filename->destroy ();
+ delete this->pd_real_filename;
+ this->pd_real_filename = 0;
+ }
+
+ if (this->pd_stripped_filename != 0)
+ {
+ this->pd_stripped_filename->destroy ();
+ delete this->pd_stripped_filename;
+ this->pd_stripped_filename = 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;
+
+ for (size_t i = 0; i < size; ++i)
+ {
+ this->pragma_prefixes ().pop (trash);
+ delete [] trash;
+ trash = 0;
+ }
+
+ // Clean up each included file name - the array allocation itself
+ // gets cleaned up in fini().
+ for (unsigned long j = 0; j < this->pd_n_include_file_names; ++j)
+ {
+ this->pd_include_file_names[j]->destroy ();
+ delete this->pd_include_file_names[j];
+ this->pd_include_file_names[j] = 0;
+ }
+
+ this->pd_n_include_file_names = 0;
+
+ for (size_t k = 0; k < n_included_idl_files_; ++k)
+ {
+ ACE::strdelete (this->included_idl_files_[k]);
+ this->included_idl_files_[k] = 0;
+ }
+
+ this->n_included_idl_files_ = 0;
+ this->n_allocated_idl_files_ = 0;
+ delete [] this->included_idl_files_;
+ this->included_idl_files_ = 0;
+
+ ACE::strdelete (this->recursion_start_);
+ this->recursion_start_ = 0;
+
+ if (0 != this->pd_root)
+ {
+ this->pd_root->destroy ();
+ }
+}
+
+void
+IDL_GlobalData::append_idl_flag (const char *s)
+{
+ idl_flags_ += " " + ACE_CString (s);
+}
+
+const char *
+IDL_GlobalData::idl_flags (void) const
+{
+ return idl_flags_.c_str ();
+}
+
+ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> &
+IDL_GlobalData::idl_keywords (void)
+{
+ return this->idl_keywords_;
+}
+
+ACE_Unbounded_Stack<char *> &
+IDL_GlobalData::pragma_prefixes (void)
+{
+ return this->pragma_prefixes_;
+}
+
+void
+IDL_GlobalData::update_prefix (char *filename)
+{
+ // If we are just starting up and processing the temporary filename,
+ // there are no prefix issues to deal with yet.
+ if (this->pd_main_filename == 0 || this->pd_filename == 0)
+ {
+ return;
+ }
+
+ char *fstring = this->pd_filename->get_string ();
+ char *tail = fstring + ACE_OS::strlen (fstring) - 3;
+
+ // We have to do this check because some preprocessors (gcc 3.2
+ // on RedHat Linux 7.1, for one) output the same filename
+ // multiple times for no apparent reason, and we don't want it
+ // to clear the prefix.
+ if (ACE_OS::strcmp (fstring, filename) == 0
+ || ACE_OS::strcmp (tail, ".cc") == 0)
+ {
+ return;
+ }
+
+ ACE_CString tmp ("", 0, 0);
+ char *main_filename = this->pd_main_filename->get_string ();
+
+// ACE_CString ext_id (filename);
+ char *prefix = 0;
+
+ int status = this->file_prefixes_.find (filename, prefix);
+
+ if (status == 0)
+ {
+ this->pd_root->prefix (prefix);
+ }
+ else
+ {
+ prefix = ACE::strnew ("");
+ (void) this->file_prefixes_.bind (ACE::strnew (filename), prefix);
+ this->pd_root->prefix ("");
+ }
+
+ // The first branch is executed if we are finishing an
+ // included IDL file (but the current filename has not yet
+ // been changed). So we check for (1) the current filename is
+ // not the same as the main filename (2) the prefix stack size
+ // is greater than 1 (to skip the case where we are passed the
+ // temporary filename) and (3) we have either seen the filename
+ // passed in before as an included file or we are passed the
+ // main filename. Otherwise we know we are beginning an included
+ // file, so we push a blank prefix on the stack, which may
+ // possibly be changed later.
+ if (this->seen_include_file_before (filename) != 0
+ || ACE_OS::strcmp (filename, main_filename) == 0
+ || ACE_OS::strcmp (filename, this->pd_filename->get_string ()) != 0)
+ {
+ if (!this->pd_in_main_file)
+ {
+ char *trash = 0;
+ this->pragma_prefixes_.pop (trash);
+ delete [] trash;
+ }
+ }
+ else
+ {
+ this->pragma_prefixes_.push (tmp.rep ());
+ }
+}
+
+UTL_ScopedName *
+IDL_GlobalData::string_to_scoped_name (char *s)
+{
+ char *start = s;
+ int len = 0;
+ UTL_ScopedName *retval = 0;
+ char tmp[256];
+
+ // If we're doing #pragma ID, the id string may have a ::
+ // while the target scoped name does not, so we check for
+ // a space.
+ char *test = ACE_OS::strchr (start, ' ');
+ char *end = ACE_OS::strstr (start, "::");
+
+ if (test != 0 && test - end < 0)
+ {
+ end = test;
+ }
+
+ while (end != 0)
+ {
+ len = end - start;
+
+ if (len != 0)
+ {
+ ACE_OS::strncpy (tmp,
+ start,
+ len);
+
+ tmp[len] = '\0';
+
+ Identifier *id = 0;
+ ACE_NEW_RETURN (id,
+ Identifier (tmp),
+ 0);
+
+ if (retval == 0)
+ {
+ ACE_NEW_RETURN (retval,
+ UTL_ScopedName (id,
+ 0),
+ 0);
+ }
+ else
+ {
+ UTL_ScopedName *conc_name = 0;
+ ACE_NEW_RETURN (conc_name,
+ UTL_ScopedName (id,
+ 0),
+ 0);
+
+ retval->nconc (conc_name);
+ }
+ }
+
+ start = end + 2;
+ end = (end[0] == ' ' ? 0 : ACE_OS::strstr (start, "::"));
+
+ if (test != 0 && test - end < 0)
+ {
+ end = 0;
+ }
+ }
+
+ len = test - start;
+
+ // This means we've already dealt with the space between the target
+ // name and the id string (above) and we're done.
+ if (test == 0 || len <= 0)
+ {
+ return retval;
+ }
+
+ ACE_OS::strncpy (tmp,
+ start,
+ len);
+
+ tmp[len] = '\0';
+
+ Identifier *id = 0;
+ ACE_NEW_RETURN (id,
+ Identifier (tmp),
+ 0);
+
+ if (retval == 0)
+ {
+ ACE_NEW_RETURN (retval,
+ UTL_ScopedName (id,
+ 0),
+ 0);
+ }
+ else
+ {
+ UTL_ScopedName *conc_name = 0;
+ ACE_NEW_RETURN (conc_name,
+ UTL_ScopedName (id,
+ 0),
+ 0);
+
+ retval->nconc (conc_name);
+ }
+
+ return retval;
+}
+
+const char *
+IDL_GlobalData::stripped_preproc_include (const char *name)
+{
+ // Some preprocessors prepend "./" to filenames in the
+ // working directory, some others prepend ".\". If either
+ // of these are here, we want to strip them.
+ if (name[0] == '.')
+ {
+ if (name[1] == '\\' || name[1] == '/')
+ {
+ return name + 2;
+ }
+ }
+
+#if defined(ACE_OPENVMS)
+ char* tmp;
+ char* tmpName = new char[strlen(name) + 1];
+ ACE_OS::strcpy (tmpName, name);
+ if ((tmp = ACE_OS::strrchr (tmpName, ';')) != 0)
+ *tmp = '\000';
+ if ((tmp = translateName (tmpName)) != 0)
+ name = tmp;
+ delete [] tmpName;
+
+ char home[PATH_MAX];
+ if (ACE_OS::getcwd (home, sizeof(home)) != NULL)
+ {
+ tmp = translateName (home);
+ if (tmp == 0)
+ tmp = home;
+ if (ACE_OS::strlen (tmp) < ACE_OS::strlen (name))
+ {
+ if (ACE_OS::strncasecmp (tmp, name, ACE_OS::strlen (tmp)) == 0)
+ {
+ const char* tmpC = name + ACE_OS::strlen (tmp);
+ if (*tmpC == '/')
+ ++tmpC;
+ return (char*)tmpC;
+ }
+ }
+ }
+#endif
+
+ return name;
+}
+
+/**
+ Whether we should not mung idl element names that are
+ C++ keywords e.g. delete, operator etc. with _cxx_ prefix.
+ Should be true when being used by the IFR Service
+ */
+bool
+IDL_GlobalData::preserve_cpp_keywords (void)
+{
+ return preserve_cpp_keywords_;
+}
+
+/**
+ Set whether we should not mung idl element names that are C++
+ keywords e.g. delete, operator etc. with _cxx_ prefix.
+ Is unset by the tao_idl compiler.
+ */
+void
+IDL_GlobalData::preserve_cpp_keywords (bool val)
+{
+ preserve_cpp_keywords_ = val;
+}
+
+void
+IDL_GlobalData::add_include_path (const char *s)
+{
+ this->include_paths_.enqueue_tail (ACE::strnew (s));
+}
+
+ACE_Hash_Map_Manager<char *, char *, ACE_Null_Mutex> &
+IDL_GlobalData::file_prefixes (void)
+{
+ return this->file_prefixes_;
+}
+
+bool
+IDL_GlobalData::pass_orb_idl (void) const
+{
+ return this->pass_orb_idl_;
+}
+
+void
+IDL_GlobalData::pass_orb_idl (bool val)
+{
+ this->pass_orb_idl_ = val;
+}
+
+bool
+IDL_GlobalData::using_ifr_backend (void) const
+{
+ return this->using_ifr_backend_;
+}
+
+void
+IDL_GlobalData::using_ifr_backend (bool val)
+{
+ this->using_ifr_backend_ = val;
+}
+
+bool
+IDL_GlobalData::ignore_idl3 (void) const
+{
+ return this->ignore_idl3_;
+}
+
+void
+IDL_GlobalData::ignore_idl3 (bool val)
+{
+ this->ignore_idl3_ = val;
+}
+
+// Return 0 on success, -1 failure. The <errno> corresponding to the
+// error that caused the GPERF execution is also set.
+int
+IDL_GlobalData::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;
+#else
+ // 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;
+ }
+ }
+#endif /* ACE_WIN32 */
+}
+
+void
+IDL_GlobalData::fini (void)
+{
+ if (0 != this->pd_root)
+ {
+ this->pd_root->fini ();
+ 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->tao_root_;
+ this->tao_root_ = 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;
+ delete [] this->pd_include_file_names;
+ this->pd_include_file_names = 0;
+
+ char **path_tmp = 0;
+
+ for (ACE_Unbounded_Queue_Iterator<char *>qiter (
+ this->include_paths_
+ );
+ !qiter.done ();
+ qiter.advance ())
+ {
+ qiter.next (path_tmp);
+ ACE::strdelete (*path_tmp);
+ }
+
+ ACE_Hash_Map_Entry<char *, char *> *entry = 0;
+
+ for (ACE_Hash_Map_Iterator<char *, char *, ACE_Null_Mutex> hiter (
+ this->file_prefixes_
+ );
+ !hiter.done ();
+ hiter.advance ())
+ {
+ hiter.next (entry);
+ ACE::strdelete (entry->ext_id_);
+ ACE::strdelete (entry->int_id_);
+ }
+}
+
+void
+IDL_GlobalData::create_uses_multiple_stuff (
+ AST_Component *c,
+ AST_Component::port_description &pd
+ )
+{
+ ACE_CString struct_name (pd.id->get_string ());
+ struct_name += "Connection";
+ Identifier struct_id (struct_name.c_str ());
+ UTL_ScopedName sn (&struct_id, 0);
+ AST_Structure *connection =
+ idl_global->gen ()->create_structure (&sn, 0, 0);
+ struct_id.destroy ();
+
+ Identifier object_id ("objref");
+ UTL_ScopedName object_name (&object_id,
+ 0);
+ AST_Field *object_field =
+ idl_global->gen ()->create_field (pd.impl,
+ &object_name,
+ AST_Field::vis_NA);
+ (void) DeclAsScope (connection)->fe_add_field (object_field);
+ object_id.destroy ();
+
+ Identifier local_id ("Cookie");
+ UTL_ScopedName local_name (&local_id,
+ 0);
+ Identifier module_id ("Components");
+ UTL_ScopedName scoped_name (&module_id,
+ &local_name);
+ AST_Decl *d = c->lookup_by_name (&scoped_name,
+ true);
+ local_id.destroy ();
+ module_id.destroy ();
+
+ if (d == 0)
+ {
+ // This would happen if we haven't included Componennts.idl.
+ idl_global->err ()->lookup_error (&scoped_name);
+ return;
+ }
+
+ AST_ValueType *cookie = AST_ValueType::narrow_from_decl (d);
+
+ Identifier cookie_id ("ck");
+ UTL_ScopedName cookie_name (&cookie_id,
+ 0);
+ AST_Field *cookie_field =
+ idl_global->gen ()->create_field (cookie,
+ &cookie_name,
+ AST_Field::vis_NA);
+ (void) DeclAsScope (connection)->fe_add_field (cookie_field);
+ cookie_id.destroy ();
+
+ (void) c->fe_add_structure (connection);
+
+ idl_uns_long bound = 0;
+ AST_Expression *bound_expr =
+ idl_global->gen ()->create_expr (bound,
+ AST_Expression::EV_ulong);
+ AST_Sequence *sequence =
+ idl_global->gen ()->create_sequence (bound_expr,
+ connection,
+ 0,
+ 0,
+ 0);
+
+ ACE_CString seq_string (pd.id->get_string ());
+ seq_string += "Connections";
+ Identifier seq_id (seq_string.c_str ());
+ UTL_ScopedName seq_name (&seq_id,
+ 0);
+ AST_Typedef *connections =
+ idl_global->gen ()->create_typedef (sequence,
+ &seq_name,
+ 0,
+ 0);
+ seq_id.destroy ();
+
+ (void) c->fe_add_typedef (connections);
+}
+
+int
+IDL_GlobalData::path_cmp (const char *s, const char *t)
+{
+#if defined (WIN32) || defined (ACE_OPENVMS)
+ // Since Windows has case-insensitive filenames, the preprocessor,
+ // when searching using a provided relative path, will sometimes
+ // capitalize the first letter of the last segment of a path name
+ // and make the rest lowercase, regardless of how it was actually
+ // spelled when created. This 'feature' was preventing the
+ // validation of included IDL files, necessary before generating
+ // the corresponding C++ includes.
+ return ACE_OS::strcasecmp (s, t);
+#else
+ return ACE_OS::strcmp (s, t);
+#endif /* defined (WIN32) */
+}
+
+bool
+IDL_GlobalData::hasspace (const char *s)
+{
+ size_t length = ACE_OS::strlen (s);
+
+ if (length > 2)
+ {
+ // We don't need to check the first or last slot.
+ for (size_t i = 1; i < length - 1; ++i)
+ {
+ if (ACE_OS::ace_isspace (s[i]))
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+ACE_Unbounded_Queue<AST_ValueType *> &
+IDL_GlobalData::primary_keys (void)
+{
+ return this->primary_keys_;
+}
+
+void
+IDL_GlobalData::check_primary_keys (void)
+{
+ AST_ValueType *holder = 0;
+
+ while (!this->primary_keys_.is_empty ())
+ {
+ // Dequeue the element at the head of the queue.
+ if (this->primary_keys_.dequeue_head (holder))
+ {
+ ACE_ERROR((LM_ERROR,
+ "(%N:%l) idl_global::check_primary_keys - "
+ "dequeue_head failed\n"));
+ }
+
+ if (!holder->legal_for_primary_key ())
+ {
+ this->pd_err->illegal_primary_key (holder);
+ }
+ }
+}
+
+const char *
+IDL_GlobalData::recursion_start (void) const
+{
+ return this->recursion_start_;
+}
+
+void
+IDL_GlobalData::recursion_start (const char *val)
+{
+ ACE::strdelete (this->recursion_start_);
+ this->recursion_start_ = ACE::strnew (val);
+}
+
+UTL_String *
+IDL_GlobalData::utl_string_factory (const char *str)
+{
+ return new UTL_String (str);
+}
+
+void
+IDL_GlobalData::add_dcps_data_type (const char* id)
+{
+ // Check if the type already exists.
+ DCPS_Data_Type_Info* newinfo ;
+ if (this->dcps_type_info_map_.find (id, newinfo) != 0)
+ {
+ // No existing entry, add one.
+
+ // trailing space required!!
+ char* foo_type;
+ ACE_NEW (foo_type, char [ACE_OS::strlen (id) + 2]);
+ ACE_OS::sprintf (foo_type, "%s ", id);
+
+ UTL_ScopedName* t1 = idl_global->string_to_scoped_name (foo_type);
+ // chained with null Identifier required!!
+ UTL_ScopedName* target = new UTL_ScopedName (new Identifier (""), t1);
+
+ newinfo = new DCPS_Data_Type_Info ();
+ newinfo->name_ = target;
+
+ // Add the newly formed entry to the map.
+ if (this->dcps_type_info_map_.bind( id, newinfo) != 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Unable to insert type")
+ ACE_TEXT (" into DCPS type container: %s.\n"),
+ id));
+ return;
+ }
+ }
+ else
+ {
+ ACE_ERROR ((LM_WARNING,
+ ACE_TEXT ("(%P|%t) Duplicate DCPS type defined: %s.\n"),
+ id));
+ }
+
+}
+
+bool
+IDL_GlobalData::add_dcps_data_key (const char* id, const char* key)
+{
+ // Search the map for the type.
+ DCPS_Data_Type_Info* newinfo = 0;
+
+ if (this->dcps_type_info_map_.find (id, newinfo) == 0)
+ {
+ // Add the new key field to the type.
+ newinfo->key_list_.enqueue_tail (key);
+ return true;
+ }
+ else
+ {
+ ACE_ERROR((LM_ERROR,
+ ACE_TEXT ("missing previous #pragma DCPS_DATA_TYPE\n")));
+ }
+
+ return false;
+}
+
+IDL_GlobalData::DCPS_Data_Type_Info*
+IDL_GlobalData::is_dcps_type (UTL_ScopedName* target)
+{
+ // Traverse the entire map.
+ DCPS_Type_Info_Map::ENTRY* entry ;
+ for (DCPS_Type_Info_Map::ITERATOR current (this->dcps_type_info_map_);
+ current.next (entry);
+ current.advance ())
+ {
+ // Look for our Identifier.
+ if (0 == entry->int_id_->name_->compare (target))
+ {
+ // Found it!
+ return entry->int_id_;
+ }
+ }
+
+ // No joy.
+ return 0;
+}
diff --git a/TAO/TAO_IDL/util/utl_identifier.cpp b/TAO/TAO_IDL/util/utl_identifier.cpp
new file mode 100644
index 00000000000..e3e438dc9d6
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_identifier.cpp
@@ -0,0 +1,237 @@
+// $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.
+
+*/
+
+#include "utl_identifier.h"
+#include "global_extern.h"
+#include "utl_err.h"
+#include "utl_string.h"
+
+// FUZZ: disable check_for_streams_include
+#include "ace/streams.h"
+
+ACE_RCSID (util,
+ utl_identifier,
+ "$Id$")
+
+Identifier::Identifier (void)
+ : pv_string (0),
+ escaped_ (0)
+{
+}
+
+Identifier::Identifier (const char *s)
+{
+ bool shift = 0;
+ this->escaped_ = 0;
+
+ if (*s == '_')
+ {
+ // Only one leading underscore is allowed.
+ if (s[1] == '_')
+ {
+ idl_global->err ()->error0 (UTL_Error::EIDL_UNDERSCORE);
+ }
+
+ shift = 1;
+ this->escaped_ = 1;
+
+ ACE_CString str (s,
+ 0,
+ 0);
+
+ if (str.find ("_cxx_") == 0
+ || str.find ("_tc_") == 0
+ || str.find ("_tao_") == 0)
+ {
+ shift = 0;
+ }
+ }
+
+ if (shift)
+ {
+ this->pv_string = ACE::strnew (s + 1);
+ }
+ else
+ {
+ this->pv_string = ACE::strnew (s);
+ }
+}
+
+Identifier::~Identifier (void)
+{
+ if (this->pv_string != 0)
+ {
+ ACE::strdelete (this->pv_string);
+ this->pv_string = 0;
+ }
+}
+
+// Operations.
+
+char *
+Identifier::get_string (void)
+{
+ return this->pv_string;
+}
+
+void
+Identifier::replace_string (const char * s)
+{
+ if (this->pv_string != 0)
+ {
+ delete [] this->pv_string;
+ }
+
+ this->pv_string = ACE::strnew (s);
+}
+
+// Compare two Identifier *
+bool
+Identifier::compare (Identifier *o)
+{
+ if (o == 0)
+ {
+ return false;
+ };
+
+ if (this->pv_string == 0 || o->get_string () == 0)
+ {
+ return false;
+ }
+
+ if (this->escaped_ ^ o->escaped_)
+ {
+ return false;
+ }
+
+ return (ACE_OS::strcmp (this->pv_string, o->get_string ()) == 0);
+}
+
+// Report the appropriate error if the two identifiers differ only in case.
+bool
+Identifier::case_compare (Identifier *o)
+{
+ UTL_String member (this->pv_string);
+ UTL_String other (o->get_string ());
+
+ bool result = member.compare (&other);
+
+ member.destroy ();
+ other.destroy ();
+
+ return result;
+}
+
+// Report no error if the two identifiers differ only in case.
+bool
+Identifier::case_compare_quiet (Identifier *o)
+{
+ UTL_String member (this->pv_string);
+ UTL_String other (o->pv_string);
+
+ bool const result = member.compare_quiet (&other);
+
+ member.destroy ();
+ other.destroy ();
+
+ return result;
+}
+
+Identifier *
+Identifier::copy (void)
+{
+ Identifier *retval = 0;
+ ACE_NEW_RETURN (retval,
+ Identifier (this->pv_string),
+ 0);
+
+ retval->escaped_ = this->escaped_;
+
+ return retval;
+}
+
+bool
+Identifier::escaped (void) const
+{
+ return this->escaped_;
+}
+
+// Dumping.
+void
+Identifier::dump (ACE_OSTREAM_TYPE &o)
+{
+ if (this->pv_string == 0)
+ {
+ return;
+ }
+
+ o << this->pv_string;
+}
+
+void
+Identifier::destroy (void)
+{
+}
diff --git a/TAO/TAO_IDL/util/utl_idlist.cpp b/TAO/TAO_IDL/util/utl_idlist.cpp
new file mode 100644
index 00000000000..520036950bf
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_idlist.cpp
@@ -0,0 +1,278 @@
+// $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.
+
+ */
+
+// 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.
+
+#include "utl_idlist.h"
+#include "utl_identifier.h"
+#include "ace/OS_Memory.h"
+#include "ace/OS_NS_string.h"
+
+// FUZZ: disable check_for_streams_include
+#include "ace/streams.h"
+
+ACE_RCSID (util,
+ utl_idlist,
+ "$Id$")
+
+// Constructor
+UTL_IdList::UTL_IdList (Identifier *s,
+ UTL_IdList *cdr)
+ : UTL_List ((UTL_List *) cdr),
+ pd_car_data (s)
+{
+}
+
+// Public operations
+
+// Copy a list.
+UTL_List *
+UTL_IdList::copy (void)
+{
+ UTL_IdList *retval = 0;
+
+ if (this->tail () == 0)
+ {
+ ACE_NEW_RETURN (retval,
+ UTL_IdList (this->head ()->copy (),
+ 0),
+ 0);
+ }
+ else
+ {
+ ACE_NEW_RETURN (retval,
+ UTL_IdList (this->head ()->copy (),
+ (UTL_IdList *) this->tail ()->copy ()),
+ 0);
+ }
+
+ return (UTL_List *) retval;
+}
+
+// Get list item.
+Identifier *
+UTL_IdList::head (void)
+{
+ return this->pd_car_data;
+}
+
+// Get last item of this list.
+Identifier *
+UTL_IdList::last_component (void)
+{
+ if (this->tail () == 0)
+ {
+ return this->head ();
+ }
+
+ 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 ();
+
+ // Strip away any leading empty segments.
+
+ if (ACE_OS::strlen (this->pd_car_data->get_string ()) == 0)
+ {
+ UTL_List *this_tail = this->tail ();
+
+ if (this_tail == 0)
+ {
+ return 1;
+ }
+
+ return ((UTL_IdList *) this_tail)->compare (other);
+ }
+
+ if (ACE_OS::strlen (other->pd_car_data->get_string ()) == 0)
+ {
+ UTL_List *other_tail = other->tail ();
+
+ if (other_tail == 0)
+ {
+ return 1;
+ }
+
+ return this->compare ((UTL_IdList *) other->tail ());
+ }
+
+ 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)
+{
+ long first = true;
+ long second = false;
+
+ for (UTL_IdListActiveIterator i (this);
+ !i.is_done ();
+ i.next ())
+ {
+ if (!first)
+ {
+ o << "::";
+ }
+ else if (second)
+ {
+ first = second = false;
+ }
+
+ i.item ()->dump (o);
+
+ if (first)
+ {
+ if (ACE_OS::strcmp (i.item ()->get_string (), "::") != 0)
+ {
+ first = false;
+ }
+ else
+ {
+ second = true;
+ }
+ }
+ }
+}
+
+void
+UTL_IdList::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 ();
+}
+
+// UTL_IdList active iterator.
+
+// Constructor
+UTL_IdListActiveIterator::UTL_IdListActiveIterator (UTL_IdList *s)
+ : UTL_ListActiveIterator (s)
+{
+}
+
+// Public operations.
+
+// Get current item.
+Identifier *
+UTL_IdListActiveIterator::item (void)
+{
+ if (this->source == 0)
+ {
+ return 0;
+ }
+
+ return ((UTL_IdList *) source)->head ();
+}
diff --git a/TAO/TAO_IDL/util/utl_indenter.cpp b/TAO/TAO_IDL/util/utl_indenter.cpp
new file mode 100644
index 00000000000..4f2d2389d07
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_indenter.cpp
@@ -0,0 +1,132 @@
+// $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.
+
+ */
+
+// utl_indenter.cc - Implementation of indenter for dumping IDL AST
+//
+
+#include "ace/OS_NS_stdio.h"
+#include "utl_indenter.h"
+
+// FUZZ: disable check_for_streams_include
+#include "ace/streams.h"
+
+ACE_RCSID (util,
+ utl_indenter,
+ "$Id$")
+
+/*
+ * Constructors
+ */
+UTL_Indenter::UTL_Indenter (void)
+ : pd_indent_level (0)
+{
+}
+
+// Reset indentation level.
+void
+UTL_Indenter::reset (void)
+{
+ this->pd_indent_level = 0;
+}
+
+// Increase indentation level.
+void
+UTL_Indenter::increase (void)
+{
+ ++this->pd_indent_level;
+}
+
+// Decrease indentation level.
+void
+UTL_Indenter::decrease ()
+{
+ if (this->pd_indent_level > 0)
+ {
+ --this->pd_indent_level;
+ }
+}
+
+// Produce white space to indent to current indentation level on ostream o.
+void
+UTL_Indenter::skip_to (ACE_OSTREAM_TYPE &o)
+{
+ for (long i = 0; i < this->pd_indent_level; ++i)
+ {
+ o << " ";
+ }
+}
+
+// Produce white space to indent to current indentation level on ostream o.
+void
+UTL_Indenter::skip_to (FILE *fp)
+{
+ for (long i = 0; i < this->pd_indent_level; ++i)
+ {
+ ACE_OS::fprintf (fp,
+ " ");
+ }
+}
+
diff --git a/TAO/TAO_IDL/util/utl_labellist.cpp b/TAO/TAO_IDL/util/utl_labellist.cpp
new file mode 100644
index 00000000000..bab64bb4e15
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_labellist.cpp
@@ -0,0 +1,123 @@
+// $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.
+
+ */
+
+// 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.
+
+#include "utl_labellist.h"
+#include "ast_union_label.h"
+
+ACE_RCSID (util,
+ utl_labellist,
+ "$Id$")
+
+UTL_LabelList::UTL_LabelList (AST_UnionLabel *s,
+ UTL_LabelList *cdr)
+ : UTL_List(cdr),
+ pd_car_data(s)
+{
+}
+
+// Get list item.
+AST_UnionLabel *
+UTL_LabelList::head (void)
+{
+ return this->pd_car_data;
+}
+
+void
+UTL_LabelList::destroy (void)
+{
+ this->pd_car_data->destroy ();
+ delete this->pd_car_data;
+ this->pd_car_data = 0;
+
+ this->UTL_List::destroy ();
+}
+
+UTL_LabellistActiveIterator::UTL_LabellistActiveIterator (UTL_LabelList *s)
+ : UTL_ListActiveIterator (s)
+{
+}
+
+
+// Get current item.
+AST_UnionLabel *
+UTL_LabellistActiveIterator::item (void)
+{
+ if (source == 0)
+ {
+ return 0;
+ }
+
+ return ((UTL_LabelList *) source)->head ();
+}
+
diff --git a/TAO/TAO_IDL/util/utl_list.cpp b/TAO/TAO_IDL/util/utl_list.cpp
new file mode 100644
index 00000000000..a52dd4bde8f
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_list.cpp
@@ -0,0 +1,198 @@
+// $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.
+
+*/
+
+// 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.
+
+#include "utl_list.h"
+#include "ace/OS_Memory.h"
+
+ACE_RCSID (util,
+ utl_list,
+ "$Id$")
+
+UTL_List::UTL_List (UTL_List *c)
+ : pd_cdr_data (c)
+{
+}
+
+UTL_List::~UTL_List (void)
+{
+}
+
+// Compute list length.
+long
+UTL_List::list_length (long n)
+{
+ if (this->pd_cdr_data == 0)
+ {
+ return n;
+ }
+ else
+ {
+ return this->pd_cdr_data->list_length (n + 1);
+ }
+}
+
+// Smash last cdr with l.
+void
+UTL_List::nconc (UTL_List *l)
+{
+ if (this->pd_cdr_data == 0)
+ {
+ this->pd_cdr_data = l;
+ }
+ else
+ {
+ this->pd_cdr_data->nconc (l);
+ }
+}
+
+// Override this operation to copy lists of other types.
+UTL_List *
+UTL_List::copy (void)
+{
+ 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 retval;
+}
+
+// Get next list.
+UTL_List *
+UTL_List::tail (void)
+{
+ return pd_cdr_data;
+}
+
+// Set next list.
+void
+UTL_List::set_tail (UTL_List *l)
+{
+ this->pd_cdr_data->destroy ();
+ delete this->pd_cdr_data;
+ this->pd_cdr_data = l;
+}
+
+// Compute list length.
+long
+UTL_List::length (void)
+{
+ return list_length (1);
+}
+
+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.
+
+UTL_ListActiveIterator::UTL_ListActiveIterator (UTL_List *s)
+ : source (s)
+{
+}
+
+// Is iterator done?
+bool
+UTL_ListActiveIterator::is_done (void)
+{
+ return (this->source == 0) ? true : false;
+}
+
+// Advance to next item.
+void
+UTL_ListActiveIterator::next (void)
+{
+ 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
new file mode 100644
index 00000000000..37f6020cfa6
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_namelist.cpp
@@ -0,0 +1,134 @@
+// $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.
+
+*/
+
+// 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.
+
+#include "utl_namelist.h"
+
+ACE_RCSID (util,
+ utl_namelist,
+ "$Id$")
+
+UTL_NameList::UTL_NameList (UTL_ScopedName *s,
+ UTL_NameList *cdr)
+ : UTL_List (cdr),
+ pd_car_data (s),
+ pd_truncatable (false)
+{
+}
+
+// Get list item.
+UTL_ScopedName *
+UTL_NameList::head (void)
+{
+ return this->pd_car_data;
+}
+
+bool
+UTL_NameList::truncatable (void) const
+{
+ return this->pd_truncatable;
+}
+
+void
+UTL_NameList::truncatable (bool val)
+{
+ this->pd_truncatable = val;
+}
+
+void
+UTL_NameList::destroy (void)
+{
+ this->pd_car_data->destroy ();
+ delete this->pd_car_data;
+ this->pd_car_data = 0;
+
+ this->UTL_List::destroy ();
+}
+
+UTL_NamelistActiveIterator::UTL_NamelistActiveIterator (UTL_NameList *s)
+ : UTL_ListActiveIterator(s)
+{
+}
+
+// Get current item.
+UTL_ScopedName *
+UTL_NamelistActiveIterator::item (void)
+{
+ if (source == 0)
+ {
+ return 0;
+ }
+
+ return ((UTL_NameList *) source)->head ();
+}
+
diff --git a/TAO/TAO_IDL/util/utl_scope.cpp b/TAO/TAO_IDL/util/utl_scope.cpp
new file mode 100644
index 00000000000..3ff9e4c4cad
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_scope.cpp
@@ -0,0 +1,2586 @@
+// $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.
+
+*/
+
+#include "utl_scope.h"
+#include "utl_identifier.h"
+#include "utl_err.h"
+#include "utl_indenter.h"
+#include "utl_string.h"
+#include "ast_valuebox.h"
+#include "ast_valuetype.h"
+#include "ast_valuetype_fwd.h"
+#include "ast_eventtype.h"
+#include "ast_eventtype_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 "fe_extern.h"
+#include "global_extern.h"
+#include "ace/OS_NS_strings.h"
+
+// FUZZ: disable check_for_streams_include
+#include "ace/streams.h"
+
+ACE_RCSID (util,
+ utl_scope,
+ "$Id$")
+
+#undef INCREMENT
+#define INCREMENT 64
+
+// Static variables.
+static Identifier *_global_scope_name = 0;
+static Identifier *_global_scope_root_name = 0;
+
+// Static functions.
+
+// Determines if a name is global.
+static long
+is_global_name (Identifier *i)
+{
+ long comp_result = 0;
+
+ if (i == 0)
+ {
+ return comp_result;
+ }
+
+ if (_global_scope_name == 0)
+ {
+ ACE_NEW_RETURN (_global_scope_name,
+ Identifier ("::"),
+ 0);
+ }
+
+ if (_global_scope_root_name == 0)
+ {
+ ACE_NEW_RETURN (_global_scope_root_name,
+ Identifier (""),
+ 0);
+ }
+
+ comp_result = i->compare (_global_scope_name);
+
+ if (comp_result == 0)
+ {
+ comp_result = i->compare (_global_scope_root_name);
+ }
+
+ return comp_result;
+}
+
+// Helper function for lookup_by_name. Iterates doing local lookups of
+// subsequent components of a scoped name.
+static AST_Decl *
+iter_lookup_by_name_local (AST_Decl *d,
+ UTL_ScopedName *e,
+ long index,
+ bool full_def_only = false)
+{
+ AST_Typedef *td = AST_Typedef::narrow_from_decl (d);
+ AST_Decl *result = 0;
+
+ // Remove all the layers of typedefs.
+ while (d != NULL && d->node_type () == AST_Decl::NT_typedef)
+ {
+ if (td == 0)
+ {
+ return 0;
+ }
+
+ d = td->base_type ();
+ }
+
+ if (d == 0)
+ {
+ return 0;
+ }
+
+ // Try to convert the AST_Decl to a UTL_Scope.
+ UTL_Scope *sc = DeclAsScope (d);
+
+ if (sc == 0)
+ {
+ return 0;
+ }
+
+ if (index < static_cast<long> (sc->nmembers ()))
+ {
+ // Look up the first component of the scoped name.
+ result = sc->lookup_by_name_local (e->head (),
+ index,
+ full_def_only);
+ }
+ else
+ {
+ return 0;
+ }
+
+
+ if (result == 0)
+ {
+ return 0;
+ }
+ else
+ {
+ UTL_ScopedName *sn = (UTL_ScopedName *) e->tail ();
+
+ if (sn == 0)
+ {
+ // We're done.
+ return result;
+ }
+ else
+ {
+ // Look up the next component of the scoped name.
+ result = iter_lookup_by_name_local (result,
+ sn,
+ 0,
+ full_def_only);
+ }
+
+ if (result != 0)
+ {
+ // We're done.
+ return result;
+ }
+ else
+ {
+ // Maybe we're on the wrong branch of reopened
+ // and/or nested modules, so let's see if there's
+ // another branch. If 'index' gets as high as the
+ // number of members in the scope, the call above
+ // to lookup_by_name_local will catch it and return 0.
+ return iter_lookup_by_name_local (d,
+ e,
+ index + 1,
+ full_def_only);
+ }
+ }
+}
+
+// Constructors.
+
+UTL_Scope::UTL_Scope (void)
+ : pd_scope_node_type (AST_Decl::NT_module),
+ pd_decls (0),
+ pd_decls_allocated (0),
+ pd_decls_used (0),
+ pd_local_types (0),
+ pd_locals_allocated (0),
+ pd_locals_used (0),
+ pd_referenced (0),
+ pd_referenced_allocated (0),
+ pd_referenced_used (0),
+ pd_name_referenced (0),
+ pd_name_referenced_allocated (0),
+ pd_name_referenced_used (0),
+ has_prefix_ (0)
+{
+}
+
+UTL_Scope::UTL_Scope (AST_Decl::NodeType nt)
+ : pd_scope_node_type (nt),
+ pd_decls (0),
+ pd_decls_allocated (0),
+ pd_decls_used (0),
+ pd_local_types (0),
+ pd_locals_allocated (0),
+ pd_locals_used (0),
+ pd_referenced (0),
+ pd_referenced_allocated (0),
+ pd_referenced_used (0),
+ pd_name_referenced (0),
+ pd_name_referenced_allocated (0),
+ pd_name_referenced_used (0),
+ has_prefix_ (0)
+{
+}
+
+// Destructor.
+UTL_Scope::~UTL_Scope (void)
+{
+}
+
+// Private operations.
+
+static AST_Decl *
+add_type (AST_Type *type)
+{
+ AST_Decl *result = 0;
+ UTL_Scope *scope = 0;
+
+ switch (type->node_type())
+ {
+ case AST_Decl::NT_array:
+ result =
+ idl_global->root ()->add_array (AST_Array::narrow_from_decl (type));
+ break;
+ case AST_Decl::NT_enum:
+ result =
+ type->defined_in ()->add_enum (AST_Enum::narrow_from_decl (type));
+ scope = AST_Enum::narrow_from_decl (type);
+ break;
+ case AST_Decl::NT_sequence:
+ result =
+ idl_global->root ()->add_sequence (
+ AST_Sequence::narrow_from_decl (type)
+ );
+ break;
+ case AST_Decl::NT_string:
+ case AST_Decl::NT_wstring:
+ result =
+ idl_global->root ()->add_string (AST_String::narrow_from_decl (type));
+ break;
+ case AST_Decl::NT_struct:
+ result =
+ type->defined_in ()->add_structure (
+ AST_Structure::narrow_from_decl (type)
+ );
+ scope = AST_Structure::narrow_from_decl (type);
+ break;
+ case AST_Decl::NT_union:
+ result =
+ type->defined_in ()->add_union (AST_Union::narrow_from_decl (type));
+ scope = AST_Union::narrow_from_decl (type);
+ break;
+ default:
+ // For non-complex types, like predefined types
+ // no additional add needed, assume everything is ok.
+ result = (AST_Decl *) 1;
+ break;
+ }
+
+ if (scope != 0)
+ {
+ result = scope->call_add ();
+ }
+
+ return result;
+}
+
+// Protected operations.
+
+// Special version of lookup which only looks at the local name instead of
+// the fully scoped name, when doing lookups. This version is intended to
+// be used only by the CFE add_xxx functions.
+AST_Decl *
+UTL_Scope::lookup_for_add (AST_Decl *d,
+ bool)
+{
+ if (d == 0)
+ {
+ return 0;
+ }
+
+ Identifier *id = d->local_name ();
+
+ if (this->idl_keyword_clash (id) != 0)
+ {
+ return 0;
+ }
+
+ return this->lookup_by_name_local (id,
+ 0);
+}
+
+int
+UTL_Scope::idl_keyword_clash (Identifier *e)
+{
+ if (e->escaped ())
+ {
+ return 0;
+ }
+
+ char *tmp = e->get_string ();
+
+ UTL_String utl_tmp (tmp);
+
+ ACE_CString ext_id (utl_tmp.get_canonical_rep (),
+ 0,
+ 0);
+
+ int status = idl_global->idl_keywords ().find (ext_id);
+
+ utl_tmp.destroy ();
+
+ if (status == 0)
+ {
+ if (idl_global->case_diff_error ())
+ {
+ idl_global->err ()->idl_keyword_error (tmp);
+ }
+ else
+ {
+ idl_global->err ()->idl_keyword_warning (tmp);
+ }
+
+ return -1;
+ }
+
+ return 0;
+}
+
+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_component:
+ return scope_elem_nt != AST_Decl::NT_component_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_component_fwd:
+ return (scope_elem_nt != AST_Decl::NT_component_fwd
+ && scope_elem_nt != AST_Decl::NT_component);
+ case AST_Decl::NT_valuetype:
+ return scope_elem_nt != AST_Decl::NT_valuetype_fwd;
+ case AST_Decl::NT_eventtype:
+ return scope_elem_nt != AST_Decl::NT_eventtype_fwd;
+ case AST_Decl::NT_valuetype_fwd:
+ return (scope_elem_nt != AST_Decl::NT_valuetype_fwd
+ && scope_elem_nt != AST_Decl::NT_valuetype);
+ case AST_Decl::NT_eventtype_fwd:
+ return (scope_elem_nt != AST_Decl::NT_eventtype_fwd
+ && scope_elem_nt != AST_Decl::NT_eventtype);
+ default:
+ return true;
+ }
+}
+
+void
+UTL_Scope::check_for_predef_seq (AST_Decl *d)
+{
+ // Right now, we're interested only in predefined sequences
+ // referenced in the main IDL file. If we are processing
+ // multiple IDL files in one execution, the bits will
+ // stay set, and be accumulated as each file is parsed.
+ if (!idl_global->in_main_file ())
+ {
+ return;
+ }
+
+ AST_Type *bt = 0;
+ AST_Decl::NodeType nt = d->node_type ();
+
+ // We are interested only in members, arguments and typedefs.
+ switch (nt)
+ {
+ case AST_Decl::NT_field:
+ case AST_Decl::NT_union_branch:
+ case AST_Decl::NT_attr:
+ case AST_Decl::NT_argument:
+ bt = AST_Field::narrow_from_decl (d)->field_type ();
+ break;
+ case AST_Decl::NT_typedef:
+ bt = AST_Typedef::narrow_from_decl (d)->base_type ();
+ break;
+ default:
+ return;
+ }
+
+ // Check to eliminate more candidates.
+ if (!bt->imported () || bt->node_type () != AST_Decl::NT_typedef)
+ {
+ return;
+ }
+
+ bt = AST_Typedef::narrow_from_decl (bt)->base_type ();
+ nt = bt->node_type ();
+
+ // Must be a sequence with only one level of typedef.
+ if (nt != AST_Decl::NT_sequence)
+ {
+ return;
+ }
+
+ // Must be defined in the CORBA module.
+ AST_Decl *p = ScopeAsDecl (bt->defined_in ());
+ if (ACE_OS::strcmp (p->local_name ()->get_string (), "CORBA") != 0)
+ {
+ return;
+ }
+
+ // We know this narrowing will be successful.
+ bt = AST_Sequence::narrow_from_decl (bt)->base_type ();
+ nt = bt->node_type ();
+
+ // First check for string or wstring base type.
+ if (nt == AST_Decl::NT_string)
+ {
+ idl_global->string_seq_seen_ = true;
+ return;
+ }
+ else if (nt == AST_Decl::NT_wstring)
+ {
+ idl_global->wstring_seq_seen_ = true;
+ return;
+ }
+
+ // Now check for predefined base type.
+ AST_PredefinedType *pdt = AST_PredefinedType::narrow_from_decl (bt);
+ if (pdt == 0)
+ {
+ return;
+ }
+
+ switch (pdt->pt ())
+ {
+ case AST_PredefinedType::PT_long:
+ idl_global->long_seq_seen_ = true;
+ break;
+ case AST_PredefinedType::PT_ulong:
+ idl_global->ulong_seq_seen_ = true;
+ break;
+ case AST_PredefinedType::PT_longlong:
+ idl_global->longlong_seq_seen_ = true;
+ break;
+ case AST_PredefinedType::PT_ulonglong:
+ idl_global->ulonglong_seq_seen_ = true;
+ break;
+ case AST_PredefinedType::PT_short:
+ idl_global->short_seq_seen_ = true;
+ break;
+ case AST_PredefinedType::PT_ushort:
+ idl_global->ushort_seq_seen_ = true;
+ break;
+ case AST_PredefinedType::PT_float:
+ idl_global->float_seq_seen_ = true;
+ break;
+ case AST_PredefinedType::PT_double:
+ idl_global->double_seq_seen_ = true;
+ break;
+ case AST_PredefinedType::PT_longdouble:
+ idl_global->longdouble_seq_seen_ = true;
+ break;
+ case AST_PredefinedType::PT_char:
+ idl_global->char_seq_seen_ = true;
+ break;
+ case AST_PredefinedType::PT_wchar:
+ idl_global->wchar_seq_seen_ = true;
+ break;
+ case AST_PredefinedType::PT_boolean:
+ idl_global->boolean_seq_seen_ = true;
+ break;
+ case AST_PredefinedType::PT_octet:
+ idl_global->octet_seq_seen_ = true;
+ break;
+ case AST_PredefinedType::PT_any:
+ idl_global->any_seq_seen_ = true;
+ break;
+ default:
+ break;
+ }
+}
+
+// Public operations.
+
+// Scope Management Protocol.
+//
+// All members of the protocol defined in UTL_Scope simply return the node
+// and don't do a thing. These members are simply dummies to retain
+// compatibility with pre-two-pass compiler back-ends.
+
+AST_PredefinedType *
+UTL_Scope::add_predefined_type (AST_PredefinedType *p)
+{
+ if (p == 0)
+ {
+ return 0;
+ }
+
+ p->set_added (true);
+ return p;
+}
+
+AST_Module *
+UTL_Scope::add_module (AST_Module *m)
+{
+ if (m == 0)
+ {
+ return 0;
+ }
+
+ m->set_added (true);
+ return m;
+}
+
+AST_Interface *
+UTL_Scope::add_interface (AST_Interface *i)
+{
+ if (i == 0)
+ {
+ return 0;
+ }
+
+ i->set_added (true);
+ return i;
+}
+
+AST_InterfaceFwd *
+UTL_Scope::add_interface_fwd (AST_InterfaceFwd *i)
+{
+ if (i == 0)
+ {
+ return 0;
+ }
+
+ i->set_added (true);
+ return i;
+}
+
+AST_ValueType *
+UTL_Scope::add_valuetype (AST_ValueType *i)
+{
+ if (i == 0)
+ {
+ return 0;
+ }
+
+ i->set_added (true);
+ return i;
+}
+
+AST_ValueTypeFwd *
+UTL_Scope::add_valuetype_fwd (AST_ValueTypeFwd *i)
+{
+ if (i == 0)
+ {
+ return 0;
+ }
+
+ i->set_added (true);
+ return i;
+}
+
+AST_EventType *
+UTL_Scope::add_eventtype (AST_EventType *i)
+{
+ if (i == 0)
+ {
+ return 0;
+ }
+
+ i->set_added (true);
+ return i;
+}
+
+AST_EventTypeFwd *
+UTL_Scope::add_eventtype_fwd (AST_EventTypeFwd *i)
+{
+ if (i == 0)
+ {
+ return 0;
+ }
+
+ i->set_added (true);
+ return i;
+}
+
+AST_Component *
+UTL_Scope::add_component (AST_Component *i)
+{
+ if (i == 0)
+ {
+ return 0;
+ }
+
+ i->set_added (true);
+ return i;
+}
+
+AST_ComponentFwd *
+UTL_Scope::add_component_fwd (AST_ComponentFwd *i)
+{
+ if (i == 0)
+ {
+ return 0;
+ }
+
+ i->set_added (true);
+ return i;
+}
+
+AST_Home *
+UTL_Scope::add_home (AST_Home *i)
+{
+ if (i == 0)
+ {
+ return 0;
+ }
+
+ i->set_added (true);
+ return i;
+}
+
+AST_Exception *
+UTL_Scope::add_exception (AST_Exception *e)
+{
+ if (e == 0)
+ {
+ return 0;
+ }
+
+ e->set_added (true);
+ return e;
+}
+
+AST_Constant *
+UTL_Scope::add_constant (AST_Constant *c)
+{
+ if (c == 0)
+ {
+ return 0;
+ }
+
+ c->set_added (true);
+ return c;
+}
+
+UTL_StrList *
+UTL_Scope::add_context (UTL_StrList *c)
+{
+ return c;
+}
+
+UTL_NameList *
+UTL_Scope::add_exceptions (UTL_NameList *e)
+{
+ return e;
+}
+
+AST_Attribute *
+UTL_Scope::add_attribute (AST_Attribute *a)
+{
+ if (a == 0)
+ {
+ return 0;
+ }
+
+ a->set_added (true);
+
+ if (!a->field_type ()->added ())
+ {
+ return add_type (a->field_type ()) ? a : 0;
+ }
+ else
+ {
+ return a;
+ }
+}
+
+AST_Operation *
+UTL_Scope::add_operation (AST_Operation *o)
+{
+ if (o == 0)
+ {
+ return 0;
+ }
+
+ o->set_added (true);
+
+ if (!o->return_type ()->added ())
+ {
+ return add_type (o->return_type ()) ? o : 0;
+ }
+ else
+ {
+ return o;
+ }
+}
+
+AST_Argument *
+UTL_Scope::add_argument (AST_Argument *a)
+{
+ if (a == 0)
+ {
+ return 0;
+ }
+
+ a->set_added (true);
+
+ if (!a->field_type ()->added ())
+ {
+ return add_type (a->field_type ()) ? a : 0;
+ }
+ else
+ {
+ return a;
+ }
+}
+
+AST_Union *
+UTL_Scope::add_union (AST_Union *u)
+{
+ if (u == 0)
+ {
+ return 0;
+ }
+
+ u->set_added (true);
+ return u;
+}
+
+AST_UnionFwd *
+UTL_Scope::add_union_fwd (AST_UnionFwd *u)
+{
+ if (u == 0)
+ {
+ return 0;
+ }
+
+ u->set_added (true);
+ return u;
+}
+
+AST_UnionBranch *
+UTL_Scope::add_union_branch (AST_UnionBranch *u)
+{
+ if (u == 0)
+ {
+ return 0;
+ }
+
+ u->set_added (true);
+
+ if (!u->field_type ()->added ())
+ {
+ return add_type (u->field_type ()) ? u : 0;
+ }
+ else
+ {
+ return u;
+ }
+}
+
+AST_Structure *
+UTL_Scope::add_structure (AST_Structure *s)
+{
+ if (s == 0)
+ {
+ return 0;
+ }
+
+ s->set_added (true);
+ return s;
+}
+
+AST_StructureFwd *
+UTL_Scope::add_structure_fwd (AST_StructureFwd *s)
+{
+ if (s == 0)
+ {
+ return 0;
+ }
+
+ s->set_added (true);
+ return s;
+}
+
+AST_Field *
+UTL_Scope::add_field (AST_Field *f)
+{
+ if (f == 0)
+ {
+ return 0;
+ }
+
+ f->set_added (true);
+
+ if (!f->field_type ()->added ())
+ {
+ return add_type (f->field_type ()) ? f : 0;
+ }
+ else
+ {
+ return f;
+ }
+}
+
+AST_Enum *
+UTL_Scope::add_enum (AST_Enum *e)
+{
+ if (e == 0)
+ {
+ return 0;
+ }
+
+ e->set_added (true);
+ return e;
+}
+
+AST_EnumVal *
+UTL_Scope::add_enum_val (AST_EnumVal *e)
+{
+ if (e == 0)
+ {
+ return 0;
+ }
+
+ e->set_added (true);
+ return e;
+}
+
+AST_Typedef *
+UTL_Scope::add_typedef (AST_Typedef *t)
+{
+ if (t == 0)
+ {
+ return 0;
+ }
+
+ t->set_added (true);
+ if (!t->base_type ()->added ())
+ {
+ return add_type (t->base_type ()) ? t : 0;
+ }
+ else
+ {
+ return t;
+ }
+}
+
+AST_Sequence *
+UTL_Scope::add_sequence (AST_Sequence *s)
+{
+ if (s == 0)
+ {
+ return 0;
+ }
+
+ s->set_added (true);
+
+ if (!s->base_type ()->added ())
+ {
+ return add_type (s->base_type ()) ? s : 0;
+ }
+ else
+ {
+ return s;
+ }
+}
+
+AST_String *
+UTL_Scope::add_string (AST_String *s)
+{
+ if (s == 0)
+ {
+ return 0;
+ }
+
+ s->set_added (true);
+ return s;
+}
+
+AST_Array *
+UTL_Scope::add_array (AST_Array *a)
+{
+ if (a == 0)
+ {
+ return 0;
+ }
+
+ a->set_added (true);
+
+ if (!a->base_type ()->added ())
+ {
+ return add_type (a->base_type ()) ? a : 0;
+ }
+ else
+ {
+ return a;
+ }
+}
+
+AST_Native *
+UTL_Scope::add_native (AST_Native *n)
+{
+ if (n == 0)
+ {
+ return 0;
+ }
+
+ n->set_added (true);
+ return n;
+}
+
+AST_Factory *
+UTL_Scope::add_factory (AST_Factory *f)
+{
+ //We don't invite any new types so there is nothing actually to add
+ if (f == 0)
+ {
+ return 0;
+ }
+
+ f->set_added (true);
+ return f;
+}
+
+// Protected Front End Scope Management Protocol.
+//
+// All members of the protocol defined in UTL_Scope simply return NULL
+// and don't do a thing. This ensures that runtime errors will discover
+// operations which should have been redefined to allow certain kinds of
+// AST nodes to appear in a given context.
+
+AST_PredefinedType *
+UTL_Scope::fe_add_predefined_type (AST_PredefinedType *)
+{
+ return 0;
+}
+
+AST_Module *
+UTL_Scope::fe_add_module (AST_Module *)
+{
+ return 0;
+}
+
+AST_Interface *
+UTL_Scope::fe_add_interface (AST_Interface *)
+{
+ return 0;
+}
+
+AST_InterfaceFwd *
+UTL_Scope::fe_add_interface_fwd (AST_InterfaceFwd *)
+{
+ return 0;
+}
+
+AST_ValueBox *
+UTL_Scope::fe_add_valuebox (AST_ValueBox *)
+{
+ 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_EventType *
+UTL_Scope::fe_add_eventtype (AST_EventType *)
+{
+ return 0;
+}
+
+AST_EventTypeFwd *
+UTL_Scope::fe_add_eventtype_fwd (AST_EventTypeFwd *)
+{
+ 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 *)
+{
+ return 0;
+}
+
+AST_Constant *
+UTL_Scope::fe_add_constant (AST_Constant *)
+{
+ return 0;
+}
+
+UTL_StrList *
+UTL_Scope::fe_add_context (UTL_StrList *)
+{
+ return 0;
+}
+
+UTL_NameList *
+UTL_Scope::fe_add_exceptions (UTL_NameList *)
+{
+ return 0;
+}
+
+AST_Attribute *
+UTL_Scope::fe_add_attribute (AST_Attribute *)
+{
+ return 0;
+}
+
+AST_Operation *
+UTL_Scope::fe_add_operation (AST_Operation *)
+{
+ return 0;
+}
+
+AST_Argument *
+UTL_Scope::fe_add_argument (AST_Argument *)
+{
+ return 0;
+}
+
+AST_Union *
+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 *)
+{
+ return 0;
+}
+
+AST_Structure *
+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 *)
+{
+ return 0;
+}
+
+AST_Enum *
+UTL_Scope::fe_add_enum (AST_Enum *)
+{
+ return 0;
+}
+
+AST_EnumVal *
+UTL_Scope::fe_add_enum_val (AST_EnumVal *)
+{
+ return 0;
+}
+
+AST_Typedef *
+UTL_Scope::fe_add_typedef (AST_Typedef *)
+{
+ return 0;
+}
+
+AST_Sequence *
+UTL_Scope::fe_add_sequence (AST_Sequence *)
+{
+ return 0;
+}
+
+AST_String *
+UTL_Scope::fe_add_string (AST_String *)
+{
+ return 0;
+}
+
+AST_Array *
+UTL_Scope::fe_add_array (AST_Array *)
+{
+ return 0;
+}
+
+AST_Native *
+UTL_Scope::fe_add_native (AST_Native *)
+{
+ return 0;
+}
+
+AST_Factory *
+UTL_Scope::fe_add_factory (AST_Factory *)
+{
+ return 0;
+}
+
+// This is the second pass of the front end
+// It calls the public add protocol on everything in scope.
+// It calls the add_xx functions of the most derived AST_Node.
+
+AST_Decl *
+UTL_Scope::call_add (void)
+{
+ AST_Decl *result = 0;
+ AST_Decl *decl = 0;
+
+ UTL_ScopeActiveIterator i (this,
+ UTL_Scope::IK_decls);
+ UTL_Scope *scope = 0;
+
+ while (!i.is_done ())
+ {
+ decl = i.item ();
+ scope = 0;
+
+ switch (decl->node_type ())
+ {
+ case AST_Decl::NT_argument:
+ result = add_argument (AST_Argument::narrow_from_decl (decl));
+ break;
+ case AST_Decl::NT_array:
+ result = add_array (AST_Array::narrow_from_decl (decl));
+ break;
+ case AST_Decl::NT_attr:
+ result = add_attribute (AST_Attribute::narrow_from_decl (decl));
+ break;
+ case AST_Decl::NT_const:
+ result = add_constant (AST_Constant::narrow_from_decl (decl));
+ break;
+ case AST_Decl::NT_enum:
+ scope = AST_Enum::narrow_from_decl (decl);
+ result = add_enum (AST_Enum::narrow_from_decl (decl));
+ break;
+ case AST_Decl::NT_enum_val:
+ result = add_enum_val (AST_EnumVal::narrow_from_decl (decl));
+ break;
+ case AST_Decl::NT_except:
+ scope = AST_Exception::narrow_from_decl (decl);
+ result = add_exception (AST_Exception::narrow_from_decl (decl));
+ break;
+ case AST_Decl::NT_field:
+ result = add_field (AST_Field::narrow_from_decl (decl));
+ break;
+ case AST_Decl::NT_interface:
+ scope = AST_Interface::narrow_from_decl (decl);
+ result = add_interface (AST_Interface::narrow_from_decl (decl));
+ break;
+ case AST_Decl::NT_interface_fwd:
+ result =
+ add_interface_fwd (AST_InterfaceFwd::narrow_from_decl (decl));
+ break;
+ case AST_Decl::NT_module:
+ scope = AST_Module::narrow_from_decl (decl);
+ result = add_module (AST_Module::narrow_from_decl (decl));
+ break;
+ case AST_Decl::NT_native:
+ result = add_native (AST_Native::narrow_from_decl (decl));
+ break;
+ case AST_Decl::NT_op:
+ result = add_operation (AST_Operation::narrow_from_decl (decl));
+ scope = AST_Operation::narrow_from_decl (decl);
+ break;
+ case AST_Decl::NT_pre_defined:
+ result =
+ add_predefined_type (AST_PredefinedType::narrow_from_decl (decl));
+ break;
+ case AST_Decl::NT_sequence:
+ result = add_sequence (AST_Sequence::narrow_from_decl (decl));
+ break;
+ case AST_Decl::NT_string:
+ case AST_Decl::NT_wstring:
+ result = add_string (AST_String::narrow_from_decl (decl));
+ break;
+ case AST_Decl::NT_struct:
+ result = add_structure (AST_Structure::narrow_from_decl (decl));
+ scope = AST_Structure::narrow_from_decl (decl);
+ break;
+ case AST_Decl::NT_typedef:
+ result = add_typedef (AST_Typedef::narrow_from_decl (decl));
+ break;
+ case AST_Decl::NT_union:
+ result = add_union (AST_Union::narrow_from_decl (decl));
+ scope = AST_Union::narrow_from_decl (decl);
+ break;
+ case AST_Decl::NT_union_branch:
+ result =
+ add_union_branch (AST_UnionBranch::narrow_from_decl (decl));
+ break;
+ case AST_Decl::NT_factory:
+ result = add_factory (AST_Factory::narrow_from_decl (decl));
+ scope = AST_Factory::narrow_from_decl (decl);
+ break;
+ default:
+ return 0;
+ }
+
+ if (scope != 0)
+ {
+ scope->call_add ();
+ }
+
+ i.next ();
+ }
+
+ return result;
+}
+
+// Private lookup mechanism.
+
+// For dealing with lookups of 'Object' and 'TypeCode'.
+AST_Decl *
+UTL_Scope::lookup_pseudo (Identifier *e)
+{
+ if (e->escaped ())
+ {
+ return 0;
+ }
+
+ Identifier *item_name = 0;
+ AST_Decl *d = 0;
+ UTL_ScopeActiveIterator *i = 0;
+ char *name_string = e->get_string ();
+ bool tc_lookup = false;
+ bool obj_lookup = false;
+ bool vb_lookup = false;
+
+ if (ACE_OS::strcasecmp (name_string, "Object") == 0)
+ {
+ obj_lookup = true;
+ }
+ else if (ACE_OS::strcasecmp (name_string, "ValueBase") == 0)
+ {
+ vb_lookup = true;
+ }
+
+ if (obj_lookup || vb_lookup)
+ {
+ // Iterate over the global scope.
+ ACE_NEW_RETURN (i,
+ UTL_ScopeActiveIterator (
+ idl_global->scopes ().bottom (),
+ UTL_Scope::IK_decls),
+ 0);
+ }
+ else if (ACE_OS::strcasecmp (name_string, "TypeCode") == 0
+ || ACE_OS::strcasecmp (name_string, "TCKind") == 0)
+ {
+ // Occurrences of "TypeCode" or TCKind in IDL files must be
+ // scoped with "CORBA" so we know we'll be in the CORBA module
+ // if we get this far, and we can use "this" for the scope of
+ // the iterator.
+ ACE_NEW_RETURN (i,
+ UTL_ScopeActiveIterator (this,
+ UTL_Scope::IK_decls),
+ 0);
+ tc_lookup = true;
+ }
+ else
+ {
+ return 0;
+ }
+
+ for (; !i->is_done (); i->next ())
+ {
+ d = i->item ();
+
+ item_name = d->local_name ();
+
+ if (e->case_compare (item_name))
+ {
+ delete i;
+
+ // These have to be located here because we are just looking
+ // up a scoped name - skip for imported nodes.
+ if (idl_global->in_main_file ())
+ {
+ if (tc_lookup)
+ {
+ // Generation of #includes for Typecode.h
+ // checks this bit, so we set it for TCKind as well.
+ idl_global->typecode_seen_ = true;
+ }
+ else if (obj_lookup)
+ {
+ idl_global->base_object_seen_ = true;
+ }
+ else if (vb_lookup)
+ {
+ idl_global->valuebase_seen_ = true;
+ }
+ }
+
+ return d;
+ }
+ }
+
+ if (tc_lookup)
+ {
+ d = this->look_in_previous (e);
+
+ if (d != 0)
+ {
+ // Generation of #includes for Typecode.h
+ // checks this bit, so we set it for TCKind as well.
+ idl_global->typecode_seen_ = true;
+ delete i;
+ return d;
+ }
+ }
+
+ delete i;
+ return 0;
+}
+
+AST_Decl *
+UTL_Scope::look_in_previous (Identifier *, bool /*ignore_fwd */)
+{
+ return 0;
+}
+
+// Lookup the node for a primitive (built in) type.
+AST_Decl *
+UTL_Scope::lookup_primitive_type (AST_Expression::ExprType et)
+{
+ AST_PredefinedType::PredefinedType pdt;
+
+ AST_Decl *as_decl = ScopeAsDecl (this);
+
+ if (as_decl == 0)
+ {
+ return 0;
+ }
+
+ UTL_Scope *ancestor = as_decl->defined_in ();
+
+ if (ancestor != 0)
+ {
+ return ancestor->lookup_primitive_type (et);
+ }
+
+ switch (et)
+ {
+ case AST_Expression::EV_short:
+ pdt = AST_PredefinedType::PT_short;
+ break;
+ case AST_Expression::EV_ushort:
+ pdt = AST_PredefinedType::PT_ushort;
+ break;
+ case AST_Expression::EV_long:
+ pdt = AST_PredefinedType::PT_long;
+ break;
+ case AST_Expression::EV_ulong:
+ pdt = AST_PredefinedType::PT_ulong;
+ break;
+ case AST_Expression::EV_longlong:
+ pdt = AST_PredefinedType::PT_longlong;
+ break;
+ case AST_Expression::EV_ulonglong:
+ pdt = AST_PredefinedType::PT_ulonglong;
+ break;
+ case AST_Expression::EV_float:
+ pdt = AST_PredefinedType::PT_float;
+ break;
+ case AST_Expression::EV_double:
+ pdt = AST_PredefinedType::PT_double;
+ break;
+ case AST_Expression::EV_longdouble:
+ pdt = AST_PredefinedType::PT_longdouble;
+ break;
+ case AST_Expression::EV_char:
+ pdt = AST_PredefinedType::PT_char;
+ break;
+ case AST_Expression::EV_wchar:
+ pdt = AST_PredefinedType::PT_wchar;
+ break;
+ case AST_Expression::EV_octet:
+ pdt = AST_PredefinedType::PT_octet;
+ break;
+ case AST_Expression::EV_bool:
+ pdt = AST_PredefinedType::PT_boolean;
+ break;
+ 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:
+ default:
+ return 0;
+ }
+
+ AST_PredefinedType *t = 0;
+
+ for (UTL_ScopeActiveIterator i (this, UTL_Scope::IK_decls);
+ !i.is_done();
+ i.next ())
+ {
+ as_decl = i.item ();
+
+ if (as_decl->node_type () == AST_Decl::NT_pre_defined)
+ {
+ t = AST_PredefinedType::narrow_from_decl (as_decl);
+
+ if (t == 0)
+ {
+ continue;
+ }
+
+ if (t->pt () == pdt)
+ {
+ if (idl_global->in_main_file ())
+ {
+ switch (pdt)
+ {
+ case AST_PredefinedType::PT_any:
+ idl_global->any_seen_ = true;
+ break;
+ case AST_PredefinedType::PT_object:
+ idl_global->base_object_seen_ = true;
+ break;
+ default:
+ break;
+ }
+ }
+
+ return t;
+ }
+ }
+ }
+
+ return 0;
+}
+
+// Look through inherited list. Overridden in AST_Interface.
+AST_Decl *
+UTL_Scope::look_in_inherited (UTL_ScopedName *,
+ bool )
+{
+ return 0;
+}
+
+// Look through supported interface list. Overridden where necessary.
+AST_Decl *
+UTL_Scope::look_in_supported (UTL_ScopedName *,
+ bool)
+{
+ return 0;
+}
+
+// Look up a String * in local scope only.
+AST_Decl *
+UTL_Scope::lookup_by_name_local (Identifier *e,
+ long index,
+ bool full_def_only)
+{
+ if (index > 0 && index == (long) this->nmembers ())
+ {
+ return 0;
+ }
+
+ AST_Type *t = 0;
+
+ // Will return 0 unless looking up 'Object' or 'TypeCode'.
+ AST_Decl *d = this->lookup_pseudo (e);
+
+ if (d != 0)
+ {
+ return d;
+ }
+
+ if (this->idl_keyword_clash (e) != 0)
+ {
+ return 0;
+ }
+
+ Identifier *item_name = 0;
+
+ bool in_corba =
+ ACE_OS::strcmp (e->get_string (), "CORBA") == 0;
+
+ // Iterate over this scope. We need IK_both here for the legacy
+ // case where a recursive type is defined via an anonymous sequence.
+ // Looking up the anonymous sequence parameter succeeds only if
+ // references are included, since the decl for the (unfinished)
+ // enclosing type has not yet been added to the scope decls.
+ for (UTL_ScopeActiveIterator i (this, UTL_Scope::IK_both);
+ !i.is_done ();
+ i.next ())
+ {
+ d = i.item ();
+
+ item_name = d->local_name ();
+
+ if (item_name == 0)
+ {
+ continue;
+ }
+
+ // Right now we populate the global scope with all the CORBA basic
+ // types, so something like 'ULong' in an IDL file will find a
+ // match, unless we skip over these items. This is a workaround until
+ // there's time to fix the code generation for CORBA basic types.
+ if (!in_corba
+ && ACE_OS::strcmp (d->name ()->head ()->get_string (), "CORBA") == 0)
+ {
+ continue;
+ }
+
+ if (e->case_compare (item_name))
+ {
+ if (index == 0)
+ {
+ 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
+ || nt == AST_Decl::NT_eventtype_fwd)
+ {
+ d = AST_InterfaceFwd::narrow_from_decl (d)->full_definition ();
+ }
+ else if (nt == AST_Decl::NT_struct_fwd
+ || nt == AST_Decl::NT_union_fwd)
+ {
+ d = AST_StructureFwd::narrow_from_decl (d)->full_definition ();
+ }
+
+ t = (0 == d ? 0 : AST_Type::narrow_from_decl (d));
+
+ if (0 != t && full_def_only && !t->is_defined ())
+ {
+ continue;
+ }
+
+ return d;
+ }
+ else
+ // If the index has been incremented, it means the identifier
+ // matched on a previous call to this function, but after
+ // returning, the rest of the scoped name didn't match. So we
+ // see if there's another matching identifier to the 'head' of
+ // the scoped name we're working with.
+ {
+ index--;
+ continue;
+ }
+ }
+ }
+
+ // OK, not found, check if this scope is a module, and if so,
+ // look in previous openings, if any.
+ AST_Decl *last_chance = ScopeAsDecl (this);
+
+ if (last_chance->node_type () == AST_Decl::NT_module)
+ {
+ // Check the result using the full_def_only constraint.
+ AST_Module *m = AST_Module::narrow_from_decl (last_chance);
+ d = m->look_in_previous (e);
+ t = (0 == d ? 0 : AST_Type::narrow_from_decl (d));
+
+ if (0 != t && full_def_only && !t->is_defined ())
+ {
+ return 0;
+ }
+
+ return d;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+// Implements lookup by name for scoped names.
+AST_Decl *
+UTL_Scope::lookup_by_name (UTL_ScopedName *e,
+ bool treat_as_ref,
+ bool in_parent,
+ bool full_def_only)
+{
+ AST_Decl *d = 0;
+ UTL_Scope *s = 0;
+ AST_Type *t = 0;
+
+ // Empty name? Error.
+ if (e == 0)
+ {
+ return 0;
+ }
+
+ // If name starts with "::" or "" start lookup in global scope.
+ if (is_global_name (e->head ()))
+ {
+ // Get parent scope.
+ d = ScopeAsDecl (this);
+
+ if (0 == d)
+ {
+ return 0;
+ }
+
+ s = d->defined_in ();
+
+ // If this is the global scope..
+ if (0 == s)
+ {
+ // Look up tail of name starting here.
+ d = lookup_by_name ((UTL_ScopedName *) e->tail (),
+ treat_as_ref,
+ in_parent,
+ full_def_only);
+
+ // Now return whatever we have.
+ return d;
+ }
+
+ // OK, not global scope yet, so simply iterate with parent scope.
+ d = s->lookup_by_name (e,
+ treat_as_ref,
+ in_parent,
+ full_def_only);
+
+ // If treat_as_ref is true and d is not NULL, add d to
+ // set of nodes referenced here.
+ if (treat_as_ref && d != 0)
+ {
+ add_to_referenced (d,
+ false,
+ 0);
+ }
+
+ // Now return what we have.
+ return d;
+ }
+
+ // The name does not start with "::"
+ // Is name defined here?
+ long index = 0;
+
+ while (true)
+ {
+ d = this->lookup_by_name_local (e->head (),
+ index,
+ full_def_only);
+
+ if (0 == d)
+ {
+ // A no-op unless d can inherit.
+ d = look_in_inherited (e, treat_as_ref);
+
+ if (0 == d)
+ {
+ // A no-op unless d can support interfaces.
+ d = look_in_supported (e, treat_as_ref);
+ }
+
+ if (0 == d && this->pd_scope_node_type == AST_Decl::NT_module)
+ {
+ // Check this result using the full_def_only constraint.
+ d = this->look_in_previous (e->head (), true);
+ t = (0 == d ? 0 : AST_Type::narrow_from_decl (d));
+
+ if (0 != t && full_def_only && !t->is_defined ())
+ {
+ d = 0;
+ }
+ }
+
+ if ((0 == d) && in_parent && idl_global->err_count () == 0)
+ {
+ // OK, not found. Go down parent scope chain.
+ d = ScopeAsDecl (this);
+
+ if (d != 0)
+ {
+ s = d->defined_in ();
+
+ if (0 == s)
+ {
+ d = 0;
+ }
+ else
+ {
+ d = s->lookup_by_name (e,
+ treat_as_ref,
+ in_parent,
+ full_def_only);
+ }
+ }
+ }
+
+ // If treat_as_ref is true and d is not NULL, add d to
+ // set of nodes referenced here.
+ if (treat_as_ref && d != 0)
+ {
+ t = AST_Type::narrow_from_decl (d);
+
+ // Are we a type, rather than an identifier?
+ if (t != 0)
+ {
+ // Are we defined in this scope or just referenced?
+ if (d->defined_in () == this)
+ {
+ UTL_Scope *ds = ScopeAsDecl (this)->defined_in ();
+
+ if (ds != 0)
+ {
+ AST_Decl *parent = ScopeAsDecl (ds);
+ 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)
+ {
+ ds->add_to_referenced (d,
+ false,
+ d->local_name ());
+
+ ds = parent->defined_in ();
+ parent = ScopeAsDecl (ds);
+ nt = parent->node_type ();
+ }
+ }
+ }
+ }
+ }
+
+ // OK, now return whatever we found.
+ return d;
+ }
+
+ // For the possible call to look_in_inherited() below.
+ s = DeclAsScope (d);
+
+ // OK, start of name is defined. Now loop doing local lookups
+ // of subsequent elements of the name, if any.
+ UTL_ScopedName *sn = (UTL_ScopedName *) e->tail ();
+
+ if (sn != 0)
+ {
+ d = iter_lookup_by_name_local (d,
+ sn,
+ 0,
+ full_def_only);
+ }
+
+ // If the start of the scoped name is an interface, and the
+ // above lookup failed, it's possible that what we're looking
+ // up was inherited into that interface. The first call to
+ // look_in_inherited() is this function only checks base classes
+ // of the scope (interface) we started the lookup from.
+ if (d == 0)
+ {
+ d = s->look_in_inherited (sn, treat_as_ref);
+ }
+
+ // If treat_as_ref is true and d is not 0, add d to
+ // set of nodes referenced here.
+ if (treat_as_ref && d != 0)
+ {
+ add_to_referenced (d,
+ false,
+ 0);
+ }
+
+ // All OK, name fully resolved.
+ if (d != 0)
+ {
+ return d;
+ }
+ else
+ {
+ index++;
+ }
+ }
+}
+
+// Add a node to set of nodes referenced in this scope.
+void
+UTL_Scope::add_to_referenced (AST_Decl *e,
+ bool recursive,
+ Identifier *id,
+ AST_Decl *ex)
+{
+ UTL_Scope *s = 0;
+ AST_Decl **tmp;
+ AST_Interface *itf = 0;
+ long oreferenced_allocated;
+ long i;
+
+ if (e == 0)
+ {
+ return;
+ }
+
+ AST_Decl::NodeType nt = e->node_type ();
+
+ // Special case for forward declared interfaces in the
+ // scope in which they're defined. Cannot add before full
+ // definition is seen.
+ if (nt == AST_Decl::NT_interface || nt == AST_Decl::NT_component)
+ {
+ itf = AST_Interface::narrow_from_decl (e);
+
+ if (itf != 0
+ && itf->defined_in () == this
+ && !itf->is_defined ())
+ {
+ return;
+ }
+ }
+
+ // Only insert if it is not there already.
+ if (this->referenced (e, id))
+ {
+ return;
+ }
+
+ // Sets the appropriate *_seen_ flag for future use.
+ this->check_for_predef_seq (e);
+
+ // Make sure there's space for one more decl.
+ if (this->pd_referenced_allocated == this->pd_referenced_used)
+ {
+ oreferenced_allocated = this->pd_referenced_allocated;
+ pd_referenced_allocated += INCREMENT;
+
+ ACE_NEW (tmp,
+ AST_Decl *[this->pd_referenced_allocated]);
+
+ for (i = 0; i < oreferenced_allocated; i++)
+ {
+ tmp[i] = this->pd_referenced[i];
+ }
+
+ delete [] this->pd_referenced;
+ this->pd_referenced = tmp;
+ }
+
+ // Insert new reference.
+ if (ex == 0)
+ {
+ this->pd_referenced[this->pd_referenced_used++] = e;
+ }
+ else if (this->referenced (ex))
+ {
+ for (i = this->pd_referenced_used; i > 0; i--)
+ {
+ this->pd_referenced[i] = this->pd_referenced[i - 1];
+
+ if (this->pd_referenced[i - 1] == ex)
+ {
+ this->pd_referenced[i] = e;
+ break;
+ }
+ }
+
+ if (this->pd_referenced_used > 0)
+ {
+ ++this->pd_referenced_used;
+ }
+ }
+
+ // Now, if recursive is specified and "this" is not a common ancestor
+ // of the referencing scope and the scope of definition of "e" then
+ // add "e" to the set of referenced nodes in the parent of "this".
+ if (recursive && !(e->has_ancestor (ScopeAsDecl (this))))
+ {
+ s = e->defined_in ();
+
+ if (s != 0)
+ {
+ s->add_to_referenced (e,
+ recursive,
+ id);
+ }
+ }
+
+ // Add the identifier arg, if non-null, to the identifier list.
+ if (id)
+ {
+ this->add_to_name_referenced (id);
+ }
+}
+
+void
+UTL_Scope::add_to_name_referenced (Identifier *id)
+{
+ // Make sure we have enough space.
+ if (this->pd_name_referenced_allocated == this->pd_name_referenced_used)
+ {
+ long name_referenced_allocated = this->pd_name_referenced_allocated;
+ pd_name_referenced_allocated += INCREMENT;
+
+ Identifier **name_tmp = 0;
+ ACE_NEW (name_tmp,
+ Identifier *[this->pd_name_referenced_allocated]);
+
+ for (long i = 0; i < name_referenced_allocated; i++)
+ {
+ name_tmp[i] = this->pd_name_referenced[i];
+ }
+
+ delete [] this->pd_name_referenced;
+
+ this->pd_name_referenced = name_tmp;
+ }
+
+ // Insert new identifier.
+ this->pd_name_referenced[this->pd_name_referenced_used++] = id->copy ();
+}
+
+void
+UTL_Scope::replace_referenced (AST_Decl *old_decl,
+ AST_Decl *new_decl)
+{
+ for (int i = 0; i < this->pd_referenced_used; i++)
+ {
+ if (this->pd_referenced[i] == old_decl)
+ {
+ this->pd_referenced[i] = new_decl;
+ break;
+ }
+ }
+
+}
+
+
+void
+UTL_Scope::replace_scope (AST_Decl *old_decl,
+ AST_Decl *new_decl)
+{
+ for (int i = 0; i < pd_decls_used; i++)
+ {
+ if (this->pd_decls[i] == old_decl)
+ {
+ this->pd_decls[i] = new_decl;
+ break;
+ }
+ }
+
+}
+
+
+// Add a node to set of nodes declared in this scope.
+void
+UTL_Scope::add_to_scope (AST_Decl *e,
+ AST_Decl *ex)
+{
+ if (e == 0)
+ {
+ return;
+ }
+
+ 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 ();
+
+ Identifier *ref_name = 0;
+ char *ref_string = 0;
+
+ // First, make sure there's no clash between e, that was
+ // just declared, and some other identifier referenced
+ // in this scope.
+ for (; i > 0; --i, ++tmp)
+ {
+ // 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 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 new_nt = e->node_type ();
+ AST_Decl::NodeType scope_elem_nt = (*tmp)->node_type ();
+
+ if (decl_name->compare (ref_name) == true
+ && this->redef_clash (new_nt, scope_elem_nt) == true)
+ {
+ idl_global->err ()->redef_error (decl_string,
+ ref_string);
+
+ // if we try to continue from here, we risk a crash.
+ throw FE_Bailout ();
+ }
+ // If the spellings differ only by case, it's also an error,
+ // unless one, but not both of the identifiers were escaped.
+ else if (decl_name->case_compare_quiet (ref_name) == true
+ && !(decl_name->escaped () ^ ref_name->escaped ()))
+ {
+ if (idl_global->case_diff_error ())
+ {
+ idl_global->err ()->name_case_error (decl_string,
+ ref_string);
+
+
+ // if we try to continue from here, we risk a crash.
+ throw FE_Bailout ();
+ }
+ else
+ {
+ idl_global->err ()->name_case_warning (decl_string,
+ ref_string);
+ }
+ }
+ }
+
+ AST_Decl *d = ScopeAsDecl (this);
+ AST_Decl::NodeType nt = d->node_type ();
+
+ // The name of any scope except the unnamed scope formed by an operation
+ // may not be redefined immediately within (and the root scope has no name).
+ // As well as OBV factory construct.
+ if (nt != AST_Decl::NT_root
+ && nt != AST_Decl::NT_op
+ && nt != AST_Decl::NT_factory)
+ {
+ Identifier *parent_name = d->local_name ();
+
+ if (decl_name->compare (parent_name) == true)
+ {
+ idl_global->err ()->redef_error (
+ decl_name->get_string (),
+ parent_name->get_string ()
+ );
+
+ // if we try to continue from here, we risk a crash.
+ throw FE_Bailout ();
+ }
+ else if (decl_name->case_compare_quiet (parent_name) == true)
+ {
+ if (idl_global->case_diff_error ())
+ {
+ idl_global->err ()->name_case_error (
+ decl_name->get_string (),
+ parent_name->get_string ()
+ );
+
+ // if we try to continue from here, we risk a crash.
+ throw FE_Bailout ();
+ }
+ else
+ {
+ idl_global->err ()->name_case_warning (
+ decl_name->get_string (),
+ parent_name->get_string ()
+ );
+ }
+ }
+ }
+
+ // Now make sure there's space for one more.
+ if (this->pd_decls_allocated == this->pd_decls_used)
+ {
+ long odecls_allocated = this->pd_decls_allocated;
+ this->pd_decls_allocated += INCREMENT;
+
+ ACE_NEW (tmp,
+ AST_Decl *[pd_decls_allocated]);
+
+ for (i = 0; i < odecls_allocated; i++)
+ {
+ tmp[i] = this->pd_decls[i];
+ }
+
+ delete [] this->pd_decls;
+
+ this->pd_decls = tmp;
+ }
+
+
+ // Insert new decl.
+ if (ex == 0)
+ {
+ this->pd_decls[this->pd_decls_used++] = e;
+ }
+ else
+ {
+ for (i = this->pd_decls_used; i > 0; i--)
+ {
+ this->pd_decls[i] = this->pd_decls[i - 1];
+
+ if (this->pd_decls[i - 1] == ex)
+ {
+ this->pd_decls[i] = e;
+ break;
+ }
+ }
+
+ ++this->pd_decls_used;
+ }
+}
+
+// Add a node to set of nodes representing manifest
+// types defined in this scope.
+void
+UTL_Scope::add_to_local_types (AST_Decl *e)
+{
+ if (e == 0)
+ {
+ return;
+ }
+
+ // Make sure there's space for one more.
+ if (this->pd_locals_allocated == this->pd_locals_used)
+ {
+ long olocals_allocated = pd_locals_allocated;
+ pd_locals_allocated += INCREMENT;
+
+ AST_Decl **tmp = 0;
+ ACE_NEW (tmp,
+ AST_Decl *[this->pd_locals_allocated]);
+
+ for (long i = 0; i < olocals_allocated; i++)
+ {
+ tmp[i] = this->pd_local_types[i];
+ }
+
+ delete [] this->pd_local_types;
+
+ this->pd_local_types = tmp;
+ }
+
+ // Insert new decl.
+ this->pd_local_types[this->pd_locals_used++] = e;
+}
+
+// Has this node been referenced here before?
+bool
+UTL_Scope::referenced (AST_Decl *e,
+ Identifier *id)
+{
+ long i = pd_referenced_used;
+ AST_Decl **tmp = pd_referenced;
+ Identifier *member = 0;
+ Identifier *test = 0;
+
+ for (; i > 0; i--, tmp++)
+ {
+ // Same node?
+ if (*tmp == e)
+ {
+ return true;
+ }
+
+ // Are we definging a forward declared struct, union, or interface,
+ // or reopening a module?
+ bool forward_redef = this->redef_clash (e->node_type (),
+ (*tmp)->node_type ());
+
+ if (forward_redef == false)
+ {
+ member = (*tmp)->local_name ();
+ test = e->local_name ();
+
+ if (member->compare (test) == true)
+ {
+ return false;
+ }
+ }
+ }
+
+ // pd_referenced is a list of decls, and so there's no
+ // way of telling how much of its scoped name was used
+ // when it was referenced in this scope. pd_name_referenced
+ // is a list of Identifiers that store the identifier (or
+ // the first segment of a scoped name) used in the reference,
+ // so we can catch these name reolution clashes.
+ if (id)
+ {
+ long j = pd_name_referenced_used;
+ Identifier **name_tmp = pd_name_referenced;
+
+ for (; j > 0; j--, name_tmp++)
+ {
+ // If we are a module, there is no clash, if we
+ // are an interface, this is not the right place to
+ // catch a clash, and if it wasn't defined in this
+ // scope, then it's a type name for something else
+ // that was, and it can appear any number of times
+ // in this scope without a clash.
+ if (id->compare (*name_tmp) == true
+ && e->node_type () != AST_Decl::NT_module
+ && e->defined_in () == this)
+ {
+ idl_global->err ()->redef_error (id->get_string (),
+ (*name_tmp)->get_string ());
+
+ return true;
+ }
+ // No clash if one or the other of the identifiers was escaped.
+ else if (id->case_compare_quiet (*name_tmp) == true
+ && !(id->escaped () ^ (*name_tmp)->escaped ()))
+ {
+ if (idl_global->case_diff_error ())
+ {
+ idl_global->err ()->name_case_error (
+ id->get_string (),
+ (*name_tmp)->get_string ()
+ );
+ }
+ else
+ {
+ idl_global->err ()->name_case_warning (
+ id->get_string (),
+ (*name_tmp)->get_string ()
+ );
+ }
+
+ return true;
+ }
+ }
+ }
+
+ // Not found
+ return false;
+}
+
+bool
+UTL_Scope::has_prefix (void)
+{
+ return this->has_prefix_;
+}
+
+void
+UTL_Scope::has_prefix (bool val)
+{
+ this->has_prefix_ = val;
+}
+
+// Redefinition of inherited virtual operations.
+
+// AST Dumping.
+void
+UTL_Scope::dump (ACE_OSTREAM_TYPE &o)
+{
+ AST_Decl *d = 0;
+
+ if (idl_global->indent () == 0)
+ {
+ UTL_Indenter *idnt = 0;
+ ACE_NEW (idnt,
+ UTL_Indenter);
+
+ idl_global->set_indent (idnt);
+ }
+
+ idl_global->indent ()->increase ();
+
+ if (pd_locals_used > 0)
+ {
+ o << ("\n/* Locally defined types: */\n");
+
+ for (UTL_ScopeActiveIterator i (this, UTL_Scope::IK_localtypes);
+ !i.is_done ();
+ i.next ())
+ {
+ d = i.item ();
+
+ if (!d->imported ())
+ {
+ idl_global->indent ()->skip_to (o);
+ d->dump (o);
+ o << "\n";
+ }
+ }
+ }
+
+ if (pd_decls_used > 0)
+ {
+ o << ACE_TEXT ("\n/* Declarations: */\n");
+
+ for (UTL_ScopeActiveIterator j (this, UTL_Scope::IK_decls);
+ !j.is_done ();
+ j.next ())
+ {
+ d = j.item ();
+
+ if (!d->imported ())
+ {
+ idl_global->indent ()->skip_to (o);
+ d->dump (o);
+ o << ";\n";
+ }
+ }
+ }
+
+ idl_global->indent ()->decrease ();
+}
+
+int
+UTL_Scope::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_scope (this);
+}
+
+// How many entries are defined?
+unsigned long
+UTL_Scope::nmembers (void)
+{
+ return this->pd_decls_used;
+}
+
+void
+UTL_Scope::destroy (void)
+{
+ for (UTL_ScopeActiveIterator iter (this, IK_both);
+ !iter.is_done ();
+ iter.next ())
+ {
+ AST_Decl *d = iter.item ();
+ d->destroy ();
+ delete d;
+ d = 0;
+ }
+
+ delete [] this->pd_decls;
+ this->pd_decls = 0;
+ this->pd_decls_used = 0;
+ this->pd_locals_used = 0;
+
+ for (long i = this->pd_name_referenced_used; i > 0; --i)
+ {
+ Identifier *id = this->pd_name_referenced[i - 1];
+ id->destroy ();
+ delete id;
+ id = 0;
+ }
+
+ delete [] this->pd_name_referenced;
+ this->pd_name_referenced = 0;
+ this->pd_name_referenced_allocated = 0;
+ this->pd_name_referenced_used = 0;
+
+ delete [] this->pd_local_types;
+ this->pd_local_types = 0;
+ this->pd_locals_allocated = 0;
+ this->pd_locals_used = 0;
+
+ delete [] this->pd_referenced;
+ this->pd_referenced = 0;
+ this->pd_referenced_allocated = 0;
+ this->pd_referenced_used = 0;
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS0(UTL_Scope)
+IMPL_NARROW_FROM_SCOPE(UTL_Scope)
+
+// UTL_SCOPE_ACTIVE_ITERATOR
+
+// Constructor.
+UTL_ScopeActiveIterator::UTL_ScopeActiveIterator (
+ UTL_Scope *s,
+ UTL_Scope::ScopeIterationKind i
+ )
+ : iter_source (s),
+ ik (i),
+ stage (i == UTL_Scope::IK_both ? UTL_Scope::IK_localtypes : i),
+ il (0)
+{
+}
+
+// Public operations.
+
+// Advance to next item.
+void
+UTL_ScopeActiveIterator::next (void)
+{
+ this->il++;
+}
+
+// Get current item.
+AST_Decl *
+UTL_ScopeActiveIterator::item (void)
+{
+ if (this->is_done ())
+ {
+ return 0;
+ }
+
+ if (stage == UTL_Scope::IK_decls)
+ {
+ return this->iter_source->pd_decls[il];
+ }
+
+ if (stage == UTL_Scope::IK_localtypes)
+ {
+ return this->iter_source->pd_local_types[il];
+ }
+
+ return 0;
+}
+
+// Is this iteration done?
+bool
+UTL_ScopeActiveIterator::is_done (void)
+{
+ long limit =
+ (stage == UTL_Scope::IK_decls)
+ ? iter_source->pd_decls_used
+ : iter_source->pd_locals_used;
+
+ for (;;)
+ {
+ // Last element?
+ if (this->il < limit)
+ {
+ return false;
+ }
+
+ // Only want decls?
+ if (this->stage == UTL_Scope::IK_decls)
+ {
+ return true;
+ }
+
+ // Already done local types?
+ if (this->ik == UTL_Scope::IK_localtypes)
+ {
+ return true;
+ }
+
+ // Switch to next stage.
+ this->stage = UTL_Scope::IK_decls;
+ this->il = 0;
+ limit = this->iter_source->pd_decls_used;
+ }
+}
+
+// What kind of iterator is this?
+UTL_Scope::ScopeIterationKind
+UTL_ScopeActiveIterator::iteration_kind (void)
+{
+ return this->ik;
+}
+
+// And where are we in the iteration?
+UTL_Scope::ScopeIterationKind
+UTL_ScopeActiveIterator::iteration_stage (void)
+{
+ return this->stage;
+}
diff --git a/TAO/TAO_IDL/util/utl_stack.cpp b/TAO/TAO_IDL/util/utl_stack.cpp
new file mode 100644
index 00000000000..71877c2b695
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_stack.cpp
@@ -0,0 +1,255 @@
+// $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.
+
+*/
+
+#include "utl_stack.h"
+#include "utl_scope.h"
+#include "global_extern.h"
+
+ACE_RCSID (util,
+ utl_stack,
+ "$Id$")
+
+#undef INCREMENT
+#define INCREMENT 64
+
+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 (void)
+{
+ if (this->pd_stack_data != 0)
+ {
+ delete [] this->pd_stack_data;
+ }
+}
+
+// Push an element on the stack.
+UTL_ScopeStack *
+UTL_ScopeStack::push (UTL_Scope *el)
+{
+ UTL_Scope **tmp = 0;
+ long ostack_data_nalloced;
+ long i;
+
+ // 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;
+ this->pd_stack_data_nalloced += INCREMENT;
+
+ ACE_NEW_RETURN (tmp,
+ UTL_Scope *[this->pd_stack_data_nalloced],
+ 0);
+
+ for (i = 0; i < ostack_data_nalloced; ++i)
+ {
+ tmp[i] = this->pd_stack_data[i];
+ }
+
+ delete [] this->pd_stack_data;
+ this->pd_stack_data = tmp;
+ }
+
+ // Insert new scope.
+ this->pd_stack_data[this->pd_stack_top++] = el;
+
+ return this;
+}
+
+// Pop an element from the stack.
+void
+UTL_ScopeStack::pop (void)
+{
+ if (this->pd_stack_top <= 0)
+ {
+ return;
+ }
+
+ // If our top scope has a #pragma prefix associated with it,
+ // it goes away with the scope.
+ if (this->top_non_null ()->has_prefix ())
+ {
+ char *trash = 0;
+ idl_global->pragma_prefixes ().pop (trash);
+ delete [] trash;
+ }
+
+ --this->pd_stack_top;
+}
+
+// Return top element on stack.
+UTL_Scope *
+UTL_ScopeStack::top (void)
+{
+ if (this->pd_stack_top <= 0)
+ {
+ return 0;
+ }
+
+ return this->pd_stack_data[pd_stack_top - 1];
+}
+
+// Return bottom element on stack.
+UTL_Scope *
+UTL_ScopeStack::bottom (void)
+{
+ if (this->pd_stack_top == 0)
+ {
+ return 0;
+ }
+
+ return this->pd_stack_data[0];
+}
+
+// Clear entire stack.
+void
+UTL_ScopeStack::clear (void)
+{
+ this->pd_stack_top = 0;
+}
+
+// How deep is the stack?
+unsigned long
+UTL_ScopeStack::depth (void)
+{
+ return this->pd_stack_top;
+}
+
+// Return (top - 1) element on stack.
+UTL_Scope *
+UTL_ScopeStack::next_to_top (void)
+{
+ UTL_Scope *tmp, *retval;
+
+ 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
+ return retval; // Return next one down
+}
+
+// Return topmost non-NULL element.
+UTL_Scope *
+UTL_ScopeStack::top_non_null (void)
+{
+ for (long i = this->pd_stack_top - 1; i >= 0; --i)
+ {
+ if (this->pd_stack_data[i] != 0)
+ {
+ return this->pd_stack_data[i];
+ }
+ }
+
+ return 0;
+}
+
+UTL_ScopeStackActiveIterator::UTL_ScopeStackActiveIterator (UTL_ScopeStack &s)
+ : source (s),
+ il (s.pd_stack_top - 1)
+{
+}
+
+// Advance to next item
+void
+UTL_ScopeStackActiveIterator::next (void)
+{
+ il--;
+}
+
+// Get current item.
+UTL_Scope *
+UTL_ScopeStackActiveIterator::item (void)
+{
+ if (this->il >= 0)
+ {
+ return this->source.pd_stack_data[il];
+ }
+
+ return 0;
+}
+
+// Is this iteration done?
+long
+UTL_ScopeStackActiveIterator::is_done (void)
+{
+ if (this->il >= 0)
+ {
+ return false;
+ }
+
+ return true;
+}
+
diff --git a/TAO/TAO_IDL/util/utl_string.cpp b/TAO/TAO_IDL/util/utl_string.cpp
new file mode 100644
index 00000000000..bb12f2001f3
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_string.cpp
@@ -0,0 +1,271 @@
+// $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.
+
+*/
+
+#include "utl_string.h"
+#include "global_extern.h"
+#include "fe_extern.h"
+#include "utl_err.h"
+
+// FUZZ: disable check_for_streams_include
+#include "ace/streams.h"
+
+#include "ace/OS_NS_ctype.h"
+
+ACE_RCSID (util,
+ utl_string,
+ "$Id$")
+
+UTL_String::UTL_String (void)
+ : p_str (0),
+ c_str (0),
+ len (0)
+{
+}
+
+UTL_String::UTL_String (const char *str)
+{
+ if (str == 0)
+ {
+ this->len = 0;
+ this->p_str = 0;
+ this->c_str = 0;
+ }
+ else
+ {
+ this->len = ACE_OS::strlen (str);
+ this->p_str = ACE::strnew (str);
+ this->c_str = (char *) ACE_OS::malloc (this->len + 1);
+ this->canonicalize ();
+ }
+}
+
+UTL_String::UTL_String (UTL_String *s)
+{
+ if (s == 0)
+ {
+ this->p_str = 0;
+ this->c_str = 0;
+ this->len = 0;
+ }
+ else
+ {
+ char *b = s->get_string ();
+
+ if (b == 0)
+ {
+ this->p_str = 0;
+ this->c_str = 0;
+ this->len = 0;
+ }
+ else
+ {
+ this->len = ACE_OS::strlen (b);
+ this->p_str = ACE::strnew (b);
+ this->c_str = (char *) ACE_OS::malloc (this->len + 1);
+ this->canonicalize ();
+ }
+ }
+}
+
+UTL_String::~UTL_String (void)
+{
+}
+
+// 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.
+void
+UTL_String::canonicalize (void)
+{
+ for (size_t i = 0; i < this->len; ++i)
+ {
+ if (ACE_OS::ace_isalpha (this->p_str[i]))
+ {
+ this->c_str[i] = (char) ACE_OS::ace_toupper (this->p_str[i]);
+ }
+ else
+ {
+ this->c_str[i] = this->p_str[i];
+ }
+ }
+
+ c_str[this->len] = '\0';
+}
+
+// Compare two UTL_String *.
+bool
+UTL_String::compare (UTL_String *s)
+{
+ char *s_c_str = 0;
+ bool result;
+
+ if (this->c_str == 0
+ || s == 0
+ || (s_c_str = s->get_canonical_rep ()) == 0)
+ {
+ result = false;
+ }
+ else
+ {
+ result =
+ (ACE_OS::strcmp (this->c_str, s_c_str) == 0) ? true : false;
+ }
+
+ // Check that the names are typed consistently.
+ if (result == true
+ && ACE_OS::strcmp (this->p_str, s->get_string ()) != 0)
+ {
+ // Prevents redundant error reporting if we're in this branch.
+ result = false;
+
+ if (idl_global->case_diff_error ())
+ {
+ idl_global->err ()->name_case_error (this->p_str,
+ s->get_string ());
+
+ // If we try to continue from here, we risk a crash.
+ throw FE_Bailout ();
+ }
+ else
+ {
+ idl_global->err ()->name_case_warning (this->p_str,
+ s->get_string ());
+ }
+ }
+
+ return result;
+}
+
+bool
+UTL_String::compare_quiet (UTL_String *s)
+{
+ char *s_c_str = 0;
+ bool result;
+
+ if (this->c_str == 0
+ || s == 0
+ || (s_c_str = s->get_canonical_rep ()) == 0)
+ {
+ result = false;
+ }
+ else if (ACE_OS::strcmp (this->c_str, s_c_str) != 0)
+ {
+ result = false;
+ }
+ else if (ACE_OS::strcmp (this->p_str, s->get_string ()) != 0)
+ {
+ result = true;
+ }
+ else
+ {
+ result = false;
+ }
+
+ return result;
+}
+
+void
+UTL_String::destroy (void)
+{
+ if (this->p_str != 0)
+ {
+ ACE::strdelete (this->p_str);
+ this->p_str = 0;
+ }
+
+ if (this->c_str != 0)
+ {
+ ACE_OS::free (this->c_str);
+ this->c_str = 0;
+ }
+}
+
+// Get the char * from a String.
+char *
+UTL_String::get_string (void)
+{
+ return this->p_str;
+}
+
+// Get the canonical representation from a String.
+char *
+UTL_String::get_canonical_rep (void)
+{
+ if (this->c_str == 0)
+ {
+ this->c_str = (char *) ACE_OS::malloc (this->len + 1);
+ this->canonicalize ();
+ }
+
+ return this->c_str;
+}
+
+// AST Dumping.
+void
+UTL_String::dump (ACE_OSTREAM_TYPE &o)
+{
+ o << this->p_str;
+}
diff --git a/TAO/TAO_IDL/util/utl_strlist.cpp b/TAO/TAO_IDL/util/utl_strlist.cpp
new file mode 100644
index 00000000000..004c415fd5f
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_strlist.cpp
@@ -0,0 +1,236 @@
+// $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.
+
+*/
+
+// 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.
+
+#include "utl_strlist.h"
+#include "utl_string.h"
+
+// FUZZ: disable check_for_streams_include
+#include "ace/streams.h"
+
+#include "ace/OS_Memory.h"
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (util,
+ utl_strlist,
+ "$Id$")
+
+UTL_StrList::UTL_StrList (UTL_String *s,
+ UTL_StrList *cdr)
+ : UTL_List(cdr),
+ pd_car_data(s)
+{
+}
+
+UTL_StrList::~UTL_StrList (void)
+{
+}
+
+// Get list item.
+UTL_String *
+UTL_StrList::head (void)
+{
+ return this->pd_car_data;
+}
+
+// Set list item.
+void
+UTL_StrList::set_head (UTL_String *s)
+{
+ this->pd_car_data = s;
+}
+
+// Get last item of this list
+UTL_String *
+UTL_StrList::last_component (void)
+{
+ if (this->tail () == 0)
+ {
+ return pd_car_data;
+ }
+
+ return ((UTL_StrList *) this->tail ())->last_component();
+}
+
+// Copy a list.
+UTL_List *
+UTL_StrList::copy (void)
+{
+ 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;
+
+ for (UTL_StrlistActiveIterator i (this); !i.is_done (); i.next ())
+ {
+ str = i.item ();
+ str->destroy ();
+ delete str;
+ str = 0;
+ }
+}
+
+// AST Dumping
+void
+UTL_StrList::dump (ACE_OSTREAM_TYPE &o)
+{
+ char *s = 0;
+ bool first = true;
+ bool second = false;
+
+ for (UTL_StrlistActiveIterator i (this); !i.is_done(); i.next ())
+ {
+ if (!first)
+ {
+ o << "::";
+ }
+ else if (second)
+ {
+ first = second = false;
+ }
+
+ s = i.item ()->get_string ();
+ o << s;
+
+ if (first)
+ {
+ if (ACE_OS::strcmp (s, "::") != 0)
+ {
+ first = false;
+ }
+ else
+ {
+ second = true;
+ }
+ }
+ }
+}
+
+/*
+ * Redefinition of inherited virtual operations
+ */
+
+// UTL_StrList active iterator
+
+/*
+ * Constructor
+ */
+
+UTL_StrlistActiveIterator::UTL_StrlistActiveIterator (UTL_StrList *s)
+ : UTL_ListActiveIterator (s)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Get current item
+UTL_String *
+UTL_StrlistActiveIterator::item (void)
+{
+ if (source == 0)
+ {
+ return 0;
+ }
+
+ return ((UTL_StrList *) source)->head ();
+}
+
+/*
+ * Redefinition of inherited virtual operations
+ */
diff --git a/TAO/TAO_IDL/util/utl_tmpl/utl_decllist.cpp b/TAO/TAO_IDL/util/utl_tmpl/utl_decllist.cpp
new file mode 100644
index 00000000000..33aeef85a89
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_tmpl/utl_decllist.cpp
@@ -0,0 +1,107 @@
+// $Id$
+
+/*
+ *======================================================================
+ *
+ *Copyright 1992 Sun Microsystems, Inc.
+ *
+ *The Interface Definition Language Compiler Front End (CFE) is made
+ *available for use provided that this legend is included on all media and
+ *documentation and as a part of the software program in whole or part.
+ *Users may copy and extend functionality (but may not remove
+ *functionality) of the Interface Definition Language CFE without charge,
+ *but are not authorized to license or distribute it to anyone else except
+ *as part of a product or program developed by the user or with the express
+ *written consent of Sun Microsystems, Inc.
+ *
+ *The names of Sun Microsystems, Inc. and any of its subsidiaries may not
+ *be used in advertising or publicity pertaining to distribution of
+ *Interface Definition Language CFE as permitted herein.
+ *
+ *The Interface Definition Language CFE may not be exported outside the
+ *United States without first obtaining the appropriate government
+ *approvals.
+ *
+ *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 Microsystems, Inc. or any of
+ *its subsidiaries or affiliates to assist in its use, correction,
+ *modification or enhancement.
+ *
+ *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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.
+ *
+ *SunSoft, Inc.
+ *2550 Garcia Avenue
+ *Mountain View, California 94043
+ *
+ *
+ *
+ *
+ *======================================================================
+ */
+
+// utl_decllist.cc
+//
+// Implementation of a list of declarators
+
+#include <idl.hh>
+#include <idl_extern.hh>
+
+ACE_RCSID(utl_tmpl, utl_decllist, "$Id$")
+
+/*
+ * Constructor(s)
+ */
+
+UTL_DeclList::UTL_DeclList(FE_Declarator *s, UTL_DeclList *cdr)
+ : UTL_List<UTL_DeclList, FE_Declarator>(s, cdr)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+/*
+ * Redefinition of inherited virtual operations
+ */
+
+// UTL_DeclList active iterator
+
+/*
+ * Constructor
+ */
+
+UTL_DecllistActiveIterator::UTL_DecllistActiveIterator(UTL_DeclList *s)
+ : UTL_ListActiveIterator<UTL_DeclList, FE_Declarator>(s)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+/*
+ * Redefined inherited operations
+ */
+
diff --git a/TAO/TAO_IDL/util/utl_tmpl/utl_exceptlist.cpp b/TAO/TAO_IDL/util/utl_tmpl/utl_exceptlist.cpp
new file mode 100644
index 00000000000..357e9fccc0d
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_tmpl/utl_exceptlist.cpp
@@ -0,0 +1,106 @@
+// $Id$
+
+/*
+ *======================================================================
+ *
+ *Copyright 1992 Sun Microsystems, Inc.
+ *
+ *The Interface Definition Language Compiler Front End (CFE) is made
+ *available for use provided that this legend is included on all media and
+ *documentation and as a part of the software program in whole or part.
+ *Users may copy and extend functionality (but may not remove
+ *functionality) of the Interface Definition Language CFE without charge,
+ *but are not authorized to license or distribute it to anyone else except
+ *as part of a product or program developed by the user or with the express
+ *written consent of Sun Microsystems, Inc.
+ *
+ *The names of Sun Microsystems, Inc. and any of its subsidiaries may not
+ *be used in advertising or publicity pertaining to distribution of
+ *Interface Definition Language CFE as permitted herein.
+ *
+ *The Interface Definition Language CFE may not be exported outside the
+ *United States without first obtaining the appropriate government
+ *approvals.
+ *
+ *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 Microsystems, Inc. or any of
+ *its subsidiaries or affiliates to assist in its use, correction,
+ *modification or enhancement.
+ *
+ *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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.
+ *
+ *SunSoft, Inc.
+ *2550 Garcia Avenue
+ *Mountain View, California 94043
+ *
+ *
+ *
+ *
+ *======================================================================
+ */
+
+// utl_exceptlist.cc
+//
+// Implementation of a list of exceptions
+
+#include <idl.hh>
+#include <idl_extern.hh>
+
+ACE_RCSID(utl_tmpl, utl_exceptlist, "$Id$")
+
+/*
+ * Constructor(s)
+ */
+
+UTL_ExceptList::UTL_ExceptList(AST_Exception *s, UTL_ExceptList *cdr)
+ : UTL_List<UTL_ExceptList, AST_Exception>(s, cdr)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+/*
+ * Redefinition of inherited virtual operations
+ */
+
+// UTL_ExceptList active iterator
+
+/*
+ * Constructor
+ */
+
+UTL_ExceptlistActiveIterator::UTL_ExceptlistActiveIterator(UTL_ExceptList *s)
+ : UTL_ListActiveIterator<UTL_ExceptList, AST_Exception>(s)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+/*
+ * Redefinition of inherited virtual operations
+ */
diff --git a/TAO/TAO_IDL/util/utl_tmpl/utl_exprlist.cpp b/TAO/TAO_IDL/util/utl_tmpl/utl_exprlist.cpp
new file mode 100644
index 00000000000..d09348c5e65
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_tmpl/utl_exprlist.cpp
@@ -0,0 +1,106 @@
+// $Id$
+
+/*
+ *======================================================================
+ *
+ *Copyright 1992 Sun Microsystems, Inc.
+ *
+ *The Interface Definition Language Compiler Front End (CFE) is made
+ *available for use provided that this legend is included on all media and
+ *documentation and as a part of the software program in whole or part.
+ *Users may copy and extend functionality (but may not remove
+ *functionality) of the Interface Definition Language CFE without charge,
+ *but are not authorized to license or distribute it to anyone else except
+ *as part of a product or program developed by the user or with the express
+ *written consent of Sun Microsystems, Inc.
+ *
+ *The names of Sun Microsystems, Inc. and any of its subsidiaries may not
+ *be used in advertising or publicity pertaining to distribution of
+ *Interface Definition Language CFE as permitted herein.
+ *
+ *The Interface Definition Language CFE may not be exported outside the
+ *United States without first obtaining the appropriate government
+ *approvals.
+ *
+ *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 Microsystems, Inc. or any of
+ *its subsidiaries or affiliates to assist in its use, correction,
+ *modification or enhancement.
+ *
+ *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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.
+ *
+ *SunSoft, Inc.
+ *2550 Garcia Avenue
+ *Mountain View, California 94043
+ *
+ *
+ *
+ *
+ *======================================================================
+ */
+
+// utl_exprlist.cc
+//
+// Implementation of a list of strings
+
+#include <idl.hh>
+#include <idl_extern.hh>
+
+ACE_RCSID(utl_tmpl, utl_exprlist, "$Id$")
+
+/*
+ * Constructor(s)
+ */
+
+UTL_ExprList::UTL_ExprList(AST_Expression *s, UTL_ExprList *cdr)
+ : UTL_List<UTL_ExprList, AST_Expression>(s, cdr)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+/*
+ * Redefinition of inherited virtual operations
+ */
+
+// UTL_ExprList active iterator
+
+/*
+ * Constructor
+ */
+
+UTL_ExprlistActiveIterator::UTL_ExprlistActiveIterator(UTL_ExprList *s)
+ : UTL_ListActiveIterator<UTL_ExprList, AST_Expression>(s)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+/*
+ * Redefinition of inherited virtual operations
+ */
diff --git a/TAO/TAO_IDL/util/utl_tmpl/utl_idlist.cpp b/TAO/TAO_IDL/util/utl_tmpl/utl_idlist.cpp
new file mode 100644
index 00000000000..3f4780aa82e
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_tmpl/utl_idlist.cpp
@@ -0,0 +1,152 @@
+// $Id$
+
+/*
+ *======================================================================
+ *
+ *Copyright 1992 Sun Microsystems, Inc.
+ *
+ *The Interface Definition Language Compiler Front End (CFE) is made
+ *available for use provided that this legend is included on all media and
+ *documentation and as a part of the software program in whole or part.
+ *Users may copy and extend functionality (but may not remove
+ *functionality) of the Interface Definition Language CFE without charge,
+ *but are not authorized to license or distribute it to anyone else except
+ *as part of a product or program developed by the user or with the express
+ *written consent of Sun Microsystems, Inc.
+ *
+ *The names of Sun Microsystems, Inc. and any of its subsidiaries may not
+ *be used in advertising or publicity pertaining to distribution of
+ *Interface Definition Language CFE as permitted herein.
+ *
+ *The Interface Definition Language CFE may not be exported outside the
+ *United States without first obtaining the appropriate government
+ *approvals.
+ *
+ *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 Microsystems, Inc. or any of
+ *its subsidiaries or affiliates to assist in its use, correction,
+ *modification or enhancement.
+ *
+ *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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.
+ *
+ *SunSoft, Inc.
+ *2550 Garcia Avenue
+ *Mountain View, California 94043
+ *
+ *
+ *
+ *
+ *======================================================================
+ */
+
+// utl_idlist.cc
+//
+// Implementation of a list of utl_string nodes
+
+#include <idl.hh>
+#include <idl_extern.hh>
+
+ACE_RCSID(utl_tmpl, utl_idlist, "$Id$")
+
+/*
+ * Constructor(s)
+ */
+
+UTL_IdList::UTL_IdList(Identifier *s, UTL_IdList *cdr)
+ : UTL_List<UTL_IdList, Identifier>(s, cdr)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Get last item of this list
+Identifier *
+UTL_IdList::last_component (void)
+{
+ if (tail() == 0)
+ {
+ return head ();
+ }
+
+ return tail ()->last_component ();
+}
+
+// AST Dumping
+void
+UTL_IdList::dump (ACE_OSTREAM_TYPE &o)
+{
+ long first = true;
+ long second = false;
+
+ for (UTL_IdListActiveIterator (this); !i.is_done (); i.next ())
+ {
+ if (!first)
+ {
+ o << "::";
+ }
+ else if (second)
+ {
+ first = second = false;
+ }
+
+ i.item ()->dump (o);
+
+ if (first)
+ {
+ if (ACE_OS::strcmp (i.item ()->get_string (), "::") != 0)
+ {
+ first = false;
+ }
+ else
+ {
+ second = true;
+ }
+ }
+ }
+}
+
+/*
+ * Redefinition of inherited virtual operations
+ */
+
+// UTL_IdList active iterator
+
+/*
+ * Constructor
+ */
+
+UTL_IdListActiveIterator::UTL_IdListActiveIterator (UTL_IdList *s)
+ : UTL_ListActiveIterator<UTL_IdList, Identifier> (s)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+/*
+ * Redefinition of inherited virtual operations
+ */
diff --git a/TAO/TAO_IDL/util/utl_tmpl/utl_labellist.cpp b/TAO/TAO_IDL/util/utl_tmpl/utl_labellist.cpp
new file mode 100644
index 00000000000..eca1dbbe23a
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_tmpl/utl_labellist.cpp
@@ -0,0 +1,106 @@
+// $Id$
+
+/*
+ *======================================================================
+ *
+ *Copyright 1992 Sun Microsystems, Inc.
+ *
+ *The Interface Definition Language Compiler Front End (CFE) is made
+ *available for use provided that this legend is included on all media and
+ *documentation and as a part of the software program in whole or part.
+ *Users may copy and extend functionality (but may not remove
+ *functionality) of the Interface Definition Language CFE without charge,
+ *but are not authorized to license or distribute it to anyone else except
+ *as part of a product or program developed by the user or with the express
+ *written consent of Sun Microsystems, Inc.
+ *
+ *The names of Sun Microsystems, Inc. and any of its subsidiaries may not
+ *be used in advertising or publicity pertaining to distribution of
+ *Interface Definition Language CFE as permitted herein.
+ *
+ *The Interface Definition Language CFE may not be exported outside the
+ *United States without first obtaining the appropriate government
+ *approvals.
+ *
+ *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 Microsystems, Inc. or any of
+ *its subsidiaries or affiliates to assist in its use, correction,
+ *modification or enhancement.
+ *
+ *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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.
+ *
+ *SunSoft, Inc.
+ *2550 Garcia Avenue
+ *Mountain View, California 94043
+ *
+ *
+ *
+ *
+ *======================================================================
+ */
+
+// utl_labellist.cc
+//
+// Implementation of a list of scoped names
+
+#include <idl.hh>
+#include <idl_extern.hh>
+
+ACE_RCSID(utl_tmpl, utl_labellist, "$Id$")
+
+/*
+ * Constructor(s)
+ */
+
+UTL_LabelList::UTL_LabelList(AST_UnionLabel *s, UTL_LabelList *cdr)
+ : UTL_List<UTL_LabelList, AST_UnionLabel>(s, cdr)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+/*
+ * Redefinition of inherited virtual operations
+ */
+
+// UTL_LabelList active iterator
+
+/*
+ * Constructor
+ */
+
+UTL_LabellistActiveIterator::UTL_LabellistActiveIterator(UTL_LabelList *s)
+ : UTL_ListActiveIterator<UTL_LabelList, AST_UnionLabel>(s)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+/*
+ * Redefinition of inherited virtual operations
+ */
diff --git a/TAO/TAO_IDL/util/utl_tmpl/utl_list.cpp b/TAO/TAO_IDL/util/utl_tmpl/utl_list.cpp
new file mode 100644
index 00000000000..15b3abb62c6
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_tmpl/utl_list.cpp
@@ -0,0 +1,213 @@
+// $Id$
+
+/*
+ *======================================================================
+ *
+ *Copyright 1992 Sun Microsystems, Inc.
+ *
+ *The Interface Definition Language Compiler Front End (CFE) is made
+ *available for use provided that this legend is included on all media and
+ *documentation and as a part of the software program in whole or part.
+ *Users may copy and extend functionality (but may not remove
+ *functionality) of the Interface Definition Language CFE without charge,
+ *but are not authorized to license or distribute it to anyone else except
+ *as part of a product or program developed by the user or with the express
+ *written consent of Sun Microsystems, Inc.
+ *
+ *The names of Sun Microsystems, Inc. and any of its subsidiaries may not
+ *be used in advertising or publicity pertaining to distribution of
+ *Interface Definition Language CFE as permitted herein.
+ *
+ *The Interface Definition Language CFE may not be exported outside the
+ *United States without first obtaining the appropriate government
+ *approvals.
+ *
+ *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 Microsystems, Inc. or any of
+ *its subsidiaries or affiliates to assist in its use, correction,
+ *modification or enhancement.
+ *
+ *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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.
+ *
+ *SunSoft, Inc.
+ *2550 Garcia Avenue
+ *Mountain View, California 94043
+ *
+ *
+ *
+ *
+ *======================================================================
+ */
+
+// utl_list.cc
+//
+// Implementation of generic single-linked lists
+
+#include <stddef.h>
+#include <utl_list.hh>
+#include <bool.hh>
+
+ACE_RCSID(utl_tmpl, utl_list, "$Id$")
+
+/*
+ * Constructor(s)
+ */
+
+template<class L, class T>
+UTL_List<L, T>::UTL_List(T *c, L *l)
+ : pd_car_data(c),
+ pd_cdr_data(l)
+{
+}
+
+/*
+ * Private operations
+ */
+
+// Compute list length
+template<class L, class T>
+long
+UTL_List<L, T>::list_length(long n)
+{
+ if (pd_cdr_data == NULL)
+ return n;
+ else
+ return pd_cdr_data->list_length(n+1);
+}
+
+/*
+ * Public operations
+ */
+
+// Smash last cdr with l
+template<class L, class T>
+void
+UTL_List<L, T>::nconc(L *l)
+{
+ if (pd_cdr_data == NULL)
+ pd_cdr_data = l;
+ else
+ pd_cdr_data->nconc(l);
+}
+
+/*
+ * Override this operation to copy lists of other types
+ */
+// Copy a list
+template<class L, class T>
+L *
+UTL_List<L, T>::copy()
+{
+ if (pd_cdr_data == NULL)
+ return new L(head(), NULL);
+ return new L(head(), pd_cdr_data->copy());
+}
+
+// Get list item
+template<class L, class T>
+T *
+UTL_List<L, T>::head()
+{
+ return pd_car_data;
+}
+
+// Get next list
+template<class L, class T>
+L *
+UTL_List<L, T>::tail()
+{
+ return pd_cdr_data;
+}
+
+// Set list item
+template<class L, class T>
+void
+UTL_List<L, T>::set_head(T *s)
+{
+ pd_car_data = s;
+}
+
+// Set next list
+template<class L, class T>
+void
+UTL_List<L, T>::set_tail(L *l)
+{
+ pd_cdr_data = l;
+}
+
+// Compute list length
+template<class L, class T>
+long
+UTL_List<L, T>::length()
+{
+ return list_length(1);
+}
+
+/*
+ * Redefinition of inherited virtual operations
+ */
+
+// UTL_List active iterator
+
+/*
+ * Constructor
+ */
+
+template<class L, class T>
+UTL_ListActiveIterator<L, T>::UTL_ListActiveIterator(UTL_List<L, T> *s)
+ : source(s)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Is iterator done?
+template<class L, class T>
+long
+UTL_ListActiveIterator<L, T>::is_done()
+{
+ return (source == NULL) ? true : false;
+}
+
+// Get current item
+template<class L, class T>
+T *
+UTL_ListActiveIterator<L, T>::item()
+{
+ if (source == NULL)
+ return NULL;
+ return source->head();
+}
+
+// Advance to next item
+template<class L, class T>
+void
+UTL_ListActiveIterator<L, T>::next()
+{
+ if (source != NULL)
+ source = source->tail();
+}
+
+/*
+ * Redefinition of inherited operations
+ */
+
diff --git a/TAO/TAO_IDL/util/utl_tmpl/utl_namelist.cpp b/TAO/TAO_IDL/util/utl_tmpl/utl_namelist.cpp
new file mode 100644
index 00000000000..b520137cb73
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_tmpl/utl_namelist.cpp
@@ -0,0 +1,108 @@
+// $Id$
+
+/*
+ *======================================================================
+ *
+ *Copyright 1992 Sun Microsystems, Inc.
+ *
+ *The Interface Definition Language Compiler Front End (CFE) is made
+ *available for use provided that this legend is included on all media and
+ *documentation and as a part of the software program in whole or part.
+ *Users may copy and extend functionality (but may not remove
+ *functionality) of the Interface Definition Language CFE without charge,
+ *but are not authorized to license or distribute it to anyone else except
+ *as part of a product or program developed by the user or with the express
+ *written consent of Sun Microsystems, Inc.
+ *
+ *The names of Sun Microsystems, Inc. and any of its subsidiaries may not
+ *be used in advertising or publicity pertaining to distribution of
+ *Interface Definition Language CFE as permitted herein.
+ *
+ *The Interface Definition Language CFE may not be exported outside the
+ *United States without first obtaining the appropriate government
+ *approvals.
+ *
+ *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 Microsystems, Inc. or any of
+ *its subsidiaries or affiliates to assist in its use, correction,
+ *modification or enhancement.
+ *
+ *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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.
+ *
+ *SunSoft, Inc.
+ *2550 Garcia Avenue
+ *Mountain View, California 94043
+ *
+ *
+ *
+ *
+ *======================================================================
+ */
+
+// utl_namelist.cc
+//
+// Implementation of a list of scoped names
+
+#include <idl.hh>
+#include <idl_extern.hh>
+
+ACE_RCSID(utl_tmpl, utl_namelist, "$Id$")
+
+typedef UTL_List<UTL_NameList, UTL_ScopedName> _dummy_;
+
+/*
+ * Constructor(s)
+ */
+
+UTL_NameList::UTL_NameList(UTL_ScopedName *s, UTL_NameList *cdr)
+ : UTL_List<UTL_NameList, UTL_ScopedName>(s, cdr)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+/*
+ * Redefinition of inherited virtual operations
+ */
+
+// UTL_NameList active iterator
+
+/*
+ * Constructor
+ */
+
+UTL_NamelistActiveIterator::UTL_NamelistActiveIterator(UTL_NameList *s)
+ : UTL_ListActiveIterator<UTL_NameList, UTL_ScopedName>(s)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+/*
+ * Redefinition of inherited virtual operations
+ */
diff --git a/TAO/TAO_IDL/util/utl_tmpl/utl_strlist.cpp b/TAO/TAO_IDL/util/utl_tmpl/utl_strlist.cpp
new file mode 100644
index 00000000000..3ee0b417f08
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_tmpl/utl_strlist.cpp
@@ -0,0 +1,152 @@
+// $Id$
+
+/*
+ *======================================================================
+ *
+ *Copyright 1992 Sun Microsystems, Inc.
+ *
+ *The Interface Definition Language Compiler Front End (CFE) is made
+ *available for use provided that this legend is included on all media and
+ *documentation and as a part of the software program in whole or part.
+ *Users may copy and extend functionality (but may not remove
+ *functionality) of the Interface Definition Language CFE without charge,
+ *but are not authorized to license or distribute it to anyone else except
+ *as part of a product or program developed by the user or with the express
+ *written consent of Sun Microsystems, Inc.
+ *
+ *The names of Sun Microsystems, Inc. and any of its subsidiaries may not
+ *be used in advertising or publicity pertaining to distribution of
+ *Interface Definition Language CFE as permitted herein.
+ *
+ *The Interface Definition Language CFE may not be exported outside the
+ *United States without first obtaining the appropriate government
+ *approvals.
+ *
+ *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 Microsystems, Inc. or any of
+ *its subsidiaries or affiliates to assist in its use, correction,
+ *modification or enhancement.
+ *
+ *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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.
+ *
+ *SunSoft, Inc.
+ *2550 Garcia Avenue
+ *Mountain View, California 94043
+ *
+ *
+ *
+ *
+ *======================================================================
+ */
+
+// utl_strlist.cc
+//
+// Implementation of a list of utl_string nodes
+
+#include <idl.hh>
+#include <idl_extern.hh>
+
+ACE_RCSID(utl_tmpl, utl_strlist, "$Id$")
+
+/*
+ * Constructor(s)
+ */
+
+UTL_StrList::UTL_StrList(String *s, UTL_StrList *cdr)
+ : UTL_List<UTL_StrList, String>(s, cdr)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Get last item of this list
+String *
+UTL_StrList::last_component()
+{
+ if (tail() == NULL)
+ return head();
+ return tail()->last_component();
+}
+
+// AST Dumping
+void
+UTL_StrList::dump (ACE_OSTREAM_TYPE &o)
+{
+ char *s = 0;;
+ UTL_StrlistActiveIterator *i = new UTL_StrlistActiveIterator (this);
+ long first = true;
+ long second = false;
+
+ for (UTL_StrlistActiveIterator (this); !i.is_done(); i.next ())
+ {
+ if (!first)
+ {
+ o << "::";
+ }
+ else if (second)
+ {
+ first = second = false;
+ }
+
+ s = i.item ()->get_string ();
+ o << s;
+
+ if (first)
+ {
+ if (ACE_OS::strcmp (s, "::") != 0)
+ {
+ first = false;
+ }
+ else
+ {
+ second = true;
+ }
+ }
+ }
+}
+
+/*
+ * Redefinition of inherited virtual operations
+ */
+
+// UTL_StrList active iterator
+
+/*
+ * Constructor
+ */
+
+UTL_StrlistActiveIterator::UTL_StrlistActiveIterator(UTL_StrList *s)
+ : UTL_ListActiveIterator<UTL_StrList, String>(s)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+/*
+ * Redefinition of inherited virtual operations
+ */