XHPCALC(1) XHPCALC(1)



NAME xhpcalc - Hewlett-Packard type calculator emulator
SYNOPSIS xhpcalc
DESCRIPTION xhpcalc emulates the Hewlett-Packard Type of programmable scientific calculators, including the Scientific, Financial and Programming calculators.
You operate the calculator by clicking the left mouse key (button 1) on the on-screen calculator buttons. Some basic calculator buttons are also accessible via the keyboard, such as the digits [0] - [9], [+], [-], [*], [Backspace], etc. All the keys on the keyboard's numeric keypad work correctly. Results appear in the calculator's display at the top.
The calculator supports "continuous memory", which means that the contents of registers and program memory is saved whenever you turn off the calculator (close the window), and restored whenever you restart it. The calculator also remembers which mode (eg. SCI, FIN or PRO) it was last in, and starts in that mode by default.
To change the mode of xhpcalc move the mouse pointer onto the HP logo in the upper right corner of the calculator and click any of the mouse keys.

OPTIONS -grey or gray Does not use any colors (monochrome)
-mono Same operation as -grey
-monochrome Same operation as -grey
-reverseVideo Reverses the colors (monochrome only) of xhpcalc
-rv Same operation as -reverseVideo
-reverse Same operation as -reverseVideo
-help Prints out the LONG version of options. Any illegal option causes a SHORT version of options to be printed.
-display <display_spec> Sets display on which the calculator is to be displayed (see X manual page for more information).
-debug Program developers mode. Causes dump (on stderr) of xhpcalc internal registers when the mouse button is


- 1 - Formatted: June 8, 2000





XHPCALC(1) XHPCALC(1)



