Various improvements
This commit is contained in:
parent
b115b84dd1
commit
2fb3522470
@ -1,39 +1,42 @@
|
|||||||
cmake_minimum_required(VERSION 2.8)
|
if(MSVC)
|
||||||
project(squirrel)
|
cmake_minimum_required(VERSION 3.4)
|
||||||
|
else()
|
||||||
# get machine
|
cmake_minimum_required(VERSION 2.8)
|
||||||
execute_process( COMMAND ${CMAKE_C_COMPILER} -dumpmachine OUTPUT_VARIABLE DUMP_MACHINE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
endif()
|
||||||
message("Dump Machine : ${DUMP_MACHINE}")
|
|
||||||
|
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}" CACHE PATH "")
|
||||||
# get architecture
|
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "")
|
||||||
if(NOT DEFINED ARCHITECTURE)
|
|
||||||
string(FIND ${DUMP_MACHINE} "-" DUMP_MACHINE_STRIP)
|
project(squirrel C CXX)
|
||||||
string(SUBSTRING ${DUMP_MACHINE} 0 ${DUMP_MACHINE_STRIP} ARCHITECTURE)
|
|
||||||
endif()
|
include_directories(${CMAKE_SOURCE_DIR}/include)
|
||||||
message("Architecture : ${ARCHITECTURE}")
|
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
# global includes
|
set(SQ_FLAGS -fno-exceptions -fno-strict-aliasing -Wall -Wextra)
|
||||||
include_directories(
|
|
||||||
${PROJECT_SOURCE_DIR}/include
|
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||||
)
|
set(SQ_FLAGS ${SQ_FLAGS} -O3)
|
||||||
|
else()
|
||||||
# global flags
|
set(SQ_FLAGS ${SQ_FLAGS} -pg -pie -gstabs -g3)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti -Wall -fno-strict-aliasing")
|
endif()
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-exceptions -Wall -fno-strict-aliasing")
|
|
||||||
|
if(CMAKE_VERSION VERSION_GREATER 3)
|
||||||
set(SQGLOB_FLAGS_RELEASE "-O2")
|
add_compile_options(${SQ_FLAGS})
|
||||||
set(SQGLOB_FLAGS_DEBUG "-pg -pie -gstabs -g3")
|
else()
|
||||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${SQGLOB_FLAGS_RELEASE}")
|
add_definitions(${SQ_FLAGS})
|
||||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_DEBUG} ${SQGLOB_FLAGS_DEBUG}")
|
endif()
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${SQGLOB_FLAGS_RELEASE}")
|
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_DEBUG} ${SQGLOB_FLAGS_DEBUG}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
|
||||||
|
elseif(MSVC)
|
||||||
if("${ARCHITECTURE}" STREQUAL "x86_64")
|
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_SQ64")
|
endif()
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_SQ64")
|
|
||||||
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
add_definitions(-D_SQ64)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# subdirectories
|
|
||||||
add_subdirectory(squirrel)
|
add_subdirectory(squirrel)
|
||||||
add_subdirectory(sqstdlib)
|
add_subdirectory(sqstdlib)
|
||||||
add_subdirectory(sq)
|
add_subdirectory(sq)
|
||||||
|
|
||||||
|
install(FILES doc/squirrel3.pdf doc/sqstdlib3.pdf DESTINATION share/doc/squirrel3)
|
||||||
|
23
COMPILE
23
COMPILE
@ -23,6 +23,29 @@ samples
|
|||||||
|
|
||||||
HOW TO COMPILE
|
HOW TO COMPILE
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
|
CMAKE USERS
|
||||||
|
.........................................................
|
||||||
|
If you want to build the shared libraries under Windows using Visual
|
||||||
|
Studio, you will have to use CMake version 3.4 or newer. If not, an
|
||||||
|
earlier version will suffice. For a traditional out-of-source build
|
||||||
|
under Linux, type something like
|
||||||
|
|
||||||
|
$ mkdir build # Create temporary build directory
|
||||||
|
$ cd build
|
||||||
|
$ cmake .. # CMake will determine all the necessary information,
|
||||||
|
# including the platform (32- vs. 64-Bit)
|
||||||
|
$ make
|
||||||
|
$ make install
|
||||||
|
$ cd ..; rm -r build
|
||||||
|
|
||||||
|
The default installation directory will be the top source directory,
|
||||||
|
i. e. the binaries will go into bin/ and the libraries into lib/. You
|
||||||
|
can change this behavior by calling CMake like this:
|
||||||
|
|
||||||
|
$ cmake .. -DCMAKE_INSTALL_PREFIX=/some/path/on/your/system
|
||||||
|
|
||||||
|
Under Windows, it is probably easiest to use the CMake GUI interface.
|
||||||
|
|
||||||
GCC USERS
|
GCC USERS
|
||||||
.........................................................
|
.........................................................
|
||||||
There is a very simple makefile that compiles all libraries and exes
|
There is a very simple makefile that compiles all libraries and exes
|
||||||
|
23
README
23
README
@ -1,16 +1,26 @@
|
|||||||
The programming language SQUIRREL 3.1 stable
|
The programming language SQUIRREL 3.1 stable
|
||||||
|
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
The project has been compiled and run on Windows(x86 and x64) and
|
This project has successfully been compiled and run on
|
||||||
Linux(x86 and x64) and Solaris(x86 and x64).
|
* Windows (x86 and amd64)
|
||||||
|
* Linux (x86, amd64 and ARM)
|
||||||
|
* Solaris (x86 and amd64)
|
||||||
|
|
||||||
Has been tested with the following compilers:
|
The following compilers have been confirmed to be working:
|
||||||
MS Visual C++ 6.0,7.0,7.1,8.0,9.0,10.0 (32 and 64bits)
|
MS Visual C++ 6.0 (all on x86 and amd64)
|
||||||
|
7.0 |
|
||||||
|
7.1 v
|
||||||
|
8.0
|
||||||
|
9.0
|
||||||
|
10.0 ---
|
||||||
|
12.0 (only on x86)
|
||||||
MinGW gcc 3.2 (mingw special 20020817-1)
|
MinGW gcc 3.2 (mingw special 20020817-1)
|
||||||
Cygnus gcc 3.2
|
Cygnus gcc 3.2
|
||||||
Linux gcc 3.2.3
|
Linux gcc 3.2.3
|
||||||
Linux gcc 4.0.0 (x86 & 64bits)
|
4.0.0 (x86 and amd64)
|
||||||
Solaris gcc 4.0.0 (x86 & 64bits)
|
5.3.1 (amd64)
|
||||||
|
Solaris gcc 4.0.0 (x86 and amd64)
|
||||||
|
ARM Linux gcc 4.6.3 (Raspberry Pi Model B)
|
||||||
|
|
||||||
|
|
||||||
Feedback and suggestions are appreciated
|
Feedback and suggestions are appreciated
|
||||||
@ -20,4 +30,3 @@ wiki - http://wiki.squirrel-lang.org
|
|||||||
author - alberto@demichelis.net
|
author - alberto@demichelis.net
|
||||||
|
|
||||||
END OF README
|
END OF README
|
||||||
|
|
||||||
|
@ -392,6 +392,12 @@ SQUIRREL_API void sq_setnativedebughook(HSQUIRRELVM v,SQDEBUGHOOK hook);
|
|||||||
#define SQ_FAILED(res) (res<0)
|
#define SQ_FAILED(res) (res<0)
|
||||||
#define SQ_SUCCEEDED(res) (res>=0)
|
#define SQ_SUCCEEDED(res) (res>=0)
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
# define SQ_UNUSED_ARG(x) __attribute__((unused)) x
|
||||||
|
#else
|
||||||
|
# define SQ_UNUSED_ARG(x) x
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /*extern "C"*/
|
} /*extern "C"*/
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,22 +1,14 @@
|
|||||||
cmake_minimum_required(VERSION 2.8)
|
add_executable(sq sq.c)
|
||||||
project(libsquirrel)
|
set_target_properties(sq PROPERTIES LINKER_LANGUAGE C)
|
||||||
|
target_link_libraries(sq squirrel sqstd)
|
||||||
|
install(TARGETS sq RUNTIME DESTINATION bin)
|
||||||
|
|
||||||
# sources
|
add_executable(sq_static sq.c)
|
||||||
set(SQ_SRCS
|
set_target_properties(sq_static PROPERTIES LINKER_LANGUAGE C)
|
||||||
sq.c
|
target_link_libraries(sq_static squirrel_static sqstd_static)
|
||||||
)
|
|
||||||
|
|
||||||
# libs
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
set(SQ_LIBS
|
set_target_properties(sq_static PROPERTIES COMPILE_FLAGS "-static -Wl,-static")
|
||||||
sqstd
|
endif()
|
||||||
squirrel
|
|
||||||
)
|
|
||||||
|
|
||||||
# shared lib
|
install(TARGETS sq_static RUNTIME DESTINATION bin)
|
||||||
add_executable(sq ${SQ_SRCS})
|
|
||||||
target_link_libraries(sq ${SQ_LIBS})
|
|
||||||
|
|
||||||
# static lib
|
|
||||||
add_executable(sq_static ${SQ_SRCS})
|
|
||||||
set_target_properties(sq_static PROPERTIES COMPILE_FLAGS "-static -Wl,-static")
|
|
||||||
target_link_libraries(sq_static ${SQ_LIBS})
|
|
||||||
|
8
sq/sq.c
8
sq/sq.c
@ -46,7 +46,7 @@ SQInteger quit(HSQUIRRELVM v)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void printfunc(HSQUIRRELVM v,const SQChar *s,...)
|
void printfunc(HSQUIRRELVM SQ_UNUSED_ARG(v),const SQChar *s,...)
|
||||||
{
|
{
|
||||||
va_list vl;
|
va_list vl;
|
||||||
va_start(vl, s);
|
va_start(vl, s);
|
||||||
@ -54,7 +54,7 @@ void printfunc(HSQUIRRELVM v,const SQChar *s,...)
|
|||||||
va_end(vl);
|
va_end(vl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void errorfunc(HSQUIRRELVM v,const SQChar *s,...)
|
void errorfunc(HSQUIRRELVM SQ_UNUSED_ARG(v),const SQChar *s,...)
|
||||||
{
|
{
|
||||||
va_list vl;
|
va_list vl;
|
||||||
va_start(vl, s);
|
va_start(vl, s);
|
||||||
@ -87,10 +87,7 @@ int getargs(HSQUIRRELVM v,int argc, char* argv[],SQInteger *retval)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int compiles_only = 0;
|
int compiles_only = 0;
|
||||||
static SQChar temp[500];
|
|
||||||
const SQChar *ret=NULL;
|
|
||||||
char * output = NULL;
|
char * output = NULL;
|
||||||
int lineinfo=0;
|
|
||||||
*retval = 0;
|
*retval = 0;
|
||||||
if(argc>1)
|
if(argc>1)
|
||||||
{
|
{
|
||||||
@ -307,7 +304,6 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
HSQUIRRELVM v;
|
HSQUIRRELVM v;
|
||||||
SQInteger retval = 0;
|
SQInteger retval = 0;
|
||||||
const SQChar *filename=NULL;
|
|
||||||
#if defined(_MSC_VER) && defined(_DEBUG)
|
#if defined(_MSC_VER) && defined(_DEBUG)
|
||||||
_CrtSetAllocHook(MemAllocHook);
|
_CrtSetAllocHook(MemAllocHook);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,20 +1,15 @@
|
|||||||
cmake_minimum_required(VERSION 2.8)
|
set(SQSTD_SRC sqstdblob.cpp
|
||||||
project(sqstd)
|
sqstdio.cpp
|
||||||
|
sqstdstream.cpp
|
||||||
|
sqstdmath.cpp
|
||||||
|
sqstdsystem.cpp
|
||||||
|
sqstdstring.cpp
|
||||||
|
sqstdaux.cpp
|
||||||
|
sqstdrex.cpp)
|
||||||
|
|
||||||
# sources
|
add_library(sqstd SHARED ${SQSTD_SRC})
|
||||||
set(SQSTD_SRCS
|
target_link_libraries(sqstd squirrel)
|
||||||
sqstdblob.cpp
|
install(TARGETS sqstd LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||||||
sqstdio.cpp
|
|
||||||
sqstdstream.cpp
|
|
||||||
sqstdmath.cpp
|
|
||||||
sqstdsystem.cpp
|
|
||||||
sqstdstring.cpp
|
|
||||||
sqstdaux.cpp
|
|
||||||
sqstdrex.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
# shared lib
|
add_library(sqstd_static STATIC ${SQSTD_SRC})
|
||||||
add_library(sqstd SHARED ${SQSTD_SRCS})
|
install(TARGETS sqstd_static ARCHIVE DESTINATION lib)
|
||||||
|
|
||||||
# static lib
|
|
||||||
add_library(sqstd_static STATIC ${SQSTD_SRCS})
|
|
||||||
|
@ -114,7 +114,7 @@ static SQInteger _blob__typeof(HSQUIRRELVM v)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SQInteger _blob_releasehook(SQUserPointer p, SQInteger size)
|
static SQInteger _blob_releasehook(SQUserPointer p, SQInteger SQ_UNUSED_ARG(size))
|
||||||
{
|
{
|
||||||
SQBlob *self = (SQBlob*)p;
|
SQBlob *self = (SQBlob*)p;
|
||||||
self->~SQBlob();
|
self->~SQBlob();
|
||||||
@ -230,7 +230,7 @@ static const SQRegFunction bloblib_funcs[]={
|
|||||||
_DECL_GLOBALBLOB_FUNC(swap2,2,_SC(".n")),
|
_DECL_GLOBALBLOB_FUNC(swap2,2,_SC(".n")),
|
||||||
_DECL_GLOBALBLOB_FUNC(swap4,2,_SC(".n")),
|
_DECL_GLOBALBLOB_FUNC(swap4,2,_SC(".n")),
|
||||||
_DECL_GLOBALBLOB_FUNC(swapfloat,2,_SC(".n")),
|
_DECL_GLOBALBLOB_FUNC(swapfloat,2,_SC(".n")),
|
||||||
{0,0}
|
{0,0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
SQRESULT sqstd_getblob(HSQUIRRELVM v,SQInteger idx,SQUserPointer *ptr)
|
SQRESULT sqstd_getblob(HSQUIRRELVM v,SQInteger idx,SQUserPointer *ptr)
|
||||||
|
@ -115,7 +115,7 @@ static SQInteger _file__typeof(HSQUIRRELVM v)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SQInteger _file_releasehook(SQUserPointer p, SQInteger size)
|
static SQInteger _file_releasehook(SQUserPointer p, SQInteger SQ_UNUSED_ARG(size))
|
||||||
{
|
{
|
||||||
SQFile *self = (SQFile*)p;
|
SQFile *self = (SQFile*)p;
|
||||||
self->~SQFile();
|
self->~SQFile();
|
||||||
@ -463,7 +463,7 @@ static const SQRegFunction iolib_funcs[]={
|
|||||||
_DECL_GLOBALIO_FUNC(loadfile,-2,_SC(".sb")),
|
_DECL_GLOBALIO_FUNC(loadfile,-2,_SC(".sb")),
|
||||||
_DECL_GLOBALIO_FUNC(dofile,-2,_SC(".sb")),
|
_DECL_GLOBALIO_FUNC(dofile,-2,_SC(".sb")),
|
||||||
_DECL_GLOBALIO_FUNC(writeclosuretofile,3,_SC(".sc")),
|
_DECL_GLOBALIO_FUNC(writeclosuretofile,3,_SC(".sc")),
|
||||||
{0,0}
|
{0,0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
SQRESULT sqstd_register_iolib(HSQUIRRELVM v)
|
SQRESULT sqstd_register_iolib(HSQUIRRELVM v)
|
||||||
|
@ -78,7 +78,7 @@ static const SQRegFunction mathlib_funcs[] = {
|
|||||||
_DECL_FUNC(rand,1,NULL),
|
_DECL_FUNC(rand,1,NULL),
|
||||||
_DECL_FUNC(fabs,2,_SC(".n")),
|
_DECL_FUNC(fabs,2,_SC(".n")),
|
||||||
_DECL_FUNC(abs,2,_SC(".n")),
|
_DECL_FUNC(abs,2,_SC(".n")),
|
||||||
{0,0},
|
{0,0,0,0},
|
||||||
};
|
};
|
||||||
#undef _DECL_FUNC
|
#undef _DECL_FUNC
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ static const SQRegFunction _stream_methods[] = {
|
|||||||
_DECL_STREAM_FUNC(eos,1,_SC("x")),
|
_DECL_STREAM_FUNC(eos,1,_SC("x")),
|
||||||
_DECL_STREAM_FUNC(flush,1,_SC("x")),
|
_DECL_STREAM_FUNC(flush,1,_SC("x")),
|
||||||
_DECL_STREAM_FUNC(_cloned,0,NULL),
|
_DECL_STREAM_FUNC(_cloned,0,NULL),
|
||||||
{0,0}
|
{0,0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
void init_streamclass(HSQUIRRELVM v)
|
void init_streamclass(HSQUIRRELVM v)
|
||||||
|
@ -350,7 +350,7 @@ static SQInteger _string_endswith(HSQUIRRELVM v)
|
|||||||
SQRex *self = NULL; \
|
SQRex *self = NULL; \
|
||||||
sq_getinstanceup(v,1,(SQUserPointer *)&self,0);
|
sq_getinstanceup(v,1,(SQUserPointer *)&self,0);
|
||||||
|
|
||||||
static SQInteger _rexobj_releasehook(SQUserPointer p, SQInteger size)
|
static SQInteger _rexobj_releasehook(SQUserPointer p, SQInteger SQ_UNUSED_ARG(size))
|
||||||
{
|
{
|
||||||
SQRex *self = ((SQRex *)p);
|
SQRex *self = ((SQRex *)p);
|
||||||
sqstd_rex_free(self);
|
sqstd_rex_free(self);
|
||||||
@ -452,7 +452,7 @@ static const SQRegFunction rexobj_funcs[]={
|
|||||||
_DECL_REX_FUNC(capture,-2,_SC("xsn")),
|
_DECL_REX_FUNC(capture,-2,_SC("xsn")),
|
||||||
_DECL_REX_FUNC(subexpcount,1,_SC("x")),
|
_DECL_REX_FUNC(subexpcount,1,_SC("x")),
|
||||||
_DECL_REX_FUNC(_typeof,1,_SC("x")),
|
_DECL_REX_FUNC(_typeof,1,_SC("x")),
|
||||||
{0,0}
|
{0,0,0,0}
|
||||||
};
|
};
|
||||||
#undef _DECL_REX_FUNC
|
#undef _DECL_REX_FUNC
|
||||||
|
|
||||||
@ -466,7 +466,7 @@ static const SQRegFunction stringlib_funcs[]={
|
|||||||
_DECL_FUNC(escape,2,_SC(".s")),
|
_DECL_FUNC(escape,2,_SC(".s")),
|
||||||
_DECL_FUNC(startswith,3,_SC(".ss")),
|
_DECL_FUNC(startswith,3,_SC(".ss")),
|
||||||
_DECL_FUNC(endswith,3,_SC(".ss")),
|
_DECL_FUNC(endswith,3,_SC(".ss")),
|
||||||
{0,0}
|
{0,0,0,0}
|
||||||
};
|
};
|
||||||
#undef _DECL_FUNC
|
#undef _DECL_FUNC
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ static const SQRegFunction systemlib_funcs[]={
|
|||||||
_DECL_FUNC(date,-1,_SC(".nn")),
|
_DECL_FUNC(date,-1,_SC(".nn")),
|
||||||
_DECL_FUNC(remove,2,_SC(".s")),
|
_DECL_FUNC(remove,2,_SC(".s")),
|
||||||
_DECL_FUNC(rename,3,_SC(".ss")),
|
_DECL_FUNC(rename,3,_SC(".ss")),
|
||||||
{0,0}
|
{0,0,0,0}
|
||||||
};
|
};
|
||||||
#undef _DECL_FUNC
|
#undef _DECL_FUNC
|
||||||
|
|
||||||
|
@ -1,24 +1,18 @@
|
|||||||
cmake_minimum_required(VERSION 2.8)
|
set(SQUIRREL_SRC sqapi.cpp
|
||||||
project(libsquirrel)
|
sqbaselib.cpp
|
||||||
|
sqfuncstate.cpp
|
||||||
|
sqdebug.cpp
|
||||||
|
sqlexer.cpp
|
||||||
|
sqobject.cpp
|
||||||
|
sqcompiler.cpp
|
||||||
|
sqstate.cpp
|
||||||
|
sqtable.cpp
|
||||||
|
sqmem.cpp
|
||||||
|
sqvm.cpp
|
||||||
|
sqclass.cpp)
|
||||||
|
|
||||||
# sources
|
add_library(squirrel SHARED ${SQUIRREL_SRC})
|
||||||
set(SQUIRREL_SRCS
|
install(TARGETS squirrel LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||||||
sqapi.cpp
|
|
||||||
sqbaselib.cpp
|
|
||||||
sqfuncstate.cpp
|
|
||||||
sqdebug.cpp
|
|
||||||
sqlexer.cpp
|
|
||||||
sqobject.cpp
|
|
||||||
sqcompiler.cpp
|
|
||||||
sqstate.cpp
|
|
||||||
sqtable.cpp
|
|
||||||
sqmem.cpp
|
|
||||||
sqvm.cpp
|
|
||||||
sqclass.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
# shared lib
|
add_library(squirrel_static STATIC ${SQUIRREL_SRC})
|
||||||
add_library(squirrel SHARED ${SQUIRREL_SRCS})
|
install(TARGETS squirrel_static ARCHIVE DESTINATION lib)
|
||||||
|
|
||||||
# static lib
|
|
||||||
add_library(squirrel_static STATIC ${SQUIRREL_SRCS})
|
|
||||||
|
@ -180,7 +180,7 @@ SQBool sq_release(HSQUIRRELVM v,HSQOBJECT *po)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
SQUnsignedInteger sq_getvmrefcount(HSQUIRRELVM v, const HSQOBJECT *po)
|
SQUnsignedInteger sq_getvmrefcount(HSQUIRRELVM SQ_UNUSED_ARG(v), const HSQOBJECT *po)
|
||||||
{
|
{
|
||||||
if (!ISREFCOUNTED(type(*po))) return 0;
|
if (!ISREFCOUNTED(type(*po))) return 0;
|
||||||
return po->_unVal.pRefCounted->_uiRef;
|
return po->_unVal.pRefCounted->_uiRef;
|
||||||
|
@ -40,7 +40,7 @@ static bool str2num(const SQChar *s,SQObjectPtr &res,SQInteger base)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SQInteger base_dummy(HSQUIRRELVM v)
|
static SQInteger base_dummy(HSQUIRRELVM SQ_UNUSED_ARG(v))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -296,7 +296,7 @@ static const SQRegFunction base_funcs[]={
|
|||||||
{_SC("collectgarbage"),base_collectgarbage,0, NULL},
|
{_SC("collectgarbage"),base_collectgarbage,0, NULL},
|
||||||
{_SC("resurrectunreachable"),base_resurectureachable,0, NULL},
|
{_SC("resurrectunreachable"),base_resurectureachable,0, NULL},
|
||||||
#endif
|
#endif
|
||||||
{0,0}
|
{0,0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
void sq_base_register(HSQUIRRELVM v)
|
void sq_base_register(HSQUIRRELVM v)
|
||||||
@ -475,7 +475,7 @@ const SQRegFunction SQSharedState::_table_default_delegate_funcz[]={
|
|||||||
{_SC("clear"),obj_clear,1, _SC(".")},
|
{_SC("clear"),obj_clear,1, _SC(".")},
|
||||||
{_SC("setdelegate"),table_setdelegate,2, _SC(".t|o")},
|
{_SC("setdelegate"),table_setdelegate,2, _SC(".t|o")},
|
||||||
{_SC("getdelegate"),table_getdelegate,1, _SC(".")},
|
{_SC("getdelegate"),table_getdelegate,1, _SC(".")},
|
||||||
{0,0}
|
{0,0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
//ARRAY DEFAULT DELEGATE///////////////////////////////////////
|
//ARRAY DEFAULT DELEGATE///////////////////////////////////////
|
||||||
@ -721,7 +721,7 @@ static bool _hsort_sift_down(HSQUIRRELVM v,SQArray *arr, SQInteger root, SQInteg
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool _hsort(HSQUIRRELVM v,SQObjectPtr &arr, SQInteger l, SQInteger r,SQInteger func)
|
static bool _hsort(HSQUIRRELVM v,SQObjectPtr &arr, SQInteger SQ_UNUSED_ARG(l), SQInteger SQ_UNUSED_ARG(r),SQInteger func)
|
||||||
{
|
{
|
||||||
SQArray *a = _array(arr);
|
SQArray *a = _array(arr);
|
||||||
SQInteger i;
|
SQInteger i;
|
||||||
@ -794,7 +794,7 @@ const SQRegFunction SQSharedState::_array_default_delegate_funcz[]={
|
|||||||
{_SC("reduce"),array_reduce,2, _SC("ac")},
|
{_SC("reduce"),array_reduce,2, _SC("ac")},
|
||||||
{_SC("filter"),array_filter,2, _SC("ac")},
|
{_SC("filter"),array_filter,2, _SC("ac")},
|
||||||
{_SC("find"),array_find,2, _SC("a.")},
|
{_SC("find"),array_find,2, _SC("a.")},
|
||||||
{0,0}
|
{0,0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
//STRING DEFAULT DELEGATE//////////////////////////
|
//STRING DEFAULT DELEGATE//////////////////////////
|
||||||
@ -863,7 +863,7 @@ const SQRegFunction SQSharedState::_string_default_delegate_funcz[]={
|
|||||||
{_SC("tolower"),string_tolower,-1, _SC("s n n")},
|
{_SC("tolower"),string_tolower,-1, _SC("s n n")},
|
||||||
{_SC("toupper"),string_toupper,-1, _SC("s n n")},
|
{_SC("toupper"),string_toupper,-1, _SC("s n n")},
|
||||||
{_SC("weakref"),obj_delegate_weakref,1, NULL },
|
{_SC("weakref"),obj_delegate_weakref,1, NULL },
|
||||||
{0,0}
|
{0,0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
//INTEGER DEFAULT DELEGATE//////////////////////////
|
//INTEGER DEFAULT DELEGATE//////////////////////////
|
||||||
@ -873,7 +873,7 @@ const SQRegFunction SQSharedState::_number_default_delegate_funcz[]={
|
|||||||
{_SC("tostring"),default_delegate_tostring,1, _SC(".")},
|
{_SC("tostring"),default_delegate_tostring,1, _SC(".")},
|
||||||
{_SC("tochar"),number_delegate_tochar,1, _SC("n|b")},
|
{_SC("tochar"),number_delegate_tochar,1, _SC("n|b")},
|
||||||
{_SC("weakref"),obj_delegate_weakref,1, NULL },
|
{_SC("weakref"),obj_delegate_weakref,1, NULL },
|
||||||
{0,0}
|
{0,0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
//CLOSURE DEFAULT DELEGATE//////////////////////////
|
//CLOSURE DEFAULT DELEGATE//////////////////////////
|
||||||
@ -983,7 +983,7 @@ const SQRegFunction SQSharedState::_closure_default_delegate_funcz[]={
|
|||||||
{_SC("getinfos"),closure_getinfos,1, _SC("c")},
|
{_SC("getinfos"),closure_getinfos,1, _SC("c")},
|
||||||
{_SC("getroot"),closure_getroot,1, _SC("c")},
|
{_SC("getroot"),closure_getroot,1, _SC("c")},
|
||||||
{_SC("setroot"),closure_setroot,2, _SC("ct")},
|
{_SC("setroot"),closure_setroot,2, _SC("ct")},
|
||||||
{0,0}
|
{0,0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
//GENERATOR DEFAULT DELEGATE
|
//GENERATOR DEFAULT DELEGATE
|
||||||
@ -1002,7 +1002,7 @@ const SQRegFunction SQSharedState::_generator_default_delegate_funcz[]={
|
|||||||
{_SC("getstatus"),generator_getstatus,1, _SC("g")},
|
{_SC("getstatus"),generator_getstatus,1, _SC("g")},
|
||||||
{_SC("weakref"),obj_delegate_weakref,1, NULL },
|
{_SC("weakref"),obj_delegate_weakref,1, NULL },
|
||||||
{_SC("tostring"),default_delegate_tostring,1, _SC(".")},
|
{_SC("tostring"),default_delegate_tostring,1, _SC(".")},
|
||||||
{0,0}
|
{0,0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
//THREAD DEFAULT DELEGATE
|
//THREAD DEFAULT DELEGATE
|
||||||
@ -1162,7 +1162,7 @@ const SQRegFunction SQSharedState::_thread_default_delegate_funcz[] = {
|
|||||||
{_SC("weakref"),obj_delegate_weakref,1, NULL },
|
{_SC("weakref"),obj_delegate_weakref,1, NULL },
|
||||||
{_SC("getstackinfos"),thread_getstackinfos,2, _SC("vn")},
|
{_SC("getstackinfos"),thread_getstackinfos,2, _SC("vn")},
|
||||||
{_SC("tostring"),default_delegate_tostring,1, _SC(".")},
|
{_SC("tostring"),default_delegate_tostring,1, _SC(".")},
|
||||||
{0,0},
|
{0,0,0,0},
|
||||||
};
|
};
|
||||||
|
|
||||||
static SQInteger class_getattributes(HSQUIRRELVM v)
|
static SQInteger class_getattributes(HSQUIRRELVM v)
|
||||||
@ -1229,7 +1229,7 @@ const SQRegFunction SQSharedState::_class_default_delegate_funcz[] = {
|
|||||||
{_SC("getbase"),class_getbase,1, _SC("y")},
|
{_SC("getbase"),class_getbase,1, _SC("y")},
|
||||||
{_SC("newmember"),class_newmember,-3, _SC("y")},
|
{_SC("newmember"),class_newmember,-3, _SC("y")},
|
||||||
{_SC("rawnewmember"),class_rawnewmember,-3, _SC("y")},
|
{_SC("rawnewmember"),class_rawnewmember,-3, _SC("y")},
|
||||||
{0,0}
|
{0,0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1247,7 +1247,7 @@ const SQRegFunction SQSharedState::_instance_default_delegate_funcz[] = {
|
|||||||
{_SC("rawin"),container_rawexists,2, _SC("x")},
|
{_SC("rawin"),container_rawexists,2, _SC("x")},
|
||||||
{_SC("weakref"),obj_delegate_weakref,1, NULL },
|
{_SC("weakref"),obj_delegate_weakref,1, NULL },
|
||||||
{_SC("tostring"),default_delegate_tostring,1, _SC(".")},
|
{_SC("tostring"),default_delegate_tostring,1, _SC(".")},
|
||||||
{0,0}
|
{0,0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static SQInteger weakref_ref(HSQUIRRELVM v)
|
static SQInteger weakref_ref(HSQUIRRELVM v)
|
||||||
@ -1261,6 +1261,6 @@ const SQRegFunction SQSharedState::_weakref_default_delegate_funcz[] = {
|
|||||||
{_SC("ref"),weakref_ref,1, _SC("r")},
|
{_SC("ref"),weakref_ref,1, _SC("r")},
|
||||||
{_SC("weakref"),obj_delegate_weakref,1, NULL },
|
{_SC("weakref"),obj_delegate_weakref,1, NULL },
|
||||||
{_SC("tostring"),default_delegate_tostring,1, _SC(".")},
|
{_SC("tostring"),default_delegate_tostring,1, _SC(".")},
|
||||||
{0,0}
|
{0,0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ SQInstance::~SQInstance()
|
|||||||
if(_class){ Finalize(); } //if _class is null it was already finalized by the GC
|
if(_class){ Finalize(); } //if _class is null it was already finalized by the GC
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SQInstance::GetMetaMethod(SQVM *v,SQMetaMethod mm,SQObjectPtr &res)
|
bool SQInstance::GetMetaMethod(SQVM SQ_UNUSED_ARG(*v),SQMetaMethod mm,SQObjectPtr &res)
|
||||||
{
|
{
|
||||||
if(type(_class->_metamethods[mm]) != OT_NULL) {
|
if(type(_class->_metamethods[mm]) != OT_NULL) {
|
||||||
res = _class->_metamethods[mm];
|
res = _class->_metamethods[mm];
|
||||||
|
@ -982,6 +982,7 @@ public:
|
|||||||
SQInteger val = _fs->PopTarget();
|
SQInteger val = _fs->PopTarget();
|
||||||
SQInteger key = _fs->PopTarget();
|
SQInteger key = _fs->PopTarget();
|
||||||
SQInteger attrs = hasattrs ? _fs->PopTarget():-1;
|
SQInteger attrs = hasattrs ? _fs->PopTarget():-1;
|
||||||
|
((void)attrs);
|
||||||
assert((hasattrs && (attrs == key-1)) || !hasattrs);
|
assert((hasattrs && (attrs == key-1)) || !hasattrs);
|
||||||
unsigned char flags = (hasattrs?NEW_SLOT_ATTRIBUTES_FLAG:0)|(isstatic?NEW_SLOT_STATIC_FLAG:0);
|
unsigned char flags = (hasattrs?NEW_SLOT_ATTRIBUTES_FLAG:0)|(isstatic?NEW_SLOT_STATIC_FLAG:0);
|
||||||
SQInteger table = _fs->TopTarget(); //<<BECAUSE OF THIS NO COMMON EMIT FUNC IS POSSIBLE
|
SQInteger table = _fs->TopTarget(); //<<BECAUSE OF THIS NO COMMON EMIT FUNC IS POSSIBLE
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#ifndef SQ_EXCLUDE_DEFAULT_MEMFUNCTIONS
|
#ifndef SQ_EXCLUDE_DEFAULT_MEMFUNCTIONS
|
||||||
void *sq_vm_malloc(SQUnsignedInteger size){ return malloc(size); }
|
void *sq_vm_malloc(SQUnsignedInteger size){ return malloc(size); }
|
||||||
|
|
||||||
void *sq_vm_realloc(void *p, SQUnsignedInteger oldsize, SQUnsignedInteger size){ return realloc(p, size); }
|
void *sq_vm_realloc(void *p, SQUnsignedInteger SQ_UNUSED_ARG(oldsize), SQUnsignedInteger size){ return realloc(p, size); }
|
||||||
|
|
||||||
void sq_vm_free(void *p, SQUnsignedInteger size){ free(p); }
|
void sq_vm_free(void *p, SQUnsignedInteger SQ_UNUSED_ARG(size)){ free(p); }
|
||||||
#endif
|
#endif
|
||||||
|
@ -251,7 +251,7 @@ void SQSharedState::MarkObject(SQObjectPtr &o,SQCollectable **chain)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SQSharedState::RunMark(SQVM *vm,SQCollectable **tchain)
|
void SQSharedState::RunMark(SQVM SQ_UNUSED_ARG(*vm),SQCollectable **tchain)
|
||||||
{
|
{
|
||||||
SQVM *vms = _thread(_root_vm);
|
SQVM *vms = _thread(_root_vm);
|
||||||
|
|
||||||
|
@ -514,7 +514,7 @@ SQRESULT SQVM::Suspend()
|
|||||||
|
|
||||||
#define _FINISH(howmuchtojump) {jump = howmuchtojump; return true; }
|
#define _FINISH(howmuchtojump) {jump = howmuchtojump; return true; }
|
||||||
bool SQVM::FOREACH_OP(SQObjectPtr &o1,SQObjectPtr &o2,SQObjectPtr
|
bool SQVM::FOREACH_OP(SQObjectPtr &o1,SQObjectPtr &o2,SQObjectPtr
|
||||||
&o3,SQObjectPtr &o4,SQInteger arg_2,int exitpos,int &jump)
|
&o3,SQObjectPtr &o4,SQInteger SQ_UNUSED_ARG(arg_2),int exitpos,int &jump)
|
||||||
{
|
{
|
||||||
SQInteger nrefidx;
|
SQInteger nrefidx;
|
||||||
switch(type(o1)) {
|
switch(type(o1)) {
|
||||||
@ -1573,7 +1573,7 @@ SQInteger prevstackbase = _stackbase;
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SQVM::CallMetaMethod(SQObjectPtr &closure,SQMetaMethod mm,SQInteger nparams,SQObjectPtr &outres)
|
bool SQVM::CallMetaMethod(SQObjectPtr &closure,SQMetaMethod SQ_UNUSED_ARG(mm),SQInteger nparams,SQObjectPtr &outres)
|
||||||
{
|
{
|
||||||
//SQObjectPtr closure;
|
//SQObjectPtr closure;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user