[svn:parrot] r45692 - in branches/immutable_strings_part1: include/parrot src/string/charset src/string/encoding

bacek at svn.parrot.org bacek at svn.parrot.org
Thu Apr 15 13:42:20 UTC 2010


Author: bacek
Date: Thu Apr 15 13:42:19 2010
New Revision: 45692
URL: https://trac.parrot.org/parrot/changeset/45692

Log:
Remove inplace string updating functions:

  - set_bytes
  - set_codepoints
  - set_grapheme

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

Modified: branches/immutable_strings_part1/include/parrot/charset.h
==============================================================================
--- branches/immutable_strings_part1/include/parrot/charset.h	Thu Apr 15 13:18:51 2010	(r45691)
+++ branches/immutable_strings_part1/include/parrot/charset.h	Thu Apr 15 13:42:19 2010	(r45692)
@@ -34,7 +34,6 @@
 #define PARROT_UNICODE_CHARSET Parrot_unicode_charset_ptr
 
 typedef STRING *(*charset_get_graphemes_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset, UINTVAL count);
-typedef void (*charset_set_graphemes_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset, UINTVAL replace_count, STRING *insert_string);
 
 typedef STRING * (*charset_to_charset_t)(PARROT_INTERP, STRING *source_string);
 typedef STRING * (*charset_from_unicode_t)(PARROT_INTERP, STRING *source_string);
