[svn:parrot] r48173 - in branches/gsoc_nfg: include/parrot src/string src/string/charset
darbelo at svn.parrot.org
darbelo at svn.parrot.org
Sun Jul 25 23:43:13 UTC 2010
Author: darbelo
Date: Sun Jul 25 23:43:13 2010
New Revision: 48173
URL: https://trac.parrot.org/parrot/changeset/48173
Log:
There's no point to having a charset function that eventually always delegates to the encoding. Remove it and just call the encoding function.
Modified:
branches/gsoc_nfg/include/parrot/charset.h
branches/gsoc_nfg/src/string/api.c
branches/gsoc_nfg/src/string/charset/ascii.c
branches/gsoc_nfg/src/string/charset/binary.c
branches/gsoc_nfg/src/string/charset/iso-8859-1.c
branches/gsoc_nfg/src/string/charset/unicode.c
Modified: branches/gsoc_nfg/include/parrot/charset.h
==============================================================================
--- branches/gsoc_nfg/include/parrot/charset.h Sun Jul 25 23:42:52 2010 (r48172)
+++ branches/gsoc_nfg/include/parrot/charset.h Sun Jul 25 23:43:13 2010 (r48173)
@@ -29,7 +29,6 @@
#define PARROT_BINARY_CHARSET Parrot_binary_charset_ptr
#define PARROT_UNICODE_CHARSET Parrot_unicode_charset_ptr
-typedef STRING * (*charset_get_graphemes_t)(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL count);
typedef STRING * (*charset_to_charset_t)(PARROT_INTERP, ARGIN(const STRING *src));
typedef STRING * (*charset_from_unicode_t)(PARROT_INTERP, ARGIN(const STRING *src));
typedef STRING * (*charset_compose_t)(PARROT_INTERP, ARGIN(const STRING *src));
@@ -214,7 +213,6 @@
struct _charset {
const char *name;
- charset_get_graphemes_t get_graphemes;
charset_to_charset_t to_charset;
charset_compose_t compose;
charset_decompose_t decompose;
@@ -261,8 +259,6 @@
#define CHARSET_GET_CODEPOINT(interp, source, offset) ((source)->encoding)->get_codepoint((interp), (source), (offset))
#define CHARSET_GET_BYTE(interp, source, offset) ((source)->encoding)->get_byte((interp), (source), (offset))
#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_CODEPOINTS(interp, source) ((source)->encoding)->codepoints((interp), (source))
#define CHARSET_BYTES(interp, source) ((source)->encoding)->bytes((interp), (source))
Modified: branches/gsoc_nfg/src/string/api.c
==============================================================================
--- branches/gsoc_nfg/src/string/api.c Sun Jul 25 23:42:52 2010 (r48172)
+++ branches/gsoc_nfg/src/string/api.c Sun Jul 25 23:43:13 2010 (r48173)
@@ -1132,7 +1132,7 @@
if (true_length > (src->strlen - true_offset))
true_length = (UINTVAL)(src->strlen - true_offset);
- return CHARSET_GET_CODEPOINTS(interp, src, true_offset, true_length);
+ return ENCODING_GET_CODEPOINTS(interp, src, true_offset, true_length);
}
Modified: branches/gsoc_nfg/src/string/charset/ascii.c
==============================================================================
--- branches/gsoc_nfg/src/string/charset/ascii.c Sun Jul 25 23:42:52 2010 (r48172)
+++ branches/gsoc_nfg/src/string/charset/ascii.c Sun Jul 25 23:43:13 2010 (r48173)
@@ -165,27 +165,6 @@
/*
-=item C<STRING * ascii_get_graphemes(PARROT_INTERP, const STRING *src, UINTVAL
-offset, UINTVAL count)>
-
-Retrieves the graphemes for the STRING C<src>, starting at
-C<offset> and ending at C<offset + count>.
-
-=cut
-
-*/
-
-PARROT_CANNOT_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
-STRING *
-ascii_get_graphemes(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL count)
-{
- ASSERT_ARGS(ascii_get_graphemes)
- return ENCODING_GET_BYTES(interp, src, offset, count);
-}
-
-/*
-
=item C<static STRING * to_ascii(PARROT_INTERP, const STRING *src)>
Attempts to convert STRING C<src> to ASCII in STRING C<dest>. Throws
@@ -802,7 +781,6 @@
CHARSET * const return_set = Parrot_new_charset(interp);
static const CHARSET base_set = {
"ascii",
- ascii_get_graphemes,
to_charset,
compose,
decompose,
Modified: branches/gsoc_nfg/src/string/charset/binary.c
==============================================================================
--- branches/gsoc_nfg/src/string/charset/binary.c Sun Jul 25 23:42:52 2010 (r48172)
+++ branches/gsoc_nfg/src/string/charset/binary.c Sun Jul 25 23:43:13 2010 (r48173)
@@ -499,7 +499,6 @@
CHARSET * const return_set = Parrot_new_charset(interp);
static const CHARSET base_set = {
"binary",
- ascii_get_graphemes,
to_charset,
compose,
decompose,
Modified: branches/gsoc_nfg/src/string/charset/iso-8859-1.c
==============================================================================
--- branches/gsoc_nfg/src/string/charset/iso-8859-1.c Sun Jul 25 23:42:52 2010 (r48172)
+++ branches/gsoc_nfg/src/string/charset/iso-8859-1.c Sun Jul 25 23:43:13 2010 (r48173)
@@ -656,7 +656,6 @@
CHARSET * const return_set = Parrot_new_charset(interp);
static const CHARSET base_set = {
"iso-8859-1",
- ascii_get_graphemes,
to_charset,
compose,
decompose,
Modified: branches/gsoc_nfg/src/string/charset/unicode.c
==============================================================================
--- branches/gsoc_nfg/src/string/charset/unicode.c Sun Jul 25 23:42:52 2010 (r48172)
+++ branches/gsoc_nfg/src/string/charset/unicode.c Sun Jul 25 23:43:13 2010 (r48173)
@@ -79,14 +79,6 @@
__attribute__nonnull__(1)
__attribute__nonnull__(3);
-PARROT_CANNOT_RETURN_NULL
-static STRING * get_graphemes(PARROT_INTERP,
- ARGIN(const STRING *src),
- UINTVAL offset,
- UINTVAL count)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
static INTVAL is_cclass(PARROT_INTERP,
INTVAL flags,
ARGIN(const STRING *src),
@@ -153,9 +145,6 @@
#define ASSERT_ARGS_find_not_cclass __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
-#define ASSERT_ARGS_get_graphemes __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(src))
#define ASSERT_ARGS_is_cclass __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
@@ -202,27 +191,6 @@
/*
-=item C<static STRING * get_graphemes(PARROT_INTERP, const STRING *src, UINTVAL
-offset, UINTVAL count)>
-
-Gets the graphemes from STRING C<src> starting at C<offset>. Gets
-C<count> graphemes total.
-
-=cut
-
-*/
-
-PARROT_CANNOT_RETURN_NULL
-static STRING *
-get_graphemes(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL count)
-{
- ASSERT_ARGS(get_graphemes)
- return ENCODING_GET_CODEPOINTS(interp, src, offset, count);
-}
-
-
-/*
-
=item C<static STRING* to_charset(PARROT_INTERP, const STRING *src)>
Converts input STRING C<src> to unicode STRING C<dest>.
@@ -1045,7 +1013,6 @@
CHARSET * const return_set = Parrot_new_charset(interp);
static const CHARSET base_set = {
"unicode",
- get_graphemes,
to_charset,
compose,
decompose,
More information about the parrot-commits
mailing list