]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_parser.C
mathed48.diff
[lyx.git] / src / mathed / math_parser.C
index 6ad9268b4b2eabc5b9b8a35760c6d58a8d5a920f..ea084cc4943b44672e5dc3c7416c978679ada311 100644 (file)
@@ -424,7 +424,7 @@ void mathed_parse(MathedArray & array, unsigned flags = 0,
        int acc_brace = 0;
        int acc_braces[8];
        MathParInset * mt = (mtx) ? *mtx : 0;
-       MathedRowSt * crow = (mt) ? mt->getRowSt() : 0;
+       MathedRowSt * crow = (mt) ? mt->getRowSt().data_ : 0;
        
        ++plevel;
        MathedIter data(&array);
@@ -603,8 +603,8 @@ void mathed_parse(MathedArray & array, unsigned flags = 0,
                        if (mt && (flags & FLAG_END)) {
                                if (mt->Permit(LMPF_ALLOW_CR)) {
                                        if (crow) {
-                                               crow->setNext(new MathedRowSt(mt->GetColumns() + 1)); // this leaks
-                                               crow = crow->getNext();
+                                               crow->next_ = new MathedRowSt(mt->GetColumns() + 1);
+                                               crow = crow->next_;
                                        }
                                        data.insert('K', LM_TC_CR);
                                } else 
@@ -693,7 +693,7 @@ void mathed_parse(MathedArray & array, unsigned flags = 0,
                                rt->setArgumentIdx(0);
                                MathedArray ar;
                                mathed_parse(ar, FLAG_BRACK_END, &rt);
-                               rt->setData(ar);
+                               rt->setData(ar); // I belive that line is not needed (Lgb)
                                rt->setArgumentIdx(1);
                        } else {
                                yyis->putback(c);
@@ -701,7 +701,7 @@ void mathed_parse(MathedArray & array, unsigned flags = 0,
                        }
                        MathedArray ar;
                        mathed_parse(ar, FLAG_BRACE|FLAG_BRACE_LAST, &rt);
-                       rt->setData(ar);
+                       rt->setData(ar); // I belive that this line is not needed (Lgb)
                        data.insertInset(rt, LM_TC_ACTIVE_INSET);
                        break;
                }
@@ -763,16 +763,13 @@ void mathed_parse(MathedArray & array, unsigned flags = 0,
                
                case LM_TK_PMOD:
                case LM_TK_FUNC:
-               {
-#warning This must leak. (Lgb)
-                       // if (accent) this must leak... (Lgb)
-                       MathedInset * bg = new MathFuncInset(yylval.l->name); 
                        if (accent) {
                                data.insert(t, LM_TC_CONST);
-                       } else
+                       } else {
+                               MathedInset * bg = new MathFuncInset(yylval.l->name); 
                                data.insertInset(bg, LM_TC_INSET);
+                       }
                        break;
-               }
                
                case LM_TK_FUNCLIM:
                        data.insertInset(new MathFuncInset(yylval.l->name, LM_OT_FUNCLIM),
@@ -783,7 +780,7 @@ void mathed_parse(MathedArray & array, unsigned flags = 0,
                {
                        
                        MathMacro * p = 
-                               MathMacroTable::mathMTable.getMacro(yylval.s);
+                               MathMacroTable::mathMTable.createMacro(yylval.s);
                        if (p) {
                                if (accent) 
                                        data.insertInset(doAccent(p), p->getTCode());
@@ -833,7 +830,8 @@ void mathed_parse(MathedArray & array, unsigned flags = 0,
                                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);
+                               MathedArray dat;
+                               mathed_parse(dat, FLAG_END, &mm);
                        } else if (is_eqn_type(yylval.i)) {
                                if (plevel!= 0) {
                                        mathPrintError("Misplaced environment");
@@ -871,20 +869,20 @@ void mathed_parse(MathedArray & array, unsigned flags = 0,
                                        }
                                        mt->SetStyle(size);
                                        mt->SetType(mathed_env);
-                                       crow = mt->getRowSt();
+                                       crow = mt->getRowSt().data_;
                                }
                                
-#ifdef DEBUG
-                               lyxerr << "MATH BEGIN[" << mathed_env << "]" << endl;
-#endif
+                               lyxerr[Debug::MATHED] << "MATH BEGIN[" << mathed_env << "]" << endl;
                        } else {
 //          lyxerr << "MATHCRO[" << yytext << "]";
                                MathMacro * p = 
-                                       MathMacroTable::mathMTable.getMacro(yytext.data());
+                                       MathMacroTable::mathMTable.createMacro(yytext.data());
                                if (p) {
                                        data.insertInset(p, p->getTCode());
                                        p->setArgumentIdx(0);
-                                       mathed_parse(p->GetData(), FLAG_END, reinterpret_cast<MathParInset**>(&p));
+                                       //mathed_parse(p->GetData(), FLAG_END, reinterpret_cast<MathParInset**>(&p));
+                                       MathedArray dat;
+                                       mathed_parse(dat, FLAG_END, reinterpret_cast<MathParInset**>(&p));
 //              for (int i = 0; p->setArgumentIdx(i); ++i)
 //                p->SetData(mathed_parse(FLAG_BRACE|FLAG_BRACE_LAST));
                                } else 
@@ -895,7 +893,7 @@ void mathed_parse(MathedArray & array, unsigned flags = 0,
                case LM_TK_MACRO:
                { 
                        MathedInset * p = 
-                               MathMacroTable::mathMTable.getMacro(yylval.l->name);
+                               MathMacroTable::mathMTable.createMacro(yylval.l->name);
                        
                        if (p) {
                                if (accent) {
@@ -921,9 +919,7 @@ void mathed_parse(MathedArray & array, unsigned flags = 0,
                        } else {
                                mathed_label = yytext.data();
                        }
-#ifdef DEBUG
-                       lyxerr << "Label[" << mathed_label << "]" << endl;
-#endif
+                       lyxerr[Debug::MATHED] << "Label[" << mathed_label << "]" << endl;
                        break;
                }