[svn:parrot] r45893 - in branches/string_consting: include/parrot src/string/charset src/string/encoding

bacek at svn.parrot.org bacek at svn.parrot.org
Thu Apr 22 10:39:24 UTC 2010


Author: bacek
Date: Thu Apr 22 10:39:24 2010
New Revision: 45893
URL: https://trac.parrot.org/parrot/changeset/45893

Log:
Mass update charset/encoding functions to accept const strings

Modified:
   branches/string_consting/include/parrot/charset.h
   branches/string_consting/include/parrot/encoding.h
   branches/string_consting/src/string/charset/ascii.c
   branches/string_consting/src/string/charset/ascii.h
   branches/string_consting/src/string/charset/binary.c
   branches/string_consting/src/string/charset/iso-8859-1.c
   branches/string_consting/src/string/charset/iso-8859-1.h
   branches/string_consting/src/string/charset/unicode.c
   branches/string_consting/src/string/encoding/fixed_8.c
   branches/string_consting/src/string/encoding/ucs2.c
   branches/string_consting/src/string/encoding/utf16.c
   branches/string_consting/src/string/encoding/utf8.c

Modified: branches/string_consting/include/parrot/charset.h
==============================================================================
--- branches/string_consting/include/parrot/charset.h	Thu Apr 22 10:39:00 2010	(r45892)
+++ branches/string_consting/include/parrot/charset.h	Thu Apr 22 10:39:24 2010	(r45893)
@@ -33,11 +33,11 @@
 #define PARROT_BINARY_CHARSET Parrot_binary_charset_ptr
 #define PARROT_UNICODE_CHARSET Parrot_unicode_charset_ptr
 
-typedef STRING *(*charset_get_graphemes_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset, UINTVAL count);
+typedef STRING *(*charset_get_graphemes_t)(PARROT_INTERP, const STRING *source_string, UINTVAL offset, UINTVAL count);
 
-typedef STRING * (*charset_to_charset_t)(PARROT_INTERP, STRING *source_string);
-typedef STRING * (*charset_from_unicode_t)(PARROT_INTERP, STRING *source_string);
-typedef STRING* (*charset_compose_t)(PARROT_INTERP, STRING *source_string);
+typedef STRING * (*charset_to_charset_t)(PARROT_INTERP, const STRING *source_string);
+typedef STRING * (*charset_from_unicode_t)(PARROT_INTERP, const STRING *source_string);
+typedef STRING* (*charset_compose_t)(PARROT_INTERP, const STRING *source_string);
 typedef STRING* (*charset_decompose_t)(PARROT_INTERP, STRING *source_string);
 typedef STRING* (*charset_upcase_t)(PARROT_INTERP, const STRING *source_string);
 typedef STRING* (*charset_downcase_t)(PARROT_INTERP, const STRING *source_string);
@@ -46,32 +46,32 @@
 typedef STRING* (*charset_downcase_first_t)(PARROT_INTERP, const STRING *source_string);
 typedef STRING* (*charset_titlecase_first_t)(PARROT_INTERP, const STRING *source_string);
 typedef INTVAL (*charset_compare_t)(PARROT_INTERP, const STRING *lhs, const STRING *rhs);
-typedef INTVAL (*charset_index_t)(PARROT_INTERP, STRING *source_string, STRING *search_string, UINTVAL offset);
-typedef INTVAL (*charset_rindex_t)(PARROT_INTERP, STRING *source_string, STRING *search_string, UINTVAL offset);
-typedef UINTVAL (*charset_validate_t)(PARROT_INTERP, STRING *source_string);
+typedef INTVAL (*charset_index_t)(PARROT_INTERP, const STRING *source_string, const STRING *search_string, UINTVAL offset);
+typedef INTVAL (*charset_rindex_t)(PARROT_INTERP, const STRING *source_string, const STRING *search_string, UINTVAL offset);
+typedef UINTVAL (*charset_validate_t)(PARROT_INTERP, const STRING *source_string);
 typedef INTVAL (*charset_is_cclass_t)(PARROT_INTERP, INTVAL, const STRING *source_string, UINTVAL offset);
-typedef INTVAL (*charset_find_cclass_t)(PARROT_INTERP, INTVAL, STRING *source_string, UINTVAL offset, UINTVAL count);
-typedef INTVAL (*charset_find_not_cclass_t)(PARROT_INTERP, INTVAL, STRING *source_string, UINTVAL offset, UINTVAL count);
-typedef INTVAL (*charset_is_wordchar_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset);
-typedef INTVAL (*charset_find_wordchar_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset);
-typedef INTVAL (*charset_find_not_wordchar_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset);
-typedef INTVAL (*charset_is_whitespace_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset);
-typedef INTVAL (*charset_find_whitespace_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset);
-typedef INTVAL (*charset_find_not_whitespace_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset);
-typedef INTVAL (*charset_is_digit_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset);
-typedef INTVAL (*charset_find_digit_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset);
-typedef INTVAL (*charset_find_not_digit_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset);
-typedef INTVAL (*charset_is_punctuation_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset);
-typedef INTVAL (*charset_find_punctuation_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset);
-typedef INTVAL (*charset_find_not_punctuation_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset);
-typedef INTVAL (*charset_is_newline_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset);
-typedef INTVAL (*charset_find_newline_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset);
-typedef INTVAL (*charset_find_not_newline_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset);
-typedef INTVAL (*charset_find_word_boundary_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset);
+typedef INTVAL (*charset_find_cclass_t)(PARROT_INTERP, INTVAL, const STRING *source_string, UINTVAL offset, UINTVAL count);
+typedef INTVAL (*charset_find_not_cclass_t)(PARROT_INTERP, INTVAL, const STRING *source_string, UINTVAL offset, UINTVAL count);
+typedef INTVAL (*charset_is_wordchar_t)(PARROT_INTERP, const STRING *source_string, UINTVAL offset);
+typedef INTVAL (*charset_find_wordchar_t)(PARROT_INTERP, const STRING *source_string, UINTVAL offset);
+typedef INTVAL (*charset_find_not_wordchar_t)(PARROT_INTERP, const STRING *source_string, UINTVAL offset);
+typedef INTVAL (*charset_is_whitespace_t)(PARROT_INTERP, const STRING *source_string, UINTVAL offset);
+typedef INTVAL (*charset_find_whitespace_t)(PARROT_INTERP, const STRING *source_string, UINTVAL offset);
+typedef INTVAL (*charset_find_not_whitespace_t)(PARROT_INTERP, const STRING *source_string, UINTVAL offset);
+typedef INTVAL (*charset_is_digit_t)(PARROT_INTERP, const STRING *source_string, UINTVAL offset);
+typedef INTVAL (*charset_find_digit_t)(PARROT_INTERP, const STRING *source_string, UINTVAL offset);
+typedef INTVAL (*charset_find_not_digit_t)(PARROT_INTERP, const STRING *source_string, UINTVAL offset);
+typedef INTVAL (*charset_is_punctuation_t)(PARROT_INTERP, const STRING *source_string, UINTVAL offset);
+typedef INTVAL (*charset_find_punctuation_t)(PARROT_INTERP, const STRING *source_string, UINTVAL offset);
+typedef INTVAL (*charset_find_not_punctuation_t)(PARROT_INTERP, const STRING *source_string, UINTVAL offset);
+typedef INTVAL (*charset_is_newline_t)(PARROT_INTERP, const STRING *source_string, UINTVAL offset);
+typedef INTVAL (*charset_find_newline_t)(PARROT_INTERP, const STRING *source_string, UINTVAL offset);
+typedef INTVAL (*charset_find_not_newline_t)(PARROT_INTERP, const STRING *source_string, UINTVAL offset);
+typedef INTVAL (*charset_find_word_boundary_t)(PARROT_INTERP, const STRING *source_string, UINTVAL offset);
 typedef STRING *(*charset_string_from_codepoint_t)(PARROT_INTERP, UINTVAL codepoint);
 typedef size_t (*charset_compute_hash_t)(PARROT_INTERP, const STRING *, size_t seed);
 
