GNU Info

Info Node: (g77-295.info)Signal Intrinsic (subroutine)

(g77-295.info)Signal Intrinsic (subroutine)


Next: Sin Intrinsic Prev: Sign Intrinsic Up: Table of Intrinsic Functions
Enter node , (file) or (file)node

Signal Intrinsic (subroutine)
.............................

     CALL Signal(NUMBER, HANDLER, STATUS)

NUMBER: `INTEGER'; scalar; INTENT(IN).

HANDLER: Signal handler (`INTEGER FUNCTION' or `SUBROUTINE') or
dummy/global `INTEGER(KIND=1)' scalar.

STATUS: `INTEGER(KIND=7)'; OPTIONAL; scalar; INTENT(OUT).

Intrinsic groups: `unix'.

Description:

   If HANDLER is a an `EXTERNAL' routine, arranges for it to be invoked
with a single integer argument (of system-dependent length) when signal
NUMBER occurs.  If HANDLER is an integer, it can be used to turn off
handling of signal NUMBER or revert to its default action.  See
`signal(2)'.

   Note that HANDLER will be called using C conventions, so the value
of its argument in Fortran terms Fortran terms is obtained by applying
`%LOC()' (or LOC()) to it.

   The value returned by `signal(2)' is written to STATUS, if that
argument is supplied.  Otherwise the return value is ignored.

   Some non-GNU implementations of Fortran provide this intrinsic as
only a function, not as a subroutine, or do not support the (optional)
STATUS argument.

   *Warning:* Use of the `libf2c' run-time library function `signal_'
directly (such as via `EXTERNAL SIGNAL') requires use of the `%VAL()'
construct to pass an `INTEGER' value (such as `SIG_IGN' or `SIG_DFL')
for the HANDLER argument.

   However, while `CALL SIGNAL(SIGNUM, %VAL(SIG_IGN))' works when
`SIGNAL' is treated as an external procedure (and resolves, at link
time, to `libf2c''s `signal_' routine), this construct is not valid
when `SIGNAL' is recognized as the intrinsic of that name.

   Therefore, for maximum portability and reliability, code such
references to the `SIGNAL' facility as follows:

     INTRINSIC SIGNAL
     ...
     CALL SIGNAL(SIGNUM, SIG_IGN)

   `g77' will compile such a call correctly, while other compilers will
generally either do so as well or reject the `INTRINSIC SIGNAL'
statement via a diagnostic, allowing you to take appropriate action.

   For information on other intrinsics with the same name: Note: Signal
Intrinsic (function).


automatically generated by info2www version 1.2.2.9