Add a builtin unsigned word sized integer type -- Part 2.

Begin implementing library support for uints.

Update the compiler to use the uint type.

library/uint.m:
    Begin filling this module in.

library/private_builtin.m:
    Use the proper argument type for builtin_{unify,compare}_uint
    and provide actual implementations for them.

library/table_builtin.m:
    Add tabling builtins for uints.

library/string.m:
    Add a function to convert a uint to a decimal string.
    (XXX NYI for Erlang).

library/io.m:
    Add write_uint/[45].

    Add the stream instance for uints and text output streams.

library/stream.string_writer.m:
    Add put_uint/4.

    Support uints in string_writer.write etc.

library/pprint.m:
    Make uint an instance of the doc/1 type class.

library/pretty_printer.m:
    Add a default formatter for uints.

library/int.m:
    Unrelated change: fix formatting.

compiler/builtin_ops.m:
compiler/elds.m:
compiler/elds_to_erlang.m:
compiler/hlds_data.m:
compiler/llds.m:
compiler/llds_out_data.m:
compiler/mercury_to_mercury.m:
compiler/ml_lookup_switch.m:
compiler/mlds.m:
compiler/mlds_to_c.m:
compiler/mlds_to_cs.m:
compiler/opt_debug.m
compiler/parse_tree_out.m:
compiler/parse_tree_out_info.m:
compiler/prog_data.m:
compiler/prog_out.m:
compiler/prog_rep.m:
compiler/hlds_out_util.m:
    Use the uint type in places where we should.

compiler/mlds_to_java.m:
    Fix a bug that causes us to generate badly typed Java.
    For div and mod we need to cast the entire expression to
    an int, not just the first operand.

compiler/c_util.m:
compiler/mlds_to_cs.m:
    Add predicates for outputting unsigned integers in C and C#.

tests/hard_coded/test_pretty_printer_defaults.exp:
    Conform to the above change to the pretty_printer module.
This commit is contained in:
Julien Fischer
2016-10-28 01:32:50 +11:00
parent 5dd230ec19
commit 8e8fc26209
29 changed files with 557 additions and 47 deletions

View File

@@ -442,7 +442,7 @@ dump_const(MaybeProcLabel, Const) = Str :-
Str = int_to_string(I)
;
Const = llconst_uint(U),
Str = int_to_string(U) % XXX UINT.
Str = uint_to_string(U)
;
Const = llconst_foreign(F, _),
Str = F