NOTE:
This project is no longer being maintained: it was developed for my masters thesis, which was completed in early 1997. I still, however, welcome any questions or comments that people may have.

[Home] [ToC] [Up] [Prev] [Next]


iHTML Library Services

Buffers

The iHTML library buffer services provide operations on a data type called a "IHBuffer," allowing for the collection and manipulation of blocks of arbitrary byte data.


Types

IHBufferP
Synopsis
A data buffer, for storing and passing binary data streams.
Definition
typedef struct ih_buffer {
  int length;
  char* buffer;
} *IHBufferP;
See Also
IH_AllocBuffer()

This type is used to hold and manipulate arbitrary binary data. Its two public fields are read-only, defining the current number of bytes in the buffer and pointing to a block of memory that can be examined for their values.


Functions

IH_AllocBuffer
Synopsis
IHBufferP buffer = IH_AllocBuffer(int size, const char* data)
Arguments
(int) size
Initial size of the buffer.
(const char*) data
Initial data in the buffer.
Return
(IHBufferP) A newly allocated data buffer.
See Also
IHBufferP

This routine allocates a new IHBufferP, which is a structure used to hold arbitrary binary data. The argument size indicates the initial size of the buffer, and data is the initial data for it. Possible values for these parameters are:

size=0, data=NULL
Allocate an empty buffer.
size=-1, data=string
Allocate a buffer containing the given string.
size=x, data=pointer
Allocate buffer of size x, initially filled with data.

IH_AppendBuffer
Synopsis
IHBufferP buffer = IH_AppendBuffer(IHBufferP old, int size, const char* data)
Arguments
(IHBufferP) old
The original buffer.
(int) size
Amount of data to append to buffer.
(const char*) data
Values of data to append to buffer.
Return
(IHBufferP) The new data buffer.
See Also
IHBufferP, IH_AllocBuffer()

Append new data to an existing IHBufferP. The parameters operate the same as those for IH_AllocBuffer(); this function can be thought of as allocating a new buffer using the second and third parameters, and appending it to the buffer specified by the first.

The return value is the new buffer -- note that this may be different than the originally supplied buffer; always update to the returned buffer pointer.

IH_FreeBuffer
Synopsis
void IH_FreeBuffer(IHBufferP buffer)
Arguments
(IHBufferP) buffer
The data buffer to deallocate.
Return
nothing.
See Also
IHBufferP, IH_AllocBuffer()

Deallocate a data buffer that was previously allocated with BR_AllocBuffer().


[Home] [ToC] [Up] [Prev] [Next]

_________.oo_Q_Q_oo.____________________________________________
Dianne Kyra Hackborn <hackbod@angryredplanet.com>
Last modified: Tue Oct 8 04:04:04 PDT 1996

This web page and all material contained herein is Copyright (c) 1997 Dianne Hackborn, unless otherwise noted. All rights reserved.