diff --git a/inc/devif.h b/inc/devif.h index fb40093..e2de90c 100644 --- a/inc/devif.h +++ b/inc/devif.h @@ -56,37 +56,36 @@ typedef struct unsigned height; } MRegion; - - /**************************************************************/ /* D e v R e c */ /* */ /* Definition common to all devices. Used for mouse, kbd and */ -/* display. */ +/* display. The xxxInterfaceRec containing this device is */ +/* passed as the only argument to the device methods */ /**************************************************************/ -typedef struct DevRec +typedef struct { int active; /* ACTIVE, a flag. TRUE if this device is activated. Use this to prevent multiple consecutive initializations. */ int locked; /* LOCK, a semaphore: 0 if dev is free. Test and increment to use this device. */ - void (* enter)(); /* ENTER, a function - args: self + void (* enter)(void *); /* ENTER, a function + args: interface rec (Kbd, Dsp, Mouse) Called to set up the device. Has to be called before anything else is done to the device. */ - void (* exit)(); /* EXIT, a function - args: self + void (* exit)(void *); /* EXIT, a function + args: interface rec (Kbd, Dsp, Mouse) Called to deactivate the device and restore the device to its previous state */ - void (* before_raid)(); /* BEFORE_RAID, a function. - args: self + void (* before_raid)(void *); /* BEFORE_RAID, a function. + args: interface rec (Kbd, Dsp, Mouse) Prepare this device for uraid. */ - void (* after_raid)(); /* BEFORE_RAID, a function. - args: self + void (* after_raid)(void *); /* BEFORE_RAID, a function. + args: interface rec (Kbd, Dsp, Mouse) Cleanup and restart device after uraid. */ - void (* sync_device)(); /* SYNC_DEVICE, a function. - args: self + void (* sync_device)(void *); /* SYNC_DEVICE, a function. + args: interface rec (Kbd, Dsp, Mouse) Make reality and emulator coincide with each other */ } DevRec; @@ -130,7 +129,7 @@ typedef struct { the mouse here.*/ } MCursor; -typedef struct MouseInterfaceRec +typedef struct { DevRec device; void (* Handler)(); /* Event handler for the mouse. */ @@ -151,7 +150,7 @@ typedef MouseInterfaceRec *MouseInterface; /* Definition of the keyboard. Note that the keyboard is also */ /* dependent on the IOPage68K */ /**************************************************************/ -typedef struct KbdInterfaceRec +typedef struct { DevRec device; PFV device_event; /* Event handler for the keyboard. */ @@ -177,13 +176,19 @@ typedef KbdInterfaceRec *KbdInterface; /* Definition of the display. This structure collects all the */ /* special knowledge needed to manipulate the screen. */ /**************************************************************/ +/* + * NOTE: At this time only the DspInterface methods + * bitblt_to_screen(), clearscreen(), mouse_visible(), and mouse_invisible() + * are called, and the mouse_* are only used for DOS. + * All the other methods are not implemented and not called. + */ typedef struct DspInterfaceRec { DevRec device; - void (* drawline)(); /* DRAWLINE + unsigned long (* drawline)(); /* DRAWLINE args: dont know yet. Not yet implemented.*/ - void (* cleardisplay)(); /* CLEARDISPLAY, a function + unsigned long (* cleardisplay)(struct DspInterfaceRec *); /* CLEARDISPLAY, a function args: self clears the screen.*/ @@ -201,20 +206,19 @@ typedef struct DspInterfaceRec unsigned long (* medley_to_native_bm)(); /* 1 bit/pix to native bit/pix */ unsigned long (* native_to_medley_bm)(); /* native bit/pix to 1 bit/pix */ - unsigned long (* bitblt_to_screen)(); /* BITBLT_TO_SCREEN, a function + unsigned long (* bitblt_to_screen)(struct DspInterfaceRec *, DLword *, int, int, int, int); /* BITBLT_TO_SCREEN, a function args: self, buffer left top width height. biblt's buffer to the screen. */ unsigned long (* bitblt_from_screen)(); unsigned long (* scroll_region)(); /* ie. bbt from screen to screen */ - - void (* mouse_invisible)(); /* MOUSE_INVISIBLE + unsigned long (* mouse_invisible)(struct DspInterfaceRec *, void *); /* MOUSE_INVISIBLE args: self (a dsp), iop (an IOPAGE preferably the one and only) This method makes the mouse invisible on the screen. Note that the dsp supplies the method and the iop supplies the data. */ - void (* mouse_visible)(); /* MOUSE_VISIBLE - args: self (a dsp), iop (an IOPAGE preferably the one and only) - This method makes the mouse visible on the screen. Note that - the dsp supplies the method and the iop supplies the data. */ + unsigned long (* mouse_visible)(int x, int y); /* MOUSE_VISIBLE + args: x, y position where the mouse/cursor should be displayed. + NOTE: this should probably include the DspInterface as the first arg? + */ MRegion Display; /* Dimensions of the physical display. */ unsigned short unused0; /* alignment padding for next field */ unsigned short bitsperpixel; diff --git a/inc/dspifdefs.h b/inc/dspifdefs.h index 9661daa..006d050 100644 --- a/inc/dspifdefs.h +++ b/inc/dspifdefs.h @@ -2,7 +2,8 @@ #define DSPIFDEFS_H 1 #include "devif.h" void make_dsp_instance(DspInterface dsp, char *lispbitmap, int width_hint, int height_hint, int depth_hint); -unsigned long GenericReturnT(void); -void GenericPanic(DspInterface dsp); +unsigned long GenericReturnT(void *d); +void GenericReturnVoid(void *d); +void GenericPanic(void *d); void describedsp(DspInterface dsp); #endif diff --git a/src/dosmouse.c b/src/dosmouse.c index 1fac6e5..2aede40 100644 --- a/src/dosmouse.c +++ b/src/dosmouse.c @@ -280,7 +280,7 @@ void docopy(int newx, int newy) #endif /* NEWBITBLT */ } -dostaking_mouse_up(int newx, int newy) +unsigned long dostaking_mouse_up(int newx, int newy) { /* save hidden bitmap */ @@ -329,6 +329,7 @@ dostaking_mouse_up(int newx, int newy) (currentdsp->bitblt_to_screen)(currentdsp, DisplayRegion68k, currentmouse->Cursor.Last.x, currentmouse->Cursor.Last.y, w, h); + return (T); } dostaking_mouse_down(DspInterface dsp, IOPAGE *iop) @@ -357,6 +358,7 @@ dostaking_mouse_down(DspInterface dsp, IOPAGE *iop) (dsp->bitblt_to_screen)(dsp, DisplayRegion68k, currentmouse->Cursor.Last.x, currentmouse->Cursor.Last.y, w, h); + return (T); } /************************************************************************/ diff --git a/src/dspif.c b/src/dspif.c index 80d4642..808f8e3 100644 --- a/src/dspif.c +++ b/src/dspif.c @@ -82,9 +82,10 @@ void make_dsp_instance(DspInterface dsp, char *lispbitmap, int width_hint, int h /* Utility function that just returns T */ /* */ /*********************************************************************/ -unsigned long GenericReturnT(void) { return (T); } - -void GenericPanic(DspInterface dsp) { +unsigned long GenericReturnT(void *d) { (void)d; return (T); } +void GenericReturnVoid(void *d) {(void)d; return; } +void GenericPanic(void *d) { + (void)d; TPRINT(("Enter GenericPanic\n")); fprintf(stderr, "Panic! Call to uninitialized display slot!"); exit(0); diff --git a/src/initkbd.c b/src/initkbd.c index 4e72a35..a0759af 100644 --- a/src/initkbd.c +++ b/src/initkbd.c @@ -229,7 +229,7 @@ void init_keyboard(int flg) /* if 0 init else re-init */ void device_before_exit(void) { #if DOS - (currentmouse->device.exit)(currentmouse, currentdsp); + (currentmouse->device.exit)(currentmouse); (currentkbd->device.exit)(currentkbd); #endif /* SUNDISPLAY DOS*/ display_before_exit(); diff --git a/src/kbdif.c b/src/kbdif.c index 9ea25d6..3db105c 100644 --- a/src/kbdif.c +++ b/src/kbdif.c @@ -15,6 +15,7 @@ #include "lispemul.h" #include "dbprint.h" #include "devif.h" +#include "dspifdefs.h" KbdInterfaceRec curkbd; KbdInterface currentkbd = &curkbd; @@ -23,7 +24,6 @@ KbdInterface currentkbd = &curkbd; extern void Kbd_event(void); extern void EnterDosKbd(void); extern void ExitDosKbd(void); -extern unsigned long GenericReturnT(void); #endif /* DOS */ void make_kbd_instance(KbdInterface kbd) { diff --git a/src/mouseif.c b/src/mouseif.c index 2070d58..6a7651e 100644 --- a/src/mouseif.c +++ b/src/mouseif.c @@ -21,6 +21,7 @@ MouseInterface currentmouse = &curmouse; #ifdef DOS #include #include "lispemul.h" +#include "dspifdefs.h" /* for GenericReturnVoid */ int nomouseflag = FALSE; extern DLword *Lisp_world; @@ -31,7 +32,6 @@ extern void EnterDosMouse(void); extern void ExitDosMouse(void); extern void DosMouseAfterRaid(void); extern void DosMouseBeforeRaid(void); -extern unsigned long GenericReturnT(void); extern void ThreeButtonHandler(void); extern void TwoButtonHandler(void); #endif /* DOS */ @@ -67,10 +67,10 @@ void make_mouse_instance(MouseInterface mouse) int NumberOfButtons; if (nomouseflag) { - mouse->device.enter = &GenericReturnT; - mouse->device.exit = &GenericReturnT; - mouse->device.before_raid = &GenericReturnT; - mouse->device.after_raid = &GenericReturnT; + mouse->device.enter = GenericReturnVoid; + mouse->device.exit = GenericReturnVoid; + mouse->device.before_raid = GenericReturnVoid; + mouse->device.after_raid = GenericReturnVoid; mouse->device.active = FALSE; NumberOfButtons = 3; } else { diff --git a/src/vesainit.c b/src/vesainit.c index bfe302d..e1a3d9f 100644 --- a/src/vesainit.c +++ b/src/vesainit.c @@ -27,6 +27,7 @@ #include #include "dbprint.h" +#include "dspifdefs.h" #include "lispemul.h" #include "devif.h" #include "iopage.h" @@ -68,8 +69,6 @@ extern DLword *DisplayRegion68k_end_addr; extern DspInterface currentdsp; extern void docopy(int newx, int newy); -extern PFUL GenericReturnT(void); -extern void GenericPanic(void); extern unsigned long VGA_not_color(DspInterface dsp); extern void VGA_exit(DspInterface dsp); extern unsigned long Dosbbt1(DspInterface dsp, DLword *buf, DLword left, DLword top, DLword swidth, DLword height); @@ -78,8 +77,8 @@ extern unsigned long Dosbbt3(DspInterface dsp, DLword *buf, DLword left, DLword extern void Dosclearbanks(DspInterface dsp); extern long DOSCursorVisible(DspInterface dsp, IOPAGE *iop); extern long dos_cursor_invisible(DspInterface dsp, IOPAGE *iop); -extern int dostaking_mouse_down(DspInterface dsp, IOPAGE *iop); -extern int dostaking_mouse_up(int newx, int newy); +extern unsigned long dostaking_mouse_down(DspInterface dsp, IOPAGE *iop); +extern unsigned long dostaking_mouse_up(int newx, int newy); void VESA_Intrpt_Hndlr(void); void *VESA_prev_hndlr; /* addr of previous 0x10 intercept */ diff --git a/src/vgainit.c b/src/vgainit.c index 32935de..a816a30 100644 --- a/src/vgainit.c +++ b/src/vgainit.c @@ -18,8 +18,8 @@ extern unsigned long Dosbbt1(DspInterface dsp, DLword *buf, DLword left, DLword top, DLword swidth, DLword height); extern unsigned long Dosbbt2(DspInterface dsp, DLword *buf, DLword left, DLword top, DLword swidth, DLword height); -extern int dostaking_mouse_down(DspInterface dsp, IOPAGE *iop); -extern int dostaking_mouse_up(int newx, int newy); +extern unsigned long dostaking_mouse_down(DspInterface dsp, IOPAGE *iop); +extern unsigned long dostaking_mouse_up(int newx, int newy); extern DLword *DisplayRegion68k; extern DLword *DisplayRegion68k_end_addr; @@ -139,8 +139,8 @@ VGA_init(DspInterface dsp, char *lispbitmap, int width_hint, int height_hint, in dsp->BytesPerLine = 80; dsp->LinesPerBank = 512; - dsp->mouse_invisible = (PFV)&dostaking_mouse_down; - dsp->mouse_visible = (PFV)&dostaking_mouse_up; + dsp->mouse_invisible = &dostaking_mouse_down; + dsp->mouse_visible = &dostaking_mouse_up; dsp->device.locked = FALSE; dsp->device.active = FALSE; diff --git a/src/xinit.c b/src/xinit.c index 48551d5..9ce71d4 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -275,18 +275,20 @@ DspInterface X_init(DspInterface dsp, LispPTR lispbitmap, unsigned width_hint, u /************************************************************/ dsp->Display.width = ((dsp->Display.width + 31) >> 5) << 5; - dsp->device.enter = (PFV)Open_Display; - dsp->device.exit = (PFV)lisp_Xexit; + /* + * Device methods + */ + dsp->device.enter = (void (*)(void *))Open_Display; + dsp->device.exit = (void (*)(void *))lisp_Xexit; + dsp->device.before_raid = (void (*)(void *))Xevent_before_raid; + dsp->device.after_raid = (void (*)(void *))Xevent_after_raid; - dsp->bitblt_to_screen = (PFUL)clipping_Xbitblt; - - dsp->device.before_raid = (PFV)Xevent_before_raid; - dsp->device.after_raid = (PFV)Xevent_after_raid; + dsp->bitblt_to_screen = clipping_Xbitblt; dsp->BitGravity = NorthWestGravity; - dsp->cleardisplay = (PFV)GenericReturnT; - dsp->set_color_map_entry = (PFUL)GenericReturnT; + dsp->cleardisplay = (unsigned long (*)(DspInterface))GenericReturnT; + dsp->set_color_map_entry = GenericReturnT; /* Set the geometry of the Visible (Lisp) window. */ dsp->Visible.width =