]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/curses.priv.h
ncurses 5.7 - patch 20091205
[ncurses.git] / ncurses / curses.priv.h
index f0e9f767fab03074c886a421a3bc8e32ae020280..dbc5e29cec10ac6ec6e2bf4700150dd484c377a8 100644 (file)
@@ -35,7 +35,7 @@
 
 
 /*
- * $Id: curses.priv.h,v 1.439 2009/09/26 22:25:35 tom Exp $
+ * $Id: curses.priv.h,v 1.445 2009/12/05 21:20:51 tom Exp $
  *
  *     curses.priv.h
  *
@@ -686,8 +686,10 @@ typedef struct {
  */
 #if MIXEDCASE_FILENAMES
 #define LEAF_FMT "%c"
+#define LEAF_LEN 1
 #else
 #define LEAF_FMT "%02x"
+#define LEAF_LEN 2
 #endif
 
 /*
@@ -700,6 +702,13 @@ typedef struct {
 #define TRACEMSE_MAX   (80 + (5 * 10) + (32 * 15))
 #define TRACEMSE_FMT   "id %2d  at (%2d, %2d, %2d) state %4lx = {" /* } */
 
+#ifdef USE_TERM_DRIVER
+struct DriverTCB; /* Terminal Control Block forward declaration */
+#define INIT_TERM_DRIVER()     _nc_globals.term_driver = _nc_get_driver
+#else
+#define INIT_TERM_DRIVER()     /* nothing */
+#endif
+
 /*
  * Global data which is not specific to a screen.
  */
@@ -746,6 +755,10 @@ typedef struct {
        int             safeprint_rows;
 #endif
 
+#ifdef USE_TERM_DRIVER
+       int             (*term_driver)(struct DriverTCB*, const char*, int*);
+#endif
+
 #ifdef TRACE
        bool            init_trace;
        char            trace_fname[PATH_MAX];
@@ -805,6 +818,7 @@ typedef struct {
 #if NCURSES_NO_PADDING
        bool            _no_padding;    /* flag to set if padding disabled  */
 #endif
+       NCURSES_SP_OUTC _outch;         /* output handler if not putc */
 #if BROKEN_LINKER || USE_REENTRANT
        chtype          *real_acs_map;
        int             _LINES;
@@ -1257,7 +1271,7 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
                                        putc(PUTC_ch,b);                            \
                                    break;                                          \
                                }                                                   \
-                               fwrite(PUTC_buf, (unsigned) PUTC_n, 1, b);          \
+                               IGNORE_RC(fwrite(PUTC_buf, (unsigned) PUTC_n, 1, b)); \
                            }                                                       \
                            COUNT_OUTCHARS(PUTC_i);                                 \
                        } } } while (0)
@@ -1500,6 +1514,15 @@ extern NCURSES_EXPORT(const char *) _nc_viscbuf (const NCURSES_CH_T *, int);
 
 #endif /* TRACE/!TRACE */
 
+/*
+ * Workaround for defective implementation of gcc attribute warn_unused_result
+ */
+#if defined(__GNUC__) && defined(_FORTIFY_SOURCE)
+#define IGNORE_RC(func) errno = func
+#else
+#define IGNORE_RC(func) (void) func
+#endif /* gcc workarounds */
+
 /*
  * Return-codes for tgetent() and friends.
  */
@@ -1710,6 +1733,7 @@ extern NCURSES_EXPORT(char *) _nc_get_locale(void);
 extern NCURSES_EXPORT(int)    _nc_unicode_locale(void);
 extern NCURSES_EXPORT(int)    _nc_locale_breaks_acs(TERMINAL *);
 extern NCURSES_EXPORT(int)    _nc_setupterm(NCURSES_CONST char *, int, int *, bool);
+extern NCURSES_EXPORT(void)   _nc_tinfo_cmdch(TERMINAL *, char);
 
 /* lib_set_term.c */
 extern NCURSES_EXPORT(int)    _nc_ripoffline(int, int(*)(WINDOW*, int));
@@ -1833,6 +1857,26 @@ extern NCURSES_EXPORT(int) _nc_eventlist_timeout(_nc_eventlist *);
 #define wgetnstr_events(win, str, maxlen, evl) wgetnstr(win, str, maxlen)
 #endif
 
+/*
+ * Wide-character macros to hide some platform-differences.
+ */
+#if USE_WIDEC_SUPPORT
+#if HAVE_MBTOWC && HAVE_MBLEN
+#define reset_mbytes(state) IGNORE_RC(mblen(NULL, 0)), IGNORE_RC(mbtowc(NULL, NULL, 0))
+#define count_mbytes(buffer,length,state) mblen(buffer,length)
+#define check_mbytes(wch,buffer,length,state) \
+       (int) mbtowc(&wch, buffer, length)
+#define state_unused
+#elif HAVE_MBRTOWC && HAVE_MBRLEN
+#define reset_mbytes(state) init_mb(state)
+#define count_mbytes(buffer,length,state) mbrlen(buffer,length,&state)
+#define check_mbytes(wch,buffer,length,state) \
+       (int) mbrtowc(&wch, buffer, length, &state)
+#else
+make an error
+#endif
+#endif
+
 /*
  * Not everyone has vsscanf(), but we'd like to use it for scanw().
  */
@@ -1928,7 +1972,6 @@ extern NCURSES_EXPORT(int) _nc_get_tty_mode(TTY *);
     sp->jump = outc
 
 #ifdef USE_TERM_DRIVER
-struct DriverTCB; /* Terminal Control Block forward declaration */
 typedef void* TERM_HANDLE;
 
 typedef struct _termInfo