1 /* vi:set ts=8 sts=4 sw=4 noet: 2 * 3 * VIM - Vi IMproved by Bram Moolenaar 4 * 5 * Do ":help uganda" in Vim to read copying and usage conditions. 6 * Do ":help credits" in Vim to see a list of people who contributed. 7 * See README.txt for an overview of the Vim source code. 8 */ 9 10 #include "vim.h" 11 12 #ifdef AMIGA 13 # include <time.h> // for time() 14 #endif 15 16 /* 17 * Vim originated from Stevie version 3.6 (Fish disk 217) by GRWalter (Fred) 18 * It has been changed beyond recognition since then. 19 * 20 * Differences between version 7.4 and 8.x can be found with ":help version8". 21 * Differences between version 6.4 and 7.x can be found with ":help version7". 22 * Differences between version 5.8 and 6.x can be found with ":help version6". 23 * Differences between version 4.x and 5.x can be found with ":help version5". 24 * Differences between version 3.0 and 4.x can be found with ":help version4". 25 * All the remarks about older versions have been removed, they are not very 26 * interesting. 27 */ 28 29 #include "version.h" 30 31 char *Version = VIM_VERSION_SHORT; 32 static char *mediumVersion = VIM_VERSION_MEDIUM; 33 34 #if defined(HAVE_DATE_TIME) || defined(PROTO) 35 # if (defined(VMS) && defined(VAXC)) || defined(PROTO) 36 char longVersion[sizeof(VIM_VERSION_LONG_DATE) + sizeof(__DATE__) 37 + sizeof(__TIME__) + 3]; 38 39 void 40 init_longVersion(void) 41 { 42 /* 43 * Construct the long version string. Necessary because 44 * VAX C can't concatenate strings in the preprocessor. 45 */ 46 strcpy(longVersion, VIM_VERSION_LONG_DATE); 47 strcat(longVersion, __DATE__); 48 strcat(longVersion, " "); 49 strcat(longVersion, __TIME__); 50 strcat(longVersion, ")"); 51 } 52 53 # else 54 void 55 init_longVersion(void) 56 { 57 char *date_time = __DATE__ " " __TIME__; 58 char *msg = _("%s (%s, compiled %s)"); 59 size_t len = strlen(msg) 60 + strlen(VIM_VERSION_LONG_ONLY) 61 + strlen(VIM_VERSION_DATE_ONLY) 62 + strlen(date_time); 63 64 longVersion = alloc(len); 65 if (longVersion == NULL) 66 longVersion = VIM_VERSION_LONG; 67 else 68 vim_snprintf(longVersion, len, msg, 69 VIM_VERSION_LONG_ONLY, VIM_VERSION_DATE_ONLY, date_time); 70 } 71 # endif 72 #else 73 char *longVersion = VIM_VERSION_LONG; 74 75 void 76 init_longVersion(void) 77 { 78 // nothing to do 79 } 80 #endif 81 82 static char *(features[]) = 83 { 84 #ifdef HAVE_ACL 85 "+acl", 86 #else 87 "-acl", 88 #endif 89 #ifdef AMIGA // only for Amiga systems 90 # ifdef FEAT_ARP 91 "+ARP", 92 # else 93 "-ARP", 94 # endif 95 #endif 96 #ifdef FEAT_ARABIC 97 "+arabic", 98 #else 99 "-arabic", 100 #endif 101 "+autocmd", 102 #ifdef FEAT_AUTOCHDIR 103 "+autochdir", 104 #else 105 "-autochdir", 106 #endif 107 #ifdef FEAT_AUTOSERVERNAME 108 "+autoservername", 109 #else 110 "-autoservername", 111 #endif 112 #ifdef FEAT_BEVAL_GUI 113 "+balloon_eval", 114 #else 115 "-balloon_eval", 116 #endif 117 #ifdef FEAT_BEVAL_TERM 118 "+balloon_eval_term", 119 #else 120 "-balloon_eval_term", 121 #endif 122 #ifdef FEAT_BROWSE 123 "+browse", 124 #else 125 "-browse", 126 #endif 127 #ifdef NO_BUILTIN_TCAPS 128 "-builtin_terms", 129 #endif 130 #ifdef SOME_BUILTIN_TCAPS 131 "+builtin_terms", 132 #endif 133 #ifdef ALL_BUILTIN_TCAPS 134 "++builtin_terms", 135 #endif 136 #ifdef FEAT_BYTEOFF 137 "+byte_offset", 138 #else 139 "-byte_offset", 140 #endif 141 #ifdef FEAT_JOB_CHANNEL 142 "+channel", 143 #else 144 "-channel", 145 #endif 146 #ifdef FEAT_CINDENT 147 "+cindent", 148 #else 149 "-cindent", 150 #endif 151 #ifdef FEAT_CLIENTSERVER 152 "+clientserver", 153 #else 154 "-clientserver", 155 #endif 156 #ifdef FEAT_CLIPBOARD 157 "+clipboard", 158 #else 159 "-clipboard", 160 #endif 161 "+cmdline_compl", 162 "+cmdline_hist", 163 #ifdef FEAT_CMDL_INFO 164 "+cmdline_info", 165 #else 166 "-cmdline_info", 167 #endif 168 "+comments", 169 #ifdef FEAT_CONCEAL 170 "+conceal", 171 #else 172 "-conceal", 173 #endif 174 #ifdef FEAT_CRYPT 175 "+cryptv", 176 #else 177 "-cryptv", 178 #endif 179 #ifdef FEAT_CSCOPE 180 "+cscope", 181 #else 182 "-cscope", 183 #endif 184 "+cursorbind", 185 #ifdef CURSOR_SHAPE 186 "+cursorshape", 187 #else 188 "-cursorshape", 189 #endif 190 #if defined(FEAT_CON_DIALOG) && defined(FEAT_GUI_DIALOG) 191 "+dialog_con_gui", 192 #else 193 # if defined(FEAT_CON_DIALOG) 194 "+dialog_con", 195 # else 196 # if defined(FEAT_GUI_DIALOG) 197 "+dialog_gui", 198 # else 199 "-dialog", 200 # endif 201 # endif 202 #endif 203 #ifdef FEAT_DIFF 204 "+diff", 205 #else 206 "-diff", 207 #endif 208 #ifdef FEAT_DIGRAPHS 209 "+digraphs", 210 #else 211 "-digraphs", 212 #endif 213 #ifdef FEAT_GUI_MSWIN 214 # ifdef FEAT_DIRECTX 215 "+directx", 216 # else 217 "-directx", 218 # endif 219 #endif 220 #ifdef FEAT_DND 221 "+dnd", 222 #else 223 "-dnd", 224 #endif 225 #ifdef EBCDIC 226 "+ebcdic", 227 #else 228 "-ebcdic", 229 #endif 230 #ifdef FEAT_EMACS_TAGS 231 "+emacs_tags", 232 #else 233 "-emacs_tags", 234 #endif 235 #ifdef FEAT_EVAL 236 "+eval", 237 #else 238 "-eval", 239 #endif 240 "+ex_extra", 241 #ifdef FEAT_SEARCH_EXTRA 242 "+extra_search", 243 #else 244 "-extra_search", 245 #endif 246 "-farsi", 247 #ifdef FEAT_SEARCHPATH 248 "+file_in_path", 249 #else 250 "-file_in_path", 251 #endif 252 #ifdef FEAT_FIND_ID 253 "+find_in_path", 254 #else 255 "-find_in_path", 256 #endif 257 #ifdef FEAT_FLOAT 258 "+float", 259 #else 260 "-float", 261 #endif 262 #ifdef FEAT_FOLDING 263 "+folding", 264 #else 265 "-folding", 266 #endif 267 #ifdef FEAT_FOOTER 268 "+footer", 269 #else 270 "-footer", 271 #endif 272 // only interesting on Unix systems 273 #if !defined(USE_SYSTEM) && defined(UNIX) 274 "+fork()", 275 #endif 276 #ifdef FEAT_GETTEXT 277 # ifdef DYNAMIC_GETTEXT 278 "+gettext/dyn", 279 # else 280 "+gettext", 281 # endif 282 #else 283 "-gettext", 284 #endif 285 "-hangul_input", 286 #if (defined(HAVE_ICONV_H) && defined(USE_ICONV)) || defined(DYNAMIC_ICONV) 287 # ifdef DYNAMIC_ICONV 288 "+iconv/dyn", 289 # else 290 "+iconv", 291 # endif 292 #else 293 "-iconv", 294 #endif 295 "+insert_expand", 296 #ifdef FEAT_JOB_CHANNEL 297 "+job", 298 #else 299 "-job", 300 #endif 301 #ifdef FEAT_JUMPLIST 302 "+jumplist", 303 #else 304 "-jumplist", 305 #endif 306 #ifdef FEAT_KEYMAP 307 "+keymap", 308 #else 309 "-keymap", 310 #endif 311 #ifdef FEAT_EVAL 312 "+lambda", 313 #else 314 "-lambda", 315 #endif 316 #ifdef FEAT_LANGMAP 317 "+langmap", 318 #else 319 "-langmap", 320 #endif 321 #ifdef FEAT_LIBCALL 322 "+libcall", 323 #else 324 "-libcall", 325 #endif 326 #ifdef FEAT_LINEBREAK 327 "+linebreak", 328 #else 329 "-linebreak", 330 #endif 331 #ifdef FEAT_LISP 332 "+lispindent", 333 #else 334 "-lispindent", 335 #endif 336 "+listcmds", 337 "+localmap", 338 #ifdef FEAT_LUA 339 # ifdef DYNAMIC_LUA 340 "+lua/dyn", 341 # else 342 "+lua", 343 # endif 344 #else 345 "-lua", 346 #endif 347 #ifdef FEAT_MENU 348 "+menu", 349 #else 350 "-menu", 351 #endif 352 #ifdef FEAT_SESSION 353 "+mksession", 354 #else 355 "-mksession", 356 #endif 357 "+modify_fname", 358 "+mouse", 359 #ifdef FEAT_MOUSESHAPE 360 "+mouseshape", 361 #else 362 "-mouseshape", 363 #endif 364 365 #if defined(UNIX) || defined(VMS) 366 # ifdef FEAT_MOUSE_DEC 367 "+mouse_dec", 368 # else 369 "-mouse_dec", 370 # endif 371 # ifdef FEAT_MOUSE_GPM 372 "+mouse_gpm", 373 # else 374 "-mouse_gpm", 375 # endif 376 # ifdef FEAT_MOUSE_JSB 377 "+mouse_jsbterm", 378 # else 379 "-mouse_jsbterm", 380 # endif 381 # ifdef FEAT_MOUSE_NET 382 "+mouse_netterm", 383 # else 384 "-mouse_netterm", 385 # endif 386 #endif 387 388 #ifdef __QNX__ 389 # ifdef FEAT_MOUSE_PTERM 390 "+mouse_pterm", 391 # else 392 "-mouse_pterm", 393 # endif 394 #endif 395 396 #if defined(UNIX) || defined(VMS) 397 "+mouse_sgr", 398 # ifdef FEAT_SYSMOUSE 399 "+mouse_sysmouse", 400 # else 401 "-mouse_sysmouse", 402 # endif 403 # ifdef FEAT_MOUSE_URXVT 404 "+mouse_urxvt", 405 # else 406 "-mouse_urxvt", 407 # endif 408 "+mouse_xterm", 409 #endif 410 411 #ifdef FEAT_MBYTE_IME 412 # ifdef DYNAMIC_IME 413 "+multi_byte_ime/dyn", 414 # else 415 "+multi_byte_ime", 416 # endif 417 #else 418 "+multi_byte", 419 #endif 420 #ifdef FEAT_MULTI_LANG 421 "+multi_lang", 422 #else 423 "-multi_lang", 424 #endif 425 #ifdef FEAT_MZSCHEME 426 # ifdef DYNAMIC_MZSCHEME 427 "+mzscheme/dyn", 428 # else 429 "+mzscheme", 430 # endif 431 #else 432 "-mzscheme", 433 #endif 434 #ifdef FEAT_NETBEANS_INTG 435 "+netbeans_intg", 436 #else 437 "-netbeans_intg", 438 #endif 439 #ifdef FEAT_NUM64 440 "+num64", 441 #else 442 "-num64", 443 #endif 444 #ifdef FEAT_GUI_MSWIN 445 # ifdef FEAT_OLE 446 "+ole", 447 # else 448 "-ole", 449 # endif 450 #endif 451 #ifdef FEAT_EVAL 452 "+packages", 453 #else 454 "-packages", 455 #endif 456 #ifdef FEAT_PATH_EXTRA 457 "+path_extra", 458 #else 459 "-path_extra", 460 #endif 461 #ifdef FEAT_PERL 462 # ifdef DYNAMIC_PERL 463 "+perl/dyn", 464 # else 465 "+perl", 466 # endif 467 #else 468 "-perl", 469 #endif 470 #ifdef FEAT_PERSISTENT_UNDO 471 "+persistent_undo", 472 #else 473 "-persistent_undo", 474 #endif 475 #ifdef FEAT_PROP_POPUP 476 "+popupwin", 477 #else 478 "-popupwin", 479 #endif 480 #ifdef FEAT_PRINTER 481 # ifdef FEAT_POSTSCRIPT 482 "+postscript", 483 # else 484 "-postscript", 485 # endif 486 "+printer", 487 #else 488 "-printer", 489 #endif 490 #ifdef FEAT_PROFILE 491 "+profile", 492 #else 493 "-profile", 494 #endif 495 #ifdef FEAT_PYTHON 496 # ifdef DYNAMIC_PYTHON 497 "+python/dyn", 498 # else 499 "+python", 500 # endif 501 #else 502 "-python", 503 #endif 504 #ifdef FEAT_PYTHON3 505 # ifdef DYNAMIC_PYTHON3 506 "+python3/dyn", 507 # else 508 "+python3", 509 # endif 510 #else 511 "-python3", 512 #endif 513 #ifdef FEAT_QUICKFIX 514 "+quickfix", 515 #else 516 "-quickfix", 517 #endif 518 #ifdef FEAT_RELTIME 519 "+reltime", 520 #else 521 "-reltime", 522 #endif 523 #ifdef FEAT_RIGHTLEFT 524 "+rightleft", 525 #else 526 "-rightleft", 527 #endif 528 #ifdef FEAT_RUBY 529 # ifdef DYNAMIC_RUBY 530 "+ruby/dyn", 531 # else 532 "+ruby", 533 # endif 534 #else 535 "-ruby", 536 #endif 537 "+scrollbind", 538 #ifdef FEAT_SIGNS 539 "+signs", 540 #else 541 "-signs", 542 #endif 543 #ifdef FEAT_SMARTINDENT 544 "+smartindent", 545 #else 546 "-smartindent", 547 #endif 548 #ifdef FEAT_SOUND 549 "+sound", 550 #else 551 "-sound", 552 #endif 553 #ifdef FEAT_SPELL 554 "+spell", 555 #else 556 "-spell", 557 #endif 558 #ifdef STARTUPTIME 559 "+startuptime", 560 #else 561 "-startuptime", 562 #endif 563 #ifdef FEAT_STL_OPT 564 "+statusline", 565 #else 566 "-statusline", 567 #endif 568 "-sun_workshop", 569 #ifdef FEAT_SYN_HL 570 "+syntax", 571 #else 572 "-syntax", 573 #endif 574 // only interesting on Unix systems 575 #if defined(USE_SYSTEM) && defined(UNIX) 576 "+system()", 577 #endif 578 #ifdef FEAT_TAG_BINS 579 "+tag_binary", 580 #else 581 "-tag_binary", 582 #endif 583 "-tag_old_static", 584 "-tag_any_white", 585 #ifdef FEAT_TCL 586 # ifdef DYNAMIC_TCL 587 "+tcl/dyn", 588 # else 589 "+tcl", 590 # endif 591 #else 592 "-tcl", 593 #endif 594 #ifdef FEAT_TERMGUICOLORS 595 "+termguicolors", 596 #else 597 "-termguicolors", 598 #endif 599 #ifdef FEAT_TERMINAL 600 "+terminal", 601 #else 602 "-terminal", 603 #endif 604 #if defined(UNIX) 605 // only Unix can have terminfo instead of termcap 606 # ifdef TERMINFO 607 "+terminfo", 608 # else 609 "-terminfo", 610 # endif 611 #endif 612 #ifdef FEAT_TERMRESPONSE 613 "+termresponse", 614 #else 615 "-termresponse", 616 #endif 617 #ifdef FEAT_TEXTOBJ 618 "+textobjects", 619 #else 620 "-textobjects", 621 #endif 622 #ifdef FEAT_PROP_POPUP 623 "+textprop", 624 #else 625 "-textprop", 626 #endif 627 #if !defined(UNIX) 628 // unix always includes termcap support 629 # ifdef HAVE_TGETENT 630 "+tgetent", 631 # else 632 "-tgetent", 633 # endif 634 #endif 635 #ifdef FEAT_TIMERS 636 "+timers", 637 #else 638 "-timers", 639 #endif 640 #ifdef FEAT_TITLE 641 "+title", 642 #else 643 "-title", 644 #endif 645 #ifdef FEAT_TOOLBAR 646 "+toolbar", 647 #else 648 "-toolbar", 649 #endif 650 "+user_commands", 651 #ifdef FEAT_VARTABS 652 "+vartabs", 653 #else 654 "-vartabs", 655 #endif 656 "+vertsplit", 657 "+virtualedit", 658 "+visual", 659 "+visualextra", 660 #ifdef FEAT_VIMINFO 661 "+viminfo", 662 #else 663 "-viminfo", 664 #endif 665 "+vreplace", 666 #ifdef MSWIN 667 # ifdef FEAT_VTP 668 "+vtp", 669 # else 670 "-vtp", 671 # endif 672 #endif 673 #ifdef FEAT_WILDIGN 674 "+wildignore", 675 #else 676 "-wildignore", 677 #endif 678 #ifdef FEAT_WILDMENU 679 "+wildmenu", 680 #else 681 "-wildmenu", 682 #endif 683 "+windows", 684 #ifdef FEAT_WRITEBACKUP 685 "+writebackup", 686 #else 687 "-writebackup", 688 #endif 689 #if defined(UNIX) || defined(VMS) 690 # ifdef FEAT_X11 691 "+X11", 692 # else 693 "-X11", 694 # endif 695 #endif 696 #ifdef FEAT_XFONTSET 697 "+xfontset", 698 #else 699 "-xfontset", 700 #endif 701 #ifdef FEAT_XIM 702 "+xim", 703 #else 704 "-xim", 705 #endif 706 #ifdef MSWIN 707 # ifdef FEAT_XPM_W32 708 "+xpm_w32", 709 # else 710 "-xpm_w32", 711 # endif 712 #else 713 # ifdef HAVE_XPM 714 "+xpm", 715 # else 716 "-xpm", 717 # endif 718 #endif 719 #if defined(UNIX) || defined(VMS) 720 # ifdef USE_XSMP_INTERACT 721 "+xsmp_interact", 722 # else 723 # ifdef USE_XSMP 724 "+xsmp", 725 # else 726 "-xsmp", 727 # endif 728 # endif 729 # ifdef FEAT_XCLIPBOARD 730 "+xterm_clipboard", 731 # else 732 "-xterm_clipboard", 733 # endif 734 #endif 735 #ifdef FEAT_XTERM_SAVE 736 "+xterm_save", 737 #else 738 "-xterm_save", 739 #endif 740 NULL 741 }; 742 743 static int included_patches[] = 744 { /* Add new patch number below this line */ 745 /**/ 746 249, 747 /**/ 748 248, 749 /**/ 750 247, 751 /**/ 752 246, 753 /**/ 754 245, 755 /**/ 756 244, 757 /**/ 758 243, 759 /**/ 760 242, 761 /**/ 762 241, 763 /**/ 764 240, 765 /**/ 766 239, 767 /**/ 768 238, 769 /**/ 770 237, 771 /**/ 772 236, 773 /**/ 774 235, 775 /**/ 776 234, 777 /**/ 778 233, 779 /**/ 780 232, 781 /**/ 782 231, 783 /**/ 784 230, 785 /**/ 786 229, 787 /**/ 788 228, 789 /**/ 790 227, 791 /**/ 792 226, 793 /**/ 794 225, 795 /**/ 796 224, 797 /**/ 798 223, 799 /**/ 800 222, 801 /**/ 802 221, 803 /**/ 804 220, 805 /**/ 806 219, 807 /**/ 808 218, 809 /**/ 810 217, 811 /**/ 812 216, 813 /**/ 814 215, 815 /**/ 816 214, 817 /**/ 818 213, 819 /**/ 820 212, 821 /**/ 822 211, 823 /**/ 824 210, 825 /**/ 826 209, 827 /**/ 828 208, 829 /**/ 830 207, 831 /**/ 832 206, 833 /**/ 834 205, 835 /**/ 836 204, 837 /**/ 838 203, 839 /**/ 840 202, 841 /**/ 842 201, 843 /**/ 844 200, 845 /**/ 846 199, 847 /**/ 848 198, 849 /**/ 850 197, 851 /**/ 852 196, 853 /**/ 854 195, 855 /**/ 856 194, 857 /**/ 858 193, 859 /**/ 860 192, 861 /**/ 862 191, 863 /**/ 864 190, 865 /**/ 866 189, 867 /**/ 868 188, 869 /**/ 870 187, 871 /**/ 872 186, 873 /**/ 874 185, 875 /**/ 876 184, 877 /**/ 878 183, 879 /**/ 880 182, 881 /**/ 882 181, 883 /**/ 884 180, 885 /**/ 886 179, 887 /**/ 888 178, 889 /**/ 890 177, 891 /**/ 892 176, 893 /**/ 894 175, 895 /**/ 896 174, 897 /**/ 898 173, 899 /**/ 900 172, 901 /**/ 902 171, 903 /**/ 904 170, 905 /**/ 906 169, 907 /**/ 908 168, 909 /**/ 910 167, 911 /**/ 912 166, 913 /**/ 914 165, 915 /**/ 916 164, 917 /**/ 918 163, 919 /**/ 920 162, 921 /**/ 922 161, 923 /**/ 924 160, 925 /**/ 926 159, 927 /**/ 928 158, 929 /**/ 930 157, 931 /**/ 932 156, 933 /**/ 934 155, 935 /**/ 936 154, 937 /**/ 938 153, 939 /**/ 940 152, 941 /**/ 942 151, 943 /**/ 944 150, 945 /**/ 946 149, 947 /**/ 948 148, 949 /**/ 950 147, 951 /**/ 952 146, 953 /**/ 954 145, 955 /**/ 956 144, 957 /**/ 958 143, 959 /**/ 960 142, 961 /**/ 962 141, 963 /**/ 964 140, 965 /**/ 966 139, 967 /**/ 968 138, 969 /**/ 970 137, 971 /**/ 972 136, 973 /**/ 974 135, 975 /**/ 976 134, 977 /**/ 978 133, 979 /**/ 980 132, 981 /**/ 982 131, 983 /**/ 984 130, 985 /**/ 986 129, 987 /**/ 988 128, 989 /**/ 990 127, 991 /**/ 992 126, 993 /**/ 994 125, 995 /**/ 996 124, 997 /**/ 998 123, 999 /**/ 1000 122, 1001 /**/ 1002 121, 1003 /**/ 1004 120, 1005 /**/ 1006 119, 1007 /**/ 1008 118, 1009 /**/ 1010 117, 1011 /**/ 1012 116, 1013 /**/ 1014 115, 1015 /**/ 1016 114, 1017 /**/ 1018 113, 1019 /**/ 1020 112, 1021 /**/ 1022 111, 1023 /**/ 1024 110, 1025 /**/ 1026 109, 1027 /**/ 1028 108, 1029 /**/ 1030 107, 1031 /**/ 1032 106, 1033 /**/ 1034 105, 1035 /**/ 1036 104, 1037 /**/ 1038 103, 1039 /**/ 1040 102, 1041 /**/ 1042 101, 1043 /**/ 1044 100, 1045 /**/ 1046 99, 1047 /**/ 1048 98, 1049 /**/ 1050 97, 1051 /**/ 1052 96, 1053 /**/ 1054 95, 1055 /**/ 1056 94, 1057 /**/ 1058 93, 1059 /**/ 1060 92, 1061 /**/ 1062 91, 1063 /**/ 1064 90, 1065 /**/ 1066 89, 1067 /**/ 1068 88, 1069 /**/ 1070 87, 1071 /**/ 1072 86, 1073 /**/ 1074 85, 1075 /**/ 1076 84, 1077 /**/ 1078 83, 1079 /**/ 1080 82, 1081 /**/ 1082 81, 1083 /**/ 1084 80, 1085 /**/ 1086 79, 1087 /**/ 1088 78, 1089 /**/ 1090 77, 1091 /**/ 1092 76, 1093 /**/ 1094 75, 1095 /**/ 1096 74, 1097 /**/ 1098 73, 1099 /**/ 1100 72, 1101 /**/ 1102 71, 1103 /**/ 1104 70, 1105 /**/ 1106 69, 1107 /**/ 1108 68, 1109 /**/ 1110 67, 1111 /**/ 1112 66, 1113 /**/ 1114 65, 1115 /**/ 1116 64, 1117 /**/ 1118 63, 1119 /**/ 1120 62, 1121 /**/ 1122 61, 1123 /**/ 1124 60, 1125 /**/ 1126 59, 1127 /**/ 1128 58, 1129 /**/ 1130 57, 1131 /**/ 1132 56, 1133 /**/ 1134 55, 1135 /**/ 1136 54, 1137 /**/ 1138 53, 1139 /**/ 1140 52, 1141 /**/ 1142 51, 1143 /**/ 1144 50, 1145 /**/ 1146 49, 1147 /**/ 1148 48, 1149 /**/ 1150 47, 1151 /**/ 1152 46, 1153 /**/ 1154 45, 1155 /**/ 1156 44, 1157 /**/ 1158 43, 1159 /**/ 1160 42, 1161 /**/ 1162 41, 1163 /**/ 1164 40, 1165 /**/ 1166 39, 1167 /**/ 1168 38, 1169 /**/ 1170 37, 1171 /**/ 1172 36, 1173 /**/ 1174 35, 1175 /**/ 1176 34, 1177 /**/ 1178 33, 1179 /**/ 1180 32, 1181 /**/ 1182 31, 1183 /**/ 1184 30, 1185 /**/ 1186 29, 1187 /**/ 1188 28, 1189 /**/ 1190 27, 1191 /**/ 1192 26, 1193 /**/ 1194 25, 1195 /**/ 1196 24, 1197 /**/ 1198 23, 1199 /**/ 1200 22, 1201 /**/ 1202 21, 1203 /**/ 1204 20, 1205 /**/ 1206 19, 1207 /**/ 1208 18, 1209 /**/ 1210 17, 1211 /**/ 1212 16, 1213 /**/ 1214 15, 1215 /**/ 1216 14, 1217 /**/ 1218 13, 1219 /**/ 1220 12, 1221 /**/ 1222 11, 1223 /**/ 1224 10, 1225 /**/ 1226 9, 1227 /**/ 1228 8, 1229 /**/ 1230 7, 1231 /**/ 1232 6, 1233 /**/ 1234 5, 1235 /**/ 1236 4, 1237 /**/ 1238 3, 1239 /**/ 1240 2, 1241 /**/ 1242 1, 1243 /**/ 1244 0 1245 }; 1246 1247 /* 1248 * Place to put a short description when adding a feature with a patch. 1249 * Keep it short, e.g.,: "relative numbers", "persistent undo". 1250 * Also add a comment marker to separate the lines. 1251 * See the official Vim patches for the diff format: It must use a context of 1252 * one line only. Create it by hand or use "diff -C2" and edit the patch. 1253 */ 1254 static char *(extra_patches[]) = 1255 { /* Add your patch description below this line */ 1256 /**/ 1257 NULL 1258 }; 1259 1260 int 1261 highest_patch(void) 1262 { 1263 // this relies on the highest patch number to be the first entry 1264 return included_patches[0]; 1265 } 1266 1267 #if defined(FEAT_EVAL) || defined(PROTO) 1268 /* 1269 * Return TRUE if patch "n" has been included. 1270 */ 1271 int 1272 has_patch(int n) 1273 { 1274 int i; 1275 1276 for (i = 0; included_patches[i] != 0; ++i) 1277 if (included_patches[i] == n) 1278 return TRUE; 1279 return FALSE; 1280 } 1281 #endif 1282 1283 void 1284 ex_version(exarg_T *eap) 1285 { 1286 /* 1287 * Ignore a ":version 9.99" command. 1288 */ 1289 if (*eap->arg == NUL) 1290 { 1291 msg_putchar('\n'); 1292 list_version(); 1293 } 1294 } 1295 1296 /* 1297 * Output a string for the version message. If it's going to wrap, output a 1298 * newline, unless the message is too long to fit on the screen anyway. 1299 * When "wrap" is TRUE wrap the string in []. 1300 */ 1301 static void 1302 version_msg_wrap(char_u *s, int wrap) 1303 { 1304 int len = (int)vim_strsize(s) + (wrap ? 2 : 0); 1305 1306 if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns 1307 && *s != '\n') 1308 msg_putchar('\n'); 1309 if (!got_int) 1310 { 1311 if (wrap) 1312 msg_puts("["); 1313 msg_puts((char *)s); 1314 if (wrap) 1315 msg_puts("]"); 1316 } 1317 } 1318 1319 static void 1320 version_msg(char *s) 1321 { 1322 version_msg_wrap((char_u *)s, FALSE); 1323 } 1324 1325 /* 1326 * List all features aligned in columns, dictionary style. 1327 */ 1328 static void 1329 list_features(void) 1330 { 1331 list_in_columns((char_u **)features, -1, -1); 1332 } 1333 1334 /* 1335 * List string items nicely aligned in columns. 1336 * When "size" is < 0 then the last entry is marked with NULL. 1337 * The entry with index "current" is inclosed in []. 1338 */ 1339 void 1340 list_in_columns(char_u **items, int size, int current) 1341 { 1342 int i; 1343 int ncol; 1344 int nrow; 1345 int cur_row = 1; 1346 int item_count = 0; 1347 int width = 0; 1348 #ifdef FEAT_SYN_HL 1349 int use_highlight = (items == (char_u **)features); 1350 #endif 1351 1352 // Find the length of the longest item, use that + 1 as the column 1353 // width. 1354 for (i = 0; size < 0 ? items[i] != NULL : i < size; ++i) 1355 { 1356 int l = (int)vim_strsize(items[i]) + (i == current ? 2 : 0); 1357 1358 if (l > width) 1359 width = l; 1360 ++item_count; 1361 } 1362 width += 1; 1363 1364 if (Columns < width) 1365 { 1366 // Not enough screen columns - show one per line 1367 for (i = 0; i < item_count; ++i) 1368 { 1369 version_msg_wrap(items[i], i == current); 1370 if (msg_col > 0 && i < item_count - 1) 1371 msg_putchar('\n'); 1372 } 1373 return; 1374 } 1375 1376 // The rightmost column doesn't need a separator. 1377 // Sacrifice it to fit in one more column if possible. 1378 ncol = (int) (Columns + 1) / width; 1379 nrow = item_count / ncol + (item_count % ncol ? 1 : 0); 1380 1381 // "i" counts columns then rows. "idx" counts rows then columns. 1382 for (i = 0; !got_int && i < nrow * ncol; ++i) 1383 { 1384 int idx = (i / ncol) + (i % ncol) * nrow; 1385 1386 if (idx < item_count) 1387 { 1388 int last_col = (i + 1) % ncol == 0; 1389 1390 if (idx == current) 1391 msg_putchar('['); 1392 #ifdef FEAT_SYN_HL 1393 if (use_highlight && items[idx][0] == '-') 1394 msg_puts_attr((char *)items[idx], HL_ATTR(HLF_W)); 1395 else 1396 #endif 1397 msg_puts((char *)items[idx]); 1398 if (idx == current) 1399 msg_putchar(']'); 1400 if (last_col) 1401 { 1402 if (msg_col > 0 && cur_row < nrow) 1403 msg_putchar('\n'); 1404 ++cur_row; 1405 } 1406 else 1407 { 1408 while (msg_col % width) 1409 msg_putchar(' '); 1410 } 1411 } 1412 else 1413 { 1414 // this row is out of items, thus at the end of the row 1415 if (msg_col > 0) 1416 { 1417 if (cur_row < nrow) 1418 msg_putchar('\n'); 1419 ++cur_row; 1420 } 1421 } 1422 } 1423 } 1424 1425 void 1426 list_version(void) 1427 { 1428 int i; 1429 int first; 1430 char *s = ""; 1431 1432 /* 1433 * When adding features here, don't forget to update the list of 1434 * internal variables in eval.c! 1435 */ 1436 init_longVersion(); 1437 msg(longVersion); 1438 #ifdef MSWIN 1439 # ifdef FEAT_GUI_MSWIN 1440 # ifdef VIMDLL 1441 # ifdef _WIN64 1442 msg_puts(_("\nMS-Windows 64-bit GUI/console version")); 1443 # else 1444 msg_puts(_("\nMS-Windows 32-bit GUI/console version")); 1445 # endif 1446 # else 1447 # ifdef _WIN64 1448 msg_puts(_("\nMS-Windows 64-bit GUI version")); 1449 # else 1450 msg_puts(_("\nMS-Windows 32-bit GUI version")); 1451 # endif 1452 # endif 1453 # ifdef FEAT_OLE 1454 msg_puts(_(" with OLE support")); 1455 # endif 1456 # else 1457 # ifdef _WIN64 1458 msg_puts(_("\nMS-Windows 64-bit console version")); 1459 # else 1460 msg_puts(_("\nMS-Windows 32-bit console version")); 1461 # endif 1462 # endif 1463 #endif 1464 #if defined(MACOS_X) 1465 # if defined(MACOS_X_DARWIN) 1466 msg_puts(_("\nmacOS version")); 1467 # else 1468 msg_puts(_("\nmacOS version w/o darwin feat.")); 1469 # endif 1470 #endif 1471 1472 #ifdef VMS 1473 msg_puts(_("\nOpenVMS version")); 1474 # ifdef HAVE_PATHDEF 1475 if (*compiled_arch != NUL) 1476 { 1477 msg_puts(" - "); 1478 msg_puts((char *)compiled_arch); 1479 } 1480 # endif 1481 1482 #endif 1483 1484 // Print the list of patch numbers if there is at least one. 1485 // Print a range when patches are consecutive: "1-10, 12, 15-40, 42-45" 1486 if (included_patches[0] != 0) 1487 { 1488 msg_puts(_("\nIncluded patches: ")); 1489 first = -1; 1490 // find last one 1491 for (i = 0; included_patches[i] != 0; ++i) 1492 ; 1493 while (--i >= 0) 1494 { 1495 if (first < 0) 1496 first = included_patches[i]; 1497 if (i == 0 || included_patches[i - 1] != included_patches[i] + 1) 1498 { 1499 msg_puts(s); 1500 s = ", "; 1501 msg_outnum((long)first); 1502 if (first != included_patches[i]) 1503 { 1504 msg_puts("-"); 1505 msg_outnum((long)included_patches[i]); 1506 } 1507 first = -1; 1508 } 1509 } 1510 } 1511 1512 // Print the list of extra patch descriptions if there is at least one. 1513 if (extra_patches[0] != NULL) 1514 { 1515 msg_puts(_("\nExtra patches: ")); 1516 s = ""; 1517 for (i = 0; extra_patches[i] != NULL; ++i) 1518 { 1519 msg_puts(s); 1520 s = ", "; 1521 msg_puts(extra_patches[i]); 1522 } 1523 } 1524 1525 #ifdef MODIFIED_BY 1526 msg_puts("\n"); 1527 msg_puts(_("Modified by ")); 1528 msg_puts(MODIFIED_BY); 1529 #endif 1530 1531 #ifdef HAVE_PATHDEF 1532 if (*compiled_user != NUL || *compiled_sys != NUL) 1533 { 1534 msg_puts(_("\nCompiled ")); 1535 if (*compiled_user != NUL) 1536 { 1537 msg_puts(_("by ")); 1538 msg_puts((char *)compiled_user); 1539 } 1540 if (*compiled_sys != NUL) 1541 { 1542 msg_puts("@"); 1543 msg_puts((char *)compiled_sys); 1544 } 1545 } 1546 #endif 1547 1548 #ifdef FEAT_HUGE 1549 msg_puts(_("\nHuge version ")); 1550 #else 1551 # ifdef FEAT_BIG 1552 msg_puts(_("\nBig version ")); 1553 # else 1554 # ifdef FEAT_NORMAL 1555 msg_puts(_("\nNormal version ")); 1556 # else 1557 # ifdef FEAT_SMALL 1558 msg_puts(_("\nSmall version ")); 1559 # else 1560 msg_puts(_("\nTiny version ")); 1561 # endif 1562 # endif 1563 # endif 1564 #endif 1565 #ifndef FEAT_GUI 1566 msg_puts(_("without GUI.")); 1567 #else 1568 # ifdef FEAT_GUI_GTK 1569 # ifdef USE_GTK3 1570 msg_puts(_("with GTK3 GUI.")); 1571 # else 1572 # ifdef FEAT_GUI_GNOME 1573 msg_puts(_("with GTK2-GNOME GUI.")); 1574 # else 1575 msg_puts(_("with GTK2 GUI.")); 1576 # endif 1577 # endif 1578 # else 1579 # ifdef FEAT_GUI_MOTIF 1580 msg_puts(_("with X11-Motif GUI.")); 1581 # else 1582 # ifdef FEAT_GUI_ATHENA 1583 # ifdef FEAT_GUI_NEXTAW 1584 msg_puts(_("with X11-neXtaw GUI.")); 1585 # else 1586 msg_puts(_("with X11-Athena GUI.")); 1587 # endif 1588 # else 1589 # ifdef FEAT_GUI_PHOTON 1590 msg_puts(_("with Photon GUI.")); 1591 # else 1592 # if defined(MSWIN) 1593 msg_puts(_("with GUI.")); 1594 # else 1595 # if defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON 1596 msg_puts(_("with Carbon GUI.")); 1597 # else 1598 # if defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX 1599 msg_puts(_("with Cocoa GUI.")); 1600 # else 1601 # endif 1602 # endif 1603 # endif 1604 # endif 1605 # endif 1606 # endif 1607 # endif 1608 #endif 1609 version_msg(_(" Features included (+) or not (-):\n")); 1610 1611 list_features(); 1612 if (msg_col > 0) 1613 msg_putchar('\n'); 1614 1615 #ifdef SYS_VIMRC_FILE 1616 version_msg(_(" system vimrc file: \"")); 1617 version_msg(SYS_VIMRC_FILE); 1618 version_msg("\"\n"); 1619 #endif 1620 #ifdef USR_VIMRC_FILE 1621 version_msg(_(" user vimrc file: \"")); 1622 version_msg(USR_VIMRC_FILE); 1623 version_msg("\"\n"); 1624 #endif 1625 #ifdef USR_VIMRC_FILE2 1626 version_msg(_(" 2nd user vimrc file: \"")); 1627 version_msg(USR_VIMRC_FILE2); 1628 version_msg("\"\n"); 1629 #endif 1630 #ifdef USR_VIMRC_FILE3 1631 version_msg(_(" 3rd user vimrc file: \"")); 1632 version_msg(USR_VIMRC_FILE3); 1633 version_msg("\"\n"); 1634 #endif 1635 #ifdef USR_EXRC_FILE 1636 version_msg(_(" user exrc file: \"")); 1637 version_msg(USR_EXRC_FILE); 1638 version_msg("\"\n"); 1639 #endif 1640 #ifdef USR_EXRC_FILE2 1641 version_msg(_(" 2nd user exrc file: \"")); 1642 version_msg(USR_EXRC_FILE2); 1643 version_msg("\"\n"); 1644 #endif 1645 #ifdef FEAT_GUI 1646 # ifdef SYS_GVIMRC_FILE 1647 version_msg(_(" system gvimrc file: \"")); 1648 version_msg(SYS_GVIMRC_FILE); 1649 version_msg("\"\n"); 1650 # endif 1651 version_msg(_(" user gvimrc file: \"")); 1652 version_msg(USR_GVIMRC_FILE); 1653 version_msg("\"\n"); 1654 # ifdef USR_GVIMRC_FILE2 1655 version_msg(_("2nd user gvimrc file: \"")); 1656 version_msg(USR_GVIMRC_FILE2); 1657 version_msg("\"\n"); 1658 # endif 1659 # ifdef USR_GVIMRC_FILE3 1660 version_msg(_("3rd user gvimrc file: \"")); 1661 version_msg(USR_GVIMRC_FILE3); 1662 version_msg("\"\n"); 1663 # endif 1664 #endif 1665 version_msg(_(" defaults file: \"")); 1666 version_msg(VIM_DEFAULTS_FILE); 1667 version_msg("\"\n"); 1668 #ifdef FEAT_GUI 1669 # ifdef SYS_MENU_FILE 1670 version_msg(_(" system menu file: \"")); 1671 version_msg(SYS_MENU_FILE); 1672 version_msg("\"\n"); 1673 # endif 1674 #endif 1675 #ifdef HAVE_PATHDEF 1676 if (*default_vim_dir != NUL) 1677 { 1678 version_msg(_(" fall-back for $VIM: \"")); 1679 version_msg((char *)default_vim_dir); 1680 version_msg("\"\n"); 1681 } 1682 if (*default_vimruntime_dir != NUL) 1683 { 1684 version_msg(_(" f-b for $VIMRUNTIME: \"")); 1685 version_msg((char *)default_vimruntime_dir); 1686 version_msg("\"\n"); 1687 } 1688 version_msg(_("Compilation: ")); 1689 version_msg((char *)all_cflags); 1690 version_msg("\n"); 1691 #ifdef VMS 1692 if (*compiler_version != NUL) 1693 { 1694 version_msg(_("Compiler: ")); 1695 version_msg((char *)compiler_version); 1696 version_msg("\n"); 1697 } 1698 #endif 1699 version_msg(_("Linking: ")); 1700 version_msg((char *)all_lflags); 1701 #endif 1702 #ifdef DEBUG 1703 version_msg("\n"); 1704 version_msg(_(" DEBUG BUILD")); 1705 #endif 1706 } 1707 1708 static void do_intro_line(int row, char_u *mesg, int add_version, int attr); 1709 1710 /* 1711 * Show the intro message when not editing a file. 1712 */ 1713 void 1714 maybe_intro_message(void) 1715 { 1716 if (BUFEMPTY() 1717 && curbuf->b_fname == NULL 1718 && firstwin->w_next == NULL 1719 && vim_strchr(p_shm, SHM_INTRO) == NULL) 1720 intro_message(FALSE); 1721 } 1722 1723 /* 1724 * Give an introductory message about Vim. 1725 * Only used when starting Vim on an empty file, without a file name. 1726 * Or with the ":intro" command (for Sven :-). 1727 */ 1728 void 1729 intro_message( 1730 int colon) // TRUE for ":intro" 1731 { 1732 int i; 1733 int row; 1734 int blanklines; 1735 int sponsor; 1736 char *p; 1737 static char *(lines[]) = 1738 { 1739 N_("VIM - Vi IMproved"), 1740 "", 1741 N_("version "), 1742 N_("by Bram Moolenaar et al."), 1743 #ifdef MODIFIED_BY 1744 " ", 1745 #endif 1746 N_("Vim is open source and freely distributable"), 1747 "", 1748 N_("Help poor children in Uganda!"), 1749 N_("type :help iccf<Enter> for information "), 1750 "", 1751 N_("type :q<Enter> to exit "), 1752 N_("type :help<Enter> or <F1> for on-line help"), 1753 N_("type :help version8<Enter> for version info"), 1754 NULL, 1755 "", 1756 N_("Running in Vi compatible mode"), 1757 N_("type :set nocp<Enter> for Vim defaults"), 1758 N_("type :help cp-default<Enter> for info on this"), 1759 }; 1760 #ifdef FEAT_GUI 1761 static char *(gui_lines[]) = 1762 { 1763 NULL, 1764 NULL, 1765 NULL, 1766 NULL, 1767 #ifdef MODIFIED_BY 1768 NULL, 1769 #endif 1770 NULL, 1771 NULL, 1772 NULL, 1773 N_("menu Help->Orphans for information "), 1774 NULL, 1775 N_("Running modeless, typed text is inserted"), 1776 N_("menu Edit->Global Settings->Toggle Insert Mode "), 1777 N_(" for two modes "), 1778 NULL, 1779 NULL, 1780 NULL, 1781 N_("menu Edit->Global Settings->Toggle Vi Compatible"), 1782 N_(" for Vim defaults "), 1783 }; 1784 #endif 1785 1786 // blanklines = screen height - # message lines 1787 blanklines = (int)Rows - ((sizeof(lines) / sizeof(char *)) - 1); 1788 if (!p_cp) 1789 blanklines += 4; // add 4 for not showing "Vi compatible" message 1790 1791 // Don't overwrite a statusline. Depends on 'cmdheight'. 1792 if (p_ls > 1) 1793 blanklines -= Rows - topframe->fr_height; 1794 if (blanklines < 0) 1795 blanklines = 0; 1796 1797 // Show the sponsor and register message one out of four times, the Uganda 1798 // message two out of four times. 1799 sponsor = (int)time(NULL); 1800 sponsor = ((sponsor & 2) == 0) - ((sponsor & 4) == 0); 1801 1802 // start displaying the message lines after half of the blank lines 1803 row = blanklines / 2; 1804 if ((row >= 2 && Columns >= 50) || colon) 1805 { 1806 for (i = 0; i < (int)(sizeof(lines) / sizeof(char *)); ++i) 1807 { 1808 p = lines[i]; 1809 #ifdef FEAT_GUI 1810 if (p_im && gui.in_use && gui_lines[i] != NULL) 1811 p = gui_lines[i]; 1812 #endif 1813 if (p == NULL) 1814 { 1815 if (!p_cp) 1816 break; 1817 continue; 1818 } 1819 if (sponsor != 0) 1820 { 1821 if (strstr(p, "children") != NULL) 1822 p = sponsor < 0 1823 ? N_("Sponsor Vim development!") 1824 : N_("Become a registered Vim user!"); 1825 else if (strstr(p, "iccf") != NULL) 1826 p = sponsor < 0 1827 ? N_("type :help sponsor<Enter> for information ") 1828 : N_("type :help register<Enter> for information "); 1829 else if (strstr(p, "Orphans") != NULL) 1830 p = N_("menu Help->Sponsor/Register for information "); 1831 } 1832 if (*p != NUL) 1833 do_intro_line(row, (char_u *)_(p), i == 2, 0); 1834 ++row; 1835 } 1836 } 1837 1838 // Make the wait-return message appear just below the text. 1839 if (colon) 1840 msg_row = row; 1841 } 1842 1843 static void 1844 do_intro_line( 1845 int row, 1846 char_u *mesg, 1847 int add_version, 1848 int attr) 1849 { 1850 char_u vers[20]; 1851 int col; 1852 char_u *p; 1853 int l; 1854 int clen; 1855 #ifdef MODIFIED_BY 1856 # define MODBY_LEN 150 1857 char_u modby[MODBY_LEN]; 1858 1859 if (*mesg == ' ') 1860 { 1861 vim_strncpy(modby, (char_u *)_("Modified by "), MODBY_LEN - 1); 1862 l = (int)STRLEN(modby); 1863 vim_strncpy(modby + l, (char_u *)MODIFIED_BY, MODBY_LEN - l - 1); 1864 mesg = modby; 1865 } 1866 #endif 1867 1868 // Center the message horizontally. 1869 col = vim_strsize(mesg); 1870 if (add_version) 1871 { 1872 STRCPY(vers, mediumVersion); 1873 if (highest_patch()) 1874 { 1875 // Check for 9.9x or 9.9xx, alpha/beta version 1876 if (isalpha((int)vers[3])) 1877 { 1878 int len = (isalpha((int)vers[4])) ? 5 : 4; 1879 sprintf((char *)vers + len, ".%d%s", highest_patch(), 1880 mediumVersion + len); 1881 } 1882 else 1883 sprintf((char *)vers + 3, ".%d", highest_patch()); 1884 } 1885 col += (int)STRLEN(vers); 1886 } 1887 col = (Columns - col) / 2; 1888 if (col < 0) 1889 col = 0; 1890 1891 // Split up in parts to highlight <> items differently. 1892 for (p = mesg; *p != NUL; p += l) 1893 { 1894 clen = 0; 1895 for (l = 0; p[l] != NUL 1896 && (l == 0 || (p[l] != '<' && p[l - 1] != '>')); ++l) 1897 { 1898 if (has_mbyte) 1899 { 1900 clen += ptr2cells(p + l); 1901 l += (*mb_ptr2len)(p + l) - 1; 1902 } 1903 else 1904 clen += byte2cells(p[l]); 1905 } 1906 screen_puts_len(p, l, row, col, *p == '<' ? HL_ATTR(HLF_8) : attr); 1907 col += clen; 1908 } 1909 1910 // Add the version number to the version line. 1911 if (add_version) 1912 screen_puts(vers, row, col, 0); 1913 } 1914 1915 /* 1916 * ":intro": clear screen, display intro screen and wait for return. 1917 */ 1918 void 1919 ex_intro(exarg_T *eap UNUSED) 1920 { 1921 screenclear(); 1922 intro_message(TRUE); 1923 wait_return(TRUE); 1924 } 1925