Mercurial > vim
annotate src/os_w32exe.c @ 7955:a4de8e834b8f v7.4.1273
commit https://github.com/vim/vim/commit/c5f98ee987ae0c369867cf6cc581c766d3c0226d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Feb 7 00:00:35 2016 +0100
patch 7.4.1273
Problem: assert_false(v:false) still fails.
Solution: Fix the typo.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 07 Feb 2016 00:15:04 +0100 |
parents | 0b6c37dd858d |
children | 4aead6a9b7a9 |
rev | line source |
---|---|
7 | 1 /* vi:set ts=8 sts=4 sw=4: |
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 | |
323 | 41 /*ARGSUSED*/ |
7 | 42 int WINAPI |
43 WinMain( | |
44 HINSTANCE hInstance, | |
45 HINSTANCE hPrevInst, | |
46 LPSTR lpszCmdLine, | |
47 int nCmdShow) | |
48 { | |
23 | 49 int argc = 0; |
7 | 50 char **argv; |
51 char *tofree; | |
52 char prog[256]; | |
53 #ifdef VIMDLL | |
54 char *p; | |
55 HANDLE hLib; | |
56 #endif | |
57 | |
58 /* Ron: added full path name so that the $VIM variable will get set to our | |
59 * startup path (so the .vimrc file can be found w/o a VIM env. var.) */ | |
60 GetModuleFileName(NULL, prog, 255); | |
61 | |
26 | 62 argc = get_cmd_args(prog, (char *)lpszCmdLine, &argv, &tofree); |
63 if (argc == 0) | |
7 | 64 { |
26 | 65 MessageBox(0, "Could not allocate memory for command line.", |
66 "VIM Error", 0); | |
67 return 0; | |
7 | 68 } |
69 | |
70 #ifdef DYNAMIC_GETTEXT | |
71 /* Initialize gettext library */ | |
7613
4456fa2d22e8
commit https://github.com/vim/vim/commit/286eacd3f6631e985089176fb1dff1bcf1a1d6b5
Christian Brabandt <cb@256bit.org>
parents:
1738
diff
changeset
|
72 dyn_libintl_init(); |
7 | 73 #endif |
74 | |
75 #ifdef VIMDLL | |
76 // LoadLibrary - get name of dll to load in here: | |
77 p = strrchr(prog, '\\'); | |
78 if (p != NULL) | |
79 { | |
80 # ifdef DEBUG | |
81 strcpy(p+1, "vim32d.dll"); | |
82 # else | |
83 strcpy(p+1, "vim32.dll"); | |
84 # endif | |
85 } | |
86 hLib = LoadLibrary(prog); | |
87 if (hLib == NULL) | |
88 { | |
89 MessageBox(0, _("Could not load vim32.dll!"), _("VIM Error"), 0); | |
90 goto errout; | |
91 } | |
92 // fix up the function pointers | |
93 # ifdef FEAT_GUI | |
94 pSaveInst = GetProcAddress(hLib, (LPCSTR)2); | |
95 # endif | |
96 pmain = GetProcAddress(hLib, (LPCSTR)1); | |
97 if (pmain == NULL) | |
98 { | |
99 MessageBox(0, _("Could not fix up function pointers to the DLL!"), | |
100 _("VIM Error"),0); | |
101 goto errout; | |
102 } | |
103 #else | |
104 # ifdef FEAT_GUI | |
105 pSaveInst = SaveInst; | |
106 # endif | |
107 pmain = | |
108 # if defined(FEAT_GUI_W32) | |
109 //&& defined(__MINGW32__) | |
110 VimMain | |
111 # else | |
112 main | |
113 # endif | |
114 ; | |
115 #endif | |
116 #ifdef FEAT_GUI | |
117 pSaveInst( | |
118 #ifdef __MINGW32__ | |
119 GetModuleHandle(NULL) | |
120 #else | |
121 hInstance | |
122 #endif | |
123 ); | |
124 #endif | |
125 pmain(argc, argv); | |
126 | |
127 #ifdef VIMDLL | |
128 FreeLibrary(hLib); | |
129 errout: | |
130 #endif | |
131 free(argv); | |
1738 | 132 if (tofree != NULL) |
133 free(tofree); | |
23 | 134 #ifdef FEAT_MBYTE |
26 | 135 free_cmd_argsW(); |
23 | 136 #endif |
7 | 137 |
138 return 0; | |
139 } | |
140 #endif |