Commit 0beb6441 authored by Vivien Kraus's avatar Vivien Kraus
Browse files

Merge branch '173-guile-bindings' into 'develop'

Resolve "Guile bindings"

Closes #173

See merge request !168
parents f03d90cc c4d72d35
Pipeline #180536 passed with stages
in 37 minutes and 24 seconds
......@@ -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
......
......@@ -59,7 +59,7 @@ AM_YFLAGS = -d
AM_CFLAGS += \
$(NETTLE_CFLAGS) $(XML_CFLAGS)
AM_LDADD += \
$(NETTLE_LIBS) $(XML_LIBS)
$(NETTLE_LIBS) $(XML_LIBS) $(GUILE_LIBS)
if WITH_GOBJECT
AM_CFLAGS += $(GOBJECT_CFLAGS)
......
......@@ -18,6 +18,7 @@ apt-get update
apt-get upgrade -y
apt-get install -y \
build-essential \
guile-2.2-dev \
libglib2.0-dev \
libxml2 \
libxml2-dev \
......
......@@ -18,6 +18,7 @@ apt-get update || exit 1
apt-get install -y \
build-essential \
guile-2.2-dev \
libcairo2-dev \
libglib2.0-dev \
libgtk-3-0 \
......
......@@ -37,6 +37,7 @@ apt-get install -y \
git \
gobject-introspection \
gperf \
guile-2.2-dev \
help2man \
imagemagick \
indent \
......
......@@ -20,6 +20,7 @@ apt-get install -y \
build-essential \
curl \
git \
guile-2.2-dev \
libcairo2-dev \
libgirepository1.0-dev \
libglib2.0-dev \
......
......@@ -137,6 +137,15 @@ AC_ARG_WITH([static_program_name],
AS_IF([test "x$with_static_program_name" != "xno"], [
CPPFLAGS="$CPPFLAGS -Dprogram_name=tarot_libtarot_program_name"
])
HAVE_GUILE="0"
for guile_version in 2.2 2.0
do
AS_IF([test "x$HAVE_GUILE" == x0], [
PKG_CHECK_MODULES([GUILE], [guile-$guile_version], [HAVE_GUILE="1"], [true])
])
done
AC_DEFINE_UNQUOTED(HAVE_GUILE, $HAVE_GUILE, [Whether the tarot_guile_init () function works with guile])
AM_CONDITIONAL([HAVE_GUILE], [test "x$HAVE_GUILE" != "x0"])
# Checks for header files.
AC_HEADER_STDBOOL
......
......@@ -40,6 +40,17 @@ cat <<EOF
"share/tarot/dataset"
],
"modules": [
{
"name": "guile",
"buildsystem": "autotools",
"sources": [
{
"type": "archive",
"url": "https://ftp.gnu.org/gnu/guile/guile-2.2.6.tar.gz",
"sha256": "08c0e7487777740b61cdd97949b69e8a5e2997d8c2fe6c7e175819eb18444506"
}
]
},
{
"name": "tarot",
"buildsystem": "autotools",
......
......@@ -46,3 +46,4 @@ include %reldir%/xml/Makefile.am
include %reldir%/features/Makefile.am
include %reldir%/cnn/Makefile.am
include %reldir%/solo/Makefile.am
include %reldir%/guile/Makefile.am
......@@ -32,6 +32,8 @@ static char *libtarot_localedir = NULL;
static char *libtarot_datadir = NULL;
static char *libtarot_pkgdatadir = NULL;
int tarot_libtarot_with_guile = HAVE_GUILE;
static void
tarot_set_localedir (const char *localedir)
{
......
......@@ -48,6 +48,8 @@ extern "C"
*/
const char *tarot_libtarot_version (void);
extern int tarot_libtarot_with_guile;
#ifdef __cplusplus
}
#endif /* __cplusplus */
......
# 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/>.
AM_CPPFLAGS += -I $(srcdir)/%reldir% -I %reldir%
EXTRA_DIST += %reldir%/test_guile.c
if HAVE_GUILE
AM_CFLAGS += $(GUILE_CFLAGS)
AM_LIBS += $(GUILE_LIBS)
check_PROGRAMS += %reldir%/test-guile
%canon_reldir%_test_guile_SOURCES = \
src/libtarot/semantic-api/tarot_guile.c \
%reldir%/test_guile.c
%canon_reldir%_test_guile_LDADD = src/libtarot/libtarot.la $(AM_LIBS)
TESTS += %reldir%/test-guile
endif
/* 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/>.
*/
#include <config.h>
#include <tarot.h>
#include <stdio.h>
#include <stdlib.h>
#include <libguile.h>
void tarot_guile_init ();
static void
inner_main (void *data, int argc, char **argv)
{
(void) data;
(void) argc;
(void) argv;
tarot_guile_init ();
}
int
main (int argc, char *argv[])
{
scm_boot_guile (argc, argv, inner_main, NULL);
return EXIT_SUCCESS;
}
......@@ -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
This diff is collapsed.
......@@ -43,20 +43,16 @@ extern "C"
* @mem_out: (array length=max_mem): available aligned memory
* @alignment: (out): the game alignment
*/
size_t tarot_solo_con(size_t max_mem, char *mem_out, size_t *alignment);
size_t tarot_solo_construct (size_t max_mem, char *mem_out, size_t *alignment);
void tarot_solo_copy (TarotSolo * dest, const TarotSolo * source);
void tarot_solo_copy_as (TarotSolo *dest, const TarotSolo *source, TarotPlayer who);
/**
* tarot_solo_get:
* @game: (out):
*/
void tarot_solo_get (const TarotSolo *solo, TarotGame *game);
TarotGame *tarot_solo_get_alloc (const TarotSolo *solo);
/**
* tarot_solo_setup:
* @owners: (array length=n_owners):
* @with_call: (type boolean):
*/
TarotGameError tarot_solo_setup (TarotSolo *solo, size_t n_players, int with_call, TarotPlayer myself, size_t n_owners, const TarotPlayer *owners, TarotPlayer taker, TarotCard call);
......
Supports Markdown
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