Removed
Link Here
|
1 |
From 57ca6c191e4422ed3d53d406c9d5b47bb185489d Mon Sep 17 00:00:00 2001 |
2 |
From: zeromus <zeromus@users.noreply.github.com> |
3 |
Date: Sat, 29 Jul 2017 14:51:26 -0500 |
4 |
Subject: [PATCH] rename `type` macro to `sqtype` |
5 |
|
6 |
--- squirrel/sqapi.cpp.orig 2017-08-31 12:07:29 UTC |
7 |
+++ squirrel/sqapi.cpp |
8 |
@@ -16,7 +16,7 @@ |
9 |
static bool sq_aux_gettypedarg(HSQUIRRELVM v,SQInteger idx,SQObjectType type,SQObjectPtr **o) |
10 |
{ |
11 |
*o = &stack_get(v,idx); |
12 |
- if(type(**o) != type){ |
13 |
+ if(sqtype(**o) != type){ |
14 |
SQObjectPtr oval = v->PrintObjVal(**o); |
15 |
v->Raise_Error(_SC("wrong argument type, expected '%s' got '%.50s'"),IdType2Name(type),_stringval(oval)); |
16 |
return false; |
17 |
@@ -150,7 +150,7 @@ void sq_notifyallexceptions(HSQUIRRELVM v, SQBool enab |
18 |
|
19 |
void sq_addref(HSQUIRRELVM v,HSQOBJECT *po) |
20 |
{ |
21 |
- if(!ISREFCOUNTED(type(*po))) return; |
22 |
+ if(!ISREFCOUNTED(sqtype(*po))) return; |
23 |
#ifdef NO_GARBAGE_COLLECTOR |
24 |
__AddRef(po->_type,po->_unVal); |
25 |
#else |
26 |
@@ -160,7 +160,7 @@ void sq_addref(HSQUIRRELVM v,HSQOBJECT *po) |
27 |
|
28 |
SQUnsignedInteger sq_getrefcount(HSQUIRRELVM v,HSQOBJECT *po) |
29 |
{ |
30 |
- if(!ISREFCOUNTED(type(*po))) return 0; |
31 |
+ if(!ISREFCOUNTED(sqtype(*po))) return 0; |
32 |
#ifdef NO_GARBAGE_COLLECTOR |
33 |
return po->_unVal.pRefCounted->_uiRef; |
34 |
#else |
35 |
@@ -170,7 +170,7 @@ SQUnsignedInteger sq_getrefcount(HSQUIRRELVM v,HSQOBJE |
36 |
|
37 |
SQBool sq_release(HSQUIRRELVM v,HSQOBJECT *po) |
38 |
{ |
39 |
- if(!ISREFCOUNTED(type(*po))) return SQTrue; |
40 |
+ if(!ISREFCOUNTED(sqtype(*po))) return SQTrue; |
41 |
#ifdef NO_GARBAGE_COLLECTOR |
42 |
bool ret = (po->_unVal.pRefCounted->_uiRef <= 1) ? SQTrue : SQFalse; |
43 |
__Release(po->_type,po->_unVal); |
44 |
@@ -182,7 +182,7 @@ SQBool sq_release(HSQUIRRELVM v,HSQOBJECT *po) |
45 |
|
46 |
SQUnsignedInteger sq_getvmrefcount(HSQUIRRELVM SQ_UNUSED_ARG(v), const HSQOBJECT *po) |
47 |
{ |
48 |
- if (!ISREFCOUNTED(type(*po))) return 0; |
49 |
+ if (!ISREFCOUNTED(sqtype(*po))) return 0; |
50 |
return po->_unVal.pRefCounted->_uiRef; |
51 |
} |
52 |
|
53 |
@@ -290,7 +290,7 @@ SQRESULT sq_newclass(HSQUIRRELVM v,SQBool hasbase) |
54 |
SQClass *baseclass = NULL; |
55 |
if(hasbase) { |
56 |
SQObjectPtr &base = stack_get(v,-1); |
57 |
- if(type(base) != OT_CLASS) |
58 |
+ if(sqtype(base) != OT_CLASS) |
59 |
return sq_throwerror(v,_SC("invalid base type")); |
60 |
baseclass = _class(base); |
61 |
} |
62 |
@@ -304,7 +304,7 @@ SQBool sq_instanceof(HSQUIRRELVM v) |
63 |
{ |
64 |
SQObjectPtr &inst = stack_get(v,-1); |
65 |
SQObjectPtr &cl = stack_get(v,-2); |
66 |
- if(type(inst) != OT_INSTANCE || type(cl) != OT_CLASS) |
67 |
+ if(sqtype(inst) != OT_INSTANCE || sqtype(cl) != OT_CLASS) |
68 |
return sq_throwerror(v,_SC("invalid param type")); |
69 |
return _instance(inst)->InstanceOf(_class(cl))?SQTrue:SQFalse; |
70 |
} |
71 |
@@ -397,14 +397,14 @@ void sq_newclosure(HSQUIRRELVM v,SQFUNCTION func,SQUns |
72 |
SQRESULT sq_getclosureinfo(HSQUIRRELVM v,SQInteger idx,SQUnsignedInteger *nparams,SQUnsignedInteger *nfreevars) |
73 |
{ |
74 |
SQObject o = stack_get(v, idx); |
75 |
- if(type(o) == OT_CLOSURE) { |
76 |
+ if(sqtype(o) == OT_CLOSURE) { |
77 |
SQClosure *c = _closure(o); |
78 |
SQFunctionProto *proto = c->_function; |
79 |
*nparams = (SQUnsignedInteger)proto->_nparameters; |
80 |
*nfreevars = (SQUnsignedInteger)proto->_noutervalues; |
81 |
return SQ_OK; |
82 |
} |
83 |
- else if(type(o) == OT_NATIVECLOSURE) |
84 |
+ else if(sqtype(o) == OT_NATIVECLOSURE) |
85 |
{ |
86 |
SQNativeClosure *c = _nativeclosure(o); |
87 |
*nparams = (SQUnsignedInteger)c->_nparamscheck; |
88 |
@@ -459,7 +459,7 @@ SQRESULT sq_bindenv(HSQUIRRELVM v,SQInteger idx) |
89 |
!sq_isclass(env) && |
90 |
!sq_isinstance(env)) |
91 |
return sq_throwerror(v,_SC("invalid environment")); |
92 |
- SQWeakRef *w = _refcounted(env)->GetWeakRef(type(env)); |
93 |
+ SQWeakRef *w = _refcounted(env)->GetWeakRef(sqtype(env)); |
94 |
SQObjectPtr ret; |
95 |
if(sq_isclosure(o)) { |
96 |
SQClosure *c = _closure(o)->Clone(); |
97 |
@@ -524,7 +524,7 @@ SQRESULT sq_getclosureroot(HSQUIRRELVM v,SQInteger idx |
98 |
SQRESULT sq_clear(HSQUIRRELVM v,SQInteger idx) |
99 |
{ |
100 |
SQObject &o=stack_get(v,idx); |
101 |
- switch(type(o)) { |
102 |
+ switch(sqtype(o)) { |
103 |
case OT_TABLE: _table(o)->Clear(); break; |
104 |
case OT_ARRAY: _array(o)->Resize(0); break; |
105 |
default: |
106 |
@@ -619,7 +619,7 @@ void sq_push(HSQUIRRELVM v,SQInteger idx) |
107 |
|
108 |
SQObjectType sq_gettype(HSQUIRRELVM v,SQInteger idx) |
109 |
{ |
110 |
- return type(stack_get(v, idx)); |
111 |
+ return sqtype(stack_get(v, idx)); |
112 |
} |
113 |
|
114 |
SQRESULT sq_typeof(HSQUIRRELVM v,SQInteger idx) |
115 |
@@ -710,7 +710,7 @@ SQRESULT sq_clone(HSQUIRRELVM v,SQInteger idx) |
116 |
SQInteger sq_getsize(HSQUIRRELVM v, SQInteger idx) |
117 |
{ |
118 |
SQObjectPtr &o = stack_get(v, idx); |
119 |
- SQObjectType type = type(o); |
120 |
+ SQObjectType type = sqtype(o); |
121 |
switch(type) { |
122 |
case OT_STRING: return _string(o)->_len; |
123 |
case OT_TABLE: return _table(o)->CountUsed(); |
124 |
@@ -741,7 +741,7 @@ SQRESULT sq_getuserdata(HSQUIRRELVM v,SQInteger idx,SQ |
125 |
SQRESULT sq_settypetag(HSQUIRRELVM v,SQInteger idx,SQUserPointer typetag) |
126 |
{ |
127 |
SQObjectPtr &o = stack_get(v,idx); |
128 |
- switch(type(o)) { |
129 |
+ switch(sqtype(o)) { |
130 |
case OT_USERDATA: _userdata(o)->_typetag = typetag; break; |
131 |
case OT_CLASS: _class(o)->_typetag = typetag; break; |
132 |
default: return sq_throwerror(v,_SC("invalid object type")); |
133 |
@@ -751,7 +751,7 @@ SQRESULT sq_settypetag(HSQUIRRELVM v,SQInteger idx,SQU |
134 |
|
135 |
SQRESULT sq_getobjtypetag(const HSQOBJECT *o,SQUserPointer * typetag) |
136 |
{ |
137 |
- switch(type(*o)) { |
138 |
+ switch(sqtype(*o)) { |
139 |
case OT_INSTANCE: *typetag = _instance(*o)->_class->_typetag; break; |
140 |
case OT_USERDATA: *typetag = _userdata(*o)->_typetag; break; |
141 |
case OT_CLASS: *typetag = _class(*o)->_typetag; break; |
142 |
@@ -779,7 +779,7 @@ SQRESULT sq_getuserpointer(HSQUIRRELVM v, SQInteger id |
143 |
SQRESULT sq_setinstanceup(HSQUIRRELVM v, SQInteger idx, SQUserPointer p) |
144 |
{ |
145 |
SQObjectPtr &o = stack_get(v,idx); |
146 |
- if(type(o) != OT_INSTANCE) return sq_throwerror(v,_SC("the object is not a class instance")); |
147 |
+ if(sqtype(o) != OT_INSTANCE) return sq_throwerror(v,_SC("the object is not a class instance")); |
148 |
_instance(o)->_userpointer = p; |
149 |
return SQ_OK; |
150 |
} |
151 |
@@ -787,7 +787,7 @@ SQRESULT sq_setinstanceup(HSQUIRRELVM v, SQInteger idx |
152 |
SQRESULT sq_setclassudsize(HSQUIRRELVM v, SQInteger idx, SQInteger udsize) |
153 |
{ |
154 |
SQObjectPtr &o = stack_get(v,idx); |
155 |
- if(type(o) != OT_CLASS) return sq_throwerror(v,_SC("the object is not a class")); |
156 |
+ if(sqtype(o) != OT_CLASS) return sq_throwerror(v,_SC("the object is not a class")); |
157 |
if(_class(o)->_locked) return sq_throwerror(v,_SC("the class is locked")); |
158 |
_class(o)->_udsize = udsize; |
159 |
return SQ_OK; |
160 |
@@ -797,7 +797,7 @@ SQRESULT sq_setclassudsize(HSQUIRRELVM v, SQInteger id |
161 |
SQRESULT sq_getinstanceup(HSQUIRRELVM v, SQInteger idx, SQUserPointer *p,SQUserPointer typetag) |
162 |
{ |
163 |
SQObjectPtr &o = stack_get(v,idx); |
164 |
- if(type(o) != OT_INSTANCE) return sq_throwerror(v,_SC("the object is not a class instance")); |
165 |
+ if(sqtype(o) != OT_INSTANCE) return sq_throwerror(v,_SC("the object is not a class instance")); |
166 |
(*p) = _instance(o)->_userpointer; |
167 |
if(typetag != 0) { |
168 |
SQClass *cl = _instance(o)->_class; |
169 |
@@ -854,9 +854,9 @@ SQRESULT sq_newslot(HSQUIRRELVM v, SQInteger idx, SQBo |
170 |
{ |
171 |
sq_aux_paramscheck(v, 3); |
172 |
SQObjectPtr &self = stack_get(v, idx); |
173 |
- if(type(self) == OT_TABLE || type(self) == OT_CLASS) { |
174 |
+ if(sqtype(self) == OT_TABLE || sqtype(self) == OT_CLASS) { |
175 |
SQObjectPtr &key = v->GetUp(-2); |
176 |
- if(type(key) == OT_NULL) return sq_throwerror(v, _SC("null is not a valid key")); |
177 |
+ if(sqtype(key) == OT_NULL) return sq_throwerror(v, _SC("null is not a valid key")); |
178 |
v->NewSlot(self, key, v->GetUp(-1),bstatic?true:false); |
179 |
v->Pop(2); |
180 |
} |
181 |
@@ -869,7 +869,7 @@ SQRESULT sq_deleteslot(HSQUIRRELVM v,SQInteger idx,SQB |
182 |
SQObjectPtr *self; |
183 |
_GETSAFE_OBJ(v, idx, OT_TABLE,self); |
184 |
SQObjectPtr &key = v->GetUp(-1); |
185 |
- if(type(key) == OT_NULL) return sq_throwerror(v, _SC("null is not a valid key")); |
186 |
+ if(sqtype(key) == OT_NULL) return sq_throwerror(v, _SC("null is not a valid key")); |
187 |
SQObjectPtr res; |
188 |
if(!v->DeleteSlot(*self, key, res)){ |
189 |
v->Pop(); |
190 |
@@ -894,11 +894,11 @@ SQRESULT sq_rawset(HSQUIRRELVM v,SQInteger idx) |
191 |
{ |
192 |
SQObjectPtr &self = stack_get(v, idx); |
193 |
SQObjectPtr &key = v->GetUp(-2); |
194 |
- if(type(key) == OT_NULL) { |
195 |
+ if(sqtype(key) == OT_NULL) { |
196 |
v->Pop(2); |
197 |
return sq_throwerror(v, _SC("null key")); |
198 |
} |
199 |
- switch(type(self)) { |
200 |
+ switch(sqtype(self)) { |
201 |
case OT_TABLE: |
202 |
_table(self)->NewSlot(key, v->GetUp(-1)); |
203 |
v->Pop(2); |
204 |
@@ -931,9 +931,9 @@ SQRESULT sq_rawset(HSQUIRRELVM v,SQInteger idx) |
205 |
SQRESULT sq_newmember(HSQUIRRELVM v,SQInteger idx,SQBool bstatic) |
206 |
{ |
207 |
SQObjectPtr &self = stack_get(v, idx); |
208 |
- if(type(self) != OT_CLASS) return sq_throwerror(v, _SC("new member only works with classes")); |
209 |
+ if(sqtype(self) != OT_CLASS) return sq_throwerror(v, _SC("new member only works with classes")); |
210 |
SQObjectPtr &key = v->GetUp(-3); |
211 |
- if(type(key) == OT_NULL) return sq_throwerror(v, _SC("null key")); |
212 |
+ if(sqtype(key) == OT_NULL) return sq_throwerror(v, _SC("null key")); |
213 |
if(!v->NewSlotA(self,key,v->GetUp(-2),v->GetUp(-1),bstatic?true:false,false)) |
214 |
return SQ_ERROR; |
215 |
return SQ_OK; |
216 |
@@ -942,9 +942,9 @@ SQRESULT sq_newmember(HSQUIRRELVM v,SQInteger idx,SQBo |
217 |
SQRESULT sq_rawnewmember(HSQUIRRELVM v,SQInteger idx,SQBool bstatic) |
218 |
{ |
219 |
SQObjectPtr &self = stack_get(v, idx); |
220 |
- if(type(self) != OT_CLASS) return sq_throwerror(v, _SC("new member only works with classes")); |
221 |
+ if(sqtype(self) != OT_CLASS) return sq_throwerror(v, _SC("new member only works with classes")); |
222 |
SQObjectPtr &key = v->GetUp(-3); |
223 |
- if(type(key) == OT_NULL) return sq_throwerror(v, _SC("null key")); |
224 |
+ if(sqtype(key) == OT_NULL) return sq_throwerror(v, _SC("null key")); |
225 |
if(!v->NewSlotA(self,key,v->GetUp(-2),v->GetUp(-1),bstatic?true:false,true)) |
226 |
return SQ_ERROR; |
227 |
return SQ_OK; |
228 |
@@ -954,19 +954,19 @@ SQRESULT sq_setdelegate(HSQUIRRELVM v,SQInteger idx) |
229 |
{ |
230 |
SQObjectPtr &self = stack_get(v, idx); |
231 |
SQObjectPtr &mt = v->GetUp(-1); |
232 |
- SQObjectType type = type(self); |
233 |
+ SQObjectType type = sqtype(self); |
234 |
switch(type) { |
235 |
case OT_TABLE: |
236 |
- if(type(mt) == OT_TABLE) { |
237 |
+ if(sqtype(mt) == OT_TABLE) { |
238 |
if(!_table(self)->SetDelegate(_table(mt))) return sq_throwerror(v, _SC("delagate cycle")); v->Pop();} |
239 |
- else if(type(mt)==OT_NULL) { |
240 |
+ else if(sqtype(mt)==OT_NULL) { |
241 |
_table(self)->SetDelegate(NULL); v->Pop(); } |
242 |
else return sq_aux_invalidtype(v,type); |
243 |
break; |
244 |
case OT_USERDATA: |
245 |
- if(type(mt)==OT_TABLE) { |
246 |
+ if(sqtype(mt)==OT_TABLE) { |
247 |
_userdata(self)->SetDelegate(_table(mt)); v->Pop(); } |
248 |
- else if(type(mt)==OT_NULL) { |
249 |
+ else if(sqtype(mt)==OT_NULL) { |
250 |
_userdata(self)->SetDelegate(NULL); v->Pop(); } |
251 |
else return sq_aux_invalidtype(v, type); |
252 |
break; |
253 |
@@ -997,7 +997,7 @@ SQRESULT sq_rawdeleteslot(HSQUIRRELVM v,SQInteger idx, |
254 |
SQRESULT sq_getdelegate(HSQUIRRELVM v,SQInteger idx) |
255 |
{ |
256 |
SQObjectPtr &self=stack_get(v,idx); |
257 |
- switch(type(self)){ |
258 |
+ switch(sqtype(self)){ |
259 |
case OT_TABLE: |
260 |
case OT_USERDATA: |
261 |
if(!_delegable(self)->_delegate){ |
262 |
@@ -1026,7 +1026,7 @@ SQRESULT sq_rawget(HSQUIRRELVM v,SQInteger idx) |
263 |
{ |
264 |
SQObjectPtr &self=stack_get(v,idx); |
265 |
SQObjectPtr &obj = v->GetUp(-1); |
266 |
- switch(type(self)) { |
267 |
+ switch(sqtype(self)) { |
268 |
case OT_TABLE: |
269 |
if(_table(self)->Get(obj,obj)) |
270 |
return SQ_OK; |
271 |
@@ -1076,7 +1076,7 @@ const SQChar *sq_getlocal(HSQUIRRELVM v,SQUnsignedInte |
272 |
stackbase-=ci._prevstkbase; |
273 |
} |
274 |
SQVM::CallInfo &ci=v->_callsstack[lvl]; |
275 |
- if(type(ci._closure)!=OT_CLOSURE) |
276 |
+ if(sqtype(ci._closure)!=OT_CLOSURE) |
277 |
return NULL; |
278 |
SQClosure *c=_closure(ci._closure); |
279 |
SQFunctionProto *func=c->_function; |
280 |
@@ -1137,7 +1137,7 @@ SQRESULT sq_reservestack(HSQUIRRELVM v,SQInteger nsize |
281 |
|
282 |
SQRESULT sq_resume(HSQUIRRELVM v,SQBool retval,SQBool raiseerror) |
283 |
{ |
284 |
- if (type(v->GetUp(-1)) == OT_GENERATOR) |
285 |
+ if (sqtype(v->GetUp(-1)) == OT_GENERATOR) |
286 |
{ |
287 |
v->PushNull(); //retval |
288 |
if (!v->Execute(v->GetUp(-2), 0, v->_top, v->GetUp(-1), raiseerror, SQVM::ET_RESUME_GENERATOR)) |
289 |
@@ -1201,7 +1201,7 @@ void sq_setreleasehook(HSQUIRRELVM v,SQInteger idx,SQR |
290 |
{ |
291 |
if(sq_gettop(v) >= 1){ |
292 |
SQObjectPtr &ud=stack_get(v,idx); |
293 |
- switch( type(ud) ) { |
294 |
+ switch( sqtype(ud) ) { |
295 |
case OT_USERDATA: _userdata(ud)->_hook = hook; break; |
296 |
case OT_INSTANCE: _instance(ud)->_hook = hook; break; |
297 |
case OT_CLASS: _class(ud)->_hook = hook; break; |
298 |
@@ -1214,7 +1214,7 @@ SQRELEASEHOOK sq_getreleasehook(HSQUIRRELVM v,SQIntege |
299 |
{ |
300 |
if(sq_gettop(v) >= 1){ |
301 |
SQObjectPtr &ud=stack_get(v,idx); |
302 |
- switch( type(ud) ) { |
303 |
+ switch( sqtype(ud) ) { |
304 |
case OT_USERDATA: return _userdata(ud)->_hook; break; |
305 |
case OT_INSTANCE: return _instance(ud)->_hook; break; |
306 |
case OT_CLASS: return _class(ud)->_hook; break; |
307 |
@@ -1296,7 +1296,7 @@ const SQChar *sq_getfreevariable(HSQUIRRELVM v,SQInteg |
308 |
{ |
309 |
SQObjectPtr &self=stack_get(v,idx); |
310 |
const SQChar *name = NULL; |
311 |
- switch(type(self)) |
312 |
+ switch(sqtype(self)) |
313 |
{ |
314 |
case OT_CLOSURE:{ |
315 |
SQClosure *clo = _closure(self); |
316 |
@@ -1324,7 +1324,7 @@ const SQChar *sq_getfreevariable(HSQUIRRELVM v,SQInteg |
317 |
SQRESULT sq_setfreevariable(HSQUIRRELVM v,SQInteger idx,SQUnsignedInteger nval) |
318 |
{ |
319 |
SQObjectPtr &self=stack_get(v,idx); |
320 |
- switch(type(self)) |
321 |
+ switch(sqtype(self)) |
322 |
{ |
323 |
case OT_CLOSURE:{ |
324 |
SQFunctionProto *fp = _closure(self)->_function; |
325 |
@@ -1341,7 +1341,7 @@ SQRESULT sq_setfreevariable(HSQUIRRELVM v,SQInteger id |
326 |
else return sq_throwerror(v,_SC("invalid free var index")); |
327 |
break; |
328 |
default: |
329 |
- return sq_aux_invalidtype(v,type(self)); |
330 |
+ return sq_aux_invalidtype(v, sqtype(self)); |
331 |
} |
332 |
v->Pop(); |
333 |
return SQ_OK; |
334 |
@@ -1354,7 +1354,7 @@ SQRESULT sq_setattributes(HSQUIRRELVM v,SQInteger idx) |
335 |
SQObjectPtr &key = stack_get(v,-2); |
336 |
SQObjectPtr &val = stack_get(v,-1); |
337 |
SQObjectPtr attrs; |
338 |
- if(type(key) == OT_NULL) { |
339 |
+ if(sqtype(key) == OT_NULL) { |
340 |
attrs = _class(*o)->_attributes; |
341 |
_class(*o)->_attributes = val; |
342 |
v->Pop(2); |
343 |
@@ -1375,7 +1375,7 @@ SQRESULT sq_getattributes(HSQUIRRELVM v,SQInteger idx) |
344 |
_GETSAFE_OBJ(v, idx, OT_CLASS,o); |
345 |
SQObjectPtr &key = stack_get(v,-1); |
346 |
SQObjectPtr attrs; |
347 |
- if(type(key) == OT_NULL) { |
348 |
+ if(sqtype(key) == OT_NULL) { |
349 |
attrs = _class(*o)->_attributes; |
350 |
v->Pop(); |
351 |
v->Push(attrs); |
352 |
@@ -1407,7 +1407,7 @@ SQRESULT sq_getmemberhandle(HSQUIRRELVM v,SQInteger id |
353 |
|
354 |
SQRESULT _getmemberbyhandle(HSQUIRRELVM v,SQObjectPtr &self,const HSQMEMBERHANDLE *handle,SQObjectPtr *&val) |
355 |
{ |
356 |
- switch(type(self)) { |
357 |
+ switch(sqtype(self)) { |
358 |
case OT_INSTANCE: { |
359 |
SQInstance *i = _instance(self); |
360 |
if(handle->_static) { |
361 |
@@ -1490,8 +1490,8 @@ SQRESULT sq_createinstance(HSQUIRRELVM v,SQInteger idx |
362 |
void sq_weakref(HSQUIRRELVM v,SQInteger idx) |
363 |
{ |
364 |
SQObject &o=stack_get(v,idx); |
365 |
- if(ISREFCOUNTED(type(o))) { |
366 |
- v->Push(_refcounted(o)->GetWeakRef(type(o))); |
367 |
+ if(ISREFCOUNTED(sqtype(o))) { |
368 |
+ v->Push(_refcounted(o)->GetWeakRef(sqtype(o))); |
369 |
return; |
370 |
} |
371 |
v->Push(o); |
372 |
@@ -1500,7 +1500,7 @@ void sq_weakref(HSQUIRRELVM v,SQInteger idx) |
373 |
SQRESULT sq_getweakrefval(HSQUIRRELVM v,SQInteger idx) |
374 |
{ |
375 |
SQObjectPtr &o = stack_get(v,idx); |
376 |
- if(type(o) != OT_WEAKREF) { |
377 |
+ if(sqtype(o) != OT_WEAKREF) { |
378 |
return sq_throwerror(v,_SC("the object must be a weakref")); |
379 |
} |
380 |
v->Push(_weakref(o)->_obj); |
381 |
@@ -1529,7 +1529,7 @@ SQRESULT sq_getdefaultdelegate(HSQUIRRELVM v,SQObjectT |
382 |
SQRESULT sq_next(HSQUIRRELVM v,SQInteger idx) |
383 |
{ |
384 |
SQObjectPtr o=stack_get(v,idx),&refpos = stack_get(v,-1),realkey,val; |
385 |
- if(type(o) == OT_GENERATOR) { |
386 |
+ if(sqtype(o) == OT_GENERATOR) { |
387 |
return sq_throwerror(v,_SC("cannot iterate a generator")); |
388 |
} |
389 |
int faketojump; |
390 |
--- squirrel/sqbaselib.cpp.orig 2017-08-31 12:07:29 UTC |
391 |
+++ squirrel/sqbaselib.cpp |
392 |
@@ -169,7 +169,7 @@ static SQInteger get_slice_params(HSQUIRRELVM v,SQInte |
393 |
o=stack_get(v,1); |
394 |
if(top>1){ |
395 |
SQObjectPtr &start=stack_get(v,2); |
396 |
- if(type(start)!=OT_NULL && sq_isnumeric(start)){ |
397 |
+ if(sqtype(start)!=OT_NULL && sq_isnumeric(start)){ |
398 |
sidx=tointeger(start); |
399 |
} |
400 |
} |
401 |
@@ -340,7 +340,7 @@ static SQInteger default_delegate_len(HSQUIRRELVM v) |
402 |
static SQInteger default_delegate_tofloat(HSQUIRRELVM v) |
403 |
{ |
404 |
SQObjectPtr &o=stack_get(v,1); |
405 |
- switch(type(o)){ |
406 |
+ switch(sqtype(o)){ |
407 |
case OT_STRING:{ |
408 |
SQObjectPtr res; |
409 |
if(str2num(_stringval(o),res,10)){ |
410 |
@@ -369,7 +369,7 @@ static SQInteger default_delegate_tointeger(HSQUIRRELV |
411 |
if(sq_gettop(v) > 1) { |
412 |
sq_getinteger(v,2,&base); |
413 |
} |
414 |
- switch(type(o)){ |
415 |
+ switch(sqtype(o)){ |
416 |
case OT_STRING:{ |
417 |
SQObjectPtr res; |
418 |
if(str2num(_stringval(o),res,base)){ |
419 |
@@ -931,7 +931,7 @@ static SQInteger closure_setroot(HSQUIRRELVM v) |
420 |
static SQInteger closure_getinfos(HSQUIRRELVM v) { |
421 |
SQObject o = stack_get(v,1); |
422 |
SQTable *res = SQTable::Create(_ss(v),4); |
423 |
- if(type(o) == OT_CLOSURE) { |
424 |
+ if(sqtype(o) == OT_CLOSURE) { |
425 |
SQFunctionProto *f = _closure(o)->_function; |
426 |
SQInteger nparams = f->_nparameters + (f->_varparams?1:0); |
427 |
SQObjectPtr params = SQArray::Create(_ss(v),nparams); |
428 |
@@ -1010,7 +1010,7 @@ const SQRegFunction SQSharedState::_generator_default_ |
429 |
static SQInteger thread_call(HSQUIRRELVM v) |
430 |
{ |
431 |
SQObjectPtr o = stack_get(v,1); |
432 |
- if(type(o) == OT_THREAD) { |
433 |
+ if(sqtype(o) == OT_THREAD) { |
434 |
SQInteger nparams = sq_gettop(v); |
435 |
_thread(o)->Push(_thread(o)->_roottable); |
436 |
for(SQInteger i = 2; i<(nparams+1); i++) |
437 |
@@ -1029,7 +1029,7 @@ static SQInteger thread_call(HSQUIRRELVM v) |
438 |
static SQInteger thread_wakeup(HSQUIRRELVM v) |
439 |
{ |
440 |
SQObjectPtr o = stack_get(v,1); |
441 |
- if(type(o) == OT_THREAD) { |
442 |
+ if(sqtype(o) == OT_THREAD) { |
443 |
SQVM *thread = _thread(o); |
444 |
SQInteger state = sq_getvmstate(thread); |
445 |
if(state != SQ_VMSTATE_SUSPENDED) { |
446 |
@@ -1065,7 +1065,7 @@ static SQInteger thread_wakeup(HSQUIRRELVM v) |
447 |
static SQInteger thread_wakeupthrow(HSQUIRRELVM v) |
448 |
{ |
449 |
SQObjectPtr o = stack_get(v,1); |
450 |
- if(type(o) == OT_THREAD) { |
451 |
+ if(sqtype(o) == OT_THREAD) { |
452 |
SQVM *thread = _thread(o); |
453 |
SQInteger state = sq_getvmstate(thread); |
454 |
if(state != SQ_VMSTATE_SUSPENDED) { |
455 |
@@ -1125,7 +1125,7 @@ static SQInteger thread_getstatus(HSQUIRRELVM v) |
456 |
static SQInteger thread_getstackinfos(HSQUIRRELVM v) |
457 |
{ |
458 |
SQObjectPtr o = stack_get(v,1); |
459 |
- if(type(o) == OT_THREAD) { |
460 |
+ if(sqtype(o) == OT_THREAD) { |
461 |
SQVM *thread = _thread(o); |
462 |
SQInteger threadtop = sq_gettop(thread); |
463 |
SQInteger level; |
464 |
@@ -1134,7 +1134,7 @@ static SQInteger thread_getstackinfos(HSQUIRRELVM v) |
465 |
if(SQ_FAILED(res)) |
466 |
{ |
467 |
sq_settop(thread,threadtop); |
468 |
- if(type(thread->_lasterror) == OT_STRING) { |
469 |
+ if(sqtype(thread->_lasterror) == OT_STRING) { |
470 |
sq_throwerror(v,_stringval(thread->_lasterror)); |
471 |
} |
472 |
else { |
473 |
--- squirrel/sqclass.cpp.orig 2017-08-31 12:07:29 UTC |
474 |
+++ squirrel/sqclass.cpp |
475 |
@@ -53,7 +53,7 @@ SQClass::~SQClass() |
476 |
bool SQClass::NewSlot(SQSharedState *ss,const SQObjectPtr &key,const SQObjectPtr &val,bool bstatic) |
477 |
{ |
478 |
SQObjectPtr temp; |
479 |
- bool belongs_to_static_table = type(val) == OT_CLOSURE || type(val) == OT_NATIVECLOSURE || bstatic; |
480 |
+ bool belongs_to_static_table = sqtype(val) == OT_CLOSURE || sqtype(val) == OT_NATIVECLOSURE || bstatic; |
481 |
if(_locked && !belongs_to_static_table) |
482 |
return false; //the class already has an instance so cannot be modified |
483 |
if(_members->Get(key,temp) && _isfield(temp)) //overrides the default value |
484 |
@@ -63,18 +63,18 @@ bool SQClass::NewSlot(SQSharedState *ss,const SQObject |
485 |
} |
486 |
if(belongs_to_static_table) { |
487 |
SQInteger mmidx; |
488 |
- if((type(val) == OT_CLOSURE || type(val) == OT_NATIVECLOSURE) && |
489 |
+ if((sqtype(val) == OT_CLOSURE || sqtype(val) == OT_NATIVECLOSURE) && |
490 |
(mmidx = ss->GetMetaMethodIdxByName(key)) != -1) { |
491 |
_metamethods[mmidx] = val; |
492 |
} |
493 |
else { |
494 |
SQObjectPtr theval = val; |
495 |
- if(_base && type(val) == OT_CLOSURE) { |
496 |
+ if(_base && sqtype(val) == OT_CLOSURE) { |
497 |
theval = _closure(val)->Clone(); |
498 |
_closure(theval)->_base = _base; |
499 |
__ObjAddRef(_base); //ref for the closure |
500 |
} |
501 |
- if(type(temp) == OT_NULL) { |
502 |
+ if(sqtype(temp) == OT_NULL) { |
503 |
bool isconstructor; |
504 |
SQVM::IsEqual(ss->_constructoridx, key, isconstructor); |
505 |
if(isconstructor) { |
506 |
@@ -191,7 +191,7 @@ SQInstance::~SQInstance() |
507 |
|
508 |
bool SQInstance::GetMetaMethod(SQVM SQ_UNUSED_ARG(*v),SQMetaMethod mm,SQObjectPtr &res) |
509 |
{ |
510 |
- if(type(_class->_metamethods[mm]) != OT_NULL) { |
511 |
+ if(sqtype(_class->_metamethods[mm]) != OT_NULL) { |
512 |
res = _class->_metamethods[mm]; |
513 |
return true; |
514 |
} |
515 |
--- squirrel/sqcompiler.cpp.orig 2017-08-31 12:07:29 UTC |
516 |
+++ squirrel/sqcompiler.cpp |
517 |
@@ -191,7 +191,7 @@ class SQCompiler (public) |
518 |
} |
519 |
else { |
520 |
if(_raiseerror && _ss(_vm)->_compilererrorhandler) { |
521 |
- _ss(_vm)->_compilererrorhandler(_vm, _compilererror, type(_sourcename) == OT_STRING?_stringval(_sourcename):_SC("unknown"), |
522 |
+ _ss(_vm)->_compilererrorhandler(_vm, _compilererror, sqtype(_sourcename) == OT_STRING?_stringval(_sourcename):_SC("unknown"), |
523 |
_lex._currentline, _lex._currentcolumn); |
524 |
} |
525 |
_vm->_lasterror = SQString::Create(_ss(_vm), _compilererror, -1); |
526 |
@@ -762,7 +762,7 @@ class SQCompiler (public) |
527 |
/* Handle named constant */ |
528 |
SQObjectPtr constval; |
529 |
SQObject constid; |
530 |
- if(type(constant) == OT_TABLE) { |
531 |
+ if(sqtype(constant) == OT_TABLE) { |
532 |
Expect('.'); |
533 |
constid = Expect(TK_IDENTIFIER); |
534 |
if(!_table(constant)->Get(constid, constval)) { |
535 |
@@ -776,7 +776,7 @@ class SQCompiler (public) |
536 |
_es.epos = _fs->PushTarget(); |
537 |
|
538 |
/* generate direct or literal function depending on size */ |
539 |
- SQObjectType ctype = type(constval); |
540 |
+ SQObjectType ctype = sqtype(constval); |
541 |
switch(ctype) { |
542 |
case OT_INTEGER: EmitLoadConstInt(_integer(constval),_es.epos); break; |
543 |
case OT_FLOAT: EmitLoadConstFloat(_float(constval),_es.epos); break; |
544 |
--- squirrel/sqdebug.cpp.orig 2017-08-31 12:07:29 UTC |
545 |
+++ squirrel/sqdebug.cpp |
546 |
@@ -17,8 +17,8 @@ SQRESULT sq_getfunctioninfo(HSQUIRRELVM v,SQInteger le |
547 |
SQClosure *c = _closure(ci._closure); |
548 |
SQFunctionProto *proto = c->_function; |
549 |
fi->funcid = proto; |
550 |
- fi->name = type(proto->_name) == OT_STRING?_stringval(proto->_name):_SC("unknown"); |
551 |
- fi->source = type(proto->_sourcename) == OT_STRING?_stringval(proto->_sourcename):_SC("unknown"); |
552 |
+ fi->name = sqtype(proto->_name) == OT_STRING?_stringval(proto->_name):_SC("unknown"); |
553 |
+ fi->source = sqtype(proto->_sourcename) == OT_STRING?_stringval(proto->_sourcename):_SC("unknown"); |
554 |
fi->line = proto->_lineinfos[0]._line; |
555 |
return SQ_OK; |
556 |
} |
557 |
@@ -32,12 +32,12 @@ SQRESULT sq_stackinfos(HSQUIRRELVM v, SQInteger level, |
558 |
if (cssize > level) { |
559 |
memset(si, 0, sizeof(SQStackInfos)); |
560 |
SQVM::CallInfo &ci = v->_callsstack[cssize-level-1]; |
561 |
- switch (type(ci._closure)) { |
562 |
+ switch (sqtype(ci._closure)) { |
563 |
case OT_CLOSURE:{ |
564 |
SQFunctionProto *func = _closure(ci._closure)->_function; |
565 |
- if (type(func->_name) == OT_STRING) |
566 |
+ if (sqtype(func->_name) == OT_STRING) |
567 |
si->funcname = _stringval(func->_name); |
568 |
- if (type(func->_sourcename) == OT_STRING) |
569 |
+ if (sqtype(func->_sourcename) == OT_STRING) |
570 |
si->source = _stringval(func->_sourcename); |
571 |
si->line = func->GetLine(ci._ip); |
572 |
} |
573 |
@@ -45,7 +45,7 @@ SQRESULT sq_stackinfos(HSQUIRRELVM v, SQInteger level, |
574 |
case OT_NATIVECLOSURE: |
575 |
si->source = _SC("NATIVE"); |
576 |
si->funcname = _SC("unknown"); |
577 |
- if(type(_nativeclosure(ci._closure)->_name) == OT_STRING) |
578 |
+ if(sqtype(_nativeclosure(ci._closure)->_name) == OT_STRING) |
579 |
si->funcname = _stringval(_nativeclosure(ci._closure)->_name); |
580 |
si->line = -1; |
581 |
break; |
582 |
@@ -73,7 +73,7 @@ void SQVM::Raise_Error(const SQObjectPtr &desc) |
583 |
|
584 |
SQString *SQVM::PrintObjVal(const SQObjectPtr &o) |
585 |
{ |
586 |
- switch(type(o)) { |
587 |
+ switch(sqtype(o)) { |
588 |
case OT_STRING: return _string(o); |
589 |
case OT_INTEGER: |
590 |
scsprintf(_sp(sq_rsl(NUMBER_MAX_CHAR+1)),sq_rsl(NUMBER_MAX_CHAR), _PRINT_INT_FMT, _integer(o)); |
591 |
--- squirrel/sqfuncstate.cpp.orig 2017-08-31 12:07:29 UTC |
592 |
+++ squirrel/sqfuncstate.cpp |
593 |
@@ -77,7 +77,7 @@ SQInstructionDesc g_InstrDesc[]={ |
594 |
#endif |
595 |
void DumpLiteral(SQObjectPtr &o) |
596 |
{ |
597 |
- switch(type(o)){ |
598 |
+ switch(sqtype(o)){ |
599 |
case OT_STRING: scprintf(_SC("\"%s\""),_stringval(o));break; |
600 |
case OT_FLOAT: scprintf(_SC("{%f}"),_float(o));break; |
601 |
case OT_INTEGER: scprintf(_SC("{") _PRINT_INT_FMT _SC("}"),_integer(o));break; |
602 |
@@ -290,7 +290,7 @@ SQInteger SQFuncState::PopTarget() |
603 |
SQUnsignedInteger npos=_targetstack.back(); |
604 |
assert(npos < _vlocals.size()); |
605 |
SQLocalVarInfo &t = _vlocals[npos]; |
606 |
- if(type(t._name)==OT_NULL){ |
607 |
+ if(sqtype(t._name)==OT_NULL){ |
608 |
_vlocals.pop_back(); |
609 |
} |
610 |
_targetstack.pop_back(); |
611 |
@@ -322,7 +322,7 @@ void SQFuncState::SetStackSize(SQInteger n) |
612 |
while(size>n){ |
613 |
size--; |
614 |
SQLocalVarInfo lvi = _vlocals.back(); |
615 |
- if(type(lvi._name)!=OT_NULL){ |
616 |
+ if(sqtype(lvi._name)!=OT_NULL){ |
617 |
if(lvi._end_op == UINT_MINUS_ONE) { //this means is an outer |
618 |
_outers--; |
619 |
} |
620 |
@@ -346,7 +346,7 @@ bool SQFuncState::IsConstant(const SQObject &name,SQOb |
621 |
bool SQFuncState::IsLocal(SQUnsignedInteger stkpos) |
622 |
{ |
623 |
if(stkpos>=_vlocals.size())return false; |
624 |
- else if(type(_vlocals[stkpos]._name)!=OT_NULL)return true; |
625 |
+ else if(sqtype(_vlocals[stkpos]._name)!=OT_NULL)return true; |
626 |
return false; |
627 |
} |
628 |
|
629 |
@@ -369,7 +369,7 @@ SQInteger SQFuncState::GetLocalVariable(const SQObject |
630 |
SQInteger locals=_vlocals.size(); |
631 |
while(locals>=1){ |
632 |
SQLocalVarInfo &lvi = _vlocals[locals-1]; |
633 |
- if(type(lvi._name)==OT_STRING && _string(lvi._name)==_string(name)){ |
634 |
+ if(sqtype(lvi._name)==OT_STRING && _string(lvi._name)==_string(name)){ |
635 |
return locals-1; |
636 |
} |
637 |
locals--; |
638 |
--- squirrel/sqobject.cpp.orig 2017-08-31 12:07:29 UTC |
639 |
+++ squirrel/sqobject.cpp |
640 |
@@ -43,7 +43,7 @@ const SQChar *IdType2Name(SQObjectType type) |
641 |
|
642 |
const SQChar *GetTypeName(const SQObjectPtr &obj1) |
643 |
{ |
644 |
- return IdType2Name(type(obj1)); |
645 |
+ return IdType2Name(sqtype(obj1)); |
646 |
} |
647 |
|
648 |
SQString *SQString::Create(SQSharedState *ss,const SQChar *s,SQInteger len) |
649 |
@@ -72,7 +72,7 @@ SQInteger SQString::Next(const SQObjectPtr &refpos, SQ |
650 |
|
651 |
SQUnsignedInteger TranslateIndex(const SQObjectPtr &idx) |
652 |
{ |
653 |
- switch(type(idx)){ |
654 |
+ switch(sqtype(idx)){ |
655 |
case OT_NULL: |
656 |
return 0; |
657 |
case OT_INTEGER: |
658 |
@@ -139,7 +139,7 @@ bool SQGenerator::Yield(SQVM *v,SQInteger target) |
659 |
|
660 |
_stack.resize(size); |
661 |
SQObject _this = v->_stack[v->_stackbase]; |
662 |
- _stack._vals[0] = ISREFCOUNTED(type(_this)) ? SQObjectPtr(_refcounted(_this)->GetWeakRef(type(_this))) : _this; |
663 |
+ _stack._vals[0] = ISREFCOUNTED(sqtype(_this)) ? SQObjectPtr(_refcounted(_this)->GetWeakRef(sqtype(_this))) : _this; |
664 |
for(SQInteger n =1; n<target; n++) { |
665 |
_stack._vals[n] = v->_stack[v->_stackbase+n]; |
666 |
} |
667 |
@@ -191,7 +191,7 @@ bool SQGenerator::Resume(SQVM *v,SQObjectPtr &dest) |
668 |
et._stacksize += newbase; |
669 |
} |
670 |
SQObject _this = _stack._vals[0]; |
671 |
- v->_stack[v->_stackbase] = type(_this) == OT_WEAKREF ? _weakref(_this)->_obj : _this; |
672 |
+ v->_stack[v->_stackbase] = sqtype(_this) == OT_WEAKREF ? _weakref(_this)->_obj : _this; |
673 |
|
674 |
for(SQInteger n = 1; n<size; n++) { |
675 |
v->_stack[v->_stackbase+n] = _stack._vals[n]; |
676 |
@@ -312,9 +312,9 @@ bool CheckTag(HSQUIRRELVM v,SQWRITEFUNC read,SQUserPoi |
677 |
|
678 |
bool WriteObject(HSQUIRRELVM v,SQUserPointer up,SQWRITEFUNC write,SQObjectPtr &o) |
679 |
{ |
680 |
- SQUnsignedInteger32 _type = (SQUnsignedInteger32)type(o); |
681 |
+ SQUnsignedInteger32 _type = (SQUnsignedInteger32)sqtype(o); |
682 |
_CHECK_IO(SafeWrite(v,write,up,&_type,sizeof(_type))); |
683 |
- switch(type(o)){ |
684 |
+ switch(sqtype(o)){ |
685 |
case OT_STRING: |
686 |
_CHECK_IO(SafeWrite(v,write,up,&_string(o)->_len,sizeof(SQInteger))); |
687 |
_CHECK_IO(SafeWrite(v,write,up,_stringval(o),sq_rsl(_string(o)->_len))); |
688 |
--- squirrel/sqobject.h.orig 2017-08-31 12:07:29 UTC |
689 |
+++ squirrel/sqobject.h |
690 |
@@ -101,7 +101,7 @@ struct SQWeakRef : SQRefCounted |
691 |
SQObject _obj; |
692 |
}; |
693 |
|
694 |
-#define _realval(o) (type((o)) != OT_WEAKREF?(SQObject)o:_weakref(o)->_obj) |
695 |
+#define _realval(o) (sqtype((o)) != OT_WEAKREF?(SQObject)o:_weakref(o)->_obj) |
696 |
|
697 |
struct SQObjectPtr; |
698 |
|
699 |
@@ -128,8 +128,8 @@ struct SQObjectPtr; |
700 |
(obj)->_uiRef++; \ |
701 |
} |
702 |
|
703 |
-#define type(obj) ((obj)._type) |
704 |
-#define is_delegable(t) (type(t)&SQOBJECT_DELEGABLE) |
705 |
+#define sqtype(obj) ((obj)._type) |
706 |
+#define is_delegable(t) (sqtype(t)&SQOBJECT_DELEGABLE) |
707 |
#define raw_type(obj) _RAW_TYPE((obj)._type) |
708 |
|
709 |
#define _integer(obj) ((obj)._unVal.nInteger) |
710 |
@@ -155,8 +155,8 @@ struct SQObjectPtr; |
711 |
#define _stringval(obj) (obj)._unVal.pString->_val |
712 |
#define _userdataval(obj) ((SQUserPointer)sq_aligning((obj)._unVal.pUserData + 1)) |
713 |
|
714 |
-#define tofloat(num) ((type(num)==OT_INTEGER)?(SQFloat)_integer(num):_float(num)) |
715 |
-#define tointeger(num) ((type(num)==OT_FLOAT)?(SQInteger)_float(num):_integer(num)) |
716 |
+#define tofloat(num) ((sqtype(num)==OT_INTEGER)?(SQFloat)_integer(num):_float(num)) |
717 |
+#define tointeger(num) ((sqtype(num)==OT_FLOAT)?(SQInteger)_float(num):_integer(num)) |
718 |
///////////////////////////////////////////////////////////////////////////////////// |
719 |
///////////////////////////////////////////////////////////////////////////////////// |
720 |
#if defined(SQUSEDOUBLE) && !defined(_SQ64) || !defined(SQUSEDOUBLE) && defined(_SQ64) |
721 |
--- squirrel/sqstate.cpp.orig 2017-08-31 12:07:29 UTC |
722 |
+++ squirrel/sqstate.cpp |
723 |
@@ -221,7 +221,7 @@ SQSharedState::~SQSharedState() |
724 |
|
725 |
SQInteger SQSharedState::GetMetaMethodIdxByName(const SQObjectPtr &name) |
726 |
{ |
727 |
- if(type(name) != OT_STRING) |
728 |
+ if(sqtype(name) != OT_STRING) |
729 |
return -1; |
730 |
SQObjectPtr ret; |
731 |
if(_table(_metamethodsmap)->Get(name,ret)) { |
732 |
@@ -234,7 +234,7 @@ SQInteger SQSharedState::GetMetaMethodIdxByName(const |
733 |
|
734 |
void SQSharedState::MarkObject(SQObjectPtr &o,SQCollectable **chain) |
735 |
{ |
736 |
- switch(type(o)){ |
737 |
+ switch(sqtype(o)){ |
738 |
case OT_TABLE:_table(o)->Mark(chain);break; |
739 |
case OT_ARRAY:_array(o)->Mark(chain);break; |
740 |
case OT_USERDATA:_userdata(o)->Mark(chain);break; |
741 |
@@ -423,7 +423,7 @@ void RefTable::Mark(SQCollectable **chain) |
742 |
{ |
743 |
RefNode *nodes = (RefNode *)_nodes; |
744 |
for(SQUnsignedInteger n = 0; n < _numofslots; n++) { |
745 |
- if(type(nodes->obj) != OT_NULL) { |
746 |
+ if(sqtype(nodes->obj) != OT_NULL) { |
747 |
SQSharedState::MarkObject(nodes->obj,chain); |
748 |
} |
749 |
nodes++; |
750 |
@@ -485,7 +485,7 @@ void RefTable::Resize(SQUnsignedInteger size) |
751 |
//rehash |
752 |
SQUnsignedInteger nfound = 0; |
753 |
for(SQUnsignedInteger n = 0; n < oldnumofslots; n++) { |
754 |
- if(type(t->obj) != OT_NULL) { |
755 |
+ if(sqtype(t->obj) != OT_NULL) { |
756 |
//add back; |
757 |
assert(t->refs != 0); |
758 |
RefNode *nn = Add(::HashObj(t->obj)&(_numofslots-1),t->obj); |
759 |
@@ -518,7 +518,7 @@ RefTable::RefNode *RefTable::Get(SQObject &obj,SQHash |
760 |
mainpos = ::HashObj(obj)&(_numofslots-1); |
761 |
*prev = NULL; |
762 |
for (ref = _buckets[mainpos]; ref; ) { |
763 |
- if(_rawval(ref->obj) == _rawval(obj) && type(ref->obj) == type(obj)) |
764 |
+ if(_rawval(ref->obj) == _rawval(obj) && sqtype(ref->obj) == sqtype(obj)) |
765 |
break; |
766 |
*prev = ref; |
767 |
ref = ref->next; |
768 |
--- squirrel/sqtable.cpp.orig 2017-08-31 12:07:29 UTC |
769 |
+++ squirrel/sqtable.cpp |
770 |
@@ -62,7 +62,7 @@ void SQTable::Rehash(bool force) |
771 |
_usednodes = 0; |
772 |
for (SQInteger i=0; i<oldsize; i++) { |
773 |
_HashNode *old = nold+i; |
774 |
- if (type(old->key) != OT_NULL) |
775 |
+ if (sqtype(old->key) != OT_NULL) |
776 |
NewSlot(old->key,old->val); |
777 |
} |
778 |
for(SQInteger k=0;k<oldsize;k++) |
779 |
@@ -107,7 +107,7 @@ SQTable *SQTable::Clone() |
780 |
|
781 |
bool SQTable::Get(const SQObjectPtr &key,SQObjectPtr &val) |
782 |
{ |
783 |
- if(type(key) == OT_NULL) |
784 |
+ if(sqtype(key) == OT_NULL) |
785 |
return false; |
786 |
_HashNode *n = _Get(key, HashObj(key) & (_numofnodes - 1)); |
787 |
if (n) { |
788 |
@@ -118,7 +118,7 @@ bool SQTable::Get(const SQObjectPtr &key,SQObjectPtr & |
789 |
} |
790 |
bool SQTable::NewSlot(const SQObjectPtr &key,const SQObjectPtr &val) |
791 |
{ |
792 |
- assert(type(key) != OT_NULL); |
793 |
+ assert(sqtype(key) != OT_NULL); |
794 |
SQHash h = HashObj(key) & (_numofnodes - 1); |
795 |
_HashNode *n = _Get(key, h); |
796 |
if (n) { |
797 |
@@ -132,7 +132,7 @@ bool SQTable::NewSlot(const SQObjectPtr &key,const SQO |
798 |
//key not found I'll insert it |
799 |
//main pos is not free |
800 |
|
801 |
- if(type(mp->key) != OT_NULL) { |
802 |
+ if(sqtype(mp->key) != OT_NULL) { |
803 |
n = _firstfree; /* get a free place */ |
804 |
SQHash mph = HashObj(mp->key) & (_numofnodes - 1); |
805 |
_HashNode *othern; /* main position of colliding node */ |
806 |
@@ -161,7 +161,7 @@ bool SQTable::NewSlot(const SQObjectPtr &key,const SQO |
807 |
mp->key = key; |
808 |
|
809 |
for (;;) { /* correct `firstfree' */ |
810 |
- if (type(_firstfree->key) == OT_NULL && _firstfree->next == NULL) { |
811 |
+ if (sqtype(_firstfree->key) == OT_NULL && _firstfree->next == NULL) { |
812 |
mp->val = val; |
813 |
_usednodes++; |
814 |
return true; /* OK; table still has a free place */ |
815 |
@@ -177,7 +177,7 @@ SQInteger SQTable::Next(bool getweakrefs,const SQObjec |
816 |
{ |
817 |
SQInteger idx = (SQInteger)TranslateIndex(refpos); |
818 |
while (idx < _numofnodes) { |
819 |
- if(type(_nodes[idx].key) != OT_NULL) { |
820 |
+ if(sqtype(_nodes[idx].key) != OT_NULL) { |
821 |
//first found |
822 |
_HashNode &n = _nodes[idx]; |
823 |
outkey = n.key; |
824 |
--- squirrel/sqtable.h.orig 2017-08-31 12:07:29 UTC |
825 |
+++ squirrel/sqtable.h |
826 |
@@ -14,7 +14,7 @@ |
827 |
|
828 |
inline SQHash HashObj(const SQObjectPtr &key) |
829 |
{ |
830 |
- switch(type(key)) { |
831 |
+ switch(sqtype(key)) { |
832 |
case OT_STRING: return _string(key)->_hash; |
833 |
case OT_FLOAT: return (SQHash)((SQInteger)_float(key)); |
834 |
case OT_BOOL: case OT_INTEGER: return (SQHash)((SQInteger)_integer(key)); |
835 |
@@ -67,7 +67,7 @@ struct SQTable : public SQDelegable (public) |
836 |
{ |
837 |
_HashNode *n = &_nodes[hash]; |
838 |
do{ |
839 |
- if(_rawval(n->key) == _rawval(key) && type(n->key) == type(key)){ |
840 |
+ if(_rawval(n->key) == _rawval(key) && sqtype(n->key) == sqtype(key)){ |
841 |
return n; |
842 |
} |
843 |
}while((n = n->next)); |
844 |
@@ -80,7 +80,7 @@ struct SQTable : public SQDelegable (public) |
845 |
_HashNode *n = &_nodes[hash & (_numofnodes - 1)]; |
846 |
_HashNode *res = NULL; |
847 |
do{ |
848 |
- if(type(n->key) == OT_STRING && (scstrcmp(_stringval(n->key),key) == 0)){ |
849 |
+ if(sqtype(n->key) == OT_STRING && (scstrcmp(_stringval(n->key),key) == 0)){ |
850 |
res = n; |
851 |
break; |
852 |
} |
853 |
--- squirrel/sqvm.cpp.orig 2017-08-31 12:07:29 UTC |
854 |
+++ squirrel/sqvm.cpp |
855 |
@@ -19,7 +19,7 @@ |
856 |
bool SQVM::BW_OP(SQUnsignedInteger op,SQObjectPtr &trg,const SQObjectPtr &o1,const SQObjectPtr &o2) |
857 |
{ |
858 |
SQInteger res; |
859 |
- if((type(o1)|type(o2)) == OT_INTEGER) |
860 |
+ if((sqtype(o1)| sqtype(o2)) == OT_INTEGER) |
861 |
{ |
862 |
SQInteger i1 = _integer(o1), i2 = _integer(o2); |
863 |
switch(op) { |
864 |
@@ -39,7 +39,7 @@ bool SQVM::BW_OP(SQUnsignedInteger op,SQObjectPtr &trg |
865 |
|
866 |
#define _ARITH_(op,trg,o1,o2) \ |
867 |
{ \ |
868 |
- SQInteger tmask = type(o1)|type(o2); \ |
869 |
+ SQInteger tmask = sqtype(o1)|sqtype(o2); \ |
870 |
switch(tmask) { \ |
871 |
case OT_INTEGER: trg = _integer(o1) op _integer(o2);break; \ |
872 |
case (OT_FLOAT|OT_INTEGER): \ |
873 |
@@ -50,7 +50,7 @@ bool SQVM::BW_OP(SQUnsignedInteger op,SQObjectPtr &trg |
874 |
|
875 |
#define _ARITH_NOZERO(op,trg,o1,o2,err) \ |
876 |
{ \ |
877 |
- SQInteger tmask = type(o1)|type(o2); \ |
878 |
+ SQInteger tmask = sqtype(o1)|sqtype(o2); \ |
879 |
switch(tmask) { \ |
880 |
case OT_INTEGER: { SQInteger i2 = _integer(o2); if(i2 == 0) { Raise_Error(err); SQ_THROW(); } trg = _integer(o1) op i2; } break;\ |
881 |
case (OT_FLOAT|OT_INTEGER): \ |
882 |
@@ -61,7 +61,7 @@ bool SQVM::BW_OP(SQUnsignedInteger op,SQObjectPtr &trg |
883 |
|
884 |
bool SQVM::ARITH_OP(SQUnsignedInteger op,SQObjectPtr &trg,const SQObjectPtr &o1,const SQObjectPtr &o2) |
885 |
{ |
886 |
- SQInteger tmask = type(o1)|type(o2); |
887 |
+ SQInteger tmask = sqtype(o1)| sqtype(o2); |
888 |
switch(tmask) { |
889 |
case OT_INTEGER:{ |
890 |
SQInteger res, i1 = _integer(o1), i2 = _integer(o2); |
891 |
@@ -175,7 +175,7 @@ bool SQVM::ArithMetaMethod(SQInteger op,const SQObject |
892 |
bool SQVM::NEG_OP(SQObjectPtr &trg,const SQObjectPtr &o) |
893 |
{ |
894 |
|
895 |
- switch(type(o)) { |
896 |
+ switch(sqtype(o)) { |
897 |
case OT_INTEGER: |
898 |
trg = -_integer(o); |
899 |
return true; |
900 |
@@ -204,7 +204,7 @@ bool SQVM::NEG_OP(SQObjectPtr &trg,const SQObjectPtr & |
901 |
#define _RET_SUCCEED(exp) { result = (exp); return true; } |
902 |
bool SQVM::ObjCmp(const SQObjectPtr &o1,const SQObjectPtr &o2,SQInteger &result) |
903 |
{ |
904 |
- SQObjectType t1 = type(o1), t2 = type(o2); |
905 |
+ SQObjectType t1 = sqtype(o1), t2 = sqtype(o2); |
906 |
if(t1 == t2) { |
907 |
if(_rawval(o1) == _rawval(o2))_RET_SUCCEED(0); |
908 |
SQObjectPtr res; |
909 |
@@ -223,7 +223,7 @@ bool SQVM::ObjCmp(const SQObjectPtr &o1,const SQObject |
910 |
if(_delegable(o1)->GetMetaMethod(this, MT_CMP, closure)) { |
911 |
Push(o1);Push(o2); |
912 |
if(CallMetaMethod(closure,MT_CMP,2,res)) { |
913 |
- if(type(res) != OT_INTEGER) { |
914 |
+ if(sqtype(res) != OT_INTEGER) { |
915 |
Raise_Error(_SC("_cmp must return an integer")); |
916 |
return false; |
917 |
} |
918 |
@@ -281,7 +281,7 @@ bool SQVM::CMP_OP(CmpOP op, const SQObjectPtr &o1,cons |
919 |
|
920 |
bool SQVM::ToString(const SQObjectPtr &o,SQObjectPtr &res) |
921 |
{ |
922 |
- switch(type(o)) { |
923 |
+ switch(sqtype(o)) { |
924 |
case OT_STRING: |
925 |
res = o; |
926 |
return true; |
927 |
@@ -302,7 +302,7 @@ bool SQVM::ToString(const SQObjectPtr &o,SQObjectPtr & |
928 |
if(_delegable(o)->GetMetaMethod(this, MT_TOSTRING, closure)) { |
929 |
Push(o); |
930 |
if(CallMetaMethod(closure,MT_TOSTRING,1,res)) {; |
931 |
- if(type(res) == OT_STRING) |
932 |
+ if(sqtype(res) == OT_STRING) |
933 |
return true; |
934 |
} |
935 |
else { |
936 |
@@ -517,7 +517,7 @@ bool SQVM::FOREACH_OP(SQObjectPtr &o1,SQObjectPtr &o2, |
937 |
&o3,SQObjectPtr &o4,SQInteger SQ_UNUSED_ARG(arg_2),int exitpos,int &jump) |
938 |
{ |
939 |
SQInteger nrefidx; |
940 |
- switch(type(o1)) { |
941 |
+ switch(sqtype(o1)) { |
942 |
case OT_TABLE: |
943 |
if((nrefidx = _table(o1)->Next(false,o4, o2, o3)) == -1) _FINISH(exitpos); |
944 |
o4 = (SQInteger)nrefidx; _FINISH(1); |
945 |
@@ -540,7 +540,7 @@ bool SQVM::FOREACH_OP(SQObjectPtr &o1,SQObjectPtr &o2, |
946 |
Push(o4); |
947 |
if(CallMetaMethod(closure, MT_NEXTI, 2, itr)) { |
948 |
o4 = o2 = itr; |
949 |
- if(type(itr) == OT_NULL) _FINISH(exitpos); |
950 |
+ if(sqtype(itr) == OT_NULL) _FINISH(exitpos); |
951 |
if(!Get(o1, itr, o3, 0, DONT_FALL_BACK)) { |
952 |
Raise_Error(_SC("_nexti returned an invalid idx")); // cloud be changed |
953 |
return false; |
954 |
@@ -559,7 +559,7 @@ bool SQVM::FOREACH_OP(SQObjectPtr &o1,SQObjectPtr &o2, |
955 |
if(_generator(o1)->_state == SQGenerator::eDead) _FINISH(exitpos); |
956 |
if(_generator(o1)->_state == SQGenerator::eSuspended) { |
957 |
SQInteger idx = 0; |
958 |
- if(type(o4) == OT_INTEGER) { |
959 |
+ if(sqtype(o4) == OT_INTEGER) { |
960 |
idx = _integer(o4) + 1; |
961 |
} |
962 |
o2 = idx; |
963 |
@@ -614,14 +614,14 @@ bool SQVM::CLASS_OP(SQObjectPtr &target,SQInteger base |
964 |
SQClass *base = NULL; |
965 |
SQObjectPtr attrs; |
966 |
if(baseclass != -1) { |
967 |
- if(type(_stack._vals[_stackbase+baseclass]) != OT_CLASS) { Raise_Error(_SC("trying to inherit from a %s"),GetTypeName(_stack._vals[_stackbase+baseclass])); return false; } |
968 |
+ if(sqtype(_stack._vals[_stackbase+baseclass]) != OT_CLASS) { Raise_Error(_SC("trying to inherit from a %s"),GetTypeName(_stack._vals[_stackbase+baseclass])); return false; } |
969 |
base = _class(_stack._vals[_stackbase + baseclass]); |
970 |
} |
971 |
if(attributes != MAX_FUNC_STACKSIZE) { |
972 |
attrs = _stack._vals[_stackbase+attributes]; |
973 |
} |
974 |
target = SQClass::Create(_ss(this),base); |
975 |
- if(type(_class(target)->_metamethods[MT_INHERITED]) != OT_NULL) { |
976 |
+ if(sqtype(_class(target)->_metamethods[MT_INHERITED]) != OT_NULL) { |
977 |
int nparams = 2; |
978 |
SQObjectPtr ret; |
979 |
Push(target); Push(attrs); |
980 |
@@ -637,7 +637,7 @@ bool SQVM::CLASS_OP(SQObjectPtr &target,SQInteger base |
981 |
|
982 |
bool SQVM::IsEqual(const SQObjectPtr &o1,const SQObjectPtr &o2,bool &res) |
983 |
{ |
984 |
- if(type(o1) == type(o2)) { |
985 |
+ if(sqtype(o1) == sqtype(o2)) { |
986 |
res = (_rawval(o1) == _rawval(o2)); |
987 |
} |
988 |
else { |
989 |
@@ -653,12 +653,12 @@ bool SQVM::IsEqual(const SQObjectPtr &o1,const SQObjec |
990 |
|
991 |
bool SQVM::IsFalse(SQObjectPtr &o) |
992 |
{ |
993 |
- if(((type(o) & SQOBJECT_CANBEFALSE) |
994 |
- && ( ((type(o) == OT_FLOAT) && (_float(o) == SQFloat(0.0))) )) |
995 |
+ if(((sqtype(o) & SQOBJECT_CANBEFALSE) |
996 |
+ && ( ((sqtype(o) == OT_FLOAT) && (_float(o) == SQFloat(0.0))) )) |
997 |
#if !defined(SQUSEDOUBLE) || (defined(SQUSEDOUBLE) && defined(_SQ64)) |
998 |
|| (_integer(o) == 0) ) //OT_NULL|OT_INTEGER|OT_BOOL |
999 |
#else |
1000 |
- || (((type(o) != OT_FLOAT) && (_integer(o) == 0))) ) //OT_NULL|OT_INTEGER|OT_BOOL |
1001 |
+ || (((sqtype(o) != OT_FLOAT) && (_integer(o) == 0))) ) //OT_NULL|OT_INTEGER|OT_BOOL |
1002 |
#endif |
1003 |
{ |
1004 |
return true; |
1005 |
@@ -721,7 +721,7 @@ exception_restore: |
1006 |
case _OP_DLOAD: TARGET = ci->_literals[arg1]; STK(arg2) = ci->_literals[arg3];continue; |
1007 |
case _OP_TAILCALL:{ |
1008 |
SQObjectPtr &t = STK(arg1); |
1009 |
- if (type(t) == OT_CLOSURE |
1010 |
+ if (sqtype(t) == OT_CLOSURE |
1011 |
&& (!_closure(t)->_function->_bgenerator)){ |
1012 |
SQObjectPtr clo = t; |
1013 |
if(_openouters) CloseOuters(&(_stack._vals[_stackbase])); |
1014 |
@@ -732,7 +732,7 @@ exception_restore: |
1015 |
} |
1016 |
case _OP_CALL: { |
1017 |
SQObjectPtr clo = STK(arg1); |
1018 |
- switch (type(clo)) { |
1019 |
+ switch (sqtype(clo)) { |
1020 |
case OT_CLOSURE: |
1021 |
_GUARD(StartCall(_closure(clo), sarg0, arg3, _stackbase+arg2, false)); |
1022 |
continue; |
1023 |
@@ -759,7 +759,7 @@ exception_restore: |
1024 |
STK(arg0) = inst; |
1025 |
} |
1026 |
SQInteger stkbase; |
1027 |
- switch(type(clo)) { |
1028 |
+ switch(sqtype(clo)) { |
1029 |
case OT_CLOSURE: |
1030 |
stkbase = _stackbase+arg2; |
1031 |
_stack._vals[stkbase] = inst; |
1032 |
@@ -857,7 +857,7 @@ exception_restore: |
1033 |
case _OP_LOADNULLS:{ for(SQInt32 n=0; n < arg1; n++) STK(arg0+n).Null(); }continue; |
1034 |
case _OP_LOADROOT: { |
1035 |
SQWeakRef *w = _closure(ci->_closure)->_root; |
1036 |
- if(type(w->_obj) != OT_NULL) { |
1037 |
+ if(sqtype(w->_obj) != OT_NULL) { |
1038 |
TARGET = w->_obj; |
1039 |
} else { |
1040 |
TARGET = _roottable; //shoud this be like this? or null |
1041 |
@@ -933,7 +933,7 @@ exception_restore: |
1042 |
case _OP_INC: {SQObjectPtr o(sarg3); _GUARD(DerefInc('+',TARGET, STK(arg1), STK(arg2), o, false, arg1));} continue; |
1043 |
case _OP_INCL: { |
1044 |
SQObjectPtr &a = STK(arg1); |
1045 |
- if(type(a) == OT_INTEGER) { |
1046 |
+ if(sqtype(a) == OT_INTEGER) { |
1047 |
a._unVal.nInteger = _integer(a) + sarg3; |
1048 |
} |
1049 |
else { |
1050 |
@@ -944,7 +944,7 @@ exception_restore: |
1051 |
case _OP_PINC: {SQObjectPtr o(sarg3); _GUARD(DerefInc('+',TARGET, STK(arg1), STK(arg2), o, true, arg1));} continue; |
1052 |
case _OP_PINCL: { |
1053 |
SQObjectPtr &a = STK(arg1); |
1054 |
- if(type(a) == OT_INTEGER) { |
1055 |
+ if(sqtype(a) == OT_INTEGER) { |
1056 |
TARGET = a; |
1057 |
a._unVal.nInteger = _integer(a) + sarg3; |
1058 |
} |
1059 |
@@ -956,9 +956,9 @@ exception_restore: |
1060 |
case _OP_CMP: _GUARD(CMP_OP((CmpOP)arg3,STK(arg2),STK(arg1),TARGET)) continue; |
1061 |
case _OP_EXISTS: TARGET = Get(STK(arg1), STK(arg2), temp_reg, GET_FLAG_DO_NOT_RAISE_ERROR | GET_FLAG_RAW, DONT_FALL_BACK) ? true : false; continue; |
1062 |
case _OP_INSTANCEOF: |
1063 |
- if(type(STK(arg1)) != OT_CLASS) |
1064 |
+ if(sqtype(STK(arg1)) != OT_CLASS) |
1065 |
{Raise_Error(_SC("cannot apply instanceof between a %s and a %s"),GetTypeName(STK(arg1)),GetTypeName(STK(arg2))); SQ_THROW();} |
1066 |
- TARGET = (type(STK(arg2)) == OT_INSTANCE) ? (_instance(STK(arg2))->InstanceOf(_class(STK(arg1)))?true:false) : false; |
1067 |
+ TARGET = (sqtype(STK(arg2)) == OT_INSTANCE) ? (_instance(STK(arg2))->InstanceOf(_class(STK(arg1)))?true:false) : false; |
1068 |
continue; |
1069 |
case _OP_AND: |
1070 |
if(IsFalse(STK(arg2))) { |
1071 |
@@ -975,7 +975,7 @@ exception_restore: |
1072 |
case _OP_NEG: _GUARD(NEG_OP(TARGET,STK(arg1))); continue; |
1073 |
case _OP_NOT: TARGET = IsFalse(STK(arg1)); continue; |
1074 |
case _OP_BWNOT: |
1075 |
- if(type(STK(arg1)) == OT_INTEGER) { |
1076 |
+ if(sqtype(STK(arg1)) == OT_INTEGER) { |
1077 |
SQInteger t = _integer(STK(arg1)); |
1078 |
TARGET = SQInteger(~t); |
1079 |
continue; |
1080 |
@@ -1005,7 +1005,7 @@ exception_restore: |
1081 |
} |
1082 |
continue; |
1083 |
case _OP_RESUME: |
1084 |
- if(type(STK(arg1)) != OT_GENERATOR){ Raise_Error(_SC("trying to resume a '%s',only genenerator can be resumed"), GetTypeName(STK(arg1))); SQ_THROW();} |
1085 |
+ if(sqtype(STK(arg1)) != OT_GENERATOR){ Raise_Error(_SC("trying to resume a '%s',only genenerator can be resumed"), GetTypeName(STK(arg1))); SQ_THROW();} |
1086 |
_GUARD(_generator(STK(arg1))->Resume(this, TARGET)); |
1087 |
traps += ci->_etraps; |
1088 |
continue; |
1089 |
@@ -1014,7 +1014,7 @@ exception_restore: |
1090 |
ci->_ip += tojump; } |
1091 |
continue; |
1092 |
case _OP_POSTFOREACH: |
1093 |
- assert(type(STK(arg0)) == OT_GENERATOR); |
1094 |
+ assert(sqtype(STK(arg0)) == OT_GENERATOR); |
1095 |
if(_generator(STK(arg0))->_state == SQGenerator::eDead) |
1096 |
ci->_ip += (sarg1 - 1); |
1097 |
continue; |
1098 |
@@ -1104,7 +1104,7 @@ bool SQVM::CreateClassInstance(SQClass *theclass, SQOb |
1099 |
|
1100 |
void SQVM::CallErrorHandler(SQObjectPtr &error) |
1101 |
{ |
1102 |
- if(type(_errorhandler) != OT_NULL) { |
1103 |
+ if(sqtype(_errorhandler) != OT_NULL) { |
1104 |
SQObjectPtr out; |
1105 |
Push(_roottable); Push(error); |
1106 |
Call(_errorhandler, 2, _top-2, out,SQFalse); |
1107 |
@@ -1118,8 +1118,8 @@ void SQVM::CallDebugHook(SQInteger type,SQInteger forc |
1108 |
_debughook = false; |
1109 |
SQFunctionProto *func=_closure(ci->_closure)->_function; |
1110 |
if(_debughook_native) { |
1111 |
- const SQChar *src = type(func->_sourcename) == OT_STRING?_stringval(func->_sourcename):NULL; |
1112 |
- const SQChar *fname = type(func->_name) == OT_STRING?_stringval(func->_name):NULL; |
1113 |
+ const SQChar *src = sqtype(func->_sourcename) == OT_STRING?_stringval(func->_sourcename):NULL; |
1114 |
+ const SQChar *fname = sqtype(func->_name) == OT_STRING?_stringval(func->_name):NULL; |
1115 |
SQInteger line = forcedline?forcedline:func->GetLine(ci->_ip); |
1116 |
_debughook_native(this,type,src,line,fname); |
1117 |
} |
1118 |
@@ -1154,8 +1154,8 @@ bool SQVM::CallNative(SQNativeClosure *nclosure, SQInt |
1119 |
SQIntVec &tc = nclosure->_typecheck; |
1120 |
if((tcs = tc.size())) { |
1121 |
for(SQInteger i = 0; i < nargs && i < tcs; i++) { |
1122 |
- if((tc._vals[i] != -1) && !(type(_stack._vals[newbase+i]) & tc._vals[i])) { |
1123 |
- Raise_ParamTypeError(i,tc._vals[i],type(_stack._vals[newbase+i])); |
1124 |
+ if((tc._vals[i] != -1) && !(sqtype(_stack._vals[newbase+i]) & tc._vals[i])) { |
1125 |
+ Raise_ParamTypeError(i,tc._vals[i], sqtype(_stack._vals[newbase+i])); |
1126 |
return false; |
1127 |
} |
1128 |
} |
1129 |
@@ -1202,7 +1202,7 @@ bool SQVM::CallNative(SQNativeClosure *nclosure, SQInt |
1130 |
|
1131 |
bool SQVM::Get(const SQObjectPtr &self, const SQObjectPtr &key, SQObjectPtr &dest, SQUnsignedInteger getflags, SQInteger selfidx) |
1132 |
{ |
1133 |
- switch(type(self)){ |
1134 |
+ switch(sqtype(self)){ |
1135 |
case OT_TABLE: |
1136 |
if(_table(self)->Get(key,dest))return true; |
1137 |
break; |
1138 |
@@ -1243,7 +1243,7 @@ bool SQVM::Get(const SQObjectPtr &self, const SQObject |
1139 |
//#ifdef ROOT_FALLBACK |
1140 |
if(selfidx == 0) { |
1141 |
SQWeakRef *w = _closure(ci->_closure)->_root; |
1142 |
- if(type(w->_obj) != OT_NULL) |
1143 |
+ if(sqtype(w->_obj) != OT_NULL) |
1144 |
{ |
1145 |
if(Get(*((const SQObjectPtr *)&w->_obj),key,dest,0,DONT_FALL_BACK)) return true; |
1146 |
} |
1147 |
@@ -1257,7 +1257,7 @@ bool SQVM::Get(const SQObjectPtr &self, const SQObject |
1148 |
bool SQVM::InvokeDefaultDelegate(const SQObjectPtr &self,const SQObjectPtr &key,SQObjectPtr &dest) |
1149 |
{ |
1150 |
SQTable *ddel = NULL; |
1151 |
- switch(type(self)) { |
1152 |
+ switch(sqtype(self)) { |
1153 |
case OT_CLASS: ddel = _class_ddel; break; |
1154 |
case OT_TABLE: ddel = _table_ddel; break; |
1155 |
case OT_ARRAY: ddel = _array_ddel; break; |
1156 |
@@ -1276,7 +1276,7 @@ bool SQVM::InvokeDefaultDelegate(const SQObjectPtr &se |
1157 |
|
1158 |
SQInteger SQVM::FallBackGet(const SQObjectPtr &self,const SQObjectPtr &key,SQObjectPtr &dest) |
1159 |
{ |
1160 |
- switch(type(self)){ |
1161 |
+ switch(sqtype(self)){ |
1162 |
case OT_TABLE: |
1163 |
case OT_USERDATA: |
1164 |
//delegation |
1165 |
@@ -1299,7 +1299,7 @@ SQInteger SQVM::FallBackGet(const SQObjectPtr &self,co |
1166 |
} |
1167 |
else { |
1168 |
Pop(2); |
1169 |
- if(type(_lasterror) != OT_NULL) { //NULL means "clean failure" (not found) |
1170 |
+ if(sqtype(_lasterror) != OT_NULL) { //NULL means "clean failure" (not found) |
1171 |
return FALLBACK_ERROR; |
1172 |
} |
1173 |
} |
1174 |
@@ -1314,7 +1314,7 @@ SQInteger SQVM::FallBackGet(const SQObjectPtr &self,co |
1175 |
|
1176 |
bool SQVM::Set(const SQObjectPtr &self,const SQObjectPtr &key,const SQObjectPtr &val,SQInteger selfidx) |
1177 |
{ |
1178 |
- switch(type(self)){ |
1179 |
+ switch(sqtype(self)){ |
1180 |
case OT_TABLE: |
1181 |
if(_table(self)->Set(key,val)) return true; |
1182 |
break; |
1183 |
@@ -1348,7 +1348,7 @@ bool SQVM::Set(const SQObjectPtr &self,const SQObjectP |
1184 |
|
1185 |
SQInteger SQVM::FallBackSet(const SQObjectPtr &self,const SQObjectPtr &key,const SQObjectPtr &val) |
1186 |
{ |
1187 |
- switch(type(self)) { |
1188 |
+ switch(sqtype(self)) { |
1189 |
case OT_TABLE: |
1190 |
if(_table(self)->_delegate) { |
1191 |
if(Set(_table(self)->_delegate,key,val,DONT_FALL_BACK)) return FALLBACK_OK; |
1192 |
@@ -1367,7 +1367,7 @@ SQInteger SQVM::FallBackSet(const SQObjectPtr &self,co |
1193 |
return FALLBACK_OK; |
1194 |
} |
1195 |
else { |
1196 |
- if(type(_lasterror) != OT_NULL) { //NULL means "clean failure" (not found) |
1197 |
+ if(sqtype(_lasterror) != OT_NULL) { //NULL means "clean failure" (not found) |
1198 |
//error |
1199 |
Pop(3); |
1200 |
return FALLBACK_ERROR; |
1201 |
@@ -1386,7 +1386,7 @@ bool SQVM::Clone(const SQObjectPtr &self,SQObjectPtr & |
1202 |
{ |
1203 |
SQObjectPtr temp_reg; |
1204 |
SQObjectPtr newobj; |
1205 |
- switch(type(self)){ |
1206 |
+ switch(sqtype(self)){ |
1207 |
case OT_TABLE: |
1208 |
newobj = _table(self)->Clone(); |
1209 |
goto cloned_mt; |
1210 |
@@ -1414,14 +1414,14 @@ cloned_mt: |
1211 |
|
1212 |
bool SQVM::NewSlotA(const SQObjectPtr &self,const SQObjectPtr &key,const SQObjectPtr &val,const SQObjectPtr &attrs,bool bstatic,bool raw) |
1213 |
{ |
1214 |
- if(type(self) != OT_CLASS) { |
1215 |
+ if(sqtype(self) != OT_CLASS) { |
1216 |
Raise_Error(_SC("object must be a class")); |
1217 |
return false; |
1218 |
} |
1219 |
SQClass *c = _class(self); |
1220 |
if(!raw) { |
1221 |
SQObjectPtr &mm = c->_metamethods[MT_NEWMEMBER]; |
1222 |
- if(type(mm) != OT_NULL ) { |
1223 |
+ if(sqtype(mm) != OT_NULL ) { |
1224 |
Push(self); Push(key); Push(val); |
1225 |
Push(attrs); |
1226 |
Push(bstatic); |
1227 |
@@ -1430,7 +1430,7 @@ bool SQVM::NewSlotA(const SQObjectPtr &self,const SQOb |
1228 |
} |
1229 |
if(!NewSlot(self, key, val,bstatic)) |
1230 |
return false; |
1231 |
- if(type(attrs) != OT_NULL) { |
1232 |
+ if(sqtype(attrs) != OT_NULL) { |
1233 |
c->SetAttributes(key,attrs); |
1234 |
} |
1235 |
return true; |
1236 |
@@ -1438,8 +1438,8 @@ bool SQVM::NewSlotA(const SQObjectPtr &self,const SQOb |
1237 |
|
1238 |
bool SQVM::NewSlot(const SQObjectPtr &self,const SQObjectPtr &key,const SQObjectPtr &val,bool bstatic) |
1239 |
{ |
1240 |
- if(type(key) == OT_NULL) { Raise_Error(_SC("null cannot be used as index")); return false; } |
1241 |
- switch(type(self)) { |
1242 |
+ if(sqtype(key) == OT_NULL) { Raise_Error(_SC("null cannot be used as index")); return false; } |
1243 |
+ switch(sqtype(self)) { |
1244 |
case OT_TABLE: { |
1245 |
bool rawcall = true; |
1246 |
if(_table(self)->_delegate) { |
1247 |
@@ -1499,7 +1499,7 @@ bool SQVM::NewSlot(const SQObjectPtr &self,const SQObj |
1248 |
|
1249 |
bool SQVM::DeleteSlot(const SQObjectPtr &self,const SQObjectPtr &key,SQObjectPtr &res) |
1250 |
{ |
1251 |
- switch(type(self)) { |
1252 |
+ switch(sqtype(self)) { |
1253 |
case OT_TABLE: |
1254 |
case OT_INSTANCE: |
1255 |
case OT_USERDATA: { |
1256 |
@@ -1511,7 +1511,7 @@ bool SQVM::DeleteSlot(const SQObjectPtr &self,const SQ |
1257 |
return CallMetaMethod(closure,MT_DELSLOT,2,res); |
1258 |
} |
1259 |
else { |
1260 |
- if(type(self) == OT_TABLE) { |
1261 |
+ if(sqtype(self) == OT_TABLE) { |
1262 |
if(_table(self)->Get(key,t)) { |
1263 |
_table(self)->Remove(key); |
1264 |
} |
1265 |
@@ -1540,7 +1540,7 @@ bool SQVM::Call(SQObjectPtr &closure,SQInteger nparams |
1266 |
#ifdef _DEBUG |
1267 |
SQInteger prevstackbase = _stackbase; |
1268 |
#endif |
1269 |
- switch(type(closure)) { |
1270 |
+ switch(sqtype(closure)) { |
1271 |
case OT_CLOSURE: |
1272 |
return Execute(closure, nparams, stackbase, outres, raiseerror); |
1273 |
break; |
1274 |
@@ -1554,7 +1554,7 @@ SQInteger prevstackbase = _stackbase; |
1275 |
SQObjectPtr constr; |
1276 |
SQObjectPtr temp; |
1277 |
CreateClassInstance(_class(closure),outres,constr); |
1278 |
- SQObjectType ctype = type(constr); |
1279 |
+ SQObjectType ctype = sqtype(constr); |
1280 |
if (ctype == OT_NATIVECLOSURE || ctype == OT_CLOSURE) { |
1281 |
_stack[stackbase] = outres; |
1282 |
return Call(constr,nparams,stackbase,temp,raiseerror); |
1283 |
@@ -1717,7 +1717,7 @@ void SQVM::dumpstack(SQInteger stackbase,bool dumpall) |
1284 |
SQObjectPtr &obj=_stack[i]; |
1285 |
if(stackbase==i)scprintf(_SC(">"));else scprintf(_SC(" ")); |
1286 |
scprintf(_SC("[%d]:"),n); |
1287 |
- switch(type(obj)){ |
1288 |
+ switch(sqtype(obj)){ |
1289 |
case OT_FLOAT: scprintf(_SC("FLOAT %.3f"),_float(obj));break; |
1290 |
case OT_INTEGER: scprintf(_SC("INTEGER %d"),_integer(obj));break; |
1291 |
case OT_BOOL: scprintf(_SC("BOOL %s"),_integer(obj)?"true":"false");break; |