mirror of
https://github.com/cc65/cc65.git
synced 2025-08-13 08:25:28 +00:00
Added CollPop
git-svn-id: svn://svn.cc65.org/cc65/trunk@714 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -195,6 +195,20 @@ const void* CollConstLast (const Collection* C)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void* CollPop (Collection* C)
|
||||||
|
/* Remove the last segment from the stack and return it. Calls FAIL if the
|
||||||
|
* collection is empty.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
/* We must have at least one entry */
|
||||||
|
PRECONDITION (C->Count > 0);
|
||||||
|
|
||||||
|
/* Return the element */
|
||||||
|
return C->Items[--C->Count];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int CollIndex (Collection* C, const void* Item)
|
int CollIndex (Collection* C, const void* Item)
|
||||||
/* Return the index of the given item in the collection. Return -1 if the
|
/* Return the index of the given item in the collection. Return -1 if the
|
||||||
* item was not found in the collection.
|
* item was not found in the collection.
|
||||||
|
@@ -102,6 +102,11 @@ void* CollLast (Collection* C);
|
|||||||
const void* CollConstLast (const Collection* C);
|
const void* CollConstLast (const Collection* C);
|
||||||
/* Return the last item in a collection */
|
/* Return the last item in a collection */
|
||||||
|
|
||||||
|
void* CollPop (Collection* C);
|
||||||
|
/* Remove the last segment from the stack and return it. Calls FAIL if the
|
||||||
|
* collection is empty.
|
||||||
|
*/
|
||||||
|
|
||||||
int CollIndex (Collection* C, const void* Item);
|
int CollIndex (Collection* C, const void* Item);
|
||||||
/* Return the index of the given item in the collection. Return -1 if the
|
/* Return the index of the given item in the collection. Return -1 if the
|
||||||
* item was not found in the collection.
|
* item was not found in the collection.
|
||||||
|
Reference in New Issue
Block a user