Changeset - r11225:37853e3b55c7
[Not reviewed]
master
! ! !
rubidium - 15 years ago 2009-02-25 01:21:50
rubidium@openttd.org
(svn r15578) -Change: unexternalise squirrel.
39 files changed:
Changeset was too big and was cut off... Show full diff anyway
0 comments (0 inline, 0 general)
readme.txt
Show inline comments
 
@@ -498,6 +498,7 @@ Thanks to:
 
  Cian Duffy (MYOB)              - BeOS port / manual writing
 
  Christian Rosentreter (tokai)  - MorphOS / AmigaOS port
 
  Richard Kempton (RichK67)      - Additional airports, initial TGP implementation
 
  Alberto Demichelis             - Squirrel scripting language
 
  Michael Blunck                 - For revolutionizing TTD with awesome graphics
 
  George                         - Canal graphics
 
  David Dallaston (Pikka)        - Tram tracks
src/3rdparty/squirrel/COMPILE
Show inline comments
 
new file 100644
 
Squirrel 2.2.1 stable
 
--------------------------------------------------------
 
What is in this distribution?
 

	
 
squirrel
 
	static library implementing the compiler and interpreter of the language
 

	
 
sqstdlib
 
	the standard utility libraries
 

	
 
sq
 
	stand alone interpreter
 

	
 
doc
 
	The manual
 

	
 
etc
 
	a minimalistic embedding sample
 

	
 
samples
 
	samples programs
 

	
 

	
 
HOW TO COMPILE
 
---------------------------------------------------------
 
GCC USERS
 
.........................................................
 
There is a very simple makefile that compiles all libraries and exes
 
from the root of the project run 'make'
 

	
 
for 32 bits systems
 

	
 
 $ make
 

	
 
for 64 bits systems
 

	
 
 $ make sq64
 

	
 
VISUAL C++ USERS
 
.........................................................
 
Open squirrel.dsw from the root project directory and build(dho!)
src/3rdparty/squirrel/COPYRIGHT
Show inline comments
 
new file 100644
 
Copyright (c) 2003-2008 Alberto Demichelis
 

	
 
This software is provided 'as-is', without any
 
express or implied warranty. In no event will the
 
authors be held liable for any damages arising from
 
the use of this software.
 

	
 
Permission is granted to anyone to use this software
 
for any purpose, including commercial applications,
 
and to alter it and redistribute it freely, subject
 
to the following restrictions:
 

	
 
		1. The origin of this software must not be
 
		misrepresented; you must not claim that
 
		you wrote the original software. If you
 
		use this software in a product, an
 
		acknowledgment in the product
 
		documentation would be appreciated but is
 
		not required.
 

	
 
		2. Altered source versions must be plainly
 
		marked as such, and must not be
 
		misrepresented as being the original
 
		software.
 

	
 
		3. This notice may not be removed or
 
		altered from any source distribution.
 
-----------------------------------------------------
 
END OF COPYRIGHT
src/3rdparty/squirrel/HISTORY
Show inline comments
 
new file 100644
 
***version 2.2.2 stable***
 
-fixed some behaviour inconsistencies in thread.call() and thread.wakeup() (thx Mr.Accident)
 
-fixed coroutine error propagation
 
-fixed lingering return value from native function (thx Tom Leonard)
 
-fixed a bug if array.sort() is given a bad sort function (thx Tom Leonard)
 
-fixed some minor api bug
 
-added sq_arrayremove() and sq_arrayinsert()
 

	
 
***2008-05-16          ***
 
***version 2.2.1 stable***
 
-fixed a tailcall bug
 

	
 
***2008-02-17          ***
 
***version 2.2 stable  ***
 
-added _newslot metamethod in classes
 
-added enums added constants
 
-added sq_pushconsttable, sq_setconsttable
 
-added default param
 
-added octal literals(thx Dinosaur)
 
-fixed debug hook, 'calls' and 'returns' are properly notified in the same number.
 
-fixed a coroutine bug
 

	
 
***2007-07-29          ***
 
***version 2.1.2 stable***
 
-new behaviour for generators iteration using foreach
 
now when a generator is iterated by foreach the value returned by a 'return val' statement
 
will terminate the iteration but will not be returned as foreach iteration
 
-added sq_setclassudsize()
 
-added sq_clear()
 
-added table.clear(), array.clear()
 
-fixed sq_cmp() (thx jyuill)
 
-fixed minor bugs
 

	
 
***2006-08-21	     ***
 
***version 2.1.1 stable***
 
-vm refactoring
 
-optimized internal function memory layout
 
-new global symbol _version_ (is the version string)
 
-code size optimization for float literals(on 32bits float builts)
 
-now the raw ref API(sq_addref etc...) is fully reentrant.
 
-fixed a bug in sq_getdelegate() now pushes null if the object doesn't have a delegate(thx MatzeB)
 
-improved C reference performances in NO_GARBAGE_COLLECTOR builds
 
-sq_getlocal() now enumerates also outer values.
 
-fixed regexp library for GCC users.
 

	
 
***2006-03-19	     ***
 
***version 2.1 stable***
 
-added static class fields, new keyword static
 
-added 64bits architecture support
 
-added global slot _intsize_ int the base lib to recognize 32bits and 64bits builds
 
-added functions with fixed environment, closure.bindenv() built-in function
 
-all types except userdata and null implement the tostring() method
 
-string concatenation now invokes metamethod _tostring
 
-new metamethods for class objects _newmember and _inherited
 
-sq_call() sq_resume() sq_wakeupvm() have a new signature
 
-new C referencing implementation(scales more with the amount of references)
 
-refactored hash table
 
-new api functions sq_newslot(),sq_tobool(),sq_getbase(), sq_instanceof(), sq_bindenv()
 
-the api func sq_createslot was deprecated but still supported in form of C macro on top of sq_newslot
 
-sq_setreleasehook() now also works for classes
 
-stream.readstr() and stream.writestr() have been deprecated(this affects file and blob)
 
-fixed squirrel.h undeclared api calls
 
-fixed few minor bugs
 
-SQChar is now defined as wchar_t
 
-removed warning when building with -Wall -pedantic for GCC users
 
-added new std io function writeclosuretofile()
 
-added new std string functions strip(),rstrip(),lstrip() and split()
 
-regular expressions operators (+,*) now have more POSIX greedyness behaviour
 
-class constructors are now invoked as normal functions
 

	
 
***2005-10-02	       ***
 
***version 2.0.5 stable***
 
-fixed some 64bits incompatibilities (thx sarge)
 
-fixed minor bug in the stdlib format() function (thx Rick)
 
-fixed a bug in dofile() that was preventing to compile empty files
 
-added new API sq_poptop() & sq_getfreevariable()
 
-some performance improvements
 

	
 
***2005-08-14	       ***
 
***version 2.0.4 stable***
 
-weak references and related API calls
 
-added sq_objtobool()
 
-class instances memory policies improved(1 mem allocation for the whole instance)
 
-typetags are now declared as SQUserPointer instead of unsigned int
 
-first pass for 64bits compatibility
 
-fixed minor bug in the stdio stream
 
-fixed a bug in format()
 
-fixed bug in string.tointeger() and string.tofloat()
 

	
 
***2005-06-24	       ***
 
***version 2.0.3 stable***
 
-dofile() and loadfile() in the iolib now can decode ASCII, UTF8 files UCS2 big-endian and little-endian
 
-sq_setparamscheck() : now typemesk can check for null
 
-added string escape sequence \xhhhh
 
-fixed some C++ standard incompatibilities
 

	
 
***2005-05-15	       ***
 
***version 2.0.2 stable***
 
-performances improvements (expecially for GCC users)
 
-removed all dependencies from C++ exception handling
 
-various bugfixes
 

	
 
***2005-04-12		 ***
 
***version 2.0.1 stable***
 
-various bugfixes
 
-sq_setparamscheck() now allows spaces in the typemask
 

	
 
***2005-04-03		 ***
 
***version 2.0 stable***
 
-added API sq_gettypetag()
 
-added built-in function to the bool type(tointeger, tostring etc...)
 

	
 
***2005-02-27							***
 
***version 2.0 release candidate 1(RC 1)***
 
-added API sq_reseterror()
 
-modified sq_release()
 
-now class instances can be cloned
 
-various bufixes
 

	
 
***2005-01-26        ***
 
***version 2.0 beta 1***
 
-added bool type
 
-class properties can be redefined in a derived class
 
-added ops *= /= and %=
 
-new syntax for class attributes declaration </ and /> instead of ( and )
 
-increased the max number of literals per function from 65535 to 16777215
 
-now free variables have proper lexical scoping
 
-added API sq_createinstance(), sq_pushbool(), sq_getbool()
 
-added built-in function type()
 
-added built-in function obj.rawin(key) in table,class and instance
 
-sq_rawget() and sq_rawset() now work also on classes and instances
 
-the VM no longer uses C++ exception handling (more suitable for embedded devices)
 
-various bufixes
 

	
 
***2004-12-21         ***
 
***version 2.0 alpha 2***
 
-globals scoping changed, now if :: is omitted the VM automatically falls back on the root table
 
-various bufixes
 
-added class level attributes
 

	
 
***2004-12-12         ***
 
***version 2.0 alpha 1***
 
-codebase branch from version 1.x
 
-added classes
 
-added functions with variable number of parameters(vargc & vargv and the ...)
 
-0 and 0.0 are now considered 'false' by all conditional statements(if,while,for,?,do-while)
 
-added new api functions sq_newclass() sq_setinstanceup() sq_getinstanceup() sq_getattributes() sq_setattributes()
 
-modified api sq_settypetag()
 

	
 
***2004-11-01        ***
 
***version 1.0 stable***
 
-fixed some minor bug
 
-improoved operator 'delete' performances
 
-added scientific notation for float numbers( eg. 2.e16 or 2.e-2)
 

	
 
***2004-08-30        ***
 
***version 1.0 release candidate 2(RC 2)***
 
-fixed bug in the vm(thx Pierre Renaux)
 
-fixed bug in the optimizer(thx Pierre Renaux)
 
-fixed some bug in the documentation(thx JD)
 
-added new api functions for raw object handling
 
-removed nested multiline comments
 
-reduced memory footprint in C references
 

	
 
***2004-08-23        ***
 
***version 1.0 release candidate 1(RC 1)***
 
-fixed division by zero
 
-the 'in' operator and obj.rawget() do not query the default delegate anymore
 
-added function sq_getprintfunc()
 
-added new standard library 'auxlib'(implements default error handlers)
 

	
 
***2004-07-12        ***
 
***version 1.0 beta 4***
 
-fixed a bug in the integer.tochar() built-in method
 
-fixed unary minus operator
 
-fixed bug in dofile()
 
-fixed inconsistency between != and == operators(on float/integer comparison)
 
-added javascript style unsigned right shift operator '>>>'
 
-added array(size) constructor built-in function
 
-array.resize(size,[fill]) built-in function accepts an optional 'fill' value
 
-improved debug API, added sq_getclosureinfo() and sq_setnativeclosurename()
 

	
 
***2004-05-23        ***
 
***version 1.0 beta 3***
 
-minor vm bug fixes
 
-string allocation is now faster
 
-tables and array memory usage is now less conservative(they shrink)
 
-added regular expression routines in the standard library
 
-The 'c' expression now accepts only 1 character(thx irbrian)
 
-multiline strings <[ ]> have been substituted with C# style verbatim strings (eg. @"string")
 
-added new keyword 'parent' for accessing the delegate of tables and unserdata
 
-The metamethod '_clone' has been renamed '_cloned'
 
-the _delslot metamethod's behaviour and prototype have been changed
 
-new default function in the integer and float object 'tochar()'
 
-the built-in function chcode2string has been removed
 
-the default method [table].getdelegate() has been removed
 
-new api sq_rawdeleteslot()
 
-new table built-in method rawdelete(key)
 
-the dynamic mudule loading has been removed from the standard distribution
 
-some optimizations in the VM
 

	
 
***2004-04-21        ***
 
***version 1.0 beta 2***
 
