From d59fa6c28b47f1b2412d2de7a901d303b4d247f3 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Thu, 29 Jul 2010 01:01:16 +0100 Subject: [PATCH] make zlib load zlib.so add delete_file/1 as default. --- library/dialect/swi.yap | 2 +- packages/zlib/Makefile.in | 4 +++- packages/zlib/test_zlib.pl | 16 +++++++++++----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/library/dialect/swi.yap b/library/dialect/swi.yap index e845593b0..8219e5fdf 100755 --- a/library/dialect/swi.yap +++ b/library/dialect/swi.yap @@ -66,6 +66,7 @@ [datime/1, mktime/2, file_property/2, + delete_file/1, sleep/1]). :- reexport(library(arg), @@ -379,4 +380,3 @@ required_predicate(Na/Ar, M) :- ). - diff --git a/packages/zlib/Makefile.in b/packages/zlib/Makefile.in index f78ee2c1b..6220d63d3 100644 --- a/packages/zlib/Makefile.in +++ b/packages/zlib/Makefile.in @@ -13,6 +13,7 @@ ifeq (@PROLOG_SYSTEM@,yap) + prefix = @prefix@ exec_prefix = @exec_prefix@ ROOTDIR = $(prefix) @@ -35,6 +36,7 @@ LN_S=@LN_S@ CC=@CC@ CFLAGS= @SHLIB_CFLAGS@ $(YAP_EXTRAS) $(DEFS) -D_YAP_NOT_INSTALLED_=1 -I$(srcdir) -I../.. -I$(srcdir)/../../include @CPPFLAGS@ MKINDEX=true +LIBS=@LIBS@ @ZLIBS@ SO=@SO@ @@ -72,7 +74,7 @@ CWFLAGS=@CWFLAGS@ CMFLAGS=@CMFLAGS@ CIFLAGS= CFLAGS=$(COFLAGS) $(CWFLAGS) $(CMFLAGS) $(CIFLAGS) @DEFS@ -LIBS=@LIBS@ @ZLIBS@ +LIBS=@LIBS@ @ZLIBS@ DOCTOTEX=$(PCEHOME)/bin/doc2tex PLTOTEX=$(PCEHOME)/bin/pl2tex diff --git a/packages/zlib/test_zlib.pl b/packages/zlib/test_zlib.pl index b9e6b6943..88d7536e7 100644 --- a/packages/zlib/test_zlib.pl +++ b/packages/zlib/test_zlib.pl @@ -13,6 +13,10 @@ :- use_module(library(socket)). :- use_module(library(debug)). +:- expects_dialect(swi). +:- assert(system:swi_io). + + test_zlib :- run_tests([ zlib ]). @@ -27,7 +31,7 @@ test(gunzip, ]) :- gzopen('plunit-tmp.gz', read, 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. % gzip: Can gunzip read our compressed file @@ -35,11 +39,11 @@ test(gunzip, test(gzip, [ 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), format(ZOut, '~s', [Codes]), close(ZOut), - read_file_to_codes(pipe('gunzip < plunit-tmp.gz'), Codes1), + myread_file_to_codes(pipe('gunzip < plunit-tmp.gz'), Codes1), Codes == Codes1. % deflate: test read/write of deflate format @@ -47,7 +51,7 @@ test(gzip, test(deflate, [ 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), zopen(Out, ZOut, []), format(ZOut, '~s', [Codes]), @@ -198,7 +202,9 @@ get_data(ZIn, N) :- * UTIL * *******************************/ -read_file_to_codes(File, Codes) :- +myread_file_to_codes(File, Codes) :- open(File, read, In), call_cleanup(read_stream_to_codes(In, Codes), close(In)). +:- retract(system:swi_io). +