[m-rev.] for review: document `--use-grade-subdirs'

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Oct 30 22:55:58 AEDT 2002


On 30-Oct-2002, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> Index: NEWS
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/NEWS,v
> retrieving revision 1.274
> diff -u -u -r1.274 NEWS
> --- NEWS	22 Oct 2002 13:10:33 -0000	1.274
> +++ NEWS	30 Oct 2002 04:03:00 -0000
> @@ -318,6 +318,11 @@
>    is a list of the names of all of the source files.  If the names of the
>    source files all match the contained module names, `mmc -f' need not be run.
>  
> +* There is a new `--use-grade-subdirs' option which is similar to
> +  `--use-subdirs', but allows multiple grades to be built in a
> +  directory at the same time.  `--use-grade-subdirs' does not
> +  work with Mmake.

It might be worth mentioning here that it does work with --make.

> Index: compiler/compile_target_code.m
> @@ -981,8 +980,53 @@
>  			LDFlags, " ", LinkLibraries],
>  			LinkCmd) },
>  		invoke_shell_command(ErrorStream, verbose_commands,
> -			LinkCmd, Succeeded),
> -		maybe_report_stats(Stats)
> +			LinkCmd, LinkSucceeded),
> +		maybe_report_stats(Stats),
> +		globals__io_lookup_bool_option(use_grade_subdirs,
> +			UseGradeSubdirs),
> +		(
> +			{ LinkSucceeded = yes },
> +			{ LinkTargetType = executable },
> +			{ UseGradeSubdirs = yes }
> +		->
> +			% Link/copy the executable into the user's
> +			% directory. We don't do this for libraries
> +			% because in general they shouldn't be used
> +			% without being installed.

I don't agree with the comment here.
Often it does make sense to use a library before it is installed.

> +			globals__io_set_option(use_grade_subdirs, bool(no)),
> +			module_name_to_file_name(ModuleName, "", no,
> +				UserDirExeName),
> +			globals__io_set_option(use_grade_subdirs,
> +				bool(UseGradeSubdirs)),
> +
> +			make_symlink(OutputFileName, UserDirExeName,
> +				SymlinkSucceeded),
> +			( { SymlinkSucceeded = yes } ->
> +				{ Succeeded = yes }
> +			;
> +				copy_file(OutputFileName, UserDirExeName,
> +					CopyRes),

It would probably be worth abstracting the "make_symlink || copy_file"
functionality out into a separate procedure.

> +++ compiler/modules.m	29 Oct 2002 13:59:32 -0000
...
> +	% XXX This belongs in the library.

s/library/standard library/g

> +	% make_symlink(LinkTarget, LinkName, Succeeded)
> +	%
> +	% Make a LinkName a symlink pointing to LinkTarget.

s/a LinkName/LinkName/

> +copy_file(Source, Destination, Res) -->
> +	io__open_input(Source, SourceRes),
> +	(
> +		{ SourceRes = ok(InputStream) },
> +		io__open_output(Destination, DestRes),
> +		(
> +			{ DestRes = ok(OutputStream) },
> +			% XXX Depending on file size it may be
> +			% faster to call the system's cp command.
> +			io__input_stream_foldl_io(
> +				(pred(Char::in, di, uo) is det -->
> +					io__write_char(Char)
> +				),
> +				Res),

For copying files, you should use binary mode, not text mode.

> Index: doc/user_guide.texi
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
> retrieving revision 1.333
> diff -u -u -r1.333 user_guide.texi
> --- doc/user_guide.texi	26 Oct 2002 14:15:33 -0000	1.333
> +++ doc/user_guide.texi	29 Oct 2002 13:59:32 -0000
> @@ -6188,6 +6188,17 @@
>  Create intermediate files in a @file{Mercury} subdirectory,
>  rather than in the current directory.
>  
> + at item --use-grade-subdirs
> + at findex --use-grade-subdirs
> + at cindex File names
> + at cindex Directories
> + at cindex Subdirectories
> + at cindex @file{Mercury} subdirectory

I suggest also

	@cindex Grades

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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