1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>buffio.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.17 -->
<h1>buffio.h</h1><a href="buffio_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="preprocessor">#ifndef __BUFFIO_H__</span>
00002 <span class="preprocessor"></span><span class="preprocessor">#define __BUFFIO_H__</span>
00003 <span class="preprocessor"></span><span class="comment"></span>
00004 <span class="comment">/** @file buffio.h - Treat buffer as an I/O stream.</span>
00005 <span class="comment"></span>
00006 <span class="comment"> (c) 1998-2002 (W3C) MIT, INRIA, Keio University</span>
00007 <span class="comment"> See tidy.h for the copyright notice.</span>
00008 <span class="comment"></span>
00009 <span class="comment"> CVS Info :</span>
00010 <span class="comment"></span>
00011 <span class="comment"> $Author: creitzel $ </span>
00012 <span class="comment"> $Date: 2003/02/16 19:33:06 $ </span>
00013 <span class="comment"> $Revision: 1.2 $ </span>
00014 <span class="comment"></span>
00015 <span class="comment"> Requires buffer to automatically grow as bytes are added.</span>
00016 <span class="comment"> Must keep track of current read and write points.</span>
00017 <span class="comment"></span>
00018 <span class="comment">*/</span>
00019
00020 <span class="preprocessor">#include "platform.h"</span>
00021 <span class="preprocessor">#include "<a class="code" href="tidy_8h.html">tidy.h</a>"</span>
00022
00023 <span class="preprocessor">#ifdef __cplusplus</span>
00024 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
00025 <span class="preprocessor">#endif</span>
00026 <span class="preprocessor"></span><span class="comment"></span>
00027 <span class="comment">/** TidyBuffer - A chunk of memory */</span>
00028 TIDY_STRUCT
<a name="l00029"></a><a class="code" href="struct__TidyBuffer.html">00029</a> <span class="keyword">struct </span><a class="code" href="struct__TidyBuffer.html">_TidyBuffer</a>
00030 {
<a name="l00031"></a><a class="code" href="struct__TidyBuffer.html#m0">00031</a> byte* <a class="code" href="struct__TidyBuffer.html#m0">bp</a>; <span class="comment">/**< Pointer to bytes */</span>
<a name="l00032"></a><a class="code" href="struct__TidyBuffer.html#m1">00032</a> uint <a class="code" href="struct__TidyBuffer.html#m1">size</a>; <span class="comment">/**< # bytes currently in use */</span>
<a name="l00033"></a><a class="code" href="struct__TidyBuffer.html#m2">00033</a> uint <a class="code" href="struct__TidyBuffer.html#m2">allocated</a>; <span class="comment">/**< # bytes allocated */</span>
<a name="l00034"></a><a class="code" href="struct__TidyBuffer.html#m3">00034</a> uint <a class="code" href="struct__TidyBuffer.html#m3">next</a>; <span class="comment">/**< Offset of current input position */</span>
00035 };
00036 <span class="comment"></span>
00037 <span class="comment">/** Zero out data structure */</span>
00038 TIDY_EXPORT <span class="keywordtype">void</span> <a class="code" href="buffio_8h.html#a0">tidyBufInit</a>( <a class="code" href="struct__TidyBuffer.html">TidyBuffer</a>* buf );
00039 <span class="comment"></span>
00040 <span class="comment">/** Free current buffer, allocate given amount, reset input pointer */</span>
00041 TIDY_EXPORT <span class="keywordtype">void</span> <a class="code" href="buffio_8h.html#a1">tidyBufAlloc</a>( <a class="code" href="struct__TidyBuffer.html">TidyBuffer</a>* buf, uint allocSize );
00042 <span class="comment"></span>
00043 <span class="comment">/** Expand buffer to given size. </span>
00044 <span class="comment">** Chunk size is minimum growth. Pass 0 for default of 256 bytes.</span>
00045 <span class="comment">*/</span>
00046 TIDY_EXPORT <span class="keywordtype">void</span> <a class="code" href="buffio_8h.html#a2">tidyBufCheckAlloc</a>( <a class="code" href="struct__TidyBuffer.html">TidyBuffer</a>* buf,
00047 uint allocSize, uint chunkSize );
00048 <span class="comment"></span>
00049 <span class="comment">/** Free current contents and zero out */</span>
00050 TIDY_EXPORT <span class="keywordtype">void</span> <a class="code" href="buffio_8h.html#a3">tidyBufFree</a>( <a class="code" href="struct__TidyBuffer.html">TidyBuffer</a>* buf );
00051 <span class="comment"></span>
00052 <span class="comment">/** Set buffer bytes to 0 */</span>
00053 TIDY_EXPORT <span class="keywordtype">void</span> <a class="code" href="buffio_8h.html#a4">tidyBufClear</a>( <a class="code" href="struct__TidyBuffer.html">TidyBuffer</a>* buf );
00054 <span class="comment"></span>
00055 <span class="comment">/** Attach to existing buffer */</span>
00056 TIDY_EXPORT <span class="keywordtype">void</span> <a class="code" href="buffio_8h.html#a5">tidyBufAttach</a>( <a class="code" href="struct__TidyBuffer.html">TidyBuffer</a>* buf, <span class="keywordtype">void</span>* bp, uint size );
00057 <span class="comment"></span>
00058 <span class="comment">/** Detach from buffer. Caller must free. */</span>
00059 TIDY_EXPORT <span class="keywordtype">void</span> <a class="code" href="buffio_8h.html#a6">tidyBufDetach</a>( <a class="code" href="struct__TidyBuffer.html">TidyBuffer</a>* buf );
00060
00061 <span class="comment"></span>
00062 <span class="comment">/** Append bytes to buffer. Expand if necessary. */</span>
00063 TIDY_EXPORT <span class="keywordtype">void</span> <a class="code" href="buffio_8h.html#a7">tidyBufAppend</a>( <a class="code" href="struct__TidyBuffer.html">TidyBuffer</a>* buf, <span class="keywordtype">void</span>* vp, uint size );
00064 <span class="comment"></span>
00065 <span class="comment">/** Append one byte to buffer. Expand if necessary. */</span>
00066 TIDY_EXPORT <span class="keywordtype">void</span> <a class="code" href="buffio_8h.html#a8">tidyBufPutByte</a>( <a class="code" href="struct__TidyBuffer.html">TidyBuffer</a>* buf, byte bv );
00067 <span class="comment"></span>
00068 <span class="comment">/** Get byte from end of buffer */</span>
00069 TIDY_EXPORT <span class="keywordtype">int</span> <a class="code" href="buffio_8h.html#a9">tidyBufPopByte</a>( <a class="code" href="struct__TidyBuffer.html">TidyBuffer</a>* buf );
00070
00071 <span class="comment"></span>
00072 <span class="comment">/** Get byte from front of buffer. Increment input offset. */</span>
00073 TIDY_EXPORT <span class="keywordtype">int</span> <a class="code" href="buffio_8h.html#a10">tidyBufGetByte</a>( <a class="code" href="struct__TidyBuffer.html">TidyBuffer</a>* buf );
00074 <span class="comment"></span>
00075 <span class="comment">/** At end of buffer? */</span>
00076 TIDY_EXPORT Bool <a class="code" href="buffio_8h.html#a11">tidyBufEndOfInput</a>( <a class="code" href="struct__TidyBuffer.html">TidyBuffer</a>* buf );
00077 <span class="comment"></span>
00078 <span class="comment">/** Put a byte back into the buffer. Decrement input offset. */</span>
00079 TIDY_EXPORT <span class="keywordtype">void</span> <a class="code" href="buffio_8h.html#a12">tidyBufUngetByte</a>( <a class="code" href="struct__TidyBuffer.html">TidyBuffer</a>* buf, byte bv );
00080
00081
00082 <span class="comment">/**************</span>
00083 <span class="comment"> TIDY</span>
00084 <span class="comment">**************/</span>
00085
00086 <span class="comment">/* Forward declarations</span>
00087 <span class="comment">*/</span>
00088 <span class="comment"></span>
00089 <span class="comment">/** Initialize a buffer input source */</span>
00090 TIDY_EXPORT <span class="keywordtype">void</span> <a class="code" href="buffio_8h.html#a13">initInputBuffer</a>( <a class="code" href="group__IO.html#a3">TidyInputSource</a>* inp, <a class="code" href="struct__TidyBuffer.html">TidyBuffer</a>* buf );
00091 <span class="comment"></span>
00092 <span class="comment">/** Initialize a buffer output sink */</span>
00093 TIDY_EXPORT <span class="keywordtype">void</span> <a class="code" href="buffio_8h.html#a14">initOutputBuffer</a>( <a class="code" href="group__IO.html#a5">TidyOutputSink</a>* outp, <a class="code" href="struct__TidyBuffer.html">TidyBuffer</a>* buf );
00094
00095 <span class="preprocessor">#ifdef __cplusplus</span>
00096 <span class="preprocessor"></span>}
00097 <span class="preprocessor">#endif</span>
00098 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* __BUFFIO_H__ */</span>
</pre></div><hr><address style="align: right;"><small>Generated on Fri Dec 13 18:27:08 2002 for HTML Tidy by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0
width=110 height=53></a>1.2.17 </small></address>
</body>
</html>
|