work around static initialization problem

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2367 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2001-07-27 12:32:29 +00:00
parent d32d0cbb95
commit 2e4ad73024
4 changed files with 20 additions and 12 deletions

View 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)

View 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

View 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;
//

View 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);