summaryrefslogtreecommitdiff
path: root/modules/CIAO/tests/IDL3/ImpliedIDL/All
diff options
context:
space:
mode:
Diffstat (limited to 'modules/CIAO/tests/IDL3/ImpliedIDL/All')
-rw-r--r--modules/CIAO/tests/IDL3/ImpliedIDL/All/README88
-rw-r--r--modules/CIAO/tests/IDL3/ImpliedIDL/All/all.mpc37
-rw-r--r--modules/CIAO/tests/IDL3/ImpliedIDL/All/convert.idl53
-rw-r--r--modules/CIAO/tests/IDL3/ImpliedIDL/All/include.idl35
-rw-r--r--modules/CIAO/tests/IDL3/ImpliedIDL/All/keyword_clash.idl89
-rw-r--r--modules/CIAO/tests/IDL3/ImpliedIDL/All/pass_through.idl94
-rw-r--r--modules/CIAO/tests/IDL3/ImpliedIDL/All/raw_include.idl27
7 files changed, 423 insertions, 0 deletions
diff --git a/modules/CIAO/tests/IDL3/ImpliedIDL/All/README b/modules/CIAO/tests/IDL3/ImpliedIDL/All/README
new file mode 100644
index 00000000000..2f4e09eaf3c
--- /dev/null
+++ b/modules/CIAO/tests/IDL3/ImpliedIDL/All/README
@@ -0,0 +1,88 @@
+ Converting IDL3 to IDL2
+ =======================
+
+Introduction
+============
+
+This directory contains a test for the executable
+tao_idl3_to_idl2, which inputs a single IDL file and
+outputs a single IDL file which has the IDL3 declarations
+from the input file converted to the corresponding 'implied
+IDL' declarations specificed by the mapping in the CCM
+document.
+
+This utility can be used in conjunction with some IDL compiler
+that does not support IDL3 keywords and syntax. The output of
+the utility can be processed by such a compiler, yielding code
+in the target programming language equivalent to that which
+would have been generated in one step by a CCM-aware IDL compiler.
+
+The tao_idl3_to_idl2 executable itself is built in
+CIAO_ROOT/tools/IDL3_to_IDL2. It uses the TAO IDL compiler
+front end parsing engine and the TAO IDL compiler driver
+files, so it depends on ACE. The IDL generation is
+accomplished by a custom backend library.
+
+Other Features Tested
+=====================
+
+The IDL file keyword_clash.idl contains many identifiers that
+are either escaped (to avoid a clash with IDL keywords) or
+are C++ keywords. Coverting this file, then generatin and
+compiling C++ from it, tests the ability of the conversion
+tool to preserve these identifiers correctly when mapping
+from IDL to IDL.
+
+The IDL file raw_include.idl is intentionaly left out of
+conversion processing. It contains no IDL with 'implied IDL'
+mapping. Since it is included in pass_through.idl, it
+must be included in pass_through_IDL2.idl, but without itself
+having the '_IDL2' suffix added. This type of 'raw' inclusion
+is necessary in some cases, and the MPC file adds a command
+line option to the processing of pass_through.idl to make
+sure the raw_include.idl is processed in this way.
+
+Running The Test
+================
+
+This test is only to determine that the generated IDL files
+are valid. So once the converted IDL file (having the
+extension _IDL2.idl) is generated by tao_idl3_to_idl2, the
+TAO IDL compiler is executed on the generated IDL file and
+the resulting C++ files compiled. If the compilation is
+successful for all such files, the test is a success.
+
+Notable Build Features
+======================
+
+Two features of the MPC file for this test are of interest:
+
+1.
+Two of the three IDL files in the test, pass_through.idl and
+include.idl, contain no IDL3 constructs, but merely test the
+executable's regeneration of IDL2 constructs. Since one IDL
+file is included in the other, there is a dependency that
+requires both IDL files to be processed before running the
+IDL compiler on pass_through_IDL2.idl. The line
+
+ pass_through_IDL2.idl << include_IDL2.idl
+
+indicates this dependency to the MPC tool, ensuring the correct
+order of execution.
+
+2.
+The -Sm option passed to the IDL compiler must be used when
+processing an IDL file resulting from the execution of
+tao_idl3_to_idl2. This option disables the action of the
+tao_idl backend 'preprocessor' (which is 'on' by default)
+that adds implied IDL nodes to the Abstract Syntax Tree
+for subsequent C++ code generation. In the case of an eventtype,
+the CCM spec requires additional code generation for a corresponding
+implied 'event consumer' IDL interface, as well as for the
+eventtype itself. The tao_idl3_to_idl2 executable adds this
+interface explicitly to the generated IDL file, along with the
+original eventtype. Without the -Sm option, the event consumer
+interface would appear redundantly in both explicit and implied
+IDL, resulting in a name clash. Since the IDL compiler cannot
+know the origin of the IDL file it is processing, the -Sm
+option encapsulates that knowledge. \ No newline at end of file
diff --git a/modules/CIAO/tests/IDL3/ImpliedIDL/All/all.mpc b/modules/CIAO/tests/IDL3/ImpliedIDL/All/all.mpc
new file mode 100644
index 00000000000..19a43493818
--- /dev/null
+++ b/modules/CIAO/tests/IDL3/ImpliedIDL/All/all.mpc
@@ -0,0 +1,37 @@
+// -*- MPC -*-
+// $Id$
+
+project(ConvertIDL3) : taoidl3toidl2defaults, ciao_executor {
+ avoids += mfc
+ idlflags += -Sm
+
+ IDL3TOIDL2_Files {
+ convert.idl
+ include.idl
+ keyword_clash.idl
+ pass_through.idl
+ }
+
+ IDL_Files {
+ convert_IDL2.idl
+ include.idl
+ include_IDL2.idl
+ keyword_clash_IDL2.idl
+ pass_through_IDL2.idl << keyword_clash_IDL2C.h
+ raw_include.idl
+ }
+
+ Source_Files {
+ convert_IDL2C.cpp
+ convert_IDL2S.cpp
+ include_IDL2C.cpp
+ include_IDL2S.cpp
+ keyword_clash_IDL2C.cpp
+ keyword_clash_IDL2S.cpp
+ pass_through_IDL2C.cpp << includeC.h raw_includeC.h keyword_clash_IDL2C.h
+ pass_through_IDL2S.cpp
+ raw_includeC.cpp
+ raw_includeS.cpp
+ }
+}
+
diff --git a/modules/CIAO/tests/IDL3/ImpliedIDL/All/convert.idl b/modules/CIAO/tests/IDL3/ImpliedIDL/All/convert.idl
new file mode 100644
index 00000000000..68600a619b3
--- /dev/null
+++ b/modules/CIAO/tests/IDL3/ImpliedIDL/All/convert.idl
@@ -0,0 +1,53 @@
+// $Id$
+/**
+ * @file convert.idl
+ * @author Jeff Parsons <j.parsons@vanderbilt.edu>
+ *
+ * Tests all conversions of IDL3 constructs to IDL2.
+ */
+
+#include <Components.idl>
+
+eventtype eattype;
+interface sface {};
+interface pface {};
+interface uface {};
+interface umface {};
+
+valuetype pkey : Components::PrimaryKeyBase
+{
+ public string info;
+};
+
+valuetype pubtype_base {};
+eventtype pubtype : pubtype_base {};
+eventtype emitype : pubtype {};
+eventtype eattype {};
+
+component CompBase supports sface
+{
+};
+
+component CompDerived : CompBase
+{
+ provides pface pface_provider;
+ uses uface uface_user;
+ uses multiple umface umface_umuser;
+ publishes pubtype pubtype_publisher;
+ emits emitype emitype_emitter;
+ consumes eattype eattype_consumer;
+};
+
+home CompBaseHome supports sface manages CompBase
+{
+};
+
+home CompDerivedHome : CompBaseHome manages CompDerived primarykey pkey
+{
+ exception ch_except {};
+ void ch_op () raises (ch_except);
+ factory def_init ();
+ finder kitchen_sink (in string uid, in pkey key, in boolean all)
+ raises (ch_except);
+};
+
diff --git a/modules/CIAO/tests/IDL3/ImpliedIDL/All/include.idl b/modules/CIAO/tests/IDL3/ImpliedIDL/All/include.idl
new file mode 100644
index 00000000000..848d4128b6e
--- /dev/null
+++ b/modules/CIAO/tests/IDL3/ImpliedIDL/All/include.idl
@@ -0,0 +1,35 @@
+// $Id$
+/**
+ * @file include.idl
+ * @author Jeff Parsons <j.parsons@vanderbilt.edu>
+ *
+ * Tests tool's regeneration of IDL2 constructs, which
+ * should be basically unchanged.
+ */
+
+#ifndef INCLUDE_IDL
+#define INCLUDE_IDL
+
+module pre_mod
+{
+ typedef long longarray[3][14][7];
+
+ exception wrong
+ {
+ sequence<sequence<long> > longseqseq;
+ string reasons[4][2];
+ wstring<3> why;
+ };
+
+ enum which
+ {
+ ZERO,
+ ONE,
+ TWO
+ };
+};
+
+const pre_mod::which which_one = pre_mod::ONE;
+
+#endif /* INCLUDE_IDL */
+
diff --git a/modules/CIAO/tests/IDL3/ImpliedIDL/All/keyword_clash.idl b/modules/CIAO/tests/IDL3/ImpliedIDL/All/keyword_clash.idl
new file mode 100644
index 00000000000..987077bc185
--- /dev/null
+++ b/modules/CIAO/tests/IDL3/ImpliedIDL/All/keyword_clash.idl
@@ -0,0 +1,89 @@
+// $Id$
+/**
+ * @file keyword_clash.idl
+ * @author Jeff Parsons <j.parsons@vanderbilt.edu>
+ *
+ * Tests handling of C++ keywords and escaped identifiers (IDL
+ * keywords) in mapping IDL3 to IDL2, and mapping the resulting
+ * IDL2 to C++.
+ */
+
+#ifndef CONVERTIDL3_KEYWORD_CLASH_IDL
+#define CONVERTIDL3_KEYWORD_CLASH_IDL
+
+#include "Components.idl"
+
+module _interface
+{
+ interface _attribute
+ {
+ exception _inout {};
+ };
+};
+
+module static
+{
+ module _readonly
+ {
+ module protected
+ {
+ interface virtual
+ {
+ };
+
+ eventtype _eventtype
+ {
+ private virtual _public;
+ };
+ };
+ };
+};
+
+eventtype _eventtype
+{
+ factory friend (in string _wstring);
+};
+
+interface _oneway {};
+
+module _component
+{
+ component _out supports static::_readonly::protected::virtual
+ {
+ provides _interface::_attribute _local;
+ provides _oneway else;
+ provides static::_readonly::protected::virtual while;
+
+ attribute long _abstract;
+
+ uses multiple _interface::_attribute if;
+ uses multiple _oneway mutable;
+ uses multiple static::_readonly::protected::virtual register;
+
+ uses _interface::_attribute _union;
+ uses _oneway _struct;
+ uses static::_readonly::protected::virtual volatile;
+
+ publishes _eventtype _object;
+ publishes static::_readonly::protected::_eventtype do;
+
+ consumes _eventtype _const;
+ consumes static::_readonly::protected::_eventtype const_cast;
+
+ emits _eventtype class;
+ emits static::_readonly::protected::_eventtype delete;
+ };
+
+ home new manages _out
+ {
+ static::_readonly::protected::virtual
+ catch (
+ inout static::_readonly::protected::_eventtype try)
+ raises (_interface::_attribute::_inout);
+
+ finder continue (in _interface::_attribute _inout);
+ };
+};
+
+#endif /* CONVERTIDL3_KEYWORD_CLASH_IDL */
+
diff --git a/modules/CIAO/tests/IDL3/ImpliedIDL/All/pass_through.idl b/modules/CIAO/tests/IDL3/ImpliedIDL/All/pass_through.idl
new file mode 100644
index 00000000000..97d05edffe8
--- /dev/null
+++ b/modules/CIAO/tests/IDL3/ImpliedIDL/All/pass_through.idl
@@ -0,0 +1,94 @@
+// $Id$
+/**
+ * @file pass_through.idl
+ * @author Jeff Parsons <j.parsons@vanderbilt.edu>
+ *
+ * Tests tool's regeneration of IDL2 constructs, which
+ * should be basically unchanged.
+ */
+
+#ifndef PASS_THROUGH_IDL
+#define PASS_THROUGH_IDL
+
+#pragma prefix "glooby"
+
+#include "include.idl"
+#include "raw_include.idl"
+
+module pre_mod
+{
+ module inner
+ {
+ typedef long fork;
+ };
+
+ union uke switch (which)
+ {
+ case ONE:
+ case ZERO: string str_mem;
+ default: short s_mem;
+ };
+};
+
+module mod
+{
+ typeid mod "rama:lama/ding:dong";
+
+ interface base
+ {
+ readonly attribute unsigned long long ull_attr
+ raises (pre_mod::wrong);
+ };
+
+ interface foo
+ {
+ typeprefix foo "preefy";
+
+ exception wrongety_wrong
+ {
+ base unrelated;
+ string explanation;
+ };
+
+ attribute base base_attr
+ getraises (wrongety_wrong)
+ setraises (pre_mod::wrong, wrongety_wrong);
+ };
+
+ interface bleep;
+
+ abstract interface bar
+ {
+ base bar_op (in base inarg);
+ };
+
+ interface bleep : base, foo
+ {
+ oneway void oneway_op (in string strarg, in any anyarg);
+ bleep get_me ();
+ pre_mod::uke get_uke (out boolean success)
+ raises (pre_mod::wrong, foo::wrongety_wrong);
+ void throw_something ()
+ raises (pre_mod::wrong);
+ };
+
+ abstract valuetype vt_abase
+ {
+ };
+
+ valuetype vt_cbase
+ {
+ private bleep priv_bleep;
+ public string pub_str;
+ factory vt_init (in bleep bleeparg, in string stringarg)
+ raises (pre_mod::wrong);
+ };
+
+ valuetype vt : vt_cbase, vt_abase supports foo, bar
+ {
+ factory vt_default ();
+ };
+};
+
+#endif /* PASS_THROUGH_IDL */
+
diff --git a/modules/CIAO/tests/IDL3/ImpliedIDL/All/raw_include.idl b/modules/CIAO/tests/IDL3/ImpliedIDL/All/raw_include.idl
new file mode 100644
index 00000000000..b3aed65f2df
--- /dev/null
+++ b/modules/CIAO/tests/IDL3/ImpliedIDL/All/raw_include.idl
@@ -0,0 +1,27 @@
+// $Id$
+/**
+ * @file raw_include.idl
+ * @author Jeff Parsons <j.parsons@vanderbilt.edu>
+ *
+ * Tests tool's 'excluded file' feature, which allows the user
+ * to specifcy the generation of an #include for this file, in
+ * an IDL2 file corresponding to the IDL3 file this one is
+ * included in unchanged, without the '_IDL2' suffix.
+ */
+
+#ifndef RAW_INCLUDE_IDL
+#define RAW_INCLUDE_IDL
+
+module carnsarn
+{
+ typedef boolean t_or_f;
+
+ struct one
+ {
+ short shortshort;
+ string along;
+ wstring<3> trinity;
+ };
+};
+
+#endif /* RAW_INCLUDE_IDL */