Merge branch 'inlinec' into marshall
* inlinec: moved alien.inline tests to inline-tests.factor alien.inline: file get path>> instead of vocab-source-path alien.inline.compiler: x86_64 check and hook methods Conflicts: basis/alien/inline/inline.factordb4
commit
811a7c54eb
|
@ -2,7 +2,7 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors arrays combinators fry generalizations
|
||||
io.encodings.ascii io.files io.files.temp io.launcher kernel
|
||||
locals sequences system ;
|
||||
locals sequences system words ;
|
||||
IN: alien.inline.compiler
|
||||
|
||||
SYMBOL: C
|
||||
|
@ -27,20 +27,28 @@ SYMBOL: C++
|
|||
{ C++ [ "g++" ] }
|
||||
} case ;
|
||||
|
||||
HOOK: compiler-descr os ( lang -- descr )
|
||||
|
||||
M: word compiler-descr compiler 1array ;
|
||||
M: macosx compiler-descr
|
||||
call-next-method cpu x86.64?
|
||||
[ { "-arch" "x86_64" } append ] when ;
|
||||
|
||||
HOOK: link-descr os ( -- descr )
|
||||
|
||||
M: word link-descr { "-shared" "-o" } ;
|
||||
M: macosx link-descr
|
||||
{ "-g" "-prebind" "-dynamiclib" "-o" }
|
||||
cpu x86.64? [ { "-arch" "x86_64" } prepend ] when ;
|
||||
|
||||
: link-command ( in out lang -- descr )
|
||||
compiler os {
|
||||
{ [ dup linux? ]
|
||||
[ drop { "-shared" "-o" } ] }
|
||||
{ [ dup macosx? ]
|
||||
[ drop { "-g" "-prebind" "-dynamiclib" "-o" } ] }
|
||||
[ name>> "unimplemented for: " prepend throw ]
|
||||
} cond swap prefix prepend prepend ;
|
||||
compiler-descr link-descr append prepend prepend ;
|
||||
|
||||
:: compile-to-object ( lang contents name -- )
|
||||
name ".o" append temp-file
|
||||
contents name lang src-suffix append temp-file
|
||||
[ ascii set-file-contents ] keep 2array
|
||||
{ "-fPIC" "-c" "-o" } lang compiler prefix prepend
|
||||
lang compiler-descr { "-fPIC" "-c" "-o" } append prepend
|
||||
try-process ;
|
||||
|
||||
:: link-object ( lang args name -- )
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
! Copyright (C) 2009 Jeremy Hughes.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors alien.inline.compiler alien.inline.types
|
||||
alien.libraries alien.parser arrays assocs
|
||||
combinators effects fry generalizations grouping io.files
|
||||
io.files.info io.files.temp kernel lexer locals math math.order
|
||||
math.ranges multiline namespaces quotations sequences splitting
|
||||
strings system vocabs.loader vocabs.parser words ;
|
||||
alien.libraries alien.parser arrays assocs combinators effects
|
||||
fry generalizations grouping io.files io.files.info io.files.temp
|
||||
kernel lexer locals math math.order math.ranges multiline
|
||||
namespaces quotations sequences source-files splitting strings
|
||||
system vocabs.loader vocabs.parser words ;
|
||||
IN: alien.inline
|
||||
|
||||
SYMBOL: c-library
|
||||
|
@ -27,7 +27,7 @@ SYMBOL: c-strings
|
|||
|
||||
: compile-library? ( -- ? )
|
||||
library-path dup exists? [
|
||||
current-vocab vocab-source-path
|
||||
file get path>>
|
||||
[ file-info modified>> ] bi@ <=> +lt+ =
|
||||
] [ drop t ] if ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue