|
ObjectivesWe'd like to start by showing you how to get a CASL program on your PDA. In this chapter we'll learn how to:
In the next chapter we'll look at creating a new project, and introducing you to CASL programming. However, before going on to the next chapter, you must be familiar with the tasks described here. Installing the CASLideDemo VersionDownload the demo file from the CASLsoft Download page, http://www.caslsoft.com/download.html. Once on your hard drive, double clicking on the executable file (CASLxx.exe, where xx is the version number). You will be guided through the rest of the installation process. This will install the demo version of the CASL environment. The demo version has all the features and power of the full registered version except you'll have the demo versions of both the normal CASL compiler (p-code), and the CASLpro compiler (c-build). The compilers have a maximum limit of 40 global variables, 20 objects, and 20 functions. The installation process also installs and registers (with Windows registry) the CASL conduit. This process will only work if you've already installed the Palm desktop program. Should you install the Palm desktop program later, you can reinstall the CASLide to get the conduit functionality. If you intend to use the CASLpro demo compiler, you'll also need to download and install the open source PRC Tools and GNU C Compiler. See our GCC Install Page for instructions and the necessary files, http://www.caslsoft.com/gccinstall.htm. Normal CASL Registered VersionYou start by downloading and installing the demo file as mentioned above. When you purchased normal (p-code) CASL from CASLsoft's Sales page, http://www.caslsoft.com/sales.html, you were given a license file, and access information to the registered version of the CASL compiler file. The compiler is in a zip file. Once you've downloaded the zip file, you'll want to extract the Casl_c.exe file to your Caslxx folder, where xx is the version number. The Caslxx folder will vary depending on your installation, but will be on the form, "C:\Program Files\CASLsoft\CASLxx\". Your license file will enable the normal CASL features, and you'll still have access to the demo version of the CASLpro compiler. The license file needs to be copied to your Windows folder. This depends on your installation, and Windows version, but will be of the form, "C:\Windows\", or "C:\WinNT\". CASLpro Registered VersionThe process is the same as with normal CASL, except you'll need to have purchased the CASLpro upgrade from the Sales page, and you will have received a CASLpro license file. The same registered version of the compiler file mentioned for normal CASL includes the CASLpro functionality. Your CASLpro version of the license file enables the full features of the normal CASL and CASLpro compiler. If you haven't installed yet, you'll also need to download and install the open source PRC Tools and GNU C Compiler. See our GCC Install Page for instructions and the necessary files, http://www.caslsoft.com/gccinstall.htm. After installing a new compiler or license file, you'll want to restart the CASLide before the changes will take effect. Starting the CASLideAfter the CASLide is installed, you start the CASLide by selecting the program from the Start menu. The default location is Start | Programs | CASLxx, where xx is the version number. Go ahead and startup the CASLide. You should see a screen as shown.
The project window will show you the files in your application. The edit and form builder area is were you'll work on your code and form files. The build and debug area is a message box type area where you'll receive information about many of the tasks undertaken by the CASLide on your behalf. The CASLide is quite customizable. Let's look at some of the options. You can make settings now, and by closing the CASLide, these settings will be the default for all future projects.
I recommend staying with the default settings. The CASLide Manual goes into more details about the meaning of these options. A quick word about the display size settings. The CASL Display Size are software type settings for how a CASL program will treat the screen. Object positions, and graphic draw commands, and Bitmaps will all use this coordinate system. However once running on the PDA, the display size is fixed by hardware. The Palm OS runtime assumes only a 160x160 pixel display size. Other display resolutions are not supported. Therefore as leaving the CASL display size to 160x160 will keep a one-to-one relationship to the physical screen size on the Palm device, this makes it easier to work with bitmaps, as there are no stretching type problems to consider. When running on Windows or PocketPC, the CASL display size will be transposed to the physical display size specified. The Physical Screen Size settings apply to the form size only when running on Windows and PocketPC. These can by square, as shown, or any rectangular shape, as is the case for some PocketPC screens.
If you've made any changes to your settings, exit and restart the CASLide so these settings will be used for all new projects. CASL projects (CPJ)Now you're ready to work with a CASL project. A project is the container for all the components of a CASL program. You're likely ready to dive in and start creating that new killer app you have in mind. However, if it's alright I suggest starting with how to open an existing project. We can then concentrate on how to compile programs for Windows and Palm OS. We can look at how to get an application installed and running on a Palm device. To open a project you can use the toolbar buttons or the corresponding menu commands. Either method, and you'll see an open workspace dialog box. Navigate though the directory until you see the WeatherCalc sample application. The exact location will depend on your installation but will be of the form, "C:\Program Files\CASLsoft\CASLxx\WeatherCalc\". Open the file WeatherCalc.cpj.
You should now see something like the screen shot below. Note: Your display may differ as the CASLide restores what was open the last time the project was closed.
The project window is the key way to navigate through all the files in a project. By clicking on files in the project window, you can make this file active in the edit window. There's also a Workbook view, which shows file tabs in the editor area. This is an alternative (or supplementary) means to navigate to all files in a project. See View menu. The borders between the project windows and editor window are moveable with your mouse. This is also true of the build window border. If you'd like more room for your edit window, you can temporarily close the build window by clicking the "x" close button. When you compile, the build window will reappear. This is particularly useful when working with the form builder. Another way to make more room for the Form Builder is to change the default screen size settings with the menu command View | Project Settings, Physical Screen Size. The default is 320x320, but for smaller display resolutions, 160x160 may suit you better. Go ahead and click on each of the files in the project window, thus making each active, in turn, in the editor window. CASL script language files (CSL, CPK)The code window is basically a text editor with key words are color coded for readability.There is a code window for each code file. You can have as many code files in a project as you need or want.
CASL form files (CFF) with a graphical form builderThe form builder shows a frame, which is the full screen object, populated with the user interface objects. By clicking on any object in the form builder view, you can see a properties box. There is a form window for each form file. You can have as many form files in a project as you need or want.
CASL bitmap files (CBM) and CASL icon files (CIC)The icon editor is basically a special case of the bitmap editor. Icons are 32x22 pixels, while bitmaps can be any size.Notice that this icon is what we call an "image family". The icon file is actually 2 images, one for monochrome displays and the other for color displays. The aqua color shown on the background is the transparent color. When the image is displayed, the transparent color is replaced by the background color of the object hosting the bitmap. There is an image window for each image file. You can have as many image files in a project as you need or want.
C code (C) and C header files (H)Not needed for the WeatherCalc application, but when using the CASLpro compiler, C source code and header files can be included into a CASL project, and will be linked into the final PRC Tools and GCC process. These file could be written by you, or they could be library files provided by others. In the later case you don't need to know C to include these files. Compile and Run your program on the Windows platformOk, we haven't really written anything, but let's see how we can run this sample application on Windows. The first thing to do is select the "Windows Release" or "Windows Debug" choice in the target dropdown list.
You're now ready to try running the WeatherCalc application. By clicking the Run toolbar button, both a Build | Compile and Execute | Run will be performed. You could also do this is 2 steps. If everything is alright, after clicking the Run button, you'll see the following, which is the CASLwin version of the WeatherCalc application. It's white now, but when it gets hot it turns red, and when it's cold it turns blue. Feel free to experiment with some weather conditions.
If the Run wasn't successful, well that's not uncommon with new programs. We'll look at debugging in the next section. To exit a CASLwin program, you click the "x" close button in upper right hand corner, or use control menu in upper left hand corner. Should you find you've programmed a non-terminating loop (or similar non-responding program), you exit by performing a Ctrl+Alt+Del, selecting the CASLwin task (in this case "Running: WeatherCalc"), and ending the task. Careful not to end the CASLide task. Careful not to end your Windows session. The actual program file that's created is a file of the same name as your project, with the extension CSP (CASL Pentium). In our case the file is called WeatherCalc.csp. The file is located in the ".\Windows Release\" or ".\Windows Debug\" subfolder off our project folder. This file is actually a pseudo code file, and is executed by being interpreted by the CASLwin program in your CASLxx folder. This is similar to how Visual Basic programs run on Windows. You can run the CASLwin version of your CASL program by associating all CSP files with the CASLwin runtime file, or creating a shortcut of the CASLwin program with WeatherCalc as a parameter. See the CASLide Manual for details, the CASLwin section. Compile and Debug your program on the Windows platformCompile ErrorsIf there's a compile error it will show in the build window. Just for fun, let's intentionally create a syntax error. Go to the code window for the WeatherCalc.csl file. Find a blue key word and misspell it. The first blue word I see is "variables". I'm going to change the spelling to "bariables". Now with the "Windows Release" or "Windows Debug" selected as the target, click the compile button (or menu option).
In the build window all the compile errors are shown. You want to start with the first one, and double click on it. It will take you to the corresponding line in the source code window. From the compile error message, and your knowledge of CASL, you'll normally be able to figure out what's wrong. For us, we need to only change the spelling back to "variables". Runtime ErrorsUsually compiler errors are easier to fix, than the runtime problems that come up from wrong logic or unexpected results. It's the later runtime errors that the CASL debugger is expert at handling. The CASLide Manual goes into details about all debugger operations, so I'll only summarize here. It's possible to single step through your program in 3 ways. You can step line by line. You can step line by line within your function, but not step into nested function calls. You can step until cursor. You can set breakpoints. You can watch multiple variable values in the watch window (build window). You can have multiple watch target windows. A typical debug session might look as follows.
Compile, Make and Install your program on PDA platformsPalm OSWell we've written and tested our new application. Let's get it on a Palm device where it belongs. The detailed steps are as follows
Creator ID and Desktop NameThe first step is only critical if you'll be making a PRC file, but this is normally the case. You can also read about CSM program file options in the CASLide Manual. You make PRC settings by using the Project | PRC Settings menu option.
The creator id must be unique. If you'll be distributing your application to others you'll want to register your creator ID at the developer area of Palm, http://dev.palmos.com/creatorid/. Select Target and CompilerThe next 2 steps are essential.
Select the "Pilot Release" target with the dropdown list. Do not select the Pilot Debug target. This option is not supported. The menu option Build | C Build is unchecked if you'll be compiling with normal (p-code) CASL, and is checked if you'll be compiling with CASLpro (and PRC Tools and GCC). Compile, Make, and InstallThe next 3 steps can be combined by selecting a later step, which will automatically perform the prior steps, as needed. For example if you'd like to proceed directly to the Install step, you could select this menu option or toolbar button, and if a compile and make are needed they will be performed automatically.
The Compile, Make, and Install menu options are all on the Build menu. There are also toolbar buttons. If you hover the mouse cursor over a button, a tips note will display the button's purpose. The last Install step is essential as it transfers the PRC from the Palm install folder on your PC to your Palm device. If you want to test your Palm application on the POSE (Palm OS Emulator), you would stop after the Make PRC step. You'd install the PRC file to your POSE by using the "Install Application/Database" menu option of your POSE. The PRC file (Palm Resource) has same name as your project. In our case the file is called WeatherCalc.prc. The file is located in the ".\Pilot Release\" subfolder off our project folder. A CASLpro compile consists of the CASLpro compiler taking the CASL code and creating C code. You can see these C files in the ".\Pilot Release\" subfolder off our project folder. A CASLpro Make PRC consists of calling a C_Build.bat file in the background to call PRC Tools and GCC with the C files, any C library files you had included in your project, adn the necessary Palm OS support files, and these are compiled into native object files (O). These are linked and made into a native executable (PRC). If you're having problems with this, see the GCC Troubleshooting FAQ on our site, http://caslsoft.com/caslprofaq.htm. Install any support runtime, library, and database filesIf you've compiled your program with the normal CASL compiler, your program requires that the CASL runtime file, CASLrt.prc, be on your Palm device. Use the Palm Install utility to do this. The CASLrt.prc file is in your ".\CASLxx\PilotFiles\" folder. The full path will depend on your installation, but it's default location would be in the form of, "C:\Program Files\CASLsoft\CASLxx\PilotFiles\". You need to do this only once, or until a newer version is released. CASL programs that perform floating math, require the MathLib.prc file. This is true whether the application has been compiled with normal CASL or CASLpro. MathLib.prc is in the same ".\CASLxx\PilotFiles\" folder as the CASL runtime file. The O'Clock sample application requires this file on your Palm device. Use the Palm Install utility to do this. The normal CASL compiled version of the DaysBetween sample application makes use of the CASL_Palm_Utils.prc external library. This file must be installed on our Palm. The file is located in your ".\CASLxx\Samples\" folder, in a zip file with the same name. Use the Palm Install utility to do this. The CASLpro compiled version of the DaysBetween sample application does not require the presence of this library file (since the C code is compiled directly into the DaysBetween program file). Some applications require a database to run. The O'Clock application has a database called oclkZones.cdi. This file must be copied to your CASL hotsync folder, normally of the form, "C:\Palm\user\Casl\". The CASL conduit will install this database file on the next Hotsync operation. As you write your own programs, you'll know what files you'll need. The CASLide Manual gives additional details about CASL databases, and the CASL conduit. The CASL Language Manual indicates which math functions require the MathLib library. Hotsync Operation
WinCE and PocketPCWinCE 2.11 runtime files are on the beta site, available to all registered users. PocketPC (WinCE 3.0) runtimes are planned. The installation procedure is similar to the discussion above. You select the "Windows Release" target. You can use Project | Project Settings to change screen size and fonts. You can use Tools | IDE Settings to specify an Install Folder. The menu option Build | Install WinCE will perform the necessary compile, make, and install steps. There are a number of runtime and support files that must also be installed on your WinCE device. For details, see the CASLwinCE.txt file provided with the WinCE runtimes. |
[ Top ] © 2001, Feras Information Technology. All rights reserved. |