On Saturday 19 July 2008 09:57:02 [EMAIL PROTECTED] wrote:

> Log:
> [PDD13]
> * Implement get_directory().
> * Fix get_string() so it works.
> * Add the beginnings of a test script for the Packfile class.

> --- branches/pdd13pbc/src/pmc/packfile.pmc    (original)
> +++ branches/pdd13pbc/src/pmc/packfile.pmc    Sat Jul 19 09:57:02 2008
> @@ -20,6 +20,7 @@
>  */
>
>  #include "parrot/parrot.h"
> +#include "pmc_packfiledirectory.h"
>
>  pmclass Packfile {
>
> @@ -64,10 +65,10 @@
>      VTABLE STRING *get_string() {
>          PackFile *pf = PMC_data_typed(SELF, PackFile *);
>          STRING *str = new_string_header(interp, 0);
> -        opcode_t length = PackFile_pack_size(interp, pf);
> +        opcode_t length = PackFile_pack_size(interp, pf) *
> sizeof(opcode_t); Parrot_allocate_string(interp, str, length);
>          PackFile_pack(interp, pf, (opcode_t*)str->strstart);
> -        str->bufused = length;
> +        str->bufused = str->strlen = length;
>          return str;
>      }
>

Poking at strings directly seems unclean; do we need to add another function 
to src/packfile.c to return a packed packfile as a C string, and then create 
the string directly here in get_string()?

-- c

Reply via email to