Has anyone written a function like fortran() except for C/C++?



Hi Dan,

Thanks for the reply.  From the documentation, it looks like gentran is
exactly what I want.   Now comes the hard part, namely, how to get it to
work under maxima (this is complicated by the fact that I'm NOT a lisp
programmer).

I tried things like (in the share/contrib/gentran/ directory):

(%i1) load("local.gtload.lisp");
WARNING: DEFUN/DEFMACRO: redefining macro WHILE in
         /home/ronis/Project/notar/maxima/share/contrib/gentran/convmac.lisp,
         was defined in
         /home/ronis/Project/notar/maxima/src/binary-clisp/utils.fas
WARNING: DEFUN/DEFMACRO: redefining function $READVEXP in
         /home/ronis/Project/notar/maxima/share/contrib/gentran/gtfix.lisp,
         was defined in
         /home/ronis/Project/notar/maxima/share/contrib/gentran/templt.lisp
(%o1)                          local.gtload.lisp
(%i2) batch("test/loop.mac");

batching /home/ronis/Project/notar/maxima/share/contrib/gentran/test/loop.mac
(%i3)                        gentranlang : fortran
(%o3)                               fortran
(%i4) gentran(type(implicit real*8, a-h, o-z), type(real*8, m(4, 4)), 
for i thru 4 do (for j thru 4 do if i = j then m     : 1.0 else m     :
0.0), 
                                                i, j             i, j
type(integer, i, j))
Maxima encountered a Lisp error:

 
EVAL: undefined function SUBSTRING

Automatically continuing.

As they say, this is beyond my pay-grade.

An suggestions would be most appreciated.

David

On Thu, 2009-08-13 at 19:59 -0400, Dan Stanger wrote:
> There is gentran, which needs some work under the current maxima.  It 
> should be in the current cvs.
> Regards,
> Dan Stanger
> David Ronis wrote:
> > The subject says it all.  For what it's worth, it seems like it should
> > be easy (at least for C); the main changes are some function names and
> > replacing things like x^y by pow((double)(x), (double)(y))
> > instead of (x)**(y).
> >
> > David
> > 	
> > _______________________________________________
> > Maxima mailing list
> > Maxima at math.utexas.edu
> > http://www.math.utexas.edu/mailman/listinfo/maxima
> >
> >   
> 
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>