Alice Ching | c960228 | 2014-03-05 12:03:26 -0800 | [diff] [blame] | 1 | /* ----------------------------------------------------------------------------- |
| 2 | * guile_scm.swg |
| 3 | * |
| 4 | * This SWIG interface file is processed if the Guile module is run |
| 5 | * with SCM_ flavor. |
| 6 | * ----------------------------------------------------------------------------- */ |
| 7 | |
| 8 | #define SWIGGUILE_SCM |
| 9 | |
| 10 | %runtime "swigrun.swg" // Common C API type-checking code |
| 11 | |
| 12 | %runtime "guile_scm_run.swg" |
| 13 | %include <guile.i> |
| 14 | |
| 15 | %runtime %{ |
| 16 | |
| 17 | #define GUILE_MAYBE_VALUES \ |
| 18 | if (gswig_list_p) gswig_result = scm_values(gswig_result); |
| 19 | |
| 20 | #define GUILE_MAYBE_VECTOR \ |
| 21 | if (gswig_list_p) gswig_result = scm_vector(gswig_result); |
| 22 | |
| 23 | #define SWIG_APPEND_VALUE(object) \ |
| 24 | if (gswig_result == SCM_UNSPECIFIED) \ |
| 25 | gswig_result = object; \ |
| 26 | else { \ |
| 27 | if (!gswig_list_p) { \ |
| 28 | gswig_list_p = 1; \ |
| 29 | gswig_result = scm_listify(gswig_result, object, SCM_UNDEFINED); \ |
| 30 | } \ |
| 31 | else \ |
| 32 | gswig_result = scm_append(scm_listify(gswig_result, scm_listify(object, SCM_UNDEFINED), SCM_UNDEFINED)); \ |
| 33 | } |
| 34 | |
| 35 | %} |
| 36 | |
| 37 | %insert(init) "swiginit.swg" |
| 38 | |
| 39 | %init %{ |
| 40 | SWIG_GUILE_INIT_STATIC void |
| 41 | SWIG_init(void) |
| 42 | { |
| 43 | SWIG_InitializeModule(0); |
| 44 | SWIG_PropagateClientData(); |
| 45 | %} |