The r4 program operates as a Windows 32 console application. The following is the syntax of a r4 program request, that is entered as a DOS command prompt. There are four variations. In the first variation, r4 is the only program that is executed. The remaining variations are command pipelines. The vertical bars separate pipeline command segments.
r4 programName [argumentText] [ < inFile ] [ [>]> outFile ]
r4 programName [argumentText] [ < inFile ] | programB
programA | r4 programName [argumentText] [ [>]> outFile ]
programA | r4 programName [argumentText] | programB |
controlVariable = initialValue [ to limitValue ] [ by stepValue ] [ for repetitionValue ] |
repetitionValueExpression |
forever |
while booleanExpression |
until booleanExpression |
if booleanExpression then
instruction if booleanExpression then instruction else instruction if booleanExpression then do instruction instruction ...etc end if booleanExpression then instruction else do instruction instruction ...etc end if booleanExpression then do instruction instruction ...etc end else do instruction instruction ...etc end if booleanExpression then do instruction instruction ...etc end else instruction |
The conditionName in the signal ON or OFF is one of the following:
(space) | date() time() | the space between the functions is a space concatenation operator |
|| | date() || time() | the '||' operator is an explicit concatenation operator |
(abuttal) | date()' at 'time() | the quoted string is implicitly concatenated to the adjacent terms |
+ | Add | 21 + 21 | |
- | Subtract | 44 - 2 | |
* | Multiply | 6 * 7 | |
/ | Divide | 84 / 2 | |
% | Integer divide | 85 % 2 | |
// | Remainder | 42 // 50 | similar to modulo but the result can be negative |
** | Power (exponent) | 2 ** 4 | |
Prefix + | (0 + number) | + 42 | |
Prefix - | (0 - number) | - 42 |
= | equal |
¬=, \=, ><, <> | not equal |
> | greater than |
< | less than |
>=, ¬<, \< | greater than or equal; not less than |
<=, ¬>, \> | less than or equal; not greater than |
== | strictly equal |
¬==, \== | strictly not equal |
>> | strictly greater than |
<< | strictly less than |
>>=, ¬<<, \<< | strictly greater than or equal; strictly not less than |
<<=, ¬>>, \>> | strictly less than or equal; strictly not greater than |
& | And | returns '1' when both terms are true, and '0' otherwise |
| | Or | returns '1' when either term is true, and '0' otherwise |
&& | Exclusive or | returns '1' when one of the terms is true (but not both), and '0' otherwise |
Prefix ¬, Prefix \ | Logical not | returns '1' when the term is '0', and '0' when the term is '1'. |
1 The name of a stream is one of:
|
2 When the selectorPool option of the VALUE function is specified, it is interpreted as follows:
|
The following shows how the VALUE function is used to set and reference environment variable values.
/* DOENV.REX */
call value 'magic', 'abracadabra', 'system' /* set magic environment variable */ say value( 'magic', , 'system' ) /* get magic environment variable */ |
Access to system registry information allows r4 to prepare and reference information that is used by other system software. This is a powerful capability. However, since system registry information is critical to correct system operation, r4 can only perform some registry operations. You should be particularly careful when revising registry values. Erroneous revisions can have serious consequences. These changes cannot be undone.
Due to the sensitivity of system registry information, r4 can only be used to access and revise registry values. The product does not provide capabilities for accessing registry keys directly, and registry keys and values can not be removed. All registry values that are accessed by r4 must be strings. No other registry value format is supported.
As an extra precaution, registry revisions are only permitted when the R4REGISTRYWRITE environment variable has value: 'Y'. You can locally alter this value, as shown in the example below. No error occurs if this environment variable has not been set.
You are strongly advised to B-A-C-K-U-P the system registry before attempting to revise it with an R4 program.
If you are unfamiliar with the detailed characteristics of the system registry, you should discuss what you plan to do with a business colleague or friend, BEFORE attempting to revise registry information.
Registry values are accessed using a three part name, that has the following structure:
root\keyPath[valueName]
The keyPath consists of a hierarchy of keys separated by backslashes.
The valueName must be enclosed in square brackets.
The root must be one of the following:
'HKEY_CLASSES_ROOT'
'HKEY_CURRENT_USER'
'HKEY_LOCAL_MACHINE'
'HKEY_USERS'
'HKEY_CURRENT_CONFIG'
'HKEY_DYN_DATA'
The following root aliases are supported:
'HKCU' | HKEY_CURRENT_USER |
'HKLM' | HKEY_LOCAL_MACHINE |
'HKCR' | HKEY_CLASSES_ROOT |
'HKU' | HKEY_USERS |
'HKCC' | HKEY_CURRENT_CONFIG |
'HKDD' | HKEY_DYN_DATA |
The following shows how the VALUE function is used to access and revise system registry values.
/* DOREG.REX */
root = 'HKEY_CURRENT_USER' keypath = 'Software\Kilowatt Software\DoReg' regvalue = 'Magic' /* enable registry revision */ call value 'R4REGISTRYWRITE', 'Y', 'system' /* set R4REGISTRYWRITE=Y */ /* revise registry value */ call value root'\'keypath'['regvalue']', 'abracadabra', 'registry' /* disable registry revision */ call value 'R4REGISTRYWRITE', 'N', 'system' /* set R4REGISTRYWRITE=N */ /* registry values can still be retrieved */ /* get registry value */ say value( root'\'keypath'['regvalue']', , 'registry' ) |