Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

[r12395]: experimental / trunk / graphing-calc / mathml.h Maximize Restore History

Download this file

mathml.h    92 lines (73 with data), 2.8 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
* mathml.cc --
* Copyright (c) Michael Sloan
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with libaffa; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef H_MATHML
#define H_MATHML
#include <libxml/parser.h>
#include <libxml/tree.h>
#include "eval.h"
namespace MathML {
struct Doc {
xmlDocPtr doc;
xmlNsPtr ns;
xmlNodePtr root;
Doc(){
doc = xmlNewDoc(BAD_CAST "1.0");
doc->intSubset = xmlCreateIntSubset(doc, BAD_CAST "math", BAD_CAST "-//W3C//DTD MathML 2.0//EN", BAD_CAST "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd");
xmlAddChild((xmlNodePtr) doc, (xmlNodePtr) doc->intSubset);
root = xmlNewNode(NULL, BAD_CAST "math");
xmlNewProp(root, BAD_CAST "display" , BAD_CAST "block");
xmlDocSetRootElement(doc, root);
ns = xmlNewNs(root, BAD_CAST "http://www.w3.org/1998/Math/MathML", NULL);
xmlSetNs(root, ns);
}
~Doc(){
xmlFreeDoc(doc);
}
xmlNodePtr add_identifier(xmlNodePtr node, const char *name);
xmlNodePtr add_number(xmlNodePtr node, int d);
xmlNodePtr add_number(xmlNodePtr node, double d);
xmlNodePtr add_operator(xmlNodePtr node, const char *name);
xmlNodePtr add_operator(xmlNodePtr node, const char *name, bool prefix);
xmlNodePtr add_text(xmlNodePtr node, const char *text);
xmlNodePtr add_space(xmlNodePtr node);
xmlNodePtr add_string(xmlNodePtr node, const char *text);
xmlNodePtr add_row(xmlNodePtr node);
xmlNodePtr add_fraction(xmlNodePtr node);
xmlNodePtr add_sqrt(xmlNodePtr node);
xmlNodePtr add_root(xmlNodePtr node);
xmlNodePtr add_parenthesis(xmlNodePtr node);
xmlNodePtr add_subscript(xmlNodePtr node);
xmlNodePtr add_superscript(xmlNodePtr node);
xmlNodePtr add_function(xmlNodePtr node, const char *name);
xmlNodePtr add_function(xmlNodePtr node, const char *name, bool inverse);
};
using namespace Eval;
Doc* doc_from_func(Function func);
}
#endif
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :