feat(hectic C): json api

This commit is contained in:
2025-03-22 01:22:36 +00:00
parent aff923d470
commit bcaca5038d
11 changed files with 680 additions and 163 deletions

22
package/c/hmpl/hmpl.h Normal file
View File

@@ -0,0 +1,22 @@
#ifndef EPRINTF_HMPL
#define EPRINTF_HMPL
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "chectic.h"
#include "cjson/cJSON.h"
void init_cjson_with_arenas(Arena *arena);
char *eval(Arena *arena, const cJSON * const context, const char * const key);
/* Modified: text is passed by reference so we can update it and free old allocations */
void render_template_placeholders(Arena *arena, char **text_ptr, cJSON *context, const char * const prefix);
void render_template_with_arena(Arena *arena, char **text, const cJSON * const ccontext);
void render_template(char **text, const cJSON * const context);
#endif // EPRINTF_HMPL