RISC OS Build EnvironmentROBE

Reference guide24Module and Interface Generation Tools

Introduction and Overview

This chapter groups the tools used to generate module veneers, interface headers, Toolbox support code, resource objects, ROM-build inputs, and related derived files. These commands are commonly used in module or library build trees where generated artefacts form part of the public interface or loadable output.

Technical Details

Generated-resource and helper tools

Some build trees also rely on smaller helper tools that generate objects, modules, makefiles, or simple conditional script flow. The common ones are riscos-defmod, riscos-binaof, riscos-tboxmethods, riscos-resgen, riscos-modgen, riscos-modsqz, riscos-mergemoduleswis, riscos-makegen, and riscos-ifthere.

riscos-defmod turns OSLib Def interface descriptions into headers, veneers, or help trees. riscos-tboxmethods turns MethodGen Toolbox method files into generated C veneers. riscos-mergemoduleswis merges CMHG-generated SWI numbers into a maintained public header. The next three package resources into linkable objects or loadable modules, riscos-aoftoc converts assembler-produced AOF objects into generated C source and header files, riscos-buildrom assembles fixed-format ROM images from a description file, riscos-modsqz compresses relocatable modules into the later squeezed-module form, riscos-makegen writes AMU makefiles for older nested source layouts, and riscos-ifthere provides a small existence-test command for build scripts.

Parser and scanner generators

Projects which generate parsers or lexical analysers as part of their normal build also use riscos-bison riscos-flex, and riscos-rpcgen. These are the packaged Bison and flex tools with RISC OS filename handling and RISC OS-oriented default output names, plus the Sun RPC interface generator used when a project derives client, server, and XDR support code from one RPC definition.

riscos-bison reads a Yacc-style grammar and writes the generated parser source, with optional token-definition headers and verbose state reports. riscos-flex reads one or more scanner specifications and writes generated C or C++ scanner code, with optional headers, backing-up reports, and external table files. riscos-rpcgen reads one Sun RPC definition and writes the matching header, XDR, client, server, dispatch-table, and sample-source outputs. In all three cases the default filenames follow RISC OS naming conventions rather than the Unix defaults often described by upstream documentation.

Commands

riscos-cmunge
Generate RISC OS module veneers from a CMHG or CMunge description file
riscos-cmunge option description-file
-h -Print help.
-o -Write the generated AOF veneer object to the named file.
-s -Write the generated assembler veneer source to the named file.
-d -Write the generated C header to the named file.
-xhdr -Write the generated assembler SWI-name header to the named file.
-xh -Write the generated C SWI-name header to the named file.
-p -Run normal preprocessing before parsing the CMHG file.
-px -Run extended preprocessing and parse the flattened preprocessor output in full.
-I -Add a directory to the preprocessor include path.
-D -Predefine a symbol, optionally with a value, before preprocessing.
-U -Undefine a predefined symbol before preprocessing.
-depend -Write make-style dependency information to the named file.
-throwback -Enable throwback error reporting.
-zbase -Add Image__RO_Base to the generated C header.
-zerrors -Generate only error and veneer definitions for application-side use.
-zoslib -Generate a C header that includes oslib/os.h.
-zoslibpath -Generate a C header that includes OSLib:Core.os.h.
-blank -Create a blank CMHG template in the input file.
-cmhg -Warn when non-CMHG-compatible values or directives are used.
-tgcc -Use the GCC-oriented toolchain for output generation.
-tlcc -Use the LCC-oriented toolchain for output generation.
-tnorcroft -Use the Norcroft-oriented toolchain for output generation. This is the default.
-32bit -Generate 32-bit compatible module veneers.
-26bit -Generate 26-bit-only module veneers. This is the default architecture mode.
-64bit -Generate 64-bit AArch64 veneers for the GCC assembler path.
-apcs -Set the APCS variant explicitly.
<description-file>-CMHG or CMunge description file, often kept in a cmhg/ directory.

Reads a CMHG or CMunge module description and generates the veneer object and optional headers needed to connect RISC OS module entry points, command tables, SWI tables, and callback veneers to C or C++ code.

This tool is most often used in module projects and is usually driven by makefile rules rather than by hand for every build. CMunge extends the original CMHG format with support for newer toolchains, extra directive forms, and 32-bit and 64-bit targets.

