[svn:parrot] r46055 - in trunk: . compilers/pct/src/PAST compilers/pge/PGE ext/nqp-rx/src/stage0 runtime/parrot/library runtime/parrot/library/CGI runtime/parrot/library/MIME runtime/parrot/library/Test/Builder src/ops t/native_pbc t/op t/pmc tools/dev

bacek at svn.parrot.org bacek at svn.parrot.org
Tue Apr 27 11:35:55 UTC 2010


Author: bacek
Date: Tue Apr 27 11:35:54 2010
New Revision: 46055
URL: https://trac.parrot.org/parrot/changeset/46055

Log:
Replace deprecated in-place substr ops

Modified:
   trunk/PBC_COMPAT
   trunk/compilers/pct/src/PAST/Compiler.pir
   trunk/compilers/pge/PGE/OPTable.pir
   trunk/ext/nqp-rx/src/stage0/HLL-s0.pir
   trunk/runtime/parrot/library/CGI/QueryHash.pir
   trunk/runtime/parrot/library/Crow.pir
   trunk/runtime/parrot/library/MIME/Base64.pir
   trunk/runtime/parrot/library/OpenGL.pir
   trunk/runtime/parrot/library/Test/Builder/Output.pir
   trunk/src/ops/ops.num
   trunk/src/ops/string.ops
   trunk/t/native_pbc/annotations.pbc
   trunk/t/native_pbc/integer_1.pbc
   trunk/t/native_pbc/number_1.pbc
   trunk/t/native_pbc/string_1.pbc
   trunk/t/op/sprintf.t
   trunk/t/op/string.t
   trunk/t/op/string_cs.t
   trunk/t/op/stringu.t
   trunk/t/pmc/io.t
   trunk/t/pmc/key.t
   trunk/t/pmc/string.t
   trunk/tools/dev/nci_thunk_gen.pir
   trunk/tools/dev/pbc_to_exe.pir

Modified: trunk/PBC_COMPAT
==============================================================================
--- trunk/PBC_COMPAT	Tue Apr 27 09:09:06 2010	(r46054)
+++ trunk/PBC_COMPAT	Tue Apr 27 11:35:54 2010	(r46055)
@@ -27,6 +27,7 @@
 
 # please insert tab separated entries at the top of the list
 
+6.8	2010.04.27	bacek	remove deprecated in-place substr ops
 6.7	2010.04.22	coke	remove RetContinuation PMC
 6.6	2010.04.17	bacek	add replace op
 6.5	2010.03.09	cotto	remove cpu_ret op

Modified: trunk/compilers/pct/src/PAST/Compiler.pir
==============================================================================
--- trunk/compilers/pct/src/PAST/Compiler.pir	Tue Apr 27 09:09:06 2010	(r46054)
+++ trunk/compilers/pct/src/PAST/Compiler.pir	Tue Apr 27 11:35:54 2010	(r46055)
@@ -1150,7 +1150,7 @@
     name = node.'name'()
     if name goto call_by_name
     ##  our first child is the thing to be invoked, so make sure it's a PMC
-    substr signature, 1, 0, 'P'
+    signature = replace signature, 1, 0, 'P'
     (ops, posargs, namedargs) = self.'post_children'(node, 'signature'=>signature)
     goto children_done
   call_by_name:

Modified: trunk/compilers/pge/PGE/OPTable.pir
==============================================================================
--- trunk/compilers/pge/PGE/OPTable.pir	Tue Apr 27 09:09:06 2010	(r46054)
+++ trunk/compilers/pge/PGE/OPTable.pir	Tue Apr 27 11:35:54 2010	(r46055)
@@ -155,7 +155,7 @@
     unless $S0 goto with_looser
     $S0 = tokentable[$S0;'precedence']
     $S0 = clone $S0
-    substr $S0, -1, 0, '<'
+    $S0 = replace $S0, -1, 0, '<'
     token['precedence'] = $S0
   with_looser:
 
