PDA

View Full Version : GVMS Help Doc. - Boolean example error, Jumps, Hex to Int ?



Ron
October 13th, 2002, 12:55 PM
I'll check that boolean evaluation error.

-Ron

Ron
October 13th, 2002, 12:55 PM
I'll add the (integer) HexToInt( ( string ) ) function.

I've fixed the AND and OR they now function properly.

( In next release )

rdmears
October 13th, 2002, 12:55 PM
(A) Error in Example

The example under BOOLEAN OPERATIONS
does not match the actual behavior:

x = 1.0; y = 1.1;
s1 = "hello";
s2 = "bye";
comp = s1==s2 and x == y;
You guess what value comp has, hint FALSE and FALSE = ???

Actually, comp is always FALSE no matter if the two comparisons are TRUE! However, you get the correct result if written this way:

comp = (s1==s2) and (x == y);

(B) Clarify: Jumps with GVMS

Jumps are based on if the last statement's value is 0 or not. The last statement can be a boolean comparison too, and the jump is done accordingly. The variable comp (above) gets a value of 0 or 1 (for FALSE or TRUE).

(C) Hex to Integer

If you have a hexidecimal string, you can convert it to an integer if it's in the form 0xFF:

IntegerValue = strtoint( "0x" + HexString );

I discovered this works after Ron recently added 0xFF string recognition to GVMS. I needed to convert the hex strings from the Generic Serial support driver. This works:

keycode = strtoint( "0x"+ [pld1] );

where [pld1] is explained in the GVMS documentation under SPECIAL VARIABLES to be input from the hardware plugin driver.