Navigation  without Java Scripts

Using the Visual Development Environment (VDE)

We assume, that you have experience using the Graphical User Interface system, the windowing system. This might be either Windows 3.x, Windows 95, Windows NT, Win-OS/2 or OS/2 PM. You should thus know about using menus, closing and resizing windows, loading a file in the File Open dialog etc. If you do not have this knowledge, you should not start off trying to create an application that runs under this environment. You must first learn to use the environment.

If you are a beginner to Prolog, you don’t want to mix learning the Prolog language with the complexity of creating Windows applications with event handling and all the Windows options and possibilities, then we do suggest that you work your ways through the book about the Prolog language.

We do suggest, that you at an early stage try compiling some of the examples in the VPI subdirectory, and work your way through the Guided Tour in the Getting Started book. This gives you an impression what can be done with Visual Prolog - just so you know what you should be able to do, when you have learned to master Visual Prolog.

Iif you are going to seriously use the Visual Prolog system, you need to learn the basic concepts of Prolog properly. You will not be able to build a skyscraper without having a solid foundation. In Visual Prolog, the foundation is understanding the Prolog language and the VPI layer.

Starting the Visual Prolog Environment

The installation program will install a program group with an Icon which are normally used to start the Visual Prolog Environment. However, there are many ways to start an application in the GUI World, if you prefer another method, you can just start the VIP.EXE down in the BIN\WIN\16, BIN\WIN\32 or BIN\OS2 directories under the main VIP directory.

If Visual Prolog had an open project (a .PRJ file) last time it was closed on your computer, it will automatically reopen this project next time it starts. For the examples in this manual, you do not need to have an open project.

vde.gif (21850 bytes)

Opening an Editor Window

To create a new edit window, you can use the menu command File | New. This will bring up a new editor window with the title "NONAME".

The editor is a fairly standard text editor. It is documented in the VDE manual, but you should be able to use cursor keys and the mouse as you are used to in other editors. It supports cut, copy and Paste and Undo / Redo, which you can all be activated from the Edit menu. Also the Edit menu shows the accelerator keys associated for these actions.

Goal Mode

To check, that your system is set up properly, you should try to type in the following text in the new empty editor window:

GOAL write("Hello world"),nl.

This is what is called a GOAL in the Prolog terminology, and this is enough to be a program that can be executed. To execute the GOAL, you should activate the menu item Project | Test Goal, or just press the accelerator key Ctrl+G. If your system is installed properly, your screen will look like the following:

goalmode.gif (3659 bytes)

The result of the execution will come up in a separate window, which you must close before you can test another GOAL.

(The Visual Prolog system treats the GOAL as a program which it compiles, links and generates a Windows executable from. It uses the EASYWIN strategy, which is described in the VDE manual.).

(Note if you do not have a Project (.PRJ file) open, Visual Prolog will compile the program to your Windows temp directory. If you do have a project open while using Goal mode, Visual Prolog will use the .OBJ directory for the project to generate the temporary files. )

Try also the following goals, to see how Visual Prolog responds with yes, no or print variable values.

GOAL 2=2.
GOAL 2=3.
GOAL X = 2, Y=X+1.
GOAL X=1; X=2.

Loading A Visual Prolog Project (.VPR file)

Visual Prolog operates with projects in .VPR files. A .VPR file contains all the setup and description of Windows, dialogs, menues etc. for a Visual Prolog program. To open a Visual Prolog project you need to use Project->Open Project, and once a project is open, you can compile and run it by activating Project-Run.

You should know that the .VPR files are platform dependent. If you are using the Win16 version of the VDE, you must load the 16bit .VPR files, and if you are using the Win32 or OS/2 version of the VDE you must load the 32bit .VPR files.

Unfortunately the same fileextension are used, and in the examples on the Visual Prolog CD you must guess the format of the .VPR file from the name. The name of the Win16 version usually ends with "16", and the OS/2 version of the .VPR file usually ends with "OS2" - this is a bad design, and will probably be changed in the next version of Visual Prolog, so all platforms can use the same project file !

The design is especially bad if you want to register the the VDE to be automatically started if you click on a .VPR file. Then you have to choose which platform you want to work with ! If you are running Windows 3.1 or are using the 16 bit version of Visual Prolog, You will probably like to use the BIN\WIN\16\VIP.EXE 16bit environment, while most users running NT or WIN95/98, probably always want to use the 32 bit version.

The name of a Visual Prolog project (.VPR) file may be supplied to VIP.EXE as a command line parameter at start up. This will start Visual Prolog with the given project opened. Associating the .VPR file extension with Visual Prolog enables double-clicking on any .VPR file name to automatically invoke Visual Prolog with that project pre-loaded, as long as Visual Prolog is not already running.

Handling Errors

If you, like all programmers do, happen to make some errors in your program, the Visual Prolog system will display an error window, which contains a list of errors. You can double click on one of these errors to come to the position of the error in the source text.