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.
! 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 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 words ;
fry generalizations grouping io.directories 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 words ;
IN: alien.inline
SYMBOL: c-library
@ -85,6 +85,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 ;
@ -101,3 +104,5 @@ SYNTAX: C-FUNCTION:
function-types-effect define-c-function ;
SYNTAX: ;C-LIBRARY compile-c-library ;
SYNTAX: DELETE-C-LIBRARY: scan delete-inline-library ;