summaryrefslogtreecommitdiff
path: root/ex.h
diff options
context:
space:
mode:
Diffstat (limited to 'ex.h')
-rw-r--r--ex.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/ex.h b/ex.h
index b908bb8..395c59d 100644
--- a/ex.h
+++ b/ex.h
@@ -136,6 +136,7 @@
#endif
#ifdef MB
+int wcwidth(wchar_t);
#include <wchar.h>
#include <wctype.h>
#endif
@@ -191,6 +192,8 @@ typedef short line;
typedef int line;
#endif
+typedef short bool;
+
#ifdef LARGEF
typedef off_t bloc;
#else
@@ -252,9 +255,6 @@ typedef short bbloc;
#ifdef EOF
#undef EOF
#endif
-#ifdef printf
-#undef printf
-#endif
#ifdef vprintf
#undef vprintf
#endif
@@ -441,7 +441,8 @@ var int exitoneof; /* exit command loop on EOF */
/*
* Macros
*/
-#define CP(a, b) (ignore(movestr(a, b)))
+#define Copy(t, f, s) memmove(t, f, s)
+#define CP(a, b) memmove(a, b, strlen(b) + 1)
/*
* FIXUNDO: do we want to mung undo vars?
* Usually yes unless in a macro or global.
@@ -449,7 +450,7 @@ var int exitoneof; /* exit command loop on EOF */
#define FIXUNDO (inopen >= 0 && (inopen || !inglobal))
#define ckaw() {if (chng && value(AUTOWRITE)) wop(0);}
#define copy(a,b,c) Copy((char *) (a), (char *) (b), (c))
-#define eq(a, b) ((a) && (b) && strcmp(a, b) == 0)
+#define eq(a, b) ((void *)(a) != NULL && (void *)(b) != NULL && strcmp(a, b) == 0)
#define getexit(a) copy(a, resetlab, sizeof (JMP_BUF))
#define lastchar() lastc
#define outchar(c) (*Outchar)(c)
@@ -551,7 +552,7 @@ var int mb_cur_max;
((c) = *(s) & 0377, (n) = 1))
#define colsc(c) (mb_cur_max > 1 && ((c)&0177) != (c) ? wcwidth(c) : 1)
#define skipleft(l, p) (mb_cur_max > 1 && ((p)[0]&0200 || \
- (p)>(l) && (p)[-1]&0200) ? wskipleft(l, p) : -1)
+ ((p)>(l) && (p)[-1]&0200)) ? wskipleft(l, p) : -1)
#define skipright(l, p) (mb_cur_max > 1 && (p)>=(l) && (p)[0]&0200 ? \
wskipright(l, p) : 1)
#define samechar(cp, c) (mb_cur_max > 1 && *(cp)&0200 ? wsamechar(cp, c) : \
@@ -562,8 +563,8 @@ var int mb_cur_max;
#define xisspace(c) (mb_cur_max > 1 ? iswspace(c) : isspace(c))
#define xisupper(c) (mb_cur_max > 1 ? iswupper(c) : isupper(c))
#define xislower(c) (mb_cur_max > 1 ? iswlower(c) : islower(c))
-#define xtolower(c) (mb_cur_max > 1 ? towlower(c) : tolower(c))
-#define xtoupper(c) (mb_cur_max > 1 ? towupper(c) : toupper(c))
+#define xtolower(c) (mb_cur_max > 1 ? towlower(c) : (wint_t)tolower(c))
+#define xtoupper(c) (mb_cur_max > 1 ? towupper(c) : (wint_t)toupper(c))
#else /* !MB */
#define nextc(c, s, n) ((c) = *(s) & 0377, (n) = 1)
#define colsc(c) (1)