From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?R=FCdiger?= Sonderfeld Newsgroups: gmane.emacs.devel Subject: [PATCH] calc/calc-lang.el (c): Added support for more C (C99) functions. Date: Wed, 01 Feb 2012 19:01:32 +0100 Message-ID: <2197485.mNir3U5MpL@descartes> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1328119319 15204 80.91.229.3 (1 Feb 2012 18:01:59 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 1 Feb 2012 18:01:59 +0000 (UTC) Cc: jay.p.belanger@gmail.com To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 01 19:01:58 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RseVK-0005Wn-1k for ged-emacs-devel@m.gmane.org; Wed, 01 Feb 2012 19:01:58 +0100 Original-Received: from localhost ([::1]:43944 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RseVJ-0004ST-JY for ged-emacs-devel@m.gmane.org; Wed, 01 Feb 2012 13:01:57 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:47011) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RseVE-0004Rh-8A for emacs-devel@gnu.org; Wed, 01 Feb 2012 13:01:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RseVA-00010y-2L for emacs-devel@gnu.org; Wed, 01 Feb 2012 13:01:52 -0500 Original-Received: from ptmx.org ([178.63.28.110]:49846) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RseV9-00010l-TE for emacs-devel@gnu.org; Wed, 01 Feb 2012 13:01:48 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by ptmx.org (Postfix) with ESMTP id D062B20DF4; Wed, 1 Feb 2012 19:01:44 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at ptmx.org Original-Received: from ptmx.org ([127.0.0.1]) by localhost (ptmx.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id g9qjRq-JlSEw; Wed, 1 Feb 2012 19:01:38 +0100 (CET) Original-Received: from descartes.localnet (213-33-31-100.adsl.highway.telekom.at [213.33.31.100]) by ptmx.org (Postfix) with ESMTPSA id D946F2089E; Wed, 1 Feb 2012 19:01:38 +0100 (CET) User-Agent: KMail/4.7.3 (Linux/3.0.0-15-generic; KDE/4.7.4; x86_64; ; ) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 178.63.28.110 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:148097 Archived-At: I added support for more C (C99) functions to calc's C language mode. I= have=20 signed the fsf papers. Regards, R=C3=BCdiger -- >8 -- Subject: [PATCH] calc/calc-lang.el (c): Added support for more C (C99)=20= 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=C3=BCdiger Sonderfeld --- 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=09 . calcFunc-arcsinh ) ( atan=09 . calcFunc-arctan ) ( atan2=09 . calcFunc-arctan2 ) - ( atanh=09 . calcFunc-arctanh ))) + ( atanh=09 . 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) =3D> (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)))) =20 (put 'c 'math-variable-table '( ( M_PI=09 . var-pi ) --=20 1.7.8.3