This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
| struct | WsStreamRec |
Defines | |
| #define | WS_STREAM_BUFFER_SIZE 1024 |
Typedefs | |
| typedef size_t(* | WsStreamIOProc )(void *context, WsUInt32 *buf, size_t buflen) |
| typedef WsBool(* | WsStreamFlushProc )(void *context) |
| typedef void(* | WsStreamCloseProc )(void *context) |
| typedef WsStreamRec | WsStream |
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) |
| WsStream * | ws_stream_new_file (FILE *fp, WsBool output, WsBool close) |
| WsStream * | ws_stream_new_data_input (const unsigned char *data, size_t data_len) |
|
|
Definition at line 78 of file wsstream.h. |
|
|
Definition at line 118 of file wsstream.h. Referenced by compile_stream(), ws_compile_data(), ws_compile_file(), ws_stream_close(), ws_stream_flush(), ws_stream_getc(), ws_stream_new(), ws_stream_new_data_input(), ws_stream_new_file(), and ws_stream_ungetc(). |
|
|
Definition at line 95 of file wsstream.h. |
|
|
Definition at line 92 of file wsstream.h. |
|
|
Definition at line 87 of file wsstream.h. |
|
|
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 108 of file wsstream_data.c. References WsStreamDataInputCtxRec::data, data_close(), data_input(), WsStreamDataInputCtxRec::data_len, ws_calloc(), ws_stream_new(), WsStream, and WsStreamDataInputCtx. Referenced by ws_compile_data(). 00109 {
00110 WsStreamDataInputCtx *ctx = ws_calloc(1, sizeof(*ctx));
00111 WsStream *stream;
00112
00113 if (ctx == NULL)
00114 return NULL;
00115
00116 ctx->data = data;
00117 ctx->data_len = data_len;
00118
00119 stream = ws_stream_new(ctx, data_input, NULL, data_close);
00120
00121 if (stream == NULL)
00122 /* The stream creation failed. Close the stream context. */
00123 data_close(ctx);
00124
00125 return stream;
00126 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 206 of file wsstream_file.c. References WsStreamFileCtxRec::close_fp, file_close(), file_flush(), file_input(), file_output(), WsStreamFileCtxRec::fp, ws_calloc(), ws_stream_new(), WsStream, and WsStreamFileCtx. Referenced by ws_compile_file(). 00207 {
00208 WsStreamFileCtx *ctx = ws_calloc(1, sizeof(*ctx));
00209 WsStream *stream;
00210
00211 if (ctx == NULL)
00212 return NULL;
00213
00214 ctx->fp = fp;
00215 ctx->close_fp = close;
00216
00217 if (output)
00218 stream = ws_stream_new(ctx, file_output, file_flush, file_close);
00219 else
00220 stream = ws_stream_new(ctx, file_input, file_flush, file_close);
00221
00222 if (stream == NULL)
00223 /* The stream creation failed. Close the stream context. */
00224 file_close(ctx);
00225
00226 return stream;
00227 }
|
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 }
|