Created
July 9, 2010 20:02
-
-
Save masak/469980 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
multi method write(Buf $buf) { | |
my @contents = $buf.contents; | |
my $pio = $!PIO; | |
Q:PIR { | |
$P0 = find_lex '@contents' | |
.local pmc bb | |
.local string s | |
bb = new ['ByteBuffer'] | |
.local pmc it | |
.local int i | |
it = iter $P0 | |
i = 0 | |
loop: | |
unless it goto done | |
$P1 = shift it | |
$I1 = $P1 | |
bb[i] = $I1 | |
inc i | |
goto loop | |
done: | |
s = bb.'get_string_as'(binary:"") | |
.local pmc pio | |
pio = find_lex '$pio' | |
pio.'print'(s) # Segmentation fault on this call | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment