home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * BINTERV.H Header file for TURBO C TOOLS Intervention Functions
- *
- * Version 6.00 (C)Copyright Blaise Computing Inc. 1987, 1989
- *
- **/
-
- #ifndef DEF_BINTERV /* Prevent redefinition. */
-
- typedef struct /* IV_KEY: Specifies one hot key. */
- { /* */
- char ch; /* Character value. */
- char keycode; /* Key code (pseudo-scan code). */
- int action; /* Action to be taken when this key is */
- /* detected (see possibilities below). */
- } IV_KEY;
-
- /* Key actions */
- /* */
- #define IV_KY_NONE 0 /* No hot key pressed. */
- #define IV_KY_SERVICE 1 /* Invoke intervention function. */
- #define IV_KY_SLEEP 2 /* Put intervention function to sleep. */
- #define IV_KY_WAKE 3 /* Awaken intervention function. */
-
- typedef struct /* IV_TIME: Specifies time of day or */
- { /* time interval for intervention code.*/
- /* */
- long ticks; /* Clock ticks since midnight or */
- /* between invocations. */
- int action; /* Type of time event (moment or */
- /* interval). */
- } IV_TIME;
-
- /* Time actions */
- /* */
- #define IV_TM_NONE 0 /* No time event occurred. */
- #define IV_TM_INTERVAL 1 /* Regular interval between invocations.*/
- #define IV_TM_MOMENT 2 /* Time of day. */
-
- typedef struct /* IV_EVENT: Event that triggered the */
- { /* intervention function. */
- /* */
- IV_KEY key; /* Hot key found, if any. */
- /* */
- int time_action; /* Type of timer event (moment or */
- /* interval), if any. */
- int time_index; /* Index of timer event in table. */
- long time; /* Current time of day, measured in */
- /* clock ticks since midnight. */
- } IV_EVENT;
-
- typedef struct /* IV_VECTORS: set of interrupt */
- { /* vectors used by intervention code. */
- /* */
- const void far *ptimer; /* INT 08h: Timer tick. */
- const void far *pkeybd; /* INT 09h: Keystroke. */
- const void far *pdisk; /* INT 13h: BIOS disk services. */
- const void far *pdos; /* INT 21h: DOS functions. */
- const void far *pidle; /* INT 28h: DOS idle. */
- /* */
- const void far *pcom1; /* INT 0ch: Comm port 1 hardware event.*/
- const void far *pcom2; /* INT 0bh: Comm port 2 hardware event.*/
- } IV_VECTORS;
-
- typedef struct /* IV_CTRL: intervention control block */
- { /* */
- unsigned int signature; /* Signature identifying this structure.*/
- unsigned int sign2; /* One's complement of "signature". */
- char ident[16]; /* Identifying name. */
- unsigned int psp; /* PSP of this program. */
- int enabled; /* Nonzero if enabled (this prevents the*/
- /* filters from being installed twice).*/
- void far *pgate; /* Gateway for invoking this program */
- /* from outside. */
- IV_VECTORS prev_vec; /* Previous values of interrupt vectors.*/
- /* */
- char dos_need; /* Nonzero if intervention function */
- /* uses DOS services. */
- char dkey_need; /* Nonzero if intervention function */
- /* uses DOS functions 1-12. */
- /* */
- IV_KEY far *pkeytab; /* Table of hot keys. */
- int ktsize; /* Size of hot key table. */
- /* */
- IV_KEY key_event; /* Found key, if any. */
- /* */
- /* Internal state of filters: */
- /* */
- char wait; /* Nonzero if INT 21h or INT 28h filter */
- /* is cycling, waiting for the */
- /* intervention function to be invoked.*/
- char req; /* Nonzero if intervention function */
- /* needs invocation. */
- char awake; /* Zero if intervention function is */
- /* asleep. */
-
- /* Busy flags: */
- char timer_busy; /* INT 08h filter. */
- char kb_busy; /* INT 09h filter. */
- char com2_busy; /* INT 0bh filter. */
- char com1_busy; /* INT 0ch filter. */
- char disk_busy; /* INT 13h filter. */
- char idle_busy; /* INT 28h filter. */
- /* */
- char idle_safe; /* Nonzero if INT 0x28 is in progress */
- /* and DOS functions are available */
- /* (but not functions 1-12). */
- /* */
- void far *pschedblk; /* Entry point into scheduler's ISR */
- /* control block. */
- /* */
- const volatile unsigned /* Address of DOS critical section flag */
- char far *pdos_crit; /* (busy flag). */
- /* */
- const void far * /* Address of previous interrupt 0x16 */
- prev_16h_vec; /* handler (if replaced). */
- /* */
- char cbreak; /* Nonzero if Ctrl-C or Ctrl-Break */
- /* detected during this invocation of */
- /* the intervention function. */
- /* */
- unsigned char no_call; /* Nonzero if user wants to prevent */
- /* invocation of intervention function.*/
- /* */
- unsigned filter_mask; /* Bit map of installed filters. */
- /* */
- unsigned char kb_ext; /* Nonzero if extended BIOS keyboard */
- /* services to be used. */
- /* */
- char _res0; /* Reserved for future use. */
- /* */
- char _reserved[8]; /* Reserved for future use. */
- } IV_CTRL;
-
- #define IV_SIGNATURE (('2' << 8) | 'B') /* "B2" */
-
- /* Option values for IVINSTAL. */
-
- #define IV_DOS_NEED 1 /* Intervention function uses DOS. */
- #define IV_NO_DOS_NEED 0 /* Intervention function doesn't use */
- /* DOS. */
-
- #define IV_DKEY_NEED 2 /* Intervention function uses DOS */
- /* functions 1-12. */
- #define IV_NO_DKEY_NEED 0 /* Intervention function doesn't use */
- /* DOS functions 1-12. */
-
- #define IV_FLOAT_NEED 4 /* Intervention function uses floating */
- /* point interrupt vectors while other */
- /* programs do so also. */
- #define IV_NO_FLOAT_NEED 0 /* */
-
- #define IV_DAILY 8 /* "Moment" events to recur daily. */
-
- /* Option values for IVVECS. */
-
- #define IV_RETVEC 1 /* Return current values of interrupt */
- /* vectors. */
- #define IV_SETVEC 0 /* Set interrupt vectors. */
-
- /* Symbols for error codes */
-
- #define IV_NO_ERROR 0
- #define IV_NOT_ENABLED 1
- #define IV_NOT_INSTALLED 2
- #define IV_NULL_POINTER 3
- #define IV_BAD_OPT 4
- #define IV_INSTALLED 5
- #define IV_PART_COVERED 6
- #define IV_NOT_FOUND 7
-
- /* Symbols for intervention filters (used for filter_mask). */
-
- #define IV_F_TIMER 0x0001 /* INT 08h: Timer tick. */
- #define IV_F_KEYSTROKE 0x0002 /* INT 09h: Keystroke. */
- #define IV_F_DISK 0x0004 /* INT 13h: BIOS disk services.*/
- #define IV_F_DOS 0x0008 /* INT 21h: DOS functions. */
- #define IV_F_IDLE 0x0010 /* INT 28h: DOS idle. */
- #define IV_F_2COM 0x0020 /* INT 0ch: Comm port 1 */
- #define IV_F_1COM 0x0040 /* INT 0bh: Comm port 2 */
-
- #define IV_STD_FILTERS \
- (IV_F_TIMER | IV_F_KEYSTROKE | IV_F_DISK | IV_F_DOS | IV_F_IDLE)
- #define IV_COM_FILTERS (IV_F_2COM | IV_F_1COM)
-
- /* Internal symbols */
-
- #define IV_RESCHED 0x40000000L /* Mask for rescheduling */
- /* "moment" events. */
-
- /* Global variables. */
-
- extern int b_ivusex; /* Whether to use extended */
- /* keyboard services when */
- /* testing for hot keys: */
- /* KB_USE_EXTEND or */
- /* KB_USE_NORMAL. */
-
- extern unsigned b_ivmask; /* Mask indicating which */
- /* intervention filters to use. */
-
- /* Function declarations */
-
- /* Install intervention function*/
- int cdecl ivinstal(void (*)(IV_EVENT *),
- const char *, /* */
- char *,int, /* */
- IV_KEY *,int, /* */
- IV_TIME *,int, /* */
- int); /* */
- /* */
- int cdecl ivdetect( /* Detect presence of possibly */
- const IV_VECTORS far *, /* obscured intervention */
- const char far *, /* function. */
- IV_CTRL far **,unsigned far *); /* */
- /* */
- IV_CTRL far * cdecl ivsense( /* Detect presence of removable */
- const IV_VECTORS far *, /* intervention function. */
- const char far *); /* */
- /* */
- int cdecl ivdisabl(IV_CTRL far *); /* Disable intervention function*/
- /* */
- int cdecl ivvecs(int, /* Set or return interrupt */
- IV_VECTORS far *); /* vectors used by the */
- /* intervention filters. */
- /* */
- IV_CTRL far * cdecl ivctrl(void); /* Return address of this */
- /* program's intervention */
- /* control block. */
-
- #define DEF_BINTERV 1 /* Prevent second reading of */
- /* these definitions. */
-
- #endif /* Ends "#ifndef DEF_BINTERV" */