Removed PDC_set_ctrl_break() and PDC_get_ctrl_break(). Unimplemented on

Win32 and X11, largely useless elsewhere since the use of binary input
mode... except for one platform: DJGPP. It handles ^C and ^Break itself,
unless told not to. And it turns out that I broke that in the post-2.8
restructing of wgetch(). So, now it's handled for DJGPP in
PDC_set_keyboard_binary(), which is now called from PDC_scr_open() (as
with OS/2). To Do: I'm still debating whether or not to reintroduce
PDC_set_ctrl_break(), as a wrapper around PDC_set_keyboard_binary(), for
the benefit of some applications that misguidedly use it.
This commit is contained in:
William McBrine
2007-01-05 12:01:23 +00:00
parent 4d8ea88a53
commit c5d1047c67
10 changed files with 25 additions and 176 deletions

View File

@@ -11,7 +11,7 @@
* See the file maintain.er for details of the current maintainer. *
************************************************************************/
/* $Id: curses.h,v 1.268 2007/01/03 14:12:50 wmcbrine Exp $ */
/* $Id: curses.h,v 1.269 2007/01/05 12:01:22 wmcbrine Exp $ */
/*----------------------------------------------------------------------*
* PDCurses *
@@ -39,7 +39,7 @@ PDCurses portable platform definitions list:
**man-end****************************************************************/
#define PDC_BUILD 2826
#define PDC_BUILD 2827
#define PDCURSES 1 /* PDCurses-only routines */
#define XOPEN 1 /* X/Open Curses routines */
#define SYSVcurses 1 /* System V Curses routines */
@@ -502,7 +502,6 @@ typedef struct
bool echo; /* if terminal echo */
bool raw_inp; /* raw input mode (v. cooked input) */
bool raw_out; /* raw output mode (7 v. 8 bits) */
bool orgcbr; /* original MSDOS ^-BREAK setting */
bool audible; /* FALSE if the bell is visual */
bool mono; /* TRUE if current screen is mono */
bool resized; /* TRUE if TERM has been resized */

View File

@@ -11,7 +11,7 @@
* See the file maintain.er for details of the current maintainer. *
************************************************************************/
/* $Id: curspriv.h,v 1.146 2007/01/03 15:32:05 wmcbrine Exp $ */
/* $Id: curspriv.h,v 1.147 2007/01/05 12:01:22 wmcbrine Exp $ */
/* CURSPRIV.H
@@ -73,7 +73,6 @@ int PDC_curs_set(int);
void PDC_flushinp(void);
int PDC_get_bios_key(void);
int PDC_get_columns(void);
bool PDC_get_ctrl_break(void);
int PDC_get_cursor_mode(void);
int PDC_get_rows(void);
void PDC_gotoyx(int, int);
@@ -89,7 +88,6 @@ void PDC_save_screen_mode(int);
void PDC_scr_close(void);
void PDC_scr_free(void);
int PDC_scr_open(int, char **);
int PDC_set_ctrl_break(bool);
void PDC_set_keyboard_binary(bool);
void PDC_transform_line(int, int, int, const chtype *);
const char *PDC_sysname(void);

View File

@@ -11,10 +11,6 @@
* See the file maintain.er for details of the current maintainer. *
************************************************************************/
#ifdef __DJGPP__
# include <signal.h>
#endif
/* MS C doesn't return flags from int86() */
#ifdef MSC
# define USE_KBHIT
@@ -26,7 +22,12 @@
#include "pdcdos.h"
RCSID("$Id: pdckbd.c,v 1.76 2007/01/02 15:57:57 wmcbrine Exp $");
#ifdef __DJGPP__
# include <fcntl.h>
# include <io.h>
#endif
RCSID("$Id: pdckbd.c,v 1.77 2007/01/05 12:01:22 wmcbrine Exp $");
/*man-start**************************************************************
@@ -120,6 +121,11 @@ unsigned long PDC_get_input_fd(void)
void PDC_set_keyboard_binary(bool on)
{
PDC_LOG(("PDC_set_keyboard_binary() - called\n"));
#ifdef __DJGPP__
setmode(fileno(stdin), on ? O_BINARY : O_TEXT);
setcbrk(!on);
#endif
}
/* check if a key or mouse event is waiting */
@@ -462,43 +468,6 @@ int PDC_get_bios_key(void)
return key;
}
/* return OS control break state */
bool PDC_get_ctrl_break(void)
{
PDCREGS regs;
PDC_LOG(("PDC_get_ctrl_break() - called\n"));
regs.h.ah = 0x33;
regs.h.al = 0x00;
PDCINT(0x21, regs);
return (bool)regs.h.dl;
}
/* enable/disable the host OS BREAK key check */
int PDC_set_ctrl_break(bool setting)
{
#ifndef __DJGPP__
PDCREGS regs;
#endif
PDC_LOG(("PDC_set_ctrl_break() - called\n"));
#ifdef __DJGPP__
signal(SIGINT, setting ? SIG_DFL : SIG_IGN);
/* __djgpp_set_ctrl_c(setting);*/
setcbrk(setting);
#else
regs.h.ah = 0x33;
regs.h.al = 0x01;
regs.h.dl = setting;
PDCINT(0x21, regs);
#endif
return OK;
}
/* discard any pending keyboard or mouse input -- this is the core
routine for flushinp() */

