Introduction and Overview
This chapter groups the wrappers that manipulate host-side files in RISC OS-aware ways. It covers filetype-setting, directory creation, selective deletion, plain-text output, and resource dependency scanning for application bundles.
Technical Details
Filetype and directory helpers
Utilities such as riscos-settype, riscos-copy, riscos-cdir, riscos-wipe, and riscos-destroy help preserve or manipulate RISC OS file conventions from the host environment.
This group also includes the BASIC conversion tools riscos-basictokenise and riscos-basicdetokenise, which convert between editable textual BASIC sources and tokenised BASIC program files.
riscos-settype takes a target file and a destination filetype. The type may be written as a hexadecimal value in the range 000 to FFF, or as one of the symbolic names compiled into the tool. Symbolic names are matched case-insensitively.
The copy and deletion wrappers intentionally stay close to the classic RISC OS command names, but several compatibility flags are accepted only for command line compatibility. In particular, riscos-copy and riscos-wipe recognise the usual FileSwitch-style flag letters while only acting on verbose mode. riscos-cdir is the simple recursive directory-creation tool for build scripts, while riscos-destroy is the exact-name cleanup tool when wildcard deletion would be too broad.
For textual inspection, riscos-kitten is a small cat-style tool which accepts RISC OS filename conventions and can number or annotate text output. For Toolbox applications, riscos-resversions scans resource files and emits the module-loading commands needed to satisfy the components and gadgets they use.
The tool recognises the following built-in symbolic names:
| Name | Filetype number |
|---|---|
| Text | &FFF |
| Command | &FFE |
| Data | &FFD |
| Utility | &FFC |
| BASIC | &FFB |
| Module | &FFA |
| Sprite | &FF9 |
| Absolute | &FF8 |
| BBCFont | &FF7 |
| Font | &FF6 |
| PoScript | &FF5 |
| DMData | &FF4 |
| LaserJet | &FF3 |
| RawData | &FF1 |
| TIFF | &FF0 |
| Diary | &FEF |
| NotePad | &FEE |
| Palette | &FED |
| Template | &FEC |
| Obey | &FEB |
| Desktop | &FEA |
| ViewWord | &FE9 |
| ViewPS | &FE8 |
| ViewSheet | &FE7 |
| UNIXEx | &FE6 |
| EPROM | &FE5 |
| MSDOS | &FE4 |
| Atari | &FE3 |
| Amiga | &FE2 |
| Makefile | &FE1 |
| Accessry | &FE0 |
| VTScript | &FDF |
| VTSetup | &FDE |
| MasterUtl | &FDD |
| SoftLink | &FDC |
| TextCRLF | &FDB |
| MSDOSbat | &FDA |
| MSDOSexe | &FD9 |
| MSDOScom | &FD8 |
| TaskObey | &FD7 |
| TaskExec | &FD6 |
| Pict | &FD5 |
| MIDI | &FD4 |
| DebImage | &FD3 |
| SrcDiff | &FD2 |
| BASICTxt | &FD1 |
| PCEmConf | &FD0 |
| FontCache | &FCF |
| Device | &FCC |
| Squash | &FCA |
| SunRaster | &FC9 |
| MSDOSDisc | &FC8 |
| AIFF | &FC2 |
| Profile | &FC1 |
| Label | &FBF |
| Schedule | &FB8 |
| Plotter | &FB7 |
| Agenda | &FB6 |
| DiscCRC | &FB3 |
| AVI | &FB2 |
| WaveForm | &FB1 |
| Allocate | &FB0 |
| HTML | &FAF |
| Resource | &FAE |
| MethodGen | &FAD |
| HCL | &FAC |
| Observess | &FAB |
| UltiLabel | &FAA |
| Montage | &FA9 |
| EasyFont | &FA8 |
| Invent | &FA6 |
| Clicker | &FA5 |
| SmartKill | &FA4 |
| HomeWorks | &FA2 |
| CitApps | &FA1 |
| Access1 | &F9F |
| Access2 | &F9E |
| Access3 | &F9D |
| QueryU | &F9C |
| QueryH | &F9B |
| QueryL | &F9A |
| OMIDraw | &F99 |
| GenSound | &F96 |
| GenCode | &F95 |
| SCBBlk | &F94 |
| NCDown | &F93 |
| Font16 | &F92 |
| URI | &F91 |
| ResChain | &F90 |
| GNUZip | &F89 |
| RealAud | &F88 |
| Matrix | &F86 |
| WideEnc | &F85 |
| IMEDict | &F84 |
| MNG | &F83 |
| JAR | &F82 |
| JSScript | &F81 |
| XML | &F80 |
| CSS | &F79 |
| JSON | &F75 |
| YAML | &F74 |
| DXF | &DEA |
| SuperCalc | &DB4 |
| DBaseIII | &DB3 |
| DBaseII | &DB2 |
| DBaseNDX | &DB1 |
| WK1 | &DB0 |
| Mode7 | &D16 |
| HPGLPlot | &CAE |
| Manual | &C2F |
| BBCROM | &BBC |
| PNG | &B60 |
| Draw | &AFF |
| PhonePad | &AFB |
| Query | &AF5 |
| &AF4 | |
| Disc | &AF3 |
| Nova | &AF2 |
| Music | &AF1 |
| Alarms | &AE9 |
| PCWord | &AE6 |
| Python | &AE5 |
| Java | &AE4 |
| Director | &AE3 |
| QVAlbum | &AE2 |
| QVCam | &AE1 |
| SawFS | &AE0 |
| &ADF | |
| ICA | &AD0 |
| SVG | &AAD |
| Zip | &A91 |
| WebP | &A66 |
| JPEG2000 | &A65 |
| PBMPlus | &69E |
| BMP | &69C |
| PCX | &697 |
| GIF | &695 |
| Clear | &690 |
| FLAC | &1CF |
| AMPEG | &1AD |
| JFPatch | &13C |
| ICO | &132 |
| Perl | &102 |
If the supplied type is neither a valid hexadecimal value nor a recognised symbolic name, the tool reports Type 'name' not known.
The file name is normalised through the CLX filename parser before the type is set. The parser is initialised with the suffix list c o h s c++, so those suffixes are treated as recognised source language suffixes during name translation.
If the file cannot be examined or updated, the host wrapper reports the failing rename through the C library as Settype and then prints Failed to set filetype of file.
Commands
<file> | - | The file whose filetype is to be changed. |
<type> | - | Destination filetype, written as hexadecimal 000 to FFF or as one of the recognised symbolic filetype names. |
riscos-settype is the host-environment form of SetType. It keeps the original two-parameter interface: one file and one destination type, with no switches.
The target filename is normalised through the CLX filename parser before the filetype is changed. The parser is initialised with the suffix list c o h s c++, so host-style names and translated RISC OS forms follow the same local filename rules as other CLX-based wrappers.
If the type is not a hexadecimal value, the tool looks it up in its built-in symbolic-name table. Names are matched case-insensitively. Common names include Text, Module, Absolute, Template, Squash, PNG, Draw, Python, PDF, SVG, Zip, JSON, YAML, and Perl. The complete built-in table is listed earlier in this chapter.
<input> | - | Source file to copy. This may include wildcard characters, in which case each matching source leafname is copied into the destination directory root. |
<output> | - | Destination file, or destination pattern ending in * when input is itself a wildcard. In wildcard mode the trailing * is required: it marks where each matched leafname is substituted. A destination given as a plain directory name with no trailing * is not treated as that directory; the final path component is discarded and matched files are written into its parent instead. |
<flags> | - | Compact FileSwitch-style flag string using the recognised letters A, C, D, F, L, N, P, Q, R, T, and V. Prefix a letter with ~ to force it off. |
riscos-copy is the host-environment form of Copy. It copies one file byte-for-byte, or copies several matching source leafnames into a destination directory when the source name contains wildcards.
Following the classic Copy convention, wildcard mode needs a matching wildcard in both input and output, such as c/* export/h/*. Giving a destination directory with no trailing *, such as c/* export/h, does not copy into that directory: the final path component h is dropped silently and every matched file is written into export instead, with no error or warning to indicate the mistake.
Once the destination file has been written successfully, the source filetype is applied to it. On the host filesystem this comes from the source filename's trailing comma-suffixed type if one is present, otherwise the default filetype is &FFF.
The command does not consult Copy$Options. Although it recognises the standard option letters, only V changes behaviour. The other recognised flags are accepted for compatibility with existing usage, but they do not implement confirmation, recursion, newness checks, deletion-after-copy, or the other normal FileSwitch semantics.
If a copy fails during reading, writing, or close handling, any partially written destination file is removed before the error is reported.
Filenames are normalised through the same CLX filename parser described for riscos-settype, so a name with a recognised source-language suffix such as util.h is read as the RISC OS form h.util and mapped to host path h/util, not the literal host filename given.
<directory> | - | Directory tree to create. Parent directories are created before the final component. |
riscos-cdir is the recursive directory-creation helper for the build environment. It accepts one pathname and works from the top of that path towards the leaf, creating missing parent directories as required.
Wildcards are not supported. If the supplied pathname contains *, the command reports an error and creates nothing from that request.
If no pathname is supplied, or more than one is supplied, the command prints its syntax summary. The tool is therefore most useful in scripts which already know the exact output directory tree that should exist before a copy or build step runs.
<filename> | - | Pathname of the object to delete. Wildcards may be used to select several matching leafnames. |
<flags> | - | Optional flag string using the recognised letters C, F, R, and V. Prefix a letter with ~ to force it off. |
riscos-wipe is the host-environment form of Wipe. It deletes one file, or several matching leafnames when the supplied pathname contains wildcards.
The pathname is normalised before deletion. Wildcard handling is limited to the supplied pathname itself; the command does not perform recursive directory traversal.
The tool does not consult Wipe$Options. Only V is implemented. The recognised C, F, and R flags are accepted for compatibility but do not change the deletion semantics.
When verbose mode is enabled, the command prints a message before each deletion attempt. If one deletion fails, a diagnostic naming that object is printed.
<file> | - | File to delete. Repeat the argument to delete more than one explicitly named file. |
-h | - | Display the version and syntax summary. This form is recognised only when it is the sole argument, and then exits with failure status. |
riscos-destroy is the exact-name cleanup tool for simple scripted removal of generated files. It processes each filename in turn after normalising the name through the local CLX filename handling.
Wildcard expansion is not implemented. If any argument contains *, the command stops immediately, reports that wildcards are not supported, and returns failure.
If an ordinary deletion fails, the command reports that the file was not destroyed and then continues with later arguments. After all filenames have been processed, it still returns success unless the command stopped earlier for wildcard handling or explicit help output.
-b | - | Number non-blank lines only. Implies -n. |
-e | - | Append $ before each newline. Implies -v. |
-n | - | Number all lines. |
-s | - | Collapse runs of adjacent blank lines to a single blank line. |
-t | - | Display tab characters as ^I. Implies -v. |
-u | - | Disable output buffering on standard output. |
-v | - | Display control characters using caret notation. |
<file> | - | Input file to read. A lone - selects standard input. |
riscos-kitten is a small cat-style command which copies one or more inputs to standard output. If no files are supplied, it reads from standard input once; a lone - in the file list also selects standard input at that point in the input sequence.
With none of -b, -e, -n, -s, -t, or -v, the tool uses a raw copy path and writes the input bytes unchanged. Supplying any of those options switches to formatted text output.
Line numbering restarts from 1 for each input file or standard-input segment. In this port, bytes with the top bit set are passed through unchanged rather than being rendered with an M- prefix. The -u option changes only buffering.
If a file cannot be opened, or a read error occurs, the tool reports the problem to standard error, continues with any remaining inputs, and exits with failure status after processing everything. -h and -? print the usage summary and exit with status 1.
-h | - | Display the syntax summary and version information, then exit. |
-c | - | Report counts for each detected module token instead of emitting module-loading commands. |
-O | - | Generate command text suitable for inclusion in an Obey file. |
-s | - | Replace the literal marker %<TOOLBOX>% in the named file with the generated commands. |
-a | - | Set the application name used in generated error text. |
-i | - | Name one input Toolbox resource file. This switch may be repeated. |
<input> | - | Input Toolbox resource file supplied positionally after the options. Any number of positional inputs may be given. |
riscos-resversions examines one or more Toolbox resource files, detects the Toolbox object classes and gadget modules they require, and then emits the module-loading commands needed to satisfy those dependencies. Inputs supplied through repeated -i options and trailing positional filenames are merged into one requirement set.
When generating command output, the first line defines an EnsureToolbox alias and the remaining lines load or version-check the required Toolbox modules. With -O, the emitted text is escaped for Obey-file use. With -c, the command reports counts for each detected module token instead of generating the loader text.
Substitution mode selected by -s searches the named file for the literal text %<TOOLBOX>% and replaces that marker with the generated commands. If the marker is missing, the command warns and leaves the file unchanged.
Module selection is driven by a description table. On RISC OS this is normally supplied through ResVersions$File. Missing entries fall back to the built-in table. The fuller local documentation records that if -a is omitted, the default application name is This application, even though the built-in syntax summary only shows the explicit -a form.