make zlib load zlib.so

add delete_file/1 as default.
This commit is contained in:
Vitor Santos Costa 2010-07-29 01:01:16 +01:00
parent 36973f93ba
commit d59fa6c28b
3 changed files with 15 additions and 7 deletions

View File

@ -66,6 +66,7 @@
[datime/1, [datime/1,
mktime/2, mktime/2,
file_property/2, file_property/2,
delete_file/1,
sleep/1]). sleep/1]).
:- reexport(library(arg), :- reexport(library(arg),
@ -379,4 +380,3 @@ required_predicate(Na/Ar, M) :-
). ).

View File

@ -13,6 +13,7 @@
ifeq (@PROLOG_SYSTEM@,yap) ifeq (@PROLOG_SYSTEM@,yap)
prefix = @prefix@ prefix = @prefix@
exec_prefix = @exec_prefix@ exec_prefix = @exec_prefix@
ROOTDIR = $(prefix) ROOTDIR = $(prefix)
@ -35,6 +36,7 @@ LN_S=@LN_S@
CC=@CC@ CC=@CC@
CFLAGS= @SHLIB_CFLAGS@ $(YAP_EXTRAS) $(DEFS) -D_YAP_NOT_INSTALLED_=1 -I$(srcdir) -I../.. -I$(srcdir)/../../include @CPPFLAGS@ CFLAGS= @SHLIB_CFLAGS@ $(YAP_EXTRAS) $(DEFS) -D_YAP_NOT_INSTALLED_=1 -I$(srcdir) -I../.. -I$(srcdir)/../../include @CPPFLAGS@
MKINDEX=true MKINDEX=true
LIBS=@LIBS@ @ZLIBS@
SO=@SO@ SO=@SO@
@ -72,7 +74,7 @@ CWFLAGS=@CWFLAGS@
CMFLAGS=@CMFLAGS@ CMFLAGS=@CMFLAGS@
CIFLAGS= CIFLAGS=
CFLAGS=$(COFLAGS) $(CWFLAGS) $(CMFLAGS) $(CIFLAGS) @DEFS@ CFLAGS=$(COFLAGS) $(CWFLAGS) $(CMFLAGS) $(CIFLAGS) @DEFS@
LIBS=@LIBS@ @ZLIBS@ LIBS=@LIBS@ @ZLIBS@
DOCTOTEX=$(PCEHOME)/bin/doc2tex DOCTOTEX=$(PCEHOME)/bin/doc2tex
PLTOTEX=$(PCEHOME)/bin/pl2tex PLTOTEX=$(PCEHOME)/bin/pl2tex

View File

@ -13,6 +13,10 @@
:- use_module(library(socket)). :- use_module(library(socket)).
:- use_module(library(debug)). :- use_module(library(debug)).
:- expects_dialect(swi).
:- assert(system:swi_io).
test_zlib :- test_zlib :-
run_tests([ zlib run_tests([ zlib
]). ]).
@ -27,7 +31,7 @@ test(gunzip,
]) :- ]) :-
gzopen('plunit-tmp.gz', read, ZIn), gzopen('plunit-tmp.gz', read, ZIn),
call_cleanup(read_stream_to_codes(ZIn, Codes0), close(ZIn)), call_cleanup(read_stream_to_codes(ZIn, Codes0), close(ZIn)),
read_file_to_codes('test_zlib.pl', Codes1), myread_file_to_codes('test_zlib.pl', Codes1),
Codes0 == Codes1. Codes0 == Codes1.
% gzip: Can gunzip read our compressed file % gzip: Can gunzip read our compressed file
@ -35,11 +39,11 @@ test(gunzip,
test(gzip, test(gzip,
[ cleanup(delete_file('plunit-tmp.gz')) [ cleanup(delete_file('plunit-tmp.gz'))
]) :- ]) :-
read_file_to_codes('test_zlib.pl', Codes), myread_file_to_codes('test_zlib.pl', Codes),
gzopen('plunit-tmp.gz', write, ZOut), gzopen('plunit-tmp.gz', write, ZOut),
format(ZOut, '~s', [Codes]), format(ZOut, '~s', [Codes]),
close(ZOut), close(ZOut),
read_file_to_codes(pipe('gunzip < plunit-tmp.gz'), Codes1), myread_file_to_codes(pipe('gunzip < plunit-tmp.gz'), Codes1),
Codes == Codes1. Codes == Codes1.
% deflate: test read/write of deflate format % deflate: test read/write of deflate format
@ -47,7 +51,7 @@ test(gzip,
test(deflate, test(deflate,
[ cleanup(delete_file('plunit-tmp.z')) [ cleanup(delete_file('plunit-tmp.z'))
]) :- ]) :-
read_file_to_codes('test_zlib.pl', Codes), myread_file_to_codes('test_zlib.pl', Codes),
open('plunit-tmp.z', write, Out), open('plunit-tmp.z', write, Out),
zopen(Out, ZOut, []), zopen(Out, ZOut, []),
format(ZOut, '~s', [Codes]), format(ZOut, '~s', [Codes]),
@ -198,7 +202,9 @@ get_data(ZIn, N) :-
* UTIL * * UTIL *
*******************************/ *******************************/
read_file_to_codes(File, Codes) :- myread_file_to_codes(File, Codes) :-
open(File, read, In), open(File, read, In),
call_cleanup(read_stream_to_codes(In, Codes), close(In)). call_cleanup(read_stream_to_codes(In, Codes), close(In)).
:- retract(system:swi_io).