[mercury-users] seek_binary

Richard A. O'Keefe ok at cs.otago.ac.nz
Wed Nov 13 11:23:41 AEDT 2002


Fergus Henderson <fjh at cs.mu.OZ.AU> pointed out the comments.
I'd like to make another comment about io__seek_binary//3.
	> :- pred io__seek_binary(io__binary_stream, io__whence, int, 
	> io__state, io__state).
	> 
	> io__whence is defined as
	> :- type io__whence --->
	>     set
	> ;   cur
	> ;   end
	
This really would be better as

    :- pred io__seek_binary(io__binary_stream, io__position,
                            io_state, io_state).
    :- type io__position
       ---> absolute(int)	% int >= 0
          ; relative(int)	% any sign
          ; end_relative(int)	% some systems may require int <= 0
          ; start		% abbreviate absolute(0), rewind()
          ; end			% abbreviate end_relative(0)
          ; ...

where the dots indicate that there are other ways to represent a position
in other file systems which could well be supported.  (I know that Compaq
announced the death of Alpha, but I also know that BLISS has been ported
to IA32 and IA64, so we may very well see OpenVMS on IA64.  The mind reels.
We shall CERTAINLY continue to see MVS on z/Architecture.)

The fact that all the currently supported 'io__whence' values require
exactly one integer is sort of accidental.  Amongst other things, if you
want to support 64-bit file systems, you want to be able to pass 64-bit
offsets, so something analogous to

    :- type io__position
       ---> ...
          ; absolute64(int64)
          ; relative64(int64)
          ; end_relative64(int64)
	  ; ...

might be needed as well.

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



More information about the users mailing list