[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/calc/calc-ext.el
From: |
Jay Belanger |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/calc/calc-ext.el |
Date: |
Tue, 23 Nov 2004 01:02:43 -0500 |
Index: emacs/lisp/calc/calc-ext.el
diff -c emacs/lisp/calc/calc-ext.el:1.24 emacs/lisp/calc/calc-ext.el:1.25
*** emacs/lisp/calc/calc-ext.el:1.24 Mon Nov 22 04:52:48 2004
--- emacs/lisp/calc/calc-ext.el Tue Nov 23 05:56:40 2004
***************
*** 2886,2896 ****
--- 2886,2964 ----
(defvar math-expr-data)
+ (defvar math-read-replacement-list
+ '(;; Misc symbols
+ ("±" "+/-") ; plus or minus
+ ("Ã" "*") ; multiplication sign
+ ("÷" ":") ; division sign
+ ("â" "-") ; subtraction sign
+ ("â" "/") ; division sign
+ ("â" "*") ; asterisk multiplication
+ ("â" "inf") ; infinity symbol
+ ("â¤" "<=")
+ ("â¥" ">=")
+ ("â¦" "<=")
+ ("â§" ">=")
+ ;; fractions
+ ("¼" "(1:4)") ; 1/4
+ ("½" "(1:2)") ; 1/2
+ ("¾" "(3:4)") ; 3/4
+ ("â
" "(1:3)") ; 1/3
+ ("â
" "(2:3)") ; 2/3
+ ("â
" "(1:5)") ; 1/5
+ ("â
" "(2:5)") ; 2/5
+ ("â
" "(3:5)") ; 3/5
+ ("â
" "(4:5)") ; 4/5
+ ("â
" "(1:6)") ; 1/6
+ ("â
" "(5:6)") ; 5/6
+ ("â
" "(1:8)") ; 1/8
+ ("â
" "(3:8)") ; 3/8
+ ("â
" "(5:8)") ; 5/8
+ ("â
" "(7:8)") ; 7/8
+ ("â
" "1:") ; 1/...
+ ;; superscripts
+ ("â°" "0") ; 0
+ ("¹" "1") ; 1
+ ("²" "2") ; 2
+ ("³" "3") ; 3
+ ("â´" "4") ; 4
+ ("âµ" "5") ; 5
+ ("â¶" "6") ; 6
+ ("â·" "7") ; 7
+ ("â¸" "8") ; 8
+ ("â¹" "9") ; 9
+ ("âº" "+") ; +
+ ("â»" "-") ; -
+ ("â½" "(") ; (
+ ("â¾" ")") ; )
+ ("â¿" "n") ; n
+ ("â±" "i")) ; i
+ "A list whose elements (old new) indicate replacements to make
+ in Calc algebraic input.")
+
+ (defvar math-read-superscripts
+ "â°Â¹Â²Â³â´âµâ¶â·â¸â¹âºâ»â½â¾â¿â±" ; 0123456789+-()ni
+ "A string consisting of the superscripts allowed by Calc.")
+
+ (defun math-read-preprocess-string (str)
+ "Replace some substrings of STR by Calc equivalents."
+ (setq str
+ (replace-regexp-in-string (concat "[" math-read-superscripts "]+")
+ "^(\\&)" str))
+ (let ((rep-list math-read-replacement-list))
+ (while rep-list
+ (setq str
+ (replace-regexp-in-string (nth 0 (car rep-list))
+ (nth 1 (car rep-list)) str))
+ (setq rep-list (cdr rep-list))))
+ str)
+
(defun math-read-expr (math-exp-str)
(let ((math-exp-pos 0)
(math-exp-old-pos 0)
(math-exp-keep-spaces nil)
math-exp-token math-expr-data)
+ (setq math-exp-str (math-read-preprocess-string math-exp-str))
(while (setq math-exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)"
math-exp-str))
(setq math-exp-str (concat (substring math-exp-str 0 math-exp-token)
"\\dots"
(substring math-exp-str (+ math-exp-token 2)))))
- [Emacs-diffs] Changes to emacs/lisp/calc/calc-ext.el, Jay Belanger, 2004/11/09
- [Emacs-diffs] Changes to emacs/lisp/calc/calc-ext.el, Jay Belanger, 2004/11/09
- [Emacs-diffs] Changes to emacs/lisp/calc/calc-ext.el, Jay Belanger, 2004/11/11
- [Emacs-diffs] Changes to emacs/lisp/calc/calc-ext.el, Jay Belanger, 2004/11/11
- [Emacs-diffs] Changes to emacs/lisp/calc/calc-ext.el, Jay Belanger, 2004/11/17
- [Emacs-diffs] Changes to emacs/lisp/calc/calc-ext.el, Jay Belanger, 2004/11/21
- [Emacs-diffs] Changes to emacs/lisp/calc/calc-ext.el,
Jay Belanger <=
- [Emacs-diffs] Changes to emacs/lisp/calc/calc-ext.el, Jay Belanger, 2004/11/26
- [Emacs-diffs] Changes to emacs/lisp/calc/calc-ext.el, Jay Belanger, 2004/11/29
- [Emacs-diffs] Changes to emacs/lisp/calc/calc-ext.el, Jay Belanger, 2004/11/30