#include "wsint.h"Include dependency graph for wsstream.c:

Go to the source code of this file.
Functions | |
| WsBool | ws_stream_getc (WsStream *stream, WsUInt32 *ch_return) |
| void | ws_stream_ungetc (WsStream *stream, WsUInt32 ch) |
| WsBool | ws_stream_flush (WsStream *stream) |
| void | ws_stream_close (WsStream *stream) |
| WsStream * | ws_stream_new (void *context, WsStreamIOProc io, WsStreamFlushProc flush, WsStreamCloseProc close) |
|
|
Definition at line 117 of file wsstream.c. References WsStreamRec::close, WsStreamRec::context, ws_free(), and WsStream. Referenced by ws_compile_data(), and ws_compile_file(). 00118 {
00119 if (stream->close)
00120 (*stream->close)(stream->context);
00121
00122 ws_free(stream);
00123 }
|
Here is the call graph for this function:

|
|
Definition at line 108 of file wsstream.c. References WsStreamRec::context, WsStreamRec::flush, WsBool, and WsStream. 00109 {
00110 if (stream->flush)
00111 return (*stream->flush)(stream->context);
00112
00113 return WS_TRUE;
00114 }
|
|
||||||||||||
|
Definition at line 74 of file wsstream.c. References WsStreamRec::buffer, WsStreamRec::buffer_pos, WsStreamRec::context, WsStreamRec::data_in_buffer, WsStreamRec::io, WsStreamRec::ungetch, WsStreamRec::ungetch_valid, WsBool, and WsStream. Referenced by read_float_from_exp(), read_float_from_point(), and ws_yy_lex(). 00075 {
00076 if (stream->ungetch_valid) {
00077 *ch_return = stream->ungetch;
00078 stream->ungetch_valid = WS_FALSE;
00079
00080 return WS_TRUE;
00081 }
00082
00083 if (stream->buffer_pos >= stream->data_in_buffer) {
00084 /* Read more data to the buffer. */
00085 stream->buffer_pos = 0;
00086 stream->data_in_buffer = (*stream->io)(stream->context,
00087 stream->buffer,
00088 WS_STREAM_BUFFER_SIZE);
00089 if (stream->data_in_buffer == 0)
00090 /* EOF reached. */
00091 return WS_FALSE;
00092 }
00093
00094 /* Return the next character. */
00095 *ch_return = stream->buffer[stream->buffer_pos++];
00096
00097 return WS_TRUE;
00098 }
|
|
||||||||||||||||||||
|
Definition at line 126 of file wsstream.c. References WsStreamRec::close, WsStreamRec::context, WsStreamRec::flush, WsStreamRec::io, ws_calloc(), and WsStream. Referenced by ws_stream_new_data_input(), and ws_stream_new_file(). 00128 {
00129 WsStream *stream = ws_calloc(1, sizeof(*stream));
00130
00131 if (stream == NULL)
00132 return NULL;
00133
00134 stream->io = io;
00135 stream->flush = flush;
00136 stream->close = close;
00137 stream->context = context;
00138
00139 return stream;
00140 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 101 of file wsstream.c. References WsStreamRec::ungetch, WsStreamRec::ungetch_valid, and WsStream. Referenced by read_float_from_exp(), read_float_from_point(), and ws_yy_lex(). 00102 {
00103 stream->ungetch = ch;
00104 stream->ungetch_valid = WS_TRUE;
00105 }
|