ADC Home > Reference Library > Reference > Darwin > Miscellaneous User Space API Reference

 


buffio.h - Treat buffer as an I/O stream.

Includes:

Introduction



(c) 1998-2004 (W3C) MIT, ERCIM, Keio University See tidy.h for the copyright notice.

CVS Info :

$Author: rbraun $ $Date: 2004/05/04 20:05:14 $ $Revision: 1.1.1.1 $

Requires buffer to automatically grow as bytes are added. Must keep track of current read and write points.



Functions

initInputBuffer
initOutputBuffer
tidyBufAlloc
tidyBufAppend
tidyBufAttach
tidyBufCheckAlloc
tidyBufClear
tidyBufDetach
tidyBufEndOfInput
tidyBufFree
tidyBufGetByte
tidyBufInit
tidyBufPopByte
tidyBufPutByte
tidyBufUngetByte

initInputBuffer


TIDY_EXPORT void initInputBuffer(
    TidyInputSource*inp,
    TidyBuffer*buf );  
Discussion

Initialize a buffer input source


initOutputBuffer


TIDY_EXPORT void initOutputBuffer(
    TidyOutputSink*outp,
    TidyBuffer*buf );  
Discussion

Initialize a buffer output sink


tidyBufAlloc


TIDY_EXPORT void tidyBufAlloc(
    TidyBuffer*buf,
    uint allocSize );  
Discussion

Free current buffer, allocate given amount, reset input pointer


tidyBufAppend


TIDY_EXPORT void tidyBufAppend(
    TidyBuffer*buf,
    void*vp,
    uint size );  
Discussion

Append bytes to buffer. Expand if necessary.


tidyBufAttach


TIDY_EXPORT void tidyBufAttach(
    TidyBuffer*buf,
    byte*bp,
    uint size );  
Discussion

Attach to existing buffer


tidyBufCheckAlloc


TIDY_EXPORT void tidyBufCheckAlloc(
    TidyBuffer*buf, 
    uint allocSize,
    uint chunkSize );  
Discussion

Expand buffer to given size. ** Chunk size is minimum growth. Pass 0 for default of 256 bytes.


tidyBufClear


TIDY_EXPORT void tidyBufClear(
    TidyBuffer*buf );  
Discussion

Set buffer bytes to 0


tidyBufDetach


TIDY_EXPORT void tidyBufDetach(
    TidyBuffer*buf );  
Discussion

Detach from buffer. Caller must free.


tidyBufEndOfInput


TIDY_EXPORT Bool tidyBufEndOfInput(
    TidyBuffer*buf );  
Discussion

At end of buffer?


tidyBufFree


TIDY_EXPORT void tidyBufFree(
    TidyBuffer*buf );  
Discussion

Free current contents and zero out


tidyBufGetByte


TIDY_EXPORT int tidyBufGetByte(
    TidyBuffer*buf );  
Discussion

Get byte from front of buffer. Increment input offset.


tidyBufInit


TIDY_EXPORT void tidyBufInit(
    TidyBuffer*buf );  
Discussion

Zero out data structure


tidyBufPopByte


TIDY_EXPORT int tidyBufPopByte(
    TidyBuffer*buf );  
Discussion

Get byte from end of buffer


tidyBufPutByte


TIDY_EXPORT void tidyBufPutByte(
    TidyBuffer*buf,
    byte bv );  
Discussion

Append one byte to buffer. Expand if necessary.


tidyBufUngetByte


TIDY_EXPORT void tidyBufUngetByte(
    TidyBuffer*buf,
    byte bv );  
Discussion

Put a byte back into the buffer. Decrement input offset.

Structs and Unions


_TidyBuffer


TIDY_STRUCT struct _TidyBuffer { 
    byte*bp; /**< Pointer to bytes */
    uint size; /**< # bytes currently in use */
    uint allocated; /**< # bytes allocated */
    uint next; /**< Offset of current input position */
};  
Discussion

TidyBuffer - A chunk of memory


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.
Last Updated: 2006-06-20