Begin refactor.
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user