diff --git a/curspriv.h b/curspriv.h index b428b140..f9fb3fad 100644 --- a/curspriv.h +++ b/curspriv.h @@ -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); diff --git a/docs/IMPLEMNT.md b/docs/IMPLEMNT.md index a4c36ed7..52022b8d 100644 --- a/docs/IMPLEMNT.md +++ b/docs/IMPLEMNT.md @@ -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(). diff --git a/dos/pdcscrn.c b/dos/pdcscrn.c index b5fa6a9b..393bc533 100644 --- a/dos/pdcscrn.c +++ b/dos/pdcscrn.c @@ -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; diff --git a/os2/pdcscrn.c b/os2/pdcscrn.c index e6efa464..848078d9 100644 --- a/os2/pdcscrn.c +++ b/os2/pdcscrn.c @@ -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; diff --git a/pdcurses/initscr.c b/pdcurses/initscr.c index cddf8af6..01ce1829 100644 --- a/pdcurses/initscr.c +++ b/pdcurses/initscr.c @@ -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) diff --git a/sdl1/pdcscrn.c b/sdl1/pdcscrn.c index fe7e33f3..50d2c15e 100644 --- a/sdl1/pdcscrn.c +++ b/sdl1/pdcscrn.c @@ -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")); diff --git a/sdl2/pdcscrn.c b/sdl2/pdcscrn.c index 5b07ea44..624f6015 100644 --- a/sdl2/pdcscrn.c +++ b/sdl2/pdcscrn.c @@ -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")); diff --git a/wincon/pdcscrn.c b/wincon/pdcscrn.c index cf65eecb..06ea7d2e 100644 --- a/wincon/pdcscrn.c +++ b/wincon/pdcscrn.c @@ -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; diff --git a/x11/pdcscrn.c b/x11/pdcscrn.c index 2856b090..f4ab6767 100644 --- a/x11/pdcscrn.c +++ b/x11/pdcscrn.c @@ -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