[WIP] Refactor project
There are many problems with the way the current version is provided and maintained. This commit or series of commits will fix this.
This commit is contained in:
1 parent
f5ab5f3f27
commit
173a82b9d1
63 files changed
+2663
-2239
No files matched your search
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* @file stack.h
|
||||
* @author Piotr Krygier (everyonecancode@gmail.com)
|
||||
* @brief
|
||||
* @version 0.1
|
||||
* @date 2024-05-01
|
||||
*
|
||||
* @copyright Copyright (c) 2024
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef STACK_H
|
||||
#define STACK_H
|
||||
|
||||
#define RSE_STACK_DEFINE(name, type, size) \
|
||||
struct name { \
|
||||
type data[size]; \
|
||||
int top; \
|
||||
}
|
||||
|
||||
#define RSE_STACK_PUSH(stack, value) \
|
||||
stack.data[++stack.top] = value
|
||||
|
||||
#define RSE_STACK_POP(stack) \
|
||||
stack.data[stack.top--]
|
||||
|
||||
#define RSE_STACK_TOP(stack) \
|
||||
stack.data[stack.top]
|
||||
|
||||
#define RSE_STACK_IS_EMPTY(stack) \
|
||||
stack.top == -1
|
||||
|
||||
#define RSE_STACK_IS_FULL(stack, size) \
|
||||
stack.top == size - 1
|
||||
|
||||
#define RSE_STACK_INIT(stack) \
|
||||
stack.top = -1
|
||||
|
||||
#define RSE_STACK_SIZE(stack) \
|
||||
stack.top + 1
|
||||
|
||||
#define RSE_STACK_CLEAR(stack) \
|
||||
stack.top = -1
|
||||
|
||||
#endif // STACK_H
|
||||
Reference in new issue
Block a user