fix reading of math macros when they occur before any formula

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10770 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2006-01-24 11:04:30 +00:00
parent 94ab1dabc4
commit f687620a13
3 changed files with 16 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2006-01-18 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* math_factory.C (initMath): set initialized to true early to
avoid recursive invokation.
* math_macrotemplate.C (MathMacroTemplate): make sure math
structures are initialized.
2006-01-11 Jean-Marc Lasgouttes <lasgouttes@lyx.org> 2006-01-11 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* math_nestinset.C (doDispatch/LFUN_SELFINSERT): when inserting a * math_nestinset.C (doDispatch/LFUN_SELFINSERT): when inserting a

View File

@ -225,9 +225,9 @@ void initMath()
{ {
static bool initialized = false; static bool initialized = false;
if (!initialized) { if (!initialized) {
initialized = true;
initParser(); initParser();
initSymbols(); initSymbols();
initialized = true;
} }
} }

View File

@ -36,13 +36,17 @@ using std::endl;
MathMacroTemplate::MathMacroTemplate() MathMacroTemplate::MathMacroTemplate()
: MathNestInset(2), numargs_(0), name_(), type_("newcommand") : MathNestInset(2), numargs_(0), name_(), type_("newcommand")
{} {
initMath();
}
MathMacroTemplate::MathMacroTemplate(string const & nm, int numargs, MathMacroTemplate::MathMacroTemplate(string const & nm, int numargs,
string const & type, MathArray const & ar1, MathArray const & ar2) string const & type, MathArray const & ar1, MathArray const & ar2)
: MathNestInset(2), numargs_(numargs), name_(nm), type_(type) : MathNestInset(2), numargs_(numargs), name_(nm), type_(type)
{ {
initMath();
if (numargs_ > 9) if (numargs_ > 9)
lyxerr << "MathMacroTemplate::MathMacroTemplate: wrong # of arguments: " lyxerr << "MathMacroTemplate::MathMacroTemplate: wrong # of arguments: "
<< numargs_ << std::endl; << numargs_ << std::endl;
@ -54,6 +58,8 @@ MathMacroTemplate::MathMacroTemplate(string const & nm, int numargs,
MathMacroTemplate::MathMacroTemplate(std::istream & is) MathMacroTemplate::MathMacroTemplate(std::istream & is)
: MathNestInset(2), numargs_(0), name_() : MathNestInset(2), numargs_(0), name_()
{ {
initMath();
MathArray ar; MathArray ar;
mathed_parse_cell(ar, is); mathed_parse_cell(ar, is);
if (ar.size() != 1 || !ar[0]->asMacroTemplate()) { if (ar.size() != 1 || !ar[0]->asMacroTemplate()) {