[m-rev.] diff: shorten some code
Zoltan Somogyi
zs at csse.unimelb.edu.au
Mon Jul 18 15:39:30 AEST 2011
compiler/mlds_to_c.m:
Shorten some code.
Zoltan.
cvs diff: Diffing .
Index: mlds_to_c.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mlds_to_c.m,v
retrieving revision 1.256
diff -u -b -r1.256 mlds_to_c.m
--- mlds_to_c.m 17 Jul 2011 12:40:34 -0000 1.256
+++ mlds_to_c.m 18 Jul 2011 05:10:30 -0000
@@ -1551,12 +1551,9 @@
mlds_indent(Indent, !IO),
io.write_string("\nstatic /* final */ const ", !IO),
mlds_output_type_prefix(Opts, Type, !IO),
- io.write_string(" ", !IO),
- io.write_string(MangledModuleName, !IO),
- io.write_string("_scalar_common_", !IO),
- io.write_int(TypeRawNum, !IO),
NumRows = cord.length(RevRows),
- io.format("[%d]", [i(NumRows)], !IO),
+ io.format(" %s_scalar_common_%d[%d]",
+ [s(MangledModuleName), i(TypeRawNum), i(NumRows)], !IO),
mlds_output_type_suffix(Opts, Type, InitArraySize, !IO),
io.write_string(";\n", !IO).
@@ -1589,12 +1586,9 @@
mlds_indent(Indent, !IO),
io.write_string("\nstatic /* final */ const ", !IO),
mlds_output_type_prefix(Opts, Type, !IO),
- io.write_string(" ", !IO),
- io.write_string(MangledModuleName, !IO),
- io.write_string("_vector_common_", !IO),
- io.write_int(TypeRawNum, !IO),
NumRows = cord.length(RevRows),
- io.format("[%d]", [i(NumRows)], !IO),
+ io.format(" %s_vector_common_%d[%d]",
+ [s(MangledModuleName), i(TypeRawNum), i(NumRows)], !IO),
mlds_output_type_suffix(Opts, Type, no_size, !IO),
io.write_string(";\n", !IO).
@@ -1626,11 +1620,8 @@
mlds_indent(Indent, !IO),
io.write_string("\nstatic /* final */ const ", !IO),
mlds_output_type_prefix(Opts, Type, !IO),
- io.write_string(" ", !IO),
- io.write_string(MangledModuleName, !IO),
- io.write_string("_scalar_common_", !IO),
- io.write_int(TypeRawNum, !IO),
- io.format("[%d]", [i(NumRows)], !IO),
+ io.format(" %s_scalar_common_%d[%d]",
+ [s(MangledModuleName), i(TypeRawNum), i(NumRows)], !IO),
mlds_output_type_suffix(Opts, Type, InitArraySize, !IO),
io.write_string(" = {\n", !IO),
list.foldl2(mlds_output_cell(Opts, Indent + 1), Rows, 0, _, !IO),
@@ -1664,11 +1655,8 @@
mlds_indent(Indent, !IO),
io.write_string("\nstatic /* final */ const ", !IO),
mlds_output_type_prefix(Opts, Type, !IO),
- io.write_string(" ", !IO),
- io.write_string(MangledModuleName, !IO),
- io.write_string("_vector_common_", !IO),
- io.write_int(TypeRawNum, !IO),
- io.format("[%d]", [i(NumRows)], !IO),
+ io.format(" %s_vector_common_%d[%d]",
+ [s(MangledModuleName), i(TypeRawNum), i(NumRows)], !IO),
mlds_output_type_suffix(Opts, Type, no_size, !IO),
io.write_string(" = {\n", !IO),
list.foldl2(mlds_output_cell(Opts, Indent + 1), Rows, 0, _, !IO),
cvs diff: Diffing notes
--------------------------------------------------------------------------
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