@@ -163,7 +163,7 @@
     unless $S0 goto with_tighter
     $S0 = tokentable[$S0;'precedence']
     $S0 = clone $S0
-    substr $S0, -1, 0, '>'
+    $S0 = replace $S0, -1, 0, '>'
     token['precedence'] = $S0
   with_tighter:
 

Modified: trunk/ext/nqp-rx/src/stage0/HLL-s0.pir
==============================================================================
--- trunk/ext/nqp-rx/src/stage0/HLL-s0.pir	Tue Apr 27 09:09:06 2010	(r46054)
+++ trunk/ext/nqp-rx/src/stage0/HLL-s0.pir	Tue Apr 27 11:35:54 2010	(r46055)
@@ -99,7 +99,7 @@
     sigil = substr $S0, 0, 1
     $I0 = index '$@%&', sigil
     if $I0 < 0 goto sigil_done
-    substr $S0, 0, 1, ''
+    $S0 = replace $S0, 0, 1, ''
     ns[0] = $S0
     $S0 = ns[-1]
     $S0 = concat sigil, $S0

Modified: trunk/runtime/parrot/library/CGI/QueryHash.pir
==============================================================================
--- trunk/runtime/parrot/library/CGI/QueryHash.pir	Tue Apr 27 09:09:06 2010	(r46054)
+++ trunk/runtime/parrot/library/CGI/QueryHash.pir	Tue Apr 27 11:35:54 2010	(r46055)
@@ -143,7 +143,7 @@
         # TODO: This should be an array
         v_array = new 'Hash'
         v_array[0] = v
-        substr k, -2, 2, ''
+        k = replace k, -2, 2, ''
         query_hash[k] = v_array
         branch next_item
 v_isnt_array:

Modified: trunk/runtime/parrot/library/Crow.pir
==============================================================================
--- trunk/runtime/parrot/library/Crow.pir	Tue Apr 27 09:09:06 2010	(r46054)
+++ trunk/runtime/parrot/library/Crow.pir	Tue Apr 27 11:35:54 2010	(r46055)
@@ -124,7 +124,7 @@
         $I0 = index template, symbol
         if -1 == $I0 goto repl_done
         $I1 = length symbol
-        substr template, $I0, $I1, value
+        template = replace template, $I0, $I1, value
         goto repl_loop
       repl_done:
     goto it_loop

Modified: trunk/runtime/parrot/library/MIME/Base64.pir
==============================================================================
--- trunk/runtime/parrot/library/MIME/Base64.pir	Tue Apr 27 09:09:06 2010	(r46054)
+++ trunk/runtime/parrot/library/MIME/Base64.pir	Tue Apr 27 11:35:54 2010	(r46055)
@@ -164,9 +164,9 @@
 
     # padding with '='
     if len_mod_3 == 0 goto END_2
-        substr base64, -1, 1, ascii:"="
+        base64 = replace base64, -1, 1, ascii:"="
         if len_mod_3 == 2 goto END_2
-            substr base64, -2, 1, ascii:"="
+            base64 = replace base64, -2, 1, ascii:"="
     END_2:
 
     .return( base64 )

Modified: trunk/runtime/parrot/library/OpenGL.pir
==============================================================================
--- trunk/runtime/parrot/library/OpenGL.pir	Tue Apr 27 09:09:06 2010	(r46054)
+++ trunk/runtime/parrot/library/OpenGL.pir	Tue Apr 27 11:35:54 2010	(r46055)
@@ -309,8 +309,7 @@
     # Rename all 'glutcb*' symbols to 'glut*'
   rename_callbacks:
     .local string renamed
-    renamed = clone symbol
-    substr renamed, 4, 2, ''
+    renamed = replace symbol, 4, 2, ''
     export_renames[symbol] = renamed
     goto symbol_loop
   symbol_loop_end:
@@ -371,8 +370,7 @@
     # Rename all 'glutcb*' symbols to 'glut*'
   rename_callbacks:
     .local string renamed