-typedef STRING* (*charset_converter_t)(PARROT_INTERP, STRING *src);
+typedef STRING* (*charset_converter_t)(PARROT_INTERP, const STRING *src);
 
 /* HEADERIZER BEGIN: src/string/charset.c */
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */

Modified: branches/string_consting/include/parrot/encoding.h
==============================================================================
--- branches/string_consting/include/parrot/encoding.h	Thu Apr 22 10:39:00 2010	(r45892)
+++ branches/string_consting/include/parrot/encoding.h	Thu Apr 22 10:39:24 2010	(r45893)
@@ -19,11 +19,11 @@
 typedef UINTVAL (*encoding_get_codepoint_t)(PARROT_INTERP, const STRING *src, UINTVAL offset);
 typedef UINTVAL (*encoding_get_byte_t)(PARROT_INTERP, const STRING *src, UINTVAL offset);
 typedef void (*encoding_set_byte_t)(PARROT_INTERP, const STRING *src, UINTVAL offset, UINTVAL count);
-typedef STRING *(*encoding_get_codepoints_t)(PARROT_INTERP, STRING *src, UINTVAL offset, UINTVAL count);
-typedef STRING *(*encoding_get_bytes_t)(PARROT_INTERP, STRING *src, UINTVAL offset, UINTVAL count);
+typedef STRING *(*encoding_get_codepoints_t)(PARROT_INTERP, const STRING *src, UINTVAL offset, UINTVAL count);
+typedef STRING *(*encoding_get_bytes_t)(PARROT_INTERP, const STRING *src, UINTVAL offset, UINTVAL count);
 typedef UINTVAL (*encoding_codepoints_t)(PARROT_INTERP, ARGIN(const STRING *src));
 typedef UINTVAL (*encoding_bytes_t)(PARROT_INTERP, ARGIN(const STRING *src));
-typedef UINTVAL (*encoding_find_cclass_t)(PARROT_INTERP, STRING *s, const INTVAL *typetable, INTVAL flags, UINTVAL offset, UINTVAL count);
+typedef UINTVAL (*encoding_find_cclass_t)(PARROT_INTERP, const STRING *s, const INTVAL *typetable, INTVAL flags, UINTVAL offset, UINTVAL count);
 typedef size_t (*encoding_hash_t)(PARROT_INTERP, const STRING *s, size_t hashval);
 
 /* iterator support */

Modified: branches/string_consting/src/string/charset/ascii.c
==============================================================================
--- branches/string_consting/src/string/charset/ascii.c	Thu Apr 22 10:39:00 2010	(r45892)
+++ branches/string_consting/src/string/charset/ascii.c	Thu Apr 22 10:39:24 2010	(r45893)
@@ -32,7 +32,7 @@
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 
 PARROT_CANNOT_RETURN_NULL
-static STRING* compose(PARROT_INTERP, ARGIN(STRING *src))
+static STRING* compose(PARROT_INTERP, ARGIN(const STRING *src))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
@@ -56,7 +56,7 @@
 PARROT_WARN_UNUSED_RESULT
 static INTVAL find_cclass(PARROT_INTERP,
     INTVAL flags,
-    ARGIN(STRING *source_string),
+    ARGIN(const STRING *source_string),
     UINTVAL offset,
     UINTVAL count)
         __attribute__nonnull__(1)
@@ -64,7 +64,7 @@
 
 static INTVAL find_not_cclass(PARROT_INTERP,
     INTVAL flags,
-    ARGIN(STRING *source_string),
+    ARGIN(const STRING *source_string),
     UINTVAL offset,
     UINTVAL count)
         __attribute__nonnull__(1)
@@ -95,12 +95,12 @@
         __attribute__nonnull__(2);
 
 PARROT_CANNOT_RETURN_NULL
-static STRING * to_ascii(PARROT_INTERP, ARGIN(STRING *src))
+static STRING * to_ascii(PARROT_INTERP, ARGIN(const STRING *src))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
 PARROT_CANNOT_RETURN_NULL
-static STRING * to_charset(PARROT_INTERP, ARGIN(STRING *src))
+static STRING * to_charset(PARROT_INTERP, ARGIN(const STRING *src))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
@@ -116,7 +116,7 @@
         __attribute__nonnull__(2);
 
 PARROT_WARN_UNUSED_RESULT
-static UINTVAL validate(PARROT_INTERP, ARGIN(STRING *src))
+static UINTVAL validate(PARROT_INTERP, ARGIN(const STRING *src))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
@@ -169,7 +169,7 @@
 
 /*
 
-=item C<STRING * ascii_get_graphemes(PARROT_INTERP, STRING *source_string,
+=item C<STRING * ascii_get_graphemes(PARROT_INTERP, const STRING *source_string,
 UINTVAL offset, UINTVAL count)>
 
 Retrieves the graphemes for the STRING C<source_string>, starting at
@@ -182,7 +182,7 @@
 PARROT_CANNOT_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
 STRING *
-ascii_get_graphemes(PARROT_INTERP, ARGIN(STRING *source_string),
+ascii_get_graphemes(PARROT_INTERP, ARGIN(const STRING *source_string),
         UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(ascii_get_graphemes)
@@ -191,7 +191,7 @@
 
 /*
 
-=item C<static STRING * to_ascii(PARROT_INTERP, STRING *src)>
+=item C<static STRING * to_ascii(PARROT_INTERP, const STRING *src)>
 
 Attempts to convert STRING C<src> to ASCII in STRING C<dest>. Throws
 an exception if unconvertable UNICODE characters are involved.
@@ -202,7 +202,7 @@
 
 PARROT_CANNOT_RETURN_NULL
 static STRING *
-to_ascii(PARROT_INTERP, ARGIN(STRING *src))
+to_ascii(PARROT_INTERP, ARGIN(const STRING *src))
 {
     ASSERT_ARGS(to_ascii)
     String_iter iter;
@@ -231,7 +231,7 @@
 
 /*
 
-=item C<static STRING * to_charset(PARROT_INTERP, STRING *src)>
+=item C<static STRING * to_charset(PARROT_INTERP, const STRING *src)>
 
 Converts STRING C<src> to ASCII charset STRING C<dest>.
 
@@ -241,7 +241,7 @@
 
 PARROT_CANNOT_RETURN_NULL
 static STRING *
-to_charset(PARROT_INTERP, ARGIN(STRING *src))
+to_charset(PARROT_INTERP, ARGIN(const STRING *src))
 {
     ASSERT_ARGS(to_charset)
     const charset_converter_t conversion_func =
@@ -258,7 +258,7 @@
 /* A noop. can't compose ascii */
 /*
 
-=item C<static STRING* compose(PARROT_INTERP, STRING *src)>
+=item C<static STRING* compose(PARROT_INTERP, const STRING *src)>
 
 Can't compose ASCII strings, so performs a string copy on it and
 returns the new string.
@@ -269,10 +269,10 @@
 
 PARROT_CANNOT_RETURN_NULL
 static STRING*
-compose(PARROT_INTERP, ARGIN(STRING *src))
+compose(PARROT_INTERP, ARGIN(const STRING *src))
 {
     ASSERT_ARGS(compose)
-    return src;
+    return Parrot_str_copy(interp, src);
 }
 
 /* A noop. can't decompose ascii */
