From 4075bff35deee2c0e332ab5db6fb73936fb375bb Mon Sep 17 00:00:00 2001 From: coryan Date: Sun, 27 Feb 2000 23:12:27 +0000 Subject: ChangeLogTag:Sat Feb 26 21:45:45 2000 Carlos O'Ryan --- TAO/ChangeLogs/ChangeLog-02a | 102 ++ TAO/orbsvcs/orbsvcs/ESF/ESF_Busy_Lock.cpp | 62 + TAO/orbsvcs/orbsvcs/ESF/ESF_Busy_Lock.h | 61 + TAO/orbsvcs/orbsvcs/ESF/ESF_Busy_Lock.i | 8 + TAO/orbsvcs/orbsvcs/ESF/ESF_Copy_On_Read.cpp | 82 + TAO/orbsvcs/orbsvcs/ESF/ESF_Copy_On_Read.h | 82 + TAO/orbsvcs/orbsvcs/ESF/ESF_Copy_On_Read.i | 42 + TAO/orbsvcs/orbsvcs/ESF/ESF_Defaults.h | 42 + TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Changes.cpp | 206 +++ TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Changes.h | 161 ++ TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Changes.i | 32 + TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Command.cpp | 66 + TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Command.h | 198 +++ TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Command.i | 41 + TAO/orbsvcs/orbsvcs/ESF/ESF_Immediate_Changes.cpp | 46 + TAO/orbsvcs/orbsvcs/ESF/ESF_Immediate_Changes.h | 72 + TAO/orbsvcs/orbsvcs/ESF/ESF_Immediate_Changes.i | 43 + TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Admin.cpp | 46 + TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Admin.h | 102 ++ TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Admin.i | 7 + TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Workers.cpp | 51 + TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Workers.h | 107 ++ TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Workers.i | 25 + TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Admin.cpp | 101 ++ TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Admin.h | 134 ++ TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Admin.i | 11 + TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Collection.cpp | 22 + TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Collection.h | 184 ++ TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Collection.i | 1 + TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_List.cpp | 89 + TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_List.h | 72 + TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_List.i | 19 + TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_RB_Tree.cpp | 82 + TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_RB_Tree.h | 87 + TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_RB_Tree.i | 64 + TAO/orbsvcs/orbsvcs/ESF/ESF_Shutdown_Proxy.cpp | 30 + TAO/orbsvcs/orbsvcs/ESF/ESF_Shutdown_Proxy.h | 53 + TAO/orbsvcs/orbsvcs/ESF/ESF_Shutdown_Proxy.i | 6 + TAO/orbsvcs/orbsvcs/ESF/ESF_Worker.cpp | 19 + TAO/orbsvcs/orbsvcs/ESF/ESF_Worker.h | 51 + TAO/orbsvcs/orbsvcs/ESF/ESF_Worker.i | 1 + TAO/orbsvcs/orbsvcs/ETCL/ETCL.ll | 150 ++ TAO/orbsvcs/orbsvcs/ETCL/ETCL.yy | 240 +++ TAO/orbsvcs/orbsvcs/ETCL/ETCL_Constraint.cpp | 246 +++ TAO/orbsvcs/orbsvcs/ETCL/ETCL_Constraint.h | 418 +++++ TAO/orbsvcs/orbsvcs/ETCL/ETCL_Constraint.i | 373 ++++ TAO/orbsvcs/orbsvcs/ETCL/ETCL_l.cpp | 1904 +++++++++++++++++++++ TAO/orbsvcs/orbsvcs/ETCL/ETCL_l.cpp.diff | 143 ++ TAO/orbsvcs/orbsvcs/ETCL/ETCL_y.cpp | 1277 ++++++++++++++ TAO/orbsvcs/orbsvcs/ETCL/ETCL_y.h | 48 + TAO/orbsvcs/orbsvcs/ETCL/README | 12 + TAO/orbsvcs/orbsvcs/Makefile | 3 +- 52 files changed, 7523 insertions(+), 1 deletion(-) create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Busy_Lock.cpp create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Busy_Lock.h create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Busy_Lock.i create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Copy_On_Read.cpp create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Copy_On_Read.h create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Copy_On_Read.i create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Defaults.h create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Changes.cpp create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Changes.h create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Changes.i create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Command.cpp create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Command.h create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Command.i create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Immediate_Changes.cpp create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Immediate_Changes.h create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Immediate_Changes.i create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Admin.cpp create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Admin.h create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Admin.i create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Workers.cpp create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Workers.h create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Workers.i create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Admin.cpp create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Admin.h create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Admin.i create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Collection.cpp create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Collection.h create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Collection.i create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_List.cpp create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_List.h create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_List.i create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_RB_Tree.cpp create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_RB_Tree.h create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_RB_Tree.i create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Shutdown_Proxy.cpp create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Shutdown_Proxy.h create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Shutdown_Proxy.i create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Worker.cpp create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Worker.h create mode 100644 TAO/orbsvcs/orbsvcs/ESF/ESF_Worker.i create mode 100644 TAO/orbsvcs/orbsvcs/ETCL/ETCL.ll create mode 100644 TAO/orbsvcs/orbsvcs/ETCL/ETCL.yy create mode 100644 TAO/orbsvcs/orbsvcs/ETCL/ETCL_Constraint.cpp create mode 100644 TAO/orbsvcs/orbsvcs/ETCL/ETCL_Constraint.h create mode 100644 TAO/orbsvcs/orbsvcs/ETCL/ETCL_Constraint.i create mode 100644 TAO/orbsvcs/orbsvcs/ETCL/ETCL_l.cpp create mode 100644 TAO/orbsvcs/orbsvcs/ETCL/ETCL_l.cpp.diff create mode 100644 TAO/orbsvcs/orbsvcs/ETCL/ETCL_y.cpp create mode 100644 TAO/orbsvcs/orbsvcs/ETCL/ETCL_y.h create mode 100644 TAO/orbsvcs/orbsvcs/ETCL/README diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index d94ceb243a7..62c73b6b74a 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,105 @@ +Sat Feb 26 21:45:45 2000 Carlos O'Ryan + + * orbsvcs/orbsvcs/Makefile: + Add orbsvcs/orbsvcs/ESF to the include path, because some + compilers need that for template instantiation. + + * orbsvcs/orbsvcs/ESF/ESF_Busy_Lock.h: + * orbsvcs/orbsvcs/ESF/ESF_Busy_Lock.i: + * orbsvcs/orbsvcs/ESF/ESF_Busy_Lock.cpp: + An ACE_Guard-compatible class to implement Delayed_Commands + + * orbsvcs/orbsvcs/ESF/ESF_Copy_On_Read.cpp: + * orbsvcs/orbsvcs/ESF/ESF_Copy_On_Read.h: + * orbsvcs/orbsvcs/ESF/ESF_Copy_On_Read.i: + Realize the Copy_On_Read pattern for iterations and event + dispatching + + * orbsvcs/orbsvcs/ESF/ESF_Defaults.h: + Define the default configuration values + + * orbsvcs/orbsvcs/ESF/ESF_Delayed_Changes.cpp: + * orbsvcs/orbsvcs/ESF/ESF_Delayed_Changes.h: + * orbsvcs/orbsvcs/ESF/ESF_Delayed_Changes.i: + Realize the Delayed_Changes pattern for iterations and event + dispatching + + * orbsvcs/orbsvcs/ESF/ESF_Delayed_Command.cpp: + * orbsvcs/orbsvcs/ESF/ESF_Delayed_Command.h: + * orbsvcs/orbsvcs/ESF/ESF_Delayed_Command.i: + Implement the Command objects used in Delayed_Changes + + * orbsvcs/orbsvcs/ESF/ESF_Immediate_Changes.cpp: + * orbsvcs/orbsvcs/ESF/ESF_Immediate_Changes.h: + * orbsvcs/orbsvcs/ESF/ESF_Immediate_Changes.i: + Realize the Immediate_Changes pattern for iterations and event + dispatching + + * orbsvcs/orbsvcs/ESF/ESF_Peer_Admin.cpp: + * orbsvcs/orbsvcs/ESF/ESF_Peer_Admin.h: + * orbsvcs/orbsvcs/ESF/ESF_Peer_Admin.i: + Implement a Proxy Admin class that 'matches' suppliers and + consumers (Peers) + + * orbsvcs/orbsvcs/ESF/ESF_Peer_Workers.cpp: + * orbsvcs/orbsvcs/ESF/ESF_Peer_Workers.h: + * orbsvcs/orbsvcs/ESF/ESF_Peer_Workers.i: + Generic workers to implement Peer_Admin + + * orbsvcs/orbsvcs/ESF/ESF_Proxy_Admin.cpp: + * orbsvcs/orbsvcs/ESF/ESF_Proxy_Admin.h: + * orbsvcs/orbsvcs/ESF/ESF_Proxy_Admin.i: + Implement a generic Admin interface for an Event Service + + * orbsvcs/orbsvcs/ESF/ESF_Proxy_Collection.cpp: + * orbsvcs/orbsvcs/ESF/ESF_Proxy_Collection.h: + * orbsvcs/orbsvcs/ESF/ESF_Proxy_Collection.i: + Define the interface used for the Proxy collections + + * orbsvcs/orbsvcs/ESF/ESF_Proxy_List.cpp: + * orbsvcs/orbsvcs/ESF/ESF_Proxy_List.h: + * orbsvcs/orbsvcs/ESF/ESF_Proxy_List.i: + Implement a concrete Proxy collection, based on a linked list + + * orbsvcs/orbsvcs/ESF/ESF_Proxy_RB_Tree.cpp: + * orbsvcs/orbsvcs/ESF/ESF_Proxy_RB_Tree.h: + * orbsvcs/orbsvcs/ESF/ESF_Proxy_RB_Tree.i: + Implement a concrete Proxy collection, based on a RB-tree + + * orbsvcs/orbsvcs/ESF/ESF_Shutdown_Proxy.cpp: + * orbsvcs/orbsvcs/ESF/ESF_Shutdown_Proxy.h: + * orbsvcs/orbsvcs/ESF/ESF_Shutdown_Proxy.i: + A worker object to invoke shutdown() on the proxies + + * orbsvcs/orbsvcs/ESF/ESF_Worker.cpp: + * orbsvcs/orbsvcs/ESF/ESF_Worker.h: + * orbsvcs/orbsvcs/ESF/ESF_Worker.i: + Define the Worker interface + + * orbsvcs/orbsvcs/ETCL/README: + A parser for the Extended Trader Constraint Language. + + * orbsvcs/orbsvcs/ETCL/ETCL.ll: + The flex(1) file for the ETCL language + + * orbsvcs/orbsvcs/ETCL/ETCL.yy: + The bison(1) file for the ETCL language + + * orbsvcs/orbsvcs/ETCL/ETCL_Constraint.h: + * orbsvcs/orbsvcs/ETCL/ETCL_Constraint.i: + * orbsvcs/orbsvcs/ETCL/ETCL_Constraint.cpp: + The parser generates an abstract syntax tree, the nodes in the + tree are implemented here. + We use the familiar Visitor pattern to traverse the tree, only + the Visitor interface is defined, applications must provide + interesting ones. + + * orbsvcs/orbsvcs/ETCL/ETCL_l.cpp: + * orbsvcs/orbsvcs/ETCL/ETCL_y.h: + * orbsvcs/orbsvcs/ETCL/ETCL_y.cpp: + * orbsvcs/orbsvcs/ETCL/ETCL_l.cpp.diff: + The generated files with the required patches. + Sat Feb 26 17:29:50 2000 Darrell Brunsch * orbsvcs/orbsvcs/orbsvcs.dsp: Added dependencies for tao_idl diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Busy_Lock.cpp b/TAO/orbsvcs/orbsvcs/ESF/ESF_Busy_Lock.cpp new file mode 100644 index 00000000000..a4e11e8837a --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Busy_Lock.cpp @@ -0,0 +1,62 @@ +// $Id$ + +#ifndef TAO_ESF_BUSY_LOCK_CPP +#define TAO_ESF_BUSY_LOCK_CPP + +#include "ESF_Busy_Lock.h" + +#if ! defined (__ACE_INLINE__) +#include "ESF_Busy_Lock.i" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ESF, ESF_Busy_Lock, "$Id$") + +template +int TAO_ESF_Busy_Lock_Adapter::remove (void) +{ + return 0; +} + +template +int TAO_ESF_Busy_Lock_Adapter::acquire (void) +{ + return this->adaptee_->busy (); +} + +template +int TAO_ESF_Busy_Lock_Adapter::tryacquire (void) +{ + return this->adaptee_->busy (); +} + +template +int TAO_ESF_Busy_Lock_Adapter::release (void) +{ + return this->adaptee_->idle (); +} + +template +int TAO_ESF_Busy_Lock_Adapter::acquire_read (void) +{ + return this->adaptee_->busy (); +} + +template +int TAO_ESF_Busy_Lock_Adapter::acquire_write (void) +{ + return this->adaptee_->busy (); +} + +template +int TAO_ESF_Busy_Lock_Adapter::tryacquire_read (void) +{ + return this->adaptee_->busy (); +} + +template +int TAO_ESF_Busy_Lock_Adapter::tryacquire_write (void) +{ + return this->adaptee_->busy (); +} + +#endif /* TAO_ESF_BUSY_LOCK_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Busy_Lock.h b/TAO/orbsvcs/orbsvcs/ESF/ESF_Busy_Lock.h new file mode 100644 index 00000000000..dc102a2cd69 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Busy_Lock.h @@ -0,0 +1,61 @@ +/* -*- C++ -*- */ +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// ORBSVCS Event Service Framework +// +// = FILENAME +// ESF_Busy_Lock +// +// = AUTHOR +// Carlos O'Ryan (coryan@cs.wustl.edu) +// +// ============================================================================ + +#ifndef TAO_ESF_BUSY_LOCK_H +#define TAO_ESF_BUSY_LOCK_H + +#include "ace/OS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +template +class TAO_ESF_Busy_Lock_Adapter +{ +public: + TAO_ESF_Busy_Lock_Adapter (Adaptee* adaptee); + // Constructor + + // = The ACE_Lock methods, please check $ACE_ROOT/ace/Synch.h for + // details. + + int remove (void); + int acquire (void); + int tryacquire (void); + int release (void); + int acquire_read (void); + int acquire_write (void); + int tryacquire_read (void); + int tryacquire_write (void); + +private: + Adaptee* adaptee_; +}; + +#if defined (__ACE_INLINE__) +#include "ESF_Busy_Lock.i" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ESF_Busy_Lock.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("ESF_Busy_Lock.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* TAO_ESF_BUSY_LOCK_H */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Busy_Lock.i b/TAO/orbsvcs/orbsvcs/ESF/ESF_Busy_Lock.i new file mode 100644 index 00000000000..6723e66b926 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Busy_Lock.i @@ -0,0 +1,8 @@ +// $Id$ + +template ACE_INLINE +TAO_ESF_Busy_Lock_Adapter::TAO_ESF_Busy_Lock_Adapter (T* adaptee) + : adaptee_ (adaptee) +{ +} + diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Copy_On_Read.cpp b/TAO/orbsvcs/orbsvcs/ESF/ESF_Copy_On_Read.cpp new file mode 100644 index 00000000000..703542b5a9d --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Copy_On_Read.cpp @@ -0,0 +1,82 @@ +// $Id$ + +#ifndef TAO_ESF_COPY_ON_READ_CPP +#define TAO_ESF_COPY_ON_READ_CPP + +#include "ESF_Copy_On_Read.h" + +#if ! defined (__ACE_INLINE__) +#include "ESF_Proxy_Collection.i" +#endif /* __ACE_INLINE__ */ + +#include "ESF_Worker.h" + +ACE_RCSID(ESF, ESF_Copy_On_Read, "$Id$") + +template +TAO_ESF_Copy_On_Read:: + TAO_ESF_Copy_On_Read (void) +{ +} + +template +TAO_ESF_Copy_On_Read:: + TAO_ESF_Copy_On_Read (const COLLECTION &collection) + : collection_ (collection) +{ +} + +template void +TAO_ESF_Copy_On_Read:: + for_each (TAO_ESF_Worker *worker, + CORBA::Environment &ACE_TRY_ENV) +{ + // @@ Use an allocator for this memory... + PROXY **proxies = 0; + size_t size = 0; + ACE_TRY + { + { + ACE_GUARD (ACE_LOCK, ace_mon, this->lock_); + + size = this->collection_.size (); + ACE_NEW (proxies, PROXY*[size]); + PROXY **j = proxies; + + for (; j != proxies + size; ++j) + *j = 0; + + j = proxies; + ITERATOR end = this->collection_.end (); + for (ITERATOR i = this->collection_.begin (); i != end; ++i) + { + *j = *i; + (*j)->_incr_refcnt (); + ++j; + } + } + + for (PROXY **j = proxies; j != proxies + size; ++j) + { + worker->work (*j, ACE_TRY_ENV); + ACE_TRY_CHECK; + (*j)->_decr_refcnt (); + } + delete[] proxies; + } + ACE_CATCHANY + { + for (PROXY **j = proxies; j != proxies + size; ++j) + { + if (*j != 0) + (*j)->_decr_refcnt (); + } + delete[] proxies; + + ACE_RETHROW; + } + ACE_ENDTRY; +} + +#endif /* TAO_ESF_COPY_ON_READ_CPP */ + diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Copy_On_Read.h b/TAO/orbsvcs/orbsvcs/ESF/ESF_Copy_On_Read.h new file mode 100644 index 00000000000..5bf008a8c5a --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Copy_On_Read.h @@ -0,0 +1,82 @@ +/* -*- C++ -*- */ +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// ORBSVCS Event Service Framework +// +// = FILENAME +// ESF_Proxy_Collection +// +// = AUTHOR +// Carlos O'Ryan (coryan@cs.wustl.edu) +// +// = CREDITS +// http://www.cs.wustl.edu/~coryan/EC/index.html +// +// ============================================================================ + +#ifndef TAO_ESF_COPY_ON_READ_H +#define TAO_ESF_COPY_ON_READ_H + +#include "ESF_Proxy_Collection.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +template class TAO_ESF_Worker; + +// **************************************************************** + +template +class TAO_ESF_Copy_On_Read : public TAO_ESF_Proxy_Collection +{ + // = TITLE + // TAO_ESF_Copy_On_Read + // + // = DESCRIPTION + // Implement the Copy_On_Read protocol + // The class is parametric on the kind of collection and locking + // mechanism used. + // + // = TODO + // +public: + TAO_ESF_Copy_On_Read (void); + TAO_ESF_Copy_On_Read (const COLLECTION &collection); + // Constructors + + // = The TAO_ESF_Proxy methods + virtual void for_each (TAO_ESF_Worker *worker, + CORBA::Environment &ACE_TRY_ENV); + virtual void connected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV); + virtual void reconnected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV); + virtual void disconnected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV); + virtual void shutdown (CORBA::Environment &ACE_TRY_ENV); + +private: + COLLECTION collection_; + + ACE_LOCK lock_; +}; + +// **************************************************************** + +#if defined (__ACE_INLINE__) +#include "ESF_Copy_On_Read.i" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ESF_Copy_On_Read.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("ESF_Copy_On_Read.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* TAO_ESF_COPY_ON_READ_H */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Copy_On_Read.i b/TAO/orbsvcs/orbsvcs/ESF/ESF_Copy_On_Read.i new file mode 100644 index 00000000000..ba1cbb48e25 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Copy_On_Read.i @@ -0,0 +1,42 @@ +// $Id$ + +template void +TAO_ESF_Copy_On_Read:: + connected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_GUARD (L, ace_mon, this->lock_); + + proxy->_incr_refcnt (); + this->collection_.connected (proxy, ACE_TRY_ENV); +} + +template void +TAO_ESF_Copy_On_Read:: + reconnected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_GUARD (L, ace_mon, this->lock_); + + proxy->_incr_refcnt (); + this->collection_.reconnected (proxy, ACE_TRY_ENV); +} + +template void +TAO_ESF_Copy_On_Read:: + disconnected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_GUARD (L, ace_mon, this->lock_); + + this->collection_.disconnected (proxy, ACE_TRY_ENV); +} + +template void +TAO_ESF_Copy_On_Read:: + shutdown (CORBA::Environment &ACE_TRY_ENV) +{ + ACE_GUARD (L, ace_mon, this->lock_); + + this->collection_.shutdown (ACE_TRY_ENV); +} diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Defaults.h b/TAO/orbsvcs/orbsvcs/ESF/ESF_Defaults.h new file mode 100644 index 00000000000..77846dcee44 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Defaults.h @@ -0,0 +1,42 @@ +/* -*- C++ -*- */ +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// ORBSVCS Event Service Framework +// +// = FILENAME +// ESF_Defaults +// +// = DESCRIPTION +// In this file we set the compile time defaults for the framework. +// +// = AUTHOR +// Carlos O'Ryan (coryan@cs.wustl.edu) +// +// ============================================================================ + +#ifndef TAO_ESF_DEFAULTS_H +#define TAO_ESF_DEFAULTS_H + +#ifndef TAO_ESF_ENABLE_DEBUG_MESSAGES +#define TAO_ESF_ENABLE_DEBUG_MESSAGES 0 +#endif /* TAO_ESF_ENABLE_DEBUG_MESSAGES */ + +// Control the maximum degree of concurrency tolerated by the EC, some +// kind of limit is required to avoid starvation of delayed write +// operations. +#ifndef TAO_ESF_DEFAULT_BUSY_HWM +# define TAO_ESF_DEFAULT_BUSY_HWM 1024 +#endif /* TAO_ESF_DEFAULT_BUSY_HWM */ + +#ifndef TAO_ESF_DEFAULT_MAX_WRITE_DELAY +# define TAO_ESF_DEFAULT_MAX_WRITE_DELAY 2048 +#endif /* TAO_ESF_DEFAULT_MAX_WRITE_DELAY */ + +#ifndef TAO_ESF_DEFAULT_ORB_ID +# define TAO_ESF_DEFAULT_ORB_ID "" /* */ +#endif /* TAO_ESF_DEFAULT_ORB_ID */ + +#endif /* TAO_ESF_DEFAULTS_H */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Changes.cpp b/TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Changes.cpp new file mode 100644 index 00000000000..9dd18a0b5a1 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Changes.cpp @@ -0,0 +1,206 @@ +// $Id$ + +#ifndef TAO_ESF_DELAYED_CHANGES_CPP +#define TAO_ESF_DELAYED_CHANGES_CPP + +#include "ESF_Delayed_Changes.h" + +#if ! defined (__ACE_INLINE__) +#include "ESF_Proxy_Collection.i" +#endif /* __ACE_INLINE__ */ + +#include "ESF_Defaults.h" +#include "ESF_Worker.h" +#include "ESF_Delayed_Command.h" + +ACE_RCSID(ESF, ESF_Immediate_Changes, "$Id$") + +// **************************************************************** + +template +TAO_ESF_Delayed_Changes:: + TAO_ESF_Delayed_Changes (void) + : lock_ (this), + busy_cond_ (busy_lock_), + busy_count_ (0), + write_delay_count_ (0), + busy_hwm_ (TAO_ESF_DEFAULT_BUSY_HWM), + max_write_delay_ (TAO_ESF_DEFAULT_MAX_WRITE_DELAY) +{ +} + +template +TAO_ESF_Delayed_Changes:: + TAO_ESF_Delayed_Changes (const COLLECTION &collection) + : collection_ (collection), + lock_ (this), + busy_cond_ (busy_lock_), + busy_count_ (0), + write_delay_count_ (0), + busy_hwm_ (TAO_ESF_DEFAULT_BUSY_HWM), + max_write_delay_ (TAO_ESF_DEFAULT_MAX_WRITE_DELAY) +{ +} + +template void +TAO_ESF_Delayed_Changes:: + for_each (TAO_ESF_Worker *worker, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_GUARD (Busy_Lock, ace_mon, this->lock_); + + ITERATOR end = this->collection_.end (); + for (ITERATOR i = this->collection_.begin (); i != end; ++i) + { + worker->work (*i, ACE_TRY_ENV); + ACE_CHECK; + } +} + +template int +TAO_ESF_Delayed_Changes:: + busy (void) +{ + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->busy_lock_, -1); + + while (this->busy_count_ >= this->busy_hwm_ + || this->write_delay_count_ >= this->max_write_delay_) + this->busy_cond_.wait (); + this->busy_count_++; + + return 0; +} + +template int +TAO_ESF_Delayed_Changes:: + idle (void) +{ + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->busy_lock_, -1); + + this->busy_count_--; + if (this->busy_count_ == 0) + { + this->write_delay_count_ = 0; + this->execute_delayed_operations (); + this->busy_cond_.broadcast (); + } + return 0; +} + +template int +TAO_ESF_Delayed_Changes:: + execute_delayed_operations (void) +{ + while (!this->command_queue_.is_empty ()) + { + ACE_Command_Base* command; + this->command_queue_.dequeue_head (command); + + command->execute (); + + delete command; + } + return 0; +} + +template void +TAO_ESF_Delayed_Changes:: + connected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_GUARD_THROW_EX (ACE_SYNCH_MUTEX_T, ace_mon, this->busy_lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + + proxy->_incr_refcnt (); + if (this->busy_count_ == 0) + { + // We can add the object immediately + this->connected_i (proxy, ACE_TRY_ENV); + } + else + { + ACE_Command_Base* command; + ACE_NEW (command, + Connected_Command (this, + proxy)); + this->command_queue_.enqueue_tail (command); + this->write_delay_count_++; + } +} + +template void +TAO_ESF_Delayed_Changes:: + reconnected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_GUARD_THROW_EX (ACE_SYNCH_MUTEX_T, ace_mon, this->busy_lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + + proxy->_incr_refcnt (); + if (this->busy_count_ == 0) + { + // We can reconnect the object immediately + this->reconnected_i (proxy, ACE_TRY_ENV); + } + else + { + ACE_Command_Base* command; + ACE_NEW (command, + Reconnected_Command (this, + proxy)); + this->command_queue_.enqueue_tail (command); + this->write_delay_count_++; + } +} + +template void +TAO_ESF_Delayed_Changes:: + disconnected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_GUARD_THROW_EX (ACE_SYNCH_MUTEX_T, ace_mon, this->busy_lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + + if (this->busy_count_ == 0) + { + // We can remove the object immediately + this->disconnected_i (proxy, ACE_TRY_ENV); + } + else + { + ACE_Command_Base* command; + ACE_NEW (command, + Disconnected_Command (this, + proxy)); + this->command_queue_.enqueue_tail (command); + this->write_delay_count_++; + } +} + +template void +TAO_ESF_Delayed_Changes:: + shutdown (CORBA::Environment &ACE_TRY_ENV) +{ + ACE_GUARD_THROW_EX (ACE_SYNCH_MUTEX_T, ace_mon, this->busy_lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + + if (this->busy_count_ == 0) + { + // We can shutdown the object immediately + this->shutdown_i (ACE_TRY_ENV); + } + else + { + ACE_Command_Base* command; + ACE_NEW (command, + Shutdown_Command (this)); + this->command_queue_.enqueue_tail (command); + this->write_delay_count_++; + } +} + +#endif /* TAO_ESF_DELAYED_CHANGES_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Changes.h b/TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Changes.h new file mode 100644 index 00000000000..6b9bf11ff0a --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Changes.h @@ -0,0 +1,161 @@ +/* -*- C++ -*- */ +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// ORBSVCS Event Service Framework +// +// = FILENAME +// ESF_Proxy_Collection +// +// = AUTHOR +// Carlos O'Ryan (coryan@cs.wustl.edu) +// +// = CREDITS +// http://www.cs.wustl.edu/~coryan/EC/index.html +// +// ============================================================================ + +#ifndef TAO_ESF_DELAYED_CHANGES_H +#define TAO_ESF_DELAYED_CHANGES_H + +#include "ESF_Proxy_Collection.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ESF_Busy_Lock.h" +#include "ace/Containers.h" + +template class TAO_ESF_Connected_Command; +template class TAO_ESF_Disconnected_Command; +template class TAO_ESF_Reconnected_Command; +template class TAO_ESF_Shutdown_Command; + +template +class TAO_ESF_Delayed_Changes : public TAO_ESF_Proxy_Collection +{ + // = TITLE + // TAO_ESF_Delayed_Operations + // + // = DESCRIPTION + // This class implements the Delayed Operations protocol to solve + // the concurrency challenges outlined in the documentation of + // TAO_ESF_Proxy_Collection. + // In short the class delays changes by putting them on an + // "operation queue", the operations are stored as command objects + // in this queue and executed once the system is quiescent + // (i.e. no threads are iterating over the collection). + // + // The algorithm implemented so far is: + // - If a thread is using the set then it increases the busy + // count, this is done by calling the busy() method. Once the + // thread has stopped using the collection the idle() method is + // invoked and the busy count is decreased. + // A helper class (Busy_Lock) is used to hide this protocol + // behind the familiar GUARD idiom. + // - If the busy count reaches the busy_hwm then the thread must + // wait until the count reaches 0 again. + // This can be used to control the maximum concurrency in the + // EC, matching it (for example) with the number of + // processors. Setting the concurrency to a high value (say one + // million) allows for an arbitrary number of threads to execute + // concurrently. + // - If a modification is posted to the collection we need to + // execute it at some point. + // Just using the busy_hwm would not work, the HWM may not be + // reached ever, so another form of control is needed. + // Instead we use another counter, that keeps track of how many + // threads have used the set since the modification was + // posted. If this number of threads reaches max_write_delay then + // we don't allow any more threads to go in, eventually the + // thread count reaches 0 and we can proceed with the operations. + // + // - There is one aspect of concurrency that can be problematic: if + // thread pushes events as part of an upcall then the same thread + // could be counted twice, we need to keep track of the threads + // that are dispatching events and not increase (or decrease) the + // reference count when a thread iterates twice over the same + // set. + // + // This solves the major problems, but there are other issues to + // be addressed: + // + How do we ensure that the operations are eventually executed? + // + How do we simplify the execution of the locking protocol for + // clients of this class? + // + How do we minimize overhead for single threaded execution? + // + How do we minimize the overhead for the cases where the + // threads dispatching events don't post changes to the + // collection? + // +public: + TAO_ESF_Delayed_Changes (void); + TAO_ESF_Delayed_Changes (const COLLECTION &collection); + + int busy (void); + int idle (void); + int execute_delayed_operations (void); + + void connected_i (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV); + void reconnected_i (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV); + void disconnected_i (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV); + void shutdown_i (CORBA::Environment &ACE_TRY_ENV); + + typedef TAO_ESF_Connected_Command,PROXY> Connected_Command; + typedef TAO_ESF_Reconnected_Command,PROXY> Reconnected_Command; + typedef TAO_ESF_Disconnected_Command,PROXY> Disconnected_Command; + typedef TAO_ESF_Shutdown_Command > Shutdown_Command; + + // = The TAO_ESF_Proxy methods + virtual void for_each (TAO_ESF_Worker *worker, + CORBA::Environment &ACE_TRY_ENV); + virtual void connected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV); + virtual void reconnected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV); + virtual void disconnected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV); + virtual void shutdown (CORBA::Environment &ACE_TRY_ENV); + +private: + COLLECTION collection_; + + typedef TAO_ESF_Busy_Lock_Adapter > Busy_Lock; + + Busy_Lock lock_; + + ACE_SYNCH_MUTEX_T busy_lock_; + + ACE_SYNCH_CONDITION_T busy_cond_; + + CORBA::ULong busy_count_; + + CORBA::ULong write_delay_count_; + + CORBA::ULong busy_hwm_; + CORBA::ULong max_write_delay_; + // Control variables for the concurrency policies. + + ACE_Unbounded_Queue command_queue_; +}; + +// **************************************************************** + +#if defined (__ACE_INLINE__) +#include "ESF_Delayed_Changes.i" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ESF_Delayed_Changes.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("ESF_Delayed_Changes.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* TAO_ESF_DELAYED_CHANGES_H */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Changes.i b/TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Changes.i new file mode 100644 index 00000000000..b6511ed1a28 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Changes.i @@ -0,0 +1,32 @@ +// $Id$ + +template void +TAO_ESF_Delayed_Changes:: + connected_i (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV) +{ + this->collection_.connected (proxy, ACE_TRY_ENV); +} + +template void +TAO_ESF_Delayed_Changes:: + reconnected_i (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV) +{ + this->collection_.reconnected (proxy, ACE_TRY_ENV); +} + +template void +TAO_ESF_Delayed_Changes:: + disconnected_i (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV) +{ + this->collection_.disconnected (proxy, ACE_TRY_ENV); +} + +template void +TAO_ESF_Delayed_Changes:: + shutdown_i (CORBA::Environment &ACE_TRY_ENV) +{ + this->collection_.shutdown (ACE_TRY_ENV); +} diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Command.cpp b/TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Command.cpp new file mode 100644 index 00000000000..8f2a176d4ab --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Command.cpp @@ -0,0 +1,66 @@ +// $Id$ + +#ifndef TAO_ESF_DELAYED_COMMAND_CPP +#define TAO_ESF_DELAYED_COMMAND_CPP + +#include "ESF_Delayed_Command.h" + +#if ! defined (__ACE_INLINE__) +#include "ESF_Delayed_Command.i" +#endif /* __ACE_INLINE__ */ + +#include "tao/corba.h" + +ACE_RCSID(ESF, ESF_Delayed_Command, "$Id$") + +template int +TAO_ESF_Connected_Command::execute (void* arg) +{ + CORBA::Environment *env = &TAO_default_environment (); + if (arg != 0) + env = ACE_static_cast(CORBA::Environment*, arg); + + this->target_->connected_i (this->object_, *env); + return 0; +} + +// **************************************************************** + +template int +TAO_ESF_Reconnected_Command::execute (void* arg) +{ + CORBA::Environment *env = &TAO_default_environment (); + if (arg != 0) + env = ACE_static_cast(CORBA::Environment*, arg); + + this->target_->reconnected_i (this->object_, *env); + return 0; +} + +// **************************************************************** + +template int +TAO_ESF_Disconnected_Command::execute (void* arg) +{ + CORBA::Environment *env = &TAO_default_environment (); + if (arg != 0) + env = ACE_static_cast(CORBA::Environment*, arg); + + this->target_->disconnected_i (this->object_, *env); + return 0; +} + +// **************************************************************** + +template int +TAO_ESF_Shutdown_Command::execute (void* arg) +{ + CORBA::Environment *env = &TAO_default_environment (); + if (arg != 0) + env = ACE_static_cast(CORBA::Environment*, arg); + + this->target_->shutdown_i (*env); + return 0; +} + +#endif /* TAO_ESF_DELAYED_COMMAND_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Command.h b/TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Command.h new file mode 100644 index 00000000000..b66259c2c4e --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Command.h @@ -0,0 +1,198 @@ +/* -*- C++ -*- */ +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// ORBSVCS Event Service Framework +// +// = FILENAME +// ESF_Delayed_Command +// +// = AUTHOR +// Carlos O'Ryan (coryan@cs.wustl.edu) +// +// ============================================================================ + +#ifndef TAO_ESF_DELAYED_COMMAND_H +#define TAO_ESF_DELAYED_COMMAND_H + +#include "ace/Functor.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +template +class TAO_ESF_Connected_Command : public ACE_Command_Base +{ + // = TITLE + // ESF_Connected_Command + // + // = DESCRIPTION + // Implements a Command object that invokes the connected_i() method + // on the target, passing an argument of type Object. + // + // = MEMORY MANAGMENT + // It does not assume ownership of Object nor the Target + // arguments. + // Usually allocated from the heap or an allocator; but it is not + // self-managed. + // + // = LOCKING + // No provisions for locking, access must be serialized + // externally. + // + // = TODO + // +public: + TAO_ESF_Connected_Command (Target *target, + Object *object); + // constructor... + + virtual int execute (void *arg); + // The callback method, if the argument is not nil it is interpreted + // as a CORBA::Environment. + +private: + Target *target_; + // The target + + Object *object_; + // The argument +}; + +// **************************************************************** + +template +class TAO_ESF_Reconnected_Command : public ACE_Command_Base +{ + // = TITLE + // ESF_Reconnected_Command + // + // = DESCRIPTION + // Implements a Command object that invokes the reconnected_i() method + // on the target, passing an argument of type Object. + // + // = MEMORY MANAGMENT + // It does not assume ownership of Object nor the Target + // arguments. + // Usually allocated from the heap or an allocator; but it is not + // self-managed. + // + // = LOCKING + // No provisions for locking, access must be serialized + // externally. + // + // = TODO + // +public: + TAO_ESF_Reconnected_Command (Target *target, + Object *object); + // constructor... + + virtual int execute (void *arg); + // The callback method, if the argument is not nil it is interpreted + // as a CORBA::Environment. + +private: + Target *target_; + // The target + + Object *object_; + // The argument +}; + +// **************************************************************** + +template +class TAO_ESF_Disconnected_Command : public ACE_Command_Base +{ + // = TITLE + // ESF_Disconnected_Command + // + // = DESCRIPTION + // Implements a Command object that invokes the disconnected_i() + // method on the target, passing an argument of type Object. + // + // = MEMORY MANAGMENT + // It does not assume ownership of Object nor the Target + // arguments. + // Usually allocated from the heap or an allocator; but it is not + // self-managed. + // + // = LOCKING + // No provisions for locking, access must be serialized + // externally. + // + // = TODO + // +public: + TAO_ESF_Disconnected_Command (Target *target, + Object *object); + // constructor... + + virtual int execute (void *arg); + // The callback method, if the argument is not nil it is interpreted + // as a CORBA::Environment. + +private: + Target *target_; + // The target + + Object *object_; + // The argument +}; + +// **************************************************************** + +template +class TAO_ESF_Shutdown_Command : public ACE_Command_Base +{ + // = TITLE + // ESF_Shutdown_Command + // + // = DESCRIPTION + // Implements a Command object that invokes the shutdown_i() + // method on the target, passing an argument of type Object. + // + // = MEMORY MANAGMENT + // It does not assume ownership of Object nor the Target + // arguments. + // Usually allocated from the heap or an allocator; but it is not + // self-managed. + // + // = LOCKING + // No provisions for locking, access must be serialized + // externally. + // + // = TODO + // +public: + TAO_ESF_Shutdown_Command (Target *target); + // constructor... + + virtual int execute (void *arg); + // The callback method, if the argument is not nil it is interpreted + // as a CORBA::Environment. + +private: + Target *target_; + // The target +}; + +// **************************************************************** + +#if defined (__ACE_INLINE__) +#include "ESF_Delayed_Command.i" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ESF_Delayed_Command.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("ESF_Delayed_Command.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* TAO_ESF_DELAYED_COMMAND_H */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Command.i b/TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Command.i new file mode 100644 index 00000000000..5465f38c4bd --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Delayed_Command.i @@ -0,0 +1,41 @@ +// $Id$ + +template +TAO_ESF_Connected_Command:: + TAO_ESF_Connected_Command (Target *target, + Object *object) + : target_ (target), + object_ (object) +{ +} + +// **************************************************************** + +template +TAO_ESF_Reconnected_Command:: + TAO_ESF_Reconnected_Command (Target *target, + Object *object) + : target_ (target), + object_ (object) +{ +} + +// **************************************************************** + +template +TAO_ESF_Disconnected_Command:: + TAO_ESF_Disconnected_Command (Target *target, + Object *object) + : target_ (target), + object_ (object) +{ +} + +// **************************************************************** + +template +TAO_ESF_Shutdown_Command:: + TAO_ESF_Shutdown_Command (Target *target) + : target_ (target) +{ +} diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Immediate_Changes.cpp b/TAO/orbsvcs/orbsvcs/ESF/ESF_Immediate_Changes.cpp new file mode 100644 index 00000000000..a41c7eabdb0 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Immediate_Changes.cpp @@ -0,0 +1,46 @@ +// $Id$ + +#ifndef TAO_ESF_IMMEDIATE_CHANGES_CPP +#define TAO_ESF_IMMEDIATE_CHANGES_CPP + +#include "ESF_Immediate_Changes.h" + +#if ! defined (__ACE_INLINE__) +#include "ESF_Proxy_Collection.i" +#endif /* __ACE_INLINE__ */ + +#include "ESF_Worker.h" + +ACE_RCSID(ESF, ESF_Immediate_Changes, "$Id$") + +// **************************************************************** + +template +TAO_ESF_Immediate_Changes:: + TAO_ESF_Immediate_Changes (void) +{ +} + +template +TAO_ESF_Immediate_Changes:: + TAO_ESF_Immediate_Changes (const COLLECTION &collection) + : collection_ (collection) +{ +} + +template void +TAO_ESF_Immediate_Changes:: + for_each (TAO_ESF_Worker *worker, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_GUARD (ACE_LOCK, ace_mon, this->lock_); + + ITERATOR end = this->collection_.end (); + for (ITERATOR i = this->collection_.begin (); i != end; ++i) + { + worker->work ((*i), ACE_TRY_ENV); + ACE_CHECK; + } +} + +#endif /* TAO_ESF_IMMEDIATE_CHANGES_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Immediate_Changes.h b/TAO/orbsvcs/orbsvcs/ESF/ESF_Immediate_Changes.h new file mode 100644 index 00000000000..89d35b9f71d --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Immediate_Changes.h @@ -0,0 +1,72 @@ +/* -*- C++ -*- */ +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// ORBSVCS Event Service Framework +// +// = FILENAME +// ESF_Proxy_Collection +// +// = AUTHOR +// Carlos O'Ryan (coryan@cs.wustl.edu) +// +// = CREDITS +// http://www.cs.wustl.edu/~coryan/EC/index.html +// +// ============================================================================ + +#ifndef TAO_ESF_IMMEDIATE_CHANGES_H +#define TAO_ESF_IMMEDIATE_CHANGES_H + +#include "ESF_Proxy_Collection.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +template +class TAO_ESF_Immediate_Changes : public TAO_ESF_Proxy_Collection +{ + // = TITLE + // TAO_ESF_Immediate_Changes + // + // = DESCRIPTION + // Implement the Immediate_ +public: + TAO_ESF_Immediate_Changes (void); + TAO_ESF_Immediate_Changes (const COLLECTION &collection); + + // = The TAO_ESF_Proxy methods + virtual void for_each (TAO_ESF_Worker *worker, + CORBA::Environment &ACE_TRY_ENV); + virtual void connected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV); + virtual void reconnected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV); + virtual void disconnected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV); + virtual void shutdown (CORBA::Environment &ACE_TRY_ENV); + +private: + COLLECTION collection_; + + ACE_LOCK lock_; +}; + +// **************************************************************** + +#if defined (__ACE_INLINE__) +#include "ESF_Immediate_Changes.i" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ESF_Immediate_Changes.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("ESF_Immediate_Changes.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* TAO_ESF_IMMEDIATE_CHANGES_H */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Immediate_Changes.i b/TAO/orbsvcs/orbsvcs/ESF/ESF_Immediate_Changes.i new file mode 100644 index 00000000000..7ffce621b6b --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Immediate_Changes.i @@ -0,0 +1,43 @@ +// $Id$ + +template void +TAO_ESF_Immediate_Changes:: + connected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_GUARD (L, ace_mon, this->lock_); + + proxy->_incr_refcnt (); + this->collection_.connected (proxy, ACE_TRY_ENV); +} + +template void +TAO_ESF_Immediate_Changes:: + reconnected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_GUARD (L, ace_mon, this->lock_); + + proxy->_incr_refcnt (); + this->collection_.reconnected (proxy, ACE_TRY_ENV); +} + +template void +TAO_ESF_Immediate_Changes:: + disconnected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_GUARD (L, ace_mon, this->lock_); + + this->collection_.disconnected (proxy, ACE_TRY_ENV); +} + +template void +TAO_ESF_Immediate_Changes:: + shutdown (CORBA::Environment &ACE_TRY_ENV) +{ + ACE_GUARD (L, ace_mon, this->lock_); + + this->collection_.shutdown (ACE_TRY_ENV); +} + diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Admin.cpp b/TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Admin.cpp new file mode 100644 index 00000000000..b8df55d9d0b --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Admin.cpp @@ -0,0 +1,46 @@ +// $Id$ + +#ifndef TAO_ESF_PEER_ADMIN_CPP +#define TAO_ESF_PEER_ADMIN_CPP + +#include "ESF_Peer_Admin.h" + +#if ! defined (__ACE_INLINE__) +#include "ESF_Peer_Admin.i" +#endif /* __ACE_INLINE__ */ + +#include "ESF_Peer_Workers.h" + +ACE_RCSID(ESF, ESF_Peer_Admin, "$Id$") + +template void +TAO_ESF_Peer_Admin::peer_connected (PEER *peer, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC (()) +{ + TAO_ESF_Peer_Connected worker (peer); + + this->for_each (&worker, ACE_TRY_ENV); +} + +template void +TAO_ESF_Peer_Admin::peer_reconnected (PEER *peer, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC (()) +{ + TAO_ESF_Peer_Reconnected worker (peer); + + this->for_each (&worker, ACE_TRY_ENV); +} + +template void +TAO_ESF_Peer_Admin::peer_disconnected (PEER *peer, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC (()) +{ + TAO_ESF_Peer_Disconnected worker (peer); + + this->for_each (&worker, ACE_TRY_ENV); +} + +#endif /* TAO_ESF_PEER_ADMIN_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Admin.h b/TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Admin.h new file mode 100644 index 00000000000..8076f100978 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Admin.h @@ -0,0 +1,102 @@ +/* -*- C++ -*- */ +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// ORBSVCS Event Service Framework +// +// = FILENAME +// ESF_Peer_Admin +// +// = AUTHOR +// Carlos O'Ryan (coryan@cs.wustl.edu) +// +// = CREDITS +// http://www.cs.wustl.edu/~coryan/EC/index.html +// +// ============================================================================ + +#ifndef TAO_ESF_PEER_ADMIN_H +#define TAO_ESF_PEER_ADMIN_H + +#include "ESF_Proxy_Admin.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +template +class TAO_ESF_Peer_Admin : TAO_ESF_Proxy_Admin +{ + // = TITLE + // ESF_Peer_Admin + // + // = DESCRIPTION + // Some Event Services that perform filtering have to propagate + // the consumer connect/disconnect activities to the suppliers, + // and vice-versa. + // In that scenario the ESF_Proxy_Admin<> interface is augmented + // with connected()/reconnected()/disconnected() operations for + // the proxy peers (i.e. the ProxySuppliers for the ProxyConsumers + // and vice-versa). + // + // = REQUIREMENTS + // In addition to the requirements imposed by ESF_Proxy_Admin<> + // the PROXY interface must implement: + // + // void connected (PEER *peer, CORBA::Environment&) throw (); + // void reconnected (PEER *peer, CORBA::Environment&) throw (); + // void disconnected (PEER *peer, CORBA::Environment&) throw (); + // + // Similarly, the PEER interface must implement: + // + // void connected (PROXY *proxy, CORBA::Environment&) throw (); + // void reconnected (PROXY *proxy, CORBA::Environment&) throw (); + // void disconnected (PROXY *proxy, CORBA::Environment&) throw (); + // +public: + TAO_ESF_Peer_Admin (EVENT_CHANNEL *ec); + // Constructor + + virtual ~TAO_ESF_Peer_Admin (void); + // destructor + + virtual void peer_connected (PEER *peer, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC (()); + // A has connected, this is invoked when the peer's client + // has invoked the connect_xxx_yyy() method. + // The default implementation is a no-op. + + virtual void peer_reconnected (PEER *peer, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC (()); + // A has reconnected, i.e. its client has invoked the + // connect_xxx_yyy() method, but the peer was connected already. + // The default implementation delegates on the collection + // method + + virtual void peer_disconnected (PEER *peer, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC (()); + // A has been disconnected. The default implementation + // removes the object from the collection and deactivates the + // proxy. +}; + +// **************************************************************** + +#if defined (__ACE_INLINE__) +#include "ESF_Peer_Admin.i" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ESF_Peer_Admin.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("ESF_Peer_Admin.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* TAO_ESF_PEER_ADMIN_H */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Admin.i b/TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Admin.i new file mode 100644 index 00000000000..06c4aefb359 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Admin.i @@ -0,0 +1,7 @@ +// $Id$ + +template ACE_INLINE +TAO_ESF_Peer_Admin::TAO_ESF_Peer_Admin (EC *ec) + : TAO_ESF_Proxy_Admin (ec) +{ +} diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Workers.cpp b/TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Workers.cpp new file mode 100644 index 00000000000..cd5c8ca1e8c --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Workers.cpp @@ -0,0 +1,51 @@ +// $Id$ + +#ifndef TAO_ESF_PEER_WORKERS_CPP +#define TAO_ESF_PEER_WORKERS_CPP + +#include "ESF_Peer_Workers.h" + +#if ! defined (__ACE_INLINE__) +#include "ESF_Peer_Workers.i" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ESF, ESF_Peer_Workers, "$Id$") + +template void +TAO_ESF_Peer_Connected::work (P *proxy, + CORBA::Environment &ACE_TRY_ENV) +{ + proxy->connected (this->peer_, ACE_TRY_ENV); + ACE_CHECK; // Shouldn't happen, just following the discipline + + this->peer_->connected (proxy, ACE_TRY_ENV); + ACE_CHECK; // Shouldn't happen, just following the discipline +} + +// **************************************************************** + +template void +TAO_ESF_Peer_Reconnected::work (P *proxy, + CORBA::Environment &ACE_TRY_ENV) +{ + proxy->reconnected (this->peer_, ACE_TRY_ENV); + ACE_CHECK; // Shouldn't happen, just following the discipline + + this->peer_->reconnected (proxy, ACE_TRY_ENV); + ACE_CHECK; // Shouldn't happen, just following the discipline +} + +// **************************************************************** + +template void +TAO_ESF_Peer_Disconnected::work (P *proxy, + CORBA::Environment &ACE_TRY_ENV) +{ + proxy->disconnected (this->peer_, ACE_TRY_ENV); + ACE_CHECK; // Shouldn't happen, just following the discipline + + this->peer_->disconnected (proxy, ACE_TRY_ENV); + ACE_CHECK; // Shouldn't happen, just following the discipline +} + +#endif /* TAO_ESF_PEER_WORKERS_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Workers.h b/TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Workers.h new file mode 100644 index 00000000000..b1939cefd81 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Workers.h @@ -0,0 +1,107 @@ +/* -*- C++ -*- */ +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// ORBSVCS Event Service Framework +// +// = FILENAME +// ESF_Peer_Connected +// +// = AUTHOR +// Carlos O'Ryan (coryan@cs.wustl.edu) +// +// = CREDITS +// http://www.cs.wustl.edu/~coryan/EC/index.html +// +// ============================================================================ + +#ifndef TAO_ESF_PEER_WORKERS_H +#define TAO_ESF_PEER_WORKERS_H + +#include "ESF_Worker.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +template +class TAO_ESF_Peer_Connected : public TAO_ESF_Worker +{ + // = DESCRIPTION + // Helper class. + // Used to iterate over a Proxy_Collection and invoke: + // + // PROXY->connected (peer); + // peer->connected (proxy); + // +public: + TAO_ESF_Peer_Connected (PEER *peer); + + void work (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV); + +private: + PEER* peer_; +}; + +// **************************************************************** + +template +class TAO_ESF_Peer_Reconnected : public TAO_ESF_Worker +{ + // = DESCRIPTION + // Helper class. + // Used to iterate over a Proxy_Collection and invoke: + // + // PROXY->reconnected (peer); + // peer->reconnected (proxy); + // +public: + TAO_ESF_Peer_Reconnected (PEER *peer); + + void work (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV); + +private: + PEER* peer_; +}; + +// **************************************************************** + +template +class TAO_ESF_Peer_Disconnected : public TAO_ESF_Worker +{ + // = DESCRIPTION + // Helper class. + // Used to iterate over a Proxy_Collection and invoke: + // + // PROXY->disconnected (peer); + // peer->disconnected (proxy); + // +public: + TAO_ESF_Peer_Disconnected (PEER *peer); + + void work (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV); + +private: + PEER* peer_; +}; + +// **************************************************************** + +#if defined (__ACE_INLINE__) +#include "ESF_Peer_Workers.i" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ESF_Peer_Workers.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("ESF_Peer_Workers.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* TAO_ESF_PEER_WORKERS_H */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Workers.i b/TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Workers.i new file mode 100644 index 00000000000..0ff67b7692e --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Peer_Workers.i @@ -0,0 +1,25 @@ +// $Id$ + +template +TAO_ESF_Peer_Connected::TAO_ESF_Peer_Connected (R *peer) + : peer_ (peer) +{ +} + +// **************************************************************** + +template +TAO_ESF_Peer_Reconnected::TAO_ESF_Peer_Reconnected (R *peer) + : peer_ (peer) +{ +} + +// **************************************************************** + +template +TAO_ESF_Peer_Disconnected::TAO_ESF_Peer_Disconnected (R *peer) + : peer_ (peer) +{ +} + +// **************************************************************** diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Admin.cpp b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Admin.cpp new file mode 100644 index 00000000000..f0b9b6f9fb1 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Admin.cpp @@ -0,0 +1,101 @@ +// $Id$ + +#ifndef TAO_ESF_PROXY_ADMIN_CPP +#define TAO_ESF_PROXY_ADMIN_CPP + +#include "ESF_Proxy_Admin.h" + +#if ! defined (__ACE_INLINE__) +#include "ESF_Proxy_Admin.i" +#endif /* __ACE_INLINE__ */ + +#include "ESF_Shutdown_Proxy.h" + +ACE_RCSID(ESF, ESF_Proxy_Admin, "$Id$") + +template +TAO_ESF_Proxy_Admin::TAO_ESF_Proxy_Admin (EC *ec) + : event_channel_ (ec) +{ + this->event_channel_->create_proxy_collection (this->collection_); +} + +template +TAO_ESF_Proxy_Admin::~TAO_ESF_Proxy_Admin (void) +{ + this->event_channel_->destroy_proxy_collection (this->collection_); +} + +template ACE_TYPENAME PROXY::_ptr_type +TAO_ESF_Proxy_Admin::obtain (CORBA::Environment &) + ACE_THROW_SPEC (()) +{ + PROXY* proxy; + this->event_channel_->create_proxy (proxy); + + PortableServer::ServantBase_var holder = proxy; + + ACE_TYPENAME PROXY::_var_type result = + proxy->activate (ACE_TRY_ENV); + ACE_CHECK_RETURN (PROXY::Interface::_nil ()); + + this->collection_->connected (proxy, ACE_TRY_ENV); + ACE_CHECK_RETURN (PROXY::Interface::_nil ()); + + return result._retn (); +} + +template void +TAO_ESF_Proxy_Admin::shutdown (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC (()) +{ + TAO_ESF_Shutdown_Proxy

