aboutsummaryrefslogtreecommitdiff
path: root/hcalc.rst
blob: 761124828d29ec863372f9d420c3a94514b2b366 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
.. RST source for hcalc(1) man page. Convert with:
..   rst2man.py hcalc.rst > hcalc.1

.. include:: version.rst
.. |date| date::

=====
hcalc
=====

------------------------
graphical hex calculator
------------------------

:Manual section: 1
:Manual group: Urchlay's Misc Stuff
:Date: |date|
:Version: |version|

SYNOPSIS
========

hcalc [*-default*] [*-small* | *-medium* | *-large*] [*-dec* | *-hex* | *-oct* | *-bin* ] [*-quiet*] [*--version*] [*--help*]

DESCRIPTION
===========

**hcalc** is a small (137x174 pixels minimum) TI Programmer II
semi-clone for Unix/X11 and Windows 95/NT. It doesn't take up much
space, and supports decimal, hex, binary, and octal modes.

**hcalc** is operated with the mouse and/or keyboard. See **MOUSE** and
**KEYBOARD** sections, below.

OPTIONS
=======

Options listed as (persistent) get saved to the config file, so
they'll still apply the next time **hcalc** is started. This applies
not only to command-line arguments; the settings get saved if they're
changed via the mouse or keyboard, too.

**-small**
            Display in a 125x147 window (persistent).

**-medium**
            Display in a 250x294 window (persistent).

**-large**
            Display in a 500x588 window (persistent). This is the default.

**-dec**
            Start up in decimal mode (persistent). This is the default.

**-hex**
            Start up in hexadecimal mode (persistent).

**-oct**
            Start up in octal mode (persistent).

**-bin**
            Start up in binary mode (persistent).

**-default**
            Do not read the config file on startup. *NOTE:* This option must
            be the first on the command line, or it will be ignored!

**-quiet**
            Do not ring the X bell on invalid input (persistent).

--version   Output version number and exit.

--help
            Output usage string and exit.

DISPLAY
=======

The numeric display is limited to 15 digits in decimal, hex, or octal
base. In binary mode, it displays 32 bits, but uses narrow "ticks"
rather than 0 and 1.

In hex mode, the number in the display will always be prefixed with
"0x". In octal mode, it will always be prefixed with "0". In decimal
mode, there is no prefix.

In case of error (e.g. division by zero), the display will show **err**,
and you'll have to press *CLR* to continue.

BUTTONS
=======

The user interface mimics a pocket calculator, so it's made of
buttons. Each button can be pressed either by clicking on it with the
mouse, or pressing its keystroke (given in **bold**). A few buttons
have multiple functions, depending on which mouse button is used.

The descriptions below assume a right-handed mouse, and refer to mouse
button 1 as "left" and button 3 as "right". If your mouse is set up
left-handed, reverse them.

*0* to *9*, *A* to *F* (**0-9**, **a-f**)
  Digits. Lowercase only for the hex digits. Entering digits
  larger than the current number base is impossible (e.g. hex digits
  when in decimal mode, or digits other than 0 or 1 in binary mode) and
  will be ignored.

*.* (**.**)
  Decimal point. Only works in decimal mode (base 10); other bases
  are integer-only.

