summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-01-24 17:18:42 +0100
committerBram Moolenaar <Bram@vim.org>2019-01-24 17:18:42 +0100
commit264b74fa545edfb92c0d7d08a02c26331cc5b168 (patch)
tree2cd0e8517c498f4ce1442492572032be9815654d
parenta12a161b8ce09d024ed71c2134149fa323f8ee8e (diff)
patch 8.1.0810: too many #ifdefsv8.1.0810
Problem: Too many #ifdefs. Solution: Graduate FEAT_MBYTE, part 4.
-rw-r--r--src/ex_cmds.h2
-rw-r--r--src/getchar.c68
-rw-r--r--src/glbl_ime.cpp2
-rw-r--r--src/globals.h36
-rw-r--r--src/gui.h4
-rw-r--r--src/if_py_both.h10
-rw-r--r--src/macros.h59
-rw-r--r--src/option.h40
-rw-r--r--src/os_mac.h4
-rw-r--r--src/os_win32.h15
-rw-r--r--src/proto.h5
-rw-r--r--src/search.c57
-rw-r--r--src/sign.c2
-rw-r--r--src/spell.c177
-rw-r--r--src/spell.h51
-rw-r--r--src/spellfile.c99
-rw-r--r--src/structs.h16
-rw-r--r--src/syntax.c15
-rw-r--r--src/tag.c10
-rw-r--r--src/term.c18
-rw-r--r--src/ui.c114
-rw-r--r--src/version.c8
-rw-r--r--src/vim.h111
-rw-r--r--src/winclip.c141
-rw-r--r--src/window.c9
25 files changed, 200 insertions, 873 deletions
diff --git a/src/ex_cmds.h b/src/ex_cmds.h
index 078af19af5..07afb00616 100644
--- a/src/ex_cmds.h
+++ b/src/ex_cmds.h
@@ -1789,10 +1789,8 @@ struct exarg
int force_bin; /* 0, FORCE_BIN or FORCE_NOBIN */
int read_edit; /* ++edit argument */
int force_ff; /* ++ff= argument (first char of argument) */
-#ifdef FEAT_MBYTE
int force_enc; /* ++enc= argument (index in cmd[]) */
int bad_char; /* BAD_KEEP, BAD_DROP or replacement byte */
-#endif
#ifdef FEAT_USR_CMDS
int useridx; /* user command index */
#endif
diff --git a/src/getchar.c b/src/getchar.c
index 0f8197944a..ff1b06b026 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -291,14 +291,11 @@ add_num_buff(buffheader_T *buf, long n)
static void
add_char_buff(buffheader_T *buf, int c)
{
-#ifdef FEAT_MBYTE
char_u bytes[MB_MAXBYTES + 1];
int len;
int i;
-#endif
char_u temp[4];
-#ifdef FEAT_MBYTE
if (IS_SPECIAL(c))
len = 1;
else
@@ -307,7 +304,6 @@ add_char_buff(buffheader_T *buf, int c)
{
if (!IS_SPECIAL(c))
c = bytes[i];
-#endif
if (IS_SPECIAL(c) || c == K_SPECIAL || c == NUL)
{
@@ -333,9 +329,7 @@ add_char_buff(buffheader_T *buf, int c)
temp[1] = NUL;
}
add_buff(buf, temp, -1L);
-#ifdef FEAT_MBYTE
}
-#endif
}
/* First read ahead buffer. Used for translated commands. */
@@ -596,12 +590,10 @@ AppendToRedobuffLit(
break;
/* Handle a special or multibyte character. */
-#ifdef FEAT_MBYTE
if (has_mbyte)
/* Handle composing chars separately. */
c = mb_cptr2char_adv(&s);
else
-#endif
c = *s++;
if (c < ' ' || c == DEL || (*s == NUL && (c == '0' || c == '^')))
add_char_buff(&redobuff, Ctrl_V);
@@ -686,11 +678,7 @@ stuffReadbuffSpec(char_u *s)
}
else
{
-#ifdef FEAT_MBYTE
c = mb_ptr2char_adv(&s);
-#else
- c = *s++;
-#endif
if (c == CAR || c == NL || c == ESC)
c = ' ';
stuffcharReadbuff(c);
@@ -732,11 +720,9 @@ read_redo(int init, int old_redo)
static buffblock_T *bp;
static char_u *p;
int c;
-#ifdef FEAT_MBYTE
int n;
char_u buf[MB_MAXBYTES + 1];
int i;
-#endif
if (init)
{
@@ -752,7 +738,6 @@ read_redo(int init, int old_redo)
if ((c = *p) != NUL)
{
/* Reverse the conversion done by add_char_buff() */
-#ifdef FEAT_MBYTE
/* For a multi-byte character get all the bytes and return the
* converted character. */
if (has_mbyte && (c != K_SPECIAL || p[1] == KS_SPECIAL))
@@ -760,7 +745,6 @@ read_redo(int init, int old_redo)
else
n = 1;
for (i = 0; ; ++i)
-#endif
{
if (c == K_SPECIAL) /* special key or escaped K_SPECIAL */
{
@@ -776,7 +760,6 @@ read_redo(int init, int old_redo)
bp = bp->b_next;
p = bp->b_str;
}
-#ifdef FEAT_MBYTE
buf[i] = c;
if (i == n - 1) /* last byte of a character */
{
@@ -787,7 +770,6 @@ read_redo(int init, int old_redo)
c = *p;
if (c == NUL) /* cannot happen? */
break;
-#endif
}
}
@@ -1093,11 +1075,7 @@ ins_typebuf(
void
ins_char_typebuf(int c)
{
-#ifdef FEAT_MBYTE
char_u buf[MB_MAXBYTES + 1];
-#else
- char_u buf[4];
-#endif
if (IS_SPECIAL(c))
{
buf[0] = K_SPECIAL;
@@ -1106,14 +1084,7 @@ ins_char_typebuf(int c)
buf[3] = NUL;
}
else
- {
-#ifdef FEAT_MBYTE
buf[(*mb_char2bytes)(c, buf)] = NUL;
-#else
- buf[0] = c;
- buf[1] = NUL;
-#endif
- }
(void)ins_typebuf(buf, KeyNoremap, 0, !KeyTyped, cmd_silent);
}
@@ -1579,11 +1550,9 @@ updatescript(int c)
vgetc(void)
{
int c, c2;
-#ifdef FEAT_MBYTE
int n;
char_u buf[MB_MAXBYTES + 1];
int i;
-#endif
#ifdef FEAT_EVAL
/* Do garbage collection when garbagecollect() was called previously and
@@ -1763,7 +1732,6 @@ vgetc(void)
case K_XRIGHT: c = K_RIGHT; break;
}
-#ifdef FEAT_MBYTE
/* For a multi-byte character get all the bytes and return the
* converted character.
* Note: This will loop until enough bytes are received!
@@ -1794,7 +1762,6 @@ vgetc(void)
--no_mapping;
c = (*mb_ptr2char)(buf);
}
-#endif
break;
}
@@ -2212,7 +2179,6 @@ vgetorpeek(int advance)
break;
}
-#ifdef FEAT_MBYTE
/* Don't allow mapping the first byte(s) of a
* multi-byte char. Happens when mapping
* <M-a> and then changing 'encoding'. Beware
@@ -2225,7 +2191,6 @@ vgetorpeek(int advance)
&& MB_BYTE2LEN(c1) > MB_PTR2LEN(p2))
mlen = 0;
}
-#endif
/*
* Check an entry whether it matches.
* - Full match: mlen == keylen
@@ -2685,38 +2650,29 @@ vgetorpeek(int advance)
curwin->w_wcol = vcol;
vcol += lbr_chartabsize(ptr, ptr + col,
(colnr_T)vcol);
-#ifdef FEAT_MBYTE
if (has_mbyte)
col += (*mb_ptr2len)(ptr + col);
else
-#endif
++col;
}
curwin->w_wrow = curwin->w_cline_row
+ curwin->w_wcol / curwin->w_width;
curwin->w_wcol %= curwin->w_width;
curwin->w_wcol += curwin_col_off();
-#ifdef FEAT_MBYTE
col = 0; /* no correction needed */
-#endif
}
else
{
--curwin->w_wcol;
-#ifdef FEAT_MBYTE
col = curwin->w_cursor.col - 1;
-#endif
}
}
else if (curwin->w_p_wrap && curwin->w_wrow)
{
--curwin->w_wrow;
curwin->w_wcol = curwin->w_width - 1;
-#ifdef FEAT_MBYTE
col = curwin->w_cursor.col - 1;
-#endif
}
-#ifdef FEAT_MBYTE
if (has_mbyte && col > 0 && curwin->w_wcol > 0)
{
/* Correct when the cursor is on the right halve
@@ -2726,7 +2682,6 @@ vgetorpeek(int advance)
if ((*mb_ptr2cells)(ptr + col) > 1)
--curwin->w_wcol;
}
-#endif
}
setcursor();
out_flush();
@@ -3434,7 +3389,6 @@ do_map(
* Otherwise we won't be able to find the start of it in a
* vi-compatible way.
*/
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
int first, last;
@@ -3458,9 +3412,7 @@ do_map(
goto theend;
}
}
- else
-#endif
- if (vim_iswordc(keys[len - 1])) /* ends in keyword char */
+ else if (vim_iswordc(keys[len - 1])) // ends in keyword char
for (n = 0; n < len - 2; ++n)
if (vim_iswordc(keys[n]) != vim_iswordc(keys[len - 2]))
{
@@ -4458,9 +4410,7 @@ check_abbr(
#ifdef FEAT_LOCALMAP
mapblock_T *mp2;
#endif
-#ifdef FEAT_MBYTE
int clen = 0; /* length in characters */
-#endif
int is_id = TRUE;
int vim_abbr;
@@ -4480,7 +4430,6 @@ check_abbr(
if (col == 0) /* cannot be an abbr. */
return FALSE;
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
char_u *p;
@@ -4508,7 +4457,6 @@ check_abbr(
scol = (int)(p - ptr);
}
else
-#endif
{
if (!vim_iswordc(ptr[col - 1]))
vim_abbr = TRUE; /* Vim added abbr. */
@@ -4601,7 +4549,6 @@ check_abbr(
{
if (c < ABBR_OFF && (c < ' ' || c > '~'))
tb[j++] = Ctrl_V; /* special char needs CTRL-V */
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
/* if ABBR_OFF has been added, remove it here */
@@ -4610,7 +4557,6 @@ check_abbr(
j += (*mb_char2bytes)(c, tb + j);
}
else
-#endif
tb[j++] = c;
}
tb[j] = NUL;
@@ -4637,10 +4583,8 @@ check_abbr(
tb[0] = Ctrl_H;
tb[1] = NUL;
-#ifdef FEAT_MBYTE
if (has_mbyte)
len = clen; /* Delete characters instead of bytes */
-#endif
while (len-- > 0) /* delete the from string */
(void)ins_typebuf(tb, 1, 0, TRUE, mp->m_silent);
return TRUE;
@@ -4715,13 +4659,7 @@ vim_strsave_escape_csi(
/* Need a buffer to hold up to three times as much. Four in case of an
* illegal utf-8 byte:
* 0xc0 -> 0xc3 0x80 -> 0xc3 K_SPECIAL KS_SPECIAL KE_FILLER */
- res = alloc((unsigned)(STRLEN(p) *
-#ifdef FEAT_MBYTE
- 4
-#else
- 3
-#endif
- ) + 1);
+ res = alloc((unsigned)(STRLEN(p) * 4) + 1);
if (res != NULL)
{
d = res;
@@ -5012,7 +4950,6 @@ put_escstr(FILE *fd, char_u *strstart, int what)
for ( ; *str != NUL; ++str)
{
-#ifdef FEAT_MBYTE
char_u *p;
/* Check for a multi-byte character, which may contain escaped
@@ -5026,7 +4963,6 @@ put_escstr(FILE *fd, char_u *strstart, int what)
--str;
continue;
}
-#endif
c = *str;
/*
diff --git a/src/glbl_ime.cpp b/src/glbl_ime.cpp
index af13ad2bca..91d52edf17 100644
--- a/src/glbl_ime.cpp
+++ b/src/glbl_ime.cpp
@@ -134,7 +134,7 @@ global_ime_DefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
if (pIApp == NULL || pIApp->OnDefWindowProc(hWnd, Msg,
wParam, lParam, &lResult) != S_OK)
{
-#if defined(WIN3264) && defined(FEAT_MBYTE)
+#if defined(WIN3264)
if (wide_WindowProc)
lResult = DefWindowProcW(hWnd, Msg, wParam, lParam);
else
diff --git a/src/globals.h b/src/globals.h
index ef3764c824..355b4bb349 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -44,7 +44,6 @@ EXTERN sattr_T *ScreenAttrs INIT(= NULL);
EXTERN unsigned *LineOffset INIT(= NULL);
EXTERN char_u *LineWraps INIT(= NULL); /* line wraps to next line */
-#ifdef FEAT_MBYTE
/*
* When using Unicode characters (in UTF-8 encoding) the character in
* ScreenLinesUC[] contains the Unicode for the character at this position, or
@@ -61,7 +60,6 @@ EXTERN int Screen_mco INIT(= 0); /* value of p_mco used when
/* Only used for euc-jp: Second byte of a character that starts with 0x8e.
* These are single-width. */
EXTERN schar_T *ScreenLines2 INIT(= NULL);
-#endif
/*
* Indexes for tab page line:
@@ -798,41 +796,38 @@ EXTERN int vr_lines_changed INIT(= 0); /* #Lines changed by "gR" so far */
EXTERN JMP_BUF x_jump_env;
#endif
-#if defined(FEAT_MBYTE) || defined(FEAT_POSTSCRIPT)
/*
* These flags are set based upon 'fileencoding'.
* Note that "enc_utf8" is also set for "unicode", because the characters are
* internally stored as UTF-8 (to avoid trouble with NUL bytes).
*/
-# define DBCS_JPN 932 /* japan */
-# define DBCS_JPNU 9932 /* euc-jp */
-# define DBCS_KOR 949 /* korea */
-# define DBCS_KORU 9949 /* euc-kr */
-# define DBCS_CHS 936 /* chinese */
-# define DBCS_CHSU 9936 /* euc-cn */
-# define DBCS_CHT 950 /* taiwan */
-# define DBCS_CHTU 9950 /* euc-tw */
-# define DBCS_2BYTE 1 /* 2byte- */
-# define DBCS_DEBUG -1
-#endif
-
-#ifdef FEAT_MBYTE
+#define DBCS_JPN 932 /* japan */
+#define DBCS_JPNU 9932 /* euc-jp */
+#define DBCS_KOR 949 /* korea */
+#define DBCS_KORU 9949 /* euc-kr */
+#define DBCS_CHS 936 /* chinese */
+#define DBCS_CHSU 9936 /* euc-cn */
+#define DBCS_CHT 950 /* taiwan */
+#define DBCS_CHTU 9950 /* euc-tw */
+#define DBCS_2BYTE 1 /* 2byte- */
+#define DBCS_DEBUG -1
+
EXTERN int enc_dbcs INIT(= 0); /* One of DBCS_xxx values if
DBCS encoding */
EXTERN int enc_unicode INIT(= 0); /* 2: UCS-2 or UTF-16, 4: UCS-4 */
EXTERN int enc_utf8 INIT(= FALSE); /* UTF-8 encoded Unicode */
EXTERN int enc_latin1like INIT(= TRUE); /* 'encoding' is latin1 comp. */
-# if defined(WIN3264) || defined(FEAT_CYGWIN_WIN32_CLIPBOARD)
+#if defined(WIN3264) || defined(FEAT_CYGWIN_WIN32_CLIPBOARD)
/* Codepage nr of 'encoding'. Negative means it's not been set yet, zero
* means 'encoding' is not a valid codepage. */
EXTERN int enc_codepage INIT(= -1);
EXTERN int enc_latin9 INIT(= FALSE); /* 'encoding' is latin9 */
-# endif
+#endif
EXTERN int has_mbyte INIT(= 0); /* any multi-byte encoding */
-# if defined(WIN3264) && defined(FEAT_MBYTE)
+#if defined(WIN3264)
EXTERN int wide_WindowProc INIT(= FALSE); /* use wide WindowProc() */
-# endif
+#endif
/*
* To speed up BYTELEN() we fill a table with the byte lengths whenever
@@ -875,7 +870,6 @@ EXTERN int (*iconvctl) (iconv_t cd, int request, void *argument);
EXTERN int* (*iconv_errno) (void);
# endif
-#endif /* FEAT_MBYTE */
#ifdef FEAT_XIM
# ifdef FEAT_GUI_GTK
diff --git a/src/gui.h b/src/gui.h
index 9ac5e071c9..a57b0a3403 100644
--- a/src/gui.h
+++ b/src/gui.h
@@ -303,13 +303,11 @@ typedef struct Gui
GuiFont menu_font; /* menu item font */
# endif
#endif
-#ifdef FEAT_MBYTE
GuiFont wide_font; /* Normal 'guifontwide' font */
-# ifndef FEAT_GUI_GTK
+#ifndef FEAT_GUI_GTK
GuiFont wide_bold_font; /* Bold 'guifontwide' font */
GuiFont wide_ital_font; /* Italic 'guifontwide' font */
GuiFont wide_boldital_font; /* Bold-Italic 'guifontwide' font */
-# endif
#endif
#ifdef FEAT_XFONTSET
GuiFontset fontset; /* set of fonts for multi-byte chars */
diff --git a/src/if_py_both.h b/src/if_py_both.h
index 233489ecc6..f15bdc366e 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -24,11 +24,7 @@ static char_u e_py_systemexit[] = "E880: Can't handle SystemExit of %s exception
typedef int Py_ssize_t; /* Python 2.4 and earlier don't have this type. */
#endif
-#ifdef FEAT_MBYTE
-# define ENC_OPT ((char *)p_enc)
-#else
-# define ENC_OPT "latin1"
-#endif
+#define ENC_OPT ((char *)p_enc)
#define DOPY_FUNC "_vim_pydo"
static const char *vim_special_path = "_vim_path_";
@@ -985,11 +981,7 @@ VimStrwidth(PyObject *self UNUSED, PyObject *string)
if (!(str = StringToChars(string, &todecref)))
return NULL;
-#ifdef FEAT_MBYTE
len = mb_string2cells(str, (int)STRLEN(str));
-#else
- len = STRLEN(str);
-#endif
Py_XDECREF(todecref);
diff --git a/src/macros.h b/src/macros.h
index e651d2b124..ad243ccec2 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -96,17 +96,10 @@
* MB_ISLOWER() and MB_ISUPPER() are to be used on multi-byte characters. But
* don't use them for negative values!
*/
-#ifdef FEAT_MBYTE
-# define MB_ISLOWER(c) vim_islower(c)
-# define MB_ISUPPER(c) vim_isupper(c)
-# define MB_TOLOWER(c) vim_tolower(c)
-# define MB_TOUPPER(c) vim_toupper(c)
-#else
-# define MB_ISLOWER(c) islower(c)
-# define MB_ISUPPER(c) isupper(c)
-# define MB_TOLOWER(c) TOLOWER_LOC(c)
-# define MB_TOUPPER(c) TOUPPER_LOC(c)
-#endif
+#define MB_ISLOWER(c) vim_islower(c)
+#define MB_ISUPPER(c) vim_isupper(c)
+#define MB_TOLOWER(c) vim_tolower(c)
+#define MB_TOUPPER(c) vim_toupper(c)
/* Use our own isdigit() replacement, because on MS-Windows isdigit() returns
* non-zero for superscript 1. Also avoids that isdigit() crashes for numbers
@@ -139,8 +132,7 @@
* a mapping and the langnoremap option was set.
* The do-while is just to ignore a ';' after the macro.
*/
-# ifdef FEAT_MBYTE
-# define LANGMAP_ADJUST(c, condition) \
+# define LANGMAP_ADJUST(c, condition) \
do { \
if (*p_langmap \
&& (condition) \
@@ -154,17 +146,6 @@
c = langmap_adjust_mb(c); \
} \
} while (0)
-# else
-# define LANGMAP_ADJUST(c, condition) \
- do { \
- if (*p_langmap \
- && (condition) \
- && (p_lrm || (!p_lrm && KeyTyped)) \
- && !KeyStuffed \
- && (c) >= 0 && (c) < 256) \
- c = langmap_mapchar[c]; \
- } while (0)
-# endif
#else
# define LANGMAP_ADJUST(c, condition) /* nop */
#endif
@@ -256,33 +237,21 @@
* MB_COPY_CHAR(f, t): copy one char from "f" to "t" and advance the pointers.
* PTR2CHAR(): get character from pointer.
*/
-#ifdef FEAT_MBYTE
/* Get the length of the character p points to, including composing chars */
-# define MB_PTR2LEN(p) (has_mbyte ? (*mb_ptr2len)(p) : 1)
+#define MB_PTR2LEN(p) (has_mbyte ? (*mb_ptr2len)(p) : 1)
/* Advance multi-byte pointer, skip over composing chars. */
-# define MB_PTR_ADV(p) p += has_mbyte ? (*mb_ptr2len)(p) : 1
+#define MB_PTR_ADV(p) p += has_mbyte ? (*mb_ptr2len)(p) : 1
/* Advance multi-byte pointer, do not skip over composing chars. */
-# define MB_CPTR_ADV(p) p += enc_utf8 ? utf_ptr2len(p) : has_mbyte ? (*mb_ptr2len)(p) : 1
+#define MB_CPTR_ADV(p) p += enc_utf8 ? utf_ptr2len(p) : has_mbyte ? (*mb_ptr2len)(p) : 1
/* Backup multi-byte pointer. Only use with "p" > "s" ! */
-# define MB_PTR_BACK(s, p) p -= has_mbyte ? ((*mb_head_off)(s, p - 1) + 1) : 1
+#define MB_PTR_BACK(s, p) p -= has_mbyte ? ((*mb_head_off)(s, p - 1) + 1) : 1
/* get length of multi-byte char, not including composing chars */
-# define MB_CPTR2LEN(p) (enc_utf8 ? utf_ptr2len(p) : (*mb_ptr2len)(p))
+#define MB_CPTR2LEN(p) (enc_utf8 ? utf_ptr2len(p) : (*mb_ptr2len)(p))
-# define MB_COPY_CHAR(f, t) if (has_mbyte) mb_copy_char(&f, &t); else *t++ = *f++
-# define MB_CHARLEN(p) (has_mbyte ? mb_charlen(p) : (int)STRLEN(p))
-# define MB_CHAR2LEN(c) (has_mbyte ? mb_char2len(c) : 1)
-# define PTR2CHAR(p) (has_mbyte ? mb_ptr2char(p) : (int)*(p))
-#else
-# define MB_PTR2LEN(p) 1
-# define MB_CPTR2LEN(p) 1
-# define MB_PTR_ADV(p) ++p
-# define MB_CPTR_ADV(p) ++p
-# define MB_PTR_BACK(s, p) --p
-# define MB_COPY_CHAR(f, t) *t++ = *f++
-# define MB_CHARLEN(p) STRLEN(p)
-# define MB_CHAR2LEN(c) 1
-# define PTR2CHAR(p) ((int)*(p))
-#endif
+#define MB_COPY_CHAR(f, t) if (has_mbyte) mb_copy_char(&f, &t); else *t++ = *f++
+#define MB_CHARLEN(p) (has_mbyte ? mb_charlen(p) : (int)STRLEN(p))
+#define MB_CHAR2LEN(c) (has_mbyte ? mb_char2len(c) : 1)
+#define PTR2CHAR(p) (has_mbyte ? mb_ptr2char(p) : (int)*(p))
#ifdef FEAT_AUTOCHDIR
# define DO_AUTOCHDIR do { if (p_acd) do_autochdir(); } while (0)
diff --git a/src/option.h b/src/option.h
index 50fe380ed2..d648df7dcd 100644
--- a/src/option.h
+++ b/src/option.h
@@ -69,13 +69,11 @@
#endif
-#ifdef FEAT_MBYTE
/* Possible values for 'encoding' */
-# define ENC_UCSBOM "ucs-bom" /* check for BOM at start of file */
+#define ENC_UCSBOM "ucs-bom" /* check for BOM at start of file */
/* default value for 'encoding' */
-# define ENC_DFLT "latin1"
-#endif
+#define ENC_DFLT "latin1"
/* end-of-line style */
#define EOL_UNKNOWN -1 /* not defined yet */
@@ -315,10 +313,8 @@ EXTERN long p_aleph; /* 'aleph' */
#ifdef FEAT_AUTOCHDIR
EXTERN int p_acd; /* 'autochdir' */
#endif
-#ifdef FEAT_MBYTE
EXTERN char_u *p_ambw; /* 'ambiwidth' */
EXTERN char_u *p_emoji; /* 'emoji' */
-#endif
#if defined(FEAT_GUI) && defined(MACOS_X)
EXTERN int *p_antialias; /* 'antialias' */
#endif
@@ -395,21 +391,17 @@ EXTERN char_u *p_bsdir; /* 'browsedir' */
#ifdef FEAT_LINEBREAK
EXTERN char_u *p_breakat; /* 'breakat' */
#endif
-#ifdef FEAT_MBYTE
EXTERN char_u *p_cmp; /* 'casemap' */
EXTERN unsigned cmp_flags;
-# ifdef IN_OPTION_C
+#ifdef IN_OPTION_C
static char *(p_cmp_values[]) = {"internal", "keepascii", NULL};
-# endif
-# define CMP_INTERNAL 0x001
-# define CMP_KEEPASCII 0x002
#endif
-#ifdef FEAT_MBYTE
+#define CMP_INTERNAL 0x001
+#define CMP_KEEPASCII 0x002
EXTERN char_u *p_enc; /* 'encoding' */
EXTERN int p_deco; /* 'delcombine' */
-# ifdef FEAT_EVAL
+#ifdef FEAT_EVAL
EXTERN char_u *p_ccv; /* 'charconvert' */
-# endif
#endif
#ifdef FEAT_CMDWIN
EXTERN char_u *p_cedit; /* 'cedit' */
@@ -482,9 +474,7 @@ EXTERN char_u *p_gp; /* 'grepprg' */
EXTERN char_u *p_ei; /* 'eventignore' */
EXTERN int p_ek; /* 'esckeys' */
EXTERN int p_exrc; /* 'exrc' */
-#ifdef FEAT_MBYTE
EXTERN char_u *p_fencs; /* 'fileencodings' */
-#endif
EXTERN char_u *p_ffs; /* 'fileformats' */
EXTERN long p_fic; /* 'fileignorecase' */
#ifdef FEAT_FOLDING
@@ -519,10 +509,8 @@ EXTERN char_u *p_pdev; /* 'printdevice' */
# ifdef FEAT_POSTSCRIPT
EXTERN char_u *p_penc; /* 'printencoding' */
EXTERN char_u *p_pexpr; /* 'printexpr' */
-# ifdef FEAT_MBYTE
EXTERN char_u *p_pmfn; /* 'printmbfont' */
EXTERN char_u *p_pmcs; /* 'printmbcharset' */
-# endif
# endif
EXTERN char_u *p_pfn; /* 'printfont' */
EXTERN char_u *p_popt; /* 'printoptions' */
@@ -534,9 +522,7 @@ EXTERN char_u *p_guifont; /* 'guifont' */
# ifdef FEAT_XFONTSET
EXTERN char_u *p_guifontset; /* 'guifontset' */
# endif
-# ifdef FEAT_MBYTE
EXTERN char_u *p_guifontwide; /* 'guifontwide' */
-# endif
EXTERN int p_guipty; /* 'guipty' */
#endif
#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11)
@@ -586,14 +572,12 @@ EXTERN char_u *p_imak; /* 'imactivatekey' */
#define IM_OVER_THE_SPOT 1L
EXTERN long p_imst; /* 'imstyle' */
#endif
-#if defined(FEAT_EVAL) && defined(FEAT_MBYTE)
+#if defined(FEAT_EVAL)
EXTERN char_u *p_imaf; /* 'imactivatefunc' */
EXTERN char_u *p_imsf; /* 'imstatusfunc' */
#endif
-#ifdef FEAT_MBYTE
EXTERN int p_imcmdline; /* 'imcmdline' */
EXTERN int p_imdisable; /* 'imdisable' */
-#endif
EXTERN int p_is; /* 'incsearch' */
EXTERN int p_im; /* 'insertmode' */
EXTERN char_u *p_isf; /* 'isfname' */
@@ -629,9 +613,7 @@ EXTERN char_u *p_luadll; /* 'luadll' */
EXTERN int p_macatsui; /* 'macatsui' */
#endif
EXTERN int p_magic; /* 'magic' */
-#ifdef FEAT_MBYTE
EXTERN char_u *p_menc; /* 'makeencoding' */
-#endif
#ifdef FEAT_QUICKFIX
EXTERN char_u *p_mef; /* 'makeef' */
EXTERN char_u *p_mp; /* 'makeprg' */
@@ -644,9 +626,7 @@ EXTERN char_u *p_cc; /* 'colorcolumn' */
EXTERN int p_cc_cols[256]; /* array for 'colorcolumn' columns */
#endif
EXTERN long p_mat; /* 'matchtime' */
-#ifdef FEAT_MBYTE
EXTERN long p_mco; /* 'maxcombine' */
-#endif
#ifdef FEAT_EVAL
EXTERN long p_mfd; /* 'maxfuncdepth' */
#endif
@@ -850,9 +830,7 @@ EXTERN char_u *p_tcldll; /* 'tcldll' */
#ifdef FEAT_ARABIC
EXTERN int p_tbidi; /* 'termbidi' */
#endif
-#ifdef FEAT_MBYTE
EXTERN char_u *p_tenc; /* 'termencoding' */
-#endif
#ifdef FEAT_TERMGUICOLORS
EXTERN int p_tgc; /* 'termguicolors' */
#endif
@@ -1001,9 +979,7 @@ enum
#endif
, BV_BIN
, BV_BL
-#ifdef FEAT_MBYTE
, BV_BOMB
-#endif
, BV_CI
#ifdef FEAT_CINDENT
, BV_CIN
@@ -1068,9 +1044,7 @@ enum
, BV_LISP
, BV_LW
#endif
-#ifdef FEAT_MBYTE
, BV_MENC
-#endif
, BV_MA
, BV_ML
, BV_MOD
diff --git a/src/os_mac.h b/src/os_mac.h
index c858a6224a..692e253999 100644
--- a/src/os_mac.h
+++ b/src/os_mac.h
@@ -37,9 +37,7 @@
# include <Memory.h>
# include <OSUtils.h>
# include <Files.h>
-# ifdef FEAT_MBYTE
-# include <Script.h>
-# endif
+# include <Script.h>
#endif
/*
diff --git a/src/os_win32.h b/src/os_win32.h
index 37f6106f7f..6c4a349f98 100644
--- a/src/os_win32.h
+++ b/src/os_win32.h
@@ -213,14 +213,7 @@ Trace(char *pszFormat, ...);
#endif
/* Enable common dialogs input unicode from IME if possible. */
-#ifdef FEAT_MBYTE
-# define pDispatchMessage DispatchMessageW
-# define pGetMessage GetMessageW
-# define pIsDialogMessage IsDialogMessageW
-# define pPeekMessage PeekMessageW
-#else
-# define pDispatchMessage DispatchMessage
-# define pGetMessage GetMessage
-# define pIsDialogMessage IsDialogMessage
-# define pPeekMessage PeekMessage
-#endif
+#define pDispatchMessage DispatchMessageW
+#define pGetMessage GetMessageW
+#define pIsDialogMessage IsDialogMessageW
+#define pPeekMessage PeekMessageW
diff --git a/src/proto.h b/src/proto.h
index a71b632515..cb4add0029 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -168,10 +168,7 @@ char_u *vim_strpbrk(char_u *s, char_u *charset);
void qsort(void *base, size_t elm_count, size_t elm_size, int (*cmp)(const void *, const void *));
#endif
# include "move.pro"
-# if defined(FEAT_MBYTE) || defined(FEAT_XIM) || defined(FEAT_KEYMAP) \
- || defined(FEAT_POSTSCRIPT)
-# include "mbyte.pro"
-# endif
+# include "mbyte.pro"
# include "normal.pro"
# include "ops.pro"
# include "option.pro"
diff --git a/src/search.c b/src/search.c
index 94b1ef1e6b..0c2ce95614 100644
--- a/src/search.c
+++ b/src/search.c
@@ -85,10 +85,8 @@ static int last_idx = 0; /* index in spats[] for RE_LAST */
static char_u lastc[2] = {NUL, NUL}; /* last character searched for */
static int lastcdir = FORWARD; /* last direction of character search */
static int last_t_cmd = TRUE; /* last search t_cmd */
-#ifdef FEAT_MBYTE
static char_u lastc_bytes[MB_MAXBYTES + 1];
static int lastc_bytelen = 1; /* >1 for multi-byte char */
-#endif
/* copy of spats[], for keeping the search patterns while executing autocmds */
static struct spat saved_spats[2];
@@ -248,7 +246,6 @@ reverse_text(char_u *s)
rev_i = len;
for (s_i = 0; s_i < len; ++s_i)
{
-# ifdef FEAT_MBYTE
if (has_mbyte)
{
int mb_len;
@@ -259,7 +256,6 @@ reverse_text(char_u *s)
s_i += mb_len - 1;
}
else
-# endif
rev[--rev_i] = s[s_i];
}
@@ -446,7 +442,6 @@ pat_has_uppercase(char_u *pat)
while (*p != NUL)
{
-#ifdef FEAT_MBYTE
int l;
if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1)
@@ -455,9 +450,7 @@ pat_has_uppercase(char_u *pat)
return TRUE;
p += l;
}
- else
-#endif
- if (*p == '\\')
+ else if (*p == '\\')
{
if (p[1] == '_' && p[2] != NUL) /* skip "\_X" */
p += 3;
@@ -480,11 +473,7 @@ pat_has_uppercase(char_u *pat)
char_u *
last_csearch(void)
{
-#ifdef FEAT_MBYTE
return lastc_bytes;
-#else
- return lastc;
-#endif
}
int
@@ -503,13 +492,11 @@ last_csearch_until(void)
set_last_csearch(int c, char_u *s UNUSED, int len UNUSED)
{
*lastc = c;
-#ifdef FEAT_MBYTE
lastc_bytelen = len;
if (len)
memcpy(lastc_bytes, s, len);
else
vim_memset(lastc_bytes, 0, sizeof(lastc_bytes));
-#endif
}
#endif
@@ -687,7 +674,6 @@ searchit(
* MAXCOL + 1 is zero. */
if (pos->col == MAXCOL)
start_char_len = 0;
-#ifdef FEAT_MBYTE
/* Watch out for the "col" being MAXCOL - 2, used in a closed fold. */
else if (has_mbyte
&& pos->lnum >= 1 && pos->lnum <= buf->b_ml.ml_line_count
@@ -699,7 +685,6 @@ searchit(
else
start_char_len = (*mb_ptr2len)(ptr + pos->col);
}
-#endif
else
start_char_len = 1;
if (dir == FORWARD)
@@ -835,12 +820,10 @@ searchit(
if (matchcol == matchpos.col
&& ptr[matchcol] != NUL)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
matchcol +=
(*mb_ptr2len)(ptr + matchcol);
else
-#endif
++matchcol;
}
}
@@ -849,12 +832,10 @@ searchit(
matchcol = matchpos.col;
if (ptr[matchcol] != NUL)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
matchcol += (*mb_ptr2len)(ptr
+ matchcol);
else
-#endif
++matchcol;
}
}
@@ -946,12 +927,10 @@ searchit(
if (matchcol == matchpos.col
&& ptr[matchcol] != NUL)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
matchcol +=
(*mb_ptr2len)(ptr + matchcol);
else
-#endif
++matchcol;
}
}
@@ -963,12 +942,10 @@ searchit(
matchcol = matchpos.col;
if (ptr[matchcol] != NUL)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
matchcol +=
(*mb_ptr2len)(ptr + matchcol);
else
-#endif
++matchcol;
}
}
@@ -1029,14 +1006,12 @@ searchit(
else
{
--pos->col;
-#ifdef FEAT_MBYTE
if (has_mbyte
&& pos->lnum <= buf->b_ml.ml_line_count)
{
ptr = ml_get_buf(buf, pos->lnum, FALSE);
pos->col -= (*mb_head_off)(ptr, ptr + pos->col);
}
-#endif
}
if (end_pos != NULL)
{
@@ -1410,7 +1385,6 @@ do_search(
if (msgbuf != NULL)
{
msgbuf[0] = dirc;