From f20b30ec9543a7f714c71411fd6ce60a85a86d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20K=C3=B6ppe?= Date: Wed, 30 Aug 2000 08:50:06 +0000 Subject: [PATCH] File insertion now data-driven via %insert. Using %define for multiline defines. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@721 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Lib/guile/guile.i | 7 ++++++ SWIG/Lib/guile/typemaps.i | 41 ++++++++++++++++---------------- SWIG/Source/Modules1.1/guile.cxx | 14 +---------- 3 files changed, 29 insertions(+), 33 deletions(-) diff --git a/SWIG/Lib/guile/guile.i b/SWIG/Lib/guile/guile.i index a90cbf416..df81de988 100644 --- a/SWIG/Lib/guile/guile.i +++ b/SWIG/Lib/guile/guile.i @@ -2,6 +2,13 @@ This file is parsed by SWIG before reading any other interface file. */ +/* Include headers */ +%insert(runtime) "guiledec.swg" + +#ifndef SWIG_NOINCLUDE +%insert(runtime) "guile.swg" +#endif + /* Read in standard typemaps. */ %include "typemaps.i" diff --git a/SWIG/Lib/guile/typemaps.i b/SWIG/Lib/guile/typemaps.i index 4f72b45c8..353ff7fa6 100644 --- a/SWIG/Lib/guile/typemaps.i +++ b/SWIG/Lib/guile/typemaps.i @@ -5,26 +5,27 @@ /* Basic types */ -#define SIMPLE_MAP(C_NAME, SCM_TO_C, C_TO_SCM, SCM_NAME) \ - %typemap (guile, in) C_NAME "$target = SCM_TO_C($source);"; \ - %typemap (guile, varin) C_NAME "$target = SCM_TO_C($source);"; \ - %typemap (guile, out) C_NAME "$target = C_TO_SCM($source);"; \ - %typemap (guile, varout) C_NAME "$target = C_TO_SCM($source);"; \ - %typemap (guile, indoc) C_NAME "($arg )"; \ - %typemap (guile, outdoc) C_NAME ""; \ - %typemap (guile, in) C_NAME *INPUT (C_NAME temp) \ - "temp = (C_NAME) C_TO_SCM($source); $target = &temp;" \ - %typemap (guile, indoc) C_NAME *INPUT "($arg )"; \ - %typemap (guile, ignore) C_NAME *OUTPUT (C_NAME temp) \ - "$target = &temp;" \ - %typemap (guile, argout) C_NAME *OUTPUT \ - "GUILE_APPEND_RESULT(C_TO_SCM(*$target));"; \ - %typemap (guile, argoutdoc) C_NAME *OUTPUT "($arg )"; \ - %typemap (guile, in) C_NAME *BOTH = C_NAME *INPUT; \ - %typemap (guile, indoc) C_NAME *BOTH = C_NAME *INPUT; \ - %typemap (guile, argout) C_NAME *BOTH = C_NAME *OUTPUT; \ - %typemap (guile, argoutdoc) C_NAME *BOTH = C_NAME *OUTPUT - +%define SIMPLE_MAP(C_NAME, SCM_TO_C, C_TO_SCM, SCM_NAME) + %typemap (guile, in) C_NAME "$target = SCM_TO_C($source);"; + %typemap (guile, varin) C_NAME "$target = SCM_TO_C($source);"; + %typemap (guile, out) C_NAME "$target = C_TO_SCM($source);"; + %typemap (guile, varout) C_NAME "$target = C_TO_SCM($source);"; + %typemap (guile, indoc) C_NAME "($arg )"; + %typemap (guile, outdoc) C_NAME ""; + %typemap (guile, in) C_NAME *INPUT (C_NAME temp) + "temp = (C_NAME) C_TO_SCM($source); $target = &temp;" + %typemap (guile, indoc) C_NAME *INPUT "($arg )"; + %typemap (guile, ignore) C_NAME *OUTPUT (C_NAME temp) + "$target = &temp;" + %typemap (guile, argout) C_NAME *OUTPUT + "GUILE_APPEND_RESULT(C_TO_SCM(*$target));"; + %typemap (guile, argoutdoc) C_NAME *OUTPUT "($arg )"; + %typemap (guile, in) C_NAME *BOTH = C_NAME *INPUT; + %typemap (guile, indoc) C_NAME *BOTH = C_NAME *INPUT; + %typemap (guile, argout) C_NAME *BOTH = C_NAME *OUTPUT; + %typemap (guile, argoutdoc) C_NAME *BOTH = C_NAME *OUTPUT; +%enddef + SIMPLE_MAP(bool, gh_scm2bool, gh_bool2scm, boolean); SIMPLE_MAP(char, gh_scm2char, gh_char2scm, char); SIMPLE_MAP(unsigned char, gh_scm2char, gh_char2scm, char); diff --git a/SWIG/Source/Modules1.1/guile.cxx b/SWIG/Source/Modules1.1/guile.cxx index cf2a703c1..a8d3830aa 100644 --- a/SWIG/Source/Modules1.1/guile.cxx +++ b/SWIG/Source/Modules1.1/guile.cxx @@ -230,6 +230,7 @@ GUILE::set_init (char *iname) void GUILE::headers (void) { + Printf(f_runtime, "/* -*- buffer-read-only: t -*- */\n"); Swig_banner (f_runtime); Printf (f_runtime, "/* Implementation : GUILE */\n\n"); @@ -239,19 +240,6 @@ GUILE::headers (void) if (NoInclude) { Printf(f_runtime, "#define SWIG_NOINCLUDE\n"); } - if (Swig_insert_file ("guiledec.swg", f_runtime) == -1) { - Printf (stderr, "SWIG : Fatal error. "); - Printf (stderr, "Unable to locate 'guiledec.swg' in SWIG library.\n"); - SWIG_exit (1); - } - if (!NoInclude) { - // Write out function definitions - if (Swig_insert_file ("guile.swg", f_runtime) == -1) { - Printf (stderr, "SWIG : Fatal error. "); - Printf (stderr, "Unable to locate 'guile.swg' in SWIG library.\n"); - SWIG_exit (1); - } - } } // --------------------------------------------------------------------