CALC
Command Menu
|
Numeric
Mathematical Calculation
|
|
IFIND-Loc of Case
Insensitive text |
 |
|
BLEN-Get Buffer Length - number of bytes |
 |
+ ,
- , /, *, %, |, & , ^, ++, -- |
 |
|
ILFIND-Last Loc of
Case Insensitive text |
 |
|
BTRIM-Buffer Trim bytes start and end |
 |
ABS, EXP, LOG, LOG10, POW, SQRT, CBRT, RND |
 |
|
REM-Remove text |
 |
|
BLTRIM-Buffer Trim bytes from start |
 |
COS, SIN, TAN, ACOS, ASIN, ATAN, ATAN2 |
 |
|
IREM-Remove Case
Insensitive text |
 |
|
BRTRIM-Buffer Trim bytes from end |
 |
COSH, SINH, TANH, ACOSH, ASINH, ATANH |
 |
|
SPLIT-Split Text at Char or
String |
 |
|
BREM-Buffer Remove bytes |
 |
|
|
|
PIXX-Get Width of Entity |
 |
|
BCNV-Convert hex data in buffer to number |
 |
Text Manipulation and search |
|
PIXY-Get Height of Entity |
 |
|
|
|
POS-Move
Cursor to Absolute Position |
 |
|
PCOPY-Pointer Copy
|
 |
|
Checksum Create or test checksums |
|
REL-Move
Cursor to Relative Position |
 |
|
SHIFT-Array Data Shift |
 |
|
MCHK-Make checksum |
 |
INS-Insert
/ Overwrite Text at Cursor |
 |
|
MIN-Find minimum value in array |
 |
|
TCHK-Test checksum |
 |
DEL-Delete
Text at Cursor |
 |
|
MAX-Find maximum value in array |
 |
|
CRC16-16 support |
 |
TRIM-Trim
Chars off Start and End of Text |
 |
|
MSPLIT-User Protocol Split
|
 |
|
CRC32-32 support |
 |
LTRIM-Trim
Chars from Start of Text String |
 |
|
CFLT-Calc float to/from U32 |
 |
|
|
|
RTRIM-Trim
Chars from End of Text String |
 |
|
|
|
|
File Search and Read |
|
UPPER-Convert
Text to Uppercase |
 |
|
Buffer Manipulation and Search |
|
FEXISTS-Checks for existence of file |
 |
LOWER-Convert
Text to Lowercase |
 |
|
BCOPY-Buffer
Copy n bytes |
 |
|
FREAD-Read Text File into Text buffer |
 |
BEF-Get
Chars from Before Cursor |
 |
|
BCUT-Buffer Cut n bytes |
 |
|
DIR-Directory Listing |
 |
AFT-Get
Chars from After Cursor |
 |
|
BCUTB-Cut chars from start of buffer |
 |
|
FINFO-Get file Info |
 |
CUR-Change
Cursor Type |
 |
|
BCUTBI-Cut chars from end of buffer |
 |
|
|
|
LEN-Get
Text Length |
 |
|
BBINS-Buffer Insert bytes at position |
 |
|
Sort Array Contents/Check entity info |
|
LOC-Get
Cursor Location |
 |
|
BREP-Buffer Replace bytes at position |
 |
|
ASORT-Sort
Array |
 |
TYPE-Get
Cursor Type |
 |
|
BREPB-Replace buffer with another buffer |
 |
|
ASORTR-Sort
Array |
 |
FIND-Find
Location of text |
 |
|
BFIND-Buffer Find |
 |
|
ENTITY
INFO-Find entity Information |
 |
LFIND-Find
Last Location of text |
 |
|
BLFIND-Buffer Find Last |
 |
|
ENTITY EXISTS-Test if
entity exists |
 |
