Browse Source

Add changes from squirrel

mingodad 9 years ago
parent
commit
8eceded6a0

+ 53 - 53
SquiLu/sqstdlib/sqstdio.cpp

@@ -171,11 +171,11 @@ static SQRESULT _file_close(HSQUIRRELVM v)
 
 //bindings
 #define _DECL_FILE_FUNC(name,nparams,typecheck) {_SC(#name),_file_##name,nparams,typecheck}
-static SQRegFunction _file_methods[] = {
-	_DECL_FILE_FUNC(constructor,3,_SC("x")),
-	_DECL_FILE_FUNC(_typeof,1,_SC("x")),
-	_DECL_FILE_FUNC(close,1,_SC("x")),
-	{NULL,(SQFUNCTION)0,0,NULL}
+static const SQRegFunction _file_methods[] = {
+    _DECL_FILE_FUNC(constructor,3,_SC("x")),
+    _DECL_FILE_FUNC(_typeof,1,_SC("x")),
+    _DECL_FILE_FUNC(close,1,_SC("x")),
+    {NULL,(SQFUNCTION)0,0,NULL}
 };
 
 
@@ -218,10 +218,10 @@ SQRESULT sqstd_getfile(HSQUIRRELVM v, SQInteger idx, SQFILE *file)
 
 #define IO_BUFFER_SIZE 2048
 struct IOBuffer {
-	unsigned char buffer[IO_BUFFER_SIZE];
-	int size;
-	int ptr;
-	SQFILE file;
+    unsigned char buffer[IO_BUFFER_SIZE];
+    SQInteger size;
+    SQInteger ptr;
+    SQFILE file;
 };
 
 SQInteger _read_byte(IOBuffer *iobuffer)
@@ -246,21 +246,21 @@ SQInteger _read_byte(IOBuffer *iobuffer)
 
 SQInteger _read_two_bytes(IOBuffer *iobuffer)
 {
-	if(iobuffer->ptr < iobuffer->size) {
-		if(iobuffer->size < 2) return 0;
-		SQInteger ret = *((wchar_t*)&iobuffer->buffer[iobuffer->ptr]);
-		iobuffer->ptr += 2;
-		return ret;
-	}
-	else {
-		if( (iobuffer->size = sqstd_fread(iobuffer->buffer,1,IO_BUFFER_SIZE,iobuffer->file )) > 0 )
-		{
-			if(iobuffer->size < 2) return 0;
-			SQInteger ret = *((wchar_t*)&iobuffer->buffer[0]);
-			iobuffer->ptr = 2;
-			return ret;
-		}
-	}
+    if(iobuffer->ptr < iobuffer->size) {
+        if(iobuffer->size < 2) return 0;
+        SQInteger ret = *((const wchar_t*)&iobuffer->buffer[iobuffer->ptr]);
+        iobuffer->ptr += 2;
+        return ret;
+    }
+    else {
+        if( (iobuffer->size = sqstd_fread(iobuffer->buffer,1,IO_BUFFER_SIZE,iobuffer->file )) > 0 )
+        {
+            if(iobuffer->size < 2) return 0;
+            SQInteger ret = *((const wchar_t*)&iobuffer->buffer[0]);
+            iobuffer->ptr = 2;
+            return ret;
+        }
+    }
 
 	return 0;
 }
@@ -280,35 +280,35 @@ static SQInteger _io_file_lexfeed_UTF8(SQUserPointer iobuf)
 	if((inchar = (unsigned char)_read_byte(iobuf)) == 0) \
 		return 0;
 
-	static const SQInteger utf8_lengths[16] =
-	{
-		1,1,1,1,1,1,1,1,        /* 0000 to 0111 : 1 byte (plain ASCII) */
-		0,0,0,0,                /* 1000 to 1011 : not valid */
-		2,2,                    /* 1100, 1101 : 2 bytes */
-		3,                      /* 1110 : 3 bytes */
-		4                       /* 1111 :4 bytes */
-	};
-	static unsigned char byte_masks[5] = {0,0,0x1f,0x0f,0x07};
-	unsigned char inchar;
-	SQInteger c = 0;
-	READ(iobuffer);
-	c = inchar;
-	//
-	if(c >= 0x80) {
-		SQInteger tmp;
-		SQInteger codelen = utf8_lengths[c>>4];
-		if(codelen == 0)
-			return 0;
-			//"invalid UTF-8 stream";
-		tmp = c&byte_masks[codelen];
-		for(SQInteger n = 0; n < codelen-1; n++) {
-			tmp<<=6;
-			READ(iobuffer);
-			tmp |= inchar & 0x3F;
-		}
-		c = tmp;
-	}
-	return c;
+    static const SQInteger utf8_lengths[16] =
+    {
+        1,1,1,1,1,1,1,1,        /* 0000 to 0111 : 1 byte (plain ASCII) */
+        0,0,0,0,                /* 1000 to 1011 : not valid */
+        2,2,                    /* 1100, 1101 : 2 bytes */
+        3,                      /* 1110 : 3 bytes */
+        4                       /* 1111 :4 bytes */
+    };
+    static const unsigned char byte_masks[5] = {0,0,0x1f,0x0f,0x07};
+    unsigned char inchar;
+    SQInteger c = 0;
+    READ(iobuffer);
+    c = inchar;
+    //
+    if(c >= 0x80) {
+        SQInteger tmp;
+        SQInteger codelen = utf8_lengths[c>>4];
+        if(codelen == 0)
+            return 0;
+            //"invalid UTF-8 stream";
+        tmp = c&byte_masks[codelen];
+        for(SQInteger n = 0; n < codelen-1; n++) {
+            tmp<<=6;
+            READ(iobuffer);
+            tmp |= inchar & 0x3F;
+        }
+        c = tmp;
+    }
+    return c;
 }
 #endif
 

