RISC OS Open
A fast and easily customised operating system for ARM devices
ROOL
Home | News | Software | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account

Page "Events/versions/new" does not exist. Please create it now, or hit the "back" button in your browser.

OS_SubstituteArgs32

Programmer's Reference Manuals
» Part 15 – SWI Calls
» OS
» OS_SubstituteArgs32

OS_SubstituteArgs32

(SWI &7E)
Entry
R0 Pointer to argument list
R1 Pointer to buffer for resulting string
R2 Length of buffer
R3 Pointer to template string
R4 Length of template string
R4 Flag bit in bit 31, (bits 0-30 reserved)
Exit
R0 Preserved
R1 Preserved
R2 Length of result string (including terminator)
R3 Preserved
R4 Preserved
R5 Preserved

Use

The purpose of this call is to substitute command line arguments

Notes

This call performs the hard work involved in substituting a list of arguments into a ‘template’ string. Its main use is in the processing of command Alias$... variables by the system. It’s also useful in other situations; it has been made available to users. For example, FileSwitch uses it in the processing of Alias$LoadType_TTT variables.

The argument list is a string consisting of space separated items which will be substituted into the template string. Spaces within double quotation marks are not counted as argument seperators. Typically, the argument string will just be the tail of a *Command. Its control character terminated. The result of substituting the arguments into the template string is placed in the buffer. The length of the buffer is given so that the call can check for buffer overflow. The template string is copied into the result buffer char for char. However, when a ‘%’ appears in the template string (even within quotation marks), it marks where an argument should be placed into the output buffer. The ‘%’ is followed by a single digit from 0 – 9. 0 stands for the first argument in the argument list and so on. % means a single . Anything else following the ’’ is not treated specially, i.e. both the % and the character are copied over. The template string doesn’t have a terminator; instead its length is given. At the end of substitution, any arguments after the highest one mentioned in the template string are appended to the result string. To prevent this set the top bit of R0 on entry. If a non-existing argument is specified in the template string, then a null string is substituted, no error is given.

The CallASWI module (version 0.03) allows this SWI to be used with RISC OS pre 5.00.

See also

  • OS_SubstituteArgs
Created on December 4, 2009 14:17:33 by Alan Robertson (52)? (127.0.0.1)
Edit | Views: Print | Source | Linked from: OS SWI Calls, OS_SubstituteArgs

Search the Wiki

Commercial use

For commercial enquiries, please contact the owners of RISC OS, Castle Technology Ltd.

ROOL Store

The official C/C++ Development kit and more here.

Donate! Why?

Help ROOL make things happen – please consider donating!

Navigation

  • Home Page
  • All Pages
  • Recently Revised
  • Authors
  • Feeds
Site design © RISC OS Open Limited 2011 except where indicated
The RISC OS Open Instiki theme is based on Insitki's default layout

Valid XHTML 1.0  |  Valid CSS

Instiki 0.19.1(MML+)
This site runs on Rails

Hosted by Arachsys