diff options
Diffstat (limited to 'ace')
58 files changed, 2731 insertions, 2404 deletions
diff --git a/ace/ACE.cpp b/ace/ACE.cpp index af89390c667..4548d7596bd 100644 --- a/ace/ACE.cpp +++ b/ace/ACE.cpp @@ -164,7 +164,8 @@ ACE::compiler_beta_version (void) char ACE::debug (void) { - return ACE::debug_; + static const char* debug = ACE_OS::getenv ("ACE_DEBUG"); + return ACE::debug_ != 0 ? ACE::debug_ : (debug != 0 ? (*debug - '0'): 0); } void diff --git a/ace/ATM_Addr.h b/ace/ATM_Addr.h index c3f112e8c1c..551b5ca1b5c 100644 --- a/ace/ATM_Addr.h +++ b/ace/ATM_Addr.h @@ -74,7 +74,7 @@ public: u_char selector = DEFAULT_SELECTOR); /** - * Creates an <ACE_ATM_Addr> from an ATMSAPAddress structure. This + * Creates an ACE_ATM_Addr from an ATMSAPAddress structure. This * is vendor specific (FORE systems). May need to change when other * vendors are supported. */ @@ -82,7 +82,7 @@ public: u_char selector = DEFAULT_SELECTOR); /** - * Initializes an <ACE_ATM_Addr> from the <sap> which can be + * Initializes an ACE_ATM_Addr from the <sap> which can be * "atm-address" (e.g., * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") or "hostname" * (e.g., "frisbee.cs.wustl.edu"). @@ -98,12 +98,12 @@ public: /// t_atm_sap_addr.SVE_tag_addr, t_atm_sap_addr.SVE_tag_selector) void init (u_char selector = DEFAULT_SELECTOR); - /// Initializes from another <ACE_ATM_Addr>. + /// Initializes from another ACE_ATM_Addr. int set (const ACE_ATM_Addr &, u_char selector = DEFAULT_SELECTOR); /** - * Initializes an <ACE_ATM_Addr> from an ATMSAPAddress/sockaddr_atm + * Initializes an ACE_ATM_Addr from an ATMSAPAddress/sockaddr_atm * structure. This is vendor specific (FORE systems). May need to * change when other vendors are supported. */ @@ -111,7 +111,7 @@ public: u_char selector = DEFAULT_SELECTOR); /** - * Initializes an <ACE_ATM_Addr> from the <sap> which can be + * Initializes an ACE_ATM_Addr from the <sap> which can be * "atm-address" (e.g., * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") or "hostname" * (e.g., "frisbee.cs.wustl.edu"). @@ -120,7 +120,7 @@ public: u_char selector = DEFAULT_SELECTOR); /** - * Initializes an <ACE_ATM_Addr> from the <sap> which can be + * Initializes an ACE_ATM_Addr from the <sap> which can be * "atm-address" (e.g., * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") or "hostname" * (e.g., "frisbee.cs.wustl.edu"). diff --git a/ace/Array_Map.h b/ace/Array_Map.h index 3425e917d4c..06729141183 100644 --- a/ace/Array_Map.h +++ b/ace/Array_Map.h @@ -219,7 +219,7 @@ public: /// Remove range of elements [@a first, @a last) from the map. /** - * @note [@a first, @last) must be valid range within the map. + * @note [@a first, @a last) must be valid range within the map. */ void erase (iterator first, iterator last); diff --git a/ace/Atomic_Op_T.h b/ace/Atomic_Op_T.h index 89703186356..549ee67274b 100644 --- a/ace/Atomic_Op_T.h +++ b/ace/Atomic_Op_T.h @@ -112,7 +112,7 @@ public: * Returns a reference to the underlying <ACE_LOCK>. This makes it * possible to acquire the lock explicitly, which can be useful in * some cases if you instantiate the <ACE_Atomic_Op_Ex> with an - * <ACE_Recursive_Mutex> or <ACE_Process_Mutex>. @note the right + * ACE_Recursive_Mutex or ACE_Process_Mutex. @note the right * name would be lock_, but HP/C++ will choke on that! */ ACE_LOCK &mutex (void); @@ -211,8 +211,8 @@ public: /** * Returns a reference to the underlying <ACE_LOCK>. This makes it * possible to acquire the lock explicitly, which can be useful in - * some cases if you instantiate the <ACE_Atomic_Op> with an - * <ACE_Recursive_Mutex> or <ACE_Process_Mutex>. + * some cases if you instantiate the ACE_Atomic_Op with an + * ACE_Recursive_Mutex or ACE_Process_Mutex. * * @deprecated This member function is deprecated and so may go away in * the future. If you need access to the underlying mutex, consider diff --git a/ace/Base_Thread_Adapter.h b/ace/Base_Thread_Adapter.h index b4425f32896..9eda6e877a5 100644 --- a/ace/Base_Thread_Adapter.h +++ b/ace/Base_Thread_Adapter.h @@ -29,6 +29,8 @@ #if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) # define ACE_THREAD_ADAPTER_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ace_thread_adapter) +#else +# define ACE_THREAD_ADAPTER_NAME ace_thread_adapter #endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ // Run the thread entry point for the ACE_Thread_Adapter. This must @@ -125,7 +127,7 @@ protected: # endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ ); /// Inherit the logging features if the parent thread has an - /// <ACE_Log_Msg>. + /// ACE_Log_Msg. void inherit_log_msg (void); private: diff --git a/ace/CDR_Base.h b/ace/CDR_Base.h index 1caa81333ad..3721b8f4ec2 100644 --- a/ace/CDR_Base.h +++ b/ace/CDR_Base.h @@ -38,7 +38,6 @@ #include "ace/Basic_Types.h" #include "ace/Default_Constants.h" -#include "ace/If_Then_Else.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -168,15 +167,13 @@ public: * avoid complaints from all compilers is to define them all. */ //@{ - typedef ACE::If_Then_Else<(sizeof (bool) == 1), - bool, - unsigned char>::result_type Boolean; # if !defined (ACE_CDR_WCHAR_OVERRIDE) || defined(ACE_USES_WCHAR) # undef ACE_CDR_WCHAR_OVERRIDE # define ACE_CDR_WCHAR_OVERRIDE wchar_t # endif + typedef bool Boolean; typedef unsigned char Octet; typedef char Char; typedef ACE_CDR_WCHAR_OVERRIDE WChar; diff --git a/ace/CDR_Stream.cpp b/ace/CDR_Stream.cpp index 2ca41fe93ed..afc43abc05b 100644 --- a/ace/CDR_Stream.cpp +++ b/ace/CDR_Stream.cpp @@ -613,6 +613,30 @@ ACE_OutputCDR::write_array (const void *x, return false; } + +ACE_CDR::Boolean +ACE_OutputCDR::replace (ACE_CDR::Long x, char* loc) +{ + if (this->find (loc) == 0) + return false; + +#if !defined (ACE_ENABLE_SWAP_ON_WRITE) + *reinterpret_cast<ACE_CDR::Long*> (loc) = x; +#else + if (!strm->do_byte_swap ()) + { + *reinterpret_cast<ACE_CDR::Long *> (loc) = x; + } + else + { + ACE_CDR::swap_4 (reinterpret_cast<const char*> (&x), loc); + } +#endif /* ACE_ENABLE_SWAP_ON_WRITE */ + + return true; +} + + ACE_CDR::Boolean ACE_OutputCDR::write_boolean_array (const ACE_CDR::Boolean* x, ACE_CDR::ULong length) @@ -632,6 +656,23 @@ ACE_OutputCDR::write_boolean_array (const ACE_CDR::Boolean* x, return this->good_bit (); } + +ACE_Message_Block* +ACE_OutputCDR::find (char* loc) +{ + ACE_Message_Block* mb = 0; + for (mb = &this->start_; mb != 0; mb = mb->cont ()) + { + if (loc <= mb->wr_ptr () && loc >= mb->rd_ptr ()) + { + break; + } + } + + return mb; +} + + // **************************************************************** ACE_InputCDR::ACE_InputCDR (const char *buf, diff --git a/ace/CDR_Stream.h b/ace/CDR_Stream.h index 3c245ab945b..d6e7560e7fe 100644 --- a/ace/CDR_Stream.h +++ b/ace/CDR_Stream.h @@ -219,6 +219,11 @@ public: ACE_CDR::Boolean write_double (const ACE_CDR::Double &x); ACE_CDR::Boolean write_longdouble (const ACE_CDR::LongDouble &x); + // Overwrite the stream at the specified location that is previously + // written as a long type placeholder. There is no alignment required + // since the alignment is done before writing the long type placeholder. + ACE_CDR::Boolean replace (ACE_CDR::Long x, char* loc); + /// For string we offer methods that accept a precomputed length. ACE_CDR::Boolean write_string (const ACE_CDR::Char *x); ACE_CDR::Boolean write_string (ACE_CDR::ULong len, @@ -393,7 +398,13 @@ public: /// Set the underlying GIOP version.. int get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor); + private: + + // Find the message block in the chain of message blocks + // that the provide location locates. + ACE_Message_Block* find (char* loc); + /// disallow copying... ACE_OutputCDR (const ACE_OutputCDR& rhs); ACE_OutputCDR& operator= (const ACE_OutputCDR& rhs); diff --git a/ace/Cached_Connect_Strategy_T.h b/ace/Cached_Connect_Strategy_T.h index f04392846cb..4d928e57f54 100644 --- a/ace/Cached_Connect_Strategy_T.h +++ b/ace/Cached_Connect_Strategy_T.h @@ -40,7 +40,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL * subsequent re-use of unused, but available, connections. * * <Cached_Connect_Strategy> is intended to be used as a - * plug-in connection strategy for <ACE_Strategy_Connector>. + * plug-in connection strategy for ACE_Strategy_Connector. * It's added value is re-use of established connections and * tweaking the role of the cache as per the caching strategy. */ @@ -191,7 +191,7 @@ protected: * maximum size. * * <Bounded_Cached_Connect_Strategy> is intended to be used as a - * plug-in connection strategy for <ACE_Strategy_Connector>. + * plug-in connection strategy for ACE_Strategy_Connector. * It's added value is re-use of established connections and * tweaking the role of the cache as per the caching strategy. * Thanks to Edan Ayal <edana@bandwiz.com> for contributing this diff --git a/ace/Capabilities.h b/ace/Capabilities.h index a970722e803..609f3ddaa06 100644 --- a/ace/Capabilities.h +++ b/ace/Capabilities.h @@ -124,12 +124,12 @@ protected: * This is a container class for ACE Capabilities * values. Currently exist three different capability values: * <ACE_IntCapEntry> (integer), <ACE_BoolCapEntry> (bool) and - * <ACE_StringCapEntry> (String). An <ACE_Capabilities> is a + * <ACE_StringCapEntry> (String). An ACE_Capabilities is a * unordered set of pair = (<String>, <ACE_CapEntry> *). Where * the first component is the name of capability and the second * component is a pointer to the capability value container. A - * <FILE> is a container for <ACE_Capabilities>, the - * <ACE_Capabilities> has a name in the file, as a termcap file. + * <FILE> is a container for ACE_Capabilities, the + * ACE_Capabilities has a name in the file, as a termcap file. */ class ACE_Export ACE_Capabilities { diff --git a/ace/Cleanup.h b/ace/Cleanup.h index 37e46b7e7cb..bd1f9c2e23c 100644 --- a/ace/Cleanup.h +++ b/ace/Cleanup.h @@ -30,9 +30,10 @@ #if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) # include "ace/Global_Macros.h" # define ACE_CLEANUP_DESTROYER_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ace_cleanup_destroyer) +#else +# define ACE_CLEANUP_DESTROYER_NAME ace_cleanup_destroyer #endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ - ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** diff --git a/ace/DLL.cpp b/ace/DLL.cpp index 00363d51bbf..62f85a19ebe 100644 --- a/ace/DLL.cpp +++ b/ace/DLL.cpp @@ -46,6 +46,33 @@ ACE_DLL::ACE_DLL (const ACE_DLL &rhs) this->error ())); } +// Assignment operator + +const ACE_DLL & +ACE_DLL::operator= (const ACE_DLL &rhs) +{ + ACE_TRACE ("ACE_DLL::operator= (const ACE_DLL &)"); + + open_mode_ = 0; + dll_name_ = 0; + close_handle_on_destruction_=0; + dll_handle_=0; + error_=0; + + if (rhs.dll_name_ + // This will automatically up the refcount and initialize *this + && this->open (rhs.dll_name_, + rhs.open_mode_, + rhs.close_handle_on_destruction_) != 0 + && ACE::debug ()) + ACE_ERROR ((LM_ERROR, + ACE_LIB_TEXT ("ACE_DLL::operator=: error: %s\n"), + this->error ())); + + return *this; +} + + // If the library name and the opening mode are specified than on // object creation the library is implicitly opened. diff --git a/ace/DLL.h b/ace/DLL.h index 022521ae6a7..ae1e882f01d 100644 --- a/ace/DLL.h +++ b/ace/DLL.h @@ -57,6 +57,10 @@ public: */ explicit ACE_DLL (int close_handle_on_destruction = 1); + /// Allow assignment + const ACE_DLL& operator= (const ACE_DLL &rhs); + + /** * This constructor performs the actions of open() during construction. * @param dll_name The name or path of the DLL to load. @@ -156,10 +160,8 @@ private: ACE_SHLIB_HANDLE handle = 0); - // Disallow assignment since we don't handle it. - void operator= (const ACE_DLL &); - -private: + //private: +public: /// Open mode. int open_mode_; diff --git a/ace/DLL_Manager.cpp b/ace/DLL_Manager.cpp index 783b524c5a2..ce2c3d9cf4d 100644 --- a/ace/DLL_Manager.cpp +++ b/ace/DLL_Manager.cpp @@ -54,10 +54,6 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name, ACE_TRACE ("ACE_DLL_Handle::open"); ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); - //ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("dll_name: %s; open_mode: %d \n"), - // dll_name, - // open_mode)); - if (this->dll_name_) { // Once dll_name_ has been set, it can't be changed.. @@ -65,7 +61,7 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name, { if (ACE::debug ()) ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_DLL_Handle::open: error, ") + ACE_LIB_TEXT ("(%P|%t) DLL_Handle::open: error, ") ACE_LIB_TEXT ("tried to reopen %s with name %s\n"), this->dll_name_, dll_name)); @@ -86,10 +82,6 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name, this->handle_ = handle; else { - if (ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("ACE_DLL_Handle::open: calling dlopen on ") - ACE_LIB_TEXT ("\"%s\"\n"), dll_name)); - /* ** Get the set of names to try loading. We need to do this to ** properly support the ability for a user to specify a simple, @@ -129,18 +121,34 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name, ACE_TString *name = 0; while (name_iter.next (name)) { - if (ACE::debug ()) + if (ACE::debug () > 1) ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("ACE_DLL_Handle::open: Trying to open DLL %s with %s name\n"), - this->dll_name_, - name->c_str ())); + ACE_LIB_TEXT ("(%P|%t) ACE_DLL_Handle::open: ") + ACE_LIB_TEXT ("calling dlopen on ") + ACE_LIB_TEXT ("\"%s\"\n"), name->c_str ())); // The ACE_SHLIB_HANDLE object is obtained. this->handle_ = ACE_OS::dlopen (name->c_str (), open_mode); - if (this->handle_ != ACE_SHLIB_INVALID_HANDLE) // Good one + + if (this->handle_ != ACE_SHLIB_INVALID_HANDLE) // Good one? break; + // If errno is ENOENT we just skip over this one, + // anything else - like an undefined symbol, for + // instance must be flagged here or the next error will + // mask it. + // @TODO: If we've found our DLL _and_ it's + // broken, should we continue at all? + if (ACE::debug () && (errno != 0) && (errno != ENOENT)) + ACE_ERROR ((LM_ERROR, + ACE_LIB_TEXT ("(%P|%t) ACE_DLL_Handle::open: ") + ACE_LIB_TEXT ("Attempt to open \'%s\' failed ") + ACE_LIB_TEXT ("(%d): %s\n"), + name->c_str (), + errno, + this->error ()->c_str ())); + #if defined (AIX) // AIX often puts the shared library file (most often named // shr.o) inside an archive library. If this is an archive @@ -154,11 +162,35 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name, aix_pathname[name->length ()] = '\0'; ACE_OS::strcat (aix_pathname, ACE_LIB_TEXT ("(shr.o)")); open_mode |= RTLD_MEMBER; + + if (ACE::debug () > 1) + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%P|%t) ACE_DLL_Handle::open: ") + ACE_LIB_TEXT ("calling dlopen on ") + ACE_LIB_TEXT ("\"%s\"\n"), aix_pathname)); + this->handle_ = ACE_OS::dlopen (aix_pathname, open_mode); if (this->handle_ != ACE_SHLIB_INVALID_HANDLE) break; + + // If errno is ENOENT we just skip over this one, anything + // else - like an undefined symbol, for instance + // must be flagged here or the next error will mask it. + // + // @TODO: If we've found our DLL _and_ it's broken, + // should we continue at all? + if (ACE::debug () && (errno != 0) && (errno != ENOENT)) + ACE_ERROR ((LM_ERROR, + ACE_LIB_TEXT ("(%P|%t) ACE_DLL_Handle::open: ") + ACE_LIB_TEXT ("Attempt to open \'%s\' failed") + ACE_LIB_TEXT (" (%d): %s\n"), + name->c_str (), + errno, + this->error ()->c_str ())); + } #endif /* AIX */ + name_iter.advance (); } @@ -166,7 +198,9 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name, { if (ACE::debug ()) ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_DLL_Handle::open: Invalid handle when opening DLL %s: %s\n"), + ACE_LIB_TEXT ("(%P|%t) DLL_Handle::open: ") + ACE_LIB_TEXT ("Invalid handle while ") + ACE_LIB_TEXT ("opening DLL \"%s\": %s\n"), this->dll_name_, this->error ()->c_str ())); @@ -174,11 +208,6 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name, } } } - if (ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("ACE_DLL_Handle::open: loading %s (%d)\n"), - this->dll_name_, - this->handle_)); ++this->refcount_; return 0; @@ -200,15 +229,25 @@ ACE_DLL_Handle::close (int unload) else this->refcount_ = 0; + if (ACE::debug () > 2) + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%P|%t) DLL_Handle::close: ") + ACE_LIB_TEXT ("closing %s (%d), refcount is down to %d\n"), + this->dll_name_, + this->handle_, + this->refcount_)); + if (this->refcount_ == 0 && this->handle_ != ACE_SHLIB_INVALID_HANDLE && unload == 1) { - if (ACE::debug ()) + if (ACE::debug () > 1) ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("ACE_DLL_Handle::close: unloading %s (%d)\n"), + ACE_LIB_TEXT ("(%P|%t) DLL_Handle::close: ") + ACE_LIB_TEXT ("Unloading %s (%d)\n"), this->dll_name_, this->handle_)); + // First remove any associated Framework Components. ACE_Framework_Repository * frPtr= ACE_Framework_Repository::instance (); @@ -221,9 +260,10 @@ ACE_DLL_Handle::close (int unload) this->handle_ = ACE_SHLIB_INVALID_HANDLE; } - if (retval != 0 && ACE::debug ()) + if (retval != 0) ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_DLL_Handle::close error: \"%s\".\n"), + ACE_LIB_TEXT ("(%P|%t) DLL_Handle::close: ") + ACE_LIB_TEXT ("failed with: \"%s\".\n"), this->error ()->c_str ())); return retval; @@ -256,7 +296,8 @@ ACE_DLL_Handle::symbol (const ACE_TCHAR *sym_name, int ignore_errors) { if (ACE::debug ()) ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_DLL_Handle::symbol (\"%s\") \"%s\".\n"), + ACE_LIB_TEXT ("(%P|%t) DLL_Handle::symbol (\"%s\") ") + ACE_LIB_TEXT (" failed with \"%s\".\n"), auto_name.get (), this->error ()->c_str ())); @@ -277,9 +318,9 @@ ACE_DLL_Handle::get_handle (int become_owner) if (this->refcount_ == 0 && become_owner != 0) { - if (ACE::debug ()) + if (ACE::debug () > 1) ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_DLL_Handle::get_handle: ") + ACE_LIB_TEXT ("(%P|%t) DLL_Handle::get_handle: ") ACE_LIB_TEXT ("cannot become owner, refcount == 0.\n"))); return ACE_SHLIB_INVALID_HANDLE; @@ -293,12 +334,13 @@ ACE_DLL_Handle::get_handle (int become_owner) this->handle_ = ACE_SHLIB_INVALID_HANDLE; } - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("ACE_DLL_Handle::get_handle: ") - ACE_LIB_TEXT ("post call: handle %s, refcount %d\n"), - this->handle_ == ACE_SHLIB_INVALID_HANDLE ? + if (ACE::debug () > 1) + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("ACE_DLL_Handle::get_handle: ") + ACE_LIB_TEXT ("post call: handle %s, refcount %d\n"), + this->handle_ == ACE_SHLIB_INVALID_HANDLE ? ACE_LIB_TEXT ("invalid") : ACE_LIB_TEXT ("valid"), - this->refcount_)); + this->refcount_)); return handle; } diff --git a/ace/Default_Constants.h b/ace/Default_Constants.h index 05419382e97..b01ed091141 100644 --- a/ace/Default_Constants.h +++ b/ace/Default_Constants.h @@ -457,7 +457,7 @@ #endif /* ACE_MAX_DEFAULT_PORT */ // Default number of ACE_Event_Handlers supported by -// <ACE_Timer_Heap>. +// ACE_Timer_Heap. # if !defined (ACE_DEFAULT_TIMERS) # define ACE_DEFAULT_TIMERS _POSIX_TIMER_MAX # endif /* ACE_DEFAULT_TIMERS */ diff --git a/ace/Dynamic_Service.cpp b/ace/Dynamic_Service.cpp index dd0d8d0c679..9af5fdf2c65 100644 --- a/ace/Dynamic_Service.cpp +++ b/ace/Dynamic_Service.cpp @@ -25,6 +25,18 @@ ACE_Dynamic_Service<TYPE>::instance (const ACE_TCHAR *name) return dynamic_cast<TYPE *> (svc_obj); } + +template <class TYPE> TYPE * +ACE_Dynamic_Service<TYPE>::instance (const ACE_Service_Gestalt* conf, + const ACE_TCHAR *name) +{ + ACE_Service_Object * svc_obj = + static_cast<ACE_Service_Object *> (ACE_Dynamic_Service_Base::instance (conf, name)); + return dynamic_cast<TYPE *> (svc_obj); +} + + + ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_DYNAMIC_SERVICE_CPP */ diff --git a/ace/Dynamic_Service.h b/ace/Dynamic_Service.h index 88ac4115c12..c9dcc8896c2 100644 --- a/ace/Dynamic_Service.h +++ b/ace/Dynamic_Service.h @@ -17,6 +17,7 @@ #include /**/ "ace/pre.h" #include "ace/config-all.h" +#include "ace/Global_Macros.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -44,8 +45,27 @@ public: /// Return instance using @a name to search the Service_Repository. static TYPE* instance (const char *name); + static TYPE* instance (const ACE_Service_Gestalt* repo, + const ACE_TCHAR *name); + +#if defined (ACE_USES_WCHAR) + /// Return instance using @a name to search the Service_Repository. - static TYPE* instance (const wchar_t *name); + static TYPE* instance (const ACE_ANTI_TCHAR *name); + + static TYPE* instance (const ACE_Service_Gestalt* repo, + const ACE_ANTI_TCHAR *name); +#endif // ACE_USES_WCHAR + +private: + ACE_UNIMPLEMENTED_FUNC + (ACE_Dynamic_Service ()); + + ACE_UNIMPLEMENTED_FUNC + (ACE_Dynamic_Service (const ACE_Dynamic_Service&)); + + ACE_UNIMPLEMENTED_FUNC + (ACE_Dynamic_Service& operator= (const ACE_Dynamic_Service&)); }; ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dynamic_Service.inl b/ace/Dynamic_Service.inl index 108ddd32a09..21fb05215e8 100644 --- a/ace/Dynamic_Service.inl +++ b/ace/Dynamic_Service.inl @@ -4,10 +4,22 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL +#if defined (ACE_USES_WCHAR) + template <class TYPE> ACE_INLINE TYPE * ACE_Dynamic_Service<TYPE>::instance (const ACE_ANTI_TCHAR *name) { return instance (ACE_TEXT_TO_TCHAR_IN (name)); } +template <class TYPE> ACE_INLINE TYPE * +ACE_Dynamic_Service<TYPE>::instance (const ACE_Service_Gestalt* repo, + const ACE_ANTI_TCHAR *name) +{ + return instance (repo, ACE_TEXT_CHAR_TO_TCHAR (name)); +} + + +#endif // ACE_USES_WCHAR + ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dynamic_Service_Base.cpp b/ace/Dynamic_Service_Base.cpp index bec17fb079f..8e55675c6ac 100644 --- a/ace/Dynamic_Service_Base.cpp +++ b/ace/Dynamic_Service_Base.cpp @@ -11,6 +11,7 @@ ACE_RCSID (ace, ACE_BEGIN_VERSIONED_NAMESPACE_DECL + void ACE_Dynamic_Service_Base::dump (void) const { @@ -23,24 +24,74 @@ ACE_Dynamic_Service_Base::dump (void) const #endif /* ACE_HAS_DUMP */ } -// Get the instance using <name>. +// Get the instance using <name> for the current global +// service configuration repository. void * ACE_Dynamic_Service_Base::instance (const ACE_TCHAR *name) { ACE_TRACE ("ACE_Dynamic_Service_Base::instance"); - const ACE_Service_Type *svc_rec; + return instance (ACE_Service_Config::current (), name); +} + + +// Find a service registration + +const ACE_Service_Type * +ACE_Dynamic_Service_Base::find_i (const ACE_Service_Gestalt* &repo, + const ACE_TCHAR *name) +{ + ACE_TRACE ("ACE_Dynamic_Service_Base::find_i"); + const ACE_Service_Type *svc_rec = 0; + + ACE_Service_Gestalt* global = ACE_Service_Config::global (); + + for ( ; repo->find (name, &svc_rec) == -1; repo = global) + { + // Check the static repo, too if different + if (repo == global) + break; + } + + return svc_rec; +} + + +// Get the instance using <name> for specific configuration repository. + +void * +ACE_Dynamic_Service_Base::instance (const ACE_Service_Gestalt* repo, + const ACE_TCHAR *name) +{ + ACE_TRACE ("ACE_Dynamic_Service_Base::instance"); + + void *obj = 0; + const ACE_Service_Type_Impl *type = 0; + + const ACE_Service_Gestalt* repo_found = repo; + + const ACE_Service_Type *svc_rec = find_i (repo_found, name); + if (svc_rec != 0) + { + type = svc_rec->type (); + if (type != 0) + obj = type->object (); + } - if (ACE_Service_Repository::instance ()->find (name, - &svc_rec) == -1) - return 0; + if (ACE::debug ()) + { + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%P|%t) DSB::instance, repo=%@, name=%s, type=%@ => %@"), + repo->repo_, name, type, obj)); - const ACE_Service_Type_Impl *type = svc_rec->type (); + if (repo->repo_ != repo_found->repo_) + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" [in repo=%@]\n"), + repo_found->repo_)); + else + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n"))); - if (type == 0) - return 0; + } - void * const obj = type->object (); return obj; } diff --git a/ace/Dynamic_Service_Base.h b/ace/Dynamic_Service_Base.h index 17b7c5dda2f..0db626a919f 100644 --- a/ace/Dynamic_Service_Base.h +++ b/ace/Dynamic_Service_Base.h @@ -24,6 +24,9 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Service_Gestalt; +class ACE_Service_Type; + /** * @class ACE_Dynamic_Service_Base * @@ -34,13 +37,33 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL */ class ACE_Export ACE_Dynamic_Service_Base { + public: /// Dump the current static of the object void dump (void) const; protected: - /// Return instance using @a name to search the Service_Repository. + /// Return instance using @a name to search the (default) Service_Repository. static void* instance (const ACE_TCHAR *name); + + /// Return instance using @a name to search the specific @a repo instance. + static void* instance (const ACE_Service_Gestalt* repo, + const ACE_TCHAR *name); + + /// No need to create, or assign instances of this class + ACE_Dynamic_Service_Base (void); + ~ACE_Dynamic_Service_Base (void); + const ACE_Dynamic_Service_Base& operator= (const ACE_Dynamic_Service_Base&); + +private: + /// Implement the service search policy, i.e. "look for the service first + /// locally and then globally" + static const ACE_Service_Type *find_i (const ACE_Service_Gestalt* &repo, + const ACE_TCHAR *name); + + /// The dependency declaration class needs access to the service search + /// policy, implemented by find_i() + friend class ACE_Dynamic_Service_Dependency; }; ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Global_Macros.h b/ace/Global_Macros.h index 8487880e797..2f24a1c3646 100644 --- a/ace/Global_Macros.h +++ b/ace/Global_Macros.h @@ -570,7 +570,7 @@ ACE_Static_Svc_Descriptor ace_svc_desc_##SERVICE_CLASS = { NAME, TYPE, FN, FLAGS class ACE_Static_Svc_##SERVICE_CLASS {\ public:\ ACE_Static_Svc_##SERVICE_CLASS() { \ - ACE_Service_Config::static_svcs ()->insert (\ + ACE_Service_Config::insert (\ &ace_svc_desc_##SERVICE_CLASS); \ } \ }; @@ -583,7 +583,7 @@ ACE_Static_Svc_##SERVICE_CLASS ace_static_svc_##SERVICE_CLASS class ACE_Static_Svc_##SERVICE_CLASS {\ public:\ ACE_Static_Svc_##SERVICE_CLASS() { \ - ACE_Service_Config::static_svcs ()->insert (\ + ACE_Service_Config::insert (\ &ace_svc_desc_##SERVICE_CLASS); \ } \ };\ diff --git a/ace/Hash_Map_Manager_T.h b/ace/Hash_Map_Manager_T.h index 23ce8d690ec..5bd83664298 100644 --- a/ace/Hash_Map_Manager_T.h +++ b/ace/Hash_Map_Manager_T.h @@ -308,8 +308,8 @@ public: /** * Returns a reference to the underlying <ACE_LOCK>. This makes it * possible to acquire the lock explicitly, which can be useful in - * some cases if you instantiate the <ACE_Atomic_Op> with an - * <ACE_Recursive_Mutex> or <ACE_Process_Mutex>, or if you need to + * some cases if you instantiate the ACE_Atomic_Op with an + * ACE_Recursive_Mutex or ACE_Process_Mutex, or if you need to * guard the state of an iterator. * @note The right name would be <lock>, but HP/C++ will choke on that! */ diff --git a/ace/Log_Msg.h b/ace/Log_Msg.h index bc890417445..40811d66d99 100644 --- a/ace/Log_Msg.h +++ b/ace/Log_Msg.h @@ -702,6 +702,8 @@ ACE_END_VERSIONED_NAMESPACE_DECL #if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) # define ACE_TSS_CLEANUP_NAME ACE_PREPROC_CONCATENATE(ACE_,ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _TSS_cleanup)) +#else +# define ACE_TSS_CLEANUP_NAME ACE_TSS_cleanup #endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ diff --git a/ace/Log_Msg_Callback.h b/ace/Log_Msg_Callback.h index 2d3af46a1b3..182186ac1ae 100644 --- a/ace/Log_Msg_Callback.h +++ b/ace/Log_Msg_Callback.h @@ -42,7 +42,7 @@ class ACE_Log_Record; * * Remember that there is one Log_Msg object per thread. * Therefore, you may need to register your callback object with - * many <ACE_Log_Msg> objects (and have the correct + * many ACE_Log_Msg objects (and have the correct * synchronization in the <log> method) or have a separate * callback object per Log_Msg object. Moreover, * <ACE_Log_Msg_Callbacks> are not inherited when a new thread diff --git a/ace/Log_Msg_IPC.h b/ace/Log_Msg_IPC.h index 2b05c02de02..b50b04c05ce 100644 --- a/ace/Log_Msg_IPC.h +++ b/ace/Log_Msg_IPC.h @@ -21,7 +21,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ // IPC conduit between sender and client daemon. This should be -// included in the <ACE_Log_Msg> class, but due to "order of include" +// included in the ACE_Log_Msg class, but due to "order of include" // problems it can't be... #if defined (ACE_HAS_STREAM_PIPES) # include "ace/SPIPE_Connector.h" diff --git a/ace/Map_Manager.h b/ace/Map_Manager.h index 847c7167e2c..b4722c34864 100644 --- a/ace/Map_Manager.h +++ b/ace/Map_Manager.h @@ -262,8 +262,8 @@ public: /** * Returns a reference to the underlying <ACE_LOCK>. This makes it * possible to acquire the lock explicitly, which can be useful in - * some cases if you instantiate the <ACE_Atomic_Op> with an - * <ACE_Recursive_Mutex> or <ACE_Process_Mutex>, or if you need to + * some cases if you instantiate the ACE_Atomic_Op with an + * ACE_Recursive_Mutex or ACE_Process_Mutex, or if you need to * guard the state of an iterator. * @note The right name would be <lock>, but HP/C++ will choke on that! */ diff --git a/ace/OS_NS_sys_sendfile.cpp b/ace/OS_NS_sys_sendfile.cpp index ba731a71acd..79bf827770f 100644 --- a/ace/OS_NS_sys_sendfile.cpp +++ b/ace/OS_NS_sys_sendfile.cpp @@ -14,7 +14,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL ssize_t ACE_OS::sendfile_emulation (ACE_HANDLE out_fd, ACE_HANDLE in_fd, - ACE_LOFF_T * offset, + off_t * offset, size_t count) { // @@ We may want set up a signal lease (or oplock) if supported by @@ -28,7 +28,7 @@ ACE_OS::sendfile_emulation (ACE_HANDLE out_fd, (void) ACE_OS::munmap (buf, count); if (r > 0) - *offset += static_cast<ACE_LOFF_T> (r); + *offset += static_cast<off_t> (r); return r; } diff --git a/ace/OS_NS_sys_sendfile.h b/ace/OS_NS_sys_sendfile.h index c12cdf15c47..7cba788971a 100644 --- a/ace/OS_NS_sys_sendfile.h +++ b/ace/OS_NS_sys_sendfile.h @@ -21,7 +21,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/os_include/sys/os_types.h" +#include "ace/Basic_Types.h" /* For ssize_t and off_t. */ #if defined (ACE_EXPORT_MACRO) # undef ACE_EXPORT_MACRO @@ -33,17 +33,17 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL namespace ACE_OS { - /// Sendfile wrapper. + /// Finds the length of a string (char version). ACE_NAMESPACE_INLINE_FUNCTION ssize_t sendfile (ACE_HANDLE out_fd, ACE_HANDLE in_fd, - ACE_LOFF_T * offset, + off_t * offset, size_t count); #ifndef ACE_HAS_SENDFILE extern ssize_t sendfile_emulation (ACE_HANDLE out_fd, ACE_HANDLE in_fd, - ACE_LOFF_T * offset, + off_t * offset, size_t count); #endif /* !ACE_HAS_SENDFILE */ diff --git a/ace/OS_NS_sys_sendfile.inl b/ace/OS_NS_sys_sendfile.inl index 3a1a03b32da..1c468354b3e 100644 --- a/ace/OS_NS_sys_sendfile.inl +++ b/ace/OS_NS_sys_sendfile.inl @@ -2,16 +2,20 @@ // // $Id$ +#ifdef ACE_HAS_SENDFILE +# include <sys/sendfile.h> +#endif /* ACE_HAS_SENDFILE */ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ssize_t ACE_OS::sendfile (ACE_HANDLE out_fd, ACE_HANDLE in_fd, - ACE_LOFF_T * offset, + off_t * offset, size_t count) { #ifdef ACE_HAS_SENDFILE - return sendfile (out_fd, in_fd, offset, count); + return ::sendfile (out_fd, in_fd, offset, count); #else return ACE_OS::sendfile_emulation (out_fd, in_fd, offset, count); #endif /* ACE_HAS_SENDFILE */ diff --git a/ace/POSIX_Asynch_IO.h b/ace/POSIX_Asynch_IO.h index 57eb53e169c..8e6e0be88fd 100644 --- a/ace/POSIX_Asynch_IO.h +++ b/ace/POSIX_Asynch_IO.h @@ -151,18 +151,17 @@ protected: /** * @class ACE_POSIX_Asynch_Operation * - * @brief This class implements <ACE_Asynch_Operation> for all + * @brief This class implements ACE_Asynch_Operation for all * implementations of Proactor (AIOCB, SIG, SUN) - * Specific future implementations - * can derive from this class. + * Specific future implementations can derive from this class. */ class ACE_Export ACE_POSIX_Asynch_Operation : public virtual ACE_Asynch_Operation_Impl { public: /** * Initializes the factory with information which will be used with - * each asynchronous call. If (<handle> == ACE_INVALID_HANDLE), - * <ACE_Handler::handle> will be called on the <handler> to get the + * each asynchronous call. If (@a handle == ACE_INVALID_HANDLE), + * @c ACE_Handler::handle will be called on the handler to get the * correct handle. No need for the Proactor since the sub classes * will know the correct implementation Proactor class, since this * Operation class itself was created by the correct implementation @@ -173,7 +172,7 @@ public: const void *completion_key, ACE_Proactor *proactor = 0); - /// Check the documentation for <ACE_Asynch_Operation::cancel>. + /// Check the documentation for ACE_Asynch_Operation::cancel. int cancel (void); // = Access methods. @@ -192,7 +191,7 @@ protected: virtual ~ACE_POSIX_Asynch_Operation (void); // This call is for the POSIX implementation. This method is used by - // <ACE_Asynch_Operation> to store some information with the + // ACE_Asynch_Operation to store some information with the // Proactor after an <aio_> call is issued, so that the Proactor can // retreve this information to do <aio_return> and <aio_error>. // Passing a '0' ptr returns the status, indicating whether there @@ -587,11 +586,11 @@ private: * @class ACE_POSIX_Asynch_Accept_Result * * @brief This is that class which will be passed back to the - * <handler> when the asynchronous accept completes. + * handler when the asynchronous accept completes. * * * This class has all the information necessary for the - * <handler> to uniquiely identify the completion of the + * handler to uniquiely identify the completion of the * asynchronous accept. */ class ACE_Export ACE_POSIX_Asynch_Accept_Result : public virtual ACE_Asynch_Accept_Result_Impl, diff --git a/ace/POSIX_Proactor.h b/ace/POSIX_Proactor.h index e56a2f28409..a1ff00288a3 100644 --- a/ace/POSIX_Proactor.h +++ b/ace/POSIX_Proactor.h @@ -614,8 +614,8 @@ protected: * @class ACE_POSIX_Asynch_Timer * * @brief This class is posted to the completion port when a timer - * expires. When the <complete method> of this object is - * called, the <handler>'s <handle_timeout> method will be + * expires. When the @c complete() method of this object is + * called, the handler's @c handle_timeout() method will be * called. */ class ACE_Export ACE_POSIX_Asynch_Timer : public ACE_POSIX_Asynch_Result @@ -640,7 +640,7 @@ protected: /// Destructor. virtual ~ACE_POSIX_Asynch_Timer (void) {} - /// This method calls the <handler>'s handle_timeout method. + /// This method calls the handler's handle_timeout method. virtual void complete (size_t bytes_transferred, int success, const void *completion_key, diff --git a/ace/Parse_Node.cpp b/ace/Parse_Node.cpp index e442c5e4b65..8e83a510bb5 100644 --- a/ace/Parse_Node.cpp +++ b/ace/Parse_Node.cpp @@ -31,19 +31,21 @@ ACE_Stream_Node::dump (void) const } void -ACE_Stream_Node::apply (int & yyerrno) +ACE_Stream_Node::apply (ACE_Service_Gestalt *config, int &yyerrno) { ACE_TRACE ("ACE_Stream_Node::apply"); - if (ACE_Service_Config::initialize (this->node_->record (), - this->node_->parameters ()) == -1) + if (config->initialize (this->node_->record (config), + this->node_->parameters ()) == -1) ++yyerrno; +#ifndef ACE_NLOGGING if (ACE::debug ()) ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("did stream on %s, error = %d\n"), + ACE_LIB_TEXT ("(%P|%t) Did stream on %s, error = %d\n"), this->node_->name (), yyerrno)); +#endif /* ACE_NLOGGING */ } ACE_ALLOC_HOOK_DEFINE (ACE_Parse_Node) @@ -178,32 +180,37 @@ ACE_Resume_Node::~ACE_Resume_Node (void) } void -ACE_Suspend_Node::apply (int & yyerrno) +ACE_Suspend_Node::apply (ACE_Service_Gestalt *config, int &yyerrno) { ACE_TRACE ("ACE_Suspend_Node::apply"); - if (ACE_Service_Config::suspend (this->name ()) == -1) + if (config->suspend (this->name ()) == -1) ++yyerrno; +#ifndef ACE_NLOGGING if (ACE::debug ()) ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("did suspend on %s, error = %d\n"), this->name (), yyerrno)); +#endif /* ACE_NLOGGING */ } void -ACE_Resume_Node::apply (int & yyerrno) +ACE_Resume_Node::apply (ACE_Service_Gestalt *config, int &yyerrno) { ACE_TRACE ("ACE_Resume_Node::apply"); - if (ACE_Service_Config::resume (this->name ()) == -1) + + if (config->resume (this->name ()) == -1) ++yyerrno; +#ifndef ACE_NLOGGING if (ACE::debug ()) ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("did resume on %s, error = %d\n"), this->name (), yyerrno)); +#endif /* ACE_NLOGGING */ } ACE_ALLOC_HOOK_DEFINE (ACE_Remove_Node) @@ -227,48 +234,49 @@ ACE_Remove_Node::~ACE_Remove_Node (void) } void -ACE_Remove_Node::apply (int & yyerrno) +ACE_Remove_Node::apply (ACE_Service_Gestalt *config, int &yyerrno) { ACE_TRACE ("ACE_Remove_Node::apply"); - if (ACE_Service_Config::remove (this->name ()) == -1) + + if (config->remove (this->name ()) == -1) ++yyerrno; +#ifndef ACE_NLOGGING if (ACE::debug ()) ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("did remove on %s, error = %d\n"), + ACE_LIB_TEXT ("(%P|%t) ACE_Remove_Node::apply") + ACE_LIB_TEXT (" - did remove on %s, error = %d\n"), this->name (), yyerrno)); +#endif /* ACE_NLOGGING */ } -ACE_Dynamic_Node::ACE_Dynamic_Node (const ACE_Service_Type *sr, + +ACE_Dynamic_Node::ACE_Dynamic_Node (ACE_Service_Type_Factory const *stf, ACE_TCHAR *parms) - : ACE_Static_Node (sr->name (), parms), - record_ (sr) + : ACE_Static_Node (stf->name (), parms) + , factory_ (stf) { ACE_TRACE ("ACE_Dynamic_Node::ACE_Dynamic_Node"); } -const ACE_Service_Type * -ACE_Dynamic_Node::record (void) const -{ - ACE_TRACE ("ACE_Dynamic_Node::record"); - return this->record_; -} - void -ACE_Dynamic_Node::apply (int & yyerrno) +ACE_Dynamic_Node::apply (ACE_Service_Gestalt *config, int &yyerrno) { ACE_TRACE ("ACE_Dynamic_Node::apply"); - if (ACE_Service_Config::initialize (this->record (), - this->parameters ()) == -1) + if (config->initialize (this->factory_.get (), + this->parameters ()) == -1) ++yyerrno; +#ifndef ACE_NLOGGING if (ACE::debug ()) ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("did dynamic on %s, error = %d\n"), + ACE_LIB_TEXT ("(%P|%t) ACE_Dynamic_Node::apply") + ACE_LIB_TEXT (" - did dynamic on %s, error = %d\n"), this->name (), yyerrno)); +#endif /* ACE_NLOGGING */ } ACE_ALLOC_HOOK_DEFINE (ACE_Dynamic_Node) @@ -305,17 +313,15 @@ ACE_Static_Node::ACE_Static_Node (const ACE_TCHAR *nm, } const ACE_Service_Type * -ACE_Static_Node::record (void) const +ACE_Static_Node::record (const ACE_Service_Gestalt *config) const { ACE_TRACE ("ACE_Static_Node::record"); ACE_Service_Type *sr = 0; - if (ACE_Service_Repository::instance()->find - (this->name (), - (const ACE_Service_Type **) &sr) == -1) + if (config->find (this->name (), (const ACE_Service_Type **) &sr) == -1) return 0; - else - return sr; + + return sr; } ACE_TCHAR * @@ -326,18 +332,20 @@ ACE_Static_Node::parameters (void) const } void -ACE_Static_Node::apply (int & yyerrno) +ACE_Static_Node::apply (ACE_Service_Gestalt *config, int &yyerrno) { ACE_TRACE ("ACE_Static_Node::apply"); - if (ACE_Service_Config::initialize (this->name (), + if (config->initialize (this->name (), this->parameters ()) == -1) ++yyerrno; +#ifndef ACE_NLOGGING if (ACE::debug ()) ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("did static on %s, error = %d\n"), this->name (), yyerrno)); +#endif /* ACE_NLOGGING */ } ACE_Static_Node::~ACE_Static_Node (void) @@ -346,6 +354,7 @@ ACE_Static_Node::~ACE_Static_Node (void) delete[] this->parameters_; } + ACE_ALLOC_HOOK_DEFINE (ACE_Location_Node) void @@ -389,13 +398,6 @@ ACE_Location_Node::pathname (const ACE_TCHAR *p) this->pathname_ = p; } -void -ACE_Location_Node::set_symbol (void *s) -{ - ACE_TRACE ("ACE_Location_Node::set_symbol"); - this->symbol_ = s; -} - int ACE_Location_Node::dispose (void) const { @@ -408,10 +410,25 @@ ACE_Location_Node::open_dll (int & yyerrno) { ACE_TRACE ("ACE_Location_Node::open_dll"); +#ifndef ACE_NLOGGING + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%P|%t) LN::open_dll - path=%s\n"), + this->pathname ())); +#endif /* ACE_NLOGGING */ + if (-1 == this->dll_.open (this->pathname ())) { ++yyerrno; +#ifndef ACE_NLOGGING + ACE_TCHAR *errmsg = this->dll_.error (); + ACE_ERROR ((LM_ERROR, + ACE_LIB_TEXT ("(%P|%t) LN - DLL::open failed for %s: %s\n"), + this->pathname (), + errmsg ? errmsg : ACE_LIB_TEXT ("no error reported"))); +#endif /* ACE_NLOGGING */ + return -1; } @@ -419,6 +436,13 @@ ACE_Location_Node::open_dll (int & yyerrno) } +void +ACE_Location_Node::set_symbol (void *s) +{ + ACE_TRACE ("ACE_Location_Node::set_symbol"); + this->symbol_ = s; +} + ACE_ALLOC_HOOK_DEFINE (ACE_Object_Node) void @@ -439,7 +463,8 @@ ACE_Object_Node::ACE_Object_Node (const ACE_TCHAR *path, } void * -ACE_Object_Node::symbol (int & yyerrno, +ACE_Object_Node::symbol (ACE_Service_Gestalt *, + int &yyerrno, ACE_Service_Object_Exterminator *) { ACE_TRACE ("ACE_Object_Node::symbol"); @@ -455,7 +480,7 @@ ACE_Object_Node::symbol (int & yyerrno, #ifndef ACE_NLOGGING ACE_TCHAR *errmsg = this->dll_.error (); ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_DLL::symbol failed for object %s: %s\n"), + ACE_LIB_TEXT ("DLL::symbol failed for object %s: %s\n"), object_name, errmsg ? errmsg : ACE_LIB_TEXT ("no error reported"))); #endif /* ACE_NLOGGING */ @@ -555,7 +580,8 @@ ACE_Function_Node::make_func_name (ACE_TCHAR const * func_name) } void * -ACE_Function_Node::symbol (int & yyerrno, +ACE_Function_Node::symbol (ACE_Service_Gestalt *, + int &yyerrno, ACE_Service_Object_Exterminator *gobbler) { typedef ACE_Service_Object *(*ACE_Service_Factory_Ptr) @@ -582,7 +608,8 @@ ACE_Function_Node::symbol (int & yyerrno, #ifndef ACE_NLOGGING ACE_TCHAR *errmsg = this->dll_.error (); ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_DLL::symbol failed for function %s: %s\n"), + ACE_LIB_TEXT ("DLL::symbol failed for function %s: ") + ACE_LIB_TEXT ("%s\n"), function_name, errmsg ? errmsg : ACE_LIB_TEXT ("no error reported"))); @@ -635,7 +662,7 @@ ACE_Dummy_Node::ACE_Dummy_Node (const ACE_Static_Node *static_node, } void -ACE_Dummy_Node::apply (int & yyerrno) +ACE_Dummy_Node::apply (ACE_Service_Gestalt *, int &yyerrno) { ACE_TRACE ("ACE_Dummy_Node::apply"); @@ -645,8 +672,6 @@ ACE_Dummy_Node::apply (int & yyerrno) ACE_LIB_TEXT ("did operations on stream %s, error = %d\n"), this->name (), yyerrno)); -#else - ACE_UNUSED_ARG (yyerrno); #endif /* ACE_NLOGGING */ } @@ -677,32 +702,28 @@ ACE_Static_Function_Node::ACE_Static_Function_Node (const ACE_TCHAR *func_name) } void * -ACE_Static_Function_Node::symbol (int & yyerrno, +ACE_Static_Function_Node::symbol (ACE_Service_Gestalt *config, + int &yyerrno, ACE_Service_Object_Exterminator *gobbler) { ACE_TRACE ("ACE_Static_Function_Node::symbol"); - void *(*func)(ACE_Service_Object_Exterminator *) = 0; this->symbol_ = 0; // Locate the factory function <function_name> in the statically // linked svcs. - ACE_Static_Svc_Descriptor **ssdp = 0; - ACE_STATIC_SVCS &svcs = *ACE_Service_Config::static_svcs (); - ACE_TCHAR *function_name = const_cast<ACE_TCHAR *> (this->function_name_); - - for (ACE_STATIC_SVCS_ITERATOR iter (svcs); - iter.next (ssdp) != 0; - iter.advance ()) - { - ACE_Static_Svc_Descriptor *ssd = *ssdp; - if (ACE_OS::strcmp (ssd->name_, - function_name) == 0) - func = (void *(*)(ACE_Service_Object_Exterminator*)) ssd->alloc_; + ACE_Static_Svc_Descriptor *ssd = 0; + if (config->find_static_svc_descriptor (this->function_name_, &ssd) == -1) + { + yyerrno++; + ACE_ERROR_RETURN ((LM_ERROR, + ACE_LIB_TEXT ("(%P|%t) No static service registered for function %s\n"), + this->function_name_), + 0); } - if (func == 0) + if (ssd->alloc_ == 0) { yyerrno++; @@ -711,14 +732,15 @@ ACE_Static_Function_Node::symbol (int & yyerrno, ++yyerrno; ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("no static service registered for function %s\n"), - function_name), + ACE_LIB_TEXT ("(%P|%t) No static service factory ") + ACE_LIB_TEXT ("function registered for function %s\n"), + this->function_name_), 0); } } // Invoke the factory function and record it's return value. - this->symbol_ = (*func) (gobbler); + this->symbol_ = (*ssd->alloc_) (gobbler); if (this->symbol_ == 0) { diff --git a/ace/Parse_Node.h b/ace/Parse_Node.h index acb07deadc8..e97d841bfa1 100644 --- a/ace/Parse_Node.h +++ b/ace/Parse_Node.h @@ -25,6 +25,7 @@ #if (ACE_USES_CLASSIC_SVC_CONF == 1) #include "ace/DLL.h" +#include "ace/Svc_Conf.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -51,7 +52,9 @@ public: ACE_Parse_Node *link (void) const; void link (ACE_Parse_Node *); - virtual void apply (int & yyerrno) = 0; + + /// Will update the yyereno member and/or the corresponding configuration + virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno) = 0; const ACE_TCHAR *name (void) const; void print (void) const; @@ -65,6 +68,10 @@ public: private: const ACE_TCHAR *name_; ACE_Parse_Node *next_; + +private: + ACE_UNIMPLEMENTED_FUNC (ACE_Parse_Node (const ACE_Parse_Node&)) + ACE_UNIMPLEMENTED_FUNC (ACE_Parse_Node& operator= (const ACE_Parse_Node&)) }; /** @@ -82,13 +89,20 @@ public: ACE_Suspend_Node (const ACE_TCHAR *name); ~ACE_Suspend_Node (void); - virtual void apply (int & yyerrno); + virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno); /// Dump the state of an object. void dump (void) const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; + +private: + ACE_UNIMPLEMENTED_FUNC + (ACE_Suspend_Node (const ACE_Suspend_Node&)) + + ACE_UNIMPLEMENTED_FUNC + (ACE_Suspend_Node& operator= (const ACE_Suspend_Node&)) }; /** @@ -106,13 +120,17 @@ public: ACE_Resume_Node (const ACE_TCHAR *name); ~ACE_Resume_Node (void); - virtual void apply (int & yyerrno); + virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno); /// Dump the state of an object. void dump (void) const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; + +private: + ACE_UNIMPLEMENTED_FUNC (ACE_Resume_Node (const ACE_Resume_Node&)) + ACE_UNIMPLEMENTED_FUNC (ACE_Resume_Node& operator= (const ACE_Resume_Node&)) }; /** @@ -130,13 +148,17 @@ public: ACE_Remove_Node (const ACE_TCHAR *name); ~ACE_Remove_Node (void); - virtual void apply (int & yyerrno); + virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno); /// Dump the state of an object. void dump (void) const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; + +private: + ACE_UNIMPLEMENTED_FUNC (ACE_Remove_Node (const ACE_Remove_Node&)) + ACE_UNIMPLEMENTED_FUNC (ACE_Remove_Node& operator= (const ACE_Remove_Node&)) }; /** @@ -154,8 +176,9 @@ public: ACE_Static_Node (const ACE_TCHAR *name, ACE_TCHAR *params = 0); virtual ~ACE_Static_Node (void); - virtual void apply (int & yyerrno); - virtual const ACE_Service_Type *record (void) const; + virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno); + virtual const ACE_Service_Type *record (const ACE_Service_Gestalt *g) const; + ACE_TCHAR *parameters (void) const; /// Dump the state of an object. @@ -167,8 +190,15 @@ public: private: /// "Command-line" parameters. ACE_TCHAR *parameters_; + +private: + ACE_UNIMPLEMENTED_FUNC (ACE_Static_Node (const ACE_Static_Node&)) + ACE_UNIMPLEMENTED_FUNC (ACE_Static_Node& operator= (const ACE_Static_Node&)) }; + +class ACE_Service_Type_Factory; + /** * @class ACE_Dynamic_Node * @@ -181,11 +211,13 @@ private: class ACE_Dynamic_Node : public ACE_Static_Node { public: - ACE_Dynamic_Node (const ACE_Service_Type *, ACE_TCHAR *params); + ACE_Dynamic_Node (ACE_Service_Type_Factory const *, ACE_TCHAR *params); + + // ACE_Dynamic_Node (const ACE_Service_Type *, ACE_TCHAR *params); virtual ~ACE_Dynamic_Node (void); - virtual const ACE_Service_Type *record (void) const; - virtual void apply (int & yyerrno); + // virtual const ACE_Service_Type *record (void) const; + virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno); /// Dump the state of an object. void dump (void) const; @@ -195,7 +227,14 @@ public: private: /// Pointer to a descriptor that describes this node. - const ACE_Service_Type *record_; + ACE_Auto_Ptr<const ACE_Service_Type_Factory> factory_; + +private: + ACE_UNIMPLEMENTED_FUNC + (ACE_Dynamic_Node (const ACE_Dynamic_Node&)) + + ACE_UNIMPLEMENTED_FUNC + (ACE_Dynamic_Node& operator= (const ACE_Dynamic_Node&)) }; /** @@ -213,7 +252,7 @@ public: ACE_Stream_Node (const ACE_Static_Node *, const ACE_Parse_Node *); virtual ~ACE_Stream_Node (void); - virtual void apply (int & yyerrno); + virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno); /// Dump the state of an object. void dump (void) const; @@ -225,6 +264,42 @@ private: /// Linked list of modules that are part of the stream. const ACE_Static_Node *node_; const ACE_Parse_Node *mods_; + +private: + ACE_UNIMPLEMENTED_FUNC (ACE_Stream_Node (const ACE_Stream_Node&)) + ACE_UNIMPLEMENTED_FUNC (ACE_Stream_Node& operator= (const ACE_Stream_Node&)) +}; + +/** + * @class ACE_Dummy_Node + * + * @brief I forget why this is here... ;-) + * @brief Used in a special case of static STREAM definintion + * + * @note This class is only meant for INTERNAL use by ACE. + */ +class ACE_Dummy_Node : public ACE_Parse_Node +{ +public: + ACE_Dummy_Node (const ACE_Static_Node *, const ACE_Parse_Node *); + ~ACE_Dummy_Node (void); + + virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Linked list of modules that we're dealing with. + const ACE_Static_Node *node_; + const ACE_Parse_Node *mods_; + +private: + ACE_UNIMPLEMENTED_FUNC (ACE_Dummy_Node (const ACE_Dummy_Node&)) + ACE_UNIMPLEMENTED_FUNC (ACE_Dummy_Node& operator= (const ACE_Dummy_Node&)) }; /** @@ -240,15 +315,19 @@ class ACE_Location_Node { public: ACE_Location_Node (void); - virtual void *symbol (int & yyerrno, - ACE_Service_Object_Exterminator * = 0) = 0; - virtual void set_symbol (void *h); const ACE_DLL &dll (void); const ACE_TCHAR *pathname (void) const; void pathname (const ACE_TCHAR *h); int dispose (void) const; virtual ~ACE_Location_Node (void); + virtual void set_symbol (void *h); + + /// Will update the yyerrno member and/or corresponding configuration + /// repository + virtual void *symbol (ACE_Service_Gestalt *cfgptr, + int &yyerrno, + ACE_Service_Object_Exterminator * = 0) = 0; /// Dump the state of an object. void dump (void) const; @@ -274,6 +353,13 @@ protected: /// Symbol that we've obtained from the shared library. void *symbol_; + +private: + ACE_UNIMPLEMENTED_FUNC + (ACE_Location_Node (const ACE_Location_Node&)) + + ACE_UNIMPLEMENTED_FUNC + (ACE_Location_Node& operator= (const ACE_Location_Node&)) }; /** @@ -289,7 +375,8 @@ class ACE_Object_Node : public ACE_Location_Node { public: ACE_Object_Node (const ACE_TCHAR *pathname, const ACE_TCHAR *obj_name); - virtual void *symbol (int & yyerrno, + virtual void *symbol (ACE_Service_Gestalt *config, + int &yyerrno, ACE_Service_Object_Exterminator * = 0); virtual ~ACE_Object_Node (void); @@ -302,6 +389,10 @@ public: private: /// Name of the object that we're parsing. const ACE_TCHAR *object_name_; + +private: + ACE_UNIMPLEMENTED_FUNC (ACE_Object_Node (const ACE_Object_Node&)) + ACE_UNIMPLEMENTED_FUNC (ACE_Object_Node& operator= (const ACE_Object_Node&)) }; /** @@ -317,7 +408,8 @@ class ACE_Function_Node : public ACE_Location_Node { public: ACE_Function_Node (const ACE_TCHAR *pathname, const ACE_TCHAR *func_name); - virtual void *symbol (int & yyerrno, + virtual void *symbol (ACE_Service_Gestalt *config, + int &yyerrno, ACE_Service_Object_Exterminator *gobbler = 0); virtual ~ACE_Function_Node (void); @@ -352,34 +444,13 @@ private: /// Name of the function that we're parsing. const ACE_TCHAR *function_name_; -}; - -/** - * @class ACE_Dummy_Node - * - * @brief I forget why this is here... ;-) - * - * @note This class is only meant for INTERNAL use by ACE. - * - * @internal - */ -class ACE_Dummy_Node : public ACE_Parse_Node -{ -public: - ACE_Dummy_Node (const ACE_Static_Node *, const ACE_Parse_Node *); - ~ACE_Dummy_Node (void); - virtual void apply (int & yyerrno); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; private: - /// Linked list of modules that we're dealing with. - const ACE_Static_Node *node_; - const ACE_Parse_Node *mods_; + ACE_UNIMPLEMENTED_FUNC + (ACE_Function_Node (const ACE_Function_Node&)) + + ACE_UNIMPLEMENTED_FUNC + (ACE_Function_Node& operator= (const ACE_Function_Node&)) }; /** @@ -397,7 +468,8 @@ class ACE_Static_Function_Node : public ACE_Location_Node { public: explicit ACE_Static_Function_Node (const ACE_TCHAR *func_name); - virtual void *symbol (int & yyerrno, + virtual void *symbol (ACE_Service_Gestalt *config, + int &yyerrno, ACE_Service_Object_Exterminator * = 0); virtual ~ACE_Static_Function_Node (void); @@ -410,11 +482,14 @@ public: private: /// Name of the function that we're parsing. const ACE_TCHAR *function_name_; -}; -/// Global variable used to communicate between the parser and the main -/// program. -extern ACE_Service_Config *ace_this_svc; +private: + ACE_UNIMPLEMENTED_FUNC + (ACE_Static_Function_Node (const ACE_Static_Function_Node&)) + + ACE_UNIMPLEMENTED_FUNC + (ACE_Static_Function_Node& operator= (const ACE_Static_Function_Node&)) +}; ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Process_Manager.cpp b/ace/Process_Manager.cpp index f476fc04a10..5324903d8dd 100644 --- a/ace/Process_Manager.cpp +++ b/ace/Process_Manager.cpp @@ -354,7 +354,7 @@ ACE_Process_Manager::handle_signal (int, { ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, lock_, -1)); - ssize_t i = this->find_proc (proc); + ssize_t const i = this->find_proc (proc); if (i == -1) return -1; #if 0 @@ -400,7 +400,7 @@ ACE_Process_Manager::register_handler (ACE_Event_Handler *eh, return 0; } - ssize_t i = this->find_proc (pid); + ssize_t const i = this->find_proc (pid); if (i == -1) { @@ -443,7 +443,7 @@ ACE_Process_Manager::spawn (ACE_Process *process, { ACE_TRACE ("ACE_Process_Manager::spawn"); - pid_t pid = process->spawn (options); + pid_t const pid = process->spawn (options); // Only include the pid in the parent's table. if (pid == ACE_INVALID_PID || pid == 0) @@ -479,7 +479,7 @@ ACE_Process_Manager::spawn_n (size_t n, i < n; i++) { - pid_t pid = this->spawn (options, event_handler); + pid_t const pid = this->spawn (options, event_handler); if (pid == ACE_INVALID_PID || pid == 0) // We're in the child or something's gone wrong. return pid; @@ -521,7 +521,7 @@ ACE_Process_Manager::append_proc (ACE_Process *proc, // automagically. Get a handle to this new Process and tell the // Reactor we're interested in <handling_input> on it. - ACE_Reactor *r = this->reactor (); + ACE_Reactor * const r = this->reactor (); if (r != 0) r->register_handler (this, proc->gethandle ()); #endif /* ACE_WIN32 */ @@ -556,7 +556,7 @@ ACE_Process_Manager::remove (pid_t pid) ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1)); - ssize_t i = this->find_proc (pid); + ssize_t const i = this->find_proc (pid); if (i != -1) return this->remove_proc (i); @@ -584,7 +584,7 @@ ACE_Process_Manager::remove_proc (size_t i) } #if defined (ACE_WIN32) - ACE_Reactor *r = this->reactor (); + ACE_Reactor * const r = this->reactor (); if (r != 0) r->remove_handler (this->process_table_[i].process_->gethandle (), ACE_Event_Handler::DONT_CALL); @@ -643,7 +643,7 @@ ACE_Process_Manager::terminate (pid_t pid, // Check for duplicates and bail out if they're already // registered... - ssize_t i = this->find_proc (pid); + ssize_t const i = this->find_proc (pid); if (i == -1) // set "no such process" error @@ -655,16 +655,16 @@ ACE_Process_Manager::terminate (pid_t pid, int ACE_Process_Manager::set_scheduler (const ACE_Sched_Params & params, - pid_t pid) + pid_t pid) { - ACE_TRACE ("ACE_Process_Manager::sched_setscheduler"); + ACE_TRACE ("ACE_Process_Manager::set_scheduler"); ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1)); // Check to see if the process identified by the given pid is managed by // this instance of ACE_Process_Manager. - ssize_t i = this->find_proc (pid); + ssize_t const i = this->find_proc (pid); if (i == -1) // set "no such process" error @@ -676,14 +676,14 @@ ACE_Process_Manager::set_scheduler (const ACE_Sched_Params & params, int ACE_Process_Manager::set_scheduler_all (const ACE_Sched_Params & params) { - ACE_TRACE ("ACE_Process_Manager::setscheduler_all"); + ACE_TRACE ("ACE_Process_Manager::set_scheduler_all"); ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1)); - pid_t pid; + for (size_t i = 0; i < this->current_count_; ++i) { - pid = this->process_table_[i].process_->getpid (); + pid_t const pid = this->process_table_[i].process_->getpid (); if (ACE_OS::sched_params (params, pid) != 0) return -1; } @@ -740,7 +740,7 @@ ACE_Process_Manager::wait (const ACE_Time_Value &timeout) while (this->current_count_ > 0) { - pid_t pid = this->wait (0, remaining); + pid_t const pid = this->wait (0, remaining); if (pid == ACE_INVALID_PID) // wait() failed return -1; diff --git a/ace/RB_Tree.h b/ace/RB_Tree.h index 5c63d0b51ee..16db8fc081d 100644 --- a/ace/RB_Tree.h +++ b/ace/RB_Tree.h @@ -370,8 +370,8 @@ public: /** * Returns a reference to the underlying <ACE_LOCK>. This makes it * possible to acquire the lock explicitly, which can be useful in - * some cases if you instantiate the <ACE_Atomic_Op> with an - * <ACE_Recursive_Mutex> or <ACE_Process_Mutex>, or if you need to + * some cases if you instantiate the ACE_Atomic_Op with an + * ACE_Recursive_Mutex or ACE_Process_Mutex, or if you need to * guard the state of an iterator. * @note The right name would be <lock>, but HP/C++ will choke on that! */ diff --git a/ace/Service_Config.cpp b/ace/Service_Config.cpp index e56b5b04489..97a109e5acf 100644 --- a/ace/Service_Config.cpp +++ b/ace/Service_Config.cpp @@ -6,29 +6,13 @@ #include "ace/Service_Config.inl" #endif /* __ACE_INLINE__ */ -#include "ace/Svc_Conf.h" -#include "ace/Get_Opt.h" -#include "ace/ARGV.h" -#include "ace/Malloc.h" -#include "ace/Service_Manager.h" -#include "ace/Service_Repository.h" #include "ace/Service_Types.h" -#include "ace/Containers.h" -#include "ace/Auto_Ptr.h" #include "ace/Reactor.h" -#include "ace/Thread_Manager.h" -#include "ace/DLL.h" -#include "ace/XML_Svc_Conf.h" -#include "ace/SString.h" - -#ifndef ACE_LACKS_UNIX_SIGNALS -# include "ace/Signal.h" -#endif /* !ACE_LACKS_UNIX_SIGNALS */ - -#include "ace/OS_NS_stdio.h" +#include "ace/Signal.h" #include "ace/OS_NS_time.h" #include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_sys_stat.h" +#include "ace/Get_Opt.h" +#include "ace/Service_Gestalt.h" ACE_RCSID (ace, Service_Config, @@ -36,17 +20,43 @@ ACE_RCSID (ace, ACE_BEGIN_VERSIONED_NAMESPACE_DECL -ACE_ALLOC_HOOK_DEFINE (ACE_Service_Config) -void -ACE_Service_Config::dump (void) const +/// +ACE_Service_Config_Guard::ACE_Service_Config_Guard (ACE_Service_Gestalt * psg) + : saved_ (ACE_Service_Config::current ()) { -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Service_Config::dump"); -#endif /* ACE_HAS_DUMP */ + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%P|%t) SCG::ctor, repo=%@ - guard with %@\n"), + this->saved_->repo_, + psg->repo_)); + + if (saved_ != psg) + { + // Modify the TSS - no locking needed + (void)ACE_Service_Config::current (psg); + } +} + +/// +ACE_Service_Config_Guard::~ACE_Service_Config_Guard (void) +{ + ACE_Service_Config::current (this->saved_); + + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%P|%t) SCG::dtor, repo=%@ - un-guard\n"), + this->saved_->repo_)); } -// ---------------------------------------- + +ACE_ALLOC_HOOK_DEFINE (ACE_Service_Config) + + +// A thread-specific storage to keep a pointer to the (current) global +// configuration. +ACE_TSS_TYPE (ACE_TSS_Type_Adapter <ACE_Service_Gestalt*>) + ACE_Service_Config::current_ (0); // Set the signal handler to point to the handle_signal() function. ACE_Sig_Adapter *ACE_Service_Config::signal_handler_ = 0; @@ -54,40 +64,281 @@ ACE_Sig_Adapter *ACE_Service_Config::signal_handler_ = 0; // Trigger a reconfiguration. sig_atomic_t ACE_Service_Config::reconfig_occurred_ = 0; - // = Set by command-line options. +// = Set by command-line options. + +/// Pathname of file to write process id. +ACE_TCHAR *ACE_Service_Config::pid_file_name_ = 0; + +/// Shall we become a daemon process? int ACE_Service_Config::be_a_daemon_ = 0; -int ACE_Service_Config::no_static_svcs_ = 1; -ACE_TCHAR* ACE_Service_Config::pid_file_name_ = 0; // Number of the signal used to trigger reconfiguration. int ACE_Service_Config::signum_ = SIGHUP; -// Indicates where to write the logging output. This is typically -// either a STREAM pipe or a socket address. -const ACE_TCHAR *ACE_Service_Config::logger_key_ = ACE_DEFAULT_LOGGER_KEY; -// The ACE_Service_Manager static service object is now defined by the -// ACE_Object_Manager, in Object_Manager.cpp. +void +ACE_Service_Config::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Service_Config::dump"); +#endif /* ACE_HAS_DUMP */ +} + +int +ACE_Service_Config::parse_args_i (int argc, ACE_TCHAR *argv[]) +{ + ACE_TRACE ("ACE_Service_Config::parse_args_i"); + ACE_Get_Opt getopt (argc, + argv, + ACE_LIB_TEXT ("bs:p:"), + 1); // Start at argv[1]. + + for (int c; (c = getopt ()) != -1; ) + switch (c) + { + case 'p': + ACE_Service_Config::pid_file_name_ = getopt.opt_arg (); + break; + case 'b': + ACE_Service_Config::be_a_daemon_ = 1; + break; + case 's': + { + // There's no point in dealing with this on NT since it + // doesn't really support signals very well... +#if !defined (ACE_LACKS_UNIX_SIGNALS) + ACE_Service_Config::signum_ = + ACE_OS::atoi (getopt.opt_arg ()); + + if (ACE_Reactor::instance ()->register_handler + (ACE_Service_Config::signum_, + ACE_Service_Config::signal_handler_) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_LIB_TEXT ("cannot obtain signal handler\n")), + -1); +#endif /* ACE_LACKS_UNIX_SIGNALS */ + break; + } + } + + return ACE_Service_Gestalt::parse_args_i (argc, argv); + +} /* parse_args_i () */ + + +int +ACE_Service_Config::open_i (const ACE_TCHAR program_name[], + const ACE_TCHAR *logger_key, + bool ignore_static_svcs, + bool ignore_default_svc_conf_file, + bool ignore_debug_flag) +{ + int result = 0; + ACE_TRACE ("ACE_Service_Config::open_i"); + ACE_Log_Msg *log_msg = ACE_LOG_MSG; + + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) SC::open_i - this=%@, opened=%d, ") + ACE_TEXT ("loadstatics=%d\n"), + this, this->is_opened_, this->no_static_svcs_)); + + // Guard against reentrant processing. For example, + // if the singleton gestalt (ubergestalt) was already open, + // do not open it again... + // The base class open_i increments this and we are + // forwarding to it, so we don't have to increment here. + if (this->is_opened_ != 0) + return 0; + + // Check for things we need to do on a per-process basis and which + // may not be safe, or wise to do an a per instance basis + + // Override any defaults, if required + this->no_static_svcs_ = ignore_static_svcs; + + // Become a daemon before doing anything else. + if (this->be_a_daemon_) + ACE::daemonize (); + + // Write process id to file. + if (this->pid_file_name_ != 0) + { + FILE* pidf = ACE_OS::fopen (this->pid_file_name_, + ACE_LIB_TEXT("w")); + + if (pidf != 0) + { + ACE_OS::fprintf (pidf, + "%ld\n", + static_cast<long> (ACE_OS::getpid())); + ACE_OS::fclose (pidf); + } + } + + u_long flags = log_msg->flags (); + + // Only use STDERR if the caller hasn't already set the flags. + if (flags == 0) + flags = (u_long) ACE_Log_Msg::STDERR; + + const ACE_TCHAR *key = logger_key; + + if (key == 0 || ACE_OS::strcmp (key, ACE_DEFAULT_LOGGER_KEY) == 0) + // Only use the static <logger_key_> if the caller doesn't + // override it in the parameter list or if the key supplied is + // equal to the default static logger key. + key = this->logger_key_; + else + ACE_SET_BITS (flags, ACE_Log_Msg::LOGGER); + + if (log_msg->open (program_name, + flags, + key) == -1) + result = -1; + else + { + if (ACE::debug ()) + ACE_DEBUG ((LM_STARTUP, + ACE_LIB_TEXT ("starting up daemon %n\n"))); + + // Initialize the Service Repository (this will still work if + // user forgets to define an object of type ACE_Service_Config). + ACE_Service_Repository::instance (ACE_Service_Config::MAX_SERVICES); + + // Initialize the ACE_Reactor (the ACE_Reactor should be the + // same size as the ACE_Service_Repository). + ACE_Reactor::instance (); + + // There's no point in dealing with this on NT since it doesn't + // really support signals very well... +#if !defined (ACE_LACKS_UNIX_SIGNALS) + // Only attempt to register a signal handler for positive + // signal numbers. + if (ACE_Service_Config::signum_ > 0) + { + ACE_Sig_Set ss; + ss.sig_add (ACE_Service_Config::signum_); + if (ACE_Reactor::instance ()->register_handler + (ss, ACE_Service_Config::signal_handler_) == -1) + ACE_ERROR ((LM_ERROR, + ACE_LIB_TEXT ("can't register signal handler\n"))); + } +#endif /* ACE_LACKS_UNIX_SIGNALS */ + } + + if (result == -1) + return -1; + + if (this->init_svc_conf_file_queue () == -1) + return -1; + + // Check if the default file exists before attempting to queue it + // for processing + if (!ignore_default_svc_conf_file) + { + FILE *fp = ACE_OS::fopen (ACE_DEFAULT_SVC_CONF, + ACE_LIB_TEXT ("r")); + ignore_default_svc_conf_file = (fp == 0); + if (fp != 0) + ACE_OS::fclose (fp); + } + + if (!ignore_default_svc_conf_file + && this->svc_conf_file_queue_->is_empty ()) + { + // Load the default "svc.conf" entry here if there weren't + // overriding -f arguments in <parse_args>. + if (this->svc_conf_file_queue_->enqueue_tail (ACE_TString (ACE_DEFAULT_SVC_CONF)) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_LIB_TEXT ("%p\n"), + ACE_LIB_TEXT ("enqueuing ") + ACE_LIB_TEXT (ACE_DEFAULT_SVC_CONF) + ACE_LIB_TEXT(" file")), + -1); + } + } + + return ACE_Service_Gestalt::open_i (program_name, + logger_key, + ignore_static_svcs, + ignore_default_svc_conf_file, + ignore_debug_flag); + +} + +/// Return the global configuration instance. Allways returns the same +/// instance +ACE_Service_Gestalt * +ACE_Service_Config::global (void) +{ + return ACE_Singleton<ACE_Service_Config, ACE_SYNCH_MUTEX>::instance (); +} + +/// +ACE_Service_Gestalt * +ACE_Service_Config::instance (void) +{ + return ACE_Service_Config::current (); +} + +/// Return the configuration instance, considered "global" in +/// the current thread. This may be the same as instance(), but on some +/// occasions, it may be a different one. For example, ACE_Service_Config_Guard +/// provides a way of temporarily replacing the "current" configuration +/// instance in the context of a thread. +ACE_Service_Gestalt * +ACE_Service_Config::current (void) +{ + ACE_Service_Gestalt *tmp = ACE_Service_Config::global (); + + // If the Object_Manager is in transient state, the + // ACE_Service_Gestalt::current_ instance may not have been constructed + // yet (or may have been already destroyed). Either way there + // are no other threads. + if (ACE_Object_Manager::starting_up () || ACE_Object_Manager::shutting_down ()) + return tmp; -// Are we initialized already? -int ACE_Service_Config::is_initialized_ = 0; + if (ACE_Service_Config::current_.ts_object () != 0) + return ACE_TSS_GET (current_, ACE_Service_Gestalt); -// List of statically configured services. + // Stash a pointer to the global configuration, so it can be returned out + // of TSS the next time a thread asks for it + ACE_Service_Config::current (tmp); -ACE_STATIC_SVCS *ACE_Service_Config::static_svcs_ = 0; -ACE_SVC_QUEUE *ACE_Service_Config::svc_queue_ = 0; -ACE_SVC_QUEUE *ACE_Service_Config::svc_conf_file_queue_ = 0; + return tmp; +} -ACE_STATIC_SVCS * +/// A mutator to set the "current" (TSS) gestalt instance. +int +ACE_Service_Config::current (ACE_Service_Gestalt *newcurrent) +{ + *ACE_Service_Config::current_ = newcurrent; + return 0; +} + + +// Changed the interface of this method to return the gestalt instead of +// the container, underlying the service repository and defined +// ACE_Service_Gestalt::insert (ACE_Static_Svc_Descriptor*). This way the +// existing source code can keep using ACE_Service_Config::static_svcs(), +// however now it is not necessary to expose the repository storage *and* +// it is much easier to debug service registration problems. +ACE_Service_Gestalt * ACE_Service_Config::static_svcs (void) { - if (ACE_Service_Config::static_svcs_ == 0) - ACE_NEW_RETURN (ACE_Service_Config::static_svcs_, - ACE_STATIC_SVCS, - 0); - return ACE_Service_Config::static_svcs_; + return ACE_Service_Config::current (); } +/// +int +ACE_Service_Config::insert (ACE_Static_Svc_Descriptor* stsd) +{ + return ACE_Service_Config::current ()->insert (stsd); +} + + // Totally remove <svc_name> from the daemon by removing it from the // ACE_Reactor, and unlinking it if necessary. @@ -131,7 +382,9 @@ ACE_Service_Config::ACE_Service_Config (int ignore_static_svcs, int signum) { ACE_TRACE ("ACE_Service_Config::ACE_Service_Config"); - ACE_Service_Config::no_static_svcs_ = ignore_static_svcs; + + this->no_static_svcs_ = (ignore_static_svcs); + ACE_Service_Config::signum_ = signum; // Initialize the Service Repository. @@ -142,98 +395,6 @@ ACE_Service_Config::ACE_Service_Config (int ignore_static_svcs, ACE_Reactor::instance (); } -int -ACE_Service_Config::init_svc_conf_file_queue (void) -{ - if (ACE_Service_Config::svc_conf_file_queue_ == 0) - ACE_NEW_RETURN (ACE_Service_Config::svc_conf_file_queue_, - ACE_SVC_QUEUE, - -1); - return 0; -} - -// Handle the command-line options intended for the -// ACE_Service_Config. - -int -ACE_Service_Config::parse_args (int argc, ACE_TCHAR *argv[]) -{ - ACE_TRACE ("ACE_Service_Config::parse_args"); - ACE_Get_Arg_Opt<ACE_TCHAR> getopt (argc, - argv, - ACE_LIB_TEXT ("bdf:k:nyp:s:S:"), - 1); // Start at argv[1]. - - if (ACE_Service_Config::init_svc_conf_file_queue () == -1) - return -1; - - for (int c; (c = getopt ()) != -1; ) - switch (c) - { - case 'b': - ACE_Service_Config::be_a_daemon_ = 1; - break; - case 'd': - ACE::debug (1); - break; - case 'f': - if (ACE_Service_Config::svc_conf_file_queue_->enqueue_tail - (ACE_TString (getopt.opt_arg ())) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("enqueue_tail")), - -1); - break; - case 'k': - ACE_Service_Config::logger_key_ = getopt.opt_arg (); - break; - case 'n': - ACE_Service_Config::no_static_svcs_ = 1; - break; - case 'y': - ACE_Service_Config::no_static_svcs_ = 0; - break; - case 'p': - ACE_Service_Config::pid_file_name_ = getopt.opt_arg (); - break; - case 's': - { - // There's no point in dealing with this on NT since it - // doesn't really support signals very well... -#if !defined (ACE_LACKS_UNIX_SIGNALS) - ACE_Service_Config::signum_ = - ACE_OS::atoi (getopt.opt_arg ()); - - if (ACE_Reactor::instance ()->register_handler - (ACE_Service_Config::signum_, - ACE_Service_Config::signal_handler_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("cannot obtain signal handler\n")), - -1); -#endif /* ACE_LACKS_UNIX_SIGNALS */ - break; - } - case 'S': - if (ACE_Service_Config::svc_queue_ == 0) - ACE_NEW_RETURN (ACE_Service_Config::svc_queue_, - ACE_SVC_QUEUE, - -1); - if (ACE_Service_Config::svc_queue_->enqueue_tail - (ACE_TString (getopt.opt_arg ())) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("enqueue_tail")), - -1); - break; - default: - if (ACE::debug () > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("%c is not a ACE_Service_Config option\n"), - c)); - } - - return 0; -} #if (ACE_USES_CLASSIC_SVC_CONF == 0) ACE_Service_Type * @@ -291,492 +452,6 @@ ACE_Service_Config::create_service_type_impl (const ACE_TCHAR *name, } -// Initialize and activate a statically linked service. - -int -ACE_Service_Config::initialize (const ACE_TCHAR *svc_name, - const ACE_TCHAR *parameters) -{ - ACE_TRACE ("ACE_Service_Config::initialize"); - ACE_ARGV args (parameters); - ACE_Service_Type *srp = 0; - - if (ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("opening static service %s\n"), - svc_name)); - - if (ACE_Service_Repository::instance ()->find - (svc_name, - (const ACE_Service_Type **) &srp) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%s not found\n"), - svc_name), - -1); - else if (srp->type ()->init (args.argc (), - args.argv ()) == -1) - { - // Remove this entry. - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("static initialization failed, %p\n"), - svc_name)); - ACE_Service_Repository::instance ()->remove (svc_name); - return -1; - } - else - { - srp->active (1); - return 0; - } -} - -// Dynamically link the shared object file and retrieve a pointer to -// the designated shared object in this file. - -int -ACE_Service_Config::initialize (const ACE_Service_Type *sr, - const ACE_TCHAR *parameters) -{ - ACE_TRACE ("ACE_Service_Config::initialize"); - ACE_ARGV args (parameters); - - if (ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("opening dynamic service %s\n"), - sr->name ())); - - ACE_Service_Type *srp = 0; - if (ACE_Service_Repository::instance ()->find - (sr->name (), - (const ACE_Service_Type **) &srp) >= 0) - ACE_ERROR_RETURN ((LM_DEBUG, - ACE_LIB_TEXT ("%s already installed, please remove first before reinstalling\n"), - sr->name ()), - 0); - - if (sr->type ()->init (args.argc (), - args.argv ()) == -1) - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("dynamic initialization failed for %s\n"), - sr->name ())); - ACE_Service_Type *ps = 0; - ACE_Service_Repository::instance ()->remove (sr->name (), &ps); - // We just get ps to avoid having remove() delete it. - return -1; - } - - if (ACE_Service_Repository::instance ()->insert (sr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("insertion failed, %p\n"), - sr->name ()), - -1); - return 0; -} - -#if (ACE_USES_CLASSIC_SVC_CONF == 1) -int -ACE_Service_Config::process_directives_i (ACE_Svc_Conf_Param *param) -{ - // AC 970827 Skip the heap check because yacc allocates a buffer - // here which will be reported as a memory leak for some reason. - ACE_NO_HEAP_CHECK - - ::ace_yyparse (param); - - if (param->yyerrno > 0) - { - // This is a hack, better errors should be provided... - errno = EINVAL; - return param->yyerrno; - } - else - return 0; -} -#else -ACE_XML_Svc_Conf * -ACE_Service_Config::get_xml_svc_conf (ACE_DLL &xmldll) -{ - if (xmldll.open (ACE_LIB_TEXT ("ACEXML_XML_Svc_Conf_Parser")) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("Fail to open ACEXML_XML_Svc_Conf_Parser: %p\n"), - "ACE_Service_Config::get_xml_svc_conf"), - 0); - - void *foo; - foo = xmldll.symbol (ACE_LIB_TEXT ("_ACEXML_create_XML_Svc_Conf_Object")); - - // Cast the void* to long first. - long tmp = reinterpret_cast<long> (foo); - ACE_XML_Svc_Conf::Factory factory = - reinterpret_cast<ACE_XML_Svc_Conf::Factory> (tmp); - if (factory == 0) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("Unable to resolve factory: %p\n"), - xmldll.error ()), - 0); - - return factory (); -} -#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ - -int -ACE_Service_Config::process_file (const ACE_TCHAR file[]) -{ - ACE_TRACE ("ACE_Service_Config::process_file"); - -#if (ACE_USES_CLASSIC_SVC_CONF == 1) - int result = 0; - - FILE *fp = ACE_OS::fopen (file, - ACE_LIB_TEXT ("r")); - - if (fp == 0) - { - // Invalid svc.conf file. We'll report it here and break out of - // the method. - if (ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("%p\n"), - file)); - - // Use stat to find out if the file exists. I didn't use access() - // because stat is better supported on most non-unix platforms. - ACE_stat exists; - if (ACE_OS::stat (file, &exists) == 0) - // If it exists, but we couldn't open it for reading then we - // must not have permission to read it. - errno = EPERM; - else - errno = ENOENT; - result = -1; - } - else - { - ACE_Svc_Conf_Param f (fp); - - // Keep track of the number of errors. - result = ACE_Service_Config::process_directives_i (&f); - - (void) ACE_OS::fclose (fp); - } - return result; -#else - ACE_DLL dll; - - auto_ptr<ACE_XML_Svc_Conf> - xml_svc_conf (ACE_Service_Config::get_xml_svc_conf (dll)); - - if (xml_svc_conf.get () == 0) - return -1; - - return xml_svc_conf->parse_file (file); -#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ -} - -int -ACE_Service_Config::process_directive (const ACE_TCHAR directive[]) -{ - ACE_TRACE ("ACE_Service_Config::process_directive"); - - if (ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Service_Config::process_directive - %s\n"), - directive)); - -#if (ACE_USES_CLASSIC_SVC_CONF == 1) - ACE_UNUSED_ARG (directive); - - ACE_Svc_Conf_Param d (directive); - - int result = ACE_Service_Config::process_directives_i (&d); - - return result; -#else - ACE_DLL dll; - - auto_ptr<ACE_XML_Svc_Conf> - xml_svc_conf (ACE_Service_Config::get_xml_svc_conf (dll)); - - if (xml_svc_conf.get () == 0) - return -1; - - return xml_svc_conf->parse_string (directive); -#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ -} - -// Process service configuration requests as indicated in the queue of -// svc.conf files. -int -ACE_Service_Config::process_directives (void) -{ - ACE_TRACE ("ACE_Service_Config::process_directives"); - - int result = 0; - - if (ACE_Service_Config::svc_conf_file_queue_ != 0) - { - ACE_TString *sptr = 0; - ACE_SVC_QUEUE &queue = *ACE_Service_Config::svc_conf_file_queue_; - - // Iterate through all the svc.conf files. - for (ACE_SVC_QUEUE_ITERATOR iter (queue); - iter.next (sptr) != 0; - iter.advance ()) - { - int r = ACE_Service_Config::process_file (sptr->fast_rep ()); - - if (r < 0) - { - result = r; - break; - } - - result += r; - } - } - - return result; -} - -int -ACE_Service_Config::process_commandline_directives (void) -{ - int result = 0; - - if (ACE_Service_Config::svc_queue_ != 0) - { - ACE_TString *sptr = 0; - ACE_SVC_QUEUE &queue = *ACE_Service_Config::svc_queue_; - - for (ACE_SVC_QUEUE_ITERATOR iter (queue); - iter.next (sptr) != 0; - iter.advance ()) - { - // Process just a single directive. - if (ACE_Service_Config::process_directive (sptr->fast_rep ()) != 0) - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("process_directive"))); - result = -1; - } - } - - delete ACE_Service_Config::svc_queue_; - ACE_Service_Config::svc_queue_ = 0; - } - - return result; -} - -int -ACE_Service_Config::process_directive (const ACE_Static_Svc_Descriptor &ssd, - int force_replace) -{ - if (!force_replace) - { - if (ACE_Service_Repository::instance ()->find (ssd.name_, - 0, 0) >= 0) - { - // The service is already there, just return - return 0; - } - } - - ACE_Service_Object_Exterminator gobbler; - void *sym = (ssd.alloc_)(&gobbler); - - ACE_Service_Type_Impl *stp = - ACE_Service_Config::create_service_type_impl (ssd.name_, - ssd.type_, - sym, - ssd.flags_, - gobbler); - if (stp == 0) - return 0; - - - ACE_Service_Type *service_type; - // This is just a temporary to force the compiler to use the right - // constructor in ACE_Service_Type - ACE_DLL tmp_dll; - - ACE_NEW_RETURN (service_type, - ACE_Service_Type (ssd.name_, - stp, - tmp_dll, - ssd.active_), - -1); - - return ACE_Service_Repository::instance ()->insert (service_type); -} - -// Add the default statically-linked services to the Service -// Repository. - -int -ACE_Service_Config::load_static_svcs (void) -{ - ACE_TRACE ("ACE_Service_Config::load_static_svcs"); - - ACE_Static_Svc_Descriptor **ssdp = 0; - ACE_STATIC_SVCS &svcs = *ACE_Service_Config::static_svcs (); - - for (ACE_STATIC_SVCS_ITERATOR iter (svcs); - iter.next (ssdp) != 0; - iter.advance ()) - { - ACE_Static_Svc_Descriptor *ssd = *ssdp; - - if (ACE_Service_Config::process_directive (*ssd, 1) == -1) - return -1; - } - return 0; -} - -// Performs an open without parsing command-line arguments. - -int -ACE_Service_Config::open_i (const ACE_TCHAR program_name[], - const ACE_TCHAR *logger_key, - int ignore_default_svc_conf_file, - int ignore_debug_flag) -{ - int result = 0; - ACE_TRACE ("ACE_Service_Config::open_i"); - ACE_Log_Msg *log_msg = ACE_LOG_MSG; - - // Record the current log setting upon entering this thread. - u_long old_process_mask = log_msg->priority_mask - (ACE_Log_Msg::PROCESS); - u_long old_thread_mask = log_msg->priority_mask - (ACE_Log_Msg::THREAD); - - if (ACE_Service_Config::is_initialized_ != 0) - // Guard against reentrant processing! - return 0; - else - ACE_Service_Config::is_initialized_++; - - if (ACE_Service_Config::init_svc_conf_file_queue () == -1) - return -1; - else if (!ignore_default_svc_conf_file - && ACE_Service_Config::svc_conf_file_queue_->is_empty () - // Load the default "svc.conf" entry here if there weren't - // overriding -f arguments in <parse_args>. - && ACE_Service_Config::svc_conf_file_queue_->enqueue_tail - (ACE_TString (ACE_DEFAULT_SVC_CONF)) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("enqueue_tail")), - -1); - - if (ignore_debug_flag == 0) - { - // If -d was included as a startup parameter, the user wants debug - // information printed during service initialization. - if (ACE::debug ()) - ACE_Log_Msg::enable_debug_messages (); - else - // The user has requested no debugging info. - ACE_Log_Msg::disable_debug_messages (); - } - - // Become a daemon before doing anything else. - if (ACE_Service_Config::be_a_daemon_) - ACE_Service_Config::start_daemon (); - - // Write process id to file. - if (ACE_Service_Config::pid_file_name_ != 0) - { - FILE* pidf = ACE_OS::fopen (ACE_Service_Config::pid_file_name_, - ACE_LIB_TEXT("w")); - - if (pidf != 0) - { - ACE_OS::fprintf (pidf, - "%ld\n", - static_cast<long> (ACE_OS::getpid())); - ACE_OS::fclose (pidf); - } - } - - u_long flags = log_msg->flags (); - - if (flags == 0) - // Only use STDERR if the caller hasn't already set the flags. - flags = (u_long) ACE_Log_Msg::STDERR; - - const ACE_TCHAR *key = logger_key; - - if (key == 0 || ACE_OS::strcmp (key, ACE_DEFAULT_LOGGER_KEY) == 0) - // Only use the static <logger_key_> if the caller doesn't - // override it in the parameter list or if the key supplied is - // equal to the default static logger key. - key = ACE_Service_Config::logger_key_; - else - ACE_SET_BITS (flags, ACE_Log_Msg::LOGGER); - - if (log_msg->open (program_name, - flags, - key) == -1) - result = -1; - else - { - if (ACE::debug ()) - ACE_DEBUG ((LM_STARTUP, - ACE_LIB_TEXT ("starting up daemon %n\n"))); - - // Initialize the Service Repository (this will still work if - // user forgets to define an object of type ACE_Service_Config). - ACE_Service_Repository::instance (ACE_Service_Config::MAX_SERVICES); - - // Initialize the ACE_Reactor (the ACE_Reactor should be the - // same size as the ACE_Service_Repository). - ACE_Reactor::instance (); - - // There's no point in dealing with this on NT since it doesn't - // really support signals very well... -#if !defined (ACE_LACKS_UNIX_SIGNALS) - // Only attempt to register a signal handler for positive - // signal numbers. - if (ACE_Service_Config::signum_ > 0) - if (ACE_Reactor::instance ()->register_handler - (ACE_Service_Config::signum_, - ACE_Service_Config::signal_handler_) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("can't register signal handler\n"))); -#endif /* ACE_LACKS_UNIX_SIGNALS */ - - // See if we need to load the static services. - if (ACE_Service_Config::no_static_svcs_ == 0 - && ACE_Service_Config::load_static_svcs () == -1) - result = -1; - else - { - if (ACE_Service_Config::process_commandline_directives () == -1) - result = -1; - else - result = ACE_Service_Config::process_directives (); - } - } - - { - // Make sure to save/restore errno properly. - ACE_Errno_Guard error (errno); - - if (ignore_debug_flag == 0) - { - // Reset debugging back to the way it was when we came into - // into <open_i>. - log_msg->priority_mask (old_process_mask, ACE_Log_Msg::PROCESS); - log_msg->priority_mask (old_thread_mask, ACE_Log_Msg::THREAD); - } - } - - return result; -} ACE_Service_Config::ACE_Service_Config (const ACE_TCHAR program_name[], const ACE_TCHAR *logger_key) @@ -838,25 +513,7 @@ ACE_Service_Config::reconfigure (void) int ACE_Service_Config::close (void) { - ACE_TRACE ("ACE_Service_Config::close"); - - ACE_Service_Config::is_initialized_--; - if (ACE_Service_Config::is_initialized_ > 0) - return 0; - - // Delete the service repository. All the objects inside the - // service repository should already have been finalized. - ACE_Service_Config::close_svcs (); - - // Delete the list fo svc.conf files - delete ACE_Service_Config::svc_conf_file_queue_; - ACE_Service_Config::svc_conf_file_queue_ = 0; - - // Delete the dynamically allocated static_svcs instance. - delete ACE_Service_Config::static_svcs_; - ACE_Service_Config::static_svcs_ = 0; - - return 0; + return ACE_Service_Config::current ()->close (); } int @@ -912,20 +569,6 @@ ACE_Service_Config::reconfig_occurred (int config_occurred) ACE_Service_Config::reconfig_occurred_ = config_occurred; } -// Become a daemon (i.e., run as a "background" process). - -int -ACE_Service_Config::start_daemon (void) -{ - ACE_TRACE ("ACE_Service_Config::start_daemon"); - return ACE::daemonize (); -} +// ************************************************************ ACE_END_VERSIONED_NAMESPACE_DECL - -// All the factory functions that allocate default statically linked -// services should be placed below. - -// Allocate a Service Manager. - -ACE_FACTORY_DEFINE (ACE, ACE_Service_Manager) diff --git a/ace/Service_Config.h b/ace/Service_Config.h index 6fafb50408b..82b988d69d6 100644 --- a/ace/Service_Config.h +++ b/ace/Service_Config.h @@ -17,13 +17,12 @@ #include "ace/config-all.h" #include "ace/Default_Constants.h" +#include "ace/Service_Gestalt.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/Unbounded_Queue.h" -#include "ace/Unbounded_Set.h" #include "ace/SString.h" #include "ace/OS_NS_signal.h" @@ -134,20 +133,8 @@ public: bool operator!= (ACE_Static_Svc_Descriptor &) const; }; -// Maintain a set of the statically linked service descriptors. -typedef ACE_Unbounded_Set<ACE_Static_Svc_Descriptor *> - ACE_STATIC_SVCS; -typedef ACE_Unbounded_Set_Iterator<ACE_Static_Svc_Descriptor *> - ACE_STATIC_SVCS_ITERATOR; - -// Maintain a queue of services to be configured from the -// command-line. -typedef ACE_Unbounded_Queue<ACE_TString> - ACE_SVC_QUEUE; -typedef ACE_Unbounded_Queue_Iterator<ACE_TString> - ACE_SVC_QUEUE_ITERATOR; - #define ACE_Component_Config ACE_Service_Config + /** * @class ACE_Service_Config * @@ -155,7 +142,22 @@ typedef ACE_Unbounded_Queue_Iterator<ACE_TString> * configuration of services. * * The ACE_Service_Config uses the Monostate pattern. Therefore, - * you can only have one of these instantiated per-process. + * you can only have one of these instantiated per-process. It + * represents the process-wide collection of services, which is + * typicaly shared among all other configurable entities. The only + * ACE_Service_Config instance is registered with and owned by the + * ACE_Object_Manager. + * + * By contrast, the ACE_Service_Gestalt represents the collection + * of services, pertaining to a configurable entity. Typicaly, a + * "configurable entity" is an instance, which owns an instance of + * ACE_Service_Gestalt in order to ensure full controll over the + * services it needs. + * + * Another facet of ACE_Service_Config is that for a given thread, + * it provides access to its current, process-global + * ACE_Service_Gestalt instance through its curent() method. + * * @note The signal_handler_ static member is allocated by the * ACE_Object_Manager. The ACE_Service_Config constructor * uses signal_handler_. Therefore, if the program has any @@ -164,13 +166,9 @@ typedef ACE_Unbounded_Queue_Iterator<ACE_TString> * not eliminated, by _not_ #defining * ACE_HAS_NONSTATIC_OBJECT_MANAGER. */ -class ACE_Export ACE_Service_Config +class ACE_Export ACE_Service_Config: public ACE_Service_Gestalt { public: - enum - { - MAX_SERVICES = ACE_DEFAULT_SERVICE_REPOSITORY_SIZE - }; // = Initialization and termination methods. @@ -180,7 +178,7 @@ public: * registered when the repository is opened. */ ACE_Service_Config (int ignore_static_svcs = 1, - size_t size = ACE_Service_Config::MAX_SERVICES, + size_t size = ACE_Service_Gestalt::MAX_SERVICES, int signum = SIGHUP); /** @@ -191,9 +189,19 @@ public: ACE_Service_Config (const ACE_TCHAR program_name[], const ACE_TCHAR *logger_key = ACE_DEFAULT_LOGGER_KEY); + /// Perform user-specified close activities and remove dynamic + /// memory. + virtual ~ACE_Service_Config (void); + + +protected: + /** - * Performs an open without parsing command-line arguments. The - * @a logger_key indicates where to write the logging output, which + * Performs an open without parsing command-line arguments. + * Implements whats different in the opening sequence + * for this class, as opposed to the base class. + * + * The @a logger_key indicates where to write the logging output, which * is typically either a STREAM pipe or a socket address. If * @a ignore_default_svc_conf_file is non-0 then the "svc.conf" file * will be ignored. If @a ignore_debug_flag is non-0 then the @@ -201,12 +209,56 @@ public: * @c ACE_Log_Msg::priority_mask() appropriately. Returns number of * errors that occurred on failure and 0 otherwise. */ - static int open_i (const ACE_TCHAR program_name[], - const ACE_TCHAR *logger_key = ACE_DEFAULT_LOGGER_KEY, - int ignore_default_svc_conf_file = 0, - int ignore_debug_flag = 0); + virtual int open_i (const ACE_TCHAR program_name[], + const ACE_TCHAR *logger_key, + bool ignore_static_svcs, + bool ignore_default_svc_conf_file, + bool ignore_debug_flag); /** + * Implements whats different in the command line parameter processing + * for this class, as opposed to the base class. + */ + virtual int parse_args_i (int argc, ACE_TCHAR *argv[]); + + + + /// = Static interfaces + + + +protected: + + /// Mutator to set the (TSS) global instance. Intended for use by helper + /// classes, like ACE_Service_Config_Guard which when instantiated on the + /// stack, can temporarily change which gestalt instance is viewed as + /// global from the point of view of the static initializers in DLLs. + static int current (ACE_Service_Gestalt*); + + +public: + + /// If not yet initialized, creates a process-wide instance + /// global instance, which is registered with the ACE_Object_Manager, + /// via ACE_Singleton. Note that this is allways the same instance, + /// in contrast with current (), which may be different instance at + /// different times, dependent on the context. + static ACE_Service_Gestalt* global (void); + + + /// Accessor for the "current" service repository through a pointer + /// held in TSS. + static ACE_Service_Gestalt* current (void); + + /// This is what the static service initializators are hard-wired + /// to use, so in order to keep interface changes to a minimum this + /// method merely forwards to current(). Thus it is possible to + /// temporarily replace what those initializers think is the global + /// service repository, for instance when dynamically loading a + /// service from a DLL, which in turn, contains its own static services. + static ACE_Service_Gestalt* instance (void); + + /** * Performs an open without parsing command-line arguments. The * @a logger_key indicates where to write the logging output, which * is typically either a STREAM pipe or a socket address. If @@ -283,10 +335,6 @@ public: int ignore_default_svc_conf_file = 0, int ignore_debug_flag = 0); - /// Perform user-specified close activities and remove dynamic - /// memory. - virtual ~ACE_Service_Config (void); - /// Tidy up and perform last rites when ACE_Service_Config is shut /// down. This method calls <close_svcs>. Returns 0. static int close (void); @@ -315,11 +363,31 @@ public: // semantics for the Reactor, Service_Repository, Thread_Manager, // and Acceptor/Connector Strategy factory. Other portions of the // system may need to access them at some point or another... + + // = This is not strictly needed, anymore since the service configurator + // has been refactored to allow multiple service configuration + // instances (called gestalts). The interfaces, however were retained in for + // the sake of maintaining source-code compatibility. + // = Accessors and mutators for process-wide Singletons. /// Returns a pointer to the list of statically linked services. - static ACE_STATIC_SVCS *static_svcs (void); + /// + /// @deprecated - Same as instance(), but still useful in legacy code, + /// (notably, one that can not be easily modified) which uses the following + /// idiom for registering static services: + /// + /// ACE_Service_Config::static_svcs ()->insert (...); + static ACE_Service_Gestalt *static_svcs (void); + + /// Insert a static service descriptor for processing on open_i(). The + /// corresponding ACE_STATIC_SVC_* macros were chaged to use this method + /// instead of obtaining a ptr to a container. See the note on static_svcs(). + /// Added to prevent exposing the internal storage representation of the + /// services repository and provide a better way of debugging service + /// loading and registration problems. + static int insert (ACE_Static_Svc_Descriptor *svc); // = Utility methods. /// Dynamically link the shared object file and retrieve a pointer to @@ -352,11 +420,11 @@ public: #if defined (ACE_HAS_WINCE) && defined (ACE_USES_WCHAR) // We must provide these function to bridge the Svc_Conf parser // with ACE. - static int initialize (const ACE_Service_Type *, char parameters[]); - static int initialize (const char svc_name[], char parameters[]); - static int resume (const char svc_name[]); - static int suspend (const char svc_name[]); - static int remove (const char svc_name[]); + static int initialize (const ACE_Service_Type *, ACE_ANTI_TCHAR []); + static int initialize (const char svc_name[], ACE_ANTI_TCHAR parameters[]); + static int resume (const ACE_ANTI_TCHAR svc_name[]); + static int suspend (const ACE_ANTI_TCHAR svc_name[]); + static int remove (const ACE_ANTI_TCHAR svc_name[]); #endif /* ACE_HAS_WINCE */ /// Dump the state of an object. @@ -426,12 +494,15 @@ public: int active); #endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */ - static ACE_Service_Type_Impl *create_service_type_impl (const ACE_TCHAR *name, - int type, - void *symbol, - u_int flags, - ACE_Service_Object_Exterminator gobbler); + static ACE_Service_Type_Impl * + create_service_type_impl (const ACE_TCHAR *name, + int type, + void *symbol, + u_int flags, + ACE_Service_Object_Exterminator gobbler); + protected: + /// Process service configuration requests that were provided on the /// command-line. Returns the number of errors that occurred. static int process_commandline_directives (void); @@ -442,7 +513,8 @@ protected: /// that occurred. static int process_directives_i (ACE_Svc_Conf_Param *param); #else - /// Helper function to dynamically link in the XML Service Configurator parser. + /// Helper function to dynamically link in the XML Service Configurator + /// parser. static ACE_XML_Svc_Conf *get_xml_svc_conf (ACE_DLL &d); #endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ @@ -453,23 +525,8 @@ protected: /// ACE_Service_Repository. static int load_static_svcs (void); + private: - /// Indicates where to write the logging output. This is typically - /// either a STREAM pipe or a socket address. - static const ACE_TCHAR *logger_key_; - - /// Singleton repository of statically linked services. - static ACE_STATIC_SVCS *static_svcs_; - - /// Queue of services specified on the command-line. - static ACE_SVC_QUEUE *svc_queue_; - - /// Queue of svc.conf files specified on the command-line. - /// @@ This should probably be made to handle unicode filenames... - static ACE_SVC_QUEUE *svc_conf_file_queue_; - - /// Initialize the <svc_conf_file_queue_> if necessary. - static int init_svc_conf_file_queue (void); /// True if reconfiguration occurred. static sig_atomic_t reconfig_occurred_; @@ -481,25 +538,63 @@ private: /// Pathname of file to write process id. static ACE_TCHAR *pid_file_name_; - /// Should we avoid loading the static services? - static int no_static_svcs_; - /// Number of the signal used to trigger reconfiguration. static int signum_; /// Handles the reconfiguration signals. static ACE_Sig_Adapter *signal_handler_; - /** - * Keep track of whether the ACE_Service_Config is already - * initialized. If so, we can't allow <yyparse> to be called since - * it's not reentrant. This variable is incremented by the - * <ACE_Service_Config::open> method and decremented by the - * <ACE_Service_Config::close> method. - */ - static int is_initialized_; + /// Pointer to the Singleton (ACE_Cleanup) Gestalt instance. + /// There is thread-specific global instance pointer, which is used to + /// temporarily change which Gestalt instance is used for static service + /// registrations. + /// + /// A specific use case is a thread, which loads a _dynamic_ service from + /// a DLL. If the said DLL also contains additional _static_ services, + /// those *must* be registered with the same configuration repository as + /// the dynamic service. Otherwise, the DLL's static services would be + /// registered with the global Gestalt and may outlive the DLL that + /// contains their code and perhaps the memory in which they are in. + /// This is a problem because if the DLL gets unloaded (as it will, if + /// it was loaded in an instance of Gestalt), the DLL's memory will be + /// deallocated, but the global service repository will still "think" + /// it must finalize the (DLL's) static services - with disastrous + /// consequences, occurring in the post-main code (at_exit()). + static ACE_TSS< ACE_TSS_Type_Adapter <ACE_Service_Gestalt*> > current_; + + /// This class needs the intimate access to be able to swap the + /// current TSS pointer for the global Gestalt. + friend class ACE_Service_Config_Guard; + +}; + +/** + * @class ACE_Service_Config_Guard + * + * @brief A guard class, designed to be instantiated on the stack. + * + * Instantiating it with a specific configuration ensures any references to + * ACE_Service_Config::instance(), even when occuring in static constructors, + * will allways access the designated configuration instance. + * This comes very handy when a dynamic service also registers any static + * services of its own and their static factories. + */ +class ACE_Export ACE_Service_Config_Guard +{ +public: + ACE_Service_Config_Guard (ACE_Service_Gestalt * psg); + ~ACE_Service_Config_Guard (void); + +private: + // Private AND not implemented to disable copying + ACE_Service_Config_Guard(const ACE_Service_Config_Guard&); + ACE_Service_Config_Guard& operator= (const ACE_Service_Config_Guard&); + +private: + ACE_Service_Gestalt* saved_; }; + ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) diff --git a/ace/Service_Config.inl b/ace/Service_Config.inl index 4dd09e802b0..9580ccc6c4f 100644 --- a/ace/Service_Config.inl +++ b/ace/Service_Config.inl @@ -17,14 +17,14 @@ ACE_Service_Config::open (const ACE_TCHAR program_name[], int ignore_debug_flag) { ACE_TRACE ("ACE_Service_Config::open"); - ACE_Service_Config::no_static_svcs_ = ignore_static_svcs; - - return ACE_Service_Config::open_i (program_name, + return ACE_Service_Config::current()->open (program_name, logger_key, + ignore_static_svcs, ignore_default_svc_conf, ignore_debug_flag); } + ACE_INLINE int ACE_Service_Config::open (int argc, ACE_TCHAR *argv[], @@ -34,18 +34,23 @@ ACE_Service_Config::open (int argc, int ignore_debug_flag) { ACE_TRACE ("ACE_Service_Config::open"); - ACE_Service_Config::no_static_svcs_ = ignore_static_svcs; - - if (ACE_Service_Config::parse_args (argc, - argv) == -1) - return -1; - else - return ACE_Service_Config::open_i (argv[0], + return ACE_Service_Config::current()->open (argc, + argv, logger_key, + ignore_static_svcs, ignore_default_svc_conf, ignore_debug_flag); } +// Handle the command-line options intended for the +// ACE_Service_Config. + +ACE_INLINE int +ACE_Service_Config::parse_args (int argc, ACE_TCHAR *argv[]) +{ + return ACE_Service_Config::current ()->parse_args (argc, argv); +} + // Compare two service descriptors for equality. ACE_INLINE bool @@ -68,36 +73,83 @@ ACE_Service_Config::signal_handler (ACE_Sig_Adapter *signal_handler) signal_handler_ = signal_handler; } +// Initialize and activate a statically linked service. + +ACE_INLINE int +ACE_Service_Config::initialize (const ACE_TCHAR *svc_name, + const ACE_TCHAR *parameters) +{ + ACE_TRACE ("ACE_Service_Config::initialize"); + return ACE_Service_Config::current ()->initialize (svc_name, + parameters); +} + +// Dynamically link the shared object file and retrieve a pointer to +// the designated shared object in this file. + +ACE_INLINE int +ACE_Service_Config::initialize (const ACE_Service_Type *sr, + const ACE_TCHAR *parameters) +{ + ACE_TRACE ("ACE_Service_Config::initialize"); + return ACE_Service_Config::current ()->initialize (sr, + parameters); +} + + +ACE_INLINE int +ACE_Service_Config::process_directive (const ACE_TCHAR directive[]) +{ + return ACE_Service_Config::current ()->process_directive (directive); +} + +// Process service configuration requests as indicated in the queue of +// svc.conf files. +ACE_INLINE int +ACE_Service_Config::process_directives (void) +{ + return ACE_Service_Config::current ()->process_directives (); +} + +ACE_INLINE int +ACE_Service_Config::process_directive (const ACE_Static_Svc_Descriptor &ssd, + int force_replace) +{ + return ACE_Service_Config::current ()->process_directive (ssd, + force_replace); +} + + #if defined (ACE_HAS_WINCE) && defined (ACE_USES_WCHAR) // We must provide these function to bridge Svc_Conf parser with ACE. ACE_INLINE int -ACE_Service_Config::initialize (const ACE_Service_Type *sp, char parameters[]) +ACE_Service_Config::initialize (const ACE_Service_Type *sp, ACE_ANTI_TCHAR parameters[]) { return ACE_Service_Config::initialize (sp, ACE_TEXT_TO_TCHAR_IN (parameters)); } ACE_INLINE int -ACE_Service_Config::initialize (const char svc_name[], char parameters[]) +ACE_Service_Config::initialize (const ACE_ANTI_TCHAR svc_name[], ACE_ANTI_TCHAR parameters[]) { return ACE_Service_Config::initialize (ACE_TEXT_TO_TCHAR_IN (svc_name), ACE_TEXT_TO_TCHAR_IN (parameters)); } ACE_INLINE int -ACE_Service_Config::resume (const char svc_name[]) +ACE_Service_Config::resume (const ACE_ANTI_TCHAR svc_name[]) { return ACE_Service_Config::resume (ACE_TEXT_TO_TCHAR_IN (svc_name)); } ACE_INLINE int -ACE_Service_Config::suspend (const char svc_name[]) +ACE_Service_Config::suspend (const ACE_ANTI_TCHAR svc_name[]) { return ACE_Service_Config::suspend (ACE_TEXT_TO_TCHAR_IN (svc_name)); } ACE_INLINE int -ACE_Service_Config::remove (const char svc_name[]) +ACE_Service_Config::remove (const ACE_ANTI_TCHAR svc_name[]) { return ACE_Service_Config::remove (ACE_TEXT_TO_TCHAR_IN (svc_name)); } diff --git a/ace/Service_Gestalt.cpp b/ace/Service_Gestalt.cpp index 456958ac732..28efeb2c21e 100644 --- a/ace/Service_Gestalt.cpp +++ b/ace/Service_Gestalt.cpp @@ -98,13 +98,7 @@ ACE_Service_Type_Forward_Declaration_Guard::~ACE_Service_Type_Forward_Declaratio int ret = this->repo_->find (this->name_, &tmp, 0); // We inserted it (as inactive), so we expect to find it, right? - if (ret < 0 && ret != -2) - { - ACE_ERROR ((LM_WARNING, - ACE_LIB_TEXT ("(%P|%t) FWDCL::end - Failed (%d) to find %s\n"), - ret, this->name_)); - ACE_ASSERT (ret == -2 || ret >= 0); - } + ACE_ASSERT (ret = -2 || ret >= 0); if (tmp != 0 && tmp->type () != 0) { diff --git a/ace/Service_Object.cpp b/ace/Service_Object.cpp index 00de5f6e056..87d5b655151 100644 --- a/ace/Service_Object.cpp +++ b/ace/Service_Object.cpp @@ -26,6 +26,18 @@ ACE_Service_Type::dump (void) const #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_Service_Type::dump"); #endif /* ACE_HAS_DUMP */ + + + // Using printf, since the log facility may not have + // been initialized yet + ACE_OS::fprintf(stderr, + "// [ST] dump, this=%p, name=%s, type=%p, so=%p, active=%d\n", + this, + this->name_, + this->type_, + (this->type_ != 0) ? this->type_->object () : 0, + this->active_); + } ACE_Service_Type::ACE_Service_Type (const ACE_TCHAR *n, @@ -60,7 +72,6 @@ ACE_Service_Type::ACE_Service_Type (const ACE_TCHAR *n, ACE_Service_Type::~ACE_Service_Type (void) { ACE_TRACE ("ACE_Service_Type::~ACE_Service_Type"); - this->fini (); delete [] const_cast <ACE_TCHAR *> (this->name_); @@ -72,7 +83,15 @@ ACE_Service_Type::fini (void) if (!this->fini_already_called_) { this->fini_already_called_ = 1; + if (this->type_ != 0) return this->type_->fini (); + else + return 1; // No implementation was found. + // Currently only makes sense for dummy ST, used to "reserve" + // a spot (kind of like forward-declarations) for a dynamic + // service. This is necessary to help enforce the correct + // finalization order, when such service also has any + // (dependent) static services } return 0; } diff --git a/ace/Service_Object.h b/ace/Service_Object.h index 6101372c5f1..c206db17261 100644 --- a/ace/Service_Object.h +++ b/ace/Service_Object.h @@ -24,9 +24,12 @@ #include "ace/Event_Handler.h" #include "ace/DLL.h" +#include "ace/Service_Gestalt.h" + ACE_BEGIN_VERSIONED_NAMESPACE_DECL #define ACE_Component ACE_Service_Object + /** * @class ACE_Service_Object * @@ -38,7 +41,9 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL * ACE_Event_Handler, as well as being dynamically linked by * the ACE_Service_Config (due to the <ACE_Shared_Object>). */ -class ACE_Export ACE_Service_Object : public ACE_Event_Handler, public ACE_Shared_Object +class ACE_Export ACE_Service_Object + : public ACE_Event_Handler, + public ACE_Shared_Object { public: // = Initialization and termination methods. @@ -101,8 +106,10 @@ public: void name (const ACE_TCHAR *); const ACE_Service_Type_Impl *type (void) const; - void type (const ACE_Service_Type_Impl *, - int active = 1); + void type (const ACE_Service_Type_Impl *, int active = 1); + + // Is this just a stub for the real thing? + bool is_forward_declaration (void) const; int suspend (void) const; int resume (void) const; @@ -118,6 +125,9 @@ public: /// Dump the state of an object. void dump (void) const; + /// Get to the DLL's implentation + const ACE_DLL & dll () const; + /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; @@ -128,7 +138,8 @@ private: /// Pointer to C++ object that implements the svc. const ACE_Service_Type_Impl *type_; - /// ACE_DLL representing the shared object file (non-zero if dynamically linked). + /// ACE_DLL representing the shared object file (non-zero if + /// dynamically linked). mutable ACE_DLL dll_; /// 1 if svc is currently active, otherwise 0. diff --git a/ace/Service_Object.inl b/ace/Service_Object.inl index 23eb323085f..a675d4e942b 100644 --- a/ace/Service_Object.inl +++ b/ace/Service_Object.inl @@ -63,5 +63,10 @@ ACE_Service_Type::fini_called (void) const return this->fini_already_called_; } +ACE_INLINE const ACE_DLL & ACE_Service_Type::dll () const +{ + return this->dll_; +} + ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Service_Repository.cpp b/ace/Service_Repository.cpp index 81feb3b233e..875dceb9842 100644 --- a/ace/Service_Repository.cpp +++ b/ace/Service_Repository.cpp @@ -10,6 +10,7 @@ #include "ace/Object_Manager.h" #include "ace/Log_Msg.h" #include "ace/ACE.h" +#include "ace/OS_NS_unistd.h" #include "ace/OS_NS_errno.h" #include "ace/OS_NS_string.h" @@ -67,6 +68,7 @@ ACE_Service_Repository::instance (int size /* = ACE_Service_Repository::DEFAULT_ } } + // ACE_ASSERT (ACE_Service_Repository::svc_rep_ != 0); return ACE_Service_Repository::svc_rep_; } @@ -149,16 +151,28 @@ ACE_Service_Repository::fini (void) // order. for (int i = this->current_size_ - 1; i >= 0; i--) + { + ACE_Service_Type *s = + const_cast<ACE_Service_Type *> (this->service_vector_[i]); + + if (ACE::debug ()) { - if (ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("finalizing %s\n"), - this->service_vector_[i]->name ())); - ACE_Service_Type *s = - const_cast<ACE_Service_Type *> (this->service_vector_[i]); - // Collect errors. - retval += s->fini (); + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%P|%t) SR::fini, %@ [%d] (%d): "), + this, i, this->total_size_)); + s->dump(); } + + // Collect any errors. + int ret = s->fini (); + if (ACE::debug ()>1) + { + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%P|%t) SR::fini, returned %d\n"), + ret)); + } + retval += ret; + } } return (retval == 0) ? 0 : -1; @@ -180,8 +194,22 @@ ACE_Service_Repository::close (void) // compaction. However, the common case is not to remove // services, so typically they are deleted in reverse order. + if(ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%P|%t) SR::close, this=%@, size=%d\n"), + this, + this->current_size_)); + for (int i = this->current_size_ - 1; i >= 0; i--) { + if(ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%P|%t) SR::close, this=%@, delete so[%d]=%@ (%s)\n"), + this, + i, + this->service_vector_[i], + this->service_vector_[i]->name ())); + ACE_Service_Type *s = const_cast<ACE_Service_Type *> (this->service_vector_[i]); --this->current_size_; delete s; @@ -198,6 +226,8 @@ ACE_Service_Repository::close (void) ACE_Service_Repository::~ACE_Service_Repository (void) { ACE_TRACE ("ACE_Service_Repository::~ACE_Service_Repository"); + if(ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, "(%P|%t) SR::<dtor>, this=%@\n", this)); this->close (); } @@ -211,7 +241,7 @@ ACE_Service_Repository::~ACE_Service_Repository (void) int ACE_Service_Repository::find_i (const ACE_TCHAR name[], const ACE_Service_Type **srp, - int ignore_suspended) + int ignore_suspended) const { ACE_TRACE ("ACE_Service_Repository::find_i"); int i; @@ -244,7 +274,7 @@ ACE_Service_Repository::find_i (const ACE_TCHAR name[], int ACE_Service_Repository::find (const ACE_TCHAR name[], const ACE_Service_Type **srp, - int ignore_suspended) + int ignore_suspended) const { ACE_TRACE ("ACE_Service_Repository::find"); ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1)); @@ -254,16 +284,20 @@ ACE_Service_Repository::find (const ACE_TCHAR name[], // Insert the ACE_Service_Type SR into the repository. Note that -// services may be inserted either resumed or suspended. +// services may be inserted either resumed or suspended. Using same name +// as in an existing service causes the delete () to be called for the old one, +// i.e. make sure @code sr is allocated on the heap! int ACE_Service_Repository::insert (const ACE_Service_Type *sr) { ACE_TRACE ("ACE_Service_Repository::insert"); + int return_value = -1; ACE_Service_Type *s = 0; { + // @TODO: Do we need a recursive mutex here? ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1)); int i; @@ -275,38 +309,49 @@ ACE_Service_Repository::insert (const ACE_Service_Type *sr) // Replacing an existing entry if (i < this->current_size_) + { + return_value = 0; + // Check for self-assignment... + if (sr != this->service_vector_[i]) { - // Check for self-assignment... - if (sr == this->service_vector_[i]) - { - return_value = 0; - } - else - { - s = const_cast<ACE_Service_Type *> (this->service_vector_[i]); - this->service_vector_[i] = sr; - return_value = 0; - } + s = const_cast<ACE_Service_Type *> (this->service_vector_[i]); + this->service_vector_[i] = sr; } + } // Adding a new entry. else if (i < this->total_size_) - { - this->service_vector_[i] = sr; - this->current_size_++; - return_value = 0; - } + { + this->service_vector_[i] = sr; + this->current_size_++; + return_value = 0; + } + + if (ACE::debug ()) + { + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) SR::insert, repo=%@ [%d] (size=%d): ", + this, + i, + this->total_size_)); + sr->dump(); + } } - // delete outside the lock + // Delete outside the lock if (s != 0) + { + if (ACE::debug () > 1) { - delete s; + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) SR::insert, repo=%@ - destroying : ", + this)); + s->dump(); } + delete s; + } if (return_value == -1) - { - ACE_OS::last_error (ENOSPC); - } + ACE_OS::last_error (ENOSPC); return return_value; } @@ -345,11 +390,21 @@ ACE_Service_Repository::suspend (const ACE_TCHAR name[], return this->service_vector_[i]->suspend (); } -// Completely remove a <name> entry from the Repository and -// dynamically unlink it if it was originally dynamically linked. -// Since the order of services in the Respository does not matter, we -// simply overwrite the entry being deleted with the final entry in -// the array and decrement the <current_size> by 1. + +/** + * @brief Completely remove a <name> entry from the Repository and + * dynamically unlink it if it was originally dynamically linked. + * + * Since the order of services in the Respository matters, we can't + * simply overwrite the entry being deleted with the last and + * decrement the <current_size> by 1 - we must "pack" the array. A + * good example of why the order matters is a dynamic service, in + * whose DLL there is at least one static service. In order to prevent + * SEGV during finalization, those static services must be finalized + * _before_the dynamic service that owns them. Otherwice the TEXT + * segment, containing the code for the static service's desructor may + * be unloaded with the DLL. + */ int ACE_Service_Repository::remove (const ACE_TCHAR name[], ACE_Service_Type **ps) @@ -360,16 +415,19 @@ ACE_Service_Repository::remove (const ACE_TCHAR name[], ACE_Service_Type **ps) ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1)); int i = this->find_i (name, 0, 0); + // Not found if (i == -1) return -1; + // We need the old ptr to be delete outside the lock s = const_cast<ACE_Service_Type *> (this->service_vector_[i]); - --this->current_size_; - if (this->current_size_ >= 1) - this->service_vector_[i] - = this->service_vector_[this->current_size_]; + // Pack the array + --this->current_size_; + for (int j = i; j < this->current_size_; j++) + this->service_vector_[j] = this->service_vector_[j+1]; } + if (ps != 0) *ps = s; else diff --git a/ace/Service_Repository.h b/ace/Service_Repository.h index 1bda4000913..a8c677e7599 100644 --- a/ace/Service_Repository.h +++ b/ace/Service_Repository.h @@ -77,7 +77,8 @@ public: int fini (void); /// Get pointer to a process-wide ACE_Service_Repository. - static ACE_Service_Repository *instance (int size = ACE_Service_Repository::DEFAULT_SIZE); + static ACE_Service_Repository * + instance (int size = ACE_Service_Repository::DEFAULT_SIZE); /// Set pointer to a process-wide ACE_Service_Repository and return /// existing pointer. @@ -88,8 +89,8 @@ public: // = Search structure operations (all acquire locks as necessary). - /// Insert a new service record. Returns -1 when the service repository is full - /// and 0 on success. + /// Insert a new service record. Returns -1 when the service repository + /// is full and 0 on success. int insert (const ACE_Service_Type *); /** @@ -102,7 +103,7 @@ public: */ int find (const ACE_TCHAR name[], const ACE_Service_Type **srp = 0, - int ignore_suspended = 1); + int ignore_suspended = 1) const; /// Remove an existing service record. If @a sr == 0, the service record /// is deleted before control is returned to the caller. If @a sr != 0, @@ -135,7 +136,7 @@ private: /// held... int find_i (const ACE_TCHAR service_name[], const ACE_Service_Type ** = 0, - int ignore_suspended = 1); + int ignore_suspended = 1) const; /// Contains all the configured services. const ACE_Service_Type **service_vector_; @@ -154,7 +155,7 @@ private: #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) /// Synchronization variable for the MT_SAFE Repository - ACE_Recursive_Thread_Mutex lock_; + mutable ACE_Recursive_Thread_Mutex lock_; #endif /* ACE_MT_SAFE */ }; diff --git a/ace/Service_Types.cpp b/ace/Service_Types.cpp index 35140d29d4e..fec79c53824 100644 --- a/ace/Service_Types.cpp +++ b/ace/Service_Types.cpp @@ -103,6 +103,15 @@ ACE_Service_Object_Type::init (int argc, ACE_TCHAR *argv[]) const ACE_Service_Object * const so = static_cast<ACE_Service_Object *> (obj); + if (ACE::debug () > 2) + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%P|%t) SOT::init, this=%@, ") + ACE_LIB_TEXT ("name=%s, flags=%d, so=%@\n"), + this, + this->name_, + this->flags_, + obj)); + if (so == 0) return -1; else @@ -116,6 +125,15 @@ ACE_Service_Object_Type::fini (void) const void * const obj = this->object (); + if (ACE::debug () > 2) + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%P|%t) SOT::fini - this=%@, ") + ACE_LIB_TEXT ("name=%s, flags=%d, so=%@\n"), + this, + this->name_, + this->flags_, + obj)); + ACE_Service_Object * const so = static_cast<ACE_Service_Object *> (obj); @@ -123,6 +141,7 @@ ACE_Service_Object_Type::fini (void) const { so->fini (); + // @TODO: Why is this disabled? #if 0 if (ACE_BIT_ENABLED (this->flags_, ACE_Service_Type::DELETE_OBJ)) @@ -455,5 +474,6 @@ ACE_Stream_Type::find (const ACE_TCHAR *mod_name) const return 0; } +// @@@ Eliminated ommented out explicit template instantiation code ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Sock_Connect.cpp b/ace/Sock_Connect.cpp index e0ff264da00..e2b316e1097 100644 --- a/ace/Sock_Connect.cpp +++ b/ace/Sock_Connect.cpp @@ -1101,7 +1101,7 @@ ACE::get_ip_interfaces (size_t &count, return 0; -#elif defined (__unix) || defined (__unix__) || defined (__Lynx__) || defined (_AIX) || (defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600)) +#elif defined (__unix) || defined (__unix__) || defined (__Lynx__) || defined (_AIX) || (defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600)) || defined (ACE_OPENVMS) // COMMON (SVR4 and BSD) UNIX CODE size_t num_ifs, num_ifs_found; @@ -1370,7 +1370,7 @@ ACE::count_interfaces (ACE_HANDLE handle, size_t &how_many) how_many = num_ifs; return 0; -#elif defined (__unix) || defined (__unix__) || defined (__Lynx__) || defined (_AIX) || (defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600)) +#elif defined (__unix) || defined (__unix__) || defined (__Lynx__) || defined (_AIX) || (defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600)) || defined (ACE_OPENVMS) // Note: DEC CXX doesn't define "unix". BSD compatible OS: HP UX, // AIX, SunOS 4.x perform some ioctls to retrieve ifconf list of // ifreq structs no SIOCGIFNUM on SunOS 4.x, so use guess and scan @@ -1479,7 +1479,7 @@ ACE::get_handle (void) ACE_HANDLE handle = ACE_INVALID_HANDLE; #if defined (sparc) && ! defined (CHORUS) handle = ACE_OS::open ("/dev/udp", O_RDONLY); -#elif defined (__unix) || defined (__unix__) || defined (__Lynx__) || defined (_AIX) || (defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600)) +#elif defined (__unix) || defined (__unix__) || defined (__Lynx__) || defined (_AIX) || (defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600)) || defined (ACE_OPENVMS) // Note: DEC CXX doesn't define "unix" BSD compatible OS: HP UX, // AIX, SunOS 4.x diff --git a/ace/Strategies_T.h b/ace/Strategies_T.h index 8171bf8b07f..b9e7e6b9139 100644 --- a/ace/Strategies_T.h +++ b/ace/Strategies_T.h @@ -414,13 +414,13 @@ protected: * @class ACE_Process_Strategy * * @brief Defines the interface for specifying a concurrency strategy - * for a <SVC_HANDLER> based on multiprocessing. + * for a @c SVC_HANDLER based on multiprocessing. * * This class provides a strategy that manages the creation of * processes to handle requests from clients concurrently using a * process-per-connection model. It behaves as a "process factory", - * using <ACE::fork> to fork threads "on-demand" to run the service - * specified by a user-supplied <SVC_HANDLER> in a separate process. + * using @c ACE::fork() to fork threads "on-demand" to run the service + * specified by a user-supplied @c SVC_HANDLER in a separate process. */ template <class SVC_HANDLER> class ACE_Process_Strategy : public ACE_Concurrency_Strategy<SVC_HANDLER> @@ -432,15 +432,15 @@ public: // = Intialization and termination methods. - /// Initialize the strategy. If <avoid_zombies> is non-0 then set a - /// flag to <ACE::fork> to avoid zombies. + /// Initialize the strategy. If @a avoid_zombies is non-0 then set a + /// flag to ACE::fork() to avoid zombies. ACE_Process_Strategy (size_t n_processes = 1, ACE_Event_Handler *acceptor = 0, ACE_Reactor * = 0, int avoid_zombies = 0); - /// Initialize the strategy. If <avoid_zombies> is non-0 then set a - /// flag to <ACE::fork> to avoid zombies. + /// Initialize the strategy. If @a avoid_zombies is non-0 then set a + /// flag to ACE::fork() to avoid zombies. virtual int open (size_t n_processes = 1, ACE_Event_Handler *acceptor = 0, ACE_Reactor * = 0, @@ -450,9 +450,9 @@ public: // = Factory method. /** - * Activate the <svc_handler> with an appropriate concurrency + * Activate the @a svc_handler with an appropriate concurrency * strategy. This method activates the SVC_HANDLER by first forking - * and then calling the <open> method of the SVC_HANDLER in the + * and then calling the @c open() method of the SVC_HANDLER in the * child. */ virtual int activate_svc_handler (SVC_HANDLER *svc_handler, @@ -471,15 +471,15 @@ protected: size_t n_processes_; /** - * This is the <Acceptor> in the parent is listening on. We need to + * This is the @c Acceptor in the parent is listening on. We need to * make sure that we remove it from the Reactor and close it down in * the child. */ ACE_Event_Handler *acceptor_; /** - * This is the <Reactor> the child is using in conjunction with the - * <Acceptor>. We need to remove the <Acceptor> from this <Reactor> + * This is the reactor the child is using in conjunction with the + * acceptor. We need to remove the acceptor from this reactor * in the child. */ ACE_Reactor *reactor_; @@ -509,13 +509,13 @@ public: /// Default constructor. ACE_Accept_Strategy (ACE_Reactor *reactor = ACE_Reactor::instance ()); - /// Initialize the <peer_acceptor_> with <local_addr>. + /// Initialize the @c peer_acceptor_ with @a local_addr. ACE_Accept_Strategy (const ACE_PEER_ACCEPTOR_ADDR &local_addr, int restart = 0, ACE_Reactor *reactor = ACE_Reactor::instance ()); - /// Initialize the <peer_acceptor_> with <local_addr>, indicating - /// whether to <reuse_addr> if it's already in use. + /// Initialize the <peer_acceptor_> with @a local_addr, indicating + /// whether to @a reuse_addr if it's already in use. virtual int open (const ACE_PEER_ACCEPTOR_ADDR &local_addr, int reuse_addr = 0); @@ -822,7 +822,7 @@ protected: * subsequent re-use of unused, but available, connections. * * <ACE_Cached_Connect_Strategy> is intended to be used as a - * plug-in connection strategy for <ACE_Strategy_Connector>. + * plug-in connection strategy for ACE_Strategy_Connector. * It's added value is re-use of established connections. */ template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class MUTEX> diff --git a/ace/Svc_Conf.h b/ace/Svc_Conf.h index 4c14981caa3..4a0794a9077 100644 --- a/ace/Svc_Conf.h +++ b/ace/Svc_Conf.h @@ -28,13 +28,12 @@ #include "ace/Service_Config.h" #include "ace/Parse_Node.h" +#include "ace/Svc_Conf_Param.h" + #if (ACE_USES_CLASSIC_SVC_CONF == 1) ACE_BEGIN_VERSIONED_NAMESPACE_DECL -// Forward declarations. -struct ace_yy_buffer_state; - // The following yylex() declarations require support for reentrant // parser generation (e.g. from GNU Bison). #if defined (DEBUGGING) @@ -46,98 +45,11 @@ struct ace_yy_buffer_state; #define ACE_YY_DECL extern "C" int ace_yylex (ACE_YYSTYPE *ace_yylval, void *ACE_YYLEX_PARAM) #endif /* DEBUGGING */ -extern void ace_yy_delete_buffer (ace_yy_buffer_state *buffer); - -/** - * @class ACE_Svc_Conf_Param - * - * @brief An instance of this object will be passed down to the - * yyparse() and yylex() functions. - * - * This class retains the state for a given parse/scan. It primarily - * makes it possible to hold the static object lock in the scanner - * for as short a period of time as possible. The resulting finer - * grained locking prevents deadlocks from occuring when scanning a - * `svc.conf' file and activating an ACE_Task, for example, as a - * result of processing the directives in that file. - */ -class ACE_Svc_Conf_Param -{ -public: - - enum SVC_CONF_PARAM_TYPE - { - /// The lexer will scan a file containing one or more directives. - SVC_CONF_FILE, - - /// The lexer will scan a string containing a directive. - SVC_CONF_DIRECTIVE - }; - - /// Constructor - ACE_Svc_Conf_Param (FILE *file) - : type (SVC_CONF_FILE), - yyerrno (0), - yylineno (1), - buffer (0), - obstack () - { - source.file = file; - } - - /// Constructor - ACE_Svc_Conf_Param (const ACE_TCHAR *directive) - : type (SVC_CONF_DIRECTIVE), - yyerrno (0), - yylineno (1), - buffer (0), - obstack () - { - source.directive = directive; - } - - ~ACE_Svc_Conf_Param (void) - { - ace_yy_delete_buffer (this->buffer); - } - -public: - - union - { - /// FILE stream from which directives will be scanned and parsed. - FILE *file; - - /// String containing directive that will be scanned and parsed. - const ACE_TCHAR *directive; - - } source; - - /// Discriminant use to determine which union member to use. - SVC_CONF_PARAM_TYPE type; - - /// Keeps track of the number of errors encountered so far. - int yyerrno; - - /// Keeps track of the current line number for error-handling routine. - int yylineno; - - /// Lexer buffer that corresponds to the current Service - /// Configurator file/direct scan. - ace_yy_buffer_state *buffer; - - /// Obstack used for efficient memory allocation when - /// parsing/scanning a service configurator directive. - ACE_Obstack_T<ACE_TCHAR> obstack; - -}; - -// Parameter that is passed down to the yyparse() function, and -// eventually to yylex(). -#define ACE_YYPARSE_PARAM ace_svc_conf_parameter -#define ACE_YYLEX_PARAM ACE_YYPARSE_PARAM - -#define ACE_SVC_CONF_PARAM (static_cast<ACE_Svc_Conf_Param *> (ACE_YYLEX_PARAM)) +// Forward declarations +class ACE_Location_Node; +class ACE_Parse_Node; +class ACE_Static_Node; +class ACE_Service_Type_Factory; // The following definition for the ACE_YYSTYPE must occur before // ACE_YY_DECL is declared since ACE_YY_DECL expands to function @@ -148,7 +60,7 @@ typedef union ACE_Location_Node *location_node_; ACE_Parse_Node *parse_node_; ACE_Static_Node *static_node_; - ACE_Service_Type *svc_record_; + ACE_Service_Type_Factory *svc_record_; ACE_TCHAR *ident_; } ACE_YYSTYPE; diff --git a/ace/Svc_Conf.y b/ace/Svc_Conf.y index cb159d68b2f..a3b5b7f7080 100644 --- a/ace/Svc_Conf.y +++ b/ace/Svc_Conf.y @@ -12,6 +12,8 @@ #include "ace/OS_NS_string.h" +#include "ace/ace_wchar.h" + ACE_RCSID (ace, Svc_Conf_y, "$Id$") @@ -19,18 +21,22 @@ ACE_RCSID (ace, ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Prototypes. -static ACE_Module_Type *ace_get_module (ACE_Static_Node *str_rec, - ACE_Static_Node *svc_type, - int & yyerrno); -static ACE_Module_Type *ace_get_module (ACE_Static_Node *str_rec, + +static ACE_Module_Type *ace_get_module (const ACE_Service_Type *sr, + const ACE_Service_Type *sv, + int & ace_yyerrno); + +static ACE_Module_Type *ace_get_module (const ACE_Service_Type *sr, const ACE_TCHAR *svc_name, - int & yyerrno); + int & ace_yyerrno); #define YYDEBUG_LEXER_TEXT (yytext[yyleng] = '\0', yytext) // Force the pretty debugging code to compile. // #define YYDEBUG 1 +ACE_END_VERSIONED_NAMESPACE_DECL + %} %token ACE_DYNAMIC ACE_STATIC ACE_SUSPEND ACE_RESUME ACE_REMOVE ACE_USTREAM @@ -57,7 +63,8 @@ svc_config_entries { if ($2 != 0) { - $2->apply (ACE_SVC_CONF_PARAM->yyerrno); delete $2; + $2->apply (ACE_SVC_CONF_PARAM->config, ACE_SVC_CONF_PARAM->yyerrno); + delete $2; } ACE_SVC_CONF_PARAM->obstack.release (); } @@ -170,11 +177,11 @@ module ACE_Static_Node *module = $<static_node_>-1; ACE_ARGV args (svc_type->parameters ()); - ACE_Module_Type *mt = ace_get_module (module, - svc_type, + ACE_Module_Type *mt = ace_get_module (module->record (ACE_SVC_CONF_PARAM->config), + svc_type->record (ACE_SVC_CONF_PARAM->config), ACE_SVC_CONF_PARAM->yyerrno); ACE_Stream_Type *st = - dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (module->record ()->type ())); + dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (module->record (ACE_SVC_CONF_PARAM->config)->type ())); if (mt->init (args.argc (), args.argv ()) == -1 || st->push (mt) == -1) @@ -188,11 +195,12 @@ module } | static { - ACE_Module_Type *mt = ace_get_module ($<static_node_>-1, + ACE_Static_Node *sn = $<static_node_>-1; + ACE_Module_Type *mt = ace_get_module (sn->record (ACE_SVC_CONF_PARAM->config), $<static_node_>1->name (), ACE_SVC_CONF_PARAM->yyerrno); - if (((ACE_Stream_Type *) ($<static_node_>-1)->record ()->type ())->push (mt) == -1) + if (((ACE_Stream_Type *) sn->record (ACE_SVC_CONF_PARAM->config)->type ())->push (mt) == -1) { ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("Problem with static\n"))); @@ -201,15 +209,17 @@ module } | suspend { - ACE_Module_Type *mt = ace_get_module ($<static_node_>-1, - $<static_node_>1->name (), + ACE_Static_Node *sn = $<static_node_>-1; + ACE_Module_Type *mt = ace_get_module (sn->record (ACE_SVC_CONF_PARAM->config), + sn->name (), ACE_SVC_CONF_PARAM->yyerrno); if (mt != 0) mt->suspend (); } | resume { - ACE_Module_Type *mt = ace_get_module ($<static_node_>-1, + ACE_Static_Node *sn = $<static_node_>-1; + ACE_Module_Type *mt = ace_get_module (sn->record (ACE_SVC_CONF_PARAM->config), $<static_node_>1->name (), ACE_SVC_CONF_PARAM->yyerrno); if (mt != 0) @@ -219,12 +229,12 @@ module { ACE_Static_Node *stream = $<static_node_>-1; ACE_Static_Node *module = $<static_node_>1; - ACE_Module_Type *mt = ace_get_module (stream, + ACE_Module_Type *mt = ace_get_module (stream->record (ACE_SVC_CONF_PARAM->config), module->name (), ACE_SVC_CONF_PARAM->yyerrno); ACE_Stream_Type *st = - dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (stream->record ()->type ())); + dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (stream->record (ACE_SVC_CONF_PARAM->config)->type ())); if (mt != 0 && st->remove (mt) == -1) { ACE_ERROR ((LM_ERROR, @@ -239,37 +249,7 @@ module svc_location : ACE_IDENT type svc_initializer status { - u_int flags - = ACE_Service_Type::DELETE_THIS - | ($3->dispose () == 0 ? 0 : ACE_Service_Type::DELETE_OBJ); - ACE_Service_Object_Exterminator gobbler = 0; - void *sym = $3->symbol (ACE_SVC_CONF_PARAM->yyerrno, &gobbler); - - if (sym != 0) - { - ACE_Service_Type_Impl *stp - = ACE_Service_Config::create_service_type_impl ($1, - $2, - sym, - flags, - gobbler); - if (stp == 0) - ++ACE_SVC_CONF_PARAM->yyerrno; - - $$ = new ACE_Service_Type ($1, - stp, - $3->dll (), - $4); - } - else - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("Unable to find service: %s\n"), - $1)); - ++ACE_SVC_CONF_PARAM->yyerrno; - $$ = 0; - } - delete $3; + $$ = new ACE_Service_Type_Factory ($1, $2, $3, $4); } ; @@ -330,6 +310,9 @@ pathname ; %% + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Prints the error string to standard output. Cleans up the error // messages. @@ -353,11 +336,10 @@ yyerror (int yyerrno, int yylineno, const char *s) // record. static ACE_Module_Type * -ace_get_module (ACE_Static_Node *str_rec, +ace_get_module (const ACE_Service_Type *sr, const ACE_TCHAR *svc_name, int & yyerrno) { - const ACE_Service_Type *sr = str_rec->record (); const ACE_Service_Type_Impl *type = sr->type (); ACE_Stream_Type *st = sr == 0 ? 0 @@ -369,7 +351,7 @@ ace_get_module (ACE_Static_Node *str_rec, ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("cannot locate Module_Type %s in STREAM_Type %s\n"), svc_name, - str_rec->name ())); + sr->name ())); yyerrno++; } @@ -377,24 +359,23 @@ ace_get_module (ACE_Static_Node *str_rec, } static ACE_Module_Type * -ace_get_module (ACE_Static_Node *str_rec, - ACE_Static_Node *svc_type, +ace_get_module (const ACE_Service_Type *sr, + const ACE_Service_Type *sv, int & yyerrno) { - const ACE_Service_Type *sr = str_rec->record (); const ACE_Service_Type_Impl *type = sr->type (); ACE_Stream_Type *st = sr == 0 ? 0 : (ACE_Stream_Type *) type; - const ACE_Service_Type *sv = svc_type->record (); + type = sv->type (); ACE_Module_Type *mt = (ACE_Module_Type *) type; - const ACE_TCHAR *module_type_name = svc_type->name (); + const ACE_TCHAR *module_type_name = sr->name (); if (sr == 0 || st == 0 || mt == 0) { ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("cannot locate Module_Type %s or STREAM_Type %s\n"), module_type_name, - str_rec->name ())); + sr->name ())); yyerrno++; } diff --git a/ace/Svc_Conf_Tokens.h b/ace/Svc_Conf_Tokens.h index 6fe46126fef..8c514a0a582 100644 --- a/ace/Svc_Conf_Tokens.h +++ b/ace/Svc_Conf_Tokens.h @@ -1,21 +1,81 @@ // $Id$ #ifndef BISON_SVC_CONF_TAB_H # define BISON_SVC_CONF_TAB_H +# define ACE_YYSTYPE_IS_DECLARED 1 +/* A Bison parser, made by GNU Bison 2.0. */ -# define ACE_DYNAMIC 257 -# define ACE_STATIC 258 -# define ACE_SUSPEND 259 -# define ACE_RESUME 260 -# define ACE_REMOVE 261 -# define ACE_USTREAM 262 -# define ACE_MODULE_T 263 -# define ACE_STREAM_T 264 -# define ACE_SVC_OBJ_T 265 -# define ACE_ACTIVE 266 -# define ACE_INACTIVE 267 -# define ACE_PATHNAME 268 -# define ACE_IDENT 269 -# define ACE_STRING 270 - - -#endif /* not BISON_SVC_CONF_TAB_H */ +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 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. */ + +/* Tokens. */ +#ifndef ACE_YYTOKENTYPE +# define ACE_YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum ace_yytokentype { + ACE_DYNAMIC = 258, + ACE_STATIC = 259, + ACE_SUSPEND = 260, + ACE_RESUME = 261, + ACE_REMOVE = 262, + ACE_USTREAM = 263, + ACE_MODULE_T = 264, + ACE_STREAM_T = 265, + ACE_SVC_OBJ_T = 266, + ACE_ACTIVE = 267, + ACE_INACTIVE = 268, + ACE_PATHNAME = 269, + ACE_IDENT = 270, + ACE_STRING = 271 + }; +#endif +#define ACE_DYNAMIC 258 +#define ACE_STATIC 259 +#define ACE_SUSPEND 260 +#define ACE_RESUME 261 +#define ACE_REMOVE 262 +#define ACE_USTREAM 263 +#define ACE_MODULE_T 264 +#define ACE_STREAM_T 265 +#define ACE_SVC_OBJ_T 266 +#define ACE_ACTIVE 267 +#define ACE_INACTIVE 268 +#define ACE_PATHNAME 269 +#define ACE_IDENT 270 +#define ACE_STRING 271 + + + + +#if ! defined (ACE_YYSTYPE) && ! defined (ACE_YYSTYPE_IS_DECLARED) +typedef int ACE_YYSTYPE; +# define ace_yystype ACE_YYSTYPE /* obsolescent; will be withdrawn */ +# define ACE_YYSTYPE_IS_DECLARED 1 +# define ACE_YYSTYPE_IS_TRIVIAL 1 +#endif + + + + + +#endif /* ifndef BISON_SVC_CONF_TAB_H */ diff --git a/ace/Svc_Conf_y.cpp b/ace/Svc_Conf_y.cpp index f8cb4551e48..0469977fe98 100644 --- a/ace/Svc_Conf_y.cpp +++ b/ace/Svc_Conf_y.cpp @@ -1,22 +1,93 @@ -/* A Bison parser, made from Svc_Conf.y - by GNU bison 1.35. */ - -#define ACE_YYBISON 1 /* Identify Bison output. */ - -# define ACE_DYNAMIC 257 -# define ACE_STATIC 258 -# define ACE_SUSPEND 259 -# define ACE_RESUME 260 -# define ACE_REMOVE 261 -# define ACE_USTREAM 262 -# define ACE_MODULE_T 263 -# define ACE_STREAM_T 264 -# define ACE_SVC_OBJ_T 265 -# define ACE_ACTIVE 266 -# define ACE_INACTIVE 267 -# define ACE_PATHNAME 268 -# define ACE_IDENT 269 -# define ACE_STRING 270 +/* A Bison parser, made by GNU Bison 2.0. */ + +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 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. */ + +/* Written by Richard Stallman by simplifying the original so called + ``semantic'' parser. */ + +/* All symbols defined below should begin with ace_yy or ACE_YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define ACE_YYBISON 1 + +/* Skeleton name. */ +#define ACE_YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define ACE_YYPURE 1 + +/* Using locations. */ +#define ACE_YYLSP_NEEDED 0 + + + +/* Tokens. */ +#ifndef ACE_YYTOKENTYPE +# define ACE_YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum ace_yytokentype { + ACE_DYNAMIC = 258, + ACE_STATIC = 259, + ACE_SUSPEND = 260, + ACE_RESUME = 261, + ACE_REMOVE = 262, + ACE_USTREAM = 263, + ACE_MODULE_T = 264, + ACE_STREAM_T = 265, + ACE_SVC_OBJ_T = 266, + ACE_ACTIVE = 267, + ACE_INACTIVE = 268, + ACE_PATHNAME = 269, + ACE_IDENT = 270, + ACE_STRING = 271 + }; +#endif +#define ACE_DYNAMIC 258 +#define ACE_STATIC 259 +#define ACE_SUSPEND 260 +#define ACE_RESUME 261 +#define ACE_REMOVE 262 +#define ACE_USTREAM 263 +#define ACE_MODULE_T 264 +#define ACE_STREAM_T 265 +#define ACE_SVC_OBJ_T 266 +#define ACE_ACTIVE 267 +#define ACE_INACTIVE 268 +#define ACE_PATHNAME 269 +#define ACE_IDENT 270 +#define ACE_STRING 271 + + + + +/* Copy the first part of user declarations. */ // $Id$ @@ -32,41 +103,181 @@ #include "ace/OS_NS_string.h" +#include "ace/ace_wchar.h" + ACE_RCSID (ace, Svc_Conf_y, "$Id$") - ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Prototypes. -static ACE_Module_Type *ace_get_module (ACE_Static_Node *str_rec, - ACE_Static_Node *svc_type, - int & ace_yyerrno); -static ACE_Module_Type *ace_get_module (ACE_Static_Node *str_rec, + +static ACE_Module_Type *ace_get_module (const ACE_Service_Type *sr, + const ACE_Service_Type *sv, + int & ace_ace_yyerrno); + +static ACE_Module_Type *ace_get_module (const ACE_Service_Type *sr, const ACE_TCHAR *svc_name, - int & ace_yyerrno); + int & ace_ace_yyerrno); #define ACE_YYDEBUG_LEXER_TEXT (ace_yytext[ace_yyleng] = '\0', ace_yytext) // Force the pretty debugging code to compile. // #define ACE_YYDEBUG 1 +ACE_END_VERSIONED_NAMESPACE_DECL + + + +/* Enabling traces. */ #ifndef ACE_YYDEBUG # define ACE_YYDEBUG 0 #endif +/* Enabling verbose error messages. */ +#ifdef ACE_YYERROR_VERBOSE +# undef ACE_YYERROR_VERBOSE +# define ACE_YYERROR_VERBOSE 1 +#else +# define ACE_YYERROR_VERBOSE 0 +#endif + +#if ! defined (ACE_YYSTYPE) && ! defined (ACE_YYSTYPE_IS_DECLARED) +typedef int ACE_YYSTYPE; +# define ace_yystype ACE_YYSTYPE /* obsolescent; will be withdrawn */ +# define ACE_YYSTYPE_IS_DECLARED 1 +# define ACE_YYSTYPE_IS_TRIVIAL 1 +#endif + + + +/* Copy the second part of user declarations. */ + + +/* Line 213 of yacc.c. */ + + +#if ! defined (ace_yyoverflow) || ACE_YYERROR_VERBOSE + +# ifndef ACE_YYFREE +# define ACE_YYFREE free +# endif +# ifndef ACE_YYMALLOC +# define ACE_YYMALLOC malloc +# endif + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef ACE_YYSTACK_USE_ALLOCA +# if ACE_YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define ACE_YYSTACK_ALLOC __builtin_alloca +# else +# define ACE_YYSTACK_ALLOC alloca +# endif +# endif +# endif + +# ifdef ACE_YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define ACE_YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# else +# if defined (__STDC__) || defined (__cplusplus) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# define ACE_YYSIZE_T size_t +# endif +# define ACE_YYSTACK_ALLOC ACE_YYMALLOC +# define ACE_YYSTACK_FREE ACE_YYFREE +# endif +#endif /* ! defined (ace_yyoverflow) || ACE_YYERROR_VERBOSE */ + + +#if (! defined (ace_yyoverflow) \ + && (! defined (__cplusplus) \ + || (defined (ACE_YYSTYPE_IS_TRIVIAL) && ACE_YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union ace_yyalloc +{ + short int ace_yyss; + ACE_YYSTYPE ace_yyvs; + }; +/* The size of the maximum gap between one aligned stack and the next. */ +# define ACE_YYSTACK_GAP_MAXIMUM (sizeof (union ace_yyalloc) - 1) -#define ACE_YYFINAL 66 -#define ACE_YYFLAG -32768 -#define ACE_YYNTBASE 23 +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define ACE_YYSTACK_BYTES(N) \ + ((N) * (sizeof (short int) + sizeof (ACE_YYSTYPE)) \ + + ACE_YYSTACK_GAP_MAXIMUM) -/* ACE_YYTRANSLATE(ACE_YYLEX) -- Bison token number corresponding to ACE_YYLEX. */ -#define ACE_YYTRANSLATE(x) ((unsigned)(x) <= 270 ? ace_yytranslate[x] : 43) +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef ACE_YYCOPY +# if defined (__GNUC__) && 1 < __GNUC__ +# define ACE_YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define ACE_YYCOPY(To, From, Count) \ + do \ + { \ + register ACE_YYSIZE_T ace_yyi; \ + for (ace_yyi = 0; ace_yyi < (Count); ace_yyi++) \ + (To)[ace_yyi] = (From)[ace_yyi]; \ + } \ + while (0) +# endif +# endif -/* ACE_YYTRANSLATE[ACE_YYLEX] -- Bison token number corresponding to ACE_YYLEX. */ -static const ACE_TCHAR ace_yytranslate[] = +/* Relocate STACK from its old location to the new one. The + local variables ACE_YYSIZE and ACE_YYSTACKSIZE give the old and new number of + elements in the stack, and ACE_YYPTR gives the new location of the + stack. Advance ACE_YYPTR to a properly aligned location for the next + stack. */ +# define ACE_YYSTACK_RELOCATE(Stack) \ + do \ + { \ + ACE_YYSIZE_T ace_yynewbytes; \ + ACE_YYCOPY (&ace_yyptr->Stack, Stack, ace_yysize); \ + Stack = &ace_yyptr->Stack; \ + ace_yynewbytes = ace_yystacksize * sizeof (*Stack) + ACE_YYSTACK_GAP_MAXIMUM; \ + ace_yyptr += ace_yynewbytes / sizeof (*ace_yyptr); \ + } \ + while (0) + +#endif + +#if defined (__STDC__) || defined (__cplusplus) + typedef signed char ace_yysigned_char; +#else + typedef short int ace_yysigned_char; +#endif + +/* ACE_YYFINAL -- State number of the termination state. */ +#define ACE_YYFINAL 2 +/* ACE_YYLAST -- Last index in ACE_YYTABLE. */ +#define ACE_YYLAST 62 + +/* ACE_YYNTOKENS -- Number of terminals. */ +#define ACE_YYNTOKENS 23 +/* ACE_YYNNTS -- Number of nonterminals. */ +#define ACE_YYNNTS 21 +/* ACE_YYNRULES -- Number of rules. */ +#define ACE_YYNRULES 45 +/* ACE_YYNRULES -- Number of states. */ +#define ACE_YYNSTATES 66 + +/* ACE_YYTRANSLATE(ACE_YYLEX) -- Bison symbol number corresponding to ACE_YYLEX. */ +#define ACE_YYUNDEFTOK 2 +#define ACE_YYMAXUTOK 271 + +#define ACE_YYTRANSLATE(ACE_YYX) \ + ((unsigned int) (ACE_YYX) <= ACE_YYMAXUTOK ? ace_yytranslate[ACE_YYX] : ACE_YYUNDEFTOK) + +/* ACE_YYTRANSLATE[ACE_YYLEX] -- Bison symbol number corresponding to ACE_YYLEX. */ +static const unsigned char ace_yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -93,290 +304,183 @@ static const ACE_TCHAR ace_yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16 }; #if ACE_YYDEBUG -static const short ace_yyprhs[] = +/* ACE_YYPRHS[ACE_YYN] -- Index of the first RHS symbol of rule number ACE_YYN in + ACE_YYRHS. */ +static const unsigned char ace_yyprhs[] = { - 0, 0, 3, 6, 7, 9, 11, 13, 15, 17, - 19, 23, 27, 30, 33, 36, 40, 41, 46, 48, - 50, 51, 56, 57, 60, 61, 63, 65, 67, 69, - 71, 76, 78, 80, 81, 85, 91, 96, 99, 102, - 105, 107, 108, 110, 112 + 0, 0, 3, 6, 9, 10, 12, 14, 16, 18, + 20, 22, 26, 30, 33, 36, 39, 43, 44, 49, + 51, 53, 54, 59, 60, 63, 64, 66, 68, 70, + 72, 74, 79, 81, 83, 84, 88, 94, 99, 102, + 105, 108, 110, 111, 113, 115 }; -static const short ace_yyrhs[] = + +/* ACE_YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const ace_yysigned_char ace_yyrhs[] = { - 23, 24, 0, 23, 1, 0, 0, 25, 0, 26, - 0, 27, 0, 28, 0, 29, 0, 30, 0, 3, - 37, 41, 0, 4, 15, 41, 0, 5, 15, 0, - 6, 15, 0, 7, 15, 0, 8, 32, 33, 0, - 0, 8, 15, 31, 33, 0, 25, 0, 26, 0, - 0, 17, 34, 35, 18, 0, 0, 35, 36, 0, - 0, 25, 0, 26, 0, 27, 0, 28, 0, 29, - 0, 15, 40, 39, 38, 0, 12, 0, 13, 0, - 0, 42, 19, 15, 0, 42, 19, 15, 20, 21, - 0, 19, 15, 20, 21, 0, 9, 22, 0, 11, - 22, 0, 10, 22, 0, 16, 0, 0, 14, 0, - 15, 0, 16, 0 + 24, 0, -1, 24, 25, -1, 24, 1, -1, -1, + 26, -1, 27, -1, 28, -1, 29, -1, 30, -1, + 31, -1, 3, 38, 42, -1, 4, 15, 42, -1, + 5, 15, -1, 6, 15, -1, 7, 15, -1, 8, + 33, 34, -1, -1, 8, 15, 32, 34, -1, 26, + -1, 27, -1, -1, 17, 35, 36, 18, -1, -1, + 36, 37, -1, -1, 26, -1, 27, -1, 28, -1, + 29, -1, 30, -1, 15, 41, 40, 39, -1, 12, + -1, 13, -1, -1, 43, 19, 15, -1, 43, 19, + 15, 20, 21, -1, 19, 15, 20, 21, -1, 9, + 22, -1, 11, 22, -1, 10, 22, -1, 16, -1, + -1, 14, -1, 15, -1, 16, -1 }; -#endif - -#if ACE_YYDEBUG -/* ACE_YYRLINE[ACE_YYN] -- source line where rule number ACE_YYN was defined. */ -static const short ace_yyrline[] = +/* ACE_YYRLINE[ACE_YYN] -- source line where rule number ACE_YYN was defined. */ +static const unsigned short int ace_yyrline[] = { - 0, 55, 63, 67, 71, 72, 73, 74, 75, 76, - 80, 90, 97, 104, 111, 118, 122, 122, 129, 132, - 138, 138, 147, 151, 159, 163, 188, 201, 209, 217, - 239, 276, 280, 284, 291, 295, 299, 306, 310, 314, - 321, 322, 326, 327, 328 + 0, 62, 62, 71, 75, 79, 80, 81, 82, 83, + 84, 88, 98, 105, 112, 119, 126, 130, 130, 137, + 140, 147, 146, 155, 159, 167, 171, 196, 210, 219, + 228, 250, 257, 261, 266, 272, 276, 280, 287, 291, + 295, 302, 303, 307, 308, 309 }; #endif - -#if (ACE_YYDEBUG) || defined ACE_YYERROR_VERBOSE - -/* ACE_YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ -static const ACE_TCHAR *const ace_yytname[] = +#if ACE_YYDEBUG || ACE_YYERROR_VERBOSE +/* ACE_YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at ACE_YYNTOKENS, nonterminals. */ +static const char *const ace_yytname[] = { - "$", "error", "$undefined.", "ACE_DYNAMIC", "ACE_STATIC", "ACE_SUSPEND", - "ACE_RESUME", "ACE_REMOVE", "ACE_USTREAM", "ACE_MODULE_T", - "ACE_STREAM_T", "ACE_SVC_OBJ_T", "ACE_ACTIVE", "ACE_INACTIVE", - "ACE_PATHNAME", "ACE_IDENT", "ACE_STRING", "'{'", "'}'", "':'", "'('", - "')'", "'*'", "svc_config_entries", "svc_config_entry", "dynamic", - "static", "suspend", "resume", "remove", "stream", "@1", "stream_ops", - "stream_modules", "@2", "module_list", "module", "svc_location", - "status", "svc_initializer", "type", "parameters_opt", "pathname", 0 + "$end", "error", "$undefined", "ACE_DYNAMIC", "ACE_STATIC", + "ACE_SUSPEND", "ACE_RESUME", "ACE_REMOVE", "ACE_USTREAM", "ACE_MODULE_T", + "ACE_STREAM_T", "ACE_SVC_OBJ_T", "ACE_ACTIVE", "ACE_INACTIVE", + "ACE_PATHNAME", "ACE_IDENT", "ACE_STRING", "'{'", "'}'", "':'", "'('", + "')'", "'*'", "$accept", "svc_config_entries", "svc_config_entry", + "dynamic", "static", "suspend", "resume", "remove", "stream", "@1", + "stream_ops", "stream_modules", "@2", "module_list", "module", + "svc_location", "status", "svc_initializer", "type", "parameters_opt", + "pathname", 0 }; #endif -/* ACE_YYR1[ACE_YYN] -- Symbol number of symbol that rule ACE_YYN derives. */ -static const short ace_yyr1[] = +# ifdef ACE_YYPRINT +/* ACE_YYTOKNUM[ACE_YYLEX-NUM] -- Internal token number corresponding to + token ACE_YYLEX-NUM. */ +static const unsigned short int ace_yytoknum[] = { - 0, 23, 23, 23, 24, 24, 24, 24, 24, 24, - 25, 26, 27, 28, 29, 30, 31, 30, 32, 32, - 34, 33, 33, 35, 35, 36, 36, 36, 36, 36, - 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, - 41, 41, 42, 42, 42 + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 123, 125, 58, + 40, 41, 42 }; +# endif -/* ACE_YYR2[ACE_YYN] -- Number of symbols composing right hand side of rule ACE_YYN. */ -static const short ace_yyr2[] = +/* ACE_YYR1[ACE_YYN] -- Symbol number of symbol that rule ACE_YYN derives. */ +static const unsigned char ace_yyr1[] = { - 0, 2, 2, 0, 1, 1, 1, 1, 1, 1, - 3, 3, 2, 2, 2, 3, 0, 4, 1, 1, - 0, 4, 0, 2, 0, 1, 1, 1, 1, 1, - 4, 1, 1, 0, 3, 5, 4, 2, 2, 2, - 1, 0, 1, 1, 1 + 0, 23, 24, 24, 24, 25, 25, 25, 25, 25, + 25, 26, 27, 28, 29, 30, 31, 32, 31, 33, + 33, 35, 34, 34, 36, 36, 37, 37, 37, 37, + 37, 38, 39, 39, 39, 40, 40, 40, 41, 41, + 41, 42, 42, 43, 43, 43 }; -/* ACE_YYDEFACT[S] -- default rule to reduce with in state S when ACE_YYTABLE - doesn't specify something else to do. Zero means the default is an - error. */ -static const short ace_yydefact[] = +/* ACE_YYR2[ACE_YYN] -- Number of symbols composing right hand side of rule ACE_YYN. */ +static const unsigned char ace_yyr2[] = { - 3, 0, 2, 0, 0, 0, 0, 0, 0, 1, - 4, 5, 6, 7, 8, 9, 0, 41, 41, 12, - 13, 14, 16, 18, 19, 22, 0, 0, 0, 0, - 40, 10, 11, 22, 20, 15, 37, 39, 38, 42, - 43, 44, 0, 33, 0, 17, 24, 0, 31, 32, - 30, 0, 0, 0, 34, 21, 25, 26, 27, 28, - 29, 23, 36, 0, 35, 0, 0 + 0, 2, 2, 2, 0, 1, 1, 1, 1, 1, + 1, 3, 3, 2, 2, 2, 3, 0, 4, 1, + 1, 0, 4, 0, 2, 0, 1, 1, 1, 1, + 1, 4, 1, 1, 0, 3, 5, 4, 2, 2, + 2, 1, 0, 1, 1, 1 }; -static const short ace_yydefgoto[] = +/* ACE_YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when ACE_YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const unsigned char ace_yydefact[] = { - 1, 9, 10, 11, 12, 13, 14, 15, 33, 25, - 35, 46, 52, 61, 17, 50, 43, 29, 31, 44 + 4, 0, 1, 3, 0, 0, 0, 0, 0, 0, + 2, 5, 6, 7, 8, 9, 10, 0, 42, 42, + 13, 14, 15, 17, 19, 20, 23, 0, 0, 0, + 0, 41, 11, 12, 23, 21, 16, 38, 40, 39, + 43, 44, 45, 0, 34, 0, 18, 25, 0, 32, + 33, 31, 0, 0, 0, 35, 22, 26, 27, 28, + 29, 30, 24, 37, 0, 36 }; -static const short ace_yypact[] = +/* ACE_YYDEFGOTO[NTERM-NUM]. */ +static const ace_yysigned_char ace_yydefgoto[] = { - -32768, 20,-32768, 1, 3, 7, 14, 18, 4,-32768, - -32768,-32768,-32768,-32768,-32768,-32768, 21, 19, 19,-32768, - -32768,-32768,-32768,-32768,-32768, -2, 12, 15, 16, -5, - -32768,-32768,-32768, -2,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768, 24, 0, 17,-32768,-32768, 22,-32768,-32768, - -32768, 25, -1, 26, 23,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768, 27,-32768, 41,-32768 + -1, 1, 10, 11, 12, 13, 14, 15, 16, 34, + 26, 36, 47, 53, 62, 18, 51, 44, 30, 32, + 45 }; -static const short ace_yypgoto[] = +/* ACE_YYPACT[STATE-NUM] -- Index in ACE_YYTABLE of the portion describing + STATE-NUM. */ +#define ACE_YYPACT_NINF -13 +static const ace_yysigned_char ace_yypact[] = { - -32768,-32768, -8, -7, -6, -3, 2,-32768,-32768,-32768, - 28,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 32,-32768 + -13, 20, -13, -13, 1, 3, 7, 14, 18, 4, + -13, -13, -13, -13, -13, -13, -13, 21, 19, 19, + -13, -13, -13, -13, -13, -13, -2, 12, 15, 16, + -5, -13, -13, -13, -2, -13, -13, -13, -13, -13, + -13, -13, -13, 24, 0, 17, -13, -13, 22, -13, + -13, -13, 25, -1, 26, 23, -13, -13, -13, -13, + -13, -13, -13, -13, 27, -13 }; +/* ACE_YYPGOTO[NTERM-NUM]. */ +static const ace_yysigned_char ace_yypgoto[] = +{ + -13, -13, -13, -9, -8, -12, -7, -4, -13, -13, + -13, 28, -13, -13, -13, -13, -13, -13, -13, 31, + -13 +}; -#define ACE_YYLAST 61 - - -static const short ace_yytable[] = +/* ACE_YYTABLE[ACE_YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what ACE_YYDEFACT says. + If ACE_YYTABLE_NINF, syntax error. */ +#define ACE_YYTABLE_NINF -1 +static const unsigned char ace_yytable[] = { - 23, 24, 3, 4, 5, 6, 7, 3, 4, 39, - 40, 41, 48, 49, 42, 34, 16, 55, 18, 22, - 65, 2, 19, 3, 4, 5, 6, 7, 8, 20, - 26, 27, 28, 21, 36, 30, 51, 37, 38, 47, - 54, 66, 53, 63, 56, 57, 58, 62, 64, 59, - 32, 0, 0, 0, 60, 0, 0, 0, 0, 0, - 0, 45 + 24, 25, 4, 5, 6, 7, 8, 4, 5, 40, + 41, 42, 49, 50, 43, 35, 17, 56, 19, 23, + 2, 3, 20, 4, 5, 6, 7, 8, 9, 21, + 27, 28, 29, 22, 37, 31, 52, 38, 39, 48, + 55, 59, 54, 64, 57, 58, 60, 63, 65, 61, + 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 46 }; -static const short ace_yycheck[] = +static const ace_yysigned_char ace_yycheck[] = { - 8, 8, 3, 4, 5, 6, 7, 3, 4, 14, + 9, 9, 3, 4, 5, 6, 7, 3, 4, 14, 15, 16, 12, 13, 19, 17, 15, 18, 15, 15, 0, 1, 15, 3, 4, 5, 6, 7, 8, 15, 9, 10, 11, 15, 22, 16, 19, 22, 22, 15, - 15, 0, 20, 20, 52, 52, 52, 21, 21, 52, - 18, -1, -1, -1, 52, -1, -1, -1, -1, -1, - -1, 33 + 15, 53, 20, 20, 53, 53, 53, 21, 21, 53, + 19, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 34 }; -#define ACE_YYPURE 1 - -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ - -/* Skeleton output parser for bison, - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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. */ - -/* All symbols defined below should begin with ace_yy or ACE_YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -#if ! defined (ace_yyoverflow) || defined (ACE_YYERROR_VERBOSE) - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# if ACE_YYSTACK_USE_ALLOCA -# define ACE_YYSTACK_ALLOC alloca -# else -# ifndef ACE_YYSTACK_USE_ALLOCA -# if defined (alloca) || defined (_ALLOCA_H) -# define ACE_YYSTACK_ALLOC alloca -# else -# ifdef __GNUC__ -# define ACE_YYSTACK_ALLOC __builtin_alloca -# endif -# endif -# endif -# endif -# ifdef ACE_YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define ACE_YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# else -# if defined (__STDC__) || defined (__cplusplus) -ACE_END_VERSIONED_NAMESPACE_DECL -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -# define ACE_YYSIZE_T size_t -# endif -# define ACE_YYSTACK_ALLOC malloc -# define ACE_YYSTACK_FREE free -# endif -#endif /* ! defined (ace_yyoverflow) || defined (ACE_YYERROR_VERBOSE) */ - - -#if (! defined (ace_yyoverflow) \ - && (! defined (__cplusplus) \ - || (ACE_YYLTYPE_IS_TRIVIAL && ACE_YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union ace_yyalloc +/* ACE_YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const unsigned char ace_yystos[] = { - short ace_yyss; - ACE_YYSTYPE ace_yyvs; -# if ACE_YYLSP_NEEDED - ACE_YYLTYPE ace_yyls; -# endif + 0, 24, 0, 1, 3, 4, 5, 6, 7, 8, + 25, 26, 27, 28, 29, 30, 31, 15, 38, 15, + 15, 15, 15, 15, 26, 27, 33, 9, 10, 11, + 41, 16, 42, 42, 32, 17, 34, 22, 22, 22, + 14, 15, 16, 19, 40, 43, 34, 35, 15, 12, + 13, 39, 19, 36, 20, 15, 18, 26, 27, 28, + 29, 30, 37, 21, 20, 21 }; -/* The size of the maximum gap between one aligned stack and the next. */ -# define ACE_YYSTACK_GAP_MAX (sizeof (union ace_yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# if ACE_YYLSP_NEEDED -# define ACE_YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (ACE_YYSTYPE) + sizeof (ACE_YYLTYPE)) \ - + 2 * ACE_YYSTACK_GAP_MAX) -# else -# define ACE_YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (ACE_YYSTYPE)) \ - + ACE_YYSTACK_GAP_MAX) -# endif - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef ACE_YYCOPY -# if 1 < __GNUC__ -# define ACE_YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define ACE_YYCOPY(To, From, Count) \ - do \ - { \ - register ACE_YYSIZE_T ace_yyi; \ - for (ace_yyi = 0; ace_yyi < (Count); ace_yyi++) \ - (To)[ace_yyi] = (From)[ace_yyi]; \ - } \ - while (0) -# endif -# endif - -/* Relocate STACK from its old location to the new one. The - local variables ACE_YYSIZE and ACE_YYSTACKSIZE give the old and new number of - elements in the stack, and ACE_YYPTR gives the new location of the - stack. Advance ACE_YYPTR to a properly aligned location for the next - stack. */ -# define ACE_YYSTACK_RELOCATE(Stack) \ - do \ - { \ - ACE_YYSIZE_T ace_yynewbytes; \ - ACE_YYCOPY (&ace_yyptr->Stack, Stack, ace_yysize); \ - Stack = &ace_yyptr->Stack; \ - ace_yynewbytes = ace_yystacksize * sizeof (*Stack) + ACE_YYSTACK_GAP_MAX; \ - ace_yyptr += ace_yynewbytes / sizeof (*ace_yyptr); \ - } \ - while (0) - -#endif - - #if ! defined (ACE_YYSIZE_T) && defined (__SIZE_TYPE__) # define ACE_YYSIZE_T __SIZE_TYPE__ #endif @@ -385,9 +489,7 @@ union ace_yyalloc #endif #if ! defined (ACE_YYSIZE_T) # if defined (__STDC__) || defined (__cplusplus) -ACE_END_VERSIONED_NAMESPACE_DECL # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ -ACE_BEGIN_VERSIONED_NAMESPACE_DECL # define ACE_YYSIZE_T size_t # endif #endif @@ -397,79 +499,99 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL #define ace_yyerrok (ace_yyerrstatus = 0) #define ace_yyclearin (ace_yychar = ACE_YYEMPTY) -#define ACE_YYEMPTY -2 +#define ACE_YYEMPTY (-2) #define ACE_YYEOF 0 + #define ACE_YYACCEPT goto ace_yyacceptlab -#define ACE_YYABORT goto ace_yyabortlab -#define ACE_YYERROR goto ace_yyerrlab1 +#define ACE_YYABORT goto ace_yyabortlab +#define ACE_YYERROR goto ace_yyerrorlab + + /* Like ACE_YYERROR except do call ace_yyerror. This remains here temporarily to ease the transition to the new meaning of ACE_YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ + #define ACE_YYFAIL goto ace_yyerrlab + #define ACE_YYRECOVERING() (!!ace_yyerrstatus) + #define ACE_YYBACKUP(Token, Value) \ do \ if (ace_yychar == ACE_YYEMPTY && ace_yylen == 1) \ { \ ace_yychar = (Token); \ ace_yylval = (Value); \ - ace_yychar1 = ACE_YYTRANSLATE (ace_yychar); \ + ace_yytoken = ACE_YYTRANSLATE (ace_yychar); \ ACE_YYPOPSTACK; \ goto ace_yybackup; \ } \ else \ { \ - ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, "syntax error: cannot back up"); \ + ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, "syntax error: cannot back up");\ ACE_YYERROR; \ } \ while (0) + #define ACE_YYTERROR 1 #define ACE_YYERRCODE 256 -/* ACE_YYLLOC_DEFAULT -- Compute the default location (before the actions - are run). - - When ACE_YYLLOC_DEFAULT is run, CURRENT is set the location of the - first token. By default, to implement support for ranges, extend - its range to the last symbol. */ +/* ACE_YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ +#define ACE_YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef ACE_YYLLOC_DEFAULT -# define ACE_YYLLOC_DEFAULT(Current, Rhs, N) \ - Current.last_line = Rhs[N].last_line; \ - Current.last_column = Rhs[N].last_column; +# define ACE_YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = ACE_YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = ACE_YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = ACE_YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = ACE_YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + ACE_YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + ACE_YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (0) #endif -/* ACE_YYLEX -- calling `ace_yylex' with the right arguments. */ +/* ACE_YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef ACE_YY_LOCATION_PRINT +# if ACE_YYLTYPE_IS_TRIVIAL +# define ACE_YY_LOCATION_PRINT(File, Loc) \ + ACE_OS::fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define ACE_YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif -#if ACE_YYPURE -# if ACE_YYLSP_NEEDED -# ifdef ACE_YYLEX_PARAM -# define ACE_YYLEX ace_yylex (&ace_yylval, &ace_yylloc, ACE_YYLEX_PARAM) -# else -# define ACE_YYLEX ace_yylex (&ace_yylval, &ace_yylloc) -# endif -# else /* !ACE_YYLSP_NEEDED */ -# ifdef ACE_YYLEX_PARAM -# define ACE_YYLEX ace_yylex (&ace_yylval, ACE_YYLEX_PARAM) -# else -# define ACE_YYLEX ace_yylex (&ace_yylval) -# endif -# endif /* !ACE_YYLSP_NEEDED */ -#else /* !ACE_YYPURE */ -# define ACE_YYLEX ace_yylex () -#endif /* !ACE_YYPURE */ +/* ACE_YYLEX -- calling `ace_yylex' with the right arguments. */ + +#ifdef ACE_YYLEX_PARAM +# define ACE_YYLEX ace_yylex (&ace_yylval, ACE_YYLEX_PARAM) +#else +# define ACE_YYLEX ace_yylex (&ace_yylval) +#endif /* Enable debugging if requested. */ #if ACE_YYDEBUG # ifndef ACE_YYFPRINTF -ACE_END_VERSIONED_NAMESPACE_DECL # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ -ACE_BEGIN_VERSIONED_NAMESPACE_DECL # define ACE_YYFPRINTF ACE_OS::fprintf # endif @@ -478,13 +600,86 @@ do { \ if (ace_yydebug) \ ACE_YYFPRINTF Args; \ } while (0) + +# define ACE_YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (ace_yydebug) \ + { \ + ACE_YYFPRINTF (stderr, "%s ", Title); \ + ace_yysymprint (stderr, \ + Type, Value); \ + ACE_YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + +/*------------------------------------------------------------------. +| ace_yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +ace_yy_stack_print (short int *bottom, short int *top) +#else +static void +ace_yy_stack_print (bottom, top) + short int *bottom; + short int *top; +#endif +{ + ACE_YYFPRINTF (stderr, "Stack now"); + for (/* Nothing. */; bottom <= top; ++bottom) + ACE_YYFPRINTF (stderr, " %d", *bottom); + ACE_YYFPRINTF (stderr, "\n"); +} + +# define ACE_YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (ace_yydebug) \ + ace_yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the ACE_YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +ace_yy_reduce_print (int ace_yyrule) +#else +static void +ace_yy_reduce_print (ace_yyrule) + int ace_yyrule; +#endif +{ + int ace_yyi; + unsigned int ace_yylno = ace_yyrline[ace_yyrule]; + ACE_YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + ace_yyrule - 1, ace_yylno); + /* Print the symbols being reduced, and their result. */ + for (ace_yyi = ace_yyprhs[ace_yyrule]; 0 <= ace_yyrhs[ace_yyi]; ace_yyi++) + ACE_YYFPRINTF (stderr, "%s ", ace_yytname [ace_yyrhs[ace_yyi]]); + ACE_YYFPRINTF (stderr, "-> %s\n", ace_yytname [ace_yyr1[ace_yyrule]]); +} + +# define ACE_YY_REDUCE_PRINT(Rule) \ +do { \ + if (ace_yydebug) \ + ace_yy_reduce_print (Rule); \ +} while (0) + /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int ace_yydebug; #else /* !ACE_YYDEBUG */ # define ACE_YYDPRINTF(Args) +# define ACE_YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define ACE_YY_STACK_PRINT(Bottom, Top) +# define ACE_YY_REDUCE_PRINT(Rule) #endif /* !ACE_YYDEBUG */ + /* ACE_YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef ACE_YYINITDEPTH # define ACE_YYINITDEPTH 200 @@ -497,15 +692,13 @@ int ace_yydebug; SIZE_MAX < ACE_YYSTACK_BYTES (ACE_YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ -#if ACE_YYMAXDEPTH == 0 -# undef ACE_YYMAXDEPTH -#endif - #ifndef ACE_YYMAXDEPTH # define ACE_YYMAXDEPTH 10000 #endif - -#ifdef ACE_YYERROR_VERBOSE + + + +#if ACE_YYERROR_VERBOSE # ifndef ace_yystrlen # if defined (__GLIBC__) && defined (_STRING_H) @@ -514,13 +707,13 @@ int ace_yydebug; /* Return the length of ACE_YYSTR. */ static ACE_YYSIZE_T # if defined (__STDC__) || defined (__cplusplus) -ace_yystrlen (const ACE_TCHAR *ace_yystr) +ace_yystrlen (const char *ace_yystr) # else ace_yystrlen (ace_yystr) - const ACE_TCHAR *ace_yystr; + const char *ace_yystr; # endif { - register const ACE_TCHAR *ace_yys = ace_yystr; + register const char *ace_yys = ace_yystr; while (*ace_yys++ != '\0') continue; @@ -536,17 +729,17 @@ ace_yystrlen (ace_yystr) # else /* Copy ACE_YYSRC to ACE_YYDEST, returning the address of the terminating '\0' in ACE_YYDEST. */ -static ACE_TCHAR * +static char * # if defined (__STDC__) || defined (__cplusplus) -ace_yystpcpy (ACE_TCHAR *ace_yydest, const ACE_TCHAR *ace_yysrc) +ace_yystpcpy (ACE_TCHAR *ace_yydest, const char *ace_yysrc) # else ace_yystpcpy (ace_yydest, ace_yysrc) - ACE_TCHAR *ace_yydest; - const ACE_TCHAR *ace_yysrc; + char *ace_yydest; + const char *ace_yysrc; # endif { - register ACE_TCHAR *ace_yyd = ace_yydest; - register const ACE_TCHAR *ace_yys = ace_yysrc; + register char *ace_yyd = ace_yydest; + register const char *ace_yys = ace_yysrc; while ((*ace_yyd++ = *ace_yys++) != '\0') continue; @@ -555,85 +748,139 @@ ace_yystpcpy (ace_yydest, ace_yysrc) } # endif # endif + +#endif /* !ACE_YYERROR_VERBOSE */ + + + +#if ACE_YYDEBUG +/*--------------------------------. +| Print this symbol on ACE_YYOUTPUT. | +`--------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +ace_yysymprint (FILE *ace_yyoutput, int ace_yytype, ACE_YYSTYPE *ace_yyvaluep) +#else +static void +ace_yysymprint (ace_yyoutput, ace_yytype, ace_yyvaluep) + FILE *ace_yyoutput; + int ace_yytype; + ACE_YYSTYPE *ace_yyvaluep; +#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) ace_yyvaluep; + + if (ace_yytype < ACE_YYNTOKENS) + ACE_YYFPRINTF (ace_yyoutput, "token %s (", ace_yytname[ace_yytype]); + else + ACE_YYFPRINTF (ace_yyoutput, "nterm %s (", ace_yytname[ace_yytype]); + + +# ifdef ACE_YYPRINT + if (ace_yytype < ACE_YYNTOKENS) + ACE_YYPRINT (ace_yyoutput, ace_yytoknum[ace_yytype], *ace_yyvaluep); +# endif + switch (ace_yytype) + { + default: + break; + } + ACE_YYFPRINTF (ace_yyoutput, ")"); +} + +#endif /* ! ACE_YYDEBUG */ +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +ace_yydestruct (const char *ace_yymsg, int ace_yytype, ACE_YYSTYPE *ace_yyvaluep) +#else +static void +ace_yydestruct (ace_yymsg, ace_yytype, ace_yyvaluep) + const char *ace_yymsg; + int ace_yytype; + ACE_YYSTYPE *ace_yyvaluep; #endif - +{ + /* Pacify ``unused variable'' warnings. */ + (void) ace_yyvaluep; + if (!ace_yymsg) + ace_yymsg = "Deleting"; + ACE_YY_SYMBOL_PRINT (ace_yymsg, ace_yytype, ace_yyvaluep, ace_yylocationp); -/* The user can define ACE_YYPARSE_PARAM as the name of an argument to be passed - into ace_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. */ + switch (ace_yytype) + { + + default: + break; + } +} + + +/* Prevent warnings from -Wmissing-prototypes. */ #ifdef ACE_YYPARSE_PARAM # if defined (__STDC__) || defined (__cplusplus) -# define ACE_YYPARSE_PARAM_ARG void *ACE_YYPARSE_PARAM -# define ACE_YYPARSE_PARAM_DECL +int ace_yyparse (void *ACE_YYPARSE_PARAM); # else -# define ACE_YYPARSE_PARAM_ARG ACE_YYPARSE_PARAM -# define ACE_YYPARSE_PARAM_DECL void *ACE_YYPARSE_PARAM; +int ace_yyparse (); # endif -#else /* !ACE_YYPARSE_PARAM */ -# define ACE_YYPARSE_PARAM_ARG -# define ACE_YYPARSE_PARAM_DECL -#endif /* !ACE_YYPARSE_PARAM */ - -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ -# ifdef ACE_YYPARSE_PARAM -int ace_yyparse (void *); -# else +#else /* ! ACE_YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) int ace_yyparse (void); -# endif +#else +int ace_yyparse (); #endif +#endif /* ! ACE_YYPARSE_PARAM */ -/* ACE_YY_DECL_VARIABLES -- depending whether we use a pure parser, - variables are global, or local to ACE_YYPARSE. */ - -#define ACE_YY_DECL_NON_LSP_VARIABLES \ -/* The lookahead symbol. */ \ -int ace_yychar; \ - \ -/* The semantic value of the lookahead symbol. */ \ -ACE_YYSTYPE ace_yylval; \ - \ -/* Number of parse errors so far. */ \ -int ace_yynerrs; -#if ACE_YYLSP_NEEDED -# define ACE_YY_DECL_VARIABLES \ -ACE_YY_DECL_NON_LSP_VARIABLES \ - \ -/* Location data for the lookahead symbol. */ \ -ACE_YYLTYPE ace_yylloc; -#else -# define ACE_YY_DECL_VARIABLES \ -ACE_YY_DECL_NON_LSP_VARIABLES -#endif -/* If nonreentrant, generate the variables here. */ -#if !ACE_YYPURE -ACE_YY_DECL_VARIABLES -#endif /* !ACE_YYPURE */ +/*----------. +| ace_yyparse. | +`----------*/ + +#ifdef ACE_YYPARSE_PARAM +# if defined (__STDC__) || defined (__cplusplus) +int ace_yyparse (void *ACE_YYPARSE_PARAM) +# else +int ace_yyparse (ACE_YYPARSE_PARAM) + void *ACE_YYPARSE_PARAM; +# endif +#else /* ! ACE_YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) +int +ace_yyparse (void) +#else int -ace_yyparse (ACE_YYPARSE_PARAM_ARG) - ACE_YYPARSE_PARAM_DECL +ace_yyparse () + +#endif +#endif { - /* If reentrant, generate the variables here. */ -#if ACE_YYPURE - ACE_YY_DECL_VARIABLES -#endif /* !ACE_YYPURE */ + /* The look-ahead symbol. */ +int ace_yychar; + +/* The semantic value of the look-ahead symbol. */ +ACE_YYSTYPE ace_yylval; + +/* Number of syntax errors so far. */ +int ace_yynerrs; register int ace_yystate; register int ace_yyn; int ace_yyresult; /* Number of tokens to shift before error messages enabled. */ int ace_yyerrstatus; - /* Lookahead token as an internal (translated) token number. */ - int ace_yychar1 = 0; + /* Look-ahead token as an internal (translated) token number. */ + int ace_yytoken = 0; /* Three stacks and their tools: `ace_yyss': related to states, @@ -643,41 +890,29 @@ ace_yyparse (ACE_YYPARSE_PARAM_ARG) Refer to the stacks thru separate pointers, to allow ace_yyoverflow to reallocate them elsewhere. */ - /* The state stack. */ - short ace_yyssa[ACE_YYINITDEPTH]; - short *ace_yyss = ace_yyssa; - register short *ace_yyssp; + /* The state stack. */ + short int ace_yyssa[ACE_YYINITDEPTH]; + short int *ace_yyss = ace_yyssa; + register short int *ace_yyssp; /* The semantic value stack. */ ACE_YYSTYPE ace_yyvsa[ACE_YYINITDEPTH]; ACE_YYSTYPE *ace_yyvs = ace_yyvsa; register ACE_YYSTYPE *ace_yyvsp; -#if ACE_YYLSP_NEEDED - /* The location stack. */ - ACE_YYLTYPE ace_yylsa[ACE_YYINITDEPTH]; - ACE_YYLTYPE *ace_yyls = ace_yylsa; - ACE_YYLTYPE *ace_yylsp; -#endif -#if ACE_YYLSP_NEEDED -# define ACE_YYPOPSTACK (ace_yyvsp--, ace_yyssp--, ace_yylsp--) -#else -# define ACE_YYPOPSTACK (ace_yyvsp--, ace_yyssp--) -#endif - ACE_YYSIZE_T ace_yystacksize = ACE_YYINITDEPTH; +#define ACE_YYPOPSTACK (ace_yyvsp--, ace_yyssp--) + ACE_YYSIZE_T ace_yystacksize = ACE_YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ ACE_YYSTYPE ace_yyval; -#if ACE_YYLSP_NEEDED - ACE_YYLTYPE ace_yyloc; -#endif + /* When reducing, the number of symbols on the RHS of the reduced - rule. */ + rule. */ int ace_yylen; ACE_YYDPRINTF ((stderr, "Starting parse\n")); @@ -694,9 +929,10 @@ ace_yyparse (ACE_YYPARSE_PARAM_ARG) ace_yyssp = ace_yyss; ace_yyvsp = ace_yyvs; -#if ACE_YYLSP_NEEDED - ace_yylsp = ace_yyls; -#endif + + + ace_yyvsp[0] = ace_yylval; + goto ace_yysetstate; /*------------------------------------------------------------. @@ -711,181 +947,136 @@ ace_yyparse (ACE_YYPARSE_PARAM_ARG) ace_yysetstate: *ace_yyssp = ace_yystate; - if (ace_yyssp >= ace_yyss + ace_yystacksize - 1) + if (ace_yyss + ace_yystacksize - 1 <= ace_yyssp) { /* Get the current used size of the three stacks, in elements. */ ACE_YYSIZE_T ace_yysize = ace_yyssp - ace_yyss + 1; #ifdef ace_yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - ACE_YYSTYPE *ace_yyvs1 = ace_yyvs; - short *ace_yyss1 = ace_yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. */ -# if ACE_YYLSP_NEEDED - ACE_YYLTYPE *ace_yyls1 = ace_yyls; - /* This used to be a conditional around just the two extra args, - but that might be undefined if ace_yyoverflow is a macro. */ - ace_yyoverflow ("parser stack overflow", - &ace_yyss1, ace_yysize * sizeof (*ace_yyssp), - &ace_yyvs1, ace_yysize * sizeof (*ace_yyvsp), - &ace_yyls1, ace_yysize * sizeof (*ace_yylsp), - &ace_yystacksize); - ace_yyls = ace_yyls1; -# else - ace_yyoverflow ("parser stack overflow", - &ace_yyss1, ace_yysize * sizeof (*ace_yyssp), - &ace_yyvs1, ace_yysize * sizeof (*ace_yyvsp), - &ace_yystacksize); -# endif - ace_yyss = ace_yyss1; - ace_yyvs = ace_yyvs1; + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + ACE_YYSTYPE *ace_yyvs1 = ace_yyvs; + short int *ace_yyss1 = ace_yyss; + + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if ace_yyoverflow is a macro. */ + ace_yyoverflow ("parser stack overflow", + &ace_yyss1, ace_yysize * sizeof (*ace_yyssp), + &ace_yyvs1, ace_yysize * sizeof (*ace_yyvsp), + + &ace_yystacksize); + + ace_yyss = ace_yyss1; + ace_yyvs = ace_yyvs1; } #else /* no ace_yyoverflow */ # ifndef ACE_YYSTACK_RELOCATE goto ace_yyoverflowlab; # else /* Extend the stack our own way. */ - if (ace_yystacksize >= ACE_YYMAXDEPTH) - goto ace_yyoverflowlab; + if (ACE_YYMAXDEPTH <= ace_yystacksize) + goto ace_yyoverflowlab; ace_yystacksize *= 2; - if (ace_yystacksize > ACE_YYMAXDEPTH) - ace_yystacksize = ACE_YYMAXDEPTH; + if (ACE_YYMAXDEPTH < ace_yystacksize) + ace_yystacksize = ACE_YYMAXDEPTH; { - short *ace_yyss1 = ace_yyss; - union ace_yyalloc *ace_yyptr = - (union ace_yyalloc *) ACE_YYSTACK_ALLOC (ACE_YYSTACK_BYTES (ace_yystacksize)); - if (! ace_yyptr) - goto ace_yyoverflowlab; - ACE_YYSTACK_RELOCATE (ace_yyss); - ACE_YYSTACK_RELOCATE (ace_yyvs); -# if ACE_YYLSP_NEEDED - ACE_YYSTACK_RELOCATE (ace_yyls); -# endif -# undef ACE_YYSTACK_RELOCATE - if (ace_yyss1 != ace_yyssa) - ACE_YYSTACK_FREE (ace_yyss1); + short int *ace_yyss1 = ace_yyss; + union ace_yyalloc *ace_yyptr = + (union ace_yyalloc *) ACE_YYSTACK_ALLOC (ACE_YYSTACK_BYTES (ace_yystacksize)); + if (! ace_yyptr) + goto ace_yyoverflowlab; + ACE_YYSTACK_RELOCATE (ace_yyss); + ACE_YYSTACK_RELOCATE (ace_yyvs); + +# undef ACE_YYSTACK_RELOCATE + if (ace_yyss1 != ace_yyssa) + ACE_YYSTACK_FREE (ace_yyss1); } # endif #endif /* no ace_yyoverflow */ ace_yyssp = ace_yyss + ace_yysize - 1; ace_yyvsp = ace_yyvs + ace_yysize - 1; -#if ACE_YYLSP_NEEDED - ace_yylsp = ace_yyls + ace_yysize - 1; -#endif + ACE_YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) ace_yystacksize)); + (unsigned long int) ace_yystacksize)); - if (ace_yyssp >= ace_yyss + ace_yystacksize - 1) - ACE_YYABORT; + if (ace_yyss + ace_yystacksize - 1 <= ace_yyssp) + ACE_YYABORT; } ACE_YYDPRINTF ((stderr, "Entering state %d\n", ace_yystate)); goto ace_yybackup; - /*-----------. | ace_yybackup. | `-----------*/ ace_yybackup: /* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ +/* Read a look-ahead token if we need one and don't already have one. */ /* ace_yyresume: */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ ace_yyn = ace_yypact[ace_yystate]; - if (ace_yyn == ACE_YYFLAG) + if (ace_yyn == ACE_YYPACT_NINF) goto ace_yydefault; - /* Not known => get a lookahead token if don't already have one. */ - - /* ace_yychar is either ACE_YYEMPTY or ACE_YYEOF - or a valid token in external form. */ + /* Not known => get a look-ahead token if don't already have one. */ + /* ACE_YYCHAR is either ACE_YYEMPTY or ACE_YYEOF or a valid look-ahead symbol. */ if (ace_yychar == ACE_YYEMPTY) { ACE_YYDPRINTF ((stderr, "Reading a token: ")); ace_yychar = ACE_YYLEX; } - /* Convert token to internal form (in ace_yychar1) for indexing tables with */ - - if (ace_yychar <= 0) /* This means end of input. */ + if (ace_yychar <= ACE_YYEOF) { - ace_yychar1 = 0; - ace_yychar = ACE_YYEOF; /* Don't call ACE_YYLEX any more */ - + ace_yychar = ace_yytoken = ACE_YYEOF; ACE_YYDPRINTF ((stderr, "Now at end of input.\n")); } else { - ace_yychar1 = ACE_YYTRANSLATE (ace_yychar); - -#if ACE_YYDEBUG - /* We have to keep this `#if ACE_YYDEBUG', since we use variables - which are defined only if `ACE_YYDEBUG' is set. */ - if (ace_yydebug) - { - ACE_YYFPRINTF (stderr, "Next token is %d (%s", - ace_yychar, ace_yytname[ace_yychar1]); - /* Give the individual parser a way to print the precise - meaning of a token, for further debugging info. */ -# ifdef ACE_YYPRINT - ACE_YYPRINT (stderr, ace_yychar, ace_yylval); -# endif - ACE_YYFPRINTF (stderr, ")\n"); - } -#endif + ace_yytoken = ACE_YYTRANSLATE (ace_yychar); + ACE_YY_SYMBOL_PRINT ("Next token is", ace_yytoken, &ace_yylval, &ace_yylloc); } - ace_yyn += ace_yychar1; - if (ace_yyn < 0 || ace_yyn > ACE_YYLAST || ace_yycheck[ace_yyn] != ace_yychar1) + /* If the proper action on seeing token ACE_YYTOKEN is to reduce or to + detect an error, take that action. */ + ace_yyn += ace_yytoken; + if (ace_yyn < 0 || ACE_YYLAST < ace_yyn || ace_yycheck[ace_yyn] != ace_yytoken) goto ace_yydefault; - ace_yyn = ace_yytable[ace_yyn]; - - /* ace_yyn is what to do for this token type in this state. - Negative => reduce, -ace_yyn is rule number. - Positive => shift, ace_yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ - - if (ace_yyn < 0) + if (ace_yyn <= 0) { - if (ace_yyn == ACE_YYFLAG) - goto ace_yyerrlab; + if (ace_yyn == 0 || ace_yyn == ACE_YYTABLE_NINF) + goto ace_yyerrlab; ace_yyn = -ace_yyn; goto ace_yyreduce; } - else if (ace_yyn == 0) - goto ace_yyerrlab; if (ace_yyn == ACE_YYFINAL) ACE_YYACCEPT; - /* Shift the lookahead token. */ - ACE_YYDPRINTF ((stderr, "Shifting token %d (%s), ", - ace_yychar, ace_yytname[ace_yychar1])); + /* Shift the look-ahead token. */ + ACE_YY_SYMBOL_PRINT ("Shifting", ace_yytoken, &ace_yylval, &ace_yylloc); /* Discard the token being shifted unless it is eof. */ if (ace_yychar != ACE_YYEOF) ace_yychar = ACE_YYEMPTY; *++ace_yyvsp = ace_yylval; -#if ACE_YYLSP_NEEDED - *++ace_yylsp = ace_yylloc; -#endif + /* Count tokens shifted since error; after three, turn off error status. */ @@ -916,142 +1107,156 @@ ace_yyreduce: /* If ACE_YYLEN is nonzero, implement the default value of the action: `$$ = $1'. - Otherwise, the following line sets ACE_YYVAL to the semantic value of - the lookahead token. This behavior is undocumented and Bison + Otherwise, the following line sets ACE_YYVAL to garbage. + This behavior is undocumented and Bison users should not rely upon it. Assigning to ACE_YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that ACE_YYVAL may be used uninitialized. */ ace_yyval = ace_yyvsp[1-ace_yylen]; -#if ACE_YYLSP_NEEDED - /* Similarly for the default location. Let the user run additional - commands if for instance locations are ranges. */ - ace_yyloc = ace_yylsp[1-ace_yylen]; - ACE_YYLLOC_DEFAULT (ace_yyloc, (ace_yylsp - ace_yylen), ace_yylen); -#endif -#if ACE_YYDEBUG - /* We have to keep this `#if ACE_YYDEBUG', since we use variables which - are defined only if `ACE_YYDEBUG' is set. */ - if (ace_yydebug) + ACE_YY_REDUCE_PRINT (ace_yyn); + switch (ace_yyn) { - int ace_yyi; - - ACE_YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", - ace_yyn, ace_yyrline[ace_yyn]); - - /* Print the symbols being reduced, and their result. */ - for (ace_yyi = ace_yyprhs[ace_yyn]; ace_yyrhs[ace_yyi] > 0; ace_yyi++) - ACE_YYFPRINTF (stderr, "%s ", ace_yytname[ace_yyrhs[ace_yyi]]); - ACE_YYFPRINTF (stderr, " -> %s\n", ace_yytname[ace_yyr1[ace_yyn]]); - } -#endif - - switch (ace_yyn) { + case 2: -case 1: -{ - if (ace_yyvsp[0].parse_node_ != 0) + { + if ((ace_yyvsp[0].parse_node_) != 0) { - ace_yyvsp[0].parse_node_->apply (ACE_SVC_CONF_PARAM->yyerrno); delete ace_yyvsp[0].parse_node_; + (ace_yyvsp[0].parse_node_)->apply (ACE_SVC_CONF_PARAM->config, ACE_SVC_CONF_PARAM->yyerrno); + delete (ace_yyvsp[0].parse_node_); } ACE_SVC_CONF_PARAM->obstack.release (); - ; - break;} -case 2: -{ + ;} + break; + + case 3: + + { ACE_SVC_CONF_PARAM->obstack.release (); - ; - break;} -case 10: -{ - if (ace_yyvsp[-1].svc_record_ != 0) - ace_yyval.parse_node_ = new ACE_Dynamic_Node (ace_yyvsp[-1].svc_record_, ace_yyvsp[0].ident_); + ;} + break; + + case 11: + + { + if ((ace_yyvsp[-1].svc_record_) != 0) + (ace_yyval.parse_node_) = new ACE_Dynamic_Node ((ace_yyvsp[-1].svc_record_), (ace_yyvsp[0].ident_)); else - ace_yyval.parse_node_ = 0; - ; - break;} -case 11: -{ - ace_yyval.parse_node_ = new ACE_Static_Node (ace_yyvsp[-1].ident_, ace_yyvsp[0].ident_); - ; - break;} -case 12: -{ - ace_yyval.parse_node_ = new ACE_Suspend_Node (ace_yyvsp[0].ident_); - ; - break;} -case 13: -{ - ace_yyval.parse_node_ = new ACE_Resume_Node (ace_yyvsp[0].ident_); - ; - break;} -case 14: -{ - ace_yyval.parse_node_ = new ACE_Remove_Node (ace_yyvsp[0].ident_); - ; - break;} -case 15: -{ - ace_yyval.parse_node_ = new ACE_Stream_Node (ace_yyvsp[-1].static_node_, ace_yyvsp[0].parse_node_); - ; - break;} -case 16: -{ ace_yyval.static_node_ = new ACE_Static_Node (ace_yyvsp[0].ident_); ; - break;} -case 17: -{ - ace_yyval.parse_node_ = new ACE_Dummy_Node (ace_yyvsp[-1].static_node_, ace_yyvsp[0].parse_node_); - ; - break;} -case 18: -{ - ; - break;} -case 19: -{ - ; - break;} -case 20: -{ + (ace_yyval.parse_node_) = 0; + ;} + break; + + case 12: + + { + (ace_yyval.parse_node_) = new ACE_Static_Node ((ace_yyvsp[-1].ident_), (ace_yyvsp[0].ident_)); + ;} + break; + + case 13: + + { + (ace_yyval.parse_node_) = new ACE_Suspend_Node ((ace_yyvsp[0].ident_)); + ;} + break; + + case 14: + + { + (ace_yyval.parse_node_) = new ACE_Resume_Node ((ace_yyvsp[0].ident_)); + ;} + break; + + case 15: + + { + (ace_yyval.parse_node_) = new ACE_Remove_Node ((ace_yyvsp[0].ident_)); + ;} + break; + + case 16: + + { + (ace_yyval.parse_node_) = new ACE_Stream_Node ((ace_yyvsp[-1].static_node_), (ace_yyvsp[0].parse_node_)); + ;} + break; + + case 17: + + { (ace_yyval.static_node_) = new ACE_Static_Node ((ace_yyvsp[0].ident_)); ;} + break; + + case 18: + + { + (ace_yyval.parse_node_) = new ACE_Dummy_Node ((ace_yyvsp[-1].static_node_), (ace_yyvsp[0].parse_node_)); + ;} + break; + + case 19: + + { + ;} + break; + + case 20: + + { + ;} + break; + + case 21: + + { // Initialize left context... - ace_yyval.static_node_ = ace_yyvsp[-1].static_node_; - ; - break;} -case 21: -{ - ace_yyval.parse_node_ = ace_yyvsp[-1].parse_node_; - ; - break;} -case 22: -{ ace_yyval.parse_node_ = 0; ; - break;} -case 23: -{ - if (ace_yyvsp[0].parse_node_ != 0) + (ace_yyval.static_node_) = (ace_yyvsp[-1].static_node_); + ;} + break; + + case 22: + + { + (ace_yyval.parse_node_) = (ace_yyvsp[-1].parse_node_); + ;} + break; + + case 23: + + { (ace_yyval.parse_node_) = 0; ;} + break; + + case 24: + + { + if ((ace_yyvsp[0].parse_node_) != 0) { - ace_yyvsp[0].parse_node_->link (ace_yyvsp[-1].parse_node_); - ace_yyval.parse_node_ = ace_yyvsp[0].parse_node_; + (ace_yyvsp[0].parse_node_)->link ((ace_yyvsp[-1].parse_node_)); + (ace_yyval.parse_node_) = (ace_yyvsp[0].parse_node_); } - ; - break;} -case 24: -{ ace_yyval.parse_node_ = 0; ; - break;} -case 25: -{ - ACE_Static_Node *svc_type = ace_yyvsp[0].static_node_; + ;} + break; + + case 25: + + { (ace_yyval.parse_node_) = 0; ;} + break; + + case 26: + + { + ACE_Static_Node *svc_type = (ace_yyvsp[0].static_node_); if (svc_type != 0) { - ACE_Static_Node *module = ace_yyvsp[-2].static_node_; + ACE_Static_Node *module = (ace_yyvsp[-2].static_node_); ACE_ARGV args (svc_type->parameters ()); - ACE_Module_Type *mt = ace_get_module (module, - svc_type, + ACE_Module_Type *mt = ace_get_module (module->record (ACE_SVC_CONF_PARAM->config), + svc_type->record (ACE_SVC_CONF_PARAM->config), ACE_SVC_CONF_PARAM->yyerrno); ACE_Stream_Type *st = - dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (module->record ()->type ())); + dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (module->record (ACE_SVC_CONF_PARAM->config)->type ())); if (mt->init (args.argc (), args.argv ()) == -1 || st->push (mt) == -1) @@ -1062,50 +1267,61 @@ case 25: ACE_SVC_CONF_PARAM->yyerrno++; } } - ; - break;} -case 26: -{ - ACE_Module_Type *mt = ace_get_module (ace_yyvsp[-2].static_node_, - ace_yyvsp[0].static_node_->name (), + ;} + break; + + case 27: + + { + ACE_Static_Node *sn = (ace_yyvsp[-2].static_node_); + ACE_Module_Type *mt = ace_get_module (sn->record (ACE_SVC_CONF_PARAM->config), + (ace_yyvsp[0].static_node_)->name (), ACE_SVC_CONF_PARAM->yyerrno); - if (((ACE_Stream_Type *) (ace_yyvsp[-2].static_node_)->record ()->type ())->push (mt) == -1) + if (((ACE_Stream_Type *) sn->record (ACE_SVC_CONF_PARAM->config)->type ())->push (mt) == -1) { ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("Problem with static\n"))); ACE_SVC_CONF_PARAM->yyerrno++; } - ; - break;} -case 27: -{ - ACE_Module_Type *mt = ace_get_module (ace_yyvsp[-2].static_node_, - ace_yyvsp[0].static_node_->name (), + ;} + break; + + case 28: + + { + ACE_Static_Node *sn = (ace_yyvsp[-2].static_node_); + ACE_Module_Type *mt = ace_get_module (sn->record (ACE_SVC_CONF_PARAM->config), + sn->name (), ACE_SVC_CONF_PARAM->yyerrno); if (mt != 0) mt->suspend (); - ; - break;} -case 28: -{ - ACE_Module_Type *mt = ace_get_module (ace_yyvsp[-2].static_node_, - ace_yyvsp[0].static_node_->name (), + ;} + break; + + case 29: + + { + ACE_Static_Node *sn = (ace_yyvsp[-2].static_node_); + ACE_Module_Type *mt = ace_get_module (sn->record (ACE_SVC_CONF_PARAM->config), + (ace_yyvsp[0].static_node_)->name (), ACE_SVC_CONF_PARAM->yyerrno); if (mt != 0) mt->resume (); - ; - break;} -case 29: -{ - ACE_Static_Node *stream = ace_yyvsp[-2].static_node_; - ACE_Static_Node *module = ace_yyvsp[0].static_node_; - ACE_Module_Type *mt = ace_get_module (stream, + ;} + break; + + case 30: + + { + ACE_Static_Node *stream = (ace_yyvsp[-2].static_node_); + ACE_Static_Node *module = (ace_yyvsp[0].static_node_); + ACE_Module_Type *mt = ace_get_module (stream->record (ACE_SVC_CONF_PARAM->config), module->name (), ACE_SVC_CONF_PARAM->yyerrno); ACE_Stream_Type *st = - dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (stream->record ()->type ())); + dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (stream->record (ACE_SVC_CONF_PARAM->config)->type ())); if (mt != 0 && st->remove (mt) == -1) { ACE_ERROR ((LM_ERROR, @@ -1114,116 +1330,98 @@ case 29: stream->name ())); ACE_SVC_CONF_PARAM->yyerrno++; } - ; - break;} -case 30: -{ - u_int flags - = ACE_Service_Type::DELETE_THIS - | (ace_yyvsp[-1].location_node_->dispose () == 0 ? 0 : ACE_Service_Type::DELETE_OBJ); - ACE_Service_Object_Exterminator gobbler = 0; - void *sym = ace_yyvsp[-1].location_node_->symbol (ACE_SVC_CONF_PARAM->yyerrno, &gobbler); + ;} + break; - if (sym != 0) - { - ACE_Service_Type_Impl *stp - = ACE_Service_Config::create_service_type_impl (ace_yyvsp[-3].ident_, - ace_yyvsp[-2].type_, - sym, - flags, - gobbler); - if (stp == 0) - ++ACE_SVC_CONF_PARAM->yyerrno; - - ace_yyval.svc_record_ = new ACE_Service_Type (ace_yyvsp[-3].ident_, - stp, - ace_yyvsp[-1].location_node_->dll (), - ace_yyvsp[0].type_); - } - else - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("Unable to find service: %s\n"), - ace_yyvsp[-3].ident_)); - ++ACE_SVC_CONF_PARAM->yyerrno; - ace_yyval.svc_record_ = 0; - } - delete ace_yyvsp[-1].location_node_; - ; - break;} -case 31: -{ - ace_yyval.type_ = 1; - ; - break;} -case 32: -{ - ace_yyval.type_ = 0; - ; - break;} -case 33: -{ - ace_yyval.type_ = 1; - ; - break;} -case 34: -{ - ace_yyval.location_node_ = new ACE_Object_Node (ace_yyvsp[-2].ident_, ace_yyvsp[0].ident_); - ; - break;} -case 35: -{ - ace_yyval.location_node_ = new ACE_Function_Node (ace_yyvsp[-4].ident_, ace_yyvsp[-2].ident_); - ; - break;} -case 36: -{ - ace_yyval.location_node_ = new ACE_Static_Function_Node (ace_yyvsp[-2].ident_); - ; - break;} -case 37: -{ - ace_yyval.type_ = ACE_MODULE_T; - ; - break;} -case 38: -{ - ace_yyval.type_ = ACE_SVC_OBJ_T; - ; - break;} -case 39: -{ - ace_yyval.type_ = ACE_STREAM_T; - ; - break;} -case 41: -{ ace_yyval.ident_ = 0; ; - break;} -} + case 31: + + { + (ace_yyval.svc_record_) = new ACE_Service_Type_Factory ((ace_yyvsp[-3].ident_), (ace_yyvsp[-2].type_), (ace_yyvsp[-1].location_node_), (ace_yyvsp[0].type_)); + ;} + break; + case 32: - - ace_yyvsp -= ace_yylen; - ace_yyssp -= ace_yylen; -#if ACE_YYLSP_NEEDED - ace_yylsp -= ace_yylen; -#endif + { + (ace_yyval.type_) = 1; + ;} + break; + + case 33: -#if ACE_YYDEBUG - if (ace_yydebug) { - short *ace_yyssp1 = ace_yyss - 1; - ACE_YYFPRINTF (stderr, "state stack now"); - while (ace_yyssp1 != ace_yyssp) - ACE_YYFPRINTF (stderr, " %d", *++ace_yyssp1); - ACE_YYFPRINTF (stderr, "\n"); + (ace_yyval.type_) = 0; + ;} + break; + + case 34: + + { + (ace_yyval.type_) = 1; + ;} + break; + + case 35: + + { + (ace_yyval.location_node_) = new ACE_Object_Node ((ace_yyvsp[-2].ident_), (ace_yyvsp[0].ident_)); + ;} + break; + + case 36: + + { + (ace_yyval.location_node_) = new ACE_Function_Node ((ace_yyvsp[-4].ident_), (ace_yyvsp[-2].ident_)); + ;} + break; + + case 37: + + { + (ace_yyval.location_node_) = new ACE_Static_Function_Node ((ace_yyvsp[-2].ident_)); + ;} + break; + + case 38: + + { + (ace_yyval.type_) = ACE_MODULE_T; + ;} + break; + + case 39: + + { + (ace_yyval.type_) = ACE_SVC_OBJ_T; + ;} + break; + + case 40: + + { + (ace_yyval.type_) = ACE_STREAM_T; + ;} + break; + + case 42: + + { (ace_yyval.ident_) = 0; ;} + break; + + } -#endif + +/* Line 1037 of yacc.c. */ + + + ace_yyvsp -= ace_yylen; + ace_yyssp -= ace_yylen; + + + ACE_YY_STACK_PRINT (ace_yyss, ace_yyssp); *++ace_yyvsp = ace_yyval; -#if ACE_YYLSP_NEEDED - *++ace_yylsp = ace_yyloc; -#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 @@ -1231,11 +1429,11 @@ case 41: ace_yyn = ace_yyr1[ace_yyn]; - ace_yystate = ace_yypgoto[ace_yyn - ACE_YYNTBASE] + *ace_yyssp; - if (ace_yystate >= 0 && ace_yystate <= ACE_YYLAST && ace_yycheck[ace_yystate] == *ace_yyssp) + ace_yystate = ace_yypgoto[ace_yyn - ACE_YYNTOKENS] + *ace_yyssp; + if (0 <= ace_yystate && ace_yystate <= ACE_YYLAST && ace_yycheck[ace_yystate] == *ace_yyssp) ace_yystate = ace_yytable[ace_yystate]; else - ace_yystate = ace_yydefgoto[ace_yyn - ACE_YYNTBASE]; + ace_yystate = ace_yydefgoto[ace_yyn - ACE_YYNTOKENS]; goto ace_yynewstate; @@ -1248,155 +1446,159 @@ ace_yyerrlab: if (!ace_yyerrstatus) { ++ace_yynerrs; - -#ifdef ACE_YYERROR_VERBOSE +#if ACE_YYERROR_VERBOSE ace_yyn = ace_yypact[ace_yystate]; - if (ace_yyn > ACE_YYFLAG && ace_yyn < ACE_YYLAST) - { - ACE_YYSIZE_T ace_yysize = 0; - ACE_TCHAR *ace_yymsg; - int ace_yyx, ace_yycount; - - ace_yycount = 0; - /* Start ACE_YYX at -ACE_YYN if negative to avoid negative indexes in - ACE_YYCHECK. */ - for (ace_yyx = ace_yyn < 0 ? -ace_yyn : 0; - ace_yyx < (int) (sizeof (ace_yytname) / sizeof (ACE_TCHAR *)); ace_yyx++) - if (ace_yycheck[ace_yyx + ace_yyn] == ace_yyx) - ace_yysize += ace_yystrlen (ace_yytname[ace_yyx]) + 15, ace_yycount++; - ace_yysize += ace_yystrlen ("parse error, unexpected ") + 1; - ace_yysize += ace_yystrlen (ace_yytname[ACE_YYTRANSLATE (ace_yychar)]); - ace_yymsg = (ACE_TCHAR *) ACE_YYSTACK_ALLOC (ace_yysize); - if (ace_yymsg != 0) - { - ACE_TCHAR *ace_yyp = ace_yystpcpy (ace_yymsg, "parse error, unexpected "); - ace_yyp = ace_yystpcpy (ace_yyp, ace_yytname[ACE_YYTRANSLATE (ace_yychar)]); - - if (ace_yycount < 5) - { - ace_yycount = 0; - for (ace_yyx = ace_yyn < 0 ? -ace_yyn : 0; - ace_yyx < (int) (sizeof (ace_yytname) / sizeof (ACE_TCHAR *)); - ace_yyx++) - if (ace_yycheck[ace_yyx + ace_yyn] == ace_yyx) - { - const ACE_TCHAR *ace_yyq = ! ace_yycount ? ", expecting " : " or "; - ace_yyp = ace_yystpcpy (ace_yyp, ace_yyq); - ace_yyp = ace_yystpcpy (ace_yyp, ace_yytname[ace_yyx]); - ace_yycount++; - } - } - ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, ace_yymsg); - ACE_YYSTACK_FREE (ace_yymsg); - } - else - ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, "parse error; also virtual memory exhausted"); - } + if (ACE_YYPACT_NINF < ace_yyn && ace_yyn < ACE_YYLAST) + { + ACE_YYSIZE_T ace_yysize = 0; + int ace_yytype = ACE_YYTRANSLATE (ace_yychar); + const char* ace_yyprefix; + char *ace_yymsg; + int ace_yyx; + + /* Start ACE_YYX at -ACE_YYN if negative to avoid negative indexes in + ACE_YYCHECK. */ + int ace_yyxbegin = ace_yyn < 0 ? -ace_yyn : 0; + + /* Stay within bounds of both ace_yycheck and ace_yytname. */ + int ace_yychecklim = ACE_YYLAST - ace_yyn; + int ace_yyxend = ace_yychecklim < ACE_YYNTOKENS ? ace_yychecklim : ACE_YYNTOKENS; + int ace_yycount = 0; + + ace_yyprefix = ", expecting "; + for (ace_yyx = ace_yyxbegin; ace_yyx < ace_yyxend; ++ace_yyx) + if (ace_yycheck[ace_yyx + ace_yyn] == ace_yyx && ace_yyx != ACE_YYTERROR) + { + ace_yysize += ace_yystrlen (ace_yyprefix) + ace_yystrlen (ace_yytname [ace_yyx]); + ace_yycount += 1; + if (ace_yycount == 5) + { + ace_yysize = 0; + break; + } + } + ace_yysize += (sizeof ("syntax error, unexpected ") + + ace_yystrlen (ace_yytname[ace_yytype])); + ace_yymsg = (ACE_TCHAR *) ACE_YYSTACK_ALLOC (ace_yysize); + if (ace_yymsg != 0) + { + char *ace_yyp = ace_yystpcpy (ace_yymsg, "syntax error, unexpected "); + ace_yyp = ace_yystpcpy (ace_yyp, ace_yytname[ace_yytype]); + + if (ace_yycount < 5) + { + ace_yyprefix = ", expecting "; + for (ace_yyx = ace_yyxbegin; ace_yyx < ace_yyxend; ++ace_yyx) + if (ace_yycheck[ace_yyx + ace_yyn] == ace_yyx && ace_yyx != ACE_YYTERROR) + { + ace_yyp = ace_yystpcpy (ace_yyp, ace_yyprefix); + ace_yyp = ace_yystpcpy (ace_yyp, ace_yytname[ace_yyx]); + ace_yyprefix = " or "; + } + } + ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, ace_yymsg); + ACE_YYSTACK_FREE (ace_yymsg); + } + else + ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, "syntax error; also virtual memory exhausted"); + } else -#endif /* defined (ACE_YYERROR_VERBOSE) */ - ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, "parse error"); +#endif /* ACE_YYERROR_VERBOSE */ + ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, "syntax error"); } - goto ace_yyerrlab1; -/*--------------------------------------------------. -| ace_yyerrlab1 -- error raised explicitly by an action | -`--------------------------------------------------*/ -ace_yyerrlab1: + if (ace_yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - /* return failure if at end of input */ - if (ace_yychar == ACE_YYEOF) - ACE_YYABORT; - ACE_YYDPRINTF ((stderr, "Discarding token %d (%s).\n", - ace_yychar, ace_yytname[ace_yychar1])); - ace_yychar = ACE_YYEMPTY; + /* If just tried and failed to reuse look-ahead token after an + error, discard it. */ + + if (ace_yychar <= ACE_YYEOF) + { + /* If at end of input, pop the error token, + then the rest of the stack, then return failure. */ + if (ace_yychar == ACE_YYEOF) + for (;;) + { + + ACE_YYPOPSTACK; + if (ace_yyssp == ace_yyss) + ACE_YYABORT; + ace_yydestruct ("Error: popping", + ace_yystos[*ace_yyssp], ace_yyvsp); + } + } + else + { + ace_yydestruct ("Error: discarding", ace_yytoken, &ace_yylval); + ace_yychar = ACE_YYEMPTY; + } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ - - ace_yyerrstatus = 3; /* Each real token shifted decrements this */ - - goto ace_yyerrhandle; + goto ace_yyerrlab1; -/*-------------------------------------------------------------------. -| ace_yyerrdefault -- current state does not do anything special for the | -| error token. | -`-------------------------------------------------------------------*/ -ace_yyerrdefault: -#if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ +/*---------------------------------------------------. +| ace_yyerrorlab -- error raised explicitly by ACE_YYERROR. | +`---------------------------------------------------*/ +ace_yyerrorlab: - /* If its default is to accept any token, ok. Otherwise pop it. */ - ace_yyn = ace_yydefact[ace_yystate]; - if (ace_yyn) - goto ace_yydefault; +#ifdef __GNUC__ + /* Pacify GCC when the user code never invokes ACE_YYERROR and the label + ace_yyerrorlab therefore never appears in user code. */ + if (0) + goto ace_yyerrorlab; #endif +ace_yyvsp -= ace_yylen; + ace_yyssp -= ace_yylen; + ace_yystate = *ace_yyssp; + goto ace_yyerrlab1; -/*---------------------------------------------------------------. -| ace_yyerrpop -- pop the current state because it cannot handle the | -| error token | -`---------------------------------------------------------------*/ -ace_yyerrpop: - if (ace_yyssp == ace_yyss) - ACE_YYABORT; - ace_yyvsp--; - ace_yystate = *--ace_yyssp; -#if ACE_YYLSP_NEEDED - ace_yylsp--; -#endif -#if ACE_YYDEBUG - if (ace_yydebug) +/*-------------------------------------------------------------. +| ace_yyerrlab1 -- common code for both syntax error and ACE_YYERROR. | +`-------------------------------------------------------------*/ +ace_yyerrlab1: + ace_yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) { - short *ace_yyssp1 = ace_yyss - 1; - ACE_YYFPRINTF (stderr, "Error: state stack now"); - while (ace_yyssp1 != ace_yyssp) - ACE_YYFPRINTF (stderr, " %d", *++ace_yyssp1); - ACE_YYFPRINTF (stderr, "\n"); - } -#endif + ace_yyn = ace_yypact[ace_yystate]; + if (ace_yyn != ACE_YYPACT_NINF) + { + ace_yyn += ACE_YYTERROR; + if (0 <= ace_yyn && ace_yyn <= ACE_YYLAST && ace_yycheck[ace_yyn] == ACE_YYTERROR) + { + ace_yyn = ace_yytable[ace_yyn]; + if (0 < ace_yyn) + break; + } + } -/*--------------. -| ace_yyerrhandle. | -`--------------*/ -ace_yyerrhandle: - ace_yyn = ace_yypact[ace_yystate]; - if (ace_yyn == ACE_YYFLAG) - goto ace_yyerrdefault; + /* Pop the current state because it cannot handle the error token. */ + if (ace_yyssp == ace_yyss) + ACE_YYABORT; - ace_yyn += ACE_YYTERROR; - if (ace_yyn < 0 || ace_yyn > ACE_YYLAST || ace_yycheck[ace_yyn] != ACE_YYTERROR) - goto ace_yyerrdefault; - ace_yyn = ace_yytable[ace_yyn]; - if (ace_yyn < 0) - { - if (ace_yyn == ACE_YYFLAG) - goto ace_yyerrpop; - ace_yyn = -ace_yyn; - goto ace_yyreduce; + ace_yydestruct ("Error: popping", ace_yystos[ace_yystate], ace_yyvsp); + ACE_YYPOPSTACK; + ace_yystate = *ace_yyssp; + ACE_YY_STACK_PRINT (ace_yyss, ace_yyssp); } - else if (ace_yyn == 0) - goto ace_yyerrpop; if (ace_yyn == ACE_YYFINAL) ACE_YYACCEPT; - ACE_YYDPRINTF ((stderr, "Shifting error token, ")); - *++ace_yyvsp = ace_yylval; -#if ACE_YYLSP_NEEDED - *++ace_yylsp = ace_yylloc; -#endif + + + /* Shift the error token. */ + ACE_YY_SYMBOL_PRINT ("Shifting", ace_yystos[ace_yyn], ace_yyvsp, ace_yylsp); ace_yystate = ace_yyn; goto ace_yynewstate; @@ -1413,16 +1615,21 @@ ace_yyacceptlab: | ace_yyabortlab -- ACE_YYABORT comes here. | `-----------------------------------*/ ace_yyabortlab: + ace_yydestruct ("Error: discarding lookahead", + ace_yytoken, &ace_yylval); + ace_yychar = ACE_YYEMPTY; ace_yyresult = 1; goto ace_yyreturn; -/*---------------------------------------------. -| ace_yyoverflowab -- parser overflow comes here. | -`---------------------------------------------*/ +#ifndef ace_yyoverflow +/*----------------------------------------------. +| ace_yyoverflowlab -- parser overflow comes here. | +`----------------------------------------------*/ ace_yyoverflowlab: ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, "parser stack overflow"); ace_yyresult = 2; /* Fall through. */ +#endif ace_yyreturn: #ifndef ace_yyoverflow @@ -1432,6 +1639,12 @@ ace_yyreturn: return ace_yyresult; } + + + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Prints the error string to standard output. Cleans up the error // messages. @@ -1455,11 +1668,10 @@ ace_yyerror (int ace_yyerrno, int ace_yylineno, const char *s) // record. static ACE_Module_Type * -ace_get_module (ACE_Static_Node *str_rec, +ace_get_module (const ACE_Service_Type *sr, const ACE_TCHAR *svc_name, int & ace_yyerrno) { - const ACE_Service_Type *sr = str_rec->record (); const ACE_Service_Type_Impl *type = sr->type (); ACE_Stream_Type *st = sr == 0 ? 0 @@ -1471,7 +1683,7 @@ ace_get_module (ACE_Static_Node *str_rec, ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("cannot locate Module_Type %s in STREAM_Type %s\n"), svc_name, - str_rec->name ())); + sr->name ())); ace_yyerrno++; } @@ -1479,24 +1691,23 @@ ace_get_module (ACE_Static_Node *str_rec, } static ACE_Module_Type * -ace_get_module (ACE_Static_Node *str_rec, - ACE_Static_Node *svc_type, +ace_get_module (const ACE_Service_Type *sr, + const ACE_Service_Type *sv, int & ace_yyerrno) { - const ACE_Service_Type *sr = str_rec->record (); const ACE_Service_Type_Impl *type = sr->type (); ACE_Stream_Type *st = sr == 0 ? 0 : (ACE_Stream_Type *) type; - const ACE_Service_Type *sv = svc_type->record (); + type = sv->type (); ACE_Module_Type *mt = (ACE_Module_Type *) type; - const ACE_TCHAR *module_type_name = svc_type->name (); + const ACE_TCHAR *module_type_name = sr->name (); if (sr == 0 || st == 0 || mt == 0) { ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("cannot locate Module_Type %s or STREAM_Type %s\n"), module_type_name, - str_rec->name ())); + sr->name ())); ace_yyerrno++; } diff --git a/ace/Timer_Heap_T.h b/ace/Timer_Heap_T.h index 068aa0bfb67..efe29a0f5f3 100644 --- a/ace/Timer_Heap_T.h +++ b/ace/Timer_Heap_T.h @@ -61,7 +61,7 @@ public: virtual ACE_Timer_Node_T<TYPE> *item (void); protected: - /// Pointer to the <ACE_Timer_Heap> that we are iterating over. + /// Pointer to the ACE_Timer_Heap that we are iterating over. ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK> &timer_heap_; /// Position in the array where the iterator is at diff --git a/ace/Timer_List_T.h b/ace/Timer_List_T.h index 3b85b985801..763ef9c905c 100644 --- a/ace/Timer_List_T.h +++ b/ace/Timer_List_T.h @@ -75,11 +75,11 @@ protected: * expiring timers is O(K) (where K is the total number of timers * that are < the current time of day). * More clever implementations could use a delta-list, a heap, - * or timing wheels, etc. For instance, <ACE_Timer_Heap> - * is a subclass of <ACE_Timer_List> that implements a + * or timing wheels, etc. For instance, ACE_Timer_Heap + * is a subclass of ACE_Timer_List that implements a * heap-based callout queue. For most applications, the - * <ACE_Timer_Heap> will perform substantially faster than the - * <ACE_Timer_List>. + * ACE_Timer_Heap will perform substantially faster than the + * ACE_Timer_List. */ template <class TYPE, class FUNCTOR, class ACE_LOCK> class ACE_Timer_List_T : public ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> diff --git a/ace/Timer_Queue_Adapters.h b/ace/Timer_Queue_Adapters.h index d2ff5946c3a..ab25c490737 100644 --- a/ace/Timer_Queue_Adapters.h +++ b/ace/Timer_Queue_Adapters.h @@ -82,18 +82,18 @@ private: /// Perform the logic to compute the new ualarm(2) setting. virtual int schedule_ualarm (void); - /// Called back by <SIGALRM> handler. + /// Called back by @c SIGALRM handler. virtual int handle_signal (int signum, siginfo_t *, ucontext_t *); - /// Handler for the <SIGALRM> signal, so that we can access our state + /// Handler for the @c SIGALRM signal, so that we can access our state /// without requiring any global variables. ACE_Sig_Handler sig_handler_; - /// Implementation of the timer queue (e.g., <ACE_Timer_List>, - /// <ACE_Timer_Heap>, etc.). + /// Implementation of the timer queue (e.g., ACE_Timer_List, + /// ACE_Timer_Heap, etc.). TQ timer_queue_; - /// Mask of signals to be blocked when we're servicing <SIGALRM>. + /// Mask of signals to be blocked when we're servicing @c SIGALRM. ACE_Sig_Set mask_; }; diff --git a/ace/Timer_Queue_T.h b/ace/Timer_Queue_T.h index 604079a41da..f780d8a5240 100644 --- a/ace/Timer_Queue_T.h +++ b/ace/Timer_Queue_T.h @@ -200,8 +200,8 @@ public: * @brief Provides an interface to timers. * * This is an abstract base class that provides hook for - * implementing specialized policies such as <ACE_Timer_List> - * and <ACE_Timer_Heap>. + * implementing specialized policies such as ACE_Timer_List + * and ACE_Timer_Heap. */ template <class TYPE, class FUNCTOR, class ACE_LOCK> class ACE_Timer_Queue_T diff --git a/ace/Timer_Wheel_T.h b/ace/Timer_Wheel_T.h index 5c62a39dde0..984ad6d8bb7 100644 --- a/ace/Timer_Wheel_T.h +++ b/ace/Timer_Wheel_T.h @@ -62,7 +62,7 @@ public: virtual ACE_Timer_Node_T<TYPE>* item (void); protected: - /// Pointer to the <ACE_Timer_List> that we are iterating over. + /// Pointer to the ACE_Timer_List that we are iterating over. Wheel& timer_wheel_; /// Current position in the timing wheel diff --git a/ace/config-openvms.h b/ace/config-openvms.h index 2b62888e805..8e98becb755 100644 --- a/ace/config-openvms.h +++ b/ace/config-openvms.h @@ -6,6 +6,10 @@ #ifndef ACE_CONFIG_H #define ACE_CONFIG_H +#if !defined (ACE_USE_RCSID) +# define ACE_USE_RCSID 0 +#endif + #pragma message disable CODCAUUNR #pragma message disable CODEUNREACHABLE //#pragma message disable DOLLARID @@ -15,38 +19,29 @@ //#pragma message disable LONGEXTERN #pragma message disable UNSCOMZER -//#define MAXPATHLEN 255 -//#define howmany __howmany -//#define MAXHOSTNAMELEN 255 -//#define MAXNAMLEN FILENAME_MAX -//#define __unix__ +#define ACE_OPENVMS 0x0821 -#define ACE_OPENVMS #define ACE_DLL_SUFFIX ACE_LIB_TEXT("") #define ACE_HAS_DUMP 1 -//#define ACE_NEEDS_PTHREAD_UPPERCASE 1 - -/* -#define XtAppAddInput XTAPPADDINPUT -#define XtAppAddTimeOut XTAPPADDTIMEOUT -#define XtAppProcessEvent XTAPPPROCESSEVENT -#define XtRemoveInput XTREMOVEINPUT -#define XtRemoveTimeOut XTREMOVETIMEOUT -*/ - // need this includes to ensure proper sequence of definitions so that // f.i. HP C/C++ does not '#define ' memcpy, memmove etc. #include <stdarg.h> #include <stdio.h> #include <string.h> #undef clearerr +#undef memset +#undef memcpy +#undef memmove #define ACE_DEFAULT_BASE_ADDR ((char*)(0x30000000)) +#define ACE_MAX_UDP_PACKET_SIZE 65535 + #define ACE_HAS_STDCPP_STL_INCLUDES 1 +/* missing system headers */ #define ACE_LACKS_STDINT_H 1 #define ACE_LACKS_SYS_IPC_H 1 #define ACE_LACKS_SYS_SEM_H 1 @@ -57,7 +52,21 @@ #define ACE_LACKS_SYS_MSG_H 1 #define ACE_LACKS_REGEX_H 1 #define ACE_LACKS_SEARCH_H 1 +#define ACE_LACKS_SCHED_H 1 +#define ACE_LACKS_SYS_SYSCTL_H 1 +#define ACE_LACKS_MALLOC_H 1 + /*Platform lacks malloc.h*/ +#define ACE_LACKS_SYS_PARAM_H 1 + /*Platform lacks <sys/param.h> + (e.g., MVS)*/ +#define ACE_LACKS_SIGINFO_H 1 + /*Platform lacks the siginfo.h + include file (e.g., MVS)*/ +#define ACE_LACKS_UCONTEXT_H 1 + /*Platform lacks the ucontext.h + file*/ +/* missing rtl functions */ #define ACE_LACKS_SETPGID 1 #define ACE_LACKS_SETREUID 1 #define ACE_LACKS_SETREGID 1 @@ -65,90 +74,41 @@ #define ACE_LACKS_GETPGID 1 #define ACE_LACKS_SETSID 1 #define ACE_LACKS_FCNTL 1 +#define ACE_LACKS_SETEGID 1 +#define ACE_LACKS_SETEUID 1 #define ACE_LACKS_REALPATH 1 -#define ACE_LACKS_SYMLINKS - -#define ACE_LACKS_TIMESPEC_T 1 -#define ACE_LACKS_CONST_TIMESPEC_PTR 1 - -#define ACE_LACKS_RWLOCK_T 1 -//#define ACE_HAS_PTHREADS_UNIX98_EXT 1 -//#define ACE_LACKS_MUTEXATTR_PSHARED 1 -//#define ACE_LACKS_CONDATTR_PSHARED 1 -#define ACE_LACKS_PTHREAD_KILL 1 -#define ACE_LACKS_THREAD_PROCESS_SCOPING 1 -#define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 +#define ACE_LACKS_SYMLINKS 1 #define ACE_LACKS_PWD_REENTRANT_FUNCTIONS 1 #define ACE_LACKS_RAND_REENTRANT_FUNCTIONS 1 -#define ACE_LACKS_UNIX_SIGNALS 1 - -#define ACE_LACKS_UNNAMED_SEMAPHORE 1 - -#define ACE_MT_SAFE 1 - /*Compile using multi-thread libraries*/ -#define ACE_NEW_THROWS_EXCEPTIONS 1 - /*Compiler's 'new' throws exception on - failure (ANSI C++ behavior).*/ -#define ACE_TEMPLATES_REQUIRE_SOURCE 1 - /*Compiler's template mechanim - must see source code (i.e., - .cpp files). This is used for - GNU G++.*/ -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 - /*Platform has its standard c++ - library in the namespace std.*/ -#define ACE_HAS_VOIDPTR_GETTIMEOFDAY 1 - /* 2nd arg 'void*' instead of 'struct timezone*' */ #define ACE_HAS_SNPRINTF 1 /*Platform offers snprintf().*/ #define ACE_HAS_P_READ_WRITE /*Platform has pread() and pwrite() support*/ -#define ACE_HAS_AUTOMATIC_INIT_FINI 1 - /*Compiler/platform correctly - calls init()/fini() for shared - libraries*/ #define ACE_HAS_CHARPTR_DL 1 /*OS/platform uses char * for dlopen/dlsym args, rather than const char *.*/ #define ACE_HAS_CLOCK_GETTIME 1 - /*Platform supports POSIX.1b + /*Platform supports POSIX 1.b clock_gettime ()*/ #define ACE_HAS_CLOCK_SETTIME 1 /*Platform supports POSIX.1b clock_settime ()*/ -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES 1 - /*Prototypes for both signal() - and struct sigaction are - consistent.*/ -#define ACE_HAS_CPLUSPLUS_HEADERS 1 - /*Compiler/platform has - correctly prototyped header - files*/ +#define ACE_HAS_VOIDPTR_GETTIMEOFDAY 1 + /* 2nd arg 'void*' instead of 'struct timezone*' */ #define ACE_HAS_DIRENT 1 /*Compiler/platform has Dirent iterator functions*/ -#define ACE_HAS_EXCEPTIONS 1 - /*Compiler supports C++ - exception handling*/ #define ACE_HAS_GETPAGESIZE 1 /*Platform supports getpagesize() call (otherwise, ACE_PAGE_SIZE must be defined, except on Win32)*/ -#define ACE_HAS_GPERF 1 - /*The GPERF utility is compiled - for this platform*/ -#define ACE_HAS_IDTYPE_T 1 - /*Compiler/platform supports - idtype_t.*/ -#define ACE_HAS_IP_MULTICAST 1 - /*Platform supports IP multicast*/ #define ACE_HAS_MEMCHR 1 /*Use native implementation of memchr.*/ #define ACE_HAS_MSG @@ -168,40 +128,6 @@ 1994 in the ISO C standard Normative Addendum 1. Other standards like XPG4 define a 2 parameter wcstok().*/ -#define ACE_HAS_POSIX_NONBLOCK 1 - /*Platform supports POSIX - O_NONBLOCK semantics*/ -#define ACE_HAS_POSIX_TIME 1 - /*Platform supports the POSIX - struct timespec type*/ -#define ACE_HAS_PTHREADS 1 - /*Platform supports POSIX - Pthreads, of one form or - another. This macro says the - platform has a pthreads - variety - should also define - one of the below to say which - one. Also may need some - ACE_HAS_... thing for - extensions.*/ -#define ACE_HAS_PTHREADS_STD 1 - /*Platform supports POSIX.1c-1995 threads - (This is the final standard - Pthreads).*/ -#define ACE_HAS_PTHREAD_PROCESS_ENUM 1 - /*pthread.h declares an enum with - PTHREAD_PROCESS_PRIVATE and - PTHREAD_PROCESS_SHARED values.*/ -#define ACE_HAS_XPG4_MULTIBYTE_CHAR 1 - /*Platform has support for - multi-byte character support - compliant with the XPG4 - Worldwide Portability - Interface wide-character - classification.*/ -#define ACE_HAS_SIGINFO_T 1 - /*Platform supports SVR4 - extended signals*/ #define ACE_HAS_SIGSUSPEND 1 /*Platform supports sigsuspend()*/ #define ACE_HAS_SIG_MACROS 1 @@ -216,54 +142,12 @@ #define ACE_HAS_SIG_C_FUNC 1 /*Compiler requires extern "C" functions for signals.*/ -#define ACE_HAS_SIZET_SOCKET_LEN 1 - /*OS/compiler uses size_t * - rather than int * for socket - lengths*/ -#define ACE_HAS_SSIZE_T 1 - /*Compiler supports the ssize_t - typedef*/ -#define ACE_HAS_STRPTIME 1 - /*Enables ACE_OS::strptime ().*/ -#define ACE_HAS_STANDARD_CPP_LIBRARY 1 - /*Platform/compiler supports - Standard C++ Library*/ #define ACE_HAS_STRNLEN 1 /*Platform supports strnlen(3).*/ #define ACE_HAS_STREAMS 1 /*Platform supports STREAMS*/ #define ACE_HAS_STRERROR 1 /*Compiler/platform supports strerror ()*/ -#define ACE_HAS_STRING_CLASS 1 - /*Platform/Compiler supports a - String class (e.g., GNU or - Win32).*/ -#define ACE_HAS_SVR4_DYNAMIC_LINKING 1 - /*Compiler/platform supports - SVR4 dynamic linking semantics*/ -#define ACE_HAS_TEMPLATE_SPECIALIZATION 1 - /*Compiler implements template - specialization*/ - -#define ACE_HAS_TEMPLATE_TYPEDEFS 1 - /*Compiler implements templates - that support typedefs inside - of classes used as formal - arguments to a template - class.*/ -#define ACE_HAS_THREADS 1 - /*Platform supports threads*/ -#define ACE_HAS_THREAD_SPECIFIC_STORAGE 1 - /*Compiler/platform has - thread-specific storage*/ -#define ACE_HAS_THR_C_DEST 1 - /*The pthread_keycreate() - routine *must* take extern C - functions.*/ -#define ACE_HAS_THR_C_FUNC 1 - /*The pthread_create() routine - *must* take extern C - functions.*/ #define ACE_HAS_UALARM 1 /*Platform supports ualarm()*/ #define ACE_HAS_VOIDPTR_MMAP 1 @@ -278,12 +162,9 @@ #define ACE_LACKS_MADVISE 1 /*Platform lacks madvise() (e.g., Linux)*/ -#define ACE_LACKS_MALLOC_H 1 - /*Platform lacks malloc.h*/ #define ACE_LACKS_MKFIFO 1 -#define ACE_LACKS_NAMED_POSIX_SEM 1 - /*Platform lacks named POSIX - semaphores (e.g., Chorus)*/ + /*Platform lacks mkfifo() e.g., + VxWorks, Chorus, pSoS, and WinNT.*/ #define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS 1 /*Platform does not support reentrant netdb functions @@ -292,18 +173,6 @@ gethostbyaddr_r, gethostbyname_r, getservbyname_r).*/ -#define ACE_LACKS_SYS_PARAM_H 1 - /*Platform lacks <sys/param.h> - (e.g., MVS)*/ -#define ACE_LACKS_PRI_T 1 - /*Platform lacks pri_t (e.g., - Tandem NonStop UNIX).*/ -#define ACE_LACKS_PTHREAD_SIGMASK 1 - /*Platform lacks pthread_sigmask ().*/ -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1 - /*Platform lacks - pthread_thr_sigsetmask (e.g., - MVS, HP/UX, and OSF/1 3.2)*/ #define ACE_LACKS_READLINK 1 /*Platform lacks the readlink() function.*/ #define ACE_LACKS_RLIMIT 1 @@ -315,144 +184,188 @@ /*Platform/compiler lacks {get,set}rlimit() prototypes (e.g., Tandem)*/ -#define ACE_LACKS_SEMBUF_T 1 - /*Platform lacks struct sembuf - (e.g., Win32 and VxWorks)*/ #define ACE_LACKS_SETSCHED /*Platform lacks pthread_attr_setsched() (e.g. MVS)*/ -#define ACE_LACKS_SYSV_SHMEM 1 - /*Platform lacks System V shared - memory (e.g., Win32 and - VxWorks)*/ -#define ACE_LACKS_SIGINFO_H 1 - /*Platform lacks the siginfo.h - include file (e.g., MVS)*/ -#define ACE_LACKS_SOCKETPAIR 1 +//#define ACE_LACKS_SOCKETPAIR 1 /*Platform lacks the socketpair() call (e.g., SCO UNIX)*/ -#define ACE_LACKS_STRRECVFD 1 - /*Platform doesn't define struct - strrecvfd.*/ #define ACE_LACKS_SYSCALL 1 /*Platform doesn't have syscall() prototype*/ + +/* (missing) standard data types */ +//#define ACE_LACKS_TIMESPEC_T 1 +#define ACE_LACKS_CONST_TIMESPEC_PTR 1 + +#define ACE_LACKS_SUSECONDS_T 1 + +#define ACE_HAS_IDTYPE_T 1 + /*Compiler/platform supports + idtype_t.*/ +#define ACE_HAS_SIGINFO_T 1 + /*Platform supports SVR4 + extended signals*/ +#define ACE_HAS_XPG4_MULTIBYTE_CHAR 1 + /*Platform has support for + multi-byte character support + compliant with the XPG4 + Worldwide Portability + Interface wide-character + classification.*/ +#define ACE_HAS_SIZET_SOCKET_LEN 1 + /*OS/compiler uses size_t * + rather than int * for socket + lengths*/ +#define ACE_HAS_SSIZE_T 1 + /*Compiler supports the ssize_t + typedef*/ +#define ACE_LACKS_PRI_T 1 + /*Platform lacks pri_t (e.g., + Tandem NonStop UNIX).*/ +#define ACE_LACKS_SEMBUF_T 1 + /*Platform lacks struct sembuf + (e.g., Win32 and VxWorks)*/ +#define ACE_LACKS_STRRECVFD 1 + /*Platform doesn't define struct + strrecvfd.*/ #define ACE_LACKS_T_ERRNO 1 /*Header files lack t_errno for TLI*/ -#define ACE_LACKS_UCONTEXT_H 1 - /*Platform lacks the ucontext.h - file*/ + +/* POSIX threads ompatibilities */ +#define ACE_LACKS_RWLOCK_T 1 +#define ACE_LACKS_PTHREAD_KILL 1 +#define ACE_LACKS_THREAD_PROCESS_SCOPING 1 + +#define ACE_HAS_PTHREADS 1 + /*Platform supports POSIX + Pthreads, of one form or + another. This macro says the + platform has a pthreads + variety - should also define + one of the below to say which + one. Also may need some + ACE_HAS_... thing for + extensions.*/ +#define ACE_HAS_PTHREADS_STD 1 + /*Platform supports POSIX.1c-1995 threads + (This is the final standard + Pthreads).*/ +#define ACE_HAS_PTHREAD_PROCESS_ENUM 1 + /*pthread.h declares an enum with + PTHREAD_PROCESS_PRIVATE and + PTHREAD_PROCESS_SHARED values.*/ + +#define ACE_LACKS_UNNAMED_SEMAPHORE 1 + +#define ACE_MT_SAFE 1 + /*Compile using multi-thread libraries*/ +#define ACE_HAS_THREADS 1 + /*Platform supports threads*/ +#define ACE_HAS_THREAD_SPECIFIC_STORAGE 1 + /*Compiler/platform has + thread-specific storage*/ +#define ACE_HAS_THR_C_DEST 1 + /*The pthread_keycreate() + routine *must* take extern C + functions.*/ +#define ACE_HAS_THR_C_FUNC 1 + /*The pthread_create() routine + *must* take extern C + functions.*/ +#define ACE_LACKS_PTHREAD_SIGMASK 1 + /*Platform lacks pthread_sigmask ().*/ +#define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1 + /*Platform lacks + pthread_thr_sigsetmask (e.g., + MVS, HP/UX, and OSF/1 3.2)*/ +#define ACE_NEEDS_HUGE_THREAD_STACKSIZE (64U*1024) + /*Required by platforms with small default stacks.*/ +#define ACE_HAS_PTHREAD_SETCONCURRENCY +#define ACE_HAS_PTHREAD_GETCONCURRENCY + + +/* language/platform conformance */ +#define ACE_NEW_THROWS_EXCEPTIONS 1 + /*Compiler's 'new' throws exception on + failure (ANSI C++ behavior).*/ +#define ACE_TEMPLATES_REQUIRE_SOURCE 1 + /*Compiler's template mechanim + must see source code (i.e., + .cpp files). This is used for + GNU G++.*/ +#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 + /*Platform has its standard c++ + library in the namespace std.*/ +#define ACE_HAS_AUTOMATIC_INIT_FINI 1 + /*Compiler/platform correctly + calls init()/fini() for shared + libraries*/ +#define ACE_LACKS_UNIX_SIGNALS 1 + +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES 1 + /*Prototypes for both signal() + and struct sigaction are + consistent.*/ +#define ACE_HAS_CPLUSPLUS_HEADERS 1 + /*Compiler/platform has + correctly prototyped header + files*/ +#define ACE_HAS_EXCEPTIONS 1 + /*Compiler supports C++ + exception handling*/ +#define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 + +#define ACE_HAS_GPERF 1 + /*The GPERF utility is compiled + for this platform*/ +#define ACE_HAS_IP_MULTICAST 1 + /*Platform supports IP multicast*/ +#define ACE_HAS_POSIX_NONBLOCK 1 + /*Platform supports POSIX + O_NONBLOCK semantics*/ +#define ACE_HAS_POSIX_TIME 1 + /*Platform supports the POSIX + struct timespec type*/ +#define ACE_HAS_BROKEN_POSIX_TIME 1 + /* but in <timers.h> */ +#define ACE_HAS_STRPTIME 1 + /*Enables ACE_OS::strptime ().*/ +#define ACE_HAS_STANDARD_CPP_LIBRARY 1 + /*Platform/compiler supports + Standard C++ Library*/ +#define ACE_HAS_STRING_CLASS 1 + /*Platform/Compiler supports a + String class (e.g., GNU or + Win32).*/ +#define ACE_HAS_SVR4_DYNAMIC_LINKING 1 + /*Compiler/platform supports + SVR4 dynamic linking semantics*/ +#define ACE_HAS_TEMPLATE_SPECIALIZATION 1 + /*Compiler implements template + specialization*/ + +#define ACE_HAS_TEMPLATE_TYPEDEFS 1 + /*Compiler implements templates + that support typedefs inside + of classes used as formal + arguments to a template + class.*/ +#define ACE_LACKS_NAMED_POSIX_SEM 1 + /*Platform lacks named POSIX + semaphores (e.g., Chorus)*/ +#define ACE_LACKS_SYSV_SHMEM 1 + /*Platform lacks System V shared + memory (e.g., Win32 and + VxWorks)*/ #define ACE_LACKS_UNIX_DOMAIN_SOCKETS 1 /*ACE platform has no UNIX domain sockets*/ #define ACE_LACKS_UNIX_SYSLOG 1 -#define ACE_NEEDS_HUGE_THREAD_STACKSIZE (64U*1024) - /*Required by platforms with small default stacks.*/ - -#ifdef ACE_NEEDS_PTHREAD_UPPERCASE - -/* -** These defines take care of the upper/lower casing problem that occurs -** if you are using pthreads and are compiling /NAMES=AS_IS (which is necessary for ACE/TAO) -** -** Note that it does NOT take care of any argument differences between -** the various implementations of pthreads. -*/ - -#define pthread_attr_create PTHREAD_ATTR_CREATE -#define pthread_attr_delete PTHREAD_ATTR_DELETE -#define pthread_attr_destroy PTHREAD_ATTR_DESTROY -#define pthread_attr_getdetach_np PTHREAD_ATTR_GETDETACH_NP -#define pthread_attr_getguardsize_np PTHREAD_ATTR_GETGUARDSIZE_NP -#define pthread_attr_getinheritsched PTHREAD_ATTR_GETINHERITSCHED -#define pthread_attr_getprio PTHREAD_ATTR_GETPRIO -#define pthread_attr_getsched PTHREAD_ATTR_GETSCHED -#define pthread_attr_getschedparam PTHREAD_ATTR_GETSCHEDPARAM -#define pthread_attr_getstacksize PTHREAD_ATTR_GETSTACKSIZE -#define pthread_attr_init PTHREAD_ATTR_INIT -#define pthread_attr_setdetach_np PTHREAD_ATTR_SETDETACH_NP -#define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE -#define pthread_attr_setguardsize_np PTHREAD_ATTR_SETGUARDSIZE_NP -#define pthread_attr_setinheritsched PTHREAD_ATTR_SETINHERITSCHED -#define pthread_attr_setprio PTHREAD_ATTR_SETPRIO -#define pthread_attr_setsched PTHREAD_ATTR_SETSCHED -#define pthread_attr_setschedparam PTHREAD_ATTR_SETSCHEDPARAM -#define pthread_attr_setschedpolicy PTHREAD_ATTR_SETSCHEDPOLICY -#define pthread_attr_setstacksize PTHREAD_ATTR_SETSTACKSIZE -#define pthread_cancel PTHREAD_CANCEL -#define pthread_cancel_e PTHREAD_CANCEL_E -#define pthread_cond_broadcast PTHREAD_COND_BROADCAST -#define pthread_cond_destroy PTHREAD_COND_DESTROY -#define pthread_cond_init PTHREAD_COND_INIT -#define pthread_cond_sig_preempt_int_np PTHREAD_COND_SIG_PREEMPT_INT_NP -#define pthread_cond_signal PTHREAD_COND_SIGNAL -#define pthread_cond_signal_int_np PTHREAD_COND_SIGNAL_INT_NP -#define pthread_cond_timedwait PTHREAD_COND_TIMEDWAIT -#define pthread_cond_wait PTHREAD_COND_WAIT -#define pthread_condattr_create PTHREAD_CONDATTR_CREATE -#define pthread_condattr_delete PTHREAD_CONDATTR_DELETE -#define pthread_condattr_init PTHREAD_CONDATTR_INIT -#define pthread_create PTHREAD_CREATE -#define pthread_delay_np PTHREAD_DELAY_NP -#define pthread_detach PTHREAD_DETACH -#define pthread_equal PTHREAD_EQUAL -#define pthread_exc_fetch_fp_np PTHREAD_EXC_FETCH_FP_NP -#define pthread_exc_handler_np PTHREAD_EXC_HANDLER_NP -#define pthread_exc_pop_ctx_np PTHREAD_EXC_POP_CTX_NP -#define pthread_exc_push_ctx_np PTHREAD_EXC_PUSH_CTX_NP -#define pthread_exc_savecontext_np PTHREAD_EXC_SAVECONTEXT_NP -#define pthread_exit PTHREAD_EXIT -#define pthread_get_expiration_np PTHREAD_GET_EXPIRATION_NP -#define pthread_getprio PTHREAD_GETPRIO -#define pthread_getschedparam PTHREAD_GETSCHEDPARAM -#define pthread_getscheduler PTHREAD_GETSCHEDULER -#define pthread_getspecific PTHREAD_GETSPECIFIC -#define pthread_getunique_np PTHREAD_GETUNIQUE_NP -#define pthread_join PTHREAD_JOIN -#define pthread_join32 PTHREAD_JOIN32 -#define pthread_keycreate PTHREAD_KEYCREATE -#define pthread_key_create PTHREAD_KEY_CREATE -#define pthread_kill PTHREAD_KILL -#define pthread_lock_global_np PTHREAD_LOCK_GLOBAL_NP -#define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY -#define pthread_mutex_init PTHREAD_MUTEX_INIT -#define pthread_mutex_lock PTHREAD_MUTEX_LOCK -#define pthread_mutex_trylock PTHREAD_MUTEX_TRYLOCK -#define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK -#define pthread_mutexattr_create PTHREAD_MUTEXATTR_CREATE -#define pthread_mutexattr_delete PTHREAD_MUTEXATTR_DELETE -#define pthread_mutexattr_destroy PTHREAD_MUTEXATTR_DESTROY -#define pthread_mutexattr_getkind_np PTHREAD_MUTEXATTR_GETKIND_NP -#define pthread_mutexattr_init PTHREAD_MUTEXATTR_INIT -#define pthread_mutexattr_setkind_np PTHREAD_MUTEXATTR_SETKIND_NP -#define pthread_mutexattr_settype_np PTHREAD_MUTEXATTR_SETTYPE_NP -#define pthread_once PTHREAD_ONCE -#define pthread_resume_np PTHREAD_RESUME_NP -#define pthread_self PTHREAD_SELF -#define pthread_setasynccancel PTHREAD_SETASYNCCANCEL -#define pthread_setcancel PTHREAD_SETCANCEL -#define pthread_setcancelstate PTHREAD_SETCANCELSTATE -#define pthread_setprio PTHREAD_SETPRIO -#define pthread_setschedparam PTHREAD_SETSCHEDPARAM -#define pthread_setscheduler PTHREAD_SETSCHEDULER -#define pthread_setspecific PTHREAD_SETSPECIFIC -#define pthread_suspend_np PTHREAD_SUSPEND_NP -#define pthread_testcancel PTHREAD_TESTCANCEL -#define pthread_unlock_global_np PTHREAD_UNLOCK_GLOBAL_NP -#define pthread_yield PTHREAD_YIELD -#define pthread_yield_np PTHREAD_YIELD_NP - -/* new for OpenVMS 7.3.2 ECO 1 */ -#define pthread_attr_setscope PTHREAD_ATTR_SETSCOPE -#define pthread_attr_setstackaddr PTHREAD_ATTR_SETSTACKADDR -#define pthread_condattr_destroy PTHREAD_CONDATTR_DESTROY -#define pthread_key_delete PTHREAD_KEY_DELETE -#define pthread_setcanceltype PTHREAD_SETCANCELTYPE - -#endif // if ACE_NEEDS_PTHREAD_UPPERCASE +#define ACE_HAS_SOCK_BUF_SIZE_MAX #endif diff --git a/ace/svcconf.mpb b/ace/svcconf.mpb index 7627592eb7c..cbdcdce227f 100644 --- a/ace/svcconf.mpb +++ b/ace/svcconf.mpb @@ -8,8 +8,10 @@ feature(ace_svcconf) { DLL.cpp DLL_Manager.cpp Dynamic_Service_Base.cpp + Dynamic_Service_Dependency.cpp Parse_Node.cpp Service_Config.cpp + Service_Gestalt.cpp Service_Manager.cpp Service_Object.cpp Service_Repository.cpp @@ -29,15 +31,15 @@ feature(ace_svcconf) { "Svc_Conf_y.cpp: Svc_Conf.y" "ifeq ($(notdir $(YACC)), bison)" " $(YACC) -l -d Svc_Conf.y" - " sed -e 's/char \\*getenv/char *ace_foo/g' \\" - " -e 's/= getenv/= ACE_OS::getenv/g' \\" - " -e 's/fprintf/ACE_OS::fprintf/g' \\" + " sed -e 's/char \\*getenv/char *ace_foo/g' \\" // Eliminates getenv prototype, use ACE's + " -e 's/= getenv/= ACE_OS::getenv/g' \\" // ... like this - qualified. + " -e 's/fprintf/ACE_OS::fprintf/g' \\" // Use ACE's fprintf, not library's " -e 's/yy/ace_yy/g' \\" - " -e 's/->ace_yyerrno/->yyerrno/g' \\" - " -e 's/->ace_yylineno/->yylineno/g' \\" + " -e 's/->ace_yyerrno/->yyerrno/g' \\" // These reverse the unwanted ace_ prefix + " -e 's/->ace_yylineno/->yylineno/g' \\" // added by the substitution, above. " -e 's/YY/ACE_YY/g' \\" " -e 's/^char /ACE_TCHAR /g' \\" - " -e 's/ char / ACE_TCHAR /g' \\" + " -e 's/\([^d]\) char /\$1 ACE_TCHAR /g' \\" " -e 's/(char/(ACE_TCHAR/g' \\" " -e 's/ NULL/ 0/g' \\" " -e 's/ace_yyerror[ ]*(\"/ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, \"/g' \\" @@ -46,12 +48,18 @@ feature(ace_svcconf) { " -e 's@#include <stdio\.h>@@' \\" " -e 's/Svc_Conf\\.tab\\.c/Svc_Conf_y.cpp/g' < Svc_Conf.tab.c > /tmp/$@" " cp /tmp/$@ $@" - " echo \/\/ '$$I''d$$' > Svc_Conf_Tokens.h" - " cat Svc_Conf.tab.h >> Svc_Conf_Tokens.h" + " echo \/\/ '$$I''d:$$' >Svc_Conf_Tokens.h" + " echo '#ifndef BISON_SVC_CONF_TAB_H' >>Svc_Conf_Tokens.h" // Inclusion protection macros + " echo '# define BISON_SVC_CONF_TAB_H' >>Svc_Conf_Tokens.h" // ... same ... + " echo '# define ACE_YYSTYPE_IS_DECLARED 1' >>Svc_Conf_Tokens.h" // Don't use Svc_Conf_y.cpp's + " sed -e 's/yy/ace_yy/g' \\" + " -e 's/YY/ACE_YY/g' <Svc_Conf.tab.h >>Svc_Conf_Tokens.h" + " echo '#endif \/\* ifndef BISON_SVC_CONF_TAB_H \*\/' >>Svc_Conf_Tokens.h" " $(RM) -f /tmp/$@ Svc_Conf.tab.c Svc_Conf.tab.h Svc_Conf_y.cpp.orig" "else" " @echo 'ERROR: You must use bison 1.35 or higher to process this file'" " @/bin/false" "endif" + } } |