line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Inline::Basic; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
11772
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
4
|
1
|
|
|
1
|
|
4
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
57
|
|
5
|
|
|
|
|
|
|
$VERSION = '0.01'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
17
|
use base qw(Inline); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
83
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
902
|
use IO::Scalar; |
|
1
|
|
|
|
|
13986
|
|
|
1
|
|
|
|
|
53
|
|
10
|
1
|
|
|
1
|
|
1210
|
use Language::Basic; |
|
1
|
|
|
|
|
42361
|
|
|
1
|
|
|
|
|
555
|
|
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
0
|
|
0
|
sub _croak { require Carp; Carp::croak(@_) } |
|
0
|
|
|
|
|
0
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub register { |
15
|
|
|
|
|
|
|
return { |
16
|
0
|
|
|
0
|
0
|
0
|
language => 'Basic', |
17
|
|
|
|
|
|
|
aliases => [ qw(basic) ], |
18
|
|
|
|
|
|
|
type => 'interpreted', |
19
|
|
|
|
|
|
|
suffix => 'pl', |
20
|
|
|
|
|
|
|
}; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
0
|
39
|
sub validate { } |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub build { |
26
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
27
|
0
|
|
|
|
|
0
|
my $prog = Language::Basic::Program->new; |
28
|
0
|
|
|
|
|
0
|
my $code = $self->{API}->{code}; |
29
|
0
|
|
|
|
|
0
|
for my $line (split /\n/, $code) { |
30
|
0
|
|
|
|
|
0
|
$prog->line($line); |
31
|
|
|
|
|
|
|
} |
32
|
0
|
|
|
|
|
0
|
my $path = "$self->{API}->{install_lib}/auto/$self->{API}->{modpname}"; |
33
|
0
|
0
|
|
|
|
0
|
$self->mkpath($path) unless -d $path; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# Catching code to $script |
36
|
0
|
|
|
|
|
0
|
tie *STDOUT, 'IO::Scalar', \my $script; |
37
|
0
|
|
|
|
|
0
|
$prog->output_perl; |
38
|
0
|
|
|
|
|
0
|
untie *STDOUT; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Pre-format it |
41
|
0
|
|
|
|
|
0
|
$script =~ s/^.*# Subroutine Definitions\n#\n//s; |
42
|
0
|
|
|
|
|
0
|
$script =~ s/sub (\w+)_fun/"sub FN" . uc($1)/eg; |
|
0
|
|
|
|
|
0
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
{ |
45
|
0
|
|
|
|
|
0
|
package Inline::Basic::Tester; |
46
|
0
|
|
|
|
|
0
|
eval $script; |
47
|
|
|
|
|
|
|
} |
48
|
0
|
0
|
|
|
|
0
|
_croak "Basic build failed: $@" if $@; |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
0
|
my $obj = $self->{API}->{location}; |
51
|
0
|
0
|
|
|
|
0
|
open BASIC_OBJ, "> $obj" or _croak "$obj: $!"; |
52
|
0
|
|
|
|
|
0
|
print BASIC_OBJ $script; |
53
|
0
|
|
|
|
|
0
|
close BASIC_OBJ; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub load { |
57
|
1
|
|
|
1
|
0
|
4
|
my $self = shift; |
58
|
1
|
|
|
|
|
10
|
my $obj = $self->{API}->{location}; |
59
|
|
|
|
|
|
|
|
60
|
1
|
50
|
|
|
|
96
|
open BASIC_OBJ, "< $obj" or _croak "$obj: $!"; |
61
|
1
|
|
|
|
|
3
|
my $code = do { local $/; }; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
24
|
|
62
|
1
|
|
|
|
|
9
|
close BASIC_OBJ; |
63
|
|
|
|
|
|
|
|
64
|
1
|
|
|
1
|
|
76
|
eval "package $self->{API}->{pkg};\n$code"; |
|
1
|
|
|
1
|
|
322
|
|
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
65
|
1
|
50
|
|
|
|
5
|
_croak "Can't load Basic module $obj: $@" if $@; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
0
|
1
|
|
sub info { } |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
__END__ |