document lineutils

This commit is contained in:
Vitor Santos Costa 2008-09-01 04:44:54 +01:00
parent 6062b1c738
commit 2a53a46d12
2 changed files with 9 additions and 6 deletions

View File

@ -6801,7 +6801,6 @@ compound terms.
@node Profiling, Call Counting, Global Variables, Top @node Profiling, Call Counting, Global Variables, Top
>>>>>>> 1.222
@section Profiling Prolog Programs @section Profiling Prolog Programs
@cindex profiling @cindex profiling
@ -11003,7 +11002,6 @@ Print trie @var{Trie} on standard output.
@node Cleanup, Timeout, Tries, Library @node Cleanup, Timeout, Tries, Library
>>>>>>> 1.211
@section Call Cleanup @section Call Cleanup
@cindex cleanup @cindex cleanup

View File

@ -1,14 +1,14 @@
:- module(line_utils, :- module(line_utils,
[search_for/3, [search_for/2,
search_for/3,
scan_natural/3, scan_natural/3,
scan_integer/3, scan_integer/3,
split/3, split/3,
glue/3, glue/3,
copy_line/2,
filter/3, filter/3,
file_filter/3, file_filter/3,
process/2, process/2,
copy_line/2,
file_filter/3
]). ]).
:- meta_predicate filter(+,+,:), file_filter(+,+,:), process(+,:). :- meta_predicate filter(+,+,:), file_filter(+,+,:), process(+,:).
@ -20,6 +20,8 @@
:- use_module(library(readutil), :- use_module(library(readutil),
[read_line_to_codes/2]). [read_line_to_codes/2]).
search_for(C,L) :-
search_for(C, L, []).
search_for(C) --> [C], !. search_for(C) --> [C], !.
search_for(C) --> [_], search_for(C) --> [_],
@ -32,10 +34,13 @@ scan_integer(N) -->
scan_integer(N) --> scan_integer(N) -->
scan_natural(0, N). scan_natural(0, N).
scan_natural(N) -->
scan_natural(0, N).
scan_natural(N0,N) --> scan_natural(N0,N) -->
[C], [C],
{C >= 0'0, C =< 0'9 }, !, {C >= 0'0, C =< 0'9 }, !,
{ N1 is N0*10+(C-0'0) }, { N1 is N0*10+(C-0'0) }, %'
get_natural(N1,N). get_natural(N1,N).
scan_natural(N,N) --> []. scan_natural(N,N) --> [].