Extended Pascal 3.2
Bill Catambay, Pascal Developer
by Bill Catambay, 6/27/02.
4 out of 5 Mice.
Prospero Software's Extended Pascal is a 32-bit Pascal compiler for Windows 98 and Windows NT. Prospero supports both the unextended Pascal Standard and the Extended Pascal Standard, and adds a third layer of support for Object Pascal, exception handling, and the Windows environment. It is modeled similar to Turbo Pascal, and comes with a rudimentary IDE for editing, compiling, and linking source code.
Oddly enough, Prospero Pascal comes on a set of four floppy disks. It's been a long time since I've had to install anything off of floppy disks. I would have preferred one CD versus inserting and removing four floppies. Nevertheless, the software installed without a problem. I was immediately up and running in the Extended Pascal IDE (called the EP Workbench), and began compiling sample code right away.
After several test compilations, and after browsing the Language Reference manual that comes with the software, I am quite impressed with Prospero's Pascal. It provides full support of both the unextended Pascal Standard and the Extended Pascal Standard, complete with upward-compatibility. In fact, there are four levels that the programmer can choose from. Levels 0 and 1 support the unextended Pascal Standard (ISO 7185), with the difference between the two being that Level 1 includes conformant arrays while Level 0 does not. Level 2 supports Extended Pascal (ISO 10206), and Level 3 augments Level 2 by including object-oriented features (many of which are outlined in the Object Pascal Technical Report), exception handling features (such as RAISE, IS and TRY for handling exceptions), and some additional extensions to the language. The following is a summary of the Prospero additions to Extended Pascal that are not in the Extended Pascal Standard:
Class types can be defined. Additional types include:
wchar, byte, shortint, word, shortreal, shortstring, widestring, ptr, DayOfWeek, FileNameType
PROCEDURES & FUNCTIONS
setlength, ltrim, concat, copy, pos, delete, insert, wchr, WideToString
OpenRead, OpenWrite, connect, HandleOf, echo, close
arcsin, arccos, tan, sinh, cosh, tanh, inc, dec, min, max, int, frac, pi, rand, seed
newmem, dispmem, memavail, HeapUsed
bit & byte operations:
testbit, setbit, clearbit, flipbit, move
IsDigit, IsAlpha, LowerCase, UpperCase
addrof, taddrof, sizeof, FieldOffset, assert, raise, RaiseUser, exit, return, stkavail, StackUsed,abstract, class, constructor, destructor, except, is, on, property, rem, shl, shr, try, view, xor
In addition to the built-in language constructs, Prospero also includes some libraries and library interfaces to better support the Windows environment. The libraries include routines for text manipulation, time functions, graphics, file I/O, and more.
Prospero supports Extended Pascal's modularity using Import and Export. Modules can export colections of definitions as "interfaces", and then these interfaces can be imported by other modules or the main program. For those accustomed to using Units and Uses, the rules associated with Import and Export with modules really take some getting used to. Once mastered, they do offer more flexibility.
There is much to discuss as far as the language goes, but that discussion is covered fully in the Pascal Standards themselves. For a more in depth look at what Prospero Extended Pascal supports, read through the unextended and Extended Pascal Standards.
The IDE is called the EP Workbench, and allows you to use menus to open files, and then compile, link and debug those files. The IDE does not include a project manager window; rather, you must manage your files manually. You can set up a "Make" file for handling all the necessary compilations and linking for a particular project, but this too must be done manually. It does include it's own editor, but this is a very rudimentory editor. It does not provide automatic stylizing or colorizing for Pascal keywords; in fact, it didn't even support right-click contextual menus for options like copy and paste (these options are available from the Edit menu).
In short, this IDE is very basic. Managing projects took some getting used to. When working on a project with multiple modules, you have to manually set the "Link Options" to include the additional modules, and I found that you had to do this on all subsequent builds (i.e., it did not retain this setting). I found that the "Set Home Directory" option also needed to be done on each build, as it kept reverting to its default home directory (the SOURCES folder). When working on a project within it's own folder, you need to reset the Home Directory to that folder for successful compiles and linking.
If you prefer to use separate compile and link operations from the Workbench to make projects, you can use the "Save settings" and "Restore settings" operations from the Options menu to avoid the need to list additional modules each time. The settings include compiler and linker options, as well as paths and so on.
There were several other menu options available, such as compiler options, linker options, diagnostics, debugging, and more. All of the options are accessed via menus, and provide a satisfactory means to edit, compile, link and debug Pascal programs.
I took a look at some of the sample Make files, but for this review I chose not to spend too much time understanding the architecture of the Make files. Essentially, you create a script of compilation and link commands that result with the desired executable. The following is a sample of a Make file which incorporates multiple files and modules. The source for this project includes four Pascal files (North.pas, South.pas, East.pas and West.pas) and two header files (East.Hdr and West.Hdr).
COMP = """$(PMPATH)EPComp.Exe"""
COPT = -b -g1 -lx
LINK = """$(PMPATH)EPLink.Exe"""
XRUP = """$(PMPATH)XRUpdate.Exe"""
XRLOOK = $(XRUP) Lookup
XRSEL = lev=exp,imp,1
OBJS = North.Obj South.Obj East.Obj West.Obj
# Linking the Exe file
Compass.Exe : $(OBJS)
$(LINK) -w -tCompass.Exe $(OBJS)
# Compiling the components
North.Obj : North.Pas SouthMain.Ifc \
$(COMP) $(COPT) North.Pas
$(XRLOOK) North.Xrf $(XRSEL)
South.Obj SouthMain.Ifc SouthMods.Ifc : South.Pas
$(COMP) $(COPT) South.Pas
$(XRLOOK) South.Xrf $(XRSEL)
East.Obj : East.Pas East.Mcf SouthMods.Ifc
$(COMP) $(COPT) East.Pas
$(XRLOOK) East.Xrf $(XRSEL)
East.Mcf East.Ifc : East.Hdr
$(COMP) $(COPT) East.Hdr
$(XRLOOK) East.Xrh $(XRSEL)
West.Obj : West.Pas West.Mcf SouthMods.Ifc
$(COMP) $(COPT) West.Pas
$(XRLOOK) West.Xrf $(XRSEL)
West.Mcf West.Ifc : West.Hdr East.Ifc
$(COMP) $(COPT) West.Hdr
$(XRLOOK) West.Xrh $(XRSEL)
The example above includes the commands to generate a cross-module index that can then be examined using the "Project lookup" in the Tools menu.
Being unfamiliar with the Make commands, the above could seem a bit intimidating. The Make approach, however, is worth getting to understand because of its excellent flexibility. The Make process is the natural way to construct multi-module programs that may depend on new versions of libraries or foreign modules, as well as on changes within the project itself. There is even a "Repeat make" entry in the Build menu, and one of the compiler options causes it to output the targets and dependencies ready for the Make file entry for a module.
It should also be noted that the compiler and linker are free-standing programs that are used by the Workbench. Alternatively, they could be called from a command line, the Make program, or even another IDE.
Prospero Pascal comes with a source level debugger called Probe. The debugger allows you to step through the execution code, and examine and modify program variables. It provides for watch flags such that when a specific variable changes in value, the program halts.
I found the debugger to be quite functional, albeit the GUI interface is rather rudimentary. Debugging control is done from the "Breakpoint" dialog, with buttons for examining variables, finding locations, setting breakpoints, resuming execution, stepping to the next statement, stepping into a function or procedure, and a button for "Go to caret line". For those familiar with IDE's like CodeWarrior where you can click on a line of the source code to set a break point, and click on a variable to view it's value, Probe does not deliver in terms of ease-of-use. Viewing a variable takes you to another window, where you can specify the scope to look in and the variable to examine. Setting breakpoints also takes you to another window where you can set a breakpoint at the caret line, a specific procedure or function, or on a condition. You can click in the displayed source, then go back to the breakpoint window and choose "caret line" to set a breakpoint where you clicked. The "caret line" term can be misleading, as many times there was no caret line visible. You can always see where the breakpoint is being set by looking at the debugger log (which is displayed in its own window).
For a single module program, I did not experience any problems with the debugger. When debugging the multi-module "Compass" project, I did get confused in a couple of places. First, every time I started it up, I got an error it appears that a new window opens up whenever a new module is invoked, and the current module window does not always come to the foreground. Also, I found that once I stepped into a procedure, I couldn't find an easy way to step out of it. There was no "Step Out" button that I could see, and stepping past the end of the procedure did not provide the expected result of exiting and returning to the calling code. I tried clicking "Go", and the Breakpoint window disappeared on me (and I couldn't figure out how to get it back). In one instance, after the breakpoint window disappeared and I tried to close the rest of the windows, I got an access violation error and Probe quit on me. I finally escaped the procedure by going to the window containing the main program, clicking on a line to setup the caret line, then choosing "Go to caret line". It was far from intuitive, but it worked.
Prospero Pascal comes with an excellent set of books. First there is Extended Pascal and Objects A Practical Guide, which provides a great overview of the Pascal language, including Extensions and Objects. This guide discusses Arrays and Records, File extensions, Date and Time, Character Strings, Modules, Nonstatic types, Object-oriented programming, Exception handling, and non-standard additions to the language.
The second book is the Prospero Extended Pascal Users Manual. This book starts with a good introduction to Prospero Pascal. It then provides instructions on using the Workbench, including all the menu options, keyboard shortcuts, and online help. The following chapters discuss the compiler, the linker and librarian, Pascal executables, the symbolic debugger, the Promake utility, and other tools (such as the preprocessor and cross-module index).
The third book is the Prospero Extended Pascal Language Reference Manual. This book starts with an introduction that discusses language levels, modularity, binding, protected variables, and more. It then discusses the language by Lexical tokens, blocks and scope, labels, constants, types, variables, and procedures and functions. Chapter 9 provides a full list of all the predefined procedures and functions, followed by a chapter on expressions (primaries, operators, etc.), statements, and program components. Chapter 13 discusses the Object-Oriented features, followed by a chapter on run-time exceptions. The Appendix provides a summary of the additions in Prospero Pascal to the Extended Pascal Standard. Also contained in the third book, following the Language Reference manual, is a second manual called Prospero Extended Pascal Library Definitions Manual. This manual discusses the several library calls available in Prospero when using the Extended Pascal Library.
Finally, the one thing that I have always learned more from than any manual is sample source code. Prospero provides some sample programs with the compiler, and additional samples on their web site. The samples included modular programs as well as a text and graphic handling programs. What I found lacking was a good set of event driven Windows programs, complete with it's own menu handling and event handling routines. Most of the samples I ran created basic output to a console window. Although there was some code that demonstrated this in WinDemos, the sample code was not the strong point of the software package.
As a Pascal compiler, Prospero provides remarkable support for the unextended and Extended Pascal Standards. It also supports some additional features that are common with other Pascal dialects, including Object Pascal. I found that the IDE and debugger were fully functional, but far from intuitive. Learning how to setup a Make script for a project was no easy task either (although those familiar with Apple's MPW environment may not be as put off as others). With its support of Extended Pascal, Prospero provides a very robust compiler for the Windows platform, providing an easy-to-use environment for doing basic Pascal programming. For more intensive programming, a better understanding of the Prospero IDE is required, including the Make and Debugging facilities. Understanding how to build a full featured Windows application is a task left to the user as well, since there was minimal sample code which demonstrated this.
In summary, there are limitations to the interface, it could be made more intuitive, and some better sample code would be a benefit, but as far as providing a fully functional compiler and linker for programming in Pascal, Prospero delivers a gem.
4 out of 5 Mice