Date: 30 May, 2000 00-215
To: J3
From: /interop
Subject: BIND (C) syntax fixes, resolution of item 256
Background:
When attempting to add the BIND (C) attribute to ENTRY statements, /interop
noticed a syntax ambiguity, and upon further investigation determined the
same ambiguity exists for subroutine and function statements. Specifically,
if no arguments are specified, and no parenthesis follow the procedure or
entry name, it is not possible to differentiate the statements from BIND(C)
statements.
BIND(C) SUBROUTINE FRED ! Subroutine statement or BIND(C) statement?
The proposed solution is to place the BIND (C) clause after the argument
list but before the RESULT clause if the statement is a FUNCTION statement.
This edits which follow change the syntax rules, examples of SUBROUTINE and
FUNCTION statements using BIND(C), adds the BIND(C) capability to an ENTRY
statement, and allows BIND(C) to be specified for module procedures.
EDITS:
Fix FUNCTION statements, move constraints and notes to appropriate places,
allow BIND(C) for module procedures.
[265:16] change "([<dummy-arg-name-list>])" to
"([<dummy-arg-name-list>]) [, <proc-language-binding-spec>]
[265:18+] add (and renumber syntax rules)
R 12xx <proc-language-binding-spec> is <language-binding-spec>
"Constraint: A <proc-language-binding-spec> with a <bind-spec>
shall not be specified in the <function-stmt> or
<subroutine-stmt> of an abstract interface body
(12.3.2.1) or an interface body for a dummy
procedure.
Constraint: A <proc-language-binding-spec> shall not be
specified for an internal procedure."
[BEGIN Editor note: apply the following modifications to [265:19-27]
[265:24] delete
[265:27] change "both ELEMENTAL and a <language-binding-spec>
to "ELEMENTAL if <proc-language-binding-spec> is present in
the <function-stmt> or <subroutine-stmt>."
then move [265:19-27] to [267:6+]
END Editor note]
[265:28-31] delete 2 constraints (moved under new syntax rule above)
Modify unresolved issue 151 to reflect above edits
[266:3] delete entire line
[266:4] change "would" to "There should"
[266:4] change "the thing" to "a module procedure"
[266:8-9] change "It has been...,but there" to "There"
[266:19] change "<prefix-spec>" to "<proc-language-binding-spec>"
[266:26] change "<prefix-spec> to "<proc-language-binding-spec>"
[266:30] change "12.33" to "12.35"
[266:47] change "12.33" to "12.35"
[267:1] change "BIND <prefix-spec>" to "<proc-language-binding-spec>"
[267:8] move constraint to [265:16+]
Fix example
[268:27] replace entire line with
"INTEGER (C_INT) FUNCTION JOE (I, J, R), BIND(C,NAME=FrEd")
Fix SUBROUTINE statement
[268:47] change "[(<dummy-arg-list>)]"
to "[(<dummy-arg-list>)] [, <proc-language-binding-spec>]"
Delete unresolved issue 256
[269:23-28] delete
Permit language binding spec on ENTRY statement
[270:5] change "[RESULT (<result-name>)]"
with "[,<proc-language-binding-spec>] [RESULT (<result-name>)]"
Fix examples
[272:9] replace with "SUBROUTINE C_SUB, BIND(C)
[272:11] replace with "INTEGER(C_INT) FUNCTION C_FUNCT(),
BIND(C,NAME="C_funC")"
[388:14] replace with "SUBROUTINE COPY (IN, OUT), BIND(C)"
[390:22] replace with "SUBROUTINE FOO (C), BIND(C)
[393:35] replace with "INTEGER(C_SHORT) FUNCTION FUNC(I,J,K,L,M), BIND(C)"
Misc. edit [271:43-44] change "binding name" to "binding label"