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

OS_ReadVarVal

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

OS_ReadVarVal

(SWI &23)
Entry
R0 Pointer to wildcarded name
R1 Pointer to buffer
R2 Length of buffer, or -ve to check existence/read length
R3 Name pointer, or 0 for 1st call
R4 3 to expand macros and numbers to strings
Exit if R2 on entry was negative (read length)
R0 Corrupt (pointer to error)
R1 Preserved
R2 NOT (length), or 0 if variable does not exist
R3 New name pointer
R4 Variable type
Exit if R2 on entry was positive (read value)
R0 Preserved
R1 Preserved
R2 bytes read
R3 new name pointer
R4 Variable type

Use

The purpose of this call is to read a variable’s value

Notes

This SWI returns type and value of a variable. To check if it exists or find its length, call with R2 < 0. If the variable does not exist R2 will be 0. Otherwise the length is given by NOT(R2), although for anything other than a string variable (type 0) this is the unexpanded length. For either case an error will be returned.

RISC OS 2 does not let you read the length; it merely returns R2 negative to indicate the variable exists. On RISC OS 2 variables are limited to 256 bytes. Returned strings are not zero terminated (and may contain embedded zero bytes). Code variables seem to be indistinguishable from string variables (type 0). Numeric variables are written as 4 bytes in the buffer if expansion is not requested.

This SWI is marked as being re-entrant, which would allow it to re-enter the same code variable’s read code. No note is made about this in OS_SetVarVal and the code variable example in the PRM calls OS_Byte 135 which has undefined re-entrancy.

See also

  • OS_Byte 135
  • OS_ReadVarVal Variable Types
  • OS_SetVarVal
Created on December 1, 2009 19:39:13 by Alan Robertson (52)? (127.0.0.1)
Edit | Views: Print | Source | Linked from: Error Generators, OS SWI Calls, OS_ReadVarVal Variable Types, Variable Type Code, OS_SetVarVal, *Show

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