1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-04-27 04:47:10 +00:00

Address "warning: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x"

* Update struct DevRec methods to take a "void *" parameter
   since they get called with different xxxInterface records
   depending on whether they are a keyboard, mouse, or display.
   Introduce GenericReturnVoid method implementation for use
   where needed with DevRec methods. (see mouseif.c)

 * Cast functions implementing DevRec methods as appropriate to match
   the method signature.

 * Update struct DspInterfaceRec methods cleardisplay,
   bitblt_to_screen, mouse_invisible, and mouse_visible to declare
   the parameters they require and all return unsigned long results
   (though it's not clear that this is actually the correct type).
   Requires updating dosmouse.c method implementations.

 * Update GenericReturnT and GenericPanic method implementations
   to have the signature required by the method slots they
   are used in.

 * Correct DOS-only section with incorrect arguments to device.exit
   call for the mouse.

 * Use include "dspifdefs.h" for prototypes for GenericReturnXXX method
   implementations.
This commit is contained in:
Nick Briggs
2022-12-20 16:48:59 -08:00
parent 80e40fa942
commit 80c9c796c5
10 changed files with 63 additions and 54 deletions

View File

@@ -56,37 +56,36 @@ typedef struct
unsigned height; unsigned height;
} MRegion; } MRegion;
/**************************************************************/ /**************************************************************/
/* D e v R e c */ /* D e v R e c */
/* */ /* */
/* Definition common to all devices. Used for mouse, kbd and */ /* 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. int active; /* ACTIVE, a flag.
TRUE if this device is activated. Use this TRUE if this device is activated. Use this
to prevent multiple consecutive initializations. */ to prevent multiple consecutive initializations. */
int locked; /* LOCK, a semaphore: 0 if dev is free. int locked; /* LOCK, a semaphore: 0 if dev is free.
Test and increment to use this device. */ Test and increment to use this device. */
void (* enter)(); /* ENTER, a function void (* enter)(void *); /* ENTER, a function
args: self args: interface rec (Kbd, Dsp, Mouse)
Called to set up the device. Has to be called before Called to set up the device. Has to be called before
anything else is done to the device. */ anything else is done to the device. */
void (* exit)(); /* EXIT, a function void (* exit)(void *); /* EXIT, a function
args: self args: interface rec (Kbd, Dsp, Mouse)
Called to deactivate the device and restore the Called to deactivate the device and restore the
device to its previous state */ device to its previous state */
void (* before_raid)(); /* BEFORE_RAID, a function. void (* before_raid)(void *); /* BEFORE_RAID, a function.
args: self args: interface rec (Kbd, Dsp, Mouse)
Prepare this device for uraid. */ Prepare this device for uraid. */
void (* after_raid)(); /* BEFORE_RAID, a function. void (* after_raid)(void *); /* BEFORE_RAID, a function.
args: self args: interface rec (Kbd, Dsp, Mouse)
Cleanup and restart device after uraid. */ Cleanup and restart device after uraid. */
void (* sync_device)(); /* SYNC_DEVICE, a function. void (* sync_device)(void *); /* SYNC_DEVICE, a function.
args: self args: interface rec (Kbd, Dsp, Mouse)
Make reality and emulator coincide with each other */ Make reality and emulator coincide with each other */
} DevRec; } DevRec;
@@ -130,7 +129,7 @@ typedef struct {
the mouse here.*/ the mouse here.*/
} MCursor; } MCursor;
typedef struct MouseInterfaceRec typedef struct
{ {
DevRec device; DevRec device;
void (* Handler)(); /* Event handler for the mouse. */ void (* Handler)(); /* Event handler for the mouse. */
@@ -151,7 +150,7 @@ typedef MouseInterfaceRec *MouseInterface;
/* Definition of the keyboard. Note that the keyboard is also */ /* Definition of the keyboard. Note that the keyboard is also */
/* dependent on the IOPage68K */ /* dependent on the IOPage68K */
/**************************************************************/ /**************************************************************/
typedef struct KbdInterfaceRec typedef struct
{ {
DevRec device; DevRec device;
PFV device_event; /* Event handler for the keyboard. */ PFV device_event; /* Event handler for the keyboard. */
@@ -177,13 +176,19 @@ typedef KbdInterfaceRec *KbdInterface;
/* Definition of the display. This structure collects all the */ /* Definition of the display. This structure collects all the */
/* special knowledge needed to manipulate the screen. */ /* 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 typedef struct DspInterfaceRec
{ {
DevRec device; DevRec device;
void (* drawline)(); /* DRAWLINE unsigned long (* drawline)(); /* DRAWLINE
args: dont know yet. Not yet implemented.*/ args: dont know yet. Not yet implemented.*/
void (* cleardisplay)(); /* CLEARDISPLAY, a function unsigned long (* cleardisplay)(struct DspInterfaceRec *); /* CLEARDISPLAY, a function
args: self args: self
clears the screen.*/ 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 (* 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 (* 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. args: self, buffer left top width height.
biblt's buffer to the screen. */ biblt's buffer to the screen. */
unsigned long (* bitblt_from_screen)(); unsigned long (* bitblt_from_screen)();
unsigned long (* scroll_region)(); /* ie. bbt from screen to screen */ unsigned long (* scroll_region)(); /* ie. bbt from screen to screen */
unsigned long (* mouse_invisible)(struct DspInterfaceRec *, void *); /* MOUSE_INVISIBLE
void (* mouse_invisible)(); /* MOUSE_INVISIBLE
args: self (a dsp), iop (an IOPAGE preferably the one and only) args: self (a dsp), iop (an IOPAGE preferably the one and only)
This method makes the mouse invisible on the screen. Note that This method makes the mouse invisible on the screen. Note that
the dsp supplies the method and the iop supplies the data. */ the dsp supplies the method and the iop supplies the data. */
void (* mouse_visible)(); /* MOUSE_VISIBLE unsigned long (* mouse_visible)(int x, int y); /* MOUSE_VISIBLE
args: self (a dsp), iop (an IOPAGE preferably the one and only) args: x, y position where the mouse/cursor should be displayed.
This method makes the mouse visible on the screen. Note that NOTE: this should probably include the DspInterface as the first arg?
the dsp supplies the method and the iop supplies the data. */ */
MRegion Display; /* Dimensions of the physical display. */ MRegion Display; /* Dimensions of the physical display. */
unsigned short unused0; /* alignment padding for next field */ unsigned short unused0; /* alignment padding for next field */
unsigned short bitsperpixel; unsigned short bitsperpixel;

View File

@@ -2,7 +2,8 @@
#define DSPIFDEFS_H 1 #define DSPIFDEFS_H 1
#include "devif.h" #include "devif.h"
void make_dsp_instance(DspInterface dsp, char *lispbitmap, int width_hint, int height_hint, int depth_hint); void make_dsp_instance(DspInterface dsp, char *lispbitmap, int width_hint, int height_hint, int depth_hint);
unsigned long GenericReturnT(void); unsigned long GenericReturnT(void *d);
void GenericPanic(DspInterface dsp); void GenericReturnVoid(void *d);
void GenericPanic(void *d);
void describedsp(DspInterface dsp); void describedsp(DspInterface dsp);
#endif #endif

View File

@@ -280,7 +280,7 @@ void docopy(int newx, int newy)
#endif /* NEWBITBLT */ #endif /* NEWBITBLT */
} }
dostaking_mouse_up(int newx, int newy) unsigned long dostaking_mouse_up(int newx, int newy)
{ {
/* save hidden bitmap */ /* save hidden bitmap */
@@ -329,6 +329,7 @@ dostaking_mouse_up(int newx, int newy)
(currentdsp->bitblt_to_screen)(currentdsp, DisplayRegion68k, currentmouse->Cursor.Last.x, (currentdsp->bitblt_to_screen)(currentdsp, DisplayRegion68k, currentmouse->Cursor.Last.x,
currentmouse->Cursor.Last.y, w, h); currentmouse->Cursor.Last.y, w, h);
return (T);
} }
dostaking_mouse_down(DspInterface dsp, IOPAGE *iop) 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, (dsp->bitblt_to_screen)(dsp, DisplayRegion68k, currentmouse->Cursor.Last.x,
currentmouse->Cursor.Last.y, w, h); currentmouse->Cursor.Last.y, w, h);
return (T);
} }
/************************************************************************/ /************************************************************************/

View File

@@ -82,9 +82,10 @@ void make_dsp_instance(DspInterface dsp, char *lispbitmap, int width_hint, int h
/* Utility function that just returns T */ /* Utility function that just returns T */
/* */ /* */
/*********************************************************************/ /*********************************************************************/
unsigned long GenericReturnT(void) { return (T); } unsigned long GenericReturnT(void *d) { (void)d; return (T); }
void GenericReturnVoid(void *d) {(void)d; return; }
void GenericPanic(DspInterface dsp) { void GenericPanic(void *d) {
(void)d;
TPRINT(("Enter GenericPanic\n")); TPRINT(("Enter GenericPanic\n"));
fprintf(stderr, "Panic! Call to uninitialized display slot!"); fprintf(stderr, "Panic! Call to uninitialized display slot!");
exit(0); exit(0);

View File

@@ -229,7 +229,7 @@ void init_keyboard(int flg) /* if 0 init else re-init */
void device_before_exit(void) { void device_before_exit(void) {
#if DOS #if DOS
(currentmouse->device.exit)(currentmouse, currentdsp); (currentmouse->device.exit)(currentmouse);
(currentkbd->device.exit)(currentkbd); (currentkbd->device.exit)(currentkbd);
#endif /* SUNDISPLAY DOS*/ #endif /* SUNDISPLAY DOS*/
display_before_exit(); display_before_exit();

View File

@@ -15,6 +15,7 @@
#include "lispemul.h" #include "lispemul.h"
#include "dbprint.h" #include "dbprint.h"
#include "devif.h" #include "devif.h"
#include "dspifdefs.h"
KbdInterfaceRec curkbd; KbdInterfaceRec curkbd;
KbdInterface currentkbd = &curkbd; KbdInterface currentkbd = &curkbd;
@@ -23,7 +24,6 @@ KbdInterface currentkbd = &curkbd;
extern void Kbd_event(void); extern void Kbd_event(void);
extern void EnterDosKbd(void); extern void EnterDosKbd(void);
extern void ExitDosKbd(void); extern void ExitDosKbd(void);
extern unsigned long GenericReturnT(void);
#endif /* DOS */ #endif /* DOS */
void make_kbd_instance(KbdInterface kbd) { void make_kbd_instance(KbdInterface kbd) {

View File

@@ -21,6 +21,7 @@ MouseInterface currentmouse = &curmouse;
#ifdef DOS #ifdef DOS
#include <dos.h> #include <dos.h>
#include "lispemul.h" #include "lispemul.h"
#include "dspifdefs.h" /* for GenericReturnVoid */
int nomouseflag = FALSE; int nomouseflag = FALSE;
extern DLword *Lisp_world; extern DLword *Lisp_world;
@@ -31,7 +32,6 @@ extern void EnterDosMouse(void);
extern void ExitDosMouse(void); extern void ExitDosMouse(void);
extern void DosMouseAfterRaid(void); extern void DosMouseAfterRaid(void);
extern void DosMouseBeforeRaid(void); extern void DosMouseBeforeRaid(void);
extern unsigned long GenericReturnT(void);
extern void ThreeButtonHandler(void); extern void ThreeButtonHandler(void);
extern void TwoButtonHandler(void); extern void TwoButtonHandler(void);
#endif /* DOS */ #endif /* DOS */
@@ -67,10 +67,10 @@ void make_mouse_instance(MouseInterface mouse)
int NumberOfButtons; int NumberOfButtons;
if (nomouseflag) { if (nomouseflag) {
mouse->device.enter = &GenericReturnT; mouse->device.enter = GenericReturnVoid;
mouse->device.exit = &GenericReturnT; mouse->device.exit = GenericReturnVoid;
mouse->device.before_raid = &GenericReturnT; mouse->device.before_raid = GenericReturnVoid;
mouse->device.after_raid = &GenericReturnT; mouse->device.after_raid = GenericReturnVoid;
mouse->device.active = FALSE; mouse->device.active = FALSE;
NumberOfButtons = 3; NumberOfButtons = 3;
} else { } else {

View File

@@ -27,6 +27,7 @@
#include <graph.h> #include <graph.h>
#include "dbprint.h" #include "dbprint.h"
#include "dspifdefs.h"
#include "lispemul.h" #include "lispemul.h"
#include "devif.h" #include "devif.h"
#include "iopage.h" #include "iopage.h"
@@ -68,8 +69,6 @@ extern DLword *DisplayRegion68k_end_addr;
extern DspInterface currentdsp; extern DspInterface currentdsp;
extern void docopy(int newx, int newy); extern void docopy(int newx, int newy);
extern PFUL GenericReturnT(void);
extern void GenericPanic(void);
extern unsigned long VGA_not_color(DspInterface dsp); extern unsigned long VGA_not_color(DspInterface dsp);
extern void VGA_exit(DspInterface dsp); extern void VGA_exit(DspInterface dsp);
extern unsigned long Dosbbt1(DspInterface dsp, DLword *buf, DLword left, DLword top, DLword swidth, DLword height); 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 void Dosclearbanks(DspInterface dsp);
extern long DOSCursorVisible(DspInterface dsp, IOPAGE *iop); extern long DOSCursorVisible(DspInterface dsp, IOPAGE *iop);
extern long dos_cursor_invisible(DspInterface dsp, IOPAGE *iop); extern long dos_cursor_invisible(DspInterface dsp, IOPAGE *iop);
extern int dostaking_mouse_down(DspInterface dsp, IOPAGE *iop); extern unsigned long dostaking_mouse_down(DspInterface dsp, IOPAGE *iop);
extern int dostaking_mouse_up(int newx, int newy); extern unsigned long dostaking_mouse_up(int newx, int newy);
void VESA_Intrpt_Hndlr(void); void VESA_Intrpt_Hndlr(void);
void *VESA_prev_hndlr; /* addr of previous 0x10 intercept */ void *VESA_prev_hndlr; /* addr of previous 0x10 intercept */

View File

@@ -18,8 +18,8 @@
extern unsigned long Dosbbt1(DspInterface dsp, DLword *buf, DLword left, DLword top, DLword swidth, DLword height); 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 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 unsigned long dostaking_mouse_down(DspInterface dsp, IOPAGE *iop);
extern int dostaking_mouse_up(int newx, int newy); extern unsigned long dostaking_mouse_up(int newx, int newy);
extern DLword *DisplayRegion68k; extern DLword *DisplayRegion68k;
extern DLword *DisplayRegion68k_end_addr; 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->BytesPerLine = 80;
dsp->LinesPerBank = 512; dsp->LinesPerBank = 512;
dsp->mouse_invisible = (PFV)&dostaking_mouse_down; dsp->mouse_invisible = &dostaking_mouse_down;
dsp->mouse_visible = (PFV)&dostaking_mouse_up; dsp->mouse_visible = &dostaking_mouse_up;
dsp->device.locked = FALSE; dsp->device.locked = FALSE;
dsp->device.active = FALSE; dsp->device.active = FALSE;

View File

@@ -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->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->bitblt_to_screen = clipping_Xbitblt;
dsp->device.before_raid = (PFV)Xevent_before_raid;
dsp->device.after_raid = (PFV)Xevent_after_raid;
dsp->BitGravity = NorthWestGravity; dsp->BitGravity = NorthWestGravity;
dsp->cleardisplay = (PFV)GenericReturnT; dsp->cleardisplay = (unsigned long (*)(DspInterface))GenericReturnT;
dsp->set_color_map_entry = (PFUL)GenericReturnT; dsp->set_color_map_entry = GenericReturnT;
/* Set the geometry of the Visible (Lisp) window. */ /* Set the geometry of the Visible (Lisp) window. */
dsp->Visible.width = dsp->Visible.width =