summaryrefslogtreecommitdiff
path: root/libguile
diff options
context:
space:
mode:
Diffstat (limited to 'libguile')
-rw-r--r--libguile/load.c31
-rw-r--r--libguile/load.h4
2 files changed, 29 insertions, 6 deletions
diff --git a/libguile/load.c b/libguile/load.c
index 10cbdb255..50af25643 100644
--- a/libguile/load.c
+++ b/libguile/load.c
@@ -685,8 +685,8 @@ scm_try_autocompile (SCM source)
NULL, NULL);
}
-SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 1, 1, 0,
- (SCM filename, SCM exception_on_not_found),
+SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 0, 0, 1,
+ (SCM args),
"Search @var{%load-path} for the file named @var{filename} and\n"
"load it into the top-level environment. If @var{filename} is a\n"
"relative pathname and is not found in the list of search paths,\n"
@@ -695,9 +695,33 @@ SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 1, 1, 0,
"@code{#f} is returned instead.")
#define FUNC_NAME s_scm_primitive_load_path
{
+ SCM filename, exception_on_not_found;
SCM full_filename, compiled_filename;
int compiled_is_fallback = 0;
+ if (scm_is_string (args))
+ {
+ /* C code written for 1.8 and earlier expects this function to take a
+ single argument (the file name). */
+ filename = args;
+ exception_on_not_found = SCM_UNDEFINED;
+ }
+ else
+ {
+ /* Starting from 1.9, this function takes 1 required and 1 optional
+ argument. */
+ long len;
+
+ SCM_VALIDATE_LIST_COPYLEN (SCM_ARG1, args, len);
+ if (len < 1 || len > 2)
+ scm_error_num_args_subr (FUNC_NAME);
+
+ filename = SCM_CAR (args);
+ SCM_VALIDATE_STRING (SCM_ARG1, filename);
+
+ exception_on_not_found = len > 1 ? SCM_CADR (args) : SCM_UNDEFINED;
+ }
+
if (SCM_UNBNDP (exception_on_not_found))
exception_on_not_found = SCM_BOOL_T;
@@ -775,8 +799,7 @@ SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 1, 1, 0,
SCM
scm_c_primitive_load_path (const char *filename)
{
- return scm_primitive_load_path (scm_from_locale_string (filename),
- SCM_BOOL_T);
+ return scm_primitive_load_path (scm_from_locale_string (filename));
}
diff --git a/libguile/load.h b/libguile/load.h
index 1a1a86528..cf825fc0f 100644
--- a/libguile/load.h
+++ b/libguile/load.h
@@ -3,7 +3,7 @@
#ifndef SCM_LOAD_H
#define SCM_LOAD_H
-/* Copyright (C) 1995,1996,1998,2000,2001, 2006, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,2000,2001, 2006, 2008, 2009 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -34,7 +34,7 @@ SCM_API SCM scm_sys_library_dir (void);
SCM_API SCM scm_sys_site_dir (void);
SCM_API SCM scm_search_path (SCM path, SCM filename, SCM exts, SCM require_exts);
SCM_API SCM scm_sys_search_load_path (SCM filename);
-SCM_API SCM scm_primitive_load_path (SCM filename, SCM exception_on_not_found);
+SCM_API SCM scm_primitive_load_path (SCM filename_and_exception_on_not_found);
SCM_API SCM scm_c_primitive_load_path (const char *filename);
SCM_INTERNAL SCM scm_sys_warn_autocompilation_enabled (void);
SCM_INTERNAL void scm_init_load_path (void);