[m-rev.] diff: add -f option to mkinit to avoid command line overflows
Julien Fischer
juliensf at csse.unimelb.edu.au
Fri Jun 15 17:27:07 AEST 2007
On Thu, 14 Jun 2007, Peter Ross wrote:
> Estimated hours taken: 4
> Branches: main
>
> Windows has a limit on the command line length. Allow mkinit
> to be passed a list of files to be processed in a file via
> -f to avoid this limit.
>
> compiler/compile_target_code.m:
> Use the -f option to avoid overflowing the windows
> command line.
>
> util/mkinit.c:
> Add code to handle the -f option.
I think the idea is that mkinit_erl's options should be kept in
sync with those of mkinit, so you also need to add a -f option
to mkinit_erl (which ought to abort if invoked with -f ).
> Index: compiler/compile_target_code.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/compile_target_code.m,v
> retrieving revision 1.111
> diff -u -r1.111 compile_target_code.m
> --- compiler/compile_target_code.m 14 Jun 2007 00:18:26 -0000 1.111
> +++ compiler/compile_target_code.m 14 Jun 2007 07:22:39 -0000
> @@ -995,12 +995,33 @@
> InitFileRes = ok(InitFileStream),
> list.map_foldl(module_name_to_file_name_ext(TargetExt, no),
> AllModules, AllTargetFilesList, !IO),
> - join_quoted_string_list(AllTargetFilesList, "", "", " ",
> + join_quoted_string_list(AllTargetFilesList, "", "\n", "",
> TargetFileNames),
>
> - MkInitCmd = string.append_list([MkInit, " -k ", TargetFileNames]),
> - invoke_system_command(InitFileStream, cmd_verbose, MkInitCmd, MkInitOK,
> - !IO),
> + io.make_temp(TmpFile, !IO),
> + io.open_output(TmpFile, OpenResult, !IO),
> + (
> + OpenResult = ok(TmpStream),
> + io.write_string(TmpStream, TargetFileNames, !IO),
> + io.close_output(TmpStream, !IO),
> +
> + MkInitCmd = string.append_list([MkInit, " -k -f ", TmpFile]),
> + invoke_system_command(InitFileStream, cmd_verbose,
> + MkInitCmd, MkInitOK0, !IO),
> +
> + io.remove_file(TmpFile, RemoveResult, !IO),
> + (
> + RemoveResult = ok,
> + MkInitOK = MkInitOK0
> + ;
> + RemoveResult = error(_),
> + MkInitOK = no
> + )
> + ;
> + OpenResult = error(_),
> + MkInitOK = no
> + ),
> +
>
> (
> MkInitOK = yes,
You may also need to modify make_init_target_file/11 in the same file
in a similar way.
Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list