diff options
64 files changed, 5001 insertions, 989 deletions
diff --git a/ACEXML/Makefile b/ACEXML/Makefile index e355ff86344..ccba2b77d1c 100644 --- a/ACEXML/Makefile +++ b/ACEXML/Makefile @@ -6,6 +6,7 @@ DIRS = common \ parser \ + apps \ tests \ examples diff --git a/ACEXML/Makefile.bor b/ACEXML/Makefile.bor index 0e25ede588e..85ed6f2c300 100644 --- a/ACEXML/Makefile.bor +++ b/ACEXML/Makefile.bor @@ -4,6 +4,7 @@ DIRS = \ common \ - parser + parser \ + apps !include <$(ACE_ROOT)\include\makeinclude\recurse.bor> diff --git a/ACEXML/apps/Makefile b/ACEXML/apps/Makefile new file mode 100644 index 00000000000..a5f05b99ae5 --- /dev/null +++ b/ACEXML/apps/Makefile @@ -0,0 +1,17 @@ +#---------------------------------------------------------------------------- +# $Id$ +# +# Makefile for the client programs that test the ACE network services +#---------------------------------------------------------------------------- + +DIRS = svcconf + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nolocal.GNU diff --git a/ACEXML/apps/Makefile.bor b/ACEXML/apps/Makefile.bor new file mode 100644 index 00000000000..1da5c84407c --- /dev/null +++ b/ACEXML/apps/Makefile.bor @@ -0,0 +1,8 @@ +# +# Makefile for building the ACE XML Library +# + +DIRS = \ + svcconf + +!include <$(ACE_ROOT)\include\makeinclude\recurse.bor> diff --git a/ACEXML/apps/XML_Apps.dsw b/ACEXML/apps/XML_Apps.dsw new file mode 100644 index 00000000000..0ed29a77e72 --- /dev/null +++ b/ACEXML/apps/XML_Apps.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "XML_Svc_Conf_Parser"=.\svcconf\XML_Svc_Conf_Parser.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/ACEXML/apps/svcconf/Makefile b/ACEXML/apps/svcconf/Makefile new file mode 100644 index 00000000000..fced65f587e --- /dev/null +++ b/ACEXML/apps/svcconf/Makefile @@ -0,0 +1,40 @@ +#---------------------------------------------------------------------------- +# $Id$ +# +# Makefile for the server-side ACE network services +#---------------------------------------------------------------------------- + +LIB = libACEXML_XML_Svc_Conf_Parser.a +SHLIB = libACEXML_XML_Svc_Conf_Parser.$(SOEXT) + +FILES = Svcconf_Handler \ + Svcconf + +DEFS = $(addsuffix .h,$(FILES)) +LSRC = $(addsuffix .cpp,$(FILES)) + +LIBS += -lACEXML_Parser -lACEXML $(ACELIB) +CCFLAGS += -I../.. + +BUILD = $(VLIB) $(VSHLIB) + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU + +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Dependencies +#---------------------------------------------------------------------------- +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. diff --git a/ACEXML/apps/svcconf/Makefile.bor b/ACEXML/apps/svcconf/Makefile.bor new file mode 100644 index 00000000000..0f40444b564 --- /dev/null +++ b/ACEXML/apps/svcconf/Makefile.bor @@ -0,0 +1,20 @@ +# Makefile for building the parser + +NAME = ACEXML_XML_Svc_Conf_Parser + +OBJFILES = \ + $(OBJDIR)\Svcconf.obj \ + $(OBJDIR)\Svcconf_Handler.obj + +CFLAGS = \ + $(ACE_CFLAGS) \ + $(ACE_XML_CFLAGS) + +CPPDIR = .;.. + +LIBFILES = \ + $(ACE_LIB) \ + $(ACE_XML_LIB) +# WE need both -lACEXML and -lACEXML_Parser here + +!include <$(ACE_ROOT)\include\makeinclude\build_core_library.bor> diff --git a/ACEXML/apps/svcconf/README b/ACEXML/apps/svcconf/README new file mode 100644 index 00000000000..8a39a40bfe3 --- /dev/null +++ b/ACEXML/apps/svcconf/README @@ -0,0 +1,4 @@ +$Id$ + +This directory implement a DLL that contains the parser for XML based +service configurator. diff --git a/ACEXML/apps/svcconf/Svcconf.cpp b/ACEXML/apps/svcconf/Svcconf.cpp new file mode 100644 index 00000000000..919b5f39818 --- /dev/null +++ b/ACEXML/apps/svcconf/Svcconf.cpp @@ -0,0 +1,95 @@ +// $Id$ + + +#include "Svcconf.h" +#include "common/FileCharStream.h" +#include "common/StrCharStream.h" +#include "parser/parser/Parser.h" + +extern "C" ACE_Proper_Export_Flag ACE_XML_Svc_Conf * +_ACEXML_create_XML_Svc_Conf_Object (void) +{ + ACE_XML_Svc_Conf *retp = 0; + + ACE_NEW_RETURN (retp, + ACEXML_Svcconf_Parser (), + 0); + + return retp; +} + +ACEXML_Svcconf_Parser::ACEXML_Svcconf_Parser () +{ + this->parser_.setContentHandler (&this->svcconf_handler_); + this->parser_.setDTDHandler (&this->svcconf_handler_); + this->parser_.setErrorHandler (&this->svcconf_handler_); + this->parser_.setEntityResolver (&this->svcconf_handler_); +} + +ACEXML_Svcconf_Parser::~ACEXML_Svcconf_Parser () +{ + +} + +void * +ACEXML_Svcconf_Parser::operator new (size_t s) +{ + return ::new char[s]; +} + +void +ACEXML_Svcconf_Parser::operator delete (void *p) +{ + delete[] (char *)p; +} + +int +ACEXML_Svcconf_Parser::parse_file (const ACE_TCHAR file[]) +{ + if (file == 0) + ACE_ERROR_RETURN ((LM_ERROR, "ACEXML_Svcconf_Parser: No filename specified\n"), -1); + + ACEXML_FileCharStream *fstm = 0; + ACE_NEW_RETURN (fstm, + ACEXML_FileCharStream (), + 1); + + if (fstm->open (file) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ACEXML_Svcconf_Parser: Fail to open XML file: %s\n"), + file), + -1); + + this->input_stream_.setCharStream (fstm); + + this->parser_.parse (&this->input_stream_, this->env_); + if (this->env_.exception ()) + { + this->env_.exception ()->print (); + return -1; + } + return 0; +} + + +int +ACEXML_Svcconf_Parser::parse_string (const ACE_TCHAR str[]) +{ + if (str == 0) + ACE_ERROR_RETURN ((LM_ERROR, "ACEXML_Svcconf_Parser: Can't parse a null string\n"), -1); + + ACEXML_StrCharStream *stm = 0; + ACE_NEW_RETURN (stm, + ACEXML_StrCharStream (str), + -1); + + this->input_stream_.setCharStream (stm); + + this->parser_.parse (&this->input_stream_, this->env_); + if (this->env_.exception ()) + { + this->env_.exception ()->print (); + return -1; + } + return 0; +} diff --git a/ACEXML/apps/svcconf/Svcconf.h b/ACEXML/apps/svcconf/Svcconf.h new file mode 100644 index 00000000000..0775658dac5 --- /dev/null +++ b/ACEXML/apps/svcconf/Svcconf.h @@ -0,0 +1,46 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Svcconf.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef ACEXML_SVCCONF_H +#define ACEXML_SVCCONF_H + +#include "ace/pre.h" +#include "ace/XML_Svc_Conf.h" +#include "parser/parser/Parser.h" +#include "Svcconf_Handler.h" + + +class ACEXML_Svcconf_Parser : public ACE_XML_Svc_Conf +{ +public: + ACEXML_Svcconf_Parser (); + + virtual ~ACEXML_Svcconf_Parser (); + + virtual int parse_file (const ACE_TCHAR file[]); + + virtual int parse_string (const ACE_TCHAR str[]); + + void * operator new (size_t bytes); + + void operator delete (void *ptr); + +protected: + ACEXML_Parser parser_; + ACEXML_Svcconf_Handler svcconf_handler_; + ACEXML_InputSource input_stream_; + ACEXML_Env env_; +}; + +#include "ace/post.h" +#endif /* ACEXML_SVCCONF_H */ diff --git a/ACEXML/apps/svcconf/Svcconf_Handler.cpp b/ACEXML/apps/svcconf/Svcconf_Handler.cpp new file mode 100644 index 00000000000..87a908f067e --- /dev/null +++ b/ACEXML/apps/svcconf/Svcconf_Handler.cpp @@ -0,0 +1,671 @@ +// -*- C++ -*- $Id$ + +#include "Svcconf_Handler.h" +#include "ace/ACE.h" +#include "ace/Log_Msg.h" +#include "ace/Service_Config.h" +#include "ace/Service_Types.h" +#include "ace/Service_Repository.h" +#include "ace/DLL.h" +#include "ace/ARGV.h" +#include "ace/Module.h" + +#if !defined (__ACEXML_INLINE__) +# include "Svcconf_Handler.i" +#endif /* __ACEXML_INLINE__ */ + +ACEXML_Svcconf_Handler::ACEXML_Svcconf_Handler (void) + : in_stream_def_ (0), + in_module_ (0), + stream_svc_type_ (0), + stream_ (0), + dll_handle_ (0) +{ + // no-op +} + +ACEXML_Svcconf_Handler::~ACEXML_Svcconf_Handler (void) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::characters (const ACEXML_Char *, + int, + int, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::endDocument (ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::endElement (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *qName, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + if (ACE_OS_String::strcmp (qName, ACE_TEXT ("dynamic")) == 0) + { + ACE_Parsed_Info *active_info = (this->in_stream_def_ == 0 ? + &this->parsed_info_ : + &this->stream_info_); + + ACE_DLL svc_dll; + + if (svc_dll.open (active_info->path ()) == -1) + { + xmlenv.exception (new ACEXML_SAXException ("Cannot locate DLL\n")); + return; + } + + void *(*func) (ACE_Service_Object_Exterminator *) = 0; + ACE_Service_Object_Exterminator gobbler = 0; + void *symbol = 0; + + long temp_ptr = + ACE_reinterpret_cast(long, svc_dll.symbol (active_info->init_func ())); + func = ACE_reinterpret_cast(void *(*)(ACE_Service_Object_Exterminator *), + temp_ptr); + + if (func == 0) + { + xmlenv.exception (new ACEXML_SAXException ("Cannot locator init function\n")); + return; + } + symbol = (*func)(&gobbler); // target object created in the loaded DLL. + + ACE_Service_Type_Impl *stp = ACE_Service_Config::create_service_type_impl + (active_info->name (), + active_info->service_type (), + symbol, + ACE_Service_Type::DELETE_THIS | + ACE_Service_Type::DELETE_OBJ, + gobbler); + + if (this->in_stream_def_) + { +// ACE_DEBUG ((LM_INFO, ACE_TEXT ("Create dynamic %s for stream\n"), +// this->stream_info_.name ())); + if (active_info->service_type () == ACE_Service_Type::STREAM) + { + this->stream_ = (ACE_Stream_Type *) stp; + this->dll_handle_ = svc_dll.get_handle (1); + } + else + { + xmlenv.exception (new ACEXML_SAXException + ("Expecting Stream type in stream header\n")); + return; + } + + this->stream_svc_type_ = + ACE_Service_Config::create_service_type (this->stream_info_.name (), + this->stream_, + this->dll_handle_, + this->stream_info_.active ()); + + } + else + { + if (this->in_module_) + { + ACE_ARGV args (active_info->init_params ()); + + ACE_Module_Type *mt = (ACE_Module_Type *) stp; + + ACE_Module<ACE_SYNCH> *mp = (ACE_Module<ACE_SYNCH> *) mt->object (); + + if (ACE_OS::strcmp (mp->name (), active_info->name ()) != 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("warning: assigning Module_Type name %s to Module %s since names differ\n"), + active_info->name (), + mp->name ())); + mp->name (active_info->name ()); + } + + if (mt->init (args.argc (), args.argv ()) == -1 + || this->stream_->push (mt) == -1) + { + xmlenv.exception (new ACEXML_SAXException ("Error initializing module")); + } + + +// ACE_DEBUG ((LM_INFO, ACE_TEXT ("Push dynamic %s into stream %s\n"), +// this->parsed_info_.name (), +// this->stream_info_.name ())); + } + else + { + ACE_Service_Type *stype = + ACE_Service_Config::create_service_type (active_info->name (), + stp, + svc_dll.get_handle (1), + active_info->active ()); + // @@ Check error here. + + // ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply dynamic %s\n"), +// this->parsed_info_.name ())); + if (ACE_Service_Config::initialize (stype, + active_info->init_params ()) == -1) + { + xmlenv.exception (new ACEXML_SAXException + ("Fail to initialize dynamic service\n")); + return; + } + } + this->parsed_info_.reset (); + } + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("static")) == 0) + { + if (this->in_stream_def_) + { + // @@ Couldn't make sense out of the original Svc_Conf.y. + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Create static %s for stream\n"), + this->stream_info_.name ())); + } + else + { + if (this->in_module_) + { + // @@ Couldn't make sense out of the original Svc_Conf.y. + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Push static %s into stream %s\n"), + this->parsed_info_.name (), + this->stream_info_.name ())); + } + else + { +// ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply static %s\n"), +// this->parsed_info_.name ())); + if (ACE_Service_Config::initialize (this->parsed_info_.name (), + this->parsed_info_.init_params ()) == -1) + { + xmlenv.exception (new ACEXML_SAXException + (ACE_TEXT ("Fail initializing static service\n"))); + } + } + this->parsed_info_.reset (); + } + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("module")) == 0) + { + this->in_module_ = 0; + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("streamdef")) == 0) + { +// ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply stream %s of type %s\n"), +// this->stream_info_.name (), +// this->stream_info_.name ())); + ACE_Service_Config::initialize (this->stream_svc_type_, + this->stream_info_.init_params ()); + + this->stream_info_.reset (); + this->stream_svc_type_ = 0; + this->stream_ = 0; + this->dll_handle_ = 0; + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("stream")) == 0) + { +// ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply stream %s of type %s\n"), +// this->stream_info_.name (), +// this->stream_info_.name ())); + this->stream_info_.reset (); + } + else + { + } +} + +void +ACEXML_Svcconf_Handler::endPrefixMapping (const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::ignorableWhitespace (const ACEXML_Char *, + int, + int, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::processingInstruction (const ACEXML_Char *, + const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::setDocumentLocator (ACEXML_Locator *, + ACEXML_Env &) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::skippedEntity (const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::startDocument (ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::startElement (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *qName, + ACEXML_Attributes *alist, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + if (ACE_OS_String::strcmp (qName, ACE_TEXT ("dynamic")) == 0) + { + this->get_dynamic_attrs (alist, xmlenv); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("initializer")) == 0) + { + this->get_initializer_attrs (alist, xmlenv); + + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("static")) == 0) + { + this->get_static_attrs (alist, xmlenv); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("stream")) == 0) + { + this->get_stream_id (alist, xmlenv); + + if (ACE_Service_Repository::instance()->find + (this->stream_info_.name (), + (const ACE_Service_Type **) &this->stream_svc_type_) == -1) + { + xmlenv.exception (new ACEXML_SAXException ("Can not find stream\n")); + return; + } + this->stream_ = this->stream_svc_type_ == 0 + ? 0 + : ACE_dynamic_cast (ACE_Stream_Type *, + ACE_const_cast (ACE_Service_Type_Impl *, + this->stream_svc_type_->type ())); + +// ACE_DEBUG ((LM_INFO, ACE_TEXT ("Retrieve stream %s from repository\n"), +// this->stream_info_.name ())); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("streamdef")) == 0) + { + this->in_stream_def_ = 1; + // @@ Set up stream service object + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("module")) == 0) + { + this->in_stream_def_ = 0; + this->in_module_ = 1; + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("resume")) == 0) + { + this->get_id (alist, xmlenv); + if (this->in_module_) + { +// ACE_DEBUG ((LM_INFO, ACE_TEXT ("Resume %s in stream %s\n"), +// this->parsed_info_.name (), +// this->stream_info_.name ())); + ACE_Module_Type *mt = (this->stream_ == 0) + ? 0 + : this->stream_->find (this->parsed_info_.name ()); + + if (mt == 0) + { + xmlenv.exception (new ACEXML_SAXException ("Can't locate module\n")); + return; + } + + mt->resume (); + } + else + { +// ACE_DEBUG ((LM_INFO, ACE_TEXT ("Resume %s\n"), +// this->parsed_info_.name ())); + if (ACE_Service_Config::resume (this->parsed_info_.name ()) == -1) + { + xmlenv.exception (new ACEXML_SAXException (ACE_TEXT ("Resume fail\n"))); + } + } + this->parsed_info_.reset (); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("suspend")) == 0) + { + this->get_id (alist, xmlenv); + if (this->in_module_) + { +// ACE_DEBUG ((LM_INFO, ACE_TEXT ("Suspend %s in stream %s\n"), +// this->parsed_info_.name (), +// this->stream_info_.name ())); + ACE_Module_Type *mt = (this->stream_ == 0) + ? 0 + : this->stream_->find (this->parsed_info_.name ()); + + if (mt == 0) + { + xmlenv.exception (new ACEXML_SAXException ("Can't locate module\n")); + return; + } + + mt->suspend (); + } + else + { + // ACE_DEBUG ((LM_INFO, ACE_TEXT ("Suspend %s\n"), + // this->parsed_info_.name ())); + if (ACE_Service_Config::suspend (this->parsed_info_.name ()) == -1) + { + xmlenv.exception (new ACEXML_SAXException (ACE_TEXT ("Suspend fail\n"))); + } + } + this->parsed_info_.reset (); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("remove")) == 0) + { + this->get_id (alist, xmlenv); + if (this->in_module_) + { +// ACE_DEBUG ((LM_INFO, ACE_TEXT ("Remove %s in stream %s\n"), +// this->parsed_info_.name (), +// this->stream_info_.name ())); + ACE_Module_Type *mt = (this->stream_ == 0) + ? 0 + : this->stream_->find (this->parsed_info_.name ()); + + if (mt == 0) + { + xmlenv.exception (new ACEXML_SAXException ("Can't locate module\n")); + return; + } + + this->stream_->remove (mt); + } + else + { +// ACE_DEBUG ((LM_INFO, ACE_TEXT ("Remove %s\n"), +// this->parsed_info_.name ())); + if (ACE_Service_Config::remove (this->parsed_info_.name ()) == -1) + { + xmlenv.exception (new ACEXML_SAXException (ACE_TEXT ("Remove fail\n"))); + } + } + this->parsed_info_.reset (); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("ACE_Svc_Conf")) == 0) + { + // Main document tag. no-op. +// ACE_DEBUG ((LM_INFO, ACE_TEXT ("ACE_Svc_Conf tag\n"))); + } + else + { + // @@ Error. Perhaps we should relay to user event handler here, if available. + } + + return; +} + +void +ACEXML_Svcconf_Handler::startPrefixMapping (const ACEXML_Char *, + const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +// *** Methods inherit from ACEXML_DTDHandler. + +void +ACEXML_Svcconf_Handler::notationDecl (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +void +ACEXML_Svcconf_Handler::unparsedEntityDecl (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +// Methods inherit from ACEXML_EnitityResolver. + +ACEXML_InputSource * +ACEXML_Svcconf_Handler::resolveEntity (const ACEXML_Char *, + const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. + return 0; +} + +// Methods inherit from ACEXML_ErrorHandler. + + /* + * Receive notification of a recoverable error. + */ +void +ACEXML_Svcconf_Handler::error (ACEXML_SAXParseException &, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +void +ACEXML_Svcconf_Handler::fatalError (ACEXML_SAXParseException &, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +void +ACEXML_Svcconf_Handler::warning (ACEXML_SAXParseException &, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +int +ACEXML_Svcconf_Handler::get_stream_id (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv) +{ + if (alist != 0) + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) + { + this->stream_info_.name (alist->getValue (i)); + } + else + { + xmlenv.exception (new ACEXML_SAXException ("Invalid stream attribute\n")); + return -1; + } + } + return 0; +} + +int +ACEXML_Svcconf_Handler::get_id (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv) +{ + if (alist != 0) + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) + { + this->parsed_info_.name (alist->getValue (i)); + } + else + { + xmlenv.exception (new ACEXML_SAXException ("Invalid attribute, expecting 'id'\n")); + return -1; + } + } + return 0; +} + +int +ACEXML_Svcconf_Handler::get_dynamic_attrs (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv) +{ + if (alist != 0) + { + ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ? + &this->parsed_info_ : + &this->stream_info_); + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) + { + info->name (alist->getValue (i)); + } + else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("status")) == 0) + { + if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("inactive")) == 0) + { + info->active (0); + } + else if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("active")) == 0) + { + info->active (1); + } + else + { + xmlenv.exception + (new ACEXML_SAXException ("Invalid attribute value, expecting 'active' or 'inactive'\n")); + return -1; + } + } + else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("type")) == 0) + { + if (ACE_OS_String::strcasecmp (alist->getValue (i), ACE_TEXT ("service_object")) == 0) + { + info->service_type (ACE_Service_Type::SERVICE_OBJECT); + } + else if (ACE_OS_String::strcasecmp (alist->getValue (i), ACE_TEXT ("stream")) == 0) + { + info->service_type (ACE_Service_Type::STREAM); + } + else if (ACE_OS_String::strcasecmp (alist->getValue (i), ACE_TEXT ("module")) == 0) + { + info->service_type (ACE_Service_Type::MODULE); + } + else + { + xmlenv.exception + (new ACEXML_SAXException ("Invalid Service_Object attribute value\n")); + return -1; + } + } + else + { + xmlenv.exception (new ACEXML_SAXException ("Invalid attribute\n")); + return -1; + } + } + } + return 0; +} + +int +ACEXML_Svcconf_Handler::get_initializer_attrs (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv) +{ + if (alist != 0) + { + ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ? + &this->parsed_info_ : + &this->stream_info_); + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("init")) == 0) + { + info->init_func (alist->getValue (i)); + } + else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("path")) == 0) + { + info->path (alist->getValue (i)); + } + else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("params")) == 0) + { + info->init_params (alist->getValue (i)); + } + else + { + xmlenv.exception (new ACEXML_SAXException ("Invalid initializer attribute.\n")); + return -1; + } + } + } + return 0; +} + +int +ACEXML_Svcconf_Handler::get_static_attrs (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv) +{ + if (alist != 0) + { + ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ? + &this->parsed_info_ : + &this->stream_info_); + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) + { + info->name (alist->getValue (i)); + } + else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("params")) == 0) + { + info->init_params (alist->getValue (i)); + } + else + { + xmlenv.exception (new ACEXML_SAXException ("Invalid static attribute.\n")); + return -1; + } + } + } + return 0; +} diff --git a/ACEXML/apps/svcconf/Svcconf_Handler.h b/ACEXML/apps/svcconf/Svcconf_Handler.h new file mode 100644 index 00000000000..22069f8b97f --- /dev/null +++ b/ACEXML/apps/svcconf/Svcconf_Handler.h @@ -0,0 +1,305 @@ +// $Id$ + +//============================================================================= +/** + * @file Svcconf_Handler.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + +#ifndef ACEXML_SVCCONF_HANDLER_H +#define ACEXML_SVCCONF_HANDLER_H + +#include "common/DefaultHandler.h" +#include "ace/Service_Types.h" + +class ACE_Parsed_Info +{ +public: + ACE_Parsed_Info (); + ~ACE_Parsed_Info (); + + /** + * Set/get name of a parsed entity. + */ + int name (const ACEXML_Char *n); + const ACEXML_Char *name (void); + + /** + * Set/get type of a dynamic node. + */ + int service_type (int type); + int service_type (void); + + /** + * Set/Get active status. + */ + int active (int a); + int active (void); + + /** + * Set/get initializer path. + */ + int path (const ACEXML_Char *n); + const ACEXML_Char *path (void); + + /** + * Set/get initializer init function. + */ + int init_func (const ACEXML_Char *n); + const ACEXML_Char *init_func (void); + + /** + * Set/get initializer init parameter. + */ + int init_params (const ACEXML_Char *n); + const ACEXML_Char *init_params (void); + + /** + * Reset Parsed_Info. + */ + void reset (void); + +protected: + ACEXML_Char *name_; + int service_type_; + int active_; + ACEXML_Char *path_; + ACEXML_Char *init_func_; + ACEXML_Char *init_params_; +}; + +/** + * @class ACEXML_Svcconf_Handler + * + * @brief ACEXML_Svcconf_Handler is an example SAX event handler. + * + * This SAX event handler try to regenerate the XML document it + * reads with correct indentation. + */ +class ACEXML_Svcconf_Handler : public ACEXML_DefaultHandler +{ +public: + /* + * Default constructor. + */ + ACEXML_Svcconf_Handler (void); + + /* + * Default destructor. + */ + virtual ~ACEXML_Svcconf_Handler (void); + + // Methods inherit from ACEXML_ContentHandler. + + /* + * Receive notification of character data. + */ + virtual void characters (const ACEXML_Char *ch, + int start, + int length, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of the end of a document. + */ + virtual void endDocument (ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of the end of an element. + */ + virtual void endElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * End the scope of a prefix-URI mapping. + */ + virtual void endPrefixMapping (const ACEXML_Char *prefix, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of ignorable whitespace in element content. + */ + virtual void ignorableWhitespace (const ACEXML_Char *ch, + int start, + int length, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of a processing instruction. + */ + virtual void processingInstruction (const ACEXML_Char *target, + const ACEXML_Char *data, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive an object for locating the origin of SAX document events. + */ + virtual void setDocumentLocator (ACEXML_Locator *locator, + ACEXML_Env &xmlenv) ; + + /* + * Receive notification of a skipped entity. + */ + virtual void skippedEntity (const ACEXML_Char *name, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of the beginning of a document. + */ + virtual void startDocument (ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of the beginning of an element. + */ + virtual void startElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Begin the scope of a prefix-URI Namespace mapping. + */ + virtual void startPrefixMapping (const ACEXML_Char *prefix, + const ACEXML_Char *uri, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + // *** Methods inherit from ACEXML_DTDHandler. + + /* + * Receive notification of a notation declaration event. + */ + virtual void notationDecl (const ACEXML_Char *name, + const ACEXML_Char *publicId, + const ACEXML_Char *systemId, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of an unparsed entity declaration event. + */ + virtual void unparsedEntityDecl (const ACEXML_Char *name, + const ACEXML_Char *publicId, + const ACEXML_Char *systemId, + const ACEXML_Char *notationName, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + // Methods inherit from ACEXML_EnitityResolver. + + /* + * Allow the application to resolve external entities. + */ + virtual ACEXML_InputSource *resolveEntity (const ACEXML_Char *publicId, + const ACEXML_Char *systemId, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + // Methods inherit from ACEXML_ErrorHandler. + + /* + * Receive notification of a recoverable error. + */ + virtual void error (ACEXML_SAXParseException &exception, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of a non-recoverable error. + */ + virtual void fatalError (ACEXML_SAXParseException &exception, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of a warning. + */ + virtual void warning (ACEXML_SAXParseException &exception, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + +protected: + /** + * Get the only attribute in <stream> or <streamdef>. + */ + int get_stream_id (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv); + + /** + * Get the only attribute in <resume>, <suspend>, <remove> + */ + int get_id (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv); + + /** + * Get the dynamic tag attributes. + */ + int get_dynamic_attrs (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv); + + /** + * Get the initializer tag attributes. + */ + int get_initializer_attrs (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv); + + /** + * Get the static tag attributes. + */ + int get_static_attrs (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv); + +private: + /// We are parsing a stream definition + int in_stream_def_; + + /// We are defining a steam module + int in_module_; + + /// @a stream_ holds the actually Stream_Type object managed by @a stream_svc_type_. + ACE_Service_Type *stream_svc_type_; + ACE_Stream_Type *stream_; + + ACE_SHLIB_HANDLE dll_handle_; + + ACE_Parsed_Info parsed_info_; + + ACE_Parsed_Info stream_info_; +}; + +#if defined (__ACEXML_INLINE__) +# include "Svcconf_Handler.i" +#endif /* __ACEXML_INLINE__ */ +#endif /* ACEXML_SVCCONF_HANDLER_H */ diff --git a/ACEXML/apps/svcconf/Svcconf_Handler.i b/ACEXML/apps/svcconf/Svcconf_Handler.i new file mode 100644 index 00000000000..c78a345e2f6 --- /dev/null +++ b/ACEXML/apps/svcconf/Svcconf_Handler.i @@ -0,0 +1,133 @@ +// -*- C++ -*- $Id$ + +ACE_INLINE +ACE_Parsed_Info::ACE_Parsed_Info () + : name_ (0), + service_type_ (ACE_Service_Type::INVALID_TYPE), + active_ (1), + path_ (0), + init_func_ (0), + init_params_ (0) +{ +} + +ACE_INLINE +ACE_Parsed_Info::~ACE_Parsed_Info () +{ + delete this->name_; + delete this->path_; + delete this->init_func_; + delete this->init_params_; +} + +ACE_INLINE int +ACE_Parsed_Info::name (const ACEXML_Char *n) +{ + if (this->name_ == 0) + { + this->name_ = ACE::strnew (n); + return 0; + } + return -1; +} + +ACE_INLINE const ACEXML_Char * +ACE_Parsed_Info::name (void) +{ + return this->name_; +} + +ACE_INLINE int +ACE_Parsed_Info::service_type (int type) +{ + if (this->service_type_ == -1) + { + this->service_type_ = type; + return 0; + } + return -1; +} + +ACE_INLINE int +ACE_Parsed_Info::service_type (void) +{ + return this->service_type_; +} + +ACE_INLINE int +ACE_Parsed_Info::active (int a) +{ + this->active_ = a; + return 0; +} + +ACE_INLINE int +ACE_Parsed_Info::active (void) +{ + return this->active_; +} + +ACE_INLINE int +ACE_Parsed_Info::path (const ACEXML_Char *p) +{ + if (this->path_ == 0) + { + this->path_ = ACE::strnew (p); + return 0; + } + return -1; +} + +ACE_INLINE const ACEXML_Char * +ACE_Parsed_Info::path (void) +{ + return this->path_; +} + +ACE_INLINE int +ACE_Parsed_Info::init_func (const ACEXML_Char *n) +{ + if (this->init_func_ == 0) + { + this->init_func_ = ACE::strnew (n); + return 0; + } + return -1; +} + +ACE_INLINE const ACEXML_Char * +ACE_Parsed_Info::init_func (void) +{ + return this->init_func_; +} + +ACE_INLINE int +ACE_Parsed_Info::init_params (const ACEXML_Char *n) +{ + if (this->init_params_ == 0) + { + this->init_params_ = ACE::strnew (n); + return 0; + } + return -1; +} + +ACE_INLINE const ACEXML_Char * +ACE_Parsed_Info::init_params (void) +{ + return this->init_params_; +} + +ACE_INLINE void +ACE_Parsed_Info::reset (void) +{ + delete this->name_; + this->name_ = 0; + this->service_type_ = -1; + delete this->path_; + this->path_ = 0; + delete this->init_func_; + this->init_func_ = 0; + delete this->init_params_; + this->init_params_ = 0; +} diff --git a/ACEXML/apps/svcconf/XML_Svc_Conf_Parser.dsp b/ACEXML/apps/svcconf/XML_Svc_Conf_Parser.dsp new file mode 100644 index 00000000000..1560ec4e6de --- /dev/null +++ b/ACEXML/apps/svcconf/XML_Svc_Conf_Parser.dsp @@ -0,0 +1,119 @@ +# Microsoft Developer Studio Project File - Name="XML_Svc_Conf_Parser" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=XML_Svc_Conf_Parser - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "XML_Svc_Conf_Parser.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "XML_Svc_Conf_Parser.mak" CFG="XML_Svc_Conf_Parser - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "XML_Svc_Conf_Parser - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "XML_Svc_Conf_Parser - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "XML_Svc_Conf_Parser - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XML_SVC_CONF_PARSER_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\.." /I "..\.." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 ace.lib ACEXML.lib ACEXML_Parser.lib /nologo /dll /machine:I386 /out:"..\..\..\bin\ACEXML_XML_Svc_Conf_Parser.dll" /libpath:"..\..\..\ace" /libpath:"..\..\Common" /libpath:"..\..\parser\parser"
+
+!ELSEIF "$(CFG)" == "XML_Svc_Conf_Parser - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "XML_Svc_Conf_Parser___Win32_Debug"
+# PROP BASE Intermediate_Dir "XML_Svc_Conf_Parser___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XML_SVC_CONF_PARSER_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\.." /I "..\.." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib ACEXMLd.lib ACEXML_Parserd.lib /nologo /dll /debug /machine:I386 /out:"..\..\..\bin\ACEXML_XML_Svc_Conf_Parserd.dll" /pdbtype:sept /libpath:"..\..\..\ace" /libpath:"..\..\Common" /libpath:"..\..\parser\parser"
+
+!ENDIF
+
+# Begin Target
+
+# Name "XML_Svc_Conf_Parser - Win32 Release"
+# Name "XML_Svc_Conf_Parser - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Svcconf.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Svcconf_Handler.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Svcconf.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Svcconf_Handler.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/ACEXML/common/Makefile b/ACEXML/common/Makefile index 85e52bedbc9..50e8fb3875e 100644 --- a/ACEXML/common/Makefile +++ b/ACEXML/common/Makefile @@ -20,6 +20,7 @@ FILES = Attributes_Def_Builder \ LocatorImpl \ NamespaceSupport \ SAXExceptions \ + StrCharStream \ Transcode \ Validator \ XMLFilterImpl diff --git a/ACEXML/common/Makefile.bor b/ACEXML/common/Makefile.bor index 30be682e3b0..2b182b02afb 100644 --- a/ACEXML/common/Makefile.bor +++ b/ACEXML/common/Makefile.bor @@ -16,6 +16,7 @@ OBJFILES = \ $(OBJDIR)\LocatorImpl.obj \ $(OBJDIR)\NamespaceSupport.obj \ $(OBJDIR)\SAXExceptions.obj \ + $(OBJDIR)\StrCharStream.obj \ $(OBJDIR)\Transcode.obj \ $(OBJDIR)\Validator.obj \ $(OBJDIR)\XMLFilterImpl.obj diff --git a/ACEXML/common/StrCharStream.cpp b/ACEXML/common/StrCharStream.cpp new file mode 100644 index 00000000000..55e5b93f201 --- /dev/null +++ b/ACEXML/common/StrCharStream.cpp @@ -0,0 +1,97 @@ +// $Id$ + +#include "common/StrCharStream.h" +#include "ace/ACE.h" + +ACEXML_StrCharStream::ACEXML_StrCharStream (void) + : start_ (0), + ptr_ (0), + end_ (0) +{ +} + +ACEXML_StrCharStream::ACEXML_StrCharStream (const ACEXML_Char *str) + : start_ (0), + ptr_ (0), + end_ (0) +{ + this->open (str); +} + + +ACEXML_StrCharStream::~ACEXML_StrCharStream (void) +{ + delete this->start_; +} + +int +ACEXML_StrCharStream::open (const ACEXML_Char *str) +{ + delete this->start_; + + if (str != 0 && + (this->start_ = ACE::strnew (str)) != 0) + { + this->ptr_ = this->start_; + this->end_ = this->start_ + ACE_OS_String::strlen (this->start_); + return 0; + } + + this->start_ = this->ptr_ = this->end_ = 0; + return -1; // Invalid string passed. +} + +int +ACEXML_StrCharStream::available (void) +{ + if (this->start_ != 0) + return (this->end_ - this->start_); // @@ Will this work on all platforms? + return -1; +} + +int +ACEXML_StrCharStream::close (void) +{ + delete this->start_; + this->start_ = this->ptr_ = this->end_ = 0; + return 0; +} + +int +ACEXML_StrCharStream::get (ACEXML_Char& ch) +{ + if (this->start_ != 0 && this->ptr_ != this->end_) + { + ch = *this->ptr_++; + + return 0; + } + + return -1; +} + +int +ACEXML_StrCharStream::read (ACEXML_Char *str, + size_t len) +{ + if (this->start_ != 0 && + this->ptr_ != this->end_) + { + if (len > this->end_ - this->ptr_) + len = this->end_ - this->ptr_; + + ACE_OS_String::strncpy (str, this->ptr_, len); + this->ptr_ += len; + return len; + } + return 0; +} + +int +ACEXML_StrCharStream::peek (void) +{ + if (this->start_ !=0 && + this->ptr_ != this->end_) + return *this->ptr_; + return -1; +} diff --git a/ACEXML/common/StrCharStream.h b/ACEXML/common/StrCharStream.h new file mode 100644 index 00000000000..17f8e33d914 --- /dev/null +++ b/ACEXML/common/StrCharStream.h @@ -0,0 +1,76 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file StrCharStream.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + +#ifndef _ACEXML_STRCHARSTREAM_H_ +#define _ACEXML_STRCHARSTREAM_H_ + +#include "common/CharStream.h" + +/** + * @class ACEXML_StrCharStream StrCharStream.h "common/StrCharStream.h" + * + * An implementation of ACEXML_CharStream for reading + * input from a null-terminated ACEXML_Char string. + */ +class ACEXML_Export ACEXML_StrCharStream : public ACEXML_CharStream +{ +public: + /// Default constructor. + ACEXML_StrCharStream (void); + + /// Initializing Constructor. + ACEXML_StrCharStream (const ACEXML_Char *str); + + /// Destructor + virtual ~ACEXML_StrCharStream (void); + + /// Initializing and reset the StrCharStream with @a str. + int open (const ACEXML_Char *str); + + /** + * Returns the available ACEXML_Char in the buffer. -1 + * if the object is not initialized properly. + */ + virtual int available (void); + + /** + * Close this stream and release all resources used by it. + */ + virtual int close (void); + + /** + * Read the next ACEXML_Char. Return -1 if we are not able to + * return an ACEXML_Char, 0 if EOS is reached, or 1 if succeed. + */ + virtual int get (ACEXML_Char& ch); + + /** + * Read the next batch of ACEXML_Char strings + */ + virtual int read (ACEXML_Char *str, + size_t len); + + /** + * Peek the next ACEXML_Char in the CharStream. Return the + * character if succeess, -1 if EOS is reached. + */ + virtual int peek (void); + +private: + ACEXML_Char *start_; + + ACEXML_Char *ptr_; + + ACEXML_Char *end_; +}; + +#endif /* _ACEXML_STRCHARSTREAM_H_ */ diff --git a/ACEXML/common/XML_Common.dsp b/ACEXML/common/XML_Common.dsp index 58a0361e595..761a07eac5c 100644 --- a/ACEXML/common/XML_Common.dsp +++ b/ACEXML/common/XML_Common.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XML_COMMON_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "../.." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "ACEXML_BUILD_DLL" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../.." /I ".." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "ACEXML_BUILD_DLL" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -69,7 +69,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XML_COMMON_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../.." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D ACEXML_HAS_DLL=1 /D "ACEXML_BUILD_DLL" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../.." /I ".." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D ACEXML_HAS_DLL=1 /D "ACEXML_BUILD_DLL" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
@@ -144,6 +144,10 @@ SOURCE=.\SAXExceptions.cpp # End Source File
# Begin Source File
+SOURCE=.\StrCharStream.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\Transcode.cpp
# End Source File
# Begin Source File
@@ -240,6 +244,10 @@ SOURCE=.\SAXExceptions.h # End Source File
# Begin Source File
+SOURCE=.\StrCharStream.h
+# End Source File
+# Begin Source File
+
SOURCE=.\Transcode.h
# End Source File
# Begin Source File
diff --git a/ACEXML/examples/SAXPrint/main.cpp b/ACEXML/examples/SAXPrint/main.cpp index 2d51dac2fec..86bf8ed86c5 100644 --- a/ACEXML/examples/SAXPrint/main.cpp +++ b/ACEXML/examples/SAXPrint/main.cpp @@ -2,33 +2,77 @@ #include "ACEXML/common/FileCharStream.h" #include "ACEXML/parser/parser/Parser.h" +#include "ACEXML/parser/parser/Parser.h" #include "Print_Handler.h" #include "SAXPrint_Handler.h" +#include "ace/Get_Opt.h" + +static ACE_TCHAR *test_string = +ACE_TEXT ("<?xml version='1.0'?> <ACE_Svc_Conf> <static id=\"ACE_Service_Manager\" params='-d -p 4911'/> <dynamic id=\"Test_Task\" type=\"service_object\"> A & <initializer path=\"CCM_App\" init='_make_Test_Task' params='-p 3000'/> </dynamic> </ACE_Svc_Conf>"); int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { + ACE_TCHAR *filename = 0; + int sax = 0; // Use SAXPrint handler or not. + int str = 0; + + ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("sf:l")); + ACE_TCHAR c; + + while ((c = get_opt ()) != -1) + { + switch (c) + { + case 's': + sax = 1; + break; + case 'l': + str = 1; + break; + case 'f': + filename = get_opt.opt_arg (); + break; + default: + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Usage: %s [-sl] [-f <filename>]\n") + ACE_TEXT (" -s: Use SAXPrint_Handler (Default is Print_Handler\n") + ACE_TEXT (" -l: Parse the internal strings (test the StrCharStream class\n") + ACE_TEXT (" -f: Specify the filename when -l is not specified\n"), + argv[0]), + -1); + } + }; + + if (str == 0 && filename == 0) + ACE_ERROR_RETURN ((LM_ERROR, "No filename specified\n"), -1); + ACEXML_DefaultHandler *handler = 0; { - if (argc < 2) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("Usage: %s <XML filename> [-n]\n"), - argv [0]), - -1); - - ACEXML_FileCharStream *fstm = 0; - ACE_NEW_RETURN (fstm, - ACEXML_FileCharStream (), - 1); - - if (fstm->open (argv [1]) != 0) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("Fail to open XML file: %s\n"), - argv [1]), - -1); - - if (argc == 2) // + ACEXML_CharStream *stm = 0; + if (str == 0) + { + ACEXML_FileCharStream *fstm = 0; + ACE_NEW_RETURN (fstm, + ACEXML_FileCharStream (), + 1); + + if (fstm->open (filename) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Fail to open XML file: %s\n"), + filename), + -1); + stm = fstm; + } + else + { + ACE_NEW_RETURN (stm, + ACEXML_StrCharStream (test_string), + 1); + } + + if (sax == 0) ACE_NEW_RETURN (handler, ACEXML_Print_Handler (), -1); @@ -38,7 +82,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -1); ACEXML_Parser parser; - ACEXML_InputSource input(fstm); + ACEXML_InputSource input(stm); parser.setContentHandler (handler); parser.setDTDHandler (handler); diff --git a/ACEXML/examples/SAXPrint/svc.conf.xml b/ACEXML/examples/SAXPrint/svc.conf.xml index ff0eebe831f..152f3b44406 100644 --- a/ACEXML/examples/SAXPrint/svc.conf.xml +++ b/ACEXML/examples/SAXPrint/svc.conf.xml @@ -19,15 +19,10 @@ ]> <ACE_Svc_Conf> -<static id="ACE_Service_Manager"> - <params>-d</params> - <params>-p 4911</params> -</static> +<static id="ACE_Service_Manager" params="-d -p 4911"/> <dynamic id="Test_Task" type="service_object"> A & - <initializer path="CCM_App" init="_make_Test_Task"> - <params>-p 3000</params> - </initializer> + <initializer path="CCM_App" init="_make_Test_Task" params="-p 3000" /> </dynamic> <streamdef> @@ -42,10 +37,7 @@ <initializer path="CCM_App" init="make_ea"/> </dynamic> <dynamic id="Multicast_Router" type="module"> - <initializer path="CCM_App" init="make_mr"> - <params>-p</params> - <params>3001</params> - </initializer> + <initializer path="CCM_App" init="make_mr" params="-p 3001"/> </dynamic> </module> </streamdef> diff --git a/ACEXML/examples/svcconf/README b/ACEXML/examples/svcconf/README new file mode 100644 index 00000000000..7463c7e9572 --- /dev/null +++ b/ACEXML/examples/svcconf/README @@ -0,0 +1,3 @@ +$Id$ + +A test workspace for svc.conf handler.
\ No newline at end of file diff --git a/ACEXML/examples/svcconf/Svcconf.dsp b/ACEXML/examples/svcconf/Svcconf.dsp new file mode 100644 index 00000000000..15911671e1c --- /dev/null +++ b/ACEXML/examples/svcconf/Svcconf.dsp @@ -0,0 +1,110 @@ +# Microsoft Developer Studio Project File - Name="Svcconf" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Svcconf - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "Svcconf.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Svcconf.mak" CFG="Svcconf - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Svcconf - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Svcconf - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Svcconf - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib ACEXML.lib ACEXML_Parser.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\ace" /libpath:"..\..\Common" /libpath:"..\..\parser\parser"
+
+!ELSEIF "$(CFG)" == "Svcconf - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\\" /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib ACEXMLd.lib ACEXML_Parserd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\ace" /libpath:"..\..\Common" /libpath:"..\..\parser\parser"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Svcconf - Win32 Release"
+# Name "Svcconf - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\main.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Svcconf_Handler.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Svcconf_Handler.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/ACEXML/examples/svcconf/Svcconf.dsw b/ACEXML/examples/svcconf/Svcconf.dsw new file mode 100644 index 00000000000..f25a54a4e72 --- /dev/null +++ b/ACEXML/examples/svcconf/Svcconf.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "Svcconf"=.\Svcconf.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/ACEXML/examples/svcconf/Svcconf_Handler.cpp b/ACEXML/examples/svcconf/Svcconf_Handler.cpp new file mode 100644 index 00000000000..8376c7e41d2 --- /dev/null +++ b/ACEXML/examples/svcconf/Svcconf_Handler.cpp @@ -0,0 +1,495 @@ +// -*- C++ -*- $Id$ + +#include "Svcconf_Handler.h" +#include "ace/ACE.h" +#include "ace/Log_Msg.h" + +#if !defined (__ACEXML_INLINE__) +# include "Svcconf_Handler.i" +#endif /* __ACEXML_INLINE__ */ + +ACEXML_Svcconf_Handler::ACEXML_Svcconf_Handler (void) + : in_stream_def_ (0), + in_module_ (0) +{ + // no-op +} + +ACEXML_Svcconf_Handler::~ACEXML_Svcconf_Handler (void) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::characters (const ACEXML_Char *, + int, + int, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::endDocument (ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::endElement (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *qName, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + if (ACE_OS_String::strcmp (qName, ACE_TEXT ("dynamic")) == 0) + { + if (this->in_stream_def_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Create dynamic %s for stream\n"), + this->stream_info_.name ())); + } + else + { + if (this->in_module_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Push dynamic %s into stream %s\n"), + this->parsed_info_.name (), + this->stream_info_.name ())); + } + else + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply dynamic %s\n"), + this->parsed_info_.name ())); + } + this->parsed_info_.reset (); + } + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("static")) == 0) + { + if (this->in_stream_def_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Create sttaic %s for stream\n"), + this->stream_info_.name ())); + } + else + { + if (this->in_module_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Push static %s into stream %s\n"), + this->parsed_info_.name (), + this->stream_info_.name ())); + } + else + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply static %s\n"), + this->parsed_info_.name ())); + } + this->parsed_info_.reset (); + } + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("module")) == 0) + { + this->in_module_ = 0; + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("streamdef")) == 0 || + ACE_OS_String::strcmp (qName, ACE_TEXT ("stream")) == 0) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply stream %s of type %s\n"), + this->stream_info_.name (), + this->stream_info_.name ())); + this->stream_info_.reset (); + } + else + { + } +} + +void +ACEXML_Svcconf_Handler::endPrefixMapping (const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::ignorableWhitespace (const ACEXML_Char *, + int, + int, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::processingInstruction (const ACEXML_Char *, + const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::setDocumentLocator (ACEXML_Locator *, + ACEXML_Env &) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::skippedEntity (const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::startDocument (ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::startElement (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *qName, + ACEXML_Attributes *alist, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + if (ACE_OS_String::strcmp (qName, ACE_TEXT ("dynamic")) == 0) + { + this->get_dynamic_attrs (alist, xmlenv); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("initializer")) == 0) + { + this->get_initializer_attrs (alist, xmlenv); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("static")) == 0) + { + this->get_static_attrs (alist, xmlenv); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("stream")) == 0) + { + this->get_stream_id (alist, xmlenv); + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Retrieve stream %s from repository\n"), + this->stream_info_.name ())); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("streamdef")) == 0) + { + this->in_stream_def_ = 1; + // @@ Set up stream service object + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("module")) == 0) + { + this->in_stream_def_ = 0; + this->in_module_ = 1; + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("resume")) == 0) + { + this->get_id (alist, xmlenv); + if (this->in_module_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Resume %s in stream %s\n"), + this->parsed_info_.name (), + this->stream_info_.name ())); + } + else + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Resume %s\n"), + this->parsed_info_.name ())); + } + this->parsed_info_.reset (); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("suspend")) == 0) + { + this->get_id (alist, xmlenv); + if (this->in_module_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Suspend %s in stream %s\n"), + this->parsed_info_.name (), + this->stream_info_.name ())); + } + else + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Suspend %s\n"), + this->parsed_info_.name ())); + } + this->parsed_info_.reset (); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("remove")) == 0) + { + this->get_id (alist, xmlenv); + if (this->in_module_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Remove %s in stream %s\n"), + this->parsed_info_.name (), + this->stream_info_.name ())); + } + else + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Remove %s\n"), + this->parsed_info_.name ())); + } + this->parsed_info_.reset (); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("ACE_Svc_Conf")) == 0) + { + // Main document tag. no-op. + ACE_DEBUG ((LM_INFO, ACE_TEXT ("ACE_Svc_Conf tag\n"))); + } + else + { + // @@ Error. Perhaps we should relay to user event handler here, if available. + } + + return; + + if (alist != 0) + for (size_t i = 0; i < alist->getLength (); ++i) + { + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT (" %s = \"%s\""), + alist->getQName (i), alist->getValue (i))); + } + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (">"))); +} + +void +ACEXML_Svcconf_Handler::startPrefixMapping (const ACEXML_Char *, + const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +// *** Methods inherit from ACEXML_DTDHandler. + +void +ACEXML_Svcconf_Handler::notationDecl (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +void +ACEXML_Svcconf_Handler::unparsedEntityDecl (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +// Methods inherit from ACEXML_EnitityResolver. + +ACEXML_InputSource * +ACEXML_Svcconf_Handler::resolveEntity (const ACEXML_Char *, + const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. + return 0; +} + +// Methods inherit from ACEXML_ErrorHandler. + + /* + * Receive notification of a recoverable error. + */ +void +ACEXML_Svcconf_Handler::error (ACEXML_SAXParseException &, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +void +ACEXML_Svcconf_Handler::fatalError (ACEXML_SAXParseException &, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +void +ACEXML_Svcconf_Handler::warning (ACEXML_SAXParseException &, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +int +ACEXML_Svcconf_Handler::get_stream_id (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv) +{ + if (alist != 0) + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) + { + this->stream_info_.name (alist->getValue (i)); + } + else + { + // @@ Exception... + return -1; + } + } + return 0; +} + +int +ACEXML_Svcconf_Handler::get_id (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv) +{ + if (alist != 0) + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) + { + this->parsed_info_.name (alist->getValue (i)); + } + else + { + // @@ Exception... + return -1; + } + } + return 0; +} + +int +ACEXML_Svcconf_Handler::get_dynamic_attrs (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv) +{ + if (alist != 0) + { + ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ? + &this->parsed_info_ : + &this->stream_info_); + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) + { + info->name (alist->getValue (i)); + } + else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("status")) == 0) + { + if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("inactive")) == 0) + { + } + else if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("active")) == 0) + { + } + else + { + // @@ error, invalid 'status' value. + } + } + else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("type")) == 0) + { + if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("service_object")) == 0) + { + info->service_type (ACE_Parsed_Info::SERVICE_OBJECT_TYPE); + } + else if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("stream")) == 0) + { + info->service_type (ACE_Parsed_Info::STREAM_TYPE); + } + else if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("module")) == 0) + { + info->service_type (ACE_Parsed_Info::MODULE_TYPE); + } + else + { + // @@ error, invalid 'type' value. + } + } + else + { + // @@ Exception... + return -1; + } + } + } + return 0; +} + +int +ACEXML_Svcconf_Handler::get_initializer_attrs (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv) +{ + if (alist != 0) + { + ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ? + &this->parsed_info_ : + &this->stream_info_); + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("init")) == 0) + { + info->init_func (alist->getValue (i)); + } + else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("path")) == 0) + { + info->path (alist->getValue (i)); + } + else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("params")) == 0) + { + info->init_params (alist->getValue (i)); + } + else + { + // @@ Exception... + return -1; + } + } + } + return 0; +} + +int +ACEXML_Svcconf_Handler::get_static_attrs (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv) +{ + if (alist != 0) + { + ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ? + &this->parsed_info_ : + &this->stream_info_); + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) + { + info->name (alist->getValue (i)); + } + else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("params")) == 0) + { + info->init_params (alist->getValue (i)); + } + else + { + // @@ Exception... + return -1; + } + } + } + return 0; +} diff --git a/ACEXML/examples/svcconf/Svcconf_Handler.h b/ACEXML/examples/svcconf/Svcconf_Handler.h new file mode 100644 index 00000000000..1cff80eee87 --- /dev/null +++ b/ACEXML/examples/svcconf/Svcconf_Handler.h @@ -0,0 +1,305 @@ +// $Id$ + +//============================================================================= +/** + * @file Svcconf_Handler.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + +#ifndef ACEXML_SVCCONF_HANDLER_H +#define ACEXML_SVCCONF_HANDLER_H + +#include "common/DefaultHandler.h" + +class ACE_Parsed_Info +{ +public: + typedef enum { + MODULE_TYPE, + SERVICE_OBJECT_TYPE, + STREAM_TYPE, + INVALID_TYPE + } Service_Type; + + ACE_Parsed_Info (); + ~ACE_Parsed_Info (); + + /** + * Set/get name of a parsed entity. + */ + int name (const ACEXML_Char *n); + const ACEXML_Char *name (void); + + /** + * Set/get type of a dynamic node. + */ + int service_type (Service_Type type); + Service_Type service_type (void); + + /** + * Set/Get active status. + */ + int active (int a); + int active (void); + + /** + * Set/get initializer path. + */ + int path (const ACEXML_Char *n); + const ACEXML_Char *path (void); + + /** + * Set/get initializer init function. + */ + int init_func (const ACEXML_Char *n); + const ACEXML_Char *init_func (void); + + /** + * Set/get initializer init parameter. + */ + int init_params (const ACEXML_Char *n); + const ACEXML_Char *init_params (void); + + /** + * Reset Parsed_Info. + */ + void reset (void); + +protected: + ACEXML_Char *name_; + Service_Type service_type_; + int active_; + ACEXML_Char *path_; + ACEXML_Char *init_func_; + ACEXML_Char *init_params_; +}; + +/** + * @class ACEXML_Svcconf_Handler + * + * @brief ACEXML_Svcconf_Handler is an example SAX event handler. + * + * This SAX event handler try to regenerate the XML document it + * reads with correct indentation. + */ +class ACEXML_Svcconf_Handler : public ACEXML_DefaultHandler +{ +public: + /* + * Default constructor. + */ + ACEXML_Svcconf_Handler (void); + + /* + * Default destructor. + */ + virtual ~ACEXML_Svcconf_Handler (void); + + // Methods inherit from ACEXML_ContentHandler. + + /* + * Receive notification of character data. + */ + virtual void characters (const ACEXML_Char *ch, + int start, + int length, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of the end of a document. + */ + virtual void endDocument (ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of the end of an element. + */ + virtual void endElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * End the scope of a prefix-URI mapping. + */ + virtual void endPrefixMapping (const ACEXML_Char *prefix, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of ignorable whitespace in element content. + */ + virtual void ignorableWhitespace (const ACEXML_Char *ch, + int start, + int length, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of a processing instruction. + */ + virtual void processingInstruction (const ACEXML_Char *target, + const ACEXML_Char *data, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive an object for locating the origin of SAX document events. + */ + virtual void setDocumentLocator (ACEXML_Locator *locator, + ACEXML_Env &xmlenv) ; + + /* + * Receive notification of a skipped entity. + */ + virtual void skippedEntity (const ACEXML_Char *name, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of the beginning of a document. + */ + virtual void startDocument (ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of the beginning of an element. + */ + virtual void startElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Begin the scope of a prefix-URI Namespace mapping. + */ + virtual void startPrefixMapping (const ACEXML_Char *prefix, + const ACEXML_Char *uri, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + // *** Methods inherit from ACEXML_DTDHandler. + + /* + * Receive notification of a notation declaration event. + */ + virtual void notationDecl (const ACEXML_Char *name, + const ACEXML_Char *publicId, + const ACEXML_Char *systemId, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of an unparsed entity declaration event. + */ + virtual void unparsedEntityDecl (const ACEXML_Char *name, + const ACEXML_Char *publicId, + const ACEXML_Char *systemId, + const ACEXML_Char *notationName, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + // Methods inherit from ACEXML_EnitityResolver. + + /* + * Allow the application to resolve external entities. + */ + virtual ACEXML_InputSource *resolveEntity (const ACEXML_Char *publicId, + const ACEXML_Char *systemId, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + // Methods inherit from ACEXML_ErrorHandler. + + /* + * Receive notification of a recoverable error. + */ + virtual void error (ACEXML_SAXParseException &exception, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of a non-recoverable error. + */ + virtual void fatalError (ACEXML_SAXParseException &exception, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of a warning. + */ + virtual void warning (ACEXML_SAXParseException &exception, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + +protected: + /** + * Get the only attribute in <stream> or <streamdef>. + */ + int get_stream_id (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv); + + /** + * Get the only attribute in <resume>, <suspend>, <remove> + */ + int get_id (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv); + + /** + * Get the dynamic tag attributes. + */ + int get_dynamic_attrs (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv); + + /** + * Get the initializer tag attributes. + */ + int get_initializer_attrs (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv); + + /** + * Get the static tag attributes. + */ + int get_static_attrs (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv); + +private: + /// We are parsing a stream definition + int in_stream_def_; + + /// We are defining a steam module + int in_module_; + + ACE_Parsed_Info parsed_info_; + + ACE_Parsed_Info stream_info_; +}; + +#if defined (__ACEXML_INLINE__) +# include "Svcconf_Handler.i" +#endif /* __ACEXML_INLINE__ */ +#endif /* ACEXML_SVCCONF_HANDLER_H */ diff --git a/ACEXML/examples/svcconf/Svcconf_Handler.i b/ACEXML/examples/svcconf/Svcconf_Handler.i new file mode 100644 index 00000000000..fb6ea3db2ce --- /dev/null +++ b/ACEXML/examples/svcconf/Svcconf_Handler.i @@ -0,0 +1,133 @@ +// -*- C++ -*- $Id$ + +ACE_INLINE +ACE_Parsed_Info::ACE_Parsed_Info () + : name_ (0), + service_type_ (INVALID_TYPE), + active_ (1), + path_ (0), + init_func_ (0), + init_params_ (0) +{ +} + +ACE_INLINE +ACE_Parsed_Info::~ACE_Parsed_Info () +{ + delete this->name_; + delete this->path_; + delete this->init_func_; + delete this->init_params_; +} + +ACE_INLINE int +ACE_Parsed_Info::name (const ACEXML_Char *n) +{ + if (this->name_ == 0) + { + this->name_ = ACE::strnew (n); + return 0; + } + return -1; +} + +ACE_INLINE const ACEXML_Char * +ACE_Parsed_Info::name (void) +{ + return this->name_; +} + +ACE_INLINE int +ACE_Parsed_Info::service_type (Service_Type type) +{ + if (this->service_type_ == INVALID_TYPE) + { + this->service_type_ = type; + return 0; + } + return -1; +} + +ACE_INLINE ACE_Parsed_Info::Service_Type +ACE_Parsed_Info::service_type (void) +{ + return this->service_type_; +} + +ACE_INLINE int +ACE_Parsed_Info::active (int a) +{ + this->active_ = a; + return 0; +} + +ACE_INLINE int +ACE_Parsed_Info::active (void) +{ + return this->active_; +} + +ACE_INLINE int +ACE_Parsed_Info::path (const ACEXML_Char *p) +{ + if (this->path_ == 0) + { + this->path_ = ACE::strnew (p); + return 0; + } + return -1; +} + +ACE_INLINE const ACEXML_Char * +ACE_Parsed_Info::path (void) +{ + return this->path_; +} + +ACE_INLINE int +ACE_Parsed_Info::init_func (const ACEXML_Char *n) +{ + if (this->init_func_ == 0) + { + this->init_func_ = ACE::strnew (n); + return 0; + } + return -1; +} + +ACE_INLINE const ACEXML_Char * +ACE_Parsed_Info::init_func (void) +{ + return this->init_func_; +} + +ACE_INLINE int +ACE_Parsed_Info::init_params (const ACEXML_Char *n) +{ + if (this->init_params_ == 0) + { + this->init_params_ = ACE::strnew (n); + return 0; + } + return -1; +} + +ACE_INLINE const ACEXML_Char * +ACE_Parsed_Info::init_params (void) +{ + return this->init_params_; +} + +ACE_INLINE void +ACE_Parsed_Info::reset (void) +{ + delete this->name_; + this->name_ = 0; + this->service_type_ = INVALID_TYPE; + delete this->path_; + this->path_ = 0; + delete this->init_func_; + this->init_func_ = 0; + delete this->init_params_; + this->init_params_ = 0; +} diff --git a/ACEXML/examples/svcconf/main.cpp b/ACEXML/examples/svcconf/main.cpp new file mode 100644 index 00000000000..bbadfdc0bc0 --- /dev/null +++ b/ACEXML/examples/svcconf/main.cpp @@ -0,0 +1,71 @@ +// $Id$ + +#include "common/FileCharStream.h" +#include "common/StrCharStream.h" +#include "parser/parser/Parser.h" +#include "Svcconf_Handler.h" +#include "ace/Get_Opt.h" + +int +main (int argc, ACE_TCHAR *argv[]) +{ + ACE_TCHAR *filename = 0; + + ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("f:")); + ACE_TCHAR c; + + while ((c = get_opt ()) != -1) + { + switch (c) + { + case 'f': + filename = get_opt.opt_arg (); + break; + default: + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Usage: %s [-f <filename>]\n") + ACE_TEXT (" -f: Specify the svcconf filename\n"), + argv[0]), + -1); + } + }; + + if (filename == 0) + ACE_ERROR_RETURN ((LM_ERROR, "No filename specified\n"), -1); + + ACEXML_DefaultHandler *handler = 0; + { + ACEXML_CharStream *stm = 0; + ACEXML_FileCharStream *fstm = 0; + ACE_NEW_RETURN (fstm, + ACEXML_FileCharStream (), + 1); + + if (fstm->open (filename) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Fail to open XML file: %s\n"), + filename), + -1); + stm = fstm; + + ACE_NEW_RETURN (handler, + ACEXML_Svcconf_Handler (), + -1); + + ACEXML_Parser parser; + ACEXML_InputSource input(stm); + + parser.setContentHandler (handler); + parser.setDTDHandler (handler); + parser.setErrorHandler (handler); + parser.setEntityResolver (handler); + + ACEXML_Env xmlenv; + + parser.parse (&input, xmlenv); + if (xmlenv.exception ()) + xmlenv.exception ()->print (); + } + delete handler; + return 0; +} diff --git a/ACEXML/examples/test_docs/svcconf.dtd b/ACEXML/examples/test_docs/svcconf.dtd index dded178c1f7..b9e6cc41c8e 100644 --- a/ACEXML/examples/test_docs/svcconf.dtd +++ b/ACEXML/examples/test_docs/svcconf.dtd @@ -36,14 +36,16 @@ type (module|service_object|stream) #REQUIRED> <!-- Initializing function for dynamic entry. --> -<!ELEMENT initializer (params)*> +<!ELEMENT initializer EMPTY> <!ATTLIST initializer init CDATA #REQUIRED - path CDATA #IMPLIED> + path CDATA #IMPLIED + params CDATA #IMPLIED> <!-- A 'static' entry takes an ID attribute and an optional --> <!-- parameter lists. --> -<!ELEMENT static (params)*> -<!ATTLIST static id ID #REQUIRED> +<!ELEMENT static EMPTY> +<!ATTLIST static id ID #REQUIRED + params CDATA #IMPLIED> <!-- A 'suspend' entry takes an ID attribute. --> <!ELEMENT suspend EMPTY> @@ -56,10 +58,3 @@ <!-- A 'remove' entry takes an ID attribute. --> <!ELEMENT remove EMPTY> <!ATTLIST remove id IDREF #REQUIRED> - -<!-- A params entry can appear within dynamic and static. --> -<!-- Parameters can appear multiple time and the SAX handler --> -<!-- for Service_Configurator is supposed to concatinate --> -<!-- them together with appropriate white space to separate --> -<!-- parameters appeared in separate elements. --> -<!ELEMENT params (#PCDATA)>
\ No newline at end of file diff --git a/ACEXML/parser/parser/Makefile b/ACEXML/parser/parser/Makefile index ffd88d5c13e..63af2ae6557 100644 --- a/ACEXML/parser/parser/Makefile +++ b/ACEXML/parser/parser/Makefile @@ -13,7 +13,7 @@ FILES = Entity_Manager \ DEFS = $(addsuffix .h,$(FILES)) LSRC = $(addsuffix .cpp,$(FILES)) -LIBS += $(ACELIB) -lACEXML +LIBS += -lACEXML $(ACELIB) BUILD = $(VLIB) $(VSHLIB) diff --git a/ACEXML/parser/parser/Parser.cpp b/ACEXML/parser/parser/Parser.cpp index 7ff342bd92e..ca428c94a2c 100644 --- a/ACEXML/parser/parser/Parser.cpp +++ b/ACEXML/parser/parser/Parser.cpp @@ -264,7 +264,7 @@ ACEXML_Parser::parse_xml_prolog (ACEXML_Env &xmlenv) this->get () != 'l') { xmlenv.exception (new ACEXML_SAXParseException - (ACE_LIB_TEXT ("Unrecognized XML Decl"))); + (ACE_LIB_TEXT ("Unrecognized XML Decl ('<?xml' ?)"))); return; } @@ -281,7 +281,7 @@ ACEXML_Parser::parse_xml_prolog (ACEXML_Env &xmlenv) this->get_quoted_string (astring) != 0) { xmlenv.exception (new ACEXML_SAXParseException - (ACE_LIB_TEXT ("Unrecognized XML Decl"))); + (ACE_LIB_TEXT ("Unrecognized XML Decl ('version'?)"))); return; } @@ -329,7 +329,7 @@ ACEXML_Parser::parse_xml_prolog (ACEXML_Env &xmlenv) else { xmlenv.exception (new ACEXML_SAXParseException - (ACE_LIB_TEXT ("Unrecognized XML Decl"))); + (ACE_LIB_TEXT ("Unrecognized XML Decl ('encoding'?)"))); return; } } @@ -360,13 +360,13 @@ ACEXML_Parser::parse_xml_prolog (ACEXML_Env &xmlenv) } } xmlenv.exception (new ACEXML_SAXParseException - (ACE_LIB_TEXT ("Unrecognized XML Decl"))); + (ACE_LIB_TEXT ("Unrecognized XML Decl ('standalone'?)"))); return; } else { xmlenv.exception (new ACEXML_SAXParseException - (ACE_LIB_TEXT ("Unrecognized XML Decl"))); + (ACE_LIB_TEXT ("Unrecognized XML Decl ('standalone'?)"))); return; } } @@ -377,7 +377,7 @@ ACEXML_Parser::parse_xml_prolog (ACEXML_Env &xmlenv) if (this->get() != '>') { xmlenv.exception (new ACEXML_SAXParseException - (ACE_LIB_TEXT ("Unrecognized XML Decl"))); + (ACE_LIB_TEXT ("Unrecognized XML Decl ('>'?)"))); return; } return; diff --git a/ChangeLog b/ChangeLog index c99a6d31c50..73238225565 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,181 @@ +Wed May 8 15:15:41 2002 Nanbor Wang <nanbor@cs.wustl.edu> + + Merged in the XML-based Service Configurator framework. The + XML-based Service Configruator is *not* enabled by default and + the merge should not affect existing applications. We will make + the XML-based Service Configurator the defualt one at some point + in the future. So you might want to try it out before that + time. :) To switch current ACE to use XML Service Configurtor, + Add + + #define ACE_HAS_XML_SVC_CONF + + in your <config.h>. You can use the + $(ACE_ROOT)/bin/svcconf_convert.pl to convert your existing + svc.conf files to svc.conf.xml. + + * ace/OS.h: + * ace/Parse_Node.cpp: + * ace/Parse_Node.h: + * ace/Service_Config.cpp: + * ace/Service_Config.h: + * ace/Svc_Conf.h: + * ace/Svc_Conf_Lexer_Guard.cpp: + * ace/Svc_Conf_l.cpp: + * ace/Svc_Conf_y.cpp: + * tests/Service_Config_DLL.cpp: Simplified the macro check. + + + * ace/Service_Config.h: + * ACEXML/apps/svcconf/Svcconf.cpp: Fixed Linux compilation warnings. + + * ACEXML/apps/svcconf/Svcconf_Handler.cpp: + * ace/Service_Config.cpp: Added more comprehensive error messages. + + * ACEXML/Makefile: + * ACEXML/Makefile.bor: + * ACEXML/apps/Makefile: + * ACEXML/apps/Makefile.bor: + * ACEXML/apps/svcconf/Makefile: + * ACEXML/apps/svcconf/Makefile.bor: + * ACEXML/parser/parser/Makefile: + * ace/Makefile: + * ace/Makefile.am: + * ace/Makefile.bor: + * ace/ace.icc: + * examples/ASX/CCM_App/Makefile: + * examples/ASX/CCM_App/Makefile.CCM_App: Added or Updated Makefiles. + + + * bin/svcconf-convert.pl: Added more debugging info printout. + Fixed incorrect mapping on initializer path/path and + state/params. + + * ace/Service_Object.h: Added enum definition to differentiate + ACE_Service_Type_Impl. The enum values are taken from + "ace/Svc_Conf_Toekns.h" so that the same service can work with + both classic and XML service configurator frameworks. + + + * ace/Service_Config.h: + * ace/Service_Config.cpp: Added <create_service_type> and + <create_service_type_impl> methods to ensure objects are + allocated in consistent DLL. + + * ACEXML/parser/parser/Parser.cpp: Made the exception messages + more comprehensive so it's easier to determine the origins of + parse errors. + + * ACEXML/apps/svcconf/Svcconf_Handler.h: + * ACEXML/apps/svcconf/Svcconf_Handler.i: + * ACEXML/apps/svcconf/Svcconf_Handler.cpp: Added more implementation. + + * examples/ASX/CCM_App/svc.conf.xml: + * netsvcs/servers/svc.conf.xml: + * tests/Service_Config_Test.conf.xml: Added new XML-based svc.conf files. + + * tests/Service_Config_DLL.cpp: Added xml-based inline svc.conf directives. + + + * ACEXML/apps/XML_Apps.dsw: Added new workspace for XML + applications. This should contains all projects under this + subdirectory. + + * ACEXML/apps/svcconf/README: + * ACEXML/apps/svcconf/Svcconf.cpp: + * ACEXML/apps/svcconf/Svcconf.h: + * ACEXML/apps/svcconf/Svcconf_Handler.cpp: + * ACEXML/apps/svcconf/Svcconf_Handler.h: + * ACEXML/apps/svcconf/Svcconf_Handler.i: + * ACEXML/apps/svcconf/XML_Svc_Conf_Parser.dsp: Added new files + that implement the parser for XML-based Service Configurator. + + * bin/svcconf-convert.pl: Updated the help message. + + * ace/config-all.h: Added ACE_DEFAULT_SVC_CONF_EXT to define the + default file extention name for svc.conf files. It is ".conf" + when using classic Service Configurator and ".conf.xml" when + using XML Service Configurator. + + * tests/Service_Config_Test.cpp: Changed to use different file + extension with different Service Configurator. + + * tests/Service_Config_Test.conf.xml: Added the converted XML + based svc.conf file. + + * ace/ace_dll.dsp: + * ace/ace_lib.dsp: + * ace/XML_Svc_Conf.h: + * ace/XML_Svc_Conf.cpp: Added abstract interface definition for + DLL based XML parser. + + * ace/OS.h: Defined ACE_DEFAULT_SVC_CONF_FILE to "svc.conf.xml" if + ACE_USES_CLASSIC_SVC_CONF is not defined. + + * ace/Service_Config.cpp: Adapt Service_Config to use XML parser + to process an svc.conf.xml file. + + + * bin/generate_export_file.pl: Added code to record the flags used + to generate an export file. + + + * XML/examples/svcconf/Svcconf_Handler.h: + * XML/examples/svcconf/Svcconf_Handler.i: + * XML/examples/svcconf/Svcconf_Handler.cpp: Added Svcconf handling + simulation. + + * XML/examples/test_docs/svcconf.dtd: Revised Svcconf DTD. + + + * XML/examples/test_docs/svcconf.dtd: Updated the DTD again. + The <streamdef> tag also needed an "id" attribute. + + * XML/examples/SAXPrint/main.cpp: + * XML/examples/SAXPrint/svc.conf.xml: Modified the sample XML to + conform to the updated svcconf.dtd. + + * XML/examples/svcconf/README: + * XML/examples/svcconf/Svcconf.dsp: + * XML/examples/svcconf/Svcconf.dsw: + * XML/examples/svcconf/Svcconf_Handler.cpp: + * XML/examples/svcconf/Svcconf_Handler.h: + * XML/examples/svcconf/Svcconf_Handler.i: + * XML/examples/svcconf/main.cpp: New example to test out + svc.conf.xml parsing. Not finished. + + + * XML/examples/test_docs/svcconf.dtd: Simplied the svc.conf.dtd by + removing the <params> tags and making it an attribute for + <initializer> and <static> tags. + + + * ace/Parse_Node.cpp: + * ace/Parse_Node.h: + * ace/Service_Config.cpp: + * ace/Service_Config.h: + * ace/Svc_Conf.h: + * ace/Svc_Conf.y: + * ace/Svc_Conf_Lexer_Guard.cpp: + * ace/Svc_Conf_l.cpp: + * ace/Svc_Conf_y.cpp: Decoupled old Service_Config parser from ACE. + + + * XML/examples/SAXPrint/main.cpp: Added a new test to try the new + StrCharStream and switch to use ACE_Get_Opt to support more + robust command line arguments. + + * XML/common/StrCharStream.h: + * XML/common/StrCharStream.cpp: Added new CharStream class that + take a null-terminated ACEXML_Char string as an input source. + + * XML/common/FileCharStream.h: Removed unnecessary inclusion of + "ace/streams.h". + + * XML/common/Makefile: + * XML/common/Makefile.bor: + * XML/common/XML_Common.dsp: Added StrCharStream.*. + Wed May 8 16:29:05 2002 Krishnakumar B <kitty@cs.wustl.edu> * bin/nightlybuilds/builds.lst (STATUS): diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index c99a6d31c50..73238225565 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,181 @@ +Wed May 8 15:15:41 2002 Nanbor Wang <nanbor@cs.wustl.edu> + + Merged in the XML-based Service Configurator framework. The + XML-based Service Configruator is *not* enabled by default and + the merge should not affect existing applications. We will make + the XML-based Service Configurator the defualt one at some point + in the future. So you might want to try it out before that + time. :) To switch current ACE to use XML Service Configurtor, + Add + + #define ACE_HAS_XML_SVC_CONF + + in your <config.h>. You can use the + $(ACE_ROOT)/bin/svcconf_convert.pl to convert your existing + svc.conf files to svc.conf.xml. + + * ace/OS.h: + * ace/Parse_Node.cpp: + * ace/Parse_Node.h: + * ace/Service_Config.cpp: + * ace/Service_Config.h: + * ace/Svc_Conf.h: + * ace/Svc_Conf_Lexer_Guard.cpp: + * ace/Svc_Conf_l.cpp: + * ace/Svc_Conf_y.cpp: + * tests/Service_Config_DLL.cpp: Simplified the macro check. + + + * ace/Service_Config.h: + * ACEXML/apps/svcconf/Svcconf.cpp: Fixed Linux compilation warnings. + + * ACEXML/apps/svcconf/Svcconf_Handler.cpp: + * ace/Service_Config.cpp: Added more comprehensive error messages. + + * ACEXML/Makefile: + * ACEXML/Makefile.bor: + * ACEXML/apps/Makefile: + * ACEXML/apps/Makefile.bor: + * ACEXML/apps/svcconf/Makefile: + * ACEXML/apps/svcconf/Makefile.bor: + * ACEXML/parser/parser/Makefile: + * ace/Makefile: + * ace/Makefile.am: + * ace/Makefile.bor: + * ace/ace.icc: + * examples/ASX/CCM_App/Makefile: + * examples/ASX/CCM_App/Makefile.CCM_App: Added or Updated Makefiles. + + + * bin/svcconf-convert.pl: Added more debugging info printout. + Fixed incorrect mapping on initializer path/path and + state/params. + + * ace/Service_Object.h: Added enum definition to differentiate + ACE_Service_Type_Impl. The enum values are taken from + "ace/Svc_Conf_Toekns.h" so that the same service can work with + both classic and XML service configurator frameworks. + + + * ace/Service_Config.h: + * ace/Service_Config.cpp: Added <create_service_type> and + <create_service_type_impl> methods to ensure objects are + allocated in consistent DLL. + + * ACEXML/parser/parser/Parser.cpp: Made the exception messages + more comprehensive so it's easier to determine the origins of + parse errors. + + * ACEXML/apps/svcconf/Svcconf_Handler.h: + * ACEXML/apps/svcconf/Svcconf_Handler.i: + * ACEXML/apps/svcconf/Svcconf_Handler.cpp: Added more implementation. + + * examples/ASX/CCM_App/svc.conf.xml: + * netsvcs/servers/svc.conf.xml: + * tests/Service_Config_Test.conf.xml: Added new XML-based svc.conf files. + + * tests/Service_Config_DLL.cpp: Added xml-based inline svc.conf directives. + + + * ACEXML/apps/XML_Apps.dsw: Added new workspace for XML + applications. This should contains all projects under this + subdirectory. + + * ACEXML/apps/svcconf/README: + * ACEXML/apps/svcconf/Svcconf.cpp: + * ACEXML/apps/svcconf/Svcconf.h: + * ACEXML/apps/svcconf/Svcconf_Handler.cpp: + * ACEXML/apps/svcconf/Svcconf_Handler.h: + * ACEXML/apps/svcconf/Svcconf_Handler.i: + * ACEXML/apps/svcconf/XML_Svc_Conf_Parser.dsp: Added new files + that implement the parser for XML-based Service Configurator. + + * bin/svcconf-convert.pl: Updated the help message. + + * ace/config-all.h: Added ACE_DEFAULT_SVC_CONF_EXT to define the + default file extention name for svc.conf files. It is ".conf" + when using classic Service Configurator and ".conf.xml" when + using XML Service Configurator. + + * tests/Service_Config_Test.cpp: Changed to use different file + extension with different Service Configurator. + + * tests/Service_Config_Test.conf.xml: Added the converted XML + based svc.conf file. + + * ace/ace_dll.dsp: + * ace/ace_lib.dsp: + * ace/XML_Svc_Conf.h: + * ace/XML_Svc_Conf.cpp: Added abstract interface definition for + DLL based XML parser. + + * ace/OS.h: Defined ACE_DEFAULT_SVC_CONF_FILE to "svc.conf.xml" if + ACE_USES_CLASSIC_SVC_CONF is not defined. + + * ace/Service_Config.cpp: Adapt Service_Config to use XML parser + to process an svc.conf.xml file. + + + * bin/generate_export_file.pl: Added code to record the flags used + to generate an export file. + + + * XML/examples/svcconf/Svcconf_Handler.h: + * XML/examples/svcconf/Svcconf_Handler.i: + * XML/examples/svcconf/Svcconf_Handler.cpp: Added Svcconf handling + simulation. + + * XML/examples/test_docs/svcconf.dtd: Revised Svcconf DTD. + + + * XML/examples/test_docs/svcconf.dtd: Updated the DTD again. + The <streamdef> tag also needed an "id" attribute. + + * XML/examples/SAXPrint/main.cpp: + * XML/examples/SAXPrint/svc.conf.xml: Modified the sample XML to + conform to the updated svcconf.dtd. + + * XML/examples/svcconf/README: + * XML/examples/svcconf/Svcconf.dsp: + * XML/examples/svcconf/Svcconf.dsw: + * XML/examples/svcconf/Svcconf_Handler.cpp: + * XML/examples/svcconf/Svcconf_Handler.h: + * XML/examples/svcconf/Svcconf_Handler.i: + * XML/examples/svcconf/main.cpp: New example to test out + svc.conf.xml parsing. Not finished. + + + * XML/examples/test_docs/svcconf.dtd: Simplied the svc.conf.dtd by + removing the <params> tags and making it an attribute for + <initializer> and <static> tags. + + + * ace/Parse_Node.cpp: + * ace/Parse_Node.h: + * ace/Service_Config.cpp: + * ace/Service_Config.h: + * ace/Svc_Conf.h: + * ace/Svc_Conf.y: + * ace/Svc_Conf_Lexer_Guard.cpp: + * ace/Svc_Conf_l.cpp: + * ace/Svc_Conf_y.cpp: Decoupled old Service_Config parser from ACE. + + + * XML/examples/SAXPrint/main.cpp: Added a new test to try the new + StrCharStream and switch to use ACE_Get_Opt to support more + robust command line arguments. + + * XML/common/StrCharStream.h: + * XML/common/StrCharStream.cpp: Added new CharStream class that + take a null-terminated ACEXML_Char string as an input source. + + * XML/common/FileCharStream.h: Removed unnecessary inclusion of + "ace/streams.h". + + * XML/common/Makefile: + * XML/common/Makefile.bor: + * XML/common/XML_Common.dsp: Added StrCharStream.*. + Wed May 8 16:29:05 2002 Krishnakumar B <kitty@cs.wustl.edu> * bin/nightlybuilds/builds.lst (STATUS): diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index c99a6d31c50..73238225565 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,181 @@ +Wed May 8 15:15:41 2002 Nanbor Wang <nanbor@cs.wustl.edu> + + Merged in the XML-based Service Configurator framework. The + XML-based Service Configruator is *not* enabled by default and + the merge should not affect existing applications. We will make + the XML-based Service Configurator the defualt one at some point + in the future. So you might want to try it out before that + time. :) To switch current ACE to use XML Service Configurtor, + Add + + #define ACE_HAS_XML_SVC_CONF + + in your <config.h>. You can use the + $(ACE_ROOT)/bin/svcconf_convert.pl to convert your existing + svc.conf files to svc.conf.xml. + + * ace/OS.h: + * ace/Parse_Node.cpp: + * ace/Parse_Node.h: + * ace/Service_Config.cpp: + * ace/Service_Config.h: + * ace/Svc_Conf.h: + * ace/Svc_Conf_Lexer_Guard.cpp: + * ace/Svc_Conf_l.cpp: + * ace/Svc_Conf_y.cpp: + * tests/Service_Config_DLL.cpp: Simplified the macro check. + + + * ace/Service_Config.h: + * ACEXML/apps/svcconf/Svcconf.cpp: Fixed Linux compilation warnings. + + * ACEXML/apps/svcconf/Svcconf_Handler.cpp: + * ace/Service_Config.cpp: Added more comprehensive error messages. + + * ACEXML/Makefile: + * ACEXML/Makefile.bor: + * ACEXML/apps/Makefile: + * ACEXML/apps/Makefile.bor: + * ACEXML/apps/svcconf/Makefile: + * ACEXML/apps/svcconf/Makefile.bor: + * ACEXML/parser/parser/Makefile: + * ace/Makefile: + * ace/Makefile.am: + * ace/Makefile.bor: + * ace/ace.icc: + * examples/ASX/CCM_App/Makefile: + * examples/ASX/CCM_App/Makefile.CCM_App: Added or Updated Makefiles. + + + * bin/svcconf-convert.pl: Added more debugging info printout. + Fixed incorrect mapping on initializer path/path and + state/params. + + * ace/Service_Object.h: Added enum definition to differentiate + ACE_Service_Type_Impl. The enum values are taken from + "ace/Svc_Conf_Toekns.h" so that the same service can work with + both classic and XML service configurator frameworks. + + + * ace/Service_Config.h: + * ace/Service_Config.cpp: Added <create_service_type> and + <create_service_type_impl> methods to ensure objects are + allocated in consistent DLL. + + * ACEXML/parser/parser/Parser.cpp: Made the exception messages + more comprehensive so it's easier to determine the origins of + parse errors. + + * ACEXML/apps/svcconf/Svcconf_Handler.h: + * ACEXML/apps/svcconf/Svcconf_Handler.i: + * ACEXML/apps/svcconf/Svcconf_Handler.cpp: Added more implementation. + + * examples/ASX/CCM_App/svc.conf.xml: + * netsvcs/servers/svc.conf.xml: + * tests/Service_Config_Test.conf.xml: Added new XML-based svc.conf files. + + * tests/Service_Config_DLL.cpp: Added xml-based inline svc.conf directives. + + + * ACEXML/apps/XML_Apps.dsw: Added new workspace for XML + applications. This should contains all projects under this + subdirectory. + + * ACEXML/apps/svcconf/README: + * ACEXML/apps/svcconf/Svcconf.cpp: + * ACEXML/apps/svcconf/Svcconf.h: + * ACEXML/apps/svcconf/Svcconf_Handler.cpp: + * ACEXML/apps/svcconf/Svcconf_Handler.h: + * ACEXML/apps/svcconf/Svcconf_Handler.i: + * ACEXML/apps/svcconf/XML_Svc_Conf_Parser.dsp: Added new files + that implement the parser for XML-based Service Configurator. + + * bin/svcconf-convert.pl: Updated the help message. + + * ace/config-all.h: Added ACE_DEFAULT_SVC_CONF_EXT to define the + default file extention name for svc.conf files. It is ".conf" + when using classic Service Configurator and ".conf.xml" when + using XML Service Configurator. + + * tests/Service_Config_Test.cpp: Changed to use different file + extension with different Service Configurator. + + * tests/Service_Config_Test.conf.xml: Added the converted XML + based svc.conf file. + + * ace/ace_dll.dsp: + * ace/ace_lib.dsp: + * ace/XML_Svc_Conf.h: + * ace/XML_Svc_Conf.cpp: Added abstract interface definition for + DLL based XML parser. + + * ace/OS.h: Defined ACE_DEFAULT_SVC_CONF_FILE to "svc.conf.xml" if + ACE_USES_CLASSIC_SVC_CONF is not defined. + + * ace/Service_Config.cpp: Adapt Service_Config to use XML parser + to process an svc.conf.xml file. + + + * bin/generate_export_file.pl: Added code to record the flags used + to generate an export file. + + + * XML/examples/svcconf/Svcconf_Handler.h: + * XML/examples/svcconf/Svcconf_Handler.i: + * XML/examples/svcconf/Svcconf_Handler.cpp: Added Svcconf handling + simulation. + + * XML/examples/test_docs/svcconf.dtd: Revised Svcconf DTD. + + + * XML/examples/test_docs/svcconf.dtd: Updated the DTD again. + The <streamdef> tag also needed an "id" attribute. + + * XML/examples/SAXPrint/main.cpp: + * XML/examples/SAXPrint/svc.conf.xml: Modified the sample XML to + conform to the updated svcconf.dtd. + + * XML/examples/svcconf/README: + * XML/examples/svcconf/Svcconf.dsp: + * XML/examples/svcconf/Svcconf.dsw: + * XML/examples/svcconf/Svcconf_Handler.cpp: + * XML/examples/svcconf/Svcconf_Handler.h: + * XML/examples/svcconf/Svcconf_Handler.i: + * XML/examples/svcconf/main.cpp: New example to test out + svc.conf.xml parsing. Not finished. + + + * XML/examples/test_docs/svcconf.dtd: Simplied the svc.conf.dtd by + removing the <params> tags and making it an attribute for + <initializer> and <static> tags. + + + * ace/Parse_Node.cpp: + * ace/Parse_Node.h: + * ace/Service_Config.cpp: + * ace/Service_Config.h: + * ace/Svc_Conf.h: + * ace/Svc_Conf.y: + * ace/Svc_Conf_Lexer_Guard.cpp: + * ace/Svc_Conf_l.cpp: + * ace/Svc_Conf_y.cpp: Decoupled old Service_Config parser from ACE. + + + * XML/examples/SAXPrint/main.cpp: Added a new test to try the new + StrCharStream and switch to use ACE_Get_Opt to support more + robust command line arguments. + + * XML/common/StrCharStream.h: + * XML/common/StrCharStream.cpp: Added new CharStream class that + take a null-terminated ACEXML_Char string as an input source. + + * XML/common/FileCharStream.h: Removed unnecessary inclusion of + "ace/streams.h". + + * XML/common/Makefile: + * XML/common/Makefile.bor: + * XML/common/XML_Common.dsp: Added StrCharStream.*. + Wed May 8 16:29:05 2002 Krishnakumar B <kitty@cs.wustl.edu> * bin/nightlybuilds/builds.lst (STATUS): diff --git a/ace/Makefile b/ace/Makefile index 1c9b3328166..8ba22fc9453 100644 --- a/ace/Makefile +++ b/ace/Makefile @@ -194,6 +194,7 @@ SVCCONF_FILES = \ Service_Types \ Service_Templates \ Shared_Object \ + XML_Svc_Conf \ Svc_Conf_l \ Svc_Conf_y \ Svc_Conf_Lexer_Guard diff --git a/ace/Makefile.am b/ace/Makefile.am index 5fe2ea3a23b..644c0df082b 100644 --- a/ace/Makefile.am +++ b/ace/Makefile.am @@ -324,6 +324,7 @@ libACE_Svcconf_la_SOURCES = \ Service_Types.cpp \ Service_Templates.cpp \ Shared_Object.cpp \ + XML_Svc_Conf.cpp \ Svc_Conf_l.cpp \ Svc_Conf_y.cpp \ Svc_Conf_Lexer_Guard.cpp @@ -807,6 +808,7 @@ HEADER_FILES = \ WFMO_Reactor.h \ WIN32_Asynch_IO.h \ WIN32_Proactor.h \ + XML_Svc_Conf.h \ XTI_ATM_Mcast.h \ XtReactor.h \ ace_wchar.h \ diff --git a/ace/Makefile.bor b/ace/Makefile.bor index 170de5f5ecd..fe1c8073fb6 100644 --- a/ace/Makefile.bor +++ b/ace/Makefile.bor @@ -237,6 +237,7 @@ OBJFILES = \ $(OBJDIR)\WFMO_Reactor.obj \ $(OBJDIR)\WIN32_Asynch_IO.obj \ $(OBJDIR)\WIN32_Proactor.obj \ + $(OBJDIR)\XML_Svc_Conf.obj \ $(OBJDIR)\XtReactor.obj RESOURCE = $(OBJDIR)\ace.res @@ -391,7 +391,11 @@ typedef struct // Used for dynamic linking. # if !defined (ACE_DEFAULT_SVC_CONF) -# define ACE_DEFAULT_SVC_CONF "./svc.conf" +# if (ACE_USES_CLASSIC_SVC_CONF == 1) +# define ACE_DEFAULT_SVC_CONF "./svc.conf" +# else +# define ACE_DEFAULT_SVC_CONF "./svc.conf.xml" +# endif /* ACE_USES_CLASSIC_SVC_CONF ==1 */ # endif /* ACE_DEFAULT_SVC_CONF */ # if !defined (ACE_DEFAULT_SEM_KEY) @@ -2720,7 +2724,11 @@ typedef void (*ACE_SignalHandlerV)(...); // Used for dynamic linking # if !defined (ACE_DEFAULT_SVC_CONF) -# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT (".\\svc.conf") +# if (ACE_USES_CLASSIC_SVC_CONF == 1) +# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT (".\\svc.conf") +# else +# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT (".\\svc.conf.xml") +# endif /* ACE_USES_CLASSIC_SVC_CONF ==1 */ # endif /* ACE_DEFAULT_SVC_CONF */ // The following are #defines and #includes that are specific to @@ -3063,7 +3071,11 @@ typedef ACE_UINT64 ACE_hrtime_t; // Used for dynamic linking. # if !defined (ACE_DEFAULT_SVC_CONF) -# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT ("./svc.conf") +# if (ACE_USES_CLASSIC_SVC_CONF == 1) +# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT ("./svc.conf") +# else +# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT ("./svc.conf.xml") +# endif /* ACE_USES_CLASSIC_SVC_CONF ==1 */ # endif /* ACE_DEFAULT_SVC_CONF */ // The following are #defines and #includes that are specific to UNIX. diff --git a/ace/Parse_Node.cpp b/ace/Parse_Node.cpp index 899398bae90..3cf9be2ef12 100644 --- a/ace/Parse_Node.cpp +++ b/ace/Parse_Node.cpp @@ -7,6 +7,7 @@ // Provide the class hierarchy that defines the parse tree of Service // Nodes. +#if (ACE_USES_CLASSIC_SVC_CONF == 1) #if !defined (__ACE_INLINE__) #include "ace/Parse_Node.i" @@ -650,3 +651,4 @@ ACE_Static_Function_Node::~ACE_Static_Function_Node (void) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ diff --git a/ace/Parse_Node.h b/ace/Parse_Node.h index d9ccba2aba8..967b1813239 100644 --- a/ace/Parse_Node.h +++ b/ace/Parse_Node.h @@ -22,6 +22,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#if (ACE_USES_CLASSIC_SVC_CONF == 1) /** * @class ACE_Parse_Node * @@ -338,6 +339,7 @@ extern int ace_yyerrno; /// Global variable used to communicate between the parser and the main /// program. extern ACE_Service_Config *ace_this_svc; +#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ #include "ace/post.h" #endif /* ACE_PARSE_NODE_H */ diff --git a/ace/README b/ace/README index 9f0bed0d2ed..cc7f79ef028 100644 --- a/ace/README +++ b/ace/README @@ -975,6 +975,24 @@ ACE_HAS_BROKEN_PREALLOCATED_OBJECTS_AFTER_FORK this problem. ---------------------------------------- +The following macros determine the svc.conf file format ACE uses. + +Macro Description +----- ----------- +ACE_HAS_CLASSIC_SVC_CONF This macro forces ACE to use the classic + svc.conf format. + +ACE_HAS_XML_SVC_CONF This macro forces ACE to use the XML + svc.conf format. + +ACE_USES_CLASSIC_SVC_CONF This macro should be defined as 0 or 1, depending + on the preferred svc.conf file format. + Defining this macro to 0 means ACE will use XML + svc.conf file format. Defining it to 1 will + force ACE to use the classic svc.conf format. + ** This macro takes precedence over previous + ** two macros. +---------------------------------------- The following is a partial list of where some of these macros are used in the code. This list was originally compiled by Jam Hamidi (jh1@core01.osi.com). It is now hopelessly out of date. Hopefully, diff --git a/ace/Service_Config.cpp b/ace/Service_Config.cpp index 9274fe72b5a..72e982f5ebe 100644 --- a/ace/Service_Config.cpp +++ b/ace/Service_Config.cpp @@ -14,6 +14,8 @@ #include "ace/Framework_Component.h" #include "ace/Service_Config.h" +#include "ace/XML_Svc_Conf.h" +#include "ace/Auto_Ptr.h" #if !defined (__ACE_INLINE__) #include "ace/Service_Config.i" @@ -225,11 +227,66 @@ ACE_Service_Config::parse_args (int argc, ACE_TCHAR *argv[]) return 0; } +#if (ACE_USES_CLASSIC_SVC_CONF == 0) +ACE_Service_Type * +ACE_Service_Config::create_service_type (const ACE_TCHAR *n, + ACE_Service_Type_Impl *o, + const ACE_SHLIB_HANDLE handle, + int active) +{ + ACE_Service_Type *sp = 0; + ACE_NEW_RETURN (sp, + ACE_Service_Type (n, o, handle, active), + 0); + return sp; +} + +ACE_Service_Type_Impl * +ACE_Service_Config::create_service_type_impl (const ACE_TCHAR *name, + int type, + void *symbol, + u_int flags, + ACE_Service_Object_Exterminator gobbler) +{ + ACE_Service_Type_Impl *stp = 0; + + // Note, the only place we need to put a case statement. This is + // also the place where we'd put the RTTI tests, if the compiler + // actually supported them! + + switch (type) + { + case ACE_Service_Type::SERVICE_OBJECT: + ACE_NEW_RETURN (stp, + ACE_Service_Object_Type ((ACE_Service_Object *) symbol, + name, flags, + gobbler), + 0); + break; + case ACE_Service_Type::MODULE: + ACE_NEW_RETURN (stp, + ACE_Module_Type (symbol, name, flags), + 0); + break; + case ACE_Service_Type::STREAM: + ACE_NEW_RETURN (stp, + ACE_Stream_Type (symbol, name, flags), + 0); + break; + default: + ACE_ERROR ((LM_ERROR, + ACE_LIB_TEXT ("unknown case\n"))); + break; + } + return stp; + +} +#endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */ // Initialize and activate a statically linked service. int -ACE_Service_Config::initialize (const ACE_TCHAR svc_name[], - ACE_TCHAR *parameters) +ACE_Service_Config::initialize (const ACE_TCHAR *svc_name, + const ACE_TCHAR *parameters) { ACE_TRACE ("ACE_Service_Config::initialize"); ACE_ARGV args (parameters); @@ -269,7 +326,7 @@ ACE_Service_Config::initialize (const ACE_TCHAR svc_name[], int ACE_Service_Config::initialize (const ACE_Service_Type *sr, - ACE_TCHAR parameters[]) + const ACE_TCHAR *parameters) { ACE_TRACE ("ACE_Service_Config::initialize"); ACE_ARGV args (parameters); @@ -298,6 +355,7 @@ ACE_Service_Config::initialize (const ACE_Service_Type *sr, } } +#if (ACE_USES_CLASSIC_SVC_CONF == 1) int ACE_Service_Config::process_directives_i (ACE_Svc_Conf_Param *param) { @@ -322,12 +380,42 @@ ACE_Service_Config::process_directives_i (ACE_Svc_Conf_Param *param) 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; + + // @@ Now this sucks.. Why can't we just pass the operation name to dll.symbol? + ACE_TCHAR *cdecl_str = ACE::ldname (ACE_TEXT ("_ACEXML_create_XML_Svc_Conf_Object")); + foo = xmldll.symbol (cdecl_str); + delete[] cdecl_str; + + // Cast the void* to long first. + long tmp = ACE_reinterpret_cast (long, foo); + ACE_XML_Svc_Conf::Factory factory = ACE_reinterpret_cast (ACE_XML_Svc_Conf::Factory, tmp); + if (factory == 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_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, @@ -354,8 +442,17 @@ ACE_Service_Config::process_file (const ACE_TCHAR file[]) (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 @@ -368,6 +465,7 @@ ACE_Service_Config::process_directive (const ACE_TCHAR directive[]) 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); @@ -375,6 +473,16 @@ ACE_Service_Config::process_directive (const ACE_TCHAR 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 diff --git a/ace/Service_Config.h b/ace/Service_Config.h index 2942816d6dd..2b8da8c37b9 100644 --- a/ace/Service_Config.h +++ b/ace/Service_Config.h @@ -13,25 +13,28 @@ #ifndef ACE_SERVICE_CONFIG_H #define ACE_SERVICE_CONFIG_H #include "ace/pre.h" - -#include "ace/Service_Object.h" +#include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/Service_Types.h" #include "ace/Signal.h" #include "ace/Unbounded_Queue.h" #include "ace/Unbounded_Set.h" #include "ace/SString.h" +#include "ace/DLL.h" +#include "ace/XML_Svc_Conf.h" // Forward decl. class ACE_Service_Repository; -class ACE_Service_Type; class ACE_Allocator; class ACE_Reactor; class ACE_Thread_Manager; +#if (ACE_USES_CLASSIC_SVC_CONF == 1) class ACE_Svc_Conf_Param; +#endif /* ACE_USES_CLASSIC_SVC_CONF ==1 */ extern "C" { @@ -256,11 +259,11 @@ public: /// Dynamically link the shared object file and retrieve a pointer to /// the designated shared object in this file. static int initialize (const ACE_Service_Type *, - ACE_TCHAR parameters[]); + const ACE_TCHAR *parameters); /// Initialize and activate a statically <svc_name> service. - static int initialize (const ACE_TCHAR svc_name[], - ACE_TCHAR parameters[]); + static int initialize (const ACE_TCHAR *svc_name, + const ACE_TCHAR *parameters); /// Resume a <svc_name> that was previously suspended or has not yet /// been resumed (e.g., a static service). @@ -350,15 +353,32 @@ public: * for a list of files and here a list of services. */ static int parse_args (int, ACE_TCHAR *argv[]); +#if (ACE_USES_CLASSIC_SVC_CONF == 0) + static ACE_Service_Type *create_service_type (const ACE_TCHAR *n, + ACE_Service_Type_Impl *o, + const ACE_SHLIB_HANDLE handle, + int active); + + 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); +#endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */ 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); +#if (ACE_USES_CLASSIC_SVC_CONF == 1) /// This is the implementation function that process_directives() /// and process_directive() both call. Returns the number of errors /// that occurred. static int process_directives_i (ACE_Svc_Conf_Param *param); +#else + /// 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 */ /// Become a daemon. static int start_daemon (void); diff --git a/ace/Service_Object.h b/ace/Service_Object.h index 2801a8be3c4..c5155c0c5c0 100644 --- a/ace/Service_Object.h +++ b/ace/Service_Object.h @@ -15,6 +15,7 @@ #include "ace/pre.h" #include "ace/Shared_Object.h" +#include "ace/Svc_Conf_Tokens.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -74,6 +75,14 @@ public: DELETE_THIS = 2 }; + enum + { + SERVICE_OBJECT = ACE_SVC_OBJ_T, + MODULE = ACE_MODULE_T, + STREAM = ACE_STREAM_T, + INVALID_TYPE = -1 + }; + // = Initialization and termination methods. ACE_Service_Type (const ACE_TCHAR *n, ACE_Service_Type_Impl *o, diff --git a/ace/Svc_Conf.h b/ace/Svc_Conf.h index ecf285baebf..291fe3defca 100644 --- a/ace/Svc_Conf.h +++ b/ace/Svc_Conf.h @@ -28,6 +28,8 @@ #include "ace/Service_Config.h" #include "ace/Parse_Node.h" +#if (ACE_USES_CLASSIC_SVC_CONF == 1) + // Forward declarations. struct ace_yy_buffer_state; @@ -194,6 +196,8 @@ extern ACE_TCHAR *ace_yytext; /// Holds the length of the lexeme for the current token extern int ace_yyleng; +#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ + /// Factory that creates a new ACE_Service_Type_Impl. extern ACE_Service_Type_Impl * ace_create_service_type (const ACE_TCHAR *, diff --git a/ace/Svc_Conf.y b/ace/Svc_Conf.y index 326c9d9b442..dfb44e6fc7e 100644 --- a/ace/Svc_Conf.y +++ b/ace/Svc_Conf.y @@ -244,6 +244,9 @@ svc_location sym, flags, gobbler); + if (stp == 0) + ace_yyerrno++; + $$ = new ACE_Service_Type ($1, stp, $3->handle (), @@ -435,7 +438,6 @@ ace_create_service_type (const ACE_TCHAR *name, default: ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("unknown case\n"))); - yyerrno++; break; } return stp; diff --git a/ace/Svc_Conf_Lexer_Guard.cpp b/ace/Svc_Conf_Lexer_Guard.cpp index 13848feaac9..980d899d064 100644 --- a/ace/Svc_Conf_Lexer_Guard.cpp +++ b/ace/Svc_Conf_Lexer_Guard.cpp @@ -2,6 +2,7 @@ #include "ace/Svc_Conf.h" +#if (ACE_USES_CLASSIC_SVC_CONF == 1) #include "ace/Svc_Conf_Lexer_Guard.h" ACE_RCSID (ace, @@ -34,3 +35,4 @@ ACE_Svc_Conf_Lexer_Guard::~ACE_Svc_Conf_Lexer_Guard (void) ::ace_yy_pop_buffer (this->buffer_); } +#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ diff --git a/ace/Svc_Conf_l.cpp b/ace/Svc_Conf_l.cpp index ec92eb3473f..b315c3f0d91 100644 --- a/ace/Svc_Conf_l.cpp +++ b/ace/Svc_Conf_l.cpp @@ -28,15 +28,17 @@ /* The "const" storage-class-modifier is valid. */ #define ACE_YY_USE_CONST -#else /* ! __cplusplus */ +#else /* ! __cplusplus */ #if __STDC__ #define ACE_YY_USE_PROTOS #define ACE_YY_USE_CONST -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#if (ACE_USES_CLASSIC_SVC_CONF == 1) #ifdef __TURBOC__ #pragma warn -rch @@ -107,10 +109,10 @@ extern FILE *ace_yyin, *ace_yyout; * int a single C statement (which needs a semi-colon terminator). This * avoids problems with code like: * - * if ( condition_holds ) - * ace_yyless( 5 ); - * else - * do_something_else(); + * if ( condition_holds ) + * ace_yyless( 5 ); + * else + * do_something_else(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all @@ -120,15 +122,15 @@ extern FILE *ace_yyin, *ace_yyout; /* Return all but the first 'n' matched characters back to the input stream. */ #define ace_yyless(n) \ - do \ - { \ - /* Undo effects of setting up ace_yytext. */ \ - *ace_yy_cp = ace_yy_hold_char; \ - ACE_YY_RESTORE_ACE_YY_MORE_OFFSET \ - ace_yy_c_buf_p = ace_yy_cp = ace_yy_bp + n - ACE_YY_MORE_ADJ; \ - ACE_YY_DO_BEFORE_ACTION; /* set up ace_yytext again */ \ - } \ - while ( 0 ) + do \ + { \ + /* Undo effects of setting up ace_yytext. */ \ + *ace_yy_cp = ace_yy_hold_char; \ + ACE_YY_RESTORE_ACE_YY_MORE_OFFSET \ + ace_yy_c_buf_p = ace_yy_cp = ace_yy_bp + n - ACE_YY_MORE_ADJ; \ + ACE_YY_DO_BEFORE_ACTION; /* set up ace_yytext again */ \ + } \ + while ( 0 ) #if 0 #define unput(c) ace_yyunput( c, ace_yytext_ptr ) @@ -142,61 +144,61 @@ typedef unsigned int ace_yy_size_t; struct ace_yy_buffer_state - { - FILE *ace_yy_input_file; - - ACE_TCHAR *ace_yy_ch_buf; /* input buffer */ - ACE_TCHAR *ace_yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - ace_yy_size_t ace_yy_buf_size; - - /* Number of characters read into ace_yy_ch_buf, not including EOB - * characters. - */ - int ace_yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int ace_yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int ace_yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int ace_yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int ace_yy_fill_buffer; - - int ace_yy_buffer_status; + { + FILE *ace_yy_input_file; + + ACE_TCHAR *ace_yy_ch_buf; /* input buffer */ + ACE_TCHAR *ace_yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + ace_yy_size_t ace_yy_buf_size; + + /* Number of characters read into ace_yy_ch_buf, not including EOB + * characters. + */ + int ace_yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int ace_yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int ace_yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int ace_yy_at_bol; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int ace_yy_fill_buffer; + + int ace_yy_buffer_status; #define ACE_YY_BUFFER_NEW 0 #define ACE_YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as ACE_YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via ace_yyrestart()), so that the user can continue scanning by - * just pointing ace_yyin at a new input file. - */ + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as ACE_YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via ace_yyrestart()), so that the user can continue scanning by + * just pointing ace_yyin at a new input file. + */ #define ACE_YY_BUFFER_EOF_PENDING 2 - }; + }; static ACE_YY_BUFFER_STATE ace_yy_current_buffer = 0; @@ -210,15 +212,15 @@ static ACE_YY_BUFFER_STATE ace_yy_current_buffer = 0; /* ace_yy_hold_char holds the character lost when ace_yytext is formed. */ static ACE_TCHAR ace_yy_hold_char; -static int ace_yy_n_chars; /* number of characters read into ace_yy_ch_buf */ +static int ace_yy_n_chars; /* number of characters read into ace_yy_ch_buf */ int ace_yyleng; /* Points to current character in buffer. */ static ACE_TCHAR *ace_yy_c_buf_p = (ACE_TCHAR *) 0; -static int ace_yy_init = 1; /* whether we need to initialize */ -static int ace_yy_start = 0; /* start state number */ +static int ace_yy_init = 1; /* whether we need to initialize */ +static int ace_yy_start = 0; /* start state number */ /* Flag which is used to allow ace_yywrap()'s to do buffer switches * instead of setting up a fresh ace_yyin. A bit of a hack ... @@ -246,18 +248,18 @@ static void ace_yy_flex_free ACE_YY_PROTO(( void * )); #define ace_yy_new_buffer ace_yy_create_buffer #define ace_yy_set_interactive(is_interactive) \ - { \ - if ( ! ace_yy_current_buffer ) \ - ace_yy_current_buffer = ace_yy_create_buffer( ace_yyin, ACE_YY_BUF_SIZE ); \ - ace_yy_current_buffer->ace_yy_is_interactive = is_interactive; \ - } + { \ + if ( ! ace_yy_current_buffer ) \ + ace_yy_current_buffer = ace_yy_create_buffer( ace_yyin, ACE_YY_BUF_SIZE ); \ + ace_yy_current_buffer->ace_yy_is_interactive = is_interactive; \ + } #define ace_yy_set_bol(at_bol) \ - { \ - if ( ! ace_yy_current_buffer ) \ - ace_yy_current_buffer = ace_yy_create_buffer( ace_yyin, ACE_YY_BUF_SIZE ); \ - ace_yy_current_buffer->ace_yy_at_bol = at_bol; \ - } + { \ + if ( ! ace_yy_current_buffer ) \ + ace_yy_current_buffer = ace_yy_create_buffer( ace_yyin, ACE_YY_BUF_SIZE ); \ + ace_yy_current_buffer->ace_yy_at_bol = at_bol; \ + } #define ACE_YY_AT_BOL() (ace_yy_current_buffer->ace_yy_at_bol) @@ -276,11 +278,11 @@ static void ace_yy_fatal_error ACE_YY_PROTO(( ace_yyconst ACE_TCHAR msg[] )); * corresponding action - sets up ace_yytext. */ #define ACE_YY_DO_BEFORE_ACTION \ - ace_yytext_ptr = ace_yy_bp; \ - ace_yyleng = (int) (ace_yy_cp - ace_yy_bp); \ - ace_yy_hold_char = *ace_yy_cp; \ - *ace_yy_cp = '\0'; \ - ace_yy_c_buf_p = ace_yy_cp; + ace_yytext_ptr = ace_yy_bp; \ + ace_yyleng = (int) (ace_yy_cp - ace_yy_bp); \ + ace_yy_hold_char = *ace_yy_cp; \ + *ace_yy_cp = '\0'; \ + ace_yy_c_buf_p = ace_yy_cp; #define ACE_YY_NUM_RULES 26 #define ACE_YY_END_OF_BUFFER 27 @@ -511,8 +513,8 @@ ACE_TCHAR *ace_yytext; #include "ace/Svc_Conf_Lexer_Guard.h" ACE_RCSID (ace, - Svc_Conf_l, - "$Id$") + Svc_Conf_l, + "$Id$") // Keeps track of the current line for debugging output. int ace_yylineno = 1; @@ -609,21 +611,21 @@ ACE_YY_MALLOC_DECL */ #ifndef ACE_YY_INPUT #define ACE_YY_INPUT(buf,result,max_size) \ - if ( ace_yy_current_buffer->ace_yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( ace_yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (ACE_TCHAR) c; \ - if ( c == '\n' ) \ - buf[n++] = (ACE_TCHAR) c; \ - if ( c == EOF && ferror( ace_yyin ) ) \ - ACE_YY_FATAL_ERROR(ACE_LIB_TEXT( "input in flex scanner failed") ); \ - result = n; \ - } \ - else if ( ((result = fread( buf, sizeof (ACE_TCHAR), max_size, ace_yyin )) == 0) \ - && ferror( ace_yyin ) ) \ - ACE_YY_FATAL_ERROR(ACE_LIB_TEXT("input in flex scanner failed") ); + if ( ace_yy_current_buffer->ace_yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( ace_yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (ACE_TCHAR) c; \ + if ( c == '\n' ) \ + buf[n++] = (ACE_TCHAR) c; \ + if ( c == EOF && ferror( ace_yyin ) ) \ + ACE_YY_FATAL_ERROR(ACE_LIB_TEXT( "input in flex scanner failed") ); \ + result = n; \ + } \ + else if ( ((result = fread( buf, sizeof (ACE_TCHAR), max_size, ace_yyin )) == 0) \ + && ferror( ace_yyin ) ) \ + ACE_YY_FATAL_ERROR(ACE_LIB_TEXT("input in flex scanner failed") ); #endif /* No semi-colon after return; correct usage is to write "ace_yyterminate();" - @@ -664,13 +666,13 @@ ACE_YY_MALLOC_DECL #endif #define ACE_YY_RULE_SETUP \ - if ( ace_yyleng > 0 ) \ - ace_yy_current_buffer->ace_yy_at_bol = \ - (ace_yytext[ace_yyleng - 1] == '\n'); \ - ACE_YY_USER_ACTION + if ( ace_yyleng > 0 ) \ + ace_yy_current_buffer->ace_yy_at_bol = \ + (ace_yytext[ace_yyleng - 1] == '\n'); \ + ACE_YY_USER_ACTION ACE_YY_DECL - { + { ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, ace_mon, *ACE_Static_Object_Lock::instance (), @@ -678,94 +680,94 @@ ACE_YY_DECL ACE_Svc_Conf_Lexer_Guard ace_lexer_guard (ACE_SVC_CONF_PARAM); - register ace_yy_state_type ace_yy_current_state; - register ACE_TCHAR *ace_yy_cp=0, *ace_yy_bp=0; - register int ace_yy_act; + register ace_yy_state_type ace_yy_current_state; + register ACE_TCHAR *ace_yy_cp=0, *ace_yy_bp=0; + register int ace_yy_act; - if ( ace_yy_init ) - { - ace_yy_init = 0; + if ( ace_yy_init ) + { + ace_yy_init = 0; #ifdef ACE_YY_USER_INIT - ACE_YY_USER_INIT; + ACE_YY_USER_INIT; #endif - if ( ! ace_yy_start ) - ace_yy_start = 1; /* first start state */ + if ( ! ace_yy_start ) + ace_yy_start = 1; /* first start state */ - if ( ! ace_yyin ) - ace_yyin = stdin; + if ( ! ace_yyin ) + ace_yyin = stdin; - if ( ! ace_yyout ) - ace_yyout = stdout; + if ( ! ace_yyout ) + ace_yyout = stdout; - if ( ! ace_yy_current_buffer ) - ace_yy_current_buffer = - ace_yy_create_buffer( ace_yyin, ACE_YY_BUF_SIZE ); + if ( ! ace_yy_current_buffer ) + ace_yy_current_buffer = + ace_yy_create_buffer( ace_yyin, ACE_YY_BUF_SIZE ); - ace_yy_load_buffer_state(); - } + ace_yy_load_buffer_state(); + } - while ( 1 ) /* loops until end-of-file is reached */ - { - ace_yy_cp = ace_yy_c_buf_p; + while ( 1 ) /* loops until end-of-file is reached */ + { + ace_yy_cp = ace_yy_c_buf_p; - /* Support of ace_yytext. */ - *ace_yy_cp = ace_yy_hold_char; + /* Support of ace_yytext. */ + *ace_yy_cp = ace_yy_hold_char; - /* ace_yy_bp points to the position in ace_yy_ch_buf of the start of - * the current run. - */ - ace_yy_bp = ace_yy_cp; + /* ace_yy_bp points to the position in ace_yy_ch_buf of the start of + * the current run. + */ + ace_yy_bp = ace_yy_cp; - ace_yy_current_state = ace_yy_start; - ace_yy_current_state += ACE_YY_AT_BOL(); + ace_yy_current_state = ace_yy_start; + ace_yy_current_state += ACE_YY_AT_BOL(); ace_yy_match: - do - { - register ACE_YY_CHAR ace_yy_c = ace_yy_ec[ACE_YY_SC_TO_UI(*ace_yy_cp)]; - if ( ace_yy_accept[ace_yy_current_state] ) - { - ace_yy_last_accepting_state = ace_yy_current_state; - ace_yy_last_accepting_cpos = ace_yy_cp; - } - while ( ace_yy_chk[ace_yy_base[ace_yy_current_state] + ace_yy_c] != ace_yy_current_state ) - { - ace_yy_current_state = (int) ace_yy_def[ace_yy_current_state]; - if ( ace_yy_current_state >= 108 ) - ace_yy_c = ace_yy_meta[(unsigned int) ace_yy_c]; - } - ace_yy_current_state = ace_yy_nxt[ace_yy_base[ace_yy_current_state] + (unsigned int) ace_yy_c]; - ++ace_yy_cp; - } - while ( ace_yy_base[ace_yy_current_state] != 438 ); + do + { + register ACE_YY_CHAR ace_yy_c = ace_yy_ec[ACE_YY_SC_TO_UI(*ace_yy_cp)]; + if ( ace_yy_accept[ace_yy_current_state] ) + { + ace_yy_last_accepting_state = ace_yy_current_state; + ace_yy_last_accepting_cpos = ace_yy_cp; + } + while ( ace_yy_chk[ace_yy_base[ace_yy_current_state] + ace_yy_c] != ace_yy_current_state ) + { + ace_yy_current_state = (int) ace_yy_def[ace_yy_current_state]; + if ( ace_yy_current_state >= 108 ) + ace_yy_c = ace_yy_meta[(unsigned int) ace_yy_c]; + } + ace_yy_current_state = ace_yy_nxt[ace_yy_base[ace_yy_current_state] + (unsigned int) ace_yy_c]; + ++ace_yy_cp; + } + while ( ace_yy_base[ace_yy_current_state] != 438 ); ace_yy_find_action: - ace_yy_act = ace_yy_accept[ace_yy_current_state]; - if ( ace_yy_act == 0 ) - { /* have to back up */ - ace_yy_cp = ace_yy_last_accepting_cpos; - ace_yy_current_state = ace_yy_last_accepting_state; - ace_yy_act = ace_yy_accept[ace_yy_current_state]; - } + ace_yy_act = ace_yy_accept[ace_yy_current_state]; + if ( ace_yy_act == 0 ) + { /* have to back up */ + ace_yy_cp = ace_yy_last_accepting_cpos; + ace_yy_current_state = ace_yy_last_accepting_state; + ace_yy_act = ace_yy_accept[ace_yy_current_state]; + } - ACE_YY_DO_BEFORE_ACTION; + ACE_YY_DO_BEFORE_ACTION; -do_action: /* This label is used only to access EOF actions. */ +do_action: /* This label is used only to access EOF actions. */ - switch ( ace_yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of ACE_YY_DO_BEFORE_ACTION */ - *ace_yy_cp = ace_yy_hold_char; - ace_yy_cp = ace_yy_last_accepting_cpos; - ace_yy_current_state = ace_yy_last_accepting_state; - goto ace_yy_find_action; + switch ( ace_yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of ACE_YY_DO_BEFORE_ACTION */ + *ace_yy_cp = ace_yy_hold_char; + ace_yy_cp = ace_yy_last_accepting_cpos; + ace_yy_current_state = ace_yy_last_accepting_state; + goto ace_yy_find_action; case 1: *ace_yy_cp = ace_yy_hold_char; /* undo effects of setting up ace_yytext */ @@ -773,80 +775,80 @@ ace_yy_c_buf_p = ace_yy_cp -= 1; ACE_YY_DO_BEFORE_ACTION; /* set up ace_yytext again */ ACE_YY_RULE_SETUP ; /* EMPTY */ - ACE_YY_BREAK + ACE_YY_BREAK case 2: ACE_YY_RULE_SETUP { return token (ACE_DYNAMIC); } - // ACE_YY_BREAK + // ACE_YY_BREAK case 3: ACE_YY_RULE_SETUP { return token (ACE_STATIC); } - // ACE_YY_BREAK + // ACE_YY_BREAK case 4: ACE_YY_RULE_SETUP { return token (ACE_SUSPEND); } - // ACE_YY_BREAK + // ACE_YY_BREAK case 5: ACE_YY_RULE_SETUP { return token (ACE_RESUME); } - // ACE_YY_BREAK + // ACE_YY_BREAK case 6: ACE_YY_RULE_SETUP { return token (ACE_REMOVE); } - // ACE_YY_BREAK + // ACE_YY_BREAK case 7: ACE_YY_RULE_SETUP { return token (ACE_USTREAM); } - // ACE_YY_BREAK + // ACE_YY_BREAK case 8: ACE_YY_RULE_SETUP { return token (ACE_MODULE_T); } - // ACE_YY_BREAK + // ACE_YY_BREAK case 9: ACE_YY_RULE_SETUP { return token (ACE_SVC_OBJ_T); } - // ACE_YY_BREAK + // ACE_YY_BREAK case 10: ACE_YY_RULE_SETUP { return token (ACE_STREAM_T); } - // ACE_YY_BREAK + // ACE_YY_BREAK case 11: ACE_YY_RULE_SETUP { return token (ACE_ACTIVE); } - // ACE_YY_BREAK + // ACE_YY_BREAK case 12: ACE_YY_RULE_SETUP { return token (ACE_INACTIVE); } - // ACE_YY_BREAK + // ACE_YY_BREAK case 13: ACE_YY_RULE_SETUP { return token (':'); } - // ACE_YY_BREAK + // ACE_YY_BREAK case 14: ACE_YY_RULE_SETUP { return token ('*'); } - // ACE_YY_BREAK + // ACE_YY_BREAK case 15: ACE_YY_RULE_SETUP { return token ('('); } - // ACE_YY_BREAK + // ACE_YY_BREAK case 16: ACE_YY_RULE_SETUP { return token (')'); } - // ACE_YY_BREAK + // ACE_YY_BREAK case 17: ACE_YY_RULE_SETUP { return token ('{'); } - // ACE_YY_BREAK + // ACE_YY_BREAK case 18: ACE_YY_RULE_SETUP { return token ('}'); } - // ACE_YY_BREAK + // ACE_YY_BREAK case 19: ACE_YY_RULE_SETUP { // Check for first type of string, i.e., - // "double quotes" delimited. + // "double quotes" delimited. ACE_TCHAR *s = ACE_OS::strrchr (ace_yytext, '"'); if (s == 0) // Check for second type of string, i.e., @@ -857,360 +859,360 @@ ACE_YY_RULE_SETUP // Eliminate the opening and closing double or // single quotes. *s = '\0'; - ace_yyleng -= 1; + ace_yyleng -= 1; ace_yylval->ident_ = ACE_SVC_CONF_PARAM->obstack.copy (ace_yytext + 1, ace_yyleng); - return token (ACE_STRING); } -// ACE_YY_BREAK + return token (ACE_STRING); } +// ACE_YY_BREAK case 20: ACE_YY_RULE_SETUP { - ace_yylval->ident_ = ACE_SVC_CONF_PARAM->obstack.copy (ace_yytext, ace_yyleng); - return token (ACE_IDENT); - } -// ACE_YY_BREAK + ace_yylval->ident_ = ACE_SVC_CONF_PARAM->obstack.copy (ace_yytext, ace_yyleng); + return token (ACE_IDENT); + } +// ACE_YY_BREAK case 21: ACE_YY_RULE_SETUP { - ace_yylval->ident_ = ACE_SVC_CONF_PARAM->obstack.copy (ace_yytext, ace_yyleng); - return token (ACE_PATHNAME); - } -// ACE_YY_BREAK + ace_yylval->ident_ = ACE_SVC_CONF_PARAM->obstack.copy (ace_yytext, ace_yyleng); + return token (ACE_PATHNAME); + } +// ACE_YY_BREAK case 22: ACE_YY_RULE_SETUP ; /* EMPTY */ - ACE_YY_BREAK + ACE_YY_BREAK case 23: ACE_YY_RULE_SETUP ; /* EMPTY */ - ACE_YY_BREAK + ACE_YY_BREAK case 24: ACE_YY_RULE_SETUP { ACE_SVC_CONF_PARAM->yylineno++; ace_yylineno++; } - ACE_YY_BREAK + ACE_YY_BREAK case 25: ACE_YY_RULE_SETUP { ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("unknown character = (%d"), + ACE_LIB_TEXT ("unknown character = (%d"), *ace_yytext)); if (ACE_OS::ace_isprint (*ace_yytext)) ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("|%c"), *ace_yytext)); ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT (")\n"))); } - ACE_YY_BREAK + ACE_YY_BREAK case ACE_YY_STATE_EOF(INITIAL): case ACE_YY_STATE_EOF(PARAMETERS): case ACE_YY_STATE_EOF(NORMAL): { ace_yyterminate(); } -// ACE_YY_BREAK +// ACE_YY_BREAK case 26: ACE_YY_RULE_SETUP ACE_SVC_CONF_ECHO; - ACE_YY_BREAK - - case ACE_YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB ACE_TCHAR. */ - int ace_yy_amount_of_matched_text = (int) (ace_yy_cp - ace_yytext_ptr) - 1; - - /* Undo the effects of ACE_YY_DO_BEFORE_ACTION. */ - *ace_yy_cp = ace_yy_hold_char; - ACE_YY_RESTORE_ACE_YY_MORE_OFFSET - - if ( ace_yy_current_buffer->ace_yy_buffer_status == ACE_YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed ace_yyin at a new source and called - * ace_yylex(). If so, then we have to assure - * consistency between ace_yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - ace_yy_n_chars = ace_yy_current_buffer->ace_yy_n_chars; - ace_yy_current_buffer->ace_yy_input_file = ace_yyin; - ace_yy_current_buffer->ace_yy_buffer_status = ACE_YY_BUFFER_NORMAL; - } - - /* Note that here we test for ace_yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since ace_yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( ace_yy_c_buf_p <= &ace_yy_current_buffer->ace_yy_ch_buf[ace_yy_n_chars] ) - { /* This was really a NUL. */ - ace_yy_state_type ace_yy_next_state; - - ace_yy_c_buf_p = ace_yytext_ptr + ace_yy_amount_of_matched_text; - - ace_yy_current_state = ace_yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * ace_yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - ace_yy_next_state = ace_yy_try_NUL_trans( ace_yy_current_state ); - - ace_yy_bp = ace_yytext_ptr + ACE_YY_MORE_ADJ; - - if ( ace_yy_next_state ) - { - /* Consume the NUL. */ - ace_yy_cp = ++ace_yy_c_buf_p; - ace_yy_current_state = ace_yy_next_state; - goto ace_yy_match; - } - - else - { - ace_yy_cp = ace_yy_c_buf_p; - goto ace_yy_find_action; - } - } - - else switch ( ace_yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - ace_yy_did_buffer_switch_on_eof = 0; - - if ( ace_yywrap() ) - { - /* Note: because we've taken care in - * ace_yy_get_next_buffer() to have set up - * ace_yytext, we can now set up - * ace_yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * ACE_YY_NULL, it'll still work - another - * ACE_YY_NULL will get returned. - */ - ace_yy_c_buf_p = ace_yytext_ptr + ACE_YY_MORE_ADJ; - - ace_yy_act = ACE_YY_STATE_EOF(ACE_YY_START); - goto do_action; - } - - else - { - if ( ! ace_yy_did_buffer_switch_on_eof ) - ACE_YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - ace_yy_c_buf_p = - ace_yytext_ptr + ace_yy_amount_of_matched_text; - - ace_yy_current_state = ace_yy_get_previous_state(); - - ace_yy_cp = ace_yy_c_buf_p; - ace_yy_bp = ace_yytext_ptr + ACE_YY_MORE_ADJ; - goto ace_yy_match; - - case EOB_ACT_LAST_MATCH: - ace_yy_c_buf_p = - &ace_yy_current_buffer->ace_yy_ch_buf[ace_yy_n_chars]; - - ace_yy_current_state = ace_yy_get_previous_state(); - - ace_yy_cp = ace_yy_c_buf_p; - ace_yy_bp = ace_yytext_ptr + ACE_YY_MORE_ADJ; - goto ace_yy_find_action; - } - break; - } - - default: - ACE_YY_FATAL_ERROR( - ACE_LIB_TEXT("fatal flex scanner internal error--no action found") ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of ace_yylex */ + ACE_YY_BREAK + + case ACE_YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB ACE_TCHAR. */ + int ace_yy_amount_of_matched_text = (int) (ace_yy_cp - ace_yytext_ptr) - 1; + + /* Undo the effects of ACE_YY_DO_BEFORE_ACTION. */ + *ace_yy_cp = ace_yy_hold_char; + ACE_YY_RESTORE_ACE_YY_MORE_OFFSET + + if ( ace_yy_current_buffer->ace_yy_buffer_status == ACE_YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed ace_yyin at a new source and called + * ace_yylex(). If so, then we have to assure + * consistency between ace_yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + ace_yy_n_chars = ace_yy_current_buffer->ace_yy_n_chars; + ace_yy_current_buffer->ace_yy_input_file = ace_yyin; + ace_yy_current_buffer->ace_yy_buffer_status = ACE_YY_BUFFER_NORMAL; + } + + /* Note that here we test for ace_yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since ace_yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( ace_yy_c_buf_p <= &ace_yy_current_buffer->ace_yy_ch_buf[ace_yy_n_chars] ) + { /* This was really a NUL. */ + ace_yy_state_type ace_yy_next_state; + + ace_yy_c_buf_p = ace_yytext_ptr + ace_yy_amount_of_matched_text; + + ace_yy_current_state = ace_yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * ace_yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + ace_yy_next_state = ace_yy_try_NUL_trans( ace_yy_current_state ); + + ace_yy_bp = ace_yytext_ptr + ACE_YY_MORE_ADJ; + + if ( ace_yy_next_state ) + { + /* Consume the NUL. */ + ace_yy_cp = ++ace_yy_c_buf_p; + ace_yy_current_state = ace_yy_next_state; + goto ace_yy_match; + } + + else + { + ace_yy_cp = ace_yy_c_buf_p; + goto ace_yy_find_action; + } + } + + else switch ( ace_yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + ace_yy_did_buffer_switch_on_eof = 0; + + if ( ace_yywrap() ) + { + /* Note: because we've taken care in + * ace_yy_get_next_buffer() to have set up + * ace_yytext, we can now set up + * ace_yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * ACE_YY_NULL, it'll still work - another + * ACE_YY_NULL will get returned. + */ + ace_yy_c_buf_p = ace_yytext_ptr + ACE_YY_MORE_ADJ; + + ace_yy_act = ACE_YY_STATE_EOF(ACE_YY_START); + goto do_action; + } + + else + { + if ( ! ace_yy_did_buffer_switch_on_eof ) + ACE_YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + ace_yy_c_buf_p = + ace_yytext_ptr + ace_yy_amount_of_matched_text; + + ace_yy_current_state = ace_yy_get_previous_state(); + + ace_yy_cp = ace_yy_c_buf_p; + ace_yy_bp = ace_yytext_ptr + ACE_YY_MORE_ADJ; + goto ace_yy_match; + + case EOB_ACT_LAST_MATCH: + ace_yy_c_buf_p = + &ace_yy_current_buffer->ace_yy_ch_buf[ace_yy_n_chars]; + + ace_yy_current_state = ace_yy_get_previous_state(); + + ace_yy_cp = ace_yy_c_buf_p; + ace_yy_bp = ace_yytext_ptr + ACE_YY_MORE_ADJ; + goto ace_yy_find_action; + } + break; + } + + default: + ACE_YY_FATAL_ERROR( + ACE_LIB_TEXT("fatal flex scanner internal error--no action found") ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of ace_yylex */ /* ace_yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file */ static int ace_yy_get_next_buffer() - { - register ACE_TCHAR *dest = ace_yy_current_buffer->ace_yy_ch_buf; - register ACE_TCHAR *source = ace_yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( ace_yy_c_buf_p > &ace_yy_current_buffer->ace_yy_ch_buf[ace_yy_n_chars + 1] ) - ACE_YY_FATAL_ERROR( - ACE_LIB_TEXT("fatal flex scanner internal error--end of buffer missed") ); - - if ( ace_yy_current_buffer->ace_yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( ace_yy_c_buf_p - ace_yytext_ptr - ACE_YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (ace_yy_c_buf_p - ace_yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( ace_yy_current_buffer->ace_yy_buffer_status == ACE_YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - ace_yy_current_buffer->ace_yy_n_chars = ace_yy_n_chars = 0; - - else - { - int num_to_read = - ace_yy_current_buffer->ace_yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ + { + register ACE_TCHAR *dest = ace_yy_current_buffer->ace_yy_ch_buf; + register ACE_TCHAR *source = ace_yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( ace_yy_c_buf_p > &ace_yy_current_buffer->ace_yy_ch_buf[ace_yy_n_chars + 1] ) + ACE_YY_FATAL_ERROR( + ACE_LIB_TEXT("fatal flex scanner internal error--end of buffer missed") ); + + if ( ace_yy_current_buffer->ace_yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( ace_yy_c_buf_p - ace_yytext_ptr - ACE_YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (ace_yy_c_buf_p - ace_yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( ace_yy_current_buffer->ace_yy_buffer_status == ACE_YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + ace_yy_current_buffer->ace_yy_n_chars = ace_yy_n_chars = 0; + + else + { + int num_to_read = + ace_yy_current_buffer->ace_yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ #ifdef ACE_YY_USES_REJECT ACE_YY_FATAL_ERROR(ACE_LIB_TEXT( "input buffer overflow, can't enlarge buffer because scanner uses REJECT") ); #else - /* just a shorter name for the current buffer */ - ACE_YY_BUFFER_STATE b = ace_yy_current_buffer; + /* just a shorter name for the current buffer */ + ACE_YY_BUFFER_STATE b = ace_yy_current_buffer; - int ace_yy_c_buf_p_offset = - (int) (ace_yy_c_buf_p - b->ace_yy_ch_buf); + int ace_yy_c_buf_p_offset = + (int) (ace_yy_c_buf_p - b->ace_yy_ch_buf); - if ( b->ace_yy_is_our_buffer ) - { - int new_size = b->ace_yy_buf_size * 2; + if ( b->ace_yy_is_our_buffer ) + { + int new_size = b->ace_yy_buf_size * 2; - if ( new_size <= 0 ) - b->ace_yy_buf_size += b->ace_yy_buf_size / 8; - else - b->ace_yy_buf_size *= 2; + if ( new_size <= 0 ) + b->ace_yy_buf_size += b->ace_yy_buf_size / 8; + else + b->ace_yy_buf_size *= 2; - b->ace_yy_ch_buf = (ACE_TCHAR *) - /* Include room in for 2 EOB chars. */ - ace_yy_flex_realloc( (void *) b->ace_yy_ch_buf, + b->ace_yy_ch_buf = (ACE_TCHAR *) + /* Include room in for 2 EOB chars. */ + ace_yy_flex_realloc( (void *) b->ace_yy_ch_buf, (b->ace_yy_buf_size + 2)*sizeof(ACE_TCHAR)); - } - else - /* Can't grow it, we don't own it. */ - b->ace_yy_ch_buf = 0; + } + else + /* Can't grow it, we don't own it. */ + b->ace_yy_ch_buf = 0; - if ( ! b->ace_yy_ch_buf ) + if ( ! b->ace_yy_ch_buf ) ACE_YY_FATAL_ERROR(ACE_LIB_TEXT( - "fatal error - scanner input buffer overflow") ); + "fatal error - scanner input buffer overflow") ); - ace_yy_c_buf_p = &b->ace_yy_ch_buf[ace_yy_c_buf_p_offset]; + ace_yy_c_buf_p = &b->ace_yy_ch_buf[ace_yy_c_buf_p_offset]; - num_to_read = ace_yy_current_buffer->ace_yy_buf_size - - number_to_move - 1; + num_to_read = ace_yy_current_buffer->ace_yy_buf_size - + number_to_move - 1; #endif - } + } - if ( num_to_read * sizeof (ACE_TCHAR) > ACE_YY_READ_BUF_SIZE ) - num_to_read = ACE_YY_READ_BUF_SIZE/sizeof (ACE_TCHAR); + if ( num_to_read * sizeof (ACE_TCHAR) > ACE_YY_READ_BUF_SIZE ) + num_to_read = ACE_YY_READ_BUF_SIZE/sizeof (ACE_TCHAR); - /* Read in more data. */ - ACE_YY_INPUT( (&ace_yy_current_buffer->ace_yy_ch_buf[number_to_move]), - ace_yy_n_chars, num_to_read ); + /* Read in more data. */ + ACE_YY_INPUT( (&ace_yy_current_buffer->ace_yy_ch_buf[number_to_move]), + ace_yy_n_chars, num_to_read ); - ace_yy_current_buffer->ace_yy_n_chars = ace_yy_n_chars; - } + ace_yy_current_buffer->ace_yy_n_chars = ace_yy_n_chars; + } - if ( ace_yy_n_chars == 0 ) - { - if ( number_to_move == ACE_YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - ace_yyrestart( ace_yyin ); - } + if ( ace_yy_n_chars == 0 ) + { + if ( number_to_move == ACE_YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + ace_yyrestart( ace_yyin ); + } - else - { - ret_val = EOB_ACT_LAST_MATCH; - ace_yy_current_buffer->ace_yy_buffer_status = - ACE_YY_BUFFER_EOF_PENDING; - } - } + else + { + ret_val = EOB_ACT_LAST_MATCH; + ace_yy_current_buffer->ace_yy_buffer_status = + ACE_YY_BUFFER_EOF_PENDING; + } + } - else - ret_val = EOB_ACT_CONTINUE_SCAN; + else + ret_val = EOB_ACT_CONTINUE_SCAN; - ace_yy_n_chars += number_to_move; - ace_yy_current_buffer->ace_yy_ch_buf[ace_yy_n_chars] = ACE_YY_END_OF_BUFFER_CHAR; - ace_yy_current_buffer->ace_yy_ch_buf[ace_yy_n_chars + 1] = ACE_YY_END_OF_BUFFER_CHAR; + ace_yy_n_chars += number_to_move; + ace_yy_current_buffer->ace_yy_ch_buf[ace_yy_n_chars] = ACE_YY_END_OF_BUFFER_CHAR; + ace_yy_current_buffer->ace_yy_ch_buf[ace_yy_n_chars + 1] = ACE_YY_END_OF_BUFFER_CHAR; - ace_yytext_ptr = &ace_yy_current_buffer->ace_yy_ch_buf[0]; + ace_yytext_ptr = &ace_yy_current_buffer->ace_yy_ch_buf[0]; - return ret_val; - } + return ret_val; + } /* ace_yy_get_previous_state - get the state just before the EOB ACE_TCHAR was reached */ static ace_yy_state_type ace_yy_get_previous_state() - { - register ace_yy_state_type ace_yy_current_state; - register ACE_TCHAR *ace_yy_cp; - - ace_yy_current_state = ace_yy_start; - ace_yy_current_state += ACE_YY_AT_BOL(); - - for ( ace_yy_cp = ace_yytext_ptr + ACE_YY_MORE_ADJ; ace_yy_cp < ace_yy_c_buf_p; ++ace_yy_cp ) - { - register ACE_YY_CHAR ace_yy_c = (*ace_yy_cp ? ace_yy_ec[ACE_YY_SC_TO_UI(*ace_yy_cp)] : 1); - if ( ace_yy_accept[ace_yy_current_state] ) - { - ace_yy_last_accepting_state = ace_yy_current_state; - ace_yy_last_accepting_cpos = ace_yy_cp; - } - while ( ace_yy_chk[ace_yy_base[ace_yy_current_state] + ace_yy_c] != ace_yy_current_state ) - { - ace_yy_current_state = (int) ace_yy_def[ace_yy_current_state]; - if ( ace_yy_current_state >= 108 ) - ace_yy_c = ace_yy_meta[(unsigned int) ace_yy_c]; - } - ace_yy_current_state = ace_yy_nxt[ace_yy_base[ace_yy_current_state] + (unsigned int) ace_yy_c]; - } - - return ace_yy_current_state; - } + { + register ace_yy_state_type ace_yy_current_state; + register ACE_TCHAR *ace_yy_cp; + + ace_yy_current_state = ace_yy_start; + ace_yy_current_state += ACE_YY_AT_BOL(); + + for ( ace_yy_cp = ace_yytext_ptr + ACE_YY_MORE_ADJ; ace_yy_cp < ace_yy_c_buf_p; ++ace_yy_cp ) + { + register ACE_YY_CHAR ace_yy_c = (*ace_yy_cp ? ace_yy_ec[ACE_YY_SC_TO_UI(*ace_yy_cp)] : 1); + if ( ace_yy_accept[ace_yy_current_state] ) + { + ace_yy_last_accepting_state = ace_yy_current_state; + ace_yy_last_accepting_cpos = ace_yy_cp; + } + while ( ace_yy_chk[ace_yy_base[ace_yy_current_state] + ace_yy_c] != ace_yy_current_state ) + { + ace_yy_current_state = (int) ace_yy_def[ace_yy_current_state]; + if ( ace_yy_current_state >= 108 ) + ace_yy_c = ace_yy_meta[(unsigned int) ace_yy_c]; + } + ace_yy_current_state = ace_yy_nxt[ace_yy_base[ace_yy_current_state] + (unsigned int) ace_yy_c]; + } + + return ace_yy_current_state; + } /* ace_yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis - * next_state = ace_yy_try_NUL_trans( current_state ); + * next_state = ace_yy_try_NUL_trans( current_state ); */ #ifdef ACE_YY_USE_PROTOS @@ -1219,27 +1221,27 @@ static ace_yy_state_type ace_yy_try_NUL_trans( ace_yy_state_type ace_yy_current_ static ace_yy_state_type ace_yy_try_NUL_trans( ace_yy_current_state ) ace_yy_state_type ace_yy_current_state; #endif - { - register int ace_yy_is_jam; - register ACE_TCHAR *ace_yy_cp = ace_yy_c_buf_p; - - register ACE_YY_CHAR ace_yy_c = 1; - if ( ace_yy_accept[ace_yy_current_state] ) - { - ace_yy_last_accepting_state = ace_yy_current_state; - ace_yy_last_accepting_cpos = ace_yy_cp; - } - while ( ace_yy_chk[ace_yy_base[ace_yy_current_state] + ace_yy_c] != ace_yy_current_state ) - { - ace_yy_current_state = (int) ace_yy_def[ace_yy_current_state]; - if ( ace_yy_current_state >= 108 ) - ace_yy_c = ace_yy_meta[(unsigned int) ace_yy_c]; - } - ace_yy_current_state = ace_yy_nxt[ace_yy_base[ace_yy_current_state] + (unsigned int) ace_yy_c]; - ace_yy_is_jam = (ace_yy_current_state == 107); - - return ace_yy_is_jam ? 0 : ace_yy_current_state; - } + { + register int ace_yy_is_jam; + register ACE_TCHAR *ace_yy_cp = ace_yy_c_buf_p; + + register ACE_YY_CHAR ace_yy_c = 1; + if ( ace_yy_accept[ace_yy_current_state] ) + { + ace_yy_last_accepting_state = ace_yy_current_state; + ace_yy_last_accepting_cpos = ace_yy_cp; + } + while ( ace_yy_chk[ace_yy_base[ace_yy_current_state] + ace_yy_c] != ace_yy_current_state ) + { + ace_yy_current_state = (int) ace_yy_def[ace_yy_current_state]; + if ( ace_yy_current_state >= 108 ) + ace_yy_c = ace_yy_meta[(unsigned int) ace_yy_c]; + } + ace_yy_current_state = ace_yy_nxt[ace_yy_base[ace_yy_current_state] + (unsigned int) ace_yy_c]; + ace_yy_is_jam = (ace_yy_current_state == 107); + + return ace_yy_is_jam ? 0 : ace_yy_current_state; + } #ifndef ACE_YY_NO_UNPUT @@ -1250,41 +1252,41 @@ static void ace_yyunput( c, ace_yy_bp ) int c; register ACE_TCHAR *ace_yy_bp; #endif - { - register ACE_TCHAR *ace_yy_cp = ace_yy_c_buf_p; + { + register ACE_TCHAR *ace_yy_cp = ace_yy_c_buf_p; - /* undo effects of setting up ace_yytext */ - *ace_yy_cp = ace_yy_hold_char; + /* undo effects of setting up ace_yytext */ + *ace_yy_cp = ace_yy_hold_char; - if ( ace_yy_cp < ace_yy_current_buffer->ace_yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = ace_yy_n_chars + 2; - register ACE_TCHAR *dest = &ace_yy_current_buffer->ace_yy_ch_buf[ - ace_yy_current_buffer->ace_yy_buf_size + 2]; - register ACE_TCHAR *source = - &ace_yy_current_buffer->ace_yy_ch_buf[number_to_move]; + if ( ace_yy_cp < ace_yy_current_buffer->ace_yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = ace_yy_n_chars + 2; + register ACE_TCHAR *dest = &ace_yy_current_buffer->ace_yy_ch_buf[ + ace_yy_current_buffer->ace_yy_buf_size + 2]; + register ACE_TCHAR *source = + &ace_yy_current_buffer->ace_yy_ch_buf[number_to_move]; - while ( source > ace_yy_current_buffer->ace_yy_ch_buf ) - *--dest = *--source; + while ( source > ace_yy_current_buffer->ace_yy_ch_buf ) + *--dest = *--source; - ace_yy_cp += (int) (dest - source); - ace_yy_bp += (int) (dest - source); - ace_yy_current_buffer->ace_yy_n_chars = - ace_yy_n_chars = ace_yy_current_buffer->ace_yy_buf_size; + ace_yy_cp += (int) (dest - source); + ace_yy_bp += (int) (dest - source); + ace_yy_current_buffer->ace_yy_n_chars = + ace_yy_n_chars = ace_yy_current_buffer->ace_yy_buf_size; - if ( ace_yy_cp < ace_yy_current_buffer->ace_yy_ch_buf + 2 ) - ACE_YY_FATAL_ERROR(ACE_LIB_TEXT( "flex scanner push-back overflow") ); - } + if ( ace_yy_cp < ace_yy_current_buffer->ace_yy_ch_buf + 2 ) + ACE_YY_FATAL_ERROR(ACE_LIB_TEXT( "flex scanner push-back overflow") ); + } - *--ace_yy_cp = (ACE_TCHAR) c; + *--ace_yy_cp = (ACE_TCHAR) c; - ace_yytext_ptr = ace_yy_bp; - ace_yy_hold_char = *ace_yy_cp; - ace_yy_c_buf_p = ace_yy_cp; - } -#endif /* ifndef ACE_YY_NO_UNPUT */ + ace_yytext_ptr = ace_yy_bp; + ace_yy_hold_char = *ace_yy_cp; + ace_yy_c_buf_p = ace_yy_cp; + } +#endif /* ifndef ACE_YY_NO_UNPUT */ #ifdef __cplusplus @@ -1292,73 +1294,73 @@ static int ace_yyinput() #else static int input() #endif - { - int c; - - *ace_yy_c_buf_p = ace_yy_hold_char; - - if ( *ace_yy_c_buf_p == ACE_YY_END_OF_BUFFER_CHAR ) - { - /* ace_yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( ace_yy_c_buf_p < &ace_yy_current_buffer->ace_yy_ch_buf[ace_yy_n_chars] ) - /* This was really a NUL. */ - *ace_yy_c_buf_p = '\0'; - - else - { /* need more input */ - int offset = ace_yy_c_buf_p - ace_yytext_ptr; - ++ace_yy_c_buf_p; - - switch ( ace_yy_get_next_buffer() ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because ace_yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - ace_yyrestart( ace_yyin ); - - /* fall through */ - - case EOB_ACT_END_OF_FILE: - { - if ( ace_yywrap() ) - return EOF; - - if ( ! ace_yy_did_buffer_switch_on_eof ) - ACE_YY_NEW_FILE; + { + int c; + + *ace_yy_c_buf_p = ace_yy_hold_char; + + if ( *ace_yy_c_buf_p == ACE_YY_END_OF_BUFFER_CHAR ) + { + /* ace_yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( ace_yy_c_buf_p < &ace_yy_current_buffer->ace_yy_ch_buf[ace_yy_n_chars] ) + /* This was really a NUL. */ + *ace_yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = ace_yy_c_buf_p - ace_yytext_ptr; + ++ace_yy_c_buf_p; + + switch ( ace_yy_get_next_buffer() ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because ace_yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + ace_yyrestart( ace_yyin ); + + /* fall through */ + + case EOB_ACT_END_OF_FILE: + { + if ( ace_yywrap() ) + return EOF; + + if ( ! ace_yy_did_buffer_switch_on_eof ) + ACE_YY_NEW_FILE; #ifdef __cplusplus - return ace_yyinput(); + return ace_yyinput(); #else - return input(); + return input(); #endif - } + } - case EOB_ACT_CONTINUE_SCAN: - ace_yy_c_buf_p = ace_yytext_ptr + offset; - break; - } - } - } + case EOB_ACT_CONTINUE_SCAN: + ace_yy_c_buf_p = ace_yytext_ptr + offset; + break; + } + } + } - c = *(unsigned char *) ace_yy_c_buf_p; /* cast for 8-bit char's */ - *ace_yy_c_buf_p = '\0'; /* preserve ace_yytext */ - ace_yy_hold_char = *++ace_yy_c_buf_p; + c = *(unsigned char *) ace_yy_c_buf_p; /* cast for 8-bit char's */ + *ace_yy_c_buf_p = '\0'; /* preserve ace_yytext */ + ace_yy_hold_char = *++ace_yy_c_buf_p; - ace_yy_current_buffer->ace_yy_at_bol = (c == '\n'); + ace_yy_current_buffer->ace_yy_at_bol = (c == '\n'); - return c; - } + return c; + } #ifdef ACE_YY_USE_PROTOS @@ -1367,13 +1369,13 @@ void ace_yyrestart( FILE *input_file ) void ace_yyrestart( input_file ) FILE *input_file; #endif - { - if ( ! ace_yy_current_buffer ) - ace_yy_current_buffer = ace_yy_create_buffer( ace_yyin, ACE_YY_BUF_SIZE ); + { + if ( ! ace_yy_current_buffer ) + ace_yy_current_buffer = ace_yy_create_buffer( ace_yyin, ACE_YY_BUF_SIZE ); - ace_yy_init_buffer( ace_yy_current_buffer, input_file ); - ace_yy_load_buffer_state(); - } + ace_yy_init_buffer( ace_yy_current_buffer, input_file ); + ace_yy_load_buffer_state(); + } #ifdef ACE_YY_USE_PROTOS @@ -1382,28 +1384,28 @@ void ace_yy_switch_to_buffer( ACE_YY_BUFFER_STATE new_buffer ) void ace_yy_switch_to_buffer( new_buffer ) ACE_YY_BUFFER_STATE new_buffer; #endif - { - if ( ace_yy_current_buffer == new_buffer ) - return; + { + if ( ace_yy_current_buffer == new_buffer ) + return; - if ( ace_yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *ace_yy_c_buf_p = ace_yy_hold_char; - ace_yy_current_buffer->ace_yy_buf_pos = ace_yy_c_buf_p; - ace_yy_current_buffer->ace_yy_n_chars = ace_yy_n_chars; - } + if ( ace_yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *ace_yy_c_buf_p = ace_yy_hold_char; + ace_yy_current_buffer->ace_yy_buf_pos = ace_yy_c_buf_p; + ace_yy_current_buffer->ace_yy_n_chars = ace_yy_n_chars; + } - ace_yy_current_buffer = new_buffer; - ace_yy_load_buffer_state(); + ace_yy_current_buffer = new_buffer; + ace_yy_load_buffer_state(); - /* We don't actually know whether we did this switch during - * EOF (ace_yywrap()) processing, but the only time this flag - * is looked at is after ace_yywrap() is called, so it's safe - * to go ahead and always set it. - */ - ace_yy_did_buffer_switch_on_eof = 1; - } + /* We don't actually know whether we did this switch during + * EOF (ace_yywrap()) processing, but the only time this flag + * is looked at is after ace_yywrap() is called, so it's safe + * to go ahead and always set it. + */ + ace_yy_did_buffer_switch_on_eof = 1; + } #ifdef ACE_YY_USE_PROTOS @@ -1411,12 +1413,12 @@ void ace_yy_load_buffer_state( void ) #else void ace_yy_load_buffer_state() #endif - { - ace_yy_n_chars = ace_yy_current_buffer->ace_yy_n_chars; - ace_yytext_ptr = ace_yy_c_buf_p = ace_yy_current_buffer->ace_yy_buf_pos; - ace_yyin = ace_yy_current_buffer->ace_yy_input_file; - ace_yy_hold_char = *ace_yy_c_buf_p; - } + { + ace_yy_n_chars = ace_yy_current_buffer->ace_yy_n_chars; + ace_yytext_ptr = ace_yy_c_buf_p = ace_yy_current_buffer->ace_yy_buf_pos; + ace_yyin = ace_yy_current_buffer->ace_yy_input_file; + ace_yy_hold_char = *ace_yy_c_buf_p; + } #ifdef ACE_YY_USE_PROTOS @@ -1426,28 +1428,28 @@ ACE_YY_BUFFER_STATE ace_yy_create_buffer( file, size ) FILE *file; int size; #endif - { - ACE_YY_BUFFER_STATE b; + { + ACE_YY_BUFFER_STATE b; - b = (ACE_YY_BUFFER_STATE) ace_yy_flex_alloc( sizeof( struct ace_yy_buffer_state ) ); - if ( ! b ) - ACE_YY_FATAL_ERROR(ACE_LIB_TEXT( "out of dynamic memory in ace_yy_create_buffer()") ); + b = (ACE_YY_BUFFER_STATE) ace_yy_flex_alloc( sizeof( struct ace_yy_buffer_state ) ); + if ( ! b ) + ACE_YY_FATAL_ERROR(ACE_LIB_TEXT( "out of dynamic memory in ace_yy_create_buffer()") ); - b->ace_yy_buf_size = size; + b->ace_yy_buf_size = size; - /* ace_yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->ace_yy_ch_buf = (ACE_TCHAR *) ace_yy_flex_alloc( (b->ace_yy_buf_size + 2 ) * sizeof (ACE_TCHAR)); - if ( ! b->ace_yy_ch_buf ) - ACE_YY_FATAL_ERROR(ACE_LIB_TEXT( "out of dynamic memory in ace_yy_create_buffer()") ); + /* ace_yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->ace_yy_ch_buf = (ACE_TCHAR *) ace_yy_flex_alloc( (b->ace_yy_buf_size + 2 ) * sizeof (ACE_TCHAR)); + if ( ! b->ace_yy_ch_buf ) + ACE_YY_FATAL_ERROR(ACE_LIB_TEXT( "out of dynamic memory in ace_yy_create_buffer()") ); - b->ace_yy_is_our_buffer = 1; + b->ace_yy_is_our_buffer = 1; - ace_yy_init_buffer( b, file ); + ace_yy_init_buffer( b, file ); - return b; - } + return b; + } #ifdef ACE_YY_USE_PROTOS @@ -1456,18 +1458,18 @@ void ace_yy_delete_buffer( ACE_YY_BUFFER_STATE b ) void ace_yy_delete_buffer( b ) ACE_YY_BUFFER_STATE b; #endif - { - if ( ! b ) - return; + { + if ( ! b ) + return; - if ( b == ace_yy_current_buffer ) - ace_yy_current_buffer = (ACE_YY_BUFFER_STATE) 0; + if ( b == ace_yy_current_buffer ) + ace_yy_current_buffer = (ACE_YY_BUFFER_STATE) 0; - if ( b->ace_yy_is_our_buffer ) - ace_yy_flex_free( (void *) b->ace_yy_ch_buf ); + if ( b->ace_yy_is_our_buffer ) + ace_yy_flex_free( (void *) b->ace_yy_ch_buf ); - ace_yy_flex_free( (void *) b ); - } + ace_yy_flex_free( (void *) b ); + } #ifndef ACE_YY_ALWAYS_INTERACTIVE #ifndef ACE_YY_NEVER_INTERACTIVE @@ -1490,22 +1492,22 @@ FILE *file; #endif - { - ace_yy_flush_buffer( b ); + { + ace_yy_flush_buffer( b ); - b->ace_yy_input_file = file; - b->ace_yy_fill_buffer = 1; + b->ace_yy_input_file = file; + b->ace_yy_fill_buffer = 1; #if ACE_YY_ALWAYS_INTERACTIVE - b->ace_yy_is_interactive = 1; + b->ace_yy_is_interactive = 1; #else #if ACE_YY_NEVER_INTERACTIVE - b->ace_yy_is_interactive = 0; + b->ace_yy_is_interactive = 0; #else - b->ace_yy_is_interactive = file ? (ACE_OS::isatty( fileno (file) ) > 0) : 0; + b->ace_yy_is_interactive = file ? (ACE_OS::isatty( fileno (file) ) > 0) : 0; #endif #endif - } + } #ifdef ACE_YY_USE_PROTOS @@ -1515,27 +1517,27 @@ void ace_yy_flush_buffer( b ) ACE_YY_BUFFER_STATE b; #endif - { - if ( ! b ) - return; + { + if ( ! b ) + return; - b->ace_yy_n_chars = 0; + b->ace_yy_n_chars = 0; - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->ace_yy_ch_buf[0] = ACE_YY_END_OF_BUFFER_CHAR; - b->ace_yy_ch_buf[1] = ACE_YY_END_OF_BUFFER_CHAR; + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->ace_yy_ch_buf[0] = ACE_YY_END_OF_BUFFER_CHAR; + b->ace_yy_ch_buf[1] = ACE_YY_END_OF_BUFFER_CHAR; - b->ace_yy_buf_pos = &b->ace_yy_ch_buf[0]; + b->ace_yy_buf_pos = &b->ace_yy_ch_buf[0]; - b->ace_yy_at_bol = 1; - b->ace_yy_buffer_status = ACE_YY_BUFFER_NEW; + b->ace_yy_at_bol = 1; + b->ace_yy_buffer_status = ACE_YY_BUFFER_NEW; - if ( b == ace_yy_current_buffer ) - ace_yy_load_buffer_state(); - } + if ( b == ace_yy_current_buffer ) + ace_yy_load_buffer_state(); + } #ifndef ACE_YY_NO_SCAN_BUFFER @@ -1546,33 +1548,33 @@ ACE_YY_BUFFER_STATE ace_yy_scan_buffer( base, size ) ACE_TCHAR *base; ace_yy_size_t size; #endif - { - ACE_YY_BUFFER_STATE b; + { + ACE_YY_BUFFER_STATE b; - if ( size < 2 || - base[size-2] != ACE_YY_END_OF_BUFFER_CHAR || - base[size-1] != ACE_YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; + if ( size < 2 || + base[size-2] != ACE_YY_END_OF_BUFFER_CHAR || + base[size-1] != ACE_YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; - b = (ACE_YY_BUFFER_STATE) ace_yy_flex_alloc( sizeof( struct ace_yy_buffer_state ) ); - if ( ! b ) - ACE_YY_FATAL_ERROR(ACE_LIB_TEXT( "out of dynamic memory in ace_yy_scan_buffer()" )); + b = (ACE_YY_BUFFER_STATE) ace_yy_flex_alloc( sizeof( struct ace_yy_buffer_state ) ); + if ( ! b ) + ACE_YY_FATAL_ERROR(ACE_LIB_TEXT( "out of dynamic memory in ace_yy_scan_buffer()" )); - b->ace_yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->ace_yy_buf_pos = b->ace_yy_ch_buf = base; - b->ace_yy_is_our_buffer = 0; - b->ace_yy_input_file = 0; - b->ace_yy_n_chars = b->ace_yy_buf_size; - b->ace_yy_is_interactive = 0; - b->ace_yy_at_bol = 1; - b->ace_yy_fill_buffer = 0; - b->ace_yy_buffer_status = ACE_YY_BUFFER_NEW; + b->ace_yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->ace_yy_buf_pos = b->ace_yy_ch_buf = base; + b->ace_yy_is_our_buffer = 0; + b->ace_yy_input_file = 0; + b->ace_yy_n_chars = b->ace_yy_buf_size; + b->ace_yy_is_interactive = 0; + b->ace_yy_at_bol = 1; + b->ace_yy_fill_buffer = 0; + b->ace_yy_buffer_status = ACE_YY_BUFFER_NEW; - ace_yy_switch_to_buffer( b ); + ace_yy_switch_to_buffer( b ); - return b; - } + return b; + } #endif @@ -1583,13 +1585,13 @@ ACE_YY_BUFFER_STATE ace_yy_scan_string( ace_yyconst ACE_TCHAR *ace_yy_str ) ACE_YY_BUFFER_STATE ace_yy_scan_string( ace_yy_str ) ace_yyconst ACE_TCHAR *ace_yy_str; #endif - { - int len; - for ( len = 0; ace_yy_str[len]; ++len ) - ; + { + int len; + for ( len = 0; ace_yy_str[len]; ++len ) + ; - return ace_yy_scan_bytes( ace_yy_str, len ); - } + return ace_yy_scan_bytes( ace_yy_str, len ); + } #endif @@ -1601,34 +1603,34 @@ ACE_YY_BUFFER_STATE ace_yy_scan_bytes( bytes, len ) ace_yyconst ACE_TCHAR *bytes; int len; #endif - { - ACE_YY_BUFFER_STATE b; - ACE_TCHAR *buf; - ace_yy_size_t n; - int i; + { + ACE_YY_BUFFER_STATE b; + ACE_TCHAR *buf; + ace_yy_size_t n; + int i; - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (ACE_TCHAR *) ace_yy_flex_alloc( n * sizeof (ACE_TCHAR)); - if ( ! buf ) - ACE_YY_FATAL_ERROR(ACE_LIB_TEXT( "out of dynamic memory in ace_yy_scan_bytes()" )); + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (ACE_TCHAR *) ace_yy_flex_alloc( n * sizeof (ACE_TCHAR)); + if ( ! buf ) + ACE_YY_FATAL_ERROR(ACE_LIB_TEXT( "out of dynamic memory in ace_yy_scan_bytes()" )); - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; - buf[len] = buf[len+1] = ACE_YY_END_OF_BUFFER_CHAR; + buf[len] = buf[len+1] = ACE_YY_END_OF_BUFFER_CHAR; - b = ace_yy_scan_buffer( buf, n ); - if ( ! b ) - ACE_YY_FATAL_ERROR(ACE_LIB_TEXT( "bad buffer in ace_yy_scan_bytes()") ); + b = ace_yy_scan_buffer( buf, n ); + if ( ! b ) + ACE_YY_FATAL_ERROR(ACE_LIB_TEXT( "bad buffer in ace_yy_scan_bytes()") ); - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->ace_yy_is_our_buffer = 1; + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->ace_yy_is_our_buffer = 1; - return b; - } + return b; + } #endif @@ -1639,49 +1641,49 @@ static void ace_yy_push_state( int new_state ) static void ace_yy_push_state( new_state ) int new_state; #endif - { - if ( ace_yy_start_stack_ptr >= ace_yy_start_stack_depth ) - { - ace_yy_size_t new_size; + { + if ( ace_yy_start_stack_ptr >= ace_yy_start_stack_depth ) + { + ace_yy_size_t new_size; - ace_yy_start_stack_depth += ACE_YY_START_STACK_INCR; - new_size = ace_yy_start_stack_depth * sizeof( int ); + ace_yy_start_stack_depth += ACE_YY_START_STACK_INCR; + new_size = ace_yy_start_stack_depth * sizeof( int ); - if ( ! ace_yy_start_stack ) - ace_yy_start_stack = (int *) ace_yy_flex_alloc( new_size ); + if ( ! ace_yy_start_stack ) + ace_yy_start_stack = (int *) ace_yy_flex_alloc( new_size ); - else - ace_yy_start_stack = (int *) ace_yy_flex_realloc( - (void *) ace_yy_start_stack, new_size ); + else + ace_yy_start_stack = (int *) ace_yy_flex_realloc( + (void *) ace_yy_start_stack, new_size ); - if ( ! ace_yy_start_stack ) + if ( ! ace_yy_start_stack ) ACE_YY_FATAL_ERROR(ACE_LIB_TEXT( - "out of memory expanding start-condition stack" )); - } + "out of memory expanding start-condition stack" )); + } - ace_yy_start_stack[ace_yy_start_stack_ptr++] = ACE_YY_START; + ace_yy_start_stack[ace_yy_start_stack_ptr++] = ACE_YY_START; - BEGIN(new_state); - } + BEGIN(new_state); + } #endif #ifndef ACE_YY_NO_POP_STATE static void ace_yy_pop_state() - { - if ( --ace_yy_start_stack_ptr < 0 ) - ACE_YY_FATAL_ERROR(ACE_LIB_TEXT( "start-condition stack underflow" )); + { + if ( --ace_yy_start_stack_ptr < 0 ) + ACE_YY_FATAL_ERROR(ACE_LIB_TEXT( "start-condition stack underflow" )); - BEGIN(ace_yy_start_stack[ace_yy_start_stack_ptr]); - } + BEGIN(ace_yy_start_stack[ace_yy_start_stack_ptr]); + } #endif #ifndef ACE_YY_NO_TOP_STATE static int ace_yy_top_state() - { - return ace_yy_start_stack[ace_yy_start_stack_ptr - 1]; - } + { + return ace_yy_start_stack[ace_yy_start_stack_ptr - 1]; + } #endif #ifndef ACE_YY_EXIT_FAILURE @@ -1694,10 +1696,10 @@ static void ace_yy_fatal_error( ace_yyconst ACE_TCHAR msg[] ) static void ace_yy_fatal_error( msg ) ACE_TCHAR msg[]; #endif - { - (void) ACE_OS::fprintf( stderr, ACE_LIB_TEXT("%s\n"), msg ); - exit( ACE_YY_EXIT_FAILURE ); - } + { + (void) ACE_OS::fprintf( stderr, ACE_LIB_TEXT("%s\n"), msg ); + exit( ACE_YY_EXIT_FAILURE ); + } @@ -1705,16 +1707,16 @@ ACE_TCHAR msg[]; #undef ace_yyless #define ace_yyless(n) \ - do \ - { \ - /* Undo effects of setting up ace_yytext. */ \ - ace_yytext[ace_yyleng] = ace_yy_hold_char; \ - ace_yy_c_buf_p = ace_yytext + n; \ - ace_yy_hold_char = *ace_yy_c_buf_p; \ - *ace_yy_c_buf_p = '\0'; \ - ace_yyleng = n; \ - } \ - while ( 0 ) + do \ + { \ + /* Undo effects of setting up ace_yytext. */ \ + ace_yytext[ace_yyleng] = ace_yy_hold_char; \ + ace_yy_c_buf_p = ace_yytext + n; \ + ace_yy_hold_char = *ace_yy_c_buf_p; \ + *ace_yy_c_buf_p = '\0'; \ + ace_yyleng = n; \ + } \ + while ( 0 ) /* Internal utility routines. */ @@ -1728,11 +1730,11 @@ ACE_TCHAR *s1; ace_yyconst ACE_TCHAR *s2; int n; #endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } #endif #ifdef ACE_YY_NEED_STRLEN @@ -1742,13 +1744,13 @@ static int ace_yy_flex_strlen( ace_yyconst ACE_TCHAR *s ) static int ace_yy_flex_strlen( s ) ace_yyconst ACE_TCHAR *s; #endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; + { + register int n; + for ( n = 0; s[n]; ++n ) + ; - return n; - } + return n; + } #endif @@ -1758,9 +1760,9 @@ static void *ace_yy_flex_alloc( ace_yy_size_t size ) static void *ace_yy_flex_alloc( size ) ace_yy_size_t size; #endif - { - return (void *) malloc( size ); - } + { + return (void *) malloc( size ); + } #ifdef ACE_YY_USE_PROTOS static void *ace_yy_flex_realloc( void *ptr, ace_yy_size_t size ) @@ -1769,16 +1771,16 @@ static void *ace_yy_flex_realloc( ptr, size ) void *ptr; ace_yy_size_t size; #endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } + { + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); + } #ifdef ACE_YY_USE_PROTOS static void ace_yy_flex_free( void *ptr ) @@ -1786,16 +1788,16 @@ static void ace_yy_flex_free( void *ptr ) static void ace_yy_flex_free( ptr ) void *ptr; #endif - { - free( ACE_MALLOC_T (ptr) ); - } + { + free( ACE_MALLOC_T (ptr) ); + } #if ACE_YY_MAIN int main() - { - ace_yylex(); - return 0; - } + { + ace_yylex(); + return 0; +} #endif int @@ -1848,3 +1850,5 @@ ace_yy_pop_buffer (ace_yy_buffer_state *buffer) ace_yy_switch_to_buffer (buffer); } + +#endif /* ACE_USES_CLASSIC_SVC_CONF = 1 */ diff --git a/ace/Svc_Conf_y.cpp b/ace/Svc_Conf_y.cpp index 84b4fe61e54..3ec20415303 100644 --- a/ace/Svc_Conf_y.cpp +++ b/ace/Svc_Conf_y.cpp @@ -2,6 +2,7 @@ /* A Bison parser, made from Svc_Conf.y by GNU Bison version 1.28 */ +#if (ACE_USES_CLASSIC_SVC_CONF == 1) #define ACE_YYBISON 1 /* Identify Bison output. */ #define ACE_DYNAMIC 257 @@ -18,7 +19,7 @@ #define ACE_PATHNAME 268 #define ACE_IDENT 269 #define ACE_STRING 270 - +#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ // $Id$ @@ -31,6 +32,7 @@ ACE_RCSID (ace, Svc_Conf_y, "$Id$") +#if (ACE_USES_CLASSIC_SVC_CONF == 1) // Prototypes. static ACE_Module_Type *ace_get_module (ACE_Static_Node *str_rec, ACE_Static_Node *svc_type); @@ -1403,3 +1405,4 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) return ace_yyparse (¶m); } #endif /* DEBUGGING */ +#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ diff --git a/ace/XML_Svc_Conf.cpp b/ace/XML_Svc_Conf.cpp new file mode 100644 index 00000000000..76300b641d7 --- /dev/null +++ b/ace/XML_Svc_Conf.cpp @@ -0,0 +1,9 @@ +// $Id$ + +#include "ace/XML_Svc_Conf.h" + +#if (ACE_USES_CLASSIC_SVC_CONF == 0) +ACE_XML_Svc_Conf::~ACE_XML_Svc_Conf (void) +{ +} +#endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */ diff --git a/ace/XML_Svc_Conf.h b/ace/XML_Svc_Conf.h new file mode 100644 index 00000000000..855504d34b5 --- /dev/null +++ b/ace/XML_Svc_Conf.h @@ -0,0 +1,54 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file XML_Svc_Conf.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef ACE_XML_SVC_CONF_H +#define ACE_XML_SVC_CONF_H + +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if (ACE_USES_CLASSIC_SVC_CONF == 0) +/** + * @class ACE_XML_Svc_Conf + * + * @brief This abstract class defines the common operations + * ACE_Service_Config expects when using the XML Service Config Parser. + * + * When implementing a concret XML_Svc_Conf class, be sure to overload + * the new/delete function so the dynamically created concret XML_Svc_Conf + * instance can be deleted from the original heap in the DLL/SO. The + * concret XML_Svc_Conf implementation will be put into a DLL/SO that + * ACE applications can link to dynamically using the ACE_DLL class. + * This DLL should include an operation as follow: + * + * extern "C" ACE_XML_Svc_Conf_Parser * _ACEXML_create_XML_Svc_Conf_Object (void); + * + * + */ +class ACE_Export ACE_XML_Svc_Conf +{ +public: + typedef ACE_XML_Svc_Conf *(*Factory)(void); + + virtual ~ACE_XML_Svc_Conf (void) = 0; + + virtual int parse_file (const ACE_TCHAR file[]) = 0; + + virtual int parse_string (const ACE_TCHAR str[]) = 0; +}; +#endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */ + +#include "ace/post.h" + +#endif /* ACE_XML_SVC_CONF_H */ diff --git a/ace/ace.icc b/ace/ace.icc index 6de0551ba58..2837bebb2ed 100755 --- a/ace/ace.icc +++ b/ace/ace.icc @@ -379,6 +379,7 @@ group SVCCONF_FILES = "Service_Types.cpp", "Service_Templates.cpp", "Shared_Object.cpp", + "XML_Svc_Conf.cpp", "Svc_Conf_l.cpp", "Svc_Conf_y.cpp", "Svc_Conf_Lexer_Guard.cpp" @@ -393,7 +394,9 @@ group SVCCONF_INCLUDES = "Service_Repository.h", "Service_Types.h", "Service_Templates.h", - "Shared_Object.h" + "Shared_Object.h", + "Svc_Conf.h", + "XML_Svc_Conf.h" group STREAMS_FILES = "CDR_Base.cpp", diff --git a/ace/ace_dll.dsp b/ace/ace_dll.dsp index e58fc6a7db2..3c5073f0d82 100644 --- a/ace/ace_dll.dsp +++ b/ace/ace_dll.dsp @@ -186,14 +186,6 @@ SOURCE=.\ARGV.cpp # End Source File
# Begin Source File
-SOURCE=.\Argv_Type_Converter.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\Asynch_Connector.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\Asynch_IO.cpp
# End Source File
# Begin Source File
@@ -202,10 +194,6 @@ SOURCE=.\Asynch_IO_Impl.cpp # End Source File
# Begin Source File
-SOURCE=.\Asynch_Pseudo_Task.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\ATM_Acceptor.cpp
# End Source File
# Begin Source File
@@ -274,10 +262,6 @@ SOURCE=.\Containers.cpp # End Source File
# Begin Source File
-SOURCE=.\Copy_Disabled.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\Date_Time.cpp
# End Source File
# Begin Source File
@@ -954,10 +938,6 @@ SOURCE=.\Time_Request_Reply.cpp # End Source File
# Begin Source File
-SOURCE=.\Time_Value.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\Timeprobe.cpp
# End Source File
# Begin Source File
@@ -1070,6 +1050,10 @@ SOURCE=.\WIN32_Proactor.cpp # End Source File
# Begin Source File
+SOURCE=.\XML_Svc_Conf.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\XtReactor.cpp
# End Source File
# End Group
@@ -1118,18 +1102,10 @@ SOURCE=.\ARGV.h # End Source File
# Begin Source File
-SOURCE=.\Argv_Type_Converter.h
-# End Source File
-# Begin Source File
-
SOURCE=.\Asynch_Acceptor.h
# End Source File
# Begin Source File
-SOURCE=.\Asynch_Connector.h
-# End Source File
-# Begin Source File
-
SOURCE=.\Asynch_IO.h
# End Source File
# Begin Source File
@@ -1138,10 +1114,6 @@ SOURCE=.\Asynch_IO_Impl.h # End Source File
# Begin Source File
-SOURCE=.\Asynch_Pseudo_Task.h
-# End Source File
-# Begin Source File
-
SOURCE=.\ATM_Acceptor.h
# End Source File
# Begin Source File
@@ -1278,10 +1250,6 @@ SOURCE=.\Containers_T.h # End Source File
# Begin Source File
-SOURCE=.\Copy_Disabled.h
-# End Source File
-# Begin Source File
-
SOURCE=.\Date_Time.h
# End Source File
# Begin Source File
@@ -2278,6 +2246,10 @@ SOURCE=.\WIN32_Proactor.h # End Source File
# Begin Source File
+SOURCE=.\XML_Svc_Conf.h
+# End Source File
+# Begin Source File
+
SOURCE=.\XtReactor.h
# End Source File
# End Group
@@ -2314,10 +2286,6 @@ SOURCE=.\ARGV.i # End Source File
# Begin Source File
-SOURCE=.\Argv_Type_Converter.inl
-# End Source File
-# Begin Source File
-
SOURCE=.\Asynch_Acceptor.i
# End Source File
# Begin Source File
@@ -3046,10 +3014,6 @@ SOURCE=.\Thread_Manager.i # End Source File
# Begin Source File
-SOURCE=.\Time_Value.inl
-# End Source File
-# Begin Source File
-
SOURCE=.\Timer_Queue_Adapters.i
# End Source File
# Begin Source File
@@ -3150,19 +3114,6 @@ SOURCE=.\Asynch_Acceptor.cpp # Begin Source File
SOURCE=.\Atomic_Op.cpp
-
-!IF "$(CFG)" == "ACE DLL - Win32 MFC Release"
-
-!ELSEIF "$(CFG)" == "ACE DLL - Win32 MFC Debug"
-
-!ELSEIF "$(CFG)" == "ACE DLL - Win32 Release"
-
-!ELSEIF "$(CFG)" == "ACE DLL - Win32 Debug"
-
-# PROP Exclude_From_Build 1
-
-!ENDIF
-
# End Source File
# Begin Source File
@@ -3217,19 +3168,6 @@ SOURCE=.\Dump_T.cpp # Begin Source File
SOURCE=.\Framework_Component_T.cpp
-
-!IF "$(CFG)" == "ACE DLL - Win32 MFC Release"
-
-!ELSEIF "$(CFG)" == "ACE DLL - Win32 MFC Debug"
-
-!ELSEIF "$(CFG)" == "ACE DLL - Win32 Release"
-
-!ELSEIF "$(CFG)" == "ACE DLL - Win32 Debug"
-
-# PROP Exclude_From_Build 1
-
-!ENDIF
-
# End Source File
# Begin Source File
diff --git a/ace/ace_lib.dsp b/ace/ace_lib.dsp index d6de6069d7e..13d376dc851 100644 --- a/ace/ace_lib.dsp +++ b/ace/ace_lib.dsp @@ -173,14 +173,6 @@ SOURCE=.\ARGV.cpp # End Source File
# Begin Source File
-SOURCE=.\Argv_Type_Converter.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\Asynch_Connector.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\Asynch_IO.cpp
# End Source File
# Begin Source File
@@ -189,10 +181,6 @@ SOURCE=.\Asynch_IO_Impl.cpp # End Source File
# Begin Source File
-SOURCE=.\Asynch_Pseudo_Task.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\ATM_Acceptor.cpp
# End Source File
# Begin Source File
@@ -261,10 +249,6 @@ SOURCE=.\Containers.cpp # End Source File
# Begin Source File
-SOURCE=.\Copy_Disabled.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\Date_Time.cpp
# End Source File
# Begin Source File
@@ -945,10 +929,6 @@ SOURCE=.\Time_Request_Reply.cpp # End Source File
# Begin Source File
-SOURCE=.\Time_Value.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\Timeprobe.cpp
# End Source File
# Begin Source File
@@ -1061,6 +1041,10 @@ SOURCE=.\WIN32_Proactor.cpp # End Source File
# Begin Source File
+SOURCE=.\XML_Svc_Conf.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\XtReactor.cpp
# End Source File
# End Group
@@ -1109,18 +1093,10 @@ SOURCE=.\ARGV.h # End Source File
# Begin Source File
-SOURCE=.\Argv_Type_Converter.h
-# End Source File
-# Begin Source File
-
SOURCE=.\Asynch_Acceptor.h
# End Source File
# Begin Source File
-SOURCE=.\Asynch_Connector.h
-# End Source File
-# Begin Source File
-
SOURCE=.\Asynch_IO.h
# End Source File
# Begin Source File
@@ -1129,10 +1105,6 @@ SOURCE=.\Asynch_IO_Impl.h # End Source File
# Begin Source File
-SOURCE=.\Asynch_Pseudo_Task.h
-# End Source File
-# Begin Source File
-
SOURCE=.\ATM_Acceptor.h
# End Source File
# Begin Source File
@@ -1273,10 +1245,6 @@ SOURCE=.\Containers_T.h # End Source File
# Begin Source File
-SOURCE=.\Copy_Disabled.h
-# End Source File
-# Begin Source File
-
SOURCE=.\Date_Time.h
# End Source File
# Begin Source File
@@ -2273,6 +2241,10 @@ SOURCE=.\WIN32_Proactor.h # End Source File
# Begin Source File
+SOURCE=.\XML_Svc_Conf.h
+# End Source File
+# Begin Source File
+
SOURCE=.\XtReactor.h
# End Source File
# End Group
@@ -2309,10 +2281,6 @@ SOURCE=.\ARGV.i # End Source File
# Begin Source File
-SOURCE=.\Argv_Type_Converter.inl
-# End Source File
-# Begin Source File
-
SOURCE=.\Asynch_Acceptor.i
# End Source File
# Begin Source File
@@ -3041,10 +3009,6 @@ SOURCE=.\Thread_Manager.i # End Source File
# Begin Source File
-SOURCE=.\Time_Value.inl
-# End Source File
-# Begin Source File
-
SOURCE=.\Timer_Queue_Adapters.i
# End Source File
# Begin Source File
@@ -3145,19 +3109,6 @@ SOURCE=.\Asynch_Acceptor.cpp # Begin Source File
SOURCE=.\Atomic_Op.cpp
-
-!IF "$(CFG)" == "ACE LIB - Win32 Pharlap ETS Static Release"
-
-!ELSEIF "$(CFG)" == "ACE LIB - Win32 Pharlap ETS Static Debug"
-
-!ELSEIF "$(CFG)" == "ACE LIB - Win32 Static Release"
-
-!ELSEIF "$(CFG)" == "ACE LIB - Win32 Static Debug"
-
-# PROP Exclude_From_Build 1
-
-!ENDIF
-
# End Source File
# Begin Source File
@@ -3212,19 +3163,6 @@ SOURCE=.\Dump_T.cpp # Begin Source File
SOURCE=.\Framework_Component_T.cpp
-
-!IF "$(CFG)" == "ACE LIB - Win32 Pharlap ETS Static Release"
-
-!ELSEIF "$(CFG)" == "ACE LIB - Win32 Pharlap ETS Static Debug"
-
-!ELSEIF "$(CFG)" == "ACE LIB - Win32 Static Release"
-
-!ELSEIF "$(CFG)" == "ACE LIB - Win32 Static Debug"
-
-# PROP Exclude_From_Build 1
-
-!ENDIF
-
# End Source File
# Begin Source File
diff --git a/ace/config-all.h b/ace/config-all.h index 395eb68d2a9..62fadf96134 100644 --- a/ace/config-all.h +++ b/ace/config-all.h @@ -635,6 +635,33 @@ typedef void *(*ACE_THR_C_FUNC)(void *); #endif /* ACE_HAS_PACE */ // ============================================================================ +// ACE_USES_CLASSIC_SVC_CONF macro +// ============================================================================ + +// For now, default is to use the classic svc.conf format. +#if !defined (ACE_USES_CLASSIC_SVC_CONF) +# if defined (ACE_HAS_CLASSIC_SVC_CONF) && defined (ACE_HAS_XML_SVC_CONF) +# error You can only use either CLASSIC or XML svc.conf, not both. +# endif +// Change the ACE_HAS_XML_SVC_CONF to ACE_HAS_CLASSIC_SVC_CONF when +// we switch ACE to use XML svc.conf as default format. +# if defined (ACE_HAS_XML_SVC_CONF) +# define ACE_USES_CLASSIC_SVC_CONF 0 +# else +# define ACE_USES_CLASSIC_SVC_CONF 1 +# endif /* ACE_HAS_XML_SVC_CONF */ +#endif /* ACE_USES_CLASSIC_SVC_CONF */ + +// ============================================================================ +// Default svc.conf file extension. +// ============================================================================ +#if defined (ACE_USES_CLASSIC_SVC_CONF) && (ACE_USES_CLASSIC_SVC_CONF == 1) +# define ACE_DEFAULT_SVC_CONF_EXT ".conf" +#else +# define ACE_DEFAULT_SVC_CONF_EXT ".conf.xml" +#endif /* ACE_USES_CLASSIC_SVC_CONF && ACE_USES_CLASSIC_SVC_CONF == 1 */ + +// ============================================================================ // Miscellaneous macros // ============================================================================ diff --git a/bin/generate_export_file.pl b/bin/generate_export_file.pl index 54567889de7..7c11a18e40e 100755 --- a/bin/generate_export_file.pl +++ b/bin/generate_export_file.pl @@ -13,6 +13,8 @@ use Getopt::Std; ############################################################################## # Grab the options +$flags = join (" ", @ARGV); + if (!getopts ('df:hs') || $opt_h) { print "generate_export_file.pl [-d] [-f dependency] [-s] library_name\n"; print "\n"; @@ -57,7 +59,7 @@ $prologue = ' // -*- C++ -*- // $Id$ // Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl +// This file is generated automatically by generate_export_file.pl '."$flags".' // ------------------------------'." #ifndef -UC-_EXPORT_H #define -UC-_EXPORT_H diff --git a/bin/svcconf-convert.pl b/bin/svcconf-convert.pl new file mode 100755 index 00000000000..978628690fe --- /dev/null +++ b/bin/svcconf-convert.pl @@ -0,0 +1,300 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# +# File: svcconf-convert.pl: +# Purpose: This perl script convert classic svc.conf file into XML svc.conf file format. +# Usage: svcconf-convert.pl [-i infile] [-o outfile] [-verbose] [-nocomment] +# -i: Specify the input classic svc.conf filename. +# If omitted, the default input filename is "svc.conf". +# -o: Specify the output XML svc.conf filename. +# If this argument is omitted, the resulting XML file will be written +# to file called <input filename>.xml. +# -verbose: Verbose output. +# -nocomment: Remove all comments. Use this argument if you have comments +# mixing in the middle of a classic svc.conf directive. + +$indent = 0; + +sub inc_indent +{ + $indent += 2; +} + +sub dec_indent +{ + $indent -= 2; +} + +sub get_indent +{ + $retv = 0; + print STDERR "$0 (", $lineno, "): Unbalanced macro pairs\n" if ($indent < 0); + $retv = $indent - 1 if ($indent > 0); + $retv; +} + +sub acexml_comment +{ + my $comment = shift; + print OUT " " x &get_indent (), "<!-- $comment -->\n"; +} + +sub acexml_start +{ + my $name = shift; + my $standalone = shift; + + print OUT " " x &get_indent (), "<$name"; + + + while (@attnames) + { + print OUT " ", pop (@attnames), '="', pop (@attvalues), '"'; + } + + if ($standalone != 0) + { + print OUT "/>\n"; + } + else + { + print OUT ">\n"; + inc_indent (); + } +} + +sub acexml_end +{ + my $name = shift; + + dec_indent (); + print OUT " " x &get_indent (), "</$name>\n"; +} + +$verbose = 0; +$nocomment = 0; +@attvalues = (); +@attnames = (); +$stream = ""; +$infile = ""; +$outfile = ""; + +while ( $#ARGV >= 0) +{ + if ($ARGV[0] =~ m/^-i/i) { + shift; + $infile = "$ARGV[0]"; + } + elsif ($ARGV[0] =~ m/^-o/i) { + shift; + $outfile = "$ARGV[0]"; + } + elsif ($ARGV[0] =~ m/^-verbose/i) { + $verbose = 1; + } + elsif ($ARGV[0] =~ m/^-nocomment/i) { + $nocomment = 1; + } + elsif ($ARGV[0] =~ m/^-(\?|h|help)/i) { # Help information + print +" Usage: svcconf-convert.pl [-i infile] [-o outfile] [-verbose] [-nocomment] + -i: Specify the input classic svc.conf filename. + If omitted, the default input filename is 'svc.conf'. + -o: Specify the output XML svc.conf filename. + If this argument is omitted, the resulting XML file will + be written to file called <input filename>.xml. + -verbose: Verbose output. + -nocomment: Remove all comments. Use this argument if you + have comments mixing in the middle of a classic + svc.conf directive. +"; + exit; + } + elsif ($ARGV[0] =~ m/^-/) { + warn "$0: unknown option $ARGV[0]\n"; + exit 1; + } + else { + die "unknow argument\n"; + } + shift; +} + +if ($infile eq "") { + print "Using default svc.conf name\n" if ($verbose != 0); + $infile = "svc.conf"; +} + + +if ($outfile eq "") { + $outfile = "$infile.xml"; +} +print "OUTFILE = $outfile \n"; + +open (OUT, "> $outfile") or die "Unable to open $outfile\n"; + +undef $/; +open (FH, "< $infile"); +$_ = <FH>; + +if ($nocomment) { + if (s/^\#(.*)$//mg) { + print "ts = $_\n" if ($verbose != 0); + } +} + +print "------------------------------------------------------------\n" if ($verbose != 0); + +print OUT "<?xml version='1.0'?>\n"; +print OUT "<!-- Converted from $infile by svcconf-convert.pl -->\n"; +acexml_start ("ACE_Svc_Conf", 0); + +while (length ($_) != 0) { + s/^\s*$//mg; + + print "INPUT =\n$_\n" if ($verbose); + PARSE: { + if (s/^\s*\#(.*)//) { + acexml_comment ($1); + print "# $1\n" if ($verbose); + } + if (s/^\s*{//) { + acexml_start ("module", 0); + print "open module\n" if ($verbose); + } + + if (s/^\s*}//) { + acexml_end ("module"); + acexml_end ($stream); + print "close module\n" if ($verbose); + } + + if (s/^\s*stream\s+dynamic\s+(\w+)\s+(\w+)\s*\*\s*(\S+):(\S+)\s*\(\s*\)(\s+(active|inactive))?(\s+"([^"]+)")?//) { + $name = $1; + $type = $2; + $path = $3; + $init = $4; + $state = $6; + $param = $8; + acexml_start ("streamdef"); + if ($status ne "") { + push @attnames, ("status"); + push @attvalues, ("$state"); + } + push @attnames, ("type"); + push @attvalues, ("$type"); + push @attnames, ("id"); + push @attvalues, ("$name"); + acexml_start ("dynamic", 0); + if ($param ne "") { + push @attnames, ("params"); + push @attvalues, ("$param"); + } + push @attnames, ("init"); + push @attvalues, ("$init"); + push @attnames, ("path"); + push @attvalues, ("$path"); + acexml_start ("initializer", 1); + acexml_end ("dynamic"); + $stream = "streamdef"; + print "stream dynamic $name $type * $init:$path \"$param\" $state\n" if ($verbose); + } + + if (s/^\s*stream\s+static\s+(\w+)(\s+("(.+)"))?//) { + $name = $1; + $param = $4; + acexml_start ("streamdef", 0); + if ($param ne "") { + push @attnames, ("params"); + push @attvalues, ("$param"); + } + push @attnames, ("id"); + push @attvalues, ("$name"); + acexml_start ("static", 1); + $stream = "streamdef"; + print "static $name \"$param\"\n" if ($verbose); + } + + if (s/^\s*stream\s+(\w+)//) { + $name = $1; + push @attnames, ("id"); + push @attvalues, ("$name"); + acexml_start ("stream", 0); + $stream = "stream"; + print "stream $name\n" if ($verbose); + } + + if (s/^\s*dynamic\s+(\w+)\s+(\w+)\s*\*\s*(\S+):(\S+)\s*\(\s*\)(\s+(active|inactive))?(\s+"([^"]+)")?//) { + $name = $1; + $type = $2; + $path = $3; + $init = $4; + $state = $6; + $param = $8; + if ($status ne "") { + push @attnames, ("status"); + push @attvalues, ("$state"); + } + push @attnames, ("type"); + push @attvalues, ("$type"); + push @attnames, ("id"); + push @attvalues, ("$name"); + acexml_start ("dynamic", 0); + if ($param ne "") { + push @attnames, ("params"); + push @attvalues, ("$param"); + } + push @attnames, ("init"); + push @attvalues, ("$init"); + push @attnames, ("path"); + push @attvalues, ("$path"); + acexml_start ("initializer", 1); + acexml_end ("dynamic"); + print "dynamic $name $type * $init:$path \"$param\" $state\n" if ($verbose); + } + + if (s/^\s*static\s+(\w+)(\s+("(.+)"))?//) { + $name = $1; + $param = $4; + if ($param ne "") { + push @attnames, ("params"); + push @attvalues, ("$param"); + } + push @attnames, ("id"); + push @attvalues, ("$name"); + acexml_start ("static", 1); + print "static $name \"$param\"\n" if ($verbose); + } + + if ( s/^\s*resume\s+(\w+)//) { + $name = $1; + push @attnames, ("id"); + push @attvalues, ("$name"); + acexml_start ("resume", 1); + print "resume $name\n" if ($verbose); + } + + if ( s/^\s*remove\s+(\w+)//) { + $name = $1; + push @attnames, ("id"); + push @attvalues, ("$name"); + acexml_start ("remove", 1); + print "remove $name\n" if ($verbose); + } + + if ( s/^\s*suspend\s+(\w+)//) { + $name = $1; + push @attnames, ("id"); + push @attvalues, ("$name"); + acexml_start ("suspend", 1); + print "suspend $name\n" if ($verbose); + } + + $nothing = 1; + } +} + +acexml_end ("ACE_Svc_Conf"); diff --git a/examples/ASX/CCM_App/Makefile b/examples/ASX/CCM_App/Makefile index a52c2beba14..9d796f84d39 100644 --- a/examples/ASX/CCM_App/Makefile +++ b/examples/ASX/CCM_App/Makefile @@ -9,6 +9,8 @@ # Local macros #---------------------------------------------------------------------------- +LIBS += $(ACELIB) -lACEXML_Parser -lACEXML + BIN = SC_Client \ SC_Server @@ -30,11 +32,25 @@ include $(ACE_ROOT)/include/makeinclude/macros.GNU include $(ACE_ROOT)/include/makeinclude/rules.common.GNU include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU + +ifdef shared_libs + ifndef VXWORKS + #### Build libCCM_App library first, + #### so that they don't see the template instantiations from all + #### of the tests. + BUILD := \ + libCCM_App.$(SOEXT) \ + $(BUILD) + endif # ! VXWORKS +endif # shared_libs + include $(ACE_ROOT)/include/makeinclude/rules.local.GNU #---------------------------------------------------------------------------- # Local targets #---------------------------------------------------------------------------- +libCCM_App.$(SOEXT): CCM_App.cpp + @$(MAKE) -f Makefile.CCM_App #---------------------------------------------------------------------------- # Dependencies diff --git a/examples/ASX/CCM_App/Makefile.CCM_App b/examples/ASX/CCM_App/Makefile.CCM_App new file mode 100644 index 00000000000..3a5f20e1e4b --- /dev/null +++ b/examples/ASX/CCM_App/Makefile.CCM_App @@ -0,0 +1,49 @@ +#---------------------------------------------------------------------------- +# $Id$ +# +# Makefile for the DLL library in the DLL_Test example +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +LIB = libCCM_App.a +SHLIB = libCCM_App.$(SOEXT) +FILES = CCM_App +LSRC = $(addsuffix .cpp,$(FILES)) + +LIBS += $(ACELIB) + +BUILD = $(VLIB) $(VSHLIB) + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU + +# To remake the DLL_Test source with xlC on AIX, it works +# best to wipe out any previously-created tempinc directory. +# The compiler/linker isn't too smart about instantiating templates... +ifdef TEMPINCDIR +COMPILE.cc := $(RM) -rf tempinc; $(COMPILE.cc) +endif + +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Dependencies +#---------------------------------------------------------------------------- +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + + +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/examples/ASX/CCM_App/svc.conf.xml b/examples/ASX/CCM_App/svc.conf.xml new file mode 100644 index 00000000000..e743d4ed986 --- /dev/null +++ b/examples/ASX/CCM_App/svc.conf.xml @@ -0,0 +1,33 @@ +<?xml version='1.0'?> +<!-- Converted from svc.conf by svcconf-convert.pl --> +<ACE_Svc_Conf> + <static id="ACE_Service_Manager" params="-d -p 4911"/> + <dynamic id="Test_Task" type="Service_Object"> + <initializer path="CCM_App" init="_make_Test_Task" params="-p 3000"/> + </dynamic> + <streamdef> + <dynamic id="CCM_App" type="STREAM"> + <initializer path="CCM_App" init="make_stream"/> + </dynamic> + <module> + <dynamic id="Device_Adapter" type="Module"> + <initializer path="CCM_App" init="make_da"/> + </dynamic> + <dynamic id="Event_Analyzer" type="Module"> + <initializer path="CCM_App" init="make_ea"/> + </dynamic> + <dynamic id="Multicast_Router" type="Module"> + <initializer path="CCM_App" init="make_mr" params="-p 3001"/> + </dynamic> + </module> + </streamdef> + <stream id="CCM_App"> + <module> + <remove id="Device_Adapter"/> + <!-- remove Event_Analyzer --> + <!-- remove Multicast_Router --> + </module> + </stream> + <!-- remove CCM_App --> + <remove id="Test_Task"/> +</ACE_Svc_Conf> diff --git a/netsvcs/servers/svc.conf.xml b/netsvcs/servers/svc.conf.xml new file mode 100644 index 00000000000..6657e500089 --- /dev/null +++ b/netsvcs/servers/svc.conf.xml @@ -0,0 +1,32 @@ +<?xml version='1.0'?> +<!-- Converted from svc.conf by svcconf-convert.pl --> +<ACE_Svc_Conf> + <!-- These are the services that can be linked into ACE. --> + <!-- Note that you can append the "netsvcs" with --> + <!-- a relative path if you idn't set your LD search path correctly -- --> + <!-- ACE will locate this for you automatically by reading your LD search --> + <!-- path. Moreover, ACE will automatically insert the correct suffix --> + <!-- (e.g., ".dll", ".so", etc.). In addition, you can replace the --> + <!-- hardcoded "-p 20xxx" with "-p $PORTxxx" if you set your environment --> + <!-- variables correctly. --> + <dynamic id="Logger" type="Service_Object"> + <initializer path="ACE" init="_make_ACE_Logging_Strategy" params="-s foobar -f STDERR|OSTREAM|VERBOSE"/> + </dynamic> + <dynamic id="Time_Service" type="Service_Object"> + <initializer path="netsvcs" init="_make_ACE_TS_Server_Acceptor" params="-p 20222"/> + </dynamic> + <dynamic id="Name_Server" type="Service_Object"> + <initializer path="netsvcs" init="_make_ACE_Name_Acceptor" params="-p 20012"/> + </dynamic> + <!-- This service is disabled by default -- only enable it ACE is compiled with ACE_HAS_TOKENS_LIBRARY. --> + <!-- dynamic Token_Service Service_Object * netsvcs:_make_ACE_Token_Acceptor() "-p 20202" --> + <dynamic id="Server_Logging_Service" type="Service_Object"> + <initializer path="netsvcs" init="_make_ACE_Server_Logging_Acceptor" params="-p 20009"/> + </dynamic> + <dynamic id="Thr_Server_Logging_Service" type="Service_Object"> + <initializer path="netsvcs" init="_make_ACE_Thr_Server_Logging_Acceptor" params="-p 20020"/> + </dynamic> + <dynamic id="Client_Logging_Service" type="Service_Object"> + <initializer path="netsvcs" init="_make_ACE_Client_Logging_Acceptor" params="-p 20009"/> + </dynamic> +</ACE_Svc_Conf> diff --git a/tests/Service_Config_DLL.cpp b/tests/Service_Config_DLL.cpp index 8f556c8f56e..d63bf011fe2 100644 --- a/tests/Service_Config_DLL.cpp +++ b/tests/Service_Config_DLL.cpp @@ -42,12 +42,21 @@ Service_Config_DLL::init (int argc, ACE_TCHAR *argv[]) argv[1])); ACE_OS::sprintf (this->directive_[0], +#if (ACE_USES_CLASSIC_SVC_CONF == 1) ACE_TEXT ("dynamic Test_Object_%s Service_Object * Service_Config_DLL:_make_Service_Config_DLL() \"Test_Object_%s\""), +#else + ACE_TEXT ("<?xml version='1.0'?> <dynamic id='Test_Object_%s' type='service_object'> <initializer init='_make_Service_Config_DLL' path='Service_Config_DLL' params='Test_Object_%s'/> </dynamic>"), +#endif argv[0], argv[0]); ACE_OS::sprintf (this->directive_[1], +#if (ACE_USES_CLASSIC_SVC_CONF == 1) ACE_TEXT ("dynamic Test_Object_%s Service_Object * Service_Config_DLL:_make_Service_Config_DLL() \"Test_Object_%s\""), +#else + ACE_TEXT ("<?xml version='1.0'?> <dynamic id='Test_Object_%s' type='service_object'> <initializer init='_make_Service_Config_DLL' path='Service_Config_DLL' params='Test_Object_%s'/> </dynamic>"), +#endif + argv[1], argv[1]); diff --git a/tests/Service_Config_Test.conf.xml b/tests/Service_Config_Test.conf.xml new file mode 100644 index 00000000000..f3273f0cb93 --- /dev/null +++ b/tests/Service_Config_Test.conf.xml @@ -0,0 +1,27 @@ +<?xml version='1.0'?> +<!-- Converted from Service_Config_Test.conf by svcconf-convert.pl --> +<ACE_Svc_Conf> + <!-- Dynamically loading each of the Service Objects below causes a --> + <!-- number of threads to be spawned, each one invoking the Service --> + <!-- Configurator (e.g. ACE_Service_Config::process_directive(). If the --> + <!-- Service Configurator is thread safe and reentrant, then parsing of --> + <!-- this `Service_Config_Test.conf' file should run to completion --> + <!-- without error. --> + <!-- --> + <!-- Test_Object_1 will cause Test_Object_2 and Test_Object_3 to be --> + <!-- dynamically loaded. Dynamic loading of each of object will occur in --> + <!-- a separate thread. --> + <dynamic id="Test_Object_1" type="Service_Object"> + <initializer init="_make_Service_Config_DLL" path="Service_Config_DLL" params="2 3"/> + </dynamic> + <!-- Test_Object_4 will cause Test_Object_5 and Test_Object_6 to be --> + <!-- dynamically loaded. Dynamic loading of each of object will occur in --> + <!-- a separate thread. --> + <dynamic id="Test_Object_4" type="Service_Object"> + <initializer init="_make_Service_Config_DLL" path="Service_Config_DLL" params="5 6"/> + </dynamic> + <!-- Final_Object does nothing but print a completion message. --> + <dynamic id="Final_Object" type="Service_Object"> + <initializer init="_make_Service_Config_DLL" path="Service_Config_DLL" params="FINAL"/> + </dynamic> +</ACE_Svc_Conf> diff --git a/tests/Service_Config_Test.cpp b/tests/Service_Config_Test.cpp index d44c7fd7595..7632415a6d7 100644 --- a/tests/Service_Config_Test.cpp +++ b/tests/Service_Config_Test.cpp @@ -134,10 +134,12 @@ run_test (int argc, ACE_TCHAR *argv[]) // Byte ordering is also an issue, so we should be // generating this file on-the-fly from the UTF-8 encoded // file by using functions like iconv(1) or iconv(3). - ACE_TEXT ("Service_Config_Test.UTF-16.conf"); + ACE_TEXT ("Service_Config_Test.UTF-16") + ACE_TEXT (ACE_DEFAULT_SVC_CONF_EXT); #else // ASCII (UTF-8) encoded Service Configurator file. - ACE_TEXT ("Service_Config_Test.conf"); + ACE_TEXT ("Service_Config_Test") + ACE_TEXT (ACE_DEFAULT_SVC_CONF_EXT); #endif /* ACE_USES_WCHAR */ // Process the Service Configurator directives in this test's |