]> git.jsancho.org Git - guile-irrlicht.git/blobdiff - src/wrapped.h
Some doc
[guile-irrlicht.git] / src / wrapped.h
index 1f61d9559e13231eb11e01559b2663da1a75bc55..2518025c937a03d414ca0040a567c3aeffc20077 100644 (file)
 #ifndef __GUILE_IRRLICHT_WRAPPED_H_INCLUDED__
 #define __GUILE_IRRLICHT_WRAPPED_H_INCLUDED__
 
+#include <irrlicht/irrlicht.h>
 #include <libguile.h>
 
-#define DECLARE_WRAPPED_TYPE(TYPE, INIT, PRED, WRAP, UNWRAP)            \
-  void                                                                  \
-  INIT (void);                                                          \
-                                                                        \
-  SCM                                                                   \
-  WRAP (TYPE foreign_obj);                                              \
-                                                                        \
-  TYPE                                                                  \
-  UNWRAP (SCM wrapped_obj);                                             \
-                                                                        \
-  bool                                                                  \
-  PRED (SCM wrapped_obj);
+using namespace irr;
 
+SCM
+scm_from_irr_pointer (const char* class_name, void* pointer);
 
-#define DEFINE_WRAPPED_TYPE(TYPE, PRINT_NAME, INIT, PRED, WRAP, UNWRAP) \
-  static SCM wrapped_type;                                              \
-                                                                        \
-  void                                                                  \
-  INIT (void)                                                           \
-  {                                                                     \
-    SCM name, slots;                                                    \
-    scm_t_struct_finalize finalizer;                                    \
-                                                                        \
-    name = scm_from_utf8_symbol (PRINT_NAME);                           \
-    slots = scm_list_1 (scm_from_utf8_symbol ("data"));                 \
-    finalizer = NULL;                                                   \
-                                                                        \
-    wrapped_type =                                                      \
-      scm_make_foreign_object_type (name, slots, finalizer);            \
-  }                                                                     \
-                                                                        \
-  SCM                                                                   \
-  WRAP (TYPE foreign_obj)                                               \
-  {                                                                     \
-    return scm_make_foreign_object_1 (wrapped_type, foreign_obj);       \
-  }                                                                     \
-                                                                        \
-  TYPE                                                                  \
-  UNWRAP (SCM wrapped_obj)                                              \
-  {                                                                     \
-    scm_assert_foreign_object_type (wrapped_type, wrapped_obj);         \
-    return (TYPE)scm_foreign_object_ref (wrapped_obj, 0);               \
-  }                                                                     \
-                                                                        \
-  bool                                                                  \
-  PRED (SCM wrapped_obj)                                                \
-  {                                                                     \
-    return SCM_IS_A_P (wrapped_obj, wrapped_type);                      \
-  }
+void*
+scm_to_irr_pointer (SCM obj);
 
 #endif