-    renamed = clone symbol
-    substr renamed, 4, 2, ''
+    renamed = replace symbol, 4, 2, ''
     export_renames[symbol] = renamed
     goto symbol_loop
   symbol_loop_end:

Modified: trunk/runtime/parrot/library/Test/Builder/Output.pir
==============================================================================
--- trunk/runtime/parrot/library/Test/Builder/Output.pir	Tue Apr 27 09:09:06 2010	(r46054)
+++ trunk/runtime/parrot/library/Test/Builder/Output.pir	Tue Apr 27 11:35:54 2010	(r46055)
@@ -122,7 +122,8 @@
   	newline_index = index message, "\n"
 	if newline_index == -1 goto END_LOOP
 	inc newline_index
-	line = substr message, 0, newline_index, ''
+	line    = substr message, 0, newline_index
+	message = replace message, 0, newline_index, ''
 	push lines, line
 	if message goto SPLIT_LOOP
 

Modified: trunk/src/ops/ops.num
==============================================================================
--- trunk/src/ops/ops.num	Tue Apr 27 09:09:06 2010	(r46054)
+++ trunk/src/ops/ops.num	Tue Apr 27 11:35:54 2010	(r46055)
@@ -1067,229 +1067,213 @@
 substr_s_sc_i_ic               1043
 substr_s_s_ic_ic               1044
 substr_s_sc_ic_ic              1045
-substr_s_s_i_i_s               1046
-substr_s_s_ic_i_s              1047
-substr_s_s_i_ic_s              1048
-substr_s_s_ic_ic_s             1049
-substr_s_s_i_i_sc              1050
-substr_s_s_ic_i_sc             1051
-substr_s_s_i_ic_sc             1052
-substr_s_s_ic_ic_sc            1053
-substr_s_i_i_s                 1054
-substr_s_ic_i_s                1055
-substr_s_i_ic_s                1056
-substr_s_ic_ic_s               1057
-substr_s_i_i_sc                1058
-substr_s_ic_i_sc               1059
-substr_s_i_ic_sc               1060
-substr_s_ic_ic_sc              1061
-substr_s_p_i_i                 1062
-substr_s_p_ic_i                1063
-substr_s_p_i_ic                1064
-substr_s_p_ic_ic               1065
-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
+substr_s_p_i_i                 1046
+substr_s_p_ic_i                1047
+substr_s_p_i_ic                1048
+substr_s_p_ic_ic               1049
+replace_s_s_i_i_s              1050
+replace_s_sc_i_i_s             1051
+replace_s_s_ic_i_s             1052
+replace_s_sc_ic_i_s            1053
+replace_s_s_i_ic_s             1054
+replace_s_sc_i_ic_s            1055
+replace_s_s_ic_ic_s            1056
+replace_s_sc_ic_ic_s           1057
+replace_s_s_i_i_sc             1058
+replace_s_sc_i_i_sc            1059
+replace_s_s_ic_i_sc            1060
+replace_s_sc_ic_i_sc           1061
+replace_s_s_i_ic_sc            1062
+replace_s_sc_i_ic_sc           1063
+replace_s_s_ic_ic_sc           1064
+replace_s_sc_ic_ic_sc          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

Modified: trunk/src/ops/string.ops
==============================================================================
--- trunk/src/ops/string.ops	Tue Apr 27 09:09:06 2010	(r46054)
+++ trunk/src/ops/string.ops	Tue Apr 27 11:35:54 2010	(r46055)
@@ -240,19 +240,15 @@
 
 =item B<substr>(out STR, in STR, in INT, in INT)
 
-=item B<substr>(out STR, inout STR, in INT, in INT, in STR)
-
-=item B<substr>(inout STR, in INT, in INT, in STR)
-
-=item B<replace>(out STR, in STR, in INT, in INT, in STR)
-
 =item B<substr>(out STR, invar PMC, in INT, in INT)
 
 Set $1 to the portion of $2 starting at (zero-based) character position
 $3 and having length $4. If no length ($4) is provided, it is equivalent to
