(svn r27953) -Cleanup: Adjust other languages for r27952
[openttd.git] / src / script / squirrel_std.hpp
blobb1c7b30132226f7a850105ef4c8ab8b70132f446
1 /* $Id$ */
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
8 */
10 /** @file squirrel_std.hpp defines the Squirrel Standard Function class */
12 #ifndef SQUIRREL_STD_HPP
13 #define SQUIRREL_STD_HPP
15 #include "squirrel.hpp"
17 #if defined(__APPLE__)
18 /* Which idiotic system makes 'require' a macro? :s Oh well.... */
19 #undef require
20 #endif /* __APPLE__ */
22 /**
23 * By default we want to give a set of standard commands to a SQ script.
24 * Most of them are easy wrappers around internal functions. Of course we
25 * could just as easy include things like the stdmath of SQ, but of those
26 * functions we are sure they work on all our supported targets.
28 class SquirrelStd {
29 public:
31 /**
32 * Get the lowest of two integers.
34 static SQInteger min(HSQUIRRELVM vm);
36 /**
37 * Get the highest of two integers.
39 static SQInteger max(HSQUIRRELVM vm);
41 /**
42 * Load another file on runtime.
43 * @note This is always loaded on the root-level, no matter where you call this.
44 * @note The filename is always relative from the script it is called from. Absolute calls are NOT allowed!
46 static SQInteger require(HSQUIRRELVM vm);
48 /**
49 * Enable/disable stack trace showing for handled exceptions.
51 static SQInteger notifyallexceptions(HSQUIRRELVM vm);
54 /**
55 * Register all standard functions we want to give to a script.
57 void squirrel_register_std(Squirrel *engine);
59 /**
60 * Register all standard functions that are available on first startup.
61 * @note this set is very limited, and is only meant to load other scripts and things like that.
63 void squirrel_register_global_std(Squirrel *engine);
65 #endif /* SQUIRREL_STD_HPP */