diff options
author | lapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-07-09 17:53:17 +0200 |
---|---|---|
committer | lapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-07-09 17:53:17 +0200 |
commit | d82e2449a0282232c6e6acd1a84514ee5332f4db (patch) | |
tree | 6935f3cd4a9d3050b1aed8b1b0f9514f5fcff17f /squirrel_3_0_1_stable/_OLD_sqplus/SquirrelBindingsUtils.h | |
parent | Sorry... (diff) | |
download | cuberite-d82e2449a0282232c6e6acd1a84514ee5332f4db.tar cuberite-d82e2449a0282232c6e6acd1a84514ee5332f4db.tar.gz cuberite-d82e2449a0282232c6e6acd1a84514ee5332f4db.tar.bz2 cuberite-d82e2449a0282232c6e6acd1a84514ee5332f4db.tar.lz cuberite-d82e2449a0282232c6e6acd1a84514ee5332f4db.tar.xz cuberite-d82e2449a0282232c6e6acd1a84514ee5332f4db.tar.zst cuberite-d82e2449a0282232c6e6acd1a84514ee5332f4db.zip |
Diffstat (limited to '')
-rw-r--r-- | squirrel_3_0_1_stable/_OLD_sqplus/SquirrelBindingsUtils.h | 152 |
1 files changed, 0 insertions, 152 deletions
diff --git a/squirrel_3_0_1_stable/_OLD_sqplus/SquirrelBindingsUtils.h b/squirrel_3_0_1_stable/_OLD_sqplus/SquirrelBindingsUtils.h deleted file mode 100644 index 5f727c263..000000000 --- a/squirrel_3_0_1_stable/_OLD_sqplus/SquirrelBindingsUtils.h +++ /dev/null @@ -1,152 +0,0 @@ -#ifndef SQUIRREL_BINDINGS_UTILS_H
-#define SQUIRREL_BINDINGS_UTILS_H
-
-struct ScriptClassMemberDecl {
- const SQChar *name;
- SQFUNCTION func;
- int params;
- const SQChar *typemask;
-};
-
-struct SquirrelClassDecl {
- const SQChar *name;
- const SQChar *base;
- const ScriptClassMemberDecl *members;
-};
-
-struct ScriptConstantDecl {
- const SQChar *name;
- SQObjectType type;
- union value {
- value(float v){ f = v; }
- value(int v){ i = v; }
- value(long int v){ li = v; }
- value(const SQChar *v){ s = v; }
- float f;
- int i;
- long int li;
- const SQChar *s;
- } val;
-};
-
-struct ScriptNamespaceDecl {
- const SQChar *name;
- const ScriptClassMemberDecl *members;
- const ScriptConstantDecl *constants;
- const ScriptClassMemberDecl *delegate;
-};
-
-#define _BEGIN_CLASS(classname) \
- int __##classname##__typeof(HSQUIRRELVM v) \
- { \
- sq_pushstring(v,_SC(#classname),-1); \
- return 1; \
- } \
- struct ScriptClassMemberDecl __##classname##_members[] = { \
- {_SC("_typeof"),__##classname##__typeof,1,NULL},
-
-#define _BEGIN_NAMESPACE(xnamespace) struct ScriptClassMemberDecl __##xnamespace##_members[] = {
-#define _BEGIN_NAMESPACE_CONSTANTS(xnamespace) {NULL,NULL,0,NULL}}; \
- struct ScriptConstantDecl __##xnamespace##_constants[] = {
-
-#define _BEGIN_DELEGATE(xnamespace) struct ScriptClassMemberDecl __##xnamespace##_delegate[] = {
-#define _DELEGATE(xnamespace) __##xnamespace##_delegate
-#define _END_DELEGATE(classname) {NULL,NULL,NULL,NULL}};
-
-#define _CONSTANT(name,type,val) {_SC(#name),type,val},
-#define _CONSTANT_IMPL(name,type) {_SC(#name),type,name},
-
-#define _MEMBER_FUNCTION(classname,name,nparams,typemask) \
- {_SC(#name),__##classname##_##name,nparams,typemask},
-
-#define _END_NAMESPACE(classname,delegate) {NULL,OT_NULL,0}}; \
-struct ScriptNamespaceDecl __##classname##_decl = { \
- _SC(#classname), __##classname##_members,__##classname##_constants,delegate };
-
-#define _END_CLASS(classname) {NULL,NULL,0,NULL}}; \
-struct SquirrelClassDecl __##classname##_decl = { \
- _SC(#classname), NULL, __##classname##_members };
-
-
-#define _END_CLASS_INHERITANCE(classname,base) {NULL,NULL,NULL,NULL}}; \
-struct SquirrelClassDecl __##classname##_decl = { \
- _SC(#classname), _SC(#base), __##classname##_members };
-
-#define _MEMBER_FUNCTION_IMPL(classname,name) \
- int __##classname##_##name(HSQUIRRELVM v)
-
-#define _INIT_STATIC_NAMESPACE(classname) CreateStaticNamespace(SquirrelVM::GetVMPtr(),&__##classname##_decl);
-#define _INIT_CLASS(classname)CreateClass(SquirrelVM::GetVMPtr(),&__##classname##_decl);
-
-#define _DECL_STATIC_NAMESPACE(xnamespace) extern struct ScriptNamespaceDecl __##xnamespace##_decl;
-#define _DECL_CLASS(classname) extern struct SquirrelClassDecl __##classname##_decl;
-
-#define _CHECK_SELF(cppclass,scriptclass) \
- cppclass *self = NULL; \
- if(SQ_FAILED(sq_getinstanceup(v,1,(SQUserPointer*)&self,(SQUserPointer)&__##scriptclass##_decl))) { \
- return sq_throwerror(v,_SC("invalid instance type"));\
- }
-
-#define _CHECK_INST_PARAM(pname,idx,cppclass,scriptclass) \
- cppclass *pname = NULL; \
- if(SQ_FAILED(sq_getinstanceup(v,idx,(SQUserPointer*)&pname,(SQUserPointer)&__##scriptclass##_decl))) { \
- return sq_throwerror(v,_SC("invalid instance type"));\
- } \
-
-#define _CHECK_INST_PARAM_BREAK(pname,idx,cppclass,scriptclass) \
- cppclass *pname = NULL; \
- if(SQ_FAILED(sq_getinstanceup(v,idx,(SQUserPointer*)&pname,(SQUserPointer)&__##scriptclass##_decl))) { \
- break; \
- } \
-
-#define _CLASS_TAG(classname) ((unsigned int)&__##classname##_decl)
-
-
-#define _DECL_NATIVE_CONSTRUCTION(classname,cppclass) \
- BOOL push_##classname(cppclass &quat); \
- SquirrelObject new_##classname(cppclass &quat);
-
-#define _IMPL_NATIVE_CONSTRUCTION(classname,cppclass) \
-static int classname##_release_hook(SQUserPointer p, int size) \
-{ \
- if(p) { \
- cppclass *pv = (cppclass *)p; \
- delete pv; \
- } \
- return 0; \
-} \
-BOOL push_##classname(cppclass &quat) \
-{ \
- cppclass *newquat = new cppclass; \
- *newquat = quat; \
- if(!CreateNativeClassInstance(SquirrelVM::GetVMPtr(),_SC(#classname),newquat,classname##_release_hook)) { \
- delete newquat; \
- return FALSE; \
- } \
- return TRUE; \
-} \
-SquirrelObject new_##classname(cppclass &quat) \
-{ \
- SquirrelObject ret; \
- if(push_##classname(quat)) { \
- ret.AttachToStackObject(-1); \
- sq_pop(SquirrelVM::GetVMPtr(),1); \
- } \
- return ret; \
-} \
-int construct_##classname(cppclass *p) \
-{ \
- sq_setinstanceup(SquirrelVM::GetVMPtr(),1,p); \
- sq_setreleasehook(SquirrelVM::GetVMPtr(),1,classname##_release_hook); \
- return 1; \
-}
-
-BOOL CreateStaticClass(HSQUIRRELVM v,SquirrelClassDecl *cd);
-BOOL CreateStaticNamespace(HSQUIRRELVM v,ScriptNamespaceDecl *sn);
-BOOL CreateClass(HSQUIRRELVM v,SquirrelClassDecl *cd);
-BOOL InitScriptClasses(HSQUIRRELVM v);
-BOOL CreateNativeClassInstance(HSQUIRRELVM v,const SQChar *classname,SQUserPointer ud,SQRELEASEHOOK hook);
-BOOL CreateConstructNativeClassInstance(HSQUIRRELVM v,const SQChar * className);
-
-#endif // SQUIRREL_BINDINGS_UTILS_H
-
|