The normal modern 32-bit form uses -32bit. For AArch64 veneers, use -64bit with the GCC-oriented toolchain option -tgcc. The architecture and APCS settings should match the rest of the module build.

Include -p or -px whenever the description file uses C preprocessor directives, such as the #include "VersionNum" line in the generated skeleton; without it, CMunge fails with Unknown preprocessor command encountered: #include "VersionNum".

The CMHG description syntax is summarised in Appendix G: CMHG File Format.

riscos-cmunge -px -32bit -throwback -o o32.modhead -d h.modhead cmhg.modhead
riscos-defmod
Generate source or documentation from an OSLib Def interface description
riscos-defmod type -v -q -help -o output-directory -byte_wide byte-wide-file -P -26bit -32bit
<type>-One required output selector: -s, -l, -h, -h++, -hdr, -chelp, -asmhelp, or -cstrong. The parser also accepts -asmstrong, but that selector does not generate output.
-v -Enable verbose parser echoing and warnings.
-q -Suppress informational messages where possible.
-help -Print command help.
-o -Output directory for directory-producing modes such as -l and -cstrong.
-byte_wide -Whitespace-separated file listing externally-defined type names which should be treated as byte-wide during veneer generation.
-P -Select old-style OSLib naming, with no oslib/ path prefix and bool in place of osbool.
-26bit -Generate APCS 3/26-bit veneers.
-32bit -Generate APCS 3/32-bit veneers. If both architecture switches are supplied, the tool generates both forms.

riscos-defmod reads a Def interface description from standard input and generates source or documentation for the SWIs, constants, and types described within it. It is the compact interface-generator tool traditionally used by OSLib-style trees to derive C headers, ObjAsm veneers, assembler headers, SrcEdit help, and StrongHelp content from one reviewed Def file.

Most output forms are written to standard output. The directory-producing forms use -o to select where the generated tree is written. The supported output selectors are: -s for one ObjAsm source file, -l for a per-SWI library-style directory tree, -h for a C header, -h++ for an experimental C++-flavoured header, -hdr for an ObjAsm header, -chelp and -asmhelp for SrcEdit help, and -cstrong for a StrongHelp directory tree.

Veneer generation depends on type-width knowledge. Locally-defined Def types can be resolved from the file itself, but externally-defined byte-sized types need to be listed with -byte_wide so the generator can distinguish byte-wide and word-wide arguments correctly. If neither -26bit nor -32bit is supplied, the default veneer output is 26-bit.

The local help still mentions a Pascal output mode with -p, but the current command-line parser does not recognise it. Conversely, -asmstrong is accepted by the parser but the main dispatch code does not produce output for it. The command entry here follows the implemented behaviour rather than the historical help text.

The Def input language consumed by the tool is summarised in Appendix R: DefMod file format.

For -l, the output directory must already contain the subdirectories the tool assembles into: s for the generated veneer source, o for 26-bit objects, and o32 for 32-bit objects. The tool does not create them itself, so create LibraryOut/s, LibraryOut/o, and LibraryOut/o32 before running it with both architecture switches.

riscos-defmod -h < InterfaceDef > h/interface riscos-defmod -l -o LibraryOut -26bit -32bit < InterfaceDef
riscos-tboxmethods
Generate C veneers from MethodGen Toolbox method files
riscos-tboxmethods -h | -help -debug filename -cheader header-output -csource source-output
-h
or -help
-Display the command syntax summary and exit immediately.
-debug -Print the parsed file version, class metadata, methods, descriptions, and register definitions while the input file is being read.
<filename>-MethodGen method file to read. The file must begin with the METH header and use one of the supported format versions 100, 101, 102, or 103.
-cheader <header-output>-Write a C header containing function prototypes for all recognised Toolbox methods.
-csource <source-output>-Write one C source file implementing veneer functions for all recognised Toolbox methods.

riscos-tboxmethods is the command-line replacement for the desktop MethodGen tool. It reads a Toolbox method-definition file and generates C-callable veneers which invoke the corresponding Toolbox methods through Toolbox_ObjectMiscOp.

