#define FUNC_NAME s_scm_primitive_load
{
SCM hook = *scm_loc_load_hook;
+ char *encoding;
SCM_VALIDATE_STRING (1, filename);
if (scm_is_true (hook) && scm_is_false (scm_procedure_p (hook)))
SCM_MISC_ERROR ("value of %load-hook is neither a procedure nor #f",
SCM port = scm_open_file (filename, scm_from_locale_string ("r"));
scm_dynwind_begin (SCM_F_DYNWIND_REWINDABLE);
scm_i_dynwind_current_load_port (port);
-
+ encoding = scm_scan_for_encoding (port);
+ if (encoding)
+ {
+ scm_i_set_port_encoding_x (port, encoding);
+ free (encoding);
+ }
+ else
+ /* The file has no encoding declaraed. We'll presume Latin-1. */
+ scm_i_set_port_encoding_x (port, NULL);
while (1)
{
SCM reader, form;
"guile/ccache/" SCM_EFFECTIVE_VERSION "-" SCM_OBJCODE_MACHINE_VERSION_STRING
if ((e = getenv ("XDG_CACHE_HOME")))
- snprintf (cachedir, sizeof(cachedir), "%s" FALLBACK_DIR, e);
+ snprintf (cachedir, sizeof(cachedir), "%s/" FALLBACK_DIR, e);
else if ((e = getenv ("HOME")))
snprintf (cachedir, sizeof(cachedir), "%s/.cache/" FALLBACK_DIR, e);
#ifdef HAVE_GETPWENT
return SCM_BOOL_F;
}
-static SCM
-scm_try_autocompile (SCM source)
+SCM_DEFINE (scm_sys_warn_autocompilation_enabled, "%warn-autocompilation-enabled", 0, 0, 0,
+ (void), "")
+#define FUNC_NAME s_scm_sys_warn_autocompilation_enabled
{
static int message_shown = 0;
-
- if (scm_is_false (*scm_loc_load_should_autocompile))
- return SCM_BOOL_F;
if (!message_shown)
{
message_shown = 1;
}
+ return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
+
+static SCM
+scm_try_autocompile (SCM source)
+{
+ if (scm_is_false (*scm_loc_load_should_autocompile))
+ return SCM_BOOL_F;
+
+ scm_sys_warn_autocompilation_enabled ();
return scm_c_catch (SCM_BOOL_T,
do_try_autocompile,
SCM2PTR (source),