Linked List Module
+ Collaboration diagram for Linked List Module:

Functions

void * jit_linklist_new (void)
 Constructs instance of t_jit_linklist.
long jit_linklist_getsize (t_jit_linklist *x)
 Retrieves the linked list size.
void * jit_linklist_getindex (t_jit_linklist *x, long index)
 Retrieves the object at the specified list index.
long jit_linklist_objptr2index (t_jit_linklist *x, void *p)
 Retrieves the list index for an object pointer.
long jit_linklist_makearray (t_jit_linklist *x, void **a, long max)
 Flatten the linked list into an array.
long jit_linklist_insertindex (t_jit_linklist *x, void *o, long index)
 Insert object at specified index.
long jit_linklist_append (t_jit_linklist *x, void *o)
 Append object to the end of the linked list.
long jit_linklist_deleteindex (t_jit_linklist *x, long index)
 Delete object at specified index, freeing the object.
long jit_linklist_chuckindex (t_jit_linklist *x, long index)
 Remove object at specified index, without freeing the object.
void jit_linklist_clear (t_jit_linklist *x)
 Clears the linked list, freeing all objects in list.
void jit_linklist_chuck (t_jit_linklist *x)
 Removes all objects from the linked list, without freeing any objects in list.
void jit_linklist_reverse (t_jit_linklist *x)
 Reverses the order of objects in the linked list.
void jit_linklist_rotate (t_jit_linklist *x, long i)
 Rotates the order of objects in the linked list, by the specified number of indeces.
void jit_linklist_shuffle (t_jit_linklist *x)
 Randomizes the order of objects in the linked list.
void jit_linklist_swap (t_jit_linklist *x, long a, long b)
 Swap list location of the indeces specified.
void jit_linklist_findfirst (t_jit_linklist *x, void **o, long cmpfn(void *, void *), void *cmpdata)
 Retrieves the first object that satisfies the comparison function.
void jit_linklist_findall (t_jit_linklist *x, t_jit_linklist **out, long cmpfn(void *, void *), void *cmpdata)
 Retrieves a linked list of all objects that satisfy the comparison function.
long jit_linklist_findcount (t_jit_linklist *x, long cmpfn(void *, void *), void *cmpdata)
 Retrieves the number of objects that satisfy the comparison function.
void jit_linklist_methodall (t_jit_linklist *x, t_symbol *s,...)
 Calls a method on all objects in linked list.
void * jit_linklist_methodindex (t_jit_linklist *x, long i, t_symbol *s,...)
 Calls a method on the object at the specified index.
void jit_linklist_sort (t_jit_linklist *x, long cmpfn(void *, void *))
 Sorts linked list based on the provided comparison function.

Function Documentation

long jit_linklist_append ( t_jit_linklist *  x,
void *  o 
)

Append object to the end of the linked list.

Parameters:
xt_jit_linklist object pointer
oobject pointer
Returns:
new list length, or -1 if unsuccessful
Warning:
While exported, it is recommend to use jit_object_method to call methods on an object when the object may not be an instance of t_jit_linklist, but instead an object that supports some portion of the t_jit_linklist interface. One instance where this is the case is inside of a MOP matrix_calc method, where the arguments can be either an instance of t_jit_linklist, or t_jit_matrix which has a getindex method.
void jit_linklist_chuck ( t_jit_linklist *  x)

Removes all objects from the linked list, without freeing any objects in list.

To remove all objects from the linked list, freeing the objects, use the jit_linklist_clear method.

Parameters:
xt_jit_linklist object pointer
Warning:
While exported, it is recommend to use jit_object_method to call methods on an object when the object may not be an instance of t_jit_linklist, but instead an object that supports some portion of the t_jit_linklist interface. One instance where this is the case is inside of a MOP matrix_calc method, where the arguments can be either an instance of t_jit_linklist, or t_jit_matrix which has a getindex method.
long jit_linklist_chuckindex ( t_jit_linklist *  x,
long  index 
)

Remove object at specified index, without freeing the object.

This method will not free the object. To remove from the linked list and free the object, use the jit_linklist_deleteindex method.

Parameters:
xt_jit_linklist object pointer
indexindex to remove (zero based)
Returns:
index removed, or -1 if unsuccessful
Warning:
While exported, it is recommend to use jit_object_method to call methods on an object when the object may not be an instance of t_jit_linklist, but instead an object that supports some portion of the t_jit_linklist interface. One instance where this is the case is inside of a MOP matrix_calc method, where the arguments can be either an instance of t_jit_linklist, or t_jit_matrix which has a getindex method.
void jit_linklist_clear ( t_jit_linklist *  x)

Clears the linked list, freeing all objects in list.

To remove all elements from the linked list without freeing the objects, use the jit_linklist_chuck method.

Parameters:
xt_jit_linklist object pointer
Warning:
While exported, it is recommend to use jit_object_method to call methods on an object when the object may not be an instance of t_jit_linklist, but instead an object that supports some portion of the t_jit_linklist interface. One instance where this is the case is inside of a MOP matrix_calc method, where the arguments can be either an instance of t_jit_linklist, or t_jit_matrix which has a getindex method.
long jit_linklist_deleteindex ( t_jit_linklist *  x,
long  index 
)

