63e185d3a74ce5b5abecb51b41a463e8135e26d8
[supertux.git] / src / scripting / wrapper_util.hpp
1 #ifndef __WRAPPERUTIL_HPP__
2 #define __WRAPPERUTIL_HPP__
3
4 #include <squirrel.h>
5 #include <exception>
6 #include <string>
7
8 struct WrappedFunction {
9     const char* name;
10     SQFUNCTION f;
11 };
12 struct WrappedClass {
13     const char* name;
14     WrappedFunction* functions;
15 };
16
17 class SquirrelError : public std::exception
18 {
19 public:
20   SquirrelError(HSQUIRRELVM v, const std::string& message) throw();
21   virtual ~SquirrelError() throw();
22
23   const char* what() const throw();
24 private:
25   std::string message;
26 };
27
28 void register_functions(HSQUIRRELVM v, WrappedFunction* functions);
29 void register_classes(HSQUIRRELVM v, WrappedClass* classes);
30
31 void print_squirrel_stack(HSQUIRRELVM v);
32
33 #endif