2003-06-26 18:47:49 +00:00
|
|
|
#ifndef AUX_H
|
|
|
|
#define AUX_H
|
2003-05-25 01:54:13 +00:00
|
|
|
/*=========================================================================*\
|
|
|
|
* Auxiliar routines for class hierarchy manipulation
|
2004-06-15 06:24:00 +00:00
|
|
|
* LuaSocket toolkit (but completely independent of other LuaSocket modules)
|
2003-06-26 18:47:49 +00:00
|
|
|
*
|
|
|
|
* A LuaSocket class is a name associated with Lua metatables. A LuaSocket
|
2004-06-15 06:24:00 +00:00
|
|
|
* group is a name associated with a class. A class can belong to any number
|
2003-06-26 18:47:49 +00:00
|
|
|
* of groups. This module provides the functionality to:
|
|
|
|
*
|
|
|
|
* - create new classes
|
|
|
|
* - add classes to groups
|
2004-06-15 06:24:00 +00:00
|
|
|
* - set the class of objects
|
2003-06-26 18:47:49 +00:00
|
|
|
* - check if an object belongs to a given class or group
|
2004-06-15 06:24:00 +00:00
|
|
|
* - get the userdata associated to objects
|
|
|
|
* - print objects in a pretty way
|
2003-06-26 18:47:49 +00:00
|
|
|
*
|
|
|
|
* LuaSocket class names follow the convention <module>{<class>}. Modules
|
|
|
|
* can define any number of classes and groups. The module tcp.c, for
|
|
|
|
* example, defines the classes tcp{master}, tcp{client} and tcp{server} and
|
2004-06-15 06:24:00 +00:00
|
|
|
* the groups tcp{client,server} and tcp{any}. Module functions can then
|
|
|
|
* perform type-checking on their arguments by either class or group.
|
2003-06-26 18:47:49 +00:00
|
|
|
*
|
|
|
|
* LuaSocket metatables define the __index metamethod as being a table. This
|
2004-06-15 06:24:00 +00:00
|
|
|
* table has one field for each method supported by the class, and a field
|
|
|
|
* "class" with the class name.
|
2003-06-26 18:47:49 +00:00
|
|
|
*
|
|
|
|
* The mapping from class name to the corresponding metatable and the
|
|
|
|
* reverse mapping are done using lauxlib.
|
2003-05-25 01:54:13 +00:00
|
|
|
*
|
|
|
|
* RCS ID: $Id$
|
|
|
|
\*=========================================================================*/
|
|
|
|
|
|
|
|
#include <lua.h>
|
|
|
|
#include <lauxlib.h>
|
|
|
|
|
2004-02-04 14:29:11 +00:00
|
|
|
int aux_open(lua_State *L);
|
2003-06-26 18:47:49 +00:00
|
|
|
void aux_newclass(lua_State *L, const char *classname, luaL_reg *func);
|
|
|
|
void aux_add2group(lua_State *L, const char *classname, const char *group);
|
|
|
|
void aux_setclass(lua_State *L, const char *classname, int objidx);
|
|
|
|
void *aux_checkclass(lua_State *L, const char *classname, int objidx);
|
|
|
|
void *aux_checkgroup(lua_State *L, const char *groupname, int objidx);
|
|
|
|
void *aux_getclassudata(lua_State *L, const char *groupname, int objidx);
|
|
|
|
void *aux_getgroupudata(lua_State *L, const char *groupname, int objidx);
|
|
|
|
int aux_checkboolean(lua_State *L, int objidx);
|
2004-06-15 06:24:00 +00:00
|
|
|
int aux_tostring(lua_State *L);
|
2003-06-26 18:47:49 +00:00
|
|
|
|
|
|
|
#endif /* AUX_H */
|