| 1 |
/* |
| 2 |
Copyright (c) 2010 Peter "Corsix" Cawley |
| 3 |
|
| 4 |
Permission is hereby granted, free of charge, to any person obtaining a copy of |
| 5 |
this software and associated documentation files (the "Software"), to deal in |
| 6 |
the Software without restriction, including without limitation the rights to |
| 7 |
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
| 8 |
of the Software, and to permit persons to whom the Software is furnished to do |
| 9 |
so, subject to the following conditions: |
| 10 |
|
| 11 |
The above copyright notice and this permission notice shall be included in all |
| 12 |
copies or substantial portions of the Software. |
| 13 |
|
| 14 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 17 |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 18 |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 19 |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 20 |
SOFTWARE. |
| 21 |
*/ |
| 22 |
|
| 23 |
#ifndef CORSIX_TH_MAIN_H_ |
| 24 |
#define CORSIX_TH_MAIN_H_ |
| 25 |
#include "lua.hpp" |
| 26 |
|
| 27 |
//! Lua mode entry point |
| 28 |
/*! |
| 29 |
Performs initialization tasks for setting up the lua environment, and |
| 30 |
then calls the main lua entry point: CorsixTH.lua or an alternative |
| 31 |
script passed in via the command line. |
| 32 |
|
| 33 |
\see lua_init_no_eval |
| 34 |
*/ |
| 35 |
int lua_init(lua_State* L); |
| 36 |
|
| 37 |
//! Alternative lua mode entry point |
| 38 |
/*! |
| 39 |
Performs initialization tasks for setting up the lua environment, |
| 40 |
including preloading libraries and registering C functions; verifying |
| 41 |
the lua runtime version matches; and preparing the stack to call |
| 42 |
CorsixTH.lua or an alternate Lua entry script passed via the command |
| 43 |
line. |
| 44 |
*/ |
| 45 |
int lua_init_no_eval(lua_State* L); |
| 46 |
|
| 47 |
//! Process a caught error before returning it to the caller |
| 48 |
/*! |
| 49 |
Processing of the error message is done here so that a stack trace can be |
| 50 |
added before the stack is unwound, and so that if an error occurs while |
| 51 |
processing the error, the caller receives LUA_ERRERR rather than panicking |
| 52 |
while processing it itself. |
| 53 |
*/ |
| 54 |
int lua_stacktrace(lua_State* L); |
| 55 |
|
| 56 |
//! Process an uncaught Lua error before aborting |
| 57 |
/*! |
| 58 |
Lua errors shouldn't occur outside of protected mode, and there isn't much |
| 59 |
which can be done when they do, but at least the user should be informed, |
| 60 |
and the error message printed. |
| 61 |
*/ |
| 62 |
int lua_panic(lua_State* L); |
| 63 |
|
| 64 |
#endif // CORSIX_TH_MAIN_H_ |