|
|
|
|
|
|
|
|
|
|
|
Command |
CALC - Numeric Handling |
|
|
Description |
This provides a fast simple calculation placed in the
Result variable according to the type
of Method using + , - , / , *, %(modulus) or logical functions | (OR) & (AND)
^ (EXOR) for non float.
The source parameters can be text, numeric, variables or pointers as
appropriate.
More complex calculation methods for maths, trigs, text and
buffers are described below.
|
|
|
Syntax/Parameters |
CALC(Result,VarA,VarB,Method)
+ - Add
- - Minus
/ - Divide
* - Multiply
% - Modulus
| - OR (Logical) non float
& - AND (logical) non float
^ -EXOR (logical) non float
> - shift bits
< - shift bits
eg
CALC(varIndex,varIndex,1,"+"); // Buffer wrapping: varIndex = varIndex
+ 1
CALC(varX2,DISPX,2,"*"); // Centre of display: varX2 = DISPX * 2
CALC(hours_f,Time.mins,60,"/"); // Fractional hours: hours_f = Time.mins
/ 60
20 Combined CALC() Functions
''/-'', ''+/'', ''*+'', ''+%'', ''++'', etc - v49.48
* Added 20 "combined" CALC() functions:
CALC( varD, varX, varY, varZ, "/-" ); // varD = ( varX / varY ) - varZ
CALC( varD, varX, varY, varZ, "/+" ); // varD = ( varX / varY ) + varZ
CALC( varD, varX, varY, varZ, "-/" ); // varD = ( varX - varY ) / varZ
CALC( varD, varX, varY, varZ, "+/" ); // varD = ( varX + varY ) / varZ
CALC( varD, varX, varY, varZ, "*-" ); // varD = ( varX * varY ) - varZ
CALC( varD, varX, varY, varZ, "*+" ); // varD = ( varX * varY ) + varZ
CALC( varD, varX, varY, varZ, "-*" ); // varD = ( varX - varY ) * varZ
CALC( varD, varX, varY, varZ, "+*" ); // varD = ( varX + varY ) * varZ
CALC( varD, varX, varY, varZ, "%-" ); // varD = ( varX % varY ) - varZ
CALC( varD, varX, varY, varZ, "%+" ); // varD = ( varX % varY ) + varZ
CALC( varD, varX, varY, varZ, "-%" ); // varD = ( varX - varY ) % varZ
CALC( varD, varX, varY, varZ, "+%" ); // varD = ( varX + varY ) % varZ
CALC( varD, varX, varY, varZ, "++" ); // varD = ( varX + varY ) + varZ
CALC( varD, varX, varY, varZ, "+-" ); // varD = ( varX + varY ) - varZ
CALC( varD, varX, varY, varZ, "-+" ); // varD = ( varX - varY ) + varZ
CALC( varD, varX, varY, varZ, "--" ); // varD = ( varX - varY ) - varZ
CALC( varD, varX, varY, varZ, "**" ); // varD = ( varX * varY ) * varZ
CALC( varD, varX, varY, varZ, "*/" ); // varD = ( varX * varY ) / varZ
CALC( varD, varX, varY, varZ, "/*" ); // varD = ( varX / varY ) * varZ
CALC( varD, varX, varY, varZ, "//" ); // varD = ( varX / varY ) / varZ
* varX operator1 varY is always performed first followed by operator2
varZ
eg
CALC(varIndex,varIndex,1,128,"+%"); // Buffer wrapping: varIndex = (
varIndex + 1 ) % 128
CALC(varX2,DISPX,2,1,"/-"); // Centre of display: varX2 = ( DISPX / 2 )
- 1
CALC(hours_f,Time.mins,60,Time.hours,"/+"); // Fractional hours: hours_f
= ( Time.mins / 60 ) + Time.hours
|
|
|
Command |
CALC - ++ / -- Increment/Decrement - v49.51 |
|
|
Description |
CALC(num,''++''); and CALC(num,''--'');
Added:
CALC( dst, "++" ); // dst = dst + 1;
CALC( dst, src, "++" ); // dst = src + 1;
CALC( dst, "--" ); // dst = dst - 1;
CALC( dst, src, "--" ); // dst = src - 1; |
|
|
Syntax/Parameters |
VAR(a,0,U8);
VAR(b,0,U8);
CALC(a,"++");
a=1
CALC(a,"++");
a = 2
CALC(b,a,"++");
b=3
CALC(b,"--");
b=2 |
|
|
Command |
CALC -Maths Functions |
|
|
Description |
This provides a fast simple calculation placed in the
Result variable according to the type
of Method using + , - , / , *, %(modulus) or logical functions | (OR) & (AND)
^ (EXOR) for non float. |
|
|
Syntax/Parameters |
CALC(Result,VarA,VarB,Method)
ABS - Absolute Value of varX - CALC( varD, varX, "ABS" );
EXP - Exponential Function of varX - CALC( varD, varX, "EXP" );
LOG - Natural Logarithm of varX - CALC( varD, varX, "LOG" );
LOG10 - Base-Ten Logarithm of varX - CALC( varD, varX, "LOG10" );
POW - varX Raised to the Power of vary - CALC( varD, varX, varY,"POW");
SQRT
- Non-Negative Square Root of varX - CALC( varD, varX, "SQRT" );
CBRT - Cube Root of varX - CALC( varD, varX, "CBRT" );
RND - Random Number Generation - CALC( varD, varX, "RND" ); - v49.08
|
|
|
Command |
CALC - Trigonometric Functions |
|
|
Description |
This provides a fast simple calculation placed in the
Result variable according to the type
of Method using + , - , / , *, %(modulus) or logical functions | (OR) & (AND)
^ (EXOR) for non float. |
|
|
Syntax/Parameters |
varD is result, varX is source, set system parameter angle=degres or
radians;
COS - Cosine of varX - CALC( varD, varX, "COS" );
SIN - Sine of varX - CALC( varD, varX, "SIN" );
TAN - Tangent of varX - CALC( varD, varX, "TAN" );
ACOS - Arc Cosine of varX - CALC( varD, varX, "ACOS" );
ASIN - Arc Sine of varX - CALC( varD, varX, "ASIN" );
ATAN - Arc Tangent of varX - CALC( varD, varX, "ATAN" );
ATAN2 - Arc Tangent of varX/varY - CALC( varD, varX, varY, "ATAN2" );
COSH - Hyperbolic Cosine of varX - CALC( varD, varX, "COSH" );
SINH - Hyperbolic Sine of varX - CALC( varD, varX, "SINH" );
TANH - Hyperbolic Tangent of varX - CALC( varD, varX, "TANH" );
ACOSH - Hyperbolic Arc Cosine of varX - CALC( varD, varX, "ACOSH" );
ASINH - Hyperbolic Arc Sine of varX - CALC( varD, varX, "ASINH" );
ATANH - Hyperbolic Arc Tangent of varX - CALC( varD, varX, "ATANH" ); |
|
|
Command |
CALC - RND -
Random Number Generation |
|
|
Description |
Gives varD equal to a Random number (0 to 0.999999) multiplied by varX. |
|
|
Syntax/Parameters |
CALC( varD, varX, "RND" ); |
|
|
Topic |
Text and Cursor Handling |
|
|
Description |
Calc can be used for text and cursor manipulation where editable text is
to be placed on the screen as in a calculator or editable text field. Various
methods allow cursor movement and type, text insertion and deletion,
find or delete text, cursor position and length.
VarA contains the existing text and VarB the modifier text, cursor
position or a text length.
Example: CALC(EditBox,EditBox, "A","INS"); Inserts the letter 'A' into the
text at the cursor position
Cursor and Text Types
\\01 defines the
text as a PASSWORD so that only ***** are shown until another
\\01 or end;.
\\02 defines a
hidden cursor with over write and
\\03 a hidden
cursor with insert ON
\\04 defines an
underline cursor with over write and
\\05 an underline
cursor with insert ON
\\06 defines a
block cursor with over write and
\\07 a ertical
cursor with insert ON
A detailed description follows for each method.
'dst' and 'src' can be the same text variable.
'src' is unmodified unless same text variable as 'dst'.
Supported data types:
The parameters can be text, numeric, variables or pointers as
appropriate |
|
|
Command |
CALC - POS -
Move Cursor to Absolute
Position |
|
|
Description |
Moves cursor in text 'src'
to absolute position 'pos'
and stores result text in 'dst'.
If 'pos'
is less than zero, then cursor is put before first character ('pos'=0).
If 'pos'
is greater than
the length of 'src'
then the cursor is placed after the last character. |
|
|
Syntax/Parameters |
CALC( dst, src, pos, "POS" ); |
|
|
Command |
CALC - REL -
Move Cursor
to Relative Position |
|
|
Description |
Moves cursor in text 'src'
by displacement specified in 'mov'
and stores result text in 'dst'.
Positive values of 'mov'
move the cursor to the right and negative values of 'mov'
move the cursor to the left. If
the move results in a cursor position of less than zero, then the cursor
is put before first character. If the move results in a cursor position greater than the length of 'src'
then the cursor is placed after the last character. |
|
|
Syntax/Parameters |
CALC( dst, src,
mov, "REL" ); |
|
|
Command |
CALC - INS -
Insert / Overwrite Text at Cursor |
|
|
Description |
Puts
text from 'src2'
into 'src1'
at the cursor and stores the result text in 'dst'.
The
text will either be overwritten or inserted depending on the cursor type
in 'src1'.
If
no cursor is present then the text is appended to the end of 'src1'.
'src1'
and 'src2'
are unmodified unless same text variable as 'dst' |
|
|
Syntax/Parameters |
CALC( dst,
src1, src2, "INS" ); |
|
|
Command |
CALC - DEL -
Delete Text at Cursor |
|
|
Description |
Deletes 'num' characters from text 'src'
at the cursor and stores the result text in 'dst'.
If 'num'
is positive, then 'num' characters will be deleted after cursor. If 'num'
is negative, then -'num' characters will be deleted before
cursor (backspace).
If no cursor is present and 'num'
is negative, then -'num'
characters will be deleted from the end of the text in 'src'.
If no cursor is present and 'num'
is positive, then 'num' characters will be deleted from the start of the
text in 'src'. |
|
|
Syntax/Parameters |
CALC( dst, src, num, "DEL" ); |
|
|
Command |
CALC - TRIM -
Trim Characters from Start and End of Text String |
|
|
Description |
Removes
all text characters found in 'list'
from the start and end of text in 'src'
and stores the result text in 'dst'.
If 'list'
is ""
(empty string) then spaces (20hex), tabs (09hex), line feeds (0Ahex),
and carriage returns (0Dhex) are removed. |
|
|
Syntax/Parameters |
CALC( dst, src, list, "TRIM" ); |
|
|
Command |
CALC - LTRIM -
Trim Characters from Start of Text String |
|
|
Description |
Removes
all text characters found in 'list'
from the start of text in 'src'
and stores the result text in 'dst'. If 'list'
is ""
(empty string) then spaces (20hex), tabs (09hex), line feeds (0Ahex),
and carriage returns (0Dhex) are removed. |
|
|
Syntax/Parameters |
CALC( dst, src, list, "LTRIM" ); |
|
|
Command |
CALC - RTRIM -
Trim Characters from End of Text String |
|
|
Description |
Removes all text characters found in 'list'
from the end of text in 'src'
and stores the result text in 'dst'. If 'list'
is ""
(empty string) then spaces (20hex), tabs (09hex), line feeds (0Ahex),
and carriage returns (0Dhex) are removed. |
|
|
Syntax/Parameters |
CALC( dst, src,
list, "LTRIM" ); |
|
|
Command |
CALC - UPPER -
Convert Text to Uppercase |
|
|
Description |
Converts
the characters 'a'-'z'
to uppercase 'A'-'Z'
in text 'src'
and stores result text in 'dst'. |
|
|
Syntax/Parameters |
CALC( dst, src, 0, "UPPER" ); |
|
|
Command |
CALC - LOWER -
Convert Text to Lowercase |
|
|
Description |
Converts
the characters 'A'-'Z'
to lowercase 'a'-'z'
in text 'src'
and stores result text in 'dst'. |
|
|
Syntax/Parameters |
CALC( dst, src,
0, "LOWER" ); |
|
|
Command |
CALC - BEF
- Get Characters from Before Cursor |
|
|
Description |
'num'
characters are copied from before the cursor in text 'src'
and stored in text 'dst'.
If
no cursor in present then 'num'
characters are copied from the end of 'src'.
If 'num'
is larger than the number of characters available in 'src'
then only the available characters are copied. If 'num'
is negative, then the function performs as "AFT". |
|
|
Syntax/Parameters |
CALC( dst, src, num, "BEF" ); |
|
|
Command |
CALC - AFT
- Get Characters from After Cursor |
|
|
Description |
'num'
characters are copied from after the cursor in text 'src'
and stored in text 'dst'.
If
no cursor in present then 'num'
characters are copied from the start of 'src'.
If 'num'
is larger than the number of characters available in 'src'
then only the available characters are copied. If 'num'
is negative, then the function performs as "BEF". |
|
|
Syntax/Parameters |
CALC( dst, src, num, "AFT" ); |
|
|
Command |
CALC -CUR
- Change Cursor Type |
|
|
Description |
The cursor in text 'src'
is changed to type 'type'
and the result is stored in text 'dst'.
If no cursor is present, then the new
cursor is appended to the end.
If 'type'
is a string then the first character is taken as the cursor type.
'type'
=> integer variable | pointer to integer variable | integer | text
variable | pointer to text variable | "string" |
|
|
Syntax/Parameters |
CALC( dst, src, type, "CUR" ); |
|
|
Command |
CALC - LEN
- Get Text Length |
|
|
Description |
The
length of text 'src'
plus 'num' is stored in variable 'len'.
Cursor
characters are not included in the length. |
|
|
Syntax/Parameters |
CALC( len, src, num, "LEN" ); |
|
|
Command |
CALC -
LOC
- Get Cursor Location |
|
|
Description |
The location of the cursor in text 'src'
plus 'num'
is stored in variable 'loc'.
If no cursor is present then a value of
0 is used. |
|
|
Syntax/Parameters |
CALC( loc, src, num, "LOC" ); |
|
|
Command |
CALC -
TYPE - Get Cursor Type |
|
|
Description |
The
cursor type in text 'src'
is stored in variable 'type'.
If
no cursor is present then a value of 0 is used. |
|
|
Syntax/Parameters |
CALC( type, src, 0, "TYPE" ); |
|
|
Command |
CALC -
FIND
- Find Location of Text1 in Text2 |
|
|
Description |
The first location of the match of text 'src2'
(needle) in text 'src1'
(haystack) is returned in 'loc'.
If no matches are found then -1
is returned in 'loc'.
Cursor characters are not included in
the calculation. |
|
|
Syntax/Parameters |
CALC( loc, src1, src2, "FIND" ); |
|
|
Command |
CALC - LFIND - Find Location of
last Text1
in Text2 |
|
|
Description |
The last location of the match of text 'src2'
(needle) in text 'src1'
(haystack) is returned in 'loc'.
If no matches are found then -1
is returned in 'loc'.
Cursor characters are not included in
the calculation. |
|
|
Syntax/Parameters |
CALC( loc, src1, src2, "LFIND" ); |
|
|
Command |
CALC - IFIND - Find Location of Case Insensitive Text1 in Text2 |
|
|
Description |
The
first location of the case insensitive match of text 'src2'
(needle) in text 'src1'
(haystack) is returned in 'loc'
If no case insensitive matches are
found then -1
is returned in 'loc'.
Cursor characters are not included in
the calculation. |
|
|
Syntax/Parameters |
CALC( loc,
src1, src2, "FIND" ); |
|
|
Command |
CALC - ILFIND - Find Location of
last Case Insensitive Text1 in Text2 |
|
|
Description |
The
last location of the case insensitive match of text 'src2'
(needle) in text 'src1'
(haystack) is returned in 'loc'
If no case insensitive matches are
found then -1
is returned in 'loc'.
Cursor characters are not included in
the calculation. |
|
|
Syntax/Parameters |
CALC( loc,
src1, src2, "FIND" ); |
|
|
Command |
CALC - REM - Remove Every Text1 in Text2 |
|
|
Description |
Remove
every occurrence of text 'src2'
(needle) from text 'src1'
(haystack) and store the result
text in 'dst'. |
|
|
Syntax/Parameters |
CALC( dst, src1, src2, "REM" ); |
|
|
Command |
CALC - IREM - Remove Every Case Insensitive Text1 in Text2 |
|
|
Description |
Remove every case insensitive
occurrence of text 'src2'
(needle) from text 'src1'
(haystack) and store the result text in 'dst'. |
|
|
Syntax/Parameters |
CALC( dst,
src1, src2, "IREM" ); |
|
|
Command |
CALC - SPLIT
- Split Text at Character or String |
|
|
Description |
Split the text 'src'
at the character 'char' or string 'str'
storing the text after 'char' or 'str'
back into 'src'
and storing the text
before 'char' or 'str'
into 'dst'
or converting to number 'num'. If no 'char' or 'str' are present then the whole of 'src'
is processed.
If we have string 'str'
then the first character is taken as the split character.
'src'
is modified during this operation.
See BCUT for similar function where
length is used instead of delimiter.
Added count option to split after nth occurrence of split string.
If n is positive then split at nth occurrence from start of src.
If n is negative then split at nth occurrence from end of src.
CALC( dst, src, str, n, "SPLIT" ); |
|
|
Syntax/Parameters |
CALC( dst, src, char, "SPLIT" );
CALC( num, src, char, "SPLIT" );
CALC( dst, src, str, "SPLIT" );
CALC( dst, src, str, n, "SPLIT" );
Examples (assuming 's' is set each time):
VAR(s,"Theheshethee",TXT);
VAR(d,"",TXT);
CALC(d,s,"e","SPLIT"); // d="Th"; s="heshethee"
CALC(d,s,"she","SPLIT"); // d="Thehe"; s="thee"
CALC(d,s,\\65,"SPLIT"); // d="Th"; s="heshethee"
CALC(d,s,"e",2,"SPLIT"); // d="Theh"; s="shethee"
CALC(d,s,"e",20,"SPLIT"); // d="Theheshethee"; s=""
CALC(d,s,"p",2,"SPLIT"); // d="Theheshethee"; s=""
CALC(d,s,"e",-2,"SPLIT"); // d="Thehesheth"; s="e"
CALC(d,s,"e",-20,"SPLIT"); // d="Theheshethee"; s=""
CALC(d,s,"she",-1,"SPLIT"); // d="Thehe"; s="thee"
CALC(d,s,"he",-1,"SPLIT"); // d="Theheshet"; s="e"
CALC(d,s,"he",-2,"SPLIT"); // d="Thehes"; s="thee" |
|
|
Command |
CALC - PIXX
- Get Width of Entity |
|
|
Description |
The
display width in pixels of entity 'ent'
plus 'num'
is stored in 'size'.
Note,
variables do not have a size and return 0. Text, image, draw, touch
keys, and pages do have sizes. |
|
|
Syntax/Parameters |
CALC( size, ent, num, "PIXX" ); |
|
|
Command |
CALC - PIXY
- Get Height of Entity |
|
|
Description |
The
display height in pixels of entity 'ent'
plus 'num'
is stored in 'size'.
Note,
variables do not have a size and return 0. Text, image, draw, touch
keys, and pages do have sizes. |
|
|
Syntax/Parameters |
CALC( size, ent, num, "PIXY" ); |
|
|
Command |
CALC - PCOPY - Pointer Copy
|
|
|
Description |
Pointers can be copied using CALC(dst,src,"PCOPY"); |
|
|
Syntax/Parameters |
CALC(dst,src,"PCOPY");
Example:
VAR( v1 > "v3", PTR );
VAR( v2 > "v4", PTR );
VAR( v3, "alpha", TXT );
VAR( v4, "beta", TXT );
gives: v1>v3; v2>v4; v1=alpha; v2=beta; v3=alpha; v4=beta
CALC( v1, v2, "PCOPY" );
gives: v1>v4; v2>v4; v1=beta; v2=beta; v3=alpha; v4=beta
|
|
|
Command |
CALC - SHIFT - Array Data Shift |
|
|
Description |
Function shifts the values in an array up or down its indices.
> CALC( array, carry, shift, "SHIFT" );
> CALC( array, shift, "SHIFT" );
- 'array' is shifted by 'shift' places, one shift at a time.
- If 'shift' is positive then array.1 -> array.2; array.0 -> array.1 etc
- If 'shift' is negative then array.1 -> array.0; array.2 -> array.1 etc
- The shift is 'circular', so the shifted out value is shifted in the other end.
- If 'carry' is specified then the shift passes through the carry, ie the carry is shifted in and a new
carry is shifted out.
|
|
|
Syntax/Parameters |
CALC( array, carry, shift, "SHIFT" );
CALC( array, shift, "SHIFT" ); |
|
|
Command |
CALC - MIN |
|
|
Description |
Function obtains the minimum values stored in an array.
The minimum value in the 'array' is stored in 'val'
CALC(...''MIN''); - v49.48
* The minimum of 2 or 3 numbers can now be calculated
* CALC( varD, varX, varY, [varZ,] "MIN" ); // varD = MINIMUM of varX and varY
(and varZ if present)
eg
CALC( varD, 10, 20, "MIN" ); // varD = 10
CALC( varD, 100, -69, 5, "MIN" ); // varD = -69 |
|
|
Syntax/Parameters |
CALC( val, array, "MIN" ); |
|
|
Command |
CALC - MAX |
|
|
Description |
Function obtains the maximum values stored in an array.
The maximum value in the 'array' is stored in 'val'
CALC(...''MAX''); - v49.48
* The maximum of 2 or 3 numbers can now be calculated
* CALC( varD, varX, varY, [varZ,] "MAX" ); // varD = MAXIMUM of varX and varY
(and varZ if present)
eg
CALC( varD, 100, -69, 5, "MAX" ); // varD = 5
CALC( varD, 29.345, -200.4, "MAX" ); // varD = 29.345 |
|
|
Syntax/Parameters |
CALC( val, array, "MAX" ); |
|
|
Command |
CALC - BCOPY - Buffer Copy - Copy n bytes |
|
|
Description |
Copy length from start of src or if length negative, from end
Copy length from posn of src or if length negative, before posn
|
|
|
Syntax/Parameters |
CALC(dst,src,len,"BCOPY");
CALC(dst,sc,pos,len,"BCOPY");
|
|
|
Command |
CALC - BCUT - Buffer Cut - Cut n bytes |
|
|
Description |
Cut length from start of src or if length negative, from end
and put in dst. src is modified
Cut length from posn of src or if length negative, before posn
and put in dst. src is modified
|
|
|
Syntax/Parameters |
CALC(dst,src,len,"BCUT");
CALC(dst,src,pos,len,"BCUT"); |
|
|
Command |
CALC -BBINS - Buffer Insert - Insert bytes at position |
|
|
Description |
Insert insvar at posn of
src
|
|
|
Syntax/Parameters |
CALC(dst,src,insvar,pos,"BINS"); |
|
|
Command |
CALC - BREP - Buffer Replace - Replace bytes at position |
|
|
Description |
Replace from pos of src insvar
content and save in dest |
|
|
Syntax/Parameters |
CALC(dst,src,insvar,pos,"BREP"); |
|
|
Command |
CALC - BFIND - Buffer Find - Locate data from position |
|
|
Description |
Find first location of fvar content from
pos of src. Returns -1 if not exist |
|
|
Syntax/Parameters |
CALC(dst,src,fvar,"BFIND"); |
|
|
Command |
CALC - BLFIND - Buffer Find Last - Locate last data from position |
|
|
Description |
Find last location of fvar content from
pos of src. Returns -1 if not exist |
|
|
Syntax/Parameters |
CALC(dst,src,fvar,"BLFIND"); |
|
|
Command |
CALC - BLEN - Get Buffer Length - Calculate number of bytes |
|
|
Description |
Dst is length of src + num
|
|
|
Syntax/Parameters |
CALC(dst,src,num,"BLEN"); |
|
|
Command |
CALC - BTRIM - Buffer Trim Start and End - Remove bytes
beginning and end
|
|
|
Description |
Remove bytes in trimvar from front and end of
src |
|
|
Syntax/Parameters |
CALC(dst,src,trimvar,"BTRIM"); |
|
|
Command |
CALC - BLTRIM - Buffer Trim Start - Remove bytes from start |
|
|
Description |
Remove bytes in trimvar from front of
src |
|
|
Syntax/Parameters |
CALC(dst,src,trimvar,"BLTRIM"); |
|
|
Command |
CALC - BRTRIM - Buffer Trim End - Remove bytes from end |
|
|
Description |
Remove bytes in trimvar from end of
src |
|
|
Syntax/Parameters |
CALC(dst,src,trimvar,"BRTRIM"); |
|
|
Command |
CALC - BREM
- Buffer Remove - Find and remove bytes |
|
|
Description |
Remove every occurance
of remvar from src |
|
|
Syntax/Parameters |
CALC(dst,src,remvar,"BREM"); |
|
|
Command |
CALC -
BCNV - Convert hex data in buffer to number |
|
|
Description |
Ability to convert hex data in buffer to number. |
|
|
Syntax/Parameters |
CALC( dstVar, srcTxtVar, "HEX8A", "BCNV" ); // Convert 2 ASCII hex chars
CALC( dstVar, srcTxtVar, "HEX8D", "BCNV" ); // Convert 1 Binary char
CALC( dstVar, srcTxtVar, "HEX16A", "BCNV" ); // Convert 4 ASCII hex chars
CALC( dstVar, srcTxtVar, "HEX16D", "BCNV" ); // Convert 2 Binary chars
CALC( dstVar, srcTxtVar, "HEX24A", "BCNV" ); // Convert 6 ASCII hex chars
CALC( dstVar, srcTxtVar, "HEX24D", "BCNV" ); // Convert 3 Binary chars
CALC( dstVar, srcTxtVar, "HEX32A", "BCNV" ); // Convert 8 ASCII hex chars
CALC( dstVar, srcTxtVar, "HEX32D", "BCNV" ); // Convert 4 Binary chars
Example
VAR( varSrc, "12AB0123", TXT );
VAR( varU32, 0, U32 );
CALC( varU32, varSrc, "HEX32A", "BCNV" );
LOAD( RS2, varU32 ); \\ Outputs 313196835
LOAD( RS2, %h08%varU32 ); \\ Outputs 12ab0123 |
|
|
Command |
CALC -
BREPB - Buffer Replace - Replace all occurrences of one string
(buffer) with another (buffer) |
|
|
Description |
Function to replace all occurrences of one string (buffer) with another (buffer)
CALC( dst, src, search, replace, "BREPB" );
All occurrences of 'search' in 'src' are replaced with 'replace' and the result is stored in 'dst'
dst and src can be the same variable.
|
|
|
Syntax/Parameters |
Examples
VAR(s,"Theheshethee",TXT); VAR(d,"",TXT);
CALC(d,s,"e","","BREPB"); // d="Thhshth"; s="Theheshethee"
CALC(d,s,"e","ABC","BREPB"); // d="ThABChABCshABCthABCABC"; s="Theheshethee"
CALC(d,s,"she","ABC","BREPB"); // d="TheheABCthee"; s="Theheshethee"
CALC(d,s,"SHE","ABC","BREPB"); // d="Theheshethee"; s="Theheshethee"
CALC(s,s,"e","ABC","BREPB"); // d=""; s="ThABChABCshABCthABCABC"
|
|
|
Command |
CALC -
BCUTB - Buffer Cut - Cut chars from start of string (buffer)
|
|
|
Description |
Functions to cut chars from start of string (buffer)
CALC( dst, src, "str", n, "BCUTB" ); // cut up to "str" in src
CALC( dst, src, "str", "BCUTB" ); // cut up to 1st "str" in src
If n is positive then cut at nth occurrence from start of src
If n is negative then cut at nth occurrence from end of src
dst and src can be the same variable.
|
|
|
Syntax/Parameters |
Examples
VAR(s,"Theheshethee",TXT); VAR(d,"",TXT);
CALC(d,s,"e","BCUTB"); // d="eheshethee"; s="Theheshethee"
CALC(d,s,"she","BCUTB"); // d="shethee"; s="Theheshethee"
CALC(d,s,\\65,"BCUTB"); // d="eheshethee"; s="Theheshethee"
CALC(d,s,"e",2,"BCUTB"); // d="eshethee"; s="Theheshethee"
CALC(d,s,"e",20,"BCUTB"); // d=""; s="Theheshethee"
CALC(d,s,"p",2,"BCUTB"); // d=""; s="Theheshethee"
CALC(d,s,"e",-2,"BCUTB"); // d="Theheshethe"; s="Theheshethee"
CALC(d,s,"e",-20,"BCUTB"); // d=""; s="Theheshethee"
CALC(d,s,"she",-1,"BCUTB"); // d="Theheshe"; s="Theheshethee"
CALC(d,s,"he",-1,"BCUTB"); // d="Theheshethe"; s="Theheshethee"
CALC(d,s,"he",-2,"BCUTB"); // d="Theheshe"; s="Theheshethee"
CALC(s,s,"e",2,"BCUTB"); // d=""; s="eshethee"
|
|
|
Command |
CALC -
BCUTBI - Buffer Cut - Cut chars from end of string(buffer) |
|
|
Description |
Functions to cut chars from end of string (buffer)
CALC( dst, src, "str", n, "BCUTBI" ); // cut up to and including "str" in src
CALC( dst, src, "str", "BCUTBI" ); // cut up to and including 1st "str" in src
If n is positive then cut at nth occurrence from start of src
If n is negative then cut at nth occurrence from end of src
* dst and src can be the same variable.
|
|
|
Syntax/Parameters |
* Examples
VAR(s,"Theheshethee",TXT); VAR(d,"",TXT);
CALC(d,s,"e","BCUTBI"); // d="heshethee"; s="Theheshethee"
CALC(d,s,"she","BCUTBI"); // d="thee"; s="Theheshethee"
CALC(d,s,\\65,"BCUTBI"); // d="heshethee"; s="Theheshethee"
CALC(d,s,"e",2,"BCUTBI"); // d="shethee"; s="Theheshethee"
CALC(d,s,"e",20,"BCUTBI"); // d=""; s="Theheshethee"
CALC(d,s,"p",2,"BCUTBI"); // d=""; s="Theheshethee"
CALC(d,s,"e",-2,"BCUTBI"); // d="Thehesheth"; s="Theheshethee"
CALC(d,s,"e",-20,"BCUTBI"); // d=""; s="Theheshethee"
CALC(d,s,"she",-1,"BCUTBI"); // d="Thehe"; s="Theheshethee"
CALC(d,s,"he",-1,"BCUTBI"); // d="Theheshet"; s="Theheshethee"
CALC(d,s,"he",-2,"BCUTBI"); // d="Thehes"; s="Theheshethee"
CALC(s,s,"e",2,"BCUTBI"); // d=""; s="shethee"
|
|
|
Command |
CALC - FEXISTS |
|
|
Description |
Checks for existence of file in NAND or on SDHC card using CALC(dstVar, src, "FEXISTS");
Returns dstVar=0 if file 'src' does not exist, or dstVar=1 if the file 'src' exists |
|
|
Syntax/Parameters |
CALC(dstVar, src, "FEXISTS"); |
|
|
Command |
CALC - FREAD |
|
|
Description |
A text file can be read into a text buffer using CALC(dstTxtVar, src, "FREAD");
The buffer must be bigger than the file
size |
|
|
Syntax/Parameters |
CALC(dstTxtVar, src, "FREAD"); |
|
|
Command |
CALC -
DIR - directory listing |
|
|
Description |
Text variable can be populated with filenames in NAND: |
|
|
Syntax/Parameters |
CALC( dstTxtVar, src, filter, sep, "DIR" );
CALC( dstTxtVar, src, filter, "DIR" );
CALC( dstTxtVar, src, "DIR" );
dstTxtVar is a text variable and will contain number of files and subdirectories in list
followed by specified separator between each filename.
src is "nand" (in quotes).
sep is separator character for filenames and subdirectories in string (must be in quotes),
if
not included then "," assumed
filter is types of files to list, supported filters:
"*/" - list all files and subdirectories
"*.*", "*",
"*.bmp", "*.jpg", "*.png" (or "img" to get all image files)
"*.wav", "*.mp3", "*.wma" (or "snd" to get all sound files)
"*.fnt",
"*.txt",
"*.mnu",
"*.bin",
"*.tft",
"*.log",
"*.ppf",
"*.tri"
If not specified then "*" assumed.
Multiple filters can be included, separated by commas: "*.bmp,*.jpg,*.fnt"
Examples: (nand contains 1.bmp, 2.bmp, x.mnu)
CALC( txtVar, "nand", "*.bmp", ",", "DIR" ); // list all bitmap image files
> txtVar = "2,1.bmp,2.bmp";
CALC( txtVar, "nand", "*.fnt", "DIR" ); // list all font files
> txtVar = "0";
CALC( txtVar, "nand", "*.mnu", "DIR" ); // list all menu files
> txtVar = "1,x.mnu";
CALC( txtVar, "nand", "DIR" ); // list all files
CALC( txtVar, "nand", "*", "DIR" ); // same
CALC( txtVar, "nand", "*", ",", "DIR" ); // same
> txtVar = "3,x.mnu,1.bmp,2.bmp"; |
|
|
Command |
CALC - FINFO - Get Info |
|
|
Description |
Get info Function -
Fills dest string with the following :
filename, title, artist, length, samplerate, bitspersample, numchannels |
|
|
Syntax/Parameters |
CALC( dest, filename, "FINFO" ); |
|
|
Command |
CALC -Checksums - "MCHK", "TCHK" |
|
|
Description |
Add a checksum and check for a
checksum error |
|
|
Syntax/Parameters |
CALC( dst, src, "type", "MCHK" ); // Copy src buf to dst buf, make checksum of
"type" and append to dst buf
CALC( res, src, "type", "TCHK" ); // Test checksum of "type" in src buf and
set res to 1 if checksums same, else 0.
where "type" is:
"SUM8ZA" - Sum all data in src as type U8, checksum is two's complement of the
sum, stored as two ASCII hexadecimal characters
(when sum added to checksum is
zero, res is 1)
"SUM8ZD" - Sum all data in src as type U8, checksum is two's complement of sum,
stored as single U8
(when sum added to checksum is zero, res is 1)
"SUM8A" - Sum all data in src as type U8, checksum is sum, stored as two ASCII
hexadecimal characters
(when sum is same as checksum, res is 1)
"SUM8D" - Sum all data in src as type U8, checksum is sum, stored as single U8
(when sum is same as checksum, res is 1)
"XOR8A" - Exclusive-OR (XOR) of all data in src as type U8, checksum is XOR,
stored as two ASCII hexadecimal characters
(when XOR of src with checksum is
zero, res is 1)
"XOR8D" - Exclusive-OR (XOR) of all data in src as type U8, checksum is XOR,
stored as single U8
(when XOR of src with checksum is zero, res is 1)
Example:
LOAD(txData,"1234");
FUNC(SendData)
{
CALC(txData,txData,"SUM8ZA","MCHK"); // Add checksum (txData="123436")
LOAD(RS2,txData); // Send data
}
FUNC(ReceiveData)
{
LOAD(rxData,RS2); // Read data
CALC(res,rxData,"SUM8ZA","TCHK"); // Check for checksum error
IF(res=1?ProcessData:DataError);
} |
|
|
Command |
CALC - CRC16 - 16 support |
|
|
Description |
* Support for additional CRC-16 algorithms.
> Note CALC( dst32, srcBuf, length, "", "CRC16" ); will use the MODBUS ("modbus")
algorithm
CALC() "type"
|
Poly-nominal
|
Initial Value |
Reflect
In
|
Reflect
Out
|
XOR Out
Value
|
Names and aliases |
"arc" |
0x8005 |
0x0000 |
Yes |
Yes |
0x0000 |
"ARC", "CRC-16",
"CRC-IBM", "CRC-16/ARC", "CRC-16/LHA" |
"kermit" |
0x1021 |
0x0000 |
Yes |
Yes |
0x0000 |
"KERMIT"
"CRC-16/CCITT",
"CRC-16/CCITT-TRUE", "CRC-CCITT" |
"modbus" |
0x8005 |
0xFFFF, |
Yes |
Yes |
0x0000 |
"MODBUS" |
"x-25" |
0x1021 |
0xFFFF |
Yes |
Yes |
0xFFFF |
"X-25",
"CRC-16/IBM-SDLC",
"CRC-16/ISO-HDLC", "CRC-B" |
"xmodem" |
0x1021 |
0x0000 |
No |
No |
0x0000 |
"XMODEM", "ZMODEM", "CRC-16/ACORN" |
"ccitt-f" |
0x1021 |
0xFFFF |
No |
No |
0x0000 |
"CRC-16/CCITT-FALSE" |
"usb" |
0x8005 |
0xFFFF |
Yes |
Yes |
0xFFFF, |
"CRC-16/USB" |
"spi" |
0x1021 |
0x1D0F |
No |
No |
0x0000 |
"CRC-16/SPI-FUJITSU", "CRC-16/AUG-CCITT" |
"buypass" |
0x8005 |
0x0000 |
No |
No |
0x0000 |
"CRC-16/BUYPASS", "CRC-16/VERIFONE" |
"dds-110" |
0x8005 |
0x800D |
No |
No |
0x0000 |
"CRC-16/DDS-110" |
"dect-r" |
0x0589 |
0x0000 |
No |
No |
0x0001 |
"CRC-16/DECT-R" |
"dect-x" |
0x0589 |
0x0000 |
No |
No |
0x0000 |
"CRC-16/DECT-X" |
"dnp" |
0x3D65 |
0x0000 |
Yes |
Yes |
0xFFFF |
"CRC-16/DNP" |
"en13757" |
0x3D65 |
0x0000 |
No |
No |
0xFFFF |
"CRC-16/EN-13757" |
"genibus" |
0x1021 |
0xFFFF |
No |
No |
0xFFFF |
"CRC-16/GENIBUS", "CRC-16/EPC",
"CRC-16/I-CODE", "CRC-16/DARC" |
"maxim" |
0x8005 |
0x0000 |
Yes |
Yes |
0xFFFF |
"CRC-16/MAXIM" |
"mcrf4xx" |
0x1021 |
0xFFFF |
Yes |
Yes |
0x0000 |
"CRC-16/MCRF4XX" |
"riello", |
0x1021 |
0xB2AA |
Yes |
Yes |
0x0000 |
"CRC-16/RIELLO" |
"t10-dif", |
0x8BB7 |
0x0000 |
No |
No |
0x0000 |
"CRC-16/T10-DIF" |
"teledsk" |
0xA097 |
0x0000 |
No |
No |
0x0000 |
"CRC-16/TELEDISK" |
"tms371x" |
0x1021 |
0x89EC |
Yes |
Yes |
0x0000 |
"CRC-16/TMS37157" |
"a" |
0x1021 |
0xC6C6 |
Yes |
Yes |
0x0000 |
"CRC-A" |
* Results have been confirmed using the "123456789" test with the values at
http://regregex.bbcmicro.net/crc-catalogue.htm
|
|
|
Syntax/Parameters |
CALC( dst16, srcBuf, length, "type", "CRC16" ); |
|
|
Command |
CALC - CRC32 -32 support |
|
|
Description |
* Support for CRC-32 algorithms
> Note CALC( dst32, srcBuf, length, "", "CRC32" ); will use the CRC-32 ("adcpp")
algorithm
CALC()
"type"
|
Poly-nominal
|
Initial Value |
Reflect
In
|
Reflect
Out
|
XOR Out
Value
|
Names and aliases |
"adcpp" |
0x04C11DB7 |
0xFFFFFFFF |
Yes |
Yes |
0xFFFFFFFF |
"CRC-32",
"CRC-32/ADCCP",
"PKZIP" |
"bzip2" |
0x04C11DB7 |
0xFFFFFFFF |
No |
No |
0xFFFFFFFF |
"CRC-32/BZIP2",
"CRC-32/AAL5", "CRC-32/DECT-B", "B-CRC-32" |
"c" |
0x1EDC6F41 |
0xFFFFFFFF |
Yes |
Yes |
0xFFFFFFFF |
"CRC-32C",
"CRC-32/ISCSI",
"CRC-32/CASTAGNOLI" |
"d" |
0xA833982B |
0xFFFFFFFF |
Yes |
Yes |
0xFFFFFFFF |
"CRC-32D" |
"mpeg-2" |
0x04C11DB7 |
0xFFFFFFFF |
No |
No |
0x00000000 |
"CRC-32/MPEG-2" |
"posix" |
0x04C11DB7 |
0x00000000 |
No |
No |
0xFFFFFFFF |
"CRC-32/POSIX",
"CKSUM" |
"q" |
0x814141AB |
0x00000000 |
No |
No |
0x00000000 |
"CRC-32Q" |
"jamcrc" |
0x04C11DB7 |
0xFFFFFFFF |
Yes |
Yes |
0x00000000 |
"JAMCRC" |
"xfer" |
0x000000AF |
0x00000000 |
No |
No |
0x00000000 |
"XFER" |
* Results have been confirmed using the "123456789" test with the values at
http://regregex.bbcmicro.net/crc-catalogue.htm
|
|
|
Syntax/Parameters |
CALC( dst32, srcBuf, length, "type", "CRC32" ); |
|
|
Command |
CALC - MSPLIT -User Protocol Split
|
|
|
Description |
Perform a multiple split of a buffer to a series of
variables.
>>> CALC( dstPtr, srcBuf, char, "MSPLIT" );
- The buffer 'srcBuf' is split at each 'char' and each result is stored in an
incrementing series of variables prefixed with the name in 'dstPtr'.
- If 'dstPtr' contains "svar", the first variable will be 'svar0', then 'svar1',
'svar2', ..., 'svar9', 'svar10' etc.
- If a particular svarN is not defined then the result is not stored for that
split.
- The data is stored in the format specified in each 'svarN' allowing the buffer
to be split into text, unsigned/signed integers and floats.
Example
VAR( dst > "svar", PTR );
VAR( svar0, 0, U8 );
VAR( svar1, 0, S32 );
VAR( svar2, 0.0, FLT4 );
VAR( svar3, "", TXT );
VAR( buf, "123,-67,3.14,Hi", TXT );
CALC( dst, buf, ",", "MSPLIT" ); // Gives: svar0 = 123, svar1 = -67,
svar2 = 3.14, svar3 = "Hi"
>>> CALC( dstPtrArray, srcBuf, char, "MSPLIT"
);
- The buffer 'srcBuf' is split at each 'char' and
each result is stored in the variables pointed to by successive subscripts of the Pointer Array 'dstPtrArray'.
- The first variable will be the variable name
stored in 'dstPtrArray.0', then 'dstPtrArray.1', 'dstPtrArray.2',
- If a particular 'dstPtrArray.N' is not a variable or not defined then the
result is not stored for that split.
- The data is stored in the format specified in each 'dstPtrArray.N' variable
allowing the buffer to be split into text, unsigned/signed integers and floats.
Example
VAR( arr > "", PTR, 4 );
VAR( alpha, 0, U8 ); LOAD( arr.0 > "alpha" );
VAR( bravo, 0, S32 ); LOAD( arr.1 > "bravo" );
VAR( charlie, 0.0, FLT4 ); LOAD( arr.2 > "charlie" );
VAR( delta, "", TXT ); LOAD( arr.3 > "delta" );
VAR( buf, "123,-67,3.14,Hi", TXT );
CALC( arr, buf, ",", "MSPLIT" );
// Gives: alpha = 123, bravo = -67, charlie = 3.14, delta = "Hi"
- Using this method with arrays of pointers,
testing found the time to split 64 parameters using "MSPLIT"
was 8ms compared to 64 individual "SPLIT"s which took 30ms.
|
|
|
Syntax/Parameters |
CALC( ... "MSPLIT" )
|
|
|
Command |
CALC
- CFLT
- Calc float to/from U32 |
|
|
Description |
Added function to convert a U32 containing a IEEE 754 binary 32
formatted float into a float and vice versa.
Action depends on source and destination types.
> CALC( flt, u32, "CFLT" ); // Converts a float to IEEE 754 binary 32
formatted float
> CALC( u32, flt, "CFLT" ); // Converts an IEEE 754 binary 32
formatted float to a float |
|
|
Syntax/Parameters |
VALC( flt, u32, "CFLT" );
CALC( u32, flt, "CFLT" );
Example 1:
var(f,0,FLT4);
var(u,0,U32);
load(f,68.123);
calc(u,f,"cflt");
load(rs2,"f=",f,"; u=",%H08%u,"\\0d\\0a");
> f=68.1230; u=42883EFA
Example 2
load(u,\\41460000);
calc(f,u,"cflt");
load(rs2,"f=",f,"; u=",%H08%u,"\\0d\\0a");
> f=12.3750; u=41460000 |
|
|
Command |
CALC - Entity Information |
|
|
Description |
* More Calc commands added to obtain entity information
> CALC(var,ename,"ESIZE"); -> returns allocated display size in bytes
> CALC(var,ename,"EDEL"); -> returns 1 if entity has been deleted, else 0
> CALC(var,ename,"EVIS"); -> returns 1 if entity is visible, else 0
> CALC(var,ename,"EALIGN"); -> returns value representing alignment:
0 = Top Left, 1 = Top Centre, 2 = Top Right,
3 = Centre Left, 4 = Centre Centre, 5 = Centre Right,
6 = Bottom Left, 7 = Bottom Centre, 8 = Bottom Right |
|
|
Syntax/Parameters |
> CALC(var,ename,"ESIZE");
> CALC(var,ename,"EDEL");
> CALC(var,ename,"EVIS"); -
> CALC(var,ename,"EALIGN"); |
|
|
Command |
CALC(result,name,''EXISTS''); - v49.46 |
|
|
Description |
Entity Exists Test
* Added CALC(dst,name,"EXISTS"); to test whether entity "name" exists. |
|
|
Syntax/Parameters |
VAR(varRes,0,U8);
VAR(varAlpha,0,U8);
CALC(varRes,varAlpha,"EXISTS"); // varRes = 1
CALC(varRes,varBeta,"EXISTS"); // varRes = 0 |
|
|
Command |
Array Sort - CALC(..."ASORT"); and CALC(..."ASORTR"); |
|
|
Description |
Added functions to sort arrays
CALC(arrname, "ASORT|ASORTR");
CALC(arrname.index, "ASORT|ASORTR");
Examples :-
VAR(arrname, 0, U8, 10);
LOAD(arrname, 9, 34, 2, 42, 102, 33, 52, 1, 67, 19);
CALC(arrname, "ASORT");
Results :-
arrname.0 = 1
arrname.1 = 2
arrname.2 = 9
arrname.3 = 19
arrname.4 = 33
arrname.5 = 34
arrname.6 = 42
arrname.7 = 52
arrname.8 = 67
arrname.9 = 102
VAR(arrname, 0, U8, 3, 4);
LOAD(arrname.0, 34, 2, 67, 4);
LOAD(arrname.1, 123, 45, 6, 127);
LOAD(arrname.2, 3, 109, 16, 5);
CALC(arrname, "ASORT");
Results :-
arrname.0 = 3, 109, 16, 5
arrname.1 = 34, 2, 67, 4
arrname.2 = 123, 45, 6, 127
VAR(arrname, 0, U8, 3, 4);
LOAD(arrname.0, 34, 2, 67, 4);
LOAD(arrname.1, 123, 45, 6, 127);
LOAD(arrname.2, 3, 109, 16, 5);
CALC(arrname.1, "ASORT");
Results :-
arrname.0 = 34, 2, 67, 4
arrname.1 = 6, 45, 123, 127
arrname.2 = 3, 109, 16, 5
Additional Len parameter added to sort only a specified number of elements
Array Sort - CALC(...''ASORT''); and CALC(...''ASORTR''); - Improvements -
v49.39
* Added optional length parameter to sort only a specified number of elements :-
CALC(Arr [, len], "ASORT|ASORTR");
Renamed "RASORT" to "ASORTR". |
|
|
Syntax/Parameters |
CALC(arrname, "ASORT");
CALC(arrname.index, "ASORT");
CALC(arrname, "ASORTR");
CALC(arrname.index, "ASORTR");
CALC(arrname,len, "ASORT");
CALC(arrname.index,len, "ASORT");
CALC(arrname,len, "ASORTR");
CALC(arrname.index,len, "ASORTR"); |
|
|
Update Information |
Version |
Title |
Date |
Details |
00.49.60 |
PCOPY for Arrays |
05 Oct 15 |
|
Fixed issue with PCOPY when copying from an array of pointers.
|
|
00.14.00 |
PCOPY for Arrays |
05 Oct 15 |
|
Fixed issue with PCOPY when copying from an array of pointers.
|
|
49.58 |
CALC |
07 Sep 15 |
|
* Added VEXISTS command - allows the use of a variable as the source * Added ECURY command - gets current Y position of cursor in a text entity * Added C16TO24 and C24TO16 commands - converts between 16 and 24 bit colours * Added TOBASE and FROMBASE commands - converts from one base to another * Added BCNV command - convert HEX to binary * Added CFLT option result parameter and now handles invalid conversion
|
|
00.12.00 |
Added C16TO24 and C24TO16 CALC Commands |
03 Sep 15 |
|
Added C16TO24 and C24TO16 functions to convert values between 16bit and 24bit colours
|
|
00.12.00 |
Added VEXISTS CALC Command |
03 Sep 15 |
|
Added VEXISTS function to test for entity existence via a text variable
|
|
00.01.00 |
Improvements to Convert Text - CALC(...''BCNV''); |
13 Feb 15 |
|
Now provides conversion valid result CALC( dst, src, "type", "BCNV" ); Convert src text var to dst CALC( dst, src, result, "type", "BCNV" );
|
|
00.01.00 |
Improvements to Convert U32 to Float - CALC(...''CFLT''); |
13 Feb 15 |
|
Added check for invalid values in CFLT CALC function. Also added optional parameter to enable indication of success/failure CALC( varD, varX, "CFLT" ); CALC( varD, varX, varResult, "CFLT" );
|
|
00.01.00 |
Base Conversion - CALC(...''TOBASE''); and CALC(...''FROMBASE''); |
13 Feb 15 |
|
Added Base conversion functions: CALC( dst, src, base, padding, "TOBASE" ); Convert to base string CALC( dst, src, base, padding, "FROMBASE" ); Convert from base string
|
|
00.01.00 |
Get current Y position of text cursor - CALC(...''ECURY''); |
13 Feb 15 |
|
* Added new calc command - 'ECURY' to return the line number of any cursor within a TEXT entity :- CALC(result, entity, "ECURY");
|
|
49.51 |
CALC(num,''++''); and CALC(num,''--''); |
10 Feb 14 |
|
Added: CALC( dst, "++" ); // dst = dst + 1; CALC( dst, src, "++" ); // dst = src + 1; CALC( dst, "--" ); // dst = dst - 1; CALC( dst, src, "--" ); // dst = src - 1;
Examples: VAR(a,0,U8); VAR(b,0,U8); LOAD(RS2,a); 0 CALC(a,"++"); LOAD(RS2,a); 1 CALC(a,"++"); LOAD(RS2,a); 2 LOAD(RS2,b); 0 CALC(b,a,"++"); LOAD(RS2,b); 3 CALC(b,"--"); LOAD(RS2,b); 2 CALC(b,"--"); LOAD(RS2,b); 1 CALC(b,"--"); LOAD(RS2,b); 0 CALC(b,"--"); LOAD(RS2,b); 255
|
|
49.48 |
20 Combined CALC() Functions ''/-'', ''+/'', ''*+'', ''+%'', ''++'', etc |
29 Nov 13 |
|
* Added 20 "combined" CALC() functions: CALC( varD, varX, varY, varZ, "/-" ); // varD = ( varX / varY ) - varZ CALC( varD, varX, varY, varZ, "/+" ); // varD = ( varX / varY ) + varZ CALC( varD, varX, varY, varZ, "-/" ); // varD = ( varX - varY ) / varZ CALC( varD, varX, varY, varZ, "+/" ); // varD = ( varX + varY ) / varZ CALC( varD, varX, varY, varZ, "*-" ); // varD = ( varX * varY ) - varZ CALC( varD, varX, varY, varZ, "*+" ); // varD = ( varX * varY ) + varZ CALC( varD, varX, varY, varZ, "-*" ); // varD = ( varX - varY ) * varZ CALC( varD, varX, varY, varZ, "+*" ); // varD = ( varX + varY ) * varZ CALC( varD, varX, varY, varZ, "%-" ); // varD = ( varX % varY ) - varZ CALC( varD, varX, varY, varZ, "%+" ); // varD = ( varX % varY ) + varZ CALC( varD, varX, varY, varZ, "-%" ); // varD = ( varX - varY ) % varZ CALC( varD, varX, varY, varZ, "+%" ); // varD = ( varX + varY ) % varZ CALC( varD, varX, varY, varZ, "++" ); // varD = ( varX + varY ) + varZ CALC( varD, varX, varY, varZ, "+-" ); // varD = ( varX + varY ) - varZ CALC( varD, varX, varY, varZ, "-+" ); // varD = ( varX - varY ) + varZ CALC( varD, varX, varY, varZ, "--" ); // varD = ( varX - varY ) - varZ CALC( varD, varX, varY, varZ, "**" ); // varD = ( varX * varY ) * varZ CALC( varD, varX, varY, varZ, "*/" ); // varD = ( varX * varY ) / varZ CALC( varD, varX, varY, varZ, "/*" ); // varD = ( varX / varY ) * varZ CALC( varD, varX, varY, varZ, "//" ); // varD = ( varX / varY ) / varZ * varX operator1 varY is always performed first followed by operator2 varZ
eg CALC(varIndex,varIndex,1,128,"+%"); // Buffer wrapping: varIndex = ( varIndex + 1 ) % 128 CALC(varX2,DISPX,2,1,"/-"); // Centre of display: varX2 = ( DISPX / 2 ) - 1 CALC(hours_f,Time.mins,60,Time.hours,"/+"); // Fractional hours: hours_f = ( Time.mins / 60 ) + Time.hours
|
|
49.48 |
CALC(...''MIN''); and CALC(...''MAX''); |
29 Nov 13 |
|
* The minimum or maximum of 2 or 3 numbers can now be calculated * CALC( varD, varX, varY, [varZ,] "MIN" ); // varD = MINIMUM of varX and varY (and varZ if present) * CALC( varD, varX, varY, [varZ,] "MAX" ); // varD = MAXIMUM of varX and varY (and varZ if present) eg CALC( varD, 10, 20, "MIN" ); // varD = 10 CALC( varD, 100, -69, 5, "MIN" ); // varD = -69 CALC( varD, 29.345, -200.4, "MAX" ); // varD = 29.345
* Note this functionality is in addtion to the existing array max/min where the maximum/minimum value in an array is returned * CALC( varD, varArray, "MIN" ); // varD is minimum value in varArray * CALC( varD, varArray, "MAX" ); // varD is maximum value in varArray
|
|
49.48 |
Display Property Entities - DISPX, DISPY, DISPR |
29 Nov 13 |
|
* Added DISPX, DISPY, and DISPR built-in entities for display properties DISPX - Display Width - 320, 480, 640, 800 and 240, 272, 480 when rotated (S16C data) DISPY - Display Height - 240, 272, 480 and 320, 480, 640, 800 when rotated (S16C data) DISPR - Display Rotation in Degrees - 0, 90, 180, 270 (S16C data) eg LOAD(varDisplayWidth,DISPX);
|
|
49.46 |
Entity Exists Test - CALC(result,name,''EXISTS''); |
24 Oct 13 |
|
* Added CALC(dst,name,"EXISTS"); to test whether entity "name" exists.
eg VAR(varRes,0,U8); VAR(varAlpha,0,U8); CALC(varRes,varAlpha,"EXISTS"); // varRes = 1 CALC(varRes,varBeta,"EXISTS"); // varRes = 0
|
|
49.42 |
Array Sort - CALC(...''ASORT''); and CALC(...''ASORTR''); with length parameter |
06 Sep 13 |
|
* Added optional length parameter to sort only a specified number of elements:
CALC(Arr [, len], "ASORT|ASORTR");
|
|
49.39 |
Array Sort - CALC(...''ASORT''); and CALC(...''ASORTR''); - Improvements |
13 Jun 13 |
|
* Added optional length parameter to sort only a specified number of elements :-
CALC(Arr [, len], "ASORT|ASORTR");
Renamed "RASORT" to "ASORTR".
|
|
49.37 |
Array Sort - CALC(...''ASORT''); and CALC(...''RASORT''); |
10 Jun 13 |
|
* Added functions to sort arrays
CALC(arrname, "ASORT|RASORT"); CALC(arrname.index, "ASORT|RASORT");
Examples :-
VAR(arrname, 0, U8, 10); LOAD(arrname, 9, 34, 2, 42, 102, 33, 52, 1, 67, 19); CALC(arrname, "ASORT"); Results :- arrname.0 = 1 arrname.1 = 2 arrname.2 = 9 arrname.3 = 19 arrname.4 = 33 arrname.5 = 34 arrname.6 = 42 arrname.7 = 52 arrname.8 = 67 arrname.9 = 102
VAR(arrname, 0, U8, 3, 4); LOAD(arrname.0, 34, 2, 67, 4); LOAD(arrname.1, 123, 45, 6, 127); LOAD(arrname.2, 3, 109, 16, 5); CALC(arrname, "ASORT"); Results :- arrname.0 = 3, 109, 16, 5 arrname.1 = 34, 2, 67, 4 arrname.2 = 123, 45, 6, 127
VAR(arrname, 0, U8, 3, 4); LOAD(arrname.0, 34, 2, 67, 4); LOAD(arrname.1, 123, 45, 6, 127); LOAD(arrname.2, 3, 109, 16, 5); CALC(arrname.1, "ASORT"); Results :- arrname.0 = 34, 2, 67, 4 arrname.1 = 6, 45, 123, 127 arrname.2 = 3, 109, 16, 5
|
|
49.37 |
CALC(...''ABS''); not working with floats |
10 Jun 13 |
|
CALC(..."ABS"); command fixed for floating point numbers
|
|
49.34 |
CALC - Corrected ''BCNV'' hex conversion; Corrected default type for ''CRC16'' and ''CRC32'' |
23 Feb 13 |
|
CALC * Corrected "BCNV" hex conversion for "HEX16D", "HEX24D" and "HEX32D" with raw data. * Corrected default type for "CRC16" and "CRC32" where type is specified as empty string "".
|
|
49.32 |
CALC(...''BCOPY'')/CALC(...''BCUT'') - Fixed initialisation of variables. |
14 Feb 13 |
|
* Fixed initialisation of variables.
|
|
49.32 |
CALC(...''BCNV'') - Convert from Hex - Added ability to convert hex data in buffer to number. |
14 Feb 13 |
|
* Added ability to convert hex data in buffer to number. CALC( dstVar, srcTxtVar, "HEX8A", "BCNV" ); // Convert 2 ASCII hex chars CALC( dstVar, srcTxtVar, "HEX8D", "BCNV" ); // Convert 1 Binary char CALC( dstVar, srcTxtVar, "HEX16A", "BCNV" ); // Convert 4 ASCII hex chars CALC( dstVar, srcTxtVar, "HEX16D", "BCNV" ); // Convert 2 Binary chars CALC( dstVar, srcTxtVar, "HEX24A", "BCNV" ); // Convert 6 ASCII hex chars CALC( dstVar, srcTxtVar, "HEX24D", "BCNV" ); // Convert 3 Binary chars CALC( dstVar, srcTxtVar, "HEX32A", "BCNV" ); // Convert 8 ASCII hex chars CALC( dstVar, srcTxtVar, "HEX32D", "BCNV" ); // Convert 4 Binary chars * Example VAR( varSrc, "12AB0123", TXT ); VAR( varU32, 0, U32 ); CALC( varU32, varSrc, "HEX32A", "BCNV" ); LOAD( RS2, varU32 ); \\ Outputs 313196835 LOAD( RS2, %h08%varU32 ); \\ Outputs 12ab0123
|
|
49.21 |
CALC(...''SPLIT'') - Fixed problem with the SPLIT command when the destination is a numeric variable. |
11 Oct 12 |
|
Fixed problem with the SPLIT command when the destination is a numeric variable.
|
|
49.19 |
CALC(...''SPLIT'') - Added ability to split at string rather than just single char. |
05 Oct 12 |
|
Added ability to split at string rather than just single char * Added count option to split after nth occurrence of split string CALC( dst, src, "str", "SPLIT" ); CALC( dst, src, "str", n, "SPLIT" ); If n is positive then split at nth occurrence from start of src If n is negative then split at nth occurrence from end of src * Examples (assuming 's' is set each time) VAR(s,"Theheshethee",TXT); VAR(d,"",TXT); CALC(d,s,"e","SPLIT"); // d="Th"; s="heshethee" CALC(d,s,"she","SPLIT"); // d="Thehe"; s="thee" CALC(d,s,\\65,"SPLIT"); // d="Th"; s="heshethee" CALC(d,s,"e",2,"SPLIT"); // d="Theh"; s="shethee" CALC(d,s,"e",20,"SPLIT"); // d="Theheshethee"; s="" CALC(d,s,"p",2,"SPLIT"); // d="Theheshethee"; s="" CALC(d,s,"e",-2,"SPLIT"); // d="Thehesheth"; s="e" CALC(d,s,"e",-20,"SPLIT"); // d="Theheshethee"; s="" CALC(d,s,"she",-1,"SPLIT"); // d="Thehe"; s="thee" CALC(d,s,"he",-1,"SPLIT"); // d="Theheshet"; s="e" CALC(d,s,"he",-2,"SPLIT"); // d="Thehes"; s="thee"
|
|
49.19 |
CALC(...''DIR'') - Filters now include ''*.bin'', ''*.tft'', ''*.log'', ''*.ppf'', ''*.tri''. |
05 Oct 12 |
|
Filters now include "*.bin", "*.tft", "*.log", "*.ppf", "*.tri"
|
|
49.19 |
CALC(...''BREPB'') - Added function to replace all occurrences of one string (buffer) with another (buffer). |
05 Oct 12 |
|
Added function to replace all occurrences of one string (buffer) with another (buffer) CALC( dst, src, search, replace, "BREPB" ); * All occurrences of 'search' in 'src' are replaced with 'replace' and the result is stored in 'dst' * dst and src can be the same variable. * Examples VAR(s,"Theheshethee",TXT); VAR(d,"",TXT); CALC(d,s,"e","","BREPB"); // d="Thhshth"; s="Theheshethee" CALC(d,s,"e","ABC","BREPB"); // d="ThABChABCshABCthABCABC"; s="Theheshethee" CALC(d,s,"she","ABC","BREPB"); // d="TheheABCthee"; s="Theheshethee" CALC(d,s,"SHE","ABC","BREPB"); // d="Theheshethee"; s="Theheshethee" CALC(s,s,"e","ABC","BREPB"); // d=""; s="ThABChABCshABCthABCABC"
|
|
49.19 |
CALC(...''BCUTB'') and CALC(...''BCUTBI'') - Added functions to cut chars from start or end of string (buffer). |
05 Oct 12 |
|
Added functions to cut chars from start or end of string (buffer) CALC( dst, src, "str", n, "BCUTB" ); // cut up to "str" in src CALC( dst, src, "str", n, "BCUTBI" ); // cut up to and including "str" in src CALC( dst, src, "str", "BCUTB" ); // cut up to 1st "str" in src CALC( dst, src, "str", "BCUTBI" ); // cut up to and including 1st "str" in src If n is positive then cut at nth occurrence from start of src If n is negative then cut at nth occurrence from end of src * dst and src can be the same variable. * Examples VAR(s,"Theheshethee",TXT); VAR(d,"",TXT); CALC(d,s,"e","BCUTB"); // d="eheshethee"; s="Theheshethee" CALC(d,s,"she","BCUTB"); // d="shethee"; s="Theheshethee" CALC(d,s,\\65,"BCUTB"); // d="eheshethee"; s="Theheshethee" CALC(d,s,"e",2,"BCUTB"); // d="eshethee"; s="Theheshethee" CALC(d,s,"e",20,"BCUTB"); // d=""; s="Theheshethee" CALC(d,s,"p",2,"BCUTB"); // d=""; s="Theheshethee" CALC(d,s,"e",-2,"BCUTB"); // d="Theheshethe"; s="Theheshethee" CALC(d,s,"e",-20,"BCUTB"); // d=""; s="Theheshethee" CALC(d,s,"she",-1,"BCUTB"); // d="Theheshe"; s="Theheshethee" CALC(d,s,"he",-1,"BCUTB"); // d="Theheshethe"; s="Theheshethee" CALC(d,s,"he",-2,"BCUTB"); // d="Theheshe"; s="Theheshethee" CALC(d,s,"e","BCUTBI"); // d="heshethee"; s="Theheshethee" CALC(d,s,"she","BCUTBI"); // d="thee"; s="Theheshethee" CALC(d,s,\\65,"BCUTBI"); // d="heshethee"; s="Theheshethee" CALC(d,s,"e",2,"BCUTBI"); // d="shethee"; s="Theheshethee" CALC(d,s,"e",20,"BCUTBI"); // d=""; s="Theheshethee" CALC(d,s,"p",2,"BCUTBI"); // d=""; s="Theheshethee" CALC(d,s,"e",-2,"BCUTBI"); // d="Thehesheth"; s="Theheshethee" CALC(d,s,"e",-20,"BCUTBI"); // d=""; s="Theheshethee" CALC(d,s,"she",-1,"BCUTBI"); // d="Thehe"; s="Theheshethee" CALC(d,s,"he",-1,"BCUTBI"); // d="Theheshet"; s="Theheshethee" CALC(d,s,"he",-2,"BCUTBI"); // d="Thehes"; s="Theheshethee" CALC(s,s,"e",2,"BCUTB"); // d=""; s="eshethee" CALC(s,s,"e",2,"BCUTBI"); // d=""; s="shethee"
|
|
49.18 |
Pointer Copy - Pointers can now be copied using CALC(dst,src,''PCOPY'');. |
22 Sep 12 |
|
Pointers can now be copied using CALC(dst,src,"PCOPY"); * Example: VAR( v1 > "v3", PTR ); VAR( v2 > "v4", PTR ); VAR( v3, "alpha", TXT ); VAR( v4, "beta", TXT ); gives: v1>v3; v2>v4; v1=alpha; v2=beta; v3=alpha; v4=beta CALC( v1, v2, "PCOPY" ); gives: v1>v4; v2>v4; v1=beta; v2=beta; v3=alpha; v4=beta
|
|
49.18 |
DIR files and subdirectories - The files and subdirectories can now be listed in the CALC(...,''DIR'') command. |
22 Sep 12 |
|
The files and subdirectories can now be listed in the CALC(...,"DIR") command. * The "*/" filter is used to list the files and subdirectories. * The directories are not shown by default for backwards compatibility, therefore the filter must be used. CALC( varTxt, "SDHC/", "*/", "DIR" ); // List all files and subdirectories CALC( varTxt, "SDHC/", "*", "DIR" ); // Just list all files CALC( varTxt, "SDHC/", "DIR" ); // Just list all files (same as above) * In varTxt directories will end with a forward slash "/". Example: STYLE( stBuf, data ){ type=text; length=2048; } VAR( varTxt, "", stBuf ); CALC( varTxt, "SDHC/", "*/", "DIR" ); LOAD( RS2, varTxt ); gives: 9,tu480a.mnu,file.bmp,asc_16b.fnt,16KB.txt,file.txt,bkup/,mike.txt,tua04918.tft,boot/ CALC( varTxt, "SDHC/", "DIR" ); LOAD( RS2, varTxt ); gives: 7,tu480a.mnu,file.bmp,asc_16b.fnt,16KB.txt,file.txt,mike.txt,tua04918.tft
|
|
49.16 |
CALC(...,''SHIFT''); - Fixed problem with infinite entering loop with positive shift values. |
14 Sep 12 |
|
* Fixed problem with infinite entering loop with positive shift values.
|
|
49.08 |
Random Number Generation - CALC( varD, varX, ''RND'' ); |
11 Jul 12 |
|
CALC( varD, varX, "RND" ); * Gives varD equal to a Random number (0 to 0.999999) mutiplied by varX
|
|
49.03 |
NAND / NANDLIB / NANDMNU - All three sources/destination now globally accepted in LOAD/CALC etc commands. |
01 Jun 12 |
|
All three sources/destination now globally accepted in LOAD/CALC etc commands (previously just NAND accepted).
|
|
49.03 |
CALC( ... ''SHIFT'' ) - Fixed incrementing/up shift |
01 Jun 12 |
|
Fixed incrementing/up shift
|
|
49.03 |
AC97 - Added get info function - CALC( dest, filename, ''FINFO'' ); . |
01 Jun 12 |
|
Added get info function - CALC( dest, filename, "FINFO" ); - fills dest string with the following : filename, title, artist, length, samplerate, bitspersample, numchannels * Handles WAV header correclty and extracts metadata if present. * Plays WAV data directly rather than from RAM. * Added the following parameters :- > master_volume (0-100) - controls the overall output level of all outputs > speaker_volume (0-100) - controls the level of the speaker outputs > headphone_volume (0-100) - controls the level of the headphone outputs > balance (0-100) - 0 = all output biased to left channel, 50 = centre, 100 = all output biased to right channel > stereo_speaker (Y/N) - Y = when using the module with built in stereo audio amplifier, N = using the single speaker output
|
|
49.02 |
CALC( ... ''MSPLIT'' ) Multi-Split - New function added to perform a multiple split of a buffer to a series of variables. |
15 May 12 |
|
* New function added to perform a multiple split of a buffer to a series of variables. >>> CALC( dstPtr, srcBuf, char, "MSPLIT" );
- The buffer 'srcBuf' is split at each 'char' and each result is stored in an incrementing series of variables prefixed with the name in 'dstPtr'. - If 'dstPtr' contains "svar", the first variable will be 'svar0', then 'svar1', 'svar2', ..., 'svar9', 'svar10' etc. - If a particular svarN is not defined then the result is not stored for that split. - The data is stored in the format specified in each 'svarN' allowing the buffer to be split into text, unsigned/signed integers and floats.
- Example VAR( dst > "svar", PTR ); VAR( svar0, 0, U8 ); VAR( svar1, 0, S32 ); VAR( svar2, 0.0, FLT4 ); VAR( svar3, "", TXT ); VAR( buf, "123,-67,3.14,Hi", TXT ); CALC( dst, buf, ",", "MSPLIT" ); // Gives: svar0 = 123, svar1 = -67, svar2 = 3.14, svar3 = "Hi"
>>> CALC( dstPtrArray, srcBuf, char, "MSPLIT" );
- The buffer 'srcBuf' is split at each 'char' and each result is stored in the variables pointed to by successive subscripts of the Pointer Array 'dstPtrArray'.
- The first variable will be the variable name stored in 'dstPtrArray.0', then 'dstPtrArray.1', 'dstPtrArray.2', - If a particular 'dstPtrArray.N' is not a variable or not defined then the result is not stored for that split. - The data is stored in the format specified in each 'dstPtrArray.N' variable allowing the buffer to be split into text, unsigned/signed integers and floats.
- Example VAR( arr > "", PTR, 4 ); VAR( alpha, 0, U8 ); LOAD( arr.0 > "alpha" ); VAR( bravo, 0, S32 ); LOAD( arr.1 > "bravo" ); VAR( charlie, 0.0, FLT4 ); LOAD( arr.2 > "charlie" ); VAR( delta, "", TXT ); LOAD( arr.3 > "delta" ); VAR( buf, "123,-67,3.14,Hi", TXT ); CALC( dst, buf, ",", "MSPLIT" ); // Gives: alpha = 123, bravo = -67, charlie = 3.14, delta = "Hi"
- Using this method with arrays of pointers, testing found the time to split 64 parameters using "MSPLIT" was 8ms compared to 64 individual "SPLIT"s which took 30ms.
|
|
49.02 |
Array Minimum and Maximum Values - New functions added to obtain the minimum and maximum values stored in an array. |
15 May 12 |
|
CALC( ... "MIN" ) and CALC( ... "MAX" ) * New functions added to obtain the minimum and maximum values stored in an array > CALC( val, array, "MIN" ); The minimum value in the 'array' is stored in 'val' > CALC( val, array, "MAX" ); The maximum value in the 'array' is stored in 'val'
|
|
49.02 |
Array Data Shift - New function added to shift the values in an array up or down its indices. |
15 May 12 |
|
CALC( ... "SHIFT" ) * New function added to shift the values in an array up or down its indices. > CALC( array, carry, shift, "SHIFT" ); > CALC( array, shift, "SHIFT" ); - 'array' is shifted by 'shift' places, one shift at a time. - If 'shift' is positive then array.1 -> array.2; array.0 -> array.1 etc - If 'shift' is negative then array.1 -> array.0; array.2 -> array.1 etc - The shift is 'circular', so the shifted out value is shifted in the other end. - If 'carry' is specified then the shift passes through the carry, ie the carry is shifted in and a new carry is shifted out.
- Example VAR( arr, 0.0, FLT2, 5 ); VAR( car, 8.88, FLT2 ); LOAD( arr.0, 0.00 ); LOAD( arr.1, 1.11 ); LOAD( arr.2, 2.22 ); LOAD( arr.3, 3.33 ); LOAD( arr.4, 4.44 ); // setup arr = { 0.00, 1.11, 2.22, 3.33, 4.44 }
CALC( arr, -1, "SHIFT" ); // Gives arr = { 1.11, 2.22, 3.33, 4.44, 0.00 } CALC( arr, 2, "SHIFT" ); // Gives arr = { 4.44, 0.00, 1.11, 2.22, 3.33 } CALC( arr, car, -1, "SHIFT" ); // Gives arr = { 0.00, 1.11, 2.22, 3.33, 8.88 } and car = 4.44
LOAD( car, 9.99 ); CALC( arr, car, -1, "SHIFT" ); // Gives arr = { 1.11, 2.22, 3.33, 8.88, 9.99 } and car = 0.00
|
|
49.00 |
MCHK/TCHK - Fixed problem with CALC(...''MCHK''); and CALC(...''TCHK''); returning ''Not Var'' error. |
22 Mar 12 |
|
Fixed problem with CALC(..."MCHK"); and CALC(..."TCHK"); returning "Not Var" error.
|
|
49.00 |
CRC-32 Support - Support for CRC-32 algorithms has been implemented. |
22 Mar 12 |
|
Support for CRC-32 algorithms has been implemented. * CALC( dst32, srcBuf, "type", "CRC32" ); > Note CALC( dst32, srcBuf, "", "CRC32" ); will use the CRC-32 ("adcpp") algorithm
|
|
49.00 |
CRC-16 Support - Support for additional CRC-16 algorithms has been implemented. |
22 Mar 12 |
|
Support for additional CRC-16 algorithms has been implemented. * CALC( dst16, srcBuf, "type", "CRC16" ); > Note CALC( dst32, srcBuf, "", "CRC16" ); will use the MODBUS ("modbus") algorithm
|
|
49.00 |
CALC(AFT) - Fixed a bug where destination length was shorter than source length. |
22 Mar 12 |
|
Fixed a bug where destination length was shorter than source length causing copying to fail.
|
|
49.00 |
CALC float to/from U32 - Added function to convert a U32 containing a IEEE 754 binary 32 formatted float into a float. |
22 Mar 12 |
|
Added function to convert a U32 containing a IEEE 754 binary 32 formatted float into a float and vice versa. Action depends on source and destination types. > CALC( flt, u32, "CFLT" ); // Converts a float to IEEE 754 binary 32 formatted float > CALC( u32, flt, "CFLT" ); // Converts an IEEE 754 binary 32 formatted float to a float Example 1 var(f,0,FLT4); var(u,0,U32); load(f,68.123); calc(u,f,"cflt"); load(rs2,"f=",f,"; u=",%H08%u,"\\0d\\0a");
> f=68.1230; u=42883EFA Example 2 load(u,\\41460000); calc(f,u,"cflt"); load(rs2,"f=",f,"; u=",%H08%u,"\\0d\\0a");
> f=12.3750; u=41460000
|
|
48.24 |
CALC() - K00-K30 are now supported in source parameters for CALC(). |
10 Mar 12 |
|
K00-K30 are now supported in source parameters for CALC(), eg CALC( result, K00, K01, "&" ); Shifting CALC( dst, src, sh, "<" ); for shift left by sh places CALC( dst, src, sh, ">" ); for shift right by sh places Changed functionality such that: if destination or source is signed then signed maths is performed if destination or source is a float then float maths is performed if destination and all source unsigned then unsigned maths performed
Problem fixed with calculations returning 0 in some cases instead of correct result. Trig Functions Extra parameters now can be specified in CALC trig functions for faster angular calculations when drawing lines at angles
> CALC( varD, varX, varDiv, "ACOS" ); Arc Cosine of (varX/varDiv) > CALC( varD, varX, varDiv, "ASIN" ); Arc Sine of (varX/varDiv) > CALC( varD, varX, varDiv, "ATAN" ); Arc Tangent of (varX/varDiv) > CALC( varD, varX, varMul, "COS" ); VarMul * (Cosine of varX) > CALC( varD, varX, varMul, "SIN" ); VarMul * (Sine of varX > CALC( varD, varX, varMul, "TAN" ); VarMul * (Tangent of varX > CALC( varD, varX, varMul, "COSH" ); VarMul * (Hyperbolic Cosine of varX) > CALC( varD, varX, varMul, "SINH" ); VarMul * (Hyperbolic Sine of varX) > CALC( varD, varX, varMul, "TANH" ); VarMul * (Hyperbolic Tangent of varX) > CALC( varD, varX, varDiv, "ACOSH" ); Hyperbolic Arc Cosine of (varX/varDiv) > CALC( varD, varX, varDiv, "ASINH" ); Hyperbolic Arc Sine of (varX/varDiv) > CALC( varD, varX, varDiv, "ATANH" ); Hyperbolic Arc Tangent of (varX/varDiv)
|
|
48.24 |
SD Card Handler - Directory support added. |
10 Mar 12 |
|
Directory support added. Files can be read from subdirectories on the SD Card. The 8.3 file system must be observed. A depth of FOUR subdirectories is supported. > LIB( libImg, "SDHC/dir1/dir2/dir3/dir4/file.ext" ); > CALC( txtVar, "SDHC/dir1/dir2/dir3/dir4/", "DIR" ); Write to / Append file on SD card added (if file does not exist, it is created) > LOAD( "SDHC/file.ext", var, var, ... ); > LOAD( "SDHC/dir1/dir2/dir3/dir4/file.ext", var, var, ... ); > Limitations: Filename has to be specified in quotes, variable for filename not currently supported. Files are written is 'SR' encoding, ie raw ASCII. Added RESET(SDHC); which reinitialises SD card handler (useful after SD card removal/reinsertion). Improvements made. 33% clock speed increase. Code simplified.
|
|
48.24 |
DIR - Now subdirectory support has been added. |
10 Mar 12 |
|
Now subdirectory support has been added, for consistency, when using CALC( txtVar, "SDHC/", "DIR" ); and CALC( txtVar, "NAND/", "DIR" ); the SDHC and NAND must now always be followed with a forward slash '/'.
|
|
47.24 |
Text, Draw and Image Entity Information |
31 Oct 11 |
|
More Calc commands added to obtain entity information > CALC(var,ename,"ESIZE"); -> returns allocated display size in bytes > CALC(var,ename,"EDEL"); -> returns 1 if entity has been deleted, else 0 > CALC(var,ename,"EVIS"); -> returns 1 if entity is visible, else 0 > CALC(var,ename,"EALIGN"); -> returns value representing alignment: 0 = Top Left, 1 = Top Centre, 2 = Top Right, 3 = Centre Left, 4 = Centre Centre, 5 = Centre Right, 6 = Bottom Left, 7 = Bottom Centre, 8 = Bottom Right
|
|
47.12 |
File read into buffer - A text file can be read into a text buffer |
09 Sep 11 |
|
A text file can be read into a text buffer CALC(dstTxtVar, src, "FREAD");
|
|
47.12 |
File exists check - CALC(dstVar, src, ''FEXISTS''); checks for existence of file in NAND or on SDHC card. |
09 Sep 11 |
|
CALC(dstVar, src, "FEXISTS"); // checks for existence of file in NAND or on SDHC card > eg CALC(U8var,"SDHC/file1.bmp","FEXISTS"); returns 1 if present else 0
|
|
47.12 |
Calc - Fixed error with ATAN2. |
09 Sep 11 |
|
Fixed error with ATAN2. * Fixed ABS when destination is unsigned. * Fixed Case Insensitive Last Find "ILFIND".
|
|
47.12 |
NAND directory listing |
09 Sep 11 |
|
Text variable can be populated with filenames in NAND: CALC( dstTxtVar, src, filter, sep, "DIR" ); CALC( dstTxtVar, src, filter, "DIR" ); CALC( dstTxtVar, src, "DIR" ); > dstTxtVar is a text variable and will contain number of files in list followed by specified separator between each filename. > src is "nand" (in quotes) > sep is separator character for filenames in string (must be in quotes), if not included then "," assumed > filter is types of files to list, supported filters: "*.*", "*", "*.bmp", "*.jpg", "*.png" (or "img" to get all image files) "*.wav", "*.mp3", "*.wma" (or "snd" to get all sound files) "*.fnt", "*.txt", "*.mnu", If not specified then "*" assumed. Multiple filters can be included, separated by commas: "*.bmp,*.jpg,*.fnt"
> examples: (nand contains 1.bmp, 2.bmp, x.mnu) CALC( txtVar, "nand", "*.bmp", ",", "DIR" ); // list all bitmap image files > txtVar = "2,1.bmp,2.bmp"; CALC( txtVar, "nand", "*.fnt", "DIR" ); // list all font files > txtVar = "0"; CALC( txtVar, "nand", "*.mnu", "DIR" ); // list all menu files > txtVar = "1,x.mnu"; CALC( txtVar, "nand", "DIR" ); // list all files CALC( txtVar, "nand", "*", "DIR" ); // same CALC( txtVar, "nand", "*", ",", "DIR" ); // same > txtVar = "3,x.mnu,1.bmp,2.bmp";
|
|
45.00 |
CALC - Added trig and other maths functions. |
10 Jun 11 |
|
SETUP(SYSTEM){angles=degrees|radians;} // default degrees
CALC Trigonometric Functions: "ACOS" - Arc Cosine of varX - CALC( varD, varX, "ACOS" ); "ASIN" - Arc Sine of varX - CALC( varD, varX, "ASIN" ); "ATAN" - Arc Tangent of varX - CALC( varD, varX, "ATAN" ); "ATAN2" - Arc Tangent of varX/varY - CALC( varD, varX, varY, "ATAN2" ); "COS" - Cosine of varX - CALC( varD, varX, "COS" ); "SIN" - Sine of varX - CALC( varD, varX, "SIN" ); "TAN" - Tangent of varX - CALC( varD, varX, "TAN" ); "COSH" - Hyperbolic Cosine of varX - CALC( varD, varX, "COSH" ); "SINH" - Hyperbolic Sine of varX - CALC( varD, varX, "SINH" ); "TANH" - Hyperbolic Tangent of varX - CALC( varD, varX, "TANH" ); "ACOSH" - Hyperbolic Arc Cosine of varX - CALC( varD, varX, "ACOSH" ); "ASINH" - Hyperbolic Arc Sine of varX - CALC( varD, varX, "ASINH" ); "ATANH" - Hyperbolic Arc Tangent of varX - CALC( varD, varX, "ATANH" );
CALC Other Maths Functions: "ABS" - Absolute Value of varX - CALC( varD, varX, "ABS" ); "EXP" - Exponential Function of varX - CALC( varD, varX, "EXP" ); "LOG" - Natural Logarithm of varX - CALC( varD, varX, "LOG" ); "LOG10" - Base-Ten Logarithm of varX - CALC( varD, varX, "LOG10" ); "POW" - varX Raised to the Power of vary - CALC( varD, varX, varY,"POW"); "SQRT" - Non-Negative Square Root of varX - CALC( varD, varX, "SQRT" ); "CBRT" - Cube Root of varX - CALC( varD, varX, "CBRT" );
Note: Float data types for trig functions as values returned are 1.0 or smaller.
|
|
44.00 |
CALC Functions Added - ''BLFIND'', ''LFIND'', ''ILFIND''. |
20 May 11 |
|
"BLFIND" - Buffer Find Last Location of Text2 in Text1 "LFIND" - Find Last Location of Text1 in Text2 "ILFIND" - Find Last Location of Case Insensitive Text1 in Text2
|
|
44.00 |
ADC - Fixed bug related to value calculation |
20 May 11 |
|
Fixed bug related to value calculation
|
|
42.04 |
CALC functions - A series of ‘buffer’ functions have been introduced that handle all the characters \\0000 to \\FFFF identically. |
31 Mar 11 |
|
A series of ‘buffer’ CALC functions have been introduced that handle all the characters \\0000 to \\FFFF identically (ie no NUL’s, or cursors) These are suited to raw data processing. The functions are: Buffer Copy CALC(result,buffvar,length,"BCOPY"); copy length from start of buffvar or if length negative, from end CALC(result,buffvar,posn,len,"BCOPY"); copy length from posn of buffvar or if length negative, before posn Buffer Cut CALC(result,buffvar,length,"BCUT"); cut length from start of buffvar or if length negative, from end CALC(result,buffvar,posn,len,"BCUT"); cut length from posn of buffvar or if length negative, before posn Buffer Insert CALC(result,buffvar,insvar,posn,"BINS"); insert insvar at posn of buffvar Buffer Replace CALC(result,buffvar,insvar,posn,"BREP"); replace insvar over buffvar content from posn of buffvar Buffer Find CALC(result,buffvar,insvar,"BFIND"); find first location of insvar content from posn of buffvar Get Buffer Length CALC(result,buffvar,num,"BLEN"); result is length of buffvar+num Buffer Trim Start and End CALC(result,buffvar,trimvar,"BTRIM"); remove bytes in trimvar from front and end of buffvar Buffer Trim Start CALC(result,buffvar,trimvar,"BLTRIM"); remove bytes in trimvar from front of buffvar Buffer Trim End CALC(result,buffvar,trimvar,"BRTRIM"); remove bytes in trimvar from end of buffvar Buffer Remove CALC(result,buffvar,remvar,"BREM"); remove every occurance of remvar from buffvar
|
|
37.00 |
Calc for Text - New calculations have been added. |
13 Dec 10 |
|
The following calculations have been added. See web page for detailed explanations:
"POS" - Move Cursor to Absolute Position
"REL" - Move Cursor to Relative Position
"INS" - Insert / Overwrite Text at Cursor
"DEL" - Delete Text at Cursor
"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
"UPPER" - Convert Text to Uppercase
"LOWER" - Convert Text to Lowercase
"BEF" - Get Characters from Before Cursor
"AFT" - Get Characters from After Cursor
"CUR" - Change Cursor Type
"LEN" - Get Text Length
"LOC" - Get Cursor Location
"TYPE" - Get Cursor Type
"FIND" - Find Location of Text1 in Text2
"IFIND" - Find Location of Case Insensitive Text1 in Text2
"REM" - Remove Every Text1 in Text2
"IREM" - Remove Every Case Insensitive Text1 in Text2
"SPLIT" - Split Text at Character – allows Sscanf capability
"PIXX" - Get Width of Entity
"PIXY" - Get Height of Entity
|
|
37.00 |
CALC - CALC(result, source, 27, “POS”); . |
13 Dec 10 |
|
CALC(result, source, 27, “POS”); //move cursor to position 27 (a text string starts at 0, error is -1, use signed variable where appropriate)
|
|
36.00 |
Calc - Error in storage of U16's (ie they were not being updated). |
23 Nov 10 |
|
Error in storage of U16's (ie they were not being updated).
|
|
35.00 |
CALC - CALC now accepts VARs, signed/unsigned integers and pointers. |
12 Nov 10 |
|
CALC now accepts VARs, signed/unsigned integers (U8, U16, U32, S8, S16, S32), floats (FLT) and pointers (PTR): CALC( VAR|PTR, VAR|INT|FLT|PTR, VAR|INT|FLT|PTR, "op" ) Note PTR refers to the entity being pointed to by PTR and not the PTR itself. Use LOAD( PTR > "Name" ); to set a pointer.
|
|
27.00 |
Entity Pointers - Entity pointers have been added. |
10 Sep 10 |
|
Entity pointers have been added. STYLE( PtrData, DATA ) { type = pointer; } VAR( EntPtr1, PtrData );
To set/change which entity the entity pointer is pointing to you enclose its name in quotes. LOAD( "EntPtr1", "Var1" ); // Set EntPtr1 to point to "Var1"
To access the entity pointed to by the entity pointer, do not enclose is quotes. LOAD( EntPtr1, "ABC" ); // Load the Entity pointed to by EntPtr1 with "ABC"
The following commands now support entity pointers: > LOAD(name|ptr|"ptr",num|"txt"|var|ptr,...); > CALC(var|ptr,var|ptr,num|var|ptr,"op"); > TEXT(name|ptr,"txt"|var|ptr,...); > IF(var|ptr op num|"txt"|var|ptr ? func|func_ptr : func|func_ptr); > KEY(name,func|func_ptr,...); > INT(name,buf,func|func_ptr,...); > SHOW(name|ptr,...); > HIDE(name|ptr,...); > RUN(name|func_ptr,...); > IMG(name|img_ptr,lib|img_ptr,...);
See the tu480.mnu file for an example of using pointers to update images representing CNTSECS.
|
|
27.00 |
CALC - Added '%' (modulus) operator to CALC. |
10 Sep 10 |
|
Added '%' (modulus) operator to CALC for U8, U16. U32, S8, S16, S32 types.
|
|
|
|