mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
Scheme reader fully replaces C reader
* libguile/read.h: * libguile/read.c (scm_primitive_read): New name for C reader. (scm_read): Call current value of "read" variable. (scm_init_read): Initialize "read" binding to "primitive-read". Replaced later in boot-9.
This commit is contained in:
parent
9516a10ab3
commit
a1fdb76455
2 changed files with 22 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
|||
/* Copyright 1995-1997,1999-2001,2003-2004,2006-2012,2014-2020
|
||||
/* Copyright 1995-1997,1999-2001,2003-2004,2006-2012,2014-2021
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Guile.
|
||||
|
@ -1943,12 +1943,12 @@ scm_read_expression (SCM port, scm_t_read_opts *opts)
|
|||
|
||||
static void init_read_options (SCM port, scm_t_read_opts *opts);
|
||||
|
||||
SCM_DEFINE (scm_read, "read", 0, 1, 0,
|
||||
SCM_DEFINE (scm_primitive_read, "primitive-read", 0, 1, 0,
|
||||
(SCM port),
|
||||
"Read an s-expression from the input port @var{port}, or from\n"
|
||||
"the current input port if @var{port} is not specified.\n"
|
||||
"Any whitespace before the next token is discarded.")
|
||||
#define FUNC_NAME s_scm_read
|
||||
#define FUNC_NAME s_scm_primitive_read
|
||||
{
|
||||
scm_t_read_opts opts;
|
||||
int c;
|
||||
|
@ -1968,6 +1968,19 @@ SCM_DEFINE (scm_read, "read", 0, 1, 0,
|
|||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
static SCM scm_read_var;
|
||||
|
||||
SCM
|
||||
scm_read (SCM port)
|
||||
#define FUNC_NAME "read"
|
||||
{
|
||||
if (SCM_UNBNDP (port))
|
||||
return scm_call_0 (scm_variable_ref (scm_read_var));
|
||||
|
||||
return scm_call_1 (scm_variable_ref (scm_read_var), port);
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -2399,4 +2412,7 @@ scm_init_read ()
|
|||
|
||||
scm_init_opts (scm_read_options, scm_read_opts);
|
||||
#include "read.x"
|
||||
|
||||
scm_read_var = scm_c_define
|
||||
("read", scm_variable_ref (scm_c_lookup (s_scm_primitive_read)));
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef SCM_READ_H
|
||||
#define SCM_READ_H
|
||||
|
||||
/* Copyright 1995-1996,2000,2006,2008-2009,2018
|
||||
/* Copyright 1995-1996,2000,2006,2008-2009,2018,2021
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Guile.
|
||||
|
@ -49,6 +49,8 @@
|
|||
|
||||
SCM_API SCM scm_sym_dot;
|
||||
|
||||
SCM_INTERNAL SCM scm_primitive_read (SCM port);
|
||||
|
||||
SCM_API SCM scm_read_options (SCM setting);
|
||||
SCM_API SCM scm_read (SCM port);
|
||||
SCM_API SCM scm_read_hash_extend (SCM chr, SCM proc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue