Reference¶
Templates¶
This section describes the templates and their parameters. Each template consists of a header and an implementation. Headers are named ‘container-decl.h’ and implementations are named ‘container-impl-c.h’. For example ‘map-decl.h’ and ‘map-impl-c.h’.
The templates require a set of #define values to be set, and that will be used to generate code for a specific container type. An example implementation list of char * is:
/* list-str.h */
#define TYPE char *
#define NAME str
#define UNAME STR
#include <c-craft/list-decl.h>
#undef TYPE
#undef NAME
#undef UNAME
/* list-str.c */
#include "list-str.h"
#define TYPE char *
#define NAME str
#define UNAME STR
#include <c-craft/list-impl-c.h>
#undef TYPE
#undef NAME
#undef UNAME
Parameters for this example are TYPE, NAME and UNAME.
Container API¶
Conventions¶
This section describes the generic container implementations. These could by any type, depending on the parameters used in the generation. This reference substitutes the word ‘type’ or ‘TYPE’ in appropriate casing, rather than assume any particular type implementation. For maps there are two types, one for the key and one for the value. The value comes first, so a map of doubles keyed by int is created with map_double_int_create(), and in the reference is shown as map_type_create().
List¶
Template Generation¶
| Declarations File: | |
|---|---|
| list-decl.h | |
| Implementation File: | |
| list-impl-c.h | |
Parameters
TYPE: The type of element contained. NAME: The disambiguating name element used in function name definitions UNAME: The disambiguating name element used in data type declarations
Examples
#define TYPE void *
#define NAME ptr
#define UNAME PTR
...
LIST_PTR lp = list_ptr_create(mem, 1024);
void *data = get_some_data();
list_ptr_append(lp, data);
Data Types¶
-
typedef struct link_type *
LINK_TYPE¶ A link in a linked list as an abstract data type.
-
typedef struct list_type *
LIST_TYPE¶ A list as an abstract data type.
Functions¶
-
void
list_type_append(LIST_TYPE list, TYPE item)¶ Append an element at the end of a list.
- Parameters
list: The list being accessed.item: The item to append.
-
void
list_type_clear(LIST_TYPE list)¶ Clear all elements from the list.
- Parameters
list: The list to be cleared.
-
size_t
list_type_count(LIST_TYPE list)¶ Count the number of elements in the list.
- Return
- A count of the number of elements.
- Remark
- This function may not perform well if there are many elements.
- Parameters
list: The list being accessed.
-
LIST_TYPE
list_type_create(MEM_SCOPE scope)¶ Create a new list.
- Return
- A new empty list.
- Parameters
scope: A memory scope to own the list.
-
TYPE
list_type_find(LIST_TYPE list, TYPE item, TYPE not_found, int (*cmp)(TYPE, TYPE))¶ Search a list to find an element.
- Return
- The element, or the ‘not_found’ value if not found.
- Remark
- This function may not perform well if there are many elements.
- Parameters
list: The list being accessed.item: The element being searched for.not_found: A value to be returned to indicate the item was not found.cmp: A comparison function used to test each element in the list.
-
TYPE
list_type_first(LIST_TYPE list, TYPE not_found)¶ Get the first element in a list.
- Return
- The first element, or a not_found value if no element exists.
- Remark
- For many types a NULL or zero return is a useful way to distinguish between a valid or non-existent element.
- Parameters
list: The list being accessed.not_found: A value to be returned if the list is empty.
-
LIST_TYPE
list_type_from_array(MEM_SCOPE scope, TYPE *array, size_t len)¶ Create a list from an existing array.
- Return
- A LIST_TYPE that maybe used in subsequent list calls.
- Parameters
scope: A memory scope to own the list.array: The array to copy.len: The number of elements in the array.
-
TYPE
list_type_get(LIST_TYPE list, int index)¶ Get the element at an index in a list.
- Return
- The element at the given index.
- Remark
- Attempting to access an index that does not exist will assert in DEBUG mode and yield unpredictable results in RELEASE mode. Get does not affect any currency established with list_type_first and list_type_next.
- Remark
- Access by index may not perform well if there are many elements.
- Parameters
list: The list being accessed.index: The index to get the element from.
-
void
list_type_insert(LIST_TYPE list, TYPE item)¶ Insert an element at the front of a list.
- Parameters
list: The list being accessed.item: The element to insert.
-
void
list_type_insert_at(LIST_TYPE list, int index, TYPE item)¶ Insert an element at a given index in a list.
- Remark
- Attempting to access an index that does not exist will assert in DEBUG mode and yield unpredictable results in RELEASE mode. Get does not affect any currency established with list_type_first and list_type_next.
- Remark
- Access by index may not perform well if there are many elements.
- Parameters
list: The list being accessed.index: The index to insert the element at.item: The element to insert.
-
TYPE
list_type_next(LIST_TYPE list, TYPE not_found)¶ Get the next element in a list.
- Return
- The next element, or a zero element if no element exists.
- Remark
- For many types a zero return is a useful way to distinguish between a valid or non-existent element. Where it is not use list_type_count to determine if elements are available.
- Parameters
list: The list being accessed.not_found: A value to be returned if the list is empty.
-
TYPE
list_type_remove(LIST_TYPE list)¶ Remove the current element from a list.
- Return
- The element being removed.
- Remark
- The list_type_remove function is only appropriate during list iteration, when list_type_first and/or list_type_next have been called to establish a currency. Use at any other time will yield unpredictable results.
- Parameters
list: The list being accessed.
-
TYPE
list_type_remove_at(LIST_TYPE list, int index)¶ Remove an element from a given index.
- Return
- The element being removed.
- Remark
- Attempting to access an index that does not exist will assert in DEBUG mode and yield unpredictable results in RELEASE mode. Get should not affect any currency established with list_type_first and list_type_next.
- Remark
- Access by index may not perform well if there are many elements.
- Parameters
list: The list being accessed.index: The index to remove the element from.
-
TYPE
list_type_replace(LIST_TYPE list, TYPE item)¶ Replace the current element in a list.
- Return
- The element being replaced.
- Remark
- The list_type_replace function is only appropriate during list iteration, when list_type_first and/or list_type_next have been called to establish a currency. Use at any other time will yield unpredictable results.
- See
- list_type_get(), list_type_set()
- Parameters
list: The list being accessed.item: The element to replace with.
-
void
list_type_set(LIST_TYPE list, int index, TYPE item)¶ Set the element at an index in a list.
- Remark
- Attempting to access an index that does not exist will assert in DEBUG mode and yield unpredictable results in RELEASE mode. Set should not affect any currency established with list_type_first and list_type_next.
- Remark
- Access by index may not perform well if there are many elements.
- Parameters
list: The list being accessed.index: The index to set the element.item: The element to set.
-
TYPE *
list_type_to_array(LIST_TYPE list, TYPE not_found)¶ Convert to an array of all elements.
- Return
- A standard C array of all elements.
- Remark
- This function may not perform well if there are many elements.
- Parameters
list: The list being accessed.not_found: A value appended to to signify the array end.
-
char *
list_str_to_string(LIST_STR str, char c)¶ Concatenate to a delimited string of all elements.
- Return
- A char * concatenation of all elements.
- Remark
- This function is specific to LIST_STR only.
- Parameters
str: The list being accessed.c: A character to separate each string with.
-
LIST_TYPE
list_type_where(LIST_TYPE list, int (*func)(TYPE, TYPE), TYPE arg, )¶ Create a new list by filtering a list using supplied criteria.
- Return
- A new list with the filtered elements.
- Remark
- This function uses the supplied comparison function to test each member in turn and adds to the new list only if the function returns TRUE.
- Remark
- This function may not perform well if there are many elements.
- See
- list_type_to_array().
- Parameters
list: The list being accessed.func: A comparison function used to test each element in the list.arg: The argument to supply for the test function.
Vector¶
Template Generation¶
| Declarations File: | |
|---|---|
| vector-decl.h | |
| Implementation File: | |
| vector-impl-c.h | |
Parameters
TYPE: The type of element contained. NAME: The disambiguating name element used in function name definitions UNAME: The disambiguating name element used in data type declarations
Examples
#define TYPE char *
#define NAME str
#define UNAME STR
...
VECTOR_STR vp = vector_str_create(mem, 16);
vector_str_append(vp, "Hello, collections library !");
Functions¶
-
void
vector_type_append(VECTOR_TYPE vector, TYPE item)¶ Append an element at the end of a vector.
- Remark
- The vector is expanded if necessary, and this will cause a move of all the data.
- Parameters
vector: The vector being accessed.item: The element to append.
-
size_t
vector_type_count(VECTOR_TYPE vector)¶ Count the number of elements in the vector.
- Return
- The number of elements in the vector.
- Parameters
vector: The vector being accessed.
-
VECTOR_TYPE
vector_type_create(MEM_SCOPE scope, size_t capacity)¶ Create a new vector.
- Return
- A VECTOR_TYPE that maybe used in subsequent vector calls.
- Remark
- The capacity is the number of elements that can be appended before the vector is expanded.
- See
- vector_type_from_array()
- Parameters
scope: A memory scope.capacity: The initial number of elements in the vector.
-
TYPE
vector_type_find(VECTOR_TYPE vector, TYPE item, TYPE not_found, int (*cmp)(TYPE, TYPE))¶ Search a vector to find an element.
- Return
- The element, or not_found value if not found.
- Remark
- This function may not perform well if there are many items in the vector.
- Parameters
vector: The vector being accessed.item: The element being searched for.not_found: A value to be returned to indicate the item was not found.cmp: A comparison function used to test each element in the vector.
-
VECTOR_TYPE
vector_type_from_array(MEM_SCOPE scope, TYPE *array, size_t len)¶ Create a new vector loaded with the array contents.
- Return
- A VECTOR_TYPE that maybe used in subsequent vector calls.
- See
- vector_type_create()
- Parameters
scope: A memory scope.array: The array to copy.len: The number of elements in the array.
-
TYPE
vector_type_get(VECTOR_TYPE vector, int index)¶ Get the element at an index in a vector.
- Return
- The element at the given index.
- See
- vector_type_set().
- Parameters
vector: The vector being accessed.index: The index to get the element from.
-
void
vector_type_insert(VECTOR_TYPE vector, TYPE item)¶ Insert an element at the front of a vector.
- Note
- Elements are shuffled along, and the vector expanded if necessary. Consequently this function may not perform well.
- Parameters
vector: The vector being accessed.item: The element to insert.
-
void
vector_type_insert_at(VECTOR_TYPE vector, int index, TYPE item)¶ Insert an element at a given index.
- Note
- Elements are shuffled along, and the vector expanded if necessary. Consequently this function may not perform well.
- Parameters
vector: The vector being accessed.index: The index to insert the element at.item: The element to insert.
-
TYPE
vector_type_remove_at(VECTOR_TYPE vector, int index)¶ Remove an element from a given index.
- Return
- The element being removed.
- Note
- Elements are shuffled down. Consequently this function may not perform well.
- Parameters
vector: The vector being accessed.index: The index to remove the element from.
-
void
vector_type_set(VECTOR_TYPE vector, int index, TYPE item)¶ Set the element at an index in a vector.
- See
- vector_type_get()
- Parameters
vector: The vector being accessed.index: The index to set the element.item: The element to set.
-
TYPE *
vector_type_to_array(VECTOR_TYPE vector, TYPE not_found)¶ Convert to an array of all elements.
- Return
- A standard C array of all elements.
- Parameters
vector: The vector being accessed.not_found: A value appended to signify the array end.
-
VECTOR_TYPE
vector_type_where(VECTOR_TYPE vector, int (*func)(const TYPE, const TYPE), TYPE arg, )¶ Create a new vector by filtering a vector using supplied criteria.
- Return
- A new vector with the filtered elements.
- Remark
- This function uses the supplied comparison function to test each member in turn and adds to the new vector only if the function returns TRUE.
- Parameters
vector: The vector being accessed.func: A comparison function used to test each element in the vector.arg: The argument to supply for the test function.
Map¶
Template Generation¶
| Declarations File: | |
|---|---|
| map-decl.h | |
| Implementation File: | |
| map-impl-c.h | |
Parameters
KTYPE: The type of key used to access elements. VTYPE: The type of element contained. KNAME: The disambiguating key name used in function name definitions. VNAME: The disambiguating value name used in function name definitions. UKNAME: The disambiguating key name used in data type declarations. UVNAME: The disambiguating value name used in data type declarations. VECTOR: Define to implement a vector based map. LIST: Define to implement a list based map. STRING_HASH: Define to use a string hash, otherwise a raw data hash is used. NOTE: VECTOR and LIST are mutually exclusive. Use one or the other.
Examples
#define KTYPE char *
#define VTYPE int
#define KNAME str
#define UKNAME STR
#define VNAME int
#define UVNAME INT
#define VECTOR
#define STRING_HASH
...
MAP_INT_STR mp = map_int_str_create(mem, 12);
map_int_str_set(mp, "key", 23);
Notes
Either VECTOR or LIST must be defined, but not both.
Data Types¶
-
struct
kvp_vtype_ktype¶ Key value pair type definition.
-
KTYPE
key¶ The map key.
-
VTYPE
value¶ The map value associated with the key.
-
typedef struct kvp_vtype_ktype
KVP_VTYPE_KTYPE¶ Key value pair abstract data type.
-
typedef struct map_vtype_ktype *
MAP_VTYPE_KTYPE¶ Map abstract data type.
Functions¶
-
size_t
map_type_count(MAP_VTYPE_KTYPE map)¶ Count the number of elements in a map.
- Return
- A count of the number of elements.
- Remark
- This function may not perform well if there are many elements.
- Parameters
map: The map being accessed.
-
MAP_VTYPE_KTYPE
map_type_create(MEM_SCOPE scope, size_t slots, int (*pkcmp)(KTYPE k1, KTYPE k2))¶ Create a new map on a memory scope.
- Return
- A MAP_VTYPE_KTYPE that maybe used in subsequent map calls.
- Remark
- The number of slots should be designed according to expected usage of the map. A higher number will give better performance, but use more memory. Prime numbers have a better chance of even distribution. The exact choice is should be researched if optimum performance is a critical requirement.
- Parameters
scope: The memory scope.slots: The number of slots in the hash array.pkcmp: A comparison function for keys to determine a match on find.
-
VTYPE
map_type_find(MAP_VTYPE_KTYPE map, KTYPE key, VTYPE not_found)¶ Find an element in a map by key.
- Return
- The element found by the given key, or not_found value if not found.
- Remark
- Get does not affect any currency established with map_vname_kname_first and map_vname_kname_next.
- Remark
- The function behaves identically to map_vname_kname_get() and is provided for consistency.
- See
- map_vname_kname_get().
- Parameters
map: The map being accessed.key: The element key.not_found: A value to be returned to indicate the item was not found.
-
KTYPE
map_type_first(MAP_VTYPE_KTYPE map, KTYPE not_found)¶ Get the first key in the map.
- Return
- The first key, or a zero key if no element exists.
- Remark
- For many types a zero return is a useful way to distiguish between a valid or non-existent element. Where it is not use count to determine if elements are available.
- Remark
- The iteration order of a map is arbitrary and should not be relied on.
- Parameters
map: The map being accessed.not_found: A value to be returned to indicate the map is empty.
-
MAP_VTYPE_KTYPE
map_type_from_array(MEM_SCOPE scope, KVP_VTYPE_KTYPE *array, size_t len, size_t slots, int (*pkcmp)(KTYPE k1, KTYPE k2))¶ Create a new map from an array of key value pairs.
- Return
- A MAP_VTYPE_KTYPE that maybe used in subsequent map calls.
- Remark
- Maps cannot be created by a simple array of values since a key is required for each value. This function requires a key value pair array. A key value pair is a struct with a key member and a value member.
- See
- struct kvp_vtype_ktype, map_vname_kname_create().
- Parameters
scope: A memory scope.array: A key value pair array.len: The number of elements in the array.slots: The number of slots in the hash array.pkcmp: A comparison function for keys to determine a match on find.
-
VTYPE
map_type_get(MAP_VTYPE_KTYPE map, KTYPE key, VTYPE not_found)¶ Get an element in a map by key.
- Return
- The element found by the given key, or ‘not_found’ if not found.
- Remark
- Get does not affect any currency established with map_vname_kname_first and map_vname_kname_next.
- Remark
- The function behaves identically to map_vname_kname_find() and is provided for consistency.
- See
- map_vname_kname_set(), map_vname_kname_find().
- Parameters
map: The map being accessed.key: The element key.not_found: A value to be returned to indicate the item was not found.
-
int
map_type_insert(MAP_VTYPE_KTYPE map, KTYPE key, VTYPE item)¶ Insert an element into a map.
- Return
- TRUE if the item was inserted or FALSE if the key already exists.
- Parameters
map: The map being accessed.key: The key of the element being inserted.item: The element to insert.
-
KTYPE
map_type_next(MAP_VTYPE_KTYPE map, KTYPE not_found)¶ Get the next key in the map.
- Return
- The next key, or a zero key if no more elements exist.
- Parameters
map: The map being accessed.not_found: A value to be returned to indicate there are no more keys.
-
VTYPE
map_type_remove(MAP_VTYPE_KTYPE map, KTYPE key, VTYPE not_found)¶ Remove the element with the given key from a map.
- Return
- The element being removed, or zero if not found.
- Parameters
map: The map being accessed.key: The key of the element to remove.not_found: A value to be returned to indicate the item was not found.
-
void
map_type_set(MAP_VTYPE_KTYPE map, KTYPE key, VTYPE item)¶ Set an element in a map by key.
- Remark
- Set does not affect any currency established with map_vname_kname_first and map_vname_kname_next.
- See
- map_vname_kname_get().
- Parameters
map: The map being accessed.key: The element key.item: The element to set.
-
KTYPE *
map_type_to_key_array(MAP_VTYPE_KTYPE map, KTYPE not_found)¶ Create an array of map keys.
- Return
- An array of all keys in the map with an appended _stack.
- Remark
- The not_found value is often NULL or 0, but may be any key value.
- Remark
- This function may not perform well if there are many elements.
- See
- to_value_array().
- Parameters
map: The map being accessed.not_found: A key value to be used to terminate the array.
-
VTYPE *
map_type_to_value_array(MAP_VTYPE_KTYPE map, VTYPE not_found)¶ Create an array of map values.
- Return
- An array of all values in the map with an appended _stack.
- Remark
- The not_found value is often NULL or 0, but may be any key value.
- Remark
- The array elements will be in no particular order.
- Remark
- This function may not perform well if there are many elements.
- Parameters
map: The map being accessed.not_found: A value to be used to terminate the array.
-
MAP_VTYPE_KTYPE
map_type_where_key(MAP_VTYPE_KTYPE map, int (*func)(KTYPE, KTYPE), KTYPE arg, )¶ Create a new map by filtering the keys of a map using supplied criteria.
- Return
- A new map with the filtered elements.
- Remark
- This function uses the supplied comparison function to test each element key in turn and adds to the new map only if the function returns TRUE.
- Remark
- This function may not perform well if there are many elements.
- Parameters
map: The map being accessed.func: A comparison function used to test each element key in the map.arg: The argument to supply for the test function.
-
MAP_VTYPE_KTYPE
map_type_where_value(MAP_VTYPE_KTYPE map, int (*func)(VTYPE, VTYPE), VTYPE arg, )¶ Create a new map by filtering the values of a map using supplied criteria.
- Return
- A new map with the filtered elements.
- Remark
- This function uses the supplied comparison function to test each element value in turn and adds to the new map only if the function returns TRUE.
- Remark
- This function may not perform well if there are many elements.
- Parameters
map: The map being accessed.func: A comparison function used to test each element value in the map.arg: The argument to supply for the test function.
Stack¶
Template Generation¶
| Declarations File: | |
|---|---|
| stack-decl.h | |
| Implementation File: | |
| stack-impl-c.h | |
Parameters
TYPE: The type of element contained. NAME: The disambiguating name element used in function name definitions UNAME: The disambiguating name element used in data type declarations
Examples
#define TYPE double
#define NAME double
#define UNAME DOUBLE
...
STACK_DOUBLE vp = stack_double_create(mem, 10);
stack_double_append(vp, 1.2345);
Functions¶
-
size_t
stack_type_count(STACK_TYPE stack)¶ Count the number of elements in the stack.
- Return
- The number of elements in the stack.
- Parameters
stack: The stack being accessed.
-
STACK_TYPE
stack_type_create(MEM_SCOPE scope, size_t capacity)¶ Create a new stack.
- Return
- A STACK_TYPE that maybe used in subsequent stack calls, and to allocate memory.
- Remark
- The capacity is the number of elements that can be appended before the stack is expanded. If more elements are pushed the stack is automatically expanded.
- Parameters
scope: A memory scope.capacity: The initial number of elements in the stack.
-
TYPE
stack_type_peek(STACK_TYPE stack, TYPE not_found)¶ Peek the next element on the stack without removing it.
- Return
- The next element that would be popped off the stack, or zero if the stack is empty.
- Parameters
stack: The stack being accessed.not_found: A value to be returned to indicate nothing to peek.
-
TYPE
stack_type_pop(STACK_TYPE stack, TYPE not_found)¶ Pop the next element off the stack.
- Return
- The element popped off the stack, or zero if the stack is empty.
- Remark
- Pop takes the most recently pushed element from the stack.
- Parameters
stack: The stack being accessed.not_found: A value to be returned to indicate nothing to pop.
-
void
stack_type_push(STACK_TYPE stack, TYPE item)¶ Push an element onto the stack.
- Parameters
stack: The stack being accessed.item: The element to push onto the stack.
Queue¶
Template Generation¶
| Declarations File: | |
|---|---|
| queue-decl.h | |
| Implementation File: | |
| queue-impl-c.h | |
Parameters
TYPE: The type of element contained. NAME: The disambiguating name element used in function name definitions UNAME: The disambiguating name element used in data type declarations
Examples
#define TYPE long
#define NAME llong
#define UNAME LLONG
...
QUEUE_LLONG *lp = queue_llong_create(mem);
queue_llong_append(lp, 0xFFFFEEEE11112222L);
Functions¶
-
size_t
queue_type_count(QUEUE_TYPE queue)¶ Count the number of elements in the queue.
- Return
- The number of elements in the queue.
- Parameters
queue: The queue being accessed.
-
QUEUE_TYPE
queue_type_create(MEM_SCOPE scope)¶ Create a new queue.
- Return
- A QUEUE_TYPE that maybe used in subsequent queue calls.
- Parameters
scope: A memory scope.
-
TYPE
queue_type_peek(QUEUE_TYPE queue, TYPE not_found)¶ Peek the next element on the queue without removing it.
- Return
- The next element that would be popped off the queue, or zero if the queue is empty.
- Parameters
queue: The queue being accessed.not_found: A value to be returned if the queue is empty.
-
TYPE
queue_type_pop(QUEUE_TYPE queue, TYPE not_found)¶ Pop the next element off the queue.
- Return
- The element popped off the queue, or zero if the queue is empty.
- Remark
- Pop returns the earliest pushed element from the queue.
- Parameters
queue: The queue being accessed.not_found: A value to be returned if the queue is empty.
-
void
queue_type_push(QUEUE_TYPE queue, TYPE item)¶ Push an element onto the queue.
- Parameters
queue: The queue being accessed.item: The element to push onto the queue.
Miscellaneous¶
Arrays¶
-
int
array_type_contains(TYPE *array, size_t len, TYPE item)¶ Check if a standard C array contains an element.
- Return
- TRUE if the item is found, FALSE if not.
- Remark
- This function uses a basic equality test, so may not work as expected for complex types, including char *.
- Remark
- This function uses a simple linear search so may not perform well.
- Parameters
array: The array to check.len: The length of the array.item: The item to check for.
Atoms¶
Atoms can be used to force strings to be unique. Uniqueness may be scoped or global. Atomising is not a thread safe operation.
-
ATOM
atom_create(MEM_SCOPE mem, int slots)¶ Create an ATOM scope for atom storage.
- Return
- An ATOM scope.
- Parameters
mem: The memory scope to contain all atoms.slots: The number of slots in the hash table.
-
const char *
atom_str(ATOM atom, const char *str)¶ Atomise a string, IE make unique, within the given ATOM scope.
- Return
- A string ATOM.
- Remark
- An atom string is unique, and guaranteed to have the same pointer address for identical string content, within the same ATOM scope.
- Parameters
atom: The ATOM scope for string uniqueness.str: The string to atomise.
-
const char *
atom(const char *str)¶ Save a string as a global atom.
- Return
- An atom for the given string.
- Remark
- An atom string is globally unique, and guaranteed to have the same pointer address for identical string content.
- Parameters
str: The string to atomise.
Comparison¶
Comparison can be templated, but comparison of complex types is unlikely to yield sensible functions. Common types are included in the library.
-
int
cmp_type(TYPE v1, TYPE v2)¶ Compare two items.
- Return
- 0 if the items are equal, 1 if the first is greater than the second and -1 if the first item is less than the second.
- Parameters
v1: First item.v2: Second item.
-
int
less_than_type(TYPE v1, TYPE v2)¶ Tests if an item is less than another item.
- Return
- TRUE if the item is less than the other item, FALSE otherwise.
- Parameters
v1: The item.v2: The other item.
-
int
greater_than_type(TYPE v1, TYPE v2)¶ Tests if an item is greater than another item.
- Return
- TRUE if the item is greater than the other item, FALSE otherwise.
- Parameters
v1: The item.v2: The other item.
-
int
equals_type(TYPE v1, TYPE v2)¶ Tests if an item equals another item.
- Return
- TRUE if the item is equal to the other item, FALSE otherwise.
- Parameters
v1: The item.v2: The other item.
