zio should not care about how a user creates a FILE (pipe, socket, popen,

etc).
This commit is contained in:
Roberto Ierusalimschy
1997-06-20 16:25:54 -03:00
parent 6402bfb1f8
commit f97307b548
2 changed files with 2 additions and 46 deletions

8
zio.h
View File

@@ -1,7 +1,7 @@
/*
* zio.h
* a generic input stream interface
* $Id: zio.h,v 1.3 1997/06/18 21:39:56 roberto Exp roberto $
* $Id: zio.h,v 1.4 1997/06/19 18:55:28 roberto Exp roberto $
*/
#ifndef zio_h
@@ -13,8 +13,6 @@
/* For Lua only */
#define zFopen luaZ_Fopen
#define zfopen luaZ_fopen
#define zpopen luaZ_popen
#define zsopen luaZ_sopen
#define zmopen luaZ_mopen
#define zread luaZ_read
@@ -24,8 +22,6 @@
typedef struct zio ZIO;
ZIO* zFopen(ZIO* z, FILE* f); /* open FILEs */
ZIO* zfopen(ZIO* z, char* s, char* m); /* file by name */
ZIO* zpopen(ZIO* z, char* s, char* m); /* pipe */
ZIO* zsopen(ZIO* z, char* s); /* string */
ZIO* zmopen(ZIO* z, char* b, int size); /* memory */
@@ -33,7 +29,6 @@ int zread(ZIO* z, void* b, int n); /* read next n bytes */
#define zgetc(z) (--(z)->n>=0 ? ((int)*(z)->p++): (z)->filbuf(z))
#define zungetc(z) (++(z)->n,--(z)->p)
#define zclose(z) (*(z)->close)(z)
@@ -45,7 +40,6 @@ struct zio {
int n; /* bytes still unread */
unsigned char* p; /* current position in buffer */
int (*filbuf)(ZIO* z);
int (*close)(ZIO* z);
void* u; /* additional data */
unsigned char buffer[ZBSIZE]; /* buffer */
};