annotate dowa/dowa.h @ 65:ecb6ee6a22c3

[Misc] I will no longer drink cool aids of capital P.
author June Park <parkjune1995@gmail.com>
date Wed, 24 Dec 2025 06:22:59 -0800
parents a30944e5719e
children 75de5903355c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
4 #include <stdio.h>
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
5 #include <string.h> // stdup
1
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
6 #include <stdlib.h> // only for malloc, free, stuff
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
63
fff1b048dda6 [Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents: 59
diff changeset
8
fff1b048dda6 [Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents: 59
diff changeset
9 #ifdef DIRECTORY
fff1b048dda6 [Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents: 59
diff changeset
10 // Only for linux and mac since window do not support.
fff1b048dda6 [Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents: 59
diff changeset
11 // Maybe move this into seobeo file directly?
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
12 #include <dirent.h> // some functions loop through files
63
fff1b048dda6 [Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents: 59
diff changeset
13 #endif
64
a30944e5719e Added vibe coded markdown to html script since it is useful for me. Updated Dowa so that it can be compiled without dirnet for windows.
June Park <parkjune1995@gmail.com>
parents: 63
diff changeset
14
59
e06bc03d9618 [Color Game] Making game with a friend.
June Park <parkjune1995@gmail.com>
parents: 52
diff changeset
15 #include <math.h> // I am not re-writing stuff I guess...
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
16
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
17 #include <sys/stat.h>
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
18 #include <limits.h>
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
19
1
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
20 #include "dowa_internal.h"
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
21
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
22 #define HASH_KEY_NUMBER 5381 // DJD hash number
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
23 #define ONE_MEGA_BYTE 1048576
18
fa2b8af609d9 [Seobeo] Fixed a bug with pathing. Support SSL.
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
24 #define TRUE 1
fa2b8af609d9 [Seobeo] Fixed a bug with pathing. Support SSL.
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
25 #define FALSE 0
fa2b8af609d9 [Seobeo] Fixed a bug with pathing. Support SSL.
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
26
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
27 #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
28 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
29 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
30 (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
31 } \
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 } 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
33
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
34 // Fixed-width integer types
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
35 typedef unsigned int uint32; // 32-bit unsigned integer
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
36 typedef int int32; // 32-bit signed integer
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
37 typedef unsigned short uint16; // 16-bit unsigned integer
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
38 typedef short int16; // 16-bit signed integer
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
39 typedef unsigned char uint8; // 8-bit unsigned integer
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
40 typedef char int8; // 8-bit signed integer
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
41 typedef char boolean; // Boolean type (0 = false, nonzero = true)
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
42
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
43 // --- Arena Allocator --- //
1
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
44 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
45 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
46 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
47 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
48 } Dowa_Arena;
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
49
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
50 /* Creates a new arena with the specified capacity (in bytes). Returns a pointer to the arena, or NULL on failure. */
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
51 extern Dowa_Arena *Dowa_Arena_Create(size_t capacity);
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
52 /* Allocates a block of memory of the given size from the arena. Returns pointer to the allocated memory, or NULL if there is insufficient space. */
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
53 extern void *Dowa_Arena_Allocate(Dowa_Arena *arena, size_t size);
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
54 /* Destroys the arena and frees its underlying memory block.*/
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
55 extern void Dowa_Arena_Destroy(Dowa_Arena *arena);
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
56 /* Strdup but saves within the arena */
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
57 extern void *Dowa_Arena_Copy(Dowa_Arena *p_arena, const void *src, size_t size);
52
636eab07809d Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents: 36
diff changeset
58 /* Resets the arena offset to 0, allowing reuse without freeing */
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
59 extern void Dowa_Arena_Reset(Dowa_Arena *p_arena);
52
636eab07809d Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents: 36
diff changeset
60 /* Returns the current number of bytes allocated in the arena */
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
61 extern size_t Dowa_Arena_Get_Used(Dowa_Arena *p_arena);
52
636eab07809d Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents: 36
diff changeset
62 /* Returns the remaining capacity in bytes */
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
63 extern size_t Dowa_Arena_Get_Remaining(Dowa_Arena *p_arena);
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
64
1
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
65
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
66 // --- HashMap --- //
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
67 typedef enum {
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
68 DOWA_HASH_MAP_TYPE_BUFFER, // Raw byte 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
69 DOWA_HASH_MAP_TYPE_STRING, // Null-terminated string
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
70 DOWA_HASH_MAP_TYPE_HASHMAP, // Nested hashmap
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
71 DOWA_HASH_MAP_TYPE_INT // Integer value
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
72 } Dowa_HashMap_ValueType;
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
73
59
e06bc03d9618 [Color Game] Making game with a friend.
June Park <parkjune1995@gmail.com>
parents: 52
diff changeset
74 typedef struct Dowa_HashEntry {
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
75 char *key;
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
76 void *buffer;
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
77 size_t capacity;
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
78 Dowa_HashMap_ValueType type;
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
79 struct Dowa_HashEntry *next;
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
80 } Dowa_HashEntry;
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
81
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
82 typedef struct {
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
83 Dowa_HashEntry **entries;
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
84 size_t capacity;
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
85 uint32 current_capacity;
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
86 Dowa_Arena *p_arena;
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
87 } Dowa_HashMap;
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
88
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
89 /* Creates a new hashmap with the given initial capacity. Returns pointer to the hashmap, or NULL on failure. */
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
90 extern Dowa_HashMap *Dowa_HashMap_Create(size_t capacity);
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
91 /* Creates a new hashmap with the given initial capacity, using the provided arena for all internal allocations. Returns pointer to the hashmap, or NULL on failure. */
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
92 extern Dowa_HashMap *Dowa_HashMap_Create_With_Arena(size_t capacity, Dowa_Arena *arena);
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
93 /* Destroys the hashmap and frees all associated memory */
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
94 extern void Dowa_HashMap_Destroy(Dowa_HashMap *p_hash_map);
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
95 /* Returns the index of the entry for the specified key, or -1 if the key is not found. */
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
96 extern int32 Dowa_HashMap_Get_Position(Dowa_HashMap *p_hash_map, const char *key);
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
97 /* Retrieves the value buffer for the specified key, or NULL if the key does not exist. */
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
98 extern void *Dowa_HashMap_Get(Dowa_HashMap *p_hash_map, const char *key);
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
99 /* Inserts a copy of the given value into the hashmap under the specified key. Uses DOWA_HASH_MAP_TYPE_BUFFER as the entry type. */
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
100 extern void Dowa_HashMap_Push_Value(Dowa_HashMap *p_hash_map, const char *key, void *value, size_t value_size);
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
101 /* Inserts a copy of the given value with the specified type into the hashmap under the key. Returns the index of the new entry, or -1 on failure. */
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
102 extern int32 Dowa_HashMap_Push_Value_With_Type(Dowa_HashMap *p_hash_map, const char *key, void *value, size_t value_size, Dowa_HashMap_ValueType type);
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
103 /* Inserts a value pointer into the hashmap under the specified key without copying data. The caller retains ownership of the pointer. Returns the entry index, or -1 on failure. */
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
104 extern int32 Dowa_HashMap_Push_Value_With_Type_NoCopy(Dowa_HashMap *p_hash_map, const char *key, void *value, size_t value_size, Dowa_HashMap_ValueType type);
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
105 /* Removes the entry with the specified key from the hashmap and frees its data if owned. */
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
106 extern void Dowa_HashMap_Pop_Key(Dowa_HashMap *p_hash_map, const char *key);
52
636eab07809d Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents: 36
diff changeset
107 /* Returns TRUE if the key exists in the hashmap, FALSE otherwise. */
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
108 extern boolean Dowa_HashMap_Has_Key(Dowa_HashMap *p_hash_map, const char *key);
52
636eab07809d Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents: 36
diff changeset
109 /* Removes all entries from the hashmap without destroying it. */
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
110 extern void Dowa_HashMap_Clear(Dowa_HashMap *p_hash_map);
52
636eab07809d Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents: 36
diff changeset
111 /* Returns the number of entries currently in the hashmap. */
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
112 extern uint32 Dowa_HashMap_Get_Count(Dowa_HashMap *p_hash_map);
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
113
63
fff1b048dda6 [Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents: 59
diff changeset
114 // --- String manipuliation -- //
fff1b048dda6 [Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents: 59
diff changeset
115 // Splice string from start to end
fff1b048dda6 [Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents: 59
diff changeset
116 const char *Dowa_String_Slice(const char *from, size_t start, size_t end);
fff1b048dda6 [Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents: 59
diff changeset
117 // --- Miscellaneous --- //
fff1b048dda6 [Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents: 59
diff changeset
118 char *Dowa_Int32ToString(uint32 value, char *buffer); /* Just use atoid lmao*/
fff1b048dda6 [Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents: 59
diff changeset
119
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
120 // --- Utility Functions --- //
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
121 /* Prints all entries in the hashmap to stdout for debugging purposes. */
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
122 extern void Dowa_HashMap_Print(Dowa_HashMap *map);
64
a30944e5719e Added vibe coded markdown to html script since it is useful for me. Updated Dowa so that it can be compiled without dirnet for windows.
June Park <parkjune1995@gmail.com>
parents: 63
diff changeset
123 #ifdef DIRECTORY
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 20
diff changeset
124 /* Loads all files from the specified folder into the hashmap. Uses file names as keys and file contents as values. Returns 0 on success, or -1 on failure. */
65
ecb6ee6a22c3 [Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents: 64
diff changeset
125 extern int Dowa_HashMap_Cache_Folder(Dowa_HashMap *map, const char *folder_path);
64
a30944e5719e Added vibe coded markdown to html script since it is useful for me. Updated Dowa so that it can be compiled without dirnet for windows.
June Park <parkjune1995@gmail.com>
parents: 63
diff changeset
126 #endif
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
127
1
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
128
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
129 #endif