Browse files

Everybody freeze! Immutable strings enters the building.

Merge branch immutable_strings_part1 back to trunk.

git-svn-id: https://svn.parrot.org/parrot/trunk@45852 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent 50abf40 commit 9b0f14ac6dbc05538e8aa6b4c71e25483b7eeaea @bacek bacek committed Apr 21, 2010
Showing with 1,606 additions and 3,340 deletions.
  1. +2 −5 MANIFEST.SKIP
  2. +1 −0 PBC_COMPAT
  3. +1 −1 compilers/imcc/parser_util.c
  4. +6 −5 config/gen/makefiles/root.in
  5. +0 −2 docs/embed.pod
  6. +0 −7 docs/pdds/pdd28_strings.pod
  7. +15 −26 include/parrot/charset.h
  8. +3 −27 include/parrot/encoding.h
  9. +6 −3 include/parrot/io.h
  10. +32 −149 include/parrot/string_funcs.h
  11. +2 −3 include/parrot/string_primitives.h
  12. +2 −0 lib/Parrot/Configure/Options/Test/Prepare.pm
  13. +5 −5 lib/Parrot/Distribution.pm
  14. +1 −1 lib/Parrot/Pmc2c/PMCEmitter.pm
  15. +2 −6 src/call/args.c
  16. +2 −2 src/dynext.c
  17. +9 −8 src/hash.c
  18. +2 −2 src/hll.c
  19. +3 −5 src/io/api.c
  20. +3 −1 src/io/buffer.c
  21. +3 −2 src/io/filehandle.c
  22. +5 −3 src/io/utf8.c
  23. +2 −2 src/io/win32.c
  24. +19 −21 src/key.c
  25. +32 −36 src/library.c
  26. +26 −26 src/ops/bit.ops
  27. +206 −190 src/ops/ops.num
  28. +6 −7 src/ops/set.ops
  29. +35 −32 src/ops/string.ops
  30. +2 −2 src/packdump.c
  31. +11 −11 src/packfile.c
  32. +1 −1 src/packfile/pf_items.c
  33. +1 −1 src/pbc_dump.c
  34. +1 −1 src/pmc/bigint.pmc
  35. +1 −1 src/pmc/bignum.pmc
  36. +5 −5 src/pmc/callcontext.pmc
  37. +2 −2 src/pmc/class.pmc
  38. +15 −19 src/pmc/codestring.pmc
  39. +0 −3 src/pmc/coroutine.pmc
  40. +2 −2 src/pmc/eventhandler.pmc
  41. +7 −16 src/pmc/filehandle.pmc
  42. +2 −2 src/pmc/fixedbooleanarray.pmc
  43. +3 −3 src/pmc/fixedintegerarray.pmc
  44. +3 −3 src/pmc/fixedpmcarray.pmc
  45. +5 −5 src/pmc/fixedstringarray.pmc
  46. +8 −8 src/pmc/hash.pmc
  47. +1 −2 src/pmc/key.pmc
  48. +1 −1 src/pmc/namespace.pmc
  49. +2 −2 src/pmc/object.pmc
  50. +1 −1 src/pmc/packfiledirectory.pmc
  51. +1 −1 src/pmc/parrotinterpreter.pmc
  52. +1 −3 src/pmc/pmcproxy.pmc
  53. +10 −5 src/pmc/resizablepmcarray.pmc
  54. +1 −1 src/pmc/role.pmc
  55. +5 −5 src/pmc/scalar.pmc
  56. +11 −15 src/pmc/string.pmc
  57. +10 −23 src/pmc/stringhandle.pmc
  58. +4 −17 src/pmc/sub.pmc
  59. +3 −3 src/runcore/profiling.c
  60. +38 −43 src/spf_render.c
  61. +1 −1 src/spf_vtable.c
  62. +423 −790 src/string/api.c
  63. +17 −16 src/string/charset.c
  64. +130 −204 src/string/charset/ascii.c
  65. +3 −24 src/string/charset/ascii.h
  66. +49 −71 src/string/charset/binary.c
  67. +1 −2 src/string/charset/binary.h
  68. +153 −186 src/string/charset/iso-8859-1.c
  69. +3 −7 src/string/charset/iso-8859-1.h
  70. +97 −146 src/string/charset/unicode.c
  71. +1 −2 src/string/charset/unicode.h
  72. +16 −228 src/string/encoding/fixed_8.c
  73. +1 −2 src/string/encoding/fixed_8.h
  74. +22 −213 src/string/encoding/ucs2.c
  75. +1 −2 src/string/encoding/ucs2.h
  76. +25 −266 src/string/encoding/utf16.c
  77. +1 −2 src/string/encoding/utf16.h
  78. +28 −260 src/string/encoding/utf8.c
  79. +1 −2 src/string/encoding/utf8.h
  80. +3 −3 src/string/primitives.c
  81. +3 −7 src/sub.c
  82. BIN t/native_pbc/annotations.pbc
  83. BIN t/native_pbc/integer_1.pbc
  84. BIN t/native_pbc/number_1.pbc
  85. BIN t/native_pbc/string_1.pbc
  86. +19 −96 t/op/string.t
  87. +1 −12 t/pmc/string.t
  88. +18 −14 tools/dev/pbc_to_exe.pir
