* [PATCH] calc/calc-lang.el (c): Added support for more C (C99) functions.
@ 2012-02-01 18:01 Rüdiger Sonderfeld
2012-02-01 19:31 ` Jay Belanger
2012-05-18 15:33 ` Jay Belanger
0 siblings, 2 replies; 3+ messages in thread
From: Rüdiger Sonderfeld @ 2012-02-01 18:01 UTC (permalink / raw)
To: emacs-devel; +Cc: jay.p.belanger
I added support for more C (C99) functions to calc's C language mode. I have
signed the fsf papers.
Regards,
Rüdiger
-- >8 --
Subject: [PATCH] calc/calc-lang.el (c): Added support for more C (C99)
functions.
Support for fma (x*y+z), fmax (max), jn, j0, j1 (bessel 1st kind), yn,
y0, y1 (bessel 2nd kind), tgamma (gamma).
Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
---
lisp/calc/calc-lang.el | 32 +++++++++++++++++++++++++++++++-
1 files changed, 31 insertions(+), 1 deletions(-)
diff --git a/lisp/calc/calc-lang.el b/lisp/calc/calc-lang.el
index c53f59e..0463b6a 100644
--- a/lisp/calc/calc-lang.el
+++ b/lisp/calc/calc-lang.el
@@ -134,7 +134,37 @@
( asinh . calcFunc-arcsinh )
( atan . calcFunc-arctan )
( atan2 . calcFunc-arctan2 )
- ( atanh . calcFunc-arctanh )))
+ ( atanh . calcFunc-arctanh )
+ ( fma . (math-C-parse-fma))
+ ( fmax . calcFunc-max )
+ ( jn . calcFunc-besJ )
+ ( j0 . (math-C-parse-bess))
+ ( 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 )
--
1.7.8.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] calc/calc-lang.el (c): Added support for more C (C99) functions.
2012-02-01 18:01 [PATCH] calc/calc-lang.el (c): Added support for more C (C99) functions Rüdiger Sonderfeld
@ 2012-02-01 19:31 ` Jay Belanger
2012-05-18 15:33 ` Jay Belanger
1 sibling, 0 replies; 3+ messages in thread
From: Jay Belanger @ 2012-02-01 19:31 UTC (permalink / raw)
To: Rüdiger Sonderfeld; +Cc: jay.p.belanger, emacs-devel
> I added support for more C (C99) functions to calc's C language mode. I have
> signed the fsf papers.
Thanks!
I'll take care of this as soon as 24.1 comes out.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] calc/calc-lang.el (c): Added support for more C (C99) functions.
2012-02-01 18:01 [PATCH] calc/calc-lang.el (c): Added support for more C (C99) functions Rüdiger Sonderfeld
2012-02-01 19:31 ` Jay Belanger
@ 2012-05-18 15:33 ` Jay Belanger
1 sibling, 0 replies; 3+ messages in thread
From: Jay Belanger @ 2012-05-18 15:33 UTC (permalink / raw)
To: Rüdiger Sonderfeld; +Cc: jay.p.belanger, emacs-devel
> I added support for more C (C99) functions to calc's C language mode. I have
> signed the fsf papers.
Thanks for this; the changes have been committed.
Jay
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-05-18 15:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-01 18:01 [PATCH] calc/calc-lang.el (c): Added support for more C (C99) functions Rüdiger Sonderfeld
2012-02-01 19:31 ` Jay Belanger
2012-05-18 15:33 ` Jay Belanger
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).