| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Anarres::Mud::Driver::Program::Efun; |
|
2
|
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
33
|
use strict; |
|
|
4
|
|
|
|
|
7
|
|
|
|
4
|
|
|
|
|
150
|
|
|
4
|
4
|
|
|
4
|
|
21
|
use vars qw(@ISA @EXPORT_OK %EFUNS %EFUNFLAGS); |
|
|
4
|
|
|
|
|
7
|
|
|
|
4
|
|
|
|
|
258
|
|
|
5
|
4
|
|
|
4
|
|
945
|
use Data::Dumper; |
|
|
4
|
|
|
|
|
6044
|
|
|
|
4
|
|
|
|
|
207
|
|
|
6
|
4
|
|
|
4
|
|
23
|
use Carp; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
224
|
|
|
7
|
4
|
|
|
4
|
|
19
|
use Exporter; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
109
|
|
|
8
|
4
|
|
|
4
|
|
646
|
use Anarres::Mud::Driver::Program::Variable; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
181
|
|
|
9
|
4
|
|
|
4
|
|
539
|
use Anarres::Mud::Driver::Program::Method; |
|
|
4
|
|
|
|
|
15
|
|
|
|
4
|
|
|
|
|
152
|
|
|
10
|
4
|
|
|
4
|
|
20
|
use Anarres::Mud::Driver::Compiler::Type qw(:all); |
|
|
4
|
|
|
|
|
7
|
|
|
|
4
|
|
|
|
|
1803
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
@ISA = qw(Anarres::Mud::Driver::Program::Method); |
|
13
|
|
|
|
|
|
|
@EXPORT_OK = qw(register efuns efunflags); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
%EFUNS = (); |
|
16
|
|
|
|
|
|
|
%EFUNFLAGS = (); |
|
17
|
|
|
|
|
|
|
|
|
18
|
0
|
|
|
0
|
0
|
0
|
sub instantiate { |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub register { |
|
22
|
120
|
|
|
120
|
0
|
228
|
my ($class, $flags, $rettype, @argtypes) = @_; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# print "Registering efun $class(".join(", ",map{$$_}@argtypes).")\n"; |
|
25
|
|
|
|
|
|
|
|
|
26
|
120
|
|
|
|
|
124
|
my $efun = $class; |
|
27
|
120
|
|
|
|
|
422
|
$efun =~ s/^.*:://; |
|
28
|
|
|
|
|
|
|
|
|
29
|
120
|
50
|
|
|
|
278
|
croak "Duplicate efun $efun" if $EFUNS{$efun}; |
|
30
|
|
|
|
|
|
|
|
|
31
|
120
|
|
|
|
|
156
|
my @args = (); |
|
32
|
120
|
|
|
|
|
120
|
my $i = 0; |
|
33
|
120
|
|
|
|
|
151
|
foreach (@argtypes) { |
|
34
|
156
|
|
|
|
|
556
|
my $arg = new Anarres::Mud::Driver::Program::Variable( |
|
35
|
|
|
|
|
|
|
Type => $_, |
|
36
|
|
|
|
|
|
|
Name => "arg" . $i, |
|
37
|
|
|
|
|
|
|
); |
|
38
|
156
|
|
|
|
|
246
|
push(@args, $arg); |
|
39
|
156
|
|
|
|
|
285
|
$i++; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
{ |
|
43
|
4
|
|
|
4
|
|
20
|
no strict qw(refs); |
|
|
4
|
|
|
|
|
11
|
|
|
|
4
|
|
|
|
|
1142
|
|
|
|
120
|
|
|
|
|
126
|
|
|
44
|
120
|
|
|
|
|
1083
|
*{"$class\::ISA"} = [ qw(Anarres::Mud::Driver::Program::Efun) ] |
|
|
120
|
|
|
|
|
877
|
|
|
45
|
120
|
50
|
|
|
|
102
|
unless @{"$class\::ISA"}; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
120
|
|
|
|
|
1192
|
my $instance = $class->new( |
|
49
|
|
|
|
|
|
|
Name => $efun, |
|
50
|
|
|
|
|
|
|
Type => $rettype, |
|
51
|
|
|
|
|
|
|
Args => \@args, |
|
52
|
|
|
|
|
|
|
); |
|
53
|
|
|
|
|
|
|
|
|
54
|
120
|
|
|
|
|
236
|
$EFUNS{$efun} = $instance; |
|
55
|
120
|
|
|
|
|
477
|
$EFUNFLAGS{$efun} = $flags | M_EFUN | M_INHERITED; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Class methods |
|
59
|
|
|
|
|
|
|
|
|
60
|
4
|
|
|
4
|
0
|
18
|
sub efuns { return { %EFUNS }; } |
|
61
|
4
|
|
|
4
|
0
|
11
|
sub efunflags { return { %EFUNFLAGS }; } |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# Instance methods |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub generate_call { |
|
66
|
0
|
|
|
0
|
0
|
|
my ($self, @args) = @_; |
|
67
|
0
|
|
|
|
|
|
unshift(@args, '$self'); |
|
68
|
0
|
|
|
|
|
|
return ref($self) . '::invoke(' . join(', ', @args) . ')'; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub dump { |
|
72
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
73
|
0
|
|
|
|
|
|
my $name = ref($self); |
|
74
|
0
|
|
|
|
|
|
$name =~ s/^.*:://; |
|
75
|
0
|
|
|
|
|
|
return "(efun $name)"; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |