Skip to content

Commit b037591

Browse files
committed
Squirrel 3.2
1 parent afcf3bc commit b037591

15 files changed

Lines changed: 132 additions & 59 deletions

File tree

src/vscript/squirrel/COMPILE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Squirrel 3.1 stable
1+
Squirrel 3.2 stable
22
--------------------------------------------------------
33
What is in this distribution?
44

src/vscript/squirrel/COPYRIGHT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2003-2017 Alberto Demichelis
1+
Copyright (c) 2003-2022 Alberto Demichelis
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

src/vscript/squirrel/HISTORY

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
***version 3.2 stable***
2+
-added new inline bind env syntax for closures
23
-added sq_tailcall
34
-added rawcall keyword
45
-added post call initializer syntax
56
-added table.keys() and table.values()
67
-added table.filter()
8+
-added skipempty in split()
79
-additional parameters in array.map() and array.apply()
810
-additional optional initializer in array.reduce()
11+
-added sqstd_pushstringf and sqstd_throwerrorf
912
-closure.call() is now a "native tailcall" and the invoked function can now be suspended
1013
-fixed sq_newmember and sq_rawnewmember properly pop parameters
1114
-fixed capturing free variable on for loop counter before a break statement
1215
-fixed \u in lexer
1316
-various bugfixes
14-
15-
***version 3.1.1 stable***
1617
-sq_gettypetag doesn't set last error(it's treated as SQBool function but keeps a SQRESULT for backward compatibility)
1718
-fixed _set method in userdata delegates
1819
-fixed some warnings
1920

21+
***2016-03-27 ***
2022
***version 3.1 stable***
2123
-added slice range for tolower and toupper
2224
-added startswith() and endswith() in string lib

src/vscript/squirrel/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The programming language SQUIRREL 3.1 stable
1+
The programming language SQUIRREL 3.2 stable
22

33
--------------------------------------------------
44
This project has successfully been compiled and run on

src/vscript/squirrel/include/squirrel.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2003-2017 Alberto Demichelis
2+
Copyright (c) 2003-2022 Alberto Demichelis
33
44
Permission is hereby granted, free of charge, to any person obtaining a copy
55
of this software and associated documentation files (the "Software"), to deal
@@ -65,10 +65,10 @@ struct SQOuter;
6565

6666
#include "sqconfig.h"
6767

68-
#define SQUIRREL_VERSION _SC("Squirrel 3.1 stable")
69-
#define SQUIRREL_COPYRIGHT _SC("Copyright (C) 2003-2017 Alberto Demichelis")
68+
#define SQUIRREL_VERSION _SC("Squirrel 3.2 stable")
69+
#define SQUIRREL_COPYRIGHT _SC("Copyright (C) 2003-2022 Alberto Demichelis")
7070
#define SQUIRREL_AUTHOR _SC("Alberto Demichelis")
71-
#define SQUIRREL_VERSION_NUMBER 310
71+
#define SQUIRREL_VERSION_NUMBER 320
7272

