Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
7 Views

Fixed form, Tab Form clarifications

In reading the IVF documentation, I'd like some clarification

1) The compiler option switches have /fixed and /free, but no switch to indicate if tab format. Are tab formatted lines freely interchangeable within fixed format lines of fixed format files?

2) The IVF documentation assumes well formatted lines, what is the behavior of the following two lines containing:

     <Tab>A = B +
     <Space><Tab>1 C

Is the above a valid continuation line?

3) The documentation states that a ; followed by a comment (!) is to be ignored. Does this hold true if a space(s) and/ or tab(s) lie between the ; and !?

Jim Dempsey

0 Kudos
5 Replies
Highlighted
Black Belt Retired Employee
7 Views

1) Tab format is a variant of

1) Tab format is a variant of fixed-form, and is handled on a line by line basis. It is an extension, of course

2) The documentation says it is valid continuation.

3) Yes, but I'm unsure why the documentation calls that out. I can't find words in the standard that connect the two. 

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
7 Views

Thanks, the documentation

Thanks, the documentation states

For tab form: Any digit (except zero) after the first tab

This, taken literally could mean:

     <Tab>A = B +
      arbitraryTextHere<Space><Tab>1 C

Is a valid continuation line. (first character following first tab is digit other than 0).

I do not think the comment is to be taken literally. Rather, I think the interpretation is to be:

   <0 to 4 spaces><Tab>1 C

While you may think this question is absurd, consider trying to write a fixed/tab for to free form parser.

Think of something worse than IanH's FIXEDFORMFOREVER.FOR.

His file did not have these goofy continuation lines. But it did have rather difficult syntax to say the least.

Jim Dempsey

0 Kudos
Highlighted
Black Belt Retired Employee
7 Views

I agree that you can't have

I agree that you can't have characters other than blank before the first tab. I tested it and a blank before the tab is ok.

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
7 Views

Steve,

Steve,

Another esoteric question regarding tabs.

Fixed form:

<tab>A=Expression;<tab>Expression;...

Assume rules for 72 character lines are in place.

I assume in the above, the first tab "consumes" 6 characters of the 72 character line. (First tab rule)

What does the 2nd tab consume?

1 character position .OR. to the next "usual" tab position (9, 17, 25, 33, ...) .OR. to the next tab position of some editor unknown?

Reason for question is to resolve is to determine at which point in fixed/tab formatted file characters become comment.

Jim Dempsey

0 Kudos
Highlighted
Black Belt Retired Employee
7 Views

Jim, you'll find that

Jim, you'll find that different implementations interpret the tabs differently. Intel Fortran considers a tab to be a single character for the purpose of fixed-form line length. I know of other compilers that take the "tab stop" approach.

The answer really is: "Don't use tab form!" There's no excuse for using it nowadays. If your question is from the perspective of writing a converter, I suggest having an option for how tabs are to be treated since compilers differ. I would hope, though, that nobody mixes tab form with comments past "column 72" ,which isn't really specified in the standard either. From the standard's perspective, a fixed-form source line is exactly 72 characters, no more, no less. When we were all using punch cards, that didn't matter so much, but with variable-length source records from text editors, how you deal with line lengths less than 72 is open for interpretation. Consider:

bbbbb PRINT *, 'HOW MANY SPACES
bbbbb1IS THIS?'

where "b" is a blank.

If this was on punch cards, there would be a bunch of spaces between "SPACES" and "IS". With variable-length source records, do you pad the line to column 72 or not? This is why we invented /pad_source so many years ago, as implementations disagreed on the default behavior.

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos