Created a tokenizer and the supporting code, currently processes text that is not a string literal.
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
#include "../includes/array.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#define ARRAY_DEFAULT_CAPACITY 32
|
||||
|
||||
struct _array* ArrayCreate(void) {
|
||||
struct _array* array = calloc(1, sizeof(Array));
|
||||
|
||||
array->Items = calloc(ARRAY_DEFAULT_CAPACITY, sizeof(void*));
|
||||
array->Capacity = ARRAY_DEFAULT_CAPACITY;
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
int ArrayAdd(struct _array* array, void* item) {
|
||||
if (!array) return 0;
|
||||
|
||||
if (array->Size == array->Capacity) {
|
||||
array->Items = realloc(array->Items, array->Capacity * 2 * sizeof(void*));
|
||||
|
||||
array->Capacity *= 2;
|
||||
}
|
||||
|
||||
array->Items[array->Size] = item;
|
||||
array->Size++;
|
||||
|
||||
return 1;
|
||||
}
|
||||
Reference in New Issue
Block a user