[orbitcpp-list] Re: orbitcpp-list digest, Vol 1 #203 - 1 msg
Status: Beta
Brought to you by:
philipd
From: Kuba <kp...@po...> - 2001-05-29 06:51:26
|
OK, you are right. The example wasn't precise. Try this (doesn't matter whether using orbit-cpp-0.30 or 0.30.1): file1.idl module A { interface Empty { }; }; file2.idl #include <file1.idl> module A { struct SomeStruct { string SomeString; }; interface NotEmpty : Empty { void SomeFunction (in SomeStruct inParam); }; }; Put both files into the same directory and compile: orbit-idl -l c++ -I. file2.idl Here is the patch (thanks for diff options hint!): ------------------------------------------------------------ diff -u -b -B -w compiler/language.cc compiler.new/language.cc --- compiler/language.cc Fri Apr 6 11:41:42 2001 +++ compiler.new/language.cc Sun Apr 22 00:05:24 2001 @@ -275,15 +275,20 @@ string::size_type first = 0; string::size_type nextscopeq = id.find("::",first); - while (nextscopeq != string::npos) { - IDLScope *nextscope = scope->getScope(id.substr(first,nextscopeq-first)); - if (!nextscope) return NULL; - scope = nextscope; - first = nextscopeq + 2; - nextscopeq = id.find("::",first); + if (nextscopeq == string::npos) { + return scope->getItem(id.substr(first)); + } + else { + int spos = 0; + IDLScope *nextscope = NULL; + while ((nextscope = scope->getScope(id.substr(first,nextscopeq-first),spos)) != NULL) { + spos++; + IDLElement* element = nextscope->lookupLocal(id.substr(nextscopeq+2,id.length()-nextscopeq-2)); + if (element != NULL) return element; + } } - return scope->getItem(id.substr(first)); + return NULL; } @@ -318,13 +324,22 @@ IDLScope * -IDLScope::getScope(string const &id) const { +IDLScope::getScope (string const &id, int &spos) const { ScopeList::const_iterator first = m_scopes.begin(),last = m_scopes.end(); + string IDLIdentifier; + int pos_counter = 0; while (first != last) { - if ((*first)->getIDLIdentifier() == id) return *first; + IDLIdentifier = (*first)->getIDLIdentifier(); + if ((*first)->getIDLIdentifier() == id && pos_counter >= spos) { + spos = pos_counter; + return *first; + } + first++; + pos_counter++; } + return NULL; } diff -u -b -B -w compiler/language.hh compiler.new/language.hh --- compiler/language.hh Mon Jan 22 08:44:05 2001 +++ compiler.new/language.hh Sun Apr 22 00:04:43 2001 @@ -129,7 +129,7 @@ IDLElement *getItem(IDL_tree node) const; IDLElement *getItem(string const &id) const; - IDLScope *getScope(string const &id) const; + IDLScope *getScope (string const &id, int &spos) const; IDLScope const *getRootScope() const { if (getParentScope()) return Super::getRootScope(); else return this; ------------------------------------------------------------ -- Kamera wideo Sony, 5000 zl wygraj w konkursie eMarketu i Onet.pl [ http://konkursy.onet.pl/emarket ] |