HDTenEightyP/NetNews huggingface dataset:
From: jlg@cochiti.lanl.gov (J. Giles)
Subject: Re: ENTRY in main (was re: Jumping from nested subroutine to main directly)
Organization: Los Alamos National Laboratory
Date: Mon, 23 Nov 1992 19:41:32 GMT

In article <lh0rnpINN5ul@exodus.Eng.Sun.COM>, corbett@lupa.Eng.Sun.COM (Robert Corbett) writes:
|> [...]
|> Interestingly, the FORTRAN standard does not contain language
|> prohibiting the main program from being called recursively.
|> Since it does not permit calling the main program at all from
|> within a running program, perhaps such a restriction was felt
|> to be superfluous.
|> 
|> In any case, a main program cannot contain an ENTRY statement.
|> Section 14.2 of X3.9-1978 states
|> 
|>     A main program may contain any other statement except a
|>     BLOCK DATA, FUNCTION, SUBROUTINE, ENTRY, or RETURN
|>     statement.

Actually, by excluding those statements, the standard implicitly
denied the possibility of calling the main program.  You can't
all any Fortran procedure which is neither a FUNCTION, a SUBROUTINE, 
nor an ENTRY into one of those two.  Main programs comntain no globally 
visible names which can be called!  I know, most implementations make 
the name given on the PROGRAM statement a global - but that's not 
required or necessary.  In any case, a standard conforming code
cannot CALL it - because it's not on the list of things which
can be CALLed.

With respect to the original topic: the committee argued for 
ages over some sort of exception handling mechanism for what
became Fortran 90 with no proposal meeting the approval of
anywhere *near* a majority.  Even the concept fell to an
austerity move before the first public review cycle.  At the
time, I didn't even object to its absence - mainly because
I couldn't think of a proposal which could be approved by
such a varied crowd of committee members either.

-- 
J. Giles
Newsgroups: comp.lang.fortran
From: ercolessi@uimrl3.mrl.uiuc.edu (furio ercolessi)
Subject: Re: Understanding ENTRY and Recursion (was Re: ENTRY in main)
Reply-To: ercolessi@uimrl3.mrl.uiuc.edu (furio ercolessi)
Organization: MRL - UIUC
Date: Mon, 23 Nov 1992 21:40:46 GMT

In article <BURLEY.92Nov23121000@apple-gunkies.gnu.ai.mit.edu>, burley@apple-gunkies.gnu.ai.mit.edu
(Craig Burley) writes:

[... candidate for "best post of the month" in c.l.f. ... ]

your tutorial on entry was great!
only one thing left me a bit puzzled:

|>	REAL FUNCTION FOO(I)
|>	FOO = FLOAT (I)
|>	I = I + 1
|>	END
|>
|>But, more specifically, how would this work?
|>
|>	READ *, I, FOO(I)
|>	END
|>
|>Here, only after the value I is read, and while the I/O is still active,
|>do we know what to pass to FOO for preevaluation.

i wouldn't have dreamed of putting a function in a READ list.
do you really mean FOO to be a function? what's the purpose
of the programmer? FOO returns a value, and what is the READ
supposed to do with this value? replace it with another one,
then throw away anything? it is not stupid after all,
since FOO may do useful things in the meanwhile and we
may not need its result.  alas, i have never seen nor done
such a thing.

or do you perhaps mean FOO to be an array element here?

|>Believe me, this kind of thing gives all sorts of problems to those of
|>us who implement Fortran compiler systems, especially on weird
|>architectures or under other such constraints!

we have no difficulty in believing you

--
Furio Ercolessi
Materials Research Laboratory           |   Intl School for Advanced Studies
Univ. of Illinois at Urbana-Champaign   |   Trieste, Italy
furio@uiuc.edu                          |   furio@sissa.it
From: dik@cwi.nl (Dik T. Winter)
Newsgroups: comp.lang.fortran
Subject: Re: Jumping from nested subroutine to main directly?
Date: 24 Nov 92 00:00:00 GMT
Organization: CWI, Amsterdam