@@ -213,7 +212,6 @@
 struct _charset {
     const char *name;
     charset_get_graphemes_t get_graphemes;
-    charset_set_graphemes_t set_graphemes;
     charset_to_charset_t to_charset;
     charset_compose_t compose;
     charset_decompose_t decompose;
@@ -264,8 +262,6 @@
 #define CHARSET_SET_BYTE(interp, source, offset, value) ((source)->encoding)->set_byte((interp), (source), (offset), (value))
 #define CHARSET_GET_CODEPOINTS(interp, source, offset, count) ((source)->encoding)->get_codepoints((interp), (source), (offset), (count))
 #define CHARSET_GET_BYTES(interp, source, offset, count) ((source)->encoding)->get_bytes((interp), (source), (offset), (count))
-#define CHARSET_SET_CODEPOINTS(interp, source, offset, count, newdata) ((source)->encoding)->set_codepoints((interp), (source), (offset), (count), (newdata))
-#define CHARSET_SET_BYTES(interp, source, offset, count, newdata) ((source)->encoding)->set_bytes((interp), (source), (offset), (count), (newdata))
 #define CHARSET_BECOME_ENCODING(interp, source) ((source)->encoding)->become_encoding((interp), (source))
 #define CHARSET_CODEPOINTS(interp, source) ((source)->encoding)->codepoints((interp), (source))
 #define CHARSET_BYTES(interp, source) ((source)->encoding)->bytes((interp), (source))

Modified: branches/immutable_strings_part1/include/parrot/encoding.h
==============================================================================
--- branches/immutable_strings_part1/include/parrot/encoding.h	Thu Apr 15 13:18:51 2010	(r45691)
+++ branches/immutable_strings_part1/include/parrot/encoding.h	Thu Apr 15 13:42:19 2010	(r45692)
@@ -22,8 +22,6 @@
 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 void (*encoding_set_codepoints_t)(PARROT_INTERP, STRING *src, UINTVAL offset, UINTVAL count, STRING *new_bytes);
-typedef void (*encoding_set_bytes_t)(PARROT_INTERP, STRING *src, UINTVAL offset, UINTVAL count, STRING *new_bytes);
 typedef void (*encoding_become_encoding_t)(PARROT_INTERP, STRING *src);
 typedef UINTVAL (*encoding_codepoints_t)(PARROT_INTERP, STRING *src);
 typedef UINTVAL (*encoding_bytes_t)(PARROT_INTERP, STRING *src);
@@ -47,8 +45,6 @@
     encoding_set_byte_t                 set_byte;
     encoding_get_codepoints_t           get_codepoints;
     encoding_get_bytes_t                get_bytes;
-    encoding_set_codepoints_t           set_codepoints;
-    encoding_set_bytes_t                set_bytes;
     encoding_become_encoding_t          become_encoding;
     encoding_codepoints_t               codepoints;
     encoding_bytes_t                    bytes;
@@ -214,10 +210,6 @@
     ((src)->encoding)->get_codepoints((i), (src), (offset), (count))
 #define ENCODING_GET_BYTES(i, src, offset, count) \
     ((src)->encoding)->get_bytes((i), (src), (offset), (count))
-#define ENCODING_SET_CODEPOINTS(i, src, offset, count, newdata) \
-    ((src)->encoding)->set_codepoints((i), (src), (offset), (count), (newdata))
-#define ENCODING_SET_BYTES(i, src, offset, count, newdata) \
-    ((src)->encoding)->set_bytes((i), (src), (offset), (count), (newdata))
 #define ENCODING_BECOME_ENCODING(i, src) \
     ((src)->encoding)->become_encoding((i), (src))
 #define ENCODING_CODEPOINTS(i, src) \

Modified: branches/immutable_strings_part1/src/string/charset/ascii.c
==============================================================================
--- branches/immutable_strings_part1/src/string/charset/ascii.c	Thu Apr 15 13:18:51 2010	(r45691)
+++ branches/immutable_strings_part1/src/string/charset/ascii.c	Thu Apr 15 13:42:19 2010	(r45692)
@@ -78,16 +78,6 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(3);
 
-static void set_graphemes(PARROT_INTERP,
-    ARGIN(STRING *source_string),
-    UINTVAL offset,
-    UINTVAL replace_count,
-    ARGMOD(STRING *insert_string))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(5)
-        FUNC_MODIFIES(*insert_string);
-
 PARROT_CANNOT_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
 static STRING * string_from_codepoint(PARROT_INTERP, UINTVAL codepoint)
@@ -151,10 +141,6 @@
 #define ASSERT_ARGS_is_cclass __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(source_string))
-#define ASSERT_ARGS_set_graphemes __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(source_string) \
-    , PARROT_ASSERT_ARG(insert_string))
 #define ASSERT_ARGS_string_from_codepoint __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_titlecase __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -205,28 +191,6 @@
 
 /*
 
-=item C<static void set_graphemes(PARROT_INTERP, STRING *source_string, UINTVAL
-offset, UINTVAL replace_count, STRING *insert_string)>
-
-Sets the graphemes for C<source_string>, starting at C<offset>. Replace
-C<replace_count> graphemes with those from STRING C<insert_string>.
-
-=cut
-
-*/
-
-static void
-set_graphemes(PARROT_INTERP, ARGIN(STRING *source_string),
-        UINTVAL offset, UINTVAL replace_count, ARGMOD(STRING *insert_string))
-{
-    ASSERT_ARGS(set_graphemes)
-    ENCODING_SET_BYTES(interp, source_string, offset,
-            replace_count, insert_string);
-
-}
-
-/*
-
 =item C<static STRING * to_ascii(PARROT_INTERP, STRING *src)>
 
 Attempts to convert STRING C<src> to ASCII in STRING C<dest>. Throws
@@ -850,7 +814,6 @@
     static const CHARSET base_set = {
         "ascii",
         ascii_get_graphemes,
-        set_graphemes,
         to_charset,
         compose,
         decompose,

Modified: branches/immutable_strings_part1/src/string/charset/binary.c
==============================================================================
--- branches/immutable_strings_part1/src/string/charset/binary.c	Thu Apr 15 13:18:51 2010	(r45691)
+++ branches/immutable_strings_part1/src/string/charset/binary.c	Thu Apr 15 13:42:19 2010	(r45692)
@@ -77,16 +77,6 @@
     SHIM(const STRING *source_string),
     SHIM(UINTVAL offset));
 
-static void set_graphemes(PARROT_INTERP,
-    ARGIN(STRING *source_string),
-    UINTVAL offset,
-    UINTVAL replace_count,
-    ARGMOD(STRING *insert_string))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(5)
-        FUNC_MODIFIES(*insert_string);
-
 PARROT_CANNOT_RETURN_NULL
 static STRING * string_from_codepoint(PARROT_INTERP, UINTVAL codepoint)
         __attribute__nonnull__(1);
@@ -131,10 +121,6 @@
 #define ASSERT_ARGS_find_cclass __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
 #define ASSERT_ARGS_find_not_cclass __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
 #define ASSERT_ARGS_is_cclass __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_set_graphemes __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(source_string) \
-    , PARROT_ASSERT_ARG(insert_string))
 #define ASSERT_ARGS_string_from_codepoint __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_titlecase __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -159,27 +145,6 @@
 #define EXCEPTION(err, str) \
     Parrot_ex_throw_from_c_args(interp, NULL, (err), (str))
 
-/*
-
-=item C<static void set_graphemes(PARROT_INTERP, STRING *source_string, UINTVAL
-offset, UINTVAL replace_count, STRING *insert_string)>
-
-Sets the graphemes for STRING C<source_string>, starting at offset
-C<offset>. Replaces C<replace_count> graphemes from STRING
-C<insert_string>.
-
-=cut
-
-*/
-
-static void
-set_graphemes(PARROT_INTERP, ARGIN(STRING *source_string),
-        UINTVAL offset, UINTVAL replace_count, ARGMOD(STRING *insert_string))
-{
-    ASSERT_ARGS(set_graphemes)
-    ENCODING_SET_BYTES(interp, source_string, offset,
-            replace_count, insert_string);
-}
 
 /*
 
@@ -533,7 +498,6 @@
     static const CHARSET base_set = {
         "binary",
         ascii_get_graphemes,
-        set_graphemes,
         to_charset,
         compose,
         decompose,

Modified: branches/immutable_strings_part1/src/string/charset/iso-8859-1.c
==============================================================================
--- branches/immutable_strings_part1/src/string/charset/iso-8859-1.c	Thu Apr 15 13:18:51 2010	(r45691)
+++ branches/immutable_strings_part1/src/string/charset/iso-8859-1.c	Thu Apr 15 13:42:19 2010	(r45692)
@@ -69,16 +69,6 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(3);
 
-static void set_graphemes(PARROT_INTERP,
-    ARGIN(STRING *source_string),
-    UINTVAL offset,
-    UINTVAL replace_count,
-    ARGMOD(STRING *insert_string))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(5)
-        FUNC_MODIFIES(*insert_string);
-
 PARROT_CANNOT_RETURN_NULL
 static STRING * string_from_codepoint(PARROT_INTERP, UINTVAL codepoint)
         __attribute__nonnull__(1);
@@ -145,10 +135,6 @@
 #define ASSERT_ARGS_is_cclass __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(source_string))
-#define ASSERT_ARGS_set_graphemes __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(source_string) \
-    , PARROT_ASSERT_ARG(insert_string))
 #define ASSERT_ARGS_string_from_codepoint __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_titlecase __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -182,27 +168,6 @@
 
 /*
 
-=item C<static void set_graphemes(PARROT_INTERP, STRING *source_string, UINTVAL
-offset, UINTVAL replace_count, STRING *insert_string)>
-
-Sets C<replace_count> graphemes in STRING C<source_string> starting at offset C<offset>.
-Gets the replacement graphemes from STRING C<insert_string>.
-
-=cut
-
-*/
-
-static void
-set_graphemes(PARROT_INTERP, ARGIN(STRING *source_string),
-        UINTVAL offset, UINTVAL replace_count, ARGMOD(STRING *insert_string))
-{
-    ASSERT_ARGS(set_graphemes)
-    ENCODING_SET_BYTES(interp, source_string, offset,
-            replace_count, insert_string);
-}
-
-/*
-
 =item C<static STRING * to_iso_8859_1(PARROT_INTERP, STRING *src)>
 
 Converts STRING C<src> to iso-8859-1 in STRING C<dest>.
@@ -692,7 +657,6 @@
     static const CHARSET base_set = {
         "iso-8859-1",
         ascii_get_graphemes,
-        set_graphemes,
         to_charset,
         compose,
         decompose,

Modified: branches/immutable_strings_part1/src/string/charset/unicode.c
==============================================================================
--- branches/immutable_strings_part1/src/string/charset/unicode.c	Thu Apr 15 13:18:51 2010	(r45691)
+++ branches/immutable_strings_part1/src/string/charset/unicode.c	Thu Apr 15 13:42:19 2010	(r45692)
@@ -95,16 +95,6 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(3);
 
-static void set_graphemes(PARROT_INTERP,
-    ARGIN(STRING *source_string),
-    UINTVAL offset,
-    UINTVAL replace_count,
-    ARGMOD(STRING *insert_string))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(5)
-        FUNC_MODIFIES(*insert_string);
-
 PARROT_CANNOT_RETURN_NULL
 static STRING * string_from_codepoint(PARROT_INTERP, UINTVAL codepoint)
         __attribute__nonnull__(1);
@@ -172,10 +162,6 @@
 #define ASSERT_ARGS_is_cclass __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(source_string))
-#define ASSERT_ARGS_set_graphemes __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(source_string) \
-    , PARROT_ASSERT_ARG(insert_string))
 #define ASSERT_ARGS_string_from_codepoint __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_titlecase __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -215,27 +201,6 @@
 
 #define UNIMPL EXCEPTION(EXCEPTION_UNIMPLEMENTED, "unimplemented unicode")
 
-/*
-
-=item C<static void set_graphemes(PARROT_INTERP, STRING *source_string, UINTVAL
-offset, UINTVAL replace_count, STRING *insert_string)>
-
-Sets C<replace_count> graphemes in STRING C<source_string> starting at offset
-C<offset>.  Gets the graphemes to be replaced from STRING C<insert_string>.
-
-=cut
-
-*/
-
-static void
-set_graphemes(PARROT_INTERP, ARGIN(STRING *source_string),
-        UINTVAL offset, UINTVAL replace_count, ARGMOD(STRING *insert_string))
-{
-    ASSERT_ARGS(set_graphemes)
-    ENCODING_SET_CODEPOINTS(interp, source_string, offset,
-            replace_count, insert_string);
-}
-
 
 /*
 
@@ -1070,7 +1035,6 @@
     static const CHARSET base_set   = {
         "unicode",
         get_graphemes,
-        set_graphemes,
         to_charset,
         compose,
         decompose,

Modified: branches/immutable_strings_part1/src/string/encoding/fixed_8.c
==============================================================================
--- branches/immutable_strings_part1/src/string/encoding/fixed_8.c	Thu Apr 15 13:18:51 2010	(r45691)
+++ branches/immutable_strings_part1/src/string/encoding/fixed_8.c	Thu Apr 15 13:42:19 2010	(r45692)
@@ -637,15 +637,12 @@
         set_byte,
         get_codepoints,
         get_bytes,
-        set_codepoints,
-        set_bytes,
         become_encoding,
         codepoints,
         bytes,
         iter_init,
         find_cclass,
         fixed_8_hash
-
     };
 
     STRUCT_COPY_FROM_STRUCT(return_encoding, base_encoding);

Modified: branches/immutable_strings_part1/src/string/encoding/ucs2.c
==============================================================================
--- branches/immutable_strings_part1/src/string/encoding/ucs2.c	Thu Apr 15 13:18:51 2010	(r45691)
+++ branches/immutable_strings_part1/src/string/encoding/ucs2.c	Thu Apr 15 13:42:19 2010	(r45692)
@@ -693,8 +693,6 @@
         set_byte,
         get_codepoints,
         get_bytes,
-        set_codepoints,
-        set_bytes,
         become_encoding,
         codepoints,
         bytes,

Modified: branches/immutable_strings_part1/src/string/encoding/utf16.c
==============================================================================
--- branches/immutable_strings_part1/src/string/encoding/utf16.c	Thu Apr 15 13:18:51 2010	(r45691)
+++ branches/immutable_strings_part1/src/string/encoding/utf16.c	Thu Apr 15 13:42:19 2010	(r45692)
@@ -724,8 +724,6 @@
         set_byte,
         get_codepoints,
         get_bytes,
-        set_codepoints,
-        set_bytes,
         become_encoding,
         codepoints,
         bytes,

Modified: branches/immutable_strings_part1/src/string/encoding/utf8.c
==============================================================================
--- branches/immutable_strings_part1/src/string/encoding/utf8.c	Thu Apr 15 13:18:51 2010	(r45691)
+++ branches/immutable_strings_part1/src/string/encoding/utf8.c	Thu Apr 15 13:42:19 2010	(r45692)
@@ -942,8 +942,6 @@
         set_byte,
         get_codepoints,
         get_bytes,
-        set_codepoints,
-        set_bytes,
         become_encoding,
         codepoints,
         bytes,


More information about the parrot-commits mailing list