[m-rev.] diff: add text_{input,output}_stream types and fix documentation bugs

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Jul 27 17:45:21 AEST 2006


Estimated hours taken: 0.2
Branches: main, release

library/io.m:
 	Add the equivalences text_input_stream == input_stream and
 	text_output_stream == output_stream.  The text_ versions are less
 	ambiguous then the existing ones.

 	s/IO/I\/O/ (previously we used a mixture of both).

 	Reformat some documentation.

library/pqueue.m:
 	Fix a spot where the conversion to 4-space indentation had gone awry.

library/dir.m:
 	Reposition a section heading.

library/string.m:
browser/declarative_tree.m:
compiler/java_util.m:
compiler/mercury_compile.m:
compiler/typecheck.m:
 	Fix some typos.

Julien.

Index: browser/declarative_tree.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_tree.m,v
retrieving revision 1.43
diff -u -r1.43 declarative_tree.m
--- browser/declarative_tree.m	8 Jun 2006 08:19:01 -0000	1.43
+++ browser/declarative_tree.m	27 Jul 2006 04:21:39 -0000
@@ -1026,7 +1026,7 @@
      ;
          %
          % We wish to step through negated contexts, so we handle NEGE
-        % and COND events seperately, since step_left_in_contour/2
+        % and COND events separately, since step_left_in_contour/2
          % will throw an exception if it reaches the boundary of a
          % negated context.
          %
Index: compiler/java_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/java_util.m,v
retrieving revision 1.17
diff -u -r1.17 java_util.m
--- compiler/java_util.m	17 Mar 2006 01:40:22 -0000	1.17
+++ compiler/java_util.m	27 Jul 2006 04:22:08 -0000
@@ -14,6 +14,7 @@
  % module may require changes to c_util.m.
  %
  %-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%

  :- module ml_backend.java_util.
  :- interface.
@@ -74,7 +75,7 @@

      % Tags are not used in the Java back-end, as such, all of the tagging
      % operators except for `tag' return no-ops. The `tag' case is handled
