33 lines
904 B
C
33 lines
904 B
C
/**
|
|
* Copyright (c) 2021 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "../libs.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; |