-minor compiler/parser bug fixes
 
-sq_newclosure has a different prototype, the "paramscheck" of paramter has been moved to the new function sq_setparamscheck()
 
-sq_setparamscheck allows to add automatic parameters type checking in native closures
 
-sq_compile() lost the lineinfo parameter
 
-new api sq_enabledebuginfo() globally sets compiler's debug info generation
 
-added consistency check on bytecode serialization
 
-fixed += operator, now works on strings like +
 
-added global slot in the base lib _charsize_ to recognize unicode builds from ascii builds runtime
 
-added registry table
 
-new api call sq_pushregistrytable()
 
-added type tag to the userdata type sq_settypetag()
 
-sq_getuserdata now queries the userdata typetag
 
-the built in function collect_garbage() as been renamed collectgarbage() for consistency reasons
 
-new standard libraries(sqlibs are now obsolete)
 

	
 
***2004-02-20	     ***
 
***version 1.0 beta 1***
 
-fixed a bug in the compiler (thanks Martin Kofler)
 
-fixed bug in the switch case statement
 
-fixed the _unm metamethod
 
-fixed minor bugs in the API
 
-fixed automatic stack resizing
 
-first beta version
 
	first pass code clean up in the VM and base lib
 
	first pass code coverege test has been done on VM and built-in lib
 
-new VM creation API sq_open() sq_close() (sq_newvm and sq_releasevm are now obsolete)
 
-new api allows to specifiy a "print" function to output text(sq_printfunc)
 
-added some small optimizations
 
-new cooperative multi-threading capabilities in the base library(coroutines), VMs are now a built in type("thread")
 
-new built in functions have been added for manipulating the new "thread" type
 
-friend virtual machines share the same root table, error handler and debug hook by default
 
-new compile time options
 

	
 
***2004-01-19       ***
 
***version 0.9 alpha***
 
-fixed a garbage collection bug
 
-fixed some API bugs(thanks to Joshua Jensen)
 
-fixed tail calls (in the version 0.8 the tail call optimization was erroneously disabled)
 
-new function parameters semantic, now passing a wrong number of parameters generates an exception
 
-native closures have now a built in parameter number checking
 
-sq_rawget and sq_rawset now work also on arrays
 
-sq_getsize now woks also on userdata
 
-the userdata release hook prototype is changed(now passes the size of the userdata)
 
-the lexer reader function now returns an integer instead of a char that allows better error checking on the input(thx Joshua Jensen)
 
-faster compiler
 
-try/catch blocks do not cause any runtime memory allocation anymore
 

	
 
***2003-12-06       ***
 
***version 0.8 alpha***
 
-fixed a bug that was preventing to have callable userdata throught the metamethod _call
 
-fixed a garbage collection bug
 
-fixed == operator now can compare correctly different types
 
-new built in method getstackinfos(level)
 
-improoved line informations precision for the debug hook
 
-new api call sq_compilebuffer()
 
-new built-in api function compilestring()
 
-new syntactic sugar for function declarations inside tables
 
-the debug API has been finalized
 

	
 
***2003-11-17       ***
 
***version 0.7 alpha***
 
-fixed critical bug SQInteger the tail call system
 
-fixed bug in the continue statement code generation
 
-fixed func call param issue(thanks to Rewoonenco Andrew)
 
-added _delslot metamethod(thanks to Rewoonenco Andrew)
 
-new multiline string expression ( delimited by <[ and ]> )
 
-normal strings ("") do not allow embedded new line anymore
 
-reduced vm memory footprint(C refs are shared between friend VMs)
 
-new api method sq_deleteslot()
 
-new debug hook event 'r' is triggered when a function returns
 

	
 
***2003-11-04       ***
 
***version 0.6 alpha***
 
-fixed switch statement(was executing the default case after a break)
 
-sq_call() doesn't pop the closure (just the params)
 
-the vm execution can be suspended from the C API anytime (micro-threads)
 
-new api calls sq_suspendvm() sq_wakeupvm() sq_getvmstate() and sq_reservestack()
 

	
 
***2003-10-13       ***
 
***version 0.5 alpha***
 
-fixed some minor bug
 
