1 |
root |
1.1 |
=head1 NAME |
2 |
|
|
|
3 |
|
|
Faster - do some things faster |
4 |
|
|
|
5 |
|
|
=head1 SYNOPSIS |
6 |
|
|
|
7 |
|
|
use Faster; |
8 |
|
|
|
9 |
|
|
=head1 DESCRIPTION |
10 |
|
|
|
11 |
|
|
=over 4 |
12 |
|
|
|
13 |
|
|
=cut |
14 |
|
|
|
15 |
|
|
package Faster; |
16 |
|
|
|
17 |
|
|
use strict; |
18 |
|
|
|
19 |
|
|
BEGIN { |
20 |
|
|
our $VERSION = '0.01'; |
21 |
|
|
|
22 |
|
|
require XSLoader; |
23 |
|
|
XSLoader::load __PACKAGE__, $VERSION; |
24 |
|
|
} |
25 |
|
|
|
26 |
|
|
use B (); |
27 |
|
|
|
28 |
|
|
our $source; |
29 |
|
|
our $label_next; |
30 |
|
|
our $label_last; |
31 |
|
|
our $label_redo; |
32 |
|
|
|
33 |
|
|
sub entersub { |
34 |
|
|
my ($cv) = @_; |
35 |
|
|
|
36 |
|
|
my %opsseen; |
37 |
|
|
my @ops; |
38 |
|
|
my @todo = $cv->START; |
39 |
|
|
|
40 |
|
|
while (my $op = shift @todo) { |
41 |
|
|
for (; $$op; $op = $op->next) { |
42 |
|
|
last if $opsseen{$$op}++; |
43 |
|
|
push @ops, $op; |
44 |
|
|
my $name = $op->name; |
45 |
|
|
if (B::class($op) eq "LOGOP") { |
46 |
|
|
push @todo, $op->other; |
47 |
|
|
} elsif ($name eq "subst" and ${ $op->pmreplstart }) { |
48 |
|
|
push @todo, $op->pmreplstart; |
49 |
|
|
} elsif ($name =~ /^enter(loop|iter)$/) { |
50 |
|
|
# if ($] > 5.009) { |
51 |
|
|
# $labels{${$op->nextop}} = "NEXT"; |
52 |
|
|
# $labels{${$op->lastop}} = "LAST"; |
53 |
|
|
# $labels{${$op->redoop}} = "REDO"; |
54 |
|
|
# } else { |
55 |
|
|
# $labels{$op->nextop->seq} = "NEXT"; |
56 |
|
|
# $labels{$op->lastop->seq} = "LAST"; |
57 |
|
|
# $labels{$op->redoop->seq} = "REDO"; |
58 |
|
|
# } |
59 |
|
|
} |
60 |
|
|
} |
61 |
|
|
} |
62 |
|
|
|
63 |
|
|
for (@ops) { |
64 |
|
|
printf "%s\n", $_->name; |
65 |
|
|
} |
66 |
|
|
# walklines(\@lines, 0); |
67 |
|
|
} |
68 |
|
|
|
69 |
|
|
hook_entersub; |
70 |
|
|
|
71 |
|
|
1; |
72 |
|
|
|
73 |
|
|
=back |
74 |
|
|
|
75 |
|
|
=head1 AUTHOR |
76 |
|
|
|
77 |
|
|
Marc Lehmann <schmorp@schmorp.de> |
78 |
|
|
http://home.schmorp.de/ |
79 |
|
|
|
80 |
|
|
=cut |
81 |
|
|
|