Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.6 KiB

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