1 |
;; Calculator for GNU Emacs, part II [calc-comp.el] |
;; Calculator for GNU Emacs, part II [calc-comp.el] |
2 |
;; Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc. |
;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc. |
3 |
;; Written by Dave Gillespie, daveg@synaptics.com. |
;; Written by Dave Gillespie, daveg@synaptics.com. |
4 |
|
|
5 |
;; This file is part of GNU Emacs. |
;; This file is part of GNU Emacs. |
878 |
(if (eq calc-language 'eqn) |
(if (eq calc-language 'eqn) |
879 |
" , " ", ") |
" , " ", ") |
880 |
0) |
0) |
881 |
right)))))))) |
right))))))))) |
|
) |
|
882 |
|
|
883 |
(defconst math-eqn-special-funcs |
(defconst math-eqn-special-funcs |
884 |
'( calcFunc-log |
'( calcFunc-log |
893 |
(defun math-prod-first-term (x) |
(defun math-prod-first-term (x) |
894 |
(while (eq (car-safe x) '*) |
(while (eq (car-safe x) '*) |
895 |
(setq x (nth 1 x))) |
(setq x (nth 1 x))) |
896 |
x |
x) |
|
) |
|
897 |
|
|
898 |
(defun math-prod-last-term (x) |
(defun math-prod-last-term (x) |
899 |
(while (eq (car-safe x) '*) |
(while (eq (car-safe x) '*) |
900 |
(setq x (nth 2 x))) |
(setq x (nth 2 x))) |
901 |
x |
x) |
|
) |
|
902 |
|
|
903 |
(defun math-compose-vector (a sep prec) |
(defun math-compose-vector (a sep prec) |
904 |
(if a |
(if a |
915 |
(cons (list 'break math-compose-level) |
(cons (list 'break math-compose-level) |
916 |
(cons sep c))))) |
(cons sep c))))) |
917 |
(nreverse c)))) |
(nreverse c)))) |
918 |
"") |
"")) |
|
) |
|
919 |
|
|
920 |
(defun math-vector-no-parens (a) |
(defun math-vector-no-parens (a) |
921 |
(or (cdr (cdr a)) |
(or (cdr (cdr a)) |
922 |
(not (eq (car-safe (nth 1 a)) '*))) |
(not (eq (car-safe (nth 1 a)) '*)))) |
|
) |
|
923 |
|
|
924 |
(defun math-compose-matrix (a col cols base) |
(defun math-compose-matrix (a col cols base) |
925 |
(let ((col 0) |
(let ((col 0) |
938 |
(concat comma-spc " "))))) |
(concat comma-spc " "))))) |
939 |
a))) |
a))) |
940 |
res))) |
res))) |
941 |
(nreverse res)) |
(nreverse res))) |
|
) |
|
942 |
|
|
943 |
(defun math-compose-rows (a count first) |
(defun math-compose-rows (a count first) |
944 |
(if (cdr a) |
(if (cdr a) |
956 |
(list (list 'horiz |
(list (list 'horiz |
957 |
(if first (concat left-bracket " ") " ") |
(if first (concat left-bracket " ") " ") |
958 |
(math-compose-expr (car a) vector-prec) |
(math-compose-expr (car a) vector-prec) |
959 |
(concat " " right-bracket)))) |
(concat " " right-bracket))))) |
|
) |
|
960 |
|
|
961 |
(defun math-compose-tex-matrix (a) |
(defun math-compose-tex-matrix (a) |
962 |
(if (cdr a) |
(if (cdr a) |
963 |
(cons (math-compose-vector (cdr (car a)) " & " 0) |
(cons (math-compose-vector (cdr (car a)) " & " 0) |
964 |
(cons " \\\\ " |
(cons " \\\\ " |
965 |
(math-compose-tex-matrix (cdr a)))) |
(math-compose-tex-matrix (cdr a)))) |
966 |
(list (math-compose-vector (cdr (car a)) " & " 0))) |
(list (math-compose-vector (cdr (car a)) " & " 0)))) |
|
) |
|
967 |
|
|
968 |
(defun math-compose-eqn-matrix (a) |
(defun math-compose-eqn-matrix (a) |
969 |
(if a |
(if a |
981 |
(cons |
(cons |
982 |
" } " |
" } " |
983 |
(math-compose-eqn-matrix (cdr a))))))) |
(math-compose-eqn-matrix (cdr a))))))) |
984 |
nil) |
nil)) |
|
) |
|
985 |
|
|
986 |
(defun math-vector-is-string (a) |
(defun math-vector-is-string (a) |
987 |
(while (and (setq a (cdr a)) |
(while (and (setq a (cdr a)) |
991 |
(natnump (nth 1 (car a))) |
(natnump (nth 1 (car a))) |
992 |
(eq (nth 2 (car a)) 0) |
(eq (nth 2 (car a)) 0) |
993 |
(<= (nth 1 (car a)) 255))))) |
(<= (nth 1 (car a)) 255))))) |
994 |
(null a) |
(null a)) |
|
) |
|
995 |
|
|
996 |
(defun math-vector-to-string (a &optional quoted) |
(defun math-vector-to-string (a &optional quoted) |
997 |
(setq a (concat (mapcar (function (lambda (x) (if (consp x) (nth 1 x) x))) |
(setq a (concat (mapcar (function (lambda (x) (if (consp x) (nth 1 x) x))) |
1014 |
p (+ p 2)))))) |
p (+ p 2)))))) |
1015 |
(if quoted |
(if quoted |
1016 |
(concat "\"" a "\"") |
(concat "\"" a "\"") |
1017 |
a) |
a)) |
|
) |
|
1018 |
(defconst math-vector-to-string-chars '( ( ?\" . "\\\"" ) |
(defconst math-vector-to-string-chars '( ( ?\" . "\\\"" ) |
1019 |
( ?\\ . "\\\\" ) |
( ?\\ . "\\\\" ) |
1020 |
( ?\a . "\\a" ) |
( ?\a . "\\a" ) |
1031 |
(if (string-match "\\`\\(.*\\)#\\(.*\\)\\'" x) |
(if (string-match "\\`\\(.*\\)#\\(.*\\)\\'" x) |
1032 |
(math-to-underscores |
(math-to-underscores |
1033 |
(concat (math-match-substring x 1) "_" (math-match-substring x 2))) |
(concat (math-match-substring x 1) "_" (math-match-substring x 2))) |
1034 |
x) |
x)) |
|
) |
|
1035 |
|
|
1036 |
(defun math-tex-expr-is-flat (a) |
(defun math-tex-expr-is-flat (a) |
1037 |
(or (Math-integerp a) |
(or (Math-integerp a) |
1042 |
(math-tex-expr-is-flat (car a)))) |
(math-tex-expr-is-flat (car a)))) |
1043 |
(null a))) |
(null a))) |
1044 |
(and (memq (car a) '(^ calcFunc-subscr)) |
(and (memq (car a) '(^ calcFunc-subscr)) |
1045 |
(math-tex-expr-is-flat (nth 1 a)))) |
(math-tex-expr-is-flat (nth 1 a))))) |
|
) |
|
1046 |
|
|
1047 |
(put 'calcFunc-log 'math-compose-big 'math-compose-log) |
(put 'calcFunc-log 'math-compose-big 'math-compose-log) |
1048 |
(defun math-compose-log (a prec) |
(defun math-compose-log (a prec) |
1053 |
(math-compose-expr (nth 2 a) 1000))) |
(math-compose-expr (nth 2 a) 1000))) |
1054 |
"(" |
"(" |
1055 |
(math-compose-expr (nth 1 a) 1000) |
(math-compose-expr (nth 1 a) 1000) |
1056 |
")")) |
")"))) |
|
) |
|
1057 |
|
|
1058 |
(put 'calcFunc-log10 'math-compose-big 'math-compose-log10) |
(put 'calcFunc-log10 'math-compose-big 'math-compose-log10) |
1059 |
(defun math-compose-log10 (a prec) |
(defun math-compose-log10 (a prec) |
1062 |
(list 'subscr "log" "10") |
(list 'subscr "log" "10") |
1063 |
"(" |
"(" |
1064 |
(math-compose-expr (nth 1 a) 1000) |
(math-compose-expr (nth 1 a) 1000) |
1065 |
")")) |
")"))) |
|
) |
|
1066 |
|
|
1067 |
(put 'calcFunc-deriv 'math-compose-big 'math-compose-deriv) |
(put 'calcFunc-deriv 'math-compose-big 'math-compose-deriv) |
1068 |
(put 'calcFunc-tderiv 'math-compose-big 'math-compose-deriv) |
(put 'calcFunc-tderiv 'math-compose-big 'math-compose-deriv) |
1077 |
(list 'vec |
(list 'vec |
1078 |
'(calcFunc-string (vec ?d)) |
'(calcFunc-string (vec ?d)) |
1079 |
(nth 2 a)))) |
(nth 2 a)))) |
1080 |
prec)) |
prec))) |
|
) |
|
1081 |
|
|
1082 |
(put 'calcFunc-sqrt 'math-compose-big 'math-compose-sqrt) |
(put 'calcFunc-sqrt 'math-compose-big 'math-compose-sqrt) |
1083 |
(defun math-compose-sqrt (a prec) |
(defun math-compose-sqrt (a prec) |
1098 |
(make-list (1- h) " |") |
(make-list (1- h) " |") |
1099 |
'("\\|"))) |
'("\\|"))) |
1100 |
" " |
" " |
1101 |
c)))) |
c))))) |
|
) |
|
1102 |
|
|
1103 |
(put 'calcFunc-choose 'math-compose-big 'math-compose-choose) |
(put 'calcFunc-choose 'math-compose-big 'math-compose-choose) |
1104 |
(defun math-compose-choose (a prec) |
(defun math-compose-choose (a prec) |
1109 |
(list 'vcent |
(list 'vcent |
1110 |
(math-comp-height a1) |
(math-comp-height a1) |
1111 |
a1 " " a2) |
a1 " " a2) |
1112 |
")")) |
")"))) |
|
) |
|
1113 |
|
|
1114 |
(put 'calcFunc-integ 'math-compose-big 'math-compose-integ) |
(put 'calcFunc-integ 'math-compose-big 'math-compose-integ) |
1115 |
(defun math-compose-integ (a prec) |
(defun math-compose-integ (a prec) |
1146 |
(if over |
(if over |
1147 |
"" |
"" |
1148 |
(list 'horiz " d" var)) |
(list 'horiz " d" var)) |
1149 |
(if parens ")" "")))) |
(if parens ")" ""))))) |
|
) |
|
1150 |
|
|
1151 |
(put 'calcFunc-sum 'math-compose-big 'math-compose-sum) |
(put 'calcFunc-sum 'math-compose-big 'math-compose-sum) |
1152 |
(defun math-compose-sum (a prec) |
(defun math-compose-sum (a prec) |
1171 |
(if (memq (car-safe (nth 1 a)) '(calcFunc-sum calcFunc-prod)) |
(if (memq (car-safe (nth 1 a)) '(calcFunc-sum calcFunc-prod)) |
1172 |
" " "") |
" " "") |
1173 |
expr |
expr |
1174 |
(if (memq prec '(180 201)) ")" "")))) |
(if (memq prec '(180 201)) ")" ""))))) |
|
) |
|
1175 |
|
|
1176 |
(put 'calcFunc-prod 'math-compose-big 'math-compose-prod) |
(put 'calcFunc-prod 'math-compose-big 'math-compose-prod) |
1177 |
(defun math-compose-prod (a prec) |
(defun math-compose-prod (a prec) |
1195 |
(if (memq (car-safe (nth 1 a)) '(calcFunc-sum calcFunc-prod)) |
(if (memq (car-safe (nth 1 a)) '(calcFunc-sum calcFunc-prod)) |
1196 |
" " "") |
" " "") |
1197 |
expr |
expr |
1198 |
(if (memq prec '(196 201)) ")" "")))) |
(if (memq prec '(196 201)) ")" ""))))) |
|
) |
|
1199 |
|
|
1200 |
|
|
1201 |
(defun math-stack-value-offset-fancy () |
(defun math-stack-value-offset-fancy () |
1230 |
(or (< off 0) |
(or (< off 0) |
1231 |
(and calc-display-origin |
(and calc-display-origin |
1232 |
(> calc-line-breaking calc-display-origin))) |
(> calc-line-breaking calc-display-origin))) |
1233 |
(setq wid calc-line-breaking))) |
(setq wid calc-line-breaking)))) |
|
) |
|
1234 |
|
|
1235 |
|
|
1236 |
|
|
1243 |
(if (math-comp-is-flat c) |
(if (math-comp-is-flat c) |
1244 |
(math-comp-to-string-flat c width) |
(math-comp-to-string-flat c width) |
1245 |
(math-vert-comp-to-string |
(math-vert-comp-to-string |
1246 |
(math-comp-simplify c width)))) |
(math-comp-simplify c width))))) |
|
) |
|
1247 |
|
|
1248 |
(defun math-comp-is-flat (c) ; check if c's height is 1. |
(defun math-comp-is-flat (c) ; check if c's height is 1. |
1249 |
(cond ((not (consp c)) t) |
(cond ((not (consp c)) t) |
1258 |
(math-comp-is-flat (nth 2 c)))) |
(math-comp-is-flat (nth 2 c)))) |
1259 |
((eq (car c) 'tag) |
((eq (car c) 'tag) |
1260 |
(math-comp-is-flat (nth 2 c))) |
(math-comp-is-flat (nth 2 c))) |
1261 |
(t nil)) |
(t nil))) |
|
) |
|
1262 |
|
|
1263 |
|
|
1264 |
;;; Convert a one-line composition to a string. Break into multiple |
;;; Convert a one-line composition to a string. Break into multiple |
1291 |
(aset comp-buf (1+ k) ?\n) |
(aset comp-buf (1+ k) ?\n) |
1292 |
(setq prefix " ")) |
(setq prefix " ")) |
1293 |
(setq prefix "\n")))) |
(setq prefix "\n")))) |
1294 |
(concat comp-buf prefix str)))) |
(concat comp-buf prefix str))))) |
|
) |
|
1295 |
(setq math-comp-buf-string (make-vector 10 "")) |
(setq math-comp-buf-string (make-vector 10 "")) |
1296 |
(setq math-comp-buf-margin (make-vector 10 0)) |
(setq math-comp-buf-margin (make-vector 10 0)) |
1297 |
(setq math-comp-buf-level (make-vector 10 0)) |
(setq math-comp-buf-level (make-vector 10 0)) |
1390 |
(math-comp-to-string-flat-term (nth 2 c)))) |
(math-comp-to-string-flat-term (nth 2 c)))) |
1391 |
(t (math-comp-to-string-flat-term (nth 2 c))))) |
(t (math-comp-to-string-flat-term (nth 2 c))))) |
1392 |
|
|
1393 |
(t (math-comp-to-string-flat-term (nth 2 c)))) |
(t (math-comp-to-string-flat-term (nth 2 c))))) |
|
) |
|
1394 |
|
|
1395 |
(defun math-comp-highlight-string (s) |
(defun math-comp-highlight-string (s) |
1396 |
(setq s (copy-sequence s)) |
(setq s (copy-sequence s)) |
1398 |
(while (>= (setq i (1- i)) 0) |
(while (>= (setq i (1- i)) 0) |
1399 |
(or (memq (aref s i) '(32 ?\n)) |
(or (memq (aref s i) '(32 ?\n)) |
1400 |
(aset s i (if calc-show-selections ?\. ?\#))))) |
(aset s i (if calc-show-selections ?\. ?\#))))) |
1401 |
s |
s) |
|
) |
|
1402 |
|
|
1403 |
(defun math-comp-sel-flat-term (c) |
(defun math-comp-sel-flat-term (c) |
1404 |
(cond ((not (consp c)) |
(cond ((not (consp c)) |
1415 |
(setq math-comp-sel-tag c |
(setq math-comp-sel-tag c |
1416 |
math-comp-sel-cpos 1000000))) |
math-comp-sel-cpos 1000000))) |
1417 |
(math-comp-sel-flat-term (nth 2 c)))) |
(math-comp-sel-flat-term (nth 2 c)))) |
1418 |
(t (math-comp-sel-flat-term (nth 2 c)))) |
(t (math-comp-sel-flat-term (nth 2 c))))) |
|
) |
|
1419 |
|
|
1420 |
|
|
1421 |
;;; Simplify a composition to a canonical form consisting of |
;;; Simplify a composition to a canonical form consisting of |
1431 |
(comp-highlight (and math-comp-selected calc-show-selections)) |
(comp-highlight (and math-comp-selected calc-show-selections)) |
1432 |
(comp-tag nil)) |
(comp-tag nil)) |
1433 |
(math-comp-simplify-term c) |
(math-comp-simplify-term c) |
1434 |
(cons 'vleft (cons comp-base comp-buf))) |
(cons 'vleft (cons comp-base comp-buf)))) |
|
) |
|
1435 |
|
|
1436 |
(defun math-comp-add-string (s h v) |
(defun math-comp-add-string (s h v) |
1437 |
(and (> (length s) 0) |
(and (> (length s) 0) |
1452 |
(make-string (- h (length (car str))) 32) |
(make-string (- h (length (car str))) 32) |
1453 |
(if comp-highlight |
(if comp-highlight |
1454 |
(math-comp-highlight-string s) |
(math-comp-highlight-string s) |
1455 |
s))))))) |
s)))))))) |
|
) |
|
1456 |
|
|
1457 |
(defun math-comp-add-string-sel (x y w h) |
(defun math-comp-add-string-sel (x y w h) |
1458 |
(if (and (<= y math-comp-sel-vpos) |
(if (and (<= y math-comp-sel-vpos) |
1460 |
(<= x math-comp-sel-hpos) |
(<= x math-comp-sel-hpos) |
1461 |
(> (+ x w) math-comp-sel-hpos)) |
(> (+ x w) math-comp-sel-hpos)) |
1462 |
(setq math-comp-sel-tag comp-tag |
(setq math-comp-sel-tag comp-tag |
1463 |
math-comp-sel-vpos 10000)) |
math-comp-sel-vpos 10000))) |
|
) |
|
1464 |
|
|
1465 |
(defun math-comp-simplify-term (c) |
(defun math-comp-simplify-term (c) |
1466 |
(cond ((stringp c) |
(cond ((stringp c) |
1530 |
(let ((comp-highlight nil)) |
(let ((comp-highlight nil)) |
1531 |
(math-comp-simplify-term (nth 2 c)))) |
(math-comp-simplify-term (nth 2 c)))) |
1532 |
(t (let ((comp-tag c)) |
(t (let ((comp-tag c)) |
1533 |
(math-comp-simplify-term (nth 2 c))))))) |
(math-comp-simplify-term (nth 2 c)))))))) |
|
) |
|
1534 |
|
|
1535 |
|
|
1536 |
;;; Measuring a composition. |
;;; Measuring a composition. |
1544 |
(math-comp-is-null (car c)))) |
(math-comp-is-null (car c)))) |
1545 |
(and c (math-comp-first-char (car c)))) |
(and c (math-comp-first-char (car c)))) |
1546 |
((eq (car c) 'tag) |
((eq (car c) 'tag) |
1547 |
(math-comp-first-char (nth 2 c)))) |
(math-comp-first-char (nth 2 c))))) |
|
) |
|
1548 |
|
|
1549 |
(defun math-comp-first-string (c) |
(defun math-comp-first-string (c) |
1550 |
(cond ((stringp c) |
(cond ((stringp c) |
1555 |
(math-comp-is-null (car c)))) |
(math-comp-is-null (car c)))) |
1556 |
(and c (math-comp-first-string (car c)))) |
(and c (math-comp-first-string (car c)))) |
1557 |
((eq (car c) 'tag) |
((eq (car c) 'tag) |
1558 |
(math-comp-first-string (nth 2 c)))) |
(math-comp-first-string (nth 2 c))))) |
|
) |
|
1559 |
|
|
1560 |
(defun math-comp-last-char (c) |
(defun math-comp-last-char (c) |
1561 |
(cond ((stringp c) |
(cond ((stringp c) |
1567 |
(setq c (cdr c))) |
(setq c (cdr c))) |
1568 |
(and c (math-comp-last-char (car c))))) |
(and c (math-comp-last-char (car c))))) |
1569 |
((eq (car c) 'tag) |
((eq (car c) 'tag) |
1570 |
(math-comp-last-char (nth 2 c)))) |
(math-comp-last-char (nth 2 c))))) |
|
) |
|
1571 |
|
|
1572 |
(defun math-comp-is-null (c) |
(defun math-comp-is-null (c) |
1573 |
(cond ((stringp c) (= (length c) 0)) |
(cond ((stringp c) (= (length c) 0)) |
1577 |
(null c)) |
(null c)) |
1578 |
((eq (car c) 'tag) |
((eq (car c) 'tag) |
1579 |
(math-comp-is-null (nth 2 c))) |
(math-comp-is-null (nth 2 c))) |
1580 |
((memq (car c) '(set break)) t)) |
((memq (car c) '(set break)) t))) |
|
) |
|
1581 |
|
|
1582 |
(defun math-comp-width (c) |
(defun math-comp-width (c) |
1583 |
(cond ((not (consp c)) (length c)) |
(cond ((not (consp c)) (length c)) |
1594 |
accum)) |
accum)) |
1595 |
((eq (car c) 'tag) |
((eq (car c) 'tag) |
1596 |
(math-comp-width (nth 2 c))) |
(math-comp-width (nth 2 c))) |
1597 |
(t 0)) |
(t 0))) |
|
) |
|
1598 |
|
|
1599 |
(defun math-comp-height (c) |
(defun math-comp-height (c) |
1600 |
(if (stringp c) |
(if (stringp c) |
1601 |
1 |
1 |
1602 |
(+ (math-comp-ascent c) (math-comp-descent c))) |
(+ (math-comp-ascent c) (math-comp-descent c)))) |
|
) |
|
1603 |
|
|
1604 |
(defun math-comp-ascent (c) |
(defun math-comp-ascent (c) |
1605 |
(cond ((not (consp c)) 1) |
(cond ((not (consp c)) 1) |
1616 |
(math-comp-ascent (nth 1 c))) |
(math-comp-ascent (nth 1 c))) |
1617 |
((eq (car c) 'tag) |
((eq (car c) 'tag) |
1618 |
(math-comp-ascent (nth 2 c))) |
(math-comp-ascent (nth 2 c))) |
1619 |
(t 1)) |
(t 1))) |
|
) |
|
1620 |
|
|
1621 |
(defun math-comp-descent (c) |
(defun math-comp-descent (c) |
1622 |
(cond ((not (consp c)) 0) |
(cond ((not (consp c)) 0) |
1637 |
(+ (math-comp-descent (nth 1 c)) (math-comp-height (nth 2 c)))) |
(+ (math-comp-descent (nth 1 c)) (math-comp-height (nth 2 c)))) |
1638 |
((eq (car c) 'tag) |
((eq (car c) 'tag) |
1639 |
(math-comp-descent (nth 2 c))) |
(math-comp-descent (nth 2 c))) |
1640 |
(t 0)) |
(t 0))) |
|
) |
|
1641 |
|
|
1642 |
(defun calcFunc-cwidth (a &optional prec) |
(defun calcFunc-cwidth (a &optional prec) |
1643 |
(if (and prec (not (integerp prec))) (math-reject-arg prec 'fixnump)) |
(if (and prec (not (integerp prec))) (math-reject-arg prec 'fixnump)) |
1644 |
(math-comp-width (math-compose-expr a (or prec 0))) |
(math-comp-width (math-compose-expr a (or prec 0)))) |
|
) |
|
1645 |
|
|
1646 |
(defun calcFunc-cheight (a &optional prec) |
(defun calcFunc-cheight (a &optional prec) |
1647 |
(if (and prec (not (integerp prec))) (math-reject-arg prec 'fixnump)) |
(if (and prec (not (integerp prec))) (math-reject-arg prec 'fixnump)) |
1649 |
(memq (length a) '(2 3)) |
(memq (length a) '(2 3)) |
1650 |
(eq (nth 1 a) 0)) |
(eq (nth 1 a) 0)) |
1651 |
0 |
0 |
1652 |
(math-comp-height (math-compose-expr a (or prec 0)))) |
(math-comp-height (math-compose-expr a (or prec 0))))) |
|
) |
|
1653 |
|
|
1654 |
(defun calcFunc-cascent (a &optional prec) |
(defun calcFunc-cascent (a &optional prec) |
1655 |
(if (and prec (not (integerp prec))) (math-reject-arg prec 'fixnump)) |
(if (and prec (not (integerp prec))) (math-reject-arg prec 'fixnump)) |
1657 |
(memq (length a) '(2 3)) |
(memq (length a) '(2 3)) |
1658 |
(eq (nth 1 a) 0)) |
(eq (nth 1 a) 0)) |
1659 |
0 |
0 |
1660 |
(math-comp-ascent (math-compose-expr a (or prec 0)))) |
(math-comp-ascent (math-compose-expr a (or prec 0))))) |
|
) |
|
1661 |
|
|
1662 |
(defun calcFunc-cdescent (a &optional prec) |
(defun calcFunc-cdescent (a &optional prec) |
1663 |
(if (and prec (not (integerp prec))) (math-reject-arg prec 'fixnump)) |
(if (and prec (not (integerp prec))) (math-reject-arg prec 'fixnump)) |
1664 |
(math-comp-descent (math-compose-expr a (or prec 0))) |
(math-comp-descent (math-compose-expr a (or prec 0)))) |
|
) |
|
1665 |
|
|
1666 |
|
|
1667 |
;;; Convert a simplified composition into string form. |
;;; Convert a simplified composition into string form. |
1669 |
(defun math-vert-comp-to-string (c) |
(defun math-vert-comp-to-string (c) |
1670 |
(if (stringp c) |
(if (stringp c) |
1671 |
c |
c |
1672 |
(math-vert-comp-to-string-step (cdr (cdr c)))) |
(math-vert-comp-to-string-step (cdr (cdr c))))) |
|
) |
|
1673 |
|
|
1674 |
(defun math-vert-comp-to-string-step (c) |
(defun math-vert-comp-to-string-step (c) |
1675 |
(if (cdr c) |
(if (cdr c) |
1676 |
(concat (car c) "\n" (math-vert-comp-to-string-step (cdr c))) |
(concat (car c) "\n" (math-vert-comp-to-string-step (cdr c))) |
1677 |
(car c)) |
(car c))) |
|
) |
|
1678 |
|
|
1679 |
|
|
1680 |
;;; Convert a composition to a string in "raw" form (for debugging). |
;;; Convert a composition to a string in "raw" form (for debugging). |
1692 |
(math-comp-to-string-raw (nth 1 c) next-indent) |
(math-comp-to-string-raw (nth 1 c) next-indent) |
1693 |
(math-comp-to-string-raw-step (cdr (cdr c)) |
(math-comp-to-string-raw-step (cdr (cdr c)) |
1694 |
next-indent) |
next-indent) |
1695 |
")")))) |
")"))))) |
|
) |
|
1696 |
|
|
1697 |
(defun math-comp-to-string-raw-step (cl indent) |
(defun math-comp-to-string-raw-step (cl indent) |
1698 |
(if cl |
(if cl |
1700 |
(make-string indent 32) |
(make-string indent 32) |
1701 |
(math-comp-to-string-raw (car cl) indent) |
(math-comp-to-string-raw (car cl) indent) |
1702 |
(math-comp-to-string-raw-step (cdr cl) indent)) |
(math-comp-to-string-raw-step (cdr cl) indent)) |
1703 |
"") |
"")) |
|
) |
|
|
|
|
|
|
|
|
|
|
1704 |
|
|
1705 |
|
;;; calccomp.el ends here |