HP (Hewlett-Packard) HP 3000 Laptop User Manual


 
Appendix B 741
Expression Evaluator Functions
Expression Evaluator Features
a+b*c/d
calc !exp
2, $2, %2
setvar exp2 exp+'*e'
calc !exp2
6,$6,%6
setvar a hptimef
showvar a
A = 8:26 AM ** the time when var was set **
calc a + 'in the morning!!! '
8:26 AM in the morning!!!'
calc 'a' + 'in the morning!!!'
a in the morning!!!'
calc '!a' + 'in the morning!!!
8:26 AM in the morning!!!'
deletevar a
calc a + 'x'
ERROR
setvar hppath '!!hpgroup,pub,pub.sys'
showvar hppath
HPPATH = !hpgroup,pub,pub.sys
calc hppath - ',pub'
!hpgroup,pub.sys
calc !hppath-',pub'
calc UI,pub,pub.sys-',pub'
^
ERROR
comment ** variable dereferenced before call **
comment ** to evaluator and content does not **
comment ** make valid expression. **
calc '!hppath' - ',pub'
UI,pub.sys
setvar a 6+2
setvar b 7
setvar c b
calc b*c
49, $31, %61
calc hpresult/a
6, $6, %6
setvar a '2'
setvar b 6
calc a+b
ERROR ** variables of different types **
calc len(b)
ERROR ** expected string or string variable**
calc ord(a)
50, $32, %62
setvar a -6
calc 18/(3^2^3/3^6/3+6)/-(a+3)-1
-1, $FFFFFFFF, %37777777777
The rules of precedence determine which operations are performed before others. Their
order, from highest to lowest priority, is:
Variable dereferencing
Unary operators: + -
Bit manipulation: CSL, CSR, LSL, LSR, BOR, BAND, BNOT, BXOR
Exponentiation
Multiplication, division, modulo
Addition, subtraction
Comparison: > < = + <= <>