Utility library for providing native functionality to the Squirrel environment.

Dependents:   Squirrel

Committer:
jhnwkmn
Date:
Tue Dec 16 11:38:54 2014 +0000
Revision:
4:13939f98fe5f
Parent:
0:a9a5c12f2d30
Another pointer initialized.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jhnwkmn 0:a9a5c12f2d30 1 /////////////////////
jhnwkmn 0:a9a5c12f2d30 2 // SqBind 0 arguments
jhnwkmn 0:a9a5c12f2d30 3 /////////////////////
jhnwkmn 0:a9a5c12f2d30 4
jhnwkmn 0:a9a5c12f2d30 5 template<class T >
jhnwkmn 0:a9a5c12f2d30 6 SQInteger _sqbind_sqmethod_0(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 7
jhnwkmn 0:a9a5c12f2d30 8 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 9 typedef void (T::*M)();
jhnwkmn 0:a9a5c12f2d30 10 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 11 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 12 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 13
jhnwkmn 0:a9a5c12f2d30 14 (self->*method)();
jhnwkmn 0:a9a5c12f2d30 15
jhnwkmn 0:a9a5c12f2d30 16 return 0;
jhnwkmn 0:a9a5c12f2d30 17 }
jhnwkmn 0:a9a5c12f2d30 18
jhnwkmn 0:a9a5c12f2d30 19 template<class T >
jhnwkmn 0:a9a5c12f2d30 20 SQInteger _sqbind_sqmethod_0c(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 21
jhnwkmn 0:a9a5c12f2d30 22 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 23 typedef void (T::*M)() const;
jhnwkmn 0:a9a5c12f2d30 24 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 25 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 26 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 27
jhnwkmn 0:a9a5c12f2d30 28 (self->*method)();
jhnwkmn 0:a9a5c12f2d30 29
jhnwkmn 0:a9a5c12f2d30 30 return 0;
jhnwkmn 0:a9a5c12f2d30 31 }
jhnwkmn 0:a9a5c12f2d30 32
jhnwkmn 0:a9a5c12f2d30 33 template<class T, class R>
jhnwkmn 0:a9a5c12f2d30 34 SQInteger _sqbind_sqmethod_0r(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 35
jhnwkmn 0:a9a5c12f2d30 36 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 37 typedef R (T::*M)();
jhnwkmn 0:a9a5c12f2d30 38 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 39 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 40 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 41
jhnwkmn 0:a9a5c12f2d30 42 R r = (self->*method)();
jhnwkmn 0:a9a5c12f2d30 43 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 44 return 1;
jhnwkmn 0:a9a5c12f2d30 45 }
jhnwkmn 0:a9a5c12f2d30 46
jhnwkmn 0:a9a5c12f2d30 47 template<class T, class R>
jhnwkmn 0:a9a5c12f2d30 48 SQInteger _sqbind_sqmethod_0rc(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 49
jhnwkmn 0:a9a5c12f2d30 50 const T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 51 typedef R (T::*M)() const;
jhnwkmn 0:a9a5c12f2d30 52 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 53 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 54 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 55
jhnwkmn 0:a9a5c12f2d30 56 R r = (self->*method)();
jhnwkmn 0:a9a5c12f2d30 57 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 58 return 1;
jhnwkmn 0:a9a5c12f2d30 59 }
jhnwkmn 0:a9a5c12f2d30 60
jhnwkmn 0:a9a5c12f2d30 61 template<class T>
jhnwkmn 0:a9a5c12f2d30 62 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, void (T::*method)() ) {
jhnwkmn 0:a9a5c12f2d30 63
jhnwkmn 0:a9a5c12f2d30 64 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 65 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 66 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 67 sq_newclosure(v,_sqbind_sqmethod_0<T>,1);
jhnwkmn 0:a9a5c12f2d30 68 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 69 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 70
jhnwkmn 0:a9a5c12f2d30 71 }
jhnwkmn 0:a9a5c12f2d30 72
jhnwkmn 0:a9a5c12f2d30 73 template<class T>
jhnwkmn 0:a9a5c12f2d30 74 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, void (T::*method)() const ) {
jhnwkmn 0:a9a5c12f2d30 75
jhnwkmn 0:a9a5c12f2d30 76 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 77 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 78 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 79 sq_newclosure(v,_sqbind_sqmethod_0c<T>,1);
jhnwkmn 0:a9a5c12f2d30 80 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 81 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 82
jhnwkmn 0:a9a5c12f2d30 83 }
jhnwkmn 0:a9a5c12f2d30 84
jhnwkmn 0:a9a5c12f2d30 85 template<class T ,class R>
jhnwkmn 0:a9a5c12f2d30 86 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, R (T::*method)() ) {
jhnwkmn 0:a9a5c12f2d30 87
jhnwkmn 0:a9a5c12f2d30 88 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 89 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 90 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 91 sq_newclosure(v,_sqbind_sqmethod_0r<T,R>,1);
jhnwkmn 0:a9a5c12f2d30 92 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 93 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 94
jhnwkmn 0:a9a5c12f2d30 95 }
jhnwkmn 0:a9a5c12f2d30 96
jhnwkmn 0:a9a5c12f2d30 97 template<class T,class R>
jhnwkmn 0:a9a5c12f2d30 98 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, R (T::*method)() const ) {
jhnwkmn 0:a9a5c12f2d30 99
jhnwkmn 0:a9a5c12f2d30 100 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 101 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 102 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 103 sq_newclosure(v,_sqbind_sqmethod_0rc<T,R>,1);
jhnwkmn 0:a9a5c12f2d30 104 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 105 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 106
jhnwkmn 0:a9a5c12f2d30 107 }
jhnwkmn 0:a9a5c12f2d30 108
jhnwkmn 0:a9a5c12f2d30 109 // STATIC METHODS / FUNCTIONS
jhnwkmn 0:a9a5c12f2d30 110
jhnwkmn 0:a9a5c12f2d30 111 // using vm as template parameter....
jhnwkmn 0:a9a5c12f2d30 112 // otherwise overload won't work
jhnwkmn 0:a9a5c12f2d30 113
jhnwkmn 0:a9a5c12f2d30 114 template<class VM>
jhnwkmn 0:a9a5c12f2d30 115 SQInteger _sqbind_sqfunction_0(VM v) {
jhnwkmn 0:a9a5c12f2d30 116
jhnwkmn 0:a9a5c12f2d30 117 typedef void (*F)();
jhnwkmn 0:a9a5c12f2d30 118 F*functionptr;
jhnwkmn 0:a9a5c12f2d30 119 sq_getuserdata(v,-1,(SQUserPointer*)&functionptr,NULL);
jhnwkmn 0:a9a5c12f2d30 120 F function = *functionptr;
jhnwkmn 0:a9a5c12f2d30 121
jhnwkmn 0:a9a5c12f2d30 122 (function)();
jhnwkmn 0:a9a5c12f2d30 123
jhnwkmn 0:a9a5c12f2d30 124 return 0;
jhnwkmn 0:a9a5c12f2d30 125 }
jhnwkmn 0:a9a5c12f2d30 126
jhnwkmn 0:a9a5c12f2d30 127
jhnwkmn 0:a9a5c12f2d30 128
jhnwkmn 0:a9a5c12f2d30 129 template<class VM, class R>
jhnwkmn 0:a9a5c12f2d30 130 SQInteger _sqbind_sqfunction_0r(VM v) {
jhnwkmn 0:a9a5c12f2d30 131
jhnwkmn 0:a9a5c12f2d30 132 typedef R (*F)();
jhnwkmn 0:a9a5c12f2d30 133 F*functionptr;
jhnwkmn 0:a9a5c12f2d30 134 sq_getuserdata(v,-1,(SQUserPointer*)&functionptr,NULL);
jhnwkmn 0:a9a5c12f2d30 135 F function = *functionptr;
jhnwkmn 0:a9a5c12f2d30 136
jhnwkmn 0:a9a5c12f2d30 137 R r = (function)();
jhnwkmn 0:a9a5c12f2d30 138 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 139 return 1;
jhnwkmn 0:a9a5c12f2d30 140 }
jhnwkmn 0:a9a5c12f2d30 141
jhnwkmn 0:a9a5c12f2d30 142 //call for functions
jhnwkmn 0:a9a5c12f2d30 143 template<class VM>
jhnwkmn 0:a9a5c12f2d30 144 void sqbind_function( VM v, const SQChar *p_name, void (*function)(), const HSQOBJECT *p_class_id=NULL ) {
jhnwkmn 0:a9a5c12f2d30 145
jhnwkmn 0:a9a5c12f2d30 146 if (p_class_id)
jhnwkmn 0:a9a5c12f2d30 147 sq_pushobject(v,*p_class_id); // push class
jhnwkmn 0:a9a5c12f2d30 148 else
jhnwkmn 0:a9a5c12f2d30 149 sq_pushroottable(v);
jhnwkmn 0:a9a5c12f2d30 150
jhnwkmn 0:a9a5c12f2d30 151 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 152 sqbind_push_method_userdata(v,function);
jhnwkmn 0:a9a5c12f2d30 153 sq_newclosure(v,_sqbind_sqfunction_0<VM>,1);
jhnwkmn 0:a9a5c12f2d30 154 sq_newslot(v,-3,p_class_id!=NULL);
jhnwkmn 0:a9a5c12f2d30 155 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 156
jhnwkmn 0:a9a5c12f2d30 157 }
jhnwkmn 0:a9a5c12f2d30 158
jhnwkmn 0:a9a5c12f2d30 159
jhnwkmn 0:a9a5c12f2d30 160 template<class VM, class R>
jhnwkmn 0:a9a5c12f2d30 161 void sqbind_function( VM v, const SQChar *p_name, R (*function)(), const HSQOBJECT *p_class_id=NULL ) {
jhnwkmn 0:a9a5c12f2d30 162
jhnwkmn 0:a9a5c12f2d30 163 if (p_class_id)
jhnwkmn 0:a9a5c12f2d30 164 sq_pushobject(v,*p_class_id); // push class
jhnwkmn 0:a9a5c12f2d30 165 else
jhnwkmn 0:a9a5c12f2d30 166 sq_pushroottable(v);
jhnwkmn 0:a9a5c12f2d30 167 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 168 sqbind_push_method_userdata(v,function);
jhnwkmn 0:a9a5c12f2d30 169 sq_newclosure(v,_sqbind_sqfunction_0r<VM,R>,1);
jhnwkmn 0:a9a5c12f2d30 170 sq_newslot(v,-3,p_class_id!=NULL);
jhnwkmn 0:a9a5c12f2d30 171 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 172
jhnwkmn 0:a9a5c12f2d30 173 }
jhnwkmn 0:a9a5c12f2d30 174
jhnwkmn 0:a9a5c12f2d30 175
jhnwkmn 0:a9a5c12f2d30 176 /////////////////////
jhnwkmn 0:a9a5c12f2d30 177 // SqBind 1 arguments
jhnwkmn 0:a9a5c12f2d30 178 /////////////////////
jhnwkmn 0:a9a5c12f2d30 179
jhnwkmn 0:a9a5c12f2d30 180 template<class T,class P1 >
jhnwkmn 0:a9a5c12f2d30 181 SQInteger _sqbind_sqmethod_1(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 182
jhnwkmn 0:a9a5c12f2d30 183 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 184 typedef void (T::*M)(P1);
jhnwkmn 0:a9a5c12f2d30 185 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 186 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 187 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 188 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 189
jhnwkmn 0:a9a5c12f2d30 190 (self->*method)(p1.getter.get(v,2));
jhnwkmn 0:a9a5c12f2d30 191
jhnwkmn 0:a9a5c12f2d30 192 return 0;
jhnwkmn 0:a9a5c12f2d30 193 }
jhnwkmn 0:a9a5c12f2d30 194
jhnwkmn 0:a9a5c12f2d30 195 template<class T,class P1 >
jhnwkmn 0:a9a5c12f2d30 196 SQInteger _sqbind_sqmethod_1c(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 197
jhnwkmn 0:a9a5c12f2d30 198 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 199 typedef void (T::*M)(P1) const;
jhnwkmn 0:a9a5c12f2d30 200 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 201 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 202 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 203 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 204
jhnwkmn 0:a9a5c12f2d30 205 (self->*method)(p1.getter.get(v,2));
jhnwkmn 0:a9a5c12f2d30 206
jhnwkmn 0:a9a5c12f2d30 207 return 0;
jhnwkmn 0:a9a5c12f2d30 208 }
jhnwkmn 0:a9a5c12f2d30 209
jhnwkmn 0:a9a5c12f2d30 210 template<class T,class P1, class R>
jhnwkmn 0:a9a5c12f2d30 211 SQInteger _sqbind_sqmethod_1r(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 212
jhnwkmn 0:a9a5c12f2d30 213 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 214 typedef R (T::*M)(P1);
jhnwkmn 0:a9a5c12f2d30 215 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 216 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 217 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 218 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 219
jhnwkmn 0:a9a5c12f2d30 220 R r = (self->*method)(p1.getter.get(v,2));
jhnwkmn 0:a9a5c12f2d30 221 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 222 return 1;
jhnwkmn 0:a9a5c12f2d30 223 }
jhnwkmn 0:a9a5c12f2d30 224
jhnwkmn 0:a9a5c12f2d30 225 template<class T,class P1, class R>
jhnwkmn 0:a9a5c12f2d30 226 SQInteger _sqbind_sqmethod_1rc(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 227
jhnwkmn 0:a9a5c12f2d30 228 const T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 229 typedef R (T::*M)(P1) const;
jhnwkmn 0:a9a5c12f2d30 230 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 231 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 232 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 233 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 234
jhnwkmn 0:a9a5c12f2d30 235 R r = (self->*method)(p1.getter.get(v,2));
jhnwkmn 0:a9a5c12f2d30 236 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 237 return 1;
jhnwkmn 0:a9a5c12f2d30 238 }
jhnwkmn 0:a9a5c12f2d30 239
jhnwkmn 0:a9a5c12f2d30 240 template<class T,class P1>
jhnwkmn 0:a9a5c12f2d30 241 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, void (T::*method)(P1) ) {
jhnwkmn 0:a9a5c12f2d30 242
jhnwkmn 0:a9a5c12f2d30 243 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 244 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 245 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 246 sq_newclosure(v,_sqbind_sqmethod_1<T,P1>,1);
jhnwkmn 0:a9a5c12f2d30 247 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 248 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 249
jhnwkmn 0:a9a5c12f2d30 250 }
jhnwkmn 0:a9a5c12f2d30 251
jhnwkmn 0:a9a5c12f2d30 252 template<class T,class P1>
jhnwkmn 0:a9a5c12f2d30 253 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, void (T::*method)(P1) const ) {
jhnwkmn 0:a9a5c12f2d30 254
jhnwkmn 0:a9a5c12f2d30 255 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 256 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 257 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 258 sq_newclosure(v,_sqbind_sqmethod_1c<T,P1>,1);
jhnwkmn 0:a9a5c12f2d30 259 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 260 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 261
jhnwkmn 0:a9a5c12f2d30 262 }
jhnwkmn 0:a9a5c12f2d30 263
jhnwkmn 0:a9a5c12f2d30 264 template<class T,class P1 ,class R>
jhnwkmn 0:a9a5c12f2d30 265 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, R (T::*method)(P1) ) {
jhnwkmn 0:a9a5c12f2d30 266
jhnwkmn 0:a9a5c12f2d30 267 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 268 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 269 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 270 sq_newclosure(v,_sqbind_sqmethod_1r<T,P1,R>,1);
jhnwkmn 0:a9a5c12f2d30 271 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 272 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 273
jhnwkmn 0:a9a5c12f2d30 274 }
jhnwkmn 0:a9a5c12f2d30 275
jhnwkmn 0:a9a5c12f2d30 276 template<class T,class P1,class R>
jhnwkmn 0:a9a5c12f2d30 277 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, R (T::*method)(P1) const ) {
jhnwkmn 0:a9a5c12f2d30 278
jhnwkmn 0:a9a5c12f2d30 279 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 280 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 281 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 282 sq_newclosure(v,_sqbind_sqmethod_1rc<T,P1,R>,1);
jhnwkmn 0:a9a5c12f2d30 283 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 284 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 285
jhnwkmn 0:a9a5c12f2d30 286 }
jhnwkmn 0:a9a5c12f2d30 287
jhnwkmn 0:a9a5c12f2d30 288 // STATIC METHODS / FUNCTIONS
jhnwkmn 0:a9a5c12f2d30 289
jhnwkmn 0:a9a5c12f2d30 290 // using vm as template parameter....
jhnwkmn 0:a9a5c12f2d30 291 // otherwise overload won't work
jhnwkmn 0:a9a5c12f2d30 292
jhnwkmn 0:a9a5c12f2d30 293 template<class VM,class P1>
jhnwkmn 0:a9a5c12f2d30 294 SQInteger _sqbind_sqfunction_1(VM v) {
jhnwkmn 0:a9a5c12f2d30 295
jhnwkmn 0:a9a5c12f2d30 296 typedef void (*F)(P1);
jhnwkmn 0:a9a5c12f2d30 297 F*functionptr;
jhnwkmn 0:a9a5c12f2d30 298 sq_getuserdata(v,-1,(SQUserPointer*)&functionptr,NULL);
jhnwkmn 0:a9a5c12f2d30 299 F function = *functionptr;
jhnwkmn 0:a9a5c12f2d30 300 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 301
jhnwkmn 0:a9a5c12f2d30 302 (function)(p1.getter.get(v,2));
jhnwkmn 0:a9a5c12f2d30 303
jhnwkmn 0:a9a5c12f2d30 304 return 0;
jhnwkmn 0:a9a5c12f2d30 305 }
jhnwkmn 0:a9a5c12f2d30 306
jhnwkmn 0:a9a5c12f2d30 307
jhnwkmn 0:a9a5c12f2d30 308
jhnwkmn 0:a9a5c12f2d30 309 template<class VM,class P1, class R>
jhnwkmn 0:a9a5c12f2d30 310 SQInteger _sqbind_sqfunction_1r(VM v) {
jhnwkmn 0:a9a5c12f2d30 311
jhnwkmn 0:a9a5c12f2d30 312 typedef R (*F)(P1);
jhnwkmn 0:a9a5c12f2d30 313 F*functionptr;
jhnwkmn 0:a9a5c12f2d30 314 sq_getuserdata(v,-1,(SQUserPointer*)&functionptr,NULL);
jhnwkmn 0:a9a5c12f2d30 315 F function = *functionptr;
jhnwkmn 0:a9a5c12f2d30 316 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 317
jhnwkmn 0:a9a5c12f2d30 318 R r = (function)(p1.getter.get(v,2));
jhnwkmn 0:a9a5c12f2d30 319 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 320 return 1;
jhnwkmn 0:a9a5c12f2d30 321 }
jhnwkmn 0:a9a5c12f2d30 322
jhnwkmn 0:a9a5c12f2d30 323 //call for functions
jhnwkmn 0:a9a5c12f2d30 324 template<class VM,class P1>
jhnwkmn 0:a9a5c12f2d30 325 void sqbind_function( VM v, const SQChar *p_name, void (*function)(P1), const HSQOBJECT *p_class_id=NULL ) {
jhnwkmn 0:a9a5c12f2d30 326
jhnwkmn 0:a9a5c12f2d30 327 if (p_class_id)
jhnwkmn 0:a9a5c12f2d30 328 sq_pushobject(v,*p_class_id); // push class
jhnwkmn 0:a9a5c12f2d30 329 else
jhnwkmn 0:a9a5c12f2d30 330 sq_pushroottable(v);
jhnwkmn 0:a9a5c12f2d30 331
jhnwkmn 0:a9a5c12f2d30 332 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 333 sqbind_push_method_userdata(v,function);
jhnwkmn 0:a9a5c12f2d30 334 sq_newclosure(v,_sqbind_sqfunction_1<VM,P1>,1);
jhnwkmn 0:a9a5c12f2d30 335 sq_newslot(v,-3,p_class_id!=NULL);
jhnwkmn 0:a9a5c12f2d30 336 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 337
jhnwkmn 0:a9a5c12f2d30 338 }
jhnwkmn 0:a9a5c12f2d30 339
jhnwkmn 0:a9a5c12f2d30 340
jhnwkmn 0:a9a5c12f2d30 341 template<class VM, class P1,class R>
jhnwkmn 0:a9a5c12f2d30 342 void sqbind_function( VM v, const SQChar *p_name, R (*function)(P1), const HSQOBJECT *p_class_id=NULL ) {
jhnwkmn 0:a9a5c12f2d30 343
jhnwkmn 0:a9a5c12f2d30 344 if (p_class_id)
jhnwkmn 0:a9a5c12f2d30 345 sq_pushobject(v,*p_class_id); // push class
jhnwkmn 0:a9a5c12f2d30 346 else
jhnwkmn 0:a9a5c12f2d30 347 sq_pushroottable(v);
jhnwkmn 0:a9a5c12f2d30 348 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 349 sqbind_push_method_userdata(v,function);
jhnwkmn 0:a9a5c12f2d30 350 sq_newclosure(v,_sqbind_sqfunction_1r<VM,P1,R>,1);
jhnwkmn 0:a9a5c12f2d30 351 sq_newslot(v,-3,p_class_id!=NULL);
jhnwkmn 0:a9a5c12f2d30 352 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 353
jhnwkmn 0:a9a5c12f2d30 354 }
jhnwkmn 0:a9a5c12f2d30 355
jhnwkmn 0:a9a5c12f2d30 356
jhnwkmn 0:a9a5c12f2d30 357 /////////////////////
jhnwkmn 0:a9a5c12f2d30 358 // SqBind 2 arguments
jhnwkmn 0:a9a5c12f2d30 359 /////////////////////
jhnwkmn 0:a9a5c12f2d30 360
jhnwkmn 0:a9a5c12f2d30 361 template<class T,class P1, class P2 >
jhnwkmn 0:a9a5c12f2d30 362 SQInteger _sqbind_sqmethod_2(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 363
jhnwkmn 0:a9a5c12f2d30 364 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 365 typedef void (T::*M)(P1, P2);
jhnwkmn 0:a9a5c12f2d30 366 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 367 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 368 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 369 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 370 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 371
jhnwkmn 0:a9a5c12f2d30 372 (self->*method)(p1.getter.get(v,2), p2.getter.get(v,3));
jhnwkmn 0:a9a5c12f2d30 373
jhnwkmn 0:a9a5c12f2d30 374 return 0;
jhnwkmn 0:a9a5c12f2d30 375 }
jhnwkmn 0:a9a5c12f2d30 376
jhnwkmn 0:a9a5c12f2d30 377 template<class T,class P1, class P2 >
jhnwkmn 0:a9a5c12f2d30 378 SQInteger _sqbind_sqmethod_2c(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 379
jhnwkmn 0:a9a5c12f2d30 380 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 381 typedef void (T::*M)(P1, P2) const;
jhnwkmn 0:a9a5c12f2d30 382 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 383 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 384 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 385 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 386 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 387
jhnwkmn 0:a9a5c12f2d30 388 (self->*method)(p1.getter.get(v,2), p2.getter.get(v,3));
jhnwkmn 0:a9a5c12f2d30 389
jhnwkmn 0:a9a5c12f2d30 390 return 0;
jhnwkmn 0:a9a5c12f2d30 391 }
jhnwkmn 0:a9a5c12f2d30 392
jhnwkmn 0:a9a5c12f2d30 393 template<class T,class P1, class P2, class R>
jhnwkmn 0:a9a5c12f2d30 394 SQInteger _sqbind_sqmethod_2r(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 395
jhnwkmn 0:a9a5c12f2d30 396 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 397 typedef R (T::*M)(P1, P2);
jhnwkmn 0:a9a5c12f2d30 398 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 399 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 400 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 401 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 402 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 403
jhnwkmn 0:a9a5c12f2d30 404 R r = (self->*method)(p1.getter.get(v,2), p2.getter.get(v,3));
jhnwkmn 0:a9a5c12f2d30 405 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 406 return 1;
jhnwkmn 0:a9a5c12f2d30 407 }
jhnwkmn 0:a9a5c12f2d30 408
jhnwkmn 0:a9a5c12f2d30 409 template<class T,class P1, class P2, class R>
jhnwkmn 0:a9a5c12f2d30 410 SQInteger _sqbind_sqmethod_2rc(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 411
jhnwkmn 0:a9a5c12f2d30 412 const T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 413 typedef R (T::*M)(P1, P2) const;
jhnwkmn 0:a9a5c12f2d30 414 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 415 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 416 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 417 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 418 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 419
jhnwkmn 0:a9a5c12f2d30 420 R r = (self->*method)(p1.getter.get(v,2), p2.getter.get(v,3));
jhnwkmn 0:a9a5c12f2d30 421 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 422 return 1;
jhnwkmn 0:a9a5c12f2d30 423 }
jhnwkmn 0:a9a5c12f2d30 424
jhnwkmn 0:a9a5c12f2d30 425 template<class T,class P1, class P2>
jhnwkmn 0:a9a5c12f2d30 426 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, void (T::*method)(P1, P2) ) {
jhnwkmn 0:a9a5c12f2d30 427
jhnwkmn 0:a9a5c12f2d30 428 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 429 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 430 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 431 sq_newclosure(v,_sqbind_sqmethod_2<T,P1, P2>,1);
jhnwkmn 0:a9a5c12f2d30 432 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 433 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 434
jhnwkmn 0:a9a5c12f2d30 435 }
jhnwkmn 0:a9a5c12f2d30 436
jhnwkmn 0:a9a5c12f2d30 437 template<class T,class P1, class P2>
jhnwkmn 0:a9a5c12f2d30 438 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, void (T::*method)(P1, P2) const ) {
jhnwkmn 0:a9a5c12f2d30 439
jhnwkmn 0:a9a5c12f2d30 440 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 441 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 442 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 443 sq_newclosure(v,_sqbind_sqmethod_2c<T,P1, P2>,1);
jhnwkmn 0:a9a5c12f2d30 444 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 445 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 446
jhnwkmn 0:a9a5c12f2d30 447 }
jhnwkmn 0:a9a5c12f2d30 448
jhnwkmn 0:a9a5c12f2d30 449 template<class T,class P1, class P2 ,class R>
jhnwkmn 0:a9a5c12f2d30 450 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, R (T::*method)(P1, P2) ) {
jhnwkmn 0:a9a5c12f2d30 451
jhnwkmn 0:a9a5c12f2d30 452 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 453 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 454 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 455 sq_newclosure(v,_sqbind_sqmethod_2r<T,P1, P2,R>,1);
jhnwkmn 0:a9a5c12f2d30 456 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 457 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 458
jhnwkmn 0:a9a5c12f2d30 459 }
jhnwkmn 0:a9a5c12f2d30 460
jhnwkmn 0:a9a5c12f2d30 461 template<class T,class P1, class P2,class R>
jhnwkmn 0:a9a5c12f2d30 462 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, R (T::*method)(P1, P2) const ) {
jhnwkmn 0:a9a5c12f2d30 463
jhnwkmn 0:a9a5c12f2d30 464 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 465 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 466 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 467 sq_newclosure(v,_sqbind_sqmethod_2rc<T,P1, P2,R>,1);
jhnwkmn 0:a9a5c12f2d30 468 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 469 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 470
jhnwkmn 0:a9a5c12f2d30 471 }
jhnwkmn 0:a9a5c12f2d30 472
jhnwkmn 0:a9a5c12f2d30 473 // STATIC METHODS / FUNCTIONS
jhnwkmn 0:a9a5c12f2d30 474
jhnwkmn 0:a9a5c12f2d30 475 // using vm as template parameter....
jhnwkmn 0:a9a5c12f2d30 476 // otherwise overload won't work
jhnwkmn 0:a9a5c12f2d30 477
jhnwkmn 0:a9a5c12f2d30 478 template<class VM,class P1, class P2>
jhnwkmn 0:a9a5c12f2d30 479 SQInteger _sqbind_sqfunction_2(VM v) {
jhnwkmn 0:a9a5c12f2d30 480
jhnwkmn 0:a9a5c12f2d30 481 typedef void (*F)(P1, P2);
jhnwkmn 0:a9a5c12f2d30 482 F*functionptr;
jhnwkmn 0:a9a5c12f2d30 483 sq_getuserdata(v,-1,(SQUserPointer*)&functionptr,NULL);
jhnwkmn 0:a9a5c12f2d30 484 F function = *functionptr;
jhnwkmn 0:a9a5c12f2d30 485 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 486 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 487
jhnwkmn 0:a9a5c12f2d30 488 (function)(p1.getter.get(v,2), p2.getter.get(v,3));
jhnwkmn 0:a9a5c12f2d30 489
jhnwkmn 0:a9a5c12f2d30 490 return 0;
jhnwkmn 0:a9a5c12f2d30 491 }
jhnwkmn 0:a9a5c12f2d30 492
jhnwkmn 0:a9a5c12f2d30 493
jhnwkmn 0:a9a5c12f2d30 494
jhnwkmn 0:a9a5c12f2d30 495 template<class VM,class P1, class P2, class R>
jhnwkmn 0:a9a5c12f2d30 496 SQInteger _sqbind_sqfunction_2r(VM v) {
jhnwkmn 0:a9a5c12f2d30 497
jhnwkmn 0:a9a5c12f2d30 498 typedef R (*F)(P1, P2);
jhnwkmn 0:a9a5c12f2d30 499 F*functionptr;
jhnwkmn 0:a9a5c12f2d30 500 sq_getuserdata(v,-1,(SQUserPointer*)&functionptr,NULL);
jhnwkmn 0:a9a5c12f2d30 501 F function = *functionptr;
jhnwkmn 0:a9a5c12f2d30 502 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 503 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 504
jhnwkmn 0:a9a5c12f2d30 505 R r = (function)(p1.getter.get(v,2), p2.getter.get(v,3));
jhnwkmn 0:a9a5c12f2d30 506 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 507 return 1;
jhnwkmn 0:a9a5c12f2d30 508 }
jhnwkmn 0:a9a5c12f2d30 509
jhnwkmn 0:a9a5c12f2d30 510 //call for functions
jhnwkmn 0:a9a5c12f2d30 511 template<class VM,class P1, class P2>
jhnwkmn 0:a9a5c12f2d30 512 void sqbind_function( VM v, const SQChar *p_name, void (*function)(P1, P2), const HSQOBJECT *p_class_id=NULL ) {
jhnwkmn 0:a9a5c12f2d30 513
jhnwkmn 0:a9a5c12f2d30 514 if (p_class_id)
jhnwkmn 0:a9a5c12f2d30 515 sq_pushobject(v,*p_class_id); // push class
jhnwkmn 0:a9a5c12f2d30 516 else
jhnwkmn 0:a9a5c12f2d30 517 sq_pushroottable(v);
jhnwkmn 0:a9a5c12f2d30 518
jhnwkmn 0:a9a5c12f2d30 519 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 520 sqbind_push_method_userdata(v,function);
jhnwkmn 0:a9a5c12f2d30 521 sq_newclosure(v,_sqbind_sqfunction_2<VM,P1, P2>,1);
jhnwkmn 0:a9a5c12f2d30 522 sq_newslot(v,-3,p_class_id!=NULL);
jhnwkmn 0:a9a5c12f2d30 523 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 524
jhnwkmn 0:a9a5c12f2d30 525 }
jhnwkmn 0:a9a5c12f2d30 526
jhnwkmn 0:a9a5c12f2d30 527
jhnwkmn 0:a9a5c12f2d30 528 template<class VM, class P1, class P2,class R>
jhnwkmn 0:a9a5c12f2d30 529 void sqbind_function( VM v, const SQChar *p_name, R (*function)(P1, P2), const HSQOBJECT *p_class_id=NULL ) {
jhnwkmn 0:a9a5c12f2d30 530
jhnwkmn 0:a9a5c12f2d30 531 if (p_class_id)
jhnwkmn 0:a9a5c12f2d30 532 sq_pushobject(v,*p_class_id); // push class
jhnwkmn 0:a9a5c12f2d30 533 else
jhnwkmn 0:a9a5c12f2d30 534 sq_pushroottable(v);
jhnwkmn 0:a9a5c12f2d30 535 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 536 sqbind_push_method_userdata(v,function);
jhnwkmn 0:a9a5c12f2d30 537 sq_newclosure(v,_sqbind_sqfunction_2r<VM,P1, P2,R>,1);
jhnwkmn 0:a9a5c12f2d30 538 sq_newslot(v,-3,p_class_id!=NULL);
jhnwkmn 0:a9a5c12f2d30 539 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 540
jhnwkmn 0:a9a5c12f2d30 541 }
jhnwkmn 0:a9a5c12f2d30 542
jhnwkmn 0:a9a5c12f2d30 543
jhnwkmn 0:a9a5c12f2d30 544 /////////////////////
jhnwkmn 0:a9a5c12f2d30 545 // SqBind 3 arguments
jhnwkmn 0:a9a5c12f2d30 546 /////////////////////
jhnwkmn 0:a9a5c12f2d30 547
jhnwkmn 0:a9a5c12f2d30 548 template<class T,class P1, class P2, class P3 >
jhnwkmn 0:a9a5c12f2d30 549 SQInteger _sqbind_sqmethod_3(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 550
jhnwkmn 0:a9a5c12f2d30 551 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 552 typedef void (T::*M)(P1, P2, P3);
jhnwkmn 0:a9a5c12f2d30 553 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 554 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 555 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 556 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 557 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 558 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 559
jhnwkmn 0:a9a5c12f2d30 560 (self->*method)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4));
jhnwkmn 0:a9a5c12f2d30 561
jhnwkmn 0:a9a5c12f2d30 562 return 0;
jhnwkmn 0:a9a5c12f2d30 563 }
jhnwkmn 0:a9a5c12f2d30 564
jhnwkmn 0:a9a5c12f2d30 565 template<class T,class P1, class P2, class P3 >
jhnwkmn 0:a9a5c12f2d30 566 SQInteger _sqbind_sqmethod_3c(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 567
jhnwkmn 0:a9a5c12f2d30 568 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 569 typedef void (T::*M)(P1, P2, P3) const;
jhnwkmn 0:a9a5c12f2d30 570 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 571 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 572 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 573 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 574 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 575 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 576
jhnwkmn 0:a9a5c12f2d30 577 (self->*method)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4));
jhnwkmn 0:a9a5c12f2d30 578
jhnwkmn 0:a9a5c12f2d30 579 return 0;
jhnwkmn 0:a9a5c12f2d30 580 }
jhnwkmn 0:a9a5c12f2d30 581
jhnwkmn 0:a9a5c12f2d30 582 template<class T,class P1, class P2, class P3, class R>
jhnwkmn 0:a9a5c12f2d30 583 SQInteger _sqbind_sqmethod_3r(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 584
jhnwkmn 0:a9a5c12f2d30 585 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 586 typedef R (T::*M)(P1, P2, P3);
jhnwkmn 0:a9a5c12f2d30 587 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 588 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 589 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 590 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 591 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 592 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 593
jhnwkmn 0:a9a5c12f2d30 594 R r = (self->*method)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4));
jhnwkmn 0:a9a5c12f2d30 595 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 596 return 1;
jhnwkmn 0:a9a5c12f2d30 597 }
jhnwkmn 0:a9a5c12f2d30 598
jhnwkmn 0:a9a5c12f2d30 599 template<class T,class P1, class P2, class P3, class R>
jhnwkmn 0:a9a5c12f2d30 600 SQInteger _sqbind_sqmethod_3rc(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 601
jhnwkmn 0:a9a5c12f2d30 602 const T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 603 typedef R (T::*M)(P1, P2, P3) const;
jhnwkmn 0:a9a5c12f2d30 604 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 605 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 606 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 607 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 608 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 609 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 610
jhnwkmn 0:a9a5c12f2d30 611 R r = (self->*method)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4));
jhnwkmn 0:a9a5c12f2d30 612 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 613 return 1;
jhnwkmn 0:a9a5c12f2d30 614 }
jhnwkmn 0:a9a5c12f2d30 615
jhnwkmn 0:a9a5c12f2d30 616 template<class T,class P1, class P2, class P3>
jhnwkmn 0:a9a5c12f2d30 617 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, void (T::*method)(P1, P2, P3) ) {
jhnwkmn 0:a9a5c12f2d30 618
jhnwkmn 0:a9a5c12f2d30 619 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 620 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 621 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 622 sq_newclosure(v,_sqbind_sqmethod_3<T,P1, P2, P3>,1);
jhnwkmn 0:a9a5c12f2d30 623 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 624 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 625
jhnwkmn 0:a9a5c12f2d30 626 }
jhnwkmn 0:a9a5c12f2d30 627
jhnwkmn 0:a9a5c12f2d30 628 template<class T,class P1, class P2, class P3>
jhnwkmn 0:a9a5c12f2d30 629 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, void (T::*method)(P1, P2, P3) const ) {
jhnwkmn 0:a9a5c12f2d30 630
jhnwkmn 0:a9a5c12f2d30 631 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 632 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 633 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 634 sq_newclosure(v,_sqbind_sqmethod_3c<T,P1, P2, P3>,1);
jhnwkmn 0:a9a5c12f2d30 635 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 636 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 637
jhnwkmn 0:a9a5c12f2d30 638 }
jhnwkmn 0:a9a5c12f2d30 639
jhnwkmn 0:a9a5c12f2d30 640 template<class T,class P1, class P2, class P3 ,class R>
jhnwkmn 0:a9a5c12f2d30 641 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, R (T::*method)(P1, P2, P3) ) {
jhnwkmn 0:a9a5c12f2d30 642
jhnwkmn 0:a9a5c12f2d30 643 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 644 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 645 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 646 sq_newclosure(v,_sqbind_sqmethod_3r<T,P1, P2, P3,R>,1);
jhnwkmn 0:a9a5c12f2d30 647 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 648 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 649
jhnwkmn 0:a9a5c12f2d30 650 }
jhnwkmn 0:a9a5c12f2d30 651
jhnwkmn 0:a9a5c12f2d30 652 template<class T,class P1, class P2, class P3,class R>
jhnwkmn 0:a9a5c12f2d30 653 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, R (T::*method)(P1, P2, P3) const ) {
jhnwkmn 0:a9a5c12f2d30 654
jhnwkmn 0:a9a5c12f2d30 655 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 656 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 657 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 658 sq_newclosure(v,_sqbind_sqmethod_3rc<T,P1, P2, P3,R>,1);
jhnwkmn 0:a9a5c12f2d30 659 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 660 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 661
jhnwkmn 0:a9a5c12f2d30 662 }
jhnwkmn 0:a9a5c12f2d30 663
jhnwkmn 0:a9a5c12f2d30 664 // STATIC METHODS / FUNCTIONS
jhnwkmn 0:a9a5c12f2d30 665
jhnwkmn 0:a9a5c12f2d30 666 // using vm as template parameter....
jhnwkmn 0:a9a5c12f2d30 667 // otherwise overload won't work
jhnwkmn 0:a9a5c12f2d30 668
jhnwkmn 0:a9a5c12f2d30 669 template<class VM,class P1, class P2, class P3>
jhnwkmn 0:a9a5c12f2d30 670 SQInteger _sqbind_sqfunction_3(VM v) {
jhnwkmn 0:a9a5c12f2d30 671
jhnwkmn 0:a9a5c12f2d30 672 typedef void (*F)(P1, P2, P3);
jhnwkmn 0:a9a5c12f2d30 673 F*functionptr;
jhnwkmn 0:a9a5c12f2d30 674 sq_getuserdata(v,-1,(SQUserPointer*)&functionptr,NULL);
jhnwkmn 0:a9a5c12f2d30 675 F function = *functionptr;
jhnwkmn 0:a9a5c12f2d30 676 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 677 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 678 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 679
jhnwkmn 0:a9a5c12f2d30 680 (function)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4));
jhnwkmn 0:a9a5c12f2d30 681
jhnwkmn 0:a9a5c12f2d30 682 return 0;
jhnwkmn 0:a9a5c12f2d30 683 }
jhnwkmn 0:a9a5c12f2d30 684
jhnwkmn 0:a9a5c12f2d30 685
jhnwkmn 0:a9a5c12f2d30 686
jhnwkmn 0:a9a5c12f2d30 687 template<class VM,class P1, class P2, class P3, class R>
jhnwkmn 0:a9a5c12f2d30 688 SQInteger _sqbind_sqfunction_3r(VM v) {
jhnwkmn 0:a9a5c12f2d30 689
jhnwkmn 0:a9a5c12f2d30 690 typedef R (*F)(P1, P2, P3);
jhnwkmn 0:a9a5c12f2d30 691 F*functionptr;
jhnwkmn 0:a9a5c12f2d30 692 sq_getuserdata(v,-1,(SQUserPointer*)&functionptr,NULL);
jhnwkmn 0:a9a5c12f2d30 693 F function = *functionptr;
jhnwkmn 0:a9a5c12f2d30 694 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 695 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 696 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 697
jhnwkmn 0:a9a5c12f2d30 698 R r = (function)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4));
jhnwkmn 0:a9a5c12f2d30 699 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 700 return 1;
jhnwkmn 0:a9a5c12f2d30 701 }
jhnwkmn 0:a9a5c12f2d30 702
jhnwkmn 0:a9a5c12f2d30 703 //call for functions
jhnwkmn 0:a9a5c12f2d30 704 template<class VM,class P1, class P2, class P3>
jhnwkmn 0:a9a5c12f2d30 705 void sqbind_function( VM v, const SQChar *p_name, void (*function)(P1, P2, P3), const HSQOBJECT *p_class_id=NULL ) {
jhnwkmn 0:a9a5c12f2d30 706
jhnwkmn 0:a9a5c12f2d30 707 if (p_class_id)
jhnwkmn 0:a9a5c12f2d30 708 sq_pushobject(v,*p_class_id); // push class
jhnwkmn 0:a9a5c12f2d30 709 else
jhnwkmn 0:a9a5c12f2d30 710 sq_pushroottable(v);
jhnwkmn 0:a9a5c12f2d30 711
jhnwkmn 0:a9a5c12f2d30 712 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 713 sqbind_push_method_userdata(v,function);
jhnwkmn 0:a9a5c12f2d30 714 sq_newclosure(v,_sqbind_sqfunction_3<VM,P1, P2, P3>,1);
jhnwkmn 0:a9a5c12f2d30 715 sq_newslot(v,-3,p_class_id!=NULL);
jhnwkmn 0:a9a5c12f2d30 716 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 717
jhnwkmn 0:a9a5c12f2d30 718 }
jhnwkmn 0:a9a5c12f2d30 719
jhnwkmn 0:a9a5c12f2d30 720
jhnwkmn 0:a9a5c12f2d30 721 template<class VM, class P1, class P2, class P3,class R>
jhnwkmn 0:a9a5c12f2d30 722 void sqbind_function( VM v, const SQChar *p_name, R (*function)(P1, P2, P3), const HSQOBJECT *p_class_id=NULL ) {
jhnwkmn 0:a9a5c12f2d30 723
jhnwkmn 0:a9a5c12f2d30 724 if (p_class_id)
jhnwkmn 0:a9a5c12f2d30 725 sq_pushobject(v,*p_class_id); // push class
jhnwkmn 0:a9a5c12f2d30 726 else
jhnwkmn 0:a9a5c12f2d30 727 sq_pushroottable(v);
jhnwkmn 0:a9a5c12f2d30 728 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 729 sqbind_push_method_userdata(v,function);
jhnwkmn 0:a9a5c12f2d30 730 sq_newclosure(v,_sqbind_sqfunction_3r<VM,P1, P2, P3,R>,1);
jhnwkmn 0:a9a5c12f2d30 731 sq_newslot(v,-3,p_class_id!=NULL);
jhnwkmn 0:a9a5c12f2d30 732 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 733
jhnwkmn 0:a9a5c12f2d30 734 }
jhnwkmn 0:a9a5c12f2d30 735
jhnwkmn 0:a9a5c12f2d30 736
jhnwkmn 0:a9a5c12f2d30 737 /////////////////////
jhnwkmn 0:a9a5c12f2d30 738 // SqBind 4 arguments
jhnwkmn 0:a9a5c12f2d30 739 /////////////////////
jhnwkmn 0:a9a5c12f2d30 740
jhnwkmn 0:a9a5c12f2d30 741 template<class T,class P1, class P2, class P3, class P4 >
jhnwkmn 0:a9a5c12f2d30 742 SQInteger _sqbind_sqmethod_4(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 743
jhnwkmn 0:a9a5c12f2d30 744 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 745 typedef void (T::*M)(P1, P2, P3, P4);
jhnwkmn 0:a9a5c12f2d30 746 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 747 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 748 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 749 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 750 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 751 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 752 SqCParam<P4> p4;
jhnwkmn 0:a9a5c12f2d30 753
jhnwkmn 0:a9a5c12f2d30 754 (self->*method)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4), p4.getter.get(v,5));
jhnwkmn 0:a9a5c12f2d30 755
jhnwkmn 0:a9a5c12f2d30 756 return 0;
jhnwkmn 0:a9a5c12f2d30 757 }
jhnwkmn 0:a9a5c12f2d30 758
jhnwkmn 0:a9a5c12f2d30 759 template<class T,class P1, class P2, class P3, class P4 >
jhnwkmn 0:a9a5c12f2d30 760 SQInteger _sqbind_sqmethod_4c(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 761
jhnwkmn 0:a9a5c12f2d30 762 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 763 typedef void (T::*M)(P1, P2, P3, P4) const;
jhnwkmn 0:a9a5c12f2d30 764 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 765 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 766 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 767 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 768 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 769 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 770 SqCParam<P4> p4;
jhnwkmn 0:a9a5c12f2d30 771
jhnwkmn 0:a9a5c12f2d30 772 (self->*method)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4), p4.getter.get(v,5));
jhnwkmn 0:a9a5c12f2d30 773
jhnwkmn 0:a9a5c12f2d30 774 return 0;
jhnwkmn 0:a9a5c12f2d30 775 }
jhnwkmn 0:a9a5c12f2d30 776
jhnwkmn 0:a9a5c12f2d30 777 template<class T,class P1, class P2, class P3, class P4, class R>
jhnwkmn 0:a9a5c12f2d30 778 SQInteger _sqbind_sqmethod_4r(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 779
jhnwkmn 0:a9a5c12f2d30 780 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 781 typedef R (T::*M)(P1, P2, P3, P4);
jhnwkmn 0:a9a5c12f2d30 782 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 783 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 784 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 785 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 786 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 787 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 788 SqCParam<P4> p4;
jhnwkmn 0:a9a5c12f2d30 789
jhnwkmn 0:a9a5c12f2d30 790 R r = (self->*method)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4), p4.getter.get(v,5));
jhnwkmn 0:a9a5c12f2d30 791 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 792 return 1;
jhnwkmn 0:a9a5c12f2d30 793 }
jhnwkmn 0:a9a5c12f2d30 794
jhnwkmn 0:a9a5c12f2d30 795 template<class T,class P1, class P2, class P3, class P4, class R>
jhnwkmn 0:a9a5c12f2d30 796 SQInteger _sqbind_sqmethod_4rc(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 797
jhnwkmn 0:a9a5c12f2d30 798 const T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 799 typedef R (T::*M)(P1, P2, P3, P4) const;
jhnwkmn 0:a9a5c12f2d30 800 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 801 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 802 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 803 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 804 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 805 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 806 SqCParam<P4> p4;
jhnwkmn 0:a9a5c12f2d30 807
jhnwkmn 0:a9a5c12f2d30 808 R r = (self->*method)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4), p4.getter.get(v,5));
jhnwkmn 0:a9a5c12f2d30 809 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 810 return 1;
jhnwkmn 0:a9a5c12f2d30 811 }
jhnwkmn 0:a9a5c12f2d30 812
jhnwkmn 0:a9a5c12f2d30 813 template<class T,class P1, class P2, class P3, class P4>
jhnwkmn 0:a9a5c12f2d30 814 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, void (T::*method)(P1, P2, P3, P4) ) {
jhnwkmn 0:a9a5c12f2d30 815
jhnwkmn 0:a9a5c12f2d30 816 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 817 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 818 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 819 sq_newclosure(v,_sqbind_sqmethod_4<T,P1, P2, P3, P4>,1);
jhnwkmn 0:a9a5c12f2d30 820 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 821 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 822
jhnwkmn 0:a9a5c12f2d30 823 }
jhnwkmn 0:a9a5c12f2d30 824
jhnwkmn 0:a9a5c12f2d30 825 template<class T,class P1, class P2, class P3, class P4>
jhnwkmn 0:a9a5c12f2d30 826 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, void (T::*method)(P1, P2, P3, P4) const ) {
jhnwkmn 0:a9a5c12f2d30 827
jhnwkmn 0:a9a5c12f2d30 828 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 829 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 830 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 831 sq_newclosure(v,_sqbind_sqmethod_4c<T,P1, P2, P3, P4>,1);
jhnwkmn 0:a9a5c12f2d30 832 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 833 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 834
jhnwkmn 0:a9a5c12f2d30 835 }
jhnwkmn 0:a9a5c12f2d30 836
jhnwkmn 0:a9a5c12f2d30 837 template<class T,class P1, class P2, class P3, class P4 ,class R>
jhnwkmn 0:a9a5c12f2d30 838 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, R (T::*method)(P1, P2, P3, P4) ) {
jhnwkmn 0:a9a5c12f2d30 839
jhnwkmn 0:a9a5c12f2d30 840 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 841 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 842 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 843 sq_newclosure(v,_sqbind_sqmethod_4r<T,P1, P2, P3, P4,R>,1);
jhnwkmn 0:a9a5c12f2d30 844 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 845 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 846
jhnwkmn 0:a9a5c12f2d30 847 }
jhnwkmn 0:a9a5c12f2d30 848
jhnwkmn 0:a9a5c12f2d30 849 template<class T,class P1, class P2, class P3, class P4,class R>
jhnwkmn 0:a9a5c12f2d30 850 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, R (T::*method)(P1, P2, P3, P4) const ) {
jhnwkmn 0:a9a5c12f2d30 851
jhnwkmn 0:a9a5c12f2d30 852 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 853 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 854 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 855 sq_newclosure(v,_sqbind_sqmethod_4rc<T,P1, P2, P3, P4,R>,1);
jhnwkmn 0:a9a5c12f2d30 856 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 857 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 858
jhnwkmn 0:a9a5c12f2d30 859 }
jhnwkmn 0:a9a5c12f2d30 860
jhnwkmn 0:a9a5c12f2d30 861 // STATIC METHODS / FUNCTIONS
jhnwkmn 0:a9a5c12f2d30 862
jhnwkmn 0:a9a5c12f2d30 863 // using vm as template parameter....
jhnwkmn 0:a9a5c12f2d30 864 // otherwise overload won't work
jhnwkmn 0:a9a5c12f2d30 865
jhnwkmn 0:a9a5c12f2d30 866 template<class VM,class P1, class P2, class P3, class P4>
jhnwkmn 0:a9a5c12f2d30 867 SQInteger _sqbind_sqfunction_4(VM v) {
jhnwkmn 0:a9a5c12f2d30 868
jhnwkmn 0:a9a5c12f2d30 869 typedef void (*F)(P1, P2, P3, P4);
jhnwkmn 0:a9a5c12f2d30 870 F*functionptr;
jhnwkmn 0:a9a5c12f2d30 871 sq_getuserdata(v,-1,(SQUserPointer*)&functionptr,NULL);
jhnwkmn 0:a9a5c12f2d30 872 F function = *functionptr;
jhnwkmn 0:a9a5c12f2d30 873 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 874 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 875 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 876 SqCParam<P4> p4;
jhnwkmn 0:a9a5c12f2d30 877
jhnwkmn 0:a9a5c12f2d30 878 (function)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4), p4.getter.get(v,5));
jhnwkmn 0:a9a5c12f2d30 879
jhnwkmn 0:a9a5c12f2d30 880 return 0;
jhnwkmn 0:a9a5c12f2d30 881 }
jhnwkmn 0:a9a5c12f2d30 882
jhnwkmn 0:a9a5c12f2d30 883
jhnwkmn 0:a9a5c12f2d30 884
jhnwkmn 0:a9a5c12f2d30 885 template<class VM,class P1, class P2, class P3, class P4, class R>
jhnwkmn 0:a9a5c12f2d30 886 SQInteger _sqbind_sqfunction_4r(VM v) {
jhnwkmn 0:a9a5c12f2d30 887
jhnwkmn 0:a9a5c12f2d30 888 typedef R (*F)(P1, P2, P3, P4);
jhnwkmn 0:a9a5c12f2d30 889 F*functionptr;
jhnwkmn 0:a9a5c12f2d30 890 sq_getuserdata(v,-1,(SQUserPointer*)&functionptr,NULL);
jhnwkmn 0:a9a5c12f2d30 891 F function = *functionptr;
jhnwkmn 0:a9a5c12f2d30 892 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 893 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 894 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 895 SqCParam<P4> p4;
jhnwkmn 0:a9a5c12f2d30 896
jhnwkmn 0:a9a5c12f2d30 897 R r = (function)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4), p4.getter.get(v,5));
jhnwkmn 0:a9a5c12f2d30 898 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 899 return 1;
jhnwkmn 0:a9a5c12f2d30 900 }
jhnwkmn 0:a9a5c12f2d30 901
jhnwkmn 0:a9a5c12f2d30 902 //call for functions
jhnwkmn 0:a9a5c12f2d30 903 template<class VM,class P1, class P2, class P3, class P4>
jhnwkmn 0:a9a5c12f2d30 904 void sqbind_function( VM v, const SQChar *p_name, void (*function)(P1, P2, P3, P4), const HSQOBJECT *p_class_id=NULL ) {
jhnwkmn 0:a9a5c12f2d30 905
jhnwkmn 0:a9a5c12f2d30 906 if (p_class_id)
jhnwkmn 0:a9a5c12f2d30 907 sq_pushobject(v,*p_class_id); // push class
jhnwkmn 0:a9a5c12f2d30 908 else
jhnwkmn 0:a9a5c12f2d30 909 sq_pushroottable(v);
jhnwkmn 0:a9a5c12f2d30 910
jhnwkmn 0:a9a5c12f2d30 911 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 912 sqbind_push_method_userdata(v,function);
jhnwkmn 0:a9a5c12f2d30 913 sq_newclosure(v,_sqbind_sqfunction_4<VM,P1, P2, P3, P4>,1);
jhnwkmn 0:a9a5c12f2d30 914 sq_newslot(v,-3,p_class_id!=NULL);
jhnwkmn 0:a9a5c12f2d30 915 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 916
jhnwkmn 0:a9a5c12f2d30 917 }
jhnwkmn 0:a9a5c12f2d30 918
jhnwkmn 0:a9a5c12f2d30 919
jhnwkmn 0:a9a5c12f2d30 920 template<class VM, class P1, class P2, class P3, class P4,class R>
jhnwkmn 0:a9a5c12f2d30 921 void sqbind_function( VM v, const SQChar *p_name, R (*function)(P1, P2, P3, P4), const HSQOBJECT *p_class_id=NULL ) {
jhnwkmn 0:a9a5c12f2d30 922
jhnwkmn 0:a9a5c12f2d30 923 if (p_class_id)
jhnwkmn 0:a9a5c12f2d30 924 sq_pushobject(v,*p_class_id); // push class
jhnwkmn 0:a9a5c12f2d30 925 else
jhnwkmn 0:a9a5c12f2d30 926 sq_pushroottable(v);
jhnwkmn 0:a9a5c12f2d30 927 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 928 sqbind_push_method_userdata(v,function);
jhnwkmn 0:a9a5c12f2d30 929 sq_newclosure(v,_sqbind_sqfunction_4r<VM,P1, P2, P3, P4,R>,1);
jhnwkmn 0:a9a5c12f2d30 930 sq_newslot(v,-3,p_class_id!=NULL);
jhnwkmn 0:a9a5c12f2d30 931 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 932
jhnwkmn 0:a9a5c12f2d30 933 }
jhnwkmn 0:a9a5c12f2d30 934
jhnwkmn 0:a9a5c12f2d30 935
jhnwkmn 0:a9a5c12f2d30 936 /////////////////////
jhnwkmn 0:a9a5c12f2d30 937 // SqBind 5 arguments
jhnwkmn 0:a9a5c12f2d30 938 /////////////////////
jhnwkmn 0:a9a5c12f2d30 939
jhnwkmn 0:a9a5c12f2d30 940 template<class T,class P1, class P2, class P3, class P4, class P5 >
jhnwkmn 0:a9a5c12f2d30 941 SQInteger _sqbind_sqmethod_5(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 942
jhnwkmn 0:a9a5c12f2d30 943 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 944 typedef void (T::*M)(P1, P2, P3, P4, P5);
jhnwkmn 0:a9a5c12f2d30 945 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 946 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 947 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 948 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 949 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 950 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 951 SqCParam<P4> p4;
jhnwkmn 0:a9a5c12f2d30 952 SqCParam<P5> p5;
jhnwkmn 0:a9a5c12f2d30 953
jhnwkmn 0:a9a5c12f2d30 954 (self->*method)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4), p4.getter.get(v,5), p5.getter.get(v,6));
jhnwkmn 0:a9a5c12f2d30 955
jhnwkmn 0:a9a5c12f2d30 956 return 0;
jhnwkmn 0:a9a5c12f2d30 957 }
jhnwkmn 0:a9a5c12f2d30 958
jhnwkmn 0:a9a5c12f2d30 959 template<class T,class P1, class P2, class P3, class P4, class P5 >
jhnwkmn 0:a9a5c12f2d30 960 SQInteger _sqbind_sqmethod_5c(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 961
jhnwkmn 0:a9a5c12f2d30 962 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 963 typedef void (T::*M)(P1, P2, P3, P4, P5) const;
jhnwkmn 0:a9a5c12f2d30 964 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 965 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 966 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 967 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 968 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 969 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 970 SqCParam<P4> p4;
jhnwkmn 0:a9a5c12f2d30 971 SqCParam<P5> p5;
jhnwkmn 0:a9a5c12f2d30 972
jhnwkmn 0:a9a5c12f2d30 973 (self->*method)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4), p4.getter.get(v,5), p5.getter.get(v,6));
jhnwkmn 0:a9a5c12f2d30 974
jhnwkmn 0:a9a5c12f2d30 975 return 0;
jhnwkmn 0:a9a5c12f2d30 976 }
jhnwkmn 0:a9a5c12f2d30 977
jhnwkmn 0:a9a5c12f2d30 978 template<class T,class P1, class P2, class P3, class P4, class P5, class R>
jhnwkmn 0:a9a5c12f2d30 979 SQInteger _sqbind_sqmethod_5r(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 980
jhnwkmn 0:a9a5c12f2d30 981 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 982 typedef R (T::*M)(P1, P2, P3, P4, P5);
jhnwkmn 0:a9a5c12f2d30 983 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 984 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 985 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 986 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 987 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 988 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 989 SqCParam<P4> p4;
jhnwkmn 0:a9a5c12f2d30 990 SqCParam<P5> p5;
jhnwkmn 0:a9a5c12f2d30 991
jhnwkmn 0:a9a5c12f2d30 992 R r = (self->*method)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4), p4.getter.get(v,5), p5.getter.get(v,6));
jhnwkmn 0:a9a5c12f2d30 993 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 994 return 1;
jhnwkmn 0:a9a5c12f2d30 995 }
jhnwkmn 0:a9a5c12f2d30 996
jhnwkmn 0:a9a5c12f2d30 997 template<class T,class P1, class P2, class P3, class P4, class P5, class R>
jhnwkmn 0:a9a5c12f2d30 998 SQInteger _sqbind_sqmethod_5rc(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 999
jhnwkmn 0:a9a5c12f2d30 1000 const T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 1001 typedef R (T::*M)(P1, P2, P3, P4, P5) const;
jhnwkmn 0:a9a5c12f2d30 1002 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 1003 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 1004 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 1005 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 1006 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 1007 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 1008 SqCParam<P4> p4;
jhnwkmn 0:a9a5c12f2d30 1009 SqCParam<P5> p5;
jhnwkmn 0:a9a5c12f2d30 1010
jhnwkmn 0:a9a5c12f2d30 1011 R r = (self->*method)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4), p4.getter.get(v,5), p5.getter.get(v,6));
jhnwkmn 0:a9a5c12f2d30 1012 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 1013 return 1;
jhnwkmn 0:a9a5c12f2d30 1014 }
jhnwkmn 0:a9a5c12f2d30 1015
jhnwkmn 0:a9a5c12f2d30 1016 template<class T,class P1, class P2, class P3, class P4, class P5>
jhnwkmn 0:a9a5c12f2d30 1017 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, void (T::*method)(P1, P2, P3, P4, P5) ) {
jhnwkmn 0:a9a5c12f2d30 1018
jhnwkmn 0:a9a5c12f2d30 1019 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 1020 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 1021 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 1022 sq_newclosure(v,_sqbind_sqmethod_5<T,P1, P2, P3, P4, P5>,1);
jhnwkmn 0:a9a5c12f2d30 1023 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 1024 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 1025
jhnwkmn 0:a9a5c12f2d30 1026 }
jhnwkmn 0:a9a5c12f2d30 1027
jhnwkmn 0:a9a5c12f2d30 1028 template<class T,class P1, class P2, class P3, class P4, class P5>
jhnwkmn 0:a9a5c12f2d30 1029 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, void (T::*method)(P1, P2, P3, P4, P5) const ) {
jhnwkmn 0:a9a5c12f2d30 1030
jhnwkmn 0:a9a5c12f2d30 1031 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 1032 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 1033 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 1034 sq_newclosure(v,_sqbind_sqmethod_5c<T,P1, P2, P3, P4, P5>,1);
jhnwkmn 0:a9a5c12f2d30 1035 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 1036 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 1037
jhnwkmn 0:a9a5c12f2d30 1038 }
jhnwkmn 0:a9a5c12f2d30 1039
jhnwkmn 0:a9a5c12f2d30 1040 template<class T,class P1, class P2, class P3, class P4, class P5 ,class R>
jhnwkmn 0:a9a5c12f2d30 1041 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, R (T::*method)(P1, P2, P3, P4, P5) ) {
jhnwkmn 0:a9a5c12f2d30 1042
jhnwkmn 0:a9a5c12f2d30 1043 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 1044 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 1045 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 1046 sq_newclosure(v,_sqbind_sqmethod_5r<T,P1, P2, P3, P4, P5,R>,1);
jhnwkmn 0:a9a5c12f2d30 1047 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 1048 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 1049
jhnwkmn 0:a9a5c12f2d30 1050 }
jhnwkmn 0:a9a5c12f2d30 1051
jhnwkmn 0:a9a5c12f2d30 1052 template<class T,class P1, class P2, class P3, class P4, class P5,class R>
jhnwkmn 0:a9a5c12f2d30 1053 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, R (T::*method)(P1, P2, P3, P4, P5) const ) {
jhnwkmn 0:a9a5c12f2d30 1054
jhnwkmn 0:a9a5c12f2d30 1055 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 1056 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 1057 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 1058 sq_newclosure(v,_sqbind_sqmethod_5rc<T,P1, P2, P3, P4, P5,R>,1);
jhnwkmn 0:a9a5c12f2d30 1059 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 1060 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 1061
jhnwkmn 0:a9a5c12f2d30 1062 }
jhnwkmn 0:a9a5c12f2d30 1063
jhnwkmn 0:a9a5c12f2d30 1064 // STATIC METHODS / FUNCTIONS
jhnwkmn 0:a9a5c12f2d30 1065
jhnwkmn 0:a9a5c12f2d30 1066 // using vm as template parameter....
jhnwkmn 0:a9a5c12f2d30 1067 // otherwise overload won't work
jhnwkmn 0:a9a5c12f2d30 1068
jhnwkmn 0:a9a5c12f2d30 1069 template<class VM,class P1, class P2, class P3, class P4, class P5>
jhnwkmn 0:a9a5c12f2d30 1070 SQInteger _sqbind_sqfunction_5(VM v) {
jhnwkmn 0:a9a5c12f2d30 1071
jhnwkmn 0:a9a5c12f2d30 1072 typedef void (*F)(P1, P2, P3, P4, P5);
jhnwkmn 0:a9a5c12f2d30 1073 F*functionptr;
jhnwkmn 0:a9a5c12f2d30 1074 sq_getuserdata(v,-1,(SQUserPointer*)&functionptr,NULL);
jhnwkmn 0:a9a5c12f2d30 1075 F function = *functionptr;
jhnwkmn 0:a9a5c12f2d30 1076 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 1077 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 1078 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 1079 SqCParam<P4> p4;
jhnwkmn 0:a9a5c12f2d30 1080 SqCParam<P5> p5;
jhnwkmn 0:a9a5c12f2d30 1081
jhnwkmn 0:a9a5c12f2d30 1082 (function)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4), p4.getter.get(v,5), p5.getter.get(v,6));
jhnwkmn 0:a9a5c12f2d30 1083
jhnwkmn 0:a9a5c12f2d30 1084 return 0;
jhnwkmn 0:a9a5c12f2d30 1085 }
jhnwkmn 0:a9a5c12f2d30 1086
jhnwkmn 0:a9a5c12f2d30 1087
jhnwkmn 0:a9a5c12f2d30 1088
jhnwkmn 0:a9a5c12f2d30 1089 template<class VM,class P1, class P2, class P3, class P4, class P5, class R>
jhnwkmn 0:a9a5c12f2d30 1090 SQInteger _sqbind_sqfunction_5r(VM v) {
jhnwkmn 0:a9a5c12f2d30 1091
jhnwkmn 0:a9a5c12f2d30 1092 typedef R (*F)(P1, P2, P3, P4, P5);
jhnwkmn 0:a9a5c12f2d30 1093 F*functionptr;
jhnwkmn 0:a9a5c12f2d30 1094 sq_getuserdata(v,-1,(SQUserPointer*)&functionptr,NULL);
jhnwkmn 0:a9a5c12f2d30 1095 F function = *functionptr;
jhnwkmn 0:a9a5c12f2d30 1096 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 1097 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 1098 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 1099 SqCParam<P4> p4;
jhnwkmn 0:a9a5c12f2d30 1100 SqCParam<P5> p5;
jhnwkmn 0:a9a5c12f2d30 1101
jhnwkmn 0:a9a5c12f2d30 1102 R r = (function)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4), p4.getter.get(v,5), p5.getter.get(v,6));
jhnwkmn 0:a9a5c12f2d30 1103 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 1104 return 1;
jhnwkmn 0:a9a5c12f2d30 1105 }
jhnwkmn 0:a9a5c12f2d30 1106
jhnwkmn 0:a9a5c12f2d30 1107 //call for functions
jhnwkmn 0:a9a5c12f2d30 1108 template<class VM,class P1, class P2, class P3, class P4, class P5>
jhnwkmn 0:a9a5c12f2d30 1109 void sqbind_function( VM v, const SQChar *p_name, void (*function)(P1, P2, P3, P4, P5), const HSQOBJECT *p_class_id=NULL ) {
jhnwkmn 0:a9a5c12f2d30 1110
jhnwkmn 0:a9a5c12f2d30 1111 if (p_class_id)
jhnwkmn 0:a9a5c12f2d30 1112 sq_pushobject(v,*p_class_id); // push class
jhnwkmn 0:a9a5c12f2d30 1113 else
jhnwkmn 0:a9a5c12f2d30 1114 sq_pushroottable(v);
jhnwkmn 0:a9a5c12f2d30 1115
jhnwkmn 0:a9a5c12f2d30 1116 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 1117 sqbind_push_method_userdata(v,function);
jhnwkmn 0:a9a5c12f2d30 1118 sq_newclosure(v,_sqbind_sqfunction_5<VM,P1, P2, P3, P4, P5>,1);
jhnwkmn 0:a9a5c12f2d30 1119 sq_newslot(v,-3,p_class_id!=NULL);
jhnwkmn 0:a9a5c12f2d30 1120 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 1121
jhnwkmn 0:a9a5c12f2d30 1122 }
jhnwkmn 0:a9a5c12f2d30 1123
jhnwkmn 0:a9a5c12f2d30 1124
jhnwkmn 0:a9a5c12f2d30 1125 template<class VM, class P1, class P2, class P3, class P4, class P5,class R>
jhnwkmn 0:a9a5c12f2d30 1126 void sqbind_function( VM v, const SQChar *p_name, R (*function)(P1, P2, P3, P4, P5), const HSQOBJECT *p_class_id=NULL ) {
jhnwkmn 0:a9a5c12f2d30 1127
jhnwkmn 0:a9a5c12f2d30 1128 if (p_class_id)
jhnwkmn 0:a9a5c12f2d30 1129 sq_pushobject(v,*p_class_id); // push class
jhnwkmn 0:a9a5c12f2d30 1130 else
jhnwkmn 0:a9a5c12f2d30 1131 sq_pushroottable(v);
jhnwkmn 0:a9a5c12f2d30 1132 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 1133 sqbind_push_method_userdata(v,function);
jhnwkmn 0:a9a5c12f2d30 1134 sq_newclosure(v,_sqbind_sqfunction_5r<VM,P1, P2, P3, P4, P5,R>,1);
jhnwkmn 0:a9a5c12f2d30 1135 sq_newslot(v,-3,p_class_id!=NULL);
jhnwkmn 0:a9a5c12f2d30 1136 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 1137
jhnwkmn 0:a9a5c12f2d30 1138 }
jhnwkmn 0:a9a5c12f2d30 1139
jhnwkmn 0:a9a5c12f2d30 1140
jhnwkmn 0:a9a5c12f2d30 1141 /////////////////////
jhnwkmn 0:a9a5c12f2d30 1142 // SqBind 6 arguments
jhnwkmn 0:a9a5c12f2d30 1143 /////////////////////
jhnwkmn 0:a9a5c12f2d30 1144
jhnwkmn 0:a9a5c12f2d30 1145 template<class T,class P1, class P2, class P3, class P4, class P5, class P6 >
jhnwkmn 0:a9a5c12f2d30 1146 SQInteger _sqbind_sqmethod_6(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 1147
jhnwkmn 0:a9a5c12f2d30 1148 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 1149 typedef void (T::*M)(P1, P2, P3, P4, P5, P6);
jhnwkmn 0:a9a5c12f2d30 1150 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 1151 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 1152 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 1153 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 1154 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 1155 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 1156 SqCParam<P4> p4;
jhnwkmn 0:a9a5c12f2d30 1157 SqCParam<P5> p5;
jhnwkmn 0:a9a5c12f2d30 1158 SqCParam<P6> p6;
jhnwkmn 0:a9a5c12f2d30 1159
jhnwkmn 0:a9a5c12f2d30 1160 (self->*method)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4), p4.getter.get(v,5), p5.getter.get(v,6), p6.getter.get(v,7));
jhnwkmn 0:a9a5c12f2d30 1161
jhnwkmn 0:a9a5c12f2d30 1162 return 0;
jhnwkmn 0:a9a5c12f2d30 1163 }
jhnwkmn 0:a9a5c12f2d30 1164
jhnwkmn 0:a9a5c12f2d30 1165 template<class T,class P1, class P2, class P3, class P4, class P5, class P6 >
jhnwkmn 0:a9a5c12f2d30 1166 SQInteger _sqbind_sqmethod_6c(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 1167
jhnwkmn 0:a9a5c12f2d30 1168 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 1169 typedef void (T::*M)(P1, P2, P3, P4, P5, P6) const;
jhnwkmn 0:a9a5c12f2d30 1170 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 1171 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 1172 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 1173 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 1174 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 1175 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 1176 SqCParam<P4> p4;
jhnwkmn 0:a9a5c12f2d30 1177 SqCParam<P5> p5;
jhnwkmn 0:a9a5c12f2d30 1178 SqCParam<P6> p6;
jhnwkmn 0:a9a5c12f2d30 1179
jhnwkmn 0:a9a5c12f2d30 1180 (self->*method)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4), p4.getter.get(v,5), p5.getter.get(v,6), p6.getter.get(v,7));
jhnwkmn 0:a9a5c12f2d30 1181
jhnwkmn 0:a9a5c12f2d30 1182 return 0;
jhnwkmn 0:a9a5c12f2d30 1183 }
jhnwkmn 0:a9a5c12f2d30 1184
jhnwkmn 0:a9a5c12f2d30 1185 template<class T,class P1, class P2, class P3, class P4, class P5, class P6, class R>
jhnwkmn 0:a9a5c12f2d30 1186 SQInteger _sqbind_sqmethod_6r(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 1187
jhnwkmn 0:a9a5c12f2d30 1188 T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 1189 typedef R (T::*M)(P1, P2, P3, P4, P5, P6);
jhnwkmn 0:a9a5c12f2d30 1190 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 1191 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 1192 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 1193 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 1194 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 1195 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 1196 SqCParam<P4> p4;
jhnwkmn 0:a9a5c12f2d30 1197 SqCParam<P5> p5;
jhnwkmn 0:a9a5c12f2d30 1198 SqCParam<P6> p6;
jhnwkmn 0:a9a5c12f2d30 1199
jhnwkmn 0:a9a5c12f2d30 1200 R r = (self->*method)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4), p4.getter.get(v,5), p5.getter.get(v,6), p6.getter.get(v,7));
jhnwkmn 0:a9a5c12f2d30 1201 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 1202 return 1;
jhnwkmn 0:a9a5c12f2d30 1203 }
jhnwkmn 0:a9a5c12f2d30 1204
jhnwkmn 0:a9a5c12f2d30 1205 template<class T,class P1, class P2, class P3, class P4, class P5, class P6, class R>
jhnwkmn 0:a9a5c12f2d30 1206 SQInteger _sqbind_sqmethod_6rc(HSQUIRRELVM v) {
jhnwkmn 0:a9a5c12f2d30 1207
jhnwkmn 0:a9a5c12f2d30 1208 const T* self = &SqBind<T>::get(v, 1 );
jhnwkmn 0:a9a5c12f2d30 1209 typedef R (T::*M)(P1, P2, P3, P4, P5, P6) const;
jhnwkmn 0:a9a5c12f2d30 1210 M*methodptr;
jhnwkmn 0:a9a5c12f2d30 1211 sq_getuserdata(v,-1,(SQUserPointer*)&methodptr,NULL);
jhnwkmn 0:a9a5c12f2d30 1212 M method = *methodptr;
jhnwkmn 0:a9a5c12f2d30 1213 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 1214 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 1215 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 1216 SqCParam<P4> p4;
jhnwkmn 0:a9a5c12f2d30 1217 SqCParam<P5> p5;
jhnwkmn 0:a9a5c12f2d30 1218 SqCParam<P6> p6;
jhnwkmn 0:a9a5c12f2d30 1219
jhnwkmn 0:a9a5c12f2d30 1220 R r = (self->*method)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4), p4.getter.get(v,5), p5.getter.get(v,6), p6.getter.get(v,7));
jhnwkmn 0:a9a5c12f2d30 1221 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 1222 return 1;
jhnwkmn 0:a9a5c12f2d30 1223 }
jhnwkmn 0:a9a5c12f2d30 1224
jhnwkmn 0:a9a5c12f2d30 1225 template<class T,class P1, class P2, class P3, class P4, class P5, class P6>
jhnwkmn 0:a9a5c12f2d30 1226 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, void (T::*method)(P1, P2, P3, P4, P5, P6) ) {
jhnwkmn 0:a9a5c12f2d30 1227
jhnwkmn 0:a9a5c12f2d30 1228 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 1229 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 1230 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 1231 sq_newclosure(v,_sqbind_sqmethod_6<T,P1, P2, P3, P4, P5, P6>,1);
jhnwkmn 0:a9a5c12f2d30 1232 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 1233 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 1234
jhnwkmn 0:a9a5c12f2d30 1235 }
jhnwkmn 0:a9a5c12f2d30 1236
jhnwkmn 0:a9a5c12f2d30 1237 template<class T,class P1, class P2, class P3, class P4, class P5, class P6>
jhnwkmn 0:a9a5c12f2d30 1238 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, void (T::*method)(P1, P2, P3, P4, P5, P6) const ) {
jhnwkmn 0:a9a5c12f2d30 1239
jhnwkmn 0:a9a5c12f2d30 1240 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 1241 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 1242 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 1243 sq_newclosure(v,_sqbind_sqmethod_6c<T,P1, P2, P3, P4, P5, P6>,1);
jhnwkmn 0:a9a5c12f2d30 1244 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 1245 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 1246
jhnwkmn 0:a9a5c12f2d30 1247 }
jhnwkmn 0:a9a5c12f2d30 1248
jhnwkmn 0:a9a5c12f2d30 1249 template<class T,class P1, class P2, class P3, class P4, class P5, class P6 ,class R>
jhnwkmn 0:a9a5c12f2d30 1250 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, R (T::*method)(P1, P2, P3, P4, P5, P6) ) {
jhnwkmn 0:a9a5c12f2d30 1251
jhnwkmn 0:a9a5c12f2d30 1252 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 1253 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 1254 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 1255 sq_newclosure(v,_sqbind_sqmethod_6r<T,P1, P2, P3, P4, P5, P6,R>,1);
jhnwkmn 0:a9a5c12f2d30 1256 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 1257 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 1258
jhnwkmn 0:a9a5c12f2d30 1259 }
jhnwkmn 0:a9a5c12f2d30 1260
jhnwkmn 0:a9a5c12f2d30 1261 template<class T,class P1, class P2, class P3, class P4, class P5, class P6,class R>
jhnwkmn 0:a9a5c12f2d30 1262 void sqbind_method( HSQUIRRELVM v, const SQChar *p_name, R (T::*method)(P1, P2, P3, P4, P5, P6) const ) {
jhnwkmn 0:a9a5c12f2d30 1263
jhnwkmn 0:a9a5c12f2d30 1264 sq_pushobject(v,SqBind<T>::get_id()); // push class
jhnwkmn 0:a9a5c12f2d30 1265 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 1266 sqbind_push_method_userdata(v,method);
jhnwkmn 0:a9a5c12f2d30 1267 sq_newclosure(v,_sqbind_sqmethod_6rc<T,P1, P2, P3, P4, P5, P6,R>,1);
jhnwkmn 0:a9a5c12f2d30 1268 sq_newslot(v,-3,false);
jhnwkmn 0:a9a5c12f2d30 1269 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 1270
jhnwkmn 0:a9a5c12f2d30 1271 }
jhnwkmn 0:a9a5c12f2d30 1272
jhnwkmn 0:a9a5c12f2d30 1273 // STATIC METHODS / FUNCTIONS
jhnwkmn 0:a9a5c12f2d30 1274
jhnwkmn 0:a9a5c12f2d30 1275 // using vm as template parameter....
jhnwkmn 0:a9a5c12f2d30 1276 // otherwise overload won't work
jhnwkmn 0:a9a5c12f2d30 1277
jhnwkmn 0:a9a5c12f2d30 1278 template<class VM,class P1, class P2, class P3, class P4, class P5, class P6>
jhnwkmn 0:a9a5c12f2d30 1279 SQInteger _sqbind_sqfunction_6(VM v) {
jhnwkmn 0:a9a5c12f2d30 1280
jhnwkmn 0:a9a5c12f2d30 1281 typedef void (*F)(P1, P2, P3, P4, P5, P6);
jhnwkmn 0:a9a5c12f2d30 1282 F*functionptr;
jhnwkmn 0:a9a5c12f2d30 1283 sq_getuserdata(v,-1,(SQUserPointer*)&functionptr,NULL);
jhnwkmn 0:a9a5c12f2d30 1284 F function = *functionptr;
jhnwkmn 0:a9a5c12f2d30 1285 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 1286 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 1287 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 1288 SqCParam<P4> p4;
jhnwkmn 0:a9a5c12f2d30 1289 SqCParam<P5> p5;
jhnwkmn 0:a9a5c12f2d30 1290 SqCParam<P6> p6;
jhnwkmn 0:a9a5c12f2d30 1291
jhnwkmn 0:a9a5c12f2d30 1292 (function)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4), p4.getter.get(v,5), p5.getter.get(v,6), p6.getter.get(v,7));
jhnwkmn 0:a9a5c12f2d30 1293
jhnwkmn 0:a9a5c12f2d30 1294 return 0;
jhnwkmn 0:a9a5c12f2d30 1295 }
jhnwkmn 0:a9a5c12f2d30 1296
jhnwkmn 0:a9a5c12f2d30 1297
jhnwkmn 0:a9a5c12f2d30 1298
jhnwkmn 0:a9a5c12f2d30 1299 template<class VM,class P1, class P2, class P3, class P4, class P5, class P6, class R>
jhnwkmn 0:a9a5c12f2d30 1300 SQInteger _sqbind_sqfunction_6r(VM v) {
jhnwkmn 0:a9a5c12f2d30 1301
jhnwkmn 0:a9a5c12f2d30 1302 typedef R (*F)(P1, P2, P3, P4, P5, P6);
jhnwkmn 0:a9a5c12f2d30 1303 F*functionptr;
jhnwkmn 0:a9a5c12f2d30 1304 sq_getuserdata(v,-1,(SQUserPointer*)&functionptr,NULL);
jhnwkmn 0:a9a5c12f2d30 1305 F function = *functionptr;
jhnwkmn 0:a9a5c12f2d30 1306 SqCParam<P1> p1;
jhnwkmn 0:a9a5c12f2d30 1307 SqCParam<P2> p2;
jhnwkmn 0:a9a5c12f2d30 1308 SqCParam<P3> p3;
jhnwkmn 0:a9a5c12f2d30 1309 SqCParam<P4> p4;
jhnwkmn 0:a9a5c12f2d30 1310 SqCParam<P5> p5;
jhnwkmn 0:a9a5c12f2d30 1311 SqCParam<P6> p6;
jhnwkmn 0:a9a5c12f2d30 1312
jhnwkmn 0:a9a5c12f2d30 1313 R r = (function)(p1.getter.get(v,2), p2.getter.get(v,3), p3.getter.get(v,4), p4.getter.get(v,5), p5.getter.get(v,6), p6.getter.get(v,7));
jhnwkmn 0:a9a5c12f2d30 1314 _SQBC( R )::push(v, r );
jhnwkmn 0:a9a5c12f2d30 1315 return 1;
jhnwkmn 0:a9a5c12f2d30 1316 }
jhnwkmn 0:a9a5c12f2d30 1317
jhnwkmn 0:a9a5c12f2d30 1318 //call for functions
jhnwkmn 0:a9a5c12f2d30 1319 template<class VM,class P1, class P2, class P3, class P4, class P5, class P6>
jhnwkmn 0:a9a5c12f2d30 1320 void sqbind_function( VM v, const SQChar *p_name, void (*function)(P1, P2, P3, P4, P5, P6), const HSQOBJECT *p_class_id=NULL ) {
jhnwkmn 0:a9a5c12f2d30 1321
jhnwkmn 0:a9a5c12f2d30 1322 if (p_class_id)
jhnwkmn 0:a9a5c12f2d30 1323 sq_pushobject(v,*p_class_id); // push class
jhnwkmn 0:a9a5c12f2d30 1324 else
jhnwkmn 0:a9a5c12f2d30 1325 sq_pushroottable(v);
jhnwkmn 0:a9a5c12f2d30 1326
jhnwkmn 0:a9a5c12f2d30 1327 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 1328 sqbind_push_method_userdata(v,function);
jhnwkmn 0:a9a5c12f2d30 1329 sq_newclosure(v,_sqbind_sqfunction_6<VM,P1, P2, P3, P4, P5, P6>,1);
jhnwkmn 0:a9a5c12f2d30 1330 sq_newslot(v,-3,p_class_id!=NULL);
jhnwkmn 0:a9a5c12f2d30 1331 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 1332
jhnwkmn 0:a9a5c12f2d30 1333 }
jhnwkmn 0:a9a5c12f2d30 1334
jhnwkmn 0:a9a5c12f2d30 1335
jhnwkmn 0:a9a5c12f2d30 1336 template<class VM, class P1, class P2, class P3, class P4, class P5, class P6,class R>
jhnwkmn 0:a9a5c12f2d30 1337 void sqbind_function( VM v, const SQChar *p_name, R (*function)(P1, P2, P3, P4, P5, P6), const HSQOBJECT *p_class_id=NULL ) {
jhnwkmn 0:a9a5c12f2d30 1338
jhnwkmn 0:a9a5c12f2d30 1339 if (p_class_id)
jhnwkmn 0:a9a5c12f2d30 1340 sq_pushobject(v,*p_class_id); // push class
jhnwkmn 0:a9a5c12f2d30 1341 else
jhnwkmn 0:a9a5c12f2d30 1342 sq_pushroottable(v);
jhnwkmn 0:a9a5c12f2d30 1343 sq_pushstring(v,p_name,-1);
jhnwkmn 0:a9a5c12f2d30 1344 sqbind_push_method_userdata(v,function);
jhnwkmn 0:a9a5c12f2d30 1345 sq_newclosure(v,_sqbind_sqfunction_6r<VM,P1, P2, P3, P4, P5, P6,R>,1);
jhnwkmn 0:a9a5c12f2d30 1346 sq_newslot(v,-3,p_class_id!=NULL);
jhnwkmn 0:a9a5c12f2d30 1347 sq_pop(v,1); // pop class
jhnwkmn 0:a9a5c12f2d30 1348
jhnwkmn 0:a9a5c12f2d30 1349 }
jhnwkmn 0:a9a5c12f2d30 1350
jhnwkmn 0:a9a5c12f2d30 1351