]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/DEVEL/mathml_editor/test/editor.cc
* changed handling of ' (\primes) with a few patches in the stylesheets
[helm.git] / helm / DEVEL / mathml_editor / test / editor.cc
index 181dbf540657817d1421d9db1abaae7dd37a3401..b22bd3beda42b021a979814678083699dce614a4 100644 (file)
@@ -2,6 +2,7 @@
 #include "dom.hh"
 #include "TPushParser.hh"
 #include "TPushLexer.hh"
+#include "LPushLexer.hh"
 #include "TDictionary.hh"
 #include "CLoggerConsole.hh"
 #include "CMathMLFactoryXSLT.hh"
@@ -14,18 +15,17 @@ extern void *parseMathMLFile(char *);
 
 struct Context
 {
-  Context(const std::string& s, TPushLexer& l, TPushParser& p, DOMX::XSLTStylesheet& ts) 
+  Context(const std::string& s, APushLexer& l, TPushParser& p, DOMX::XSLTStylesheet& ts) 
     : buffer(s), i(0), lexer(l), parser(p), texStyle(ts) { };
 
   void send(void)
   {
     if (i < buffer.length()) lexer.push(buffer[i++]);
-    else lexer.push('\n');
   }
 
   std::string buffer;
   unsigned i;
-  TPushLexer& lexer;
+  APushLexer& lexer;
   TPushParser& parser;
   DOMX::XSLTStylesheet& texStyle;
 };
@@ -63,16 +63,28 @@ edit_push_char(Context* context, gchar ch)
   GUI_thaw();
 }
 
+#include <unistd.h>
+
 extern "C" void
 edit_push_string(Context* context, const gchar* s)
 {
   assert(context != NULL);
   assert(s != NULL);
-  GUI_freeze();
-  context->parser.freeze();
-  for (unsigned i = 0; s[i]; i++) context->lexer.push(s[i]);
-  context->parser.thaw();
-  GUI_thaw();
+#if 0
+//   GUI_freeze();
+//   context->parser.freeze();
+  for (unsigned i = 0; s[i]; i++)
+    {
+      GUI_freeze();
+      context->lexer.push(s[i]);
+      GUI_thaw();
+      usleep(100000);
+      usleep(100000);
+    }
+//   context->parser.thaw();
+//   GUI_thaw();
+#endif
+  context->buffer = s;
 }
 
 extern "C" void
@@ -112,9 +124,9 @@ main(int argc, char* argv[])
   DOM::Document texStyleDoc = di.createDocumentFromURI("./xsl/tml-tex.xsl");
   DOMX::XSLTStylesheet texStyle(texStyleDoc);
 
-  CMathMLFactoryXSLTDiff factory(logger, mmlStyle);
+  CMathMLFactoryXSLT factory(logger, mmlStyle);
   TPushParser parser(logger, factory, dictionary);
-  TPushLexer lexer(logger, parser);
+  LPushLexer lexer(logger, parser);
 
 #if 0
   lexer.push('$');