3 /*=========================================================================*\
4 * Auxiliar routines for class hierarchy manipulation
5 * LuaSocket toolkit (but completely independent of other LuaSocket modules)
7 * A LuaSocket class is a name associated with Lua metatables. A LuaSocket
8 * group is a name associated with a class. A class can belong to any number
9 * of groups. This module provides the functionality to:
11 * - create new classes
12 * - add classes to groups
13 * - set the class of objects
14 * - check if an object belongs to a given class or group
15 * - get the userdata associated to objects
16 * - print objects in a pretty way
18 * LuaSocket class names follow the convention <module>{<class>}. Modules
19 * can define any number of classes and groups. The module tcp.c, for
20 * example, defines the classes tcp{master}, tcp{client} and tcp{server} and
21 * the groups tcp{client,server} and tcp{any}. Module functions can then
22 * perform type-checking on their arguments by either class or group.
24 * LuaSocket metatables define the __index metamethod as being a table. This
25 * table has one field for each method supported by the class, and a field
26 * "class" with the class name.
28 * The mapping from class name to the corresponding metatable and the
29 * reverse mapping are done using lauxlib.
30 \*=========================================================================*/
35 int auxiliar_open(lua_State
*L
);
36 void auxiliar_newclass(lua_State
*L
, const char *classname
, luaL_Reg
*func
);
37 void auxiliar_add2group(lua_State
*L
, const char *classname
, const char *group
);
38 void auxiliar_setclass(lua_State
*L
, const char *classname
, int objidx
);
39 void *auxiliar_checkclass(lua_State
*L
, const char *classname
, int objidx
);
40 void *auxiliar_checkgroup(lua_State
*L
, const char *groupname
, int objidx
);
41 void *auxiliar_getclassudata(lua_State
*L
, const char *groupname
, int objidx
);
42 void *auxiliar_getgroupudata(lua_State
*L
, const char *groupname
, int objidx
);
43 int auxiliar_checkboolean(lua_State
*L
, int objidx
);
44 int auxiliar_tostring(lua_State
*L
);
45 int auxiliar_typeerror(lua_State
*L
, int narg
, const char *tname
);
47 #endif /* AUXILIAR_H */