-    % seperately in mlds_to_java__output_std_unop.
+    % separately in mlds_to_java__output_std_unop.
      %
  java_unary_prefix_op(mktag,           "/* mktag */ ").
  java_unary_prefix_op(unmktag,         "/* unmktag */ ").
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.394
diff -u -r1.394 mercury_compile.m
--- compiler/mercury_compile.m	27 Jul 2006 05:01:12 -0000	1.394
+++ compiler/mercury_compile.m	27 Jul 2006 05:53:12 -0000
@@ -784,7 +784,7 @@
      % Figure out whether the argument is a module name or a file name.
      % Open the specified file or module, and process it.
      % Return the list of modules (including sub-modules,
-    % if they were compiled to seperate object files)
+    % if they were compiled to separate object files)
      % that should be linked into the final executable.

  :- pred process_arg(options_variables::in, list(string)::in, string::in,
Index: compiler/typecheck.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/typecheck.m,v
retrieving revision 1.396
diff -u -r1.396 typecheck.m
--- compiler/typecheck.m	27 Jul 2006 05:01:29 -0000	1.396
+++ compiler/typecheck.m	27 Jul 2006 05:53:16 -0000
@@ -733,7 +733,7 @@
      % Check whether the argument types, type quantifiers, and type
      % constraints are identical up to renaming.
      %
-    % Note that we can't compare each of the parts seperately, since
+    % Note that we can't compare each of the parts separately, since
      % we need to ensure that the renaming (if any) is consistent
      % over all the arguments and all the constraints.  So we need
      % to append all the relevant types into one big type list and
Index: library/dir.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/dir.m,v
retrieving revision 1.33
diff -u -r1.33 dir.m
--- library/dir.m	19 Apr 2006 05:17:51 -0000	1.33
+++ library/dir.m	27 Jul 2006 04:14:51 -0000
@@ -31,8 +31,9 @@
  :- import_module string.

  %-----------------------------------------------------------------------------%
-
-    % predicates to isolate system dependencies
+%
+% Predicates to isolate system dependencies
+%

      % Returns the default separator between components of a pathname --
      % '/' on Unix systems and '\\' on Microsoft Windows systems.
Index: library/io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.349
diff -u -r1.349 io.m
--- library/io.m	25 Jul 2006 06:23:18 -0000	1.349
+++ library/io.m	26 Jul 2006 06:33:12 -0000
@@ -53,18 +53,21 @@
      % Opaque handles for text I/O streams.
      %
  :- type io.input_stream.
-
  :- type io.output_stream.

+    % Alternative names for the above.
+    %
+:- type io.text_input_stream == io.input_stream.
+:- type io.text_output_stream == io.output_stream.
+
      % Opaque handles for binary I/O streams.
      %
  :- type io.binary_input_stream     ==  io.binary_stream.
-
  :- type io.binary_output_stream    ==  io.binary_stream.

  :- type io.binary_stream.

-    % A unique identifier for an IO stream.
+    % A unique identifier for an I/O stream.
      %
  :- type io.stream_id.

@@ -103,14 +106,14 @@

      % Poly-type is used for io.write_many and io.format,
      % which do printf-like formatting.
-
+    %
  :- type io.poly_type == string.poly_type.

      % io.whence denotes the base for a seek operation.
      %   set - seek relative to the start of the file
      %   cur - seek relative to the current position in the file
      %   end - seek relative to the end of the file.
-
+    %
  :- type io.whence
      --->    set
      ;       cur
@@ -317,6 +320,7 @@
      is det.

      % The type `posn' represents a position within a string.
+    %
  :- type posn
      --->    posn(int, int, int).
              % line number, offset of start of line, current offset (the first
@@ -386,8 +390,7 @@

  :- pred io.print(io.output_stream::in, T::in, io::di, io::uo) is det.

-:- pred io.print(io.output_stream, deconstruct.noncanon_handling, T,
-    io, io).
+:- pred io.print(io.output_stream, deconstruct.noncanon_handling, T, io, io).
  :- mode io.print(in, in(do_not_allow), in, di, uo) is det.
  :- mode io.print(in, in(canonicalize), in, di, uo) is det.
  :- mode io.print(in, in(include_details_cc), in, di, uo) is cc_multi.
@@ -531,10 +534,10 @@

  %-----------------------------------------------------------------------------%
  %
-% Input text stream predicates.
+% Input text stream predicates
  %

-    % io.see(File, Result, !IO):
+    % io.see(File, Result, !IO).
      % Attempts to open a file for input, and if successful,
      % sets the current input stream to the newly opened stream.
      % Result is either 'ok' or 'error'.
@@ -553,12 +556,13 @@
  :- pred io.open_input(string::in, io.res(io.input_stream)::out,
      io::di, io::uo) is det.

-    % Closes an open input stream. This will throw an io.error exception
-    % if an I/O error occurs.
+    % Closes an open input stream.
+    % Throw an io.error exception if an I/O error occurs.
      %
  :- pred io.close_input(io.input_stream::in, io::di, io::uo) is det.

-    % Retrieves the current input stream. Does not modify the IO state.
+    % Retrieves the current input stream.
+    % Does not modify the I/O state.
      %
  :- pred io.input_stream(io.input_stream::out, io::di, io::uo) is det.

@@ -573,7 +577,8 @@
      %
  :- func io.stdin_stream = io.input_stream.

-    % Retrieves the standard input stream. Does not modify the IO state.
+    % Retrieves the standard input stream.
+    % Does not modify the I/O state.
      %
  :- pred io.stdin_stream(io.input_stream::out, io::di, io::uo) is det.

@@ -614,7 +619,7 @@

  %-----------------------------------------------------------------------------%
  %
-% Output text stream predicates.
+% Output text stream predicates
  %

      % Attempts to open a file for output, and if successful sets the current
@@ -646,7 +651,8 @@
      %
  :- pred io.close_output(io.output_stream::in, io::di, io::uo) is det.

-    % Retrieves the current output stream. Does not modify the IO state.
+    % Retrieves the current output stream.
+    % Does not modify the I/O state.
      %
  :- pred io.output_stream(io.output_stream::out, io::di, io::uo) is det.

@@ -660,7 +666,8 @@
      %
  :- func io.stdout_stream = io.output_stream.

-    % Retrieves the standard output stream. Does not modify the IO state.
+    % Retrieves the standard output stream.
+    % Does not modify the I/O state.
      %
  :- pred io.stdout_stream(io.output_stream::out, io::di, io::uo) is det.

@@ -668,7 +675,8 @@
      %
  :- func io.stderr_stream = io.output_stream.

-    % Retrieves the standard error stream. Does not modify the IO state.
+    % Retrieves the standard error stream.
+    % Does not modify the I/O state.
      %
  :- pred io.stderr_stream(io.output_stream::out, io::di, io::uo) is det.

@@ -712,7 +720,7 @@

  %-----------------------------------------------------------------------------%
  %
-% Binary input predicates.
+% Binary input predicates
  %

      % Reads a binary representation of a term of type T from the current
@@ -860,7 +868,7 @@

  %-----------------------------------------------------------------------------%
  %
-% Binary output predicates.
+% Binary output predicates
  %

  % These will all throw an io.error exception if an I/O error occurs.
@@ -925,7 +933,7 @@

  %-----------------------------------------------------------------------------%
  %
-% Binary input stream predicates.
+% Binary input stream predicates
  %

      % Attempts to open a file for binary input, and if successful sets
@@ -953,7 +961,7 @@
      io::di, io::uo) is det.

      % Retrieves the current binary input stream.
-    % Does not modify the IO state.
+    % Does not modify the I/O state.
      %
  :- pred io.binary_input_stream(io.binary_input_stream::out,
      io::di, io::uo) is det.
@@ -965,7 +973,7 @@
      io.binary_input_stream::out, io::di, io::uo) is det.

      % Retrieves the standard binary input stream.
-    % Does not modify the IO state.
+    % Does not modify the I/O state.
      %
  :- pred io.stdin_binary_stream(io.binary_input_stream::out,
      io::di, io::uo) is det.
@@ -983,7 +991,7 @@

  %-----------------------------------------------------------------------------%
  %
-% Binary output stream predicates.
+% Binary output stream predicates
  %

      % Attempts to open a file for binary output, and if successful sets
@@ -1011,20 +1019,19 @@
      io.res(io.binary_output_stream)::out, io::di, io::uo) is det.

      % Closes an open binary output stream.
-    % This will throw an io.error exception
-    % if an I/O error occurs.
+    % This will throw an io.error exception if an I/O error occurs.
      %
  :- pred io.close_binary_output(io.binary_output_stream::in,
      io::di, io::uo) is det.

      % Retrieves the current binary output stream.
-    % Does not modify the IO state.
+    % Does not modify the I/O state.
      %
  :- pred io.binary_output_stream(io.binary_output_stream::out,
      io::di, io::uo) is det.

      % Retrieves the standard binary output stream.
-    % Does not modify the IO state.
+    % Does not modify the I/O state.
      %
  :- pred io.stdout_binary_stream(io.binary_output_stream::out,
      io::di, io::uo) is det.
@@ -1048,18 +1055,18 @@

  %-----------------------------------------------------------------------------%
  %
-% Global state predicates.
+% Global state predicates
  %

-    % io.progname(DefaultProgname, Progname):
+    % io.progname(DefaultProgname, Progname).
      %
      % Returns the name that the program was invoked with, if available,
      % or DefaultProgname if the name is not available.
-    % Does not modify the IO state.
+    % Does not modify the I/O state.
      %
  :- pred io.progname(string::in, string::out, io::di, io::uo) is det.

-    % io.progname_base(DefaultProgname, Progname):
+    % io.progname_base(DefaultProgname, Progname).
      %
      % Like `io.progname', except that it strips off any path name
      % preceding the program name.  Useful for error messages.
@@ -1067,17 +1074,16 @@
  :- pred io.progname_base(string::in, string::out, io::di, io::uo) is det.

      % Returns the arguments that the program was invoked with,
-    % if available, otherwise an empty list. Does not modify the IO state.
+    % if available, otherwise an empty list. Does not modify the I/O state.
      %
  :- pred io.command_line_arguments(list(string)::out, io::di, io::uo) is det.

-    % The io.state contains an integer used to record the program's exit
+    % The I/O state contains an integer used to record the program's exit
      % status. When the program finishes, it will return this exit status
      % to the operating system. The following predicates can be used to get
      % and set the exit status.
      %
  :- pred io.get_exit_status(int::out, io::di, io::uo) is det.
-
  :- pred io.set_exit_status(int::in, io::di, io::uo) is det.

      % The io.state includes a `globals' field which is not used by the I/O
@@ -1085,7 +1091,7 @@
      % of type `univ' so that the application can store any data it wants there.
      % The following predicates can be used to access this global state.
      %
-    % Doesn't modify the io.state.
+    % Does not modify the I/O state.
      %
  :- pred io.get_globals(univ::uo, io::di, io::uo) is det.

@@ -1135,15 +1141,15 @@
      %
  :- pred io.make_temp(string::out, io::di, io::uo) is det.

-    % io.make_temp(Dir, Prefix, Name, IO0, IO) creates an empty file whose
+    % io.make_temp(Dir, Prefix, Name, !IO) creates an empty file whose
      % name is different to the name of any existing file. The file will reside
      % in the directory specified by `Dir' and will have a prefix using up to
      % the first 5 characters of `Prefix'. Name is bound to the name of the
      % file. It is the responsibility of the program to delete the file
      % when it is no longer needed.
      %
-:- pred io.make_temp(string::in, string::in, string::out,
-    io::di, io::uo) is det.
+:- pred io.make_temp(string::in, string::in, string::out, io::di, io::uo)
+    is det.

      % io.remove_file(FileName, Result, !IO) attempts to remove the file
      % `FileName', binding Result to ok/0 if it succeeds, or error/1 if it
@@ -1152,7 +1158,7 @@
      %
  :- pred io.remove_file(string::in, io.res::out, io::di, io::uo) is det.

-    % io.rename_file(OldFileName, NewFileName, Result, !IO):
+    % io.rename_file(OldFileName, NewFileName, Result, !IO).
      %
      % Attempts to rename the file `OldFileName' as `NewFileName', binding
      % Result to ok/0 if it succeeds, or error/1 if it fails. If `OldFileName'
@@ -1162,21 +1168,21 @@
      % the file previously named `NewFileName' will be deleted and replaced
      % with the file previously named `OldFileName'.
      %
-:- pred io.rename_file(string::in, string::in, io.res::out,
-    io::di, io::uo) is det.
+:- pred io.rename_file(string::in, string::in, io.res::out, io::di, io::uo)
+    is det.

-    % Can this platform read and create symbolic links.
+    % Succeeds if this platform can read and create symbolic links.
      %
  :- pred io.have_symlinks is semidet.

-    % io.make_symlink(FileName, LinkFileName, Result, !IO):
+    % io.make_symlink(FileName, LinkFileName, Result, !IO).
      %
      % Attempts to make `LinkFileName' be a symbolic link to `FileName'.
      % If `FileName' is a relative path, it is interpreted relative
      % to the directory containing `LinkFileName'.
      %
-:- pred io.make_symlink(string::in, string::in, io.res::out,
-    io::di, io::uo) is det.
+:- pred io.make_symlink(string::in, string::in, io.res::out, io::di, io::uo)
+    is det.

      % io.read_symlink(FileName, Result, !IO) returns `ok(LinkTarget)'
      % if `FileName' is a symbolic link pointing to `LinkTarget', and
@@ -1229,7 +1235,7 @@

  %-----------------------------------------------------------------------------%
  %
-% Memory management predicates.
+% Memory management predicates
  %

      % Write memory/time usage statistics to stderr.
Index: library/pqueue.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/pqueue.m,v
retrieving revision 1.23
diff -u -r1.23 pqueue.m
--- library/pqueue.m	19 Apr 2006 05:17:54 -0000	1.23
+++ library/pqueue.m	27 Jul 2006 04:11:46 -0000
@@ -76,9 +76,11 @@
  :- import_module list.
  :- import_module pair.

+%---------------------------------------------------------------------------%
+
  :- type pqueue(K, V)
      --->    empty
-    ;   pqueue(int, K, V, pqueue(K, V), pqueue(K, V)).
+    ;       pqueue(int, K, V, pqueue(K, V), pqueue(K, V)).

  %---------------------------------------------------------------------------%

Index: library/string.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.245
diff -u -r1.245 string.m
--- library/string.m	19 Apr 2006 05:17:57 -0000	1.245
+++ library/string.m	27 Jul 2006 04:20:15 -0000
@@ -738,10 +738,10 @@
      %
  :- func string.word_wrap(string, int) = string.

-    % word_wrap(Str, N, WordSeperator) = Wrapped.
+    % word_wrap(Str, N, WordSeparator) = Wrapped.
      % word_wrap/3 is like word_wrap/2, except that words that need to be broken
-    % up over multiple lines have WordSeperator inserted between each piece.
-    % If the length of WordSeperator is greater that or equal to N, then
+    % up over multiple lines have WordSeparator inserted between each piece.
+    % If the length of WordSeparator is greater that or equal to N, then
      % no separator is used.
      %
  :- func string.word_wrap(string, int, string) = string.
@@ -4576,13 +4576,13 @@

  %------------------------------------------------------------------------------%

-string.format_table(Columns, Seperator) = Table :-
+string.format_table(Columns, Separator) = Table :-
      MaxWidths = list.map(find_max_length, Columns),
      PaddedColumns = list.map_corresponding(pad_column, MaxWidths, Columns),
      (
          PaddedColumns = [PaddedHead | PaddedTail],
          Rows = list.foldl(list.map_corresponding(
-            string.join_rev_columns(Seperator)), PaddedTail, PaddedHead)
+            string.join_rev_columns(Separator)), PaddedTail, PaddedHead)
      ;
          PaddedColumns = [],
          Rows = []
@@ -4591,7 +4591,7 @@

  :- func join_rev_columns(string, string, string) = string.

-join_rev_columns(Seperator, Col1, Col2) = Col2 ++ Seperator ++ Col1.
+join_rev_columns(Separator, Col1, Col2) = Col2 ++ Separator ++ Col1.

  :- func find_max_length(justified_column) = int.


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