]> matita.cs.unibo.it Git - helm.git/commitdiff
* added default dictionary/stylesheet paths
authorLuca Padovani <luca.padovani@unito.it>
Thu, 20 Mar 2003 16:15:12 +0000 (16:15 +0000)
committerLuca Padovani <luca.padovani@unito.it>
Thu, 20 Mar 2003 16:15:12 +0000 (16:15 +0000)
* small fix in configure.ac

14 files changed:
helm/DEVEL/mathml_editor/configure.ac
helm/DEVEL/mathml_editor/ocaml/c_mathml_editor.cc
helm/DEVEL/mathml_editor/ocaml/c_mathml_editor.h
helm/DEVEL/mathml_editor/ocaml/i_mathml_editor.ml
helm/DEVEL/mathml_editor/ocaml/mathml_editor.ml
helm/DEVEL/mathml_editor/ocaml/ml_mathml_editor.c
helm/DEVEL/mathml_editor/src/AMathMLFactory.cc [new file with mode: 0644]
helm/DEVEL/mathml_editor/src/AMathMLFactory.hh
helm/DEVEL/mathml_editor/src/ILPushLexer.cc
helm/DEVEL/mathml_editor/src/Makefile.am
helm/DEVEL/mathml_editor/src/TDictionary.cc
helm/DEVEL/mathml_editor/src/TDictionary.hh
helm/DEVEL/mathml_editor/src/config.dirs.in [new file with mode: 0644]
helm/DEVEL/mathml_editor/test/editor.cc

index 20227a54d7c4fe646490e8039484732cb811602f..f39a5f93f59f011282ddfac1b65eb644799ee495 100644 (file)
@@ -35,7 +35,7 @@ AC_ARG_WITH(gmetadom-prefix,
        GMETADOM_PREFIX=$withval
 )
 