The input format is the MethodGen binary method-file format headed by METH. Accepted file versions are 100, 101, 102, and 103. The class record supplies the class title, object name, source path, and dependency headers, while each method record supplies its method identifier, name, optional description, and input/output register descriptions.

The generated veneer naming follows the method names recorded in the input file. The class prefix is lower-cased, and the method suffix is converted from camel-case style to underscore-separated lower case, so a method such as Window_SetTitle becomes window_set_title.

Every generated veneer returns _kernel_oserror *. Its first two arguments are always unsigned int flags for R0 and the Toolbox ObjectId for R1. Method-specific input registers are appended as additional value parameters, and method-specific output registers are exposed as pointer parameters so the veneer can write results back to the caller after a successful Toolbox call.

The generated header includes kernel.h, toolbox.h, and the dependency headers recorded in the method file. The generated source includes the same headers plus the class header itself. Unlike the original desktop tool, this command emits one C source file containing all the veneers rather than one source file per method.

You may request the header, the source, or both in one invocation. If neither -cheader nor -csource is supplied, the tool still reads and validates the method file, which is mainly useful together with -debug.

.Methods files (RISC OS filetype &FAD) are normally produced by the desktop MethodGen tool, not written by hand; this command exists to read that tool's output, not to replace it. Methods are named ClassName_MethodName in the file, such as MyObject_SetTitle, and the class title supplies the lower-cased prefix used in the generated veneer name, here myobject_set_title.

riscos-tboxmethods MyObject.Methods -cheader MyObject.h -csource MyObject.c extern _kernel_oserror *myobject_set_title ( unsigned int flags, ObjectId MyObject); riscos-tboxmethods -debug MyObject.Methods Methods version: 100 Reading class header Class title: MyObject Object name: MyObject Needs headers: toolbox.h Source: c.MyObject Methods defined: 1 #0 Name: MyObject_SetTitle Source: c.MyObject Description: <unset>
riscos-mergemoduleswis
Merge CMHG-generated SWI definitions into a maintained public header
riscos-mergemoduleswis cmhg-header user-header output-header
<cmhg-header>-Header generated by CMHG with the -d option. It must contain the exact marker comment /* SWI number definitions */.
<user-header>-Maintained public header containing the exact replacement marker comment /* SWIs here */.
<output-header>-Destination for the merged header.

riscos-mergemoduleswis exists for module projects where CMHG owns the SWI number allocation, but the exported public header also needs hand-maintained declarations, comments, structures, or helper macros. It merges those two sources by taking the generated SWI definition block from the CMHG header and inserting it into the maintained header template.

The merge is deliberately text-based rather than a general C parser. The tool looks for the fixed CMHG marker /* SWI number definitions */, copies the following generated SWI block up to the first blank line, removes any #undef lines, removes generated X... SWI definitions, and substitutes the result for the /* SWIs here */ marker in the user header.

If the first generated numbered SWI name ends in _00, the merged block is wrapped in a matching #ifndef guard with a closing #endif. The rest of the user header is preserved unchanged.

The command requires exactly three positional parameters. If any are omitted, it prints a short syntax line and exits with failure status. If either required marker comment is absent, the merge also fails.

On non-RISC OS hosts the implementation stages its inputs and output through riscos-copy and temporary files so that file handling stays aligned with the cross-compilation environment. That detail does not change the visible three-file interface.

riscos-mergemoduleswis hdrdefs h.public h.export
riscos-resgen
Build a relocatable object containing ResourceFS file data
riscos-resgen -help -via file -wa -wn -apcs variant -26bit | -32bit area-name output-file local-file resourcefs-name
-help -Display the syntax summary and APCS option list. The live tool uses the switch form -help.
-via -Read additional whitespace-separated local-file and resourcefs-name pairs from the named file.
-wa -Suppress the warning for zero-length input files.
-wn -Suppress the warning for an empty input set.
-apcs -Select the APCS variant for the generated AOF area attributes.
-26bit -Compatibility form that clears the APCS 32-bit flag in the generated output.
-32bit -Compatibility form that sets the APCS 32-bit flag in the generated output.
<area-name>-Name of the generated AOF area and of the exported symbol that returns the ResourceFS block address.
<output-file>-Relocatable object file to create.
<local-file>-Host or RISC OS source file to embed.
<resourcefs-name>-Name that the embedded file will have once the generated block is registered with ResourceFS.