-passing in the length of $2. This creates a COW copy of $2.
+passing in the length of $2.
+
+=item B<replace>(out STR, in STR, in INT, in INT, in STR)
 
-Optionally pass in string $5 for replacement. If the length of $5 is
+Replace part of $2 starting from $3 of length $4 with $5. If the length of $5 is
 different from the length specified in $4, then $2 will grow or shrink
 accordingly. If $3 is one character position larger than the length of
 $2, then $5 is appended to $2 (and the empty string is returned);
@@ -264,8 +260,7 @@
 the end of the string (ie an offset of -1 corresponds to the last
 character).
 
-The third form is optimized for replace only, ignoring the replaced
-substring and does not waste a register to do the string replace.
+New $1 string returned.
 
 =cut
 
@@ -278,15 +273,6 @@
     $1 = Parrot_str_substr(interp, $2, $3, $4);
 }
 
-inline op substr(out STR, inout STR, in INT, in INT, in STR) :base_core :deprecated {
-    $1 = Parrot_str_substr(interp, $2, $3, $4);
-    $2 = Parrot_str_replace(interp, $2, $3, $4, $5);
-}
-
-inline op substr(inout STR, in INT, in INT, in STR) :base_core :deprecated {
-    $1 = Parrot_str_replace(interp, $1, $2, $3, $4);
-}
-
 inline op substr(out STR, invar PMC, in INT, in INT) :base_core {
     $1 = VTABLE_substr_str(interp, $2, $3, $4);
 }

Modified: trunk/t/native_pbc/annotations.pbc
==============================================================================
Binary file (source and/or target). No diff available.

Modified: trunk/t/native_pbc/integer_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.

Modified: trunk/t/native_pbc/number_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.

Modified: trunk/t/native_pbc/string_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.

Modified: trunk/t/op/sprintf.t
==============================================================================
--- trunk/t/op/sprintf.t	Tue Apr 27 09:09:06 2010	(r46054)
+++ trunk/t/op/sprintf.t	Tue Apr 27 11:35:54 2010	(r46055)
@@ -202,8 +202,8 @@
     # remove /'s
     $S0 = substr expected, 0, 1
     if $S0 != "/" goto eh_bad_line
-    substr expected, 0, 1, ''
-    substr expected, -1, 1, ''
+    expected = replace expected, 0, 1, ''
+    expected = replace expected, -1, 1, ''
 
     $I0 = index $S1, expected
     if $I0 == -1 goto is_nok

Modified: trunk/t/op/string.t
==============================================================================
--- trunk/t/op/string.t	Tue Apr 27 09:09:06 2010	(r46054)
+++ trunk/t/op/string.t	Tue Apr 27 11:35:54 2010	(r46055)
@@ -19,7 +19,7 @@
 .sub main :main
     .include 'test_more.pir'
 
-    plan(399)
+    plan(373)
 
     set_s_s_sc()
     test_clone()
@@ -36,19 +36,19 @@
     exception_substr_oob()
     len_greater_than_strlen()
     len_greater_than_strlen_neg_offset()
-    five_arg_substr_w_rep_eq_length()
-    five_arg_substr_w_replacement_gt_length()
-    five_arg_substr_w_replacement_lt_length()
-    five_arg_substr_vs_hash()
-    five_arg_substr__offset_at_end_of_string()
-    exception_five_arg_substr__offset_past_end_of_string()
-    five_arg_substr_neg_offset_repl_eq_length()
-    five_arg_substr_neg_offset_repl_gt_length()
-    five_arg_substr_neg_offset_repl_lt_length()
-    exception_five_arg_substr_neg_offset_out_of_string()
-    five_arg_substr_length_gt_strlen()
-    five_arg_substr_length_gt_strlen_neg_offset()
-    four_arg_replacement_only_substr()
+    replace_w_rep_eq_length()
+    replace_w_replacement_gt_length()
+    replace_w_replacement_lt_length()
+    replace_vs_hash()
+    replace__offset_at_end_of_string()
+    exception_replace__offset_past_end_of_string()
+    replace_neg_offset_repl_eq_length()
+    replace_neg_offset_repl_gt_length()
+    replace_neg_offset_repl_lt_length()
+    exception_replace_neg_offset_out_of_string()
+    replace_length_gt_strlen()
+    replace_length_gt_strlen_neg_offset()
+    replace_only_substr()
     three_arg_substr()
     exception_substr__pos_offset_zero_length_string()
     substr_offset_zero_zero_length_string()
