Current File : //kunden/usr/share/emacs/27.2/lisp/calculator.elc |
;ELC
;;; Compiled
;;; in Emacs version 27.2
;;; with all optimizations.
;;; This file uses dynamic docstrings, first added in Emacs 19.29.
;;; This file does not contain utf-8 non-ASCII characters,
;;; and so can be loaded in Emacs versions earlier than 23.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(byte-code "\300\301\302\303\304\305\306\307\310\311\310\312&\210\313\314\315\316\317DD\320\321\322\310\301&\210\313\323\315\316\324DD\325\321\322\310\301&\210\313\326\315\316\327DD\330\321\322\310\301&\210\313\331\315\316\332DD\333\321\334\310\301&\210\313\335\315\316\336DD\337\321\340\310\301&\210\313\341\315\316\342DD\343\321\344\310\301&\210\313\345\315\316\346DD\347\321\322\310\301&\210\313\350\315\316\351DD\352\321\344\310\301&\210\313\353\315\316\354DD\355\321\340\310\301&\210\313\356\315\316\357DD\360\321\361\310\301&\210\313\362\315\316\363DD\364\321\365\310\301&\210\313\366\315\316\367DD\370\321\371\310\301&\210\313\372\315\316\373DD\374\321\322\310\301&\210\375\372\376\377#\210\313\201@ \315\316\201A DD\201B \321\322\310\301&\210\313\201C \315\316\201D DD\201E \321\322\310\301&\210\313\201F \315\316\201G DD\201H \321\201I \310\301&\210\313\201J \315\316\201K DD\201L \321\201M \201N \201O \310\301& \210\313\201P \315\316\201Q DD\201R \321\201S \310\301&\210\201T \201U !\207" [custom-declare-group calculator nil "Simple Emacs calculator." :prefix "calculator" :version "21.1" :group tools applications custom-declare-variable calculator-electric-mode funcall function #[0 "\300\207" [nil] 1] "Run `calculator' electrically, in the echo area.\nElectric mode saves some place but changes the way you interact with the\ncalculator." :type boolean calculator-use-menu #[0 "\300\207" [t] 1] "Make `calculator' create a menu.\nNote that this requires easymenu. Must be set before loading." calculator-bind-escape #[0 "\300\207" [nil] 1] "If non-nil, set escape to exit the calculator." calculator-unary-style #[0 "\300\207" [postfix] 1] "Value is either `prefix' or `postfix'.\nThis determines the default behavior of unary operators." (choice (const prefix) (const postfix)) calculator-prompt #[0 "\300\207" [#1="Calc=%s> "] 1 #1#] "The prompt used by the Emacs calculator.\nIt should contain a \"%s\" somewhere that will indicate the i/o radixes;\nthis will be a two-character string as described in the documentation\nfor `calculator-mode'." string calculator-number-digits #[0 "\300\207" [3] 1] "The calculator's number of digits used for standard display.\nUsed by the `calculator-standard-display' function - it will use the\nformat string \"%.NC\" where this number is N and C is a character given\nat runtime." integer calculator-radix-grouping-mode #[0 "\300\207" [t] 1] "Use digit grouping in radix output mode.\nIf this is set, chunks of `calculator-radix-grouping-digits' characters\nwill be separated by `calculator-radix-grouping-separator' when in radix\noutput mode is active (determined by `calculator-output-radix')." calculator-radix-grouping-digits #[0 "\300\207" [4] 1] "The number of digits used for grouping display in radix modes.\nSee `calculator-radix-grouping-mode'." calculator-radix-grouping-separator #[0 "\300\207" [#2="'"] 1 #2#] "The separator used in radix grouping display.\nSee `calculator-radix-grouping-mode'." calculator-remove-zeros #[0 "\300\207" [t] 1] "Non-nil value means delete all redundant zero decimal digits.\nIf this value is not t and not nil, redundant zeros are removed except\nfor one.\nUsed by the `calculator-remove-zeros' function." (choice (const t) (const leave-decimal) (const nil)) calculator-displayer #[0 "\300\207" [(std 110)] 1] "A displayer specification for numerical values.\nThis is the displayer used to show all numbers in an expression. Result\nvalues will be displayed according to the first element of\n`calculator-displayers'.\n\nThe displayer is a symbol, a string or an expression. A symbol should\nbe the name of a one-argument function, a string is used with a single\nargument and an expression will be evaluated with the variable `num'\nbound to whatever should be displayed. If it is a function symbol, it\nshould be able to handle special symbol arguments, currently `left' and\n`right' which will be sent by special keys to modify display parameters\nassociated with the displayer function (for example to change the number\nof digits displayed).\n\nAn exception to the above is the case of the list (std C [G]) where C is\na character and G is an optional boolean, in this case the\n`calculator-standard-displayer' function will be used with these as\narguments." (choice (function) (string) (sexp) (list (const std) character) (list (const std) character boolean)) calculator-displayers #[0 "\300\207" [(((std 110) "Standard display, decimal point or scientific") (calculator-eng-display "Eng display") ((std 102 t) "Standard display, decimal point with grouping") ((std 101) "Standard display, scientific") ("%S" "Emacs printer"))] 1] "A list of displayers.\nEach element is a list of a displayer and a description string. The\nfirst element is the one which is currently used, this is for the\ndisplay of result values not values in expressions. A displayer\nspecification is the same as the values that can be stored in\n`calculator-displayer'.\n\n`calculator-rotate-displayer' rotates this list." sexp calculator-paste-decimals #[0 "\300\207" [t] 1] "If non-nil, convert pasted integers so they have a decimal point.\nThis makes it possible to paste big integers since they will be read as\nfloats, otherwise the Emacs reader will fail on them." make-obsolete-variable "it is no longer used." "26.1" calculator-copy-displayer #[0 "\300\207" [nil] 1] "If non-nil, this is any value that can be used for\n`calculator-displayer', to format a string before copying it with\n`calculator-copy'. If nil, then `calculator-displayer's normal value is\nused." calculator-2s-complement #[0 "\300\207" [nil] 1] "If non-nil, show negative numbers in 2s complement in radix modes.\nOtherwise show as a negative number." calculator-mode-hook #[0 "\300\207" [nil] 1] "List of hook functions for `calculator-mode' to run.\nNote: if `calculator-electric-mode' is on, then this hook will get\nactivated in the minibuffer -- in that case it should not do much more\nthan local key settings and other effects that will change things\noutside the scope of calculator related code." hook calculator-user-registers #[0 "\300\207" [nil] 1] "An association list of user-defined register bindings.\nEach element in this list is a list of a character and a number that\nwill be stored in that character's register.\n\nFor example, use this to define the golden ratio number:\n (setq calculator-user-registers \\='((?g . 1.61803398875)))\nbefore you load calculator." (repeat (cons character number)) :set #[514 "\302\300!\203 \303\"\211\211\207" [calculator-registers calculator-user-registers boundp append] 5 "\n\n(fn _ VAL)"] calculator-user-operators #[0 "\300\207" [nil] 1] "A list of additional operators.\nThis is a list in the same format as specified in the documentation for\n`calculator-operators', that you can use to bind additional calculator\noperators. It is probably not a good idea to modify this value with\n`customize' since it is too complex...\n\nExamples:\n\n* A very simple one, adding a postfix \"x-to-y\" conversion keys, using\n t as a prefix key:\n\n (setq calculator-user-operators\n \\='((\"tf\" cl-to-fr (+ 32 (/ (* X 9) 5)) 1)\n (\"tc\" fr-to-cl (/ (* (- X 32) 5) 9) 1)\n (\"tp\" kg-to-lb (/ X 0.453592) 1)\n (\"tk\" lb-to-kg (* X 0.453592) 1)\n (\"tF\" mt-to-ft (/ X 0.3048) 1)\n (\"tM\" ft-to-mt (* X 0.3048) 1)))\n\n* Using a function-like form is simple: use `X' for the argument (`Y'\n for a second one in case of a binary operator), `TX' is a truncated\n version of `X' and `F' for a recursive call. Here is a [very\n inefficient] Fibonacci number operator:\n\n (add-to-list \\='calculator-user-operators\n \\='(\"F\" fib\n (if (<= TX 1) 1 (+ (F (- TX 1)) (F (- TX 2))))))\n\n Note that this will be either postfix or prefix, according to\n `calculator-unary-style'." (repeat (list string symbol sexp integer integer)) require cl-lib] 12)
#@418 A list of initial operators.
This is a list in the same format as `calculator-operators'. Whenever
`calculator' starts, it looks at the value of this variable, and if it
is not empty, its contents is prepended to `calculator-operators' and
the appropriate key bindings are made.
This variable is then reset to nil. Don't use this if you want to add
user-defined operators, use `calculator-user-operators' instead.
(defvar calculator-initial-operators '(("=" = identity 1 -1) (nobind "+" + + 2 4) (nobind "-" - - 2 4) (nobind "+" + + -1 9) (nobind "-" - - -1 9) ("(" \( identity -1 -1) (")" \) identity 1 10) ("|" or (logior TX TY) 2 2) ("#" xor (logxor TX TY) 2 2) ("&" and (logand TX TY) 2 3) ("*" * * 2 5) ("/" / / 2 5) ("\\" div (/ TX TY) 2 5) ("%" rem (% TX TY) 2 5) ("L" log log 2 6) ("S" sin (sin DX) x 6) ("C" cos (cos DX) x 6) ("T" tan (tan DX) x 6) ("IS" asin (D (asin X)) x 6) ("IC" acos (D (acos X)) x 6) ("IT" atan (D (atan X)) x 6) ("Q" sqrt sqrt x 7) ("^" ^ calculator-expt 2 7) ("!" ! calculator-fact x 7) (";" 1/ (/ 1 X) 1 7) ("_" - - 1 8) ("~" ~ (lognot TX) x 8) (">" repR calculator-repR 1 8) ("<" repL calculator-repL 1 8) ("v" avg (/ (apply '+ L) (length L)) 0 8) ("l" tot (apply '+ L) 0 8)) (#$ . 8419))
#@1344 The calculator operators, each a list with:
1. The key(s) that is bound to for this operation, a string that is
used with `kbd';
2. The displayed symbol for this function;
3. The function symbol, or a form that uses the variables `X' and `Y',
(if it is a binary operator), `TX' and `TY' (truncated integer
versions), `DX' (converted to radians if degrees mode is on), `D'
(function for converting radians to degrees if deg mode is on), `L'
(list of saved values), `F' (function for recursive iteration calls)
and evaluates to the function value -- these variables are capital;
4. The function's arity, optional, one of: 2 => binary, -1 => prefix
unary, +1 => postfix unary, 0 => a 0-arg operator func (note that
using such a function replaces the currently entered number, if any),
non-number (the default) => postfix or prefix as determined by
`calculator-unary-style';
5. The function's precedence -- should be in the range of 1 (lowest) to
9 (highest) (optional, defaults to 1);
It it possible have a unary prefix version of a binary operator if it
comes later in this list. If the list begins with the symbol `nobind',
then no key binding will take place -- this is only used for predefined
keys.
Use `calculator-user-operators' to add operators to this list, see its
documentation for an example.
(defvar calculator-operators nil (#$ . 9655))
#@44 Stack contents -- operations and operands.
(defvar calculator-stack nil (#$ . 11050))
#@45 Current number being entered (as a string).
(defvar calculator-curnum nil (#$ . 11142))
#@50 Cons of the stack and its string representation.
(defvar calculator-stack-display nil (#$ . 11236))
#@69 A table to convert input characters to corresponding radix symbols.
(defvar calculator-char-radix '((68) (66 . bin) (79 . oct) (72 . hex) (88 . hex)) (#$ . 11342))
#@69 The mode for display, one of: nil (decimal), `bin', `oct' or `hex'.
(defvar calculator-output-radix nil (#$ . 11512))
#@67 The mode for input, one of: nil (decimal), `bin', `oct' or `hex'.
(defvar calculator-input-radix nil (#$ . 11636))
#@66 Non-nil if trig functions operate on degrees instead of radians.
(defvar calculator-deg nil (#$ . 11757))
#@35 A list of saved values collected.
(defvar calculator-saved-list nil (#$ . 11869))
#@42 The pointer to the current saved number.
(defvar calculator-saved-ptr 0 (#$ . 11957))
#@60 Bound to t when a value should be added to the saved-list.
(defvar calculator-add-saved nil (#$ . 12049))
#@68 When non-nil, we see something that the next digit should replace.
(defvar calculator-display-fragile nil (#$ . 12161))
#@32 The current calculator buffer.
(defvar calculator-buffer nil (#$ . 12287))
#@50 Internal value used by `calculator-eng-display'.
(defvar calculator-eng-extra nil (#$ . 12368))
#@50 Internal value used by `calculator-eng-display'.
(defvar calculator-eng-tmp-show nil (#$ . 12470))
#@98 The last binary operation and its arguments.
Used for repeating operations in calculator-repR/L.
(defvar calculator-last-opXY nil (#$ . 12575))
#@53 The association list of calculator register values.
(defvar calculator-registers (byte-code "\303\304 B\305\nBD\"\207" [calculator-user-registers float-e float-pi append 101 112] 5) (#$ . 12725))
#@57 Used to hack restarting with the electric mode changed.
(defvar calculator-restart-other-mode nil (#$ . 12928))
#@20
(fn KEY CMD MAP)
(defalias 'calculator-define-key #[771 ";\203 \300!\202\f \301!\302#\210\211\204( \303 \262\304\305\"\210\306\"\210\211CG\307\211W\205\205 \211H\310!\311\242\"\312\nGSU\203\\ \313!\204| \211$\210\202| \313!\203j \240\210\202| \303 $\210\240\266\266\211T\262\202- \266\202\262\207" [kbd keymap-parent define-key make-sparse-keymap suppress-keymap t set-keymap-parent 0 vector lookup-key #[1028 "\300\242#\210\301!\2051 \302X\203 \303X\204% \304X\2051 \305X\2051 \300\242\306\307\310\"!#\207" [define-key characterp 65 90 97 122 vector logxor 32] 10 "\n\n(fn M C K X)"] keymapp] 19 (#$ . 13046)])
#@25 The calculator key map.
(defvar calculator-mode-map (byte-code "\304 \305\306\"\210\307\211\203/ \211@\310A!\211\203'