In article <1992Nov21.222705.20726@monu6.cc.monash.edu.au> map@hal.maths.monash.edu.au (Michael Page) writes:
 > ags@seaman.cc.purdue.edu (Dave Seaman) writes:
 > >Write a subroutine to do whatever final cleanup is needed. Have
 > >the main program end with a call to the cleanup routine. Have the
 > >cleanup routine finish with a STOP statement, so that it never
 > >returns to the main program.
This fails the request: a return to the main subroutine not a complete bail
out.
 > One way to almost do what he wants is to use an ENTRY statement at the 
 > point he wants to return to in the main program.  However, I suspect he 
 > wants something a bit more `automatic' than that, but I don't think it 
 > exists in FORTRAN.  Does it exist in C, Pascal, ..?
Moreover that will not work at all:
	SUBROUTINE A()
	INTEGER I
	I = 1
	CALL B()
	ENTRY A1()
	PRINT *, I
	RETURN
	END
...
	SUBROUTINE Z()
	CALL A1()
	END
Where Z is called somewhere in the elaboration of B.  This is illegal
(A is called recursively), and hence not portable.  Moreover, if the
system uses a stack, what will be the value printed?  And finally,
the RETURN statement returns back to Z (which in turn returns back to
B, which in turn returns back to A, which in turn might return back to
Z, ad infinitum).
-- 
dik t. winter, cwi, kruislaan 413, 1098 sj  amsterdam, nederland
home: bovenover 215, 1025 jn  amsterdam, nederland; e-mail: dik@cwi.nl
From: ohnielse@fysik.uni-c.dk (Ole Holm Nielsen)
Newsgroups: comp.lang.fortran
Subject: Re: extra 8 bytes
Date: 18 Nov 92 10:22:18 GMT
Reply-To: ohnielse@fysik.uni-c.dk
Organization: UNI-C, Danish Computer Center for Research and Education

In article 1e8i03INNecd@corax.udac.uu.se, l@chiron.astro.uu.se (Lars Kamel) writes:
>In article <1992Oct20.204145.27333@uceng.UC.EDU>, juber@uceng.UC.EDU (James Uber) writes:
>|> When using fortran to write unformated data, e.g.
>|> 
>|> 	open( 10, file=file1, form='unformated')
>|> 	write( 10 ) (real(i),i=1,1000)
>|> 
>|> i get a file length of 4008 bytes, or 8 bytes too much.
>|> I never really cared before, but now i want to use
>|> these unformatted data files in another visualization
>|> system that has the capability to read "raw" data.
>|> I can get around the 4 extra bytes on the front and
>|> back of the file within this system, by telling it
>|> to skip the first word and so on, but is there a way
>|> to tell fortran unformatted write not to do this?
>|> Or, is it an operating system thing?

There was a discussion in this group on the origin and usefulness of
the extra bytes a week or two ago.  The extra bytes are record-length
information.
Newsgroups: comp.lang.fortran
From: jlg@cochiti.lanl.gov (J. Giles)
Subject: Re: The History of Fortran
Organization: Los Alamos National Laboratory
Distribution: na
Date: Mon, 16 Nov 1992 18:32:36 GMT

In article <1992Nov14.171435.2380@biome.bio.ns.ca>, silvert@biome.bio.ns.ca (Bill Silvert) writes:
|> In <BxppLz.C02@news.cso.uiuc.edu> ritley@uimrl7.mrl.uiuc.edu () writes:
|> 
|> >Can anyone suggest any books or references on the history of
|> >Fortran?  I would be curious to know such a things as what machines
|> >it was first written for, who this person Hollerith
|> >is, etc.
|> 
|> Hollerith predates Fortran by many years.  He was a US census official
|> who came up with the idea of using punched cards to store census data.

Actually, the idea he came up with was to automate the census by 
using tabulating machines.  In fact, he invented the very *idea* of 
tabulating machines themselves.  The use of cards was a matter of 
convenience: there were already automated devices for manupulating 
money - these bill sorters and other hardware could be directly
incorporated into his new machinery.  The idea of representing
the information as *holes* in the paper/cardboard "bills" was
*not* Hollerith's (nor was it Jacquard's - whose loom Hollerith
got the idea from - it came from the age-old use of holes-in-paper
to mark the positioning of required pegs in automated musical
instruments).

-- 
J. Giles
From: burley@apple-gunkies.gnu.ai.mit.edu (Craig Burley)
Newsgroups: comp.lang.fortran
Subject: Re: How does one return a logical value...???
Date: 23 Nov 92 11:02:52
Organization: Free Software Foundation 545 Tech Square Cambridge, MA 02139
	<1992Nov20.210324.3906@draco.macsch.com>
	<1emiqnINNrs1@talon.UCS.ORST.EDU>
NNTP-Posting-Host: apple-gunkies.gnu.ai.mit.edu
In-reply-to: pmontgom@math.orst.edu's message of 22 Nov 92 00:04:39 GMT

In article <1emiqnINNrs1@talon.UCS.ORST.EDU> pmontgom@math.orst.edu (Peter Montgomery) writes:

   In article <1992Nov20.210324.3906@draco.macsch.com>
   dnl@convex.is.macsch.com (David Lombard) writes:

   >The following statement is fairly clear:

   >	IF( A.EQ.B .EQV. C.EQ.D ) ...

   >What would you do with this phantom?

   >	IF( A.EQ.B .EQ. C.EQ.D ) ...


	   There is no ambiguity if A, B, C, D are all type logical,
   since logical equality is an associative operation
   (A .EQV. (B .EQV. C))  is equivalent to  ((A .EQV. B) .EQV. C).
   If the operands are numeric, they can be paired off starting from the left.

You apparently haven't been reading the thread, so your comment is not helpful.

First of all, A, B, C, and D, are _not_ LOGICAL, else the example would be
equivalent to

    IF( A.EQV.B .EQV. C.EQV.D ) ...

Second of all, I doubt your claim of nonambiguity would hold up well if
you replace, say, the second .EQ./.EQV. with .NE./.NEQV..
--

James Craig Burley, Software Craftsperson    burley@gnu.ai.mit.edu
Member of the League for Programming Freedom (LPF) lpf@uunet.uu.net
Newsgroups: comp.lang.fortran
From: ercolessi@uimrl3.mrl.uiuc.edu (furio ercolessi)
Subject: Re: a question on ATAN function
Reply-To: ercolessi@uimrl3.mrl.uiuc.edu (furio ercolessi)
Organization: MRL - UIUC
Date: Mon, 23 Nov 1992 21:43:59 GMT

In article <dedmunds.722548228@sfu.ca>, dedmunds@selkirk.sfu.ca (Darran Edmundson) writes:
|>I'd like to pose a neophyte question on using the arctan function to
|>calculate the phase angle of a complex variable (i.e. \theta = atan(v/u)
|>where u and v are the real and complex parts of my imaginary number
|>respectively). 

atan2, which takes u and v as two separate arguments, is what
you want!
--
Furio Ercolessi
Materials Research Laboratory           |   Intl School for Advanced Studies
Univ. of Illinois at Urbana-Champaign   |   Trieste, Italy
furio@uiuc.edu                          |   furio@sissa.it
From: l@chiron.astro.uu.se (Lars Kamel)
Newsgroups: comp.lang.fortran
Subject: Re: extra 8 bytes
Date: 16 Nov 1992 16:24:35 GMT
Organization: Uppsala University
Distribution: world
NNTP-Posting-Host: chiron.astro.uu.se

In article <1992Oct20.204145.27333@uceng.UC.EDU>, juber@uceng.UC.EDU (James Uber) writes:
|> When using fortran to write unformated data, e.g.
|> 
|> 	open( 10, file=file1, form='unformated')
|> 	write( 10 ) (real(i),i=1,1000)
|> 
|> i get a file length of 4008 bytes, or 8 bytes too much.
|> I never really cared before, but now i want to use
|> these unformatted data files in another visualization
|> system that has the capability to read "raw" data.
|> I can get around the 4 extra bytes on the front and
|> back of the file within this system, by telling it
|> to skip the first word and so on, but is there a way
|> to tell fortran unformatted write not to do this?
|> Or, is it an operating system thing?
|> 
|> Thank you,
|> jim uber
|> univ. of cincinnati
|> juber@uceng.uc.edu
|> -- 
|> --
|> james uber
|> juber@uceng.uc.edu
I have had the same problem when programming on a VAX/VMS system. Based on
my expirence, I propose that you change your code to (if your compiler
allows it):
      open( 10, file=file1, form='unformatted', recordtype='fixed',
     +          access='direct', recl=1000)
      write( 10, rec=1) (real(i),i=1,1000)

Lars Kamel (lars@laban.uu.se)
Newsgroups: comp.lang.fortran
From: wws@craywr.cray.com (Walter Spector)
Subject: Re: Jumping from nested subroutine
Organization: Cray Research, Inc.
Date: 23 Nov 92 14:39:08 CST

Interesting question.

The much-maligned 'assigned GOTO' is the Standard Fortran version of
setjmp and longjmp.  But assigned GOTO, by the Standard, is limited in
scope to a single program unit.  I've heard that an implementation or two
accidently support passing what amounts to a LABEL data type down the
calling chain.  Then you can 'GOTO label' where you want to longjmp.
(I'd be fascinated to know who supports it!)

	assign 10 to label
	call suba (label)	!! Standard... (see below) !!
     10	continue
	...
	end
	subroutine suba (label)
	...
	goto label		!! Non-Standard !!

WARNING: If the above accidently works on your computer, your compiler
vendor will probably consider it to be a bug.  Not a feature.
If your compiler accidently allows this, and you depend on it,
comment your code well.  Because next time you change compilers or
port your code to a different machine it WILL break.

In article <By6Ast.BA1@pgroup.com>, lfm@pgroup.com (Larry Meadows) writes:
|> Well, I can't resist...
|> 
|> What the original poster wants is called non-local GOTO in pascal, and
|> setjmp/longjmp in C.
|> ...
|>   If fortran entry point's don't exist, I'd
|> be inclined to hack the object to create them.

You would have to be careful when using setjmp in a Fortran
program.  You might write a Fortran-callable glue routine in C
for setjmp and longjmp.  But that glue routine would then have
present in the calling tree in order to work (I.e., the glue
routine would then have to call SUBA in the example above).
A simple setjmp interface would not work since there would be
no link back to your original routine after a longjmp was taken.

Maybe a LABEL data type is needed in the next rev of the Standard?
Labels are used in several places - assigned GOTO, alternate RETURN,
formats, etc.  It really isn't wise to overload numeric variable names
with these labels (shades of Hollerith constants?)  IMHO, assigned GOTO
should not have been depricated in Fortran-90 since sometimes there
is no alternative.  For example, consider the following:

	assign 10 to label1
	assign 20 to label2
	call suba (label1,label2)	!! Standard
     10 continue
	...
     20 format (10x,8f5.3)
	end
	subroutine suba (label1,label2)
	...
	write (6,label2) array		!! Standard !!
	goto label1			!! Non-Standard !!

In the above, the label is legal for the format, but is illegal for
a non-local jump.  Kind of inconsistent.

Walt
----
Walt Spector
(wws@renaissance.cray.com)
Sunnyvale, California
_._ _._ _.... _. ._.
Newsgroups: comp.lang.fortran
From: ctrbdo@iapa.uucp%mailhost.ecn.uoknor.edu (bryan d oakley)
Subject: ENTRY in main (was re: Jumping from nested subroutine to main directly)
Organization: FAA / Mike Monroney Aeronautical Center
Date: Sun, 22 Nov 1992 20:46:34 GMT

>== Michael Page writes:
> One way to almost do what he wants is to use an ENTRY statement at
> the point he wants to return to in the main program.  However, I
> suspect he wants something a bit more `automatic' than that, but I
> don't think it exists in FORTRAN.  Does it exist in C, Pascal, ..?

