comparison src/evalfunc.c @ 19742:810eee1b42e3 v8.2.0427

patch 8.2.0427: it is not possible to check for a typo in a feature name Commit: https://github.com/vim/vim/commit/7929651e05b081fe55e0e745725a7ad78c51be16 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 22 16:17:14 2020 +0100 patch 8.2.0427: it is not possible to check for a typo in a feature name Problem: It is not possible to check for a typo in a feature name. Solution: Add an extra argument to has().
author Bram Moolenaar <Bram@vim.org>
date Sun, 22 Mar 2020 16:30:03 +0100
parents fe8ba2f82f59
children 2dc5e6ddeb4c
comparison
equal deleted inserted replaced
19741:350dcc40421f 19742:810eee1b42e3
564 {"getwinposy", 0, 0, 0, ret_number, f_getwinposy}, 564 {"getwinposy", 0, 0, 0, ret_number, f_getwinposy},
565 {"getwinvar", 2, 3, FEARG_1, ret_any, f_getwinvar}, 565 {"getwinvar", 2, 3, FEARG_1, ret_any, f_getwinvar},
566 {"glob", 1, 4, FEARG_1, ret_any, f_glob}, 566 {"glob", 1, 4, FEARG_1, ret_any, f_glob},
567 {"glob2regpat", 1, 1, FEARG_1, ret_string, f_glob2regpat}, 567 {"glob2regpat", 1, 1, FEARG_1, ret_string, f_glob2regpat},
568 {"globpath", 2, 5, FEARG_2, ret_any, f_globpath}, 568 {"globpath", 2, 5, FEARG_2, ret_any, f_globpath},
569 {"has", 1, 1, 0, ret_number, f_has}, 569 {"has", 1, 2, 0, ret_number, f_has},
570 {"has_key", 2, 2, FEARG_1, ret_number, f_has_key}, 570 {"has_key", 2, 2, FEARG_1, ret_number, f_has_key},
571 {"haslocaldir", 0, 2, FEARG_1, ret_number, f_haslocaldir}, 571 {"haslocaldir", 0, 2, FEARG_1, ret_number, f_haslocaldir},
572 {"hasmapto", 1, 3, FEARG_1, ret_number, f_hasmapto}, 572 {"hasmapto", 1, 3, FEARG_1, ret_number, f_hasmapto},
573 {"highlightID", 1, 1, FEARG_1, ret_number, f_hlID}, // obsolete 573 {"highlightID", 1, 1, FEARG_1, ret_number, f_hlID}, // obsolete
574 {"highlight_exists",1, 1, FEARG_1, ret_number, f_hlexists}, // obsolete 574 {"highlight_exists",1, 1, FEARG_1, ret_number, f_hlexists}, // obsolete
3355 void 3355 void
3356 f_has(typval_T *argvars, typval_T *rettv) 3356 f_has(typval_T *argvars, typval_T *rettv)
3357 { 3357 {
3358 int i; 3358 int i;
3359 char_u *name; 3359 char_u *name;
3360 int x = FALSE;
3360 int n = FALSE; 3361 int n = FALSE;
3361 static char *(has_list[]) = 3362 typedef struct {
3362 { 3363 char *name;
3364 short present;
3365 } has_item_T;
3366 static has_item_T has_list[] =
3367 {
3368 {"amiga",
3363 #ifdef AMIGA 3369 #ifdef AMIGA
3364 "amiga", 3370 1
3365 # ifdef FEAT_ARP 3371 #else
3366 "arp", 3372 0
3367 # endif 3373 #endif
3368 #endif 3374 },
3375 {"arp",
3376 #if defined(AMIGA) && defined(FEAT_ARP)
3377 1
3378 #else
3379 0
3380 #endif
3381 },
3382 {"beos",
3369 #ifdef __BEOS__ 3383 #ifdef __BEOS__
3370 "beos", 3384 1
3371 #endif 3385 #else
3386 0
3387 #endif
3388 },
3389 {"haiku",
3372 #ifdef __HAIKU__ 3390 #ifdef __HAIKU__
3373 "haiku", 3391 1
3374 #endif 3392 #else
3393 0
3394 #endif
3395 },
3396 {"bsd",
3375 #if defined(BSD) && !defined(MACOS_X) 3397 #if defined(BSD) && !defined(MACOS_X)
3376 "bsd", 3398 1
3377 #endif 3399 #else
3400 0
3401 #endif
3402 },
3403 {"hpux",
3378 #ifdef hpux 3404 #ifdef hpux
3379 "hpux", 3405 1
3380 #endif 3406 #else
3407 0
3408 #endif
3409 },
3410 {"linux",
3381 #ifdef __linux__ 3411 #ifdef __linux__
3382 "linux", 3412 1
3383 #endif 3413 #else
3414 0
3415 #endif
3416 },
3417 {"mac", // Mac OS X (and, once, Mac OS Classic)
3384 #ifdef MACOS_X 3418 #ifdef MACOS_X
3385 "mac", // Mac OS X (and, once, Mac OS Classic) 3419 1
3386 "osx", // Mac OS X 3420 #else
3387 # ifdef MACOS_X_DARWIN 3421 0
3388 "macunix", // Mac OS X, with the darwin feature 3422 #endif
3389 "osxdarwin", // synonym for macunix 3423 },
3390 # endif 3424 {"osx", // Mac OS X
3391 #endif 3425 #ifdef MACOS_X
3426 1
3427 #else
3428 0
3429 #endif
3430 },
3431 {"macunix", // Mac OS X, with the darwin feature
3432 #if defined(MACOS_X) && defined(MACOS_X_DARWIN)
3433 1
3434 #else
3435 0
3436 #endif
3437 },
3438 {"osxdarwin", // synonym for macunix
3439 #if defined(MACOS_X) && defined(MACOS_X_DARWIN)
3440 1
3441 #else
3442 0
3443 #endif
3444 },
3445 {"qnx",
3392 #ifdef __QNX__ 3446 #ifdef __QNX__
3393 "qnx", 3447 1
3394 #endif 3448 #else
3449 0
3450 #endif
3451 },
3452 {"sun",
3395 #ifdef SUN_SYSTEM 3453 #ifdef SUN_SYSTEM
3396 "sun", 3454 1
3397 #else 3455 #else
3398 "moon", 3456 0
3399 #endif 3457 #endif
3458 },
3459 {"unix",
3400 #ifdef UNIX 3460 #ifdef UNIX
3401 "unix", 3461 1
3402 #endif 3462 #else
3463 0
3464 #endif
3465 },
3466 {"vms",
3403 #ifdef VMS 3467 #ifdef VMS
3404 "vms", 3468 1
3405 #endif 3469 #else
3470 0
3471 #endif
3472 },
3473 {"win32",
3406 #ifdef MSWIN 3474 #ifdef MSWIN
3407 "win32", 3475 1
3408 #endif 3476 #else
3477 0
3478 #endif
3479 },
3480 {"win32unix",
3409 #if defined(UNIX) && defined(__CYGWIN__) 3481 #if defined(UNIX) && defined(__CYGWIN__)
3410 "win32unix", 3482 1
3411 #endif 3483 #else
3484 0
3485 #endif
3486 },
3487 {"win64",
3412 #ifdef _WIN64 3488 #ifdef _WIN64
3413 "win64", 3489 1
3414 #endif 3490 #else
3491 0
3492 #endif
3493 },
3494 {"ebcdic",
3415 #ifdef EBCDIC 3495 #ifdef EBCDIC
3416 "ebcdic", 3496 1
3417 #endif 3497 #else
3498 0
3499 #endif
3500 },
3501 {"fname_case",
3418 #ifndef CASE_INSENSITIVE_FILENAME 3502 #ifndef CASE_INSENSITIVE_FILENAME
3419 "fname_case", 3503 1
3420 #endif 3504 #else
3505 0
3506 #endif
3507 },
3508 {"acl",
3421 #ifdef HAVE_ACL 3509 #ifdef HAVE_ACL
3422 "acl", 3510 1
3423 #endif 3511 #else
3512 0
3513 #endif
3514 },
3515 {"arabic",
3424 #ifdef FEAT_ARABIC 3516 #ifdef FEAT_ARABIC
3425 "arabic", 3517 1
3426 #endif 3518 #else
3427 "autocmd", 3519 0
3520 #endif
3521 },
3522 {"autocmd", 1},
3523 {"autochdir",
3428 #ifdef FEAT_AUTOCHDIR 3524 #ifdef FEAT_AUTOCHDIR
3429 "autochdir", 3525 1
3430 #endif 3526 #else
3527 0
3528 #endif
3529 },
3530 {"autoservername",
3431 #ifdef FEAT_AUTOSERVERNAME 3531 #ifdef FEAT_AUTOSERVERNAME
3432 "autoservername", 3532 1
3433 #endif 3533 #else
3534 0
3535 #endif
3536 },
3537 {"balloon_eval",
3434 #ifdef FEAT_BEVAL_GUI 3538 #ifdef FEAT_BEVAL_GUI
3435 "balloon_eval", 3539 1
3436 # ifndef FEAT_GUI_MSWIN // other GUIs always have multiline balloons 3540 #else
3437 "balloon_multiline", 3541 0
3438 # endif 3542 #endif
3439 #endif 3543 },
3544 {"balloon_multiline",
3545 #if defined(FEAT_BEVAL_GUI) && !defined(FEAT_GUI_MSWIN)
3546 // MS-Windows requires runtime check, see below
3547 1
3548 #else
3549 0
3550 #endif
3551 },
3552 {"balloon_eval_term",
3440 #ifdef FEAT_BEVAL_TERM 3553 #ifdef FEAT_BEVAL_TERM
3441 "balloon_eval_term", 3554 1
3442 #endif 3555 #else
3556 0
3557 #endif
3558 },
3559 {"builtin_terms",
3443 #if defined(SOME_BUILTIN_TCAPS) || defined(ALL_BUILTIN_TCAPS) 3560 #if defined(SOME_BUILTIN_TCAPS) || defined(ALL_BUILTIN_TCAPS)
3444 "builtin_terms", 3561 1
3445 # ifdef ALL_BUILTIN_TCAPS 3562 #else
3446 "all_builtin_terms", 3563 0
3447 # endif 3564 #endif
3448 #endif 3565 },
3566 {"all_builtin_terms",
3567 #if defined(ALL_BUILTIN_TCAPS)
3568 1
3569 #else
3570 0
3571 #endif
3572 },
3573 {"browsefilter",
3449 #if defined(FEAT_BROWSE) && (defined(USE_FILE_CHOOSER) \ 3574 #if defined(FEAT_BROWSE) && (defined(USE_FILE_CHOOSER) \
3450 || defined(FEAT_GUI_MSWIN) \ 3575 || defined(FEAT_GUI_MSWIN) \
3451 || defined(FEAT_GUI_MOTIF)) 3576 || defined(FEAT_GUI_MOTIF))
3452 "browsefilter", 3577 1
3453 #endif 3578 #else
3579 0
3580 #endif
3581 },
3582 {"byte_offset",
3454 #ifdef FEAT_BYTEOFF 3583 #ifdef FEAT_BYTEOFF
3455 "byte_offset", 3584 1
3456 #endif 3585 #else
3586 0
3587 #endif
3588 },
3589 {"channel",
3457 #ifdef FEAT_JOB_CHANNEL 3590 #ifdef FEAT_JOB_CHANNEL
3458 "channel", 3591 1
3459 #endif 3592 #else
3593 0
3594 #endif
3595 },
3596 {"cindent",
3460 #ifdef FEAT_CINDENT 3597 #ifdef FEAT_CINDENT
3461 "cindent", 3598 1
3462 #endif 3599 #else
3600 0
3601 #endif
3602 },
3603 {"clientserver",
3463 #ifdef FEAT_CLIENTSERVER 3604 #ifdef FEAT_CLIENTSERVER
3464 "clientserver", 3605 1
3465 #endif 3606 #else
3607 0
3608 #endif
3609 },
3610 {"clipboard",
3466 #ifdef FEAT_CLIPBOARD 3611 #ifdef FEAT_CLIPBOARD
3467 "clipboard", 3612 1
3468 #endif 3613 #else
3469 "cmdline_compl", 3614 0
3470 "cmdline_hist", 3615 #endif
3471 "comments", 3616 },
3617 {"cmdline_compl", 1},
3618 {"cmdline_hist", 1},
3619 {"comments", 1},
3620 {"conceal",
3472 #ifdef FEAT_CONCEAL 3621 #ifdef FEAT_CONCEAL
3473 "conceal", 3622 1
3474 #endif 3623 #else
3624 0
3625 #endif
3626 },
3627 {"cryptv",
3475 #ifdef FEAT_CRYPT 3628 #ifdef FEAT_CRYPT
3476 "cryptv", 3629 1
3477 "crypt-blowfish", 3630 #else
3478 "crypt-blowfish2", 3631 0
3479 #endif 3632 #endif
3633 },
3634 {"crypt-blowfish",
3635 #ifdef FEAT_CRYPT
3636 1
3637 #else
3638 0
3639 #endif
3640 },
3641 {"crypt-blowfish2",
3642 #ifdef FEAT_CRYPT
3643 1
3644 #else
3645 0
3646 #endif
3647 },
3648 {"cscope",
3480 #ifdef FEAT_CSCOPE 3649 #ifdef FEAT_CSCOPE
3481 "cscope", 3650 1
3482 #endif 3651 #else
3483 "cursorbind", 3652 0
3653 #endif
3654 },
3655 {"cursorbind", 1},
3656 {"cursorshape",
3484 #ifdef CURSOR_SHAPE 3657 #ifdef CURSOR_SHAPE
3485 "cursorshape", 3658 1
3486 #endif 3659 #else
3660 0
3661 #endif
3662 },
3663 {"debug",
3487 #ifdef DEBUG 3664 #ifdef DEBUG
3488 "debug", 3665 1
3489 #endif 3666 #else
3667 0
3668 #endif
3669 },
3670 {"dialog_con",
3490 #ifdef FEAT_CON_DIALOG 3671 #ifdef FEAT_CON_DIALOG
3491 "dialog_con", 3672 1
3492 #endif 3673 #else
3674 0
3675 #endif
3676 },
3677 {"dialog_gui",
3493 #ifdef FEAT_GUI_DIALOG 3678 #ifdef FEAT_GUI_DIALOG
3494 "dialog_gui", 3679 1
3495 #endif 3680 #else
3681 0
3682 #endif
3683 },
3684 {"diff",
3496 #ifdef FEAT_DIFF 3685 #ifdef FEAT_DIFF
3497 "diff", 3686 1
3498 #endif 3687 #else
3688 0
3689 #endif
3690 },
3691 {"digraphs",
3499 #ifdef FEAT_DIGRAPHS 3692 #ifdef FEAT_DIGRAPHS
3500 "digraphs", 3693 1
3501 #endif 3694 #else
3695 0
3696 #endif
3697 },
3698 {"directx",
3502 #ifdef FEAT_DIRECTX 3699 #ifdef FEAT_DIRECTX
3503 "directx", 3700 1
3504 #endif 3701 #else
3702 0
3703 #endif
3704 },
3705 {"dnd",
3505 #ifdef FEAT_DND 3706 #ifdef FEAT_DND
3506 "dnd", 3707 1
3507 #endif 3708 #else
3709 0
3710 #endif
3711 },
3712 {"emacs_tags",
3508 #ifdef FEAT_EMACS_TAGS 3713 #ifdef FEAT_EMACS_TAGS
3509 "emacs_tags", 3714 1
3510 #endif 3715 #else
3511 "eval", // always present, of course! 3716 0
3512 "ex_extra", // graduated feature 3717 #endif
3718 },
3719 {"eval", 1}, // always present, of course!
3720 {"ex_extra", 1}, // graduated feature
3721 {"extra_search",
3513 #ifdef FEAT_SEARCH_EXTRA 3722 #ifdef FEAT_SEARCH_EXTRA
3514 "extra_search", 3723 1
3515 #endif 3724 #else
3725 0
3726 #endif
3727 },
3728 {"file_in_path",
3516 #ifdef FEAT_SEARCHPATH 3729 #ifdef FEAT_SEARCHPATH
3517 "file_in_path", 3730 1
3518 #endif 3731 #else
3732 0
3733 #endif
3734 },
3735 {"filterpipe",
3519 #if defined(FEAT_FILTERPIPE) && !defined(VIMDLL) 3736 #if defined(FEAT_FILTERPIPE) && !defined(VIMDLL)
3520 "filterpipe", 3737 1
3521 #endif 3738 #else
3739 0
3740 #endif
3741 },
3742 {"find_in_path",
3522 #ifdef FEAT_FIND_ID 3743 #ifdef FEAT_FIND_ID
3523 "find_in_path", 3744 1
3524 #endif 3745 #else
3746 0
3747 #endif
3748 },
3749 {"float",
3525 #ifdef FEAT_FLOAT 3750 #ifdef FEAT_FLOAT
3526 "float", 3751 1
3527 #endif 3752 #else
3753 0
3754 #endif
3755 },
3756 {"folding",
3528 #ifdef FEAT_FOLDING 3757 #ifdef FEAT_FOLDING
3529 "folding", 3758 1
3530 #endif 3759 #else
3760 0
3761 #endif
3762 },
3763 {"footer",
3531 #ifdef FEAT_FOOTER 3764 #ifdef FEAT_FOOTER
3532 "footer", 3765 1
3533 #endif 3766 #else
3767 0
3768 #endif
3769 },
3770 {"fork",
3534 #if !defined(USE_SYSTEM) && defined(UNIX) 3771 #if !defined(USE_SYSTEM) && defined(UNIX)
3535 "fork", 3772 1
3536 #endif 3773 #else
3774 0
3775 #endif
3776 },
3777 {"gettext",
3537 #ifdef FEAT_GETTEXT 3778 #ifdef FEAT_GETTEXT
3538 "gettext", 3779 1
3539 #endif 3780 #else
3781 0
3782 #endif
3783 },
3784 {"gui",
3540 #ifdef FEAT_GUI 3785 #ifdef FEAT_GUI
3541 "gui", 3786 1
3542 #endif 3787 #else
3543 #ifdef FEAT_GUI_ATHENA 3788 0
3544 # ifdef FEAT_GUI_NEXTAW 3789 #endif
3545 "gui_neXtaw", 3790 },
3546 # else 3791 {"gui_neXtaw",
3547 "gui_athena", 3792 #if defined(FEAT_GUI_ATHENA) && defined(FEAT_GUI_NEXTAW)
3548 # endif 3793 1
3549 #endif 3794 #else
3795 0
3796 #endif
3797 },
3798 {"gui_athena",
3799 #if defined(FEAT_GUI_ATHENA) && !defined(FEAT_GUI_NEXTAW)
3800 1
3801 #else
3802 0
3803 #endif
3804 },
3805 {"gui_gtk",
3550 #ifdef FEAT_GUI_GTK 3806 #ifdef FEAT_GUI_GTK
3551 "gui_gtk", 3807 1
3552 # ifdef USE_GTK3 3808 #else
3553 "gui_gtk3", 3809 0
3554 # else 3810 #endif
3555 "gui_gtk2", 3811 },
3556 # endif 3812 {"gui_gtk2",
3557 #endif 3813 #if defined(FEAT_GUI_GTK) && !defined(USE_GTK3)
3814 1
3815 #else
3816 0
3817 #endif
3818 },
3819 {"gui_gtk3",
3820 #if defined(FEAT_GUI_GTK) && defined(USE_GTK3)
3821 1
3822 #else
3823 0
3824 #endif
3825 },
3826 {"gui_gnome",
3558 #ifdef FEAT_GUI_GNOME 3827 #ifdef FEAT_GUI_GNOME
3559 "gui_gnome", 3828 1
3560 #endif 3829 #else
3830 0
3831 #endif
3832 },
3833 {"gui_haiku",
3561 #ifdef FEAT_GUI_HAIKU 3834 #ifdef FEAT_GUI_HAIKU
3562 "gui_haiku", 3835 1
3563 #endif 3836 #else
3837 0
3838 #endif
3839 },
3840 {"gui_mac",
3564 #ifdef FEAT_GUI_MAC 3841 #ifdef FEAT_GUI_MAC
3565 "gui_mac", 3842 1
3566 #endif 3843 #else
3844 0
3845 #endif
3846 },
3847 {"gui_motif",
3567 #ifdef FEAT_GUI_MOTIF 3848 #ifdef FEAT_GUI_MOTIF
3568 "gui_motif", 3849 1
3569 #endif 3850 #else
3851 0
3852 #endif
3853 },
3854 {"gui_photon",
3570 #ifdef FEAT_GUI_PHOTON 3855 #ifdef FEAT_GUI_PHOTON
3571 "gui_photon", 3856 1
3572 #endif 3857 #else
3858 0
3859 #endif
3860 },
3861 {"gui_win32",
3573 #ifdef FEAT_GUI_MSWIN 3862 #ifdef FEAT_GUI_MSWIN
3574 "gui_win32", 3863 1
3575 #endif 3864 #else
3865 0
3866 #endif
3867 },
3868 {"iconv",
3576 #if defined(HAVE_ICONV_H) && defined(USE_ICONV) 3869 #if defined(HAVE_ICONV_H) && defined(USE_ICONV)
3577 "iconv", 3870 1
3578 #endif 3871 #else
3579 "insert_expand", 3872 0
3873 #endif
3874 },
3875 {"insert_expand", 1},
3876 {"job",
3580 #ifdef FEAT_JOB_CHANNEL 3877 #ifdef FEAT_JOB_CHANNEL
3581 "job", 3878 1
3582 #endif 3879 #else
3880 0
3881 #endif
3882 },
3883 {"jumplist",
3583 #ifdef FEAT_JUMPLIST 3884 #ifdef FEAT_JUMPLIST
3584 "jumplist", 3885 1
3585 #endif 3886 #else
3887 0
3888 #endif
3889 },
3890 {"keymap",
3586 #ifdef FEAT_KEYMAP 3891 #ifdef FEAT_KEYMAP
3587 "keymap", 3892 1
3588 #endif 3893 #else
3589 "lambda", // always with FEAT_EVAL, since 7.4.2120 with closure 3894 0
3895 #endif
3896 },
3897 {"lambda", 1}, // always with FEAT_EVAL, since 7.4.2120 with closure
3898 {"langmap",
3590 #ifdef FEAT_LANGMAP 3899 #ifdef FEAT_LANGMAP
3591 "langmap", 3900 1
3592 #endif 3901 #else
3902 0
3903 #endif
3904 },
3905 {"libcall",
3593 #ifdef FEAT_LIBCALL 3906 #ifdef FEAT_LIBCALL
3594 "libcall", 3907 1
3595 #endif 3908 #else
3909 0
3910 #endif
3911 },
3912 {"linebreak",
3596 #ifdef FEAT_LINEBREAK 3913 #ifdef FEAT_LINEBREAK
3597 "linebreak", 3914 1
3598 #endif 3915 #else
3916 0
3917 #endif
3918 },
3919 {"lispindent",
3599 #ifdef FEAT_LISP 3920 #ifdef FEAT_LISP
3600 "lispindent", 3921 1
3601 #endif 3922 #else
3602 "listcmds", 3923 0
3603 "localmap", 3924 #endif
3604 #ifdef FEAT_LUA 3925 },
3605 # ifndef DYNAMIC_LUA 3926 {"listcmds", 1},
3606 "lua", 3927 {"localmap", 1},
3607 # endif 3928 {"lua",
3608 #endif 3929 #if defined(FEAT_LUA) && !defined(DYNAMIC_LUA)
3930 1
3931 #else
3932 0
3933 #endif
3934 },
3935 {"menu",
3609 #ifdef FEAT_MENU 3936 #ifdef FEAT_MENU
3610 "menu", 3937 1
3611 #endif 3938 #else
3939 0
3940 #endif
3941 },
3942 {"mksession",
3612 #ifdef FEAT_SESSION 3943 #ifdef FEAT_SESSION
3613 "mksession", 3944 1
3614 #endif 3945 #else
3615 "modify_fname", 3946 0
3616 "mouse", 3947 #endif
3948 },
3949 {"modify_fname", 1},
3950 {"mouse", 1},
3951 {"mouseshape",
3617 #ifdef FEAT_MOUSESHAPE 3952 #ifdef FEAT_MOUSESHAPE
3618 "mouseshape", 3953 1
3619 #endif 3954 #else
3620 #if defined(UNIX) || defined(VMS) 3955 0
3621 # ifdef FEAT_MOUSE_DEC 3956 #endif
3622 "mouse_dec", 3957 },
3623 # endif 3958 {"mouse_dec",
3624 # ifdef FEAT_MOUSE_GPM 3959 #if (defined(UNIX) || defined(VMS)) && defined(FEAT_MOUSE_DEC)
3625 "mouse_gpm", 3960 1
3626 # endif 3961 #else
3627 # ifdef FEAT_MOUSE_JSB 3962 0
3628 "mouse_jsbterm", 3963 #endif
3629 # endif 3964 },
3630 # ifdef FEAT_MOUSE_NET 3965 {"mouse_gpm",
3631 "mouse_netterm", 3966 #if (defined(UNIX) || defined(VMS)) && defined(FEAT_MOUSE_GPM)
3632 # endif 3967 1
3633 # ifdef FEAT_MOUSE_PTERM 3968 #else
3634 "mouse_pterm", 3969 0
3635 # endif 3970 #endif
3636 # ifdef FEAT_MOUSE_XTERM 3971 },
3637 "mouse_sgr", 3972 {"mouse_jsbterm",
3638 # endif 3973 #if (defined(UNIX) || defined(VMS)) && defined(FEAT_MOUSE_JSB)
3639 # ifdef FEAT_SYSMOUSE 3974 1
3640 "mouse_sysmouse", 3975 #else
3641 # endif 3976 0
3642 # ifdef FEAT_MOUSE_URXVT 3977 #endif
3643 "mouse_urxvt", 3978 },
3644 # endif 3979 {"mouse_netterm",
3645 # ifdef FEAT_MOUSE_XTERM 3980 #if (defined(UNIX) || defined(VMS)) && defined(FEAT_MOUSE_NET)
3646 "mouse_xterm", 3981 1
3647 # endif 3982 #else
3648 #endif 3983 0
3649 "multi_byte", 3984 #endif
3985 },
3986 {"mouse_pterm",
3987 #if (defined(UNIX) || defined(VMS)) && defined(FEAT_MOUSE_PTERM)
3988 1
3989 #else
3990 0
3991 #endif
3992 },
3993 {"mouse_sgr",
3994 #if (defined(UNIX) || defined(VMS)) && defined(FEAT_MOUSE_XTERM)
3995 1
3996 #else
3997 0
3998 #endif
3999 },
4000 {"mouse_sysmouse",
4001 #if (defined(UNIX) || defined(VMS)) && defined(FEAT_SYSMOUSE)
4002 1
4003 #else
4004 0
4005 #endif
4006 },
4007 {"mouse_urxvt",
4008 #if (defined(UNIX) || defined(VMS)) && defined(FEAT_MOUSE_URXVT)
4009 1
4010 #else
4011 0
4012 #endif
4013 },
4014 {"mouse_xterm",
4015 #if (defined(UNIX) || defined(VMS)) && defined(FEAT_MOUSE_XTERM)
4016 1
4017 #else
4018 0
4019 #endif
4020 },
4021 {"multi_byte", 1},
4022 {"multi_byte_ime",
3650 #ifdef FEAT_MBYTE_IME 4023 #ifdef FEAT_MBYTE_IME
3651 "multi_byte_ime", 4024 1
3652 #endif 4025 #else
4026 0
4027 #endif
4028 },
4029 {"multi_lang",
3653 #ifdef FEAT_MULTI_LANG 4030 #ifdef FEAT_MULTI_LANG
3654 "multi_lang", 4031 1
3655 #endif 4032 #else
3656 #ifdef FEAT_MZSCHEME 4033 0
3657 #ifndef DYNAMIC_MZSCHEME 4034 #endif
3658 "mzscheme", 4035 },
3659 #endif 4036 {"mzscheme",
3660 #endif 4037 #if defined(FEAT_MZSCHEME) && !defined(DYNAMIC_MZSCHEME)
3661 "num64", 4038 1
4039 #else
4040 0
4041 #endif
4042 },
4043 {"num64", 1},
4044 {"ole",
3662 #ifdef FEAT_OLE 4045 #ifdef FEAT_OLE
3663 "ole", 4046 1
3664 #endif 4047 #else
4048 0
4049 #endif
4050 },
4051 {"packages",
3665 #ifdef FEAT_EVAL 4052 #ifdef FEAT_EVAL
3666 "packages", 4053 1
3667 #endif 4054 #else
4055 0
4056 #endif
4057 },
4058 {"path_extra",
3668 #ifdef FEAT_PATH_EXTRA 4059 #ifdef FEAT_PATH_EXTRA
3669 "path_extra", 4060 1
3670 #endif 4061 #else
3671 #ifdef FEAT_PERL 4062 0
3672 #ifndef DYNAMIC_PERL 4063 #endif
3673 "perl", 4064 },
3674 #endif 4065 {"perl",
3675 #endif 4066 #if defined(FEAT_PERL) && !defined(DYNAMIC_PERL)
4067 1
4068 #else
4069 0
4070 #endif
4071 },
4072 {"persistent_undo",
3676 #ifdef FEAT_PERSISTENT_UNDO 4073 #ifdef FEAT_PERSISTENT_UNDO
3677 "persistent_undo", 4074 1
3678 #endif 4075 #else
4076 0
4077 #endif
4078 },
4079 {"python_compiled",
3679 #if defined(FEAT_PYTHON) 4080 #if defined(FEAT_PYTHON)
3680 "python_compiled", 4081 1
3681 # if defined(DYNAMIC_PYTHON) 4082 #else
3682 "python_dynamic", 4083 0
3683 # else 4084 #endif
3684 "python", 4085 },
3685 "pythonx", 4086 {"python_dynamic",
3686 # endif 4087 #if defined(FEAT_PYTHON) && defined(DYNAMIC_PYTHON)
3687 #endif 4088 1
4089 #else
4090 0
4091 #endif
4092 },
4093 {"python",
4094 #if defined(FEAT_PYTHON) && !defined(DYNAMIC_PYTHON)
4095 1
4096 #else
4097 0
4098 #endif
4099 },
4100 {"pythonx",
4101 #if (defined(FEAT_PYTHON) && !defined(DYNAMIC_PYTHON)) \
4102 || (defined(FEAT_PYTHON3) && !defined(DYNAMIC_PYTHON3))
4103 1
4104 #else
4105 0
4106 #endif
4107 },
4108 {"python3_compiled",
3688 #if defined(FEAT_PYTHON3) 4109 #if defined(FEAT_PYTHON3)
3689 "python3_compiled", 4110 1
3690 # if defined(DYNAMIC_PYTHON3) 4111 #else
3691 "python3_dynamic", 4112 0
3692 # else 4113 #endif
3693 "python3", 4114 },
3694 "pythonx", 4115 {"python3_dynamic",
3695 # endif 4116 #if defined(FEAT_PYTHON3) && defined(DYNAMIC_PYTHON3)
3696 #endif 4117 1
4118 #else
4119 0
4120 #endif
4121 },
4122 {"python3",
4123 #if defined(FEAT_PYTHON3) && !defined(DYNAMIC_PYTHON3)
4124 1
4125 #else
4126 0
4127 #endif
4128 },
4129 {"popupwin",
3697 #ifdef FEAT_PROP_POPUP 4130 #ifdef FEAT_PROP_POPUP
3698 "popupwin", 4131 1
3699 #endif 4132 #else
4133 0
4134 #endif
4135 },
4136 {"postscript",
3700 #ifdef FEAT_POSTSCRIPT 4137 #ifdef FEAT_POSTSCRIPT
3701 "postscript", 4138 1
3702 #endif 4139 #else
4140 0
4141 #endif
4142 },
4143 {"printer",
3703 #ifdef FEAT_PRINTER 4144 #ifdef FEAT_PRINTER
3704 "printer", 4145 1
3705 #endif 4146 #else
4147 0
4148 #endif
4149 },
4150 {"profile",
3706 #ifdef FEAT_PROFILE 4151 #ifdef FEAT_PROFILE
3707 "profile", 4152 1
3708 #endif 4153 #else
4154 0
4155 #endif
4156 },
4157 {"reltime",
3709 #ifdef FEAT_RELTIME 4158 #ifdef FEAT_RELTIME
3710 "reltime", 4159 1
3711 #endif 4160 #else
4161 0
4162 #endif
4163 },
4164 {"quickfix",
3712 #ifdef FEAT_QUICKFIX 4165 #ifdef FEAT_QUICKFIX
3713 "quickfix", 4166 1
3714 #endif 4167 #else
4168 0
4169 #endif
4170 },
4171 {"rightleft",
3715 #ifdef FEAT_RIGHTLEFT 4172 #ifdef FEAT_RIGHTLEFT
3716 "rightleft", 4173 1
3717 #endif 4174 #else
4175 0
4176 #endif
4177 },
4178 {"ruby",
3718 #if defined(FEAT_RUBY) && !defined(DYNAMIC_RUBY) 4179 #if defined(FEAT_RUBY) && !defined(DYNAMIC_RUBY)
3719 "ruby", 4180 1
3720 #endif 4181 #else
3721 "scrollbind", 4182 0
4183 #endif
4184 },
4185 {"scrollbind", 1},
4186 {"showcmd",
3722 #ifdef FEAT_CMDL_INFO 4187 #ifdef FEAT_CMDL_INFO
3723 "showcmd", 4188 1
3724 "cmdline_info", 4189 #else
3725 #endif 4190 0
4191 #endif
4192 },
4193 {"cmdline_info",
4194 #ifdef FEAT_CMDL_INFO
4195 1
4196 #else
4197 0
4198 #endif
4199 },
4200 {"signs",
3726 #ifdef FEAT_SIGNS 4201 #ifdef FEAT_SIGNS
3727 "signs", 4202 1
3728 #endif 4203 #else
4204 0
4205 #endif
4206 },
4207 {"smartindent",
3729 #ifdef FEAT_SMARTINDENT 4208 #ifdef FEAT_SMARTINDENT
3730 "smartindent", 4209 1
3731 #endif 4210 #else
4211 0
4212 #endif
4213 },
4214 {"startuptime",
3732 #ifdef STARTUPTIME 4215 #ifdef STARTUPTIME
3733 "startuptime", 4216 1
3734 #endif 4217 #else
4218 0
4219 #endif
4220 },
4221 {"statusline",
3735 #ifdef FEAT_STL_OPT 4222 #ifdef FEAT_STL_OPT
3736 "statusline", 4223 1
3737 #endif 4224 #else
4225 0
4226 #endif
4227 },
4228 {"netbeans_intg",
3738 #ifdef FEAT_NETBEANS_INTG 4229 #ifdef FEAT_NETBEANS_INTG
3739 "netbeans_intg", 4230 1
3740 #endif 4231 #else
4232 0
4233 #endif
4234 },
4235 {"sound",
3741 #ifdef FEAT_SOUND 4236 #ifdef FEAT_SOUND
3742 "sound", 4237 1
3743 #endif 4238 #else
4239 0
4240 #endif
4241 },
4242 {"spell",
3744 #ifdef FEAT_SPELL 4243 #ifdef FEAT_SPELL
3745 "spell", 4244 1
3746 #endif 4245 #else
4246 0
4247 #endif
4248 },
4249 {"syntax",
3747 #ifdef FEAT_SYN_HL 4250 #ifdef FEAT_SYN_HL
3748 "syntax", 4251 1
3749 #endif 4252 #else
4253 0
4254 #endif
4255 },
4256 {"system",
3750 #if defined(USE_SYSTEM) || !defined(UNIX) 4257 #if defined(USE_SYSTEM) || !defined(UNIX)
3751 "system", 4258 1
3752 #endif 4259 #else
4260 0
4261 #endif
4262 },
4263 {"tag_binary",
3753 #ifdef FEAT_TAG_BINS 4264 #ifdef FEAT_TAG_BINS
3754 "tag_binary", 4265 1
3755 #endif 4266 #else
3756 #ifdef FEAT_TCL 4267 0
3757 # ifndef DYNAMIC_TCL 4268 #endif
3758 "tcl", 4269 },
3759 # endif 4270 {"tcl",
3760 #endif 4271 #if defined(FEAT_TCL) && !defined(DYNAMIC_TCL)
4272 1
4273 #else
4274 0
4275 #endif
4276 },
4277 {"termguicolors",
3761 #ifdef FEAT_TERMGUICOLORS 4278 #ifdef FEAT_TERMGUICOLORS
3762 "termguicolors", 4279 1
3763 #endif 4280 #else
4281 0
4282 #endif
4283 },
4284 {"terminal",
3764 #if defined(FEAT_TERMINAL) && !defined(MSWIN) 4285 #if defined(FEAT_TERMINAL) && !defined(MSWIN)
3765 "terminal", 4286 1
3766 #endif 4287 #else
4288 0
4289 #endif
4290 },
4291 {"terminfo",
3767 #ifdef TERMINFO 4292 #ifdef TERMINFO
3768 "terminfo", 4293 1
3769 #endif 4294 #else
4295 0
4296 #endif
4297 },
4298 {"termresponse",
3770 #ifdef FEAT_TERMRESPONSE 4299 #ifdef FEAT_TERMRESPONSE
3771 "termresponse", 4300 1
3772 #endif 4301 #else
4302 0
4303 #endif
4304 },
4305 {"textobjects",
3773 #ifdef FEAT_TEXTOBJ 4306 #ifdef FEAT_TEXTOBJ
3774 "textobjects", 4307 1
3775 #endif 4308 #else
4309 0
4310 #endif
4311 },
4312 {"textprop",
3776 #ifdef FEAT_PROP_POPUP 4313 #ifdef FEAT_PROP_POPUP
3777 "textprop", 4314 1
3778 #endif 4315 #else
4316 0
4317 #endif
4318 },
4319 {"tgetent",
3779 #ifdef HAVE_TGETENT 4320 #ifdef HAVE_TGETENT
3780 "tgetent", 4321 1
3781 #endif 4322 #else
4323 0
4324 #endif
4325 },
4326 {"timers",
3782 #ifdef FEAT_TIMERS 4327 #ifdef FEAT_TIMERS
3783 "timers", 4328 1
3784 #endif 4329 #else
4330 0
4331 #endif
4332 },
4333 {"title",
3785 #ifdef FEAT_TITLE 4334 #ifdef FEAT_TITLE
3786 "title", 4335 1
3787 #endif 4336 #else
4337 0
4338 #endif
4339 },
4340 {"toolbar",
3788 #ifdef FEAT_TOOLBAR 4341 #ifdef FEAT_TOOLBAR
3789 "toolbar", 4342 1
3790 #endif 4343 #else
4344 0
4345 #endif
4346 },
4347 {"unnamedplus",
3791 #if defined(FEAT_CLIPBOARD) && defined(FEAT_X11) 4348 #if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
3792 "unnamedplus", 4349 1
3793 #endif 4350 #else
3794 "user-commands", // was accidentally included in 5.4 4351 0
3795 "user_commands", 4352 #endif
4353 },
4354 {"user-commands", 1}, // was accidentally included in 5.4
4355 {"user_commands", 1},
4356 {"vartabs",
3796 #ifdef FEAT_VARTABS 4357 #ifdef FEAT_VARTABS
3797 "vartabs", 4358 1
3798 #endif 4359 #else
3799 "vertsplit", 4360 0
4361 #endif
4362 },
4363 {"vertsplit", 1},
4364 {"viminfo",
3800 #ifdef FEAT_VIMINFO 4365 #ifdef FEAT_VIMINFO
3801 "viminfo", 4366 1
3802 #endif 4367 #else
3803 "vimscript-1", 4368 0
3804 "vimscript-2", 4369 #endif
3805 "vimscript-3", 4370 },
3806 "vimscript-4", 4371 {"vimscript-1", 1},
3807 "virtualedit", 4372 {"vimscript-2", 1},
3808 "visual", 4373 {"vimscript-3", 1},
3809 "visualextra", 4374 {"vimscript-4", 1},
3810 "vreplace", 4375 {"virtualedit", 1},
4376 {"visual", 1},
4377 {"visualextra", 1},
4378 {"vreplace", 1},
4379 {"vtp",
3811 #ifdef FEAT_VTP 4380 #ifdef FEAT_VTP
3812 "vtp", 4381 1
3813 #endif 4382 #else
4383 0
4384 #endif
4385 },
4386 {"wildignore",
3814 #ifdef FEAT_WILDIGN 4387 #ifdef FEAT_WILDIGN
3815 "wildignore", 4388 1
3816 #endif 4389 #else
4390 0
4391 #endif
4392 },
4393 {"wildmenu",
3817 #ifdef FEAT_WILDMENU 4394 #ifdef FEAT_WILDMENU
3818 "wildmenu", 4395 1
3819 #endif 4396 #else
3820 "windows", 4397 0
4398 #endif
4399 },
4400 {"windows", 1},
4401 {"winaltkeys",
3821 #ifdef FEAT_WAK 4402 #ifdef FEAT_WAK
3822 "winaltkeys", 4403 1
3823 #endif 4404 #else
4405 0
4406 #endif
4407 },
4408 {"writebackup",
3824 #ifdef FEAT_WRITEBACKUP 4409 #ifdef FEAT_WRITEBACKUP
3825 "writebackup", 4410 1
3826 #endif 4411 #else
4412 0
4413 #endif
4414 },
4415 {"xim",
3827 #ifdef FEAT_XIM 4416 #ifdef FEAT_XIM
3828 "xim", 4417 1
3829 #endif 4418 #else
4419 0
4420 #endif
4421 },
4422 {"xfontset",
3830 #ifdef FEAT_XFONTSET 4423 #ifdef FEAT_XFONTSET
3831 "xfontset", 4424 1
3832 #endif 4425 #else
4426 0
4427 #endif
4428 },
4429 {"xpm",
4430 #if defined(FEAT_XPM_W32) || defined(HAVE_XPM)
4431 1
4432 #else
4433 0
4434 #endif
4435 },
4436 {"xpm_w32", // for backward compatibility
3833 #ifdef FEAT_XPM_W32 4437 #ifdef FEAT_XPM_W32
3834 "xpm", 4438 1
3835 "xpm_w32", // for backward compatibility 4439 #else
3836 #else 4440 0
3837 # if defined(HAVE_XPM) 4441 #endif
3838 "xpm", 4442 },
3839 # endif 4443 {"xsmp",
3840 #endif
3841 #ifdef USE_XSMP 4444 #ifdef USE_XSMP
3842 "xsmp", 4445 1
3843 #endif 4446 #else
4447 0
4448 #endif
4449 },
4450 {"xsmp_interact",
3844 #ifdef USE_XSMP_INTERACT 4451 #ifdef USE_XSMP_INTERACT
3845 "xsmp_interact", 4452 1
3846 #endif 4453 #else
4454 0
4455 #endif
4456 },
4457 {"xterm_clipboard",
3847 #ifdef FEAT_XCLIPBOARD 4458 #ifdef FEAT_XCLIPBOARD
3848 "xterm_clipboard", 4459 1
3849 #endif 4460 #else
4461 0
4462 #endif
4463 },
4464 {"xterm_save",
3850 #ifdef FEAT_XTERM_SAVE 4465 #ifdef FEAT_XTERM_SAVE
3851 "xterm_save", 4466 1
3852 #endif 4467 #else
4468 0
4469 #endif
4470 },
4471 {"X11",
3853 #if defined(UNIX) && defined(FEAT_X11) 4472 #if defined(UNIX) && defined(FEAT_X11)
3854 "X11", 4473 1
3855 #endif 4474 #else
3856 NULL 4475 0
4476 #endif
4477 },
4478 {NULL, 0}
3857 }; 4479 };
3858 4480
3859 name = tv_get_string(&argvars[0]); 4481 name = tv_get_string(&argvars[0]);
3860 for (i = 0; has_list[i] != NULL; ++i) 4482 for (i = 0; has_list[i].name != NULL; ++i)
3861 if (STRICMP(name, has_list[i]) == 0) 4483 if (STRICMP(name, has_list[i].name) == 0)
3862 { 4484 {
3863 n = TRUE; 4485 x = TRUE;
4486 n = has_list[i].present;
3864 break; 4487 break;
3865 } 4488 }
3866 4489
3867 if (n == FALSE) 4490 // features also in has_list[] but sometimes enabled at runtime
3868 { 4491 if (x == TRUE && n == FALSE)
3869 if (STRNICMP(name, "patch", 5) == 0) 4492 {
3870 { 4493 if (0)
3871 if (name[5] == '-' 4494 ;
3872 && STRLEN(name) >= 11
3873 && vim_isdigit(name[6])
3874 && vim_isdigit(name[8])
3875 && vim_isdigit(name[10]))
3876 {
3877 int major = atoi((char *)name + 6);
3878 int minor = atoi((char *)name + 8);
3879
3880 // Expect "patch-9.9.01234".
3881 n = (major < VIM_VERSION_MAJOR
3882 || (major == VIM_VERSION_MAJOR
3883 && (minor < VIM_VERSION_MINOR
3884 || (minor == VIM_VERSION_MINOR
3885 && has_patch(atoi((char *)name + 10))))));
3886 }
3887 else
3888 n = has_patch(atoi((char *)name + 5));
3889 }
3890 else if (STRICMP(name, "vim_starting") == 0)
3891 n = (starting != 0);
3892 else if (STRICMP(name, "ttyin") == 0)
3893 n = mch_input_isatty();
3894 else if (STRICMP(name, "ttyout") == 0)
3895 n = stdout_isatty;
3896 else if (STRICMP(name, "multi_byte_encoding") == 0)
3897 n = has_mbyte;
3898 #if defined(FEAT_BEVAL) && defined(FEAT_GUI_MSWIN) 4495 #if defined(FEAT_BEVAL) && defined(FEAT_GUI_MSWIN)
3899 else if (STRICMP(name, "balloon_multiline") == 0) 4496 else if (STRICMP(name, "balloon_multiline") == 0)
3900 n = multiline_balloon_available(); 4497 n = multiline_balloon_available();
3901 #endif 4498 #endif
3902 #ifdef DYNAMIC_TCL 4499 #ifdef VIMDLL
3903 else if (STRICMP(name, "tcl") == 0) 4500 else if (STRICMP(name, "filterpipe") == 0)
3904 n = tcl_enabled(FALSE); 4501 n = gui.in_use || gui.starting;
3905 #endif 4502 #endif
3906 #if defined(USE_ICONV) && defined(DYNAMIC_ICONV) 4503 #if defined(USE_ICONV) && defined(DYNAMIC_ICONV)
3907 else if (STRICMP(name, "iconv") == 0) 4504 else if (STRICMP(name, "iconv") == 0)
3908 n = iconv_enabled(FALSE); 4505 n = iconv_enabled(FALSE);
3909 #endif 4506 #endif
3913 #endif 4510 #endif
3914 #ifdef DYNAMIC_MZSCHEME 4511 #ifdef DYNAMIC_MZSCHEME
3915 else if (STRICMP(name, "mzscheme") == 0) 4512 else if (STRICMP(name, "mzscheme") == 0)
3916 n = mzscheme_enabled(FALSE); 4513 n = mzscheme_enabled(FALSE);
3917 #endif 4514 #endif
3918 #ifdef DYNAMIC_RUBY 4515 #ifdef DYNAMIC_PERL
3919 else if (STRICMP(name, "ruby") == 0) 4516 else if (STRICMP(name, "perl") == 0)
3920 n = ruby_enabled(FALSE); 4517 n = perl_enabled(FALSE);
3921 #endif 4518 #endif
3922 #ifdef DYNAMIC_PYTHON 4519 #ifdef DYNAMIC_PYTHON
3923 else if (STRICMP(name, "python") == 0) 4520 else if (STRICMP(name, "python") == 0)
3924 n = python_enabled(FALSE); 4521 n = python_enabled(FALSE);
3925 #endif 4522 #endif
3942 # elif defined(DYNAMIC_PYTHON3) 4539 # elif defined(DYNAMIC_PYTHON3)
3943 n = python3_enabled(FALSE); 4540 n = python3_enabled(FALSE);
3944 # endif 4541 # endif
3945 } 4542 }
3946 #endif 4543 #endif
3947 #ifdef DYNAMIC_PERL 4544 #ifdef DYNAMIC_RUBY
3948 else if (STRICMP(name, "perl") == 0) 4545 else if (STRICMP(name, "ruby") == 0)
3949 n = perl_enabled(FALSE); 4546 n = ruby_enabled(FALSE);
3950 #endif 4547 #endif
3951 #ifdef FEAT_GUI 4548 #ifdef DYNAMIC_TCL
3952 else if (STRICMP(name, "gui_running") == 0) 4549 else if (STRICMP(name, "tcl") == 0)
3953 n = (gui.in_use || gui.starting); 4550 n = tcl_enabled(FALSE);
3954 # ifdef FEAT_BROWSE
3955 else if (STRICMP(name, "browse") == 0)
3956 n = gui.in_use; // gui_mch_browse() works when GUI is running
3957 # endif
3958 #endif
3959 #ifdef FEAT_SYN_HL
3960 else if (STRICMP(name, "syntax_items") == 0)
3961 n = syntax_present(curwin);
3962 #endif
3963 #ifdef FEAT_VTP
3964 else if (STRICMP(name, "vcon") == 0)
3965 n = is_term_win32() && has_vtp_working();
3966 #endif
3967 #ifdef FEAT_NETBEANS_INTG
3968 else if (STRICMP(name, "netbeans_enabled") == 0)
3969 n = netbeans_active();
3970 #endif
3971 #ifdef FEAT_MOUSE_GPM
3972 else if (STRICMP(name, "mouse_gpm_enabled") == 0)
3973 n = gpm_enabled();
3974 #endif 4551 #endif
3975 #if defined(FEAT_TERMINAL) && defined(MSWIN) 4552 #if defined(FEAT_TERMINAL) && defined(MSWIN)
3976 else if (STRICMP(name, "terminal") == 0) 4553 else if (STRICMP(name, "terminal") == 0)
3977 n = terminal_enabled(); 4554 n = terminal_enabled();
3978 #endif 4555 #endif
4556 }
4557
4558 // features not in has_list[]
4559 if (x == FALSE)
4560 {
4561 if (STRNICMP(name, "patch", 5) == 0)
4562 {
4563 x = TRUE;
4564 if (name[5] == '-'
4565 && STRLEN(name) >= 11
4566 && vim_isdigit(name[6])
4567 && vim_isdigit(name[8])
4568 && vim_isdigit(name[10]))
4569 {
4570 int major = atoi((char *)name + 6);
4571 int minor = atoi((char *)name + 8);
4572
4573 // Expect "patch-9.9.01234".
4574 n = (major < VIM_VERSION_MAJOR
4575 || (major == VIM_VERSION_MAJOR
4576 && (minor < VIM_VERSION_MINOR
4577 || (minor == VIM_VERSION_MINOR
4578 && has_patch(atoi((char *)name + 10))))));
4579 }
4580 else
4581 n = has_patch(atoi((char *)name + 5));
4582 }
4583 else if (STRICMP(name, "vim_starting") == 0)
4584 {
4585 x = TRUE;
4586 n = (starting != 0);
4587 }
4588 else if (STRICMP(name, "ttyin") == 0)
4589 {
4590 x = TRUE;
4591 n = mch_input_isatty();
4592 }
4593 else if (STRICMP(name, "ttyout") == 0)
4594 {
4595 x = TRUE;
4596 n = stdout_isatty;
4597 }
4598 else if (STRICMP(name, "multi_byte_encoding") == 0)
4599 {
4600 x = TRUE;
4601 n = has_mbyte;
4602 }
4603 else if (STRICMP(name, "gui_running") == 0)
4604 {
4605 x = TRUE;
4606 #ifdef FEAT_GUI
4607 n = (gui.in_use || gui.starting);
4608 #endif
4609 }
4610 else if (STRICMP(name, "browse") == 0)
4611 {
4612 x = TRUE;
4613 #if defined(FEAT_GUI) && defined(FEAT_BROWSE)
4614 n = gui.in_use; // gui_mch_browse() works when GUI is running
4615 #endif
4616 }
4617 else if (STRICMP(name, "syntax_items") == 0)
4618 {
4619 x = TRUE;
4620 #ifdef FEAT_SYN_HL
4621 n = syntax_present(curwin);
4622 #endif
4623 }
4624 else if (STRICMP(name, "vcon") == 0)
4625 {
4626 x = TRUE;
4627 #ifdef FEAT_VTP
4628 n = is_term_win32() && has_vtp_working();
4629 #endif
4630 }
4631 else if (STRICMP(name, "netbeans_enabled") == 0)
4632 {
4633 x = TRUE;
4634 #ifdef FEAT_NETBEANS_INTG
4635 n = netbeans_active();
4636 #endif
4637 }
4638 else if (STRICMP(name, "mouse_gpm_enabled") == 0)
4639 {
4640 x = TRUE;
4641 #ifdef FEAT_MOUSE_GPM
4642 n = gpm_enabled();
4643 #endif
4644 }
4645 else if (STRICMP(name, "conpty") == 0)
4646 {
4647 x = TRUE;
3979 #if defined(FEAT_TERMINAL) && defined(MSWIN) 4648 #if defined(FEAT_TERMINAL) && defined(MSWIN)
3980 else if (STRICMP(name, "conpty") == 0)
3981 n = use_conpty(); 4649 n = use_conpty();
3982 #endif 4650 #endif
4651 }
4652 else if (STRICMP(name, "clipboard_working") == 0)
4653 {
4654 x = TRUE;
3983 #ifdef FEAT_CLIPBOARD 4655 #ifdef FEAT_CLIPBOARD
3984 else if (STRICMP(name, "clipboard_working") == 0)
3985 n = clip_star.available; 4656 n = clip_star.available;
3986 #endif 4657 #endif
3987 #ifdef VIMDLL 4658 }
3988 else if (STRICMP(name, "filterpipe") == 0) 4659 }
3989 n = gui.in_use || gui.starting; 4660
3990 #endif 4661 if (argvars[1].v_type != VAR_UNKNOWN && tv_get_number(&argvars[1]) != 0)
3991 } 4662 // return whether feature could ever be enabled
3992 4663 rettv->vval.v_number = x;
3993 rettv->vval.v_number = n; 4664 else
4665 // return whether feature is enabled
4666 rettv->vval.v_number = n;
3994 } 4667 }
3995 4668
3996 /* 4669 /*
3997 * "haslocaldir()" function 4670 * "haslocaldir()" function
3998 */ 4671 */