blob: 416e832a1d3a36cba9da587166d7b0d858b34817 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#include <u.h>
#include <libc.h>
#include "dat.h"
#include "fns.h"
void usage(void);
void
main(int argc, char *argv[])
{
char *parsetestfile = nil;
ARGBEGIN{
case 'd':
debug = 1;
break;
case 'f':
parsetestfile = EARGF(usage());
break;
default:
usage();
}ARGEND
if(argc != 0)
usage();
if(parsetestfile){
int fd = open(parsetestfile, OREAD);
if(fd < 0)
exits("open");
Term *database = parse(fd, 0);
Term *goal;
for(goal = initgoals; goal != nil; goal = goal->next){
Binding *bindings = nil;
evalquery(database, goal, &bindings);
}
repl(database);
}
exits(nil);
}
void
usage(void)
{
fprint(2, "Usage: pprolog [-d]\n");
exits("Usage");
}
|