Hmmm... I've been programming FORTRAN for 10ish years (if you count
college) and NEVER thought to put an ENTRY in the main program,
though at first glance it seems to be the only time I might consider
using an ENTRY point (yes, I'm one of the people that frowns :-( on
the use of ENTRY points).

Question: what does this do to the stack?  If you kept jumping back to
the main routine everytime you had an error, and never 'returned' from
the routine causing the error, wouldn't the stack just grow un-
controllably?  Also, wouldn't this be considered recursion, since a
routine subordinate to main (effectively) calls main?  I'm guessing
the code would look like this (pardon the GOTOs :-):

	program example

c	top of main loop:
10	    <get input...>
	    <process input ...>
	    <produce output ...>
	    if (.not. done) goto 10
	    goto 20
c	end of main loop...

	ENTRY error
	<process error condition>
	if (.not. fatal) goto 10
	goto 20

20	end


Does anybody do this in the real world?

-- 
----------------------------------------------------------------------
Instrument Approach Procedures Automation              DOT/FAA/AMI-230
----------------------------------------------------------------------
Bryan D. Oakley                    ctrbdo%iapa@mailhost.ecn.uoknor.edu
Newsgroups: comp.lang.fortran
From: cpr4k@holmes.acc.Virginia.EDU (Christian P. Roberts)
Subject: Fortran 90 Examples
Organization: Academic Computing Center - U.Va.
Date: Wed, 18 Nov 1992 20:11:47 GMT


