return closure;
}
+naRef naNewGhost(naContext c, naGhostType* type, void* ptr)
+{
+ naRef ghost = naNew(c, T_GHOST);
+ ghost.ref.ptr.ghost->gtype = type;
+ ghost.ref.ptr.ghost->ptr = ptr;
+ return ghost;
+}
+
+naGhostType* naGhost_type(naRef ghost)
+{
+ if(!IS_GHOST(ghost)) return 0;
+ return ghost.ref.ptr.ghost->gtype;
+}
+
+void* naGhost_ptr(naRef ghost)
+{
+ if(!IS_GHOST(ghost)) return 0;
+ return ghost.ref.ptr.ghost->ptr;
+}
+
naRef naNil()
{
naRef r;
naRef naNum(double num)
{
naRef r;
+ r.ref.reftag = ~NASAL_REFTAG;
r.num = num;
return r;
}
case T_FUNC: return sizeof(struct naFunc);
case T_CLOSURE: return sizeof(struct naClosure);
case T_CCODE: return sizeof(struct naCCode);
+ case T_GHOST: return sizeof(struct naGhost);
};
return 0x7fffffff; // Make sure the answer is nonsense :)
}
return IS_CCODE(r);
}
+int naIsGhost(naRef r)
+{
+ return IS_GHOST(r);
+}