*/
#include <GdomeSmartDOMXSLT.hh>
+#include <cassert>
#include "ALogger.hh"
#include "TDictionary.hh"
#include "CMathMLFactoryXSLT.hh"
#include "TPushLexer.hh"
+#include "LPushLexer.hh"
#include "TPushParser.hh"
class CCallbackLogger : public ALogger
struct Editor
{
- Editor(const DOM::Document&, const DOM::Document&, const DOM::Document&, void (*)(int, const char*, void*), void*);
+ Editor(const char*, const char*, const char*, void (*)(int, const char*, void*), void*, bool);
~Editor();
ALogger* logger;
APushLexer* lexer;
};
-Editor::Editor(const DOM::Document& dict, const DOM::Document& mml, const DOM::Document& tex,
- void (*cb)(int, const char*, void*), void* data)
+Editor::Editor(const char* dict_uri, const char* mml_uri, const char* tex_uri,
+ void (*cb)(int, const char*, void*), void* data, bool alt)
{
+ assert(dict_uri);
+ assert(mml_uri);
+ assert(tex_uri);
assert(cb);
logger = new CCallbackLogger(cb, data);
dictionary = new TDictionary(*logger);
- dictionary->load(DOM::Document(dict));
+ dictionary->load(dict_uri);
+ DOM::DOMImplementation di;
+ DOM::Document mml = di.createDocumentFromURI(mml_uri);
+ DOM::Document tex = di.createDocumentFromURI(tex_uri);
tml_mml = new DOMX::XSLTStylesheet(mml);
tml_tex = new DOMX::XSLTStylesheet(tex);
factory = new CMathMLFactoryXSLT(*logger, *tml_mml);
parser = new TPushParser(*logger, *factory, *dictionary);
- lexer = new TPushLexer(*logger, *parser);
+ if (alt) lexer = new LPushLexer(*logger, *parser);
+ else lexer = new TPushLexer(*logger, *parser);
}
Editor::~Editor()
}
extern "C" Editor*
-c_mathml_editor_new(GdomeDocument* dictionary,
- GdomeDocument* tml_mml,
- GdomeDocument* tml_tex,
+c_mathml_editor_new(bool alt,
+ const char* dictionary_uri,
+ const char* tml_mml_uri,
+ const char* tml_tex_uri,
void (*log_message_cb)(int, const char*, void*),
void* user_data)
{
- return new Editor(DOM::Document(dictionary),
- DOM::Document(tml_mml),
- DOM::Document(tml_tex), log_message_cb, user_data);
+ return new Editor(dictionary_uri, tml_mml_uri, tml_tex_uri, log_message_cb, user_data, alt);
}
extern "C" void
c_mathml_editor_reset(Editor* editor)
{
assert(editor);
+ editor->lexer->reset();
editor->parser->reset();
}