Mercurial > vim
annotate src/os_w32exe.c @ 11434:b3815e491811 v8.0.0601
patch 8.0.0601: no test coverage for :spellrepall
commit https://github.com/vim/vim/commit/545cb79da586be3333a0a55616046f94b01f6b1a
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue May 23 11:31:22 2017 +0200
patch 8.0.0601: no test coverage for :spellrepall
Problem: No test coverage for :spellrepall.
Solution: Add a test. (Dominique Pelle, closes https://github.com/vim/vim/issues/1717)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 23 May 2017 11:45:03 +0200 |
parents | 04eb70c77cf4 |
children | 639b8318472c |
rev | line source |
---|---|
10042
4aead6a9b7a9
commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
7 | 2 * |
3 * VIM - Vi IMproved by Bram Moolenaar | |
4 * GUI support by Robert Webb | |
5 * | |
6 * Do ":help uganda" in Vim to read copying and usage conditions. | |
7 * Do ":help credits" in Vim to see a list of people who contributed. | |
8 * See README.txt for an overview of the Vim source code. | |
9 */ | |
10 /* | |
11 * Windows GUI: main program (EXE) entry point: | |
12 * | |
13 * Ron Aaron <ronaharon@yahoo.com> wrote this and the DLL support code. | |
14 */ | |
15 #include "vim.h" | |
16 | |
17 #ifdef __MINGW32__ | |
18 # ifndef _cdecl | |
19 # define _cdecl | |
20 # endif | |
21 #endif | |
22 | |
23 /* cproto doesn't create a prototype for main() */ | |
24 int _cdecl | |
25 #if defined(FEAT_GUI_W32) | |
26 VimMain | |
27 #else | |
28 main | |
29 #endif | |
7805
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7613
diff
changeset
|
30 (int argc, char **argv); |
379 | 31 static int (_cdecl *pmain)(int, char **); |
7 | 32 |
33 #ifndef PROTO | |
34 #ifdef FEAT_GUI | |
35 #ifndef VIMDLL | |
36 void _cdecl SaveInst(HINSTANCE hInst); | |
37 #endif | |
379 | 38 static void (_cdecl *pSaveInst)(HINSTANCE); |
7 | 39 #endif |
40 | |
41 int WINAPI | |
42 WinMain( | |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
43 HINSTANCE hInstance UNUSED, |
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
44 HINSTANCE hPrevInst UNUSED, |
7 | 45 LPSTR lpszCmdLine, |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
46 int nCmdShow UNUSED) |
7 | 47 { |
23 | 48 int argc = 0; |
7 | 49 char **argv; |
50 char *tofree; | |
51 char prog[256]; | |
52 #ifdef VIMDLL | |
53 char *p; | |
54 HANDLE hLib; | |
55 #endif | |
56 | |
57 /* Ron: added full path name so that the $VIM variable will get set to our | |
58 * startup path (so the .vimrc file can be found w/o a VIM env. var.) */ | |
59 GetModuleFileName(NULL, prog, 255); | |
60 | |
26 | 61 argc = get_cmd_args(prog, (char *)lpszCmdLine, &argv, &tofree); |
62 if (argc == 0) | |
7 | 63 { |
26 | 64 MessageBox(0, "Could not allocate memory for command line.", |
65 "VIM Error", 0); | |
66 return 0; | |
7 | 67 } |
68 | |
69 #ifdef DYNAMIC_GETTEXT | |
70 /* Initialize gettext library */ | |
7613
4456fa2d22e8
commit https://github.com/vim/vim/commit/286eacd3f6631e985089176fb1dff1bcf1a1d6b5
Christian Brabandt <cb@256bit.org>
parents:
1738
diff
changeset
|
71 dyn_libintl_init(); |
7 | 72 #endif |
73 | |
74 #ifdef VIMDLL | |
75 // LoadLibrary - get name of dll to load in here: | |
76 p = strrchr(prog, '\\'); | |
77 if (p != NULL) | |
78 { | |
79 # ifdef DEBUG | |
80 strcpy(p+1, "vim32d.dll"); | |
81 # else | |
82 strcpy(p+1, "vim32.dll"); | |
83 # endif | |
84 } | |
85 hLib = LoadLibrary(prog); | |
86 if (hLib == NULL) | |
87 { | |
88 MessageBox(0, _("Could not load vim32.dll!"), _("VIM Error"), 0); | |
89 goto errout; | |
90 } | |
91 // fix up the function pointers | |
92 # ifdef FEAT_GUI | |
93 pSaveInst = GetProcAddress(hLib, (LPCSTR)2); | |
94 # endif | |
95 pmain = GetProcAddress(hLib, (LPCSTR)1); | |
96 if (pmain == NULL) | |
97 { | |
98 MessageBox(0, _("Could not fix up function pointers to the DLL!"), | |
99 _("VIM Error"),0); | |
100 goto errout; | |
101 } | |
102 #else | |
103 # ifdef FEAT_GUI | |
104 pSaveInst = SaveInst; | |
105 # endif | |
106 pmain = | |
107 # if defined(FEAT_GUI_W32) | |
108 //&& defined(__MINGW32__) | |
109 VimMain | |
110 # else | |
111 main | |
112 # endif | |
113 ; | |
114 #endif | |
115 #ifdef FEAT_GUI | |
116 pSaveInst( | |
117 #ifdef __MINGW32__ | |
118 GetModuleHandle(NULL) | |
119 #else | |
120 hInstance | |
121 #endif | |
122 ); | |
123 #endif | |
124 pmain(argc, argv); | |
125 | |
126 #ifdef VIMDLL | |
127 FreeLibrary(hLib); | |
128 errout: | |
129 #endif | |
130 free(argv); | |
1738 | 131 if (tofree != NULL) |
132 free(tofree); | |
23 | 133 #ifdef FEAT_MBYTE |
26 | 134 free_cmd_argsW(); |
23 | 135 #endif |
7 | 136 |
137 return 0; | |
138 } | |
139 #endif |