Index: include/Ice/Object.h =================================================================== RCS file: /home/cvsroot/ice/include/Ice/Object.h,v retrieving revision 1.85 diff -c -r1.85 Object.h *** include/Ice/Object.h 19 Oct 2004 02:24:44 -0000 1.85 --- include/Ice/Object.h 1 Dec 2004 06:49:49 -0000 *************** *** 53,60 **** virtual bool operator<(const Object&) const; virtual ::Ice::Int ice_hash() const; - static const ::std::string __ids[]; - virtual bool ice_isA(const ::std::string&, const Current& = Current()) const; ::IceInternal::DispatchStatus ___ice_isA(::IceInternal::Incoming&, const Current&); --- 53,58 ---- Index: include/Slice/Parser.h =================================================================== RCS file: /home/cvsroot/ice/include/Slice/Parser.h,v retrieving revision 1.95 diff -c -r1.95 Parser.h *** include/Slice/Parser.h 13 Oct 2004 04:44:26 -0000 1.95 --- include/Slice/Parser.h 1 Dec 2004 06:49:49 -0000 *************** *** 320,325 **** --- 320,326 ---- std::string name() const; std::string scoped() const; std::string scope() const; + std::string flattenedScope() const; std::string file() const; std::string line() const; std::string comment() const; Index: src/Ice/Object.cpp =================================================================== RCS file: /home/cvsroot/ice/src/Ice/Object.cpp,v retrieving revision 1.80 diff -c -r1.80 Object.cpp *** src/Ice/Object.cpp 19 Oct 2004 02:24:44 -0000 1.80 --- src/Ice/Object.cpp 1 Dec 2004 06:49:51 -0000 *************** *** 48,54 **** return static_cast(reinterpret_cast(this) >> 4); } ! const string Ice::Object::__ids[] = { "::Ice::Object" }; --- 48,54 ---- return static_cast(reinterpret_cast(this) >> 4); } ! static const string __Ice__Object_ids[] = { "::Ice::Object" }; *************** *** 56,62 **** bool Ice::Object::ice_isA(const string& s, const Current&) const { ! return s == __ids[0]; } void --- 56,62 ---- bool Ice::Object::ice_isA(const string& s, const Current&) const { ! return s == __Ice__Object_ids[0]; } void *************** *** 68,86 **** vector Ice::Object::ice_ids(const Current&) const { ! return vector(&__ids[0], &__ids[1]); } const string& Ice::Object::ice_id(const Current&) const { ! return __ids[0]; } const ::std::string& Ice::Object::ice_staticId() { ! return __ids[0]; } void --- 68,86 ---- vector Ice::Object::ice_ids(const Current&) const { ! return vector(&__Ice__Object_ids[0], &__Ice__Object_ids[1]); } const string& Ice::Object::ice_id(const Current&) const { ! return __Ice__Object_ids[0]; } const ::std::string& Ice::Object::ice_staticId() { ! return __Ice__Object_ids[0]; } void Index: src/Slice/Parser.cpp =================================================================== RCS file: /home/cvsroot/ice/src/Slice/Parser.cpp,v retrieving revision 1.153 diff -c -r1.153 Parser.cpp *** src/Slice/Parser.cpp 4 Nov 2004 22:30:17 -0000 1.153 --- src/Slice/Parser.cpp 1 Dec 2004 06:49:56 -0000 *************** *** 327,332 **** --- 327,344 ---- } string + Slice::Contained::flattenedScope() const + { + string s = scope(); + string flattenedScope; + for(string::const_iterator r = s.begin(); r != s.end(); ++r) + { + flattenedScope += ((*r) == ':') ? '_' : *r; + } + return flattenedScope; + } + + string Slice::Contained::file() const { return _file; Index: src/slice2cpp/Gen.cpp =================================================================== RCS file: /home/cvsroot/ice/src/slice2cpp/Gen.cpp,v retrieving revision 1.242 diff -c -r1.242 Gen.cpp *** src/slice2cpp/Gen.cpp 25 Nov 2004 04:18:33 -0000 1.242 --- src/slice2cpp/Gen.cpp 1 Dec 2004 06:49:58 -0000 *************** *** 409,418 **** } H << nl << "virtual const ::std::string& ice_name() const;"; ! C << sp << nl << "const ::std::string " << scoped.substr(2) << "::_name = \"" << p->scoped().substr(2) << "\";"; C << sp << nl << "const ::std::string&" << nl << scoped.substr(2) << "::ice_name() const"; C << sb; ! C << nl << "return " << scoped << "::_name;"; C << eb; if(p->isLocal()) --- 409,421 ---- } H << nl << "virtual const ::std::string& ice_name() const;"; ! ! string flatName = p->flattenedScope() + p->name() + "_name"; ! ! C << sp << nl << "static const ::std::string " << flatName << " = \"" << p->scoped().substr(2) << "\";"; C << sp << nl << "const ::std::string&" << nl << scoped.substr(2) << "::ice_name() const"; C << sb; ! C << nl << "return " << flatName << ';'; C << eb; if(p->isLocal()) *************** *** 435,446 **** if(!p->isLocal()) { H << sp << nl << "static const ::IceInternal::UserExceptionFactoryPtr& ice_factory();"; - - C << sp << nl << "const ::IceInternal::UserExceptionFactoryPtr&"; - C << nl << scoped.substr(2) << "::ice_factory()"; - C << sb; - C << nl << "return _factory;"; - C << eb; } return true; } --- 438,443 ---- *************** *** 450,468 **** { string name = fixKwd(p->name()); string scope = fixKwd(p->scope()); DataMemberList dataMembers = p->dataMembers(); DataMemberList::const_iterator q; if(!p->isLocal()) { - string flattenedScope; - - for(string::const_iterator r = scope.begin(); r != scope.end(); ++r) - { - flattenedScope += ((*r) == ':') ? '_' : *r; - } - - string scoped = fixKwd(p->scoped()); ExceptionPtr base = p->base(); H << sp << nl << "virtual void __write(::IceInternal::BasicStream*) const;"; --- 447,460 ---- { string name = fixKwd(p->name()); string scope = fixKwd(p->scope()); + string scoped = fixKwd(p->scoped()); DataMemberList dataMembers = p->dataMembers(); DataMemberList::const_iterator q; + string factoryName; + if(!p->isLocal()) { ExceptionPtr base = p->base(); H << sp << nl << "virtual void __write(::IceInternal::BasicStream*) const;"; *************** *** 608,620 **** } } ! string factoryName = "__F" + flattenedScope + name; ! C << sp << nl << "class " << factoryName << " : public ::IceInternal::UserExceptionFactory"; C << sb; - C.dec(); - C << nl << "public:"; - C.inc(); C << sp << nl << "virtual void"; C << nl << "createAndThrow()"; C << sb; --- 600,609 ---- } } ! factoryName = "__F" + p->flattenedScope() + p->name(); ! C << sp << nl << "struct " << factoryName << " : public ::IceInternal::UserExceptionFactory"; C << sb; C << sp << nl << "virtual void"; C << nl << "createAndThrow()"; C << sb; *************** *** 622,629 **** C << eb; C << eb << ';'; ! C << sp << nl << "::IceInternal::UserExceptionFactoryPtr " << scoped.substr(2) << "::_factory = new " ! << factoryName << ';'; C << sp << nl << "class " << factoryName << "__Init"; C << sb; --- 611,624 ---- C << eb; C << eb << ';'; ! C << sp << nl << "static ::IceInternal::UserExceptionFactoryPtr " << factoryName ! << "__Ptr = new " << factoryName << ';'; ! ! C << sp << nl << "const ::IceInternal::UserExceptionFactoryPtr&"; ! C << nl << scoped.substr(2) << "::ice_factory()"; ! C << sb; ! C << nl << "return " << factoryName << "__Ptr;"; ! C << eb; C << sp << nl << "class " << factoryName << "__Init"; C << sb; *************** *** 643,668 **** C << sp << nl << "static " << factoryName << "__Init "<< factoryName << "__i;"; C << sp << nl << "#ifdef __APPLE__"; ! string initfuncname = "__F" + flattenedScope + name + "__initializer"; C << nl << "extern \"C\" { void " << initfuncname << "() {} }"; C << nl << "#endif"; } - - H.dec(); - H << sp << nl << "private:"; - H.inc(); - if(!p->isLocal()) - { - H << sp << nl << "static ::IceInternal::UserExceptionFactoryPtr _factory;"; - } - H << sp << nl << "static const ::std::string _name;"; - H << eb << ';'; if(!p->isLocal()) { ! H << sp << nl << "static " << fixKwd(p->scoped()) << " __" << p->name() << "_init;"; } } bool --- 638,654 ---- C << sp << nl << "static " << factoryName << "__Init "<< factoryName << "__i;"; C << sp << nl << "#ifdef __APPLE__"; ! string initfuncname = "__F" + p->flattenedScope() + p->name() + "__initializer"; C << nl << "extern \"C\" { void " << initfuncname << "() {} }"; C << nl << "#endif"; } H << eb << ';'; if(!p->isLocal()) { ! H << sp << nl << "static " << name << " __" << p->name() << "_init;"; } + } bool *************** *** 2258,2264 **** StringList::const_iterator q; H << sp; - H << nl << "static const ::std::string __ids[" << ids.size() << "];"; H << nl << "virtual bool ice_isA" << "(const ::std::string&, const ::Ice::Current& = ::Ice::Current()) const;"; H << nl << "virtual ::std::vector< ::std::string> ice_ids" --- 2244,2249 ---- *************** *** 2266,2273 **** H << nl << "virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::Current()) const;"; H << nl << "static const ::std::string& ice_staticId();"; C << sp; ! C << nl << "const ::std::string " << fixKwd(p->scoped()).substr(2) << "::__ids[" << ids.size() << "] ="; C << sb; q = ids.begin(); while(q != ids.end()) --- 2251,2260 ---- H << nl << "virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::Current()) const;"; H << nl << "static const ::std::string& ice_staticId();"; + string flatName = p->flattenedScope() + p->name() + "_ids"; + C << sp; ! C << nl << "static const ::std::string " << flatName << '[' << ids.size() << "] ="; C << sb; q = ids.begin(); while(q != ids.end()) *************** *** 2284,2310 **** C << nl << "bool" << nl << fixKwd(p->scoped()).substr(2) << "::ice_isA(const ::std::string& _s, const ::Ice::Current&) const"; C << sb; ! C << nl << "return ::std::binary_search(__ids, __ids + " << ids.size() << ", _s);"; C << eb; C << sp; C << nl << "::std::vector< ::std::string>" << nl << fixKwd(p->scoped()).substr(2) << "::ice_ids(const ::Ice::Current&) const"; C << sb; ! C << nl << "return ::std::vector< ::std::string>(&__ids[0], &__ids[" << ids.size() << "]);"; C << eb; C << sp; C << nl << "const ::std::string&" << nl << fixKwd(p->scoped()).substr(2) << "::ice_id(const ::Ice::Current&) const"; C << sb; ! C << nl << "return __ids[" << scopedPos << "];"; C << eb; C << sp; C << nl << "const ::std::string&" << nl << fixKwd(p->scoped()).substr(2) << "::ice_staticId()"; C << sb; ! C << nl << "return __ids[" << scopedPos << "];"; C << eb; emitGCFunctions(p); --- 2271,2298 ---- C << nl << "bool" << nl << fixKwd(p->scoped()).substr(2) << "::ice_isA(const ::std::string& _s, const ::Ice::Current&) const"; C << sb; ! C << nl << "return ::std::binary_search(" << flatName << ", " << flatName << " + " << ids.size() << ", _s);"; C << eb; C << sp; C << nl << "::std::vector< ::std::string>" << nl << fixKwd(p->scoped()).substr(2) << "::ice_ids(const ::Ice::Current&) const"; C << sb; ! C << nl << "return ::std::vector< ::std::string>(&" << flatName << "[0], &" << flatName ! << '[' << ids.size() << "]);"; C << eb; C << sp; C << nl << "const ::std::string&" << nl << fixKwd(p->scoped()).substr(2) << "::ice_id(const ::Ice::Current&) const"; C << sb; ! C << nl << "return " << flatName << '[' << scopedPos << "];"; C << eb; C << sp; C << nl << "const ::std::string&" << nl << fixKwd(p->scoped()).substr(2) << "::ice_staticId()"; C << sb; ! C << nl << "return " << flatName << '[' << scopedPos << "];"; C << eb; emitGCFunctions(p); *************** *** 2352,2362 **** StringList::const_iterator q; H << sp; - H << nl << "static ::std::string __all[" << allOpNames.size() << "];"; H << nl << "virtual ::IceInternal::DispatchStatus __dispatch(::IceInternal::Incoming&, const ::Ice::Current&);"; C << sp; ! C << nl << "::std::string " << scoped.substr(2) << "::__all[] ="; C << sb; q = allOpNames.begin(); while(q != allOpNames.end()) --- 2340,2351 ---- StringList::const_iterator q; H << sp; H << nl << "virtual ::IceInternal::DispatchStatus __dispatch(::IceInternal::Incoming&, const ::Ice::Current&);"; + + string flatName = p->flattenedScope() + p->name() + "_all"; C << sp; ! C << nl << "static ::std::string " << flatName << "[] ="; C << sb; q = allOpNames.begin(); while(q != allOpNames.end()) *************** *** 2374,2386 **** C << sb; C << nl << "::std::pair< ::std::string*, ::std::string*> r = " ! << "::std::equal_range(__all, __all + " << allOpNames.size() << ", current.operation);"; C << nl << "if(r.first == r.second)"; C << sb; C << nl << "return ::IceInternal::DispatchOperationNotExist;"; C << eb; C << sp; ! C << nl << "switch(r.first - __all)"; C << sb; int i = 0; for(q = allOpNames.begin(); q != allOpNames.end(); ++q) --- 2363,2376 ---- C << sb; C << nl << "::std::pair< ::std::string*, ::std::string*> r = " ! << "::std::equal_range(" << flatName << ", " << flatName << " + " << allOpNames.size() ! << ", current.operation);"; C << nl << "if(r.first == r.second)"; C << sb; C << nl << "return ::IceInternal::DispatchOperationNotExist;"; C << eb; C << sp; ! C << nl << "switch(r.first - " << flatName << ')'; C << sb; int i = 0; for(q = allOpNames.begin(); q != allOpNames.end(); ++q) *************** *** 2522,2536 **** { H << sp << nl << "static const ::Ice::ObjectFactoryPtr& ice_factory();"; ! string flattenedScope; ! ! for(string::const_iterator r = scope.begin(); r != scope.end(); ++r) ! { ! flattenedScope += ((*r) == ':') ? '_' : *r; ! } ! ! string name = fixKwd(p->name()); ! string factoryName = "__F" + flattenedScope + name; C << sp; C << nl << "class " << factoryName << " : public ::Ice::ObjectFactory"; C << sb; --- 2512,2518 ---- { H << sp << nl << "static const ::Ice::ObjectFactoryPtr& ice_factory();"; ! string factoryName = "__F" + p->flattenedScope() + p->name(); C << sp; C << nl << "class " << factoryName << " : public ::Ice::ObjectFactory"; C << sb; *************** *** 2547,2558 **** C << eb; C << eb << ';'; C << sp; ! C << nl << "::Ice::ObjectFactoryPtr " << scoped.substr(2) << "::_factory = new " << factoryName << ';'; C << sp << nl << "const ::Ice::ObjectFactoryPtr&" << nl << scoped.substr(2) << "::ice_factory()"; C << sb; ! C << nl << "return _factory;"; C << eb; C << sp; --- 2529,2541 ---- C << eb; C << eb << ';'; + string flatName = factoryName + "_Ptr"; C << sp; ! C << nl << "static ::Ice::ObjectFactoryPtr " << flatName << " = new " << factoryName << ';'; C << sp << nl << "const ::Ice::ObjectFactoryPtr&" << nl << scoped.substr(2) << "::ice_factory()"; C << sb; ! C << nl << "return " << flatName << ';'; C << eb; C << sp; *************** *** 2575,2588 **** C << sp; C << nl << "static " << factoryName << "__Init " << factoryName << "__i;"; C << sp << nl << "#ifdef __APPLE__"; ! std::string initfuncname = "__F" + flattenedScope + name + "__initializer"; C << nl << "extern \"C\" { void " << initfuncname << "() {} }"; C << nl << "#endif"; - - H.dec(); - H << sp << nl << "private:"; - H.inc(); - H << sp << nl << "static ::Ice::ObjectFactoryPtr _factory;"; } } --- 2558,2566 ---- C << sp; C << nl << "static " << factoryName << "__Init " << factoryName << "__i;"; C << sp << nl << "#ifdef __APPLE__"; ! std::string initfuncname = "__F" + p->flattenedScope() + p->name() + "__initializer"; C << nl << "extern \"C\" { void " << initfuncname << "() {} }"; C << nl << "#endif"; } }