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