[m-rev.] diff: implement concat_string_list for .NET
Zoltan Somogyi
zs at cs.mu.OZ.AU
Mon Feb 17 15:57:22 AEDT 2003
On 16-Feb-2003, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> + % This type is for strings which may contain embedded null characters.
> +:- type string_with_0s ---> string_with_0s(string).
This is wrong. If you define an abstract data type, it must contain not only
the character array ("string") but also its length.
> +% This version is only used if there is no matching foreign_proc version.
> +% Note that this version only works if the Mercury implementation's
> +% string representation allows strings to contain embedded null
> +% characters. So we check that.
> +concat_string_list(StringsList, _Len, string_with_0s(StringWithNulls)) :-
> + (
> + char__to_int(NullChar, 0),
> + NullCharString = string__char_to_string(NullChar),
> + string__length(NullCharString, 1)
> + ->
I don't believe this test will succeed on any version of the current Mercury
implementation.
The reason why I used C code to do the concatenation in the first place
is that with a very few exceptions (such as string__index), the predicates
in the string module all assume that strings are null terminated.
String__length certainly does.
Zoltan.
--------------------------------------------------------------------------
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