From c7864ed1dff60a303f61f762339e0f396e00b4dd Mon Sep 17 00:00:00 2001 From: Stephen Hurd <admin@localhost.localdomain> Date: Wed, 26 Apr 2023 23:58:31 -0400 Subject: [PATCH] Fix build on openSUSE Tumbleweed (and building without bitmap) Some Linux systems ship with a reentrant ncurses library that does not have an ESCDELAY variable. For now, simply don't allow control over ESCDELAY on the systems since we also currently have a global, and so can't use set_escdelay() as intended. Also, in ripper, stub out all the stuff that's used when HAS_VSTAT is not defined. This makes most of the code not compiled when it's useless anyway. --- src/conio/ciolib.c | 4 ++ src/syncterm/ripper.c | 142 +++++++++++++++++++++++------------------- src/syncterm/term.c | 2 - 3 files changed, 82 insertions(+), 66 deletions(-) diff --git a/src/conio/ciolib.c b/src/conio/ciolib.c index b9120d6370..0cac18b530 100644 --- a/src/conio/ciolib.c +++ b/src/conio/ciolib.c @@ -287,7 +287,11 @@ static int try_curses_init(int mode) cio_api.setvideoflags=curs_setvideoflags; cio_api.getvideoflags=curs_getvideoflags; #if defined(NCURSES_VERSION_MAJOR) || defined (__NetBSD__) +#if NCURSES_REENTRANT + // TODO: set_escdelay() is used for this. +#else cio_api.escdelay=&ESCDELAY; +#endif #endif cio_api.setfont = curs_setfont; cio_api.getfont = curs_getfont; diff --git a/src/syncterm/ripper.c b/src/syncterm/ripper.c index cc5b14b5ca..d50224196f 100644 --- a/src/syncterm/ripper.c +++ b/src/syncterm/ripper.c @@ -38,6 +38,8 @@ // TODO: Output parsing... (yech) // TODO: Actually make the graphics viewport work properly +#ifdef HAS_VSTAT + enum rip_state { RIP_STATE_BOL // Beginning of the line , @@ -15744,10 +15746,62 @@ ansi_only(BYTE *buf, unsigned count) return out - buf; } +static void +handle_mouse_button(struct rip_button_style *but) +{ + if (but->flags.radiogroup) + puts("TODO: Handle radio group"); + if (but->flags.cbgroup) + puts("TODO: Handle checkbox group"); + if (but->flags.explode) + puts("TODO: Handle explode flag"); + handle_command_str(but->command); + + /* + * The docs says this happens before the command str, but the + * behaviour of popups disagrees. + * + * Also, the command str can free() all this stuff! + */ + if (rip.mfields) { + if (but->flags.resetafter) + rv_reset("RESET", NULL); + } +} + +static void +shadow_palette(void) +{ + uint32_t palette[16]; + int i; + + if (get_modepalette(palette)) { + for (i = 0; i < 16; i++) + palette[i] += 16; + set_modepalette(palette); + } +} + +static void +normal_palette(void) +{ + uint32_t palette[16]; + int i; + + if (get_modepalette(palette)) { + for (i = 0; i < 16; i++) + palette[i] -= 16; + set_modepalette(palette); + } +} + +#endif + // This may end up stuffing up to three bytes into the buffer... size_t parse_rip(BYTE *origbuf, unsigned blen, unsigned maxlen) { +#ifdef HAS_VSTAT unsigned pos = 0; size_t rip_start = maxlen + 1; bool copy = false; @@ -16039,12 +16093,29 @@ parse_rip(BYTE *origbuf, unsigned blen, unsigned maxlen) } if (rip.text_disabled) return ansi_only(origbuf, blen); +#endif return blen; } +void +suspend_rip(bool suspend) +{ +#ifdef HAS_VSTAT + if (suspend) { + if (rip.enabled) + rip_suspended = true; + } + else { + if (rip.enabled) + rip_suspended = false; + } +#endif +} + void init_rip(struct bbslist *bbs) { +#ifdef HAS_VSTAT FREE_AND_NULL(rip.xmap); FREE_AND_NULL(rip.ymap); FREE_AND_NULL(rip.xunmap); @@ -16095,58 +16166,24 @@ init_rip(struct bbslist *bbs) set_ega_palette(); normal_palette(); } -} - -void -suspend_rip(bool suspend) -{ - if (suspend) { - if (rip.enabled) - rip_suspended = true; - } - else { - if (rip.enabled) - rip_suspended = false; - } +#endif } int rip_kbhit(void) { +#ifdef HAS_VSTAT if (rip.enabled) if (ripbuf) return 1; - - +#endif return kbhit(); } -static void -handle_mouse_button(struct rip_button_style *but) -{ - if (but->flags.radiogroup) - puts("TODO: Handle radio group"); - if (but->flags.cbgroup) - puts("TODO: Handle checkbox group"); - if (but->flags.explode) - puts("TODO: Handle explode flag"); - handle_command_str(but->command); - - /* - * The docs says this happens before the command str, but the - * behaviour of popups disagrees. - * - * Also, the command str can free() all this stuff! - */ - if (rip.mfields) { - if (but->flags.resetafter) - rv_reset("RESET", NULL); - } -} - int rip_getch(void) { +#ifdef HAS_VSTAT int ch; struct mouse_event mevent; int oldhold = hold_update; @@ -16314,30 +16351,7 @@ rip_getch(void) normal_palette(); hold_update = oldhold; return ch; -} - -static void -shadow_palette(void) -{ - uint32_t palette[16]; - int i; - - if (get_modepalette(palette)) { - for (i = 0; i < 16; i++) - palette[i] += 16; - set_modepalette(palette); - } -} - -static void -normal_palette(void) -{ - uint32_t palette[16]; - int i; - - if (get_modepalette(palette)) { - for (i = 0; i < 16; i++) - palette[i] -= 16; - set_modepalette(palette); - } +#else + return getch(); +#endif } diff --git a/src/syncterm/term.c b/src/syncterm/term.c index d7de504ba5..140ee20114 100644 --- a/src/syncterm/term.c +++ b/src/syncterm/term.c @@ -3430,9 +3430,7 @@ apc_handler(char *strbuf, size_t slen, void *apcd) paste_pixmap(strbuf, slen, fn, apcd); } - // TODO: Copy PPM to memory // TODO: Copy PBM mask to memory - // TODO: Multiple (at least two) memory buffers } void -- GitLab