Mercurial
annotate dowa/dowa.h @ 199:b4a070994b54
Adding exmaple env file.
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Sat, 14 Feb 2026 16:18:25 -0800 |
| parents | a2720eac50ce |
| children |
| rev | line source |
|---|---|
|
1
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1 #ifndef DOWA |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2 #define DOWA |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3 |
|
92
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
4 #include <stdio.h> // printfs... |
|
71
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
5 #include <string.h> // strdup, strlen, memcmp, memcpy |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
6 #include <stdlib.h> // malloc, free, realloc |
|
21
09def63429b9
[Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents:
20
diff
changeset
|
7 #include <assert.h> // mostly for TODO |
|
71
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
8 #include <stddef.h> // size_t |
|
63
fff1b048dda6
[Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents:
59
diff
changeset
|
9 |
|
1
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
10 #include "dowa_internal.h" |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
11 |
|
71
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
12 // DLAPI macro for DLL export/import |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
13 #ifndef DLAPI |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
14 #ifdef _WIN32 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
15 #ifdef DOWA_EXPORTS |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
16 #define DLAPI __declspec(dllexport) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
17 #else |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
18 #define DLAPI __declspec(dllimport) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
19 #endif |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
20 #else |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
21 #define DLAPI extern |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
22 #endif |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
23 #endif |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
24 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
25 #define HASH_KEY_NUMBER 5381 |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
26 #define ONE_MEGA_BYTE 1048576 |
|
18
fa2b8af609d9
[Seobeo] Fixed a bug with pathing. Support SSL.
June Park <parkjune1995@gmail.com>
parents:
5
diff
changeset
|
27 #define TRUE 1 |
|
fa2b8af609d9
[Seobeo] Fixed a bug with pathing. Support SSL.
June Park <parkjune1995@gmail.com>
parents:
5
diff
changeset
|
28 #define FALSE 0 |
|
71
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
29 #define DOWA_HASH_BUCKET_SIZE 8 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
30 #define DOWA_HASH_CACHE_LINE_SIZE 64 |
|
18
fa2b8af609d9
[Seobeo] Fixed a bug with pathing. Support SSL.
June Park <parkjune1995@gmail.com>
parents:
5
diff
changeset
|
31 |
|
36
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
22
diff
changeset
|
32 #define Dowa_Free(p) do { \ |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
22
diff
changeset
|
33 if (p) { \ |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
22
diff
changeset
|
34 free(p); \ |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
22
diff
changeset
|
35 (p) = NULL; \ |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
22
diff
changeset
|
36 } \ |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
22
diff
changeset
|
37 } while (0) |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
22
diff
changeset
|
38 |
| 74 | 39 typedef unsigned long long uint64; |
| 40 typedef long long int64; | |
| 41 typedef unsigned int uint32; | |
| 42 typedef int int32; | |
| 43 typedef unsigned short uint16; | |
| 44 typedef short int16; | |
| 45 typedef unsigned char uint8; | |
| 46 typedef char int8; | |
| 47 typedef char boolean; | |
|
21
09def63429b9
[Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents:
20
diff
changeset
|
48 |
|
09def63429b9
[Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents:
20
diff
changeset
|
49 // --- Arena Allocator --- // |
|
1
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
50 typedef struct { |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
51 char *buffer; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
52 size_t offset; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
53 size_t capacity; |
|
65
ecb6ee6a22c3
[Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents:
64
diff
changeset
|
54 } Dowa_Arena; |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
55 |
|
71
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
56 DLAPI Dowa_Arena *Dowa_Arena_Create(size_t capacity); |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
57 DLAPI void *Dowa_Arena_Allocate(Dowa_Arena *p_arena, size_t size); |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
58 DLAPI void *Dowa_Arena_Allocate_Aligned(Dowa_Arena *p_arena, size_t size, size_t alignment); |
|
72
4532ce6d9eb8
[Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
59 DLAPI void Dowa_Arena_Free(Dowa_Arena *p_arena); |
|
71
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
60 DLAPI void *Dowa_Arena_Copy(Dowa_Arena *p_arena, const void *p_src, size_t size); |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
61 DLAPI void Dowa_Arena_Reset(Dowa_Arena *p_arena); |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
62 DLAPI size_t Dowa_Arena_Get_Used(Dowa_Arena *p_arena); |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
63 DLAPI size_t Dowa_Arena_Get_Remaining(Dowa_Arena *p_arena); |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
64 |
|
92
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
65 // --- Array and HashMap --- // |
|
71
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
66 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
67 typedef enum { |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
68 DOWA_ALLOCATOR_MALLOC = 0, |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
69 DOWA_ALLOCATOR_ARENA = 1 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
70 } Dowa_Allocator_Type; |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
71 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
72 typedef struct { |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
73 size_t length; |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
74 size_t capacity; |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
75 uint8 allocator_type; |
|
92
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
76 Dowa_Arena *p_arena; |
|
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
77 void *p_hash; |
|
71
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
78 } Dowa_Array_Header; |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
79 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
80 typedef struct { |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
81 uint32 hash[DOWA_HASH_BUCKET_SIZE]; |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
82 uint32 index[DOWA_HASH_BUCKET_SIZE]; |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
83 } Dowa_Hash_Bucket; |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
84 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
85 typedef struct { |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
86 size_t bucket_count; |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
87 size_t item_count; |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
88 size_t tombstone_count; |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
89 uint8 allocator_type; |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
90 Dowa_Arena* p_arena; |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
91 Dowa_Hash_Bucket* p_buckets; |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
92 } Dowa_Hash_Index; |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
93 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
94 #define Dowa_KV(K, V) struct { K key; V value; } |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
95 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
96 #define dowa__header(a) ((Dowa_Array_Header*)(a) - 1) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
97 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
98 // --- Array Macros --- // |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
99 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
100 #define Dowa_Array_Length(a) ((a) ? dowa__header(a)->length : 0) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
101 #define Dowa_Array_Capacity(a) ((a) ? dowa__header(a)->capacity : 0) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
102 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
103 #define Dowa_Array_Push(a, v) \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
104 ((a) = dowa__array_grow((a), sizeof(*(a)), 0, NULL), \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
105 (a)[dowa__header(a)->length++] = (v)) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
106 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
107 #define Dowa_Array_Push_Arena(a, v, arena) \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
108 ((a) = dowa__array_grow((a), sizeof(*(a)), 0, (arena)), \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
109 (a)[dowa__header(a)->length++] = (v)) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
110 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
111 #define Dowa_Array_Pop(a) ((a)[--dowa__header(a)->length]) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
112 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
113 #define Dowa_Array_Clear(a) ((a) ? (dowa__header(a)->length = 0) : 0) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
114 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
115 #define Dowa_Array_Free(a) ((a) ? (dowa__array_free((a)), (a) = NULL) : 0) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
116 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
117 #define Dowa_Array_Reserve(a, n) \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
118 ((a) = dowa__array_grow((a), sizeof(*(a)), (n), NULL)) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
119 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
120 #define Dowa_Array_Reserve_Arena(a, n, arena) \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
121 ((a) = dowa__array_grow((a), sizeof(*(a)), (n), (arena))) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
122 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
123 // --- HashMap Macros --- // |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
124 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
125 #define Dowa_HashMap_Get(m, k) \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
126 dowa__hashmap_get((m), sizeof(*(m)), (k), strlen(k) + 1) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
127 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
128 #define Dowa_HashMap_Get_Ptr(m, k) \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
129 dowa__hashmap_get_ptr((m), sizeof(*(m)), (k), strlen(k) + 1) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
130 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
131 #define Dowa_HashMap_Push(m, k, v) \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
132 do { \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
133 (m) = dowa__hashmap_push((m), sizeof(*(m)), (k), strlen(k) + 1, NULL); \ |
|
92
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
134 void *p_kv_temp = dowa__hashmap_get_ptr((m), sizeof(*(m)), (k), strlen(k) + 1); \ |
|
71
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
135 if (p_kv_temp) \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
136 ((typeof(m))p_kv_temp)->value = (v); \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
137 } while (0) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
138 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
139 #define Dowa_HashMap_Push_Arena(m, k, v, arena) \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
140 do { \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
141 (m) = dowa__hashmap_push((m), sizeof(*(m)), (k), strlen(k) + 1, (arena)); \ |
|
92
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
142 void *p_kv_temp = dowa__hashmap_get_ptr((m), sizeof(*(m)), (k), strlen(k) + 1); \ |
|
71
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
143 if (p_kv_temp) \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
144 ((typeof(m))p_kv_temp)->value = (v); \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
145 } while (0) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
146 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
147 #define Dowa_HashMap_Has_Key(m, k) \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
148 dowa__hashmap_has_key((m), sizeof(*(m)), (k), strlen(k) + 1) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
149 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
150 #define Dowa_HashMap_Delete(m, k) \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
151 dowa__hashmap_delete((m), sizeof(*(m)), (k), strlen(k) + 1) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
152 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
153 #define Dowa_HashMap_Clear(m) dowa__hashmap_clear((m), sizeof(*(m))) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
154 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
155 #define Dowa_HashMap_Free(m) ((m) ? (dowa__hashmap_free((m)), (m) = NULL) : 0) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
156 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
157 #define Dowa_HashMap_Count(m) dowa__hashmap_count(m) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
158 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
159 #define Dowa_HashMap_Get_Binary(m, k, ksize) \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
160 dowa__hashmap_get((m), sizeof(*(m)), (k), (ksize)) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
161 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
162 #define Dowa_HashMap_Get_Ptr_Binary(m, k, ksize) \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
163 dowa__hashmap_get_ptr((m), sizeof(*(m)), (k), (ksize)) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
164 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
165 #define Dowa_HashMap_Push_Binary(m, k, ksize, v) \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
166 do { \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
167 (m) = dowa__hashmap_push((m), sizeof(*(m)), (k), (ksize), NULL); \ |
|
92
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
168 void *p_kv_temp = dowa__hashmap_get_ptr((m), sizeof(*(m)), (k), (ksize)); \ |
|
71
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
169 if (p_kv_temp) \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
170 ((typeof(m))p_kv_temp)->value = (v); \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
171 } while (0) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
172 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
173 #define Dowa_HashMap_Push_Binary_Arena(m, k, ksize, v, arena) \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
174 do { \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
175 (m) = dowa__hashmap_push((m), sizeof(*(m)), (k), (ksize), (arena)); \ |
|
92
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
176 void *p_kv_temp = dowa__hashmap_get_ptr((m), sizeof(*(m)), (k), (ksize)); \ |
|
71
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
177 if (p_kv_temp) \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
178 ((typeof(m))p_kv_temp)->value = (v); \ |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
179 } while (0) |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
180 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
181 // --- Array Core Functions --- // |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
182 |
|
92
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
183 DLAPI void *dowa__array_grow(void *p_array, size_t element_size, size_t minimum_capacity, Dowa_Arena* p_arena); |
|
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
184 DLAPI void dowa__array_free(void *p_array); |
|
71
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
185 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
186 // --- HashMap Core Functions --- // |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
187 |
|
92
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
188 DLAPI uint32 dowa__hash_bytes(void *p_key, size_t key_size); |
|
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
189 DLAPI void *dowa__hashmap_get(void *p_map, size_t element_size, void *p_key, size_t key_size); |
|
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
190 DLAPI void *dowa__hashmap_get_ptr(void *p_map, size_t element_size, void *p_key, size_t key_size); |
|
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
191 DLAPI void *dowa__hashmap_push(void *p_map, size_t element_size, void *p_key, size_t key_size, Dowa_Arena* p_arena); |
|
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
192 DLAPI boolean dowa__hashmap_has_key(void *p_map, size_t element_size, void *p_key, size_t key_size); |
|
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
193 DLAPI void dowa__hashmap_delete(void *p_map, size_t element_size, void *p_key, size_t key_size); |
|
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
194 DLAPI void dowa__hashmap_clear(void *p_map, size_t element_size); |
|
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
195 DLAPI void dowa__hashmap_free(void *p_map); |
|
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
196 DLAPI size_t dowa__hashmap_count(void *p_map); |
|
71
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
197 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
198 // --- String Manipulation --- // |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
199 |
| 96 | 200 DLAPI char *Dowa_String_Slice(char *from, size_t start, size_t end, Dowa_Arena *p_arena); |
| 201 DLAPI char **Dowa_String_Split(char *from, char *token, int32 from_length, int32 token_length, Dowa_Arena *p_arena); | |
| 202 DLAPI char *Dowa_String_Copy_Arena(char *from, Dowa_Arena *p_arena); | |
|
71
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
203 DLAPI int32 Dowa_String_Pos_Find(const char *p_from, const char *p_value, const size_t from_length, const size_t value_length); |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
204 DLAPI char *Dowa_String_Find(const char *p_from, const char *p_value, const size_t from_length, const size_t value_length); |
|
72
4532ce6d9eb8
[Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
205 DLAPI int32 Dowa_String_Pos_Find_Char(const char *p_from, int c, int32 from_length); |
|
4532ce6d9eb8
[Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
206 DLAPI char *Dowa_String_Find_Char(const char *p_from, int c, int32 from_length); |
|
92
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
207 DLAPI char *Dowa_String_UUID(uint32 seed, void *buffer); |
|
3
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
208 |
|
181
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
209 // --- JSON --- // |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
210 typedef enum { |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
211 DOWA_JSON_NULL, |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
212 DOWA_JSON_BOOL, |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
213 DOWA_JSON_NUMBER, |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
214 DOWA_JSON_STRING, |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
215 DOWA_JSON_ARRAY, |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
216 DOWA_JSON_OBJECT |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
217 } Dowa_JSON_Type; |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
218 |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
219 typedef struct Dowa_JSON_Value { |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
220 Dowa_JSON_Type type; |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
221 union { |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
222 boolean bool_val; |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
223 double num_val; |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
224 char *str_val; |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
225 struct Dowa_JSON_Value *array_val; // Dowa array of Dowa_JSON_Value |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
226 void *object_val; // Dowa_JSON_Entry* hashmap |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
227 }; |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
228 } Dowa_JSON_Value; |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
229 |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
230 typedef Dowa_KV(char*, Dowa_JSON_Value) Dowa_JSON_Entry; |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
231 |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
232 DLAPI Dowa_JSON_Value Dowa_JSON_Parse(const char *json, int32 length, Dowa_Arena *p_arena); |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
233 DLAPI Dowa_JSON_Value *Dowa_JSON_Get(Dowa_JSON_Entry *map, const char *key); |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
234 DLAPI char *Dowa_JSON_Get_String(Dowa_JSON_Entry *map, const char *key); |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
235 DLAPI double Dowa_JSON_Get_Number(Dowa_JSON_Entry *map, const char *key); |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
236 DLAPI boolean Dowa_JSON_Get_Bool(Dowa_JSON_Entry *map, const char *key); |
|
a2720eac50ce
[NPC] Adding JSON RPC protocol for MPC endpoints
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
237 |
|
92
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
238 // --- Math --- // |
|
655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents:
74
diff
changeset
|
239 DLAPI uint32 Dowa_Math_Random_Uint32(uint32 seed_number); |
|
1
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
240 |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
241 #endif |