[m-rev.] for review: make `mmc --make' warn about truncated error logs

Julien Fischer juliensf at cs.mu.OZ.AU
Mon Dec 12 16:23:09 AEDT 2005


On Mon, 12 Dec 2005, Peter Wang wrote:

> Estimated hours taken: 2
> Branches: main
>
> compiler/make.util.m:
> 	Make `mmc --make' print an informative message telling the user where
> 	to look for the full error message log if it is truncating the log on
> 	standard output because of the `--output-compile-error-lines' option.
>
> Index: compiler/make.util.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/make.util.m,v
> retrieving revision 1.26
> diff -u -r1.26 make.util.m
> --- compiler/make.util.m	28 Nov 2005 04:11:45 -0000	1.26
> +++ compiler/make.util.m	11 Dec 2005 23:34:12 -0000
> @@ -454,9 +454,8 @@
>                  LinesToWrite, !IO),
>              io__output_stream(CurrentOutputStream, !IO),
>              io__input_stream_foldl2_io(TmpErrorInputStream,
> -                write_error_char(ErrorFileOutputStream,
> -                CurrentOutputStream, LinesToWrite),
> -                0, TmpFileInputRes, !IO),
> +                write_error_char(ErrorFileOutputStream, CurrentOutputStream),
> +                LinesToWrite, TmpFileInputRes, !IO),
>              (
>                  TmpFileInputRes = ok(_)
>              ;
> @@ -492,18 +491,26 @@
>      io__remove_file(TmpErrorFileName, _, !IO).
>
>  :- pred write_error_char(io__output_stream::in, io__output_stream::in,
> -    int::in, char::in, int::in, int::out, io::di, io::uo) is det.
> +    char::in, int::in, int::out, io::di, io::uo) is det.
>
> -write_error_char(FullOutputStream, PartialOutputStream, LineLimit,
> -        Char, !Lines, !IO) :-
> +write_error_char(FullOutputStream, PartialOutputStream, Char,
> +        !LinesRemaining, !IO) :-
>      io__write_char(FullOutputStream, Char, !IO),
> -    ( !.Lines < LineLimit ->
> -        io__write_char(PartialOutputStream, Char, !IO)
> -    ;
> -        true
> -    ),
> -    ( Char = '\n' ->
> -        !:Lines = !.Lines + 1
> +    ( !.LinesRemaining > 0 ->
> +        io__write_char(PartialOutputStream, Char, !IO),
> +        ( Char = '\n' ->
> +            !:LinesRemaining = !.LinesRemaining - 1
> +        ;
> +            true
> +        )
> +    ; !.LinesRemaining = 0 ->
> +        io.output_stream_name(FullOutputStream, FullOutputFileName, !IO),
> +        io.write_string(PartialOutputStream, "... error log truncated, see `",
> +            !IO),
> +        io.write_string(PartialOutputStream, FullOutputFileName, !IO),
> +        io.write_string(PartialOutputStream, "' for the rest.\n", !IO),
> +        % Only write the above message once.
> +        !:LinesRemaining = -1
>      ;
>          true
>      ).

I suggst s/rest/complete error log/ or somthing along those lines,
otherwise that's fine.

Cheers,
Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list