Google
 

Trailing-Edge - PDP-10 Archives - k20v7d - uetp/lib/f7t1.for
There are 4 other files named f7t1.for in the archive. Click here to see a list.
C F7T1
C	Test program for DEC-10/20 Fortran Version 7
C	This program performs minimal confidence test on DIX
C
C           COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION 1982, 1983
C
C This software  is furnished  under a  license and  may be  used  and
C copied only in accordance  with the terms of  such license and  with
C the inclusion of the above  copyright notice.  This software or  any
C other copies thereof may not be provided or otherwise made available
C to any other person.  No title  to and ownership of the software  is
C hereby transferred.
C
C The information in this software is subject to change without notice
C and should not  be construed  as a commitment  by Digital  Equipment
C Corporation.
C
C Digital assumes no responsibility for the use or reliability of  its
C software on equipment which is not supplied by Digital.
C

C Facility: DIX-TEST
C
C Edit History:
C
C Edit (%O'3', '16-Oct-82', 'David Dyer-Bennet')
C %(  Add fortran interface tests: FOR36 V6 (F6T1.FOR), FOR36 V7 (F7T1.FOR),
C     FOR32 V3 (F32T1.VAX-FOR).  F7T1 has the detailed justification
C     of the source and expected destination values used. )%
C
C Edit (%O'7', '1-Nov-82', 'David Dyer-Bennet')
C %(  Change fortran DEC-20 test programs to look for interface files
C     in SYS:.
C     Files: F6T1.FOR, F7T1.FOR)%
C
C Edit (%O'14', '14-Jan-83', 'Sandy Clemens')
C %(  Many edits to the Installation Verification system (ICS)  files.
C     Add SYS:  to all  the  10/20 programs  in  the COPY  or  INCLUDE
C     statement for the interface files.   Add SYS$LIBRARY to the  VAX
C     programs in  the COPY  or INCLUDE  statement for  the  interface
C     files.  Add check for INFO or  SUCCESS status return in all  ICS
C     programs.   Add  Lib$Match_Cond  to  VMS  programs  for   status
C     checking.  Change  some  of  the  symbolic  variable  names  for
C     clarification.   Change  use  of  numeric  parameter  values  to
C     symbolic variable names.  Get rid  of use of "IMPLICIT  INTEGER"
C     in FORTRAN test programs.   Add copyright notice to  everything.
C     Make the TOPS-10 test programs  EXACTLY the same as the  TOPS-20
C     programs, in order to use the same ones on both systems.  Files:
C     F6T1.10-FOR  (DELETED),  F7T1.10-FOR  (DELETED),  C32T1.VAX-COB,
C     C36T1.CBL, F32T1.VAX-FOR, F6T1.FOR, F7T1.FOR, DIXTHST.TXT )%
C
C Edit (%O'15', '19-Jan-83', 'Sandy Clemens')
C %(  Change erroneous program message "Tests through 10 completed
C     successfully" to correct message "Tests though 9 completed
C     successfully."   Files: F6T1.FOR, F7T1.FOR )%
C
C Edit (%O'20', '24-Jan-83', 'Sandy Clemens')
C %(  Add copyright and liability waiver to whatever needs it.
C     FILE: C32T1.VAX-COB, C36T1.CBL, CREDIX.CTL, CREDIX.VAX-COM,
C     DIXDMP.CBL, DIXDMP.VAX-COB, DIXMNT.CBL, DIXTST.CBL,
C     DIXTST.VAX-COB, F32T1.VAX-FOR, F6T1.FOR, F7T1.FOR, PART1.CBL,
C     PART3.VAX-COB, RUNDIX.CTL, RUNDIX.VAX-COM, SUB6X1.FOR,
C     SUB7X1.FOR  )%

C Here is one of the most complete and best documented conversion examples
C you will ever see.  Here are a DEC-20 record, shown as seen in DEC-20
C memory and as seen in VAX memory, in octal and decimal (and binary);
C And a VAX record containing the proper converted equivalent values,
C represented in as many forms and as much detail.
C
C DEC-20 FORM OF TEST RECORD:
C 
C Descr
C Nam		Fld	Type	Lng	Scal	Contents	Comments
C -----		---	----	---	----	--------	--------
C STR20		1	ASCII-7	7		"Abc(12)"
C 		2	ASCII-7	3		Nulls		Filler
C SBF20		3	SBF36		2	21474836.47
C FLT20		4	FLOAT-36		3.1415925E+00
C 
C DEC: {           27015512064            }{        -33408571294              }
C OCT: {3  1  1  2  2  0  0  0  0  0  0  0}{4  0  7  0  5  4  3  2  4  1  4  2}
C  20: {       20 WORD N+1                }{          20 WORD N               }
C INT: {  2  }{  )  }{       FILL        }X{  A  }{  b  }{  c  }{  (  }{  1  }X
C BIT: 011001001010010000000000000000000000100000111000101100011010100001100010
C VAX: <= N+8 }{         VAX WORD N+4         }{       VAX WORD N             }
C OCT: 5  4  4}{2 4  4  0  0  0  0  0  0  1  0}{0 7  0  5  4  3  2  4  1  4  2}
C DEC: <=     }{      -1543503864             }{          951167074           }
C 
C -----------------------------------------------------------------------------
C 
C DEC: {          17553718994             }{        2147483647                }
C OCT: {2  0  2  6  2  2  0  7  7  3  2  2}{0  1  7  7  7  7  7  7  7  7  7  7}
C  20: {         20 WORD N+3              }{       20 WORD N+2                }
C INT: {   FLOAT-36: 3.1415926E+00        }{   SBF36: 2147483647              }
C BIT: 010000010110010010000111111011010010000001111111111111111111111111111111
C VAX: <= N+16        }{        VAX WORD N+12         }{      VAX WORD N+8   =>
C OCT: <=4  0  5  4  4}{2 0  7  7  3  2  2  0  1  7  7}{3 7  7  7  7  7  7  7=>
C DEC: <=  16740      }{      -2014502785             }{      -156           =>
C 
C -----------------------------------------------------------------------------
C 
C BIT:                                                         0000000000000000
C VAX:                                                           WORD N+16   =>
C OCT:                                                         {0 0  0  0  0  0
C DEC:                                                         {             =>
C 
C =============================================================================
C 
C VAX FORM OF TEST RECORD:
C 
C Descr
C Nam		Fld	Type	Lng	Scal	Contents	Comments
C -----		---	----	---	----	--------	--------
C STRVAX		1	ASCII-8	7		"Abc(12)"
C 		2	ASCII-8	1		Nulls		Filler
C SBFVAX		3	SBF32		2	21474836.47
C FLTVAX		4	D-FLOAT			3.141592562198639E0
C 
C Note: The value given here for the D_Float field is the correct
C conversion from SBF36 3.1415926E0.  Since D_Float is a form of greater
C precision, there is no difficulty in conversion:  The same string of
C mantissa bits, properly represented for the other system, is used.
C 
C DEC: {         2699825              }{          677601857           }
C OCT: {0 0  0  1  2  2  3  1  0  6  1}{0 5  0  3  0  6  6  1  1  0  1}
C VAX: {       VAX WORD N+4           }{        VAX WORD N            }
C INT: {      }{  )   }{  2   }{   1  }{  (   }{  c   }{   b  }{  A   }
C BIT: 0000000000101001001100100011000100101000011000110110001001000001
C  20: <=      20 WORD N+1        }{             20 WORD N            }
C OCT:   0  0  0  5  1  1  4  4  3}{0  4  5  0  3  0  6  6  1  1  0  1}
C DEC: <=    -268266717           }{           4972569153             }
C 
C DEC: {       2147483647             }
C OCT: {1 7  7  7  7  7  7  7  7  7  7}
C VAX: {       VAX WORD N+8           }
C INT: {       21474836.47            }
C BIT: 01111111111111111111111111111111
C  20: <=    20 WORD N+2      }{ N+1 =>
C OCT:  3  7  7  7  7  7  7  7}{7  7 6
C DEC: <=    5528092671       }{     =>
C 
C -----------------------------------------------------------------------------
C 
C DEC: {         16384                }{         265961801            }
C OCT: {0 0  0  0  0  0  4  0  0  0  0}{0 1  7  6  6  4  4  0  5  1  1}
C VAX: {         VAX WORD N+16        }{         VAX WORD N+12        }
C INT: {                3.1415926E00                                  }
C BIT: 0000000000000000010000000000000000001111110110100100000101001001
C  20: <=  20 WORD N+4}{        20 WORD N+3               }{  N+2    =>
C OCT:   0  0  0  0  0}{2  0  0  0  0  0  1  7  6  6  4  4}{0  5  1  1 
C DEC: <=    0        }{        17179934116               }{         =>
C 
C -----------------------------------------------------------------------------
C 
C DEC:
C OCT:
C VAX:
C INT:      NOT PRESENT
C BIT: 00000000000000000000
C  20: {    N+4          =>
C OCT: {0  0  0  0  0  0  0
C DEC: {                 =>

C [%O'7'] Add SYS: to file specs.
C	Include the DIL interface files
	INCLUDE 'SYS:DILV7'
	INCLUDE 'SYS:DIXV7'

C	Foreign field descriptors
	INTEGER STR20 (3), SBF20 (3), FLT20 (3)
	INTEGER STRVAX (3), SBFVAX (3), FLTVAX (3)

C	BUFFERS
	INTEGER SRCDAT (4)
	INTEGER DSTDAT (5)

C	VARIABLES
	INTEGER TEST, STAT

C	Initialize foreign field descriptors
	TEST = 1
	STAT = XDESCR (STR20, SRCDAT, SYS36, 7, 0, 0, ASCII7, 7, 0)
	IF (STAT.NE.NORMAL) GOTO 777
	TEST = 2
	STAT = XDESCR (SBF20, SRCDAT, SYS36, 36, 2, 0, SBF36, 0, 2)
	IF (STAT.NE.NORMAL) GOTO 777
	TEST = 3
	STAT = XDESCR (FLT20, SRCDAT, SYS36, 36, 3, 0, FLOT36, 0, 0)
	IF (STAT.NE.NORMAL) GOTO 777
	TEST = 4
	STAT = XDESCR (STRVAX, DSTDAT, SYSVAX, 8, 0, 0, ASCII8, 7, 0)
	IF (STAT.NE.NORMAL) GOTO 777
	TEST = 5
	STAT = XDESCR (SBFVAX, DSTDAT, SYSVAX, 8, 8, 0, SBF32, 0, 2)
	IF (STAT.NE.NORMAL) GOTO 777
	TEST = 6
	STAT = XDESCR (FLTVAX, DSTDAT, SYSVAX, 8, 12, 0, DFLOAT, 0, 0)
	IF (STAT.NE.NORMAL) GOTO 777

C	INITIALIZE SRC BUFFER
C 	Data is as described at top.
	SRCDAT (1) = -33408571294
	SRCDAT (2) = 27015512064
	SRCDAT (3) = 2147483647
	SRCDAT (4) = 17553718994

C	INITIALIZE DESTINATION BUFFER TO ZEROS
	DO 10 I = 1, 5
10	DSTDAT (I) = 0

C	DO CONVERSIONS
	WRITE (5, 1001)
1001	FORMAT (' Doing conversions')
C
	TEST = 7
	STAT = XCVST (STR20, STRVAX)
	IF (STAT.NE.NORMAL) GOTO 777
	TEST = 8
	STAT = XCVFB (SBF20, SBFVAX)
	IF (STAT.NE.NORMAL) GOTO 777
	TEST = 9
	STAT = XCGEN (FLT20, FLTVAX)
	IF (STAT.NE.NORMAL) GOTO 777

	WRITE (5, 781)
781	FORMAT (' Tests through 9 completed successfully')

	GO TO 100

C	PRINT ERROR INFORMATION
777	WRITE (5, 778) TEST, STAT
778	FORMAT (' ? Failure in test ', I4, ' Status = ', I10)
	STOP

C	CHECK RESULTS
C	What we should have created is the VAX form of the record as 
C	described in the comments at the head of this program.
100	DO 20 I = 1, 5
20	WRITE (5, 779) I, DSTDAT (I)
779	FORMAT (' DSTDAT sub ', I3, ' = ', I12)

	TEST = 10
	IF (DSTDAT (1) .NEQ. 4972569153) GO TO 777
	TEST = 11
	IF (DSTDAT (2) .NEQ. -268266717) GO TO 777
	TEST = 12
	IF (DSTDAT (3) .NEQ. 5528092671) GO TO 777
	TEST = 13
C	Since the initial precision is only float-36, the full D_float
C	precision will not be produced in the answer.
C	D_Float is exactly like F_Float for the first word.  The second
C	word consists entirely of lower-order mantissa bits.  In our
C	example, however, mantissa bits cannot be manufactured from nowhere.
C	Float-36 has 26 mantissa bits.  F_Float has 24 (first one hidden).
C	Therefore, 2 bits, which happen to be 10, will overflow into the
C	second word of the D_Float.  The remainder of that word
C       (vax word N+16) will be 0.  Lay this out on the chart, and you will
C	see that 20 word n+3 will thus be 200000,,176644, or 17179934116.
	IF (DSTDAT (4) .NEQ. 17179934116) GO TO 777
	TEST = 14
	IF (DSTDAT (5) .NEQ. 0) GO TO 777

	WRITE (5, 780)
780	FORMAT (' Tests through 14 successfully completed')

C	TRY A COUPLE OF ERROR CASES

C	GET AN UNKNOWN SYSTEM OF ORIGIN ERROR AND VERIFY USE OF UNKSYS
	TEST = 15
	STAT = XDESCR (STR20, SRCDAT, 3, 7, 0, 0, ASCII7, 7, 0)
	IF (STAT .NEQ. UNKSYS) GO TO 777

C	GET AN INVALID DATA TYPE ERROR AND VERIFY USE OF DATTYP
	TEST = 16
	STAT = XDESCR (STR20, SRCDAT, SYS36, 7, 0, 0, -75, 7, 0)
	IF (STAT .NEQ. DATTYP) GO TO 777
	
	WRITE (5, 782)
782	FORMAT (' Tests through 16 successfully completed')

	WRITE (5, 783)
783	FORMAT (' F7T1 successfully completed')

	END