@@ -57,7 +57,7 @@
     zero_length_substr_zero_length_string()
     zero_length_substr_zero_length_string()
     three_arg_substr_zero_length_string()
-    five_arg_substr_zero_length_string()
+    replace_zero_length_string()
     four_arg_substr_replace_zero_length_string()
     concat_s_s_sc_null_onto_null()
     concat_s_sc_repeated_two_arg_concats()
@@ -369,43 +369,35 @@
     is( $S1, "length 21", '' )
 .end
 
-.sub five_arg_substr_w_rep_eq_length
+.sub replace_w_rep_eq_length
     set $S0, "abcdefghijk"
     set $S1, "xyz"
-    substr $S2, $S0, 4, 3, $S1
-    is( $S0, "abcdxyzhijk", '' )
-    is( $S1, "xyz", '' )
-    is( $S2, "efg", '' )
+    replace $S2, $S0, 4, 3, $S1
+    is( $S2, "abcdxyzhijk", '' )
 .end
 
-.sub five_arg_substr_w_replacement_gt_length
+.sub replace_w_replacement_gt_length
     set $S0, "abcdefghijk"
     set $S1, "xyz0123"
-    substr $S2, $S0, 4, 3, $S1
-    is( $S0, "abcdxyz0123hijk", '' )
-    is( $S1, "xyz0123", '' )
-    is( $S2, "efg", '' )
+    $S2 = replace $S0, 4, 3, $S1
+    is( $S2, "abcdxyz0123hijk", '' )
 .end
 
-.sub five_arg_substr_w_replacement_lt_length
+.sub replace_w_replacement_lt_length
     set $S0, "abcdefghijk"
     set $S1, "x"
-    substr $S2, $S0, 4, 3, $S1
-    is( $S0, "abcdxhijk", '' )
-    is( $S1, "x", '' )
-    is( $S2, "efg", '' )
+    $S2 = replace $S0, 4, 3, $S1
+    is( $S2, "abcdxhijk", '' )
 .end
 
-.sub five_arg_substr__offset_at_end_of_string
-  set $S0, "abcdefghijk"
-  set $S1, "xyz"
-  substr $S2, $S0, 11, 3, $S1
-    is( $S0, "abcdefghijkxyz", '' )
-    is( $S1, "xyz", '' )
-    is( $S2, "", '' )
+.sub replace__offset_at_end_of_string
+    set $S0, "abcdefghijk"
+    set $S1, "xyz"
+    $S2 = replace $S0, 11, 3, $S1
+    is( $S2, "abcdefghijkxyz", '' )
 .end
 
-.sub five_arg_substr_vs_hash
+.sub replace_vs_hash
     # Check that string hashval properly updated.
     .local pmc hash
     hash = new ['Hash']
@@ -414,80 +406,68 @@
     hash["foo"] = 42
     $S0 = replace $S0, 1, 1, ''
     $S1 = hash[$S0]
-    is( $S1, '42', 'substr behave it self')
+    is( $S1, '42', 'replace behave it self')
 .end
 
-.sub exception_five_arg_substr__offset_past_end_of_string
+.sub exception_replace__offset_past_end_of_string
     set $S0, "abcdefghijk"
     set $S1, "xyz"
     push_eh handler
-    substr $S2, $S0, 12, 3, $S1
+    $S2 = replace $S0, 12, 3, $S1
     ok(0,"no exception")
 handler:
-    .exception_is( "Cannot take substr outside string" )
+    .exception_is( "Can only replace inside string or index after end of string" )
 .end
 
