diff options
author | bearbin <bearbin@gmail.com> | 2013-07-29 14:55:26 +0200 |
---|---|---|
committer | bearbin <bearbin@gmail.com> | 2013-07-29 14:55:26 +0200 |
commit | fb1044c4e55c726753d094b66756a1cb3bc60ee8 (patch) | |
tree | c61e56725da7dff0154d566722651e2c39c9d6c6 /source/squirrelbindings/SquirrelFunctions.cpp | |
parent | WebAdmin: Removed the duplicate memory usage querying (diff) | |
parent | Changed everyting to Unix line endings. (diff) | |
download | cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar.gz cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar.bz2 cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar.lz cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar.xz cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar.zst cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.zip |
Diffstat (limited to 'source/squirrelbindings/SquirrelFunctions.cpp')
-rw-r--r-- | source/squirrelbindings/SquirrelFunctions.cpp | 188 |
1 files changed, 94 insertions, 94 deletions
diff --git a/source/squirrelbindings/SquirrelFunctions.cpp b/source/squirrelbindings/SquirrelFunctions.cpp index 0e35f7361..9407670d4 100644 --- a/source/squirrelbindings/SquirrelFunctions.cpp +++ b/source/squirrelbindings/SquirrelFunctions.cpp @@ -1,94 +1,94 @@ -
-#include "Globals.h"
-
-
-
-
-
-#ifdef USE_SQUIRREL
-
-
-
-
-
-#include "SquirrelFunctions.h"
-#include "SquirrelBindings.h"
-
-
-
-
-
-static HSQUIRRELVM squirrelvm = NULL;
-
-
-
-
-
-SQInteger runtimeErrorHandler(HSQUIRRELVM a_VM)
-{
- const SQChar *sErr = 0;
- if(sq_gettop(a_VM) >= 1)
- {
- if(SQ_SUCCEEDED(sq_getstring(a_VM, 2, &sErr)))
- {
- LOGERROR("Squirrel Error: %s", sErr);
- }
- else
- {
- LOGERROR("Squirrel Error: Unknown Error");
- }
- }
- return 0;
-}
-
-void compilerErrorHandler(HSQUIRRELVM v,
- const SQChar* a_Desc,
- const SQChar* a_Source,
- SQInteger a_Line,
- SQInteger a_Column)
-{
-
- LOGERROR("Squirrel Error: %s (%d:%d) %s", a_Source, a_Line, a_Column, a_Desc);
-}
-
-HSQUIRRELVM OpenSquirrelVM()
-{
- if(!squirrelvm)
- {
- squirrelvm = sq_open(1024);
- Sqrat::DefaultVM::Set(squirrelvm);
-
- sq_newclosure(squirrelvm, runtimeErrorHandler, 0);
- sq_seterrorhandler(squirrelvm);
-
- sq_setcompilererrorhandler(squirrelvm, compilerErrorHandler);
-
- BindSquirrel(squirrelvm);
- }
- return squirrelvm;
-}
-
-void CloseSquirrelVM()
-{
- if(squirrelvm)
- {
- sq_close(squirrelvm);
- squirrelvm = NULL;
- }
-}
-
-
-void sqPrint(SQChar * text)
-{
- LOGINFO("%s", text);
-}
-
-
-
-
-
-#endif // USE_SQUIRREL
-
-
-
-
+ +#include "Globals.h" + + + + + +#ifdef USE_SQUIRREL + + + + + +#include "SquirrelFunctions.h" +#include "SquirrelBindings.h" + + + + + +static HSQUIRRELVM squirrelvm = NULL; + + + + + +SQInteger runtimeErrorHandler(HSQUIRRELVM a_VM) +{ + const SQChar *sErr = 0; + if(sq_gettop(a_VM) >= 1) + { + if(SQ_SUCCEEDED(sq_getstring(a_VM, 2, &sErr))) + { + LOGERROR("Squirrel Error: %s", sErr); + } + else + { + LOGERROR("Squirrel Error: Unknown Error"); + } + } + return 0; +} + +void compilerErrorHandler(HSQUIRRELVM v, + const SQChar* a_Desc, + const SQChar* a_Source, + SQInteger a_Line, + SQInteger a_Column) +{ + + LOGERROR("Squirrel Error: %s (%d:%d) %s", a_Source, a_Line, a_Column, a_Desc); +} + +HSQUIRRELVM OpenSquirrelVM() +{ + if(!squirrelvm) + { + squirrelvm = sq_open(1024); + Sqrat::DefaultVM::Set(squirrelvm); + + sq_newclosure(squirrelvm, runtimeErrorHandler, 0); + sq_seterrorhandler(squirrelvm); + + sq_setcompilererrorhandler(squirrelvm, compilerErrorHandler); + + BindSquirrel(squirrelvm); + } + return squirrelvm; +} + +void CloseSquirrelVM() +{ + if(squirrelvm) + { + sq_close(squirrelvm); + squirrelvm = NULL; + } +} + + +void sqPrint(SQChar * text) +{ + LOGINFO("%s", text); +} + + + + + +#endif // USE_SQUIRREL + + + + |