I am learning Fortran 90 through _Fortran_90_Explained_, by 
Metcalf and Reid.  I have run into several snags trying to 
implement some of the new features.

Does anyone have any example codes that use modules, interfaces,
external subroutines, argument intent, etc. that s/he would be
willing to share.  As is often the case, if you can see one example
that does it right, you're in business.

-- 

Chris Roberts                     ITC/Academic Computing Center
cpr4k@virginia.edu                University of Virginia           
(804) 982-4693                    Charlottesville, Virginia 22903
Newsgroups: comp.lang.fortran
From: shenkin@still3.chem.columbia.edu (Peter Shenkin)
Subject: Re: Jumping from nested subroutine to main directly?
Organization: Dept. of Chem, Columbia U, New York
Date: Sat, 21 Nov 1992 19:56:09 GMT
X-Posted-From: still3.chem.columbia.edu
NNTP-Posting-Host: sol.ctr.columbia.edu

In article <1992Nov21.015026.17820@netcom.com> jchauvin@netcom.com (John H. Chauvin) writes:
>Is it possible to transfer control from a nested subroutine directly to the 
>main routine without have to execute multiple returns from all the 
>subroutines in between?  I would like a way of exiting directly to the main 
>routine when a error is detected six or seven subroutines down.

No, you cannot;  but executing the multiple returns can be simplifed by
the adoption of the alternate return dummy parameter for the use of
error handling.  (The sole use, preferably.)

	-P.