7373
#define SQ_VMSTATE_IDLE 0
7474
#define SQ_VMSTATE_RUNNING 1
@@ -280,7 +280,7 @@ SQUIRREL_API SQRESULT sq_getclosureinfo(HSQUIRRELVM v,SQInteger idx,SQInteger *n
280280
SQUIRREL_API SQRESULT sq_getclosurename(HSQUIRRELVM v,SQInteger idx);
281281
SQUIRREL_API SQRESULT sq_setnativeclosurename(HSQUIRRELVM v,SQInteger idx,const SQChar *name);
282282
SQUIRREL_API SQRESULT sq_setinstanceup(HSQUIRRELVM v, SQInteger idx, SQUserPointer p);
283-
SQUIRREL_API SQRESULT sq_getinstanceup(HSQUIRRELVM v, SQInteger idx, SQUserPointer *p,SQUserPointer typetag);
283+
SQUIRREL_API SQRESULT sq_getinstanceup(HSQUIRRELVM v, SQInteger idx, SQUserPointer *p,SQUserPointer typetag,SQBool throwerror);
284284
SQUIRREL_API SQRESULT sq_setclassudsize(HSQUIRRELVM v, SQInteger idx, SQInteger udsize);
285285
SQUIRREL_API SQRESULT sq_newclass(HSQUIRRELVM v,SQBool hasbase);
286286
SQUIRREL_API SQRESULT sq_createinstance(HSQUIRRELVM v,SQInteger idx);

src/vscript/squirrel/sqstdlib/sqstdblob.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#define SETUP_BLOB(v) \
1616
SQBlob *self = NULL; \
17-
{ if(SQ_FAILED(sq_getinstanceup(v,1,(SQUserPointer*)&self,(SQUserPointer)SQSTD_BLOB_TYPE_TAG))) \
17+
{ if(SQ_FAILED(sq_getinstanceup(v,1,(SQUserPointer*)&self,(SQUserPointer)SQSTD_BLOB_TYPE_TAG,SQFalse))) \
1818
return sq_throwerror(v,_SC("invalid type tag")); } \
1919
if(!self || !self->IsValid()) \
2020
return sq_throwerror(v,_SC("the blob is invalid"));
@@ -152,7 +152,7 @@ static SQInteger _blob__cloned(HSQUIRRELVM v)
152152
{
153153
SQBlob *other = NULL;
154154
{
155-
if(SQ_FAILED(sq_getinstanceup(v,2,(SQUserPointer*)&other,(SQUserPointer)SQSTD_BLOB_TYPE_TAG)))
155+
if(SQ_FAILED(sq_getinstanceup(v,2,(SQUserPointer*)&other,(SQUserPointer)SQSTD_BLOB_TYPE_TAG,SQFalse)))
156156
return SQ_ERROR;
157157
}
158158
//SQBlob *thisone = new SQBlob(other->Len());
@@ -242,7 +242,7 @@ static const SQRegFunction bloblib_funcs[]={
242242
SQRESULT sqstd_getblob(HSQUIRRELVM v,SQInteger idx,SQUserPointer *ptr)
243243
{
244244
SQBlob *blob;
245-
if(SQ_FAILED(sq_getinstanceup(v,idx,(SQUserPointer *)&blob,(SQUserPointer)SQSTD_BLOB_TYPE_TAG)))
245+
if(SQ_FAILED(sq_getinstanceup(v,idx,(SQUserPointer *)&blob,(SQUserPointer)SQSTD_BLOB_TYPE_TAG,SQTrue)))
246246
return -1;
247247
*ptr = blob->GetBuf();
248248
return SQ_OK;
@@ -251,7 +251,7 @@ SQRESULT sqstd_getblob(HSQUIRRELVM v,SQInteger idx,SQUserPointer *ptr)
251251
SQInteger sqstd_getblobsize(HSQUIRRELVM v,SQInteger idx)
252252
{
253253
SQBlob *blob;
254-
if(SQ_FAILED(sq_getinstanceup(v,idx,(SQUserPointer *)&blob,(SQUserPointer)SQSTD_BLOB_TYPE_TAG)))
254+
if(SQ_FAILED(sq_getinstanceup(v,idx,(SQUserPointer *)&blob,(SQUserPointer)SQSTD_BLOB_TYPE_TAG,SQTrue)))
255255
return -1;
256256
return blob->Len();
257257
}
@@ -267,7 +267,7 @@ SQUserPointer sqstd_createblob(HSQUIRRELVM v, SQInteger size)
267267
sq_pushinteger(v,size); //size
268268
SQBlob *blob = NULL;
269269
if(SQ_SUCCEEDED(sq_call(v,2,SQTrue,SQFalse))
270-
&& SQ_SUCCEEDED(sq_getinstanceup(v,-1,(SQUserPointer *)&blob,(SQUserPointer)SQSTD_BLOB_TYPE_TAG))) {
270+
&& SQ_SUCCEEDED(sq_getinstanceup(v,-1,(SQUserPointer *)&blob,(SQUserPointer)SQSTD_BLOB_TYPE_TAG,SQTrue))) {
271271
sq_remove(v,-2);
272272
return blob->GetBuf();
273273
}

src/vscript/squirrel/sqstdlib/sqstdio.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static SQInteger _file_constructor(HSQUIRRELVM v)
154154
static SQInteger _file_close(HSQUIRRELVM v)
155155
{
156156
SQFile *self = NULL;
157-
if(SQ_SUCCEEDED(sq_getinstanceup(v,1,(SQUserPointer*)&self,(SQUserPointer)SQSTD_FILE_TYPE_TAG))
157+
if(SQ_SUCCEEDED(sq_getinstanceup(v,1,(SQUserPointer*)&self,(SQUserPointer)SQSTD_FILE_TYPE_TAG, SQTrue))
158158
&& self != NULL)
159159
{
160160
self->Close();
@@ -200,7 +200,7 @@ SQRESULT sqstd_createfile(HSQUIRRELVM v, SQFILE file,SQBool own)
200200
SQRESULT sqstd_getfile(HSQUIRRELVM v, SQInteger idx, SQFILE *file)
201201
{
202202
SQFile *fileobj = NULL;
203-
if(SQ_SUCCEEDED(sq_getinstanceup(v,idx,(SQUserPointer*)&fileobj,(SQUserPointer)SQSTD_FILE_TYPE_TAG))) {
203+
if(SQ_SUCCEEDED(sq_getinstanceup(v,idx,(SQUserPointer*)&fileobj,(SQUserPointer)SQSTD_FILE_TYPE_TAG,SQFalse))) {
204204
*file = fileobj->GetHandle();
205205
return SQ_OK;
206206
}

src/vscript/squirrel/sqstdlib/sqstdstream.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#define SETUP_STREAM(v) \
1313
SQStream *self = NULL; \
14-
if(SQ_FAILED(sq_getinstanceup(v,1,(SQUserPointer*)&self,(SQUserPointer)((SQUnsignedInteger)SQSTD_STREAM_TYPE_TAG)))) \
14+
if(SQ_FAILED(sq_getinstanceup(v,1,(SQUserPointer*)&self,(SQUserPointer)((SQUnsignedInteger)SQSTD_STREAM_TYPE_TAG),SQFalse))) \
1515
return sq_throwerror(v,_SC("invalid type tag")); \
1616
if(!self || !self->IsValid()) \
1717
return sq_throwerror(v,_SC("the stream is invalid"));

src/vscript/squirrel/sqstdlib/sqstdstring.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ static SQInteger _string_endswith(HSQUIRRELVM v)
387387

388388
#define SETUP_REX(v) \
389389
SQRex *self = NULL; \
390-
if(SQ_FAILED(sq_getinstanceup(v,1,(SQUserPointer *)&self,rex_typetag))) { \
390+
if(SQ_FAILED(sq_getinstanceup(v,1,(SQUserPointer *)&self,rex_typetag,SQFalse))) { \
391391
return sq_throwerror(v,_SC("invalid type tag")); \
392392
}
393393

@@ -471,7 +471,7 @@ static SQInteger _regexp_subexpcount(HSQUIRRELVM v)
471471
static SQInteger _regexp_constructor(HSQUIRRELVM v)
472472
{
473473
SQRex *self = NULL;
474-
if (SQ_FAILED(sq_getinstanceup(v, 1, (SQUserPointer *)&self, rex_typetag))) {
474+
if (SQ_FAILED(sq_getinstanceup(v, 1, (SQUserPointer *)&self, rex_typetag, SQFalse))) {
475475
return sq_throwerror(v, _SC("invalid type tag"));
476476
}
477477
if (self != NULL) {

src/vscript/squirrel/squirrel/sqapi.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -807,21 +807,21 @@ SQRESULT sq_setclassudsize(HSQUIRRELVM v, SQInteger idx, SQInteger udsize)
807807
}
808808

809809

810-
SQRESULT sq_getinstanceup(HSQUIRRELVM v, SQInteger idx, SQUserPointer *p,SQUserPointer typetag)
811-
{
812-
SQObjectPtr &o = stack_get(v,idx);
813-
if(sq_type(o) != OT_INSTANCE) return sq_throwerror(v,_SC("the object is not a class instance"));
814-
(*p) = _instance(o)->_userpointer;
815-
if(typetag != 0) {
816-
SQClass *cl = _instance(o)->_class;
817-
do{
818-
if(cl->_typetag == typetag)
819-
return SQ_OK;
820-
cl = cl->_base;
821-
}while(cl != NULL);
822-
return sq_throwerror(v,_SC("invalid type tag"));
823-
}
824-
return SQ_OK;
810+
SQRESULT sq_getinstanceup(HSQUIRRELVM v, SQInteger idx, SQUserPointer *p, SQUserPointer typetag, SQBool throwerror)
811+
{
812+
SQObjectPtr &o = stack_get(v, idx);
813+
if (sq_type(o) != OT_INSTANCE) return throwerror ? sq_throwerror(v, _SC("the object is not a class instance")) : SQ_ERROR;
814+
(*p) = _instance(o)->_userpointer;
815+
if (typetag != 0) {
816+
SQClass *cl = _instance(o)->_class;
817+
do {
818+
if (cl->_typetag == typetag)
819+
return SQ_OK;
820+
cl = cl->_base;
821+
} while (cl != NULL);
822+
return throwerror ? sq_throwerror(v, _SC("invalid type tag")) : SQ_ERROR;
823+
}
824+
return SQ_OK;
825825
}
826826

827827
SQInteger sq_gettop(HSQUIRRELVM v)

0 commit comments

Comments
 (0)