# HG changeset patch # User Leonard Ritter # Date 1653016684 -7200 # Fri May 20 05:18:04 2022 +0200 # Node ID a0d79e0623312ff1cac400a39d5111a5b1d3d5b4 # Parent 8e0fb9dd1a6b1e2fe5a7f1a1069c94432f6d37de * smaller changes on tcc bridge diff --git a/lib/tukan/tcc.sc b/lib/tukan/tcc.sc --- a/lib/tukan/tcc.sc +++ b/lib/tukan/tcc.sc @@ -20,10 +20,13 @@ TCC_INCLUDE_PATH := module-dir .. "/../../include/libtcc/include" TCC_LIB_PATH := module-dir .. "/../../lib" - inline tcc_verify (f ...) - let res = (f ...) - assert (res == 0) - res + spice tcc_verify (f ...) + let msg = + .. "\n" (repr ('anchor args)) " tcc call failed" + spice-quote + let res = (f ...) + assert (res == 0) msg + res type TCC :: (mutable @TCCState) inline __typecall (cls) diff --git a/testing/test_tcc.sc b/testing/test_tcc.sc --- a/testing/test_tcc.sc +++ b/testing/test_tcc.sc @@ -2,21 +2,12 @@ using import tukan.tcc -vvv bind testcode -""""#include +cc := (TCC) - void main() { - printf("Hello, World!\n"); - } - -cc := (TCC) -from (methodsof cc) let set_lib_path add_include_path add_library_path - \ set_output_type compile_string relocate get_symbol run - -set_lib_path TCC_LIB_PATH +'set_lib_path cc TCC.LIB_PATH va-map inline (path) - add_include_path path + 'add_include_path cc path TCC_INCLUDE_PATH #"/usr/local/include/x86_64-linux-gnu" #"/usr/local/include" @@ -24,7 +15,7 @@ #"/usr/include" va-map inline (path) - add_library_path path + 'add_library_path cc path #"/usr/lib/x86_64-linux-gnu" #"/usr/lib" #"/lib/x86_64-linux-gnu" @@ -32,15 +23,20 @@ #"/usr/local/lib/x86_64-linux-gnu" #"/usr/local/lib" -set_output_type TCC.OUTPUT_MEMORY -tcc_verify compile_string testcode -#'run cc 0 null -tcc_verify relocate TCC.RELOCATE_AUTO +'set_output_type cc TCC.OUTPUT_MEMORY -func := (get_symbol "main") -assert (func != null) -call - func as (@ (function void)) +#tcc_verify 'compile_string cc testcode +tcc_verify 'add_file cc + report (module-dir .. "/tcc_in.c") +static-if 1 + 'run cc 0 null +else + tcc_verify 'relocate cc TCC.RELOCATE_AUTO + + func := ('get_symbol cc "main") + assert (func != null) + call + func as (@ (function void)) ; \ No newline at end of file diff --git a/testing/tukdag.sc b/testing/tukdag.sc --- a/testing/tukdag.sc +++ b/testing/tukdag.sc @@ -5,7 +5,6 @@ using import Array using import glm -import ..lib.tukan.use using import tukan.FIR using import tukan.CADAG.dot using import tukan.gl