diff -r c80c910fe191 -r abae4669fba7 ucx/memstream.h --- a/ucx/memstream.h Wed Oct 10 09:34:13 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -#ifndef MEMSTREAM_H -#define MEMSTREAM_H - -#include - -/* as fmemopen is a C extension we provide our cross plattform stuff here */ - -#ifdef __cplusplus -extern "C" { -#endif - - -/* as FILE is opaque, we don't do evil hacks but provide an alternative */ -typedef struct UcxMemstream UcxMemstream; - -UcxMemstream *ucx_memopen(void *space, size_t length); -void ucx_memclose(UcxMemstream* stream); - -/* - * Moves the position of the stream to a new position relative to whence. - * - * SEEK_SET marks the start of the buffer - * SEEK_CUR marks the current position - * SEEK_END marks the first 0-byte in the buffer - * - * ucx_memseek returns 0 on success and -1 if the new position is beyond the - * bounds of the allocated buffer. In that case the position of the stream - * remains unchanged. - * - */ -int ucx_memseek(UcxMemstream *stream, off_t offset, int whence); -size_t ucx_memtell(UcxMemstream *stream); - -/* - * returns non-zero, iff the current stream position has exceeded the last - * available byte of the underlying buffer - * - */ -int ucx_memeof(UcxMemstream *stream); - -/* memwrite, memread, memputc and memreadc shall not generate overflows */ -size_t ucx_memio(void *d, size_t s, size_t n, UcxMemstream* m, _Bool read); -#define ucx_memwrite(data, itemsize, nitems, memstream) \ - ucx_memio(data, itemsize, nitems, memstream, 0) -#define ucx_memread(data, itemsize, nitems, memstream) \ - ucx_memio(data, itemsize, nitems, memstream, 1) -int ucx_memputc(UcxMemstream *stream, int c); -int ucx_memgetc(UcxMemstream *stream); - -#ifdef __cplusplus -} -#endif - -#endif /* MEMSTREAM_H */ -