Kohi Game Engine
stack.h
Go to the documentation of this file.
1 
12 #pragma once
13 
14 #include "defines.h"
15 
20 typedef struct stack {
28  void* memory;
30 
38 KAPI b8 stack_create(stack* out_stack, u32 element_size);
45 
53 KAPI b8 stack_push(stack* s, void* element_data);
54 
64 KAPI b8 stack_pop(stack* s, void* out_element_data);
This file contains global type definitions which are used throughout the entire engine and applicatio...
#define KAPI
Import/export qualifier.
Definition: defines.h:177
unsigned int u32
Unsigned 32-bit integer.
Definition: defines.h:25
_Bool b8
8-bit boolean type
Definition: defines.h:58
KAPI void stack_destroy(stack *s)
Destroys the given stack.
struct stack stack
A simple stack container. Elements may be pushed on or popped off of the stack only.
KAPI b8 stack_push(stack *s, void *element_data)
Pushes an element (a copy of the element data) onto the stack.
KAPI b8 stack_create(stack *out_stack, u32 element_size)
Creates a new stack.
KAPI b8 stack_pop(stack *s, void *out_element_data)
Attempts to pop an element (writing out a copy of the element data on success) from the stack....
A simple stack container. Elements may be pushed on or popped off of the stack only.
Definition: stack.h:20
u32 element_count
The current element count.
Definition: stack.h:24
u32 element_size
The element size in bytes.
Definition: stack.h:22
u32 allocated
The total amount of currently-allocated memory.
Definition: stack.h:26
void * memory
The allocated memory block.
Definition: stack.h:28