1 #ifndef _PROTO_HLUA_H 2 #define _PROTO_HLUA_H 3 4 #ifdef USE_LUA 5 6 #include <lua.h> 7 8 #include <types/hlua.h> 9 10 /* 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 #define HLUA_SET_CTRLYIELD(__hlua) do {(__hlua)->flags |= HLUA_CTRLYIELD;} while(0) 15 #define HLUA_CLR_CTRLYIELD(__hlua) do {(__hlua)->flags &= ~HLUA_CTRLYIELD;} while(0) 16 #define HLUA_IS_CTRLYIELDING(__hlua) ((__hlua)->flags & HLUA_CTRLYIELD) 17 #define HLUA_SET_WAKERESWR(__hlua) do {(__hlua)->flags |= HLUA_WAKERESWR;} while(0) 18 #define HLUA_CLR_WAKERESWR(__hlua) do {(__hlua)->flags &= ~HLUA_WAKERESWR;} while(0) 19 #define HLUA_IS_WAKERESWR(__hlua) ((__hlua)->flags & HLUA_WAKERESWR) 20 #define HLUA_SET_WAKEREQWR(__hlua) do {(__hlua)->flags |= HLUA_WAKEREQWR;} while(0) 21 #define HLUA_CLR_WAKEREQWR(__hlua) do {(__hlua)->flags &= ~HLUA_WAKEREQWR;} while(0) 22 #define HLUA_IS_WAKEREQWR(__hlua) ((__hlua)->flags & HLUA_WAKEREQWR) 23 24 #define HLUA_INIT(__hlua) do { (__hlua)->T = 0; } while(0) 25 26 /* Lua HAProxy integration functions. */ 27 void hlua_ctx_destroy(struct hlua *lua); 28 void hlua_init(); 29 int hlua_post_init(); 30 31 #else /* USE_LUA */ 32 33 #define HLUA_IS_RUNNING(__hlua) 0 34 35 #define HLUA_INIT(__hlua) 36 37 /* Empty function for compilation without Lua. */ hlua_init()38static inline void hlua_init() { } hlua_post_init()39static inline int hlua_post_init() { return 1; } hlua_ctx_destroy(struct hlua * lua)40static inline void hlua_ctx_destroy(struct hlua *lua) { } 41 42 #endif /* USE_LUA */ 43 44 #endif /* _PROTO_HLUA_H */ 45