SUBDIRS = src test ocaml textomml
CLEANFILES = core
-bin_SCRIPTS = editex-config
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = editex.pc
backup:
cd ..; tar cvfz @PACKAGE@-@VERSION@-`date|tr ' ' '_'|tr ':' '_'`.tar.gz @PACKAGE@
EXEEXT = @EXEEXT@
GDOMEXSLT_CFLAGS = @GDOMEXSLT_CFLAGS@
GDOMEXSLT_LIBS = @GDOMEXSLT_LIBS@
+GLIB2_CFLAGS = @GLIB2_CFLAGS@
+GLIB2_LIBS = @GLIB2_LIBS@
GMETADOM_CFLAGS = @GMETADOM_CFLAGS@
GMETADOM_LIBS = @GMETADOM_LIBS@
GTKMATHVIEW_CFLAGS = @GTKMATHVIEW_CFLAGS@
OCAMLSTUBDIR = @OCAMLSTUBDIR@
OCAML_INCLUDE_DIR = @OCAML_INCLUDE_DIR@
PACKAGE = @PACKAGE@
+PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
STRIP = @STRIP@
VERSION = @VERSION@
SUBDIRS = src test ocaml textomml
CLEANFILES = core
-bin_SCRIPTS = editex-config
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = editex.pc
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES = editex-config
-SCRIPTS = $(bin_SCRIPTS)
+CONFIG_CLEAN_FILES = editex.pc
+DATA = $(pkgconfig_DATA)
DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \
-Makefile.am Makefile.in NEWS aclocal.m4 config.guess config.h.in \
-config.sub configure configure.ac editex-config.in install-sh ltmain.sh \
+Makefile.am Makefile.in NEWS TODO aclocal.m4 config.guess config.h.in \
+config.sub configure configure.ac editex.pc.in install-sh ltmain.sh \
missing mkinstalldirs
-rm -f config.h
maintainer-clean-hdr:
-editex-config: $(top_builddir)/config.status editex-config.in
+editex.pc: $(top_builddir)/config.status editex.pc.in
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
-install-binSCRIPTS: $(bin_SCRIPTS)
+install-pkgconfigDATA: $(pkgconfig_DATA)
@$(NORMAL_INSTALL)
- $(mkinstalldirs) $(DESTDIR)$(bindir)
- @list='$(bin_SCRIPTS)'; for p in $$list; do \
- if test -f $$p; then \
- echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
- $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
- else if test -f $(srcdir)/$$p; then \
- echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
- $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
- else :; fi; fi; \
+ $(mkinstalldirs) $(DESTDIR)$(pkgconfigdir)
+ @list='$(pkgconfig_DATA)'; for p in $$list; do \
+ if test -f $(srcdir)/$$p; then \
+ echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgconfigdir)/$$p"; \
+ $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgconfigdir)/$$p; \
+ else if test -f $$p; then \
+ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(pkgconfigdir)/$$p"; \
+ $(INSTALL_DATA) $$p $(DESTDIR)$(pkgconfigdir)/$$p; \
+ fi; fi; \
done
-uninstall-binSCRIPTS:
+uninstall-pkgconfigDATA:
@$(NORMAL_UNINSTALL)
- list='$(bin_SCRIPTS)'; for p in $$list; do \
- rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
+ list='$(pkgconfig_DATA)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(pkgconfigdir)/$$p; \
done
# This directory's subdirectories are mostly independent; you can cd
all-recursive-am: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
-install-exec-am: install-binSCRIPTS
+install-exec-am:
install-exec: install-exec-recursive
-install-data-am:
+install-data-am: install-pkgconfigDATA
install-data: install-data-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-recursive
-uninstall-am: uninstall-binSCRIPTS
+uninstall-am: uninstall-pkgconfigDATA
uninstall: uninstall-recursive
-all-am: Makefile $(SCRIPTS) config.h
+all-am: Makefile $(DATA) config.h
all-redirect: all-recursive-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs: installdirs-recursive
installdirs-am:
- $(mkinstalldirs) $(DESTDIR)$(bindir)
+ $(mkinstalldirs) $(DESTDIR)$(pkgconfigdir)
mostlyclean-generic:
-rm -f config.status
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
-uninstall-binSCRIPTS install-binSCRIPTS install-data-recursive \
+uninstall-pkgconfigDATA install-pkgconfigDATA install-data-recursive \
uninstall-data-recursive install-exec-recursive \
uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
all-recursive check-recursive installcheck-recursive info-recursive \
--- /dev/null
+
+* add param node in the TML with the name of the parameter
+* add space node? active node?
+* add alt boolean to all deleting methods
+* implement a mechanism that allows the definition of new macros
+* add open-group close-group attributes in the dictionary and handle them
+* implement macro completion
+
+BUGS
+* $1\over{2}$ does not work
+
+* compare pure_subst/pure_diff/subst_diff performances
+
dnl Process this file with autoconf to produce a configure script.
-AC_INIT
-AC_CONFIG_SRCDIR([src/TToken.hh])
+AC_INIT(editex, [0.0.1])
+AC_CONFIG_SRCDIR(src/TToken.hh)
+AM_INIT_AUTOMAKE($AC_PACKAGE_NAME, $AC_PACKAGE_VERSION)
+
+PACKAGE=$AC_PACKAGE_NAME
+VERSION=$AC_PACKAGE_VERSION
+AC_SUBST(PACKAGE)
+AC_SUBST(VERSION)
-PACKAGE=editex
-VERSION=0.0.1
EDITEX_VERSION_INFO=`echo $VERSION | awk -F. '{ printf "%d:%d:%d", $1+$2, $3, $2 }'`
AC_SUBST(EDITEX_VERSION_INFO)
)
AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
AM_CONFIG_HEADER(config.h)
AH_TOP([
AM_PROG_LIBTOOL
+PKG_CHECK_MODULES(GLIB2, glib-2.0)
+AC_SUBST(GLIB2_CFLAGS)
+AC_SUBST(GLIB2_LIBS)
+
GMETADOM_CONFIG="gmetadom-config"
GMETADOM_MIN_VERSION=0.1.0
AC_MSG_CHECKING([for GMetaDOM C++ library] >= $GMETADOM_MIN_VERSION)
textomml/Makefile
textomml/config.dirs
ocaml/Makefile
- editex-config
+ editex.pc
])
-AC_CONFIG_COMMANDS([default],[[chmod +x editex-config]],[[]])
AC_OUTPUT
<entry name="longleftarrow" class="o" val="????;"/>
<entry name="Longleftarrow" class="o" val="????"/>
<entry name="longrightarrow" class="o" val="????"/>
- <entry name="Longrightarrow" class="o" val="????"/>
+ <entry name="Longrightarrow" class="o" val="⇒"/>
<entry name="longleftrightarrow" class="o" val="????"/>
<entry name="Longleftrightarrow" class="o" val="????"/>
<entry name="longmapsto" class="o" val="????"/>
--- /dev/null
+# This is a comment
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: EdiTeX
+Description: An XML/MathML editor based on TeX/LaTeX syntax
+Version: @VERSION@
+Requires: glib-2.0
+Libs: -L${libdir} -leditex
+Cflags: -I${includedir}/editex
+
+#include <assert.h>
+
#include <caml/memory.h>
#include <caml/custom.h>
#include <caml/callback.h>
-#include <assert.h>
#include "mlgdomevalue.h"
#include "c_mathml_editor.h"
-#undef assert
-#define assert(x) {}
-
typedef struct
{
Editor* c_editor;
libeditex_la_LDFLAGS = -version-info @EDITEX_VERSION_INFO@
+libeditex_la_LDADDS = \
+ $(GLIB2_LIBS) \
+ $(GMETADOM_LIBS) \
+ $(GDOMEXSLT_LIBS)
+
libeditex_la_SOURCES = \
Diff.cc \
CLoggerConsole.cc \
TListener.hh \
dom.hh
-INCLUDES = $(GMETADOM_CFLAGS) $(GDOMEXSLT_CFLAGS)
+INCLUDES = \
+ $(GLIB2_CFLAGS) \
+ $(GMETADOM_CFLAGS) \
+ $(GDOMEXSLT_CFLAGS)
EXEEXT = @EXEEXT@
GDOMEXSLT_CFLAGS = @GDOMEXSLT_CFLAGS@
GDOMEXSLT_LIBS = @GDOMEXSLT_LIBS@
+GLIB2_CFLAGS = @GLIB2_CFLAGS@
+GLIB2_LIBS = @GLIB2_LIBS@
GMETADOM_CFLAGS = @GMETADOM_CFLAGS@
GMETADOM_LIBS = @GMETADOM_LIBS@
GTKMATHVIEW_CFLAGS = @GTKMATHVIEW_CFLAGS@
OCAMLSTUBDIR = @OCAMLSTUBDIR@
OCAML_INCLUDE_DIR = @OCAML_INCLUDE_DIR@
PACKAGE = @PACKAGE@
+PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
STRIP = @STRIP@
VERSION = @VERSION@
libeditex_la_LDFLAGS = -version-info @EDITEX_VERSION_INFO@
+libeditex_la_LDADDS = $(GLIB2_LIBS) $(GMETADOM_LIBS) $(GDOMEXSLT_LIBS)
+
+
libeditex_la_SOURCES = Diff.cc CLoggerConsole.cc TPushLexer.cc LPushLexer.cc APushParser.cc TPushParser.cc CMathMLFactoryXSLT.cc CMathMLFactoryXSLTDiff.cc TDictionary.cc TDocument.cc TNode.cc TTokenizer.cc
pkginclude_HEADERS = Diff.hh ALogger.hh CLoggerConsole.hh APushLexer.hh APushParser.hh AMathMLFactory.hh CMathMLFactoryXSLT.hh CMathMLFactoryXSLTDiff.hh TPushLexer.hh LPushLexer.hh TPushParser.hh TTokenizer.hh TDictionary.hh TDocument.hh TNode.hh TListener.hh dom.hh
-INCLUDES = $(GMETADOM_CFLAGS) $(GDOMEXSLT_CFLAGS)
+INCLUDES = $(GLIB2_CFLAGS) $(GMETADOM_CFLAGS) $(GDOMEXSLT_CFLAGS)
+
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
if (factory) factory->documentModified(doc);
}
-std::string
-TPushParser::PRIME() const
+TNode
+TPushParser::PRIME()
{
const TDictionary::Entry entry = dictionary.find("prime");
- if (entry.cls == TDictionary::OPERATOR) return entry.value;
- else return "?";
+ if (entry.cls == TDictionary::OPERATOR)
+ {
+ TNode op = doc.createO(entry.value, nextId++);
+ op["name"] = "prime";
+ return op;
+ }
+ else
+ {
+ TNode op = doc.createO("?", nextId++);
+ return op;
+ }
}
bool
TPushParser::isPrimes(const TNode& node) const
{
assert(node);
- return node.isG() && node.last() && node.last().is("o") && node.last()["val"] == PRIME();
+ return node.isG() && node.last() && node.last().is("o") && node.last()["name"] == "prime";
}
bool
{
if (prev.isSp() && prev[1] && isPrimes(prev[1]))
{
- prev[1].append(doc.createO(PRIME(), nextId++));
+ prev[1].append(PRIME());
return true;
}
else if (prev.isSb() && prev[0] &&
prev[0].isSp() && prev[0][1] &&
isPrimes(prev[0][1]))
{
- prev[0][1].append(doc.createO(PRIME(), nextId++));
+ prev[0][1].append(PRIME());
return true;
}
else
prev.replace(elem);
elem.append(prev);
elem.append(g);
- g.append(doc.createO(PRIME(), nextId++));
+ g.append(PRIME());
return true;
}
}
private:
void init(void);
- std::string PRIME(void) const;
+ TNode PRIME(void);
bool isPrimes(const TNode&) const;
-
-
bool do_begin(void);
bool do_end(void);
EXEEXT = @EXEEXT@
GDOMEXSLT_CFLAGS = @GDOMEXSLT_CFLAGS@
GDOMEXSLT_LIBS = @GDOMEXSLT_LIBS@
+GLIB2_CFLAGS = @GLIB2_CFLAGS@
+GLIB2_LIBS = @GLIB2_LIBS@
GMETADOM_CFLAGS = @GMETADOM_CFLAGS@
GMETADOM_LIBS = @GMETADOM_LIBS@
GTKMATHVIEW_CFLAGS = @GTKMATHVIEW_CFLAGS@
OCAMLSTUBDIR = @OCAMLSTUBDIR@
OCAML_INCLUDE_DIR = @OCAML_INCLUDE_DIR@
PACKAGE = @PACKAGE@
+PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
STRIP = @STRIP@
VERSION = @VERSION@
#include "dom.hh"
#include "TPushParser.hh"
#include "TPushLexer.hh"
+#include "LPushLexer.hh"
#include "TDictionary.hh"
#include "CLoggerConsole.hh"
#include "CMathMLFactoryXSLT.hh"
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;
};
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
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('$');
g_free(msg);
}
+static guint edit_timeout_id;
+extern void edit_timeout(gpointer);
+
void
GUI_init(int* argc, char*** argv, char* title, guint width, guint height, gpointer c)
{
gtk_widget_show(window);
context = c;
- /*edit_timeout_id = gtk_timeout_add(400, edit_timeout, context);*/
+ /*edit_timeout_id = gtk_timeout_add(50, edit_timeout, context);*/
}
void
</m:mo>
</xsl:template>
- <xsl:template name="cursor">
+ <xsl:template match="tml:cursor[@visible='1']">
<xsl:choose>
<xsl:when test="substring(@val,1,1)='\'">
<m:mrow>
<xsl:attribute name="xref">
<xsl:value-of select="@id"/>
</xsl:attribute>
- </xsl:if>I</m:mtext>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="tml:cursor[@visible='1']">
- <xsl:param name="annotation" select="/.."/>
- <xsl:choose>
- <xsl:when test="$annotation">
- <m:msub>
- <xsl:call-template name="cursor"/>
- <m:mtext>
- <xsl:value-of select="$annotation"/>
- </m:mtext>
- </m:msub>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="cursor"/>
+ </xsl:if><xsl:value-of select="@val"/>I</m:mtext>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:template>
<xsl:template match="tml:g">
- <xsl:param name="annotation" select="/.."/>
<xsl:choose>
<xsl:when test="not(@id) and count(*) = 1">
- <xsl:apply-templates select="*[1]">
- <xsl:with-param name="annotation" select="$annotation"/>
- </xsl:apply-templates>
+ <xsl:apply-templates select="*[1]"/>
</xsl:when>
<xsl:when test="tml:cursor">
<m:mstyle mathbackground="#e0e0e0">
</xsl:attribute>
</xsl:if>
<m:mrow>
- <xsl:apply-templates select="*">
- <xsl:with-param name="annotation" select="$annotation"/>
- </xsl:apply-templates>
+ <xsl:apply-templates select="*"/>
</m:mrow>
</m:mstyle>
</xsl:when>
<xsl:value-of select="@id"/>
</xsl:attribute>
</xsl:if>
- <xsl:apply-templates select="*">
- <xsl:with-param name="annotation" select="$annotation"/>
- </xsl:apply-templates>
+ <xsl:apply-templates select="*"/>
</m:mrow>
</xsl:otherwise>
</xsl:choose>
</m:mfrac>
</xsl:template>
+ <xsl:template match="tml:c[@name='space']">
+ <m:mspace width="veryverythickmathspace">
+ </m:mspace>
+ </xsl:template>
+
</xsl:stylesheet>
<xsl:template match="tml:n">
<xsl:choose>
<xsl:when test="@name">\<xsl:value-of select="@name"/>
- <xsl:if test="parent::tml:g and following-sibling::tml:n"><xsl:value-of select="' '"/></xsl:if>
+ <xsl:if test="parent::tml:g and following-sibling::tml:i"><xsl:value-of select="' '"/></xsl:if>
</xsl:when>
<xsl:when test="string-length(@val)=1"><xsl:value-of select="@val"/></xsl:when>
<xsl:otherwise>{\rm <xsl:value-of select="@val"/>}</xsl:otherwise>
<xsl:template match="tml:o">
<xsl:choose>
- <xsl:when test="@name">\<xsl:value-of select="@name"/><xsl:value-of select="' '"/></xsl:when>
+ <xsl:when test="@name">\<xsl:value-of select="@name"/>
+ <xsl:if test="parent::tml:g and following-sibling::tml:i"><xsl:value-of select="' '"/></xsl:if>
+ </xsl:when>
<xsl:when test="string-length(@val)=1"><xsl:value-of select="@val"/></xsl:when>
<xsl:otherwise><xsl:value-of select="@val"/></xsl:otherwise>
</xsl:choose>
<xsl:template match="tml:g[@id]">{<xsl:apply-templates select="*"/>}</xsl:template>
+ <xsl:template match="tml:g[count(*)>1]">{<xsl:apply-templates select="*"/>}</xsl:template>
+
<xsl:template match="tml:g">
<xsl:apply-templates select="*"/>
</xsl:template>