improve SWI compatibility, especilaly for threaded stuff.

This commit is contained in:
Vítor Santos Costa
2010-08-04 11:37:12 +01:00
parent 6ee0ce8e48
commit bebb236e32
16 changed files with 439 additions and 73 deletions

View File

@@ -27,7 +27,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),
this_read_file_to_codes('test_zlib.pl', Codes1),
Codes0 == Codes1.
% gzip: Can gunzip read our compressed file
@@ -35,11 +35,11 @@ test(gunzip,
test(gzip,
[ cleanup(delete_file('plunit-tmp.gz'))
]) :-
read_file_to_codes('test_zlib.pl', Codes),
this_read_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),
this_read_file_to_codes(pipe('gunzip < plunit-tmp.gz'), Codes1),
Codes == Codes1.
% deflate: test read/write of deflate format
@@ -47,12 +47,12 @@ test(gzip,
test(deflate,
[ cleanup(delete_file('plunit-tmp.z'))
]) :-
read_file_to_codes('test_zlib.pl', Codes),
open('plunit-tmp.z', write, Out),
this_read_file_to_codes('test_zlib.pl', Codes),
system:swi_open('plunit-tmp.z', write, Out),
zopen(Out, ZOut, []),
format(ZOut, '~s', [Codes]),
close(ZOut),
open('plunit-tmp.z', read, In),
system:swi_open('plunit-tmp.z', read, In),
zopen(In, ZIn, []),
read_stream_to_codes(ZIn, Codes1),
close(ZIn),
@@ -198,7 +198,7 @@ get_data(ZIn, N) :-
* UTIL *
*******************************/
read_file_to_codes(File, Codes) :-
open(File, read, In),
this_read_file_to_codes(File, Codes) :-
system:swi_open(File, read, In),
call_cleanup(read_stream_to_codes(In, Codes), close(In)).