Mercurial
diff dowa/dowa.h @ 3:2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Wed, 24 Sep 2025 18:49:09 -0700 |
| parents | 8a43dedbe530 |
| children | 3e12bf044589 |
line wrap: on
line diff
--- a/dowa/dowa.h Wed Sep 24 13:15:32 2025 -0700 +++ b/dowa/dowa.h Wed Sep 24 18:49:09 2025 -0700 @@ -5,6 +5,11 @@ #include <string.h> // stdup #include <stdlib.h> // only for malloc, free, stuff #include <assert.h> +#include <dirent.h> + +#include <sys/stat.h> +#include <limits.h> + #include "dowa_internal.h" #define HASH_KEY_NUMBER 5381 // DJD hash number @@ -32,10 +37,17 @@ extern void Dowa_Arena_Free(Dowa_PArena p_arena); // --- Map --- // +typedef enum { + DOWA_TYPE_BUFFER, + DOWA_TYPE_STRING, + DOWA_TYPE_INT, +} Dowa_ValueType; + typedef struct { - char *key; - void *buffer; - size_t capacity; + char *key; + void *buffer; + size_t capacity; + Dowa_ValueType type; } Dowa_HashEntry, *Dowa_PHashEntry; typedef struct { @@ -47,7 +59,13 @@ extern Dowa_PHashMap Dowa_HashMap_Create(size_t capacity); extern int32 Dowa_HashMap_GetPosition(Dowa_PHashMap p_hash_map, char *key); extern void Dowa_HashMap_PushValue(Dowa_PHashMap p_hash_map, char *key, void *value, size_t value_size); +extern void Dowa_HashMap_PushValueWithType(Dowa_PHashMap p_hash_map, char *key, void *value, size_t value_size, Dowa_ValueType type); extern void Dowa_HashMap_PopKey(Dowa_PHashMap p_hash_map, char *key); +// --- Maybe Useful --- // +extern void Dowa_HashMap_Print(Dowa_PHashMap map); +// 0 for success, -1 for failure. +extern int Dowa_Cache_Folder(Dowa_PHashMap map, const char *folder_path); + #endif