ZEDA  1.6.18
Data Structures | Macros | Typedefs | Functions
generalized I/O stream.

Data Structures

struct  __zstream
 
struct  zStream
 abstracted stream manipulation class. More...
 

Macros

#define zStreamRewind(s)   (*(s)->rewind)( (s) )
 set the current position to the head of a stream. More...
 
#define zStreamSeek(s, p)   (*(s)->seek)( (s), (p) )
 set the current position to the specified location in a stream. More...
 
#define zStreamTell(s)   (*(s)->tell)( (s) )
 tell the current position in a stream. More...
 
#define zStreamRead(s, d, u, n)   (*(s)->read)( (s), (d), (u), (n) )
 read n data from the current position of s, and copy it to the memory pointed by d. u is the size of a data cell. More...
 
#define zStreamWrite(s, m, u, n)   (*(s)->write)( (s), (m), (u), (n) )
 write n data stored at m to the current position of s. s is the size of a data cell. More...
 
#define zStreamClose(s)   (*(s)->close)( (s) )
 close a stream. More...
 

Typedefs

typedef struct __zstream zStream
 

Functions

void zStreamAttachFile (zStream *str, FILE *fp)
 attach a file to a stream. More...
 
void zStreamAttachMem (zStream *str, byte *mem, size_t size)
 attach a memory space to a stream. More...
 
zStreamzStreamOpenFile (zStream *str, char filename[], char *mode)
 open a file and attach to a stream. More...
 
zStreamzStreamOpenMem (zStream *str, size_t size)
 allocate a memory space and attach to a stream. More...
 

Detailed Description

Macro Definition Documentation

◆ zStreamRewind

#define zStreamRewind (   s)    (*(s)->rewind)( (s) )

set the current position to the head of a stream.

◆ zStreamSeek

#define zStreamSeek (   s,
 
)    (*(s)->seek)( (s), (p) )

set the current position to the specified location in a stream.

◆ zStreamTell

#define zStreamTell (   s)    (*(s)->tell)( (s) )

tell the current position in a stream.

◆ zStreamRead

#define zStreamRead (   s,
  d,
  u,
 
)    (*(s)->read)( (s), (d), (u), (n) )

read n data from the current position of s, and copy it to the memory pointed by d. u is the size of a data cell.

◆ zStreamWrite

#define zStreamWrite (   s,
  m,
  u,
 
)    (*(s)->write)( (s), (m), (u), (n) )

write n data stored at m to the current position of s. s is the size of a data cell.

◆ zStreamClose

#define zStreamClose (   s)    (*(s)->close)( (s) )

close a stream.

Typedef Documentation

◆ zStream

typedef struct __zstream zStream

Function Documentation

◆ zStreamAttachFile()

void zStreamAttachFile ( zStream str,
FILE *  fp 
)

attach a file to a stream.

zStreamAttachFile() attaches a file stream fp to an abstracted stream str.

◆ zStreamAttachMem()

void zStreamAttachMem ( zStream str,
byte mem,
size_t  size 
)

attach a memory space to a stream.

zStreamAttachMem() attaches a memory buffer pointed by mem with the size size to an abstracted stream str.

◆ zStreamOpenFile()

zStream* zStreamOpenFile ( zStream str,
char  filename[],
char *  mode 
)

open a file and attach to a stream.

zStreamOpenFile() opens a file filename with the mode mode, and attaches it to a stream str.

Returns
a pointer str is returned if succeeding to open the file. Otherwise, the null pointer is returned.

◆ zStreamOpenMem()

zStream* zStreamOpenMem ( zStream str,
size_t  size 
)

allocate a memory space and attach to a stream.

zStreamOpenMem() allocates a memory buffer with the size size, and attaches it to a stream str.

Returns
a pointer str is returned if succeeding to allocate the memory space. Otherwise, the null pointer is returned.