blob: fe82987dc95311a86829f24a7ba3d3c59c55e174 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001/* vi:set ts=8 sts=4 sw=4:
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 *
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +000020 * Differences between version 6.x and 7.x can be found with ":help version7".
Bram Moolenaar071d4272004-06-13 20:20:40 +000021 * Differences between version 5.x and 6.x can be found with ":help version6".
22 * Differences between version 4.x and 5.x can be found with ":help version5".
23 * Differences between version 3.0 and 4.x can be found with ":help version4".
24 * All the remarks about older versions have been removed, they are not very
25 * interesting.
26 */
27
28#include "version.h"
29
Bram Moolenaard042c562005-06-30 22:04:15 +000030char *Version = VIM_VERSION_SHORT;
31static char *mediumVersion = VIM_VERSION_MEDIUM;
Bram Moolenaar071d4272004-06-13 20:20:40 +000032
33#if defined(HAVE_DATE_TIME) || defined(PROTO)
34# if (defined(VMS) && defined(VAXC)) || defined(PROTO)
35char longVersion[sizeof(VIM_VERSION_LONG_DATE) + sizeof(__DATE__)
36 + sizeof(__TIME__) + 3];
37 void
38make_version()
39{
40 /*
41 * Construct the long version string. Necessary because
42 * VAX C can't catenate strings in the preprocessor.
43 */
44 strcpy(longVersion, VIM_VERSION_LONG_DATE);
45 strcat(longVersion, __DATE__);
46 strcat(longVersion, " ");
47 strcat(longVersion, __TIME__);
48 strcat(longVersion, ")");
49}
50# else
51char *longVersion = VIM_VERSION_LONG_DATE __DATE__ " " __TIME__ ")";
52# endif
53#else
54char *longVersion = VIM_VERSION_LONG;
55#endif
56
57static void version_msg __ARGS((char *s));
58
59static char *(features[]) =
60{
61#ifdef AMIGA /* only for Amiga systems */
62# ifdef FEAT_ARP
63 "+ARP",
64# else
65 "-ARP",
66# endif
67#endif
68#ifdef FEAT_ARABIC
69 "+arabic",
70#else
71 "-arabic",
72#endif
73#ifdef FEAT_AUTOCMD
74 "+autocmd",
75#else
76 "-autocmd",
77#endif
78#ifdef FEAT_BEVAL
79 "+balloon_eval",
80#else
81 "-balloon_eval",
82#endif
83#ifdef FEAT_BROWSE
84 "+browse",
85#else
86 "-browse",
87#endif
88#ifdef NO_BUILTIN_TCAPS
89 "-builtin_terms",
90#endif
91#ifdef SOME_BUILTIN_TCAPS
92 "+builtin_terms",
93#endif
94#ifdef ALL_BUILTIN_TCAPS
95 "++builtin_terms",
96#endif
97#ifdef FEAT_BYTEOFF
98 "+byte_offset",
99#else
100 "-byte_offset",
101#endif
102#ifdef FEAT_CINDENT
103 "+cindent",
104#else
105 "-cindent",
106#endif
107#ifdef FEAT_CLIENTSERVER
108 "+clientserver",
109#else
110 "-clientserver",
111#endif
112#ifdef FEAT_CLIPBOARD
113 "+clipboard",
114#else
115 "-clipboard",
116#endif
117#ifdef FEAT_CMDL_COMPL
118 "+cmdline_compl",
119#else
120 "-cmdline_compl",
121#endif
122#ifdef FEAT_CMDHIST
123 "+cmdline_hist",
124#else
125 "-cmdline_hist",
126#endif
127#ifdef FEAT_CMDL_INFO
128 "+cmdline_info",
129#else
130 "-cmdline_info",
131#endif
132#ifdef FEAT_COMMENTS
133 "+comments",
134#else
135 "-comments",
136#endif
137#ifdef FEAT_CRYPT
138 "+cryptv",
139#else
140 "-cryptv",
141#endif
142#ifdef FEAT_CSCOPE
143 "+cscope",
144#else
145 "-cscope",
146#endif
Bram Moolenaar17c7c012006-01-26 22:25:15 +0000147#ifdef CURSOR_SHAPE
148 "+cursorshape",
149#else
150 "-cursorshape",
151#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000152#if defined(FEAT_CON_DIALOG) && defined(FEAT_GUI_DIALOG)
153 "+dialog_con_gui",
154#else
155# if defined(FEAT_CON_DIALOG)
156 "+dialog_con",
157# else
158# if defined(FEAT_GUI_DIALOG)
159 "+dialog_gui",
160# else
161 "-dialog",
162# endif
163# endif
164#endif
165#ifdef FEAT_DIFF
166 "+diff",
167#else
168 "-diff",
169#endif
170#ifdef FEAT_DIGRAPHS
171 "+digraphs",
172#else
173 "-digraphs",
174#endif
175#ifdef FEAT_DND
176 "+dnd",
177#else
178 "-dnd",
179#endif
180#ifdef EBCDIC
181 "+ebcdic",
182#else
183 "-ebcdic",
184#endif
185#ifdef FEAT_EMACS_TAGS
186 "+emacs_tags",
187#else
188 "-emacs_tags",
189#endif
190#ifdef FEAT_EVAL
191 "+eval",
192#else
193 "-eval",
194#endif
195#ifdef FEAT_EX_EXTRA
196 "+ex_extra",
197#else
198 "-ex_extra",
199#endif
200#ifdef FEAT_SEARCH_EXTRA
201 "+extra_search",
202#else
203 "-extra_search",
204#endif
205#ifdef FEAT_FKMAP
206 "+farsi",
207#else
208 "-farsi",
209#endif
210#ifdef FEAT_SEARCHPATH
211 "+file_in_path",
212#else
213 "-file_in_path",
214#endif
215#ifdef FEAT_FIND_ID
216 "+find_in_path",
217#else
218 "-find_in_path",
219#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +0000220#ifdef FEAT_FLOAT
221 "+float",
222#else
223 "-float",
224#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000225#ifdef FEAT_FOLDING
226 "+folding",
227#else
228 "-folding",
229#endif
230#ifdef FEAT_FOOTER
231 "+footer",
232#else
233 "-footer",
234#endif
235 /* only interesting on Unix systems */
236#if !defined(USE_SYSTEM) && defined(UNIX)
237 "+fork()",
238#endif
239#ifdef FEAT_GETTEXT
240# ifdef DYNAMIC_GETTEXT
241 "+gettext/dyn",
242# else
243 "+gettext",
244# endif
245#else
246 "-gettext",
247#endif
248#ifdef FEAT_HANGULIN
249 "+hangul_input",
250#else
251 "-hangul_input",
252#endif
253#if (defined(HAVE_ICONV_H) && defined(USE_ICONV)) || defined(DYNAMIC_ICONV)
254# ifdef DYNAMIC_ICONV
255 "+iconv/dyn",
256# else
257 "+iconv",
258# endif
259#else
260 "-iconv",
261#endif
262#ifdef FEAT_INS_EXPAND
263 "+insert_expand",
264#else
265 "-insert_expand",
266#endif
267#ifdef FEAT_JUMPLIST
268 "+jumplist",
269#else
270 "-jumplist",
271#endif
272#ifdef FEAT_KEYMAP
273 "+keymap",
274#else
275 "-keymap",
276#endif
277#ifdef FEAT_LANGMAP
278 "+langmap",
279#else
280 "-langmap",
281#endif
282#ifdef FEAT_LIBCALL
283 "+libcall",
284#else
285 "-libcall",
286#endif
287#ifdef FEAT_LINEBREAK
288 "+linebreak",
289#else
290 "-linebreak",
291#endif
292#ifdef FEAT_LISP
293 "+lispindent",
294#else
295 "-lispindent",
296#endif
297#ifdef FEAT_LISTCMDS
298 "+listcmds",
299#else
300 "-listcmds",
301#endif
302#ifdef FEAT_LOCALMAP
303 "+localmap",
304#else
305 "-localmap",
306#endif
307#ifdef FEAT_MENU
308 "+menu",
309#else
310 "-menu",
311#endif
312#ifdef FEAT_SESSION
313 "+mksession",
314#else
315 "-mksession",
316#endif
317#ifdef FEAT_MODIFY_FNAME
318 "+modify_fname",
319#else
320 "-modify_fname",
321#endif
322#ifdef FEAT_MOUSE
323 "+mouse",
324# ifdef FEAT_MOUSESHAPE
325 "+mouseshape",
326# else
327 "-mouseshape",
328# endif
329# else
330 "-mouse",
331#endif
332#if defined(UNIX) || defined(VMS)
333# ifdef FEAT_MOUSE_DEC
334 "+mouse_dec",
335# else
336 "-mouse_dec",
337# endif
338# ifdef FEAT_MOUSE_GPM
339 "+mouse_gpm",
340# else
341 "-mouse_gpm",
342# endif
343# ifdef FEAT_MOUSE_JSB
344 "+mouse_jsbterm",
345# else
346 "-mouse_jsbterm",
347# endif
348# ifdef FEAT_MOUSE_NET
349 "+mouse_netterm",
350# else
351 "-mouse_netterm",
352# endif
Bram Moolenaar446cb832008-06-24 21:56:24 +0000353# ifdef FEAT_SYSMOUSE
354 "+mouse_sysmouse",
355# else
356 "-mouse_sysmouse",
357# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000358# ifdef FEAT_MOUSE_XTERM
359 "+mouse_xterm",
360# else
361 "-mouse_xterm",
362# endif
363#endif
364#ifdef __QNX__
365# ifdef FEAT_MOUSE_PTERM
366 "+mouse_pterm",
367# else
368 "-mouse_pterm",
369# endif
370#endif
371#ifdef FEAT_MBYTE_IME
372# ifdef DYNAMIC_IME
373 "+multi_byte_ime/dyn",
374# else
375 "+multi_byte_ime",
376# endif
377#else
378# ifdef FEAT_MBYTE
379 "+multi_byte",
380# else
381 "-multi_byte",
382# endif
383#endif
384#ifdef FEAT_MULTI_LANG
385 "+multi_lang",
386#else
387 "-multi_lang",
388#endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000389#ifdef FEAT_MZSCHEME
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000390# ifdef DYNAMIC_MZSCHEME
391 "+mzscheme/dyn",
392# else
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000393 "+mzscheme",
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000394# endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000395#else
396 "-mzscheme",
397#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000398#ifdef FEAT_NETBEANS_INTG
399 "+netbeans_intg",
400#else
401 "-netbeans_intg",
402#endif
403#ifdef FEAT_GUI_W32
404# ifdef FEAT_OLE
405 "+ole",
406# else
407 "-ole",
408# endif
409#endif
410#ifdef FEAT_OSFILETYPE
411 "+osfiletype",
412#else
413 "-osfiletype",
414#endif
415#ifdef FEAT_PATH_EXTRA
416 "+path_extra",
417#else
418 "-path_extra",
419#endif
420#ifdef FEAT_PERL
421# ifdef DYNAMIC_PERL
422 "+perl/dyn",
423# else
424 "+perl",
425# endif
426#else
427 "-perl",
428#endif
429#ifdef FEAT_PRINTER
430# ifdef FEAT_POSTSCRIPT
431 "+postscript",
432# else
433 "-postscript",
434# endif
435 "+printer",
436#else
437 "-printer",
438#endif
Bram Moolenaar05159a02005-02-26 23:04:13 +0000439#ifdef FEAT_PROFILE
440 "+profile",
441#else
442 "-profile",
443#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000444#ifdef FEAT_PYTHON
445# ifdef DYNAMIC_PYTHON
446 "+python/dyn",
447# else
448 "+python",
449# endif
450#else
451 "-python",
452#endif
453#ifdef FEAT_QUICKFIX
454 "+quickfix",
455#else
456 "-quickfix",
457#endif
Bram Moolenaard68071d2006-05-02 22:08:30 +0000458#ifdef FEAT_RELTIME
459 "+reltime",
460#else
461 "-reltime",
462#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000463#ifdef FEAT_RIGHTLEFT
464 "+rightleft",
465#else
466 "-rightleft",
467#endif
468#ifdef FEAT_RUBY
469# ifdef DYNAMIC_RUBY
470 "+ruby/dyn",
471# else
472 "+ruby",
473# endif
474#else
475 "-ruby",
476#endif
477#ifdef FEAT_SCROLLBIND
478 "+scrollbind",
479#else
480 "-scrollbind",
481#endif
482#ifdef FEAT_SIGNS
483 "+signs",
484#else
485 "-signs",
486#endif
487#ifdef FEAT_SMARTINDENT
488 "+smartindent",
489#else
490 "-smartindent",
491#endif
492#ifdef FEAT_SNIFF
493 "+sniff",
494#else
495 "-sniff",
496#endif
Bram Moolenaaref94eec2009-11-11 13:22:11 +0000497#ifdef STARTUPTIME
498 "+startuptime",
499#else
500 "-startuptime",
501#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000502#ifdef FEAT_STL_OPT
503 "+statusline",
504#else
505 "-statusline",
506#endif
507#ifdef FEAT_SUN_WORKSHOP
508 "+sun_workshop",
509#else
510 "-sun_workshop",
511#endif
512#ifdef FEAT_SYN_HL
513 "+syntax",
514#else
515 "-syntax",
516#endif
517 /* only interesting on Unix systems */
518#if defined(USE_SYSTEM) && (defined(UNIX) || defined(__EMX__))
519 "+system()",
520#endif
521#ifdef FEAT_TAG_BINS
522 "+tag_binary",
523#else
524 "-tag_binary",
525#endif
526#ifdef FEAT_TAG_OLDSTATIC
527 "+tag_old_static",
528#else
529 "-tag_old_static",
530#endif
531#ifdef FEAT_TAG_ANYWHITE
532 "+tag_any_white",
533#else
534 "-tag_any_white",
535#endif
536#ifdef FEAT_TCL
537# ifdef DYNAMIC_TCL
538 "+tcl/dyn",
539# else
540 "+tcl",
541# endif
542#else
543 "-tcl",
544#endif
545#if defined(UNIX) || defined(__EMX__)
546/* only Unix (or OS/2 with EMX!) can have terminfo instead of termcap */
547# ifdef TERMINFO
548 "+terminfo",
549# else
550 "-terminfo",
551# endif
552#else /* unix always includes termcap support */
553# ifdef HAVE_TGETENT
554 "+tgetent",
555# else
556 "-tgetent",
557# endif
558#endif
559#ifdef FEAT_TERMRESPONSE
560 "+termresponse",
561#else
562 "-termresponse",
563#endif
564#ifdef FEAT_TEXTOBJ
565 "+textobjects",
566#else
567 "-textobjects",
568#endif
569#ifdef FEAT_TITLE
570 "+title",
571#else
572 "-title",
573#endif
574#ifdef FEAT_TOOLBAR
575 "+toolbar",
576#else
577 "-toolbar",
578#endif
579#ifdef FEAT_USR_CMDS
580 "+user_commands",
581#else
582 "-user_commands",
583#endif
584#ifdef FEAT_VERTSPLIT
585 "+vertsplit",
586#else
587 "-vertsplit",
588#endif
589#ifdef FEAT_VIRTUALEDIT
590 "+virtualedit",
591#else
592 "-virtualedit",
593#endif
594#ifdef FEAT_VISUAL
595 "+visual",
596# ifdef FEAT_VISUALEXTRA
597 "+visualextra",
598# else
599 "-visualextra",
600# endif
601#else
602 "-visual",
603#endif
604#ifdef FEAT_VIMINFO
605 "+viminfo",
606#else
607 "-viminfo",
608#endif
609#ifdef FEAT_VREPLACE
610 "+vreplace",
611#else
612 "-vreplace",
613#endif
614#ifdef FEAT_WILDIGN
615 "+wildignore",
616#else
617 "-wildignore",
618#endif
619#ifdef FEAT_WILDMENU
620 "+wildmenu",
621#else
622 "-wildmenu",
623#endif
624#ifdef FEAT_WINDOWS
625 "+windows",
626#else
627 "-windows",
628#endif
629#ifdef FEAT_WRITEBACKUP
630 "+writebackup",
631#else
632 "-writebackup",
633#endif
634#if defined(UNIX) || defined(VMS)
635# ifdef FEAT_X11
636 "+X11",
637# else
638 "-X11",
639# endif
640#endif
641#ifdef FEAT_XFONTSET
642 "+xfontset",
643#else
644 "-xfontset",
645#endif
646#ifdef FEAT_XIM
647 "+xim",
648#else
649 "-xim",
650#endif
651#if defined(UNIX) || defined(VMS)
652# ifdef USE_XSMP_INTERACT
653 "+xsmp_interact",
654# else
655# ifdef USE_XSMP
656 "+xsmp",
657# else
658 "-xsmp",
659# endif
660# endif
661# ifdef FEAT_XCLIPBOARD
662 "+xterm_clipboard",
663# else
664 "-xterm_clipboard",
665# endif
666#endif
667#ifdef FEAT_XTERM_SAVE
668 "+xterm_save",
669#else
670 "-xterm_save",
671#endif
672#ifdef WIN3264
673# ifdef FEAT_XPM_W32
674 "+xpm_w32",
675# else
676 "-xpm_w32",
677# endif
678#endif
679 NULL
680};
681
682static int included_patches[] =
683{ /* Add new patch number below this line */
684/**/
685 0
686};
687
Bram Moolenaar10d4cec2008-11-30 11:15:09 +0000688/*
689 * Place to put a short description when adding a feature with a patch.
690 * Keep it short, e.g.,: "relative numbers", "persistent undo".
691 * Also add a comment marker to separate the lines.
692 * See the official Vim patches for the diff format: It must use a context of
Bram Moolenaarcbb8eb32008-12-24 13:25:14 +0000693 * one line only. Create it by hand or use "diff -C2" and edit the patch.
Bram Moolenaar10d4cec2008-11-30 11:15:09 +0000694 */
695static char *(extra_patches[]) =
696{ /* Add your patch description below this line */
697/**/
698 NULL
699};
700
Bram Moolenaar071d4272004-06-13 20:20:40 +0000701 int
702highest_patch()
703{
704 int i;
705 int h = 0;
706
707 for (i = 0; included_patches[i] != 0; ++i)
708 if (included_patches[i] > h)
709 h = included_patches[i];
710 return h;
711}
712
713#if defined(FEAT_EVAL) || defined(PROTO)
714/*
715 * Return TRUE if patch "n" has been included.
716 */
717 int
718has_patch(n)
719 int n;
720{
721 int i;
722
723 for (i = 0; included_patches[i] != 0; ++i)
724 if (included_patches[i] == n)
725 return TRUE;
726 return FALSE;
727}
728#endif
729
730 void
731ex_version(eap)
732 exarg_T *eap;
733{
734 /*
735 * Ignore a ":version 9.99" command.
736 */
737 if (*eap->arg == NUL)
738 {
739 msg_putchar('\n');
740 list_version();
741 }
742}
743
744 void
745list_version()
746{
747 int i;
748 int first;
749 char *s = "";
750
751 /*
752 * When adding features here, don't forget to update the list of
753 * internal variables in eval.c!
754 */
755 MSG(longVersion);
756#ifdef WIN3264
757# ifdef FEAT_GUI_W32
758# if defined(_MSC_VER) && (_MSC_VER <= 1010)
759 /* Only MS VC 4.1 and earlier can do Win32s */
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000760 MSG_PUTS(_("\nMS-Windows 16/32-bit GUI version"));
Bram Moolenaar071d4272004-06-13 20:20:40 +0000761# else
Bram Moolenaard9b87332006-10-03 14:30:41 +0000762# ifdef _WIN64
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000763 MSG_PUTS(_("\nMS-Windows 64-bit GUI version"));
Bram Moolenaard9b87332006-10-03 14:30:41 +0000764# else
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000765 MSG_PUTS(_("\nMS-Windows 32-bit GUI version"));
Bram Moolenaard9b87332006-10-03 14:30:41 +0000766# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000767# endif
768 if (gui_is_win32s())
769 MSG_PUTS(_(" in Win32s mode"));
770# ifdef FEAT_OLE
771 MSG_PUTS(_(" with OLE support"));
772# endif
773# else
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000774# ifdef _WIN64
775 MSG_PUTS(_("\nMS-Windows 64-bit console version"));
776# else
777 MSG_PUTS(_("\nMS-Windows 32-bit console version"));
778# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000779# endif
780#endif
781#ifdef WIN16
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000782 MSG_PUTS(_("\nMS-Windows 16-bit version"));
Bram Moolenaar071d4272004-06-13 20:20:40 +0000783#endif
784#ifdef MSDOS
785# ifdef DJGPP
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000786 MSG_PUTS(_("\n32-bit MS-DOS version"));
Bram Moolenaar071d4272004-06-13 20:20:40 +0000787# else
Bram Moolenaare7cb9cf2008-06-20 14:32:41 +0000788 MSG_PUTS(_("\n16-bit MS-DOS version"));
Bram Moolenaar071d4272004-06-13 20:20:40 +0000789# endif
790#endif
791#ifdef MACOS
792# ifdef MACOS_X
793# ifdef MACOS_X_UNIX
794 MSG_PUTS(_("\nMacOS X (unix) version"));
795# else
796 MSG_PUTS(_("\nMacOS X version"));
797# endif
798#else
799 MSG_PUTS(_("\nMacOS version"));
800# endif
801#endif
802
803#ifdef RISCOS
804 MSG_PUTS(_("\nRISC OS version"));
805#endif
806#ifdef VMS
Bram Moolenaar6949d1d2008-08-25 02:14:05 +0000807 MSG_PUTS(_("\nOpenVMS version"));
Bram Moolenaar3d20ca12006-11-28 16:43:58 +0000808# ifdef HAVE_PATHDEF
809 if (*compiled_arch != NUL)
810 {
811 MSG_PUTS(" - ");
812 MSG_PUTS(compiled_arch);
813 }
814# endif
815
Bram Moolenaar071d4272004-06-13 20:20:40 +0000816#endif
817
818 /* Print the list of patch numbers if there is at least one. */
819 /* Print a range when patches are consecutive: "1-10, 12, 15-40, 42-45" */
820 if (included_patches[0] != 0)
821 {
822 MSG_PUTS(_("\nIncluded patches: "));
823 first = -1;
824 /* find last one */
825 for (i = 0; included_patches[i] != 0; ++i)
826 ;
827 while (--i >= 0)
828 {
829 if (first < 0)
830 first = included_patches[i];
831 if (i == 0 || included_patches[i - 1] != included_patches[i] + 1)
832 {
833 MSG_PUTS(s);
834 s = ", ";
835 msg_outnum((long)first);
836 if (first != included_patches[i])
837 {
838 MSG_PUTS("-");
839 msg_outnum((long)included_patches[i]);
840 }
841 first = -1;
842 }
843 }
844 }
845
Bram Moolenaar10d4cec2008-11-30 11:15:09 +0000846 /* Print the list of extra patch descriptions if there is at least one. */
847 if (extra_patches[0] != NULL)
848 {
849 MSG_PUTS(_("\nExtra patches: "));
850 s = "";
851 for (i = 0; extra_patches[i] != NULL; ++i)
852 {
853 MSG_PUTS(s);
854 s = ", ";
855 MSG_PUTS(extra_patches[i]);
856 }
857 }
858
Bram Moolenaar071d4272004-06-13 20:20:40 +0000859#ifdef MODIFIED_BY
860 MSG_PUTS("\n");
861 MSG_PUTS(_("Modified by "));
862 MSG_PUTS(MODIFIED_BY);
863#endif
864
865#ifdef HAVE_PATHDEF
866 if (*compiled_user != NUL || *compiled_sys != NUL)
867 {
868 MSG_PUTS(_("\nCompiled "));
869 if (*compiled_user != NUL)
870 {
871 MSG_PUTS(_("by "));
872 MSG_PUTS(compiled_user);
873 }
874 if (*compiled_sys != NUL)
875 {
876 MSG_PUTS("@");
877 MSG_PUTS(compiled_sys);
878 }
879 }
880#endif
881
882#ifdef FEAT_HUGE
883 MSG_PUTS(_("\nHuge version "));
884#else
885# ifdef FEAT_BIG
886 MSG_PUTS(_("\nBig version "));
887# else
888# ifdef FEAT_NORMAL
889 MSG_PUTS(_("\nNormal version "));
890# else
891# ifdef FEAT_SMALL
892 MSG_PUTS(_("\nSmall version "));
893# else
894 MSG_PUTS(_("\nTiny version "));
895# endif
896# endif
897# endif
898#endif
899#ifndef FEAT_GUI
900 MSG_PUTS(_("without GUI."));
901#else
902# ifdef FEAT_GUI_GTK
903# ifdef FEAT_GUI_GNOME
904# ifdef HAVE_GTK2
905 MSG_PUTS(_("with GTK2-GNOME GUI."));
906# else
907 MSG_PUTS(_("with GTK-GNOME GUI."));
908# endif
909# else
910# ifdef HAVE_GTK2
911 MSG_PUTS(_("with GTK2 GUI."));
912# else
913 MSG_PUTS(_("with GTK GUI."));
914# endif
915# endif
916# else
917# ifdef FEAT_GUI_MOTIF
918 MSG_PUTS(_("with X11-Motif GUI."));
919# else
920# ifdef FEAT_GUI_ATHENA
921# ifdef FEAT_GUI_NEXTAW
922 MSG_PUTS(_("with X11-neXtaw GUI."));
923# else
924 MSG_PUTS(_("with X11-Athena GUI."));
925# endif
926# else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000927# ifdef FEAT_GUI_PHOTON
928 MSG_PUTS(_("with Photon GUI."));
929# else
930# if defined(MSWIN)
931 MSG_PUTS(_("with GUI."));
932# else
933# if defined (TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON
934 MSG_PUTS(_("with Carbon GUI."));
935# else
936# if defined (TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX
937 MSG_PUTS(_("with Cocoa GUI."));
938# else
939# if defined (MACOS)
940 MSG_PUTS(_("with (classic) GUI."));
Bram Moolenaar071d4272004-06-13 20:20:40 +0000941# endif
942# endif
943# endif
944# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000945# endif
946# endif
947# endif
948# endif
949#endif
950 version_msg(_(" Features included (+) or not (-):\n"));
951
952 /* print all the features */
953 for (i = 0; features[i] != NULL; ++i)
954 {
955 version_msg(features[i]);
956 if (msg_col > 0)
957 version_msg(" ");
958 }
959
960 version_msg("\n");
961#ifdef SYS_VIMRC_FILE
962 version_msg(_(" system vimrc file: \""));
963 version_msg(SYS_VIMRC_FILE);
964 version_msg("\"\n");
965#endif
966#ifdef USR_VIMRC_FILE
967 version_msg(_(" user vimrc file: \""));
968 version_msg(USR_VIMRC_FILE);
969 version_msg("\"\n");
970#endif
971#ifdef USR_VIMRC_FILE2
972 version_msg(_(" 2nd user vimrc file: \""));
973 version_msg(USR_VIMRC_FILE2);
974 version_msg("\"\n");
975#endif
976#ifdef USR_VIMRC_FILE3
977 version_msg(_(" 3rd user vimrc file: \""));
978 version_msg(USR_VIMRC_FILE3);
979 version_msg("\"\n");
980#endif
981#ifdef USR_EXRC_FILE
982 version_msg(_(" user exrc file: \""));
983 version_msg(USR_EXRC_FILE);
984 version_msg("\"\n");
985#endif
986#ifdef USR_EXRC_FILE2
987 version_msg(_(" 2nd user exrc file: \""));
988 version_msg(USR_EXRC_FILE2);
989 version_msg("\"\n");
990#endif
991#ifdef FEAT_GUI
992# ifdef SYS_GVIMRC_FILE
993 version_msg(_(" system gvimrc file: \""));
994 version_msg(SYS_GVIMRC_FILE);
995 version_msg("\"\n");
996# endif
997 version_msg(_(" user gvimrc file: \""));
998 version_msg(USR_GVIMRC_FILE);
999 version_msg("\"\n");
1000# ifdef USR_GVIMRC_FILE2
1001 version_msg(_("2nd user gvimrc file: \""));
1002 version_msg(USR_GVIMRC_FILE2);
1003 version_msg("\"\n");
1004# endif
1005# ifdef USR_GVIMRC_FILE3
1006 version_msg(_("3rd user gvimrc file: \""));
1007 version_msg(USR_GVIMRC_FILE3);
1008 version_msg("\"\n");
1009# endif
1010#endif
1011#ifdef FEAT_GUI
1012# ifdef SYS_MENU_FILE
1013 version_msg(_(" system menu file: \""));
1014 version_msg(SYS_MENU_FILE);
1015 version_msg("\"\n");
1016# endif
1017#endif
1018#ifdef HAVE_PATHDEF
1019 if (*default_vim_dir != NUL)
1020 {
1021 version_msg(_(" fall-back for $VIM: \""));
1022 version_msg((char *)default_vim_dir);
1023 version_msg("\"\n");
1024 }
1025 if (*default_vimruntime_dir != NUL)
1026 {
1027 version_msg(_(" f-b for $VIMRUNTIME: \""));
1028 version_msg((char *)default_vimruntime_dir);
1029 version_msg("\"\n");
1030 }
1031 version_msg(_("Compilation: "));
1032 version_msg((char *)all_cflags);
1033 version_msg("\n");
1034#ifdef VMS
1035 if (*compiler_version != NUL)
1036 {
1037 version_msg(_("Compiler: "));
1038 version_msg((char *)compiler_version);
1039 version_msg("\n");
1040 }
1041#endif
1042 version_msg(_("Linking: "));
1043 version_msg((char *)all_lflags);
1044#endif
1045#ifdef DEBUG
1046 version_msg("\n");
1047 version_msg(_(" DEBUG BUILD"));
1048#endif
1049}
1050
1051/*
1052 * Output a string for the version message. If it's going to wrap, output a
1053 * newline, unless the message is too long to fit on the screen anyway.
1054 */
1055 static void
1056version_msg(s)
1057 char *s;
1058{
1059 int len = (int)STRLEN(s);
1060
1061 if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns
1062 && *s != '\n')
1063 msg_putchar('\n');
1064 if (!got_int)
1065 MSG_PUTS(s);
1066}
1067
1068static void do_intro_line __ARGS((int row, char_u *mesg, int add_version, int attr));
1069
1070/*
1071 * Give an introductory message about Vim.
1072 * Only used when starting Vim on an empty file, without a file name.
1073 * Or with the ":intro" command (for Sven :-).
1074 */
1075 void
1076intro_message(colon)
1077 int colon; /* TRUE for ":intro" */
1078{
1079 int i;
1080 int row;
1081 int blanklines;
1082 int sponsor;
1083 char *p;
1084 static char *(lines[]) =
1085 {
1086 N_("VIM - Vi IMproved"),
1087 "",
1088 N_("version "),
1089 N_("by Bram Moolenaar et al."),
1090#ifdef MODIFIED_BY
1091 " ",
1092#endif
1093 N_("Vim is open source and freely distributable"),
1094 "",
1095 N_("Help poor children in Uganda!"),
1096 N_("type :help iccf<Enter> for information "),
1097 "",
1098 N_("type :q<Enter> to exit "),
1099 N_("type :help<Enter> or <F1> for on-line help"),
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001100 N_("type :help version7<Enter> for version info"),
Bram Moolenaar071d4272004-06-13 20:20:40 +00001101 NULL,
1102 "",
1103 N_("Running in Vi compatible mode"),
1104 N_("type :set nocp<Enter> for Vim defaults"),
1105 N_("type :help cp-default<Enter> for info on this"),
1106 };
1107#ifdef FEAT_GUI
1108 static char *(gui_lines[]) =
1109 {
1110 NULL,
1111 NULL,
1112 NULL,
1113 NULL,
1114#ifdef MODIFIED_BY
1115 NULL,
1116#endif
1117 NULL,
1118 NULL,
1119 NULL,
1120 N_("menu Help->Orphans for information "),
1121 NULL,
1122 N_("Running modeless, typed text is inserted"),
1123 N_("menu Edit->Global Settings->Toggle Insert Mode "),
1124 N_(" for two modes "),
1125 NULL,
1126 NULL,
1127 NULL,
1128 N_("menu Edit->Global Settings->Toggle Vi Compatible"),
1129 N_(" for Vim defaults "),
1130 };
1131#endif
1132
1133 /* blanklines = screen height - # message lines */
1134 blanklines = (int)Rows - ((sizeof(lines) / sizeof(char *)) - 1);
1135 if (!p_cp)
1136 blanklines += 4; /* add 4 for not showing "Vi compatible" message */
1137#if defined(WIN3264) && !defined(FEAT_GUI_W32)
1138 if (mch_windows95())
1139 blanklines -= 3; /* subtract 3 for showing "Windows 95" message */
1140#endif
1141
1142#ifdef FEAT_WINDOWS
1143 /* Don't overwrite a statusline. Depends on 'cmdheight'. */
1144 if (p_ls > 1)
1145 blanklines -= Rows - topframe->fr_height;
1146#endif
1147 if (blanklines < 0)
1148 blanklines = 0;
1149
1150 /* Show the sponsor and register message one out of four times, the Uganda
1151 * message two out of four times. */
Bram Moolenaarf4cd3e82005-12-22 22:47:02 +00001152 sponsor = (int)time(NULL);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001153 sponsor = ((sponsor & 2) == 0) - ((sponsor & 4) == 0);
1154
1155 /* start displaying the message lines after half of the blank lines */
1156 row = blanklines / 2;
1157 if ((row >= 2 && Columns >= 50) || colon)
1158 {
1159 for (i = 0; i < (int)(sizeof(lines) / sizeof(char *)); ++i)
1160 {
1161 p = lines[i];
1162#ifdef FEAT_GUI
1163 if (p_im && gui.in_use && gui_lines[i] != NULL)
1164 p = gui_lines[i];
1165#endif
1166 if (p == NULL)
1167 {
1168 if (!p_cp)
1169 break;
1170 continue;
1171 }
1172 if (sponsor != 0)
1173 {
1174 if (strstr(p, "children") != NULL)
1175 p = sponsor < 0
1176 ? N_("Sponsor Vim development!")
1177 : N_("Become a registered Vim user!");
1178 else if (strstr(p, "iccf") != NULL)
1179 p = sponsor < 0
1180 ? N_("type :help sponsor<Enter> for information ")
1181 : N_("type :help register<Enter> for information ");
1182 else if (strstr(p, "Orphans") != NULL)
1183 p = N_("menu Help->Sponsor/Register for information ");
1184 }
1185 if (*p != NUL)
1186 do_intro_line(row, (char_u *)_(p), i == 2, 0);
1187 ++row;
1188 }
1189#if defined(WIN3264) && !defined(FEAT_GUI_W32)
1190 if (mch_windows95())
1191 {
1192 do_intro_line(++row,
1193 (char_u *)_("WARNING: Windows 95/98/ME detected"),
1194 FALSE, hl_attr(HLF_E));
1195 do_intro_line(++row,
1196 (char_u *)_("type :help windows95<Enter> for info on this"),
1197 FALSE, 0);
1198 }
1199#endif
1200 }
1201
1202 /* Make the wait-return message appear just below the text. */
1203 if (colon)
1204 msg_row = row;
1205}
1206
1207 static void
1208do_intro_line(row, mesg, add_version, attr)
1209 int row;
1210 char_u *mesg;
1211 int add_version;
1212 int attr;
1213{
1214 char_u vers[20];
1215 int col;
1216 char_u *p;
1217 int l;
1218 int clen;
1219#ifdef MODIFIED_BY
1220# define MODBY_LEN 150
1221 char_u modby[MODBY_LEN];
1222
1223 if (*mesg == ' ')
1224 {
Bram Moolenaar589e43a2008-01-05 12:59:22 +00001225 vim_strncpy(modby, (char_u *)_("Modified by "), MODBY_LEN - 1);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001226 l = STRLEN(modby);
Bram Moolenaar589e43a2008-01-05 12:59:22 +00001227 vim_strncpy(modby + l, (char_u *)MODIFIED_BY, MODBY_LEN - l - 1);
Bram Moolenaar071d4272004-06-13 20:20:40 +00001228 mesg = modby;
1229 }
1230#endif
1231
1232 /* Center the message horizontally. */
1233 col = vim_strsize(mesg);
1234 if (add_version)
1235 {
1236 STRCPY(vers, mediumVersion);
1237 if (highest_patch())
1238 {
1239 /* Check for 9.9x or 9.9xx, alpha/beta version */
1240 if (isalpha((int)mediumVersion[3]))
1241 {
1242 if (isalpha((int)mediumVersion[4]))
1243 sprintf((char *)vers + 5, ".%d%s", highest_patch(),
1244 mediumVersion + 5);
1245 else
1246 sprintf((char *)vers + 4, ".%d%s", highest_patch(),
1247 mediumVersion + 4);
1248 }
1249 else
1250 sprintf((char *)vers + 3, ".%d", highest_patch());
1251 }
1252 col += (int)STRLEN(vers);
1253 }
1254 col = (Columns - col) / 2;
1255 if (col < 0)
1256 col = 0;
1257
1258 /* Split up in parts to highlight <> items differently. */
1259 for (p = mesg; *p != NUL; p += l)
1260 {
1261 clen = 0;
1262 for (l = 0; p[l] != NUL
1263 && (l == 0 || (p[l] != '<' && p[l - 1] != '>')); ++l)
1264 {
1265#ifdef FEAT_MBYTE
1266 if (has_mbyte)
1267 {
1268 clen += ptr2cells(p + l);
Bram Moolenaar0fa313a2005-08-10 21:07:57 +00001269 l += (*mb_ptr2len)(p + l) - 1;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001270 }
1271 else
1272#endif
1273 clen += byte2cells(p[l]);
1274 }
1275 screen_puts_len(p, l, row, col, *p == '<' ? hl_attr(HLF_8) : attr);
1276 col += clen;
1277 }
1278
1279 /* Add the version number to the version line. */
1280 if (add_version)
1281 screen_puts(vers, row, col, 0);
1282}
1283
1284/*
1285 * ":intro": clear screen, display intro screen and wait for return.
1286 */
Bram Moolenaar071d4272004-06-13 20:20:40 +00001287 void
1288ex_intro(eap)
Bram Moolenaar0c094b92009-05-14 20:20:33 +00001289 exarg_T *eap UNUSED;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001290{
1291 screenclear();
1292 intro_message(TRUE);
1293 wait_return(TRUE);
1294}