Chapter Contents |
Previous |
Next |
User-Added Signals |
To add a user signal to the library, you must write at least two routines. (Depending on your needs, more routines may be necessary.) Routines for Adding Signals lists the routines you may need to write to define and control a new signal. The table also indicates the preferred language for each routine. Most routines can be written in either C or assembler language.
Assembler routines called by the SAS/C Library rather
than by the operating system can use the
CENTRY
and
CEXIT
macros for function linkage. (Refer to Chapter 11, "Communication with Assembler
Programs," in SAS/C Compiler and Library User's Guide, for information
on the
CENTRY
and
CEXIT
macros.)
Assembler routines that call C functions must use the
CENTRY
and
CEXIT
macros to run successfully when either
the optimized or minimal form of function linkage is in use. Refer to Chapter
9, "Run-Time Argument Processing," of the SAS/C Compiler
and Library User's Guide for more information on the
=optimize
and
=minimal
options.
Note:
A routine
that calls operating system macros is usually written
in assembler language.
Note that all of the routines in Routines for Adding Signals except the jump intercept routine can be coded in either C or assembler. This table simply indicates which language is preferred.
Initialization Routine and sigdef Function |
To add a signal to the library, you
must code an initialization routine. This routine is usually coded in assembler
language. The initialization routine calls the
sigdef
function to define the signal. The initialization routine also
calls an operating system macro to establish the address of the operating
system exit that should be invoked when the signal occurs. For example, to
define a CMS I/O interrupt signal called
SIGIOI
, the initialization routine may issue calls similar to the ones
here. The call to
sigdef
in assembler might look like the following:
LA R1,DEFPARMS L R15,=V(SIGDEF) BALR R14,R15 sigdef(SIGASY1,0,0,0,0,"IOI"); DEFPARMS DC A(SIGASY1) symbol definition obtained by * "COPY SIGNALS" DC 4A(0) DC A(SIGNAME) SIGNAME DC C'IOI',X'00'
The call to
sigdef
renames SIGASY1 to SIGIOI but does not define any special routines
for processing the signal (indicated by the 0s for the second DC in the DEFPARMS
area).
A sample call to the CMS HNDINT macro to handle the interrupt might look like the following:
HNDINT SET,(TAP1,EXIT,unit,ASAP)
The call to HNDINT identifies the
I/O unit number that causes the interrupt (
unit
) and the address of the operating system exit routine (
EXIT
) that you code to generate the signal for
the library.
Note:
It is possible to raise, handle, or block a user signal before it has been
defined by a call to
sigdef
.
When
sigdef
is called,
it has no effect on the signal's status; that is, the signal remains blocked
or unblocked, and any user handler remains in effect. However, if the call
to
sigdef
defines a default
handler, this default replaces the previous default handler.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.