depressed in the xhpcalc display window. Left Mouse button gives normal registers, right mouse button gives storage registers.
-radix Interchanges the period "." character with a comma "," for European style numbers.
-comma Causes the display to not display the "," in any of the numbers.
-iconify Forces xhpcalc to come up in icon form.
-iconic Same operation as -iconify
-file <file_name> This allows starting the calculator's continuous memory from a file other that the normal "saved at last exit" continuous memory file. This is most useful to load a favorite program stored in a different file, with no danger of overwriting or destroying it. Upon exit, the continuous memory file is still saved in $HOME/.xhpcalc.
-startupFile <file_name> Same as -file above.
-shiftMode <mode> Sets the way in which the "f" and "g" keys should be used. This is an alternate way of specifying the shift mode instead of using one of the explicit modes itemized below. mode can be one of "noShift", "fgShift", "allShift" which are described individually below. (Default = -shiftMode fgShift)
-noShift Allows keystrokes to be pressed with the mouse directly. You do not need to use the "f" and "g" keys at all, and in fact using them produces no useful effect.
-fgShift Allows keystrokes to be pressed with the mouse directly. If you do use the "f" or "g" function keys then any key of the triplet produces ONLY that "f" or "g" key corresponding to the triplet. (This is the most useful mode) (default = -fgshift)
-allShift Causes the key triplet to ONLY generate the center key on a press of any of the triplet, and to ONLY generate the "f" or "g" key on a press of the triplet after a function key entry. (This is useful if you tend to


- 2 - Formatted: June 8, 2000





XHPCALC(1) XHPCALC(1)



miss with your aim a lot)
-geometry <geometry_spec> Locates xhpcalc on the screen. Sizing parameters are used if specified, but usually do not produce a good result. For example, xhpcalc -geometry -0-0 puts the calculator window in the lower right corner.
-iconGeometry <geometry_spec> Locates the icon for the window in the desired location. (This is passed as a hint to the window manager which does with it as it pleases.) The size specification is usually ignored by the window manager.
-startAs <calc_type> This sets the initial startup of the calculator to be the type indicated. (Choices = SCI FIN PRO) (Default = SCI)
-calcTypes <acceptable_types> The list of calculator types which you want access to. If you don't include the calculator type in this list it won't be available to you to use. (Choices = SCI FIN PRO) (Default = "SCI FIN PRO")
-SCI Deletes xhpcalc type SCI from the available list.
-FIN Deletes xhpcalc type FIN from the available list.
-PRO Deletes xhpcalc type PRO from the available list.
(WARNING: don't delete all xhpcalc types)

OPERATION Any mouse button can be used in xhpcalc to press keys. They all have the same effect.
To cause xhpcalc to turn into an icon press the "ON" key. (If you are using the default mwm window manager, then you can restore the xhpcalc icon to its normal appearance by double-clicking on the icon. The behavior of other window managers may differ.)
To turn xhpcalc off press CTRL-C or CTRL-D on the computer keyboard. This causes xhpcalc to update its continuous memory file and die. If you are using the mwm window manager, you can also double-click on the `Window Menu' button on the upper left corner of the window frame.



- 3 - Formatted: June 8, 2000





XHPCALC(1) XHPCALC(1)



There are NO keys on xhpcalc that causes xhpcalc to exit. However, the window manager close action (i.e. double-click on the Window Menu button in mwm) causes xhpcalc to exit.

USING THE KEYBOARD If you wish to use the numeric keypad for numeric entry, the digit keys [0] through [9] act like numbers, [Tab] and [Return] act like [ENTER], and [,] (comma) and [Backspace] act like [<--], which is the calculator backspace key. The keys [*], [/], [+], [-] do the expected math functions.
The keyboard keys are user-definable. See the Keyboard Equivalents subheading in the X RESOURCES section, below.
By default the keys on the computer keyboard that have operational functions are:
0-9 Numeric keys
A-F a-f Numeric keys for the PRO emulator
A-F a-f Function keys for the SCI emulator
. Decimal Point
n Negate (Change Sign - CHS)
^ EEX (Begin entering exponent)
CTRL-C, CTRL-D Quit
DEL, CTRL-H BKSP Back Space [<--]
, Back Space [<--]
CTRL-M (CR) ENTER
CTRL-J (LF) ENTER
CTRL-I (TAB) ENTER

PROGRAMMING xhpcalc shares the program between all the emulated types. For example, when you change calculator personalities from SCI to PRO, the program you entered on the SCI is now in the PRO.
The display of the program is in English instead of number pairs, so that the different types of calculator functions may be mixed without confusion.


- 4 - Formatted: June 8, 2000





XHPCALC(1) XHPCALC(1)



You can freely mix the keystrokes from the different calculators in program memory, and all will work correctly remembering that the PRO emulator uses a TOTALLY separate set of registers for its INTEGER mode calculations, and these can not in any way be reached from the FLOAT mode calculators.
NOTE: The integer storage registers and integer stack registers of the PRO are not the same as those for other models. You should not intermix operations in programs, but nothing stops you from doing so.
The "LOGO" (change of xhpcalc identity) is NOT programmable.
There are always 999 program steps available to the programmer, and registers 0 through .9 are always available. These do not trade off as do some real calculators.
Because of the nasty effects of accidentally purging a program from memory, the "CLR-PRG" key actually clears program memory ONLY if you are in PROG mode (ie. programming). Striking the "CLR-PRG" key at any other time results in no action taken.
If you develop a favorite program you may want to exit from xhpcalc (using CTRL-C, CTRL-D, or closing the window with the mwm Window Menu button) and move or copy the file $HOME/.xhpcalc to a file of another name. Whenever you want xhpcalc to start up with this program in memory use the -startupFile <name> option which causes xhpcalc to restore its continuous memory from that file instead of the default file "$HOME/.xhpcalc". The only file updated with current status on exit is "$HOME/.xhpcalc" thereby preserving your developed program. You can then add comments to the saved file using an editor.
An alternate way of dumping current status to the $HOME/.xhpcalc file is to use the "g"-"ON" sequence. This makes an immediate dump to the file without quitting.

CONTINUOUS MEMORY Continuous memory attempts to preserve itself when xhpcalc terminates. If the file, "$HOME/.xhpcalc" exists when xhpcalc is started, that file is used as continuous memory. "$HOME/.xhpcalc" is written to (by default) when the xhpcalc receives a CTRL-D, CTRL-C or various "kill" signals. Use "f"-"ON" to totally reset xhpcalc, causing the continuous memory to be ignored and resetting all registers and program memory to power-on conditions. This won't work if "-shiftMode noShift" is set.
The converse is "g"-"ON" which saves continuous memory into the "$HOME/.xhpcalc" file.
If you want to start up from a different continuous memory file use


- 5 - Formatted: June 8, 2000





XHPCALC(1) XHPCALC(1)



the -startupFile <name> option on the command line. This file is read instead of the "$HOME/.xhpcalc" file. The "$HOME/.xhpcalc" file is still updated on program exit.
The format of the continuous memory file is ASCII. This makes for a larger file, but permits portability, user modifications and programming.
Any continuous memory file entry that starts with "#=" is treated as a comment when the file is read. Comments do NOT survive when the continuous memory file is updated at program exit, so they are useful only with the -startupFile option. The "?" in the line containing "PROGRAM=" may be treated as a comment and be set to whatever you desire (i.e. name the program).

COLOR USAGE xhpcalc uses many colors (8 or 9 by default) unless you specify -grey or -monochrome or have a monochrome display. xhpcalc shares colors with other programs whenever possible.

WINDOW SIZING xhpcalc is sized based on the sizes of the fonts requested for the keys and the display. Although you can modify the size of xhpcalc with window manager commands, the result will be a strange looking calculator.

CUT & PASTE xhpcalc allows you to cut out the contents of the calculator display and paste the contents into other windows which support cut and paste, such as hpterm(1).
To cut the contents of the display, press [Shift] then the center mouse key. To paste information into xhpcalc, press [Shift] then the right
Refer to the manual entry for hpterm(1) for more information about using cut and paste with hpterm.

X RESOURCES This section describes the resources which can be used to customize the appearance and behavior of xhpcalc via the user's .Xdefaults file. If you are using the Visual User Environment (VUE), then see also the VUE CUSTOMIZATION section, below.
The syntax for all xhpcalc resources is
XHpcalc.:


- 6 - Formatted: June 8, 2000





XHPCALC(1) XHPCALC(1)



For example, XHpcalc.calcTypes:SCI If is left blank, "True" is assumed. For example, XHpcalc.comma: is equivalent to XHpcalc.comma:True
General Resources The resources below affect the overall appearance and behavior of xhpcalc.
calcTypes: Lists calculator types which you want access to. If you don't include the calculator type in this list, it won't be available for you to use. If a is unspecified, the last "calcType" in .xhpcalc is assumed. (Default = "SCI FIN PRO");
display: Sets the display on which the calculator is to be shown. (Default: $DISPLAY from environment, or "local:0.0")
debug: Program developers mode. Causes dump of xhpcalc internal registers when the mouse button is depressed in the xhpcalc display window. Left Mouse button gives normal registers, right mouse button gives storage registers. (Default: False)
geometry: Locates xhpcalc on the screen. Sizing parameters are used if specified, but usually do not produce a good result. (Default: NULL)
iconGeometry: Locates the icon for the window in the desired location. The size specification is usually ignored by the window manager. (Default: NULL)
iconify: Causes the calculator to come up in iconic form. (Default: False)
startupFile: Allows starting the calculator continuous memory from a file other than "$HOME/.xhpcalc". This is most useful to load a favorite program stored in a different file, with no danger of overwriting or destroying it. The eventual continuous memory file written is still the $HOME/.xhpcalc file. If a is unspecified, then xhpcalc starts with a clean memory (equivalent to keys "f"-"ON"). (Default = NULL).


- 7 - Formatted: June 8, 2000





XHPCALC(1) XHPCALC(1)



continuousFile: This is the file to which the continuous memory is written on calculator exit. If a is unspecified, then continuous memory is thrown away. (Default = $HOME/.xhpcalc)
comma: Causes the display to not display the "," in any of the numbers. (Default: False)
radix: Interchanges the period "." character for a comma "," for European style numbers. (Default: False)
Delay: Sets the length of time that a calculator button should be inverse videoed (depressed). Expressed in milliseconds (1/1000 of a second). (Default = 50)
buttonDelay: Sets the length of time that a calculator button should be inverse videoed (depressed), but only when pressed with a mouse button. This overrides the Delay: option described above. Expressed in milliseconds (1/1000 of a second). (Default = set with Delay:)
keyDelay: Sets the length of time that a calculator button should be inverse videoed (depressed), but only when pressed with a keyboard key. This overrides the Delay: option described above. Expressed in milliseconds (1/1000 of a second). (Default = set with Delay:)
shiftMode: Sets the way in which the "f" and "g" keys should be used. This is an alternate way of specifying the shift mode instead of using one of the explicit modes itemized below. mode can be one of "noShift", "fgShift", "allShift", which are described below. If a is unspecified, then "noShift" is assumed. (Default = -shiftMode fgShift)
Cut and Paste These resources affect xhpcalc's cut and paste capability.
cutButton: Defines which mouse/keyboard keys need to be combined to cut the calculator display into the X11 cut buffer. Acceptable arguments are "Left" "Right" "Center" "Shift" "Meta" "Control" and may be separated either with spaces " " or pipe symbols "|".


- 8 - Formatted: June 8, 2000





XHPCALC(1) XHPCALC(1)



(Default = Left Shift)
cutBase: Defines how the base indicator (PRO calculator) is included in the cut buffer. adjacent places the "h", "d", "o" or "b" immediately against the number. separated places the "h", "d", "o" or "b" one blank away from the number. none places no indication of base in the cut buffer. (Default = Adjacent)
cutDigits: Defines how the digits are cut from the calculator display. all places all significant digits (held internally) in the cut buffer. showing places only what you see in the cut buffer. (Default = Showing)
pasteButton: Defines which mouse/keyboard keys need to be combined to paste the X11 cut buffer onto the calculator keyboard. NOTE: The paste buffer has the characters defined in the resource "ignorePaste" removed from it before being pasted on the keyboard. Acceptable arguments are "Left" "Right" "Center" "Shift" "Meta" "Control" and may be separated either with spaces " " or pipe symbols "|". (Default = Right Shift)
pasteIgnore: Defines which characters are removed from the X cut/paste buffer before the characters are placed on the calculator keyboard stack. This allows removing things such as "$" and "," from the input string. The resulting string is then interpreted in accordance with the key defaults described below. (Default = ", $")
pasteAccept: Defines which characters are accepted from the X cut/paste buffer and placed on the calculator keyboard stack. If this is not defined then all characters are accepted, except those specified in pasteIgnore. If a is unspecified, then nothing is accepted. (Default = NULL)
Keyboard Equivalents These resources are used to configure the mapping of keyboard keys to various xhpcalc buttons.




- 9 - Formatted: June 8, 2000





XHPCALC(1) XHPCALC(1)



key: Defines the default generic mapping of keyboard keys to calculator function keys. The syntax is = separated with blanks or tabs.
NOTE: keycodes less than space " " should be represented in octal. Because of the way X11 parses the line it is necessary to use a double backslash "\\" to represent a single backslash to the calculator, which causes the calculator to interpret the number following as an octal representation of the desired character.
key is used to set the defaults for all calculator types. You may use keyALL to add to this set of defaults, or may redefine key to completely change the initial set of defaults. You may also set the key mapping for JUST a single calculator by setting the keycode mapping for that calculator using the defaults described below. (Default = XHpcalc.key: 0=0 1=1 2=2 3=3 4=4 5=5 6=6 7=7 8=8 9=9 a=Afun A=Afun b=Bfun B=Bfun c=Cfun C=Cfun d=Dfun D=Dfun e=Efun E=Efun f=Ffun F=Ffun n=CHS ^=EEX \004=OFF \003=OFF ,=BKSP \177=BKSP \010=BKSP \015=ENTER \012=ENTER \011=ENTER +=+ -=- *=* /=/ .=. M=mem N=IGNORE)
keyALL : Allows adding to the set of built in key_stroke to key_code mappings that the calculator starts with by default. (Default = NULL)
keySCI: Specific mapping of keyboard keys to calculator function keys, and is added to the definition of "XHpcalc.key:", but only for the SCI type calculator. The same syntax and choices are available. (Default = NULL)
keyFIN: Specific mapping of keyboard keys to calculator function keys, and is added to the definition of "XHpcalc.key:", but only for the FIN type calculator. The same syntax and choices are available. (Default = NULL)
keyPRO: Specific mapping of keyboard keys to calculator function keys, and is added to the definition of "XHpcalc.key:", but only for the PRO type calculator. The same syntax and choices are available. (Default = XHpcalc.keyPRO: a=A A=A b=B B=B c=C C=C d=D D=D e=E E=E f=F F=F)




- 10 - Formatted: June 8, 2000





XHPCALC(1) XHPCALC(1)



General Calculator Body The resources below affect the body and overall appearance of the calculator.
reverseVideo: Reverses the colors of a Monochrome display. Not useful when using full Color.
grey: on/off
fore: (Default = Black)
back: (Default = DarkSlateGrey)
bord: (Default = Black)
Normal keys The resources below affect the "normal" part of the calculator keys, which is in the center of the calculator button.
PKeyFore: (Default = White)
PKeyBack: (Default = Black)
PKeyBord: (Default = Black)
PFont: (Default = hp8.6x8)
The f and g Keys The resources below affect the shifted "f" and "g" portions of the calculator keys, which is the top and bottom third of each button respectively.
FKeyFore: (Default = Gold)
FKeyBack: (Default = DarkSlateGrey)
FKeyBord: (Default = DarkSlateGrey)




- 11 - Formatted: June 8, 2000





XHPCALC(1) XHPCALC(1)



FFont: (Default = hp8.6x8)
GKeyFore: (Default = #0B0)
GKeyBack: (Default = DarkSlateGrey)
GKeyBord: (Default = Black)
GFont: (Default = hp8.6x8)
Calculator Display These resources affect the calculator's display window.
DispFore: (Default = Yellow)
DispBack: (Default = #777)
DispBord: (Default = Black)
DFont: (Default = hp8.12x15)
VUE CUSTOMIZATION If you are using the Visual User Environment (VUE) then you must let VUE know when you make changes to your .Xdefaults file. In order for your changes to take effect, run:
xrdb -nocpp -merge $HOME/.Xdefaults
VUE automatically saves your new defaults in the file $HOME/.vue/$DISPLAY/current/vue.resources.
You can also edit the vue.resources file directly. If you do so, and want to store your changes for the next time you login, then run:
xrdb -load $HOME/.vue.$DISPLAY.current/vue.resources

Background Information for the X-Knowledgeable Reader
The X Resource Data Base (xrdb) allows users to customize the look and behavior of their applications. The advantage of using xrdb becomes apparent in a distributed environment where a program may be running


- 12 - Formatted: June 8, 2000





XHPCALC(1) XHPCALC(1)



on one machine and displaying output on another machine. This allows users to specify different defaults for the different systems they use. The xrdb is kept on the server side (the display side), not on the client side (where the program is running). Therefore, at run time the program can check to see what kind of display it is displaying to.
You can use any file (not just .Xdefaults ) to specify customizations, and then run:
xrdb -nocpp -merge
But this is not recommended, because some clients do not use xrdb. Any additions or changes of defaults should be made to both .Xdefaults and the xrdb files.
TIDBITS OF MISCELLANEOUS KNOWLEDGE Sending a SIGPWD (powerfail signal) to xhpcalc causes the emulator to display the LOW BATTERY ("*") prompt in the display. But this does not show in the display until the next time the display is redrawn.
To find out the revision of xhpcalc you are using click any mouse button in the calculator display window.

CAVEATS xhpcalc results are sometimes different from actual calculators. This is usually due to more precise answers and more significant digits in xhpcalc. but is sometimes due to the representation of the numbers in IEEE (binary) format.
The emulator does not trade register locations for program locations. Program locations are 0 through 999 Register locations are 0 through .9 from the keyboard, and 0 through 100 for indirect reference. This does not match real calculators which tend to trade registers for program locations.
The PRO registers in INTEGER mode are not accessible from the PRO FLOAT mode. The INTEGER registers are solely accessible from the PRO mode and only when in INTEGER mode.
xhpcalc is not re-sizable, but sizes itself based on the fonts used for the keys and display.










- 13 - Formatted: June 8, 2000