Introduction and Overview
Not every useful development command compiles code. The build environment also includes tools for static checking, formatting, library discovery, source inspection, and repository maintenance.
Technical Details
Code quality tools
riscos-cppcheck and riscos-indent wrap common source-quality tools so that they work sensibly inside the environment. These are especially useful when cleaning older codebases or keeping generated changes consistent.
For 64-bit-targeted checking, riscos64-cppcheck reuses the same checker wrapper but selects the 64-bit build context.
Library discovery
riscos-libsearch queries the exported library databases and can locate libraries, symbols, and headers in both the system resources and the locally built export tree.
Results from /riscos-built/Export take priority over matching entries from the baked-in system export tree, so locally built libraries override the installed copies when both provide the same include path or symbol.
Git workflow notes
The normal git command is available inside the environment, along with helpers such as git open and git absorb. Authentication and basic remote operations should work provided the mapped host credential store is valid, but signing and some more advanced host configuration patterns may not.
git absorb is particularly useful when review comments have resulted in a few staged fixes that really belong in earlier commits. It automatically creates fixup! commits targeted at the relevant earlier commits so that a later autosquash rebase can fold them back into the branch history cleanly.
Documentation maintenance helpers
Documentation-oriented projects may also use StrongHelp support tools or PRM-oriented tools such as riscos-prminxml. In this chapter they belong to the broader maintenance story: ensuring that source, documentation, and exported interface information remain aligned.
Template-maintenance work also falls into this area. The riscos-fixuptemplate tool analyses Template files, reports style and layout issues, and can rewrite a narrow set of dialogue-box geometry problems when an output file is requested.
Command-line regression testing
riscos-tooltester is the local integration-test runner for command-line tools. It sits between simple ad hoc shell testing and a larger language-specific test framework: the test suite is plain text, expected output is checked directly, and created files can be validated with built-in checkers.
Header conversion helpers
Some maintenance tasks involve keeping generated language bindings aligned with the standard assembler-style interface headers from the RISC OS source tree. riscos-hdrtoh exists for that job.
Commands
-platform | - | Override the wrapper's default cppcheck platform. Use a simple platform name such as riscos or riscos64, or supply a platform description file path. |
-std | - | Override the wrapper's default language standard. Common values include c89, c99, and c11. |
-filename-format | - | Control how reported filenames are written. Use riscos for the default RISC OS-style rewritten names or posix to keep transformed POSIX paths. |
<cppcheck-option> | - | Other upstream cppcheck options. The wrapper passes these through unchanged after applying its own defaults. |
<file> | - | One file or directory tree to analyse. The shipped usage form allows the file argument list to be extended with additional paths. |
<additional-file> | - | Additional files or directory trees to analyse. |
Runs static analysis on source code with build-environment resources configured for common RISC OS projects.
By default the wrapper adds RISC OS target macros and platform settings: -D__riscos, a 32-bit or 64-bit architecture macro set depending on BUILD64, --platform=riscos or --platform=riscos64, and a default language standard of --std=c89 for 32-bit or --std=c11 for 64-bit.
If you specify --platform=... or --std=... yourself, your values replace those defaults. Reported filenames are rewritten back into RISC OS form by default; use --filename-format=posix to keep transformed POSIX-style names instead.
When --platform=<name> uses a simple name rather than a path, the wrapper looks for platform descriptions in ~/.config/cppcheck/platform-<name>.xml, /etc/cppcheck/platform-<name>.xml, or the current directory.
This reference concentrates on the wrapper-specific behaviour. Other upstream cppcheck options are passed through unchanged.
<file> | - | First source file to format. |
<additional-file> | - | Additional source files. The shipped usage includes both single-file and multi-file forms. |
<indent-option> | - | Upstream GNU indent options passed through by the wrapper. |
Formats source files while using the environment's RISC OS-oriented support resources.
The wrapper accepts RISC OS-style filenames through riscos-transformcli, selects the environment's default /etc/indent.pro profile if the user does not already have a personal ~/.indent.pro, and sets VERSION_CONTROL=never so that indent does not leave backup files behind.
If you want a different personal style profile, create ~/.indent.pro on the host side and the wrapper will leave your profile selection alone.
This reference documents the wrapper behaviour and positional file handling. Other GNU indent switches are passed through unchanged.
| - | Rebuild the SQLite index for /riscos-built/Export. | ||||
-index-system | - | Rebuild the SQLite index for /riscos-resources/Export. | ||||
| - | Search indexed file names and file descriptions for a pattern. | ||||
| - | List indexed symbols for one header file. | ||||
| - | Show details of one indexed library. | ||||
-lib-list | - | List all indexed libraries. | ||||
-func | - | Search specifically for a function or define name. | ||||
-less | - | Open matched files in less during search operations. | ||||
<query> | - | A bare function, define, or header query. Bare queries ending in .h are treated as header lookups; other bare queries are treated as function-or-define lookups. |
Searches the system and built library databases to find headers, functions, defines, and library names. It is intended as a discovery tool when you are trying to work out which include file or library export a project needs.
Bare queries ending in .h are treated as header lookups. Other bare queries are treated as function or define lookups. Use --func, --lib, --lib-list, or --symbols when you need a more specific query mode.
The search covers both the locally built export tree and the installed system export tree, with locally built results taking priority. The --less option can open matched files directly for inspection, and --index or --index-system rebuild the SQLite indexes when needed.
| - | Show per-test progress output. This is the default behaviour. | ||||
| - | Suppress per-test progress output and show only the summary. | ||||
-script | - | Read a different test script file instead of the default tests.txt. | ||||
-group | - | Run only groups whose names match the supplied regular expression. | ||||
-test | - | Run only tests whose names match the supplied regular expression. | ||||
-show-command | - | Print the expanded command for each test before it is run. | ||||
-show-output | - | Print captured output when a test fails. | ||||
-show-diff | - | Print the line-oriented diff between actual and expected output on failure. | ||||
-save-output | - | Save captured output from every test into the named directory. | ||||
-junitxml | - | Write a JUnit XML report to the named file. | ||||
-debug | - | Enable internal debug output. The installed script accepts the comma-separated names filename, replace, aof, junitxml, or all. | ||||
<tool-under-test> | - | Path to the executable or script that the suite will run. Inside the test script it is available through the substitution variable $TOOL. Tests run with the working directory set to test-directory, not the directory riscos-tooltester was started from, so a relative path such as a bare leafname or ./mytool will not resolve unless the tool also happens to live under the test directory; give an absolute path, or a path already resolvable through PATH, for a tool that lives elsewhere. | ||||
<test-directory> | - | Directory containing the main test script, expectation files, replacement scripts, and any test data. |
riscos-tooltester runs a command-line tool repeatedly according to a plain text test description, captures output, checks return codes, and can validate files or directories created by the tool.
The normal calling convention is to place any switches first, then pass the tool under test and the directory containing the suite. By default the runner reads tests.txt from that directory. The script format is designed for repository-local maintenance: it is simple to diff, easy to split with Include:, and keeps expected output in ordinary text files.
Tests are arranged into Group: blocks and Test: entries. A group establishes default statements such as Command:, Replace:, or Env:; each following test inherits those values and may override them or clear them with a leading minus form such as -Expect:.
Captured output is compared against the file named by Expect: after any optional replacement script named by Replace: has normalised unstable data such as paths, timestamps, branch names, or memory addresses. When output mismatches, the runner writes the post-replacement actual output to the expectation pathname with -actual appended, which makes it easy to inspect the real result before updating the expected file.
The tool also checks side effects. Creates: and CreatesDir: assert that files or directories were created, Removes: and Absent: assert that paths are absent after the run, and built-in checker families such as text, binary, aof, alf, and elf can validate the created file content or structure.
Use -group and -test for narrow reruns while debugging. Add -show-command, -show-output, or -show-diff when you need more diagnostics, and use -junitxml when integrating the results with CI reporting.
The installed topic help mentions a -fast-fail option, but that switch is not implemented by the runner; do not rely on it.
-t | - | Supply a processor type token. The option is accepted but does not select any alternative processing mode. |
-o | - | Explicitly supply the output Template filename. |
<templatefile> | - | Input Template file to analyse. |
<output-file> | - | Optional destination for the revised Template file. If omitted, the command runs in report-only mode and does not write a replacement file. |
riscos-fixuptemplate reads a Template file, walks each window object, classifies its icons, and reports warnings against individual icons or against the window as a whole. The checks are advisory rather than a complete style-guide validator, but they are useful when cleaning older templates or checking the consistency of generated resources.
The warning passes cover window flags, title formatting, approximate aspect ratio, validation-string usage, questionable flag combinations, recommended icon sizes, edge spacing, alignment, label and button content, and dialogue-box structure such as divider placement and default-button uniqueness.
Automatic correction is limited mainly to dialogue-box geometry. When a window looks like a dialogue box with a divider and one or more action or default buttons, the tool may move the divider, resize the window, reposition buttons into expected local-action and activation groups, and update the visible-area extents before writing an output file.
If no output file is supplied, the command operates in report-only mode and writes warnings to standard output. An output file may be supplied either positionally or through -o. When written, that file is given RISC OS filetype &FEC. The live command does not provide a separate -h help flag; its built-in usage text is shown when invoked without the required template filename.
-format | - | Select the output language. Supported values are C, BASIC, Pascal, Python, and Fortran. If omitted, C output is generated. |
-comments | - | Preserve source comments in generated output where the selected output format supports them. |
-undefs | - | Emit #undef handling in C output. |
-many | - | Treat the remaining input arguments as multiple source files and generate one combined output file. |
-o | - | Set the output file explicitly. |
-silent | - | Parse an additional file first without emitting its contents. This is useful when the main input depends on values defined in another header. |
-swisonly | - | Emit only SWI-related definitions. |
-upperhex | - | Write hexadecimal constants in upper case. |
-noboilerplate | - | Suppress the normal generated header and trailer boilerplate. |
-noerror | - | Continue even if an input file cannot be read. |
-module | - | Set the Pascal module declaration name. |
<input> | - | Assembler-style input header file. In the normal form this is the only input file. |
<additional-input> | - | Additional input files used with -many. |
<output> | - | Generated constant file in the selected target language. |
riscos-hdrtoh reads the simple assembler-style definition headers used in the RISC OS source tree and writes equivalent constants for other languages. The default output language is C, but the tool can also generate BASIC, Pascal, Python, and Fortran forms.
Unlike most other wrappers in this guide, the -o filename is used exactly as given, with no RISC OS dot-as-directory translation. A dotted name such as h.swis therefore creates a literal host file called h.swis in the current directory rather than h/swis, and the generated C include guard embeds that literal name, producing an invalid identifier such as RISCOS_h.swis_H. Give a normal host-style path such as h/swis instead, with any intermediate directory created in advance.
The parser is intentionally simple. It is designed for interface headers that define constants, SWIs, and related values, not for arbitrary assembler source or headers that rely on complex conditional logic and macro programming.
The tool recognises or ignores the simple directive vocabulary used in these headers, including directives such as SUBT, TTL, GBLA, GBLL, GBLS, SETA, SETL, and SETS, but it should not be treated as a general assembler.
| - | Display the command help summary. | ||||
-help-indexed | - | Display the reference for indexed multi-document builds based on an index.xml file. | ||||
-help-params | - | List stylesheet parameters supported by each output format. | ||||
-help-tag | - | Display tag help for one PRM-in-XML element. If no tag name is supplied, the tool lists the supported tags. | ||||
| - | Display the installed tool version. | ||||
| - | Select the transform catalog version. The default is 103, matching the installed 1.03 DTD and transforms. | ||||
| - | Enable debug output. | ||||
-lint | - | Validate the input files in addition to formatting them. | ||||
| - | Select the output format. Supported values are command, header, html, html+xml, html5, html5+xml, index, lint, skeleton, and stronghelp. | ||||
| - | Write logging output to one file. | ||||
| - | Write logging output into a directory. This is especially useful for indexed builds that generate multiple output files. | ||||
| - | Write one output file, or select the output location used by formats that emit one named file. | ||||
| - | Write generated output into a directory. | ||||
| - | Pass one stylesheet parameter as name=value. Use this for renderer options such as HTML contents generation or CSS selection. | ||||
<input-file> | - | Input PRM-in-XML source file. For normal chapter builds this is usually one XML file; indexed builds instead use an index.xml control file. | ||||
<additional-input-file> | - | Additional input files when the selected format accepts more than one source document. |
riscos-prminxml is the main PRM-in-XML conversion and validation tool. It turns structured XML interface documentation into presentation formats such as HTML, StrongHelp skeletons, command-help text, generated headers, or indexed multi-document books.
The normal controls are -f to choose the output format, -o or -O to choose where the generated output will go, and --lint to validate the source while formatting it. If no format is selected explicitly, the default is html, but the usual local workflow is to choose the format deliberately.
The most common formats are skeleton to create a starter document, lint to validate structure against the PRM DTD, html5+xml for modern HTML plus a copy of the XML, command to generate VTranslate-style command help, header to generate C constants, stronghelp to generate a StrongHelp directory skeleton, and index to build a complete indexed documentation set from an index.xml control file.
-f lint performs only validation. The separate --lint switch can be combined with another output format so that the document is both validated and rendered in one run. For multi-document builds the indexed form is described by --help-indexed, which explains the index.xml layout, output directories, and section/page listing structure.
--param passes stylesheet-specific settings through to the selected renderer. Useful controls include create-contents, css-base, css-variant, override-docgroup, and chapter-number or edge-index overrides for HTML5 output. Use --help-params to inspect the parameter set supported by the installed transforms before relying on one in a build script.
Do not write generated output into the same directory as the source when using -O. Generated files may overwrite the source tree. The installed reference material for the format lives in /riscos-resources/Install/Tools/Linux/riscos-prminxml-resources/docs, with HowTo.md and PRMinXML.txt being the most useful starting points.
| - | Use the named commit as the base of the absorb stack. | ||||
| - | Report what would be done without creating any commits or rebasing. | ||||
-force-author | - | Allow fixups to commits not authored by you. | ||||
-force-detach | - | Allow absorb to create fixups while on a detached HEAD. | ||||
| - | Skip all safety checks as though all --force-* flags had been supplied. | ||||
| - | Display more output while matching and creating fixups. | ||||
| - | Run git rebase automatically after a successful absorb. | ||||
-gen-completions | - | Generate shell completion output for one supported shell. The installed help lists bash, fish, nushell, zsh, powershell, and elvish. | ||||
| - | Match each staged change against the complete file instead of more localised hunks. | ||||
| - | Generate at most one fixup commit for each target commit. | ||||
| - | Add the supplied commit message body text to every generated fixup commit. | ||||
| - | Display the command help text. | ||||
| - | Display the installed git absorb version. | ||||
<rebase-option> | - | Extra arguments passed to git rebase. The installed help states that these are only valid when --and-rebase is set. |
git absorb examines the staged changes in the Git index, works out which earlier commits those changes most likely belong to, and creates fixup! commits targeted at those earlier commits. It is designed for the common review-cleanup case where you have several small fixes that should be merged into earlier atomic commits rather than left as one opaque follow-up change.
The normal workflow is: stage the fixes with git add, run git absorb, inspect the generated fixup commits, and then fold them back with git rebase -i --autosquash. The convenience flag --and-rebase performs the rebase automatically after generating the commits. Use --dry-run to inspect what would happen without creating commits.
By default the tool considers staged changes and matches them against earlier commits on the current branch. Use --base to set the absorb base explicitly, --force-author to allow fixups to commits by other authors, --force-detach to work on a detached HEAD, and --one-fixup-per-commit to reduce multiple fixups to one per target commit.
If the result is not what you wanted, you can recover the previous branch state with git reset --soft PRE_ABSORB_HEAD or by using the reflog.
The shipped build-environment topic help covers the normal workflow and a small subset of switches, but it does not document every installed option and still mentions options that are not present in the current git absorb -h output. The switch list above is therefore based on the installed command help rather than the shorter topic summary.
<cppcheck-option> | - | Any riscos-cppcheck or upstream cppcheck option. |
<file> | - | First file or directory tree to analyse. |
<additional-file> | - | Additional files or directory trees to analyse. |
riscos64-cppcheck is a thin wrapper around riscos-cppcheck. It sets BUILD64 to 1 unless BUILD32 is already explicitly set, then runs the normal checker wrapper.
That means the real analysis behaviour still comes from riscos-cppcheck: the same wrapper resources, platform defaults, filename rewriting, and passthrough option handling apply. The only extra behaviour is the 64-bit build selection, which changes the default platform and architecture macro assumptions to match a 64-bit build.
Examples
Checking a source tree for common C issues
This is the usual first pass when checking an older source tree.
riscos-cppcheck .
Reformatting a single C source file
This applies the active indent profile to one file.
riscos-indent c/module
Looking up the library for a function
This is a fast way to find the export path needed by a project.
riscos-libsearch --func jpeg_read_header