[svn:parrot] r48174 - in branches/gsoc_nfg: include/parrot src/string/charset src/string/encoding

darbelo at svn.parrot.org darbelo at svn.parrot.org
Sun Jul 25 23:43:32 UTC 2010


Author: darbelo
Date: Sun Jul 25 23:43:32 2010
New Revision: 48174
URL: https://trac.parrot.org/parrot/changeset/48174

Log:
Remove the get_bytes encoding function. Most encodings didn't implement it properly and now the bytebuffer PMC has rendered it moot.

Modified:
   branches/gsoc_nfg/include/parrot/encoding.h
   branches/gsoc_nfg/src/string/charset/ascii.h
   branches/gsoc_nfg/src/string/encoding/fixed_8.c
   branches/gsoc_nfg/src/string/encoding/nfg.c
   branches/gsoc_nfg/src/string/encoding/ucs2.c
   branches/gsoc_nfg/src/string/encoding/ucs4.c
   branches/gsoc_nfg/src/string/encoding/utf16.c
   branches/gsoc_nfg/src/string/encoding/utf8.c

Modified: branches/gsoc_nfg/include/parrot/encoding.h
==============================================================================
--- branches/gsoc_nfg/include/parrot/encoding.h	Sun Jul 25 23:43:13 2010	(r48173)
+++ branches/gsoc_nfg/include/parrot/encoding.h	Sun Jul 25 23:43:32 2010	(r48174)
@@ -20,7 +20,6 @@
 typedef UINTVAL  (*encoding_get_byte_t)(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset);
 typedef void     (*encoding_set_byte_t)(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL count);
 typedef STRING * (*encoding_get_codepoints_t)(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL count);
-typedef STRING * (*encoding_get_bytes_t)(PARROT_INTERP, ARGIN(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, ARGIN(const STRING *s), ARGIN(const INTVAL *typetable), INTVAL flags, UINTVAL offset, UINTVAL count);
@@ -41,7 +40,6 @@
     encoding_get_byte_t                 get_byte;
     encoding_set_byte_t                 set_byte;
     encoding_get_codepoints_t           get_codepoints;
-    encoding_get_bytes_t                get_bytes;
     encoding_codepoints_t               codepoints;
     encoding_bytes_t                    bytes;
     encoding_iter_init_t                iter_init;
@@ -204,8 +202,6 @@
     ((src)->encoding)->set_byte((i), (src), (offset), (value))
 #define ENCODING_GET_CODEPOINTS(i, src, offset, count) \
     ((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_CODEPOINTS(i, src) \
     ((src)->encoding)->codepoints((i), (src))
 #define ENCODING_BYTES(i, src) \

Modified: branches/gsoc_nfg/src/string/charset/ascii.h
==============================================================================
--- branches/gsoc_nfg/src/string/charset/ascii.h	Sun Jul 25 23:43:13 2010	(r48173)
+++ branches/gsoc_nfg/src/string/charset/ascii.h	Sun Jul 25 23:43:32 2010	(r48174)
@@ -53,15 +53,6 @@
         __attribute__nonnull__(3);
 
 PARROT_CANNOT_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
-STRING * ascii_get_graphemes(PARROT_INTERP,
-    ARGIN(const STRING *src),
-    UINTVAL offset,
-    UINTVAL count)
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-PARROT_CANNOT_RETURN_NULL
 STRING * charset_cvt_ascii_to_binary(PARROT_INTERP,
     ARGIN(const STRING *src))
         __attribute__nonnull__(1)
@@ -99,9 +90,6 @@
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(src) \
     , PARROT_ASSERT_ARG(search_string))
-#define ASSERT_ARGS_ascii_get_graphemes __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(src))
 #define ASSERT_ARGS_charset_cvt_ascii_to_binary __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(src))

Modified: branches/gsoc_nfg/src/string/encoding/fixed_8.c
==============================================================================
--- branches/gsoc_nfg/src/string/encoding/fixed_8.c	Sun Jul 25 23:43:13 2010	(r48173)
+++ branches/gsoc_nfg/src/string/encoding/fixed_8.c	Sun Jul 25 23:43:32 2010	(r48174)
@@ -71,15 +71,6 @@
         __attribute__nonnull__(2);
 
 PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static STRING * get_bytes(PARROT_INTERP,
-    ARGIN(const STRING *src),
-    UINTVAL offset,
-    UINTVAL count)
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-PARROT_WARN_UNUSED_RESULT
 static UINTVAL get_codepoint(PARROT_INTERP,
     ARGIN(const STRING *src),
     UINTVAL offset)
@@ -134,9 +125,6 @@
        PARROT_ASSERT_ARG(s))
 #define ASSERT_ARGS_get_byte __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(src))
-#define ASSERT_ARGS_get_bytes __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(src))
 #define ASSERT_ARGS_get_codepoint __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(src))
@@ -286,7 +274,7 @@
 offset, UINTVAL count)>
 
 Returns the codepoints in string C<src> at position C<offset> and length
