GMETADOM_PREFIX=$withval
)
-AC_CONFIG_HEADERS([config.h])
+dnl AC_CONFIG_HEADERS([config.h])
AM_CONFIG_HEADER(config.h)
AH_TOP([
AC_CONFIG_FILES([
Makefile
src/Makefile
+ src/config.dirs
test/Makefile
textomml/Makefile
textomml/config.dirs
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,
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*);
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 ->
* 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
;;
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;
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,
--- /dev/null
+/* 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";
+}
+
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;
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)
{
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;
}
LPushLexer.cc \
APushParser.cc \
TPushParser.cc \
+ AMathMLFactory.cc \
CMathMLFactoryXSLT.cc \
CMathMLFactoryXSLTDiff.cc \
TDictionary.cc \
#include <sstream>
#include "dom.hh"
+#include "config.dirs"
#include "TDictionary.hh"
#include "TTokenizer.hh"
#include "CLoggerConsole.hh"
else return uri;
}
+std::string
+TDictionary::getDefaultDictionaryPath()
+{
+ return PKGDATADIR"/dictionary-tex.xml";
+}
+
void
TDictionary::load(const std::string& uri)
{
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& = "");
--- /dev/null
+
+#define PKGDATADIR "@prefix@/share/@PACKAGE@"
+
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);