Commit 4e8fe231 authored by deuce's avatar deuce
Browse files

Fix Win32 warnings.

parent f18441ec
......@@ -17,6 +17,11 @@ SRC_ROOT = ..
# Cross platform/compiler definitions
!include ..\build\Common.bmake # defines clean and output directory rules
!ifdef USE_SDL
MT_CFLAGS = $(MT_CFLAGS) -IC:$(DIRSEP)SDL$(DIRSEP)SDL-1.2.9$(DIRSEP)include -DUSE_SDL
OBJS = $(OBJS) $(MTOBJODIR)$(DIRSEP)sdl_con$(OFILE) $(MTOBJODIR)$(DIRSEP)SDL_win32_main$(OFILE)
!endif
CFLAGS = -w-par -w-csu $(CFLAGS) $(XPDEV-MT_CFLAGS) $(MT_CFLAGS) -I$(CIOLIB_SRC)
OBJS = $(OBJS) $(MTOBJODIR)$(DIRSEP)win32cio$(OFILE)
......
......@@ -237,6 +237,7 @@ int try_conio_init(int mode)
cio_api.gettext=win32_gettext;
cio_api.textattr=win32_textattr;
cio_api.kbhit=win32_kbhit;
cio_api.delay=win32_delay;
cio_api.wherey=win32_wherey;
cio_api.wherex=win32_wherex;
cio_api.putch=win32_putch;
......@@ -263,7 +264,6 @@ int initciolib(int mode)
case CIOLIB_MODE_AUTO:
#ifdef WITH_SDL
if(!try_sdl_init(mode))
#endif
#ifdef _WIN32
if(!try_conio_init(mode))
......
# Microsoft Developer Studio Project File - Name="conio" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=conio - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "conio.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "conio.mak" CFG="conio - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "conio - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "conio - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "conio - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "msvc.win32.release"
# PROP Intermediate_Dir "msvc.win32.release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "..\xpdev" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "conio - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "msvc.win32.debug"
# PROP Intermediate_Dir "msvc.win32.debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "." /I "..\xpdev" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "conio - Win32 Release"
# Name "conio - Win32 Debug"
# Begin Source File
SOURCE=.\ansi_cio.c
# End Source File
# Begin Source File
SOURCE=.\ciolib.c
# End Source File
# Begin Source File
SOURCE=.\cterm.c
# End Source File
# Begin Source File
SOURCE=.\mouse.c
# End Source File
# Begin Source File
SOURCE=.\win32cio.c
# End Source File
# End Target
# End Project
# Microsoft Developer Studio Project File - Name="conio" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=conio - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "conio.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "conio.mak" CFG="conio - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "conio - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "conio - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "conio - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "msvc.win32.release"
# PROP Intermediate_Dir "msvc.win32.release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "..\xpdev" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "conio - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "msvc.win32.debug"
# PROP Intermediate_Dir "msvc.win32.debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "." /I "..\xpdev" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "conio - Win32 Release"
# Name "conio - Win32 Debug"
# Begin Source File
SOURCE=.\ansi_cio.c
# End Source File
# Begin Source File
SOURCE=.\ciolib.c
# End Source File
# Begin Source File
SOURCE=.\cterm.c
# End Source File
# Begin Source File
SOURCE=.\mouse.c
# End Source File
# Begin Source File
SOURCE=.\win32cio.c
# End Source File
# End Target
# End Project
......@@ -99,6 +99,7 @@ enum {
extern "C" {
#endif
void ciomouse_gotevent(int event, int x, int y);
int mouse_trywait(void);
int mouse_wait(void);
int mouse_pending(void);
int ciolib_getmouse(struct mouse_event *mevent);
......
#include <stdarg.h>
#include <stdio.h> /* NULL */
#include <stdlib.h>
#include <string.h>
#include "gen_defs.h"
......@@ -14,6 +15,7 @@
#undef main
#endif
#include "SDL.h"
#include "SDL_thread.h"
extern int CIOLIB_main(int argc, char **argv);
/********************************************************/
......@@ -169,7 +171,6 @@ const int sdl_tabs[10]={9,17,25,33,41,49,57,65,73,80};
/* Called from all threads */
void sdl_user_func(int func, ...)
{
static int sent_update=0;
unsigned int *i;
va_list argptr;
void **args;
......@@ -223,7 +224,7 @@ void sdl_user_func(int func, ...)
}
/* Blinker Thread */
void sdl_blinker_thread(void *data)
int sdl_blinker_thread(void *data)
{
while(1) {
SLEEP(500);
......@@ -286,10 +287,8 @@ int sdl_init(void)
sdl_user_func(SDL_USEREVENT_INIT);
SDL_SemWait(sdl_init_complete);
if(sdl_init_good) {
init_mouse();
if(sdl_init_good)
return(0);
}
return(-1);
}
......@@ -392,7 +391,7 @@ int sdl_kbhit(void)
/* Called from main thread only */
void sdl_delay(long msec)
{
usleep(msec*1000);
SLEEP(msec);
}
/* Called from main thread only */
......@@ -407,6 +406,14 @@ int sdl_wherex(void)
return(vstat.curs_col+1);
}
/* Called from BOTH THREADS */
int sdl_beep(void)
{
/* ToDo BEEP! */
BEEP(440,100);
return(0);
}
/* Put the character _c on the screen at the current cursor position.
* The special characters return, linefeed, bell, and backspace are handled
* properly, as is line wrap and scrolling. The cursor position is updated.
......@@ -542,14 +549,6 @@ int sdl_getche(void)
}
}
/* Called from BOTH THREADS */
int sdl_beep(void)
{
/* ToDo BEEP! */
BEEP(440,100);
return(0);
}
/* Called from main thread only */
void sdl_textmode(int mode)
{
......@@ -572,6 +571,7 @@ int sdl_showmouse(void)
int sdl_hidemouse(void)
{
sdl_user_func(SDL_USEREVENT_HIDEMOUSE);
return(0);
}
#if 0 /* ToDo Copy/Paste */
......@@ -776,6 +776,7 @@ int sdl_draw_one_char(unsigned short sch, unsigned int x, unsigned int y)
else
src.y *= ch;
SDL_BlitSurface(sdl_font, &src, win, &dst);
return(0);
}
/* Called from event thread only, */
......@@ -793,7 +794,7 @@ int sdl_full_screen_redraw(void)
this_blink=vstat.blink;
if((newvmem=(unsigned short *)malloc(vstat.cols*vstat.rows*sizeof(unsigned short)))==NULL)
return;
return(-1);
memcpy(newvmem, vstat.vmem, vstat.cols*vstat.rows*sizeof(unsigned short));
sdl_updated=1;
rects=(SDL_Rect *)malloc(sizeof(SDL_Rect)*vstat.cols*vstat.rows);
......@@ -825,6 +826,7 @@ int sdl_full_screen_redraw(void)
if(rcount)
SDL_UpdateRects(win,rcount,rects);
free(rects);
return(0);
}
/* Called from event thread only */
......@@ -853,7 +855,7 @@ struct mainparams {
};
/* Called from events thread only */
void sdl_runmain(void *data)
int sdl_runmain(void *data)
{
struct mainparams *mp=data;
SDL_Event ev;
......@@ -861,10 +863,11 @@ void sdl_runmain(void *data)
sdl_exitcode=CIOLIB_main(mp->argc, mp->argv);
ev.type=SDL_QUIT;
while(SDL_PeepEvents(&ev, 1, SDL_ADDEVENT, 0xffffffff)!=1);
return(0);
}
/* Mouse event/keyboard thread */
void sdl_mouse_thread(void *data)
int sdl_mouse_thread(void *data)
{
while(1) {
if(mouse_wait())
......@@ -875,7 +878,7 @@ void sdl_mouse_thread(void *data)
/* Event Thread */
int main(int argc, char **argv)
{
unsigned int i=0;
unsigned int i;
SDL_Event ev;
struct mainparams mp;
......@@ -940,7 +943,6 @@ int main(int argc, char **argv)
break;
case SDL_QUIT:
return(sdl_exitcode);
break;
case SDL_VIDEORESIZE:
if(ev.resize.w > 0 && ev.resize.h > 0) {
FREE_AND_NULL(last_vmem);
......
#include <stdlib.h>
#include "vidmodes.h"
#define B_00000000_B 0x00
......
......@@ -704,3 +704,8 @@ char *win32_getcliptext(void)
return(ret);
}
void win32_delay(long msec)
{
SLEEP(msec);
}
......@@ -37,6 +37,7 @@
#ifdef __cplusplus
extern "C" {
#endif
void win32_delay(long msec);
int win32_kbhit(void);
int win32_getch(void);
int win32_getche(void);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment