diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-06-20 16:25:54 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-06-20 16:25:54 -0300 |
commit | f97307b54893a53c985a0dcd8b3bb2b94cedd48d (patch) | |
tree | aa2aa6c7631064f0507747b72f7fba747ccd7026 /zio.h | |
parent | 6402bfb1f84391cab2c55bad45fec0f82da3c359 (diff) | |
download | lua-f97307b54893a53c985a0dcd8b3bb2b94cedd48d.tar.gz lua-f97307b54893a53c985a0dcd8b3bb2b94cedd48d.tar.bz2 lua-f97307b54893a53c985a0dcd8b3bb2b94cedd48d.zip |
zio should not care about how a user creates a FILE (pipe, socket, popen,
etc).
Diffstat (limited to 'zio.h')
-rw-r--r-- | zio.h | 8 |
1 files changed, 1 insertions, 7 deletions
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * zio.h | 2 | * zio.h |
3 | * a generic input stream interface | 3 | * a generic input stream interface |
4 | * $Id: zio.h,v 1.3 1997/06/18 21:39:56 roberto Exp roberto $ | 4 | * $Id: zio.h,v 1.4 1997/06/19 18:55:28 roberto Exp roberto $ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef zio_h | 7 | #ifndef zio_h |
@@ -13,8 +13,6 @@ | |||
13 | 13 | ||
14 | /* For Lua only */ | 14 | /* For Lua only */ |
15 | #define zFopen luaZ_Fopen | 15 | #define zFopen luaZ_Fopen |
16 | #define zfopen luaZ_fopen | ||
17 | #define zpopen luaZ_popen | ||
18 | #define zsopen luaZ_sopen | 16 | #define zsopen luaZ_sopen |
19 | #define zmopen luaZ_mopen | 17 | #define zmopen luaZ_mopen |
20 | #define zread luaZ_read | 18 | #define zread luaZ_read |
@@ -24,8 +22,6 @@ | |||
24 | typedef struct zio ZIO; | 22 | typedef struct zio ZIO; |
25 | 23 | ||
26 | ZIO* zFopen(ZIO* z, FILE* f); /* open FILEs */ | 24 | ZIO* zFopen(ZIO* z, FILE* f); /* open FILEs */ |
27 | ZIO* zfopen(ZIO* z, char* s, char* m); /* file by name */ | ||
28 | ZIO* zpopen(ZIO* z, char* s, char* m); /* pipe */ | ||
29 | ZIO* zsopen(ZIO* z, char* s); /* string */ | 25 | ZIO* zsopen(ZIO* z, char* s); /* string */ |
30 | ZIO* zmopen(ZIO* z, char* b, int size); /* memory */ | 26 | ZIO* zmopen(ZIO* z, char* b, int size); /* memory */ |
31 | 27 | ||
@@ -33,7 +29,6 @@ int zread(ZIO* z, void* b, int n); /* read next n bytes */ | |||
33 | 29 | ||
34 | #define zgetc(z) (--(z)->n>=0 ? ((int)*(z)->p++): (z)->filbuf(z)) | 30 | #define zgetc(z) (--(z)->n>=0 ? ((int)*(z)->p++): (z)->filbuf(z)) |
35 | #define zungetc(z) (++(z)->n,--(z)->p) | 31 | #define zungetc(z) (++(z)->n,--(z)->p) |
36 | #define zclose(z) (*(z)->close)(z) | ||
37 | 32 | ||
38 | 33 | ||
39 | 34 | ||
@@ -45,7 +40,6 @@ struct zio { | |||
45 | int n; /* bytes still unread */ | 40 | int n; /* bytes still unread */ |
46 | unsigned char* p; /* current position in buffer */ | 41 | unsigned char* p; /* current position in buffer */ |
47 | int (*filbuf)(ZIO* z); | 42 | int (*filbuf)(ZIO* z); |
48 | int (*close)(ZIO* z); | ||
49 | void* u; /* additional data */ | 43 | void* u; /* additional data */ |
50 | unsigned char buffer[ZBSIZE]; /* buffer */ | 44 | unsigned char buffer[ZBSIZE]; /* buffer */ |
51 | }; | 45 | }; |