2015-01-23 13:06:13 +00:00
|
|
|
#ifndef _PROTO_HLUA_H
|
|
|
|
#define _PROTO_HLUA_H
|
|
|
|
|
2015-03-04 15:48:34 +00:00
|
|
|
#ifdef USE_LUA
|
|
|
|
|
2015-01-23 13:06:13 +00:00
|
|
|
#include <lua.h>
|
|
|
|
|
|
|
|
#include <types/hlua.h>
|
|
|
|
|
2015-03-03 14:17:35 +00:00
|
|
|
/* The following macros are used to set flags. */
|
|
|
|
#define HLUA_SET_RUN(__hlua) do {(__hlua)->flags |= HLUA_RUN;} while(0)
|
|
|
|
#define HLUA_CLR_RUN(__hlua) do {(__hlua)->flags &= ~HLUA_RUN;} while(0)
|
|
|
|
#define HLUA_IS_RUNNING(__hlua) ((__hlua)->flags & HLUA_RUN)
|
2015-03-03 16:29:06 +00:00
|
|
|
#define HLUA_SET_CTRLYIELD(__hlua) do {(__hlua)->flags |= HLUA_CTRLYIELD;} while(0)
|
|
|
|
#define HLUA_CLR_CTRLYIELD(__hlua) do {(__hlua)->flags &= ~HLUA_CTRLYIELD;} while(0)
|
|
|
|
#define HLUA_IS_CTRLYIELDING(__hlua) ((__hlua)->flags & HLUA_CTRLYIELD)
|
2015-03-05 16:45:34 +00:00
|
|
|
#define HLUA_SET_WAKERESWR(__hlua) do {(__hlua)->flags |= HLUA_WAKERESWR;} while(0)
|
|
|
|
#define HLUA_CLR_WAKERESWR(__hlua) do {(__hlua)->flags &= ~HLUA_WAKERESWR;} while(0)
|
|
|
|
#define HLUA_IS_WAKERESWR(__hlua) ((__hlua)->flags & HLUA_WAKERESWR)
|
2015-03-05 23:35:53 +00:00
|
|
|
#define HLUA_SET_WAKEREQWR(__hlua) do {(__hlua)->flags |= HLUA_WAKEREQWR;} while(0)
|
|
|
|
#define HLUA_CLR_WAKEREQWR(__hlua) do {(__hlua)->flags &= ~HLUA_WAKEREQWR;} while(0)
|
|
|
|
#define HLUA_IS_WAKEREQWR(__hlua) ((__hlua)->flags & HLUA_WAKEREQWR)
|
2015-03-03 14:17:35 +00:00
|
|
|
|
2015-03-04 15:48:34 +00:00
|
|
|
#define HLUA_INIT(__hlua) do { (__hlua)->T = 0; } while(0)
|
|
|
|
|
2015-01-23 13:06:13 +00:00
|
|
|
/* Lua HAProxy integration functions. */
|
2015-01-23 13:27:52 +00:00
|
|
|
void hlua_ctx_destroy(struct hlua *lua);
|
2015-01-23 13:06:13 +00:00
|
|
|
void hlua_init();
|
2015-01-23 11:08:30 +00:00
|
|
|
int hlua_post_init();
|
2015-01-23 13:06:13 +00:00
|
|
|
|
2015-03-04 15:48:34 +00:00
|
|
|
#else /* USE_LUA */
|
|
|
|
|
2015-03-03 14:17:35 +00:00
|
|
|
#define HLUA_IS_RUNNING(__hlua) 0
|
|
|
|
|
2015-03-04 15:48:34 +00:00
|
|
|
#define HLUA_INIT(__hlua)
|
|
|
|
|
|
|
|
/* Empty function for compilation without Lua. */
|
|
|
|
static inline void hlua_init() { }
|
|
|
|
static inline int hlua_post_init() { return 1; }
|
2015-06-17 18:18:54 +00:00
|
|
|
static inline void hlua_ctx_destroy(struct hlua *lua) { }
|
2015-03-04 15:48:34 +00:00
|
|
|
|
|
|
|
#endif /* USE_LUA */
|
|
|
|
|
2015-01-23 13:06:13 +00:00
|
|
|
#endif /* _PROTO_HLUA_H */
|