/* -------------------------------------------------------------------- */
/*                                                                      */
/* FILE : trap.h                                                        */
/*                                                                      */
/* DESC : Interrupt Interface Implementation.                           */
/*                                                                      */
/* PROJ : CSA\sampler.                                                  */
/*                                                                      */
/* CREATED  16.02.98 19:37    by L&M.                                   */
/*                                                                      */
/*                                                                      */
/*                                     1995-98 (c) by Leonid Moiseichuk */
/* -------------------------------------------------------------------- */

#ifndef __trap_h
#define __trap_h

/* ==========================[ includes ]============================== */

#ifndef __timer_h
#include "timer.h"
#endif

#ifdef __cplusplus //IV
    #define __CPPARGS ...
#else
    #define __CPPARGS
#endif

typedef void interrupt (*VarFunc)(__CPPARGS); /* interrupt function pointer */


/* ===========================[ classes ]============================== */

class far Trap
{
   public :

      Trap( int iNum );
      virtual ~Trap();

      virtual int InterruptHandler() = 0;
         // If return zero, then unregister interrupt and quit

   protected :

      void RegisterInterrupt();
      void UnregisterInterrupt();

      friend void interrupt InterruptEntry(unsigned, unsigned DI, unsigned SI);

   public :

      unsigned di;
      unsigned si;

   private :

      int  Vector ;
      VarFunc OldHandler ;

      static Trap* CurrentTrap ;
}; // Class Trap


#endif // Sentry of __trap_h
Соседние файлы в папке Samp16