aboutsummaryrefslogtreecommitdiff
path: root/src/auxiliar.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/auxiliar.h')
-rw-r--r--src/auxiliar.h25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/auxiliar.h b/src/auxiliar.h
index bc45182..70f4704 100644
--- a/src/auxiliar.h
+++ b/src/auxiliar.h
@@ -2,26 +2,28 @@
2#define AUX_H 2#define AUX_H
3/*=========================================================================*\ 3/*=========================================================================*\
4* Auxiliar routines for class hierarchy manipulation 4* Auxiliar routines for class hierarchy manipulation
5* LuaSocket toolkit 5* LuaSocket toolkit (but completely independent of other LuaSocket modules)
6* 6*
7* A LuaSocket class is a name associated with Lua metatables. A LuaSocket 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 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: 9* of groups. This module provides the functionality to:
10* 10*
11* - create new classes 11* - create new classes
12* - add classes to groups 12* - add classes to groups
13* - set the class of object 13* - set the class of objects
14* - check if an object belongs to a given class or group 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
15* 17*
16* LuaSocket class names follow the convention <module>{<class>}. Modules 18* LuaSocket class names follow the convention <module>{<class>}. Modules
17* can define any number of classes and groups. The module tcp.c, for 19* 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 20* 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 21* 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. 22* perform type-checking on their arguments by either class or group.
21* 23*
22* LuaSocket metatables define the __index metamethod as being a table. This 24* 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 25* table has one field for each method supported by the class, and a field
24* mode, it also has one field with the class name. 26* "class" with the class name.
25* 27*
26* The mapping from class name to the corresponding metatable and the 28* The mapping from class name to the corresponding metatable and the
27* reverse mapping are done using lauxlib. 29* reverse mapping are done using lauxlib.
@@ -32,14 +34,6 @@
32#include <lua.h> 34#include <lua.h>
33#include <lauxlib.h> 35#include <lauxlib.h>
34 36
35/* min and max macros */
36#ifndef MIN
37#define MIN(x, y) ((x) < (y) ? x : y)
38#endif
39#ifndef MAX
40#define MAX(x, y) ((x) > (y) ? x : y)
41#endif
42
43int aux_open(lua_State *L); 37int aux_open(lua_State *L);
44void aux_newclass(lua_State *L, const char *classname, luaL_reg *func); 38void aux_newclass(lua_State *L, const char *classname, luaL_reg *func);
45void aux_add2group(lua_State *L, const char *classname, const char *group); 39void aux_add2group(lua_State *L, const char *classname, const char *group);
@@ -49,5 +43,6 @@ void *aux_checkgroup(lua_State *L, const char *groupname, int objidx);
49void *aux_getclassudata(lua_State *L, const char *groupname, int objidx); 43void *aux_getclassudata(lua_State *L, const char *groupname, int objidx);
50void *aux_getgroupudata(lua_State *L, const char *groupname, int objidx); 44void *aux_getgroupudata(lua_State *L, const char *groupname, int objidx);
51int aux_checkboolean(lua_State *L, int objidx); 45int aux_checkboolean(lua_State *L, int objidx);
46int aux_tostring(lua_State *L);
52 47
53#endif /* AUX_H */ 48#endif /* AUX_H */