riscos-resgen packages one or more files into a relocatable object that can later be linked into an application or module and registered with ResourceFS, the filing-system module that exposes bundled resource files through the Resources: prefix; see Glossary.

Each file pair contributes one ResourceFS record. The tool preserves the source file length, load and exec information, and contents, padding the stored data to a word boundary as required. The generated data area is read-only.

The exported symbol named by area-name identifies a small entry stub; calling it returns the address of the packaged ResourceFS block for registration. This makes riscos-resgen the normal tool when the resources should live inside some larger linked component rather than in a standalone module.

-via is cumulative with direct file pairs on the command line. The via file is parsed as whitespace-separated tokens only; quoting is not supported. On non-RISC OS hosts, filetypes are inferred from comma-suffixed hexadecimal host filename endings such as messages,fff.

The live command reports its help under -help, and reports Unrecognised flag --help if the GNU long-option form is used. This entry documents the supported switch name rather than the unsupported alias.

riscos-resgen resourcefsfiles o.messages m.messages Resources.MyApp.Messages
riscos-modgen
Generate a loadable ResourceFS module from input files
riscos-modgen -32bit | -64bit filename module-name module-help module-version binary-file resource-file -via viafile
-32bit -Generate a 32-bit resource module. This is also the default.
-64bit -Generate the corresponding 64-bit resource module form.
<filename>-Output module file to create. On non-RISC OS hosts the written file is normalised to filetype ,ffa.
<module-name>-Short module title stored in the generated module header.
<module-help>-Base help text for the module. The tool appends the supplied version and the current date automatically.
<module-version>-Version text appended to the help string.
<binary-file>-Host file whose contents and metadata will be copied into the module.
<resource-file>-ResourceFS pathname that will be associated with the preceding input file.
-via -Read whitespace-separated binary-file and resource-file pairs from the named text file.

riscos-modgen builds a loadable ResourceFS module rather than a plain object file. It is intended for resource collections such as messages files, templates, token files, or helper resources that should be registered automatically when the module is loaded.

Each input pair contributes one ResourceFS file entry. The generated module stores the input contents, load address, execution address, and length so that the registered resource appears with the expected metadata.

The -via file is tokenised on whitespace only, with no comment syntax and no support for filenames containing spaces. On non-RISC OS hosts, filetypes are inferred from trailing comma-suffixed hexadecimal filetypes in the source filenames; otherwise filetype &FFF is assumed.

If no resources are supplied, the tool still creates a module shell and warns that no resource files were specified. Zero-length inputs are also accepted with a warning.

The generated module includes the logic needed to register its files with ResourceFS when initialised, deregister them when removed, and re-register them if Service_ResourceFSStarting is seen.

riscos-modgen Messages Messages "UK Messages" 0.09 -via msglist
riscos-modsqz
Compress a relocatable module into the squeezed-module form
riscos-modsqz -f -v unsqueezed-file squeezed-file
-f -Try harder to squeeze poor compression candidates. Without this option, the command normally declines compression when the estimated output exceeds about 90% of the original size.
-v -Display progress information and compression statistics.
<unsqueezed-file>-Input relocatable module to analyse and compress.
<squeezed-file>-Optional output filename for the squeezed module. If omitted, the source file is replaced in place.

riscos-modsqz compresses a normal relocatable RISC OS module into the squeezed form understood by later RISC OS module loaders. The input is still a module image with a normal relocatable-module header; the output is still a module file, but with a compact squeezed header and a compressed body.

The command validates the input module header before attempting compression. It rejects files whose key offsets are absent, point beyond the end of the file, or are misaligned where word alignment is required. Modules whose initoffset already has bit 31 set are treated as already squeezed and are rejected.

The module body is treated as a sequence of 32-bit words. The compressor builds tables of common full-word values and common upper-24-bit values, then estimates the final encoded size including its tables and decompressor margin. Without -f, compression is normally abandoned if that estimate exceeds about 90% of the original size. With -f, the command still proceeds provided that the real encoded output is not larger than the input.

