Menu

#101 partial fix for gentran for c

None
wont-fix
nobody
gentran (2)
5
2021-07-18
2021-02-05
No

Hi,
as far as I know, gentran is still broken. In my repo here: https://github.com/jgeisler0303/maxima I have some fixes that make it work at least with SBCL and for my needs (not all features but probably most). I think that is better than nothing and would like to ask if it's possible to integrate the fixes.
If yes, then what should I do to make it happen?
BR,
Jens

Discussion

  • Robert Dodier

    Robert Dodier - 2021-06-26

    Jens, thanks for your interest in Maxima, and sorry for the late reply.

    There has been some work recently on the Gentran package -- can I ask you to take a look at the current version as it is in Git (https://sourceforge.net/p/maxima/code/ci/master/tree/) and see what changes you want to propose?

    I see that you have a fork of andrejv/maxima on Github -- unfortunately andrejv/maxima hasn't been updated for some years. In order to see what needs to be done, I think you'll have to compare against the official version here on SF. I know that SF doesn't make the PR work flow as simple as on Github, so it might be a little more work.

    Thanks for your help, I appreciate it a lot.

     
  • Jens Geisler

    Jens Geisler - 2021-07-10

    Hi Robert,
    now I found the time to look at gentran from the latest master branch and as far as I can tell it is working now flawlessly. The order in which expressions are output is a bit different from my version which makes 1:1 comparison impossible but the outcome should be the same (I haven't checked a compiled program yet). I only had to adapt my code a bit since the configuration options like ccurind, clinelen etc. have changed names, but that's no problem.

    Thanks so much for fixing gentran! My patch request is now obsolete.

    Maybe one comment: it is a bit annoying and I don't really see the purpose, that gentranin appends to an already existing file. But I guess its better for me to adapt my code accordingly instead of changing a decades old API.

    Cheers, Jens

     
  • Robert Dodier

    Robert Dodier - 2021-07-10
    • labels: --> gentran
    • status: open --> wont-fix
    • Group: -->
     
  • Robert Dodier

    Robert Dodier - 2021-07-10

    Hi Jens, thanks for the update. I'm glad to hear that the current version of gentran is working for you (aside from the file appending issue). I'm closing this ticket accordingly.

    About file appending versus overwriting, I have to say that the way files are handled in gentran seems pretty confusing to me. I agree that it makes more sense to overwrite files by default. I see a couple of ways forward for this particular problem.

    (1) Make it possible to supply gentranin with a file stream instead of a filename, then open the output file for writing (without appending). I find that a minor update to the function MKFIL is needed, as follows:

    :lisp (defun mkfil (f) (if (streamp f) f (stripdollar f)))
    

    Then I can say

    f: openw ("myoutput.f");
    gentranin ("mytemplate.tem", [f]);
    

    (2) Get gentran functions to honor the global flag file_output_append which is used elsewhere in Maxima. I think that would be pretty easy since it appears there is only one place (function MKFILPR) where a file is opened for output. One issue to be resolved is that the default value of file_output_append is false so that would change the default behavior of gentran. I don't know if that's any problem; it depends on what anybody is doing with gentran these days.

    If you're interested, I encourage you to bring up this topic or any others on that maxima-discuss mailing list. Gentran is an interesting package and it could benefit from some attention.

     
  • Jens Geisler

    Jens Geisler - 2021-07-18

    Hi Robert, thanks for your support. Just to be clear (and to avoid duplication), are your two suggestions regarding a better handling of file output already registered with the developers or do you encourage me to bring them up in the mailing-list?

    Of course I will bring up any further topics in the mailing list. To me, gentran is essential in using maxima! So I'm really glad it is now picking up more momentum.

     
  • Robert Dodier

    Robert Dodier - 2021-07-18

    Hi Jens, I haven't mentioned these possible changes to anyone else, so if you will open a discussion on this topic, that would be very helpful.

    I am inclined to try to implement both ideas at this point, although the bit about handling streams instead of file names may run into problems eventually -- the way files are handled in gentran is complex and idiosyncratic, I think I see how to make a simple modification (as shown above) but it might turn out that it is not enough.

    About the file appending flag, that seems more straightforward, there is just one place to change the code. The issue that I see that needs to be resolved is what should be the default behavior. I suppose that if the default behavior (overwrite instead of append) isn't acceptable, there could be a new option flag which is for gentran only, although I'd rather not invent yet another option flag.

    I can work on the programming if you or somebody else can figure out what needs to be done.

     

Log in to post a comment.