summaryrefslogtreecommitdiffstats
path: root/src/digraph.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-01-24 15:04:48 +0100
committerBram Moolenaar <Bram@vim.org>2019-01-24 15:04:48 +0100
commit135059724f140ceac889c9f8136bd1bf5c41d49d (patch)
tree64a9fc867701c8cdd596130cdab2d92129920bd7 /src/digraph.c
parent4b9e91f0ba02192e4592a5c4a9bdcdd6e9efeb5e (diff)
patch 8.1.0805: too many #ifdefsv8.1.0805
Problem: Too many #ifdefs. Solution: Graduate FEAT_MBYTE, part 1.
Diffstat (limited to 'src/digraph.c')
-rw-r--r--src/digraph.c173
1 files changed, 9 insertions, 164 deletions
diff --git a/src/digraph.c b/src/digraph.c
index 407b45f835..d936136805 100644
--- a/src/digraph.c
+++ b/src/digraph.c
@@ -15,11 +15,7 @@
#if defined(FEAT_DIGRAPHS) || defined(PROTO)
-#ifdef FEAT_MBYTE
typedef int result_T;
-#else
-typedef char_u result_T;
-#endif
typedef struct digraph
{
@@ -38,8 +34,8 @@ static garray_T user_digraphs = {0, 0, (int)sizeof(digr_T), 10, NULL};
* compilers cannot handle them (Amiga SAS/C is the most picky one).
*/
static digr_T digraphdefault[] =
-#ifdef __MINT__
+#ifdef __MINT__
/*
* ATARI digraphs
*/
@@ -320,137 +316,7 @@ static digr_T digraphdefault[] =
};
# else
-# if defined(MACOS_X) && !defined(FEAT_MBYTE)
-
- /*
- * Macintosh digraphs
- */
- {{'a', 't', 64}, /* @ */
- {'A', '"', 128}, /* ~@ XX */
- {'A', 'o', 129}, /* */
- {'C', ',', 130}, /* */
- {'E', '\'', 131}, /* */
- {'N', '~', 132}, /* */
- {'O', '"', 133}, /* */
- {'U', '"', 134}, /* */
- {'a', '\'', 135}, /* ~G XX */
- {'a', '`', 136}, /* ~H XX */
- {'a', '^', 137}, /* */
- {'a', '"', 138}, /* */
- {'a', '~', 139}, /* */
- {'a', 'o', 140}, /* */
- {'c', ',', 141}, /* */
- {'e', '\'', 142}, /* */
- {'e', '`', 143}, /* */
- {'e', '^', 144}, /* */
- {'e', '"', 145}, /* */
- {'i', '\'', 146}, /* */
- {'i', '`', 147}, /* */
- {'i', '^', 148}, /* */
- {'i', '"', 149}, /* */
- {'n', '~', 150}, /* */
- {'o', '\'', 151}, /* */
- {'o', '`', 152}, /* */
- {'o', '^', 153}, /* */
- {'o', '"', 154}, /* */
- {'o', '~', 155}, /* o */
- {'u', '\'', 156}, /* */
- {'u', '`', 157}, /* ~] XX */
- {'u', '^', 158}, /* */
- {'u', '"', 159}, /* */
- {'+', '_', 160}, /* */
- {'~', 'o', 161}, /* */
- {'c', '|', 162}, /* */
- {'$', '$', 163}, /* */
- {'p', 'a', 164}, /* */
- {'.', '.', 165}, /* * */
- {'P', 'P', 166}, /* */
- {'s', 's', 167}, /* */
- {'r', 'O', 168}, /* */
- {'c', 'O', 169}, /* */
- {'T', 'M', 170}, /* */
- {'=', '/', 173}, /* */
- {'A', 'E', 174}, /* */
- {'O', '/', 175}, /* */
- {'0', '0', 176}, /* */
- {'+', '-', 177}, /* */
- {'<', '=', 178}, /* */
- {'>', '=', 179}, /* */
- {'Y', '-', 180}, /* */
- {'j', 'u', 181}, /* */
- {'m', 'u', 181}, /* */
- {'d', 'd', 182}, /* */
- {'S', 'S', 183}, /* */
- {'S', 'I', 183}, /* */
- {'P', 'I', 184}, /* */
- {'p', 'i', 185}, /* */
- {'I', 'I', 186}, /* */
- {'a', '-', 187}, /* */
- {'o', '-', 188}, /* */
- {'O', 'M', 189}, /* */
- {'a', 'e', 190}, /* */
- {'o', '/', 191}, /* */
- {'~', '?', 192}, /* */
- {'~', '!', 193}, /* */
- {'-', ',', 194}, /* */
- {'v', '-', 195}, /* ~H XX */
- {'f', '-', 196}, /* */
- {'~', '~', 197}, /* */
- {'D', 'E', 198}, /* */
- {'<', '<', 199}, /* */
- {'>', '>', 200}, /* */
- {'.', ':', 201}, /* */
- {'A', '`', 203}, /* */
- {'A', '~', 204}, /* */
- {'O', '~', 205}, /* */
- {'O', 'E', 206}, /* */
- {'o', 'e', 207}, /* */
- {'-', '.', 208}, /* - */
- {'-', '-', 209}, /* - */
- {'`', '`', 210}, /* " */
- {'\'', '\'', 211}, /* " */
- {'`', ' ', 212}, /* ' */
- {'\'', ' ', 213}, /* ' */
- {'-', ':', 214}, /* */
- {'D', 'I', 215}, /* */
- {'y', ':', 216}, /* */
- {'Y', ':', 217}, /* */
- {'/', '/', 218}, /* */
- {'E', '=', 219}, /* Euro System >=8.5 */
- {'o', 'x', 219}, /* Currency System <=8.1*/
- {'<', ' ', 220}, /* */
- {'>', ' ', 221}, /* */
- {'f', 'i', 222}, /* */
- {'f', 'l', 223}, /* */
- {'+', '+', 224}, /* */
- {'~', '.', 225}, /* */
- {',', ' ', 226}, /* */
- {',', ',', 227}, /* */
- {'%', '.', 228}, /* */
- {'%', '0', 228}, /* */
- {'A', '^', 229}, /* */
- {'E', '^', 230}, /* */
- {'A', '\'', 231}, /* */
- {'E', '"', 232}, /* */
- {'E', '`', 233}, /* */
- {'I', '\'', 234}, /* */
- {'I', '^', 235}, /* */
- {'I', '"', 236}, /* */
- {'I', '`', 237}, /* */
- {'O', '\'', 238}, /* */
- {'O', '^', 239}, /* */
- {'A', 'P', 240}, /* */
- {'O', '`', 241}, /* */
- {'U', '\'', 242}, /* */
- {'U', '^', 243}, /* */
- {'U', '`', 244}, /* */
- {'i', '.', 245}, /* */
- {NUL, NUL, NUL}
- };
-
-# else /* !MACOS_X */
-
-# ifdef OLD_DIGRAPHS
+# ifdef OLD_DIGRAPHS
/*
* digraphs compatible with Vim 5.x
@@ -557,7 +423,7 @@ static digr_T digraphdefault[] =
{'y', '"', 255}, /* x XX */
{NUL, NUL, NUL}
};
-# else /* OLD_DIGRAPHS */
+# else /* OLD_DIGRAPHS */
/*
* digraphs for Unicode from RFC1345
@@ -792,7 +658,6 @@ static digr_T digraphdefault[] =
{'y', ':', 0xff},
{'y', '"', 0xff}, // x XX Vim 5.x compatible
-# ifdef FEAT_MBYTE
# define USE_UNICODE_DIGRAPHS
{'A', '-', 0x0100},
@@ -1957,14 +1822,11 @@ static digr_T digraphdefault[] =
{'f', 'l', 0xfb02},
{'f', 't', 0xfb05},
{'s', 't', 0xfb06},
-# endif /* FEAT_MBYTE */
{NUL, NUL, NUL}
};
-# endif /* OLD_DIGRAPHS */
-
-# endif /* Macintosh */
+# endif /* OLD_DIGRAPHS */
# endif /* EBCDIC */
# endif /* !HPUX_DIGRAPHS */
#endif /* !__MINT__ */
@@ -2141,8 +2003,7 @@ getexactdigraph(int char1, int char2, int meta_char)
++dp;
}
}
-#ifdef FEAT_MBYTE
-# ifdef USE_UNICODE_DIGRAPHS
+#ifdef USE_UNICODE_DIGRAPHS
if (retval != 0 && !enc_utf8)
{
char_u buf[6], *to;
@@ -2166,12 +2027,11 @@ getexactdigraph(int char1, int char2, int meta_char)
(void)convert_setup(&vc, NULL, NULL);
}
}
-# endif
+#endif
/* Ignore multi-byte characters when not in multi-byte mode. */
if (!has_mbyte && retval > 0xff)
retval = 0;
-#endif
if (retval == 0) /* digraph deleted or not found */
{
@@ -2297,10 +2157,7 @@ listdigraphs(int use_headers)
#else
if (getexactdigraph(dp->char1, dp->char2, FALSE) == dp->result
-# ifdef FEAT_MBYTE
- && (has_mbyte || dp->result <= 255)
-# endif
- )
+ && (has_mbyte || dp->result <= 255))
printdigraph(dp, use_headers ? &previous : NULL);
#endif
++dp;
@@ -2364,11 +2221,7 @@ printdigraph(digr_T *dp, result_T *previous)
int list_width;
- if ((dy_flags & DY_UHEX)
-#ifdef FEAT_MBYTE
- || has_mbyte
-#endif
- )
+ if ((dy_flags & DY_UHEX) || has_mbyte)
list_width = 13;
else
list_width = 11;
@@ -2404,7 +2257,6 @@ printdigraph(digr_T *dp, result_T *previous)
*p = NUL;
msg_outtrans(buf);
p = buf;
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
/* add a space to draw a composing char on */
@@ -2413,7 +2265,6 @@ printdigraph(digr_T *dp, result_T *previous)
p += (*mb_char2bytes)(dp->result, p);
}
else
-#endif
*p++ = (char_u)dp->result;
*p = NUL;
msg_outtrans_attr(buf, HL_ATTR(HLF_8));
@@ -2465,21 +2316,15 @@ keymap_init(void)
/* Source the keymap file. It will contain a ":loadkeymap" command
* which will call ex_loadkeymap() below. */
- buflen = STRLEN(curbuf->b_p_keymap)
-# ifdef FEAT_MBYTE
- + STRLEN(p_enc)
-# endif
- + 14;
+ buflen = STRLEN(curbuf->b_p_keymap) + STRLEN(p_enc) + 14;
buf = alloc((unsigned)buflen);
if (buf == NULL)
return e_outofmem;
-# ifdef FEAT_MBYTE
/* try finding "keymap/'keymap'_'encoding'.vim" in 'runtimepath' */
vim_snprintf((char *)buf, buflen, "keymap/%s_%s.vim",
curbuf->b_p_keymap, p_enc);
if (source_runtime(buf, 0) == FAIL)
-# endif
{
/* try finding "keymap/'keymap'.vim" in 'runtimepath' */
vim_snprintf((char *)buf, buflen, "keymap/%s.vim",