summaryrefslogtreecommitdiff
path: root/share/swig/2.0.11/guile/guile_scm.swg
blob: dfd5da271cfb68af2e89818f052a7f7f133a160c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* -----------------------------------------------------------------------------
 * guile_scm.swg
 *
 * This SWIG interface file is processed if the Guile module is run
 * with SCM_ flavor.
 * ----------------------------------------------------------------------------- */

#define SWIGGUILE_SCM

%runtime "swigrun.swg"       // Common C API type-checking code

%runtime "guile_scm_run.swg"
%include <guile.i>

%runtime %{

#define GUILE_MAYBE_VALUES \
      if (gswig_list_p) gswig_result = scm_values(gswig_result);

#define GUILE_MAYBE_VECTOR \
      if (gswig_list_p) gswig_result = scm_vector(gswig_result);

#define SWIG_APPEND_VALUE(object)						\
    if (gswig_result == SCM_UNSPECIFIED)						\
        gswig_result = object;							\
    else {									\
      if (!gswig_list_p) {							\
	      gswig_list_p = 1;							\
	      gswig_result = scm_listify(gswig_result, object, SCM_UNDEFINED);	\
      }									\
      else									\
            gswig_result = scm_append(scm_listify(gswig_result, scm_listify(object, SCM_UNDEFINED), SCM_UNDEFINED));		\
    }

%}

%insert(init) "swiginit.swg"

%init %{
SWIG_GUILE_INIT_STATIC void
SWIG_init(void)
{
  SWIG_InitializeModule(0);
  SWIG_PropagateClientData();
%}