2014-12-22 12:35:05 +01:00
|
|
|
/* Read-only tables helper */
|
|
|
|
|
|
|
|
#ifndef lrodefs_h
|
|
|
|
#define lrodefs_h
|
|
|
|
|
|
|
|
#include "lrotable.h"
|
|
|
|
|
|
|
|
#undef LUA_REG_TYPE
|
|
|
|
#undef LSTRKEY
|
|
|
|
#undef LNILKEY
|
|
|
|
#undef LNUMKEY
|
|
|
|
#undef LFUNCVAL
|
|
|
|
#undef LNUMVAL
|
|
|
|
#undef LROVAL
|
|
|
|
#undef LNILVAL
|
|
|
|
#undef LREGISTER
|
|
|
|
|
2019-02-17 19:26:29 +01:00
|
|
|
#if LUA_OPTIMIZE_MEMORY >=1
|
2015-12-16 06:04:58 +01:00
|
|
|
#define LUA_REG_TYPE luaR_entry
|
2014-12-22 12:35:05 +01:00
|
|
|
#define LSTRKEY LRO_STRKEY
|
|
|
|
#define LNUMKEY LRO_NUMKEY
|
|
|
|
#define LNILKEY LRO_NILKEY
|
|
|
|
#define LFUNCVAL LRO_FUNCVAL
|
2015-03-01 23:11:24 +01:00
|
|
|
#define LUDATA LRO_LUDATA
|
2014-12-22 12:35:05 +01:00
|
|
|
#define LNUMVAL LRO_NUMVAL
|
|
|
|
#define LROVAL LRO_ROVAL
|
|
|
|
#define LNILVAL LRO_NILVAL
|
2019-05-08 13:08:20 +02:00
|
|
|
#define LREGISTER(L, name, table) return 0
|
2014-12-22 12:35:05 +01:00
|
|
|
#else
|
|
|
|
#define LUA_REG_TYPE luaL_reg
|
|
|
|
#define LSTRKEY(x) x
|
|
|
|
#define LNILKEY NULL
|
|
|
|
#define LFUNCVAL(x) x
|
|
|
|
#define LNILVAL NULL
|
|
|
|
#define LREGISTER(L, name, table)\
|
|
|
|
luaL_register(L, name, table);\
|
|
|
|
return 1
|
|
|
|
#endif
|
|
|
|
|
2019-05-08 13:08:20 +02:00
|
|
|
#define LROT_TABLE(t) static const LUA_REG_TYPE t ## _map[];
|
|
|
|
#define LROT_TABLEREF(t) ((void *) t ## _map)
|
|
|
|
#define LROT_BEGIN(t) static const LUA_REG_TYPE t ## _map [] = {
|
|
|
|
#define LROT_PUBLIC_BEGIN(t) const LUA_REG_TYPE t ## _map[] = {
|
|
|
|
#define LROT_EXTERN(t) extern const LUA_REG_TYPE t ## _map[]
|
|
|
|
#define LROT_TABENTRY(n,t) {LRO_STRKEY(#n), LRO_ROVAL(t ## _map)},
|
|
|
|
#define LROT_FUNCENTRY(n,f) {LRO_STRKEY(#n), LRO_FUNCVAL(f)},
|
|
|
|
#define LROT_NUMENTRY(n,x) {LRO_STRKEY(#n), LRO_NUMVAL(x)},
|
|
|
|
#define LROT_LUDENTRY(n,x) {LRO_STRKEY(#n), LRO_LUDATA((void *) x)},
|
|
|
|
#define LROT_END(t,mt, f) {LRO_NILKEY, LRO_NILVAL} };
|
|
|
|
#define LREGISTER(L, name, table) return 0
|
2018-10-13 16:14:33 +02:00
|
|
|
|
2014-12-22 12:35:05 +01:00
|
|
|
#endif /* lrodefs_h */
|
|
|
|
|