1 |
/* readline.c --- line editing support for Guile */ |
/* readline.c --- line editing support for Guile */ |
2 |
|
|
3 |
/* Copyright (C) 1997,1999,2000,2001 Free Software Foundation, Inc. |
/* Copyright (C) 1997,1999,2000,2001, 2002 Free Software Foundation, Inc. |
4 |
* |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
6 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
149 |
|
|
150 |
static int in_readline = 0; |
static int in_readline = 0; |
151 |
#ifdef USE_THREADS |
#ifdef USE_THREADS |
152 |
static scm_t_mutex reentry_barrier_mutex; |
static SCM reentry_barrier_mutex; |
153 |
#endif |
#endif |
154 |
|
|
155 |
static SCM internal_readline (SCM text); |
static SCM internal_readline (SCM text); |
229 |
int reentryp = 0; |
int reentryp = 0; |
230 |
#ifdef USE_THREADS |
#ifdef USE_THREADS |
231 |
/* We should rather use scm_t_mutexry_lock when it becomes available */ |
/* We should rather use scm_t_mutexry_lock when it becomes available */ |
232 |
scm_mutex_lock (&reentry_barrier_mutex); |
scm_lock_mutex (reentry_barrier_mutex); |
233 |
#endif |
#endif |
234 |
if (in_readline) |
if (in_readline) |
235 |
reentryp = 1; |
reentryp = 1; |
236 |
else |
else |
237 |
++in_readline; |
++in_readline; |
238 |
#ifdef USE_THREADS |
#ifdef USE_THREADS |
239 |
scm_mutex_unlock (&reentry_barrier_mutex); |
scm_unlock_mutex (reentry_barrier_mutex); |
240 |
#endif |
#endif |
241 |
if (reentryp) |
if (reentryp) |
242 |
scm_misc_error (s_scm_readline, "readline is not reentrant", SCM_EOL); |
scm_misc_error (s_scm_readline, "readline is not reentrant", SCM_EOL); |
577 |
#endif |
#endif |
578 |
|
|
579 |
#ifdef USE_THREADS |
#ifdef USE_THREADS |
580 |
scm_mutex_init (&reentry_barrier_mutex); |
reentry_barrier_mutex = scm_permanent_object (scm_make_mutex ()); |
581 |
#endif |
#endif |
582 |
scm_init_opts (scm_readline_options, |
scm_init_opts (scm_readline_options, |
583 |
scm_readline_opts, |
scm_readline_opts, |