From: Georg Baum Date: Mon, 17 Dec 2012 20:38:40 +0000 (+0100) Subject: Generate debug output for symbol macros as well X-Git-Tag: 2.1.0beta1~1038 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=6cf364d30e474066bcfb95401870c827ebafe5d9;p=features.git Generate debug output for symbol macros as well This is useful for debugging, and it will enable development/tools/generate_symbols_images.py to generate a few more images. --- diff --git a/src/mathed/MacroTable.cpp b/src/mathed/MacroTable.cpp index 20a713a513..60fd568349 100644 --- a/src/mathed/MacroTable.cpp +++ b/src/mathed/MacroTable.cpp @@ -191,20 +191,28 @@ MacroData const * MacroTable::get(docstring const & name) const } -void MacroTable::insert(docstring const & name, MacroData const & data) +MacroTable::iterator +MacroTable::insert(docstring const & name, MacroData const & data) { //lyxerr << "MacroTable::insert: " << to_utf8(name) << endl; - operator[](name) = data; + iterator it = find(name); + if (it == end()) + it = map::insert( + make_pair(name, data)).first; + else + it->second = data; + return it; } -void MacroTable::insert(Buffer * buf, docstring const & def, string const & requires) +MacroTable::iterator +MacroTable::insert(Buffer * buf, docstring const & def, string const & requires) { //lyxerr << "MacroTable::insert, def: " << to_utf8(def) << endl; MathMacroTemplate mac(buf, def); MacroData data(buf, mac); data.requires() = requires; - insert(mac.name(), data); + return insert(mac.name(), data); } diff --git a/src/mathed/MacroTable.h b/src/mathed/MacroTable.h index 88427d68fd..8b9b38a436 100644 --- a/src/mathed/MacroTable.h +++ b/src/mathed/MacroTable.h @@ -153,9 +153,9 @@ class MacroTable : public std::map { public: /// Parse full "\\def..." or "\\newcommand..." or ... - void insert(Buffer * buf, docstring const & definition, std::string const &); + iterator insert(Buffer * buf, docstring const & definition, std::string const &); /// Insert pre-digested macro definition - void insert(docstring const & name, MacroData const & data); + iterator insert(docstring const & name, MacroData const & data); /// MacroData const * get(docstring const & name) const; /// diff --git a/src/mathed/MathFactory.cpp b/src/mathed/MathFactory.cpp index d41d4558cc..29d9a5f9a4 100644 --- a/src/mathed/MathFactory.cpp +++ b/src/mathed/MathFactory.cpp @@ -151,7 +151,15 @@ void initSymbols() string macro; string requires; is >> macro >> requires; - MacroTable::globalMacros().insert(0, from_utf8(macro), requires); + MacroTable::iterator it = MacroTable::globalMacros().insert( + 0, from_utf8(macro), requires); + // If you change the following output, please adjust + // development/tools/generate_symbols_images.py. + LYXERR(Debug::MATHED, "read symbol '" << to_utf8(it->first) + << " inset: macro" + << " draw: 0" + << " extra: " + << " requires: " << requires << '\''); continue; }