diff --git a/example/test-list.sex b/example/test-list.sex index 4e4eb63..c4af345 100644 --- a/example/test-list.sex +++ b/example/test-list.sex @@ -1,6 +1,5 @@ (include stdlib.h) (include stddef.h) -(include stdbool.h) (include stdio.h) (chicken-import srfi-1 brev-separate) ; list routines, e.g. fold @@ -16,7 +15,7 @@ ((const char *) c) ((fn bool ((bool val))) not))) -(var foo f #((= .a-field 1.2))) +(var foo f) (list-T int) (make-list-T int #f) @@ -26,7 +25,7 @@ (extern fn void puk ((int a) (float b))) (fn int bar () (return ,(imports-test 10 20 30))) -(pub fn void baz () true) +(pub fn bool baz () (return true)) (extern var int i) (var int j) @@ -34,15 +33,15 @@ (pub fn int main () (var (* list-int) l (make-list-int)) - (printf "Size of the list: %zu\n" (length-list-int l)) + (printf "Size of the list: %lu\n" (length-list-int l)) (add-value-list-int l 3) (add-value-list-int l 4) - (printf "Size of the list: %zu\n" (length-list-int l)) + (printf "Size of the list: %lu\n" (length-list-int l)) (list-for-each list-int l int v (printf "%d " v)) (printf "\n") - (printf "Size of the list: %zu\n" (length-list-int l)) - (printf "%p\n" l->next) + (printf "Size of the list: %lu\n" (length-list-int l)) + (printf "%p\n" (cast void* l->next)) (return 0)) (pub fn void print-list (((const list-int) *l)) diff --git a/sexc.scm b/sexc.scm index 4e94b99..12bde6a 100644 --- a/sexc.scm +++ b/sexc.scm @@ -1,7 +1,8 @@ (declare (unit sexc) (uses fmt-c sex-macros - sex-modules)) + sex-modules + sex-types)) (include "utils.macros.scm") @@ -44,6 +45,10 @@ ((@) 'vector-ref) ((include) '%include) ((cast) '%cast) + ;; uh things we do for c89 compatibility + ((bool) 'int) + ((true) 1) + ((false) 0) (else (if (symbol? atom) (unkebabify atom) @@ -288,7 +293,7 @@ (emit-c sex-forms))) (call-with-values (lambda () - (process compiler (append (list temp-c-out "-o" out-file) + (process compiler (append (list temp-c-out "-o" out-file "-std=c89" "-pedantic") (if (get-arg args 'compile-object #f) (list "-c") (list))