View
7 MANIFEST.SKIP
@@ -65,8 +65,8 @@
^all_cstring\.str/
^blib$
^blib/
-^config_lib\.pir$
-^config_lib\.pir/
+^config_lib\.pasm$
+^config_lib\.pasm/
^cover_db$
^cover_db/
^install_config\.fpmc$
@@ -616,9 +616,6 @@
# generated from svn:ignore of 'runtime/parrot/library/String/'
^runtime/parrot/library/String/Utils\.pbc$
^runtime/parrot/library/String/Utils\.pbc/
-# generated from svn:ignore of 'runtime/parrot/library/TAP/'
-^runtime/parrot/library/TAP/.*\.pbc$
-^runtime/parrot/library/TAP/.*\.pbc/
# generated from svn:ignore of 'runtime/parrot/library/Tcl/'
^runtime/parrot/library/Tcl/.*\.pbc$
^runtime/parrot/library/Tcl/.*\.pbc/
View
1 PBC_COMPAT
@@ -27,6 +27,7 @@
# please insert tab separated entries at the top of the list
+6.6 2010.04.17 bacek add replace op
6.5 2010.03.09 cotto remove cpu_ret op
6.4 2010.03.02 cotto remove prederef__ and reserved
6.3 2010.02.16 whiteknight Add OpLib and Opcode PMCs
View
2 compilers/imcc/parser_util.c
@@ -708,7 +708,7 @@ imcc_compile(PARROT_INTERP, ARGIN(const char *s), int pasm_file,
sub_data->seg = new_cs;
sub_data->start_offs = 0;
sub_data->end_offs = new_cs->base.size;
- sub_data->name = Parrot_str_copy(interp, name);
+ sub_data->name = name;
*error_message = NULL;
}
View
11 config/gen/makefiles/root.in
@@ -2559,11 +2559,11 @@ tags.emacs.dummy:
tags-vi: tags.vi.dummy
$(RM_F) tags
@ctags@ \
- --links=no --totals \
- -R --exclude=blib --exclude=.svn \
- --languages=c,perl --langmap=c:+.h,c:+.pmc,c:+.ops \
- -I NOTNULL,NULLOK,ARGIN,ARGMOD,ARGOUT,ARGINOUT,ARGIN_NULLOK,ARGOUT_NULLOK,ARGMOD_NULLOK,ARGFREE,ARGFREE_NOTNULL \
- .
+ --links=no --totals \
+ -R --exclude=blib --exclude=.svn \
+ --languages=c,perl --langmap=c:+.h,c:+.pmc,c:+.ops \
+ -I NOTNULL,NULLOK,ARGIN,ARGMOD,ARGOUT,ARGINOUT,ARGIN_NULLOK,ARGOUT_NULLOK,ARGMOD_NULLOK,ARGFREE,ARGFREE_NOTNULL \
+ .
$(PERL) $(BUILD_TOOLS_DIR)/addopstags.pl $(OPS_FILES)
tags.vi.dummy:
@@ -2575,6 +2575,7 @@ perlcritic:
# Andy's extra-cranky Perl::Critic checking for cage cleaners
cagecritic:
+ @perl -MPerl::Critic::Bangs -e'$$min=q{1.04};die qq{You need Bangs $$min} unless $$Perl::Critic::Bangs::VERSION ge $$min'
perlcritic -1 --profile tools/util/perlcritic-cage.conf $(CRITIC_FILES)
# This target will eventually create all the headers automatically. If you
View
2 docs/embed.pod
@@ -1551,8 +1551,6 @@ The list may also be augmented if additional functionality is required.
=item C<Parrot_store_sub_in_namespace>
-=item C<Parrot_str_append>
-
=item C<Parrot_str_boolean>
=item C<Parrot_str_byte_length>
View
7 docs/pdds/pdd28_strings.pod
@@ -379,13 +379,6 @@ Concatenate two strings. Takes three arguments: two strings, and one integer
value of flags. If both string arguments are null, return a new string created
according to the integer flags.
-=head4 Parrot_str_append (was string_append)
-
-Append one string to another and return the result. In the default case, the
-return value is the same as the first string argument (modifying that argument
-in place). If the first argument is COW or read-only, then the return value is
-a new string.
-
=head4 Parrot_str_new (was string_from_cstring)
Return a new string with the default encoding and character set. Accepts two
View
41 include/parrot/charset.h
@@ -34,19 +34,17 @@ PARROT_DATA CHARSET *Parrot_ascii_charset_ptr;
#define PARROT_UNICODE_CHARSET Parrot_unicode_charset_ptr
typedef STRING *(*charset_get_graphemes_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset, UINTVAL count);
-typedef STRING *(*charset_get_graphemes_inplace_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset, UINTVAL count, STRING *dest_string);
-typedef void (*charset_set_graphemes_t)(PARROT_INTERP, STRING *source_string, UINTVAL offset, UINTVAL replace_count, STRING *insert_string);
-typedef STRING * (*charset_to_charset_t)(PARROT_INTERP, STRING *source_string, STRING *dest);
-typedef STRING * (*charset_from_unicode_t)(PARROT_INTERP, STRING *source_string, STRING *dest);
+typedef STRING * (*charset_to_charset_t)(PARROT_INTERP, STRING *source_string);
+typedef STRING * (*charset_from_unicode_t)(PARROT_INTERP, STRING *source_string);
typedef STRING* (*charset_compose_t)(PARROT_INTERP, STRING *source_string);
typedef STRING* (*charset_decompose_t)(PARROT_INTERP, STRING *source_string);
-typedef void (*charset_upcase_t)(PARROT_INTERP, STRING *source_string);
-typedef void (*charset_downcase_t)(PARROT_INTERP, STRING *source_string);
-typedef void (*charset_titlecase_t)(PARROT_INTERP, STRING *source_string);
-typedef void (*charset_upcase_first_t)(PARROT_INTERP, STRING *source_string);
-typedef void (*charset_downcase_first_t)(PARROT_INTERP, STRING *source_string);
-typedef void (*charset_titlecase_first_t)(PARROT_INTERP, STRING *source_string);
+typedef STRING* (*charset_upcase_t)(PARROT_INTERP, const STRING *source_string);
+typedef STRING* (*charset_downcase_t)(PARROT_INTERP, const STRING *source_string);
+typedef STRING* (*charset_titlecase_t)(PARROT_INTERP, const STRING *source_string);
+typedef STRING* (*charset_upcase_first_t)(PARROT_INTERP, const STRING *source_string);
+typedef STRING* (*charset_downcase_first_t)(PARROT_INTERP, const STRING *source_string);
+typedef STRING* (*charset_titlecase_first_t)(PARROT_INTERP, const STRING *source_string);
typedef INTVAL (*charset_compare_t)(PARROT_INTERP, const STRING *lhs, const STRING *rhs);
typedef INTVAL (*charset_index_t)(PARROT_INTERP, STRING *source_string, STRING *search_string, UINTVAL offset);
typedef INTVAL (*charset_rindex_t)(PARROT_INTERP, STRING *source_string, STRING *search_string, UINTVAL offset);
@@ -73,7 +71,7 @@ typedef INTVAL (*charset_find_word_boundary_t)(PARROT_INTERP, STRING *source_str
typedef STRING *(*charset_string_from_codepoint_t)(PARROT_INTERP, UINTVAL codepoint);
typedef size_t (*charset_compute_hash_t)(PARROT_INTERP, const STRING *, size_t seed);
-typedef STRING* (*charset_converter_t)(PARROT_INTERP, STRING *src, STRING *dst);
+typedef STRING* (*charset_converter_t)(PARROT_INTERP, STRING *src);
/* HEADERIZER BEGIN: src/string/charset.c */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
@@ -86,7 +84,7 @@ const char * Parrot_charset_c_name(SHIM_INTERP, INTVAL number_of_charset);
PARROT_EXPORT
PARROT_CAN_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
-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
@@ -137,18 +135,19 @@ const CHARSET * Parrot_get_charset(SHIM_INTERP, INTVAL number_of_charset);
PARROT_EXPORT
PARROT_CAN_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
-CHARSET * Parrot_load_charset(PARROT_INTERP, ARGIN(const char *charsetname))
+const CHARSET * Parrot_load_charset(PARROT_INTERP,
+ ARGIN(const char *charsetname))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
PARROT_EXPORT
INTVAL Parrot_make_default_charset(SHIM_INTERP,
SHIM(const char *charsetname),
- ARGIN(CHARSET *charset))
+ ARGIN(const CHARSET *charset))
__attribute__nonnull__(3);
PARROT_EXPORT
-PARROT_CAN_RETURN_NULL
+PARROT_CANNOT_RETURN_NULL
PARROT_MALLOC
CHARSET * Parrot_new_charset(PARROT_INTERP)
__attribute__nonnull__(1);
@@ -164,7 +163,7 @@ INTVAL Parrot_register_charset(PARROT_INTERP,
PARROT_EXPORT
void Parrot_register_charset_converter(PARROT_INTERP,
ARGIN(const CHARSET *lhs),
- ARGIN(CHARSET *rhs),
+ ARGIN(const CHARSET *rhs),
ARGIN(charset_converter_t func))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
@@ -214,8 +213,6 @@ void Parrot_register_charset_converter(PARROT_INTERP,
struct _charset {
const char *name;
charset_get_graphemes_t get_graphemes;
- charset_get_graphemes_inplace_t get_graphemes_inplace;
- charset_set_graphemes_t set_graphemes;
charset_to_charset_t to_charset;
charset_compose_t compose;
charset_decompose_t decompose;
@@ -238,8 +235,6 @@ struct _charset {
};
#define CHARSET_GET_GRAPEMES(interp, source, offset, count) ((source)->charset)->get_graphemes((interp), (source), (offset), (count))
-#define CHARSET_GET_GRAPHEMES_INPLACE(interp, source, dest, offset, count) ((source)->charset)->get_graphemes((interp), (source), (dest), (offset), (count))
-#define CHARSET_SET_GRAPHEMES(interp, source, offset, replace_count, insert) ((source)->charset)->set_graphemes((interp), (source), (offset), (replace_count), (insert))
#define CHARSET_TO_UNICODE(interp, source, dest) ((source)->charset)->to_unicode((interp), (source), (dest))
#define CHARSET_COMPOSE(interp, source) ((source)->charset)->compose((interp), (source))
#define CHARSET_DECOMPOSE(interp, source) ((source)->charset)->decompose((interp), (source))
@@ -262,16 +257,10 @@ struct _charset {
#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))
-#define CHARSET_GET_CODEPOINTS_INPLACE(interp, source, dest, offset, count) ((source)->encoding)->get_codepoints_inplace((interp), (source), (dest), (offset), (count))
#define CHARSET_GET_BYTES(interp, source, offset, count) ((source)->encoding)->get_bytes((interp), (source), (offset), (count))
-#define CHARSET_GET_BYTES_INPLACE(interp, source, offset, count, dest) ((source)->encoding)->get_bytes((interp), (source), (offset), (count), (dest))
-#define CHARSET_SET_CODEPOINTS(interp, source, offset, count, newdata) ((source)->encoding)->set_codepoints((interp), (source), (offset), (count), (newdata))
-#define CHARSET_SET_BYTES(interp, source, offset, count, newdata) ((source)->encoding)->set_bytes((interp), (source), (offset), (count), (newdata))
-#define CHARSET_BECOME_ENCODING(interp, source) ((source)->encoding)->become_encoding((interp), (source))
#define CHARSET_CODEPOINTS(interp, source) ((source)->encoding)->codepoints((interp), (source))
#define CHARSET_BYTES(interp, source) ((source)->encoding)->bytes((interp), (source))
View
30 include/parrot/encoding.h
@@ -15,20 +15,14 @@
#include "parrot/parrot.h"
-typedef STRING * (*encoding_to_encoding_t)(PARROT_INTERP, NOTNULL(STRING *src), NULLOK(STRING *dest));
+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);
typedef STRING *(*encoding_get_bytes_t)(PARROT_INTERP, STRING *src, UINTVAL offset, UINTVAL count);
-typedef STRING *(*encoding_get_codepoints_inplace_t)(PARROT_INTERP, STRING *src, UINTVAL offset, UINTVAL count, STRING *dest_string);
-typedef STRING *(*encoding_get_bytes_inplace_t)(PARROT_INTERP, STRING *src, UINTVAL offset, UINTVAL count, STRING *dest_string);
-typedef void (*encoding_set_codepoints_t)(PARROT_INTERP, STRING *src, UINTVAL offset, UINTVAL count, STRING *new_bytes);
-typedef void (*encoding_set_bytes_t)(PARROT_INTERP, STRING *src, UINTVAL offset, UINTVAL count, STRING *new_bytes);
-typedef void (*encoding_become_encoding_t)(PARROT_INTERP, STRING *src);
-typedef UINTVAL (*encoding_codepoints_t)(PARROT_INTERP, STRING *src);
-typedef UINTVAL (*encoding_bytes_t)(PARROT_INTERP, STRING *src);
+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, STRING *s, const INTVAL *typetable, INTVAL flags, UINTVAL offset, UINTVAL count);
typedef size_t (*encoding_hash_t)(PARROT_INTERP, const STRING *s, size_t hashval);
@@ -44,16 +38,10 @@ struct _encoding {
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;
- encoding_get_codepoints_inplace_t get_codepoints_inplace;
encoding_get_bytes_t get_bytes;
- encoding_get_bytes_inplace_t get_bytes_inplace;
- encoding_set_codepoints_t set_codepoints;
- encoding_set_bytes_t set_bytes;
- encoding_become_encoding_t become_encoding;
encoding_codepoints_t codepoints;
encoding_bytes_t bytes;
encoding_iter_init_t iter_init;
@@ -208,26 +196,14 @@ void Parrot_str_internal_register_encoding_names(PARROT_INTERP)
((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) \
((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_CODEPOINTS_INPLACE(i, src, offset, count, dest) \
- ((src)->encoding)->get_codepoints_inplace((i), (src), (offset), (count), (dest))
#define ENCODING_GET_BYTES(i, src, offset, count) \
((src)->encoding)->get_bytes((i), (src), (offset), (count))
-#define ENCODING_GET_BYTES_INPLACE(i, src, offset, count, dest) \
- ((src)->encoding)->get_bytes_inplace((i), (src), (offset), (count), (dest))
-#define ENCODING_SET_CODEPOINTS(i, src, offset, count, newdata) \
- ((src)->encoding)->set_codepoints((i), (src), (offset), (count), (newdata))
-#define ENCODING_SET_BYTES(i, src, offset, count, newdata) \
- ((src)->encoding)->set_bytes((i), (src), (offset), (count), (newdata))
-#define ENCODING_BECOME_ENCODING(i, src) \
- ((src)->encoding)->become_encoding((i), (src))
#define ENCODING_CODEPOINTS(i, src) \
((src)->encoding)->codepoints((i), (src))
#define ENCODING_BYTES(i, src) \
View
9 include/parrot/io.h
@@ -453,14 +453,17 @@ size_t Parrot_io_peek_buffer(PARROT_INTERP,
FUNC_MODIFIES(*filehandle)
FUNC_MODIFIES(*buf);
+PARROT_WARN_UNUSED_RESULT
size_t Parrot_io_read_buffer(PARROT_INTERP,
ARGMOD(PMC *filehandle),
- ARGIN(STRING **buf))
+ ARGMOD(STRING **buf))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
- FUNC_MODIFIES(*filehandle);
+ FUNC_MODIFIES(*filehandle)
+ FUNC_MODIFIES(*buf);
+PARROT_WARN_UNUSED_RESULT
size_t Parrot_io_readline_buffer(PARROT_INTERP,
ARGMOD(PMC *filehandle),
ARGOUT(STRING **buf))
@@ -646,7 +649,7 @@ INTVAL Parrot_io_is_encoding(PARROT_INTERP,
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
INTVAL Parrot_io_parse_open_flags(PARROT_INTERP,
- ARGIN_NULLOK(STRING *mode_str))
+ ARGIN_NULLOK(const STRING *mode_str))
__attribute__nonnull__(1);
PARROT_EXPORT
View
181 include/parrot/string_funcs.h
@@ -27,48 +27,31 @@
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-STRING * Parrot_str_append(PARROT_INTERP,
- ARGMOD_NULLOK(STRING *a),
- ARGIN_NULLOK(STRING *b))
- __attribute__nonnull__(1)
- FUNC_MODIFIES(*a);
-
-PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
STRING * Parrot_str_bitwise_and(PARROT_INTERP,
ARGIN_NULLOK(const STRING *s1),
- ARGIN_NULLOK(const STRING *s2),
- ARGOUT_NULLOK(STRING **dest))
- __attribute__nonnull__(1)
- FUNC_MODIFIES(*dest);
+ ARGIN_NULLOK(const STRING *s2))
+ __attribute__nonnull__(1);
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
STRING * Parrot_str_bitwise_not(PARROT_INTERP,
- ARGIN_NULLOK(const STRING *s),
- ARGOUT_NULLOK(STRING **dest))
- __attribute__nonnull__(1)
- FUNC_MODIFIES(*dest);
+ ARGIN_NULLOK(const STRING *s))
+ __attribute__nonnull__(1);
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
STRING * Parrot_str_bitwise_or(PARROT_INTERP,
ARGIN_NULLOK(const STRING *s1),
- ARGIN_NULLOK(const STRING *s2),
- ARGOUT_NULLOK(STRING **dest))
- __attribute__nonnull__(1)
- FUNC_MODIFIES(*dest);
+ ARGIN_NULLOK(const STRING *s2))
+ __attribute__nonnull__(1);
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
STRING * Parrot_str_bitwise_xor(PARROT_INTERP,
ARGIN_NULLOK(const STRING *s1),
- ARGIN_NULLOK(const STRING *s2),
- ARGOUT_NULLOK(STRING **dest))
- __attribute__nonnull__(1)
- FUNC_MODIFIES(*dest);
+ ARGIN_NULLOK(const STRING *s2))
+ __attribute__nonnull__(1);
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
@@ -84,21 +67,17 @@ PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
STRING* Parrot_str_change_charset(PARROT_INTERP,
ARGMOD_NULLOK(STRING *src),
- INTVAL charset_nr,
- ARGOUT_NULLOK(STRING *dest))
+ INTVAL charset_nr)
__attribute__nonnull__(1)
- FUNC_MODIFIES(*src)
- FUNC_MODIFIES(*dest);
+ FUNC_MODIFIES(*src);
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
STRING* Parrot_str_change_encoding(PARROT_INTERP,
ARGIN_NULLOK(STRING *src),
- INTVAL encoding_nr,
- ARGOUT_NULLOK(STRING *dest))
- __attribute__nonnull__(1)
- FUNC_MODIFIES(*dest);
+ INTVAL encoding_nr)
+ __attribute__nonnull__(1);
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
@@ -108,12 +87,6 @@ STRING * Parrot_str_chopn(PARROT_INTERP, ARGMOD(STRING *s), INTVAL n)
FUNC_MODIFIES(*s);
PARROT_EXPORT
-void Parrot_str_chopn_inplace(PARROT_INTERP, ARGMOD(STRING *s), INTVAL n)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- FUNC_MODIFIES(*s);
-
-PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
INTVAL Parrot_str_compare(PARROT_INTERP,
ARGIN_NULLOK(const STRING *s1),
@@ -130,8 +103,7 @@ PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
STRING * Parrot_str_concat(PARROT_INTERP,
ARGIN_NULLOK(STRING *a),
- ARGIN_NULLOK(STRING *b),
- UINTVAL Uflags)
+ ARGIN_NULLOK(STRING *b))
__attribute__nonnull__(1);
PARROT_EXPORT
@@ -149,11 +121,6 @@ STRING * Parrot_str_downcase(PARROT_INTERP, ARGIN_NULLOK(const STRING *s))
__attribute__nonnull__(1);
PARROT_EXPORT
-void Parrot_str_downcase_inplace(PARROT_INTERP, ARGMOD_NULLOK(STRING *s))
- __attribute__nonnull__(1)
- FUNC_MODIFIES(*s);
-
-PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
INTVAL Parrot_str_equal(PARROT_INTERP,
ARGIN_NULLOK(const STRING *s1),
@@ -264,10 +231,8 @@ STRING* Parrot_str_join(PARROT_INTERP,
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
-INTVAL Parrot_str_length(PARROT_INTERP, ARGMOD(STRING *s))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- FUNC_MODIFIES(*s);
+INTVAL Parrot_str_length(SHIM_INTERP, ARGIN(const STRING *s))
+ __attribute__nonnull__(2);
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
@@ -286,14 +251,6 @@ STRING * Parrot_str_new_constant(PARROT_INTERP, ARGIN(const char *buffer))
__attribute__nonnull__(2);
PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
-STRING * Parrot_str_new_COW(PARROT_INTERP, ARGMOD(STRING *s))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- FUNC_MODIFIES(*s);
-
-PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
PARROT_MALLOC
PARROT_CANNOT_RETURN_NULL
@@ -332,8 +289,7 @@ INTVAL Parrot_str_not_equal(PARROT_INTERP,
__attribute__nonnull__(1);
PARROT_EXPORT
-void Parrot_str_pin(PARROT_INTERP, ARGMOD(STRING *s))
- __attribute__nonnull__(1)
+void Parrot_str_pin(SHIM_INTERP, ARGMOD(STRING *s))
__attribute__nonnull__(2)
FUNC_MODIFIES(*s);
@@ -347,42 +303,15 @@ STRING * Parrot_str_repeat(PARROT_INTERP,
PARROT_EXPORT
PARROT_CAN_RETURN_NULL
+PARROT_WARN_UNUSED_RESULT
STRING * Parrot_str_replace(PARROT_INTERP,
ARGIN(STRING *src),
INTVAL offset,
INTVAL length,
- ARGIN(STRING *rep),
- ARGOUT_NULLOK(STRING **d))
+ ARGIN(STRING *rep))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
- __attribute__nonnull__(5)
- FUNC_MODIFIES(*d);
-
-PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
-STRING * Parrot_str_resize(PARROT_INTERP, ARGMOD(STRING *s), UINTVAL addlen)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- FUNC_MODIFIES(*s);
-
-PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
-STRING * Parrot_str_reuse_COW(SHIM_INTERP,
- ARGMOD(STRING *s),
- ARGOUT(STRING *d))
- __attribute__nonnull__(2)
- __attribute__nonnull__(3)
- FUNC_MODIFIES(*s)
- FUNC_MODIFIES(*d);
-
-PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
-STRING * Parrot_str_set(PARROT_INTERP,
- ARGIN_NULLOK(STRING *dest),
- ARGMOD(STRING *src))
- __attribute__nonnull__(1)
- __attribute__nonnull__(3)
- FUNC_MODIFIES(*src);
+ __attribute__nonnull__(5);
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
@@ -398,11 +327,8 @@ PARROT_WARN_UNUSED_RESULT
STRING * Parrot_str_substr(PARROT_INTERP,
ARGIN_NULLOK(STRING *src),
INTVAL offset,
- INTVAL length,
- ARGOUT_NULLOK(STRING **d),
- int replace_dest)
- __attribute__nonnull__(1)
- FUNC_MODIFIES(*d);
+ INTVAL length)
+ __attribute__nonnull__(1);
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
@@ -411,11 +337,6 @@ STRING * Parrot_str_titlecase(PARROT_INTERP, ARGIN_NULLOK(const STRING *s))
__attribute__nonnull__(1);
PARROT_EXPORT
-void Parrot_str_titlecase_inplace(PARROT_INTERP, ARGMOD_NULLOK(STRING *s))
- __attribute__nonnull__(1)
- FUNC_MODIFIES(*s);
-
-PARROT_EXPORT
PARROT_MALLOC
PARROT_CANNOT_RETURN_NULL
char * Parrot_str_to_cstring(PARROT_INTERP, ARGIN_NULLOK(const STRING *s))
@@ -460,29 +381,12 @@ STRING * Parrot_str_upcase(PARROT_INTERP, ARGIN_NULLOK(const STRING *s))
__attribute__nonnull__(1);
PARROT_EXPORT
-void Parrot_str_upcase_inplace(PARROT_INTERP, ARGMOD_NULLOK(STRING *s))
- __attribute__nonnull__(1)
- FUNC_MODIFIES(*s);
-
-PARROT_EXPORT
-void Parrot_str_write_COW(PARROT_INTERP, ARGMOD(STRING *s))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- FUNC_MODIFIES(*s);
-
-PARROT_EXPORT
PARROT_PURE_FUNCTION
PARROT_CANNOT_RETURN_NULL
const char * Parrot_string_cstring(SHIM_INTERP, ARGIN(const STRING *str))
__attribute__nonnull__(2);
PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_PURE_FUNCTION
-UINTVAL string_capacity(SHIM_INTERP, ARGIN(const STRING *s))
- __attribute__nonnull__(2);
-
-PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
STRING * string_chr(PARROT_INTERP, UINTVAL character)
@@ -546,6 +450,12 @@ char * string_to_cstring_nullable(SHIM_INTERP,
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
+STRING* Parrot_str_clone(PARROT_INTERP, ARGIN(const STRING *s))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CANNOT_RETURN_NULL
STRING * Parrot_str_from_int_base(PARROT_INTERP,
ARGOUT(char *tc),
HUGEINTVAL num,
@@ -565,8 +475,6 @@ STRING* Parrot_str_from_uint(PARROT_INTERP,
__attribute__nonnull__(2)
FUNC_MODIFIES(*tc);
-#define ASSERT_ARGS_Parrot_str_append __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_bitwise_and __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_bitwise_not __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -585,9 +493,6 @@ STRING* Parrot_str_from_uint(PARROT_INTERP,
#define ASSERT_ARGS_Parrot_str_chopn __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(s))
-#define ASSERT_ARGS_Parrot_str_chopn_inplace __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_Parrot_str_compare __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_compose __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -599,8 +504,6 @@ STRING* Parrot_str_from_uint(PARROT_INTERP,
, PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_Parrot_str_downcase __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_str_downcase_inplace __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_equal __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_escape __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -638,16 +541,12 @@ STRING* Parrot_str_from_uint(PARROT_INTERP,
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(ar))
#define ASSERT_ARGS_Parrot_str_length __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(s))
+ PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_Parrot_str_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_new_constant __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(buffer))
-#define ASSERT_ARGS_Parrot_str_new_COW __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_Parrot_str_new_from_buffer __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(buffer))
@@ -660,32 +559,20 @@ STRING* Parrot_str_from_uint(PARROT_INTERP,
#define ASSERT_ARGS_Parrot_str_not_equal __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_pin __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(s))
+ PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_Parrot_str_repeat __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_Parrot_str_replace __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src) \
, PARROT_ASSERT_ARG(rep))
-#define ASSERT_ARGS_Parrot_str_resize __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(s))
-#define ASSERT_ARGS_Parrot_str_reuse_COW __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(s) \
- , PARROT_ASSERT_ARG(d))
-#define ASSERT_ARGS_Parrot_str_set __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(src))
#define ASSERT_ARGS_Parrot_str_split __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_substr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_titlecase __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_str_titlecase_inplace __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_to_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_to_hashval __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -703,15 +590,8 @@ STRING* Parrot_str_from_uint(PARROT_INTERP,
, PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_Parrot_str_upcase __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_str_upcase_inplace __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_str_write_COW __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_Parrot_string_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(str))
-#define ASSERT_ARGS_string_capacity __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_string_chr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_string_increment __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -730,6 +610,9 @@ STRING* Parrot_str_from_uint(PARROT_INTERP,
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_string_to_cstring_nullable __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_Parrot_str_clone __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_Parrot_str_from_int_base __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(tc))
View
5 include/parrot/string_primitives.h
@@ -36,12 +36,11 @@ void string_set_data_directory(PARROT_INTERP, ARGIN(const char *dir))
PARROT_EXPORT
Parrot_UInt4 string_unescape_one(PARROT_INTERP,
ARGMOD(UINTVAL *offset),
- ARGMOD(STRING *string))
+ ARGIN(const STRING *string))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
- FUNC_MODIFIES(*offset)
- FUNC_MODIFIES(*string);
+ FUNC_MODIFIES(*offset);
#define ASSERT_ARGS_Parrot_char_digit_value __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_str_dup_remove_quotes __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
View
2 lib/Parrot/Configure/Options/Test/Prepare.pm
@@ -78,6 +78,8 @@ sub _find_steps_tests {
? qq|$secondlevel-$number|
: $number;
$steps_tests_complex{$category}{$class}{$final}++;
+
+ return;
}
} # END wanted()
finddepth( \&wanted, ( $steps_dir ) );
View
10 lib/Parrot/Distribution.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2004-2009, Parrot Foundation.
+# Copyright (C) 2004-2010, Parrot Foundation.
# $Id$
=head1 NAME
@@ -248,13 +248,13 @@ BEGIN {
# and make a hash out of the directories
my %dirs =
map { ( ( File::Spec->splitpath($_) )[1] => 1 ) }
- grep { m|(?i)(?:$filter_ext)| } $self->_dist_files;
+ grep { m/(?i)(?:$filter_ext)/ } $self->_dist_files;
# Filter out ignored directories
# and return the results
my @dirs = sort
map { $self->directory_with_name($_) }
- grep { !m|(?:$filter_dir)| }
+ grep { !m/(?:$filter_dir)/ }
keys %dirs;
return @dirs;
};
@@ -293,7 +293,7 @@ BEGIN {
# and return a sorted list of filenames
my @files = sort
map { $self->file_with_name($_) }
- grep { m|(?i)(?:$filter_ext)| }
+ grep { m/(?i)(?:$filter_ext)/ }
$self->_dist_files;
return @files;
};
@@ -334,7 +334,7 @@ sub get_make_language_files {
# and return a sorted list of filenames
my @files = sort
map { $self->file_with_name($_) }
- grep { m|[/\\]makefiles[/\\][a-z]+\.in$| }
+ grep { m{[/\\]makefiles[/\\][a-z]+\.in$} }
$self->_dist_files;
return @files;
}
View
2 lib/Parrot/Pmc2c/PMCEmitter.pm
@@ -570,7 +570,7 @@ EOC
vt->base_type = entry;
vt->whoami = string_make(interp, "$classname", @{[length($classname)]},
"ascii", PObj_constant_FLAG|PObj_external_FLAG);
- vt->provides_str = Parrot_str_append(interp, vt->provides_str,
+ vt->provides_str = Parrot_str_concat(interp, vt->provides_str,
string_make(interp, "$provides", @{[length($provides)]}, "ascii",
PObj_constant_FLAG|PObj_external_FLAG));
View
8 src/call/args.c
@@ -364,9 +364,7 @@ Parrot_pcc_build_sig_object_from_op(PARROT_INTERP, ARGIN_NULLOK(PMC *signature),
{
STRING *string_value;
if (constant)
- /* ensure that callees don't modify constant caller strings */
- string_value = Parrot_str_new_COW(interp,
- Parrot_pcc_get_string_constant(interp, ctx, raw_index));
+ string_value = Parrot_pcc_get_string_constant(interp, ctx, raw_index);
else
string_value = CTX_REG_STR(ctx, raw_index);
@@ -456,10 +454,8 @@ extract_named_arg_from_op(PARROT_INTERP, ARGMOD(PMC *call_object), ARGIN(STRING
break;
case PARROT_ARG_STRING:
if (constant)
- /* ensure that callees don't modify constant caller strings */
VTABLE_set_string_keyed_str(interp, call_object, name,
- Parrot_str_new_COW(interp,
- Parrot_pcc_get_string_constant(interp, ctx, raw_index)));
+ Parrot_pcc_get_string_constant(interp, ctx, raw_index));
else
VTABLE_set_string_keyed_str(interp, call_object, name,
CTX_REG_STR(ctx, raw_index));
View
4 src/dynext.c
@@ -294,7 +294,7 @@ get_path(PARROT_INTERP, ARGMOD_NULLOK(STRING *lib), Parrot_dlopen_flags flags,
for (i = 0; i < n; ++i) {
ext = VTABLE_get_string_keyed_int(interp, share_ext, i);
- full_name = Parrot_str_concat(interp, wo_ext, ext, 0);
+ full_name = Parrot_str_concat(interp, wo_ext, ext);
path = Parrot_locate_runtime_file_str(interp, full_name,
PARROT_RUNTIME_FT_DYNEXT);
if (path) {
@@ -350,7 +350,7 @@ get_path(PARROT_INTERP, ARGMOD_NULLOK(STRING *lib), Parrot_dlopen_flags flags,
/* And on cygwin replace a leading "lib" by "cyg". */
#ifdef __CYGWIN__
if (!STRING_IS_EMPTY(lib) && memcmp(lib->strstart, "lib", 3) == 0) {
- path = Parrot_str_append(interp, CONST_STRING(interp, "cyg"),
+ path = Parrot_str_concat(interp, CONST_STRING(interp, "cyg"),
Parrot_str_substr(interp, lib, 3, lib->strlen - 3, NULL, 0));
*handle = dlopen_string(interp, flags, path);
View
17 src/hash.c
@@ -183,7 +183,8 @@ STRING_compare(PARROT_INTERP, ARGIN(const void *search_key), ARGIN_NULLOK(const
return 1;
/* COWed strings */
- if (Buffer_bufstart(s1) == Buffer_bufstart(s2) && s1->bufused == s2->bufused)
+ if (Buffer_bufstart(s1) == Buffer_bufstart(s2)
+ && s1->bufused == s2->bufused)
return 0;
return CHARSET_COMPARE(interp, s1, s2);
@@ -1323,13 +1324,14 @@ parrot_hash_put(PARROT_INTERP, ARGMOD(Hash *hash),
/* When the hash is constant, check that the key and value are also
* constant. */
if (!PMC_IS_NULL(hash->container)
- && PObj_constant_TEST(hash->container)) {
+ && PObj_constant_TEST(hash->container)) {
if (hash->key_type == Hash_key_type_STRING
- && !PObj_constant_TEST((PObj *)key))
+ && !PObj_constant_TEST((PObj *)key))
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
"Used non-constant key in constant hash.");
- if (((hash->entry_type == enum_type_PMC) || (hash->entry_type == enum_type_STRING))
- && !PObj_constant_TEST((PObj *)value))
+ if (((hash->entry_type == enum_type_PMC)
+ || (hash->entry_type == enum_type_STRING))
+ && !PObj_constant_TEST((PObj *)value))
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
"Used non-constant value in constant hash.");
}
@@ -1434,7 +1436,7 @@ parrot_hash_clone(PARROT_INTERP, ARGIN(const Hash *hash), ARGOUT(Hash *dest))
break;
case enum_type_STRING:
- valtmp = (void *)Parrot_str_copy(interp, (STRING *)b->value);
+ valtmp = b->value;
break;
case enum_type_PMC:
@@ -1450,9 +1452,8 @@ parrot_hash_clone(PARROT_INTERP, ARGIN(const Hash *hash), ARGOUT(Hash *dest))
"hash corruption: type = %d\n", hash->entry_type);
};
- if (key){
+ if (key)
parrot_hash_put(interp, dest, key, valtmp);
- }
}
}
View
4 src/hll.c
@@ -521,11 +521,11 @@ Parrot_regenerate_HLL_namespaces(PARROT_INTERP)
if (PMC_IS_NULL(ns_hash) ||
ns_hash->vtable->base_type == enum_class_Undef)
{
- STRING * const hll_name = Parrot_get_HLL_name(interp, hll_id);
+ STRING * hll_name = Parrot_get_HLL_name(interp, hll_id);
if (!hll_name)
continue;
- Parrot_str_downcase_inplace(interp, hll_name);
+ hll_name = Parrot_str_downcase(interp, hll_name);
/* XXX as in Parrot_register_HLL() this needs to be fixed to use
* the correct type of namespace. It's relatively easy to do that
View
8 src/io/api.c
@@ -366,7 +366,7 @@ Parrot_io_reads(PARROT_INTERP, ARGMOD(PMC *pmc), size_t length)
"Cannot read from a closed filehandle");
if (length == 0)
- result = Parrot_str_copy(interp, string_orig);
+ result = string_orig;
else {
INTVAL read_length = length;
const INTVAL orig_length = Parrot_str_byte_length(interp, string_orig);
@@ -377,8 +377,7 @@ Parrot_io_reads(PARROT_INTERP, ARGMOD(PMC *pmc), size_t length)
if (offset + read_length > orig_length)
read_length = orig_length - offset;
- result = Parrot_str_substr(interp, string_orig, offset,
- read_length, NULL, 0);
+ result = Parrot_str_substr(interp, string_orig, offset, read_length);
SETATTR_StringHandle_read_offset(interp, pmc, offset + read_length);
}
}
@@ -436,8 +435,7 @@ Parrot_io_readline(PARROT_INTERP, ARGMOD(PMC *pmc))
else
read_length = newline_pos - offset + 1; /* +1 to include the newline */
- result = Parrot_str_substr(interp, result, offset,
- read_length, NULL, 0);
+ result = Parrot_str_substr(interp, result, offset, read_length);
SETATTR_StringHandle_read_offset(interp, pmc, newline_pos + 1);
}
else
View
4 src/io/buffer.c
@@ -266,9 +266,10 @@ The buffer layer's C<Read> function.
*/
+PARROT_WARN_UNUSED_RESULT
size_t
Parrot_io_read_buffer(PARROT_INTERP, ARGMOD(PMC *filehandle),
- ARGIN(STRING **buf))
+ ARGMOD(STRING **buf))
{
ASSERT_ARGS(Parrot_io_read_buffer)
unsigned char *out_buf, *buffer_start, *buffer_next, *buffer_end;
@@ -449,6 +450,7 @@ that is what is required.
*/
+PARROT_WARN_UNUSED_RESULT
size_t
Parrot_io_readline_buffer(PARROT_INTERP, ARGMOD(PMC *filehandle), ARGOUT(STRING **buf))
{
View
5 src/io/filehandle.c
@@ -27,7 +27,8 @@ operating systems. For the primary public I/O API, see F<src/io/api.c>.
=over 4
-=item C<INTVAL Parrot_io_parse_open_flags(PARROT_INTERP, STRING *mode_str)>
+=item C<INTVAL Parrot_io_parse_open_flags(PARROT_INTERP, const STRING
+*mode_str)>
Parses a Parrot string for file open mode flags (C<r> for read, C<w> for write,
C<a> for append, and C<p> for pipe) and returns the combined generic bit flags.
@@ -39,7 +40,7 @@ C<a> for append, and C<p> for pipe) and returns the combined generic bit flags.
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
INTVAL
-Parrot_io_parse_open_flags(PARROT_INTERP, ARGIN_NULLOK(STRING *mode_str))
+Parrot_io_parse_open_flags(PARROT_INTERP, ARGIN_NULLOK(const STRING *mode_str))
{
ASSERT_ARGS(Parrot_io_parse_open_flags)
INTVAL i, mode_len;
View
8 src/io/utf8.c
@@ -83,7 +83,10 @@ Parrot_io_read_utf8(PARROT_INTERP, ARGMOD(PMC *filehandle),
UNUSED(read);
s->strlen = iter.charpos;
- s = Parrot_str_append(interp, s, s2);
+ s = Parrot_str_concat(interp, s, s2);
+ /* String is updated. Poke into iterator to replace old string */
+ iter.str = s;
+ *buf = s;
len += len2 + 1;
/* check last char */
@@ -116,8 +119,7 @@ Parrot_io_write_utf8(PARROT_INTERP, ARGMOD(PMC *filehandle),
if (s->encoding == Parrot_utf8_encoding_ptr)
return Parrot_io_write_buffer(interp, filehandle, s);
- dest = Parrot_utf8_encoding_ptr->to_encoding(interp, s,
- Parrot_gc_new_string_header(interp, 0));
+ dest = Parrot_utf8_encoding_ptr->to_encoding(interp, s);
return Parrot_io_write_buffer(interp, filehandle, dest);
}
View
4 src/io/win32.c
@@ -660,8 +660,8 @@ Parrot_io_open_pipe_win32(PARROT_INTERP, ARGMOD(PMC *filehandle),
if (comspec == NULL)
comspec = "cmd";
auxcomm = Parrot_str_new(interp, comspec, 0);
- auxcomm = Parrot_str_append(interp, auxcomm, Parrot_str_new(interp, " /c ", 0));
- auxcomm = Parrot_str_append(interp, auxcomm, command);
+ auxcomm = Parrot_str_concat(interp, auxcomm, Parrot_str_new(interp, " /c ", 0));
+ auxcomm = Parrot_str_concat(interp, auxcomm, command);
cmd = Parrot_str_to_cstring(interp, auxcomm);
start.cb = sizeof start;
GetStartupInfo(&start);
View
40 src/key.c
@@ -444,8 +444,6 @@ key_string(PARROT_INTERP, ARGIN(PMC *key))
{
STRING *s;
GETATTR_Key_str_key(interp, key, s);
- if (s)
- s = Parrot_str_new_COW(interp, s);
return s;
}
case KEY_string_FLAG | KEY_register_FLAG:
@@ -652,65 +650,65 @@ key_set_to_string(PARROT_INTERP, ARGIN_NULLOK(PMC *key))
switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
case KEY_integer_FLAG:
GETATTR_Key_int_key(interp, key, int_key);
- value = Parrot_str_append(interp, value,
- Parrot_str_from_int(interp, int_key));
+ value = Parrot_str_concat(interp, value,
+ Parrot_str_from_int(interp, int_key));
break;
case KEY_number_FLAG:
GETATTR_Key_int_key(interp, key, int_key);
- value = Parrot_str_append(interp, value,
- Parrot_str_from_num(interp, (FLOATVAL)int_key));
+ value = Parrot_str_concat(interp, value,
+ Parrot_str_from_num(interp, (FLOATVAL)int_key));
break;
case KEY_string_FLAG:
GETATTR_Key_str_key(interp, key, str_key);
- value = Parrot_str_append(interp, value, quote);
- value = Parrot_str_append(interp, value, str_key);
- value = Parrot_str_append(interp, value, quote);
+ value = Parrot_str_concat(interp, value, quote);
+ value = Parrot_str_concat(interp, value, str_key);
+ value = Parrot_str_concat(interp, value, quote);
break;
case KEY_pmc_FLAG:
- value = Parrot_str_append(interp, value,
- VTABLE_get_string(interp, key));
+ value = Parrot_str_concat(interp, value,
+ VTABLE_get_string(interp, key));
break;
case KEY_integer_FLAG | KEY_register_FLAG:
GETATTR_Key_int_key(interp, key, int_key);
- value = Parrot_str_append(interp, value,
+ value = Parrot_str_concat(interp, value,
Parrot_str_from_int(interp,
REG_INT(interp, int_key)));
break;
case KEY_number_FLAG | KEY_register_FLAG:
GETATTR_Key_int_key(interp, key, int_key);
- value = Parrot_str_append(interp, value,
+ value = Parrot_str_concat(interp, value,
Parrot_str_from_num(interp,
REG_NUM(interp, int_key)));
break;
case KEY_string_FLAG | KEY_register_FLAG:
- value = Parrot_str_append(interp, value, quote);
+ value = Parrot_str_concat(interp, value, quote);
GETATTR_Key_int_key(interp, key, int_key);
- value = Parrot_str_append(interp, value,
+ value = Parrot_str_concat(interp, value,
REG_STR(interp, int_key));
- value = Parrot_str_append(interp, value, quote);
+ value = Parrot_str_concat(interp, value, quote);
break;
case KEY_pmc_FLAG | KEY_register_FLAG:
{
PMC *reg;
GETATTR_Key_int_key(interp, key, int_key);
reg = REG_PMC(interp, int_key);
- value = Parrot_str_append(interp, value,
- VTABLE_get_string(interp, reg));
+ value = Parrot_str_concat(interp, value,
+ VTABLE_get_string(interp, reg));
}
break;
default:
- value = Parrot_str_append(interp, value, CONST_STRING(interp, "Key type unknown"));
+ value = Parrot_str_concat(interp, value, CONST_STRING(interp, "Key type unknown"));
break;
}
GETATTR_Key_next_key(interp, key, next_key);
if (next_key)
- value = Parrot_str_append(interp, value, semicolon);
+ value = Parrot_str_concat(interp, value, semicolon);
GETATTR_Key_next_key(interp, key, key);
}
- value = Parrot_str_append(interp, value, Parrot_str_new(interp, " ]", 2));
+ value = Parrot_str_concat(interp, value, Parrot_str_new(interp, " ]", 2));
return value;
}
View
68 src/library.c
@@ -181,7 +181,7 @@ parrot_init_library_paths(PARROT_INTERP)
versionlib = VTABLE_get_string_keyed_str(interp, config_hash, libkey);
entry = VTABLE_get_string_keyed_str(interp, config_hash, verkey);
- versionlib = Parrot_str_append(interp, versionlib, entry);
+ versionlib = Parrot_str_concat(interp, versionlib, entry);
if (!VTABLE_get_integer_keyed_str(interp, config_hash, installed))
builddir = VTABLE_get_string_keyed_str(interp,
@@ -202,15 +202,15 @@ parrot_init_library_paths(PARROT_INTERP)
}
}
if (!STRING_IS_NULL(builddir)) {
- entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/"), 0);
+ entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/"));
VTABLE_push_string(interp, paths, entry);
- entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/runtime/parrot/include/"), 0);
+ entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/runtime/parrot/include/"));
VTABLE_push_string(interp, paths, entry);
}
entry = CONST_STRING(interp, "./");
VTABLE_push_string(interp, paths, entry);
if (!STRING_IS_NULL(versionlib)) {
- entry = Parrot_str_concat(interp, versionlib, CONST_STRING(interp, "/include/"), 0);
+ entry = Parrot_str_concat(interp, versionlib, CONST_STRING(interp, "/include/"));
VTABLE_push_string(interp, paths, entry);
}
@@ -227,13 +227,13 @@ parrot_init_library_paths(PARROT_INTERP)
}
}
if (!STRING_IS_NULL(builddir)) {
- entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/runtime/parrot/library/"), 0);
+ entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/runtime/parrot/library/"));
VTABLE_push_string(interp, paths, entry);
}
entry = CONST_STRING(interp, "./");
VTABLE_push_string(interp, paths, entry);
if (!STRING_IS_NULL(versionlib)) {
- entry = Parrot_str_concat(interp, versionlib, CONST_STRING(interp, "/library/"), 0);
+ entry = Parrot_str_concat(interp, versionlib, CONST_STRING(interp, "/library/"));
VTABLE_push_string(interp, paths, entry);
}
@@ -242,13 +242,13 @@ parrot_init_library_paths(PARROT_INTERP)
VTABLE_set_pmc_keyed_int(interp, lib_paths,
PARROT_LIB_PATH_LANG, paths);
if (!STRING_IS_NULL(builddir)) {
- entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/runtime/parrot/languages/"), 0);
+ entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/runtime/parrot/languages/"));
VTABLE_push_string(interp, paths, entry);
}
entry = CONST_STRING(interp, "./");
VTABLE_push_string(interp, paths, entry);
if (!STRING_IS_NULL(versionlib)) {
- entry = Parrot_str_concat(interp, versionlib, CONST_STRING(interp, "/languages/"), 0);
+ entry = Parrot_str_concat(interp, versionlib, CONST_STRING(interp, "/languages/"));
VTABLE_push_string(interp, paths, entry);
}
@@ -257,13 +257,13 @@ parrot_init_library_paths(PARROT_INTERP)
VTABLE_set_pmc_keyed_int(interp, lib_paths,
PARROT_LIB_PATH_DYNEXT, paths);
if (!STRING_IS_NULL(builddir)) {
- entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/runtime/parrot/dynext/"), 0);
+ entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/runtime/parrot/dynext/"));
VTABLE_push_string(interp, paths, entry);
}
entry = CONST_STRING(interp, "dynext/");
VTABLE_push_string(interp, paths, entry);
if (!STRING_IS_NULL(versionlib)) {
- entry = Parrot_str_concat(interp, versionlib, CONST_STRING(interp, "/dynext/"), 0);
+ entry = Parrot_str_concat(interp, versionlib, CONST_STRING(interp, "/dynext/"));
VTABLE_push_string(interp, paths, entry);
}
@@ -419,7 +419,7 @@ path_finalize(PARROT_INTERP, ARGMOD(STRING *path))
STRING * const nul = string_chr(interp, '\0');
- path = Parrot_str_append(interp, path, nul);
+ path = Parrot_str_concat(interp, path, nul);
path->bufused--;
path->strlen--;
@@ -454,7 +454,7 @@ path_guarantee_trailing_separator(PARROT_INTERP, ARGMOD(STRING *path))
/* make sure the path has a trailing slash before appending the file */
if (Parrot_str_indexed(interp, path , path->strlen - 1)
!= Parrot_str_indexed(interp, path_separator_string, 0))
- path = Parrot_str_append(interp, path , path_separator_string);
+ path = Parrot_str_concat(interp, path , path_separator_string);
return path;
}
@@ -479,7 +479,7 @@ path_append(PARROT_INTERP, ARGMOD(STRING *l_path), ARGMOD(STRING *r_path))
{
ASSERT_ARGS(path_append)
l_path = path_guarantee_trailing_separator(interp, l_path);
- l_path = Parrot_str_append(interp, l_path, r_path);
+ l_path = Parrot_str_concat(interp, l_path, r_path);
return l_path;
}
@@ -505,9 +505,9 @@ path_concat(PARROT_INTERP, ARGMOD(STRING *l_path), ARGMOD(STRING *r_path))
ASSERT_ARGS(path_concat)
STRING* join;
- join = Parrot_str_copy(interp, l_path);
+ join = l_path;
join = path_guarantee_trailing_separator(interp, join);
- join = Parrot_str_append(interp, join, r_path);
+ join = Parrot_str_concat(interp, join, r_path);
return join;
}
@@ -532,9 +532,7 @@ try_load_path(PARROT_INTERP, ARGMOD(STRING* path))
ASSERT_ARGS(try_load_path)
STRING *final;
- final = Parrot_str_copy(interp, path);
-
- final = path_finalize(interp, final);
+ final = path_finalize(interp, path);
if (Parrot_stat_info_intval(interp, final, STAT_EXISTS)) {
return final;
@@ -566,7 +564,7 @@ try_bytecode_extensions(PARROT_INTERP, ARGMOD(STRING* path))
STRING * const pir_extension = CONST_STRING(interp, ".pir");
STRING * const pasm_extension = CONST_STRING(interp, ".pasm");
- test_path = Parrot_str_copy(interp, path);
+ test_path = path;
/* First try the path as given. */
result = try_load_path(interp, test_path);
@@ -582,24 +580,24 @@ try_bytecode_extensions(PARROT_INTERP, ARGMOD(STRING* path))
if (!STRING_IS_NULL(test_path)) {
if (Parrot_str_byte_length(interp, test_path) > 4) {
- STRING *orig_ext = Parrot_str_substr(interp, test_path, -4, 4, NULL, 0);
+ STRING *orig_ext = Parrot_str_substr(interp, test_path, -4, 4);
/* First try substituting .pbc for the .pir extension */
if (Parrot_str_equal(interp, orig_ext, pir_extension)) {
STRING * const without_ext = Parrot_str_chopn(interp, test_path, 4);
- test_path = Parrot_str_append(interp, without_ext, bytecode_extension);
+ test_path = Parrot_str_concat(interp, without_ext, bytecode_extension);
result = try_load_path(interp, test_path);
if (result)
return result;
}
/* Next try substituting .pir, then .pasm for the .pbc extension */
else if (Parrot_str_equal(interp, orig_ext, bytecode_extension)) {
STRING * const without_ext = Parrot_str_chopn(interp, test_path, 4);
- test_path = Parrot_str_append(interp, without_ext, pir_extension);
+ test_path = Parrot_str_concat(interp, without_ext, pir_extension);
result = try_load_path(interp, test_path);
if (result)
return result;
- test_path = Parrot_str_append(interp, without_ext, pasm_extension);
+ test_path = Parrot_str_concat(interp, without_ext, pasm_extension);
result = try_load_path(interp, test_path);
if (result)
return result;
@@ -609,10 +607,10 @@ try_bytecode_extensions(PARROT_INTERP, ARGMOD(STRING* path))
/* Finally, try substituting .pbc for the .pasm extension. */
if (Parrot_str_byte_length(interp, test_path) > 5) {
- STRING * const orig_ext = Parrot_str_substr(interp, test_path, -5, 5, NULL, 0);
+ STRING * const orig_ext = Parrot_str_substr(interp, test_path, -5, 5);
if (Parrot_str_equal(interp, orig_ext, pasm_extension)) {
STRING * const without_ext = Parrot_str_chopn(interp, test_path, 5);
- test_path = Parrot_str_append(interp, without_ext, bytecode_extension);
+ test_path = Parrot_str_concat(interp, without_ext, bytecode_extension);
result = try_load_path(interp, test_path);
if (result)
return result;
@@ -717,8 +715,7 @@ Parrot_locate_runtime_file_str(PARROT_INTERP, ARGMOD(STRING *file),
STRING * const path = VTABLE_get_string_keyed_int(interp, paths, i);
STRING *found_name;
- full_name = Parrot_str_copy(interp, path);
- full_name = path_append(interp, full_name, file);
+ full_name = path_append(interp, path, file);
found_name =
(type & PARROT_RUNTIME_FT_DYNEXT)
@@ -917,23 +914,22 @@ parrot_split_path_ext(PARROT_INTERP, ARGMOD(STRING *in),
++pos_dot;
++pos_sl;
if (pos_sl && pos_dot) {
- stem = Parrot_str_substr(interp, in, pos_sl, pos_dot - pos_sl - 1,
- NULL, 0);
- *wo_ext = Parrot_str_substr(interp, in, 0, pos_dot - 1, NULL, 0);
- *ext = Parrot_str_substr(interp, in, pos_dot, len - pos_dot, NULL, 0);
+ stem = Parrot_str_substr(interp, in, pos_sl, pos_dot - pos_sl - 1);
+ *wo_ext = Parrot_str_substr(interp, in, 0, pos_dot - 1);
+ *ext = Parrot_str_substr(interp, in, pos_dot, len - pos_dot);
}
else if (pos_dot) {
- stem = Parrot_str_substr(interp, in, 0, pos_dot - 1, NULL, 0);
+ stem = Parrot_str_substr(interp, in, 0, pos_dot - 1);
*wo_ext = stem;
- *ext = Parrot_str_substr(interp, in, pos_dot, len - pos_dot, NULL, 0);
+ *ext = Parrot_str_substr(interp, in, pos_dot, len - pos_dot);
}
else if (pos_sl) {
- stem = Parrot_str_substr(interp, in, pos_sl, len - pos_sl, NULL, 0);
- *wo_ext = Parrot_str_copy(interp, in);
+ stem = Parrot_str_substr(interp, in, pos_sl, len - pos_sl);
+ *wo_ext = in;
*ext = NULL;
}
else {
- stem = Parrot_str_copy(interp, in);
+ stem = in;
*wo_ext = stem;
*ext = NULL;
}
View
52 src/ops/bit.ops
@@ -109,37 +109,37 @@ from $2 and $3.
=cut
-inline op bands(inout STR, in STR) :base_core {
- Parrot_str_bitwise_and(interp, $1, $2, &$1);
+inline op bands(inout STR, in STR) :base_core :deprecated {
+ $1 = Parrot_str_bitwise_and(interp, $1, $2);
}
inline op bands(invar PMC, in STR) :base_core {
STRING * const a = VTABLE_get_string(interp, $1);
- STRING * const b = Parrot_str_bitwise_and(interp, a, $2, NULL);
+ STRING * const b = Parrot_str_bitwise_and(interp, a, $2);
VTABLE_set_string_native(interp, $1, b);
}
inline op bands(invar PMC, invar PMC) :base_core {
STRING * a = VTABLE_get_string(interp, $1);
STRING * const b = VTABLE_get_string(interp, $2);
- a = Parrot_str_bitwise_and(interp, a, b, NULL);
+ a = Parrot_str_bitwise_and(interp, a, b);
VTABLE_set_string_native(interp, $1, a);
}
inline op bands(out STR, in STR, in STR) :base_core {
- $1 = Parrot_str_bitwise_and(interp, $2, $3, NULL);
+ $1 = Parrot_str_bitwise_and(interp, $2, $3);
}
inline op bands(invar PMC, invar PMC, in STR) :base_core {
STRING * const a = VTABLE_get_string(interp, $2);
- STRING * const b = Parrot_str_bitwise_and(interp, a, $3, NULL);
+ STRING * const b = Parrot_str_bitwise_and(interp, a, $3);
VTABLE_set_string_native(interp, $1, b);
}
inline op bands(invar PMC, invar PMC, invar PMC) :base_core {
STRING * const a = VTABLE_get_string(interp, $2);
STRING * const b = VTABLE_get_string(interp, $3);
- STRING * const c = Parrot_str_bitwise_and(interp, a, b, NULL);
+ STRING * const c = Parrot_str_bitwise_and(interp, a, b);
VTABLE_set_string_native(interp, $1, c);
}
@@ -187,23 +187,23 @@ inline op bnot(out PMC, invar PMC) :base_core {
=cut
-inline op bnots(inout STR) :base_core {
- Parrot_str_bitwise_not(interp, $1, &$1);
+inline op bnots(inout STR) :base_core :deprecated {
+ $1 = Parrot_str_bitwise_not(interp, $1);
}
inline op bnots(out STR, in STR) :base_core {
- Parrot_str_bitwise_not(interp, $2, &$1);
+ $1 = Parrot_str_bitwise_not(interp, $2);
}
inline op bnots(invar PMC) :base_core {
STRING * const a = VTABLE_get_string(interp, $1);
- STRING * const b = Parrot_str_bitwise_not(interp, a, NULL);
+ STRING * const b = Parrot_str_bitwise_not(interp, a);
VTABLE_set_string_native(interp, $1, b);
}
inline op bnots(out PMC, invar PMC) :base_core {
STRING * const a = VTABLE_get_string(interp, $2);
- STRING * const b = Parrot_str_bitwise_not(interp, a, NULL);
+ STRING * const b = Parrot_str_bitwise_not(interp, a);
VTABLE_set_string_native(interp, $1, b);
}
@@ -279,37 +279,37 @@ from $2 and $3.
=cut
-inline op bors(inout STR, in STR) :base_core {
- Parrot_str_bitwise_or(interp, $1, $2, &$1);
+inline op bors(inout STR, in STR) :base_core :deprecated {
+ $1 = Parrot_str_bitwise_or(interp, $1, $2);
}
inline op bors(invar PMC, in STR) :base_core {
STRING * const a = VTABLE_get_string(interp, $1);
- STRING * const b = Parrot_str_bitwise_or(interp, a, $2, NULL);
+ STRING * const b = Parrot_str_bitwise_or(interp, a, $2);
VTABLE_set_string_native(interp, $1, b);
}
inline op bors(invar PMC, invar PMC) :base_core {
STRING * const a = VTABLE_get_string(interp, $1);
STRING * const b = VTABLE_get_string(interp, $2);
- STRING * const c = Parrot_str_bitwise_or(interp, a, b, NULL);
+ STRING * const c = Parrot_str_bitwise_or(interp, a, b);
VTABLE_set_string_native(interp, $1, c);
}
inline op bors(out STR, in STR, in STR) :base_core {
- $1 = Parrot_str_bitwise_or(interp, $2, $3, NULL);
+ $1 = Parrot_str_bitwise_or(interp, $2, $3);
}
inline op bors(invar PMC, invar PMC, in STR) :base_core {
STRING * const b = VTABLE_get_string(interp, $2);
- STRING * const c = Parrot_str_bitwise_or(interp, b, $3, NULL);
+ STRING * const c = Parrot_str_bitwise_or(interp, b, $3);
VTABLE_set_string_native(interp, $1, c);
}
inline op bors(invar PMC, invar PMC, invar PMC) :base_core {
STRING * const a = VTABLE_get_string(interp, $2);
STRING * const b = VTABLE_get_string(interp, $3);
- STRING * const c = Parrot_str_bitwise_or(interp, a, b, NULL);
+ STRING * const c = Parrot_str_bitwise_or(interp, a, b);
VTABLE_set_string_native(interp, $1, c);
}
@@ -579,37 +579,37 @@ from $2 and $3.
=cut
-inline op bxors(inout STR, in STR) :base_core {
- Parrot_str_bitwise_xor(interp, $1, $2, &$1);
+inline op bxors(inout STR, in STR) :base_core :deprecated {
+ $1 = Parrot_str_bitwise_xor(interp, $1, $2);
}
inline op bxors(invar PMC, in STR) :base_core {
STRING * const a = VTABLE_get_string(interp, $1);
- STRING * const b = Parrot_str_bitwise_xor(interp, a, $2, NULL);
+ STRING * const b = Parrot_str_bitwise_xor(interp, a, $2);
VTABLE_set_string_native(interp, $1, b);
}
inline op bxors(invar PMC, invar PMC) :base_core {
STRING * const a = VTABLE_get_string(interp, $1);
STRING * const b = VTABLE_get_string(interp, $2);
- STRING * const c = Parrot_str_bitwise_xor(interp, a, b, NULL);
+ STRING * const c = Parrot_str_bitwise_xor(interp, a, b);
VTABLE_set_string_native(interp, $1, c);
}
inline op bxors(out STR, in STR, in STR) :base_core {
- $1 = Parrot_str_bitwise_xor(interp, $2, $3, NULL);
+ $1 = Parrot_str_bitwise_xor(interp, $2, $3);
}
inline op bxors(invar PMC, invar PMC, in STR) :base_core {
STRING * const a = VTABLE_get_string(interp, $2);
- STRING * const b = Parrot_str_bitwise_xor(interp, a, $3, NULL);
+ STRING * const b = Parrot_str_bitwise_xor(interp, a, $3);
VTABLE_set_string_native(interp, $1, b);
}
inline op bxors(invar PMC, invar PMC, invar PMC) :base_core {
STRING * const a = VTABLE_get_string(interp, $2);
STRING * const b = VTABLE_get_string(interp, $3);
- STRING * const c = Parrot_str_bitwise_xor(interp, a, b, NULL);
+ STRING * const c = Parrot_str_bitwise_xor(interp, a, b);
VTABLE_set_string_native(interp, $1, c);
}
View
396 src/ops/ops.num
@@ -1087,193 +1087,209 @@ substr_s_p_i_i 1062
substr_s_p_ic_i 1063
substr_s_p_i_ic 1064
substr_s_p_ic_ic 1065
-index_i_s_s 1066
-index_i_sc_s 1067
-index_i_s_sc 1068
-index_i_sc_sc 1069
-index_i_s_s_i 1070
-index_i_sc_s_i 1071
-index_i_s_sc_i 1072
-index_i_sc_sc_i 1073
-index_i_s_s_ic 1074
-index_i_sc_s_ic 1075
-index_i_s_sc_ic 1076
-index_i_sc_sc_ic 1077
-sprintf_s_s_p 1078
-sprintf_s_sc_p 1079
-sprintf_p_p_p 1080
-new_s 1081
-new_s_i 1082
-new_s_ic 1083
-stringinfo_i_s_i 1084
-stringinfo_i_sc_i 1085
-stringinfo_i_s_ic 1086
-stringinfo_i_sc_ic 1087
-upcase_s_s 1088
-upcase_s_sc 1089
-upcase_s 1090
-downcase_s_s 1091
-downcase_s_sc 1092
-downcase_s 1093
-titlecase_s_s 1094
-titlecase_s_sc 1095
-titlecase_s 1096
-join_s_s_p 1097
-join_s_sc_p 1098
-split_p_s_s 1099
-split_p_sc_s 1100
-split_p_s_sc 1101
-split_p_sc_sc 1102
-charset_i_s 1103
-charset_i_sc 1104
-charsetname_s_i 1105
-charsetname_s_ic 1106
-find_charset_i_s 1107
-find_charset_i_sc 1108
-trans_charset_s_i 1109
-trans_charset_s_ic 1110
-trans_charset_s_s_i 1111
-trans_charset_s_sc_i 1112
-trans_charset_s_s_ic 1113
-trans_charset_s_sc_ic 1114
-encoding_i_s 1115
-encoding_i_sc 1116
-encodingname_s_i 1117
-encodingname_s_ic 1118
-find_encoding_i_s 1119
-find_encoding_i_sc 1120
-trans_encoding_s_i 1121
-trans_encoding_s_ic 1122
-trans_encoding_s_s_i 1123
-trans_encoding_s_sc_i 1124
-trans_encoding_s_s_ic 1125
-trans_encoding_s_sc_ic 1126
-is_cclass_i_i_s_i 1127
-is_cclass_i_ic_s_i 1128
-is_cclass_i_i_sc_i 1129
-is_cclass_i_ic_sc_i 1130
-is_cclass_i_i_s_ic 1131
-is_cclass_i_ic_s_ic 1132
-is_cclass_i_i_sc_ic 1133
-is_cclass_i_ic_sc_ic 1134
-find_cclass_i_i_s_i_i 1135
-find_cclass_i_ic_s_i_i 1136
-find_cclass_i_i_sc_i_i 1137
-find_cclass_i_ic_sc_i_i 1138
-find_cclass_i_i_s_ic_i 1139
-find_cclass_i_ic_s_ic_i 1140
-find_cclass_i_i_sc_ic_i 1141
-find_cclass_i_ic_sc_ic_i 1142
-find_cclass_i_i_s_i_ic 1143
-find_cclass_i_ic_s_i_ic 1144
-find_cclass_i_i_sc_i_ic 1145
-find_cclass_i_ic_sc_i_ic 1146
-find_cclass_i_i_s_ic_ic 1147
-find_cclass_i_ic_s_ic_ic 1148
-find_cclass_i_i_sc_ic_ic 1149
-find_cclass_i_ic_sc_ic_ic 1150
-find_not_cclass_i_i_s_i_i 1151
-find_not_cclass_i_ic_s_i_i 1152
-find_not_cclass_i_i_sc_i_i 1153
-find_not_cclass_i_ic_sc_i_i 1154
-find_not_cclass_i_i_s_ic_i 1155
-find_not_cclass_i_ic_s_ic_i 1156
-find_not_cclass_i_i_sc_ic_i 1157
-find_not_cclass_i_ic_sc_ic_i 1158
-find_not_cclass_i_i_s_i_ic 1159
-find_not_cclass_i_ic_s_i_ic 1160
-find_not_cclass_i_i_sc_i_ic 1161
-find_not_cclass_i_ic_sc_i_ic 1162
-find_not_cclass_i_i_s_ic_ic 1163
-find_not_cclass_i_ic_s_ic_ic 1164
-find_not_cclass_i_i_sc_ic_ic 1165
-find_not_cclass_i_ic_sc_ic_ic 1166
-escape_s_s 1167
-compose_s_s 1168
-compose_s_sc 1169
-spawnw_i_s 1170
-spawnw_i_sc 1171
-spawnw_i_p 1172
-err_i 1173
-err_s 1174
-err_s_i 1175
-err_s_ic 1176
-time_i 1177
-time_n 1178
-gmtime_s_i 1179
-gmtime_s_ic 1180
-localtime_s_i 1181
-localtime_s_ic 1182
-decodetime_p_i 1183
-decodetime_p_ic 1184
-decodelocaltime_p_i 1185
-decodelocaltime_p_ic 1186
-sysinfo_s_i 1187
-sysinfo_s_ic 1188
-sysinfo_i_i 1189
-sysinfo_i_ic 1190
-sleep_i 1191
-sleep_ic 1192
-sleep_n 1193
-sleep_nc 1194
-sizeof_i_i 1195
-sizeof_i_ic 1196
-store_lex_s_p 1197
-store_lex_sc_p 1198
-store_dynamic_lex_s_p 1199
-store_dynamic_lex_sc_p 1200
-find_lex_p_s 1201
-find_lex_p_sc 1202
-find_dynamic_lex_p_s 1203
-find_dynamic_lex_p_sc 1204
-find_caller_lex_p_s 1205
-find_caller_lex_p_sc 1206
-get_namespace_p 1207
-get_namespace_p_p 1208
-get_namespace_p_pc 1209
-get_hll_namespace_p 1210
-get_hll_namespace_p_p 1211
-get_hll_namespace_p_pc 1212
-get_root_namespace_p 1213
-get_root_namespace_p_p 1214
-get_root_namespace_p_pc 1215
-get_global_p_s 1216
-get_global_p_sc 1217
-get_global_p_p_s 1218
-get_global_p_pc_s 1219
-get_global_p_p_sc 1220
-get_global_p_pc_sc 1221
-get_hll_global_p_s 1222
-get_hll_global_p_sc 1223
-get_hll_global_p_p_s 1224
-get_hll_global_p_pc_s 1225
-get_hll_global_p_p_sc 1226
-get_hll_global_p_pc_sc 1227
-get_root_global_p_s 1228
-get_root_global_p_sc 1229
-get_root_global_p_p_s 1230
-get_root_global_p_pc_s 1231
-get_root_global_p_p_sc 1232
-get_root_global_p_pc_sc 1233
-set_global_s_p 1234
-set_global_sc_p 1235
-set_global_p_s_p 1236
-set_global_pc_s_p 1237
-set_global_p_sc_p 1238
-set_global_pc_sc_p 1239
-set_hll_global_s_p 1240
-set_hll_global_sc_p 1241
-set_hll_global_p_s_p 1242
-set_hll_global_pc_s_p 1243
-set_hll_global_p_sc_p 1244
-set_hll_global_pc_sc_p 1245
-set_root_global_s_p 1246
-set_root_global_sc_p 1247
-set_root_global_p_s_p 1248
-set_root_global_pc_s_p 1249
-set_root_global_p_sc_p 1250
-set_root_global_pc_sc_p 1251
-find_name_p_s 1252
-find_name_p_sc 1253
-find_sub_not_null_p_s 1254
-find_sub_not_null_p_sc 1255
+replace_s_s_i_i_s 1066
+replace_s_sc_i_i_s 1067
+replace_s_s_ic_i_s 1068
+replace_s_sc_ic_i_s 1069
+replace_s_s_i_ic_s 1070
+replace_s_sc_i_ic_s 1071
+replace_s_s_ic_ic_s 1072
+replace_s_sc_ic_ic_s 1073
+replace_s_s_i_i_sc 1074
+replace_s_sc_i_i_sc 1075
+replace_s_s_ic_i_sc 1076
+replace_s_sc_ic_i_sc 1077
+replace_s_s_i_ic_sc 1078
+replace_s_sc_i_ic_sc 1079
+replace_s_s_ic_ic_sc 1080
+replace_s_sc_ic_ic_sc 1081
+index_i_s_s 1082
+index_i_sc_s 1083
+index_i_s_sc 1084
+index_i_sc_sc 1085
+index_i_s_s_i 1086
+index_i_sc_s_i 1087
+index_i_s_sc_i 1088
+index_i_sc_sc_i 1089
+index_i_s_s_ic 1090
+index_i_sc_s_ic 1091
+index_i_s_sc_ic 1092
+index_i_sc_sc_ic 1093
+sprintf_s_s_p 1094
+sprintf_s_sc_p 1095
+sprintf_p_p_p 1096
+new_s 1097
+new_s_i 1098
+new_s_ic 1099
+stringinfo_i_s_i 1100
+stringinfo_i_sc_i 1101
+stringinfo_i_s_ic 1102
+stringinfo_i_sc_ic 1103
+upcase_s_s 1104
+upcase_s_sc 1105
+upcase_s 1106
+downcase_s_s 1107
+downcase_s_sc 1108
+downcase_s 1109
+titlecase_s_s 1110
+titlecase_s_sc 1111
+titlecase_s 1112
+join_s_s_p 1113
+join_s_sc_p 1114
+split_p_s_s 1115
+split_p_sc_s 1116
+split_p_s_sc 1117
+split_p_sc_sc 1118
+charset_i_s 1119
+charset_i_sc 1120
+charsetname_s_i 1121
+charsetname_s_ic 1122
+find_charset_i_s 1123
+find_charset_i_sc 1124
+trans_charset_s_i 1125
+trans_charset_s_ic 1126
+trans_charset_s_s_i 1127
+trans_charset_s_sc_i 1128
+trans_charset_s_s_ic 1129
+trans_charset_s_sc_ic 1130
+encoding_i_s 1131
+encoding_i_sc 1132
+encodingname_s_i 1133
+encodingname_s_ic 1134
+find_encoding_i_s 1135
+find_encoding_i_sc 1136
+trans_encoding_s_i 1137
+trans_encoding_s_ic 1138
+trans_encoding_s_s_i 1139
+trans_encoding_s_sc_i 1140
+trans_encoding_s_s_ic 1141
+trans_encoding_s_sc_ic 1142
+is_cclass_i_i_s_i 1143
+is_cclass_i_ic_s_i 1144
+is_cclass_i_i_sc_i 1145
+is_cclass_i_ic_sc_i 1146
+is_cclass_i_i_s_ic 1147
+is_cclass_i_ic_s_ic 1148
+is_cclass_i_i_sc_ic 1149
+is_cclass_i_ic_sc_ic 1150
+find_cclass_i_i_s_i_i 1151
+find_cclass_i_ic_s_i_i 1152
+find_cclass_i_i_sc_i_i 1153
+find_cclass_i_ic_sc_i_i 1154
+find_cclass_i_i_s_ic_i 1155
+find_cclass_i_ic_s_ic_i 1156
+find_cclass_i_i_sc_ic_i 1157
+find_cclass_i_ic_sc_ic_i 1158
+find_cclass_i_i_s_i_ic 1159
+find_cclass_i_ic_s_i_ic 1160
+find_cclass_i_i_sc_i_ic 1161
+find_cclass_i_ic_sc_i_ic 1162
+find_cclass_i_i_s_ic_ic 1163
+find_cclass_i_ic_s_ic_ic 1164
+find_cclass_i_i_sc_ic_ic 1165
+find_cclass_i_ic_sc_ic_ic 1166
+find_not_cclass_i_i_s_i_i 1167
+find_not_cclass_i_ic_s_i_i 1168
+find_not_cclass_i_i_sc_i_i 1169
+find_not_cclass_i_ic_sc_i_i 1170
+find_not_cclass_i_i_s_ic_i 1171
+find_not_cclass_i_ic_s_ic_i 1172
+find_not_cclass_i_i_sc_ic_i 1173
+find_not_cclass_i_ic_sc_ic_i 1174
+find_not_cclass_i_i_s_i_ic 1175
+find_not_cclass_i_ic_s_i_ic 1176
+find_not_cclass_i_i_sc_i_ic 1177
+find_not_cclass_i_ic_sc_i_ic 1178
+find_not_cclass_i_i_s_ic_ic 1179
+find_not_cclass_i_ic_s_ic_ic 1180
+find_not_cclass_i_i_sc_ic_ic 1181
+find_not_cclass_i_ic_sc_ic_ic 1182
+escape_s_s 1183
+compose_s_s 1184
+compose_s_sc 1185
+spawnw_i_s 1186
+spawnw_i_sc 1187
+spawnw_i_p 1188
+err_i 1189
+err_s 1190
+err_s_i 1191
+err_s_ic 1192
+time_i 1193
+time_n 1194
+gmtime_s_i 1195
+gmtime_s_ic 1196
+localtime_s_i 1197
+localtime_s_ic 1198
+decodetime_p_i 1199
+decodetime_p_ic 1200
+decodelocaltime_p_i 1201
+decodelocaltime_p_ic 1202
+sysinfo_s_i 1203
+sysinfo_s_ic 1204
+sysinfo_i_i 1205
+sysinfo_i_ic 1206
+sleep_i 1207
+sleep_ic 1208
+sleep_n 1209
+sleep_nc 1210
+sizeof_i_i 1211
+sizeof_i_ic 1212
+store_lex_s_p 1213
+store_lex_sc_p 1214
+store_dynamic_lex_s_p 1215
+store_dynamic_lex_sc_p 1216
+find_lex_p_s 1217
+find_lex_p_sc 1218
+find_dynamic_lex_p_s 1219
+find_dynamic_lex_p_sc 1220
+find_caller_lex_p_s 1221
+find_caller_lex_p_sc 1222
+get_namespace_p 1223
+get_namespace_p_p 1224
+get_namespace_p_pc 1225
+get_hll_namespace_p 1226
+get_hll_namespace_p_p 1227
+get_hll_namespace_p_pc 1228
+get_root_namespace_p 1229
+get_root_namespace_p_p 1230
+get_root_namespace_p_pc 1231
+get_global_p_s 1232
+get_global_p_sc 1233
+get_global_p_p_s 1234
+get_global_p_pc_s 1235
+get_global_p_p_sc 1236
+get_global_p_pc_sc 1237
+get_hll_global_p_s 1238
+get_hll_global_p_sc 1239
+get_hll_global_p_p_s 1240
+get_hll_global_p_pc_s 1241
+get_hll_global_p_p_sc 1242
+get_hll_global_p_pc_sc 1243
+get_root_global_p_s 1244
+get_root_global_p_sc 1245
+get_root_global_p_p_s 1246
+get_root_global_p_pc_s 1247
+get_root_global_p_p_sc 1248
+get_root_global_p_pc_sc 1249
+set_global_s_p 1250
+set_global_sc_p 1251
+set_global_p_s_p 1252
+set_global_pc_s_p 1253
+set_global_p_sc_p 1254
+set_global_pc_sc_p 1255
+set_hll_global_s_p 1256
+set_hll_global_sc_p 1257
+set_hll_global_p_s_p 1258
+set_hll_global_pc_s_p 1259
+set_hll_global_p_sc_p 1260
+set_hll_global_pc_sc_p 1261
+set_root_global_s_p 1262
+set_root_global_sc_p 1263
+set_root_global_p_s_p 1264
+set_root_global_pc_s_p 1265
+set_root_global_p_sc_p 1266
+set_root_global_pc_sc_p 1267
+find_name_p_s 1268
+find_name_p_sc 1269
+find_sub_not_null_p_s 1270
+find_sub_not_null_p_sc 1271
View
13 src/ops/set.ops
@@ -19,15 +19,15 @@ These operations all set registers to various values.
=item B<clone>(out STR, in STR)
-Make a clone of $2, and put it in $1. Doesn't affect what was in
-$1. Removes the constant flag on the copy, if there was one.
+Effectively the same as set $1, $2, except that if $2 is a null STRING, $1 gets
+a new empty string instead.
=cut
inline op clone(out STR, in STR) :base_mem {
/* cloning a NULL STRING produces an empty STRING; TT #964 */
$1 = $2
- ? Parrot_str_copy(interp, $2)
+ ? $2
: Parrot_str_new(interp, NULL, 0);
}
@@ -154,7 +154,7 @@ inline op set(out STR, invar STR) :base_core {
}
inline op set(out STR, inconst STR) :base_core {
- $1 = Parrot_str_copy(interp, $2);
+ $1 = $2;
}
inline op set(out STR, in INT) :base_core {