+ 3 - 3
SquiLu/sqstdlib/sqstdstream.cpp

@@ -434,7 +434,7 @@ void init_streamclass(HSQUIRRELVM v)
 	sq_pop(v,1);
 }
 
-SQRESULT declare_stream(HSQUIRRELVM v,const SQChar* name,SQUserPointer typetag,const SQChar* reg_name,SQRegFunction *methods,SQRegFunction *globals)
+SQRESULT declare_stream(HSQUIRRELVM v,const SQChar* name,SQUserPointer typetag,const SQChar* reg_name,const SQRegFunction *methods,const SQRegFunction *globals)
 {
 	if(sq_gettype(v,-1) != OT_TABLE)
 		return sq_throwerror(v,_SC("table expected"));
@@ -449,7 +449,7 @@ SQRESULT declare_stream(HSQUIRRELVM v,const SQChar* name,SQUserPointer typetag,c
 		sq_settypetag(v,-1,typetag);
 		SQInteger i = 0;
 		while(methods[i].name != 0) {
-			SQRegFunction &f = methods[i];
+			const SQRegFunction &f = methods[i];
 			sq_pushstring(v,f.name,-1);
 			sq_newclosure(v,f.f,0);
 			sq_setparamscheck(v,f.nparamscheck,f.typemask);
@@ -463,7 +463,7 @@ SQRESULT declare_stream(HSQUIRRELVM v,const SQChar* name,SQUserPointer typetag,c
 		i = 0;
 		while(globals[i].name!=0)
 		{
-			SQRegFunction &f = globals[i];
+			const SQRegFunction &f = globals[i];
 			sq_pushstring(v,f.name,-1);
 			sq_newclosure(v,f.f,0);
 			sq_setparamscheck(v,f.nparamscheck,f.typemask);

+ 1 - 1
SquiLu/sqstdlib/sqstdstream.h

@@ -18,5 +18,5 @@ SQInteger _stream_eos(HSQUIRRELVM v);
 SQInteger _stream_flush(HSQUIRRELVM v);
 
 #define _DECL_STREAM_FUNC(name,nparams,typecheck) {_SC(#name),_stream_##name,nparams,typecheck}
-SQRESULT declare_stream(HSQUIRRELVM v,const SQChar* name,SQUserPointer typetag,const SQChar* reg_name,SQRegFunction *methods,SQRegFunction *globals);
+SQRESULT declare_stream(HSQUIRRELVM v,const SQChar* name,SQUserPointer typetag,const SQChar* reg_name,const SQRegFunction *methods,const SQRegFunction *globals);
 #endif /*_SQSTD_STREAM_H_*/

+ 478 - 15
SquiLu/squilu.cbp

@@ -31,7 +31,8 @@
 				<Option type="1" />
 				<Option compiler="gcc" />
 				<Compiler>
-					<Add option="-O3" />
+					<Add option="-fomit-frame-pointer" />
+					<Add option="-Os" />
 					<Add option="-Wall" />
 					<Add option="-DNDEBUG=1" />
 					<Add option="-DWITH_FULL_DAD_EXTRAS=1" />
@@ -369,6 +370,7 @@
 				<Compiler>
 					<Add option="-O3" />
 					<Add option="-Wall" />
+					<Add option="-flto" />
 					<Add option="-DNDEBUG=1" />
 					<Add option="-DWITH_FULL_DAD_EXTRAS=1" />
 					<Add option="-D_SQ64=1" />
@@ -381,6 +383,7 @@
 				</Compiler>
 				<Linker>
 					<Add option="-s" />
+					<Add option="-flto" />
 					<Add library="pthread" />
 					<Add library="rt" />
 					<Add library="dl" />
@@ -402,6 +405,7 @@
 					<Add option="-fexpensive-optimizations" />
 					<Add option="-O3" />
 					<Add option="-Wall" />
+					<Add option="-flto" />
 					<Add option="-DWITH_FLTK=1" />
 					<Add option="-DNDEBUG=1" />
 					<Add option="-DWITH_FULL_DAD_EXTRAS=1" />
@@ -419,6 +423,7 @@
 					<Add directory="../flu" />
 				</Compiler>
 				<Linker>
+					<Add option="-flto" />
 					<Add library="pthread" />
 					<Add library="rt" />
 					<Add library="dl" />
@@ -535,6 +540,7 @@
 					<Add option="-fexpensive-optimizations" />
 					<Add option="-O3" />
 					<Add option="-Wall" />
+					<Add option="-flto" />
 					<Add option="-DWITH_FLTK=1" />
 					<Add option="-DNDEBUG=1" />
 					<Add option="-DWITH_FULL_DAD_EXTRAS=1" />
@@ -550,6 +556,7 @@
 					<Add directory="../flu" />
 				</Compiler>
 				<Linker>
+					<Add option="-flto" />
 					<Add library="pthread" />
 					<Add library="rt" />
 					<Add library="dl" />
@@ -857,6 +864,66 @@
 					<Add directory="../libharu/src" />
 				</Linker>
 			</Target>
+			<Target title="Release 64bits Alone">
+				<Option output="bin/squilu-alone" prefix_auto="1" extension_auto="1" />
+				<Option object_output="obj/Release-alone/" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Option use_console_runner="0" />
+				<Compiler>
+					<Add option="-fomit-frame-pointer" />
+					<Add option="-Os" />
+					<Add option="-Wall" />
+					<Add option="-fno-rtti" />
+					<Add option="-fno-exceptions" />
+					<Add option="-flto" />
+					<Add option="-DSQUILU_ALONE=1" />
+					<Add option="-DNEED_SUBLATIN_C=1" />
+					<Add option="-DNDEBUG=1" />
+					<Add option="-DWITH_FULL_DAD_EXTRAS2=1" />
+					<Add option="-D_SQ64=1" />
+					<Add option="-DCONFIG_64=1" />
+					<Add option="-DHAS_UNIX_DOMAIN_SOCKETS=1" />
+					<Add option="-DUSE_SIGNAL_HANDLER=1" />
+					<Add option="-DWITH_MYSQL2=1" />
+					<Add option="-DWITH_POSTGRESQL2=1" />
+				</Compiler>
+				<Linker>
+					<Add option="-s" />
+					<Add option="-flto" />
+				</Linker>
+			</Target>
+			<Target title="Release 64bits dynlib">
+				<Option output="bin/squilu-alone" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).def" prefix_auto="1" extension_auto="1" />
+				<Option object_output="obj/Release-alone/" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-fno-rtti" />
+					<Add option="-fno-exceptions" />
+					<Add option="-fPIC" />
+					<Add option="-shared" />
+					<Add option="-DSQUILU_ALONE=1" />
+					<Add option="-DNEED_SUBLATIN_C=1" />
+					<Add option="-DNDEBUG=1" />
+					<Add option="-DWITH_FULL_DAD_EXTRAS2=1" />
+					<Add option="-D_SQ64=1" />
+					<Add option="-DCONFIG_64=1" />
+					<Add option="-DHAS_UNIX_DOMAIN_SOCKETS=1" />
+					<Add option="-DUSE_SIGNAL_HANDLER=1" />
+					<Add option="-DWITH_MYSQL2=1" />
+					<Add option="-DWITH_POSTGRESQL2=1" />
+					<Add directory="../../zeromq-3.2.2/include" />
+				</Compiler>
+				<Linker>
+					<Add option="-s" />
+					<Add option="-Wl,-E" />
+					<Add directory="../../zeromq-3.2.2" />
+					<Add directory="../fltk/lib" />
+				</Linker>
+			</Target>
 		</Build>
 		<Compiler>
 			<Add option="-std=c++11" />
@@ -908,6 +975,7 @@
 			<Add option="-DWITH_POSTGRESQL=1" />
 			<Add option="-DWITH_LIBCLANG=1" />
 			<Add option="-DWITH_MPDECIMAL=1" />
+			<Add option="-DSQ_USE_EASYCURL=1" />
 			<Add directory="include" />
 			<Add directory="sqstdlib" />
 			<Add directory="../myaxtls" />
@@ -923,6 +991,7 @@
 			<Add directory="../minizip" />
 			<Add directory="../unql/src" />
 			<Add directory="../../../local/clang-3.6/include" />
+			<Add directory="../../../local/include" />
 		</Compiler>
 		<Linker>
 			<Add library="m" />
@@ -936,9 +1005,56 @@
 			<Add directory="../mpdecimal" />
 			<Add directory="../discount" />
 			<Add directory="../gumbo" />
+			<Add directory="../../../local/lib" />
 		</Linker>
-		<Unit filename="../SquiLu-ext/HighResolutionTimer.cpp" />
-		<Unit filename="../SquiLu-ext/HighResolutionTimer.h" />
+		<Unit filename="../SquiLu-ext/HighResolutionTimer.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+			<Option target="Release alone" />
+			<Option target="Release alone wince" />
+			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
+			<Option target="Debug 64bits" />
+			<Option target="Release FLTK 64bits Lib" />
+			<Option target="Release FLTK 64bits Computed Gotos" />
+			<Option target="Release 64bits static Library" />
+			<Option target="Debug FLTK 64bits" />
+			<Option target="Debug FLTK 64bits asan" />
+			<Option target="Debug 64bits static Library" />
+			<Option target="Temp Code FLTK 64bits" />
+			<Option target="AST Debug FLTK 64bits" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/HighResolutionTimer.h">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+			<Option target="Release alone" />
+			<Option target="Release alone wince" />
+			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
+			<Option target="Debug 64bits" />
+			<Option target="Release FLTK 64bits Lib" />
+			<Option target="Release FLTK 64bits Computed Gotos" />
+			<Option target="Release 64bits static Library" />
+			<Option target="Debug FLTK 64bits" />
+			<Option target="Debug FLTK 64bits asan" />
+			<Option target="Debug 64bits static Library" />
+			<Option target="Temp Code FLTK 64bits" />
+			<Option target="AST Debug FLTK 64bits" />
+		</Unit>
 		<Unit filename="../SquiLu-ext/celibc.c">
 			<Option compilerVar="CC" />
 			<Option target="Release alone wince" />
@@ -952,11 +1068,79 @@
 			<Option compilerVar="CC" />
 			<Option target="Temp Code FLTK 64bits" />
 		</Unit>
-		<Unit filename="../SquiLu-ext/civetweb.h" />
+		<Unit filename="../SquiLu-ext/civetweb.h">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+			<Option target="Release alone" />
+			<Option target="Release alone wince" />
+			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
+			<Option target="Debug 64bits" />
+			<Option target="Release FLTK 64bits Lib" />
+			<Option target="Release FLTK 64bits Computed Gotos" />
+			<Option target="Release 64bits static Library" />
+			<Option target="Debug FLTK 64bits" />
+			<Option target="Debug FLTK 64bits asan" />
+			<Option target="Debug 64bits static Library" />
+			<Option target="Temp Code FLTK 64bits" />
+			<Option target="AST Debug FLTK 64bits" />
+		</Unit>
 		<Unit filename="../SquiLu-ext/code_mix_prep.c">
 			<Option compilerVar="CC" />
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+			<Option target="Release alone" />
+			<Option target="Release alone wince" />
+			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
+			<Option target="Debug 64bits" />
+			<Option target="Release FLTK 64bits Lib" />
+			<Option target="Release FLTK 64bits Computed Gotos" />
+			<Option target="Release 64bits static Library" />
+			<Option target="Debug FLTK 64bits" />
+			<Option target="Debug FLTK 64bits asan" />
+			<Option target="Debug 64bits static Library" />
+			<Option target="Temp Code FLTK 64bits" />
+			<Option target="AST Debug FLTK 64bits" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/dad_utils.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+			<Option target="Release alone" />
+			<Option target="Release alone wince" />
+			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
+			<Option target="Debug 64bits" />
+			<Option target="Release FLTK 64bits Lib" />
+			<Option target="Release FLTK 64bits Computed Gotos" />
+			<Option target="Release 64bits static Library" />
+			<Option target="Debug FLTK 64bits" />
+			<Option target="Debug FLTK 64bits asan" />
+			<Option target="Debug 64bits static Library" />
+			<Option target="Temp Code FLTK 64bits" />
+			<Option target="AST Debug FLTK 64bits" />
 		</Unit>
-		<Unit filename="../SquiLu-ext/dad_utils.cpp" />
 		<Unit filename="../SquiLu-ext/dynamic_library.cpp">
 			<Option target="Debug" />
 			<Option target="Release" />
@@ -1001,8 +1185,54 @@
 			<Option target="Temp Code FLTK 64bits" />
 			<Option target="AST Debug FLTK 64bits" />
 		</Unit>
-		<Unit filename="../SquiLu-ext/fpdf.cpp" />
-		<Unit filename="../SquiLu-ext/fpdf.h" />
+		<Unit filename="../SquiLu-ext/fpdf.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+			<Option target="Release alone" />
+			<Option target="Release alone wince" />
+			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
+			<Option target="Debug 64bits" />
+			<Option target="Release FLTK 64bits Lib" />
+			<Option target="Release FLTK 64bits Computed Gotos" />
+			<Option target="Release 64bits static Library" />
+			<Option target="Debug FLTK 64bits" />
+			<Option target="Debug FLTK 64bits asan" />
+			<Option target="Debug 64bits static Library" />
+			<Option target="Temp Code FLTK 64bits" />
+			<Option target="AST Debug FLTK 64bits" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/fpdf.h">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+			<Option target="Release alone" />
+			<Option target="Release alone wince" />
+			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
+			<Option target="Debug 64bits" />
+			<Option target="Release FLTK 64bits Lib" />
+			<Option target="Release FLTK 64bits Computed Gotos" />
+			<Option target="Release 64bits static Library" />
+			<Option target="Debug FLTK 64bits" />
+			<Option target="Debug FLTK 64bits asan" />
+			<Option target="Debug 64bits static Library" />
+			<Option target="Temp Code FLTK 64bits" />
+			<Option target="AST Debug FLTK 64bits" />
+		</Unit>
 		<Unit filename="../SquiLu-ext/lua_socket.cpp">
 			<Option target="Debug" />
 			<Option target="Release" />
@@ -1205,11 +1435,57 @@
 			<Option target="Temp Code FLTK 64bits" />
 			<Option target="AST Debug FLTK 64bits" />
 		</Unit>
-		<Unit filename="../SquiLu-ext/sq_dns_sd.cpp" />
+		<Unit filename="../SquiLu-ext/sq_dns_sd.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+			<Option target="Release alone" />
+			<Option target="Release alone wince" />
+			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
+			<Option target="Debug 64bits" />
+			<Option target="Release FLTK 64bits Lib" />
+			<Option target="Release FLTK 64bits Computed Gotos" />
+			<Option target="Release 64bits static Library" />
+			<Option target="Debug FLTK 64bits" />
+			<Option target="Debug FLTK 64bits asan" />
+			<Option target="Debug 64bits static Library" />
+			<Option target="Temp Code FLTK 64bits" />
+			<Option target="AST Debug FLTK 64bits" />
+		</Unit>
 		<Unit filename="../SquiLu-ext/sq_fastcgi.cpp">
 			<Option target="&lt;{~None~}&gt;" />
 		</Unit>
-		<Unit filename="../SquiLu-ext/sq_ffi.cpp" />
+		<Unit filename="../SquiLu-ext/sq_ffi.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+			<Option target="Release alone" />
+			<Option target="Release alone wince" />
+			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
+			<Option target="Debug 64bits" />
+			<Option target="Release FLTK 64bits Lib" />
+			<Option target="Release FLTK 64bits Computed Gotos" />
+			<Option target="Release 64bits static Library" />
+			<Option target="Debug FLTK 64bits" />
+			<Option target="Debug FLTK 64bits asan" />
+			<Option target="Debug 64bits static Library" />
+			<Option target="Temp Code FLTK 64bits" />
+			<Option target="AST Debug FLTK 64bits" />
+		</Unit>
 		<Unit filename="../SquiLu-ext/sq_fltk.cpp">
 			<Option target="Debug" />
 			<Option target="Release" />
@@ -1232,7 +1508,30 @@
 			<Option target="Temp Code FLTK 64bits" />
 			<Option target="AST Debug FLTK 64bits" />
 		</Unit>
-		<Unit filename="../SquiLu-ext/sq_fpdf.cpp" />
+		<Unit filename="../SquiLu-ext/sq_fpdf.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+			<Option target="Release alone" />
+			<Option target="Release alone wince" />
+			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
+			<Option target="Debug 64bits" />
+			<Option target="Release FLTK 64bits Lib" />
+			<Option target="Release FLTK 64bits Computed Gotos" />
+			<Option target="Release 64bits static Library" />
+			<Option target="Debug FLTK 64bits" />
+			<Option target="Debug FLTK 64bits asan" />
+			<Option target="Debug 64bits static Library" />
+			<Option target="Temp Code FLTK 64bits" />
+			<Option target="AST Debug FLTK 64bits" />
+		</Unit>
 		<Unit filename="../SquiLu-ext/sq_fs.c">
 			<Option compilerVar="CC" />
 			<Option target="Debug" />
@@ -1256,8 +1555,78 @@
 			<Option target="Temp Code FLTK 64bits" />
 			<Option target="AST Debug FLTK 64bits" />
 		</Unit>
-		<Unit filename="../SquiLu-ext/sq_gumbo.cpp" />
-		<Unit filename="../SquiLu-ext/sq_libclang.cpp" />
+		<Unit filename="../SquiLu-ext/sq_gumbo.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+			<Option target="Release alone" />
+			<Option target="Release alone wince" />
+			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
+			<Option target="Debug 64bits" />
+			<Option target="Release FLTK 64bits Lib" />
+			<Option target="Release FLTK 64bits Computed Gotos" />
+			<Option target="Release 64bits static Library" />
+			<Option target="Debug FLTK 64bits" />
+			<Option target="Debug FLTK 64bits asan" />
+			<Option target="Debug 64bits static Library" />
+			<Option target="Temp Code FLTK 64bits" />
+			<Option target="AST Debug FLTK 64bits" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sq_libclang.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+			<Option target="Release alone" />
+			<Option target="Release alone wince" />
+			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
+			<Option target="Debug 64bits" />
+			<Option target="Release FLTK 64bits Lib" />
+			<Option target="Release FLTK 64bits Computed Gotos" />
+			<Option target="Release 64bits static Library" />
+			<Option target="Debug FLTK 64bits" />
+			<Option target="Debug FLTK 64bits asan" />
+			<Option target="Debug 64bits static Library" />
+			<Option target="Temp Code FLTK 64bits" />
+			<Option target="AST Debug FLTK 64bits" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sq_libcurl.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+			<Option target="Release alone" />
+			<Option target="Release alone wince" />
+			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
+			<Option target="Debug 64bits" />
+			<Option target="Release FLTK 64bits Lib" />
+			<Option target="Release FLTK 64bits Computed Gotos" />
+			<Option target="Release 64bits static Library" />
+			<Option target="Debug FLTK 64bits" />
+			<Option target="Debug FLTK 64bits asan" />
+			<Option target="Debug 64bits static Library" />
+			<Option target="Temp Code FLTK 64bits" />
+			<Option target="AST Debug FLTK 64bits" />
+		</Unit>
 		<Unit filename="../SquiLu-ext/sq_markdown.cpp">
 			<Option target="Debug" />
 			<Option target="Release" />
@@ -1323,9 +1692,54 @@
 			<Option target="Temp Code FLTK 64bits" />
 			<Option target="AST Debug FLTK 64bits" />
 		</Unit>
-		<Unit filename="../SquiLu-ext/sq_mysql.cpp" />
+		<Unit filename="../SquiLu-ext/sq_mysql.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+			<Option target="Release alone" />
+			<Option target="Release alone wince" />
+			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
+			<Option target="Debug 64bits" />
+			<Option target="Release FLTK 64bits Lib" />
+			<Option target="Release FLTK 64bits Computed Gotos" />
+			<Option target="Release 64bits static Library" />
+			<Option target="Debug FLTK 64bits" />
+			<Option target="Debug FLTK 64bits asan" />
+			<Option target="Debug 64bits static Library" />
+			<Option target="Temp Code FLTK 64bits" />
+			<Option target="AST Debug FLTK 64bits" />
+		</Unit>
 		<Unit filename="../SquiLu-ext/sq_openssl.cpp">
 			<Option compilerVar="CC" />
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+			<Option target="Release alone" />
+			<Option target="Release alone wince" />
+			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
+			<Option target="Debug 64bits" />
+			<Option target="Release FLTK 64bits Lib" />
+			<Option target="Release FLTK 64bits Computed Gotos" />
+			<Option target="Release 64bits static Library" />
+			<Option target="Debug FLTK 64bits" />
+			<Option target="Debug FLTK 64bits asan" />
+			<Option target="Debug 64bits static Library" />
+			<Option target="Temp Code FLTK 64bits" />
+			<Option target="AST Debug FLTK 64bits" />
 		</Unit>
 		<Unit filename="../SquiLu-ext/sq_parsecsv.cpp">
 			<Option target="Debug" />
@@ -1458,7 +1872,30 @@
 			<Option target="Temp Code FLTK 64bits" />
 			<Option target="AST Debug FLTK 64bits" />
 		</Unit>
-		<Unit filename="../SquiLu-ext/sq_sqlite3.h" />
+		<Unit filename="../SquiLu-ext/sq_sqlite3.h">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+			<Option target="Release alone" />
+			<Option target="Release alone wince" />
+			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
+			<Option target="Debug 64bits" />
+			<Option target="Release FLTK 64bits Lib" />
+			<Option target="Release FLTK 64bits Computed Gotos" />
+			<Option target="Release 64bits static Library" />
+			<Option target="Debug FLTK 64bits" />
+			<Option target="Debug FLTK 64bits asan" />
+			<Option target="Debug 64bits static Library" />
+			<Option target="Temp Code FLTK 64bits" />
+			<Option target="AST Debug FLTK 64bits" />
+		</Unit>
 		<Unit filename="../SquiLu-ext/sq_sys.cpp">
 			<Option target="&lt;{~None~}&gt;" />
 		</Unit>
@@ -1484,7 +1921,30 @@
 			<Option target="Temp Code FLTK 64bits" />
 			<Option target="AST Debug FLTK 64bits" />
 		</Unit>
-		<Unit filename="../SquiLu-ext/sq_unql.cpp" />
+		<Unit filename="../SquiLu-ext/sq_unql.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+			<Option target="Release alone" />
+			<Option target="Release alone wince" />
+			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
+			<Option target="Debug 64bits" />
+			<Option target="Release FLTK 64bits Lib" />
+			<Option target="Release FLTK 64bits Computed Gotos" />
+			<Option target="Release 64bits static Library" />
+			<Option target="Debug FLTK 64bits" />
+			<Option target="Debug FLTK 64bits asan" />
+			<Option target="Debug 64bits static Library" />
+			<Option target="Temp Code FLTK 64bits" />
+			<Option target="AST Debug FLTK 64bits" />
+		</Unit>
 		<Unit filename="../SquiLu-ext/sq_zlib.cpp">
 			<Option target="Debug" />
 			<Option target="Release" />
@@ -1698,6 +2158,7 @@
 			<Option target="Debug FLTK 64bits asan" />
 			<Option target="Temp Code FLTK 64bits" />
 			<Option target="AST Debug FLTK 64bits" />
+			<Option target="Release 64bits Alone" />
 		</Unit>
 		<Unit filename="sqstdlib/sqstdaux.cpp" />
 		<Unit filename="sqstdlib/sqstdblob.cpp" />
@@ -1742,6 +2203,8 @@
 			<Option target="Debug FLTK 64bits asan" />
 			<Option target="Debug 64bits static Library" />
 			<Option target="Temp Code FLTK 64bits" />
+			<Option target="Release 64bits Alone" />
+			<Option target="Release 64bits dynlib" />
 		</Unit>
 		<Unit filename="squirrel/sqcompiler.h" />
 		<Unit filename="squirrel/sqcompiler2.cpp">

+ 1 - 1
SquiLu/squirrel/sqapi.cpp

@@ -150,7 +150,7 @@ SQRESULT sq_compile(HSQUIRRELVM v,SQLEXREADFUNC read,SQUserPointer p,const SQCha
 	SQObjectPtr o;
 #ifndef NO_COMPILER
 	if(Compile(v, read, p, sourcename, o, raiseerror?true:false, _ss(v)->_debuginfo, show_warnings)) {
-		v->Push(SQClosure::Create(_ss(v), _funcproto(o)));
+		v->Push(SQClosure::Create(_ss(v), _funcproto(o), _table(v->_roottable)->GetWeakRef(OT_TABLE)));
 		return SQ_OK;
 	}
 	return SQ_ERROR;

+ 32 - 24
SquiLu/squirrel/sqclosure.h

@@ -10,14 +10,16 @@ struct SQClass;
 struct SQClosure : public CHAINABLE_OBJ
 {
 private:
-	SQClosure(SQSharedState *ss,SQFunctionProto *func){_function = func; __ObjAddRef(_function); _base = NULL; INIT_CHAIN();ADD_TO_CHAIN(&_ss(this)->_gc_chain,this); _env = NULL;}
+    SQClosure(SQSharedState *ss,SQFunctionProto *func){_function = func; __ObjAddRef(_function); _base = NULL; INIT_CHAIN();ADD_TO_CHAIN(&_ss(this)->_gc_chain,this); _env = NULL; _root=NULL;}
 public:
-	static SQClosure *Create(SQSharedState *ss,SQFunctionProto *func){
-		SQInteger size = _CALC_CLOSURE_SIZE(func);
-		SQClosure *nc=(SQClosure*)SQ_MALLOC(size);
-		new (nc) SQClosure(ss,func);
-		nc->_outervalues = (SQObjectPtr *)(nc + 1);
-		nc->_defaultparams = &nc->_outervalues[func->_noutervalues];
+    static SQClosure *Create(SQSharedState *ss,SQFunctionProto *func,SQWeakRef *root){
+        SQInteger size = _CALC_CLOSURE_SIZE(func);
+        SQClosure *nc=(SQClosure*)SQ_MALLOC(size);
+        new (nc) SQClosure(ss,func);
+        nc->_outervalues = (SQObjectPtr *)(nc + 1);
+        nc->_defaultparams = &nc->_outervalues[func->_noutervalues];
+        nc->_root = root;
+        __ObjAddRef(nc->_root);
 		_CONSTRUCT_VECTOR(SQObjectPtr,func->_noutervalues,nc->_outervalues);
 		_CONSTRUCT_VECTOR(SQObjectPtr,func->_ndefaultparams,nc->_defaultparams);
 		return nc;
@@ -31,18 +33,23 @@ public:
 		this->~SQClosure();
 		sq_vm_free(this,size);
 	}
-
-	SQClosure *Clone()
-	{
-		SQFunctionProto *f = _function;
-		SQClosure * ret = SQClosure::Create(_opt_ss(this),f);
-		ret->_env = _env;
-		if(ret->_env) __ObjAddRef(ret->_env);
-		_COPY_VECTOR(ret->_outervalues,_outervalues,f->_noutervalues);
-		_COPY_VECTOR(ret->_defaultparams,_defaultparams,f->_ndefaultparams);
-		return ret;
-	}
-	~SQClosure();
+    void SetRoot(SQWeakRef *r)
+    {
+        __ObjRelease(_root);
+        _root = r;
+        __ObjAddRef(_root);
+    }
+    SQClosure *Clone()
+    {
+        SQFunctionProto *f = _function;
+        SQClosure * ret = SQClosure::Create(_opt_ss(this),f,_root);
+        ret->_env = _env;
+        if(ret->_env) __ObjAddRef(ret->_env);
+        _COPY_VECTOR(ret->_outervalues,_outervalues,f->_noutervalues);
+        _COPY_VECTOR(ret->_defaultparams,_defaultparams,f->_ndefaultparams);
+        return ret;
+    }
+    ~SQClosure();
 
 	bool Save(SQVM *v,SQUserPointer up,SQWRITEFUNC write);
 	bool SaveAsSource(SQVM *v,SQUserPointer up,SQWRITEFUNC write);
@@ -56,11 +63,12 @@ public:
 	}
 	SQObjectType GetType() {return OT_CLOSURE;}
 #endif
-	SQWeakRef *_env;
-	SQClass *_base;
-	SQFunctionProto *_function;
-	SQObjectPtr *_outervalues;
-	SQObjectPtr *_defaultparams;
+    SQWeakRef *_env;
+    SQWeakRef *_root;
+    SQClass *_base;
+    SQFunctionProto *_function;
+    SQObjectPtr *_outervalues;
+    SQObjectPtr *_defaultparams;
 };
 
 //////////////////////////////////////////////

+ 2 - 0
SquiLu/squirrel/sqcompiler.cpp

@@ -808,6 +808,8 @@ public:
         {
             id = _fs->CreateString(_lex._svalue);
         }
+        else id = {};
+
 		LogicalOrExp();
 		switch(_token)  {
 		case _SC('='):

+ 2 - 1
SquiLu/squirrel/sqobject.cpp

@@ -454,7 +454,8 @@ bool SQClosure::Load(SQVM *v,SQUserPointer up,SQREADFUNC read,SQObjectPtr &ret)
 	SQObjectPtr func;
 	_CHECK_IO(SQFunctionProto::Load(v,up,read,func));
 	_CHECK_IO(CheckTag(v,read,up,SQ_CLOSURESTREAM_TAIL));
-	ret = SQClosure::Create(_ss(v),_funcproto(func));
+    ret = SQClosure::Create(_ss(v),_funcproto(func),_table(v->_roottable)->GetWeakRef(OT_TABLE));
+    //FIXME: load an root for this closure
 	return true;
 }
 

+ 2 - 0
SquiLu/squirrel/sqstate.h

@@ -60,11 +60,13 @@ private:
 
 struct SQObjectPtr;
 
+#ifdef SQ_WITH_DELAYED_RELEASE_HOOKS
 struct SQDelayedReleseHook {
     SQRELEASEHOOK hook;
     SQUserPointer ptr;
     SQInteger size;
 };
+#endif // SQ_WITH_DELAYED_RELEASE_HOOKS
 
 struct SQSharedState
 {

+ 1 - 1
SquiLu/squirrel/sqvm.cpp

@@ -627,7 +627,7 @@ bool SQVM::FOREACH_OP(SQObjectPtr &o1,SQObjectPtr &o2,SQObjectPtr
 bool SQVM::CLOSURE_OP(SQObjectPtr &target, SQFunctionProto *func)
 {
 	SQInteger nouters;
-	SQClosure *closure = SQClosure::Create(_ss(this), func);
+	SQClosure *closure = SQClosure::Create(_ss(this), func,_table(_roottable)->GetWeakRef(OT_TABLE));
 	if((nouters = func->_noutervalues)) {
 		for(SQInteger i = 0; i<nouters; i++) {
 			SQOuterVar &v = func->_outervalues[i];