summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorPeter Mikkelsen <peter@pmikkelsen.com>2021-07-05 16:27:38 +0000
committerPeter Mikkelsen <peter@pmikkelsen.com>2021-07-05 16:27:38 +0000
commit44ab8a339c78bcc3460d44b2f435116f21faa60a (patch)
treefa512c143c5df81c0c333a187b9083cbac9636f6 /main.c
parent3f26a0f2a1f699e628136ec5be6178b5ab40fc44 (diff)
First step on modules. Still very very rough.
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