tpl_util - Tuple Utilities

The TPL_UTIL package is used for quickly creating N-tuples of information, where each element of a tuple is represented as a (void *) pointer:

    #include  "tpl_util.h"			-- Tuple utilities.
    Tuple  tuple ;
    tuple = tplCreate (3,
                       (void *) thisInfo,
                       (void *) thatInfo,
                       (void *) otherInfo) ;

The following code fragments retrieves and prints out the individual elements in a tuple:

    #include  <stdio.h>				-- Standard I/O definitions.
    int  i ;
    for (i = 0 ;  i < tplArity (tuple) ;  i++)
        printf ("Element %d: %p\n", i, tplGet (tuple, i)) ;

When a tuple is no longer needed, it should be deleted:

    tplDestroy (tuple) ;

Public Procedures

tplArity() - returns the number of elements in a tuple.
tplCreate() - creates a tuple of N elements.
tplDestroy() - deletes a tuple.
tplGet() - gets an individual element from a tuple.
tplSet() - sets the value of an individual element in a tuple.

Source Files


(See libgpl for the complete source, including support routines and build files.)

Alex Measday  /  E-mail