Next: Fixed Size Data Mini Array Search Library, Previous: Fixed Size Data Mini Array Definitions, Up: Fixed Size Data Mini Array Interface [Index]
int x1f4_case_??mini(void *)
returns 0 if the $1 associative array is empty, non zero otherwise
int x1f4_find_??mini (void *, void *, unsigned, int (*)(void *, void *), void **)
looks for some $1 associative array item matching the $2 key according to the $4 comparison criterion, which when called is passed the $2 key and the start address of the data of the element being examined biased by $3 as arguments, in this order. Upon success, the start address of the found associative array element data is stored at $5.
$4 is expected to return a negative number if the key is less than the associative array element (as indicated by its second argument), 0 if the element is fine and a positive number if the key is greater than the associative array element.
returns 0 if no match was found, non zero otherwise
int x1f4_lime_??mini(void *, void *, int (*)(void *, void *))
calls $3 for each element in the $1 sequence, with $2 and the data for the element as arguments, in this order, until $3 returns non zero
returns 0 if $3 was never called (i.e. sequence is empty) or if $3 never returned non zero, the non zero return of $3 otherwise
int x1f4_look_??mini (void *, void *, unsigned, int (*)(void *, void *), void **)
looks for some $1 associative array existing item matching the $2 key according to the $4 comparison criterion, which when called is passed the $2 key and the start address of the data of the element being examined biased by $3 as arguments, in this order. The start address of the found associative array element data is stored at $5.
If the $1 associative array stores no item matching the $2 key the function has undefined results.
$4 is expected to return a negative number if the key is less than the associative array element (as indicated by its second argument), 0 if the element is fine and a positive number if the key is greater than the associative array element.
returns non zero
int x1f4_part_??mini (void *, void *, unsigned, unsigned, void **)
splits the $1 associative array into two arrays, one to replace the $1 array and one to be found stored at $2. $1 is expected full and 2 * k + 1 long. The length of the $1 array (the number of records it stores) is expected indicated by $3. The in bytes expressed size of one stored record is expected indicated by $4. After the split $1 will store the first k records it initially stored, the $2 the last k. Both arrays will have 2 * k + 1 slots. $2 needs to be allocated accordingly. It does not need to be further setup. The k-th record of the initial $1 array will be found at the address stored at $5. The array slot at which is stored is marked as unused, and presumably its value will be read and re-stored by the application.
If $1 is not full the function has no effect. If $1 is not 2 * k + 1 long the function has undefined results.
returns 0 if $1 is not full, non zero otherwise
int x1f4_port_??mini (void *, void *, int (*)(void *, void *), unsigned, void **)
looks for some $1 associative array item matching the $2 key according to the $3 comparison criterion, which when called is passed the $2 key and the start address of the data of the element being examined biased by $4 as arguments, in this order. Upon look up success, the start address of the found associative array element data is stored at $5. Upon look up failure, inserts a new element, corresponding the $2 key, and stores the start address of the new element data at $5.
$3 is expected to return a negative number if the key is less than the associative array element (as indicated by its second argument), 0 if the element is fine and a positive number if the key is greater than the associative array element.
or:
inserts a new item corresponding the $2 key if none present, retrieves the corresponding item otherwise.
arguments:
the associative array
the key
the comparison method, receives the $2 key and the start address of the data of the element being examined biased by $4 as arguments, in this order, returns a negative number if the key is less than the associative array element (as indicated by its second argument), 0 if the element is fine and a positive number if the key is greater than the associative array element.
some offset (expressed in bytes) to add the start address of the associative array elements data when passing to $3
the address where to store the address of the allocated item data if one is allocated
returns 0 if a new element was inserted, X1f4_??MINI_EVER_MATCH
if a
match was found, one of the defined errors for failure
int x1f4_suit_??mini(void *)
returns 0 if the $1 associative array is full, non zero otherwise
int x1f4_type_??mini(void *, unsigned, unsigned)
setups the $3 bytes long $1 memory block for use as an associate array of $2 bytes long records. The number of available slots will be less than $3 / $2 since the array infrastructure requires some bytes reserved for each slot (about 4).
returns 0 for success, non zero for failure (the indicated memory block size is too small for the block to be usable)