aboutsummaryrefslogtreecommitdiff
path: root/redist/json_helpers.h
blob: 3ebf66b2ffeda1942c04ea98b16c07b0ca3c36bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// (C) 2017 <>< Joshua Allen, Under MIT/x11 License.

#ifndef JSON_HELPERS_H
#define JSON_HELPERS_H

#include <stdint.h>
#include <jsmn.h>
#include "survive_types.h"

void json_write_float_array(FILE* f, const char* tag, float* v, uint8_t count);
void json_write_double_array(FILE* f, const char* tag, double* v, uint8_t count);
void json_write_uint32(FILE* f, const char* tag, uint32_t v);
void json_write_float(FILE* f, const char* tag, float v);
void json_write_str(FILE* f, const char* tag, const char* v);

int parse_float_array(char* str, jsmntok_t* token, FLT** values, uint8_t count);

void json_load_file(const char* path);
extern void (*json_begin_object)(char* tag);
extern void (*json_end_object)();
extern void (*json_tag_value)(char* tag, char** values, uint8_t count);


#endif