From 7fbd8ae2d479dac52fe985000bf0ade3aaf99827 Mon Sep 17 00:00:00 2001 From: Mark Hessling Date: Thu, 1 Jul 2004 07:28:05 +0000 Subject: [PATCH] MinGW changes from Vladimir Kokovic --- curses.h | 25 ++-- curspriv.h | 10 +- panel.h | 15 +- pdcurses/initscr.c | 24 +-- win32/mingwin32.mak | 4 +- win32/pdckbd.c | 345 ++++++++++++++++++++++---------------------- win32/pdcscrn.c | 20 +-- 7 files changed, 228 insertions(+), 215 deletions(-) diff --git a/curses.h b/curses.h index da01b1c0..e981d6df 100644 --- a/curses.h +++ b/curses.h @@ -7,18 +7,18 @@ * that PDCurses code is used would be appreciated, but is not mandatory. * * Any changes which you make to this software which may improve or enhance -* it, should be forwarded to the current maintainer for the benefit of +* it, should be forwarded to the current maintainer for the benefit of * other users. * * The only restriction placed on this code is that no distribution of * modified PDCurses code be made under the PDCurses name, by anyone * other than the current maintainer. -* +* * See the file maintain.er for details of the current maintainer. *************************************************************************** */ -/* -$Id: curses.h,v 1.19 2004/01/02 05:50:05 mark Exp $ +/* +$Id: curses.h,v 1.20 2004/07/01 07:25:27 rexx Exp $ */ /* *---------------------------------------------------------------------- @@ -27,7 +27,7 @@ $Id: curses.h,v 1.19 2004/01/02 05:50:05 mark Exp $ * MH * 991212 2.4 * Key modifiers pressed by themselves are now returned as keys -* KEY_SHIFT_L KEY_SHIFT_R +* KEY_SHIFT_L KEY_SHIFT_R * KEY_CONTROL_L KEY_CONTROL_R * KEY_ALT_L KEY_ALT_R * This works on Win32 and X11 ports only @@ -126,7 +126,7 @@ $Id: curses.h,v 1.19 2004/01/02 05:50:05 mark Exp $ *---------------------------------------------------------------------- */ #if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS) - extern "C" + extern "C" { # define bool _bool #endif @@ -187,7 +187,7 @@ PDCurses portable platform definitions list: * OS2 * CPLUSPLUS * -* __TURBOC__, __MSDOS__, +* __TURBOC__, __MSDOS__, * __OS2__ and __WIN32__ * are predefined by compiler. */ @@ -294,7 +294,7 @@ PDCurses portable platform definitions list: # else /* no __OS2__ define, so assume DOS */ # ifdef _WIN32 # ifndef WIN32 -# define WIN32 +# define WIN32 # endif # ifdef INCLUDE_WINDOWS_H /* only include for WIN32 files */ # include @@ -1006,6 +1006,7 @@ typedef struct int scrnmode; /* default screen mode */ unsigned video_seg; /* video base segment */ unsigned video_ofs; /* video base offset */ + unsigned long os_version; /* Win32 Version */ #endif #if defined(OS2) || defined(WIN32) @@ -1034,7 +1035,7 @@ typedef struct /* external variables */ -#if !defined(PDC_STATIC_BUILD) && defined(_MSC_VER) && defined(WIN32) && !defined(CURSES_LIBRARY) +#if !defined(PDC_STATIC_BUILD) && (defined(_MSC_VER) || defined(__MINGW32__)) && defined(WIN32) && !defined(CURSES_LIBRARY) __declspec(dllimport) int LINES; /* terminal height */ __declspec(dllimport) int COLS; /* terminal width */ __declspec(dllimport) WINDOW* stdscr; /* the default screen window */ @@ -1045,7 +1046,7 @@ __declspec(dllimport) MOUSE_STATUS Mouse_status; __declspec(dllimport) int COLORS; __declspec(dllimport) int COLOR_PAIRS; #else -# if !defined(PDC_STATIC_BUILD) && defined(_MSC_VER) && defined(WIN32) +# if !defined(PDC_STATIC_BUILD) && (defined(_MSC_VER) || defined(__MINGW32__)) && defined(WIN32) __declspec(dllexport) extern int LINES; /* terminal height */ __declspec(dllexport) extern int COLS; /* terminal width */ __declspec(dllexport) extern WINDOW* stdscr; /* the default screen window */ @@ -1095,7 +1096,7 @@ The following is the structure of a win->_attrs chtype: ------------------------------------------------------------------------------------------------- colour number | modifiers | character eg 'a' (potential for DBCS) -The available attribute modifiers are bold, underline, invisible, protect, reverse +The available attribute modifiers are bold, underline, invisible, protect, reverse and blink. **man-end**********************************************************************/ @@ -1930,7 +1931,7 @@ int PDC_CDECL PDC_set_line_color Args(( short )); #if !defined(UNIX) && !defined(XCURSES) /* set delaytenths = 0 added - William McBrine */ -# define nocbreak() (SP->cbreak = FALSE, SP->delaytenths = 0) +# define nocbreak() (SP->cbreak = FALSE, SP->delaytenths = 0) # define cbreak() (SP->cbreak = TRUE) # define nocrmode() (SP->cbreak = FALSE) # define crmode() (SP->cbreak = TRUE) diff --git a/curspriv.h b/curspriv.h index d0e527b6..4695fecd 100644 --- a/curspriv.h +++ b/curspriv.h @@ -7,18 +7,18 @@ * that PDCurses code is used would be appreciated, but is not mandatory. * * Any changes which you make to this software which may improve or enhance -* it, should be forwarded to the current maintainer for the benefit of +* it, should be forwarded to the current maintainer for the benefit of * other users. * * The only restriction placed on this code is that no distribution of * modified PDCurses code be made under the PDCurses name, by anyone * other than the current maintainer. -* +* * See the file maintain.er for details of the current maintainer. *************************************************************************** */ /* -$Id: curspriv.h,v 1.7 2004/01/02 21:02:13 mark Exp $ +$Id: curspriv.h,v 1.8 2004/07/01 07:25:34 rexx Exp $ */ /* * @@ -224,7 +224,7 @@ extern VIRCON vir; #define _GOCHAR 0x11 /* ^Q character */ #define _PRINTCHAR 0x10 /* ^P character */ #define _STOPCHAR 0x13 /* ^S character */ -#define NUNGETCH 20 /* max # chars to ungetch() */ +#define NUNGETCH 256 /* max # chars to ungetch() */ @@ -278,7 +278,7 @@ extern WINDOW* twin; /* used by many routines */ /*---------------------------------------------------------------------- * ANSI C prototypes. Be sure that your compiler conditional -* compilation definitions above define HAVE_PROTO if your compiler +* compilation definitions above define HAVE_PROTO if your compiler * supports prototypes. */ #ifdef HAVE_PROTO diff --git a/panel.h b/panel.h index 0dbffc98..a63b7184 100644 --- a/panel.h +++ b/panel.h @@ -7,17 +7,17 @@ * that PDCurses code is used would be appreciated, but is not mandatory. * * Any changes which you make to this software which may improve or enhance -* it, should be forwarded to the current maintainer for the benefit of +* it, should be forwarded to the current maintainer for the benefit of * other users. * * The only restriction placed on this code is that no distribution of * modified PDCurses code be made under the PDCurses name, by anyone * other than the current maintainer. -* +* * See the file maintain.er for details of the current maintainer. *************************************************************************** */ -/* +/* $Id */ /* @@ -28,6 +28,11 @@ $Id #include +#if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS) +extern "C" +{ +#endif + typedef struct panelobs { struct panelobs *above; @@ -82,3 +87,7 @@ int replace_panel( /* PANEL *pan,WINDOW *win */ ); #endif /* end of panel.h */ + +#if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS) +} +#endif diff --git a/pdcurses/initscr.c b/pdcurses/initscr.c index 91abf140..f680d0a6 100644 --- a/pdcurses/initscr.c +++ b/pdcurses/initscr.c @@ -7,13 +7,13 @@ * that PDCurses code is used would be appreciated, but is not mandatory. * * Any changes which you make to this software which may improve or enhance -* it, should be forwarded to the current maintainer for the benefit of +* it, should be forwarded to the current maintainer for the benefit of * other users. * * The only restriction placed on this code is that no distribution of * modified PDCurses code be made under the PDCurses name, by anyone * other than the current maintainer. -* +* * See the file maintain.er for details of the current maintainer. *************************************************************************** */ @@ -61,7 +61,7 @@ #endif #ifdef PDCDEBUG -char *rcsid_initscr = "$Id: initscr.c,v 1.4 2002/12/16 06:58:09 mark Exp $"; +char *rcsid_initscr = "$Id: initscr.c,v 1.5 2004/07/01 07:28:05 rexx Exp $"; #else char* _curses_notice = "PDCurses 2.2 - Public Domain 1994"; #endif @@ -111,7 +111,7 @@ char *c_strbeg; void* emalloc( size_t ); void* ecalloc( size_t, size_t ); void efree( void* ); - + extern void* emalloc(); /* user's emalloc(size) */ extern void* ecalloc(); /* user's ecalloc(num,size) */ extern void efree(); /* user's efree(ptr) */ @@ -179,7 +179,7 @@ extern void (*PDC_initial_slk)(); A program which outputs to more than one terminal should use newterm() for each terminal instead of initscr(). The newterm() - function should be called once for each terminal. It returns a + function should be called once for each terminal. It returns a value of type SCREEN* which should be saved as a reference to that terminal. The arguments are the type of of terminal to be used in place of TERM (environment variable), a file pointer for output @@ -381,14 +381,14 @@ register int i=0; wclrtobot(stdscr); -/* - * If preserving the existing screen don't allow a screen clear... - */ -if (SP->_preserve) + /* + * If preserving the existing screen don't allow a screen clear... + */ + if (SP->_preserve) { - untouchwin(curscr); - untouchwin(stdscr); - stdscr->_clear = FALSE; + untouchwin(curscr); + untouchwin(stdscr); + stdscr->_clear = FALSE; } curscr->_clear = FALSE; diff --git a/win32/mingwin32.mak b/win32/mingwin32.mak index e2ba5c01..943ace93 100644 --- a/win32/mingwin32.mak +++ b/win32/mingwin32.mak @@ -12,8 +12,8 @@ # Change these for your environment... # ################################################################################ -PDCURSES_HOME =f:/curses -CC_HOME =f:/mingw32 +PDCURSES_HOME =d:/pdcurses/pdcurses +CC_HOME =c:/mingw32 ################################################################################ # Nothing below here should required changing. ################################################################################ diff --git a/win32/pdckbd.c b/win32/pdckbd.c index ff15523a..2f10ae8d 100644 --- a/win32/pdckbd.c +++ b/win32/pdckbd.c @@ -7,13 +7,13 @@ * that PDCurses code is used would be appreciated, but is not mandatory. * * Any changes which you make to this software which may improve or enhance -* it, should be forwarded to the current maintainer for the benefit of +* it, should be forwarded to the current maintainer for the benefit of * other users. * * The only restriction placed on this code is that no distribution of * modified PDCurses code be made under the PDCurses name, by anyone * other than the current maintainer. -* +* * See the file maintain.er for details of the current maintainer. *************************************************************************** */ @@ -25,7 +25,7 @@ #include #ifdef PDCDEBUG -char *rcsid_PDCkbd = "$Id: pdckbd.c,v 1.11 2004/01/01 01:13:34 mark Exp $"; +char *rcsid_PDCkbd = "$Id: pdckbd.c,v 1.12 2004/07/01 07:21:13 rexx Exp $"; #endif #define KEY_STATE TRUE @@ -50,7 +50,7 @@ char *rcsid_PDCkbd = "$Id: pdckbd.c,v 1.11 2004/01/01 01:13:34 mark Exp $"; # define RIGHTMOST_BUTTON_PRESSED 0x0002 #endif /* - * These variables are used to store information about the next + * These variables are used to store information about the next * Input Event. */ INPUT_RECORD save_ip; @@ -74,7 +74,7 @@ static int win32_kbhit(int); * These values are for strict IBM keyboard compatibles only *******************************************************************************/ -typedef struct +typedef struct { int normal; int shift; @@ -85,142 +85,142 @@ typedef struct static KPTAB kptab[] = { - {0, 0, 0, 0, 0 }, /* 0 */ - {0, 0, 0, 0, 0 }, /* 1 */ - {0, 0, 0, 0, 0 }, /* 2 */ - {0, 0, 0, 0, 0 }, /* 3 */ - {0, 0, 0, 0, 0 }, /* 4 */ - {0, 0, 0, 0, 0 }, /* 5 */ - {0, 0, 0, 0, 0 }, /* 6 */ - {0, 0, 0, 0, 0 }, /* 7 */ - {0x08, 0x08, 0x7F, ALT_BKSP, 0 }, /* 8 */ - {0x09, KEY_BTAB, CTL_TAB, ALT_TAB, 999 }, /* 9 */ - {0, 0, 0, 0, 0 }, /* 10 */ - {0, 0, 0, 0, 0 }, /* 11 */ - {KEY_B2, 0x35, CTL_PAD5, ALT_PAD5, 0 }, /* 12 */ - {0x0D, 0x0D, CTL_ENTER, ALT_ENTER, 1 }, /* 13 */ - {0, 0, 0, 0, 0 }, /* 14 */ - {0, 0, 0, 0, 0 }, /* 15 */ - {0, 0, 0, 0, 0 }, /* 16 */ - {0, 0, 0, 0, 0 }, /* 17 */ - {0, 0, 0, 0, 0 }, /* 18 */ - {0, 0, 0, 0, 0 }, /* 19 */ - {0, 0, 0, 0, 0 }, /* 20 */ - {0, 0, 0, 0, 0 }, /* 21 */ - {0, 0, 0, 0, 0 }, /* 22 */ - {0, 0, 0, 0, 0 }, /* 23 */ - {0, 0, 0, 0, 0 }, /* 24 */ - {0, 0, 0, 0, 0 }, /* 25 */ - {0, 0, 0, 0, 0 }, /* 26 */ - {0x1B, 0x1B, 0x1B, ALT_ESC, 0 }, /* 27 */ - {0, 0, 0, 0, 0 }, /* 28 */ - {0, 0, 0, 0, 0 }, /* 29 */ - {0, 0, 0, 0, 0 }, /* 30 */ - {0, 0, 0, 0, 0 }, /* 31 */ - {0x20, 0x20, 0x20, 0x20, 0 }, /* 32 */ - {KEY_A3, 0x39, CTL_PAD9, ALT_PAD9, 3 }, /* 33 */ - {KEY_C3, 0x33, CTL_PAD3, ALT_PAD3, 4 }, /* 34 */ - {KEY_C1, 0x31, CTL_PAD1, ALT_PAD1, 5 }, /* 35 */ - {KEY_A1, 0x37, CTL_PAD7, ALT_PAD7, 6 }, /* 36 */ - {KEY_B1, 0x34, CTL_PAD4, ALT_PAD4, 7 }, /* 37 */ - {KEY_A2, 0x38, CTL_PAD8, ALT_PAD8, 8 }, /* 38 */ - {KEY_B3, 0x36, CTL_PAD6, ALT_PAD6, 9 }, /* 39 */ - {KEY_C2, 0x32, CTL_PAD2, ALT_PAD2, 10 }, /* 40 */ - {0, 0, 0, 0, 0 }, /* 41 */ - {0, 0, 0, 0, 0 }, /* 42 */ - {0, 0, 0, 0, 0 }, /* 43 */ - {0, 0, 0, 0, 0 }, /* 44 */ - {PAD0, 0x30, CTL_PAD0, ALT_PAD0, 11 }, /* 45 */ - {PADSTOP, 0x2E, CTL_PADSTOP, ALT_PADSTOP,12 }, /* 46 */ - {0, 0, 0, 0, 0 }, /* 47 */ - {0x30, 0x29, 0, ALT_0, 0 }, /* 48 */ - {0x31, 0x21, 0, ALT_1, 0 }, /* 49 */ - {0x32, 0x40, 0, ALT_2, 0 }, /* 50 */ - {0x33, 0x23, 0, ALT_3, 0 }, /* 51 */ - {0x34, 0x24, 0, ALT_4, 0 }, /* 52 */ - {0x35, 0x25, 0, ALT_5, 0 }, /* 53 */ - {0x36, 0x5E, 0, ALT_6, 0 }, /* 54 */ - {0x37, 0x26, 0, ALT_7, 0 }, /* 55 */ - {0x38, 0x2A, 0, ALT_8, 0 }, /* 56 */ - {0x39, 0x28, 0, ALT_9, 0 }, /* 57 */ - {0, 0, 0, 0, 0 }, /* 58 */ - {0, 0, 0, 0, 0 }, /* 59 */ - {0, 0, 0, 0, 0 }, /* 60 */ - {0, 0, 0, 0, 0 }, /* 61 */ - {0, 0, 0, 0, 0 }, /* 62 */ - {0, 0, 0, 0, 0 }, /* 63 */ - {0, 0, 0, 0, 0 }, /* 64 */ - {0x61, 0x41, 0x01, ALT_A, 0 }, /* 65 */ - {0x62, 0x42, 0x02, ALT_B, 0 }, /* 66 */ - {0x63, 0x43, 0x03, ALT_C, 0 }, /* 67 */ - {0x64, 0x44, 0x04, ALT_D, 0 }, /* 68 */ - {0x65, 0x45, 0x05, ALT_E, 0 }, /* 69 */ - {0x66, 0x46, 0x06, ALT_F, 0 }, /* 70 */ - {0x67, 0x47, 0x07, ALT_G, 0 }, /* 71 */ - {0x68, 0x48, 0x08, ALT_H, 0 }, /* 72 */ - {0x69, 0x49, 0x09, ALT_I, 0 }, /* 73 */ - {0x6A, 0x4A, 0x0A, ALT_J, 0 }, /* 74 */ - {0x6B, 0x4B, 0x0B, ALT_K, 0 }, /* 75 */ - {0x6C, 0x4C, 0x0C, ALT_L, 0 }, /* 76 */ - {0x6D, 0x4D, 0x0D, ALT_M, 0 }, /* 77 */ - {0x6E, 0x4E, 0x0E, ALT_N, 0 }, /* 78 */ - {0x6F, 0x4F, 0x0F, ALT_O, 0 }, /* 79 */ - {0x70, 0x50, 0x10, ALT_P, 0 }, /* 80 */ - {0x71, 0x51, 0x11, ALT_Q, 0 }, /* 81 */ - {0x72, 0x52, 0x12, ALT_R, 0 }, /* 82 */ - {0x73, 0x53, 0x13, ALT_S, 0 }, /* 83 */ - {0x74, 0x54, 0x14, ALT_T, 0 }, /* 84 */ - {0x75, 0x55, 0x15, ALT_U, 0 }, /* 85 */ - {0x76, 0x56, 0x16, ALT_V, 0 }, /* 86 */ - {0x77, 0x57, 0x17, ALT_W, 0 }, /* 87 */ - {0x78, 0x58, 0x18, ALT_X, 0 }, /* 88 */ - {0x79, 0x59, 0x19, ALT_Y, 0 }, /* 89 */ - {0x7A, 0x5A, 0x1A, ALT_Z, 0 }, /* 90 */ - {0, 0, 0, 0, 0 }, /* 91 */ - {0, 0, 0, 0, 0 }, /* 92 */ - {0, 0, 0, 0, 0 }, /* 93 */ - {0, 0, 0, 0, 0 }, /* 94 */ - {0, 0, 0, 0, 0 }, /* 95 */ - {0x30, 0, CTL_PAD0, ALT_PAD0, 0 }, /* 96 */ - {0x31, 0, CTL_PAD1, ALT_PAD1, 0 }, /* 97 */ - {0x32, 0, CTL_PAD2, ALT_PAD2, 0 }, /* 98 */ - {0x33, 0, CTL_PAD3, ALT_PAD3, 0 }, /* 99 */ - {0x34, 0, CTL_PAD4, ALT_PAD4, 0 }, /* 100 */ - {0x35, 0, CTL_PAD5, ALT_PAD5, 0 }, /* 101 */ - {0x36, 0, CTL_PAD6, ALT_PAD6, 0 }, /* 102 */ - {0x37, 0, CTL_PAD7, ALT_PAD7, 0 }, /* 103 */ - {0x38, 0, CTL_PAD8, ALT_PAD8, 0 }, /* 104 */ - {0x39, 0, CTL_PAD9, ALT_PAD9, 0 }, /* 105 */ - {PADSTAR, SHF_PADSTAR,CTL_PADSTAR, ALT_PADSTAR,999 }, /* 106 */ - {PADPLUS, SHF_PADPLUS,CTL_PADPLUS, ALT_PADPLUS,999 }, /* 107 */ - {0, 0, 0, 0, 0 }, /* 108 */ - {PADMINUS, SHF_PADMINUS,CTL_PADMINUS,ALT_PADMINUS,999 }, /* 109 */ - {0x2E, 0, CTL_PADSTOP, ALT_PADSTOP,0 }, /* 110 */ - {PADSLASH, SHF_PADSLASH,CTL_PADSLASH,ALT_PADSLASH,2 }, /* 111 */ - {KEY_F(1), KEY_F(13), KEY_F(25), KEY_F(37), 0 }, /* 112 */ - {KEY_F(2), KEY_F(14), KEY_F(26), KEY_F(38), 0 }, /* 113 */ - {KEY_F(3), KEY_F(15), KEY_F(27), KEY_F(39), 0 }, /* 114 */ - {KEY_F(4), KEY_F(16), KEY_F(28), KEY_F(40), 0 }, /* 115 */ - {KEY_F(5), KEY_F(17), KEY_F(29), KEY_F(41), 0 }, /* 116 */ - {KEY_F(6), KEY_F(18), KEY_F(30), KEY_F(42), 0 }, /* 117 */ - {KEY_F(7), KEY_F(19), KEY_F(31), KEY_F(43), 0 }, /* 118 */ - {KEY_F(8), KEY_F(20), KEY_F(32), KEY_F(44), 0 }, /* 119 */ - {KEY_F(9), KEY_F(21), KEY_F(33), KEY_F(45), 0 }, /* 120 */ - {KEY_F(10), KEY_F(22), KEY_F(34), KEY_F(46), 0 }, /* 121 */ - {KEY_F(11), KEY_F(23), KEY_F(35), KEY_F(47), 0 }, /* 122 */ - {KEY_F(12), KEY_F(24), KEY_F(36), KEY_F(48), 0 }, /* 123 */ - {0, 0, 0, 0, 0 }, /* 124 */ - {0, 0, 0, 0, 0 }, /* 125 */ - {0, 0, 0, 0, 0 }, /* 126 */ - {0, 0, 0, 0, 0 }, /* 127 */ - {0, 0, 0, 0, 0 }, /* 128 */ - {0, 0, 0, 0, 0 }, /* 129 */ - {0, 0, 0, 0, 0 }, /* 130 */ - {0, 0, 0, 0, 0 }, /* 131 */ - {0, 0, 0, 0, 0 }, /* 132 */ - {0, 0, 0, 0, 0 }, /* 133 */ - {0, 0, 0, 0, 0 }, /* 134 */ - {0, 0, 0, 0, 0 }, /* 135 */ + {0, 0, 0, 0, 0 }, /* 0 */ + {0, 0, 0, 0, 0 }, /* 1 VK_LBUTTON */ + {0, 0, 0, 0, 0 }, /* 2 VK_RBUTTON */ + {0, 0, 0, 0, 0 }, /* 3 VK_CANCEL */ + {0, 0, 0, 0, 0 }, /* 4 VK_MBUTTON */ + {0, 0, 0, 0, 0 }, /* 5 */ + {0, 0, 0, 0, 0 }, /* 6 */ + {0, 0, 0, 0, 0 }, /* 7 */ + {0x08, 0x08, 0x7F, ALT_BKSP, 0 }, /* 8 VK_BACK */ + {0x09, KEY_BTAB, CTL_TAB, ALT_TAB, 999 }, /* 9 VK_TAB */ + {0, 0, 0, 0, 0 }, /* 10 */ + {0, 0, 0, 0, 0 }, /* 11 */ + {KEY_B2, 0x35, CTL_PAD5, ALT_PAD5, 0 }, /* 12 VK_CLEAR */ + {0x0D, 0x0D, CTL_ENTER, ALT_ENTER, 1 }, /* 13 VK_RETURN */ + {0, 0, 0, 0, 0 }, /* 14 */ + {0, 0, 0, 0, 0 }, /* 15 */ + {0, 0, 0, 0, 0 }, /* 16 VK_SHIFT */ + {0, 0, 0, 0, 0 }, /* 17 VK_CONTROL */ + {0, 0, 0, 0, 0 }, /* 18 VK_MENU */ + {0, 0, 0, 0, 0 }, /* 19 VK_PAUSE */ + {0, 0, 0, 0, 0 }, /* 20 VK_CAPITAL */ + {0, 0, 0, 0, 0 }, /* 21 VK_HANGUL */ + {0, 0, 0, 0, 0 }, /* 22 */ + {0, 0, 0, 0, 0 }, /* 23 VK_JUNJA */ + {0, 0, 0, 0, 0 }, /* 24 VK_FINAL */ + {0, 0, 0, 0, 0 }, /* 25 VK_HANJA */ + {0, 0, 0, 0, 0 }, /* 26 */ + {0x1B, 0x1B, 0x1B, ALT_ESC, 0 }, /* 27 VK_ESCAPE */ + {0, 0, 0, 0, 0 }, /* 28 VK_CONVERT */ + {0, 0, 0, 0, 0 }, /* 29 VK_NONCONVERT */ + {0, 0, 0, 0, 0 }, /* 30 VK_ACCEPT */ + {0, 0, 0, 0, 0 }, /* 31 VK_MODECHANGE */ + {0x20, 0x20, 0x20, 0x20, 0 }, /* 32 VK_SPACE */ + {KEY_A3, 0x39, CTL_PAD9, ALT_PAD9, 3 }, /* 33 VK_PRIOR */ + {KEY_C3, 0x33, CTL_PAD3, ALT_PAD3, 4 }, /* 34 VK_NEXT */ + {KEY_C1, 0x31, CTL_PAD1, ALT_PAD1, 5 }, /* 35 VK_END */ + {KEY_A1, 0x37, CTL_PAD7, ALT_PAD7, 6 }, /* 36 VK_HOME */ + {KEY_B1, 0x34, CTL_PAD4, ALT_PAD4, 7 }, /* 37 VK_LEFT */ + {KEY_A2, 0x38, CTL_PAD8, ALT_PAD8, 8 }, /* 38 VK_UP */ + {KEY_B3, 0x36, CTL_PAD6, ALT_PAD6, 9 }, /* 39 VK_RIGHT */ + {KEY_C2, 0x32, CTL_PAD2, ALT_PAD2, 10 }, /* 40 VK_DOWN */ + {0, 0, 0, 0, 0 }, /* 41 VK_SELECT */ + {0, 0, 0, 0, 0 }, /* 42 VK_PRINT */ + {0, 0, 0, 0, 0 }, /* 43 VK_EXECUTE */ + {0, 0, 0, 0, 0 }, /* 44 VK_SNAPSHOT */ + {PAD0, 0x30, CTL_PAD0, ALT_PAD0, 11 }, /* 45 VK_INSERT */ + {PADSTOP, 0x2E, CTL_PADSTOP, ALT_PADSTOP,12 }, /* 46 VK_DELETE */ + {0, 0, 0, 0, 0 }, /* 47 VK_HELP */ + {0x30, 0x29, 0, ALT_0, 0 }, /* 48 */ + {0x31, 0x21, 0, ALT_1, 0 }, /* 49 */ + {0x32, 0x40, 0, ALT_2, 0 }, /* 50 */ + {0x33, 0x23, 0, ALT_3, 0 }, /* 51 */ + {0x34, 0x24, 0, ALT_4, 0 }, /* 52 */ + {0x35, 0x25, 0, ALT_5, 0 }, /* 53 */ + {0x36, 0x5E, 0, ALT_6, 0 }, /* 54 */ + {0x37, 0x26, 0, ALT_7, 0 }, /* 55 */ + {0x38, 0x2A, 0, ALT_8, 0 }, /* 56 */ + {0x39, 0x28, 0, ALT_9, 0 }, /* 57 */ + {0, 0, 0, 0, 0 }, /* 58 */ + {0, 0, 0, 0, 0 }, /* 59 */ + {0, 0, 0, 0, 0 }, /* 60 */ + {0, 0, 0, 0, 0 }, /* 61 */ + {0, 0, 0, 0, 0 }, /* 62 */ + {0, 0, 0, 0, 0 }, /* 63 */ + {0, 0, 0, 0, 0 }, /* 64 */ + {0x61, 0x41, 0x01, ALT_A, 0 }, /* 65 */ + {0x62, 0x42, 0x02, ALT_B, 0 }, /* 66 */ + {0x63, 0x43, 0x03, ALT_C, 0 }, /* 67 */ + {0x64, 0x44, 0x04, ALT_D, 0 }, /* 68 */ + {0x65, 0x45, 0x05, ALT_E, 0 }, /* 69 */ + {0x66, 0x46, 0x06, ALT_F, 0 }, /* 70 */ + {0x67, 0x47, 0x07, ALT_G, 0 }, /* 71 */ + {0x68, 0x48, 0x08, ALT_H, 0 }, /* 72 */ + {0x69, 0x49, 0x09, ALT_I, 0 }, /* 73 */ + {0x6A, 0x4A, 0x0A, ALT_J, 0 }, /* 74 */ + {0x6B, 0x4B, 0x0B, ALT_K, 0 }, /* 75 */ + {0x6C, 0x4C, 0x0C, ALT_L, 0 }, /* 76 */ + {0x6D, 0x4D, 0x0D, ALT_M, 0 }, /* 77 */ + {0x6E, 0x4E, 0x0E, ALT_N, 0 }, /* 78 */ + {0x6F, 0x4F, 0x0F, ALT_O, 0 }, /* 79 */ + {0x70, 0x50, 0x10, ALT_P, 0 }, /* 80 */ + {0x71, 0x51, 0x11, ALT_Q, 0 }, /* 81 */ + {0x72, 0x52, 0x12, ALT_R, 0 }, /* 82 */ + {0x73, 0x53, 0x13, ALT_S, 0 }, /* 83 */ + {0x74, 0x54, 0x14, ALT_T, 0 }, /* 84 */ + {0x75, 0x55, 0x15, ALT_U, 0 }, /* 85 */ + {0x76, 0x56, 0x16, ALT_V, 0 }, /* 86 */ + {0x77, 0x57, 0x17, ALT_W, 0 }, /* 87 */ + {0x78, 0x58, 0x18, ALT_X, 0 }, /* 88 */ + {0x79, 0x59, 0x19, ALT_Y, 0 }, /* 89 */ + {0x7A, 0x5A, 0x1A, ALT_Z, 0 }, /* 90 */ + {0, 0, 0, 0, 0 }, /* 91 VK_LWIN */ + {0, 0, 0, 0, 0 }, /* 92 VK_RWIN */ + {0, 0, 0, 0, 0 }, /* 93 VK_APPS */ + {0, 0, 0, 0, 0 }, /* 94 */ + {0, 0, 0, 0, 0 }, /* 95 */ + {0x30, 0, CTL_PAD0, ALT_PAD0, 0 }, /* 96 VK_NUMPAD0 */ + {0x31, 0, CTL_PAD1, ALT_PAD1, 0 }, /* 97 VK_NUMPAD1 */ + {0x32, 0, CTL_PAD2, ALT_PAD2, 0 }, /* 98 VK_NUMPAD2 */ + {0x33, 0, CTL_PAD3, ALT_PAD3, 0 }, /* 99 VK_NUMPAD3 */ + {0x34, 0, CTL_PAD4, ALT_PAD4, 0 }, /* 100 VK_NUMPAD4 */ + {0x35, 0, CTL_PAD5, ALT_PAD5, 0 }, /* 101 VK_NUMPAD5 */ + {0x36, 0, CTL_PAD6, ALT_PAD6, 0 }, /* 102 VK_NUMPAD6 */ + {0x37, 0, CTL_PAD7, ALT_PAD7, 0 }, /* 103 VK_NUMPAD7 */ + {0x38, 0, CTL_PAD8, ALT_PAD8, 0 }, /* 104 VK_NUMPAD8 */ + {0x39, 0, CTL_PAD9, ALT_PAD9, 0 }, /* 105 VK_NUMPAD9 */ + {PADSTAR, SHF_PADSTAR,CTL_PADSTAR, ALT_PADSTAR,999 }, /* 106 VK_MULTIPLY */ + {PADPLUS, SHF_PADPLUS,CTL_PADPLUS, ALT_PADPLUS,999 }, /* 107 VK_ADD */ + {0, 0, 0, 0, 0 }, /* 108 VK_SEPARATOR */ + {PADMINUS, SHF_PADMINUS,CTL_PADMINUS,ALT_PADMINUS,999 }, /* 109 VK_SUBTRACT */ + {0x2E, 0, CTL_PADSTOP, ALT_PADSTOP,0 }, /* 110 VK_DECIMAL */ + {PADSLASH, SHF_PADSLASH,CTL_PADSLASH,ALT_PADSLASH,2 }, /* 111 VK_DIVIDE */ + {KEY_F(1), KEY_F(13), KEY_F(25), KEY_F(37), 0 }, /* 112 VK_F1 */ + {KEY_F(2), KEY_F(14), KEY_F(26), KEY_F(38), 0 }, /* 113 VK_F2 */ + {KEY_F(3), KEY_F(15), KEY_F(27), KEY_F(39), 0 }, /* 114 VK_F3 */ + {KEY_F(4), KEY_F(16), KEY_F(28), KEY_F(40), 0 }, /* 115 VK_F4 */ + {KEY_F(5), KEY_F(17), KEY_F(29), KEY_F(41), 0 }, /* 116 VK_F5 */ + {KEY_F(6), KEY_F(18), KEY_F(30), KEY_F(42), 0 }, /* 117 VK_F6 */ + {KEY_F(7), KEY_F(19), KEY_F(31), KEY_F(43), 0 }, /* 118 VK_F7 */ + {KEY_F(8), KEY_F(20), KEY_F(32), KEY_F(44), 0 }, /* 119 VK_F8 */ + {KEY_F(9), KEY_F(21), KEY_F(33), KEY_F(45), 0 }, /* 120 VK_F9 */ + {KEY_F(10), KEY_F(22), KEY_F(34), KEY_F(46), 0 }, /* 121 VK_F10 */ + {KEY_F(11), KEY_F(23), KEY_F(35), KEY_F(47), 0 }, /* 122 VK_F11 */ + {KEY_F(12), KEY_F(24), KEY_F(36), KEY_F(48), 0 }, /* 123 VK_F12 */ + {0, 0, 0, 0, 0 }, /* 124 VK_F13 */ + {0, 0, 0, 0, 0 }, /* 125 VK_F14 */ + {0, 0, 0, 0, 0 }, /* 126 VK_F15 */ + {0, 0, 0, 0, 0 }, /* 127 VK_F16 */ + {0, 0, 0, 0, 0 }, /* 128 VK_F17 */ + {0, 0, 0, 0, 0 }, /* 129 VK_F18 */ + {0, 0, 0, 0, 0 }, /* 130 VK_F19 */ + {0, 0, 0, 0, 0 }, /* 131 VK_F20 */ + {0, 0, 0, 0, 0 }, /* 132 VK_F21 */ + {0, 0, 0, 0, 0 }, /* 133 VK_F22 */ + {0, 0, 0, 0, 0 }, /* 134 VK_F23 */ + {0, 0, 0, 0, 0 }, /* 135 VK_F24 */ {0, 0, 0, 0, 0 }, /* 136 */ {0, 0, 0, 0, 0 }, /* 137 */ {0, 0, 0, 0, 0 }, /* 138 */ @@ -229,8 +229,8 @@ static KPTAB kptab[] = {0, 0, 0, 0, 0 }, /* 141 */ {0, 0, 0, 0, 0 }, /* 142 */ {0, 0, 0, 0, 0 }, /* 143 */ - {0, 0, 0, 0, 0 }, /* 144 */ - {0, 0, 0, 0, 0 }, /* 145 */ + {0, 0, 0, 0, 0 }, /* 144 VK_NUMLOCK */ + {0, 0, 0, 0, 0 }, /* 145 VK_SCROLL */ {0, 0, 0, 0, 0 }, /* 146 */ {0, 0, 0, 0, 0 }, /* 147 */ {0, 0, 0, 0, 0 }, /* 148 */ @@ -245,12 +245,12 @@ static KPTAB kptab[] = {0, 0, 0, 0, 0 }, /* 157 */ {0, 0, 0, 0, 0 }, /* 158 */ {0, 0, 0, 0, 0 }, /* 159 */ - {0, 0, 0, 0, 0 }, /* 160 */ - {0, 0, 0, 0, 0 }, /* 161 */ - {0, 0, 0, 0, 0 }, /* 162 */ - {0, 0, 0, 0, 0 }, /* 163 */ - {0, 0, 0, 0, 0 }, /* 164 */ - {0, 0, 0, 0, 0 }, /* 165 */ + {0, 0, 0, 0, 0 }, /* 160 VK_LSHIFT */ + {0, 0, 0, 0, 0 }, /* 161 VK_RSHIFT */ + {0, 0, 0, 0, 0 }, /* 162 VK_LCONTROL */ + {0, 0, 0, 0, 0 }, /* 163 VK_RCONTROL */ + {0, 0, 0, 0, 0 }, /* 164 VK_LMENU */ + {0, 0, 0, 0, 0 }, /* 165 VK_RMENU */ {0, 0, 0, 0, 0 }, /* 166 */ {0, 0, 0, 0, 0 }, /* 167 */ {0, 0, 0, 0, 0 }, /* 168 */ @@ -451,7 +451,7 @@ unsigned long PDC_get_input_fd() bool PDC_check_bios_key(void) { return(win32_kbhit(0)); -} +} /*man-start********************************************************************* @@ -494,7 +494,7 @@ int PDC_get_bios_key(void) while(1) { win32_getch(); - + switch(save_ip.EventType) { case KEY_EVENT: @@ -512,7 +512,6 @@ int PDC_get_bios_key(void) ); } #endif - local_key_modifiers = pdc_key_modifiers = 0L; ignore_key = 0; switch(save_ip.Event.KeyEvent.wVirtualKeyCode) @@ -572,7 +571,7 @@ int PDC_get_bios_key(void) * If the Unicode character is not zero; its a displayable character. * Check for Ctrl-Alt sequences; they are diatric characters */ - if ( save_ip.Event.KeyEvent.uChar.UnicodeChar != 0 ) + if ( ( SP->os_version < 0x80000000 ) && ( save_ip.Event.KeyEvent.uChar.UnicodeChar != 0 ) ) /* NT only ! */ { idx = save_ip.Event.KeyEvent.wVirtualKeyCode; if ( local_key_modifiers & PDC_KEY_MODIFIER_CONTROL @@ -643,17 +642,19 @@ int PDC_get_bios_key(void) || save_ip.Event.KeyEvent.dwControlKeyState & RIGHT_ALT_PRESSED) && kptab[idx].alt) return(kptab[idx].alt); -/* return((int)(unsigned char)save_ip.Event.KeyEvent.uChar.AsciiChar); */ - return((int)save_ip.Event.KeyEvent.uChar.UnicodeChar); + if ( SP->os_version < 0x80000000 ) /* NT only ! */ + return((int)save_ip.Event.KeyEvent.uChar.UnicodeChar); + else + return((int)(unsigned char)save_ip.Event.KeyEvent.uChar.AsciiChar); } } break; case MOUSE_EVENT: memset((char*)&Temp_Mouse_status,0,sizeof(MOUSE_STATUS)); - /* + /* * button press, release or double click ... */ - if (save_ip.Event.MouseEvent.dwEventFlags == 0 + if (save_ip.Event.MouseEvent.dwEventFlags == 0 || save_ip.Event.MouseEvent.dwEventFlags == DOUBLE_CLICK) { /* @@ -690,8 +691,8 @@ int PDC_get_bios_key(void) } /* * To get here we have a button release event or another button press - * while a current button is pressed. The latter, we throw away. - * We have to use the information from the previous mouse event to + * while a current button is pressed. The latter, we throw away. + * We have to use the information from the previous mouse event to * determine which button was released. */ if (last_button_no == 1 @@ -793,7 +794,7 @@ int PDC_get_bios_key(void) if (trap_mouse && (key = PDC_mouse_in_slk(TEMP_MOUSE_Y_POS,TEMP_MOUSE_X_POS))) return(KEY_F(key)); - + Temp_Mouse_status.changes |= (1 << (button_no-1)); if (save_ip.Event.MouseEvent.dwControlKeyState & SHIFT_PRESSED) TEMP_BUTTON_STATUS(button_no) |= BUTTON_SHIFT; @@ -1025,28 +1026,28 @@ int PDC_sysgetch(void) /*man-start********************************************************************* PDC_validchar() - validate/translate passed character - + PDCurses Description: This is a private PDCurses function. - + Checks that 'c' is a valid character, and if so returns it, with function key translation applied if 'w' has keypad mode set. If char is invalid, returns -1. - + PDCurses Return Value: This function returns -1 if the passed character is invalid, or the WINDOW* 'w' is NULL, or 'w's keypad is not active. - + This function returns 0 under Flexos if the passed character is 0x0300. (-:Forget why. --Frotz 911130:-) - + Otherwise, this function returns the PDCurses equivalent of the passed character. See the function key and key macros in - + PDCurses Errors: There are no errors defined for this routine. - + Portability: PDCurses int PDC_validchar( int c ); @@ -1063,9 +1064,9 @@ int PDC_validchar(int c) if (_getch_win_ == (WINDOW *)NULL) ch = (-1); /* bad window pointer */ - else if ((unsigned int)c < 256) + else if ((unsigned int)c < 256) ch = c; /* normal character */ - else if (!(_getch_win_->_use_keypad)) + else if (!(_getch_win_->_use_keypad)) ch = (-1); /* skip if keys if !keypad mode */ #ifdef PDCDEBUG if (trace_on) PDC_debug("PDC_validchar() - returned: %x\n",ch); @@ -1281,15 +1282,15 @@ static int win32_kbhit(int timeout) #ifdef PDCDEBUG if (trace_on) PDC_debug("win32_kbhit() - called: timeout %d keyCount %d\n", timeout, keyCount); #endif - + if (keyCount > 0) return TRUE; - + if (WaitForSingleObject(hConIn, timeout) != WAIT_OBJECT_0) { return FALSE; } - + PeekConsoleInput(hConIn, &ip, 1, &read); if (read == 0) return(FALSE); diff --git a/win32/pdcscrn.c b/win32/pdcscrn.c index e7e40b7d..fc428b73 100644 --- a/win32/pdcscrn.c +++ b/win32/pdcscrn.c @@ -7,13 +7,13 @@ * that PDCurses code is used would be appreciated, but is not mandatory. * * Any changes which you make to this software which may improve or enhance -* it, should be forwarded to the current maintainer for the benefit of +* it, should be forwarded to the current maintainer for the benefit of * other users. * * The only restriction placed on this code is that no distribution of * modified PDCurses code be made under the PDCurses name, by anyone * other than the current maintainer. -* +* * See the file maintain.er for details of the current maintainer. *************************************************************************** */ @@ -22,7 +22,7 @@ #include #ifdef PDCDEBUG -char *rcsid_PDCscrn = "$Id: pdcscrn.c,v 1.3 2004/04/02 02:25:17 rexx Exp $"; +char *rcsid_PDCscrn = "$Id: pdcscrn.c,v 1.4 2004/07/01 07:21:22 rexx Exp $"; #endif HANDLE hConOut = INVALID_HANDLE_VALUE; @@ -36,7 +36,7 @@ extern LONG InputThread( LPVOID lpThreadData ); CONSOLE_SCREEN_BUFFER_INFO scr; CONSOLE_SCREEN_BUFFER_INFO orig_scr; - + static CHAR_INFO *ciSaveBuffer=NULL; static CHAR_INFO *save_ci=NULL; static DWORD dwConsoleMode=0; @@ -305,6 +305,8 @@ int PDC_scr_open(SCREEN *internal, bool echo) internal->linesrippedoff = 0; internal->linesrippedoffontop = 0; internal->delaytenths = 0; + + internal->os_version = GetVersion(); #if defined(PDC_THREAD_BUILD) /* * Create the anonymous pipe and thread for handling input @@ -415,8 +417,8 @@ int nlines,ncols; if (trace_on) PDC_debug("PDC_resize_screen() - called. Lines: %d Cols: %d\n",nlines,ncols); #endif SP->resized = FALSE; /* prevent endless loops in case of errors */ - - if (nlines == 0 + + if (nlines == 0 && ncols == 0) return(OK); /* undocumented feature: let assign LINES and COLS to current values by the calling @@ -428,10 +430,10 @@ int nlines,ncols; if (!GetConsoleScreenBufferInfo(hConOut,&csbi)) /*needed for recovery*/ return(ERR); max = GetLargestConsoleWindowSize(hConOut); - + size.X = ncols; size.Y = nlines; - + /* Fit window into allowed values */ rect.Left = rect.Top = 0; rect.Right = ncols - 1; @@ -451,7 +453,7 @@ int nlines,ncols; SetConsoleWindowInfo(hConOut, TRUE, &csbi.srWindow); return( (external_resized) ? OK : ERR ); } - + SetConsoleActiveScreenBuffer(hConOut); return ( OK ); #elif defined(FGC)