From 7012cd3b91135cedf245c403b99f14b99f0267eb Mon Sep 17 00:00:00 2001 From: Ludovic 'Archivist' Lagouardette Date: Tue, 21 May 2024 07:01:27 +0200 Subject: [PATCH] added type support --- .idea/.gitignore | 8 ++++++++ .idea/ink.iml | 2 ++ .idea/misc.xml | 4 ++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ ink.h | 16 ++++++++++++++++ lib.c | 2 +- 7 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/ink.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/ink.iml b/.idea/ink.iml new file mode 100644 index 0000000..f08604b --- /dev/null +++ b/.idea/ink.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..79b3c94 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..0df1c94 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ink.h b/ink.h index cb8bf8e..9227efe 100644 --- a/ink.h +++ b/ink.h @@ -85,6 +85,18 @@ struct ink_routine { void *routine_userdata; }; +struct ink_collection_list { + struct elem* elems; + size_t size; +}; + +struct ink_type { + const char* name; + void* elements; + void (*collect)(void*); + struct ink_collection_list (*gc)(void*); +}; + /** * Represents a complete execution context for the ink interpreter */ @@ -99,6 +111,10 @@ struct context { struct ink_routine *routines; int routines_capacity; int routines_top; + + struct ink_type *types; + int types_capacity; + int types_top; /** * Contains the id of the routine that is currently being manipulated diff --git a/lib.c b/lib.c index 7bcd411..09e2063 100644 --- a/lib.c +++ b/lib.c @@ -4,7 +4,7 @@ #include #include #include -#ifdef INSTRUMENTION +#ifdef INSTRUMENTATION #include #endif #endif