summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/Concurrency
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/tests/Concurrency')
-rw-r--r--TAO/orbsvcs/tests/Concurrency/CC_client.cpp475
-rw-r--r--TAO/orbsvcs/tests/Concurrency/CC_client.h142
-rw-r--r--TAO/orbsvcs/tests/Concurrency/CC_command.cpp684
-rw-r--r--TAO/orbsvcs/tests/Concurrency/CC_command.h475
-rw-r--r--TAO/orbsvcs/tests/Concurrency/CC_command.l58
-rw-r--r--TAO/orbsvcs/tests/Concurrency/CC_command.tab.cpp1071
-rw-r--r--TAO/orbsvcs/tests/Concurrency/CC_command.tab.h32
-rw-r--r--TAO/orbsvcs/tests/Concurrency/CC_command.y126
-rw-r--r--TAO/orbsvcs/tests/Concurrency/CC_naming_service.cpp185
-rw-r--r--TAO/orbsvcs/tests/Concurrency/CC_naming_service.h86
-rw-r--r--TAO/orbsvcs/tests/Concurrency/CC_test_utils.cpp73
-rw-r--r--TAO/orbsvcs/tests/Concurrency/CC_test_utils.h37
-rw-r--r--TAO/orbsvcs/tests/Concurrency/CC_tests.cpp388
-rw-r--r--TAO/orbsvcs/tests/Concurrency/CC_tests.h183
-rw-r--r--TAO/orbsvcs/tests/Concurrency/Concurrency.mpc6
-rw-r--r--TAO/orbsvcs/tests/Concurrency/Makefile.am59
-rw-r--r--TAO/orbsvcs/tests/Concurrency/README111
-rw-r--r--TAO/orbsvcs/tests/Concurrency/lex.CC_command.cpp1702
-rw-r--r--TAO/orbsvcs/tests/Concurrency/lex.CC_command.cpp.diff209
-rw-r--r--TAO/orbsvcs/tests/Concurrency/test.basic21
-rw-r--r--TAO/orbsvcs/tests/Concurrency/test.dinphil12
-rw-r--r--TAO/orbsvcs/tests/Concurrency/test.e12
-rw-r--r--TAO/orbsvcs/tests/Concurrency/test.extended4
-rw-r--r--TAO/orbsvcs/tests/Concurrency/test.phil16
-rw-r--r--TAO/orbsvcs/tests/Concurrency/test.phil26
-rw-r--r--TAO/orbsvcs/tests/Concurrency/test.phil36
-rw-r--r--TAO/orbsvcs/tests/Concurrency/test.phil46
-rw-r--r--TAO/orbsvcs/tests/Concurrency/test.phil56
28 files changed, 6171 insertions, 0 deletions
diff --git a/TAO/orbsvcs/tests/Concurrency/CC_client.cpp b/TAO/orbsvcs/tests/Concurrency/CC_client.cpp
new file mode 100644
index 00000000000..93760c93800
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/CC_client.cpp
@@ -0,0 +1,475 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/orbsvcs/tests
+//
+// = FILENAME
+// CC_client.h
+//
+// = DESCRIPTION
+// This is the test class for the concurrency service. The class
+// implements a client to the concurrency service.
+// This file contains the main function for the test.
+//
+// = AUTHORS
+// Torben Worm <tworm@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "CC_client.h"
+
+#include "tao/debug.h"
+
+#include "ace/Read_Buffer.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_unistd.h"
+#include "ace/os_include/os_ctype.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_fcntl.h"
+
+ACE_RCSID(Concurrency, CC_client, "$Id$")
+
+// Constructor.
+CC_Client::CC_Client (void)
+ : naming_service_ (0),
+ cc_factory_ior_file_ (0),
+ cc_factory_key_ (0),
+ f_handle_ (ACE_INVALID_HANDLE),
+ shutdown_ (0),
+ use_naming_service_ (1),
+ run_basic_tests_ (0),
+ run_extended_tests_ (0),
+ use_script_file_ (0),
+ script_file_ (0)
+{
+}
+
+CC_Client::~CC_Client (void)
+{
+ // Free resources and close the ior files.
+ if (this->cc_factory_ior_file_)
+ ACE_OS::fclose (this->cc_factory_ior_file_);
+
+ if (this->f_handle_ != ACE_INVALID_HANDLE)
+ ACE_OS::close (this->f_handle_);
+
+ if (this->cc_factory_key_ != 0)
+ ACE_OS::free (this->cc_factory_key_);
+
+ if (naming_service_!=0)
+ delete naming_service_;
+}
+
+// Reads the lock set factory ior from a file
+
+int
+CC_Client::read_ior (char *filename)
+{
+ // Open the file for reading.
+ this->f_handle_ = ACE_OS::open (filename,0);
+
+ if (this->f_handle_ == ACE_INVALID_HANDLE)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to open %s for writing: %p\n",
+ filename),
+ -1);
+ ACE_Read_Buffer ior_buffer (this->f_handle_);
+ this->cc_factory_key_ = ior_buffer.read ();
+
+ if (this->cc_factory_key_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to allocate memory to read ior: %p\n"),
+ -1);
+ return 0;
+}
+
+// Parses the command line arguments and returns an error status.
+
+int
+CC_Client::parse_args (void)
+{
+ ACE_Get_Opt get_opts (argc_, argv_, "dc:sf:k:xbhe:");
+ int c;
+ int result;
+
+ if(argc_==1) // No arguments given on command line
+ {
+ print_usage();
+ return -1;
+ }
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'b': // debug flag
+ this->run_basic_tests_ = 1;
+ break;
+ case 'c':
+ this->use_script_file_ = 1;
+ this->script_file_ = ACE_OS::strdup (get_opts.opt_arg ());
+ break;
+ case 'd': // debug flag
+ TAO_debug_level++;
+ break;
+ case 'e': // debug flag
+ run_extended_tests_ = 1;
+ this->extended_tests_params_ = ACE_OS::strdup (get_opts.opt_arg ());
+ break;
+ case 'f': // read the IOR from the file.
+ result = this->read_ior (get_opts.opt_arg ());
+ if (result < 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to read ior from %s : %p\n",
+ get_opts.opt_arg ()),
+ -1);
+ break;
+ case 'k': // read the cubit IOR from the command-line.
+ this->cc_factory_key_ =
+ ACE_OS::strdup (get_opts.opt_arg ());
+ break;
+ case 'x':
+ this->shutdown_ = 1;
+ break;
+ case 's': // Don't use the TAO Naming Service.
+ this->use_naming_service_ = 0;
+ break;
+ case 'h':
+ default:
+ print_usage ();
+ ACE_ERROR_RETURN ((LM_ERROR, ""), -1);
+ }
+
+ // Indicates successful parsing of command line.
+ return 0;
+}
+
+// Execute client example code.
+
+int
+CC_Client::run (void)
+{
+ int tests_run = 0;
+ // Tells whether any tests have been run
+
+ int success = CC_SUCCESS;
+ // Did test succeed?
+
+ if (this->run_basic_tests_ && success == CC_SUCCESS)
+ {
+ success = run_basic_tests ();
+ if(success==CC_FAIL)
+ ACE_DEBUG((LM_DEBUG, "Basic tests did not succeed\n"));
+ tests_run = 1;
+ }
+
+ if (this->run_extended_tests_ && success == CC_SUCCESS)
+ {
+ success = run_extended_tests (this->extended_tests_params_);
+ if(success==CC_FAIL)
+ ACE_DEBUG((LM_DEBUG, "Extended tests did not succeed\n"));
+ tests_run = 1;
+ }
+
+ if(this->use_script_file_ && success == CC_SUCCESS)
+ {
+ cmdlist = new CC_CommandList();
+ FILE *f;
+
+ // Open the command file for parsing if the filename!=stdin
+ if(ACE_OS::strcmp(this->script_file_, "stdin")!=0)
+ {
+ f = ACE_OS::fopen(this->script_file_, "r");
+ if(f==0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to open %s\n",
+ this->script_file_),
+ -1);
+ ace_cc_yyin = f;
+ }
+ ace_cc_yyparse();
+ }
+
+ // Other tests go here
+ // if (other_test_flag && success == CC_SUCCESS) ...
+
+ if (this->shutdown_)
+ // @@TAO is this needed??
+
+ if (tests_run == 0)
+ {
+ print_usage ();
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "No tests given\n"),
+ -1);
+ }
+
+ return success;
+}
+
+// This function runs basic tests concerned with only one lock set
+
+int
+CC_Client::run_basic_tests (void)
+{
+ Test_Single_Lock_With_Mode t1 (naming_service_,
+ CosConcurrencyControl::read);
+ Test_Single_Lock_With_Mode t2 (naming_service_,
+ CosConcurrencyControl::write);
+ Test_Single_Lock_With_Mode t3 (naming_service_,
+ CosConcurrencyControl::upgrade);
+ Test_Single_Lock_With_Mode t4 (naming_service_,
+ CosConcurrencyControl::intention_read);
+ Test_Single_Lock_With_Mode t5 (naming_service_,
+ CosConcurrencyControl::intention_write);
+ // This test should be run for several different lock mode, but
+ // since we do not support
+ Test_Release_Not_Held_Lock t6 (naming_service_,
+ CosConcurrencyControl::read);
+ if (t1.run () == CC_SUCCESS &&
+ t2.run () == CC_SUCCESS &&
+ t3.run () == CC_SUCCESS &&
+ t4.run () == CC_SUCCESS &&
+ t5.run () == CC_SUCCESS &&
+ t6.run () == CC_SUCCESS )
+ return CC_SUCCESS;
+ else
+ return CC_FAIL;
+}
+
+int
+CC_Client::check_extended_test_params(char *params)
+{
+ // Format (regexp): [0-9]+;.*;.*
+ int no_of_params = 0;
+ char *cp = params; // pointer to walk along the string
+ enum {TAO_START, TAO_NUMBER, TAO_ARG, TAO_ERROR} state = TAO_START;
+
+ while(*cp!='\0')
+ {
+ switch(state)
+ {
+ case TAO_START:
+ if(isdigit(*cp))
+ state = TAO_NUMBER;
+ else
+ state = TAO_ERROR;
+ break;
+
+ case TAO_NUMBER:
+ if((*cp)==';')
+ {
+ state = TAO_ARG;
+ no_of_params++;
+ }
+ else
+ if(!isdigit(*cp))
+ state = TAO_ERROR;
+ break;
+
+ case TAO_ARG:
+ if((*cp)==';')
+ {
+ no_of_params++;
+ }
+ break;
+
+ case TAO_ERROR:
+ return -1;
+ // break;
+
+ default:
+ ACE_ERROR_RETURN((LM_ERROR,
+ "CC_Client::check_extended_test_params\n"), -1);
+ }
+ cp++;
+ }
+ if (state==TAO_ERROR) // there was only one character given and it was wrong
+ return -1;
+ else
+ return no_of_params;
+}
+
+int
+CC_Client::run_extended_tests (char *params)
+{
+ int success = CC_FAIL;
+ int no_of_args = 0;
+
+ ACE_DEBUG ((LM_DEBUG,
+ "Params: %s\n",
+ params));
+
+ no_of_args = check_extended_test_params(params);
+ if(no_of_args==-1)
+ {
+ ACE_ERROR_RETURN((LM_ERROR,
+ "Error in parameter string (%s). Format: '<test#>;<arg1>;<arg2>'\n", params), CC_FAIL);
+ }
+
+ ACE_DEBUG((LM_DEBUG, "Number of arguments: %i\n", no_of_args));
+
+ char *cmd = ACE_OS::strtok (params, ";");
+ char *arg1 = ACE_OS::strtok (0, ";");
+ // char *arg2 = ACE_OS::strtok (0, ";");
+
+ // A possible scenario using test 1,2, and 3 Create and lock the
+ // lock set with the name 'Name'
+ // ./CC_client -e '1;Name'
+ // Try to lock the same lock set. The process will hang
+ // ./CC_client -e '2:Name'
+ // Unlocks the lock set. Now test 2 will continue.
+ // ./CC_client -e '3:Name'
+
+ if (ACE_OS::strcmp (cmd, "1") == 0)
+ {
+ Test_Setup_LockSet t1 (naming_service_, arg1);
+ success = t1.run ();
+ }
+
+ if (ACE_OS::strcmp (cmd, "2") == 0)
+ {
+ Test_Use_Already_Created_LockSet t2 (naming_service_, arg1);
+ success = t2.run ();
+ }
+
+ if (ACE_OS::strcmp (cmd, "3") == 0)
+ {
+ Test_Unlock_Already_Created_LockSet t3 (naming_service_, arg1);
+ success = t3.run ();
+ }
+
+ return success;
+}
+
+void
+CC_Client::print_usage (void)
+{
+ ACE_ERROR ((LM_ERROR,
+ "usage: %s"
+ " [-b]"
+ " [-c] cc-test-script"
+ " [-d]"
+ " [-f cc_factory-obj-ref-key-file]"
+ " [-k cc-obj-ref-key]"
+ " [-x]"
+ " [-s]"
+ "\n",
+ this->argv_ [0]));
+}
+
+int
+CC_Client::init_naming_service (void)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ ACE_NEW_RETURN (naming_service_,
+ CC_naming_service,
+ -1);
+
+ this->naming_service_->Init (this->orb_ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ return -1;
+ }
+ ACE_ENDTRY;
+ return 0;
+}
+
+int
+CC_Client::init (int argc, char **argv)
+{
+ int naming_result;
+ this->argc_ = argc;
+ this->argv_ = argv;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ // Retrieve the ORB.
+ this->orb_ = CORBA::ORB_init (this->argc_,
+ this->argv_,
+ "internet"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Parse command line and verify parameters.
+ if (this->parse_args () == -1)
+ return -1;
+
+ if (this->use_naming_service_)
+ {
+ naming_result = this->init_naming_service ();
+ if (naming_result < 0)
+ return naming_result;
+ }
+ else
+ {
+ if (this->cc_factory_key_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%s: no lock set factory key specified\n",
+ this->argv_[0]),
+ -1);
+
+
+ CORBA::Object_var factory_object =
+ this->orb_->string_to_object (this->cc_factory_key_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+#if 0
+ // The test cannot currently run without the naming service.
+ this->factory_ =
+ CosConcurrencyControl::LockSetFactory::_narrow
+ (factory_object.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (this->factory_.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "invalid factory key <%s>\n",
+ this->cc_factory_key_),
+ -1);
+#endif /* 0 */
+ }
+
+ ACE_DEBUG ((LM_DEBUG,
+ "Factory received OK\n"));
+
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "CC_Client::init");
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+// This function runs the test.
+
+int
+main (int argc, char **argv)
+{
+ CC_Client cc_client;
+
+ ACE_DEBUG ((LM_DEBUG,
+ "\n \t CosConcurrencyControl: client \n\n"));
+
+ if (cc_client.init (argc, argv) == -1)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Did not initialize correctly\n"));
+ return 1;
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Running the test\n"));
+ return cc_client.run ();
+ }
+}
diff --git a/TAO/orbsvcs/tests/Concurrency/CC_client.h b/TAO/orbsvcs/tests/Concurrency/CC_client.h
new file mode 100644
index 00000000000..a81df69daa0
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/CC_client.h
@@ -0,0 +1,142 @@
+// -*- c++ -*-
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/Concurrency
+//
+// = FILENAME
+// CC_client.h
+//
+// = DESCRIPTION
+// This class implements a client used to test the CosConcurrency
+// service.
+//
+// = AUTHORS
+// Torben Worm <tworm@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "ace/Get_Opt.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "orbsvcs/CosConcurrencyControlC.h"
+#include "orbsvcs/CosNamingC.h"
+#include "CC_tests.h"
+#include "CC_naming_service.h"
+#include "CC_command.h"
+#include "CC_command.tab.h"
+
+#ifndef _CC_CLIENT_H_
+#define _CC_CLIENT_H_
+
+// Stuff to be used by the command file parser
+int ace_cc_yyparse(void);
+int line_no = 1;
+char line_buf[500];
+CC_CommandList *cmdlist;
+extern FILE *ace_cc_yyin;
+// end of parser stuff
+
+
+class CC_Client
+{
+ // = TITLE
+ // Defines a class that encapsulates the behaviour of a clien of
+ // the concurrency service.
+ //
+ // = DESCRIPTION
+ // This class declares an interface to run the test client for
+ // the concurrency service.
+public:
+ // = Initialization and termination methods.
+ CC_Client (void);
+ // Default constructor.
+
+ ~CC_Client (void);
+ // Destructor.
+
+ int run (void);
+ // Run the test.
+
+ int init (int argc, char **argv);
+ // Initialize the test with the parameters from the command line.
+
+private:
+ int init_naming_service (void);
+ // Function to initialize the naming service.
+
+ int parse_args (void);
+ // Function to parse the command line arguments.
+
+ int read_ior (char *filename);
+ // Function to read the ior from the given file.
+
+ int run_basic_tests (void);
+ // Runs the basic tests (on a single lock set). Returns CC_SUCCESS
+ // upon success CC_FAIL otherwise.
+
+ int run_extended_tests (char *params);
+ // Runs the extended tests (on more lock sets). Returns CC_SUCCESS
+ // upon success CC_FAIL otherwise.
+
+ int check_extended_test_params(char *params);
+ // Checks the parameters given to the run_extended_tests() function.
+ // returns -1 if an error is found.
+
+ CC_naming_service *naming_service_;
+ // A pointer to the naming service used for this test.
+
+ FILE *cc_factory_ior_file_;
+ // File from which to obtain the IOR.
+
+ char *cc_factory_key_;
+ // The factory key for the lock set factory.
+
+ ACE_HANDLE f_handle_;
+ // File handle to read the IOR.
+
+ int shutdown_;
+ // Flag to tell server to shutdown.
+
+ CORBA::ORB_var orb_;
+ // Remember our orb.
+
+ // CosConcurrencyControl::LockSetFactory_var factory_;
+ // factory pointer for the lock set. @@TAO maybe to be used when naming
+ // service is not used (for simple testing)
+
+ int argc_;
+ // The number of arguments passed on the command line.
+
+ char **argv_;
+ // The arguments from the command line.
+
+ int use_naming_service_;
+ // Flag to tell the client whether to use the naming service or not
+ // to find the concurrency control factory.
+
+ int run_basic_tests_;
+ // flag to tell which test should be run.
+
+ int run_extended_tests_;
+ // flag to tell which test should be run.
+
+ char *extended_tests_params_;
+ // Parameters to the extended tests. The parameters are of the
+ // following format: <test>:<parm1>:<parm2>...
+
+ int use_script_file_;
+ // Flag to tell whethter to use a script file to run the tests.
+
+ char *script_file_;
+ // The script file to run
+
+ void print_usage (void);
+ // Prints out the options to the program.
+};
+#endif /* !defined (_CC_CLIENT_H_) */
diff --git a/TAO/orbsvcs/tests/Concurrency/CC_command.cpp b/TAO/orbsvcs/tests/Concurrency/CC_command.cpp
new file mode 100644
index 00000000000..fda16fbaa42
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/CC_command.cpp
@@ -0,0 +1,684 @@
+// $Id$
+// ============================================================================
+//
+// = LIBRARY
+// TAO/orbsvcs/tests
+//
+// = FILENAME
+// CC_command.cpp
+//
+// = DESCRIPTION
+// This is the command classes for the test of the concurrency service.
+//
+// = AUTHORS
+// Torben Worm <tworm@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "CC_command.h"
+#include "CC_test_utils.h"
+#include "CC_naming_service.h"
+#include "ace/ACE.h"
+#include "ace/Process.h"
+#include "ace/Log_Msg.h"
+#include "orbsvcs/CosConcurrencyControlC.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_unistd.h"
+#include "ace/OS_NS_string.h"
+
+
+ACE_RCSID (Concurrency,
+ CC_command,
+ "$Id$")
+
+
+CC_Command::~CC_Command(void)
+{
+}
+
+int CC_Command::execute()
+{
+ return 0;
+}
+
+CC_Command::CC_Command(void)
+{
+}
+
+CosConcurrencyControl::LockSet_var
+CC_Command::GetLockSet (const char *lock_set_name
+ ACE_ENV_ARG_DECL)
+{
+ CosConcurrencyControl::LockSet_var ccls_ret;
+
+ ACE_TRY
+ {
+ if(ACE_OS::strcmp(lock_set_name, "")!=0)
+ {
+ CORBA::Object_var ccls_obj =
+ CC_naming_service::Instance()->get_obj_from_name ("",
+ lock_set_name
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ccls_ret =
+ CosConcurrencyControl::LockSet::_narrow (ccls_obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ // No lock set name was given. Use the global lock set.
+ if(cc_lockset_.in()==0)
+ {
+ ACE_THROW_RETURN (CORBA::UNKNOWN (), 0);
+ }
+ else
+ ccls_ret = cc_lockset_.in ();
+ }
+ }
+ ACE_CATCHANY
+ {
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+
+ return ccls_ret;
+}
+
+CORBA::Exception *CC_Command::excep_ = 0;
+
+CosConcurrencyControl::LockSet_var CC_Command::cc_lockset_(0);
+
+CC_Start_Cmd::CC_Start_Cmd (const char *config_file_name)
+ : cfg_name_ (ACE_OS::strdup (config_file_name))
+{
+ // printf("CC_Start_Cmd::CC_Start_Cmd: config: %s\n", config_file_name);
+}
+
+CC_Start_Cmd::~CC_Start_Cmd()
+{
+ // cfg_name_ is allocated in the lexer with strdup
+ if (cfg_name_)
+ {
+ ACE_OS::free(cfg_name_);
+ cfg_name_ = 0;
+ }
+}
+
+int CC_Start_Cmd::execute(void)
+{
+ if (excep_)
+ {
+ printf ("Exception: %s\n", excep_->_rep_id ());
+ delete excep_;
+ excep_ = 0;
+ return 0; // CC_FAIL
+ }
+
+ printf ("Executing start command (script file: %s)\n", cfg_name_);
+
+ char cmd_line[1024];
+ int success = ACE_OS::sprintf(&cmd_line[0], "%s -c %s",
+ "./CC_client", cfg_name_);
+ if(success>=1024 || success==-1)
+ ACE_ERROR_RETURN((LM_ERROR, "Creation of process failed: %s\n",
+ cmd_line), 0);
+
+ ACE_Process new_process;
+ ACE_Process_Options options;
+ options.command_line(cmd_line);
+
+ if(new_process.spawn(options) == -1)
+ {
+ ACE_ERROR_RETURN((LM_ERROR, "Creation of process failed: %s\n",
+ cmd_line), 0);
+ }
+ return 1; // CC_SUCCESS
+}
+
+CC_CreateLockSet_Cmd::CC_CreateLockSet_Cmd (const char *lock_set_name)
+ : name_ (ACE_OS::strdup (lock_set_name))
+{
+ // printf("CC_CreateLockSet_Cmd::CC_CreateLockSet_Cmd: lock set: %s\n",
+ // lock_set_name);
+}
+
+CC_CreateLockSet_Cmd::~CC_CreateLockSet_Cmd()
+{
+ // name_ is allocated in the lexer with strdup
+ if(name_)
+ {
+ ACE_OS::free(name_);
+ name_ = 0;
+ }
+}
+
+int CC_CreateLockSet_Cmd::execute(void)
+{
+ if(excep_)
+ {
+ printf("Exception: %s\n", excep_->_rep_id ());
+ delete excep_;
+ excep_ = 0;
+ return 0; // CC_FAIL
+ }
+
+ printf("Executing create command (lock set: %s)\n", name_);
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ CosConcurrencyControl::LockSet_ptr lock_set =
+ CC_TestUtils::create_lock_set();
+ if(ACE_OS::strcmp(name_,"")!=0)// Do not bind an empty name
+ {
+ CC_naming_service::Instance()->bind_name(name_,
+ lock_set ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ // We did not specify a name => the global lock set variable is set
+ cc_lockset_ = lock_set;
+ }
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "CC_CreateLockSet_Cmd::execute(void)");
+ }
+ ACE_ENDTRY;
+
+ return 1; // CC_SUCCESS
+}
+
+CC_Lock_Cmd::CC_Lock_Cmd (const char *lock_set_name,
+ CosConcurrencyControl::lock_mode mode)
+ : name_ (ACE_OS::strdup (lock_set_name)),
+ mode_(mode)
+{
+ // printf("CC_Lock_Cmd::CC_Lock_Cmd: lock set: %s, mode: %s\n",
+ // lock_set_name, CC_TestUtils::get_lock_mode_name(mode));
+}
+
+CC_Lock_Cmd::~CC_Lock_Cmd()
+{
+ ACE_OS::free (this->name_);
+}
+
+int CC_Lock_Cmd::execute(void)
+{
+ if(excep_)
+ {
+ printf("Exception: %s\n", excep_->_rep_id ());
+ delete excep_;
+ excep_ = 0;
+ return 0; // CC_FAIL
+ }
+
+ printf("Executing lock command (lock set: %s, mode: %s)\n",
+ name_, CC_TestUtils::get_lock_mode_name(mode_));
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ CosConcurrencyControl::LockSet_var ccls =
+ GetLockSet(name_ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ ccls->lock (mode_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "CC_Lock_Cmd::execute(void)");
+ return 0;
+ }
+ ACE_ENDTRY;
+ return 1; // CC_SUCCESS
+}
+
+CC_UnLock_Cmd::CC_UnLock_Cmd (const char *lock_set_name,
+ CosConcurrencyControl::lock_mode mode)
+ : name_ (ACE_OS::strdup (lock_set_name)),
+ mode_ (mode)
+{
+ // printf("CC_UnLock_Cmd::CC_UnLock_Cmd: lock set: %s, mode: %s\n",
+ // lock_set_name, CC_TestUtils::get_lock_mode_name(mode));
+}
+
+CC_UnLock_Cmd::~CC_UnLock_Cmd()
+{
+ ACE_OS::free (this->name_);
+}
+
+int CC_UnLock_Cmd::execute(void)
+{
+ if(excep_)
+ {
+ printf("Exception: %s\n", excep_->_rep_id ());
+ delete excep_;
+ excep_ = 0;
+ return 0; // CC_FAIL
+ }
+
+ printf("Executing unlock command (lock set: %s, mode: %s)\n",
+ name_, CC_TestUtils::get_lock_mode_name(mode_));
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ CosConcurrencyControl::LockSet_var ccls = GetLockSet(name_ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ccls->unlock (mode_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "CC_UnLock_Cmd::execute(void)");
+ return 0;
+ }
+ ACE_ENDTRY;
+ return 1; // CC_SUCCESS
+}
+
+CC_TryLock_Cmd::CC_TryLock_Cmd (const char *lock_set_name,
+ CosConcurrencyControl::lock_mode mode)
+ : name_ (ACE_OS::strdup (lock_set_name)),
+ mode_ (mode)
+{
+ // printf("CC_TryLock_Cmd::CC_TryLock_Cmd: lock set: %s, mode %s\n",
+ // lock_set_name, CC_TestUtils::get_lock_mode_name(mode));
+}
+
+CC_TryLock_Cmd::~CC_TryLock_Cmd()
+{
+ ACE_OS::free (this->name_);
+}
+
+int CC_TryLock_Cmd::execute(void)
+{
+ if(excep_)
+ {
+ printf("Exception: %s\n", excep_->_rep_id ());
+ delete excep_;
+ excep_ = 0;
+ return 0; // CC_FAIL
+ }
+
+ printf("Executing try_lock command (lock set: %s, mode: %s)\n",
+ name_, CC_TestUtils::get_lock_mode_name(mode_));
+
+ CORBA::Boolean lock_not_held;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ CosConcurrencyControl::LockSet_var ccls = GetLockSet(name_ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ lock_not_held = ccls->try_lock (mode_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (lock_not_held)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "%s lock not held\n",
+ CC_TestUtils::get_lock_mode_name (mode_)));
+ }
+ else
+ ACE_DEBUG ((LM_DEBUG,
+ "%s lock held\n",
+ CC_TestUtils::get_lock_mode_name (mode_)));
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "CC_TryLock_Cmd::execute(void)");
+ return 0;
+ }
+ ACE_ENDTRY;
+
+ return 1; // CC_SUCCESS
+}
+
+CC_ChangeMode_Cmd::
+ CC_ChangeMode_Cmd (const char *lock_set_name,
+ CosConcurrencyControl::lock_mode held_mode,
+ CosConcurrencyControl::lock_mode new_mode)
+ : name_(ACE_OS::strdup (lock_set_name)),
+ held_mode_ (held_mode),
+ new_mode_ (new_mode)
+{
+ // printf("CC_ChangeMode_Cmd::CC_ChangeMode_Cmd: lock set: %s, held mode: %s, new mode: %s\n",
+ // lock_set_name,
+ // CC_TestUtils::get_lock_mode_name(held_mode),
+ // CC_TestUtils::get_lock_mode_name(new_mode));
+}
+
+CC_ChangeMode_Cmd::~CC_ChangeMode_Cmd()
+{
+ ACE_OS::strdup (this->name_);
+}
+
+int CC_ChangeMode_Cmd::execute(void)
+{
+ if(excep_)
+ {
+ printf("Exception: %s\n", excep_->_rep_id ());
+ delete excep_;
+ excep_ = 0;
+ return 0; // CC_FAIL
+ }
+
+ printf("Executing change_mode command (lock set: %s, held_mode: %s, new_mode: %s)\n",
+ name_, CC_TestUtils::get_lock_mode_name(held_mode_),
+ CC_TestUtils::get_lock_mode_name(new_mode_));
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ CosConcurrencyControl::LockSet_var ccls = GetLockSet(name_ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ccls->change_mode (held_mode_, new_mode_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "CC_ChangeMode_Cmd::execute(void)");
+ }
+ ACE_ENDTRY;
+ return 1; // CC_SUCCESS
+}
+
+CC_Sleep_Cmd::CC_Sleep_Cmd(int seconds)
+ : time_ (seconds)
+{
+}
+
+CC_Sleep_Cmd::~CC_Sleep_Cmd()
+{
+}
+
+int CC_Sleep_Cmd::execute(void)
+{
+ if(excep_)
+ {
+ printf("Exception: %s\n", excep_->_rep_id ());
+ delete excep_;
+ excep_ = 0;
+ return 0; // CC_FAIL
+ }
+
+ printf("Executing sleep command (time: %i)\n", time_);
+
+ ACE_OS::sleep(time_);
+ return 1; // CC_SUCCESS
+}
+
+CC_Repeat_Cmd::CC_Repeat_Cmd(int times)
+ : times_ (times)
+{
+}
+
+CC_Repeat_Cmd::~CC_Repeat_Cmd()
+{
+}
+
+int CC_Repeat_Cmd::execute(void)
+{
+ if(excep_)
+ {
+ printf("Exception: %s\n", excep_->_rep_id ());
+ delete excep_;
+ excep_ = 0;
+ return 0; // CC_FAIL
+ }
+
+ printf("Executing repeat command (times: %i)\n", times_);
+
+ return 1; // CC_SUCCESS
+}
+
+CC_Wait_Cmd::CC_Wait_Cmd (const char *prompt)
+ : prompt_ (ACE_OS::strdup (prompt))
+{
+}
+
+CC_Wait_Cmd::~CC_Wait_Cmd()
+{
+ ACE_OS::free (this->prompt_);
+}
+
+int CC_Wait_Cmd::execute(void)
+{
+ if (excep_)
+ {
+ printf ("Exception: %s\n", excep_->_rep_id ());
+ delete excep_;
+ excep_ = 0;
+ return 0; // CC_FAIL
+ }
+
+ printf ("Executing wait command\n");
+
+ printf ("%s", prompt_);
+ (void) ACE_OS::fgetc (stdin);
+
+ return 1; // CC_SUCCESS
+}
+
+CC_Excep_Cmd::CC_Excep_Cmd (const char *excep)
+ : ex_ (ACE_OS::strdup (excep))
+{
+ // printf("CC_Excep_Cmd::CC_Excep_Cmd: excep: %s\n", excep);
+}
+
+CC_Excep_Cmd::~CC_Excep_Cmd(void)
+{
+ ACE_OS::free (this->ex_);
+}
+
+int
+CC_Excep_Cmd::execute(void)
+{
+ printf ("Executing excep command (expected: %s)\n", ex_);
+ // First we check to see if an exception has occured. If not we fail
+ // because we expected to see one
+ if(excep_==0)
+ return 0; // CC_FAIL
+
+ // If there is an exception check that it's the expected one
+ if(ACE_OS::strcmp(excep_->_rep_id (), ex_)==0)
+ {
+ delete excep_;
+ excep_ = 0;
+ return 1; // CC_SUCCESS
+ }
+ else
+ {
+ printf ("Exception: %s\n", excep_->_rep_id ());
+ delete excep_;
+ excep_ = 0;
+ return 0; // CC_FAIL
+ }
+}
+
+CC_Dummy_Cmd::CC_Dummy_Cmd(void)
+{
+}
+
+CC_Dummy_Cmd::~CC_Dummy_Cmd(void)
+{
+}
+
+int
+CC_Dummy_Cmd::execute(void)
+{
+ return 1; // CC_SUCCESS
+}
+
+CC_Print_Cmd::CC_Print_Cmd (const char * message)
+ : msg_ (ACE_OS::strdup (message))
+{
+}
+
+CC_Print_Cmd::~CC_Print_Cmd(void)
+{
+ ACE_OS::free(msg_);
+}
+
+int
+CC_Print_Cmd::execute(void)
+{
+ printf ("%s\n", msg_);
+ return 1; // CC_SUCCESS
+}
+
+CC_Lookup_Cmd::CC_Lookup_Cmd (const char *lock_set_name)
+ : name_ (ACE_OS::strdup (lock_set_name))
+{
+}
+
+CC_Lookup_Cmd::~CC_Lookup_Cmd()
+{
+ if(name_)
+ {
+ ACE_OS::free(name_);
+ name_ = 0;
+ }
+}
+
+int
+CC_Lookup_Cmd::execute(void)
+{
+ if(excep_)
+ {
+ printf ("Exception: %s\n", excep_->_rep_id ());
+ delete excep_;
+ excep_ = 0;
+ return 0; // CC_FAIL
+ }
+
+ printf ("Executing lookup command (lock set: %s)\n", name_);
+
+ // Do the lookup if we haven't done it before
+ if(cc_lockset_.in() == 0)
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ CORBA::Object_var ccls_obj =
+ CC_naming_service::Instance()->get_obj_from_name ("",
+ name_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CosConcurrencyControl::LockSet_var ccls =
+ CosConcurrencyControl::LockSet::_narrow (ccls_obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ cc_lockset_ = ccls;
+ ACE_TRY_CHECK;
+
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "CC_UnLock_Cmd::execute(void)");
+ }
+ ACE_ENDTRY;
+ }
+ return 1; // CC_SUCCESS
+}
+
+CC_CommandElem::CC_CommandElem(CC_Command *cmd, CC_CommandElem *next)
+ : next_ (next), cmd_ (cmd)
+{
+}
+
+CC_CommandElem::~CC_CommandElem(void)
+{
+}
+
+CC_Command *CC_CommandElem::GetCommand(void)
+{
+ return cmd_;
+}
+
+CC_CommandElem *
+CC_CommandElem::GetNext(void)
+{
+ return next_;
+}
+
+void
+CC_CommandElem::SetNext(CC_CommandElem *next)
+{
+ next_ = next;
+}
+
+CC_CommandList::CC_CommandList(void)
+ : head_ (0), last_ (0), times_ (1)
+{
+ printf("CC_CommandList::CC_CommandList\n");
+}
+
+CC_CommandList::~CC_CommandList(void)
+{
+}
+
+int
+CC_CommandList::add(CC_Command *cmd)
+{
+ if(head_==0)
+ {
+ head_ = new CC_CommandElem(cmd, 0);
+ last_ = head_;
+ }
+ else
+ {
+ CC_CommandElem *tmp = new CC_CommandElem(cmd, 0);
+ last_->SetNext(tmp);
+ last_ = tmp;
+ }
+ return 0;
+}
+
+int
+CC_CommandList::execute(void)
+{
+ CC_CommandElem *current = head_;
+
+ for(int i=0; i<times_; i++)
+ {
+ current = head_;
+ while(current!=0)
+ {
+ if(current->GetCommand()->execute()==0) // == CC_FAIL
+ {
+ return 0; // CC_FAIL
+ }
+ current = current->GetNext();
+ }
+ }
+ return 1; // CC_SUCCESS
+}
+
+void
+CC_CommandList::setrepeat(int times)
+{
+ times_ = times;
+}
diff --git a/TAO/orbsvcs/tests/Concurrency/CC_command.h b/TAO/orbsvcs/tests/Concurrency/CC_command.h
new file mode 100644
index 00000000000..735d38d7c21
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/CC_command.h
@@ -0,0 +1,475 @@
+// -*- c++ -*-
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/Concurrency
+//
+// = FILENAME
+// CC_command.h
+//
+// = DESCRIPTION
+// This file implements the command possible to execute on the
+// concurrency service's lock set interface. The file also contains
+// an implementation of a command list used by the command parser to
+// store the commands to be executed.
+//
+// = AUTHORS
+// Torben Worm <tworm@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "orbsvcs/CosConcurrencyControlC.h"
+
+#ifndef _CC_COMMAND_H_
+#define _CC_COMMAND_H_
+
+class CC_Command
+ // = TITLE
+ // Defines an abstact class for the commands towards the lock set
+ //
+ // = DESCRIPTION
+ // This class declares an interface to run a test towards one or more
+ // lock sets in the concurrency service. The class provides a virtual
+ // execute method that is common for all its subclasses. It is also the
+ // the base class for the auxillary commands start, wait, and sleep.
+{
+ public:
+ virtual ~CC_Command(void);
+ // Destructor
+
+ virtual int execute() = 0;
+ // Abstract execute method
+
+ protected:
+ CosConcurrencyControl::LockSet_var
+ GetLockSet (const char *lock_set_name
+ ACE_ENV_ARG_DECL);
+ // Function to look up the lock set we are operating on, or if the
+ // name is "" return the global lock set variable
+
+ CC_Command(void);
+ // Default constructor. We do not want instances of this class
+
+ static CORBA::Exception *excep_;
+ // The last exception raised in one of the test commands. This variable
+ // is checked by all commands in order to determine if an exception has
+ // been raised. This is necessary because sometimes we want to check that
+ // an event caused an exception (done by the CC_Excep_Cmd command class)
+ // as part of the testing.
+
+ static CosConcurrencyControl::LockSet_var cc_lockset_;
+ // This is the default lock set. The variable is either set by a create
+ // command without name or by the lookup command.
+
+ private:
+};
+
+class CC_Start_Cmd : public CC_Command
+ // = TITLE
+ // Defines a class for the start command
+ //
+ // = DESCRIPTION
+ // This class represents the start command. The start command is used
+ // to start a new process with another script file in order to test the
+ // aspects of the concurrency service that requires several processes
+ // running at the same time.
+{
+ public:
+ CC_Start_Cmd (const char *config_file_name);
+ // Constructor
+
+ virtual ~CC_Start_Cmd();
+ // Destructor
+
+ virtual int execute(void);
+ // Start the child process. The current version does not wait for the
+ // process to terminate.
+
+private:
+ char *cfg_name_;
+ // The name of the script file
+};
+
+class CC_CreateLockSet_Cmd : public CC_Command
+ // = TITLE
+ // Defines a class for the create command on the lock set factory
+ //
+ // = DESCRIPTION
+ // This class represents the create command on the lock set factory.
+ // The lock set is registered in the naming service with the provided
+ // name.
+{
+ public:
+ CC_CreateLockSet_Cmd (const char *lock_set_name);
+ // Constructor
+
+ virtual ~CC_CreateLockSet_Cmd ();
+ // Destructor
+
+ virtual int execute(void);
+ // Executes the command, i.e. creates the lock set and binds the name
+ // in the naming service.
+
+private:
+ char *name_;
+ // The name used to bind in the naming service.
+};
+
+class CC_Lock_Cmd:public CC_Command
+ // = TITLE
+ // Defines a class for the lock command on the lock set
+ //
+ // = DESCRIPTION
+ // This class represents the lock command on the lock set. The lock set
+ // is looked up in the naming service.
+{
+ public:
+ CC_Lock_Cmd(const char *lock_set_name,
+ CosConcurrencyControl::lock_mode mode);
+ // Constructor.
+
+ virtual ~CC_Lock_Cmd();
+ // Destructor
+
+ virtual int execute(void);
+ // Executes the command, i.e. looks up the lock set with the requested
+ // name in the naming server and executes the lock command on that lock set.
+
+private:
+ char *name_;
+ // The name to look up in the naming service.
+
+ CosConcurrencyControl::lock_mode mode_;
+ // The mode of the lock.
+};
+
+class CC_UnLock_Cmd:public CC_Command
+ // = TITLE
+ // Defines a class for the unlock command on the lock set
+ //
+ // = DESCRIPTION
+ // This class represents the unlock command on the lock set. The lock set
+ // is looked up in the naming service.
+{
+ public:
+ CC_UnLock_Cmd(const char *lock_set_name,
+ CosConcurrencyControl::lock_mode mode);
+ // Constructor.
+
+ virtual ~CC_UnLock_Cmd();
+ // Destructor
+
+ virtual int execute(void);
+ // Executes the command, i.e. looks up the lock set with the requested
+ // name in the naming server and executes the unlock command on that
+ // lock set.
+
+private:
+ char *name_;
+ // The name to look up in the naming service.
+
+ CosConcurrencyControl::lock_mode mode_;
+ // The mode of the lock.
+};
+
+class CC_TryLock_Cmd:public CC_Command
+ // = TITLE
+ // Defines a class for the try_lock command on the lock set
+ //
+ // = DESCRIPTION
+ // This class represents the try_lock command on the lock set. The lock set
+ // is looked up in the naming service.
+{
+ public:
+ CC_TryLock_Cmd(const char *lock_set_name,
+ CosConcurrencyControl::lock_mode mode);
+ // Constructor
+
+ virtual ~CC_TryLock_Cmd();
+ // Destructor
+
+ virtual int execute(void);
+ // Executes the command, i.e. looks up the lock set with the requested
+ // name in the naming server and executes the try_lock command on that
+ // lock set.
+
+private:
+ char *name_;
+ // The name to look up in the naming service.
+
+ CosConcurrencyControl::lock_mode mode_;
+ // The mode of the lock.
+};
+
+class CC_ChangeMode_Cmd:public CC_Command
+ // = TITLE
+ // Defines a class for the change_mode command on the lock set
+ //
+ // = DESCRIPTION
+ // This class represents the change_mode command on the lock set.
+ // The lock set is looked up in the naming service.
+{
+ public:
+ CC_ChangeMode_Cmd (const char *lock_set_name,
+ CosConcurrencyControl::lock_mode held_mode,
+ CosConcurrencyControl::lock_mode new_mode);
+ // Constructor
+
+ virtual ~CC_ChangeMode_Cmd();
+ // Destructor
+
+ virtual int execute(void);
+ // Executes the command, i.e. looks up the lock set with the requested
+ // name in the naming server and executes the change_mode command on that
+ // lock set.
+
+private:
+ char *name_;
+ // The name to look up in the naming service.
+
+ CosConcurrencyControl::lock_mode held_mode_;
+ // The mode of the held lock
+
+ CosConcurrencyControl::lock_mode new_mode_;
+ // The new mode of the lock
+};
+
+class CC_Sleep_Cmd:public CC_Command
+ // = TITLE
+ // Defines a class for the sleep command
+ //
+ // = DESCRIPTION
+ // This class represents the sleep command. This command is used to make
+ // the script pause for the requested number of second, e.g. to wait for
+ // another process to start.
+{
+ public:
+ CC_Sleep_Cmd(int seconds);
+ // Constructor.
+
+ virtual ~CC_Sleep_Cmd();
+ // Destructor.
+
+ virtual int execute(void);
+ // Executes the command.
+
+ private:
+ int time_;
+ // The number of seconds to sleep
+};
+
+class CC_Repeat_Cmd:public CC_Command
+ // = TITLE
+ // Defines a class for the repeat command
+ //
+ // = DESCRIPTION
+ // This class represents the repeat command. This command is used to make
+ // the script repeat the test the requested number of times.
+ // The command is curently NOT implemented.
+{
+ public:
+ CC_Repeat_Cmd(int times);
+ // Constructor.
+
+ virtual ~CC_Repeat_Cmd();
+ // Destructor.
+
+ virtual int execute(void);
+ // Executes the command.
+ private:
+ int times_;
+ // The number of times the commands should be repeated
+};
+
+class CC_Wait_Cmd:public CC_Command
+ // = TITLE
+ // Defines a class for the wait command
+ //
+ // = DESCRIPTION
+ // This class represents the wait command. This command is used to make
+ // the script wait for the user to press return. It is possible to print
+ // different prompts, e.g. instructions.
+{
+ public:
+ CC_Wait_Cmd (const char *prompt);
+ // Constructor.
+
+ virtual ~CC_Wait_Cmd();
+ // Destructor.
+
+ virtual int execute(void);
+ // Executes the command.
+
+private:
+ char *prompt_;
+ // The prompt to print on the screen
+};
+
+class CC_Excep_Cmd : public CC_Command
+ // = TITLE
+ // Defines a class for the excep command
+ //
+ // = DESCRIPTION
+ // This class represents the excep command. This command is used to make
+ // the script capable of dealing with cases where an exception is raised
+ // as part of the testing.
+{
+ public:
+ CC_Excep_Cmd (const char *excep);
+ // Constructor.
+
+ virtual ~CC_Excep_Cmd(void);
+ // Destructor.
+
+ virtual int execute(void);
+ // Executes the command. Checks to see if the excep_ class variable is set,
+ // and if that's the case check that it is of the expected type. If not the
+ // test fails.
+
+private:
+ char *ex_;
+ // The string representation of the expected exception
+};
+
+class CC_Dummy_Cmd: public CC_Command
+ // = TITLE
+ // Defines a class for the dummy command
+ //
+ // = DESCRIPTION
+ // This class represents the dummy command. This command is used to
+ // put in a command in the chain that does nothing.
+{
+ public:
+ CC_Dummy_Cmd(void);
+ // Constructor.
+
+ virtual ~CC_Dummy_Cmd(void);
+ // Destructor.
+
+ virtual int execute(void);
+ // Executes the command, i.e. does nothing.
+
+ private:
+};
+
+class CC_Print_Cmd: public CC_Command
+ // = TITLE
+ // Defines a class for the print command
+ //
+ // = DESCRIPTION
+ // This class represents the print command. This command is used to
+ // print a message on stdout
+{
+public:
+ CC_Print_Cmd (const char *message);
+ // Constructor.
+
+ virtual ~CC_Print_Cmd(void);
+ // Destructor.
+
+ virtual int execute(void);
+ // Executes the command.
+
+private:
+ char *msg_;
+ // Holds the message to print
+};
+
+class CC_Lookup_Cmd:public CC_Command
+ // = TITLE
+ // Defines a class for the lookup command.
+ //
+ // = DESCRIPTION
+ // This class represents the lookup command. The lock set
+ // is looked up in the naming service and the class variable
+ // cc_lockset_ is set accordingly.
+{
+public:
+ CC_Lookup_Cmd (const char *lock_set_name);
+ // Constructor
+
+ virtual ~CC_Lookup_Cmd();
+ // Destructor
+
+ virtual int execute(void);
+ // Executes the command, i.e. looks up the lock set with the requested
+ // name in the naming server and sets the cc_lockset_ variable.
+
+private:
+ char *name_;
+ // The name to look up in the naming service.
+
+};
+
+class CC_CommandElem
+ // = TITLE
+ // Defines a class for a command element
+ //
+ // = DESCRIPTION
+ // This class implements a command element used in the command list
+ // below. The class is a simple tupple holding a pointer to the command
+ // and a pointer to the next element in the list.
+{
+ public:
+ CC_CommandElem (CC_Command *cmd, CC_CommandElem *next);
+ // Constructor.
+
+ ~CC_CommandElem(void);
+ // Destructor.
+
+ CC_Command *GetCommand(void);
+ // Returns a pointer to the command in this element
+
+ CC_CommandElem *GetNext(void);
+ // Returns the pointer to the next element
+
+ void SetNext(CC_CommandElem *next);
+ // Sets the next pointer
+
+ private:
+ CC_CommandElem *next_;
+ // Pointer to the next element
+
+ CC_Command *cmd_;
+ // Pointer to the command element
+};
+
+class CC_CommandList
+ // = TITLE
+ // Defines a class for a command list
+ //
+ // = DESCRIPTION
+ // This class implements a command list used from the script parser
+ // to store the parsed commands The class implements a simple single
+ // linked list.
+{
+ public:
+ CC_CommandList(void);
+ // Constructor.
+
+ ~CC_CommandList(void);
+ // Destructor.
+
+ int add(CC_Command *cmd);
+ // Adds the command to the list
+
+ int execute(void);
+ // Executes all the commands in the list from head to tail
+
+ void setrepeat(int times);
+ // Sets the number of times to repeat the script
+
+ private:
+ CC_CommandElem *head_;
+ // The head of the command list
+
+ CC_CommandElem *last_;
+ // The last inserted element
+
+ int times_;
+ // The number of times the script should be repeated
+};
+
+#endif /* _CC_COMMAND_H_ */
diff --git a/TAO/orbsvcs/tests/Concurrency/CC_command.l b/TAO/orbsvcs/tests/Concurrency/CC_command.l
new file mode 100644
index 00000000000..57ff98ea222
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/CC_command.l
@@ -0,0 +1,58 @@
+/* $id$
+ * ============================================================================
+ *
+ * = LIBRARY
+ * TAO/orbsvcs/tests
+ *
+ * = FILENAME
+ * CC_command.l
+ *
+ * = DESCRIPTION
+ * This is the lex file for the concurrency service script language.
+ *
+ * = AUTHORS
+ * Torben Worm <tworm@cs.wustl.edu>
+ *
+ * ============================================================================
+ */
+%option noyywrap nounput noinput always-interactive
+%{
+#include "CC_command.h"
+#include "CC_command.tab.h"
+#include "ace/ACE.h"
+
+extern int line_no;
+extern char line_buf[500];
+%}
+
+%%
+
+; return T_TERM;
+start return T_START_CMD;
+create return T_CREATE_CMD;
+lock return T_LOCK_CMD;
+unlock return T_UNLOCK_CMD;
+try_lock return T_TRYLOCK_CMD;
+change_mode return T_CHANGEMODE_CMD;
+sleep return T_SLEEP_CMD;
+wait return T_WAIT_CMD;
+print return T_PRINT_CMD;
+repeat return T_REPEAT_CMD;
+exception return T_EXCEP_CMD;
+lookup return T_LOOKUP_CMD;
+read return T_READ;
+intention_read return T_IREAD;
+upgrade return T_UPGRADE;
+write return T_WRITE;
+intention_write return T_IWRITE;
+\".*\" { yylval.id = ACE_OS::strdup(&yytext[1]);
+ yylval.id[yyleng-2]='\0';
+ return Q_STRING; }
+[0-9]+ { yylval.num = atoi(yytext); return T_NUM; }
+[A-Za-z][A-Za-z_0-9\.:/]* { yylval.id = ACE_OS::strdup(yytext);
+ return T_IDENT; }
+^\/\/.*\n { }
+[ ]+ { }
+\n.* { line_no ++;
+ ACE_OS::strcpy(line_buf, yytext+1);
+ yyless(1); }
diff --git a/TAO/orbsvcs/tests/Concurrency/CC_command.tab.cpp b/TAO/orbsvcs/tests/Concurrency/CC_command.tab.cpp
new file mode 100644
index 00000000000..8a67df0eb67
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/CC_command.tab.cpp
@@ -0,0 +1,1071 @@
+// $Id$
+
+/* A Bison parser, made from CC_command.y
+ by GNU Bison version 1.28 */
+
+#define ACE_CC_YYBISON 1 /* Identify Bison output. */
+
+#define T_START_CMD 257
+#define T_CREATE_CMD 258
+#define T_LOCK_CMD 259
+#define T_UNLOCK_CMD 260
+#define T_TRYLOCK_CMD 261
+#define T_CHANGEMODE_CMD 262
+#define T_SLEEP_CMD 263
+#define T_WAIT_CMD 264
+#define T_REPEAT_CMD 265
+#define T_EXCEP_CMD 266
+#define T_PRINT_CMD 267
+#define T_LOOKUP_CMD 268
+#define T_TERM 269
+#define T_READ 270
+#define T_IREAD 271
+#define T_UPGRADE 272
+#define T_WRITE 273
+#define T_IWRITE 274
+#define T_IDENT 275
+#define Q_STRING 276
+#define T_NUM 277
+
+
+#include "CC_command.h"
+#include "ace/ACE.h"
+#include "orbsvcs/CosConcurrencyControlC.h"
+#include "ace/OS_NS_stdio.h"
+
+void ace_cc_yyerror (const char* s);
+int ace_cc_yylex(void);
+
+extern int line_no;
+extern char line_buf[500];
+extern char *ace_cc_yytext;
+extern CC_CommandList *cmdlist;
+
+typedef union {
+ CC_Command *command;
+ CosConcurrencyControl::lock_mode lock_mode;
+ char *id;
+ int num;
+} ACE_CC_YYSTYPE;
+#include <stdio.h>
+
+#ifndef __cplusplus
+#ifndef __STDC__
+#define const
+#endif
+#endif
+
+
+
+#define ACE_CC_YYFINAL 66
+#define ACE_CC_YYFLAG -32768
+#define ACE_CC_YYNTBASE 24
+
+#define ACE_CC_YYTRANSLATE(x) ((unsigned)(x) <= 277 ? ace_cc_yytranslate[x] : 31)
+
+static const char ace_cc_yytranslate[] = { 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23
+};
+
+#if ACE_CC_YYDEBUG != 0
+static const short ace_cc_yyprhs[] = { 0,
+ 0, 1, 3, 6, 8, 12, 16, 19, 24, 28,
+ 33, 37, 42, 46, 52, 57, 61, 64, 68, 72,
+ 76, 80, 84, 86, 88, 90, 92, 94, 96, 98
+};
+
+static const short ace_cc_yyrhs[] = { -1,
+ 25, 0, 25, 26, 0, 26, 0, 3, 27, 15,
+ 0, 4, 28, 15, 0, 4, 15, 0, 5, 28,
+ 30, 15, 0, 5, 30, 15, 0, 6, 28, 30,
+ 15, 0, 6, 30, 15, 0, 7, 28, 30, 15,
+ 0, 7, 30, 15, 0, 8, 28, 30, 30, 15,
+ 0, 8, 30, 30, 15, 0, 9, 23, 15, 0,
+ 10, 15, 0, 10, 22, 15, 0, 13, 22, 15,
+ 0, 14, 28, 15, 0, 11, 23, 15, 0, 12,
+ 29, 15, 0, 21, 0, 21, 0, 21, 0, 16,
+ 0, 17, 0, 18, 0, 19, 0, 20, 0
+};
+
+#endif
+
+#if ACE_CC_YYDEBUG != 0
+static const short ace_cc_yyrline[] = { 0,
+ 51, 52, 60, 61, 64, 66, 68, 70, 72, 74,
+ 76, 78, 80, 82, 84, 86, 88, 90, 92, 94,
+ 96, 99, 103, 105, 107, 109, 110, 111, 112, 113
+};
+#endif
+
+
+#if ACE_CC_YYDEBUG != 0 || defined (ACE_CC_YYERROR_VERBOSE)
+
+static const char * const ace_cc_yytname[] = { "$","error","$undefined.","T_START_CMD",
+"T_CREATE_CMD","T_LOCK_CMD","T_UNLOCK_CMD","T_TRYLOCK_CMD","T_CHANGEMODE_CMD",
+"T_SLEEP_CMD","T_WAIT_CMD","T_REPEAT_CMD","T_EXCEP_CMD","T_PRINT_CMD","T_LOOKUP_CMD",
+"T_TERM","T_READ","T_IREAD","T_UPGRADE","T_WRITE","T_IWRITE","T_IDENT","Q_STRING",
+"T_NUM","start","cmd_list","cmd","config_file_name","lock_set_name","exception_name",
+"lock_mode", NULL
+};
+#endif
+
+static const short ace_cc_yyr1[] = { 0,
+ 24, 24, 25, 25, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 27, 28, 29, 30, 30, 30, 30, 30
+};
+
+static const short ace_cc_yyr2[] = { 0,
+ 0, 1, 2, 1, 3, 3, 2, 4, 3, 4,
+ 3, 4, 3, 5, 4, 3, 2, 3, 3, 3,
+ 3, 3, 1, 1, 1, 1, 1, 1, 1, 1
+};
+
+static const short ace_cc_yydefact[] = { 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 4, 23, 0, 7, 24, 0, 26,
+ 27, 28, 29, 30, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 17, 0, 0, 25, 0, 0, 0,
+ 3, 5, 6, 0, 9, 0, 11, 0, 13, 0,
+ 0, 16, 18, 21, 22, 19, 20, 8, 10, 12,
+ 0, 15, 14, 0, 0, 0
+};
+
+static const short ace_cc_yydefgoto[] = { 64,
+ 13, 14, 16, 19, 38, 26
+};
+
+static const short ace_cc_yypact[] = { 0,
+ -1, 14, 20, 20, 20, 20, 7, 4, 8, 1,
+ 10, 13, 0,-32768,-32768, 18,-32768,-32768, 27,-32768,
+-32768,-32768,-32768,-32768, 31, 28, 31, 29, 31, 30,
+ 31, 31, 37,-32768, 38, 39,-32768, 40, 41, 42,
+-32768,-32768,-32768, 43,-32768, 44,-32768, 45,-32768, 31,
+ 46,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+ 47,-32768,-32768, 63, 64,-32768
+};
+
+static const short ace_cc_yypgoto[] = {-32768,
+-32768, 52,-32768, 12,-32768, -4
+};
+
+
+#define ACE_CC_YYLAST 65
+
+
+static const short ace_cc_yytable[] = { 28,
+ 30, 32, 1, 2, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, 25, 27, 29, 31, 34, 15,
+ 44, 37, 46, 40, 48, 35, 50, 51, 17, 33,
+ 36, 39, 42, 18, 18, 20, 21, 22, 23, 24,
+ 18, 43, 45, 47, 49, 61, 20, 21, 22, 23,
+ 24, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+ 62, 63, 65, 66, 41
+};
+
+static const short ace_cc_yycheck[] = { 4,
+ 5, 6, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 3, 4, 5, 6, 15, 21,
+ 25, 21, 27, 12, 29, 22, 31, 32, 15, 23,
+ 23, 22, 15, 21, 21, 16, 17, 18, 19, 20,
+ 21, 15, 15, 15, 15, 50, 16, 17, 18, 19,
+ 20, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 0, 0, 13
+};
+/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
+
+/* This file comes from bison-1.28. */
+
+/* Skeleton output parser for bison,
+ Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/* As a special exception, when this file is copied by Bison into a
+ Bison output file, you may use that output file without restriction.
+ This special exception was added by the Free Software Foundation
+ in version 1.24 of Bison. */
+
+/* This is the parser code that is written into each bison parser
+ when the %semantic_parser declaration is not specified in the grammar.
+ It was written by Richard Stallman by simplifying the hairy parser
+ used when %semantic_parser is specified. */
+
+#ifndef ACE_CC_YYSTACK_USE_ALLOCA
+#ifdef alloca
+#define ACE_CC_YYSTACK_USE_ALLOCA
+#else /* alloca not defined */
+#ifdef __GNUC__
+#define ACE_CC_YYSTACK_USE_ALLOCA
+#define alloca __builtin_alloca
+#else /* not GNU C. */
+#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
+#define ACE_CC_YYSTACK_USE_ALLOCA
+#include <alloca.h>
+#else /* not sparc */
+/* We think this test detects Watcom and Microsoft C. */
+/* This used to test MSDOS, but that is a bad idea
+ since that symbol is in the user namespace. */
+#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
+#if 0 /* No need for malloc.h, which pollutes the namespace;
+ instead, just don't use alloca. */
+#include <malloc.h>
+#endif
+#else /* not MSDOS, or __TURBOC__ */
+#if defined(_AIX)
+/* I don't know what this was needed for, but it pollutes the namespace.
+ So I turned it off. rms, 2 May 1997. */
+/* #include <malloc.h> */
+ #pragma alloca
+#define ACE_CC_YYSTACK_USE_ALLOCA
+#else /* not MSDOS, or __TURBOC__, or _AIX */
+#if 0
+#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
+ and on HPUX 10. Eventually we can turn this on. */
+#define ACE_CC_YYSTACK_USE_ALLOCA
+#define alloca __builtin_alloca
+#endif /* __hpux */
+#endif
+#endif /* not _AIX */
+#endif /* not MSDOS, or __TURBOC__ */
+#endif /* not sparc */
+#endif /* not GNU C */
+#endif /* alloca not defined */
+#endif /* ACE_CC_YYSTACK_USE_ALLOCA not defined */
+
+#ifdef ACE_CC_YYSTACK_USE_ALLOCA
+#define ACE_CC_YYSTACK_ALLOC alloca
+#else
+#define ACE_CC_YYSTACK_ALLOC malloc
+#endif
+
+/* Note: there must be only one dollar sign in this file.
+ It is replaced by the list of actions, each action
+ as one case of the switch. */
+
+#define ace_cc_yyerrok (ace_cc_yyerrstatus = 0)
+#define ace_cc_yyclearin (ace_cc_yychar = ACE_CC_YYEMPTY)
+#define ACE_CC_YYEMPTY -2
+#define ACE_CC_YYEOF 0
+#define ACE_CC_YYACCEPT goto ace_cc_yyacceptlab
+#define ACE_CC_YYABORT goto ace_cc_yyabortlab
+#define ACE_CC_YYERROR goto ace_cc_yyerrlab1
+/* Like ACE_CC_YYERROR except do call ace_cc_yyerror.
+ This remains here temporarily to ease the
+ transition to the new meaning of ACE_CC_YYERROR, for GCC.
+ Once GCC version 2 has supplanted version 1, this can go. */
+#define ACE_CC_YYFAIL goto ace_cc_yyerrlab
+#define ACE_CC_YYRECOVERING() (!!ace_cc_yyerrstatus)
+#define ACE_CC_YYBACKUP(token, value) \
+do \
+ if (ace_cc_yychar == ACE_CC_YYEMPTY && ace_cc_yylen == 1) \
+ { ace_cc_yychar = (token), ace_cc_yylval = (value); \
+ ace_cc_yychar1 = ACE_CC_YYTRANSLATE (ace_cc_yychar); \
+ ACE_CC_YYPOPSTACK; \
+ goto ace_cc_yybackup; \
+ } \
+ else \
+ { ace_cc_yyerror ("syntax error: cannot back up"); ACE_CC_YYERROR; } \
+while (0)
+
+#define ACE_CC_YYTERROR 1
+#define ACE_CC_YYERRCODE 256
+
+#ifndef ACE_CC_YYPURE
+#define ACE_CC_YYLEX ace_cc_yylex()
+#endif
+
+#ifdef ACE_CC_YYPURE
+#ifdef ACE_CC_YYLSP_NEEDED
+#ifdef ACE_CC_YYLEX_PARAM
+#define ACE_CC_YYLEX ace_cc_yylex(&ace_cc_yylval, &ace_cc_yylloc, ACE_CC_YYLEX_PARAM)
+#else
+#define ACE_CC_YYLEX ace_cc_yylex(&ace_cc_yylval, &ace_cc_yylloc)
+#endif
+#else /* not ACE_CC_YYLSP_NEEDED */
+#ifdef ACE_CC_YYLEX_PARAM
+#define ACE_CC_YYLEX ace_cc_yylex(&ace_cc_yylval, ACE_CC_YYLEX_PARAM)
+#else
+#define ACE_CC_YYLEX ace_cc_yylex(&ace_cc_yylval)
+#endif
+#endif /* not ACE_CC_YYLSP_NEEDED */
+#endif
+
+/* If nonreentrant, generate the variables here */
+
+#ifndef ACE_CC_YYPURE
+
+int ace_cc_yychar; /* the lookahead symbol */
+ACE_CC_YYSTYPE ace_cc_yylval; /* the semantic value of the */
+ /* lookahead symbol */
+
+#ifdef ACE_CC_YYLSP_NEEDED
+ACE_CC_YYLTYPE ace_cc_yylloc; /* location data for the lookahead */
+ /* symbol */
+#endif
+
+int ace_cc_yynerrs; /* number of parse errors so far */
+#endif /* not ACE_CC_YYPURE */
+
+#if ACE_CC_YYDEBUG != 0
+int ace_cc_yydebug; /* nonzero means print parse trace */
+/* Since this is uninitialized, it does not stop multiple parsers
+ from coexisting. */
+#endif
+
+/* ACE_CC_YYINITDEPTH indicates the initial size of the parser's stacks */
+
+#ifndef ACE_CC_YYINITDEPTH
+#define ACE_CC_YYINITDEPTH 200
+#endif
+
+/* ACE_CC_YYMAXDEPTH is the maximum size the stacks can grow to
+ (effective only if the built-in stack extension method is used). */
+
+#if ACE_CC_YYMAXDEPTH == 0
+#undef ACE_CC_YYMAXDEPTH
+#endif
+
+#ifndef ACE_CC_YYMAXDEPTH
+#define ACE_CC_YYMAXDEPTH 10000
+#endif
+
+/* Define __ace_cc_yy_memcpy. Note that the size argument
+ should be passed with type unsigned int, because that is what the non-GCC
+ definitions require. With GCC, __builtin_memcpy takes an arg
+ of type size_t, but it can handle unsigned int. */
+
+#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
+#define __ace_cc_yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
+#else /* not GNU C or C++ */
+#ifndef __cplusplus
+
+/* This is the most reliable way to avoid incompatibilities
+ in available built-in functions on various systems. */
+static void
+__ace_cc_yy_memcpy (to, from, count)
+ char *to;
+ char *from;
+ unsigned int count;
+{
+ register char *f = from;
+ register char *t = to;
+ register int i = count;
+
+ while (i-- > 0)
+ *t++ = *f++;
+}
+
+#else /* __cplusplus */
+
+/* This is the most reliable way to avoid incompatibilities
+ in available built-in functions on various systems. */
+static void
+__ace_cc_yy_memcpy (char *to, char *from, unsigned int count)
+{
+ register char *t = to;
+ register char *f = from;
+ register int i = count;
+
+ while (i-- > 0)
+ *t++ = *f++;
+}
+
+#endif
+#endif
+
+
+
+/* The user can define ACE_CC_YYPARSE_PARAM as the name of an argument to be passed
+ into ace_cc_yyparse. The argument should have type void *.
+ It should actually point to an object.
+ Grammar actions can access the variable by casting it
+ to the proper pointer type. */
+
+#ifdef ACE_CC_YYPARSE_PARAM
+#ifdef __cplusplus
+#define ACE_CC_YYPARSE_PARAM_ARG void *ACE_CC_YYPARSE_PARAM
+#define ACE_CC_YYPARSE_PARAM_DECL
+#else /* not __cplusplus */
+#define ACE_CC_YYPARSE_PARAM_ARG ACE_CC_YYPARSE_PARAM
+#define ACE_CC_YYPARSE_PARAM_DECL void *ACE_CC_YYPARSE_PARAM;
+#endif /* not __cplusplus */
+#else /* not ACE_CC_YYPARSE_PARAM */
+#define ACE_CC_YYPARSE_PARAM_ARG
+#define ACE_CC_YYPARSE_PARAM_DECL
+#endif /* not ACE_CC_YYPARSE_PARAM */
+
+/* Prevent warning if -Wstrict-prototypes. */
+#ifdef __GNUC__
+#ifdef ACE_CC_YYPARSE_PARAM
+int ace_cc_yyparse (void *);
+#else
+int ace_cc_yyparse (void);
+#endif
+#endif
+
+int
+ace_cc_yyparse(ACE_CC_YYPARSE_PARAM_ARG)
+ ACE_CC_YYPARSE_PARAM_DECL
+{
+ register int ace_cc_yystate;
+ register int ace_cc_yyn;
+ register short *ace_cc_yyssp;
+ register ACE_CC_YYSTYPE *ace_cc_yyvsp;
+ int ace_cc_yyerrstatus; /* number of tokens to shift before error messages enabled */
+ int ace_cc_yychar1 = 0; /* lookahead token as an internal (translated) token number */
+
+ short ace_cc_yyssa[ACE_CC_YYINITDEPTH]; /* the state stack */
+ ACE_CC_YYSTYPE ace_cc_yyvsa[ACE_CC_YYINITDEPTH]; /* the semantic value stack */
+
+ short *ace_cc_yyss = ace_cc_yyssa; /* refer to the stacks thru separate pointers */
+ ACE_CC_YYSTYPE *ace_cc_yyvs = ace_cc_yyvsa; /* to allow ace_cc_yyoverflow to reallocate them elsewhere */
+
+#ifdef ACE_CC_YYLSP_NEEDED
+ ACE_CC_YYLTYPE ace_cc_yylsa[ACE_CC_YYINITDEPTH]; /* the location stack */
+ ACE_CC_YYLTYPE *ace_cc_yyls = ace_cc_yylsa;
+ ACE_CC_YYLTYPE *ace_cc_yylsp;
+
+#define ACE_CC_YYPOPSTACK (ace_cc_yyvsp--, ace_cc_yyssp--, ace_cc_yylsp--)
+#else
+#define ACE_CC_YYPOPSTACK (ace_cc_yyvsp--, ace_cc_yyssp--)
+#endif
+
+ int ace_cc_yystacksize = ACE_CC_YYINITDEPTH;
+ int ace_cc_yyfree_stacks = 0;
+
+#ifdef ACE_CC_YYPURE
+ int ace_cc_yychar;
+ ACE_CC_YYSTYPE ace_cc_yylval;
+ int ace_cc_yynerrs;
+#ifdef ACE_CC_YYLSP_NEEDED
+ ACE_CC_YYLTYPE ace_cc_yylloc;
+#endif
+#endif
+
+ ACE_CC_YYSTYPE ace_cc_yyval; /* the variable used to return */
+ /* semantic values from the action */
+ /* routines */
+
+ int ace_cc_yylen;
+
+#if ACE_CC_YYDEBUG != 0
+ if (ace_cc_yydebug)
+ fprintf(stderr, "Starting parse\n");
+#endif
+
+ ace_cc_yystate = 0;
+ ace_cc_yyerrstatus = 0;
+ ace_cc_yynerrs = 0;
+ ace_cc_yychar = ACE_CC_YYEMPTY; /* Cause a token to be read. */
+
+ /* Initialize stack pointers.
+ Waste one element of value and location stack
+ so that they stay on the same level as the state stack.
+ The wasted elements are never initialized. */
+
+ ace_cc_yyssp = ace_cc_yyss - 1;
+ ace_cc_yyvsp = ace_cc_yyvs;
+#ifdef ACE_CC_YYLSP_NEEDED
+ ace_cc_yylsp = ace_cc_yyls;
+#endif
+
+/* Push a new state, which is found in ace_cc_yystate . */
+/* In all cases, when you get here, the value and location stacks
+ have just been pushed. so pushing a state here evens the stacks. */
+ace_cc_yynewstate:
+
+ *++ace_cc_yyssp = ace_cc_yystate;
+
+ if (ace_cc_yyssp >= ace_cc_yyss + ace_cc_yystacksize - 1)
+ {
+ /* Give user a chance to reallocate the stack */
+ /* Use copies of these so that the &'s don't force the real ones into memory. */
+ ACE_CC_YYSTYPE *ace_cc_yyvs1 = ace_cc_yyvs;
+ short *ace_cc_yyss1 = ace_cc_yyss;
+#ifdef ACE_CC_YYLSP_NEEDED
+ ACE_CC_YYLTYPE *ace_cc_yyls1 = ace_cc_yyls;
+#endif
+
+ /* Get the current used size of the three stacks, in elements. */
+ int size = ace_cc_yyssp - ace_cc_yyss + 1;
+
+#ifdef ace_cc_yyoverflow
+ /* Each stack pointer address is followed by the size of
+ the data in use in that stack, in bytes. */
+#ifdef ACE_CC_YYLSP_NEEDED
+ /* This used to be a conditional around just the two extra args,
+ but that might be undefined if ace_cc_yyoverflow is a macro. */
+ ace_cc_yyoverflow("parser stack overflow",
+ &ace_cc_yyss1, size * sizeof (*ace_cc_yyssp),
+ &ace_cc_yyvs1, size * sizeof (*ace_cc_yyvsp),
+ &ace_cc_yyls1, size * sizeof (*ace_cc_yylsp),
+ &ace_cc_yystacksize);
+#else
+ ace_cc_yyoverflow("parser stack overflow",
+ &ace_cc_yyss1, size * sizeof (*ace_cc_yyssp),
+ &ace_cc_yyvs1, size * sizeof (*ace_cc_yyvsp),
+ &ace_cc_yystacksize);
+#endif
+
+ ace_cc_yyss = ace_cc_yyss1; ace_cc_yyvs = ace_cc_yyvs1;
+#ifdef ACE_CC_YYLSP_NEEDED
+ ace_cc_yyls = ace_cc_yyls1;
+#endif
+#else /* no ace_cc_yyoverflow */
+ /* Extend the stack our own way. */
+ if (ace_cc_yystacksize >= ACE_CC_YYMAXDEPTH)
+ {
+ ace_cc_yyerror("parser stack overflow");
+ if (ace_cc_yyfree_stacks)
+ {
+ free (ace_cc_yyss);
+ free (ace_cc_yyvs);
+#ifdef ACE_CC_YYLSP_NEEDED
+ free (ace_cc_yyls);
+#endif
+ }
+ return 2;
+ }
+ ace_cc_yystacksize *= 2;
+ if (ace_cc_yystacksize > ACE_CC_YYMAXDEPTH)
+ ace_cc_yystacksize = ACE_CC_YYMAXDEPTH;
+#ifndef ACE_CC_YYSTACK_USE_ALLOCA
+ ace_cc_yyfree_stacks = 1;
+#endif
+ ace_cc_yyss = (short *) ACE_CC_YYSTACK_ALLOC (ace_cc_yystacksize * sizeof (*ace_cc_yyssp));
+ __ace_cc_yy_memcpy ((char *)ace_cc_yyss, (char *)ace_cc_yyss1,
+ size * (unsigned int) sizeof (*ace_cc_yyssp));
+ ace_cc_yyvs = (ACE_CC_YYSTYPE *) ACE_CC_YYSTACK_ALLOC (ace_cc_yystacksize * sizeof (*ace_cc_yyvsp));
+ __ace_cc_yy_memcpy ((char *)ace_cc_yyvs, (char *)ace_cc_yyvs1,
+ size * (unsigned int) sizeof (*ace_cc_yyvsp));
+#ifdef ACE_CC_YYLSP_NEEDED
+ ace_cc_yyls = (ACE_CC_YYLTYPE *) ACE_CC_YYSTACK_ALLOC (ace_cc_yystacksize * sizeof (*ace_cc_yylsp));
+ __ace_cc_yy_memcpy ((char *)ace_cc_yyls, (char *)ace_cc_yyls1,
+ size * (unsigned int) sizeof (*ace_cc_yylsp));
+#endif
+#endif /* no ace_cc_yyoverflow */
+
+ ace_cc_yyssp = ace_cc_yyss + size - 1;
+ ace_cc_yyvsp = ace_cc_yyvs + size - 1;
+#ifdef ACE_CC_YYLSP_NEEDED
+ ace_cc_yylsp = ace_cc_yyls + size - 1;
+#endif
+
+#if ACE_CC_YYDEBUG != 0
+ if (ace_cc_yydebug)
+ fprintf(stderr, "Stack size increased to %d\n", ace_cc_yystacksize);
+#endif
+
+ if (ace_cc_yyssp >= ace_cc_yyss + ace_cc_yystacksize - 1)
+ ACE_CC_YYABORT;
+ }
+
+#if ACE_CC_YYDEBUG != 0
+ if (ace_cc_yydebug)
+ fprintf(stderr, "Entering state %d\n", ace_cc_yystate);
+#endif
+
+ goto ace_cc_yybackup;
+ ace_cc_yybackup:
+
+/* Do appropriate processing given the current state. */
+/* Read a lookahead token if we need one and don't already have one. */
+/* ace_cc_yyresume: */
+
+ /* First try to decide what to do without reference to lookahead token. */
+
+ ace_cc_yyn = ace_cc_yypact[ace_cc_yystate];
+ if (ace_cc_yyn == ACE_CC_YYFLAG)
+ goto ace_cc_yydefault;
+
+ /* Not known => get a lookahead token if don't already have one. */
+
+ /* ace_cc_yychar is either ACE_CC_YYEMPTY or ACE_CC_YYEOF
+ or a valid token in external form. */
+
+ if (ace_cc_yychar == ACE_CC_YYEMPTY)
+ {
+#if ACE_CC_YYDEBUG != 0
+ if (ace_cc_yydebug)
+ fprintf(stderr, "Reading a token: ");
+#endif
+ ace_cc_yychar = ACE_CC_YYLEX;
+ }
+
+ /* Convert token to internal form (in ace_cc_yychar1) for indexing tables with */
+
+ if (ace_cc_yychar <= 0) /* This means end of input. */
+ {
+ ace_cc_yychar1 = 0;
+ ace_cc_yychar = ACE_CC_YYEOF; /* Don't call ACE_CC_YYLEX any more */
+
+#if ACE_CC_YYDEBUG != 0
+ if (ace_cc_yydebug)
+ fprintf(stderr, "Now at end of input.\n");
+#endif
+ }
+ else
+ {
+ ace_cc_yychar1 = ACE_CC_YYTRANSLATE(ace_cc_yychar);
+
+#if ACE_CC_YYDEBUG != 0
+ if (ace_cc_yydebug)
+ {
+ fprintf (stderr, "Next token is %d (%s", ace_cc_yychar, ace_cc_yytname[ace_cc_yychar1]);
+ /* Give the individual parser a way to print the precise meaning
+ of a token, for further debugging info. */
+#ifdef ACE_CC_YYPRINT
+ ACE_CC_YYPRINT (stderr, ace_cc_yychar, ace_cc_yylval);
+#endif
+ fprintf (stderr, ")\n");
+ }
+#endif
+ }
+
+ ace_cc_yyn += ace_cc_yychar1;
+ if (ace_cc_yyn < 0 || ace_cc_yyn > ACE_CC_YYLAST || ace_cc_yycheck[ace_cc_yyn] != ace_cc_yychar1)
+ goto ace_cc_yydefault;
+
+ ace_cc_yyn = ace_cc_yytable[ace_cc_yyn];
+
+ /* ace_cc_yyn is what to do for this token type in this state.
+ Negative => reduce, -ace_cc_yyn is rule number.
+ Positive => shift, ace_cc_yyn is new state.
+ New state is final state => don't bother to shift,
+ just return success.
+ 0, or most negative number => error. */
+
+ if (ace_cc_yyn < 0)
+ {
+ if (ace_cc_yyn == ACE_CC_YYFLAG)
+ goto ace_cc_yyerrlab;
+ ace_cc_yyn = -ace_cc_yyn;
+ goto ace_cc_yyreduce;
+ }
+ else if (ace_cc_yyn == 0)
+ goto ace_cc_yyerrlab;
+
+ if (ace_cc_yyn == ACE_CC_YYFINAL)
+ ACE_CC_YYACCEPT;
+
+ /* Shift the lookahead token. */
+
+#if ACE_CC_YYDEBUG != 0
+ if (ace_cc_yydebug)
+ fprintf(stderr, "Shifting token %d (%s), ", ace_cc_yychar, ace_cc_yytname[ace_cc_yychar1]);
+#endif
+
+ /* Discard the token being shifted unless it is eof. */
+ if (ace_cc_yychar != ACE_CC_YYEOF)
+ ace_cc_yychar = ACE_CC_YYEMPTY;
+
+ *++ace_cc_yyvsp = ace_cc_yylval;
+#ifdef ACE_CC_YYLSP_NEEDED
+ *++ace_cc_yylsp = ace_cc_yylloc;
+#endif
+
+ /* count tokens shifted since error; after three, turn off error status. */
+ if (ace_cc_yyerrstatus) ace_cc_yyerrstatus--;
+
+ ace_cc_yystate = ace_cc_yyn;
+ goto ace_cc_yynewstate;
+
+/* Do the default action for the current state. */
+ace_cc_yydefault:
+
+ ace_cc_yyn = ace_cc_yydefact[ace_cc_yystate];
+ if (ace_cc_yyn == 0)
+ goto ace_cc_yyerrlab;
+
+/* Do a reduction. ace_cc_yyn is the number of a rule to reduce with. */
+ace_cc_yyreduce:
+ ace_cc_yylen = ace_cc_yyr2[ace_cc_yyn];
+ if (ace_cc_yylen > 0)
+ ace_cc_yyval = ace_cc_yyvsp[1-ace_cc_yylen]; /* implement default value of the action */
+
+#if ACE_CC_YYDEBUG != 0
+ if (ace_cc_yydebug)
+ {
+ int i;
+
+ fprintf (stderr, "Reducing via rule %d (line %d), ",
+ ace_cc_yyn, ace_cc_yyrline[ace_cc_yyn]);
+
+ /* Print the symbols being reduced, and their result. */
+ for (i = ace_cc_yyprhs[ace_cc_yyn]; ace_cc_yyrhs[i] > 0; i++)
+ fprintf (stderr, "%s ", ace_cc_yytname[ace_cc_yyrhs[i]]);
+ fprintf (stderr, " -> %s\n", ace_cc_yytname[ace_cc_yyr1[ace_cc_yyn]]);
+ }
+#endif
+
+
+ switch (ace_cc_yyn) {
+
+case 2:
+{ cmdlist->add(new CC_Sleep_Cmd(0));
+ /* dummy to check exeption in the last command */
+ if(cmdlist->execute()!=0) //CC_FAIL
+ { printf(" ** Test succeded!!\n"); }
+ else
+ { printf(" ** Test FAILED!!\n"); } ;
+ break;}
+case 3:
+{ cmdlist->add(ace_cc_yyvsp[0].command); ;
+ break;}
+case 4:
+{ cmdlist->add(ace_cc_yyvsp[0].command); ;
+ break;}
+case 5:
+{ ace_cc_yyval.command = new CC_Start_Cmd(ace_cc_yyvsp[-1].id); ;
+ break;}
+case 6:
+{ ace_cc_yyval.command = new CC_CreateLockSet_Cmd(ace_cc_yyvsp[-1].id); ;
+ break;}
+case 7:
+{ ace_cc_yyval.command = new CC_CreateLockSet_Cmd(""); ;
+ break;}
+case 8:
+{ ace_cc_yyval.command = new CC_Lock_Cmd(ace_cc_yyvsp[-2].id, ace_cc_yyvsp[-1].lock_mode); ;
+ break;}
+case 9:
+{ ace_cc_yyval.command = new CC_Lock_Cmd("", ace_cc_yyvsp[-1].lock_mode); ;
+ break;}
+case 10:
+{ ace_cc_yyval.command = new CC_UnLock_Cmd(ace_cc_yyvsp[-2].id, ace_cc_yyvsp[-1].lock_mode); ;
+ break;}
+case 11:
+{ ace_cc_yyval.command = new CC_UnLock_Cmd("", ace_cc_yyvsp[-1].lock_mode); ;
+ break;}
+case 12:
+{ ace_cc_yyval.command = new CC_TryLock_Cmd(ace_cc_yyvsp[-2].id, ace_cc_yyvsp[-1].lock_mode); ;
+ break;}
+case 13:
+{ ace_cc_yyval.command = new CC_TryLock_Cmd("", ace_cc_yyvsp[-1].lock_mode); ;
+ break;}
+case 14:
+{ ace_cc_yyval.command = new CC_ChangeMode_Cmd(ace_cc_yyvsp[-3].id, ace_cc_yyvsp[-2].lock_mode, ace_cc_yyvsp[-1].lock_mode); ;
+ break;}
+case 15:
+{ ace_cc_yyval.command = new CC_ChangeMode_Cmd("", ace_cc_yyvsp[-2].lock_mode, ace_cc_yyvsp[-1].lock_mode); ;
+ break;}
+case 16:
+{ ace_cc_yyval.command = new CC_Sleep_Cmd(ace_cc_yyvsp[-1].num); ;
+ break;}
+case 17:
+{ ace_cc_yyval.command = new CC_Wait_Cmd(""); ;
+ break;}
+case 18:
+{ ace_cc_yyval.command = new CC_Wait_Cmd(ace_cc_yyvsp[-1].id); ;
+ break;}
+case 19:
+{ ace_cc_yyval.command = new CC_Print_Cmd(ace_cc_yyvsp[-1].id); ;
+ break;}
+case 20:
+{ ace_cc_yyval.command = new CC_Lookup_Cmd(ace_cc_yyvsp[-1].id); ;
+ break;}
+case 21:
+{ cmdlist->setrepeat(ace_cc_yyvsp[-1].num);
+ ace_cc_yyval.command = new CC_Dummy_Cmd();;
+ break;}
+case 22:
+{ ace_cc_yyval.command = new CC_Excep_Cmd(ace_cc_yyvsp[-1].id); ;
+ break;}
+case 23:
+{ace_cc_yyval.id = ace_cc_yyvsp[0].id; ;
+ break;}
+case 24:
+{ace_cc_yyval.id = ace_cc_yyvsp[0].id; ;
+ break;}
+case 25:
+{ace_cc_yyval.id = ace_cc_yyvsp[0].id; ;
+ break;}
+case 26:
+{ ace_cc_yyval.lock_mode = CosConcurrencyControl::read; ;
+ break;}
+case 27:
+{ ace_cc_yyval.lock_mode = CosConcurrencyControl::intention_read; ;
+ break;}
+case 28:
+{ ace_cc_yyval.lock_mode = CosConcurrencyControl::upgrade; ;
+ break;}
+case 29:
+{ ace_cc_yyval.lock_mode = CosConcurrencyControl::write; ;
+ break;}
+case 30:
+{ ace_cc_yyval.lock_mode = CosConcurrencyControl::intention_write; ;
+ break;}
+}
+ /* the action file gets copied in in place of this dollarsign */
+
+
+ ace_cc_yyvsp -= ace_cc_yylen;
+ ace_cc_yyssp -= ace_cc_yylen;
+#ifdef ACE_CC_YYLSP_NEEDED
+ ace_cc_yylsp -= ace_cc_yylen;
+#endif
+
+#if ACE_CC_YYDEBUG != 0
+ if (ace_cc_yydebug)
+ {
+ short *ssp1 = ace_cc_yyss - 1;
+ fprintf (stderr, "state stack now");
+ while (ssp1 != ace_cc_yyssp)
+ fprintf (stderr, " %d", *++ssp1);
+ fprintf (stderr, "\n");
+ }
+#endif
+
+ *++ace_cc_yyvsp = ace_cc_yyval;
+
+#ifdef ACE_CC_YYLSP_NEEDED
+ ace_cc_yylsp++;
+ if (ace_cc_yylen == 0)
+ {
+ ace_cc_yylsp->first_line = ace_cc_yylloc.first_line;
+ ace_cc_yylsp->first_column = ace_cc_yylloc.first_column;
+ ace_cc_yylsp->last_line = (ace_cc_yylsp-1)->last_line;
+ ace_cc_yylsp->last_column = (ace_cc_yylsp-1)->last_column;
+ ace_cc_yylsp->text = 0;
+ }
+ else
+ {
+ ace_cc_yylsp->last_line = (ace_cc_yylsp+ace_cc_yylen-1)->last_line;
+ ace_cc_yylsp->last_column = (ace_cc_yylsp+ace_cc_yylen-1)->last_column;
+ }
+#endif
+
+ /* Now "shift" the result of the reduction.
+ Determine what state that goes to,
+ based on the state we popped back to
+ and the rule number reduced by. */
+
+ ace_cc_yyn = ace_cc_yyr1[ace_cc_yyn];
+
+ ace_cc_yystate = ace_cc_yypgoto[ace_cc_yyn - ACE_CC_YYNTBASE] + *ace_cc_yyssp;
+ if (ace_cc_yystate >= 0 && ace_cc_yystate <= ACE_CC_YYLAST && ace_cc_yycheck[ace_cc_yystate] == *ace_cc_yyssp)
+ ace_cc_yystate = ace_cc_yytable[ace_cc_yystate];
+ else
+ ace_cc_yystate = ace_cc_yydefgoto[ace_cc_yyn - ACE_CC_YYNTBASE];
+
+ goto ace_cc_yynewstate;
+
+ace_cc_yyerrlab: /* here on detecting error */
+
+ if (! ace_cc_yyerrstatus)
+ /* If not already recovering from an error, report this error. */
+ {
+ ++ace_cc_yynerrs;
+
+#ifdef ACE_CC_YYERROR_VERBOSE
+ ace_cc_yyn = ace_cc_yypact[ace_cc_yystate];
+
+ if (ace_cc_yyn > ACE_CC_YYFLAG && ace_cc_yyn < ACE_CC_YYLAST)
+ {
+ int size = 0;
+ char *msg;
+ int x, count;
+
+ count = 0;
+ /* Start X at -ace_cc_yyn if nec to avoid negative indexes in ace_cc_yycheck. */
+ for (x = (ace_cc_yyn < 0 ? -ace_cc_yyn : 0);
+ x < (sizeof(ace_cc_yytname) / sizeof(char *)); x++)
+ if (ace_cc_yycheck[x + ace_cc_yyn] == x)
+ size += strlen(ace_cc_yytname[x]) + 15, count++;
+ msg = (char *) malloc(size + 15);
+ if (msg != 0)
+ {
+ strcpy(msg, "parse error");
+
+ if (count < 5)
+ {
+ count = 0;
+ for (x = (ace_cc_yyn < 0 ? -ace_cc_yyn : 0);
+ x < (sizeof(ace_cc_yytname) / sizeof(char *)); x++)
+ if (ace_cc_yycheck[x + ace_cc_yyn] == x)
+ {
+ strcat(msg, count == 0 ? ", expecting `" : " or `");
+ strcat(msg, ace_cc_yytname[x]);
+ strcat(msg, "'");
+ count++;
+ }
+ }
+ ace_cc_yyerror(msg);
+ free(msg);
+ }
+ else
+ ace_cc_yyerror ("parse error; also virtual memory exceeded");
+ }
+ else
+#endif /* ACE_CC_YYERROR_VERBOSE */
+ ace_cc_yyerror("parse error");
+ }
+
+ goto ace_cc_yyerrlab1;
+ace_cc_yyerrlab1: /* here on error raised explicitly by an action */
+
+ if (ace_cc_yyerrstatus == 3)
+ {
+ /* if just tried and failed to reuse lookahead token after an error, discard it. */
+
+ /* return failure if at end of input */
+ if (ace_cc_yychar == ACE_CC_YYEOF)
+ ACE_CC_YYABORT;
+
+#if ACE_CC_YYDEBUG != 0
+ if (ace_cc_yydebug)
+ fprintf(stderr, "Discarding token %d (%s).\n", ace_cc_yychar, ace_cc_yytname[ace_cc_yychar1]);
+#endif
+
+ ace_cc_yychar = ACE_CC_YYEMPTY;
+ }
+
+ /* Else will try to reuse lookahead token
+ after shifting the error token. */
+
+ ace_cc_yyerrstatus = 3; /* Each real token shifted decrements this */
+
+ goto ace_cc_yyerrhandle;
+
+ace_cc_yyerrdefault: /* current state does not do anything special for the error token. */
+
+#if 0
+ /* This is wrong; only states that explicitly want error tokens
+ should shift them. */
+ ace_cc_yyn = ace_cc_yydefact[ace_cc_yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
+ if (ace_cc_yyn) goto ace_cc_yydefault;
+#endif
+
+ace_cc_yyerrpop: /* pop the current state because it cannot handle the error token */
+
+ if (ace_cc_yyssp == ace_cc_yyss) ACE_CC_YYABORT;
+ ace_cc_yyvsp--;
+ ace_cc_yystate = *--ace_cc_yyssp;
+#ifdef ACE_CC_YYLSP_NEEDED
+ ace_cc_yylsp--;
+#endif
+
+#if ACE_CC_YYDEBUG != 0
+ if (ace_cc_yydebug)
+ {
+ short *ssp1 = ace_cc_yyss - 1;
+ fprintf (stderr, "Error: state stack now");
+ while (ssp1 != ace_cc_yyssp)
+ fprintf (stderr, " %d", *++ssp1);
+ fprintf (stderr, "\n");
+ }
+#endif
+
+ace_cc_yyerrhandle:
+
+ ace_cc_yyn = ace_cc_yypact[ace_cc_yystate];
+ if (ace_cc_yyn == ACE_CC_YYFLAG)
+ goto ace_cc_yyerrdefault;
+
+ ace_cc_yyn += ACE_CC_YYTERROR;
+ if (ace_cc_yyn < 0 || ace_cc_yyn > ACE_CC_YYLAST || ace_cc_yycheck[ace_cc_yyn] != ACE_CC_YYTERROR)
+ goto ace_cc_yyerrdefault;
+
+ ace_cc_yyn = ace_cc_yytable[ace_cc_yyn];
+ if (ace_cc_yyn < 0)
+ {
+ if (ace_cc_yyn == ACE_CC_YYFLAG)
+ goto ace_cc_yyerrpop;
+ ace_cc_yyn = -ace_cc_yyn;
+ goto ace_cc_yyreduce;
+ }
+ else if (ace_cc_yyn == 0)
+ goto ace_cc_yyerrpop;
+
+ if (ace_cc_yyn == ACE_CC_YYFINAL)
+ ACE_CC_YYACCEPT;
+
+#if ACE_CC_YYDEBUG != 0
+ if (ace_cc_yydebug)
+ fprintf(stderr, "Shifting error token, ");
+#endif
+
+ *++ace_cc_yyvsp = ace_cc_yylval;
+#ifdef ACE_CC_YYLSP_NEEDED
+ *++ace_cc_yylsp = ace_cc_yylloc;
+#endif
+
+ ace_cc_yystate = ace_cc_yyn;
+ goto ace_cc_yynewstate;
+
+ ace_cc_yyacceptlab:
+ /* ACE_CC_YYACCEPT comes here. */
+ if (ace_cc_yyfree_stacks)
+ {
+ free (ace_cc_yyss);
+ free (ace_cc_yyvs);
+#ifdef ACE_CC_YYLSP_NEEDED
+ free (ace_cc_yyls);
+#endif
+ }
+ return 0;
+
+ ace_cc_yyabortlab:
+ /* ACE_CC_YYABORT comes here. */
+ if (ace_cc_yyfree_stacks)
+ {
+ free (ace_cc_yyss);
+ free (ace_cc_yyvs);
+#ifdef ACE_CC_YYLSP_NEEDED
+ free (ace_cc_yyls);
+#endif
+ }
+ return 1;
+}
+
+
+void
+ace_cc_yyerror (const char *s)
+{
+ ACE_OS::printf ("%d: %s at %s in:\n%s\n",
+ line_no,
+ s,
+ ace_cc_yytext,
+ line_buf);
+ ACE_OS::exit (-1);
+}
diff --git a/TAO/orbsvcs/tests/Concurrency/CC_command.tab.h b/TAO/orbsvcs/tests/Concurrency/CC_command.tab.h
new file mode 100644
index 00000000000..71a69f98647
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/CC_command.tab.h
@@ -0,0 +1,32 @@
+// $Id$
+
+typedef union {
+ CC_Command *command;
+ CosConcurrencyControl::lock_mode lock_mode;
+ char *id;
+ int num;
+} ACE_CC_YYSTYPE;
+#define T_START_CMD 257
+#define T_CREATE_CMD 258
+#define T_LOCK_CMD 259
+#define T_UNLOCK_CMD 260
+#define T_TRYLOCK_CMD 261
+#define T_CHANGEMODE_CMD 262
+#define T_SLEEP_CMD 263
+#define T_WAIT_CMD 264
+#define T_REPEAT_CMD 265
+#define T_EXCEP_CMD 266
+#define T_PRINT_CMD 267
+#define T_LOOKUP_CMD 268
+#define T_TERM 269
+#define T_READ 270
+#define T_IREAD 271
+#define T_UPGRADE 272
+#define T_WRITE 273
+#define T_IWRITE 274
+#define T_IDENT 275
+#define Q_STRING 276
+#define T_NUM 277
+
+
+extern ACE_CC_YYSTYPE ace_cc_yylval;
diff --git a/TAO/orbsvcs/tests/Concurrency/CC_command.y b/TAO/orbsvcs/tests/Concurrency/CC_command.y
new file mode 100644
index 00000000000..339c8e47084
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/CC_command.y
@@ -0,0 +1,126 @@
+/* $Id$
+ * ============================================================================
+ *
+ * = LIBRARY
+ * TAO/orbsvcs/tests
+ *
+ * = FILENAME
+ * CC_command.y
+ *
+ * = DESCRIPTION
+ * This is the yacc file for the concurrency service script language.
+ *
+ * = AUTHORS
+ * Torben Worm <tworm@cs.wustl.edu>
+ *
+ * ============================================================================
+ */
+%{
+#include "CC_command.h"
+#include "ace/ACE.h"
+#include "orbsvcs/CosConcurrencyControlC.h"
+
+void yyerror (const char* s);
+int yylex(void);
+
+extern int line_no;
+extern char line_buf[500];
+extern char *yytext;
+extern CC_CommandList *cmdlist;
+%}
+
+%union {
+ CC_Command *command;
+ CosConcurrencyControl::lock_mode lock_mode;
+ char *id;
+ int num;
+}
+
+%token T_START_CMD T_CREATE_CMD T_LOCK_CMD T_UNLOCK_CMD T_TRYLOCK_CMD
+%token T_CHANGEMODE_CMD T_SLEEP_CMD T_WAIT_CMD T_REPEAT_CMD T_EXCEP_CMD
+%token T_PRINT_CMD T_LOOKUP_CMD T_TERM
+%token T_READ T_IREAD T_UPGRADE T_WRITE T_IWRITE
+%token <id> T_IDENT Q_STRING
+%token <num> T_NUM
+
+%type <command> cmd
+%type <id> config_file_name lock_set_name exception_name
+%type <lock_mode> lock_mode
+
+%%
+start: /* empty */
+ | cmd_list { cmdlist->add(new CC_Sleep_Cmd(0));
+ /* dummy to check exeption in the last command */
+ if(cmdlist->execute()!=0) //CC_FAIL
+ { printf(" ** Test succeded!!\n"); }
+ else
+ { printf(" ** Test FAILED!!\n"); } }
+ ;
+
+cmd_list: cmd_list cmd { cmdlist->add($2); }
+ | cmd { cmdlist->add($1); }
+ ;
+
+cmd: T_START_CMD config_file_name T_TERM
+ { $$ = new CC_Start_Cmd($2); }
+ | T_CREATE_CMD lock_set_name T_TERM
+ { $$ = new CC_CreateLockSet_Cmd($2); }
+ | T_CREATE_CMD T_TERM
+ { $$ = new CC_CreateLockSet_Cmd(""); }
+ | T_LOCK_CMD lock_set_name lock_mode T_TERM
+ { $$ = new CC_Lock_Cmd($2, $3); }
+ | T_LOCK_CMD lock_mode T_TERM
+ { $$ = new CC_Lock_Cmd("", $2); }
+ | T_UNLOCK_CMD lock_set_name lock_mode T_TERM
+ { $$ = new CC_UnLock_Cmd($2, $3); }
+ | T_UNLOCK_CMD lock_mode T_TERM
+ { $$ = new CC_UnLock_Cmd("", $2); }
+ | T_TRYLOCK_CMD lock_set_name lock_mode T_TERM
+ { $$ = new CC_TryLock_Cmd($2, $3); }
+ | T_TRYLOCK_CMD lock_mode T_TERM
+ { $$ = new CC_TryLock_Cmd("", $2); }
+ | T_CHANGEMODE_CMD lock_set_name lock_mode lock_mode T_TERM
+ { $$ = new CC_ChangeMode_Cmd($2, $3, $4); }
+ | T_CHANGEMODE_CMD lock_mode lock_mode T_TERM
+ { $$ = new CC_ChangeMode_Cmd("", $2, $3); }
+ | T_SLEEP_CMD T_NUM T_TERM
+ { $$ = new CC_Sleep_Cmd($2); }
+ | T_WAIT_CMD T_TERM
+ { $$ = new CC_Wait_Cmd(""); }
+ | T_WAIT_CMD Q_STRING T_TERM
+ { $$ = new CC_Wait_Cmd($2); }
+ | T_PRINT_CMD Q_STRING T_TERM
+ { $$ = new CC_Print_Cmd($2); }
+ | T_LOOKUP_CMD lock_set_name T_TERM
+ { $$ = new CC_Lookup_Cmd($2); }
+ | T_REPEAT_CMD T_NUM T_TERM
+ { cmdlist->setrepeat($2);
+ $$ = new CC_Dummy_Cmd();}
+ | T_EXCEP_CMD exception_name T_TERM
+ { $$ = new CC_Excep_Cmd($2); }
+ ;
+
+config_file_name: T_IDENT {$$ = $1; }
+
+lock_set_name: T_IDENT {$$ = $1; }
+
+exception_name: T_IDENT {$$ = $1; }
+
+lock_mode: T_READ { $$ = CosConcurrencyControl::read; }
+ | T_IREAD { $$ = CosConcurrencyControl::intention_read; }
+ | T_UPGRADE { $$ = CosConcurrencyControl::upgrade; }
+ | T_WRITE { $$ = CosConcurrencyControl::write; }
+ | T_IWRITE { $$ = CosConcurrencyControl::intention_write; }
+
+%%
+
+void
+yyerror (const char *s)
+{
+ ACE_OS::printf ("%d: %s at %s in:\n%s\n",
+ line_no,
+ s,
+ yytext,
+ line_buf);
+ ACE_OS::exit (-1);
+}
diff --git a/TAO/orbsvcs/tests/Concurrency/CC_naming_service.cpp b/TAO/orbsvcs/tests/Concurrency/CC_naming_service.cpp
new file mode 100644
index 00000000000..d12cb0d1e94
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/CC_naming_service.cpp
@@ -0,0 +1,185 @@
+// $Id
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/Concurrency
+//
+// = FILENAME
+// CC_naming_service.cpp
+//
+// = DESCRIPTION
+// This class implements the naming services necessary to test the
+// concurrency service
+//
+// = AUTHORS
+// Torben Worm <tworm@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "CC_naming_service.h"
+#include "ace/OS_NS_string.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID(Concurrency, CC_naming_service, "$Id$")
+
+CC_naming_service::CC_naming_service (CORBA::ORB_var orb
+ ACE_ENV_ARG_DECL)
+ : cc_factory_key_ (0),
+ orb_ (0),
+ factory_ (0)
+{
+ this->Init(orb ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ instance_ = this;
+}
+
+CC_naming_service::CC_naming_service(void)
+ : cc_factory_key_ (0),
+ orb_ (0),
+ factory_ (0)
+{
+}
+
+void
+CC_naming_service::Init(CORBA::ORB_var orb
+ ACE_ENV_ARG_DECL)
+{
+ this->orb_ = orb;
+
+ int success = init_naming_service ();
+ if (success < 0)
+ ACE_THROW (CORBA::INTERNAL ());
+}
+
+CC_naming_service::~CC_naming_service (void)
+{
+ // if(instance_!=0)
+ // delete instance_;
+ // @TAO somthing went wrong when these lines were uncommented
+}
+
+CC_naming_service *
+CC_naming_service::Instance(void)
+{
+ if(instance_ == 0)
+ {
+ instance_ = new CC_naming_service();
+ }
+ return instance_;
+}
+
+CORBA::Object_var
+CC_naming_service::get_obj_from_name (const char *c_name,
+ const char *name
+ ACE_ENV_ARG_DECL)
+{
+ ACE_DEBUG ((LM_DEBUG, "C: %s, N: %s\n", c_name, name));
+ CORBA::Object_var obj;
+
+ ACE_TRY
+ {
+ if (ACE_OS::strlen (c_name) == 0)
+ {
+ CosNaming::Name ns_name (1);
+ ns_name.length (1);
+ ns_name[0].id = CORBA::string_dup (name);
+ obj = my_name_client_->resolve (ns_name ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ CosNaming::Name ns_name (2);
+ ns_name.length (2);
+ ns_name[0].id = CORBA::string_dup (c_name);
+ ns_name[1].id = CORBA::string_dup (name);
+ obj = my_name_client_->resolve (ns_name ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ if (CORBA::is_nil (obj.in ()) )
+ ACE_DEBUG((LM_DEBUG,
+ "OBJ was nill (aieee)\n"));
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "CC_Client::get_obj_from_name (...)");
+ return obj;
+ }
+ ACE_ENDTRY;
+
+ return obj;
+}
+
+void
+CC_naming_service::bind_name (const char *n,
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL)
+{
+ ACE_DEBUG ((LM_DEBUG, "CC_Client::bind_name\n"));
+
+ ACE_TRY
+ {
+ CosNaming::Name ns_name (1);
+ ns_name.length (1);
+ ns_name[0].id = CORBA::string_dup (n);
+ my_name_client_->bind (ns_name,
+ obj
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "CC_Client::bind_name (...)");
+ }
+ ACE_ENDTRY;
+}
+
+CosConcurrencyControl::LockSetFactory_var
+CC_naming_service::get_lock_set_factory (void)
+{
+ return this->factory_;
+}
+
+int
+CC_naming_service::init_naming_service (void)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ // Initialize the naming services
+ if (my_name_client_.init (orb_.in ()) != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to initialize "
+ "the TAO_Naming_Client. \n"),
+ -1);
+
+ CORBA::Object_var factory_obj = get_obj_from_name ("CosConcurrency",
+ "LockSetFactory"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ this->factory_ =
+ CosConcurrencyControl::LockSetFactory::_narrow
+ (factory_obj.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (this->factory_.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " could not resolve lock set factory in Naming service\n"),
+ -1);
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "CC_Client::init_naming_service");
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+CC_naming_service* CC_naming_service::instance_ = 0;
diff --git a/TAO/orbsvcs/tests/Concurrency/CC_naming_service.h b/TAO/orbsvcs/tests/Concurrency/CC_naming_service.h
new file mode 100644
index 00000000000..597a9696840
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/CC_naming_service.h
@@ -0,0 +1,86 @@
+// -*- c++ -*-
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/Concurrency
+//
+// = FILENAME
+// CC_naming_service.h
+//
+// = DESCRIPTION
+// This class implements the naming services necessary to test the
+// concurrency service.
+//
+// = AUTHORS
+// Torben Worm <tworm@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "orbsvcs/CosConcurrencyControlC.h"
+#include "orbsvcs/CosNamingC.h"
+#include "orbsvcs/Naming/Naming_Client.h"
+
+#ifndef _CC_NAMING_SERVICE_H_
+#define _CC_NAMING_SERVICE_H_
+
+class CC_naming_service
+{
+ // = TITLE
+ // Defines a class that encapsulates the necessary naming service
+ // functions for the concurrency service.
+ //
+ // = DESCRIPTION
+ // This class declares an interface to the naming service for the
+ // concurrency service tests.
+public:
+ CC_naming_service ();
+ // Default constructor
+
+ CC_naming_service (CORBA::ORB_var orb_ ACE_ENV_ARG_DECL);
+ // Constructor
+
+ ~CC_naming_service (void);
+ // Default destructor.
+
+ void Init (CORBA::ORB_var orb_ ACE_ENV_ARG_DECL);
+ // Initialization method must be called after first call of Instance()
+ // in order to initialize the object correctly
+
+ CORBA::Object_var get_obj_from_name (const char *c_name,
+ const char *name
+ ACE_ENV_ARG_DECL);
+ // Lookup a name in the naming service (context, name)
+
+ void bind_name (const char *n,
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL);
+ // Bind a name in the concurrency context.
+
+ CosConcurrencyControl::LockSetFactory_var get_lock_set_factory (void);
+ // Gets the cc lock set factory which is common for all tests.
+
+ static CC_naming_service *Instance(void);
+ // The naming service object is a singleton
+
+private:
+ int init_naming_service (void);
+ // Function to initialize the naming service.
+
+ char *cc_factory_key_;
+ // Key of factory obj ref.
+
+ CORBA::ORB_var orb_;
+ // Remember our orb.
+
+ TAO_Naming_Client my_name_client_;
+ // Name service wrapper class
+
+ CosConcurrencyControl::LockSetFactory_var factory_;
+ // factory pointer for the lock set.
+
+ static CC_naming_service *instance_;
+ // The instance of the naming service object
+};
+#endif /* !defined (_CC_NAMING_SERVICE_H_) */
diff --git a/TAO/orbsvcs/tests/Concurrency/CC_test_utils.cpp b/TAO/orbsvcs/tests/Concurrency/CC_test_utils.cpp
new file mode 100644
index 00000000000..f88b2b65f7e
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/CC_test_utils.cpp
@@ -0,0 +1,73 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/orbsvcs/tests
+//
+// = FILENAME
+// CC_test_utils.cpp
+//
+// = DESCRIPTION
+// This class provides a namespace for utility functions for the
+// concurrency service test.
+//
+// = AUTHORS
+// Torben Worm <tworm@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "CC_test_utils.h"
+#include "CC_naming_service.h"
+#include "ace/OS.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID(Concurrency, CC_test_utils, "$Id$")
+
+char *CC_TestUtils::get_lock_mode_name (CosConcurrencyControl::lock_mode mode)
+{
+ if (mode==CosConcurrencyControl::read)
+ return const_cast<char*> ("read");
+
+ if (mode==CosConcurrencyControl::write)
+ return const_cast<char*> ("write");
+
+ if (mode==CosConcurrencyControl::upgrade)
+ return const_cast<char*> ("upgrade");
+
+ if (mode==CosConcurrencyControl::intention_read)
+ return const_cast<char*> ("intention_read");
+
+ if (mode==CosConcurrencyControl::intention_write)
+ return const_cast<char*> ("intention_write");
+
+ return const_cast<char*> ("unknown lock mode");
+}
+
+CosConcurrencyControl::LockSet_ptr
+CC_TestUtils::create_lock_set (void)
+{
+ // Create the lock set and return an obj ref corresponding to the
+ // key.
+ CosConcurrencyControl::LockSet_ptr lock_set(0);
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ lock_set =
+ CC_naming_service::Instance()->get_lock_set_factory ()->create (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (lock_set))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "null lock set objref returned by factory\n"),
+ 0);
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "CC_Client::create_lock_set");
+ return 0;
+ }
+ ACE_ENDTRY;
+ return lock_set;
+}
diff --git a/TAO/orbsvcs/tests/Concurrency/CC_test_utils.h b/TAO/orbsvcs/tests/Concurrency/CC_test_utils.h
new file mode 100644
index 00000000000..4c1a643f863
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/CC_test_utils.h
@@ -0,0 +1,37 @@
+/* -*- C++ -*- */
+// $Id$
+// ============================================================================
+//
+// = LIBRARY
+// TAO/orbsvcs/tests
+//
+// = FILENAME
+// CC_test_utils.h
+//
+// = DESCRIPTION
+// This class provides a namespace for utility functions for the
+// concurrency service test.
+//
+// = AUTHORS
+// Torben Worm <tworm@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "orbsvcs/CosConcurrencyControlC.h"
+
+#ifndef _CC_TEST_UTILS_H_
+#define _CC_TEST_UTILS_H_
+
+class CC_TestUtils
+{
+ public:
+ static char *get_lock_mode_name (CosConcurrencyControl::lock_mode mode);
+ // Function to return a human readable string from a lock_mode enum.
+
+ static CosConcurrencyControl::LockSet_ptr create_lock_set (void);
+ // Creates a lock set by means of th lock set factory in the concurrency
+ // service server.
+ private:
+};
+
+#endif /* _CC_TEST_UTILS_H_ */
diff --git a/TAO/orbsvcs/tests/Concurrency/CC_tests.cpp b/TAO/orbsvcs/tests/Concurrency/CC_tests.cpp
new file mode 100644
index 00000000000..5dfccef2eb5
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/CC_tests.cpp
@@ -0,0 +1,388 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/Concurrency
+//
+// = FILENAME
+// CC_tests.h
+//
+// = DESCRIPTION
+// This class implements a number of test objects to test the
+// concurrency service.
+//
+// = AUTHORS
+// Torben Worm <tworm@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "CC_tests.h"
+#include "ace/OS.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID(Concurrency, CC_tests, "$Id$")
+
+CC_Test::CC_Test (CC_naming_service *ns)
+ : result (CC_FAIL),
+ naming_service_ (ns)
+{
+}
+
+CC_Test::~CC_Test (void)
+{
+}
+
+CosConcurrencyControl::LockSet_ptr
+CC_Test::create_lock_set (void)
+{
+ // Create the lock set and return an obj ref corresponding to the
+ // key.
+ CosConcurrencyControl::LockSet_ptr lock_set(0);
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ lock_set =
+ this->naming_service_->get_lock_set_factory ()->create (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (lock_set))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "null lock set objref returned by factory\n"),
+ 0);
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "CC_Client::create_lock_set");
+ return 0;
+ }
+ ACE_ENDTRY;
+ return lock_set;
+}
+
+char *
+CC_Test::get_lock_mode_name (CosConcurrencyControl::lock_mode mode)
+{
+ if (mode==CosConcurrencyControl::read)
+ return const_cast<char *> ("read");
+
+ if (mode==CosConcurrencyControl::write)
+ return const_cast<char *> ("write");
+
+ if (mode==CosConcurrencyControl::upgrade)
+ return const_cast<char *> ("upgrade");
+
+ if (mode==CosConcurrencyControl::intention_read)
+ return const_cast<char *> ("intension_read");
+
+ if (mode==CosConcurrencyControl::intention_write)
+ return const_cast<char *> ("intension_write");
+
+ return const_cast<char *> ("unknown lock mode");
+}
+
+// ================================
+// Here the tests start.
+
+Test_Single_Lock_With_Mode::Test_Single_Lock_With_Mode (CC_naming_service *naming_service,
+ CosConcurrencyControl::lock_mode mode)
+ : CC_Test (naming_service),
+ mode_ (mode)
+{
+}
+
+Test_Single_Lock_With_Mode::~Test_Single_Lock_With_Mode (void)
+{
+}
+
+int
+Test_Single_Lock_With_Mode::run (int /* times_to_run */)
+{
+ CORBA::Boolean lock_not_held;
+
+ CosConcurrencyControl::LockSet_ptr cc_lock_set_ = create_lock_set ();
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ cc_lock_set_->lock (mode_ ACE_ENV_ARG_PARAMETER);
+
+ ACE_TRY_CHECK;
+ ACE_DEBUG ((LM_DEBUG,
+ "%s lock set\n",
+ get_lock_mode_name (mode_)));
+
+ lock_not_held = cc_lock_set_->try_lock (mode_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (lock_not_held)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "%s lock not held\n",
+ get_lock_mode_name (mode_)));
+ return CC_FAIL;
+ }
+ else
+ ACE_DEBUG ((LM_DEBUG,
+ "%s lock held\n",
+ get_lock_mode_name (mode_)));
+
+ cc_lock_set_->unlock (mode_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_DEBUG ((LM_DEBUG,
+ "%s lock released\n",
+ get_lock_mode_name (mode_)));
+
+ lock_not_held = cc_lock_set_->try_lock (mode_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (lock_not_held)
+ ACE_DEBUG ((LM_DEBUG,
+ "%s lock not held\n",
+ get_lock_mode_name (mode_)));
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "%s lock held\n",
+ get_lock_mode_name (mode_)));
+ return CC_FAIL;
+ }
+
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Test_Single_Lock_With_Mode::run");
+ return CC_FAIL;
+ }
+ ACE_ENDTRY;
+
+ CORBA::release (cc_lock_set_);
+
+ return CC_SUCCESS;
+}
+
+// ================================
+
+Test_Setup_LockSet::Test_Setup_LockSet (CC_naming_service *naming_service,
+ char *name)
+ : CC_Test (naming_service),
+ my_name_ (name)
+{
+}
+
+Test_Setup_LockSet::~Test_Setup_LockSet (void)
+{
+}
+
+int
+Test_Setup_LockSet::run (int /* times_to_run */)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ CosConcurrencyControl::LockSet_ptr cc_lock_set_ =
+ create_lock_set ();
+ this->naming_service_->bind_name (my_name_, cc_lock_set_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG,
+ "Name bound\n"));
+
+ cc_lock_set_->lock (CosConcurrencyControl::read
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG,
+ "Read lock set\n"));
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Test_Against_Other_LockSet::run");
+ return CC_FAIL;
+ }
+ ACE_ENDTRY;
+
+ return CC_SUCCESS;
+}
+
+// ================================
+
+Test_Use_Already_Created_LockSet::
+Test_Use_Already_Created_LockSet (CC_naming_service *naming_service,
+ char *name)
+ : CC_Test (naming_service),
+ my_name_ (name)
+{
+}
+
+Test_Use_Already_Created_LockSet::~Test_Use_Already_Created_LockSet (void)
+{
+}
+
+int
+Test_Use_Already_Created_LockSet::run (int /* times_to_run */)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ CORBA::Object_var ccls_obj =
+ this->naming_service_->get_obj_from_name (const_cast<char *> (""),
+ my_name_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CosConcurrencyControl::LockSet_var ccls =
+ CosConcurrencyControl::LockSet::_narrow (ccls_obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ccls->lock (CosConcurrencyControl::read
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Test_Against_Other_LockSet::run");
+ return CC_FAIL;
+ }
+ ACE_ENDTRY;
+
+ return CC_SUCCESS;
+}
+
+// ================================
+
+Test_Unlock_Already_Created_LockSet::
+Test_Unlock_Already_Created_LockSet (CC_naming_service *naming_service,
+ char *name)
+ : CC_Test (naming_service),
+ my_name_ (name)
+{
+}
+
+Test_Unlock_Already_Created_LockSet::~Test_Unlock_Already_Created_LockSet (void)
+{
+}
+
+int
+Test_Unlock_Already_Created_LockSet::run (int /* times_to_run */)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ CORBA::Object_var ccls_obj =
+ this->naming_service_->get_obj_from_name (const_cast<char *> (""), my_name_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CosConcurrencyControl::LockSet_var ccls =
+ CosConcurrencyControl::LockSet::_narrow (ccls_obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ccls->unlock (CosConcurrencyControl::read
+ ACE_ENV_ARG_PARAMETER);
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Test_Unlock_Already_Created_LockSet::run");
+ return CC_FAIL;
+ }
+ ACE_ENDTRY;
+
+ return CC_SUCCESS;
+}
+
+// ================================
+
+Test_Release_Not_Held_Lock::Test_Release_Not_Held_Lock (CC_naming_service *naming_service,
+ CosConcurrencyControl::lock_mode mode)
+ : CC_Test (naming_service),
+ mode_ (mode)
+{
+}
+
+Test_Release_Not_Held_Lock::~Test_Release_Not_Held_Lock (void)
+{
+}
+
+int
+Test_Release_Not_Held_Lock::run (int /* times_to_run */)
+{
+ CORBA::Boolean lock_not_held;
+
+ // Create the lock set
+ CosConcurrencyControl::LockSet_ptr cc_lock_set_ = create_lock_set ();
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ // lock the lock
+ cc_lock_set_->lock (mode_ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG,
+ "%s lock set\n",
+ get_lock_mode_name (mode_)));
+
+ // check to see if the lock is held
+ lock_not_held = cc_lock_set_->try_lock (mode_
+ ACE_ENV_ARG_PARAMETER);
+
+ if (lock_not_held)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "%s lock not held\n",
+ get_lock_mode_name (mode_)));
+ return CC_FAIL;
+ }
+ else
+ ACE_DEBUG ((LM_DEBUG,
+ "%s lock held\n",
+ get_lock_mode_name (mode_)));
+
+ // release the lock
+ cc_lock_set_->unlock (mode_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_DEBUG ((LM_DEBUG,
+ "%s lock released\n",
+ get_lock_mode_name (mode_)));
+
+ // release the lock again. this should raise an exception
+ cc_lock_set_->unlock (mode_
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_DEBUG ((LM_DEBUG,
+ "attemptet to release %s lock\n",
+ get_lock_mode_name (mode_)));
+
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH(CosConcurrencyControl::LockNotHeld, userex)
+ {
+ // We should end here
+ ACE_UNUSED_ARG (userex);
+ ACE_DEBUG((LM_DEBUG, "CosConcurrencyControl::LockNotHeld\n"));
+ return CC_SUCCESS;
+ }
+
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Test_Release_Not_Held_Lock::run");
+ return CC_FAIL;
+ }
+ ACE_ENDTRY;
+
+ CORBA::release (cc_lock_set_);
+
+ return CC_FAIL;
+}
diff --git a/TAO/orbsvcs/tests/Concurrency/CC_tests.h b/TAO/orbsvcs/tests/Concurrency/CC_tests.h
new file mode 100644
index 00000000000..9f0083fd2ad
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/CC_tests.h
@@ -0,0 +1,183 @@
+// -*- c++ -*-
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/Concurrency
+//
+// = FILENAME
+// CC_tests.h
+//
+// = DESCRIPTION
+// This class implements a number of test objects to test the
+// concurrency service.
+//
+// = AUTHORS
+// Torben Worm <tworm@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "orbsvcs/CosConcurrencyControlC.h"
+#include "orbsvcs/CosNamingC.h"
+#include "CC_naming_service.h"
+
+#ifndef _CC_TESTS_H_
+#define _CC_TESTS_H_
+
+// Return codes for the tests
+enum
+{
+ CC_FAIL,
+ CC_SUCCESS = 1
+};
+
+class CC_Test
+{
+ // = TITLE
+ // Defines an abstract base class for a test
+ //
+ // = DESCRIPTION
+ // This class declares an interface to run the test of the
+ // concurrency service.
+public:
+ CC_Test (CC_naming_service *ns);
+ // Default constructor
+
+ virtual ~CC_Test (void);
+ // Destructor
+
+ virtual int run (int times_to_run = 1) = 0;
+ // Run the test times_to_run number of times. Returns CC_SUCCESS on
+ // success CC_FAIL otherwise.
+
+ CosConcurrencyControl::LockSet_ptr create_lock_set (void);
+ // Create a new lock set using the default global lock set factory
+ // from the naming service.
+
+ char *get_lock_mode_name (CosConcurrencyControl::lock_mode mode);
+ // Returns a human readable string from the lock mode enum.
+
+protected:
+ int result;
+ // The result of the test being performed.
+
+ CC_naming_service *naming_service_;
+ // The naming service beeing used to register and look up locks
+};
+
+class Test_Single_Lock_With_Mode : public CC_Test
+{
+ // = TITLE
+ // This is a simple test that checks that it is possible to set
+ // the lock in the desired mode, try it, and release it.
+public:
+ Test_Single_Lock_With_Mode (CC_naming_service *naming_service,
+ CosConcurrencyControl::lock_mode mode);
+ // Default constructor. The naming service must be initialized
+ // before calling this method. The mode is the mode of the lock to
+ // be tested.
+
+ virtual ~Test_Single_Lock_With_Mode (void);
+ // Destructor
+
+ virtual int run (int times_to_run = 1);
+ // Runs the test the specified number of times.
+
+private:
+ CosConcurrencyControl::lock_mode mode_;
+ // The lock mode of the lock being tested
+};
+
+class Test_Setup_LockSet : public CC_Test
+{
+ // = TITLE
+ // This class creates a read lock, registeres it with the naming
+ // service and locks it.
+public:
+ Test_Setup_LockSet (CC_naming_service *naming_service_,
+ char *name);
+ // Default constructor. The naming service must be initialized
+ // before calling this method. The name is the name the lock will be
+ // registered under in the naming service.
+
+ virtual ~Test_Setup_LockSet (void);
+ // Destructor
+
+ virtual int run (int times_to_run = 1);
+ // Runs the test the specified number of times.
+
+private:
+ char *my_name_;
+ // The name of the lock
+};
+
+class Test_Use_Already_Created_LockSet : public CC_Test
+{
+ // = TITLE
+ // This class looks up the lock in the naming service and locks
+ // it.
+public:
+ Test_Use_Already_Created_LockSet (CC_naming_service *naming_service_,
+ char *name);
+ // Default constructor. The naming service must be initialized
+ // before calling this method. The name is the name the lock will be
+ // looked up under in the naming service.
+
+ virtual ~Test_Use_Already_Created_LockSet (void);
+ // Destructor
+
+ virtual int run (int times_to_run = 1);
+ // Runs the test the specified number of times.
+
+private:
+ char *my_name_;
+ // The name of the lock
+};
+
+class Test_Unlock_Already_Created_LockSet : public CC_Test
+{
+ // = TITLE
+ // This class looks up the lock in the naming service and unlocks
+ // it.
+public:
+ Test_Unlock_Already_Created_LockSet (CC_naming_service *naming_service_,
+ char *name);
+ // Default constructor. The naming service must be initialized
+ // before calling this method. The name is the name the lock will be
+ // looked up under in the naming service.
+
+ virtual ~Test_Unlock_Already_Created_LockSet (void);
+ // Destructor
+
+ virtual int run (int times_to_run = 1);
+ // Runs the test the specified number of times.
+
+private:
+ char *my_name_;
+ // The name of the lock
+};
+
+class Test_Release_Not_Held_Lock : public CC_Test
+{
+ // = TITLE
+ // This class tests that the LockNotHeld exception is thrown if a
+ // not held lock is released.
+public:
+ Test_Release_Not_Held_Lock (CC_naming_service *naming_service_,
+ CosConcurrencyControl::lock_mode mode_);
+ // Default constructor. The naming service must be initialized
+ // before calling this method. The mode is the mode of the lock
+
+ virtual ~Test_Release_Not_Held_Lock (void);
+ // Destructor
+
+ virtual int run (int times_to_run = 1);
+ // Runs the test the specified number of times.
+
+private:
+ CosConcurrencyControl::lock_mode mode_;
+ // The lock mode of the lock being tested
+};
+
+#endif /* !defined (_CC_TESTS_H_) */
diff --git a/TAO/orbsvcs/tests/Concurrency/Concurrency.mpc b/TAO/orbsvcs/tests/Concurrency/Concurrency.mpc
new file mode 100644
index 00000000000..e2242dffa83
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/Concurrency.mpc
@@ -0,0 +1,6 @@
+// -*- MPC -*-
+// $Id$
+
+project(CC client) : orbsvcsexe, concurrency, naming, svc_utils, iortable, portableserver {
+ exename = CC_client
+}
diff --git a/TAO/orbsvcs/tests/Concurrency/Makefile.am b/TAO/orbsvcs/tests/Concurrency/Makefile.am
new file mode 100644
index 00000000000..d73d8319cc3
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/Makefile.am
@@ -0,0 +1,59 @@
+## Process this file with automake to create Makefile.in
+##
+## $Id$
+##
+## This file was generated by MPC. Any changes made directly to
+## this file will be lost the next time it is generated.
+##
+## MPC Command:
+## ../bin/mwc.pl -type automake -noreldefs TAO.mwc
+
+ACE_BUILDDIR = $(top_builddir)/..
+ACE_ROOT = $(top_srcdir)/..
+TAO_BUILDDIR = $(top_builddir)
+TAO_ROOT = $(top_srcdir)
+
+## Makefile.CC_client.am
+
+noinst_PROGRAMS = CC_client
+
+CC_client_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -I$(TAO_ROOT)/orbsvcs \
+ -I$(TAO_BUILDDIR)/orbsvcs
+
+CC_client_SOURCES = \
+ CC_client.cpp \
+ CC_command.cpp \
+ CC_command.tab.cpp \
+ CC_naming_service.cpp \
+ CC_test_utils.cpp \
+ CC_tests.cpp \
+ lex.CC_command.cpp \
+ CC_client.h \
+ CC_command.h \
+ CC_command.tab.h \
+ CC_naming_service.h \
+ CC_test_utils.h \
+ CC_tests.h
+
+CC_client_LDADD = \
+ $(TAO_BUILDDIR)/tao/libTAO_IORTable.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_Svc_Utils.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosConcurrency.la \
+ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+## Clean up template repositories, etc.
+clean-local:
+ -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
+ -rm -f gcctemp.c gcctemp so_locations *.ics
+ -rm -rf cxx_repository ptrepository ti_files
+ -rm -rf templateregistry ir.out
+ -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/TAO/orbsvcs/tests/Concurrency/README b/TAO/orbsvcs/tests/Concurrency/README
new file mode 100644
index 00000000000..07fd0ced426
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/README
@@ -0,0 +1,111 @@
+$Id$
+
+This is the readme file for the tests of the concurrency service.
+
+The test program has been changed to use a configuration file instead of
+hard coded test procedures. The old test procedures are left in the
+program for backwards compatibility, but they will be removed at a later
+point in time.
+
+The description of the old tests is in the readme file for the
+concurrency service in the directory:
+ $TAO_ROOT/orbsvcs/Concurrency_Control
+please consult this file for a decription of these tests.
+
+The new tests are described by this simle test language:
+
+start: /* empty */
+ | cmd_list
+ ;
+
+cmd_list: cmd_list cmd
+ | cmd
+ ;
+
+cmd: start <config_file_name> ;
+ | create <lock_set_name> ;
+ | create ;
+ | lock <lock_set_name> <lock_mode> ;
+ | lock <lock_mode> ;
+ | unlock <lock_set_name> <lock_mode> ;
+ | unlock <lock_mode> ;
+ | try_lock <lock_set_name> <lock_mode> ;
+ | try_lock <lock_mode> ;
+ | change_mode <lock_set_name> <lock_mode> <lock_mode> ;
+ | change_mode <lock_mode> <lock_mode> ;
+ | lookup <lock_set_name> ;
+ | sleep <int> ;
+ | repeat <int> ;
+ | wait ;
+ | wait <prompt> ;
+ ;
+
+lock_mode: read | intention_read | upgrade | write | intention_write
+
+prompt: " string "
+
+If the lock set name is left out the default lock set is used. The
+repeat command just sets a global variable in the test, i.e. the last
+repeat command is the one that will take effect - the whole script is
+run the specified number of times.
+
+An example of a script (assuming it's called 'test.cfg' - comments are
+not supported):
+
+ // Start a new CC_client with test.txt as script file
+ start test.txt;
+ // Create the lock set "ls1" and register it in the naming service
+ create ls1;
+ // Lock the read lock in the lock set
+ lock ls1 read;
+ // Try the read lock
+ try_lock ls1 read;
+ // sleep two seconds
+ sleep 2;
+ // Wait for the user to press enter
+ wait;
+ // Unlock the read lock in the ls1 lock set
+ unlock ls1 read;
+ // Change the mode of the read lock in the ls1 lock set to write mode
+ change_mode ls1 read write;
+
+The test can be run with the command ./CC_client -c test.cfg.
+
+There are currentlig the following tests in the
+ $TAO_ROOT/orbsvcs/tests/Concurrency
+directory:
+ basic_tests.cfg The same as running ./CC_client -b
+ extended_tests.cfg The same as running ./CC_client -e '1;test'
+ ./CC_client -e '2;test'
+ ./CC_client -e '3;test'
+ test.dinphil Dining philosophers. Uses test.phil[1-5]
+
+----------------------------------------
+
+THE IMPLEMENTATION
+
+The implementation of the concurrency service tests is located in
+the $TAO_ROOT/orbsvcs/tests/Concurrency directory and consists of
+the following files:
+
+ CC_client.{h,cpp} contain initialization and the main function.
+
+ CC_tests.{h,cpp} The old tests [-b] and [-e] options to CC_client
+
+ CC_command.{h,cpp} The commands that can be used in the scripting
+ language are implemented in these files. The list of
+ commands to execute is also implemented here.
+
+ CC_command.l The lex file for the script language.
+
+ CC_command.y The yacc file for the script language.
+
+ CC_command.tab.{h,cpp} and lex.CC_command.cpp Derived files from
+ the lex and yacc files.
+
+ CC_naming_service.{h,cpp} A wrapper class around the necessary
+ naming service functinallity for the tests.
+
+ CC_test_utils.{h,cpp} provides a namespace for utility functions.
+
+ test.* Test scripts for the concurrency service. \ No newline at end of file
diff --git a/TAO/orbsvcs/tests/Concurrency/lex.CC_command.cpp b/TAO/orbsvcs/tests/Concurrency/lex.CC_command.cpp
new file mode 100644
index 00000000000..d301a466f67
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/lex.CC_command.cpp
@@ -0,0 +1,1702 @@
+// $Id$
+/* A lexical scanner generated by flex */
+
+/* Scanner skeleton version:
+ * Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp
+ */
+
+#define FLEX_SCANNER
+#define ACE_CC_YY_FLEX_MAJOR_VERSION 2
+#define ACE_CC_YY_FLEX_MINOR_VERSION 5
+
+#include "ace/OS_NS_string.h"
+
+
+/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
+#ifdef c_plusplus
+#ifndef __cplusplus
+#define __cplusplus
+#endif
+#endif
+
+
+#ifdef __cplusplus
+
+#include /**/ <stdlib.h>
+
+/* Use prototypes in function declarations. */
+#define ACE_CC_YY_USE_PROTOS
+
+/* The "const" storage-class-modifier is valid. */
+#define ACE_CC_YY_USE_CONST
+
+#else /* ! __cplusplus */
+
+#if __STDC__
+
+#define ACE_CC_YY_USE_PROTOS
+#define ACE_CC_YY_USE_CONST
+
+#endif /* __STDC__ */
+#endif /* ! __cplusplus */
+
+#ifdef __TURBOC__
+ #pragma warn -rch
+ #pragma warn -use
+#include /**/ <io.h>
+#include /**/ <stdlib.h>
+#define ACE_CC_YY_USE_CONST
+#define ACE_CC_YY_USE_PROTOS
+#endif
+
+#ifdef ACE_CC_YY_USE_CONST
+#define ace_cc_yyconst const
+#else
+#define ace_cc_yyconst
+#endif
+
+
+#ifdef ACE_CC_YY_USE_PROTOS
+#define ACE_CC_YY_PROTO(proto) proto
+#else
+#define ACE_CC_YY_PROTO(proto) ()
+#endif
+
+/* Returned upon end-of-file. */
+#define ACE_CC_YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index. If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define ACE_CC_YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN ace_cc_yy_start = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The ACE_CC_YYSTATE alias is for lex
+ * compatibility.
+ */
+#define ACE_CC_YY_START ((ace_cc_yy_start - 1) / 2)
+#define ACE_CC_YYSTATE ACE_CC_YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define ACE_CC_YY_STATE_EOF(state) (ACE_CC_YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define ACE_CC_YY_NEW_FILE ace_cc_yyrestart( ace_cc_yyin )
+
+#define ACE_CC_YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#define ACE_CC_YY_BUF_SIZE 16384
+
+typedef struct ace_cc_yy_buffer_state *ACE_CC_YY_BUFFER_STATE;
+
+extern int ace_cc_yyleng;
+extern FILE *ace_cc_yyin, *ace_cc_yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+/* The funky do-while in the following #define is used to turn the definition
+ * int a single C statement (which needs a semi-colon terminator). This
+ * avoids problems with code like:
+ *
+ * if ( condition_holds )
+ * ace_cc_yyless( 5 );
+ * else
+ * do_something_else();
+ *
+ * Prior to using the do-while the compiler would get upset at the
+ * "else" because it interpreted the "if" statement as being all
+ * done when it reached the ';' after the ace_cc_yyless() call.
+ */
+
+/* Return all but the first 'n' matched characters back to the input stream. */
+
+#define ace_cc_yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up ace_cc_yytext. */ \
+ *ace_cc_yy_cp = ace_cc_yy_hold_char; \
+ ACE_CC_YY_RESTORE_ACE_CC_YY_MORE_OFFSET \
+ ace_cc_yy_c_buf_p = ace_cc_yy_cp = ace_cc_yy_bp + n - ACE_CC_YY_MORE_ADJ; \
+ ACE_CC_YY_DO_BEFORE_ACTION; /* set up ace_cc_yytext again */ \
+ } \
+ while ( 0 )
+
+#define unput(c) ace_cc_yyunput( c, ace_cc_yytext_ptr )
+
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ */
+typedef unsigned int ace_cc_yy_size_t;
+
+
+struct ace_cc_yy_buffer_state
+ {
+ FILE *ace_cc_yy_input_file;
+
+ char *ace_cc_yy_ch_buf; /* input buffer */
+ char *ace_cc_yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ ace_cc_yy_size_t ace_cc_yy_buf_size;
+
+ /* Number of characters read into ace_cc_yy_ch_buf, not including EOB
+ * characters.
+ */
+ int ace_cc_yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int ace_cc_yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int ace_cc_yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int ace_cc_yy_at_bol;
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int ace_cc_yy_fill_buffer;
+
+ int ace_cc_yy_buffer_status;
+#define ACE_CC_YY_BUFFER_NEW 0
+#define ACE_CC_YY_BUFFER_NORMAL 1
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as ACE_CC_YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via ace_cc_yyrestart()), so that the user can continue scanning by
+ * just pointing ace_cc_yyin at a new input file.
+ */
+#define ACE_CC_YY_BUFFER_EOF_PENDING 2
+ };
+
+static ACE_CC_YY_BUFFER_STATE ace_cc_yy_current_buffer = 0;
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ */
+#define ACE_CC_YY_CURRENT_BUFFER ace_cc_yy_current_buffer
+
+
+/* ace_cc_yy_hold_char holds the character lost when ace_cc_yytext is formed. */
+static char ace_cc_yy_hold_char;
+
+static int ace_cc_yy_n_chars; /* number of characters read into ace_cc_yy_ch_buf */
+
+
+int ace_cc_yyleng;
+
+/* Points to current character in buffer. */
+static char *ace_cc_yy_c_buf_p = (char *) 0;
+static int ace_cc_yy_init = 1; /* whether we need to initialize */
+static int ace_cc_yy_start = 0; /* start state number */
+
+#define ace_cc_yywrap() 1
+/* Flag which is used to allow ace_cc_yywrap()'s to do buffer switches
+ * instead of setting up a fresh ace_cc_yyin. A bit of a hack ...
+ */
+#if (ace_cc_yywrap() != 1)
+static int ace_cc_yy_did_buffer_switch_on_eof;
+#endif
+
+void ace_cc_yyrestart ACE_CC_YY_PROTO(( FILE *input_file ));
+
+void ace_cc_yy_switch_to_buffer ACE_CC_YY_PROTO(( ACE_CC_YY_BUFFER_STATE new_buffer ));
+void ace_cc_yy_load_buffer_state ACE_CC_YY_PROTO(( void ));
+ACE_CC_YY_BUFFER_STATE ace_cc_yy_create_buffer ACE_CC_YY_PROTO(( FILE *file, int size ));
+void ace_cc_yy_delete_buffer ACE_CC_YY_PROTO(( ACE_CC_YY_BUFFER_STATE b ));
+void ace_cc_yy_init_buffer ACE_CC_YY_PROTO(( ACE_CC_YY_BUFFER_STATE b, FILE *file ));
+void ace_cc_yy_flush_buffer ACE_CC_YY_PROTO(( ACE_CC_YY_BUFFER_STATE b ));
+#define ACE_CC_YY_FLUSH_BUFFER ace_cc_yy_flush_buffer( ace_cc_yy_current_buffer )
+
+ACE_CC_YY_BUFFER_STATE ace_cc_yy_scan_buffer ACE_CC_YY_PROTO(( char *base, ace_cc_yy_size_t size ));
+ACE_CC_YY_BUFFER_STATE ace_cc_yy_scan_string ACE_CC_YY_PROTO(( ace_cc_yyconst char *ace_cc_yy_str ));
+ACE_CC_YY_BUFFER_STATE ace_cc_yy_scan_bytes ACE_CC_YY_PROTO(( ace_cc_yyconst char *bytes, int len ));
+
+static void *ace_cc_yy_flex_alloc ACE_CC_YY_PROTO(( ace_cc_yy_size_t ));
+static void *ace_cc_yy_flex_realloc ACE_CC_YY_PROTO(( void *, ace_cc_yy_size_t ));
+static void ace_cc_yy_flex_free ACE_CC_YY_PROTO(( void * ));
+
+#define ace_cc_yy_new_buffer ace_cc_yy_create_buffer
+
+#define ace_cc_yy_set_interactive(is_interactive) \
+ { \
+ if ( ! ace_cc_yy_current_buffer ) \
+ ace_cc_yy_current_buffer = ace_cc_yy_create_buffer( ace_cc_yyin, ACE_CC_YY_BUF_SIZE ); \
+ ace_cc_yy_current_buffer->ace_cc_yy_is_interactive = is_interactive; \
+ }
+
+#define ace_cc_yy_set_bol(at_bol) \
+ { \
+ if ( ! ace_cc_yy_current_buffer ) \
+ ace_cc_yy_current_buffer = ace_cc_yy_create_buffer( ace_cc_yyin, ACE_CC_YY_BUF_SIZE ); \
+ ace_cc_yy_current_buffer->ace_cc_yy_at_bol = at_bol; \
+ }
+
+#define ACE_CC_YY_AT_BOL() (ace_cc_yy_current_buffer->ace_cc_yy_at_bol)
+
+
+#define ACE_CC_YY_SKIP_ACE_CC_YYWRAP
+typedef unsigned char ACE_CC_YY_CHAR;
+FILE *ace_cc_yyin = (FILE *) 0, *ace_cc_yyout = (FILE *) 0;
+typedef int ace_cc_yy_state_type;
+extern char *ace_cc_yytext;
+#define ace_cc_yytext_ptr ace_cc_yytext
+
+static ace_cc_yy_state_type ace_cc_yy_get_previous_state ACE_CC_YY_PROTO(( void ));
+static ace_cc_yy_state_type ace_cc_yy_try_NUL_trans ACE_CC_YY_PROTO(( ace_cc_yy_state_type current_state ));
+static int ace_cc_yy_get_next_buffer ACE_CC_YY_PROTO(( void ));
+static void ace_cc_yy_fatal_error ACE_CC_YY_PROTO(( ace_cc_yyconst char msg[] ));
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up ace_cc_yytext.
+ */
+#define ACE_CC_YY_DO_BEFORE_ACTION \
+ ace_cc_yytext_ptr = ace_cc_yy_bp; \
+ ace_cc_yyleng = (int) (ace_cc_yy_cp - ace_cc_yy_bp); \
+ ace_cc_yy_hold_char = *ace_cc_yy_cp; \
+ *ace_cc_yy_cp = '\0'; \
+ ace_cc_yy_c_buf_p = ace_cc_yy_cp;
+
+#define ACE_CC_YY_NUM_RULES 25
+#define ACE_CC_YY_END_OF_BUFFER 26
+static ace_cc_yyconst short int ace_cc_yy_accept[124] =
+ { 0,
+ 0, 0, 26, 25, 24, 23, 25, 20, 1, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 25, 24, 23, 0, 19, 20, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 0, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 0, 22,
+ 21, 21, 21, 21, 4, 21, 21, 14, 21, 21,
+ 21, 21, 21, 21, 9, 21, 21, 21, 21, 21,
+ 21, 10, 21, 8, 2, 21, 21, 21, 17, 21,
+ 3, 21, 21, 13, 11, 21, 5, 21, 21, 21,
+
+ 21, 21, 16, 21, 21, 21, 6, 21, 12, 21,
+ 21, 21, 7, 21, 21, 21, 21, 21, 21, 15,
+ 21, 18, 0
+ } ;
+
+static ace_cc_yyconst int ace_cc_yy_ec[256] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 3, 1, 4, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 5, 6, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 5, 8, 1,
+ 1, 1, 1, 1, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 1, 1, 1, 1, 10, 1, 11, 9, 12, 13,
+
+ 14, 9, 15, 16, 17, 9, 18, 19, 20, 21,
+ 22, 23, 9, 24, 25, 26, 27, 9, 28, 29,
+ 30, 9, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1
+ } ;
+
+static ace_cc_yyconst int ace_cc_yy_meta[31] =
+ { 0,
+ 1, 2, 1, 1, 3, 3, 3, 1, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
+ } ;
+
+static ace_cc_yyconst short int ace_cc_yy_base[128] =
+ { 0,
+ 0, 136, 141, 143, 0, 137, 135, 131, 143, 0,
+ 15, 108, 115, 113, 110, 119, 14, 108, 11, 24,
+ 125, 0, 127, 125, 124, 120, 0, 115, 111, 112,
+ 97, 24, 105, 26, 107, 109, 89, 99, 102, 99,
+ 98, 112, 92, 101, 97, 96, 91, 90, 86, 93,
+ 91, 90, 79, 92, 79, 76, 73, 72, 95, 143,
+ 81, 69, 71, 72, 0, 65, 65, 0, 79, 66,
+ 62, 68, 74, 74, 0, 70, 69, 68, 55, 54,
+ 56, 0, 52, 0, 0, 55, 58, 62, 0, 64,
+ 0, 56, 55, 0, 0, 59, 0, 56, 49, 46,
+
+ 45, 48, 0, 43, 43, 42, 0, 49, 0, 51,
+ 46, 14, 0, 45, 30, 40, 30, 32, 18, 0,
+ 29, 0, 143, 49, 52, 38, 55
+ } ;
+
+static ace_cc_yyconst short int ace_cc_yy_def[128] =
+ { 0,
+ 123, 1, 123, 123, 124, 123, 125, 123, 123, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 123, 124, 123, 125, 125, 123, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 127, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 127, 123,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 0, 123, 123, 123, 123
+ } ;
+
+static ace_cc_yyconst short int ace_cc_yy_nxt[174] =
+ { 0,
+ 4, 5, 6, 7, 4, 4, 8, 9, 10, 4,
+ 10, 11, 10, 12, 10, 10, 13, 10, 14, 10,
+ 10, 10, 15, 16, 17, 18, 19, 20, 10, 10,
+ 28, 38, 35, 39, 40, 47, 50, 114, 29, 36,
+ 27, 115, 122, 121, 120, 48, 119, 41, 51, 22,
+ 118, 22, 24, 117, 24, 59, 59, 59, 116, 113,
+ 112, 111, 110, 109, 108, 107, 106, 105, 104, 103,
+ 102, 101, 100, 99, 98, 97, 96, 95, 94, 93,
+ 92, 91, 90, 89, 88, 87, 86, 85, 84, 83,
+ 82, 81, 80, 79, 78, 77, 60, 76, 75, 74,
+
+ 73, 72, 71, 70, 69, 68, 67, 66, 65, 64,
+ 63, 62, 61, 60, 58, 57, 56, 55, 54, 53,
+ 52, 49, 46, 45, 44, 43, 26, 25, 25, 23,
+ 42, 37, 34, 33, 32, 31, 30, 26, 25, 23,
+ 123, 21, 3, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123
+ } ;
+
+static ace_cc_yyconst short int ace_cc_yy_chk[174] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 11, 19, 17, 19, 20, 32, 34, 112, 11, 17,
+ 126, 112, 121, 119, 118, 32, 117, 20, 34, 124,
+ 116, 124, 125, 115, 125, 127, 127, 127, 114, 111,
+ 110, 108, 106, 105, 104, 102, 101, 100, 99, 98,
+ 96, 93, 92, 90, 88, 87, 86, 83, 81, 80,
+ 79, 78, 77, 76, 74, 73, 72, 71, 70, 69,
+ 67, 66, 64, 63, 62, 61, 59, 58, 57, 56,
+
+ 55, 54, 53, 52, 51, 50, 49, 48, 47, 46,
+ 45, 44, 43, 42, 41, 40, 39, 38, 37, 36,
+ 35, 33, 31, 30, 29, 28, 26, 25, 24, 23,
+ 21, 18, 16, 15, 14, 13, 12, 8, 7, 6,
+ 3, 2, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123
+ } ;
+
+static ace_cc_yy_state_type ace_cc_yy_last_accepting_state;
+static char *ace_cc_yy_last_accepting_cpos;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define ace_cc_yymore() ace_cc_yymore_used_but_not_detected
+#define ACE_CC_YY_MORE_ADJ 0
+#define ACE_CC_YY_RESTORE_ACE_CC_YY_MORE_OFFSET
+char *ace_cc_yytext;
+#define INITIAL 0
+/* $Id$
+ * ============================================================================
+ *
+ * = LIBRARY
+ * TAO/orbsvcs/tests
+ *
+ * = FILENAME
+ * CC_command.l
+ *
+ * = DESCRIPTION
+ * This is the lex file for the concurrency service script language.
+ *
+ * = AUTHORS
+ * Torben Worm <tworm@cs.wustl.edu>
+ *
+ * ============================================================================
+ */
+#define ACE_CC_YY_NO_UNPUT 1
+#define ACE_CC_YY_NO_INPUT 1
+#define ACE_CC_YY_ALWAYS_INTERACTIVE 1
+#include "CC_command.h"
+#include "CC_command.tab.h"
+#include "ace/ACE.h"
+
+extern int line_no;
+extern char line_buf[500];
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef ACE_CC_YY_SKIP_ACE_CC_YYWRAP
+#ifdef __cplusplus
+extern "C" int ace_cc_yywrap ACE_CC_YY_PROTO(( void ));
+#else
+extern int ace_cc_yywrap ACE_CC_YY_PROTO(( void ));
+#endif
+#endif
+
+#ifndef ACE_CC_YY_NO_UNPUT
+static void ace_cc_yyunput ACE_CC_YY_PROTO(( int c, char *buf_ptr ));
+#endif
+
+#ifndef ace_cc_yytext_ptr
+static void ace_cc_yy_flex_strncpy ACE_CC_YY_PROTO(( char *, ace_cc_yyconst char *, int ));
+#endif
+
+#ifdef ACE_CC_YY_NEED_STRLEN
+static int ace_cc_yy_flex_strlen ACE_CC_YY_PROTO(( ace_cc_yyconst char * ));
+#endif
+
+#ifndef ACE_CC_YY_NO_INPUT
+#ifdef __cplusplus
+static int ace_cc_yyinput ACE_CC_YY_PROTO(( void ));
+#else
+static int input ACE_CC_YY_PROTO(( void ));
+#endif
+#endif
+
+#if ACE_CC_YY_STACK_USED
+static int ace_cc_yy_start_stack_ptr = 0;
+static int ace_cc_yy_start_stack_depth = 0;
+static int *ace_cc_yy_start_stack = 0;
+#ifndef ACE_CC_YY_NO_PUSH_STATE
+static void ace_cc_yy_push_state ACE_CC_YY_PROTO(( int new_state ));
+#endif
+#ifndef ACE_CC_YY_NO_POP_STATE
+static void ace_cc_yy_pop_state ACE_CC_YY_PROTO(( void ));
+#endif
+#ifndef ACE_CC_YY_NO_TOP_STATE
+static int ace_cc_yy_top_state ACE_CC_YY_PROTO(( void ));
+#endif
+
+#else
+#define ACE_CC_YY_NO_PUSH_STATE 1
+#define ACE_CC_YY_NO_POP_STATE 1
+#define ACE_CC_YY_NO_TOP_STATE 1
+#endif
+
+#ifdef ACE_CC_YY_MALLOC_DECL
+ACE_CC_YY_MALLOC_DECL
+#else
+#if __STDC__
+#ifndef __cplusplus
+#include /**/ <stdlib.h>
+#endif
+#else
+/* Just try to get by without declaring the routines. This will fail
+ * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
+ * or sizeof(void*) != sizeof(int).
+ */
+#endif
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef ACE_CC_YY_READ_BUF_SIZE
+#define ACE_CC_YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+
+#ifndef ACE_CC_ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ACE_CC_ECHO (void) fwrite( ace_cc_yytext, ace_cc_yyleng, 1, ace_cc_yyout )
+#endif
+
+/* Gets input and stuffs it into "buf". number of characters read, or ACE_CC_YY_NULL,
+ * is returned in "result".
+ */
+#ifndef ACE_CC_YY_INPUT
+#define ACE_CC_YY_INPUT(buf,result,max_size) \
+ if ( ace_cc_yy_current_buffer->ace_cc_yy_is_interactive ) \
+ { \
+ int c = '*', n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( ace_cc_yyin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+ if ( c == '\n' ) \
+ buf[n++] = (char) c; \
+ if ( c == EOF && ferror( ace_cc_yyin ) ) \
+ ACE_CC_YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ result = n; \
+ } \
+ else if ( ((result = fread( buf, 1, max_size, ace_cc_yyin )) == 0) \
+ && ferror( ace_cc_yyin ) ) \
+ ACE_CC_YY_FATAL_ERROR( "input in flex scanner failed" );
+#endif
+
+/* No semi-colon after return; correct usage is to write "ace_cc_yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef ace_cc_yyterminate
+#define ace_cc_yyterminate() return ACE_CC_YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef ACE_CC_YY_START_STACK_INCR
+#define ACE_CC_YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef ACE_CC_YY_FATAL_ERROR
+#define ACE_CC_YY_FATAL_ERROR(msg) ace_cc_yy_fatal_error( msg )
+#endif
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef ACE_CC_YY_DECL
+#define ACE_CC_YY_DECL int ace_cc_yylex ACE_CC_YY_PROTO(( void ))
+#endif
+
+/* Code executed at the beginning of each rule, after ace_cc_yytext and ace_cc_yyleng
+ * have been set up.
+ */
+#ifndef ACE_CC_YY_USER_ACTION
+#define ACE_CC_YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef ACE_CC_YY_BREAK
+#define ACE_CC_YY_BREAK break;
+#endif
+
+#define ACE_CC_YY_RULE_SETUP \
+ if ( ace_cc_yyleng > 0 ) \
+ ace_cc_yy_current_buffer->ace_cc_yy_at_bol = \
+ (ace_cc_yytext[ace_cc_yyleng - 1] == '\n'); \
+ ACE_CC_YY_USER_ACTION
+
+ACE_CC_YY_DECL
+ {
+ register ace_cc_yy_state_type ace_cc_yy_current_state;
+ register char *ace_cc_yy_cp = NULL, *ace_cc_yy_bp = NULL;
+ register int ace_cc_yy_act;
+
+
+
+
+ if ( ace_cc_yy_init )
+ {
+ ace_cc_yy_init = 0;
+
+#ifdef ACE_CC_YY_USER_INIT
+ ACE_CC_YY_USER_INIT;
+#endif
+
+ if ( ! ace_cc_yy_start )
+ ace_cc_yy_start = 1; /* first start state */
+
+ if ( ! ace_cc_yyin )
+ ace_cc_yyin = stdin;
+
+ if ( ! ace_cc_yyout )
+ ace_cc_yyout = stdout;
+
+ if ( ! ace_cc_yy_current_buffer )
+ ace_cc_yy_current_buffer =
+ ace_cc_yy_create_buffer( ace_cc_yyin, ACE_CC_YY_BUF_SIZE );
+
+ ace_cc_yy_load_buffer_state();
+ }
+
+ ace_cc_yy_cp = ace_cc_yy_bp = 0; /* To avoid g++ warning about
+ possible uninitialized use. */
+ while ( 1 ) /* loops until end-of-file is reached */
+ {
+ ace_cc_yy_cp = ace_cc_yy_c_buf_p;
+
+ /* Support of ace_cc_yytext. */
+ *ace_cc_yy_cp = ace_cc_yy_hold_char;
+
+ /* ace_cc_yy_bp points to the position in ace_cc_yy_ch_buf of the start of
+ * the current run.
+ */
+ ace_cc_yy_bp = ace_cc_yy_cp;
+
+ ace_cc_yy_current_state = ace_cc_yy_start;
+ ace_cc_yy_current_state += ACE_CC_YY_AT_BOL();
+ace_cc_yy_match:
+ do
+ {
+ register ACE_CC_YY_CHAR ace_cc_yy_c = ace_cc_yy_ec[ACE_CC_YY_SC_TO_UI(*ace_cc_yy_cp)];
+ if ( ace_cc_yy_accept[ace_cc_yy_current_state] )
+ {
+ ace_cc_yy_last_accepting_state = ace_cc_yy_current_state;
+ ace_cc_yy_last_accepting_cpos = ace_cc_yy_cp;
+ }
+ while ( ace_cc_yy_chk[ace_cc_yy_base[ace_cc_yy_current_state] + ace_cc_yy_c] != ace_cc_yy_current_state )
+ {
+ ace_cc_yy_current_state = (int) ace_cc_yy_def[ace_cc_yy_current_state];
+ if ( ace_cc_yy_current_state >= 124 )
+ ace_cc_yy_c = ace_cc_yy_meta[(unsigned int) ace_cc_yy_c];
+ }
+ ace_cc_yy_current_state = ace_cc_yy_nxt[ace_cc_yy_base[ace_cc_yy_current_state] + (unsigned int) ace_cc_yy_c];
+ ++ace_cc_yy_cp;
+ }
+ while ( ace_cc_yy_base[ace_cc_yy_current_state] != 143 );
+
+ace_cc_yy_find_action:
+ ace_cc_yy_act = ace_cc_yy_accept[ace_cc_yy_current_state];
+ if ( ace_cc_yy_act == 0 )
+ { /* have to back up */
+ ace_cc_yy_cp = ace_cc_yy_last_accepting_cpos;
+ ace_cc_yy_current_state = ace_cc_yy_last_accepting_state;
+ ace_cc_yy_act = ace_cc_yy_accept[ace_cc_yy_current_state];
+ }
+
+ ACE_CC_YY_DO_BEFORE_ACTION;
+
+
+do_action: /* This label is used only to access EOF actions. */
+
+
+ switch ( ace_cc_yy_act )
+ { /* beginning of action switch */
+ case 0: /* must back up */
+ /* undo the effects of ACE_CC_YY_DO_BEFORE_ACTION */
+ *ace_cc_yy_cp = ace_cc_yy_hold_char;
+ ace_cc_yy_cp = ace_cc_yy_last_accepting_cpos;
+ ace_cc_yy_current_state = ace_cc_yy_last_accepting_state;
+ goto ace_cc_yy_find_action;
+
+case 1:
+ACE_CC_YY_RULE_SETUP
+return T_TERM;
+ /* ACE_CC_YY_BREAK */
+case 2:
+ACE_CC_YY_RULE_SETUP
+return T_START_CMD;
+ /* ACE_CC_YY_BREAK */
+case 3:
+ACE_CC_YY_RULE_SETUP
+return T_CREATE_CMD;
+ /* ACE_CC_YY_BREAK */
+case 4:
+ACE_CC_YY_RULE_SETUP
+return T_LOCK_CMD;
+ /* ACE_CC_YY_BREAK */
+case 5:
+ACE_CC_YY_RULE_SETUP
+return T_UNLOCK_CMD;
+ /* ACE_CC_YY_BREAK */
+case 6:
+ACE_CC_YY_RULE_SETUP
+return T_TRYLOCK_CMD;
+ /* ACE_CC_YY_BREAK */
+case 7:
+ACE_CC_YY_RULE_SETUP
+return T_CHANGEMODE_CMD;
+ /* ACE_CC_YY_BREAK */
+case 8:
+ACE_CC_YY_RULE_SETUP
+return T_SLEEP_CMD;
+ /* ACE_CC_YY_BREAK */
+case 9:
+ACE_CC_YY_RULE_SETUP
+return T_WAIT_CMD;
+ /* ACE_CC_YY_BREAK */
+case 10:
+ACE_CC_YY_RULE_SETUP
+return T_PRINT_CMD;
+ /* ACE_CC_YY_BREAK */
+case 11:
+ACE_CC_YY_RULE_SETUP
+return T_REPEAT_CMD;
+ /* ACE_CC_YY_BREAK */
+case 12:
+ACE_CC_YY_RULE_SETUP
+return T_EXCEP_CMD;
+ /* ACE_CC_YY_BREAK */
+case 13:
+ACE_CC_YY_RULE_SETUP
+return T_LOOKUP_CMD;
+ /* ACE_CC_YY_BREAK */
+case 14:
+ACE_CC_YY_RULE_SETUP
+return T_READ;
+ /* ACE_CC_YY_BREAK */
+case 15:
+ACE_CC_YY_RULE_SETUP
+return T_IREAD;
+ /* ACE_CC_YY_BREAK */
+case 16:
+ACE_CC_YY_RULE_SETUP
+return T_UPGRADE;
+ /* ACE_CC_YY_BREAK */
+case 17:
+ACE_CC_YY_RULE_SETUP
+return T_WRITE;
+ /* ACE_CC_YY_BREAK */
+case 18:
+ACE_CC_YY_RULE_SETUP
+return T_IWRITE;
+ /* ACE_CC_YY_BREAK */
+case 19:
+ACE_CC_YY_RULE_SETUP
+{ ace_cc_yylval.id = ACE_OS::strdup(&ace_cc_yytext[1]);
+ ace_cc_yylval.id[ace_cc_yyleng-2]='\0';
+ return Q_STRING; }
+ /* ACE_CC_YY_BREAK */
+case 20:
+ACE_CC_YY_RULE_SETUP
+{ ace_cc_yylval.num = atoi(ace_cc_yytext); return T_NUM; }
+ /* ACE_CC_YY_BREAK */
+case 21:
+ACE_CC_YY_RULE_SETUP
+{ ace_cc_yylval.id = ACE_OS::strdup(ace_cc_yytext);
+ return T_IDENT; }
+ /* ACE_CC_YY_BREAK */
+case 22:
+ACE_CC_YY_RULE_SETUP
+{ }
+ ACE_CC_YY_BREAK
+case 23:
+ACE_CC_YY_RULE_SETUP
+{ }
+ ACE_CC_YY_BREAK
+case 24:
+ACE_CC_YY_RULE_SETUP
+{ line_no ++;
+ ACE_OS::strcpy(line_buf, ace_cc_yytext+1);
+ ace_cc_yyless(1); }
+ ACE_CC_YY_BREAK
+case 25:
+ACE_CC_YY_RULE_SETUP
+ACE_CC_ECHO;
+ ACE_CC_YY_BREAK
+case ACE_CC_YY_STATE_EOF(INITIAL):
+ ace_cc_yyterminate();
+
+ case ACE_CC_YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int ace_cc_yy_amount_of_matched_text = (int) (ace_cc_yy_cp - ace_cc_yytext_ptr) - 1;
+
+ /* Undo the effects of ACE_CC_YY_DO_BEFORE_ACTION. */
+ *ace_cc_yy_cp = ace_cc_yy_hold_char;
+ ACE_CC_YY_RESTORE_ACE_CC_YY_MORE_OFFSET
+
+ if ( ace_cc_yy_current_buffer->ace_cc_yy_buffer_status == ACE_CC_YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed ace_cc_yyin at a new source and called
+ * ace_cc_yylex(). If so, then we have to assure
+ * consistency between ace_cc_yy_current_buffer and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ ace_cc_yy_n_chars = ace_cc_yy_current_buffer->ace_cc_yy_n_chars;
+ ace_cc_yy_current_buffer->ace_cc_yy_input_file = ace_cc_yyin;
+ ace_cc_yy_current_buffer->ace_cc_yy_buffer_status = ACE_CC_YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for ace_cc_yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since ace_cc_yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( ace_cc_yy_c_buf_p <= &ace_cc_yy_current_buffer->ace_cc_yy_ch_buf[ace_cc_yy_n_chars] )
+ { /* This was really a NUL. */
+ ace_cc_yy_state_type ace_cc_yy_next_state;
+
+ ace_cc_yy_c_buf_p = ace_cc_yytext_ptr + ace_cc_yy_amount_of_matched_text;
+
+ ace_cc_yy_current_state = ace_cc_yy_get_previous_state();
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * ace_cc_yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ ace_cc_yy_next_state = ace_cc_yy_try_NUL_trans( ace_cc_yy_current_state );
+
+ ace_cc_yy_bp = ace_cc_yytext_ptr + ACE_CC_YY_MORE_ADJ;
+
+ if ( ace_cc_yy_next_state )
+ {
+ /* Consume the NUL. */
+ ace_cc_yy_cp = ++ace_cc_yy_c_buf_p;
+ ace_cc_yy_current_state = ace_cc_yy_next_state;
+ goto ace_cc_yy_match;
+ }
+
+ else
+ {
+ ace_cc_yy_cp = ace_cc_yy_c_buf_p;
+ goto ace_cc_yy_find_action;
+ }
+ }
+
+ else switch ( ace_cc_yy_get_next_buffer() )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+#if (ace_cc_yywrap() != 1)
+ ace_cc_yy_did_buffer_switch_on_eof = 0;
+#endif
+
+ if ( ace_cc_yywrap() )
+ {
+ /* Note: because we've taken care in
+ * ace_cc_yy_get_next_buffer() to have set up
+ * ace_cc_yytext, we can now set up
+ * ace_cc_yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * ACE_CC_YY_NULL, it'll still work - another
+ * ACE_CC_YY_NULL will get returned.
+ */
+ ace_cc_yy_c_buf_p = ace_cc_yytext_ptr + ACE_CC_YY_MORE_ADJ;
+
+ ace_cc_yy_act = ACE_CC_YY_STATE_EOF(ACE_CC_YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+#if (ace_cc_yywrap() != 1)
+ if ( ! ace_cc_yy_did_buffer_switch_on_eof )
+ ACE_CC_YY_NEW_FILE;
+#endif
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ ace_cc_yy_c_buf_p =
+ ace_cc_yytext_ptr + ace_cc_yy_amount_of_matched_text;
+
+ ace_cc_yy_current_state = ace_cc_yy_get_previous_state();
+
+ ace_cc_yy_cp = ace_cc_yy_c_buf_p;
+ ace_cc_yy_bp = ace_cc_yytext_ptr + ACE_CC_YY_MORE_ADJ;
+ goto ace_cc_yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ ace_cc_yy_c_buf_p =
+ &ace_cc_yy_current_buffer->ace_cc_yy_ch_buf[ace_cc_yy_n_chars];
+
+ ace_cc_yy_current_state = ace_cc_yy_get_previous_state();
+
+ ace_cc_yy_cp = ace_cc_yy_c_buf_p;
+ ace_cc_yy_bp = ace_cc_yytext_ptr + ACE_CC_YY_MORE_ADJ;
+ goto ace_cc_yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ ACE_CC_YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+ } /* end of ace_cc_yylex */
+
+
+/* ace_cc_yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+
+static int ace_cc_yy_get_next_buffer()
+ {
+ register char *dest = ace_cc_yy_current_buffer->ace_cc_yy_ch_buf;
+ register char *source = ace_cc_yytext_ptr;
+ register int number_to_move, i;
+ int ret_val;
+
+ if ( ace_cc_yy_c_buf_p > &ace_cc_yy_current_buffer->ace_cc_yy_ch_buf[ace_cc_yy_n_chars + 1] )
+ ACE_CC_YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( ace_cc_yy_current_buffer->ace_cc_yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( ace_cc_yy_c_buf_p - ace_cc_yytext_ptr - ACE_CC_YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (int) (ace_cc_yy_c_buf_p - ace_cc_yytext_ptr) - 1;
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ if ( ace_cc_yy_current_buffer->ace_cc_yy_buffer_status == ACE_CC_YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ ace_cc_yy_current_buffer->ace_cc_yy_n_chars = ace_cc_yy_n_chars = 0;
+
+ else
+ {
+ int num_to_read =
+ ace_cc_yy_current_buffer->ace_cc_yy_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+#ifdef ACE_CC_YY_USES_REJECT
+ ACE_CC_YY_FATAL_ERROR(
+"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
+#else
+
+ /* just a shorter name for the current buffer */
+ ACE_CC_YY_BUFFER_STATE b = ace_cc_yy_current_buffer;
+
+ int ace_cc_yy_c_buf_p_offset =
+ (int) (ace_cc_yy_c_buf_p - b->ace_cc_yy_ch_buf);
+
+ if ( b->ace_cc_yy_is_our_buffer )
+ {
+ int new_size = b->ace_cc_yy_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->ace_cc_yy_buf_size += b->ace_cc_yy_buf_size / 8;
+ else
+ b->ace_cc_yy_buf_size *= 2;
+
+ b->ace_cc_yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ ace_cc_yy_flex_realloc( (void *) b->ace_cc_yy_ch_buf,
+ b->ace_cc_yy_buf_size + 2 );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->ace_cc_yy_ch_buf = 0;
+
+ if ( ! b->ace_cc_yy_ch_buf )
+ ACE_CC_YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ ace_cc_yy_c_buf_p = &b->ace_cc_yy_ch_buf[ace_cc_yy_c_buf_p_offset];
+
+ num_to_read = ace_cc_yy_current_buffer->ace_cc_yy_buf_size -
+ number_to_move - 1;
+#endif
+ }
+
+ if ( num_to_read > ACE_CC_YY_READ_BUF_SIZE )
+ num_to_read = ACE_CC_YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ ACE_CC_YY_INPUT( (&ace_cc_yy_current_buffer->ace_cc_yy_ch_buf[number_to_move]),
+ ace_cc_yy_n_chars, num_to_read );
+
+ ace_cc_yy_current_buffer->ace_cc_yy_n_chars = ace_cc_yy_n_chars;
+ }
+
+ if ( ace_cc_yy_n_chars == 0 )
+ {
+ if ( number_to_move == ACE_CC_YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ ace_cc_yyrestart( ace_cc_yyin );
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ ace_cc_yy_current_buffer->ace_cc_yy_buffer_status =
+ ACE_CC_YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ ace_cc_yy_n_chars += number_to_move;
+ ace_cc_yy_current_buffer->ace_cc_yy_ch_buf[ace_cc_yy_n_chars] = ACE_CC_YY_END_OF_BUFFER_CHAR;
+ ace_cc_yy_current_buffer->ace_cc_yy_ch_buf[ace_cc_yy_n_chars + 1] = ACE_CC_YY_END_OF_BUFFER_CHAR;
+
+ ace_cc_yytext_ptr = &ace_cc_yy_current_buffer->ace_cc_yy_ch_buf[0];
+
+ return ret_val;
+ }
+
+
+/* ace_cc_yy_get_previous_state - get the state just before the EOB char was reached */
+
+static ace_cc_yy_state_type ace_cc_yy_get_previous_state()
+ {
+ register ace_cc_yy_state_type ace_cc_yy_current_state;
+ register char *ace_cc_yy_cp;
+
+ ace_cc_yy_current_state = ace_cc_yy_start;
+ ace_cc_yy_current_state += ACE_CC_YY_AT_BOL();
+
+ for ( ace_cc_yy_cp = ace_cc_yytext_ptr + ACE_CC_YY_MORE_ADJ; ace_cc_yy_cp < ace_cc_yy_c_buf_p; ++ace_cc_yy_cp )
+ {
+ register ACE_CC_YY_CHAR ace_cc_yy_c = (*ace_cc_yy_cp ? ace_cc_yy_ec[ACE_CC_YY_SC_TO_UI(*ace_cc_yy_cp)] : 1);
+ if ( ace_cc_yy_accept[ace_cc_yy_current_state] )
+ {
+ ace_cc_yy_last_accepting_state = ace_cc_yy_current_state;
+ ace_cc_yy_last_accepting_cpos = ace_cc_yy_cp;
+ }
+ while ( ace_cc_yy_chk[ace_cc_yy_base[ace_cc_yy_current_state] + ace_cc_yy_c] != ace_cc_yy_current_state )
+ {
+ ace_cc_yy_current_state = (int) ace_cc_yy_def[ace_cc_yy_current_state];
+ if ( ace_cc_yy_current_state >= 124 )
+ ace_cc_yy_c = ace_cc_yy_meta[(unsigned int) ace_cc_yy_c];
+ }
+ ace_cc_yy_current_state = ace_cc_yy_nxt[ace_cc_yy_base[ace_cc_yy_current_state] + (unsigned int) ace_cc_yy_c];
+ }
+
+ return ace_cc_yy_current_state;
+ }
+
+
+/* ace_cc_yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = ace_cc_yy_try_NUL_trans( current_state );
+ */
+
+#ifdef ACE_CC_YY_USE_PROTOS
+static ace_cc_yy_state_type ace_cc_yy_try_NUL_trans( ace_cc_yy_state_type ace_cc_yy_current_state )
+#else
+static ace_cc_yy_state_type ace_cc_yy_try_NUL_trans( ace_cc_yy_current_state )
+ace_cc_yy_state_type ace_cc_yy_current_state;
+#endif
+ {
+ register int ace_cc_yy_is_jam;
+ register char *ace_cc_yy_cp = ace_cc_yy_c_buf_p;
+
+ register ACE_CC_YY_CHAR ace_cc_yy_c = 1;
+ if ( ace_cc_yy_accept[ace_cc_yy_current_state] )
+ {
+ ace_cc_yy_last_accepting_state = ace_cc_yy_current_state;
+ ace_cc_yy_last_accepting_cpos = ace_cc_yy_cp;
+ }
+ while ( ace_cc_yy_chk[ace_cc_yy_base[ace_cc_yy_current_state] + ace_cc_yy_c] != ace_cc_yy_current_state )
+ {
+ ace_cc_yy_current_state = (int) ace_cc_yy_def[ace_cc_yy_current_state];
+ if ( ace_cc_yy_current_state >= 124 )
+ ace_cc_yy_c = ace_cc_yy_meta[(unsigned int) ace_cc_yy_c];
+ }
+ ace_cc_yy_current_state = ace_cc_yy_nxt[ace_cc_yy_base[ace_cc_yy_current_state] + (unsigned int) ace_cc_yy_c];
+ ace_cc_yy_is_jam = (ace_cc_yy_current_state == 123);
+
+ return ace_cc_yy_is_jam ? 0 : ace_cc_yy_current_state;
+ }
+
+
+#ifndef ACE_CC_YY_NO_UNPUT
+#ifdef ACE_CC_YY_USE_PROTOS
+static void ace_cc_yyunput( int c, register char *ace_cc_yy_bp )
+#else
+static void ace_cc_yyunput( c, ace_cc_yy_bp )
+int c;
+register char *ace_cc_yy_bp;
+#endif
+ {
+ register char *ace_cc_yy_cp = ace_cc_yy_c_buf_p;
+
+ /* undo effects of setting up ace_cc_yytext */
+ *ace_cc_yy_cp = ace_cc_yy_hold_char;
+
+ if ( ace_cc_yy_cp < ace_cc_yy_current_buffer->ace_cc_yy_ch_buf + 2 )
+ { /* need to shift things up to make room */
+ /* +2 for EOB chars. */
+ register int number_to_move = ace_cc_yy_n_chars + 2;
+ register char *dest = &ace_cc_yy_current_buffer->ace_cc_yy_ch_buf[
+ ace_cc_yy_current_buffer->ace_cc_yy_buf_size + 2];
+ register char *source =
+ &ace_cc_yy_current_buffer->ace_cc_yy_ch_buf[number_to_move];
+
+ while ( source > ace_cc_yy_current_buffer->ace_cc_yy_ch_buf )
+ *--dest = *--source;
+
+ ace_cc_yy_cp += (int) (dest - source);
+ ace_cc_yy_bp += (int) (dest - source);
+ ace_cc_yy_current_buffer->ace_cc_yy_n_chars =
+ ace_cc_yy_n_chars = ace_cc_yy_current_buffer->ace_cc_yy_buf_size;
+
+ if ( ace_cc_yy_cp < ace_cc_yy_current_buffer->ace_cc_yy_ch_buf + 2 )
+ ACE_CC_YY_FATAL_ERROR( "flex scanner push-back overflow" );
+ }
+
+ *--ace_cc_yy_cp = (char) c;
+
+
+ ace_cc_yytext_ptr = ace_cc_yy_bp;
+ ace_cc_yy_hold_char = *ace_cc_yy_cp;
+ ace_cc_yy_c_buf_p = ace_cc_yy_cp;
+ }
+#endif /* ifndef ACE_CC_YY_NO_UNPUT */
+
+#ifndef ACE_CC_YY_NO_INPUT
+#ifdef __cplusplus
+static int ace_cc_yyinput()
+#else
+static int input()
+#endif
+ {
+ int c;
+
+ *ace_cc_yy_c_buf_p = ace_cc_yy_hold_char;
+
+ if ( *ace_cc_yy_c_buf_p == ACE_CC_YY_END_OF_BUFFER_CHAR )
+ {
+ /* ace_cc_yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( ace_cc_yy_c_buf_p < &ace_cc_yy_current_buffer->ace_cc_yy_ch_buf[ace_cc_yy_n_chars] )
+ /* This was really a NUL. */
+ *ace_cc_yy_c_buf_p = '\0';
+
+ else
+ { /* need more input */
+ int offset = ace_cc_yy_c_buf_p - ace_cc_yytext_ptr;
+ ++ace_cc_yy_c_buf_p;
+
+ switch ( ace_cc_yy_get_next_buffer() )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because ace_cc_yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ ace_cc_yyrestart( ace_cc_yyin );
+
+ /* fall through */
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( ace_cc_yywrap() )
+ return EOF;
+
+ /* if ( ! ace_cc_yy_did_buffer_switch_on_eof )
+ ACE_CC_YY_NEW_FILE;
+#ifdef __cplusplus
+ return ace_cc_yyinput();
+#else
+ return input();
+ #endif */
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ ace_cc_yy_c_buf_p = ace_cc_yytext_ptr + offset;
+ break;
+ }
+ }
+ }
+
+ c = *(unsigned char *) ace_cc_yy_c_buf_p; /* cast for 8-bit char's */
+ *ace_cc_yy_c_buf_p = '\0'; /* preserve ace_cc_yytext */
+ ace_cc_yy_hold_char = *++ace_cc_yy_c_buf_p;
+
+ ace_cc_yy_current_buffer->ace_cc_yy_at_bol = (c == '\n');
+
+ return c;
+ }
+#endif /* ! ACE_CC_YY_NO_INPUT */
+
+
+#ifdef ACE_CC_YY_USE_PROTOS
+void ace_cc_yyrestart( FILE *input_file )
+#else
+void ace_cc_yyrestart( input_file )
+FILE *input_file;
+#endif
+ {
+ if ( ! ace_cc_yy_current_buffer )
+ ace_cc_yy_current_buffer = ace_cc_yy_create_buffer( ace_cc_yyin, ACE_CC_YY_BUF_SIZE );
+
+ ace_cc_yy_init_buffer( ace_cc_yy_current_buffer, input_file );
+ ace_cc_yy_load_buffer_state();
+ }
+
+
+#ifdef ACE_CC_YY_USE_PROTOS
+void ace_cc_yy_switch_to_buffer( ACE_CC_YY_BUFFER_STATE new_buffer )
+#else
+void ace_cc_yy_switch_to_buffer( new_buffer )
+ACE_CC_YY_BUFFER_STATE new_buffer;
+#endif
+ {
+ if ( ace_cc_yy_current_buffer == new_buffer )
+ return;
+
+ if ( ace_cc_yy_current_buffer )
+ {
+ /* Flush out information for old buffer. */
+ *ace_cc_yy_c_buf_p = ace_cc_yy_hold_char;
+ ace_cc_yy_current_buffer->ace_cc_yy_buf_pos = ace_cc_yy_c_buf_p;
+ ace_cc_yy_current_buffer->ace_cc_yy_n_chars = ace_cc_yy_n_chars;
+ }
+
+ ace_cc_yy_current_buffer = new_buffer;
+ ace_cc_yy_load_buffer_state();
+
+ /* We don't actually know whether we did this switch during
+ * EOF (ace_cc_yywrap()) processing, but the only time this flag
+ * is looked at is after ace_cc_yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+#if (ace_cc_yywrap() != 1)
+ ace_cc_yy_did_buffer_switch_on_eof = 1;
+#endif
+ }
+
+
+#ifdef ACE_CC_YY_USE_PROTOS
+void ace_cc_yy_load_buffer_state( void )
+#else
+void ace_cc_yy_load_buffer_state()
+#endif
+ {
+ ace_cc_yy_n_chars = ace_cc_yy_current_buffer->ace_cc_yy_n_chars;
+ ace_cc_yytext_ptr = ace_cc_yy_c_buf_p = ace_cc_yy_current_buffer->ace_cc_yy_buf_pos;
+ ace_cc_yyin = ace_cc_yy_current_buffer->ace_cc_yy_input_file;
+ ace_cc_yy_hold_char = *ace_cc_yy_c_buf_p;
+ }
+
+
+#ifdef ACE_CC_YY_USE_PROTOS
+ACE_CC_YY_BUFFER_STATE ace_cc_yy_create_buffer( FILE *file, int size )
+#else
+ACE_CC_YY_BUFFER_STATE ace_cc_yy_create_buffer( file, size )
+FILE *file;
+int size;
+#endif
+ {
+ ACE_CC_YY_BUFFER_STATE b;
+
+ b = (ACE_CC_YY_BUFFER_STATE) ace_cc_yy_flex_alloc( sizeof( struct ace_cc_yy_buffer_state ) );
+ if ( ! b )
+ ACE_CC_YY_FATAL_ERROR( "out of dynamic memory in ace_cc_yy_create_buffer()" );
+
+ b->ace_cc_yy_buf_size = size;
+
+ /* ace_cc_yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->ace_cc_yy_ch_buf = (char *) ace_cc_yy_flex_alloc( b->ace_cc_yy_buf_size + 2 );
+ if ( ! b->ace_cc_yy_ch_buf )
+ ACE_CC_YY_FATAL_ERROR( "out of dynamic memory in ace_cc_yy_create_buffer()" );
+
+ b->ace_cc_yy_is_our_buffer = 1;
+
+ ace_cc_yy_init_buffer( b, file );
+
+ return b;
+ }
+
+
+#ifdef ACE_CC_YY_USE_PROTOS
+void ace_cc_yy_delete_buffer( ACE_CC_YY_BUFFER_STATE b )
+#else
+void ace_cc_yy_delete_buffer( b )
+ACE_CC_YY_BUFFER_STATE b;
+#endif
+ {
+ if ( ! b )
+ return;
+
+ if ( b == ace_cc_yy_current_buffer )
+ ace_cc_yy_current_buffer = (ACE_CC_YY_BUFFER_STATE) 0;
+
+ if ( b->ace_cc_yy_is_our_buffer )
+ ace_cc_yy_flex_free( (void *) b->ace_cc_yy_ch_buf );
+
+ ace_cc_yy_flex_free( (void *) b );
+ }
+
+
+
+#ifdef ACE_CC_YY_USE_PROTOS
+void ace_cc_yy_init_buffer( ACE_CC_YY_BUFFER_STATE b, FILE *file )
+#else
+void ace_cc_yy_init_buffer( b, file )
+ACE_CC_YY_BUFFER_STATE b;
+FILE *file;
+#endif
+
+
+ {
+ ace_cc_yy_flush_buffer( b );
+
+ b->ace_cc_yy_input_file = file;
+ b->ace_cc_yy_fill_buffer = 1;
+
+#if ACE_CC_YY_ALWAYS_INTERACTIVE
+ b->ace_cc_yy_is_interactive = 1;
+#else
+#if ACE_CC_YY_NEVER_INTERACTIVE
+ b->ace_cc_yy_is_interactive = 0;
+#else
+ b->ace_cc_yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+#endif
+#endif
+ }
+
+
+#ifdef ACE_CC_YY_USE_PROTOS
+void ace_cc_yy_flush_buffer( ACE_CC_YY_BUFFER_STATE b )
+#else
+void ace_cc_yy_flush_buffer( b )
+ACE_CC_YY_BUFFER_STATE b;
+#endif
+
+ {
+ if ( ! b )
+ return;
+
+ b->ace_cc_yy_n_chars = 0;
+
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->ace_cc_yy_ch_buf[0] = ACE_CC_YY_END_OF_BUFFER_CHAR;
+ b->ace_cc_yy_ch_buf[1] = ACE_CC_YY_END_OF_BUFFER_CHAR;
+
+ b->ace_cc_yy_buf_pos = &b->ace_cc_yy_ch_buf[0];
+
+ b->ace_cc_yy_at_bol = 1;
+ b->ace_cc_yy_buffer_status = ACE_CC_YY_BUFFER_NEW;
+
+ if ( b == ace_cc_yy_current_buffer )
+ ace_cc_yy_load_buffer_state();
+ }
+
+
+#ifndef ACE_CC_YY_NO_SCAN_BUFFER
+#ifdef ACE_CC_YY_USE_PROTOS
+ACE_CC_YY_BUFFER_STATE ace_cc_yy_scan_buffer( char *base, ace_cc_yy_size_t size )
+#else
+ACE_CC_YY_BUFFER_STATE ace_cc_yy_scan_buffer( base, size )
+char *base;
+ace_cc_yy_size_t size;
+#endif
+ {
+ ACE_CC_YY_BUFFER_STATE b;
+
+ if ( size < 2 ||
+ base[size-2] != ACE_CC_YY_END_OF_BUFFER_CHAR ||
+ base[size-1] != ACE_CC_YY_END_OF_BUFFER_CHAR )
+ /* They forgot to leave room for the EOB's. */
+ return 0;
+
+ b = (ACE_CC_YY_BUFFER_STATE) ace_cc_yy_flex_alloc( sizeof( struct ace_cc_yy_buffer_state ) );
+ if ( ! b )
+ ACE_CC_YY_FATAL_ERROR( "out of dynamic memory in ace_cc_yy_scan_buffer()" );
+
+ b->ace_cc_yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->ace_cc_yy_buf_pos = b->ace_cc_yy_ch_buf = base;
+ b->ace_cc_yy_is_our_buffer = 0;
+ b->ace_cc_yy_input_file = 0;
+ b->ace_cc_yy_n_chars = b->ace_cc_yy_buf_size;
+ b->ace_cc_yy_is_interactive = 0;
+ b->ace_cc_yy_at_bol = 1;
+ b->ace_cc_yy_fill_buffer = 0;
+ b->ace_cc_yy_buffer_status = ACE_CC_YY_BUFFER_NEW;
+
+ ace_cc_yy_switch_to_buffer( b );
+
+ return b;
+ }
+#endif
+
+
+#ifndef ACE_CC_YY_NO_SCAN_STRING
+#ifdef ACE_CC_YY_USE_PROTOS
+ACE_CC_YY_BUFFER_STATE ace_cc_yy_scan_string( ace_cc_yyconst char *ace_cc_yy_str )
+#else
+ACE_CC_YY_BUFFER_STATE ace_cc_yy_scan_string( ace_cc_yy_str )
+ace_cc_yyconst char *ace_cc_yy_str;
+#endif
+ {
+ int len;
+ for ( len = 0; ace_cc_yy_str[len]; ++len )
+ ;
+
+ return ace_cc_yy_scan_bytes( ace_cc_yy_str, len );
+ }
+#endif
+
+
+#ifndef ACE_CC_YY_NO_SCAN_BYTES
+#ifdef ACE_CC_YY_USE_PROTOS
+ACE_CC_YY_BUFFER_STATE ace_cc_yy_scan_bytes( ace_cc_yyconst char *bytes, int len )
+#else
+ACE_CC_YY_BUFFER_STATE ace_cc_yy_scan_bytes( bytes, len )
+ace_cc_yyconst char *bytes;
+int len;
+#endif
+ {
+ ACE_CC_YY_BUFFER_STATE b;
+ char *buf;
+ ace_cc_yy_size_t n;
+ int i;
+
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = len + 2;
+ buf = (char *) ace_cc_yy_flex_alloc( n );
+ if ( ! buf )
+ ACE_CC_YY_FATAL_ERROR( "out of dynamic memory in ace_cc_yy_scan_bytes()" );
+
+ for ( i = 0; i < len; ++i )
+ buf[i] = bytes[i];
+
+ buf[len] = buf[len+1] = ACE_CC_YY_END_OF_BUFFER_CHAR;
+
+ b = ace_cc_yy_scan_buffer( buf, n );
+ if ( ! b )
+ ACE_CC_YY_FATAL_ERROR( "bad buffer in ace_cc_yy_scan_bytes()" );
+
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->ace_cc_yy_is_our_buffer = 1;
+
+ return b;
+ }
+#endif
+
+
+#ifndef ACE_CC_YY_NO_PUSH_STATE
+#ifdef ACE_CC_YY_USE_PROTOS
+static void ace_cc_yy_push_state( int new_state )
+#else
+static void ace_cc_yy_push_state( new_state )
+int new_state;
+#endif
+ {
+ if ( ace_cc_yy_start_stack_ptr >= ace_cc_yy_start_stack_depth )
+ {
+ ace_cc_yy_size_t new_size;
+
+ ace_cc_yy_start_stack_depth += ACE_CC_YY_START_STACK_INCR;
+ new_size = ace_cc_yy_start_stack_depth * sizeof( int );
+
+ if ( ! ace_cc_yy_start_stack )
+ ace_cc_yy_start_stack = (int *) ace_cc_yy_flex_alloc( new_size );
+
+ else
+ ace_cc_yy_start_stack = (int *) ace_cc_yy_flex_realloc(
+ (void *) ace_cc_yy_start_stack, new_size );
+
+ if ( ! ace_cc_yy_start_stack )
+ ACE_CC_YY_FATAL_ERROR(
+ "out of memory expanding start-condition stack" );
+ }
+
+ ace_cc_yy_start_stack[ace_cc_yy_start_stack_ptr++] = ACE_CC_YY_START;
+
+ BEGIN(new_state);
+ }
+#endif
+
+
+#ifndef ACE_CC_YY_NO_POP_STATE
+static void ace_cc_yy_pop_state()
+ {
+ if ( --ace_cc_yy_start_stack_ptr < 0 )
+ ACE_CC_YY_FATAL_ERROR( "start-condition stack underflow" );
+
+ BEGIN(ace_cc_yy_start_stack[ace_cc_yy_start_stack_ptr]);
+ }
+#endif
+
+
+#ifndef ACE_CC_YY_NO_TOP_STATE
+static int ace_cc_yy_top_state()
+ {
+ return ace_cc_yy_start_stack[ace_cc_yy_start_stack_ptr - 1];
+ }
+#endif
+
+#ifndef ACE_CC_YY_EXIT_FAILURE
+#define ACE_CC_YY_EXIT_FAILURE 2
+#endif
+
+#ifdef ACE_CC_YY_USE_PROTOS
+static void ace_cc_yy_fatal_error( ace_cc_yyconst char msg[] )
+#else
+static void ace_cc_yy_fatal_error( msg )
+char msg[];
+#endif
+ {
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( ACE_CC_YY_EXIT_FAILURE );
+ }
+
+
+
+/* Redefine ace_cc_yyless() so it works in section 3 code. */
+
+#undef ace_cc_yyless
+#define ace_cc_yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up ace_cc_yytext. */ \
+ ace_cc_yytext[ace_cc_yyleng] = ace_cc_yy_hold_char; \
+ ace_cc_yy_c_buf_p = ace_cc_yytext + n; \
+ ace_cc_yy_hold_char = *ace_cc_yy_c_buf_p; \
+ *ace_cc_yy_c_buf_p = '\0'; \
+ ace_cc_yyleng = n; \
+ } \
+ while ( 0 )
+
+
+/* Internal utility routines. */
+
+#ifndef ace_cc_yytext_ptr
+#ifdef ACE_CC_YY_USE_PROTOS
+static void ace_cc_yy_flex_strncpy( char *s1, ace_cc_yyconst char *s2, int n )
+#else
+static void ace_cc_yy_flex_strncpy( s1, s2, n )
+char *s1;
+ace_cc_yyconst char *s2;
+int n;
+#endif
+ {
+ register int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+ }
+#endif
+
+#ifdef ACE_CC_YY_NEED_STRLEN
+#ifdef ACE_CC_YY_USE_PROTOS
+static int ace_cc_yy_flex_strlen( ace_cc_yyconst char *s )
+#else
+static int ace_cc_yy_flex_strlen( s )
+ace_cc_yyconst char *s;
+#endif
+ {
+ register int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+ }
+#endif
+
+
+#ifdef ACE_CC_YY_USE_PROTOS
+static void *ace_cc_yy_flex_alloc( ace_cc_yy_size_t size )
+#else
+static void *ace_cc_yy_flex_alloc( size )
+ace_cc_yy_size_t size;
+#endif
+ {
+ return (void *) malloc( size );
+ }
+
+#ifdef ACE_CC_YY_USE_PROTOS
+static void *ace_cc_yy_flex_realloc( void *ptr, ace_cc_yy_size_t size )
+#else
+static void *ace_cc_yy_flex_realloc( ptr, size )
+void *ptr;
+ace_cc_yy_size_t size;
+#endif
+ {
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return (void *) realloc( (char *) ptr, size );
+ }
+
+#ifdef ACE_CC_YY_USE_PROTOS
+static void ace_cc_yy_flex_free( void *ptr )
+#else
+static void ace_cc_yy_flex_free( ptr )
+void *ptr;
+#endif
+ {
+ free( ACE_MALLOC_T (ptr) );
+ }
+
+#if ACE_CC_YY_MAIN
+int main()
+ {
+ ace_cc_yylex();
+ return 0;
+ }
+#endif
diff --git a/TAO/orbsvcs/tests/Concurrency/lex.CC_command.cpp.diff b/TAO/orbsvcs/tests/Concurrency/lex.CC_command.cpp.diff
new file mode 100644
index 00000000000..9beb6741b18
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/lex.CC_command.cpp.diff
@@ -0,0 +1,209 @@
+--- lex.CC_command.cpp.orig Mon Nov 12 19:05:12 2001
++++ lex.CC_command.cpp Mon Nov 12 19:14:49 2001
+@@ -220,10 +220,13 @@
+ static int ace_cc_yy_init = 1; /* whether we need to initialize */
+ static int ace_cc_yy_start = 0; /* start state number */
+
++#define ace_cc_yywrap() 1
+ /* Flag which is used to allow ace_cc_yywrap()'s to do buffer switches
+ * instead of setting up a fresh ace_cc_yyin. A bit of a hack ...
+ */
++#if (ace_cc_yywrap() != 1)
+ static int ace_cc_yy_did_buffer_switch_on_eof;
++#endif
+
+ void ace_cc_yyrestart ACE_CC_YY_PROTO(( FILE *input_file ));
+
+@@ -262,7 +265,6 @@
+ #define ACE_CC_YY_AT_BOL() (ace_cc_yy_current_buffer->ace_cc_yy_at_bol)
+
+
+-#define ace_cc_yywrap() 1
+ #define ACE_CC_YY_SKIP_ACE_CC_YYWRAP
+ typedef unsigned char ACE_CC_YY_CHAR;
+ FILE *ace_cc_yyin = (FILE *) 0, *ace_cc_yyout = (FILE *) 0;
+@@ -644,6 +646,8 @@
+ ace_cc_yy_load_buffer_state();
+ }
+
++ ace_cc_yy_cp = ace_cc_yy_bp = 0; /* To avoid g++ warning about
++ possible uninitialized use. */
+ while ( 1 ) /* loops until end-of-file is reached */
+ {
+ ace_cc_yy_cp = ace_cc_yy_c_buf_p;
+@@ -705,90 +709,90 @@
+ case 1:
+ ACE_CC_YY_RULE_SETUP
+ return T_TERM;
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 2:
+ ACE_CC_YY_RULE_SETUP
+ return T_START_CMD;
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 3:
+ ACE_CC_YY_RULE_SETUP
+ return T_CREATE_CMD;
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 4:
+ ACE_CC_YY_RULE_SETUP
+ return T_LOCK_CMD;
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 5:
+ ACE_CC_YY_RULE_SETUP
+ return T_UNLOCK_CMD;
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 6:
+ ACE_CC_YY_RULE_SETUP
+ return T_TRYLOCK_CMD;
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 7:
+ ACE_CC_YY_RULE_SETUP
+ return T_CHANGEMODE_CMD;
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 8:
+ ACE_CC_YY_RULE_SETUP
+ return T_SLEEP_CMD;
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 9:
+ ACE_CC_YY_RULE_SETUP
+ return T_WAIT_CMD;
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 10:
+ ACE_CC_YY_RULE_SETUP
+ return T_PRINT_CMD;
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 11:
+ ACE_CC_YY_RULE_SETUP
+ return T_REPEAT_CMD;
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 12:
+ ACE_CC_YY_RULE_SETUP
+ return T_EXCEP_CMD;
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 13:
+ ACE_CC_YY_RULE_SETUP
+ return T_LOOKUP_CMD;
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 14:
+ ACE_CC_YY_RULE_SETUP
+ return T_READ;
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 15:
+ ACE_CC_YY_RULE_SETUP
+ return T_IREAD;
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 16:
+ ACE_CC_YY_RULE_SETUP
+ return T_UPGRADE;
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 17:
+ ACE_CC_YY_RULE_SETUP
+ return T_WRITE;
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 18:
+ ACE_CC_YY_RULE_SETUP
+ return T_IWRITE;
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 19:
+ ACE_CC_YY_RULE_SETUP
+ { ace_cc_yylval.id = ACE_OS::strdup(&ace_cc_yytext[1]);
+ ace_cc_yylval.id[ace_cc_yyleng-2]='\0';
+ return Q_STRING; }
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 20:
+ ACE_CC_YY_RULE_SETUP
+ { ace_cc_yylval.num = atoi(ace_cc_yytext); return T_NUM; }
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 21:
+ ACE_CC_YY_RULE_SETUP
+ { ace_cc_yylval.id = ACE_OS::strdup(ace_cc_yytext);
+ return T_IDENT; }
+- ACE_CC_YY_BREAK
++ /* ACE_CC_YY_BREAK */
+ case 22:
+ ACE_CC_YY_RULE_SETUP
+ { }
+@@ -882,7 +886,9 @@
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
++#if (ace_cc_yywrap() != 1)
+ ace_cc_yy_did_buffer_switch_on_eof = 0;
++#endif
+
+ if ( ace_cc_yywrap() )
+ {
+@@ -903,8 +909,10 @@
+
+ else
+ {
++#if (ace_cc_yywrap() != 1)
+ if ( ! ace_cc_yy_did_buffer_switch_on_eof )
+ ACE_CC_YY_NEW_FILE;
++#endif
+ }
+ break;
+ }
+@@ -1188,7 +1196,7 @@
+ }
+ #endif /* ifndef ACE_CC_YY_NO_UNPUT */
+
+-
++#ifndef ACE_CC_YY_NO_INPUT
+ #ifdef __cplusplus
+ static int ace_cc_yyinput()
+ #else
+@@ -1237,13 +1245,13 @@
+ if ( ace_cc_yywrap() )
+ return EOF;
+
+- if ( ! ace_cc_yy_did_buffer_switch_on_eof )
++ /* if ( ! ace_cc_yy_did_buffer_switch_on_eof )
+ ACE_CC_YY_NEW_FILE;
+ #ifdef __cplusplus
+ return ace_cc_yyinput();
+ #else
+ return input();
+-#endif
++ #endif */
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+@@ -1261,6 +1269,7 @@
+
+ return c;
+ }
++#endif /* ! ACE_CC_YY_NO_INPUT */
+
+
+ #ifdef ACE_CC_YY_USE_PROTOS
+@@ -1304,7 +1313,9 @@
+ * is looked at is after ace_cc_yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
++#if (ace_cc_yywrap() != 1)
+ ace_cc_yy_did_buffer_switch_on_eof = 1;
++#endif
+ }
+
+
diff --git a/TAO/orbsvcs/tests/Concurrency/test.basic b/TAO/orbsvcs/tests/Concurrency/test.basic
new file mode 100644
index 00000000000..3673cebe927
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/test.basic
@@ -0,0 +1,21 @@
+create test;
+lock test read;
+try_lock test read;
+unlock test read;
+unlock test read;
+lock test write;
+try_lock test write;
+unlock test write;
+lock test upgrade;
+try_lock test upgrade;
+unlock test upgrade;
+lock test intention_read;
+try_lock test intention_read;
+unlock test intention_read;
+unlock test intention_read;
+lock test intention_write;
+try_lock test intention_write;
+unlock test intention_write;
+create ls2;
+unlock ls2 write;
+exception IDL:omg.org/CosConcurrencyControl/LockNotHeld:1.0;
diff --git a/TAO/orbsvcs/tests/Concurrency/test.dinphil b/TAO/orbsvcs/tests/Concurrency/test.dinphil
new file mode 100644
index 00000000000..81b02f90ee7
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/test.dinphil
@@ -0,0 +1,12 @@
+print "Creating lock sets";
+create fork1;
+create fork2;
+create fork3;
+create fork4;
+create fork5;
+print "Running the tests";
+start test.phil1;
+start test.phil2;
+start test.phil3;
+start test.phil4;
+start test.phil5;
diff --git a/TAO/orbsvcs/tests/Concurrency/test.e1 b/TAO/orbsvcs/tests/Concurrency/test.e1
new file mode 100644
index 00000000000..1c1e4517680
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/test.e1
@@ -0,0 +1,2 @@
+wait "Press return";
+unlock ls1 write;
diff --git a/TAO/orbsvcs/tests/Concurrency/test.extended b/TAO/orbsvcs/tests/Concurrency/test.extended
new file mode 100644
index 00000000000..330f03e39c5
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/test.extended
@@ -0,0 +1,4 @@
+create ls1;
+lock ls1 write;
+wait "Run test.e1 - then press return";
+lock ls1 write;
diff --git a/TAO/orbsvcs/tests/Concurrency/test.phil1 b/TAO/orbsvcs/tests/Concurrency/test.phil1
new file mode 100644
index 00000000000..19d25e04ef9
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/test.phil1
@@ -0,0 +1,6 @@
+repeat 100;
+lock fork2 write;
+lock fork1 write;
+print "Phil 1 eating";
+unlock fork2 write;
+unlock fork1 write;
diff --git a/TAO/orbsvcs/tests/Concurrency/test.phil2 b/TAO/orbsvcs/tests/Concurrency/test.phil2
new file mode 100644
index 00000000000..7f02934cf4d
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/test.phil2
@@ -0,0 +1,6 @@
+repeat 100;
+lock fork2 write;
+lock fork3 write;
+print "Phil 2 eating";
+unlock fork2 write;
+unlock fork3 write;
diff --git a/TAO/orbsvcs/tests/Concurrency/test.phil3 b/TAO/orbsvcs/tests/Concurrency/test.phil3
new file mode 100644
index 00000000000..4d808e88ac7
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/test.phil3
@@ -0,0 +1,6 @@
+repeat 100;
+lock fork3 write;
+lock fork4 write;
+print "Phil 3 eating";
+unlock fork3 write;
+unlock fork4 write;
diff --git a/TAO/orbsvcs/tests/Concurrency/test.phil4 b/TAO/orbsvcs/tests/Concurrency/test.phil4
new file mode 100644
index 00000000000..36910b9a9aa
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/test.phil4
@@ -0,0 +1,6 @@
+repeat 100;
+lock fork4 write;
+lock fork5 write;
+print "Phil 4 eating";
+unlock fork4 write;
+unlock fork5 write;
diff --git a/TAO/orbsvcs/tests/Concurrency/test.phil5 b/TAO/orbsvcs/tests/Concurrency/test.phil5
new file mode 100644
index 00000000000..b5f5058eac6
--- /dev/null
+++ b/TAO/orbsvcs/tests/Concurrency/test.phil5
@@ -0,0 +1,6 @@
+repeat 100;
+lock fork5 write;
+lock fork1 write;
+print "Phil 5 eating";
+unlock fork5 write;
+unlock fork1 write;