diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-05-25 01:54:13 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-05-25 01:54:13 +0000 |
| commit | 0f6c8d50a99997ac7829864b1c93362b50f1bbf3 (patch) | |
| tree | d0cefe3a05484e65b7b7e79d8cae4a1d2e6d19fb /src/buffer.h | |
| parent | c1ef3e7103cc652d2004ef1ddc9409b946207f33 (diff) | |
| download | luasocket-0f6c8d50a99997ac7829864b1c93362b50f1bbf3.tar.gz luasocket-0f6c8d50a99997ac7829864b1c93362b50f1bbf3.tar.bz2 luasocket-0f6c8d50a99997ac7829864b1c93362b50f1bbf3.zip | |
Porting to LUA 5.0 final
Diffstat (limited to 'src/buffer.h')
| -rw-r--r-- | src/buffer.h | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/buffer.h b/src/buffer.h index 4943e3b..3ffc145 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -3,11 +3,12 @@ | |||
| 3 | * | 3 | * |
| 4 | * RCS ID: $Id$ | 4 | * RCS ID: $Id$ |
| 5 | \*=========================================================================*/ | 5 | \*=========================================================================*/ |
| 6 | #ifndef BUF_H_ | 6 | #ifndef BUF_H |
| 7 | #define BUF_H_ | 7 | #define BUF_H |
| 8 | 8 | ||
| 9 | #include <lua.h> | 9 | #include <lua.h> |
| 10 | #include "lsbase.h" | 10 | #include "io.h" |
| 11 | #include "tm.h" | ||
| 11 | 12 | ||
| 12 | /* buffer size in bytes */ | 13 | /* buffer size in bytes */ |
| 13 | #define BUF_SIZE 8192 | 14 | #define BUF_SIZE 8192 |
| @@ -15,10 +16,11 @@ | |||
| 15 | /*-------------------------------------------------------------------------*\ | 16 | /*-------------------------------------------------------------------------*\ |
| 16 | * Buffer control structure | 17 | * Buffer control structure |
| 17 | \*-------------------------------------------------------------------------*/ | 18 | \*-------------------------------------------------------------------------*/ |
| 18 | typedef struct t_buf_tag { | 19 | typedef struct t_buf_ { |
| 19 | size_t buf_first, buf_last; | 20 | p_io io; /* IO driver used for this buffer */ |
| 20 | char buf_data[BUF_SIZE]; | 21 | p_tm tm; /* timeout management for this buffer */ |
| 21 | p_base buf_base; | 22 | size_t first, last; /* index of first and last bytes of stored data */ |
| 23 | char data[BUF_SIZE]; /* storage space for buffer data */ | ||
| 22 | } t_buf; | 24 | } t_buf; |
| 23 | typedef t_buf *p_buf; | 25 | typedef t_buf *p_buf; |
| 24 | 26 | ||
| @@ -26,9 +28,9 @@ typedef t_buf *p_buf; | |||
| 26 | * Exported functions | 28 | * Exported functions |
| 27 | \*-------------------------------------------------------------------------*/ | 29 | \*-------------------------------------------------------------------------*/ |
| 28 | void buf_open(lua_State *L); | 30 | void buf_open(lua_State *L); |
| 29 | void buf_init(lua_State *L, p_buf buf, p_base base); | 31 | void buf_init(p_buf buf, p_io io, p_tm tm); |
| 30 | int buf_send(lua_State *L, p_buf buf); | 32 | int buf_meth_send(lua_State *L, p_buf buf); |
| 31 | int buf_receive(lua_State *L, p_buf buf); | 33 | int buf_meth_receive(lua_State *L, p_buf buf); |
| 32 | int buf_isempty(lua_State *L, p_buf buf); | 34 | int buf_isempty(p_buf buf); |
| 33 | 35 | ||
| 34 | #endif /* BUF_H_ */ | 36 | #endif /* BUF_H */ |
