mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
Restore signature of `scm_primitive_load_path ()' as found in 1.8.
The incompatibility was introduced by
0fb81f95b0
("add exception_on_error
optional arg to primitive-load-path").
* libguile/load.c (scm_primitive_load_path): Change to take 1 rest
argument. Interpret the argument as either a file name (C-level
backward compatibility with 1.8) or an actual argument list.
(scm_c_primitive_load_path): Update caller.
* libguile/load.h (scm_primitive_load_path): Update accordingly.
* doc/ref/api-evaluation.texi (Loading): Update documentation of
`primitive-load-path' and `scm_primitive_load_path ()'.
This commit is contained in:
parent
682d78d05e
commit
31ab99de56
3 changed files with 38 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
|||
@c -*-texinfo-*-
|
||||
@c This is part of the GNU Guile Reference Manual.
|
||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
|
||||
@c Free Software Foundation, Inc.
|
||||
@c See the file guile.texi for copying conditions.
|
||||
|
||||
|
@ -538,13 +538,20 @@ documentation for @code{%load-hook} later in this section.
|
|||
@code{SCM}.
|
||||
@end deftypefn
|
||||
|
||||
@deffn {Scheme Procedure} primitive-load-path filename
|
||||
@deffn {Scheme Procedure} primitive-load-path filename [exception-on-not-found]
|
||||
@deffnx {C Function} scm_primitive_load_path (filename)
|
||||
Search @code{%load-path} for the file named @var{filename} and
|
||||
load it into the top-level environment. If @var{filename} is a
|
||||
relative pathname and is not found in the list of search paths,
|
||||
an error is signalled. Preferentially loads a compiled version of the
|
||||
file, if it is available and up-to-date.
|
||||
|
||||
By default or if @var{exception-on-not-found} is true, an exception is
|
||||
raised if @var{filename} is not found. If @var{exception-on-not-found}
|
||||
is @code{#f} and @var{filename} is not found, no exception is raised and
|
||||
@code{#f} is returned. For compatibility with Guile 1.8 and earlier,
|
||||
the C function takes only one argument, which can be either a string
|
||||
(the file name) or an argument list.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} %search-load-path filename
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue