Begin refactor.

This commit is contained in:
2021-09-18 23:13:05 -07:00
parent df53c646a2
commit 2b7446b818
143 changed files with 1706 additions and 2345 deletions

View File

@ -4,9 +4,33 @@
// https://opensource.org/licenses/MIT
#pragma once
#include <dawn/dawn.h>
#include "../libs.h"
#include "array.h"
#define STRING_HANDLEBAR_KEY_MAXLENGTH 32
#define STRING_STACK_STRING_SIZE 256
#define STRING_STACK_STRING_COUNT 128
#define STRING_STACK_BUFFER STRING_STACK_STRING_SIZE * STRING_STACK_STRING_COUNT
/** Representation of a String Handlebar Variable */
typedef struct {
/** The key to use to replace in the source */
char *key;
/** The value to replace it with */
char *value;
} stringhandlebarvariable_t;
/** Definition of a string stack to push and pop strings from. */
typedef struct {
/** Raw char buffer, for holding strings */
char buffer[STRING_STACK_BUFFER];
/** Strings themselves */
char *strings[STRING_STACK_STRING_COUNT];
/** How many strings are on the stack */
int32_t size;
} stringstack_t;
/**
* Replaces handlebars within the string with items from the list of variables.
* Output of replacement is stored in the buffer provided. Handlebars within the