• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/calc/

Lines Matching +defs:math +defs:exp +defs:pos

53 	       (alg-exp (mapcar 'math-evaluate-expr entry)))
54 (when (and (= (length alg-exp) 1)
55 (eq (car-safe (car alg-exp)) 'calcFunc-assign)
56 (= (length (car alg-exp)) 3)
57 (eq (car-safe (nth 1 (car alg-exp))) 'var))
58 (set (nth 2 (nth 1 (car alg-exp))) (nth 2 (car alg-exp)))
59 (calc-refresh-evaltos (nth 2 (nth 1 (car alg-exp))))
60 (setq alg-exp (list (nth 2 (car alg-exp)))))
61 (setq calc-quick-prev-results alg-exp
63 (math-format-value x 1000)))
64 alg-exp
67 (if (and (= (length alg-exp) 1)
68 (memq (car-safe (car alg-exp)) '(nil bigpos bigneg))
73 (math-format-value (car alg-exp) 1000))
76 (math-format-value (car alg-exp) 1000))
77 (if (and (integerp (car alg-exp))
78 (> (car alg-exp) 0)
79 (< (car alg-exp) 127))
80 (format ", \"%c\"" (car alg-exp))
85 (let ((long (concat (math-format-value (car entry) 1000)
103 (math-expr-opers math-standard-opers)
165 (math-format-value (calc-top-n str (car args)) 1000)))
181 (setq x (math-read-exprs x))
192 (math-read-exprs str)
203 (math-is-true (car res))
213 (if (math-constp (car res))
215 (math-format-value (car res) 1000)
229 (math-format-value (car res) 1000))
257 (math-expr-opers (if prefix math-standard-opers math-expr-opers)))
269 (alg-exp (calc-do-alg-entry initial prompt t 'calc-alg-entry-history)))
270 (if (stringp alg-exp)
273 (calc-alg-edit alg-exp))
277 (nvals (mapcar 'calc-normalize alg-exp)))
278 (while alg-exp
279 (calc-record (if (featurep 'calc-ext) (car alg-exp) (car nvals))
282 (and (not (equal (car alg-exp)
287 (setq alg-exp (cdr alg-exp)
298 (defvar calc-alg-exp)
303 (calc-alg-exp 'error))
329 (when (eq calc-alg-exp 'error)
330 (when (eq (car-safe (setq calc-alg-exp (math-read-exprs buf))) 'error)
331 (setq calc-alg-exp nil)))
334 (and calc-alg-exp (setq calc-alg-exp (mapcar 'calc-normalize calc-alg-exp))))
335 calc-alg-exp)))
349 (insert (math-format-flat-expr calc-previous-modulo 0))
363 (if (consp calc-alg-exp)
364 (progn (setq prefix-arg (length calc-alg-exp))
382 (setq calc-alg-exp (minibuffer-contents))
390 (exp (and (> (length str) 0)
393 (math-read-exprs str)))))
394 (if (eq (car-safe exp) 'error)
397 (forward-char (nth 1 exp))
400 (concat " [" (or (nth 2 exp) "Error") "]"))
402 (setq calc-alg-exp (if (calc-minibuffer-contains "\\` *\\[ *\\'")
404 exp))
471 (defvar math-read-replacement-list
536 (defvar math-read-superscripts
540 (defvar math-read-subscripts
544 (defun math-read-preprocess-string (str)
547 (replace-regexp-in-string (concat "[" math-read-superscripts "]+")
550 (replace-regexp-in-string (concat "[" math-read-subscripts "]+")
552 (let ((rep-list math-read-replacement-list))
560 ;; The next few variables are local to math-read-exprs (and math-read-expr
563 (defvar math-exp-pos)
564 (defvar math-exp-str)
565 (defvar math-exp-old-pos)
566 (defvar math-exp-token)
567 (defvar math-exp-keep-spaces)
568 (defvar math-expr-data)
570 (defun math-read-exprs (math-exp-str)
571 (let ((math-exp-pos 0)
572 (math-exp-old-pos 0)
573 (math-exp-keep-spaces nil)
574 math-exp-token math-expr-data)
575 (setq math-exp-str (math-read-preprocess-string math-exp-str))
577 (setq math-exp-str (funcall calc-language-input-filter math-exp-str)))
578 (while (setq math-exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)" math-exp-str))
579 (setq math-exp-str (concat (substring math-exp-str 0 math-exp-token) "\\dots"
580 (substring math-exp-str (+ math-exp-token 2)))))
581 (math-build-parse-table)
582 (math-read-token)
583 (let ((val (catch 'syntax (math-read-expr-list))))
585 (list 'error math-exp-old-pos val)
586 (if (equal math-exp-token 'end)
588 (list 'error math-exp-old-pos "Syntax error"))))))
590 (defun math-read-expr-list ()
591 (let* ((math-exp-keep-spaces nil)
592 (val (list (math-read-expr-level 0)))
594 (while (equal math-expr-data ",")
595 (math-read-token)
596 (let ((rest (list (math-read-expr-level 0))))
607 (defvar math-toks nil
608 "Tokens to pass between math-build-parse-table and math-find-user-tokens.")
610 (defun math-build-parse-table ()
616 (math-toks nil))
620 (math-find-user-tokens (car (car p)))
623 (sort (mapcar 'car math-toks)
631 (defun math-find-user-tokens (p)
642 (or (assoc s math-toks)
644 (setq math-toks (cons (list s) math-toks))
650 (math-find-user-tokens (nth 1 (car p)))
652 (math-find-user-tokens (nth 2 (car p))))))
655 (defun math-read-token ()
656 (if (>= math-exp-pos (length math-exp-str))
657 (setq math-exp-old-pos math-exp-pos
658 math-exp-token 'end
659 math-expr-data "\000")
660 (let ((ch (aref math-exp-str math-exp-pos)))
661 (setq math-exp-old-pos math-exp-pos)
663 (setq math-exp-pos (1+ math-exp-pos))
664 (if math-exp-keep-spaces
665 (setq math-exp-token 'space
666 math-expr-data " ")
667 (math-read-token)))
670 (eq (string-match calc-user-tokens math-exp-str math-exp-pos)
671 math-exp-pos)))
672 (setq math-exp-token 'punc
673 math-expr-data (math-match-substring math-exp-str 0)
674 math-exp-pos (match-end 0)))
680 math-exp-str math-exp-pos)
681 (setq math-exp-token 'symbol
682 math-exp-pos (match-end 0)
683 math-expr-data (math-restore-dashes
684 (math-match-substring math-exp-str 0)))
686 (let ((code (assoc math-expr-data math-eqn-ignore-words)))
689 (math-read-token))
691 (math-read-token)
692 (if (assoc math-expr-data (cdr code))
693 (setq math-expr-data (format "%s %s"
694 (car code) math-expr-data))))
696 (setq math-exp-token 'punc
697 math-expr-data (nth 2 code)))
699 (math-read-token)
700 (math-read-token))))))
703 (eq (string-match "\\.[0-9]" math-exp-str math-exp-pos)
704 math-exp-pos))
706 (eq (string-match "_\\.?[0-9]" math-exp-str math-exp-pos)
707 math-exp-pos)
708 (or (eq math-exp-pos 0)
712 math-exp-str (1- math-exp-pos))
713 (1- math-exp-pos))))))
715 (string-match "0[xX][0-9a-fA-F]+" math-exp-str math-exp-pos))
717 math-exp-str math-exp-pos))
718 (setq math-exp-token 'number
719 math-expr-data (math-match-substring math-exp-str 0)
720 math-exp-pos (match-end 0)))
725 math-exp-str math-exp-pos)
726 math-exp-pos))
727 (setq math-exp-token 'number
728 math-expr-data (math-match-substring math-exp-str 1)
729 math-exp-pos (match-end 1))
730 (if (eq (string-match "\\$\\([1-9][0-9]*\\)" math-exp-str math-exp-pos)
731 math-exp-pos)
732 (setq math-expr-data (- (string-to-number (math-match-substring
733 math-exp-str 1))))
734 (string-match "\\$+" math-exp-str math-exp-pos)
735 (setq math-expr-data (- (match-end 0) (match-beginning 0))))
736 (setq math-exp-token 'dollar
737 math-exp-pos (match-end 0))))
739 (if (eq (string-match "#\\([1-9][0-9]*\\)" math-exp-str math-exp-pos)
740 math-exp-pos)
741 (setq math-expr-data (string-to-number
742 (math-match-substring math-exp-str 1))
743 math-exp-pos (match-end 0))
744 (setq math-expr-data 1
745 math-exp-pos (1+ math-exp-pos)))
746 (setq math-exp-token 'hash))
748 math-exp-str math-exp-pos)
749 math-exp-pos)
750 (setq math-exp-token 'punc
751 math-expr-data (math-match-substring math-exp-str 0)
752 math-exp-pos (match-end 0)))
755 math-exp-str math-exp-pos))
758 (setq math-exp-str (copy-sequence math-exp-str))
759 (aset math-exp-str (match-beginning 1) ?\{)
760 (if (< (match-end 1) (length math-exp-str))
761 (aset math-exp-str (match-end 1) ?\}))
762 (math-read-token))
763 (setq math-exp-token 'string
764 math-expr-data (math-match-substring math-exp-str 1)
765 math-exp-pos (match-end 0))))
767 (< math-exp-pos (1- (length math-exp-str))))
769 math-exp-str math-exp-pos)
771 math-exp-str math-exp-pos))
772 (setq math-exp-token 'symbol
773 math-exp-pos (match-end 0)
774 math-expr-data (math-restore-dashes
775 (math-match-substring math-exp-str 1)))
776 (let ((code (assoc math-expr-data math-latex-ignore-words)))
779 (math-read-token))
781 (setq math-exp-token 'punc
782 math-expr-data (nth 2 code)))
784 (string-match " *{" math-exp-str math-exp-pos))
785 (setq math-exp-pos (match-end 0)
786 math-exp-token 'punc
787 math-expr-data "[")
788 (let ((right (string-match "}" math-exp-str math-exp-pos)))
790 (setq math-exp-str (copy-sequence math-exp-str))
791 (aset math-exp-str right ?\])))))))
793 (< math-exp-pos (1- (length math-exp-str))))
795 math-exp-str math-exp-pos)
797 math-exp-str math-exp-pos)
799 math-exp-str math-exp-pos))
800 (setq math-exp-token 'symbol
801 math-exp-pos (match-end 0)
802 math-expr-data (math-restore-dashes
803 (math-match-substring math-exp-str 1)))
804 (let ((code (assoc math-expr-data math-tex-ignore-words))
808 (math-read-token))
810 (setq math-exp-token 'punc
811 math-expr-data (nth 2 code)))
813 (string-match " *{\\([^}]*\\)}" math-exp-str math-exp-pos))
814 (setq math-exp-pos (match-end 0)
815 envname (match-string 1 math-exp-str)
816 math-exp-token 'punc
817 math-expr-data "[")
823 math-exp-str math-exp-pos)
824 (setq math-exp-str
825 (replace-match "]" t t math-exp-str))
828 (string-match " *{" math-exp-str math-exp-pos))
829 (setq math-exp-pos (match-end 0)
830 math-exp-token 'punc
831 math-expr-data "[")
832 (let ((right (string-match "}" math-exp-str math-exp-pos)))
834 (setq math-exp-str (copy-sequence math-exp-str))
835 (aset math-exp-str right ?\])))))))
838 math-exp-str math-exp-pos) math-exp-pos))
839 (setq math-exp-token 'punc
840 math-expr-data (upcase (math-match-substring math-exp-str 0))
841 math-exp-pos (match-end 0)))
842 ((and (eq calc-language 'math)
843 (eq (string-match "\\[\\[\\|->\\|:>" math-exp-str math-exp-pos)
844 math-exp-pos))
845 (setq math-exp-token 'punc
846 math-expr-data (math-match-substring math-exp-str 0)
847 math-exp-pos (match-end 0)))
850 math-exp-str math-exp-pos)
851 math-exp-pos))
852 (setq math-exp-token 'punc
853 math-expr-data (math-match-substring math-exp-str 0)
854 math-exp-pos (match-end 0))
855 (and (eq (string-match "\\\\dots\\." math-exp-str math-exp-pos)
856 math-exp-pos)
857 (setq math-exp-pos (match-end 0)))
858 (if (memq (aref math-expr-data 0) '(?~ ?^))
859 (math-read-token)))
860 ((eq (string-match "%%.*$" math-exp-str math-exp-pos) math-exp-pos)
861 (setq math-exp-pos (match-end 0))
862 (math-read-token))
870 (setq math-exp-token 'punc
871 math-expr-data (char-to-string ch)
872 math-exp-pos (1+ math-exp-pos)))))))
874 (defconst math-alg-inequalities
878 (defun math-read-expr-level (exp-prec &optional exp-term)
879 (let* ((x (math-read-factor)) (first t) op op2)
881 (setq op (calc-check-user-syntax x exp-prec))
884 (and (setq op (assoc math-expr-data math-expr-opers))
887 math-expr-data
888 (cdr (memq op math-expr-opers))))
892 (not (math-factor-after)))
896 (memq math-exp-token '(symbol number dollar hash))
897 (equal math-expr-data "(")
898 (and (equal math-expr-data "[")
899 (not (eq calc-language 'math))
900 (not (and math-exp-keep-spaces
902 (or (not (setq op (assoc math-expr-data math-expr-opers)))
905 (not (eq math-exp-token 'symbol))
912 math-expr-data))))
915 (setq op (assoc "2x" math-expr-opers))))
916 (not (and exp-term (equal math-expr-data exp-term)))
917 (>= (nth 2 op) exp-prec))
919 (math-read-token))
928 (if (eq (nth 2 op) exp-prec)
930 (setq exp-prec 1000)
935 (memq (nth 1 op) math-alg-inequalities)
936 (memq (car-safe x) math-alg-inequalities))
938 (math-composite-inequalities x op))
941 (math-read-expr-level (nth 3 op) exp-term))))
958 (equal math-expr-data
960 (equal math-expr-data (car rule)))))
961 (let ((save-exp-pos math-exp-pos)
962 (save-exp-old-pos math-exp-old-pos)
963 (save-exp-token math-exp-token)
964 (save-exp-data math-expr-data))
978 (setq conds (append (math-flatten-lands
995 (math-normalize
996 (math-multi-subst
1006 (math-multi-subst
1018 (or (math-is-true (math-simplify
1019 (math-multi-subst
1025 (not (setq match (math-multi-subst
1027 (setq math-exp-old-pos save-exp-old-pos
1028 math-exp-token save-exp-token
1029 math-expr-data save-exp-data
1030 math-exp-pos save-exp-pos)))))))
1036 (save-exp-pos math-exp-pos)
1037 (save-exp-old-pos math-exp-old-pos)
1038 (save-exp-token math-exp-token)
1039 (save-exp-data math-expr-data)
1043 (and (equal math-expr-data (car p))
1045 (math-read-token)
1049 (math-read-expr-level
1067 (eq math-exp-token 'end)))
1075 (setq opos math-exp-pos
1080 (> math-exp-pos opos))
1087 (setq math-exp-pos save-exp-pos
1088 math-exp-old-pos save-exp-old-pos
1089 math-exp-token save-exp-token
1090 math-expr-data save-exp-data
1094 (defun math-remove-dashes (x)
1096 (math-remove-dashes
1097 (concat (math-match-substring x 1) "#" (math-match-substring x 2)))
1100 (defun math-restore-dashes (x)
1102 (math-restore-dashes
1103 (concat (math-match-substring x 1) "-" (math-match-substring x 2)))
1106 (defun math-read-if (cond op)
1107 (let ((then (math-read-expr-level 0)))
1108 (or (equal math-expr-data ":")
1110 (math-read-token)
1111 (list 'calcFunc-if cond then (math-read-expr-level (nth 3 op)))))
1113 (defun math-factor-after ()
1114 (let ((math-exp-pos math-exp-pos)
1115 math-exp-old-pos math-exp-token math-expr-data)
1116 (math-read-token)
1117 (or (memq math-exp-token '(number symbol dollar hash string))
1118 (and (assoc math-expr-data '(("-") ("+") ("!") ("|") ("/")))
1119 (assoc (concat "u" math-expr-data) math-expr-opers))
1120 (eq (nth 2 (assoc math-expr-data math-expr-opers)) -1)
1121 (assoc math-expr-data '(("(") ("[") ("{"))))))
1123 (defun math-read-factor ()
1125 (cond ((eq math-exp-token 'number)
1126 (let ((num (math-read-number math-expr-data)))
1129 (setq math-exp-old-pos math-exp-pos)
1131 (math-read-token)
1132 (if (and math-read-expr-quotes
1139 ((or (equal math-expr-data "-")
1140 (equal math-expr-data "+")
1141 (equal math-expr-data "!")
1142 (equal math-expr-data "|")
1143 (equal math-expr-data "/"))
1144 (setq math-expr-data (concat "u" math-expr-data))
1145 (math-read-factor))
1146 ((and (setq op (assoc math-expr-data math-expr-opers))
1150 (math-read-token)
1151 (let ((val (math-read-expr-level (nth 3 op))))
1156 (math-neg val))
1158 ((eq math-exp-token 'symbol)
1159 (let ((sym (intern math-expr-data)))
1160 (math-read-token)
1161 (if (equal math-expr-data calc-function-open)
1162 (let ((f (assq sym math-expr-function-mapping)))
1163 (math-read-token)
1166 (let ((args (if (or (equal math-expr-data calc-function-close)
1167 (eq math-exp-token 'end))
1169 (math-read-expr-list))))
1170 (if (not (or (equal math-expr-data calc-function-close)
1171 (eq math-exp-token 'end)))
1173 (math-read-token)
1177 (math-known-matrixp
1182 (math-parse-fortran-subscr sym args)
1195 (if math-read-expr-quotes
1198 (intern (math-remove-dashes
1204 (let ((v (assq (nth 1 val) math-expr-variable-mapping)))
1213 (equal math-expr-data "["))
1214 (math-read-token)
1216 (math-read-expr-list)))
1217 (if (equal math-expr-data "]")
1218 (math-read-token)
1221 ((eq math-exp-token 'dollar)
1222 (let ((abs (if (> math-expr-data 0) math-expr-data (- math-expr-data))))
1224 (let ((num math-expr-data))
1225 (math-read-token)
1227 (math-check-complete (nth (1- abs) calc-dollar-values)))
1231 ((eq math-exp-token 'hash)
1235 (if (<= math-expr-data (length calc-arg-values))
1236 (let ((num math-expr-data))
1237 (math-read-token)
1241 ((equal math-expr-data "(")
1242 (let* ((exp (let ((math-exp-keep-spaces nil))
1243 (math-read-token)
1244 (if (or (equal math-expr-data "\\dots")
1245 (equal math-expr-data "\\ldots"))
1247 (math-read-expr-level 0)))))
1248 (let ((math-exp-keep-spaces nil))
1250 ((equal math-expr-data ",")
1252 (math-read-token)
1253 (let ((exp2 (math-read-expr-level 0)))
1254 (setq exp
1255 (if (and exp2 (Math-realp exp) (Math-realp exp2))
1256 (math-normalize (list 'cplx exp exp2))
1257 (list '+ exp (list '* exp2 '(var i var-i))))))))
1258 ((equal math-expr-data ";")
1260 (math-read-token)
1261 (let ((exp2 (math-read-expr-level 0)))
1262 (setq exp (if (and exp2 (Math-realp exp)
1264 (math-normalize (list 'polar exp exp2))
1266 (list '* exp
1267 (list 'calcFunc-exp
1269 (math-to-radians-2 exp2)
1271 ((or (equal math-expr-data "\\dots")
1272 (equal math-expr-data "\\ldots"))
1274 (math-read-token)
1275 (let ((exp2 (if (or (equal math-expr-data ")")
1276 (equal math-expr-data "]")
1277 (eq math-exp-token 'end))
1279 (math-read-expr-level 0))))
1280 (setq exp
1282 (if (equal math-expr-data ")") 0 1)
1283 exp
1285 (if (not (or (equal math-expr-data ")")
1286 (and (equal math-expr-data "]") (eq (car-safe exp) 'intv))
1287 (eq math-exp-token 'end)))
1289 (math-read-token)
1290 exp))
1291 ((eq math-exp-token 'string)
1293 (math-read-string))
1294 ((equal math-expr-data "[")
1296 (math-read-brackets t "]"))
1297 ((equal math-expr-data "{")
1299 (math-read-brackets nil "}"))
1300 ((equal math-expr-data "<")
1302 (math-read-angle-brackets))