# buffio.h File Reference

Go to the source code of this file.

## Data Structures
struct | _TidyBuffer
## Functions
void | tidyBufInit (TidyBuffer *buf)
void | tidyBufAlloc (TidyBuffer *buf, uint allocSize)
void | tidyBufCheckAlloc (TidyBuffer *buf, uint allocSize, uint chunkSize)
void | tidyBufFree (TidyBuffer *buf)
void | tidyBufClear (TidyBuffer *buf)
void | tidyBufAttach (TidyBuffer *buf, void *bp, uint size)
void | tidyBufDetach (TidyBuffer *buf)
void | tidyBufAppend (TidyBuffer *buf, void *vp, uint size)
void | tidyBufPutByte (TidyBuffer *buf, byte bv)
int | tidyBufPopByte (TidyBuffer *buf)
int | tidyBufGetByte (TidyBuffer *buf)
Bool | tidyBufEndOfInput (TidyBuffer *buf)
void | tidyBufUngetByte (TidyBuffer *buf, byte bv)
void | initInputBuffer (TidyInputSource *inp, TidyBuffer *buf)
void | initOutputBuffer (TidyOutputSink *outp, TidyBuffer *buf)

## Detailed Description

- Treat buffer as an I/O stream.

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

CVS Info :

Author:
  creitzel

Date:
  2002/10/15 19:46:52

Revision:
  1.1.2.3

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

## Function Documentation

void tidyBufInit | ( | TidyBuffer * | buf | ) |

| Zero out data structure

void tidyBufAlloc | ( | TidyBuffer * | buf,
|  | uint | allocSize
| ) |

| Free current buffer, allocate given amount, reset input pointer

void tidyBufCheckAlloc | ( | TidyBuffer * | buf,
|  | uint | allocSize,
|  | uint | chunkSize
| ) |

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

void tidyBufFree | ( | TidyBuffer * | buf | ) |

| Free current contents and zero out

void tidyBufClear | ( | TidyBuffer * | buf | ) |

| Set buffer bytes to 0

void tidyBufAttach | ( | TidyBuffer * | buf,
|  | void * | bp,
|  | uint | size
| ) |

| Attach to existing buffer

void tidyBufDetach | ( | TidyBuffer * | buf | ) |

| Detach from buffer. Caller must free.

void tidyBufAppend | ( | TidyBuffer * | buf,
|  | void * | vp,
|  | uint | size
| ) |

| Append bytes to buffer. Expand if necessary.

void tidyBufPutByte | ( | TidyBuffer * | buf,
|  | byte | bv
| ) |

| Append one byte to buffer. Expand if necessary.

int tidyBufPopByte | ( | TidyBuffer * | buf | ) |

| Get byte from end of buffer

int tidyBufGetByte | ( | TidyBuffer * | buf | ) |

| Get byte from front of buffer. Increment input offset.

Bool tidyBufEndOfInput | ( | TidyBuffer * | buf | ) |

| At end of buffer?

void tidyBufUngetByte | ( | TidyBuffer * | buf,
|  | byte | bv
| ) |

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

void initInputBuffer | ( | TidyInputSource * | inp,
|  | TidyBuffer * | buf
| ) |

| Initialize a buffer input source

void initOutputBuffer | ( | TidyOutputSink * | outp,
|  | TidyBuffer * | buf
| ) |

| Initialize a buffer output sink