HTML Tidy  4.9.32
The HTACG Tidy HTML Project
buffio.h File Reference

More...

#include "platform.h"
#include "tidy.h"

Go to the source code of this file.

Data Structures

struct  _TidyBuffer
 TidyBuffer - A chunk of memory. More...
 

Functions

void TIDY_CALL tidyBufAlloc (TidyBuffer *buf, uint allocSize)
 Free current buffer, allocate given amount, reset input pointer, use the default allocator. More...
 
void TIDY_CALL tidyBufAllocWithAllocator (TidyBuffer *buf, TidyAllocator *allocator, uint allocSize)
 Free current buffer, allocate given amount, reset input pointer, use the given custom allocator. More...
 
void TIDY_CALL tidyBufAppend (TidyBuffer *buf, void *vp, uint size)
 Append bytes to buffer. More...
 
void TIDY_CALL tidyBufAttach (TidyBuffer *buf, byte *bp, uint size)
 Attach to existing buffer. More...
 
void TIDY_CALL tidyBufCheckAlloc (TidyBuffer *buf, uint allocSize, uint chunkSize)
 Expand buffer to given size. More...
 
void TIDY_CALL tidyBufClear (TidyBuffer *buf)
 Set buffer bytes to 0. More...
 
void TIDY_CALL tidyBufDetach (TidyBuffer *buf)
 Detach from buffer. More...
 
Bool TIDY_CALL tidyBufEndOfInput (TidyBuffer *buf)
 At end of buffer? More...
 
void TIDY_CALL tidyBufFree (TidyBuffer *buf)
 Free current contents and zero out. More...
 
int TIDY_CALL tidyBufGetByte (TidyBuffer *buf)
 Get byte from front of buffer. More...
 
void TIDY_CALL tidyBufInit (TidyBuffer *buf)
 Initialize data structure using the default allocator. More...
 
void TIDY_CALL tidyBufInitWithAllocator (TidyBuffer *buf, TidyAllocator *allocator)
 Initialize data structure using the given custom allocator. More...
 
int TIDY_CALL tidyBufPopByte (TidyBuffer *buf)
 Get byte from end of buffer. More...
 
void TIDY_CALL tidyBufPutByte (TidyBuffer *buf, byte bv)
 Append one byte to buffer. More...
 
void TIDY_CALL tidyBufUngetByte (TidyBuffer *buf, byte bv)
 Put a byte back into the buffer. More...
 
void TIDY_CALL tidyInitInputBuffer (TidyInputSource *inp, TidyBuffer *buf)
 Initialize a buffer input source. More...
 
void TIDY_CALL tidyInitOutputBuffer (TidyOutputSink *outp, TidyBuffer *buf)
 Initialize a buffer output sink. More...
 

Detailed Description

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

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

Definition in file buffio.h.


Data Structure Documentation

struct _TidyBuffer

Definition at line 23 of file buffio.h.

Data Fields
uint allocated

bytes allocated

TidyAllocator * allocator Memory allocator.
byte * bp Pointer to bytes.
uint next Offset of current input position.
uint size

bytes currently in use

Function Documentation

void TIDY_CALL tidyBufAlloc ( TidyBuffer *  buf,
uint  allocSize 
)
void TIDY_CALL tidyBufAllocWithAllocator ( TidyBuffer *  buf,
TidyAllocator *  allocator,
uint  allocSize 
)
void TIDY_CALL tidyBufAppend ( TidyBuffer *  buf,
void *  vp,
uint  size 
)

Expand if necessary.

void TIDY_CALL tidyBufAttach ( TidyBuffer *  buf,
byte *  bp,
uint  size 
)
void TIDY_CALL tidyBufCheckAlloc ( TidyBuffer *  buf,
uint  allocSize,
uint  chunkSize 
)

Chunk size is minimum growth. Pass 0 for default of 256 bytes.

void TIDY_CALL tidyBufClear ( TidyBuffer *  buf)
void TIDY_CALL tidyBufDetach ( TidyBuffer *  buf)

Caller must free.

Bool TIDY_CALL tidyBufEndOfInput ( TidyBuffer *  buf)
void TIDY_CALL tidyBufFree ( TidyBuffer *  buf)
int TIDY_CALL tidyBufGetByte ( TidyBuffer *  buf)

Increment input offset.

void TIDY_CALL tidyBufInit ( TidyBuffer *  buf)
void TIDY_CALL tidyBufInitWithAllocator ( TidyBuffer *  buf,
TidyAllocator *  allocator 
)
int TIDY_CALL tidyBufPopByte ( TidyBuffer *  buf)
void TIDY_CALL tidyBufPutByte ( TidyBuffer *  buf,
byte  bv 
)

Expand if necessary.

void TIDY_CALL tidyBufUngetByte ( TidyBuffer *  buf,
byte  bv 
)

Decrement input offset.

void TIDY_CALL tidyInitInputBuffer ( TidyInputSource *  inp,
TidyBuffer *  buf 
)
void TIDY_CALL tidyInitOutputBuffer ( TidyOutputSink *  outp,
TidyBuffer *  buf 
)