List(3)

NAME
list - procedures for managing lisp style lists in libmagicutils.a

SYNOPSIS
#include magic.h
#include list.h

LIST_ADD(item,list)

LIST_FIRST(list)

LIST_TAIL(list)

bool ListContainsP(element, list)
ClientData element;
List *list;

Void ListDealloc(list)
List *list;

Void ListDeallocC(list)
List *list;

int ListLength(list)
List *list;

ClientData ListPop(listPP)
List **listPP;

List *ListReverse(list)
List *list

DESCRIPTION
These macros and procedures permit the implementation of linked lists of arbitrary things. The lists are lisp like, i.e., list pointers are in separate structures rather than in the strucs being linked. Macros are distinguished from procedues by names that are all upper-case.

LIST_ADD(i,l) adds an item to the front of a list.

LIST_COPY(l,lnew) creates a copy of a list

LIST_FIRST references the first item on the list.

LIST_TAIL(l) references the sublist consisting of all but the first item of the list.

ListContainsP returns TRUE in the specified item is contained in the list.

int ListLength returns the length of the list.

Void ListDealloc reclaims a list (but not its contents).

Void ListDeallocC reclaims a list /fIand/fR its contents.

ListPop deletes the first item from the list, and returns it (the item).

List *ListReverse creates and returns a reversed copy of a list.

SEE ALSO
magicutils(3)