emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/calc/calc-aent.el [emacs-unicode-2]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/calc/calc-aent.el [emacs-unicode-2]
Date: Wed, 08 Dec 2004 01:55:38 -0500

Index: emacs/lisp/calc/calc-aent.el
diff -c emacs/lisp/calc/calc-aent.el:1.8.4.3 
emacs/lisp/calc/calc-aent.el:1.8.4.4
*** emacs/lisp/calc/calc-aent.el:1.8.4.3        Fri Nov 12 02:53:01 2004
--- emacs/lisp/calc/calc-aent.el        Wed Dec  8 05:02:18 2004
***************
*** 3,10 ****
  ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
  
  ;; Author: Dave Gillespie <address@hidden>
! ;; Maintainers: D. Goel <address@hidden>
! ;;              Colin Walters <address@hidden>
  
  ;; This file is part of GNU Emacs.
  
--- 3,9 ----
  ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
  
  ;; Author: Dave Gillespie <address@hidden>
! ;; Maintainer: Jay Belanger <address@hidden>
  
  ;; This file is part of GNU Emacs.
  
***************
*** 28,40 ****
  ;;; Code:
  
  ;; This file is autoloaded from calc.el.
- (require 'calc)
  
  (require 'calc-macs)
- (eval-when-compile '(require calc-macs))
- 
- (defun calc-Need-calc-aent () nil)
- 
  
  (defun calc-do-quick-calc ()
    (calc-check-defines)
--- 27,35 ----
  ;;; Code:
  
  ;; This file is autoloaded from calc.el.
  
+ (require 'calc)
  (require 'calc-macs)
  
  (defun calc-do-quick-calc ()
    (calc-check-defines)
***************
*** 52,71 ****
               (entry (calc-do-alg-entry "" "Quick calc: " t))
               (alg-exp (mapcar (function
                                 (lambda (x)
!                                  (if (and (not calc-extensions-loaded)
                                            calc-previous-alg-entry
                                            (string-match
                                             "\\`[-0-9._+*/^() ]+\\'"
                                             calc-previous-alg-entry))
                                       (calc-normalize x)
!                                    (calc-extensions)
                                     (math-evaluate-expr x))))
                                entry)))
          (when (and (= (length alg-exp) 1)
                     (eq (car-safe (car alg-exp)) 'calcFunc-assign)
                     (= (length (car alg-exp)) 3)
                     (eq (car-safe (nth 1 (car alg-exp))) 'var))
!           (calc-extensions)
            (set (nth 2 (nth 1 (car alg-exp))) (nth 2 (car alg-exp)))
            (calc-refresh-evaltos (nth 2 (nth 1 (car alg-exp))))
            (setq alg-exp (list (nth 2 (car alg-exp)))))
--- 47,66 ----
               (entry (calc-do-alg-entry "" "Quick calc: " t))
               (alg-exp (mapcar (function
                                 (lambda (x)
!                                  (if (and (not (featurep 'calc-ext))
                                            calc-previous-alg-entry
                                            (string-match
                                             "\\`[-0-9._+*/^() ]+\\'"
                                             calc-previous-alg-entry))
                                       (calc-normalize x)
!                                    (require 'calc-ext)
                                     (math-evaluate-expr x))))
                                entry)))
          (when (and (= (length alg-exp) 1)
                     (eq (car-safe (car alg-exp)) 'calcFunc-assign)
                     (= (length (car alg-exp)) 3)
                     (eq (car-safe (nth 1 (car alg-exp))) 'var))
!           (require 'calc-ext)
            (set (nth 2 (nth 1 (car alg-exp))) (nth 2 (car alg-exp)))
            (calc-refresh-evaltos (nth 2 (nth 1 (car alg-exp))))
            (setq alg-exp (list (nth 2 (car alg-exp)))))
***************
*** 92,98 ****
                                  "")
                                ")")))
          (if (and (< (length buf) (frame-width)) (= (length entry) 1)
!                  calc-extensions-loaded)
              (let ((long (concat (math-format-value (car entry) 1000)
                                  " =>  " buf)))
                (if (<= (length long) (- (frame-width) 8))
--- 87,93 ----
                                  "")
                                ")")))
          (if (and (< (length buf) (frame-width)) (= (length entry) 1)
!                  (featurep 'calc-ext))
              (let ((long (concat (math-format-value (car entry) 1000)
                                  " =>  " buf)))
                (if (<= (length long) (- (frame-width) 8))
***************
*** 148,154 ****
         ((eq separator 'eval)
        (eval str))
         ((eq separator 'macro)
!       (calc-extensions)
        (let* ((calc-buffer (current-buffer))
               (calc-window (get-buffer-window calc-buffer))
               (save-window (selected-window)))
--- 143,149 ----
         ((eq separator 'eval)
        (eval str))
         ((eq separator 'macro)
!       (require 'calc-ext)
        (let* ((calc-buffer (current-buffer))
               (calc-window (get-buffer-window calc-buffer))
               (save-window (selected-window)))
***************
*** 209,215 ****
            (and (memq 'clear-message calc-command-flags)
                 (message ""))
            (cond ((eq separator 'pred)
!                  (calc-extensions)
                   (if (= (length res) 1)
                       (math-is-true (car res))
                     (calc-eval-error '(0 "Single value expected"))))
--- 204,210 ----
            (and (memq 'clear-message calc-command-flags)
                 (message ""))
            (cond ((eq separator 'pred)
!                  (require 'calc-ext)
                   (if (= (length res) 1)
                       (math-is-true (car res))
                     (calc-eval-error '(0 "Single value expected"))))
***************
*** 241,249 ****
                             res (cdr res)))
                     buf)))))))))
  
  (defun calc-eval-error (msg)
!   (if (and (boundp 'calc-eval-error)
!          calc-eval-error)
        (if (eq calc-eval-error 'string)
          (nth 1 msg)
        (error "%s" (nth 1 msg)))
--- 236,249 ----
                             res (cdr res)))
                     buf)))))))))
  
+ (defvar calc-eval-error nil
+   "Determines how calc handles errors.
+ NIL means return a list containing the character position of error.
+ STRING means return error message as string rather than list.
+ T means abort and give an error message.")
+ 
  (defun calc-eval-error (msg)
!   (if calc-eval-error
        (if (eq calc-eval-error 'string)
          (nth 1 msg)
        (error "%s" (nth 1 msg)))
***************
*** 272,290 ****
         (alg-exp (calc-do-alg-entry initial prompt t)))
      (if (stringp alg-exp)
        (progn
!         (calc-extensions)
          (calc-alg-edit alg-exp))
        (let* ((calc-simplify-mode (if (eq last-command-char ?\C-j)
                                     'none
                                   calc-simplify-mode))
             (nvals (mapcar 'calc-normalize alg-exp)))
        (while alg-exp
!         (calc-record (if calc-extensions-loaded (car alg-exp) (car nvals))
                       "alg'")
          (calc-pop-push-record-list calc-dollar-used
                                     (and (not (equal (car alg-exp)
                                                      (car nvals)))
!                                         calc-extensions-loaded
                                          "")
                                     (list (car nvals)))
          (setq alg-exp (cdr alg-exp)
--- 272,290 ----
         (alg-exp (calc-do-alg-entry initial prompt t)))
      (if (stringp alg-exp)
        (progn
!         (require 'calc-ext)
          (calc-alg-edit alg-exp))
        (let* ((calc-simplify-mode (if (eq last-command-char ?\C-j)
                                     'none
                                   calc-simplify-mode))
             (nvals (mapcar 'calc-normalize alg-exp)))
        (while alg-exp
!         (calc-record (if (featurep 'calc-ext) (car alg-exp) (car nvals))
                       "alg'")
          (calc-pop-push-record-list calc-dollar-used
                                     (and (not (equal (car alg-exp)
                                                      (car nvals)))
!                                         (featurep 'calc-ext)
                                          "")
                                     (list (car nvals)))
          (setq alg-exp (cdr alg-exp)
***************
*** 386,391 ****
--- 386,393 ----
      (and (> (length calc-alg-exp) 0) (setq calc-previous-alg-entry 
calc-alg-exp))
      (exit-minibuffer)))
  
+ (defvar calc-buffer)
+ 
  (defun calcAlg-enter ()
    (interactive)
    (let* ((str (minibuffer-contents))
***************
*** 443,448 ****
--- 445,454 ----
         ((eq last-command-char ?@) "0@ ")
         (t (char-to-string last-command-char)))))
  
+ ;; The variable calc-digit-value is initially declared in calc.el,
+ ;; but can be set by calcDigit-algebraic and calcDigit-edit.
+ (defvar calc-digit-value)
+ 
  (defun calcDigit-algebraic ()
    (interactive)
    (if (calc-minibuffer-contains "address@hidden *[^'m ]+[^'m]*\\'")
***************
*** 459,478 ****
  
  ;;; Algebraic expression parsing.   [Public]
  
! ;;; The next few variables are local to math-read-exprs (and math-read-expr)
! ;;; but are set in functions they call.
  
  (defvar math-exp-pos)
  (defvar math-exp-str)
  (defvar math-exp-old-pos)
  (defvar math-exp-token)
  (defvar math-exp-keep-spaces)
  
  (defun math-read-exprs (math-exp-str)
    (let ((math-exp-pos 0)
        (math-exp-old-pos 0)
        (math-exp-keep-spaces nil)
        math-exp-token math-expr-data)
      (if calc-language-input-filter
        (setq math-exp-str (funcall calc-language-input-filter math-exp-str)))
      (while (setq math-exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)" 
math-exp-str))
--- 465,486 ----
  
  ;;; Algebraic expression parsing.   [Public]
  
! ;; The next few variables are local to math-read-exprs (and math-read-expr
! ;; in calc-ext.el), but are set in functions they call.
  
  (defvar math-exp-pos)
  (defvar math-exp-str)
  (defvar math-exp-old-pos)
  (defvar math-exp-token)
  (defvar math-exp-keep-spaces)
+ (defvar math-expr-data)
  
  (defun math-read-exprs (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))
      (if calc-language-input-filter
        (setq math-exp-str (funcall calc-language-input-filter math-exp-str)))
      (while (setq math-exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)" 
math-exp-str))
***************
*** 727,732 ****
--- 735,743 ----
                   math-expr-data (char-to-string ch)
                   math-exp-pos (1+ math-exp-pos)))))))
  
+ (defconst math-alg-inequalities
+   '(calcFunc-lt calcFunc-gt calcFunc-leq calcFunc-geq
+               calcFunc-eq calcFunc-neq))
  
  (defun math-read-expr-level (exp-prec &optional exp-term)
    (let* ((x (math-read-factor)) (first t) op op2)
***************
*** 771,777 ****
        (if (not (equal (car op) "2x"))
          (math-read-token))
        (and (memq (nth 1 op) '(sdev mod))
!          (calc-extensions))
        (setq x (cond ((consp (nth 1 op))
                     (funcall (car (nth 1 op)) x op))
                    ((eq (nth 3 op) -1)
--- 782,788 ----
        (if (not (equal (car op) "2x"))
          (math-read-token))
        (and (memq (nth 1 op) '(sdev mod))
!          (require 'calc-ext))
        (setq x (cond ((consp (nth 1 op))
                     (funcall (car (nth 1 op)) x op))
                    ((eq (nth 3 op) -1)
***************
*** 787,793 ****
                    ((and (not first)
                          (memq (nth 1 op) math-alg-inequalities)
                          (memq (car-safe x) math-alg-inequalities))
!                    (calc-extensions)
                     (math-composite-inequalities x op))
                    (t (list (nth 1 op)
                             x
--- 798,804 ----
                    ((and (not first)
                          (memq (nth 1 op) math-alg-inequalities)
                          (memq (car-safe x) math-alg-inequalities))
!                    (require 'calc-ext)
                     (math-composite-inequalities x op))
                    (t (list (nth 1 op)
                             x
***************
*** 815,821 ****
                      (or (not (listp
                                (setq matches (calc-match-user-syntax rule))))
                          (let ((args (progn
!                                       (calc-extensions)
                                        calc-arg-values))
                                (conds nil)
                                temp)
--- 826,832 ----
                      (or (not (listp
                                (setq matches (calc-match-user-syntax rule))))
                          (let ((args (progn
!                                       (require 'calc-ext)
                                        calc-arg-values))
                                (conds nil)
                                temp)
***************
*** 830,836 ****
                                                  conds)
                                    match (nth 1 match)))
                            (while (and conds match)
!                             (calc-extensions)
                              (cond ((eq (car-safe (car conds))
                                         'calcFunc-let)
                                     (setq temp (car conds))
--- 841,847 ----
                                                  conds)
                                    match (nth 1 match)))
                            (while (and conds match)
!                             (require 'calc-ext)
                              (cond ((eq (car-safe (car conds))
                                         'calcFunc-let)
                                     (setq temp (car conds))
***************
*** 941,950 ****
              matches "Failed"))
      matches))
  
- (defconst math-alg-inequalities
-   '(calcFunc-lt calcFunc-gt calcFunc-leq calcFunc-geq
-               calcFunc-eq calcFunc-neq))
- 
  (defun math-remove-dashes (x)
    (if (string-match "\\`\\(.*\\)-\\(.*\\)\\'" x)
        (math-remove-dashes
--- 952,957 ----
***************
*** 1026,1032 ****
                           (throw 'syntax "Expected `)'"))
                       (math-read-token)
                       (if (and (eq calc-language 'fortran) args
!                               (calc-extensions)
                                (let ((calc-matrix-mode 'scalar))
                                  (math-known-matrixp
                                   (list 'var sym
--- 1033,1039 ----
                           (throw 'syntax "Expected `)'"))
                       (math-read-token)
                       (if (and (eq calc-language 'fortran) args
!                               (require 'calc-ext)
                                (let ((calc-matrix-mode 'scalar))
                                  (math-known-matrixp
                                   (list 'var sym
***************
*** 1085,1091 ****
          ((eq math-exp-token 'hash)
           (or calc-hashes-used
               (throw 'syntax "#'s not allowed in this context"))
!          (calc-extensions)
           (if (<= math-expr-data (length calc-arg-values))
               (let ((num math-expr-data))
                 (math-read-token)
--- 1092,1098 ----
          ((eq math-exp-token 'hash)
           (or calc-hashes-used
               (throw 'syntax "#'s not allowed in this context"))
!          (require 'calc-ext)
           (if (<= math-expr-data (length calc-arg-values))
               (let ((num math-expr-data))
                 (math-read-token)
***************
*** 1116,1122 ****
                     (setq exp (if (and exp2 (Math-realp exp)
                                        (Math-anglep exp2))
                                   (math-normalize (list 'polar exp exp2))
!                                (calc-extensions)
                                 (list '* exp
                                       (list 'calcFunc-exp
                                             (list '*
--- 1123,1129 ----
                     (setq exp (if (and exp2 (Math-realp exp)
                                        (Math-anglep exp2))
                                   (math-normalize (list 'polar exp exp2))
!                                (require 'calc-ext)
                                 (list '* exp
                                       (list 'calcFunc-exp
                                             (list '*
***************
*** 1143,1160 ****
             (math-read-token)
             exp))
          ((eq math-exp-token 'string)
!          (calc-extensions)
           (math-read-string))
          ((equal math-expr-data "[")
!          (calc-extensions)
           (math-read-brackets t "]"))
          ((equal math-expr-data "{")
!          (calc-extensions)
           (math-read-brackets nil "}"))
          ((equal math-expr-data "<")
!          (calc-extensions)
           (math-read-angle-brackets))
          (t (throw 'syntax "Expected a number")))))
  
  ;;; arch-tag: 5599e45d-e51e-44bb-9a20-9f4ed8c96c32
  ;;; calc-aent.el ends here
--- 1150,1169 ----
             (math-read-token)
             exp))
          ((eq math-exp-token 'string)
!          (require 'calc-ext)
           (math-read-string))
          ((equal math-expr-data "[")
!          (require 'calc-ext)
           (math-read-brackets t "]"))
          ((equal math-expr-data "{")
!          (require 'calc-ext)
           (math-read-brackets nil "}"))
          ((equal math-expr-data "<")
!          (require 'calc-ext)
           (math-read-angle-brackets))
          (t (throw 'syntax "Expected a number")))))
  
+ (provide 'calc-aent)
+ 
  ;;; arch-tag: 5599e45d-e51e-44bb-9a20-9f4ed8c96c32
  ;;; calc-aent.el ends here




reply via email to

[Prev in Thread] Current Thread [Next in Thread]