diff --git a/.gitignore b/.gitignore index b7155f2e41158af5618deeda9e075c09d6cdca52..6688a4ac7b8667e75386ee1e22f770689043ef13 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ *.o */*.o */*.x +*.gch diff --git a/lst-vector/Makefile b/lst-vector/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..e94ac0785d27b8accb796510d12b71c20f08ca32 --- /dev/null +++ b/lst-vector/Makefile @@ -0,0 +1,12 @@ +cc=gcc +LIBS=-Wextra -Wall -g -fsanitize=address -fsanitize=leak -lm + +lst_vec.x: lst_vec.o + $(cc) -o $@ $^ $(LIBS) + +lst_vec.o: lst_vec.c lst_vec.h + $(cc) -c $^ $(LIBS) + +clean: + rm -f *.o *.x *.gch + diff --git a/lst-vector/lst_vec.c b/lst-vector/lst_vec.c new file mode 100644 index 0000000000000000000000000000000000000000..86bca0b1c18fab547ba89c944b9447d415d0761c --- /dev/null +++ b/lst-vector/lst_vec.c @@ -0,0 +1,8 @@ +#include "lst_vec.h" +#include <stdio.h> +#include <stdlib.h> + + +int main() { + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/lst-vector/lst_vec.h b/lst-vector/lst_vec.h new file mode 100644 index 0000000000000000000000000000000000000000..d1a4b57cadfcb5996244b7d542dc9d80b0840256 --- /dev/null +++ b/lst-vector/lst_vec.h @@ -0,0 +1,33 @@ +#ifndef _LST_VEC_H_ +#define _LST_VEC_H_ + +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +#include <assert.h> + + +typedef struct _element { + void *data; + struct _element *next; +} element; + +typedef element* lst_vector; + +lst_vector lst_vector_init(); +int lst_vector_length(lst_vector *v); +element lst_vector_push(lst_vector *v, void *element); +element lst_vector_pop(lst_vector *v); +lst_vector lst_vector_set(lst_vector *v, int index, void *element); +element lst_vector_get(lst_vector *v, int index); +element lst_vector_remove(lst_vector *v, int index); +lst_vector lst_vector_insert(lst_vector *v, void *element, int index); +void lst_vector_empty(lst_vector **v); + +lst_vector lst_vector_map(lst_vector *v, void *(*f)(void *)); +lst_vector lst_vector_filter(lst_vector *v, bool (*f)(void *)); + + +#endif +