comparison dowa/dowa.h @ 182:d6ab5921fedc

Merging in changes I had on my mac related to JSON parser and MPC endpoints.
author June Park <parkjune1995@gmail.com>
date Fri, 23 Jan 2026 21:09:49 -0800
parents a2720eac50ce
children
comparison
equal deleted inserted replaced
179:8d17f6e6e290 182:d6ab5921fedc
204 DLAPI char *Dowa_String_Find(const char *p_from, const char *p_value, const size_t from_length, const size_t value_length); 204 DLAPI char *Dowa_String_Find(const char *p_from, const char *p_value, const size_t from_length, const size_t value_length);
205 DLAPI int32 Dowa_String_Pos_Find_Char(const char *p_from, int c, int32 from_length); 205 DLAPI int32 Dowa_String_Pos_Find_Char(const char *p_from, int c, int32 from_length);
206 DLAPI char *Dowa_String_Find_Char(const char *p_from, int c, int32 from_length); 206 DLAPI char *Dowa_String_Find_Char(const char *p_from, int c, int32 from_length);
207 DLAPI char *Dowa_String_UUID(uint32 seed, void *buffer); 207 DLAPI char *Dowa_String_UUID(uint32 seed, void *buffer);
208 208
209 // --- JSON --- //
210 typedef enum {
211 DOWA_JSON_NULL,
212 DOWA_JSON_BOOL,
213 DOWA_JSON_NUMBER,
214 DOWA_JSON_STRING,
215 DOWA_JSON_ARRAY,
216 DOWA_JSON_OBJECT
217 } Dowa_JSON_Type;
218
219 typedef struct Dowa_JSON_Value {
220 Dowa_JSON_Type type;
221 union {
222 boolean bool_val;
223 double num_val;
224 char *str_val;
225 struct Dowa_JSON_Value *array_val; // Dowa array of Dowa_JSON_Value
226 void *object_val; // Dowa_JSON_Entry* hashmap
227 };
228 } Dowa_JSON_Value;
229
230 typedef Dowa_KV(char*, Dowa_JSON_Value) Dowa_JSON_Entry;
231
232 DLAPI Dowa_JSON_Value Dowa_JSON_Parse(const char *json, int32 length, Dowa_Arena *p_arena);
233 DLAPI Dowa_JSON_Value *Dowa_JSON_Get(Dowa_JSON_Entry *map, const char *key);
234 DLAPI char *Dowa_JSON_Get_String(Dowa_JSON_Entry *map, const char *key);
235 DLAPI double Dowa_JSON_Get_Number(Dowa_JSON_Entry *map, const char *key);
236 DLAPI boolean Dowa_JSON_Get_Bool(Dowa_JSON_Entry *map, const char *key);
237
209 // --- Math --- // 238 // --- Math --- //
210 DLAPI uint32 Dowa_Math_Random_Uint32(uint32 seed_number); 239 DLAPI uint32 Dowa_Math_Random_Uint32(uint32 seed_number);
211 240
212 #endif 241 #endif