EGSnrc icon indicating copy to clipboard operation
EGSnrc copied to clipboard

80 Character Limit

Open crcrewso opened this issue 9 years ago • 15 comments

We've been dealing with the 80 character limit for a while. Under old installs I would manually correct the mortran files when the issue arose. With the transition to git this should be removed.

beam

crcrewso avatar Feb 09 '16 20:02 crcrewso

This has been fixed a week ago on the develop branch in commit 76006b8. Thank you for taking the time to report this.

ftessier avatar Feb 09 '16 21:02 ftessier

While the example I gave was fixed in a specific version of the development branch I would like to submit a greater issue. The existence of the 80 char limit at all. I know that is a lot of fixing to increase the 80 char limit to a more reasonable 256 but it's something that I've continually run across with descriptive file names.

crcrewso avatar Feb 09 '16 22:02 crcrewso

I agree with you, it is a pain. The 80 character width limit is a legacy from terminal days of course. While in principle it seems possible to increase the allowed width using the %Cn mortran flag, the Mortran 3 guide specifies that n must be between 10 and 80. We will no change the mortran source code at this point; but we are looking ahead to port everything to C++, eventually.

ftessier avatar Feb 10 '16 01:02 ftessier

While it is true that the EGS User Guide to Mortran3 in the EGSnrc user's manual PIRS-701 (SLAC265 - APPENDIX 4) states that the line length can be increased up to a maximum of 80 characters, one can actually go beyond this limit according to the original Mortran3 User's Guide by A. James Cook. The directive %Cn tells the Mortran3 pre-processor to interpret n characters as program text. However there is yet another directive which is missing in the first document above, '%Bn', that tells the pre-processor to set the input buffer size to n. In the last two lines of the file $HEN_HOUSE/mortran3/mornew77.raw, %B80 and %C72 are set as the defaults. This is the reason for the need to use %C80 on each Mortran source file to maximize the line length. James Cook states in the second document that the actual maximum number of characters is 120. I have tested this by using both directives above and found the actual limit to be 132. To allow lines with 132 characters EGSnrc wide, one would change the last two lines of mornew77.raw to use %B132 and %C132. One will of course have to remove the %C80 from the top of each Mortran source which can be easily be done with a script. I have tested the above only with a little test program called check77.mortran located in $HEN_HOUSE/mortran3. I will reopen this issue and test this at the system level.

mainegra avatar Feb 10 '16 17:02 mainegra

Thank you

In past releases we've had to manually change the mortran on some applications and recompile to allow 90+ character names. Making the limit 132 ( which I believe would be effectively 124 + extensions) would be fantastic.

crcrewso avatar Feb 16 '16 15:02 crcrewso

@mainegra is it realistic to fix and test this for the 2017 release?

ftessier avatar Jan 17 '17 14:01 ftessier

@ftessier can I get back to you on that next week? Although the fix is "trivial" I would like to test it thoroughly system-wide. There aren't that many mortran files in EGSnrc, but one will have to make sure to make the change for the system, the RZ apps and BEAMnrc.

mainegra avatar Jan 17 '17 15:01 mainegra

@ftessier @mainegra if you're not comfortable with it being in the 2017 release, I would be happy to see it rolled into the develop branch so I could do testing over 2017. That way it could be in the 2018 release with more confidence?!

crcrewso avatar Jan 17 '17 15:01 crcrewso

Yes, @crcrewso I would also like to improve this limitation of the Mortran side of the system. As I said I will look into this next week. Cheers!

mainegra avatar Jan 17 '17 15:01 mainegra

I second that @crcrewso, let's roll it out on develop and wait for 2018 to merge into master. So no rush on this one @mainegra!

ftessier avatar Jan 18 '17 02:01 ftessier

@mainegra do you think we could (should?) increase the 80-char limit to 132 right away, so it has a year of dwell time on the develop branch ahead of the next release?

ftessier avatar Apr 22 '21 23:04 ftessier

@mainegra do you think we could (should?) increase the 80-char limit to 132 right away, so it has a year of dwell time on the develop branch ahead of the next release?

@ftessier yes. We should definitely do that! I'll have to look again, but shouldn't we try for 256 or 512? If this is a big deal, the 132 should be adequate!

mainegra avatar Apr 23 '21 13:04 mainegra

That would be great, but from the foregoing comments:

James Cook states in the second document that the actual maximum number of characters is 120. I have tested this by using both directives above and found the actual limit to be 132.

I take it 132 is a hard-limit? Or perhaps we should stick to 120. Without deciphering the mortran source code, who knows if 132 might cause a buffer overflow in some cases eventually?

ftessier avatar Apr 23 '21 14:04 ftessier

120 or 132 are definitely better than 80! But, once users are aware the 80 limit is removed I can see 120 or 132 also becoming too small.

mainegra avatar Apr 23 '21 14:04 mainegra

Yes, time to let Mortran rest. 😉

ftessier avatar Apr 23 '21 15:04 ftessier