added simple socket server

This commit is contained in:
Daniel Ledda
2025-11-27 23:45:15 +01:00
parent cbedadd36e
commit 9b772e2046
5 changed files with 187 additions and 34 deletions

28
core.h
View File

@@ -139,7 +139,7 @@ inline function Vec4 vec4(real32 x, real32 y, real32 z, real32 w) {
#define DefineList(type, prefix) \
typedef struct prefix ## List prefix ## List;\
struct prefix ## List {\
type* data;\
type *data;\
size_t length;\
size_t capacity;\
};\
@@ -211,19 +211,19 @@ StringList strSplit(Arena *arena, string splitStr, string inputStr);
string strPrintfv(Arena *arena, const char *fmt, va_list args);
string strPrintf(Arena *arena, const char *fmt, ...);
typedef struct ParsePositiveIntResult ParsePositiveIntResult;
struct ParsePositiveIntResult {
uint8 result;
bool valid;
};
ParsePositiveIntResult parsePositiveInt(string str, size_t *lengthPointer);
#define DefineResult(type, prefix) \
typedef struct prefix ## Result prefix ## Result;\
struct prefix ## Result {\
type result;\
bool valid;\
};\
typedef type prefix ## Result ## _underlying
typedef struct ParsePositiveReal32Result ParsePositiveReal32Result;
struct ParsePositiveReal32Result {
real32 result;
bool valid;
};
ParsePositiveReal32Result parsePositiveReal32(string str, size_t *lengthPointer);
DefineResult(int32, Int32);
Int32Result parsePositiveInt(string str);
DefineResult(real32, Real32);
Real32Result parsePositiveReal32(string str);
inline function bool isNumeric(char c);
@@ -304,7 +304,7 @@ extern void (*print)(const char *fmt, ...);
// ### Loops ###
#define EachIn(list, it) size_t it = 0; it < (list).length; it++
#define EachEl(list, type, element) type* element = (list).data; element < (list).data + (list).length; element += 1
#define EachEl(list, type, element) type *element = (list).data; element < (list).data + (list).length; element += 1
#define EachInReversed(list, it) size_t it = (list).length - 1; it >= 0 && it < (list).length; it--
#define EachInArray(arr, it) size_t it = 0; it < ArrayCount(arr); ++it