]> git.lyx.org Git - features.git/commitdiff
Generate debug output for symbol macros as well
authorGeorg Baum <baum@lyx.org>
Mon, 17 Dec 2012 20:38:40 +0000 (21:38 +0100)
committerGeorg Baum <baum@lyx.org>
Fri, 28 Dec 2012 12:25:41 +0000 (13:25 +0100)
This is useful for debugging, and it will enable
development/tools/generate_symbols_images.py to generate a few more images.

src/mathed/MacroTable.cpp
src/mathed/MacroTable.h
src/mathed/MathFactory.cpp

index 20a713a513e15e1d3af377282e4cfe63d359cfe5..60fd5683491a79ae60e6854eeda2c98f30466984 100644 (file)
@@ -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<docstring, MacroData>::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);
 }
 
 
index 88427d68fdf5ed7b8b4f596d8e3e9ce8868d09f0..8b9b38a436773e2ea941e76845646ac40cfcb006 100644 (file)
@@ -153,9 +153,9 @@ class MacroTable : public std::map<docstring, MacroData>
 {
 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;
        ///
index d41d4558cc821dd8e20b03ea0045182dbc2a6f00..29d9a5f9a4839db950025e2e3991e2a563d15904 100644 (file)
@@ -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;
                }