Hi,

>> In addition to this, the patch contains a part which concerns the
>> function 'gfc_terminal_width': Currently this returns a fixed value of
>> 80, which means that all source lines are trimmed to 80 characters in
>> the error messages. I increased this default value to 132 (in order to
>> accommodate standard free-format lines), and added a part which tries
>> to determine the terminal width from the environment variable $COLUMNS
>> (the corresponding code was borrowed from gcc/opts.c).
>
> I think it is a good idea to use $COLUMNS (which is, e.g. set by the shell
> under Unix); however, if the variable is not available, I think one should
> keep the value 80.

well, does the 80-character limit actually have any meaning on current
computing platforms? This is basically an artifact from the punchcard
era, right?

Since the current default line length in free-format source is 132
characters, I thought that might be a more reasonable default. One
could also use 132 for free format and 80 for fixed format, or adjust
it to the actual values of gfc_option.free_line_length and
gfc_option.fixed_line_length. Opinions?

Btw, I just noticed that the $COLUMN method does not actually work on
my system (the variable seems to be defined, but not exported), but it
may still work on other systems.

Attached is a small patch with an alternative implementation (borrowed
from ada/terminals.c). It is not portable to all systems, but at least
it does actually work on my openSUSE box. Is this something we want to
have for gfortran?


> Regarding the error printing: My long standing wish is to ignore ignore
> trailing comments when trimming the error message, i.e. instead of printing
>
> e" ! some very long comment line
>
> one should rather show
>
> print *, some "line" ! some ver
>
> where one cuts of the comment line. I think the issue mostly occurs with %C
> error printing where the current location is at the end of the line, while
> for %L the location should be fine.

Yes, certainly not a bad idea. I'm not sure how much effort would be
needed to accomplish it, though. Anyway, this problem would be
mitigated already by a proper determination of the terminal width. (A
fullscreen terminal on my MacBook is 180 characters wide, of which 100
are currently wasted.)

Cheers,
Janus

Attachment: terminal_width.diff
Description: Binary data

Reply via email to