[m-rev.] trivial diff: remove a bug workaround

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Mar 22 09:28:19 AEDT 2007


Estimated hours taken: 0.5
Branches: main

Remove a bug workaround in the the thread module.

Misc. minor changes to library modules.

library/thread.m:
 	Delete the workaround for the bug with foreign_import_module pragmas
 	and sub-modules on the lowlevel backends.

library/deconstruct.m:
library/sparse_bitset.m:
library/varset.m:
 	Delete duplicate imports.

library/io.m:
library/thread.semaphore.m:
 	s/which/that/ in a spot.

library/prolog.m:
 	Convert this module to 4-space indentation.

library/dir.m:
library/getopt.m:
library/getopt_io.m:
library/lexer.m:
 	Fix some formatting so that it conforms to our current coding
 	standard.

Julien.


Index: deconstruct.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/deconstruct.m,v
retrieving revision 1.43
diff -u -r1.43 deconstruct.m
--- deconstruct.m	13 Feb 2007 01:58:53 -0000	1.43
+++ deconstruct.m	21 Mar 2007 22:19:23 -0000
@@ -272,7 +272,6 @@

  :- implementation.

-:- import_module construct.
  :- import_module int.
  :- import_module require.
  :- import_module type_desc.
Index: dir.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/dir.m,v
retrieving revision 1.39
diff -u -r1.39 dir.m
--- dir.m	18 Jan 2007 07:33:02 -0000	1.39
+++ dir.m	21 Mar 2007 22:19:23 -0000
@@ -641,7 +641,7 @@
          (
              !.FileName = []
          ;
-            !.FileName = [_|_],
+            !.FileName = [_ | _],
              list.takewhile(isnt(dir.is_directory_separator_semidet),
                  !.FileName, Share, !:FileName),
              Share = [_ | _],
Index: getopt.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/getopt.m,v
retrieving revision 1.41
diff -u -r1.41 getopt.m
--- getopt.m	23 Oct 2006 00:32:56 -0000	1.41
+++ getopt.m	21 Mar 2007 22:19:23 -0000
@@ -281,6 +281,7 @@
      list(string).

  %-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%

  :- implementation.

@@ -289,6 +290,8 @@
  :- import_module solutions.
  :- import_module string.
  :- import_module svset.
+
+%-----------------------------------------------------------------------------%

  % Please keep the differences between this module and getopt_io.m to the
  % minimum. Most changes should done in both modules.
Index: getopt_io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/getopt_io.m,v
retrieving revision 1.10
diff -u -r1.10 getopt_io.m
--- getopt_io.m	23 Oct 2006 00:32:56 -0000	1.10
+++ getopt_io.m	21 Mar 2007 22:19:23 -0000
@@ -296,6 +296,9 @@
  :- import_module string.
  :- import_module svset.

+
+%-----------------------------------------------------------------------------%
+
  % Please keep the differences between this module and getopt.m to the
  % minimum. Most changes should done in both modules.

Index: io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.376
diff -u -r1.376 io.m
--- io.m	18 Mar 2007 23:34:59 -0000	1.376
+++ io.m	21 Mar 2007 22:19:23 -0000
@@ -24,7 +24,7 @@
  %
  % In multithreaded programs, each thread in the program has its own set of
  % "current" input and output streams. At the time it is created, a child
-% thread inherits the current streams from its parent. Predicates which
+% thread inherits the current streams from its parent. Predicates that
  % change which stream is current affect only the calling thread.
  %
  %-----------------------------------------------------------------------------%
Index: lexer.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/lexer.m,v
retrieving revision 1.53
diff -u -r1.53 lexer.m
--- lexer.m	18 Mar 2007 23:34:59 -0000	1.53
+++ lexer.m	21 Mar 2007 22:19:23 -0000
@@ -1,10 +1,10 @@
-%---------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
  % vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
-%---------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
  % Copyright (C) 1993-2000, 2003-2007 The University of Melbourne.
  % This file may only be copied under the terms of the GNU Library General
  % Public License - see the file COPYING.LIB in the Mercury distribution.
-%---------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
  %
  % File: lexer.m.
  % Main author: fjh.
@@ -100,6 +100,7 @@
      %
  :- pred token_to_string(token::in, string::out) is det.

+%-----------------------------------------------------------------------------%
  %-----------------------------------------------------------------------------%
  :- implementation.
  %-----------------------------------------------------------------------------%
Index: prolog.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/prolog.m,v
retrieving revision 1.20
diff -u -r1.20 prolog.m
--- prolog.m	19 Apr 2006 05:17:55 -0000	1.20
+++ prolog.m	21 Mar 2007 22:19:23 -0000
@@ -1,4 +1,6 @@
  %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
  % Copyright (C) 1997-2003, 2005-2006 The University of Melbourne.
  % This file may only be copied under the terms of the GNU Library General
  % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -23,29 +25,33 @@
  :- import_module univ.

  %-----------------------------------------------------------------------------%
+%
+% Prolog arithmetic operators
+%

-% Prolog arithmetic operators.
-
-:- pred T =:= T.			% In Mercury, just use =
+:- pred T =:= T.            % In Mercury, just use =
  :- mode in =:= in is semidet.

-:- pred T =\= T.			% In Mercury, just use \=
+:- pred T =\= T.            % In Mercury, just use \=
  :- mode in =\= in is semidet.

  /*******
  is/2 is currently defined in int.m, for historical reasons.

-:- pred is(T, T) is det.		% In Mercury, just use =
+:- pred is(T, T) is det.        % In Mercury, just use =
  :- mode is(uo, di) is det.
  :- mode is(out, in) is det.
  ******/

-% Prolog term comparison operators.
+%-----------------------------------------------------------------------------%
+%
+% Prolog term comparison operators
+%

-:- pred T == T.				% In Mercury, just use =
+:- pred T == T.             % In Mercury, just use =
  :- mode in == in is semidet.

-:- pred T \== T.			% In Mercury, just use \=
+:- pred T \== T.            % In Mercury, just use \=
  :- mode in \== in is semidet.

  % Prolog's so-called "univ" operator, `=..'.
@@ -54,24 +60,24 @@

  :- pred T =.. univ_result.
  :- mode in =.. out is det.
-	%
-	% Note that the Mercury =.. is a bit different to the Prolog
-	% one.  We could make it slightly more similar by overloading '.'/2,
-	% but that would cause ambiguities that might prevent type
-	% inference in a lot of cases.
-	%
+    %
+    % Note that the Mercury =.. is a bit different to the Prolog
+    % one.  We could make it slightly more similar by overloading '.'/2,
+    % but that would cause ambiguities that might prevent type
+    % inference in a lot of cases.
+    %
  % :- type univ_result ---> '.'(string, list(univ)).
  :- type univ_result == pair(string, list(univ)).

-	% arg/3.  In Mercury, use argument/3 (defined in module std_util)
-	% instead:
-	%      arg(ArgNum, Term, Data) :- argument(Term, ArgNum - 1, Data).
-	%
+    % arg/3.  In Mercury, use argument/3 (defined in module std_util)
+    % instead:
+    %      arg(ArgNum, Term, Data) :- argument(Term, ArgNum - 1, Data).
+    %
  :- pred arg(int::in, T::in, univ::out) is semidet.

-	% det_arg/3: like arg/3, but calls error/1 rather than failing
-	% if the index is out of range.
-	%
+    % det_arg/3: like arg/3, but calls error/1 rather than failing
+    % if the index is out of range.
+    %
  :- pred det_arg(int::in, T::in, univ::out) is det.

  %-----------------------------------------------------------------------------%
@@ -95,19 +101,19 @@
  '=\\='(X, Y) :- X \= Y.

  '=..'(Term, Functor - Args) :-
-	deconstruct(Term, canonicalize, Functor, _Arity, Args).
+    deconstruct(Term, canonicalize, Functor, _Arity, Args).

  % we use a module qualifier here to avoid
  % overriding the builtin Prolog version
  prolog.arg(ArgumentIndex, Type, Univ) :-
-	deconstruct.arg(Type, canonicalize, ArgumentIndex - 1, Arg),
-	type_to_univ(Arg, Univ).
+    deconstruct.arg(Type, canonicalize, ArgumentIndex - 1, Arg),
+    type_to_univ(Arg, Univ).

  det_arg(ArgumentIndex, Type, Argument) :-
-	( arg(ArgumentIndex, Type, Arg) ->
-		Argument = Arg
-	;
-		error("det_arg: arg failed")
-	).
+    ( arg(ArgumentIndex, Type, Arg) ->
+        Argument = Arg
+    ;
+        error("det_arg: arg failed")
+    ).

  %-----------------------------------------------------------------------------%
Index: sparse_bitset.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/sparse_bitset.m,v
retrieving revision 1.35
diff -u -r1.35 sparse_bitset.m
--- sparse_bitset.m	19 Jan 2007 07:05:05 -0000	1.35
+++ sparse_bitset.m	21 Mar 2007 22:19:23 -0000
@@ -379,7 +379,6 @@
  :- implementation.

  :- import_module int.
-:- import_module list.
  :- import_module require.

  %-----------------------------------------------------------------------------%
@@ -387,7 +386,7 @@
      % The number of variables for most procedures
      % should fit into one or two words.
  :- type sparse_bitset(T)    % <= enum(T)
-    ---> sparse_bitset(bitset_impl).
+    --->    sparse_bitset(bitset_impl).

      % The list of elements, sorted on offset.
      % No two elements have the same offset.
Index: thread.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/thread.m,v
retrieving revision 1.6
diff -u -r1.6 thread.m
--- thread.m	3 Mar 2007 03:43:34 -0000	1.6
+++ thread.m	21 Mar 2007 22:19:23 -0000
@@ -58,16 +58,6 @@

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

-    % XXX The following is necessary in order to avoid compilation errors in
-    % lowlevel grades.  For some reason parent modules are not #including
-    % their own .mh files.  Without this declaration the code for spawn/3
-    % will not compile.  This can be removed once the problem with the .mh
-    % files is fixed.
-    %
-:- pragma foreign_decl("C", "void ML_call_back_to_mercury_cc_multi(MR_Word);").
-
-%-----------------------------------------------------------------------------%
-
  :- pragma foreign_proc("C",
      can_spawn,
      [will_not_call_mercury, promise_pure],
Index: thread.semaphore.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/thread.semaphore.m,v
retrieving revision 1.5
diff -u -r1.5 thread.semaphore.m
--- thread.semaphore.m	3 Mar 2007 03:43:34 -0000	1.5
+++ thread.semaphore.m	21 Mar 2007 22:19:23 -0000
@@ -13,7 +13,7 @@
  % This module implements a simple semaphore data type for allowing
  % coroutines to synchronise with one another.
  %
-% The operations in this module are no-ops in the hlc grades which don't
+% The operations in this module are no-ops in the hlc grades that do not
  % contain a .par component.
  %
  %-----------------------------------------------------------------------------%
@@ -86,8 +86,8 @@
  }
  ").

-:- pragma foreign_type(c,  semaphore, "ML_Semaphore *").
-:- pragma foreign_type(il, semaphore,
+:- pragma foreign_type("C",  semaphore, "ML_Semaphore *").
+:- pragma foreign_type("IL", semaphore,
          "class [semaphore__csharp_code]ML_Semaphore").

  :- pragma foreign_decl("C", "
Index: varset.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/varset.m,v
retrieving revision 1.80
diff -u -r1.80 varset.m
--- varset.m	1 Nov 2006 06:33:38 -0000	1.80
+++ varset.m	21 Mar 2007 22:19:23 -0000
@@ -253,14 +253,10 @@

  :- implementation.

-:- import_module assoc_list.
  :- import_module bool.
  :- import_module int.
-:- import_module list.
-:- import_module map.
  :- import_module pair.
  :- import_module require.
-:- import_module set.
  :- import_module string.

  :- type varset(T)

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