Included in the main Amzi! directory is the source code, ARUN.C. This is the source for the DOS (and other command-line interface) runtime shell. It is a relatively simple Logic Server Application.
ARUN takes one argument, which is the name of a .XPL file. It initializes the Prolog environment, loads the extended predicates for DOS, loads the named .XPL file, and calls its main/0 predicate. It then closes the Prolog environment.
You can modify ARUN.C to create your own command-line shell, or use it as a sample. It illustrates how to trap errors from a 'C' program using the setjmp API functions, and how to map other command line arguments to Prolog so they can be retrieved by the Prolog program.
There is one tricky wrinkle in ARUN.C. If the name of the executable is not ARUN, then ARUN assumes its name is the same as the name of the .XPL file it is supposed to run. Huh? That's not as dumb as it seems, for the utility APKG simply makes a copy of ARUN.EXE, using the name of the .XPL file for the name of the new .EXE. So, if you package DUCKS, you get a copy of ARUN.EXE named DUCKS.EXE, but when DUCKS.EXE runs it notices its name is not ARUN, so it runs DUCKS.XPL rather than reading the command line.
Copyright ©1987-1997 Amzi! inc. All Rights Reserved.