Before compiling on Windows.

This commit is contained in:
Diego Nehab
2005-10-07 04:40:59 +00:00
parent 562d8cceb7
commit f4dadea763
26 changed files with 475 additions and 462 deletions

View File

@ -15,7 +15,7 @@
/*-------------------------------------------------------------------------*\
* Initializes the module
\*-------------------------------------------------------------------------*/
int aux_open(lua_State *L) {
int auxiliar_open(lua_State *L) {
(void) L;
return 0;
}
@ -24,7 +24,7 @@ int aux_open(lua_State *L) {
* Creates a new class with given methods
* Methods whose names start with __ are passed directly to the metatable.
\*-------------------------------------------------------------------------*/
void aux_newclass(lua_State *L, const char *classname, luaL_reg *func) {
void auxiliar_newclass(lua_State *L, const char *classname, luaL_reg *func) {
luaL_newmetatable(L, classname); /* mt */
/* create __index table to place methods */
lua_pushstring(L, "__index"); /* mt,"__index" */
@ -47,7 +47,7 @@ void aux_newclass(lua_State *L, const char *classname, luaL_reg *func) {
/*-------------------------------------------------------------------------*\
* Prints the value of a class in a nice way
\*-------------------------------------------------------------------------*/
int aux_tostring(lua_State *L) {
int auxiliar_tostring(lua_State *L) {
char buf[32];
if (!lua_getmetatable(L, 1)) goto error;
lua_pushstring(L, "__index");
@ -68,7 +68,7 @@ error:
/*-------------------------------------------------------------------------*\
* Insert class into group
\*-------------------------------------------------------------------------*/
void aux_add2group(lua_State *L, const char *classname, const char *groupname) {
void auxiliar_add2group(lua_State *L, const char *classname, const char *groupname) {
luaL_getmetatable(L, classname);
lua_pushstring(L, groupname);
lua_pushboolean(L, 1);
@ -79,7 +79,7 @@ void aux_add2group(lua_State *L, const char *classname, const char *groupname) {
/*-------------------------------------------------------------------------*\
* Make sure argument is a boolean
\*-------------------------------------------------------------------------*/
int aux_checkboolean(lua_State *L, int objidx) {
int auxiliar_checkboolean(lua_State *L, int objidx) {
if (!lua_isboolean(L, objidx))
luaL_typerror(L, objidx, lua_typename(L, LUA_TBOOLEAN));
return lua_toboolean(L, objidx);
@ -89,8 +89,8 @@ int aux_checkboolean(lua_State *L, int objidx) {
* Return userdata pointer if object belongs to a given class, abort with
* error otherwise
\*-------------------------------------------------------------------------*/
void *aux_checkclass(lua_State *L, const char *classname, int objidx) {
void *data = aux_getclassudata(L, classname, objidx);
void *auxiliar_checkclass(lua_State *L, const char *classname, int objidx) {
void *data = auxiliar_getclassudata(L, classname, objidx);
if (!data) {
char msg[45];
sprintf(msg, "%.35s expected", classname);
@ -103,8 +103,8 @@ void *aux_checkclass(lua_State *L, const char *classname, int objidx) {
* Return userdata pointer if object belongs to a given group, abort with
* error otherwise
\*-------------------------------------------------------------------------*/
void *aux_checkgroup(lua_State *L, const char *groupname, int objidx) {
void *data = aux_getgroupudata(L, groupname, objidx);
void *auxiliar_checkgroup(lua_State *L, const char *groupname, int objidx) {
void *data = auxiliar_getgroupudata(L, groupname, objidx);
if (!data) {
char msg[45];
sprintf(msg, "%.35s expected", groupname);
@ -116,7 +116,7 @@ void *aux_checkgroup(lua_State *L, const char *groupname, int objidx) {
/*-------------------------------------------------------------------------*\
* Set object class
\*-------------------------------------------------------------------------*/
void aux_setclass(lua_State *L, const char *classname, int objidx) {
void auxiliar_setclass(lua_State *L, const char *classname, int objidx) {
luaL_getmetatable(L, classname);
if (objidx < 0) objidx--;
lua_setmetatable(L, objidx);
@ -126,10 +126,7 @@ void aux_setclass(lua_State *L, const char *classname, int objidx) {
* Get a userdata pointer if object belongs to a given group. Return NULL
* otherwise
\*-------------------------------------------------------------------------*/
void *aux_getgroupudata(lua_State *L, const char *groupname, int objidx) {
#if 0
return lua_touserdata(L, objidx);
#else
void *auxiliar_getgroupudata(lua_State *L, const char *groupname, int objidx) {
if (!lua_getmetatable(L, objidx))
return NULL;
lua_pushstring(L, groupname);
@ -141,17 +138,12 @@ void *aux_getgroupudata(lua_State *L, const char *groupname, int objidx) {
lua_pop(L, 2);
return lua_touserdata(L, objidx);
}
#endif
}
/*-------------------------------------------------------------------------*\
* Get a userdata pointer if object belongs to a given class. Return NULL
* otherwise
\*-------------------------------------------------------------------------*/
void *aux_getclassudata(lua_State *L, const char *classname, int objidx) {
#if 0
return lua_touserdata(L, objidx);
#else
void *auxiliar_getclassudata(lua_State *L, const char *classname, int objidx) {
return luaL_checkudata(L, objidx, classname);
#endif
}