1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-13 15:18:14 +00:00

Fix "error: implicit declaration of function" from dspsubrs

Creates an sdldefs.h, declares a few more functions in sdl.c static,
and includes sdldefs.h in dspsubrs.c when necessary.
This commit is contained in:
Nick Briggs 2021-11-07 11:26:46 -08:00
parent 1db44b1f76
commit 64e0419af3
3 changed files with 19 additions and 5 deletions

11
inc/sdldefs.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef SDLDEFS_H
#define SDLDEFS_H 1
void sdl_notify_damage(int x, int y, int w, int h);
void sdl_setCursor(int hot_x, int hot_y);
void sdl_bitblt_to_screen(int _x, int _y, int _w, int _h);
void sdl_set_invert(int flag);
void sdl_setMousePosition(int x, int y);
void process_SDLevents();
int init_SDL(char *windowtitle, int w, int h, int s);
#endif

View File

@ -18,9 +18,11 @@
#include "lispemul.h" // for LispPTR, DLword, ATOM_T, NIL
#include "lispmap.h" // for S_POSITIVE
#include "lsptypes.h" // for GETWORD
#ifdef XWINDOW
#if defined(XWINDOW)
#include "xcursordefs.h" // for Set_XCursor
#include "xlspwindefs.h" // for lisp_Xvideocolor, set_Xmouseposition
#elif defined(SDL)
#include "sdldefs.h"
#endif
extern int DebugDSP;

View File

@ -1,5 +1,6 @@
#include <SDL.h>
#include <SDL_keycode.h>
#include "sdldefs.h"
#include "lispemul.h"
#include "miscstat.h"
#include "keyboard.h"
@ -275,7 +276,7 @@ void sdl_bitblt_to_screen(int _x, int _y, int _w, int _h) {
/* after = SDL_GetTicks(); */
/* printf("UpdateTexture took %dms\n", after - before); */
}
int map_key(SDL_Keycode k) {
static int map_key(SDL_Keycode k) {
for(int i = 0; keymap[i] != -1; i+= 2) {
if(keymap[i+1] == k)
return keymap[i];
@ -283,7 +284,7 @@ int map_key(SDL_Keycode k) {
return -1;
}
#define KEYCODE_OFFSET 0
void handle_keydown(SDL_Keycode k, unsigned short mod) {
static void handle_keydown(SDL_Keycode k, unsigned short mod) {
int lk = map_key(k);
if(lk == -1) {
printf("No mapping for key %s\n", SDL_GetKeyName(k));
@ -294,7 +295,7 @@ void handle_keydown(SDL_Keycode k, unsigned short mod) {
if ((KBDEventFlg += 1) > 0) Irq_Stk_End = Irq_Stk_Check = 0;
}
}
void handle_keyup(SDL_Keycode k, unsigned short mod) {
static void handle_keyup(SDL_Keycode k, unsigned short mod) {
int lk = map_key(k);
if(lk == -1) {
printf("No mapping for key %s\n", SDL_GetKeyName(k));
@ -320,7 +321,7 @@ extern MISCSTATS *MiscStats;
#define MOUSE_LEFT 13
#define MOUSE_RIGHT 14
#define MOUSE_MIDDLE 15
void sdl_update_viewport(int width, int height) {
static void sdl_update_viewport(int width, int height) {
int w = width / 32 * 32;
if(w > sdl_displaywidth * sdl_pixelscale)
w = sdl_displaywidth * sdl_pixelscale;