From 875b69c407e71ce3b4bf1299e3b78a3096868997 Mon Sep 17 00:00:00 2001 From: herbglitch Date: Thu, 8 Feb 2024 02:48:08 -0700 Subject: [PATCH] added stack datatype to std --- CMakeLists.txt | 1 + include/arc/std/vector.h | 11 +++++++---- src/std/vector.c | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a748f21..bf660ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,7 @@ set(ARCHEUS_STD_SOURCES src/std/handler.c src/std/hashtable.c src/std/io.c + src/std/stack.c src/std/string.c src/std/vector.c src/std/defaults/config.c diff --git a/include/arc/std/vector.h b/include/arc/std/vector.h index dcf4ff2..f38ec27 100644 --- a/include/arc/std/vector.h +++ b/include/arc/std/vector.h @@ -18,7 +18,7 @@ typedef struct ARC_Vector ARC_Vector; * @param a first data struct * @param b second data struct * - * @return 0 when a == b + * @return 0 when a == b, TODO: return and ARC_Bool */ typedef int32_t (* ARC_Vector_CompareDataFn)(void *a, void *b); @@ -45,8 +45,9 @@ void ARC_Vector_Add(ARC_Vector *vector, void *data); /** * @brief remove from ARC_Vector * - * @param vector ARC_Vector to remove from - * @param data data that is being removed + * @param vector ARC_Vector to remove from + * @param data data that is being removed + * @param compare comparison callback to get check if data should be removed */ void ARC_Vector_Remove(ARC_Vector *vector, void *data, ARC_Vector_CompareDataFn compare); @@ -62,6 +63,8 @@ void ARC_Vector_RemoveIndex(ARC_Vector *vector, uint32_t *index); * @brief gets size of vector * * @param vector ARC_Vector to get size from + * + * @return the pointer of the vectors size, TODO: don't pass as a pointer */ uint32_t *ARC_Vector_Size(ARC_Vector *vector); @@ -79,4 +82,4 @@ void *ARC_Vector_Get(ARC_Vector *vector, uint32_t *index); } #endif -#endif //ARC_STD_VECTOR_H_ +#endif //ARC_STD_VECTOR_H_ \ No newline at end of file diff --git a/src/std/vector.c b/src/std/vector.c index 7e9158b..6ddba58 100644 --- a/src/std/vector.c +++ b/src/std/vector.c @@ -107,4 +107,4 @@ void *ARC_Vector_Get(ARC_Vector *vector, uint32_t *index){ } return vector->data[*index]; -} +} \ No newline at end of file