* Interfaces.Ada @ 1994-10-31 15:33 Kyongsuk Pace 1994-11-01 18:06 ` Interfaces.Ada Michael Feldman 0 siblings, 1 reply; 9+ messages in thread From: Kyongsuk Pace @ 1994-10-31 15:33 UTC (permalink / raw) Let me try the same question again. The organization I work has tons of Fortran programs and we really need to have the interface capability between Fortran and Ada. I tried to use pragma import in GNAT to use some Fortran programs. However, pragma for Fortran is not implemented yet according to Robert Dewar. I got this response from Robert Dewar after I sent the question to gnat-report! I read about interfaces.Fortran in one of Mike Feldman's postings in info-Ada. Can you (Mike Feldman) tell me where I can get it and how to use it with GNAT (i.e., does it require any changes before it will work)? I am using Sun Sparc. Thank you. Susie Pace ===================================================================== Kyongsuk Pace Fleet Numerical Meteorology and Oceanography Center pacek@fnoc.navy.mil 7 Grace Hopper Ave, stop 1 408-656-4367 Monterey, CA 93943-5501 fax:408-656-4489 ===================================================================== ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Interfaces.Ada 1994-10-31 15:33 Interfaces.Ada Kyongsuk Pace @ 1994-11-01 18:06 ` Michael Feldman 1994-11-01 21:04 ` Interfaces.Ada Matt Kennel 1994-11-03 11:15 ` Interfaces.Ada Robert Dewar 0 siblings, 2 replies; 9+ messages in thread From: Michael Feldman @ 1994-11-01 18:06 UTC (permalink / raw) In article <9409317836.AA783621232@smtpgw.fnoc.navy.mil>, Kyongsuk Pace <pacek@FNOC.NAVY.MIL> wrote: >Let me try the same question again. The organization I work has tons of >Fortran programs and we really need to have the interface capability >between Fortran and Ada. > >I tried to use pragma import in GNAT to use some Fortran programs. >However, pragma for Fortran is not implemented yet according to Robert >Dewar. I got this response from Robert Dewar after I sent the question to >gnat-report! I read about interfaces.Fortran in one of Mike Feldman's >postings in info-Ada. Can you (Mike Feldman) tell me where I can get it >and how to use it with GNAT (i.e., does it require any changes before it >will work)? I am using Sun Sparc. Thank you. I think Robert Dewar has commented on the best way (currently) to interface Fortran programs to GNAT. Interfaces.Fortran, and especially the data structures interface - which will provide column-mapped multi-dimensional arrays, etc. simply has not been implemented yet. I suggested to CLA readers that they look in RM9X 5.0 to see what these language interfaces will look like in an implementation that supports them fully. I did not (mean to) imply that GNAT was currently supporting anything but C. I am not at all familiar with GCC F77, so I'm not a good one to ask for details on how to do the interfacing to GNAT (especially while we wait for the full Interfaces.Fortran to be done). Robert Dewar has suggested that the scalar data types are the same in all the GNU languages; Fortran generally requires parameters to be passed by reference; typically this has been done in Ada 83 by using the 'Address attribute to pass an address from Ada to Fortran. (NOTE: an Ada access type is not necessaily the same thing, as has been discussed at length here recently). Handling arrays is something you'll have to look at closely, until there's a full Interfaces.Fortran to make it easier. If you are really hurting to get started, maybe the NYU folks can help, but I'm hesitant to suggest this because they are up to their ears finishing the compiler. Maybe Robert will comment again on CLA. BTW - I've always advocated that each organization set up a small group or even a single individual who becomes the local expert on language interfacing, and that this group or person be tasked with writing whatever interfacing "glue" is necessary to make the Ada side of the interface as clean and clear as possible to the rest of the project. Try to avoid distributing 'Address calls and suchlike throughout a big program, for example - go through a project-specific interface layer if need be. Do not assume that the performance hit will be unacceptable. Is there a CLA reader out there who has experience in interfacing to Fortran? Mike Feldman ------------------------------------------------------------------------ Michael B. Feldman - chair, SIGAda Education Working Group Professor, Dept. of Electrical Engineering and Computer Science The George Washington University - Washington, DC 20052 USA 202-994-5919 (voice) - 202-994-0227 (fax) - mfeldman@seas.gwu.edu (Internet) ------------------------------------------------------------------------ Ada on the World-Wide Web: http://lglwww.epfl.ch/Ada/ ------------------------------------------------------------------------ "Non illegitimi carborundum." (Don't let the bastards grind you down.) ------------------------------------------------------------------------ ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Interfaces.Ada 1994-11-01 18:06 ` Interfaces.Ada Michael Feldman @ 1994-11-01 21:04 ` Matt Kennel 1994-11-02 6:24 ` Interfaces.Ada Tucker Taft ` (3 more replies) 1994-11-03 11:15 ` Interfaces.Ada Robert Dewar 1 sibling, 4 replies; 9+ messages in thread From: Matt Kennel @ 1994-11-01 21:04 UTC (permalink / raw) Michael Feldman (mfeldman@seas.gwu.edu) wrote: : >will work)? I am using Sun Sparc. Thank you. : I think Robert Dewar has commented on the best way (currently) to : interface Fortran programs to GNAT. Interfaces.Fortran, and especially : the data structures interface - which will provide column-mapped : multi-dimensional arrays, etc. simply has not been implemented yet. I've always wondered about one thing: When people make new langauges why do they implement the C storage layout for multi-dimensional arrays instead of that of Fortran? E.g. as it seems, Ada9x, Modula-3. Given that most matrix algorithms are in Fortran why be backwards? (and ones in C usually use some sort of non-compatible dope-vector thing anyway because C doesn't have variable matrix sizes.) Why not make the default just like Fortran? I don't think one way is particularly more "natural" than the other so now that Fortran chose one convention why not stay with it? The only thing I can figure out is that it is a childish attitude like "bleah fortran sucks so we'll be different". I don't believe this is true so what is the real reason? Is it that compelling? : Mike Feldman -- -Matt Kennel mbk@inls1.ucsd.edu -Institute for Nonlinear Science, University of California, San Diego -*** AD: Archive for nonlinear dynamics papers & programs: FTP to -*** lyapunov.ucsd.edu, username "anonymous". ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Interfaces.Ada 1994-11-01 21:04 ` Interfaces.Ada Matt Kennel @ 1994-11-02 6:24 ` Tucker Taft 1994-11-02 13:55 ` Interfaces.Ada Mats Weber ` (2 subsequent siblings) 3 siblings, 0 replies; 9+ messages in thread From: Tucker Taft @ 1994-11-02 6:24 UTC (permalink / raw) In article <396agd$9bt@network.ucsd.edu>, Matt Kennel <mbk@inls1.ucsd.edu> wrote: >Michael Feldman (mfeldman@seas.gwu.edu) wrote: >: >will work)? I am using Sun Sparc. Thank you. > >: I think Robert Dewar has commented on the best way (currently) to >: interface Fortran programs to GNAT. Interfaces.Fortran, and especially >: the data structures interface - which will provide column-mapped >: multi-dimensional arrays, etc. simply has not been implemented yet. > >I've always wondered about one thing: > > When people make new langauges why do they implement the C storage > layout for multi-dimensional arrays instead of that of Fortran? E.g. > as it seems, Ada9x, Modula-3. Note that Ada doesn't "implement the C storage layout" for arrays. Ada 83 doesn't specify the order. However, implementors naturally have chosen the layout implied by the way that array aggregates are written, where the second index varies fastest as you move through memory. For example, in the following array aggregate: ((1,2,3), (4,5,6), (7,8,9)) One would naturally expect the second dimension to vary fastest, by just looking at the syntax for the aggregate. But to reiterate, there is nothing in Ada 83 that requires a particular layout. In Ada 9X, the Convention pragma may be used to specify Fortran-style array layout. Also, it is a bit funny to call the non-Fortran order the "C storage layout" for multi-dimensional arrays. C was certainly not the first language to vary the last dimension fastest. Algol 60 used the non-Fortran order (or at least suggested it in the same sense that Ada's array aggregate notation suggests it). So it has a long history, though clearly not as relevant a history as Fortran's choice to modern numerics. It is also of course possible to simply reverse the indices when defining and using a multidimensional array in an implementation that has the non-Fortran order, so it doesn't seem like an insurmountable barrier in any case. > Given that most matrix algorithms are in Fortran why be backwards? (and > ones in C usually use some sort of non-compatible dope-vector thing anyway > because C doesn't have variable matrix sizes.) Calling the non-Fortran order "backwards" reminds me of the typical non-Britisher comment about the "backwards" nature of the British drive-on-the-left rule ;-). > Why not make the default just like Fortran? I don't think one way is > particularly more "natural" than the other so now that Fortran chose one > convention why not stay with it? The array aggregate notation suggests that the non-Fortran order is somewhat more natural in Ada. > The only thing I can figure out is that it is a childish attitude > like "bleah fortran sucks so we'll be different". I don't believe this > is true so what is the real reason? Is it that compelling? It didn't come out of any desire to be different. I believe it was simply that Ada comes more from the Algol school of languages than the Fortran school of languages. >: Mike Feldman > >-- >-Matt Kennel mbk@inls1.ucsd.edu >-Institute for Nonlinear Science, University of California, San Diego >-*** AD: Archive for nonlinear dynamics papers & programs: FTP to >-*** lyapunov.ucsd.edu, username "anonymous". -Tucker Taft stt@inmet.com Intermetrics, Inc. Cambridge, MA 02138 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Interfaces.Ada 1994-11-01 21:04 ` Interfaces.Ada Matt Kennel 1994-11-02 6:24 ` Interfaces.Ada Tucker Taft @ 1994-11-02 13:55 ` Mats Weber 1994-11-02 16:14 ` Interfaces.Ada Stephen J Bevan 1994-11-03 11:18 ` Interfaces.Ada Robert Dewar 3 siblings, 0 replies; 9+ messages in thread From: Mats Weber @ 1994-11-02 13:55 UTC (permalink / raw) In article <396agd$9bt@network.ucsd.edu>, mbk@inls1.ucsd.edu (Matt Kennel) wrote: > When people make new langauges why do they implement the C storage > layout for multi-dimensional arrays instead of that of Fortran? E.g. > as it seems, Ada9x, Modula-3. There is a technical reason for this, which appears in Pascal, where type Matrix is array [1 .. n, 1 .. m] of Real; is defined as equivalent to type Matrix is array [1 .. n] of array [1 .. m] of Real; so it is quite natural to chose an ordering different from FORTRAN. BTW the above is not true in Ada, and the layout of arrays in memory is not sepcified by the language. Mats ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Interfaces.Ada 1994-11-01 21:04 ` Interfaces.Ada Matt Kennel 1994-11-02 6:24 ` Interfaces.Ada Tucker Taft 1994-11-02 13:55 ` Interfaces.Ada Mats Weber @ 1994-11-02 16:14 ` Stephen J Bevan 1994-11-03 11:18 ` Interfaces.Ada Robert Dewar 3 siblings, 0 replies; 9+ messages in thread From: Stephen J Bevan @ 1994-11-02 16:14 UTC (permalink / raw) [ Since the following isn't Ada specific, I've redirected followups to comp.lang.misc - bevan ] In article <396agd$9bt@network.ucsd.edu> mbk@inls1.ucsd.edu (Matt Kennel) writes: ... I've always wondered about one thing: When people make new langauges why do they implement the C storage layout for multi-dimensional arrays instead of that of Fortran? E.g. as it seems, Ada9x, Modula-3. ... Perhaps because the people who make new languages with Fortran incompatible arrays don't necessarily care about Fortran compatibility? Why not make the default just like Fortran? I don't think one way is particularly more "natural" than the other so now that Fortran chose one convention why not stay with it? Perhaps because some do find the row major order more natural. The following is taken from the section 2.2.6 "Arrays and Orthogonal Lists" in Knuth's Fundamental Algorithms pp 296 :- The most natural (and most commonly used) way to allocate storage is to let the array appear in memory in the ``lexiographic order'' of its indices, sometimes called ``row major order''. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Interfaces.Ada 1994-11-01 21:04 ` Interfaces.Ada Matt Kennel ` (2 preceding siblings ...) 1994-11-02 16:14 ` Interfaces.Ada Stephen J Bevan @ 1994-11-03 11:18 ` Robert Dewar 1994-11-05 3:14 ` Interfaces.Ada Michael Feldman 3 siblings, 1 reply; 9+ messages in thread From: Robert Dewar @ 1994-11-03 11:18 UTC (permalink / raw) It is actually the columnwise choice in Fortran that is peculiar. In most languages it doesn't matter how arrays are stored (you can't normally tell), and rowwise is somewhat the more natural choice for ENglish speakers (note how you are reading rows of this message and not columns). Why Fortran chose column-wise I don't know, but the choice of using row-wise is well established (all Algol compilers I know of used row wise), and basically we just have another one of those incompatiilities which is a nuisance. At this stage, obviously you can't be compatible with everyone automatically, but the pragma Convention (Fortran seems a nice approach in Ada 9X (it was actually my idea to put it in in this general form, so I'm of course biased in liking the way this is done :-) ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Interfaces.Ada 1994-11-03 11:18 ` Interfaces.Ada Robert Dewar @ 1994-11-05 3:14 ` Michael Feldman 0 siblings, 0 replies; 9+ messages in thread From: Michael Feldman @ 1994-11-05 3:14 UTC (permalink / raw) In article <39agv3$870@schonberg.cs.nyu.edu>, Robert Dewar <dewar@cs.nyu.edu> wrote: >At this stage, obviously you can't be compatible with everyone automatically, >but the pragma Convention (Fortran seems a nice approach in Ada 9X (it was >actually my idea to put it in in this general form, so I'm of course biased >in liking the way this is done :-) I like it too. As you know, I've griped for years that Ada compiler implementers missed the boat in not providing something like this in their Ada 83 compilers (via an implementation-dependent pragma, say), as a way of gaining entree into the Fortran engineering world, which rejected PL/I, as I recall, in part because of the lack of array compatibility. I'm very glad that Ada 9X has focused on the issue. ('Course now with Fortran 90 a real thing, perhaps it's too late. I hope not. It would be really nice to have - and for engineers to use - a really smooth Fortran-to-Ada interface. Hope GNAT fills in the Convention gap soon.) Mike Feldman ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Interfaces.Ada 1994-11-01 18:06 ` Interfaces.Ada Michael Feldman 1994-11-01 21:04 ` Interfaces.Ada Matt Kennel @ 1994-11-03 11:15 ` Robert Dewar 1 sibling, 0 replies; 9+ messages in thread From: Robert Dewar @ 1994-11-03 11:15 UTC (permalink / raw) "Fortran generally requires parameters to be passed by reference" a common myth, but one that has never been true, not even array parameters are required to be passed by reference in Fortran. In fact the Ada permission to pass composites either by copy or by reference is conciously copied from the Fortran standard! Back to GNAT and Fortran. The only piece of functionality that I see missing is the columnwise arrays (which has nothing to do with either pragma Import, or with Interfaces.Fortran, but rather with pragma Convention applied to an array. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~1994-11-05 3:14 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 1994-10-31 15:33 Interfaces.Ada Kyongsuk Pace 1994-11-01 18:06 ` Interfaces.Ada Michael Feldman 1994-11-01 21:04 ` Interfaces.Ada Matt Kennel 1994-11-02 6:24 ` Interfaces.Ada Tucker Taft 1994-11-02 13:55 ` Interfaces.Ada Mats Weber 1994-11-02 16:14 ` Interfaces.Ada Stephen J Bevan 1994-11-03 11:18 ` Interfaces.Ada Robert Dewar 1994-11-05 3:14 ` Interfaces.Ada Michael Feldman 1994-11-03 11:15 ` Interfaces.Ada Robert Dewar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox