sc68fordevelopers  2.2.1
istream68_def.h
Go to the documentation of this file.
1 
14 /* Copyright (C) 1998-2003 Benjamin Gerard */
15 
16 #ifndef _ISTREAM68_DEF_H_
17 #define _ISTREAM68_DEF_H_
18 
19 #include "file68/istream68.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
30 #define ISTREAM_OPEN_READ_BIT 0
31 
33 #define ISTREAM_OPEN_READ (1<<ISTREAM_OPEN_READ_BIT)
34 
36 #define ISTREAM_OPEN_WRITE_BIT 1
37 
39 #define ISTREAM_OPEN_WRITE (1<<ISTREAM_OPEN_WRITE_BIT)
40 
42 #define ISTREAM_IS_OPEN(V) (!!((V)&(ISTREAM_OPEN_READ|ISTREAM_OPEN_WRITE)))
43 
45 #define ISTREAM_IS_OPEN_READ(V) (((V)>>ISTREAM_OPEN_READ_BIT)&1)
46 
48 #define ISTREAM_IS_OPEN_WRITE(V) (((V)>>ISTREAM_OPEN_WRITE_BIT)&1)
49 
55 typedef const char * (* istream_name_t) (istream_t *);
56 typedef int (* istream_open_t) (istream_t *);
57 typedef int (* istream_close_t) (istream_t *);
58 typedef int (* istream_length_t) (istream_t *);
59 typedef int (* istream_tell_t) (istream_t *);
60 typedef int (* istream_seek_t) (istream_t *, int);
61 typedef int (* istream_read_t) (istream_t *, void *, int);
62 typedef int (* istream_write_t) (istream_t *, const void *, int);
63 typedef void (* istream_destroy_t) (istream_t *);
67 struct _istream_t {
68  /*const*/ istream_name_t name;
69  /*const*/ istream_open_t open;
70  /*const*/ istream_close_t close;
71  /*const*/ istream_read_t read;
72  /*const*/ istream_write_t write;
73  /*const*/ istream_length_t length;
74  /*const*/ istream_tell_t tell;
75  /*const*/ istream_seek_t seekf;
76  /*const*/ istream_seek_t seekb;
77  /*const*/ istream_destroy_t destroy;
78 };
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif /* #ifndef _ISTREAM68_DEF_H_ */
istream_close_t close
Close stream.
Definition: istream68_def.h:70
istream_tell_t tell
Get stream position.
Definition: istream68_def.h:74
istream_length_t length
Get stream data length.
Definition: istream68_def.h:73
istream_read_t read
Read data from stream.
Definition: istream68_def.h:71
istream_seek_t seekf
Seek forward.
Definition: istream68_def.h:75
istream_seek_t seekb
Seek backward.
Definition: istream68_def.h:76
istream_destroy_t destroy
Destructor .
Definition: istream68_def.h:77
istream_name_t name
Get stream name.
Definition: istream68_def.h:68
Input stream structure.
Definition: istream68_def.h:67
istream_open_t open
Open stream.
Definition: istream68_def.h:69
istream_write_t write
Write data to stream/.
Definition: istream68_def.h:72
generic stream operation.