Contents Back Forward |
2. Configuring CSPL and its tools |
2.1 Software Requirements To fully utilize the 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 because it's free and all examples in this tutorial are created with it). -- A C++ IDE such as EditPlus (Not required but makes the coding phase simpler ). -- A good C/C++ tutorial. The Borland C++ compiler can be downloaded from http://www.borland.com/bcppbuilder/freecompiler/ while some good C tutorials that can be downloaded are the following:
| |
2.2 Installing CSPL Installing CSPL is very easy. Just unzip the whole pack into a new directory (ie: C:\CSPL). This will give you 6 directories: Docs: Directory containing documentation (this html file included). EditPlus: Directory containing the 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 using the standard template. Tools: Directory containing tools built to aid CSPL designers (actually there is only one tool at the moment: CSPLCompanion). Projects: Directory containing all CSPL projects started by the user (CSPLCompanion creates new projects in this directory). At this point you should download and install the free compiler (be sure to remember the directory in which you install it!) |
|
2.3 Configuring CSPL Companion CSPL Companion is a tool which should help the 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. For 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 such as notepad (Right-click on the CSPLCompanion.bat file and select modify). The first three lines of the 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 the REM line, place the path in which you installed Borland Compiler and the CSPL pack between brackets (so if you installed the compiler in C:\programs\borland the second row should be changed to SET BORLANDPATH="c:\programs\borland"). Now save changes, exit from notepad, and you're ready to use Companion. |
|
2.4 Configuring EditPlus EditPlus is a good IDE which has 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 how to configure EditPlus to help you in writing down CSPL applications. NOTE: This section explains how to configure EditPlus v 1.22, although actually there are newer versions out. Anyway you can probably adapt my instructions to newer versions without too much of a problem. 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: ![]() Note: Obviously, be sure to substitute in the Auto-completion form the directory in which you actually installed EditPlus instead of the example, C:\Programmi\EditPlus. At this point pass to the Files->Syntax submenu, push the Add button and select the CSPL.stx file which comes with this package and fill out the form as in the following image: ![]() Obviously the Syntax file form will point to the cspl.stx file which comes with this package. I placed it in the EditPlus directory but that is not necessary. Now it's time to select the Files->Filters submenu, push the Add button, and fill out the form as shown in the following image: ![]() Now it's time to fill Files->Templates submenu. Push the Add button and fill out 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 and it's time to move to the Tools submenu. Select the Tools->User Tools submenu. The first thing we should do is 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 the Borland Compiler (the file named bcc32.exe) and it probably differs from the path shown in the screenshot. ![]() At this point you should configure EditPlus to link your CSPLClient program. Push the Add button and fill out the form as shown in the following screenshot. Notice two things: 1) In the Command box you should insert the path to the Borland Linker (the file named ilink32.exe) which probably differs from the 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 my CSPL syntax file, CSPL files (even if they're C/C++ files) should have a .csp extension instead of classic .c or .cpp extension. Anyway this will not create any problem with the compiler. To link the program you should always have the cspl.res file in the same directory as the source files. CSPLCompanion (see appendix B) always copies this file when creating new templates so I suggest you always use CSPLCompanion to start a new CSPL program and after to load it with EditPlus |