merged with herbglitch/master

This commit is contained in:
herbglitch 2024-02-08 17:00:05 -07:00
commit c822075173
8 changed files with 303 additions and 5 deletions

18
include/arc/std/bool.h Normal file
View file

@ -0,0 +1,18 @@
#ifndef ARC_STD_BOOL_H_
#define ARC_STD_BOOL_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#define ARC_Bool bool
#define ARC_True true
#define ARC_False false
#ifdef __cplusplus
}
#endif
#endif //ARC_STD_BOOL_H_

57
include/arc/std/queue.h Normal file
View file

@ -0,0 +1,57 @@
#ifndef ARC_STD_QUEUE_H_
#define ARC_STD_QUEUE_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
/**
* @brief a queue type
*/
typedef struct ARC_Queue ARC_Queue;
/**
* @brief creates ARC_Queue type
*
* @param queue ARC_Queue to initialize
*/
void ARC_Queue_Create(ARC_Queue **queue);
/**
* @brief destroyes ARC_Queue type
*/
void ARC_Queue_Destroy(ARC_Queue *queue);
/**
* @brief pushes value to end of queue
*
* @param queue ARC_Queue to push to
* @param data data that is being pushed
*/
void ARC_Queue_Push(ARC_Queue *queue, void *data);
/**
* @brief pops the front off of the ARC_Queue
*
* @param queue ARC_Queue to remove from
*
* @return the poped data from the queue as a void *
*/
void *ARC_Queue_Pop(ARC_Queue *queue);
/**
* @brief gets size of queue
*
* @param vector ARC_Queue to get size from
*
* @return the queues size
*/
uint32_t ARC_Queue_Size(ARC_Queue *queue);
#ifdef __cplusplus
}
#endif
#endif //ARC_STD_QUEUE_H_

57
include/arc/std/stack.h Normal file
View file

@ -0,0 +1,57 @@
#ifndef ARC_STD_STACK_H_
#define ARC_STD_STACK_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
/**
* @brief a stack type
*/
typedef struct ARC_Stack ARC_Stack;
/**
* @brief creates ARC_Stack type
*
* @param stack ARC_Stack to initialize
*/
void ARC_Stack_Create(ARC_Stack **stack);
/**
* @brief destroyes ARC_Stack type
*/
void ARC_Stack_Destroy(ARC_Stack *stack);
/**
* @brief pushes value on stack
*
* @param stack ARC_Stack to push to
* @param data data that is being pushed
*/
void ARC_Stack_Push(ARC_Stack *stack, void *data);
/**
* @brief pops top off of ARC_Stack
*
* @param stack ARC_Stack to remove from
*
* @return the poped data from the stack as a void *
*/
void *ARC_Stack_Pop(ARC_Stack *stack);
/**
* @brief gets size of stack
*
* @param stack ARC_Stack to get size from
*
* @return the stacks size
*/
uint32_t ARC_Stack_Size(ARC_Stack *stack);
#ifdef __cplusplus
}
#endif
#endif //ARC_STD_STACK_H_

View file

@ -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_