Mercurial > luasocket
comparison src/auxiliar.h @ 0:4b915342e2a8
LuaSocket 2.0.2 + CMake build description.
author | Eric Wing <ewing . public |-at-| gmail . com> |
---|---|
date | Tue, 26 Aug 2008 18:40:01 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4b915342e2a8 |
---|---|
1 #ifndef AUXILIAR_H | |
2 #define AUXILIAR_H | |
3 /*=========================================================================*\ | |
4 * Auxiliar routines for class hierarchy manipulation | |
5 * LuaSocket toolkit (but completely independent of other LuaSocket modules) | |
6 * | |
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: | |
10 * | |
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 | |
17 * | |
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. | |
23 * | |
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. | |
27 * | |
28 * The mapping from class name to the corresponding metatable and the | |
29 * reverse mapping are done using lauxlib. | |
30 * | |
31 * RCS ID: $Id: auxiliar.h,v 1.9 2005/10/07 04:40:59 diego Exp $ | |
32 \*=========================================================================*/ | |
33 | |
34 #include "lua.h" | |
35 #include "lauxlib.h" | |
36 | |
37 int auxiliar_open(lua_State *L); | |
38 void auxiliar_newclass(lua_State *L, const char *classname, luaL_reg *func); | |
39 void auxiliar_add2group(lua_State *L, const char *classname, const char *group); | |
40 void auxiliar_setclass(lua_State *L, const char *classname, int objidx); | |
41 void *auxiliar_checkclass(lua_State *L, const char *classname, int objidx); | |
42 void *auxiliar_checkgroup(lua_State *L, const char *groupname, int objidx); | |
43 void *auxiliar_getclassudata(lua_State *L, const char *groupname, int objidx); | |
44 void *auxiliar_getgroupudata(lua_State *L, const char *groupname, int objidx); | |
45 int auxiliar_checkboolean(lua_State *L, int objidx); | |
46 int auxiliar_tostring(lua_State *L); | |
47 | |
48 #endif /* AUXILIAR_H */ |