summaryrefslogtreecommitdiff
path: root/TAO/IIOP
diff options
context:
space:
mode:
authorgokhale <asgokhale@users.noreply.github.com>1997-07-02 04:06:58 +0000
committergokhale <asgokhale@users.noreply.github.com>1997-07-02 04:06:58 +0000
commit49ac70629826044fee636db8c6a752d9fb13f60c (patch)
treee44f5f9dd9129aa38c80ca780a9a0454d25f736c /TAO/IIOP
parentbfc59de46cac9236338b836118ea2059d4f27cb4 (diff)
downloadATCD-49ac70629826044fee636db8c6a752d9fb13f60c.tar.gz
TAO Cubit code
Diffstat (limited to 'TAO/IIOP')
-rw-r--r--TAO/IIOP/tests/Cubit/TAO/Makefile121
-rw-r--r--TAO/IIOP/tests/Cubit/TAO/clnt.cpp508
-rw-r--r--TAO/IIOP/tests/Cubit/TAO/cubit.cpp576
-rw-r--r--TAO/IIOP/tests/Cubit/TAO/cubit.h106
-rw-r--r--TAO/IIOP/tests/Cubit/TAO/cubit.idl40
-rw-r--r--TAO/IIOP/tests/Cubit/TAO/cubitC.cpp381
-rw-r--r--TAO/IIOP/tests/Cubit/TAO/cubitC.h102
-rw-r--r--TAO/IIOP/tests/Cubit/TAO/cubitS.cpp232
-rw-r--r--TAO/IIOP/tests/Cubit/TAO/cubitS.h82
-rw-r--r--TAO/IIOP/tests/Cubit/TAO/cubit_i.cpp91
-rw-r--r--TAO/IIOP/tests/Cubit/TAO/cubit_i.h54
-rw-r--r--TAO/IIOP/tests/Cubit/TAO/method_db.i67
-rw-r--r--TAO/IIOP/tests/Cubit/TAO/svr.cpp212
-rw-r--r--TAO/IIOP/tests/Cubit/TAO/test.mak456
-rw-r--r--TAO/IIOP/tests/Cubit/TAO/test.mdpbin0 -> 42496 bytes
-rw-r--r--TAO/IIOP/tests/Cubit/TAO/test1.cpp390
-rw-r--r--TAO/IIOP/tests/Cubit/TAO/test1.h124
-rw-r--r--TAO/IIOP/tests/Cubit/TAO/test1.idl78
-rw-r--r--TAO/IIOP/tests/Cubit/TAO/test1_clnt.cpp636
-rw-r--r--TAO/IIOP/tests/Cubit/TAO/test1_svr.cpp670
20 files changed, 4926 insertions, 0 deletions
diff --git a/TAO/IIOP/tests/Cubit/TAO/Makefile b/TAO/IIOP/tests/Cubit/TAO/Makefile
new file mode 100644
index 00000000000..4fb42d17ec0
--- /dev/null
+++ b/TAO/IIOP/tests/Cubit/TAO/Makefile
@@ -0,0 +1,121 @@
+#----------------------------------------------------------------------------
+# $Id$
+#
+# Top-level Makefile for the ACE-ified Sun Ref. implementation
+# of IIOP ORB
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# Local macros
+#----------------------------------------------------------------------------
+
+LDLIBS = -lcorba
+
+PROG_SRCS = svr.cpp clnt.cpp cubit.cpp \
+ test1.cpp test1_clnt.cpp test1_svr.cpp \
+ echo_clnt.cpp echo_svr.cpp
+
+LSRC = $(PROG_SRCS)
+
+CUBIT_SVR_OBJS = svr.o cubit_i.o cubitS.o
+CUBIT_CLT_OBJS = clnt.o cubitC.o
+
+BASIC_SVR_OBJS = test1.o test1_svr.o
+BASIC_CLT_OBJS = test1.o test1_clnt.o
+
+ECHO_SVR_OBJS = test1.o echo_svr.o
+ECHO_CLT_OBJS = test1.o echo_clnt.o
+
+BIN = svr clnt test1_svr test1_clnt
+BUILD = $(BIN)
+VLDLIBS = $(LDLIBS:%=%$(VAR))
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(WRAPPER_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(WRAPPER_ROOT)/include/makeinclude/macros.GNU
+include $(WRAPPER_ROOT)/include/makeinclude/rules.common.GNU
+include $(WRAPPER_ROOT)/include/makeinclude/rules.nonested.GNU
+#include $(WRAPPER_ROOT)/include/makeinclude/rules.bin.GNU
+include $(WRAPPER_ROOT)/include/makeinclude/rules.local.GNU
+
+# Local modifications to variables imported by includes above.
+LDFLAGS += -L../../../proto/lib
+CPPFLAGS += -I../../../proto/include -DUSE_ACE_EVENT_HANDLING -DDEBUG
+
+svr: $(addprefix $(VDIR),$(CUBIT_SVR_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS)
+
+clnt: $(addprefix $(VDIR),$(CUBIT_CLT_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS)
+
+test1_svr: $(addprefix $(VDIR),$(BASIC_SVR_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS)
+
+test1_clnt: $(addprefix $(VDIR),$(BASIC_CLT_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS)
+
+########
+# Sanity check builds by running basic functionality tests.
+#
+# "sleep 5" in the server startup is usually enough to get the
+# objref into the file so the client can read it.
+#
+check: $(TESTS)
+ @echo "testing with 'cube' calls, stub + DII, IOR strings"
+ @./svr -i30 -o non-internet > obj.1 & sleep 5
+ @./clnt -n250 -O `cat obj.1` -x
+ @echo ''
+ @echo "testing request forwarding with 'cube' calls, stub + DII"
+ @./svr -f -i30 > obj.2 & sleep 5
+ @./clnt -n250 -O `cat obj.2` -x
+ @echo ''
+ @echo "testing transmission of primitive data types"
+ @./test1_svr -i30 > obj.3 & sleep 5
+ @./test1_clnt -n50 -O `cat obj.3` -x
+ @echo ''
+# @echo "testing echo of primitive data values"
+# @./echo_svr -i30 > obj.4 & sleep 5
+# @./echo_clnt -O `cat obj.4` -x
+# @echo ''
+ @echo "testing with 'cube' calls, MT-ized (no forwarding)"
+ @./svr -t -i30 -o non-internet > obj.5 & sleep 5
+ @./clnt -n250 -O `cat obj.5` -x
+ @echo ''
+
+ifdef LOCALRULES
+########
+# CUBIT test
+svr: svr.o cubit.o
+ $(LINK.cc) -o svr svr.o cubit.o $(LDLIBS)
+clnt: cubit.o clnt.o
+ $(LINK.cc) -o clnt clnt.o cubit.o $(LDLIBS)
+
+########
+# BASIC DATATYPES test
+test1_clnt: test1.o test1_clnt.o
+ $(LINK.cc) -o test1_clnt test1_clnt.o test1.o $(LDLIBS)
+test1_svr: test1.o test1_svr.o
+ $(LINK.cc) -o test1_svr test1_svr.o test1.o $(LDLIBS)
+
+########
+# ECHO test ... "test1" where the operation semantics are violated;
+# this aids some porting work, but is a less rigorous test
+echo_clnt: test1.o echo_clnt.o
+ $(LINK.cc) -o echo_clnt echo_clnt.o test1.o $(LDLIBS)
+echo_svr: test1.o echo_svr.o
+ $(LINK.cc) -o echo_svr echo_svr.o test1.o $(LDLIBS)
+endif
+
+clean:
+ -rm -rf *.o Log $(BIN) obj.* core Templates.DB .make.state
+
+install:
+ -@echo "Nothing to install, these are tests!"
+
+
+
+
+
diff --git a/TAO/IIOP/tests/Cubit/TAO/clnt.cpp b/TAO/IIOP/tests/Cubit/TAO/clnt.cpp
new file mode 100644
index 00000000000..f0249489889
--- /dev/null
+++ b/TAO/IIOP/tests/Cubit/TAO/clnt.cpp
@@ -0,0 +1,508 @@
+// @(#)clnt.cpp 1.2 05/14/97
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// All Rights Reserved
+//
+// TEST: Simple "cube" client, calling hand-crafted stubs.
+//
+// Modified version of Cubit Example written by Sun Microsystems Inc.
+// Modified by: Brian Mendel
+
+#include <ace/Get_Opt.h>
+//#include <crtdbg.h>
+
+#if unix
+# include <unistd.h>
+# include <sys/time.h>
+
+#elif defined (VXWORKS)
+# include <unistd.h>
+# include <time.h>
+
+#else // windows
+
+#endif // unix
+
+#include "cubitC.h"
+
+#include <corba/debug.h>
+
+
+#if !defined (_WIN32)
+extern char *optarg; // missing on some platforms
+#endif
+
+inline int func (unsigned i) { return i - 117; }
+
+extern void
+print_exception (const CORBA_Exception *, const char *, FILE *f=stdout);
+
+
+//
+// forward declarations
+//
+static void cube_union_stub(unsigned, unsigned&, unsigned&,
+ CORBA_Object_ptr, CORBA_Environment &);
+
+static void cube_union_dii(unsigned &, unsigned &,
+ CORBA_Object_ptr, CORBA_Environment &);
+
+// Global variables
+const char* TAO_arg_ior = 0;
+unsigned loop_count = 1;
+int exit_later = 0;
+
+// = TITLE
+// Parses the command line arguments and returns an error status
+//
+// = DESCRIPTION
+// This method parses the command line arguments
+int parse_args(int argc, char *argv[])
+{
+ ACE_Get_Opt opts (argc, argv, "dn:O:x");
+ int c;
+
+ while ((c = opts ()) != -1)
+ switch (c) {
+
+ case 'd': // debug flag
+ TAO_debug_level++;
+ continue;
+
+ case 'n': // loop count
+ loop_count = (unsigned) ACE_OS::atoi (opts.optarg);
+ continue;
+
+ case 'O': // stringified objref
+ {
+ TAO_arg_ior = ACE_OS::strdup(opts.optarg);
+ }
+ continue;
+
+ case 'x':
+ exit_later++;
+ continue;
+
+ case '?':
+ default:
+ ACE_OS::fprintf (stderr, "usage: %s"
+ " [-d]"
+ " [-n loopcount]"
+ " [-O objref]"
+ " [-x]"
+ "\n", argv [0]
+ );
+ return 1;
+ }
+
+ return 0; // Indicates successful parsing of command line
+}
+
+int
+main (int argc, char *argv[])
+{
+ CORBA_ORB_ptr orb_ptr;
+ CORBA_Object_ptr objref = CORBA_Object::_nil();
+ CORBA_Environment env;
+
+ orb_ptr = CORBA_ORB_init(argc, argv, "internet", env);
+ if (env.exception() != 0)
+ {
+ print_exception(env.exception(), "ORB initialization");
+ return 1;
+ }
+
+ //
+ // Parse command line and verify parameters.
+ //
+ parse_args(argc, argv);
+
+ if (TAO_arg_ior == 0)
+ ACE_ERROR_RETURN((LM_ERROR, "%s: must specify an object reference using -O <ior>\n", argv[0]), 1);
+
+ objref = orb_ptr->string_to_object ((CORBA_String)TAO_arg_ior, env);
+
+ ACE_OS::free((void*)TAO_arg_ior);
+ TAO_arg_ior = 0;
+
+ if (env.exception () != 0)
+ {
+ print_exception (env.exception (), "string2object");
+ return 1;
+ }
+
+ if (CORBA_is_nil (objref) == CORBA_B_TRUE)
+ ACE_ERROR_RETURN((LM_ERROR, "%s: must identify non-null target objref\n", argv [0]), 1);
+
+ // Narrow the CORBA_Object reference to the stub object, checking
+ // the type along the way using _is_a
+ Cubit_ptr aCubit = Cubit::_narrow(objref);
+ if (aCubit == 0)
+ ACE_ERROR_RETURN((LM_ERROR, "(%P|%t) Unable to narrow object reference to a Cubit_ptr.\n"), 1);
+
+ //
+ // Make the calls in a loop.
+ //
+ unsigned i;
+ unsigned call_count, error_count;
+
+ call_count = 0;
+ error_count = 0;
+
+ ACE_Time_Value before, after;
+
+ before = ACE_OS::gettimeofday();
+
+ for (i = 0; i < loop_count; i++)
+ {
+ //
+ // Cube an octet.
+ //
+ CORBA_Octet arg_octet, ret_octet;
+
+ call_count++;
+ ret_octet = aCubit->Cubit_cube_octet (arg_octet = func (i), env);
+ if (env.exception () != 0)
+ {
+ print_exception (env.exception (), "from cube_octet");
+ error_count++;
+ }
+ else
+ {
+ dmsg2 ("cube octet: %d --> %d\n", arg_octet, ret_octet);
+ arg_octet = arg_octet * arg_octet * arg_octet;
+ if (arg_octet != ret_octet) {
+ ACE_OS::printf ("** cube_octet(%d) ERROR (--> %d)\n",
+ (CORBA_Octet) func (i), ret_octet);
+ error_count++;
+ }
+ }
+
+ //
+ // Cube a short.
+ //
+ CORBA_Short arg_short, ret_short;
+
+ call_count++;
+ ret_short = aCubit->Cubit_cube_short (arg_short = func (i), env);
+ if (env.exception () != 0)
+ {
+ print_exception (env.exception (), "from cube_short");
+ error_count++;
+ }
+ else
+ {
+ dmsg2 ("cube short: %d --> %d\n", arg_short, ret_short);
+ arg_short = arg_short * arg_short * arg_short;
+ if (arg_short != ret_short)
+ {
+ ACE_OS::printf ("** cube_short(%d) ERROR (--> %d)\n",
+ (CORBA_Short) func (i), ret_short);
+ error_count++;
+ }
+ }
+
+ //
+ // Cube a long.
+ //
+ CORBA_Long arg_long, ret_long;
+
+ call_count++;
+ ret_long = aCubit->Cubit_cube_long (arg_long = func (i), env);
+ if (env.exception () != 0)
+ {
+ print_exception (env.exception (), "from cube_long");
+ error_count++;
+ }
+ else
+ {
+ dmsg2 ("cube long: %d --> %d\n", arg_long, ret_long);
+ arg_long = arg_long * arg_long * arg_long;
+ if (arg_long != ret_long) {
+ ACE_OS::printf ("** cube_long(%ld) ERROR (--> %ld)\n",
+ (CORBA_Long) func (i), ret_long);
+ error_count++;
+ }
+ }
+
+ //
+ // Cube a "struct" ...
+ //
+ Cubit_Many arg_struct, *ret_struct;
+
+ call_count++;
+
+ arg_struct.l = func (i);
+ arg_struct.s = func (i);
+ arg_struct.o = func (i);
+
+ ret_struct = aCubit->Cubit_cube_struct (arg_struct, env);
+ if (env.exception () != 0)
+ {
+ print_exception (env.exception (), "from cube_struct");
+ error_count++;
+ }
+ else
+ {
+ dmsg ("cube struct ...");
+ arg_struct.l = arg_struct.l * arg_struct.l * arg_struct.l;
+ arg_struct.s = arg_struct.s * arg_struct.s * arg_struct.s;
+ arg_struct.o = arg_struct.o * arg_struct.o * arg_struct.o;
+
+ if (arg_struct.l != ret_struct->l
+ || arg_struct.s != ret_struct->s
+ || arg_struct.o != ret_struct->o)
+ {
+ ACE_OS::printf ("** cube_struct ERROR\n");
+ error_count++;
+ }
+ delete ret_struct;
+ }
+
+ }
+
+ after = ACE_OS::gettimeofday();
+
+ if (call_count > 0)
+ {
+ if (error_count == 0)
+ {
+ ACE_Time_Value diff = after - before;
+ unsigned long us = diff.sec() * 1000 * 1000 + diff.usec();
+
+ us /= call_count;
+
+ if (us > 0)
+ ACE_OS::printf ("cube average call ACE_OS::time\t= %ld.%.03ldms, \t"
+ "%ld calls/second\n",
+ us / 1000, us % 1000,
+ 1000000L / us);
+ }
+
+ ACE_OS::printf ("%d calls, %d errors\n", call_count, error_count);
+ }
+
+ //
+ // Simple test for DII: call "cube_struct". (It's not timed
+ // since the copious mallocation of DII would bias numbers against
+ // typical stub-based calls.)
+ //
+ do {
+ //
+ // Create the request ...
+ //
+ CORBA_Request_ptr req;
+
+ req = objref->_request ((const CORBA_String) "cube_struct", env);
+ if (env.exception () != 0) {
+ print_exception (env.exception (), "DII request create");
+ break;
+ }
+
+ //
+ // ... initialise the argument list and result ...
+ //
+ Cubit_Many arg, *result;
+
+ arg.o = 3; arg.l = 5; arg.s = -7;
+
+ CORBA_Any tmp_arg (TC_Cubit_Many, &arg, CORBA_B_FALSE);
+
+ req->arguments ()->add_value (0, tmp_arg, CORBA_ARG_IN, env);
+ if (env.exception () != 0) {
+ print_exception (env.exception (), "DII request arg add");
+ CORBA_release (req);
+ break;
+ }
+
+ req->result ()->value ()
+ ->replace (TC_Cubit_Many, 0, CORBA_B_TRUE, env);
+ if (env.exception () != 0) {
+ print_exception (env.exception (), "DII request result type");
+ CORBA_release (req);
+ break;
+ }
+
+ //
+ // Make the invocation, verify the result
+ //
+ req->invoke ();
+ if (req->env ()->exception () != 0) {
+ print_exception (req->env ()->exception (), "DII invoke");
+ CORBA_release (req);
+ break;
+ }
+
+ result = (Cubit_Many *) req->result ()->value ()->value ();
+
+ if (result->o != 27 || result->l != 125 || result->s != -343)
+ ACE_OS::fprintf (stderr, "DII cube_struct -- bad results\n");
+ else
+ dmsg ("DII cube_struct ... success!!");
+
+ CORBA_release (req);
+
+ } while (0);
+
+ //
+ // Two more tests, using the "cube_union" function
+ //
+ cube_union_dii(call_count, error_count, objref, env);
+ if (env.exception () != 0)
+ error_count++;
+
+ cube_union_stub(i, call_count, error_count, objref, env);
+ if (env.exception () != 0)
+ error_count++;
+
+ if (exit_later) {
+ aCubit->Cubit_please_exit (env);
+ dexc (env, "server, please ACE_OS::exit");
+ }
+
+ CORBA_release (objref);
+
+ return (error_count == 0) ? 0 : 1;
+}
+
+
+static void
+cube_union_stub(unsigned i,
+ unsigned &call_count,
+ unsigned &error_count,
+ CORBA_Object_ptr objref,
+ CORBA_Environment &env)
+{
+ Cubit_ptr aCubit = Cubit::_narrow(objref);
+ //
+ // Cube a "union" ...
+ //
+ Cubit_oneof u, *r;
+
+ call_count++;
+
+ u._disc = e_2nd;
+ u.l = 3;
+
+ r = aCubit->Cubit_cube_union (u, env);
+ if (env.exception () != 0) {
+ print_exception (env.exception (), "from cube_union");
+ error_count++;
+ } else {
+ dmsg ("cube union ...");
+ u.l = u.l * u.l * u.l ;
+
+ if (u.l != r->l) {
+ ACE_OS::printf ("** cube_union ERROR\n");
+ error_count++;
+ }
+
+ delete r;
+ }
+
+ //
+ // Cube another "union" which uses the default arm ...
+ //
+ call_count++;
+
+ u._disc = e_5th;
+ u.cm.l = func (i);
+ u.cm.s = func (i);
+ u.cm.o = func (i);
+
+ u.cm.l = 7;
+ u.cm.s = 5;
+ u.cm.o = 3;
+
+ r = aCubit->Cubit_cube_union (u, env);
+ if (env.exception () != 0) {
+ print_exception (env.exception (), "from cube_union");
+ error_count++;
+ } else {
+ dmsg ("cube union ...");
+ u.cm.l = u.cm.l * u.cm.l * u.cm.l;
+ u.cm.s = u.cm.s * u.cm.s * u.cm.s;
+ u.cm.o = u.cm.o * u.cm.o * u.cm.o;
+
+ if (u.cm.l != r->cm.l
+ || u.cm.s != r->cm.s
+ || u.cm.o != r->cm.o) {
+ ACE_OS::printf ("** cube_union ERROR\n");
+ error_count++;
+ }
+
+ delete r;
+ }
+}
+
+
+static void
+cube_union_dii (unsigned &call_count,
+ unsigned &error_count,
+ CORBA_Object_ptr objref,
+ CORBA_Environment &env)
+{
+ //
+ // Create the request ...
+ //
+ CORBA_Request_ptr req;
+
+ call_count++;
+
+ req = objref->_request ((const CORBA_String) "cube_union", env);
+ if (env.exception () != 0) {
+ error_count++;
+
+ print_exception (env.exception (), "cube_union_dii request create");
+ return;
+ }
+
+ //
+ // ... initialise the argument list and result ...
+ //
+ Cubit_oneof u, *r;
+
+ u._disc = e_3rd;
+ u.cm.l = 5;
+ u.cm.s = -7;
+ u.cm.o = 3;
+
+ CORBA_Any tmp_arg (TC_Cubit_oneof, &u, CORBA_B_FALSE);
+
+ req->arguments ()->add_value (0, tmp_arg, CORBA_ARG_IN, env);
+ if (env.exception () != 0) {
+ error_count++;
+ print_exception (env.exception (), "cube_union_dii request arg add");
+ CORBA_release (req);
+ return;
+ }
+
+ req->result ()->value ()->replace (TC_Cubit_oneof, 0, CORBA_B_TRUE, env);
+ if (env.exception () != 0) {
+ error_count++;
+ print_exception (env.exception (), "cube_union_dii result type");
+ CORBA_release (req);
+ return;
+ }
+
+ //
+ // Make the invocation, verify the result
+ //
+ req->invoke ();
+ if (req->env ()->exception () != 0) {
+ error_count++;
+ print_exception (req->env ()->exception (),"cube_union_dii invoke");
+ CORBA_release (req);
+ return;
+ }
+
+ r = (Cubit_oneof *) req->result ()->value ()->value ();
+
+ if (r->cm.o != 27 || r->cm.l != 125 || r->cm.s != -343) {
+ error_count++;
+ ACE_OS::fprintf (stderr, "cube_union_dii -- bad results\n");
+ }
+ else
+ dmsg ("cube_union_dii ... success!!");
+
+ CORBA_release (req);
+}
diff --git a/TAO/IIOP/tests/Cubit/TAO/cubit.cpp b/TAO/IIOP/tests/Cubit/TAO/cubit.cpp
new file mode 100644
index 00000000000..d232de8eee8
--- /dev/null
+++ b/TAO/IIOP/tests/Cubit/TAO/cubit.cpp
@@ -0,0 +1,576 @@
+// @(#)cubit.cpp 1.2 95/09/29
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// All Rights Reserved
+//
+// TEST: hand-written C-style "Cubit" stubs and "skeletons"
+//
+// NOTE: these "skeletons" are really the methods, using DSI. No real
+// ORB would be implemented in this particular way. Several things would
+// be more typical of real (static) skeletons:
+//
+// * Most of the "in" (and much of the "out") parameter data would
+// be preallocated on the stack, not heap allocated. (Static
+// preallocation doesnt' really work in a multithreaded system,
+// and moreover can waste a lot of space.)
+//
+// * The ORB core wouldn't be told about parameters using heap
+// allocated data structures (e.g. NVList).
+//
+// * Skeletons would need to some kind of "marshal the response NOW"
+// API so that stack-allocated "out" values wouldn't become invalid
+// up until they were safely marshaled.
+//
+// * They'd handle exceptions rather than just generating debugging
+// messages when they happen.
+//
+// * Method code would be called by the skeletons, not written as
+// part of the "skeleton" itself!
+//
+// A key part of turning this code into a complete ORB would be to ensure
+// that skeletons were always efficient and correct. They might not need
+// to be sharable between different implementations of the same OMG-IDL
+// object interface, but many ORBs choose to be structured that way.
+//
+
+#include "cubit.h" // for stubs ...
+#include <corba/boa.h> // ... and skeletons
+
+#include <corba/debug.h> // ... and debugging
+
+
+//
+// CUBE OCTET
+//
+
+static const TAO_Param_Data Cubit_cube_octet_params [] = {
+ { _tc_CORBA_Octet, PARAM_RETURN, 0 },
+ { _tc_CORBA_Octet, PARAM_IN, 0 }
+};
+
+static const TAO_Call_Data Cubit_cube_octet_calldata = {
+ "cube_octet", CORBA_B_TRUE,
+ 2, &Cubit_cube_octet_params [0],
+ 0, 0
+};
+
+
+CORBA_Octet
+Cubit_cube_octet (
+ Cubit_ptr target,
+ CORBA_Octet o,
+ CORBA_Environment &env
+)
+{
+ CORBA_Octet retval = 0;
+ STUB_Object *data;
+
+ if (target->QueryInterface (IID_STUB_Object, (void **)&data)
+ != NOERROR)
+ env.exception (new CORBA_INV_OBJREF (COMPLETED_NO));
+ else {
+ data->do_call (env, &Cubit_cube_octet_calldata,
+ &retval, &o);
+ data->Release ();
+ }
+ return retval;
+}
+
+static void
+_cube_octet_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ CORBA_NVList_ptr nvlist;
+ CORBA_NamedValue_ptr nv;
+ CORBA_Any temp_value (_tc_CORBA_Octet);
+
+ req.orb()->create_list (0, nvlist);
+ nv = nvlist->add_value (0, temp_value, CORBA_ARG_IN, env);
+ dexc (env, "cube_octet, add value");
+
+ req.params (nvlist, env);
+ dexc (env, "cube_octet, get params");
+
+ CORBA_Octet* value = new CORBA_Octet;
+
+ *value = *(CORBA_Octet *)nv->value ()->value ();
+ // dmsg1 ("cube octet, parameter '%d'", *value);
+ *value = (CORBA_Octet) ((*value) * (*value) * (*value));
+ // dmsg1 ("cube octet, result '%d'", *value);
+
+ CORBA_Any* any =
+ new CORBA_Any (_tc_CORBA_Octet, value, CORBA_B_TRUE);
+
+ req.result (any, env);
+ dexc (env, "cube_octet, result");
+}
+
+
+//
+// CUBE SHORT
+//
+
+static const TAO_Param_Data Cubit_cube_short_params [] = {
+ { _tc_CORBA_Short, PARAM_RETURN, 0 },
+ { _tc_CORBA_Short, PARAM_IN, 0 }
+};
+
+static const TAO_Call_Data Cubit_cube_short_calldata = {
+ "cube_short", CORBA_B_TRUE,
+ 2, &Cubit_cube_short_params [0],
+ 0, 0
+};
+
+
+CORBA_Short
+Cubit_cube_short (Cubit_ptr target,
+ CORBA_Short s,
+ CORBA_Environment &env)
+{
+ CORBA_Short retval;
+ STUB_Object *data;
+
+ if (target->QueryInterface (IID_STUB_Object, (void **)&data)
+ != NOERROR)
+ env.exception (new CORBA_INV_OBJREF (COMPLETED_NO));
+ else {
+ data->do_call (env, &Cubit_cube_short_calldata,
+ &retval, &s);
+ data->Release ();
+ }
+ return retval;
+}
+
+static void
+_cube_short_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ CORBA_NVList_ptr nvlist;
+ CORBA_NamedValue_ptr nv;
+ CORBA_Any temp_value (_tc_CORBA_Short);
+
+ req.orb()->create_list (0, nvlist);
+ nv = nvlist->add_value (0, temp_value, CORBA_ARG_IN, env);
+ dexc (env, "cube_short, add_value");
+
+ req.params (nvlist, env);
+ dexc (env, "cube_short, get params");
+
+ CORBA_Short* value = new CORBA_Short;
+
+ *value = *(CORBA_Short *)nv->value ()->value ();
+ // dmsg1 ("cube short, parameter '%d'", *value);
+ *value =(CORBA_Short) ((*value) * (*value) * (*value));
+ // dmsg1 ("cube short, result '%d'", *value);
+
+ CORBA_Any* any =
+ new CORBA_Any (_tc_CORBA_Short, value, CORBA_B_TRUE);
+
+ req.result (any, env);
+ dexc (env, "cube_short, result");
+}
+
+
+//
+// CUBE LONG
+//
+
+static const TAO_Param_Data Cubit_cube_long_params [] = {
+ { _tc_CORBA_Long, PARAM_RETURN, 0 },
+ { _tc_CORBA_Long, PARAM_IN, 0 }
+};
+
+static const TAO_Call_Data Cubit_cube_long_calldata = {
+ "cube_long", CORBA_B_TRUE,
+ 2, &Cubit_cube_long_params [0],
+ 0, 0
+};
+
+
+CORBA_Long
+Cubit_cube_long (Cubit_ptr target,
+ CORBA_Long l,
+ CORBA_Environment &env)
+{
+ CORBA_Long retval;
+ STUB_Object *data;
+
+ if (target->QueryInterface (IID_STUB_Object, (void **)&data) != NOERROR)
+ env.exception (new CORBA_INV_OBJREF (COMPLETED_NO));
+ else
+ {
+ data->do_call (env, &Cubit_cube_long_calldata,
+ &retval, &l);
+ data->Release ();
+ }
+ return retval;
+}
+
+
+static void
+_cube_long_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ CORBA_NVList_ptr nvlist;
+ CORBA_NamedValue_ptr nv;
+ CORBA_Any temp_value (_tc_CORBA_Long);
+
+ req.orb()->create_list (0, nvlist);
+ nv = nvlist->add_value (0, temp_value, CORBA_ARG_IN, env);
+ dexc (env, "cube_long, add_value");
+
+ req.params (nvlist, env);
+ dexc (env, "cube_long, get params");
+
+ CORBA_Long* value = new CORBA_Long;
+
+ *value = *(CORBA_Long *)nv->value ()->value ();
+ // dmsg1 ("cube long, parameter '%d'", *value);
+ *value = (*value) * (*value) * (*value);
+ // dmsg1 ("cube long, result '%d'", *value);
+
+ CORBA_Any* any =
+ new CORBA_Any (_tc_CORBA_Long, value, CORBA_B_TRUE);
+
+ req.result (any, env);
+ dexc (env, "cube_long, result");
+}
+
+//
+// Encapsulated parameters for struct "Cubit_Many" typecode.
+// None of these parameters is complicated, so this is just
+// a linear sequence of element encodings
+//
+// NOTE: it's important that this be longword aligned!!
+//
+static const CORBA_Long _oc_Cubit_Many [] = {
+ 1, // byte order flag (TRICKY!)
+
+ 1, 0, // empty string: repository/type ID
+ 1, 0, // empty string: struct name
+
+ 3, // three struct elements
+
+ // First structure element: name, typecode for Octet
+ 1, 0, // empty string: name "o"
+ tk_octet,
+
+ // Second structure element: name, typecode for Long
+ 1, 0, // empty string: name "l"
+ tk_long,
+
+ // Third structure element: name, typecode for Short
+ 1, 0, // empty string: name "s"
+ tk_short,
+};
+
+static CORBA_TypeCode _tc_Cubit_Many (tk_struct,
+ sizeof _oc_Cubit_Many, (unsigned char *) &_oc_Cubit_Many,
+ CORBA_B_FALSE);
+CORBA_TypeCode_ptr TC_Cubit_Many = &_tc_Cubit_Many;
+
+
+//
+// CUBE STRUCT
+//
+
+static const TAO_Param_Data Cubit_cube_struct_params [] = {
+ { &_tc_Cubit_Many, PARAM_RETURN, sizeof (Cubit_Many) },
+ { &_tc_Cubit_Many, PARAM_IN, 0 }
+};
+
+static const TAO_Call_Data Cubit_cube_struct_calldata = {
+ "cube_struct", CORBA_B_TRUE,
+ 2, &Cubit_cube_struct_params [0],
+ 0, 0
+};
+
+Cubit_Many *
+Cubit_cube_struct (Cubit_ptr target,
+ Cubit_Many &values,
+ CORBA_Environment &env)
+{
+ Cubit_Many *retval;
+ STUB_Object *data;
+
+ if (target->QueryInterface (IID_STUB_Object, (void **)&data) != NOERROR)
+ env.exception (new CORBA_INV_OBJREF (COMPLETED_NO));
+ else
+ {
+ data->do_call (env, &Cubit_cube_struct_calldata,
+ &retval, &values);
+ data->Release ();
+ }
+ return retval;
+}
+
+
+static void
+_cube_struct_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ CORBA_NVList_ptr nvlist;
+ CORBA_NamedValue_ptr nv;
+ CORBA_Any temp_value (TC_Cubit_Many);
+
+ req.orb()->create_list (0, nvlist);
+ nv = nvlist->add_value (0, temp_value, CORBA_ARG_IN, env);
+ dexc (env, "cube_struct, add_value");
+
+ req.params (nvlist, env);
+ dexc (env, "cube_struct, get params");
+
+ Cubit_Many *value;
+ Cubit_Many *retval = new Cubit_Many;
+
+ value = (Cubit_Many *)nv->value ()->value ();
+
+ retval->o = (CORBA_Octet) (value->o * value->o * value->o);
+ retval->s = (CORBA_Short) (value->s * value->s * value->s);
+ retval->l = value->l * value->l * value->l;
+
+ // dmsg2 ("cube struct.o, %d -> %d", value->o, retval->o);
+ // dmsg2 ("cube struct.s, %d -> %d", value->s, retval->s);
+ // dmsg2 ("cube struct.l, %d -> %d", value->l, retval->l);
+
+ CORBA_Any *any =
+ new CORBA_Any (TC_Cubit_Many, retval, CORBA_B_TRUE);
+
+ req.result (any, env);
+ dexc (env, "cube_struct, result");
+}
+
+//
+// CUBE UNION
+//
+
+//
+// NOTE: not all union typecodes can be encoded as an array
+// of "long "values, but this one can. Ones with discriminants
+// that are one or two bytes long can't easily be coded portably.
+//
+// The benefit of doing it as an array of "long" values is
+// twofold: (a) easier to read; (b) on most systems it's then
+// adequately aligned for the typecode interpreter to use, so
+// no additional runtime copy needs to be made.
+//
+static const CORBA_Long _oc_Cubit_oneof [] = {
+ 1, // byte order flag (TRICKY)
+ 1, 0, // omitted repository/type ID
+ 1, 0, // omitted struct name, "oneof"
+
+ //
+ // discriminant typecode:
+ //
+ tk_enum, // tk_enum
+ 72, // encapsulation length
+
+ 1, // byte order flag (TRICKY)
+ 1, 0, // omitted repository/type ID
+ 1, 0, // omitted enum name, "discrim"
+ 6, // 5 elements in the enum
+
+ 1, 0, // omitted member name, "e_0th"
+ 1, 0, // omitted member name, "e_1st"
+ 1, 0, // omitted member name, "e_2nd"
+ 1, 0, // omitted member name, "e_3rd"
+ 1, 0, // omitted member name, "e_4th"
+ 1, 0, // omitted member name, "e_5th"
+
+ 4, // default member index (zero based)
+ 5, // number of union members
+
+ // the 1st union branch arm
+ e_0th, // member label value
+ 1, 0, // omitted member name, "o"
+ tk_octet, // member typecode
+
+ // the 2nd union branch arm
+ e_1st, // member label value
+ 1, 0, // omitted member name, "s"
+ tk_short, // member typecode
+
+ // the 3rd union branch arm
+ e_2nd, // member label value
+ 1, 0, // omitted member name, "l"
+ tk_long, // member typecode
+
+ // the 4th union branch arm
+ e_3rd, // member label value
+ 1, 0, // omitted member name, "cm"
+
+ // the 4th union member typecode
+ tk_struct, // tk_struct
+ 60, // encap length
+
+ 1, // byte order flag (TRICKY)
+ 1, 0, // omitted repository/type ID
+ 1, 0, // omitted struct name, "Many"
+ 3, // three struct members
+
+ // First structure element
+ 1, 0, // omitted member name, "o"
+ tk_octet, // member type, tk_octet
+
+ // Second structure element
+ 1, 0, // omitted member name, "l"
+ tk_long, // member type, tk_long
+
+ // Third structure element
+ 1, 0, // omitted member name, "s"
+ tk_short, // member type, tk_short
+
+ // the 5th union branch arm
+ 4, // the 5th member label value
+ 1, 0, // omitted member name, "cm"
+ ~0, // indirected typecode (~0)
+ -84 // offset to struct "Many" typecode
+};
+
+static CORBA_TypeCode _tc_Cubit_oneof (tk_union,
+ (sizeof _oc_Cubit_oneof), (unsigned char *) &_oc_Cubit_oneof,
+ CORBA_B_FALSE);
+CORBA_TypeCode_ptr TC_Cubit_oneof = &_tc_Cubit_oneof;
+
+static const TAO_Param_Data Cubit_cube_union_params [] = {
+ { &_tc_Cubit_oneof, PARAM_RETURN, sizeof (Cubit_oneof) },
+ { &_tc_Cubit_oneof, PARAM_IN, 0 }
+};
+
+static const TAO_Call_Data Cubit_cube_union_calldata = {
+ "cube_union", CORBA_B_TRUE,
+ 2, &Cubit_cube_union_params [0],
+ 0, 0
+};
+
+Cubit_oneof *
+Cubit_cube_union (Cubit_ptr target,
+ Cubit_oneof &values,
+ CORBA_Environment &env)
+{
+ Cubit_oneof *retval;
+ STUB_Object *data;
+
+ if (target->QueryInterface (IID_STUB_Object, (void **)&data) != NOERROR)
+ env.exception (new CORBA_INV_OBJREF (COMPLETED_NO));
+ else
+ {
+ data->do_call (env, &Cubit_cube_union_calldata,
+ &retval, &values);
+ data->Release ();
+ }
+ return retval;
+}
+
+
+static void
+_cube_union_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ CORBA_NVList_ptr nvlist;
+ CORBA_NamedValue_ptr nv;
+ CORBA_Any temp_value (TC_Cubit_oneof);
+
+ req.orb()->create_list (0, nvlist);
+ nv = nvlist->add_value (0, temp_value, CORBA_ARG_IN, env);
+ dexc (env, "cube_union_3rd, add_value");
+
+ req.params (nvlist, env);
+ dexc (env, "cube_union_3rd, get params");
+
+ Cubit_oneof *v;
+ Cubit_oneof *r = new Cubit_oneof;
+
+ v = (Cubit_oneof *)nv->value ()->value ();
+ r->_disc = v->_disc;
+
+ switch (v->_disc) {
+ case e_0th:
+ r->o = (CORBA_Octet) (v->o * v->o * v->o);
+ break;
+
+ case e_1st:
+ r->s = (CORBA_Short) (v->s * v->s * v->s);
+ break;
+
+ case e_2nd:
+ r->l = v->l * v->l * v->l;
+ break;
+
+ case e_3rd:
+ default:
+ r->cm.o = (CORBA_Octet) (v->cm.o * v->cm.o * v->cm.o);
+ r->cm.s = (CORBA_Short) (v->cm.s * v->cm.s * v->cm.s);
+ r->cm.l = v->cm.l * v->cm.l * v->cm.l;
+ break;
+ }
+
+ CORBA_Any *any = new CORBA_Any (TC_Cubit_oneof, r, CORBA_B_TRUE);
+
+ req.result (any, env);
+ dexc (env, "cube_struct, result");
+}
+
+
+//
+// PLEASE EXIT
+//
+
+static const TAO_Call_Data Cubit_please_exit_calldata = {
+ "please_exit", CORBA_B_FALSE,
+ 0, 0,
+ 0, 0
+};
+
+void
+Cubit_please_exit (
+ Cubit_ptr target,
+ CORBA_Environment &env
+)
+{
+ STUB_Object *data;
+
+ if (target->QueryInterface (IID_STUB_Object, (void **)&data)
+ != NOERROR)
+ env.exception (new CORBA_INV_OBJREF (COMPLETED_NO));
+ else {
+ data->do_call (env, &Cubit_please_exit_calldata
+ );
+ data->Release ();
+ }
+}
+
+static void
+_please_exit_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ dmsg ("I've been asked to shut down...");
+ req.oa ()->please_shutdown (env);
+ dexc (env, "please_exit, please_shutdown");
+}
+
+
+const CORBA_Char *Cubit__id = (CORBA_Char *)
+ "IDL:Eng.SUN.COM/Cubit:1.1";
+
+
+//
+// table of all operations, used by operation dispatch to get to the
+// right skeleton ... could be sorted by the IDL compiler so bsearch
+// is effective, perhaps with help from opname hashes and a small cache
+// (e.g. like Obj-C?). for now, just lsearch.
+//
+const TAO_Skel_Entry Cubit_operations [] = {
+ { &Cubit_cube_octet_calldata, _cube_octet_skel },
+ { &Cubit_cube_short_calldata, _cube_short_skel },
+ { &Cubit_cube_long_calldata, _cube_long_skel },
+ { &Cubit_cube_struct_calldata, _cube_struct_skel },
+ { &Cubit_cube_union_calldata, _cube_union_skel },
+ { &Cubit_please_exit_calldata, _please_exit_skel },
+ { 0, 0 } // last entry
+};
diff --git a/TAO/IIOP/tests/Cubit/TAO/cubit.h b/TAO/IIOP/tests/Cubit/TAO/cubit.h
new file mode 100644
index 00000000000..92dd6b381bd
--- /dev/null
+++ b/TAO/IIOP/tests/Cubit/TAO/cubit.h
@@ -0,0 +1,106 @@
+// @(#)cubit.hh 1.1 95/09/10
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// All Rights Reserved
+//
+// Hand-crafted C language binding glue ...
+//
+// This doesn't use C++ since doing the obvious derivation
+// (all parent interfaces are virtual public parents) makes
+// object references have different "views". That is, a
+// pointer to a Cubit (i.e. a Cubit_ptr) would not have
+// the same binary value as a pointer to a CORBA_Object
+// (i.e. a CORBA_Object_ptr, generic objref). That'd
+// mean lots of narrowing/widening/RTTI infrastructure.
+//
+
+#ifndef _CUBIT_HH
+#define _CUBIT_HH
+
+#ifdef _MSC_VER
+#pragma pack (push, 1) // VC++, known padding rules
+#endif // VC++
+
+#include <corba/orb.h>
+#include <corba/stub.h>
+
+
+//
+// C style binding
+//
+
+typedef CORBA_Object Cubit;
+typedef Cubit *Cubit_ptr, *CubitRef;
+
+extern CORBA_TypeCode_ptr TC_Cubit_Many;
+extern CORBA_TypeCode_ptr TC_Cubit_oneof;
+
+struct Cubit_Many {
+ CORBA_Octet o;
+ CORBA_Long l;
+ CORBA_Short s;
+};
+
+enum Cubit_discrim {e_0th = 0, e_1st = 1, e_2nd = 2,
+ e_3rd = 3, e_4th = 4, e_5th = 5};
+
+struct Cubit_oneof {
+ Cubit_discrim _disc;
+
+ union {
+ CORBA_Octet o;
+ CORBA_Short s;
+ CORBA_Long l;
+ Cubit_Many cm;
+ };
+};
+
+CORBA_Octet
+Cubit_cube_octet (
+ Cubit_ptr target,
+ CORBA_Octet o,
+ CORBA_Environment &env
+);
+
+CORBA_Short
+Cubit_cube_short (
+ Cubit_ptr target,
+ CORBA_Short s,
+ CORBA_Environment &env
+);
+
+CORBA_Long
+Cubit_cube_long (
+ Cubit_ptr target,
+ CORBA_Long l,
+ CORBA_Environment &env
+);
+
+Cubit_Many *
+Cubit_cube_struct (
+ Cubit_ptr target,
+ Cubit_Many &values,
+ CORBA_Environment &env
+);
+
+Cubit_oneof *
+Cubit_cube_union (
+ Cubit_ptr target,
+ Cubit_oneof &values,
+ CORBA_Environment &env
+);
+
+void
+Cubit_please_exit (
+ Cubit_ptr target,
+ CORBA_Environment &env
+);
+
+extern const CORBA_Char *Cubit__id; // type ID
+
+extern const TAO_Skel_Entry Cubit_operations [];
+
+#ifdef _MSC_VER
+#pragma pack (pop) // VC++, go back to other padding rules
+#endif // VC++
+
+#endif // _CUBIT_HH
diff --git a/TAO/IIOP/tests/Cubit/TAO/cubit.idl b/TAO/IIOP/tests/Cubit/TAO/cubit.idl
new file mode 100644
index 00000000000..d9b38c34a2a
--- /dev/null
+++ b/TAO/IIOP/tests/Cubit/TAO/cubit.idl
@@ -0,0 +1,40 @@
+// @(#)cubit.idl 1.1 95/09/10
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+
+#pragma prefix "Eng.SUN.COM"
+#pragma version Cubit 1.1
+
+interface Cubit {
+ octet cube_octet (in octet o);
+ short cube_short (in short s);
+ long cube_long (in long l);
+
+ struct Many {
+ octet o; // + 3 bytes padding (normally) ...
+ long l;
+ short s; // + 2 bytes padding (normally) ...
+ };
+
+ Many cube_struct (in Many values);
+
+ enum discrim {e_0th, e_1st, e_2nd, e_3rd, e_4th, e_5th};
+
+ union oneof
+ switch (discrim) {
+ // this is an easy union to interpret; no padding
+ // is needed between discriminant and value.
+ case e_0th:
+ octet o;
+ case e_1st:
+ short s;
+ case e_2nd:
+ long l;
+ case e_3rd:
+ default:
+ Many cm;
+ };
+
+ oneof cube_union (in oneof values);
+
+ oneway void please_exit ();
+};
diff --git a/TAO/IIOP/tests/Cubit/TAO/cubitC.cpp b/TAO/IIOP/tests/Cubit/TAO/cubitC.cpp
new file mode 100644
index 00000000000..99416520c15
--- /dev/null
+++ b/TAO/IIOP/tests/Cubit/TAO/cubitC.cpp
@@ -0,0 +1,381 @@
+// @(#)cubitC.cpp 05/14/97
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// All Rights Reserved
+//
+// Modified version of Cubit Example written by Sun Microsystems Inc.
+// Modified by: Brian Mendel
+
+#include "cubitC.h" // for stubs ...
+
+Cubit_ptr Cubit::_duplicate(Cubit_ptr obj)
+{
+ if (obj)
+ obj->AddRef();
+
+ return obj;
+}
+
+Cubit_ptr Cubit::_narrow(CORBA_Object_ptr obj)
+{
+ CORBA_Environment env;
+ if (obj->_is_a("IDL:Cubit:1.0", env))
+ {
+ STUB_Object *istub;
+ if (obj->QueryInterface(IID_STUB_Object, (void **)&istub) != NOERROR)
+ {
+ return Cubit::_nil();
+ }
+ Cubit_ptr new_obj = new Cubit(istub);
+ return Cubit::_duplicate(new_obj);
+ }
+ return Cubit::_nil();
+}
+
+Cubit_ptr Cubit::_nil()
+{
+ return (Cubit_ptr)NULL;
+}
+
+//
+// CUBE OCTET
+//
+
+static const TAO_Param_Data Cubit_cube_octet_params [] =
+{
+ { _tc_CORBA_Octet, PARAM_RETURN, 0 },
+ { _tc_CORBA_Octet, PARAM_IN, 0 }
+};
+
+
+static const TAO_Call_Data Cubit_cube_octet_calldata =
+{
+ "cube_octet", CORBA_B_TRUE,
+ 2, &Cubit_cube_octet_params [0],
+ 0, 0
+};
+
+
+CORBA_Octet
+Cubit::Cubit_cube_octet (CORBA_Octet o,
+ CORBA_Environment &env)
+{
+ CORBA_Octet retval;
+
+ STUB_Object *istub;
+ if (this->QueryInterface(IID_STUB_Object, (void **)&istub) != NOERROR)
+ {
+ env.exception(new CORBA_DATA_CONVERSION (COMPLETED_NO));
+ return 0;
+ }
+
+ istub->do_call (env, &Cubit_cube_octet_calldata,
+ &retval, &o);
+ istub->Release ();
+
+ return retval;
+}
+
+
+//
+// CUBE SHORT
+//
+
+static const TAO_Param_Data Cubit_cube_short_params [] =
+{
+ { _tc_CORBA_Short, PARAM_RETURN, 0 },
+ { _tc_CORBA_Short, PARAM_IN, 0 }
+};
+
+static const TAO_Call_Data Cubit_cube_short_calldata =
+{
+ "cube_short", CORBA_B_TRUE,
+ 2, &Cubit_cube_short_params [0],
+ 0, 0
+};
+
+
+CORBA_Short
+Cubit::Cubit_cube_short (CORBA_Short s,
+ CORBA_Environment &env)
+{
+ CORBA_Short retval;
+
+ STUB_Object *istub;
+ if (this->QueryInterface(IID_STUB_Object, (void **)&istub) != NOERROR)
+ {
+ env.exception(new CORBA_DATA_CONVERSION (COMPLETED_NO));
+ return 0;
+ }
+
+ istub->do_call(env, &Cubit_cube_short_calldata,
+ &retval, &s);
+
+ istub->Release ();
+
+ return retval;
+}
+
+//
+// CUBE LONG
+//
+
+static const TAO_Param_Data Cubit_cube_long_params [] =
+{
+ { _tc_CORBA_Long, PARAM_RETURN, 0 },
+ { _tc_CORBA_Long, PARAM_IN, 0 }
+};
+
+static const TAO_Call_Data Cubit_cube_long_calldata =
+{
+ "cube_long", CORBA_B_TRUE,
+ 2, &Cubit_cube_long_params [0],
+ 0, 0
+};
+
+
+CORBA_Long
+Cubit::Cubit_cube_long (CORBA_Long l,
+ CORBA_Environment &env)
+{
+ CORBA_Long retval;
+
+ STUB_Object *istub;
+ if (this->QueryInterface(IID_STUB_Object, (void **)&istub) != NOERROR)
+ {
+ env.exception(new CORBA_DATA_CONVERSION (COMPLETED_NO));
+ return 0;
+ }
+
+ istub->do_call (env, &Cubit_cube_long_calldata,
+ &retval, &l);
+ istub->Release ();
+
+ return retval;
+}
+
+
+//
+// Encapsulated parameters for struct "Cubit_Many" typecode.
+// None of these parameters is complicated, so this is just
+// a linear sequence of element encodings
+//
+// NOTE: it's important that this be longword aligned!!
+//
+static const CORBA_Long _oc_Cubit_Many [] =
+{
+ 1, // byte order flag (TRICKY!)
+
+ 1, 0, // empty string: repository/type ID
+ 1, 0, // empty string: struct name
+
+ 3, // three struct elements
+
+ // First structure element: name, typecode for Octet
+ 1, 0, // empty string: name "o"
+ tk_octet,
+
+ // Second structure element: name, typecode for Long
+ 1, 0, // empty string: name "l"
+ tk_long,
+
+ // Third structure element: name, typecode for Short
+ 1, 0, // empty string: name "s"
+ tk_short,
+};
+
+static CORBA_TypeCode _tc_Cubit_Many (tk_struct,
+ sizeof _oc_Cubit_Many, (unsigned char *) &_oc_Cubit_Many,
+ CORBA_B_FALSE);
+CORBA_TypeCode_ptr TC_Cubit_Many = &_tc_Cubit_Many;
+
+
+//
+// CUBE STRUCT
+//
+
+static const TAO_Param_Data Cubit_cube_struct_params [] =
+{
+ { &_tc_Cubit_Many, PARAM_RETURN, sizeof (Cubit_Many) },
+ { &_tc_Cubit_Many, PARAM_IN, 0 }
+};
+
+static const TAO_Call_Data Cubit_cube_struct_calldata =
+{
+ "cube_struct", CORBA_B_TRUE,
+ 2, &Cubit_cube_struct_params [0],
+ 0, 0
+};
+
+Cubit_Many*
+Cubit::Cubit_cube_struct (Cubit_Many &values,
+ CORBA_Environment &env)
+{
+ Cubit_Many *retval;
+
+ STUB_Object *istub;
+ if (this->QueryInterface(IID_STUB_Object, (void **)&istub) != NOERROR)
+ {
+ env.exception(new CORBA_DATA_CONVERSION (COMPLETED_NO));
+ return 0;
+ }
+
+ istub->do_call (env, &Cubit_cube_struct_calldata,
+ &retval, &values);
+ istub->Release ();
+
+ return retval;
+}
+
+
+//
+// CUBE UNION
+//
+
+//
+// NOTE: not all union typecodes can be encoded as an array
+// of "long "values, but this one can. Ones with discriminants
+// that are one or two bytes long can't easily be coded portably.
+//
+// The benefit of doing it as an array of "long" values is
+// twofold: (a) easier to read; (b) on most systems it's then
+// adequately aligned for the typecode interpreter to use, so
+// no additional runtime copy needs to be made.
+//
+static const CORBA_Long _oc_Cubit_oneof [] =
+{
+ 1, // byte order flag (TRICKY)
+ 1, 0, // omitted repository/type ID
+ 1, 0, // omitted struct name, "oneof"
+
+ //
+ // discriminant typecode:
+ //
+ tk_enum, // tk_enum
+ 72, // encapsulation length
+
+ 1, // byte order flag (TRICKY)
+ 1, 0, // omitted repository/type ID
+ 1, 0, // omitted enum name, "discrim"
+ 6, // 5 elements in the enum
+
+ 1, 0, // omitted member name, "e_0th"
+ 1, 0, // omitted member name, "e_1st"
+ 1, 0, // omitted member name, "e_2nd"
+ 1, 0, // omitted member name, "e_3rd"
+ 1, 0, // omitted member name, "e_4th"
+ 1, 0, // omitted member name, "e_5th"
+
+ 4, // default member index (zero based)
+ 5, // number of union members
+
+ // the 1st union branch arm
+ e_0th, // member label value
+ 1, 0, // omitted member name, "o"
+ tk_octet, // member typecode
+
+ // the 2nd union branch arm
+ e_1st, // member label value
+ 1, 0, // omitted member name, "s"
+ tk_short, // member typecode
+
+ // the 3rd union branch arm
+ e_2nd, // member label value
+ 1, 0, // omitted member name, "l"
+ tk_long, // member typecode
+
+ // the 4th union branch arm
+ e_3rd, // member label value
+ 1, 0, // omitted member name, "cm"
+
+ // the 4th union member typecode
+ tk_struct, // tk_struct
+ 60, // encap length
+
+ 1, // byte order flag (TRICKY)
+ 1, 0, // omitted repository/type ID
+ 1, 0, // omitted struct name, "Many"
+ 3, // three struct members
+
+ // First structure element
+ 1, 0, // omitted member name, "o"
+ tk_octet, // member type, tk_octet
+
+ // Second structure element
+ 1, 0, // omitted member name, "l"
+ tk_long, // member type, tk_long
+
+ // Third structure element
+ 1, 0, // omitted member name, "s"
+ tk_short, // member type, tk_short
+
+ // the 5th union branch arm
+ 4, // the 5th member label value
+ 1, 0, // omitted member name, "cm"
+ ~0, // indirected typecode (~0)
+ -84 // offset to struct "Many" typecode
+};
+
+static CORBA_TypeCode _tc_Cubit_oneof (tk_union,
+ (sizeof _oc_Cubit_oneof), (unsigned char *) &_oc_Cubit_oneof,
+ CORBA_B_FALSE);
+CORBA_TypeCode_ptr TC_Cubit_oneof = &_tc_Cubit_oneof;
+
+static const TAO_Param_Data Cubit_cube_union_params [] =
+{
+ { &_tc_Cubit_oneof, PARAM_RETURN, sizeof (Cubit_oneof) },
+ { &_tc_Cubit_oneof, PARAM_IN, 0 }
+};
+
+static const TAO_Call_Data Cubit_cube_union_calldata =
+{
+ "cube_union", CORBA_B_TRUE,
+ 2, &Cubit_cube_union_params [0],
+ 0, 0
+};
+
+Cubit_oneof*
+Cubit::Cubit_cube_union (Cubit_oneof &values,
+ CORBA_Environment &env)
+{
+ Cubit_oneof *retval;
+
+ STUB_Object *istub;
+ if (this->QueryInterface(IID_STUB_Object, (void **)&istub) != NOERROR)
+ {
+ env.exception(new CORBA_DATA_CONVERSION (COMPLETED_NO));
+ return 0;
+ }
+
+ istub->do_call (env, &Cubit_cube_union_calldata,
+ &retval, &values);
+ istub->Release ();
+
+ return retval;
+}
+
+
+
+//
+// PLEASE EXIT
+//
+
+static const TAO_Call_Data Cubit_please_exit_calldata =
+{
+ "please_exit", CORBA_B_FALSE,
+ 0, 0,
+ 0, 0
+};
+
+void
+Cubit::Cubit_please_exit (CORBA_Environment &env)
+{
+ STUB_Object *istub;
+ if (this->QueryInterface(IID_STUB_Object, (void **)&istub) != NOERROR)
+ {
+ env.exception(new CORBA_DATA_CONVERSION (COMPLETED_NO));
+ return;
+ }
+
+ istub->do_call (env, &Cubit_please_exit_calldata);
+ istub->Release ();
+}
diff --git a/TAO/IIOP/tests/Cubit/TAO/cubitC.h b/TAO/IIOP/tests/Cubit/TAO/cubitC.h
new file mode 100644
index 00000000000..8f9dfe53841
--- /dev/null
+++ b/TAO/IIOP/tests/Cubit/TAO/cubitC.h
@@ -0,0 +1,102 @@
+// @(#)cubitC.h 05/14/97
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// All Rights Reserved
+//
+// Modified version of Cubit Example written by Sun Microsystems Inc.
+// Modified by: Brian Mendel
+
+/**************************************************************************
+This file has been hand-crafted to work with the ORB API of the SUN's IIOP
+implementation
+***************************************************************************/
+
+#ifndef _CUBIT_HH
+#define _CUBIT_HH
+
+#ifdef _MSC_VER
+#pragma pack (push, 1) // VC++, known padding rules
+#endif // VC++
+
+#include "corba/orb.h"
+#include "corba/stub.h"
+
+#include <iostream.h>
+
+extern CORBA_TypeCode_ptr TC_Cubit_Many;
+extern CORBA_TypeCode_ptr TC_Cubit_oneof;
+
+struct Cubit_Many
+{
+ CORBA_Octet o;
+ CORBA_Long l;
+ CORBA_Short s;
+};
+
+enum Cubit_discrim
+ { e_0th = 0, e_1st = 1, e_2nd = 2,
+ e_3rd = 3, e_4th = 4, e_5th = 5 };
+
+struct Cubit_oneof
+{
+ Cubit_discrim _disc;
+
+ union
+ {
+ CORBA_Octet o;
+ CORBA_Short s;
+ CORBA_Long l;
+ Cubit_Many cm;
+ };
+};
+
+class Cubit;
+typedef Cubit *Cubit_ptr;
+typedef Cubit_ptr Cubit_ref;
+
+class Cubit : public virtual CORBA_Object
+{
+public:
+
+ static Cubit_ptr _duplicate(Cubit_ptr obj);
+ static Cubit_ptr _narrow(CORBA_Object_ptr obj);
+ static Cubit_ptr _nil();
+
+ virtual
+ CORBA_Octet Cubit_cube_octet (CORBA_Octet o,
+ CORBA_Environment &env);
+
+ virtual
+ CORBA_Short Cubit_cube_short (CORBA_Short s,
+ CORBA_Environment &env);
+
+ virtual
+ CORBA_Long Cubit_cube_long (CORBA_Long l,
+ CORBA_Environment &env);
+
+ virtual
+ Cubit_Many* Cubit_cube_struct (Cubit_Many &values,
+ CORBA_Environment &env);
+
+ virtual
+ Cubit_oneof* Cubit_cube_union (Cubit_oneof &values,
+ CORBA_Environment &env);
+
+ virtual
+ void Cubit_please_exit (CORBA_Environment &env);
+
+protected:
+ Cubit() { }
+ Cubit(STUB_Object *objref)
+ : CORBA_Object(objref) { }
+ virtual ~Cubit() { }
+
+
+};
+
+extern const CORBA_Char *Cubit__id; // type ID
+
+#ifdef _MSC_VER
+#pragma pack (pop) // VC++, go back to other padding rules
+#endif // VC++
+
+#endif // _CUBIT_HH
diff --git a/TAO/IIOP/tests/Cubit/TAO/cubitS.cpp b/TAO/IIOP/tests/Cubit/TAO/cubitS.cpp
new file mode 100644
index 00000000000..b153b71db1b
--- /dev/null
+++ b/TAO/IIOP/tests/Cubit/TAO/cubitS.cpp
@@ -0,0 +1,232 @@
+// @(#)cubitS.cpp 05/14/97
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// All Rights Reserved
+//
+// TEST: hand-written C-style "Cubit" stubs and "skeletons"
+//
+
+#include "cubitS.h"
+#include "cubitC.cpp"
+
+#include "connect.h"
+#include "params.h"
+
+#include "corba/debug.h" // ... and debugging
+#include "corba/optable.h" // TAO Dynamic Operation Table
+#include "method_db.i"
+#include "iiopobj.h"
+
+#if defined(CUBIT_USE_DYNAMIC_HASH)
+TAO_Dynamic_Hash_OpTable tao_cubit_optable(7); // Dynamic Operation Table
+#else
+TAO_Linear_OpTable tao_cubit_optable(7);
+#endif
+
+_skel_Cubit::_skel_Cubit(const char* obj_name)
+{
+ const char* mn = "_skel_Cubit::_skel_Cubit()";
+
+ // Initialize Method Database
+ initialize_method_db (&tao_cubit_optable);
+
+ char *type_id = "IDL:Cubit:1.0";
+ // CORBA_String type_id = "IDL:Cubit:1.0";
+ IIOP_Object *data;
+
+ CORBA_BOA_ptr oa = TAO_OA_PARAMS::instance()->oa();
+ if (oa == 0)
+ {
+ // We just have to assume that oa will be good, or we have to
+ // throw an exception. For now we "assume", but we'll
+ ACE_ERROR((LM_ERROR, "(%P|%t) %s Unable to locate a valid object adapter\n", mn));
+ return;
+ }
+
+ this->optable_ = &tao_cubit_optable;
+ data = new IIOP_Object(type_id);
+
+ data->profile.iiop_version.major = IIOP::MY_MAJOR;
+ data->profile.iiop_version.minor = IIOP::MY_MINOR;
+ data->profile.host = ACE_OS::strdup(oa->get_addr().get_host_name());
+ data->profile.port = oa->get_addr().get_port_number();
+ data->profile.object_key.length = ACE_OS::strlen(obj_name);
+ data->profile.object_key.maximum = data->profile.object_key.length;
+ data->profile.object_key.buffer = new CORBA_Octet [(size_t)data->profile.object_key.length+1];
+
+ ACE_OS::memcpy (data->profile.object_key.buffer,
+ obj_name,
+ data->profile.object_key.length+1);
+
+ this->set_parent(data);
+ this->sub_ = this;
+
+ if (oa->bind(data->profile.object_key, this) == -1)
+ {
+ ACE_ERROR((LM_ERROR, "(%P|%t) %s Unable to bind object to key '%s': %p\n", mn, data->profile.object_key.buffer));
+ return;
+ }
+}
+
+void
+_skel_Cubit::_cube_octet_skel(CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ CORBA_NVList_ptr nvlist;
+ CORBA_NamedValue_ptr nv;
+ CORBA_Any temp_value (_tc_CORBA_Octet);
+
+ req.orb()->create_list (0, nvlist);
+ nv = nvlist->add_value (0, temp_value, CORBA_ARG_IN, env);
+ dexc (env, "cube_octet, add value");
+
+ req.params (nvlist, env);
+ dexc (env, "cube_octet, get params");
+
+ // Call Implementation
+ CORBA_Octet *value = new CORBA_Octet;
+ Cubit *the_cubit = (Cubit*)obj->get_subclass();
+
+ *value = the_cubit->Cubit_cube_octet(*(CORBA_Octet *)nv->value()->value(), env);
+
+ CORBA_Any *any = new CORBA_Any (_tc_CORBA_Octet, value, CORBA_B_TRUE);
+
+ req.result (any, env);
+ dexc (env, "cube_octet, result");
+}
+
+void
+_skel_Cubit::_cube_short_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ CORBA_NVList_ptr nvlist;
+ CORBA_NamedValue_ptr nv;
+ CORBA_Any temp_value (_tc_CORBA_Short);
+
+ req.orb()->create_list (0, nvlist);
+ nv = nvlist->add_value (0, temp_value, CORBA_ARG_IN, env);
+ dexc (env, "cube_short, add_value");
+
+ req.params (nvlist, env);
+ dexc (env, "cube_short, get params");
+
+ // Call Implementation
+ CORBA_Short *value = new CORBA_Short;
+ Cubit *the_cubit = (Cubit*)obj->get_subclass();
+ *value = the_cubit->Cubit_cube_short(*(CORBA_Short *)nv->value ()->value (), env);
+
+ CORBA_Any *any = new CORBA_Any (_tc_CORBA_Short, value, CORBA_B_TRUE);
+
+ req.result (any, env);
+ dexc (env, "cube_short, result");
+}
+
+void
+_skel_Cubit::_cube_long_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ CORBA_NVList_ptr nvlist;
+ CORBA_NamedValue_ptr nv;
+ CORBA_Any temp_value (_tc_CORBA_Long);
+
+ req.orb()->create_list (0, nvlist);
+ nv = nvlist->add_value (0, temp_value, CORBA_ARG_IN, env);
+ dexc (env, "cube_long, add_value");
+
+ req.params (nvlist, env);
+ dexc (env, "cube_long, get params");
+
+ // Call Implementation
+ CORBA_Long *value = new CORBA_Long;
+ Cubit *the_cubit = (Cubit*)obj->get_subclass();
+ *value = the_cubit->Cubit_cube_long(*(CORBA_Long *)nv->value ()->value (), env);
+
+ CORBA_Any *any =
+ new CORBA_Any (_tc_CORBA_Long, value, CORBA_B_TRUE);
+
+ req.result (any, env);
+ dexc (env, "cube_long, result");
+}
+
+void
+_skel_Cubit::_cube_struct_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ CORBA_NVList_ptr nvlist;
+ CORBA_NamedValue_ptr nv;
+ CORBA_Any temp_value (TC_Cubit_Many);
+
+ req.orb()->create_list (0, nvlist);
+ nv = nvlist->add_value (0, temp_value, CORBA_ARG_IN, env);
+ dexc (env, "cube_struct, add_value");
+
+ req.params (nvlist, env);
+ dexc (env, "cube_struct, get params");
+
+ // Call Implementation
+ Cubit_Many *value;
+ Cubit *the_cubit = (Cubit*)obj->get_subclass();
+ value = the_cubit->Cubit_cube_struct(*(Cubit_Many*)nv->value()->value(), env);
+
+ Cubit_Many *retval = new Cubit_Many;
+ retval->o = (CORBA_Octet)value->o;
+ retval->s = (CORBA_Short)value->s;
+ retval->l = value->l;
+
+ // dmsg2 ("cube struct.o, %d -> %d", value->o, retval->o);
+ // dmsg2 ("cube struct.s, %d -> %d", value->s, retval->s);
+ // dmsg2 ("cube struct.l, %d -> %d", value->l, retval->l);
+
+ CORBA_Any *any = new CORBA_Any (TC_Cubit_Many, retval, CORBA_B_TRUE);
+
+ req.result (any, env);
+ dexc (env, "cube_struct, result");
+}
+
+void
+_skel_Cubit::_cube_union_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ CORBA_NVList_ptr nvlist;
+ CORBA_NamedValue_ptr nv;
+ CORBA_Any temp_value (TC_Cubit_oneof);
+
+ req.orb()->create_list (0, nvlist);
+ nv = nvlist->add_value (0, temp_value, CORBA_ARG_IN, env);
+ dexc (env, "cube_union_3rd, add_value");
+
+ req.params (nvlist, env);
+ dexc (env, "cube_union_3rd, get params");
+
+ // Call Implementation
+ Cubit_oneof *v;
+ Cubit *the_cubit = (Cubit*)obj->get_subclass();
+ v = the_cubit->Cubit_cube_union(*(Cubit_oneof *)nv->value ()->value (), env);
+
+ Cubit_oneof *r = new Cubit_oneof;
+ r->_disc = v->_disc;
+ r->o = (CORBA_Octet) (v->o);
+ r->s = (CORBA_Short) (v->s);
+ r->l = v->l;
+ r->cm.o = (CORBA_Octet) (v->cm.o);
+ r->cm.s = (CORBA_Short) (v->cm.s);
+ r->cm.l = v->cm.l;
+
+ CORBA_Any *any = new CORBA_Any (TC_Cubit_oneof, r, CORBA_B_TRUE);
+
+ req.result (any, env);
+ dexc (env, "cube_struct, result");
+}
+
+void
+_skel_Cubit::_please_exit_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ Cubit *the_cubit = (Cubit*)obj->get_subclass();
+ the_cubit->Cubit_please_exit(env);
+}
diff --git a/TAO/IIOP/tests/Cubit/TAO/cubitS.h b/TAO/IIOP/tests/Cubit/TAO/cubitS.h
new file mode 100644
index 00000000000..84c07b741b0
--- /dev/null
+++ b/TAO/IIOP/tests/Cubit/TAO/cubitS.h
@@ -0,0 +1,82 @@
+// @(#)cubitS.h 05/14/97
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// All Rights Reserved
+//
+// Modified version of Cubit Example written by Sun Microsystems Inc.
+// Modified by: Brian Mendel
+
+/**************************************************************************
+This file has been hand-crafted to work with the ORB API of the SUN's IIOP
+implementation
+***************************************************************************/
+
+#ifndef _SKEL_CUBIT_HH
+#define _SKEL_CUBIT_HH
+
+#include "cubitC.h"
+
+class _skel_Cubit;
+typedef _skel_Cubit *_skel_Cubit_ptr;
+typedef _skel_Cubit_ptr _skel_Cubit_ref;
+
+class _skel_Cubit : public Cubit
+{
+public:
+ virtual
+ CORBA_Octet Cubit_cube_octet (CORBA_Octet o,
+ CORBA_Environment &env) = 0;
+ static
+ void _cube_octet_skel(CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env);
+
+ virtual
+ CORBA_Short Cubit_cube_short (CORBA_Short s,
+ CORBA_Environment &env) = 0;
+
+ static
+ void _cube_short_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env);
+
+ virtual
+ CORBA_Long Cubit_cube_long (CORBA_Long l,
+ CORBA_Environment &env) = 0;
+
+ static
+ void _cube_long_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env);
+
+ virtual
+ Cubit_Many* Cubit_cube_struct (Cubit_Many &values,
+ CORBA_Environment &env) = 0;
+
+ static
+ void _cube_struct_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env);
+
+ virtual
+ Cubit_oneof* Cubit_cube_union (Cubit_oneof &values,
+ CORBA_Environment &env) = 0;
+
+ static
+ void _cube_union_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env);
+
+ virtual
+ void Cubit_please_exit (CORBA_Environment &env) = 0;
+
+ static
+ void _please_exit_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env);
+protected:
+ _skel_Cubit(const char* obj_name = 0);
+ virtual ~_skel_Cubit() { }
+
+};
+
+#endif // _SKEL_CUBIT_HH
diff --git a/TAO/IIOP/tests/Cubit/TAO/cubit_i.cpp b/TAO/IIOP/tests/Cubit/TAO/cubit_i.cpp
new file mode 100644
index 00000000000..ae22b7cd12c
--- /dev/null
+++ b/TAO/IIOP/tests/Cubit/TAO/cubit_i.cpp
@@ -0,0 +1,91 @@
+// @(#)cubit_i.cpp 05/14/97
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// All Rights Reserved
+//
+// TEST: hand-written Cubit Implementation
+//
+// Modified version of Cubit Example written by Sun Microsystems Inc.
+// Modified by: Brian Mendel
+
+#include "cubit_i.h"
+
+#include <corba/boa.h> // ... and skeletons
+#include <corba/debug.h> // ... and debugging
+
+#include "connect.h"
+#include "params.h"
+
+Cubit_i::Cubit_i(const char* obj_name)
+: _skel_Cubit(obj_name)
+{
+}
+
+Cubit_i::~Cubit_i()
+{
+}
+
+CORBA_Octet
+Cubit_i::Cubit_cube_octet (CORBA_Octet o,
+ CORBA_Environment &env)
+{
+
+ return (CORBA_Octet) (o * o * o);
+}
+
+CORBA_Short
+Cubit_i::Cubit_cube_short (CORBA_Short s,
+ CORBA_Environment &env)
+{
+ return (CORBA_Short) (s * s * s);
+}
+
+
+CORBA_Long
+Cubit_i::Cubit_cube_long (CORBA_Long l,
+ CORBA_Environment &env)
+{
+ return (CORBA_Long) (l * l * l);
+}
+
+Cubit_Many*
+Cubit_i::Cubit_cube_struct (Cubit_Many &values,
+ CORBA_Environment &env)
+{
+ values.o = values.o * values.o * values.o;
+ values.s = values.s * values.s * values.s;
+ values.l = values.l * values.l * values.l;
+
+ return &values;
+}
+
+Cubit_oneof*
+Cubit_i::Cubit_cube_union (Cubit_oneof &values,
+ CORBA_Environment &env)
+{
+ switch (values._disc) {
+ case e_0th:
+ values.o = (CORBA_Octet) (values.o * values.o * values.o);
+ break;
+ case e_1st:
+ values.s = (CORBA_Short) (values.s * values.s * values.s);
+ break;
+ case e_2nd:
+ values.l = values.l * values.l * values.l;
+ break;
+ case e_3rd:
+ default:
+ values.cm.o = (CORBA_Octet) (values.cm.o * values.cm.o * values.cm.o);
+ values.cm.s = (CORBA_Short) (values.cm.s * values.cm.s * values.cm.s);
+ values.cm.l = values.cm.l * values.cm.l * values.cm.l;
+ }
+ return &values;
+}
+
+void Cubit_i::Cubit_please_exit (CORBA_Environment &env)
+{
+ TAO_OA_Parameters* params = TAO_OA_PARAMS::instance();
+
+ dmsg ("I've been asked to shut down...");
+ params->oa()->please_shutdown(env);
+ dexc (env, "please_exit, please_shutdown");
+}
diff --git a/TAO/IIOP/tests/Cubit/TAO/cubit_i.h b/TAO/IIOP/tests/Cubit/TAO/cubit_i.h
new file mode 100644
index 00000000000..6f4bee0d486
--- /dev/null
+++ b/TAO/IIOP/tests/Cubit/TAO/cubit_i.h
@@ -0,0 +1,54 @@
+// @(#)cubit_i.cpp 05/14/97
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// All Rights Reserved
+//
+// TEST: hand-written Cubit Implementation
+//
+// Modified version of Cubit Example written by Sun Microsystems Inc.
+// Modified by: Brian Mendel
+
+/**************************************************************************
+This file has been hand-crafted to work with the ORB API of the SUN's IIOP
+implementation
+***************************************************************************/
+
+#ifndef _CUBIT_I_HH
+#define _CUBIT_I_HH
+
+#include "cubitS.h"
+
+class Cubit_i;
+typedef Cubit_i *Cubit_i_ptr;
+typedef Cubit_i_ptr Cubit_i_ref;
+
+class Cubit_i : public _skel_Cubit
+{
+public:
+ Cubit_i(const char* obj_name = 0);
+ ~Cubit_i();
+
+ virtual
+ CORBA_Octet Cubit_cube_octet (CORBA_Octet o,
+ CORBA_Environment &env);
+
+ virtual
+ CORBA_Short Cubit_cube_short (CORBA_Short s,
+ CORBA_Environment &env);
+
+ virtual
+ CORBA_Long Cubit_cube_long (CORBA_Long l,
+ CORBA_Environment &env);
+
+ virtual
+ Cubit_Many* Cubit_cube_struct (Cubit_Many &values,
+ CORBA_Environment &env);
+
+ virtual
+ Cubit_oneof* Cubit_cube_union (Cubit_oneof &values,
+ CORBA_Environment &env);
+
+ virtual
+ void Cubit_please_exit (CORBA_Environment &env);
+};
+
+#endif // _CUBIT_I_HH
diff --git a/TAO/IIOP/tests/Cubit/TAO/method_db.i b/TAO/IIOP/tests/Cubit/TAO/method_db.i
new file mode 100644
index 00000000000..6b77cdf040a
--- /dev/null
+++ b/TAO/IIOP/tests/Cubit/TAO/method_db.i
@@ -0,0 +1,67 @@
+// @(#)method_db.i 05/14/97
+
+// This file provides a way of initializing the method database
+// Written by: Brian Mendel
+
+#include "cubitS.h"
+
+static void
+is_a_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ CORBA_NVList_ptr nvlist;
+ CORBA_NamedValue_ptr nv;
+ CORBA_Any temp_value (_tc_CORBA_String);
+
+ req.orb()->create_list (0, nvlist);
+ nv = nvlist->add_value (0, temp_value, CORBA_ARG_IN, env);
+
+ req.params (nvlist, env);
+ if (env.exception () != 0)
+ {
+ dexc (env, "is_a_skel, get params");
+ return;
+ }
+
+ CORBA_Boolean *retval;
+ CORBA_String value = *(CORBA_String *) nv->value()->value();
+
+ if (ACE_OS::strcmp ((char*)value, "IDL:Cubit:1.0") == 0
+ || ACE_OS::strcmp ((char *)value, _tc_CORBA_Object->id (env)) == 0)
+ retval = new CORBA_Boolean (CORBA_B_TRUE);
+ else
+ retval = new CORBA_Boolean (CORBA_B_FALSE);
+
+ CORBA_Any *any = new CORBA_Any (_tc_CORBA_Boolean, retval, CORBA_B_TRUE);
+
+ req.result (any, env);
+ dexc (env, "_is_a, result");
+}
+
+
+struct method_db
+{
+ CORBA_String opname;
+ TAO_Skeleton skel_ptr;
+};
+
+static const method_db cubit_operations[] = {
+ { "_is_a", &is_a_skel },
+ { "cube_octet", &_skel_Cubit::_cube_octet_skel },
+ { "cube_short", &_skel_Cubit::_cube_short_skel },
+ { "cube_long", &_skel_Cubit::_cube_long_skel },
+ { "cube_struct", &_skel_Cubit::_cube_struct_skel },
+ { "cube_union", &_skel_Cubit::_cube_union_skel },
+ { "please_exit", &_skel_Cubit::_please_exit_skel },
+ { 0, 0 }
+};
+
+
+void initialize_method_db (TAO_Operation_Table *the_optable)
+{
+ for (int ndx = 0; ndx < 7; ndx++)
+ the_optable->bind(cubit_operations[ndx].opname,
+ cubit_operations[ndx].skel_ptr);
+
+}
diff --git a/TAO/IIOP/tests/Cubit/TAO/svr.cpp b/TAO/IIOP/tests/Cubit/TAO/svr.cpp
new file mode 100644
index 00000000000..0e537bc6206
--- /dev/null
+++ b/TAO/IIOP/tests/Cubit/TAO/svr.cpp
@@ -0,0 +1,212 @@
+// @(#)svr.cpp 05/14/97
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// All Rights Reserved
+//
+// TEST: simple IIOP server for "cubit.idl" interface.
+//
+// Starts up, builds an objref, prints its string in debug mode,
+// listens for messages, responds to them.
+//
+// Modified version of Cubit Example written by Sun Microsystems Inc.
+// Modified by: Brian Mendel
+
+#include "ace/Get_Opt.h"
+#include "ace/Log_Msg.h"
+
+#include "corba/orb.h"
+#include "corba/debug.h"
+#include "connect.h"
+
+#include "cubit_i.h"
+
+extern void
+print_exception (const CORBA_Exception *, const char *, FILE *f=stdout);
+
+// Global Variables
+CORBA_String key = (CORBA_String)"key0";
+int num_of_objs = 1;
+
+// = TITLE
+// Parses the command line arguments and returns an error status
+//
+// = DESCRIPTION
+// This method parses the command line arguments
+int parse_args(int argc, char *argv[])
+{
+ ACE_Get_Opt opts (argc, argv, "dk:n:");
+ int c;
+
+ while ((c = opts ()) != -1)
+ switch (c) {
+
+ case 'd': // debug flag
+ TAO_debug_level++;
+ continue;
+
+ case 'k': // key (str)
+ key = (CORBA_String) opts.optarg;
+ continue;
+
+ case 'n': // idle seconds b4 exit
+ num_of_objs = ACE_OS::atoi(opts.optarg);
+ continue;
+
+ case '?':
+ default:
+ ACE_OS::fprintf (stderr, "usage: %s"
+ " [-d]"
+ " [-k {object_key}]"
+ "\n", argv [0]
+ );
+ return 1;
+ }
+
+ return 0; // Indicates successful parsing of command line
+}
+
+
+//
+// Standard command line parsing utilities used.
+//
+int
+main (int argc, char *argv[])
+{
+ CORBA_Environment env;
+ CORBA_Object_ptr obj = 0;
+ CORBA_ORB_ptr orb_ptr;
+ CORBA_BOA_ptr oa_ptr;
+ char *orb_name = "internet";
+ int idle = -1;
+
+ orb_ptr = CORBA_ORB_init (argc, argv, orb_name, env);
+ if (env.exception () != 0) {
+ print_exception (env.exception (), "ORB init");
+ return 1;
+ }
+
+ // Initialize the Basic Object Adapter
+ oa_ptr = orb_ptr->BOA_init(argc, argv, "ROA");
+ if (oa_ptr == 0)
+ ACE_ERROR_RETURN((LM_ERROR, "(%P|%t) Unable to initialize the BOA.\n"), 1);
+
+
+ //
+ // Parse remaining command line and verify parameters.
+ //
+ parse_args(argc, argv);
+
+ // Create implementation object with user specified key
+ Cubit_i_ptr *my_cubit = new Cubit_i_ptr[num_of_objs];
+ for (int ndx = 0; ndx < num_of_objs; ndx++)
+ {
+ CORBA_String obj_str = CORBA_string_alloc(ACE_OS::strlen ((char *)key)+2);
+ sprintf(obj_str, "%s%d", (char*)key, ndx);
+ my_cubit[ndx] = new Cubit_i(obj_str);
+ if (my_cubit[ndx] == 0)
+ ACE_ERROR_RETURN((LM_ERROR, "(%P|%t) Unable to create implementation object&d\n", ndx), 2);
+
+ if (TAO_debug_level >= 1)
+ {
+ // Why are we getting the BOA_ptr from here when we've already
+ // got it above?
+ CORBA_OctetSeq obj_key;
+ obj_key.buffer = (CORBA_Octet *) obj_str;
+ obj_key.length = obj_key.maximum = ACE_OS::strlen (obj_str);
+
+ if (oa_ptr->find(obj_key, obj) == -1)
+ ACE_ERROR_RETURN((LM_ERROR, "(%P|%t) Unable to locate object with key '%s', %p\n", key), 3);
+
+ //
+ // Stringify the objref we'll be implementing, and
+ // print it to stdout. Someone will take that string
+ // and give it to some client. Then release the object.
+ //
+ CORBA_String str;
+
+ str = orb_ptr->object_to_string (obj, env);
+ if (env.exception () != 0) {
+ print_exception (env.exception (), "object2string");
+ return 1;
+ }
+ ACE_OS::puts ((char *)str);
+ ACE_OS::fflush (stdout);
+ dmsg1 ("Object Created at: '%ul'", obj);
+ dmsg1 ("listening as object '%s'", str);
+
+ }
+ CORBA_string_free(obj_str);
+ }
+// Cubit_i_ptr my_cubit = new Cubit_i(key);
+// if (my_cubit1 == 0)
+// ACE_ERROR_RETURN((LM_ERROR, "(%P|%t) Unable to create implementation object\n"), 2);
+
+/* if (TAO_debug_level >= 1)
+ {
+ // Why are we getting the BOA_ptr from here when we've already
+ // got it above?
+ CORBA_OctetSeq obj_key;
+ obj_key.buffer = (CORBA_Octet *) key;
+ obj_key.length = obj_key.maximum = ACE_OS::strlen ((char *)key);
+
+ if (oa_ptr->find(obj_key, obj) == -1)
+ ACE_ERROR_RETURN((LM_ERROR, "(%P|%t) Unable to locate object with key '%s', %p\n", key), 3);
+
+ //
+ // Stringify the objref we'll be implementing, and
+ // print it to stdout. Someone will take that string
+ // and give it to some client. Then release the object.
+ //
+ CORBA_String str;
+
+ str = orb_ptr->object_to_string (obj, env);
+ if (env.exception () != 0) {
+ print_exception (env.exception (), "object2string");
+ return 1;
+ }
+ ACE_OS::puts ((char *)str);
+ ACE_OS::fflush (stdout);
+ dmsg1 ("listening as object '%s'", str);
+
+ obj_key.buffer = (CORBA_Octet *)"key1";
+ obj_key.length = obj_key.maximum = 4;
+ if (oa_ptr->find(obj_key, obj) == -1)
+ ACE_ERROR_RETURN((LM_ERROR, "(%P|%t) Unable to locate object with key '%s', %p\n", key), 3);
+
+ str = orb_ptr->object_to_string (obj, env);
+ if (env.exception () != 0) {
+ print_exception (env.exception (), "object2string");
+ return 1;
+ }
+ ACE_OS::puts ((char *)str);
+ ACE_OS::fflush (stdout);
+ dmsg1 ("listening as object '%s'", str);
+ }
+*/
+ // Handle requests for this object until we're killed, or one of
+ // the methods asks us to exit.
+ //
+ int terminationStatus = 0;
+
+
+#if !defined(USE_HOMEBREW_EVENT_LOOP)
+ ACE_Service_Config::run_reactor_event_loop();
+#else
+ while (1)
+ {
+ int result = params->reactor()->handle_events ();
+
+ if (result == -1)
+ {
+ terminationStatus = -1;
+ break;
+ }
+ }
+#endif
+
+ //
+ // Shut down the OA -- recycles all underlying resources (e.g. file
+ // descriptors, etc).
+ //
+ oa_ptr->clean_shutdown (env);
+ return 0;
+}
diff --git a/TAO/IIOP/tests/Cubit/TAO/test.mak b/TAO/IIOP/tests/Cubit/TAO/test.mak
new file mode 100644
index 00000000000..136b00ac904
--- /dev/null
+++ b/TAO/IIOP/tests/Cubit/TAO/test.mak
@@ -0,0 +1,456 @@
+# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+!IF "$(CFG)" == ""
+CFG=server - Win32 Debug
+!MESSAGE No configuration specified. Defaulting to server - Win32 Debug.
+!ENDIF
+
+!IF "$(CFG)" != "client - Win32 Release" && "$(CFG)" != "client - Win32 Debug"\
+ && "$(CFG)" != "server - Win32 Release" && "$(CFG)" != "server - Win32 Debug"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE on this makefile
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "test.mak" CFG="server - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "client - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "client - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "server - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "server - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+!ERROR An invalid configuration is specified.
+!ENDIF
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+################################################################################
+# Begin Project
+RSC=rc.exe
+CPP=cl.exe
+
+!IF "$(CFG)" == "client - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "client\Release"
+# PROP BASE Intermediate_Dir "client\Release"
+# PROP BASE Target_Dir "client"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir "client"
+OUTDIR=.
+INTDIR=.\Release
+
+ALL : "$(OUTDIR)\client.exe"
+
+CLEAN :
+ -@erase "$(INTDIR)\clnt.obj"
+ -@erase "$(INTDIR)\cubitC.obj"
+ -@erase "$(OUTDIR)\client.exe"
+
+"$(INTDIR)" :
+ if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)"
+
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\proto\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "..\proto\include" /D "WIN32" /D "NDEBUG"\
+ /D "_CONSOLE" /Fp"$(INTDIR)/client.pch" /YX /Fo"$(INTDIR)/" /c
+CPP_OBJS=.\Release/
+CPP_SBRS=.\.
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/client.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib ..\lib\TAO.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+LINK32_FLAGS=ace.lib ..\lib\TAO.lib kernel32.lib user32.lib gdi32.lib\
+ winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib\
+ uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no\
+ /pdb:"$(OUTDIR)/client.pdb" /machine:I386 /out:"$(OUTDIR)/client.exe"
+LINK32_OBJS= \
+ "$(INTDIR)\clnt.obj" \
+ "$(INTDIR)\cubitC.obj"
+
+"$(OUTDIR)\client.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "client - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "client\Debug"
+# PROP BASE Intermediate_Dir "client\Debug"
+# PROP BASE Target_Dir "client"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir "client"
+OUTDIR=.
+INTDIR=.\Debug
+
+ALL : "$(OUTDIR)\client.exe"
+
+CLEAN :
+ -@erase "$(INTDIR)\clnt.obj"
+ -@erase "$(INTDIR)\cubitC.obj"
+ -@erase "$(INTDIR)\vc40.idb"
+ -@erase "$(INTDIR)\vc40.pdb"
+ -@erase "$(OUTDIR)\client.exe"
+ -@erase "$(OUTDIR)\client.ilk"
+ -@erase "$(OUTDIR)\client.pdb"
+
+"$(INTDIR)" :
+ if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)"
+
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\proto\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
+CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\proto\include" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /Fp"$(INTDIR)/client.pch" /YX /Fo"$(INTDIR)/"\
+ /Fd"$(INTDIR)/" /c
+CPP_OBJS=.\Debug/
+CPP_SBRS=.\.
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/client.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+# ADD LINK32 ace.lib ..\lib\TAO.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+LINK32_FLAGS=ace.lib ..\lib\TAO.lib kernel32.lib user32.lib gdi32.lib\
+ winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib\
+ uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes\
+ /pdb:"$(OUTDIR)/client.pdb" /debug /machine:I386 /out:"$(OUTDIR)/client.exe"
+LINK32_OBJS= \
+ "$(INTDIR)\clnt.obj" \
+ "$(INTDIR)\cubitC.obj"
+
+"$(OUTDIR)\client.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "server - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "server\Release"
+# PROP BASE Intermediate_Dir "server\Release"
+# PROP BASE Target_Dir "server"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir "server"
+OUTDIR=.
+INTDIR=.\Release
+
+ALL : "$(OUTDIR)\server.exe"
+
+CLEAN :
+ -@erase "$(INTDIR)\cubit_i.obj"
+ -@erase "$(INTDIR)\cubitS.obj"
+ -@erase "$(INTDIR)\svr.obj"
+ -@erase "$(OUTDIR)\server.exe"
+
+"$(INTDIR)" :
+ if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)"
+
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\proto\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "..\proto\include" /D "WIN32" /D "NDEBUG"\
+ /D "_CONSOLE" /Fp"$(INTDIR)/server.pch" /YX /Fo"$(INTDIR)/" /c
+CPP_OBJS=.\Release/
+CPP_SBRS=.\.
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/server.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib ..\lib\TAO.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+LINK32_FLAGS=ace.lib ..\lib\TAO.lib kernel32.lib user32.lib gdi32.lib\
+ winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib\
+ uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no\
+ /pdb:"$(OUTDIR)/server.pdb" /machine:I386 /out:"$(OUTDIR)/server.exe"
+LINK32_OBJS= \
+ "$(INTDIR)\cubit_i.obj" \
+ "$(INTDIR)\cubitS.obj" \
+ "$(INTDIR)\svr.obj"
+
+"$(OUTDIR)\server.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "server - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "server\Debug"
+# PROP BASE Intermediate_Dir "server\Debug"
+# PROP BASE Target_Dir "server"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir "server"
+OUTDIR=.
+INTDIR=.\Debug
+
+ALL : "$(OUTDIR)\server.exe"
+
+CLEAN :
+ -@erase "$(INTDIR)\cubit_i.obj"
+ -@erase "$(INTDIR)\cubitS.obj"
+ -@erase "$(INTDIR)\svr.obj"
+ -@erase "$(INTDIR)\vc40.idb"
+ -@erase "$(INTDIR)\vc40.pdb"
+ -@erase "$(OUTDIR)\server.exe"
+ -@erase "$(OUTDIR)\server.ilk"
+ -@erase "$(OUTDIR)\server.pdb"
+
+"$(INTDIR)" :
+ if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)"
+
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\proto\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
+CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\proto\include" /D "WIN32" /D\
+ "_DEBUG" /D "_CONSOLE" /Fp"$(INTDIR)/server.pch" /YX /Fo"$(INTDIR)/"\
+ /Fd"$(INTDIR)/" /c
+CPP_OBJS=.\Debug/
+CPP_SBRS=.\.
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/server.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+# ADD LINK32 ace.lib ..\lib\TAO.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+LINK32_FLAGS=ace.lib ..\lib\TAO.lib kernel32.lib user32.lib gdi32.lib\
+ winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib\
+ uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes\
+ /pdb:"$(OUTDIR)/server.pdb" /debug /machine:I386 /out:"$(OUTDIR)/server.exe"
+LINK32_OBJS= \
+ "$(INTDIR)\cubit_i.obj" \
+ "$(INTDIR)\cubitS.obj" \
+ "$(INTDIR)\svr.obj"
+
+"$(OUTDIR)\server.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ENDIF
+
+.c{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.cpp{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.cxx{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.c{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+.cpp{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+.cxx{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+################################################################################
+# Begin Target
+
+# Name "client - Win32 Release"
+# Name "client - Win32 Debug"
+
+!IF "$(CFG)" == "client - Win32 Release"
+
+!ELSEIF "$(CFG)" == "client - Win32 Debug"
+
+!ENDIF
+
+################################################################################
+# Begin Source File
+
+SOURCE=.\clnt.cpp
+DEP_CPP_CLNT_=\
+ ".\cubitC.h"\
+ {$(INCLUDE)}"\ace\ACE.h"\
+ {$(INCLUDE)}"\ace\ACE.i"\
+ {$(INCLUDE)}"\ace\Auto_Ptr.cpp"\
+ {$(INCLUDE)}"\ace\Auto_Ptr.h"\
+ {$(INCLUDE)}"\ace\Auto_Ptr.i"\
+ {$(INCLUDE)}"\ace\config-win32-common.h"\
+ {$(INCLUDE)}"\ace\config.h"\
+ {$(INCLUDE)}"\ace\Get_Opt.h"\
+ {$(INCLUDE)}"\ace\Get_Opt.i"\
+ {$(INCLUDE)}"\ace\Log_Msg.h"\
+ {$(INCLUDE)}"\ace\Log_Priority.h"\
+ {$(INCLUDE)}"\ace\Log_Record.h"\
+ {$(INCLUDE)}"\ace\Log_Record.i"\
+ {$(INCLUDE)}"\ace\OS.h"\
+ {$(INCLUDE)}"\ace\OS.i"\
+ {$(INCLUDE)}"\ace\SString.h"\
+ {$(INCLUDE)}"\ace\SString.i"\
+ {$(INCLUDE)}"\ace\stdcpp.h"\
+ {$(INCLUDE)}"\ace\Trace.h"\
+ {$(INCLUDE)}"\ace\ws2tcpip.h"\
+
+NODEP_CPP_CLNT_=\
+ ".\corba\orb.h"\
+ ".\corba\stub.h"\
+
+
+"$(INTDIR)\clnt.obj" : $(SOURCE) $(DEP_CPP_CLNT_) "$(INTDIR)"
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\cubitC.cpp
+DEP_CPP_CUBIT=\
+ ".\cubitC.h"\
+
+NODEP_CPP_CUBIT=\
+ ".\corba\orb.h"\
+ ".\corba\stub.h"\
+
+
+"$(INTDIR)\cubitC.obj" : $(SOURCE) $(DEP_CPP_CUBIT) "$(INTDIR)"
+
+
+# End Source File
+# End Target
+################################################################################
+# Begin Target
+
+# Name "server - Win32 Release"
+# Name "server - Win32 Debug"
+
+!IF "$(CFG)" == "server - Win32 Release"
+
+!ELSEIF "$(CFG)" == "server - Win32 Debug"
+
+!ENDIF
+
+################################################################################
+# Begin Source File
+
+SOURCE=.\cubitS.cpp
+DEP_CPP_CUBITS=\
+ ".\cubitC.cpp"\
+ ".\cubitC.h"\
+ ".\cubitS.h"\
+ ".\method_db.i"\
+
+NODEP_CPP_CUBITS=\
+ ".\connect.h"\
+ ".\corba\debug.h"\
+ ".\corba\optable.h"\
+ ".\corba\orb.h"\
+ ".\corba\stub.h"\
+ ".\iiopobj.h"\
+ ".\params.h"\
+
+
+"$(INTDIR)\cubitS.obj" : $(SOURCE) $(DEP_CPP_CUBITS) "$(INTDIR)"
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\cubit_i.cpp
+DEP_CPP_CUBIT_=\
+ ".\cubit_i.h"\
+ ".\cubitC.h"\
+ ".\cubitS.h"\
+
+NODEP_CPP_CUBIT_=\
+ ".\connect.h"\
+ ".\corba\orb.h"\
+ ".\corba\stub.h"\
+ ".\params.h"\
+
+
+"$(INTDIR)\cubit_i.obj" : $(SOURCE) $(DEP_CPP_CUBIT_) "$(INTDIR)"
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\svr.cpp
+DEP_CPP_SVR_C=\
+ ".\cubit_i.h"\
+ ".\cubitC.h"\
+ ".\cubitS.h"\
+ {$(INCLUDE)}"\ace\ACE.h"\
+ {$(INCLUDE)}"\ace\ACE.i"\
+ {$(INCLUDE)}"\ace\Auto_Ptr.cpp"\
+ {$(INCLUDE)}"\ace\Auto_Ptr.h"\
+ {$(INCLUDE)}"\ace\Auto_Ptr.i"\
+ {$(INCLUDE)}"\ace\config-win32-common.h"\
+ {$(INCLUDE)}"\ace\config.h"\
+ {$(INCLUDE)}"\ace\Get_Opt.h"\
+ {$(INCLUDE)}"\ace\Get_Opt.i"\
+ {$(INCLUDE)}"\ace\Log_Msg.h"\
+ {$(INCLUDE)}"\ace\Log_Priority.h"\
+ {$(INCLUDE)}"\ace\Log_Record.h"\
+ {$(INCLUDE)}"\ace\Log_Record.i"\
+ {$(INCLUDE)}"\ace\OS.h"\
+ {$(INCLUDE)}"\ace\OS.i"\
+ {$(INCLUDE)}"\ace\SString.h"\
+ {$(INCLUDE)}"\ace\SString.i"\
+ {$(INCLUDE)}"\ace\stdcpp.h"\
+ {$(INCLUDE)}"\ace\Trace.h"\
+ {$(INCLUDE)}"\ace\ws2tcpip.h"\
+
+NODEP_CPP_SVR_C=\
+ ".\connect.h"\
+ ".\corba\debug.h"\
+ ".\corba\orb.h"\
+ ".\corba\stub.h"\
+
+
+"$(INTDIR)\svr.obj" : $(SOURCE) $(DEP_CPP_SVR_C) "$(INTDIR)"
+
+
+# End Source File
+# End Target
+# End Project
+################################################################################
diff --git a/TAO/IIOP/tests/Cubit/TAO/test.mdp b/TAO/IIOP/tests/Cubit/TAO/test.mdp
new file mode 100644
index 00000000000..21a6ca18114
--- /dev/null
+++ b/TAO/IIOP/tests/Cubit/TAO/test.mdp
Binary files differ
diff --git a/TAO/IIOP/tests/Cubit/TAO/test1.cpp b/TAO/IIOP/tests/Cubit/TAO/test1.cpp
new file mode 100644
index 00000000000..a27c29ee378
--- /dev/null
+++ b/TAO/IIOP/tests/Cubit/TAO/test1.cpp
@@ -0,0 +1,390 @@
+// @(#)test1.cpp 1.4 95/09/28
+// Copyright 1995 by Sun Microsystems, Inc.
+// All Rights Reserved
+//
+// TEST stubs for "test1"
+//
+
+#include <stdio.h>
+
+#include "test1.h"
+
+
+//
+// Define all the stubs ... it's a lot less error prone to do it with
+// macros than by hand!
+//
+// NOTE: the "calldata" is exported for use by the skeletons. At some
+// point skeletons will probably be fully abstracted; for now they aren't.
+//
+// Also, for some reason, name mangling is changed by the explicit
+// declaration as "extern" -- if it's not done, linking fails.
+//
+#define DEFINE_TEST3(typename, truetype, truetypename) \
+ static const TAO_Param_Data test1_ ## typename ## _paramdata [4] = { \
+ { _tc_CORBA_ ## truetypename, PARAM_RETURN, 0 }, \
+ { _tc_CORBA_ ## truetypename, PARAM_IN, 0 }, \
+ { _tc_CORBA_ ## truetypename, PARAM_OUT, 0 }, \
+ { _tc_CORBA_ ## truetypename, PARAM_INOUT, 0 }, \
+ }; \
+ \
+ extern const TAO_Call_Data test1_ ## typename ## _calldata; \
+ \
+ const TAO_Call_Data test1_ ## typename ## _calldata = { \
+ "test_" #typename, CORBA_B_TRUE, \
+ 4, &test1_ ## typename ## _paramdata [0], \
+ 0, 0, \
+ }; \
+ \
+ CORBA_ ## truetype \
+ test1_test_ ## typename (test1_ptr target, \
+ CORBA_ ## truetype in_a1, \
+ CORBA_ ## truetype &out_a2, \
+ CORBA_ ## truetype &inout_a3, \
+ CORBA_Environment &env) { \
+ CORBA_ ## truetype _retval; \
+ STUB_Object *_obj; \
+ if (target->QueryInterface (IID_STUB_Object, (void **)&_obj) \
+ != NOERROR) \
+ env.exception (new CORBA_INV_OBJREF (COMPLETED_NO)); \
+ else { \
+ _obj->do_call (env, &test1_ ## typename ## _calldata, \
+ &_retval, &in_a1, &out_a2, &inout_a3); \
+ _obj->Release (); \
+ } \
+ return _retval; \
+ }
+
+// changed extern const calldata test1_ ## typename ## _calldata;
+// to const calldata test1_ ## typename ## _calldata; \
+
+// changed CORBA_ ## truetype _retval = 0; to changed CORBA_ ## truetype _retval;
+
+#define DEFINE_TEST(typename, truetype) \
+ DEFINE_TEST3(typename, truetype, truetype)
+
+
+//
+// Generate a system exception, passing an operation ID that's
+// not allowed by IIOP (much less this interface) and verifying
+// that the server returns some kind of system exception.
+//
+static const TAO_Call_Data illegal_calldata = {
+ "+_illegal", CORBA_B_TRUE,
+ 0, 0,
+ 0, 0
+};
+
+void
+test_illegal (test1_ptr target, CORBA_Environment &env)
+{
+ STUB_Object *data;
+
+ if (target->QueryInterface (IID_STUB_Object, (void **)&data)
+ != NOERROR)
+ env.exception (new CORBA_INV_OBJREF (COMPLETED_NO));
+ else {
+ data->do_call (env, &illegal_calldata
+ );
+ data->Release ();
+ }
+}
+
+
+extern const TAO_Call_Data test1_void_calldata;
+const TAO_Call_Data test1_void_calldata = {
+ "test_void", CORBA_B_TRUE,
+ 0, 0,
+ 0, 0
+};
+
+void
+test1_test_void (test1_ptr target, CORBA_Environment &env)
+{
+ STUB_Object *data;
+
+ if (target->QueryInterface (IID_STUB_Object, (void **)&data)
+ != NOERROR)
+ env.exception (new CORBA_INV_OBJREF (COMPLETED_NO));
+ else {
+ data->do_call (env, &test1_void_calldata
+ );
+ data->Release ();
+ }
+}
+
+DEFINE_TEST (short, Short);
+DEFINE_TEST (long, Long);
+DEFINE_TEST (ushort, UShort);
+DEFINE_TEST (ulong, ULong);
+
+#if defined(MIPS)
+//
+// NOTE: C/C++ compilers as a rule pass a "float" in the space that
+// a "double" takes up. Conversions are evidently optional; portability
+// forces the following "explicit temporary" hack to work on at least
+// one MIPS platform, which converts the parameter to "double" and
+// hence changes the binary representation. (Even if that is a compiler
+// bug, it's probably required by now for binary compatibility!)
+//
+// A "-k ansi" compiler flag may be needed to get correct behaviour;
+// passing the "in" parameters by reference apparently works too. At
+// this time, none of these solutions is used by default.
+//
+// This stub-level hackery seems like it could be replaced inside of the
+// stub interpreter, which could just manually convert "float" parameters
+// (all of them) as special cases. But of course, that would slow the
+// interpreter down on _every_ call, not just the ones that require it
+// (such as this one). Tradeoffs!
+//
+static const TAO_Param_Data test1_float_paramdata [4] = {
+ { _tc_CORBA_Float , PARAM_RETURN , 0 },
+ { _tc_CORBA_Float , PARAM_IN , 0 },
+ { _tc_CORBA_Float , PARAM_OUT , 0 },
+ { _tc_CORBA_Float , PARAM_INOUT , 0 }
+};
+
+extern const TAO_Call_Data test1_float_calldata;
+
+const TAO_Call_Data test1_float_calldata = {
+ "test_float", CORBA_B_TRUE,
+ 4 , &test1_float_paramdata [0],
+ 0 , 0
+};
+
+CORBA_Float
+test1_test_float (
+ test1_ptr target,
+ CORBA_Float in_a1,
+ CORBA_Float &out_a2,
+ CORBA_Float &inout_a3,
+ CORBA_Environment &env
+)
+{
+ CORBA_Float _retval;
+
+ // These three temporaries required due to MIPS compiler bug
+ CORBA_Float _in_a1 = in_a1;
+ CORBA_Float _out_a2 = out_a2;
+ CORBA_Float _inout_a3 = inout_a3;
+
+ target -> data -> do_call (env,
+ &test1_float_calldata,
+ &_retval,
+ &_in_a1,
+ &_out_a2,
+ &_inout_a3);
+ return _retval;
+}
+
+#else
+DEFINE_TEST (float, Float);
+#endif // MIPS
+
+
+DEFINE_TEST (double, Double);
+DEFINE_TEST (boolean, Boolean);
+DEFINE_TEST (char, Char);
+DEFINE_TEST (octet, Octet);
+
+/*
+CORBA_Any *
+test1_test_any (test1_ptr target,
+ const CORBA_Any &in_a1,
+ CORBA_Any *&out_a2,
+ CORBA_Any &inout_a3,
+ CORBA_Environment &env)
+{
+ // XXX implement this stub! ... annoying that C++ mapping
+ // calls for so much special casing
+}
+*/
+
+
+DEFINE_TEST3 (TypeCode, TypeCode_ptr, TypeCode);
+DEFINE_TEST3 (Principal, Principal_ptr, Principal);
+DEFINE_TEST3 (Object, Object_ptr, Object);
+
+// NOTE: C++ mapping has "in" strings as "const", which doesn't
+// show up in this macro ...
+DEFINE_TEST3 (string, Char *, String);
+
+DEFINE_TEST (longlong, LongLong);
+DEFINE_TEST (ulonglong, ULongLong);
+DEFINE_TEST (wchar, WChar);
+
+// NOTE: C++ mapping has "in" strings as "const", which doesn't
+// show up in this macro ...
+DEFINE_TEST3 (wstring, WChar *, WString);
+
+#if !defined(NONNATIVE_LONGDOUBLE)
+DEFINE_TEST (longdouble, LongDouble);
+#endif
+
+#undef DEFINE_TEST
+
+
+//
+// Utility macros used to construct octet codes that are aligned
+// on longword boundaries, and with a known byte order. This
+// happens to use big endian encoding since it was convenient.
+// (Longword alignment is a happy accident of the specification
+// of OMG-IDL ... it could have been much worse!)
+//
+// It'd be much simpler to lay out such data in assembler!
+//
+
+#if defined (WORDS_BIGENDIAN)
+# define MAKE_BIG_LONG(a,b,c,d) \
+ ((((a) & 0xff) << 24) | (((b) & 0xff) << 16) \
+ | (((c) & 0xff) << 8) | ((d) & 0xff))
+# define BIG_ENDIAN_LONG(x) (x)
+
+#else // LITTLE_ENDIAN
+# define MAKE_BIG_LONG(a,b,c,d) \
+ ((((d) & 0xff) << 24) | (((c) & 0xff) << 16) \
+ | (((b) & 0xff) << 8) | ((a) & 0xff))
+# define BYTE_FROM(n,integer) (((integer)>>(8*(n)))&0xff)
+# define BIG_ENDIAN_LONG(integer) \
+ MAKE_BIG_LONG (BYTE_FROM(3,integer), BYTE_FROM(2,integer),\
+ BYTE_FROM(1,integer), BYTE_FROM(0,integer))
+#endif
+
+
+
+//
+// "x1" exception typecode ... must be longword aligned
+//
+static CORBA_Long oc_x1 [] = {
+ 0, // big endian flag + padding
+ BIG_ENDIAN_LONG (29), // length of ID string + NUL
+ MAKE_BIG_LONG ('I', 'D', 'L', ':'), // bytes of ID string
+ MAKE_BIG_LONG ('E', 'n', 'g', '.'),
+ MAKE_BIG_LONG ('S', 'U', 'N', '.'),
+ MAKE_BIG_LONG ('C', 'O', 'M', '/'),
+ MAKE_BIG_LONG ('t', 'e', 's', 't'),
+ MAKE_BIG_LONG ('1', '/', 'x', '1'),
+ MAKE_BIG_LONG (':', '1', '.', '0'),
+ 0,
+ BIG_ENDIAN_LONG (1), // (empty) namelen + NUL
+ 0,
+ BIG_ENDIAN_LONG (1), // only one struct member
+ BIG_ENDIAN_LONG (1), // (empty) member name + NUL
+ 0,
+ BIG_ENDIAN_LONG (tk_long)
+};
+static CORBA_TypeCode tc_x1 (tk_except, sizeof oc_x1,
+ (unsigned char *)&oc_x1, CORBA_B_FALSE);
+CORBA_TypeCode_ptr _tc_test1_x1 = &tc_x1;
+
+
+
+//
+// "x2" exception typecode ... must be longword aligned
+//
+static CORBA_Long oc_x2 [] = {
+ 0, // big endian flag + padding
+ BIG_ENDIAN_LONG (29), // length of ID string + NUL
+ MAKE_BIG_LONG ('I', 'D', 'L', ':'), // bytes of ID string
+ MAKE_BIG_LONG ('E', 'n', 'g', '.'),
+ MAKE_BIG_LONG ('S', 'U', 'N', '.'),
+ MAKE_BIG_LONG ('C', 'O', 'M', '/'),
+ MAKE_BIG_LONG ('t', 'e', 's', 't'),
+ MAKE_BIG_LONG ('1', '/', 'x', '2'),
+ MAKE_BIG_LONG (':', '1', '.', '0'),
+ 0,
+ BIG_ENDIAN_LONG (1), // (empty) namelen + NUL
+ 0,
+ BIG_ENDIAN_LONG (2), // two struct members
+
+ BIG_ENDIAN_LONG (1), // (empty) member name + NUL
+ 0,
+ BIG_ENDIAN_LONG (tk_objref),
+ BIG_ENDIAN_LONG (29), // type ID + NUL
+ MAKE_BIG_LONG ('I', 'D', 'L', ':'), // bytes of ID string
+ MAKE_BIG_LONG ('o', 'm', 'g', '.'),
+ MAKE_BIG_LONG ('o', 'r', 'g', '/'),
+ MAKE_BIG_LONG ('C', 'O', 'R', 'B'),
+ MAKE_BIG_LONG ('A', '/', 'O', 'b'),
+ MAKE_BIG_LONG ('j', 'e', 'c', 't'),
+ MAKE_BIG_LONG (':', '1', '.', '0'),
+ 0,
+
+ BIG_ENDIAN_LONG (1), // (empty) member name + NUL
+ 0,
+ BIG_ENDIAN_LONG (tk_long)
+};
+static CORBA_TypeCode tc_x2 (tk_except, sizeof oc_x2,
+ (unsigned char *)&oc_x2, CORBA_B_FALSE);
+CORBA_TypeCode_ptr _tc_test1_x2 = &tc_x2;
+
+
+//
+// parameter, exception, and call descriptions for "test_throw"
+//
+static const TAO_Param_Data test1_test_throw_paramdata [1] = {
+ { _tc_CORBA_Long, PARAM_IN, 0 }
+};
+
+static CORBA_TypeCode_ptr test1_test_throw_excepts [2] = {
+ &tc_x1, &tc_x2
+};
+
+extern const TAO_Call_Data test1_test_throw_calldata;
+
+const TAO_Call_Data test1_test_throw_calldata = {
+ "test_throw", CORBA_B_TRUE,
+ 1, &test1_test_throw_paramdata [0],
+ 2, &test1_test_throw_excepts [0]
+};
+
+//
+// "test_throw" stub
+//
+void
+test1_test_throw (
+ test1_ptr target,
+ CORBA_Long case_num,
+ CORBA_Environment &env // throw (x1, x2)
+)
+{
+ STUB_Object *data;
+
+ if (target->QueryInterface (IID_STUB_Object, (void **)&data)
+ != NOERROR)
+ env.exception (new CORBA_INV_OBJREF (COMPLETED_NO));
+ else {
+ data->do_call (env, &test1_test_throw_calldata,
+ &case_num);
+ data->Release ();
+ }
+}
+
+//
+// PLEASE EXIT
+//
+
+static const TAO_Call_Data test1_please_exit_calldata = {
+ "please_exit", CORBA_B_FALSE,
+ 0, 0,
+ 0, 0
+};
+
+void
+test1_please_exit (
+ test1_ptr target,
+ CORBA_Environment &env
+)
+{
+ STUB_Object *data;
+
+ if (target->QueryInterface (IID_STUB_Object, (void **)&data)
+ != NOERROR)
+ env.exception (new CORBA_INV_OBJREF (COMPLETED_NO));
+ else {
+ data->do_call (env, &test1_please_exit_calldata
+ );
+ data->Release ();
+ }
+}
+
diff --git a/TAO/IIOP/tests/Cubit/TAO/test1.h b/TAO/IIOP/tests/Cubit/TAO/test1.h
new file mode 100644
index 00000000000..7d3bd0e08a5
--- /dev/null
+++ b/TAO/IIOP/tests/Cubit/TAO/test1.h
@@ -0,0 +1,124 @@
+// @(#)test1.hh 1.2 95/09/12
+// Copyright 1995 by Sun Microsystems, Inc.
+// All Rights Reserved
+//
+// TEST interface for "test1"
+//
+
+#ifndef _TEST1_HH
+#define _TEST1_HH
+
+#include <corba/orb.h>
+#include <corba/stub.h>
+
+
+#ifdef _MSC_VER
+#pragma pack (push, 1) // VC++, known padding rules
+#endif // VC++
+
+typedef CORBA_UShort test1_ushort;
+typedef CORBA_ULong test1_ulong;
+
+typedef CORBA_LongLong test1_longlong;
+typedef CORBA_ULongLong test1_ulonglong;
+typedef CORBA_LongDouble test1_longdouble;
+
+typedef CORBA_Object test1;
+typedef test1 *test1_ptr;
+
+#define DECL_TEST(typename, truetype) \
+ truetype \
+ test1_test_ ## typename ( \
+ test1_ptr target, \
+ truetype in_a1, \
+ truetype &out_a2, \
+ truetype &inout_a3, \
+ CORBA_Environment &env \
+ )
+
+void test_illegal (test1_ptr target, CORBA_Environment &env);
+void test1_test_void (test1_ptr target, CORBA_Environment &env);
+
+DECL_TEST (short, CORBA_Short);
+DECL_TEST (long, CORBA_Long);
+DECL_TEST (ushort, CORBA_UShort);
+DECL_TEST (ulong, CORBA_ULong);
+DECL_TEST (float, CORBA_Float);
+DECL_TEST (double, CORBA_Double);
+DECL_TEST (boolean, CORBA_Boolean);
+DECL_TEST (char, CORBA_Char);
+DECL_TEST (octet, CORBA_Octet);
+
+CORBA_Any *
+test1_test_any (
+ test1_ptr target,
+ const CORBA_Any &in_a1,
+ CORBA_Any *&out_a2,
+ CORBA_Any &inout_a3,
+ CORBA_Environment &env
+);
+
+DECL_TEST (TypeCode, CORBA_TypeCode_ptr);
+DECL_TEST (Principal, CORBA_Principal_ptr);
+DECL_TEST (Object, CORBA_Object_ptr);
+
+// NOTE: CORBA C++ mapping says the "in" string is const
+DECL_TEST (string, CORBA_String);
+
+DECL_TEST (longlong, CORBA_LongLong);
+DECL_TEST (ulonglong, CORBA_ULongLong);
+DECL_TEST (wchar, CORBA_WChar);
+
+// NOTE: CORBA C++ mapping says the "in" string is const
+DECL_TEST (wstring, CORBA_WString);
+
+DECL_TEST (longdouble, CORBA_LongDouble);
+
+#undef DECL_TEST
+
+extern CORBA_TypeCode_ptr _tc_test1_x1;
+
+class test1_x1 : public CORBA_UserException {
+ public:
+ CORBA_Long case_num;
+
+ test1_x1 (CORBA_Long n)
+ : CORBA_UserException (_tc_test1_x1), case_num (n)
+ { }
+};
+
+extern CORBA_TypeCode_ptr _tc_test1_x2;
+
+class test1_x2 : public CORBA_UserException {
+ public:
+ CORBA_Object_ptr obj;
+ CORBA_Long case_num;
+
+ test1_x2 (CORBA_Object_ptr obj1,
+ CORBA_Long n)
+ : CORBA_UserException (_tc_test1_x2),
+ obj (obj1), case_num (n) { }
+
+ ~test1_x2 ()
+ { CORBA_release (obj); }
+};
+
+void
+test1_test_throw (
+ test1_ptr target,
+ CORBA_Long case_num,
+ CORBA_Environment &env // throw (x1, x2)
+);
+
+void
+test1_please_exit (
+ test1_ptr target,
+ CORBA_Environment &env
+);
+
+#ifdef _MSC_VER
+#pragma pack (pop) // VC++, go back to other padding rules
+#endif // VC++
+
+#endif // _TEST1_HH
+
diff --git a/TAO/IIOP/tests/Cubit/TAO/test1.idl b/TAO/IIOP/tests/Cubit/TAO/test1.idl
new file mode 100644
index 00000000000..e6cf20cd2de
--- /dev/null
+++ b/TAO/IIOP/tests/Cubit/TAO/test1.idl
@@ -0,0 +1,78 @@
+// @(#)test1.idl 1.1 95/09/11
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+//
+// TEST basic marshaling tests for all IDL primitive types, modes
+//
+// This test omits constructed types (struct, union, enum, sequence, and
+// array types), and only tests very simple user defined exceptions.
+//
+// Values returned are well defined functions of the input values:
+//
+// * For numeric types (octet, short, long, longlong, float, double,
+// longdouble, and unsigned variants) the value is cubed.
+// * For Boolean, it's the negation.
+// * For Any, TypeCode, Principal, Object, char and wchar,
+// string and wstring, it's the input value.
+//
+// The "return" and "out" parameter is the function of the "in" parameter;
+// the "inout" parameter is the function of its original value.
+//
+// The "echo" test has all output values be the input values, with no
+// changes to the bit patterns originally transmitted. While easier to
+// use to identify some kinds of problem, it is not as complete a test.
+//
+
+#define DECL_TEST(type) \
+ type test_ ## type ( in type a1, out type a2, inout type a3)
+
+#pragma prefix "Eng.SUN.COM" // only for Sun-defined interfaces
+
+interface test1 {
+ void test_void ();
+
+ typedef unsigned short ushort;
+ typedef unsigned long ulong;
+
+ typedef long long longlong;
+ typedef unsigned long long ulonglong;
+ typedef long double longdouble;
+
+ DECL_TEST (short);
+ DECL_TEST (long);
+ DECL_TEST (ushort);
+ DECL_TEST (ulong);
+ DECL_TEST (float);
+ DECL_TEST (double);
+ DECL_TEST (boolean);
+ DECL_TEST (char);
+ DECL_TEST (octet);
+ DECL_TEST (any);
+ DECL_TEST (TypeCode);
+ DECL_TEST (Principal);
+ DECL_TEST (Object); // CORBA::Object
+ DECL_TEST (string); // unbounded string
+
+ DECL_TEST (longlong);
+ DECL_TEST (ulonglong);
+ DECL_TEST (wchar);
+ DECL_TEST (wstring); // unbounded wstring
+ DECL_TEST (longdouble);
+
+ //
+ // All cases, "case_num" in the exception is the same as the 'in' param
+ // * negative or zero, throws x1
+ // * positive even cases, throws x2 with obj = null objref
+ // * positive odd cases, throws x2 with obj = target objref
+ //
+ exception x1 { long case_num; };
+ exception x2 { Object obj; long case_num; };
+
+ void test_throw (in long case_num) raises (x1, x2);
+
+ //
+ // Aid for test cleanup in case server's not told to quit after
+ // being idle for some time period
+ //
+ oneway void please_exit ();
+};
+
diff --git a/TAO/IIOP/tests/Cubit/TAO/test1_clnt.cpp b/TAO/IIOP/tests/Cubit/TAO/test1_clnt.cpp
new file mode 100644
index 00000000000..831a0189371
--- /dev/null
+++ b/TAO/IIOP/tests/Cubit/TAO/test1_clnt.cpp
@@ -0,0 +1,636 @@
+// @(#)test1_clnt.cpp 1.5 95/09/24
+// Copyright 1995 by Sun Microsystems, Inc.
+// All Rights Reserved
+//
+// TEST client driver for "test1"
+//
+
+#ifdef USE_IOSTREAM
+#include <iostream.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <ace/Get_Opt.h>
+
+#if unix
+# include <unistd.h>
+
+#else // windows
+
+#endif // unix
+
+#include "test1.h"
+#include <corba/debug.h>
+
+
+#if !defined (_WIN32)
+extern char *optarg; // missing on some platforms
+#endif
+
+extern void
+print_exception (const CORBA_Exception *, const char *, FILE *f=stdout);
+
+
+//
+// All tests are specified so that the return value and "out" (second)
+// parameters are easily tested functions of the "in" (first) parameter,
+// and the "inout" (third) parameter is the same function the its
+// initial value. Caller is expected to specify two different "in"
+// values. This helps make the marshaled bits vary, and turn up a class
+// of potential problems that'd be hidden if parameter order had no
+// effect on the test.
+//
+// PERFORM_TEST calls a test for a given type, reporting in cases where
+// the ORB or operation failed. The COMPARE symbol can be redefined
+// to achieve different functions -- e.g. cubing numbers, identity,
+// negation, etc. It should return true iff the correct result was
+// returned.
+//
+// BAD_COMPARE_VALUES is to produce diagnostics when a test fails,
+// showing the actual and expected values of returned parameters.
+// This helps diagnose specific porting problems.
+//
+// The RELEASE symbol may be defined to free memory, eliminating client
+// side memory leaks in the test.
+//
+#define RELEASE(X) // NOP by default
+#define PERFORM_TEST(name,type,value1,value2) \
+ { \
+ CORBA_ ## type v1, v2, v3; \
+ \
+ v1 = (CORBA_ ## type)(value1); \
+ v2 = 0; \
+ v3 = (CORBA_ ## type)(value2); \
+ \
+ test_count++; \
+ v1 = test1_test_ ## name (target, v1, v2, v3, env); \
+ if (env.exception () != 0) { \
+ print_exception (env.exception (), "perform test_" #name); \
+ error_count++; \
+ } else if (!COMPARE (CORBA_ ## type, v1, value1) \
+ || !COMPARE (CORBA_ ## type, v2, value1) \
+ || !COMPARE (CORBA_ ## type, v3, value2) ) { \
+ ACE_OS::fprintf (stderr, "bad comparison, test_" #name "\n"); \
+ BAD_COMPARE_VALUES(type,v1,v2,v3,value1,value2) \
+ error_count++; \
+ } \
+ RELEASE (v1); RELEASE (v2); RELEASE (v3); \
+ }
+
+//
+// This messing about is because the ostream op << cannot always
+// be used with all kinds of data ... e.g. LongDouble, TypeCode.
+//
+#ifdef USE_IOSTREAM
+# define DO_IO(x) x
+#else
+# define DO_IO(x)
+#endif
+#define BAD_COMPARE_VALUE_OUT(type,v1,v2,v3,value1,value2) \
+ DO_IO( cerr << " v1=" << v1; \
+ cerr << " expecting " << EXPVAL(CORBA_ ## type, value1) << "\n"; \
+ cerr << " v2=" << v2; \
+ cerr << " expecting " << EXPVAL(CORBA_ ## type, value1) << "\n"; \
+ cerr << " v3=" << v3; \
+ cerr << " expecting " << EXPVAL(CORBA_ ## type, value2) << "\n");
+#define BAD_COMPARE_VALUES(type,v1,v2,v3,value1,value2) \
+ BAD_COMPARE_VALUE_OUT(type,v1,v2,v3,value1,value2)
+
+
+//
+// test utility -- should be able to just use is_equivalent() directly
+// but this implementation uses null pointers for nil, so this must
+// check for nulls first. (May be noncompliant with C++ mapping!)
+//
+static CORBA_Boolean
+compare_objrefs (
+ CORBA_Object_ptr v1,
+ CORBA_Object_ptr v2
+)
+{
+ CORBA_Boolean temp;
+ CORBA_Environment env;
+
+ if (v1 == v2)
+ return CORBA_B_TRUE;
+
+ if (CORBA_is_nil (v1))
+ return CORBA_is_nil (v2);
+
+ temp = v1->_is_equivalent (v2, env);
+ if (env.exception () != 0) {
+ print_exception (env.exception (), "compare objref");
+ return CORBA_B_FALSE;
+ }
+ return temp;
+}
+
+
+//
+// Helper routine to help sure math (especially for floating point)
+// gets done correctly.
+//
+template <class Type>
+Type cube (Type arg)
+{
+ Type temp = arg;
+
+ temp = temp * arg;
+ temp = temp * arg;
+ return temp;
+}
+
+
+static int skip_longdouble = 0;
+
+//
+// This just performs the tests ...
+//
+void
+do_tests (
+ test1_ptr target,
+ unsigned loop_count,
+ unsigned &test_count,
+ unsigned &error_count
+)
+{
+ int count;
+
+ for (count = 0; count < loop_count; count++) {
+ CORBA_Environment env;
+ CORBA_Environment env2; // XXX
+
+ //
+ // test_void
+ //
+ test_count++;
+ test1_test_void (target, env);
+ if (env.exception () != 0) {
+ print_exception (env.exception (), "perform test_void");
+ error_count++;
+ }
+
+ //
+ // Numeric tests ... try some variety in computation, no real
+ // rationale in the choice of initial parameter values except
+ // not to use the same values all the time.
+ //
+#define EXPVAL(type,original_value) ((type) cube((type)(original_value)))
+#define COMPARE(type,retval,original_value) \
+ ((retval) == EXPVAL(type, original_value))
+
+ PERFORM_TEST (octet, Octet, count + 29, count - 22);
+
+ PERFORM_TEST (short, Short, count - 23, count + 19);
+ PERFORM_TEST (ushort, UShort, count + 23, count - 19);
+
+ PERFORM_TEST (long, Long, count - 17, count + 20);
+ PERFORM_TEST (ulong, ULong, count + 17, count - 20);
+
+#if !defined (NONNATIVE_LONGLONG)
+ // don't try this on platforms that don't support
+ // math on longlongs ...
+ PERFORM_TEST (longlong, LongLong, count - 177, count + 3);
+ PERFORM_TEST (ulonglong, ULongLong, count + 177, count - 3);
+#endif // !NONNATIVE_LONGLONG
+
+#if !defined (i386)
+ //
+ // XXX not sure what's wrong with the COMPARE macro with respect to
+ // floating point on x86, since fprintf shows the values basically
+ // look correct ... but these float/double tests fail.
+ //
+ PERFORM_TEST (float, Float, count - 0.29, count + 3.14159);
+ PERFORM_TEST (double, Double, count * 1.77, count * 2.71);
+#endif // !defined (i386)
+
+
+#ifndef NONNATIVE_LONGDOUBLE
+#undef BAD_COMPARE_VALUES
+#define BAD_COMPARE_VALUES(type,v1,v2,v3,value1,value2) // NOP
+
+ //
+ // don't try this between two platforms that don't provide
+ // arithmetic support for LongDouble values ...
+ //
+ if (!skip_longdouble) {
+ PERFORM_TEST (longdouble, LongDouble,
+ count - 2.33, count * 3.14159);
+ }
+
+# undef BAD_COMPARE_VALUES
+# define BAD_COMPARE_VALUES(type,v1,v2,v3,value1,value2) \
+ BAD_COMPARE_VALUE_OUT(type,v1,v2,v3,value1,value2)
+#endif // !NONNATIVE_LONGDOUBLE
+
+#undef COMPARE
+#undef EXPVAL
+
+
+ //
+ // Boolean -- negation
+ //
+#define EXPVAL(type,original_value) (!(type)(original_value))
+#define COMPARE(type,retval,original_value) \
+ (((type)(retval)) == EXPVAL(type,original_value))
+
+ PERFORM_TEST (boolean, Boolean,
+ (count & 0x01) != 0, (count & 0x01) == 0);
+#undef COMPARE
+#undef EXPVAL
+
+ //
+ // Char, WChar -- identity
+ //
+#define EXPVAL(type,original_value) ((type)(original_value))
+#define COMPARE(type,retval,original_value) \
+ (((type)(retval)) == EXPVAL(type,original_value))
+
+ PERFORM_TEST (char, Char, count + 26, count - 5);
+ PERFORM_TEST (wchar, WChar, count, count + 25);
+#undef COMPARE
+#undef EXPVAL
+
+ //
+ // Object_ptr -- identity (special comparision)
+ //
+#define EXPVAL(type,original_value) ((type)(original_value))
+#define COMPARE(type,retval,original_value) \
+ (compare_objrefs (retval, original_value) == CORBA_B_TRUE)
+#undef RELEASE
+#define RELEASE(obj) \
+ { CORBA_release (obj); }
+
+ PERFORM_TEST (Object, Object_ptr, target, CORBA_Object::_nil ());
+#undef COMPARE
+#undef EXPVAL
+
+ //
+ // TypeCode_ptr -- identity (special comparision), and verifies
+ // that most of the built-in typecode constants exist.
+ //
+ // XXX should try this on all standard and system exceptions!
+ //
+ // XXX this currently tests only marshaling/unmarshaling of
+ // "no parameter" TypeCodes ... complex ones (objref, struct,
+ // union, enum, sequence, array, alias, exception) are _NOT_
+ // currently attempted.
+ //
+ // XXX for the simple typecodes (string, wstring), the single
+ // "bound" parameter isn't exercised/verified as it should be.
+ //
+#define EXPVAL(type,original_value) ((type)(original_value))
+#define COMPARE(type,retval,original) \
+ (((retval) == (original)) || \
+ ((retval)->_kind == (original)->_kind))
+
+#undef RELEASE
+#define RELEASE(tc) \
+ { CORBA_release (tc); }
+
+#undef BAD_COMPARE_VALUES
+#define BAD_COMPARE_VALUES(type,v1,v2,v3,value1,value2) // NOP
+
+ {
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_Null, _tc_CORBA_Void);
+
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_Short, _tc_CORBA_UShort);
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_Long, _tc_CORBA_ULong);
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_LongLong, _tc_CORBA_ULongLong);
+
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_Float, _tc_CORBA_Double);
+
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_Boolean, _tc_CORBA_Octet);
+
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_Any, _tc_CORBA_TypeCode);
+
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_LongDouble, _tc_CORBA_Principal);
+
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_Char, _tc_CORBA_String);
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_WChar, _tc_CORBA_WString);
+
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_LongDouble, _tc_CORBA_Octet);
+
+ //
+ // Try all of the standard exception typecodes.
+ //
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_UNKNOWN, _tc_CORBA_BAD_PARAM);
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_NO_MEMORY, _tc_CORBA_IMP_LIMIT);
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_COMM_FAILURE, _tc_CORBA_INV_OBJREF);
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_OBJECT_NOT_EXIST, _tc_CORBA_NO_PERMISSION);
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_INTERNAL, _tc_CORBA_MARSHAL);
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_INITIALIZE, _tc_CORBA_NO_IMPLEMENT);
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_BAD_TYPECODE, _tc_CORBA_BAD_OPERATION);
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_NO_RESOURCES, _tc_CORBA_NO_RESPONSE);
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_PERSIST_STORE, _tc_CORBA_BAD_INV_ORDER);
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_TRANSIENT, _tc_CORBA_FREE_MEM);
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_INV_IDENT, _tc_CORBA_INV_FLAG);
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_INTF_REPOS, _tc_CORBA_BAD_CONTEXT);
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_OBJ_ADAPTER, _tc_CORBA_DATA_CONVERSION);
+
+ //
+ // All the built-in "user defined" system exceptions.
+ //
+ PERFORM_TEST (TypeCode, TypeCode_ptr,
+ _tc_CORBA_BadKind, _tc_CORBA_Bounds);
+ }
+#undef COMPARE
+#undef RELEASE
+
+ //
+ // string (unbounded)-- identity (special comparision)
+ //
+#define COMPARE(type,retval,original_value) \
+ (strcmp ((char *)(retval), (char*)(original_value)) == 0)
+#undef RELEASE
+#define RELEASE(obj) CORBA_string_free(obj)
+ static const CORBA_Char str1 [] = "small";
+ static const CORBA_Char str2 [] =
+ "relatively long string, constructed"
+ " with the aid of C++ implicit string"
+ " catenation, which simplifies much stuff";
+ PERFORM_TEST (string, String, str1, str2);
+#undef COMPARE
+#undef RELEASE
+
+
+ // XXX any, principal, wstring ... output _is_ input
+
+
+ //
+ // Three test cases involve throwing user-defined exceptions.
+ //
+ {
+ CORBA_Exception *xp;
+
+ //
+ // Case one: with parameter <= zero, must throw
+ // an "x1" exception whose "case_num" is that parameter
+ //
+ test_count++;
+
+ test1_test_throw (target, -5, env);
+ if (env.exception () != 0) {
+ xp = env.exception ();
+
+ if (strcmp ((char *)xp->id (),
+ (char *) _tc_test1_x1->id (env2)) != 0) {
+ error_count++;
+ ACE_OS::fprintf (stderr, "test_throw case 1, "
+ "wrong exception thrown (id = '%s')\n",
+ xp->id ());
+ } else {
+ test1_x1 *xp2 = (test1_x1 *) xp;
+
+ if (xp2->case_num != -5) {
+ error_count++;
+ ACE_OS::fprintf (stderr, "test_throw case 1, "
+ "wrong value (case_num = '%ld')\n",
+ xp2->case_num);
+ }
+
+ // else, right exception was thrown
+ }
+ } else {
+ error_count++;
+ ACE_OS::fprintf (stderr, "test_throw case 1, "
+ "no exception thrown !!\n");
+ }
+
+
+ //
+ // Case two: with positive odd parameter, must throw
+ // an "x2" exception whose obj is null, and whose case_num
+ // is that parameter
+ //
+ test_count++;
+
+ test1_test_throw (target, 101, env);
+ if (env.exception () != 0) {
+ xp = env.exception ();
+
+ if (strcmp ((char *)xp->id (),
+ (char *) _tc_test1_x2->id (env2)) != 0) {
+ error_count++;
+ ACE_OS::fprintf (stderr, "test_throw case 2, "
+ "wrong exception thrown (id = '%s')\n",
+ xp->id ());
+ } else {
+ test1_x2 *xp2 = (test1_x2 *) xp;
+
+ if (xp2->case_num != 101) {
+ error_count++;
+ ACE_OS::fprintf (stderr, "test_throw case 2, "
+ "wrong value (case_num = '%ld')\n",
+ xp2->case_num);
+ }
+
+ if (!CORBA_is_nil (xp2->obj)) {
+ error_count++;
+ ACE_OS::fprintf (stderr, "test_throw case 2, "
+ "non-null objref thrown\n");
+ }
+
+ // else, right exception was thrown
+ }
+ } else {
+ error_count++;
+ ACE_OS::fprintf (stderr, "test_throw case 2, "
+ "no exception thrown !!\n");
+ }
+
+
+#if 0
+// 18-sept-95: commented this out. Work remains to be done in
+// this area: (a) ServerRequest::target operation unimplemented,
+// so for the servers of current interest this test is no help;
+// (b) probable pointer leak in exceptions holding data.
+
+ //
+ // Case three: with positive even parameter, must throw
+ // an "x2" exception whose obj is the target, and whose
+ // case_num is that parameter
+ //
+ test_count++;
+
+ test1_test_throw (target, 42, env);
+ if (env.exception () != 0) {
+ xp = env.exception ();
+
+ if (strcmp ((char *)xp->id (),
+ (char *) _tc_test1_x2->id (env2)) != 0) {
+ error_count++;
+ ACE_OS::fprintf (stderr, "test_throw case 3, "
+ "wrong exception thrown (id = '%s')\n",
+ xp->id ());
+ } else {
+ test1_x2 *xp2 = (test1_x2 *) xp;
+
+ if (xp2->case_num != 42) {
+ error_count++;
+ ACE_OS::fprintf (stderr, "test_throw case 3, "
+ "wrong value (case_num = '%ld')\n",
+ xp2->case_num);
+ }
+
+ CORBA_Boolean status;
+
+ status = target->_is_equivalent (xp2->obj, env);
+
+ if (env.exception () != 0) {
+ error_count++;
+ print_exception (env.exception (),
+ "test_throw/3 call to is_equivalent");
+ } else if (status != CORBA_B_TRUE) {
+ error_count++;
+ ACE_OS::fprintf (stderr, "test_throw case 3, "
+ "non-equivalent objref thrown\n");
+ }
+
+ // else, right exception was thrown
+ }
+ } else {
+ error_count++;
+ ACE_OS::fprintf (stderr, "test_throw case 3, "
+ "no exception thrown !!\n");
+ }
+
+ env.clear ();
+#endif // 0
+
+ }
+
+ //
+ // test_illegal -- generate a BAD_OPERATION system exception
+ // from the remote process
+ //
+ test_count++;
+ test_illegal (target, env);
+ if (env.exception () == 0
+ || ACE_OS::strcmp ((char *) env.exception()->id(),
+ (char *) _tc_CORBA_BAD_OPERATION->id (env2)) != 0) {
+ ACE_OS::fprintf (stderr, "couldn't generate BAD_OPERATION exception\n");
+ error_count++;
+ }
+ }
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ CORBA_ORB_ptr orb_ptr;
+ CORBA_Environment env;
+ CORBA_Object_ptr objref = CORBA_Object::_nil();
+ unsigned loop_count = 1;
+ unsigned tests = 0, errors = 0;
+ int exit_later = 0;
+
+ orb_ptr = CORBA_ORB_init (argc, argv, "internet", env);
+ if (env.exception () != 0) {
+ dexc (env, "ORB initialisation");
+ return 1;
+ }
+
+ //
+ // Parse and verify parameters.
+ //
+ ACE_Get_Opt get_opt (argc, argv, "dln:O:x");
+ int c;
+
+ while ((c = get_opt ()) != -1)
+ switch (c) {
+ case 'd': // debug flag
+ TAO_debug_level++;
+ continue;
+
+ case 'l': // skip "long double" test
+ skip_longdouble++;
+ continue;
+
+ case 'n': // loop count
+ loop_count = (unsigned) ACE_OS::atoi (get_opt.optarg);
+ continue;
+
+ case 'O': // stringified objref
+ {
+ objref = orb_ptr->string_to_object (
+ (CORBA_String)get_opt.optarg, env);
+ if (env.exception () != 0) {
+ dexc (env, "string2object");
+ return 1;
+ }
+ }
+ continue;
+
+ case 'x':
+ exit_later++;
+ continue;
+
+ case '?':
+ default:
+ ACE_OS::fprintf (stderr, "usage: %s"
+ " [-d]"
+ " [-l]"
+ " [-n loopcount]"
+ " [-O objref]"
+ " [-x]"
+ "\n", argv [0]
+ );
+ return 1;
+ }
+
+ if (CORBA_is_nil (objref) == CORBA_B_TRUE) {
+ ACE_OS::fprintf (stderr, "%s: must identify non-null target objref\n",
+ argv [0]);
+ return 1;
+ }
+
+
+ do_tests (objref, loop_count, tests, errors);
+
+ char *progname = ACE_OS::strrchr (argv [0], '/');
+
+ if (progname != 0)
+ progname += 1;
+ else
+ progname = argv [0];
+
+ ACE_OS::fprintf (stderr, "%s: %d loops, %d tests (%d errors)\n",
+ progname, loop_count, tests, errors);
+
+ if (exit_later) {
+ test1_please_exit (objref, env);
+ if (env.exception () != 0)
+ print_exception (env.exception (), "test1_please_exit");
+ }
+
+ CORBA_release (objref);
+
+ return errors != 0;
+}
diff --git a/TAO/IIOP/tests/Cubit/TAO/test1_svr.cpp b/TAO/IIOP/tests/Cubit/TAO/test1_svr.cpp
new file mode 100644
index 00000000000..c4a51a036c7
--- /dev/null
+++ b/TAO/IIOP/tests/Cubit/TAO/test1_svr.cpp
@@ -0,0 +1,670 @@
+// @(#)test1_svr.cpp 1.7 95/09/25
+// Copyright 1995 by Sun Microsystems Inc.
+// All Rights Reserved
+//
+// TEST: simple IIOP server for "test1.idl" interface.
+//
+// Starts up, builds an objref, prints its string, listens for
+// messages, responds to them.
+//
+
+#include <stdio.h>
+#include <string.h>
+#include <ace/Get_Opt.h>
+
+#if unix
+# include <unistd.h> // for getopt on some systems
+
+#else // windows
+
+#endif
+
+#include "test1.h"
+#include <corba/boa.h>
+#include <roa.h>
+
+#include <corba/debug.h>
+
+
+
+#if !defined (_WIN32)
+extern char *optarg; // missing on some platforms
+#endif
+
+//
+// Skeleton code ... just a macro for a bunch of DSI-based method code,
+// in lieu of having an IDL compmiler generate static skeletons. Static
+// skeletons would be more efficient; most mallocation could go away.
+//
+// Use by: defining OPERATION macro, call DEFINE_SKEL3 as needed, then
+// undef OPERATION.
+//
+// NOTE: "v1_copy" below is needed to work around a bug with the
+// HP9000 G++ 2.6.3 compiler, with "LongLong".
+//
+// XXX this could probably be a template ... or could even be merged
+// directly into the Dynamic Implementation Routine below.
+//
+// XXX we must currently use IN_COPY_VALUE since the memory consumed
+// by the parameters must be deallocated by the ORB. When we get an
+// updated version of DSI which provides "send it now" semantics,
+// these should preallocate the values and not use IN_COPY_VALUE. A
+// net decrease in malloc overhead can be had that way. (NVList should
+// also get a public constructor, and a way to provide the buffer.)
+//
+#define DEFINE_SKEL3(name,truetype,truetypename) \
+ static void \
+ _test1_test_ ## name ( \
+ CORBA_ServerRequest &req, \
+ CORBA_Object_ptr obj, \
+ CORBA_Environment &env \
+ ) \
+ { \
+ CORBA_NVList_ptr nvlist; \
+ CORBA_ ## truetype scratch = 0; \
+ CORBA_Any temp_value (_tc_CORBA_ ## truetypename, \
+ &scratch, CORBA_B_FALSE); \
+ \
+ req.orb ()->create_list (3, nvlist); \
+ (void) nvlist->add_value (0, temp_value, \
+ CORBA_IN_COPY_VALUE|CORBA_ARG_IN, env); \
+ (void) nvlist->add_value (0, temp_value, \
+ CORBA_IN_COPY_VALUE|CORBA_ARG_OUT, env); \
+ (void) nvlist->add_value (0, temp_value, \
+ CORBA_IN_COPY_VALUE|CORBA_ARG_INOUT, env); \
+ \
+ req.params (nvlist, env); \
+ if (env.exception () != 0) { \
+ dexc (env, "test1_test_" # name "skeleton, req.params"); \
+ return; \
+ } \
+ \
+ CORBA_ ## truetype *v1, *v2, *retval; \
+ \
+ v1 = (CORBA_ ## truetype *) nvlist->item (0)->value ()->value (); \
+ v2 = new CORBA_ ## truetype; \
+ *v2 = (CORBA_ ## truetype) OPERATION (*v1); \
+ retval = new CORBA_ ## truetype; \
+ *retval = (CORBA_ ## truetype) OPERATION (*v1); \
+ \
+ CORBA_Any_ptr any_val; \
+ \
+ any_val = nvlist->item (1)->value (); \
+ any_val->replace (any_val->type (), v2, CORBA_B_TRUE, env); \
+ if (env.exception () != 0) { \
+ dexc (env, "test1_test_" # name "skeleton, val2 replace"); \
+ return; \
+ } \
+ \
+ v1 = (CORBA_ ## truetype *) nvlist->item (2)->value ()->value (); \
+ CORBA_ ## truetype v1copy = *v1; \
+ *v1 = (CORBA_ ## truetype) OPERATION (v1copy); \
+ \
+ any_val = new CORBA_Any (_tc_CORBA_ ## truetypename, \
+ retval, CORBA_B_TRUE); \
+ req.result (any_val, env); \
+ if (env.exception () != 0) { \
+ dexc (env, "test1_test_" # name "skeleton, result"); \
+ return; \
+ } \
+ } \
+ extern TAO_Call_Data test1_ ## name ## _calldata;
+
+
+extern const TAO_Call_Data test1_void_calldata;
+
+static void
+_test1_test_void (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ CORBA_NVList_ptr nvlist;
+
+ req.orb ()->create_list (0, nvlist);
+ req.params (nvlist, env);
+
+ if (env.exception () != 0)
+ dexc (env, "test_throw, get params");
+}
+
+
+//
+// Dynamic Skeleton methods for numeric types ... these all just
+// cube their parameters in various permutations
+//
+template <class Type>
+Type cube (Type arg)
+{
+ Type temp = arg;
+
+ temp = temp * arg;
+ temp = temp * arg;
+ return temp;
+}
+
+#define OPERATION(n) cube(n)
+
+DEFINE_SKEL3 (octet, Octet, Octet)
+
+DEFINE_SKEL3 (short, Short, Short)
+DEFINE_SKEL3 (ushort, UShort, UShort)
+
+DEFINE_SKEL3 (long, Long, Long)
+DEFINE_SKEL3 (ulong, ULong, ULong)
+
+#if !defined (NONNATIVE_LONGLONG)
+ // don't try this on platforms that don't support
+ // math on longlongs ...
+DEFINE_SKEL3 (longlong, LongLong, LongLong)
+DEFINE_SKEL3 (ulonglong, ULongLong, ULongLong)
+#endif // !NONNATIVE_LONGLONG
+
+DEFINE_SKEL3 (float, Float, Float)
+DEFINE_SKEL3 (double, Double, Double)
+
+#if !defined (NONNATIVE_LONGDOUBLE)
+ // don't try this on platforms that don't support
+ // math on long doubles ...
+DEFINE_SKEL3 (longdouble, LongDouble, LongDouble)
+#endif // !NONNATIVE_LONGDOUBLE
+
+#undef OPERATION
+
+//
+// Dynamic Skeleton methods for Boolean type ... just negates its
+// parameters
+//
+#define OPERATION(x) (!(x))
+DEFINE_SKEL3 (boolean, Boolean, Boolean)
+#undef OPERATION
+
+//
+// For character types, output is same as input, no magic needed.
+//
+#define OPERATION(x) (x)
+DEFINE_SKEL3 (char, Char, Char)
+DEFINE_SKEL3 (wchar, WChar, WChar)
+#undef OPERATION
+
+//
+// For objref, typecode, output is same as input but duplication
+// is needed
+//
+#define OPERATION(x) ((x) ? (x)->AddRef() : 0, x)
+DEFINE_SKEL3 (Object, Object_ptr, Object)
+DEFINE_SKEL3 (TypeCode, TypeCode_ptr, TypeCode)
+#undef OPERATION
+
+//
+// For string, output is copy of input
+//
+#define OPERATION(x) (CORBA_string_copy(x))
+DEFINE_SKEL3 (string, String, String)
+#undef OPERATION
+
+//
+// For wstring, output is copy of input
+//
+#define OPERATION(x) (CORBA_wstring_copy(x))
+DEFINE_SKEL3 (wstring, WString, WString)
+#undef OPERATION
+
+//
+// XXX IMPLEMENT THE REST OF THE DATA TYPES
+//
+// any, principal -- out is in
+//
+
+
+//
+// All cases, "case_num" in the exception is the same as the 'in' param
+// * negative or zero, throws x1
+// * positive even cases, throws x2 with obj = null objref
+// * positive odd cases, throws x2 with obj = target objref
+//
+// exception x1 { long case_num; };
+// exception x2 { Object obj; long case_num; };
+//
+// void test_throw (in long case_num) raises (x1, x2);
+//
+
+extern const TAO_Call_Data test1_test_throw_calldata;
+
+static void
+_test1_test_throw (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ CORBA_NVList_ptr nvlist;
+ CORBA_NamedValue_ptr nv;
+ CORBA_Any temp_value (_tc_CORBA_Long);
+ CORBA_Long value;
+
+ req.orb ()->create_list (0, nvlist);
+ nv = nvlist->add_value (0, temp_value, CORBA_ARG_IN, env);
+
+ req.params (nvlist, env);
+ if (env.exception () != 0)
+ {
+ dexc (env, "test_throw, get params");
+ return;
+ }
+
+ value = *(CORBA_Long *)nv->value ()->value ();
+ if (env.exception () != 0)
+ {
+ dexc (env, "test_throw, param value");
+ return;
+ }
+
+ CORBA_Any_ptr any;
+
+ if (value <= 0)
+ {
+ test1_x1 *x;
+
+ x = new test1_x1 (value);
+ any = new CORBA_Any (_tc_test1_x1, x, CORBA_B_TRUE);
+
+ }
+ else if (value & 0x01)
+ {
+ test1_x2 *x;
+
+ x = new test1_x2 (CORBA_Object::_nil (), value);
+ any = new CORBA_Any (_tc_test1_x2, x, CORBA_B_TRUE);
+
+ }
+ else
+ {
+#if 0
+ test1_x2 *x;
+
+ x = new test1_x2 (req.oa()->target (), value);
+ any = new CORBA_Any (_tc_test1_x2, x, CORBA_B_TRUE);
+#else
+ //
+ // XXX right now, we don't have a target() operation on the
+ // BOA ... needs to be added. Verify the client side memory
+ // leak of pointers embedded in user exceptions is fixed, too.
+ //
+ env.exception (new CORBA_IMP_LIMIT (COMPLETED_NO));
+ return;
+#endif
+ }
+
+ req.exception (USER_EXCEPTION, any, env);
+}
+
+
+//
+// This table is used to associate operation names with the Dynamic
+// Skeleton method ... someday it could return static skeletons.
+//
+#define DECL_SKEL(name) \
+ { & test1_ ## name ## _calldata, _test1_test_ ## name }
+
+static const TAO_Skel_Entry test1_operations [] = {
+ DECL_SKEL (void),
+
+ DECL_SKEL (octet),
+ DECL_SKEL (char),
+
+ DECL_SKEL (wchar),
+
+ DECL_SKEL (short),
+ DECL_SKEL (ushort),
+ DECL_SKEL (long),
+ DECL_SKEL (ulong),
+
+#if !defined (NONNATIVE_LONGLONG)
+ // don't try this on platforms that don't support
+ // math on longlongs ...
+ DECL_SKEL (longlong),
+ DECL_SKEL (ulonglong),
+#endif
+
+ DECL_SKEL (float),
+ DECL_SKEL (double),
+
+#if !defined (NONNATIVE_LONGDOUBLE)
+ // don't try this on platforms that don't support
+ // math on long doubles ...
+ DECL_SKEL (longdouble),
+#endif // !NONNATIVE_LONGDOUBLE
+
+ DECL_SKEL (boolean),
+
+ DECL_SKEL (Object),
+ DECL_SKEL (TypeCode),
+
+ DECL_SKEL (string),
+ DECL_SKEL (wstring),
+
+ { & test1_test_throw_calldata, _test1_test_throw },
+
+ { 0, 0 }
+};
+
+
+//
+// Dispatch to method code ...
+//
+// Knows how to interpret "context" to get target objref, and where to
+// get second level skeletons for that target. Both of those operations
+// will generally be abstracted (into library and stub code) so the main
+// body of this routine would be invisible to most applications.
+//
+// However, there are applications that need to do this stuff themselves
+// (like bridging between environments, e.g. different ORBs, languages, or
+// other object systems). Everything needed to work without using an IDL
+// compiler is a public, supported API.
+//
+static void
+level1_skeleton (
+ CORBA_OctetSeq &key,
+ CORBA_ServerRequest &req,
+ void *context,
+ CORBA_Environment &env
+)
+{
+ //
+ // Verify that the target object and "this" object have the
+ // same key. Normally, this would be used to figure out
+ // which object was the target, and hence which operations
+ // vector to dispatch the request.
+ //
+ CORBA_OctetSeq *obj_key;
+
+ obj_key = (CORBA_OctetSeq *) context;
+ if (obj_key->length != key.length
+ || ACE_OS::memcmp (obj_key->buffer, key.buffer,
+ obj_key->length) != 0)
+ {
+ env.exception (new CORBA_OBJECT_NOT_EXIST (COMPLETED_NO));
+#ifdef DEBUG
+ if (TAO_debug_level)
+ dmsg_opaque ("request to nonexistent object, key = ",
+ key.buffer, key.length);
+#endif
+ return;
+ }
+
+ //
+ // Find a "level 2 skeleton" for this operation, then
+ // call it with the right per-object state.
+ //
+ const TAO_Skel_Entry *entry;
+ CORBA_String opname;
+
+ opname = req.op_name ();
+ for (entry = &test1_operations [0]; entry->op_descriptor; entry++)
+ {
+ if (strcmp ((char *)opname, entry->op_descriptor->opname) == 0)
+ {
+ // We pass a bogus object because this version of the cubit example is
+ // so tightly coupled that it doesn't use it. Future modifications will,
+ // hopefully!
+ CORBA_Object_ptr bogus_object = 0;
+ entry->impl_skeleton (req, bogus_object, env);
+ return;
+ }
+ }
+
+ //
+ // XXX True top-level skeleton code would also have to understand
+ // the built-in operations:
+ //
+ // * _is_a (for narrowing tests) ... can be derived by searching an
+ // appropriately structured graph of level2 skeletons.
+ //
+ // * _non_existent ... if the level1 skeleton consults a module
+ // which understands object lifespans, this should be simple.
+ //
+ // * _get_interface ... could either (a) fail; (b) return the ref
+ // from some IFR; or most interestingly (c) return a ref to some
+ // code in this process that can answer all IFR queries from the
+ // skeleton data structures.
+ //
+ // * _get_implementation ... return some administrative hook to
+ // the object implementation:
+ //
+ // No other legal operations start with a character that's not an
+ // ASCII alphanumeric, for what it's worth.
+ //
+ // The skeleton might want to use data in the object key to find
+ // the objref's type; if it's integrated with object creation, and
+ // an per-process implementation repository, this should be easy.
+ //
+
+ //
+ // bypass level 2 skeletons for this one ...
+ //
+ if (strcmp ((char *) opname, "please_exit") == 0)
+ {
+ dmsg ("I've been asked to shut down...");
+ req.oa ()->please_shutdown (env);
+ dexc (env, "please_exit, please_shutdown");
+ return;
+ }
+
+ //
+ // No match. Operation not implemented; say so.
+ //
+ dmsg1 ("unknown operation, %s", opname);
+ env.exception (new CORBA_BAD_OPERATION (COMPLETED_NO));
+}
+
+
+//
+// Create and print the objref, listen for calls on it until done.
+//
+extern void
+print_exception (const CORBA_Exception *, const char *, FILE *f=stdout);
+
+int
+OA_listen (CORBA_ORB_ptr orb_ptr,
+ CORBA_BOA_ptr oa_ptr,
+ CORBA_String key,
+ int idle)
+{
+ //
+ // Create the object we'll be implementing.
+ //
+ CORBA_OctetSeq obj_key;
+ CORBA_Object_ptr obj;
+ CORBA_Environment env;
+
+ obj_key.buffer = (CORBA_Octet *) key;
+ obj_key.length = obj_key.maximum = ACE_OS::strlen (key);
+
+ obj = oa_ptr->create (obj_key, (CORBA_String) "", env);
+ if (env.exception () != 0)
+ {
+ print_exception (env.exception (), "BOA::create");
+ return 1;
+ }
+
+ //
+ // Stringify the objref we'll be implementing, and
+ // print it to stdout. Someone will take that string
+ // and give it to some client.
+ //
+ CORBA_String str;
+
+ str = orb_ptr->object_to_string (obj, env);
+ if (env.exception () != 0)
+ {
+ print_exception (env.exception (), "object2string");
+ return 1;
+ }
+ ACE_OS::puts ((char *)str);
+ ACE_OS::fflush (stdout);
+ dmsg1 ("listening as object '%s'", str);
+
+ //
+ // Clean up -- "key" is sufficient to dispatch all requests.
+ //
+ CORBA_release (obj);
+ CORBA_string_free (str);
+ env.clear ();
+
+ //
+ // Handle requests for this object until we're killed, or one of
+ // the methods makes us exit.
+ //
+ // NOTE: apart from registering the top level skeleton, the rest
+ // of this loop is exactly what BOA::run() does. It's here to
+ // show there's no magic.
+ //
+#if 0
+ oa_ptr->register_dir (level1_skeleton, &obj_key, env);
+#else
+ oa_ptr->register_dir (oa_ptr->dispatch, &obj_key, env);
+#endif
+ if (env.exception () != 0)
+ {
+ print_exception (env.exception (), "register_dir");
+ return 1;
+ }
+
+ for (;;) {
+ if (idle == -1)
+ oa_ptr->get_request (CORBA_B_FALSE, 0, env);
+ else
+ {
+ timeval tv;
+
+ tv.tv_sec = idle;
+ tv.tv_usec = 0;
+ oa_ptr->get_request (CORBA_B_FALSE, &tv, env);
+ }
+
+ CORBA_Exception_ptr xp;
+
+ if ((xp = env.exception ()) != 0)
+ {
+ CORBA_Environment env2; // XXX
+ char *id;
+
+ id = env.exception ()->id ();
+
+ //
+ // We get BAD_INV_ORDER if we call get_request() after
+ // shutdown was initiated. Simpler to rely on that
+ // than to arrange any handshaking in this simple app.
+ //
+ if (strcmp (id, _tc_CORBA_BAD_INV_ORDER->id (env2)) == 0)
+ {
+ break;
+
+ //
+ // Other exceptions are errors.
+ //
+ }
+ else
+ {
+ print_exception (env.exception (), "BOA::get_request");
+ return 1;
+ }
+ }
+ env.clear ();
+ }
+
+ //
+ // Shut down the OA -- recycles all underlying resources (e.g. file
+ // descriptors, etc).
+ //
+ // XXX shutdown is not quite the same as release, unless we want mem
+ // leaks to cause some rude failure modes. BOA just hasn't been
+ // updated yet to have any handshake about this though.
+ //
+ oa_ptr->Release ();
+ return 0;
+}
+
+
+//
+// Standard command line parsing utilities used.
+//
+int
+main (int argc, char *argv[])
+{
+ CORBA_Environment env;
+ CORBA_ORB_ptr orb_ptr;
+ CORBA_BOA_ptr oa_ptr;
+ CORBA_String key = (CORBA_String) "elvis";
+ char *oa_name = 0;
+ char *orb_name = "internet";
+ int idle = -1;
+
+ //
+ // Parse the command line, get options
+ //
+ ACE_Get_Opt get_opt (argc, argv, "dln:O:x");
+ int c;
+
+ while ((c = get_opt ()) != -1)
+ switch (c)
+ {
+ case 'd': // more debug noise
+ TAO_debug_level++;
+ continue;
+
+ case 'i': // idle seconds b4 exit
+ idle = ACE_OS::atoi (get_opt.optarg);
+ continue;
+
+ case 'k': // key (str)
+ key = (CORBA_String) get_opt.optarg;
+ continue;
+
+ case 'o': // orb name
+ orb_name = get_opt.optarg;
+ continue;
+
+ case 'p': // portnum
+ oa_name = get_opt.optarg;
+ continue;
+
+ // XXX set debug filters ...
+
+ //
+ // XXX ignore OMG-specified options ... hope nobody ever tries
+ // to use that "-ORB* param" and "-OA* param" syntax, it flies
+ // in the face of standard command parsing algorithms which
+ // require single-character option specifiers.
+ //
+
+
+ case '?':
+ default:
+ ACE_OS::fprintf (stderr, "usage: %s"
+ " [-d]"
+ " [-i idle_seconds]"
+ " [-k object_key=elvis]"
+ " [-o orbname=internet]"
+ " [-p oa_name]"
+ "\n", argv [0]
+ );
+ return 1;
+ }
+
+ orb_ptr = CORBA_ORB_init (argc, argv, orb_name, env);
+ if (env.exception () != 0) {
+ print_exception (env.exception (), "ORB init");
+ return 1;
+ }
+
+ //
+ // The BOA may or may not actually be named ...
+ //
+ oa_ptr = CORBA_BOA::get_named_boa (orb_ptr, oa_name, env);
+ if (env.exception () != 0) {
+ print_exception (env.exception (), "OA init");
+ return 1;
+ }
+
+ return OA_listen (orb_ptr, oa_ptr, key, idle);
+}
+