MeatAxe 2.4
Sets of Integers.

Data Structures

class  Set_t
 A Set of Integers. More...

Functions

int SetIsValid (const Set_t *s)
 Check a set.
Set_tSetAlloc ()
 Create a new set.
int SetFree (Set_t *x)
 Destroy a set.
Set_tSetDup (const Set_t *s)
 Duplicate a set.
int SetInsert (Set_t *set, long elem)
 Insert an element into a set.
int SetPrint (char *name, const Set_t *s)
 Write a Set to the Standar Output.
int SetContains (const Set_t *set, long elem)
 Check if a number is in a set.

Function Documentation

Set_t* SetAlloc ( )

Create a new set.

This function creates a new, empty set. To destroy a set, use SetFree(), not SysFree().

Returns:
Pointer to the new set or 0 on error.
int SetContains ( const Set_t set,
long  elem 
)

Check if a number is in a set.

Parameters:
setPointer to the set.
elemNumber to check.
Returns:
1 if the set contains elem, 0 if not.
Set_t* SetDup ( const Set_t s)

Duplicate a set.

Parameters:
sPointer to the set.
Returns:
Pointer to a copy of the set, or 0 on error.
int SetFree ( Set_t x)

Destroy a set.

This function frees an integer set. The argument must be a Set_t structure which has previously been allocated with SetAlloc().

Parameters:
xPointer to the set.
Returns:
0 on success, -1 on error.
int SetInsert ( Set_t set,
long  elem 
)

Insert an element into a set.

Parameters:
setPointer to the set.
elemNumber to insert.
Returns:
0 on success, -1 on error.
int SetIsValid ( const Set_t s)

Check a set.

This function checks if the argument is a valid set. If the set is o.k., the function returns 1. Otherwise, an error is signaled and, if the error handler does not terminate the program, the function returns 0.

Parameters:
sPointer to the set.
Returns:
1 if s is a valid set, 0 otherwise.
int SetPrint ( char *  name,
const Set_t s 
)

Write a Set to the Standar Output.

This function prints a set in human-readable format on the standard output. If name is different from 0, name and a "=" is printed before the set.

Parameters:
nameName to print before the set or 0.
sPointer to the set.