Variables

A variable, in Proteus, can be a string, an integer number or a floating point number, without distinction. Every variable can change its type during execution and is automatically created the first time it appears in the source code.

A variable name is a sequence of characters (case unsensitive) of any length; spaces, tabs, double quotes and the symbols '=', '&', '|', '^', '*', '\', '/' are not allowed in the name, which cannot start with a digit (0-9), with a sign (+/-) or with characters '@' and '!'.

Variables cannot be used before having being assigned a value: if this happens, Proteus stops execution and warns the user, specifying the variable that triggered the exception.

Examples
Valid variable names:
STRING X A1
Invalid variable names:
1A MY"VAR STREQ

There are a few predefined variables:

L current line (string)
N number of lines read
S size of input file (bytes)
F name of input file
EOF boolean flag: end of file?
BOF boolean flag: start of file?
ARGC number of parameters on the command line (minimum 4)
EOL line terminator, used by PRINTLN, FWRITELN, FINSERT; predefined value depends on the version being used: CR+LF for Dos/Windows™, LF for Unix™
CEOL line terminator, used by CONSOLELN and DEBUG; predefined value depends on the version being used: CR+LF for Dos/Windows™, LF for Unix™
EEOL line terminator, used by ERRORLN; predefined value depends on the version being used: CR+LF for Dos/Windows™, LF for Unix™
OS determined operating system:
0 = Unix™
1 = Ms-Dos™
2 = Windows™
3 = Win32 ISAPI
4 = Win32 Service 
VERSION interpreter version
R_LENGTH maximum length of the string found by the last call to REXMATCH/ REXIMATCH
R_START start of the string found by the last call to REXMATCH/ REXIMATCH
MONTHS string of 12 words, separated by spaces or commas, used as values returned by CMONTH (January -> December)
DAYS string of 7 words, separated by spaces or commas, used as values returned by CDOW (Sunday -> Saturday)
EPOCH reference value used to determine century in dates where year is specified by using only two digits; default value is 1970
DATE_TYPE date format; determine how strings are interpreted by the functions on dates; possible values:
  • 0 - american format - mm/dd/yy[yy]
  • 1 - european format - dd/mm/yy[yy] (default);
  • 2 - japanese format - yy[yy]/mm/dd;

if DATE_TYPE is different from 0-2, it is assumed 1 (european format)

TIME_TYPE time format (for DIRLAST, TIME); possible values:
  • 0 - 12 hours
  • other - 24 hours

In both cases, the time is 9 characters long; in 24 hour mode, the last character is space; in 12 hour mode, it is 'a' or 'p'.

PROG_DATA this variable is predefined only if the directive !endprog appears inside the program; its value becomes the offset in the script file of the first line following the directive
FILE_MASK this variable is predefined only under Unix™; it sets the access rights used for the creation of new files by the following functions:

As usual under Unix™, these rights are masked by complementing the umask of the process (which can be modified through UMASK).

The value assigned to this variabile must be a string of three octal numbers, from "000" to "777", representing the access rights to the file for the owner, the group and the others, respectively; each digit is the sum of the following values:

  • 1 for execution right
  • 2 for writing
  • 4 for reading

Initially, FILE_MASK is "000".

PID this variabile is predefined only under Unix™; at the beginning of the execution its value is set to the value of the process id.

R_LENGTH and R_START are set to 0 at the beginning and change their values after each call to REXMATCH/ REXIMATCH.

EOL, CEOL, MONTHS, DAYS, EPOCH, DATE_TYPE, TIME_TYPE and FILE_MASK should be updated during execution, if necessary; the other predefined variables can also be changed, even though this is not reccommended, because the program becomes difficult to understand.

Use PSET and PUB to access these variables from user defined functions (UDFs), or use the prefix '_' before the variable name: PUB(VARIABLE) is the same as _VARIABLE.

Start of page Next topic Previous topic Contents Index
Midnight Lake iPhone Case Black Women Shoes Black Flat Shoes Leather Flats Black Patent Ballerinas Black Ballet Shoes Casual Shoes Black Shoes Women Balle Record Player Cufflinks Best iPhone XR Clear Cases iPhone XS/XS Max Leather Cases Sale Best iPhone 8/8 Plus Silicone Cases iPhone 7/7 Plus Cases & Screen Protector New Cases For iPhone 6/6 Plus iPhone 8 Case Sale iPhone Xr Case Online iPhone 7 Case UK Online iPhone X Case UK Sale iPhone X Case Deals iPhone Xs Case New Case For iPhone Xr UK Online Case For iPhone 8 UK Outlet Fashion Silver Cufflinks For Men Best Mens Cufflinks Outlet Online The Gold Cufflinks Shop Online Cheap Shirt Cufflinks On Sale Nice Wedding Cufflinks UK Online Top Black Cufflinks UK Online Mens Cufflinks Online Silver Cufflinks For Men Men Cufflinks UK Sale Gold Cufflinks UK Online Gold Cufflinks UK Silver Cufflinks UK Shirt Cufflinks Discount Online Mens Cufflinks Deals & Sales Girls Shoes For Dance Fashion Ballet Dance Shoes Best Ballet Flats Shoes UK Online Cheap Ballet Pointe Shoes UK Online Best Ballet Shoes Outlet Best Dance Shoes Sale Cheap Ballet Flats Sale UK Best Pointe Shoes Online UK Ballet Dance Shoes UK Shoes For Dance UK Best Ballet Slippers Shop Best Yoga Shoes Hotsell