ASCIIHEADER(3SP)

NAME
ReadHeader, WriteHeader, FreeHeader, FindHeaderValue, GetValueArray - read/write AsciiHeaders

SYNOPSIS

#include <speech.h>

AsciiHeader ReadHeader (FILE *fp)

int WriteHeader (FILE *fp, AsciiHeader *hdr)

void FreeHeader (AsciiHeader *hdr)

char *FindHeaderValue (AsciiHeader *hdr, char *key)

char **GetValueArray (AsciiHeader *hdr, char *key, int *len)

DESCRIPTION
The routines describe here are used to read, write, and find values in AsciiHeaders.

The incore AsciiHeader structure and array of:

    struct asciihdr {
        char *ah_key;
        int *ah_vlen;
        char **ah_value;
    };
    typedef struct asciihdr AsciiHdr;

The ah_value field is an array of character pointers, which point to the string values for ah_key. ah_vlen holds the length of the ah_value array.

ReadHeader reads an AsciiHeader from stream fp and returns a pointer to the header. The space for the header is allocated using malloc(3) and should be freed using FreeHeader(3SP).

WriteHeader writes the header pointed to by hdr to the stream fp.

FreeHeader is used to free the spaced used by the header returned by ReadHeader.

FindHeaderValue returns the first value form the value array for key in hdr.

GetValueArray returns a pointer to the value array for key in hdr. The length of the array is placed in len.

DIAGNOSTICS

ReadHeader() returns a a pointer to the header if successfuly, otherwise a NULL pointer is returned and ErrorString is set. WriteHeader() returns a positive number on success, otherwise a negative number is returned and ErrorString is set.

FindHeader() returns a charater pointer to the first array value of the value array for key if key exists in hdr, otherwise a NULL pointer is returned. GetValueArray() returns a pointer to and array of character pointers which are the values for key if key exists in hdr, otherwise a NULL pointer is returned.

SEE ALSO
IntArray2StrArray(3SP), StrArray2IntArray(3SP), FloatArray2StrArray(3SP), Str2StrArray(3SP), FreeStrArray(3SP), StrArray2FloatArray(3SP), fopen(3), malloc(3), free(3)

BUGS

AUTHORS
Center for Spoken Language Understanding
Department of Computer Science and Engineering
Oregon Graduate Institute of Science & Technology