worker; + + this->collection_->for_each (&worker, ACE_TRY_ENV); + ACE_CHECK; // Cannot happen, just following the discipline. + + this->collection_->shutdown (ACE_TRY_ENV); +} + +template void +TAO_ESF_Proxy_Admin::connected (P *, + CORBA::Environment &) + ACE_THROW_SPEC (()) +{ +} + +template void +TAO_ESF_Proxy_Admin::reconnected (P *proxy, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC (()) +{ + this->collection_->reconnected (proxy, ACE_TRY_ENV); +} + +template void +TAO_ESF_Proxy_Admin::disconnected (P *proxy, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC (()) +{ + ACE_TRY + { + this->collection_->disconnected (proxy, ACE_TRY_ENV); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + // @@ In the future the collections may raise exceptions to + // report errors (such as out of memory or things like that). + // We must decide how is that info going to be used, and how + // would we propagate the exception to the application. + // For example: the CosEC has no exceptions for "out of + // resources" or something similar, and i've never seen a spec + // that has an exception for "could not acquire a mutex". + } + ACE_ENDTRY; + + proxy->deactivate (ACE_TRY_ENV); + ACE_CHECK; // Cannot happen, just following the discipline. +} + +#endif /* TAO_ESF_PROXY_ADMIN_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Admin.h b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Admin.h new file mode 100644 index 00000000000..7b04adf48fa --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Admin.h @@ -0,0 +1,134 @@ +/* -*- C++ -*- */ +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// ORBSVCS Event Service Framework +// +// = FILENAME +// ESF_Proxy_Admin +// +// = AUTHOR +// Carlos O'Ryan (coryan@cs.wustl.edu) +// +// = CREDITS +// http://www.cs.wustl.edu/~coryan/EC/index.html +// +// ============================================================================ + +#ifndef TAO_ESF_PROXY_ADMIN_H +#define TAO_ESF_PROXY_ADMIN_H + +#include "ESF_Proxy_Collection.h" +#include "ESF_Worker.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +template +class TAO_ESF_Proxy_Admin +{ + // = TITLE + // ESF_Proxy_Admin + // + // = DESCRIPTION + // Implement common tasks in the Admin interfaces. + // + // = REQUIREMENTS + // + // The EVENT_CHANNEL interface must implement: + // + // void create_proxy (PROXY*&); + // // create a new proxy + // void destroy_proxy (PROXY*); + // // destroy a proxy + // + // void create_proxy_collection (TAO_ESF_Proxy_Collection*&); + // // create a proxy collection + // void destroy_proxy_collection (TAO_ESF_Proxy_Collection*&); + // // destroy a proxy collection + // + // In addition to the requirements imposed by + // TAO_ESF_Proxy_Collection<>, the PROXY interface must define: + // + // typename .... _ptr_type; + // // The T_ptr for the IDL interface implemented by the PROXY. + // typename .... _var_type; + // // The T_var for the IDL interface implemented by the PROXY. + // + // PROXY::_ptr_type + // PROXY::activate (CORBA::Environment &) throw (); + // // activate the proxy and return the object reference + // +public: + TAO_ESF_Proxy_Admin (EVENT_CHANNEL *ec); + // Constructor + + virtual ~TAO_ESF_Proxy_Admin (void); + // destructor + + void for_each (TAO_ESF_Worker *worker, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC (()); + // Iterate over its internal collection. + + virtual ACE_TYPENAME PROXY::_ptr_type + obtain (CORBA::Environment &) + ACE_THROW_SPEC (()); + // Create a new PROXY and activate it. + + virtual void shutdown (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC (()); + // The Event Channel that owns this Admin object is going + // down. Invoke on all the proxies, cleanup the + // collection and prepare to terminate. + + virtual void connected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC (()); + // A has connected, this is invoked when the proxy's client + // has invoked the connect_xxx_yyy() method. + // The default implementation is a no-op. + + virtual void reconnected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC (()); + // A has reconnected, i.e. its client has invoked the + // connect_xxx_yyy() method, but the proxy was connected already. + // The default implementation delegates on the collection + // method + + virtual void disconnected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC (()); + // A has been disconnected. The default implementation + // removes the object from the collection and deactivates the + // proxy. + +private: + EVENT_CHANNEL *event_channel_; + // The Event Channel we belong to + + typedef TAO_ESF_Proxy_Collection Collection; + + Collection *collection_; + // The supplier container. +}; + +// **************************************************************** + +#if defined (__ACE_INLINE__) +#include "ESF_Proxy_Admin.i" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ESF_Proxy_Admin.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("ESF_Proxy_Admin.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* TAO_ESF_PROXY_ADMIN_H */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Admin.i b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Admin.i new file mode 100644 index 00000000000..9e2226e4e54 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Admin.i @@ -0,0 +1,11 @@ +// $Id$ + +template ACE_INLINE void +TAO_ESF_Proxy_Admin:: + for_each (TAO_ESF_Worker

