Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uakari.primate.wisc.edu!sdd.hp.com!elroy.jpl.nasa.gov!ames!skipper!elxsi!maine From: maine@elxsi.dfrf.nasa.gov (Richard Maine) Newsgroups: comp.lang.fortran Subject: Re: Is the INCLUDE statement standard? Message-ID: Date: 30 Aug 90 05:26:43 GMT References: <1990Aug29.160951.19827@athena.mit.edu> Sender: news@skipper.dfrf.nasa.gov Organization: NASA Dryden, Edwards, Cal. Lines: 63 In-reply-to: oliver@athena.mit.edu's message of 29 Aug 90 16:09:51 GMT On 29 Aug 90 16:09:51 GMT, oliver@athena.mit.edu (James D. Oliver III) said: James> Title pretty much says it all. I want to know, before I go James> replacing multitudes of common block and parameter statements, James> whether this is a standard command. I don't see mention of it James> in any FORTRAN 77 references, so I would assume it is not. No, it's not standard Fortran 77. Yes, it is (will be, is proposed to be, whatever) standard Fortran 90. James> If it's not standard, I'd like to know how portable I can James> expect it to be, i.e., which systems support it. Almost all systems support something roughly equivalent. The exact syntax varies somewhat, however. In my experience, the most widely adopted syntax looks like include 'filename' with the include starting in column 7 or later just like a fortran statement, and with quotes around the file name. This also happens to be consistent with the proposed Fortran 90 standard syntax (Fortran 90 isn't picky about which column it starts in, but 7 is certainly acceptable). Compilers that I personally have used with this exact syntax include Elxsi, Sun, Vax, Iris 4D (mips), IBM RS6000, and Lahey F77L (for IBM PCs running DOS). Microsoft Fortran (IBM PC DOS) supports include, but with a different syntax, which I don't recall without checking the manual. My old Iris 3030 also uses a different syntax. The compilers on our SEL GOULD (also known as Encore) systems running MPX-32 support include; I think it was this syntax, but I'd have to recheck before I'd swear it. CDC Cyber systems running NOS (I don't know about the newer ones) did not directly support include, but the UPDATE utility supported a simillar facility with a different syntax; we tended to put our source code in UPDATE libraries and let UPDATE do the inclusion as a preprocessing step. I really don't recall whether IBM mainframes do anything comparable. (Perhaps it's a mental block that protects my sanity by erasing most of the memories of the horrid years that I had to put up with IBM mainframes). On those systems with different syntax, it is pretty easy to write an automatic procedure to change the syntax to the required form. Often it's little more than a single line command. If you are really paranoid, you can easily write an include preprocessor in no more than about a screenful of standard Fortran. Thus, although include is not (currently) standard, it is reasonably portable as long as you are willing to accept simple syntax changing procedures. I find that the use of include saves me a lot more time (mostly by assuring that my common blocks are *always* consistent - a simple typo in one version of a common block can cause many hours of debugging effort). The time saved is far greater than the minor time spent on setting up a few automatic syntax conversion procedures. -- Richard Maine maine@elxsi.dfrf.nasa.gov [130.134.64.6]