-.sub five_arg_substr_neg_offset_repl_eq_length
+.sub replace_neg_offset_repl_eq_length
     set $S0, "abcdefghijk"
     set $S1, "xyz"
-    substr $S2, $S0, -3, 3, $S1
-    is( $S0, "abcdefghxyz", '' )
-    is( $S1, "xyz", '' )
-    is( $S2, "ijk", '' )
+    $S2 = replace $S0, -3, 3, $S1
+    is( $S2, "abcdefghxyz", '' )
 .end
 
-.sub five_arg_substr_neg_offset_repl_gt_length
+.sub replace_neg_offset_repl_gt_length
     set $S0, "abcdefghijk"
     set $S1, "xyz"
-    substr $S2, $S0, -6, 2, $S1
-    is( $S0, "abcdexyzhijk", '' )
-    is( $S1, "xyz", '' )
-    is( $S2, "fg", '' )
+    $S2 = replace $S0, -6, 2, $S1
+    is( $S2, "abcdexyzhijk", '' )
 .end
 
-.sub five_arg_substr_neg_offset_repl_lt_length
+.sub replace_neg_offset_repl_lt_length
     set $S0, "abcdefghijk"
     set $S1, "xyz"
-    substr $S2, $S0, -6, 4, $S1
-    is( $S0, "abcdexyzjk", '' )
-    is( $S1, "xyz", '' )
-    is( $S2, "fghi", '' )
+    $S2 = replace $S0, -6, 4, $S1
+    is( $S2, "abcdexyzjk", '' )
 .end
 
-.sub exception_five_arg_substr_neg_offset_out_of_string
+.sub exception_replace_neg_offset_out_of_string
     set $S0, "abcdefghijk"
     set $S1, "xyz"
     push_eh handler
-    substr $S2, $S0, -12, 4, $S1
+    $S2 = replace $S0, -12, 4, $S1
     ok(0,"no exception")
 handler:
-    .exception_is( "Cannot take substr outside string" )
+    .exception_is( "Can only replace inside string or index after end of string" )
 .end
 
-.sub five_arg_substr_length_gt_strlen
+.sub replace_length_gt_strlen
     set $S0, "abcdefghijk"
     set $S1, "xyz"
-    substr $S2, $S0, 3, 11, $S1
-    is( $S0, "abcxyz", '' )
-    is( $S1, "xyz", '' )
-    is( $S2, "defghijk", '' )
+    $S2 = replace $S0, 3, 11, $S1
+    is( $S2, "abcxyz", '' )
 .end
 
-.sub five_arg_substr_length_gt_strlen_neg_offset
+.sub replace_length_gt_strlen_neg_offset
     set $S0, "abcdefghijk"
     set $S1, "xyz"
-    substr $S2, $S0, -3, 11, $S1
-    is( $S0, "abcdefghxyz", '' )
-    is( $S1, "xyz", '' )
-    is( $S2, "ijk", '' )
+    $S2 = replace $S0, -3, 11, $S1
+    is( $S2, "abcdefghxyz", '' )
 .end
 
-.sub four_arg_replacement_only_substr
+.sub replace_only_substr
     set $S0, "abcdefghijk"
     set $S1, "xyz"
     $S2 = replace $S0, 3, 3, $S1
-    is( $S0, "abcdefghijk", '' )
-    is( $S1, "xyz", '' )
     is( $S2, "abcxyzghijk", '' )
 .end
 
@@ -547,34 +527,28 @@
     is( $S1, "", '' )
 .end
 
-.sub five_arg_substr_zero_length_string
+.sub replace_zero_length_string
     set $S0, ""
     set $S1, "xyz"
-    substr $S2, $S0, 0, 3, $S1
-    is( $S0, "xyz", '' )
-    is( $S1, "xyz", '' )
-    is( $S2, "", '' )
+    $S2 = replace $S0, 0, 3, $S1
+    is( $S2, "xyz", '' )
 
     set $S3, ""
     set $S4, "abcde"
