Skip to content

Commit

Permalink
Made the SCREEN structure innards private, and made SP internal to th…
Browse files Browse the repository at this point in the history
…e PDCursesMod library. This breaks the binary API, so we are also going from version 4.3.7 to 4.4.0.
  • Loading branch information
Bill-Gray committed Jul 23, 2023
1 parent bae8da4 commit 1167188
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 63 deletions.
66 changes: 3 additions & 63 deletions curses.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ Defined by this header:
/* NOTE : For version changes that are not backward compatible, */
/* the 'endwin_*' #defines below should be updated. */
#define PDC_VER_MAJOR 4
#define PDC_VER_MINOR 3
#define PDC_VER_CHANGE 7
#define PDC_VER_MINOR 4
#define PDC_VER_CHANGE 0
#define PDC_VER_YEAR 2023
#define PDC_VER_MONTH 07
#define PDC_VER_DAY 23
Expand Down Expand Up @@ -389,66 +389,7 @@ typedef struct _win /* definition of a window */
int _smincol, _smaxcol; /* saved position used only for pads */
} WINDOW;

/* See above warning against directly accessing SCREEN elements. */

typedef struct
{
bool alive; /* if initscr() called, and not endwin() */
bool autocr; /* if cr -> lf */
bool cbreak; /* if terminal unbuffered */
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 audible; /* FALSE if the bell is visual */
bool mono; /* TRUE if current screen is mono */
bool resized; /* TRUE if TERM has been resized */
bool orig_attr; /* TRUE if we have the original colors */
short orig_fore; /* original screen foreground color */
short orig_back; /* original screen foreground color */
int cursrow; /* position of physical cursor */
int curscol; /* position of physical cursor */
int visibility; /* visibility of cursor */
int orig_cursor; /* original cursor size */
int lines; /* new value for LINES */
int cols; /* new value for COLS */
mmask_t _trap_mbe; /* trap these mouse button events */
int mouse_wait; /* time to wait (in ms) for a
button release after a press, in
order to count it as a click */
int slklines; /* lines in use by slk_init() */
WINDOW *slk_winptr; /* window for slk */
int linesrippedoff; /* lines ripped off via ripoffline() */
int linesrippedoffontop; /* lines ripped off on
top via ripoffline() */
int delaytenths; /* 1/10ths second to wait block
getch() for */
bool _preserve; /* TRUE if screen background
to be preserved */
int _restore; /* specifies if screen background
to be restored, and how */
unsigned long key_modifiers; /* key modifiers (SHIFT, CONTROL, etc.)
on last key press */
bool return_key_modifiers; /* TRUE if modifier keys are
returned as "real" keys */
bool in_endwin; /* if we're in endwin(), we should use
only signal-safe code */
MOUSE_STATUS mouse_status; /* last returned mouse status */
short line_color; /* color of line attributes - default -1 */
attr_t termattrs; /* attribute capabilities */
WINDOW *lastscr; /* the last screen image */
FILE *dbfp; /* debug trace file pointer */
bool color_started; /* TRUE after start_color() */
bool dirty; /* redraw on napms() after init_color() */
int sel_start; /* start of selection (y * COLS + x) */
int sel_end; /* end of selection */
int *c_buffer; /* character buffer */
int c_pindex; /* putter index */
int c_gindex; /* getter index */
int *c_ungch; /* array of ungotten chars */
int c_ungind; /* ungetch() push index */
int c_ungmax; /* allocated size of ungetch() buffer */
struct _opaque_screen_t *opaque; /* internal library variables */
} SCREEN;
typedef struct _screen SCREEN;

/*----------------------------------------------------------------------
*
Expand All @@ -470,7 +411,6 @@ PDCEX int LINES; /* terminal height */
PDCEX int COLS; /* terminal width */
PDCEX WINDOW *stdscr; /* the default screen window */
PDCEX WINDOW *curscr; /* the current screen image */
PDCEX SCREEN *SP; /* curses variables */
PDCEX MOUSE_STATUS Mouse_status;
PDCEX int COLORS;
PDCEX int COLOR_PAIRS;
Expand Down
61 changes: 61 additions & 0 deletions curspriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,67 @@ PDCEX int PDC_wcwidth( const int32_t ucs);

#define _is_altcharset( ch) (((ch) & (A_ALTCHARSET | (A_CHARTEXT ^ 0x7f))) == A_ALTCHARSET)

struct _screen
{
bool alive; /* if initscr() called, and not endwin() */
bool autocr; /* if cr -> lf */
bool cbreak; /* if terminal unbuffered */
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 audible; /* FALSE if the bell is visual */
bool mono; /* TRUE if current screen is mono */
bool resized; /* TRUE if TERM has been resized */
bool orig_attr; /* TRUE if we have the original colors */
short orig_fore; /* original screen foreground color */
short orig_back; /* original screen foreground color */
int cursrow; /* position of physical cursor */
int curscol; /* position of physical cursor */
int visibility; /* visibility of cursor */
int orig_cursor; /* original cursor size */
int lines; /* new value for LINES */
int cols; /* new value for COLS */
mmask_t _trap_mbe; /* trap these mouse button events */
int mouse_wait; /* time to wait (in ms) for a
button release after a press, in
order to count it as a click */
int slklines; /* lines in use by slk_init() */
WINDOW *slk_winptr; /* window for slk */
int linesrippedoff; /* lines ripped off via ripoffline() */
int linesrippedoffontop; /* lines ripped off on
top via ripoffline() */
int delaytenths; /* 1/10ths second to wait block
getch() for */
bool _preserve; /* TRUE if screen background
to be preserved */
int _restore; /* specifies if screen background
to be restored, and how */
unsigned long key_modifiers; /* key modifiers (SHIFT, CONTROL, etc.)
on last key press */
bool return_key_modifiers; /* TRUE if modifier keys are
returned as "real" keys */
bool in_endwin; /* if we're in endwin(), we should use
only signal-safe code */
MOUSE_STATUS mouse_status; /* last returned mouse status */
short line_color; /* color of line attributes - default -1 */
attr_t termattrs; /* attribute capabilities */
WINDOW *lastscr; /* the last screen image */
FILE *dbfp; /* debug trace file pointer */
bool color_started; /* TRUE after start_color() */
bool dirty; /* redraw on napms() after init_color() */
int sel_start; /* start of selection (y * COLS + x) */
int sel_end; /* end of selection */
int *c_buffer; /* character buffer */
int c_pindex; /* putter index */
int c_gindex; /* getter index */
int *c_ungch; /* array of ungotten chars */
int c_ungind; /* ungetch() push index */
int c_ungmax; /* allocated size of ungetch() buffer */
struct _opaque_screen_t *opaque; /* internal library variables */
};

PDCEX SCREEN *SP; /* curses variables */

#if PDC_COLOR_BITS < 15
typedef int16_t hash_idx_t;
#else
Expand Down

0 comments on commit 1167188

Please sign in to comment.