The output file is always written with RISC OS filetype &FFA. If compression is not worthwhile and an explicit output filename was supplied, the unsqueezed input is copied unchanged to that output file. The binary squeezed-module layout is summarised in Appendix M: Squeezed module format.

In this image, riscos-modsqz segfaults when given a real relocatable module built by this environment (with or without -v); it only completes normally on inputs small enough that compression is declined outright as not worthwhile. Treat module squeezing as currently unavailable here rather than retrying with different switches.

riscos-modsqz MyModule,ffa riscos-modsqz -v MyModule,ffa Squashed,ffa
riscos-buildrom
Construct a fixed-format ROM image from a description file
riscos-buildrom -h -d description-file
-h
or -help
-Display the version banner and syntax summary, then exit without building an image.
-d -Description file naming the kernel image and the modules to place in the ROM. This parameter is required for normal operation.

riscos-buildrom assembles a ROM image from already prepared binary components. It does not compile or transform those inputs; it reads the named kernel and module files, writes them into a fixed-size image, and zero-fills the remaining padding space.

The description file is plain text. Its first line names the kernel image, its second line is an output name recorded by the parser, its third line is a ROM length field which is currently ignored, its fourth line is a blank separator line which is also ignored, and the remaining non-empty lines name the modules to include.

The tool always constructs a 6 MiB image and always writes the final host output file as img2. Although the description file contains an output-name field, that field is not used for the written filename.

The kernel image is written first, omitting its final four bytes. Each listed module is then written as a four-byte length word followed by the module data padded to a four-byte boundary. If the selected inputs leave too little room in the fixed-size image for the required padding, the command fails rather than writing a truncated ROM.

If -d is omitted, the live command reports Error: No description file supplied and exits with failure status.

riscos-buildrom -d ROMImage Initialising ROM descriptor Reading filenames... Adding tail values... Constructing image... Done!
riscos-bison
Generate a parser from a Yacc-style grammar
riscos-bison -d -h -k -l -n -r -t -v -y -V -b file-prefix -o outfile -p name-prefix long-option grammar-file
-d -Also write token definitions to a header file. The long form is --defines.
-h -Display command usage help. The long form is --help.
-k -Include a token name table in the generated parser. The long form is --token-table.
-l -Suppress #line directives in generated output. The long form is --no-lines.
-n -Do not copy a parser skeleton into the output file. The long form is --no-parser.
-r -Use raw token numbers internally. The long form is --raw.
-t -Enable debugging support in the generated parser. The long form is --debug.
-v -Write a verbose report of states and conflicts. The long form is --verbose.
-y -Use fixed Yacc-style output filenames such as y_tab/c. The long forms are --yacc and --fixed-output-files.
-V -Display the upstream Bison version and the packaged RISC OS build version. The long form is --version.
-b -Choose the base prefix from which output filenames are derived. The long form is --file-prefix=prefix.
-o -Write the main generated parser to the named file. The long forms are --output=outfile and --output-file=outfile.
-p -Rename externally visible parser symbols by applying the supplied prefix. The long form is --name-prefix=prefix.
<long-option>-Any of the supported long options listed in the built-in command help, including the long forms documented above.
<grammar-file>-The Yacc-style grammar description to read.

riscos-bison is the build environment's packaged Bison command. It reads one grammar file, analyses it into LALR parser tables, and writes a generated C parser source file together with optional support outputs.

The repository port contains built-in copies of the normal parser skeletons, so the command remains usable even when external skeleton files are not installed. If external skeletons are required, the command first checks the BISON_SIMPLE and BISON_HAIRY environment variables, and otherwise falls back to the default RISC OS locations choices:bison.simple and choices:bison.hairy.

Temporary files are created beneath <Wimp$ScrapDir>.bison. Without explicit naming options, a grammar with base name name produces parser source at the RISC OS-style path c.name_tab (host c/name_tab), using _tab rather than the Unix .tab convention. With -d, the token-definition header is written alongside it at h.name_tab (host h/name_tab). When -b prefix is used, the prefix replaces name in both paths.

Grammars which use semantic-parser support may also produce extra files for semantic value types and guard code, named from the same base. Warnings are treated as a failed run, so parser output is not written when the grammar contains problems that the command considers significant.

