* or send an email to <lpadovan@cs.unibo.it>
*/
+#include <cassert>
+
#include "dom.hh"
#include "TPushParser.hh"
-#include "TPushLexer.hh"
-#include "LPushLexer.hh"
+#include "timer.hh"
+
+#include "ILPushLexer.hh"
#include "TDictionary.hh"
#include "CLoggerConsole.hh"
#include "CMathMLFactoryXSLT.hh"
struct Context
{
+ /*
+ Context(const std::string& s, TPushLexer& l, TPushParser& p) : buffer(s), i(0), lexer(l), parser(p) { };
+ */
Context(const std::string& s, APushLexer& l, TPushParser& p, DOMX::XSLTStylesheet& ts)
: buffer(s), i(0), lexer(l), parser(p), texStyle(ts) { };
#if 0
res.normalize();
DOM::Node c = res.get_firstChild();
- if (c) cout << "HEY, there is a child! " << c.get_nodeName() << " " << c.get_nodeValue() << endl;
+ if (c) std::cout << "HEY, there is a child! " << c.get_nodeName() << " " << c.get_nodeValue() << std::endl;
#endif
- data->texStyle.save(res, stdout);
+ //data->texStyle.save(res, stdout);
}
extern "C" int
edit_push_char(Context* context, gchar ch)
{
assert(context != NULL);
+ long t0 = getTimer();
GUI_freeze();
- cout << "*** SENDING " << ch << endl;
+ std::cout << "*** SENDING " << ch << std::endl;
context->lexer.push(ch);
GUI_thaw();
+ long t1 = getTimer();
+ std::cout << "=== OVERALL TIME = " << (t1 - t0) / 1000 << std::endl;
}
#include <unistd.h>
}
extern "C" void
-edit_drop(Context* context, gboolean alt)
+edit_drop(Context* context, gboolean alt, gboolean control)
{
+ // At the moment, the last parameter is not used, but it will
+ // be useful when we will handle the "fast" deletion
assert(context != NULL);
GUI_freeze();
context->lexer.drop(alt);
GUI_thaw();
}
-void
+extern "C" void
+edit_complete(Context* context)
+{
+ assert(context != NULL);
+ GUI_freeze();
+ if (!context->lexer.complete()) context->lexer.push('\t');
+ GUI_thaw();
+}
+
+int
main(int argc, char* argv[])
{
CLoggerConsole logger;
TDictionary dictionary(logger);
logger.info("loading the dictionary...");
- dictionary.load("/home/luca/projects/helm/DEVEL/mathml_editor/dictionary-test.xml");
+ dictionary.load("./dict/dictionary-tex.xml");
logger.info("loading the stylesheet...");
DOM::DOMImplementation di;
DOM::Document mmlStyleDoc = di.createDocumentFromURI("./xsl/tml-mmlp.xsl");
DOMX::XSLTStylesheet mmlStyle(mmlStyleDoc);
- DOM::Document texStyleDoc = di.createDocumentFromURI("./xsl/tml-tex.xsl");
+ DOM::Document texStyleDoc = di.createDocumentFromURI("./xsl/tml-texid.xsl");
DOMX::XSLTStylesheet texStyle(texStyleDoc);
CMathMLFactoryXSLT factory(logger, mmlStyle);
TPushParser parser(logger, factory, dictionary);
- LPushLexer lexer(logger, parser);
+ ILPushLexer lexer(logger, parser, dictionary);
#if 0
lexer.push('$');
GUI_run();
GUI_uninit();
GUI_unload_document();
+
}