mirror of
https://github.com/VARCem/PDCurses.git
synced 2026-09-25 00:05:16 +00:00
More ifdefs undone. Also, more structures are now dynamically allocated,
saving space in the data segment (where that applies).
This commit is contained in:
14
curspriv.h
14
curspriv.h
@@ -15,7 +15,7 @@
|
||||
* See the file maintain.er for details of the current maintainer. *
|
||||
************************************************************************/
|
||||
|
||||
/* $Id: curspriv.h,v 1.111 2006/08/11 07:04:31 wmcbrine Exp $ */
|
||||
/* $Id: curspriv.h,v 1.112 2006/08/11 19:50:51 wmcbrine Exp $ */
|
||||
|
||||
/* CURSPRIV.H
|
||||
|
||||
@@ -52,7 +52,7 @@ struct cttyset
|
||||
SCREEN saved;
|
||||
};
|
||||
|
||||
extern struct cttyset ctty[3];
|
||||
extern struct cttyset *ctty;
|
||||
|
||||
/* tracing flag */
|
||||
extern bool trace_on;
|
||||
@@ -78,6 +78,8 @@ extern unsigned long pdc_key_modifiers;
|
||||
|
||||
extern MOUSE_STATUS Trapped_Mouse_status;
|
||||
|
||||
extern unsigned char *atrtab;
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
* ANSI C prototypes.
|
||||
*/
|
||||
@@ -104,20 +106,14 @@ void PDC_reset_shell_mode(void);
|
||||
int PDC_resize_screen(int, int);
|
||||
void PDC_restore_screen_mode(int);
|
||||
int PDC_scr_close(void);
|
||||
void PDC_scr_exit(void);
|
||||
int PDC_scr_open(int, char **);
|
||||
int PDC_set_ctrl_break(bool);
|
||||
int PDC_set_font(int);
|
||||
void PDC_set_keyboard_binary(bool);
|
||||
void PDC_sync(WINDOW *);
|
||||
void PDC_transform_line(int, int, int, const chtype *);
|
||||
int PDC_validchar(int);
|
||||
|
||||
#ifdef XCURSES
|
||||
# define PDC_scr_exit() XCursesExit()
|
||||
#else
|
||||
# define PDC_scr_exit() if (SP) free(SP)
|
||||
#endif
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
void PDC_debug(const char *, ...);
|
||||
# define PDC_LOG(x) if (trace_on) PDC_debug x
|
||||
|
||||
@@ -19,9 +19,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
RCSID("$Id: pdcdisp.c,v 1.48 2006/07/30 03:55:46 wmcbrine Exp $");
|
||||
|
||||
extern unsigned char atrtab[MAX_ATRTAB];
|
||||
RCSID("$Id: pdcdisp.c,v 1.49 2006/08/11 19:50:51 wmcbrine Exp $");
|
||||
|
||||
#ifdef __PACIFIC__
|
||||
void movedata(unsigned sseg, unsigned soff, unsigned dseg,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* See the file maintain.er for details of the current maintainer. *
|
||||
************************************************************************/
|
||||
|
||||
/* $Id: pdcdos.h,v 1.6 2006/08/11 07:04:31 wmcbrine Exp $ */
|
||||
/* $Id: pdcdos.h,v 1.7 2006/08/11 19:50:51 wmcbrine Exp $ */
|
||||
|
||||
#define CURSES_LIBRARY 1
|
||||
#include <curses.h>
|
||||
@@ -120,4 +120,5 @@ int PDC_get_scrn_mode(void);
|
||||
void PDC_putctty(chtype);
|
||||
int PDC_query_adapter_type(void);
|
||||
int PDC_set_80x25(void);
|
||||
int PDC_set_font(int);
|
||||
int PDC_set_scrn_mode(int);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
# include <sys/movedata.h>
|
||||
#endif
|
||||
|
||||
RCSID("$Id: pdcscrn.c,v 1.40 2006/08/11 06:17:48 wmcbrine Exp $");
|
||||
RCSID("$Id: pdcscrn.c,v 1.41 2006/08/11 19:50:51 wmcbrine Exp $");
|
||||
|
||||
Regs regs; /* used in various other modules */
|
||||
|
||||
@@ -89,6 +89,14 @@ int PDC_scr_close(void)
|
||||
return OK;
|
||||
}
|
||||
|
||||
void PDC_scr_exit(void)
|
||||
{
|
||||
if (SP)
|
||||
free(SP);
|
||||
if (atrtab)
|
||||
free(atrtab);
|
||||
}
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
PDC_scr_open() - Internal low-level binding to open the
|
||||
@@ -117,7 +125,8 @@ int PDC_scr_open(int argc, char **argv)
|
||||
#endif
|
||||
PDC_LOG(("PDC_scr_open() - called\n"));
|
||||
|
||||
if ((SP = (SCREEN *)calloc(1, sizeof(SCREEN))) == (SCREEN *)NULL)
|
||||
if (!(SP = (SCREEN *)calloc(1, sizeof(SCREEN)))
|
||||
|| !(atrtab = (unsigned char *)calloc(MAX_ATRTAB, 1)) )
|
||||
return ERR;
|
||||
|
||||
SP->orig_attr = FALSE;
|
||||
|
||||
@@ -19,9 +19,7 @@
|
||||
#include <curses.h>
|
||||
#include <string.h>
|
||||
|
||||
RCSID("$Id: pdcdisp.c,v 1.33 2006/07/30 03:55:46 wmcbrine Exp $");
|
||||
|
||||
extern unsigned char atrtab[MAX_ATRTAB];
|
||||
RCSID("$Id: pdcdisp.c,v 1.34 2006/08/11 19:50:51 wmcbrine Exp $");
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <curses.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
RCSID("$Id: pdcscrn.c,v 1.37 2006/08/11 07:25:40 wmcbrine Exp $");
|
||||
RCSID("$Id: pdcscrn.c,v 1.38 2006/08/11 19:50:51 wmcbrine Exp $");
|
||||
|
||||
#ifdef EMXVIDEO
|
||||
static unsigned char *saved_screen = NULL;
|
||||
@@ -39,6 +39,7 @@ extern int PDC_query_adapter_type(VIOCONFIGINFO *);
|
||||
extern void PDC_set_keyboard_default(void);
|
||||
extern int PDC_set_scrn_mode(VIOMODEINFO);
|
||||
#endif
|
||||
extern int PDC_set_font(int);
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
@@ -118,6 +119,14 @@ static bool PDC_scrn_modes_equal(VIOMODEINFO mode1, VIOMODEINFO mode2)
|
||||
|
||||
#endif
|
||||
|
||||
void PDC_scr_exit(void)
|
||||
{
|
||||
if (SP)
|
||||
free(SP);
|
||||
if (atrtab)
|
||||
free(atrtab);
|
||||
}
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
PDC_scr_open() - Internal low-level binding to open the physical screen
|
||||
@@ -146,7 +155,8 @@ int PDC_scr_open(int argc, char **argv)
|
||||
#endif
|
||||
PDC_LOG(("PDC_scr_open() - called\n"));
|
||||
|
||||
if ((SP = (SCREEN *)calloc(1, sizeof(SCREEN))) == (SCREEN *)NULL)
|
||||
if (!(SP = (SCREEN *)calloc(1, sizeof(SCREEN)))
|
||||
|| !(atrtab = (unsigned char *)calloc(MAX_ATRTAB, 1)) )
|
||||
return ERR;
|
||||
|
||||
#ifdef EMXVIDEO
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
static void PDC_init_pair(short, short, short);
|
||||
|
||||
RCSID("$Id: color.c,v 1.50 2006/07/31 22:27:12 wmcbrine Exp $");
|
||||
RCSID("$Id: color.c,v 1.51 2006/08/11 19:50:51 wmcbrine Exp $");
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
@@ -118,11 +118,7 @@ static bool colorstarted = FALSE;
|
||||
|
||||
/* COLOR_PAIR to attribute encoding table. */
|
||||
|
||||
#ifdef XCURSES
|
||||
unsigned char *atrtab = NULL;
|
||||
#else
|
||||
unsigned char atrtab[MAX_ATRTAB];
|
||||
#endif
|
||||
|
||||
static unsigned char colorset[PDC_COLOR_PAIRS];
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
# undef wnoutrefresh
|
||||
#endif
|
||||
|
||||
RCSID("$Id: initscr.c,v 1.67 2006/08/11 07:08:22 wmcbrine Exp $");
|
||||
RCSID("$Id: initscr.c,v 1.68 2006/08/11 19:50:51 wmcbrine Exp $");
|
||||
|
||||
const char *_curses_notice = "PDCurses 3.0 - Public Domain 2006";
|
||||
|
||||
@@ -61,7 +61,7 @@ int c_ungch[NUNGETCH]; /* array of ungotten chars */
|
||||
|
||||
/* Global definitions for setmode routines */
|
||||
|
||||
struct cttyset ctty[3] = {{0}, {0}, {0}};
|
||||
struct cttyset *ctty;
|
||||
|
||||
#ifdef PDC_WIDE
|
||||
cchar_t _wacs_map[] = {
|
||||
@@ -173,6 +173,12 @@ WINDOW *Xinitscr(int argc, char *argv[])
|
||||
exit(8);
|
||||
}
|
||||
|
||||
if (!(ctty = calloc(3, sizeof(struct cttyset))))
|
||||
{
|
||||
fprintf(stderr, "initscr(): Unable to allocate ctty\n");
|
||||
exit(9);
|
||||
}
|
||||
|
||||
SP->autocr = TRUE; /* cr -> lf by default */
|
||||
SP->raw_out = FALSE; /* tty I/O modes */
|
||||
SP->raw_inp = FALSE; /* tty I/O modes */
|
||||
@@ -280,15 +286,6 @@ int endwin(void)
|
||||
|
||||
PDC_scr_close();
|
||||
|
||||
#if 0
|
||||
/* resetty(); */
|
||||
if (SP->orig_font != SP->font) /* screen has not been resized */
|
||||
{
|
||||
PDC_set_font(SP->orig_font);
|
||||
resize_term(PDC_get_rows(), PDC_get_columns());
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DOS) || defined(OS2)
|
||||
reset_shell_mode();
|
||||
#endif
|
||||
@@ -347,11 +344,16 @@ void delscreen(SCREEN *sp)
|
||||
delwin(curscr);
|
||||
stdscr = (WINDOW *)NULL;
|
||||
curscr = (WINDOW *)NULL;
|
||||
|
||||
SP->alive = FALSE;
|
||||
|
||||
free(ctty);
|
||||
ctty = NULL;
|
||||
|
||||
PDC_scr_exit();
|
||||
|
||||
SP = (SCREEN *)NULL;
|
||||
atrtab = (unsigned char *)NULL;
|
||||
}
|
||||
|
||||
int resize_term(int nlines, int ncols)
|
||||
|
||||
@@ -27,9 +27,8 @@
|
||||
#include <string.h>
|
||||
|
||||
extern HANDLE hConOut;
|
||||
extern unsigned char atrtab[MAX_ATRTAB];
|
||||
|
||||
RCSID("$Id: pdcdisp.c,v 1.34 2006/08/10 08:43:36 wmcbrine Exp $");
|
||||
RCSID("$Id: pdcdisp.c,v 1.35 2006/08/11 19:50:51 wmcbrine Exp $");
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#define CURSES_LIBRARY 1
|
||||
#include <curses.h>
|
||||
|
||||
RCSID("$Id: pdcscrn.c,v 1.50 2006/08/11 07:04:31 wmcbrine Exp $");
|
||||
RCSID("$Id: pdcscrn.c,v 1.51 2006/08/11 19:50:51 wmcbrine Exp $");
|
||||
|
||||
#define PDC_RESTORE_NONE 0
|
||||
#define PDC_RESTORE_BUFFER 1
|
||||
@@ -98,6 +98,14 @@ int PDC_scr_close(void)
|
||||
return OK;
|
||||
}
|
||||
|
||||
void PDC_scr_exit(void)
|
||||
{
|
||||
if (SP)
|
||||
free(SP);
|
||||
if (atrtab)
|
||||
free(atrtab);
|
||||
}
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
PDC_scr_open() - Internal low-level binding to open the physical screen
|
||||
@@ -124,7 +132,8 @@ int PDC_scr_open(int argc, char **argv)
|
||||
|
||||
PDC_LOG(("PDC_scr_open() - called\n"));
|
||||
|
||||
if ((SP = (SCREEN *)calloc(1, sizeof(SCREEN))) == (SCREEN *)NULL)
|
||||
if (!(SP = (SCREEN *)calloc(1, sizeof(SCREEN)))
|
||||
|| !(atrtab = (unsigned char *)calloc(MAX_ATRTAB, 1)) )
|
||||
return ERR;
|
||||
|
||||
hConOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
@@ -24,41 +24,10 @@
|
||||
#define CURSES_LIBRARY 1
|
||||
#include <curses.h>
|
||||
|
||||
RCSID("$Id: pdcsetsc.c,v 1.25 2006/08/10 08:43:36 wmcbrine Exp $");
|
||||
RCSID("$Id: pdcsetsc.c,v 1.26 2006/08/11 19:50:51 wmcbrine Exp $");
|
||||
|
||||
extern HANDLE hConOut;
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
PDC_set_font() - sets the current font size
|
||||
|
||||
PDCurses Description:
|
||||
This is a private PDCurses function.
|
||||
|
||||
This routine sets the current font size, if the adapter allows
|
||||
such a change.
|
||||
|
||||
PDCurses Return Value:
|
||||
This function returns OK upon success otherwise ERR is returned.
|
||||
|
||||
PDCurses Errors:
|
||||
It is an error to attempt to change the font size on a "bogus"
|
||||
adapter. The reason for this is that we have a known video
|
||||
adapter identity problem. e.g. Two adapters report the same
|
||||
identifying characteristics.
|
||||
|
||||
Portability:
|
||||
PDCurses int PDC_set_font(int size);
|
||||
|
||||
**man-end****************************************************************/
|
||||
|
||||
int PDC_set_font(int size)
|
||||
{
|
||||
PDC_LOG(("PDC_set_font() - called\n"));
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int PDC_curs_set(int visibility)
|
||||
{
|
||||
CONSOLE_CURSOR_INFO cci;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "pdcx11.h"
|
||||
|
||||
RCSID("$Id: pdcscrn.c,v 1.34 2006/08/11 07:04:31 wmcbrine Exp $");
|
||||
RCSID("$Id: pdcscrn.c,v 1.35 2006/08/11 19:50:51 wmcbrine Exp $");
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
@@ -43,6 +43,11 @@ int PDC_scr_close(void)
|
||||
return OK;
|
||||
}
|
||||
|
||||
void PDC_scr_exit(void)
|
||||
{
|
||||
XCursesExit();
|
||||
}
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
PDC_scr_open() - Internal low-level binding to open the physical
|
||||
|
||||
@@ -19,38 +19,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
RCSID("$Id: pdcsetsc.c,v 1.22 2006/07/30 23:57:04 wmcbrine Exp $");
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
PDC_set_font() - sets the current font size
|
||||
|
||||
PDCurses Description:
|
||||
This is a private PDCurses function.
|
||||
|
||||
This routine sets the current font size, if the adapter allows
|
||||
such a change.
|
||||
|
||||
PDCurses Return Value:
|
||||
This function returns OK upon success otherwise ERR is returned.
|
||||
|
||||
PDCurses Errors:
|
||||
It is an error to attempt to change the font size on a "bogus"
|
||||
adapter. The reason for this is that we have a known video
|
||||
adapter identity problem. e.g. Two adapters report the same
|
||||
identifying characteristics.
|
||||
|
||||
Portability:
|
||||
PDCurses int PDC_set_font(int size);
|
||||
|
||||
**man-end****************************************************************/
|
||||
|
||||
int PDC_set_font(int size)
|
||||
{
|
||||
PDC_LOG(("PDC_set_font() - called\n"));
|
||||
|
||||
return OK;
|
||||
}
|
||||
RCSID("$Id: pdcsetsc.c,v 1.23 2006/08/11 19:50:51 wmcbrine Exp $");
|
||||
|
||||
int PDC_curs_set(int visibility)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* See the file maintain.er for details of the current maintainer. *
|
||||
************************************************************************/
|
||||
|
||||
/* $Id: pdcx11.h,v 1.47 2006/07/30 23:57:04 wmcbrine Exp $ */
|
||||
/* $Id: pdcx11.h,v 1.48 2006/08/11 19:50:51 wmcbrine Exp $ */
|
||||
|
||||
#define CURSES_LIBRARY 1
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -179,7 +179,6 @@ extern int shmkey_Xcurscr;
|
||||
extern int otherpid;
|
||||
extern int XCursesLINES;
|
||||
extern int XCursesCOLS;
|
||||
extern unsigned char *atrtab;
|
||||
extern int XC_display_sock;
|
||||
extern int XC_key_sock;
|
||||
extern int display_sockets[2];
|
||||
|
||||
Reference in New Issue
Block a user