请教fortran语言命令entry
发布网友
发布时间:2022-04-13 06:33
我来回答
共1个回答
热心网友
时间:2022-04-13 08:03
够详细吧?
ENTRY
Statement: Provides one or more entry points within a subprogram. It is not executable and must precede any CONTAINS statement (if any) within the subprogram.
Syntax
ENTRY name [ ( [d-arg [, d-arg ] ...] ) [RESULT (r-name)] ]
name
Is the name of an entry point. If RESULT is specified, this entry name must not appear in any specification statement in the scoping unit of the function subprogram.
d-arg
(Optional) Is a mmy argument. The mmy argument can be an alternate return indicator (*) if the ENTRY statement is within a subroutine subprogram.
r-name
(Optional) Is the name of a function result. This name must not be the same as the name of the entry point, or the name of any other function or function result. This parameter can only be specified for function subprograms.
Rules and Behavior
ENTRY statements can only appear in external proceres or mole proceres.
An ENTRY statement must not appear in a CASE, DO, IF, FORALL, or WHERE construct, or a nonblock DO loop.
When the ENTRY statement appears in a subroutine subprogram, it is referenced by a CALL statement. When the ENTRY statement appears in a function subprogram, it is referenced by a function reference.
An entry name within a function subprogram can appear in a type declaration statement.
Within the subprogram containing the ENTRY statement, the entry name must not appear as a mmy argument in the FUNCTION or SUBROUTINE statement, and it must not appear in an EXTERNAL or INTRINSIC statement. For example, neither of the following are valid:
(1) SUBROUTINE SUB(E)
ENTRY E
...
(2) SUBROUTINE SUB
EXTERNAL E
ENTRY E
...
An ENTRY statement can reference itself if the function or subroutine subprogram was defined as RECURSIVE.
Dummy arguments can be used in ENTRY statements even if they differ in order, number, type and kind parameters, and name from the mmy arguments used in the FUNCTION, SUBROUTINE, and other ENTRY statements in the same subprogram. However, each reference to a function, subroutine, or entry must use an actual argument list that agrees in order, number, and type with the mmy argument list in the corresponding FUNCTION, SUBROUTINE, or ENTRY statement.
Dummy arguments can be referred to only in executable statements that follow the first SUBROUTINE, FUNCTION, or ENTRY statement in which the mmy argument is specified. If a mmy argument is not currently associated with an actual argument, the mmy argument is undefined and cannot be referenced. Arguments do not retain their association from one reference of a subprogram to another.
Compatibility
CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB
See Also: Program Units and Proceres, ENTRY Statements in Function Subprograms, ENTRY Statements in Subroutine Subprograms
Example
C This fragment writes a message indicating
C whether num is positive or negative
IF (num .GE. 0) THEN
CALL Sign
ELSE
CALL Negative
END IF
...
END
SUBROUTINE Sign
WRITE (*, *) 'It''s positive.'
RETURN
ENTRY Negative
WRITE (*, *) 'It''s negative.'
RETURN
END SUBROUTINE
【 在 gaowj (john) 的大作中提到: 】
: 树上仅仅是简单的查到:
: 为子例程子程序和函数提更第二个入口
: 一般形式为:
: ...................