*+* *-* *x* *÷* (**+** **-** **\*** **x** **/** **%**)
  Arithmetic: addition, subtraction, multiplication, division (modulus with
  right-click). Note that the **x** key is the same as **\***.

*=* (**=** **Enter**)
  Finish the calculation and display the result.

*+/-* (**_** **i**)
  Invert sign.

*INV* (**~**)
  Unary NOT, aka 1's complement; invert the bits in the current number.
  For 32-bit two's complement, right-click or use **@** on the keyboard.
  Integer operation; truncates digits after the decimal point.

*OR* *AND* *XOR* (**&** **|** **^**)
  Boolean operations. Integer operations; truncates digits after the decimal point.

*DEC* *HEX* *OCT* *BIN* (**D** **H** **O** **B** or **F1** to **F4**)
  Change the number base. The number being displayed will be converted
  to the new base. Truncates digits after the decimal point.

*DEL* (**Backspace** or **Delete**)
  Delete the last digit entered. Deleting the last digit results in 0.

*STO* *RCL* *SUM* (**[**, **]**, **}**)
  Store to memory (like *M* on most calculators); recall memory (like *MR*);
  add current value to memory (like *M+*).

*<<* *>>* (**<** **>**)
  Bit shift by one position, left or right.
  Integer operation; truncates digits after the decimal point.

*SHF* (**S**)
  Shift left/right by some number of bits (binary
  operation, like addition). Shifts left for positive
  numbers and right for negative. This is less confusing
  than it sounds: 1 shifted left once is 2, -1 shifted right
  once in -2.
  Integer operation; truncates digits after the decimal point.

*CE* (**u**)
  Clears the number being entered, same as backspacing over it,
  but does not clear any pending operation.

*CLR* (**C**, **Escape**)
  Clears the display, memory, and any pending operation. With right-click,
  exits **hcalc** (use **Q** or **^Q** to quit from the keyboard).

MOUSE
=====

Mouse operation is simple: for the most part, just left-click on the
buttons to press them.

There's no *%* button for the modulus operator, but you can
right-click on the *÷* (division) key. Also, right-click on
the *INV* key for two's complement.

Right-clicking on the *CLR* key exits **hcalc**.

For the numeric display, a left-click copies the number to the X
selection buffer.  Right-click pastes from X, but beware: pasting
anything but a number in the current base might have unexpected
effects, because all pasted characters are treated as keystrokes (so,
e.g. pasting a capital Q quits the application). This can be useful,
e.g. if you paste "2+2=", **hcalc** will display "4".

A center-click (button 2) anywhere in the **hcalc** window also pastes.

KEYBOARD
========

These keys don't have calculator buttons.

**^C**
            Copy the current number to the X selection
            buffer. Same as clicking mouse button 1 (usually left) on the number display.

**^V** **Shift-Insert**
            Paste from the X selection buffer.
            Same as clicking a mouse button other than 1 (right-clicking) on the number display.

**q**
            Quiet. Toggles the audible bell.

**z**
            Zoom: change window size. Alternates between the 3 sizes: **-small**,
            **-medium**, **-large**.

.. other sections we might want, uncomment as needed.

FILES
=====

**$HOME/.hcalc.cfg**
            Config file. This is a binary file, not human-readable, and not
            portable across architectures. It gets read on startup (unless
            **-default** is given) and written on exit. It stores the
            number base, window size (as set on the command line),
            the number that was displayed on exit, the contents of the
            *STO* memory, and the **-quiet** flag.

            Some care is taken to make sure a config file from a different
            architecture won't be used.

            Since the config file isn't human-readable, an easy way to
            create one is to run **hcalc** with **-default** plus your preferred
            options. Example::

              hcalc -default -quiet -large -hex

            ...which will kill any existing config file, and create a new one
            that stores the options you gave. Now when you run **hcalc** with
            no options, it will start up in hex mode, in a large window, and won't
            ring the bell.

            An even easier way is just to run **hcalc** and use the controls to
            set the number base, size, and quiet flag. These settings automatically
            get saved to the config file.

ENVIRONMENT
===========

**HOME**
            Config file is searched for here. If this is not set, or can't be
            read, no config file will be read or written.

**DISPLAY**
            X display to use.

.. EXIT STATUS
.. ===========

.. BUGS
.. ====

.. EXAMPLES
.. ========

COPYRIGHT
=========

**hcalc** is released under the terms of the GNU GPL.

AUTHORS
=======

**hcalc** was originally written by DJ Delorie, modified by
Theodore Kilgore, and modified again by B. Watson, who also
wrote this man page.

SEE ALSO
========

**xcalc**\(1)