Added GUI Frame

This commit is contained in:
2021-08-11 09:48:56 -07:00
parent 247df18225
commit 7229981177
13 changed files with 247 additions and 16 deletions

View File

@ -97,4 +97,19 @@ int32_t stringHandlebarsBuffer(char *source,
// Return the count of chars we wrote to the buffer. -1 due to null term.
return l - 1;
}
void stringStackInit(stringstack_t *stack) {
stack->size = 0;
}
void stringStackPush(stringstack_t *stack, char *string) {
size_t offset = stack->size * STRING_STACK_STRING_SIZE;
arrayCopy(sizeof(char), string, strlen(string) + 1, stack->strings + offset);
stack->strings[stack->size] = stack->buffer + offset;
stack->size++;
}
void stringStackPop(stringstack_t *stack) {
stack->size -= 1;
}

View File

@ -5,6 +5,7 @@
#pragma once
#include <dawn/dawn.h>
#include "array.h"
/**
* Replaces handlebars within the string with items from the list of variables.
@ -21,4 +22,24 @@
*/
int32_t stringHandlebarsBuffer(char *source,
stringhandlebarvariable_t *variables, int32_t variableCount, char *buffer
);
);
/**
* Initializes a string stack for pushing strings on to.
* @param stack Stack to initialize.
*/
void stringStackInit(stringstack_t *stack);
/**
* Push a string onto the stack. The source string will be copied so you can
* change the original pointer after this push operation.
* @param stack Stack to push onto.
* @param string String to copy and push.
*/
void stringStackPush(stringstack_t *stack, char *string);
/**
* Pop an element off the end of a string stack.
* @param stack Stack to pop from.
*/
void stringStackPop(stringstack_t *stack);