mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-20 20:03:44 +00:00
Enable support for literals of the new types.
Begin implementing library support for 8, 16, and 32 bit types.
Update the compiler to represent values of their own constants.
library/int8.m:
library/int16.m:
library/int32.m:
library/uint8.m:
library/uint16.m:
library/uint32.m:
Begin filling these modules out.
library/uint.m:
Unrelated change: add the predicates plus/2, minus/2 and
times/2 for uints.
library/integer.m:
Add predicates for converting integer/0 values into values
of the new types.
Add functions for converting values of the new types into
integer/0 values.
library/string.m:
Add functions for converting values of the new types to strings.
library/private_builtin.m:
Replace the placeholder definitions for the builtin unify and compare
predicates for the new types with their actual definitions.
library/erlang_rtti_implementation.m:
library/rtti_implementation.m:
Replace placeholder definitions for the new types with their
actual definitions.
library/io.m:
Add predicates for writing values of the new types to file streams.
library/stream.string_writer.m:
Implement generic write and print for values of the new types.
library/string.to_string.m:
Likewise for string/1.
library/term.m:
library/term_conversion.m:
Add predicates and functions for converting the new types to
and from terms.
compiler/builtin_ops.m:
compiler/elds.m:
compiler/hlds_data.m:
compiler/llds.m:
compiler/mlds.m:
compiler/prog_data.m:
Replace placeholders for the new types with the new types.
compiler/superhomogeneous.m:
Enable literals of the new types.
compiler/mlds_to_cs.m:
Avoid a warning from the C# compiler for bitwise-or operators
with sbyte operands.
compiler/c_util.m:
compiler/elds_to_erlang.m:
compiler/hlds_out_util.m:
compiler/llds_out_data.m:
compiler/lookup_switch.m:
compiler/mlds_to_c.m:
compiler/mlds_to_java.m:
compiler/opt_debug.m:
compiler/parse_tree_out_info.m:
compiler/parse_tree_to_term.m:
compiler/prog_out.m:
compiler/prog_rep.m:
compiler/prog_util.m:
Replace placeholder code for the new types with code that uses the new
types.
tests/invalid/invalid_int.m:
tests/invalid/invalid_int.err_exp2:
Extend this test case to cover the fixed size integer types.
80 lines
1.5 KiB
Mathematica
80 lines
1.5 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module invalid_int.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
main(!IO) :-
|
|
X = {
|
|
0b11111111111111111111111111111111,
|
|
0b100000000000000000000000000000000,
|
|
0b1111111111111111111111111111111111111111111111111111111111111111,
|
|
0b10000000000000000000000000000000000000000000000000000000000000000,
|
|
|
|
0o37777777777,
|
|
0o40000000000,
|
|
0o1777777777777777777777,
|
|
0o2000000000000000000000,
|
|
|
|
0xffffffff,
|
|
0x100000000,
|
|
0x110000000,
|
|
0xffffffffffffffff,
|
|
0x10000000000000000,
|
|
|
|
2147483647,
|
|
2147483648,
|
|
9223372036854775807,
|
|
9223372036854775808
|
|
},
|
|
io.write(X, !IO),
|
|
|
|
I8 = {
|
|
-129_i8,
|
|
-128_i8,
|
|
127_i8,
|
|
128_i8
|
|
},
|
|
io.write(I8, !IO),
|
|
|
|
U8 = {
|
|
256_u8,
|
|
257_u8
|
|
},
|
|
io.write(U8, !IO),
|
|
|
|
I16 = {
|
|
-32_769_i16,
|
|
-32_768_i16,
|
|
32_767_i16,
|
|
32_768_i16
|
|
},
|
|
io.write(I16, !IO),
|
|
|
|
U16 = {
|
|
65_535_u16,
|
|
65_536_u16
|
|
},
|
|
io.write(U16, !IO),
|
|
|
|
I32 = {
|
|
-2_147_483_649_i32,
|
|
-2_147_483_648_i32,
|
|
2_147_483_647_i32,
|
|
2_147_483_648_i32
|
|
},
|
|
io.write(I32, !IO),
|
|
|
|
U32 = {
|
|
4_294_967_295_u32,
|
|
4_294_967_296_u32
|
|
},
|
|
io.write(U32, !IO).
|