* __scm.h, alist.c, async.c, async.h, backtrace.h, chars.c,
continuations.c, debug.c, debug.h, dynl-dl.c, dynl.c, dynl.h,
dynwind.c, dynwind.h, eq.c, error.c, error.h, eval.c, eval.h,
feature.c, filesys.c, filesys.h, fports.c, fports.h, gc.c, gc.h,
genio.c, genio.h, gh.h, gh_data.c, gsubr.c, gsubr.h, hash.c,
hashtab.c, init.c, init.h, ioext.c, ioext.h, kw.c, libguile.h,
list.c, list.h, load.c, load.h, mallocs.c, markers.c,
mit-pthreads.c, net_db.c, numbers.c, numbers.h, options.c,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, regex-posix.c,
regex-posix.h, root.c, root.h, scmsigs.c, scmsigs.h, script.c,
script.h, simpos.c, simpos.h, smob.c, smob.h, snarf.h, socket.c,
srcprop.c, stackchk.c, stackchk.h, stacks.c, stime.c, stime.h,
strings.c, strings.h, strports.c, struct.c, struct.h, symbols.c,
symbols.h, tags.h, threads.c, throw.h, unif.c, variable.c,
vectors.c, vectors.h, version.h, vports.c, weaks.c: Update
copyright years.
1998-10-19 21:36:50 +00:00
|
|
|
|
/* Copyright (C) 1995,1996,1998 Free Software Foundation, Inc.
|
1996-07-25 22:56:11 +00:00
|
|
|
|
*
|
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
|
|
* any later version.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
*
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
|
* along with this software; see the file COPYING. If not, write to
|
1997-05-26 22:34:48 +00:00
|
|
|
|
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
|
|
|
|
* Boston, MA 02111-1307 USA
|
1996-07-25 22:56:11 +00:00
|
|
|
|
*
|
|
|
|
|
|
* As a special exception, the Free Software Foundation gives permission
|
|
|
|
|
|
* for additional uses of the text contained in its release of GUILE.
|
|
|
|
|
|
*
|
|
|
|
|
|
* The exception is that, if you link the GUILE library with other files
|
|
|
|
|
|
* to produce an executable, this does not by itself cause the
|
|
|
|
|
|
* resulting executable to be covered by the GNU General Public License.
|
|
|
|
|
|
* Your use of that executable is in no way restricted on account of
|
|
|
|
|
|
* linking the GUILE library code into it.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This exception does not however invalidate any other reasons why
|
|
|
|
|
|
* the executable file might be covered by the GNU General Public License.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This exception applies only to the code released by the
|
|
|
|
|
|
* Free Software Foundation under the name GUILE. If you copy
|
|
|
|
|
|
* code from other Free Software Foundation releases into a copy of
|
|
|
|
|
|
* GUILE, as the General Public License permits, the exception does
|
|
|
|
|
|
* not apply to the code that you add in this way. To avoid misleading
|
|
|
|
|
|
* anyone as to the status of such modified files, you must delete
|
|
|
|
|
|
* this exception notice from them.
|
|
|
|
|
|
*
|
|
|
|
|
|
* If you write modifications of your own for GUILE, it is your choice
|
|
|
|
|
|
* whether to permit this exception to apply to your modifications.
|
1997-05-26 22:34:48 +00:00
|
|
|
|
* If you do not wish that, delete this exception notice. */
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
#include "_scm.h"
|
1996-09-05 16:51:22 +00:00
|
|
|
|
#include "libpath.h"
|
C files should #include only the header files they need, not
libguile.h (which #includes all the header files); the pointless
recompilation was wasting my time.
* Makefile.in (all .o dependency lists): Regenerated.
* libguile.h: Don't try to get a definition for size_t here...
* __scm.h: Do it here.
* _scm.h: Since this is the internal libguile header, put things
here that all (or a majority) of the libguile files will want.
Don't #include <libguile.h> here; that generates dependencies on
way too much. Instead, get "__scm.h", "error.h", "pairs.h",
"list.h", "gc.h", "gsubr.h", "procs.h", "numbers.h", "symbols.h",
"boolean.h", "strings.h", "vectors.h", "root.h", "ports.h", and
"async.h".
* alist.c: Get "eq.h", "list.h", "alist.h".
* append.c: Get "append.h", "list.h".
* arbiters.c: Get "arbiters.h", "smob.h".
* async.c: Get "async.h", "smob.h", "throw.h", "eval.h".
* boolean.c: Get "boolean.h".
* chars.c: Get "chars.h".
* continuations.c: Get "continuations.h", "dynwind.h", "debug.h",
"stackchk.h".
* debug.c: Get "debug.h", "feature.h", "read.h", "strports.h",
"continuations.h", "alist.h", "srcprop.h", "procprop.h", "smob.h",
"genio.h", "throw.h", "eval.h".
* dynwind.c: Get "dynwind.h", "alist.h", "eval.h".
* eq.c: Get "eq.h", "unif.h", "smob.h", "strorder.h",
"stackchk.h".
* error.c: Get "error.h", "throw.h", "genio.h", "pairs.h".
* eval.c: Get "eval.h", "stackchk.h", "srcprop.h", "debug.h",
"hashtab.h", "procprop.h", "markers.h", "smob.h", "throw.h",
"continuations.h", "eq.h", "sequences.h", "alist.h", "append.h",
"debug.h".
* fdsocket.c: Get "fdsocket.h", "unif.h", "filesys.h".
* feature.c: Get "feature.h".
* files.c: Get "files.h".
* filesys.c: Get "filesys.h", "smob.h", "genio.h".
* fports.c: Get "fports.h", "markers.h".
* gc.c: Get "async.h", "unif.h", "smob.h", "weaks.h",
"genio.h", "struct.h", "stackchk.h", "stime.h".
* gdbint.c: Get "gdbint.h", "chars.h", "eval.h", "print.h",
"read.h", "strports.h", "tag.h".
* genio.c: Get "genio.h", "chars.h".
* gsubr.c: Get "gsubr.h", "genio.h".
* hash.c: Get "hash.h", "chars.h".
* hashtab.c: Get "hashtab.h", "eval.h", "hash.h", "alist.h".
* init.c: Get everyone who has an scm_init_mumble function:
"weaks.h", "vports.h", "version.h", "vectors.h", "variable.h",
"unif.h", "throw.h", "tag.h", "symbols.h", "struct.h",
"strports.h", "strorder.h", "strop.h", "strings.h", "stime.h",
"stackchk.h", "srcprop.h", "socket.h", "simpos.h", "sequences.h",
"scmsigs.h", "read.h", "ramap.h", "procs.h", "procprop.h",
"print.h", "posix.h", "ports.h", "pairs.h", "options.h",
"objprop.h", "numbers.h", "mbstrings.h", "mallocs.h", "load.h",
"list.h", "kw.h", "ioext.h", "hashtab.h", "hash.h", "gsubr.h",
"gdbint.h", "gc.h", "fports.h", "filesys.h", "files.h",
"feature.h", "fdsocket.h", "eval.h", "error.h", "eq.h",
"dynwind.h", "debug.h", "continuations.h", "chars.h", "boolean.h",
"async.h", "arbiters.h", "append.h", "alist.h".
* ioext.c: Get "ioext.h", "fports.h".
* kw.c: Get "kw.h", "smob.h", "mbstrings.h", "genio.h".
* list.c: Get "list.h", "eq.h".
* load.c: Get "load.h", "eval.h", "read.h", "fports.h".
* mallocs.c: Get "smob.h", "genio.h".
* markers.c: Get "markers.h".
* mbstrings.c: Get "mbstrings.h", "read.h", "genio.h", "unif.h",
"chars.h".
* numbers.c: Get "unif.h", "genio.h".
* objprop.c: Get "objprop.h", "weaks.h", "alist.h", "hashtab.h".
* options.c: Get "options.h".
* ports.c: Get "ports.h", "vports.h", "strports.h", "fports.h",
"markers.h", "chars.h", "genio.h".
* posix.c: Get "posix.h", "sequences.h", "feature.h", "unif.h",
"read.h", "scmsigs.h", "genio.h", "fports.h".
* print.c: Get "print.h", "unif.h", "weaks.h", "read.h",
"procprop.h", "eval.h", "smob.h", "mbstrings.h", "genio.h",
"chars.h".
* procprop.c: Get "procprop.h", "eval.h", "alist.h".
* procs.c: Get "procs.h".
* ramap.c: Get "ramap.h", "feature.h", "eval.h", "eq.h",
"chars.h", "smob.h", "unif.h".
* read.c: Get "alist.h", "kw.h", "mbstrings.h", "unif.h",
"eval.h", "genio.h", "chars.h".
* root.c: Get "root.h", "stackchk.h".
* scmsigs.c: Get "scmsigs.h".
* sequences.c: Get "sequences.h".
* simpos.c: Get "simpos.h", "scmsigs.h".
* smob.c: Get "smob.h".
* socket.c: Get "socket.h", "feature.h".
* srcprop.c: Get "srcprop.h", "weaks.h", "hashtab.h", "debug.h",
"alist.h", "smob.h".
* stackchk.c: Get "stackchk.h", "genio.h".
* stime.c: Get "stime.h"."libguile/continuations.h".
* strings.c: Get "strings.h", "chars.h".
* strop.c: Get "strop.h", "chars.h".
* strorder.c: Get "strorder.h", "chars.h".
* strports.c: Get "strports.h", "print.h", "eval.h", "unif.h".
* struct.c: Get "struct.h", "chars.h".
* symbols.c: Get "symbols.h", "mbstrings.h", "alist.h",
"variable.h", "eval.h", "chars.h".
* tag.c: Get "tag.h", "struct.h", "chars.h".
* throw.c: Get "throw.h", "continuations.h", "debug.h",
"dynwind.h", "eval.h", "alist.h", "smob.h", "genio.h".
* unif.c: Get "unif.h", "feature.h", "strop.h", "sequences.h",
"smob.h", "genio.h", "eval.h", "chars.h".
* variable.c: Get "variable.h", "smob.h", "genio.h".
* vectors.c: Get "vectors.h", "eq.h".
* version.c: Get "version.h".
* vports.c: Get "vports.h", "fports.h", "chars.h", "eval.h".
* weaks.c: Get "weaks.h".
1996-09-10 02:26:07 +00:00
|
|
|
|
#include "fports.h"
|
|
|
|
|
|
#include "read.h"
|
|
|
|
|
|
#include "eval.h"
|
1996-11-02 20:53:42 +00:00
|
|
|
|
#include "throw.h"
|
1997-06-23 23:48:39 +00:00
|
|
|
|
#include "alist.h"
|
1998-06-18 21:53:45 +00:00
|
|
|
|
#include "dynwind.h"
|
C files should #include only the header files they need, not
libguile.h (which #includes all the header files); the pointless
recompilation was wasting my time.
* Makefile.in (all .o dependency lists): Regenerated.
* libguile.h: Don't try to get a definition for size_t here...
* __scm.h: Do it here.
* _scm.h: Since this is the internal libguile header, put things
here that all (or a majority) of the libguile files will want.
Don't #include <libguile.h> here; that generates dependencies on
way too much. Instead, get "__scm.h", "error.h", "pairs.h",
"list.h", "gc.h", "gsubr.h", "procs.h", "numbers.h", "symbols.h",
"boolean.h", "strings.h", "vectors.h", "root.h", "ports.h", and
"async.h".
* alist.c: Get "eq.h", "list.h", "alist.h".
* append.c: Get "append.h", "list.h".
* arbiters.c: Get "arbiters.h", "smob.h".
* async.c: Get "async.h", "smob.h", "throw.h", "eval.h".
* boolean.c: Get "boolean.h".
* chars.c: Get "chars.h".
* continuations.c: Get "continuations.h", "dynwind.h", "debug.h",
"stackchk.h".
* debug.c: Get "debug.h", "feature.h", "read.h", "strports.h",
"continuations.h", "alist.h", "srcprop.h", "procprop.h", "smob.h",
"genio.h", "throw.h", "eval.h".
* dynwind.c: Get "dynwind.h", "alist.h", "eval.h".
* eq.c: Get "eq.h", "unif.h", "smob.h", "strorder.h",
"stackchk.h".
* error.c: Get "error.h", "throw.h", "genio.h", "pairs.h".
* eval.c: Get "eval.h", "stackchk.h", "srcprop.h", "debug.h",
"hashtab.h", "procprop.h", "markers.h", "smob.h", "throw.h",
"continuations.h", "eq.h", "sequences.h", "alist.h", "append.h",
"debug.h".
* fdsocket.c: Get "fdsocket.h", "unif.h", "filesys.h".
* feature.c: Get "feature.h".
* files.c: Get "files.h".
* filesys.c: Get "filesys.h", "smob.h", "genio.h".
* fports.c: Get "fports.h", "markers.h".
* gc.c: Get "async.h", "unif.h", "smob.h", "weaks.h",
"genio.h", "struct.h", "stackchk.h", "stime.h".
* gdbint.c: Get "gdbint.h", "chars.h", "eval.h", "print.h",
"read.h", "strports.h", "tag.h".
* genio.c: Get "genio.h", "chars.h".
* gsubr.c: Get "gsubr.h", "genio.h".
* hash.c: Get "hash.h", "chars.h".
* hashtab.c: Get "hashtab.h", "eval.h", "hash.h", "alist.h".
* init.c: Get everyone who has an scm_init_mumble function:
"weaks.h", "vports.h", "version.h", "vectors.h", "variable.h",
"unif.h", "throw.h", "tag.h", "symbols.h", "struct.h",
"strports.h", "strorder.h", "strop.h", "strings.h", "stime.h",
"stackchk.h", "srcprop.h", "socket.h", "simpos.h", "sequences.h",
"scmsigs.h", "read.h", "ramap.h", "procs.h", "procprop.h",
"print.h", "posix.h", "ports.h", "pairs.h", "options.h",
"objprop.h", "numbers.h", "mbstrings.h", "mallocs.h", "load.h",
"list.h", "kw.h", "ioext.h", "hashtab.h", "hash.h", "gsubr.h",
"gdbint.h", "gc.h", "fports.h", "filesys.h", "files.h",
"feature.h", "fdsocket.h", "eval.h", "error.h", "eq.h",
"dynwind.h", "debug.h", "continuations.h", "chars.h", "boolean.h",
"async.h", "arbiters.h", "append.h", "alist.h".
* ioext.c: Get "ioext.h", "fports.h".
* kw.c: Get "kw.h", "smob.h", "mbstrings.h", "genio.h".
* list.c: Get "list.h", "eq.h".
* load.c: Get "load.h", "eval.h", "read.h", "fports.h".
* mallocs.c: Get "smob.h", "genio.h".
* markers.c: Get "markers.h".
* mbstrings.c: Get "mbstrings.h", "read.h", "genio.h", "unif.h",
"chars.h".
* numbers.c: Get "unif.h", "genio.h".
* objprop.c: Get "objprop.h", "weaks.h", "alist.h", "hashtab.h".
* options.c: Get "options.h".
* ports.c: Get "ports.h", "vports.h", "strports.h", "fports.h",
"markers.h", "chars.h", "genio.h".
* posix.c: Get "posix.h", "sequences.h", "feature.h", "unif.h",
"read.h", "scmsigs.h", "genio.h", "fports.h".
* print.c: Get "print.h", "unif.h", "weaks.h", "read.h",
"procprop.h", "eval.h", "smob.h", "mbstrings.h", "genio.h",
"chars.h".
* procprop.c: Get "procprop.h", "eval.h", "alist.h".
* procs.c: Get "procs.h".
* ramap.c: Get "ramap.h", "feature.h", "eval.h", "eq.h",
"chars.h", "smob.h", "unif.h".
* read.c: Get "alist.h", "kw.h", "mbstrings.h", "unif.h",
"eval.h", "genio.h", "chars.h".
* root.c: Get "root.h", "stackchk.h".
* scmsigs.c: Get "scmsigs.h".
* sequences.c: Get "sequences.h".
* simpos.c: Get "simpos.h", "scmsigs.h".
* smob.c: Get "smob.h".
* socket.c: Get "socket.h", "feature.h".
* srcprop.c: Get "srcprop.h", "weaks.h", "hashtab.h", "debug.h",
"alist.h", "smob.h".
* stackchk.c: Get "stackchk.h", "genio.h".
* stime.c: Get "stime.h"."libguile/continuations.h".
* strings.c: Get "strings.h", "chars.h".
* strop.c: Get "strop.h", "chars.h".
* strorder.c: Get "strorder.h", "chars.h".
* strports.c: Get "strports.h", "print.h", "eval.h", "unif.h".
* struct.c: Get "struct.h", "chars.h".
* symbols.c: Get "symbols.h", "mbstrings.h", "alist.h",
"variable.h", "eval.h", "chars.h".
* tag.c: Get "tag.h", "struct.h", "chars.h".
* throw.c: Get "throw.h", "continuations.h", "debug.h",
"dynwind.h", "eval.h", "alist.h", "smob.h", "genio.h".
* unif.c: Get "unif.h", "feature.h", "strop.h", "sequences.h",
"smob.h", "genio.h", "eval.h", "chars.h".
* variable.c: Get "variable.h", "smob.h", "genio.h".
* vectors.c: Get "vectors.h", "eq.h".
* version.c: Get "version.h".
* vports.c: Get "vports.h", "fports.h", "chars.h", "eval.h".
* weaks.c: Get "weaks.h".
1996-09-10 02:26:07 +00:00
|
|
|
|
|
|
|
|
|
|
#include "load.h"
|
1996-09-05 16:51:22 +00:00
|
|
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
#endif /* HAVE_UNISTD_H */
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef R_OK
|
|
|
|
|
|
#define R_OK 4
|
|
|
|
|
|
#endif
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
1996-09-05 16:51:22 +00:00
|
|
|
|
/* Loading a file, given an absolute filename. */
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
1996-10-28 23:05:37 +00:00
|
|
|
|
/* Hook to run when we load a file, perhaps to announce the fact somewhere.
|
|
|
|
|
|
Applied to the full name of the file. */
|
|
|
|
|
|
static SCM *scm_loc_load_hook;
|
|
|
|
|
|
|
1998-09-06 18:15:49 +00:00
|
|
|
|
static void
|
1998-06-18 21:53:45 +00:00
|
|
|
|
swap_port (void *data)
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM *save_port = data, tmp = scm_cur_loadp;
|
|
|
|
|
|
scm_cur_loadp = *save_port;
|
|
|
|
|
|
*save_port = tmp;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
|
load (void *data)
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM port = (SCM) data, form;
|
|
|
|
|
|
while (1)
|
|
|
|
|
|
{
|
|
|
|
|
|
form = scm_read (port);
|
|
|
|
|
|
if (SCM_EOF_OBJECT_P (form))
|
|
|
|
|
|
break;
|
|
|
|
|
|
scm_eval_x (form);
|
|
|
|
|
|
}
|
|
|
|
|
|
return SCM_UNSPECIFIED;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
* strports.c (scm_read_0str, scm_eval_0str): update scm_read usage.
* gdbint.c (gdb_read): update scm_lreadr usage.
* load.h: update prototypes.
* load.c (scm_primitive_load, scm_read_and_eval_x,
scm_primitive_load_path): remove case_insensitive_p, sharp arguments.
* read.h: add prototype for scm_read_hash_extend. Change args for
other prototypes.
* read.c (scm_read_hash_procedures): new variable.
(scm_read_hash_extend): new procedure.
(scm_get_hash_procedure): new procedure.
* (scm_lreadr): use scm_get_hash_procedure instead of an argument
for extended # processing.
(scm_read, scm_lreadr, scm_lreadrecparen, scm_lreadparen,
scm_read_token): remove case_i, sharp arguments. Change callers.
* read.h (SCM_N_READ_OPTIONS): increase to 3.
(SCM_CASE_INSENSITIVE_P): define.
* read.c: add case-insensitive option to scm_read_opts.
* (scm_read_token): use SCM_CASE_INSENSITIVE_P instead of an argument
to determine whether to convert symbol case.
(default_case_i): definition removed.
* read.c (scm_read_token): if case_i, downcase ic before doing
anything with it.
1997-03-08 18:58:24 +00:00
|
|
|
|
SCM_PROC(s_primitive_load, "primitive-load", 1, 0, 0, scm_primitive_load);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM
|
* strports.c (scm_read_0str, scm_eval_0str): update scm_read usage.
* gdbint.c (gdb_read): update scm_lreadr usage.
* load.h: update prototypes.
* load.c (scm_primitive_load, scm_read_and_eval_x,
scm_primitive_load_path): remove case_insensitive_p, sharp arguments.
* read.h: add prototype for scm_read_hash_extend. Change args for
other prototypes.
* read.c (scm_read_hash_procedures): new variable.
(scm_read_hash_extend): new procedure.
(scm_get_hash_procedure): new procedure.
* (scm_lreadr): use scm_get_hash_procedure instead of an argument
for extended # processing.
(scm_read, scm_lreadr, scm_lreadrecparen, scm_lreadparen,
scm_read_token): remove case_i, sharp arguments. Change callers.
* read.h (SCM_N_READ_OPTIONS): increase to 3.
(SCM_CASE_INSENSITIVE_P): define.
* read.c: add case-insensitive option to scm_read_opts.
* (scm_read_token): use SCM_CASE_INSENSITIVE_P instead of an argument
to determine whether to convert symbol case.
(default_case_i): definition removed.
* read.c (scm_read_token): if case_i, downcase ic before doing
anything with it.
1997-03-08 18:58:24 +00:00
|
|
|
|
scm_primitive_load (filename)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM filename;
|
|
|
|
|
|
{
|
1996-10-28 23:05:37 +00:00
|
|
|
|
SCM hook = *scm_loc_load_hook;
|
1996-09-05 16:51:22 +00:00
|
|
|
|
SCM_ASSERT (SCM_NIMP (filename) && SCM_ROSTRINGP (filename), filename,
|
1996-10-27 02:38:39 +00:00
|
|
|
|
SCM_ARG1, s_primitive_load);
|
1996-10-28 23:05:37 +00:00
|
|
|
|
SCM_ASSERT (hook == SCM_BOOL_F
|
|
|
|
|
|
|| (scm_procedure_p (hook) == SCM_BOOL_T),
|
|
|
|
|
|
hook, "value of %load-hook is neither a procedure nor #f",
|
|
|
|
|
|
s_primitive_load);
|
|
|
|
|
|
|
|
|
|
|
|
if (hook != SCM_BOOL_F)
|
|
|
|
|
|
scm_apply (hook, scm_listify (filename, SCM_UNDEFINED), SCM_EOL);
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
1998-06-18 21:53:45 +00:00
|
|
|
|
SCM port, save_port;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
port = scm_open_file (filename,
|
|
|
|
|
|
scm_makfromstr ("r", (scm_sizet) sizeof (char), 0));
|
1998-06-18 21:53:45 +00:00
|
|
|
|
save_port = port;
|
|
|
|
|
|
scm_internal_dynamic_wind (swap_port,
|
|
|
|
|
|
load,
|
|
|
|
|
|
swap_port,
|
|
|
|
|
|
(void *) port,
|
|
|
|
|
|
&save_port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
scm_close_port (port);
|
|
|
|
|
|
}
|
1996-09-24 07:21:17 +00:00
|
|
|
|
return SCM_UNSPECIFIED;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
1996-10-30 23:34:33 +00:00
|
|
|
|
|
|
|
|
|
|
/* Builtin path to scheme library files. */
|
|
|
|
|
|
#ifdef SCM_PKGDATA_DIR
|
|
|
|
|
|
SCM_PROC (s_sys_package_data_dir, "%package-data-dir", 0, 0, 0, scm_sys_package_data_dir);
|
|
|
|
|
|
SCM
|
|
|
|
|
|
scm_sys_package_data_dir ()
|
|
|
|
|
|
{
|
|
|
|
|
|
return scm_makfrom0str (SCM_PKGDATA_DIR);
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif /* SCM_PKGDATA_DIR */
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
1996-09-05 16:51:22 +00:00
|
|
|
|
/* Initializing the load path, and searching it. */
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
1996-10-28 23:05:37 +00:00
|
|
|
|
/* List of names of directories we search for files to load. */
|
1996-09-05 16:51:22 +00:00
|
|
|
|
static SCM *scm_loc_load_path;
|
|
|
|
|
|
|
1996-10-28 23:05:37 +00:00
|
|
|
|
/* List of extensions we try adding to the filenames. */
|
|
|
|
|
|
static SCM *scm_loc_load_extensions;
|
|
|
|
|
|
|
1997-10-25 06:53:11 +00:00
|
|
|
|
|
|
|
|
|
|
/* Parse the null-terminated string PATH as if it were a standard path
|
|
|
|
|
|
environment variable (i.e. a colon-separated list of strings), and
|
|
|
|
|
|
prepend the elements to TAIL. */
|
|
|
|
|
|
SCM
|
1998-06-22 09:23:01 +00:00
|
|
|
|
scm_internal_parse_path (char *path, SCM tail)
|
1997-10-25 06:53:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
if (path && path[0] != '\0')
|
|
|
|
|
|
{
|
|
|
|
|
|
char *scan, *elt_end;
|
|
|
|
|
|
|
|
|
|
|
|
/* Scan backwards from the end of the string, to help
|
|
|
|
|
|
construct the list in the right order. */
|
|
|
|
|
|
scan = elt_end = path + strlen (path);
|
|
|
|
|
|
do {
|
|
|
|
|
|
/* Scan back to the beginning of the current element. */
|
|
|
|
|
|
do scan--;
|
|
|
|
|
|
while (scan >= path && *scan != ':');
|
|
|
|
|
|
tail = scm_cons (scm_makfromstr (scan + 1, elt_end - (scan + 1), 0),
|
|
|
|
|
|
tail);
|
|
|
|
|
|
elt_end = scan;
|
|
|
|
|
|
} while (scan >= path);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return tail;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1998-06-22 09:23:01 +00:00
|
|
|
|
SCM_PROC (s_parse_path, "parse-path", 1, 1, 0, scm_parse_path);
|
|
|
|
|
|
|
|
|
|
|
|
SCM
|
|
|
|
|
|
scm_parse_path (SCM path, SCM tail)
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM_ASSERT (SCM_FALSEP (path) || (SCM_NIMP (path) && SCM_ROSTRINGP (path)),
|
|
|
|
|
|
path,
|
|
|
|
|
|
SCM_ARG1,
|
|
|
|
|
|
s_parse_path);
|
|
|
|
|
|
if (SCM_UNBNDP (tail))
|
|
|
|
|
|
tail = SCM_EOL;
|
|
|
|
|
|
return (SCM_FALSEP (path)
|
|
|
|
|
|
? tail
|
|
|
|
|
|
: scm_internal_parse_path (SCM_ROCHARS (path), tail));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1996-09-05 16:51:22 +00:00
|
|
|
|
/* Initialize the global variable %load-path, given the value of the
|
1996-10-30 23:34:33 +00:00
|
|
|
|
SCM_SITE_DIR and SCM_LIBRARY_DIR preprocessor symbols and the
|
1997-10-25 06:53:11 +00:00
|
|
|
|
GUILE_LOAD_PATH environment variable. */
|
1996-07-25 22:56:11 +00:00
|
|
|
|
void
|
1996-09-05 16:51:22 +00:00
|
|
|
|
scm_init_load_path ()
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM path = SCM_EOL;
|
|
|
|
|
|
|
1996-10-30 23:34:33 +00:00
|
|
|
|
#ifdef SCM_LIBRARY_DIR
|
1997-06-17 19:20:07 +00:00
|
|
|
|
path = scm_listify (scm_makfrom0str (SCM_SITE_DIR),
|
|
|
|
|
|
scm_makfrom0str (SCM_LIBRARY_DIR),
|
|
|
|
|
|
scm_makfrom0str (SCM_PKGDATA_DIR),
|
|
|
|
|
|
SCM_UNDEFINED);
|
1996-10-30 23:34:33 +00:00
|
|
|
|
#endif /* SCM_LIBRARY_DIR */
|
1996-09-05 16:51:22 +00:00
|
|
|
|
|
1998-06-22 09:23:01 +00:00
|
|
|
|
path = scm_internal_parse_path (getenv ("GUILE_LOAD_PATH"), path);
|
1997-10-25 06:53:11 +00:00
|
|
|
|
|
1996-09-05 16:51:22 +00:00
|
|
|
|
*scm_loc_load_path = path;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
1998-06-22 09:23:01 +00:00
|
|
|
|
SCM scm_listofnullstr;
|
1996-09-05 16:51:22 +00:00
|
|
|
|
|
1998-06-22 09:23:01 +00:00
|
|
|
|
/* Search PATH for a directory containing a file named FILENAME.
|
1996-09-05 16:51:22 +00:00
|
|
|
|
The file must be readable, and not a directory.
|
1996-10-28 23:05:37 +00:00
|
|
|
|
If we find one, return its full filename; otherwise, return #f.
|
|
|
|
|
|
If FILENAME is absolute, return it unchanged. */
|
1998-06-22 09:23:01 +00:00
|
|
|
|
SCM_PROC(s_search_path, "search-path", 2, 1, 0, scm_search_path);
|
1996-09-05 16:51:22 +00:00
|
|
|
|
SCM
|
1998-06-22 09:23:01 +00:00
|
|
|
|
scm_search_path (path, filename, extensions)
|
|
|
|
|
|
SCM path;
|
1996-09-05 16:51:22 +00:00
|
|
|
|
SCM filename;
|
1998-06-22 09:23:01 +00:00
|
|
|
|
SCM extensions;
|
1996-09-05 16:51:22 +00:00
|
|
|
|
{
|
|
|
|
|
|
char *buf;
|
|
|
|
|
|
int filename_len;
|
1998-09-06 18:15:49 +00:00
|
|
|
|
size_t max_path_len;
|
|
|
|
|
|
size_t max_ext_len;
|
1996-09-05 16:51:22 +00:00
|
|
|
|
|
1998-06-22 09:23:01 +00:00
|
|
|
|
SCM_ASSERT (scm_ilength (path) >= 0, path, SCM_ARG1, s_search_path);
|
1996-09-05 16:51:22 +00:00
|
|
|
|
SCM_ASSERT (SCM_NIMP (filename) && SCM_ROSTRINGP (filename), filename,
|
1998-06-22 09:23:01 +00:00
|
|
|
|
SCM_ARG2, s_search_path);
|
|
|
|
|
|
if (SCM_UNBNDP (extensions))
|
|
|
|
|
|
extensions = scm_listofnullstr;
|
|
|
|
|
|
else
|
|
|
|
|
|
SCM_ASSERT (scm_ilength (extensions) >= 0, extensions,
|
|
|
|
|
|
SCM_ARG3, s_search_path);
|
1996-09-05 16:51:22 +00:00
|
|
|
|
filename_len = SCM_ROLENGTH (filename);
|
|
|
|
|
|
|
1996-10-28 23:05:37 +00:00
|
|
|
|
/* If FILENAME is absolute, return it unchanged. */
|
|
|
|
|
|
if (filename_len >= 1
|
|
|
|
|
|
&& SCM_ROCHARS (filename)[0] == '/')
|
|
|
|
|
|
return filename;
|
|
|
|
|
|
|
|
|
|
|
|
/* Find the length of the longest element of path. */
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM walk;
|
|
|
|
|
|
|
|
|
|
|
|
max_path_len = 0;
|
|
|
|
|
|
for (walk = path; SCM_NIMP (walk); walk = SCM_CDR (walk))
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM elt = SCM_CAR (walk);
|
|
|
|
|
|
SCM_ASSERT (SCM_NIMP (elt) && SCM_ROSTRINGP (elt), elt,
|
1998-06-22 09:23:01 +00:00
|
|
|
|
"path is not a list of strings",
|
|
|
|
|
|
s_search_path);
|
1996-10-28 23:05:37 +00:00
|
|
|
|
if (SCM_LENGTH (elt) > max_path_len)
|
|
|
|
|
|
max_path_len = SCM_LENGTH (elt);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Find the length of the longest element of the load extensions
|
|
|
|
|
|
list. */
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM walk;
|
|
|
|
|
|
|
|
|
|
|
|
max_ext_len = 0;
|
1998-06-22 09:23:01 +00:00
|
|
|
|
for (walk = extensions; SCM_NIMP (walk); walk = SCM_CDR (walk))
|
1996-10-28 23:05:37 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM elt = SCM_CAR (walk);
|
|
|
|
|
|
SCM_ASSERT (SCM_NIMP (elt) && SCM_ROSTRINGP (elt), elt,
|
1998-06-22 09:23:01 +00:00
|
|
|
|
"extension list is not a list of strings",
|
|
|
|
|
|
s_search_path);
|
1996-10-28 23:05:37 +00:00
|
|
|
|
if (SCM_LENGTH (elt) > max_ext_len)
|
|
|
|
|
|
max_ext_len = SCM_LENGTH (elt);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
1996-09-05 16:51:22 +00:00
|
|
|
|
SCM_DEFER_INTS;
|
|
|
|
|
|
|
1996-10-28 23:05:37 +00:00
|
|
|
|
buf = scm_must_malloc (max_path_len + 1 + filename_len + max_ext_len + 1,
|
1998-06-22 09:23:01 +00:00
|
|
|
|
s_search_path);
|
1996-09-05 16:51:22 +00:00
|
|
|
|
|
1996-10-28 23:05:37 +00:00
|
|
|
|
/* Try every path element. At this point, we know it's a proper
|
|
|
|
|
|
list of strings. */
|
|
|
|
|
|
for (; SCM_NIMP (path); path = SCM_CDR (path))
|
1996-09-05 16:51:22 +00:00
|
|
|
|
{
|
1998-06-22 09:23:01 +00:00
|
|
|
|
SCM path_elt = SCM_CAR (path), exts;
|
1996-10-28 23:05:37 +00:00
|
|
|
|
|
|
|
|
|
|
/* Try every extension. At this point, we know it's a proper
|
|
|
|
|
|
list of strings. */
|
1998-06-22 09:23:01 +00:00
|
|
|
|
for (exts = extensions; SCM_NIMP (exts); exts = SCM_CDR (exts))
|
1996-09-05 16:51:22 +00:00
|
|
|
|
{
|
1996-10-28 23:05:37 +00:00
|
|
|
|
SCM ext_elt = SCM_CAR (exts);
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
|
|
/* Concatenate the path name, the filename, and the extension. */
|
|
|
|
|
|
i = SCM_ROLENGTH (path_elt);
|
|
|
|
|
|
memcpy (buf, SCM_ROCHARS (path_elt), i);
|
1996-11-02 20:53:42 +00:00
|
|
|
|
if (i >= 1 && buf[i - 1] != '/')
|
|
|
|
|
|
buf[i++] = '/';
|
1996-10-28 23:05:37 +00:00
|
|
|
|
memcpy (buf + i, SCM_ROCHARS (filename), filename_len);
|
|
|
|
|
|
i += filename_len;
|
|
|
|
|
|
memcpy (buf + i, SCM_ROCHARS (ext_elt), SCM_LENGTH (ext_elt));
|
|
|
|
|
|
i += SCM_LENGTH (ext_elt);
|
|
|
|
|
|
buf[i] = '\0';
|
1996-09-05 16:51:22 +00:00
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
struct stat mode;
|
|
|
|
|
|
|
|
|
|
|
|
if (stat (buf, &mode) >= 0
|
|
|
|
|
|
&& ! (mode.st_mode & S_IFDIR)
|
|
|
|
|
|
&& access (buf, R_OK) == 0)
|
|
|
|
|
|
{
|
1996-10-28 23:05:37 +00:00
|
|
|
|
SCM result = scm_makfromstr (buf, i, 0);
|
1996-09-05 16:51:22 +00:00
|
|
|
|
scm_must_free (buf);
|
|
|
|
|
|
SCM_ALLOW_INTS;
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
scm_must_free (buf);
|
|
|
|
|
|
SCM_ALLOW_INTS;
|
|
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1998-06-22 09:23:01 +00:00
|
|
|
|
/* Search %load-path for a directory containing a file named FILENAME.
|
|
|
|
|
|
The file must be readable, and not a directory.
|
|
|
|
|
|
If we find one, return its full filename; otherwise, return #f.
|
|
|
|
|
|
If FILENAME is absolute, return it unchanged. */
|
|
|
|
|
|
SCM_PROC(s_sys_search_load_path, "%search-load-path", 1, 0, 0, scm_sys_search_load_path);
|
|
|
|
|
|
SCM
|
|
|
|
|
|
scm_sys_search_load_path (filename)
|
|
|
|
|
|
SCM filename;
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM path = *scm_loc_load_path;
|
|
|
|
|
|
SCM exts = *scm_loc_load_extensions;
|
|
|
|
|
|
SCM_ASSERT (SCM_NIMP (filename) && SCM_ROSTRINGP (filename), filename,
|
|
|
|
|
|
SCM_ARG1, s_sys_search_load_path);
|
|
|
|
|
|
SCM_ASSERT (scm_ilength (path) >= 0, path, "load path is not a proper list",
|
|
|
|
|
|
s_sys_search_load_path);
|
|
|
|
|
|
SCM_ASSERT (scm_ilength (exts) >= 0, exts,
|
|
|
|
|
|
"load extension list is not a proper list",
|
|
|
|
|
|
s_sys_search_load_path);
|
|
|
|
|
|
return scm_search_path (path,
|
|
|
|
|
|
filename,
|
|
|
|
|
|
exts);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
* strports.c (scm_read_0str, scm_eval_0str): update scm_read usage.
* gdbint.c (gdb_read): update scm_lreadr usage.
* load.h: update prototypes.
* load.c (scm_primitive_load, scm_read_and_eval_x,
scm_primitive_load_path): remove case_insensitive_p, sharp arguments.
* read.h: add prototype for scm_read_hash_extend. Change args for
other prototypes.
* read.c (scm_read_hash_procedures): new variable.
(scm_read_hash_extend): new procedure.
(scm_get_hash_procedure): new procedure.
* (scm_lreadr): use scm_get_hash_procedure instead of an argument
for extended # processing.
(scm_read, scm_lreadr, scm_lreadrecparen, scm_lreadparen,
scm_read_token): remove case_i, sharp arguments. Change callers.
* read.h (SCM_N_READ_OPTIONS): increase to 3.
(SCM_CASE_INSENSITIVE_P): define.
* read.c: add case-insensitive option to scm_read_opts.
* (scm_read_token): use SCM_CASE_INSENSITIVE_P instead of an argument
to determine whether to convert symbol case.
(default_case_i): definition removed.
* read.c (scm_read_token): if case_i, downcase ic before doing
anything with it.
1997-03-08 18:58:24 +00:00
|
|
|
|
SCM_PROC(s_primitive_load_path, "primitive-load-path", 1, 0, 0, scm_primitive_load_path);
|
1996-09-05 16:51:22 +00:00
|
|
|
|
SCM
|
* strports.c (scm_read_0str, scm_eval_0str): update scm_read usage.
* gdbint.c (gdb_read): update scm_lreadr usage.
* load.h: update prototypes.
* load.c (scm_primitive_load, scm_read_and_eval_x,
scm_primitive_load_path): remove case_insensitive_p, sharp arguments.
* read.h: add prototype for scm_read_hash_extend. Change args for
other prototypes.
* read.c (scm_read_hash_procedures): new variable.
(scm_read_hash_extend): new procedure.
(scm_get_hash_procedure): new procedure.
* (scm_lreadr): use scm_get_hash_procedure instead of an argument
for extended # processing.
(scm_read, scm_lreadr, scm_lreadrecparen, scm_lreadparen,
scm_read_token): remove case_i, sharp arguments. Change callers.
* read.h (SCM_N_READ_OPTIONS): increase to 3.
(SCM_CASE_INSENSITIVE_P): define.
* read.c: add case-insensitive option to scm_read_opts.
* (scm_read_token): use SCM_CASE_INSENSITIVE_P instead of an argument
to determine whether to convert symbol case.
(default_case_i): definition removed.
* read.c (scm_read_token): if case_i, downcase ic before doing
anything with it.
1997-03-08 18:58:24 +00:00
|
|
|
|
scm_primitive_load_path (filename)
|
1996-09-05 16:51:22 +00:00
|
|
|
|
SCM filename;
|
|
|
|
|
|
{
|
1996-10-28 23:05:37 +00:00
|
|
|
|
SCM full_filename;
|
|
|
|
|
|
|
|
|
|
|
|
SCM_ASSERT (SCM_NIMP (filename) && SCM_ROSTRINGP (filename), filename,
|
|
|
|
|
|
SCM_ARG1, s_primitive_load_path);
|
|
|
|
|
|
|
|
|
|
|
|
full_filename = scm_sys_search_load_path (filename);
|
|
|
|
|
|
|
1996-09-28 19:40:54 +00:00
|
|
|
|
if (SCM_FALSEP (full_filename))
|
|
|
|
|
|
{
|
1996-10-28 23:05:37 +00:00
|
|
|
|
int absolute = (SCM_LENGTH (filename) >= 1
|
|
|
|
|
|
&& SCM_ROCHARS (filename)[0] == '/');
|
1996-10-27 02:38:39 +00:00
|
|
|
|
scm_misc_error (s_primitive_load_path,
|
1996-10-28 23:05:37 +00:00
|
|
|
|
(absolute
|
|
|
|
|
|
? "Unable to load file %S"
|
|
|
|
|
|
: "Unable to find file %S in load path"),
|
|
|
|
|
|
scm_listify (filename, SCM_UNDEFINED));
|
1996-09-28 19:40:54 +00:00
|
|
|
|
}
|
1996-10-28 23:05:37 +00:00
|
|
|
|
|
* strports.c (scm_read_0str, scm_eval_0str): update scm_read usage.
* gdbint.c (gdb_read): update scm_lreadr usage.
* load.h: update prototypes.
* load.c (scm_primitive_load, scm_read_and_eval_x,
scm_primitive_load_path): remove case_insensitive_p, sharp arguments.
* read.h: add prototype for scm_read_hash_extend. Change args for
other prototypes.
* read.c (scm_read_hash_procedures): new variable.
(scm_read_hash_extend): new procedure.
(scm_get_hash_procedure): new procedure.
* (scm_lreadr): use scm_get_hash_procedure instead of an argument
for extended # processing.
(scm_read, scm_lreadr, scm_lreadrecparen, scm_lreadparen,
scm_read_token): remove case_i, sharp arguments. Change callers.
* read.h (SCM_N_READ_OPTIONS): increase to 3.
(SCM_CASE_INSENSITIVE_P): define.
* read.c: add case-insensitive option to scm_read_opts.
* (scm_read_token): use SCM_CASE_INSENSITIVE_P instead of an argument
to determine whether to convert symbol case.
(default_case_i): definition removed.
* read.c (scm_read_token): if case_i, downcase ic before doing
anything with it.
1997-03-08 18:58:24 +00:00
|
|
|
|
return scm_primitive_load (full_filename);
|
1996-09-05 16:51:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
1996-11-02 20:53:42 +00:00
|
|
|
|
/* The following function seems trivial - and indeed it is. Its
|
|
|
|
|
|
* existence is motivated by its ability to evaluate expressions
|
|
|
|
|
|
* without copying them first (as is done in "eval").
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
SCM_SYMBOL (scm_end_of_file_key, "end-of-file");
|
|
|
|
|
|
|
* strports.c (scm_read_0str, scm_eval_0str): update scm_read usage.
* gdbint.c (gdb_read): update scm_lreadr usage.
* load.h: update prototypes.
* load.c (scm_primitive_load, scm_read_and_eval_x,
scm_primitive_load_path): remove case_insensitive_p, sharp arguments.
* read.h: add prototype for scm_read_hash_extend. Change args for
other prototypes.
* read.c (scm_read_hash_procedures): new variable.
(scm_read_hash_extend): new procedure.
(scm_get_hash_procedure): new procedure.
* (scm_lreadr): use scm_get_hash_procedure instead of an argument
for extended # processing.
(scm_read, scm_lreadr, scm_lreadrecparen, scm_lreadparen,
scm_read_token): remove case_i, sharp arguments. Change callers.
* read.h (SCM_N_READ_OPTIONS): increase to 3.
(SCM_CASE_INSENSITIVE_P): define.
* read.c: add case-insensitive option to scm_read_opts.
* (scm_read_token): use SCM_CASE_INSENSITIVE_P instead of an argument
to determine whether to convert symbol case.
(default_case_i): definition removed.
* read.c (scm_read_token): if case_i, downcase ic before doing
anything with it.
1997-03-08 18:58:24 +00:00
|
|
|
|
SCM_PROC (s_read_and_eval_x, "read-and-eval!", 0, 1, 0, scm_read_and_eval_x);
|
1996-11-02 20:53:42 +00:00
|
|
|
|
|
|
|
|
|
|
SCM
|
* strports.c (scm_read_0str, scm_eval_0str): update scm_read usage.
* gdbint.c (gdb_read): update scm_lreadr usage.
* load.h: update prototypes.
* load.c (scm_primitive_load, scm_read_and_eval_x,
scm_primitive_load_path): remove case_insensitive_p, sharp arguments.
* read.h: add prototype for scm_read_hash_extend. Change args for
other prototypes.
* read.c (scm_read_hash_procedures): new variable.
(scm_read_hash_extend): new procedure.
(scm_get_hash_procedure): new procedure.
* (scm_lreadr): use scm_get_hash_procedure instead of an argument
for extended # processing.
(scm_read, scm_lreadr, scm_lreadrecparen, scm_lreadparen,
scm_read_token): remove case_i, sharp arguments. Change callers.
* read.h (SCM_N_READ_OPTIONS): increase to 3.
(SCM_CASE_INSENSITIVE_P): define.
* read.c: add case-insensitive option to scm_read_opts.
* (scm_read_token): use SCM_CASE_INSENSITIVE_P instead of an argument
to determine whether to convert symbol case.
(default_case_i): definition removed.
* read.c (scm_read_token): if case_i, downcase ic before doing
anything with it.
1997-03-08 18:58:24 +00:00
|
|
|
|
scm_read_and_eval_x (port)
|
1996-11-02 20:53:42 +00:00
|
|
|
|
SCM port;
|
|
|
|
|
|
{
|
* strports.c (scm_read_0str, scm_eval_0str): update scm_read usage.
* gdbint.c (gdb_read): update scm_lreadr usage.
* load.h: update prototypes.
* load.c (scm_primitive_load, scm_read_and_eval_x,
scm_primitive_load_path): remove case_insensitive_p, sharp arguments.
* read.h: add prototype for scm_read_hash_extend. Change args for
other prototypes.
* read.c (scm_read_hash_procedures): new variable.
(scm_read_hash_extend): new procedure.
(scm_get_hash_procedure): new procedure.
* (scm_lreadr): use scm_get_hash_procedure instead of an argument
for extended # processing.
(scm_read, scm_lreadr, scm_lreadrecparen, scm_lreadparen,
scm_read_token): remove case_i, sharp arguments. Change callers.
* read.h (SCM_N_READ_OPTIONS): increase to 3.
(SCM_CASE_INSENSITIVE_P): define.
* read.c: add case-insensitive option to scm_read_opts.
* (scm_read_token): use SCM_CASE_INSENSITIVE_P instead of an argument
to determine whether to convert symbol case.
(default_case_i): definition removed.
* read.c (scm_read_token): if case_i, downcase ic before doing
anything with it.
1997-03-08 18:58:24 +00:00
|
|
|
|
SCM form = scm_read (port);
|
1997-09-22 00:43:52 +00:00
|
|
|
|
if (SCM_EOF_OBJECT_P (form))
|
1996-11-02 20:53:42 +00:00
|
|
|
|
scm_ithrow (scm_end_of_file_key, SCM_EOL, 1);
|
|
|
|
|
|
return scm_eval_x (form);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
1996-09-05 16:51:22 +00:00
|
|
|
|
|
1997-06-23 23:48:39 +00:00
|
|
|
|
/* Information about the build environment. */
|
1996-09-05 16:51:22 +00:00
|
|
|
|
|
1997-06-23 23:48:39 +00:00
|
|
|
|
/* Initialize the scheme variable %guile-build-info, based on data
|
|
|
|
|
|
provided by the Makefile, via libpath.h. */
|
|
|
|
|
|
static void
|
|
|
|
|
|
init_build_info ()
|
|
|
|
|
|
{
|
|
|
|
|
|
static struct { char *name; char *value; } info[] = SCM_BUILD_INFO;
|
|
|
|
|
|
SCM *loc = SCM_CDRLOC (scm_sysintern ("%guile-build-info", SCM_EOL));
|
1998-09-06 18:15:49 +00:00
|
|
|
|
unsigned int i;
|
1997-06-23 23:48:39 +00:00
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < (sizeof (info) / sizeof (info[0])); i++)
|
|
|
|
|
|
*loc = scm_acons (SCM_CAR (scm_intern0 (info[i].name)),
|
|
|
|
|
|
scm_makfrom0str (info[i].value),
|
|
|
|
|
|
*loc);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
void
|
|
|
|
|
|
scm_init_load ()
|
|
|
|
|
|
{
|
1998-06-22 09:23:01 +00:00
|
|
|
|
scm_listofnullstr = scm_permanent_object (SCM_LIST1 (scm_nullstr));
|
|
|
|
|
|
scm_loc_load_path = SCM_CDRLOC (scm_sysintern ("%load-path", SCM_EOL));
|
1996-10-28 23:05:37 +00:00
|
|
|
|
scm_loc_load_extensions
|
1998-06-22 09:23:01 +00:00
|
|
|
|
= SCM_CDRLOC (scm_sysintern ("%load-extensions",
|
|
|
|
|
|
scm_listify (scm_makfrom0str (""),
|
|
|
|
|
|
scm_makfrom0str (".scm"),
|
|
|
|
|
|
SCM_UNDEFINED)));
|
|
|
|
|
|
scm_loc_load_hook = SCM_CDRLOC (scm_sysintern ("%load-hook", SCM_BOOL_F));
|
1996-09-05 16:51:22 +00:00
|
|
|
|
|
1997-06-23 23:48:39 +00:00
|
|
|
|
init_build_info ();
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
#include "load.x"
|
|
|
|
|
|
}
|