ajlist.c
Datatypes: AjPList AjIList AjPList AjIList
Lists
Sections: Constructors Adding values Modifiers Removing data Element retrieval Trace functions Destructors unused exit
Constructors for lists
Functions: ajListNew ajListNewListref ajListNewRef
Creates a new general list.
Synopsis
Prototype
AjPList ajListNew (
void
);
Type | Name | Read/Write | Description |
AjPList | | RETURN | new list; |
Returns
Description
Creates a new general list.
See Also
See other functions in this section
Availability
In release 6.4.0
Copy a list.
WARNING: pointers to the data are copied, NOT the data
so be careful when cleaning up after copy.
Synopsis
Prototype
AjPList ajListNewListref (
const AjPList list
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | list to be copied |
AjPList | | RETURN | new copied list. |
Input
list: | (Input) | list to be copied |
Returns
Description
Copy a list.
WARNING: pointers to the data are copied, NOT the data
so be careful when cleaning up after copy.
See Also
See other functions in this section
Availability
In release 6.4.0
Makes a reference-counted copy of any list
Synopsis
Prototype
AjPList ajListNewRef (
AjPList list
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | list to be given a new reference |
AjPList | | RETURN | new list; |
Input & Output
list: | (Modify) | list to be given a new reference |
Returns
Description
Makes a reference-counted copy of any list
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajListPush ajListPushAppend ajListPushlist
Add a new node at the start of the list and add the
data pointer.
Synopsis
Prototype
void ajListPush (
AjPList list,
void* x
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | list to be changed. |
void* | x | Modify | Pointer to data. |
void | | RETURN | |
Input & Output
list: | (Modify) | list to be changed. |
x: | (Modify) | Pointer to data. |
Returns
Description
Add a new node at the start of the list and add the
data pointer.
See Also
See other functions in this section
Availability
In release 6.4.0
Add a new node at the end of the list and add the
data pointer.
Synopsis
Prototype
void ajListPushAppend (
AjPList list,
void* x
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List to be changed. |
void* | x | Modify | Pointer to data to append. |
void | | RETURN | |
Input & Output
list: | (Modify) | List to be changed. |
x: | (Modify) | Pointer to data to append. |
Returns
Description
Add a new node at the end of the list and add the
data pointer.
See Also
See other functions in this section
Availability
In release 6.4.0
Adds a list to the start of the current list, then deletes the second list.
Synopsis
Prototype
void ajListPushlist (
AjPList list,
AjPList* Plist
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List. |
AjPList* | Plist | Delete | List to be merged. |
void | | RETURN | |
Output
Plist: | (Delete) | List to be merged. |
Input & Output
Returns
Description
Adds a list to the start of the current list, then deletes the second list.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajListMap ajListPurge ajListReverse ajListSort ajListSortTwo ajListSortTwoThree ajListSortTwoUnique ajListSortUnique
For each node in the list call function apply.
Synopsis
Prototype
void ajListMap (
AjPList list,
void function apply,
void* cl
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List. |
void function | apply | Function | Function to call for each list item. |
void* | cl | Modify | Standard, usually NULL. |
void | | RETURN | |
Input
apply: | (Function) | Function to call for each list item. |
Input & Output
list: | (Modify) | List. |
cl: | (Modify) | Standard, usually NULL. |
Returns
Description
For each node in the list call function apply.
See Also
See other functions in this section
Availability
In release 6.4.0
Garbage collect a list
Synopsis
Prototype
void ajListPurge (
AjPList list,
AjBool* function test,
void* function nodedelete
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List. |
AjBool* function | test | Function | Function to test whether to delete |
void* function | nodedelete | Function | Wrapper function for item destructor |
void | | RETURN | |
Input
test: | (Function) | Function to test whether to delete |
nodedelete: | (Function) | Wrapper function for item destructor |
Input & Output
Returns
Description
Garbage collect a list
See Also
See other functions in this section
Availability
In release 6.4.0
Reverse the order of the nodes in an abstract list.
Synopsis
Prototype
void ajListReverse (
AjPList list
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List |
void | | RETURN | |
Input & Output
Returns
Description
Reverse the order of the nodes in an abstract list.
See Also
See other functions in this section
Availability
In release 6.4.0
Sort the items in a list.
Synopsis
Prototype
void ajListSort (
AjPList list,
int* function sort1
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List. |
int* function | sort1 | Function | Function to compare two list items. |
void | | RETURN | |
Input
sort1: | (Function) | Function to compare two list items. |
Input & Output
Returns
Description
Sort the items in a list.
See Also
See other functions in this section
Availability
In release 6.4.0
Sort the items in a list using 2 fields in the same object hierarchy.
Synopsis
Prototype
void ajListSortTwo (
AjPList list,
int* function sort1,
int* function sort2
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List. |
int* function | sort1 | Function | 1st function to compare two list items. |
int* function | sort2 | Function | 2nd function to compare two list items. |
void | | RETURN | |
Input
sort1: | (Function) | 1st function to compare two list items. |
sort2: | (Function) | 2nd function to compare two list items. |
Input & Output
Returns
Description
Sort the items in a list using 2 fields in the same object hierarchy.
See Also
See other functions in this section
Availability
In release 6.4.0
Sort the items in a list using 3 fields in the same object hierarchy.
Synopsis
Prototype
void ajListSortTwoThree (
AjPList list,
int* function sort1,
int* function sort2,
int* function sort3
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List. |
int* function | sort1 | Function | 1st function to compare two list items. |
int* function | sort2 | Function | 2nd function to compare two list items. |
int* function | sort3 | Function | 3rd function to compare two list items. |
void | | RETURN | |
Input
sort1: | (Function) | 1st function to compare two list items. |
sort2: | (Function) | 2nd function to compare two list items. |
sort3: | (Function) | 3rd function to compare two list items. |
Input & Output
Returns
Description
Sort the items in a list using 3 fields in the same object hierarchy.
See Also
See other functions in this section
Availability
In release 6.4.0
Double-sort the items in a list, and remove duplicates
Synopsis
Prototype
void ajListSortTwoUnique (
AjPList list,
int* function sort1,
int* function sort2,
void* function nodedelete
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List. |
int* function | sort1 | Function | Function to compare two list items. |
int* function | sort2 | Function | Function to compare two list items. |
void* function | nodedelete | Function | Function to delete an item |
void | | RETURN | |
Input
sort1: | (Function) | Function to compare two list items. |
sort2: | (Function) | Function to compare two list items. |
nodedelete: | (Function) | Function to delete an item |
Input & Output
Returns
Description
Double-sort the items in a list, and remove duplicates
See Also
See other functions in this section
Availability
In release 6.4.0
Sort the items in a list, and remove duplicates
Synopsis
Prototype
void ajListSortUnique (
AjPList list,
int* function sort1,
void* function nodedelete
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List. |
int* function | sort1 | Function | Function to compare two list items. |
void* function | nodedelete | Function | Function to delete an item |
void | | RETURN | |
Input
sort1: | (Function) | Function to compare two list items. |
nodedelete: | (Function) | Function to delete an item |
Input & Output
Returns
Description
Sort the items in a list, and remove duplicates
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajListPop ajListPopLast
remove the first node but set pointer to data first.
Synopsis
Prototype
AjBool ajListPop (
AjPList list,
void** x
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List |
void** | x | Output | pointer to pointer to data |
AjBool | | RETURN | ajTrue on success. |
Output
x: | (Output) | pointer to pointer to data |
Input & Output
Returns
AjBool: | ajTrue on success. |
Description
remove the first node but set pointer to data first.
See Also
See other functions in this section
Availability
In release 6.4.0
remove the last node but set pointer to data first.
Synopsis
Prototype
AjBool ajListPopLast (
AjPList list,
void** x
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List |
void** | x | Output | pointer to pointer to data |
AjBool | | RETURN | ajTrue on success. |
Output
x: | (Output) | pointer to pointer to data |
Input & Output
Returns
AjBool: | ajTrue on success. |
Description
remove the last node but set pointer to data first.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajListGetLength ajListMapfind ajListMapread ajListPeek ajListPeekFirst ajListPeekLast ajListPeekNumber ajListToarray ajListToindex
get the number of nodes in the linked list.
Synopsis
Prototype
ajuint ajListGetLength (
const AjPList list
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | List |
ajuint | | RETURN | Number of nodes in list. |
Input
Returns
ajuint: | Number of nodes in list. |
Description
get the number of nodes in the linked list.
See Also
See other functions in this section
Availability
In release 6.4.0
For each node in the list call function 'apply' and return
ajTrue when any node is matched by the function.
Synopsis
Prototype
AjBool ajListMapfind (
const AjPList list,
AjBool function apply,
void* cl
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | List |
AjBool function | apply | Function | Function to call to test each list item. |
void* | cl | Modify | Standard, usually NULL. |
AjBool | | RETURN | ajTrue on success. |
Input
list: | (Input) | List |
apply: | (Function) | Function to call to test each list item. |
Input & Output
cl: | (Modify) | Standard, usually NULL. |
Returns
AjBool: | ajTrue on success. |
Description
For each node in the list call function 'apply' and return
ajTrue when any node is matched by the function.
See Also
See other functions in this section
Availability
In release 6.4.0
For each node in the list call function apply.
The apply function must not modify the list elements.
Synopsis
Prototype
void ajListMapread (
const AjPList list,
void function apply,
void* cl
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | List. |
void function | apply | Function | Function to call for each list item. |
void* | cl | Modify | Standard, usually NULL. |
void | | RETURN | |
Input
list: | (Input) | List. |
apply: | (Function) | Function to call for each list item. |
Input & Output
cl: | (Modify) | Standard, usually NULL. |
Returns
Description
For each node in the list call function apply.
The apply function must not modify the list elements.
See Also
See other functions in this section
Availability
In release 6.4.0
Return the first node but keep it on the list
Synopsis
Prototype
AjBool ajListPeek (
const AjPList list,
void** x
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | List |
void** | x | Output | pointer to pointer to data |
AjBool | | RETURN | ajTrue on success. |
Input
Output
x: | (Output) | pointer to pointer to data |
Returns
AjBool: | ajTrue on success. |
Description
Return the first node but keep it on the list
See Also
See other functions in this section
Availability
In release 6.4.0
Set pointer to first node's data. Does NOT remove the first node.
Synopsis
Prototype
AjBool ajListPeekFirst (
const AjPList list,
void** x
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | List |
void** | x | Output | pointer to pointer to data |
AjBool | | RETURN | ajTrue on success. |
Input
Output
x: | (Output) | pointer to pointer to data |
Returns
AjBool: | ajTrue on success. |
Description
Set pointer to first node's data. Does NOT remove the first node.
See Also
See other functions in this section
Availability
In release 6.4.0
Set pointer to last node's data. Does NOT remove the last node.
Synopsis
Prototype
AjBool ajListPeekLast (
const AjPList list,
void** x
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | List |
void** | x | Output | pointer to pointer to data |
AjBool | | RETURN | ajTrue on success. |
Input
Output
x: | (Output) | pointer to pointer to data |
Returns
AjBool: | ajTrue on success. |
Description
Set pointer to last node's data. Does NOT remove the last node.
See Also
See other functions in this section
Availability
In release 6.4.0
Set pointer to last node's nth data item. 0 <= n < number of elements.
Synopsis
Prototype
AjBool ajListPeekNumber (
const AjPList list,
ajuint ipos,
void** x
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | List |
ajuint | ipos | Input | element of the list |
void** | x | Output | pointer to pointer to data |
AjBool | | RETURN | ajTrue on success. |
Input
list: | (Input) | List |
ipos: | (Input) | element of the list |
Output
x: | (Output) | pointer to pointer to data |
Returns
AjBool: | ajTrue on success. |
Description
Set pointer to last node's nth data item. 0 <= n < number of elements.
See Also
See other functions in this section
Availability
In release 6.4.0
Create an array of the pointers to the data.
Synopsis
Prototype
ajuint ajListToarray (
const AjPList list,
void*** array
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | List |
void*** | array | Output | Array of pointers to list items. |
ajuint | | RETURN | Size of array of pointers. |
Input
Output
array: | (Output) | Array of pointers to list items. |
Returns
ajuint: | Size of array of pointers. |
Description
Create an array of the pointers to the data.
See Also
See other functions in this section
Availability
In release 6.4.0
Create an array of the pointers to the data.
Synopsis
Prototype
ajuint ajListToindex (
const AjPList list,
ajuint* lind,
int* function sort1
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | List |
ajuint* | lind | Output | Populated ndex array to be sorted |
int* function | sort1 | Function | Function to compare two list items. |
ajuint | | RETURN | Size of index array. |
Input
list: | (Input) | List |
sort1: | (Function) | Function to compare two list items. |
Output
lind: | (Output) | Populated ndex array to be sorted |
Returns
ajuint: | Size of index array. |
Description
Create an array of the pointers to the data.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajListProbe ajListProbeData ajListTrace
Test list for memory allocation conflicts
Synopsis
Prototype
void ajListProbe (
AjPList const* Plist
);
Type | Name | Read/Write | Description |
AjPList const* | Plist | Input | List |
void | | RETURN | |
Input
Returns
Description
Test list for memory allocation conflicts
See Also
See other functions in this section
Availability
In release 6.4.0
Test list and data for memory allocation conflicts
Synopsis
Prototype
void ajListProbeData (
AjPList const* Plist
);
Type | Name | Read/Write | Description |
AjPList const* | Plist | Input | List |
void | | RETURN | |
Input
Returns
Description
Test list and data for memory allocation conflicts
See Also
See other functions in this section
Availability
In release 6.4.0
Traces through a list and validates it
Synopsis
Prototype
void ajListTrace (
const AjPList list
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | list to be traced. |
void | | RETURN | |
Input
list: | (Input) | list to be traced. |
Returns
Description
Traces through a list and validates it
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajListFree ajListFreeData
Free all nodes in the list.
NOTE: The data is only freed with a specified list type.
For undefined data types we recommend you to
use ajListMap with a routine to free the memory.
Synopsis
Prototype
void ajListFree (
AjPList* Plist
);
Type | Name | Read/Write | Description |
AjPList* | Plist | Delete | List |
void | | RETURN | |
Output
Returns
Description
Free all nodes in the list.
NOTE: The data is only freed with a specified list type.
For undefined data types we recommend you to
use ajListMap with a routine to free the memory.
See Also
See other functions in this section
Availability
In release 6.4.0
Free all nodes in the list. Free all the data values.
For more complex data objects use ajListMap with a routine to
free the object memory.
Synopsis
Prototype
void ajListFreeData (
AjPList* Plist
);
Type | Name | Read/Write | Description |
AjPList* | Plist | Delete | List |
void | | RETURN | |
Output
Returns
Description
Free all nodes in the list. Free all the data values.
For more complex data objects use ajListMap with a routine to
free the object memory.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajListUnused
Dummy function to catch all unused functions defined in ajlist
Synopsis
Prototype
void ajListUnused (
void** array
);
Type | Name | Read/Write | Description |
void** | array | Input | Array needed by ajListArrayTrace |
void | | RETURN | |
Input
array: | (Input) | Array needed by ajListArrayTrace |
Returns
Description
Dummy function to catch all unused functions defined in ajlist
See Also
See other functions in this section
Availability
In release 6.4.0
Functions called on exit from the program by ajExit to do
any necessary cleanup and to report internal statistics to the debug file
Functions: ajListExit
Prints a summary of list usage with debug calls
Synopsis
Prototype
void ajListExit (
void
);
Type | Name | Read/Write | Description |
void | | RETURN | |
Returns
Description
Prints a summary of list usage with debug calls
See Also
See other functions in this section
Availability
In release 6.4.0
List iterators
Sections: constructors tests destructors stepping modifiers Trace functions
Functions: ajListIterNew ajListIterNewBack ajListIterNewread ajListIterNewreadBack
Creates an iterator to operate from start to end of list.
Synopsis
Prototype
AjIList ajListIterNew (
AjPList list
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List
Not const in practice - the iterator can insert
and delete entries |
AjIList | | RETURN | New list iterator |
Input & Output
list: | (Modify) | List
Not const in practice - the iterator can insert
and delete entries |
Returns
AjIList: | New list iterator |
Description
Creates an iterator to operate from start to end of list.
See Also
See other functions in this section
Availability
In release 6.4.0
Creates an iterator to operate from end to start of the list.
Synopsis
Prototype
AjIList ajListIterNewBack (
AjPList list
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List
Not const - the iterator can insert and delete entries |
AjIList | | RETURN | New list iterator |
Input & Output
list: | (Modify) | List
Not const - the iterator can insert and delete entries |
Returns
AjIList: | New list iterator |
Description
Creates an iterator to operate from end to start of the list.
See Also
See other functions in this section
Availability
In release 6.4.0
Creates an iterator to operate from start to end of read-only list.
Synopsis
Prototype
AjIList ajListIterNewread (
const AjPList list
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | List
Not const in practice - the iterator can insert
and delete entries |
AjIList | | RETURN | New list iterator |
Input
list: | (Input) | List
Not const in practice - the iterator can insert
and delete entries |
Returns
AjIList: | New list iterator |
Description
Creates an iterator to operate from start to end of read-only list.
See Also
See other functions in this section
Availability
In release 6.4.0
Creates an iterator to operate from end to start of the list.
Synopsis
Prototype
AjIList ajListIterNewreadBack (
const AjPList list
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | List |
AjIList | | RETURN | New list iterator |
Input
Returns
AjIList: | New list iterator |
Description
Creates an iterator to operate from end to start of the list.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajListIterDone ajListIterDoneBack
Tests whether an iterator has completed yet.
Synopsis
Prototype
AjBool ajListIterDone (
const AjIList iter
);
Type | Name | Read/Write | Description |
const AjIList | iter | Input | List iterator. |
AjBool | | RETURN | ajTrue if the iterator is exhausted. |
Input
iter: | (Input) | List iterator. |
Returns
AjBool: | ajTrue if the iterator is exhausted. |
Description
Tests whether an iterator has completed yet.
See Also
See other functions in this section
Availability
In release 6.4.0
Tests whether a backwards iterator has completed yet.
Synopsis
Prototype
AjBool ajListIterDoneBack (
const AjIList iter
);
Type | Name | Read/Write | Description |
const AjIList | iter | Input | List iterator. |
AjBool | | RETURN | ajTrue if the iterator is exhausted. |
Input
iter: | (Input) | List iterator. |
Returns
AjBool: | ajTrue if the iterator is exhausted. |
Description
Tests whether a backwards iterator has completed yet.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajListIterDel
Destructor for a list iterator.
Synopsis
Prototype
void ajListIterDel (
AjIList* iter
);
Type | Name | Read/Write | Description |
AjIList* | iter | Delete | List iterator. |
void | | RETURN | |
Output
iter: | (Delete) | List iterator. |
Returns
Description
Destructor for a list iterator.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajListIterGet ajListIterGetBack
Returns next item using iterator, or steps off the end.
Synopsis
Prototype
void* ajListIterGet (
AjIList iter
);
Type | Name | Read/Write | Description |
AjIList | iter | Modify | List iterator. |
void* | | RETURN | Data item returned. |
Input & Output
iter: | (Modify) | List iterator. |
Returns
void*: | Data item returned. |
Description
Returns next item using iterator, or steps off the end.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns next item using back iterator.
Synopsis
Prototype
void* ajListIterGetBack (
AjIList iter
);
Type | Name | Read/Write | Description |
AjIList | iter | Modify | List iterator. |
void* | | RETURN | Data item returned. |
Input & Output
iter: | (Modify) | List iterator. |
Returns
void*: | Data item returned. |
Description
Returns next item using back iterator.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajListIterInsert ajListIterRemove ajListIterRewind
Insert an item in a list, using an iterator (if not null)
to show which position to insert. Otherwise, simply push.
Synopsis
Prototype
void ajListIterInsert (
AjIList iter,
void* x
);
Type | Name | Read/Write | Description |
AjIList | iter | Modify | List iterator. |
void* | x | Modify | Data item to insert. |
void | | RETURN | |
Input & Output
iter: | (Modify) | List iterator. |
x: | (Modify) | Data item to insert. |
Returns
Description
Insert an item in a list, using an iterator (if not null)
to show which position to insert. Otherwise, simply push.
See Also
See other functions in this section
Availability
In release 6.4.0
Remove an item from a list, using an iterator (if not null)
to show which item. Otherwise remove the first item.
We want to remove the item just fetched by the iterator.
Synopsis
Prototype
void ajListIterRemove (
AjIList iter
);
Type | Name | Read/Write | Description |
AjIList | iter | Modify | List iterator. |
void | | RETURN | |
Input & Output
iter: | (Modify) | List iterator. |
Returns
Description
Remove an item from a list, using an iterator (if not null)
to show which item. Otherwise remove the first item.
We want to remove the item just fetched by the iterator.
See Also
See other functions in this section
Availability
In release 6.4.0
Resets iterator to start position
Synopsis
Prototype
void ajListIterRewind (
AjIList iter
);
Type | Name | Read/Write | Description |
AjIList | iter | Modify | List iterator. |
void | | RETURN | |
Input & Output
iter: | (Modify) | List iterator. |
Returns
Description
Resets iterator to start position
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajListIterTrace
Traces a list iterator and validates it.
Synopsis
Prototype
void ajListIterTrace (
const AjIList iter
);
Type | Name | Read/Write | Description |
const AjIList | iter | Input | list iterator to be traced. |
void | | RETURN | |
Input
iter: | (Input) | list iterator to be traced. |
Returns
Description
Traces a list iterator and validates it.
See Also
See other functions in this section
Availability
In release 6.4.0
String lists
Sections: Constructors Adding values Modifiers Removing data Element retrieval Trace functions Destructors
Constructors for lists
Functions: ajListstrNew ajListstrNewList ajListstrNewListref
Creates a new string list.
Synopsis
Prototype
AjPList ajListstrNew (
void
);
Type | Name | Read/Write | Description |
AjPList | | RETURN | new list; |
Returns
Description
Creates a new string list.
See Also
See other functions in this section
Availability
In release 6.4.0
Copy a list, with copies of all the string values.
General data cannot be copied so this is a string-only function
Synopsis
Prototype
AjPList ajListstrNewList (
const AjPList list
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | list to be copied |
AjPList | | RETURN | new copied list. |
Input
list: | (Input) | list to be copied |
Returns
Description
Copy a list, with copies of all the string values.
General data cannot be copied so this is a string-only function
See Also
See other functions in this section
Availability
In release 6.4.0
Copy a string list.
WARNING: pointers to the data are copied, NOT the data
so be careful when cleaning up after copy.
Synopsis
Prototype
AjPList ajListstrNewListref (
const AjPList list
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | List to be copied |
AjPList | | RETURN | New, copied, list. |
Input
list: | (Input) | List to be copied |
Returns
AjPList: | New, copied, list. |
Description
Copy a string list.
WARNING: pointers to the data are copied, NOT the data
so be careful when cleaning up after copy.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajListstrPush ajListstrPushAppend ajListstrPushlist
Add a new node at the start of a string list.
Synopsis
Prototype
void ajListstrPush (
AjPList list,
AjPStr x
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | list to be changed. |
AjPStr | x | Modify | String data. |
void | | RETURN | |
Input & Output
list: | (Modify) | list to be changed. |
x: | (Modify) | String data. |
Returns
Description
Add a new node at the start of a string list.
See Also
See other functions in this section
Availability
In release 6.4.0
Add a new node at the end of the list and add the
data pointer.
Synopsis
Prototype
void ajListstrPushAppend (
AjPList list,
AjPStr x
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List to be changed. |
AjPStr | x | Modify | String to append. |
void | | RETURN | |
Input & Output
list: | (Modify) | List to be changed. |
x: | (Modify) | String to append. |
Returns
Description
Add a new node at the end of the list and add the
data pointer.
See Also
See other functions in this section
Availability
In release 6.4.0
Adds a list to the start of the current list, then deletes the second list.
Synopsis
Prototype
void ajListstrPushlist (
AjPList list,
AjPList* Plist
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List. |
AjPList* | Plist | Delete | List to be merged. |
void | | RETURN | |
Output
Plist: | (Delete) | List to be merged. |
Input & Output
Returns
Description
Adds a list to the start of the current list, then deletes the second list.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajListstrMap ajListstrReverse
For each node in the list call function apply,
with the address of the string and a client pointer.
Synopsis
Prototype
void ajListstrMap (
AjPList list,
void function apply,
void* cl
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List. |
void function | apply | Function | Function to call for each list item. |
void* | cl | Modify | Standard, usually NULL. |
void | | RETURN | |
Input
apply: | (Function) | Function to call for each list item. |
Input & Output
list: | (Modify) | List. |
cl: | (Modify) | Standard, usually NULL. |
Returns
Description
For each node in the list call function apply,
with the address of the string and a client pointer.
See Also
See other functions in this section
Availability
In release 6.4.0
Reverse the order of the nodes in a string list.
Synopsis
Prototype
void ajListstrReverse (
AjPList list
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List |
void | | RETURN | |
Input & Output
Returns
Description
Reverse the order of the nodes in a string list.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajListstrPop ajListstrPopLast
Remove the first node but set pointer to data first.
Synopsis
Prototype
AjBool ajListstrPop (
AjPList list,
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List |
AjPStr* | Pstr | Output | String |
AjBool | | RETURN | ajTrue on success. |
Output
Input & Output
Returns
AjBool: | ajTrue on success. |
Description
Remove the first node but set pointer to data first.
See Also
See other functions in this section
Availability
In release 6.4.0
Remove the last node but set pointer to data first.
Synopsis
Prototype
AjBool ajListstrPopLast (
AjPList list,
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List |
AjPStr* | Pstr | Output | String |
AjBool | | RETURN | ajTrue on success. |
Output
Input & Output
Returns
AjBool: | ajTrue on success. |
Description
Remove the last node but set pointer to data first.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajListstrGetLength ajListstrMapfind ajListstrMapread ajListstrPeek ajListstrToarray ajListstrToarrayAppend
get the number of nodes in the linked list.
Synopsis
Prototype
ajuint ajListstrGetLength (
const AjPList list
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | List |
ajuint | | RETURN | Number of nodes in list. |
Input
Returns
ajuint: | Number of nodes in list. |
Description
get the number of nodes in the linked list.
See Also
See other functions in this section
Availability
In release 6.4.0
For each node in the list call function apply and return
ajTrue when any node is matched by the function.
Synopsis
Prototype
AjBool ajListstrMapfind (
const AjPList list,
AjBool function apply,
void* cl
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | List |
AjBool function | apply | Function | Function to call to test each list item. |
void* | cl | Modify | Standard, usually NULL. |
AjBool | | RETURN | ajTrue on success. |
Input
list: | (Input) | List |
apply: | (Function) | Function to call to test each list item. |
Input & Output
cl: | (Modify) | Standard, usually NULL. |
Returns
AjBool: | ajTrue on success. |
Description
For each node in the list call function apply and return
ajTrue when any node is matched by the function.
See Also
See other functions in this section
Availability
In release 6.4.0
For each node in the list call function apply,
with the address of the string and a client pointer.
The apply function must not modify the list elements.
Synopsis
Prototype
void ajListstrMapread (
const AjPList list,
void* function apply,
void* cl
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | List. |
void* function | apply | Function | Function to call for each list item. |
void* | cl | Modify | Standard, usually NULL. |
void | | RETURN | |
Input
list: | (Input) | List. |
apply: | (Function) | Function to call for each list item. |
Input & Output
cl: | (Modify) | Standard, usually NULL. |
Returns
Description
For each node in the list call function apply,
with the address of the string and a client pointer.
The apply function must not modify the list elements.
See Also
See other functions in this section
Availability
In release 6.4.0
Return the first node but keep it on the list.
Synopsis
Prototype
AjBool ajListstrPeek (
const AjPList list,
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | List |
AjPStr* | Pstr | Output | String |
AjBool | | RETURN | ajTrue on success. |
Input
Output
Returns
AjBool: | ajTrue on success. |
Description
Return the first node but keep it on the list.
See Also
See other functions in this section
Availability
In release 6.4.0
create an array of the pointers to the data.
Synopsis
Prototype
ajuint ajListstrToarray (
const AjPList list,
AjPStr** array
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | List |
AjPStr** | array | Output | Array of Strings. |
ajuint | | RETURN | Size of array of pointers. |
Input
Output
array: | (Output) | Array of Strings. |
Returns
ajuint: | Size of array of pointers. |
Description
create an array of the pointers to the data.
See Also
See other functions in this section
Availability
In release 6.4.0
append to an array of the pointers to the data.
Synopsis
Prototype
ajuint ajListstrToarrayAppend (
const AjPList list,
AjPStr** array
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | List |
AjPStr** | array | Output | Array of Strings. |
ajuint | | RETURN | Size of array of pointers. |
Input
Output
array: | (Output) | Array of Strings. |
Returns
ajuint: | Size of array of pointers. |
Description
append to an array of the pointers to the data.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajListstrTrace
Traces through a string list and validates it
Synopsis
Prototype
void ajListstrTrace (
const AjPList list
);
Type | Name | Read/Write | Description |
const AjPList | list | Input | list to be traced. |
void | | RETURN | |
Input
list: | (Input) | list to be traced. |
Returns
Description
Traces through a string list and validates it
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajListstrFree ajListstrFreeData
Free the list. Do not attempt to free the nodes.
For use where the node data has been saved elsewhere, for example
by ajListToarray or where the list is a temporary structure
referring to permanent data.
Synopsis
Prototype
void ajListstrFree (
AjPList* Plist
);
Type | Name | Read/Write | Description |
AjPList* | Plist | Delete | List |
void | | RETURN | |
Output
Returns
Description
Free the list. Do not attempt to free the nodes.
For use where the node data has been saved elsewhere, for example
by ajListToarray or where the list is a temporary structure
referring to permanent data.
See Also
See other functions in this section
Availability
In release 6.4.0
Free all nodes in a string list.
Also deletes all the strings. If these are to be preserved,
use ajListstrDel instead.
Synopsis
Prototype
void ajListstrFreeData (
AjPList* Plist
);
Type | Name | Read/Write | Description |
AjPList* | Plist | Delete | List |
void | | RETURN | |
Output
Returns
Description
Free all nodes in a string list.
Also deletes all the strings. If these are to be preserved,
use ajListstrDel instead.
See Also
See other functions in this section
Availability
In release 6.4.0
String list iterators
Sections: stepping modifiers Trace functions
Functions: ajListstrIterGet ajListstrIterGetBack
Returns next item using iterator, or steps off the end.
Synopsis
Prototype
AjPStr ajListstrIterGet (
AjIList iter
);
Type | Name | Read/Write | Description |
AjIList | iter | Modify | List iterator. |
AjPStr | | RETURN | Data item returned. |
Input & Output
iter: | (Modify) | List iterator. |
Returns
AjPStr: | Data item returned. |
Description
Returns next item using iterator, or steps off the end.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns next item using back iterator.
Synopsis
Prototype
AjPStr ajListstrIterGetBack (
AjIList iter
);
Type | Name | Read/Write | Description |
AjIList | iter | Modify | List iterator. |
AjPStr | | RETURN | Data item returned. |
Input & Output
iter: | (Modify) | List iterator. |
Returns
AjPStr: | Data item returned. |
Description
Returns next item using back iterator.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajListstrIterInsert ajListstrIterRemove
Insert an item in a list, using an iterator (if not null)
to show which position to insert. Otherwise, simply push.
Synopsis
Prototype
void ajListstrIterInsert (
AjIList iter,
AjPStr str
);
Type | Name | Read/Write | Description |
AjIList | iter | Modify | List iterator. |
AjPStr | str | Modify | String to insert. |
void | | RETURN | |
Input & Output
iter: | (Modify) | List iterator. |
str: | (Modify) | String to insert. |
Returns
Description
Insert an item in a list, using an iterator (if not null)
to show which position to insert. Otherwise, simply push.
See Also
See other functions in this section
Availability
In release 6.4.0
Remove an item from a list, using an iterator (if not null)
to show which item. Otherwise remove the first item.
We want to remove the item just fetched by the iterator.
Synopsis
Prototype
void ajListstrIterRemove (
AjIList iter
);
Type | Name | Read/Write | Description |
AjIList | iter | Modify | List iterator. |
void | | RETURN | |
Input & Output
iter: | (Modify) | List iterator. |
Returns
Description
Remove an item from a list, using an iterator (if not null)
to show which item. Otherwise remove the first item.
We want to remove the item just fetched by the iterator.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajListstrIterTrace
Traces a list iterator and validates it
Synopsis
Prototype
void ajListstrIterTrace (
const AjIList iter
);
Type | Name | Read/Write | Description |
const AjIList | iter | Input | List iterator to be traced. |
void | | RETURN | |
Input
iter: | (Input) | List iterator to be traced. |
Returns
Description
Traces a list iterator and validates it
See Also
See other functions in this section
Availability
In release 6.4.0