PsiFS: File Format Converters

!PsiFS

!PsiFS

A file called !PsiFS is required to describe the characteristics of each file format converter.

The !PsiFS file is split into several sections, each terminated by a line containing <EOF> on its own. Within each section, lines of the form tag=value are used to associate a value with a tag. Any other lines are treated as comments which are ignored; no special prefix character is required.

Note that both case and spaces are significant. In particular, trailing spaces prevent recognition of the <EOF> token, so if problems are encountered it is worth checking that there are no invisible trailing spaces.

Defaults

The first section of the !PsiFS file specifies default options. These are automatically copied to the PsiFS options file (either !Boot.Choices.PsiFS.Options or !PsiFS.Config.Options, depending upon the computer's configuration) if the associated tag is not already defined.

The tags currently associated with selecting file format converters are:
TagDescription
ConvertAny conversion.
Convert_typeAny conversion of type file.
Convert_type_StandardStand-alone conversion of type file.
Convert_type_InterceptLoadLoading a type file into receiver.
Convert_type_InterceptLoad_receiver
Convert_type_InterceptRunRunning a type file from sender.
Convert_type_InterceptRun_sender
Convert_type_InterceptSaveSaving a type file from sender to receiver.
Convert_type_InterceptSave_sender
Convert_type_InterceptSave_sender_receiver

In these tags type is the file type as a three digit upper-case hexadecimal number, sender is the name of the task sending the file, and receiver is the name of the task receiving the file. Both sender and receiver are the task names displayed by the Task Manager, but with any spaces or equals signs removed.

The value associated with each of these tags is the Tag of the file format converter to use, or blank if no conversion should be applied.

When a conversion is required, PsiFS uses these options to select the default file format converter, starting from the most specific matching option and continuing until a selectable file format converter is found. This behaviour is especially important if automatic conversions are enabled.

The following additional tags are associated with the options for the file format converters:
TagDescription
ConvertOptions_TagThe most recently used options.
ConvertOptions_Tag_VersionThe Options value of the converter, used to detect changes and prevent use of incompatible options.

It should not be necessary to include these tags within the !PsiFS file; they are described here for completeness. It is more effective to set default options within the !PsiFSRes toolbox resource file.

Each time a conversion is performed, PsiFS automatically updates the appropriate defaults to ensure that the most suitable conversion and options are selected for successive operations.

Shared Characteristics

The second section of the !PsiFS file defines tags that apply to all converters. These definitions are overridden by a tag of the same name specified for an individual file format converter.

See the individual characteristics defined below for details of the available options.

Individual Characteristics

The following tags may be defined for each converter:
TagTypeDescription
TagRequiredName to use for the converter in PsiFS configuration files. This is currently only used to specify the default converter, but in the future it may also be used to store converter specific options.
NameRecommendedText to display in the Name field of the Info window. This should normally be the name of the tool used to perform the conversion.
AuthorRecommendedText to display in the Author field of the Info window. This should normally include any copyright message.
VersionRecommendedText to display in the Version field of the Info window.
PurposeRecommendedText to display in the Purpose field of the Info window. This should normally describe the individual file format conversion.
WebSiteRecommendedURL to launch if the Web site button in the Info window is clicked. This should normally be the site associated with the converter.
DescriptionRecommendedMenu entry for this file format converter. This should normally include both the source and destination file types.
InputRequiredList of supported input file types.
InputUIDOptionalSpace separated list of supported input file UIDs. The UIDs should be specified in the same format as for *PsiFSMap, i.e. as 24 digit hexadecimal numbers. If this tag is left blank then no restrictions are placed on the input UID.
InputNameOptionalSpace separated list of supported input leaf names. Standard wildcards may be used, for example to check for specific extensions. If this tag is left blank then no restrictions are placed on the input file name.
OutputRequiredSingle file type produced by the file format converter.
InterceptLoadOptionalList of file types to intercept when loaded by dragging within the desktop.
InterceptRunOptionalList of file types to intercept when run by double-clicking within the desktop.
InterceptSaveOptionalList of file types to intercept when saved or transferred between applications by dragging within the desktop.
OptionsOptionalDefinition of user selectable options.
ConvertRequiredThe Convert tag specifies the command used to perform the conversion. The source and destination filenames and the original leafname are substituted for the character sequences <src>, <dest> and <orig> respectively. Any options specified using the Options tag are substituted for the character sequence <opt>

File type lists consist of a space separated list of RISC OS file types, specified in either numeric or textual form. The following special file types are also supported: Directory, Application and Untyped. However, although they are fully supported, it is recommended that these special file types are not used to trigger file transfer intercepts.

The list of files to intercept only apply if enabled within the PsiFS configuration, and may be overridden by the user pressing Left Alt to force an intercept or Right Alt to prevent an intercept.

The Options value starts with the name of a toolbox template from the !PsiFSRes file, followed by a space separated list of "-keyword gadget" pairs. The -keyword is the option that will be substituted for the <opt> character sequence within the Convert string, and gadget consists of a single letter gadget type followed by the component ID of the gadget in hexadecimal. Note that the options are sorted before use; ordering is not preserved.

Running Converter

The file format converter is run using Wimp_StartTask, so almost any command may be used. However, PsiFS assumes that the conversion will have been performed when control is returned, so multi-tasking converters are not supported.

If the converter is unable to handle the supplied file then it should generate an error using either OS_GenerateError or Wimp_ReportError and exit without producing an output file. PsiFS will not display any error messages itself if no output file is found. Error messages should not be output via the VDU drivers (stdout/stderr for a C program); if necessary output should be redirected to a file and post-processed to convert any messages to RISC OS errors.

Future versions may support converters running in a TaskWindow; this will be controlled by additional tags specifying the capabilities of individual converters.


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