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