-C<count>.  (Delegates to C<get_bytes>.)
+C<count>.
 
 =cut
 
@@ -298,28 +286,6 @@
 get_codepoints(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(get_codepoints)
-    STRING * const return_string = get_bytes(interp, src, offset, count);
-    return_string->charset = src->charset;
-    return return_string;
-}
-
-/*
-
-=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>.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static STRING *
-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);
 
     return_string->encoding = src->encoding;
@@ -506,7 +472,6 @@
         get_byte,
         set_byte,
         get_codepoints,
-        get_bytes,
         codepoints,
         bytes,
         iter_init,
@@ -527,4 +492,3 @@
  * End:
  * vim: expandtab shiftwidth=4:
  */
-

Modified: branches/gsoc_nfg/src/string/encoding/nfg.c
==============================================================================
--- branches/gsoc_nfg/src/string/encoding/nfg.c	Sun Jul 25 23:43:13 2010	(r48173)
+++ branches/gsoc_nfg/src/string/encoding/nfg.c	Sun Jul 25 23:43:32 2010	(r48174)
@@ -71,14 +71,6 @@
     SHIM(UINTVAL offset))
         __attribute__nonnull__(1);
 
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static STRING * get_bytes(PARROT_INTERP,
-    SHIM(const STRING *src),
-    SHIM(UINTVAL offset),
-    SHIM(UINTVAL count))
-        __attribute__nonnull__(1);
-
 static UINTVAL get_codepoint(PARROT_INTERP,
     ARGIN(const STRING *src),
     UINTVAL offset)
@@ -159,8 +151,6 @@
     , PARROT_ASSERT_ARG(typetable))
 #define ASSERT_ARGS_get_byte __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_get_bytes __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_get_codepoint __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(src))