@@ -516,8 +516,8 @@
 
 /*
 
-=item C<INTVAL mixed_cs_index(PARROT_INTERP, STRING *src, STRING *search,
-UINTVAL offs)>
+=item C<INTVAL mixed_cs_index(PARROT_INTERP, const STRING *src, const STRING
+*search, UINTVAL offs)>
 
 Searches for the first instance of STRING C<search> in STRING C<src>.
 returns the position where the substring is found if it is indeed found.
@@ -530,7 +530,7 @@
 
 PARROT_WARN_UNUSED_RESULT
 INTVAL
-mixed_cs_index(PARROT_INTERP, ARGIN(STRING *src), ARGIN(STRING *search),
+mixed_cs_index(PARROT_INTERP, ARGIN(const STRING *src), ARGIN(const STRING *search),
     UINTVAL offs)
 {
     ASSERT_ARGS(mixed_cs_index)
@@ -576,8 +576,8 @@
 
 /*
 
-=item C<INTVAL ascii_cs_index(PARROT_INTERP, STRING *source_string, STRING
-*search_string, UINTVAL offset)>
+=item C<INTVAL ascii_cs_index(PARROT_INTERP, const STRING *source_string, const
+STRING *search_string, UINTVAL offset)>
 
 Searches for the first instance of STRING C<search> in STRING C<src>.
 returns the position where the substring is found if it is indeed found.
@@ -589,8 +589,8 @@
 
 PARROT_WARN_UNUSED_RESULT
 INTVAL
-ascii_cs_index(PARROT_INTERP, ARGIN(STRING *source_string),
-        ARGIN(STRING *search_string), UINTVAL offset)
+ascii_cs_index(PARROT_INTERP, ARGIN(const STRING *source_string),
+        ARGIN(const STRING *search_string), UINTVAL offset)
 {
     ASSERT_ARGS(ascii_cs_index)
     INTVAL retval;
@@ -606,8 +606,8 @@
 
 /*
 
-=item C<INTVAL ascii_cs_rindex(PARROT_INTERP, STRING *source_string, STRING
-*search_string, UINTVAL offset)>
+=item C<INTVAL ascii_cs_rindex(PARROT_INTERP, const STRING *source_string, const
+STRING *search_string, UINTVAL offset)>
 
 Searches for the last instance of STRING C<search_string> in STRING
 C<source_string>. Starts searching at C<offset>.
@@ -618,8 +618,8 @@
 
 PARROT_WARN_UNUSED_RESULT
 INTVAL
-ascii_cs_rindex(PARROT_INTERP, ARGIN(STRING *source_string),
-        ARGIN(STRING *search_string), UINTVAL offset)
+ascii_cs_rindex(PARROT_INTERP, ARGIN(const STRING *source_string),
+        ARGIN(const STRING *search_string), UINTVAL offset)
 {
     ASSERT_ARGS(ascii_cs_rindex)
     INTVAL retval;
@@ -636,7 +636,7 @@
 
 /*
 
-=item C<static UINTVAL validate(PARROT_INTERP, STRING *src)>
+=item C<static UINTVAL validate(PARROT_INTERP, const STRING *src)>
 
 Verifies that the given string is valid ASCII. Returns 1 if it is ASCII,
 returns 0 otherwise.
@@ -647,7 +647,7 @@
 
 PARROT_WARN_UNUSED_RESULT
 static UINTVAL
-validate(PARROT_INTERP, ARGIN(STRING *src))
+validate(PARROT_INTERP, ARGIN(const STRING *src))
 {
     ASSERT_ARGS(validate)
     UINTVAL offset;
@@ -713,7 +713,7 @@
 
 /*
 
-=item C<static INTVAL find_cclass(PARROT_INTERP, INTVAL flags, STRING
+=item C<static INTVAL find_cclass(PARROT_INTERP, INTVAL flags, const STRING
 *source_string, UINTVAL offset, UINTVAL count)>
 
 Find a character in the given character class.  Delegates to the find_cclass
@@ -725,7 +725,7 @@
 
 PARROT_WARN_UNUSED_RESULT
 static INTVAL
-find_cclass(PARROT_INTERP, INTVAL flags, ARGIN(STRING *source_string),
+find_cclass(PARROT_INTERP, INTVAL flags, ARGIN(const STRING *source_string),
             UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(find_cclass)
@@ -739,7 +739,7 @@
 
 /*
 
-=item C<static INTVAL find_not_cclass(PARROT_INTERP, INTVAL flags, STRING
+=item C<static INTVAL find_not_cclass(PARROT_INTERP, INTVAL flags, const STRING
 *source_string, UINTVAL offset, UINTVAL count)>
 
 =cut
@@ -747,7 +747,7 @@
 */
 
 static INTVAL
