[m-dev.] for review: teeny changes to string.m
Michael Day
mcda at students.cs.mu.oz.au
Thu Oct 26 22:08:08 AEDT 2000
Some mode issues that were bugging me when trying to avoid making copies
of strings... is ui properly supported yet? It seems to work.
Estimated hours taken: 0.25
Tweak the modes for both the predicate and functional forms
of string__length.
string.m:
Add a new mode definition for string__length to let it take unique
strings and change the modes for its functional form so that the
output is unique rather than ground. Also fix an incorrect comment.
Index: library/string.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.130
diff -u -r1.130 string.m
--- library/string.m 2000/09/14 15:24:44 1.130
+++ library/string.m 2000/10/26 11:02:07
@@ -23,6 +23,7 @@
:- pred string__length(string, int).
:- mode string__length(in, uo) is det.
+:- mode string__length(ui, uo) is det.
% Determine the length of a string.
% An empty string has length zero.
@@ -1441,13 +1442,22 @@
/*
:- pred string__length(string, int).
-:- mode string__length(in, out) is det.
+:- mode string__length(in, uo) is det.
*/
:- pragma c_code(string__length(Str::in, Length::uo),
[will_not_call_mercury, thread_safe], "
Length = strlen(Str);
").
+/*
+:- pred string__length(string, int).
+:- mode string__length(ui, uo) is det.
+*/
+:- pragma c_code(string__length(Str::ui, Length::uo),
+ [will_not_call_mercury, thread_safe], "
+ Length = strlen(Str);
+").
+
/*-----------------------------------------------------------------------*/
/*
@@ -1712,6 +1722,8 @@
:- interface.
:- func string__length(string) = int.
+:- mode string__length(in) = uo.
+:- mode string__length(ui) = uo.
:- func string__append(string, string) = string.
--------------------------------------------------------------------------
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