Return to MathMLbuilder.c CVS log | Up to [Public] / Amaya / amaya |
1.1 cvs 1: /* 2: * 3: * (c) COPYRIGHT MIT and INRIA, 1996. 4: * Please first read the full copyright statement in file COPYRIGHT. 5: * 6: */ 7: 8: /* 9: * 10: * MathMLbuilder 11: * 12: * Author: V. Quint 13: */ 14: 15: 16: #define THOT_EXPORT extern 1.4 cvs 17: #include "amaya.h" 1.17 cvs 18: #include "undo.h" 1.1 cvs 19: 20: #include "Mathedit_f.h" 21: #include "XMLparser_f.h" 22: 23: #include "MathML.h" 24: #include "parser.h" 25: 26: #define EOS '\0' 27: #define SPACE ' ' 28: 1.15 cvs 29: typedef UCHAR_T MathEntityName[20]; 1.1 cvs 30: typedef struct _MathEntity 31: { /* a Math entity representing an operator char */ 32: MathEntityName MentityName; /* entity name */ 33: int charCode; /* decimal code of char */ 1.15 cvs 34: CHAR_T alphabet; /* 'L' = ISO-Latin-1, 'G' = Symbol */ 1.1 cvs 35: } 36: MathEntity; 37: 38: static MathEntity MathEntityTable[] = 39: { 40: /* This table MUST be in alphabetical order */ 41: /* This table contains characters from the Symbol font plus some 42: specific MathML entities */ 43: {"Agr", 65, 'G'}, 1.9 cvs 44: {"And", 217, 'G'}, 1.1 cvs 45: {"ApplyFunction", 32, 'L'}, /* render as white space */ 1.9 cvs 46: {"Backslash", 92, 'L'}, 1.1 cvs 47: {"Bgr", 66, 'G'}, 48: {"Cap", 199, 'G'}, 1.9 cvs 49: {"CenterDot", 215, 'G'}, 50: {"CirclePlus", 197, 'G'}, 51: {"CircleTimes", 196, 'G'}, 52: {"Colon", 58, 'G'}, 53: {"Congruent", 64, 'G'}, 1.1 cvs 54: {"Cup", 200, 'G'}, 55: {"Delta", 68, 'G'}, 1.9 cvs 56: {"Diamond", 168, 'G'}, 57: {"DoubleDownArrow", 223, 'G'}, 58: {"DoubleLeftArrow", 220, 'G'}, 59: {"DoubleLeftRightArrow", 219, 'G'}, 60: {"DoubleRightArrow", 222, 'G'}, 61: {"DoubleUpArrow", 221, 'G'}, 62: {"DownArrow", 175, 'G'}, 63: {"DownTee", 94, 'G'}, 1.1 cvs 64: {"EEgr", 72, 'G'}, 65: {"Egr", 69, 'G'}, 1.9 cvs 66: {"Element", 206, 'G'}, 67: {"Equal", 61, 'L'}, 68: {"EqualTilde", 64, 'G'}, 69: {"Exists", 36, 'G'}, 70: {"ForAll", 34, 'G'}, 1.1 cvs 71: {"Gamma", 71, 'G'}, 1.9 cvs 72: {"GreaterEqual", 179, 'G'}, 1.1 cvs 73: {"Igr", 73, 'G'}, 74: {"Integral", 242, 'G'}, 1.9 cvs 75: {"Intersection", 199, 'G'}, 1.1 cvs 76: {"InvisibleTimes", 0, SPACE}, 77: {"Kgr", 75, 'G'}, 78: {"KHgr", 67, 'G'}, 79: {"Lambda", 76, 'G'}, 80: {"LeftArrow", 172, 'G'}, 1.9 cvs 81: {"LeftRightArrow", 171, 'G'}, 1.1 cvs 82: {"Mgr", 77, 'G'}, 83: {"Ngr", 78, 'G'}, 1.11 cvs 84: {"NonBreakingSpace", 160, 'L'}, 1.9 cvs 85: {"Not", 216, 'G'}, 86: {"NotElement", 207, 'G'}, 87: {"NotEqual", 185, 'G'}, 88: {"NotSubset", 203, 'G'}, 1.1 cvs 89: {"Ogr", 79, 'G'}, 90: {"Omega", 87, 'G'}, 1.9 cvs 91: {"Or", 218, 'G'}, 1.1 cvs 92: {"PI", 213, 'G'}, 1.9 cvs 93: {"PartialD", 182, 'G'}, 1.1 cvs 94: {"Phi", 70, 'G'}, 95: {"Pi", 80, 'G'}, 96: {"PlusMinus", 177, 'G'}, 1.9 cvs 97: {"Product", 213, 'G'}, 98: {"Proportional", 181, 'G'}, 1.1 cvs 99: {"Psi", 89, 'G'}, 100: {"Rgr", 82, 'G'}, 101: {"RightArrow", 174, 'G'}, 102: {"Sigma", 83, 'G'}, 103: {"Sol", 164, 'G'}, 1.9 cvs 104: {"Star", 42, 'L'}, 105: {"Subset", 204, 'G'}, 106: {"SubsetEqual", 205, 'G'}, 107: {"SuchThat", 39, 'G'}, 1.1 cvs 108: {"Sum", 229, 'G'}, 1.9 cvs 109: {"Superset", 201, 'G'}, 110: {"SupersetEqual", 202, 'G'}, 1.1 cvs 111: {"Tgr", 84, 'G'}, 1.9 cvs 112: {"Therefore", 92, 'G'}, 1.1 cvs 113: {"Theta", 81, 'G'}, 1.9 cvs 114: {"Tilde", 126, 'L'}, 115: {"TripleDot", 188, 'G'}, 116: {"Union", 200, 'G'}, 117: {"UpArrow", 173, 'G'}, 1.1 cvs 118: {"Upsi", 85, 'G'}, 119: {"Upsi1", 161, 'G'}, 1.13 cvs 120: {"Vee", 218, 'G'}, 1.1 cvs 121: {"Verbar", 189, 'G'}, 1.9 cvs 122: {"VerticalBar", 124, 'L'}, 1.1 cvs 123: {"Xi", 88, 'G'}, 124: {"Zgr", 90, 'G'}, 125: {"af", 32, 'L'}, /* render as white space */ 126: {"aleph", 192, 'G'}, 127: {"alpha", 97, 'G'}, 128: {"and", 217, 'G'}, 129: {"angle", 208, 'G'}, 130: {"ap", 187, 'G'}, 131: {"beta", 98, 'G'}, 132: {"bottom", 94, 'G'}, 133: {"bull", 183, 'G'}, 134: {"cap", 199, 'G'}, 135: {"chi", 99, 'G'}, 136: {"clubs", 167, 'G'}, 137: {"cong", 64, 'G'}, 138: {"copysf", 211, 'G'}, 139: {"copyssf", 227, 'G'}, 140: {"cr", 191, 'G'}, 141: {"cup", 200, 'G'}, 142: {"darr", 175, 'G'}, 143: {"dArr", 223, 'G'}, 144: {"dd", 100, 'L'}, 145: {"deg", 176, 'G'}, 146: {"delta", 100, 'G'}, 147: {"diams", 168, 'G'}, 148: {"divide", 184, 'G'}, 149: {"dtri", 209, 'G'}, 150: {"ee", 101, 'L'}, 151: {"empty", 198, 'G'}, 152: {"emsp", 32, 'G'}, 153: {"epsiv", 101, 'G'}, 154: {"equiv", 186, 'G'}, 155: {"eta", 104, 'G'}, 156: {"exist", 36, 'G'}, 157: {"florin", 166, 'G'}, 158: {"forall", 34, 'G'}, 159: {"gamma", 103, 'G'}, 160: {"ge", 179, 'G'}, 161: {"gt", 62, 'L'}, 162: {"hearts", 169, 'G'}, 163: {"horbar", 190, 'G'}, 1.8 cvs 164: {"ifraktur", 193, 'G'}, 1.1 cvs 165: {"infin", 165, 'G'}, 166: {"int", 242, 'G'}, 167: {"iota", 105, 'G'}, 168: {"isin", 206, 'G'}, 169: {"it", 242, 'G'}, 170: {"kappa", 107, 'G'}, 171: {"lambda", 108, 'G'}, 172: {"lang", 225, 'G'}, 173: {"larr", 172, 'G'}, 174: {"lArr", 220, 'G'}, 175: {"le", 163, 'G'}, 176: {"lowbar", 95, 'G'}, 177: {"loz", 224, 'G'}, 178: {"lrarr", 171, 'G'}, 179: {"lrArr", 219, 'G'}, 180: {"lsqb", 91, 'G'}, 1.6 cvs 181: {"lt", 60, 'L'}, 1.1 cvs 182: {"middot", 215, 'G'}, 183: {"mldr", 188, 'G'}, 184: {"mu", 109, 'G'}, 185: {"ne", 185, 'G'}, 186: {"not", 216, 'G'}, 187: {"notin", 207, 'G'}, 1.8 cvs 188: {"nu", 110, 'G'}, 1.1 cvs 189: {"ogr", 111, 'G'}, 190: {"omega", 119, 'G'}, 191: {"oplus", 197, 'G'}, 192: {"or", 218, 'G'}, 193: {"otimes", 196, 'G'}, 194: {"part", 182, 'G'}, 195: {"phi", 102, 'G'}, 196: {"phiv", 106, 'G'}, 197: {"pi", 112, 'G'}, 198: {"piv", 118, 'G'}, 199: {"prop", 181, 'G'}, 200: {"psi", 121, 'G'}, 201: {"radic", 214, 'G'}, 202: {"rarr", 174, 'G'}, 203: {"rArr", 222, 'G'}, 204: {"rdquo", 178, 'G'}, 205: {"regsf", 210, 'G'}, 206: {"regssf", 226, 'G'}, 207: {"rfraktur", 194, 'G'}, 208: {"rho", 114, 'G'}, 209: {"rsqb", 93, 'G'}, 210: {"sigma", 115, 'G'}, 211: {"sigmav", 86, 'G'}, 212: {"spades", 170, 'G'}, 213: {"sub", 204, 'G'}, 214: {"sube", 205, 'G'}, 215: {"subne", 203, 'G'}, 216: {"sum", 229, 'G'}, 217: {"sup", 201, 'G'}, 218: {"supe", 202, 'G'}, 219: {"tau", 116, 'G'}, 220: {"there4", 92, 'G'}, 221: {"theta", 113, 'G'}, 222: {"thetav", 74, 'G'}, 223: {"thickspace", 32, 'L'}, 224: {"times", 180, 'G'}, 225: {"trade", 212, 'G'}, 226: {"tradesf", 212, 'G'}, 227: {"tradessf", 228, 'G'}, 228: {"uarr", 173, 'G'}, 229: {"uArr", 221, 'G'}, 230: {"upsi", 117, 'G'}, 1.13 cvs 231: {"vee", 218, 'G'}, 1.1 cvs 232: {"weierp", 195, 'G'}, 233: {"xi", 120, 'G'}, 234: {"zeta", 122, 'G'}, 235: {"zzzz", -1, SPACE} /* this last entry is required */ 236: }; 237: 238: /* mapping table of MathML elements */ 239: 240: static ElemMapping MathMLElemMappingTable[] = 241: { 242: /* This table MUST be in alphabetical order */ 243: {"XMLcomment", SPACE, MathML_EL_XMLcomment}, 244: {"XMLcomment_line", SPACE, MathML_EL_XMLcomment_line}, 1.19 cvs 245: {"maction", SPACE, MathML_EL_MACTION}, 1.5 cvs 246: {"maligngroup", 'E', MathML_EL_MALIGNGROUP}, 247: {"malignmark", 'E', MathML_EL_MALIGNMARK}, 1.1 cvs 248: {"merror", SPACE, MathML_EL_MERROR}, 249: {"mf", SPACE, MathML_EL_MF}, /* for compatibility with an old version of 250: MathML: WD-math-970704 */ 251: {"mfenced", SPACE, MathML_EL_MFENCED}, 252: {"mfrac", SPACE, MathML_EL_MFRAC}, 253: {"mi", SPACE, MathML_EL_MI}, 254: {"mmultiscripts", SPACE, MathML_EL_MMULTISCRIPTS}, 255: {"mn", SPACE, MathML_EL_MN}, 256: {"mo", SPACE, MathML_EL_MO}, 257: {"mover", SPACE, MathML_EL_MOVER}, 258: {"mpadded", SPACE, MathML_EL_MPADDED}, 259: {"mphantom", SPACE, MathML_EL_MPHANTOM}, 260: {"mprescripts", SPACE, MathML_EL_PrescriptPairs}, 261: {"mroot", SPACE, MathML_EL_MROOT}, 262: {"mrow", SPACE, MathML_EL_MROW}, 263: {"ms", SPACE, MathML_EL_MS}, 264: {"mspace", 'E', MathML_EL_MSPACE}, 265: {"msqrt", SPACE, MathML_EL_MSQRT}, 266: {"mstyle", SPACE, MathML_EL_MSTYLE}, 267: {"msub", SPACE, MathML_EL_MSUB}, 268: {"msubsup", SPACE, MathML_EL_MSUBSUP}, 269: {"msup", SPACE, MathML_EL_MSUP}, 1.5 cvs 270: {"mtable", SPACE, MathML_EL_MTABLE}, 271: {"mtd", SPACE, MathML_EL_MTD}, 1.1 cvs 272: {"mtext", SPACE, MathML_EL_MTEXT}, 1.5 cvs 273: {"mtr", SPACE, MathML_EL_MTR}, 1.1 cvs 274: {"munder", SPACE, MathML_EL_MUNDER}, 275: {"munderover", SPACE, MathML_EL_MUNDEROVER}, 276: {"none", SPACE, MathML_EL_Construct}, 277: {"sep", 'E', MathML_EL_SEP}, 278: {"", SPACE, 0} /* Last entry. Mandatory */ 279: }; 280: 281: static AttributeMapping MathMLAttributeMappingTable[] = 282: { 283: /* The first entry MUST be unknown_attr */ 284: /* The rest of this table MUST be in alphabetical order */ 285: {"unknown_attr", "", 'A', MathML_ATTR_Invalid_attribute}, 286: {"ZZGHOST", "", 'A', MathML_ATTR_Ghost_restruct}, 287: 1.21 cvs 288: {"accent", "", 'A', MathML_ATTR_accent}, 1.22 ! cvs 289: {"accentunder", "", 'A', MathML_ATTR_accentunder}, ! 290: {"actiontype", "", 'A', MathML_ATTR_actiontype}, ! 291: {"align", "", 'A', MathML_ATTR_align}, ! 292: {"alignmentscope", "", 'A', MathML_ATTR_alignmentscope}, ! 293: {"background", "", 'A', MathML_ATTR_background_}, 1.20 cvs 294: {"class", "", 'A', MathML_ATTR_class}, 1.22 ! cvs 295: {"close", "", 'A', MathML_ATTR_close}, ! 296: {"columnalign", "", 'A', MathML_ATTR_columnalign}, ! 297: {"columnlines", "", 'A', MathML_ATTR_columnlines}, ! 298: {"columnspacing", "", 'A', MathML_ATTR_columnspacing}, ! 299: {"columnspan", "", 'A', MathML_ATTR_columnspan}, 1.21 cvs 300: {"color", "", 'A', MathML_ATTR_color}, 1.22 ! cvs 301: {"depth", "", 'A', MathML_ATTR_depth_}, ! 302: {"displaystyle", "", 'A', MathML_ATTR_displaystyle}, ! 303: {"edge", "", 'A', MathML_ATTR_edge}, ! 304: {"equalcolumns", "", 'A', MathML_ATTR_equalcolumns}, ! 305: {"equalrows", "", 'A', MathML_ATTR_equalrows}, 1.21 cvs 306: {"fence", "", 'A', MathML_ATTR_fence}, 307: {"fontfamily", "", 'A', MathML_ATTR_fontfamily}, 308: {"fontstyle", "", 'A', MathML_ATTR_fontstyle}, 309: {"fontsize", "", 'A', MathML_ATTR_fontsize}, 310: {"fontweight", "", 'A', MathML_ATTR_fontweight}, 311: {"form", "", 'A', MathML_ATTR_form}, 1.22 ! cvs 312: {"frame", "", 'A', MathML_ATTR_frame}, ! 313: {"framespacing", "", 'A', MathML_ATTR_framespacing}, ! 314: {"groupalign", "", 'A', MathML_ATTR_groupalign}, ! 315: {"height", "", 'A', MathML_ATTR_height_}, 1.20 cvs 316: {"id", "", 'A', MathML_ATTR_id}, 1.21 cvs 317: {"largeop", "", 'A', MathML_ATTR_largeop}, 1.22 ! cvs 318: {"linethickness", "", 'A', MathML_ATTR_linethickness}, 1.7 cvs 319: {"link", "", 'A', MathML_ATTR_link}, 1.22 ! cvs 320: {"lquote", "", 'A', MathML_ATTR_lquote}, 1.21 cvs 321: {"lspace", "", 'A', MathML_ATTR_lspace}, 322: {"maxsize", "", 'A', MathML_ATTR_maxsize}, 323: {"minsize", "", 'A', MathML_ATTR_minsize}, 324: {"movablelimits", "", 'A', MathML_ATTR_movablelimits}, 1.22 ! cvs 325: {"open", "", 'A', MathML_ATTR_open}, 1.20 cvs 326: {"other", "", 'A', MathML_ATTR_other}, 1.22 ! cvs 327: {"rowalign", "", 'A', MathML_ATTR_rowalign}, ! 328: {"rowlines", "", 'A', MathML_ATTR_rowlines}, ! 329: {"rowspacing", "", 'A', MathML_ATTR_rowspacing}, ! 330: {"rowspan", "", 'A', MathML_ATTR_rowspan_}, ! 331: {"rquote", "", 'A', MathML_ATTR_rquote}, 1.21 cvs 332: {"rspace", "", 'A', MathML_ATTR_rspace}, 1.22 ! cvs 333: {"scriptlevel", "", 'A', MathML_ATTR_scriptlevel}, ! 334: {"scriptminsize", "", 'A', MathML_ATTR_scriptminsize}, ! 335: {"scriptsizemultiplier", "", 'A', MathML_ATTR_scriptsizemultiplier}, ! 336: {"selection", "", 'A', MathML_ATTR_selection}, 1.21 cvs 337: {"separator", "", 'A', MathML_ATTR_separator}, 1.22 ! cvs 338: {"separators", "", 'A', MathML_ATTR_separators}, 1.21 cvs 339: {"stretchy", "", 'A', MathML_ATTR_stretchy}, 1.20 cvs 340: {"style", "", 'A', MathML_ATTR_style_}, 1.22 ! cvs 341: {"subscriptshift", "", 'A', MathML_ATTR_subscriptshift}, ! 342: {"superscriptshift", "", 'A', MathML_ATTR_superscriptshift}, 1.21 cvs 343: {"symmetric", "", 'A', MathML_ATTR_symmetric}, 1.22 ! cvs 344: {"width", "", 'A', MathML_ATTR_width_}, 1.1 cvs 345: 346: {"", "", EOS, 0} /* Last entry. Mandatory */ 347: }; 348: 349: /* mapping table of attribute values */ 350: 351: static AttrValueMapping MathMLAttrValueMappingTable[] = 352: { 1.21 cvs 353: {MathML_ATTR_accent, "true", MathML_ATTR_accent_VAL_true}, 354: {MathML_ATTR_accent, "false", MathML_ATTR_accent_VAL_false}, 355: 1.22 ! cvs 356: {MathML_ATTR_accentunder, "true", MathML_ATTR_accentunder_VAL_true}, ! 357: {MathML_ATTR_accentunder, "false", MathML_ATTR_accentunder_VAL_false}, ! 358: ! 359: {MathML_ATTR_displaystyle, "true", MathML_ATTR_displaystyle_VAL_true}, ! 360: {MathML_ATTR_displaystyle, "false", MathML_ATTR_displaystyle_VAL_false}, ! 361: ! 362: {MathML_ATTR_edge, "left", MathML_ATTR_edge_VAL_left_}, ! 363: {MathML_ATTR_edge, "right", MathML_ATTR_edge_VAL_right_}, ! 364: 1.1 cvs 365: {MathML_ATTR_fence, "true", MathML_ATTR_fence_VAL_true}, 366: {MathML_ATTR_fence, "false", MathML_ATTR_fence_VAL_false}, 1.21 cvs 367: 1.1 cvs 368: {MathML_ATTR_fontstyle, "italic", MathML_ATTR_fontstyle_VAL_italic}, 369: {MathML_ATTR_fontstyle, "normal", MathML_ATTR_fontstyle_VAL_normal}, 1.21 cvs 370: 371: {MathML_ATTR_fontweight, "bold", MathML_ATTR_fontweight_VAL_bold_}, 372: {MathML_ATTR_fontweight, "normal", MathML_ATTR_fontweight_VAL_normal}, 373: 374: {MathML_ATTR_form, "prefix", MathML_ATTR_form_VAL_prefix}, 375: {MathML_ATTR_form, "infix", MathML_ATTR_form_VAL_infix}, 376: {MathML_ATTR_form, "postfix", MathML_ATTR_form_VAL_postfix}, 377: 1.22 ! cvs 378: {MathML_ATTR_frame, "none", MathML_ATTR_frame_VAL_none}, ! 379: {MathML_ATTR_frame, "solid", MathML_ATTR_frame_VAL_solid_}, ! 380: {MathML_ATTR_frame, "dashed", MathML_ATTR_frame_VAL_dashed_}, ! 381: 1.21 cvs 382: {MathML_ATTR_largeop, "true", MathML_ATTR_largeop_VAL_true}, 383: {MathML_ATTR_largeop, "false", MathML_ATTR_largeop_VAL_false}, 384: 1.7 cvs 385: {MathML_ATTR_link, "document", MathML_ATTR_link_VAL_document}, 386: {MathML_ATTR_link, "extended", MathML_ATTR_link_VAL_extended}, 387: {MathML_ATTR_link, "group", MathML_ATTR_link_VAL_group}, 388: {MathML_ATTR_link, "locator", MathML_ATTR_link_VAL_locator}, 389: {MathML_ATTR_link, "simple", MathML_ATTR_link_VAL_simple}, 1.21 cvs 390: 391: {MathML_ATTR_movablelimits, "true", MathML_ATTR_movablelimits_VAL_true}, 392: {MathML_ATTR_movablelimits, "false", MathML_ATTR_movablelimits_VAL_false}, 393: 394: {MathML_ATTR_separator, "true", MathML_ATTR_separator_VAL_true}, 395: {MathML_ATTR_separator, "false", MathML_ATTR_separator_VAL_false}, 396: 397: {MathML_ATTR_stretchy, "true", MathML_ATTR_stretchy_VAL_true}, 398: {MathML_ATTR_stretchy, "false", MathML_ATTR_stretchy_VAL_false}, 399: 400: {MathML_ATTR_symmetric, "true", MathML_ATTR_symmetric_VAL_true}, 401: {MathML_ATTR_symmetric, "false", MathML_ATTR_symmetric_VAL_false}, 1.1 cvs 402: 403: {0, "", 0} /* Last entry. Mandatory */ 404: }; 405: 406: #define MaxMsgLength 200 407: 1.12 cvs 408: #include "HTMLtable_f.h" 409: 1.1 cvs 410: /*---------------------------------------------------------------------- 1.2 cvs 411: GetMathMLSSchema returns the MathML Thot schema for document doc. 1.1 cvs 412: ----------------------------------------------------------------------*/ 413: #ifdef __STDC__ 1.2 cvs 414: SSchema GetMathMLSSchema (Document doc) 1.1 cvs 415: #else 1.2 cvs 416: SSchema GetMathMLSSchema (doc) 1.1 cvs 417: Document doc; 418: 419: #endif 420: { 1.2 cvs 421: SSchema MathMLSSchema; 422: 423: MathMLSSchema = TtaGetSSchema ("MathML", doc); 1.1 cvs 424: if (MathMLSSchema == NULL) 425: MathMLSSchema = TtaNewNature(TtaGetDocumentSSchema(doc), "MathML", "MathMLP"); 1.2 cvs 426: return (MathMLSSchema); 1.1 cvs 427: } 428: 429: 430: /*---------------------------------------------------------------------- 431: MapMathMLElementType 432: search in the mapping tables the entry for the element type of 433: name XMLname and returns the corresponding Thot element type. 434: Returns -1 and schema = NULL if not found. 435: ----------------------------------------------------------------------*/ 436: #ifdef __STDC__ 1.14 cvs 437: void MapMathMLElementType (STRING XMLname, ElementType *elType, STRING* mappedName, STRING content, Document doc) 1.1 cvs 438: #else 1.2 cvs 439: void MapMathMLElementType (XMLname, elType, mappedName, content, doc) 1.14 cvs 440: STRING XMLname; 1.1 cvs 441: ElementType *elType; 1.14 cvs 442: USTRING* mappedName; 443: STRING content; 1.2 cvs 444: Document doc; 1.1 cvs 445: #endif 446: { 447: int i; 448: 449: elType->ElTypeNum = 0; 450: /* search in MathMLElemMappingTable */ 451: i = 0; 452: do 1.14 cvs 453: if (ustrcasecmp (MathMLElemMappingTable[i].XMLname, XMLname)) 1.1 cvs 454: i++; 455: else 456: { 457: elType->ElTypeNum = MathMLElemMappingTable[i].ThotType; 1.3 cvs 458: if (elType->ElSSchema == NULL) 459: elType->ElSSchema = GetMathMLSSchema (doc); 1.1 cvs 460: *mappedName = MathMLElemMappingTable[i].XMLname; 461: *content = MathMLElemMappingTable[i].XMLcontents; 462: } 463: while (elType->ElTypeNum <= 0 && MathMLElemMappingTable[i].XMLname[0] != EOS); 464: } 465: 466: /*---------------------------------------------------------------------- 467: GetMathMLElementName 468: search in the mapping tables the XML name for a given Thot type 469: ----------------------------------------------------------------------*/ 470: #ifdef __STDC__ 1.14 cvs 471: void GetMathMLElementName (ElementType elType, STRING *buffer) 1.1 cvs 472: #else 473: void GetMathMLElementName (elType, buffer) 474: ElementType elType; 1.14 cvs 475: STRING buffer; 1.1 cvs 476: 477: #endif 478: { 479: int i; 480: 481: if (elType.ElTypeNum > 0) 482: { 483: i = 0; 1.14 cvs 484: if (ustrcmp ("MathML", TtaGetSSchemaName (elType.ElSSchema)) == 0) 1.1 cvs 485: do 486: { 487: if (MathMLElemMappingTable[i].ThotType == elType.ElTypeNum) 488: { 1.16 cvs 489: *buffer = MathMLElemMappingTable[i].XMLname; 1.1 cvs 490: return; 491: } 492: i++; 493: } 494: while (MathMLElemMappingTable[i].XMLname[0] != EOS); 495: } 496: *buffer = "???"; 497: return; 498: } 499: 500: /*---------------------------------------------------------------------- 501: MapMathMLAttribute 502: Search in the Attribute Mapping Table the entry for the 503: attribute of name Attr and returns the corresponding Thot attribute type. 504: ----------------------------------------------------------------------*/ 505: #ifdef __STDC__ 1.14 cvs 506: void MapMathMLAttribute (STRING Attr, AttributeType *attrType, STRING elementName, Document doc) 1.1 cvs 507: #else 1.2 cvs 508: void MapMathMLAttribute (Attr, attrType, elementName, doc) 1.14 cvs 509: STRING Attr; 1.1 cvs 510: AttributeType *attrType; 1.14 cvs 511: STRING elementName; 1.2 cvs 512: Document doc; 1.1 cvs 513: #endif 514: { 515: int i; 516: 517: attrType->AttrTypeNum = 0; 518: attrType->AttrSSchema = NULL; 519: i = 0; 520: do 1.14 cvs 521: if (ustrcasecmp (MathMLAttributeMappingTable[i].XMLattribute, Attr)) 1.1 cvs 522: i++; 523: else 524: if (MathMLAttributeMappingTable[i].XMLelement[0] == EOS) 525: { 526: attrType->AttrTypeNum = MathMLAttributeMappingTable[i].ThotAttribute; 1.2 cvs 527: attrType->AttrSSchema = GetMathMLSSchema (doc); 1.1 cvs 528: } 1.14 cvs 529: else if (!ustrcasecmp (MathMLAttributeMappingTable[i].XMLelement, 1.1 cvs 530: elementName)) 531: { 532: attrType->AttrTypeNum = MathMLAttributeMappingTable[i].ThotAttribute; 1.2 cvs 533: attrType->AttrSSchema = GetMathMLSSchema (doc); 1.1 cvs 534: } 535: else 536: i++; 537: while (attrType->AttrTypeNum <= 0 && MathMLAttributeMappingTable[i].AttrOrContent != EOS); 538: } 539: 540: /*---------------------------------------------------------------------- 541: MapMathMLAttributeValue 542: Search in the Attribute Value Mapping Table the entry for the attribute 543: ThotAtt and its value AttrVal. Returns the corresponding Thot value. 544: ----------------------------------------------------------------------*/ 545: #ifdef __STDC__ 1.14 cvs 546: void MapMathMLAttributeValue (STRING AttrVal, AttributeType attrType, int *value) 1.1 cvs 547: #else 548: void MapMathMLAttributeValue (AttrVal, attrType, value) 1.14 cvs 549: STRING AttrVal; 1.1 cvs 550: AttributeType attrType; 551: int *value; 552: #endif 553: { 554: int i; 555: 556: *value = 0; 557: i = 0; 558: while (MathMLAttrValueMappingTable[i].ThotAttr != attrType.AttrTypeNum && 559: MathMLAttrValueMappingTable[i].ThotAttr != 0) 560: i++; 561: if (MathMLAttrValueMappingTable[i].ThotAttr == attrType.AttrTypeNum) 562: do 1.14 cvs 563: if (!ustrcasecmp (MathMLAttrValueMappingTable[i].XMLattrValue, AttrVal)) 1.1 cvs 564: *value = MathMLAttrValueMappingTable[i].ThotAttrValue; 565: else 566: i++; 567: while (*value <= 0 && MathMLAttrValueMappingTable[i].ThotAttr != 0); 568: } 569: 570: /*---------------------------------------------------------------------- 571: MapMathMLEntity 572: Search that entity in the entity table and return the corresponding value. 573: ----------------------------------------------------------------------*/ 574: #ifdef __STDC__ 1.14 cvs 575: void MapMathMLEntity (STRING entityName, STRING entityValue, int valueLength, STRING alphabet) 1.1 cvs 576: #else 577: void MapMathMLEntity (entityName, entityValue, valueLength, alphabet) 1.14 cvs 578: STRING entityName; 579: STRING entityValue; 1.1 cvs 580: int valueLength; 1.14 cvs 581: STRING alphabet; 1.1 cvs 582: 583: #endif 584: 585: { 586: int i; 587: 588: for (i = 0; MathEntityTable[i].charCode >= 0 && 1.14 cvs 589: ustrcmp (MathEntityTable[i].MentityName, entityName); 1.1 cvs 590: i++); 1.14 cvs 591: if (!ustrcmp (MathEntityTable[i].MentityName, entityName)) 1.1 cvs 592: /* entity found */ 593: { 1.15 cvs 594: entityValue[0] = (UCHAR_T) MathEntityTable[i].charCode; 1.1 cvs 595: entityValue[1] = EOS; 596: *alphabet = MathEntityTable[i].alphabet; 597: } 598: else 599: { 600: entityValue[0] = EOS; 601: *alphabet = EOS; 602: } 603: } 604: 605: /*---------------------------------------------------------------------- 606: MathMLEntityCreated 607: A MathML entity has been created by the XML parser. 608: Create a text element containing the entity name. 609: ----------------------------------------------------------------------*/ 610: #ifdef __STDC__ 1.14 cvs 611: void MathMLEntityCreated (USTRING entityValue, STRING entityName, Document doc) 1.1 cvs 612: #else 613: void MathMLEntityCreated (entityValue, entityName, doc) 1.14 cvs 614: USTRING entityValue; 615: STRING entityName; 1.1 cvs 616: Document doc; 617: 618: #endif 619: { 620: ElementType elType; 621: Element elText; 622: AttributeType attrType; 623: Attribute attr; 624: Language lang; 625: int len; 626: #define MAX_ENTITY_LENGTH 80 1.15 cvs 627: CHAR_T buffer[MAX_ENTITY_LENGTH]; 1.1 cvs 628: 1.14 cvs 629: if (ustrlen (entityValue) <= 1) 1.1 cvs 630: if (entityValue[0] == EOS || entityValue[0] == SPACE || 631: ((int)entityValue[0]) == 129 || /* thin space */ 632: ((int)entityValue[0]) == 130 || /* en space */ 633: ((int)entityValue[0]) == 160) /* sticky space */ 634: /* null character or space */ 635: /* create a text element containing the entity name with an 636: attribute entity */ 637: { 638: XMLTextToDocument (); 1.14 cvs 639: len = ustrlen (entityName); 1.1 cvs 640: if (len > MAX_ENTITY_LENGTH -3) 641: len = MAX_ENTITY_LENGTH -3; 642: buffer[0] = '&'; 1.14 cvs 643: ustrncpy (&buffer[1], entityName, len); 1.1 cvs 644: buffer[len+1] = ';'; 645: buffer[len+2] = EOS; 646: elType.ElTypeNum = MathML_EL_TEXT_UNIT; 1.2 cvs 647: elType.ElSSchema = GetMathMLSSchema (doc); 1.1 cvs 648: elText = TtaNewElement (doc, elType); 649: XMLInsertElement (elText); 650: lang = TtaGetLanguageIdFromAlphabet('L'); 651: TtaSetTextContent (elText, buffer, lang, doc); 1.2 cvs 652: attrType.AttrSSchema = GetMathMLSSchema (doc); 1.22 ! cvs 653: attrType.AttrTypeNum = MathML_ATTR_IntEntity; 1.1 cvs 654: attr = TtaNewAttribute (attrType); 655: TtaAttachAttribute (elText, attr, doc); 1.22 ! cvs 656: TtaSetAttributeValue (attr, MathML_ATTR_IntEntity_VAL_yes_, elText, doc); 1.1 cvs 657: } 658: } 659: 660: /*---------------------------------------------------------------------- 661: CheckTextElement Put the content of input buffer into the document. 662: ----------------------------------------------------------------------*/ 663: #ifdef __STDC__ 664: static void CheckTextElement (Element *el, Document doc) 665: #else 666: static void CheckTextElement (el, doc) 667: Element *el; 668: Document doc; 669: 670: #endif 671: { 672: ElementType parentType, elType; 673: Element parent, new; 674: int len; 675: Language lang; 1.15 cvs 676: CHAR_T alphabet; 677: CHAR_T text[4]; 1.1 cvs 678: 679: len = TtaGetTextLength (*el); 680: if (len == 1) 681: { 682: len = 2; 683: TtaGiveTextContent (*el, text, &len, &lang); 684: alphabet = TtaGetAlphabet (lang); 685: parent = TtaGetParent (*el); 686: if (text[0] != EOS) 687: { 688: parentType = TtaGetElementType (parent); 689: elType = parentType; 690: if (parentType.ElTypeNum == MathML_EL_MF && 691: (text[0] == '(' || 692: text[0] == ')' || 693: text[0] == '[' || 694: text[0] == ']' || 695: text[0] == '{' || 696: text[0] == '}')) 697: /* Transform the text element into a Thot SYMBOL */ 698: elType.ElTypeNum = MathML_EL_SYMBOL_UNIT; 699: else if (parentType.ElTypeNum == MathML_EL_MF && 700: text[0] == '|') 701: /* Transform the text element into a Thot GRAPHIC */ 702: { 703: elType.ElTypeNum = MathML_EL_GRAPHICS_UNIT; 704: text[0] = 'v'; 705: } 706: else 707: /* a TEXT element is OK */ 708: elType.ElTypeNum = MathML_EL_TEXT_UNIT; 709: if (elType.ElTypeNum != MathML_EL_TEXT_UNIT) 710: { 711: new = TtaNewElement (doc, elType); 712: TtaInsertSibling (new, *el, FALSE, doc); 713: TtaDeleteTree (*el, doc); 714: *el = new; 715: TtaSetGraphicsShape (new, text[0], doc); 716: } 717: } 718: } 719: } 720: 721: /*---------------------------------------------------------------------- 722: ElementNeedsPlaceholder 723: returns TRUE if element el needs a sibling placeholder. 724: ----------------------------------------------------------------------*/ 725: #ifdef __STDC__ 1.18 cvs 726: ThotBool ElementNeedsPlaceholder (Element el) 1.1 cvs 727: #else 1.18 cvs 728: ThotBool ElementNeedsPlaceholder (el) 1.1 cvs 729: Element el; 730: 731: #endif 732: { 733: ElementType elType; 734: Element child, parent; 1.18 cvs 735: ThotBool ret; 1.1 cvs 736: 737: ret = FALSE; 738: elType = TtaGetElementType (el); 739: if (elType.ElTypeNum == MathML_EL_MROW || 740: elType.ElTypeNum == MathML_EL_MF || 741: elType.ElTypeNum == MathML_EL_MFENCED || 1.19 cvs 742: elType.ElTypeNum == MathML_EL_MACTION || 1.1 cvs 743: elType.ElTypeNum == MathML_EL_MROOT || 744: elType.ElTypeNum == MathML_EL_MSQRT || 745: elType.ElTypeNum == MathML_EL_MFRAC || 746: elType.ElTypeNum == MathML_EL_MSUBSUP || 747: elType.ElTypeNum == MathML_EL_MSUB || 748: elType.ElTypeNum == MathML_EL_MSUP || 749: elType.ElTypeNum == MathML_EL_MUNDER || 750: elType.ElTypeNum == MathML_EL_MOVER || 751: elType.ElTypeNum == MathML_EL_MUNDEROVER || 752: elType.ElTypeNum == MathML_EL_MMULTISCRIPTS) 753: ret = TRUE; 754: else 755: if (elType.ElTypeNum == MathML_EL_MO) 756: /* an operator that contains a single Symbol needs a placeholder, 757: except when it is in a Base or UnderOverBase */ 758: { 759: child = TtaGetFirstChild (el); 760: if (child != NULL) 761: { 762: elType = TtaGetElementType (child); 763: if (elType.ElTypeNum == MathML_EL_SYMBOL_UNIT) 764: { 765: ret = TRUE; 766: parent = TtaGetParent (el); 767: if (parent != NULL) 768: { 769: elType = TtaGetElementType (parent); 770: if (elType.ElTypeNum == MathML_EL_Base || 771: elType.ElTypeNum == MathML_EL_UnderOverBase) 772: ret = FALSE; 773: } 774: } 775: } 776: } 777: return ret; 778: } 779: 780: /*---------------------------------------------------------------------- 781: CreatePlaceholders 782: ----------------------------------------------------------------------*/ 783: #ifdef __STDC__ 784: static void CreatePlaceholders (Element el, Document doc) 785: #else 786: static void CreatePlaceholders (el, doc) 787: Element el; 788: Document doc; 789: #endif 790: { 791: Element sibling, prev, constr, child; 792: Attribute attr; 793: ElementType elType; 794: AttributeType attrType; 1.18 cvs 795: ThotBool create; 1.1 cvs 796: 1.2 cvs 797: elType.ElSSchema = GetMathMLSSchema (doc); 1.1 cvs 798: prev = NULL; 799: create = TRUE; 800: sibling = el; 801: while (sibling != NULL) 802: { 803: if (!ElementNeedsPlaceholder (sibling)) 804: create = FALSE; 805: else 806: { 807: if (sibling == el) 808: /* first element */ 809: { 810: elType = TtaGetElementType (sibling); 811: if (elType.ElTypeNum == MathML_EL_MF) 812: /* the first element is a MF. Don't create a placeholder 813: before */ 814: create = FALSE; 815: else if (elType.ElTypeNum == MathML_EL_MROW) 816: /* the first element is a MROW */ 817: { 818: child = TtaGetFirstChild (sibling); 819: if (child != NULL) 820: { 821: elType = TtaGetElementType (child); 822: if (elType.ElTypeNum != MathML_EL_MF) 823: /* the first child of the MROW element is not a MF */ 824: /* Don't create a placeholder before */ 825: create = FALSE; 826: } 827: } 828: } 829: if (create) 830: { 831: elType.ElTypeNum = MathML_EL_Construct; 832: constr = TtaNewElement (doc, elType); 833: TtaInsertSibling (constr, sibling, TRUE, doc); 834: attrType.AttrSSchema = elType.ElSSchema; 1.22 ! cvs 835: attrType.AttrTypeNum = MathML_ATTR_IntPlaceholder; 1.1 cvs 836: attr = TtaNewAttribute (attrType); 837: TtaAttachAttribute (constr, attr, doc); 1.22 ! cvs 838: TtaSetAttributeValue (attr, MathML_ATTR_IntPlaceholder_VAL_yes_, constr, doc); 1.1 cvs 839: } 840: create = TRUE; 841: } 842: prev = sibling; 843: TtaNextSibling (&sibling); 844: } 845: if (prev != NULL && create) 846: { 847: elType = TtaGetElementType (prev); 848: /* don't insert a placeholder after the last element if it's a MF 849: or a SEP */ 850: if (elType.ElTypeNum == MathML_EL_MF || 851: elType.ElTypeNum == MathML_EL_SEP) 852: create = FALSE; 853: else if (elType.ElTypeNum == MathML_EL_MROW) 854: /* the last element is a MROW */ 855: { 856: child = TtaGetLastChild (prev); 857: if (child != NULL) 858: { 859: elType = TtaGetElementType (child); 860: if (elType.ElTypeNum != MathML_EL_MF) 861: /* the last child of the MROW element is not a MF */ 862: /* Don't create a placeholder before */ 863: create = FALSE; 864: } 865: } 866: if (create) 867: { 868: elType.ElTypeNum = MathML_EL_Construct; 869: constr = TtaNewElement (doc, elType); 870: TtaInsertSibling (constr, prev, FALSE, doc); 871: attrType.AttrSSchema = elType.ElSSchema; 1.22 ! cvs 872: attrType.AttrTypeNum = MathML_ATTR_IntPlaceholder; 1.1 cvs 873: attr = TtaNewAttribute (attrType); 874: TtaAttachAttribute (constr, attr, doc); 1.22 ! cvs 875: TtaSetAttributeValue (attr, MathML_ATTR_IntPlaceholder_VAL_yes_, constr, doc); 1.1 cvs 876: } 877: } 878: } 879: 880: /*---------------------------------------------------------------------- 881: NextNotSep 882: Return the next sibling of element el that is not a SEP element 883: Return el itself if it's not a SEP 884: ----------------------------------------------------------------------*/ 885: #ifdef __STDC__ 886: static void NextNotSep (Element* el, Element* prev) 887: #else 888: static void NextNotSep (el, prev) 889: Element *el; 890: #endif 891: { 892: ElementType elType; 893: 894: if (*el == NULL) 895: return; 896: elType = TtaGetElementType (*el); 897: while (*el != NULL && elType.ElTypeNum == MathML_EL_SEP) 898: { 899: *prev = *el; 900: TtaNextSibling (el); 901: if (*el != NULL) 902: elType = TtaGetElementType (*el); 903: } 904: } 905: 906: /*---------------------------------------------------------------------- 907: CheckMathSubExpressions 908: Children of element el should be of type type1, type2, and type3. 909: Create an element of that type. 910: ----------------------------------------------------------------------*/ 911: #ifdef __STDC__ 912: static void CheckMathSubExpressions (Element el, int type1, int type2, int type3, Document doc) 913: #else 914: static void CheckMathSubExpressions (el, type1, type2, type3, doc) 915: Element el; 916: int type1; 917: int type2; 918: int type3; 919: Document doc; 920: #endif 921: { 922: Element child, new, prev; 923: ElementType elType, childType; 924: 1.2 cvs 925: elType.ElSSchema = GetMathMLSSchema (doc); 1.1 cvs 926: child = TtaGetFirstChild (el); 927: prev = NULL; 928: NextNotSep (&child, &prev); 929: if (child != NULL && type1 != 0) 930: { 931: elType.ElTypeNum = type1; 932: childType = TtaGetElementType (child); 933: if (TtaSameTypes (childType, elType) == 0) 934: { 935: TtaRemoveTree (child, doc); 936: new = TtaNewElement (doc, elType); 937: if (prev == NULL) 938: TtaInsertFirstChild (&new, el, doc); 939: else 940: TtaInsertSibling (new, prev, FALSE, doc); 941: TtaInsertFirstChild (&child, new, doc); 942: CreatePlaceholders (child, doc); 943: child = new; 944: } 945: if (type2 != 0) 946: { 947: prev = child; 948: TtaNextSibling (&child); 949: NextNotSep (&child, &prev); 950: if (child != NULL) 951: { 952: elType.ElTypeNum = type2; 953: childType = TtaGetElementType (child); 954: if (TtaSameTypes (childType, elType) == 0) 955: { 956: TtaRemoveTree (child, doc); 957: new = TtaNewElement (doc, elType); 958: TtaInsertSibling (new, prev, FALSE, doc); 959: TtaInsertFirstChild (&child, new, doc); 960: CreatePlaceholders (child, doc); 961: child = new; 962: } 963: if (type3 != 0) 964: { 965: prev = child; 966: TtaNextSibling (&child); 967: NextNotSep (&child, &prev); 968: if (child != NULL) 969: { 970: elType.ElTypeNum = type3; 971: childType = TtaGetElementType (child); 972: if (TtaSameTypes (childType, elType) == 0) 973: { 974: TtaRemoveTree (child, doc); 975: new = TtaNewElement (doc, elType); 976: TtaInsertSibling (new, prev, FALSE, doc); 977: TtaInsertFirstChild (&child, new, doc); 978: CreatePlaceholders (child, doc); 979: } 980: } 981: } 982: } 983: } 984: } 985: } 986: 987: 988: /*---------------------------------------------------------------------- 1.22 ! cvs 989: SetSingleIntHorizStretchAttr 1.1 cvs 990: 1.22 ! cvs 991: Put a IntHorizStretch attribute on element el if it contains only 1.1 cvs 992: a MO element that is a stretchable symbol. 993: -----------------------------------------------------------------------*/ 994: #ifdef __STDC__ 1.22 ! cvs 995: void SetSingleIntHorizStretchAttr (Element el, Document doc, Element* selEl) 1.1 cvs 996: #else /* __STDC__*/ 1.22 ! cvs 997: void SetSingleIntHorizStretchAttr (el, doc, selEl) 1.1 cvs 998: Element el; 999: Document doc; 1000: Element* selEl; 1001: #endif /* __STDC__*/ 1002: { 1003: Element child, sibling, textEl, symbolEl; 1004: ElementType elType; 1005: Attribute attr; 1006: AttributeType attrType; 1007: int len; 1008: Language lang; 1.15 cvs 1009: CHAR_T alphabet; 1010: UCHAR_T text[2], c; 1.1 cvs 1011: 1012: if (el == NULL) 1013: return; 1014: child = TtaGetFirstChild (el); 1015: if (child != NULL) 1016: { 1017: elType = TtaGetElementType (child); 1018: if (elType.ElTypeNum == MathML_EL_MO) 1019: /* the first child is a MO */ 1020: { 1021: sibling = child; 1022: TtaNextSibling (&sibling); 1023: if (sibling == NULL) 1024: /* there is no other child */ 1025: { 1026: textEl = TtaGetFirstChild (child); 1027: elType = TtaGetElementType (textEl); 1028: if (elType.ElTypeNum == MathML_EL_TEXT_UNIT) 1029: { 1030: len = TtaGetTextLength (textEl); 1031: if (len == 1) 1032: { 1033: len = 2; 1034: TtaGiveTextContent (textEl, text, &len, &lang); 1035: alphabet = TtaGetAlphabet (lang); 1036: if (len == 1) 1037: if (alphabet == 'G') 1038: /* a single Symbol character */ 1039: if ((int)text[0] == 172 || (int)text[0] == 174) 1040: /* horizontal arrow */ 1041: { 1.10 cvs 1042: c = EOS; 1.22 ! cvs 1043: /* attach a IntHorizStretch attribute */ 1.1 cvs 1044: attrType.AttrSSchema = elType.ElSSchema; 1.22 ! cvs 1045: attrType.AttrTypeNum = MathML_ATTR_IntHorizStretch; 1.1 cvs 1046: attr = TtaNewAttribute (attrType); 1047: TtaAttachAttribute (el, attr, doc); 1.22 ! cvs 1048: TtaSetAttributeValue (attr, MathML_ATTR_IntHorizStretch_VAL_yes_, el, doc); 1.1 cvs 1049: /* replace the TEXT element by a Thot SYMBOL element */ 1050: elType.ElTypeNum = MathML_EL_SYMBOL_UNIT; 1051: symbolEl = TtaNewElement (doc, elType); 1052: TtaInsertSibling (symbolEl, textEl, FALSE, doc); 1053: if (selEl != NULL) 1054: if (*selEl == textEl) 1055: *selEl = symbolEl; 1056: TtaDeleteTree (textEl, doc); 1057: if ((int)text[0] == 172) 1058: c = '<'; 1059: if ((int)text[0] == 174) 1060: c = '>'; 1.10 cvs 1061: if (c != EOS) 1062: TtaSetGraphicsShape (symbolEl, c, doc); 1.1 cvs 1063: } 1064: } 1065: } 1066: } 1067: } 1068: } 1069: } 1070: 1071: /*---------------------------------------------------------------------- 1.22 ! cvs 1072: SetIntHorizStretchAttr 1.1 cvs 1073: 1.22 ! cvs 1074: Put a IntHorizStretch attribute on all children of element el which 1.1 cvs 1075: contain only a MO element that is a stretchable symbol. 1076: -----------------------------------------------------------------------*/ 1077: #ifdef __STDC__ 1.22 ! cvs 1078: static void SetIntHorizStretchAttr (Element el, Document doc) 1.1 cvs 1079: #else /* __STDC__*/ 1.22 ! cvs 1080: static void SetIntHorizStretchAttr (el, doc) 1.1 cvs 1081: Element el; 1082: Document doc; 1083: #endif /* __STDC__*/ 1084: { 1085: Element child; 1086: 1087: if (el == NULL) 1088: return; 1089: child = TtaGetFirstChild (el); 1090: while (child != NULL) 1091: { 1.22 ! cvs 1092: SetSingleIntHorizStretchAttr (child, doc, NULL); 1.1 cvs 1093: TtaNextSibling (&child); 1094: } 1095: } 1096: 1097: /*---------------------------------------------------------------------- 1.22 ! cvs 1098: SetIntVertStretchAttr 1.1 cvs 1099: 1.22 ! cvs 1100: Put a IntVertStretch attribute on element el if its base element 1.1 cvs 1101: (Base for a MSUBSUP, MSUP or MSUB; UnderOverBase for a MUNDEROVER, 1102: a MUNDER of a MOVER) contains only a MO element that is a vertically 1103: stretchable symbol. 1104: -----------------------------------------------------------------------*/ 1105: #ifdef __STDC__ 1.22 ! cvs 1106: void SetIntVertStretchAttr (Element el, Document doc, int base, Element* selEl) 1.1 cvs 1107: #else /* __STDC__*/ 1.22 ! cvs 1108: void SetIntVertStretchAttr (el, doc, base, selEl) 1.1 cvs 1109: Element el; 1110: Document doc; 1111: int base; 1112: Element* selEl; 1113: #endif /* __STDC__*/ 1114: { 1115: Element child, sibling, textEl, symbolEl, parent, operator; 1116: ElementType elType; 1117: Attribute attr; 1118: AttributeType attrType; 1119: int len; 1120: Language lang; 1.15 cvs 1121: CHAR_T alphabet; 1122: UCHAR_T text[2], c; 1.1 cvs 1123: 1124: if (el == NULL) 1125: return; 1126: operator = NULL; 1127: if (base == 0) 1128: /* it's a MO */ 1129: { 1130: parent = TtaGetParent (el); 1131: if (parent != NULL) 1132: { 1133: elType = TtaGetElementType (parent); 1134: if (elType.ElTypeNum != MathML_EL_Base && 1135: elType.ElTypeNum != MathML_EL_UnderOverBase && 1136: elType.ElTypeNum != MathML_EL_MSUBSUP && 1137: elType.ElTypeNum != MathML_EL_MSUB && 1138: elType.ElTypeNum != MathML_EL_MSUP && 1139: elType.ElTypeNum != MathML_EL_MUNDEROVER && 1140: elType.ElTypeNum != MathML_EL_MUNDER && 1141: elType.ElTypeNum != MathML_EL_MUNDEROVER) 1142: operator = el; 1143: } 1144: } 1145: else 1146: /* it's not a MO */ 1147: { 1148: /* search the Base or UnderOverBase child */ 1149: child = TtaGetFirstChild (el); 1150: if (child != NULL) 1151: { 1152: elType = TtaGetElementType (child); 1153: if (elType.ElTypeNum == base) 1154: /* the first child is a Base or UnderOverBase */ 1155: { 1156: child = TtaGetFirstChild (child); 1157: if (child != NULL) 1158: { 1159: elType = TtaGetElementType (child); 1160: if (elType.ElTypeNum == MathML_EL_MO) 1161: /* its first child is a MO */ 1162: { 1163: sibling = child; 1164: TtaNextSibling (&sibling); 1165: if (sibling == NULL) 1166: /* there is no other child */ 1167: operator = child; 1168: } 1169: } 1170: } 1171: } 1172: } 1173: if (operator != NULL) 1174: { 1175: textEl = TtaGetFirstChild (operator); 1176: if (textEl != NULL) 1177: { 1178: elType = TtaGetElementType (textEl); 1179: if (elType.ElTypeNum == MathML_EL_TEXT_UNIT) 1180: { 1181: len = TtaGetTextLength (textEl); 1182: if (len == 1) 1183: { 1184: len = 2; 1185: TtaGiveTextContent (textEl, text, &len, &lang); 1186: alphabet = TtaGetAlphabet (lang); 1187: if (len == 1) 1188: if (alphabet == 'G') 1189: /* a single Symbol character */ 1190: if ((int)text[0] == 242) 1191: /* Integral */ 1192: { 1.22 ! cvs 1193: /* attach a IntVertStretch attribute */ 1.1 cvs 1194: attrType.AttrSSchema = elType.ElSSchema; 1.22 ! cvs 1195: attrType.AttrTypeNum = MathML_ATTR_IntVertStretch; 1.1 cvs 1196: attr = TtaNewAttribute (attrType); 1197: TtaAttachAttribute (el, attr, doc); 1.22 ! cvs 1198: TtaSetAttributeValue (attr, MathML_ATTR_IntVertStretch_VAL_yes_, el, doc); 1.1 cvs 1199: /* replace the TEXT element by a Thot SYMBOL element*/ 1200: elType.ElTypeNum = MathML_EL_SYMBOL_UNIT; 1201: symbolEl = TtaNewElement (doc, elType); 1202: TtaInsertSibling (symbolEl, textEl, FALSE, doc); 1203: if (selEl != NULL) 1204: if (*selEl == textEl) 1205: *selEl = symbolEl; 1206: TtaDeleteTree (textEl, doc); 1207: c = 'i'; 1208: TtaSetGraphicsShape (symbolEl, c, doc); 1209: } 1210: } 1211: } 1212: } 1213: } 1214: } 1215: 1216: /*---------------------------------------------------------------------- 1.22 ! cvs 1217: SetIntPlaceholderAttr 1.1 cvs 1218: 1.22 ! cvs 1219: Put a IntPlaceholder attribute on all Construct elements in the 1.1 cvs 1220: subtree of root el. 1221: -----------------------------------------------------------------------*/ 1222: #ifdef __STDC__ 1.22 ! cvs 1223: static void SetIntPlaceholderAttr (Element el, Document doc) 1.1 cvs 1224: #else /* __STDC__*/ 1.22 ! cvs 1225: static void SetIntPlaceholderAttr (el, doc) 1.1 cvs 1226: Element el; 1227: Document doc; 1228: #endif /* __STDC__*/ 1229: { 1230: Element child; 1231: ElementType elType; 1232: Attribute attr; 1233: AttributeType attrType; 1234: 1235: if (el == NULL) 1236: return; 1237: elType = TtaGetElementType (el); 1238: if (elType.ElTypeNum == MathML_EL_Construct && 1.2 cvs 1239: elType.ElSSchema == GetMathMLSSchema (doc)) 1.1 cvs 1240: { 1241: attrType.AttrSSchema = elType.ElSSchema; 1.22 ! cvs 1242: attrType.AttrTypeNum = MathML_ATTR_IntPlaceholder; 1.1 cvs 1243: attr = TtaNewAttribute (attrType); 1244: TtaAttachAttribute (el, attr, doc); 1.22 ! cvs 1245: TtaSetAttributeValue (attr, MathML_ATTR_IntPlaceholder_VAL_yes_, el, doc); 1.1 cvs 1246: } 1247: else 1248: { 1249: child = TtaGetFirstChild (el); 1250: while (child != NULL) 1251: { 1.22 ! cvs 1252: SetIntPlaceholderAttr (child, doc); 1.1 cvs 1253: TtaNextSibling (&child); 1254: } 1255: } 1256: } 1257: 1258: /*---------------------------------------------------------------------- 1259: BuildMultiscript 1260: 1261: The content of a MMULTISCRIPT element has been created following 1262: the original MathML structure. Create all Thot elements defined 1263: in the MathML S schema. 1264: -----------------------------------------------------------------------*/ 1265: #ifdef __STDC__ 1266: static void BuildMultiscript (Element elMMULTISCRIPT, Document doc) 1267: #else /* __STDC__*/ 1268: static void BuildMultiscript (elMMULTISCRIPT, doc) 1269: Element elMMULTISCRIPT; 1270: Document doc; 1271: #endif /* __STDC__*/ 1272: { 1273: Element elem, base, next, group, pair, script, prevPair, prevScript; 1274: ElementType elType, elTypeGroup, elTypePair, elTypeScript; 1.2 cvs 1275: SSchema MathMLSSchema; 1.1 cvs 1276: base = NULL; 1277: group = NULL; 1278: prevPair = NULL; 1279: prevScript = NULL; 1280: 1.2 cvs 1281: MathMLSSchema = GetMathMLSSchema (doc); 1.1 cvs 1282: elTypeGroup.ElSSchema = MathMLSSchema; 1283: elTypePair.ElSSchema = MathMLSSchema; 1284: elTypeScript.ElSSchema = MathMLSSchema; 1285: 1286: /* process all children of the MMULTISCRIPT element */ 1287: elem = TtaGetFirstChild (elMMULTISCRIPT); 1288: while (elem != NULL) 1289: { 1290: /* remember the element to be processed after the current one */ 1291: next = elem; 1292: TtaNextSibling (&next); 1293: 1294: /* remove the current element from the tree */ 1295: TtaRemoveTree (elem, doc); 1296: 1297: if (base == NULL) 1298: /* the current element is the first child of the MMULTISCRIPT 1299: element */ 1300: { 1301: /* Create a MultiscriptBase element as the first child of 1302: MMULTISCRIPT and move the current element as the first child 1303: of the MultiscriptBase element */ 1304: elTypeGroup.ElTypeNum = MathML_EL_MultiscriptBase; 1305: base = TtaNewElement (doc, elTypeGroup); 1306: TtaInsertFirstChild (&base, elMMULTISCRIPT, doc); 1307: TtaInsertFirstChild (&elem, base, doc); 1308: } 1309: else 1310: /* the current element is a subscript or a superscript */ 1311: { 1312: if (group == NULL) 1313: /* there is no PostscriptPairs element. Create one */ 1314: { 1315: elTypeGroup.ElTypeNum = MathML_EL_PostscriptPairs; 1316: group = TtaNewElement (doc, elTypeGroup); 1317: TtaInsertSibling (group, base, FALSE, doc); 1318: elTypePair.ElTypeNum = MathML_EL_PostscriptPair; 1319: /* create a first and a last PostscriptPair as placeholders */ 1320: pair = TtaNewTree (doc, elTypePair, ""); 1321: TtaInsertFirstChild (&pair, group, doc); 1.22 ! cvs 1322: SetIntPlaceholderAttr (pair, doc); 1.1 cvs 1323: prevPair = pair; 1324: pair = TtaNewTree (doc, elTypePair, ""); 1325: TtaInsertSibling (pair, prevPair, FALSE, doc); 1.22 ! cvs 1326: SetIntPlaceholderAttr (pair, doc); 1.1 cvs 1327: prevScript = NULL; 1328: } 1329: if (prevScript == NULL) 1330: /* the current element is the first subscript or superscript 1331: in a pair */ 1332: { 1333: /* create a PostscriptPair or PrescriptPair element */ 1334: pair = TtaNewElement (doc, elTypePair); 1335: if (prevPair == NULL) 1336: TtaInsertFirstChild (&pair, group, doc); 1337: else 1338: TtaInsertSibling (pair, prevPair, FALSE, doc); 1339: prevPair = pair; 1340: /* create a MSubscript element */ 1341: elTypeScript.ElTypeNum = MathML_EL_MSubscript; 1342: script = TtaNewElement (doc, elTypeScript); 1343: TtaInsertFirstChild (&script, pair, doc); 1344: prevScript = script; 1345: } 1346: else 1347: /* the current element is a superscript in a pair */ 1348: { 1349: /* create a MSuperscript element */ 1350: elTypeScript.ElTypeNum = MathML_EL_MSuperscript; 1351: script = TtaNewElement (doc, elTypeScript); 1352: /* insert it as a sibling of the previous MSubscript element */ 1353: TtaInsertSibling (script, prevScript, FALSE, doc); 1354: prevScript = NULL; 1355: } 1356: /* insert the current element as a child of the new MSuperscript or 1357: MSubscript element */ 1358: TtaInsertFirstChild (&elem, script, doc); 1.22 ! cvs 1359: SetIntPlaceholderAttr (elem, doc); 1.1 cvs 1360: } 1361: 1362: CreatePlaceholders (elem, doc); 1363: 1364: /* get next child of the MMULTISCRIPT element */ 1365: elem = next; 1366: if (elem != NULL) 1367: { 1368: elType = TtaGetElementType (elem); 1369: if (elType.ElSSchema == MathMLSSchema && 1370: elType.ElTypeNum == MathML_EL_PrescriptPairs) 1371: /* the next element is a PrescriptPairs */ 1372: { 1373: /* if there there is no PostscriptPairs element, create one as a 1374: placeholder */ 1375: if (elTypeGroup.ElTypeNum != MathML_EL_PostscriptPairs) 1376: { 1377: elTypeGroup.ElTypeNum = MathML_EL_PostscriptPairs; 1378: group = TtaNewTree (doc, elTypeGroup, ""); 1379: TtaInsertSibling (group, elem, TRUE, doc); 1.22 ! cvs 1380: SetIntPlaceholderAttr (group, doc); 1.1 cvs 1381: } 1382: /* the following elements will be interpreted as sub- superscripts 1383: in PrescriptPair elements, wich will be children of this 1384: PrescriptPairs element */ 1385: elTypeGroup.ElTypeNum = MathML_EL_PrescriptPairs; 1386: elTypePair.ElTypeNum = MathML_EL_PrescriptPair; 1387: group = elem; 1388: /* create a first and a last PostscriptPair as placeholders */ 1389: pair = TtaNewTree (doc, elTypePair, ""); 1390: TtaInsertFirstChild (&pair, group, doc); 1.22 ! cvs 1391: SetIntPlaceholderAttr (pair, doc); 1.1 cvs 1392: prevPair = pair; 1393: pair = TtaNewTree (doc, elTypePair, ""); 1394: TtaInsertSibling (pair, prevPair, FALSE, doc); 1.22 ! cvs 1395: SetIntPlaceholderAttr (pair, doc); 1.1 cvs 1396: prevScript = NULL; 1397: TtaNextSibling (&elem); 1398: } 1399: } 1400: } 1401: /* all children of element MMULTISCRIPTS have been processed */ 1402: /* if the last group processed is not a PrescriptPairs element, 1403: create one as a placeholder */ 1404: if (elTypeGroup.ElTypeNum != MathML_EL_PrescriptPairs && base != NULL) 1405: { 1406: elTypeGroup.ElTypeNum = MathML_EL_PrescriptPairs; 1407: elem = TtaNewTree (doc, elTypeGroup, ""); 1408: if (group == NULL) 1409: group = base; 1410: TtaInsertSibling (elem, group, TRUE, doc); 1.22 ! cvs 1411: SetIntPlaceholderAttr (elem, doc); 1.1 cvs 1412: } 1413: } 1414: 1.5 cvs 1415: 1416: /*---------------------------------------------------------------------- 1417: CheckMTable 1418: 1419: The content of a MTABLE element has been created following 1420: the original MathML structure. Create all Thot elements defined 1421: in the MathML S schema. 1422: -----------------------------------------------------------------------*/ 1423: #ifdef __STDC__ 1.12 cvs 1424: void CheckMTable (Element elMTABLE, Document doc) 1.5 cvs 1425: #else /* __STDC__*/ 1.12 cvs 1426: void CheckMTable (elMTABLE, doc) 1.5 cvs 1427: Element elMTABLE; 1428: Document doc; 1429: #endif /* __STDC__*/ 1430: { 1431: ElementType elType; 1432: Element MTableHead, MTableBody, row, nextRow, el, prevRow, cell, 1433: nextCell, newMTD, firstColHead, child, prevChild, nextChild, 1434: wrapper; 1435: SSchema MathMLSSchema; 1436: 1437: MathMLSSchema = GetMathMLSSchema (doc); 1438: row = TtaGetFirstChild (elMTABLE); 1439: 1440: /* create a MTable_head as the first child of element MTABLE */ 1441: elType.ElSSchema = MathMLSSchema; 1442: elType.ElTypeNum = MathML_EL_MTable_head; 1443: MTableHead = TtaNewElement (doc, elType); 1444: TtaInsertFirstChild (&MTableHead, elMTABLE, doc); 1445: elType.ElTypeNum = MathML_EL_MColumn_head; 1446: firstColHead = TtaNewTree (doc, elType, ""); 1447: TtaInsertFirstChild (&firstColHead, MTableHead, doc); 1448: 1449: /* create a MTable_body */ 1450: elType.ElSSchema = MathMLSSchema; 1451: elType.ElTypeNum = MathML_EL_MTable_body; 1452: MTableBody = TtaNewElement (doc, elType); 1453: TtaInsertSibling (MTableBody, MTableHead, FALSE, doc); 1454: 1455: /* move all children of element MTABLE into the new MTable_body element 1456: and wrap each non-MTR element with a MTR */ 1457: prevRow = NULL; 1458: while (row) 1459: { 1460: nextRow = row; 1461: TtaNextSibling (&nextRow); 1462: elType = TtaGetElementType (row); 1463: TtaRemoveTree (row, doc); 1464: if (TtaSameSSchemas (elType.ElSSchema, MathMLSSchema) && 1465: (elType.ElTypeNum == MathML_EL_XMLcomment || 1466: elType.ElTypeNum == MathML_EL_MTR)) 1467: { 1468: if (prevRow == NULL) 1469: TtaInsertFirstChild (&row, MTableBody, doc); 1470: else 1471: TtaInsertSibling (row, prevRow, FALSE, doc); 1472: prevRow = row; 1473: if (elType.ElTypeNum == MathML_EL_MTR) 1474: cell = TtaGetFirstChild (row); 1475: else 1476: cell = NULL; 1477: } 1478: else 1479: /* this child is not a MTR nor a comment, create a MTR element */ 1480: { 1481: elType.ElSSchema = MathMLSSchema; 1482: elType.ElTypeNum = MathML_EL_MTR; 1483: el = TtaNewElement (doc, elType); 1484: if (prevRow == NULL) 1485: TtaInsertFirstChild (&el, MTableBody, doc); 1486: else 1487: TtaInsertSibling (el, prevRow, FALSE, doc); 1488: TtaInsertFirstChild (&row, el, doc); 1489: cell = row; 1490: prevRow = el; 1491: } 1492: while (cell) 1493: /* check all children of the current MTR element */ 1494: { 1495: nextCell = cell; 1496: TtaNextSibling (&nextCell); 1497: elType = TtaGetElementType (cell); 1498: if (!TtaSameSSchemas (elType.ElSSchema, MathMLSSchema) || 1499: (elType.ElTypeNum != MathML_EL_XMLcomment && 1500: elType.ElTypeNum != MathML_EL_MTD)) 1501: /* this is not a MTD nor a comment, create a wrapping MTD */ 1502: { 1503: elType.ElSSchema = MathMLSSchema; 1504: elType.ElTypeNum = MathML_EL_MTD; 1505: newMTD = TtaNewElement (doc, elType); 1506: TtaInsertSibling (newMTD, cell, TRUE, doc); 1507: TtaRemoveTree (cell, doc); 1508: TtaInsertFirstChild (&cell, newMTD, doc); 1509: cell = newMTD; 1510: } 1511: if (elType.ElTypeNum == MathML_EL_MTD) 1512: /* This is a MTD element. Wrap its contents with a CellWrapper */ 1513: { 1514: child = TtaGetFirstChild (cell); 1515: elType.ElSSchema = MathMLSSchema; 1516: elType.ElTypeNum = MathML_EL_CellWrapper; 1517: wrapper = TtaNewElement (doc, elType); 1518: TtaInsertFirstChild (&wrapper, cell, doc); 1519: prevChild = NULL; 1520: while (child) 1521: { 1522: nextChild = child; 1523: TtaNextSibling (&nextChild); 1524: TtaRemoveTree (child, doc); 1525: if (prevChild == NULL) 1526: TtaInsertFirstChild (&child, wrapper, doc); 1527: else 1528: TtaInsertSibling (child, prevChild, FALSE, doc); 1529: prevChild = child; 1530: child = nextChild; 1531: } 1532: } 1533: cell = nextCell; 1534: } 1535: row = nextRow; 1536: } 1.12 cvs 1537: CheckAllRows (elMTABLE, doc); 1.5 cvs 1538: } 1.12 cvs 1539: 1.1 cvs 1540: 1541: /*---------------------------------------------------------------------- 1542: SetFontstyleAttr 1543: The content of a MI element has been created or modified. 1544: Create or change attribute IntFontstyle for that element accordingly. 1545: -----------------------------------------------------------------------*/ 1546: #ifdef __STDC__ 1547: void SetFontstyleAttr (Element el, Document doc) 1548: #else /* __STDC__*/ 1549: void SetFontstyleAttr (el, doc) 1550: Element el; 1551: Document doc; 1552: #endif /* __STDC__*/ 1553: { 1554: ElementType elType; 1555: AttributeType attrType; 1556: Attribute attr, IntAttr; 1557: int len; 1558: 1559: if (el != NULL) 1560: { 1561: /* search the fontstyle attribute */ 1562: elType = TtaGetElementType (el); 1563: attrType.AttrSSchema = elType.ElSSchema; 1564: attrType.AttrTypeNum = MathML_ATTR_fontstyle; 1565: attr = TtaGetAttribute (el, attrType); 1566: attrType.AttrTypeNum = MathML_ATTR_IntFontstyle; 1567: IntAttr = TtaGetAttribute (el, attrType); 1568: if (attr != NULL) 1569: /* there is a fontstyle attribute. Remove the corresponding 1570: internal attribute that is not needed */ 1571: { 1572: if (IntAttr != NULL) 1573: TtaRemoveAttribute (el, IntAttr, doc); 1574: } 1575: else 1576: /* there is no fontstyle attribute. Create an internal attribute 1577: IntFontstyle with a value that depends on the content of the MI */ 1578: { 1579: /* get content length */ 1580: len = TtaGetElementVolume (el); 1581: if (len > 1) 1582: /* put an attribute IntFontstyle = IntNormal */ 1583: { 1584: if (IntAttr == NULL) 1585: { 1586: IntAttr = TtaNewAttribute (attrType); 1587: TtaAttachAttribute (el, IntAttr, doc); 1588: } 1589: TtaSetAttributeValue (IntAttr, MathML_ATTR_IntFontstyle_VAL_IntNormal, 1590: el, doc); 1591: } 1592: else 1593: /* MI contains a single character. Remove attribute IntFontstyle 1594: if it exists */ 1595: { 1596: if (IntAttr != NULL) 1597: TtaRemoveAttribute (el, IntAttr, doc); 1598: } 1599: } 1600: } 1601: } 1602: 1603: /*---------------------------------------------------------------------- 1.22 ! cvs 1604: SetIntAddSpaceAttr 1.1 cvs 1605: The content of a MO element has been created or modified. 1.22 ! cvs 1606: Create or change attribute IntAddSpace for that element accordingly. 1.1 cvs 1607: -----------------------------------------------------------------------*/ 1608: #ifdef __STDC__ 1.22 ! cvs 1609: void SetIntAddSpaceAttr (Element el, Document doc) 1.1 cvs 1610: #else /* __STDC__*/ 1.22 ! cvs 1611: void SetIntAddSpaceAttr (el, doc) 1.1 cvs 1612: Element el; 1613: Document doc; 1614: #endif /* __STDC__*/ 1615: { 1616: Element textEl, previous; 1617: ElementType elType; 1618: AttributeType attrType; 1619: Attribute attr; 1620: int len, val; 1621: #define BUFLEN 10 1.15 cvs 1622: UCHAR_T text[BUFLEN]; 1.1 cvs 1623: Language lang; 1.15 cvs 1624: CHAR_T alphabet; 1.1 cvs 1625: 1626: textEl = TtaGetFirstChild (el); 1627: if (textEl != NULL) 1628: { 1.22 ! cvs 1629: /* search the IntAddSpace attribute */ 1.1 cvs 1630: elType = TtaGetElementType (el); 1631: attrType.AttrSSchema = elType.ElSSchema; 1.22 ! cvs 1632: attrType.AttrTypeNum = MathML_ATTR_IntAddSpace; 1.1 cvs 1633: attr = TtaGetAttribute (el, attrType); 1634: if (attr == NULL) 1635: { 1636: attr = TtaNewAttribute (attrType); 1637: TtaAttachAttribute (el, attr, doc); 1638: } 1.22 ! cvs 1639: val = MathML_ATTR_IntAddSpace_VAL_nospace; 1.1 cvs 1640: len = TtaGetTextLength (textEl); 1641: if (len > 0 && len < BUFLEN) 1642: { 1643: len = BUFLEN; 1644: TtaGiveTextContent (textEl, text, &len, &lang); 1645: alphabet = TtaGetAlphabet (lang); 1646: if (len == 1) 1647: if (alphabet == 'L') 1648: /* ISO-Latin 1 character */ 1649: { 1650: if (text[0] == '-') 1651: /* unary or binary operator? */ 1652: { 1653: previous = el; 1654: TtaPreviousSibling (&previous); 1655: if (previous == NULL) 1656: /* no previous sibling => unary operator */ 1.22 ! cvs 1657: val = MathML_ATTR_IntAddSpace_VAL_nospace; 1.1 cvs 1658: else 1659: { 1660: elType = TtaGetElementType (previous); 1661: if (elType.ElTypeNum == MathML_EL_MO) 1662: /* after an operator => unary operator */ 1.22 ! cvs 1663: val = MathML_ATTR_IntAddSpace_VAL_nospace; 1.1 cvs 1664: else 1665: /* binary operator */ 1.22 ! cvs 1666: val = MathML_ATTR_IntAddSpace_VAL_both; 1.1 cvs 1667: } 1668: } 1669: else if (text[0] == '+' || 1670: text[0] == '&' || 1671: text[0] == '*' || 1672: text[0] == '<' || 1673: text[0] == '=' || 1674: text[0] == '>' || 1675: text[0] == '^') 1676: /* binary operator */ 1.22 ! cvs 1677: val = MathML_ATTR_IntAddSpace_VAL_both; 1.1 cvs 1678: else if (text[0] == ',' || 1679: text[0] == ';') 1.22 ! cvs 1680: val = MathML_ATTR_IntAddSpace_VAL_spaceafter; 1.1 cvs 1681: } 1682: else if (alphabet == 'G') 1683: /* Symbol character set */ 1684: if ((int)text[0] == 163 || /* less or equal */ 1685: (int)text[0] == 177 || /* plus or minus */ 1686: (int)text[0] == 179 || /* greater or equal */ 1687: (int)text[0] == 180 || /* times */ 1688: (int)text[0] == 184 || /* divide */ 1689: (int)text[0] == 185 || /* not equal */ 1690: (int)text[0] == 186 || /* identical */ 1691: (int)text[0] == 187 || /* equivalent */ 1692: (int)text[0] == 196 || /* circle times */ 1693: (int)text[0] == 197 || /* circle plus */ 1694: ((int)text[0] >= 199 && (int)text[0] <= 209) || /* */ 1695: (int)text[0] == 217 || /* and */ 1696: (int)text[0] == 218 ) /* or */ 1.22 ! cvs 1697: val = MathML_ATTR_IntAddSpace_VAL_both; 1.1 cvs 1698: } 1699: TtaSetAttributeValue (attr, val, el, doc); 1700: } 1701: } 1702: 1703: 1704: /*---------------------------------------------------------------------- 1705: ChangeTypeOfElement 1706: Change the type of element elem into newTypeNum 1707: -----------------------------------------------------------------------*/ 1708: #ifdef __STDC__ 1709: void ChangeTypeOfElement (Element elem, Document doc, int newTypeNum) 1710: #else /* __STDC__*/ 1711: void ChangeTypeOfElement (elem, doc, newTypeNum) 1712: Element elem; 1713: Document doc; 1714: int newTypeNum; 1715: #endif /* __STDC__*/ 1716: 1717: { 1718: Element prev, next, parent; 1.10 cvs 1719: 1720: parent = NULL; 1.1 cvs 1721: prev = elem; 1722: TtaPreviousSibling (&prev); 1723: if (prev == NULL) 1724: { 1725: next = elem; 1726: TtaNextSibling (&next); 1727: if (next == NULL) 1728: parent = TtaGetParent (elem); 1729: } 1730: TtaRemoveTree (elem, doc); 1731: ChangeElementType (elem, newTypeNum); 1732: if (prev != NULL) 1733: TtaInsertSibling (elem, prev, FALSE, doc); 1734: else if (next != NULL) 1735: TtaInsertSibling (elem, next, TRUE, doc); 1736: else 1737: TtaInsertFirstChild (&elem, parent, doc); 1738: } 1739: 1740: 1741: /*---------------------------------------------------------------------- 1742: CheckFence 1743: If el is a MO element that contains a single fence character, 1744: transform the MO into a MF and the character into a Thot symbol. 1745: ----------------------------------------------------------------------*/ 1746: #ifdef __STDC__ 1747: void CheckFence (Element el, Document doc) 1748: #else 1749: void CheckFence (el, doc) 1750: Element el; 1751: Document doc; 1752: 1753: #endif 1754: { 1755: ElementType elType; 1756: Element content; 1757: AttributeType attrType; 1758: Attribute attr; 1759: int len; 1760: Language lang; 1.15 cvs 1761: CHAR_T alphabet; 1762: UCHAR_T text[2], c; 1.1 cvs 1763: 1764: elType = TtaGetElementType (el); 1765: if (elType.ElTypeNum == MathML_EL_MO) 1766: { 1767: content = TtaGetFirstChild (el); 1768: if (content != NULL) 1769: { 1770: elType = TtaGetElementType (content); 1771: if (elType.ElTypeNum == MathML_EL_TEXT_UNIT) 1772: { 1773: len = TtaGetTextLength (content); 1774: if (len == 1) 1775: { 1776: len = 2; 1777: TtaGiveTextContent (content, text, &len, &lang); 1778: alphabet = TtaGetAlphabet (lang); 1779: if (len == 1) 1780: if (alphabet == 'L') 1781: /* a single character */ 1782: if (text[0] == '(' || text[0] == ')' || 1783: text[0] == '[' || text[0] == ']' || 1784: text[0] == '{' || text[0] == '}' || 1785: text[0] == '|' ) 1786: { 1787: /* remove the content of the MO element */ 1788: TtaDeleteTree (content, doc); 1789: /* change the MO element into a MF element */ 1790: ChangeTypeOfElement (el, doc, MathML_EL_MF); 1.22 ! cvs 1791: /* attach a IntVertStretch attribute to the MF element */ 1.1 cvs 1792: attrType.AttrSSchema = elType.ElSSchema; 1.22 ! cvs 1793: attrType.AttrTypeNum = MathML_ATTR_IntVertStretch; 1.1 cvs 1794: attr = TtaNewAttribute (attrType); 1795: TtaAttachAttribute (el, attr, doc); 1.22 ! cvs 1796: TtaSetAttributeValue (attr, MathML_ATTR_IntVertStretch_VAL_yes_, el, doc); 1.1 cvs 1797: /* create a new content for the MF element */ 1798: if (text[0] == '|') 1799: { 1800: elType.ElTypeNum = MathML_EL_GRAPHICS_UNIT; 1801: c = 'v'; 1802: } 1803: else 1804: { 1805: elType.ElTypeNum = MathML_EL_SYMBOL_UNIT; 1806: c = text[0]; 1807: } 1808: content = TtaNewElement (doc, elType); 1809: TtaInsertFirstChild (&content, el, doc); 1810: TtaSetGraphicsShape (content, c, doc); 1811: } 1812: } 1813: } 1814: } 1815: } 1816: } 1817: 1818: /*---------------------------------------------------------------------- 1819: CreateFencedSeparators 1820: Create FencedSeparator elements within the fencedExpression 1821: according to attribute separators of the MFENCED element. 1822: ----------------------------------------------------------------------*/ 1823: #ifdef __STDC__ 1.18 cvs 1824: void CreateFencedSeparators (Element fencedExpression, Document doc, ThotBool record) 1.1 cvs 1825: #else 1.17 cvs 1826: void CreateFencedSeparators (fencedExpression, doc, record) 1.1 cvs 1827: Element fencedExpression; 1828: Document doc; 1.18 cvs 1829: ThotBool record; 1.1 cvs 1830: 1831: #endif 1832: { 1833: ElementType elType; 1834: Element child, separator, leaf, next, prev, mfenced; 1835: AttributeType attrType; 1836: Attribute attr; 1837: int length, sep, i; 1838: Language lang; 1.15 cvs 1839: CHAR_T text[32], sepValue[4]; 1.1 cvs 1840: 1841: /* get the separators attribute */ 1842: mfenced = TtaGetParent (fencedExpression); 1843: elType = TtaGetElementType (fencedExpression); 1844: attrType.AttrSSchema = elType.ElSSchema; 1845: attrType.AttrTypeNum = MathML_ATTR_separators; 1846: text[0] = ','; /* default value is sparators="," */ 1847: text[1] = EOS; 1848: length = 1; 1849: attr = TtaGetAttribute (mfenced, attrType); 1850: if (attr != NULL) 1851: { 1852: length = 31; 1853: TtaGiveTextAttributeValue (attr, text, &length); 1854: } 1855: 1856: /* create FencedSeparator elements in the FencedExpression */ 1857: prev = NULL; 1858: sep = 0; 1859: /* skip leading spaces in attribute separators */ 1860: while (text[sep] <= SPACE && text[sep] != EOS) 1861: sep++; 1862: /* if attribute separators is empty or contains only spaces, do not 1863: insert any separator element */ 1864: if (text[sep] != EOS) 1865: { 1866: child = TtaGetFirstChild (fencedExpression); 1867: while (child != NULL) 1868: { 1869: next = child; 1870: TtaNextSibling (&next); 1871: elType = TtaGetElementType (child); 1872: if (elType.ElTypeNum != MathML_EL_Construct) 1873: { 1874: if (prev != NULL) 1875: { 1876: elType.ElTypeNum = MathML_EL_FencedSeparator; 1877: separator = TtaNewElement (doc, elType); 1878: TtaInsertSibling (separator, prev, FALSE, doc); 1879: elType.ElTypeNum = MathML_EL_TEXT_UNIT; 1880: leaf = TtaNewElement (doc, elType); 1881: TtaInsertFirstChild (&leaf, separator, doc); 1882: sepValue[0] = text[sep]; 1883: sepValue[1] = SPACE; 1884: sepValue[2] = EOS; 1885: lang = TtaGetLanguageIdFromAlphabet('L'); 1886: TtaSetTextContent (leaf, sepValue, lang, doc); 1887: /* is there a following non-space character in separators? */ 1888: i = sep + 1; 1889: while (text[i] <= SPACE && text[i] != EOS) 1890: i++; 1891: if (text[i] > SPACE && text[i] != EOS) 1892: sep = i; 1.17 cvs 1893: if (record) 1894: TtaRegisterElementCreate (separator, doc); 1.1 cvs 1895: } 1896: prev = child; 1897: } 1898: child = next; 1899: } 1900: } 1901: } 1902: 1903: 1904: /*---------------------------------------------------------------------- 1905: TransformMFENCED 1906: Transform the content of a MFENCED element: create elements 1907: OpeningFence, FencedExpression, ClosingFence and FencedSeparator. 1908: ----------------------------------------------------------------------*/ 1909: #ifdef __STDC__ 1910: void TransformMFENCED (Element el, Document doc) 1911: #else 1912: void TransformMFENCED (el, doc) 1913: Element el; 1914: Document doc; 1915: 1916: #endif 1917: { 1918: ElementType elType; 1919: Element child, fencedExpression, leaf, fence, next, prev, 1920: firstChild; 1921: AttributeType attrType; 1922: Attribute attr; 1923: int length; 1.15 cvs 1924: CHAR_T text[32], c; 1.1 cvs 1925: 1926: child = TtaGetFirstChild (el); 1927: if (child != NULL) 1928: elType = TtaGetElementType (child); 1929: if (child != NULL && elType.ElTypeNum == MathML_EL_OpeningFence) 1930: /* The first child of this MFENCED element is an OpeningFence. 1931: This MFENCED expression has already been transformed, possibly 1932: by the Transform command */ 1933: { 1934: TtaNextSibling (&child); 1935: fencedExpression = child; 1936: if (fencedExpression != NULL) 1937: elType = TtaGetElementType (fencedExpression); 1938: if (elType.ElTypeNum == MathML_EL_FencedExpression) 1939: /* the second child is a FencedExpression. OK. 1940: Remove all existing FencedSeparator elements */ 1941: { 1942: child = TtaGetFirstChild (fencedExpression); 1943: prev = NULL; 1944: while (child != NULL) 1945: { 1946: elType = TtaGetElementType (child); 1947: next = child; 1948: TtaNextSibling (&next); 1949: if (elType.ElTypeNum == MathML_EL_FencedSeparator) 1950: /* Remove this separator */ 1951: TtaDeleteTree (child, doc); 1952: child = next; 1953: } 1954: /* create FencedSeparator elements in the FencedExpression */ 1.17 cvs 1955: CreateFencedSeparators (fencedExpression, doc, FALSE); 1.1 cvs 1956: } 1957: } 1958: else 1959: /* this MFENCED element must be transformed */ 1960: { 1961: /* create a FencedExpression element as a child of the MFENCED elem. */ 1962: elType = TtaGetElementType (el); 1963: elType.ElTypeNum = MathML_EL_FencedExpression; 1964: fencedExpression = TtaNewElement (doc, elType); 1965: TtaInsertFirstChild (&fencedExpression, el, doc); 1966: if (child == NULL) 1967: /* empty MFENCED element */ 1968: { 1969: elType.ElTypeNum = MathML_EL_Construct; 1970: child = TtaNewElement (doc, elType); 1971: TtaInsertFirstChild (&child, fencedExpression, doc); 1.22 ! cvs 1972: SetIntPlaceholderAttr (child, doc); 1.1 cvs 1973: } 1974: else 1975: { 1976: /* move the content of the MFENCED element within the new 1977: FencedExpression element */ 1978: prev = NULL; 1979: firstChild = NULL; 1980: while (child != NULL) 1981: { 1982: next = child; 1983: TtaNextSibling (&next); 1984: TtaRemoveTree (child, doc); 1985: if (prev == NULL) 1986: { 1987: TtaInsertFirstChild (&child, fencedExpression, doc); 1988: firstChild = child; 1989: } 1990: else 1991: TtaInsertSibling (child, prev, FALSE, doc); 1992: prev = child; 1993: child = next; 1994: } 1995: 1996: /* create FencedSeparator elements in the FencedExpression */ 1.17 cvs 1997: CreateFencedSeparators (fencedExpression, doc, FALSE); 1.1 cvs 1998: 1999: /* Create placeholders within the FencedExpression element */ 2000: CreatePlaceholders (firstChild, doc); 2001: } 2002: 2003: /* create the OpeningFence element according to the open attribute */ 2004: c = '('; 2005: attrType.AttrSSchema = elType.ElSSchema; 2006: attrType.AttrTypeNum = MathML_ATTR_open; 2007: attr = TtaGetAttribute (el, attrType); 2008: if (attr != NULL) 2009: { 2010: length = 7; 2011: TtaGiveTextAttributeValue (attr, text, &length); 2012: c = text[0]; 2013: } 2014: elType.ElTypeNum = MathML_EL_OpeningFence; 2015: fence = TtaNewElement (doc, elType); 2016: TtaInsertSibling (fence, fencedExpression, TRUE, doc); 2017: elType.ElTypeNum = MathML_EL_SYMBOL_UNIT; 2018: leaf = TtaNewElement (doc, elType); 2019: TtaInsertFirstChild (&leaf, fence, doc); 2020: TtaSetGraphicsShape (leaf, c, doc); 2021: 2022: /* create the ClosingFence element according to close attribute */ 2023: c = ')'; 2024: attrType.AttrTypeNum = MathML_ATTR_close; 2025: attr = TtaGetAttribute (el, attrType); 2026: if (attr != NULL) 2027: { 2028: length = 7; 2029: TtaGiveTextAttributeValue (attr, text, &length); 2030: c = text[0]; 2031: } 2032: elType.ElTypeNum = MathML_EL_ClosingFence; 2033: fence = TtaNewElement (doc, elType); 2034: TtaInsertSibling (fence, fencedExpression, FALSE, doc); 2035: elType.ElTypeNum = MathML_EL_SYMBOL_UNIT; 2036: leaf = TtaNewElement (doc, elType); 2037: TtaInsertFirstChild (&leaf, fence, doc); 2038: TtaSetGraphicsShape (leaf, c, doc); 2039: } 2040: } 2041: 2042: /*---------------------------------------------------------------------- 2043: MathMLElementComplete 2044: Check the Thot structure of the MathML element el. 2045: ----------------------------------------------------------------------*/ 2046: #ifdef __STDC__ 2047: void MathMLElementComplete (Element el, Document doc) 2048: #else 2049: void MathMLElementComplete (el, doc) 2050: Element el; 2051: Document doc; 2052: 2053: #endif 2054: { 2055: ElementType elType, parentType; 2056: Element child, parent, new, prev, next; 2057: AttributeType attrType; 2058: Attribute attr; 1.2 cvs 2059: SSchema MathMLSSchema; 1.1 cvs 2060: 2061: elType = TtaGetElementType (el); 1.2 cvs 2062: MathMLSSchema = GetMathMLSSchema (doc); 1.1 cvs 2063: 2064: if (elType.ElSSchema != MathMLSSchema) 2065: /* this is not a MathML element. It's the HTML element <math>, or 2066: any other element containing a MathML expression */ 2067: { 2068: if (TtaGetFirstChild (el) == NULL && !TtaIsLeaf (elType)) 2069: /* this element is empty. Create a MathML element as it's child */ 2070: { 2071: elType.ElSSchema = MathMLSSchema; 2072: elType.ElTypeNum = MathML_EL_MathML; 2073: new = TtaNewElement (doc, elType); 2074: TtaInsertFirstChild (&new, el, doc); 2075: /* Create a placeholder within the MathML element */ 2076: elType.ElTypeNum = MathML_EL_Construct; 2077: child = TtaNewElement (doc, elType); 2078: TtaInsertFirstChild (&child, new, doc); 2079: attrType.AttrSSchema = elType.ElSSchema; 1.22 ! cvs 2080: attrType.AttrTypeNum = MathML_ATTR_IntPlaceholder; 1.1 cvs 2081: attr = TtaNewAttribute (attrType); 2082: TtaAttachAttribute (child, attr, doc); 1.22 ! cvs 2083: TtaSetAttributeValue (attr, MathML_ATTR_IntPlaceholder_VAL_yes_, child, doc); 1.1 cvs 2084: } 2085: } 2086: else 2087: { 2088: switch (elType.ElTypeNum) 2089: { 2090: case MathML_EL_TEXT_UNIT: 2091: CheckTextElement (&el, doc); 2092: break; 2093: case MathML_EL_MI: 2094: SetFontstyleAttr (el, doc); 2095: break; 2096: case MathML_EL_MO: 1.22 ! cvs 2097: SetIntAddSpaceAttr (el, doc); ! 2098: SetIntVertStretchAttr (el, doc, 0, NULL); 1.1 cvs 2099: break; 2100: case MathML_EL_MROOT: 2101: /* end of a Root. Create a RootBase and an Index */ 2102: CheckMathSubExpressions (el, MathML_EL_RootBase, MathML_EL_Index, 2103: 0, doc); 2104: break; 2105: case MathML_EL_MSQRT: 2106: /* end od a Square Root. Create a RootBase */ 2107: CheckMathSubExpressions (el, MathML_EL_RootBase, 0, 0, doc); 2108: break; 2109: case MathML_EL_MFRAC: 2110: /* end of a fraction. Create a Numerator and a Denominator */ 2111: CheckMathSubExpressions (el, MathML_EL_Numerator, 2112: MathML_EL_Denominator, 0, doc); 2113: break; 2114: case MathML_EL_MFENCED: 2115: TransformMFENCED (el, doc); 2116: break; 2117: case MathML_EL_MSUBSUP: 2118: /* end of a MSUBSUP. Create Base, Subscript, and Superscript */ 2119: CheckMathSubExpressions (el, MathML_EL_Base, MathML_EL_Subscript, 2120: MathML_EL_Superscript, doc); 1.22 ! cvs 2121: SetIntVertStretchAttr (el, doc, MathML_EL_Base, NULL); 1.1 cvs 2122: break; 2123: case MathML_EL_MSUB: 2124: /* end of a MSUB. Create Base and Subscript */ 2125: CheckMathSubExpressions (el, MathML_EL_Base, MathML_EL_Subscript, 2126: 0, doc); 1.22 ! cvs 2127: SetIntVertStretchAttr (el, doc, MathML_EL_Base, NULL); 1.1 cvs 2128: break; 2129: case MathML_EL_MSUP: 2130: /* end of a MSUP. Create Base and Superscript */ 2131: CheckMathSubExpressions (el, MathML_EL_Base, MathML_EL_Superscript, 2132: 0, doc); 1.22 ! cvs 2133: SetIntVertStretchAttr (el, doc, MathML_EL_Base, NULL); 1.1 cvs 2134: break; 2135: case MathML_EL_MUNDEROVER: 2136: /* end of a MUNDEROVER. Create UnderOverBase, Underscript, and 2137: Overscript */ 2138: CheckMathSubExpressions (el, MathML_EL_UnderOverBase, 2139: MathML_EL_Underscript, MathML_EL_Overscript, doc); 1.22 ! cvs 2140: SetIntHorizStretchAttr (el, doc); ! 2141: SetIntVertStretchAttr (el, doc, MathML_EL_UnderOverBase, NULL); 1.1 cvs 2142: break; 2143: case MathML_EL_MUNDER: 2144: /* end of a MUNDER. Create UnderOverBase, and Underscript */ 2145: CheckMathSubExpressions (el, MathML_EL_UnderOverBase, 2146: MathML_EL_Underscript, 0, doc); 1.22 ! cvs 2147: SetIntHorizStretchAttr (el, doc); ! 2148: SetIntVertStretchAttr (el, doc, MathML_EL_UnderOverBase, NULL); 1.1 cvs 2149: break; 2150: case MathML_EL_MOVER: 2151: /* end of a MOVER. Create UnderOverBase, and Overscript */ 2152: CheckMathSubExpressions (el, MathML_EL_UnderOverBase, 2153: MathML_EL_Overscript, 0, doc); 1.22 ! cvs 2154: SetIntHorizStretchAttr (el, doc); ! 2155: SetIntVertStretchAttr (el, doc, MathML_EL_UnderOverBase, NULL); 1.1 cvs 2156: break; 2157: case MathML_EL_MMULTISCRIPTS: 2158: /* end of a MMULTISCRIPTS. Create all elements defined in the 2159: MathML S schema */ 2160: BuildMultiscript (el, doc); 1.5 cvs 2161: break; 2162: case MathML_EL_MTABLE: 2163: /* end of a MTABLE. Create all elements defined in the MathML S 2164: schema */ 2165: CheckMTable (el, doc); 1.1 cvs 2166: break; 2167: case MathML_EL_MROW: 2168: /* end of MROW */ 2169: /*if the first and the last child are MO containing a fence character 2170: transform the MO into a MF and the character into a Thot SYMBOL */ 2171: child = TtaGetFirstChild (el); 2172: if (child != NULL) 2173: { 2174: CheckFence (child, doc); 2175: child = TtaGetLastChild (el); 2176: if (child != NULL) 2177: CheckFence (child, doc); 2178: /* Create placeholders within the MROW */ 2179: CreatePlaceholders (TtaGetFirstChild (el), doc); 2180: } 2181: break; 2182: default: 2183: break; 2184: } 2185: parent = TtaGetParent (el); 2186: parentType = TtaGetElementType (parent); 2187: if (parentType.ElSSchema != elType.ElSSchema) 2188: /* root of a MathML tree, Create a MathML element if there is no */ 2189: if (elType.ElTypeNum != MathML_EL_MathML) 2190: { 2191: elType.ElSSchema = MathMLSSchema; 2192: elType.ElTypeNum = MathML_EL_MathML; 2193: new = TtaNewElement (doc, elType); 2194: TtaInsertSibling (new, el, TRUE, doc); 2195: next = el; 2196: TtaNextSibling (&next); 2197: TtaRemoveTree (el, doc); 2198: TtaInsertFirstChild (&el, new, doc); 2199: prev = el; 2200: while (next != NULL) 2201: { 2202: child = next; 2203: TtaNextSibling (&next); 2204: TtaRemoveTree (child, doc); 2205: TtaInsertSibling (child, prev, FALSE, doc); 2206: prev = child; 2207: } 2208: /* Create placeholders within the MathML element */ 2209: CreatePlaceholders (el, doc); 2210: } 2211: } 2212: } 2213: 2214: /*---------------------------------------------------------------------- 2215: MathMLAttributeComplete 2216: ----------------------------------------------------------------------*/ 2217: #ifdef __STDC__ 2218: void MathMLAttributeComplete (Attribute attr, Element el, Document doc) 2219: #else 2220: void MathMLAttributeComplete (attr, el, doc) 2221: Attribute attr; 2222: Element el; 2223: Document doc; 2224: 2225: #endif 2226: { 2227: } 2228: 2229: /*---------------------------------------------------------------------- 2230: MathMLGetDTDName 2231: ----------------------------------------------------------------------*/ 2232: #ifdef __STDC__ 1.14 cvs 2233: void MathMLGetDTDName (STRING DTDname, STRING elementName) 1.1 cvs 2234: #else 2235: void MathMLGetDTDName (DTDname, elementName) 1.14 cvs 2236: STRING DTDname; 2237: STRING elementName; 1.1 cvs 2238: 2239: #endif 2240: { 2241: /* no other DTD allowed within MathML elements */ 1.14 cvs 2242: ustrcpy (DTDname, ""); 1.1 cvs 2243: } 2244: 2245: /* end of module */