From 8deff6fb42b498ba440bfd400475d287c67c5409 Mon Sep 17 00:00:00 2001 From: Marc Laukien Date: Sat, 8 Sep 2001 18:29:04 +0000 Subject: functional/shared/handle changes --- cpp/src/Ice/Acceptor.h | 2 +- cpp/src/Ice/Collector.cpp | 9 ++- cpp/src/Ice/Connector.h | 2 +- cpp/src/Ice/Emitter.h | 2 +- cpp/src/Ice/Endpoint.h | 2 +- cpp/src/Ice/EventHandler.h | 2 +- cpp/src/Ice/Instance.h | 2 +- cpp/src/Ice/Makefile | 3 +- cpp/src/Ice/ObjectAdapterFactory.cpp | 3 +- cpp/src/Ice/ObjectAdapterFactory.h | 2 +- cpp/src/Ice/ObjectAdapterI.cpp | 8 +- cpp/src/Ice/Proxy.cpp | 19 ++--- cpp/src/Ice/ProxyFactory.h | 2 +- cpp/src/Ice/Reference.h | 2 +- cpp/src/Ice/Shared.cpp | 45 ------------ cpp/src/Ice/ThreadPool.h | 2 +- cpp/src/Ice/TraceLevels.h | 2 +- cpp/src/Ice/Transceiver.h | 2 +- cpp/src/Ice/ValueFactoryManager.h | 2 +- cpp/src/Ice/ice.dsp | 4 - cpp/src/IcePack/Grammer.y | 2 + cpp/src/IcePack/Parser.cpp | 120 ++++++++++++++++++++++++++++-- cpp/src/IcePack/Parser.h | 23 +++++- cpp/src/IcePack/Scanner.l | 138 ++--------------------------------- cpp/src/Slice/GrammerUtil.cpp | 27 ------- cpp/src/Slice/GrammerUtil.h | 35 ++------- cpp/src/Slice/Makefile | 11 +-- cpp/src/Slice/Parser.cpp | 41 ----------- cpp/src/Slice/slice.dsp | 8 -- cpp/src/slice2cpp/Gen.h | 20 ++--- cpp/src/slice2docbook/Gen.h | 2 +- 31 files changed, 192 insertions(+), 352 deletions(-) delete mode 100644 cpp/src/Ice/Shared.cpp delete mode 100644 cpp/src/Slice/GrammerUtil.cpp (limited to 'cpp/src') diff --git a/cpp/src/Ice/Acceptor.h b/cpp/src/Ice/Acceptor.h index 9c26905334b..bb128910285 100644 --- a/cpp/src/Ice/Acceptor.h +++ b/cpp/src/Ice/Acceptor.h @@ -18,7 +18,7 @@ namespace IceInternal { -class Acceptor : public Shared +class Acceptor : public ::Ice::Shared { public: diff --git a/cpp/src/Ice/Collector.cpp b/cpp/src/Ice/Collector.cpp index bc40066723f..e8eea7c8bfe 100644 --- a/cpp/src/Ice/Collector.cpp +++ b/cpp/src/Ice/Collector.cpp @@ -525,7 +525,8 @@ IceInternal::CollectorFactory::message(Stream&) // // Can't use _collectors.remove_if(constMemFun(...)), because VC++ // doesn't support member templates :-( - _collectors.erase(remove_if(_collectors.begin(), _collectors.end(), constMemFun(&Collector::destroyed)), + _collectors.erase(remove_if(_collectors.begin(), _collectors.end(), + ::IceInternal::constMemFun(&Collector::destroyed)), _collectors.end()); // @@ -635,7 +636,7 @@ IceInternal::CollectorFactory::setState(State state) _threadPool->_register(_acceptor->fd(), this); } - for_each(_collectors.begin(), _collectors.end(), voidMemFun(&Collector::activate)); + for_each(_collectors.begin(), _collectors.end(), ::IceInternal::voidMemFun(&Collector::activate)); break; } @@ -651,7 +652,7 @@ IceInternal::CollectorFactory::setState(State state) _threadPool->unregister(_acceptor->fd()); } - for_each(_collectors.begin(), _collectors.end(), voidMemFun(&Collector::hold)); + for_each(_collectors.begin(), _collectors.end(), ::IceInternal::voidMemFun(&Collector::hold)); break; } @@ -674,7 +675,7 @@ IceInternal::CollectorFactory::setState(State state) _threadPool->unregister(_acceptor->fd()); } } - for_each(_collectors.begin(), _collectors.end(), voidMemFun(&Collector::destroy)); + for_each(_collectors.begin(), _collectors.end(), ::IceInternal::voidMemFun(&Collector::destroy)); _collectors.clear(); break; } diff --git a/cpp/src/Ice/Connector.h b/cpp/src/Ice/Connector.h index 12c6267567c..b5a8f8b34ec 100644 --- a/cpp/src/Ice/Connector.h +++ b/cpp/src/Ice/Connector.h @@ -18,7 +18,7 @@ namespace IceInternal { -class Connector : public Shared +class Connector : public ::Ice::Shared { public: diff --git a/cpp/src/Ice/Emitter.h b/cpp/src/Ice/Emitter.h index f9e261b35fc..5d33c2b173d 100644 --- a/cpp/src/Ice/Emitter.h +++ b/cpp/src/Ice/Emitter.h @@ -88,7 +88,7 @@ private: #endif }; -class EmitterFactory : public Shared, public JTCMutex +class EmitterFactory : public ::Ice::Shared, public JTCMutex { public: diff --git a/cpp/src/Ice/Endpoint.h b/cpp/src/Ice/Endpoint.h index c364099fe2f..ff0ed6b23de 100644 --- a/cpp/src/Ice/Endpoint.h +++ b/cpp/src/Ice/Endpoint.h @@ -28,7 +28,7 @@ const ::Ice::Short TcpEndpointType = 1; const ::Ice::Short SslEndpointType = 2; const ::Ice::Short UdpEndpointType = 3; -class Endpoint : public Shared +class Endpoint : public ::Ice::Shared { public: diff --git a/cpp/src/Ice/EventHandler.h b/cpp/src/Ice/EventHandler.h index 1fea0a0b3a6..2ddfd36d354 100644 --- a/cpp/src/Ice/EventHandler.h +++ b/cpp/src/Ice/EventHandler.h @@ -27,7 +27,7 @@ class LocalException; namespace IceInternal { -class EventHandler : public Shared +class EventHandler : public ::Ice::Shared { public: diff --git a/cpp/src/Ice/Instance.h b/cpp/src/Ice/Instance.h index 6548e9eb36a..841c3dc98ea 100644 --- a/cpp/src/Ice/Instance.h +++ b/cpp/src/Ice/Instance.h @@ -34,7 +34,7 @@ class CommunicatorI; namespace IceInternal { -class Instance : public Shared, public JTCMutex +class Instance : public ::Ice::Shared, public JTCMutex { public: diff --git a/cpp/src/Ice/Makefile b/cpp/src/Ice/Makefile index 803238f7b97..00e48fa048e 100644 --- a/cpp/src/Ice/Makefile +++ b/cpp/src/Ice/Makefile @@ -18,8 +18,7 @@ VERSIONED_NAME = $(top_srcdir)/lib/$(VERSIONED_BASE) TARGETS = $(NAME) $(VERSIONED_NAME) -OBJS = Shared.o \ - Stream.o \ +OBJS = Stream.o \ LocalException.o \ Pickler.o \ PicklerI.o \ diff --git a/cpp/src/Ice/ObjectAdapterFactory.cpp b/cpp/src/Ice/ObjectAdapterFactory.cpp index 0df7b32816f..f0f520b737c 100644 --- a/cpp/src/Ice/ObjectAdapterFactory.cpp +++ b/cpp/src/Ice/ObjectAdapterFactory.cpp @@ -26,7 +26,8 @@ void IceInternal::ObjectAdapterFactory::shutdown() { JTCSyncT sync(*this); - for_each(_adapters.begin(), _adapters.end(), secondVoidMemFun(&ObjectAdapter::deactivate)); + for_each(_adapters.begin(), _adapters.end(), + ::IceInternal::secondVoidMemFun(&ObjectAdapter::deactivate)); _adapters.clear(); } diff --git a/cpp/src/Ice/ObjectAdapterFactory.h b/cpp/src/Ice/ObjectAdapterFactory.h index d8f9e394ad4..6507a92fc9d 100644 --- a/cpp/src/Ice/ObjectAdapterFactory.h +++ b/cpp/src/Ice/ObjectAdapterFactory.h @@ -22,7 +22,7 @@ namespace IceInternal { -class ObjectAdapterFactory : public Shared, public JTCMutex +class ObjectAdapterFactory : public ::Ice::Shared, public JTCMutex { public: diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp index 468293b242c..4549106a002 100644 --- a/cpp/src/Ice/ObjectAdapterI.cpp +++ b/cpp/src/Ice/ObjectAdapterI.cpp @@ -53,7 +53,7 @@ Ice::ObjectAdapterI::activate() } for_each(_collectorFactories.begin(), _collectorFactories.end(), - voidMemFun(& ::IceInternal::CollectorFactory::activate)); + ::IceInternal::voidMemFun(& ::IceInternal::CollectorFactory::activate)); } void @@ -67,7 +67,7 @@ Ice::ObjectAdapterI::hold() } for_each(_collectorFactories.begin(), _collectorFactories.end(), - voidMemFun(& ::IceInternal::CollectorFactory::hold)); + ::IceInternal::voidMemFun(& ::IceInternal::CollectorFactory::hold)); } void @@ -81,7 +81,7 @@ Ice::ObjectAdapterI::deactivate() } for_each(_collectorFactories.begin(), _collectorFactories.end(), - voidMemFun(& ::IceInternal::CollectorFactory::destroy)); + ::IceInternal::voidMemFun(& ::IceInternal::CollectorFactory::destroy)); _collectorFactories.clear(); _objects.clear(); } @@ -240,7 +240,7 @@ Ice::ObjectAdapterI::identityToProxy(const string& ident) vector endpoints; transform(_collectorFactories.begin(), _collectorFactories.end(), back_inserter(endpoints), - constMemFun(&CollectorFactory::endpoint)); + ::IceInternal::constMemFun(&CollectorFactory::endpoint)); ReferencePtr reference = new Reference(_instance, ident, Reference::ModeTwoway, false, endpoints, endpoints); return _instance->proxyFactory()->referenceToProxy(reference); diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index f80f0a17eed..87643fd767a 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -88,7 +88,7 @@ IceProxy::Ice::Object::_isA(const string& s) { try { - Handle< ::IceDelegate::Ice::Object> __del = __getDelegate(); + ::IceInternal::Handle< ::IceDelegate::Ice::Object> __del = __getDelegate(); return __del->_isA(s); } catch (const LocationForward& __ex) @@ -114,7 +114,7 @@ IceProxy::Ice::Object::_ping() { try { - Handle< ::IceDelegate::Ice::Object> __del = __getDelegate(); + ::IceInternal::Handle< ::IceDelegate::Ice::Object> __del = __getDelegate(); __del->_ping(); return; } @@ -136,7 +136,7 @@ IceProxy::Ice::Object::_ping() void IceProxy::Ice::Object::_flush() { - Handle< ::IceDelegate::Ice::Object> __del = __getDelegate(); + ::IceInternal::Handle< ::IceDelegate::Ice::Object> __del = __getDelegate(); __del->_flush(); } @@ -409,7 +409,7 @@ IceProxy::Ice::Object::~Object() { } -Handle< ::IceDelegate::Ice::Object> +::IceInternal::Handle< ::IceDelegate::Ice::Object> IceProxy::Ice::Object::__getDelegate() { JTCSyncT sync(*this); @@ -432,10 +432,10 @@ IceProxy::Ice::Object::__getDelegate() return _delegate; } -Handle< ::IceDelegateM::Ice::Object> +::IceInternal::Handle< ::IceDelegateM::Ice::Object> IceProxy::Ice::Object::__createDelegateM() { - return Handle< ::IceDelegateM::Ice::Object>(new ::IceDelegateM::Ice::Object); + return ::IceInternal::Handle< ::IceDelegateM::Ice::Object>(new ::IceDelegateM::Ice::Object); } void @@ -538,7 +538,7 @@ IceDelegateM::Ice::Object::setup(const ReferencePtr& reference) case Reference::ModeBatchOneway: { remove_copy_if(_reference->endpoints.begin(), _reference->endpoints.end(), back_inserter(endpoints), - not1(constMemFun(&Endpoint::regular))); + not1(::IceInternal::constMemFun(&Endpoint::regular))); break; } @@ -546,14 +546,15 @@ IceDelegateM::Ice::Object::setup(const ReferencePtr& reference) case Reference::ModeBatchDatagram: { remove_copy_if(_reference->endpoints.begin(), _reference->endpoints.end(), back_inserter(endpoints), - not1(constMemFun(&Endpoint::datagram))); + not1(::IceInternal::constMemFun(&Endpoint::datagram))); break; } } if (_reference->secure) { - endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), not1(constMemFun(&Endpoint::secure))), + endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), + not1(::IceInternal::constMemFun(&Endpoint::secure))), endpoints.end()); } diff --git a/cpp/src/Ice/ProxyFactory.h b/cpp/src/Ice/ProxyFactory.h index 9d7df5694d7..f2a831ea152 100644 --- a/cpp/src/Ice/ProxyFactory.h +++ b/cpp/src/Ice/ProxyFactory.h @@ -22,7 +22,7 @@ namespace IceInternal class Stream; -class ProxyFactory : public Shared +class ProxyFactory : public ::Ice::Shared { public: diff --git a/cpp/src/Ice/Reference.h b/cpp/src/Ice/Reference.h index 865477a822f..f5330ff68e5 100644 --- a/cpp/src/Ice/Reference.h +++ b/cpp/src/Ice/Reference.h @@ -21,7 +21,7 @@ namespace IceInternal class Stream; -class Reference : public Shared +class Reference : public ::Ice::Shared { public: diff --git a/cpp/src/Ice/Shared.cpp b/cpp/src/Ice/Shared.cpp deleted file mode 100644 index 12f3bb88501..00000000000 --- a/cpp/src/Ice/Shared.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2001 -// MutableRealms, Inc. -// Huntsville, AL, USA -// -// All Rights Reserved -// -// ********************************************************************** - -#include - -using namespace std; -using namespace Ice; -using namespace IceInternal; - -//static int simpleDebugCounter = 0; -//static int debugCounter = 0; -//static JTCMutex debugCounterMutex; - -IceInternal::SimpleShared::SimpleShared() : - _ref(0), - _noDelete(false) -{ -// cout << "new SimpleShared: " << ++simpleDebugCounter << endl; -} - -IceInternal::SimpleShared::~SimpleShared() -{ -// cout << "delete SimpleShared: " << --simpleDebugCounter << endl; -} - -IceInternal::Shared::Shared() : - _ref(0), - _noDelete(false) -{ -// JTCSyncT sync(debugCounterMutex); -// cout << "new Shared: " << ++debugCounter << endl; -} - -IceInternal::Shared::~Shared() -{ -// JTCSyncT sync(debugCounterMutex); -// cout << "delete Shared: " << --debugCounter << endl; -} diff --git a/cpp/src/Ice/ThreadPool.h b/cpp/src/Ice/ThreadPool.h index 0c649acedbd..cee7779c223 100644 --- a/cpp/src/Ice/ThreadPool.h +++ b/cpp/src/Ice/ThreadPool.h @@ -22,7 +22,7 @@ namespace IceInternal class Stream; -class ThreadPool : public Shared, public JTCMonitorT +class ThreadPool : public ::Ice::Shared, public JTCMonitorT { public: diff --git a/cpp/src/Ice/TraceLevels.h b/cpp/src/Ice/TraceLevels.h index f30e5442e77..b764e93ac03 100644 --- a/cpp/src/Ice/TraceLevels.h +++ b/cpp/src/Ice/TraceLevels.h @@ -18,7 +18,7 @@ namespace IceInternal { -class TraceLevels : public Shared +class TraceLevels : public ::Ice::Shared { public: diff --git a/cpp/src/Ice/Transceiver.h b/cpp/src/Ice/Transceiver.h index dc1b292034d..89460b12288 100644 --- a/cpp/src/Ice/Transceiver.h +++ b/cpp/src/Ice/Transceiver.h @@ -19,7 +19,7 @@ namespace IceInternal class Buffer; -class Transceiver : public Shared +class Transceiver : public ::Ice::Shared { public: diff --git a/cpp/src/Ice/ValueFactoryManager.h b/cpp/src/Ice/ValueFactoryManager.h index 1246b866477..5f23e6e3611 100644 --- a/cpp/src/Ice/ValueFactoryManager.h +++ b/cpp/src/Ice/ValueFactoryManager.h @@ -19,7 +19,7 @@ namespace IceInternal { -class ValueFactoryManager : public Shared, public JTCMutex +class ValueFactoryManager : public ::Ice::Shared, public JTCMutex { public: diff --git a/cpp/src/Ice/ice.dsp b/cpp/src/Ice/ice.dsp index 5fa32da7baa..8fadf57fcaa 100644 --- a/cpp/src/Ice/ice.dsp +++ b/cpp/src/Ice/ice.dsp @@ -210,10 +210,6 @@ SOURCE=.\Reference.cpp # End Source File # Begin Source File -SOURCE=.\Shared.cpp -# End Source File -# Begin Source File - SOURCE=.\SslAcceptor.cpp # End Source File # Begin Source File diff --git a/cpp/src/IcePack/Grammer.y b/cpp/src/IcePack/Grammer.y index 8dfef955e99..8eb904530fa 100644 --- a/cpp/src/IcePack/Grammer.y +++ b/cpp/src/IcePack/Grammer.y @@ -25,6 +25,8 @@ yyerror(const char* s) %} +%pure_parser + %token ICE_PACK_STRING %token ICE_PACK_EXIT %token ICE_PACK_ADD diff --git a/cpp/src/IcePack/Parser.cpp b/cpp/src/IcePack/Parser.cpp index da7cb9be577..a9d26ecbab4 100644 --- a/cpp/src/IcePack/Parser.cpp +++ b/cpp/src/IcePack/Parser.cpp @@ -17,12 +17,16 @@ # define fileno _fileno #endif +#ifdef HAVE_READLINE +# include +# include +#endif + using namespace std; using namespace Ice; using namespace IcePack; extern FILE* yyin; -extern const char* yycommands; namespace IcePack { @@ -139,6 +143,98 @@ IcePack::Parser::shutdown() } } +void +IcePack::Parser::getInput(char* buf, int result, int maxSize) +{ + if (_commands) + { + if (strcmp(_commands, ";") == 0) + { + buf[0] = EOF; + result = 1; + } + else + { + result = strlen(_commands); + if (result >= maxSize) + { + error("fatal error in flex scanner: command line too long"); + buf[0] = EOF; + result = 1; + } + else + { + strcpy(buf, _commands); + _commands = ";"; + } + } + } + else if (isatty(fileno(yyin))) + { +#ifdef HAVE_READLINE + + char* line = readline(parser->getPrompt()); + if (line && *line) + { + add_history(line); + } + if (!line) + { + buf[0] = EOF; + result = 1; + } + else + { + result = strlen(line) + 1; + if (result >= maxSize) + { + free(line); + error("fatal error in flex scanner: input line too long"); + buf[0] = EOF; + result = 1; + } + else + { + strcpy(buf, line); + strcat(buf, "\n"); + free(line); + } + } + +#else + + cout << parser->getPrompt() << flush; + int c = '*'; + int n; + for (n = 0; n < maxSize && (c = getc(yyin)) != EOF && c != '\n'; ++n) + { + buf[n] = static_cast(c); + } + if (c == '\n') + { + buf[n++] = static_cast(c); + } + if (c == EOF && ferror(yyin)) + { + error("input in flex scanner failed"); + buf[0] = EOF; + result = 1; + } + result = n; + +#endif + } + else + { + if (((result = fread(buf, 1, maxSize, yyin)) == 0) && ferror(yyin)) + { + error("input in flex scanner failed"); + buf[0] = EOF; + result = 1; + } + } +} + void IcePack::Parser::nextLine() { @@ -154,7 +250,7 @@ IcePack::Parser::continueLine() char* IcePack::Parser::getPrompt() { - assert(!yycommands && isatty(fileno(yyin))); + assert(!_commands && isatty(fileno(yyin))); if (_continue) { @@ -214,7 +310,7 @@ IcePack::Parser::scanPosition(const char* s) void IcePack::Parser::error(const char* s) { - if (!yycommands && !isatty(fileno(yyin))) + if (!_commands && !isatty(fileno(yyin))) { cerr << _currentFile << ':' << _currentLine << ": " << s << endl; } @@ -222,7 +318,7 @@ IcePack::Parser::error(const char* s) { cerr << "error: " << s << endl; } - yynerrs++; + _errors++; } void @@ -234,7 +330,7 @@ IcePack::Parser::error(const string& s) void IcePack::Parser::warning(const char* s) { - if (!yycommands && !isatty(fileno(yyin))) + if (!_commands && !isatty(fileno(yyin))) { cerr << _currentFile << ':' << _currentLine << ": warning: " << s << endl; } @@ -259,8 +355,9 @@ IcePack::Parser::parse(FILE* file, bool debug) assert(!parser); parser = this; + _errors = 0; + _commands = 0; yyin = file; - yycommands = 0; _currentFile = ""; _currentLine = 0; @@ -268,6 +365,10 @@ IcePack::Parser::parse(FILE* file, bool debug) nextLine(); int status = yyparse(); + if (_errors) + { + status = EXIT_FAILURE; + } parser = 0; return status; @@ -282,8 +383,9 @@ IcePack::Parser::parse(const std::string& commands, bool debug) assert(!parser); parser = this; + _errors = 0; + _commands = commands.c_str(); yyin = 0; - yycommands = commands.c_str(); _currentFile = ""; _currentLine = 0; @@ -291,6 +393,10 @@ IcePack::Parser::parse(const std::string& commands, bool debug) nextLine(); int status = yyparse(); + if (_errors) + { + status = EXIT_FAILURE; + } parser = 0; return status; diff --git a/cpp/src/IcePack/Parser.h b/cpp/src/IcePack/Parser.h index 42282a010c2..d957978dd1b 100644 --- a/cpp/src/IcePack/Parser.h +++ b/cpp/src/IcePack/Parser.h @@ -14,12 +14,24 @@ #include #include -#define YYSTYPE std::list - -extern int yynerrs; +// +// Stuff for flex and bison +// +#define YYSTYPE std::list +#define YY_DECL int yylex(YYSTYPE* yylvalp) +YY_DECL; int yyparse(); -int yylex(); + +// +// I must set the initial stack depth to the maximum stack depth to +// disable bison stack resizing. The bison stack resizing routines use +// simple malloc/alloc/memcpy calls, which do not work for the +// YYSTYPE, since YYSTYPE is a C++ type, with constructor, destructor, +// assignment operator, etc. +// +#define YYMAXDEPTH 20000 // 20000 should suffice. Bison default is 10000 as maximum. +#define YYINITDEPTH YYMAXDEPTH // Initial depth is set to max depth, for the reasons described above. namespace IcePack { @@ -57,6 +69,7 @@ public: void getAll(); void shutdown(); + void getInput(char*, int, int); void nextLine(); void continueLine(); char* getPrompt(); @@ -75,9 +88,11 @@ private: Parser(const Ice::CommunicatorPtr&, const IcePack::AdminPrx&); + const char* _commands; Ice::CommunicatorPtr _communicator; IcePack::AdminPrx _admin; bool _continue; + int _errors; int _currentLine; std::string _currentFile; }; diff --git a/cpp/src/IcePack/Scanner.l b/cpp/src/IcePack/Scanner.l index b5cb5519df2..9fe7335714c 100644 --- a/cpp/src/IcePack/Scanner.l +++ b/cpp/src/IcePack/Scanner.l @@ -14,139 +14,11 @@ #include #include -#ifdef WIN32 -# include -# define isatty _isatty -# define fileno _fileno -// '_isatty' : inconsistent dll linkage. dllexport assumed. -# pragma warning( disable : 4273 ) -#endif - using namespace std; using namespace Ice; using namespace IcePack; -const char* yycommands; - -#ifdef HAVE_READLINE - -# include -# include - -# define YY_INPUT(buf, result, maxSize) \ -\ -if (yycommands) \ -{ \ - if (strcmp(yycommands, ";") == 0) \ - { \ - buf[0] = EOF; \ - result = 1; \ - } \ - else \ - { \ - result = strlen(yycommands); \ - if (result >= maxSize) \ - { \ - YY_FATAL_ERROR("fatal error in flex scanner: command line too long"); \ - } \ - else \ - { \ - strcpy(buf, yycommands); \ - yycommands = ";"; \ - } \ - }\ -} \ -else if (yy_current_buffer->yy_is_interactive) \ -{ \ - char* line = readline(parser->getPrompt()); \ - if (line && *line) \ - { \ - add_history(line); \ - } \ - if (!line) \ - { \ - buf[0] = EOF; \ - result = 1; \ - } \ - else \ - { \ - result = strlen(line) + 1; \ - if (result >= maxSize) \ - { \ - free(line); \ - YY_FATAL_ERROR("fatal error in flex scanner: input line too long"); \ - } \ - else \ - { \ - strcpy(buf, line); \ - strcat(buf, "\n"); \ - free(line); \ - } \ - } \ -} \ -else \ -{ \ - if (((result = fread(buf, 1, maxSize, yyin)) == 0) && ferror(yyin)) \ - { \ - YY_FATAL_ERROR("input in flex scanner failed"); \ - } \ -} - -#else - -# define YY_INPUT(buf, result, maxSize) \ -\ -if (yycommands) \ -{ \ - if (strcmp(yycommands, ";") == 0) \ - { \ - buf[0] = EOF; \ - result = 1; \ - } \ - else \ - { \ - result = strlen(yycommands); \ - if (result >= maxSize) \ - { \ - YY_FATAL_ERROR("fatal error in flex scanner: command line too long"); \ - } \ - else \ - { \ - strcpy(buf, yycommands); \ - yycommands = ";"; \ - } \ - }\ -} \ -else if (yy_current_buffer->yy_is_interactive) \ -{ \ - if (isatty(fileno(yyin))) \ - { \ - cout << parser->getPrompt() << flush; \ - } \ - int c = '*', n; \ - for (n = 0; n < maxSize && (c = getc(yyin)) != EOF && c != '\n'; ++n ) \ - { \ - buf[n] = (char)c; \ - } \ - if (c == '\n') \ - { \ - buf[n++] = (char)c; \ - } \ - if (c == EOF && ferror(yyin)) \ - { \ - YY_FATAL_ERROR("input in flex scanner failed"); \ - } \ - result = n; \ -} \ -else \ -{ \ - if (((result = fread(buf, 1, maxSize, yyin)) == 0) && ferror(yyin)) \ - { \ - YY_FATAL_ERROR("input in flex scanner failed"); \ - } \ -} - -#endif +#define YY_INPUT(buf, result, maxSize) parser->getInput(buf, result, maxSize) %} @@ -293,8 +165,8 @@ L [a-zA-Z_] s += c; } } - yylval.clear(); - yylval.push_back(s); + yylvalp->clear(); + yylvalp->push_back(s); return ICE_PACK_STRING; } @@ -323,8 +195,8 @@ L [a-zA-Z_] s += c; } } - yylval.clear(); - yylval.push_back(s); + yylvalp->clear(); + yylvalp->push_back(s); return ICE_PACK_STRING; } diff --git a/cpp/src/Slice/GrammerUtil.cpp b/cpp/src/Slice/GrammerUtil.cpp deleted file mode 100644 index a27c390f169..00000000000 --- a/cpp/src/Slice/GrammerUtil.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2001 -// MutableRealms, Inc. -// Huntsville, AL, USA -// -// All Rights Reserved -// -// ********************************************************************** - -#include - -using namespace std; -using namespace Slice; - -void IceInternal::incRef(StringTok* p) { p->__incRef(); } -void IceInternal::decRef(StringTok* p) { p->__decRef(); } -void IceInternal::incRef(TypeStringListTok* p) { p->__incRef(); } -void IceInternal::decRef(TypeStringListTok* p) { p->__decRef(); } -void IceInternal::incRef(StringListTok* p) { p->__incRef(); } -void IceInternal::decRef(StringListTok* p) { p->__decRef(); } -void IceInternal::incRef(BoolTok* p) { p->__incRef(); } -void IceInternal::decRef(BoolTok* p) { p->__decRef(); } -void IceInternal::incRef(TypeListTok* p) { p->__incRef(); } -void IceInternal::decRef(TypeListTok* p) { p->__decRef(); } -void IceInternal::incRef(ClassListTok* p) { p->__incRef(); } -void IceInternal::decRef(ClassListTok* p) { p->__decRef(); } diff --git a/cpp/src/Slice/GrammerUtil.h b/cpp/src/Slice/GrammerUtil.h index 258955dc1cb..7dc3c54a008 100644 --- a/cpp/src/Slice/GrammerUtil.h +++ b/cpp/src/Slice/GrammerUtil.h @@ -23,35 +23,12 @@ class BoolTok; class TypeListTok; class ClassListTok; -} - -namespace IceInternal -{ - -void ICE_API incRef(::Slice::StringTok*); -void ICE_API decRef(::Slice::StringTok*); -void ICE_API incRef(::Slice::TypeStringListTok*); -void ICE_API decRef(::Slice::TypeStringListTok*); -void ICE_API incRef(::Slice::StringListTok*); -void ICE_API decRef(::Slice::StringListTok*); -void ICE_API incRef(::Slice::BoolTok*); -void ICE_API decRef(::Slice::BoolTok*); -void ICE_API incRef(::Slice::TypeListTok*); -void ICE_API decRef(::Slice::TypeListTok*); -void ICE_API incRef(::Slice::ClassListTok*); -void ICE_API decRef(::Slice::ClassListTok*); - -} - -namespace Slice -{ - -typedef ::IceInternal::Handle StringTokPtr; -typedef ::IceInternal::Handle TypeStringListTokPtr; -typedef ::IceInternal::Handle StringListTokPtr; -typedef ::IceInternal::Handle BoolTokPtr; -typedef ::IceInternal::Handle TypeListTokPtr; -typedef ::IceInternal::Handle ClassListTokPtr; +typedef ::Ice::Handle StringTokPtr; +typedef ::Ice::Handle TypeStringListTokPtr; +typedef ::Ice::Handle StringListTokPtr; +typedef ::Ice::Handle BoolTokPtr; +typedef ::Ice::Handle TypeListTokPtr; +typedef ::Ice::Handle ClassListTokPtr; } diff --git a/cpp/src/Slice/Makefile b/cpp/src/Slice/Makefile index 7c08096d7c1..950b45e91a4 100644 --- a/cpp/src/Slice/Makefile +++ b/cpp/src/Slice/Makefile @@ -18,10 +18,8 @@ VERSIONED_NAME = $(top_srcdir)/lib/$(VERSIONED_BASE) TARGETS = $(NAME) $(VERSIONED_NAME) -OBJS = Shared.o \ - Scanner.o \ +OBJS = Scanner.o \ Grammer.o \ - GrammerUtil.o \ Parser.o \ OutputUtil.o @@ -52,11 +50,4 @@ clean:: -rm -f Grammer.cpp Grammer.h Grammer.output -rm -f Scanner.cpp lex.yy.c -Shared.cpp: ../Ice/Shared.cpp - rm -f $@ - ln -s ../Ice/Shared.cpp $@ - -clean:: - -rm -f Shared.cpp - include .depend diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 856c60026b5..bc4c20fef7e 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -21,47 +21,6 @@ Unit* unit; } -void IceInternal::incRef(GrammerBase* p) { p->__incRef(); } -void IceInternal::decRef(GrammerBase* p) { p->__decRef(); } -void IceInternal::incRef(SyntaxTreeBase* p) { p->__incRef(); } -void IceInternal::decRef(SyntaxTreeBase* p) { p->__decRef(); } -void IceInternal::incRef(Type* p) { p->__incRef(); } -void IceInternal::decRef(Type* p) { p->__decRef(); } -void IceInternal::incRef(Builtin* p) { p->__incRef(); } -void IceInternal::decRef(Builtin* p) { p->__decRef(); } -void IceInternal::incRef(Contained* p) { p->__incRef(); } -void IceInternal::decRef(Contained* p) { p->__decRef(); } -void IceInternal::incRef(Container* p) { p->__incRef(); } -void IceInternal::decRef(Container* p) { p->__decRef(); } -void IceInternal::incRef(Module* p) { p->__incRef(); } -void IceInternal::decRef(Module* p) { p->__decRef(); } -void IceInternal::incRef(Constructed* p) { p->__incRef(); } -void IceInternal::decRef(Constructed* p) { p->__decRef(); } -void IceInternal::incRef(ClassDecl* p) { p->__incRef(); } -void IceInternal::decRef(ClassDecl* p) { p->__decRef(); } -void IceInternal::incRef(ClassDef* p) { p->__incRef(); } -void IceInternal::decRef(ClassDef* p) { p->__decRef(); } -void IceInternal::incRef(Proxy* p) { p->__incRef(); } -void IceInternal::decRef(Proxy* p) { p->__decRef(); } -void IceInternal::incRef(Struct* p) { p->__incRef(); } -void IceInternal::decRef(Struct* p) { p->__decRef(); } -void IceInternal::incRef(Operation* p) { p->__incRef(); } -void IceInternal::decRef(Operation* p) { p->__decRef(); } -void IceInternal::incRef(DataMember* p) { p->__incRef(); } -void IceInternal::decRef(DataMember* p) { p->__decRef(); } -void IceInternal::incRef(Sequence* p) { p->__incRef(); } -void IceInternal::decRef(Sequence* p) { p->__decRef(); } -void IceInternal::incRef(Dictionary* p) { p->__incRef(); } -void IceInternal::decRef(Dictionary* p) { p->__decRef(); } -void IceInternal::incRef(Enum* p) { p->__incRef(); } -void IceInternal::decRef(Enum* p) { p->__decRef(); } -void IceInternal::incRef(Enumerator* p) { p->__incRef(); } -void IceInternal::decRef(Enumerator* p) { p->__decRef(); } -void IceInternal::incRef(Native* p) { p->__incRef(); } -void IceInternal::decRef(Native* p) { p->__decRef(); } -void IceInternal::incRef(Unit* p) { p->__incRef(); } -void IceInternal::decRef(Unit* p) { p->__decRef(); } - // ---------------------------------------------------------------------- // SyntaxTreeBase // ---------------------------------------------------------------------- diff --git a/cpp/src/Slice/slice.dsp b/cpp/src/Slice/slice.dsp index fbc63c2948c..9b3c090d983 100644 --- a/cpp/src/Slice/slice.dsp +++ b/cpp/src/Slice/slice.dsp @@ -106,10 +106,6 @@ SOURCE=.\Grammer.cpp # End Source File # Begin Source File -SOURCE=.\GrammerUtil.cpp -# End Source File -# Begin Source File - SOURCE=.\OutputUtil.cpp # End Source File # Begin Source File @@ -120,10 +116,6 @@ SOURCE=.\Parser.cpp SOURCE=.\Scanner.cpp # End Source File -# Begin Source File - -SOURCE=..\Ice\Shared.cpp -# End Source File # End Group # Begin Group "Header Files" diff --git a/cpp/src/slice2cpp/Gen.h b/cpp/src/slice2cpp/Gen.h index 77002b264a3..18a62288adc 100644 --- a/cpp/src/slice2cpp/Gen.h +++ b/cpp/src/slice2cpp/Gen.h @@ -17,7 +17,7 @@ namespace Slice { -class Gen : ::IceInternal::noncopyable +class Gen : public ::Ice::noncopyable { public: @@ -45,7 +45,7 @@ private: std::vector _includePaths; std::string _dllExport; - class TypesVisitor : ::IceInternal::noncopyable, public ParserVisitor + class TypesVisitor : public ::Ice::noncopyable, public ParserVisitor { public: @@ -66,7 +66,7 @@ private: std::string _dllExport; }; - class ProxyDeclVisitor : ::IceInternal::noncopyable, public ParserVisitor + class ProxyDeclVisitor : public ::Ice::noncopyable, public ParserVisitor { public: @@ -86,7 +86,7 @@ private: std::string _dllExport; }; - class ProxyVisitor : ::IceInternal::noncopyable, public ParserVisitor + class ProxyVisitor : public ::Ice::noncopyable, public ParserVisitor { public: @@ -108,7 +108,7 @@ private: std::string _dllExport; }; - class DelegateVisitor : ::IceInternal::noncopyable, public ParserVisitor + class DelegateVisitor : public ::Ice::noncopyable, public ParserVisitor { public: @@ -130,7 +130,7 @@ private: std::string _dllExport; }; - class DelegateMVisitor : ::IceInternal::noncopyable, public ParserVisitor + class DelegateMVisitor : public ::Ice::noncopyable, public ParserVisitor { public: @@ -152,7 +152,7 @@ private: std::string _dllExport; }; - class ObjectDeclVisitor : ::IceInternal::noncopyable, public ParserVisitor + class ObjectDeclVisitor : public ::Ice::noncopyable, public ParserVisitor { public: @@ -170,7 +170,7 @@ private: std::string _dllExport; }; - class ObjectVisitor : ::IceInternal::noncopyable, public ParserVisitor + class ObjectVisitor : public ::Ice::noncopyable, public ParserVisitor { public: @@ -191,7 +191,7 @@ private: std::string _dllExport; }; - class IceVisitor : ::IceInternal::noncopyable, public ParserVisitor + class IceVisitor : public ::Ice::noncopyable, public ParserVisitor { public: @@ -210,7 +210,7 @@ private: std::string _dllExport; }; - class HandleVisitor : ::IceInternal::noncopyable, public ParserVisitor + class HandleVisitor : public ::Ice::noncopyable, public ParserVisitor { public: diff --git a/cpp/src/slice2docbook/Gen.h b/cpp/src/slice2docbook/Gen.h index 86fcc9c881f..88db0e266ba 100644 --- a/cpp/src/slice2docbook/Gen.h +++ b/cpp/src/slice2docbook/Gen.h @@ -18,7 +18,7 @@ namespace Slice { -class Gen : ::IceInternal::noncopyable, public ParserVisitor +class Gen : public ::Ice::noncopyable, public ParserVisitor { public: -- cgit v1.2.3