Delete object at specified index, freeing the object.

To remove from the linked list without freeing the object, use the jit_linklist_chuckindex method.

Parameters:
xt_jit_linklist object pointer
indexindex to delete (zero based)
Returns:
index deleted, or -1 if unsuccessful
Warning:
While exported, it is recommend to use jit_object_method to call methods on an object when the object may not be an instance of t_jit_linklist, but instead an object that supports some portion of the t_jit_linklist interface. One instance where this is the case is inside of a MOP matrix_calc method, where the arguments can be either an instance of t_jit_linklist, or t_jit_matrix which has a getindex method.
void jit_linklist_findall ( t_jit_linklist *  x,
t_jit_linklist **  out,
long   cmpfnvoid *, void *,
void *  cmpdata 
)

Retrieves a linked list of all objects that satisfy the comparison function.

Parameters:
xt_jit_linklist object pointer
outpointer to linked list containing all objects found found (set to NULL, if not found)
cmpfncomparison function pointer (should returns 1 if object matches data, otherwise 0)
cmpdataopaque data used in comparison function
Warning:
While exported, it is recommend to use jit_object_method to call methods on an object when the object may not be an instance of t_jit_linklist, but instead an object that supports some portion of the t_jit_linklist interface. One instance where this is the case is inside of a MOP matrix_calc method, where the arguments can be either an instance of t_jit_linklist, or t_jit_matrix which has a getindex method.
long jit_linklist_findcount ( t_jit_linklist *  x,
long   cmpfnvoid *, void *,
void *  cmpdata 
)

Retrieves the number of objects that satisfy the comparison function.

Parameters:
xt_jit_linklist object pointer
cmpfncomparison function pointer (should returns 1 if object matches data, otherwise 0)
cmpdataopaque data used in comparison function
Returns:
number object objects that satisfy the comparison function
Warning:
While exported, it is recommend to use jit_object_method to call methods on an object when the object may not be an instance of t_jit_linklist, but instead an object that supports some portion of the t_jit_linklist interface. One instance where this is the case is inside of a MOP matrix_calc method, where the arguments can be either an instance of t_jit_linklist, or t_jit_matrix which has a getindex method.
void jit_linklist_findfirst ( t_jit_linklist *  x,
void **  o,
long   cmpfnvoid *, void *,
void *  cmpdata 
)

Retrieves the first object that satisfies the comparison function.

Parameters:
xt_jit_linklist object pointer
opointer to object pointer found (set to NULL, if not found)
cmpfncomparison function pointer (should returns 1 if object matches data, otherwise 0)
cmpdataopaque data used in comparison function
Warning:
While exported, it is recommend to use jit_object_method to call methods on an object when the object may not be an instance of t_jit_linklist, but instead an object that supports some portion of the t_jit_linklist interface. One instance where this is the case is inside of a MOP matrix_calc method, where the arguments can be either an instance of t_jit_linklist, or t_jit_matrix which has a getindex method.
void* jit_linklist_getindex ( t_jit_linklist *  x,
long  index 
)

Retrieves the object at the specified list index.

Parameters:
xt_jit_linklist object pointer
indexlist index ()
Returns:
object pointer
Warning:
While exported, it is recommend to use jit_object_method to call methods on an object when the object may not be an instance of t_jit_linklist, but instead an object that supports some portion of the t_jit_linklist interface. One instance where this is the case is inside of a MOP matrix_calc method, where the arguments can be either an instance of t_jit_linklist, or t_jit_matrix which has a getindex method.
long jit_linklist_getsize ( t_jit_linklist *  x)

Retrieves the linked list size.

Parameters:
xt_jit_linklist object pointer
Returns:
linked list size
Warning:
While exported, it is recommend to use jit_object_method to call methods on an object when the object may not be an instance of t_jit_linklist, but instead an object that supports some portion of the t_jit_linklist interface. One instance where this is the case is inside of a MOP matrix_calc method, where the arguments can be either an instance of t_jit_linklist, or t_jit_matrix which has a getindex method.
long jit_linklist_insertindex ( t_jit_linklist *  x,
void *  o,
long  index 
)

Insert object at specified index.

Parameters:
xt_jit_linklist object pointer
oobject pointer
indexindex (zero based)
Returns:
index inserted at, or -1 if unsuccessful
Warning:
While exported, it is recommend to use jit_object_method to call methods on an object when the object may not be an instance of t_jit_linklist, but instead an object that supports some portion of the t_jit_linklist interface. One instance where this is the case is inside of a MOP matrix_calc method, where the arguments can be either an instance of t_jit_linklist, or t_jit_matrix which has a getindex method.
long jit_linklist_makearray ( t_jit_linklist *  x,
void **  a,
long  max 
)

Flatten the linked list into an array.

