cvsuser 05/03/07 08:44:24
Modified: encodings utf8.c
src packdump.c
Log:
Strings. Finally. 16 - packfile fixes
* utf8 encoding didn't properly calculate strlen
* remove representation in packdump
make world and make testr succeed now.
Revision Changes Path
1.25 +11 -2 parrot/encodings/utf8.c
Index: utf8.c
===================================================================
RCS file: /cvs/public/parrot/encodings/utf8.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- utf8.c 2 Mar 2005 17:00:50 -0000 1.24
+++ utf8.c 7 Mar 2005 16:44:23 -0000 1.25
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: utf8.c,v 1.24 2005/03/02 17:00:50 leo Exp $
+$Id: utf8.c,v 1.25 2005/03/07 16:44:23 leo Exp $
=head1 NAME
@@ -47,6 +47,7 @@
typedef unsigned char utf8_t;
#endif
+static void iter_init(Interp *, String *src, String_iter *iter);
/*
=item C<static UINTVAL
@@ -475,7 +476,15 @@
static UINTVAL
codepoints(Interp *interpreter, STRING *src)
{
- return src->strlen;
+ String_iter iter;
+ /*
+ * this is used to initially calculate src->strlen,
+ * therefore we must scan the whole string
+ */
+ iter_init(interpreter, src, &iter);
+ while (iter.bytepos < src->bufused)
+ iter.get_and_advance(interpreter, &iter);
+ return iter.charpos;
}
static UINTVAL
1.24 +5 -5 parrot/src/packdump.c
Index: packdump.c
===================================================================
RCS file: /cvs/public/parrot/src/packdump.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- packdump.c 30 Jul 2004 07:08:19 -0000 1.23
+++ packdump.c 7 Mar 2005 16:44:24 -0000 1.24
@@ -2,7 +2,7 @@
Copyright (C) 2001-2002 Gregor N. Purdy. All rights reserved.
This program is free software. It is subject to the same license as
Parrot itself.
-$Id: packdump.c,v 1.23 2004/07/30 07:08:19 leo Exp $
+$Id: packdump.c,v 1.24 2005/03/07 16:44:24 leo Exp $
=head1 NAME
@@ -85,8 +85,8 @@
PIO_printf(interpreter, " [ 'PFC_STRING', {\n");
PIO_printf(interpreter, " FLAGS => 0x%04lx,\n",
(long)PObj_get_FLAGS(self->u.string));
- PIO_printf(interpreter, " REPRESENTATION => %ld,\n",
- self->u.string->representation);
+ PIO_printf(interpreter, " CHARSET => %ld,\n",
+ self->u.string->charset);
PIO_printf(interpreter, " SIZE => %ld,\n",
(long)self->u.string->bufused);
/* TODO: Won't do anything reasonable for most encodings */
@@ -140,7 +140,7 @@
/*
=item C<void
-PackFile_Fixup_dump(Interp *interpreter,
+PackFile_Fixup_dump(Interp *interpreter,
struct PackFile_FixupTable *ft)>
Dumps the fix-up table C<ft>.
@@ -150,7 +150,7 @@
*/
void
-PackFile_Fixup_dump(Interp *interpreter,
+PackFile_Fixup_dump(Interp *interpreter,
struct PackFile_FixupTable *ft)
{
opcode_t i;