-tested with non ASCII identifiers in unicode mode(I've tried chinese chars)
 
-added built-in function string.find()
 
-the built-in function array.sort() optionally accepts a cmp(a,b) function
 
-the debug hook function now has a new prototype debug_hook(event_type,sourcefile,line,functionname)
 
-fixed some debug info imprecision
 

	
 
***2003-10-01       ***
 
***version 0.4 alpha***
 
-faster VM
 
-sq_call will pop arguments and closure also in case of failure
 
-fixed a bug in sq_remove
 
-now the VM detects delegation cycles(and throws an exception)
 
-new operators ++ and --
 
-new operator ',' comma operator
 
-fixed some expression precedence issue
 
-fixed bug in sq_arraypop
 

	
 
***2003-09-15       ***
 
***version 0.3 alpha***
 
-fixed a bug in array::insert()
 
-optional Unicode core(define SQUNICODE or _UNICODE on Win32)
 
-sq_compiler uses a new reader function SQLEXREADFUNC
 
-the debug hook passes 'l' instead of 'line' for line callbacks
 
	and 'c' instead of 'call' for call callbacks
 
-new array.extend() bulit-in function
 
-new API sq_clone()
 

	
 
***2003-09-10           ***
 
***version 0.2 pre-alpha***
 
-new completely reentrant VM (sq_open and sq_close are now obsolete)
 
-sq_newvm() has a new prototype
 
-allocators are now global and linked in the VM
 
-_newslot meta method added
 
-rawset creates a slot if doesn't exists
 
-the compiler error callback pass the vm handle(thanks Pierre Renaux)
 
-sq_setforeignptr() sq_getforeingptr() are now public
 
-sq_resume() now is possible to resume generators from C
 
-sq_getlasterror() retrieve the last thrown error
 
-improved docs
 

	
 
***2003-09-06           ***
 
***version 0.1 pre-alpha***
 
first release
src/3rdparty/squirrel/Makefile
Show inline comments
 
new file 100644
 

	
 
SQUIRREL=.
 
MAKE=make
 

	
 
sq32:
 
	cd squirrel; $(MAKE)
 
	cd sqstdlib; $(MAKE)
 
	cd sq; $(MAKE)
 

	
 
sqprof:
 
	cd squirrel; $(MAKE) sqprof
 
	cd sqstdlib; $(MAKE) sqprof
 
	cd sq; $(MAKE) sqprof
 

	
 
sq64:
 
	cd squirrel; $(MAKE) sq64
 
	cd sqstdlib; $(MAKE) sq64
 
	cd sq; $(MAKE) sq64
 

	
 
clean:
 
	$(MAKE) -C squirrel clean
 
	$(MAKE) -C sqstdlib clean
 
	$(MAKE) -C sq clean
src/3rdparty/squirrel/README
Show inline comments
 
new file 100644
 
The programming language SQUIRREL 2.2.1 stable
 

	
 
--------------------------------------------------
 
The project has been compiled and run on Windows(Windows XP/2000 on Intel x86 Windows XP Pro on AMD x64) and
 
Linux(Slackware 9.0 on Intel x86, Fedora Core 4 on AMD x64).
 

	
 
Has been tested with the following compilers:
 
	MS Visual C++ 6.0,7.0,7.1 and 8.0 (32 and 64bits)
 
	MinGW gcc 3.2 (mingw special 20020817-1)
 
	Cygnus gcc 3.2
 
	Linux gcc 3.2.3
 
	Linux gcc 4.0.0 (x86 64bits)
 

	
 

	
 
Feedback and suggestions are appreciated
 
project page - http://www.squirrel-lang.org
 
community forums - http://www.squirrel-lang.org/Forums
 
wiki - http://wiki.squirrel-lang.org
 
author - alberto@demichelis.net
 

	
 
END OF README
 

	
src/3rdparty/squirrel/README.OpenTTD
Show inline comments
 
new file 100644
 
This folder contains a modified version of Squirrel that is tailored to meet
 
the needs of OpenTTD.
 
We have based this modification on the version as described in:
 
include/squirrel.h
src/3rdparty/squirrel/doc/sqstdlib2.chm
Show inline comments
 
new file 100644
 
binary diff not shown
src/3rdparty/squirrel/doc/squirrel2.chm
Show inline comments
 
new file 100644
 
binary diff not shown
src/3rdparty/squirrel/etc/minimal.c
Show inline comments
 
new file 100644
 
#include <stdarg.h>
 
#include <stdio.h>
 

	
 
#include <squirrel.h>
 
#include <sqstdio.h>
 
#include <sqstdaux.h>
 

	
 
#ifdef _MSC_VER
 
#pragma comment (lib ,"squirrel.lib")
 
#pragma comment (lib ,"sqstdlib.lib")
 
#endif
 

	
 
#ifdef SQUNICODE
 
#define scvprintf vwprintf
 
#else
 
#define scvprintf vprintf
 
#endif
 

	
 
void printfunc(HSQUIRRELVM v, const SQChar *s, ...)
 
{
 
va_list arglist;
 
va_start(arglist, s);
 
scvprintf(s, arglist);
 
va_end(arglist);
 
}
 

	
 
void call_foo(HSQUIRRELVM v, int n,float f,const SQChar *s)
 
{
 
	SQInteger top = sq_gettop(v); //saves the stack size before the call
 
	sq_pushroottable(v); //pushes the global table
 
	sq_pushstring(v,_SC("foo"),-1);
 
	if(SQ_SUCCEEDED(sq_get(v,-2))) { //gets the field 'foo' from the global table
 
		sq_pushroottable(v); //push the 'this' (in this case is the global table)
 
		sq_pushinteger(v,n);
 
		sq_pushfloat(v,f);
 
		sq_pushstring(v,s,-1);
 
		sq_call(v,4,SQFalse,SQTrue); //calls the function
 
	}
 
	sq_settop(v,top); //restores the original stack size
 
}
 

	
 
int main(int argc, char* argv[])
 
{
 
	HSQUIRRELVM v;
 
	v = sq_open(1024); // creates a VM with initial stack size 1024
 

	
 
	//sq_pushroottable(v); //push the root table were to register the lib function
 
	//sqstd_register_iolib(v);
 
	sqstd_seterrorhandlers(v); //registers the default error handlers
 

	
 
	sq_setprintfunc(v, printfunc); //sets the print function
 

	
 
	sq_pushroottable(v); //push the root table(were the globals of the script will be stored)
 
	if(SQ_SUCCEEDED(sqstd_dofile(v, _SC("test.nut"), SQFalse, SQTrue))) // also prints syntax errors if any
 
	{
 
		call_foo(v,1,2.5,_SC("teststring"));
 
	}
 

	
 
	sq_pop(v,1); //pops the root table
 
	sq_close(v);
 

	
 
	return 0;
 
}
src/3rdparty/squirrel/etc/test.nut
Show inline comments
 
new file 100644
 
function foo(i, f, s)
 
{
 
    print("Called foo(), i="+i+", f="+f+", s='"+s+"'\n");
 
}
src/3rdparty/squirrel/include/sqstdaux.h
Show inline comments
 
new file 100644
 
/*	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_ */
src/3rdparty/squirrel/include/sqstdblob.h
Show inline comments
 
new file 100644
 
/*	see copyright notice in squirrel.h */
 
#ifndef _SQSTDBLOB_H_
 
#define _SQSTDBLOB_H_
 

	
 
#ifdef __cplusplus
 
extern "C" {
 
#endif
 

	
 
SQUIRREL_API SQUserPointer sqstd_createblob(HSQUIRRELVM v, SQInteger size);
 
SQUIRREL_API SQRESULT sqstd_getblob(HSQUIRRELVM v,SQInteger idx,SQUserPointer *ptr);
 
SQUIRREL_API SQInteger sqstd_getblobsize(HSQUIRRELVM v,SQInteger idx);
 

	
 
SQUIRREL_API SQRESULT sqstd_register_bloblib(HSQUIRRELVM v);
 

	
 
#ifdef __cplusplus
 
} /*extern "C"*/
 
#endif
 

	
 
#endif /*_SQSTDBLOB_H_*/
 

	
src/3rdparty/squirrel/include/sqstdio.h
Show inline comments
 
new file 100644
 
/*	see copyright notice in squirrel.h */
 
#ifndef _SQSTDIO_H_
 
#define _SQSTDIO_H_
 

	
 
#ifdef __cplusplus
 

	
 
#define SQSTD_STREAM_TYPE_TAG 0x80000000
 

	
 
struct SQStream {
 
	virtual ~SQStream() {}
 
	virtual SQInteger Read(void *buffer, SQInteger size) = 0;
 
	virtual SQInteger Write(void *buffer, SQInteger size) = 0;
 
	virtual SQInteger Flush() = 0;
 
	virtual SQInteger Tell() = 0;
 
	virtual SQInteger Len() = 0;
 
	virtual SQInteger Seek(SQInteger offset, SQInteger origin) = 0;
 
	virtual bool IsValid() = 0;
 
	virtual bool EOS() = 0;
 
};
 

	
 
extern "C" {
 
#endif
 

	
 
#define SQ_SEEK_CUR 0
 
#define SQ_SEEK_END 1
 
#define SQ_SEEK_SET 2
 

	
 
typedef void* SQFILE;
 

	
 
SQUIRREL_API SQFILE sqstd_fopen(const SQChar *,const SQChar *);
 
SQUIRREL_API SQInteger sqstd_fread(SQUserPointer, SQInteger, SQInteger, SQFILE);
 
SQUIRREL_API SQInteger sqstd_fwrite(const SQUserPointer, SQInteger, SQInteger, SQFILE);
 
SQUIRREL_API SQInteger sqstd_fseek(SQFILE , SQInteger , SQInteger);
 
SQUIRREL_API SQInteger sqstd_ftell(SQFILE);
 
SQUIRREL_API SQInteger sqstd_fflush(SQFILE);
 
SQUIRREL_API SQInteger sqstd_fclose(SQFILE);
 
SQUIRREL_API SQInteger sqstd_feof(SQFILE);
 

	
 
SQUIRREL_API SQRESULT sqstd_createfile(HSQUIRRELVM v, SQFILE file,SQBool own);
 
SQUIRREL_API SQRESULT sqstd_getfile(HSQUIRRELVM v, SQInteger idx, SQFILE *file);
 

	
 
//compiler helpers
 
SQUIRREL_API SQRESULT sqstd_loadfile(HSQUIRRELVM v,const SQChar *filename,SQBool printerror);
 
SQUIRREL_API SQRESULT sqstd_dofile(HSQUIRRELVM v,const SQChar *filename,SQBool retval,SQBool printerror);
 
SQUIRREL_API SQRESULT sqstd_writeclosuretofile(HSQUIRRELVM v,const SQChar *filename);
 

	
 
SQUIRREL_API SQRESULT sqstd_register_iolib(HSQUIRRELVM v);
 

	
 
#ifdef __cplusplus
 
} /*extern "C"*/
 
#endif
 

	
 
#endif /*_SQSTDIO_H_*/
 

	
src/3rdparty/squirrel/include/sqstdmath.h
Show inline comments
 
new file 100644
 
/*	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_*/
src/3rdparty/squirrel/include/sqstdstring.h
Show inline comments
 
new file 100644
 
/*	see copyright notice in squirrel.h */
 
#ifndef _SQSTD_STRING_H_
 
#define _SQSTD_STRING_H_
 

	
 
#ifdef __cplusplus
 
extern "C" {
 
#endif
 

	
 
typedef unsigned int SQRexBool;
 
typedef struct SQRex SQRex;
 

	
 
typedef struct {
 
	const SQChar *begin;
 
	SQInteger len;
 
} SQRexMatch;
 

	
 
SQUIRREL_API SQRex *sqstd_rex_compile(const SQChar *pattern,const SQChar **error);
 
SQUIRREL_API void sqstd_rex_free(SQRex *exp);
 
SQUIRREL_API SQBool sqstd_rex_match(SQRex* exp,const SQChar* text);
 
SQUIRREL_API SQBool sqstd_rex_search(SQRex* exp,const SQChar* text, const SQChar** out_begin, const SQChar** out_end);
 
SQUIRREL_API SQBool sqstd_rex_searchrange(SQRex* exp,const SQChar* text_begin,const SQChar* text_end,const SQChar** out_begin, const SQChar** out_end);
 
SQUIRREL_API SQInteger sqstd_rex_getsubexpcount(SQRex* exp);
 
SQUIRREL_API SQBool sqstd_rex_getsubexp(SQRex* exp, SQInteger n, SQRexMatch *subexp);
 

	
 
SQUIRREL_API SQRESULT sqstd_register_stringlib(HSQUIRRELVM v);
 

	
 
#ifdef __cplusplus
 
} /*extern "C"*/
 
#endif
 

	
 
#endif /*_SQSTD_STRING_H_*/
src/3rdparty/squirrel/include/sqstdsystem.h
Show inline comments
 
new file 100644
 
/*	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_ */
src/3rdparty/squirrel/include/squirrel.h
Show inline comments
 
new file 100644
 
/*
 
Copyright (c) 2003-2008 Alberto Demichelis
 

	
 
This software is provided 'as-is', without any
 
express or implied warranty. In no event will the
 
authors be held liable for any damages arising from
 
the use of this software.
 

	
 
Permission is granted to anyone to use this software
 
for any purpose, including commercial applications,
 
and to alter it and redistribute it freely, subject
 
to the following restrictions:
 

	
 
		1. The origin of this software must not be
 
		misrepresented; you must not claim that
 
		you wrote the original software. If you
 
		use this software in a product, an
 
		acknowledgment in the product
 
		documentation would be appreciated but is
 
		not required.
 

	
 
		2. Altered source versions must be plainly
 
		marked as such, and must not be
 
		misrepresented as being the original
 
		software.
 

	
 
		3. This notice may not be removed or
 
		altered from any source distribution.
 

	
 
*/
 
#ifndef _SQUIRREL_H_
 
#define _SQUIRREL_H_
 

	
 
#ifdef __cplusplus
 
extern "C" {
 
#endif
 

	
 
#if defined(_MSC_VER) && _MSC_VER >= 1400 // MSVC 2005 safety checks
 
# pragma warning(disable: 4996)   // '_wfopen' was declared deprecated
 
# define _CRT_SECURE_NO_DEPRECATE // all deprecated 'unsafe string functions
 
# define _CRT_NON_CONFORMING_SWPRINTFS // another deprecated stuff
 
#endif /* _MSC_VER >= 1400 */
 

	
 
#ifndef SQUIRREL_API
 
#define SQUIRREL_API extern
 
#endif
 

	
 
#if (defined(_WIN64) || defined(_LP64)) && !defined(_SQ64)
 
#define _SQ64
 
#endif
 

	
 
#ifdef _SQ64
 
#ifdef _MSC_VER
 
typedef __int64 SQInteger;
 
typedef unsigned __int64 SQUnsignedInteger;
 
typedef unsigned __int64 SQHash; /*should be the same size of a pointer*/
 
#else
 
typedef long SQInteger;
 
typedef unsigned long SQUnsignedInteger;
 
typedef unsigned long SQHash; /*should be the same size of a pointer*/
 
#endif
 
typedef int SQInt32;
 
#else
 
typedef int SQInteger;
 
typedef int SQInt32; /*must be 32 bits(also on 64bits processors)*/
 
typedef unsigned int SQUnsignedInteger;
 
typedef unsigned int SQHash; /*should be the same size of a pointer*/
 
#endif
 

	
 

	
 
typedef float SQFloat;
 
typedef void* SQUserPointer;
 
typedef SQUnsignedInteger SQBool;
 
typedef SQInteger SQRESULT;
 

	
 
#define SQTrue	(1)
 
#define SQFalse	(0)
 

	
 
struct SQVM;
 
struct SQTable;
 
struct SQArray;
 
struct SQString;
 
struct SQClosure;
 
struct SQGenerator;
 
struct SQNativeClosure;
 
struct SQUserData;
 
struct SQFunctionProto;
 
struct SQRefCounted;
 
struct SQClass;
 
struct SQInstance;
 
struct SQDelegable;
 

	
 
#ifdef _UNICODE
 
#define SQUNICODE
 
#endif
 

	
 
#ifdef SQUNICODE
 
#if (defined(_MSC_VER) && _MSC_VER >= 1400) // 1400 = VS8
 

	
 
#ifndef _WCHAR_T_DEFINED //this is if the compiler considers wchar_t as native type
 
typedef unsigned short wchar_t;
 
#endif
 
#endif
 

	
 
typedef wchar_t SQChar;
 
#define _SC(a) L##a
 
#define	scstrcmp	wcscmp
 
#define scsprintf	swprintf
 
#define scsnprintf	_snwprintf
 
#define scstrlen	wcslen
 
#define scstrtod	wcstod
 
#define scstrtol	wcstol
 
#define scatoi		_wtoi
 
#define scstrtoul	wcstoul
 
#define scvsprintf	vswprintf
 
#define scstrstr	wcsstr
 
#define scisspace	iswspace
 
#define scisdigit	iswdigit
 
#define scisxdigit	iswxdigit
 
#define scisalpha	iswalpha
 
#define sciscntrl	iswcntrl
 
#define scisalnum	iswalnum
 
#define scprintf	wprintf
 
#define scfprintf	fwprintf
 
#define scvprintf	vwprintf
 
#define scvfprintf	vfwprintf
 
#define scvsnprintf	_vsnwprintf
 
#define scstrdup	_wcsdup
 
#define scstrrchr	wcsrchr
 
#define scstrcat	wcscat
 
#define MAX_CHAR 0xFFFF
 
#else
 
typedef char SQChar;
 
#define _SC(a) a
 
#define	scstrcmp	strcmp
 
#define scsprintf	sprintf
 
#define scsnprintf	snprintf
 
#define scstrlen	strlen
 
#define scstrtod	strtod
 
#define scstrtol	strtol
 
#define scatoi		atoi
 
#define scstrtoul	strtoul
 
#define scvsprintf	vsprintf
 
#define scstrstr	strstr
 
#define scisspace	isspace
 
#define scisdigit	isdigit
 
#define scisxdigit	isxdigit
 
#define sciscntrl	iscntrl
 
#define scisalpha	isalpha
 
#define scisalnum	isalnum
 
#define scprintf	printf
 
#define scfprintf	fprintf
 
#define scvprintf	vprintf
 
#define scvfprintf	vfprintf
 
#define scvsnprintf	vsnprintf
 
#define scstrdup	strdup
 
#define scstrrchr	strrchr
 
#define scstrcat	strcat
 
#define MAX_CHAR 0xFF
 
#endif
 

	
 
#define SQUIRREL_VERSION	_SC("Squirrel 2.2.2 stable - With custom OpenTTD modifications")
 
#define SQUIRREL_COPYRIGHT	_SC("Copyright (C) 2003-2008 Alberto Demichelis")
 
#define SQUIRREL_AUTHOR		_SC("Alberto Demichelis")
 

	
 
#define SQ_VMSTATE_IDLE			0
 
#define SQ_VMSTATE_RUNNING		1
 
#define SQ_VMSTATE_SUSPENDED	2
 

	
 
#define SQUIRREL_EOB 0
 
#define SQ_BYTECODE_STREAM_TAG	0xFAFA
 

	
 
#define SQOBJECT_REF_COUNTED	0x08000000
 
#define SQOBJECT_NUMERIC		0x04000000
 
#define SQOBJECT_DELEGABLE		0x02000000
 
#define SQOBJECT_CANBEFALSE		0x01000000
 

	
 
#define SQ_MATCHTYPEMASKSTRING (-99999)
 

	
 
#define _RT_MASK 0x00FFFFFF
 
#define _RAW_TYPE(type) (type&_RT_MASK)
 

	
 
#define _RT_NULL			0x00000001
 
#define _RT_INTEGER			0x00000002
 
#define _RT_FLOAT			0x00000004
 
#define _RT_BOOL			0x00000008
 
#define _RT_STRING			0x00000010
 
#define _RT_TABLE			0x00000020
 
#define _RT_ARRAY			0x00000040
 
#define _RT_USERDATA		0x00000080
 
#define _RT_CLOSURE			0x00000100
 
#define _RT_NATIVECLOSURE	0x00000200
 
#define _RT_GENERATOR		0x00000400
 
#define _RT_USERPOINTER		0x00000800
 
#define _RT_THREAD			0x00001000
 
#define _RT_FUNCPROTO		0x00002000
 
#define _RT_CLASS			0x00004000
 
#define _RT_INSTANCE		0x00008000
 
#define _RT_WEAKREF			0x00010000
 

	
 
typedef enum tagSQObjectType{
 
	OT_NULL =			(_RT_NULL|SQOBJECT_CANBEFALSE),
 
	OT_INTEGER =		(_RT_INTEGER|SQOBJECT_NUMERIC|SQOBJECT_CANBEFALSE),
 
	OT_FLOAT =			(_RT_FLOAT|SQOBJECT_NUMERIC|SQOBJECT_CANBEFALSE),
 
	OT_BOOL =			(_RT_BOOL|SQOBJECT_CANBEFALSE),
 
	OT_STRING =			(_RT_STRING|SQOBJECT_REF_COUNTED),
 
	OT_TABLE =			(_RT_TABLE|SQOBJECT_REF_COUNTED|SQOBJECT_DELEGABLE),
 
	OT_ARRAY =			(_RT_ARRAY|SQOBJECT_REF_COUNTED),
 
	OT_USERDATA =		(_RT_USERDATA|SQOBJECT_REF_COUNTED|SQOBJECT_DELEGABLE),
 
	OT_CLOSURE =		(_RT_CLOSURE|SQOBJECT_REF_COUNTED),
 
	OT_NATIVECLOSURE =	(_RT_NATIVECLOSURE|SQOBJECT_REF_COUNTED),
 
	OT_GENERATOR =		(_RT_GENERATOR|SQOBJECT_REF_COUNTED),
 
	OT_USERPOINTER =	_RT_USERPOINTER,
 
	OT_THREAD =			(_RT_THREAD|SQOBJECT_REF_COUNTED) ,
 
	OT_FUNCPROTO =		(_RT_FUNCPROTO|SQOBJECT_REF_COUNTED), //internal usage only
 
	OT_CLASS =			(_RT_CLASS|SQOBJECT_REF_COUNTED),
 
	OT_INSTANCE =		(_RT_INSTANCE|SQOBJECT_REF_COUNTED|SQOBJECT_DELEGABLE),
 
	OT_WEAKREF =		(_RT_WEAKREF|SQOBJECT_REF_COUNTED)
 
}SQObjectType;
 

	
 
#define ISREFCOUNTED(t) (t&SQOBJECT_REF_COUNTED)
 

	
 

	
 
typedef union tagSQObjectValue
 
{
 
	struct SQTable *pTable;
 
	struct SQArray *pArray;
 
	struct SQClosure *pClosure;
 
	struct SQGenerator *pGenerator;
 
	struct SQNativeClosure *pNativeClosure;
 
	struct SQString *pString;
 
	struct SQUserData *pUserData;
 
	SQInteger nInteger;
 
	SQFloat fFloat;
 
	SQUserPointer pUserPointer;
 
	struct SQFunctionProto *pFunctionProto;
 
	struct SQRefCounted *pRefCounted;
 
	struct SQDelegable *pDelegable;
 
	struct SQVM *pThread;
 
	struct SQClass *pClass;
 
	struct SQInstance *pInstance;
 
	struct SQWeakRef *pWeakRef;
 
}SQObjectValue;
 

	
 

	
 
typedef struct tagSQObject
 
{
 
	SQObjectType _type;
 
	SQObjectValue _unVal;
 
}SQObject;
 

	
 
typedef struct tagSQStackInfos{
 
	const SQChar* funcname;
 
	const SQChar* source;
 
	SQInteger line;
 
}SQStackInfos;
 

	
 
typedef struct SQVM* HSQUIRRELVM;
 
typedef SQObject HSQOBJECT;
 
typedef SQInteger (*SQFUNCTION)(HSQUIRRELVM);
 
typedef SQInteger (*SQRELEASEHOOK)(SQUserPointer,SQInteger size);
 
typedef void (*SQCOMPILERERROR)(HSQUIRRELVM,const SQChar * /*desc*/,const SQChar * /*source*/,SQInteger /*line*/,SQInteger /*column*/);
 
typedef void (*SQPRINTFUNCTION)(HSQUIRRELVM,const SQChar * ,...);
 

	
 
typedef SQInteger (*SQWRITEFUNC)(SQUserPointer,SQUserPointer,SQInteger);
 
typedef SQInteger (*SQREADFUNC)(SQUserPointer,SQUserPointer,SQInteger);
 

	
 
typedef SQInteger (*SQLEXREADFUNC)(SQUserPointer);
 

	
 
typedef struct tagSQRegFunction{
 
	const SQChar *name;
 
	SQFUNCTION f;
 
	SQInteger nparamscheck;
 
	const SQChar *typemask;
 
}SQRegFunction;
 

	
 
/*vm*/
 
SQUIRREL_API HSQUIRRELVM sq_open(SQInteger initialstacksize);
 
SQUIRREL_API HSQUIRRELVM sq_newthread(HSQUIRRELVM friendvm, SQInteger initialstacksize);
 
SQUIRREL_API void sq_seterrorhandler(HSQUIRRELVM v);
 
SQUIRREL_API void sq_close(HSQUIRRELVM v);
 
SQUIRREL_API void sq_setforeignptr(HSQUIRRELVM v,SQUserPointer p);
 
SQUIRREL_API SQUserPointer sq_getforeignptr(HSQUIRRELVM v);
 
SQUIRREL_API void sq_setprintfunc(HSQUIRRELVM v, SQPRINTFUNCTION printfunc);
 
SQUIRREL_API SQPRINTFUNCTION sq_getprintfunc(HSQUIRRELVM v);
 
SQUIRREL_API SQRESULT sq_suspendvm(HSQUIRRELVM v);
 
SQUIRREL_API bool sq_resumecatch(HSQUIRRELVM v, int suspend = -1);
 
SQUIRREL_API SQRESULT sq_wakeupvm(HSQUIRRELVM v,SQBool resumedret,SQBool retval,SQBool raiseerror);
 
SQUIRREL_API SQInteger sq_getvmstate(HSQUIRRELVM v);
 

	
 
/*compiler*/
 
SQUIRREL_API SQRESULT sq_compile(HSQUIRRELVM v,SQLEXREADFUNC read,SQUserPointer p,const SQChar *sourcename,SQBool raiseerror);
 
SQUIRREL_API SQRESULT sq_compilebuffer(HSQUIRRELVM v,const SQChar *s,SQInteger size,const SQChar *sourcename,SQBool raiseerror);
 
SQUIRREL_API void sq_enabledebuginfo(HSQUIRRELVM v, SQBool enable);
 
SQUIRREL_API void sq_notifyallexceptions(HSQUIRRELVM v, SQBool enable);
 
SQUIRREL_API void sq_setcompilererrorhandler(HSQUIRRELVM v,SQCOMPILERERROR f);
 

	
 
/*stack operations*/
 
SQUIRREL_API void sq_push(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API void sq_pop(HSQUIRRELVM v,SQInteger nelemstopop);
 
SQUIRREL_API void sq_poptop(HSQUIRRELVM v);
 
SQUIRREL_API void sq_remove(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API SQInteger sq_gettop(HSQUIRRELVM v);
 
SQUIRREL_API void sq_settop(HSQUIRRELVM v,SQInteger newtop);
 
SQUIRREL_API void sq_reservestack(HSQUIRRELVM v,SQInteger nsize);
 
SQUIRREL_API SQInteger sq_cmp(HSQUIRRELVM v);
 
SQUIRREL_API void sq_move(HSQUIRRELVM dest,HSQUIRRELVM src,SQInteger idx);
 

	
 
/*object creation handling*/
 
SQUIRREL_API SQUserPointer sq_newuserdata(HSQUIRRELVM v,SQUnsignedInteger size);
 
SQUIRREL_API void sq_newtable(HSQUIRRELVM v);
 
SQUIRREL_API void sq_newarray(HSQUIRRELVM v,SQInteger size);
 
SQUIRREL_API void sq_newclosure(HSQUIRRELVM v,SQFUNCTION func,SQUnsignedInteger nfreevars);
 
SQUIRREL_API SQRESULT sq_setparamscheck(HSQUIRRELVM v,SQInteger nparamscheck,const SQChar *typemask);
 
SQUIRREL_API SQRESULT sq_bindenv(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API void sq_pushstring(HSQUIRRELVM v,const SQChar *s,SQInteger len);
 
SQUIRREL_API void sq_pushfloat(HSQUIRRELVM v,SQFloat f);
 
SQUIRREL_API void sq_pushinteger(HSQUIRRELVM v,SQInteger n);
 
SQUIRREL_API void sq_pushbool(HSQUIRRELVM v,SQBool b);
 
SQUIRREL_API void sq_pushuserpointer(HSQUIRRELVM v,SQUserPointer p);
 
SQUIRREL_API void sq_pushnull(HSQUIRRELVM v);
 
SQUIRREL_API SQObjectType sq_gettype(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API SQInteger sq_getsize(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API SQRESULT sq_getbase(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API SQBool sq_instanceof(HSQUIRRELVM v);
 
SQUIRREL_API void sq_tostring(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API void sq_tobool(HSQUIRRELVM v, SQInteger idx, SQBool *b);
 
SQUIRREL_API SQRESULT sq_getstring(HSQUIRRELVM v,SQInteger idx,const SQChar **c);
 
SQUIRREL_API SQRESULT sq_getinteger(HSQUIRRELVM v,SQInteger idx,SQInteger *i);
 
SQUIRREL_API SQRESULT sq_getfloat(HSQUIRRELVM v,SQInteger idx,SQFloat *f);
 
SQUIRREL_API SQRESULT sq_getbool(HSQUIRRELVM v,SQInteger idx,SQBool *b);
 
SQUIRREL_API SQRESULT sq_getthread(HSQUIRRELVM v,SQInteger idx,HSQUIRRELVM *thread);
 
SQUIRREL_API SQRESULT sq_getuserpointer(HSQUIRRELVM v,SQInteger idx,SQUserPointer *p);
 
SQUIRREL_API SQRESULT sq_getuserdata(HSQUIRRELVM v,SQInteger idx,SQUserPointer *p,SQUserPointer *typetag);
 
SQUIRREL_API SQRESULT sq_settypetag(HSQUIRRELVM v,SQInteger idx,SQUserPointer typetag);
 
SQUIRREL_API SQRESULT sq_gettypetag(HSQUIRRELVM v,SQInteger idx,SQUserPointer *typetag);
 
SQUIRREL_API void sq_setreleasehook(HSQUIRRELVM v,SQInteger idx,SQRELEASEHOOK hook);
 
SQUIRREL_API SQChar *sq_getscratchpad(HSQUIRRELVM v,SQInteger minsize);
 
SQUIRREL_API SQRESULT sq_getclosureinfo(HSQUIRRELVM v,SQInteger idx,SQUnsignedInteger *nparams,SQUnsignedInteger *nfreevars);
 
SQUIRREL_API SQRESULT sq_setnativeclosurename(HSQUIRRELVM v,SQInteger idx,const SQChar *name);
 
SQUIRREL_API SQRESULT sq_setinstanceup(HSQUIRRELVM v, SQInteger idx, SQUserPointer p);
 
SQUIRREL_API SQRESULT sq_getinstanceup(HSQUIRRELVM v, SQInteger idx, SQUserPointer *p,SQUserPointer typetag);
 
SQUIRREL_API SQRESULT sq_setclassudsize(HSQUIRRELVM v, SQInteger idx, SQInteger udsize);
 
SQUIRREL_API SQRESULT sq_newclass(HSQUIRRELVM v,SQBool hasbase);
 
SQUIRREL_API SQRESULT sq_createinstance(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API SQRESULT sq_setattributes(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API SQRESULT sq_getattributes(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API SQRESULT sq_getclass(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API void sq_weakref(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API SQRESULT sq_getdefaultdelegate(HSQUIRRELVM v,SQObjectType t);
 

	
 
/*object manipulation*/
 
SQUIRREL_API void sq_pushroottable(HSQUIRRELVM v);
 
SQUIRREL_API void sq_pushregistrytable(HSQUIRRELVM v);
 
SQUIRREL_API void sq_pushconsttable(HSQUIRRELVM v);
 
SQUIRREL_API SQRESULT sq_setroottable(HSQUIRRELVM v);
 
SQUIRREL_API SQRESULT sq_setconsttable(HSQUIRRELVM v);
 
SQUIRREL_API SQRESULT sq_newslot(HSQUIRRELVM v, SQInteger idx, SQBool bstatic);
 
SQUIRREL_API SQRESULT sq_deleteslot(HSQUIRRELVM v,SQInteger idx,SQBool pushval);
 
SQUIRREL_API SQRESULT sq_set(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API SQRESULT sq_get(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API SQRESULT sq_rawget(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API SQRESULT sq_rawset(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API SQRESULT sq_rawdeleteslot(HSQUIRRELVM v,SQInteger idx,SQBool pushval);
 
SQUIRREL_API SQRESULT sq_arrayappend(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API SQRESULT sq_arraypop(HSQUIRRELVM v,SQInteger idx,SQBool pushval);
 
SQUIRREL_API SQRESULT sq_arrayresize(HSQUIRRELVM v,SQInteger idx,SQInteger newsize);
 
SQUIRREL_API SQRESULT sq_arrayreverse(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API SQRESULT sq_arrayremove(HSQUIRRELVM v,SQInteger idx,SQInteger itemidx);
 
SQUIRREL_API SQRESULT sq_arrayinsert(HSQUIRRELVM v,SQInteger idx,SQInteger destpos);
 
SQUIRREL_API SQRESULT sq_setdelegate(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API SQRESULT sq_getdelegate(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API SQRESULT sq_clone(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API SQRESULT sq_setfreevariable(HSQUIRRELVM v,SQInteger idx,SQUnsignedInteger nval);
 
SQUIRREL_API SQRESULT sq_next(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API SQRESULT sq_getweakrefval(HSQUIRRELVM v,SQInteger idx);
 
SQUIRREL_API SQRESULT sq_clear(HSQUIRRELVM v,SQInteger idx);
 

	
 
/*calls*/
 
SQUIRREL_API SQRESULT sq_call(HSQUIRRELVM v,SQInteger params,SQBool retval,SQBool raiseerror, int suspend = -1);
 
SQUIRREL_API SQRESULT sq_resume(HSQUIRRELVM v,SQBool retval,SQBool raiseerror);
 
SQUIRREL_API const SQChar *sq_getlocal(HSQUIRRELVM v,SQUnsignedInteger level,SQUnsignedInteger idx);
 
SQUIRREL_API const SQChar *sq_getfreevariable(HSQUIRRELVM v,SQInteger idx,SQUnsignedInteger nval);
 
SQUIRREL_API SQRESULT sq_throwerror(HSQUIRRELVM v,const SQChar *err);
 
SQUIRREL_API void sq_reseterror(HSQUIRRELVM v);
 
SQUIRREL_API void sq_getlasterror(HSQUIRRELVM v);
 

	
 
/*raw object handling*/
 
SQUIRREL_API SQRESULT sq_getstackobj(HSQUIRRELVM v,SQInteger idx,HSQOBJECT *po);
 
SQUIRREL_API void sq_pushobject(HSQUIRRELVM v,HSQOBJECT obj);
 
SQUIRREL_API void sq_addref(HSQUIRRELVM v,HSQOBJECT *po);
 
SQUIRREL_API SQBool sq_release(HSQUIRRELVM v,HSQOBJECT *po);
 
SQUIRREL_API void sq_resetobject(HSQOBJECT *po);
 
SQUIRREL_API const SQChar *sq_objtostring(HSQOBJECT *o);
 
SQUIRREL_API SQBool sq_objtobool(HSQOBJECT *o);
 
SQUIRREL_API SQInteger sq_objtointeger(HSQOBJECT *o);
 
SQUIRREL_API SQFloat sq_objtofloat(HSQOBJECT *o);
 
SQUIRREL_API SQRESULT sq_getobjtypetag(HSQOBJECT *o,SQUserPointer * typetag);
 

	
 
/*GC*/
 
SQUIRREL_API SQInteger sq_collectgarbage(HSQUIRRELVM v);
 

	
 
/*serialization*/
 
SQUIRREL_API SQRESULT sq_writeclosure(HSQUIRRELVM vm,SQWRITEFUNC writef,SQUserPointer up);
 
SQUIRREL_API SQRESULT sq_readclosure(HSQUIRRELVM vm,SQREADFUNC readf,SQUserPointer up);
 

	
 
/*mem allocation*/
 
SQUIRREL_API void *sq_malloc(SQUnsignedInteger size);
 
SQUIRREL_API void *sq_realloc(void* p,SQUnsignedInteger oldsize,SQUnsignedInteger newsize);
 
SQUIRREL_API void sq_free(void *p,SQUnsignedInteger size);
 

	
 
/*debug*/
 
SQUIRREL_API SQRESULT sq_stackinfos(HSQUIRRELVM v,SQInteger level,SQStackInfos *si);
 
SQUIRREL_API void sq_setdebughook(HSQUIRRELVM v);
 

	
 
/*UTILITY MACRO*/
 
#define sq_isnumeric(o) ((o)._type&SQOBJECT_NUMERIC)
 
#define sq_istable(o) ((o)._type==OT_TABLE)
 
#define sq_isarray(o) ((o)._type==OT_ARRAY)
 
#define sq_isfunction(o) ((o)._type==OT_FUNCPROTO)
 
#define sq_isclosure(o) ((o)._type==OT_CLOSURE)
 
#define sq_isgenerator(o) ((o)._type==OT_GENERATOR)
 
#define sq_isnativeclosure(o) ((o)._type==OT_NATIVECLOSURE)
 
#define sq_isstring(o) ((o)._type==OT_STRING)
 
#define sq_isinteger(o) ((o)._type==OT_INTEGER)
 
#define sq_isfloat(o) ((o)._type==OT_FLOAT)
 
#define sq_isuserpointer(o) ((o)._type==OT_USERPOINTER)
 
#define sq_isuserdata(o) ((o)._type==OT_USERDATA)
 
#define sq_isthread(o) ((o)._type==OT_THREAD)
 
#define sq_isnull(o) ((o)._type==OT_NULL)
 
#define sq_isclass(o) ((o)._type==OT_CLASS)
 
#define sq_isinstance(o) ((o)._type==OT_INSTANCE)
 
#define sq_isbool(o) ((o)._type==OT_BOOL)
 
#define sq_isweakref(o) ((o)._type==OT_WEAKREF)
 
#define sq_type(o) ((o)._type)
 

	
 
/* deprecated */
 
#define sq_createslot(v,n) sq_newslot(v,n,SQFalse)
 

	
 
#define SQ_OK (0)
 
#define SQ_ERROR (-1)
 

	
 
#define SQ_FAILED(res) (res<0)
 
#define SQ_SUCCEEDED(res) (res>=0)
 

	
 
#ifdef __cplusplus
 
} /*extern "C"*/
 
#endif
 

	
 
#endif /*_SQUIRREL_H_*/
src/3rdparty/squirrel/samples/ackermann.nut
Show inline comments
 
new file 100644
 
/*
 
*
 
* Original Javascript version by David Hedbor(http://www.bagley.org/~doug/shootout/)
 
*
 
*/
 

	
 
function Ack(M, N) {
 
    if (M == 0) return( N + 1 );
 
    if (N == 0) return( Ack(M - 1, 1) );
 
    return( Ack(M - 1, Ack(M, (N - 1))) );
 
}
 

	
 
local n;
 

	
 
if(ARGS.len()!=0) {
 
   n = ARGS[0].tointeger();
 
  if(n < 1) n = 1;
 
} else {
 
  n = 1;
 
}
 
print("n="+n+"\n");
 
print("Ack(3,"+ n+ "):"+ Ack(3, n));
src/3rdparty/squirrel/samples/array.nut
Show inline comments
 
new file 100644
 
/*
 
*
 
* Original Javascript version by David Hedbor(http://www.bagley.org/~doug/shootout/)
 
*
 
*/
 
local n, i, k;
 

	
 
if(ARGS.len()!=0) {
 
   n = ARGS[0].tointeger();
 
  if(n < 1) n = 1;
 
} else {
 
  n = 1;
 
}
 

	
 
local x = []; x.resize(n);
 
local y = []; y.resize(n);
 

	
 
for (i = 0; i < n; i+=1) {
 
  x[i] = i + 1;
 
  y[i] = 0;
 
}
 

	
 
for (k = 0 ; k < n; k+=1) {
 
  for (i = n-1; i >= 0; i-=1) {
 
	y[i] = y[i]+ x[i];
 
  }
 
}
 
print(y[0].tostring()+" "+y[n-1]);
src/3rdparty/squirrel/samples/class.nut
Show inline comments
 
new file 100644
 
//////////////////////////////////////////////////////////////////////////////////
 
//////////////////////////////////////////////////////////////////////////////////
 
class BaseVector {
 
	constructor(...)
 
	{
 
		if(vargc >= 3) {
 
			x = vargv[0];
 
			y = vargv[1];
 
			z = vargv[2];
 
		}
 
	}
 

	
 

	
 
	x = 0;
 
	y = 0;
 
	z = 0;
 
}
 

	
 
class Vector3 extends BaseVector {
 
	function _add(other)
 
	{
 
		if(other instanceof this.getclass())
 
			return ::Vector3(x+other.x,y+other.y,z+other.z);
 
		else
 
			throw "wrong parameter";
 
	}
 
	function Print()
 
	{
 
		::print(x+","+y+","+z+"\n");
 
	}
 
}
 

	
 
local v0 = Vector3(1,2,3)
 
local v1 = Vector3(11,12,13)
 
local v2 = v0 + v1;
 
v2.Print();
 

	
 
FakeNamespace <- {
 
	Utils = {}
 
}
 

	
 
class FakeNamespace.Utils.SuperClass {
 
	constructor()
 
	{
 
		::print("FakeNamespace.Utils.SuperClass")
 
	}
 
}
 

	
 
local testy = FakeNamespace.Utils.SuperClass();
src/3rdparty/squirrel/samples/classattributes.nut
Show inline comments
 
new file 100644
 
class Foo {
 
	//constructor
 
	constructor(a)
 
	{
 
		testy = ["stuff",1,2,3];
 
	}
 
	//attributes of PrintTesty
 
	</ test = "freakin attribute"/>
 
	function PrintTesty()
 
	{
 
		foreach(i,val in testy)
 
		{
 
			::print("idx = "+i+" = "+val+" \n");
 
		}
 
	}
 
	//attributes of testy
 
	</ flippy = 10 , second = [1,2,3] />
 
	testy = null;
 

	
 
}
 

	
 
foreach(member,val in Foo)
 
{
 
	::print(member+"\n");
 
	local attr;
 
	if((attr = Foo.getattributes(member)) != null) {
 
		foreach(i,v in attr)
 
		{
 
			::print("\t"+i+" = "+(typeof v)+"\n");
 
		}
 
	}
 
	else {
 
		::print("\t<no attributes>\n")
 
	}
 
}
src/3rdparty/squirrel/samples/coroutines.nut
Show inline comments
 
new file 100644
 
function coroutine_test(a,b)
 
{
 
	::print(a+" "+b+"\n");
 
	local ret = ::suspend("suspend 1");
 
	::print("the coroutine says "+ret+"\n");
 
	ret = ::suspend("suspend 2");
 
	::print("the coroutine says "+ret+"\n");
 
	ret = ::suspend("suspend 3");
 
	::print("the coroutine says "+ret+"\n");
 
	return "I'm done"
 
}
 

	
 
local coro = ::newthread(coroutine_test);
 

	
 
local susparam = coro.call("test","coroutine"); //starts the coroutine
 

	
 
local i = 1;
 
do
 
{
 
	::print("suspend passed ["+susparam+"]\n")
 
	susparam = coro.wakeup("ciao "+i);
 
	++i;
 
}while(coro.getstatus()=="suspended")
 

	
 
::print("return passed ["+susparam+"]\n")
src/3rdparty/squirrel/samples/delegation.nut
Show inline comments
 
new file 100644
 

	
 
PEntity <- {
 
	name="noname"
 
	pos={x=0,y=0,z=0}
 
	type="entity"
 
	//methamethod
 
	_typeof=function()
 
	{
 
		return type;
 
	}
 
}
 

	
 
function PEntity::PrintPos()
 
{
 
	::print("x="+pos.x+" y="+pos.y+" z="+pos.z+"\n");
 
}
 

	
 
function PEntity::new(name,pos)
 
{
 
	local newentity=clone ::PEntity;
 
	if(name)
 
		newentity.name=name;
 
	if(pos)
 
		newentity.pos=pos;
 
	return newentity;
 
}
 

	
 
PPlayer <- {
 
	model="warrior.mdl"
 
	weapon="fist"
 
	health=100
 
	armor=0
 
	//overrides the parent type
 
	type="player"
 
}
 

	
 
function PPlayer::new(name,pos)
 
{
 
	local newplayer=delegate ::PEntity.new(name,pos) : clone ::PPlayer;
 
	return newplayer;
 
}
 

	
 
local player=PPlayer.new("godzilla",{x=10,y=20,z=30});
 

	
 
::print("PLAYER NAME"+player.name+"\n");
 
::print("ENTITY TYPE"+typeof player+"\n");
 

	
 
player.PrintPos();
 

	
 
player.pos.x=123;
 

	
 
player.PrintPos();
src/3rdparty/squirrel/samples/fibonacci.nut
Show inline comments
 
new file 100644
 
/*
 
*
 
* Original Javascript version by David Hedbor(http://www.bagley.org/~doug/shootout/)
 
*
 
*/
 

	
 
function fib(n)
 
{
 
    if (n < 2) return 1
 
    return fib(n-2) + fib(n-1)
 
}
 

	
 
local n = ARGS.len()!=0?ARGS[0].tointeger():1
 

	
 
print(fib(n)+"\n")
src/3rdparty/squirrel/samples/flow.nut
Show inline comments
 
new file 100644
 
function min(x,y)
 
	return x<y?x:y;
 

	
 
function max(x,y)
 
	return x>y?x:y;
 

	
 
if(min(100,200)>max(50,20))
 
	print("I'm useless statement just to show up the if/else\n");
 
else
 
	print("squirrel!!\n");
 

	
 
print("\n")
 

	
 
function typy(obj)
 
{
 
	switch(typeof obj)
 
	{
 
		case "integer":
 
		case "float":
 
			return "is a number";
 
		case "table":
 
		case "array":
 
			return "is a container";
 
		default:
 
			return "is other stuff"
 
	}
 
}
 

	
 
local a=1,b={},c=function(a,b){return a+b;}
 

	
 
print("a "+typy(a)+"\n");
 
print("b "+typy(b)+"\n");
 
print("c "+typy(c)+"\n");
src/3rdparty/squirrel/samples/generators.nut
Show inline comments
 
new file 100644
 
/*
 
*Random number function from The Great Computer Language shootout
 
*converted to a generator func
 
*/
 

	
 
function gen_random(max) {
 
	local last=42
 
	local IM = 139968;
 
	local IA = 3877;
 
	local IC = 29573;
 
	for(;;){  //loops forever
 
		yield (max * (last = (last * IA + IC) % IM) / IM);
 
	}
 
}
 

	
 
local randtor=gen_random(100);
 

	
 
print("RAND NUMBERS \n")
 

	
 
for(local i=0;i<10;i+=1)
 
	print(">"+resume randtor+"\n");
 

	
 
print("FIBONACCI \n")
 
function fiboz(n)
 
{
 
	local prev=0;
 
	local curr=1;
 
	yield 1;
 

	
 
	for(local i=0;i<n-1;i+=1)
 
	{
 
		local res=prev+curr;
 
		prev=curr;
 
		yield curr=res;
 
	}
 
	return prev+curr;
 
}
 

	
 
foreach(val in fiboz(10))
 
{
 
	::print(">"+val+"\n");
 
}
src/3rdparty/squirrel/samples/hello.nut
Show inline comments
 
new file 100644
 
print("Hello World!")
 
\ No newline at end of file
src/3rdparty/squirrel/samples/list.nut
Show inline comments
 
new file 100644
 
/*translation of the list test from The Great Computer Language Shootout
 
*/
 

	
 
function compare_arr(a1,a2)
 
{
 
	foreach(i,val in a1)
 
		if(val!=a2[i])return null;
 
	return 1;
 
}
 

	
 
function test()
 
{
 
	local size=10000
 
	local l1=[]; l1.resize(size);
 
	for(local i=0;i<size;i+=1) l1[i]=i;
 
	local l2=clone l1;
 
	local l3=[]
 

	
 
	l2.reverse();
 
	while(l2.len()>0)
 
		l3.append(l2.pop());
 
	while(l3.len()>0)
 
		l2.append(l3.pop());
 
	l1.reverse();
 

	
 
	if(compare_arr(l1,l2))
 
		return l1.len();
 
	return null;
 
}
 

	
 
local n = ARGS.len()!=0?ARGS[0].tointeger():1
 
for(local i=0;i<n;i+=1)
 
	if(!test())
 
	{
 
		print("failed");
 
		return;
 
	}
 

	
 
print("oki doki");
src/3rdparty/squirrel/samples/loops.nut
Show inline comments
 
new file 100644
 
local arr=["one","two","three"]
 

	
 
::print("FOREACH\n");
 

	
 
foreach(i,val in arr)
 
{
 
	::print("index ["+i+"]="+val+"\n");
 
}
 

	
 
::print("FOR\n");
 

	
 
for(local i=0;i<arr.len();i+=1)
 
{
 
	::print("index ["+i+"]="+arr[i]+"\n");
 
}
 

	
 
::print("WHILE\n");
 

	
 
local i=0;
 
while(i<arr.len())
 
{
 
	::print("index ["+i+"]="+arr[i]+"\n");
 
	i+=1;
 
}
 
::print("DO WHILE\n");
 

	
 
local i=0;
 
do
 
{
 
	::print("index ["+i+"]="+arr[i]+"\n");
 
	i+=1;
 
}while(i<arr.len());
src/3rdparty/squirrel/samples/matrix.nut
Show inline comments
 
new file 100644
 
/*
 
*
 
* Original Javascript version by David Hedbor(http://www.bagley.org/~doug/shootout/)
 
*
 
*/
 
local SIZE=30;
 

	
 
function mkmatrix(rows, cols) {
 
  local i, j, count = 1;
 
  local m = []; m.resize(rows);
 
  for (i = 0; i < rows; i+=1) {
 
    m[i] = [];m[i].resize(cols)
 
    for (j = 0; j < cols; j+=1) {
 
      m[i][j] = count+=1;
 
    }
 
  }
 
  return m;
 
}
 

	
 
function mmult(rows, cols,  m1, m2, m3) {
 
  local i, j, k, val;
 
  for (i = 0; i < rows; i+=1) {
 
    for (j = 0; j < cols; j+=1) {
 
      val = 0;
 
      for (k = 0; k < cols; k+=1) {
 
	val += m1[i][k] * m2[k][j];
 
      }
 
      m3[i][j] = val;
 
    }
 
  }
 
  return m3;
 
}
 

	
 
local n = ARGS.len()!=0?ARGS[0].tointeger():1
 

	
 
local m1 = mkmatrix(SIZE, SIZE);
 
local m2 = mkmatrix(SIZE, SIZE);
 
local mm = mkmatrix(SIZE, SIZE);
 

	
 
for (local i = 0; i < n; i+=1) {
 
  mmult(SIZE, SIZE, m1, m2, mm);
 
}
 

	
 
print(mm[0][0]+" "+mm[2][3]+" "+mm[3][2]+" "+mm[4][4]);
src/3rdparty/squirrel/samples/metamethods.nut
Show inline comments
 
new file 100644
 

	
 
local base_vec={
 
	function _add(n)
 
	{
 
		return {
 
			x=x+n.x,
 
			y=y+n.y,
 
			z=z+n.z,
 
		}
 
	}
 
	function _sub(n)
 
	{
 
		return {
 
			x=x-n.x,
 
			y=y-n.y,
 
			z=z-n.z,
 
		}
 
	}
 
	function _div(n)
 
	{
 
		return {
 
			x=x/n.x,
 
			y=y/n.y,
 
			z=z/n.z,
 
		}
 
	}
 
	function _mul(n)
 
	{
 
		return {
 
			x=x*n.x,
 
			y=y*n.y,
 
			z=z*n.z,
 
		}
 
	}
 
	function _modulo(n)
 
	{
 
		return {
 
			x=x%n,
 
			y=y%n,
 
			z=z%n,
 
		}
 
	}
 
	function _typeof() {return "vector";}
 
	function _get(key)
 
	{
 
		if(key==100)
 
		{
 
			return test_field;
 
		}
 
	},
 
	function _set(key,val)
 
	{
 
		::print("key = "+key+"\n");
 
		::print("val = "+val+"\n")
 
		if(key==100)
 
		{
 
			return test_field=val;
 
		}
 
	}
 
	test_field="nothing"
 
}
 

	
 
function vector(_x,_y,_z):(base_vec)
 
{
 
	return delegate base_vec : {x=_x,y=_y,z=_z }
 
}
 
////////////////////////////////////////////////////////////
 

	
 
local v1=vector(1.5,2.5,3.5);
 
local v2=vector(1.5,2.5,3.5);
 

	
 
local r=v1+v2;
 

	
 

	
 
foreach(i,val in r)
 
{
 
	print(i+" = "+val+"\n");
 
}
 

	
 
r=v1*v2;
 

	
 
foreach(i,val in r)
 
{
 
	print(i+" = "+val+"\n");
 
}
 

	
 
r=v1/v2;
 

	
 
foreach(i,val in r)
 
{
 
	print(i+" = "+val+"\n");
 
}
 

	
 
r=v1-v2;
 

	
 
foreach(i,val in r)
 
{
 
	print(i+" = "+val+"\n");
 
}
 

	
 
r=v1%2;
 

	
 
foreach(i,val in r)
 
{
 
	print(i+" = "+val+"\n");
 
}
 

	
 
print(v1[100]+"\n");
 
v1[100]="set SUCCEEDED";
 
print(v1[100]+"\n");
 

	
 
if(typeof v1=="vector")
 
	print("<SUCCEEDED>\n");
 
else
 
	print("<FAILED>\n");
src/3rdparty/squirrel/samples/methcall.nut
Show inline comments
 
new file 100644
 
/*translation of the methcall test from The Great Computer Language Shootout
 
*/
 

	
 
Toggle <- {
 
	bool=null
 
}
 

	
 
function Toggle::value() {
 
	return bool;
 
}
 

	
 
function Toggle::activate() {
 
	bool = !bool;
 
	return this;
 
}
 

	
 
function Toggle::new(startstate) {
 
	local newo=clone this;
 
	newo.bool = startstate;
 
	return newo;
 
}
 

	
 
NthToggle <- {
 
	count_max=null
 
	count=0
 
}
 

	
 
function NthToggle::new(start_state,max_counter)
 
{
 
	local newo=delegate ::Toggle.new(start_state) : clone this;
 
	newo.count_max <- max_counter
 
	return newo;
 
}
 

	
 
function NthToggle::activate ()
 
{
 
	count+=1
 
    if (count >= count_max) {
 
      bool = !bool;
 
      count = 0;
 
    }
 
    return this;
 
}
 

	
 

	
 
local n = ARGS.len()!=0?ARGS[0].tointeger():1
 

	
 
local val = 1;
 
local toggle = Toggle.new(val);
 
for (local i=0; i<n; i+=1) {
 
  val = toggle.activate().value();
 

	
 
}
 
print(toggle.value() ? "true\n" : "false\n");
 

	
 
val = 1;
 
local ntoggle = NthToggle.new(val, 3);
 
for (local i=0; i<n; i+=1) {
 
  val = ntoggle.activate().value();
 
}
 
print(ntoggle.value() ? "true\n" : "false\n");
src/3rdparty/squirrel/samples/tailstate.nut
Show inline comments
 
new file 100644
 
function state1()
 
{
 
	::suspend("state1");
 
	return state2();
 
}
 

	
 
function state2()
 
{
 
	::suspend("state2");
 
	return state3();
 
}
 

	
 
function state3()
 
{
 
	::suspend("state3");
 
	return state1();
 
}
 

	
 
local statethread = ::newthread(state1)
 

	
 
::print(statethread.call()+"\n");
 

	
 
for(local i = 0; i < 10000; i++)
 
	::print(statethread.wakeup()+"\n");
src/3rdparty/squirrel/sq/Makefile
Show inline comments
 
new file 100644
 
SQUIRREL= ..
 

	
 

	
 
OUT= $(SQUIRREL)/bin/sq
 
INCZ= -I$(SQUIRREL)/include -I. -I$(SQUIRREL)/sqlibs
 
LIBZ= -L$(SQUIRREL)/lib
 
LIB= -lsquirrel -lsqstdlib
 

	
 
OBJS= sq.o
 

	
 
SRCS= sq.c
 

	
 

	
 
sq32:
 
	g++ -O2 -fno-rtti -o $(OUT) $(SRCS) $(INCZ) $(LIBZ) $(LIB)
 

	
 
sqprof:
 
	g++ -O2 -pg -fno-rtti -pie -gstabs -g3 -o $(OUT) $(SRCS) $(INCZ) $(LIBZ) $(LIB)
 

	
 
sq64:
 
	g++ -O2 -fno-rtti -D_SQ64 -o $(OUT) $(SRCS) $(INCZ) $(LIBZ) $(LIB)
 

	
 
clean:
 
	rm -f $(OUT)
src/3rdparty/squirrel/sq/sq.c
Show inline comments
 
new file 100644
 
/*	see copyright notice in squirrel.h */
 

	
 
#include <stdio.h>
 
#include <stdlib.h>
 
#include <string.h>
 
#include <stdarg.h>
 

	
 
#if defined(_MSC_VER) && defined(_DEBUG)
 
#include <crtdbg.h>
 
#include <conio.h>
 
#endif
 
#include <squirrel.h>
 
#include <sqstdblob.h>
 
#include <sqstdsystem.h>
 
#include <sqstdio.h>
 
#include <sqstdmath.h>
 
#include <sqstdstring.h>
 
#include <sqstdaux.h>
 

	
 
#ifdef SQUNICODE
 
#define scfprintf fwprintf
 
#define scfopen	_wfopen
 
#define scvprintf vwprintf
 
#else
 
#define scfprintf fprintf
 
#define scfopen	fopen
 
#define scvprintf vprintf
 
#endif
 

	
 

	
 
void PrintVersionInfos();
 

	
 
#if defined(_MSC_VER) && defined(_DEBUG)
 
int MemAllocHook( int allocType, void *userData, size_t size, int blockType,
 
   long requestNumber, const unsigned char *filename, int lineNumber)
 
{
 
//	if(requestNumber==585)_asm int 3;
 
	return 1;
 
}
 
#endif
 

	
 

	
 
SQInteger quit(HSQUIRRELVM v)
 
{
 
	int *done;
 
	sq_getuserpointer(v,-1,(SQUserPointer*)&done);
 
	*done=1;
 
	return 0;
 
}
 

	
 
void printfunc(HSQUIRRELVM v,const SQChar *s,...)
 
{
 
	va_list vl;
 
	va_start(vl, s);
 
	scvprintf( s, vl);
 
	va_end(vl);
 
}
 

	
 
void PrintVersionInfos()
 
{
 
	scfprintf(stdout,_SC("%s %s (%d bits)\n"),SQUIRREL_VERSION,SQUIRREL_COPYRIGHT,sizeof(SQInteger)*8);
 
}
 

	
 
void PrintUsage()
 
{
 
	scfprintf(stderr,_SC("usage: sq <options> <scriptpath [args]>.\n")
 
		_SC("Available options are:\n")
 
		_SC("   -c              compiles the file to bytecode(default output 'out.cnut')\n")
 
		_SC("   -o              specifies output file for the -c option\n")
 
		_SC("   -c              compiles only\n")
 
		_SC("   -d              generates debug infos\n")
 
		_SC("   -v              displays version infos\n")
 
		_SC("   -h              prints help\n"));
 
}
 

	
 
#define _INTERACTIVE 0
 
#define _DONE 2
 
//<<FIXME>> this func is a mess
 
int getargs(HSQUIRRELVM v,int argc, char* argv[])
 
{
 
	int i;
 
	int compiles_only = 0;
 
	static SQChar temp[500];
 
	const SQChar *ret=NULL;
 
	char * output = NULL;
 
	int lineinfo=0;
 
	if(argc>1)
 
	{
 
		int arg=1,exitloop=0;
 
		while(arg < argc && !exitloop)
 
		{
 

	
 
			if(argv[arg][0]=='-')
 
			{
 
				switch(argv[arg][1])
 
				{
 
				case 'd': //DEBUG(debug infos)
 
					sq_enabledebuginfo(v,1);
 
					break;
 
				case 'c':
 
					compiles_only = 1;
 
					break;
 
				case 'o':
 
					if(arg < argc) {
 
						arg++;
 
						output = argv[arg];
 
					}
 
					break;
 
				case 'v':
 
					PrintVersionInfos();
 
					return _DONE;
 

	
 
				case 'h':
 
					PrintVersionInfos();
 
					PrintUsage();
 
					return _DONE;
 
				default:
 
					PrintVersionInfos();
 
					scprintf(_SC("unknown prameter '-%c'\n"),argv[arg][1]);
 
					PrintUsage();
 
					return _DONE;
 
				}
 
			}else break;
 
			arg++;
 
		}
 

	
 
		// src file
 

	
 
		if(arg<argc) {
 
			const SQChar *filename=NULL;
 
#ifdef SQUNICODE
 
			mbstowcs(temp,argv[arg],strlen(argv[arg]));
 
			filename=temp;
 
#else
 
			filename=argv[arg];
 
#endif
 

	
 
			arg++;
 
			sq_pushroottable(v);
 
			sq_pushstring(v,_SC("ARGS"),-1);
 
			sq_newarray(v,0);
 
			for(i=arg;i<argc;i++)
 
			{
 
				const SQChar *a;
 
#ifdef SQUNICODE
 
				int alen=(int)strlen(argv[i]);
 
				a=sq_getscratchpad(v,(int)(alen*sizeof(SQChar)));
 
				mbstowcs(sq_getscratchpad(v,-1),argv[i],alen);
 
				sq_getscratchpad(v,-1)[alen] = _SC('\0');
 
#else
 
				a=argv[i];
 
#endif
 
				sq_pushstring(v,a,-1);
 

	
 
				sq_arrayappend(v,-2);
 
			}
 
			sq_createslot(v,-3);
 
			sq_pop(v,1);
 
			if(compiles_only) {
 
				if(SQ_SUCCEEDED(sqstd_loadfile(v,filename,SQTrue))){
 
					SQChar *outfile = _SC("out.cnut");
 
					if(output) {
 
#ifdef SQUNICODE
 
						int len = (int)(strlen(output)+1);
 
						mbstowcs(sq_getscratchpad(v,len*sizeof(SQChar)),output,len);
 
						outfile = sq_getscratchpad(v,-1);
 
#else
 
						outfile = output;
 
#endif
 
					}
 
					if(SQ_SUCCEEDED(sqstd_writeclosuretofile(v,outfile)))
 
						return _DONE;
 
				}
 
			}
 
			else {
 
				if(SQ_SUCCEEDED(sqstd_dofile(v,filename,SQFalse,SQTrue))) {
 
					return _DONE;
 
				}
 
			}
 
			//if this point is reached an error occured
 
			{
 
				const SQChar *err;
 
				sq_getlasterror(v);
 
				if(SQ_SUCCEEDED(sq_getstring(v,-1,&err))) {
 
					scprintf(_SC("Error [%s]\n"),err);
 
					return _DONE;
 
				}
 
			}
 

	
 
		}
 
	}
 

	
 
	return _INTERACTIVE;
 
}
 

	
 
void Interactive(HSQUIRRELVM v)
 
{
 

	
 
#define MAXINPUT 1024
 
	SQChar buffer[MAXINPUT];
 
	SQInteger blocks =0;
 
	SQInteger string=0;
 
	SQInteger retval=0;
 
	SQInteger done=0;
 
	PrintVersionInfos();
 

	
 
	sq_pushroottable(v);
 
	sq_pushstring(v,_SC("quit"),-1);
 
	sq_pushuserpointer(v,&done);
 
	sq_newclosure(v,quit,1);
 
	sq_setparamscheck(v,1,NULL);
 
	sq_createslot(v,-3);
 
	sq_pop(v,1);
 

	
 
    while (!done)
 
	{
 
		SQInteger i = 0;
 
		scprintf(_SC("\nsq>"));
 
		for(;;) {
 
			int c;
 
			if(done)return;
 
			c = getchar();
 
			if (c == _SC('\n')) {
 
				if (i>0 && buffer[i-1] == _SC('\\'))
 
				{
 
					buffer[i-1] = _SC('\n');
 
				}
 
				else if(blocks==0)break;
 
				buffer[i++] = _SC('\n');
 
			}
 
			else if (c==_SC('}')) {blocks--; buffer[i++] = (SQChar)c;}
 
			else if(c==_SC('{') && !string){
 
					blocks++;
 
					buffer[i++] = (SQChar)c;
 
			}
 
			else if(c==_SC('"') || c==_SC('\'')){
 
					string=!string;
 
					buffer[i++] = (SQChar)c;
 
			}
 
			else if (i >= MAXINPUT-1) {
 
				scfprintf(stderr, _SC("sq : input line too long\n"));
 
				break;
 
			}
 
			else{
 
				buffer[i++] = (SQChar)c;
 
			}
 
		}
 
		buffer[i] = _SC('\0');
 

	
 
		if(buffer[0]==_SC('=')){
 
			scsprintf(sq_getscratchpad(v,MAXINPUT),_SC("return (%s)"),&buffer[1]);
 
			memcpy(buffer,sq_getscratchpad(v,-1),(scstrlen(sq_getscratchpad(v,-1))+1)*sizeof(SQChar));
 
			retval=1;
 
		}
 
		i=scstrlen(buffer);
 
		if(i>0){
 
			SQInteger oldtop=sq_gettop(v);
 
			if(SQ_SUCCEEDED(sq_compilebuffer(v,buffer,i,_SC("interactive console"),SQTrue))){
 
				sq_pushroottable(v);
 
				if(SQ_SUCCEEDED(sq_call(v,1,retval,SQTrue)) &&	retval){
 
					scprintf(_SC("\n"));
 
					sq_pushroottable(v);
 
					sq_pushstring(v,_SC("print"),-1);
 
					sq_get(v,-2);
 
					sq_pushroottable(v);
 
					sq_push(v,-4);
 
					sq_call(v,2,SQFalse,SQTrue);
 
					retval=0;
 
					scprintf(_SC("\n"));
 
				}
 
			}
 

	
 
			sq_settop(v,oldtop);
 
		}
 
	}
 
}
 

	
 
int main(int argc, char* argv[])
 
{
 
	HSQUIRRELVM v;
 

	
 
	const SQChar *filename=NULL;
 
#if defined(_MSC_VER) && defined(_DEBUG)
 
	_CrtSetAllocHook(MemAllocHook);
 
#endif
 

	
 
	v=sq_open(1024);
 
	sq_setprintfunc(v,printfunc);
 

	
 
	sq_pushroottable(v);
 

	
 
	sqstd_register_bloblib(v);
 
	sqstd_register_iolib(v);
 
	sqstd_register_systemlib(v);
 
	sqstd_register_mathlib(v);
 
	sqstd_register_stringlib(v);
 

	
 
	//aux library
 
	//sets error handlers
 
	sqstd_seterrorhandlers(v);
 

	
 
	//gets arguments
 
	switch(getargs(v,argc,argv))
 
	{
 
	case _INTERACTIVE:
 
		Interactive(v);
 
		break;
 
	case _DONE:
 
	default:
 
		break;
 
	}
 

	
 
	sq_close(v);
 

	
 
#if defined(_MSC_VER) && defined(_DEBUG)
 
	_getch();
 
	_CrtMemDumpAllObjectsSince( NULL );
 
#endif
 
	return 0;
 
}
 

	
src/3rdparty/squirrel/sq/sq.dsp
Show inline comments
 
new file 100644
 
# Microsoft Developer Studio Project File - Name="sq" - Package Owner=<4>
 
# Microsoft Developer Studio Generated Build File, Format Version 6.00
 
# ** DO NOT EDIT **
 

	
 
# TARGTYPE "Win32 (x86) Console Application" 0x0103
 

	
 
CFG=sq - Win32 Debug
 
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
 
!MESSAGE use the Export Makefile command and run
 
!MESSAGE
 
!MESSAGE NMAKE /f "sq.mak".
 
!MESSAGE
 
!MESSAGE You can specify a configuration when running NMAKE
 
!MESSAGE by defining the macro CFG on the command line. For example:
 
!MESSAGE
 
!MESSAGE NMAKE /f "sq.mak" CFG="sq - Win32 Debug"
 
!MESSAGE
 
!MESSAGE Possible choices for configuration are:
 
!MESSAGE
 
!MESSAGE "sq - Win32 Release" (based on "Win32 (x86) Console Application")
 
!MESSAGE "sq - Win32 Debug" (based on "Win32 (x86) Console Application")
 
!MESSAGE
 

	
 
# Begin Project
 
# PROP AllowPerConfigDependencies 0
 
# PROP Scc_LocalPath ".."
 
CPP=cl.exe
 
RSC=rc.exe
 

	
 
!IF  "$(CFG)" == "sq - Win32 Release"
 

	
 
# PROP BASE Use_MFC 0
 
# PROP BASE Use_Debug_Libraries 0
 
# PROP BASE Output_Dir "Release"
 
# PROP BASE Intermediate_Dir "Release"
 
# PROP BASE Target_Dir ""
 
# PROP Use_MFC 0
 
# PROP Use_Debug_Libraries 0
 
# PROP Output_Dir "Release"
 
# PROP Intermediate_Dir "Release"
 
# PROP Ignore_Export_Lib 0
 
# PROP Target_Dir ""
 
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
 
# ADD CPP /nologo /W3 /GX /O2 /I "..\include" /I "..\sqstdlib" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
 
# ADD BASE RSC /l 0x410 /d "NDEBUG"
 
# ADD RSC /l 0x410 /d "NDEBUG"
 
BSC32=bscmake.exe
 
# ADD BASE BSC32 /nologo
 
# ADD BSC32 /nologo
 
LINK32=link.exe
 
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
 
# ADD LINK32 squirrel.lib sqstdlib.lib /nologo /subsystem:console /machine:I386 /out:"../bin/sq.exe" /libpath:"../lib"
 

	
 
!ELSEIF  "$(CFG)" == "sq - Win32 Debug"
 

	
 
# PROP BASE Use_MFC 0
 
# PROP BASE Use_Debug_Libraries 1
 
# PROP BASE Output_Dir "Debug"
 
# PROP BASE Intermediate_Dir "Debug"
 
# PROP BASE Target_Dir ""
 
# PROP Use_MFC 0
 
# PROP Use_Debug_Libraries 1
 
# PROP Output_Dir "Debug"
 
# PROP Intermediate_Dir "Debug"
 
# PROP Ignore_Export_Lib 0
 
# PROP Target_Dir ""
 
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
 
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\include" /I "..\sqstdlib" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
 
# ADD BASE RSC /l 0x410 /d "_DEBUG"
 
# ADD RSC /l 0x410 /d "_DEBUG"
 
BSC32=bscmake.exe
 
# ADD BASE BSC32 /nologo
 
# ADD BSC32 /nologo
 
LINK32=link.exe
 
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
 
# ADD LINK32 squirrel.lib sqstdlib.lib /nologo /subsystem:console /debug /machine:I386 /out:"../bin/sq.exe" /pdbtype:sept /libpath:"../lib"
 

	
 
!ENDIF
 

	
 
# Begin Target
 

	
 
# Name "sq - Win32 Release"
 
# Name "sq - Win32 Debug"
 
# Begin Group "Source Files"
 

	
 
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
 
# Begin Source File
 

	
 
SOURCE=.\sq.c
 
# End Source File
 
# End Group
 
# Begin Group "Header Files"
 

	
 
# PROP Default_Filter "h;hpp;hxx;hm;inl"
 
# End Group
 
# Begin Group "Resource Files"
 

	
 
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
 
# End Group
 
# End Target
 
# End Project
src/3rdparty/squirrel/sqstdlib/Makefile
Show inline comments
 
new file 100644
 
SQUIRREL= ..
 

	
 

	
 
OUT= $(SQUIRREL)/lib/libsqstdlib.a
 
INCZ= -I$(SQUIRREL)/include -I. -Iinclude
 

	
 
SRCS= \
 
	sqstdblob.cpp \
 
	sqstdio.cpp \
 
	sqstdstream.cpp \
 
	sqstdmath.cpp \
 
	sqstdsystem.cpp \
 
	sqstdstring.cpp \
 
	sqstdaux.cpp \
 
	sqstdrex.cpp
 

	
 

	
 
sq32:
 
	gcc -O2  -fno-rtti -Wall -c $(SRCS) $(INCZ)
 
	ar rc $(OUT) *.o
 

	
 
sqprof:
 
	gcc -O2 -pg -fno-rtti -pie -gstabs -g3 -Wall -c $(SRCS) $(INCZ)
 
	ar rc $(OUT) *.o
 

	
 
sq64:
 
	gcc -O2 -D_SQ64 -fno-rtti -Wall -c $(SRCS) $(INCZ)
 
	ar rc $(OUT) *.o
 

	
 
clean:
 
	rm -f $(OUT) $(SRCS:%.cpp=%.o)
src/3rdparty/squirrel/sqstdlib/sqstdaux.cpp
Show inline comments
 
new file 100644
 
/* see copyright notice in squirrel.h */
 
#include <squirrel.h>
 
#include <sqstdaux.h>
 
#include <assert.h>
 

	
 
void sqstd_printcallstack(HSQUIRRELVM v)
 
{
 
	SQPRINTFUNCTION pf = sq_getprintfunc(v);
 
	if(pf) {
 
		SQStackInfos si;
 
		SQInteger i;
 
		SQFloat f;
 
		const SQChar *s;
 
		SQInteger level=1; //1 is to skip this function that is level 0
 
		const SQChar *name=0;
 
		SQInteger seq=0;
 
		pf(v,_SC("\nCALLSTACK\n"));
 
		while(SQ_SUCCEEDED(sq_stackinfos(v,level,&si)))
 
		{
 
			const SQChar *fn=_SC("unknown");
 
			const SQChar *src=_SC("unknown");
 
			if(si.funcname)fn=si.funcname;
 
			if(si.source)src=si.source;
 
			pf(v,_SC("*FUNCTION [%s()] %s line [%d]\n"),fn,src,si.line);
 
			level++;
 
		}
 
		level=0;
 
		pf(v,_SC("\nLOCALS\n"));
 

	
 
		for(level=0;level<10;level++){
 
			seq=0;
 
			while((name = sq_getlocal(v,level,seq)))
 
			{
 
				seq++;
 
				switch(sq_gettype(v,-1))
 
				{
 
				case OT_NULL:
 
					pf(v,_SC("[%s] NULL\n"),name);
 
					break;
 
				case OT_INTEGER:
 
					sq_getinteger(v,-1,&i);
 
					pf(v,_SC("[%s] %d\n"),name,i);
 
					break;
 
				case OT_FLOAT:
 
					sq_getfloat(v,-1,&f);
 
					pf(v,_SC("[%s] %.14g\n"),name,f);
 
					break;
 
				case OT_USERPOINTER:
 
					pf(v,_SC("[%s] USERPOINTER\n"),name);
 
					break;
 
				case OT_STRING:
 
					sq_getstring(v,-1,&s);
 
					pf(v,_SC("[%s] \"%s\"\n"),name,s);
 
					break;
 
				case OT_TABLE:
 
					pf(v,_SC("[%s] TABLE\n"),name);
 
					break;
 
				case OT_ARRAY:
 
					pf(v,_SC("[%s] ARRAY\n"),name);
 
					break;
 
				case OT_CLOSURE:
 
					pf(v,_SC("[%s] CLOSURE\n"),name);
 
					break;
 
				case OT_NATIVECLOSURE:
 
					pf(v,_SC("[%s] NATIVECLOSURE\n"),name);
 
					break;
 
				case OT_GENERATOR:
 
					pf(v,_SC("[%s] GENERATOR\n"),name);
 
					break;
 
				case OT_USERDATA:
 
					pf(v,_SC("[%s] USERDATA\n"),name);
 
					break;
 
				case OT_THREAD:
 
					pf(v,_SC("[%s] THREAD\n"),name);
 
					break;
 
				case OT_CLASS:
 
					pf(v,_SC("[%s] CLASS\n"),name);
 
					break;
 
				case OT_INSTANCE:
 
					pf(v,_SC("[%s] INSTANCE\n"),name);
 
					break;
 
				case OT_WEAKREF:
 
					pf(v,_SC("[%s] WEAKREF\n"),name);
 
					break;
 
				case OT_BOOL:{
 
					sq_getinteger(v,-1,&i);
 
					pf(v,_SC("[%s] %s\n"),name,i?_SC("true"):_SC("false"));
 
							 }
 
					break;
 
				default: assert(0); break;
 
				}
 
				sq_pop(v,1);
 
			}
 
		}
 
	}
 
}
 

	
 
static SQInteger _sqstd_aux_printerror(HSQUIRRELVM v)
 
{
 
	SQPRINTFUNCTION pf = sq_getprintfunc(v);
 
	if(pf) {
 
		const SQChar *sErr = 0;
 
		if(sq_gettop(v)>=1) {
 
			if(SQ_SUCCEEDED(sq_getstring(v,2,&sErr)))	{
 
				pf(v,_SC("\nAN ERROR HAS OCCURED [%s]\n"),sErr);
 
			}
 
			else{
 
				pf(v,_SC("\nAN ERROR HAS OCCURED [unknown]\n"));
 
			}
 
			sqstd_printcallstack(v);
 
		}
 
	}
 
	return 0;
 
}
 

	
 
void _sqstd_compiler_error(HSQUIRRELVM v,const SQChar *sErr,const SQChar *sSource,SQInteger line,SQInteger column)
 
{
 
	SQPRINTFUNCTION pf = sq_getprintfunc(v);
 
	if(pf) {
 
		pf(v,_SC("%s line = (%d) column = (%d) : error %s\n"),sSource,line,column,sErr);
 
	}
 
}
 

	
 
void sqstd_seterrorhandlers(HSQUIRRELVM v)
 
{
 
	sq_setcompilererrorhandler(v,_sqstd_compiler_error);
 
	sq_newclosure(v,_sqstd_aux_printerror,0);
 
	sq_seterrorhandler(v);
 
}

Changeset was too big and was cut off... Show full diff anyway

0 comments (0 inline, 0 general)