home *** CD-ROM | disk | FTP | other *** search
- /*
- * JOURNAL.H - Common header file for JOURNAL.C and PLAYBACK.C
- *
- * Copyright (c) 1987 by Davide P. Cervone
- * You may use this code provided this copyright notice is kept intact.
- */
-
- #include <libraries/dos.h>
- #include <exec/io.h>
- #include <exec/interrupts.h>
- #include <exec/memory.h>
- #include <devices/input.h>
- #include <devices/inputevent.h>
- #include <stdio.h>
-
- #define ONE 1L
-
- extern struct MsgPort *CreatePort();
- extern struct IOStdReq *CreateStdIO();
- extern LONG AllocSignal(), Wait(), SetSignal();
- extern struct Task *FindTask();
- extern struct InputEvent *AllocMem();
- extern FILE *fopen();
- extern long errno, _OSERR; /* Lattice and DOS error numbers */
-
- extern void RemoveHandler(); /* defined later on */
-
- /*
- * assembly routine that gets called by the Input.Device which sets up
- * the stack and calls our input handler
- */
- extern void myHandlerStub();
-
-
- /*
- * Structure used to pack event data into a small space. This is the
- * format used to record that data in the journal file */
-
- struct SmallEvent
- {
- union
- {
- struct
- {
- UBYTE se_IDType; /* ie_Class and ie_Code combined */
- UBYTE se_Raw; /* RawKey Code */
- UWORD se_PrevChar; /* previous key and qualifier */
- } se_ID;
- ULONG se_XYpos; /* X in bits 0-11, Y in 12-23 (ie_Type in 24-31) */
- } se_Long1;
- UWORD se_Qualifier;
- ULONG se_Long2; /* Micros in 0-19, Ticks in 20-32 */
- };
- #define se_Type se_Long1.se_ID.se_IDType
- #define se_Code se_Long1.se_ID.se_Raw
- #define se_Prev se_Long1.se_ID.se_PrevChar
- #define se_XY se_Long1.se_XYpos
- #define se_Ticks se_Long2
- #define se_Micros se_Long2
- #define se_Count se_Long2
-
- /*
- * Some shorthands for InputEvent fields
- */
- #define my_Prev ie_X
- #define my_Time ie_Secs /* micros since last event */
- #define my_Ticks ie_Mics /* ticks since last event */
- #define my_Ready ie_NextEvent /* TRUE when it can be posted */
- #define my_InUse ie_Class /* TRUE when it is in use */
- #define my_Saved ie_SubClass /* TRUE if is has been recorded */
- #define my_Count my_Time /* number of compressed events */
- #define ie_Secs ie_TimeStamp.tv_secs
- #define ie_Mics ie_TimeStamp.tv_micro
-
- #define COUNTMASK 0x3F /* how much of my_Count is count */
- #define READY ((struct InputEvent *) TRUE)
- #define TIME (theEvent->ie_Mics-TimerMics)
- #define MILLION 1000000
-
- #define XMINMOUSE xminmove
- #define YMINMOUSE yminmove
- #define XDEFMIN 8 /* default DX */
- #define YDEFMIN 8 /* default DY */
- #define LONGTIME 8 /* if this many ticks occur, we */
- /* write out a dummy move to */
- /* record the pause */
-
- #define IE_SIZE sizeof(struct InputEvent)
- #define NEWEVENT AllocMem(IE_SIZE,0)
- #define FREEVENT(ev) FreeMem(ev,IE_SIZE)
-
- #define SIGBREAKF_ANY (SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D |\
- SIGBREAKF_CTRL_E | SIGBREAKF_CTRL_F)
-