iookup unification - another 100 lines bite the dust

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2357 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2001-07-26 10:21:18 +00:00
parent 8e0e11f8ae
commit 16fe92dbc0
10 changed files with 279 additions and 390 deletions

View File

@ -62,8 +62,6 @@ libmathed_la_SOURCES = \
math_spaceinset.h \ math_spaceinset.h \
math_sqrtinset.C \ math_sqrtinset.C \
math_sqrtinset.h \ math_sqrtinset.h \
math_utils.C \
math_utils.h \
support.C \ support.C \
support.h \ support.h \
symbol_def.h symbol_def.h

View File

@ -669,7 +669,7 @@ void MathCursor::interpret(string const & s)
case LM_TK_SYM: { case LM_TK_SYM: {
MathTextCodes code = static_cast<MathTextCodes>(l->id); MathTextCodes code = static_cast<MathTextCodes>(l->id);
if (code < 255) if (code < 255)
insert(l->id, MathIsBOPS(code) ? LM_TC_BOPS : LM_TC_SYMB); insert(l->id, l->bin != LMB_NONE ? LM_TC_BOPS : LM_TC_SYMB);
else else
p = new MathFuncInset(l->name); p = new MathFuncInset(l->name);
break; break;
@ -733,7 +733,9 @@ void MathCursor::macroModeOpen()
{ {
if (!imacro_) { if (!imacro_) {
imacro_ = new MathFuncInset(""); imacro_ = new MathFuncInset("");
insert(imacro_); array().insert(cursor().pos_, imacro_);
array().next(cursor().pos_);
//insert(imacro_);
} else } else
lyxerr << "Math Warning: Already in macro mode" << endl; lyxerr << "Math Warning: Already in macro mode" << endl;
} }

View File

@ -100,6 +100,8 @@ public:
/// ///
void plainErase(); void plainErase();
/// ///
void plainInsert(MathInset * p);
///
void delLine(); void delLine();
/// This is in pixels from (maybe?) the top of inset /// This is in pixels from (maybe?) the top of inset
void setPos(int, int); void setPos(int, int);

View File

@ -10,275 +10,275 @@ namespace {
latexkeys const wordlist[] = latexkeys const wordlist[] =
{ {
//{"displaystyle", LM_TK_STY, LM_ST_DISPLAY}, //{"displaystyle", LM_TK_STY, LM_ST_DISPLAY, LMB_NONE},
//{"scriptscriptstyle", LM_TK_STY, LM_ST_SCRIPTSCRIPT}, //{"scriptscriptstyle", LM_TK_STY, LM_ST_SCRIPTSCRIPT, LMB_NONE},
//{"scriptstyle", LM_TK_STY, LM_ST_SCRIPT}, //{"scriptstyle", LM_TK_STY, LM_ST_SCRIPT, LMB_NONE},
//{"textstyle", LM_TK_STY, LM_ST_TEXT}, //{"textstyle", LM_TK_STY, LM_ST_TEXT, LMB_NONE},
{"Delta", LM_TK_SYM, LM_Delta}, {"Delta", LM_TK_SYM, LM_Delta, LMB_NONE},
{"Downarrow", LM_TK_SYM, LM_Downarrow}, {"Downarrow", LM_TK_SYM, LM_Downarrow, LMB_NONE},
{"Gamma", LM_TK_SYM, LM_Gamma}, {"Gamma", LM_TK_SYM, LM_Gamma, LMB_NONE},
{"Im", LM_TK_SYM, LM_Im}, {"Im", LM_TK_SYM, LM_Im, LMB_NONE},
{"Lambda", LM_TK_SYM, LM_Lambda}, {"Lambda", LM_TK_SYM, LM_Lambda, LMB_NONE},
{"Leftarrow", LM_TK_SYM, LM_Leftarrow}, {"Leftarrow", LM_TK_SYM, LM_Leftarrow, LMB_NONE},
{"Leftrightarrow", LM_TK_SYM, LM_Leftrightarrow}, {"Leftrightarrow", LM_TK_SYM, LM_Leftrightarrow, LMB_NONE},
{"Longleftarrow", LM_TK_SYM, LM_Longleftarrow}, {"Longleftarrow", LM_TK_SYM, LM_Longleftarrow, LMB_NONE},
{"Longleftrightarrow", LM_TK_SYM, LM_Longleftrightarrow}, {"Longleftrightarrow", LM_TK_SYM, LM_Longleftrightarrow, LMB_NONE},
{"Longrightarrow", LM_TK_SYM, LM_Longrightarrow}, {"Longrightarrow", LM_TK_SYM, LM_Longrightarrow, LMB_NONE},
{"Omega", LM_TK_SYM, LM_Omega}, {"Omega", LM_TK_SYM, LM_Omega, LMB_NONE},
{"Phi", LM_TK_SYM, LM_Phi}, {"Phi", LM_TK_SYM, LM_Phi, LMB_NONE},
{"Pi", LM_TK_SYM, LM_Pi}, {"Pi", LM_TK_SYM, LM_Pi, LMB_NONE},
{"Pr", LM_TK_FUNCLIM, 0}, {"Pr", LM_TK_FUNCLIM, 0, LMB_NONE},
{"Psi", LM_TK_SYM, LM_Psi}, {"Psi", LM_TK_SYM, LM_Psi, LMB_NONE},
{"Re", LM_TK_SYM, LM_Re}, {"Re", LM_TK_SYM, LM_Re, LMB_NONE},
{"Rightarrow", LM_TK_SYM, LM_Rightarrow}, {"Rightarrow", LM_TK_SYM, LM_Rightarrow, LMB_NONE},
{"Sigma", LM_TK_SYM, LM_Sigma}, {"Sigma", LM_TK_SYM, LM_Sigma, LMB_NONE},
{"Theta", LM_TK_SYM, LM_Theta}, {"Theta", LM_TK_SYM, LM_Theta, LMB_NONE},
{"Uparrow", LM_TK_SYM, LM_Uparrow}, {"Uparrow", LM_TK_SYM, LM_Uparrow, LMB_NONE},
{"Updownarrow", LM_TK_SYM, LM_Updownarrow}, {"Updownarrow", LM_TK_SYM, LM_Updownarrow, LMB_NONE},
{"Upsilon", LM_TK_SYM, LM_Upsilon}, {"Upsilon", LM_TK_SYM, LM_Upsilon, LMB_NONE},
{"Vert", LM_TK_SYM, LM_Vert}, {"Vert", LM_TK_SYM, LM_Vert, LMB_NONE},
{"Xi", LM_TK_SYM, LM_Xi}, {"Xi", LM_TK_SYM, LM_Xi, LMB_NONE},
{"acute", LM_TK_DECORATION, LM_acute}, {"acute", LM_TK_DECORATION, LM_acute, LMB_NONE},
{"aleph", LM_TK_SYM, LM_aleph}, {"aleph", LM_TK_SYM, LM_aleph, LMB_NONE},
{"alpha", LM_TK_SYM, LM_alpha}, {"alpha", LM_TK_SYM, LM_alpha, LMB_NONE},
{"amalg", LM_TK_SYM, LM_amalg}, {"amalg", LM_TK_SYM, LM_amalg, LMB_OPERATOR},
{"angle", LM_TK_SYM, LM_angle}, {"angle", LM_TK_SYM, LM_angle, LMB_NONE},
{"approx", LM_TK_SYM, LM_approx}, {"approx", LM_TK_SYM, LM_approx, LMB_RELATION},
{"arccos", LM_TK_FUNC, 0}, {"arccos", LM_TK_FUNC, 0, LMB_NONE},
{"arcsin", LM_TK_FUNC, 0}, {"arcsin", LM_TK_FUNC, 0, LMB_NONE},
{"arctan", LM_TK_FUNC, 0}, {"arctan", LM_TK_FUNC, 0, LMB_NONE},
{"arg", LM_TK_FUNC, 0}, {"arg", LM_TK_FUNC, 0, LMB_NONE},
{"asymp", LM_TK_SYM, LM_asymp}, {"asymp", LM_TK_SYM, LM_asymp, LMB_RELATION},
{"backslash", LM_TK_SYM, LM_backslash}, {"backslash", LM_TK_SYM, LM_backslash, LMB_NONE},
{"bar", LM_TK_DECORATION, LM_bar}, {"bar", LM_TK_DECORATION, LM_bar, LMB_NONE},
{"begin", LM_TK_BEGIN, 0}, {"begin", LM_TK_BEGIN, 0, LMB_NONE},
{"beta", LM_TK_SYM, LM_beta}, {"beta", LM_TK_SYM, LM_beta, LMB_NONE},
{"bigcap", LM_TK_BIGSYM, LM_cap}, {"bigcap", LM_TK_BIGSYM, LM_cap, LMB_NONE},
{"bigcirc", LM_TK_SYM, LM_bigcirc}, {"bigcirc", LM_TK_SYM, LM_bigcirc, LMB_OPERATOR},
{"bigcup", LM_TK_BIGSYM, LM_cup}, {"bigcup", LM_TK_BIGSYM, LM_cup, LMB_NONE},
{"bigodot", LM_TK_BIGSYM, LM_bigodot}, {"bigodot", LM_TK_BIGSYM, LM_bigodot, LMB_NONE},
{"bigoplus", LM_TK_BIGSYM, LM_oplus}, {"bigoplus", LM_TK_BIGSYM, LM_oplus, LMB_NONE},
{"bigotimes", LM_TK_BIGSYM, LM_otimes}, {"bigotimes", LM_TK_BIGSYM, LM_otimes, LMB_NONE},
{"bigsqcup", LM_TK_BIGSYM, LM_bigsqcup}, {"bigsqcup", LM_TK_BIGSYM, LM_bigsqcup, LMB_NONE},
{"bigtriangledown", LM_TK_SYM, LM_bigtriangledown}, {"bigtriangledown", LM_TK_SYM, LM_bigtriangledown, LMB_OPERATOR},
{"bigtriangleup", LM_TK_SYM, LM_bigtriangleup}, {"bigtriangleup", LM_TK_SYM, LM_bigtriangleup, LMB_OPERATOR},
{"biguplus", LM_TK_BIGSYM, LM_biguplus}, {"biguplus", LM_TK_BIGSYM, LM_biguplus, LMB_NONE},
{"bigvee", LM_TK_BIGSYM, LM_vee}, {"bigvee", LM_TK_BIGSYM, LM_vee, LMB_NONE},
{"bigwedge", LM_TK_BIGSYM, LM_wedge}, {"bigwedge", LM_TK_BIGSYM, LM_wedge, LMB_NONE},
{"bmod", LM_TK_FUNC, 0}, {"bmod", LM_TK_FUNC, 0, LMB_NONE},
{"bot", LM_TK_SYM, LM_bot}, {"bot", LM_TK_SYM, LM_bot, LMB_NONE},
{"bowtie", LM_TK_SYM, LM_bowtie}, {"bowtie", LM_TK_SYM, LM_bowtie, LMB_RELATION},
{"breve", LM_TK_DECORATION, LM_breve}, {"breve", LM_TK_DECORATION, LM_breve, LMB_NONE},
{"bullet", LM_TK_SYM, LM_bullet}, {"bullet", LM_TK_SYM, LM_bullet, LMB_OPERATOR},
{"cap", LM_TK_SYM, LM_cap}, {"cap", LM_TK_SYM, LM_cap, LMB_OPERATOR},
{"cdot", LM_TK_SYM, LM_cdot}, {"cdot", LM_TK_SYM, LM_cdot, LMB_OPERATOR},
{"cdots", LM_TK_DOTS, LM_cdots}, {"cdots", LM_TK_DOTS, LM_cdots, LMB_NONE},
{"check", LM_TK_DECORATION, LM_check}, {"check", LM_TK_DECORATION, LM_check, LMB_NONE},
{"chi", LM_TK_SYM, LM_chi}, {"chi", LM_TK_SYM, LM_chi, LMB_NONE},
{"circ", LM_TK_SYM, LM_circ}, {"circ", LM_TK_SYM, LM_circ, LMB_OPERATOR},
{"clubsuit", LM_TK_SYM, LM_clubsuit}, {"clubsuit", LM_TK_SYM, LM_clubsuit, LMB_NONE},
{"cong", LM_TK_SYM, LM_cong}, {"cong", LM_TK_SYM, LM_cong, LMB_RELATION},
{"coprod", LM_TK_BIGSYM, LM_coprod}, {"coprod", LM_TK_BIGSYM, LM_coprod, LMB_NONE},
{"cos", LM_TK_FUNC, 0}, {"cos", LM_TK_FUNC, 0, LMB_NONE},
{"cosh", LM_TK_FUNC, 0}, {"cosh", LM_TK_FUNC, 0, LMB_NONE},
{"cot", LM_TK_FUNC, 0}, {"cot", LM_TK_FUNC, 0, LMB_NONE},
{"coth", LM_TK_FUNC, 0}, {"coth", LM_TK_FUNC, 0, LMB_NONE},
{"csc", LM_TK_FUNC, 0}, {"csc", LM_TK_FUNC, 0, LMB_NONE},
{"cup", LM_TK_SYM, LM_cup}, {"cup", LM_TK_SYM, LM_cup, LMB_OPERATOR},
{"dagger", LM_TK_SYM, LM_dagger}, {"dagger", LM_TK_SYM, LM_dagger, LMB_OPERATOR},
{"dashv", LM_TK_SYM, LM_dashv}, {"dashv", LM_TK_SYM, LM_dashv, LMB_RELATION},
{"ddagger", LM_TK_SYM, LM_ddagger}, {"ddagger", LM_TK_SYM, LM_ddagger, LMB_OPERATOR},
{"ddot", LM_TK_DECORATION, LM_ddot}, {"ddot", LM_TK_DECORATION, LM_ddot, LMB_NONE},
{"ddots", LM_TK_DOTS, LM_ddots}, {"ddots", LM_TK_DOTS, LM_ddots, LMB_NONE},
{"deg", LM_TK_FUNC, 0}, {"deg", LM_TK_FUNC, 0, LMB_NONE},
{"delta", LM_TK_SYM, LM_delta}, {"delta", LM_TK_SYM, LM_delta, LMB_NONE},
{"det", LM_TK_FUNCLIM, 0}, {"det", LM_TK_FUNCLIM, 0, LMB_NONE},
{"diamond", LM_TK_SYM, LM_diamond}, {"diamond", LM_TK_SYM, LM_diamond, LMB_OPERATOR},
{"diamondsuit", LM_TK_SYM, LM_diamondsuit}, {"diamondsuit", LM_TK_SYM, LM_diamondsuit, LMB_NONE},
{"dim", LM_TK_FUNC, 0}, {"dim", LM_TK_FUNC, 0, LMB_NONE},
{"div", LM_TK_SYM, LM_div}, {"div", LM_TK_SYM, LM_div, LMB_OPERATOR},
{"dot", LM_TK_DECORATION, LM_dot}, {"dot", LM_TK_DECORATION, LM_dot, LMB_NONE},
{"doteq", LM_TK_SYM, LM_doteq}, {"doteq", LM_TK_SYM, LM_doteq, LMB_RELATION},
{"downarrow", LM_TK_SYM, LM_downarrow}, {"downarrow", LM_TK_SYM, LM_downarrow, LMB_NONE},
{"ell", LM_TK_SYM, LM_ell}, {"ell", LM_TK_SYM, LM_ell, LMB_NONE},
{"emptyset", LM_TK_MACRO, LM_emptyset}, {"emptyset", LM_TK_MACRO, LM_emptyset, LMB_NONE},
{"end", LM_TK_END, 0}, {"end", LM_TK_END, 0, LMB_NONE},
{"epsilon", LM_TK_SYM, LM_epsilon}, {"epsilon", LM_TK_SYM, LM_epsilon, LMB_NONE},
{"equiv", LM_TK_SYM, LM_equiv}, {"equiv", LM_TK_SYM, LM_equiv, LMB_RELATION},
{"eta", LM_TK_SYM, LM_eta}, {"eta", LM_TK_SYM, LM_eta, LMB_NONE},
{"exists", LM_TK_SYM, LM_exists}, {"exists", LM_TK_SYM, LM_exists, LMB_NONE},
{"exp", LM_TK_FUNC, 0}, {"exp", LM_TK_FUNC, 0, LMB_NONE},
{"flat", LM_TK_SYM, LM_flat}, {"flat", LM_TK_SYM, LM_flat, LMB_NONE},
{"forall", LM_TK_SYM, LM_forall}, {"forall", LM_TK_SYM, LM_forall, LMB_NONE},
{"frac", LM_TK_FRAC, 0}, {"frac", LM_TK_FRAC, 0, LMB_NONE},
{"frown", LM_TK_SYM, LM_frown}, {"frown", LM_TK_SYM, LM_frown, LMB_RELATION},
{"gamma", LM_TK_SYM, LM_gamma}, {"gamma", LM_TK_SYM, LM_gamma, LMB_NONE},
{"gcd", LM_TK_FUNCLIM, 0}, {"gcd", LM_TK_FUNCLIM, 0, LMB_NONE},
{"geq", LM_TK_SYM, LM_geq}, {"geq", LM_TK_SYM, LM_geq, LMB_RELATION},
{"gg", LM_TK_SYM, LM_gg}, {"gg", LM_TK_SYM, LM_gg, LMB_RELATION},
{"grave", LM_TK_DECORATION, LM_grave}, {"grave", LM_TK_DECORATION, LM_grave, LMB_NONE},
{"hat", LM_TK_DECORATION, LM_hat}, {"hat", LM_TK_DECORATION, LM_hat, LMB_NONE},
{"hbar", LM_TK_SYM, LM_hbar}, {"hbar", LM_TK_SYM, LM_hbar, LMB_NONE},
{"heartsuit", LM_TK_SYM, LM_heartsuit}, {"heartsuit", LM_TK_SYM, LM_heartsuit, LMB_NONE},
{"hom", LM_TK_FUNC, 0}, {"hom", LM_TK_FUNC, 0, LMB_NONE},
{"hookleftarrow", LM_TK_SYM, LM_hookleftarrow}, {"hookleftarrow", LM_TK_SYM, LM_hookleftarrow, LMB_NONE},
{"hookrightarrow", LM_TK_SYM, LM_hookrightarrow}, {"hookrightarrow", LM_TK_SYM, LM_hookrightarrow, LMB_NONE},
{"imath", LM_TK_SYM, LM_imath}, {"imath", LM_TK_SYM, LM_imath, LMB_NONE},
{"in", LM_TK_SYM, LM_in}, {"in", LM_TK_SYM, LM_in, LMB_RELATION},
{"inf", LM_TK_FUNCLIM, 0}, {"inf", LM_TK_FUNCLIM, 0, LMB_NONE},
{"infty", LM_TK_SYM, LM_infty}, {"infty", LM_TK_SYM, LM_infty, LMB_NONE},
{"int", LM_TK_BIGSYM, LM_int}, {"int", LM_TK_BIGSYM, LM_int, LMB_NONE},
{"iota", LM_TK_SYM, LM_iota}, {"iota", LM_TK_SYM, LM_iota, LMB_NONE},
{"jmath", LM_TK_SYM, LM_jmath}, {"jmath", LM_TK_SYM, LM_jmath, LMB_NONE},
{"kappa", LM_TK_SYM, LM_kappa}, {"kappa", LM_TK_SYM, LM_kappa, LMB_NONE},
{"ker", LM_TK_FUNC, 0}, {"ker", LM_TK_FUNC, 0, LMB_NONE},
{"label", LM_TK_LABEL, 0}, {"label", LM_TK_LABEL, 0, LMB_NONE},
{"lambda", LM_TK_SYM, LM_lambda}, {"lambda", LM_TK_SYM, LM_lambda, LMB_NONE},
{"langle", LM_TK_SYM, LM_langle}, {"langle", LM_TK_SYM, LM_langle, LMB_NONE},
{"lceil", LM_TK_SYM, LM_lceil}, {"lceil", LM_TK_SYM, LM_lceil, LMB_NONE},
{"ldots", LM_TK_DOTS, LM_ldots}, {"ldots", LM_TK_DOTS, LM_ldots, LMB_NONE},
{"left", LM_TK_LEFT, 0}, {"left", LM_TK_LEFT, 0, LMB_NONE},
{"leftarrow", LM_TK_SYM, LM_leftarrow}, {"leftarrow", LM_TK_SYM, LM_leftarrow, LMB_NONE},
{"leftharpoondown", LM_TK_SYM, LM_leftharpoondown}, {"leftharpoondown", LM_TK_SYM, LM_leftharpoondown, LMB_NONE},
{"leftharpoonup", LM_TK_SYM, LM_leftharpoonup}, {"leftharpoonup", LM_TK_SYM, LM_leftharpoonup, LMB_NONE},
{"leftrightarrow", LM_TK_SYM, LM_leftrightarrow}, {"leftrightarrow", LM_TK_SYM, LM_leftrightarrow, LMB_NONE},
{"leq", LM_TK_SYM, LM_leq}, {"leq", LM_TK_SYM, LM_leq, LMB_RELATION},
{"lfloor", LM_TK_SYM, LM_lfloor}, {"lfloor", LM_TK_SYM, LM_lfloor, LMB_NONE},
{"lg", LM_TK_FUNC, 0}, {"lg", LM_TK_FUNC, 0, LMB_NONE},
{"lim", LM_TK_FUNCLIM, 0}, {"lim", LM_TK_FUNCLIM, 0, LMB_NONE},
{"liminf", LM_TK_FUNCLIM, 0}, {"liminf", LM_TK_FUNCLIM, 0, LMB_NONE},
{"limits", LM_TK_LIMIT, 1 }, {"limits", LM_TK_LIMIT, 1 , LMB_NONE},
{"limsup", LM_TK_FUNCLIM, 0}, {"limsup", LM_TK_FUNCLIM, 0, LMB_NONE},
{"ll", LM_TK_SYM, LM_ll}, {"ll", LM_TK_SYM, LM_ll, LMB_RELATION},
{"ln", LM_TK_FUNC, 0}, {"ln", LM_TK_FUNC, 0, LMB_NONE},
{"log", LM_TK_FUNC, 0}, {"log", LM_TK_FUNC, 0, LMB_NONE},
{"longleftarrow", LM_TK_SYM, LM_longleftarrow}, {"longleftarrow", LM_TK_SYM, LM_longleftarrow, LMB_NONE},
{"longleftrightarrow", LM_TK_SYM, LM_longleftrightarrow}, {"longleftrightarrow", LM_TK_SYM, LM_longleftrightarrow, LMB_NONE},
{"longmapsto", LM_TK_SYM, LM_longmapsto}, {"longmapsto", LM_TK_SYM, LM_longmapsto, LMB_NONE},
{"longrightarrow", LM_TK_SYM, LM_longrightarrow}, {"longrightarrow", LM_TK_SYM, LM_longrightarrow, LMB_NONE},
{"mapsto", LM_TK_SYM, LM_mapsto}, {"mapsto", LM_TK_SYM, LM_mapsto, LMB_NONE},
{"mathbf", LM_TK_FONT, LM_TC_BF}, {"mathbf", LM_TK_FONT, LM_TC_BF, LMB_NONE},
{"mathcal", LM_TK_FONT, LM_TC_CAL}, {"mathcal", LM_TK_FONT, LM_TC_CAL, LMB_NONE},
{"mathit", LM_TK_FONT, LM_TC_IT}, {"mathit", LM_TK_FONT, LM_TC_IT, LMB_NONE},
{"mathnormal", LM_TK_FONT, LM_TC_VAR}, {"mathnormal", LM_TK_FONT, LM_TC_VAR, LMB_NONE},
{"mathrm", LM_TK_FONT, LM_TC_RM}, {"mathrm", LM_TK_FONT, LM_TC_RM, LMB_NONE},
{"mathsf", LM_TK_FONT, LM_TC_SF}, {"mathsf", LM_TK_FONT, LM_TC_SF, LMB_NONE},
{"mathtt", LM_TK_FONT, LM_TC_TT}, {"mathtt", LM_TK_FONT, LM_TC_TT, LMB_NONE},
{"max", LM_TK_FUNCLIM, 0}, {"max", LM_TK_FUNCLIM, 0, LMB_NONE},
{"mid", LM_TK_SYM, LM_mid}, {"mid", LM_TK_SYM, LM_mid, LMB_RELATION},
{"min", LM_TK_FUNCLIM, 0}, {"min", LM_TK_FUNCLIM, 0, LMB_NONE},
{"models", LM_TK_SYM, LM_models}, {"models", LM_TK_SYM, LM_models, LMB_RELATION},
{"mp", LM_TK_SYM, LM_mp}, {"mp", LM_TK_SYM, LM_mp, LMB_OPERATOR},
{"mu", LM_TK_SYM, LM_mu}, {"mu", LM_TK_SYM, LM_mu, LMB_NONE},
{"nabla", LM_TK_SYM, LM_nabla}, {"nabla", LM_TK_SYM, LM_nabla, LMB_NONE},
{"natural", LM_TK_SYM, LM_natural}, {"natural", LM_TK_SYM, LM_natural, LMB_NONE},
{"nearrow", LM_TK_SYM, LM_nearrow}, {"nearrow", LM_TK_SYM, LM_nearrow, LMB_NONE},
{"neg", LM_TK_SYM, LM_neg}, {"neg", LM_TK_SYM, LM_neg, LMB_NONE},
{"neq", LM_TK_SYM, LM_neq}, {"neq", LM_TK_SYM, LM_neq, LMB_RELATION},
{"newcommand", LM_TK_NEWCOMMAND, 0 }, {"newcommand", LM_TK_NEWCOMMAND, 0 , LMB_NONE},
{"ni", LM_TK_SYM, LM_ni}, {"ni", LM_TK_SYM, LM_ni, LMB_RELATION},
{"nolimits", LM_TK_LIMIT, -1}, {"nolimits", LM_TK_LIMIT, -1, LMB_NONE},
{"nonumber", LM_TK_NONUM, 0}, {"nonumber", LM_TK_NONUM, 0, LMB_NONE},
{"not", LM_TK_DECORATION, LM_not}, {"not", LM_TK_DECORATION, LM_not, LMB_NONE},
{"notin", LM_TK_MACRO, LM_notin}, {"notin", LM_TK_MACRO, LM_notin, LMB_RELATION},
{"nu", LM_TK_SYM, LM_nu}, {"nu", LM_TK_SYM, LM_nu, LMB_NONE},
{"nwarrow", LM_TK_SYM, LM_nwarrow}, {"nwarrow", LM_TK_SYM, LM_nwarrow, LMB_NONE},
{"odot", LM_TK_SYM, LM_odot}, {"odot", LM_TK_SYM, LM_odot, LMB_OPERATOR},
{"oint", LM_TK_BIGSYM, LM_oint}, {"oint", LM_TK_BIGSYM, LM_oint, LMB_NONE},
{"omega", LM_TK_SYM, LM_omega}, {"omega", LM_TK_SYM, LM_omega, LMB_NONE},
{"ominus", LM_TK_SYM, LM_ominus}, {"ominus", LM_TK_SYM, LM_ominus, LMB_OPERATOR},
{"oplus", LM_TK_SYM, LM_oplus}, {"oplus", LM_TK_SYM, LM_oplus, LMB_OPERATOR},
{"oslash", LM_TK_SYM, LM_oslash}, {"oslash", LM_TK_SYM, LM_oslash, LMB_OPERATOR},
{"otimes", LM_TK_SYM, LM_otimes}, {"otimes", LM_TK_SYM, LM_otimes, LMB_OPERATOR},
{"overbrace", LM_TK_DECORATION, LM_overbrace}, {"overbrace", LM_TK_DECORATION, LM_overbrace, LMB_NONE},
{"overleftarrow", LM_TK_DECORATION, LM_overleftarrow}, {"overleftarrow", LM_TK_DECORATION, LM_overleftarrow, LMB_NONE},
{"overline", LM_TK_DECORATION, LM_overline}, {"overline", LM_TK_DECORATION, LM_overline, LMB_NONE},
{"overrightarrow", LM_TK_DECORATION, LM_overightarrow}, {"overrightarrow", LM_TK_DECORATION, LM_overightarrow, LMB_NONE},
{"parallel", LM_TK_SYM, LM_parallel}, {"parallel", LM_TK_SYM, LM_parallel, LMB_RELATION},
{"partial", LM_TK_SYM, LM_partial}, {"partial", LM_TK_SYM, LM_partial, LMB_NONE},
{"perp", LM_TK_MACRO, LM_perp}, {"perp", LM_TK_MACRO, LM_perp, LMB_RELATION},
{"phi", LM_TK_SYM, LM_phi}, {"phi", LM_TK_SYM, LM_phi, LMB_NONE},
{"pi", LM_TK_SYM, LM_pi}, {"pi", LM_TK_SYM, LM_pi, LMB_NONE},
{"pm", LM_TK_SYM, LM_pm}, {"pm", LM_TK_SYM, LM_pm, LMB_OPERATOR},
{"pmod", LM_TK_PMOD, 0}, {"pmod", LM_TK_PMOD, 0, LMB_NONE},
{"prec", LM_TK_SYM, LM_prec}, {"prec", LM_TK_SYM, LM_prec, LMB_RELATION},
{"preceq", LM_TK_SYM, LM_preceq}, {"preceq", LM_TK_SYM, LM_preceq, LMB_RELATION},
{"prime", LM_TK_SYM, LM_prime}, {"prime", LM_TK_SYM, LM_prime, LMB_NONE},
{"prod", LM_TK_BIGSYM, LM_prod}, {"prod", LM_TK_BIGSYM, LM_prod, LMB_NONE},
{"propto", LM_TK_SYM, LM_propto}, {"propto", LM_TK_SYM, LM_propto, LMB_RELATION},
{"psi", LM_TK_SYM, LM_psi}, {"psi", LM_TK_SYM, LM_psi, LMB_NONE},
{"qquad", LM_TK_SPACE, LM_qquad}, {"qquad", LM_TK_SPACE, LM_qquad, LMB_NONE},
{"quad", LM_TK_SPACE, LM_quad}, {"quad", LM_TK_SPACE, LM_quad, LMB_NONE},
{"rangle", LM_TK_SYM, LM_rangle}, {"rangle", LM_TK_SYM, LM_rangle, LMB_NONE},
{"rceil", LM_TK_SYM, LM_rceil}, {"rceil", LM_TK_SYM, LM_rceil, LMB_NONE},
{"rfloor", LM_TK_SYM, LM_rfloor}, {"rfloor", LM_TK_SYM, LM_rfloor, LMB_NONE},
{"rho", LM_TK_SYM, LM_rho}, {"rho", LM_TK_SYM, LM_rho, LMB_NONE},
{"right", LM_TK_RIGHT, 0}, {"right", LM_TK_RIGHT, 0, LMB_NONE},
{"rightarrow", LM_TK_SYM, LM_rightarrow}, {"rightarrow", LM_TK_SYM, LM_rightarrow, LMB_NONE},
{"rightharpoondown", LM_TK_SYM, LM_rightharpoondown}, {"rightharpoondown", LM_TK_SYM, LM_rightharpoondown, LMB_NONE},
{"rightharpoonup", LM_TK_SYM, LM_rightharpoonup}, {"rightharpoonup", LM_TK_SYM, LM_rightharpoonup, LMB_NONE},
{"rightleftharpoons", LM_TK_SYM, LM_rightleftharpoons}, {"rightleftharpoons", LM_TK_SYM, LM_rightleftharpoons, LMB_NONE},
{"searrow", LM_TK_SYM, LM_searrow}, {"searrow", LM_TK_SYM, LM_searrow, LMB_NONE},
{"sec", LM_TK_FUNC, 0}, {"sec", LM_TK_FUNC, 0, LMB_NONE},
{"setminus", LM_TK_SYM, LM_setminus}, {"setminus", LM_TK_SYM, LM_setminus, LMB_OPERATOR},
{"sharp", LM_TK_SYM, LM_sharp}, {"sharp", LM_TK_SYM, LM_sharp, LMB_NONE},
{"sigma", LM_TK_SYM, LM_sigma}, {"sigma", LM_TK_SYM, LM_sigma, LMB_NONE},
{"sim", LM_TK_SYM, LM_sim}, {"sim", LM_TK_SYM, LM_sim, LMB_RELATION},
{"simeq", LM_TK_SYM, LM_simeq}, {"simeq", LM_TK_SYM, LM_simeq, LMB_RELATION},
{"sin", LM_TK_FUNC, 0}, {"sin", LM_TK_FUNC, 0, LMB_NONE},
{"sinh", LM_TK_FUNC, 0}, {"sinh", LM_TK_FUNC, 0, LMB_NONE},
{"smile", LM_TK_SYM, LM_smile}, {"smile", LM_TK_SYM, LM_smile, LMB_RELATION},
{"spadesuit", LM_TK_SYM, LM_spadesuit}, {"spadesuit", LM_TK_SYM, LM_spadesuit, LMB_NONE},
{"sqcap", LM_TK_SYM, LM_sqcap}, {"sqcap", LM_TK_SYM, LM_sqcap, LMB_OPERATOR},
{"sqcup", LM_TK_SYM, LM_sqcup}, {"sqcup", LM_TK_SYM, LM_sqcup, LMB_OPERATOR},
{"sqrt", LM_TK_SQRT, 0}, {"sqrt", LM_TK_SQRT, 0, LMB_NONE},
{"sqsubseteq", LM_TK_SYM, LM_sqsubseteq}, {"sqsubseteq", LM_TK_SYM, LM_sqsubseteq, LMB_RELATION},
{"sqsupseteq", LM_TK_SYM, LM_sqsupseteq}, {"sqsupseteq", LM_TK_SYM, LM_sqsupseteq, LMB_RELATION},
{"stackrel", LM_TK_STACK, 0}, {"stackrel", LM_TK_STACK, 0, LMB_NONE},
{"star", LM_TK_SYM, LM_star}, {"star", LM_TK_SYM, LM_star, LMB_OPERATOR},
{"subset", LM_TK_SYM, LM_subset}, {"subset", LM_TK_SYM, LM_subset, LMB_RELATION},
{"subseteq", LM_TK_SYM, LM_subseteq}, {"subseteq", LM_TK_SYM, LM_subseteq, LMB_RELATION},
{"succ", LM_TK_SYM, LM_succ}, {"succ", LM_TK_SYM, LM_succ, LMB_RELATION},
{"succeq", LM_TK_SYM, LM_succeq}, {"succeq", LM_TK_SYM, LM_succeq, LMB_RELATION},
{"sum", LM_TK_BIGSYM, LM_sum}, {"sum", LM_TK_BIGSYM, LM_sum, LMB_NONE},
{"sup", LM_TK_FUNCLIM, 0}, {"sup", LM_TK_FUNCLIM, 0, LMB_NONE},
{"supset", LM_TK_SYM, LM_supset}, {"supset", LM_TK_SYM, LM_supset, LMB_RELATION},
{"supseteq", LM_TK_SYM, LM_supseteq}, {"supseteq", LM_TK_SYM, LM_supseteq, LMB_RELATION},
{"surd", LM_TK_SYM, LM_surd}, {"surd", LM_TK_SYM, LM_surd, LMB_NONE},
{"swarrow", LM_TK_SYM, LM_swarrow}, {"swarrow", LM_TK_SYM, LM_swarrow, LMB_NONE},
{"tan", LM_TK_FUNC, 0}, {"tan", LM_TK_FUNC, 0, LMB_NONE},
{"tanh", LM_TK_FUNC, 0}, {"tanh", LM_TK_FUNC, 0, LMB_NONE},
{"tau", LM_TK_SYM, LM_tau}, {"tau", LM_TK_SYM, LM_tau, LMB_NONE},
{"textrm", LM_TK_FONT, LM_TC_TEXTRM}, {"textrm", LM_TK_FONT, LM_TC_TEXTRM, LMB_NONE},
{"theta", LM_TK_SYM, LM_theta}, {"theta", LM_TK_SYM, LM_theta, LMB_NONE},
{"tilde", LM_TK_DECORATION, LM_tilde}, {"tilde", LM_TK_DECORATION, LM_tilde, LMB_NONE},
{"times", LM_TK_SYM, LM_times}, {"times", LM_TK_SYM, LM_times, LMB_OPERATOR},
{"top", LM_TK_SYM, LM_top}, {"top", LM_TK_SYM, LM_top, LMB_NONE},
{"triangle", LM_TK_SYM, LM_triangle}, {"triangle", LM_TK_SYM, LM_triangle, LMB_NONE},
{"triangleleft", LM_TK_SYM, LM_triangleleft}, {"triangleleft", LM_TK_SYM, LM_triangleleft, LMB_OPERATOR},
{"triangleright", LM_TK_SYM, LM_triangleright}, {"triangleright", LM_TK_SYM, LM_triangleright, LMB_OPERATOR},
{"underbrace", LM_TK_DECORATION, LM_underbrace}, {"underbrace", LM_TK_DECORATION, LM_underbrace, LMB_NONE},
{"underline", LM_TK_DECORATION, LM_underline}, {"underline", LM_TK_DECORATION, LM_underline, LMB_NONE},
{"uparrow", LM_TK_SYM, LM_uparrow}, {"uparrow", LM_TK_SYM, LM_uparrow, LMB_NONE},
{"updownarrow", LM_TK_SYM, LM_updownarrow}, {"updownarrow", LM_TK_SYM, LM_updownarrow, LMB_NONE},
{"uplus", LM_TK_SYM, LM_uplus}, {"uplus", LM_TK_SYM, LM_uplus, LMB_OPERATOR},
{"upsilon", LM_TK_SYM, LM_upsilon}, {"upsilon", LM_TK_SYM, LM_upsilon, LMB_NONE},
{"varepsilon", LM_TK_SYM, LM_varepsilon}, {"varepsilon", LM_TK_SYM, LM_varepsilon, LMB_NONE},
{"varphi", LM_TK_SYM, LM_varphi}, {"varphi", LM_TK_SYM, LM_varphi, LMB_NONE},
{"varpi", LM_TK_SYM, LM_varpi}, {"varpi", LM_TK_SYM, LM_varpi, LMB_NONE},
{"varsigma", LM_TK_SYM, LM_varsigma}, {"varsigma", LM_TK_SYM, LM_varsigma, LMB_NONE},
{"vartheta", LM_TK_SYM, LM_vartheta}, {"vartheta", LM_TK_SYM, LM_vartheta, LMB_NONE},
{"vdash", LM_TK_SYM, LM_vdash}, {"vdash", LM_TK_SYM, LM_vdash, LMB_RELATION},
{"vdots", LM_TK_DOTS, LM_vdots}, {"vdots", LM_TK_DOTS, LM_vdots, LMB_NONE},
{"vec", LM_TK_DECORATION, LM_vec}, {"vec", LM_TK_DECORATION, LM_vec, LMB_NONE},
{"vee", LM_TK_SYM, LM_vee}, {"vee", LM_TK_SYM, LM_vee, LMB_OPERATOR},
{"wedge", LM_TK_SYM, LM_wedge}, {"wedge", LM_TK_SYM, LM_wedge, LMB_OPERATOR},
{"widehat", LM_TK_DECORATION, LM_widehat}, {"widehat", LM_TK_DECORATION, LM_widehat, LMB_NONE},
{"widetilde", LM_TK_DECORATION, LM_widetilde}, {"widetilde", LM_TK_DECORATION, LM_widetilde, LMB_NONE},
{"wp", LM_TK_SYM, LM_wp}, {"wp", LM_TK_SYM, LM_wp, LMB_NONE},
{"wr", LM_TK_SYM, LM_wr}, {"wr", LM_TK_SYM, LM_wr, LMB_OPERATOR},
{"xi", LM_TK_SYM, LM_xi}, {"xi", LM_TK_SYM, LM_xi, LMB_NONE},
{"zeta", LM_TK_SYM, LM_zeta}, {"zeta", LM_TK_SYM, LM_zeta, LMB_NONE},
}; };

View File

@ -639,8 +639,7 @@ void mathed_parse(MathArray & array, unsigned flags)
case LM_TK_SYM: case LM_TK_SYM:
if (yylval.l->id < 256) { if (yylval.l->id < 256) {
MathTextCodes c = static_cast<MathTextCodes>(yylval.l->id); MathTextCodes tc = yylval.l->bin == LMB_NONE ? LM_TC_SYMB : LM_TC_BOPS;
MathTextCodes tc = MathIsBOPS(c) ? LM_TC_BOPS : LM_TC_SYMB;
array.push_back(yylval.l->id, tc); array.push_back(yylval.l->id, tc);
} else } else
array.push_back(new MathFuncInset(yylval.l->name)); array.push_back(new MathFuncInset(yylval.l->name));

View File

@ -25,6 +25,7 @@
#include "LString.h" #include "LString.h"
#include "math_defs.h"
#include "symbol_def.h" #include "symbol_def.h"
class MathArray; class MathArray;
@ -107,6 +108,8 @@ struct latexkeys {
short token; short token;
/// ///
unsigned int id; unsigned int id;
///
MathBinaryTypes bin;
}; };

View File

@ -1,99 +0,0 @@
/*
* File: math_utils.C
* Purpose: X independent general mathed routines
* Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
* Created: August 1996
*
* Copyright: 1996, 1997 Alejandro Aguilar Sierra
*
* License: GNU GPL version 2 or later
*/
#include <algorithm>
#include "math_defs.h"
#include "symbol_def.h"
using std::sort;
using std::lower_bound;
namespace {
// This table includes all binary operators and relations
struct binary_op_pair {
short id;
short isrel;
};
binary_op_pair binary_op_table[] = {
{ LM_leq, LMB_RELATION }, { LM_geq, LMB_RELATION },
{ LM_equiv, LMB_RELATION }, { LM_models, LMB_RELATION },
{ LM_prec, LMB_RELATION }, { LM_succ, LMB_RELATION },
{ LM_sim, LMB_RELATION }, { LM_perp, LMB_RELATION },
{ LM_preceq, LMB_RELATION }, { LM_succeq, LMB_RELATION },
{ LM_simeq, LMB_RELATION }, { LM_mid, LMB_RELATION },
{ LM_ll, LMB_RELATION }, { LM_gg, LMB_RELATION },
{ LM_asymp, LMB_RELATION }, { LM_parallel, LMB_RELATION },
{ LM_subset, LMB_RELATION }, { LM_supset, LMB_RELATION },
{ LM_approx, LMB_RELATION }, { LM_smile, LMB_RELATION },
{ LM_subseteq, LMB_RELATION }, { LM_supseteq, LMB_RELATION },
{ LM_cong, LMB_RELATION }, { LM_frown, LMB_RELATION },
{ LM_sqsubseteq, LMB_RELATION }, { LM_sqsupseteq, LMB_RELATION },
{ LM_doteq, LMB_RELATION }, { LM_neq, LMB_RELATION },
{ LM_in, LMB_RELATION }, { LM_ni, LMB_RELATION },
{ LM_propto, LMB_RELATION }, { LM_notin, LMB_RELATION },
{ LM_vdash, LMB_RELATION }, { LM_dashv, LMB_RELATION },
{ LM_bowtie, LMB_RELATION },
{ LM_pm, LMB_OPERATOR }, { LM_cap, LMB_OPERATOR },
{ LM_diamond, LMB_OPERATOR }, { LM_oplus, LMB_OPERATOR },
{ LM_mp, LMB_OPERATOR }, { LM_cup, LMB_OPERATOR },
{ LM_bigtriangleup, LMB_OPERATOR }, { LM_ominus, LMB_OPERATOR },
{ LM_times, LMB_OPERATOR }, { LM_uplus, LMB_OPERATOR },
{ LM_bigtriangledown, LMB_OPERATOR }, { LM_otimes, LMB_OPERATOR },
{ LM_div, LMB_OPERATOR }, { LM_sqcap, LMB_OPERATOR },
{ LM_triangleright, LMB_OPERATOR }, { LM_oslash, LMB_OPERATOR },
{ LM_cdot, LMB_OPERATOR }, { LM_sqcup, LMB_OPERATOR },
{ LM_triangleleft, LMB_OPERATOR }, { LM_odot, LMB_OPERATOR },
{ LM_star, LMB_OPERATOR }, { LM_vee, LMB_OPERATOR },
{ LM_amalg, LMB_OPERATOR }, { LM_bigcirc, LMB_OPERATOR },
{ LM_setminus, LMB_OPERATOR }, { LM_wedge, LMB_OPERATOR },
{ LM_dagger, LMB_OPERATOR }, { LM_circ, LMB_OPERATOR },
{ LM_bullet, LMB_OPERATOR }, { LM_wr, LMB_OPERATOR },
{ LM_ddagger, LMB_OPERATOR }
};
struct comparator {
// used by sort and lower_bound
inline
int operator()(binary_op_pair const & a, binary_op_pair const & b) const
{
return a.id < b.id;
}
};
} // namespace anon
int MathLookupBOP(short id)
{
static int const bopCount =
sizeof(binary_op_table) / sizeof(binary_op_pair);
static bool issorted = false;
if (!issorted) {
sort(binary_op_table, binary_op_table + bopCount, comparator());
issorted = true;
}
binary_op_pair search_elem = { id, 0 };
binary_op_pair * res = lower_bound(binary_op_table,
binary_op_table + bopCount,
search_elem, comparator());
if (res != binary_op_table + bopCount && res->id == id)
return res->isrel;
else
return LMB_NONE;
}

View File

@ -1,8 +0,0 @@
// -*- C++ -*-
#ifndef MATHUTILS_H
#define MATHUTILS_H
int MathLookupBOP(short id);
#endif

View File

@ -9,7 +9,6 @@
#include "math_parser.h" #include "math_parser.h"
#include "Painter.h" #include "Painter.h"
#include "debug.h" #include "debug.h"
#include "math_utils.h"
using std::sort; using std::sort;
using std::lower_bound; using std::lower_bound;
@ -29,12 +28,6 @@ bool MathIsAlphaFont(MathTextCodes x)
} }
bool MathIsBOPS(MathTextCodes x)
{
return MathLookupBOP(x) != LMB_NONE;
}
bool MathIsBinary(MathTextCodes x) bool MathIsBinary(MathTextCodes x)
{ {
return x == LM_TC_BOP || x == LM_TC_BOPS; return x == LM_TC_BOP || x == LM_TC_BOPS;

View File

@ -29,7 +29,6 @@ int mathed_string_width(MathTextCodes type, MathStyles size, string const & s);
bool MathIsInset(MathTextCodes x); bool MathIsInset(MathTextCodes x);
bool MathIsAlphaFont(MathTextCodes x); bool MathIsAlphaFont(MathTextCodes x);
bool MathIsBOPS(MathTextCodes x);
bool MathIsSymbol(MathTextCodes x); bool MathIsSymbol(MathTextCodes x);
bool MathIsRelOp(unsigned char c, MathTextCodes f); bool MathIsRelOp(unsigned char c, MathTextCodes f);