 
 SYNTAX: C-INCLUDE: scan define-c-include ;
 
-SYNTAX: C-FUNCTION:
-    return-library-function-params define-c-function ;
+SYNTAX: C-FUNCTION: function-types-effect define-c-function ;
 
 SYNTAX: ;C-LIBRARY compile-c-library ;

SYMBOL: compiler-args
SYMBOL: c-strings

: return-library-function-params ( -- return library function params )
    scan c-library get scan ")" parse-tokens
    [ "(" subseq? not ] filter [
        [ dup CHAR: - = [ drop CHAR: space ] when ] map
    ] 3dip ;

: factor-function ( return library function params -- )
    [ dup "const " head? [ 6 tail ] when ] 3dip
    make-function define-declared ;

: c-function-string ( return library function params -- str )
    [ nip ] dip
    " " join "(" prepend ")" append 3array " " join
    library-is-c++ get [ "extern \"C\" " prepend ] when ;

: library-path ( -- str )
    "lib" c-library get library-suffix

! Copyright (C) 2009 Jeremy Hughes.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.inline.compiler alien.libraries
alien.parser arrays assocs effects fry generalizations grouping
io.files io.files.info io.files.temp kernel lexer math
math.order math.ranges multiline namespaces sequences splitting
strings system vocabs.loader vocabs.parser words ;
IN: alien.inline

<PRIVATE
