iDevOS CALC Command
Basic Mathematical Functions
iDevOS provides a number of operators which support basic mathematics, such as:
"++"
,"--"
- increment and decrement"+"
,"-"
- addition and subtraction"*"
,"/"
- multiplication and division"%"
- modulus"&"
,"|"
,"^"
,"<"
,">"
- bitwise AND, OR, XOR, left shift, right shift
See CALC
Basic Commands for further details.
There are also a number of operators which perform a combination of the basic operators. Firstly a basic mathematical operation is performed on the first two parameters and then a second mathematical operation is performed on the result with a third parameter. For example "+%"
, which can be used for circular buffer indexing, where an index can be increased by a value and then the modulus taken. The operators are:
"++"
,"--"
,"+-"
,"-+"
"**"
,"//"
,"*/"
,"/*"
"*+"
,"*-"
,"+*"
,"-*"
"/+"
,"/-"
,"+/"
,"-/"
"%+"
,"%-"
,"+%"
,"-%"
See CALC
Basic Commands for further details.
Mathematical Functions
"ABS"
- Absolute value"EXP"
- Exponential function"LOG"
- Natural logarithm"LOG10"
- Base-10 logarithm"SQRT"
- Non-negative square root"CBRT"
- Cube root"POW"
- X raised to the power of Y"MIN"
- Minimum value from a set of 2 or 3 variables"MAX"
- Maximum value from a set of 2 or 3 variables"RND"
- Generate a random number
Trigonometric Functions
"COS"
- Cosine"SIN"
- Sine"TAN"
- Tangent"ACOS"
- Arc cosine"ASIN"
- Arc sine"ATAN"
- Arc tangent"ATAN2"
- "Two argument" arc tangent"COSH"
- Hyperbolic cosine"SINH"
- Hyperbolic sine"TANH"
- Hyperbolic tangent"ACOSH"
- Hyperbolic arc cosine"ASINH"
- Hyperbolic arc sine"ATANH"
- Hyperbolic arc tangent
Entity Functions
"ESIZE"
- Get allocated display size for an entity"PIXX"
- Get the display width of an entity"PIXY"
- Get the display height of an entity"POSX"
- Get the display X-position of an entity on a page"POSY"
- Get the display Y-position of an entity on a page"EDEL"
- Check if an entity is deleted"EVIS"
- Check if an entity is visible"EALIGN"
- Get the alignment of an entity"EXISTS"
- Check if an entity exists (immediate name)"VEXISTS"
- Check if an entity exists (name in a variable)"PCOPY"
- Copy pointers"EINFO"
- Get textual information about an entity
Text String Functions
These commands are specifically for text strings that can contain the "hidden" cursor and password characters. For commands that operate on buffers of data (where all bytes are processed the same), see the Data Buffer Functions, below.
Cursor Control
Cursor Movement
"LOC"
- Get the cursor location in a text string"POS"
- Move cursor to absolute position"REL"
- Move cursor to relative position"ECURY"
- Get current row of text cursor
Cursor Type
Cursor Text Actions
"AFT"
- Get a number of characters after the cursor in a text string"BEF"
- Get a number of characters before the cursor in a text string"DEL"
- Delete a number of characters at the cursor in a text string"INS"
- Insert/Overwrite text at cursor
Other Text String Functions
"LEN"
- Get the text string length"REM"
- Remove all occurrences of some text from a text string"IREM"
- Case insensitive remove all occurrences of some text from a text string"FIND"
- Find first location of a text string in another text string"IFIND"
- Case-insensitive find first location of a text string in another text string"LFIND"
- Find last location of a text string in another text string"ILFIND"
- Case-insensitive find last location of a text string in another text string"UPPER"
- Convert text string to uppercase"LOWER"
- Convert text string to lowercase"TRIM"
- Trim characters from start and end of text string"LTRIM"
- Trim characters from start of text string"RTRIM"
- Trim characters from end of text string"SPLIT"
- Split text string at a delimiter"MSPLIT"
- Multiple split of a buffer or text string to a series of variables
Data Buffer Functions
These commands are for processing buffers of data (where all bytes are processed the same). For commands which are specifically for text strings (which can contain the "hidden" cursor and password characters), see Text String Functions, above.
"BFIND"
- Find first location of a data pattern in a buffer"BLFIND"
- Find last location of a data pattern in a buffer"BLEN"
- Get buffer length"BTRIM"
- Trim bytes from the start and end of a buffer"BLTRIM"
- Trim bytes from the start of a buffer"BRTRIM"
- Trim bytes from the end of a buffer"BCOPY"
- Copy a number of characters from a buffer"BCUT"
- Cut a number of characters from a buffer"BREM"
- Remove all occurrences of one buffer in another"BCUTB"
- Cut all chars from src0 up to src1"BCUTBI"
- Cut all chars from src0 up to and including src1"BCNV"
- Convert ASCII or raw hex string to a number"BINS"
- Insert buffer into buffer at a position"BREP"
- Replace buffer with buffer at a position"BREPB"
- Replace all occurrences of a matching buffer with another"MSPLIT"
- Multiple split of a buffer or text string to a series of variables
Arrays
"ASORT"
- Sort an array in ascending order"ASORTR"
- Sort an array in descending order"MIN"
- Minimum value contained in an array"MAX"
- Maximum value contained in an array"SHIFT"
- Shift the values in an array up or down its indices
Conversion Functions
"CFLT"
- Convert U32 to/from float"C16TO24"
- Convert 16-bit colour to 24-bit colour"C24TO16"
- Convert 24-bit colour to 16-bit colour"TOBASE"
- Convert to base string"FROMBASE"
- Convert from base string
File Functions
"DIR"
- Get a list of files in a directory"FEXISTS"
- Check if a file exists"FREAD"
- Read a file"FINFO"
- Get tag information for a file