Skip to content
Snippets Groups Projects
Commit 9244d4dd authored by rswindell's avatar rswindell
Browse files

Fixed numerous problems/warnings encountered when building for Win32.

parent b757b96d
Branches
Tags
No related merge requests found
......@@ -601,7 +601,7 @@ void ansi_fixterm(void)
}
#endif
int ansi_initciowrap(long inmode)
int ansi_initciolib(long inmode)
{
int i;
char *init="\033[0m\033[2J\033[1;1H";
......
......@@ -5,16 +5,16 @@
#ifdef __cplusplus
extern "C" {
#endif
int ansi_puttext(int sx, int sy, int ex, int ey, unsigned char *fill);
int ansi_gettext(int sx, int sy, int ex, int ey, unsigned char *fill);
void ansi_textattr(unsigned char attr);
int ansi_puttext(int sx, int sy, int ex, int ey, void *fill);
int ansi_gettext(int sx, int sy, int ex, int ey, void *fill);
void ansi_textattr(int);
int ansi_kbhit(void);
void ansi_delay(long msec);
int ansi_wherey(void);
int ansi_wherex(void);
int ansi_putch(unsigned char ch);
int ansi_putch(int ch);
void ansi_gotoxy(int x, int y);
int ansi_initciowrap(long inmode);
int ansi_initciolib(long inmode);
void ansi_gettextinfo(struct text_info *info);
void ansi_setcursortype(int type);
int ansi_getch(void);
......
#include <stdarg.h>
#include <stdlib.h> /* malloc */
#include <stdio.h>
#define CIOLIB_NO_MACROS
......@@ -136,25 +137,25 @@ int try_ansi_init(int mode)
}
#ifdef _WIN32
int try_ciolib_init(int mode)
int try_conio_init(int mode)
{
/* This should test for something or other */
if(isatty(fileno(stdout))) {
cio_api.mode=CIOLIB_CIOLIB_MODE;
cio_api.mode=CIOLIB_CONIO_MODE;
cio_api.puttext=puttext;
cio_api.gettext=gettext;
cio_api.textattr=textattr;
cio_api.kbhit=kbhit;
cio_api.delay=delay;
// cio_api.delay=delay;
cio_api.wherey=wherey;
cio_api.wherex=wherex;
cio_api.putch=putch;
cio_api.gotoxy=gotoxy;
cio_api.gettextinfo=gettextinfo;
cio_api.setcursortype=setcursortype;
cio_api.setcursortype=_setcursortype;
cio_api.getch=getch;
cio_api.getche=getche;
cio_api.beep=beep;
// cio_api.beep=beep;
cio_api.textmode=textmode;
return(1);
}
......@@ -169,7 +170,7 @@ int initciolib(int mode)
switch(mode) {
case CIOLIB_AUTO_MODE:
#ifdef _WIN32
if(!try_ciolib_init(mode))
if(!try_conio_init(mode))
#else
if(!try_x_init(mode))
if(!try_curses_init(mode))
......@@ -177,8 +178,8 @@ int initciolib(int mode)
try_ansi_init(mode);
break;
#ifdef _WIN32
case CIOLIB_ciolib_MODE:
try_ciolib_init(mode);
case CIOLIB_CONIO_MODE:
try_conio_init(mode);
break;
#else
case CIOLIB_CURSES_MODE:
......@@ -580,8 +581,8 @@ int ciolib_cprintf(char *fmat, ...)
if(!initialized)
initciolib(CIOLIB_AUTO_MODE);
va_start(argptr,fmat);
#ifdef WIN32
ret=vnsprintf(str,sizeof(str)-1,fmat,argptr);
#ifdef _WIN32
ret=vsnprintf(str,sizeof(str)-1,fmat,argptr);
#else
ret=vsnprintf(NULL,0,fmat,argptr);
str=(char *)malloc(ret+1);
......@@ -594,7 +595,7 @@ int ciolib_cprintf(char *fmat, ...)
ciolib_cputs(str);
else
ret=EOF;
#ifndef WIN32
#ifndef _WIN32
free(str);
#endif
return(ret);
......
......@@ -12,8 +12,9 @@ enum {
,CIOLIB_CONIO_MODE
};
#ifndef __unix__
#ifndef __unix__ /* presumably, Win32 */
#include <conio.h>
#include <io.h> /* isatty */
#else
#ifndef BOOL
......@@ -83,14 +84,14 @@ struct text_info {
typedef struct {
int mode;
void (*clreol) (void);
int (*puttext) (int,int,int,int,unsigned char *);
int (*gettext) (int,int,int,int,unsigned char *);
void (*textattr) (unsigned char);
int (*puttext) (int,int,int,int,void *);
int (*gettext) (int,int,int,int,void *);
void (*textattr) (int);
int (*kbhit) (void);
void (*delay) (long);
int (*wherex) (void);
int (*wherey) (void);
int (*putch) (unsigned char);
int (*putch) (int);
void (*gotoxy) (int,int);
void (*clrscr) (void);
void (*gettextinfo) (struct text_info *);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment