[svn:parrot] r45756 - in branches/immutable_strings_part1: include/parrot src/ops src/string src/string/encoding
petdance at svn.parrot.org
petdance at svn.parrot.org
Sat Apr 17 15:44:35 UTC 2010
Author: petdance
Date: Sat Apr 17 15:44:27 2010
New Revision: 45756
URL: https://trac.parrot.org/parrot/changeset/45756
Log:
fixing some sad consts. Removed all the set_codepoint functions in the encodings
Modified:
branches/immutable_strings_part1/include/parrot/charset.h
branches/immutable_strings_part1/include/parrot/encoding.h
branches/immutable_strings_part1/src/ops/string.ops
branches/immutable_strings_part1/src/string/charset.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 Sat Apr 17 14:56:47 2010 (r45755)
+++ branches/immutable_strings_part1/include/parrot/charset.h Sat Apr 17 15:44:27 2010 (r45756)
@@ -84,7 +84,7 @@
PARROT_EXPORT
PARROT_CAN_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
-const STRING * Parrot_charset_name(SHIM_INTERP, INTVAL number_of_charset);
+STRING * Parrot_charset_name(SHIM_INTERP, INTVAL number_of_charset);
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
@@ -257,7 +257,6 @@
#define CHARSET_TO_ENCODING(interp, source) ((source)->encoding)->to_encoding((interp), (source))
#define CHARSET_COPY_TO_ENCODING(interp, source) ((source)->encoding)->copy_to_encoding((interp), (source))
#define CHARSET_GET_CODEPOINT(interp, source, offset) ((source)->encoding)->get_codepoint((interp), (source), (offset))
-#define CHARSET_SET_CODEPOINT(interp, source, offset, codepoint) ((source)->encoding)->set_codepoint((interp), (source), (offset), (codepoint))
#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))
Modified: branches/immutable_strings_part1/include/parrot/encoding.h
==============================================================================
--- branches/immutable_strings_part1/include/parrot/encoding.h Sat Apr 17 14:56:47 2010 (r45755)
+++ branches/immutable_strings_part1/include/parrot/encoding.h Sat Apr 17 15:44:27 2010 (r45756)
@@ -17,7 +17,6 @@
typedef STRING * (*encoding_to_encoding_t)(PARROT_INTERP, NOTNULL(const STRING *src));
typedef UINTVAL (*encoding_get_codepoint_t)(PARROT_INTERP, const STRING *src, UINTVAL offset);
-typedef void (*encoding_set_codepoint_t)(PARROT_INTERP, STRING *src, UINTVAL offset, UINTVAL codepoint);
typedef UINTVAL (*encoding_get_byte_t)(PARROT_INTERP, const STRING *src, UINTVAL offset);
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);
@@ -39,7 +38,6 @@
UINTVAL max_bytes_per_codepoint;
encoding_to_encoding_t to_encoding;
encoding_get_codepoint_t get_codepoint;
- encoding_set_codepoint_t set_codepoint;
encoding_get_byte_t get_byte;
encoding_set_byte_t set_byte;
encoding_get_codepoints_t get_codepoints;
@@ -198,8 +196,6 @@
((src)->encoding)->max_bytes_per_codepoint
#define ENCODING_GET_CODEPOINT(i, src, offset) \
((src)->encoding)->get_codepoint((i), (src), (offset))
-#define ENCODING_SET_CODEPOINT(i, src, offset, codepoint) \
- ((src)->encoding)->set_codepoint((i), (src), (offset), (codepoint))
#define ENCODING_GET_BYTE(i, src, offset) \
((src)->encoding)->get_byte((i), (src), (offset))
#define ENCODING_SET_BYTE(i, src, offset, value) \
Modified: branches/immutable_strings_part1/src/ops/string.ops
==============================================================================
--- branches/immutable_strings_part1/src/ops/string.ops Sat Apr 17 14:56:47 2010 (r45755)
+++ branches/immutable_strings_part1/src/ops/string.ops Sat Apr 17 15:44:27 2010 (r45756)
@@ -198,8 +198,8 @@
inline op bytelength(out INT, in STR) :base_mem {
UINTVAL n;
- STRING * const s = $2;
- if (!s)
+ const STRING * const s = $2;
+ if (STRING_IS_NULL(s))
n = 0;
else {
n = s->bufused;
Modified: branches/immutable_strings_part1/src/string/charset.c
==============================================================================
--- branches/immutable_strings_part1/src/string/charset.c Sat Apr 17 14:56:47 2010 (r45755)
+++ branches/immutable_strings_part1/src/string/charset.c Sat Apr 17 15:44:27 2010 (r45756)
@@ -44,7 +44,7 @@
typedef struct One_charset {
NOTNULL(const CHARSET *charset);
- const STRING *name;
+ STRING *name;
To_converter *to_converters;
int n_converters;
} One_charset;
@@ -244,8 +244,7 @@
/*
-=item C<const STRING * Parrot_charset_name(PARROT_INTERP, INTVAL
-number_of_charset)>
+=item C<STRING * Parrot_charset_name(PARROT_INTERP, INTVAL number_of_charset)>
Returns the name of the charset given by the INTVAL index
C<number_of_charset>.
@@ -257,7 +256,7 @@
PARROT_EXPORT
PARROT_CAN_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
-const STRING *
+STRING *
Parrot_charset_name(SHIM_INTERP, INTVAL number_of_charset)
{
ASSERT_ARGS(Parrot_charset_name)
Modified: branches/immutable_strings_part1/src/string/encoding/fixed_8.c
==============================================================================
--- branches/immutable_strings_part1/src/string/encoding/fixed_8.c Sat Apr 17 14:56:47 2010 (r45755)
+++ branches/immutable_strings_part1/src/string/encoding/fixed_8.c Sat Apr 17 15:44:27 2010 (r45756)
@@ -109,13 +109,6 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-static void set_codepoint(PARROT_INTERP,
- ARGIN(STRING *source_string),
- UINTVAL offset,
- UINTVAL codepoint)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
PARROT_DOES_NOT_RETURN
PARROT_CANNOT_RETURN_NULL
static STRING * to_encoding(PARROT_INTERP, SHIM(const STRING *src))
@@ -156,9 +149,6 @@
#define ASSERT_ARGS_set_byte __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(source_string))
-#define ASSERT_ARGS_set_codepoint __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(source_string))
#define ASSERT_ARGS_to_encoding __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
@@ -210,25 +200,6 @@
return get_byte(interp, source_string, offset);
}
-/*
-
-=item C<static void set_codepoint(PARROT_INTERP, STRING *source_string, UINTVAL
-offset, UINTVAL codepoint)>
-
-This is the same as set byte
-
-=cut
-
-*/
-
-static void
-set_codepoint(PARROT_INTERP, ARGIN(STRING *source_string),
- UINTVAL offset, UINTVAL codepoint)
-{
- ASSERT_ARGS(set_codepoint)
- set_byte(interp, source_string, offset, codepoint);
-}
-
/*
@@ -535,7 +506,6 @@
1, /* Max bytes per codepoint */
to_encoding,
get_codepoint,
- set_codepoint,
get_byte,
set_byte,
get_codepoints,
Modified: branches/immutable_strings_part1/src/string/encoding/ucs2.c
==============================================================================
--- branches/immutable_strings_part1/src/string/encoding/ucs2.c Sat Apr 17 14:56:47 2010 (r45755)
+++ branches/immutable_strings_part1/src/string/encoding/ucs2.c Sat Apr 17 15:44:27 2010 (r45756)
@@ -98,13 +98,6 @@
SHIM(UINTVAL byte))
__attribute__nonnull__(1);
-static void set_codepoint(PARROT_INTERP,
- ARGIN(STRING *src),
- UINTVAL offset,
- UINTVAL codepoint)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
static STRING * to_encoding(PARROT_INTERP, ARGIN(const STRING *src))
@@ -161,9 +154,6 @@
, PARROT_ASSERT_ARG(iter))
#define ASSERT_ARGS_set_byte __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_set_codepoint __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(src))
#define ASSERT_ARGS_to_encoding __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
@@ -244,31 +234,6 @@
#endif
}
-/*
-
-=item C<static void set_codepoint(PARROT_INTERP, STRING *src, UINTVAL offset,
-UINTVAL codepoint)>
-
-Sets, in string C<src> at position C<offset>, the codepoint C<codepoint>.
-
-=cut
-
-*/
-
-static void
-set_codepoint(PARROT_INTERP, ARGIN(STRING *src), UINTVAL offset, UINTVAL codepoint)
-{
- ASSERT_ARGS(set_codepoint)
-#if PARROT_HAS_ICU
- UChar * const s = (UChar*) src->strstart;
- s[offset] = codepoint;
-#else
- UNUSED(src)
- UNUSED(offset)
- UNUSED(codepoint)
- no_ICU_lib(interp);
-#endif
-}
/*
@@ -623,7 +588,6 @@
2, /* Max bytes per codepoint 0 .. 0x10ffff */
to_encoding,
get_codepoint,
- set_codepoint,
get_byte,
set_byte,
get_codepoints,
Modified: branches/immutable_strings_part1/src/string/encoding/utf16.c
==============================================================================
--- branches/immutable_strings_part1/src/string/encoding/utf16.c Sat Apr 17 14:56:47 2010 (r45755)
+++ branches/immutable_strings_part1/src/string/encoding/utf16.c Sat Apr 17 15:44:27 2010 (r45756)
@@ -90,13 +90,6 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-static void set_codepoint(PARROT_INTERP,
- ARGIN(STRING *src),
- UINTVAL offset,
- UINTVAL codepoint)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
static STRING * to_encoding(PARROT_INTERP, ARGIN(const STRING *src))
@@ -151,9 +144,6 @@
#define ASSERT_ARGS_set_byte __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
-#define ASSERT_ARGS_set_codepoint __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(src))
#define ASSERT_ARGS_to_encoding __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
@@ -305,27 +295,6 @@
#endif
}
-/*
-
-=item C<static void set_codepoint(PARROT_INTERP, STRING *src, UINTVAL offset,
-UINTVAL codepoint)>
-
-Sets, in string C<src> at position C<offset>, the codepoint C<codepoint>.
-
-=cut
-
-*/
-
-static void
-set_codepoint(PARROT_INTERP, ARGIN(STRING *src), UINTVAL offset, UINTVAL codepoint)
-{
- ASSERT_ARGS(set_codepoint)
- UNUSED(interp);
- UNUSED(src);
- UNUSED(offset);
- UNUSED(codepoint);
- UNIMPL;
-}
/*
@@ -631,7 +600,6 @@
4, /* Max bytes per codepoint 0 .. 0x10ffff */
to_encoding,
get_codepoint,
- set_codepoint,
get_byte,
set_byte,
get_codepoints,
Modified: branches/immutable_strings_part1/src/string/encoding/utf8.c
==============================================================================
--- branches/immutable_strings_part1/src/string/encoding/utf8.c Sat Apr 17 14:56:47 2010 (r45755)
+++ branches/immutable_strings_part1/src/string/encoding/utf8.c Sat Apr 17 15:44:27 2010 (r45756)
@@ -86,13 +86,6 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-static void set_codepoint(PARROT_INTERP,
- ARGIN(STRING *src),
- UINTVAL offset,
- UINTVAL codepoint)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
PARROT_CAN_RETURN_NULL
static STRING * to_encoding(PARROT_INTERP, ARGIN(const STRING *src))
__attribute__nonnull__(1)
@@ -165,9 +158,6 @@
#define ASSERT_ARGS_set_byte __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
-#define ASSERT_ARGS_set_codepoint __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(src))
#define ASSERT_ARGS_to_encoding __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
@@ -599,29 +589,6 @@
return utf8_decode(interp, start);
}
-/*
-
-=item C<static void set_codepoint(PARROT_INTERP, STRING *src, UINTVAL offset,
-UINTVAL codepoint)>
-
-Sets, in string C<src> at position C<offset>, the codepoint C<codepoint>.
-
-=cut
-
-*/
-
-static void
-set_codepoint(PARROT_INTERP, ARGIN(STRING *src), UINTVAL offset, UINTVAL codepoint)
-{
- ASSERT_ARGS(set_codepoint)
- const void *start;
- void *p;
- DECL_CONST_CAST;
-
- start = utf8_skip_forward(src->strstart, offset);
- p = PARROT_const_cast(void *, start);
- utf8_encode(interp, p, codepoint);
-}
/*
@@ -851,7 +818,6 @@
4, /* Max bytes per codepoint 0 .. 0x10ffff */
to_encoding,
get_codepoint,
- set_codepoint,
get_byte,
set_byte,
get_codepoints,
More information about the parrot-commits
mailing list