rev |
line source |
mojo@14206
|
1 diff -Naur old/istream.c new/istream.c
|
mojo@14206
|
2 --- istream.c 2011-01-04 20:22:22.000000000 +1100
|
mojo@14206
|
3 +++ istream.c 2012-07-04 21:50:51.529661517 +1000
|
mojo@14206
|
4 @@ -22,8 +22,8 @@
|
mojo@14206
|
5 static void basic_close(int *handle);
|
mojo@14206
|
6 static int basic_read(int *handle, char *buf, int len);
|
mojo@14206
|
7
|
mojo@14206
|
8 -static void file_close(struct file_handle *handle);
|
mojo@14206
|
9 -static int file_read(struct file_handle *handle, char *buf, int len);
|
mojo@14206
|
10 +static void file_close(struct file_handle_rofl *handle);
|
mojo@14206
|
11 +static int file_read(struct file_handle_rofl *handle, char *buf, int len);
|
mojo@14206
|
12
|
mojo@14206
|
13 static int str_read(Str handle, char *buf, int len);
|
mojo@14206
|
14
|
mojo@14206
|
15 @@ -114,7 +114,7 @@
|
mojo@14206
|
16 stream = New(union input_stream);
|
mojo@14206
|
17 init_base_stream(&stream->base, STREAM_BUF_SIZE);
|
mojo@14206
|
18 stream->file.type = IST_FILE;
|
mojo@14206
|
19 - stream->file.handle = New(struct file_handle);
|
mojo@14206
|
20 + stream->file.handle = New(struct file_handle_rofl);
|
mojo@14206
|
21 stream->file.handle->f = f;
|
mojo@14206
|
22 if (closep)
|
mojo@14206
|
23 stream->file.handle->close = closep;
|
mojo@14206
|
24 @@ -658,13 +658,13 @@
|
mojo@14206
|
25 }
|
mojo@14206
|
26
|
mojo@14206
|
27 static void
|
mojo@14206
|
28 -file_close(struct file_handle *handle)
|
mojo@14206
|
29 +file_close(struct file_handle_rofl *handle)
|
mojo@14206
|
30 {
|
mojo@14206
|
31 handle->close(handle->f);
|
mojo@14206
|
32 }
|
mojo@14206
|
33
|
mojo@14206
|
34 static int
|
mojo@14206
|
35 -file_read(struct file_handle *handle, char *buf, int len)
|
mojo@14206
|
36 +file_read(struct file_handle_rofl *handle, char *buf, int len)
|
mojo@14206
|
37 {
|
mojo@14206
|
38 return fread(buf, 1, len, handle->f);
|
mojo@14206
|
39 }
|
mojo@14206
|
40 diff -Naur old/istream.h new/istream.h
|
mojo@14206
|
41 --- istream.h 2003-10-21 02:41:56.000000000 +1000
|
mojo@14206
|
42 +++ istream.h 2012-07-04 21:50:51.529661517 +1000
|
mojo@14206
|
43 @@ -20,7 +20,7 @@
|
mojo@14206
|
44
|
mojo@14206
|
45 typedef struct stream_buffer *StreamBuffer;
|
mojo@14206
|
46
|
mojo@14206
|
47 -struct file_handle {
|
mojo@14206
|
48 +struct file_handle_rofl {
|
mojo@14206
|
49 FILE *f;
|
mojo@14206
|
50 void (*close) ();
|
mojo@14206
|
51 };
|
mojo@14206
|
52 @@ -53,7 +53,7 @@
|
mojo@14206
|
53
|
mojo@14206
|
54 struct file_stream {
|
mojo@14206
|
55 struct stream_buffer stream;
|
mojo@14206
|
56 - struct file_handle *handle;
|
mojo@14206
|
57 + struct file_handle_rofl *handle;
|
mojo@14206
|
58 char type;
|
mojo@14206
|
59 char iseos;
|
mojo@14206
|
60 int (*read) ();
|