Commit 697bf715 authored by Vivien Kraus's avatar Vivien Kraus
Browse files

Generate the bindings directly in C

The other options were ot generate scheme code, or use scheme macros
to generate it at macro expand time.

The latter is not possible in r7rs-small, because syntax-case has been
removed.  So I will not go down this road.

The former is quite awkward, because we constantly need to jump in the
XML document in order to get the C type names of things.

So for now everything is XSLT+C.
parent f03d90cc
......@@ -116,6 +116,7 @@
/src/libtarot/pkgconfig/libtarot.pc
/src/libtarot/semantic-api/api.sxml
/src/libtarot/semantic-api/api.xml
/src/libtarot/semantic-api/tarot_guile.c
/src/libtarot/test/cheating-called-suit.c
/src/libtarot/test/cheating.c
/src/libtarot/test/dog-impossible
......
......@@ -37,6 +37,7 @@ apt-get install -y \
git \
gobject-introspection \
gperf \
guile-2.2 \
help2man \
imagemagick \
indent \
......
......@@ -14,14 +14,20 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
EXTRA_DIST += \
%reldir%/semantic-api.xsl
%reldir%/semantic-api.xsl \
%reldir%/guile-bindings.xsl
dist_pkgdata_DATA += %reldir%/api.xml
dist_pkgdata_DATA += %reldir%/api.xml %reldir%/tarot_guile.c
MAINTAINERCLEANFILES += \
$(srcdir)/%reldir%/api.xml
$(srcdir)/%reldir%/api.xml \
$(srcdir)/%reldir%/tarot_guile.c
$(srcdir)/%reldir%/api.xml: %reldir%/semantic-api.xsl src/libtarot/gobject/Tarot.gir
$(AM_V_GEN) $(XSLTPROC) $(srcdir)/%reldir%/semantic-api.xsl $(srcdir)/src/libtarot/gobject/Tarot.gir \
| $(XMLLINT) --format - > $(srcdir)/%reldir%/api.xml-t
@mv $(srcdir)/%reldir%/api.xml-t $(srcdir)/%reldir%/api.xml
$(srcdir)/%reldir%/tarot_guile.c: %reldir%/api.xml %reldir%/guile-bindings.xsl
$(AM_V_GEN) $(XSLTPROC) $(srcdir)/%reldir%/guile-bindings.xsl $(srcdir)/%reldir%/api.xml | sed 's/, )/)/g' | $(INDENT) > $(srcdir)/%reldir%/tarot_guile.c-t
@mv $(srcdir)/%reldir%/tarot_guile.c-t $(srcdir)/%reldir%/tarot_guile.c
<?xml version="1.0" encoding="UTF-8"?>
<!-- tarot implements the rules of the tarot game
Copyright (C) 2019 Vivien Kraus
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
This program 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="text" indent="no"/>
<xsl:strip-space elements="*" />
<xsl:template match="api">
</xsl:template>
</xsl:stylesheet>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment