diff options
Diffstat (limited to 'src/gallium/auxiliary/os/os_stream.h')
-rw-r--r-- | src/gallium/auxiliary/os/os_stream.h | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/src/gallium/auxiliary/os/os_stream.h b/src/gallium/auxiliary/os/os_stream.h index bf30e6542d3..8232b0f1586 100644 --- a/src/gallium/auxiliary/os/os_stream.h +++ b/src/gallium/auxiliary/os/os_stream.h @@ -37,25 +37,54 @@ #include "pipe/p_compiler.h" -struct os_stream; - - /** - * Create a stream - * @param filename relative or absolute path (necessary for windows) - * @param optional maximum file size (0 for a growable size). + * OS stream (FILE, socket, etc) abstraction. */ +struct os_stream +{ + void + (*close)(struct os_stream *stream); + + boolean + (*write)(struct os_stream *stream, const void *data, size_t size); + + void + (*flush)(struct os_stream *stream); +}; + + +static INLINE void +os_stream_close(struct os_stream *stream) +{ + stream->close(stream); +} + + +static INLINE boolean +os_stream_write(struct os_stream *stream, const void *data, size_t size) +{ + return stream->write(stream, data, size); +} + + +static INLINE void +os_stream_flush(struct os_stream *stream) +{ + stream->flush(stream); +} + + struct os_stream * -os_stream_create(const char *filename, size_t max_size); +os_file_stream_create(const char *filename); + -boolean -os_stream_write(struct os_stream *stream, const void *data, size_t size); +struct os_stream * +os_null_stream_create(void); -void -os_stream_flush(struct os_stream *stream); -void -os_stream_close(struct os_stream *stream); +#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) +#define os_file_stream_create(_filename) os_null_stream_create() +#endif #endif /* _OS_STREAM_H_ */ |