mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-16 16:50:21 +02:00
correctly handle --no-autocompile (fixed broken previous patch)
* libguile/load.c (scm_init_load): Initialize %load-should-autocompile to false. * libguile/init.c (scm_i_init_guile): * libguile/load.h: * libguile/load.c (scm_init_load_should_autocompile): At the end of init, check GUILE_AUTO_COMPILE. * libguile/script.c (scm_compile_shell_switches): Instead of making --autocompile / --no-autocompile render into the s-expression, just handle them immediately, so that --no-autocompile takes effect for the expander.
This commit is contained in:
parent
2533f10b40
commit
6128f34c4b
4 changed files with 19 additions and 24 deletions
|
@ -586,6 +586,7 @@ scm_i_init_guile (SCM_STACKITEM *base)
|
||||||
|
|
||||||
atexit (cleanup_for_exit);
|
atexit (cleanup_for_exit);
|
||||||
scm_load_startup_files ();
|
scm_load_startup_files ();
|
||||||
|
scm_init_load_should_autocompile ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -901,13 +901,9 @@ scm_init_load ()
|
||||||
|
|
||||||
scm_loc_compile_fallback_path
|
scm_loc_compile_fallback_path
|
||||||
= SCM_VARIABLE_LOC (scm_c_define ("%compile-fallback-path", SCM_BOOL_F));
|
= SCM_VARIABLE_LOC (scm_c_define ("%compile-fallback-path", SCM_BOOL_F));
|
||||||
|
scm_loc_load_should_autocompile
|
||||||
|
= SCM_VARIABLE_LOC (scm_c_define ("%load-should-autocompile", SCM_BOOL_F));
|
||||||
|
|
||||||
{
|
|
||||||
SCM autocomp = scm_from_bool (scm_getenv_int ("GUILE_AUTO_COMPILE", 1));
|
|
||||||
scm_loc_load_should_autocompile
|
|
||||||
= SCM_VARIABLE_LOC (scm_c_define ("%load-should-autocompile", autocomp));
|
|
||||||
}
|
|
||||||
|
|
||||||
the_reader = scm_make_fluid ();
|
the_reader = scm_make_fluid ();
|
||||||
scm_fluid_set_x (the_reader, SCM_BOOL_F);
|
scm_fluid_set_x (the_reader, SCM_BOOL_F);
|
||||||
scm_c_define("current-reader", the_reader);
|
scm_c_define("current-reader", the_reader);
|
||||||
|
@ -921,6 +917,15 @@ scm_init_load ()
|
||||||
#include "libguile/load.x"
|
#include "libguile/load.x"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
scm_init_load_should_autocompile ()
|
||||||
|
{
|
||||||
|
*scm_loc_load_should_autocompile =
|
||||||
|
scm_from_bool (scm_getenv_int ("GUILE_AUTO_COMPILE", 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Local Variables:
|
Local Variables:
|
||||||
c-file-style: "gnu"
|
c-file-style: "gnu"
|
||||||
|
|
|
@ -39,6 +39,7 @@ SCM_API SCM scm_c_primitive_load_path (const char *filename);
|
||||||
SCM_INTERNAL SCM scm_sys_warn_autocompilation_enabled (void);
|
SCM_INTERNAL SCM scm_sys_warn_autocompilation_enabled (void);
|
||||||
SCM_INTERNAL void scm_init_load_path (void);
|
SCM_INTERNAL void scm_init_load_path (void);
|
||||||
SCM_INTERNAL void scm_init_load (void);
|
SCM_INTERNAL void scm_init_load (void);
|
||||||
|
SCM_INTERNAL void scm_init_load_should_autocompile (void);
|
||||||
SCM_INTERNAL void scm_init_eval_in_scheme (void);
|
SCM_INTERNAL void scm_init_eval_in_scheme (void);
|
||||||
|
|
||||||
#endif /* SCM_LOAD_H */
|
#endif /* SCM_LOAD_H */
|
||||||
|
|
|
@ -457,8 +457,6 @@ scm_compile_shell_switches (int argc, char **argv)
|
||||||
int use_emacs_interface = 0;
|
int use_emacs_interface = 0;
|
||||||
int turn_on_debugging = 0;
|
int turn_on_debugging = 0;
|
||||||
int dont_turn_on_debugging = 0;
|
int dont_turn_on_debugging = 0;
|
||||||
int turn_on_autocompile = 0;
|
|
||||||
int dont_turn_on_autocompile = 0;
|
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
char *argv0 = guile;
|
char *argv0 = guile;
|
||||||
|
@ -595,17 +593,15 @@ scm_compile_shell_switches (int argc, char **argv)
|
||||||
turn_on_debugging = 0;
|
turn_on_debugging = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Do autocompile on/off now, because the form itself might need this
|
||||||
|
decision. */
|
||||||
else if (! strcmp (argv[i], "--autocompile"))
|
else if (! strcmp (argv[i], "--autocompile"))
|
||||||
{
|
scm_variable_set_x (scm_c_lookup ("%load-should-autocompile"),
|
||||||
turn_on_autocompile = 1;
|
SCM_BOOL_T);
|
||||||
dont_turn_on_autocompile = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (! strcmp (argv[i], "--no-autocompile"))
|
else if (! strcmp (argv[i], "--no-autocompile"))
|
||||||
{
|
scm_variable_set_x (scm_c_lookup ("%load-should-autocompile"),
|
||||||
dont_turn_on_autocompile = 1;
|
SCM_BOOL_F);
|
||||||
turn_on_autocompile = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (! strcmp (argv[i], "--emacs")) /* use emacs protocol */
|
else if (! strcmp (argv[i], "--emacs")) /* use emacs protocol */
|
||||||
use_emacs_interface = 1;
|
use_emacs_interface = 1;
|
||||||
|
@ -720,14 +716,6 @@ scm_compile_shell_switches (int argc, char **argv)
|
||||||
tail = scm_cons (scm_cons (sym_load_user_init, SCM_EOL), tail);
|
tail = scm_cons (scm_cons (sym_load_user_init, SCM_EOL), tail);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we are given an autocompilation arg, set %load-should-autocompile. */
|
|
||||||
if (turn_on_autocompile || dont_turn_on_autocompile)
|
|
||||||
{
|
|
||||||
tail = scm_cons (scm_list_3 (sym_set_x, sym_sys_load_should_autocompile,
|
|
||||||
scm_from_bool (turn_on_autocompile)),
|
|
||||||
tail);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If debugging was requested, or we are interactive and debugging
|
/* If debugging was requested, or we are interactive and debugging
|
||||||
was not explicitly turned off, turn on debugging. */
|
was not explicitly turned off, turn on debugging. */
|
||||||
if (turn_on_debugging || (interactive && !dont_turn_on_debugging))
|
if (turn_on_debugging || (interactive && !dont_turn_on_debugging))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue