PsiFS: File Format Converters

PsiFS Module Example

PsiFS Module Example

An example file format converter configuration for the *PsiFSTar and *PsiFSSIS commands has been included in the directory !PsiFS.Converters.!PsiFS. This allows the contents of tar and SIS files to be extracted or listed. A print job launcher and a very simple converter for EPOC clipboard files have also been included.

Please note that since the file format converter interface uses the !Scrap directory to store temporary files, filenames may be truncated unless long filenames are supported on the drive where !Scrap is located.

The following sections describe each of the files within the sub-directory.

!PsiFS

The !PsiFS file tells PsiFS all of the important characteristics of the file format converter.

The first section of the file sets default conversion options, and this is followed by the converter configurations. Multiple converter configurations with different options are specified for each command; this is necessary if different output file types are produced.

The PsiFSCapture alias defined within the !Boot file is used to capture the output from a command to a specified file. The PsiFSInstall, PsiFSConvert and PsiFSPrint aliases are used to start BASIC programs to perform other special operations.

!PsiFSRes

The !PsiFSRes file contains the toolbox template used to select conversion options for SIS files, and launch options for print jobs. There are no user selectable options for the conversion of tar files.

A String Set gadget is used to allow selection of the installation drive. It is not possible to generate the list of available options dynamically when the conversion is performed, so a static list offering just drives C and D is specified in the toolbox resource file.

!Boot

The !Boot file is run by PsiFS at start-up using Wimp_StartTask.

This starts by defining the textual version of the supported file types to ensure that the !PsiFS file can be correctly parsed. The file format converter is then registered by defining the system variable PsiFSConverter$PsiFS to point to the current directory. Another set of system variables (PsiFS$ConverterScrap, PsiFS$ConverterInstall and PsiFS$ConverterScrap) are defined to specify the names of temporary files. Finally, aliases for PsiFSCapture, PsiFSInstall, PsiFSConvert and PsiFSPrint are defined to run the Capture, Install, Convert and Print programs respectively, enabling simpler commands to be used within the !PsiFS file.

!Run

The !Run file is not normally run; it is included solely to provide a friendly error message if someone does try to run it.

Capture

The Capture file is a simple BASIC program that executes a command with the output captured to a text file.

This program is used instead of a simple command alias to ensure that the output file is deleted if an error occurs. This behaviour is required by the PsiFS file format converter interface.

Convert

The Convert file is a simple BASIC program that performs a straightforward bidirectional conversion between EPOC clipboard and text files.

PsiFS_GetTranslationTable is used to obtain a character translation table between the Windows ANSI character set used by EPOC and the Latin1 character set normally used by RISC OS. A few additional translations are then added to handle some peculiarities of EPOC files.

Install

The Install file is a simple BASIC program that starts an asynchronous remote operation to install a SIS file.

The first step is to make a copy of the SIS file to ensure that it is still available after the file format converter interface has deleted any temporary files. PsiFS_AsyncStart is then used to start the installation, and Message_PsifsAsyncStart is broadcast to open an action window.

Finally, a dummy output file is created to signal to PsiFS that the "conversion" has been successful.

Print

The Print file is a simple BASIC program that sends a message to the PsiFS filer to process a print job file.

Like the Install program, the first step is to make a copy of the print job file to ensure that it is still available after the file format converter interface has deleted any temporary files. Message_PsifsPrint is then broadcast to open a print job window.

A dummy output file is created to signal to PsiFS that the "conversion" has been successful, and the temporary copy of the print job file is deleted.

AddRemove

The AddRemove file is a copy of the InstExe.exe executable used to install the Add/remove control panel icon. This is copied to an EPOC device and run to install the necessary files.

[Contents] [Up] Copyright © Alexander Thoukydides, 1998, 1999, 2000, 2001, 2002