]> git.lyx.org Git - features.git/blobdiff - src/mathed/math_factory.C
change "support/std_sstream.h" to <sstream>
[features.git] / src / mathed / math_factory.C
index cc76614ab5e029c211a3ab5902fb989d929f50fa..3da237bd528201a84c1ce5488fa569ef598c94d4 100644 (file)
@@ -37,6 +37,7 @@
 #include "math_makeboxinset.h"
 #include "math_oversetinset.h"
 #include "math_parboxinset.h"
+#include "math_parser.h"
 #include "math_rootinset.h"
 #include "math_sizeinset.h"
 #include "math_spaceinset.h"
 #include "debug.h"
 #include "math_support.h"
 
-#include "support/std_sstream.h"
 #include "support/filetools.h" // LibFileSearch
 #include "support/lstrings.h"
 
 #include "frontends/lyx_gui.h"
 
 #include <fstream>
+#include <sstream>
 
 using lyx::support::LibFileSearch;
 using lyx::support::split;
@@ -139,9 +140,8 @@ void initSymbols()
 
                // special case of pre-defined macros
                if (line.size() > 8 && line.substr(0, 5) == "\\def\\") {
-                       //lyxerr << "defining: '" << line << '\'' << endl;
-                       istringstream is(line);
-                       MathMacroTable::create(MathAtom(new MathMacroTemplate(is)));
+                       //lyxerr << "macro definition: '" << line << '\'' << endl;
+                       MacroTable::globalMacros().insert(line);
                        continue;
                }
 
@@ -218,6 +218,7 @@ void initMath()
 {
        static bool initialized = false;
        if (!initialized) {
+               initParser();
                initSymbols();
                initialized = true;
        }
@@ -235,7 +236,7 @@ latexkeys const * in_word_set(string const & str)
 
 MathAtom createMathInset(string const & s)
 {
-       //lyxerr << "creating inset with name: '" << s << '\'' << endl;;
+       //lyxerr << "creating inset with name: '" << s << '\'' << endl;
        latexkeys const * l = in_word_set(s);
        if (l) {
                string const & inset = l->inset;
@@ -319,10 +320,13 @@ MathAtom createMathInset(string const & s)
        if (s == "dfrac")
                return MathAtom(new MathDfracInset);
 
-       if (MathMacroTable::has(s))
-               return MathAtom(new MathMacro(s));
+       if (MacroTable::globalMacros().has(s))
+               return MathAtom(new MathMacro(s,
+                       MacroTable::globalMacros().get(s).numargs()));
+       //if (MacroTable::localMacros().has(s))
+       //      return MathAtom(new MathMacro(s,
+       //              MacroTable::localMacros().get(s).numargs()));
 
-       //lyxerr << "creating inset 2 with name: '" << s << '\'' << endl;
        return MathAtom(new MathUnknownInset(s));
 }