blob: 14286738db8d41827f9bf1e0b5af130a9b97470d [file] [log] [blame]
Thierry FOURNIER6f1fd482015-01-23 14:06:13 +01001#ifndef _PROTO_HLUA_H
2#define _PROTO_HLUA_H
3
Thierry FOURNIERa718b292015-03-04 16:48:34 +01004#ifdef USE_LUA
5
Thierry FOURNIER6f1fd482015-01-23 14:06:13 +01006#include <lua.h>
7
8#include <types/hlua.h>
9
Thierry FOURNIERa097fdf2015-03-03 15:17:35 +010010/* The following macros are used to set flags. */
11#define HLUA_SET_RUN(__hlua) do {(__hlua)->flags |= HLUA_RUN;} while(0)
12#define HLUA_CLR_RUN(__hlua) do {(__hlua)->flags &= ~HLUA_RUN;} while(0)
13#define HLUA_IS_RUNNING(__hlua) ((__hlua)->flags & HLUA_RUN)
14
Thierry FOURNIERa718b292015-03-04 16:48:34 +010015#define HLUA_INIT(__hlua) do { (__hlua)->T = 0; } while(0)
16
Thierry FOURNIER6f1fd482015-01-23 14:06:13 +010017/* Lua HAProxy integration functions. */
Thierry FOURNIER380d0932015-01-23 14:27:52 +010018void hlua_ctx_destroy(struct hlua *lua);
Thierry FOURNIER6f1fd482015-01-23 14:06:13 +010019void hlua_init();
Thierry FOURNIERa4a0f3d2015-01-23 12:08:30 +010020int hlua_post_init();
Thierry FOURNIER6f1fd482015-01-23 14:06:13 +010021
Thierry FOURNIERa718b292015-03-04 16:48:34 +010022#else /* USE_LUA */
23
Thierry FOURNIERa097fdf2015-03-03 15:17:35 +010024#define HLUA_IS_RUNNING(__hlua) 0
25
Thierry FOURNIERa718b292015-03-04 16:48:34 +010026#define HLUA_INIT(__hlua)
27
28/* Empty function for compilation without Lua. */
29static inline void hlua_init() { }
30static inline int hlua_post_init() { return 1; }
31static inline void hlua_ctx_destroy() { }
32
33#endif /* USE_LUA */
34
Thierry FOURNIER6f1fd482015-01-23 14:06:13 +010035#endif /* _PROTO_HLUA_H */