[m-rev.] for review: document char__to_int caveats
Fergus Henderson
fjh at cs.mu.OZ.AU
Mon Oct 21 19:33:33 AEST 2002
Branches: main
Estimated hours taken: 0.25
library/char.m:
Add some documentation warning about issues with char__to_int
and Unicode.
Workspace: /home/ceres/fjh/mercury
Index: library/char.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/char.m,v
retrieving revision 1.38
diff -u -d -r1.38 char.m
--- library/char.m 14 Jun 2002 10:18:46 -0000 1.38
+++ library/char.m 21 Oct 2002 09:31:26 -0000
@@ -11,6 +11,9 @@
% This module defines some predicates that manipulate characters.
+% The set of characters which are supported and the mapping from
+% characters to integer values are both implementation dependent.
+
% Originally we used `character' rather than `char' for the type name
% because `char' was used by NU-Prolog to mean something different.
% But now we use `char' and the use of `character' is discouraged.
@@ -33,7 +36,18 @@
:- mode char__to_int(in, out) is det.
:- mode char__to_int(in, in) is semidet. % implied
:- mode char__to_int(out, in) is semidet.
- % Convert a character to it's corresponding numerical code.
+ % Convert a character to its corresponding numerical code
+ % (integer value).
+ % Beware that the mapping from characters to numerical codes
+ % is implementation dependent; there is no guarantee that
+ % the integer values for characters will fit in 8 bits.
+ % Furthermore, the value returned from char__to_int might be
+ % different than the byte(s) used to store the character in a file.
+ % There is also no guarantee that characters created using
+ % `char__to_int(out, in)' can be written to files or
+ % to the standard output or standard error streams.
+ % For example, an implementation might use represent characters
+ % using Unicode, but store files in an 8-bit national character set.
:- func char__max_char_value = int.
:- pred char__max_char_value(int).
--
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