This command does not create its own c and h output directories; create them yourself before running it, or the command crashes instead of reporting a clean error. A grammar filename containing a literal dot, such as a Unix-style expr.y, also crashes immediately with No such file or directory even though the file exists; use a plain RISC OS-style leafname with no dot instead. -v crashes separately, trying to write its verbose report into a directory named after the grammar file and aborting with a double-free when that path collides with the grammar file itself; avoid -v until this is fixed.

mkdir -p c h
riscos-bison -d exprgram
riscos-flex
Generate lexical analysers from flex input files
riscos-flex option ... input-file ...
<-7, --7bit>-Generate a 7-bit scanner.
<-8, --8bit>-Generate an 8-bit scanner.
<-b, --backup>-Write backing-up information to the default RISC OS report file bck.lex.
<-B, --batch>-Generate a batch scanner. This is the opposite of -I.
<--bison-bridge>-Generate a scanner intended to be called by a Bison pure parser.
<-C[aefFmr]>-Select table-compression options. The built-in default is -Cem.
<-+, --c++>-Generate a C++ scanner class.
<-d, --debug>-Enable debug mode in the generated scanner.
<-F, --fast>-Generate the alternate fast table representation. The built-in help describes this as equivalent to -CFr.
<-f, --full>-Generate a fast, larger scanner with full tables. The built-in help describes this as equivalent to -Cfr.
<--header-file=FILE>-Create a C header file in addition to the scanner source.
<-?, -h, --help>-Display the command help text and exit.
<-I, --interactive>-Generate an interactive scanner. This is the opposite of -B.
<-i, --case-insensitive>-Ignore case in patterns.
<-l, --lex-compat>-Enable maximal compatibility with the original lex tool.
<-L, --noline>-Suppress #line directives in the generated scanner.
<-o FILE, --outfile=FILE>-Write the generated scanner to the named file instead of using the default output name.
<-P PREFIX, --prefix=PREFIX>-Use the supplied prefix instead of the default yy for generated symbols.
<-R, --reentrant>-Generate a reentrant C scanner.
<-S FILE, --skel=FILE>-Read the scanner skeleton from the named file instead of the built-in default.
<-s, --nodefault>-Suppress the default rule which would otherwise echo unmatched text.
<-t, --stdout>-Write the generated scanner to standard output instead of a file.
<-T, --trace>-Run flex itself in trace mode.
<--tables-file=FILE>-Write serialised tables to the named file.
<-v, --verbose>-Write a summary of scanner statistics to standard output.
<-V, --version>-Display the command version and exit.
<-w, --nowarn>-Suppress warning messages.
<-X, --posix-compat>-Enable maximal compatibility with POSIX lex behaviour.
<--yyclass=NAME>-Set the generated C++ scanner class name.
<--yylineno>-Track line numbers in yylineno.
<input-file>-One or more flex source files. Use - to read from standard input.

riscos-flex reads one or more scanner specifications and emits generated scanner source. The normal output is C, but -+ selects C++ scanner output instead.

When no input file is supplied, or when an input is named as -, the specification is read from standard input. If more than one input file is supplied they are processed in sequence as one logical scanner source.

The RISC OS port uses RISC OS-oriented default output names. Without explicit naming options the generated C scanner is written to c.lexyy, the generated C++ scanner to cc.lexyy, the backing-up report to bck.lex, and external tables to tbl.lexyy. Use -o, --header-file, or --tables-file when a project needs explicit filenames.

Important option conflicts are enforced by the local parser. --header-file cannot be combined with -t. -f and -F are mutually exclusive, and either of them conflicts with -Cm, -I, and -l. -+ conflicts with -l, -CF, --reentrant, and --bison-bridge. The option --reentrant-bison is accepted as a deprecated alias for --bison-bridge.

This command does not currently work in this image. Even the smallest valid input, a file containing only %%, fails with bad start condition list and a fatal parse error, whether read from a named file or from standard input. Treat riscos-flex as unavailable until this is fixed.

If a project depends on a generated scanner, generate it outside this environment with a working flex (any recent upstream release) and commit the generated .c/.h pair into the project's source tree, building from those directly rather than re-running riscos-flex as part of the build. This sidesteps the broken generation step entirely; only regeneration after editing the .l source needs a working flex elsewhere.

