]> git.pld-linux.org Git - packages/vim.git/blob - 7.3.441
- up to 7.3.600
[packages/vim.git] / 7.3.441
1 To: vim_dev@googlegroups.com
2 Subject: Patch 7.3.441
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.3.441
11 Problem:    Newer versions of MzScheme (Racket) require earlier (trampolined)
12             initialisation.
13 Solution:   Call mzscheme_main() early in main(). (Sergey Khorev)
14 Files:      src/Make_mvc.mak, src/if_mzsch.c, src/main.c,
15             src/proto/if_mzsch.pro
16     
17
18 *** ../vim-7.3.440/src/Make_mvc.mak     2011-09-14 19:01:38.000000000 +0200
19 --- src/Make_mvc.mak    2012-02-12 01:46:05.000000000 +0100
20 ***************
21 *** 740,745 ****
22 --- 740,747 ----
23   !endif
24   !endif
25   MZSCHEME_OBJ = $(OUTDIR)\if_mzsch.obj
26 + # increase stack size
27 + MZSCHEME_LIB = $(MZSCHEME_LIB) /STACK:8388608
28   !endif
29   
30   # Perl interface
31 *** ../vim-7.3.440/src/if_mzsch.c       2010-11-03 21:59:23.000000000 +0100
32 --- src/if_mzsch.c      2012-02-12 01:47:31.000000000 +0100
33 ***************
34 *** 31,38 ****
35    * depend". */
36   #if defined(FEAT_MZSCHEME) || defined(PROTO)
37   
38 - #include <assert.h>
39
40   /* Base data structures */
41   #define SCHEME_VIMBUFFERP(obj)  SAME_TYPE(SCHEME_TYPE(obj), mz_buffer_type)
42   #define SCHEME_VIMWINDOWP(obj)  SAME_TYPE(SCHEME_TYPE(obj), mz_window_type)
43 --- 31,36 ----
44 ***************
45 *** 559,575 ****
46       hMzSch = vimLoadLib(sch_dll);
47       hMzGC = vimLoadLib(gc_dll);
48   
49 !     if (!hMzSch)
50       {
51         if (verbose)
52 !           EMSG2(_(e_loadlib), sch_dll);
53         return FAIL;
54       }
55   
56 !     if (!hMzGC)
57       {
58         if (verbose)
59 !           EMSG2(_(e_loadlib), gc_dll);
60         return FAIL;
61       }
62   
63 --- 557,573 ----
64       hMzSch = vimLoadLib(sch_dll);
65       hMzGC = vimLoadLib(gc_dll);
66   
67 !     if (!hMzGC)
68       {
69         if (verbose)
70 !           EMSG2(_(e_loadlib), gc_dll);
71         return FAIL;
72       }
73   
74 !     if (!hMzSch)
75       {
76         if (verbose)
77 !           EMSG2(_(e_loadlib), sch_dll);
78         return FAIL;
79       }
80   
81 ***************
82 *** 798,862 ****
83   static __declspec(thread) void *tls_space;
84   #endif
85   
86 !     void
87 ! mzscheme_main(void)
88   {
89   #if MZSCHEME_VERSION_MAJOR >= 500 && defined(WIN32) && defined(USE_THREAD_LOCAL)
90       scheme_register_tls_space(&tls_space, 0);
91   #endif
92 ! #if defined(MZ_PRECISE_GC) && MZSCHEME_VERSION_MAJOR >= 400
93 !     /* use trampoline for precise GC in MzScheme >= 4.x */
94 !     scheme_main_setup(TRUE, mzscheme_env_main, 0, NULL);
95   #else
96 !     mzscheme_env_main(NULL, 0, NULL);
97   #endif
98   }
99   
100       static int
101 ! mzscheme_env_main(Scheme_Env *env, int argc UNUSED, char **argv UNUSED)
102   {
103 !     /* neither argument nor return values are used */
104 ! #ifdef MZ_PRECISE_GC
105 ! # if MZSCHEME_VERSION_MAJOR < 400
106 !     /*
107 !      * Starting from version 4.x, embedding applications must use
108 !      * scheme_main_setup/scheme_main_stack_setup trampolines
109 !      * rather than setting stack base directly with scheme_set_stack_base
110 !      */
111       Scheme_Object   *dummy = NULL;
112       MZ_GC_DECL_REG(1);
113       MZ_GC_VAR_IN_REG(0, dummy);
114   
115       stack_base = &__gc_var_stack__;
116   # else
117 -     /* environment has been created by us by Scheme */
118 -     environment = env;
119 - # endif
120 -     /*
121 -      * In 4.x, all activities must be performed inside trampoline
122 -      * so we are forced to initialise GC immediately
123 -      * This can be postponed in 3.x but I see no point in implementing
124 -      * a feature which will work in older versions only.
125 -      * One would better use conservative GC if he needs dynamic MzScheme
126 -      */
127 -     mzscheme_init();
128 - #else
129       int dummy = 0;
130       stack_base = (void *)&dummy;
131   #endif
132 !     main_loop(FALSE, FALSE);
133 ! #if defined(MZ_PRECISE_GC) && MZSCHEME_VERSION_MAJOR < 400
134       /* releasing dummy */
135       MZ_GC_REG();
136       MZ_GC_UNREG();
137   #endif
138 !     return 0;
139   }
140   
141       static void
142   startup_mzscheme(void)
143   {
144 ! #if !defined(MZ_PRECISE_GC) || MZSCHEME_VERSION_MAJOR < 400
145       scheme_set_stack_base(stack_base, 1);
146   #endif
147   
148 --- 796,863 ----
149   static __declspec(thread) void *tls_space;
150   #endif
151   
152 ! /*
153 !  * Since version 4.x precise GC requires trampolined startup.
154 !  * Futures and places in version 5.x need it too.
155 !  */
156 ! #if defined(MZ_PRECISE_GC) && MZSCHEME_VERSION_MAJOR >= 400 \
157 !     || MZSCHEME_VERSION_MAJOR >= 500 && (defined(MZ_USE_FUTURES) || defined(MZ_USE_PLACES))
158 ! # ifdef DYNAMIC_MZSCHEME
159 ! #  error Precise GC v.4+ or Racket with futures/places do not support dynamic MzScheme
160 ! # endif
161 ! # define TRAMPOLINED_MZVIM_STARTUP
162 ! #endif
163
164 !     int
165 ! mzscheme_main(int argc, char** argv)
166   {
167   #if MZSCHEME_VERSION_MAJOR >= 500 && defined(WIN32) && defined(USE_THREAD_LOCAL)
168       scheme_register_tls_space(&tls_space, 0);
169   #endif
170 ! #ifdef TRAMPOLINED_MZVIM_STARTUP
171 !     return scheme_main_setup(TRUE, mzscheme_env_main, argc, argv);
172   #else
173 !     return mzscheme_env_main(NULL, argc, argv);
174   #endif
175   }
176   
177       static int
178 ! mzscheme_env_main(Scheme_Env *env, int argc, char **argv)
179   {
180 !     int vim_main_result;
181 ! #ifdef TRAMPOLINED_MZVIM_STARTUP
182 !     /* Scheme has created the environment for us */
183 !     environment = env;
184 ! #else
185 ! # ifdef MZ_PRECISE_GC
186       Scheme_Object   *dummy = NULL;
187       MZ_GC_DECL_REG(1);
188       MZ_GC_VAR_IN_REG(0, dummy);
189   
190       stack_base = &__gc_var_stack__;
191   # else
192       int dummy = 0;
193       stack_base = (void *)&dummy;
194 + # endif
195   #endif
196
197 !     /* mzscheme_main is called as a trampoline from main.
198 !      * We trampoline into vim_main2
199 !      * Passing argc, argv through from mzscheme_main
200 !      */
201 !     vim_main_result = vim_main2(argc, argv);
202 ! #if !defined(TRAMPOLINED_MZVIM_STARTUP) && defined(MZ_PRECISE_GC)
203       /* releasing dummy */
204       MZ_GC_REG();
205       MZ_GC_UNREG();
206   #endif
207 !     return vim_main_result;
208   }
209   
210       static void
211   startup_mzscheme(void)
212   {
213 ! #ifndef TRAMPOLINED_MZVIM_STARTUP
214       scheme_set_stack_base(stack_base, 1);
215   #endif
216   
217 ***************
218 *** 868,874 ****
219       MZ_REGISTER_STATIC(exn_message);
220       MZ_REGISTER_STATIC(vim_exn);
221   
222 ! #if !defined(MZ_PRECISE_GC) || MZSCHEME_VERSION_MAJOR < 400
223       /* in newer versions of precise GC the initial env has been created */
224       environment = scheme_basic_env();
225   #endif
226 --- 869,875 ----
227       MZ_REGISTER_STATIC(exn_message);
228       MZ_REGISTER_STATIC(vim_exn);
229   
230 ! #ifndef TRAMPOLINED_MZVIM_STARTUP
231       /* in newer versions of precise GC the initial env has been created */
232       environment = scheme_basic_env();
233   #endif
234 ***************
235 *** 3013,3019 ****
236         MZ_GC_REG();
237   
238         tmp = scheme_make_struct_names(exn_name, scheme_null, 0, &nc);
239 -       assert(nc <= 5);
240         mch_memmove(exn_names, tmp, nc * sizeof(Scheme_Object *));
241         MZ_GC_CHECK();
242   
243 --- 3014,3019 ----
244 *** ../vim-7.3.440/src/main.c   2011-12-08 15:57:54.000000000 +0100
245 --- src/main.c  2012-02-12 01:49:50.000000000 +0100
246 ***************
247 *** 554,559 ****
248 --- 554,584 ----
249       debug_break_level = params.use_debug_break_level;
250   #endif
251   
252 + #ifdef FEAT_MZSCHEME
253 +     /*
254 +      * Newer version of MzScheme (Racket) require earlier (trampolined)
255 +      * initialisation via scheme_main_setup.
256 +      * Implement this by initialising it as early as possible
257 +      * and splitting off remaining Vim main into vim_main2
258 +      */
259 +     {
260 +       /* Pack up preprocessed command line arguments.
261 +        * It is safe because Scheme does not access argc/argv. */
262 +       char *args[2];
263 +       args[0] = (char *)fname;
264 +       args[1] = (char *)&params;
265 +       return mzscheme_main(2, args);
266 +     }
267 + }
268
269 + int vim_main2(int argc, char **argv)
270 + {
271 +     char_u    *fname = (char_u *)argv[0];
272 +     mparm_T   params;
273
274 +     memcpy(&params, argv[1], sizeof(params));
275 + #endif
276
277       /* Execute --cmd arguments. */
278       exe_pre_commands(&params);
279   
280 ***************
281 *** 957,970 ****
282   
283       /*
284        * Call the main command loop.  This never returns.
285 !      * For embedded MzScheme the main_loop will be called by Scheme
286 !      * for proper stack tracking
287 !      */
288 ! #ifndef FEAT_MZSCHEME
289       main_loop(FALSE, FALSE);
290 - #else
291 -     mzscheme_main();
292 - #endif
293   
294       return 0;
295   }
296 --- 982,989 ----
297   
298       /*
299        * Call the main command loop.  This never returns.
300 !     */
301       main_loop(FALSE, FALSE);
302   
303       return 0;
304   }
305 *** ../vim-7.3.440/src/proto/if_mzsch.pro       2010-08-15 21:57:28.000000000 +0200
306 --- src/proto/if_mzsch.pro      2012-02-12 01:50:57.000000000 +0100
307 ***************
308 *** 14,19 ****
309   void mzvim_reset_timer __ARGS((void));
310   void *mzvim_eval_string __ARGS((char_u *str));
311   int mzthreads_allowed __ARGS((void));
312 ! void mzscheme_main __ARGS((void));
313   void do_mzeval __ARGS((char_u *str, typval_T *rettv));
314   /* vim: set ft=c : */
315 --- 14,20 ----
316   void mzvim_reset_timer __ARGS((void));
317   void *mzvim_eval_string __ARGS((char_u *str));
318   int mzthreads_allowed __ARGS((void));
319 ! int mzscheme_main __ARGS((int argc, char **argv));
320   void do_mzeval __ARGS((char_u *str, typval_T *rettv));
321 + int vim_main2 __ARGS((int argc, char **argv));
322   /* vim: set ft=c : */
323 *** ../vim-7.3.440/src/version.c        2012-02-12 01:35:06.000000000 +0100
324 --- src/version.c       2012-02-12 01:54:14.000000000 +0100
325 ***************
326 *** 716,717 ****
327 --- 716,719 ----
328   {   /* Add new patch number below this line */
329 + /**/
330 +     441,
331   /**/
332
333 -- 
334 hundred-and-one symptoms of being an internet addict:
335 43. You tell the kids they can't use the computer because "Daddy's got work to
336     do" and you don't even have a job.
337
338  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
339 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
340 \\\  an exciting new programming language -- http://www.Zimbu.org        ///
341  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.051519 seconds and 3 git commands to generate.