-find_not_cclass(PARROT_INTERP, INTVAL flags, ARGIN(STRING *source_string),
+find_not_cclass(PARROT_INTERP, INTVAL flags, ARGIN(const STRING *source_string),
                 UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(find_not_cclass)
@@ -842,7 +842,7 @@
 
 /*
 
-=item C<STRING * charset_cvt_ascii_to_binary(PARROT_INTERP, STRING *src)>
+=item C<STRING * charset_cvt_ascii_to_binary(PARROT_INTERP, const STRING *src)>
 
 Converts an ASCII STRING C<src> to a binary STRING C<dest>.
 
@@ -852,7 +852,7 @@
 
 PARROT_CANNOT_RETURN_NULL
 STRING *
-charset_cvt_ascii_to_binary(PARROT_INTERP, ARGIN(STRING *src))
+charset_cvt_ascii_to_binary(PARROT_INTERP, ARGIN(const STRING *src))
 {
     ASSERT_ARGS(charset_cvt_ascii_to_binary)
     STRING *dest = Parrot_str_clone(interp, src);
@@ -869,7 +869,8 @@
 
 /*
 
-=item C<STRING * charset_cvt_ascii_to_iso_8859_1(PARROT_INTERP, STRING *src)>
+=item C<STRING * charset_cvt_ascii_to_iso_8859_1(PARROT_INTERP, const STRING
+*src)>
 
 Converts ASCII STRING C<src> to ISO8859-1 STRING C<dest>.
 
@@ -879,7 +880,7 @@
 
 PARROT_CANNOT_RETURN_NULL
 STRING *
-charset_cvt_ascii_to_iso_8859_1(PARROT_INTERP, ARGIN(STRING *src))
+charset_cvt_ascii_to_iso_8859_1(PARROT_INTERP, ARGIN(const STRING *src))
 {
     ASSERT_ARGS(charset_cvt_ascii_to_iso_8859_1)
     STRING * dest = Parrot_str_clone(interp, src);

Modified: branches/string_consting/src/string/charset/ascii.h
==============================================================================
--- branches/string_consting/src/string/charset/ascii.h	Thu Apr 22 10:39:00 2010	(r45892)
+++ branches/string_consting/src/string/charset/ascii.h	Thu Apr 22 10:39:24 2010	(r45893)
@@ -36,8 +36,8 @@
 
 PARROT_WARN_UNUSED_RESULT
 INTVAL ascii_cs_index(PARROT_INTERP,
-    ARGIN(STRING *source_string),
-    ARGIN(STRING *search_string),
+    ARGIN(const STRING *source_string),
+    ARGIN(const STRING *search_string),
     UINTVAL offset)
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
@@ -45,8 +45,8 @@
 
 PARROT_WARN_UNUSED_RESULT
 INTVAL ascii_cs_rindex(PARROT_INTERP,
-    ARGIN(STRING *source_string),
-    ARGIN(STRING *search_string),
+    ARGIN(const STRING *source_string),
+    ARGIN(const STRING *search_string),
     UINTVAL offset)
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
@@ -55,26 +55,28 @@
 PARROT_CANNOT_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
 STRING * ascii_get_graphemes(PARROT_INTERP,
-    ARGIN(STRING *source_string),
+    ARGIN(const STRING *source_string),
     UINTVAL offset,
     UINTVAL count)
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
 PARROT_CANNOT_RETURN_NULL
-STRING * charset_cvt_ascii_to_binary(PARROT_INTERP, ARGIN(STRING *src))
+STRING * charset_cvt_ascii_to_binary(PARROT_INTERP,
+    ARGIN(const STRING *src))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
 PARROT_CANNOT_RETURN_NULL
-STRING * charset_cvt_ascii_to_iso_8859_1(PARROT_INTERP, ARGIN(STRING *src))
+STRING * charset_cvt_ascii_to_iso_8859_1(PARROT_INTERP,
+    ARGIN(const STRING *src))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
 PARROT_WARN_UNUSED_RESULT
 INTVAL mixed_cs_index(PARROT_INTERP,
-    ARGIN(STRING *src),
-    ARGIN(STRING *search),
+    ARGIN(const STRING *src),
+    ARGIN(const STRING *search),
     UINTVAL offs)
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)

Modified: branches/string_consting/src/string/charset/binary.c
==============================================================================
--- branches/string_consting/src/string/charset/binary.c	Thu Apr 22 10:39:00 2010	(r45892)
+++ branches/string_consting/src/string/charset/binary.c	Thu Apr 22 10:39:24 2010	(r45893)
@@ -34,17 +34,17 @@
         __attribute__nonnull__(3);
 
 PARROT_CANNOT_RETURN_NULL
-static STRING* compose(PARROT_INTERP, SHIM(STRING *source_string))
+static STRING* compose(PARROT_INTERP, SHIM(const STRING *source_string))
         __attribute__nonnull__(1);
 
 static INTVAL cs_index(SHIM_INTERP,
-    SHIM(STRING *source_string),
-    SHIM(STRING *search_string),
+    SHIM(const STRING *source_string),
+    SHIM(const STRING *search_string),
     SHIM(UINTVAL offset));
 
 static INTVAL cs_rindex(SHIM_INTERP,
-    SHIM(STRING *source_string),
-    SHIM(STRING *search_string),
+    SHIM(const STRING *source_string),
+    SHIM(const STRING *search_string),
     SHIM(UINTVAL offset));
 
 PARROT_CANNOT_RETURN_NULL
@@ -62,13 +62,13 @@
 
 static INTVAL find_cclass(SHIM_INTERP,
     SHIM(INTVAL flags),
-    SHIM(STRING *source_string),
+    SHIM(const STRING *source_string),
     UINTVAL offset,
     UINTVAL count);
 
 static INTVAL find_not_cclass(SHIM_INTERP,
     SHIM(INTVAL flags),
-    SHIM(STRING *source_string),
+    SHIM(const STRING *source_string),
     UINTVAL offset,
     UINTVAL count);
 
@@ -91,7 +91,7 @@
         __attribute__nonnull__(1);
 
 PARROT_CANNOT_RETURN_NULL
-static STRING* to_charset(PARROT_INTERP, ARGIN(STRING *src))
+static STRING* to_charset(PARROT_INTERP, ARGIN(const STRING *src))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
@@ -104,7 +104,7 @@
     SHIM(const STRING *source_string))
         __attribute__nonnull__(1);
 
-static UINTVAL validate(SHIM_INTERP, SHIM(STRING *source_string));
+static UINTVAL validate(SHIM_INTERP, SHIM(const STRING *source_string));
 #define ASSERT_ARGS_compare __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(lhs) \
     , PARROT_ASSERT_ARG(rhs))
@@ -148,7 +148,7 @@
 
 /*
 
-=item C<static STRING* to_charset(PARROT_INTERP, STRING *src)>
+=item C<static STRING* to_charset(PARROT_INTERP, const STRING *src)>
 
 Converts the STRING C<src> to STRING C<dest> in binary mode. Throws
 an exception if a suitable conversion function is not found.
@@ -159,7 +159,7 @@
 
 PARROT_CANNOT_RETURN_NULL
 static STRING*
-to_charset(PARROT_INTERP, ARGIN(STRING *src))
+to_charset(PARROT_INTERP, ARGIN(const STRING *src))
 {
     ASSERT_ARGS(to_charset)
     charset_converter_t conversion_func =
@@ -174,7 +174,7 @@
 
 /*
 
-=item C<static STRING* compose(PARROT_INTERP, STRING *source_string)>
+=item C<static STRING* compose(PARROT_INTERP, const STRING *source_string)>
 
 Throws an exception because we cannot compose a binary string.
 
@@ -185,7 +185,7 @@
 /* A err. can't compose binary */
 PARROT_CANNOT_RETURN_NULL
 static STRING*
-compose(PARROT_INTERP, SHIM(STRING *source_string))
+compose(PARROT_INTERP, SHIM(const STRING *source_string))
 {
     ASSERT_ARGS(compose)
     EXCEPTION(EXCEPTION_INVALID_CHARTYPE, "Can't compose binary data");
@@ -351,8 +351,8 @@
 
 /*
 
-=item C<static INTVAL cs_index(PARROT_INTERP, STRING *source_string, STRING
-*search_string, UINTVAL offset)>
+=item C<static INTVAL cs_index(PARROT_INTERP, const STRING *source_string, const
+STRING *search_string, UINTVAL offset)>
 
 Returns -1. It makes no sense to try and search for a substring in
 raw binary data.
@@ -362,8 +362,8 @@
 */
 
 static INTVAL
-cs_index(SHIM_INTERP, SHIM(STRING *source_string),
-        SHIM(STRING *search_string), SHIM(UINTVAL offset))
+cs_index(SHIM_INTERP, SHIM(const STRING *source_string),
+        SHIM(const STRING *search_string), SHIM(UINTVAL offset))
 {
     ASSERT_ARGS(cs_index)
     return -1;
@@ -371,8 +371,8 @@
 
 /*
 
-=item C<static INTVAL cs_rindex(PARROT_INTERP, STRING *source_string, STRING
-*search_string, UINTVAL offset)>
+=item C<static INTVAL cs_rindex(PARROT_INTERP, const STRING *source_string,
+const STRING *search_string, UINTVAL offset)>
 
 Returns -1. It makes no sense to search for the last substring match
 in raw binary data.
@@ -382,8 +382,8 @@
 */
 
 static INTVAL
-cs_rindex(SHIM_INTERP, SHIM(STRING *source_string),
-        SHIM(STRING *search_string), SHIM(UINTVAL offset))
+cs_rindex(SHIM_INTERP, SHIM(const STRING *source_string),
+        SHIM(const STRING *search_string), SHIM(UINTVAL offset))
 {
     ASSERT_ARGS(cs_rindex)
     return -1;
@@ -391,7 +391,7 @@
 
 /*
 
-=item C<static UINTVAL validate(PARROT_INTERP, STRING *source_string)>
+=item C<static UINTVAL validate(PARROT_INTERP, const STRING *source_string)>
 
 Returns 1. All sequential data is valid binary data.
 
@@ -401,7 +401,7 @@
 
 /* Binary's always valid */
 static UINTVAL
-validate(SHIM_INTERP, SHIM(STRING *source_string))
+validate(SHIM_INTERP, SHIM(const STRING *source_string))
 {
     ASSERT_ARGS(validate)
     return 1;
@@ -426,7 +426,7 @@
 
 /*
 
-=item C<static INTVAL find_cclass(PARROT_INTERP, INTVAL flags, STRING
+=item C<static INTVAL find_cclass(PARROT_INTERP, INTVAL flags, const STRING
 *source_string, UINTVAL offset, UINTVAL count)>
 
 =cut
@@ -435,7 +435,7 @@
 
 static INTVAL
 find_cclass(SHIM_INTERP, SHIM(INTVAL flags),
-            SHIM(STRING *source_string), UINTVAL offset, UINTVAL count)
+            SHIM(const STRING *source_string), UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(find_cclass)
     return offset + count;
@@ -443,7 +443,7 @@
 
 /*
 
-=item C<static INTVAL find_not_cclass(PARROT_INTERP, INTVAL flags, STRING
+=item C<static INTVAL find_not_cclass(PARROT_INTERP, INTVAL flags, const STRING
 *source_string, UINTVAL offset, UINTVAL count)>
 
 =cut
@@ -452,7 +452,7 @@
 
 static INTVAL
 find_not_cclass(SHIM_INTERP, SHIM(INTVAL flags),
-               SHIM(STRING *source_string), UINTVAL offset, UINTVAL count)
+               SHIM(const STRING *source_string), UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(find_not_cclass)
     return offset + count;

Modified: branches/string_consting/src/string/charset/iso-8859-1.c
==============================================================================
--- branches/string_consting/src/string/charset/iso-8859-1.c	Thu Apr 22 10:39:00 2010	(r45892)
+++ branches/string_consting/src/string/charset/iso-8859-1.c	Thu Apr 22 10:39:24 2010	(r45893)
@@ -27,7 +27,7 @@
 
 PARROT_CANNOT_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
-static STRING* compose(PARROT_INTERP, ARGIN(STRING *src))
+static STRING* compose(PARROT_INTERP, ARGIN(const STRING *src))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
@@ -48,7 +48,7 @@
 
 static INTVAL find_cclass(PARROT_INTERP,
     INTVAL flags,
-    ARGIN(STRING *source_string),
+    ARGIN(const STRING *source_string),
     UINTVAL offset,
     UINTVAL count)
         __attribute__nonnull__(1)
@@ -56,7 +56,7 @@
 
 static INTVAL find_not_cclass(PARROT_INTERP,
     INTVAL flags,
-    ARGIN(STRING *source_string),
+    ARGIN(const STRING *source_string),
     UINTVAL offset,
     UINTVAL count)
         __attribute__nonnull__(1)
@@ -86,17 +86,17 @@
 
 PARROT_CANNOT_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
-static STRING * to_charset(PARROT_INTERP, ARGIN(STRING *src))
+static STRING * to_charset(PARROT_INTERP, ARGIN(const STRING *src))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
 PARROT_CANNOT_RETURN_NULL
-static STRING * to_iso_8859_1(PARROT_INTERP, ARGIN(STRING *src))
+static STRING * to_iso_8859_1(PARROT_INTERP, ARGIN(const STRING *src))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
 PARROT_CANNOT_RETURN_NULL
-static STRING * to_unicode(PARROT_INTERP, ARGIN(STRING *src))
+static STRING * to_unicode(PARROT_INTERP, ARGIN(const STRING *src))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
@@ -111,7 +111,7 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-static UINTVAL validate(PARROT_INTERP, ARGIN(STRING *src))
+static UINTVAL validate(PARROT_INTERP, ARGIN(const STRING *src))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
@@ -168,7 +168,7 @@
 
 /*
 
-=item C<static STRING * to_iso_8859_1(PARROT_INTERP, STRING *src)>
+=item C<static STRING * to_iso_8859_1(PARROT_INTERP, const STRING *src)>
 
 Converts STRING C<src> to iso-8859-1 in STRING C<dest>.
 
@@ -178,7 +178,7 @@
 
 PARROT_CANNOT_RETURN_NULL
 static STRING *
-to_iso_8859_1(PARROT_INTERP, ARGIN(STRING *src))
+to_iso_8859_1(PARROT_INTERP, ARGIN(const STRING *src))
 {
     ASSERT_ARGS(to_iso_8859_1)
     UINTVAL offs, src_len;
@@ -204,7 +204,7 @@
 
 /*
 
-=item C<static STRING * to_unicode(PARROT_INTERP, STRING *src)>
+=item C<static STRING * to_unicode(PARROT_INTERP, const STRING *src)>
 
 Converts STRING C<src> to unicode STRING C<dest>.
 
@@ -214,7 +214,7 @@
 
 PARROT_CANNOT_RETURN_NULL
 static STRING *
-to_unicode(PARROT_INTERP, ARGIN(STRING *src))
+to_unicode(PARROT_INTERP, ARGIN(const STRING *src))
 {
     ASSERT_ARGS(to_unicode)
     STRING * dest = Parrot_str_clone(interp, src);
@@ -244,7 +244,7 @@
 
 /*
 
-=item C<static STRING * to_charset(PARROT_INTERP, STRING *src)>
+=item C<static STRING * to_charset(PARROT_INTERP, const STRING *src)>
 
 Converts the STRING C<src> to an ISO-8859-1 STRING C<dest>.
 
@@ -255,7 +255,7 @@
 PARROT_CANNOT_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
 static STRING *
-to_charset(PARROT_INTERP, ARGIN(STRING *src))
+to_charset(PARROT_INTERP, ARGIN(const STRING *src))
 {
     ASSERT_ARGS(to_charset)
     const charset_converter_t conversion_func =
@@ -270,7 +270,7 @@
 
 /*
 
-=item C<static STRING* compose(PARROT_INTERP, STRING *src)>
+=item C<static STRING* compose(PARROT_INTERP, const STRING *src)>
 
 ISO-8859-1 does not support composing, so we just copy the STRING C<src> and return the
 copy.
@@ -283,10 +283,10 @@
 PARROT_CANNOT_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
 static STRING*
-compose(PARROT_INTERP, ARGIN(STRING *src))
+compose(PARROT_INTERP, ARGIN(const STRING *src))
 {
     ASSERT_ARGS(compose)
-    return src;
+    return Parrot_str_copy(interp, src);
 }
 
 /*
@@ -516,7 +516,7 @@
 
 /*
 
-=item C<static UINTVAL validate(PARROT_INTERP, STRING *src)>
+=item C<static UINTVAL validate(PARROT_INTERP, const STRING *src)>
 
 Returns 1 if the STRING C<src> is a valid ISO-8859-1 STRING. Returns 0 otherwise.
 
@@ -525,7 +525,7 @@
 */
 
 static UINTVAL
-validate(PARROT_INTERP, ARGIN(STRING *src))
+validate(PARROT_INTERP, ARGIN(const STRING *src))
 {
     ASSERT_ARGS(validate)
     UINTVAL offset;
@@ -566,7 +566,7 @@
 
 /*
 
-=item C<static INTVAL find_cclass(PARROT_INTERP, INTVAL flags, STRING
+=item C<static INTVAL find_cclass(PARROT_INTERP, INTVAL flags, const STRING
 *source_string, UINTVAL offset, UINTVAL count)>
 
 Find a character in the given character class.  Delegates to the find_cclass
@@ -578,7 +578,7 @@
 
 static INTVAL
 find_cclass(PARROT_INTERP, INTVAL flags,
-            ARGIN(STRING *source_string), UINTVAL offset, UINTVAL count)
+            ARGIN(const STRING *source_string), UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(find_cclass)
     UINTVAL pos = offset;
@@ -591,7 +591,7 @@
 
 /*
 
-=item C<static INTVAL find_not_cclass(PARROT_INTERP, INTVAL flags, STRING
+=item C<static INTVAL find_not_cclass(PARROT_INTERP, INTVAL flags, const STRING
 *source_string, UINTVAL offset, UINTVAL count)>
 
 =cut
@@ -600,7 +600,7 @@
 
 static INTVAL
 find_not_cclass(PARROT_INTERP, INTVAL flags,
-                ARGIN(STRING *source_string), UINTVAL offset, UINTVAL count)
+                ARGIN(const STRING *source_string), UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(find_not_cclass)
     UINTVAL pos = offset;
@@ -686,7 +686,8 @@
 
 /*
 
-=item C<STRING * charset_cvt_iso_8859_1_to_ascii(PARROT_INTERP, STRING *src)>
+=item C<STRING * charset_cvt_iso_8859_1_to_ascii(PARROT_INTERP, const STRING
+*src)>
 
 Converts STRING C<src> in ISO-8859-1 to ASCII STRING C<dest>.
 
@@ -697,7 +698,7 @@
 PARROT_CANNOT_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
 STRING *
-charset_cvt_iso_8859_1_to_ascii(PARROT_INTERP, ARGIN(STRING *src))
+charset_cvt_iso_8859_1_to_ascii(PARROT_INTERP, ARGIN(const STRING *src))
 {
     ASSERT_ARGS(charset_cvt_iso_8859_1_to_ascii)
     UINTVAL offs;

Modified: branches/string_consting/src/string/charset/iso-8859-1.h
==============================================================================
--- branches/string_consting/src/string/charset/iso-8859-1.h	Thu Apr 22 10:39:00 2010	(r45892)
+++ branches/string_consting/src/string/charset/iso-8859-1.h	Thu Apr 22 10:39:24 2010	(r45893)
@@ -18,7 +18,8 @@
 
 PARROT_CANNOT_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
-STRING * charset_cvt_iso_8859_1_to_ascii(PARROT_INTERP, ARGIN(STRING *src))
+STRING * charset_cvt_iso_8859_1_to_ascii(PARROT_INTERP,
+    ARGIN(const STRING *src))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 

Modified: branches/string_consting/src/string/charset/unicode.c
==============================================================================
--- branches/string_consting/src/string/charset/unicode.c	Thu Apr 22 10:39:00 2010	(r45892)
+++ branches/string_consting/src/string/charset/unicode.c	Thu Apr 22 10:39:24 2010	(r45893)
@@ -34,7 +34,7 @@
         __attribute__nonnull__(3);
 
 PARROT_CANNOT_RETURN_NULL
-static STRING* compose(PARROT_INTERP, ARGIN(STRING *src))
+static STRING* compose(PARROT_INTERP, ARGIN(const STRING *src))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
@@ -45,8 +45,8 @@
         __attribute__nonnull__(2);
 
 static INTVAL cs_rindex(PARROT_INTERP,
-    SHIM(STRING *source_string),
-    SHIM(STRING *search_string),
+    SHIM(const STRING *source_string),
+    SHIM(const STRING *search_string),
     SHIM(UINTVAL offset))
         __attribute__nonnull__(1);
 
@@ -66,7 +66,7 @@
 
 static INTVAL find_cclass(PARROT_INTERP,
     INTVAL flags,
-    ARGIN(STRING *source_string),
+    ARGIN(const STRING *source_string),
     UINTVAL offset,
     UINTVAL count)
         __attribute__nonnull__(1)
@@ -74,7 +74,7 @@
 
 static INTVAL find_not_cclass(PARROT_INTERP,
     INTVAL flags,
-    ARGIN(STRING *source_string),
+    ARGIN(const STRING *source_string),
     UINTVAL offset,
     UINTVAL count)
         __attribute__nonnull__(1)
@@ -82,7 +82,7 @@
 
 PARROT_CANNOT_RETURN_NULL
 static STRING * get_graphemes(PARROT_INTERP,
-    ARGIN(STRING *source_string),
+    ARGIN(const STRING *source_string),
     UINTVAL offset,
     UINTVAL count)
         __attribute__nonnull__(1)
@@ -110,7 +110,7 @@
         __attribute__nonnull__(1);
 
 PARROT_CANNOT_RETURN_NULL
-static STRING* to_charset(PARROT_INTERP, ARGIN(STRING *src))
+static STRING* to_charset(PARROT_INTERP, ARGIN(const STRING *src))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
@@ -127,7 +127,7 @@
     SHIM(const STRING *source_string))
         __attribute__nonnull__(1);
 
-static UINTVAL validate(PARROT_INTERP, ARGIN(STRING *src))
+static UINTVAL validate(PARROT_INTERP, ARGIN(const STRING *src))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
@@ -204,8 +204,8 @@
 
 /*
 
-=item C<static STRING * get_graphemes(PARROT_INTERP, STRING *source_string,
-UINTVAL offset, UINTVAL count)>
+=item C<static STRING * get_graphemes(PARROT_INTERP, const STRING
+*source_string, UINTVAL offset, UINTVAL count)>
 
 Gets the graphemes from STRING C<source_string> starting at C<offset>. Gets
 C<count> graphemes total.
@@ -216,7 +216,7 @@
 
 PARROT_CANNOT_RETURN_NULL
 static STRING *
-get_graphemes(PARROT_INTERP, ARGIN(STRING *source_string),
+get_graphemes(PARROT_INTERP, ARGIN(const STRING *source_string),
         UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(get_graphemes)
@@ -226,7 +226,7 @@
 
 /*
 
-=item C<static STRING* to_charset(PARROT_INTERP, STRING *src)>
+=item C<static STRING* to_charset(PARROT_INTERP, const STRING *src)>
 
 Converts input STRING C<src> to unicode STRING C<dest>.
 
@@ -236,7 +236,7 @@
 
 PARROT_CANNOT_RETURN_NULL
 static STRING*
-to_charset(PARROT_INTERP, ARGIN(STRING *src))
+to_charset(PARROT_INTERP, ARGIN(const STRING *src))
 {
     ASSERT_ARGS(to_charset)
     const charset_converter_t conversion_func =
@@ -252,7 +252,7 @@
 
 /*
 
-=item C<static STRING* compose(PARROT_INTERP, STRING *src)>
+=item C<static STRING* compose(PARROT_INTERP, const STRING *src)>
 
 If Parrot is built with ICU, composes the STRING C<src>. Attempts to
 denormalize the STRING into the ICU default, NFC.
@@ -265,7 +265,7 @@
 
 PARROT_CANNOT_RETURN_NULL
 static STRING*
-compose(PARROT_INTERP, ARGIN(STRING *src))
+compose(PARROT_INTERP, ARGIN(const STRING *src))
 {
     ASSERT_ARGS(compose)
 #if PARROT_HAS_ICU
@@ -688,8 +688,8 @@
 
 /*
 
-=item C<static INTVAL cs_rindex(PARROT_INTERP, STRING *source_string, STRING
-*search_string, UINTVAL offset)>
+=item C<static INTVAL cs_rindex(PARROT_INTERP, const STRING *source_string,
+const STRING *search_string, UINTVAL offset)>
 
 Finds the last index of substring C<search_string> in STRING C<source_string>,
 starting from C<offset>. Not implemented.
@@ -699,8 +699,8 @@
 */
 
 static INTVAL
-cs_rindex(PARROT_INTERP, SHIM(STRING *source_string),
-        SHIM(STRING *search_string), SHIM(UINTVAL offset))
+cs_rindex(PARROT_INTERP, SHIM(const STRING *source_string),
+        SHIM(const STRING *search_string), SHIM(UINTVAL offset))
 {
     ASSERT_ARGS(cs_rindex)
     /* TODO: https://trac.parrot.org/parrot/wiki/StringsTasklist Implement this. */
@@ -710,7 +710,7 @@
 
 /*
 
-=item C<static UINTVAL validate(PARROT_INTERP, STRING *src)>
+=item C<static UINTVAL validate(PARROT_INTERP, const STRING *src)>
 
 Returns 1 if the STRING C<src> is a valid unicode string, returns 0 otherwise.
 
@@ -719,7 +719,7 @@
 */
 
 static UINTVAL
-validate(PARROT_INTERP, ARGIN(STRING *src))
+validate(PARROT_INTERP, ARGIN(const STRING *src))
 {
     ASSERT_ARGS(validate)
     UINTVAL     offset;
@@ -863,7 +863,7 @@
 
 /*
 
-=item C<static INTVAL find_cclass(PARROT_INTERP, INTVAL flags, STRING
+=item C<static INTVAL find_cclass(PARROT_INTERP, INTVAL flags, const STRING
 *source_string, UINTVAL offset, UINTVAL count)>
 
 =cut
@@ -872,7 +872,7 @@
 
 static INTVAL
 find_cclass(PARROT_INTERP, INTVAL flags,
-            ARGIN(STRING *source_string), UINTVAL offset, UINTVAL count)
+            ARGIN(const STRING *source_string), UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(find_cclass)
     String_iter iter;
@@ -904,7 +904,7 @@
 
 /*
 
-=item C<static INTVAL find_not_cclass(PARROT_INTERP, INTVAL flags, STRING
+=item C<static INTVAL find_not_cclass(PARROT_INTERP, INTVAL flags, const STRING
 *source_string, UINTVAL offset, UINTVAL count)>
 
 =cut
@@ -913,7 +913,7 @@
 
 static INTVAL
 find_not_cclass(PARROT_INTERP, INTVAL flags,
-                ARGIN(STRING *source_string), UINTVAL offset, UINTVAL count)
+                ARGIN(const STRING *source_string), UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(find_not_cclass)
     String_iter iter;

Modified: branches/string_consting/src/string/encoding/fixed_8.c
==============================================================================
--- branches/string_consting/src/string/encoding/fixed_8.c	Thu Apr 22 10:39:00 2010	(r45892)
+++ branches/string_consting/src/string/encoding/fixed_8.c	Thu Apr 22 10:39:24 2010	(r45893)
@@ -33,7 +33,7 @@
 
 PARROT_WARN_UNUSED_RESULT
 static UINTVAL find_cclass(SHIM_INTERP,
-    ARGIN(STRING *s),
+    ARGIN(const STRING *s),
     ARGIN(const INTVAL *typetable),
     INTVAL flags,
     UINTVAL pos,
@@ -73,7 +73,7 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 static STRING * get_bytes(PARROT_INTERP,
-    ARGIN(STRING *source_string),
+    ARGIN(const STRING *source_string),
     UINTVAL offset,
     UINTVAL count)
         __attribute__nonnull__(1)
@@ -89,7 +89,7 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 static STRING * get_codepoints(PARROT_INTERP,
-    ARGIN(STRING *source_string),
+    ARGIN(const STRING *source_string),
     UINTVAL offset,
     UINTVAL count)
         __attribute__nonnull__(1)
@@ -203,7 +203,7 @@
 
 /*
 
-=item C<static UINTVAL find_cclass(PARROT_INTERP, STRING *s, const INTVAL
+=item C<static UINTVAL find_cclass(PARROT_INTERP, const STRING *s, const INTVAL
 *typetable, INTVAL flags, UINTVAL pos, UINTVAL end)>
 
 codepoints are bytes, so delegate
@@ -214,8 +214,8 @@
 
 PARROT_WARN_UNUSED_RESULT
 static UINTVAL
-find_cclass(SHIM_INTERP, ARGIN(STRING *s), ARGIN(const INTVAL *typetable),
-INTVAL flags, UINTVAL pos, UINTVAL end)
+find_cclass(SHIM_INTERP, ARGIN(const STRING *s), ARGIN(const INTVAL *typetable),
+        INTVAL flags, UINTVAL pos, UINTVAL end)
 {
     ASSERT_ARGS(find_cclass)
     const unsigned char *contents = (const unsigned char *)s->strstart;
@@ -283,8 +283,8 @@
 
 /*
 
-=item C<static STRING * get_codepoints(PARROT_INTERP, STRING *source_string,
-UINTVAL offset, UINTVAL count)>
+=item C<static STRING * get_codepoints(PARROT_INTERP, const STRING
+*source_string, UINTVAL offset, UINTVAL count)>
 
 Returns the codepoints in string C<src> at position C<offset> and length
 C<count>.  (Delegates to C<get_bytes>.)
@@ -296,7 +296,7 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 static STRING *
-get_codepoints(PARROT_INTERP, ARGIN(STRING *source_string),
+get_codepoints(PARROT_INTERP, ARGIN(const STRING *source_string),
         UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(get_codepoints)
@@ -308,8 +308,8 @@
 
 /*
 
-=item C<static STRING * get_bytes(PARROT_INTERP, STRING *source_string, UINTVAL
-offset, UINTVAL count)>
+=item C<static STRING * get_bytes(PARROT_INTERP, const STRING *source_string,
+UINTVAL offset, UINTVAL count)>
 
 Returns the bytes in string C<src> at position C<offset> and length C<count>.
 
@@ -320,7 +320,7 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 static STRING *
-get_bytes(PARROT_INTERP, ARGIN(STRING *source_string), UINTVAL offset, UINTVAL count)
+get_bytes(PARROT_INTERP, ARGIN(const STRING *source_string), UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(get_bytes)
     STRING * const return_string = Parrot_str_copy(interp, source_string);

Modified: branches/string_consting/src/string/encoding/ucs2.c
==============================================================================
--- branches/string_consting/src/string/encoding/ucs2.c	Thu Apr 22 10:39:00 2010	(r45892)
+++ branches/string_consting/src/string/encoding/ucs2.c	Thu Apr 22 10:39:24 2010	(r45893)
@@ -47,7 +47,7 @@
 
 PARROT_WARN_UNUSED_RESULT
 static UINTVAL find_cclass(PARROT_INTERP,
-    ARGIN(STRING *s),
+    ARGIN(const STRING *s),
     ARGIN(const INTVAL *typetable),
     INTVAL flags,
     UINTVAL pos,
@@ -64,7 +64,7 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 static STRING * get_bytes(PARROT_INTERP,
-    SHIM(STRING *src),
+    SHIM(const STRING *src),
     SHIM(UINTVAL offset),
     SHIM(UINTVAL count))
         __attribute__nonnull__(1);
@@ -78,7 +78,7 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 static STRING * get_codepoints(PARROT_INTERP,
-    ARGIN(STRING *src),
+    ARGIN(const STRING *src),
     UINTVAL offset,
     UINTVAL count)
         __attribute__nonnull__(1)
@@ -232,7 +232,7 @@
 
 /*
 
-=item C<static UINTVAL find_cclass(PARROT_INTERP, STRING *s, const INTVAL
+=item C<static UINTVAL find_cclass(PARROT_INTERP, const STRING *s, const INTVAL
 *typetable, INTVAL flags, UINTVAL pos, UINTVAL end)>
 
 Stub, the charset level handles this for unicode strings.
@@ -243,8 +243,8 @@
 
 PARROT_WARN_UNUSED_RESULT
 static UINTVAL
-find_cclass(PARROT_INTERP, ARGIN(STRING *s), ARGIN(const INTVAL *typetable),
-INTVAL flags, UINTVAL pos, UINTVAL end)
+find_cclass(PARROT_INTERP, ARGIN(const STRING *s), ARGIN(const INTVAL *typetable),
+        INTVAL flags, UINTVAL pos, UINTVAL end)
 {
     UNUSED(s);
     UNUSED(typetable);
@@ -296,7 +296,7 @@
 
 /*
 
-=item C<static STRING * get_codepoints(PARROT_INTERP, STRING *src, UINTVAL
+=item C<static STRING * get_codepoints(PARROT_INTERP, const STRING *src, UINTVAL
 offset, UINTVAL count)>
 
 Returns the codepoints in string C<src> at position C<offset> and length
@@ -309,7 +309,7 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 static STRING *
-get_codepoints(PARROT_INTERP, ARGIN(STRING *src), UINTVAL offset, UINTVAL count)
+get_codepoints(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(get_codepoints)
     STRING * const return_string = Parrot_str_copy(interp, src);
@@ -337,8 +337,8 @@
 
 /*
 
-=item C<static STRING * get_bytes(PARROT_INTERP, STRING *src, UINTVAL offset,
-UINTVAL count)>
+=item C<static STRING * get_bytes(PARROT_INTERP, const STRING *src, UINTVAL
+offset, UINTVAL count)>
 
 Returns the bytes in string C<src> at position C<offset> and length C<count>.
 
@@ -349,7 +349,7 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 static STRING *
-get_bytes(PARROT_INTERP, SHIM(STRING *src), SHIM(UINTVAL offset),
+get_bytes(PARROT_INTERP, SHIM(const STRING *src), SHIM(UINTVAL offset),
         SHIM(UINTVAL count))
 {
     ASSERT_ARGS(get_bytes)

Modified: branches/string_consting/src/string/encoding/utf16.c
==============================================================================
--- branches/string_consting/src/string/encoding/utf16.c	Thu Apr 22 10:39:00 2010	(r45892)
+++ branches/string_consting/src/string/encoding/utf16.c	Thu Apr 22 10:39:24 2010	(r45893)
@@ -37,7 +37,7 @@
 
 PARROT_WARN_UNUSED_RESULT
 static UINTVAL find_cclass(PARROT_INTERP,
-    ARGIN(STRING *s),
+    ARGIN(const STRING *s),
     ARGIN(const INTVAL *typetable),
     INTVAL flags,
     UINTVAL pos,
@@ -54,7 +54,7 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 static STRING * get_bytes(PARROT_INTERP,
-    ARGIN(STRING *src),
+    ARGIN(const STRING *src),
     UINTVAL offset,
     UINTVAL count)
         __attribute__nonnull__(1)
@@ -69,7 +69,7 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 static STRING * get_codepoints(PARROT_INTERP,
-    ARGIN(STRING *src),
+    ARGIN(const STRING *src),
     UINTVAL offset,
     UINTVAL count)
         __attribute__nonnull__(1)
@@ -298,7 +298,7 @@
 
 /*
 
-=item C<static UINTVAL find_cclass(PARROT_INTERP, STRING *s, const INTVAL
+=item C<static UINTVAL find_cclass(PARROT_INTERP, const STRING *s, const INTVAL
 *typetable, INTVAL flags, UINTVAL pos, UINTVAL end)>
 
 Stub, the charset level handles this for unicode strings.
@@ -309,8 +309,8 @@
 
 PARROT_WARN_UNUSED_RESULT
 static UINTVAL
-find_cclass(PARROT_INTERP, ARGIN(STRING *s), ARGIN(const INTVAL *typetable),
-INTVAL flags, UINTVAL pos, UINTVAL end)
+find_cclass(PARROT_INTERP, ARGIN(const STRING *s), ARGIN(const INTVAL *typetable),
+        INTVAL flags, UINTVAL pos, UINTVAL end)
 {
     UNUSED(s);
     UNUSED(typetable);
@@ -375,7 +375,7 @@
 
 /*
 
-=item C<static STRING * get_codepoints(PARROT_INTERP, STRING *src, UINTVAL
+=item C<static STRING * get_codepoints(PARROT_INTERP, const STRING *src, UINTVAL
 offset, UINTVAL count)>
 
 Returns the codepoints in string C<src> at position C<offset> and length
@@ -388,7 +388,7 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 static STRING *
-get_codepoints(PARROT_INTERP, ARGIN(STRING *src), UINTVAL offset, UINTVAL count)
+get_codepoints(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(get_codepoints)
     String_iter iter;
@@ -409,8 +409,8 @@
 
 /*
 
-=item C<static STRING * get_bytes(PARROT_INTERP, STRING *src, UINTVAL offset,
-UINTVAL count)>
+=item C<static STRING * get_bytes(PARROT_INTERP, const STRING *src, UINTVAL
+offset, UINTVAL count)>
 
 Returns the bytes in string C<src> at position C<offset> and length C<count>.
 
@@ -421,7 +421,7 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 static STRING *
-get_bytes(PARROT_INTERP, ARGIN(STRING *src), UINTVAL offset, UINTVAL count)
+get_bytes(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(get_bytes)
     UNUSED(interp);

Modified: branches/string_consting/src/string/encoding/utf8.c
==============================================================================
--- branches/string_consting/src/string/encoding/utf8.c	Thu Apr 22 10:39:00 2010	(r45892)
+++ branches/string_consting/src/string/encoding/utf8.c	Thu Apr 22 10:39:24 2010	(r45893)
@@ -37,7 +37,7 @@
 
 PARROT_WARN_UNUSED_RESULT
 static UINTVAL find_cclass(PARROT_INTERP,
-    SHIM(STRING *s),
+    SHIM(const STRING *s),
     SHIM(const INTVAL *typetable),
     SHIM(INTVAL flags),
     SHIM(UINTVAL pos),
@@ -51,12 +51,11 @@
 
 PARROT_CANNOT_RETURN_NULL
 static STRING * get_bytes(PARROT_INTERP,
-    ARGMOD(STRING *src),
+    ARGIN(const STRING *src),
     UINTVAL offset,
     UINTVAL count)
         __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        FUNC_MODIFIES(*src);
+        __attribute__nonnull__(2);
 
 static UINTVAL get_codepoint(PARROT_INTERP,
     ARGIN(const STRING *src),
@@ -66,7 +65,7 @@
 
 PARROT_CANNOT_RETURN_NULL
 static STRING * get_codepoints(PARROT_INTERP,
-    ARGIN(STRING *src),
+    ARGIN(const STRING *src),
     UINTVAL offset,
     UINTVAL count)
         __attribute__nonnull__(1)
@@ -592,7 +591,7 @@
 
 /*
 
-=item C<static UINTVAL find_cclass(PARROT_INTERP, STRING *s, const INTVAL
+=item C<static UINTVAL find_cclass(PARROT_INTERP, const STRING *s, const INTVAL
 *typetable, INTVAL flags, UINTVAL pos, UINTVAL end)>
 
 Stub, the charset level handles this for unicode strings.
@@ -603,8 +602,8 @@
 
 PARROT_WARN_UNUSED_RESULT
 static UINTVAL
-find_cclass(PARROT_INTERP, SHIM(STRING *s), SHIM(const INTVAL *typetable),
-SHIM(INTVAL flags), SHIM(UINTVAL pos), SHIM(UINTVAL end))
+find_cclass(PARROT_INTERP, SHIM(const STRING *s), SHIM(const INTVAL *typetable),
+        SHIM(INTVAL flags), SHIM(UINTVAL pos), SHIM(UINTVAL end))
 {
     Parrot_ex_throw_from_c_args(interp, NULL,
         EXCEPTION_UNIMPLEMENTED,
@@ -664,7 +663,7 @@
 
 /*
 
-=item C<static STRING * get_codepoints(PARROT_INTERP, STRING *src, UINTVAL
+=item C<static STRING * get_codepoints(PARROT_INTERP, const STRING *src, UINTVAL
 offset, UINTVAL count)>
 
 Returns the codepoints in string C<src> at position C<offset> and length
@@ -676,7 +675,7 @@
 
 PARROT_CANNOT_RETURN_NULL
 static STRING *
-get_codepoints(PARROT_INTERP, ARGIN(STRING *src), UINTVAL offset, UINTVAL count)
+get_codepoints(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(get_codepoints)
 
@@ -704,8 +703,8 @@
 
 /*
 
-=item C<static STRING * get_bytes(PARROT_INTERP, STRING *src, UINTVAL offset,
-UINTVAL count)>
+=item C<static STRING * get_bytes(PARROT_INTERP, const STRING *src, UINTVAL
+offset, UINTVAL count)>
 
 Returns the bytes in string C<src> at position C<offset> and length C<count>.
 
@@ -715,7 +714,7 @@
 
 PARROT_CANNOT_RETURN_NULL
 static STRING *
-get_bytes(PARROT_INTERP, ARGMOD(STRING *src), UINTVAL offset, UINTVAL count)
+get_bytes(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(get_bytes)
     STRING * const return_string = Parrot_str_copy(interp, src);


More information about the parrot-commits mailing list