]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve commenting convention.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 30 Aug 2009 05:12:46 +0000 (05:12 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 30 Aug 2009 05:12:46 +0000 (05:12 +0000)
(calc-digit-map, toplevel): Simplify.

lisp/ChangeLog
lisp/calc/calc.el

index 8bfd1dfa019a3aecab9503ec05afdbf13fccacfd..09ddbe5fe56dc34d17eb493a3e382dff5f28aa54 100644 (file)
@@ -1,5 +1,8 @@
 2009-08-30  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * calc/calc.el: Improve commenting convention.
+       (calc-digit-map, toplevel): Simplify.
+
        * comint.el (comint-insert-input): Be careful to only set point if we
        don't delegate to some other command.
 
index 790647d62ca4f9f9cf676817615f8ffb46ae073f..d38d6b7dbdebe76d08eb01812bcdfc0644f3850a 100644 (file)
@@ -1043,25 +1043,13 @@ Used by `calc-user-invocation'.")
     map)
   "The key map for Calc.")
 
-
-
 (defvar calc-digit-map
   (let ((map (make-keymap)))
-    (if (featurep 'xemacs)
-        (map-keymap (function
-                     (lambda (keys bind)
-                       (define-key map keys
-                         (if (eq bind 'undefined)
-                             'undefined 'calcDigit-nondigit))))
-                    calc-mode-map)
-      (let ((cmap (nth 1 calc-mode-map))
-            (dmap (nth 1 map))
-            (i 0))
-        (while (< i 128)
-          (aset dmap i
-                (if (eq (aref cmap i) 'undefined)
-                    'undefined 'calcDigit-nondigit))
-          (setq i (1+ i)))))
+    (map-keymap (lambda (key bind)
+                  (define-key map (vector key)
+                    (if (eq bind 'undefined)
+                        'undefined 'calcDigit-nondigit)))
+                calc-mode-map)
     (mapc (lambda (x) (define-key map (char-to-string x) 'calcDigit-key))
           "_0123456789.e+-:n#@oh'\"mspM")
     (mapc (lambda (x) (define-key map (char-to-string x) 'calcDigit-letter))
@@ -1078,15 +1066,13 @@ Used by `calc-user-invocation'.")
              (define-key calc-digit-map x 'calcDigit-backspace)
              (define-key calc-mode-map x 'calc-pop)
              (define-key calc-mode-map
-                 (if (vectorp x)
-                     (if (featurep 'xemacs)
-                         (if (= (length x) 1)
-                             (vector (if (consp (aref x 0))
-                                         (cons 'meta (aref x 0))
-                                       (list 'meta (aref x 0))))
-                           "\e\C-d")
-                       (vconcat "\e" x))
-                   (concat "\e" x))
+                (if (and (vectorp x) (featurep 'xemacs))
+                    (if (= (length x) 1)
+                        (vector (if (consp (aref x 0))
+                                    (cons 'meta (aref x 0))
+                                  (list 'meta (aref x 0))))
+                      "\e\C-d")
+                  (vconcat "\e" x))
                'calc-pop-above))
          (error nil)))
       (if calc-scan-for-dels
@@ -2436,101 +2422,101 @@ largest Emacs integer.")
 
 
 ;;;; Arithmetic routines.
-;;;
-;;; An object as manipulated by one of these routines may take any of the
-;;; following forms:
-;;;
-;;; integer                 An integer.  For normalized numbers, this format
-;;;                        is used only for
-;;;                         negative math-small-integer-size + 1 to
-;;;                         math-small-integer-size - 1
-;;;
-;;; (bigpos N0 N1 N2 ...)   A big positive integer,
-;;;                           N0 + N1*math-bignum-digit-size
-;;;                              + N2*(math-bignum-digit-size)^2 ...
-;;; (bigneg N0 N1 N2 ...)   A big negative integer,
-;;;                           - N0 - N1*math-bignum-digit-size ...
-;;;                        Each digit N is in the range
-;;;                             0 ... math-bignum-digit-size -1.
-;;;                        Normalized, always at least three N present,
-;;;                        and the most significant N is nonzero.
-;;;
-;;; (frac NUM DEN)          A fraction.  NUM and DEN are small or big integers.
-;;;                         Normalized, DEN > 1.
-;;;
-;;; (float NUM EXP)         A floating-point number, NUM * 10^EXP;
-;;;                         NUM is a small or big integer, EXP is a small int.
-;;;                        Normalized, NUM is not a multiple of 10, and
-;;;                        abs(NUM) < 10^calc-internal-prec.
-;;;                        Normalized zero is stored as (float 0 0).
-;;;
-;;; (cplx REAL IMAG)        A complex number; REAL and IMAG are any of above.
-;;;                        Normalized, IMAG is nonzero.
-;;;
-;;; (polar R THETA)         Polar complex number.  Normalized, R > 0 and THETA
-;;;                         is neither zero nor 180 degrees (pi radians).
-;;;
-;;; (vec A B C ...)         Vector of objects A, B, C, ...  A matrix is a
-;;;                         vector of vectors.
-;;;
-;;; (hms H M S)             Angle in hours-minutes-seconds form.  All three
-;;;                         components have the same sign; H and M must be
-;;;                         numerically integers; M and S are expected to
-;;;                         lie in the range [0,60).
-;;;
-;;; (date N)                A date or date/time object.  N is an integer to
-;;;                        store a date only, or a fraction or float to
-;;;                        store a date and time.
-;;;
-;;; (sdev X SIGMA)          Error form, X +/- SIGMA.  When normalized,
-;;;                         SIGMA > 0.  X is any complex number and SIGMA
-;;;                        is real numbers; or these may be symbolic
-;;;                         expressions where SIGMA is assumed real.
-;;;
-;;; (intv MASK LO HI)       Interval form.  MASK is 0=(), 1=(], 2=[), or 3=[].
-;;;                         LO and HI are any real numbers, or symbolic
-;;;                        expressions which are assumed real, and LO < HI.
-;;;                        For [LO..HI], if LO = HI normalization produces LO,
-;;;                        and if LO > HI normalization produces [LO..LO).
-;;;                        For other intervals, if LO > HI normalization
-;;;                        sets HI equal to LO.
-;;;
-;;; (mod N M)              Number modulo M.  When normalized, 0 <= N < M.
-;;;                        N and M are real numbers.
-;;;
-;;; (var V S)              Symbolic variable.  V is a Lisp symbol which
-;;;                        represents the variable's visible name.  S is
-;;;                        the symbol which actually stores the variable's
-;;;                        value:  (var pi var-pi).
-;;;
-;;; In general, combining rational numbers in a calculation always produces
-;;; a rational result, but if either argument is a float, result is a float.
-
-;;; In the following comments, [x y z] means result is x, args must be y, z,
-;;; respectively, where the code letters are:
-;;;
-;;;    O  Normalized object (vector or number)
-;;;    V  Normalized vector
-;;;    N  Normalized number of any type
-;;;    N  Normalized complex number
-;;;    R  Normalized real number (float or rational)
-;;;    F  Normalized floating-point number
-;;;    T  Normalized rational number
-;;;    I  Normalized integer
-;;;    B  Normalized big integer
-;;;    S  Normalized small integer
-;;;    D  Digit (small integer, 0..999)
-;;;    L  Normalized bignum digit list (without "bigpos" or "bigneg" symbol)
-;;;       or normalized vector element list (without "vec")
-;;;    P  Predicate (truth value)
-;;;    X  Any Lisp object
-;;;    Z  "nil"
-;;;
-;;; Lower-case letters signify possibly un-normalized values.
-;;; "L.D" means a cons of an L and a D.
-;;; [N N; n n] means result will be normalized if argument is.
-;;; Also, [Public] marks routines intended to be called from outside.
-;;; [This notation has been neglected in many recent routines.]
+;;
+;; An object as manipulated by one of these routines may take any of the
+;; following forms:
+;;
+;; integer                 An integer.  For normalized numbers, this format
+;;                         is used only for
+;;                         negative math-small-integer-size + 1 to
+;;                         math-small-integer-size - 1
+;;
+;; (bigpos N0 N1 N2 ...)   A big positive integer,
+;;                           N0 + N1*math-bignum-digit-size
+;;                              + N2*(math-bignum-digit-size)^2 ...
+;; (bigneg N0 N1 N2 ...)   A big negative integer,
+;;                           - N0 - N1*math-bignum-digit-size ...
+;;                         Each digit N is in the range
+;;                             0 ... math-bignum-digit-size -1.
+;;                         Normalized, always at least three N present,
+;;                         and the most significant N is nonzero.
+;;
+;; (frac NUM DEN)          A fraction.  NUM and DEN are small or big integers.
+;;                         Normalized, DEN > 1.
+;;
+;; (float NUM EXP)         A floating-point number, NUM * 10^EXP;
+;;                         NUM is a small or big integer, EXP is a small int.
+;;                         Normalized, NUM is not a multiple of 10, and
+;;                         abs(NUM) < 10^calc-internal-prec.
+;;                         Normalized zero is stored as (float 0 0).
+;;
+;; (cplx REAL IMAG)        A complex number; REAL and IMAG are any of above.
+;;                         Normalized, IMAG is nonzero.
+;;
+;; (polar R THETA)         Polar complex number.  Normalized, R > 0 and THETA
+;;                         is neither zero nor 180 degrees (pi radians).
+;;
+;; (vec A B C ...)         Vector of objects A, B, C, ...  A matrix is a
+;;                         vector of vectors.
+;;
+;; (hms H M S)             Angle in hours-minutes-seconds form.  All three
+;;                         components have the same sign; H and M must be
+;;                         numerically integers; M and S are expected to
+;;                         lie in the range [0,60).
+;;
+;; (date N)                A date or date/time object.  N is an integer to
+;;                         store a date only, or a fraction or float to
+;;                         store a date and time.
+;;
+;; (sdev X SIGMA)          Error form, X +/- SIGMA.  When normalized,
+;;                         SIGMA > 0.  X is any complex number and SIGMA
+;;                         is real numbers; or these may be symbolic
+;;                         expressions where SIGMA is assumed real.
+;;
+;; (intv MASK LO HI)       Interval form.  MASK is 0=(), 1=(], 2=[), or 3=[].
+;;                         LO and HI are any real numbers, or symbolic
+;;                         expressions which are assumed real, and LO < HI.
+;;                         For [LO..HI], if LO = HI normalization produces LO,
+;;                         and if LO > HI normalization produces [LO..LO).
+;;                         For other intervals, if LO > HI normalization
+;;                         sets HI equal to LO.
+;;
+;; (mod N M)               Number modulo M.  When normalized, 0 <= N < M.
+;;                         N and M are real numbers.
+;;
+;; (var V S)               Symbolic variable.  V is a Lisp symbol which
+;;                         represents the variable's visible name.  S is
+;;                         the symbol which actually stores the variable's
+;;                         value:  (var pi var-pi).
+;;
+;; In general, combining rational numbers in a calculation always produces
+;; a rational result, but if either argument is a float, result is a float.
+
+;; In the following comments, [x y z] means result is x, args must be y, z,
+;; respectively, where the code letters are:
+;;
+;;    O  Normalized object (vector or number)
+;;    V  Normalized vector
+;;    N  Normalized number of any type
+;;    N  Normalized complex number
+;;    R  Normalized real number (float or rational)
+;;    F  Normalized floating-point number
+;;    T  Normalized rational number
+;;    I  Normalized integer
+;;    B  Normalized big integer
+;;    S  Normalized small integer
+;;    D  Digit (small integer, 0..999)
+;;    L  Normalized bignum digit list (without "bigpos" or "bigneg" symbol)
+;;       or normalized vector element list (without "vec")
+;;    P  Predicate (truth value)
+;;    X  Any Lisp object
+;;    Z  "nil"
+;;
+;; Lower-case letters signify possibly un-normalized values.
+;; "L.D" means a cons of an L and a D.
+;; [N N; n n] means result will be normalized if argument is.
+;; Also, [Public] marks routines intended to be called from outside.
+;; [This notation has been neglected in many recent routines.]
 
 (defvar math-eval-rules-cache)
 (defvar math-eval-rules-cache-other)
@@ -2662,7 +2648,7 @@ largest Emacs integer.")
 
 
 
-;;; True if A is a floating-point real or complex number.  [P x] [Public]
+;; True if A is a floating-point real or complex number.  [P x] [Public]
 (defun math-floatp (a)
   (cond ((eq (car-safe a) 'float) t)
        ((memq (car-safe a) '(cplx polar mod sdev intv))
@@ -2674,7 +2660,7 @@ largest Emacs integer.")
 
 
 
-;;; Verify that A is a complete object and return A.  [x x] [Public]
+;; Verify that A is a complete object and return A.  [x x] [Public]
 (defun math-check-complete (a)
   (cond ((integerp a) a)
        ((eq (car-safe a) 'incomplete)
@@ -2684,7 +2670,7 @@ largest Emacs integer.")
 
 
 
-;;; Coerce integer A to be a bignum.  [B S]
+;; Coerce integer A to be a bignum.  [B S]
 (defun math-bignum (a)
   (if (>= a 0)
       (cons 'bigpos (math-bignum-big a))
@@ -2697,7 +2683,7 @@ largest Emacs integer.")
           (math-bignum-big (/ a math-bignum-digit-size)))))
 
 
-;;; Build a normalized floating-point number.  [F I S]
+;; Build a normalized floating-point number.  [F I S]
 (defun math-make-float (mant exp)
   (if (eq mant 0)
       '(float 0 0)