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

View File

@ -2,10 +2,10 @@
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.inline.compiler alien.inline.types
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 source-files splitting strings system vocabs.loader
vocabs.parser words ;
generalizations grouping io.directories io.files
io.files.info io.files.temp kernel lexer math math.order
math.ranges multiline namespaces sequences source-files
splitting strings system vocabs.loader vocabs.parser words ;
IN: alien.inline
<PRIVATE
@ -84,6 +84,9 @@ PRIVATE>
: define-c-include ( str -- )
"#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: COMPILE-AS-C++ t library-is-c++ set ;
@ -100,3 +103,5 @@ SYNTAX: C-FUNCTION:
function-types-effect define-c-function ;
SYNTAX: ;C-LIBRARY compile-c-library ;
SYNTAX: DELETE-C-LIBRARY: scan delete-inline-library ;