next up previous index
Next: Z041 Restart of Up: CERNLIB Previous: Z036 Intercept a

Z037 Routines to Handle Control-C Interrupts on Vax

Routine ID: Z037
Author(s): C. MekenkampLibrary: KERNLIB
Submitter: R. VeenhofSubmitted: 10.03.1988
Language: Fortran, Vax MacroRevised:

These routines allow you to write a program that, when interrupted with a control- C, resumes execution in a routine that you specify, which is higher up in the calling tree.

Structure:

Vax Macro and Vax Fortran routines
User Entry Names: ASTINT, ASTXIT, ASTDCC, ASTECC, ASTSCS, ASTECS
Internal Entry Names: ASTCCH

Usage:

VAXAST should be initialised at the beginning of the program by

    CALL ASTINT
The routine to which control should be returned after a control- C has been typed, should have in its header
    EXTERNAL ASTCCH
    CALL LIB$ESTABLISH(ASTCCH)
When a control- C is typed on the terminal, ASTCCH is called. This routine is part of VAXAST, its main job is to unwind the stack of routine calls until the routine is found in which the LIB$ESTABLISH was issued. Your program then continues execution just after the call to the routine that was interrupted. You may have several routines with the header shown above. Only the last call to LIB$ESTABLISH has effect.

When you no longer wish to make use of the VAXAST routines:

    CALL ASTXIT
You may not wish to have control- C trapped all the time, for instance when the program is waiting for input. To suspend trapping for a short while, do the following:
       CALL ASTDCC
       ...
       CALL ASTECC
Between ASTDCC and ASTECC a control- C typed on the terminal has the same effect as a control- Y, i.e. stopping the program and returning to DCL. Execution can, as with control- Y, be resumed at the point it was interrupted, via the CONTINUE command.

Not all programs survive the stack unwind ASTCCH performs. A classical example is the set of I/O routines in the Vax Fortran run time library (RTL). VAXAST replaces those routines by variants that are stack unwind proof but perform otherwise identical tasks. You will see 29 messages about multiply defined symbols when you LINK your program, you can safely ignore them.

If there is a part in your own program where the stack should not be unwound but during which you would like a control- C to be stored, do the following:

    CALL ASTSCS
    ...
    CALL ASTECS
A control- C typed between the ASTSCS and ASTECS calls remains 'dormant' and takes effect only at the ASTECS call.

Notes:

1988 C.A.J. Mekenkamp. All Rights Reserved.
Carlo Mekenkamp, President Krugerstraat 42, NL-1975 EH IJmuiden.

Z041



next up previous index
Next: Z041 Restart of Up: CERNLIB Previous: Z036 Intercept a


Janne Saarela
Mon Apr 3 15:06:23 METDST 1995