[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/lisp/calc calc-ext.el
From: |
Jay Belanger |
Subject: |
[Emacs-diffs] emacs/lisp/calc calc-ext.el |
Date: |
Mon, 16 Nov 2009 00:01:57 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Jay Belanger <jpb> 09/11/16 00:01:57
Modified files:
lisp/calc : calc-ext.el
Log message:
(math-read-number-fancy): Read complement signed numbers.
(calc-init-extensions): Add binding for `calc-symclip'.
Add autoloads for `calcFunc-symclip' and `calc-symclip'.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/calc/calc-ext.el?cvsroot=emacs&r1=1.81&r2=1.82
Patches:
Index: calc-ext.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calc/calc-ext.el,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -b -r1.81 -r1.82
--- calc-ext.el 28 Oct 2009 18:35:37 -0000 1.81
+++ calc-ext.el 16 Nov 2009 00:01:57 -0000 1.82
@@ -198,6 +198,7 @@
(define-key calc-mode-map "bo" 'calc-or)
(define-key calc-mode-map "bp" 'calc-pack-bits)
(define-key calc-mode-map "br" 'calc-rshift-binary)
+ (define-key calc-mode-map "bs" 'calc-symclip)
(define-key calc-mode-map "bt" 'calc-rotate-binary)
(define-key calc-mode-map "bu" 'calc-unpack-bits)
(define-key calc-mode-map "bw" 'calc-word-size)
@@ -762,7 +763,7 @@
math-sqr-float math-trunc-fancy math-trunc-special)
("calc-bin" calcFunc-and calcFunc-ash
-calcFunc-clip calcFunc-diff calcFunc-lsh calcFunc-not calcFunc-or
+calcFunc-clip calcFunc-diff calcFunc-symclip calcFunc-lsh calcFunc-not
calcFunc-or
calcFunc-rash calcFunc-rot calcFunc-rsh calcFunc-xor math-clip
math-compute-max-digits math-convert-radix-digits math-float-parts
math-format-bignum-binary math-format-bignum-hex
@@ -987,9 +988,9 @@
calc-floor calc-idiv calc-increment calc-mant-part calc-max calc-min
calc-round calc-scale-float calc-sign calc-trunc calc-xpon-part)
- ("calc-bin" calc-and calc-binary-radix calc-clip calc-decimal-radix
-calc-diff calc-hex-radix calc-leading-zeros calc-lshift-arith
-calc-lshift-binary calc-not calc-octal-radix calc-or calc-radix
+ ("calc-bin" calc-and calc-binary-radix calc-clip calc-complement-signed-mode
+calc-decimal-radix calc-diff calc-hex-radix calc-symclip calc-leading-zeros
+calc-lshift-arith calc-lshift-binary calc-not calc-octal-radix calc-or
calc-radix
calc-rotate-binary calc-rshift-arith calc-rshift-binary calc-word-size
calc-xor)
@@ -2994,10 +2995,20 @@
(math-add int (math-div frac (math-pow radix (length fracs))))))))
;; Integer with explicit radix
- ((string-match "^\\([0-9]+\\)\\(#\\|\\^\\^\\)\\([0-9a-zA-Z]+\\)$" s)
+ ((string-match "^\\([0-9]+\\)\\(#&?\\|\\^\\^\\)\\([0-9a-zA-Z]+\\)$" s)
(math-read-radix (math-match-substring s 3)
(string-to-number (math-match-substring s 1))))
+ ;; Complement signed with explicit radix
+ ((string-match "^\\([0-9]+\\)\\(##\\)\\([0-9a-zA-Z]+\\)$" s)
+ (let ((num (math-read-radix (math-match-substring s 3)
+ (string-to-number (math-match-substring s
1)))))
+ (if (and
+ (Math-lessp num math-2-word-size)
+ (<= (math-compare math-half-2-word-size num) 0))
+ (math-sub num math-2-word-size)
+ num)))
+
;; C language hexadecimal notation
((and (eq calc-language 'c)
(string-match "^0[xX]\\([0-9a-fA-F]+\\)$" s))
- [Emacs-diffs] emacs/lisp/calc calc-ext.el,
Jay Belanger <=