 : prototype-string' ( function types return -- str )
     [ dup arg-list ] <effect> prototype-string ;
 
-: append-function-body ( prototype-str -- str )
-    " {\n" append parse-here append "\n}\n" append ;
+: append-function-body ( prototype-str body -- str )
+    [ swap % " {\n" % % "\n}\n" % ] "" make ;
 
 : compile-library? ( -- ? )
     c-library get library-path dup exists? [

    compile-library? [ compile-library ] when
    c-library get dup library-path "cdecl" add-library ;

: define-c-function ( function types effect -- )
    [ factor-function define-declared ] 3keep prototype-string
    append-function-body c-strings get push ;

: define-c-function' ( function effect -- )
    [ in>> ] keep [ factor-function define-declared ] 3keep
    out>> prototype-string'
    append-function-body c-strings get push ;

: define-c-link ( str -- )
    "-l" prepend compiler-args get push ;

SYNTAX: C-INCLUDE: scan define-c-include ;

SYNTAX: C-FUNCTION:
    function-types-effect parse-here define-c-function ;

SYNTAX: C-TYPEDEF: scan scan define-c-typedef ;

