diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-06-26 18:47:49 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-06-26 18:47:49 +0000 |
commit | 71f6bb60bf2b7457091c7106190f92ab7e51f7c6 (patch) | |
tree | 8ad3668667bd3da3c34f7ff7ae0a9a7a4daa4679 /src/auxiliar.h | |
parent | f330540576031528f0daac231c61d4dd06e8ba1e (diff) | |
download | luasocket-71f6bb60bf2b7457091c7106190f92ab7e51f7c6.tar.gz luasocket-71f6bb60bf2b7457091c7106190f92ab7e51f7c6.tar.bz2 luasocket-71f6bb60bf2b7457091c7106190f92ab7e51f7c6.zip |
Finished implementation of LuaSocket 2.0 alpha on Linux.
Some testing still needed.
Diffstat (limited to 'src/auxiliar.h')
-rw-r--r-- | src/auxiliar.h | 48 |
1 files changed, 37 insertions, 11 deletions
diff --git a/src/auxiliar.h b/src/auxiliar.h index 66be31d..324e800 100644 --- a/src/auxiliar.h +++ b/src/auxiliar.h | |||
@@ -1,22 +1,37 @@ | |||
1 | #ifndef AUX_H | ||
2 | #define AUX_H | ||
1 | /*=========================================================================*\ | 3 | /*=========================================================================*\ |
2 | * Auxiliar routines for class hierarchy manipulation | 4 | * Auxiliar routines for class hierarchy manipulation |
5 | * LuaSocket toolkit | ||
6 | * | ||
7 | * A LuaSocket class is a name associated with Lua metatables. A LuaSocket | ||
8 | * group is a name associated to 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 object | ||
14 | * - check if an object belongs to a given class or group | ||
15 | * | ||
16 | * LuaSocket class names follow the convention <module>{<class>}. Modules | ||
17 | * can define any number of classes and groups. The module tcp.c, for | ||
18 | * example, defines the classes tcp{master}, tcp{client} and tcp{server} and | ||
19 | * the groups tcp{client, server} and tcp{any}. Module functions can then | ||
20 | * perform type-checking on it's arguments by either class or group. | ||
21 | * | ||
22 | * LuaSocket metatables define the __index metamethod as being a table. This | ||
23 | * table has one field for each method supported by the class. In DEBUG | ||
24 | * mode, it also has one field with the class name. | ||
25 | * | ||
26 | * The mapping from class name to the corresponding metatable and the | ||
27 | * reverse mapping are done using lauxlib. | ||
3 | * | 28 | * |
4 | * RCS ID: $Id$ | 29 | * RCS ID: $Id$ |
5 | \*=========================================================================*/ | 30 | \*=========================================================================*/ |
6 | #ifndef AUX_H | ||
7 | #define AUX_H | ||
8 | 31 | ||
9 | #include <lua.h> | 32 | #include <lua.h> |
10 | #include <lauxlib.h> | 33 | #include <lauxlib.h> |
11 | 34 | ||
12 | void aux_newclass(lua_State *L, const char *name, luaL_reg *func); | ||
13 | void aux_add2group(lua_State *L, const char *name, const char *group); | ||
14 | void *aux_checkclass(lua_State *L, const char *name, int objidx); | ||
15 | void *aux_checkgroup(lua_State *L, const char *group, int objidx); | ||
16 | void *aux_getclassudata(lua_State *L, const char *group, int objidx); | ||
17 | void *aux_getgroupudata(lua_State *L, const char *group, int objidx); | ||
18 | void aux_setclass(lua_State *L, const char *name, int objidx); | ||
19 | |||
20 | /* min and max macros */ | 35 | /* min and max macros */ |
21 | #ifndef MIN | 36 | #ifndef MIN |
22 | #define MIN(x, y) ((x) < (y) ? x : y) | 37 | #define MIN(x, y) ((x) < (y) ? x : y) |
@@ -25,4 +40,15 @@ void aux_setclass(lua_State *L, const char *name, int objidx); | |||
25 | #define MAX(x, y) ((x) > (y) ? x : y) | 40 | #define MAX(x, y) ((x) > (y) ? x : y) |
26 | #endif | 41 | #endif |
27 | 42 | ||
28 | #endif | 43 | void aux_open(lua_State *L); |
44 | void aux_newclass(lua_State *L, const char *classname, luaL_reg *func); | ||
45 | void aux_add2group(lua_State *L, const char *classname, const char *group); | ||
46 | void aux_setclass(lua_State *L, const char *classname, int objidx); | ||
47 | void *aux_checkclass(lua_State *L, const char *classname, int objidx); | ||
48 | void *aux_checkgroup(lua_State *L, const char *groupname, int objidx); | ||
49 | void *aux_getclassudata(lua_State *L, const char *groupname, int objidx); | ||
50 | void *aux_getgroupudata(lua_State *L, const char *groupname, int objidx); | ||
51 | int aux_meth_setoption(lua_State *L, luaL_reg *opt); | ||
52 | int aux_checkboolean(lua_State *L, int objidx); | ||
53 | |||
54 | #endif /* AUX_H */ | ||