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

db4
Jeremy Hughes 2009-07-07 21:11:57 +12:00
parent c478fa9f1b
commit 5e822dd454
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 combinators effects alien.libraries alien.parser arrays assocs combinators effects
fry generalizations grouping io.files io.files.info io.files.temp fry generalizations grouping io.directories io.files
kernel lexer locals math math.order math.ranges multiline io.files.info io.files.temp kernel lexer locals math math.order
namespaces quotations sequences source-files splitting strings math.ranges multiline namespaces quotations sequences
system vocabs.loader words ; source-files splitting strings system vocabs.loader words ;
IN: alien.inline IN: alien.inline
SYMBOL: c-library SYMBOL: c-library
@ -85,6 +85,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 ;
@ -101,3 +104,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 ;