/[emacs]/emacs/lisp/calc/calc-rewr.el
ViewVC logotype

Diff of /emacs/lisp/calc/calc-rewr.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by walters, Wed Nov 14 09:06:50 2001 UTC revision 1.3 by walters, Mon Nov 19 07:37:35 2001 UTC
# Line 1  Line 1 
1  ;; Calculator for GNU Emacs, part II [calc-rewr.el]  ;;; calc-rewr.el --- rewriting functions for Calc
2    
3  ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.  ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
4  ;; Written by Dave Gillespie, daveg@synaptics.com.  
5    ;; Author: David Gillespie <daveg@synaptics.com>
6    ;; Maintainer: Colin Walters <walters@debian.org>
7    
8  ;; This file is part of GNU Emacs.  ;; This file is part of GNU Emacs.
9    
# Line 19  Line 22 
22  ;; file named COPYING.  Among other things, the copyright notice  ;; file named COPYING.  Among other things, the copyright notice
23  ;; and this notice must be preserved on all copies.  ;; and this notice must be preserved on all copies.
24    
25    ;;; Commentary:
26    
27    ;;; Code:
28    
29  ;; This file is autoloaded from calc-ext.el.  ;; This file is autoloaded from calc-ext.el.
30  (require 'calc-ext)  (require 'calc-ext)
# Line 29  Line 34 
34  (defun calc-Need-calc-rewr () nil)  (defun calc-Need-calc-rewr () nil)
35    
36    
37    (defvar math-rewrite-default-iters 100)
38  (defun calc-rewrite-selection (rules-str &optional many prefix)  (defun calc-rewrite-selection (rules-str &optional many prefix)
39    (interactive "sRewrite rule(s): \np")    (interactive "sRewrite rule(s): \np")
40    (calc-slow-wrapper    (calc-slow-wrapper
# Line 43  Line 49 
49            (math-rewrite-default-iters 1))            (math-rewrite-default-iters 1))
50       (if (or (null rules-str) (equal rules-str "") (equal rules-str "$"))       (if (or (null rules-str) (equal rules-str "") (equal rules-str "$"))
51           (if (= num 1)           (if (= num 1)
52               (error "Can't use same stack entry for formula and rules.")               (error "Can't use same stack entry for formula and rules")
53             (setq rules (calc-top-n 1 t)             (setq rules (calc-top-n 1 t)
54                   pop-rules t))                   pop-rules t))
55         (setq rules (if (stringp rules-str)         (setq rules (if (stringp rules-str)
# Line 203  Line 209 
209                      (if (= mmt-many 0) " (reached iteration limit)" "")                      (if (= mmt-many 0) " (reached iteration limit)" "")
210                      ":\n" fmt "\n"))))                      ":\n" fmt "\n"))))
211      whole-expr))      whole-expr))
 (setq math-rewrite-default-iters 100)  
212    
213  (defun math-rewrite-phase (sched)  (defun math-rewrite-phase (sched)
214    (while (and sched (/= mmt-many 0))    (while (and sched (/= mmt-many 0))
# Line 479  Line 484 
484                                             (if (eq (car-safe pats) 'vec)                                             (if (eq (car-safe pats) 'vec)
485                                                 (cdr pats)                                                 (cdr pats)
486                                               (list pats)))))))))                                               (list pats)))))))))
 (setq math-rewrite-whole nil)  
 (setq math-make-import-list nil)  
487    
488    (defvar math-rewrite-whole nil)
489    (defvar math-make-import-list nil)
490  (defun math-compile-rewrites (rules &optional name)  (defun math-compile-rewrites (rules &optional name)
491    (if (eq (car-safe rules) 'var)    (if (eq (car-safe rules) 'var)
492        (let ((prop (get (nth 2 rules) 'math-rewrite-cache))        (let ((prop (get (nth 2 rules) 'math-rewrite-cache))
# Line 805  Line 810 
810               (cons (car expr)               (cons (car expr)
811                     (mapcar 'math-rwcomp-subst-rec (cdr expr)))))))                     (mapcar 'math-rwcomp-subst-rec (cdr expr)))))))
812    
813  (setq math-rwcomp-tracing nil)  (defvar math-rwcomp-tracing nil)
814    
815  (defun math-rwcomp-trace (instr)  (defun math-rwcomp-trace (instr)
816    (if math-rwcomp-tracing (progn (terpri) (princ instr)))    (when math-rwcomp-tracing
817        (terpri) (princ instr))
818    instr)    instr)
819    
820  (defun math-rwcomp-instr (&rest instr)  (defun math-rwcomp-instr (&rest instr)

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26