riscos-flex -o c/scanner l/scanner
riscos-rpcgen
Generate Sun RPC support sources from an RPC interface definition
riscos-rpcgen -a -b -C -D name[=value] -I -K seconds -L -N -T -debuglib -i size -k -v infile
riscos-rpcgen -b -C -D name[=value] -I -K seconds -L -N -T -debuglib -i size -k -v -o outfile -c | -h | -l | -m | -t | -Sc | -Ss | -s nettype | -n netid infile
riscos-rpcgen -help
-a -Generate the normal full output set and additionally write sample client and server source files.
-b -Use backward-compatibility generation for the older SunOS 4.1 style RPC environment instead of the newer transport-aware model.
-c -Generate only the XDR routine source file.
-C -Generate ANSI C style declarations explicitly.
-D -Predefine one preprocessor symbol before the input definition is parsed.
-debuglib -Insert DebugLib tracing calls into generated client stub code.
-h -Generate only the C header file. This is not the help switch.
-help -Display the built-in usage summary and exit. The tool uses -help for this form.
-i -Set the minimum aggregate field size at which inline XDR code generation begins. A value of zero disables inline generation.
-I -Generate server code suitable for inetd-style startup in the older compatibility model.
-k -Generate K&R style C declarations instead of ANSI C style declarations.
-K -Set the server inactivity timeout used by generated server code.
-l -Generate only the client-side stub source file.
-L -Make generated server code report errors through syslog.
-m -Generate only the server-side stub source file.
-n -Generate server registration code for the named netid. This requires the newer transport-aware mode.
-N -Use the newer rpcgen calling convention that supports multiple arguments and call-by-value.
-o -Write the selected single-output form to outfile instead of the default derived filename.
-s -Generate server registration code for the named nettype. Supported values are udp and tcp.
-Sc -Generate only the sample client source file.
-Ss -Generate only the sample server source file.
-t -Generate only the RPC dispatch-table source include file.
-T -Enable RPC dispatch-table support during full generation and add the dispatch-table declarations to the generated header.
-v -Enable verbose progress reporting from the generator.
<infile>-Base name of the RPC interface definition to read. The source is expected in the usual rpcgen definition form, conventionally a .x file.
<outfile>-Explicit output filename for a single generated output class.
<netid>-Transport identifier to register in generated server code when -n is used.
<nettype>-Transport class passed to generated server registration code when -s is used.
<seconds>-Idle timeout used by generated server code before it exits.
<size>-Threshold controlling when the XDR generator emits inline marshalling code.

riscos-rpcgen generates Sun RPC support sources from one RPC interface definition. It runs the definition through the C preprocessor and writes the C source and header files needed for the defined types and remote procedures.

The normal invocation is riscos-rpcgen infile. That full-generation mode writes XDR support, a header, client stubs, and server stubs using filenames derived from the input base name. Add -T when dispatch-table support is required, and add -a when skeleton client and server examples are also wanted.

If only one generated file class is needed, select exactly one explicit generation switch such as -c, -h, -l, -m, -t, -Sc, or -Ss. In those single-output modes, -o may be used to choose the output filename.

The source definition is expected in the usual Sun RPC .x form containing declarations such as const, typedef, struct, union, enum, and program. Extra preprocessor symbols may be added with -D, so conditional compilation in the definition file can control which declarations appear in the generated output.

Only one explicit generation mode may be selected. Dispatch-table generation is incompatible with new-style multi-argument mode selected by -N. The built-in help banner is reached through -help, which matters because -h generates the header file rather than printing help.

Server generation has two distinct registration styles. Use -I and optionally -K for the older inetd-oriented form. Use -n for the transport-aware form. The -s registration form accepts only udp or tcp.

The infile and -o outfile arguments go through the same Unix-extension-to-RISC-OS-directory mapping as other tools in this environment. Give infile with its .x suffix, such as msg.x; the tool reads it from x.msg (host x/msg), not from a bare msg in the current directory. Likewise, -o msg_hdr.h writes to h.msg_hdr (host h/msg_hdr), not to a literal msg_hdr.h.

riscos-rpcgen msg.x riscos-rpcgen -h -o msg_hdr.h msg.x riscos-rpcgen -N -l msg.x