[DEV] rework basic arbo

This commit is contained in:
Edouard DUPIN 2018-06-27 00:27:57 +02:00
parent 21c05fee09
commit d7cdc92133
74 changed files with 698 additions and 389 deletions

7
.gitignore vendored
View File

@ -1,6 +1 @@
# Folders created at compilation *.pyc
bin/
lib/
# Folders created at documentation generation
doc/

View File

@ -1,4 +1,10 @@
/* see copyright notice in squirrel.h */ /**
* @author Alberto DEMICHELIS
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -9,13 +15,13 @@
#include <crtdbg.h> #include <crtdbg.h>
#include <conio.h> #include <conio.h>
#endif #endif
#include <squirrel/squirrel.h> #include <rabbit/rabbit.hpp>
#include <squirrel/sqstdblob.h> #include <rabbit-std/sqstdblob.hpp>
#include <squirrel/sqstdsystem.h> #include <rabbit-std/sqstdsystem.hpp>
#include <squirrel/sqstdio.h> #include <rabbit-std/sqstdio.hpp>
#include <squirrel/sqstdmath.h> #include <rabbit-std/sqstdmath.hpp>
#include <squirrel/sqstdstring.h> #include <rabbit-std/sqstdstring.hpp>
#include <squirrel/sqstdaux.h> #include <rabbit-std/sqstdaux.hpp>
#ifdef SQUNICODE #ifdef SQUNICODE
#define scfprintf fwprintf #define scfprintf fwprintf
@ -29,9 +35,13 @@
void PrintVersionInfos(); void PrintVersionInfos();
#if defined(_MSC_VER) && defined(_DEBUG) #if defined(_MSC_VER) && defined(_DEBUG)
int MemAllocHook( int allocType, void *userData, size_t size, int blockType, int MemAllocHook(int allocType,
long requestNumber, const unsigned char *filename, int lineNumber) void *userData,
{ size_t size,
int blockType,
long requestNumber,
const unsigned char *filename,
int lineNumber) {
//if(requestNumber==769)_asm int 3; //if(requestNumber==769)_asm int 3;
return 1; return 1;
} }
@ -71,7 +81,7 @@ void PrintUsage()
{ {
scfprintf(stderr,_SC("usage: sq <options> <scriptpath [args]>.\n") scfprintf(stderr,_SC("usage: sq <options> <scriptpath [args]>.\n")
_SC("Available options are:\n") _SC("Available options are:\n")
_SC(" -c compiles the file to bytecode(default output 'out.cnut')\n") _SC(" -c compiles the file to bytecode(default output 'out.karrot')\n")
_SC(" -o specifies output file for the -c option\n") _SC(" -o specifies output file for the -c option\n")
_SC(" -c compiles only\n") _SC(" -c compiles only\n")
_SC(" -d generates debug infos\n") _SC(" -d generates debug infos\n")
@ -103,7 +113,7 @@ int getargs(HSQUIRRELVM v,int argc, char* argv[],SQInteger *retval)
{ {
switch(argv[arg][1]) switch(argv[arg][1])
{ {
case 'd': //DEBUG(debug infos) case 'd':
sq_enabledebuginfo(v,1); sq_enabledebuginfo(v,1);
break; break;
case 'c': case 'c':
@ -154,7 +164,7 @@ int getargs(HSQUIRRELVM v,int argc, char* argv[],SQInteger *retval)
//sq_pop(v,1); //sq_pop(v,1);
if(compiles_only) { if(compiles_only) {
if(SQ_SUCCEEDED(sqstd_loadfile(v,filename,SQTrue))){ if(SQ_SUCCEEDED(sqstd_loadfile(v,filename,SQTrue))){
const SQChar *outfile = _SC("out.cnut"); const SQChar *outfile = _SC("out.karrot");
if(output) { if(output) {
#ifdef SQUNICODE #ifdef SQUNICODE
int len = (int)(strlen(output)+1); int len = (int)(strlen(output)+1);
@ -243,7 +253,7 @@ void Interactive(HSQUIRRELVM v)
while (!done) while (!done)
{ {
SQInteger i = 0; SQInteger i = 0;
scprintf(_SC("\nsq>")); scprintf(_SC("\nrabbit> "));
for(;;) { for(;;) {
int c; int c;
if(done)return; if(done)return;

View File

@ -1,16 +0,0 @@
/* see copyright notice in squirrel.h */
#ifndef _SQSTD_AUXLIB_H_
#define _SQSTD_AUXLIB_H_
#ifdef __cplusplus
extern "C" {
#endif
SQUIRREL_API void sqstd_seterrorhandlers(HSQUIRRELVM v);
SQUIRREL_API void sqstd_printcallstack(HSQUIRRELVM v);
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /* _SQSTD_AUXLIB_H_ */

View File

@ -1,15 +0,0 @@
/* see copyright notice in squirrel.h */
#ifndef _SQSTD_MATH_H_
#define _SQSTD_MATH_H_
#ifdef __cplusplus
extern "C" {
#endif
SQUIRREL_API SQRESULT sqstd_register_mathlib(HSQUIRRELVM v);
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*_SQSTD_MATH_H_*/

View File

@ -1,15 +0,0 @@
/* see copyright notice in squirrel.h */
#ifndef _SQSTD_SYSTEMLIB_H_
#define _SQSTD_SYSTEMLIB_H_
#ifdef __cplusplus
extern "C" {
#endif
SQUIRREL_API SQInteger sqstd_register_systemlib(HSQUIRRELVM v);
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /* _SQSTD_SYSTEMLIB_H_ */

71
lutin_rabbit-core.py Normal file
View File

@ -0,0 +1,71 @@
#!/usr/bin/python
import lutin.debug as debug
import lutin.tools as tools
import os
def get_type():
return "LIBRARY"
def get_desc():
return "rabbit script interpreter"
def get_licence():
return "MIT"
def get_compagny_type():
return "org"
def get_compagny_name():
return "rabbit"
def get_maintainer():
return ["Edouard DUPIN <edupin@gmail.com>"]
def get_version():
return [0,1]
def configure(target, my_module):
my_module.add_src_file([
'rabbit/sqmem.cpp',
'rabbit/sqbaselib.cpp',
'rabbit/sqapi.cpp',
'rabbit/sqlexer.cpp',
'rabbit/sqclass.cpp',
'rabbit/sqvm.cpp',
'rabbit/sqtable.cpp',
'rabbit/sqstate.cpp',
'rabbit/sqobject.cpp',
'rabbit/sqcompiler.cpp',
'rabbit/sqdebug.cpp',
'rabbit/sqfuncstate.cpp',
])
my_module.compile_version("c++", 2011)
my_module.add_depend([
'z',
'm',
'c'
])
my_module.add_header_file([
'rabbit/sqclass.hpp',
'rabbit/sqvm.hpp',
'rabbit/sqstate.hpp',
'rabbit/rabbit.hpp',
'rabbit/sqobject.hpp',
'rabbit/sqopcodes.hpp',
'rabbit/squserdata.hpp',
'rabbit/squtils.hpp',
'rabbit/sqpcheader.hpp',
'rabbit/sqfuncproto.hpp',
'rabbit/sqconfig.hpp',
'rabbit/sqcompiler.hpp',
'rabbit/sqarray.hpp',
'rabbit/sqclosure.hpp',
'rabbit/sqlexer.hpp',
'rabbit/sqfuncstate.hpp',
'rabbit/sqstring.hpp',
'rabbit/sqtable.hpp',
])
return True

55
lutin_rabbit-std.py Normal file
View File

@ -0,0 +1,55 @@
#!/usr/bin/python
import lutin.debug as debug
import lutin.tools as tools
import os
def get_type():
return "LIBRARY"
def get_desc():
return "rabbit script interpreter (std wrapping)"
def get_licence():
return "MIT"
def get_compagny_type():
return "org"
def get_compagny_name():
return "rabbit"
def get_maintainer():
return ["Edouard DUPIN <edupin@gmail.com>"]
def get_version():
return [0,1]
def configure(target, my_module):
my_module.add_src_file([
'rabbit-std/sqstdaux.cpp',
'rabbit-std/sqstdstream.cpp',
'rabbit-std/sqstdrex.cpp',
'rabbit-std/sqstdsystem.cpp',
'rabbit-std/sqstdio.cpp',
'rabbit-std/sqstdblob.cpp',
'rabbit-std/sqstdmath.cpp',
'rabbit-std/sqstdstring.cpp',
])
my_module.compile_version("c++", 2011)
my_module.add_depend([
'rabbit-core'
])
my_module.add_header_file([
'rabbit-std/sqstdstring.hpp',
'rabbit-std/sqstdmath.hpp',
'rabbit-std/sqstdaux.hpp',
'rabbit-std/sqstdsystem.hpp',
'rabbit-std/sqstdblobimpl.hpp',
'rabbit-std/sqstdstream.hpp',
'rabbit-std/sqstdio.hpp',
'rabbit-std/sqstdblob.hpp',
])
return True

40
lutin_rabbit.py Normal file
View File

@ -0,0 +1,40 @@
#!/usr/bin/python
import lutin.debug as debug
import lutin.tools as tools
import os
def get_type():
return "BINARY"
def get_desc():
return "rabbit command line interpreter"
def get_licence():
return "MIT"
def get_compagny_type():
return "org"
def get_compagny_name():
return "rabbit"
def get_maintainer():
return ["Edouard DUPIN <edupin@gmail.com>"]
def get_version():
return [0,1]
def configure(target, my_module):
my_module.add_src_file([
'cmdLine/rabbit.cpp',
])
my_module.compile_version("c++", 2011)
my_module.add_depend([
'rabbit-core',
'rabbit-std',
'cxx',
])
return True

View File

@ -1,6 +1,13 @@
/* see copyright notice in squirrel.h */ /**
#include <squirrel/squirrel.h> * @author Alberto DEMICHELIS
#include <squirrel/sqstdaux.h> * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#include <rabbit/rabbit.hpp>
#include <rabbit-std/sqstdaux.hpp>
#include <assert.h> #include <assert.h>
void sqstd_printcallstack(HSQUIRRELVM v) void sqstd_printcallstack(HSQUIRRELVM v)

11
rabbit-std/sqstdaux.hpp Normal file
View File

@ -0,0 +1,11 @@
/**
* @author Alberto DEMICHELIS
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
SQUIRREL_API void sqstd_seterrorhandlers(HSQUIRRELVM v);
SQUIRREL_API void sqstd_printcallstack(HSQUIRRELVM v);

View File

@ -1,11 +1,11 @@
/* see copyright notice in squirrel.h */ /* see copyright notice in rabbit.hpp */
#include <new> #include <new>
#include <squirrel/squirrel.h> #include <rabbit/rabbit.hpp>
#include <squirrel/sqstdio.h> #include <rabbit-std/sqstdio.hpp>
#include <string.h> #include <string.h>
#include <squirrel/sqstdblob.h> #include <rabbit-std/sqstdblob.hpp>
#include "sqstdstream.h" #include <rabbit-std/sqstdstream.hpp>
#include "sqstdblobimpl.h" #include <rabbit-std/sqstdblobimpl.hpp>
#define SQSTD_BLOB_TYPE_TAG ((SQUnsignedInteger)(SQSTD_STREAM_TYPE_TAG | 0x00000002)) #define SQSTD_BLOB_TYPE_TAG ((SQUnsignedInteger)(SQSTD_STREAM_TYPE_TAG | 0x00000002))

View File

@ -1,10 +1,11 @@
/* see copyright notice in squirrel.h */ /**
#ifndef _SQSTDBLOB_H_ * @author Alberto DEMICHELIS
#define _SQSTDBLOB_H_ * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
#ifdef __cplusplus * @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
extern "C" { * @license MPL-2 (see license file)
#endif */
#pragma once
SQUIRREL_API SQUserPointer sqstd_createblob(HSQUIRRELVM v, SQInteger size); SQUIRREL_API SQUserPointer sqstd_createblob(HSQUIRRELVM v, SQInteger size);
SQUIRREL_API SQRESULT sqstd_getblob(HSQUIRRELVM v,SQInteger idx,SQUserPointer *ptr); SQUIRREL_API SQRESULT sqstd_getblob(HSQUIRRELVM v,SQInteger idx,SQUserPointer *ptr);
@ -12,9 +13,3 @@ SQUIRREL_API SQInteger sqstd_getblobsize(HSQUIRRELVM v,SQInteger idx);
SQUIRREL_API SQRESULT sqstd_register_bloblib(HSQUIRRELVM v); SQUIRREL_API SQRESULT sqstd_register_bloblib(HSQUIRRELVM v);
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*_SQSTDBLOB_H_*/

View File

@ -1,6 +1,11 @@
/* see copyright notice in squirrel.h */ /**
#ifndef _SQSTD_BLOBIMPL_H_ * @author Alberto DEMICHELIS
#define _SQSTD_BLOBIMPL_H_ * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
struct SQBlob : public SQStream struct SQBlob : public SQStream
{ {
@ -105,4 +110,3 @@ private:
bool _owns; bool _owns;
}; };
#endif //_SQSTD_BLOBIMPL_H_

View File

@ -1,9 +1,16 @@
/* see copyright notice in squirrel.h */ /**
* @author Alberto DEMICHELIS
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#include <new> #include <new>
#include <stdio.h> #include <stdio.h>
#include <squirrel/squirrel.h> #include <rabbit/rabbit.hpp>
#include <squirrel/sqstdio.h> #include <rabbit-std/sqstdio.hpp>
#include "sqstdstream.h" #include <rabbit-std/sqstdstream.hpp>
#define SQSTD_FILE_TYPE_TAG ((SQUnsignedInteger)(SQSTD_STREAM_TYPE_TAG | 0x00000001)) #define SQSTD_FILE_TYPE_TAG ((SQUnsignedInteger)(SQSTD_STREAM_TYPE_TAG | 0x00000001))
//basic API //basic API

View File

@ -1,8 +1,11 @@
/* see copyright notice in squirrel.h */ /**
#ifndef _SQSTDIO_H_ * @author Alberto DEMICHELIS
#define _SQSTDIO_H_ * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
#ifdef __cplusplus * @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
#define SQSTD_STREAM_TYPE_TAG 0x80000000 #define SQSTD_STREAM_TYPE_TAG 0x80000000
@ -18,9 +21,6 @@ struct SQStream {
virtual bool EOS() = 0; virtual bool EOS() = 0;
}; };
extern "C" {
#endif
#define SQ_SEEK_CUR 0 #define SQ_SEEK_CUR 0
#define SQ_SEEK_END 1 #define SQ_SEEK_END 1
#define SQ_SEEK_SET 2 #define SQ_SEEK_SET 2
@ -46,9 +46,3 @@ SQUIRREL_API SQRESULT sqstd_writeclosuretofile(HSQUIRRELVM v,const SQChar *filen
SQUIRREL_API SQRESULT sqstd_register_iolib(HSQUIRRELVM v); SQUIRREL_API SQRESULT sqstd_register_iolib(HSQUIRRELVM v);
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*_SQSTDIO_H_*/

View File

@ -1,8 +1,15 @@
/* see copyright notice in squirrel.h */ /**
#include <squirrel/squirrel.h> * @author Alberto DEMICHELIS
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#include <rabbit/rabbit.hpp>
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
#include <squirrel/sqstdmath.h> #include <rabbit-std/sqstdmath.hpp>
#define SINGLE_ARG_FUNC(_funcname) static SQInteger math_##_funcname(HSQUIRRELVM v){ \ #define SINGLE_ARG_FUNC(_funcname) static SQInteger math_##_funcname(HSQUIRRELVM v){ \
SQFloat f; \ SQFloat f; \

11
rabbit-std/sqstdmath.hpp Normal file
View File

@ -0,0 +1,11 @@
/**
* @author Alberto DEMICHELIS
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
SQUIRREL_API SQRESULT sqstd_register_mathlib(HSQUIRRELVM v);

View File

@ -1,9 +1,16 @@
/* see copyright notice in squirrel.h */ /**
#include <squirrel/squirrel.h> * @author Alberto DEMICHELIS
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#include <rabbit/rabbit.hpp>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <setjmp.h> #include <setjmp.h>
#include <squirrel/sqstdstring.h> #include <rabbit-std/sqstdstring.hpp>
#ifdef _DEBUG #ifdef _DEBUG
#include <stdio.h> #include <stdio.h>

View File

@ -1,13 +1,20 @@
/* see copyright notice in squirrel.h */ /**
* @author Alberto DEMICHELIS
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#include <new> #include <new>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <squirrel/squirrel.h> #include <rabbit/rabbit.hpp>
#include <squirrel/sqstdio.h> #include <rabbit-std/sqstdio.hpp>
#include <squirrel/sqstdblob.h> #include <rabbit-std/sqstdblob.hpp>
#include "sqstdstream.h" #include <rabbit-std/sqstdstream.hpp>
#include "sqstdblobimpl.h" #include <rabbit-std/sqstdblobimpl.hpp>
#define SETUP_STREAM(v) \ #define SETUP_STREAM(v) \
SQStream *self = NULL; \ SQStream *self = NULL; \

View File

@ -1,6 +1,11 @@
/* see copyright notice in squirrel.h */ /**
#ifndef _SQSTD_STREAM_H_ * @author Alberto DEMICHELIS
#define _SQSTD_STREAM_H_ * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
SQInteger _stream_readblob(HSQUIRRELVM v); SQInteger _stream_readblob(HSQUIRRELVM v);
SQInteger _stream_readline(HSQUIRRELVM v); SQInteger _stream_readline(HSQUIRRELVM v);
@ -15,4 +20,3 @@ SQInteger _stream_flush(HSQUIRRELVM v);
#define _DECL_STREAM_FUNC(name,nparams,typecheck) {_SC(#name),_stream_##name,nparams,typecheck} #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,const SQRegFunction *methods,const 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_*/

View File

@ -1,6 +1,13 @@
/* see copyright notice in squirrel.h */ /**
#include <squirrel/squirrel.h> * @author Alberto DEMICHELIS
#include <squirrel/sqstdstring.h> * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#include <rabbit/rabbit.hpp>
#include <rabbit-std/sqstdstring.hpp>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>

View File

@ -1,10 +1,11 @@
/* see copyright notice in squirrel.h */ /**
#ifndef _SQSTD_STRING_H_ * @author Alberto DEMICHELIS
#define _SQSTD_STRING_H_ * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
#ifdef __cplusplus * @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
extern "C" { * @license MPL-2 (see license file)
#endif */
#pragma once
typedef unsigned int SQRexBool; typedef unsigned int SQRexBool;
typedef struct SQRex SQRex; typedef struct SQRex SQRex;
@ -26,8 +27,3 @@ SQUIRREL_API SQRESULT sqstd_format(HSQUIRRELVM v,SQInteger nformatstringidx,SQIn
SQUIRREL_API SQRESULT sqstd_register_stringlib(HSQUIRRELVM v); SQUIRREL_API SQRESULT sqstd_register_stringlib(HSQUIRRELVM v);
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*_SQSTD_STRING_H_*/

View File

@ -1,9 +1,16 @@
/* see copyright notice in squirrel.h */ /**
#include <squirrel/squirrel.h> * @author Alberto DEMICHELIS
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#include <rabbit/rabbit.hpp>
#include <time.h> #include <time.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <squirrel/sqstdsystem.h> #include <rabbit-std/sqstdsystem.hpp>
#ifdef SQUNICODE #ifdef SQUNICODE
#include <wchar.h> #include <wchar.h>

View File

@ -0,0 +1,10 @@
/**
* @author Alberto DEMICHELIS
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
SQUIRREL_API SQInteger sqstd_register_systemlib(HSQUIRRELVM v);

View File

@ -1,26 +1,11 @@
/* /**
Copyright (c) 2003-2017 Alberto Demichelis * @author Alberto DEMICHELIS
* @author Edouard DUPIN
Permission is hereby granted, free of charge, to any person obtaining a copy * @copyright 2018, Edouard DUPIN, all right reserved
of this software and associated documentation files (the "Software"), to deal * @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
in the Software without restriction, including without limitation the rights * @license MPL-2 (see license file)
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell */
copies of the Software, and to permit persons to whom the Software is #pragma once
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef _SQUIRREL_H_
#define _SQUIRREL_H_
#ifdef _SQ_CONFIG_INCLUDE #ifdef _SQ_CONFIG_INCLUDE
#include _SQ_CONFIG_INCLUDE #include _SQ_CONFIG_INCLUDE
@ -63,12 +48,12 @@ struct SQOuter;
#define SQUNICODE #define SQUNICODE
#endif #endif
#include "sqconfig.h" #include "sqconfig.hpp"
#define SQUIRREL_VERSION _SC("Squirrel 3.1 stable") #define SQUIRREL_VERSION _SC("Rabbit 0.1 un-stable")
#define SQUIRREL_COPYRIGHT _SC("Copyright (C) 2003-2017 Alberto Demichelis") #define SQUIRREL_COPYRIGHT _SC("Copyright (C) 2003-2017 Alberto Demichelis")
#define SQUIRREL_AUTHOR _SC("Alberto Demichelis") #define SQUIRREL_AUTHOR _SC("Edouard DUPIN")
#define SQUIRREL_VERSION_NUMBER 310 #define SQUIRREL_VERSION_NUMBER 010
#define SQ_VMSTATE_IDLE 0 #define SQ_VMSTATE_IDLE 0
#define SQ_VMSTATE_RUNNING 1 #define SQ_VMSTATE_RUNNING 1
@ -408,4 +393,3 @@ SQUIRREL_API void sq_setnativedebughook(HSQUIRRELVM v,SQDEBUGHOOK hook);
} /*extern "C"*/ } /*extern "C"*/
#endif #endif
#endif /*_SQUIRREL_H_*/

View File

@ -1,17 +1,21 @@
/* /**
see copyright notice in squirrel.h * @author Alberto DEMICHELIS
*/ * @author Edouard DUPIN
#include "sqpcheader.h" * @copyright 2018, Edouard DUPIN, all right reserved
#include "sqvm.h" * @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
#include "sqstring.h" * @license MPL-2 (see license file)
#include "sqtable.h" */
#include "sqarray.h" #include <rabbit/sqpcheader.hpp>
#include "sqfuncproto.h" #include <rabbit/sqvm.hpp>
#include "sqclosure.h" #include <rabbit/sqstring.hpp>
#include "squserdata.h" #include <rabbit/sqtable.hpp>
#include "sqcompiler.h" #include <rabbit/sqarray.hpp>
#include "sqfuncstate.h" #include <rabbit/sqfuncproto.hpp>
#include "sqclass.h" #include <rabbit/sqclosure.hpp>
#include <rabbit/squserdata.hpp>
#include <rabbit/sqcompiler.hpp>
#include <rabbit/sqfuncstate.hpp>
#include <rabbit/sqclass.hpp>
static bool sq_aux_gettypedarg(HSQUIRRELVM v,SQInteger idx,SQObjectType type,SQObjectPtr **o) static bool sq_aux_gettypedarg(HSQUIRRELVM v,SQInteger idx,SQObjectType type,SQObjectPtr **o)
{ {

View File

@ -1,6 +1,11 @@
/* see copyright notice in squirrel.h */ /**
#ifndef _SQARRAY_H_ * @author Alberto DEMICHELIS
#define _SQARRAY_H_ * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
struct SQArray : public CHAINABLE_OBJ struct SQArray : public CHAINABLE_OBJ
{ {
@ -91,4 +96,5 @@ public:
SQObjectPtrVec _values; SQObjectPtrVec _values;
}; };
#endif //_SQARRAY_H_

View File

@ -1,14 +1,18 @@
/* /**
see copyright notice in squirrel.h * @author Alberto DEMICHELIS
*/ * @author Edouard DUPIN
#include "sqpcheader.h" * @copyright 2018, Edouard DUPIN, all right reserved
#include "sqvm.h" * @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
#include "sqstring.h" * @license MPL-2 (see license file)
#include "sqtable.h" */
#include "sqarray.h" #include <rabbit/sqpcheader.hpp>
#include "sqfuncproto.h" #include <rabbit/sqvm.hpp>
#include "sqclosure.h" #include <rabbit/sqstring.hpp>
#include "sqclass.h" #include <rabbit/sqtable.hpp>
#include <rabbit/sqarray.hpp>
#include <rabbit/sqfuncproto.hpp>
#include <rabbit/sqclosure.hpp>
#include <rabbit/sqclass.hpp>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <ctype.h> #include <ctype.h>

View File

@ -1,12 +1,16 @@
/* /**
see copyright notice in squirrel.h * @author Alberto DEMICHELIS
*/ * @author Edouard DUPIN
#include "sqpcheader.h" * @copyright 2018, Edouard DUPIN, all right reserved
#include "sqvm.h" * @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
#include "sqtable.h" * @license MPL-2 (see license file)
#include "sqclass.h" */
#include "sqfuncproto.h" #include <rabbit/sqpcheader.hpp>
#include "sqclosure.h" #include <rabbit/sqvm.hpp>
#include <rabbit/sqtable.hpp>
#include <rabbit/sqclass.hpp>
#include <rabbit/sqfuncproto.hpp>
#include <rabbit/sqclosure.hpp>

View File

@ -1,6 +1,11 @@
/* see copyright notice in squirrel.h */ /**
#ifndef _SQCLASS_H_ * @author Alberto DEMICHELIS
#define _SQCLASS_H_ * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
struct SQInstance; struct SQInstance;
@ -159,4 +164,3 @@ public:
SQObjectPtr _values[1]; SQObjectPtr _values[1];
}; };
#endif //_SQCLASS_H_

View File

@ -1,7 +1,11 @@
/* see copyright notice in squirrel.h */ /**
#ifndef _SQCLOSURE_H_ * @author Alberto DEMICHELIS
#define _SQCLOSURE_H_ * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
#define _CALC_CLOSURE_SIZE(func) (sizeof(SQClosure) + (func->_noutervalues*sizeof(SQObjectPtr)) + (func->_ndefaultparams*sizeof(SQObjectPtr))) #define _CALC_CLOSURE_SIZE(func) (sizeof(SQClosure) + (func->_noutervalues*sizeof(SQObjectPtr)) + (func->_ndefaultparams*sizeof(SQObjectPtr)))
@ -197,5 +201,3 @@ public:
}; };
#endif //_SQCLOSURE_H_

View File

@ -1,18 +1,22 @@
/* /**
see copyright notice in squirrel.h * @author Alberto DEMICHELIS
*/ * @author Edouard DUPIN
#include "sqpcheader.h" * @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#include <rabbit/sqpcheader.hpp>
#ifndef NO_COMPILER #ifndef NO_COMPILER
#include <stdarg.h> #include <stdarg.h>
#include <setjmp.h> #include <setjmp.h>
#include "sqopcodes.h" #include <rabbit/sqopcodes.hpp>
#include "sqstring.h" #include <rabbit/sqstring.hpp>
#include "sqfuncproto.h" #include <rabbit/sqfuncproto.hpp>
#include "sqcompiler.h" #include <rabbit/sqcompiler.hpp>
#include "sqfuncstate.h" #include <rabbit/sqfuncstate.hpp>
#include "sqlexer.h" #include <rabbit/sqlexer.hpp>
#include "sqvm.h" #include <rabbit/sqvm.hpp>
#include "sqtable.h" #include <rabbit/sqtable.hpp>
#define EXPR 1 #define EXPR 1
#define OBJECT 2 #define OBJECT 2

View File

@ -1,6 +1,11 @@
/* see copyright notice in squirrel.h */ /**
#ifndef _SQCOMPILER_H_ * @author Alberto DEMICHELIS
#define _SQCOMPILER_H_ * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
struct SQVM; struct SQVM;
@ -76,4 +81,3 @@ struct SQVM;
typedef void(*CompilerErrorFunc)(void *ud, const SQChar *s); typedef void(*CompilerErrorFunc)(void *ud, const SQChar *s);
bool Compile(SQVM *vm, SQLEXREADFUNC rg, SQUserPointer up, const SQChar *sourcename, SQObjectPtr &out, bool raiseerror, bool lineinfo); bool Compile(SQVM *vm, SQLEXREADFUNC rg, SQUserPointer up, const SQChar *sourcename, SQObjectPtr &out, bool raiseerror, bool lineinfo);
#endif //_SQCOMPILER_H_

View File

@ -1,3 +1,11 @@
/**
* @author Alberto DEMICHELIS
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
#ifdef _SQ64 #ifdef _SQ64

View File

@ -1,12 +1,17 @@
/* /**
see copyright notice in squirrel.h * @author Alberto DEMICHELIS
*/ * @author Edouard DUPIN
#include "sqpcheader.h" * @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#include <rabbit/sqpcheader.hpp>
#include <stdarg.h> #include <stdarg.h>
#include "sqvm.h" #include <rabbit/sqvm.hpp>
#include "sqfuncproto.h" #include <rabbit/sqfuncproto.hpp>
#include "sqclosure.h" #include <rabbit/sqclosure.hpp>
#include "sqstring.h" #include <rabbit/sqstring.hpp>
SQRESULT sq_getfunctioninfo(HSQUIRRELVM v,SQInteger level,SQFunctionInfo *fi) SQRESULT sq_getfunctioninfo(HSQUIRRELVM v,SQInteger level,SQFunctionInfo *fi)
{ {

View File

@ -1,8 +1,13 @@
/* see copyright notice in squirrel.h */ /**
#ifndef _SQFUNCTION_H_ * @author Alberto DEMICHELIS
#define _SQFUNCTION_H_ * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
#include "sqopcodes.h" #include <rabbit/sqopcodes.hpp>
enum SQOuterType { enum SQOuterType {
otLOCAL = 0, otLOCAL = 0,
@ -150,5 +155,3 @@ public:
SQInteger _ninstructions; SQInteger _ninstructions;
SQInstruction _instructions[1]; SQInstruction _instructions[1];
}; };
#endif //_SQFUNCTION_H_

View File

@ -1,14 +1,19 @@
/* /**
see copyright notice in squirrel.h * @author Alberto DEMICHELIS
*/ * @author Edouard DUPIN
#include "sqpcheader.h" * @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#include <rabbit/sqpcheader.hpp>
#ifndef NO_COMPILER #ifndef NO_COMPILER
#include "sqcompiler.h" #include <rabbit/sqcompiler.hpp>
#include "sqstring.h" #include <rabbit/sqstring.hpp>
#include "sqfuncproto.h" #include <rabbit/sqfuncproto.hpp>
#include "sqtable.h" #include <rabbit/sqtable.hpp>
#include "sqopcodes.h" #include <rabbit/sqopcodes.hpp>
#include "sqfuncstate.h" #include <rabbit/sqfuncstate.hpp>
#ifdef _DEBUG_DUMP #ifdef _DEBUG_DUMP
SQInstructionDesc g_InstrDesc[]={ SQInstructionDesc g_InstrDesc[]={

View File

@ -1,8 +1,13 @@
/* see copyright notice in squirrel.h */ /**
#ifndef _SQFUNCSTATE_H_ * @author Alberto DEMICHELIS
#define _SQFUNCSTATE_H_ * @author Edouard DUPIN
/////////////////////////////////// * @copyright 2018, Edouard DUPIN, all right reserved
#include "squtils.h" * @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
#include <rabbit/squtils.hpp>
struct SQFuncState struct SQFuncState
{ {
@ -87,5 +92,3 @@ private:
}; };
#endif //_SQFUNCSTATE_H_

View File

@ -1,13 +1,18 @@
/* /**
see copyright notice in squirrel.h * @author Alberto DEMICHELIS
*/ * @author Edouard DUPIN
#include "sqpcheader.h" * @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#include <rabbit/sqpcheader.hpp>
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include "sqtable.h" #include <rabbit/sqtable.hpp>
#include "sqstring.h" #include <rabbit/sqstring.hpp>
#include "sqcompiler.h" #include <rabbit/sqcompiler.hpp>
#include "sqlexer.h" #include <rabbit/sqlexer.hpp>
#define CUR_CHAR (_currdata) #define CUR_CHAR (_currdata)
#define RETURN_TOKEN(t) { _prevtoken = _curtoken; _curtoken = t; return t;} #define RETURN_TOKEN(t) { _prevtoken = _curtoken; _curtoken = t; return t;}

View File

@ -1,6 +1,11 @@
/* see copyright notice in squirrel.h */ /**
#ifndef _SQLEXER_H_ * @author Alberto DEMICHELIS
#define _SQLEXER_H_ * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
#ifdef SQUNICODE #ifdef SQUNICODE
typedef SQChar LexChar; typedef SQChar LexChar;
@ -52,4 +57,3 @@ public:
void *_errtarget; void *_errtarget;
}; };
#endif

View File

@ -1,7 +1,13 @@
/* /**
see copyright notice in squirrel.h * @author Alberto DEMICHELIS
*/ * @author Edouard DUPIN
#include "sqpcheader.h" * @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#include <rabbit/sqpcheader.hpp>
#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); }

View File

@ -1,15 +1,19 @@
/* /**
see copyright notice in squirrel.h * @author Alberto DEMICHELIS
*/ * @author Edouard DUPIN
#include "sqpcheader.h" * @copyright 2018, Edouard DUPIN, all right reserved
#include "sqvm.h" * @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
#include "sqstring.h" * @license MPL-2 (see license file)
#include "sqarray.h" */
#include "sqtable.h" #include <rabbit/sqpcheader.hpp>
#include "squserdata.h" #include <rabbit/sqvm.hpp>
#include "sqfuncproto.h" #include <rabbit/sqstring.hpp>
#include "sqclass.h" #include <rabbit/sqarray.hpp>
#include "sqclosure.h" #include <rabbit/sqtable.hpp>
#include <rabbit/squserdata.hpp>
#include <rabbit/sqfuncproto.hpp>
#include <rabbit/sqclass.hpp>
#include <rabbit/sqclosure.hpp>
const SQChar *IdType2Name(SQObjectType type) const SQChar *IdType2Name(SQObjectType type)

View File

@ -1,8 +1,13 @@
/* see copyright notice in squirrel.h */ /**
#ifndef _SQOBJECT_H_ * @author Alberto DEMICHELIS
#define _SQOBJECT_H_ * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
#include "squtils.h" #include <rabbit/squtils.hpp>
#ifdef _SQ64 #ifdef _SQ64
#define UINT_MINUS_ONE (0xFFFFFFFFFFFFFFFF) #define UINT_MINUS_ONE (0xFFFFFFFFFFFFFFFF)
@ -350,4 +355,3 @@ const SQChar *IdType2Name(SQObjectType type);
#endif //_SQOBJECT_H_

View File

@ -1,6 +1,11 @@
/* see copyright notice in squirrel.h */ /**
#ifndef _SQOPCODES_H_ * @author Alberto DEMICHELIS
#define _SQOPCODES_H_ * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
#define MAX_FUNC_STACKSIZE 0xFF #define MAX_FUNC_STACKSIZE 0xFF
#define MAX_LITERALS ((SQInteger)0x7FFFFFFF) #define MAX_LITERALS ((SQInteger)0x7FFFFFFF)
@ -123,10 +128,9 @@ struct SQInstruction
unsigned char _arg3; unsigned char _arg3;
}; };
#include "squtils.h" #include <rabbit/squtils.hpp>
typedef sqvector<SQInstruction> SQInstructionVec; typedef sqvector<SQInstruction> SQInstructionVec;
#define NEW_SLOT_ATTRIBUTES_FLAG 0x01 #define NEW_SLOT_ATTRIBUTES_FLAG 0x01
#define NEW_SLOT_STATIC_FLAG 0x02 #define NEW_SLOT_STATIC_FLAG 0x02
#endif // _SQOPCODES_H_

24
rabbit/sqpcheader.hpp Normal file
View File

@ -0,0 +1,24 @@
/**
* @author Alberto DEMICHELIS
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
#if defined(_MSC_VER) && defined(_DEBUG)
#include <crtdbg.hpp>
#endif
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <new>
//rabbit stuff
#include <rabbit/rabbit.hpp>
#include <rabbit/sqobject.hpp>
#include <rabbit/sqstate.hpp>

View File

@ -1,16 +1,20 @@
/* /**
see copyright notice in squirrel.h * @author Alberto DEMICHELIS
*/ * @author Edouard DUPIN
#include "sqpcheader.h" * @copyright 2018, Edouard DUPIN, all right reserved
#include "sqopcodes.h" * @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
#include "sqvm.h" * @license MPL-2 (see license file)
#include "sqfuncproto.h" */
#include "sqclosure.h" #include <rabbit/sqpcheader.hpp>
#include "sqstring.h" #include <rabbit/sqopcodes.hpp>
#include "sqtable.h" #include <rabbit/sqvm.hpp>
#include "sqarray.h" #include <rabbit/sqfuncproto.hpp>
#include "squserdata.h" #include <rabbit/sqclosure.hpp>
#include "sqclass.h" #include <rabbit/sqstring.hpp>
#include <rabbit/sqtable.hpp>
#include <rabbit/sqarray.hpp>
#include <rabbit/squserdata.hpp>
#include <rabbit/sqclass.hpp>
SQSharedState::SQSharedState() SQSharedState::SQSharedState()
{ {

View File

@ -1,9 +1,14 @@
/* see copyright notice in squirrel.h */ /**
#ifndef _SQSTATE_H_ * @author Alberto DEMICHELIS
#define _SQSTATE_H_ * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
#include "squtils.h" #include <rabbit/squtils.hpp>
#include "sqobject.h" #include <rabbit/sqobject.hpp>
struct SQString; struct SQString;
struct SQTable; struct SQTable;
//max number of character for a printed number //max number of character for a printed number
@ -133,4 +138,3 @@ private:
bool CompileTypemask(SQIntVec &res,const SQChar *typemask); bool CompileTypemask(SQIntVec &res,const SQChar *typemask);
#endif //_SQSTATE_H_

View File

@ -1,6 +1,11 @@
/* see copyright notice in squirrel.h */ /**
#ifndef _SQSTRING_H_ * @author Alberto DEMICHELIS
#define _SQSTRING_H_ * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
inline SQHash _hashstr (const SQChar *s, size_t l) inline SQHash _hashstr (const SQChar *s, size_t l)
{ {
@ -28,4 +33,3 @@ public:
#endif //_SQSTRING_H_

View File

@ -1,11 +1,16 @@
/* /**
see copyright notice in squirrel.h * @author Alberto DEMICHELIS
*/ * @author Edouard DUPIN
#include "sqpcheader.h" * @copyright 2018, Edouard DUPIN, all right reserved
#include "sqvm.h" * @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
#include "sqtable.h" * @license MPL-2 (see license file)
#include "sqfuncproto.h" */
#include "sqclosure.h"
#include <rabbit/sqpcheader.hpp>
#include <rabbit/sqvm.hpp>
#include <rabbit/sqtable.hpp>
#include <rabbit/sqfuncproto.hpp>
#include <rabbit/sqclosure.hpp>
SQTable::SQTable(SQSharedState *ss,SQInteger nInitialSize) SQTable::SQTable(SQSharedState *ss,SQInteger nInitialSize)
{ {

View File

@ -1,13 +1,19 @@
/* see copyright notice in squirrel.h */ /**
#ifndef _SQTABLE_H_ * @author Alberto DEMICHELIS
#define _SQTABLE_H_ * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
/* /*
* The following code is based on Lua 4.0 (Copyright 1994-2002 Tecgraf, PUC-Rio.) * The following code is based on Lua 4.0 (Copyright 1994-2002 Tecgraf, PUC-Rio.)
* http://www.lua.org/copyright.html#4 * http://www.lua.org/copyright.html#4
* http://www.lua.org/source/4.0.1/src_ltable.c.html * http://www.lua.org/source/4.0.1/src_ltable.c.html
*/ */
#include "sqstring.h" #include <rabbit/sqstring.hpp>
#define hashptr(p) ((SQHash)(((SQInteger)p) >> 3)) #define hashptr(p) ((SQHash)(((SQInteger)p) >> 3))
@ -107,4 +113,3 @@ public:
}; };
#endif //_SQTABLE_H_

View File

@ -1,6 +1,11 @@
/* see copyright notice in squirrel.h */ /**
#ifndef _SQUSERDATA_H_ * @author Alberto DEMICHELIS
#define _SQUSERDATA_H_ * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
struct SQUserData : SQDelegable struct SQUserData : SQDelegable
{ {
@ -37,4 +42,3 @@ struct SQUserData : SQDelegable
//SQChar _val[1]; //SQChar _val[1];
}; };
#endif //_SQUSERDATA_H_

View File

@ -1,6 +1,11 @@
/* see copyright notice in squirrel.h */ /**
#ifndef _SQUTILS_H_ * @author Alberto DEMICHELIS
#define _SQUTILS_H_ * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
void *sq_vm_malloc(SQUnsignedInteger size); void *sq_vm_malloc(SQUnsignedInteger size);
void *sq_vm_realloc(void *p,SQUnsignedInteger oldsize,SQUnsignedInteger size); void *sq_vm_realloc(void *p,SQUnsignedInteger oldsize,SQUnsignedInteger size);
@ -113,4 +118,3 @@ private:
SQUnsignedInteger _allocated; SQUnsignedInteger _allocated;
}; };
#endif //_SQUTILS_H_

View File

@ -1,18 +1,22 @@
/* /**
see copyright notice in squirrel.h * @author Alberto DEMICHELIS
*/ * @author Edouard DUPIN
#include "sqpcheader.h" * @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#include <rabbit/sqpcheader.hpp>
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
#include "sqopcodes.h" #include <rabbit/sqopcodes.hpp>
#include "sqvm.h" #include <rabbit/sqvm.hpp>
#include "sqfuncproto.h" #include <rabbit/sqfuncproto.hpp>
#include "sqclosure.h" #include <rabbit/sqclosure.hpp>
#include "sqstring.h" #include <rabbit/sqstring.hpp>
#include "sqtable.h" #include <rabbit/sqtable.hpp>
#include "squserdata.h" #include <rabbit/squserdata.hpp>
#include "sqarray.h" #include <rabbit/sqarray.hpp>
#include "sqclass.h" #include <rabbit/sqclass.hpp>
#define TOP() (_stack._vals[_top-1]) #define TOP() (_stack._vals[_top-1])
#define TARGET _stack._vals[_stackbase+arg0] #define TARGET _stack._vals[_stackbase+arg0]

View File

@ -1,9 +1,15 @@
/* see copyright notice in squirrel.h */ /**
#ifndef _SQVM_H_ * @author Alberto DEMICHELIS
#define _SQVM_H_ * @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file)
*/
#pragma once
#include <rabbit/sqopcodes.hpp>
#include <rabbit/sqobject.hpp>
#include "sqopcodes.h"
#include "sqobject.h"
#define MAX_NATIVE_CALLS 100 #define MAX_NATIVE_CALLS 100
#define MIN_STACK_OVERHEAD 15 #define MIN_STACK_OVERHEAD 15
@ -210,4 +216,3 @@ inline SQObjectPtr &stack_get(HSQUIRRELVM v,SQInteger idx){return ((idx>=0)?(v->
v->ci->_closure.Null(); \ v->ci->_closure.Null(); \
v->ci = css?&v->_callsstack[css-1]:NULL; \ v->ci = css?&v->_callsstack[css-1]:NULL; \
} }
#endif //_SQVM_H_

View File

@ -1,20 +0,0 @@
/* see copyright notice in squirrel.h */
#ifndef _SQPCHEADER_H_
#define _SQPCHEADER_H_
#if defined(_MSC_VER) && defined(_DEBUG)
#include <crtdbg.h>
#endif
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <new>
//squirrel stuff
#include <squirrel/squirrel.h>
#include "sqobject.h"
#include "sqstate.h"
#endif //_SQPCHEADER_H_