]> git.mxchange.org Git - simgear.git/blobdiff - simgear/nasal/misc.c
cppbind::Ghost: improve compiler error message for wrong usage.
[simgear.git] / simgear / nasal / misc.c
index 1c3a6195564d50eafd86c5ce5df49173123846bc..5a531d536d7d2a0cd0bccfb1c92a2323c8cbeb18 100644 (file)
@@ -107,6 +107,24 @@ naRef naNewCCode(struct Context* c, naCFunction fptr)
 {
     naRef r = naNew(c, T_CCODE);
     PTR(r).ccode->fptr = fptr;
+    PTR(r).ccode->fptru = 0;
+    return r;
+}
+
+naRef naNewCCodeU(struct Context* c, naCFunctionU fptr, void* user_data)
+{
+    return naNewCCodeUD(c, fptr, user_data, 0);
+}
+
+naRef naNewCCodeUD( struct Context* c,
+                    naCFunctionU fptr,
+                    void* user_data,
+                    void (*destroy)(void*) )
+{
+    naRef r = naNew(c, T_CCODE);
+    PTR(r).ccode->fptru = fptr;
+    PTR(r).ccode->user_data = user_data;
+    PTR(r).ccode->destroy = destroy;
     return r;
 }
 
@@ -121,11 +139,12 @@ naRef naNewFunc(struct Context* c, naRef code)
 
 naRef naNewGhost(naContext c, naGhostType* type, void* ptr)
 {
+    naRef ghost;
     // ensure 'simple' ghost users don't see garbage for these fields
     type->get_member = 0;
     type->set_member = 0;
     
-    naRef ghost = naNew(c, T_GHOST);
+    ghost = naNew(c, T_GHOST);
     PTR(ghost).ghost->gtype = type;
     PTR(ghost).ghost->ptr = ptr;
     return ghost;
@@ -225,6 +244,7 @@ int naIsFunc(naRef r)   { return IS_FUNC(r); }
 int naIsCode(naRef r)   { return IS_CODE(r); }
 int naIsCCode(naRef r)  { return IS_CCODE(r); }
 int naIsGhost(naRef r)  { return IS_GHOST(r); }
+int naIsIdentical(naRef l, naRef r) { return IDENTICAL(l, r); }
 
 void naSetUserData(naContext c, void* p) { c->userData = p; }
 void* naGetUserData(naContext c)