create a_regress_simple_evar
[liba.git] / lua / src / a.h
blob63e3b39e2e239ad5634412c26852a14f5fd0b407
1 #ifndef LUA_LIBA_A_H
2 #define LUA_LIBA_A_H
4 #if defined(_MSC_VER)
5 #if !defined _CRT_SECURE_NO_WARNINGS
6 #define _CRT_SECURE_NO_WARNINGS
7 #endif /* _CRT_SECURE_NO_WARNINGS */
8 #pragma warning(disable : 4820)
9 #endif /* _MSC_VER */
10 #include "a/a.h"
11 #if __has_warning("-Wcomma")
12 #pragma clang diagnostic ignored "-Wcomma"
13 #endif /* -Wcomma */
14 #if __has_warning("-Wdocumentation")
15 #pragma clang diagnostic ignored "-Wdocumentation"
16 #endif /* -Wdocumentation */
17 #if __has_warning("-Wdocumentation-unknown-command")
18 #pragma clang diagnostic ignored "-Wdocumentation-unknown-command"
19 #endif /* -Wdocumentation-unknown-command */
20 #if defined(__GNUC__) || defined(__clang__)
21 #pragma GCC diagnostic ignored "-Wpadded"
22 #endif /* -Wpadded */
23 #include <lua.h>
25 #if !defined LUA_INT
26 #define LUA_INT lua_Integer
27 #endif /* LUA_INT */
28 #if !defined LUA_NUM
29 #define LUA_NUM a_float
30 #endif /* LUA_NUM */
32 typedef struct
34 char const *name;
35 lua_CFunction func;
36 } lua_fun;
38 typedef struct
40 char const *name;
41 char const *data;
42 } lua_str;
44 typedef struct
46 char const *name;
47 LUA_INT data;
48 } lua_int;
50 typedef struct
52 char const *name;
53 LUA_NUM data;
54 } lua_num;
56 #if defined(__cplusplus)
57 extern "C" {
58 #endif /* __cplusplus */
60 #if defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM > 503)
61 #define lua_newclass(L, T) (T *)lua_newuserdatauv(L, sizeof(T), 0)
62 #else /* !LUA_VERSION_NUM */
63 #define lua_newclass(L, T) (T *)lua_newuserdata(L, sizeof(T))
64 #endif /* LUA_VERSION_NUM */
66 #if defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM > 501)
67 LUALIB_API void luaL_checkversion_(lua_State *L, lua_Number ver, size_t sz);
68 #define luaL_checkversion(L) luaL_checkversion_(L, LUA_VERSION_NUM, sizeof(lua_Number) + sizeof(lua_Integer) * 16)
69 #else /* !LUA_VERSION_NUM */
70 #define luaL_checkversion(L) (void)0
71 #endif /* LUA_VERSION_NUM */
73 #if !defined LUA_VERSION_NUM || (LUA_VERSION_NUM <= 501)
74 LUALIB_API void luaL_register(lua_State *L, char const *libname, lua_fun const *l);
75 #define lua_rawsetp(L, idx, p) (lua_pushlightuserdata(L, p), lua_insert(L, -2), lua_rawset(L, idx))
76 #define lua_rawgetp(L, idx, p) (lua_pushlightuserdata(L, p), lua_rawget(L, idx))
77 #define lua_rawlen lua_objlen
78 #endif /* LUA_VERSION_NUM */
80 LUALIB_API char const *luaL_checklstring(lua_State *L, int numArg, size_t *l);
81 LUALIB_API char const *luaL_optlstring(lua_State *L, int numArg, char const *def, size_t *l);
83 LUALIB_API lua_Integer luaL_checkinteger(lua_State *L, int numArg);
84 LUALIB_API lua_Integer luaL_optinteger(lua_State *L, int nArg, lua_Integer def);
86 LUALIB_API lua_Number luaL_checknumber(lua_State *L, int numArg);
87 LUALIB_API lua_Number luaL_optnumber(lua_State *L, int nArg, lua_Number def);
89 LUALIB_API void luaL_checkstack(lua_State *L, int sz, char const *msg);
90 LUALIB_API void luaL_checktype(lua_State *L, int narg, int t);
91 LUALIB_API void luaL_checkany(lua_State *L, int narg);
93 LUALIB_API int luaL_error(lua_State *L, char const *fmt, ...);
94 LUALIB_API void luaL_where(lua_State *L, int lvl);
96 void lua_u8_new(lua_State *L, a_u8 value);
97 a_u8 lua_u8_get(lua_State *L, int idx);
98 void lua_u16_new(lua_State *L, a_u16 value);
99 a_u16 lua_u16_get(lua_State *L, int idx);
100 void lua_u32_new(lua_State *L, a_u32 value);
101 a_u32 lua_u32_get(lua_State *L, int idx);
102 void lua_u64_new(lua_State *L, a_u64 value);
103 a_u64 lua_u64_get(lua_State *L, int idx);
105 void *lua_alloc(lua_State *L, void const *ptr, size_t siz);
107 void lua_registry_get(lua_State *L, int (*fn)(lua_State *));
108 void lua_registry_set(lua_State *L, int (*fn)(lua_State *));
110 void lua_fun_reg(lua_State *L, int idx, lua_fun const *tab, size_t len);
111 void lua_fun_set(lua_State *L, int idx, char const *name, lua_CFunction func);
113 void lua_str_reg(lua_State *L, int idx, lua_str const *tab, size_t len);
114 void lua_str_set(lua_State *L, int idx, char const *name, char const *data);
115 char const *lua_str_get(lua_State *L, int idx, char const *name);
117 void lua_int_reg(lua_State *L, int idx, lua_int const *tab, size_t len);
118 void lua_int_set(lua_State *L, int idx, char const *name, LUA_INT data);
119 LUA_INT lua_int_get(lua_State *L, int idx, char const *name);
121 void lua_num_reg(lua_State *L, int idx, lua_num const *tab, size_t len);
122 void lua_num_set(lua_State *L, int idx, char const *name, LUA_NUM data);
123 LUA_NUM lua_num_get(lua_State *L, int idx, char const *name);
125 void lua_array_u8_new(lua_State *L, a_u8 const *ptr, unsigned int num);
126 void lua_array_u16_new(lua_State *L, a_u16 const *ptr, unsigned int num);
127 void lua_array_u32_new(lua_State *L, a_u32 const *ptr, unsigned int num);
128 void lua_array_u64_new(lua_State *L, a_u64 const *ptr, unsigned int num);
130 void lua_array_str_new(lua_State *L, char const *const *ptr, unsigned int num);
131 void lua_array_str_get(lua_State *L, int idx, char const **ptr, unsigned int num);
132 void lua_array_str_set(lua_State *L, int idx, char const *const *ptr, unsigned int num);
134 void lua_array_int_new(lua_State *L, LUA_INT const *ptr, unsigned int num);
135 void lua_array_int_get(lua_State *L, int idx, LUA_INT *ptr, unsigned int num);
136 void lua_array_int_set(lua_State *L, int idx, LUA_INT const *ptr, unsigned int num);
138 void lua_array_num_new(lua_State *L, LUA_NUM const *ptr, unsigned int num);
139 void lua_array_num_get(lua_State *L, int idx, LUA_NUM *ptr, unsigned int num);
140 void lua_array_num_set(lua_State *L, int idx, LUA_NUM const *ptr, unsigned int num);
142 LUA_NUM *lua_table_num_get(lua_State *L, int idx, LUA_NUM const *ptr, size_t *num);
144 void lua_stack_view(lua_State *L, unsigned int line);
145 //#define LUA_STACK(L) lua_stack_view(L, __LINE__)
147 A_PUBLIC int luaopen_liba(lua_State *L);
148 A_PUBLIC int luaopen_liba_complex(lua_State *L);
149 A_PUBLIC int luaopen_liba_crc16(lua_State *L);
150 A_PUBLIC int luaopen_liba_crc32(lua_State *L);
151 A_PUBLIC int luaopen_liba_crc64(lua_State *L);
152 A_PUBLIC int luaopen_liba_crc8(lua_State *L);
153 A_PUBLIC int luaopen_liba_hpf(lua_State *L);
154 A_PUBLIC int luaopen_liba_lpf(lua_State *L);
155 A_PUBLIC int luaopen_liba_mf(lua_State *L);
156 A_PUBLIC int luaopen_liba_pid(lua_State *L);
157 A_PUBLIC int luaopen_liba_pid_fuzzy(lua_State *L);
158 A_PUBLIC int luaopen_liba_pid_neuro(lua_State *L);
159 A_PUBLIC int luaopen_liba_tf(lua_State *L);
160 A_PUBLIC int luaopen_liba_trajbell(lua_State *L);
161 A_PUBLIC int luaopen_liba_trajpoly3(lua_State *L);
162 A_PUBLIC int luaopen_liba_trajpoly5(lua_State *L);
163 A_PUBLIC int luaopen_liba_trajpoly7(lua_State *L);
164 A_PUBLIC int luaopen_liba_trajtrap(lua_State *L);
165 A_PUBLIC int luaopen_liba_version(lua_State *L);
167 #if defined(__cplusplus)
168 } /* extern "C" */
169 #endif /* __cplusplus */
171 #endif /* a.h */