The attached patch reverts part of the MathedArray * -> & change in order to make MathMatrix work again. Andre' -- André Pönitz ........................................ [EMAIL PROTECTED]
? mathed30.diff ? mathed35.diff ? bug.diff ? mathed25.diff ? mathed27.diff ? mathed26.diff ? mathed29.diff ? mathed28.diff ? .bug.diff.swp ? mathed34.diff ? mathed31.diff ? mathed33.diff ? mathed32.diff ? mathed36.diff Index: formula.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/formula.C,v retrieving revision 1.88 diff -u -p -r1.88 formula.C --- formula.C 2001/02/20 17:45:56 1.88 +++ formula.C 2001/02/21 11:58:26 @@ -305,8 +305,7 @@ void InsetFormula::Read(Buffer const *, // Silly hack to read labels. mathed_label.erase(); - MathedArray ar; - mathed_parse(ar, 0, &par); + mathed_parse(0, 0, &par); par->Metrics(); disp_flag = (par->GetType() > 0); Index: formulamacro.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/formulamacro.C,v retrieving revision 1.49 diff -u -p -r1.49 formulamacro.C --- formulamacro.C 2001/02/20 17:45:56 1.49 +++ formulamacro.C 2001/02/21 11:58:26 @@ -101,8 +101,7 @@ void InsetFormulaMacro::Read(Buffer cons { istream & is = lex.getStream(); mathed_parser_file(is, lex.GetLineNo()); - MathedArray ar; - mathed_parse(ar, 0, reinterpret_cast<MathParInset **>(&tmacro)); + mathed_parse(0, 0, reinterpret_cast<MathParInset **>(&tmacro)); // Update line number lex.setLineNo(mathed_parser_lineno()); Index: math_parser.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_parser.C,v retrieving revision 1.33 diff -u -p -r1.33 math_parser.C --- math_parser.C 2001/02/20 17:45:56 1.33 +++ math_parser.C 2001/02/21 11:58:27 @@ -405,7 +405,7 @@ MathedInset * doAccent(MathedInset * p) } -void mathed_parse(MathedArray & array, unsigned flags = 0, +MathedArray * mathed_parse(unsigned flags = 0, MathedArray * array = 0, MathParInset ** mtx = 0) { int t = yylex(); @@ -424,7 +424,8 @@ void mathed_parse(MathedArray & array, u MathedRowSt * crow = (mt) ? mt->getRowSt() : 0; ++plevel; - MathedIter data(&array); + if (!array) array = new MathedArray; + MathedIter data(array); while (t) { if ((flags & FLAG_BRACE) && t != LM_TK_OPEN) { if ((flags & FLAG_BRACK_ARG) && t == '[') { @@ -468,7 +469,7 @@ void mathed_parse(MathedArray & array, u macro = new MathMacroTemplate(name, na); flags = FLAG_BRACE|FLAG_BRACE_LAST; *mtx = macro; - macro->setData(array); + macro->setData(*array); break; } case LM_TK_SPECIAL: @@ -523,7 +524,7 @@ void mathed_parse(MathedArray & array, u } if (brace == 0 && (flags & FLAG_BRACE_LAST)) { --plevel; - return; + return array; } else { data.insert('}', LM_TC_TEX); } @@ -549,7 +550,7 @@ void mathed_parse(MathedArray & array, u { if (flags & FLAG_BRACK_END) { --plevel; - return; + return array; } else data.insert(']', LM_TC_CONST); break; @@ -558,9 +559,8 @@ void mathed_parse(MathedArray & array, u case '^': { MathParInset * p = new MathParInset(size, "", LM_OT_SCRIPT); - MathedArray ar; - mathed_parse(ar, FLAG_BRACE_OPT|FLAG_BRACE_LAST); - p->setData(ar); + MathedArray * ar = mathed_parse(FLAG_BRACE_OPT|FLAG_BRACE_LAST, 0); + p->setData(*ar); // lyxerr << "UP[" << p->GetStyle() << "]" << endl; data.insertInset(p, LM_TC_UP); break; @@ -568,9 +568,8 @@ void mathed_parse(MathedArray & array, u case '_': { MathParInset * p = new MathParInset(size, "", LM_OT_SCRIPT); - MathedArray ar; - mathed_parse(ar, FLAG_BRACE_OPT|FLAG_BRACE_LAST); - p->setData(ar); + MathedArray * ar = mathed_parse(FLAG_BRACE_OPT|FLAG_BRACE_LAST, 0); + p->setData(*ar); data.insertInset(p, LM_TC_DOWN); break; } @@ -671,11 +670,9 @@ void mathed_parse(MathedArray & array, u case LM_TK_FRAC: { MathFracInset * fc = new MathFracInset(fractype); - MathedArray num; - mathed_parse(num, FLAG_BRACE|FLAG_BRACE_LAST); - MathedArray den; - mathed_parse(den, FLAG_BRACE|FLAG_BRACE_LAST); - fc->SetData(num, den); + MathedArray * num = mathed_parse(FLAG_BRACE|FLAG_BRACE_LAST); + MathedArray * den = mathed_parse(FLAG_BRACE|FLAG_BRACE_LAST); + fc->SetData(*num, *den); data.insertInset(fc, LM_TC_ACTIVE_INSET); break; } @@ -688,17 +685,13 @@ void mathed_parse(MathedArray & array, u if (c == '[') { rt = new MathRootInset(size); rt->setArgumentIdx(0); - MathedArray ar; - mathed_parse(ar, FLAG_BRACK_END, &rt); - rt->setData(ar); + rt->setData(*mathed_parse(FLAG_BRACK_END, 0, &rt)); rt->setArgumentIdx(1); } else { yyis->putback(c); rt = new MathSqrtInset(size); } - MathedArray ar; - mathed_parse(ar, FLAG_BRACE|FLAG_BRACE_LAST, &rt); - rt->setData(ar); + rt->setData(*mathed_parse(FLAG_BRACE|FLAG_BRACE_LAST, 0, &rt)); data.insertInset(rt, LM_TC_ACTIVE_INSET); break; } @@ -709,14 +702,13 @@ void mathed_parse(MathedArray & array, u if (lfd == LM_TK_SYM || lfd == LM_TK_STR || lfd == LM_TK_BOP|| lfd == LM_TK_SPECIAL) lfd = (lfd == LM_TK_SYM) ? yylval.l->id: yylval.i; // lyxerr << "L[" << lfd << " " << lfd << "]"; - MathedArray ar; - mathed_parse(ar, FLAG_RIGHT); + MathedArray * a = mathed_parse(FLAG_RIGHT); int rgd = yylex(); // lyxerr << "R[" << rgd << "]"; if (rgd == LM_TK_SYM || rgd == LM_TK_STR || rgd == LM_TK_BOP || rgd == LM_TK_SPECIAL) rgd = (rgd == LM_TK_SYM) ? yylval.l->id: yylval.i; MathDelimInset * dl = new MathDelimInset(lfd, rgd); - dl->setData(ar); + dl->setData(*a); data.insertInset(dl, LM_TC_ACTIVE_INSET); // lyxerr << "RL[" << lfd << " " << rgd << "]"; break; @@ -725,7 +717,7 @@ void mathed_parse(MathedArray & array, u { if (flags & FLAG_RIGHT) { --plevel; - return; + return array; } else { mathPrintError("Unmatched right delimiter"); // panic = true; @@ -744,9 +736,7 @@ void mathed_parse(MathedArray & array, u { MathDecorationInset * sq = new MathDecorationInset(yylval.l->id, size); - MathedArray ar; - mathed_parse(ar, FLAG_BRACE|FLAG_BRACE_LAST); - sq->setData(ar); + sq->setData(*mathed_parse(FLAG_BRACE|FLAG_BRACE_LAST)); data.insertInset(sq, LM_TC_ACTIVE_INSET); break; } @@ -790,11 +780,8 @@ void mathed_parse(MathedArray & array, u data.insertInset(doAccent(p), p->getTCode()); else data.insertInset(p, p->getTCode()); - for (int i = 0; p->setArgumentIdx(i); ++i) { - MathedArray ar; - mathed_parse(ar, FLAG_BRACE|FLAG_BRACE_LAST); - p->setData(ar); - } + for (int i = 0; p->setArgumentIdx(i); ++i) + p->setData(*mathed_parse(FLAG_BRACE|FLAG_BRACE_LAST)); } else { MathedInset * q = new MathFuncInset(yylval.s, LM_OT_UNDEF); @@ -815,10 +802,10 @@ void mathed_parse(MathedArray & array, u lyxerr << "[" << yylval.i << "]" << endl; --plevel; if (mt) { // && (flags & FLAG_END)) { - mt->setData(array); - array.clear(); + mt->setData(*array); + array = 0; } - return; + return array; } case LM_TK_BEGIN: { @@ -835,7 +822,7 @@ void mathed_parse(MathedArray & array, u MathParInset * mm = new MathMatrixInset(nc, 0); mm->SetAlign(ar2[0], ar); data.insertInset(mm, LM_TC_ACTIVE_INSET); - mathed_parse(mm->GetData(), FLAG_END, &mm); + mathed_parse(FLAG_END, &mm->GetData(), &mm); } else if (is_eqn_type(yylval.i)) { if (plevel!= 0) { mathPrintError("Misplaced environment"); @@ -886,7 +873,7 @@ void mathed_parse(MathedArray & array, u if (p) { data.insertInset(p, p->getTCode()); p->setArgumentIdx(0); - mathed_parse(p->GetData(), FLAG_END, reinterpret_cast<MathParInset**>(&p)); + mathed_parse(FLAG_END, &p->GetData(), +reinterpret_cast<MathParInset**>(&p)); // for (int i = 0; p->setArgumentIdx(i); ++i) // p->SetData(mathed_parse(FLAG_BRACE|FLAG_BRACE_LAST)); } else @@ -952,6 +939,7 @@ void mathed_parse(MathedArray & array, u } } --plevel; + return array; } Index: support.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/support.h,v retrieving revision 1.4 diff -u -p -r1.4 support.h --- support.h 2001/02/20 17:45:56 1.4 +++ support.h 2001/02/21 11:58:27 @@ -36,7 +36,8 @@ extern math_deco_struct const * search_d /// math_parser.C extern -void mathed_parse(MathedArray & data, unsigned flags, MathParInset ** mt); +MathedArray * mathed_parse(unsigned flags, MathedArray * data, + MathParInset ** mt); /// math_parser.C extern