Tutorial Project. Release 13

From wiki.visual-prolog.com

Written by Victor Yukhtenko. Email: victor@pdc.spb.su

The programs listed below are part of the Evolutions Tutorial Project article.

Game Rules ...

Goal

The demonstration of practices of the Vip-based programming:

  • The ways of the communication of the main applicaion with the parts of the application, which are placed to the DLL (Dynamically Linked Library);
  • The practice of the rising and handling the exceptions.

Functionality

  • New strategy model Computer3 added.

Code

  • Tested with Visual Prolog 7.3 build 7302.
  • The set of projects. The Release 13 contains the set strongly dependent projects - the project of the main application and projects of three DLLs, where DLL has the special project to build it. The set of projects contains:
    • The Project ModelsDLL (generates the DLL), where models of the computer strategies of the game Computer0, Computer1, Computer2 are placed.
    • The Project Computer3DLL (generates the DLL), where the model of the strategy Computer3 is placed.
    • The Project HumanInterfaceDLL (generates the DLL), where classes related to the HumanInterface are placed. This DLL is called using the library, which used while the main application building.
    • Project ObjectWin - the project of the main executable application.

Install

If you have VipSpbSDK, then you will find all projects in the directory Examples\Polyline\Polyline13\Programs

To get the full set of projects of the series of the Polyline projects, please download archives using links at PDC forum:

  • VipSpbSDK_PE_73_Examples_Polyline_1_14.zip
  • VipSpbSDK_PE_73_Tools_Polyline_1_14.zip]

to any convenient directory. The directory named VipSpbSDK will be created automatically.

Building

Please, see first your version specialty

Open and build projects:

  • Programs\Computer3Dll\Computer3Dll.prj6;
  • Programs\HumanInterfaceDll\HumanInterfaceDLL.prj6;
  • Programs\ModelsDll\ModelsDll.prj6. The warning while the compilation points to the incorrect declaration. It is done to demonstrate the reaction on the exception in the DLL;
  • Programs\ObjectWin\Polyline13_ObjWindows.prj6.

To build projects the IDE variable SpbSolutions must be set to the VipSpbSDK directory.

The complex building

To simplify the settings and initial building of applicaions the Build.cmd command file included (BuildPersonal.cmd - please see details in Polyline Version Reference or in Examples\Polyline\VersionReference.html).

The use of Build.cmd file:

  • sets the SpbSolutions IDE variable, which refers to the VipSpb SDK directory;
  • "knows" where Visual Prolog is installed and uses VipBuilder.exe;
  • builds all projects containing in the subfolders;
  • builds all needed libraries;
  • registers all pzl-Components (if needed);
  • informs regarding the result of each building operation;
  • Build.cmd file may be used together with the Visual Prolog CE only (please see details in Polyline Version Reference or in Examples\Polyline\VersionReference.html).

Run

  • The application corresponding to the project Programs\ObjectWin\Polyline13_ObjWindows.prj6 must be invoked;
  • Run the application using the E of the IDE or run the executable at the directory EXE.
  • The language of the application may be defined in the command line by the language identifier:
    • en - English
    • ru - Russian
  • When running the program from the IDE, the parameter of the language must be placed to the field "Project Settings"\Run Options\Run Arguments, available from menu Project\Settings...