-AC_CONFIG_HEADERS([config.h])
+dnl AC_CONFIG_HEADERS([config.h])
 AM_CONFIG_HEADER(config.h)
 
 AH_TOP([
@@ -249,6 +249,7 @@ AC_SUBST(OCAML_INCLUDE_DIR)
 AC_CONFIG_FILES([
  Makefile 
  src/Makefile
+ src/config.dirs
  test/Makefile
  textomml/Makefile
  textomml/config.dirs
index 73bc4abb7cd2e3706b4ef6999617486ce0c31bd7..f610a7ff5d92bd810ee56dcefdb67310f65a9274 100644 (file)
@@ -96,6 +96,24 @@ Editor::~Editor()
   delete logger;
 }
 
+extern "C" const char*
+c_mathml_editor_get_default_dictionary_path()
+{
+  return TDictionary::getDefaultDictionaryPath().c_str();
+}
+
+extern "C" const char*
+c_mathml_editor_get_default_mathml_stylesheet_path()
+{
+  return AMathMLFactory::getDefaultMathMLStylesheetPath().c_str();
+}
+
+extern "C" const char*
+c_mathml_editor_get_default_tex_stylesheet_path()
+{
+  return AMathMLFactory::getDefaultTeXStylesheetPath().c_str();
+}
+
 extern "C" Editor*
 c_mathml_editor_new(GdomeDocument* dictionary,
                    GdomeDocument* tml_mml,
index 63796bcd82071804ebd153546a750ec23c8ded1c..6c8a5f5cb126703df0ebef1234be00a015edc317 100644 (file)
@@ -30,6 +30,9 @@
 
 typedef struct Editor Editor;
 
+const char*    c_mathml_editor_get_default_dictionary_path(void);
+const char*    c_mathml_editor_get_default_mathml_stylesheet_path(void);
+const char*    c_mathml_editor_get_default_tex_stylesheet_path(void);
 Editor*        c_mathml_editor_new(GdomeDocument*, GdomeDocument*, GdomeDocument*, void (*)(int, const char*, void*), void*);
 void           c_mathml_editor_destroy(Editor*);
 int            c_mathml_editor_freeze(Editor*);
index 229478101f89eaf450ca0487d080c3ad68cbe27e..25171b8bb9fa07f23db5a694d43d1c55b49c5414 100644 (file)
 
 type t
 
+external get_default_dictionary_path : unit -> string
+  = "ml_mathml_editor_get_default_dictionary_path"
+
+external get_default_mathml_stylesheet_path : unit -> string
+  = "ml_mathml_editor_get_default_mathml_stylesheet_path"
+
+external get_default_tex_stylesheet_path : unit -> string
+  = "ml_mathml_editor_get_default_tex_stylesheet_path"
+
 external create : 
   dictionary:[> `Document] GdomeT.t ->
   mml: [> `Document] GdomeT.t -> 
index 06372e8e497729be4f6c498c8c1f6e081cccf264..472760184651d98c62f149c61b9e8933fec19e41 100644 (file)
  * or send an email to <lpadovan@cs.unibo.it>
  *)
 
+let default_dictionary_path = I_mathml_editor.get_default_dictionary_path ()
+;;
+
+let default_mathml_stylesheet_path = I_mathml_editor.get_default_mathml_stylesheet_path ()
+;;
+
+let default_tex_stylesheet_path = I_mathml_editor.get_default_tex_stylesheet_path ()
+;;
+
 let create ~dictionary ~mml ~tml ~log =
   I_mathml_editor.create dictionary#as_Document mml#as_Document tml#as_Document log
 ;;
index 9b78aeb4101ade83155400f41882b5a43fc3c7c0..4f84fffe36c814eb0f06e94abaa66cbb829ecb8f 100644 (file)
@@ -58,7 +58,7 @@ ml_mathml_editor_finalize(value v)
   free(editor);
 }
 
-void
+static void
 ml_mathml_editor_log_callback(int level, const char* msg, void* user_data)
 {
   ml_Editor* ml_editor = (ml_Editor*) user_data;
@@ -66,6 +66,27 @@ ml_mathml_editor_log_callback(int level, const char* msg, void* user_data)
   callback2(ml_editor->callback, Val_int(level), copy_string(msg));
 }
 
+value
+ml_mathml_editor_get_default_dictionary_path(value unit)
+{
+  CAMLparam1(unit);
+  CAMLreturn(copy_string(c_mathml_editor_get_default_dictionary_path()));
+}
+
+value
+ml_mathml_editor_get_default_mathml_stylesheet_path(value unit)
+{
+  CAMLparam1(unit);
+  CAMLreturn(copy_string(c_mathml_editor_get_default_mathml_stylesheet_path()));
+}
+
+value
+ml_mathml_editor_get_default_tex_stylesheet_path(value unit)
+{
+  CAMLparam1(unit);
+  CAMLreturn(copy_string(c_mathml_editor_get_default_tex_stylesheet_path()));
+}
+
 value
 ml_mathml_editor_new(value dictionary,
                     value tml_mml,
diff --git a/helm/DEVEL/mathml_editor/src/AMathMLFactory.cc b/helm/DEVEL/mathml_editor/src/AMathMLFactory.cc
new file mode 100644 (file)
index 0000000..8f8b21c
--- /dev/null
@@ -0,0 +1,42 @@
+/* This file is part of EdiTeX, an editor of mathematical
+ * expressions based on TeX syntax.
+ * 
+ * Copyright (C) 2002-2003 Luca Padovani <lpadovan@cs.unibo.it>,
+ *                    2003 Paolo Marinelli <pmarinel@cs.unibo.it>.
+ *
+ * This library 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.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * For more information, please visit the project's home page
+ * http://helm.cs.unibo.it/editex/
+ * or send an email to <lpadovan@cs.unibo.it>
+ */
+
+#include <string>
+
+#include "config.dirs"
+#include "AMathMLFactory.hh"
+
+std::string
+AMathMLFactory::getDefaultMathMLStylesheetPath()
+{
+  return PKGDATADIR"tml-mmlp.xsl";
+}
+
+std::string
+AMathMLFactory::getDefaultTeXStylesheetPath()
+{
+  return PKGDATADIR"tml-tex.xsl";
+}
+
index b91d240d426a0c68d6caf3ed55b0477de85ebdc3..f53b56408bb2c1f99deb24e6c78ade44dafaec41 100644 (file)
@@ -34,6 +34,9 @@ public:
   AMathMLFactory(class ALogger& l) : logger(l) { };
   virtual ~AMathMLFactory() { };
 
+  static std::string getDefaultMathMLStylesheetPath(void);
+  static std::string getDefaultTeXStylesheetPath(void);
+
   virtual void documentModified(class TDocument&) = 0;
   virtual DOM::Document document(void) const = 0;
 
index 8a2777fef317d7d11a6b860e5c7713e10f703cdc..b82b52e5c3a654f2293f0bbe78ccaa7f7aafbefb 100644 (file)
@@ -24,7 +24,7 @@ ILPushLexer::complete()
       if (!complete_list.size())
         {
           // no matching macro
-          logger.warning("wrong prefix: nothing to complete");
+          logger.warning("no known macro with `" + buffer + "' prefix");
         }
       else if (complete_list.size() == 1)
         {
@@ -34,7 +34,13 @@ ILPushLexer::complete()
       else
         {
           // we have more than one matching macro
-          logger.warning("prefix not sufficient");
+          logger.warning("ambiguous prefix `" + buffer + "'");
+         for (std::list<std::string>::const_iterator p = complete_list.begin();
+              p != complete_list.end();
+              p++)
+           {
+             logger.info("Candidate: " + *p);
+           }
           buffer = new_buffer;
         }
 
index 439f23e52ea1d6d86f27fd3f631d818c0d255a0d..f1c14e5f090582421e3500c76c192896b87bdefb 100644 (file)
@@ -16,6 +16,7 @@ libeditex_la_SOURCES = \
   LPushLexer.cc \
   APushParser.cc \
   TPushParser.cc \
+  AMathMLFactory.cc \
   CMathMLFactoryXSLT.cc \
   CMathMLFactoryXSLTDiff.cc \
   TDictionary.cc \
index c1aae5cc1dbd427f9b457ae44a8f353682b29372..2359b69cbfa6855596875bed87535666056fc733 100644 (file)
@@ -26,6 +26,7 @@
 #include <sstream>
 
 #include "dom.hh"
+#include "config.dirs"
 #include "TDictionary.hh"
 #include "TTokenizer.hh"
 #include "CLoggerConsole.hh"
@@ -48,6 +49,12 @@ getURIName(const std::string& uri)
   else return uri;
 }
 
+std::string
+TDictionary::getDefaultDictionaryPath()
+{
+  return PKGDATADIR"/dictionary-tex.xml";
+}
+
 void
 TDictionary::load(const std::string& uri)
 {
index 43c2e51af3f5511d79f45e814918fd1045e2ad37..8807f83772e0e2076a86079b9d1ca12875ea25bc 100644 (file)
@@ -84,6 +84,8 @@ public:
     unsigned table : 1;
   };
 
+  static std::string getDefaultDictionaryPath(void);
+
   void load(const std::string&);
   void load(const std::string&, const std::string&);
   void load(const DOM::Document&, const std::string& = "");
diff --git a/helm/DEVEL/mathml_editor/src/config.dirs.in b/helm/DEVEL/mathml_editor/src/config.dirs.in
new file mode 100644 (file)
index 0000000..1ce2d0a
--- /dev/null
@@ -0,0 +1,3 @@
+
+#define PKGDATADIR "@prefix@/share/@PACKAGE@"
+
index 6f9175f949d1da8c76c4be8660347dc2c7d2482b..37b84866ce3f9cc0f1c6f0cf770af4c69f88ffe2 100644 (file)
@@ -162,7 +162,7 @@ main(int argc, char* argv[])
   DOM::Document texStyleDoc = di.createDocumentFromURI("./xsl/tml-texid.xsl");
   DOMX::XSLTStylesheet texStyle(texStyleDoc);
 
-  CMathMLFactoryXSLT factory(logger, mmlStyle);
+  CMathMLFactoryXSLTDiff factory(logger, mmlStyle);
   TPushParser parser(logger, factory, dictionary);
   ILPushLexer lexer(logger, parser, dictionary);