1 /* ----------------------------------------------------------------------------- 2 * ocaml.i 3 * 4 * SWIG Configuration File for Ocaml 5 * ----------------------------------------------------------------------------- */ 6 7 %runtime %{ 8 #define SWIGSTATIC static 9 %} 10 11 /* Insert common stuff */ 12 %insert(runtime) "swigrun.swg" 13 14 /* Include headers */ 15 %insert(runtime) "ocamldec.swg" 16 17 /* Type registration */ 18 %insert(init) "swiginit.swg" 19 %insert(init) "typeregister.swg" 20 21 %insert(mlitail) %{ 22 val swig_val : c_enum_type -> c_obj -> Swig.c_obj 23 %} 24 25 %insert(mltail) %{ 26 let rec swig_val t v = 27 match v with 28 C_enum e -> enum_to_int t v 29 | C_list l -> Swig.C_list (List.map (swig_val t) l) 30 | C_array a -> Swig.C_array (Array.map (swig_val t) a) 31 | _ -> Obj.magic v 32 %} 33 34 /*#ifndef SWIG_NOINCLUDE*/ 35 %insert(runtime) "ocaml.swg" 36 /*#endif*/ 37 38 %insert(classtemplate) "class.swg" 39 40 /* Definitions */ 41 #define SWIG_malloc(size) swig_malloc(size, FUNC_NAME) 42 #define SWIG_free(mem) free(mem) 43 44 /* Read in standard typemaps. */ 45 %include <swig.swg> 46 %include <typemaps.i> 47 %include <typecheck.i> 48 %include <exception.i> 49 %include <preamble.swg> 50 51 /* ocaml keywords */ 52 /* There's no need to use this, because of my rewriting machinery. C++ 53 * words never collide with ocaml keywords */ 54 55 /* still we include the file, but the warning says that the offending 56 name will be properly renamed. Just to let the user to know about 57 it. */ 58 %include <ocamlkw.swg> 59