Removed meaningless argc/argv passing for non-X11 ports; made initscr()

the core routine and Xinitscr() the wrapper, as it should be.
This commit is contained in:
William McBrine
2019-09-15 02:01:15 -04:00
parent 2579ae1049
commit 2048b6b93e
9 changed files with 41 additions and 40 deletions

View File

@@ -68,9 +68,12 @@ void PDC_reset_shell_mode(void);
int PDC_resize_screen(int, int);
void PDC_restore_screen_mode(int);
void PDC_save_screen_mode(int);
#ifdef XCURSES
void PDC_set_args(int, char **);
#endif
void PDC_scr_close(void);
void PDC_scr_free(void);
int PDC_scr_open(int, char **);
int PDC_scr_open(void);
void PDC_set_keyboard_binary(bool);
void PDC_transform_line(int, int, int, const chtype *);
const char *PDC_sysname(void);

View File

@@ -1,9 +1,9 @@
PDCurses Implementor's Guide
============================
- Version 1.6 - 2019/09/?? - added PDC_doupdate(); removed SP allocation
from PDC_scr_open(); removed
PDC_init_pair(), PDC_pair_content()
- Version 1.6 - 2019/09/?? - added PDC_doupdate(); removed argc, argv
and SP allocation from PDC_scr_open();
removed PDC_init_pair(), PDC_pair_content()
- Version 1.5 - 2019/09/06 - PDC_has_mouse(), removed PDC_get_input_fd()
- Version 1.4 - 2018/12/31 - PDCurses.md -> USERS.md, MANUAL.md; new dir
- Version 1.3 - 2018/01/12 - notes about official ports, new indentation
@@ -248,18 +248,14 @@ the cursor to the lower left corner. (The X11 port does nothing.)
Free any memory allocated by PDC_scr_open(). Called by delscreen().
### int PDC_scr_open(int argc, char **argv);
### int PDC_scr_open(void);
The platform-specific part of initscr(). It's actually called from
Xinitscr(); the arguments, if present, correspond to those used with
main(), and may be used to set the title of the terminal window, or for
other, platform-specific purposes. (The arguments are currently used
only in X11.) PDC_scr_open() must initialize acs_map[] (unless it's
preset) and several members of SP, including lines, cols, mouse_wait,
orig_attr (and if orig_attr is TRUE, orig_fore and orig_back), mono,
_restore and _preserve. If using an existing terminal, and the
environment variable PDC_RESTORE_SCREEN is set, this function may also
store the existing screen image for later restoration by
The platform-specific part of initscr(). It must initialize acs_map[]
(unless it's preset) and several members of SP, including lines, cols,
mouse_wait, orig_attr (and if orig_attr is TRUE, orig_fore and
orig_back), mono, _restore and _preserve. If using an existing terminal,
and the environment variable PDC_RESTORE_SCREEN is set, this function
may also store the existing screen image for later restoration by
PDC_scr_close().

View File

@@ -484,7 +484,7 @@ void PDC_scr_free(void)
/* open the physical screen -- miscellaneous initialization, may save
the existing screen for later restoration */
int PDC_scr_open(int argc, char **argv)
int PDC_scr_open(void)
{
#if SMALL || MEDIUM
struct SREGS segregs;

View File

@@ -84,7 +84,7 @@ void PDC_scr_free(void)
/* open the physical screen -- miscellaneous initialization, may save
the existing screen for later restoration */
int PDC_scr_open(int argc, char **argv)
int PDC_scr_open(void)
{
USHORT totchars;
int i;

View File

@@ -10,7 +10,7 @@ initscr
### Synopsis
WINDOW *initscr(void);
WINDOW *Xinitscr(int argc, char *argv[]);
WINDOW *Xinitscr(int argc, char **argv);
int endwin(void);
bool isendwin(void);
SCREEN *newterm(const char *type, FILE *outfd, FILE *infd);
@@ -116,14 +116,11 @@ MOUSE_STATUS Mouse_status;
extern RIPPEDOFFLINE linesripped[5];
extern char linesrippedoff;
#ifndef XCURSES
static
#endif
WINDOW *Xinitscr(int argc, char *argv[])
WINDOW *initscr(void)
{
int i;
PDC_LOG(("Xinitscr() - called\n"));
PDC_LOG(("initscr() - called\n"));
if (SP && SP->alive)
return NULL;
@@ -132,7 +129,7 @@ WINDOW *Xinitscr(int argc, char *argv[])
if (!SP)
return NULL;
if (PDC_scr_open(argc, argv) == ERR)
if (PDC_scr_open() == ERR)
{
fprintf(stderr, "initscr(): Unable to create SP\n");
exit(8);
@@ -246,12 +243,15 @@ WINDOW *Xinitscr(int argc, char *argv[])
return stdscr;
}
WINDOW *initscr(void)
#ifdef XCURSES
WINDOW *Xinitscr(int argc, char **argv)
{
PDC_LOG(("initscr() - called\n"));
PDC_LOG(("Xinitscr() - called\n"));
return Xinitscr(0, NULL);
PDC_set_args(argc, argv);
return initscr();
}
#endif
int endwin(void)
{
@@ -278,7 +278,7 @@ SCREEN *newterm(const char *type, FILE *outfd, FILE *infd)
{
PDC_LOG(("newterm() - called\n"));
return Xinitscr(0, NULL) ? SP : NULL;
return initscr() ? SP : NULL;
}
SCREEN *set_term(SCREEN *new)

View File

@@ -122,7 +122,7 @@ static void _initialize_colors(void)
/* open the physical screen -- miscellaneous initialization */
int PDC_scr_open(int argc, char **argv)
int PDC_scr_open(void)
{
PDC_LOG(("PDC_scr_open() - called\n"));

View File

@@ -132,7 +132,7 @@ static void _initialize_colors(void)
/* open the physical screen -- miscellaneous initialization */
int PDC_scr_open(int argc, char **argv)
int PDC_scr_open(void)
{
PDC_LOG(("PDC_scr_open() - called\n"));

View File

@@ -372,7 +372,7 @@ void PDC_scr_free(void)
/* open the physical screen -- miscellaneous initialization, may save
the existing screen for later restoration */
int PDC_scr_open(int argc, char **argv)
int PDC_scr_open(void)
{
const char *str;
CONSOLE_SCREEN_BUFFER_INFO csbi;

View File

@@ -161,6 +161,10 @@ static bool exposed = FALSE;
static Pixmap icon_pixmap, icon_pixmap_mask;
static char *prog_name[] = {"PDCurses", NULL};
static char **argv = prog_name;
static int argc = 1;
/* close the physical screen */
void PDC_scr_close(void)
@@ -460,23 +464,21 @@ static void _pointer_setup(void)
&pointerforecolor, &pointerbackcolor);
}
void PDC_set_args(int c, char **v)
{
argc = c;
argv = v;
}
/* open the physical screen -- miscellaneous initialization */
int PDC_scr_open(int argc, char **argv)
int PDC_scr_open(void)
{
char *myargv[] = {"PDCurses", NULL};
bool italic_font_valid, bold_font_valid;
int minwidth, minheight;
PDC_LOG(("PDC_scr_open() - called\n"));
if (!argv)
{
argv = myargv;
argc = 1;
}
/* Start defining X Toolkit things */
#if XtSpecificationRelease > 4