[svn:parrot] r48206 - in trunk: src/string/charset t/op
darbelo at svn.parrot.org
darbelo at svn.parrot.org
Wed Jul 28 21:52:31 UTC 2010
Author: darbelo
Date: Wed Jul 28 21:52:30 2010
New Revision: 48206
URL: https://trac.parrot.org/parrot/changeset/48206
Log:
Make index and rindex operations work for the 'binary' charset.
Modified:
trunk/src/string/charset/binary.c
trunk/t/op/string.t
Modified: trunk/src/string/charset/binary.c
==============================================================================
--- trunk/src/string/charset/binary.c Wed Jul 28 18:42:09 2010 (r48205)
+++ trunk/src/string/charset/binary.c Wed Jul 28 21:52:30 2010 (r48206)
@@ -37,16 +37,6 @@
static STRING* compose(PARROT_INTERP, SHIM(const STRING *src))
__attribute__nonnull__(1);
-static INTVAL cs_index(SHIM_INTERP,
- SHIM(const STRING *src),
- SHIM(const STRING *search_string),
- SHIM(UINTVAL offset));
-
-static INTVAL cs_rindex(SHIM_INTERP,
- SHIM(const STRING *src),
- SHIM(const STRING *search_string),
- SHIM(UINTVAL offset));
-
PARROT_CANNOT_RETURN_NULL
static STRING* decompose(PARROT_INTERP, SHIM(const STRING *src))
__attribute__nonnull__(1);
@@ -107,8 +97,6 @@
, PARROT_ASSERT_ARG(rhs))
#define ASSERT_ARGS_compose __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_cs_index __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_cs_rindex __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_decompose __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_downcase __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -346,46 +334,6 @@
/*
-=item C<static INTVAL cs_index(PARROT_INTERP, const STRING *src, const STRING
-*search_string, UINTVAL offset)>
-
-Returns -1. It makes no sense to try and search for a substring in
-raw binary data.
-
-=cut
-
-*/
-
-static INTVAL
-cs_index(SHIM_INTERP, SHIM(const STRING *src),
- SHIM(const STRING *search_string), SHIM(UINTVAL offset))
-{
- ASSERT_ARGS(cs_index)
- return -1;
-}
-
-/*
-
-=item C<static INTVAL cs_rindex(PARROT_INTERP, const STRING *src, const STRING
-*search_string, UINTVAL offset)>
-
-Returns -1. It makes no sense to search for the last substring match
-in raw binary data.
-
-=cut
-
-*/
-
-static INTVAL
-cs_rindex(SHIM_INTERP, SHIM(const STRING *src),
- SHIM(const STRING *search_string), SHIM(UINTVAL offset))
-{
- ASSERT_ARGS(cs_rindex)
- return -1;
-}
-
-/*
-
=item C<static UINTVAL validate(PARROT_INTERP, const STRING *src)>
Returns 1. All sequential data is valid binary data.
@@ -510,8 +458,8 @@
downcase_first,
titlecase_first,
compare,
- cs_index,
- cs_rindex,
+ ascii_cs_index,
+ ascii_cs_rindex,
validate,
is_cclass,
find_cclass,
Modified: trunk/t/op/string.t
==============================================================================
--- trunk/t/op/string.t Wed Jul 28 18:42:09 2010 (r48205)
+++ trunk/t/op/string.t Wed Jul 28 21:52:30 2010 (r48206)
@@ -989,7 +989,7 @@
set $S0, binary:"Parrot"
set $S1, binary:"rot"
index $I1, $S0, $S1
- is( $I1, "-1", 'binary - binary' )
+ is( $I1, 3, 'binary - binary' )
.end
.sub negative_index_bug_35959
More information about the parrot-commits
mailing list