Created
April 22, 2012 18:13
-
-
Save Benabik/2465856 to your computer and use it in GitHub Desktop.
PCT.Dumper in Winxed
This file contains hidden or 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
.sub 'padre_item' :multi(['PGE';'Match']) | |
.param pmc obj | |
.param pmc name | |
.local string str | |
str = obj.'Str'() | |
$I0 = length str | |
if $I0 < 48 goto have_str | |
str = substr str, 0, 48 | |
str = concat str, '...' | |
have_str: | |
str = escape str | |
$S0 = obj['type'] | |
unless $S0 goto have_name | |
name = $S0 | |
have_name: | |
$P0 = new 'ResizablePMCArray' | |
$I1 = obj.'from'() | |
push $P0, $I1 | |
$I2 = obj.'to'() | |
$I2 -= $I1 | |
push $P0, $I2 | |
push $P0, name | |
push $P0, str | |
$S0 = sprintf ' %4d %4d %-20s "%s"', $P0 | |
say $S0 | |
.local pmc hash, hash_it | |
hash = obj.'hash'() | |
hash_it = iter hash | |
hash_it_loop: | |
unless hash_it goto hash_it_done | |
.local string key | |
key = shift hash_it | |
$P0 = hash[key] | |
'padre_item'($P0, key) | |
goto hash_it_loop | |
hash_it_done: | |
$P0 = obj.'list'() | |
'padre_item'($P0, name) | |
.end |
This file contains hidden or 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
class PGE.Match; | |
function padre_item[multi(class PGE.Match, var)](var obj, var name) { | |
:(string str) = obj.Str(); | |
if (length(str) >= 48) | |
str = substr(str, 0, 48) + '...'; | |
str = escape(str); | |
string s0 = obj['type']; | |
if (s0) | |
name = s0; | |
:(int from) = obj.from(); | |
:(int to) = obj.to(); | |
say(sprintf(' %4d %4d %-20s "%s"', [from, to - from, name, str])); | |
var hash = obj.hash(); | |
for (string key in hash) | |
padre_item(hash[key], key); | |
padre_item(obj.list(), name); | |
} |
This file contains hidden or 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
.sub 'padre_item' :multi([ 'PGE'; 'Match' ], pmc) | |
.param pmc __ARG_1 | |
.param pmc __ARG_2 | |
($S1) = __ARG_1.'Str'() | |
.annotate 'line', 32 | |
length $I3, $S1 | |
lt $I3, 48, __label_1 | |
.annotate 'line', 33 | |
substr $S4, $S1, 0, 48 | |
concat $S5, $S4, '...' | |
set $S1, $S5 | |
__label_1: # endif | |
.annotate 'line', 34 | |
escape $S1, $S1 | |
.annotate 'line', 36 | |
$S2 = __ARG_1['type'] | |
.annotate 'line', 37 | |
if_null $S2, __label_2 | |
unless $S2 goto __label_2 | |
.annotate 'line', 38 | |
box __ARG_2, $S2 | |
__label_2: # endif | |
($I1) = __ARG_1.'from'() | |
($I2) = __ARG_1.'to'() | |
.annotate 'line', 42 | |
root_new $P2, ['parrot';'ResizablePMCArray'] | |
assign $P2, 4 | |
$P2[0] = $I1 | |
sub $I3, $I2, $I1 | |
$P2[1] = $I3 | |
$P2[2] = __ARG_2 | |
$P2[3] = $S1 | |
sprintf $S4, ' %4d %4d %-20s "%s"', $P2 | |
say $S4 | |
.annotate 'line', 44 | |
$P1 = __ARG_1.'hash'() | |
.annotate 'line', 45 | |
if_null $P1, __label_4 | |
iter $P3, $P1 | |
set $P3, 0 | |
__label_3: # for iteration | |
unless $P3 goto __label_4 | |
shift $S3, $P3 | |
.annotate 'line', 46 | |
get_hll_global $P2, [ 'PCT'; 'Dumper' ], 'padre_item' | |
$P4 = $P1[$S3] | |
$P2($P4, $S3) | |
goto __label_3 | |
__label_4: # endfor | |
.annotate 'line', 48 | |
get_hll_global $P2, [ 'PCT'; 'Dumper' ], 'padre_item' | |
$P4 = __ARG_1.'list'() | |
$P2($P4, __ARG_2) | |
.annotate 'line', 49 | |
.end # padre_item |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment