[m-rev.] trivial diff: add XXX comments to bytecode_data.m
Fergus Henderson
fjh at cs.mu.OZ.AU
Fri Jan 10 16:12:08 AEDT 2003
compiler/bytecode_data.m:
Add some XXX comments about places which are assuming 8-bit characters.
Workspace: /home/ceres/fjh/mercury
Index: compiler/bytecode_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/bytecode_data.m,v
retrieving revision 1.8
diff -u -d -r1.8 bytecode_data.m
--- compiler/bytecode_data.m 20 Mar 2002 12:35:52 -0000 1.8
+++ compiler/bytecode_data.m 21 Oct 2002 11:55:05 -0000
@@ -20,9 +20,11 @@
:- import_module io, int, list, string.
+ % XXX this assumes strings contain 8-bit characters
:- pred output_string(string, io__state, io__state).
:- mode output_string(in, di, uo) is det.
+ % XXX this assumes strings contain 8-bit characters
:- pred string_to_byte_list(string, list(int)).
:- mode string_to_byte_list(in, out) is det.
@@ -81,10 +83,22 @@
:- import_module char, require.
output_string(Val) -->
+ % XXX this assumes strings contain 8-bit characters
+ % Using write_bytes here is wrong; the output will depend
+ % on the Mercury implementation's representation of chars,
+ % so it may be different for different Mercury implementations.
+ % In particular, it will do the wrong thing for Mercury
+ % implementations which represent characters in Unicode.
io__write_bytes(Val),
io__write_byte(0).
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 implementation's representation of chars,
+ % so it may be different for different Mercury implementations.
+ % In particular, it will do the wrong thing for Mercury
+ % implementations which represent characters in Unicode.
string__to_char_list(Val, Chars),
ToInt = (pred(C::in, I::out) is det :- char__to_int(C, I)),
list__map(ToInt, Chars, List0),
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list