DESCRIPTOR_FUNCS(3)

NAME
lInit, lNm2Str (_lNm2Str), lStr2Nm (_lStr2Nm), lCountDescr, lCopyDescr, lGetPosInDescr, lDumpDescr, lUndumpDescr, lWriteDescr

generic list manipulation and information functions

SYNOPSIS
#include "cull.h"

void lInit( lNameSpace *namev );

char* lNm2Str( int nm );

char* _lNm2Str( lNameSpace *nsp, int nm );

int lStr2Nm( char *str );

int _lStr2Nm( lNameSpace *nsp, char *str );

int lCountDescr( lDescr *descriptor );

lDescr* lCopyDescr( lDescr *descriptor );

int lGetPosInDescr( lDescr *descriptor, int nm );

void lWriteDescr( lDescr *descriptor );

int lDumpDescr(
    FILE *file,
    lDescr *descriptor,
    int indent
);

lDescr* lUndumpDescr( FILE *file );

DESCRIPTION

lInit
    initializes the name to string conversion. Names are represented by unique numbers which are mapped to their corresponding strings. The function argument is a pointer to a lNameSpace array.

lNm2Str, _lNm2Str
    converts the field names (represented by numbers) to the corresponding strings. If the NameSpace has been initialized with lInit() the corresponding string is returned, otherwise the string "Nameindex = n" is returned, where n is replaced by the field number representing nm. _lNm2Str converts the field names (represented by numbers) to the corresponding strings. A NameSpace is delivered explicitly. The corresponding string is returned, otherwise the string "Nameindex = n" is returned, where n is replaced by the field number representing nm.

lStr2Nm, _lStr2Nm
    converts the string field names to the corresponding field id's. If the NameSpace has been initialized with lInit() the corresponding field id is returned, otherwise NoName is returned. _lStr2Nm converts the string field names to the corresponding field id's. A NameSpace is delivered explicitly. The corresponding field id is returned, if it can be found in the NameSpace. Otherwise the function returns NoName.

lCountDescr
    count the number of fields specified in the descriptor. The descriptor is delivered as function argument. The number of fields is returned.

lCopyDescr
    duplicate the specified descriptor. The descriptor is delivered as function argument. A pointer to the copied descriptor is returned, NULL otherwise.

lGetPosInDescr
    get the position of the field named nm from the descriptor. If the field named nm is not contained in the descriptor -1 is returned.

lDumpDescr
    dump the list descriptor in ASCII format to a file. The first argument is a FILE pointer of the dump file, the second argument is the descriptor that shall be dumped and the third argument is the number of indentation units for formatting purposes. This function is normally used only by

lUndumpDescr
    undump the list descriptor from a dump file. A FILE pointer to the dump file is delivered as function argument. If no error occurs a pointer to the list descriptor is returned, otherwise NULL is returned. This function is normally used only by

lWriteDescr
    writes a list descriptor to stdout. This function is used for debugging only.

RETURN VALUES
The functions return -1 or NULL in case of error, otherwise 0 or a valid pointer are returned.

ERRORS
The following errors can occur in the above listed functions. The functions which are affected by a special error are enumerated in parentheses.

LENAMEOUT
    This error occurs, if the name is out of namespace ranges. (lNm2Str)

LEDESCRNULL
    The descriptor argument is NULL. (lCountDescr, lWriteDescr, lDumpDescr, lGetPosInDescr)

LEFILENULL
    The file pointer delivered is NULL. (lDumpDescr, lUndumpDescr)

LENAMENOT
    The specified name is not a field of the specified descriptor. (lGetPosInDescr)

LEFIELDREAD
    Reading a field value from a dump file failed. (lUndumpDescr)

LEFGETDESCR
    Reading a descriptor pair from a dump file failed. (lUndumpDescr)

LESYNTAX
    A syntax error occurred (missing opening or closing brackets). (lUndumpDescr)

SEE ALSO

COPYRIGHT
See for a full statement of rights and permissions.