mirror of
https://github.com/CPunch/Cosmo.git
synced 2025-09-29 23:00:07 +00:00
Added dictionary support to OP_ITER
ISTRING_RESERVED was added to iStrings call & callCFunction now use memmove instead of memcpy Additionally, added cosmoO_setUserP, cosmoO_getUserP, cosmoO_setUserI and cosmoO_getUserI to the C API.
This commit is contained in:
11
src/cobj.h
11
src/cobj.h
@@ -47,7 +47,10 @@ typedef struct CObjObject {
|
||||
CommonHeader; // "is a" CObj
|
||||
cosmo_Flag istringFlags; // enables us to have a much faster lookup for reserved IStrings (like __init, __index, etc.)
|
||||
CTable tbl;
|
||||
void *user; // userdata (NULL by default)
|
||||
union { // userdata (NULL by default)
|
||||
void *userP;
|
||||
int userI;
|
||||
};
|
||||
struct CObjObject *proto; // protoobject, describes the behavior of the object
|
||||
} CObjObject;
|
||||
|
||||
@@ -136,8 +139,10 @@ void cosmoO_setObject(CState *state, CObjObject *object, CValue key, CValue val)
|
||||
bool cosmoO_indexObject(CState *state, CObjObject *object, CValue key, CValue *val);
|
||||
bool cosmoO_newIndexObject(CState *state, CObjObject *object, CValue key, CValue val);
|
||||
|
||||
void cosmoO_setUserData(CState *state, CObjObject *object, void *p);
|
||||
void *cosmoO_getUserData(CState *state, CObjObject *object);
|
||||
void cosmoO_setUserP(CState *state, CObjObject *object, void *p);
|
||||
void *cosmoO_getUserP(CState *state, CObjObject *object);
|
||||
void cosmoO_setUserI(CState *state, CObjObject *object, int i);
|
||||
int cosmoO_getUserI(CState *state, CObjObject *object);
|
||||
|
||||
// internal string
|
||||
bool cosmoO_getIString(CState *state, CObjObject *object, int flag, CValue *val);
|
||||
|
Reference in New Issue
Block a user