working on lexer, and updated vector (still needs testing)
This commit is contained in:
parent
cdd6c3976b
commit
6e814f12e6
4 changed files with 195 additions and 3 deletions
|
|
@ -23,6 +23,13 @@ typedef struct ARC_Vector ARC_Vector;
|
|||
*/
|
||||
typedef ARC_Bool (* ARC_Vector_CompareDataFn)(void *dataA, void *dataB);
|
||||
|
||||
/**
|
||||
* @brief a callback that cleans up memory when it is removed from the vector
|
||||
*
|
||||
* @param[in] data the item to delete
|
||||
*/
|
||||
typedef void (* ARC_Vector_DeleteDataFn)(void *data);
|
||||
|
||||
/**
|
||||
* @brief creates an ARC_Vector which is an "expandable" array
|
||||
*
|
||||
|
|
@ -32,8 +39,9 @@ typedef ARC_Bool (* ARC_Vector_CompareDataFn)(void *dataA, void *dataB);
|
|||
* @param[out] vector ARC_Vector to initialize
|
||||
* @param[in] compareDataFn a callback that checks if data stored in the array matches,
|
||||
* if set to NULL and ARC_Vector_Remove is called, the pointer addresses will be compared
|
||||
* @param[in] deleteDataFn a callback that frees an item on remove or clear, can be set to NULL to do nothing
|
||||
*/
|
||||
void ARC_Vector_Create(ARC_Vector **vector, ARC_Vector_CompareDataFn *compareDataFn);
|
||||
void ARC_Vector_Create(ARC_Vector **vector, ARC_Vector_CompareDataFn *compareDataFn, ARC_Vector_DeleteDataFn *deleteDataFn);
|
||||
|
||||
/**
|
||||
* @brief destroys an ARC_Vector
|
||||
|
|
@ -60,6 +68,7 @@ void ARC_Vector_Add(ARC_Vector *vector, void *data);
|
|||
*
|
||||
* @note this function uses the ARC_Vector_CompareDataFn that the ARC_Vector was created with
|
||||
* @note this function will not throw an error if there is no match
|
||||
* @note this function will call ARC_Vector_RemoveIndex, so it's notes are also applicable to this function
|
||||
*
|
||||
* @param[in] vector ARC_Vector to remove from
|
||||
* @param[in] data matching data to remove
|
||||
|
|
@ -70,6 +79,7 @@ void ARC_Vector_Remove(ARC_Vector *vector, void *data);
|
|||
* @brief removes an item from an ARC_Vector at an index
|
||||
*
|
||||
* @note this function will error if trying to remove an index that is outside the bounds of the ARC_Vector
|
||||
* @note this function will use ARC_Vector_DeleteDataFn if it was set in the ARC_Vector_Create function
|
||||
*
|
||||
* @param[in] vector ARC_Vector to remove from
|
||||
* @param[in] index position of data to remove
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue