Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | /* SWIG Configuration File for Ocaml. -*-c-*- |
2 | Modified from mzscheme.i | |
3 | This file is parsed by SWIG before reading any other interface | |
4 | file. */ | |
5 | ||
6 | %runtime %{ | |
7 | #define SWIGSTATIC static | |
8 | %} | |
9 | ||
10 | /* Insert common stuff */ | |
11 | %insert(runtime) "swigrun.swg" | |
12 | ||
13 | /* Include headers */ | |
14 | %insert(runtime) "ocamldec.swg" | |
15 | ||
16 | /* Type registration */ | |
17 | %insert(init) "swiginit.swg" | |
18 | %insert(init) "typeregister.swg" | |
19 | ||
20 | %insert(mlitail) %{ | |
21 | val swig_val : c_enum_type -> c_obj -> Swig.c_obj | |
22 | %} | |
23 | ||
24 | %insert(mltail) %{ | |
25 | let rec swig_val t v = | |
26 | match v with | |
27 | C_enum e -> enum_to_int t v | |
28 | | C_list l -> Swig.C_list (List.map (swig_val t) l) | |
29 | | C_array a -> Swig.C_array (Array.map (swig_val t) a) | |
30 | | _ -> Obj.magic v | |
31 | %} | |
32 | ||
33 | /*#ifndef SWIG_NOINCLUDE*/ | |
34 | %insert(runtime) "ocaml.swg" | |
35 | /*#endif*/ | |
36 | ||
37 | %insert(classtemplate) "class.swg" | |
38 | ||
39 | /* Definitions */ | |
40 | #define SWIG_malloc(size) swig_malloc(size, FUNC_NAME) | |
41 | #define SWIG_free(mem) free(mem) | |
42 | ||
43 | /* Read in standard typemaps. */ | |
44 | %include "swig.swg" | |
45 | %include "typemaps.i" | |
46 | %include "typecheck.i" | |
47 | %include "exception.i" | |
48 | %include "preamble.swg" |