[net.lang.ada] Fortran/Ada

SERAFINI%FAE@AMES-IO.ARPA.UUCP (05/21/86)

>>From:           Mike Feldman   <MFELDMAN%GWUVM.BITNET@WISCVM.WISC.EDU>
>>Subject:      Fortran-77/Ada

>>Another thing to watch out for is that Fortranners often take advantage
>>of their knowing that multi-dimensional arrays are mapped "column major",
>>and do tricks accordingly; storage mapping for such things is NOT
>>defined in the ALRM; it is implementation-dependent, but most compilers
>>seem to do it row-major, a la PL/1 or Pascal.

The Fortran 77 standard (ANSI X3.9-1978 pp 5.4-5.7)
implies that storage should be column-major,
and the tricks usually done involve using part of an N dimension array as
an N-1 dimension array, especially in argument passing.  This could 
probably be handled by a translator if it could see the subroutine code
at the same time it translates the call, so it could know how much of
the array to pass.  (It wouldn't be easy, but it sounds possible.)

While we're on the subject, is there anyone actively (passively?) developing
an automatic Fortran-Ada translator?  Anybody interested in doing one?
(Ever try a team programming project using a network as the primary
communication medium?)

>>Mike Feldman        (MFELDMAN%GWUVM.BITNET@WISCVM.WISC.EDU)
>>Dept. of EE&CS
>>George Washington University
>>Washington, DC 20052

David Serafini              
Aerodynamics Division
NASA/Ames Research Center
Moffett Field, CA 94035

ARPA:     serafini%far@ames-io.ARPA
     or   serafini@ames-aero.ARPA
UUCP:     {hplabs,ihnp4,dual,decwrl,allegra}!ames!amelia!serafini

jb@rti-sel.UUCP (Jeff Bartlett) (05/28/86)

Some of the gotcha's I found in Xlating 'tran --> Ada were:
1.	a subroutine that wrote N elements of an array to an unformatted file.

	Of course, the array, N, and the logical unit number were parameters.

	And the actual parameters were arrays of almost anything, including
	the first elements of common blocks (yes, they wrote the whole block).
	(BTW, there was a matching read subroutine).

2.	Passing a slice of a multi-dim array to subroutines.
		(row-major vs column major).

3.	Run-time generated format lists. (nasty, but legal)

4.	Jumping out of case statements with GOTOs.  Can't with Ada.

5.	Equivalaces.  (arrays mapped into matrices, RM vs CM again).

6.	Of course, there is no compiler checks for parameter type or number.

7.	Statement operator precedence.

I think mechanical translation is difficult, but do-able.  It would
require the global 'view' of things.

Jeff Bartlett
Center for Digital Systems Research
Research Triangle Institute              rti-sel!jb@mcnc

GOODENOUGH@USC-ISI.ARPA (John B. Goodenough) (06/02/86)

I noticed an assertion in this message that you can't jump out of case
statements with GOTOs, but of course, such jumps are allowed.  You can't
jump between case statement alternatives, though, and perhaps this is what was
meant.
-------

stt@ada-uts (06/20/86)

It is permissible to jump out of case statements in Ada.

However, it is not permissible to jump into any control structure,
nor to jump out of program units.  The former is permissible
in most Fortrans, and the latter in some Pascals.

ken@njitcccc.UUCP (Kenneth Ng) (06/22/86)

In article <4700039@ada-uts>, stt@ada-uts writes:
> 
> It is permissible to jump out of case statements in Ada.
> 
> However, it is not permissible to jump into any control structure,
> nor to jump out of program units.  The former is permissible
> in most Fortrans, and the latter in some Pascals.
Strange, I thought it was that in Fortran you could jump OUT
of any control structure, but you could not jump into one?

-- 
Kenneth Ng:
Post office: NJIT - CCCC, Newark New Jersey  07102
uucp(unreliable) ihnp4!allegra!bellcore!njitcccc!ken
soon uucp:ken@rigel.cccc.njit.edu
bitnet(prefered) ken@njitcccc.bitnet
soon bitnet: ken@orion.cccc.njit.edu
(Yes, we are slowly moving to RFC 920, kicking and screaming)

Vulcan jealousy: "I fail to see the logic in prefering Stonn over me"