-    substr $S5, $S3, 0, 0, $S4
-    is( $S3, "abcde", '' )
-    is( $S4, "abcde", '' )
-    is( $S5, "", '' )
+    $S5 = replace $S3, 0, 0, $S4
+    is( $S5, "abcde", '' )
 .end
 
 .sub four_arg_substr_replace_zero_length_string
     set $S0, ""
     set $S1, "xyz"
-    substr $S0, 0, 3, $S1
+    $S0 = replace $S0, 0, 3, $S1
     is( $S0, "xyz", '' )
-    is( $S1, "xyz", '' )
 
     set $S2, ""
     set $S3, "abcde"
-    substr $S2, 0, 0, $S3
+    $S2 = replace $S2, 0, 0, $S3
     is( $S2, "abcde", '' )
-    is( $S3, "abcde", '' )
 .end
 
 .sub concat_s_s_sc_null_onto_null
@@ -2037,7 +2011,7 @@
     .param string s
     $I0 = index s, '::'
     is( s, "Foo::Bar", 'bug 60030' )
-    substr s, $I0, 2, "/"
+    s = replace s, $I0, 2, "/"
     is( s, "Foo/Bar", 'bug 60030' )
     collect
     is( s, "Foo/Bar", 'bug 60030' )

Modified: trunk/t/op/string_cs.t
==============================================================================
--- trunk/t/op/string_cs.t	Tue Apr 27 09:09:06 2010	(r46054)
+++ trunk/t/op/string_cs.t	Tue Apr 27 11:35:54 2010	(r46055)
@@ -653,7 +653,8 @@
     trans_charset S1, S0, I0
     find_encoding I0, "utf16"
     trans_encoding S1, S1, I0
-    substr S2, S1, 1, 1, "oe"
+    substr  S2, S1, 1, 1
+    replace S1, S1, 1, 1, "oe"
     find_encoding I0, "utf8"
     trans_encoding S2, S2, I0
     trans_encoding S1, S1, I0

Modified: trunk/t/op/stringu.t
==============================================================================
--- trunk/t/op/stringu.t	Tue Apr 27 09:09:06 2010	(r46054)
+++ trunk/t/op/stringu.t	Tue Apr 27 11:35:54 2010	(r46055)
@@ -256,7 +256,7 @@
     set S0, "AAAAAAAAAA\\u666"
     set I0, 0x666
     chr S1, I0
-    substr S0, 10, 5, S1
+    replace S0, S0, 10, 5, S1
     print S0
     print "\n"
     end

Modified: trunk/t/pmc/io.t
==============================================================================
--- trunk/t/pmc/io.t	Tue Apr 27 09:09:06 2010	(r46054)
+++ trunk/t/pmc/io.t	Tue Apr 27 11:35:54 2010	(r46055)
@@ -415,7 +415,7 @@
     \$S2 = ""
   SPLIT:
     \$S3 = substr \$S1, 0, 1
-    \$S1 = substr 0, 1, ""
+    \$S1 = replace \$S1, 0, 1, ""
     if \$S3 == " " goto GOT_NR
     \$S2 = concat \$S2, \$S3
     goto SPLIT
@@ -615,7 +615,7 @@
 
     # Extract part of the read in file
     .local string head_from_file
-    substr head_from_file, from_file, 0, 5, ''
+    head_from_file = substr from_file, 0, 5
     say head_from_file
 
     end
@@ -646,23 +646,20 @@
     .local string sub_3
     sub_3 = ''
     substr sub_1, line, 0, 3
-    substr sub_2, line, 0, 3, ''
-    substr sub_3, line, 0, 3, ''
+    substr sub_2, line, 3, 3
+    line = replace line, 0, 6, ''
     print "line: "
     print line
     print "sub_1: "
     say sub_1
     print "sub_2: "
     say sub_2
-    print "sub_3: "
-    say sub_3
   end
 .end
 CODE
 line: 6789ABCDEFGHIJKLMNOPQRSTUVWXYZ
 sub_1: 012
