home *** CD-ROM | disk | FTP | other *** search
- Documentation for XE - A mini-expression evaluator from Transactor Magazine
-
- Code and docs freely distributable but
- copyright (c) 1987 Transactor Publishing Inc.
-
- XE is an expression evaluator; a handy little calculator to have around for
- the odd bit of number-crunching you may need. It comes up in a window that
- can be sized, dragged, re-ordered and closed.
-
- Features of XE:
- * allows nested parentheses
- * has 26 variables that can be used in expressions
- * prints results in any number base
- * accepts numerical constants in decimal, hex, binary or any other base
- * can evaluate multiple expressions with a single command line
- * assignments to variables can be made within expressions
-
- Limitations:
- * 32-bit integers only.
- * no checking for overflow.
- * the only operators supported are the four basic operations (+ - * /)
- plus the modulo operation (%).
-
- How to use XE:
-
- XE doesn't work with a calculator keyboard, but allows you to enter
- expressions in their normal algebraic form, for example:
-
- >2*(3+4)-2*4 (The '>' is XE's prompt)
- 6 (XE's answer)
-
- Expressions are evaluated left-to-right, with multiplication, division
- and the modulo operation (*, / and %) taking precedence over addition and
- subtraction (+ and -).
-
- XE allows single-letter variables, which can be assigned a constant or an
- expression, and used in expressions. For example:
-
- >a=5
- 5
- >2*a
- 10
- >b=a+1
- 6
-
- Notice that a result is printed when a variable assignment is made. This is
- because an assignment returns a value in an expression (as in C). So you
- could do this:
-
- >25+3*(b=4*3)
- 61
- >b
- 12
-
- The variable 'b' was assigned the value 3*4, and that value was used in
- the expression. This allows you to do multiple-variable assignments:
-
- >a=b=c=d=e=x=0
-
- XE will evaluate more than one expression at a time if you separate
- the expressions by commas. This can be useful to print out the values
- of several variables or results, e.g.:
-
- >a,b,c,a+b
-
- XE can speak not only in decimal (base 10), but in any arbitrary base
- up to base 36. After you select a new base using the syntax Bn, XE
- will print all results in that base. For example, to work in hex:
-
- >B16
- New base: 16 (decimal)
- >23*10
- $E6
- >B24,21*10
- New base: 21 (decimal)
- 21: AK
-
- Notice that the notation for number bases higher than 16 extends hexadecimal
- notation by using letters of the alphabet higher than F. In this case, the
- 'A' in AK means '10 * 21^1', and the K means '20 * 21^0'.
-
- To enter your numbers in a different base, use the following prefixes:
- $ - hexadecimal (base 16)
- % - binary (base 2)
- # - current output base
-
- Example: add binary 100101110 to decimal 152 and print the result
- in hexadecimal. Solution:
-
- >B16
- New base: 16 (decimal)
- >%100101110+152
- $1C6
-
- When you're not actually calculating with XE, you can put it away temporarily
- without actually closing it down by selecting "Tiny Window" from the menu.
- The main XE window will close, and a conveniently small and inconspicuous
- window will open in its place. Clicking anywhere in the tiny window (except
- the drag bar or depth gadgets, of course) will close the tiny window and
- bring the main XE window up instead.
-
- XE also supports Transactor's TWM (Tiny Window Manager) program, so if you
- have TWM running in your system when you select "Tiny Window" from the menu,
- XE will be allotted a gadget (named "TransCalc") in the TWM window, and will
- not bother to put up a tiny window of its own.
-
-
-
-
-
-
-