File insertion now data-driven via %insert.
Using %define for multiline defines. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@721 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b8b42a3598
commit
74ac578ba8
3 changed files with 29 additions and 33 deletions
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <SCM_NAME>)"; \
|
||||
%typemap (guile, outdoc) C_NAME "<SCM_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 <SCM_NAME>)"; \
|
||||
%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 <SCM_NAME>)"; \
|
||||
%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 <SCM_NAME>)";
|
||||
%typemap (guile, outdoc) C_NAME "<SCM_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 <SCM_NAME>)";
|
||||
%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 <SCM_NAME>)";
|
||||
%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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue