comparison lisp/calc/calc-keypd.el @ 40785:2fb9d407ae73

Initial import of Calc 2.02f.
author Eli Zaretskii <eliz@gnu.org>
date Tue, 06 Nov 2001 18:59:06 +0000
parents
children 37f2fe9b6ad0
comparison
equal deleted inserted replaced
40784:d57f74c55909 40785:2fb9d407ae73
1 ;; Calculator for GNU Emacs, part II [calc-keypd.el]
2 ;; Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
3 ;; Written by Dave Gillespie, daveg@synaptics.com.
4
5 ;; This file is part of GNU Emacs.
6
7 ;; GNU Emacs is distributed in the hope that it will be useful,
8 ;; but WITHOUT ANY WARRANTY. No author or distributor
9 ;; accepts responsibility to anyone for the consequences of using it
10 ;; or for whether it serves any particular purpose or works at all,
11 ;; unless he says so in writing. Refer to the GNU Emacs General Public
12 ;; License for full details.
13
14 ;; Everyone is granted permission to copy, modify and redistribute
15 ;; GNU Emacs, but only under the conditions described in the
16 ;; GNU Emacs General Public License. A copy of this license is
17 ;; supposed to have been given to you along with GNU Emacs so you
18 ;; can know your rights and responsibilities. It should be in a
19 ;; file named COPYING. Among other things, the copyright notice
20 ;; and this notice must be preserved on all copies.
21
22
23
24 ;; This file is autoloaded from calc-ext.el.
25 (require 'calc-ext)
26
27 (require 'calc-macs)
28
29 (defun calc-Need-calc-keypd () nil)
30
31
32
33 ;;; Pictorial interface to Calc using the X window system mouse.
34
35 (defvar calc-keypad-buffer nil)
36 (defvar calc-keypad-menu 0)
37 (defvar calc-keypad-full-layout nil)
38 (defvar calc-keypad-input nil)
39 (defvar calc-keypad-prev-input nil)
40 (defvar calc-keypad-prev-x-left-click nil)
41 (defvar calc-keypad-prev-x-middle-click nil)
42 (defvar calc-keypad-prev-x-right-click nil)
43 (defvar calc-keypad-said-hello nil)
44
45 (defvar calc-keypad-map nil)
46 (if calc-keypad-map
47 ()
48 (setq calc-keypad-map (make-sparse-keymap))
49 (define-key calc-keypad-map " " 'calc-keypad-press)
50 (define-key calc-keypad-map "\r" 'calc-keypad-press)
51 (define-key calc-keypad-map "\t" 'calc-keypad-menu)
52 (define-key calc-keypad-map "q" 'calc-keypad-off))
53
54 (defun calc-do-keypad (&optional full-display interactive)
55 (if (string-match "^19" emacs-version)
56 (error "Sorry, calc-keypad not yet implemented for Emacs 19"))
57 (calc-create-buffer)
58 (let ((calcbuf (current-buffer)))
59 (or (and calc-keypad-buffer
60 (buffer-name calc-keypad-buffer))
61 (progn
62 (setq calc-keypad-buffer (get-buffer-create "*Calc Keypad*"))
63 (set-buffer calc-keypad-buffer)
64 (use-local-map calc-keypad-map)
65 (setq major-mode 'calc-keypad)
66 (setq mode-name "Calculator")
67 (put 'calc-keypad 'mode-class 'special)
68 (make-local-variable 'calc-main-buffer)
69 (setq calc-main-buffer calcbuf)
70 (calc-keypad-redraw)
71 (calc-trail-buffer)))
72 (let ((width 29)
73 (height 17)
74 win old-win)
75 (if (setq win (get-buffer-window "*Calculator*"))
76 (delete-window win))
77 (if (setq win (get-buffer-window "*Calc Trail*"))
78 (if (one-window-p)
79 (switch-to-buffer (other-buffer))
80 (delete-window win)))
81 (if (setq win (get-buffer-window calc-keypad-buffer))
82 (progn
83 (bury-buffer "*Calculator*")
84 (bury-buffer "*Calc Trail*")
85 (bury-buffer calc-keypad-buffer)
86 (if (one-window-p)
87 (switch-to-buffer (other-buffer))
88 (delete-window win))
89 (if (and calc-keypad-prev-x-left-click
90 (eq (aref mouse-map 0) 'calc-keypad-x-right-click)
91 (eq (aref mouse-map 1) 'calc-keypad-x-middle-click)
92 (eq (aref mouse-map 2) 'calc-keypad-x-left-click))
93 (progn
94 (aset mouse-map 0 calc-keypad-prev-x-right-click)
95 (aset mouse-map 1 calc-keypad-prev-x-middle-click)
96 (aset mouse-map 2 calc-keypad-prev-x-left-click)
97 (setq calc-keypad-prev-x-left-click nil))))
98 (setq calc-was-keypad-mode t
99 old-win (get-largest-window))
100 (if (or (< (window-height old-win) (+ height 6))
101 (< (window-width old-win) (+ width 15))
102 full-display)
103 (delete-other-windows old-win))
104 (if (< (window-height old-win) (+ height 4))
105 (error "Screen is not tall enough for this mode"))
106 (if full-display
107 (progn
108 (setq win (split-window old-win (- (window-height old-win)
109 height 1)))
110 (set-window-buffer old-win (calc-trail-buffer))
111 (set-window-buffer win calc-keypad-buffer)
112 (set-window-start win 1)
113 (setq win (split-window win (+ width 3) t))
114 (set-window-buffer win calcbuf))
115 (if (or t ; left-side keypad not yet fully implemented
116 (< (save-excursion
117 (set-buffer (window-buffer old-win))
118 (current-column))
119 (/ (window-width) 2)))
120 (setq win (split-window old-win (- (window-width old-win)
121 width 2)
122 t))
123 (setq old-win (split-window old-win (+ width 2) t)))
124 (set-window-buffer win calc-keypad-buffer)
125 (set-window-start win 1)
126 (split-window win (- (window-height win) height 1))
127 (set-window-buffer win calcbuf))
128 (select-window old-win)
129 (if (and (eq window-system 'x)
130 (not calc-keypad-prev-x-left-click))
131 (progn
132 (setq calc-keypad-prev-x-right-click (aref mouse-map 0)
133 calc-keypad-prev-x-middle-click (aref mouse-map 1)
134 calc-keypad-prev-x-left-click (aref mouse-map 2))
135 (aset mouse-map 0 'calc-keypad-x-right-click)
136 (aset mouse-map 1 'calc-keypad-x-middle-click)
137 (aset mouse-map 2 'calc-keypad-x-left-click)))
138 (message "Welcome to GNU Emacs Calc! Use the left and right mouse buttons.")
139 (run-hooks 'calc-keypad-start-hook)
140 (and calc-keypad-said-hello interactive
141 (progn
142 (sit-for 2)
143 (message "")))
144 (setq calc-keypad-said-hello t))))
145 (setq calc-keypad-input nil)
146 )
147
148 (defun calc-keypad-off ()
149 (interactive)
150 (if calc-standalone-flag
151 (save-buffers-kill-emacs nil)
152 (calc-keypad))
153 )
154
155 (defun calc-keypad-redraw ()
156 (set-buffer calc-keypad-buffer)
157 (setq buffer-read-only t)
158 (setq calc-keypad-full-layout (append (symbol-value (nth calc-keypad-menu
159 calc-keypad-menus))
160 calc-keypad-layout))
161 (let ((buffer-read-only nil)
162 (row calc-keypad-full-layout)
163 (y 0))
164 (erase-buffer)
165 (insert "\n")
166 (while row
167 (let ((col (car row)))
168 (while col
169 (let* ((key (car col))
170 (cwid (if (>= y 4)
171 5
172 (if (and (= y 3) (eq col (car row)))
173 (progn (setq col (cdr col)) 9)
174 4)))
175 (name (if (and calc-standalone-flag
176 (eq (nth 1 key) 'calc-keypad-off))
177 "EXIT"
178 (if (> (length (car key)) cwid)
179 (substring (car key) 0 cwid)
180 (car key))))
181 (wid (length name))
182 (pad (- cwid (/ wid 2))))
183 (insert (make-string (/ (- cwid wid) 2) 32)
184 name
185 (make-string (/ (- cwid wid -1) 2) 32)
186 (if (equal name "MENU")
187 (int-to-string (1+ calc-keypad-menu))
188 "|")))
189 (or (setq col (cdr col))
190 (insert "\n")))
191 (insert (if (>= y 4)
192 "-----+-----+-----+-----+-----"
193 (if (= y 3)
194 "-----+---+-+--+--+-+---++----"
195 "----+----+----+----+----+----"))
196 (if (= y 7) "+\n" "|\n"))
197 (setq y (1+ y)
198 row (cdr row)))))
199 (setq calc-keypad-prev-input t)
200 (calc-keypad-show-input)
201 (goto-char (point-min))
202 )
203
204 (defun calc-keypad-show-input ()
205 (or (equal calc-keypad-input calc-keypad-prev-input)
206 (let ((buffer-read-only nil))
207 (save-excursion
208 (goto-char (point-min))
209 (forward-line 1)
210 (delete-region (point-min) (point))
211 (if calc-keypad-input
212 (insert "Calc: " calc-keypad-input "\n")
213 (insert "----+-----Calc " calc-version "-----+----"
214 (int-to-string (1+ calc-keypad-menu))
215 "\n")))))
216 (setq calc-keypad-prev-input calc-keypad-input)
217 )
218
219 (defun calc-keypad-press ()
220 (interactive)
221 (or (eq major-mode 'calc-keypad)
222 (error "Must be in *Calc Keypad* buffer for this command"))
223 (let* ((row (save-excursion
224 (beginning-of-line)
225 (count-lines (point-min) (point))))
226 (y (/ row 2))
227 (x (/ (current-column) (if (>= y 4) 6 5)))
228 radix frac inv
229 (hyp (save-excursion
230 (set-buffer calc-main-buffer)
231 (setq radix calc-number-radix
232 frac calc-prefer-frac
233 inv calc-inverse-flag)
234 calc-hyperbolic-flag))
235 (invhyp t)
236 (menu (symbol-value (nth calc-keypad-menu calc-keypad-menus)))
237 (input calc-keypad-input)
238 (iexpon (and input
239 (or (string-match "\\*[0-9]+\\.\\^" input)
240 (and (<= radix 14) (string-match "e" input)))
241 (match-end 0)))
242 (key (nth x (nth y calc-keypad-full-layout)))
243 (cmd (or (nth (if inv (if hyp 4 2) (if hyp 3 99)) key)
244 (setq invhyp nil)
245 (nth 1 key)))
246 (isstring (and (consp cmd) (stringp (car cmd))))
247 (calc-is-keypad-press t))
248 (if invhyp (calc-wrapper)) ; clear Inv and Hyp flags
249 (unwind-protect
250 (cond ((or (null cmd)
251 (= (% row 2) 0))
252 (beep))
253 ((and (> (minibuffer-depth) 0))
254 (cond (isstring
255 (setq unread-command-char (aref (car cmd) 0)))
256 ((eq cmd 'calc-pop)
257 (setq unread-command-char ?\177))
258 ((eq cmd 'calc-enter)
259 (setq unread-command-char 13))
260 ((eq cmd 'calc-undo)
261 (setq unread-command-char 7))
262 (t
263 (beep))))
264 ((and input (string-match "STO\\|RCL" input))
265 (cond ((and isstring (string-match "[0-9]" (car cmd)))
266 (setq calc-keypad-input nil)
267 (let ((var (intern (concat "var-q" (car cmd)))))
268 (cond ((equal input "STO+") (calc-store-plus var))
269 ((equal input "STO-") (calc-store-minus var))
270 ((equal input "STO*") (calc-store-times var))
271 ((equal input "STO/") (calc-store-div var))
272 ((equal input "STO^") (calc-store-power var))
273 ((equal input "STOn") (calc-store-neg 1 var))
274 ((equal input "STO&") (calc-store-inv 1 var))
275 ((equal input "STO") (calc-store-into var))
276 (t (calc-recall var)))))
277 ((memq cmd '(calc-pop calc-undo))
278 (setq calc-keypad-input nil))
279 ((and (equal input "STO")
280 (setq frac (assq cmd '( ( calc-plus . "+" )
281 ( calc-minus . "-" )
282 ( calc-times . "*" )
283 ( calc-divide . "/" )
284 ( calc-power . "^")
285 ( calc-change-sign . "n")
286 ( calc-inv . "&") ))))
287 (setq calc-keypad-input (concat input (cdr frac))))
288 (t
289 (beep))))
290 (isstring
291 (setq cmd (car cmd))
292 (if (or (and (equal cmd ".")
293 input
294 (string-match "[.:e^]" input))
295 (and (equal cmd "e")
296 input
297 (or (and (<= radix 14) (string-match "e" input))
298 (string-match "\\^\\|[-.:]\\'" input)))
299 (and (not (equal cmd "."))
300 (let ((case-fold-search nil))
301 (string-match cmd "0123456789ABCDEF"
302 (if (string-match
303 "[e^]" (or input ""))
304 10 radix)))))
305 (beep)
306 (setq calc-keypad-input (concat
307 (and (/= radix 10)
308 (or (not input)
309 (equal input "-"))
310 (format "%d#" radix))
311 (and (or (not input)
312 (equal input "-"))
313 (or (and (equal cmd "e") "1")
314 (and (equal cmd ".")
315 (if frac "1" "0"))))
316 input
317 (if (and (equal cmd ".") frac)
318 ":"
319 (if (and (equal cmd "e")
320 (or (not input)
321 (string-match
322 "#" input))
323 (> radix 14))
324 (format "*%d.^" radix)
325 cmd))))))
326 ((and (eq cmd 'calc-change-sign)
327 input)
328 (let* ((epos (or iexpon 0))
329 (suffix (substring input epos)))
330 (setq calc-keypad-input (concat
331 (substring input 0 epos)
332 (if (string-match "\\`-" suffix)
333 (substring suffix 1)
334 (concat "-" suffix))))))
335 ((and (eq cmd 'calc-pop)
336 input)
337 (if (equal input "")
338 (beep)
339 (setq calc-keypad-input (substring input 0
340 (or (string-match
341 "\\*[0-9]+\\.\\^\\'"
342 input)
343 -1)))))
344 ((and (eq cmd 'calc-undo)
345 input)
346 (setq calc-keypad-input nil))
347 (t
348 (if input
349 (let ((val (math-read-number input)))
350 (setq calc-keypad-input nil)
351 (if val
352 (calc-wrapper
353 (calc-push-list (list (calc-record
354 (calc-normalize val)))))
355 (or (equal input "")
356 (beep))
357 (setq cmd nil))
358 (if (eq cmd 'calc-enter) (setq cmd nil))))
359 (setq prefix-arg current-prefix-arg)
360 (if cmd
361 (if (and (consp cmd) (eq (car cmd) 'progn))
362 (while (setq cmd (cdr cmd))
363 (if (integerp (car cmd))
364 (setq prefix-arg (car cmd))
365 (command-execute (car cmd))))
366 (command-execute cmd)))))
367 (set-buffer calc-keypad-buffer)
368 (calc-keypad-show-input)))
369 )
370
371 (defun calc-keypad-x-left-click (arg)
372 "Handle a left-button mouse click in Calc Keypad window."
373 (let (coords)
374 (if (and calc-keypad-buffer
375 (buffer-name calc-keypad-buffer)
376 (get-buffer-window calc-keypad-buffer)
377 (setq coords (coordinates-in-window-p
378 arg (get-buffer-window calc-keypad-buffer))))
379 (let ((win (selected-window)))
380 (unwind-protect
381 (progn
382 (x-mouse-set-point arg)
383 (calc-keypad-press))
384 (and (window-point win)
385 (select-window win))))
386 (funcall calc-keypad-prev-x-left-click arg)))
387 )
388
389 (defun calc-keypad-x-right-click (arg)
390 "Handle a right-button mouse click in Calc Keypad window."
391 (if (and calc-keypad-buffer
392 (buffer-name calc-keypad-buffer)
393 (get-buffer-window calc-keypad-buffer)
394 (coordinates-in-window-p
395 arg (get-buffer-window calc-keypad-buffer)))
396 (save-excursion
397 (set-buffer calc-keypad-buffer)
398 (calc-keypad-menu))
399 (funcall calc-keypad-prev-x-right-click arg))
400 )
401
402 (defun calc-keypad-x-middle-click (arg)
403 "Handle a middle-button mouse click in Calc Keypad window."
404 (if (and calc-keypad-buffer
405 (buffer-name calc-keypad-buffer)
406 (get-buffer-window calc-keypad-buffer)
407 (coordinates-in-window-p
408 arg (get-buffer-window calc-keypad-buffer)))
409 (save-excursion
410 (set-buffer calc-keypad-buffer)
411 (calc-keypad-menu-back))
412 (funcall calc-keypad-prev-x-middle-click arg))
413 )
414
415 (defun calc-keypad-menu ()
416 (interactive)
417 (or (eq major-mode 'calc-keypad)
418 (error "Must be in *Calc Keypad* buffer for this command"))
419 (while (progn (setq calc-keypad-menu (% (1+ calc-keypad-menu)
420 (length calc-keypad-menus)))
421 (not (symbol-value (nth calc-keypad-menu calc-keypad-menus)))))
422 (calc-keypad-redraw)
423 )
424
425 (defun calc-keypad-menu-back ()
426 (interactive)
427 (or (eq major-mode 'calc-keypad)
428 (error "Must be in *Calc Keypad* buffer for this command"))
429 (while (progn (setq calc-keypad-menu (% (1- (+ calc-keypad-menu
430 (length calc-keypad-menus)))
431 (length calc-keypad-menus)))
432 (not (symbol-value (nth calc-keypad-menu calc-keypad-menus)))))
433 (calc-keypad-redraw)
434 )
435
436 (defun calc-keypad-store ()
437 (interactive)
438 (setq calc-keypad-input "STO")
439 )
440
441 (defun calc-keypad-recall ()
442 (interactive)
443 (setq calc-keypad-input "RCL")
444 )
445
446 (defun calc-pack-interval (mode)
447 (interactive "p")
448 (if (or (< mode 0) (> mode 3))
449 (error "Open/close code should be in the range from 0 to 3."))
450 (calc-pack (- -6 mode))
451 )
452
453 (defun calc-keypad-execute ()
454 (interactive)
455 (let* ((prompt "Calc keystrokes: ")
456 (flush 'x-flush-mouse-queue)
457 (prefix nil)
458 keys cmd)
459 (save-excursion
460 (calc-select-buffer)
461 (while (progn
462 (setq keys (read-key-sequence prompt))
463 (setq cmd (key-binding keys))
464 (if (or (memq cmd '(calc-inverse
465 calc-hyperbolic
466 universal-argument
467 digit-argument
468 negative-argument))
469 (and prefix (string-match "\\`\e?[-0-9]\\'" keys)))
470 (progn
471 (setq last-command-char (aref keys (1- (length keys))))
472 (command-execute cmd)
473 (setq flush 'not-any-more
474 prefix t
475 prompt (concat prompt (key-description keys) " ")))
476 (eq cmd flush))))) ; skip mouse-up event
477 (message "")
478 (if (commandp cmd)
479 (command-execute cmd)
480 (error "Not a Calc command: %s" (key-description keys))))
481 )
482
483
484 ;;; |----+----+----+----+----+----|
485 ;;; | ENTER |+/- |EEX |UNDO| <- |
486 ;;; |-----+---+-+--+--+-+---++----|
487 ;;; | INV | 7 | 8 | 9 | / |
488 ;;; |-----+-----+-----+-----+-----|
489 ;;; | HYP | 4 | 5 | 6 | * |
490 ;;; |-----+-----+-----+-----+-----|
491 ;;; |EXEC | 1 | 2 | 3 | - |
492 ;;; |-----+-----+-----+-----+-----|
493 ;;; | OFF | 0 | . | PI | + |
494 ;;; |-----+-----+-----+-----+-----|
495
496 (defvar calc-keypad-layout
497 '( ( ( "ENTER" calc-enter calc-roll-down calc-roll-up calc-over )
498 ( "ENTER" calc-enter calc-roll-down calc-roll-up calc-over )
499 ( "+/-" calc-change-sign calc-inv (progn -4 calc-pack) )
500 ( "EEX" ("e") (progn calc-num-prefix calc-pack-interval)
501 (progn -5 calc-pack) )
502 ( "UNDO" calc-undo calc-redo calc-last-args )
503 ( "<-" calc-pop (progn 0 calc-pop)
504 (progn calc-num-prefix calc-pop) ) )
505 ( ( "INV" calc-inverse )
506 ( "7" ("7") calc-round )
507 ( "8" ("8") (progn 2 calc-clean-num) )
508 ( "9" ("9") calc-float )
509 ( "/" calc-divide (progn calc-inverse calc-power) ) )
510 ( ( "HYP" calc-hyperbolic )
511 ( "4" ("4") calc-ln calc-log10 )
512 ( "5" ("5") calc-exp calc-exp10 )
513 ( "6" ("6") calc-abs )
514 ( "*" calc-times calc-power ) )
515 ( ( "EXEC" calc-keypad-execute )
516 ( "1" ("1") calc-arcsin calc-sin )
517 ( "2" ("2") calc-arccos calc-cos )
518 ( "3" ("3") calc-arctan calc-tan )
519 ( "-" calc-minus calc-conj ) )
520 ( ( "OFF" calc-keypad-off )
521 ( "0" ("0") calc-imaginary )
522 ( "." (".") calc-precision )
523 ( "PI" calc-pi )
524 ( "+" calc-plus calc-sqrt ) ) )
525 )
526
527 (defvar calc-keypad-menus '( calc-keypad-math-menu
528 calc-keypad-funcs-menu
529 calc-keypad-binary-menu
530 calc-keypad-vector-menu
531 calc-keypad-modes-menu
532 calc-keypad-user-menu ) )
533
534 ;;; |----+----+----+----+----+----|
535 ;;; |FLR |CEIL|RND |TRNC|CLN2|FLT |
536 ;;; |----+----+----+----+----+----|
537 ;;; | LN |EXP | |ABS |IDIV|MOD |
538 ;;; |----+----+----+----+----+----|
539 ;;; |SIN |COS |TAN |SQRT|y^x |1/x |
540
541 (defvar calc-keypad-math-menu
542 '( ( ( "FLR" calc-floor )
543 ( "CEIL" calc-ceiling )
544 ( "RND" calc-round )
545 ( "TRNC" calc-trunc )
546 ( "CLN2" (progn 2 calc-clean-num) )
547 ( "FLT" calc-float ) )
548 ( ( "LN" calc-ln )
549 ( "EXP" calc-exp )
550 ( "" nil )
551 ( "ABS" calc-abs )
552 ( "IDIV" calc-idiv )
553 ( "MOD" calc-mod ) )
554 ( ( "SIN" calc-sin )
555 ( "COS" calc-cos )
556 ( "TAN" calc-tan )
557 ( "SQRT" calc-sqrt )
558 ( "y^x" calc-power )
559 ( "1/x" calc-inv ) ) )
560 )
561
562 ;;; |----+----+----+----+----+----|
563 ;;; |IGAM|BETA|IBET|ERF |BESJ|BESY|
564 ;;; |----+----+----+----+----+----|
565 ;;; |IMAG|CONJ| RE |ATN2|RAND|RAGN|
566 ;;; |----+----+----+----+----+----|
567 ;;; |GCD |FACT|DFCT|BNOM|PERM|NXTP|
568
569 (defvar calc-keypad-funcs-menu
570 '( ( ( "IGAM" calc-inc-gamma )
571 ( "BETA" calc-beta )
572 ( "IBET" calc-inc-beta )
573 ( "ERF" calc-erf )
574 ( "BESJ" calc-bessel-J )
575 ( "BESY" calc-bessel-Y ) )
576 ( ( "IMAG" calc-imaginary )
577 ( "CONJ" calc-conj )
578 ( "RE" calc-re calc-im )
579 ( "ATN2" calc-arctan2 )
580 ( "RAND" calc-random )
581 ( "RAGN" calc-random-again ) )
582 ( ( "GCD" calc-gcd calc-lcm )
583 ( "FACT" calc-factorial calc-gamma )
584 ( "DFCT" calc-double-factorial )
585 ( "BNOM" calc-choose )
586 ( "PERM" calc-perm )
587 ( "NXTP" calc-next-prime calc-prev-prime ) ) )
588 )
589
590 ;;; |----+----+----+----+----+----|
591 ;;; |AND | OR |XOR |NOT |LSH |RSH |
592 ;;; |----+----+----+----+----+----|
593 ;;; |DEC |HEX |OCT |BIN |WSIZ|ARSH|
594 ;;; |----+----+----+----+----+----|
595 ;;; | A | B | C | D | E | F |
596
597 (defvar calc-keypad-binary-menu
598 '( ( ( "AND" calc-and calc-diff )
599 ( "OR" calc-or )
600 ( "XOR" calc-xor )
601 ( "NOT" calc-not calc-clip )
602 ( "LSH" calc-lshift-binary calc-rotate-binary )
603 ( "RSH" calc-rshift-binary ) )
604 ( ( "DEC" calc-decimal-radix )
605 ( "HEX" calc-hex-radix )
606 ( "OCT" calc-octal-radix )
607 ( "BIN" calc-binary-radix )
608 ( "WSIZ" calc-word-size )
609 ( "ARSH" calc-rshift-arith ) )
610 ( ( "A" ("A") )
611 ( "B" ("B") )
612 ( "C" ("C") )
613 ( "D" ("D") )
614 ( "E" ("E") )
615 ( "F" ("F") ) ) )
616 )
617
618 ;;; |----+----+----+----+----+----|
619 ;;; |SUM |PROD|MAX |MAP*|MAP^|MAP$|
620 ;;; |----+----+----+----+----+----|
621 ;;; |INV |DET |TRN |IDNT|CRSS|"x" |
622 ;;; |----+----+----+----+----+----|
623 ;;; |PACK|UNPK|INDX|BLD |LEN |... |
624
625 (defvar calc-keypad-vector-menu
626 '( ( ( "SUM" calc-vector-sum calc-vector-alt-sum calc-vector-mean )
627 ( "PROD" calc-vector-product nil calc-vector-sdev )
628 ( "MAX" calc-vector-max calc-vector-min calc-vector-median )
629 ( "MAP*" (lambda () (interactive)
630 (calc-map '(2 calcFunc-mul "*"))) )
631 ( "MAP^" (lambda () (interactive)
632 (calc-map '(2 calcFunc-pow "^"))) )
633 ( "MAP$" calc-map-stack ) )
634 ( ( "MINV" calc-inv )
635 ( "MDET" calc-mdet )
636 ( "MTRN" calc-transpose calc-conj-transpose )
637 ( "IDNT" (progn calc-num-prefix calc-ident) )
638 ( "CRSS" calc-cross )
639 ( "\"x\"" "\excalc-algebraic-entry\rx\r"
640 "\excalc-algebraic-entry\ry\r"
641 "\excalc-algebraic-entry\rz\r"
642 "\excalc-algebraic-entry\rt\r") )
643 ( ( "PACK" calc-pack )
644 ( "UNPK" calc-unpack )
645 ( "INDX" (progn calc-num-prefix calc-index) "\C-u\excalc-index\r" )
646 ( "BLD" (progn calc-num-prefix calc-build-vector) )
647 ( "LEN" calc-vlength )
648 ( "..." calc-full-vectors ) ) )
649 )
650
651 ;;; |----+----+----+----+----+----|
652 ;;; |FLT |FIX |SCI |ENG |GRP | |
653 ;;; |----+----+----+----+----+----|
654 ;;; |RAD |DEG |FRAC|POLR|SYMB|PREC|
655 ;;; |----+----+----+----+----+----|
656 ;;; |SWAP|RLL3|RLL4|OVER|STO |RCL |
657
658 (defvar calc-keypad-modes-menu
659 '( ( ( "FLT" calc-normal-notation
660 (progn calc-num-prefix calc-normal-notation) )
661 ( "FIX" (progn 2 calc-fix-notation)
662 (progn calc-num-prefix calc-fix-notation) )
663 ( "SCI" calc-sci-notation
664 (progn calc-num-prefix calc-sci-notation) )
665 ( "ENG" calc-eng-notation
666 (progn calc-num-prefix calc-eng-notation) )
667 ( "GRP" calc-group-digits "\C-u-3\excalc-group-digits\r" )
668 ( "" nil ) )
669 ( ( "RAD" calc-radians-mode )
670 ( "DEG" calc-degrees-mode )
671 ( "FRAC" calc-frac-mode )
672 ( "POLR" calc-polar-mode )
673 ( "SYMB" calc-symbolic-mode )
674 ( "PREC" calc-precision ) )
675 ( ( "SWAP" calc-roll-down )
676 ( "RLL3" (progn 3 calc-roll-up) (progn 3 calc-roll-down) )
677 ( "RLL4" (progn 4 calc-roll-up) (progn 4 calc-roll-down) )
678 ( "OVER" calc-over )
679 ( "STO" calc-keypad-store )
680 ( "RCL" calc-keypad-recall ) ) )
681 )
682