Overview

The Expression Calc doubles as a simple calculator supporting arithmetic and bitwise operations, as well as scripting extension to Hex Workshop, supporting variables, document manipulation, and conditional expressions.  The calculator uses the same expression parsing and evaluation engine that Hex Workshop uses for functions defined as part of the Structure Viewer.

Layout

Sign and Size

The sign and size drop down lists control the sign and type of data used for the expression.

Expression

The expression area allows users to enter compound expressions.  The last expression (literal, calculation, variable, etc.) is displayed in the results area.

Results

Displays the results of the last expression.  See Options below to set the byte ordering and base (hex or decimal).

Defining Expressions

Please see the Expressions topics for information on defining expressions.

Executing Expression

The expression is evaluated (or executed) when a user presses the "Eval" button or presses Ctrl+Enter within the editor window.  

The expression is also automatically evaluated when the user changes the Sign or Data Type using the drop down combo boxes on the Expression Calc.

Sign and Data Type

The sign and data type selections are used to render the final evaluation results and any literal values within the expression.  Some expression functions require specific data type sizes and will report an error if the data type is too small (e.g. invoking getDWordAt(...) when the data type is set to 16 bits).

Options

The following options can be set by right-clicking on the Expression Calc's title area or background area (not on the individual controls).

Show Results As

Controls the displayed base (either hex or decimal) of the results.

By default the Expression Calc displays the results based on the Toolbar's Environment Settings for offset base.  Options include:

Interpret Byte Order As

Controls the byte order used to interpret hexadecimal strings (e.g. 0x00FF) and the byte order used to render the results.

By default the Expression Calc displays the results based on the Toolbar's Environment Settings for byte order.  Options include:

Place results on clipboard

Controls whether expression results are automatically placed on the clipboard.  This option is enabled by default.