-/* 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.
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;
}
#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
+
\f
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)));
}
#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.
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);