[m-rev.] for review: finish dir.m implementation for erlang backend

Ian MacLarty maclarty at csse.unimelb.edu.au
Mon Oct 1 13:54:47 AEST 2007


On Wed, Sep 26, 2007 at 11:03:00AM +1000, Peter Wang wrote:
> Estimated hours taken: 6
> Branches: main
> 
> Finish implementation of dir.m for Erlang backend.
> 
> library/dir.m:
> 	Change the procedures in this module to thread `dir.stream' values
> 	through them.  In the Erlang backend a `dir.stream' is a list of file
> 	names in a directory, rather than a handle, so an output argument is
> 	needed when reading an entry from the stream.
> 
> 	Implement the missing foreign_procs for Erlang.
> 
> library/io.m:
> 	Make the Erlang implementation of `io.file_type' support symlinks.
> 
> 	Implement `file_id' support for Erlang.
> 
> 	Fix the C implementation of compare on `file_id's, which did not take
> 	into account file inodes at all.
> 
> 	Fix error handling in the Erlang implementation of
> 	`io.make_symlink_2'.
> 
> tests/hard_coded/dir_test.exp2:
> 	Update expected output for the fixed `file_id' comparison.
> 
> tests/hard_coded/dir_test.exp3:
> 	Update expected output for a previous change (addition of
> 	`dir.current_directory').
> 
> Index: library/dir.m
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/library/dir.m,v
> retrieving revision 1.43
> diff -u -r1.43 dir.m
> --- library/dir.m	21 Sep 2007 03:21:35 -0000	1.43
> +++ library/dir.m	26 Sep 2007 01:07:17 -0000
> @@ -1214,14 +1214,14 @@
>      list(file_id)::in, bool::in, bool::in, bool::out, T::in,
>      io.maybe_partial_res(T)::out, io::di, io::uo) is det.
>  
> -:- pred dir.foldl2_process_dir2(dir.stream::in, bool::in,
> +:- pred dir.foldl2_process_dir2(dir.stream::in, dir.stream::out, bool::in,

Would it not be better to put the the dir.stream arguments at the end,
where state arguments normally go?

Another approach might be to use an io_mutvar instead of a threaded
pair.  Did you consider that option?

Otherwise it looks fine to me.

Ian.
--------------------------------------------------------------------------
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