Mercurial > emacs
comparison lisp/calc/calc-ext.el @ 58410:8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
math-read-big-lines.
(math-read-big-expr): Replace variables the-baseline, the-h2
and err-msg by math-read-big-baseline, math-read-big-h2 and
math-read-err-msg.
(math-read-big-bigp): Replace variable h2 with math-rb-h2.
author | Jay Belanger <jay.p.belanger@gmail.com> |
---|---|
date | Mon, 22 Nov 2004 04:52:48 +0000 |
parents | 4a12728aef72 |
children | 09310c09d91e |
comparison
equal
deleted
inserted
replaced
58409:924fa48ab4bf | 58410:8d1aac87d0f4 |
---|---|
2941 (calc-language-option nil) | 2941 (calc-language-option nil) |
2942 (math-expr-opers (get 'tex 'math-oper-table)) | 2942 (math-expr-opers (get 'tex 'math-oper-table)) |
2943 (math-expr-function-mapping (get 'tex 'math-function-table)) | 2943 (math-expr-function-mapping (get 'tex 'math-function-table)) |
2944 (math-expr-variable-mapping (get 'tex 'math-variable-table))) | 2944 (math-expr-variable-mapping (get 'tex 'math-variable-table))) |
2945 (math-read-expr str))) | 2945 (math-read-expr str))) |
2946 (let ((lines nil) | 2946 (let ((math-read-big-lines nil) |
2947 (pos 0) | 2947 (pos 0) |
2948 (width 0) | 2948 (width 0) |
2949 (err-msg nil) | 2949 (math-read-big-err-msg nil) |
2950 the-baseline the-h2 | 2950 math-read-big-baseline math-read-big-h2 |
2951 new-pos p) | 2951 new-pos p) |
2952 (while (setq new-pos (string-match "\n" str pos)) | 2952 (while (setq new-pos (string-match "\n" str pos)) |
2953 (setq lines (cons (substring str pos new-pos) lines) | 2953 (setq math-read-big-lines |
2954 (cons (substring str pos new-pos) math-read-big-lines) | |
2954 pos (1+ new-pos))) | 2955 pos (1+ new-pos))) |
2955 (setq lines (nreverse (cons (substring str pos) lines)) | 2956 (setq math-read-big-lines |
2956 p lines) | 2957 (nreverse (cons (substring str pos) math-read-big-lines)) |
2958 p math-read-big-lines) | |
2957 (while p | 2959 (while p |
2958 (setq width (max width (length (car p))) | 2960 (setq width (max width (length (car p))) |
2959 p (cdr p))) | 2961 p (cdr p))) |
2960 (if (math-read-big-bigp lines) | 2962 (if (math-read-big-bigp math-read-big-lines) |
2961 (or (catch 'syntax | 2963 (or (catch 'syntax |
2962 (math-read-big-rec 0 0 width (length lines))) | 2964 (math-read-big-rec 0 0 width (length math-read-big-lines))) |
2963 err-msg | 2965 math-read-big-err-msg |
2964 '(error 0 "Syntax error")) | 2966 '(error 0 "Syntax error")) |
2965 (math-read-expr str))))) | 2967 (math-read-expr str))))) |
2966 | 2968 |
2967 (defun math-read-big-bigp (lines) | 2969 (defun math-read-big-bigp (math-read-big-lines) |
2968 (and (cdr lines) | 2970 (and (cdr math-read-big-lines) |
2969 (let ((matrix nil) | 2971 (let ((matrix nil) |
2970 (v 0) | 2972 (v 0) |
2971 (height (if (> (length (car lines)) 0) 1 0))) | 2973 (height (if (> (length (car math-read-big-lines)) 0) 1 0))) |
2972 (while (and (cdr lines) | 2974 (while (and (cdr math-read-big-lines) |
2973 (let* ((i 0) | 2975 (let* ((i 0) |
2974 j | 2976 j |
2975 (l1 (car lines)) | 2977 (l1 (car math-read-big-lines)) |
2976 (l2 (nth 1 lines)) | 2978 (l2 (nth 1 math-read-big-lines)) |
2977 (len (min (length l1) (length l2)))) | 2979 (len (min (length l1) (length l2)))) |
2978 (if (> (length l2) 0) | 2980 (if (> (length l2) 0) |
2979 (setq height (1+ height))) | 2981 (setq height (1+ height))) |
2980 (while (and (< i len) | 2982 (while (and (< i len) |
2981 (or (memq (aref l1 i) '(?\ ?\- ?\_)) | 2983 (or (memq (aref l1 i) '(?\ ?\- ?\_)) |
2982 (memq (aref l2 i) '(?\ ?\-)) | 2984 (memq (aref l2 i) '(?\ ?\-)) |
2983 (and (memq (aref l1 i) '(?\| ?\,)) | 2985 (and (memq (aref l1 i) '(?\| ?\,)) |
2984 (= (aref l2 i) (aref l1 i))) | 2986 (= (aref l2 i) (aref l1 i))) |
2985 (and (eq (aref l1 i) ?\[) | 2987 (and (eq (aref l1 i) ?\[) |
2986 (eq (aref l2 i) ?\[) | 2988 (eq (aref l2 i) ?\[) |
2987 (let ((h2 (length l1))) | 2989 (let ((math-rb-h2 (length l1))) |
2988 (setq j (math-read-big-balance | 2990 (setq j (math-read-big-balance |
2989 (1+ i) v "["))) | 2991 (1+ i) v "["))) |
2990 (setq i (1- j))))) | 2992 (setq i (1- j))))) |
2991 (setq i (1+ i))) | 2993 (setq i (1+ i))) |
2992 (or (= i len) | 2994 (or (= i len) |
2993 (and (eq (aref l1 i) ?\[) | 2995 (and (eq (aref l1 i) ?\[) |
2994 (eq (aref l2 i) ?\[) | 2996 (eq (aref l2 i) ?\[) |
2995 (setq matrix t) | 2997 (setq matrix t) |
2996 nil)))) | 2998 nil)))) |
2997 (setq lines (cdr lines) | 2999 (setq math-read-big-lines (cdr math-read-big-lines) |
2998 v (1+ v))) | 3000 v (1+ v))) |
2999 (or (and (> height 1) | 3001 (or (and (> height 1) |
3000 (not (cdr lines))) | 3002 (not (cdr math-read-big-lines))) |
3001 matrix)))) | 3003 matrix)))) |
3002 | 3004 |
3003 ;;; Nontrivial "flat" formatting. | 3005 ;;; Nontrivial "flat" formatting. |
3004 | 3006 |
3005 (defvar math-format-hash-args nil) | 3007 (defvar math-format-hash-args nil) |