Included in the SOURCE directory is the source code, ARUN.CPP. This is the source for the command-line interface runtime shell for the Windows console (A4RUN.EXE). It is a relatively simple Logic Server Application.
A4RUN takes one argument, which is the name of a XPL file. It initializes the Prolog environment, loads the extended predicates for the command line (DOS.CPP), loads the named XPL file, and calls its main/0 predicate. It then closes the Prolog environment.
You can modify ARUN.CPP to create your own command-line shell, or use it as a sample. It illustrates how to trap errors from a C++ program, and how to map command line arguments to Prolog so they can be retrieved by the Prolog program.
There is one tricky wrinkle in ARUN.CPP. If the name of the executable is not A4RUN, then A4RUN 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 you can make a copy of A4RUN.EXE, using the name of the XPL file for the name of the new .EXE. This lets you easily create executables for your application.
For example, if your Prolog program is DUCKS.XPL, you can copy A4RUN.EXE to DUCKS.EXE. When you run DUCKS.EXE it notices its name is not A4RUN, so it runs DUCKS.XPL rather than reading the command line.
Copyright ©1987-1997 Amzi! inc. All Rights Reserved.