]> git.lyx.org Git - features.git/commitdiff
work around static initialization problem
authorAndré Pönitz <poenitz@gmx.net>
Fri, 27 Jul 2001 12:32:29 +0000 (12:32 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 27 Jul 2001 12:32:29 +0000 (12:32 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2367 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/formulabase.C
src/mathed/math_macrotable.C
src/mathed/math_macrotable.h
src/mathed/math_parser.C

index 8ae66c7cb7a0f8ed3ab8de1acae77602f245cbd8..c81c2ae7b0f76bbe4db73b0638cd33fe7f598d8c 100644 (file)
@@ -39,6 +39,7 @@
 #include "font.h"
 #include "math_arrayinset.h"
 #include "math_spaceinset.h"
+#include "math_macrotable.h"
 #include "support/lyxlib.h"
 #include "mathed/support.h"
 #include "undo_funcs.h"
@@ -125,7 +126,12 @@ MathArrayInset * matrixpar(int & idx)
 
 InsetFormulaBase::InsetFormulaBase(MathInset * par)
        : par_(par)
-{}
+{
+#ifdef WITH_WARNINGS
+#warning This is needed as long the math parser is not re-entrant
+#endif
+       MathMacroTable::builtinMacros();
+}
 
 
 InsetFormulaBase::InsetFormulaBase(InsetFormulaBase const & f)
index c18456063f73c69f00536d36f27f7526d30c9f9f..71a353678911bcf8702cd7b40e92d13fa80e967b 100644 (file)
@@ -101,7 +101,7 @@ void MathMacroTable::builtinMacros()
 
        built = true;
     
-       lyxerr[Debug::MATHED] << "Building macros" << endl;
+       //lyxerr[Debug::MATHED] << "Building macros" << endl;
    
 /* 
        // This macro doesn't have arguments
index 68ea0494768daf60560abc0fd50102ab26251de6..bb4e72598491b754c4a8b5df9dfb85e3ff55abca 100644 (file)
@@ -28,9 +28,9 @@ public:
        static MathMacro * cloneTemplate(string const &);
        ///
        static void createTemplate(string const &, int, string const &);
-private:
        ///
        static void builtinMacros();
+private:
        ///
        typedef std::map<string, MathMacroTemplate *> table_type;
        //
index 1848d7492516d62eac041850646d44996540bfc5..918f4c81d2c37044271de5c8ed4e0889a6d070ac 100644 (file)
@@ -323,7 +323,7 @@ int yylex()
                                        yyis->putback(c);
                                //lyxerr[Debug::MATHED] << "reading: text '" << yytext << "'\n";
                                latexkeys const * l = in_word_set(yytext);
-                               if (!l)
+                               if (!l) 
                                        return LM_TK_UNDEF;
 
                                if (l->token == LM_TK_BEGIN || l->token == LM_TK_END) { 
@@ -511,18 +511,19 @@ void handle_frac(MathArray & array, string const & name)
 
 void mathed_parse(MathArray & array, unsigned flags)
 {
-       int t = yylex();
-       bool panic = false;
        static int plevel = -1;
-       yyvarcode = LM_TC_VAR;
-       
-       int brace  = 0;
-       int limits = 0;
 
        ++plevel;
+       yyvarcode = LM_TC_VAR;
+
+       int  t      = yylex();
+       bool panic  = false;
+       int  brace  = 0;
+       int  limits = 0;
+
        while (t) {
-               //lyxerr << "t: " << t << " flags: " << flags << " i: " << yylval.i << "\n";
-               //      << " plevel: " << plevel << " ";
+               //lyxerr << "t: " << t << " flags: " << flags << " i: " << yylval.i
+               //      << " '" << yytext << "'\n";
                //array.dump(lyxerr);
                //lyxerr << "\n";
 
@@ -753,6 +754,7 @@ void mathed_parse(MathArray & array, unsigned flags)
                
                case LM_TK_UNDEF: 
                        if (MathMacroTable::hasTemplate(yytext)) {
+                               lyxerr << "@@@ Found macro!\n";
                                MathMacro * m = MathMacroTable::cloneTemplate(yytext);
                                for (int i = 0; i < m->nargs(); ++i) 
                                        mathed_parse(m->cell(i), FLAG_ITEM);