****************************************************************************/
/*
- * $Id: curses.priv.h,v 1.505 2012/08/25 20:49:15 tom Exp $
+ * $Id: curses.priv.h,v 1.514 2012/12/15 20:03:45 tom Exp $
*
* curses.priv.h
*
extern NCURSES_EXPORT(int) _nc_env_access (void);
#endif
-/*
- * Not all platforms have memmove; some have an equivalent bcopy. (Some may
- * have neither).
- */
-#if USE_OK_BCOPY
-#define memmove(d,s,n) bcopy(s,d,n)
-#elif USE_MY_MEMMOVE
-#define memmove(d,s,n) _nc_memmove(d,s,n)
-extern NCURSES_EXPORT(void *) _nc_memmove (void *, const void *, size_t);
-#endif
-
/*
* If we have va_copy(), use it for assigning va_list's.
*/
AttrOf(dst) |= (attr_t) (ext + 1)
#define if_WIDEC(code) code
-#define Charable(ch) ((SP_PARM != 0 && SP_PARM->_legacy_coding) \
+#define Charable(ch) ((SP_PARM->_legacy_coding) \
|| (AttrOf(ch) & A_ALTCHARSET) \
|| (!isWidecExt(ch) && \
(ch).chars[1] == L'\0' && \
#define ARG_CH_T NCURSES_CH_T
#define CARG_CH_T NCURSES_CH_T
#define PUTC_DATA /* nothing */
-#define PUTC(ch) NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx ch)
+#define PUTC(ch) NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx (int) ch)
#define BLANK (' '|A_NORMAL)
#define ZEROS ('\0'|A_NORMAL)
#include <nc_alloc.h>
+/*
+ * Use these for tic/infocmp malloc failures. Generally the ncurses library
+ * tries to limp along after a failure.
+ */
+#define TYPE_MALLOC(type, size, name) \
+ name = typeMalloc(type, size); \
+ if (name == 0) \
+ _nc_err_abort(MSG_NO_MEMORY)
+
+#define TYPE_REALLOC(type, size, name) \
+ name = typeRealloc(type, size, name); \
+ if (name == 0) \
+ _nc_err_abort(MSG_NO_MEMORY)
+
/*
* TTY bit definition for converting tabs to spaces.
*/
* Wide-character macros to hide some platform-differences.
*/
#if USE_WIDEC_SUPPORT
+
+#if defined(__MINGW32__)
+/*
+ * MinGW has wide-character functions, but they do not work correctly.
+ */
+
+extern int __MINGW_NOTHROW _nc_wctomb(char *, wchar_t);
+#define wctomb(s,wc) _nc_wctomb(s,wc)
+#define wcrtomb(s,wc,n) _nc_wctomb(s,wc)
+
+extern int __MINGW_NOTHROW _nc_mbtowc(wchar_t *, const char *, size_t);
+#define mbtowc(pwc,s,n) _nc_mbtowc(pwc,s,n)
+
+extern int __MINGW_NOTHROW _nc_mblen(const char *, size_t);
+#define mblen(s,n) _nc_mblen(s, n)
+
+#endif /* __MINGW32__ */
+
#if HAVE_MBTOWC && HAVE_MBLEN
#define reset_mbytes(state) IGNORE_RC(mblen(NULL, (size_t) 0)), IGNORE_RC(mbtowc(NULL, NULL, (size_t) 0))
#define count_mbytes(buffer,length,state) mblen(buffer,length)
#else
make an error
#endif
-#endif
+
+#endif /* USE_WIDEC_SUPPORT */
/*
* Not everyone has vsscanf(), but we'd like to use it for scanw().
#define SetSafeOutcWrapper(outc) \
SCREEN* sp = CURRENT_SCREEN; \
+ struct screen outc_wrapper; \
if (sp==0) { \
- struct screen dummy; \
- sp = &dummy; \
+ sp = &outc_wrapper; \
memset(sp,0,sizeof(struct screen)); \
sp->_outch = _nc_outc_wrapper; \
}\