blob: 248b9773e2de3210bb48a001aa6ebf936be671e1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file squirrel_std.hpp defines the Squirrel Standard Function class */
#ifndef SQUIRREL_STD_HPP
#define SQUIRREL_STD_HPP
#include "squirrel.hpp"
#if defined(__APPLE__)
/* Which idiotic system makes 'require' a macro? :s Oh well.... */
#undef require
#endif /* __APPLE__ */
/**
* By default we want to give a set of standard commands to a SQ script.
* Most of them are easy wrappers around internal functions. Of course we
* could just as easy include things like the stdmath of SQ, but of those
* functions we are sure they work on all our supported targets.
*/
class SquirrelStd {
public:
/**
* Get the lowest of two integers.
*/
static SQInteger min(HSQUIRRELVM vm);
/**
* Get the highest of two integers.
*/
static SQInteger max(HSQUIRRELVM vm);
/**
* Load another file on runtime.
* @note This is always loaded on the root-level, no matter where you call this.
* @note The filename is always relative from the script it is called from. Absolute calls are NOT allowed!
*/
static SQInteger require(HSQUIRRELVM vm);
/**
* Enable/disable stack trace showing for handled exceptions.
*/
static SQInteger notifyallexceptions(HSQUIRRELVM vm);
};
/**
* Register all standard functions we want to give to a script.
*/
void squirrel_register_std(Squirrel *engine);
/**
* Register all standard functions that are available on first startup.
* @note this set is very limited, and is only ment to load other scripts and things like that.
*/
void squirrel_register_global_std(Squirrel *engine);
#endif /* SQUIRREL_STD_HPP */
|