@@ -415,30 +405,6 @@
 
 /*
 
-=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>.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static STRING *
-get_bytes(PARROT_INTERP, SHIM(const STRING *src), SHIM(UINTVAL offset),
-        SHIM(UINTVAL count))
-{
-    ASSERT_ARGS(get_bytes)
-    Parrot_ex_throw_from_c_args(interp, NULL,
-        EXCEPTION_UNIMPLEMENTED,
-        "No get_bytes for NFG");
-}
-
-
-/*
-
 =item C<static UINTVAL codepoints(PARROT_INTERP, const STRING *src)>
 
 Returns the number of codepoints in string C<src>.
@@ -728,7 +694,6 @@
         get_byte,
         set_byte,
         get_codepoints,
-        get_bytes,
         codepoints,
         bytes,
         iter_init,

Modified: branches/gsoc_nfg/src/string/encoding/ucs2.c
==============================================================================
--- branches/gsoc_nfg/src/string/encoding/ucs2.c	Sun Jul 25 23:43:13 2010	(r48173)
+++ branches/gsoc_nfg/src/string/encoding/ucs2.c	Sun Jul 25 23:43:32 2010	(r48174)
@@ -61,14 +61,6 @@
     SHIM(UINTVAL offset))
         __attribute__nonnull__(1);
 
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static STRING * get_bytes(PARROT_INTERP,
-    SHIM(const STRING *src),
-    SHIM(UINTVAL offset),
-    SHIM(UINTVAL count))
-        __attribute__nonnull__(1);
-
 static UINTVAL get_codepoint(PARROT_INTERP,
     ARGIN(const STRING *src),
     UINTVAL offset)
@@ -137,8 +129,6 @@
     , PARROT_ASSERT_ARG(typetable))
 #define ASSERT_ARGS_get_byte __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_get_bytes __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_get_codepoint __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(src))
@@ -338,28 +328,6 @@
 
 /*
 
-=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>.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static STRING *
-get_bytes(PARROT_INTERP, SHIM(const STRING *src), SHIM(UINTVAL offset),
-        SHIM(UINTVAL count))
-{
-    ASSERT_ARGS(get_bytes)
-    UNIMPL;
-}
-
-
-/*
-
 =item C<static UINTVAL codepoints(PARROT_INTERP, const STRING *src)>
 
 Returns the number of codepoints in string C<src>.
@@ -587,7 +555,6 @@
         get_byte,
         set_byte,
         get_codepoints,
-        get_bytes,
         codepoints,
         bytes,
         iter_init,

Modified: branches/gsoc_nfg/src/string/encoding/ucs4.c
==============================================================================
--- branches/gsoc_nfg/src/string/encoding/ucs4.c	Sun Jul 25 23:43:13 2010	(r48173)
+++ branches/gsoc_nfg/src/string/encoding/ucs4.c	Sun Jul 25 23:43:32 2010	(r48174)
@@ -61,14 +61,6 @@
     SHIM(UINTVAL offset))
         __attribute__nonnull__(1);
 
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static STRING * get_bytes(PARROT_INTERP,
-    SHIM(const STRING *src),
-    SHIM(UINTVAL offset),
-    SHIM(UINTVAL count))
-        __attribute__nonnull__(1);
-
 static UINTVAL get_codepoint(PARROT_INTERP,
     ARGIN(const STRING *src),
     UINTVAL offset)
@@ -141,8 +133,6 @@
     , PARROT_ASSERT_ARG(typetable))
 #define ASSERT_ARGS_get_byte __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_get_bytes __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_get_codepoint __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(src))
@@ -348,30 +338,6 @@
 
 /*
 
-=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>.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static STRING *
-get_bytes(PARROT_INTERP, SHIM(const STRING *src), SHIM(UINTVAL offset),
-        SHIM(UINTVAL count))
-{
-    ASSERT_ARGS(get_bytes)
-    Parrot_ex_throw_from_c_args(interp, NULL,
-        EXCEPTION_UNIMPLEMENTED,
-        "No get_bytes for UCS-4");
-}
-
-
-/*
-
 =item C<static UINTVAL codepoints(PARROT_INTERP, const STRING *src)>
 
 Returns the number of codepoints in string C<src>.
@@ -574,7 +540,6 @@
         get_byte,
         set_byte,
         get_codepoints,
-        get_bytes,
         codepoints,
         bytes,
         iter_init,

Modified: branches/gsoc_nfg/src/string/encoding/utf16.c
==============================================================================
--- branches/gsoc_nfg/src/string/encoding/utf16.c	Sun Jul 25 23:43:13 2010	(r48173)
+++ branches/gsoc_nfg/src/string/encoding/utf16.c	Sun Jul 25 23:43:32 2010	(r48174)
@@ -51,15 +51,6 @@
     UINTVAL offset)
         __attribute__nonnull__(2);
 
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static STRING * get_bytes(PARROT_INTERP,
-    ARGIN(const STRING *src),
-    UINTVAL offset,
-    UINTVAL count)
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
 static UINTVAL get_codepoint(PARROT_INTERP,
     ARGIN(const STRING *src),
     UINTVAL offset)
@@ -124,9 +115,6 @@
     , PARROT_ASSERT_ARG(typetable))
 #define ASSERT_ARGS_get_byte __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(src))
-#define ASSERT_ARGS_get_bytes __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(src))
 #define ASSERT_ARGS_get_codepoint __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(src))
@@ -393,31 +381,6 @@
     return return_string;
 }
 
-
-/*
-
-=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>.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static STRING *
-get_bytes(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL count)
-{
-    ASSERT_ARGS(get_bytes)
-    UNUSED(interp);
-    UNUSED(src);
-    UNUSED(offset)
-    UNUSED(count);
-    UNIMPL;
-}
-
 /*
 
 =item C<static UINTVAL codepoints(PARROT_INTERP, const STRING *src)>
@@ -591,7 +554,6 @@
         get_byte,
         set_byte,
         get_codepoints,
-        get_bytes,
         codepoints,
         bytes,
         iter_init,

Modified: branches/gsoc_nfg/src/string/encoding/utf8.c
==============================================================================
--- branches/gsoc_nfg/src/string/encoding/utf8.c	Sun Jul 25 23:43:13 2010	(r48173)
+++ branches/gsoc_nfg/src/string/encoding/utf8.c	Sun Jul 25 23:43:32 2010	(r48174)
@@ -49,14 +49,6 @@
     UINTVAL offset)
         __attribute__nonnull__(2);
 
-PARROT_CANNOT_RETURN_NULL
-static STRING * get_bytes(PARROT_INTERP,
-    ARGIN(const STRING *src),
-    UINTVAL offset,
-    UINTVAL count)
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
 static UINTVAL get_codepoint(PARROT_INTERP,
     ARGIN(const STRING *src),
     UINTVAL offset)
@@ -142,9 +134,6 @@
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_get_byte __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(src))
-#define ASSERT_ARGS_get_bytes __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(src))
 #define ASSERT_ARGS_get_codepoint __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(src))
@@ -704,35 +693,6 @@
 
 /*
 
-=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>.
-
-=cut
-
-*/
-
-PARROT_CANNOT_RETURN_NULL
-static STRING *
-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);
-
-    return_string->strstart = (char *)return_string->strstart + offset ;
-    return_string->bufused = count;
-
-    return_string->strlen = count;
-    return_string->hashval = 0;
-
-    return return_string;
-}
-
-
-
-/*
-
 =item C<static UINTVAL codepoints(PARROT_INTERP, const STRING *src)>
 
 Returns the number of codepoints in string C<src>.
@@ -821,7 +781,6 @@
         get_byte,
         set_byte,
         get_codepoints,
-        get_bytes,
         codepoints,
         bytes,
         iter_init,


More information about the parrot-commits mailing list