[svn:parrot] r46123 - in branches/include_dynpmc_makefile: . config/auto/zlib docs/book/pir docs/project include/parrot src src/interp src/runcore t/src tools/dev

darbelo at svn.parrot.org darbelo at svn.parrot.org
Wed Apr 28 23:37:50 UTC 2010


Author: darbelo
Date: Wed Apr 28 23:37:50 2010
New Revision: 46123
URL: https://trac.parrot.org/parrot/changeset/46123

Log:
Last sync with trunk.

Modified:
   branches/include_dynpmc_makefile/   (props changed)
   branches/include_dynpmc_makefile/config/auto/zlib/   (props changed)
   branches/include_dynpmc_makefile/docs/book/pir/ch04_variables.pod
   branches/include_dynpmc_makefile/docs/project/metacommitter_guide.pod
   branches/include_dynpmc_makefile/include/parrot/runcore_trace.h   (props changed)
   branches/include_dynpmc_makefile/src/interp/inter_create.c   (props changed)
   branches/include_dynpmc_makefile/src/packfile.c
   branches/include_dynpmc_makefile/src/runcore/cores.c   (props changed)
   branches/include_dynpmc_makefile/src/runcore/trace.c   (props changed)
   branches/include_dynpmc_makefile/t/src/embed.t   (props changed)
   branches/include_dynpmc_makefile/tools/dev/mk_gitignore.pl   (props changed)

Modified: branches/include_dynpmc_makefile/docs/book/pir/ch04_variables.pod
==============================================================================
--- branches/include_dynpmc_makefile/docs/book/pir/ch04_variables.pod	Wed Apr 28 23:25:17 2010	(r46122)
+++ branches/include_dynpmc_makefile/docs/book/pir/ch04_variables.pod	Wed Apr 28 23:37:50 2010	(r46123)
@@ -489,34 +489,35 @@
 When the offset position is negative, it counts backward from the end of the
 string. Thus an offset of -1 starts at the last character of the string.
 
-C<substr> also has a four-argument form, where the fourth argument is a string
-used to replace the substring. This variant modifies the source string and
-returns the removed substring.
+C<substr> no longer has a four-argument form, as in-place string operations
+have been removed.  There is a C<replace> operator which will perform the
+replacement and return a new_string without modifying the old_string.
+The arguments are new_string, old_string, offset, count and
+replacement_string.  The old_string is copied to the new_string with the
+replacement_string inserted from offset replacing the content for count
+characters.
 
-This example above replaces the substring "bc" in C<$S1> with the string "XYZ",
-and returns "bc" in C<$S0>:
+This example replaces the substring "bc" in C<$S1> with the string "XYZ",
+and returns "aXYZde" in C<$S0>, C<$S1> is not changed:
 
 =begin PIR_FRAGMENT
 
   $S1 = "abcde"
-  $S0 = substr $S1, 1, 2, "XYZ"
-  say $S0                        # prints "bc"
-  say $S1                        # prints "aXYZde"
+  $S0 = replace $S1, 1, 2, "XYZ"
+  say $S0                        # prints "aXYZde"
+  say $S1                        # prints "abcde"
 
 =end PIR_FRAGMENT
 
-When the offset position in a replacing C<substr> is one character beyond the
-original string length, C<substr> appends the replacement string just like the
+When the offset position in a C<replace> is one character beyond the original
+string length, C<replace> appends the replacement string just like the
 concatenation operator. If the replacement string is an empty string, the
-opcode removes the characters from the original string.
-
-If you don't need to capture the replaced string, an optimized version of
-C<substr> performs a replace without returning the removed substring:
+opcode removes the characters from the original string in the new string.
 
 =begin PIR_FRAGMENT
 
   $S1 = "abcde"
-  $S1 = substr 1, 2, "XYZ"
+  $S1 = replace $S1, 1, 2, "XYZ"
   say $S1                        # prints "aXYZde"
 
 =end PIR_FRAGMENT
@@ -897,10 +898,11 @@
 C<bors>X<bors opcode>, C<bands>X<bands opcode>, and C<bxors>X<bxors opcode>.
 These take string or string-like PMC arguments and perform the logical
 operation on each byte of the strings to produce the result string.
+Remember that in-place sting operations are no longer acailable.
 
 =begin PIR_FRAGMENT
 
-  $S0 = bors $S1
+  $P0 = bors $P1
   $P0 = bands $P1
   $S0 = bors $S1, $S2
   $P0 = bxors $P1, $S2

Modified: branches/include_dynpmc_makefile/docs/project/metacommitter_guide.pod
==============================================================================
--- branches/include_dynpmc_makefile/docs/project/metacommitter_guide.pod	Wed Apr 28 23:25:17 2010	(r46122)
+++ branches/include_dynpmc_makefile/docs/project/metacommitter_guide.pod	Wed Apr 28 23:37:50 2010	(r46123)
@@ -66,11 +66,13 @@
 Congratulate the new member publicly by sending an email to
 parrot-dev at lists.parrot.org, and copying the new committer.
 
-
 The steps for the "languages" repository and Trac instance are the same,
 except the URLs are L<https://trac.parrot.org/languages/...> and the
 committer group is "languages_committers".
 
+Note that commit messages from the new member will be automatically held
+pending list-admin approval.
+
 =head2 To manage the list of Metacommitters
 
 Only existing Metacommitters can perform this activity.

Modified: branches/include_dynpmc_makefile/src/packfile.c
==============================================================================
--- branches/include_dynpmc_makefile/src/packfile.c	Wed Apr 28 23:25:17 2010	(r46122)
+++ branches/include_dynpmc_makefile/src/packfile.c	Wed Apr 28 23:37:50 2010	(r46123)
@@ -481,6 +481,15 @@
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 /* HEADERIZER END: static */
 
+/* Segment header:
+  1 op - Segment size
+  1 op - Internal type
+  1 op - Internal id
+  1 op - Size of theop array
+  See pdd13_bytecode: Packfile Segment Header
+*/
+#define SEGMENT_HEADER_SIZE 4
+
 /* offset not in ptr diff, but in byte */
 #define OFFS(pf, cursor) ((pf) ? ((const char *)(cursor) - (const char *)((pf)->src)) : 0)
 /**
@@ -1573,7 +1582,7 @@
 default_dump(PARROT_INTERP, ARGIN(const PackFile_Segment *self))
 {
     ASSERT_ARGS(default_dump)
-    size_t i = self->data ? 0: self->file_offset + 4;
+    size_t i = self->data ? 0: self->file_offset + SEGMENT_HEADER_SIZE;
 
     default_dump_header(interp, self);
 
@@ -2517,10 +2526,7 @@
 default_packed_size(ARGIN(const PackFile_Segment *self))
 {
     ASSERT_ARGS(default_packed_size)
-    /* op_count, itype, id, size */
-    /* XXX There should be a constant defining this 4, and why */
-    /* This is the 2nd place in the file that has this */
-    return 4 + self->size;
+    return SEGMENT_HEADER_SIZE + self->size;
 }
 
 


More information about the parrot-commits mailing list