// The search is currently linear but will be binary or hash, later.
MathMacroTemplate *MathMacroTable::getTemplate(charconst* name) const
{ for (int i=0; i<num_macros; i++) { if (strcmp(name, macro_table[i]->GetName())==0) return macro_table[i];
}
return0;
}
void MathMacroTable::addTemplate(MathMacroTemplate *m)
{ if (num_macros<max_macros)
macro_table[num_macros++] = m; else
lyxerr.print("Error (MathMacroTable::addTemplate): " "Macro table exhausted!");
}
// All this stuff aparently leaks because it's created here and is not // deleted never, but it have to live all the LyX sesion. OK, would not // so hard to do it in the MacroTable destructor, but this doesn't harm // seriously, so don't bother me with purify results here. ;-)
// This macro doesn't have arguments
m = new MathMacroTemplate("notin"); // this leaks
addTemplate(m);
array = new LyxArrayBase; // this leaks
iter.SetData(array);
iter.Insert(new MathAccentInset(LM_in, LM_TC_BOPS, LM_not)); // this leaks
m->SetData(array);
// These two are only while we are still with LyX 2.x
m = new MathMacroTemplate("emptyset"); // this leaks
addTemplate(m);
array = new LyxArrayBase; // this leaks
iter.SetData(array);
iter.Insert(new MathAccentInset('O', LM_TC_RM, LM_not)); // this leaks
m->SetData(array);
m = new MathMacroTemplate("perp"); // this leaks
addTemplate(m);
array = new LyxArrayBase; // this leaks
iter.SetData(array);
iter.Insert(LM_bot, LM_TC_BOP);
m->SetData(array);
// binom has two arguments
m = new MathMacroTemplate("binom", 2);
addTemplate(m);
array = new LyxArrayBase;
m->SetData(array);
iter.SetData(array);
inset = new MathDelimInset('(', ')');
iter.Insert(inset, LM_TC_ACTIVE_INSET);
array = new LyxArrayBase;
iter.SetData(array);
MathFracInset *frac = new MathFracInset(LM_OT_ATOP);
iter.Insert(frac, LM_TC_ACTIVE_INSET);
inset->SetData(array);
array = new LyxArrayBase;
array2 = new LyxArrayBase;
iter.SetData(array);
iter.Insert(m->getMacroPar(0));
iter.SetData(array2);
iter.Insert(m->getMacroPar(1));
frac->SetData(array, array2);
/* // Cases has 1 argument m=newMathMacroTemplate("cases",1,MMF_Env);// this leaks addTemplate(m); array=newLyxArrayBase;// this leaks iter.SetData(array); arg=newMathMatrixInset(2,1);// this leaks
m->setArgument(arg); arg->SetAlign('c',"ll"); iter.Insert(arg,LM_TC_ACTIVE_INSET); inset=newMathDelimInset('{','.');// this leaks inset->SetData(array); array=newLyxArrayBase;// this leaks iter.SetData(array); iter.Insert(inset,LM_TC_ACTIVE_INSET); m->SetData(array);
// the environment substack has 1 argument m=newMathMacroTemplate("substack",1,MMF_Env);// this leaks addTemplate(m); arg=newMathMatrixInset(1,1);// this leaks m->setArgument(arg); arg->SetType(LM_OT_MACRO); array=newLyxArrayBase;// this leaks iter.SetData(array); iter.Insert(arg,LM_TC_ACTIVE_INSET);
m->SetData(array);*/
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.