Menu

#55 restore c and ratfor in gentran

None
closed
nobody
8
2017-10-15
2014-04-17
No

Currently gentran is broken for c and ratfor. Consider this

(%i3) load("gentran")$
(%i4) kill(labels);
(%o0)                                done
(%i1) load("gentran")$
(%i2) gentranlang(ratfor)$
(%i3) gentran(for i:1 thru 10 do s: s + i)$
Maxima encountered a Lisp error:

EVAL: undefined function RATCODE

Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
(%i4) gentranlang(c)$
(%i5) gentran(for i:1 thru 10 do s: s + i)$
Maxima encountered a Lisp error:

EVAL: undefined function CCODE

Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.

If I try harder I hit another bug:

(%i1) load("gentran")$
(%i2) load("lspc.lisp")$
(%i3) gentranlang(c)$
(%i4) gentran(for i:1 thru 10 do s: s + i)$
Maxima encountered a Lisp error:

GET: 1 is not a symbol

Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.

The patch (1) loads lspc.lisp and lsprat.lisp, (2) makes a fix similar to this one
http://sourceforge.net/p/maxima/code/ci/master/tree/share/contrib/gentran/lspfor.lisp#l185
applied befor in 42ed80 for fortran.

With this patch the basic functionality of gentran is restored for c and
ratfor:

(%i1) load("gentran")$
(%i2) gentranlang(ratfor)$
(%i3) gentran(for i:1 thru 10 do s: s + i)$
DO I=1.0,10.0
S=S+I
(%i4) gentranlang(c)$
(%i5) gentran(for i:1 thru 10 do s: s + i)$
FOR (I=1;!(I>10);I=I+1)
S=S+I;
1 Attachments

Discussion

  • Robert Dodier

    Robert Dodier - 2017-10-06
    • labels: gentran --> gentran, share
    • status: open --> accepted
    • Group: -->
    • Priority: 5 --> 8
     
  • Robert Dodier

    Robert Dodier - 2017-10-06

    Looks good, thanks for your efforts. Sorry for the long delay, I will try to apply this patch soon.

     
  • Robert Dodier

    Robert Dodier - 2017-10-15
    • status: accepted --> closed
     
  • Robert Dodier

    Robert Dodier - 2017-10-15

    I see this patch was already applied as commit 05a2882. Closing this item accordingly. Thanks for your work on this.

     

Log in to post a comment.