Parameters:
xt_jit_linklist object pointer
aarray pointer
maxmaximum array size
Returns:
number of object pointers copied into array
Warning:
While exported, it is recommend to use jit_object_method to call methods on an object when the object may not be an instance of t_jit_linklist, but instead an object that supports some portion of the t_jit_linklist interface. One instance where this is the case is inside of a MOP matrix_calc method, where the arguments can be either an instance of t_jit_linklist, or t_jit_matrix which has a getindex method.
void jit_linklist_methodall ( t_jit_linklist *  x,
t_symbol s,
  ... 
)

Calls a method on all objects in linked list.

Equivalent to calling jit_object_method on the object at each index.

Parameters:
xt_jit_linklist object pointer
smethod name
...untyped arguments
Warning:
While exported, it is recommend to use jit_object_method to call methods on an object when the object may not be an instance of t_jit_linklist, but instead an object that supports some portion of the t_jit_linklist interface. One instance where this is the case is inside of a MOP matrix_calc method, where the arguments can be either an instance of t_jit_linklist, or t_jit_matrix which has a getindex method.
void* jit_linklist_methodindex ( t_jit_linklist *  x,
long  i,
t_symbol s,
  ... 
)

Calls a method on the object at the specified index.

Equivalent to calling jit_object_method on the object.

Parameters:
xt_jit_linklist object pointer
iindex
smethod name
...untyped arguments
Returns:
method return value
Warning:
While exported, it is recommend to use jit_object_method to call methods on an object when the object may not be an instance of t_jit_linklist, but instead an object that supports some portion of the t_jit_linklist interface. One instance where this is the case is inside of a MOP matrix_calc method, where the arguments can be either an instance of t_jit_linklist, or t_jit_matrix which has a getindex method.
void* jit_linklist_new ( void  )

Constructs instance of t_jit_linklist.

Returns:
t_jit_linklist object pointer
Warning:
While exported, it is recommend to use jit_object_new to construct a t_jit_linklist object.
long jit_linklist_objptr2index ( t_jit_linklist *  x,
void *  p 
)

Retrieves the list index for an object pointer.

Parameters:
xt_jit_linklist object pointer
pobject pointer
Returns:
object's list index (zero based), or -1 if not present
Warning:
While exported, it is recommend to use jit_object_method to call methods on an object when the object may not be an instance of t_jit_linklist, but instead an object that supports some portion of the t_jit_linklist interface. One instance where this is the case is inside of a MOP matrix_calc method, where the arguments can be either an instance of t_jit_linklist, or t_jit_matrix which has a getindex method.
void jit_linklist_reverse ( t_jit_linklist *  x)

Reverses the order of objects in the linked list.

Parameters:
xt_jit_linklist object pointer
Warning:
While exported, it is recommend to use jit_object_method to call methods on an object when the object may not be an instance of t_jit_linklist, but instead an object that supports some portion of the t_jit_linklist interface. One instance where this is the case is inside of a MOP matrix_calc method, where the arguments can be either an instance of t_jit_linklist, or t_jit_matrix which has a getindex method.
void jit_linklist_rotate ( t_jit_linklist *  x,
long  i 
)

Rotates the order of objects in the linked list, by the specified number of indeces.

Parameters:
xt_jit_linklist object pointer
irotation index count
Warning:
While exported, it is recommend to use jit_object_method to call methods on an object when the object may not be an instance of t_jit_linklist, but instead an object that supports some portion of the t_jit_linklist interface. One instance where this is the case is inside of a MOP matrix_calc method, where the arguments can be either an instance of t_jit_linklist, or t_jit_matrix which has a getindex method.
void jit_linklist_shuffle ( t_jit_linklist *  x)

Randomizes the order of objects in the linked list.

Parameters:
xt_jit_linklist object pointer
Warning:
While exported, it is recommend to use jit_object_method to call methods on an object when the object may not be an instance of t_jit_linklist, but instead an object that supports some portion of the t_jit_linklist interface. One instance where this is the case is inside of a MOP matrix_calc method, where the arguments can be either an instance of t_jit_linklist, or t_jit_matrix which has a getindex method.
void jit_linklist_sort ( t_jit_linklist *  x,
long   cmpfnvoid *, void * 
)

Sorts linked list based on the provided comparison function.

Parameters:
xt_jit_linklist object pointer
cmpfncomparison function pointer (returns 0 if a>b, otherwise 1)
Warning:
While exported, it is recommend to use jit_object_method to call methods on an object when the object may not be an instance of t_jit_linklist, but instead an object that supports some portion of the t_jit_linklist interface. One instance where this is the case is inside of a MOP matrix_calc method, where the arguments can be either an instance of t_jit_linklist, or t_jit_matrix which has a getindex method.
void jit_linklist_swap ( t_jit_linklist *  x,
long  a,
long  b 
)

Swap list location of the indeces specified.

Parameters:
xt_jit_linklist object pointer
aindex a
bindex b
Warning:
While exported, it is recommend to use jit_object_method to call methods on an object when the object may not be an instance of t_jit_linklist, but instead an object that supports some portion of the t_jit_linklist interface. One instance where this is the case is inside of a MOP matrix_calc method, where the arguments can be either an instance of t_jit_linklist, or t_jit_matrix which has a getindex method.