diff options
author | Chris Cleeland <chris.cleeland@gmail.com> | 1997-03-04 02:55:45 +0000 |
---|---|---|
committer | Chris Cleeland <chris.cleeland@gmail.com> | 1997-03-04 02:55:45 +0000 |
commit | 0ea5dd5da05b6a9b074feea81ea6383980b2b6b4 (patch) | |
tree | be26b9733691666d209621d52d789c00c75c7fb4 /TAO/IIOP | |
parent | 77694cbbc9a8dea2fa917689bc7f08d638c43164 (diff) | |
download | ATCD-0ea5dd5da05b6a9b074feea81ea6383980b2b6b4.tar.gz |
Completed "ACE-ification".
Some of the changes made to get to compile on NT broke things
here, so that will need to be resolved.
Modified Files:
Makefile clnt.cpp cubit.cpp svr.cpp test1.cpp test1_clnt.cpp
test1_svr.cpp
Diffstat (limited to 'TAO/IIOP')
-rw-r--r-- | TAO/IIOP/test/Makefile | 69 | ||||
-rw-r--r-- | TAO/IIOP/test/clnt.cpp | 166 | ||||
-rw-r--r-- | TAO/IIOP/test/cubit.cpp | 2 | ||||
-rw-r--r-- | TAO/IIOP/test/svr.cpp | 416 | ||||
-rw-r--r-- | TAO/IIOP/test/test1.cpp | 2 | ||||
-rw-r--r-- | TAO/IIOP/test/test1_clnt.cpp | 42 | ||||
-rw-r--r-- | TAO/IIOP/test/test1_svr.cpp | 73 |
7 files changed, 399 insertions, 371 deletions
diff --git a/TAO/IIOP/test/Makefile b/TAO/IIOP/test/Makefile index 3dfca9eab2e..6650e549dec 100644 --- a/TAO/IIOP/test/Makefile +++ b/TAO/IIOP/test/Makefile @@ -1,26 +1,61 @@ -# @(#)Makefile 1.12 95/09/30 -# Makefile for sanity checks - -ROOT = .. - -include $(ROOT)/Makefile.conf +#---------------------------------------------------------------------------- +# $Id$ +# +# Top-level Makefile for the ACE-ified Sun Ref. implementation +# of IIOP ORB +#---------------------------------------------------------------------------- -CPPFLAGS += -I$(ROOT)/proto/include +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- -LDLIBS = -Qoption ld -R$(ROOT)/proto/lib -L$(ROOT)/proto/lib -lcorba +LDLIBS = -lcorba PROG_SRCS = svr.cpp clnt.cpp cubit.cpp \ test1.cpp test1_clnt.cpp test1_svr.cpp \ echo_clnt.cpp echo_svr.cpp -TESTS = svr clnt test1_svr test1_clnt -# TESTS = svr clnt test1_svr test1_clnt echo_svr echo_clnt +LSRC = $(PROG_SRCS) +CUBIT_SVR_OBJS = svr.o cubit.o +CUBIT_CLT_OBJS = clnt.o cubit.o -######## -default: $(TESTS) -all: default +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 + +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. @@ -50,6 +85,7 @@ check: $(TESTS) @./clnt -n250 -O `cat obj.5` -x @echo '' +ifdef LOCALRULES ######## # CUBIT test svr: svr.o cubit.o @@ -71,10 +107,15 @@ 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 $(TESTS) obj.* core Templates.DB .make.state + -rm -rf *.o Log $(BIN) obj.* core Templates.DB .make.state install: -@echo "Nothing to install, these are tests!" + + + + diff --git a/TAO/IIOP/test/clnt.cpp b/TAO/IIOP/test/clnt.cpp index dbc0bed9603..139afb96136 100644 --- a/TAO/IIOP/test/clnt.cpp +++ b/TAO/IIOP/test/clnt.cpp @@ -8,19 +8,19 @@ #include <signal.h> #include <stdio.h> #include <stdlib.h> +#include <ace/Get_Opt.h> #if unix # include <unistd.h> # include <sys/time.h> #else // windows -#include "ace/Get_Opt.h" #endif // unix #include "cubit.hh" -#include "../lib/runtime/debug.hh" +#include <corba/debug.hh> #if !defined (DECLARED_GETTIMEOFDAY) @@ -65,54 +65,51 @@ main (int argc, char *argv[]) // // Parse command line and verify parameters. // - ACE_Get_Opt get_opt (argc, argv, "dn:O:x"); + ACE_Get_Opt opts (argc, argv, "dn:O:x"); int c; - while ((c = get_opt ()) != -1) - switch (c) - { - case 'd': // debug flag - debug_level++; - continue; - - case 'n': // loop count - loop_count = (unsigned) 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) - { - print_exception (env.exception (), "string2object"); - return 1; - } - } - continue; - - case 'x': - exit_later++; - continue; - - case '?': - default: - fprintf (stderr, "usage: %s" - " [-d]" - " [-n loopcount]" - " [-O objref]" - " [-x]" - "\n", argv [0] - ); - return 1; - } + while ((c = opts ()) != -1) + switch (c) { + case 'd': // debug flag + debug_level++; + continue; + + case 'n': // loop count + loop_count = (unsigned) ACE_OS::atoi (opts.optarg); + continue; + + case 'O': // stringified objref + { + objref = orb_ptr->string_to_object ( + (CORBA_String)opts.optarg, env); + if (env.exception () != 0) { + print_exception (env.exception (), "string2object"); + return 1; + } + } + 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; + } - if (CORBA_is_nil (objref) == CORBA_B_TRUE) - { - fprintf (stderr, "%s: must identify non-null target objref\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; } // @@ -123,17 +120,14 @@ main (int argc, char *argv[]) CORBA_Boolean type_ok; type_ok = objref->_is_a (Cubit__id, env); - if (env.exception () != 0) - { - print_exception (env.exception (), "check type of target"); - return -1; - } - else if (type_ok != CORBA_B_TRUE) - { - fprintf (stderr, "%s: target objref is of wrong type\n", - argv [0]); - printf ("type_ok = %d\n", type_ok); - return 1; + if (env.exception () != 0) { + print_exception (env.exception (), "check type of target"); + return -1; + } else if (type_ok != CORBA_B_TRUE) { + ACE_OS::fprintf (stderr, "%s: target objref is of wrong type\n", + argv [0]); + ACE_OS::printf ("type_ok = %d\n", type_ok); + return 1; } // @@ -150,12 +144,9 @@ main (int argc, char *argv[]) call_count = 0; error_count = 0; -#if defined (HAVE_GETTIMEOFDAY) - timeval before, after; + ACE_Time_Value before, after; - if (gettimeofday (&before, 0) < 0) - dperror ("gettimeofday before"); -#endif // defined (HAVE_GETTIMEOFDAY) + before = ACE_OS::gettimeofday(); for (i = 0; i < loop_count; i++) { // @@ -172,7 +163,7 @@ main (int argc, char *argv[]) dmsg2 ("cube octet: %d --> %d\n", arg_octet, ret_octet); arg_octet = arg_octet * arg_octet * arg_octet; if (arg_octet != ret_octet) { - printf ("** cube_octet(%d) ERROR (--> %d)\n", + ACE_OS::printf ("** cube_octet(%d) ERROR (--> %d)\n", (CORBA_Octet) func (i), ret_octet); error_count++; } @@ -192,8 +183,8 @@ main (int argc, char *argv[]) dmsg2 ("cube short: %d --> %d\n", arg_short, ret_short); arg_short = arg_short * arg_short * arg_short; if (arg_short != ret_short) { - printf ("** cube_short(%d) ERROR (--> %d)\n", - (CORBA_Short) func (i), ret_short); + ACE_OS::printf ("** cube_short(%d) ERROR (--> %d)\n", + (CORBA_Short) func (i), ret_short); error_count++; } } @@ -212,7 +203,7 @@ main (int argc, char *argv[]) dmsg2 ("cube long: %d --> %d\n", arg_long, ret_long); arg_long = arg_long * arg_long * arg_long; if (arg_long != ret_long) { - printf ("** cube_long(%ld) ERROR (--> %ld)\n", + ACE_OS::printf ("** cube_long(%ld) ERROR (--> %ld)\n", (CORBA_Long) func (i), ret_long); error_count++; } @@ -242,7 +233,7 @@ main (int argc, char *argv[]) if (arg_struct.l != ret_struct->l || arg_struct.s != ret_struct->s || arg_struct.o != ret_struct->o) { - printf ("** cube_struct ERROR\n"); + ACE_OS::printf ("** cube_struct ERROR\n"); error_count++; } delete ret_struct; @@ -250,28 +241,25 @@ main (int argc, char *argv[]) } -#if defined (HAVE_GETTIMEOFDAY) - if (gettimeofday (&after, 0) < 0) - dperror ("gettimeofday after"); + after = ACE_OS::gettimeofday(); - if (call_count > 0) { - if (error_count == 0) { - unsigned long us; + if (call_count > 0) + { + if (error_count == 0) + { + ACE_Time_Value diff = after - before; + unsigned long us = diff.sec() * 1000 * 1000 + diff.usec(); - us = after.tv_sec - before.tv_sec; - us *= 1000 * 1000; - us += after.tv_usec - before.tv_usec; us /= call_count; - printf ("cube average call time\t= %ld.%.03ldms, \t" - "%ld calls/second\n", - us / 1000, us % 1000, - 1000000L / us); - } + ACE_OS::printf ("cube average call ACE_OS::time\t= %ld.%.03ldms, \t" + "%ld calls/second\n", + us / 1000, us % 1000, + 1000000L / us); + } - printf ("%d calls, %d errors\n", call_count, error_count); - } -#endif // defined (HAVE_GETTIMEOFDAY) + ACE_OS::printf ("%d calls, %d errors\n", call_count, error_count); + } // // Simple test for DII: call "cube_struct". (It's not timed @@ -327,7 +315,7 @@ main (int argc, char *argv[]) result = (Cubit_Many *) req->result ()->value ()->value (); if (result->o != 27 || result->l != 125 || result->s != -343) - fprintf (stderr, "DII cube_struct -- bad results\n"); + ACE_OS::fprintf (stderr, "DII cube_struct -- bad results\n"); else dmsg ("DII cube_struct ... success!!"); @@ -348,7 +336,7 @@ main (int argc, char *argv[]) if (exit_later) { Cubit_please_exit (objref, env); - dexc (env, "server, please exit"); + dexc (env, "server, please ACE_OS::exit"); } CORBA_release (objref); @@ -384,7 +372,7 @@ cube_union_stub( u.l = u.l * u.l * u.l ; if (u.l != r->l) { - printf ("** cube_union ERROR\n"); + ACE_OS::printf ("** cube_union ERROR\n"); error_count++; } @@ -418,7 +406,7 @@ cube_union_stub( if (u.cm.l != r->cm.l || u.cm.s != r->cm.s || u.cm.o != r->cm.o) { - printf ("** cube_union ERROR\n"); + ACE_OS::printf ("** cube_union ERROR\n"); error_count++; } @@ -492,7 +480,7 @@ cube_union_dii ( if (r->cm.o != 27 || r->cm.l != 125 || r->cm.s != -343) { error_count++; - fprintf (stderr, "cube_union_dii -- bad results\n"); + ACE_OS::fprintf (stderr, "cube_union_dii -- bad results\n"); } else dmsg ("cube_union_dii ... success!!"); diff --git a/TAO/IIOP/test/cubit.cpp b/TAO/IIOP/test/cubit.cpp index 077ba286522..d5291bbbf34 100644 --- a/TAO/IIOP/test/cubit.cpp +++ b/TAO/IIOP/test/cubit.cpp @@ -35,7 +35,7 @@ #include "cubit.hh" // for stubs ... #include <corba/toa.hh> // ... and skeletons -#include "../lib/runtime/debug.hh" // ... and debugging +#include <corba/debug.hh> // ... and debugging // diff --git a/TAO/IIOP/test/svr.cpp b/TAO/IIOP/test/svr.cpp index e6340e77f60..3e32c4c160e 100644 --- a/TAO/IIOP/test/svr.cpp +++ b/TAO/IIOP/test/svr.cpp @@ -10,12 +10,12 @@ #include <stdio.h> #include <string.h> +#include <ace/Get_Opt.h> #if unix # include <unistd.h> // for getopt on some systems #else // windows -#include "ace/Get_Opt.h" #endif @@ -26,14 +26,14 @@ // // XXX a general debug/trace facility would be handy // -#include "../lib/runtime/debug.hh" +#include <corba/debug.hh> // // XXX this stuff is ugly but needed, since this exposes features // (IIOP forwarding) that TOA doesn't provide. // -#include "../lib/bridge/connmgr.hh" -#include "../lib/bridge/tcpoa.hh" +#include <connmgr.hh> +#include <tcpoa.hh> // extern char *optarg; // missing on some platforms @@ -61,9 +61,8 @@ is_a_skel ( return; } - CORBA_Boolean *retval; - CORBA_String value = *(CORBA_String *) - nv->value ()->value (); + CORBA_Boolean *retval; + CORBA_String value = *(CORBA_String *) nv->value()->value(); // // This object's type "is_a" conformant subtype of the type whose @@ -80,14 +79,13 @@ is_a_skel ( // XXX "env" should be checked to see if TypeCode::id() reported // an exception ... // - if (strcmp ((char *)value, (char *)Cubit__id) == 0 - || strcmp ((char *)value, _tc_CORBA_Object->id (env)) == 0) + if (ACE_OS::strcmp ((char*)value, Cubit__id) == 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); + CORBA_Any *any = new CORBA_Any (_tc_CORBA_Boolean, retval, CORBA_B_TRUE); req.result (any, env); dexc (env, "_is_a, result"); @@ -118,8 +116,8 @@ tcpoa_dispatch ( obj_key = (CORBA_OctetSeq *) context; if (obj_key->length != key.length - || memcmp (obj_key->buffer, key.buffer, - obj_key->length) != 0) { + || ACE_OS::memcmp (obj_key->buffer, key.buffer, + obj_key->length) != 0) { env.exception (new CORBA_OBJECT_NOT_EXIST (COMPLETED_NO)); #ifdef DEBUG if (debug_level) @@ -140,7 +138,7 @@ tcpoa_dispatch ( opname = req.op_name (); for (entry = &Cubit_operations [0]; entry->op_descriptor; entry++) { - if (strcmp ((char *)opname, entry->op_descriptor->opname) == 0) { + if (ACE_OS::strcmp ((char *)opname, entry->op_descriptor->opname) == 0) { entry->impl_skeleton (req, env); return; } @@ -154,7 +152,7 @@ tcpoa_dispatch ( // objref's type), and _get_implementation (needs an implementation // repository). // - if (strcmp ((char *)opname, "_is_a") == 0) { + if (ACE_OS::strcmp ((char *)opname, "_is_a") == 0) { is_a_skel (req, env); return; } @@ -179,15 +177,15 @@ tcpoa_forwarder ( CORBA_Environment &env ) { - CORBA_OctetSeq *obj_key; + CORBA_OctetSeq *obj_key; - obj_key = (CORBA_OctetSeq *) context; + obj_key = (CORBA_OctetSeq *) context; - if (obj_key->length == key.length - && memcmp (obj_key->buffer, key.buffer, key.length) == 0) { - the_ref = fwd_ref->_duplicate (fwd_ref); - } else - env.exception (new CORBA_OBJECT_NOT_EXIST (COMPLETED_NO)); + if (obj_key->length == key.length + && ACE_OS::memcmp (obj_key->buffer, key.buffer, key.length) == 0) { + the_ref = fwd_ref->_duplicate (fwd_ref); + } else + env.exception (new CORBA_OBJECT_NOT_EXIST (COMPLETED_NO)); } @@ -204,126 +202,126 @@ OA_listen ( CORBA_Boolean do_threads ) { - // - // 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 = strlen ((char *)key); + // + // 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 ((char *)key); + + obj = oa_ptr->create (obj_key, (CORBA_String) "", env); + if (env.exception () != 0) { + print_exception (env.exception (), "TCP_OA::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. 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); + CORBA_release (obj); + obj = 0; + + // + // If we're forking a child server, do so -- read the objref + // it'll use, and prepare to forward all requests to it. That + // objref has a dynamically assigned port. + // + if (do_fork) { +#if defined (HAVE_POPEN) + FILE *f = popen ("exec ./svr -i120 -kbaskerville", "r"); + char buffer [BUFSIZ]; - obj = oa_ptr->create (obj_key, (CORBA_String) "", env); - if (env.exception () != 0) { - print_exception (env.exception (), "TCP_OA::create"); - return 1; + if (ACE_OS::fgets (buffer, sizeof buffer, f) != buffer) { + ACE_OS::fprintf (stderr, "error: can't read from child\n"); + 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. Then release the object. - // - CORBA_String str; - - str = orb_ptr->object_to_string (obj, env); + fwd_ref = orb_ptr->string_to_object ((CORBA_String) buffer, env); if (env.exception () != 0) { - print_exception (env.exception (), "object2string"); - return 1; + print_exception (env.exception (), "string2object"); + return 1; } - puts ((char *)str); - fflush (stdout); - dmsg1 ("listening as object '%s'", str); - CORBA_release (obj); - obj = 0; // - // If we're forking a child server, do so -- read the objref - // it'll use, and prepare to forward all requests to it. That - // objref has a dynamically assigned port. + // NOTE: don't fclose("f") since some systems make that the + // same as pclose("f"). Pclose waits for the child to exit, + // causing a deadlock since the child won't exit until it's + // told to do so by a client, but no client can be redirected + // to the child until the pclose returns ... // - if (do_fork) { -#if defined (HAVE_POPEN) - FILE *f = popen ("exec ./svr -i120 -kbaskerville", "r"); - char buffer [BUFSIZ]; - - if (fgets (buffer, sizeof buffer, f) != buffer) { - fprintf (stderr, "error: can't read from child\n"); - return 1; - } - fwd_ref = orb_ptr->string_to_object ((CORBA_String) buffer, env); - if (env.exception () != 0) { - print_exception (env.exception (), "string2object"); - return 1; - } - - // - // NOTE: don't fclose("f") since some systems make that the - // same as pclose("f"). Pclose waits for the child to exit, - // causing a deadlock since the child won't exit until it's - // told to do so by a client, but no client can be redirected - // to the child until the pclose returns ... - // #else - fprintf (stderr, "error: no popen(), can't create child\n"); -// env.exception (new CORBA_IMP_LIMIT); - return 1; + ACE_OS::fprintf (stderr, "error: no popen(), can't create child\n"); + env.exception (new CORBA_IMP_LIMIT(COMPLETED_NO)); + return 1; #endif // !defined (HAVE_POPEN) + } + + // + // Handle requests for this object until we're killed, or one of + // the methods asks us to exit. + // + // NOTE: for multithreaded environments (e.g. POSIX threads) also + // want to use threads. The current notion is to dedicate a thread + // to a "read" on each client file descriptor, and then when that + // successfully gets a Request message, to start another thread + // reading that descriptor while the first one creates the Reply. + // + // This will accentuate the need for server-side policies to address + // resource management, such as shutting down connections that have + // no requests in progress after they've been idle for some time + // period (e.g. 10 minutes), and reclaiming the thread used by that + // connection. + // + while (oa_ptr->shutting_down () != CORBA_B_TRUE) { + if (idle == -1) + oa_ptr->get_request (tcpoa_dispatch, + fwd_ref ? tcpoa_forwarder : 0, + do_threads, &obj_key, 0, env); + else { + timeval tv; + + tv.tv_sec = idle; + tv.tv_usec = 0; + oa_ptr->get_request (tcpoa_dispatch, + fwd_ref ? tcpoa_forwarder : 0, + do_threads, &obj_key, &tv, env); } // - // Handle requests for this object until we're killed, or one of - // the methods asks us to exit. - // - // NOTE: for multithreaded environments (e.g. POSIX threads) also - // want to use threads. The current notion is to dedicate a thread - // to a "read" on each client file descriptor, and then when that - // successfully gets a Request message, to start another thread - // reading that descriptor while the first one creates the Reply. - // - // This will accentuate the need for server-side policies to address - // resource management, such as shutting down connections that have - // no requests in progress after they've been idle for some time - // period (e.g. 10 minutes), and reclaiming the thread used by that - // connection. + // XXX "env2" should be checked to see if TypeCode::id() reported + // an exception ... // - while (oa_ptr->shutting_down () != CORBA_B_TRUE) { - if (idle == -1) - oa_ptr->get_request (tcpoa_dispatch, - fwd_ref ? tcpoa_forwarder : 0, - do_threads, &obj_key, 0, env); - else { - timeval tv; - - tv.tv_sec = idle; - tv.tv_usec = 0; - oa_ptr->get_request (tcpoa_dispatch, - fwd_ref ? tcpoa_forwarder : 0, - do_threads, &obj_key, &tv, env); - } - - // - // XXX "env2" should be checked to see if TypeCode::id() reported - // an exception ... - // - CORBA_Environment env2; - - if (env.exception () != 0 - && strcmp ((char *)env.exception ()->id (), - _tc_CORBA_INITIALIZE->id (env2)) == 0) { - print_exception (env.exception (), "TCP_OA::get_request"); - return 1; - } - env.clear (); - } + CORBA_Environment env2; - // - // Shut down the OA -- recycles all underlying resources (e.g. file - // descriptors, etc). - // - oa_ptr->clean_shutdown (env); - return 0; + if (env.exception () != 0 + && ACE_OS::strcmp ((char *)env.exception ()->id (), + _tc_CORBA_INITIALIZE->id (env2)) == 0) { + print_exception (env.exception (), "TCP_OA::get_request"); + return 1; + } + env.clear (); + } + + // + // Shut down the OA -- recycles all underlying resources (e.g. file + // descriptors, etc). + // + oa_ptr->clean_shutdown (env); + return 0; } @@ -336,90 +334,88 @@ main ( char *argv[] ) { - CORBA_Environment env; - CORBA_ORB_ptr orb_ptr; - TCP_OA_ptr oa_ptr; - CORBA_Boolean do_fork = CORBA_B_FALSE; - CORBA_Boolean do_threads = CORBA_B_FALSE; - CORBA_String key = (CORBA_String) "key0"; - char *oa_name = 0; - char *orb_name = "internet"; - int idle = -1; - - // - // Parse the command line, get options - // - ACE_Get_Opt get_opt (argc, argv, "di:fk:o:p:t"); - - int c; - - while ((c = get_opt ()) != -1) - switch (c) { - case 'd': // more debug noise - debug_level++; - continue; - - case 'i': // idle seconds b4 exit - idle = atoi (get_opt.optarg); - continue; - - case 'f': // fork child server - do_fork = CORBA_B_TRUE; - 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; + CORBA_Environment env; + CORBA_ORB_ptr orb_ptr; + TCP_OA_ptr oa_ptr; + CORBA_Boolean do_fork = CORBA_B_FALSE; + CORBA_Boolean do_threads = CORBA_B_FALSE; + CORBA_String key = (CORBA_String) "key0"; + char *oa_name = 0; + char *orb_name = "internet"; + int idle = -1; + + // + // Parse the command line, get options + // + ACE_Get_Opt opts (argc, argv, "di:fk:o:p:t"); + int c; + + while ((c = opts()) != -1) + switch (c) { + case 'd': // more debug noise + debug_level++; + continue; + + case 'i': // idle seconds b4 exit + idle = ACE_OS::atoi (opts.optarg); + continue; + + case 'f': // fork child server + do_fork = CORBA_B_TRUE; + continue; + + case 'k': // key (str) + key = (CORBA_String) opts.optarg; + continue; + + case 'o': // orb name + orb_name = opts.optarg; + continue; + + case 'p': // portnum + oa_name = opts.optarg; + continue; - case 't': // create thread-per-request - do_threads = CORBA_B_TRUE; - 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: - fprintf (stderr, "usage: %s" - " [-d]" - " [-f]" - " [-i idle_seconds]" - " [-k]" - " [-k object_key=key0]" - " [-o orb_name=internet]" - " [-p portnum=5555]" - " [-t]" - "\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; + case 't': // create thread-per-request + do_threads = CORBA_B_TRUE; + 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]" + " [-f]" + " [-i idle_seconds]" + " [-k]" + " [-k object_key=key0]" + " [-o orb_name=internet]" + " [-p portnum=5555]" + " [-t]" + "\n", argv [0] + ); + return 1; } - oa_ptr = TCP_OA::init (orb_ptr, oa_name, env); - if (env.exception () != 0) { - print_exception (env.exception (), "OA init"); - return 1; - } + orb_ptr = CORBA_ORB_init (argc, argv, orb_name, env); + if (env.exception () != 0) { + print_exception (env.exception (), "ORB init"); + return 1; + } - return OA_listen (orb_ptr, oa_ptr, key, idle, do_fork, do_threads); -} + oa_ptr = TCP_OA::init (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, do_fork, do_threads); +} diff --git a/TAO/IIOP/test/test1.cpp b/TAO/IIOP/test/test1.cpp index dbeb800d249..8228d8f2e53 100644 --- a/TAO/IIOP/test/test1.cpp +++ b/TAO/IIOP/test/test1.cpp @@ -217,7 +217,9 @@ DEFINE_TEST (wchar, WChar); // show up in this macro ... DEFINE_TEST3 (wstring, WChar *, WString); +#if !defined(NONNATIVE_LONGDOUBLE) DEFINE_TEST (longdouble, LongDouble); +#endif #undef DEFINE_TEST diff --git a/TAO/IIOP/test/test1_clnt.cpp b/TAO/IIOP/test/test1_clnt.cpp index d0f017b7644..4583818105e 100644 --- a/TAO/IIOP/test/test1_clnt.cpp +++ b/TAO/IIOP/test/test1_clnt.cpp @@ -11,17 +11,17 @@ #include <stdio.h> #include <string.h> +#include <ace/Get_Opt.h> #if unix # include <unistd.h> #else // windows -#include "ace/Get_Opt.h" #endif // unix #include "test1.hh" -#include "../lib/runtime/debug.hh" +#include <corba/debug.hh> #if !defined (_WIN32) @@ -71,7 +71,7 @@ print_exception (const CORBA_Exception *, const char *, FILE *f=stdout); } else if (!COMPARE (CORBA_ ## type, v1, value1) \ || !COMPARE (CORBA_ ## type, v2, value1) \ || !COMPARE (CORBA_ ## type, v3, value2) ) { \ - fprintf (stderr, "bad comparison, test_" #name "\n"); \ + ACE_OS::fprintf (stderr, "bad comparison, test_" #name "\n"); \ BAD_COMPARE_VALUES(type,v1,v2,v3,value1,value2) \ error_count++; \ } \ @@ -401,7 +401,7 @@ do_tests ( if (strcmp ((char *)xp->id (), (char *) _tc_test1_x1->id (env2)) != 0) { error_count++; - fprintf (stderr, "test_throw case 1, " + ACE_OS::fprintf (stderr, "test_throw case 1, " "wrong exception thrown (id = '%s')\n", xp->id ()); } else { @@ -409,7 +409,7 @@ do_tests ( if (xp2->case_num != -5) { error_count++; - fprintf (stderr, "test_throw case 1, " + ACE_OS::fprintf (stderr, "test_throw case 1, " "wrong value (case_num = '%ld')\n", xp2->case_num); } @@ -418,7 +418,7 @@ do_tests ( } } else { error_count++; - fprintf (stderr, "test_throw case 1, " + ACE_OS::fprintf (stderr, "test_throw case 1, " "no exception thrown !!\n"); } @@ -437,7 +437,7 @@ do_tests ( if (strcmp ((char *)xp->id (), (char *) _tc_test1_x2->id (env2)) != 0) { error_count++; - fprintf (stderr, "test_throw case 2, " + ACE_OS::fprintf (stderr, "test_throw case 2, " "wrong exception thrown (id = '%s')\n", xp->id ()); } else { @@ -445,14 +445,14 @@ do_tests ( if (xp2->case_num != 101) { error_count++; - fprintf (stderr, "test_throw case 2, " + 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++; - fprintf (stderr, "test_throw case 2, " + ACE_OS::fprintf (stderr, "test_throw case 2, " "non-null objref thrown\n"); } @@ -460,7 +460,7 @@ do_tests ( } } else { error_count++; - fprintf (stderr, "test_throw case 2, " + ACE_OS::fprintf (stderr, "test_throw case 2, " "no exception thrown !!\n"); } @@ -485,7 +485,7 @@ do_tests ( if (strcmp ((char *)xp->id (), (char *) _tc_test1_x2->id (env2)) != 0) { error_count++; - fprintf (stderr, "test_throw case 3, " + ACE_OS::fprintf (stderr, "test_throw case 3, " "wrong exception thrown (id = '%s')\n", xp->id ()); } else { @@ -493,7 +493,7 @@ do_tests ( if (xp2->case_num != 42) { error_count++; - fprintf (stderr, "test_throw case 3, " + ACE_OS::fprintf (stderr, "test_throw case 3, " "wrong value (case_num = '%ld')\n", xp2->case_num); } @@ -508,7 +508,7 @@ do_tests ( "test_throw/3 call to is_equivalent"); } else if (status != CORBA_B_TRUE) { error_count++; - fprintf (stderr, "test_throw case 3, " + ACE_OS::fprintf (stderr, "test_throw case 3, " "non-equivalent objref thrown\n"); } @@ -516,7 +516,7 @@ do_tests ( } } else { error_count++; - fprintf (stderr, "test_throw case 3, " + ACE_OS::fprintf (stderr, "test_throw case 3, " "no exception thrown !!\n"); } @@ -532,9 +532,9 @@ do_tests ( test_count++; test_illegal (target, env); if (env.exception () == 0 - || strcmp ((char *) env.exception()->id(), + || ACE_OS::strcmp ((char *) env.exception()->id(), (char *) _tc_CORBA_BAD_OPERATION->id (env2)) != 0) { - fprintf (stderr, "couldn't generate BAD_OPERATION exception\n"); + ACE_OS::fprintf (stderr, "couldn't generate BAD_OPERATION exception\n"); error_count++; } } @@ -574,7 +574,7 @@ main (int argc, char *argv[]) continue; case 'n': // loop count - loop_count = (unsigned) atoi (get_opt.optarg); + loop_count = (unsigned) ACE_OS::atoi (get_opt.optarg); continue; case 'O': // stringified objref @@ -594,7 +594,7 @@ main (int argc, char *argv[]) case '?': default: - fprintf (stderr, "usage: %s" + ACE_OS::fprintf (stderr, "usage: %s" " [-d]" " [-l]" " [-n loopcount]" @@ -606,7 +606,7 @@ main (int argc, char *argv[]) } if (CORBA_is_nil (objref) == CORBA_B_TRUE) { - fprintf (stderr, "%s: must identify non-null target objref\n", + ACE_OS::fprintf (stderr, "%s: must identify non-null target objref\n", argv [0]); return 1; } @@ -614,14 +614,14 @@ main (int argc, char *argv[]) do_tests (objref, loop_count, tests, errors); - char *progname = strrchr (argv [0], '/'); + char *progname = ACE_OS::strrchr (argv [0], '/'); if (progname != 0) progname += 1; else progname = argv [0]; - fprintf (stderr, "%s: %d loops, %d tests (%d errors)\n", + ACE_OS::fprintf (stderr, "%s: %d loops, %d tests (%d errors)\n", progname, loop_count, tests, errors); if (exit_later) { diff --git a/TAO/IIOP/test/test1_svr.cpp b/TAO/IIOP/test/test1_svr.cpp index 6ce7c40cf51..0531aaa03cb 100644 --- a/TAO/IIOP/test/test1_svr.cpp +++ b/TAO/IIOP/test/test1_svr.cpp @@ -10,19 +10,19 @@ #include <stdio.h> #include <string.h> +#include <ace/Get_Opt.h> #if unix # include <unistd.h> // for getopt on some systems #else // windows -#include "ace/Get_Opt.h" #endif #include "test1.hh" #include <corba/toa.hh> -#include "../lib/runtime/debug.hh" +#include <corba/debug.hh> @@ -106,10 +106,10 @@ extern char *optarg; // missing on some platforms return; \ } \ } \ - calldata test1_ ## name ## _calldata; + extern calldata test1_ ## name ## _calldata; -const calldata test1_void_calldata; +extern const calldata test1_void_calldata; static void _test1_test_void ( @@ -227,7 +227,7 @@ DEFINE_SKEL3 (wstring, WString, WString) // void test_throw (in long case_num) raises (x1, x2); // -const calldata test1_test_throw_calldata; +extern const calldata test1_test_throw_calldata; static void _test1_test_throw ( @@ -371,7 +371,7 @@ level1_skeleton ( obj_key = (CORBA_OctetSeq *) context; if (obj_key->length != key.length - || memcmp (obj_key->buffer, key.buffer, + || ACE_OS::memcmp (obj_key->buffer, key.buffer, obj_key->length) != 0) { env.exception (new CORBA_OBJECT_NOT_EXIST (COMPLETED_NO)); #ifdef DEBUG @@ -463,7 +463,7 @@ OA_listen ( CORBA_Environment env; obj_key.buffer = (CORBA_Octet *) key; - obj_key.length = obj_key.maximum = strlen (key); + obj_key.length = obj_key.maximum = ACE_OS::strlen (key); obj = oa_ptr->create (obj_key, (CORBA_String) "", env); if (env.exception () != 0) { @@ -483,8 +483,8 @@ OA_listen ( print_exception (env.exception (), "object2string"); return 1; } - puts ((char *)str); - fflush (stdout); + ACE_OS::puts ((char *)str); + ACE_OS::fflush (stdout); dmsg1 ("listening as object '%s'", str); // @@ -580,26 +580,27 @@ main (int argc, char *argv[]) int c; while ((c = get_opt ()) != -1) - switch (c) { - case 'd': // more debug noise - debug_level++; - continue; + switch (c) + { + case 'd': // more debug noise + debug_level++; + continue; - case 'i': // idle seconds b4 exit - idle = atoi (get_opt.optarg); - 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 'k': // key (str) + key = (CORBA_String) get_opt.optarg; + continue; - case 'o': // orb name - orb_name = get_opt.optarg; - continue; + case 'o': // orb name + orb_name = get_opt.optarg; + continue; - case 'p': // portnum - oa_name = get_opt.optarg; - continue; + case 'p': // portnum + oa_name = get_opt.optarg; + continue; // XXX set debug filters ... @@ -611,17 +612,17 @@ main (int argc, char *argv[]) // - case '?': - default: - fprintf (stderr, "usage: %s" - " [-d]" - " [-i idle_seconds]" - " [-k object_key=elvis]" - " [-o orbname=internet]" - " [-p oa_name]" - "\n", argv [0] - ); - return 1; + 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); |