From: Mike D. Lowis Date: Fri, 22 Feb 2013 18:18:39 +0000 (-0500) Subject: updated lexer to use garbage collector X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=38692fa8d408566017d9a1ce186179d3b0bc50e9;p=proto%2Fsclpl.git updated lexer to use garbage collector --- diff --git a/premake4.lua b/premake4.lua index bd0b83f..f078ed1 100644 --- a/premake4.lua +++ b/premake4.lua @@ -30,7 +30,8 @@ project "sclpl-lex" kind "ConsoleApp" language "C" location "build" - files { "source/lexer/**.*" } + includedirs { "source/lexer/**", "source/runtime/**" } + files { "source/lexer/**.*", "source/runtime/collector/**.*"} project "sclpl-lex-tests" kind "ConsoleApp" diff --git a/source/lexer/main.c b/source/lexer/main.c index 7a7c380..07b88a1 100644 --- a/source/lexer/main.c +++ b/source/lexer/main.c @@ -1,6 +1,16 @@ +#include "gc.h" int main(int argc, char** argv) { + /* init the collector */ + int foo; + gc_set_stack_base(&foo); + + /* main program */ + + + /* shutdown the collector */ + gc_shutdown(); return 0; } diff --git a/source/runtime/collector/gc.c b/source/runtime/collector/gc.c index 76a020d..c4ad125 100644 --- a/source/runtime/collector/gc.c +++ b/source/runtime/collector/gc.c @@ -173,7 +173,7 @@ void gc_free_blocks(block_t* p_blocks) } /*****************************************************************************/ -#if 1 +#if 0 #include #include diff --git a/source/runtime/collector/gc.h b/source/runtime/collector/gc.h index 4783cbb..5d62fd4 100644 --- a/source/runtime/collector/gc.h +++ b/source/runtime/collector/gc.h @@ -7,6 +7,8 @@ #ifndef GC_H #define GC_H +#include + typedef struct { void* next; size_t size;