Mercurial > vim
comparison src/main.c @ 15597:536dd2bc5ac9 v8.1.0806
patch 8.1.0806: too many #ifdefs
commit https://github.com/vim/vim/commit/fc3abf47fbe1e426f2b676c316c81ee9ff607075
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jan 24 15:54:21 2019 +0100
patch 8.1.0806: too many #ifdefs
Problem: Too many #ifdefs.
Solution: Graduate FEAT_MBYTE, part 2.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 24 Jan 2019 16:00:08 +0100 |
parents | b069a878bbeb |
children | a6ca8cf07a98 |
comparison
equal
deleted
inserted
replaced
15596:d614c94f60fd | 15597:536dd2bc5ac9 |
---|---|
117 * Do any system-specific initialisations. These can NOT use IObuff or | 117 * Do any system-specific initialisations. These can NOT use IObuff or |
118 * NameBuff. Thus emsg2() cannot be called! | 118 * NameBuff. Thus emsg2() cannot be called! |
119 */ | 119 */ |
120 mch_early_init(); | 120 mch_early_init(); |
121 | 121 |
122 #if defined(WIN32) && defined(FEAT_MBYTE) | 122 #if defined(WIN32) |
123 /* | 123 /* |
124 * MinGW expands command line arguments, which confuses our code to | 124 * MinGW expands command line arguments, which confuses our code to |
125 * convert when 'encoding' changes. Get the unexpanded arguments. | 125 * convert when 'encoding' changes. Get the unexpanded arguments. |
126 */ | 126 */ |
127 argc = get_cmd_argsW(&argv); | 127 argc = get_cmd_argsW(&argv); |
248 } | 248 } |
249 #endif | 249 #endif |
250 params.fname = alist_name(&GARGLIST[0]); | 250 params.fname = alist_name(&GARGLIST[0]); |
251 } | 251 } |
252 | 252 |
253 #if defined(WIN32) && defined(FEAT_MBYTE) | 253 #if defined(WIN32) |
254 { | 254 { |
255 extern void set_alist_count(void); | 255 extern void set_alist_count(void); |
256 | 256 |
257 /* Remember the number of entries in the argument list. If it changes | 257 /* Remember the number of entries in the argument list. If it changes |
258 * we don't react on setting 'encoding'. */ | 258 * we don't react on setting 'encoding'. */ |
590 */ | 590 */ |
591 if (params.edit_type == EDIT_QF) | 591 if (params.edit_type == EDIT_QF) |
592 { | 592 { |
593 char_u *enc = NULL; | 593 char_u *enc = NULL; |
594 | 594 |
595 # ifdef FEAT_MBYTE | |
596 enc = p_menc; | 595 enc = p_menc; |
597 # endif | |
598 if (params.use_ef != NULL) | 596 if (params.use_ef != NULL) |
599 set_string_option_direct((char_u *)"ef", -1, | 597 set_string_option_direct((char_u *)"ef", -1, |
600 params.use_ef, OPT_FREE, SID_CARG); | 598 params.use_ef, OPT_FREE, SID_CARG); |
601 vim_snprintf((char *)IObuff, IOSIZE, "cfile %s", p_ef); | 599 vim_snprintf((char *)IObuff, IOSIZE, "cfile %s", p_ef); |
602 if (qf_init(NULL, p_ef, p_efm, TRUE, IObuff, enc) < 0) | 600 if (qf_init(NULL, p_ef, p_efm, TRUE, IObuff, enc) < 0) |
811 exe_commands(¶ms); | 809 exe_commands(¶ms); |
812 | 810 |
813 /* Must come before the may_req_ calls. */ | 811 /* Must come before the may_req_ calls. */ |
814 starting = 0; | 812 starting = 0; |
815 | 813 |
816 #if defined(FEAT_TERMRESPONSE) && defined(FEAT_MBYTE) | 814 #if defined(FEAT_TERMRESPONSE) |
817 /* Must be done before redrawing, puts a few characters on the screen. */ | 815 /* Must be done before redrawing, puts a few characters on the screen. */ |
818 may_req_ambiguous_char_width(); | 816 may_req_ambiguous_char_width(); |
819 #endif | 817 #endif |
820 | 818 |
821 RedrawingDisabled = 0; | 819 RedrawingDisabled = 0; |
924 void | 922 void |
925 common_init(mparm_T *paramp) | 923 common_init(mparm_T *paramp) |
926 { | 924 { |
927 cmdline_init(); | 925 cmdline_init(); |
928 | 926 |
929 #ifdef FEAT_MBYTE | |
930 (void)mb_init(); /* init mb_bytelen_tab[] to ones */ | 927 (void)mb_init(); /* init mb_bytelen_tab[] to ones */ |
931 #endif | |
932 #ifdef FEAT_EVAL | 928 #ifdef FEAT_EVAL |
933 eval_init(); /* init global variables */ | 929 eval_init(); /* init global variables */ |
934 #endif | 930 #endif |
935 | 931 |
936 #ifdef __QNXNTO__ | 932 #ifdef __QNXNTO__ |
1547 #endif | 1543 #endif |
1548 #ifdef FEAT_EVAL | 1544 #ifdef FEAT_EVAL |
1549 if (garbage_collect_at_exit) | 1545 if (garbage_collect_at_exit) |
1550 garbage_collect(FALSE); | 1546 garbage_collect(FALSE); |
1551 #endif | 1547 #endif |
1552 #if defined(WIN32) && defined(FEAT_MBYTE) | 1548 #if defined(WIN32) |
1553 free_cmd_argsW(); | 1549 free_cmd_argsW(); |
1554 #endif | 1550 #endif |
1555 | 1551 |
1556 mch_exit(exitval); | 1552 mch_exit(exitval); |
1557 } | 1553 } |
2499 #else | 2495 #else |
2500 2 /* add buffer number now and use curbuf */ | 2496 2 /* add buffer number now and use curbuf */ |
2501 #endif | 2497 #endif |
2502 ); | 2498 ); |
2503 | 2499 |
2504 #if defined(FEAT_MBYTE) && defined(WIN32) | 2500 #if defined(WIN32) |
2505 { | 2501 { |
2506 /* Remember this argument has been added to the argument list. | 2502 /* Remember this argument has been added to the argument list. |
2507 * Needed when 'encoding' is changed. */ | 2503 * Needed when 'encoding' is changed. */ |
2508 used_file_arg(argv[0], parmp->literal, parmp->full_path, | 2504 used_file_arg(argv[0], parmp->literal, parmp->full_path, |
2509 # ifdef FEAT_DIFF | 2505 # ifdef FEAT_DIFF |
2582 } | 2578 } |
2583 #endif | 2579 #endif |
2584 #if defined(WIN3264) && !defined(FEAT_GUI_W32) | 2580 #if defined(WIN3264) && !defined(FEAT_GUI_W32) |
2585 if (is_cygpty_used()) | 2581 if (is_cygpty_used()) |
2586 { | 2582 { |
2587 # if defined(FEAT_MBYTE) && defined(HAVE_BIND_TEXTDOMAIN_CODESET) \ | 2583 # if defined(HAVE_BIND_TEXTDOMAIN_CODESET) \ |
2588 && defined(FEAT_GETTEXT) | 2584 && defined(FEAT_GETTEXT) |
2589 char *s, *tofree = NULL; | 2585 char *s, *tofree = NULL; |
2590 | 2586 |
2591 /* Set the encoding of the error message based on $LC_ALL or | 2587 /* Set the encoding of the error message based on $LC_ALL or |
2592 * other environment variables instead of 'encoding'. | 2588 * other environment variables instead of 'encoding'. |
3658 */ | 3654 */ |
3659 if (parmp->serverArg) | 3655 if (parmp->serverArg) |
3660 { | 3656 { |
3661 cmdsrv_main(&parmp->argc, parmp->argv, | 3657 cmdsrv_main(&parmp->argc, parmp->argv, |
3662 parmp->serverName_arg, &parmp->serverStr); | 3658 parmp->serverName_arg, &parmp->serverStr); |
3663 # ifdef FEAT_MBYTE | |
3664 parmp->serverStrEnc = vim_strsave(p_enc); | 3659 parmp->serverStrEnc = vim_strsave(p_enc); |
3665 # endif | |
3666 } | 3660 } |
3667 | 3661 |
3668 /* If we're still running, get the name to register ourselves. | 3662 /* If we're still running, get the name to register ourselves. |
3669 * On Win32 can register right now, for X11 need to setup the | 3663 * On Win32 can register right now, for X11 need to setup the |
3670 * clipboard first, it's further down. */ | 3664 * clipboard first, it's further down. */ |
4279 char_u **tofree) | 4273 char_u **tofree) |
4280 { | 4274 { |
4281 char_u *res = data; | 4275 char_u *res = data; |
4282 | 4276 |
4283 *tofree = NULL; | 4277 *tofree = NULL; |
4284 # ifdef FEAT_MBYTE | |
4285 if (client_enc != NULL && p_enc != NULL) | 4278 if (client_enc != NULL && p_enc != NULL) |
4286 { | 4279 { |
4287 vimconv_T vimconv; | 4280 vimconv_T vimconv; |
4288 | 4281 |
4289 vimconv.vc_type = CONV_NONE; | 4282 vimconv.vc_type = CONV_NONE; |
4296 else | 4289 else |
4297 *tofree = res; | 4290 *tofree = res; |
4298 } | 4291 } |
4299 convert_setup(&vimconv, NULL, NULL); | 4292 convert_setup(&vimconv, NULL, NULL); |
4300 } | 4293 } |
4301 # endif | |
4302 return res; | 4294 return res; |
4303 } | 4295 } |
4304 #endif | 4296 #endif |