emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r108290: calc/calc-lang.el (math-C-pa


From: Jay Belanger
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108290: calc/calc-lang.el (math-C-parse-bess, math-C-parse-fma): New functions.
Date: Fri, 18 May 2012 10:16:23 -0500
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 108290
author: Rüdiger Sonderfeld <address@hidden>
committer: Jay Belanger <address@hidden>
branch nick: trunk
timestamp: Fri 2012-05-18 10:16:23 -0500
message:
  calc/calc-lang.el  (math-C-parse-bess, math-C-parse-fma): New functions.
  (math-function-table):  Add support for more C functions.
modified:
  lisp/ChangeLog
  lisp/calc/calc-lang.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-05-18 07:04:04 +0000
+++ b/lisp/ChangeLog    2012-05-18 15:16:23 +0000
@@ -1,3 +1,9 @@
+2012-05-18  Rüdiger Sonderfeld <address@hidden>
+
+       * 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  <address@hidden>
 
        * flyspell.el (flyspell-check-pre-word-p, flyspell-check-word-p)

=== modified file 'lisp/calc/calc-lang.el'
--- a/lisp/calc/calc-lang.el    2012-01-19 07:21:25 +0000
+++ b/lisp/calc/calc-lang.el    2012-05-18 15:16:23 +0000
@@ -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 )


reply via email to

[Prev in Thread] Current Thread [Next in Thread]