#pragma once #include #include struct Stack { size_t size; size_t capacity; void* data; }; void stack_init(struct Stack* stack, size_t size); void stack_push(struct Stack* stack, void* data, size_t len); void* stack_pop(struct Stack* stack, size_t len); void stack_free(struct Stack* stack); inline void stack_push_int(struct Stack* stack, int value) { stack_push(stack, &value, sizeof(int)); } inline bool stack_pop_int(struct Stack* stack, int* value) { void* d = stack_pop(stack, sizeof(int)); if (d == NULL) return false; *value = *(int*)(d); return true; }