alien.inline: added DELETE-C-LIBRARY: word, mainly for tests

Conflicts:

	basis/alien/inline/inline.factor
db4
Jeremy Hughes 2009-07-08 09:45:08 +12:00
parent e140d80d71
commit b421a360c0
2 changed files with 14 additions and 12 deletions

View File

@ -1,7 +1,7 @@
! Copyright (C) 2009 Jeremy Hughes. ! Copyright (C) 2009 Jeremy Hughes.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: tools.test alien.inline alien.inline.private io.files USING: alien.inline alien.inline.private io.directories io.files
io.directories kernel ; kernel namespaces tools.test ;
IN: alien.inline.tests IN: alien.inline.tests
C-LIBRARY: const C-LIBRARY: const
@ -15,8 +15,7 @@ C-FUNCTION: const-int add ( int a, int b )
{ 2 1 } [ add ] must-infer-as { 2 1 } [ add ] must-infer-as
[ 5 ] [ 2 3 add ] unit-test [ 5 ] [ 2 3 add ] unit-test
<< c-library get library-path dup exists? DELETE-C-LIBRARY: const
[ delete-file ] [ drop ] if >>
C-LIBRARY: cpplib C-LIBRARY: cpplib
@ -35,8 +34,7 @@ C-FUNCTION: const-char* hello ( )
{ 0 1 } [ hello ] must-infer-as { 0 1 } [ hello ] must-infer-as
[ "hello world" ] [ hello ] unit-test [ "hello world" ] [ hello ] unit-test
<< c-library get library-path dup exists? DELETE-C-LIBRARY: cpplib
[ delete-file ] [ drop ] if >>
C-LIBRARY: compile-error C-LIBRARY: compile-error
@ -47,5 +45,4 @@ C-FUNCTION: char* breakme ( )
<< [ compile-c-library ] must-fail >> << [ compile-c-library ] must-fail >>
<< c-library get library-path dup exists? DELETE-C-LIBRARY: compile-error
[ delete-file ] [ drop ] if >>

View File

@ -2,10 +2,10 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.inline.compiler alien.inline.types USING: accessors alien.inline.compiler alien.inline.types
alien.libraries alien.parser arrays assocs effects fry alien.libraries alien.parser arrays assocs effects fry
generalizations grouping io.files io.files.info io.files.temp generalizations grouping io.directories io.files
kernel lexer math math.order math.ranges multiline namespaces io.files.info io.files.temp kernel lexer math math.order
sequences source-files splitting strings system vocabs.loader math.ranges multiline namespaces sequences source-files
vocabs.parser words ; splitting strings system vocabs.loader vocabs.parser words ;
IN: alien.inline IN: alien.inline
<PRIVATE <PRIVATE
@ -84,6 +84,9 @@ PRIVATE>
: define-c-include ( str -- ) : define-c-include ( str -- )
"#include " prepend c-strings get push ; "#include " prepend c-strings get push ;
: delete-inline-library ( str -- )
library-path dup exists? [ delete-file ] [ drop ] if ;
SYNTAX: C-LIBRARY: scan define-c-library ; SYNTAX: C-LIBRARY: scan define-c-library ;
SYNTAX: COMPILE-AS-C++ t library-is-c++ set ; SYNTAX: COMPILE-AS-C++ t library-is-c++ set ;
@ -100,3 +103,5 @@ SYNTAX: C-FUNCTION:
function-types-effect define-c-function ; function-types-effect define-c-function ;
SYNTAX: ;C-LIBRARY compile-c-library ; SYNTAX: ;C-LIBRARY compile-c-library ;
SYNTAX: DELETE-C-LIBRARY: scan delete-inline-library ;