From ccd8724a38d12cf17e18c8fa8661d3d647f0f164 Mon Sep 17 00:00:00 2001 From: William McBrine Date: Mon, 27 Mar 2006 20:11:17 +0000 Subject: [PATCH] Removed some of the redundant compiler definitions (e.g., TC for __TURBOC__). Also removed the comment section that talked about giving these values to allow the use of if instead of ifdef, while every single test for them in the code actually used ifdef. --- curses.h | 21 +-------------------- curspriv.h | 4 ++-- demos/newdemo.c | 4 ++-- dos/pdcdisp.c | 8 ++++---- dos/pdcgetsc.c | 14 +++++++------- os2/pdckbd.c | 12 ++++++------ pdcurses/kernel.c | 4 ++-- 7 files changed, 24 insertions(+), 43 deletions(-) diff --git a/curses.h b/curses.h index b53c73c4..350824a3 100644 --- a/curses.h +++ b/curses.h @@ -15,7 +15,7 @@ * See the file maintain.er for details of the current maintainer. * ************************************************************************/ -/* $Id: curses.h,v 1.156 2006/03/27 19:31:30 wmcbrine Exp $ */ +/* $Id: curses.h,v 1.157 2006/03/27 20:11:16 wmcbrine Exp $ */ /*----------------------------------------------------------------------* * PDCurses * @@ -26,19 +26,12 @@ /*man-start************************************************************** -All defines are "defined" here. All compiler and environment specific -definitions are defined into generic class defines. These defines are to -be given values so that the code can rely on #if, rather than a -complicated set of #if defined() or #ifdefs. - PDCurses definitions list: (Only define those needed) DOS True if compiling for DOS. OS2 True if compiling for OS/2. WIN32 True if compiling for Windows. XCURSES True if compiling for X11. - HC True if using a Metaware compiler. - TC True if using a Borland compiler. MSC True if using a Microsoft compiler. NOMACROS Don't use (most) macros in place of functions. PDC_BUILD Defines API build version. @@ -63,7 +56,6 @@ PDCurses portable platform definitions list: * BORLAND COMPILERS Turbo C[++], Borland C[++] * * Borland definitions: - * TC * DOS * OS2 * @@ -73,7 +65,6 @@ PDCurses portable platform definitions list: */ #ifdef __TURBOC__ /* Borland gives defines this as a value*/ -# define TC __TURBOC__ /* Define a value for TC */ # ifdef __MSDOS__ # define DOS 6 /* Major release of DOS supported */ # include @@ -97,12 +88,10 @@ PDCurses portable platform definitions list: * METAWARE COMPILERS High C * * Metaware definitions: - * HC * DOS */ #ifdef __HIGHC__ -# define HC 1 # pragma off(prototype_override_warnings) # ifdef __MSDOS__ # define DOS 6 /* Major release of DOS supported */ @@ -157,12 +146,10 @@ PDCurses portable platform definitions list: * TOPSPEED compilers TSC * * TOPSPEED definitions: - * TSC * DOS || OS2 */ #ifdef __TSC__ /* You may have to define in makefile */ -# define TSC 1 # ifdef __OS2__ # define OS2 3 /* Major release of OS/2 supported */ # endif @@ -172,12 +159,10 @@ PDCurses portable platform definitions list: * IBM C Set/2 Compiler CSET2 * * IBM definitions: - * CSET2 * OS2 */ #ifdef __IBMC__ -# define CSET2 1 # ifdef __OS2__ # define OS2 3 /* Major release of OS/2 supported */ # endif @@ -214,8 +199,6 @@ PDCurses portable platform definitions list: * GNU compilers djgpp * * djgpp definitions: - * __DJGPP__ - * GO32 (deprecated) * DOS */ @@ -293,13 +276,11 @@ PDCurses portable platform definitions list: * Watcom C/C++ 10.6 compiler * * WATCOM definitions: - * WATCOMC * OS2 * WIN32 */ #ifdef __WATCOMC__ -# define WATCOMC 1 # if defined(__DOS__) || defined(__DOS4G__) # define DOS 7 /* Major release of DOS supported */ # include diff --git a/curspriv.h b/curspriv.h index dca0a840..42d2ace4 100644 --- a/curspriv.h +++ b/curspriv.h @@ -15,7 +15,7 @@ * See the file maintain.er for details of the current maintainer. * ************************************************************************/ -/* $Id: curspriv.h,v 1.56 2006/03/27 19:04:40 wmcbrine Exp $ */ +/* $Id: curspriv.h,v 1.57 2006/03/27 20:11:16 wmcbrine Exp $ */ /* CURSPRIV.H @@ -82,7 +82,7 @@ # ifdef NDP # define _FAR_POINTER(s,o) ((((int)(s)) << 4) + ((int)(o))) # else -# if defined(WATCOMC) && defined(__FLAT__) +# if defined(__WATCOMC__) && defined(__FLAT__) # define _FAR_POINTER(s,o) ((((int)(s)) << 4) + ((int)(o))) # else # define _FAR_POINTER(s,o) (((long)s << 16) | (long)o) diff --git a/demos/newdemo.c b/demos/newdemo.c index e91cf46a..d480620f 100644 --- a/demos/newdemo.c +++ b/demos/newdemo.c @@ -15,7 +15,7 @@ #ifdef PDCDEBUG const char *rcsid_newdemo = - "$Id: newdemo.c,v 1.27 2006/02/24 02:40:31 wmcbrine Exp $"; + "$Id: newdemo.c,v 1.28 2006/03/27 20:11:17 wmcbrine Exp $"; #endif int WaitForUser(void); @@ -234,7 +234,7 @@ int main(int argc, char **argv) curs_set(0); -#if !defined(TC) && !defined(OS2) +#if !defined(__TURBOC__) && !defined(OS2) signal(SIGINT, trap); #endif noecho(); diff --git a/dos/pdcdisp.c b/dos/pdcdisp.c index 563bc2b4..231ae89b 100644 --- a/dos/pdcdisp.c +++ b/dos/pdcdisp.c @@ -21,7 +21,7 @@ #ifdef PDCDEBUG const char *rcsid_PDCdisp = - "$Id: pdcdisp.c,v 1.27 2006/03/27 19:31:31 wmcbrine Exp $"; + "$Id: pdcdisp.c,v 1.28 2006/03/27 20:11:17 wmcbrine Exp $"; #endif extern unsigned char atrtab[MAX_ATRTAB]; @@ -171,13 +171,13 @@ int PDC_fix_cursor(int flag) case _VGACOLOR: case _VGAMONO: if (flag & 1) -#ifdef WATCOMC +#ifdef __WATCOMC__ regs.w.ax = 0x1200; #else regs.x.ax = 0x1200; #endif else -#ifdef WATCOMC +#ifdef __WATCOMC__ regs.w.ax = 0x1201; #else regs.x.ax = 0x1201; @@ -254,7 +254,7 @@ int PDC_putc(chtype character, chtype color) regs.h.al = (unsigned char) (character & 0x00FF); regs.h.bh = SP->video_page; regs.h.bl = (unsigned char) (color); -#ifdef WATCOMC +#ifdef __WATCOMC__ regs.w.cx = 1; #else regs.x.cx = 1; diff --git a/dos/pdcgetsc.c b/dos/pdcgetsc.c index eed78f75..33ac6524 100644 --- a/dos/pdcgetsc.c +++ b/dos/pdcgetsc.c @@ -21,7 +21,7 @@ #ifdef PDCDEBUG const char *rcsid_PDCgetsc = - "$Id: pdcgetsc.c,v 1.18 2006/02/23 01:46:52 wmcbrine Exp $"; + "$Id: pdcgetsc.c,v 1.19 2006/03/27 20:11:17 wmcbrine Exp $"; #endif /*man-start************************************************************** @@ -86,7 +86,7 @@ int PDC_get_cur_col(void) { PDC_LOG(("PDC_get_cur_col() - called\n")); -#ifdef WATCOMC +#ifdef __WATCOMC__ regs.w.ax = 0x0003; #else regs.x.ax = 0x0003; @@ -123,7 +123,7 @@ int PDC_get_cur_row(void) { PDC_LOG(("PDC_get_cur_row() - called\n")); -#ifdef WATCOMC +#ifdef __WATCOMC__ regs.w.ax = 0x0003; #else regs.x.ax = 0x0003; @@ -160,7 +160,7 @@ int PDC_get_attribute(void) { PDC_LOG(("PDC_get_attribute() - called\n")); -#ifdef WATCOMC +#ifdef __WATCOMC__ regs.w.ax = 0x0800; #else regs.x.ax = 0x0800; @@ -431,7 +431,7 @@ int PDC_query_adapter_type(void) _go32_dpmi_registers dpmi_regs; #endif -#if !defined(__DJGPP__) && !defined(WATCOMC) +#if !defined(__DJGPP__) && !defined(__WATCOMC__) struct SREGS segs; #endif short video_base = getdosmemword(0x463); @@ -493,7 +493,7 @@ int PDC_query_adapter_type(void) bx == 0x0010 --> return EGA information */ regs.h.ah = 0x12; -# ifdef WATCOMC +# ifdef __WATCOMC__ regs.w.bx = 0x10; # else regs.x.bx = 0x10; @@ -586,7 +586,7 @@ int PDC_query_adapter_type(void) SP->video_seg = dpmi_regs.x.es; #endif -#if !defined(__DJGPP__) && !defined(WATCOMC) +#if !defined(__DJGPP__) && !defined(__WATCOMC__) regs.h.ah = 0xfe; regs.h.al = 0; regs.x.di = SP->video_ofs; diff --git a/os2/pdckbd.c b/os2/pdckbd.c index 9adb3e67..d1c78b26 100644 --- a/os2/pdckbd.c +++ b/os2/pdckbd.c @@ -18,7 +18,7 @@ #define CURSES_LIBRARY 1 #include -#if defined (CURSES__32BIT__) || defined(CSET2) || defined(TC) +#if defined (CURSES__32BIT__) || defined(__IBMC__) || defined(__TURBOC__) # include #else # define INCL_DOSSIGNALS @@ -28,7 +28,7 @@ #ifdef PDCDEBUG const char *rcsid_PDCkbd = - "$Id: pdckbd.c,v 1.20 2006/03/26 01:48:49 wmcbrine Exp $"; + "$Id: pdckbd.c,v 1.21 2006/03/27 20:11:17 wmcbrine Exp $"; #endif /************************************************************************ @@ -408,8 +408,8 @@ int PDC_get_bios_key(void) bool PDC_get_ctrl_break(void) { -#if defined(CURSES__32BIT__) || defined(CSET2) || defined(TC) -# ifdef TC +#if defined(CURSES__32BIT__) || defined(__IBMC__) || defined(__TURBOC__) +# ifdef __TURBOC__ void __cdecl (*oldAction) (int); # else void (*oldAction) (int); @@ -417,7 +417,7 @@ bool PDC_get_ctrl_break(void) #endif PDC_LOG(("PDC_get_ctrl_break() - called\n")); -#if defined(CURSES__32BIT__) || defined(CSET2) || defined(TC) +#if defined(CURSES__32BIT__) || defined(__IBMC__) || defined(__TURBOC__) oldAction = signal(SIGINT, SIG_DFL); @@ -526,7 +526,7 @@ int PDC_set_ctrl_break(bool setting) { PDC_LOG(("PDC_set_ctrl_break() - called. Setting: %d\n", setting)); -#if defined(CURSES__32BIT__) || defined(CSET2) || defined(TC) +#if defined(CURSES__32BIT__) || defined(__IBMC__) || defined(__TURBOC__) signal(SIGINT, setting ? SIG_DFL : SIG_IGN); signal(SIGBREAK, setting ? SIG_DFL : SIG_IGN); #else diff --git a/pdcurses/kernel.c b/pdcurses/kernel.c index eb8e270e..dce67ad6 100644 --- a/pdcurses/kernel.c +++ b/pdcurses/kernel.c @@ -71,7 +71,7 @@ #ifdef PDCDEBUG const char *rcsid_kernel = - "$Id: kernel.c,v 1.40 2006/03/27 19:04:40 wmcbrine Exp $"; + "$Id: kernel.c,v 1.41 2006/03/27 20:11:17 wmcbrine Exp $"; #endif RIPPEDOFFLINE linesripped[5]; @@ -402,7 +402,7 @@ int napms(int ms) #elif defined(DOS) -# if defined(TC) || defined(__WATCOMC__) +# if defined(__TURBOC__) || defined(__WATCOMC__) delay(ms);