diff --git a/README.adoc b/README.adoc index 9811e071..e285112c 100644 --- a/README.adoc +++ b/README.adoc @@ -1,8 +1,8 @@ image:https://img.shields.io/badge/scoreboard-Remedy IT-brightgreen.svg[Scoreboard, link=https://www.taox11.org/scoreboard.html] image:https://www.codefactor.io/repository/github/remedyit/taox11/badge[CodeFactor, link=https://www.codefactor.io/repository/github/remedyit/taox11] -image:https://github.com/RemedyIT/taox11/workflows/linux/badge.svg[Linux CI, link=https://github.com/RemedyIT/taox11/actions?query=workflow%3Alinux] -image:https://github.com/RemedyIT/taox11/workflows/windows/badge.svg[Windows CI, link=https://github.com/RemedyIT/taox11/actions?query=workflow%3Awindows] -image:https://github.com/RemedyIT/taox11/workflows/fuzzr/badge.svg[Fuzzr CI, link=https://github.com/RemedyIT/taox11/actions?query=workflow%3Afuzzr] +image:https://github.com/RemedyIT/taox11/actions/workflows/linux.yml/badge.svg[Linux CI, link=https://github.com/RemedyIT/taox11/actions?query=workflow%3Alinux] +// image:https://github.com/RemedyIT/taox11/actions/workflows/windows.yml/badge.svg[Windows CI, link=https://github.com/RemedyIT/taox11/actions?query=workflow%3Awindows] +image:https://github.com/RemedyIT/taox11/actions/workflows/fuzzr.yml/badge.svg[Fuzzr CI, link=https://github.com/RemedyIT/taox11/actions?query=workflow%3Afuzzr] image:https://codecov.io/gh/RemedyIT/taox11/branch/master/graph/badge.svg[Codecov, link=https://codecov.io/gh/RemedyIT/taox11] = TAOX11 diff --git a/bin/taox11_tests.lst b/bin/taox11_tests.lst index 0175b9d2..09905031 100644 --- a/bin/taox11_tests.lst +++ b/bin/taox11_tests.lst @@ -179,6 +179,7 @@ tests/typecode/run_test.pl: !CORBA_E_COMPACT !CORBA_E_MICRO tests/typecode_adapter/orb_create/run_test.pl: !CORBA_E_COMPACT !CORBA_E_MICRO tests/typecode_adapter/resolve_ref/run_test.pl: !CORBA_E_COMPACT !CORBA_E_MICRO tests/typelib/nocpp/run_test.pl: +tests/typelib/proxyany/run_test.pl: tests/typelib/shared/run_test.pl: tests/typelib/stdlib/run_test.pl: tests/typelib/taox11/run_test.pl: diff --git a/ridlbe/c++11/templates/cli/src/pre.erb b/ridlbe/c++11/templates/cli/src/pre.erb index 36aaaf12..c584113c 100644 --- a/ridlbe/c++11/templates/cli/src/pre.erb +++ b/ridlbe/c++11/templates/cli/src/pre.erb @@ -1,12 +1,12 @@ -#if __has_include("tao/x11/base/tao_corba.h") -# include "tao/x11/base/tao_corba.h" -#endif % pre_includes.each do |incfile| #include "<%= incfile %>" % end % includes.each do |incfile| #include "<%= incfile %>" % end +#if __has_include("tao/x11/base/tao_corba.h") +# include "tao/x11/base/tao_corba.h" +#endif % post_includes.each do |incfile| #include "<%= incfile %>" % end diff --git a/ridlbe/c++11/writers/anytypecodesrc.rb b/ridlbe/c++11/writers/anytypecodesrc.rb index 52da1434..13182ff4 100644 --- a/ridlbe/c++11/writers/anytypecodesrc.rb +++ b/ridlbe/c++11/writers/anytypecodesrc.rb @@ -68,6 +68,8 @@ def visit_anyops(parser) end def visit_typecodes(parser) + writer(StubSourceTaoTypecodeWriter).visit_nodes(parser) unless params[:gen_stub_proxy_source] + writer(StubSourceTypecodeWriter).visit_nodes(parser) end end # AnyTypeCodeWriter @@ -82,6 +84,10 @@ def initialize(output = STDOUT, opts = {}) attr_reader :includes + def generate_tao_anytypecode? + params[:gen_typecodes] && !params[:gen_stub_proxy_source] + end + def post_visit(_parser) properties[:pre_includes] = @default_pre_includes properties[:post_includes] = @default_post_includes @@ -90,7 +96,7 @@ def post_visit(_parser) end def enter_interface(node) - add_pre_include('tao/AnyTypeCode/Objref_TypeCode_Static.h') if params[:gen_typecodes] + add_pre_include('tao/AnyTypeCode/Objref_TypeCode_Static.h') if generate_tao_anytypecode? add_post_include('tao/x11/anytypecode/any_basic_impl_t.h') if params[:gen_any_ops] return if node.is_local? || node.is_pseudo? || node.is_abstract? @@ -98,8 +104,8 @@ def enter_interface(node) end def enter_valuetype(node) - add_pre_include('tao/AnyTypeCode/Value_TypeCode_Static.h') if params[:gen_typecodes] - add_pre_include('tao/AnyTypeCode/TypeCode_Value_Field.h') if params[:gen_typecodes] + add_pre_include('tao/AnyTypeCode/Value_TypeCode_Static.h') if generate_tao_anytypecode? + add_pre_include('tao/AnyTypeCode/TypeCode_Value_Field.h') if generate_tao_anytypecode? add_post_include('tao/x11/anytypecode/any_basic_impl_t.h') if params[:gen_any_ops] return if node.is_abstract? || node.is_local? @@ -107,7 +113,7 @@ def enter_valuetype(node) end def visit_valuebox(node) - add_pre_include('tao/AnyTypeCode/Alias_TypeCode_Static.h') if params[:gen_typecodes] + add_pre_include('tao/AnyTypeCode/Alias_TypeCode_Static.h') if generate_tao_anytypecode? add_post_include('tao/x11/anytypecode/any_basic_impl_t.h') if params[:gen_any_ops] return if node.is_local? @@ -115,8 +121,8 @@ def visit_valuebox(node) end def enter_struct(node) - add_pre_include('tao/AnyTypeCode/Struct_TypeCode_Static.h') if params[:gen_typecodes] - add_pre_include('tao/AnyTypeCode/TypeCode_Struct_Field.h') if params[:gen_typecodes] + add_pre_include('tao/AnyTypeCode/Struct_TypeCode_Static.h') if generate_tao_anytypecode? + add_pre_include('tao/AnyTypeCode/TypeCode_Struct_Field.h') if generate_tao_anytypecode? add_post_include('tao/x11/anytypecode/any_dual_impl_t.h') if params[:gen_any_ops] return if node.is_local? @@ -125,8 +131,8 @@ def enter_struct(node) end def enter_union(node) - add_pre_include('tao/AnyTypeCode/Union_TypeCode_Static.h') if params[:gen_typecodes] - add_pre_include('tao/AnyTypeCode/TypeCode_Case_T.h') if params[:gen_typecodes] + add_pre_include('tao/AnyTypeCode/Union_TypeCode_Static.h') if generate_tao_anytypecode? + add_pre_include('tao/AnyTypeCode/TypeCode_Case_T.h') if generate_tao_anytypecode? add_post_include('tao/x11/anytypecode/any_dual_impl_t.h') if params[:gen_any_ops] add_post_include('tao/x11/anytypecode/typecode_case_t.h') if params[:gen_any_ops] return if node.is_local? @@ -136,32 +142,32 @@ def enter_union(node) end def enter_exception(node) - add_pre_include('tao/AnyTypeCode/Struct_TypeCode_Static.h') if params[:gen_typecodes] - add_pre_include('tao/AnyTypeCode/TypeCode_Struct_Field.h') if params[:gen_typecodes] + add_pre_include('tao/AnyTypeCode/Struct_TypeCode_Static.h') if generate_tao_anytypecode? + add_pre_include('tao/AnyTypeCode/TypeCode_Struct_Field.h') if generate_tao_anytypecode? add_post_include('tao/x11/anytypecode/any_dual_impl_t.h') if params[:gen_any_ops] # arg template included in P.h node.members.each { |m| check_idl_type(m.idltype) } end def visit_enum(_node) - add_pre_include('tao/AnyTypeCode/Enum_TypeCode_Static.h') if params[:gen_typecodes] + add_pre_include('tao/AnyTypeCode/Enum_TypeCode_Static.h') if generate_tao_anytypecode? add_post_include('tao/x11/anytypecode/any_basic_impl_t.h') if params[:gen_any_ops] end def visit_bitmask(_node) - add_pre_include('tao/AnyTypeCode/Enum_TypeCode_Static.h') if params[:gen_typecodes] + add_pre_include('tao/AnyTypeCode/Enum_TypeCode_Static.h') if generate_tao_anytypecode? add_post_include('tao/x11/anytypecode/any_basic_impl_t.h') if params[:gen_any_ops] end def visit_bitset(_node) - add_pre_include('tao/AnyTypeCode/Enum_TypeCode_Static.h') if params[:gen_typecodes] + add_pre_include('tao/AnyTypeCode/Enum_TypeCode_Static.h') if generate_tao_anytypecode? add_post_include('tao/x11/anytypecode/any_basic_impl_t.h') if params[:gen_any_ops] end def visit_typedef(node) return if node.idltype.resolved_type.is_a?(IDL::Type::Native) - add_pre_include('tao/AnyTypeCode/Alias_TypeCode_Static.h') if params[:gen_typecodes] + add_pre_include('tao/AnyTypeCode/Alias_TypeCode_Static.h') if generate_tao_anytypecode? # just an alias or a sequence, array or fixed? unless node.idltype.is_a?(IDL::Type::ScopedName) add_post_include('tao/x11/anytypecode/any_dual_impl_t.h') if params[:gen_typecodes] @@ -169,16 +175,16 @@ def visit_typedef(node) case idl_type when IDL::Type::String, IDL::Type::WString - add_pre_include('tao/AnyTypeCode/String_TypeCode_Static.h') if params[:gen_typecodes] + add_pre_include('tao/AnyTypeCode/String_TypeCode_Static.h') if generate_tao_anytypecode? when IDL::Type::Sequence, IDL::Type::Array - add_pre_include('tao/AnyTypeCode/Sequence_TypeCode_Static.h') if params[:gen_typecodes] + add_pre_include('tao/AnyTypeCode/Sequence_TypeCode_Static.h') if generate_tao_anytypecode? unless node.is_local? check_idl_type(idl_type) check_idl_type(idl_type.basetype) end when IDL::Type::Map - add_pre_include('tao/AnyTypeCode/Sequence_TypeCode_Static.h') if params[:gen_typecodes] + add_pre_include('tao/AnyTypeCode/Sequence_TypeCode_Static.h') if generate_tao_anytypecode? unless node.is_local? check_idl_type(idl_type) check_idl_type(idl_type.basetype) diff --git a/ridlbe/c++11/writers/stubproxysource.rb b/ridlbe/c++11/writers/stubproxysource.rb index 40b7d4b6..c90521d5 100644 --- a/ridlbe/c++11/writers/stubproxysource.rb +++ b/ridlbe/c++11/writers/stubproxysource.rb @@ -28,12 +28,19 @@ def initialize(output = STDOUT, opts = {}) super @default_pre_includes = [] - @default_pre_includes << 'tao/x11/corba.h' - @default_post_includes = [] + @default_post_includes = [ + 'tao/x11/corba.h', + 'tao/x11/anytypecode/typecode_impl.h', + 'tao/x11/anytypecode/typecode.h' + ] unless params[:no_cdr_streaming] @default_pre_includes << 'tao/CDR.h' @default_post_includes << 'tao/x11/cdr_long_double.h' end + if params[:gen_typecodes] + @default_pre_includes << 'tao/AnyTypeCode/TypeCode.h' + @default_pre_includes << 'tao/AnyTypeCode/TypeCode_Constants.h' + end end # Object traits are only required for interfaces and valuetypes @@ -59,6 +66,8 @@ def enter_valuetype(node) def pre_visit(parser) visit_includes(parser) + visit_tao_typecodes(parser) if params[:gen_typecodes] + super end @@ -97,6 +106,10 @@ def visit_proxy_object_ref_traits_specializations(parser) def visit_proxy_implementation(parser) writer(StubProxySourceProxyImplWriter).visit_nodes(parser) end + + def visit_tao_typecodes(parser) + writer(StubSourceTaoTypecodeWriter).visit_nodes(parser) + end end # StubProxySourceWriter class StubProxySourceCDRWriter < StubProxySourceBaseWriter @@ -233,7 +246,7 @@ def initialize(output = STDOUT, opts = {}) end def generate_typecodes? - params[:gen_typecodes] && !params[:gen_anytypecode_source] + params[:gen_typecodes] && params[:gen_stub_proxy_source] end def generate_anyops? @@ -304,9 +317,7 @@ def enter_valuetype(node) end def visit_valuebox(node) - if generate_typecodes? - add_pre_include('tao/AnyTypeCode/Alias_TypeCode_Static.h') - end + add_pre_include('tao/AnyTypeCode/Alias_TypeCode_Static.h') if generate_typecodes? add_post_include('tao/x11/anytypecode/any_basic_impl_t.h') if generate_anyops? add_post_include('tao/x11/anytypecode/typecode.h') # in case not added yet add_post_include('tao/x11/valuetype/valuetype_proxies.h') # after typecode includes diff --git a/ridlbe/c++11/writers/stubsource.rb b/ridlbe/c++11/writers/stubsource.rb index 911527cd..fd2358c1 100644 --- a/ridlbe/c++11/writers/stubsource.rb +++ b/ridlbe/c++11/writers/stubsource.rb @@ -165,7 +165,8 @@ def visit_proxy_object_ref_traits_specializations(parser) end def visit_typecodes(parser) - writer(StubSourceTypecodeWriter).visit_nodes(parser) + writer(StubSourceTaoTypecodeWriter).visit_nodes(parser) unless params[:gen_stub_proxy_source] + writer(StubSourceTypecodeWriter).visit_nodes(parser) unless params[:gen_anytypecode_source] end def visit_cdr(parser) @@ -254,9 +255,7 @@ def enter_valuetype(node) end def visit_valuebox(node) - if generate_typecodes? - add_pre_include('tao/AnyTypeCode/Alias_TypeCode_Static.h') - end + add_pre_include('tao/AnyTypeCode/Alias_TypeCode_Static.h') if generate_typecodes? add_post_include('tao/x11/anytypecode/any_basic_impl_t.h') if generate_anyops? add_post_include('tao/x11/anytypecode/typecode.h') # in case not added yet add_post_include('tao/x11/valuetype/valuetype_proxies.h') # after typecode includes @@ -517,12 +516,6 @@ def initialize(output = STDOUT, opts = {}) super end - def pre_visit(parser) - writer(StubSourceTaoTypecodeWriter).visit_nodes(parser) - - super - end - def enter_interface(node) visitor(InterfaceVisitor).visit_typecode(node) end diff --git a/tests/typelib/proxyany/client.cpp b/tests/typelib/proxyany/client.cpp new file mode 100644 index 00000000..65936121 --- /dev/null +++ b/tests/typelib/proxyany/client.cpp @@ -0,0 +1,31 @@ +/** + * @file client.cpp + * @author Johnny Willemsen + * + * @brief C++11 client application which uses IDL defines types + * and TAOX11. This version of the test has proxy and anytypecode + * in one file + * + * @copyright Copyright (c) Remedy IT Expertise BV + */ + +#include "testC.h" + +// Check for ACE define + +int +main(int, char* []) +{ + int result {}; + + Test::Bar mybar; + + try + { + } + catch (const std::exception& e) + { + return 1; + } + return result; +} diff --git a/tests/typelib/proxyany/proxyanycombined.mpc b/tests/typelib/proxyany/proxyanycombined.mpc new file mode 100644 index 00000000..69576544 --- /dev/null +++ b/tests/typelib/proxyany/proxyanycombined.mpc @@ -0,0 +1,23 @@ +// -*- MPC -*- + +project(*proxyany_gen_Idl): ridl_ostream_defaults { + idlflags += -Gcpc + idlflags -= -Sa -St + IDL_Files { + ../test.idl + } + custom_only = 1 +} + +project(*proxyany_taox11_Client): taox11_client, taox11_anytypecode { + after += *proxyany_gen_Idl + Source_Files { + client.cpp + } + Source_Files { + testC.cpp + testCP.cpp + } +} + + diff --git a/tests/typelib/proxyany/run_test.pl b/tests/typelib/proxyany/run_test.pl new file mode 100755 index 00000000..1a1bcc10 --- /dev/null +++ b/tests/typelib/proxyany/run_test.pl @@ -0,0 +1,31 @@ +#--------------------------------------------------------------------- +# @file run_test.pl +# @author Marcel Smit +# +# @copyright Copyright (c) Remedy IT Expertise BV +#--------------------------------------------------------------------- +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $target = PerlACE::TestTarget::create_target(2) || die "Create target 2 failed\n"; + +$status = 0; + +$SV = $target->CreateProcess ("client"); + +$server = $SV->SpawnWaitKill ($target->ProcessStartWaitInterval()); + +if ($server != 0) { + print STDERR "ERROR: client returned $server\n"; + $status = 1; +} + +$target->GetStderrLog(); + +exit $status;