/*
- * $Id: curses.priv.h,v 1.436 2009/08/30 18:13:54 tom Exp $
+ * $Id: curses.priv.h,v 1.445 2009/12/05 21:20:51 tom Exp $
*
* curses.priv.h
*
/*
* Options for terminal drivers, etc...
*/
-#if 0
+#ifdef USE_TERM_DRIVER
#define USE_SP_RIPOFF 1
#define USE_SP_TERMTYPE 1
#define USE_SP_WINDOWLIST 1
-#define USE_TERM_DRIVER 1
#endif
/*
*/
#if MIXEDCASE_FILENAMES
#define LEAF_FMT "%c"
+#define LEAF_LEN 1
#else
#define LEAF_FMT "%02x"
+#define LEAF_LEN 2
#endif
/*
#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.
*/
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];
#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;
bool _nc_sp_idlok;
bool _nc_sp_idcok;
-#define _nc_idlok SP_PARM->_nc_sp_idlok
-#define _nc_idcok SP_PARM->_nc_sp_idcok
-
/*
* These are the data that support the mouse interface.
*/
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)
#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.
*/
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));
extern NCURSES_EXPORT(void) _nc_scroll_window (WINDOW *, int const, NCURSES_SIZE_T const, NCURSES_SIZE_T const, NCURSES_CH_T);
#endif
+#if USE_WIDEC_SUPPORT
+extern NCURSES_EXPORT(int) _nc_insert_wch(WINDOW *, const cchar_t *);
+#endif
+
#if USE_WIDEC_SUPPORT && !defined(USE_TERMLIB)
extern NCURSES_EXPORT(size_t) _nc_wcrtomb (char *, wchar_t, mbstate_t *);
#endif
#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().
*/
#define _nc_set_screen(sp) SP = sp
#endif
-#if NCURSES_SP_FUNCS && 0
+#if NCURSES_SP_FUNCS
#define CURRENT_SCREEN_PRE (IsPreScreen(CURRENT_SCREEN) ? CURRENT_SCREEN : new_prescr())
#else
#define CURRENT_SCREEN_PRE CURRENT_SCREEN
sp->jump = outc
#ifdef USE_TERM_DRIVER
-struct DriverTCB; /* Terminal Control Block forward declaration */
typedef void* TERM_HANDLE;
typedef struct _termInfo