12 #include "../stdafx.h" 14 #include <sqstdmath.h> 17 #include "../core/alloc_func.hpp" 18 #include "../core/math_func.hpp" 19 #include "../string_func.h" 21 #include "../safeguards.h" 28 sq_getinteger(vm, 2, &tmp1);
29 sq_getinteger(vm, 3, &tmp2);
30 sq_pushinteger(vm, ::
min(tmp1, tmp2));
38 sq_getinteger(vm, 2, &tmp1);
39 sq_getinteger(vm, 3, &tmp2);
40 sq_pushinteger(vm, ::
max(tmp1, tmp2));
46 SQInteger top = sq_gettop(vm);
47 const SQChar *filename;
49 sq_getstring(vm, 2, &filename);
53 sq_stackinfos(vm, 1, &si);
54 if (si.source == NULL) {
55 DEBUG(misc, 0,
"[squirrel] Couldn't detect the script-name of the 'require'-caller; this should never happen!");
62 SQChar *s = strrchr(path, PATHSEPCHAR);
69 #if (PATHSEPCHAR != '/') 70 for (
char *n = path; *n !=
'\0'; n++)
if (*n ==
'/') *n = PATHSEPCHAR;
79 return ret ? 0 : SQ_ERROR;
86 if (sq_gettop(vm) >= 1) {
87 if (SQ_SUCCEEDED(sq_getbool(vm, -1, &b))) {
88 sq_notifyallexceptions(vm, b);
111 sqstd_register_mathlib(engine->
GetVM());
void AddMethod(const char *method_name, SQFUNCTION proc, uint nparam=0, const char *params=NULL, void *userdata=NULL, int size=0)
Adds a function to the stack.
static SQInteger max(HSQUIRRELVM vm)
Get the highest of two integers.
static char * strecat(char *dst, const char *src, const char *last)
Appends characters from one string to another.
defines the Squirrel Standard Function class
static SQInteger notifyallexceptions(HSQUIRRELVM vm)
Enable/disable stack trace showing for handled exceptions.
#define lastof(x)
Get the last element of an fixed size array.
static SQInteger min(HSQUIRRELVM vm)
Get the lowest of two integers.
static SQInteger require(HSQUIRRELVM vm)
Load another file on runtime.
HSQUIRRELVM GetVM()
Get the squirrel VM.
#define DEBUG(name, level,...)
Output a line of debugging information.
void squirrel_register_global_std(Squirrel *engine)
Register all standard functions that are available on first startup.
char * strecpy(char *dst, const char *src, const char *last)
Copies characters from one buffer to another.
void squirrel_register_std(Squirrel *engine)
Register all standard functions we want to give to a script.
bool LoadScript(const char *script)
Load a script.