summaryrefslogtreecommitdiffhomepage
path: root/include/rodeo_types.h
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2023-03-08 05:16:04 -0500
committerrealtradam <[email protected]>2023-03-08 05:16:04 -0500
commit3f36ef9b24e2ce978461291d84e293776c41eb66 (patch)
treebe531c569f3a1cedebd66ec7b2dd389ad94d4b37 /include/rodeo_types.h
parent4b410af18ed7e76b42be1d2ab2ebdfe8e5bf97e8 (diff)
downloadRodeoKit-3f36ef9b24e2ce978461291d84e293776c41eb66.tar.gz
RodeoKit-3f36ef9b24e2ce978461291d84e293776c41eb66.zip
added logging system and improved string integration
Diffstat (limited to 'include/rodeo_types.h')
-rw-r--r--include/rodeo_types.h29
1 files changed, 27 insertions, 2 deletions
diff --git a/include/rodeo_types.h b/include/rodeo_types.h
index bdd7ab7..37e87eb 100644
--- a/include/rodeo_types.h
+++ b/include/rodeo_types.h
@@ -3,6 +3,7 @@
// system
#include <stdbool.h>
#include <stdint.h>
+#include <stddef.h>
typedef struct
{
@@ -24,7 +25,7 @@ rodeo_vertex_t;
typedef
void
-(*rodeo_mainloop_func)(void);
+(*rodeo_mainloop_function)(void);
typedef struct
{
@@ -35,4 +36,28 @@ typedef struct
}
rodeo_rectangle_t;
-typedef union rodeo_string_t *rodeo_string_p;
+/// --- String ---
+
+// taken from STC library
+// must match their layout exactly as it will be cast to it.
+// (TODO should write test cases for the string funcs)
+typedef char rodeo_string_value_t;
+typedef struct { rodeo_string_value_t* data; intptr_t size, cap; } rodeo_string_buffer_t;
+typedef union {
+ struct { rodeo_string_value_t data[sizeof(rodeo_string_buffer_t) - 1]; unsigned char size; } sml;
+ struct { rodeo_string_value_t* data; size_t size, ncap; } lon;
+} rodeo_string_t;
+
+/// --- Log ---
+
+typedef enum
+{
+ rodeo_loglevel_info,
+ rodeo_loglevel_warning,
+ rodeo_loglevel_error
+}
+rodeo_loglevel_t;
+
+typedef
+void
+(*rodeo_log_function)(rodeo_string_t text);