From: Rüdiger Sonderfeld Date: Fri, 18 May 2012 15:16:23 +0000 (-0500) Subject: calc/calc-lang.el (math-C-parse-bess, math-C-parse-fma): New functions. X-Git-Tag: emacs-24.2.90~471^2~25 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b1a107166626f4d26399f828fba43b56d57ebeb8;p=emacs.git calc/calc-lang.el (math-C-parse-bess, math-C-parse-fma): New functions. (math-function-table): Add support for more C functions. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 774ea476fb3..30cd1843b30 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-05-18 Rüdiger Sonderfeld + + * 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 * flyspell.el (flyspell-check-pre-word-p, flyspell-check-word-p) diff --git a/lisp/calc/calc-lang.el b/lisp/calc/calc-lang.el index c53f59eb0f4..ec4c497a1c6 100644 --- a/lisp/calc/calc-lang.el +++ b/lisp/calc/calc-lang.el @@ -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 )