*worker, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC (()) +{ + this->collection_->for_each (worker, ACE_TRY_ENV); +} + diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Collection.cpp b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Collection.cpp new file mode 100644 index 00000000000..797ad4df35d --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Collection.cpp @@ -0,0 +1,22 @@ +// $Id$ + +#ifndef TAO_ESF_PROXY_COLLECTION_CPP +#define TAO_ESF_PROXY_COLLECTION_CPP + +#include "ESF_Proxy_Collection.h" +#include "ESF_Worker.h" + +#if ! defined (__ACE_INLINE__) +#include "ESF_Proxy_Collection.i" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ESF, ESF_Proxy_Collection, "$Id$") + +// **************************************************************** + +template +TAO_ESF_Proxy_Collection::~TAO_ESF_Proxy_Collection (void) +{ +} + +#endif /* TAO_ESF_PROXY_COLLECTION_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Collection.h b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Collection.h new file mode 100644 index 00000000000..9f69b025d41 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Collection.h @@ -0,0 +1,184 @@ +/* -*- C++ -*- */ +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// ORBSVCS Event Service Framework +// +// = FILENAME +// ESF_Proxy_Collection +// +// = AUTHOR +// Carlos O'Ryan (coryan@cs.wustl.edu) +// +// = CREDITS +// http://www.cs.wustl.edu/~coryan/EC/index.html +// +// ============================================================================ + +#ifndef TAO_ESF_PROXY_COLLECTION_H +#define TAO_ESF_PROXY_COLLECTION_H + +#include "tao/corba.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +template class TAO_ESF_Worker; + +template +class TAO_ESF_Proxy_Collection +{ + // = TITLE + // ESF_Proxy_Collection + // + // = DESCRIPTION + // Many components in an Event Service need to keep a collection + // of proxies; these collections must be able to cope with several + // concurrency issues: + // + Some threads may need to iterate over the collection and + // invoke a method on each element. Locking the collection + // while this is done is not feasible in all cases: under some + // configurations the same thread that is iterating over the + // collection may need to make changes to the set. + // + A recursive lock does not solve the concurrency problems + // because recursive changes to the collection still invalidate + // the iterators. + // + // There are several solutions to this problem (see the VARIANTS) + // section, and there is no single one that works bests in all + // cases. As usual, we wish the strategize the protocol used to + // serialize iterations and changes to the collection. This class + // encapsulates that protocol. + // + // The usual form of the Iterator pattern does not work well in + // this case: in several variants the synchronization protocol and + // the iteration loop must collaborate to work efficiently. + // Exposing an external iterator would require that every other + // component in the system can support all the synchronization + // protocols. It is possible to hide some of that complexity + // using heavy weight iterators, but their use is ackward, + // specially since the Koening-style iterators have become more + // popular. + // + // Regular member functions are used to insert, remove and update + // members of the collection and to shutdown (i.e. perform final + // cleanup operations). + // + // The class must also collaborate with other components of the + // EC to efficiently and safely perform memory managment of the + // members in the collection. + // + // = REQUIREMENTS + // The PROXY object must be reference counted with the following + // operations: + // + // _incr_refcnt() - increment the reference count. + // _decr_refcnt() - decrement the reference count. + // + // = VARIANTS + // + // We identify several sources of variation: + // + // + Immediate_Changes: in this variant the iteration in performed + // while holding some kind of synchronization primitive, such as a + // thread mutex, a recursive mutex, a RW lock, etc. + // This is only useful in configurations where a separate thread + // dispatches the events, and thus, can only be used with real + // locks. + // + // + Copy_On_Read: before performing the iteration the collection + // is duplicated into a temporary array. Thus no locks are held + // during the iteration. This is a very expensive approach, but + // useful in many cases. + // The kind of lock is also strategized in this case. + // + // + Copy_On_Write: this is very similar to the previous approach, + // but the collection is only duplicated when a change is required + // while some thread is performing an iteration. The iteration + // continues over the original copy, while the changes are + // performed in the duplicate. The new copy of the collection is + // used for any subsequent operations, the original is discarded + // when the last thread using it completes its work. + // This approach optimizes for the case where no changes are + // is duplicated into a temporary array. Thus no locks are held + // during the iteration. This is a very expensive approach, but + // useful in many cases. + // The kind of lock is also strategized in this case. + // + // + Delayed_Changes: before starting the iteration a counter is + // incremented, this counter is used to keep track of the number + // of threads concurrently using the collection. + // If a thread wants to perform a change to the collection it must + // first verify that there are no threads iterating over it. If + // there are any threads then the thread queues the modification + // for later execution, using the Command pattern. + // The kind of lock is strategized, as this approach is used in + // single threaded configurations. + // There are two main variations: + // - An upcall can result in new dispatches: in this case we + // have to keep track of a the list of current threads using + // a Set, to avoid dead-locks. + // IMPLEMENTATION: the design is not complete, probably + // similar to the next one. + // - Otherwise we just need to control the concurrency using the + // algorithm described below. + // + // + // = MEMORY MANAGMENT + // It assumes ownership of the proxies added to the collection, + // it increases the reference count. + // + // = LOCKING + // Locking is provided by derived classes. + // + // = TODO + // +public: + virtual ~TAO_ESF_Proxy_Collection (void); + // destructor + + virtual void for_each (TAO_ESF_Worker *worker, + CORBA::Environment &ACE_TRY_ENV) = 0; + // Iterate over the collection and invoke worker->work() for each + // member of the collection. + // This encapsulates + + virtual void connected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV) = 0; + // Insert a new element into the collection. The collection assumes + // ownership of the element. + + virtual void reconnected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV) = 0; + // Insert an element into the collection. No errors can be raised + // if the element is already present. + // The collection assumes ownership, i.e. must invoke + // _decr_refcnt()> if the element is already present in the + // collection. + + virtual void disconnected (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV) = 0; + // Remove an element from the collection. + + virtual void shutdown (CORBA::Environment &ACE_TRY_ENV) = 0; + // The EC is shutting down, must release all the elements. +}; + +// **************************************************************** + +#if defined (__ACE_INLINE__) +#include "ESF_Proxy_Collection.i" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ESF_Proxy_Collection.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("ESF_Proxy_Collection.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* TAO_ESF_PROXY_COLLECTION_H */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Collection.i b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Collection.i new file mode 100644 index 00000000000..cfa1da318d3 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_Collection.i @@ -0,0 +1 @@ +// $Id$ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_List.cpp b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_List.cpp new file mode 100644 index 00000000000..5fd6f3adc5b --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_List.cpp @@ -0,0 +1,89 @@ +// $Id$ + +#ifndef TAO_ESF_PROXY_LIST_CPP +#define TAO_ESF_PROXY_LIST_CPP + +#include "ESF_Proxy_List.h" + +#if ! defined (__ACE_INLINE__) +#include "ESF_Proxy_List.i" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ESF, ESF_Proxy_List, "$Id$") + +template +TAO_ESF_Proxy_List:: + TAO_ESF_Proxy_List (void) +{ +} + +template void +TAO_ESF_Proxy_List::connected (PROXY *proxy, + CORBA::Environment &) +{ + int r = this->impl_.insert (proxy); + if (r == 0) + return; + + if (r == 1) + { + // @@ Already there, throw some user exception.. + proxy->_decr_refcnt (); + } + if (r == -1) + { + // @@ Cannot insert, running out of memory? throw some other + // user exception + proxy->_decr_refcnt (); + } +} + +template void +TAO_ESF_Proxy_List::reconnected (PROXY *proxy, + CORBA::Environment &) +{ + int r = this->impl_.insert (proxy); + if (r == 0 || r == 1) + { + // Reference count is incremented by the callers to [re]connected. + // @@ Find out if the protocol could be simplified, and decoupling + // increased. + proxy->_decr_refcnt (); + return; + } + + if (r == -1) + { + // @@ Cannot insert, running out of memory? throw some other + // user exception + proxy->_decr_refcnt (); + } +} + +template void +TAO_ESF_Proxy_List::disconnected (PROXY *proxy, + CORBA::Environment &) +{ + int r = this->impl_.remove (proxy); + if (r != 0) + { + // @@ Cannot remove, throw some other + // user exception + return; + } + proxy->_decr_refcnt (); +} + +template void +TAO_ESF_Proxy_List::shutdown (CORBA::Environment &) +{ + Iterator end = this->impl_.end (); + for (Iterator i = this->impl_.begin (); i != end; ++i) + { + // Decrement reference count + (*i)->_decr_refcnt (); + } + this->impl_.reset (); +} + +#endif /* TAO_ESF_PROXY_LIST_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_List.h b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_List.h new file mode 100644 index 00000000000..0c8b593d8a9 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_List.h @@ -0,0 +1,72 @@ +/* -*- C++ -*- */ +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// ORBSVCS Event Service Framework +// +// = FILENAME +// ESF_Proxy_List +// +// = AUTHOR +// Carlos O'Ryan (coryan@cs.wustl.edu) +// +// = CREDITS +// http://www.cs.wustl.edu/~coryan/EC/index.html +// +// ============================================================================ + +#ifndef TAO_ESF_PROXY_LIST_H +#define TAO_ESF_PROXY_LIST_H + +#include "tao/corba.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Containers.h" + +template +class TAO_ESF_Proxy_List +{ + // = DESCRIPTION + // A concrete proxy collection. + // Based on the ACE_Unbounded_Set<> collection, used a double + // linked list internally. + // +public: + typedef ACE_Unbounded_Set Implementation; + typedef ACE_Unbounded_Set_Iterator Iterator; + + TAO_ESF_Proxy_List (void); + + ACE_Unbounded_Set_Iterator begin (void); + ACE_Unbounded_Set_Iterator end (void); + size_t size (void) const; + void connected (PROXY *, + CORBA::Environment &); + void reconnected (PROXY *, + CORBA::Environment &); + void disconnected (PROXY *, + CORBA::Environment &); + void shutdown (CORBA::Environment &); + +private: + ACE_Unbounded_Set impl_; +}; + +#if defined (__ACE_INLINE__) +#include "ESF_Proxy_List.i" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ESF_Proxy_List.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("ESF_Proxy_List.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* TAO_ESF_PROXY_LIST_H */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_List.i b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_List.i new file mode 100644 index 00000000000..881283569ba --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_List.i @@ -0,0 +1,19 @@ +// $Id$ + +template ACE_INLINE ACE_Unbounded_Set_Iterator +TAO_ESF_Proxy_List::begin (void) +{ + return this->impl_.begin (); +} + +template ACE_INLINE ACE_Unbounded_Set_Iterator +TAO_ESF_Proxy_List::end (void) +{ + return this->impl_.end (); +} + +template ACE_INLINE size_t +TAO_ESF_Proxy_List::size (void) const +{ + return this->impl_.size (); +} diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_RB_Tree.cpp b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_RB_Tree.cpp new file mode 100644 index 00000000000..3b439e54ab3 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_RB_Tree.cpp @@ -0,0 +1,82 @@ +// $Id$ + +#ifndef TAO_ESF_PROXY_RB_TREE_CPP +#define TAO_ESF_PROXY_RB_TREE_CPP + +#include "ESF_Proxy_RB_Tree.h" + +#if ! defined (__ACE_INLINE__) +#include "ESF_Proxy_RB_Tree.i" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ESF, ESF_Proxy_RB_Tree, "$Id$") + +template +TAO_ESF_Proxy_RB_Tree:: + TAO_ESF_Proxy_RB_Tree (void) +{ +} + +template void +TAO_ESF_Proxy_RB_Tree::connected (PROXY *proxy, + CORBA::Environment &) +{ + int r = this->impl_.bind (proxy, 1); + if (r == 0) + return; + + if (r == 1) + { + // @@ Already there, throw some user exception.. + proxy->_decr_refcnt (); + } + if (r == -1) + { + // @@ Cannot insert, running out of memory? throw some other + // user exception + proxy->_decr_refcnt (); + } +} + +template void +TAO_ESF_Proxy_RB_Tree::reconnected (PROXY *proxy, + CORBA::Environment &) +{ + int r = this->impl_.rebind (proxy, 1); + if (r != 0) + { + // Reference count is incremented by the callers to [re]connected. + // @@ Find out if the protocol could be simplified, and decoupling + // increased. + proxy->_decr_refcnt (); + return; + } +} + +template void +TAO_ESF_Proxy_RB_Tree::disconnected (PROXY *proxy, + CORBA::Environment &) +{ + int r = this->impl_.unbind (proxy); + if (r != 0) + { + // @@ Cannot remove, throw some other + // user exception + return; + } + proxy->_decr_refcnt (); +} + +template void +TAO_ESF_Proxy_RB_Tree::shutdown (CORBA::Environment &) +{ + Iterator end = this->impl_.end (); + for (Iterator i = this->impl_.begin (); i != end; ++i) + { + // Decrement reference count + (*i)->_decr_refcnt (); + } + this->impl_.clear (); +} + +#endif /* TAO_ESF_PROXY_RB_TREE_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_RB_Tree.h b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_RB_Tree.h new file mode 100644 index 00000000000..b4708000082 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_RB_Tree.h @@ -0,0 +1,87 @@ +/* -*- C++ -*- */ +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// ORBSVCS Event Service Framework +// +// = FILENAME +// ESF_Proxy_RB_Tree +// +// = AUTHOR +// Carlos O'Ryan (coryan@cs.wustl.edu) +// +// = CREDITS +// http://www.cs.wustl.edu/~coryan/EC/index.html +// +// ============================================================================ + +#ifndef TAO_ESF_PROXY_RB_TREE_H +#define TAO_ESF_PROXY_RB_TREE_H + +#include "tao/corba.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/RB_Tree.h" + +template +class TAO_ESF_Proxy_RB_Tree_Iterator +{ +public: + typedef ACE_RB_Tree_Iterator,ACE_Null_Mutex> Implementation; + + TAO_ESF_Proxy_RB_Tree_Iterator (const Implementation &i); + + int operator == (const TAO_ESF_Proxy_RB_Tree_Iterator &rhs) const; + int operator != (const TAO_ESF_Proxy_RB_Tree_Iterator &rhs) const; + TAO_ESF_Proxy_RB_Tree_Iterator& operator++ (void); + TAO_ESF_Proxy_RB_Tree_Iterator operator++ (int); + PROXY *operator *(void); + +private: + Implementation impl_; +}; + +// **************************************************************** + +template +class TAO_ESF_Proxy_RB_Tree +{ +public: + typedef ACE_RB_Tree,ACE_Null_Mutex> Implementation; + typedef TAO_ESF_Proxy_RB_Tree_Iterator Iterator; + + TAO_ESF_Proxy_RB_Tree (void); + + TAO_ESF_Proxy_RB_Tree_Iterator begin (void); + TAO_ESF_Proxy_RB_Tree_Iterator end (void); + size_t size (void) const; + void connected (PROXY *, + CORBA::Environment &); + void reconnected (PROXY *, + CORBA::Environment &); + void disconnected (PROXY *, + CORBA::Environment &); + void shutdown (CORBA::Environment &); + +private: + Implementation impl_; +}; + +#if defined (__ACE_INLINE__) +#include "ESF_Proxy_RB_Tree.i" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ESF_Proxy_RB_Tree.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("ESF_Proxy_RB_Tree.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* TAO_ESF_PROXY_RB_TREE_H */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_RB_Tree.i b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_RB_Tree.i new file mode 100644 index 00000000000..1efd97a1894 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Proxy_RB_Tree.i @@ -0,0 +1,64 @@ +// $Id$ + + +template ACE_INLINE +TAO_ESF_Proxy_RB_Tree_Iterator:: + TAO_ESF_Proxy_RB_Tree_Iterator (const Implementation &i) + : impl_ (i) +{ +} + +template ACE_INLINE int +TAO_ESF_Proxy_RB_Tree_Iterator:: + operator == (const TAO_ESF_Proxy_RB_Tree_Iterator &rhs) const +{ + return this->impl_ == rhs.impl_; +} + +template ACE_INLINE int +TAO_ESF_Proxy_RB_Tree_Iterator:: + operator != (const TAO_ESF_Proxy_RB_Tree_Iterator &rhs) const +{ + return this->impl_ != rhs.impl_; +} + +template ACE_INLINE TAO_ESF_Proxy_RB_Tree_Iterator& +TAO_ESF_Proxy_RB_Tree_Iterator::operator++ (void) +{ + ++this->impl_; + return *this; +} + +template ACE_INLINE TAO_ESF_Proxy_RB_Tree_Iterator +TAO_ESF_Proxy_RB_Tree_Iterator::operator++ (int) +{ + TAO_ESF_Proxy_RB_Tree_Iterator tmp = *this; + ++this->impl_; + return tmp; +} + +template ACE_INLINE PROXY* +TAO_ESF_Proxy_RB_Tree_Iterator::operator *(void) +{ + return (*this->impl_).key (); +} + +// **************************************************************** + +template ACE_INLINE TAO_ESF_Proxy_RB_Tree_Iterator +TAO_ESF_Proxy_RB_Tree::begin (void) +{ + return Iterator (this->impl_.begin ()); +} + +template ACE_INLINE TAO_ESF_Proxy_RB_Tree_Iterator +TAO_ESF_Proxy_RB_Tree::end (void) +{ + return Iterator (this->impl_.end ()); +} + +template ACE_INLINE size_t +TAO_ESF_Proxy_RB_Tree::size (void) const +{ + return this->impl_.current_size (); +} diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Shutdown_Proxy.cpp b/TAO/orbsvcs/orbsvcs/ESF/ESF_Shutdown_Proxy.cpp new file mode 100644 index 00000000000..628710224a9 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Shutdown_Proxy.cpp @@ -0,0 +1,30 @@ +// $Id$ + +#ifndef TAO_ESF_SHUTDOWN_PROXY_CPP +#define TAO_ESF_SHUTDOWN_PROXY_CPP + +#include "ESF_Shutdown_Proxy.h" + +#if ! defined (__ACE_INLINE__) +#include "ESF_Shutdown_Proxy.i" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ESF, ESF_Shutdown_Proxy, "$Id$") + +template void +TAO_ESF_Shutdown_Proxy::work (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_TRY + { + proxy->shutdown (ACE_TRY_ENV); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + // Do not propagate any exceptions + } + ACE_ENDTRY; +} + +#endif /* TAO_ESF_SHUTDOWN_PROXY_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Shutdown_Proxy.h b/TAO/orbsvcs/orbsvcs/ESF/ESF_Shutdown_Proxy.h new file mode 100644 index 00000000000..8d3986f5133 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Shutdown_Proxy.h @@ -0,0 +1,53 @@ +/* -*- C++ -*- */ +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// ORBSVCS Event Service Framework +// +// = FILENAME +// ESF_Shutdown_Proxy +// +// = AUTHOR +// Carlos O'Ryan (coryan@cs.wustl.edu) +// +// = CREDITS +// http://www.cs.wustl.edu/~coryan/EC/index.html +// +// ============================================================================ + +#ifndef TAO_ESF_SHUTDOWN_PROXY_H +#define TAO_ESF_SHUTDOWN_PROXY_H + +#include "ESF_Worker.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +template +class TAO_ESF_Shutdown_Proxy : public TAO_ESF_Worker +{ +public: + TAO_ESF_Shutdown_Proxy (void); + + void work (PROXY *proxy, + CORBA::Environment &ACE_TRY_ENV); +}; + +// **************************************************************** + +#if defined (__ACE_INLINE__) +#include "ESF_Shutdown_Proxy.i" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ESF_Shutdown_Proxy.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("ESF_Shutdown_Proxy.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* TAO_ESF_SHUTDOWN_PROXY_H */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Shutdown_Proxy.i b/TAO/orbsvcs/orbsvcs/ESF/ESF_Shutdown_Proxy.i new file mode 100644 index 00000000000..5266f0aa225 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Shutdown_Proxy.i @@ -0,0 +1,6 @@ +// $Id$ + +template ACE_INLINE +TAO_ESF_Shutdown_Proxy::TAO_ESF_Shutdown_Proxy (void) +{ +} diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Worker.cpp b/TAO/orbsvcs/orbsvcs/ESF/ESF_Worker.cpp new file mode 100644 index 00000000000..2cc875b07c6 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Worker.cpp @@ -0,0 +1,19 @@ +// $Id$ + +#ifndef TAO_ESF_WORKER_CPP +#define TAO_ESF_WORKER_CPP + +#include "ESF_Worker.h" + +#if ! defined (__ACE_INLINE__) +#include "ESF_Worker.i" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ESF, ESF_Worker, "$Id$") + +template +TAO_ESF_Worker::~TAO_ESF_Worker (void) +{ +} + +#endif /* TAO_ESF_WORKER_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Worker.h b/TAO/orbsvcs/orbsvcs/ESF/ESF_Worker.h new file mode 100644 index 00000000000..f3001e69aef --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Worker.h @@ -0,0 +1,51 @@ +/* -*- C++ -*- */ +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// ORBSVCS Real-time Event Channel +// +// = FILENAME +// ESF_Worker +// +// = AUTHOR +// Carlos O'Ryan (coryan@cs.wustl.edu) +// +// = CREDITS +// http://www.cs.wustl.edu/~coryan/EC/index.html +// +// ============================================================================ + +#ifndef TAO_ESF_WORKER_H +#define TAO_ESF_WORKER_H + +#include "tao/corba.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +template +class TAO_ESF_Worker +{ +public: + virtual ~TAO_ESF_Worker (void); + + virtual void work (Object *object, + CORBA::Environment &ACE_TRY_ENV) = 0; +}; + +#if defined (__ACE_INLINE__) +#include "ESF_Worker.i" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ESF_Worker.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("ESF_Worker.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* TAO_ESF_WORKER_H */ diff --git a/TAO/orbsvcs/orbsvcs/ESF/ESF_Worker.i b/TAO/orbsvcs/orbsvcs/ESF/ESF_Worker.i new file mode 100644 index 00000000000..cfa1da318d3 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ESF/ESF_Worker.i @@ -0,0 +1 @@ +// $Id$ diff --git a/TAO/orbsvcs/orbsvcs/ETCL/ETCL.ll b/TAO/orbsvcs/orbsvcs/ETCL/ETCL.ll new file mode 100644 index 00000000000..c27536a8d12 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ETCL/ETCL.ll @@ -0,0 +1,150 @@ +%option noyywrap + +%{ +// ETCL.ll,v 1.1.2.1 2000/02/27 23:12:27 coryan Exp +// ======================================================================== +// +// = LIBRARY +// orbsvcs/ECTL +// +// = FILENAME +// ETCL.ll +// +// = AUTHOR +// Carlos O'Ryan based on previous work by +// Seth Widoff +// +// ======================================================================== + +#include "ace/OS.h" + +#include "ETCL_Constraint.h" +#include "ETCL_y.h" + +static const char * extract_string(char*); + +#define TAO_YY_LEX_DEBUG + +#ifdef TAO_CONSTRAINT_DEBUG +#define TAO_YY_LEX_DEBUG TAO_OS::fprintf(stderr, "%s\n", yytext) +#endif /* TAO_CONSTRAINT_DEBUG */ + +#define YY_DECL int TAO_ETCL_yylex (TAO_ETCL_YYSTYPE *lvalp, void* state) + +#define YY_BREAK +#define YY_NO_UNPUT + +%} + +white_space [ \t] +letter [a-zA-Z] +digit [0-9] +alpha_num ({letter}|{digit}) +integer {digit}+ +float ({digit}*\.{digit}+)([eE][-+]?{digit}+)? +string '(([^'\\]*)|([^'\\]*\\')|([^'\\]*\\\\))*' +base {letter}({alpha_num}|[_])* +ident {base}|\\{base} +newline \n + +%% + +min { TAO_YY_LEX_DEBUG; return TAO_ETCL_MIN; } +max { TAO_YY_LEX_DEBUG; return TAO_ETCL_MAX; } +first { TAO_YY_LEX_DEBUG; return TAO_ETCL_FIRST; } +random { TAO_YY_LEX_DEBUG; return TAO_ETCL_RANDOM; } +with { TAO_YY_LEX_DEBUG; return TAO_ETCL_WITH; } +exist { TAO_YY_LEX_DEBUG; return TAO_ETCL_EXIST; } +not { TAO_YY_LEX_DEBUG; return TAO_ETCL_NOT; } +and { TAO_YY_LEX_DEBUG; return TAO_ETCL_AND; } +or { TAO_YY_LEX_DEBUG; return TAO_ETCL_OR; } +in { TAO_YY_LEX_DEBUG; return TAO_ETCL_IN; } +"~" { TAO_YY_LEX_DEBUG; return TAO_ETCL_TWIDDLE; } +"+" { TAO_YY_LEX_DEBUG; return TAO_ETCL_PLUS; } +"-" { TAO_YY_LEX_DEBUG; return TAO_ETCL_MINUS; } +"*" { TAO_YY_LEX_DEBUG; return TAO_ETCL_MULT; } +"/" { TAO_YY_LEX_DEBUG; return TAO_ETCL_DIV; } +"<" { TAO_YY_LEX_DEBUG; return TAO_ETCL_LT; } +"<=" { TAO_YY_LEX_DEBUG; return TAO_ETCL_LE; } +">" { TAO_YY_LEX_DEBUG; return TAO_ETCL_GT; } +">=" { TAO_YY_LEX_DEBUG; return TAO_ETCL_GE; } +"==" { TAO_YY_LEX_DEBUG; return TAO_ETCL_EQ; } +"!=" { TAO_YY_LEX_DEBUG; return TAO_ETCL_NE; } +"(" { TAO_YY_LEX_DEBUG; return TAO_ETCL_LPAREN; } +")" { TAO_YY_LEX_DEBUG; return TAO_ETCL_RPAREN; } +"$" { TAO_YY_LEX_DEBUG; return TAO_ETCL_DOLLAR; } +"." { TAO_YY_LEX_DEBUG; return TAO_ETCL_DOT; } +"default" { TAO_YY_LEX_DEBUG; return TAO_ETCL_DEFAULT; } +"_d" { TAO_YY_LEX_DEBUG; return TAO_ETCL_DISCRIMINANT; } +"_type_id" { TAO_YY_LEX_DEBUG; return TAO_ETCL_TYPE_ID; } +"_repos_id" { TAO_YY_LEX_DEBUG; return TAO_ETCL_REPOS_ID; } +"_length" { TAO_YY_LEX_DEBUG; return TAO_ETCL_LENGTH; } +"[" { TAO_YY_LEX_DEBUG; return TAO_ETCL_LBRA; } +"]" { TAO_YY_LEX_DEBUG; return TAO_ETCL_RBRA; } +TRUE { + lvalp->constraint = + new TAO_ETCL_Boolean_Literal (1); + TAO_YY_LEX_DEBUG; return TAO_ETCL_BOOLEAN; + } +FALSE { + lvalp->constraint = + new TAO_ETCL_Boolean_Literal (0); + TAO_YY_LEX_DEBUG; return TAO_ETCL_BOOLEAN; + } +{integer} { + lvalp->constraint = + new TAO_ETCL_Integer_Literal (ACE_OS::atoi (yytext)); + TAO_YY_LEX_DEBUG; return TAO_ETCL_INTEGER; + } +{float} { + double v; + sscanf (yytext, "%lf", &v); + lvalp->constraint = + new TAO_ETCL_Float_Literal (v); + TAO_YY_LEX_DEBUG; return TAO_ETCL_FLOAT; + } +{string} { + lvalp->constraint = + new TAO_ETCL_String_Literal (extract_string(yytext)); + TAO_YY_LEX_DEBUG; return TAO_ETCL_STRING; + } +{ident} { + lvalp->constraint = + new TAO_ETCL_Identifier (yytext); + TAO_YY_LEX_DEBUG; return TAO_ETCL_IDENT; + } +{white_space} { + TAO_YY_LEX_DEBUG; break; // Ignore + } +. { + TAO_YY_LEX_DEBUG; break; // @@ TODO + } +%% + +const char* +extract_string(char* str) +{ + char *t = str; + for (char * i = str + 1; *i != 0; ++i, ++t) + { + if (*i == '\\') + { + ++i; + if (*i == 0) + return 0; + else if (*i == 't') + *t = '\t'; + else if (*i == 'n') + *t = '\n'; + else if (*i == '\\') + *t = '\\'; + else + *t = *i; + continue; + } + *t = *i; + + } + + return str; +} diff --git a/TAO/orbsvcs/orbsvcs/ETCL/ETCL.yy b/TAO/orbsvcs/orbsvcs/ETCL/ETCL.yy new file mode 100644 index 00000000000..d655da742db --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ETCL/ETCL.yy @@ -0,0 +1,240 @@ +%{ +// $Id$ +// ======================================================================== +// +// = LIBRARY +// orbsvcs / Extended Trader Constraint Language parser. +// +// = FILENAME +// ETCL.yy +// +// = AUTHOR +// Carlos O'Ryan based on previous work by +// Seth Widoff +// +// ======================================================================== + +#include "orbsvcs/ETCL/ETCL_Constraint.h" + +#define YYPARSE_PARAM lex_state +#define YYLEX_PARAM lex_state + +//#define YYDEBUG 1 + +#define YYSTYPE TAO_ETCL_YYSTYPE + +static void yyerror (const char *) +{ + // @@ TODO + // Ignore error messages +} + +extern int yylex (YYSTYPE *lvalp, void *lex_state); + +%} + +%token TAO_ETCL_GT TAO_ETCL_GE TAO_ETCL_LT TAO_ETCL_LE +%token TAO_ETCL_EQ TAO_ETCL_NE +%token TAO_ETCL_EXIST TAO_ETCL_DEFAULT +%token TAO_ETCL_AND TAO_ETCL_OR TAO_ETCL_NOT +%token TAO_ETCL_IN TAO_ETCL_TWIDDLE +%token TAO_ETCL_BOOLEAN +%token TAO_ETCL_PLUS TAO_ETCL_MINUS TAO_ETCL_MULT TAO_ETCL_DIV +%token TAO_ETCL_UMINUS +%token TAO_ETCL_INTEGER TAO_ETCL_FLOAT TAO_ETCL_STRING +%token TAO_ETCL_RPAREN TAO_ETCL_LPAREN +%token TAO_ETCL_RBRA TAO_ETCL_LBRA +%token TAO_ETCL_IDENT +%token TAO_ETCL_UNSIGNED TAO_ETCL_SIGNED TAO_ETCL_DOUBLE +%token TAO_ETCL_CONSTRAINT TAO_ETCL_SEQUENCE +%token TAO_ETCL_WITH TAO_ETCL_MAX TAO_ETCL_MIN +%token TAO_ETCL_FIRST TAO_ETCL_RANDOM + +%token TAO_ETCL_DOLLAR TAO_ETCL_DOT +%token TAO_ETCL_DISCRIMINANT TAO_ETCL_LENGTH +%token TAO_ETCL_TYPE_ID TAO_ETCL_REPOS_ID + + +%type TAO_ETCL_IDENT +%type TAO_ETCL_BOOLEAN +%type TAO_ETCL_STRING +%type TAO_ETCL_FLOAT +%type TAO_ETCL_INTEGER +%type expr_in +%type constraint preference bool_or bool_and bool_compare +%type expr_in expr_twiddle expr term factor_not factor +%type union_pos union_val component_array +%type component_array component_assoc component_pos +%type component_dot component_ext component + +%start constraint +%pure_parser + +%% + +constraint: bool_or + | preference + ; + +preference: TAO_ETCL_MIN bool_or +{ $$ = new TAO_ETCL_Preference (TAO_ETCL_MIN, $2); } + | TAO_ETCL_MAX bool_or +{ $$ = new TAO_ETCL_Preference (TAO_ETCL_MAX, $2); } + | TAO_ETCL_WITH bool_or +{ $$ = new TAO_ETCL_Preference (TAO_ETCL_WITH, $2); } + | TAO_ETCL_FIRST +{ $$ = new TAO_ETCL_Preference (TAO_ETCL_FIRST); } + | TAO_ETCL_RANDOM +{ $$ = new TAO_ETCL_Preference (TAO_ETCL_RANDOM); } + ; + +bool_or: bool_or TAO_ETCL_OR bool_and + { $$ = new TAO_ETCL_Binary_Expr (TAO_ETCL_OR, $1, $3); } + | bool_and + ; + +bool_and: bool_and TAO_ETCL_AND bool_compare + { $$ = new TAO_ETCL_Binary_Expr (TAO_ETCL_AND, $1, $3); } + | bool_compare + ; + +bool_compare: expr_in TAO_ETCL_EQ expr_in + { $$ = new TAO_ETCL_Binary_Expr (TAO_ETCL_EQ, $1, $3); } + | expr_in TAO_ETCL_NE expr_in + { $$ = new TAO_ETCL_Binary_Expr (TAO_ETCL_NE, $1, $3); } + | expr_in TAO_ETCL_GT expr_in + { $$ = new TAO_ETCL_Binary_Expr (TAO_ETCL_GT, $1, $3); } + | expr_in TAO_ETCL_GE expr_in + { $$ = new TAO_ETCL_Binary_Expr (TAO_ETCL_GE, $1, $3); } + | expr_in TAO_ETCL_LT expr_in + { $$ = new TAO_ETCL_Binary_Expr (TAO_ETCL_LT, $1, $3); } + | expr_in TAO_ETCL_LE expr_in + { $$ = new TAO_ETCL_Binary_Expr (TAO_ETCL_LE, $1, $3); } + | expr_in + ; + +expr_in: expr_twiddle TAO_ETCL_IN component + { $$ = new TAO_ETCL_Binary_Expr (TAO_ETCL_IN, $1, $3); } + | expr_twiddle TAO_ETCL_IN TAO_ETCL_DOLLAR component + { $$ = new TAO_ETCL_Binary_Expr (TAO_ETCL_IN, $1, $4); } + | expr_twiddle + ; + +expr_twiddle: expr TAO_ETCL_TWIDDLE expr + { $$ = new TAO_ETCL_Binary_Expr (TAO_ETCL_TWIDDLE, $1, $3); } + | expr + ; + +expr: expr TAO_ETCL_PLUS term + { $$ = new TAO_ETCL_Binary_Expr (TAO_ETCL_PLUS, $1, $3); } + | expr TAO_ETCL_MINUS term + { $$ = new TAO_ETCL_Binary_Expr (TAO_ETCL_MINUS, $1, $3); } + | term + ; + +term: term TAO_ETCL_MULT factor_not + { $$ = new TAO_ETCL_Binary_Expr (TAO_ETCL_MULT, $1, $3); } + | term TAO_ETCL_DIV factor_not + { $$ = new TAO_ETCL_Binary_Expr (TAO_ETCL_DIV, $1, $3); } + | factor_not + ; + +factor_not: TAO_ETCL_NOT factor + { $$ = new TAO_ETCL_Unary_Expr (TAO_ETCL_NOT, $2); } + | factor + ; + +factor: TAO_ETCL_LPAREN bool_or TAO_ETCL_RPAREN + { $$ = $2; } + + | TAO_ETCL_INTEGER + { $$ = $1; } + | TAO_ETCL_PLUS TAO_ETCL_INTEGER + { $$ = new TAO_ETCL_Unary_Expr (TAO_ETCL_PLUS, $2); } + | TAO_ETCL_MINUS TAO_ETCL_INTEGER + { $$ = new TAO_ETCL_Unary_Expr (TAO_ETCL_MINUS, $2); } + + | TAO_ETCL_FLOAT + { $$ = $1; } + | TAO_ETCL_PLUS TAO_ETCL_FLOAT + { $$ = new TAO_ETCL_Unary_Expr (TAO_ETCL_PLUS, $2); } + | TAO_ETCL_MINUS TAO_ETCL_FLOAT + { $$ = new TAO_ETCL_Unary_Expr (TAO_ETCL_MINUS, $2); } + + | TAO_ETCL_STRING + | TAO_ETCL_BOOLEAN + + | TAO_ETCL_EXIST TAO_ETCL_DOLLAR component + { $$ = new TAO_ETCL_Exist ($3); } + | TAO_ETCL_DEFAULT TAO_ETCL_DOLLAR component + { $$ = new TAO_ETCL_Default ($3); } + | TAO_ETCL_DOLLAR component + { $$ = new TAO_ETCL_Eval ($2); } + ; + +component: /* empty */ + { $$ = 0 } + | TAO_ETCL_DOT component_dot + { $$ = new TAO_ETCL_Dot ($2); } + + | TAO_ETCL_IDENT component_ext + { $$ = new TAO_ETCL_Component ($1, $2); } + + | component_array + | component_assoc + ; + +component_ext: /* empty */ + { $$ = 0 } + | TAO_ETCL_DOT component_dot + { $$ = new TAO_ETCL_Dot ($2); } + + | component_array + | component_assoc + ; + +component_dot: TAO_ETCL_IDENT component_ext + { $$ = new TAO_ETCL_Component ($1, $2); } + | TAO_ETCL_LENGTH + { $$ = new TAO_ETCL_Special (TAO_ETCL_LENGTH); } + | TAO_ETCL_DISCRIMINANT + { $$ = new TAO_ETCL_Special (TAO_ETCL_DISCRIMINANT); } + | TAO_ETCL_TYPE_ID + { $$ = new TAO_ETCL_Special (TAO_ETCL_TYPE_ID); } + | TAO_ETCL_REPOS_ID + { $$ = new TAO_ETCL_Special (TAO_ETCL_REPOS_ID); } + | component_pos + | union_pos + ; + +component_array: TAO_ETCL_LBRA TAO_ETCL_INTEGER TAO_ETCL_RBRA component_ext + { $$ = new TAO_ETCL_Component_Array ($2, $4); } + ; + +component_assoc: TAO_ETCL_LPAREN TAO_ETCL_IDENT TAO_ETCL_RPAREN component_ext + { $$ = new TAO_ETCL_Component_Assoc ($2, $4); } + ; + +component_pos: TAO_ETCL_INTEGER component_ext + { $$ = new TAO_ETCL_Component_Pos ($1, $2); } + ; + +union_pos: TAO_ETCL_LPAREN union_val TAO_ETCL_RPAREN component_ext + { $$ = new TAO_ETCL_Union_Pos ($2, $4); } + ; + +union_val: /* empty */ + { $$ = 0; } + | TAO_ETCL_INTEGER + { $$ = new TAO_ETCL_Union_Value (+1, $1); } + | TAO_ETCL_PLUS TAO_ETCL_INTEGER + { $$ = new TAO_ETCL_Union_Value (+1, $2); } + | TAO_ETCL_MINUS TAO_ETCL_INTEGER + { $$ = new TAO_ETCL_Union_Value (-1, $2); } + | TAO_ETCL_STRING + { $$ = new TAO_ETCL_Union_Value ($1); } + ; + +%% + +//extern int yydebug = 1; diff --git a/TAO/orbsvcs/orbsvcs/ETCL/ETCL_Constraint.cpp b/TAO/orbsvcs/orbsvcs/ETCL/ETCL_Constraint.cpp new file mode 100644 index 00000000000..26cbda00608 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ETCL/ETCL_Constraint.cpp @@ -0,0 +1,246 @@ +// $Id$ + +#include "ETCL_Constraint.h" +#include "ETCL_y.h" + +#if ! defined (__ACE_INLINE__) +#include "ETCL_Constraint.i" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ETCL, ETCL_Constraint, "$Id$") + +TAO_ETCL_Constraint::~TAO_ETCL_Constraint (void) +{ +} + +TAO_ETCL_Constraint * +TAO_ETCL_Constraint::parse_constraint (const char* constraint) +{ +} + + +// **************************************************************** + +void +TAO_ETCL_Boolean_Literal::visit (TAO_ETCL_Constraint_Visitor *visitor) +{ + visitor->visit_boolean_literal (this); +} + +void +TAO_ETCL_Integer_Literal::visit (TAO_ETCL_Constraint_Visitor *visitor) +{ + visitor->visit_integer_literal (this); +} + +void +TAO_ETCL_Float_Literal::visit (TAO_ETCL_Constraint_Visitor *visitor) +{ + visitor->visit_float_literal (this); +} + +void +TAO_ETCL_String_Literal::visit (TAO_ETCL_Constraint_Visitor *visitor) +{ + visitor->visit_string_literal (this); +} + +void +TAO_ETCL_Identifier::visit (TAO_ETCL_Constraint_Visitor *visitor) +{ + visitor->visit_identifier (this); +} + +// **************************************************************** + +TAO_ETCL_Union_Value::~TAO_ETCL_Union_Value (void) +{ + delete this->string_; + delete this->integer_; +} + +void +TAO_ETCL_Union_Value::visit (TAO_ETCL_Constraint_Visitor *visitor) +{ + visitor->visit_union_value (this); +} + +// **************************************************************** + +TAO_ETCL_Union_Pos::~TAO_ETCL_Union_Pos (void) +{ + delete this->component_; + delete this->union_value_; +} + +void +TAO_ETCL_Union_Pos::visit (TAO_ETCL_Constraint_Visitor *visitor) +{ + visitor->visit_union_pos (this); +} + +// **************************************************************** + +TAO_ETCL_Component_Pos::~TAO_ETCL_Component_Pos (void) +{ + delete this->component_; + delete this->integer_; +} + +void +TAO_ETCL_Component_Pos::visit (TAO_ETCL_Constraint_Visitor *visitor) +{ + visitor->visit_component_pos (this); +} + +// **************************************************************** + +TAO_ETCL_Component_Assoc::~TAO_ETCL_Component_Assoc (void) +{ + delete this->component_; + delete this->identifier_; +} + +void +TAO_ETCL_Component_Assoc::visit (TAO_ETCL_Constraint_Visitor *visitor) +{ + visitor->visit_component_assoc (this); +} + +// **************************************************************** + +TAO_ETCL_Component_Array::~TAO_ETCL_Component_Array (void) +{ + delete this->component_; + delete this->integer_; +} + +void +TAO_ETCL_Component_Array::visit (TAO_ETCL_Constraint_Visitor *visitor) +{ + visitor->visit_component_array (this); +} + +// **************************************************************** + +TAO_ETCL_Special::~TAO_ETCL_Special (void) +{ +} + +void +TAO_ETCL_Special::visit (TAO_ETCL_Constraint_Visitor *visitor) +{ + visitor->visit_special (this); +} + +// **************************************************************** + +TAO_ETCL_Component::~TAO_ETCL_Component (void) +{ + delete this->component_; + delete this->identifier_; +} + +void +TAO_ETCL_Component::visit (TAO_ETCL_Constraint_Visitor *visitor) +{ + visitor->visit_component (this); +} + +// **************************************************************** + +TAO_ETCL_Dot::~TAO_ETCL_Dot (void) +{ + delete this->component_; +} + +void +TAO_ETCL_Dot::visit (TAO_ETCL_Constraint_Visitor *visitor) +{ + visitor->visit_dot (this); +} + +// **************************************************************** + +TAO_ETCL_Eval::~TAO_ETCL_Eval (void) +{ + delete this->component_; +} + +void +TAO_ETCL_Eval::visit (TAO_ETCL_Constraint_Visitor *visitor) +{ + visitor->visit_eval (this); +} + +// **************************************************************** + +TAO_ETCL_Default::~TAO_ETCL_Default (void) +{ + delete this->component_; +} + +void +TAO_ETCL_Default::visit (TAO_ETCL_Constraint_Visitor *visitor) +{ + visitor->visit_default (this); +} + +// **************************************************************** + +TAO_ETCL_Exist::~TAO_ETCL_Exist (void) +{ + delete this->component_; +} + +void +TAO_ETCL_Exist::visit (TAO_ETCL_Constraint_Visitor *visitor) +{ + visitor->visit_exist (this); +} + +// **************************************************************** + +TAO_ETCL_Unary_Expr::~TAO_ETCL_Unary_Expr (void) +{ + delete this->subexpr_; +} + +void +TAO_ETCL_Unary_Expr::visit (TAO_ETCL_Constraint_Visitor *visitor) +{ + visitor->visit_unary_expr (this); +} + +// **************************************************************** + +TAO_ETCL_Binary_Expr::~TAO_ETCL_Binary_Expr (void) +{ + delete this->lhs_; + delete this->rhs_; +} + +void +TAO_ETCL_Binary_Expr::visit (TAO_ETCL_Constraint_Visitor *visitor) +{ + visitor->visit_binary_expr (this); +} + +// **************************************************************** + +TAO_ETCL_Preference::~TAO_ETCL_Preference (void) +{ + delete this->subexpr_; +} + +void +TAO_ETCL_Preference::visit (TAO_ETCL_Constraint_Visitor *visitor) +{ + visitor->visit_preference (this); +} + +// **************************************************************** + +TAO_ETCL_Constraint_Visitor::~TAO_ETCL_Constraint_Visitor (void) +{ +} diff --git a/TAO/orbsvcs/orbsvcs/ETCL/ETCL_Constraint.h b/TAO/orbsvcs/orbsvcs/ETCL/ETCL_Constraint.h new file mode 100644 index 00000000000..f5b52793389 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ETCL/ETCL_Constraint.h @@ -0,0 +1,418 @@ +/* -*- C++ -*- */ +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// orbsvcs / Extended Trader Constraint Language parser. +// +// = FILENAME +// ECTL_Constraint +// +// = AUTHOR +// Carlos O'Ryan (coryan@cs.wustl.edu) +// +// ============================================================================ + +#ifndef TAO_ETCL_CONSTRAINT_H +#define TAO_ETCL_CONSTRAINT_H + +#include "orbsvcs/orbsvcs_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/SString.h" + +class TAO_ETCL_Constraint_Visitor; + +class TAO_ORBSVCS_Export TAO_ETCL_Constraint +{ +public: + virtual ~TAO_ETCL_Constraint (void); + // Constructor and destructor + + virtual void visit (TAO_ETCL_Constraint_Visitor *visitor) = 0; + + static TAO_ETCL_Constraint *parse_constraint (const char* constraint); +}; + +// **************************************************************** + +class TAO_ORBSVCS_Export TAO_ETCL_Boolean_Literal : public TAO_ETCL_Constraint +{ +public: + TAO_ETCL_Boolean_Literal (int value); + + int value (void) const; + // Get the value + + // = The Constraint methods. + void visit (TAO_ETCL_Constraint_Visitor *visitor); + +private: + int value_; + // The value +}; + +// **************************************************************** + +class TAO_ORBSVCS_Export TAO_ETCL_Integer_Literal : public TAO_ETCL_Constraint +{ +public: + TAO_ETCL_Integer_Literal (long value); + + long value (void) const; + // Get the value + + // = The Constraint methods. + void visit (TAO_ETCL_Constraint_Visitor *visitor); + +private: + long value_; + // The value +}; + +// **************************************************************** + +class TAO_ORBSVCS_Export TAO_ETCL_Float_Literal : public TAO_ETCL_Constraint +{ +public: + TAO_ETCL_Float_Literal (double value); + + double value (void) const; + // Get the value + + // = The Constraint methods. + void visit (TAO_ETCL_Constraint_Visitor *visitor); + +private: + double value_; + // The value +}; + +// **************************************************************** + +class TAO_ORBSVCS_Export TAO_ETCL_String_Literal : public TAO_ETCL_Constraint +{ +public: + TAO_ETCL_String_Literal (const char *value); + + const char *value (void) const; + // Get the value + + // = The Constraint methods. + void visit (TAO_ETCL_Constraint_Visitor *visitor); + +private: + ACE_CString string_; + // The value +}; + +// **************************************************************** + +class TAO_ORBSVCS_Export TAO_ETCL_Identifier : public TAO_ETCL_Constraint +{ +public: + TAO_ETCL_Identifier (const char *value); + + const char *value (void) const; + // Get the value + + // = The Constraint methods. + void visit (TAO_ETCL_Constraint_Visitor *visitor); + +private: + ACE_CString string_; + // The value +}; + +// **************************************************************** + +class TAO_ORBSVCS_Export TAO_ETCL_Union_Value : public TAO_ETCL_Constraint +{ +public: + TAO_ETCL_Union_Value (int sign, + TAO_ETCL_Constraint *integer); + TAO_ETCL_Union_Value (TAO_ETCL_Constraint *string); + virtual ~TAO_ETCL_Union_Value (void); + + int sign (void) const; + TAO_ETCL_Integer_Literal *integer (void) const; + TAO_ETCL_String_Literal *string (void) const; + + // = The Constraint methods. + void visit (TAO_ETCL_Constraint_Visitor *visitor); + +private: + int sign_; + TAO_ETCL_Integer_Literal *integer_; + TAO_ETCL_String_Literal *string_; +}; + +class TAO_ORBSVCS_Export TAO_ETCL_Union_Pos : public TAO_ETCL_Constraint +{ +public: + TAO_ETCL_Union_Pos (TAO_ETCL_Constraint *union_value, + TAO_ETCL_Constraint *component); + virtual ~TAO_ETCL_Union_Pos (void); + + TAO_ETCL_Union_Value *union_value (void) const; + TAO_ETCL_Constraint *component (void) const; + + // = The Constraint methods. + void visit (TAO_ETCL_Constraint_Visitor *visitor); + +private: + TAO_ETCL_Union_Value *union_value_; + TAO_ETCL_Constraint *component_; +}; + +class TAO_ORBSVCS_Export TAO_ETCL_Component_Pos : public TAO_ETCL_Constraint +{ +public: + TAO_ETCL_Component_Pos (TAO_ETCL_Constraint *integer, + TAO_ETCL_Constraint *component); + virtual ~TAO_ETCL_Component_Pos (void); + + TAO_ETCL_Integer_Literal *integer (void) const; + TAO_ETCL_Constraint *component (void) const; + + // = The Constraint methods. + void visit (TAO_ETCL_Constraint_Visitor *visitor); + +private: + TAO_ETCL_Integer_Literal *integer_; + TAO_ETCL_Constraint *component_; +}; + +class TAO_ORBSVCS_Export TAO_ETCL_Component_Assoc : public TAO_ETCL_Constraint +{ +public: + TAO_ETCL_Component_Assoc (TAO_ETCL_Constraint *identifier, + TAO_ETCL_Constraint *component); + virtual ~TAO_ETCL_Component_Assoc (void); + + TAO_ETCL_Identifier *identifier (void) const; + TAO_ETCL_Constraint *component (void) const; + + // = The Constraint methods. + void visit (TAO_ETCL_Constraint_Visitor *visitor); + +private: + TAO_ETCL_Identifier *identifier_; + TAO_ETCL_Constraint *component_; +}; + +class TAO_ORBSVCS_Export TAO_ETCL_Component_Array : public TAO_ETCL_Constraint +{ +public: + TAO_ETCL_Component_Array (TAO_ETCL_Constraint *integer, + TAO_ETCL_Constraint *component); + virtual ~TAO_ETCL_Component_Array (void); + + TAO_ETCL_Integer_Literal *integer (void) const; + TAO_ETCL_Constraint *component (void) const; + + // = The Constraint methods. + void visit (TAO_ETCL_Constraint_Visitor *visitor); + +private: + TAO_ETCL_Integer_Literal *integer_; + TAO_ETCL_Constraint *component_; +}; + +class TAO_ORBSVCS_Export TAO_ETCL_Special : public TAO_ETCL_Constraint +{ +public: + TAO_ETCL_Special (int type); + virtual ~TAO_ETCL_Special (void); + + int type (void) const; + + // = The Constraint methods. + void visit (TAO_ETCL_Constraint_Visitor *visitor); + +private: + int type_; +}; + +class TAO_ORBSVCS_Export TAO_ETCL_Component : public TAO_ETCL_Constraint +{ +public: + TAO_ETCL_Component (TAO_ETCL_Constraint *identifier, + TAO_ETCL_Constraint *component); + virtual ~TAO_ETCL_Component (void); + + TAO_ETCL_Identifier *identifier (void) const; + TAO_ETCL_Constraint *component (void) const; + + // = The Constraint methods. + void visit (TAO_ETCL_Constraint_Visitor *visitor); + +private: + TAO_ETCL_Identifier *identifier_; + TAO_ETCL_Constraint *component_; +}; + +class TAO_ORBSVCS_Export TAO_ETCL_Dot : public TAO_ETCL_Constraint +{ +public: + TAO_ETCL_Dot (TAO_ETCL_Constraint *component); + virtual ~TAO_ETCL_Dot (void); + + TAO_ETCL_Constraint *component (void) const; + + // = The Constraint methods. + void visit (TAO_ETCL_Constraint_Visitor *visitor); + +private: + TAO_ETCL_Constraint *component_; +}; + +class TAO_ORBSVCS_Export TAO_ETCL_Eval : public TAO_ETCL_Constraint +{ +public: + TAO_ETCL_Eval (TAO_ETCL_Constraint *component); + virtual ~TAO_ETCL_Eval (void); + + TAO_ETCL_Constraint *component (void) const; + + // = The Constraint methods. + void visit (TAO_ETCL_Constraint_Visitor *visitor); + +private: + TAO_ETCL_Constraint *component_; +}; + +class TAO_ORBSVCS_Export TAO_ETCL_Default : public TAO_ETCL_Constraint +{ +public: + TAO_ETCL_Default (TAO_ETCL_Constraint *component); + virtual ~TAO_ETCL_Default (void); + + TAO_ETCL_Constraint *component (void) const; + + // = The Constraint methods. + void visit (TAO_ETCL_Constraint_Visitor *visitor); + +private: + TAO_ETCL_Constraint *component_; +}; + +class TAO_ORBSVCS_Export TAO_ETCL_Exist : public TAO_ETCL_Constraint +{ +public: + TAO_ETCL_Exist (TAO_ETCL_Constraint *component); + virtual ~TAO_ETCL_Exist (void); + + TAO_ETCL_Constraint *component (void) const; + + // = The Constraint methods. + void visit (TAO_ETCL_Constraint_Visitor *visitor); + +private: + TAO_ETCL_Constraint *component_; +}; + +class TAO_ORBSVCS_Export TAO_ETCL_Unary_Expr : public TAO_ETCL_Constraint +{ +public: + TAO_ETCL_Unary_Expr (int type, + TAO_ETCL_Constraint *subexpr); + virtual ~TAO_ETCL_Unary_Expr (void); + + int type (void) const; + TAO_ETCL_Constraint *subexpr (void) const; + + // = The Constraint methods. + void visit (TAO_ETCL_Constraint_Visitor *visitor); + +private: + int type_; + TAO_ETCL_Constraint *subexpr_; +}; + +class TAO_ORBSVCS_Export TAO_ETCL_Binary_Expr : public TAO_ETCL_Constraint +{ +public: + TAO_ETCL_Binary_Expr (int type, + TAO_ETCL_Constraint *lhs, + TAO_ETCL_Constraint *rhs); + virtual ~TAO_ETCL_Binary_Expr (void); + + int type (void) const; + TAO_ETCL_Constraint *rhs (void) const; + TAO_ETCL_Constraint *lhs (void) const; + + // = The Constraint methods. + void visit (TAO_ETCL_Constraint_Visitor *visitor); + +private: + int type_; + TAO_ETCL_Constraint *lhs_; + TAO_ETCL_Constraint *rhs_; +}; + +class TAO_ORBSVCS_Export TAO_ETCL_Preference : public TAO_ETCL_Constraint +{ +public: + TAO_ETCL_Preference (int type, + TAO_ETCL_Constraint *subexpr = 0); + virtual ~TAO_ETCL_Preference (void); + + int type (void) const; + TAO_ETCL_Constraint *subexpr (void) const; + + // = The Constraint methods. + void visit (TAO_ETCL_Constraint_Visitor *visitor); + +private: + int type_; + TAO_ETCL_Constraint *subexpr_; +}; + +// **************************************************************** + +class TAO_ORBSVCS_Export TAO_ETCL_Constraint_Visitor +{ +public: + virtual ~TAO_ETCL_Constraint_Visitor (void); + // Destructor + + virtual void visit_boolean_literal (TAO_ETCL_Boolean_Literal *) = 0; + virtual void visit_integer_literal (TAO_ETCL_Integer_Literal *) = 0; + virtual void visit_float_literal (TAO_ETCL_Float_Literal *) = 0; + virtual void visit_string_literal (TAO_ETCL_String_Literal *) = 0; + virtual void visit_identifier (TAO_ETCL_Identifier *) = 0; + virtual void visit_union_value (TAO_ETCL_Union_Value *) = 0; + virtual void visit_union_pos (TAO_ETCL_Union_Pos *) = 0; + virtual void visit_component_pos (TAO_ETCL_Component_Pos *) = 0; + virtual void visit_component_assoc (TAO_ETCL_Component_Assoc *) = 0; + virtual void visit_component_array (TAO_ETCL_Component_Array *) = 0; + virtual void visit_special (TAO_ETCL_Special *) = 0; + virtual void visit_component (TAO_ETCL_Component *) = 0; + virtual void visit_dot (TAO_ETCL_Dot *) = 0; + virtual void visit_eval (TAO_ETCL_Eval *) = 0; + virtual void visit_default (TAO_ETCL_Default *) = 0; + virtual void visit_exist (TAO_ETCL_Exist *) = 0; + virtual void visit_unary_expr (TAO_ETCL_Unary_Expr *) = 0; + virtual void visit_binary_expr (TAO_ETCL_Binary_Expr *) = 0; + virtual void visit_preference (TAO_ETCL_Preference *) = 0; +}; + +// **************************************************************** + +union TAO_ETCL_YYSTYPE +{ + TAO_ETCL_Constraint *constraint; +}; + +// **************************************************************** + +#if defined (__ACE_INLINE__) +#include "ETCL_Constraint.i" +#endif /* __ACE_INLINE__ */ + +#endif /* TAO_ETCL_CONSTRAINT_H */ diff --git a/TAO/orbsvcs/orbsvcs/ETCL/ETCL_Constraint.i b/TAO/orbsvcs/orbsvcs/ETCL/ETCL_Constraint.i new file mode 100644 index 00000000000..848e058cd6d --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ETCL/ETCL_Constraint.i @@ -0,0 +1,373 @@ +// $Id$ + +ACE_INLINE +TAO_ETCL_Boolean_Literal::TAO_ETCL_Boolean_Literal (int value) + : value_ (value) +{ +} + +ACE_INLINE int +TAO_ETCL_Boolean_Literal::value (void) const +{ + return this->value_; +} + + +// **************************************************************** + +ACE_INLINE +TAO_ETCL_Integer_Literal::TAO_ETCL_Integer_Literal (long value) + : value_ (value) +{ +} + +ACE_INLINE long +TAO_ETCL_Integer_Literal::value (void) const +{ + return this->value_; +} + + +// **************************************************************** + +ACE_INLINE +TAO_ETCL_Float_Literal::TAO_ETCL_Float_Literal (double value) + : value_ (value) +{ +} + +ACE_INLINE double +TAO_ETCL_Float_Literal::value (void) const +{ + return this->value_; +} + + +// **************************************************************** + +ACE_INLINE +TAO_ETCL_String_Literal::TAO_ETCL_String_Literal (const char *value) + : string_ (value) +{ +} + +ACE_INLINE const char * +TAO_ETCL_String_Literal::value (void) const +{ + return this->string_.c_str (); +} + + +// **************************************************************** + +ACE_INLINE +TAO_ETCL_Identifier::TAO_ETCL_Identifier (const char *value) + : string_ (value) +{ +} + +ACE_INLINE const char * +TAO_ETCL_Identifier::value (void) const +{ + return this->string_.c_str (); +} + + +// **************************************************************** + +ACE_INLINE +TAO_ETCL_Union_Value::TAO_ETCL_Union_Value (int sign, + TAO_ETCL_Constraint *integer) + : sign_ (sign), + string_ (0) +{ + this->integer_ = + ACE_dynamic_cast (TAO_ETCL_Integer_Literal*, integer); +} + +ACE_INLINE +TAO_ETCL_Union_Value::TAO_ETCL_Union_Value (TAO_ETCL_Constraint *string) + : sign_ (0), + integer_ (0) +{ + this->string_ = + ACE_dynamic_cast (TAO_ETCL_String_Literal*, string); +} + +ACE_INLINE int +TAO_ETCL_Union_Value::sign (void) const +{ + return this->sign_; +} + +ACE_INLINE TAO_ETCL_Integer_Literal * +TAO_ETCL_Union_Value::integer (void) const +{ + return this->integer_; +} + +ACE_INLINE TAO_ETCL_String_Literal * +TAO_ETCL_Union_Value::string (void) const +{ + return this->string_; +} + + +// **************************************************************** + +ACE_INLINE +TAO_ETCL_Union_Pos::TAO_ETCL_Union_Pos (TAO_ETCL_Constraint *union_value, + TAO_ETCL_Constraint *component) + : component_ (component) +{ + this->union_value_ = + ACE_dynamic_cast (TAO_ETCL_Union_Value*, union_value); +} + +ACE_INLINE TAO_ETCL_Union_Value * +TAO_ETCL_Union_Pos::union_value (void) const +{ + return this->union_value_; +} + +ACE_INLINE TAO_ETCL_Constraint * +TAO_ETCL_Union_Pos::component (void) const +{ + return this->component_; +} + +// **************************************************************** + +ACE_INLINE +TAO_ETCL_Component_Pos::TAO_ETCL_Component_Pos (TAO_ETCL_Constraint *integer, + TAO_ETCL_Constraint *component) + : component_ (component) +{ + this->integer_ = + ACE_dynamic_cast (TAO_ETCL_Integer_Literal*, integer); +} + +ACE_INLINE TAO_ETCL_Integer_Literal * +TAO_ETCL_Component_Pos::integer (void) const +{ + return this->integer_; +} + +ACE_INLINE TAO_ETCL_Constraint * +TAO_ETCL_Component_Pos::component (void) const +{ + return this->component_; +} + +// **************************************************************** + +ACE_INLINE +TAO_ETCL_Component_Assoc::TAO_ETCL_Component_Assoc (TAO_ETCL_Constraint *identifier, + TAO_ETCL_Constraint *component) + : component_ (component) +{ + this->identifier_ = + ACE_dynamic_cast (TAO_ETCL_Identifier*, identifier); +} + +ACE_INLINE TAO_ETCL_Identifier * +TAO_ETCL_Component_Assoc::identifier (void) const +{ + return this->identifier_; +} + +ACE_INLINE TAO_ETCL_Constraint * +TAO_ETCL_Component_Assoc::component (void) const +{ + return this->component_; +} + +// **************************************************************** + +ACE_INLINE +TAO_ETCL_Component_Array::TAO_ETCL_Component_Array (TAO_ETCL_Constraint *integer, + TAO_ETCL_Constraint *component) + : component_ (component) +{ + this->integer_ = + ACE_dynamic_cast (TAO_ETCL_Integer_Literal*, integer); +} + +ACE_INLINE TAO_ETCL_Integer_Literal * +TAO_ETCL_Component_Array::integer (void) const +{ + return this->integer_; +} + +ACE_INLINE TAO_ETCL_Constraint * +TAO_ETCL_Component_Array::component (void) const +{ + return this->component_; +} + +// **************************************************************** + +ACE_INLINE +TAO_ETCL_Special::TAO_ETCL_Special (int type) + : type_ (type) +{ +} + +ACE_INLINE int +TAO_ETCL_Special::type (void) const +{ + return this->type_; +} + +// **************************************************************** + +ACE_INLINE +TAO_ETCL_Component::TAO_ETCL_Component (TAO_ETCL_Constraint *identifier, + TAO_ETCL_Constraint *component) + : component_ (component) +{ + this->identifier_ = + ACE_dynamic_cast (TAO_ETCL_Identifier*, identifier); +} + +ACE_INLINE TAO_ETCL_Identifier * +TAO_ETCL_Component::identifier (void) const +{ + return this->identifier_; +} + +ACE_INLINE TAO_ETCL_Constraint * +TAO_ETCL_Component::component (void) const +{ + return this->component_; +} + +// **************************************************************** + +ACE_INLINE +TAO_ETCL_Dot::TAO_ETCL_Dot (TAO_ETCL_Constraint *component) + : component_ (component) +{ +} + +ACE_INLINE TAO_ETCL_Constraint * +TAO_ETCL_Dot::component (void) const +{ + return this->component_; +} + +// **************************************************************** + +ACE_INLINE +TAO_ETCL_Eval::TAO_ETCL_Eval (TAO_ETCL_Constraint *component) + : component_ (component) +{ +} + +ACE_INLINE TAO_ETCL_Constraint * +TAO_ETCL_Eval::component (void) const +{ + return this->component_; +} + +// **************************************************************** + +ACE_INLINE +TAO_ETCL_Default::TAO_ETCL_Default (TAO_ETCL_Constraint *component) + : component_ (component) +{ +} + +ACE_INLINE TAO_ETCL_Constraint * +TAO_ETCL_Default::component (void) const +{ + return this->component_; +} + +// **************************************************************** + +ACE_INLINE +TAO_ETCL_Exist::TAO_ETCL_Exist (TAO_ETCL_Constraint *component) + : component_ (component) +{ +} + +ACE_INLINE TAO_ETCL_Constraint * +TAO_ETCL_Exist::component (void) const +{ + return this->component_; +} + +// **************************************************************** + +ACE_INLINE +TAO_ETCL_Unary_Expr::TAO_ETCL_Unary_Expr (int type, + TAO_ETCL_Constraint *subexpr) + : type_ (type), + subexpr_ (subexpr) +{ +} + +ACE_INLINE int +TAO_ETCL_Unary_Expr::type (void) const +{ + return this->type_; +} + +ACE_INLINE TAO_ETCL_Constraint * +TAO_ETCL_Unary_Expr::subexpr (void) const +{ + return this->subexpr_; +} + +// **************************************************************** + +ACE_INLINE +TAO_ETCL_Binary_Expr::TAO_ETCL_Binary_Expr (int type, + TAO_ETCL_Constraint *lhs, + TAO_ETCL_Constraint *rhs) + : type_ (type), + lhs_ (lhs), + rhs_ (rhs) +{ +} + +ACE_INLINE int +TAO_ETCL_Binary_Expr::type (void) const +{ + return this->type_; +} + +ACE_INLINE TAO_ETCL_Constraint * +TAO_ETCL_Binary_Expr::rhs (void) const +{ + return this->rhs_; +} + +ACE_INLINE TAO_ETCL_Constraint * +TAO_ETCL_Binary_Expr::lhs (void) const +{ + return this->lhs_; +} + +// **************************************************************** + +ACE_INLINE +TAO_ETCL_Preference::TAO_ETCL_Preference (int type, + TAO_ETCL_Constraint *subexpr) + : type_ (type), + subexpr_ (subexpr) +{ +} + +ACE_INLINE int +TAO_ETCL_Preference::type (void) const +{ + return this->type_; +} + +ACE_INLINE TAO_ETCL_Constraint * +TAO_ETCL_Preference::subexpr (void) const +{ + return this->subexpr_; +} diff --git a/TAO/orbsvcs/orbsvcs/ETCL/ETCL_l.cpp b/TAO/orbsvcs/orbsvcs/ETCL/ETCL_l.cpp new file mode 100644 index 00000000000..c1a095184e5 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ETCL/ETCL_l.cpp @@ -0,0 +1,1904 @@ +#define yy_create_buffer TAO_ETCL__create_buffer +#define yy_delete_buffer TAO_ETCL__delete_buffer +#define yy_scan_buffer TAO_ETCL__scan_buffer +#define yy_scan_string TAO_ETCL__scan_string +#define yy_scan_bytes TAO_ETCL__scan_bytes +#define yy_flex_debug TAO_ETCL__flex_debug +#define yy_init_buffer TAO_ETCL__init_buffer +#define yy_flush_buffer TAO_ETCL__flush_buffer +#define yy_load_buffer_state TAO_ETCL__load_buffer_state +#define yy_switch_to_buffer TAO_ETCL__switch_to_buffer +#define yyin TAO_ETCL_in +#define yyleng TAO_ETCL_leng +#define yylex TAO_ETCL_lex +#define yyout TAO_ETCL_out +#define yyrestart TAO_ETCL_restart +#define yytext TAO_ETCL_text + +/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * $Id$ + */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 + +#include + + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +#ifdef c_plusplus +#ifndef __cplusplus +#define __cplusplus +#endif +#endif + + +#ifdef __cplusplus + +#include +#include "ace/Synch.h" + +/* Use prototypes in function declarations. */ +#define YY_USE_PROTOS + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define YY_USE_PROTOS +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include +#include +#define YY_USE_CONST +#define YY_USE_PROTOS +#endif + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#endif + +/* Returned upon end-of-file. */ +#define 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 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 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 YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define YY_BUF_SIZE 16384 + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +extern int yyleng; +extern FILE *yyin, *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 ) + * 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 yyless() call. + */ + +/* Return all but the first 'n' matched characters back to the input stream. */ + +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, 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 yy_size_t; + + +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int 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 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 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 yy_at_bol; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as 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 yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + }; + +static YY_BUFFER_STATE 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 YY_CURRENT_BUFFER yy_current_buffer + + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart YY_PROTO(( FILE *input_file )); + +void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +void yy_load_buffer_state YY_PROTO(( void )); +YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) + +YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); + +static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +static void yy_flex_free YY_PROTO(( void * )); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + + +#define yywrap() 1 +#define YY_SKIP_YYWRAP +typedef unsigned char YY_CHAR; +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +typedef int yy_state_type; +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state YY_PROTO(( void )); +static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +static int yy_get_next_buffer YY_PROTO(( void )); +static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 41 +#define YY_END_OF_BUFFER 42 +static yyconst short int yy_accept[118] = + { 0, + 0, 0, 42, 40, 39, 41, 40, 24, 40, 22, + 23, 14, 12, 13, 25, 15, 35, 16, 40, 18, + 38, 38, 38, 31, 40, 32, 40, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 11, 21, 0, + 37, 0, 36, 0, 35, 17, 20, 19, 38, 38, + 38, 38, 27, 0, 0, 0, 38, 38, 38, 38, + 10, 38, 38, 38, 9, 38, 38, 0, 0, 38, + 38, 38, 0, 0, 0, 8, 38, 38, 38, 2, + 1, 7, 38, 38, 0, 36, 38, 33, 0, 0, + 0, 38, 38, 38, 38, 5, 34, 0, 0, 0, + + 38, 6, 3, 38, 0, 0, 0, 38, 4, 30, + 0, 0, 26, 0, 28, 29, 0 + } ; + +static yyconst int yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 4, 1, 1, 5, 1, 1, 6, 7, + 8, 9, 10, 1, 11, 12, 13, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 1, 1, 15, + 16, 17, 1, 1, 18, 19, 19, 19, 20, 21, + 19, 19, 19, 19, 19, 22, 19, 19, 19, 19, + 19, 23, 24, 25, 26, 19, 19, 19, 19, 19, + 27, 28, 29, 1, 30, 1, 31, 19, 19, 32, + + 33, 34, 35, 36, 37, 19, 19, 38, 39, 40, + 41, 42, 19, 43, 44, 45, 46, 19, 47, 48, + 49, 19, 1, 1, 1, 50, 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 yyconst int yy_meta[51] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 2, 1, 1, 1, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 1, 1, 1, 2, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 1 + } ; + +static yyconst short int yy_base[122] = + { 0, + 0, 0, 146, 147, 147, 147, 129, 147, 45, 147, + 147, 147, 147, 147, 130, 147, 40, 127, 126, 125, + 0, 122, 116, 147, 0, 147, 21, 98, 104, 88, + 98, 94, 24, 92, 89, 100, 93, 147, 147, 50, + 147, 51, 48, 115, 46, 147, 147, 147, 0, 106, + 101, 0, 147, 93, 92, 75, 91, 88, 84, 77, + 0, 71, 78, 72, 0, 76, 70, 57, 60, 90, + 93, 0, 72, 69, 68, 0, 78, 64, 63, 0, + 0, 0, 74, 69, 90, 89, 82, 0, 66, 59, + 66, 52, 52, 51, 54, 0, 0, 49, 49, 54, + + 45, 0, 0, 43, 44, 47, 39, 30, 0, 147, + 35, 37, 0, 35, 147, 147, 147, 85, 87, 62, + 89 + } ; + +static yyconst short int yy_def[122] = + { 0, + 117, 1, 117, 117, 117, 117, 117, 117, 118, 117, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, + 119, 119, 119, 117, 120, 117, 117, 119, 119, 119, + 119, 119, 119, 119, 119, 119, 119, 117, 117, 118, + 117, 117, 117, 117, 117, 117, 117, 117, 119, 119, + 119, 121, 117, 117, 117, 117, 119, 119, 119, 119, + 119, 119, 119, 119, 119, 119, 119, 118, 117, 119, + 119, 121, 117, 117, 117, 119, 119, 119, 119, 119, + 119, 119, 119, 119, 117, 117, 119, 119, 117, 117, + 117, 119, 119, 119, 119, 119, 119, 117, 117, 117, + + 119, 119, 119, 119, 117, 117, 117, 119, 119, 117, + 117, 117, 119, 117, 117, 117, 0, 117, 117, 117, + 117 + } ; + +static yyconst short int yy_nxt[198] = + { 0, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 21, 21, + 22, 21, 21, 21, 23, 21, 24, 25, 26, 27, + 28, 29, 30, 31, 21, 21, 32, 21, 33, 34, + 35, 21, 36, 21, 21, 21, 37, 21, 21, 38, + 41, 44, 53, 45, 62, 41, 68, 44, 54, 45, + 63, 43, 41, 55, 52, 56, 116, 69, 115, 85, + 85, 114, 42, 86, 113, 112, 111, 42, 68, 110, + 69, 109, 108, 107, 42, 40, 40, 40, 49, 49, + 72, 72, 106, 105, 104, 103, 102, 101, 100, 99, + + 98, 97, 86, 86, 96, 95, 94, 93, 92, 91, + 90, 89, 88, 87, 84, 83, 82, 81, 80, 79, + 78, 77, 76, 75, 74, 73, 71, 70, 43, 67, + 66, 65, 64, 61, 60, 59, 58, 57, 51, 50, + 48, 47, 46, 43, 39, 117, 3, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117 + + } ; + +static yyconst short int yy_chk[198] = + { 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, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 9, 17, 27, 17, 33, 40, 42, 45, 27, 45, + 33, 43, 68, 27, 120, 27, 114, 43, 112, 69, + 69, 111, 9, 69, 108, 107, 106, 40, 42, 105, + 43, 104, 101, 100, 68, 118, 118, 118, 119, 119, + 121, 121, 99, 98, 95, 94, 93, 92, 91, 90, + + 89, 87, 86, 85, 84, 83, 79, 78, 77, 75, + 74, 73, 71, 70, 67, 66, 64, 63, 62, 60, + 59, 58, 57, 56, 55, 54, 51, 50, 44, 37, + 36, 35, 34, 32, 31, 30, 29, 28, 23, 22, + 20, 19, 18, 15, 7, 3, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117 + + } ; + +static yy_state_type yy_last_accepting_state; +static char *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 yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "ETCL/ETCL.ll" +#define INITIAL 0 +#line 4 "ETCL/ETCL.ll" +// $Id$ +// ======================================================================== +// +// = LIBRARY +// orbsvcs/ECTL +// +// = FILENAME +// ETCL.ll +// +// = AUTHOR +// Carlos O'Ryan based on previous work by +// Seth Widoff +// +// ======================================================================== + +#include "ace/OS.h" + +#include "ETCL_Constraint.h" +#include "ETCL_y.h" + +static const char * extract_string(char*); + +#define TAO_YY_LEX_DEBUG + +#ifdef TAO_CONSTRAINT_DEBUG +#define TAO_YY_LEX_DEBUG TAO_OS::fprintf(stderr, "%s\n", yytext) +#endif /* TAO_CONSTRAINT_DEBUG */ + +#define YY_DECL int TAO_ETCL_yylex (TAO_ETCL_YYSTYPE *lvalp, void* state) + +#define YY_BREAK +#define YY_NO_UNPUT + + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap YY_PROTO(( void )); +#else +extern int yywrap YY_PROTO(( void )); +#endif +#endif + +#ifndef YY_NO_UNPUT +static void yyunput YY_PROTO(( int c, char *buf_ptr )); +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen YY_PROTO(( yyconst char * )); +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus +static int yyinput YY_PROTO(( void )); +#else +static int input YY_PROTO(( void )); +#endif +#endif + +#if YY_STACK_USED +static int yy_start_stack_ptr = 0; +static int yy_start_stack_depth = 0; +static int *yy_start_stack = 0; +#ifndef YY_NO_PUSH_STATE +static void yy_push_state YY_PROTO(( int new_state )); +#endif +#ifndef YY_NO_POP_STATE +static void yy_pop_state YY_PROTO(( void )); +#endif +#ifndef YY_NO_TOP_STATE +static int yy_top_state YY_PROTO(( void )); +#endif + +#else +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 +#endif + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include +#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 YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ + +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( yy_current_buffer->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL int yylex YY_PROTO(( void )) +#endif + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +class TAO_ETCL_Lex_State_Guard +{ +public: + TAO_ETCL_Lex_State_Guard (void *state) + { + this->previous_state = yy_current_buffer; + yy_switch_to_buffer ((YY_BUFFER_STATE)state); + } + ~TAO_ETCL_Lex_State_Guard (void) + { + yy_switch_to_buffer (this->previous_state); + } + +private: + YY_BUFFER_STATE previous_state; +}; + +YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 50 "ETCL/ETCL.ll" + + static ACE_SYNCH_MUTEX mutex; + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, mutex, -1); + + TAO_ETCL_Lex_State_Guard lex_helper (state); + + if ( yy_init ) + { + yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yy_start; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 118 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 147 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + + +do_action: /* This label is used only to access EOF actions. */ + + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yy_hold_char; + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 52 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_MIN; } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 53 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_MAX; } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 54 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_FIRST; } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 55 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_RANDOM; } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 56 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_WITH; } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 57 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_EXIST; } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 58 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_NOT; } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 59 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_AND; } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 60 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_OR; } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 61 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_IN; } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 62 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_TWIDDLE; } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 63 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_PLUS; } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 64 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_MINUS; } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 65 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_MULT; } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 66 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_DIV; } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 67 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_LT; } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 68 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_LE; } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 69 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_GT; } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 70 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_GE; } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 71 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_EQ; } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 72 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_NE; } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 73 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_LPAREN; } + YY_BREAK +case 23: +YY_RULE_SETUP +#line 74 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_RPAREN; } + YY_BREAK +case 24: +YY_RULE_SETUP +#line 75 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_DOLLAR; } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 76 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_DOT; } + YY_BREAK +case 26: +YY_RULE_SETUP +#line 77 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_DEFAULT; } + YY_BREAK +case 27: +YY_RULE_SETUP +#line 78 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_DISCRIMINANT; } + YY_BREAK +case 28: +YY_RULE_SETUP +#line 79 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_TYPE_ID; } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 80 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_REPOS_ID; } + YY_BREAK +case 30: +YY_RULE_SETUP +#line 81 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_LENGTH; } + YY_BREAK +case 31: +YY_RULE_SETUP +#line 82 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_LBRA; } + YY_BREAK +case 32: +YY_RULE_SETUP +#line 83 "ETCL/ETCL.ll" +{ TAO_YY_LEX_DEBUG; return TAO_ETCL_RBRA; } + YY_BREAK +case 33: +YY_RULE_SETUP +#line 84 "ETCL/ETCL.ll" +{ + lvalp->constraint = + new TAO_ETCL_Boolean_Literal (1); + TAO_YY_LEX_DEBUG; return TAO_ETCL_BOOLEAN; + } + YY_BREAK +case 34: +YY_RULE_SETUP +#line 89 "ETCL/ETCL.ll" +{ + lvalp->constraint = + new TAO_ETCL_Boolean_Literal (0); + TAO_YY_LEX_DEBUG; return TAO_ETCL_BOOLEAN; + } + YY_BREAK +case 35: +YY_RULE_SETUP +#line 94 "ETCL/ETCL.ll" +{ + lvalp->constraint = + new TAO_ETCL_Integer_Literal (ACE_OS::atoi (yytext)); + TAO_YY_LEX_DEBUG; return TAO_ETCL_INTEGER; + } + YY_BREAK +case 36: +YY_RULE_SETUP +#line 99 "ETCL/ETCL.ll" +{ + double v; + sscanf (yytext, "%lf", &v); + lvalp->constraint = + new TAO_ETCL_Float_Literal (v); + TAO_YY_LEX_DEBUG; return TAO_ETCL_FLOAT; + } + YY_BREAK +case 37: +YY_RULE_SETUP +#line 106 "ETCL/ETCL.ll" +{ + lvalp->constraint = + new TAO_ETCL_String_Literal (extract_string(yytext)); + TAO_YY_LEX_DEBUG; return TAO_ETCL_STRING; + } + YY_BREAK +case 38: +YY_RULE_SETUP +#line 111 "ETCL/ETCL.ll" +{ + lvalp->constraint = + new TAO_ETCL_Identifier (yytext); + TAO_YY_LEX_DEBUG; return TAO_ETCL_IDENT; + } + YY_BREAK +case 39: +YY_RULE_SETUP +#line 116 "ETCL/ETCL.ll" +{ + TAO_YY_LEX_DEBUG; break; // Ignore + } + YY_BREAK +case 40: +YY_RULE_SETUP +#line 119 "ETCL/ETCL.ll" +{ + TAO_YY_LEX_DEBUG; break; // @@ TODO + } + YY_BREAK +case 41: +YY_RULE_SETUP +#line 122 "ETCL/ETCL.ll" +ECHO; + YY_BREAK +case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between 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. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since 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 ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * 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). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ + + +/* 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 yy_get_next_buffer() + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - 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) (yy_c_buf_p - yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_current_buffer->yy_n_chars = yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ +#ifdef YY_USES_REJECT + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +#else + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; + + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; +#endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + + return ret_val; + } + + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +static yy_state_type yy_get_previous_state() + { + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = yy_start; + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 118 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; + } + + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + +#ifdef YY_USE_PROTOS +static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +#else +static yy_state_type yy_try_NUL_trans( yy_current_state ) +yy_state_type yy_current_state; +#endif + { + register int yy_is_jam; + register char *yy_cp = yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 118 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 117); + + return yy_is_jam ? 0 : yy_current_state; + } + + +#ifndef YY_NO_UNPUT +#ifdef YY_USE_PROTOS +static void yyunput( int c, register char *yy_bp ) +#else +static void yyunput( c, yy_bp ) +int c; +register char *yy_bp; +#endif + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_current_buffer->yy_n_chars = + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } +#endif /* ifndef YY_NO_UNPUT */ + + +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#endif + { + int c; + + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* 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 ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yy_c_buf_p - yytext_ptr; + ++yy_c_buf_p; + + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because 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. */ + yyrestart( yyin ); + + /* fall through */ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + return EOF; + + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; + + + return c; + } + + +#ifdef YY_USE_PROTOS +void yyrestart( FILE *input_file ) +#else +void yyrestart( input_file ) +FILE *input_file; +#endif + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + +#ifdef YY_USE_PROTOS +void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +#else +void yy_switch_to_buffer( new_buffer ) +YY_BUFFER_STATE new_buffer; +#endif + { + if ( yy_current_buffer == new_buffer ) + return; + + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + +#ifdef YY_USE_PROTOS +void yy_load_buffer_state( void ) +#else +void yy_load_buffer_state() +#endif + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +#else +YY_BUFFER_STATE yy_create_buffer( file, size ) +FILE *file; +int size; +#endif + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* 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->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; + } + + +#ifdef YY_USE_PROTOS +void yy_delete_buffer( YY_BUFFER_STATE b ) +#else +void yy_delete_buffer( b ) +YY_BUFFER_STATE b; +#endif + { + if ( ! b ) + return; + + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + +#ifndef YY_ALWAYS_INTERACTIVE +#ifndef YY_NEVER_INTERACTIVE +extern int isatty YY_PROTO(( int )); +#endif +#endif + +#ifdef YY_USE_PROTOS +void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +#else +void yy_init_buffer( b, file ) +YY_BUFFER_STATE b; +FILE *file; +#endif + + + { + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + +#if YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; +#else +#if YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; +#else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +#endif +#endif + } + + +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + + { + if ( ! b ) + return; + + b->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->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } + + +#ifndef YY_NO_SCAN_BUFFER +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +#else +YY_BUFFER_STATE yy_scan_buffer( base, size ) +char *base; +yy_size_t size; +#endif + { + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; + } +#endif + + +#ifndef YY_NO_SCAN_STRING +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) +#else +YY_BUFFER_STATE yy_scan_string( yy_str ) +yyconst char *yy_str; +#endif + { + int len; + for ( len = 0; yy_str[len]; ++len ) + ; + + return yy_scan_bytes( yy_str, len ); + } +#endif + + +#ifndef YY_NO_SCAN_BYTES +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +#else +YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +yyconst char *bytes; +int len; +#endif + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; + } +#endif + + +#ifndef YY_NO_PUSH_STATE +#ifdef YY_USE_PROTOS +static void yy_push_state( int new_state ) +#else +static void yy_push_state( new_state ) +int new_state; +#endif + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } +#endif + + +#ifndef YY_NO_POP_STATE +static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif + + +#ifndef YY_NO_TOP_STATE +static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +#ifdef YY_USE_PROTOS +static void yy_fatal_error( yyconst char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } + + + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + +/* Internal utility routines. */ + +#ifndef yytext_ptr +#ifdef YY_USE_PROTOS +static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +#else +static void yy_flex_strncpy( s1, s2, n ) +char *s1; +yyconst char *s2; +int n; +#endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } +#endif + +#ifdef YY_NEED_STRLEN +#ifdef YY_USE_PROTOS +static int yy_flex_strlen( yyconst char *s ) +#else +static int yy_flex_strlen( s ) +yyconst char *s; +#endif + { + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; + } +#endif + + +#ifdef YY_USE_PROTOS +static void *yy_flex_alloc( yy_size_t size ) +#else +static void *yy_flex_alloc( size ) +yy_size_t size; +#endif + { + return (void *) malloc( size ); + } + +#ifdef YY_USE_PROTOS +static void *yy_flex_realloc( void *ptr, yy_size_t size ) +#else +static void *yy_flex_realloc( ptr, size ) +void *ptr; +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 YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + free( ptr ); + } + +#if YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif +#line 122 "ETCL/ETCL.ll" + + +const char* +extract_string(char* str) +{ + char *t = str; + for (char * i = str + 1; *i != 0; ++i, ++t) + { + if (*i == '\\') + { + ++i; + if (*i == 0) + return 0; + else if (*i == 't') + *t = '\t'; + else if (*i == 'n') + *t = '\n'; + else if (*i == '\\') + *t = '\\'; + else + *t = *i; + continue; + } + *t = *i; + + } + + return str; +} diff --git a/TAO/orbsvcs/orbsvcs/ETCL/ETCL_l.cpp.diff b/TAO/orbsvcs/orbsvcs/ETCL/ETCL_l.cpp.diff new file mode 100644 index 00000000000..5b87c3845f4 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ETCL/ETCL_l.cpp.diff @@ -0,0 +1,143 @@ +--- ETCL_l.cpp.orig Mon Feb 7 18:49:18 2000 ++++ ETCL_l.cpp Mon Feb 7 18:51:27 2000 +@@ -469,7 +469,7 @@ + // + // = LIBRARY + // orbsvcs/ECTL +-// ++// + // = FILENAME + // ETCL.ll + // +@@ -641,6 +641,23 @@ + #define YY_RULE_SETUP \ + YY_USER_ACTION + ++class TAO_ETCL_Lex_State_Guard ++{ ++public: ++ TAO_ETCL_Lex_State_Guard (void *state) ++ { ++ this->previous_state = yy_current_buffer; ++ yy_switch_to_buffer ((YY_BUFFER_STATE)state); ++ } ++ ~TAO_ETCL_Lex_State_Guard (void) ++ { ++ yy_switch_to_buffer (this->previous_state); ++ } ++ ++private: ++ YY_BUFFER_STATE previous_state; ++}; ++ + YY_DECL + { + register yy_state_type yy_current_state; +@@ -649,7 +666,10 @@ + + #line 50 "ETCL/ETCL.ll" + ++ static ACE_SYNCH_MUTEX mutex; ++ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, mutex, -1); + ++ TAO_ETCL_Lex_State_Guard lex_helper (state); + + if ( yy_init ) + { +@@ -895,8 +915,8 @@ + case 33: + YY_RULE_SETUP + #line 84 "ETCL/ETCL.ll" +-{ +- lvalp->constraint = ++{ ++ lvalp->constraint = + new TAO_ETCL_Boolean_Literal (1); + TAO_YY_LEX_DEBUG; return TAO_ETCL_BOOLEAN; + } +@@ -904,8 +924,8 @@ + case 34: + YY_RULE_SETUP + #line 89 "ETCL/ETCL.ll" +-{ +- lvalp->constraint = ++{ ++ lvalp->constraint = + new TAO_ETCL_Boolean_Literal (0); + TAO_YY_LEX_DEBUG; return TAO_ETCL_BOOLEAN; + } +@@ -913,10 +933,10 @@ + case 35: + YY_RULE_SETUP + #line 94 "ETCL/ETCL.ll" +-{ +- lvalp->constraint = ++{ ++ lvalp->constraint = + new TAO_ETCL_Integer_Literal (ACE_OS::atoi (yytext)); +- TAO_YY_LEX_DEBUG; return TAO_ETCL_INTEGER; ++ TAO_YY_LEX_DEBUG; return TAO_ETCL_INTEGER; + } + YY_BREAK + case 36: +@@ -924,41 +944,41 @@ + #line 99 "ETCL/ETCL.ll" + { + double v; +- sscanf (yytext, "%lf", &v); +- lvalp->constraint = ++ sscanf (yytext, "%lf", &v); ++ lvalp->constraint = + new TAO_ETCL_Float_Literal (v); +- TAO_YY_LEX_DEBUG; return TAO_ETCL_FLOAT; ++ TAO_YY_LEX_DEBUG; return TAO_ETCL_FLOAT; + } + YY_BREAK + case 37: + YY_RULE_SETUP + #line 106 "ETCL/ETCL.ll" +-{ ++{ + lvalp->constraint = + new TAO_ETCL_String_Literal (extract_string(yytext)); +- TAO_YY_LEX_DEBUG; return TAO_ETCL_STRING; ++ TAO_YY_LEX_DEBUG; return TAO_ETCL_STRING; + } + YY_BREAK + case 38: + YY_RULE_SETUP + #line 111 "ETCL/ETCL.ll" +-{ +- lvalp->constraint = ++{ ++ lvalp->constraint = + new TAO_ETCL_Identifier (yytext); +- TAO_YY_LEX_DEBUG; return TAO_ETCL_IDENT; ++ TAO_YY_LEX_DEBUG; return TAO_ETCL_IDENT; + } + YY_BREAK + case 39: + YY_RULE_SETUP + #line 116 "ETCL/ETCL.ll" +-{ ++{ + TAO_YY_LEX_DEBUG; break; // Ignore + } + YY_BREAK + case 40: + YY_RULE_SETUP + #line 119 "ETCL/ETCL.ll" +-{ ++{ + TAO_YY_LEX_DEBUG; break; // @@ TODO + } + YY_BREAK +@@ -1877,7 +1897,7 @@ + continue; + } + *t = *i; +- ++ + } + + return str; diff --git a/TAO/orbsvcs/orbsvcs/ETCL/ETCL_y.cpp b/TAO/orbsvcs/orbsvcs/ETCL/ETCL_y.cpp new file mode 100644 index 00000000000..f4976f4c52b --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ETCL/ETCL_y.cpp @@ -0,0 +1,1277 @@ +// $Id$ + +/* A Bison parser, made from ETCL/ETCL.yy + by GNU Bison version 1.28 */ + +#define YYBISON 1 /* Identify Bison output. */ + +#define yyparse TAO_ETCL_yyparse +#define yylex TAO_ETCL_yylex +#define yyerror TAO_ETCL_yyerror +#define yylval TAO_ETCL_yylval +#define yychar TAO_ETCL_yychar +#define yydebug TAO_ETCL_yydebug +#define yynerrs TAO_ETCL_yynerrs +#define TAO_ETCL_GT 257 +#define TAO_ETCL_GE 258 +#define TAO_ETCL_LT 259 +#define TAO_ETCL_LE 260 +#define TAO_ETCL_EQ 261 +#define TAO_ETCL_NE 262 +#define TAO_ETCL_EXIST 263 +#define TAO_ETCL_DEFAULT 264 +#define TAO_ETCL_AND 265 +#define TAO_ETCL_OR 266 +#define TAO_ETCL_NOT 267 +#define TAO_ETCL_IN 268 +#define TAO_ETCL_TWIDDLE 269 +#define TAO_ETCL_BOOLEAN 270 +#define TAO_ETCL_PLUS 271 +#define TAO_ETCL_MINUS 272 +#define TAO_ETCL_MULT 273 +#define TAO_ETCL_DIV 274 +#define TAO_ETCL_UMINUS 275 +#define TAO_ETCL_INTEGER 276 +#define TAO_ETCL_FLOAT 277 +#define TAO_ETCL_STRING 278 +#define TAO_ETCL_RPAREN 279 +#define TAO_ETCL_LPAREN 280 +#define TAO_ETCL_RBRA 281 +#define TAO_ETCL_LBRA 282 +#define TAO_ETCL_IDENT 283 +#define TAO_ETCL_UNSIGNED 284 +#define TAO_ETCL_SIGNED 285 +#define TAO_ETCL_DOUBLE 286 +#define TAO_ETCL_CONSTRAINT 287 +#define TAO_ETCL_SEQUENCE 288 +#define TAO_ETCL_WITH 289 +#define TAO_ETCL_MAX 290 +#define TAO_ETCL_MIN 291 +#define TAO_ETCL_FIRST 292 +#define TAO_ETCL_RANDOM 293 +#define TAO_ETCL_DOLLAR 294 +#define TAO_ETCL_DOT 295 +#define TAO_ETCL_DISCRIMINANT 296 +#define TAO_ETCL_LENGTH 297 +#define TAO_ETCL_TYPE_ID 298 +#define TAO_ETCL_REPOS_ID 299 + +#line 1 "ETCL/ETCL.yy" + +// $Id$ +// ======================================================================== +// +// = LIBRARY +// orbsvcs / Extended Trader Constraint Language parser. +// +// = FILENAME +// ETCL.yy +// +// = AUTHOR +// Carlos O'Ryan based on previous work by +// Seth Widoff +// +// ======================================================================== + +#include "orbsvcs/ETCL/ETCL_Constraint.h" + +#define YYPARSE_PARAM lex_state +#define YYLEX_PARAM lex_state + +//#define YYDEBUG 1 + +#define YYSTYPE TAO_ETCL_YYSTYPE + +static void yyerror (const char *) +{ + // @@ TODO + // Ignore error messages +} + +extern int yylex (YYSTYPE *lvalp, void *lex_state); + +#ifndef YYSTYPE +#define YYSTYPE int +#endif +#include + +#ifndef __cplusplus +#ifndef __STDC__ +#define const +#endif +#endif + + + +#define YYFINAL 112 +#define YYFLAG -32768 +#define YYNTBASE 46 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 299 ? yytranslate[x] : 65) + +static const char 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, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45 +}; + +#if YYDEBUG != 0 +static const short yyprhs[] = { 0, + 0, 2, 4, 7, 10, 13, 15, 17, 21, 23, + 27, 29, 33, 37, 41, 45, 49, 53, 55, 59, + 64, 66, 70, 72, 76, 80, 82, 86, 90, 92, + 95, 97, 101, 103, 106, 109, 111, 114, 117, 119, + 121, 125, 129, 132, 133, 136, 139, 141, 143, 144, + 147, 149, 151, 154, 156, 158, 160, 162, 164, 166, + 171, 176, 179, 184, 185, 187, 190, 193 +}; + +static const short yyrhs[] = { 48, + 0, 47, 0, 37, 48, 0, 36, 48, 0, 35, + 48, 0, 38, 0, 39, 0, 48, 12, 49, 0, + 49, 0, 49, 11, 50, 0, 50, 0, 51, 7, + 51, 0, 51, 8, 51, 0, 51, 3, 51, 0, + 51, 4, 51, 0, 51, 5, 51, 0, 51, 6, + 51, 0, 51, 0, 52, 14, 57, 0, 52, 14, + 40, 57, 0, 52, 0, 53, 15, 53, 0, 53, + 0, 53, 17, 54, 0, 53, 18, 54, 0, 54, + 0, 54, 19, 55, 0, 54, 20, 55, 0, 55, + 0, 13, 56, 0, 56, 0, 26, 48, 25, 0, + 22, 0, 17, 22, 0, 18, 22, 0, 23, 0, + 17, 23, 0, 18, 23, 0, 24, 0, 16, 0, + 9, 40, 57, 0, 10, 40, 57, 0, 40, 57, + 0, 0, 41, 59, 0, 29, 58, 0, 60, 0, + 61, 0, 0, 41, 59, 0, 60, 0, 61, 0, + 29, 58, 0, 43, 0, 42, 0, 44, 0, 45, + 0, 62, 0, 63, 0, 28, 22, 27, 58, 0, + 26, 29, 25, 58, 0, 22, 58, 0, 26, 64, + 25, 58, 0, 0, 22, 0, 17, 22, 0, 18, + 22, 0, 24, 0 +}; + +#endif + +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 75, 76, 79, 81, 83, 85, 87, 91, 93, 96, + 98, 101, 103, 105, 107, 109, 111, 113, 116, 118, + 120, 123, 125, 128, 130, 132, 135, 137, 139, 142, + 144, 147, 150, 152, 154, 157, 159, 161, 164, 165, + 167, 169, 171, 175, 177, 180, 183, 184, 187, 189, + 192, 193, 196, 198, 200, 202, 204, 206, 207, 210, + 214, 218, 222, 226, 228, 230, 232, 234 +}; +#endif + + +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) + +static const char * const yytname[] = { "$","error","$undefined.","TAO_ETCL_GT", +"TAO_ETCL_GE","TAO_ETCL_LT","TAO_ETCL_LE","TAO_ETCL_EQ","TAO_ETCL_NE","TAO_ETCL_EXIST", +"TAO_ETCL_DEFAULT","TAO_ETCL_AND","TAO_ETCL_OR","TAO_ETCL_NOT","TAO_ETCL_IN", +"TAO_ETCL_TWIDDLE","TAO_ETCL_BOOLEAN","TAO_ETCL_PLUS","TAO_ETCL_MINUS","TAO_ETCL_MULT", +"TAO_ETCL_DIV","TAO_ETCL_UMINUS","TAO_ETCL_INTEGER","TAO_ETCL_FLOAT","TAO_ETCL_STRING", +"TAO_ETCL_RPAREN","TAO_ETCL_LPAREN","TAO_ETCL_RBRA","TAO_ETCL_LBRA","TAO_ETCL_IDENT", +"TAO_ETCL_UNSIGNED","TAO_ETCL_SIGNED","TAO_ETCL_DOUBLE","TAO_ETCL_CONSTRAINT", +"TAO_ETCL_SEQUENCE","TAO_ETCL_WITH","TAO_ETCL_MAX","TAO_ETCL_MIN","TAO_ETCL_FIRST", +"TAO_ETCL_RANDOM","TAO_ETCL_DOLLAR","TAO_ETCL_DOT","TAO_ETCL_DISCRIMINANT","TAO_ETCL_LENGTH", +"TAO_ETCL_TYPE_ID","TAO_ETCL_REPOS_ID","constraint","preference","bool_or","bool_and", +"bool_compare","expr_in","expr_twiddle","expr","term","factor_not","factor", +"component","component_ext","component_dot","component_array","component_assoc", +"component_pos","union_pos","union_val", NULL +}; +#endif + +static const short yyr1[] = { 0, + 46, 46, 47, 47, 47, 47, 47, 48, 48, 49, + 49, 50, 50, 50, 50, 50, 50, 50, 51, 51, + 51, 52, 52, 53, 53, 53, 54, 54, 54, 55, + 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 57, 57, 57, 57, 57, 58, 58, + 58, 58, 59, 59, 59, 59, 59, 59, 59, 60, + 61, 62, 63, 64, 64, 64, 64, 64 +}; + +static const short yyr2[] = { 0, + 1, 1, 2, 2, 2, 1, 1, 3, 1, 3, + 1, 3, 3, 3, 3, 3, 3, 1, 3, 4, + 1, 3, 1, 3, 3, 1, 3, 3, 1, 2, + 1, 3, 1, 2, 2, 1, 2, 2, 1, 1, + 3, 3, 2, 0, 2, 2, 1, 1, 0, 2, + 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, + 4, 2, 4, 0, 1, 2, 2, 1 +}; + +static const short yydefact[] = { 0, + 0, 0, 0, 40, 0, 0, 33, 36, 39, 0, + 0, 0, 0, 6, 7, 44, 2, 1, 9, 11, + 18, 21, 23, 26, 29, 31, 44, 44, 30, 34, + 37, 35, 38, 0, 5, 4, 3, 0, 0, 49, + 0, 43, 47, 48, 0, 0, 0, 0, 0, 0, + 0, 0, 44, 0, 0, 0, 0, 0, 41, 42, + 32, 0, 0, 0, 46, 51, 52, 49, 64, 49, + 55, 54, 56, 57, 45, 58, 59, 8, 10, 14, + 15, 16, 17, 12, 13, 44, 19, 22, 24, 25, + 27, 28, 49, 49, 50, 62, 0, 0, 65, 68, + 0, 53, 20, 61, 60, 66, 67, 49, 63, 0, + 0, 0 +}; + +static const short yydefgoto[] = { 110, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 42, 65, 75, 66, 67, 76, 77, 101 +}; + +static const short yypact[] = { 41, + -39, -32, 0,-32768, 26, 38,-32768,-32768,-32768, 73, + 73, 73, 73,-32768,-32768, 27,-32768, 3, 9,-32768, + 97, 13, 103, 54,-32768,-32768, 27, 27,-32768,-32768, +-32768,-32768,-32768, -6, 3, 3, 3, 4, 14, 43, + -1,-32768,-32768,-32768, 73, 73, 73, 73, 73, 73, + 73, 73, 6, 73, 73, 73, 73, 73,-32768,-32768, +-32768, 50, 11, -1,-32768,-32768,-32768, 43, 70, 43, +-32768,-32768,-32768,-32768,-32768,-32768,-32768, 9,-32768,-32768, +-32768,-32768,-32768,-32768,-32768, 27,-32768, 105, 54, 54, +-32768,-32768, 43, 43,-32768,-32768, 30, 44,-32768,-32768, + 60,-32768,-32768,-32768,-32768,-32768,-32768, 43,-32768, 93, + 98,-32768 +}; + +static const short yypgoto[] = {-32768, +-32768, 104, 67, 80, 59,-32768, 65, 69, 71, 124, + -24, -63, 66, -16, -14,-32768,-32768,-32768 +}; + + +#define YYLAST 130 + + +static const short yytable[] = { 43, + 27, 44, 59, 60, 96, 45, 102, 28, 1, 2, + 43, 43, 44, 44, 45, 4, 5, 6, 61, 46, + 68, 7, 8, 9, 69, 10, 53, 70, 87, 104, + 105, 38, 62, 39, 40, 63, 43, 94, 44, 16, + 71, 72, 73, 74, 109, 86, 41, 30, 31, 1, + 2, 106, 38, 3, 39, 40, 4, 5, 6, 32, + 33, 103, 7, 8, 9, 107, 10, 41, 38, 43, + 39, 44, 57, 58, 93, 11, 12, 13, 14, 15, + 16, 1, 2, 64, 108, 3, 97, 98, 4, 5, + 6, 99, 111, 100, 7, 8, 9, 112, 10, 47, + 48, 49, 50, 51, 52, 80, 81, 82, 83, 84, + 85, 78, 16, 34, 35, 36, 37, 54, 88, 55, + 56, 55, 56, 89, 90, 79, 29, 91, 92, 95 +}; + +static const short yycheck[] = { 16, + 40, 16, 27, 28, 68, 12, 70, 40, 9, 10, + 27, 28, 27, 28, 12, 16, 17, 18, 25, 11, + 22, 22, 23, 24, 26, 26, 14, 29, 53, 93, + 94, 26, 29, 28, 29, 22, 53, 27, 53, 40, + 42, 43, 44, 45, 108, 40, 41, 22, 23, 9, + 10, 22, 26, 13, 28, 29, 16, 17, 18, 22, + 23, 86, 22, 23, 24, 22, 26, 41, 26, 86, + 28, 86, 19, 20, 25, 35, 36, 37, 38, 39, + 40, 9, 10, 41, 25, 13, 17, 18, 16, 17, + 18, 22, 0, 24, 22, 23, 24, 0, 26, 3, + 4, 5, 6, 7, 8, 47, 48, 49, 50, 51, + 52, 45, 40, 10, 11, 12, 13, 15, 54, 17, + 18, 17, 18, 55, 56, 46, 3, 57, 58, 64 +}; +#define YYPURE 1 + +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "/usr/share/misc/bison.simple" +/* 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 YYSTACK_USE_ALLOCA +#ifdef alloca +#define YYSTACK_USE_ALLOCA +#else /* alloca not defined */ +#ifdef __GNUC__ +#define 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 YYSTACK_USE_ALLOCA +#include +#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 +#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 */ + #pragma alloca +#define 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 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 /* YYSTACK_USE_ALLOCA not defined */ + +#ifdef YYSTACK_USE_ALLOCA +#define YYSTACK_ALLOC alloca +#else +#define 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 yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab +#define YYRECOVERING() (!!yyerrstatus) +#define YYBACKUP(token, value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + +#ifndef YYPURE +#define YYLEX yylex() +#endif + +#ifdef YYPURE +#ifdef YYLSP_NEEDED +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval, &yylloc) +#endif +#else /* not YYLSP_NEEDED */ +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval) +#endif +#endif /* not YYLSP_NEEDED */ +#endif + +/* If nonreentrant, generate the variables here */ + +#ifndef YYPURE + +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ + +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ +#endif + +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ + +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ +#endif + +/* YYINITDEPTH indicates the initial size of the parser's stacks */ + +#ifndef YYINITDEPTH +#define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ + +#if YYMAXDEPTH == 0 +#undef YYMAXDEPTH +#endif + +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 10000 +#endif + +/* Define __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 __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 +__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 +__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 + +#line 217 "/usr/share/misc/bison.simple" + +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into 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 YYPARSE_PARAM +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +#ifdef YYPARSE_PARAM +int yyparse (void *); +#else +int yyparse (void); +#endif +#endif + +int +yyparse(YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; + +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else +#define YYPOPSTACK (yyvsp--, yyssp--) +#endif + + int yystacksize = YYINITDEPTH; + int yyfree_stacks = 0; + +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; +#endif +#endif + + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + + int yylen; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = 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. */ + + yyssp = yyss - 1; + yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif + +/* Push a new state, which is found in 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. */ +yynewstate: + + *++yyssp = yystate; + + if (yyssp >= yyss + 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. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + + /* Get the current used size of the three stacks, in elements. */ + int size = yyssp - yyss + 1; + +#ifdef yyoverflow + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); +#else + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif + + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif +#else /* no yyoverflow */ + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + { + yyerror("parser stack overflow"); + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 2; + } + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; +#ifndef YYSTACK_USE_ALLOCA + yyfree_stacks = 1; +#endif + yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, + size * (unsigned int) sizeof (*yyssp)); + yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, + size * (unsigned int) sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, + size * (unsigned int) sizeof (*yylsp)); +#endif +#endif /* no yyoverflow */ + + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); +#endif + + goto yybackup; + yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); +#endif + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Now at end of input.\n"); +#endif + } + else + { + yychar1 = YYTRANSLATE(yychar); + +#if YYDEBUG != 0 + if (yydebug) + { + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ +#ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +#endif + fprintf (stderr, ")\n"); + } +#endif + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +#endif + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + + yystate = yyn; + goto yynewstate; + +/* Do the default action for the current state. */ +yydefault: + + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + +/* Do a reduction. yyn is the number of a rule to reduce with. */ +yyreduce: + yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ + +#if YYDEBUG != 0 + if (yydebug) + { + int i; + + fprintf (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + + /* Print the symbols being reduced, and their result. */ + for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) + fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif + + + switch (yyn) { + +case 3: +#line 80 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Preference (TAO_ETCL_MIN, yyvsp[0].constraint); ; + break;} +case 4: +#line 82 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Preference (TAO_ETCL_MAX, yyvsp[0].constraint); ; + break;} +case 5: +#line 84 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Preference (TAO_ETCL_WITH, yyvsp[0].constraint); ; + break;} +case 6: +#line 86 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Preference (TAO_ETCL_FIRST); ; + break;} +case 7: +#line 88 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Preference (TAO_ETCL_RANDOM); ; + break;} +case 8: +#line 92 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Binary_Expr (TAO_ETCL_OR, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 10: +#line 97 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Binary_Expr (TAO_ETCL_AND, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 12: +#line 102 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Binary_Expr (TAO_ETCL_EQ, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 13: +#line 104 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Binary_Expr (TAO_ETCL_NE, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 14: +#line 106 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Binary_Expr (TAO_ETCL_GT, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 15: +#line 108 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Binary_Expr (TAO_ETCL_GE, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 16: +#line 110 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Binary_Expr (TAO_ETCL_LT, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 17: +#line 112 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Binary_Expr (TAO_ETCL_LE, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 19: +#line 117 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Binary_Expr (TAO_ETCL_IN, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 20: +#line 119 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Binary_Expr (TAO_ETCL_IN, yyvsp[-3].constraint, yyvsp[0].constraint); ; + break;} +case 22: +#line 124 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Binary_Expr (TAO_ETCL_TWIDDLE, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 24: +#line 129 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Binary_Expr (TAO_ETCL_PLUS, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 25: +#line 131 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Binary_Expr (TAO_ETCL_MINUS, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 27: +#line 136 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Binary_Expr (TAO_ETCL_MULT, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 28: +#line 138 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Binary_Expr (TAO_ETCL_DIV, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 30: +#line 143 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Unary_Expr (TAO_ETCL_NOT, yyvsp[0].constraint); ; + break;} +case 32: +#line 148 "ETCL/ETCL.yy" +{ yyval.constraint = yyvsp[-1].constraint; ; + break;} +case 33: +#line 151 "ETCL/ETCL.yy" +{ yyval.constraint = yyvsp[0].constraint; ; + break;} +case 34: +#line 153 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Unary_Expr (TAO_ETCL_PLUS, yyvsp[0].constraint); ; + break;} +case 35: +#line 155 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Unary_Expr (TAO_ETCL_MINUS, yyvsp[0].constraint); ; + break;} +case 36: +#line 158 "ETCL/ETCL.yy" +{ yyval.constraint = yyvsp[0].constraint; ; + break;} +case 37: +#line 160 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Unary_Expr (TAO_ETCL_PLUS, yyvsp[0].constraint); ; + break;} +case 38: +#line 162 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Unary_Expr (TAO_ETCL_MINUS, yyvsp[0].constraint); ; + break;} +case 41: +#line 168 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Exist (yyvsp[0].constraint); ; + break;} +case 42: +#line 170 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Default (yyvsp[0].constraint); ; + break;} +case 43: +#line 172 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Eval (yyvsp[0].constraint); ; + break;} +case 44: +#line 176 "ETCL/ETCL.yy" +{ yyval.constraint = 0 ; + break;} +case 45: +#line 178 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Dot (yyvsp[0].constraint); ; + break;} +case 46: +#line 181 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Component (yyvsp[-1].constraint, yyvsp[0].constraint); ; + break;} +case 49: +#line 188 "ETCL/ETCL.yy" +{ yyval.constraint = 0 ; + break;} +case 50: +#line 190 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Dot (yyvsp[0].constraint); ; + break;} +case 53: +#line 197 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Component (yyvsp[-1].constraint, yyvsp[0].constraint); ; + break;} +case 54: +#line 199 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Special (TAO_ETCL_LENGTH); ; + break;} +case 55: +#line 201 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Special (TAO_ETCL_DISCRIMINANT); ; + break;} +case 56: +#line 203 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Special (TAO_ETCL_TYPE_ID); ; + break;} +case 57: +#line 205 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Special (TAO_ETCL_REPOS_ID); ; + break;} +case 60: +#line 211 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Component_Array (yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 61: +#line 215 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Component_Assoc (yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 62: +#line 219 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Component_Pos (yyvsp[-1].constraint, yyvsp[0].constraint); ; + break;} +case 63: +#line 223 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Union_Pos (yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 64: +#line 227 "ETCL/ETCL.yy" +{ yyval.constraint = 0; ; + break;} +case 65: +#line 229 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Union_Value (+1, yyvsp[0].constraint); ; + break;} +case 66: +#line 231 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Union_Value (+1, yyvsp[0].constraint); ; + break;} +case 67: +#line 233 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Union_Value (-1, yyvsp[0].constraint); ; + break;} +case 68: +#line 235 "ETCL/ETCL.yy" +{ yyval.constraint = new TAO_ETCL_Union_Value (yyvsp[0].constraint); ; + break;} +} + /* the action file gets copied in in place of this dollarsign */ +#line 543 "/usr/share/misc/bison.simple" + + yyvsp -= yylen; + yyssp -= yylen; +#ifdef YYLSP_NEEDED + yylsp -= yylen; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + + *++yyvsp = yyval; + +#ifdef YYLSP_NEEDED + yylsp++; + if (yylen == 0) + { + yylsp->first_line = yylloc.first_line; + yylsp->first_column = yylloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+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. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + +yyerrlab: /* here on detecting error */ + + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + int size = 0; + char *msg; + int x, count; + + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) malloc(size + 15); + if (msg != 0) + { + strcpy(msg, "parse error"); + + if (count < 5) + { + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } + } + yyerror(msg); + free(msg); + } + else + yyerror ("parse error; also virtual memory exceeded"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror("parse error"); + } + + goto yyerrlab1; +yyerrlab1: /* here on error raised explicitly by an action */ + + if (yyerrstatus == 3) + { + /* if just tried and failed to reuse lookahead token after an error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +#endif + + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token + after shifting the error token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + +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. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; +#endif + +yyerrpop: /* pop the current state because it cannot handle the error token */ + + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; +#ifdef YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "Error: state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + +yyerrhandle: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting error token, "); +#endif + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + yystate = yyn; + goto yynewstate; + + yyacceptlab: + /* YYACCEPT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 0; + + yyabortlab: + /* YYABORT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 1; +} +#line 238 "ETCL/ETCL.yy" + + +//extern int yydebug = 1; diff --git a/TAO/orbsvcs/orbsvcs/ETCL/ETCL_y.h b/TAO/orbsvcs/orbsvcs/ETCL/ETCL_y.h new file mode 100644 index 00000000000..992da22bf02 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ETCL/ETCL_y.h @@ -0,0 +1,48 @@ +// $Id$ +#ifndef YYSTYPE +#define YYSTYPE int +#endif +#define TAO_ETCL_GT 257 +#define TAO_ETCL_GE 258 +#define TAO_ETCL_LT 259 +#define TAO_ETCL_LE 260 +#define TAO_ETCL_EQ 261 +#define TAO_ETCL_NE 262 +#define TAO_ETCL_EXIST 263 +#define TAO_ETCL_DEFAULT 264 +#define TAO_ETCL_AND 265 +#define TAO_ETCL_OR 266 +#define TAO_ETCL_NOT 267 +#define TAO_ETCL_IN 268 +#define TAO_ETCL_TWIDDLE 269 +#define TAO_ETCL_BOOLEAN 270 +#define TAO_ETCL_PLUS 271 +#define TAO_ETCL_MINUS 272 +#define TAO_ETCL_MULT 273 +#define TAO_ETCL_DIV 274 +#define TAO_ETCL_UMINUS 275 +#define TAO_ETCL_INTEGER 276 +#define TAO_ETCL_FLOAT 277 +#define TAO_ETCL_STRING 278 +#define TAO_ETCL_RPAREN 279 +#define TAO_ETCL_LPAREN 280 +#define TAO_ETCL_RBRA 281 +#define TAO_ETCL_LBRA 282 +#define TAO_ETCL_IDENT 283 +#define TAO_ETCL_UNSIGNED 284 +#define TAO_ETCL_SIGNED 285 +#define TAO_ETCL_DOUBLE 286 +#define TAO_ETCL_CONSTRAINT 287 +#define TAO_ETCL_SEQUENCE 288 +#define TAO_ETCL_WITH 289 +#define TAO_ETCL_MAX 290 +#define TAO_ETCL_MIN 291 +#define TAO_ETCL_FIRST 292 +#define TAO_ETCL_RANDOM 293 +#define TAO_ETCL_DOLLAR 294 +#define TAO_ETCL_DOT 295 +#define TAO_ETCL_DISCRIMINANT 296 +#define TAO_ETCL_LENGTH 297 +#define TAO_ETCL_TYPE_ID 298 +#define TAO_ETCL_REPOS_ID 299 + diff --git a/TAO/orbsvcs/orbsvcs/ETCL/README b/TAO/orbsvcs/orbsvcs/ETCL/README new file mode 100644 index 00000000000..dca67871f74 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/ETCL/README @@ -0,0 +1,12 @@ +# $Id$ +# +# Implement an "Extended Trader Constraint Language" parser. +# This language was defined as part of the Notification Service +# [give URL] to define filtering constraints. It is in fact an +# extension on the "Trader Constraint Language", using in the Trading +# Service [URL] to constraint on user queries. +# +# Other services use the same language, including the Logging Service, +# parts of the Fault Tolerance services and (in the future) TAO's +# Real-time Event Service. +# diff --git a/TAO/orbsvcs/orbsvcs/Makefile b/TAO/orbsvcs/orbsvcs/Makefile index 50274267416..6c12a0ec9cf 100644 --- a/TAO/orbsvcs/orbsvcs/Makefile +++ b/TAO/orbsvcs/orbsvcs/Makefile @@ -12,7 +12,7 @@ LIBNAME = liborbsvcs LIB = $(LIBNAME).a SHLIB = $(LIBNAME).$(SOEXT) -VPATH=.:Naming:Time:Concurrency:Property:Trader:Sched:Event:CosEvent:Log:Notify:ETCL: +VPATH=.:Naming:Time:Concurrency:Property:Trader:Sched:Event:CosEvent:Log:Notify:ETCL:ESF: ACE_SHLIBS = -lTAO -lACE @@ -403,6 +403,7 @@ include $(ACE_ROOT)/include/makeinclude/rules.local.GNU LDFLAGS += -L$(TAO_ROOT)/tao CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs \ -I$(TAO_ROOT)/orbsvcs/orbsvcs/Event \ + -I$(TAO_ROOT)/orbsvcs/orbsvcs/ESF \ $(foreach svc, $(TAO_ORBSVCS), -DTAO_ORBSVCS_HAS_$(svc)) # -- cgit v1.2.1