View File

@@ -15,7 +15,7 @@
#include <stdlib.h>
RCSID("$Id: pdcscrn.c,v 1.80 2007/01/03 14:10:46 wmcbrine Exp $");
RCSID("$Id: pdcscrn.c,v 1.81 2007/01/05 12:01:22 wmcbrine Exp $");
int pdc_adapter; /* screen type */
int pdc_scrnmode; /* default screen mode */
@@ -515,6 +515,10 @@ int PDC_scr_open(int argc, char **argv)
SP->orig_attr = FALSE;
/* Now set the keyboard into binary mode */
PDC_set_keyboard_binary(TRUE);
pdc_direct_video = TRUE; /* Assume that we can */
pdc_video_seg = 0xb000; /* Base screen segment addr */
pdc_video_ofs = 0x0; /* Base screen segment ofs */

View File

@@ -13,16 +13,6 @@
#include "pdcos2.h"
#if defined(__EMX__) || defined(__WATCOMC__) || defined(__IBMC__) || \
defined(__TURBOC__)
# define HAVE_SIGNAL
# include <signal.h>
#else
# define INCL_DOSSIGNALS
# define INCL_NOCOMMON
# include <bsedos.h>
#endif
#ifdef EMXVIDEO
# include <termios.h>
static int tahead = -1;
@@ -35,7 +25,7 @@ static bool key_pressed = FALSE;
static int mouse_events = 0;
#endif
RCSID("$Id: pdckbd.c,v 1.77 2007/01/02 15:57:57 wmcbrine Exp $");
RCSID("$Id: pdckbd.c,v 1.78 2007/01/05 12:01:22 wmcbrine Exp $");
/*man-start**************************************************************
@@ -491,75 +481,6 @@ int PDC_get_bios_key(void)
return key;
}
/* return OS control break state */
bool PDC_get_ctrl_break(void)
{
#ifdef HAVE_SIGNAL
# ifdef __TURBOC__
void __cdecl (*oldAction) (int);
# else
void (*oldAction) (int);
# endif
#endif
PDC_LOG(("PDC_get_ctrl_break() - called\n"));
#ifdef HAVE_SIGNAL
oldAction = signal(SIGINT, SIG_DFL);
if (oldAction == SIG_ERR)
return FALSE;
else
signal(SIGINT, oldAction);
return (oldAction != SIG_IGN);
#else
PFNSIGHANDLER oldHandler, oldHandler1;
USHORT oldAction, oldAction1;
/* get the current state, and set to ignore */
DosSetSigHandler((PFNSIGHANDLER) NULL, &oldHandler, &oldAction,
SIGA_IGNORE, SIG_CTRLBREAK);
/* restore the previous state */
DosSetSigHandler(oldHandler, &oldHandler1, &oldAction1,
oldAction, SIG_CTRLBREAK);
return (oldAction != SIGA_IGNORE);
#endif
}
/* enable/disable the host OS BREAK key check */
int PDC_set_ctrl_break(bool setting)
{
PDC_LOG(("PDC_set_ctrl_break() - called. Setting: %d\n", setting));
#ifdef HAVE_SIGNAL
signal(SIGINT, setting ? SIG_DFL : SIG_IGN);
signal(SIGBREAK, setting ? SIG_DFL : SIG_IGN);
#else
PFNSIGHANDLER oldHandler;
USHORT oldAction, Action;
/* turn off control C checking */
if (setting)
Action = SIGA_KILL;
else
Action = SIGA_IGNORE;
DosSetSigHandler((PFNSIGHANDLER) NULL, &oldHandler, &oldAction,
Action, SIG_CTRLBREAK);
DosSetSigHandler((PFNSIGHANDLER) NULL, &oldHandler, &oldAction,
Action, SIG_CTRLC);
#endif
return OK;
}
/* discard any pending keyboard or mouse input -- this is the core
routine for flushinp() */

