Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    void _chain_intr( void (__interrupt __far *func)() );
    #include <dos.h>

Description:
    The _chain_intr function is used at the end of an interrupt routine to
    start executing another interrupt handler (usually the previous handler
    for that interrupt).  When the interrupt handler designated by func
    receives control, the stack and registers appear as though the interrupt
    just occurred.

Returns:
    The _chain_intr function does not return.

See Also:
    _dos_getvect, _dos_keep, _dos_setvect

Example:
    #include <stdio.h>
    #include <dos.h>

    volatile int clock_ticks;
    void (__interrupt __far *prev_int_1c)();
    #define BLIP_COUNT  (5*18)  /* 5 seconds */

    void __interrupt __far timer_rtn()
      {
        ++clock_ticks;
        _chain_intr( prev_int_1c );
      }

    int delays = 0;

    int compile_a_line()
      {
        if( delays > 15 ) return( 0 );
        delay( 1000 );  /* delay for 1 second */
        printf( "Delayed for 1 second\n" );
        delays++;
        return( 1 );
      }

    void main()
      {
        prev_int_1c = _dos_getvect( 0x1c );
        _dos_setvect( 0x1c, timer_rtn );
        while( compile_a_line() ) {
            if( clock_ticks >= BLIP_COUNT ) {
                putchar( '.' );
                clock_ticks -= BLIP_COUNT;
            }
        }
        _dos_setvect( 0x1c, prev_int_1c );
      }

Classification:
    WATCOM

Systems:
    DOS, Win/16

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson