simon 01/09/03 09:41:39
Modified: . string.c string.h strnative.c
Log:
Tidying up the string vtables.
Revision Changes Path
1.2 +3 -0 parrot/string.c
Index: string.c
===================================================================
RCS file: /home/perlcvs/parrot/string.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- string.c 2001/08/29 12:07:04 1.1
+++ string.c 2001/09/03 16:41:38 1.2
@@ -20,6 +20,9 @@
return s;
}
+STRING *
+string_grow_buffer(STRING* s, IV newsize);
+
/* Setup string vtables */
void
string_init(void) {
1.2 +3 -2 parrot/string.h
Index: string.h
===================================================================
RCS file: /home/perlcvs/parrot/string.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- string.h 2001/08/29 12:07:04 1.1
+++ string.h 2001/09/03 16:41:38 1.2
@@ -32,10 +32,11 @@
/* String vtable functions */
typedef IV (*string_to_iv_t)(STRING *);
+typedef IV (*iv_to_iv_t)(IV);
struct string_vtable {
- string_to_iv_t compute_strlen;
-
+ string_to_iv_t compute_strlen; /* How long is a piece of string? */
+ iv_to_iv_t max_strlen; /* I have n characters - how many bytes should I
allocate? */
};
typedef struct string_vtable STRING_VTABLE;
1.2 +6 -0 parrot/strnative.c
Index: strnative.c
===================================================================
RCS file: /home/perlcvs/parrot/strnative.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- strnative.c 2001/08/29 12:07:04 1.1
+++ strnative.c 2001/09/03 16:41:39 1.2
@@ -13,9 +13,15 @@
return s->buflen;
}
+static IV
+string_native_max_strlen (IV x) {
+ return x;
+}
+
STRING_VTABLE
string_native_vtable (void) {
return (STRING_VTABLE) {
string_native_compute_strlen,
+ string_native_max_strlen,
};
}