Pascal Compiler DDE Frontend
by Carol Haynes

Running this application opens a directory window containing the application directory !PascalDT, the application file PascalDT, and the C source file used to create the PascalDT file.

PascalDT is a Desktop interface to Acorn's ISO Pascal (Release 2), using the DDEUtils module to provide throwback facilities in the same way as Desktop C and Desktop Assembler. The necessary modules can be found in the !System.Modules directory on this disc, but you will need ISO Pascal to use the application.

The application directory !PascalDT should be placed with the other tools in the DDE directory. The PascalDT application file (note no '!') should be placed in the library directory alongside Pascal.

PascalDT expects the system variable <Wimp$ScrapDir> to be set to a suitable directory for storing temporary files used during compilation - this can be set by running the Scrap application on this disc. This is in addition to the @.tmp and @.dec directories required by the ISO Pascal compiler itself. If <Wimp$ScrapDir> is not set then PascalDT sets it to '!PascalDT.tmp'.

Note that PascalDT saves object files by default in the 'o' directory rather than 'aof'. This conforms to more recent Acorn practice for naming object files. If this is inconvenient then change "o." to "aof." on line 12 in the file '!PascalDT.Desc'. Also line 6 of this file determines how large a WimpSlot to provide for PascalDT (and Pascal) to run in. This is set to 640K, but if you have the memory you may wish to enlarge this to allow in-store compilations more easily.

Using PascalDT
~~~~~~~~~~~~~~

Running the !PascalDT application loads it onto the icon bar in the usual way. Dragging a Pascal source file to the icon opens the main window. Alternatively click Select on the icon bar icon and drag the source file to the window icon labelled Source.

There are four options available in the window; the Pascal command line equivalent of the option is shown in capitals underneath (-throwback is a PascalDT option).

Produce Listing
(-LISTING)
When selected a full annotated listing is sent to the output window during compilation, otherwise only a brief summary is reported.

Syntax check only
(-NOOBJECT)
When selected the source file is compiled as normal but no object file is produced. This allows syntax checking to be performed.

Debug
(-DEBUG)
Produce full debugging information in the object file.

Throwback
(-throwback)
Show errors in a throwback window allowing instant editing of source code.

Clicking with the Menu button over the window reveals an options menu as follows, and where applicable each is followed by its equivalent Pascal command line option and the initial defaults:

Command line 
* Use extensions    -EXTEND
* Version id        -IDENTIFY
Add log info      -LOG (enhanced by PascalDT)
No checks         -NOCHECKS
No diagnostics    -NODIAGNOSTICS
* Allow \ sequences -SLASH
* Compile in memory -STORE
Other 

Note that 'Command line' and 'Other' lead to writable menu items allowing for further tailoring of the system. Altering the 'Command line' and pressing Return will execute that modified command immediately. The changes you make will not be reflected elsewhere in the window and menu. The 'Other' section allows other command line options to be added to the command line and retained for further compilations. Note that any overlap between options set in the window or elsewhere in the menu will be overridden by those set in the 'Other' entry. For example, if you enter -DEBUG V into the 'Other' part of the menu then the full -DEBUG set from the main window will be overridden and only the V version of -DEBUG used in the final compilation.

Clicking Menu over the icon bar icon leads to the usual menu structure for DDE tools as described in the DDE manual.

System requirements
~~~~~~~~~~~~~~~~~~~

ISO Pascal Release 2 compiler

FPEmulator 2.80
Clib       3.75
FrontEnd   1.13
TaskWindow 0.29
DDEUtils   1.50

Sufficient memory to run the above modules, ISO Pascal and this program (probably 2 Mb minimum).

Desktop C if you wish to modify or recompile the application.

How it works
~~~~~~~~~~~~
!PascalDT is an application directory which contains the necessary files to integrate with the FrontEnd module. Unfortunately ISO Pascal predates the throwback facilities provided by FrontEnd and so this program acts as a pipe, catching output from Pascal compilations and extracting error messages and directing them at DDEUtils to use the throwback facilities.

At its simplest PascalDT constructs a command line of the form:
PascalDT <source> [Pascal options] [-throwback] -ob <objfile>

PascalDT reads the command line arguments and executes:
Pascal <source> [Pascal options] -ob <objfile> { > temp }
i.e. Pascal is invoked and output redirected to a temporary file.

PascalDT examines the temporary file and lists its contents by simply printing them. DDEUtils catches this into the output window. Each line is then examined for a compiler message. If a message is found the line number of the error is extracted from the previous two lines of output and the throwback SWI invoked (assuming -throwback is specified in the PascalDT command line) to set up and send messages to a throwback window.

Finally an error log is produced and printed and the temporary file containing the object code is date stamped (ISO Pascal doesn't always seem to do this). The temporary file for redirected output is deleted and a return code is sent to the calling program, 0 for success or warnings, 1 for simple errors and 2 for fatal errors.

DDEUtils presents a save box for the object file if one is produced and the temporary object file is copied as requested by dragging the file to a directory as usual.

Notes
~~~~~

This program is not much use without the DDE tools provided only with Desktop C and Desktop assembler. In particular a Desktop compiler is not much use without a Desktop linker! Also throwback will only work with SrcEdit at present.

If you use Pascal with assembler or Pascal with C then this revamps a rather neglected Archimedes language tool and makes it easy to use and to integrate with the DDE. Alternatively Acorn could make the DDE tools available separately for more general use - perhaps even an APCS conformant version of ISO Pascal could be released to allow interworking with C code libraries.

PascalDT will also interact with the Make application by adding these lines at the begining of the file !Make.choices.tools:
PascalDT
pas
-ex -id -sl -throwback
PascalDT $< $(pascaldtflags) -ob $@
DDE:DDE.!PascalDT.desc
DDE:DDE.!PascalDT.!setup

Also if you want to add facilities to SrcEdit (eg. a Pascal help system) you can do this by looking at the relevant sections in the DDE manual.

 RISC User 1992
