Copyright (c) Hyperion Entertainment and contributors.

Difference between revisions of "AmigaOS Manual: ARexx Special Variables"

From AmigaOS Documentation Wiki
Jump to navigation Jump to search
(Added variable STDIN)
m (Added NOVALUE, HALT, PROCEDURE, and DROP links)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
There are four special variables that ARexx sets automatically during execution of a script:
+
There are five special variables that ARexx sets automatically during execution of a script:
 
{| class="wikitable"
 
{| class="wikitable"
| RC || RC is set to return code from any executed host command. If an ERROR or SYNTAX interrupt occures, RC is set to the error code that triggered the interrupt. The NOVALUE and HALT interrupts have no effect on RC.
+
| RC || RC is set to return code from any executed host command. If an ERROR or SYNTAX interrupt occures, RC is set to the error code that triggered the interrupt. The [[AmigaOS_Manual:_ARexx_Instructions#SIGNAL|NOVALUE]] and [[AmigaOS_Manual:_ARexx_Instructions#SIGNAL|HALT]] interrupts have no effect on RC.
 
|-
 
|-
 
| RC2 || RC2 is a secondary return code set by a host command in case of an ERROR. It tells why the command execution failed. RC2 is set only when RC is greater than zero.
 
| RC2 || RC2 is a secondary return code set by a host command in case of an ERROR. It tells why the command execution failed. RC2 is set only when RC is greater than zero.
Line 9: Line 9:
 
| SIGL || SIGL contains the line number of the last instruction that caused a jump to a label.
 
| SIGL || SIGL contains the line number of the last instruction that caused a jump to a label.
 
|-
 
|-
| STDIN || Logical name of the standard input/output stream. Functions READCH(), READLN(), WRITECH(), and WRITELN() can use STDIN for reading and writing to the console window.
+
| STDIN || Logical name of the standard input/output stream. Functions [[AmigaOS_Manual:_ARexx_Functions#READCH.28.29|READCH]], [[AmigaOS_Manual:_ARexx_Functions#READLN.28.29|READLN]], [[AmigaOS_Manual:_ARexx_Functions#WRITECH.28.29|WRITECH]], and [[AmigaOS_Manual:_ARexx_Functions#WRITELN.28.29|WRITELN]] can use STDIN for reading and writing to the console window.
 
|}
 
|}
None of these variables have an initial value. They may be altered by the user, but ARexx will continue to set them automatically when appropriate. The PROCEDURE and DROP instructions also affect these variables.
+
The RC, RC2, RESULT, and SIGL variables have no initial value. They may be altered by the user, but ARexx will continue to set them automatically when appropriate. The [[AmigaOS_Manual:_ARexx_Instructions#PROCEDURE|PROCEDURE]] and [[AmigaOS_Manual:_ARexx_Instructions#DROP|DROP]] instructions also affect these variables.

Latest revision as of 10:51, 21 March 2019

There are five special variables that ARexx sets automatically during execution of a script:

RC RC is set to return code from any executed host command. If an ERROR or SYNTAX interrupt occures, RC is set to the error code that triggered the interrupt. The NOVALUE and HALT interrupts have no effect on RC.
RC2 RC2 is a secondary return code set by a host command in case of an ERROR. It tells why the command execution failed. RC2 is set only when RC is greater than zero.
RESULT RESULT is set by a RETURN instruction in a subroutine that has been called. If the RETURN instruction has no expression on it, then RESULT becomes uninitialized. After a host command has been executed successfully, RESULT contains the command's result string. In case of an ERROR, RESULT is uninitialized.
SIGL SIGL contains the line number of the last instruction that caused a jump to a label.
STDIN Logical name of the standard input/output stream. Functions READCH, READLN, WRITECH, and WRITELN can use STDIN for reading and writing to the console window.

The RC, RC2, RESULT, and SIGL variables have no initial value. They may be altered by the user, but ARexx will continue to set them automatically when appropriate. The PROCEDURE and DROP instructions also affect these variables.