[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::languages

Title:Languages
Notice:Speaking In Tongues
Moderator:TLE::TOKLAS::FELDMAN
Created:Sat Jan 25 1986
Last Modified:Wed May 21 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:394
Total number of notes:2683

105.0. "FORTRAN - PASCAL conversion" by RDGE43::MARSHALL (Steve Marshall - European A.D.G,Acre Road,Reading) Mon Sep 22 1986 06:04

    Hi there folks,
    	I am new to this notes file, and have a quick question. I am
    converting a FORTRAN program and have come across a few funnies.
    
    1) An equivalence statement.
    
    		EQUIVALENCE (xarray(1),yarray(1,1))
    
    	where
    		DIMENSION xarray(64)
    		DIMENSION yarray(8,8)
    
       In what order are the elements of yarray assigned into xarray.
    Are they assigned by row or by column ?
    
    	i.e      1           2           3   .....
      row	1,1         1,2          1,3 .....
      column	1,1	    2,1          3,1 .....
    
    
    2) A funny logical statement.
    
    	IF (((i1 .OR. j1) .AND. .NOT. 7) .NE. 0) GOTO ...
    
    	i1 and j1 are declared as integers.
    
    	What the hell does this statement do ?? And how do I convert
    it to a PASCAL equivalent ?
    
    
    		Thanks in advance for any help.
    		Best regards
    			Steve Marshall - European Development (UK).
    
T.RTitleUserPersonal
Name
DateLines
105.1PASTIS::MONAHANMon Sep 22 1986 07:199
    1) The leftmost subscript varies most rapidly. This would mean that
    xarray(2) would occupy the same storage as yarray(2,1).
    
    2) Some species of Fortran permit integer variables to be used with
    logical operators, to perform a bitwise operation.  The .OR. operation
    will produce a result that has a bit set in any position that either
    operand had a bit set.  The .NOT. 7 gives an integer that has all
    bits except the low order 3 set. The .AND. operation masks out these
    bits.
105.2Bitwise operations in PascalMINAR::BISHOPMon Sep 22 1986 11:505
    To get logical operations on whole longwords using VAX Pascal,
    use the UAND, UOR, UXOR and UNOT predeclared functions.  See
    page 11-7 of "Programming in VAX Pascal".
    
    				-John Bishop
105.3CHOVAX::YOUNGI think we're all bozos on this BUS.Mon Sep 22 1986 13:275
    Why would you want to slow down a good FORTRAN program by converting
    it into Pascal anyway?
    
    ;^)  Barry
    
105.4Improve your code; drop the card deckTLE::AMARTINAlan H. MartinTue Sep 23 1986 16:594
Re .3:

The only good Fortran program is a dead Fortran program.
				/AHM
105.5FORTRAN will never dieQUARK::LIONELReality is frequently inaccurateTue Sep 23 1986 22:5910
    Re .4:
    
    I have long since forgotten who said this, but it doesn't matter.
    The quote is:
    
    	"I don't know what the programming language of the year 2000
         will look like, but I know it will be called FORTRAN."
    
    
    					Steve
105.6S. CrayCLT::GILBERTeager like a childWed Sep 24 1986 00:250
105.7He may have been mistaken...CIM::JONANWe should've stopped at fire...Wed Sep 24 1986 10:495
    Hmmmmm.  Interesting seein' how the CRAY-2 will be running some
    sort of version of UNIX and have some extended version of C for
    the primary language.
    
    /Jon
105.8IPG::HAXBYJohn Haxby -- Definitively WrongFri Dec 05 1986 13:335
    Re .1, .2: The order Fortran stores its array elements is, I think,
    implementation dependent.  Whoever thought up equivalence should
    be shot, at dawn, if not sooner.
    
    							jch
105.9To implement is human, to standardize is divineNOBUGS::AMARTINAlan H. MartinFri Dec 05 1986 13:5911
Re .8:

>    Re .1, .2: The order Fortran stores its array elements is, I think,
>    implementation dependent.  Whoever thought up equivalence should
>    be shot, at dawn, if not sooner.

Only in the sense that non-standard-conforming implementations might be
stupid enough to implement arrays with row-major mapping, or subscripts
running in the wrong direction.  All ANSI standard Fortran implementations
use the same storage order, since the standard requires it.
				/AHM
105.10NOGOV::HAXBYJohn Haxby -- Definitively WrongWed Jan 07 1987 09:164
    I lost interest in Fortran before the ANSI standard got established
    ... I stand corrected.
    
    								jch