X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=blobdiff_plain;f=codegen%2Fmain.cpp;h=bfe12e03098478ae32ce74bf2819c71209bec250;hp=aef6d59ed9c84b7670377040b6388278235bf6ce;hb=ef7b2923fafd73063f2a3fc02e34a5c83f14fc0b;hpb=2f0896ce9a4305c9538917492faf8c78fe7b9b1a diff --git a/codegen/main.cpp b/codegen/main.cpp index aef6d59..bfe12e0 100644 --- a/codegen/main.cpp +++ b/codegen/main.cpp @@ -1,3 +1,22 @@ +/* + Copyright (C) 2006 + intra2net.com + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #include #include #include @@ -87,19 +106,14 @@ std::string get_namespace(const xmlpp::Element* root, const std::string &id) return element->get_attribute("name")->get_value(); } -//! extract group from attributes -std::string -extract_group(const std::string &attrs) +//! procedure marked for export? +bool +is_marked(const std::string &attrs) { // todo: improve this - std::string error; std::string to_match("gccxml(libt2n-"); std::string::size_type p(attrs.find(to_match)); - if (p==std::string::npos) return error; - std::string group(attrs, p+to_match.length(), attrs.length()); - p=group.find_first_of(')'); - assert(p!=std::string::npos); - return std::string(group,0,p); + return (p!=std::string::npos); } struct type_info @@ -241,7 +255,7 @@ protected: // attributes are speparated by spaces? t2n_procedure f; - if (extract_group(attributes->get_value()).empty()) return; + if (!is_marked(attributes->get_value())) return; // we need the return type f.ret_type=get_type(root, returns->get_value());