calc/calc-lang.el (math-C-parse-bess, math-C-parse-fma): New functions.

(math-function-table):  Add support for more C functions.
This commit is contained in:
Rüdiger Sonderfeld 2012-05-18 10:16:23 -05:00 committed by Jay Belanger
parent adf4198e98
commit b1a1071666
2 changed files with 39 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2012-05-18 Rüdiger Sonderfeld <ruediger@c-plusplus.de>
* calc/calc-lang.el (math-C-parse-bess, math-C-parse-fma):
New functions.
(math-function-table): Add support for more C functions.
2012-05-18 Agustín Martín Domingo <agustin.martin@hispalinux.es>
* flyspell.el (flyspell-check-pre-word-p, flyspell-check-word-p)

View file

@ -133,8 +133,39 @@
( asin . calcFunc-arcsin )
( asinh . calcFunc-arcsinh )
( atan . calcFunc-arctan )
( atan2 . calcFunc-arctan2 )
( atanh . calcFunc-arctanh )))
( atan2 . calcFunc-arctan2 )
( atanh . calcFunc-arctanh )
( fma . (math-C-parse-fma))
( fmax . calcFunc-max )
( j0 . (math-C-parse-bess))
( jn . calcFunc-besJ )
( j1 . (math-C-parse-bess))
( yn . calcFunc-besY )
( y0 . (math-C-parse-bess))
( y1 . (math-C-parse-bess))
( tgamma . calcFunc-gamma )))
(defun math-C-parse-bess (f val)
"Parse C's j0, j1, y0, y1 functions."
(let ((args (math-read-expr-list)))
(math-read-token)
(append
(cond ((eq val 'j0) '(calcFunc-besJ 0))
((eq val 'j1) '(calcFunc-besJ 1))
((eq val 'y0) '(calcFunc-besY 0))
((eq val 'y1) '(calcFunc-besY 1)))
args)))
(defun math-C-parse-fma (f val)
"Parse C's fma function fma(x,y,z) => (x * y + z)."
(let ((args (math-read-expr-list)))
(math-read-token)
(list 'calcFunc-add
(list 'calcFunc-mul
(nth 0 args)
(nth 1 args))
(nth 2 args))))
(put 'c 'math-variable-table
'( ( M_PI . var-pi )