11/26/80 fortran_77.conversions This info segment outlines some suggested procedures for converting FORTRAN programs fron ansi66 to ansi77. The implementation of FORTRAN 77 on Multics is not yet complete, so this list of suggested conversion procedures may grow with future releases. The paragraphs below are titled: common blocks equivalence groups default character string length packed character string layout zero trip DO loop blank lines common blocks: Under the ansi77 option, it is invalid to mix character mode variables and variables of other modes within a single common block. Common blocks in ansi66 programs that contain both character and non-character data must be split into two separate common blocks, one for character data and one for non-character data. equivalence groups: Under the ansi77 options, it is invalid to equivalence character mode variables with variables of other modes. Such equivalencing in ansi66 programs should be replaced with explicit assignment statements. For complex and double precision data, the corresponding character variable should be given the length 8. For integer, real, and logical data, the corresponding character variable is of length 4. Whenever the storage in question is to be viewed as non-character data, the program should explicitly assign the character value to an integer, real, etc. variable. Whenever the storage is to be viewed as character data, it may be inspected directly. default character string length: Under the ansi77 option, the default length for character variables has changed from 8 to 1. To avoid ambiguity, all CHARACTER statements in the program should be inspected to ensure that every character mode variable has an explicitly declared length. packed character string layout: The representation of character data in storage is different under the ansi77 option. This change in storage layout will most seriously affect programs which use permanent common blocks (those whose names end with "$") or unformatted files which contain character data and which were written by an ansi66 program. ansi77 programs can access character data in ansi66 format as follows: for each character datum in ansi66 format, the ansi77 program should declare a corresponding character datum. The length of the character datum in the ansi77 program should be the smallest multiple of 4 that is greater than or equal to the length declared in the ansi66 program. For example, a CHARACTER*15 variable becomes CHARACTER*16, and a CHARACTER*32 variable remains CHARACTER*32. The next step is to use the substring notation wherever an ansi77 variable is used to access ansi66 data. If the variable was declared CHARACTER*15 in the ansi66 program, the ansi77 program should reference a CHARACTER*16 variable with the substring notation (1:15). This technique can be used in converting old format data to the new format by reading the data as described above, and writing the data to a new file or common block straightforwardly with an ansi77 program. zero trip DO loop: For ansi66 programs being converted to ansi77, each DO loop must be examined. If the logic of the program depends on the loop body being executed at least once in all circumstances, the final loop value should be changed to use the MAX or MIN intrinsic function. For example, the statement DO 100 I = J,K might be changed to DO 100 I = J,MAX(J,K) to ensure that the loop is executed at least once under the ansi77 option. If the increment is known to be negative, the MIN intrinsic function should be used instead of MAX. blank lines: The interpretation of a blank line differs in the ansi66 and ansi77 options. In ansi66, it is interpreted as an initial line, i.e. it begins a statement, whereas in ansi77, it is ignored. This will present no difficulty in all but the most pathological cases. Consider the following program: %options card; program blank_line integer foo, foogoto5, k data foo /66/, foogoto5 /77/ k = foo &go to 5 100 format (" This was compiled with the ansi", i2, " option.") 5 write (6, 100) k stop end If this program compiled with the ansi66 option, it will set k to the value of the variable foo, because the blank line terminates the assignment. If compiled with the ansi77 option, it will set k to the value of foogoto5, because the blank line is ignored and the what we might think of as the goto statement is considered part of the assignment statement. If the ansi66 semantics of this program were desired while compiling under the ansi77 option, it would be necessary to insure that the goto statement was not interpreted as a continuation line to the assignment. The remedy is to simply remove the continuation marker in column six. ----------------------------------------------------------- Historical Background This edition of the Multics software materials and documentation is provided and donated to Massachusetts Institute of Technology by Group BULL including BULL HN Information Systems Inc. as a contribution to computer science knowledge. This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology, Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell BULL Inc., Groupe BULL and BULL HN Information Systems Inc. to the development of this operating system. Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970), renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership of Professor Fernando Jose Corbato. Users consider that Multics provided the best software architecture for managing computer hardware properly and for executing programs. Many subsequent operating systems incorporated Multics principles. Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. . ----------------------------------------------------------- Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without fee is hereby granted,provided that the below copyright notice and historical background appear in all copies and that both the copyright notice and historical background and this permission notice appear in supporting documentation, and that the names of MIT, HIS, BULL or BULL HN not be used in advertising or publicity pertaining to distribution of the programs without specific prior written permission. Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc. Copyright 2006 by BULL HN Information Systems Inc. Copyright 2006 by Bull SAS All Rights Reserved