[m-dev.] diff: format of casts
Zoltan Somogyi
zs at cs.mu.OZ.AU
Wed Aug 9 13:41:06 AEST 2000
compiler/llds_out.m:
Ensure that the parentheses following a cast are always followed by a
space, since without this the output code is harder to read.
Zoltan.
Index: llds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.146
diff -u -r1.146 llds_out.m
--- llds_out.m 2000/08/03 06:10:33 1.146
+++ llds_out.m 2000/08/07 23:32:37
@@ -1891,7 +1891,6 @@
{ Type = term__functor(term__atom("string"), [], _) }
->
output_llds_type_cast(word),
- io__write_string(" "),
io__write_string(VarName)
;
{ Type = term__functor(term__atom("float"), [], _) }
@@ -2516,11 +2515,12 @@
% Same as output_llds_type, but will put parentheses
% around the llds_type.
:- pred output_llds_type_cast(llds_type::in,
- io__state::di, io__state::uo) is det.
+ io__state::di, io__state::uo) is det.
+
output_llds_type_cast(LLDSType) -->
io__write_string("("),
output_llds_type(LLDSType),
- io__write_string(")").
+ io__write_string(") ").
:- pred output_llds_type(llds_type::in, io__state::di, io__state::uo) is det.
@@ -3623,11 +3623,11 @@
{ llds_out__float_const_expr_name(Rval, FloatName) }
->
output_llds_type_cast(data_ptr),
- io__write_string(" &mercury_float_const_"),
+ io__write_string("&mercury_float_const_"),
io__write_string(FloatName)
;
output_llds_type_cast(data_ptr),
- io__write_string(" float_to_word("),
+ io__write_string("float_to_word("),
output_rval(Rval),
io__write_string(")")
).
@@ -3651,7 +3651,7 @@
{ llds_out__float_const_expr_name(Rval, FloatName) }
->
output_llds_type_cast(word),
- io__write_string(" &mercury_float_const_"),
+ io__write_string("&mercury_float_const_"),
io__write_string(FloatName)
;
io__write_string("float_to_word("),
@@ -3791,19 +3791,19 @@
(
{ MemRef = stackvar_ref(N) },
output_llds_type_cast(data_ptr),
- io__write_string(" &MR_stackvar("),
+ io__write_string("&MR_stackvar("),
io__write_int(N),
io__write_string(")")
;
{ MemRef = framevar_ref(N) },
output_llds_type_cast(data_ptr),
- io__write_string(" &MR_framevar("),
+ io__write_string("&MR_framevar("),
io__write_int(N),
io__write_string(")")
;
{ MemRef = heap_ref(Rval, Tag, FieldNum) },
output_llds_type_cast(data_ptr),
- io__write_string(" &MR_field("),
+ io__write_string("&MR_field("),
output_tag(Tag),
io__write_string(", "),
output_rval(Rval),
@@ -3827,14 +3827,12 @@
% things like 1 << 32 work when `Integer' is 64 bits
% but `int' is 32 bits.
output_llds_type_cast(integer),
- io__write_string(" "),
io__write_int(N).
output_rval_const(float_const(FloatVal)) -->
% the cast to (Float) here lets the C compiler
% do arithmetic in `float' rather than `double'
% if `Float' is `float' not `double'.
output_llds_type_cast(float),
- io__write_string(" "),
io__write_float(FloatVal).
output_rval_const(string_const(String)) -->
io__write_string("MR_string_const("""),
@@ -3859,7 +3857,7 @@
% data addresses are all assumed to be of type `MR_Word *';
% we need to cast them here to avoid type errors
output_llds_type_cast(data_ptr),
- io__write_string(" &"),
+ io__write_string("&"),
output_data_addr(DataAddr).
output_rval_const(label_entry(Label)) -->
io__write_string("ENTRY("),
@@ -3882,7 +3880,7 @@
{ error("Cannot output a binop(_, _, _) in a static initializer") }.
output_static_rval(mkword(Tag, Exprn)) -->
output_llds_type_cast(data_ptr),
- io__write_string(" MR_mkword("),
+ io__write_string("MR_mkword("),
output_tag(Tag),
io__write_string(", "),
output_static_rval(Exprn),
@@ -3933,7 +3931,7 @@
output_code_addr(CodeAddress).
output_rval_static_const(data_addr_const(DataAddr)) -->
output_llds_type_cast(data_ptr),
- io__write_string(" &"),
+ io__write_string("&"),
output_data_addr(DataAddr).
output_rval_static_const(label_entry(Label)) -->
io__write_string("ENTRY("),
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list