Contents
Back
Forward

2. Configuring CSPL and its tools


2.1 Software Requirements

To fully use CSPL Package you'll need several things:

-- Civilization II : Test of Time from Microprose.
-- Borland C++ Compiler (you're strongly encouraged to use this compiler 'cause it's free and all examples in this tutorial are realized with it).
-- A C++ IDE as EditPlus (Not required but make simpler coding phase).
-- A good C/C++ tutorial.

The Borland C++ compiler can be downloaded from http://www.borland.com/bcppbuilder/freecompiler/
while some good C tutorials can be downloaded are the followings:




2.2 Installing CSPL

Installing CSPL is very easy: Just unzip the whole pack in a new directory (ie: C:\CSPL)
you'll obtain 6 directories:

Docs: Directory containing documentation (this html file included).
EditPlus: Directory containing syntax file to configure EditPlus with CSPL (if you want to use EditPlus).
Library: Directory containing CSPL library files.
Templates: Directory containing CSPL client skeletons; used to create new CSPL programs mantaining the standard template.
Tools: Directory containing tools builded to aid CSPL designers (actually there is only one tool: CSPLCompanion).
Projects: Directory containing all CSPL projects started by the user (CSPLCompanion creates new projects in this dir).

At this point you should download and install the free compiler (remember the directory in which you install it!)


2.3 Configuring CSPL Companion

CSPL Companion is a tool which should help CSPL designer in managing CSPL files;
it is just a batch file but it can be very useful.
CSPL Companion has two main functions:
1) It is used to create templates of CSPLclient source code files.
2) It is used to automate compiling and linking operations.

We'll see how to use CSPLCompanion later; now you should just configure it, so it can be used without problems later.
Ensure you've installed the compiler and modify the CSPLCompanion.bat file with a text editor as notepad (Right click on CSPLCompanion.bat file and select modify).
The first three lines of CSPLCompanion.bat file should be:

REM PLACE YOUR BORLAND PATH AND CSPL PATH IN THE FOLLOWING BRACKETS
SET BORLANDPATH="BORLAND_PATH_HERE"
SET CSPLPATH="CSPL_PATH_HERE"
Now, as explained by REM line, place the path in which you installed Borland Compiler and the CSPL pack between brackets
(so if you intalled the compiler in C:\programs\borland the second row should be changed in SET BORLANDPATH="c:\programs\borland"), now save changes and exit from notepad, you´re ready to use Companion.


2.4 Configuring EditPlus

EditPlus is a good IDE which an interesting feature: the user can add support for new languages in a very simple way. I used this feature to make EditPlus fully compatible with CSPL and in this section I´ll explain you how to configure EditPlus to help you in writing down CSPL applications.
NOTICE: This section explains you how configure EditPlus v 1.22, actually there are newer versions out, anyway i think you can adapt my instruction to newer versions without great problems.

In this package you should find an EditPlus directory with a couple of files (template.csp and cspl.stx), these files are a modified version of standard C++ syntax files which come with EditPlus, modified to support all CSPL functions. If you've downloaded EditPlus install it in a directory you like and launch it; At this point select Configure User Tools… from the Tools menu as in the following image:



At this point the Preferences window should pop-up, select File->Settings submenu , push the Add button and compile the form as in the following image:



Notice: Obviously substitute in the Auto-completion form the directory C:\Programmi\EditPlus with the directory in which you installed EditPlus.

At this point pass to the Files->Syntax submenu, push add button and select CSPL.stx file which comes with this package and fill the form as in the following image:



Obviously Syntax file form will point to cspl.stx file which comes with this package, i placed it in EditPlus directory but it is not necessary. Now it's time to select Files->Filters submenu, to push Add button and to fill the form as shown in the following image:



And now it's time to fill Files->Templates submenu, push the Add button and fill the form as shown in the following image:



Notice: Obviously the File path entry should point to your template.csp file which comes with this package.

At this point you've finished with the Files submenu, it's time to move to Tools submenu: select Tools->User Tools submenu The first think we should make is to set EditPlus to allow it to compile CSPLClient programs.
Push the Add button and compile the form as in the following screenshot (Notice that in the Command box you should insert the path to Borland Compiler, called bcc32.exe and it probably differs from path shown in the screenshot)



At this point you should configure EditPlus to link your CSPLClient program, push the Add button and fill the form as shown in the following screenshot
(Notice two things:
1) in the Command box you should insert the path to Borland Linker, called ilink32.exe and it probably differs from path shown in the screenshot
2) in the Argument box you should insert the whole following line:
/aa c0w32.obj $(FileNameNoExt).obj,$(FileNameNoExt).exe,cspl.lib import32.lib cw32.lib,,cspl.res
)



At this point EditPlus is configured to be used with CSPL programs but there are still a couple of things you should know: To avoid conflicts between Editplus C++ standard syntax files and mine CSPL syntax file CSPL files (even if they´re C/C++ file) should have a .csp extension instead of classic .c or .cpp extension anyway this will not create any problem with compiler. To link the program you should always have the cspl.res file in the same directory of source files, CSPLCompanion (see appendix B) always copies this file when creating new templates so I suggest you to use always CSPLCompanion to start a new CSPL program and after to load it with EditPlus




Contents / Introduction
Chapter I / Chapter II / Chapter III / Chapter IV / Chapter V / Chapter VI / Chapter VII
Chapter VIII / Chapter IX / Chapter X / Chapter XI / Chapter XII / Chapter XIII
Appendix A / Appendix B / Appendix C