From ad8c9359649fa7123efc46a98c6cec0dd44f34c8 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Tue, 6 Jan 2015 21:25:40 +0200 Subject: Update for Guile 2.0 * configure.ac (AM_C_PROTOTYPES): Remove. * gint: Upgrade * modules/expat (libgamma_expat_la_CPPFLAGS): Add AM_CPPFLAGS * scripts/bootstrap: Fix deprecation warnings. (grammar): Fix definition of --parents * src/Makefile.am: Use AM_CPPFLAGS instead of INCLUDES * src/eval.c (scheme_exec_data) Remove. (scheme_safe_exec_body): Return result. (gamma_safe_exec): Use scm_c_catch instead of scm_internal_lazy_catch. * src/gamma-expat.c (gamma_xml_parser_create) (make_user_data): Use scm_malloc instead of scm_gc_malloc. * src/expat.sci: Don't load (ice-9 syncase) when using Guile 2.0 * src/sql.sci: Likewise. --- configure.ac | 3 +-- gint | 2 +- modules/expat | 2 +- scripts/bootstrap | 7 ++++--- src/Makefile.am | 15 +++++++++------ src/eval.c | 15 +++++++-------- src/expat.sci | 5 +++-- src/gamma-expat.c | 7 +++---- src/sql.sci | 6 ++++-- 9 files changed, 33 insertions(+), 29 deletions(-) diff --git a/configure.ac b/configure.ac index d7993f0..15aeb87 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ dnl This file is part of Gamma -dnl Copyright (C) 2002, 2004, 2007, 2010 Sergey Poznyakoff +dnl Copyright (C) 2002, 2004, 2007, 2010, 2015 Sergey Poznyakoff dnl dnl Gamma is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by @@ -33,7 +33,6 @@ AC_PROG_CC AC_PROG_INSTALL AC_PROG_LN_S AM_PROG_LIBTOOL -AM_C_PROTOTYPES GINT_INIT(gint,[1.8]) diff --git a/gint b/gint index 4254b05..fd86bf7 160000 --- a/gint +++ b/gint @@ -1 +1 @@ -Subproject commit 4254b0590e609b82dac3d688ecb401c9eefb7e25 +Subproject commit fd86bf7d44b0c970771830692ae7491447ebe8b1 diff --git a/modules/expat b/modules/expat index e4f6686..4017150 100644 --- a/modules/expat +++ b/modules/expat @@ -44,4 +44,4 @@ expat.sci makefile: expat.scm: Makefile libgamma_expat_la_LIBADD = @LTLIBOBJS@ @GUILE_LIBS@ $(EXPAT_LIBS) -libgamma_expat_la_CPPFLAGS = $(EXPAT_INCS) +libgamma_expat_la_CPPFLAGS = $(AM_CPPFLAGS) $(EXPAT_INCS) diff --git a/scripts/bootstrap b/scripts/bootstrap index 9c37074..264d1a7 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,7 +4,7 @@ main='(module-ref (resolve-module '\''(scripts bootstrap)) '\'main')' exec ${GUILE-guile} -l $0 -c "(apply $main (cons \"$0\" (cdr (command-line))))" "$@" !# ;;;; This file is part of Gamma. -;;;; Copyright (C) 2010 Sergey Poznyakoff +;;;; Copyright (C) 2010, 2015 Sergey Poznyakoff ;;;; ;;;; Gamma is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -26,7 +26,8 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cons \"$0\" (cdr (command-line))))" :use-module (ice-9 popen) :use-module (srfi srfi-1)) -(debug-enable 'debug) +(if (= (string->number (major-version)) 1) + (debug-enable 'debug)) (debug-enable 'backtrace) (define module-dir #f) @@ -51,7 +52,7 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cons \"$0\" (cdr (command-line))))" (modconfig-defun (value #t)) (reconfigure (value #t)) (files-from (single-char #\T) (value #t)) - (parents (single-char #\p (value #t))) + (parents (single-char #\p) (value #f)) (help))) (define (usage) diff --git a/src/Makefile.am b/src/Makefile.am index 6fc983a..c5caa7f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,5 @@ # This file is part of Gamma. -# Copyright (C) 2002, 2007, 2010 Sergey Poznyakoff +# Copyright (C) 2002, 2007, 2010, 2015 Sergey Poznyakoff # # Gamma is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,15 +14,20 @@ # You should have received a copy of the GNU General Public License # along with Gamma. If not, see . -INCLUDES =-I$(top_builddir) -I$(srcdir) -I. @INCLUDEPATH@ +AM_CPPFLAGS =\ + -I$(top_builddir)\ + -I$(srcdir)\ + -I.\ + @INCLUDEPATH@\ + -DDATADIR=\"$(guiledir)\" -EXTRA_DIST= +EXTRA_DIST = modules.mk documentation.sci EXTRA_LTLIBRARIES= lib_LTLIBRARIES=@GAMMA_LIB_LIST@ install-data-hook: @GAMMA_INSTALL_HOOKS@ +MAINTAINERCLEANFILES= include modules.mk -EXTRA_DIST += modules.mk documentation.sci sitedir=$(GUILE_SITE)/$(PACKAGE) site_DATA=$(GAMMA_BUILT_DATA_FILES) documentation.scm @@ -36,8 +41,6 @@ DOT_DOC_FILES=$(DOT_X_FILES:.x=.doc) DISTCLEANFILES=$(site_DATA) -AM_CPPFLAGS=-DDATADIR=\"$(guiledir)\" - SUFFIXES= CLEANFILES= BUILT_SOURCES= diff --git a/src/eval.c b/src/eval.c index cc3da50..1702ea0 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1,5 +1,5 @@ /* This file is part of Gamma. - Copyright (C) 2010 Sergey Poznyakoff + Copyright (C) 2010, 2015 Sergey Poznyakoff Gamma is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,15 +35,13 @@ eval_catch_handler (void *data, SCM tag, SCM throw_args) struct scheme_exec_data { SCM (*handler) (void *data); void *data; - SCM result; }; static SCM scheme_safe_exec_body (void *data) { struct scheme_exec_data *ed = data; - ed->result = ed->handler(ed->data); - return SCM_BOOL_F; + return ed->handler(ed->data); } int @@ -51,16 +49,17 @@ gamma_safe_exec(SCM (*handler) (void *data), void *data, SCM *result) { jmp_buf jmp_env; struct scheme_exec_data ed; + SCM res; if (setjmp(jmp_env)) exit(70); /* EX_SOFTWARE */ ed.handler = handler; ed.data = data; - scm_internal_lazy_catch(SCM_BOOL_T, - scheme_safe_exec_body, (void*)&ed, - eval_catch_handler, &jmp_env); + res = scm_c_catch(SCM_BOOL_T, + scheme_safe_exec_body, (void*)&ed, + eval_catch_handler, &jmp_env, NULL, NULL); if (result) - *result = ed.result; + *result = res; return 0; } diff --git a/src/expat.sci b/src/expat.sci index 6f729fd..19e48fe 100644 --- a/src/expat.sci +++ b/src/expat.sci @@ -1,5 +1,5 @@ ;;;; This file is part of Gamma. -*- scheme -*- -;;;; Copyright (C) 2010 Sergey Poznyakoff +;;;; Copyright (C) 2010, 2015 Sergey Poznyakoff ;;;; ;;;; Gamma is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -26,7 +26,8 @@ changequote([,])dnl xml-set-handler) :export-syntax (xml-error-descr)) -(use-syntax (ice-9 syncase)) +(if (= (string->number (major-version)) 1) + (use-syntax (ice-9 syncase))) (let ((lib-path "LIBDIR/")) (load-extension (string-append diff --git a/src/gamma-expat.c b/src/gamma-expat.c index b70fe32..a81d30e 100644 --- a/src/gamma-expat.c +++ b/src/gamma-expat.c @@ -1,5 +1,5 @@ /* This file is part of Gamma. - Copyright (C) 2010 Sergey Poznyakoff + Copyright (C) 2010, 2015 Sergey Poznyakoff Gamma is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,7 +32,7 @@ gamma_xml_parser_create(XML_Parser parser) { struct gamma_xml_parser *gp; - gp = scm_gc_malloc(sizeof (*gp), "XML_Parser"); + gp = scm_malloc(sizeof (*gp)); gp->parser = parser; SCM_RETURN_NEWSMOB(gamma_xml_parser_tag, gp); } @@ -100,8 +100,7 @@ make_user_data () { int i; - struct gamma_expat_user_data *p = scm_gc_malloc(sizeof (*p), - "make_user_data"); + struct gamma_expat_user_data *p = scm_malloc(sizeof (*p)); for (i = 0; i < gamma_expat_handler_count; i++) p->handler[i] = SCM_UNSPECIFIED; p->external_entity_ref_handler_arg = SCM_UNSPECIFIED; diff --git a/src/sql.sci b/src/sql.sci index fd23795..ab91c00 100644 --- a/src/sql.sci +++ b/src/sql.sci @@ -1,5 +1,5 @@ ;;;; This file is part of Gamma. -*- scheme -*- -;;;; Copyright (C) 2002, 2008, 2010 Sergey Poznyakoff +;;;; Copyright (C) 2002, 2008, 2010, 2015 Sergey Poznyakoff ;;;; ;;;; Gamma is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -19,7 +19,9 @@ changequote([,])dnl (define-module (gamma sql) :use-module (gamma documentation) :export-syntax (sql-catch-failure sql-ignore-failure)) -(use-syntax (ice-9 syncase)) + +(if (= (string->number (major-version)) 1) + (use-syntax (ice-9 syncase))) (let ((lib-path "LIBDIR/")) (load-extension (string-append -- cgit v1.2.1