[svn:parrot] r45519 - branches/immutable_strings_part1/src/string/encoding
bacek at svn.parrot.org
bacek at svn.parrot.org
Sat Apr 10 14:35:59 UTC 2010
Author: bacek
Date: Sat Apr 10 14:35:59 2010
New Revision: 45519
URL: https://trac.parrot.org/parrot/changeset/45519
Log:
Update fixed_8 charset
Modified:
branches/immutable_strings_part1/src/string/encoding/fixed_8.c
Modified: branches/immutable_strings_part1/src/string/encoding/fixed_8.c
==============================================================================
--- branches/immutable_strings_part1/src/string/encoding/fixed_8.c Sat Apr 10 14:35:47 2010 (r45518)
+++ branches/immutable_strings_part1/src/string/encoding/fixed_8.c Sat Apr 10 14:35:59 2010 (r45519)
@@ -80,18 +80,6 @@
__attribute__nonnull__(2);
PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static STRING * get_bytes_inplace(PARROT_INTERP,
- ARGIN(STRING *source_string),
- UINTVAL offset,
- UINTVAL count,
- ARGMOD(STRING *return_string))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(5)
- FUNC_MODIFIES(*return_string);
-
-PARROT_WARN_UNUSED_RESULT
static UINTVAL get_codepoint(PARROT_INTERP,
ARGIN(const STRING *source_string),
UINTVAL offset)
@@ -107,18 +95,6 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static STRING * get_codepoints_inplace(PARROT_INTERP,
- ARGIN(STRING *source_string),
- UINTVAL offset,
- UINTVAL count,
- ARGMOD(STRING *dest_string))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(5)
- FUNC_MODIFIES(*dest_string);
-
static void iter_init(SHIM_INTERP,
ARGIN(const STRING *src),
ARGOUT(String_iter *iter))
@@ -162,9 +138,7 @@
PARROT_DOES_NOT_RETURN
PARROT_CANNOT_RETURN_NULL
-static STRING * to_encoding(PARROT_INTERP,
- SHIM(STRING *src),
- SHIM(STRING *dest))
+static STRING * to_encoding(PARROT_INTERP, SHIM(STRING *src))
__attribute__nonnull__(1);
#define ASSERT_ARGS_become_encoding __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -192,20 +166,12 @@
#define ASSERT_ARGS_get_bytes __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(source_string))
-#define ASSERT_ARGS_get_bytes_inplace __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(source_string) \
- , PARROT_ASSERT_ARG(return_string))
#define ASSERT_ARGS_get_codepoint __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(source_string))
#define ASSERT_ARGS_get_codepoints __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(source_string))
-#define ASSERT_ARGS_get_codepoints_inplace __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(source_string) \
- , PARROT_ASSERT_ARG(dest_string))
#define ASSERT_ARGS_iter_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(src) \
, PARROT_ASSERT_ARG(iter))
@@ -233,7 +199,7 @@
/*
-=item C<static STRING * to_encoding(PARROT_INTERP, STRING *src, STRING *dest)>
+=item C<static STRING * to_encoding(PARROT_INTERP, STRING *src)>
Converts the string C<src> to this particular encoding. If C<dest> is
provided, it will contain the result. Otherwise this function operates in
@@ -247,7 +213,7 @@
PARROT_DOES_NOT_RETURN
PARROT_CANNOT_RETURN_NULL
static STRING *
-to_encoding(PARROT_INTERP, SHIM(STRING *src), SHIM(STRING *dest))
+to_encoding(PARROT_INTERP, SHIM(STRING *src))
{
ASSERT_ARGS(to_encoding)
UNIMPL;
@@ -416,8 +382,9 @@
get_bytes(PARROT_INTERP, ARGIN(STRING *source_string), UINTVAL offset, UINTVAL count)
{
ASSERT_ARGS(get_bytes)
- STRING * const return_string = Parrot_str_new_COW(interp,
- source_string);
+ STRING * const return_string = Parrot_gc_new_string_header(interp, 0);
+ STRUCT_COPY(return_string, source_string);
+
return_string->encoding = source_string->encoding;
return_string->charset = source_string->charset;
@@ -430,60 +397,6 @@
return return_string;
}
-
-/*
-
-=item C<static STRING * get_codepoints_inplace(PARROT_INTERP, STRING
-*source_string, UINTVAL offset, UINTVAL count, STRING *dest_string)>
-
-Gets from string C<src> at position C<offset> C<count> codepoints and returns
-them in C<return_string>. (Delegates to C<get_bytes>.)
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static STRING *
-get_codepoints_inplace(PARROT_INTERP, ARGIN(STRING *source_string),
- UINTVAL offset, UINTVAL count, ARGMOD(STRING *dest_string))
-{
- ASSERT_ARGS(get_codepoints_inplace)
- return get_bytes_inplace(interp, source_string, offset,
- count, dest_string);
-}
-
-/*
-
-=item C<static STRING * get_bytes_inplace(PARROT_INTERP, STRING *source_string,
-UINTVAL offset, UINTVAL count, STRING *return_string)>
-
-Gets from string C<src> at position C<offset> C<count> bytes and returns them
-in C<return_string>.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static STRING *
-get_bytes_inplace(PARROT_INTERP, ARGIN(STRING *source_string),
- UINTVAL offset, UINTVAL count, ARGMOD(STRING *return_string))
-{
- ASSERT_ARGS(get_bytes_inplace)
- Parrot_str_reuse_COW(interp, source_string, return_string);
-
- 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 void set_codepoints(PARROT_INTERP, STRING *source_string, UINTVAL
@@ -687,9 +600,7 @@
get_byte,
set_byte,
get_codepoints,
- get_codepoints_inplace,
get_bytes,
- get_bytes_inplace,
set_codepoints,
set_bytes,
become_encoding,
@@ -697,8 +608,8 @@
bytes,
iter_init,
find_cclass
-
};
+
STRUCT_COPY_FROM_STRUCT(return_encoding, base_encoding);
Parrot_register_encoding(interp, "fixed_8", return_encoding);
return return_encoding;
More information about the parrot-commits
mailing list