There are 3 other files named test.for in the archive. Click here to see a list.
C FORTRAN program to illustrate each transformation performed
C by TRANSFORT.
C 10/21/85 jke
C TRANSFORM 1
C DEC-20 FORTRAN allows comment lines to begin with several characters
C the VAX does not allow. The translated program has all comment lines
C beginning with an asterisk.
C This comment line begins with C
c This comment line begins with c
$ This comment line begins with $
! This comment line begins with !
/ This comment line begins with /
C TRANSFORM 2
C Statements on multi-statement lines are separated so that each
C is contained on its own individual line. A statement label is
C associated with the first statement on the line, and a "!"
C comment is associated with the last.
10 A = B; CONTINUE; IF (A.EQ.3) 20,30,40 ! If statement is last
C TRANSFORM 3
C Identifiers longer than 6 characters are truncated to 6 characters.
C The DEC-20 and VAX both allow longer identifiers, but they are only
C significant to 6 characters whereas they are significant to 31 on
C the VAX.
C In the example given, the identifiers A VERYLONGIDENTIFIER and
C AVERYLITTLEID are considered to be the same identifier on the DEC20.
C This transform insures that the VAX will do the same.
C This transformation generates an IDTRNC6 warning.
LONGIDENTIFIER = AMUCHLONGERIDENTIFIER + AVERYLONGIDENTIFIER
1 + AVERYLITTLEID
C TRANSFORM 4
C Hollerith constants used as actual arguments to subprograms are
C detected because the bit patterns actually passed to the subprogram
C may be different.
C This transformation generates a HOLCNSARG warning.
C This transformation does not alter the target code.
CALL SAMPLE ( 3HABC )
C TRANSFORM 5
C Octal constants, when found, are converted to use the VAX syntax.
C This transformation generates a BITHACKAS warning.
A = "777
C TRANSFORM 6
C Alternate syntax for relational operators: The symbolic forms of
C the relational operators are converted to the standard form.
IF ( A == B ) THEN ! equal
IF ( A # B ) THEN ! not equal
IF ( A < B ) THEN ! less than
IF ( A > B ) THEN ! greater than
IF ( A <= B ) THEN ! less than or equal
IF ( A >= B ) THEN ! greater than or equal
C TRANSFORM 7
C The symbolic form of the exponentiation operator "^" is converted to
SQRT( A ) = A ^ 0.5 ! ^
C TRANSFORM 8
C The precedences of unary + and - differ on the VAX and DEC.
C Expressions involving these operators may be altered so that
C the expressions are evaluated in the same manner. Parentheses
C are placed around the unary term.
A = A * - B * C + D ! B * C is negated
C TRANSFORM 9
C Mixing logical and numeric values in an expression - this is
C detected because logical values have different representations
C on the two machines. This also occurs during equivalence.
C This transform produces a BITHACKAS warning, a BITHACKEQ warning,
C or a BADLOGOP warning.
I = .TRUE.
LV = (.TRUE. .AND. 3)
C TRANSFORM 10
C The additional return label indicator "$" available on the DEC
C is converted to "*" so it will compile on the VAX.
SUBROUTINE TEST ( A,*,B,$,C,& ) ! List is (A,*,B,$,C,&)
CALL TEST (*10,$20,&30) ! List is (*10,$20,&30)
C TRANSFORM 11
C Two-branch IF statement converted to an equivalent 3-branch IF.
IF (A <= B) 10,20
C TRANSFORM 12
C Obsolete or untranslatable statements are flagged. These statements
C include DECODE, ENCODE, PUNCH,
DECODE( A,B,C )
ENCODE( A,B,C )
REREAD (FMT=100) A,B,C
C TRANSFORM 13
C Default write unit - this form of statement is illegal on the VAX.
C TRANSFORT can, via the control file, create write statement to
C UNIT 6 (or a user-specified unit), or ignore them.
C This transformation produces a WRTUNTMOD warning.
WRITE 10, A,B,C
WRITE * , A,B,C
C TRANSFORM 14
C FMT specification of a namelist - FMT is converted to NML.
WRITE (3,FMT=AAA) ! FMT should be changed to NML
WRITE (3,FMT=BBB) ! This one should not be
C TRANSFORM 15
C Default field widths for edit descriptors I,F,E,D,G,O,Z,L, and A
C This transform produces a BDDFLTFMT warning.
C TRANSFORM 16
C R-Hollerith Edit Descriptor is converted to A edit descriptor.
C This transformation produces a warning.
C TRANSFORM 17
C Argument passing: because of the different methods used, certain
C situations can cause different results to occur from the same
C code ont he two machines. TRANSFORT attempts to warn about
C these situations.
C This transform produces a COMPARM warning or a VARUSED2 warning.
CALL SUB( A,E,E )
X = 1 + FN( E, A, E)
C TRANSFORM 18
C Assigned GOTO statement. Since the VAX ignores the list of labels
C in the statement, these statements are detected.
C This transform produces an ASGOTOLST warning.
GOTO LV (10,20,30)
C TRANSFORM 19
C Unit 5 for output. Like the default output unit, unit 5 WRITES can
C be altered to unit 6, a user-defined unit, or ignored. This is
C provided because the DEC allows input and output both using unit 5,
C but the VAX does input from unit 5 and output from unit 6.
C (Terminal I/O)
C This transform produces a WRTUNTMOD warning.
WRITE( 5, *) A,B,C
WRITE(UNIT=5, FMT=*) A,B,C
C TRANSFORM 20
C OPEN STATEMENT QUALIFIERS
C TRANSFORM 21
C CLOSE STATEMENT QUALIFIERS
C TRANSFORM 22
C The final X edit descriptor of a format statement is replaced with
C a blank character.
C This transform produces a BADFRMTNX warning.
C TRANSFORM 23
C Floating point descriptors with empty decimal field widths are
C converted to explicitly indicate an empty decimal field.
C This transform produces a warning.
C TRANSFORM 24
C Quoted strings as actual arguments are detected because the bit
C patterns actually passed to the subroutines may differ.
C This transform produces a CHRCNSARG warning.
CALL SUB ( 'A' )
X = VAL( '123' )
C TRANSFORM 25
C Mixing numbers and quoted strings: Again, due to differing bit
C patterns, these are detected and warned about.
C This transform produces a BITHACKAS warning or a BADRELOP warning.
A = 'ABC'
IF (A <= '3') 10,20,20
C TRANSFORM 26
C A edit descriptor - detected due to number of A items which appear
C per word - 5 on DEC but only 4 on VAX.
C This transform produces a SZMSMTCHF warning.
160 FORMAT (X,A5)
C TRANSFORM 27
C DO Loops may be converted to execute once if the ONE-TRIP flag is
C set (ONE-TRIP appears in the control file). Order of expression
C evaluation is insured.
C This transform produces a ONETRIP warning.
DO 10 I=1,2,3
DO 10 J=A,B
DO 10 K=A,FN(3)
DO 10 L=A,FN(3),B
C TRANSFORM 28
C Program format: Look above!