diff options
Diffstat (limited to 'lzio.c')
-rw-r--r-- | lzio.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lzio.c,v 1.1 1997/09/16 19:25:59 roberto Exp roberto $ | 2 | ** $Id: lzio.c,v 1.2 1997/11/21 19:00:46 roberto Exp roberto $ |
3 | ** a generic input stream interface | 3 | ** a generic input stream interface |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -20,22 +20,23 @@ static int zmfilbuf (ZIO* z) | |||
20 | return EOZ; | 20 | return EOZ; |
21 | } | 21 | } |
22 | 22 | ||
23 | ZIO* zmopen (ZIO* z, char* b, int size) | 23 | ZIO* zmopen (ZIO* z, char* b, int size, char *name) |
24 | { | 24 | { |
25 | if (b==NULL) return NULL; | 25 | if (b==NULL) return NULL; |
26 | z->n=size; | 26 | z->n=size; |
27 | z->p= (unsigned char *)b; | 27 | z->p= (unsigned char *)b; |
28 | z->filbuf=zmfilbuf; | 28 | z->filbuf=zmfilbuf; |
29 | z->u=NULL; | 29 | z->u=NULL; |
30 | z->name=name; | ||
30 | return z; | 31 | return z; |
31 | } | 32 | } |
32 | 33 | ||
33 | /* ------------------------------------------------------------ strings --- */ | 34 | /* ------------------------------------------------------------ strings --- */ |
34 | 35 | ||
35 | ZIO* zsopen (ZIO* z, char* s) | 36 | ZIO* zsopen (ZIO* z, char* s, char *name) |
36 | { | 37 | { |
37 | if (s==NULL) return NULL; | 38 | if (s==NULL) return NULL; |
38 | return zmopen(z,s,strlen(s)); | 39 | return zmopen(z,s,strlen(s),name); |
39 | } | 40 | } |
40 | 41 | ||
41 | /* -------------------------------------------------------------- FILEs --- */ | 42 | /* -------------------------------------------------------------- FILEs --- */ |
@@ -50,13 +51,14 @@ static int zffilbuf (ZIO* z) | |||
50 | } | 51 | } |
51 | 52 | ||
52 | 53 | ||
53 | ZIO* zFopen (ZIO* z, FILE* f) | 54 | ZIO* zFopen (ZIO* z, FILE* f, char *name) |
54 | { | 55 | { |
55 | if (f==NULL) return NULL; | 56 | if (f==NULL) return NULL; |
56 | z->n=0; | 57 | z->n=0; |
57 | z->p=z->buffer; | 58 | z->p=z->buffer; |
58 | z->filbuf=zffilbuf; | 59 | z->filbuf=zffilbuf; |
59 | z->u=f; | 60 | z->u=f; |
61 | z->name=name; | ||
60 | return z; | 62 | return z; |
61 | } | 63 | } |
62 | 64 | ||