PsiFS: File Format Converters

!ChangeFSI Example

!ChangeFSI Example

An example file format converter configuration for !ChangeFSI has been included in the directory !PsiFS.Converters.!ChangeFSI. This allows common graphics formats (GIF, PCX, BMP, PBM, JPEG, TIFF, and Sprite files) to be converted to either Sprite or JPEG files with a selectable number of bits per pixel.

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 for all of the supported file types. This is followed by a separate converter configuration for each combination of output format and conversion options. Note that all of the converters in this example support the same input file types, so these are defined once within the shared characteristics section.

The PsiFSChangeFSI alias defined within the !Boot file is used to perform all of the conversions, with additional parameters specifying the required behaviour.

!Boot

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

This starts by defining the textual version of all the supported file types to ensure that the !PsiFS file can be correctly parsed. Next, the file format converter is registered by defining the system variable PsiFSConverter$ChangeFSI to point to the current directory. Finally, an alias for PsiFSChangeFSI is defined to run the !Run file, enabling simpler commands to be used within the !PsiFS file.

!Run

The !Run file is run by PsiFS using Wimp_StartTask when the converter is called via the PsiFSChangeFSI alias.

It starts by ensuring that there is sufficient memory to run ChangeFSI. If necessary, the FindFSI BASIC program is then used to locate !ChangeFSI if has not already been seen by the filer. Finally, the ChangeFSI executable is run to perform the required conversion, and any error is reported.

FindFSI

The FindFSI file is a simple BASIC program that searches for !ChangeFSI in likely locations. If a copy is found then its !Boot file is run to set the necessary system variables.

This program is only required because the file format converter is not contained within the same directory as the configuration files.


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