Google hasn't embedded this in plaintext :-(
Here's the patch in a legible format:
diff -r 409691084d19 src/if_mzsch.c
--- a/src/if_mzsch.c Tue Oct 04 21:22:44 2011 +0200
+++ b/src/if_mzsch.c Wed Oct 05 11:28:38 2011 +0100
@@ -798,22 +798,22 @@
static __declspec(thread) void *tls_space;
#endif
- void
-mzscheme_main(void)
+ int
+mzscheme_main(int argc, char** argv)
{
#if MZSCHEME_VERSION_MAJOR >= 500 && defined(WIN32) &&
defined(USE_THREAD_LOCAL)
scheme_register_tls_space(&tls_space, 0);
#endif
#if defined(MZ_PRECISE_GC) && MZSCHEME_VERSION_MAJOR >= 400
/* use trampoline for precise GC in MzScheme >= 4.x */
- scheme_main_setup(TRUE, mzscheme_env_main, 0, NULL);
+ scheme_main_setup(TRUE, mzscheme_env_main, argc, argv);
#else
- mzscheme_env_main(NULL, 0, NULL);
+ return mzscheme_env_main(NULL, argc, argv);
#endif
}
static int
-mzscheme_env_main(Scheme_Env *env, int argc UNUSED, char **argv UNUSED)
+mzscheme_env_main(Scheme_Env *env, int argc, char **argv)
{
/* neither argument nor return values are used */
#ifdef MZ_PRECISE_GC
@@ -844,13 +844,19 @@
int dummy = 0;
stack_base = (void *)&dummy;
#endif
- main_loop(FALSE, FALSE);
+ /* mzscheme_main is called as a (semi-) trampoline from main.
+ * We trampoline back into main -- to avoid a complete refacator.
+ * Passing argc, argv through from mzscheme_main
+ * */
+ {
+ int main_rv = main(argc, argv);
#if defined(MZ_PRECISE_GC) && MZSCHEME_VERSION_MAJOR < 400
- /* releasing dummy */
- MZ_GC_REG();
- MZ_GC_UNREG();
+ /* releasing dummy */
+ MZ_GC_REG();
+ MZ_GC_UNREG();
#endif
- return 0;
+ return main_rv;
+ }
}
static void
diff -r 409691084d19 src/main.c
--- a/src/main.c Tue Oct 04 21:22:44 2011 +0200
+++ b/src/main.c Wed Oct 05 11:28:38 2011 +0100
@@ -172,6 +172,24 @@
int i;
#endif
+#ifdef FEAT_MZSCHEME
+ {
+ static int mzscheme_trampolined = 0;
+ /* TODO: I don't want to change the storage class of fname and params
+ * to static. fname is required after the trampoline (i.e. outside this
+ * block, and in the recursive call to main()). In the section:
+ * "Recovery mode without a file name"
+ *
+ * params is used quite frequently both inside and outside of this
+ * block.
+ * */
+ static char_u *save_mz_fname = NULL;
+ static mparm_T save_mz_params;
+ if(!mzscheme_trampolined) /* first time in */
+ {
+ mzscheme_trampolined = 1; /* there won't be a second time in! */
+#endif
+
/*
* Do any system-specific initialisations. These can NOT use IObuff or
* NameBuff. Thus emsg2() cannot be called!
@@ -554,6 +572,25 @@
debug_break_level = params.use_debug_break_level;
#endif
+#ifdef FEAT_MZSCHEME
+ /* save params and fname for when we bouce back from the trampoline */
+ save_mz_fname = fname;
+ save_mz_params = params;
+ /*
+ * For embedded MzScheme the main_loop will be called by Scheme
+ * for proper stack tracking
+ *
+ * mzscheme_main calls main, which then calls main_loop which never
+ * returns. So the return here is a little redundant.
+ */
+ return mzscheme_main(argc, argv);
+ } /* this ends the if!(mzscheme_trampolined) above */
+ /* restore params and fname for when we bouce back from the trampoline */
+ fname = save_mz_fname;
+ params = save_mz_params;
+ }
+#endif
+
/* Execute --cmd arguments. */
exe_pre_commands(¶ms);
@@ -957,14 +994,8 @@
/*
* Call the main command loop. This never returns.
- * For embedded MzScheme the main_loop will be called by Scheme
- * for proper stack tracking
- */
-#ifndef FEAT_MZSCHEME
+ */
main_loop(FALSE, FALSE);
-#else
- mzscheme_main();
-#endif
return 0;
}
diff -r 409691084d19 src/proto/if_mzsch.pro
--- a/src/proto/if_mzsch.pro Tue Oct 04 21:22:44 2011 +0200
+++ b/src/proto/if_mzsch.pro Wed Oct 05 11:28:38 2011 +0100
@@ -14,6 +14,6 @@
void mzvim_reset_timer __ARGS((void));
void *mzvim_eval_string __ARGS((char_u *str));
int mzthreads_allowed __ARGS((void));
-void mzscheme_main __ARGS((void));
+int mzscheme_main __ARGS((int argc, char** argv));
void do_mzeval __ARGS((char_u *str, typval_T *rettv));
/* vim: set ft=c : */
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php