summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c39
1 files changed, 7 insertions, 32 deletions
diff --git a/main.c b/main.c
index ed3d7db..7c1b1ca 100644
--- a/main.c
+++ b/main.c
@@ -10,56 +10,31 @@ 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();
-
initflags();
initstreams();
+ initmodules();
- int fd = open("./stdlib.pl", OREAD);
- if(fd < 0){
- print("Can't open ./stdlib.pl\n");
- exits("open");
+ while(argc != 0){
+ parsemodule(argv[0]);
+ argc--;
+ argv++;
}
- Term *database = parse(fd, nil, 0);
- close(fd);
-
- if(parsetestfile){
- int fd = open(parsetestfile, OREAD);
- if(fd < 0)
- exits("open");
- Term *clauses = parse(fd, nil, 0);
- database = appendterm(database, clauses);
-
- Term *goal;
- for(goal = initgoals; goal != nil; goal = goal->next){
- Binding *bindings = nil;
- evalquery(database, goal, &bindings);
- }
- }
-
- repl(database);
-
+ repl();
exits(nil);
}
void
usage(void)
{
- fprint(2, "Usage: pprolog [-d]\n");
+ fprint(2, "Usage: pprolog [-d] modulefiles\n");
exits("Usage");
} \ No newline at end of file