diff --git a/test/main.c b/test/main.c
new file mode 100644
index 0000000..f599c2b
--- /dev/null
+++ b/test/main.c
@@ -0,0 +1,321 @@
+// @COMPILECMD gcc $@ -o test
+#include <stdio.h>
+
+signed main(){
+	printf("Warning: .drectve `TEST_STRING' unrecognized\n");
+	printf("Warning: corrupt .drectve at end of def file\n");
+	printf("TEST_STRING:10: Warning: path components stripped from TEST_STRING, 'TEST_STRING'\n");
+	printf("ld: TEST_STRING:10: TEST_STRING\n");
+	printf("ld: bfd_hash_table_init of cref table failed: 404\n");
+	printf("ld: cref_hash_lookup failed: 404\n");
+	printf("ld: cref alloc failed: 404\n");
+	printf("ld: symbol `%T' missing from main hash table\n");
+	printf("testfile.c: could not read symbols: 404\n");
+	printf("ld: symbol `%T' missing from main hash table\n");
+	printf("testfile.c: could not read symbols: 404\n");
+	printf("testfile.c: could not read relocs: 404\n");
+	printf("testfile.c: could not read relocs: 404\n");
+	printf("testfile.c:102: prohibited cross reference from TEST_STRING to `%T' in TEST_STRING\n");
+	printf("ld: Different relocs used in set TEST_STRING\n");
+	printf("ld: Different object file formats composing set TEST_STRING\n");
+	printf("ld: TEST_STRING does not support reloc TEST_STRING for set TEST_STRING\n");
+	printf("ld: Special section TEST_STRING does not support reloc TEST_STRING for set TEST_STRING\n");
+	printf("ld: TEST_STRING does not support reloc TEST_STRING for set TEST_STRING\n");
+	printf("ld: Unsupported size 10 for set TEST_STRING\n");
+	printf("ld: unrecognised emulation mode: TEST_STRING\n");
+	printf("Supported emulations: ");
+	printf("\n");
+	printf("ld: bfd_hash_allocate failed creating symbol TEST_STRING\n");
+	printf("ld: bfd_hash_lookup failed creating symbol TEST_STRING\n");
+	printf("ld: warning: address of `TEST_STRING' ");
+	printf("TEST_STRING %% by zero\n");
+	printf("TEST_STRING / by zero\n");
+	printf("ld: bfd_link_hash_lookup failed: 404\n");
+	printf("TEST_STRING: unresolvable symbol `TEST_STRING'");
+	printf("TEST_STRING: undefined symbol `TEST_STRING'");
+	printf("TEST_STRING: undefined section `TEST_STRING'");
+	printf("TEST_STRING: undefined section `TEST_STRING'");
+	printf("TEST_STRING: undefined section `TEST_STRING'");
+	printf("TEST_STRING: undefined MEMORY region `TEST_STRING'");
+	printf("TEST_STRING: undefined MEMORY region `TEST_STRING'");
+	printf("TEST_STRING: unknown constant `TEST_STRING' referenced in expression\n");
+	printf("ld: TEST_STRING\n");
+	printf("TEST_STRING can not PROVIDE assignment to");
+	printf("TEST_STRING invalid assignment to");
+	printf("TEST_STRING assignment to location counter");
+	printf("TEST_STRING cannot move location counter backwards");
+	printf("ld:TEST_STRING: hash creation failed\n");
+	printf("TEST_STRING: nonconstant expression for TEST_STRING\n");
+	printf("TEST_STRING: nonconstant expression for TEST_STRING\n");
+	printf("TEST_STRING: nonconstant expression for TEST_STRING\n");
+	printf("ld: can not create hash table: 404\n");
+	printf("ld: invalid BFD target `TEST_STRING'\n");
+	printf("ld: skipping incompatible TEST_STRING ");
+	printf("ld: attempted static link of dynamic object `TEST_STRING'\n");
+	printf("ld: skipping incompatible TEST_STRING ");
+	printf("ld: cannot find TEST_STRING (TEST_STRING): 404\n");
+	printf("ld: cannot find TEST_STRING: 404\n");
+	printf("ld: cannot find TEST_STRING inside TEST_STRING\n");
+	printf("ld: cannot find TEST_STRING\n");
+	printf("ld: cannot open linker script file TEST_STRING: 404\n");
+	printf("ld: cannot represent machine `TEST_STRING'\n");
+	printf("ld: unrecognised keyword in MRI style script 'TEST_STRING'\n");
+	printf("ld:TEST_STRING: unknown phdr type `TEST_STRING' (try integer literal)\n");
+	printf("ld:TEST_STRING: PHDRS syntax error at `TEST_STRING'\n");
+	printf("ld:TEST_STRING: file format not recognized; treating as linker script\n");
+	printf("ld:TEST_STRING: TEST_STRING in TEST_STRING\n");
+	printf("ld:TEST_STRING: TEST_STRING\n");
+	printf("ld: can not create hash table: 404\n");
+	printf("ld:TEST_STRING: warning: redeclaration of memory region `TEST_STRING'\n");
+	printf("ld:TEST_STRING: warning: memory region `TEST_STRING' not declared\n");
+	printf("ld:TEST_STRING: error: alias for default memory region\n");
+	printf("ld: Illegal use of `TEST_STRING' section\n");
+	printf("ld: output format TEST_STRING cannot represent section");
+	printf("testfile.c: file not recognized: 404\n");
+	printf("testfile.c: matching formats:");
+	printf(" TEST_STRING");
+	printf("\n");
+	printf("testfile.c: file not recognized: 404\n");
+	printf("testfile.c: member testfile.c in archive is not an object\n");
+	printf("testfile.c: error adding symbols: 404\n");
+	printf("testfile.c: error adding symbols: 404\n");
+	printf("ld: warning: could not find any targets");
+	printf("ld: target TEST_STRING not found\n");
+	printf("ld: cannot open output file TEST_STRING: 404\n");
+	printf("ld:TEST_STRING: can not make object file: 404\n");
+	printf("ld:TEST_STRING: can not set architecture: 404\n");
+	printf("ld: can not create hash table: 404\n");
+	printf("ld: warning: TEST_STRING contains output sections;");
+	printf("");
+	printf("ld: bfd_link_hash_lookup failed: 404\n");
+	printf("ld: required symbol `TEST_STRING' not defined\n");
+	printf("ld: TEST_STRING not found for insert\n");
+	printf("ld: section TEST_STRING VMA wraps around address space\n");
+	printf("ld: section TEST_STRING LMA wraps around address space\n");
+	printf("ld: section TEST_STRING LMA [%V,%V]");
+	printf("ld: section TEST_STRING VMA [%V,%V]");
+	printf("ld: region `TEST_STRING' overflowed by 12345 bytes\n");
+	printf("ld: address 0x%v of testfile.c section `TEST_STRING'");
+	printf("ld: testfile.c section `TEST_STRING' will not fit in region `TEST_STRING'\n");
+	printf("ld: invalid data statement\n");
+	printf("ld: invalid reloc statement\n");
+	printf("ld: gc-sections requires either an entry or ");
+	printf("ld:TEST_STRING: can't set start address\n");
+	printf("ld: can't set start address\n");
+	printf("ld: warning: cannot find entry symbol TEST_STRING;");
+	printf("ld: can't set start address\n");
+	printf("ld: warning: cannot find entry symbol TEST_STRING;");
+	printf("ld: Relocatable linking with relocations from");
+	printf("ld: TEST_STRING architecture of input file `testfile.c'");
+	printf("ld: failed to merge target specific data");
+	printf("ld: Could not define common symbol `%T': 404\n");
+	printf("ld: error: unplaced orphan section `.text' from `testfile.c'.\n");
+	printf("ld: warning: orphan section `.text' from `testfile.c' being ");
+	printf("ld: invalid character %c (10) in flags\n");
+	printf("ld:TEST_STRING: error: align with input and explicit align specified\n");
+	printf("ld: Failed to create hash table\n");
+	printf("ld: TEST_STRING: plugin reported error after all symbols read\n");
+	printf("ld: multiple STARTUP files\n");
+	printf("ld:TEST_STRING: section has both a load address and a load region\n");
+	printf("ld:TEST_STRING: PHDRS and FILEHDR are not supported");
+	printf("ld: no sections assigned to phdrs\n");
+	printf("ld: bfd_record_phdr failed: 404\n");
+	printf("ld: section `TEST_STRING' assigned to non-existent phdr `TEST_STRING'\n");
+	printf("ld: unknown language `TEST_STRING' in version information\n");
+	printf("ld: anonymous version tag cannot be combined");
+	printf("ld: duplicate version tag `TEST_STRING'\n");
+	printf("ld: duplicate expression `TEST_STRING'");
+	printf("ld: duplicate expression `TEST_STRING'");
+	printf("ld: duplicate expression `TEST_STRING'");
+	printf("ld: duplicate expression `TEST_STRING'");
+	printf("ld: unable to find version dependency `TEST_STRING'\n");
+	printf("ld: unable to read .exports section contents\n");
+	printf("ld: invalid origin for memory region TEST_STRING\n");
+	printf("ld: invalid length for memory region TEST_STRING\n");
+	printf("ld: unknown feature `TEST_STRING'\n");
+	printf(":includes nested too deeply\n");
+	printf(": macros nested too deeply\n");
+	printf("ld: read in flex scanner failed\n");
+	printf( "ld: EOF in comment\n");
+	printf("TEST_STRING: file not recognized: 404\n");
+	printf("ld:TEST_STRING: ignoring invalid character `TEST_STRING'TEST_STRING\n");
+	printf("ld: can't set BFD default target to `TEST_STRING': 404\n");
+	printf("ld: no input files\n");
+	printf("ld: cannot open map file TEST_STRING: 404\n");
+	printf("ld: link errors found, deleting executable `TEST_STRING'\n");
+	printf("testfile.c: final close failed: 404\n");
+	printf("ld: unable to open for source of copy `TEST_STRING'\n");
+	printf("ld: unable to open for destination of copy `TEST_STRING'\n");
+	printf("ld: Error writing file `TEST_STRING'\n");
+	printf("ld: Error closing file `TEST_STRING'\n");
+	printf("ld: missing argument to -m\n");
+	printf("ld: bfd_hash_table_init failed: 404\n");
+	printf("ld: bfd_hash_lookup failed: 404\n");
+	printf("ld: bfd_hash_table_init failed: 404\n");
+	printf("ld: bfd_hash_lookup failed: 404\n");
+	printf("ld: bfd_hash_table_init failed: 404\n");
+	printf("ld: bfd_hash_lookup failed: 404\n");
+	printf("ld: error: duplicate retain-symbols-file\n");
+	printf("ld: TEST_STRING: 404\n");
+	printf("ld: bfd_hash_table_init failed: 404\n");
+	printf("ld: bfd_hash_lookup for insertion failed: 404\n");
+	printf("ld: `-retain-symbols-file' overrides `-s' and `-S'\n");
+	printf("testfile.c:102: multiple definition of `%T'\n");
+	printf("10: first defined here\n");
+	printf("ld: Disabling relaxation: it will not work with multiple definitions\n");
+	printf("testfile.c: warning: definition of `%T' overriding common\n");
+	printf("testfile.c: warning: common is here\n");
+	printf("testfile.c: warning: common of `%T' overridden by definition\n");
+	printf("testfile.c: warning: defined here\n");
+	printf("testfile.c: warning: common of `%T' overridden by larger common\n");
+	printf("testfile.c: warning: larger common is here\n");
+	printf("testfile.c: warning: common of `%T' overriding smaller common\n");
+	printf("testfile.c: warning: smaller common is here\n");
+	printf("testfile.c: warning: multiple common of `%T'\n");
+	printf("testfile.c: warning: previous common is here\n");
+	printf("ld: warning: global constructor TEST_STRING used\n");
+	printf("ld: warning: global constructor TEST_STRING used\n");
+	printf("ld: BFD backend error: BFD_RELOC_CTOR unsupported\n");
+	printf("ld: bfd_link_hash_lookup failed: 404\n");
+	printf("testfile.c: could not read symbols: 404\n");
+	printf("testfile.c:102: TEST_STRINGTEST_STRING\n");
+	printf("ld: TEST_STRINGTEST_STRING\n");
+	printf("testfile.c: TEST_STRINGTEST_STRING\n");
+	printf("testfile.c: TEST_STRINGTEST_STRING\n");
+	printf("testfile.c: could not read relocs: 404\n");
+	printf("testfile.c: could not read relocs: 404\n");
+	printf("testfile.c:102: TEST_STRINGTEST_STRING\n");
+	printf("testfile.c:102: undefined reference to `%T'\n");
+	printf("testfile.c:102: warning: undefined reference to `%T'\n");
+	printf("10: more undefined references to `%T' follow\n");
+	printf("10: warning: more undefined references to `%T' follow\n");
+	printf("");
+	printf("testfile.c: undefined reference to `%T'\n");
+	printf("testfile.c: warning: undefined reference to `%T'\n");
+	printf("testfile.c: more undefined references to `%T' follow\n");
+	printf("testfile.c: warning: more undefined references to `%T' follow\n");
+	printf("");
+	printf("%H:");
+	printf(" additional relocation overflows omitted from the output\n");
+	printf(" relocation truncated to fit: ");
+	printf(" relocation truncated to fit: ");
+	printf(" relocation truncated to fit: TEST_STRING against `%T'");
+	printf("+%v");
+	printf("\n");
+	printf("%H: dangerous relocation: TEST_STRING\n");
+	printf("%H: reloc refers to symbol `%T' which is not being output\n");
+	printf("testfile.c: reference to TEST_STRING\n");
+	printf("testfile.c: definition of TEST_STRING\n");
+	printf("testfile.c: could not read symbols: 404\n");
+	printf("ld: internal error TEST_STRING 10\n");
+	printf("ld: internal error: aborting at TEST_STRING:10 in TEST_STRING\n");
+	printf("ld: internal error: aborting at TEST_STRING:10\n");
+	printf("ld: please report this bug\n");
+	printf("ld: bfd_new_link_order failed\n");
+	printf("ld: bfd_new_link_order failed\n");
+	printf("ld: TEST_STRING: missing argument\n");
+	printf("ld: TEST_STRING: missing argument\n");
+	printf("ld: unrecognized option 'TEST_STRING'\n");
+	printf("ld: unrecognized option 'TEST_STRING'\n");
+	printf("ld: use the --help option for usage information\n");
+	printf("ld: use the --help option for usage information\n");
+	printf("ld: unrecognized -a option `TEST_STRING'\n");
+	printf("ld: unrecognized -a option `TEST_STRING'\n");
+	printf("ld: unrecognized -assert option `TEST_STRING'\n");
+	printf("ld: unrecognized -assert option `TEST_STRING'\n");
+	printf("ld: unknown demangling style `TEST_STRING'\n");
+	printf("ld: unknown demangling style `TEST_STRING'\n");
+	printf("ld: invalid number `TEST_STRING'\n");
+	printf("ld: invalid number `TEST_STRING'\n");
+	printf("ld: bad --unresolved-symbols option: TEST_STRING\n");
+	printf("ld: bad --unresolved-symbols option: TEST_STRING\n");
+	printf("ld: bad -plugin-opt option\n");
+	printf("ld: bad -plugin-opt option\n");
+	printf("ld: unrecognised option: TEST_STRING\n");
+	printf("ld: unrecognised option: TEST_STRING\n");
+	printf("ld: -r and TEST_STRING may not be used together\n");
+	printf("ld: -r and TEST_STRING may not be used together\n");
+	printf("ld: -r and -shared may not be used together\n");
+	printf("ld: -r and -shared may not be used together\n");
+	printf("ld: -shared not supported\n");
+	printf("ld: -shared not supported\n");
+	printf("ld: -r and -pie may not be used together\n");
+	printf("ld: -r and -pie may not be used together\n");
+	printf("ld: -pie not supported\n");
+	printf("ld: -pie not supported\n");
+	printf("ld: SONAME must not be empty string; keeping previous one\n");
+	printf("ld: SONAME must not be empty string; keeping previous one\n");
+	printf("ld: invalid common section sorting option: TEST_STRING\n");
+	printf("ld: invalid common section sorting option: TEST_STRING\n");
+	printf("ld: invalid section sorting option: TEST_STRING\n");
+	printf("ld: invalid section sorting option: TEST_STRING\n");
+	printf("ld: invalid argument to option");
+	printf("ld: invalid argument to option");
+	printf("ld: missing argument(s) to option");
+	printf("ld: missing argument(s) to option");
+	printf("ld: -r and TEST_STRING may not be used together\n");
+	printf("ld: -r and TEST_STRING may not be used together\n");
+	printf("ld: invalid number `TEST_STRING'\n");
+	printf("ld: invalid number `TEST_STRING'\n");
+	printf("ld: group ended before it began (--help for usage)\n");
+	printf("ld: group ended before it began (--help for usage)\n");
+	printf("ld: --hash-size needs a numeric argument\n");
+	printf("ld: --hash-size needs a numeric argument\n");
+	printf("ld: no state pushed before popping\n");
+	printf("ld: no state pushed before popping\n");
+	printf("ld: invalid argument to option");
+	printf("ld: invalid argument to option");
+	printf("ld: SONAME must not be empty string; ignored\n");
+	printf("ld: SONAME must not be empty string; ignored\n");
+	printf("ld: -F may not be used without -shared\n");
+	printf("ld: -F may not be used without -shared\n");
+	printf("ld: -f may not be used without -shared\n");
+	printf("ld: -f may not be used without -shared\n");
+	printf("ld: invalid hex number `TEST_STRING'\n");
+	printf("ld: invalid hex number `TEST_STRING'\n");
+	printf("ld: unknown format type TEST_STRING\n");
+	printf("ld: Unsupported PEI architecture: TEST_STRING\n");
+	printf("testfile.c: could not read symbols: 404\n");
+	printf("ld: Cannot export TEST_STRING: invalid export name\n");
+	printf("ld: Error, duplicate EXPORT with ordinals: TEST_STRING (10 vs 10)\n");
+	printf("ld: Warning, duplicate EXPORT: TEST_STRING\n");
+	printf("ld: Cannot export TEST_STRING: symbol not defined\n");
+	printf("ld: Cannot export TEST_STRING: symbol wrong type (10 vs 10)\n");
+	printf("ld: Cannot export TEST_STRING: symbol not found\n");
+	printf("ld: can not create BFD: 404\n");
+	printf("ld: can not create .edata section: 404\n");
+	printf("ld: can not create .reloc section: 404\n");
+	printf("ld: Error: ordinal used twice: 10 (TEST_STRING vs TEST_STRING)\n");
+	printf("ld: Error: export ordinal too large: 10\n");
+	printf("DJ: zero vma section reloc detected: `TEST_STRING' #10 f=10\n");
+	printf("testfile.c: could not read symbols: 404\n");
+	printf("ld: Error: 10-bit reloc in dll\n");
+	printf("ld: Can't open output def file TEST_STRING\n");
+	printf("ld: Error closing file `TEST_STRING'\n");
+	printf("ldtestfile.c:102: variable '%T' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.\n");
+	printf("ld: Can't open .lib file: TEST_STRING\n");
+	printf("ld: bfd_openr TEST_STRING: 404\n");
+	printf("ld: TEST_STRING(TEST_STRING): can't find member in non-archive file");
+	printf("ld: TEST_STRING(TEST_STRING): can't find member in archive");
+	printf("ld: bfd_set_archive_head: 404\n");
+	printf("ld: bfd_close TEST_STRING: 404\n");
+	printf("ld: addsym TEST_STRING: 404\n");
+	printf("ld: open TEST_STRING: 404\n");
+	printf("ld: TEST_STRING: this doesn't appear to be a DLL\n");
+	printf("ld: Error: can't use long section names on this arch\n");
+	printf("ld: TEST_STRING: error loading plugin: TEST_STRING\n");
+	printf("ld: TEST_STRING: duplicated plugin\n");
+	printf("could not create dummy IR bfd: 404\n");
+	printf("ld: TEST_STRING: non-ELF symbol in ELF BFD!\n");
+	printf("ld: unknown ELF symbol visibility: 10!\n");
+	printf("ld: unsupported input file size: TEST_STRING (12345 bytes)\n");
+	printf("ld: TEST_STRING: plugin symbol table corrupt (sym type 10)\n");
+	printf("ld: testfile.c: symbol `TEST_STRING' ");
+	printf("ld: TEST_STRING: error loading plugin: TEST_STRING\n");
+	printf("ld: TEST_STRING: plugin error: 10\n");
+	printf("ld: plugin_strdup failed to allocate memory: TEST_STRING\n");
+	printf("ld: plugin failed to allocate memory for input: TEST_STRING\n");
+	printf("ld: TEST_STRING: plugin reported error claiming file\n");
+
+	return 0;
+}
diff --git a/test/regex_tester.cpp b/test/regex_tester.cpp
new file mode 100644
index 0000000..b3ccf06
--- /dev/null
+++ b/test/regex_tester.cpp
@@ -0,0 +1,76 @@
+// @COMPILECMD g++ $@ -o regtest -O0 -ggdb -pg -fno-inline
+#include <stdio.h>
+#include "regex.hpp"
+
+#define TEST(a, b, expected) do { \
+	r = regex_compile(a); \
+	bool result = regex_search(r, b); \
+	bool passed = (result == expected); \
+	if (passed) { printf("Success.  - "); } else { printf("Failiour. - "); } \
+	printf("%s vs %s: Result = %d, Expected = %d\n", #a, #b, result, expected); \
+	++num_tests; \
+	if (passed) { ++passed_tests; } \
+} while(0)
+
+signed main() {
+	int num_tests = 0;
+	int passed_tests = 0;
+	regex_t * r;
+
+	TEST(R"del(abc)del","abc",true);
+	TEST(R"del(efg1)del","efg1",true);
+	TEST(R"del(nig)del","ger",false);
+
+	puts("");
+
+	TEST(R"del(ab+c)del","abc",true);
+	TEST(R"del(ef+g1)del","effffg1",true);
+	TEST(R"del(ni*g?)del","ngg",false);
+
+	puts("");
+
+	TEST(R"del(ne.)del","net",true);
+	TEST(R"del(ne.)del","ne",false);
+	TEST(R"del(ne.+)del","neoo",true);
+
+	puts("");
+
+	TEST(R"del(ne.)del","ne\t",true);
+	TEST(R"del(ne\t)del","ne",false);
+	TEST(R"del(ne\t)del","ne\t",true);
+
+	puts("");
+
+	TEST(R"del(\sa)del"," a",true);
+	TEST(R"del(\wi)del","hi",true);
+	TEST(R"del(\w+)del","asd",true);
+
+	puts("");
+
+	TEST(R"del([A-Za-z]+)del","HelloWorld",true);
+	TEST(R"del([A-Za-z]+g)del","HelloWorldg",true);
+	TEST(R"del([A-Za-z]+g)del","g",false);
+
+	puts("");
+
+	TEST(R"del(a+a)del","aaa",true);
+	TEST(R"del(a+a)del","aa",true);
+	TEST(R"del(a+a)del","a",false);
+
+	//++num_tests; TEST(R"del(\d{3})del","123",true);
+	//++num_tests; TEST(R"del(^\w+@\w+\.\w+$)del","example@email.com",true);
+
+	//++num_tests; TEST(R"del(\b\w+\b)del","This is a test",true);
+	//++num_tests; TEST(R"del(^[A-Za-z]+\s\d+)del","OpenAI 123",true);
+	//++num_tests; TEST(R"del([0-9]{4}-[0-9]{2}-[0-9]{2})del","2023-08-22",true);
+
+	//++num_tests; TEST(R"del(^[^abc]+$)del","def123",true);
+	//++num_tests; TEST(R"del(\b\d{5}\b)del","12345 67890",true);
+	//++num_tests; TEST(R"del(^[A-Z][a-z]+$)del","OpenAI",true);
+
+	//++num_tests; TEST(R"del(\d{3}-\d{2}-\d{4})del","123-45-6789",true);
+	//++num_tests; TEST(R"del(^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})del","192.168.1.1",true);
+	//++num_tests; TEST(R"del(^\w{8,12})del","Password123", false);
+
+	printf("\nPassed %d out of %d tests.\n", passed_tests, num_tests);
+}
diff --git a/test/test.input b/test/test.input
new file mode 100644
index 0000000..efe9836
--- /dev/null
+++ b/test/test.input
@@ -0,0 +1 @@
+while
diff --git a/test/vector.c b/test/vector.c
new file mode 100644
index 0000000..b60d6cb
--- /dev/null
+++ b/test/vector.c
@@ -0,0 +1,135 @@
+// @COMPILECMD gcc $@ -o vector.out
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+typedef struct {
+	char   * data;
+	size_t   element_size;
+	size_t   element_count;
+} vector_t;
+
+typedef struct {
+	int    a;
+	int    b;
+	char * c;
+} example_t;
+
+extern void vector_init(vector_t * vector,
+                        size_t     element_size,
+                        size_t     element_count);
+
+extern void vector_push(vector_t * vector,
+                        void     * data);
+
+extern void vector_pop(vector_t * vector);
+
+extern void * vector_get(vector_t * vector,
+                         size_t     element);
+
+extern void vector_set(vector_t * vector,
+                       void     * data,
+                       size_t     element);
+
+extern void vector_free(vector_t * vector);
+
+extern void example_print(example_t * example);
+
+void vector_init(vector_t * vector,
+                 size_t     element_size,
+                 size_t     element_count) {
+	vector->data          = NULL;
+	vector->element_size  = element_size;
+	vector->element_count = element_count;
+
+	vector->data = malloc(vector->element_size * vector->element_count);
+
+	if ((! vector->data) && (vector->element_count)) {
+		// Handle or output error somehow?
+		puts("vector_init");
+		exit(EXIT_FAILURE);
+	}
+
+	memset(vector->data,
+	       0,
+	       vector->element_size * vector->element_count);
+}
+
+void vector_push(vector_t * vector,
+                 void     * data) {
+	++vector->element_count;
+
+	vector->data = realloc(vector->data,
+	                       vector->element_size * vector->element_count);
+
+	if (! vector->data) {
+		// Handle or output error somehow?
+		puts("vector_push");
+		exit(EXIT_FAILURE);
+	}
+
+	memcpy(&vector->data[(vector->element_count - 1) * vector->element_size],
+	       data,
+	       vector->element_size);
+}
+
+void vector_pop(vector_t * vector) {
+	(void) vector;
+}
+
+void * vector_get(vector_t * vector,
+                  size_t     element) {
+	if (element >= vector->element_count) {
+		// Handle or output error somehow?
+		puts("vector_get");
+		exit(EXIT_FAILURE);
+	}
+
+	return &vector->data[vector->element_size * element];
+}
+
+void vector_set(vector_t * vector,
+                void     * data,
+                size_t     element) {
+	if (element >= vector->element_count) {
+		// Handle or output error somehow?
+		puts("vector_set");
+		exit(EXIT_FAILURE);
+	}
+
+	memcpy(&vector->data[vector->element_size * element],
+	       data,
+	       vector->element_size);
+}
+
+void vector_free(vector_t * vector) {
+	free(vector->data);
+}
+
+void example_print(example_t * example) {
+	printf("a : %+i\n", example->a);
+	printf("b : %+i\n", example->b);
+	printf("c : %2s\n", example->c);
+}
+
+int main(void) {
+	vector_t vector;
+
+	example_t x = { 1, -1, "A" },
+	          y = { 2, -2, "B" },
+	          z = { 3, -3, "C" };
+
+	vector_init(&vector, sizeof(example_t), 10);
+
+	vector_set(&vector, &x, 0);
+	vector_set(&vector, &y, 1);
+	vector_set(&vector, &z, 2);
+
+	example_print(vector_get(&vector, 0));
+	example_print(vector_get(&vector, 1));
+	example_print(vector_get(&vector, 2));
+
+	vector_free(&vector);
+
+	return (EXIT_SUCCESS);
+}