-sub_2: 012
-sub_3: 345
+sub_2: 345
 OUTPUT
 
 pir_error_output_like( <<'CODE', <<'OUT', 'read on null PMC throws exception');

Modified: trunk/t/pmc/key.t
==============================================================================
--- trunk/t/pmc/key.t	Tue Apr 27 09:09:06 2010	(r46054)
+++ trunk/t/pmc/key.t	Tue Apr 27 11:35:54 2010	(r46055)
@@ -129,7 +129,7 @@
 loop:
   unless iterator goto end
   elem = shift iterator
-  $S0 = substr elem, 0, 1, ''
+  $S0 = replace elem, 0, 1, ''
   goto loop
 end:
   .return('')

Modified: trunk/t/pmc/string.t
==============================================================================
--- trunk/t/pmc/string.t	Tue Apr 27 09:09:06 2010	(r46054)
+++ trunk/t/pmc/string.t	Tue Apr 27 11:35:54 2010	(r46055)
@@ -900,7 +900,7 @@
   $P0 = "Foo44"
 
   $S0 = $P0
-  substr $S0, 0, 1, "B"
+  $S0 = replace $S0, 0, 1, "B"
   is( $S0, "Boo44", 'substr replace' )
   is( $P0, "Foo44", '... no change to original' )
 .end

Modified: trunk/tools/dev/nci_thunk_gen.pir
==============================================================================
--- trunk/tools/dev/nci_thunk_gen.pir	Tue Apr 27 09:09:06 2010	(r46054)
+++ trunk/tools/dev/nci_thunk_gen.pir	Tue Apr 27 11:35:54 2010	(r46055)
@@ -776,7 +776,7 @@
         inner_whitespace_loop:
             $I0 = index line, $S0
             if $I0 < 0 goto end_inner_whitespace_loop
-            substr line, $I0, 1, ' '
+            line = replace line, $I0, 1, ' '
             goto inner_whitespace_loop
         end_inner_whitespace_loop:
 
@@ -787,14 +787,16 @@
     multispace_loop:
         $I0 = index line, '  '
         if $I0 < 0 goto end_multispace_loop
-        $S0 = substr line, $I0, 2, ' '
+        $S0  = substr line, $I0, 2
+        line = replace line, $I0, 2, ' '
         goto multispace_loop
     end_multispace_loop:
 
     # remove leading whitespace
     $S0 = substr line, 0, 1
     unless $S0 == ' ' goto end_leading
-        $S0 = substr line, 0, 1, ''
+        $S0  = substr line, 0, 1
+        line = replace line, 0, 1, ' '
     end_leading:
 
     # handle empty (or whitespace only) lines
@@ -804,7 +806,8 @@
     # remove trailing whitespace
     $S0 = substr line, -1, 1
     unless $S0 == ' ' goto end_trailing
-        $S0 = substr line, -1, 1, ''
+        $S0  = substr line, -1, 1
+        line = replace line, -1, 1, ''
     end_trailing:
 
     # read the signature
@@ -1111,7 +1114,7 @@
         $S1 = substr file, $I1, $I0
         unless $S1 == $S0 goto extn_loop
         extn = $S1
-        substr file, $I1, $I0, ''
+        file = replace file, $I1, $I0, ''
     end_extn_loop:
 
     .return (dir, file, extn)

Modified: trunk/tools/dev/pbc_to_exe.pir
==============================================================================
--- trunk/tools/dev/pbc_to_exe.pir	Tue Apr 27 09:09:06 2010	(r46054)
+++ trunk/tools/dev/pbc_to_exe.pir	Tue Apr 27 11:35:54 2010	(r46055)
@@ -381,8 +381,7 @@
     downcase $S0
     if $S0 != '.pbc' goto err_pbc_path_not_pbc
     .local string base_path
-     base_path = substr pbc_path, 0
-     substr base_path, -4, 4, ''
+     base_path = replace pbc_path, -4, 4, ''
 
     .local string new_path
     new_path = substr base_path, 0


More information about the parrot-commits mailing list