simon 01/09/13 01:39:50
Modified: . TODO
docs strings.pod
Log:
Update string docs.
Revision Changes Path
1.5 +2 -3 parrot/TODO
Index: TODO
===================================================================
RCS file: /home/perlcvs/parrot/TODO,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -r1.4 -r1.5
--- TODO 2001/09/10 21:26:08 1.4
+++ TODO 2001/09/13 08:39:49 1.5
@@ -13,6 +13,5 @@
rather than:
add_i_ic I4, I4, 3
-Fix disassembler to recognise new bytecode format. If possible, abstract
-out bytecode-reading/writing stuff to a separate Perl module so we can
-change the format without breaking the (dis)assembler.
+Abstract out bytecode-reading/writing stuff to a separate Perl module so
+we can change the format without breaking the (dis)assembler.
1.3 +13 -8 parrot/docs/strings.pod
Index: strings.pod
===================================================================
RCS file: /home/perlcvs/parrot/docs/strings.pod,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -r1.2 -r1.3
--- strings.pod 2001/09/10 10:01:52 1.2
+++ strings.pod 2001/09/13 08:39:49 1.3
@@ -80,7 +80,6 @@
STRING* string_chopn(STRING* s, IV n)
-B<Not implemented>:
To retrieve a substring of the string, call
STRING* string_substr(STRING* src, IV offset, IV length, STRING** dest)
@@ -154,7 +153,9 @@
=head2 C<encoding>
-This specifies the encoding of the buffer, from the following C<enum>:
+This is a vtable of functions; the vtable should normally be taken from
+the array C<Parrot_string_vtable>. Entries in this array specify the
+encoding of the string, from the following C<enum>:
enum {
enc_native,
@@ -201,13 +202,17 @@
C<ENC_VTABLE(a)> is shorthand for:
- Parrot_string_vtable[a->encoding]
+ a->encoding
-The C<Parrot_string_vtable> is a static array of virtual tables, defined
-in C<string.c>. Each encoding has its own vtable; to call the
-concatenation function for C<a>, we look up its encoding and retrieve
-the C<concat> entry from that encoding's vtable. This produces a
-function pointer we can throw the arguments at.
+Vtables are taken from the C<Parrot_string_vtable> array, defined in
+C<string.c>. Each encoding has its own vtable; to call the concatenation
+function for C<a>, we look up its vtable and retrieve the C<concat>
+entry from that vtable. This produces a function pointer we can throw
+the arguments at.
+
+To get the actual position in the array from the vtable, use the
+C<which> entry, which returns an C<IV> index into
+C<Parrot_string_vtable>.
Most of the string vtable functions are self-explanatory as they are
thin wrappers around the functions given above. Some of them, however,