SWI-Prolog for Windows Jan Wielemaker 06/06/94 (Updated: 16/11/94) (Version 1.9.4) This distribution contains SWI-Prolog for Windows. It is a port of version 1.9.4 of SWI-Prolog. SWI-Prolog runs in a simple MS-Window providing traditional stream-based interaction. Status: ======= Third beta test version. First beta-test version reported mostly installation problems due to filename representation problems. Third beta-test version should run on machines lacking floating point hardware (`SX' machines). It should fix a bug in the stack-expander incorporates various improvements and fixes in the common sources. Please report problems to jan@swi.psy.uva.nl. Version 1.9.4 windows-specific changes ====================================== * Compiled for floating-point emulations on machines that lack floating point hardware. * Fixed memory management bug in stack-expander. * Added DDE interface. * Added editor declaration for Windows notepad. * Fixed problem in file-name mapping that caused existing files to be reported as non-existing sometimes. Version 1.9.0 windows-specific changes ====================================== * Filename conversion and finding the home-directory is fixed. * The drive's root directory is now handled properly. * Fatal errors will now often :-( show a Windows message-box instead of just quiting Prolog. This allows you to read the message :-) * Control-C break is tested in the main virtual machine loop. A few procent slower, but it does allow you to break a looping program ... * Cut-and-paste is implemented in the console-window, allowing for xterm-like cut-and-paste (left/right to start/extend the selection and middle to paste it). * Improved error reporting. * Now Writes files in DOS text-format rather then using binary mode. * Installation has changed a bit. Read it! ============ Copyright: ========== SWI-Prolog may be distributed freely for non-commercial use. See pl\licence for a more complete description of your rights. Requirements: ============= 386/486/pentium based PC running MS-Windows 3.1. SWI-Prolog is compiled using the WATCOM 32-bit C/C++ compiler and should run on machines with and with or without floating point coprocessor. Minimum memory usage will be about 1 MB. You'll probably need at least 4 MB to run SWI-Prolog under Windows. Please report your experiences. Parts: ====== The system consists of four parts: bin/pl.exe 32-bits Windows Executable. bin/pl.qlf Quick-Load-File containing procompiled Prolog code, defining various essential parts of the Prolog system. Should be installed in the same directory as pl.exe and have the same base-name. Other places where it will be looking for this file are: startup/startup.pc and startup/startup (both relative to the `home' directory). library\ The Prolog library file. Holds the Prolog library and help system. boot\ Contains the Prolog source for building pl.qlf. You don't need this if you don't want to look at this or modify it. Installation: ============= Unpack the zip file from C:, creating a directory c:\pl. If you want to install in another directory, there are various possibilities to make the system find its home directory. It will be looking for these in the following places (in this order: 1) Trying the environment variable `SWI_HOME_DIR' 2) Trying the environment variable `SWIPL' 3) Trying the parent directory of the directory from which the executable was loaded. Thus, if pl.exe is in bin/pl.exe from the home directory this should work. 4) Trying :\pl where drive is one of `cdefghijklmnopab' 3) is the new and preferred way of finding the home directory. It implies that you just have to make a new `program instance', specifying an absolute path to the pl.exe executable. Create a `New Program Object' using the Window Program Manager's `new...' option. The fields should be: Description: SWI-Prolog Command Line: c:\pl\bin\pl.exe Working Directory: The place you work Modify `Command Line' if you installed SWI-Prolog into another directory. Configuration of the Console: ============================= The stream-based console window is a completely separate library, using its own configuration info. It will look at two environment variables: "CONSOLE" and the base-name of the running program ("PL" if you use the default configuration). Options in "PL" overrule those in "CONSOLE". Options in "CONSOLE" apply to any application compiled using the console library. The options variable should contain a string of the form :{,:} Where is one of: default description sl 200 Number of lines you can scroll back. There is no limit, but the more you specify the more memory will be used. Memory is allocated when data becomes available. rows 24 Initial number of lines cols 80 Initial number of columns x CW_USEDEFAULT X-coordinate of the top-left corner. y CW_USEDEFAULT Y-coordinate of the top-left corner. You will normally specify this in your autoexec.bat file. Here is what I use: set CONSOLE=sl:600,x:400,y:400 Editor interface ================ SWI-Prolog defines an interface to an external text editor using the predicates ed(+Predicate) and edit(+File). Normally, after the user quits the editor, the system will run the predicate make/0 to recompile all modified files. This will not work for Windows as the shell/1 call returns immediately, without waiting for the external application to finish. You can specify the editor in autoexec.bat or ~/_plrc. If you wish to use the simple notepad editor delivered with Windows, put the following line in your ~/_plrc: ?- setenv('EDITOR', notepad). Windowing and Graphics ====================== SWI-Prolog itself has no graphical capabilities. Graphics can be provided by the XPCE toolkit, for which an MS-Windows beta version is available. XPCE is *not* free software. It is distributed for academic users at a price of dfl. 500,-- (at the time of writing, $1 approximates dfl. 1.75). This licence includes classroom and student usage. For details, ftp swi.psy.uva.nl/pub/xpce/Windows/... or contact xpce-request@swi.psy.uva.nl if you are interrested. Filenames: ========== All filenames are internally handled in a Unix compatible format: they are lowercase, the directories are separated with a '/' and absolute files are of the form /:/... Filenames will be converted to DOS/Windows format just before invoking the C-library functions. Filename expansion will translate `~' to the environment variable HOME. Constructs of the form $VAR in filenames are expanded to the corresponding environment variable. DOS %VAR% is not recognised. The user may specify filenames either using DOS format or Unix format. Unix format should be used in source-files that need to be run both on the Unix and DOS/Windows version. The predicate prolog_to_os_filename(+PrologPath, +OsPath) may be used to explicitely convert filenames between both representations. This predicate exists in all versions of 1.9.4 and later. On unix it simply unifies the arguments. Features and bugs specific to this version: =========================================== * Dynamically expanding runtime stacks using a stack-shifter. Expands the environment (local), heap (global) and trail-stacks if necessary. * Garbage collection on global (heap) and trail-stacks. * Fixed C-stack of 128 KB (limits depth of unification and various other recursive tasks; does not limit normal Prolog recursion). * GNU-Readline 1.2 based input editor that allows for GNU-EMACS like editing of the command line. This input editor runs on top of a simple, still incomplete I/O window. Features: * Command history using ^P, ^N * Cursor movement using ^B, ^F, etc. * Many more; just try the GNU-Emacs bindings! * End-of-file is ^D. * Completion on files and atoms using TAB, viewing alternatives using ESC-? * Window may be resized and scrolled. * Cut-and-paste is similar to X11's xterm: left-button starts a selection, right-button extends it and middle-button pastes. Bugs: * Showing matching bracket does not work * Resizing the window while the line is wrapped gives bad results. * save/[1,2] and save_program/[1,2] do not work. * profile/1 does not work. * load_foreign/[2,5] does not work. * The statistics/[0.2] reported CPU-time also includes idle time. * help/1 just dumps it output in the console window. Should be a separate window some day ... Boot compilation: ================= The file bin/pl.qlf is a `Prolog Quick Load File' file created from the Prolog sources in the boot subdirectory. If you want to change anything there, you can recreate the startup file using the command: pl.exe -b boot/init.pl -c boot/load.pl For this command-line the working directory should be the home directory of Prolog. If not, you should absolute paths. Sources: ======== The common source for all platforms is available using anonymous ftp to swi.psy.uva.nl, directory pub/SWI-Prolog. The Windows version is compiled using the 32-bit WATCOM C/C++ compiler (version 9.5). If you decide to port it to another compiler (for example GCC), please forward me the changes. SWI-Prolog is reported *not* to compile using WATCOM version 10.0. The problem appears that there is no specific area in virtual memory-space where malloc() happens. This implies there are no (not enough) bits on a pointer to add tags to it. It uses two libraries, both of which may be found at ftp.swi.psy.uva.nl: Library xos.lib redefines the WATCOM file access library to handle both Unix and DOS format files and make the direcory operations work on the root-direcories of a drive. Library readline.lib provides the console window and readline command-editor. Both libraries are assumed to be installed next to the Prolog sources: ..../xos/... XOS library ..../readline/... Readline and console library ..../pl/... SWI-Prolog source