PageRenderTime 43ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Lib/ocaml/ocaml.i

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