line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Language::Prolog::Yaswi::Low; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.23'; |
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
114821
|
use strict; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
99
|
|
6
|
4
|
|
|
4
|
|
18
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
226
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Exporter; |
9
|
|
|
|
|
|
|
our @ISA = qw(Exporter DynaLoader); |
10
|
|
|
|
|
|
|
our @EXPORT = qw( init |
11
|
|
|
|
|
|
|
cleanup |
12
|
|
|
|
|
|
|
toplevel |
13
|
|
|
|
|
|
|
openquery |
14
|
|
|
|
|
|
|
cutquery |
15
|
|
|
|
|
|
|
nextsolution |
16
|
|
|
|
|
|
|
swi2perl |
17
|
|
|
|
|
|
|
testquery |
18
|
|
|
|
|
|
|
getvar |
19
|
|
|
|
|
|
|
getquery |
20
|
|
|
|
|
|
|
getallvars |
21
|
|
|
|
|
|
|
$converter ); |
22
|
|
|
|
|
|
|
|
23
|
4
|
|
|
4
|
|
23
|
use Carp; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
221
|
|
24
|
4
|
|
|
4
|
|
1652
|
use Language::Prolog::Types::Converter; |
|
4
|
|
|
|
|
9514
|
|
|
4
|
|
|
|
|
860
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our $converter = Language::Prolog::Types::Converter->new(); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# our @fids; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our ($qid, $query, @vars, @cells, %vars_cache); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub getvar ($) { |
34
|
32
|
|
|
32
|
0
|
177
|
my $name=$_[0]->name(); |
35
|
|
|
|
|
|
|
croak "no such variable '$name'" |
36
|
32
|
50
|
|
|
|
155
|
unless exists $vars_cache{$name}; |
37
|
32
|
|
|
|
|
189
|
return swi2perl($vars_cache{$name}); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub getallvars { |
41
|
0
|
|
|
0
|
0
|
0
|
return map { swi2perl($_) } @cells[0..$#vars] |
|
0
|
|
|
|
|
0
|
|
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub getquery () { |
45
|
0
|
|
|
0
|
0
|
0
|
swi2perl($query); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# require XSLoader; |
49
|
|
|
|
|
|
|
# XSLoader::load('Language::Prolog::Yaswi::Low', $VERSION); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
our $dl_load_flags; |
52
|
|
|
|
|
|
|
$dl_load_flags = 0x1 unless defined $dl_load_flags; |
53
|
4
|
|
|
4
|
1
|
1343
|
sub dl_load_flags { $dl_load_flags } |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
require DynaLoader; |
56
|
4
|
|
|
4
|
|
1516
|
use Alien::SWIProlog; |
|
4
|
|
|
|
|
158834
|
|
|
4
|
|
|
|
|
97
|
|
57
|
|
|
|
|
|
|
__PACKAGE__->bootstrap; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
our @args; |
60
|
|
|
|
|
|
|
@args = (PL_EXE(), '-q') unless @args; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub init { |
63
|
0
|
|
|
0
|
0
|
|
@args=(PL_EXE(), @_); |
64
|
0
|
|
|
|
|
|
start(); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
69
|
|
|
|
|
|
|
__END__ |