Closed magv closed 2 years ago
Anyone? I'd imagine this change to be uncontroversial.
I am also for this change. In another thread @vermaseren mentioned that there may be some fixed-size buffers. Are we sure that this change does not produce buffer overflows?
There's a fixed-size buffer that holds the content of a line; this one is flushed every line. The line continuation marks are just printed every few lines or so, no buffer involved. I think this change is safe.
Basically what needs to be done is rather simple: 1: whenever an output expression is printed set a flag. 2: when the flag is set: don’t print end-of-line or carriage-return. 3: when done printing the output expression, reset the flag and print an end-of-line cq carriage-return. This needs intervention in the places where you print expressions (in sch.c) and where you print dollars. In addition you need to look for the LINEFEEDS etc and put the if around it.
On 13 Sep 2021, at 11:50, Vitaly Magerya @.***> wrote:
There's a fixed-size buffer that holds the content of a line; this one is flushed every line. The line continuation marks are just printer every few lines or so, no buffer involved.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vermaseren/form/pull/394#issuecomment-918023382, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJPCEUO57MRVDIGN4N7O33UBXCNNANCNFSM5DJBJXMQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
There's unfortunately also some logic to insert spaces, &
, and \
marks into the line buffers that would need to be modified to fully allow printing without newlines -- and that logic is a bit too tangled for me, so at the moment I've given up on changing that. Instead of the full solution, at least allowing to suppress the line continuation break marks (the _ +=
sequences) would make handling FORM output a bit more bearable for us -- hence this pull request.
Here's a test case.
Is this ready for merging?
If you're asking me, then yes. Not sure about others' opinions.
Allow disabling the continuation line limit by setting
ContinuationLines
to 0.Also fix the documentation: the continuation line limit applies not only for Fortran, but for all formats.
This fixes issue #392.