1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-02-26 08:43:40 +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;
} 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;

View File

@@ -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

View File

@@ -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);
}
/************************************************************************/

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 */
/* */
/*********************************************************************/
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);

View File

@@ -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();

View File

@@ -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) {

View File

@@ -21,6 +21,7 @@ MouseInterface currentmouse = &curmouse;
#ifdef DOS
#include <dos.h>
#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 {

View File

@@ -27,6 +27,7 @@
#include <graph.h>
#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 */

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 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;

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->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 =