-- 
************************f*u*cn*rd*ths*u*cn*gt*a*gd*jb*************************
Peter S. Shenkin  shenkin@still3.chem.columbia.edu   Columbia Univ., Chemistry
********* DEMOCRACY:  The theory that the people know what they want, ********
********** and deserve to get it good and hard.  -- H. L. Mencken ************
Organization: Doctoral student, Industrial Administration, Carnegie Mellon, Pittsburgh, PA
Newsgroups: comp.lang.fortran
Date: Wed, 18 Nov 1992 20:36:02 -0500 
From: "Bruno W. Repetto" <br0w+@andrew.cmu.edu>
Subject: Re: How does one return a logical value...???

Excerpts from netnews.comp.lang.fortran: 18-Nov-92 How does one return a
logic.. by Conrad W Taylor@cs.uiuc. 
> From: ctaylor@cs.uiuc.edu (Conrad W Taylor)
> Subject: How does one return a logical value...???
> Date: Wed, 18 Nov 1992 10:52:22 GMT
>  
>          I have written a function which returns a logical
> value, CheckActivity(previous, ROWS, COLS), previous is an
> array.  I'm using it like this:
>  
>  
> My compiler says that I have mixed types when I use .TRUE. .  What
> should I use I tried T instead of .TRUE. . It doesn't give errors
> but it doesn't increment the uncontrol... it never goes into the
> IF statement; skips it completely.  I'm new to FORTRAN and please
> if anyone knows what I should do, let me know via e-mail.  Thanks
> in advance to all that reply to my e-mail.
>  
> -Conrad
>  
>  

You should have the following in your calling (sub)program:

       logical CheckActivity
.
.
.
         IF (CheckActivity(previous, ROWS, COLS) .EQ.  .TRUE.) THEN
           uncontrol = uncontrol + 1
         ENDIF
.
.
.
And in your function declaration:
       logical function CheckActivity(... arguments...)

