diff --git a/docs/IMPLEMNT.md b/docs/IMPLEMNT.md index 6e55d11a..0d8b74be 100644 --- a/docs/IMPLEMNT.md +++ b/docs/IMPLEMNT.md @@ -1,7 +1,8 @@ PDCurses Implementor's Guide ============================ -- Version 1.6 - 2019/09/?? - added PDC_doupdate(); removed +- Version 1.6 - 2019/09/?? - added PDC_doupdate(); removed 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 @@ -254,15 +255,13 @@ 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 allocate memory for SP, and 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. (Although SP is -used the same way in all ports, it's allocated here in order to allow -the X11 port to map it to a block of shared memory.) 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(). +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 +PDC_scr_close(). pdcsetsc.c: diff --git a/dos/pdcscrn.c b/dos/pdcscrn.c index 0e790a0a..79a57060 100644 --- a/dos/pdcscrn.c +++ b/dos/pdcscrn.c @@ -496,11 +496,6 @@ int PDC_scr_open(int argc, char **argv) PDC_LOG(("PDC_scr_open() - called\n")); - SP = calloc(1, sizeof(SCREEN)); - - if (!SP) - return ERR; - for (i = 0; i < 16; i++) pdc_curstoreal[realtocurs[i]] = i; diff --git a/os2/pdcscrn.c b/os2/pdcscrn.c index 497bc38c..2fecb4a1 100644 --- a/os2/pdcscrn.c +++ b/os2/pdcscrn.c @@ -93,11 +93,6 @@ int PDC_scr_open(int argc, char **argv) PDC_LOG(("PDC_scr_open() - called\n")); - SP = calloc(1, sizeof(SCREEN)); - - if (!SP) - return ERR; - for (i = 0; i < 16; i++) pdc_curstoreal[realtocurs[i]] = i; diff --git a/pdcurses/initscr.c b/pdcurses/initscr.c index 2fc135a1..e433bb55 100644 --- a/pdcurses/initscr.c +++ b/pdcurses/initscr.c @@ -128,6 +128,10 @@ WINDOW *Xinitscr(int argc, char *argv[]) if (SP && SP->alive) return NULL; + SP = calloc(1, sizeof(SCREEN)); + if (!SP) + return NULL; + if (PDC_scr_open(argc, argv) == ERR) { fprintf(stderr, "initscr(): Unable to create SP\n"); diff --git a/sdl1/pdcscrn.c b/sdl1/pdcscrn.c index 244761a8..31358cd1 100644 --- a/sdl1/pdcscrn.c +++ b/sdl1/pdcscrn.c @@ -128,11 +128,6 @@ int PDC_scr_open(int argc, char **argv) { PDC_LOG(("PDC_scr_open() - called\n")); - SP = calloc(1, sizeof(SCREEN)); - - if (!SP) - return ERR; - pdc_own_screen = !pdc_screen; if (pdc_own_screen) diff --git a/sdl2/pdcscrn.c b/sdl2/pdcscrn.c index bafb4521..be52d32b 100644 --- a/sdl2/pdcscrn.c +++ b/sdl2/pdcscrn.c @@ -138,11 +138,6 @@ int PDC_scr_open(int argc, char **argv) { PDC_LOG(("PDC_scr_open() - called\n")); - SP = calloc(1, sizeof(SCREEN)); - - if (!SP) - return ERR; - pdc_own_window = !pdc_window; if (pdc_own_window) diff --git a/wincon/pdcscrn.c b/wincon/pdcscrn.c index e9fbb4e4..0e45a67f 100644 --- a/wincon/pdcscrn.c +++ b/wincon/pdcscrn.c @@ -385,11 +385,6 @@ int PDC_scr_open(int argc, char **argv) PDC_LOG(("PDC_scr_open() - called\n")); - SP = calloc(1, sizeof(SCREEN)); - - if (!SP) - return ERR; - for (i = 0; i < 16; i++) { pdc_curstoreal[realtocurs[i]] = i; diff --git a/x11/pdcscrn.c b/x11/pdcscrn.c index db54407e..65d1af1e 100644 --- a/x11/pdcscrn.c +++ b/x11/pdcscrn.c @@ -561,8 +561,6 @@ int PDC_scr_open(int argc, char **argv) if (!strcmp(pdc_app_data.textCursor, "vertical")) pdc_vertical_cursor = TRUE; - SP = calloc(1, sizeof(SCREEN)); - SP->lines = LINES; SP->cols = COLS;