summaryrefslogtreecommitdiff
path: root/libguile/load.c
AgeCommit message (Collapse)AuthorFilesLines
2014-01-09Merge branch 'stable-2.0'Mark H Weaver1-10/+5
Conflicts: module/system/vm/traps.scm test-suite/tests/peval.test
2014-01-08scm_primitive_load: Simplify code using 'scm_open_file_with_encoding'.Mark H Weaver1-10/+5
* libguile/load.c (scm_primitive_load): Use 'scm_open_file_with_encoding'.
2013-11-28Remove private-gc.hAndy Wingo1-1/+0
* libguile/simpos.c (scm_getenv_int): Move here, from gc.c. * libguile/private-gc.h: Remove, unused. * libguile/simpos.h: Move scm_getenv_int declaration here. * libguile/vm.c: * libguile/gc.c: Adapt scm_getenv_int users. * libguile/gc-malloc.c: * libguile/load.c: * libguile/script.c: Remove private-gc includes from non-users of scm_getenv_int. * libguile/Makefile.am: Adapt.
2013-03-28Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver1-32/+95
Conflicts: configure.ac libguile/deprecated.c libguile/deprecated.h libguile/filesys.h libguile/fluids.c libguile/fports.c libguile/gc.c libguile/guile.c libguile/numbers.c libguile/objcodes.c libguile/r6rs-ports.c libguile/smob.c libguile/socket.c libguile/threads.h module/language/scheme/decompile-tree-il.scm module/language/tree-il/peval.scm test-suite/tests/syncase.test
2013-03-10add %site-ccache-dirJason Earl1-0/+13
* libguile/load.h: * libguile/load.c (scm_sys_site_ccache_dir): New procedure. * doc/ref/scheme-using.texi (Installing Site Packages): * doc/ref/api-options.texi (Build Config): Add docs. Fixes bug 10326.
2013-03-07fix compilation under mingwAndy Wingo1-7/+9
* libguile/load.c (is_absolute_file_name, search_path): Fix compilation under mingw.
2013-03-07Use `scm_is_eq' in load.c.Ludovic Courtès1-2/+2
* libguile/load.c (is_file_name_separator): Use `scm_is_eq' instead of `=='.
2013-02-24load.c uses same logic as boot-9 for file namesAndy Wingo1-32/+80
* libguile/load.c (is_file_name_separator, is_drive_letter): (is_absolute_file_name): New helpers, like the ones in boot-9. Perhaps we should just define them in C. (search_path, scm_try_auto_compile, canonical_suffix): Rewrite using the new helpers.
2013-01-30Revert "detect and consume byte-order marks for textual ports"Andy Wingo1-3/+0
This reverts commit b2cb557d75e4daf8c7c8cd43313f4cc51d9a3f1b, which was pushed accidentally.
2013-01-30detect and consume byte-order marks for textual portsAndy Wingo1-0/+3
* libguile/ports.h: * libguile/ports.c (scm_consume_byte_order_mark): New procedure. * libguile/fports.c (scm_open_file): Call consume-byte-order-mark if we are opening a file in "r" mode. * libguile/read.c (scm_i_scan_for_encoding): Don't do anything about byte-order marks. * libguile/load.c (scm_primitive_load): Add a note about the duplicate encoding scan. * test-suite/tests/filesys.test: Add tests for UTF-8, UTF-16BE, and UTF-16LE BOM handling.
2013-01-23merge stable-2.0Andy Wingo1-9/+13
There are some bugs with command-line handling that will be sorted out with the next commit.
2013-01-21fix try-module-autoload, which did not detect failure to find the fileAndy Wingo1-9/+13
* libguile/load.c (scm_primitive_load_path): If the second argument is a procedure, call it like a thunk. * doc/ref/api-evaluation.texi (Load Paths): Update docs. * module/ice-9/boot-9.scm (resolve-interface): Use `unless'. (try-module-autoload): Use the new primitive-load-path to detect failure to find an appropriate file. Fixes a bug reported by Diogo F. S. Ramos. Thanks to Noah Lavine for tracking it down.
2013-01-07Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver1-2/+33
Conflicts: GUILE-VERSION libguile/posix.c module/ice-9/eval.scm test-suite/tests/cse.test
2012-11-28Add parse-path-with-ellipsis, and use it for GUILE_LOAD_PATH et al.Mark H Weaver1-2/+33
* libguile/load.c (scm_ellipsis): New Variable. (scm_parse_path_with_ellipsis): New procedure. (scm_init_load): Initialize 'scm_ellipsis'. (scm_init_load_path): Use 'scm_parse_path_with_ellipsis' to handle GUILE_LOAD_PATH and GUILE_LOAD_COMPILED_PATH. * libguile/load.h (scm_parse_path_with_ellipsis): Add prototype. * doc/ref/guile-invoke.texi (Environment Variables): doc/ref/api-evaluation.texi (Load Paths): Add documentation. Correct description of default load path to reflect reality. Remove 'GUILE_LOAD_PATH' from the concept index; it is already in the variable index. Add cross references between these two sections of the manual.
2012-02-08Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-14/+14
Conflicts: GUILE-VERSION libguile/gc-malloc.c libguile/ports.c
2012-02-02Improve the usage of variable names in C docstrings.Bake Timmons1-2/+2
* libguile/alist.c: * libguile/array-map.c: * libguile/arrays.c: * libguile/bitvectors.c: * libguile/filesys.c: * libguile/foreign.c: * libguile/generalized-arrays.c: * libguile/hashtab.c: * libguile/ioext.c: * libguile/load.c: * libguile/numbers.c: * libguile/ports.c: * libguile/posix.c: * libguile/print.c: * libguile/procprop.c: * libguile/promises.c: * libguile/simpos.c: * libguile/socket.c: * libguile/srfi-1.c: * libguile/srfi-13.c: * libguile/srfi-14.c: * libguile/stacks.c: * libguile/stime.c: * libguile/strings.c: * libguile/struct.c: * libguile/symbols.c: * libguile/threads.c: * libguile/weak-table.c: * libguile/weak-vector.c: Make the variable names in the C docstrings more consistent. Replace a few instances of @var with @code when appropriate.
2012-02-01Fix search_path to fill stat_buf when given an absolute pathnameMark H Weaver1-12/+12
* libguile/load.c (search_path): When the provided 'filename' is an absolute pathname, perform a 'stat' on that pathname to fill the 'stat_buf'. Previously, 'stat_buf' was left uninitialized in this case, even though 'scm_primitive_load_path' assumes that 'stat_buf' will be filled. Update the header comment to explicitly specify that 'stat_buf' will be filled. Also 'goto end' in a few failure cases instead of replicating its code.
2012-01-10Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-4/+8
Conflicts: libguile/__scm.h libguile/array-map.c libguile/procprop.c libguile/tags.h module/ice-9/deprecated.scm module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm test-suite/standalone/test-num2integral.c test-suite/tests/regexp.test
2012-01-09primitive-load returns the value(s) of the last expressionAndy Wingo1-4/+8
* libguile/load.c (scm_primitive_load): Return the values yielded from evaluating the last expression in the file. * test-suite/tests/load.test ("return value of `load'"): Add tests.
2011-12-06Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-10/+10
Conflicts: libguile/deprecation.c libguile/load.c libguile/print.c
2011-12-05warnings written to warning portAndy Wingo1-10/+10
* libguile/deprecation.c (scm_c_issue_deprecation_warning): * libguile/load.c (auto_compile_catch_handler): (scm_sys_warn_auto_compilation_enabled, scm_primitive_load_path): * module/ice-9/boot-9.scm (warn, %load-announce, duplicate-handlers) (load-in-vicinity): * module/system/base/message.scm (warning): Write to the warning port. (*current-warning-port*): Alias the warning port.
2011-12-01Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-2/+1
Conflicts: configure.ac libguile/fluids.c libguile/gc.c libguile/gc.h libguile/objcodes.c libguile/procprop.c libguile/vm.c module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm
2011-11-23use new scm_make_fluid_with_defaultAndy Wingo1-2/+1
* libguile/load.c (scm_init_load): * libguile/ports.c (scm_init_ports): * libguile/read.c (scm_init_read): Use scm_make_fluid_with_default.
2011-11-08locking for putc, putsAndy Wingo1-12/+12
* libguile/ports.c (scm_putc, scm_puts): * libguile/ports.h (scm_putc_unlocked, scm_puts_unlocked): Separate into _unlocked and locked variants. Change all callers to use the _unlocked versions.
2011-10-25most uses of scm_from_locale_symbol become scm_from_utf8_symbolAndy Wingo1-1/+1
* libguile/array-handle.c: * libguile/chars.c: * libguile/expand.c: * libguile/feature.c: * libguile/goops.c: * libguile/gsubr.c: * libguile/instructions.c: * libguile/load.c: * libguile/macros.c: * libguile/memoize.c: * libguile/modules.c: * libguile/options.c: * libguile/print.c: * libguile/smob.c: * libguile/snarf.h: Change most uses of scm_from_locale_symbol to scm_from_utf8_symbol, as the symbols really are not locale-dependent.
2011-10-24add SCM_{PACK,UNPACK}_POINTERAndy Wingo1-4/+4
* libguile/tags.h (SCM_UNPACK_POINTER, SCM_PACK_POINTER): New macros. The old SCM2PTR and PTR2SCM were defined in such a way that round-tripping through a pointer could lose precision, even in the case in which you weren't interested in actually dereferencing the pointer, it was simply that you needed to plumb a SCM through APIs that take pointers. These new macros are more like SCM_PACK and SCM_UNPACK, but for pointer types. The bit representation of the pointer should be the same as the scm_t_bits representation. * libguile/gc.h (PTR2SCM, SCM2PTR): Remove support for (old) UNICOS pointers. We are going to try tagging the SCM object itself in the future, and I don't think that keeping this support is worth its cost. It probably doesn't work anyway. * libguile/backtrace.c: * libguile/bytevectors.c: * libguile/continuations.c: * libguile/fluids.c: * libguile/foreign.c: * libguile/gc.h: * libguile/guardians.c: * libguile/hashtab.c: * libguile/load.c: * libguile/numbers.c: * libguile/ports.c: * libguile/smob.c: * libguile/strings.c: * libguile/symbols.c: * libguile/vm.c: * libguile/weak-set.c: * libguile/weak-table.c: * libguile/weak-vector.c: Update many sites to use the new macros.
2011-08-03avoid duplicate stats when searching for files in a pathAndy Wingo1-112/+127
* libguile/load.c (search_path): Extract from scm_search_path, to give the caller the stat buffer of the found path. (scm_search_path, scm_sys_search_load_path): Adapt accordingly. (compiled_is_fresh): Take the stat buffers directly. (scm_primitive_load_path, scm_init_eval_in_scheme): Adapt to search_path / compiled_is_fresh changes to avoid duplicate states in search-path.
2011-08-03fix unnecessary call to canonicalize_path in load-path fast caseAndy Wingo1-6/+8
* libguile/load.c (scm_primitive_load_path): Don't canonicalize the filename unless we need to look in the fallback path. Fixes a stat explosion; see http://savannah.gnu.org/bugs/?33815.
2011-07-21add a site dir to %load-compiled-pathAndy Wingo1-1/+4
* libguile/Makefile.am (libpath.h): Define SCM_SITE_CCACHE_DIR. Defined as site-ccache/ instead of site/ccache/ to indicate that we don't expect further subdirectories, and also to avoid confusion about whether extensions/ is a site-specific or not. * libguile/load.c (scm_init_load_path): Add SCM_SITE_CCACHE_DIR to the default load-compiled path.
2011-06-30fix generation of auto-compiled file names on mingw systemsAndy Wingo1-2/+18
* libguile/load.c (canonical_to_suffix, scm_primitive_load_path): * module/ice-9/boot-9.scm (load-in-vicinity): * module/system/base/compile.scm (compiled-file-name): If the canonical path of a file is a DOS-style path with a drive letter, turn it into a path suffix it by removing the colon and prefixing a "/". Inspired by a patch from Jan Nieuwenhuizen.
2011-06-30%load-hook not just for primitive-loadAndy Wingo1-0/+9
* libguile/load.c (scm_primitive_load_path): * module/ice-9/boot-9.scm (load-in-vicinity): Call %load-hook as needed.
2011-06-17better messages on failed autocompilationAndy Wingo1-5/+18
* libguile/load.c (auto_compile_catch_handler): * module/ice-9/boot-9.scm (load-in-vicinity): Nicer messages when autocompilation fails.
2011-06-17mingw: use $APPDATA as a possible root for cachedir.Jan Nieuwenhuizen1-0/+6
* libguile/load.c (scm_init_load_path) [MINGW32]: Fall back to using $LOCALAPPDATA or $APPDATA if $XDG_CACHE_HOME and $HOME aren't set.
2011-05-13scm_is_false instead of == SCM_BOOL_F; also is_null, is_true, etcAndy Wingo1-1/+1
* libguile/deprecation.c (scm_issue_deprecation_warning) * libguile/eval.c (CAPTURE_ENV): * libguile/goops.c (make_dispatch_procedure, make_class_from_symbol): (create_smob_classes): * libguile/guardians.c (finalize_guarded, scm_i_get_one_zombie): * libguile/hashtab.c (scm_fixup_weak_alist, scm_internal_hash_fold): * libguile/i18n.c (scm_nl_langinfo) * libguile/load.c (scm_primitive_load) * libguile/posix.c (scm_setrlimit) * libguile/socket.c (scm_to_sockaddr): * libguile/srcprop.c (scm_make_srcprops): Use scm_is_false / scm_is_true / scm_is_null instead of comparing against SCM_BOOL_F et al.
2011-04-15add --fresh-auto-compileAndy Wingo1-2/+25
* doc/ref/api-evaluation.texi (Compilation): Add discussion of --fresh-auto-compile. * doc/ref/scheme-scripts.texi (Invoking Guile): Add --fresh-auto-compile option. * NEWS: Add entry. * libguile/load.c: Define %fresh-auto-compile. (scm_primitive_load_path): Use it here. (scm_init_load_should_auto_compile): Init from GUILE_AUTO_COMPILE env var, with a value of "fresh". * module/ice-9/boot-9.scm (load-in-vicinity): Auto-compilation cache is stale if %fresh-auto-compile is true. * module/ice-9/command-line.scm (compile-shell-switches): Parse out --fresh-auto-compile.
2011-04-14add packager info to %build-infoAndy Wingo1-0/+15
* libguile/load.c (init_build_info): Add packager, packager-version, and packager-bug-reports to %build-info, if they are available.
2011-02-13Add `%auto-compilation-options', used by `compile-file' when auto-compiling.Ludovic Courtès1-4/+24
* module/ice-9/boot-9.scm (%auto-compilation-options): New variable. (load-in-vicinity): Honor it. * libguile/load.c (kw_opts, sym_compile_file, sym_auto_compilation_options): New variables. (do_try_auto_compile): Honor %AUTO-COMPILATION-OPTIONS. * module/system/repl/common.scm (repl-default-options): Have `compile-options' default to %AUTO-COMPILATION-OPTIONS.
2011-02-13primitive-load defaults to utf-8, not latin-1Andy Wingo1-2/+3
* libguile/load.c (scm_primitive_load): Default to utf-8.
2011-02-13autocompile -> auto-compileAndy Wingo1-19/+19
* NEWS: * check-guile.in: * doc/guile.1: * doc/ref/scheme-scripts.texi: * libguile/init.c: * libguile/load.c: * libguile/load.h: * libguile/script.c: * module/Makefile.am: * module/ice-9/boot-9.scm: * module/scripts/compile.scm: * module/system/base/compile.scm: * test-suite/Makefile.am: * test-suite/tests/popen.test: Change "autocompile" to "auto-compile" or "auto_compile", as appropriate, in variable names, function names, command line arguments, and the documentation.
2011-01-07use scm_from_latin1_symboln for string literals and load-symbolAndy Wingo1-2/+2
* libguile/bytevectors.c: * libguile/eval.c: * libguile/goops.c: * libguile/i18n.c: * libguile/load.c: * libguile/memoize.c: * libguile/modules.c: * libguile/ports.c: * libguile/print.c: * libguile/procs.c: * libguile/programs.c: * libguile/read.c: * libguile/script.c: * libguile/srfi-14.c: * libguile/stacks.c: * libguile/strings.c: * libguile/throw.c: * libguile/vm.c: Use scm_from_latin1_symboln to make symbols from string literals, because they aren't in the user's locale -- they are in ASCII, and we can optimize this case. * libguile/vm-i-loader.c: Also use scm_from_latin1_symboln when loading narrow symbols.
2010-09-04Don't say "source file is newer" when either file is inaccessible.Ludovic Courtès1-10/+13
* libguile/load.c (compiled_is_fresh): Don't emit "source file is newer" warning when either FULL_FILENAME or COMPILED_FILENAME could not be stat'd. This is consistent with what load/compiled-file-name do.
2010-09-04Compare source/compiled file timestamps with nano-second resolution.Ludovic Courtès1-7/+20
* libguile/load.c (compiled_is_fresh): Rename `res' to `compiled_is_newer'. Use `get_stat_mtime' to compare with nano-second resolution when available. * module/ice-9/boot-9.scm (load)[fresh-compiled-file-name]: Likewise, using `stat:mtimensec'.
2010-08-06%site-dir is specific to the effective versionAndy Wingo1-3/+17
* libguile/load.h: * libguile/load.c (scm_sys_global_site_dir): New API, is what %site-dir used to be. (scm_sys_site_dir): Changed to be a version-specific dir. (scm_init_load_path): Search the version-specific sitedir before the global one. * libguile/Makefile.am (libpath.h): Update SCM_SITE_DIR and SCM_GLOBAL_SITE_DIR, as appropriate.
2010-07-26Check for go/scm mtime ordering rather than equality.Ludovic Courtès1-2/+2
* am/guilec (install-data-hook): Remove. (guile_install_go_files): New variable. ($(guile_install_go_files)): New dependency. * libguile/load.c (compiled_is_fresh): Check for ordering of STAT_SOURCE and STAT_COMPILED, not equality. * module/ice-9/boot-9.scm (load): Ditto. * module/system/base/compile.scm (call-with-output-file/atomic): Don't set the timestamp of TEMPLATE.
2010-06-20Canonicalize source file names in `primitive-load-path' (fix bug #30170).Ludovic Courtès1-0/+3
* libguile/load.c (scm_primitive_load_path): Canonicalize FULL_FILENAME. Fixes bug #30170 ("Auto-compilation erroneously recompiles dependencies").
2010-04-09remove libguile/lang.h, deprecate %nil (in favor of #nil)Andy Wingo1-1/+0
* libguile/Makefile.am: * libguile/init.c: * libguile/lang.c: * libguile/lang.h: Remove lang.c and lang.h. * libguile/pairs.h (SCM_NIL_P, SCM_NULL_OR_NIL_P): Moved here. * module/ice-9/deprecated.scm (%nil): %nil definition moved here. * libguile/alist.c: * libguile/async.c: * libguile/backtrace.c: * libguile/boolean.c: * libguile/dynl.c: * libguile/eval.c: * libguile/filesys.c: * libguile/fluids.c: * libguile/list.c: * libguile/load.c: * libguile/options.c: * libguile/posix.c: * libguile/print.c: * libguile/promises.c: * libguile/sort.c: * libguile/throw.c: * libguile/trees.c: * libguile/vectors.c: * libguile/vm.c: * libguile/weaks.c: * srfi/srfi-1.c: <libguile/lang.h> references removed.
2010-03-30correctly handle --no-autocompile (fixed broken previous patch)Andy Wingo1-6/+11
* 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.
2010-03-30going through scm_shell not necessary to get autocompilationAndy Wingo1-3/+7
* libguile/load.c (scm_init_load): Initialize %load-should-autocompile from the environment variable here, so that apps that don't go through scm_shell get autocompilation. * libguile/script.c (scm_compile_shell_switches): Explicitly enable or disable autocompilation here, if told to do so.
2010-01-07properly integrate vm bootstrapping into init.cAndy Wingo1-0/+4
* libguile/Makefile.am (modinclude_HEADERS): * libguile/vm-bootstrap.h: Remove vm-bootstrap.h. * libguile/frames.c: No more vm-bootstrap.h. * libguile/instructions.c (scm_init_instructions): * libguile/objcodes.c (scm_init_objcodes): * libguile/programs.c (scm_init_programs): No need to call scm_bootstrap_vm, init.c does that for us. * libguile/vm.c (scm_bootstrap_vm): No need call e.g. scm_bootstrap_frames, init.c does that. Remove a twice-calling guard, should be unnecessary. Don't define the load-compiled subr here. * libguile/load.c (scm_init_load): Define the load-compiled subr here. * libguile/vm.h: Declare scm_bootstrap_vm here. * libguile/init.c (scm_i_init_guile): Properly integrate VM bootstrapping into this file.
2010-01-07Fix 1.8-compatibility of `scm_search_path ()'.Ludovic Courtès1-3/+4
* libguile/load.c (scm_search_path): Handle the 1.8-compatibility case where REST is `SCM_UNDEFINED'. Reported by Dale P. Smith.