home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.3 / 7.3.441 < prev    next >
Encoding:
Internet Message Format  |  2012-11-20  |  9.4 KB

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