The presence of the 'logical CheckActivity' declaration in the calling
subprogram is required.  If you compiled the two modules separately, and
the calling subprogram didn't have the logical declaration, then the
linker will link wierd code... Most compilers will notice if something
is out of order if the modules are compiled in a single file, but will
fail to warn you if they are compiled separately; you may or may not get
a runtime error.  Was this your case?

My 2 rubber ningis worth.  (Stolen from someone.)

Bruno. br0w+@andrew.cmu.edu
From: corbett@lupa.Eng.Sun.COM (Robert Corbett)
Newsgroups: comp.lang.fortran
Subject: Re: ENTRY in main (was re: Jumping from nested subroutine to main directly)
Date: 23 Nov 1992 05:41:13 GMT
Organization: Sun Microsystems, Mt. View, Ca.
NNTP-Posting-Host: lupa

In article <By4xpo.FG@iapa.uucp%mailhost.ecn.uoknor.edu> ctrbdo@iapa.uucp%mailhost.ecn.uoknor.edu (bryan d oakley) writes:
>>== Michael Page writes:
>> One way to almost do what he wants is to use an ENTRY statement at
>> the point he wants to return to in the main program.
>
>Hmmm... I've been programming FORTRAN for 10ish years (if you count
>college) and NEVER thought to put an ENTRY in the main program,
>though at first glance it seems to be the only time I might consider
>using an ENTRY point (yes, I'm one of the people that frowns :-( on
>the use of ENTRY points).
>
>Question: what does this do to the stack?  If you kept jumping back to
>the main routine everytime you had an error, and never 'returned' from
>the routine causing the error, wouldn't the stack just grow un-
>controllably?  Also, wouldn't this be considered recursion, since a
>routine subordinate to main (effectively) calls main?

Interestingly, the FORTRAN standard does not contain language
prohibiting the main program from being called recursively.
Since it does not permit calling the main program at all from
within a running program, perhaps such a restriction was felt
to be superfluous.

In any case, a main program cannot contain an ENTRY statement.
Section 14.2 of X3.9-1978 states

    A main program may contain any other statement except a
    BLOCK DATA, FUNCTION, SUBROUTINE, ENTRY, or RETURN
    statement.


					Yours truly,
					Robert Corbett
*
*
*
*
*
*
*
*
*
*
From: c9e-aw@volga (Claudio Fahey)
Newsgroups: comp.lang.fortran
Subject: Looking for a shareware DOS or OS/2 fortran compiler
Date: 22 Nov 92 05:47:43 GMT
Organization: University of California, at Berkeley

Does anybody know of a shareware or public domain fortran
compiler for DOS or OS/2?  If so, where could I get it?
Thanks a lot.
Newsgroups: comp.lang.fortran
From: ercolessi@uimrl4.mrl.uiuc.edu (furio ercolessi)
Subject: Re: Print characters on one line without newline...???
Reply-To: ercolessi@uimrl4.mrl.uiuc.edu (furio ercolessi)
Organization: MRL - UIUC
Date: Mon, 16 Nov 1992 19:49:53 GMT

In article <BxtnK6.23s@cs.uiuc.edu>, ctaylor@cs.uiuc.edu (Conrad W Taylor) writes:
|>         I'm writting this PrintX routine that is to print
|>the letter X n times on one line without any spaces and
|>newline.  My PrintX routine looks like this:
|> [...]
|>
|>This routine only prints one 'X' on n lines and I want it to print
|>n X's on one line without any spaces in between and without a new-
|>line character.  Could someone explain what I might be doing wrong?

I do not think this can be done using standard Fortran.
Many compilers, however, offer a FORMAT extension usually
called $ which allows this, and works as follows:

      SUBROUTINE PrintX(XCOUNT)
        INTEGER XCOUNT

        INTEGER i

        DO 10 i=1, XCOUNT
          PRINT 20
  10    CONTINUE
  20    FORMAT($, 'X')

        PRINT *
        
        RETURN
        END

You may have a hard time in doing this on IBM mainframes :-)
--
Furio Ercolessi
Materials Research Laboratory           |   Intl School for Advanced Studies
Univ. of Illinois at Urbana-Champaign   |   Trieste, Italy
furio@uiuc.edu                          |   furio@sissa.it
Newsgroups: comp.lang.fortran