View File

@@ -14,7 +14,7 @@
#include <curspriv.h>
#include <stdlib.h>
RCSID("$Id: initscr.c,v 1.96 2007/01/03 14:11:32 wmcbrine Exp $");
RCSID("$Id: initscr.c,v 1.97 2007/01/05 12:01:23 wmcbrine Exp $");
const char *_curses_notice = "PDCurses 3.0 - Public Domain 2007";
@@ -158,7 +158,6 @@ WINDOW *Xinitscr(int argc, char *argv[])
SP->delaytenths = 0;
SP->line_color = -1;
SP->orgcbr = PDC_get_ctrl_break();
SP->orig_cursor = PDC_get_cursor_mode();
LINES = SP->lines;

View File

@@ -13,7 +13,7 @@
#include <curspriv.h>
RCSID("$Id: inopts.c,v 1.35 2006/12/25 14:27:12 wmcbrine Exp $");
RCSID("$Id: inopts.c,v 1.36 2007/01/05 12:01:23 wmcbrine Exp $");
/*man-start**************************************************************
@@ -281,7 +281,6 @@ int raw(void)
PDC_set_keyboard_binary(TRUE);
SP->raw_inp = TRUE;
PDC_set_ctrl_break(FALSE);
return OK;
}
@@ -292,7 +291,6 @@ int noraw(void)
PDC_set_keyboard_binary(FALSE);
SP->raw_inp = FALSE;
PDC_set_ctrl_break(TRUE);
return OK;
}

View File

@@ -14,7 +14,7 @@
#include <curspriv.h>
#include <string.h>
RCSID("$Id: kernel.c,v 1.68 2006/12/25 14:27:12 wmcbrine Exp $");
RCSID("$Id: kernel.c,v 1.69 2007/01/05 12:01:23 wmcbrine Exp $");
RIPPEDOFFLINE linesripped[5];
char linesrippedoff = 0;
@@ -139,9 +139,6 @@ static int _restore_mode(int i)
{
memcpy(SP, &(ctty[i].saved), sizeof(SCREEN));
if (PDC_get_ctrl_break() != ctty[i].saved.orgcbr)
PDC_set_ctrl_break(ctty[i].saved.orgcbr);
if (ctty[i].saved.raw_out)
raw();

View File

@@ -13,7 +13,7 @@
#include "pdcwin.h"
RCSID("$Id: pdckbd.c,v 1.103 2007/01/02 15:57:57 wmcbrine Exp $");
RCSID("$Id: pdckbd.c,v 1.104 2007/01/05 12:01:23 wmcbrine Exp $");
/*man-start**************************************************************
@@ -645,24 +645,6 @@ int PDC_get_bios_key(void)
return -1;
}
/* return OS control break state */
bool PDC_get_ctrl_break(void)
{
PDC_LOG(("PDC_get_ctrl_break() - called\n"));
return FALSE;
}
/* enable/disable the host OS BREAK key check */
int PDC_set_ctrl_break(bool setting)
{
PDC_LOG(("PDC_set_ctrl_break() - called\n"));
return OK;
}
/* discard any pending keyboard or mouse input -- this is the core
routine for flushinp() */

View File

@@ -13,7 +13,7 @@
#include "pdcx11.h"
RCSID("$Id: pdckbd.c,v 1.55 2007/01/02 15:57:57 wmcbrine Exp $");
RCSID("$Id: pdckbd.c,v 1.56 2007/01/05 12:01:23 wmcbrine Exp $");
/*man-start**************************************************************
@@ -96,24 +96,6 @@ void PDC_set_keyboard_binary(bool on)
PDC_LOG(("PDC_set_keyboard_binary() - called\n"));
}
/* return OS control break state */
bool PDC_get_ctrl_break(void)
{
PDC_LOG(("PDC_get_ctrl_break() - called\n"));
return FALSE;
}
/* enable/disable the host OS BREAK key check */
int PDC_set_ctrl_break(bool setting)
{
PDC_LOG(("PDC_set_ctrl_break() - called\n"));
return OK;
}
/* discard any pending keyboard or mouse input -- this is the core
routine for flushinp() */