00001
00011 #ifndef _ENTRYLIST_DRIVER_H_
00012 #define _ENTRYLIST_DRIVER_H_
00013
00024 #include <stdio.h>
00025 #include "lua.h"
00026 #include "any_driver.h"
00027 #include "allocator.h"
00028 #include "entrylist.h"
00029
00033 extern int entrylist_tag;
00034
00038 extern allocator_t * lists;
00039
00043 extern allocator_t * entries;
00044
00048 any_driver_t entrylist_driver;
00049
00050 int lua_entrylist_init(lua_State * L);
00051
00055 #define DRIVER_NAME "entrylist"
00056
00057 #define EL_FUNCTION_DECLARE(name) int lua_entrylist_##name(lua_State * L)
00058
00059 #define EL_FUNCTION_START(name) \
00060 int lua_entrylist_##name(lua_State * L) \
00061 { \
00062 el_list_t * el; \
00063 if (lua_tag(L, 1) != entrylist_tag) { \
00064 printf("el_" #name " : first parameter is not an entry-list\n"); \
00065 return 0; \
00066 } \
00067 if (el = lua_touserdata(L, 1), !el) { \
00068 printf("el_" #name " : Null pointer.\n"); \
00069 return 0; \
00070 }
00071
00072 #define EL_FUNCTION_END() }
00073
00074 #define GET_ENTRYLIST(EL,N) \
00075 if (lua_tag(L, N) != entrylist_tag) { \
00076 printf("%s : parameter #%d is not an entry-list\n",__FUNCTION__, N); \
00077 return 0; \
00078 } \
00079 if ((EL) = lua_touserdata(L, 1), !(EL)) { \
00080 printf("%s : parameter #%d, null pointer.\n", __FUNCTION__, N); \
00081 return 0; \
00082 }
00083
00084 #endif