Functions for input and output to/from a bitstream


Functions

int bitio_i_open (void *buf, size_t size)
 This function opens a bitstream for input.
int bitio_i_input (int handle, unsigned long *val, int nbits)
 This function reads a value from a bitstream.
void bitio_i_close (int handle)
 Closes an bitstream that was opened for input.
int bitio_o_open ()
 Opens a bitstream for output.
long bitio_o_append (int handle, unsigned long val, int nbits)
 This function appends a value to a bitstream.
void bitio_o_outp (int handle, unsigned long val, int nbits, long bitpos)
 This function outputs a value to a specified position of a bitstream.
size_t bitio_o_get_size (int handle)
 Returns the size of an output-bitstream (number of bytes).
void * bitio_o_close (int handle, size_t *nbytes)
 This function closes an output-bitstream.

Function Documentation

int bitio_i_open ( void *  buf,
size_t  size 
)

This function opens a bitstream for input.

Parameters:
[in] buf Buffer to be used for input
[in] size Size of buffer.
Returns:
the function returns a handle by which the bitstream can be identified for all subsequent actions or -1 if the maximum number of opened bitstreams exceeds.
See also:
bitio_i_close, bitio_i_input, bitio_o_open

Definition at line 162 of file bitio.c.

int bitio_i_input ( int  handle,
unsigned long *  val,
int  nbits 
)

This function reads a value from a bitstream. The bitstream must have been opened by bitio_i_open.

Parameters:
[in] handle Identifies the bitstream.
[out] val Is where the input-value is stored.
[in] nbits Number of bits the value consists of.
Returns:
Returns 1 on success or 0 on a fault (number of bytes in the bitstream exceeded).
See also:
bitio_i_open, bitio_i_close, bitio_o_outp

Definition at line 207 of file bitio.c.

void bitio_i_close ( int  handle  ) 

Closes an bitstream that was opened for input

Parameters:
[in] handle Handle that identifies the bitstream.
See also:
bitio_i_open, bitio_i_input

Definition at line 254 of file bitio.c.

int bitio_o_open (  ) 

This function opens a bitstream for output.

Returns:
The return-vaule is a handle by which the bit-stream can be identified for all subesquent actions or -1 if there is no unused bitstream available.

Definition at line 271 of file bitio.c.

long bitio_o_append ( int  handle,
unsigned long  val,
int  nbits 
)

This function appends a value to a bitstream which was opened by bitio_o_open.

Parameters:
[in] handle Indicates the bitstream for appending.
[in] val Value to be output.
[in] nbits Number of bits of val to be output to the stream.
Note:
nbits must be less than sizeof (long)
Returns:
The return-value is the bit-position of the value in the bit-stream, or -1 on a fault.
See also:
bitio_o_open, bitio_o_close, bitio_o_outp

Definition at line 322 of file bitio.c.

void bitio_o_outp ( int  handle,
unsigned long  val,
int  nbits,
long  bitpos 
)

This function outputs a value to a specified position of a bitstream.

Parameters:
[in] handle Indicates the bitstream for output.
[in] val Value to be output.
[in] nbits Number of bits of val to be output to the stream.
[in] bitpos bitposition of the value in the bitstream.
Note:
nbits must be less then sizeof (long)
See also:
bitio_o_open, bitio_o_close, bitio_o_append, bitio_i_input

Definition at line 366 of file bitio.c.

size_t bitio_o_get_size ( int  handle  ) 

This function returns the size of an output-bitstream (number of bytes)

Parameters:
[in] handle Identifies the bitstream
Returns:
Size of the bitstream.
See also:
bitio_o_open, bitio_o_outp, bitio_o_append

Definition at line 421 of file bitio.c.

void* bitio_o_close ( int  handle,
size_t *  nbytes 
)

This function closes an output-bitstream identified by handle and returns a pointer to the memory-area holding the bitstream.

Parameters:
[in] handle Bit-stream-handle
[out] nbytes number of bytes in the bitstream.
Returns:
The funcion returns a pointer to the memory-area holding the bit-stream or NULL if an invalid handle was specified. The memory area must be freed by the calling function.
See also:
bitio_o_open, bitio_o_outp, bitio_o_append, bitio_i_close

Definition at line 448 of file bitio.c.


Generated on Tue Dec 18 16:52:45 2007 for OPERA BUFR software by  doxygen 1.5.4