enable path expansion by default

This commit is contained in:
Vítor Santos Costa
2015-04-24 10:03:44 -06:00
parent d5ce9a1376
commit 0ed3ee4fc4
16 changed files with 1551 additions and 1566 deletions

View File

@@ -2,7 +2,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% $Date: 2011-11-28 14:41:26 +0100 (Mon, 28 Nov 2011) $
% $Date: 2011-11-28 14:41:26 +0100 (Mon, 28 Nov 2011) $
% $Revision: 6764 $
%
% This file is part of ProbLog
@@ -412,24 +412,17 @@ logger_start_timer(Name) :-
(
statistics(walltime,[StartTime,_]),
bb_put(Key,StartTime)
);(
bb_get(Key,_)
)
;
(
bb_get(Key,_)
->
(
write('logger_start_timer, timer '),
write(Name),
write(' is already started'),
nl,
fail
);(
write('logger_start_timer, timer '),
write(Name),
write(' is not defined'),
nl,
fail
)
)
),!.
format(user_error, 'logger_start_timer, timer ~a is already started~n', [Name])
;
format(user_error, 'logger_start_timer, timer ~a is not defined~n', [Name])
)
),
!.
logger_stop_timer(Name) :-

View File

@@ -219,7 +219,7 @@
% load library modules
:- use_module(library(system), [exec/3, file_exists/1,wait/2]).
:- use_module(library(system), [exec/3, file_exists/1,wait/2, md5/3]).
:- use_module(library(lists), [memberchk/2]).
:- yap_flag(arithmetic_exceptions, false).
@@ -292,57 +292,27 @@ concat_path_with_filename(Path, File_Name, Result):-
%========================================================================
calc_md5(Filename,MD5):-
catch(calc_md5_intern(Filename,'md5sum',MD5),_,fail),
!.
calc_md5(Filename,MD5):-
catch(calc_md5_intern(Filename,'md5 -r',MD5),_,fail),
% used in Mac OS
% the -r makes the output conform with md5sum
catch(calc_md5_intern(Filename,MD5),_,fail),
!.
calc_md5(Filename,MD5):-
throw(md5error(calc_md5(Filename,MD5))).
calc_md5_intern(Filename,Command,MD5) :-
calc_md5_intern(Filename,MD5) :-
( file_exists(Filename) -> true ; throw(md5_file(Filename)) ),
file_to_codes(Filename, S, []),
md5( S, MD5, [] ),
format('~s => ~s~n', [S,MD5]).
atomic_concat([Command,' "',Filename,'"'],Call),
% execute the md5 command
exec(Call,[null,pipe(S),null],PID),
bb_put(calc_md5_temp,End-End), % use difference list
bb_put(calc_md5_temp2,0),
file_to_codes( F, Codes, LF ) :-
open(F, read, S),
get_codes( S, Codes, LF).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
( % read 32 Bytes from stdout of process
repeat,
get_byte(S,C),
(
C== -1
->
(
close(S),
wait(PID,_Status),
throw(md5error('premature end of output stream, please check os.yap calc_md5/2'))
);
true
),
bb_get(calc_md5_temp,List-[C|NewEnd]),
bb_put(calc_md5_temp,List-NewEnd),
bb_get(calc_md5_temp2,OldLength),
NewLength is OldLength+1,
bb_put(calc_md5_temp2,NewLength),
NewLength=32
),
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
get_codes(S, [C|L], LF) :-
get_code(S, C),
C \= -1,
!,
close(S),
wait(PID,_Status),
bb_delete(calc_md5_temp, FinalList-[]),
bb_delete(calc_md5_temp2,_),
atom_codes(MD5,FinalList).
get_codes(S, L, LF).
get_codes(_, LF, LF).
%========================================================================
%=
@@ -364,5 +334,5 @@ path_grouping(PathSep) :-
path_separator('\\') :-
current_prolog_flag( windows, true ).
path_separator('/').
path_separator('/').