[m-rev.] diff: delete unused predicates

Julien Fischer jfischer at opturion.com
Mon Apr 18 15:48:14 AEST 2022


Delete unused predicates.

compiler/bytecode_data.m:
      As above.

Julien.

diff --git a/compiler/bytecode_data.m b/compiler/bytecode_data.m
index c73a01c..8a5078e 100644
--- a/compiler/bytecode_data.m
+++ b/compiler/bytecode_data.m
@@ -2,6 +2,7 @@
  % vim: ft=mercury ts=4 sw=4 et
  %---------------------------------------------------------------------------%
  % Copyright (C) 1999-2000, 2003-2007, 2009-2011 The University of Melbourne.
+% Copyright (C) 2014, 2017, 2019-2022 The Mercury team.
  % This file may only be copied under the terms of the GNU General
  % Public License - see the file COPYING in the Mercury distribution.
  %---------------------------------------------------------------------------%
@@ -18,13 +19,11 @@
  :- interface.

  :- import_module io.
-:- import_module list.

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

      % XXX This assumes strings contain 8-bit characters.
  :- pred output_string(string::in, io::di, io::uo) is det.
-:- pred string_to_byte_list(string::in, list(int)::out) is det.

  :- pred output_byte(int::in, io::di, io::uo) is det.

@@ -34,12 +33,10 @@
      % NOTE: We -assume- the machine architecture uses 2's-complement.
      %
  :- pred output_int(int::in, io::di, io::uo) is det.
-:- pred int_to_byte_list(int::in, list(int)::out) is det.

-    % Same as output_int and int_to_byte_list, except only use 32 bits.
+    % Same as output_int, except only use 32 bits.
      %
  :- pred output_int32(int::in, io::di, io::uo) is det.
-:- pred int32_to_byte_list(int::in, list(int)::out) is det.

      % Spit out a `short' in a portable format.
      % This format is: big-endian, 16-bit, 2's-complement.
@@ -47,7 +44,6 @@
      % NOTE: We -assume- the machine architecture uses 2's-complement.
      %
  :- pred output_short(int::in, io::di, io::uo) is det.
-:- pred short_to_byte_list(int::in, list(int)::out) is det.

      % Spit out a `float' in a portable `highest common denominator format.
      % This format is: big-endian, 64-bit, IEEE-754 floating point value.
@@ -55,7 +51,6 @@
      % NOTE: We -assume- the machine architecture uses IEEE-754.
      %
  :- pred output_float(float::in, io::di, io::uo) is det.
-:- pred float_to_byte_list(float::in, list(int)::out) is det.

  %-----------------------------------------------------------------------------%
  %-----------------------------------------------------------------------------%
@@ -64,6 +59,7 @@

  :- import_module char.
  :- import_module int.
+:- import_module list.
  :- import_module require.
  :- import_module string.

@@ -74,6 +70,8 @@ output_string(Val, !IO) :-
      list.foldl(io.write_byte, List, !IO),
      io.write_byte(0, !IO).

+:- pred string_to_byte_list(string::in, list(int)::out) is det.
+
  string_to_byte_list(Val, List) :-
      % XXX This assumes strings contain 8-bit characters.
      % Using char.to_int here is wrong; the output will depend on the Mercury
@@ -101,38 +99,17 @@ output_int(IntVal, !IO) :-
          output_int(bytecode_int_bits, IntVal, !IO)
      ).

-int_to_byte_list(IntVal, Bytes) :-
-    int.bits_per_int(IntBits),
-    ( if IntBits > bytecode_int_bits then
-        unexpected($pred,
-            "size of int is larger than size of bytecode integer.")
-    else
-        int_to_byte_list(bytecode_int_bits, IntVal, Bytes)
-    ).
-
  output_int32(IntVal, !IO) :-
      output_int(32, IntVal, !IO).

-int32_to_byte_list(IntVal, List) :-
-    int_to_byte_list(32, IntVal, List).
-
  output_short(Val, !IO) :-
      output_int(16, Val, !IO).

-short_to_byte_list(Val, Bytes) :-
-    int_to_byte_list(16, Val, Bytes).
-
  :- pred output_int(int::in, int::in, io::di, io::uo) is det.

  output_int(Bits, IntVal, !IO) :-
      output_int(io.write_byte, Bits, IntVal, !IO).

-:- pred int_to_byte_list(int::in, int::in, list(int)::out) is det.
-
-int_to_byte_list(Bits, IntVal, Bytes) :-
-    output_int(list.cons, Bits, IntVal, [], RevBytes),
-    list.reverse(RevBytes, Bytes).
-
  :- pred output_int(pred(int, T, T), int, int, T, T).
  :- mode output_int(pred(in, in, out) is det, in, in, in, out) is det.
  :- mode output_int(pred(in, di, uo) is det, in, in, di, uo) is det.
@@ -179,7 +156,7 @@ bits_per_byte = 8.

  output_padding_zeros(Writer, NumBytes, !IO) :-
      ( if NumBytes > 0 then
-        call(Writer, 0, !IO),
+        Writer(0, !IO),
          NumBytes1 = NumBytes - 1,
          output_padding_zeros(Writer, NumBytes1, !IO)
      else
@@ -195,7 +172,7 @@ output_int_bytes(Writer, ByteNum, IntVal, !IO) :-
          BitShifts = ByteNum * bits_per_byte,
          Byte = (IntVal >> BitShifts) mod (1 << bits_per_byte),
          ByteNum1 = ByteNum - 1,
-        call(Writer, Byte, !IO),
+        Writer(Byte, !IO),
          output_int_bytes(Writer, ByteNum1, IntVal, !IO)
      else
          true
@@ -212,9 +189,6 @@ output_float(Val, !IO) :-
      output_byte(B6, !IO),
      output_byte(B7, !IO).

-float_to_byte_list(Val, [B0, B1, B2, B3, B4, B5, B6, B7]) :-
-    float_to_float64_bytes(Val, B0, B1, B2, B3, B4, B5, B6, B7).
-
      % Convert a `float' to the representation used in the bytecode.
      % That is, a sequence of eight bytes.
      %


More information about the reviews mailing list