1999-07-23 21:43:58 +00:00
|
|
|
|
/* readline.c --- line editing support for Guile */
|
|
|
|
|
|
|
2003-04-05 15:34:17 +00:00
|
|
|
|
/* Copyright (C) 1997,1999,2000,2001, 2002, 2003 Free Software Foundation, Inc.
|
1999-07-23 21:43:58 +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
|
1999-08-06 07:26:07 +00:00
|
|
|
|
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
|
|
|
|
* Boston, MA 02111-1307 USA
|
1999-07-23 21:43:58 +00:00
|
|
|
|
*
|
|
|
|
|
|
*/
|
1999-12-13 03:57:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
1999-07-23 21:43:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
2003-03-19 23:46:29 +00:00
|
|
|
|
#if HAVE_CONFIG_H
|
|
|
|
|
|
# include <config.h>
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
1999-07-24 11:40:11 +00:00
|
|
|
|
#include "libguile/_scm.h"
|
2000-06-06 12:44:17 +00:00
|
|
|
|
#ifdef HAVE_RL_GETC_FUNCTION
|
2000-05-01 22:12:43 +00:00
|
|
|
|
#include "libguile.h"
|
1999-07-24 11:40:11 +00:00
|
|
|
|
#include "libguile/gh.h"
|
|
|
|
|
|
#include "libguile/iselect.h"
|
|
|
|
|
|
|
2001-03-09 23:31:55 +00:00
|
|
|
|
#include <stdio.h>
|
2000-06-14 15:03:01 +00:00
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
#endif
|
1999-07-23 21:43:58 +00:00
|
|
|
|
#include <readline/readline.h>
|
|
|
|
|
|
#include <readline/history.h>
|
2001-11-02 00:06:34 +00:00
|
|
|
|
#ifndef __MINGW32__
|
1999-07-23 21:43:58 +00:00
|
|
|
|
#include <sys/time.h>
|
2001-11-02 00:06:34 +00:00
|
|
|
|
#else
|
|
|
|
|
|
#include <io.h>
|
|
|
|
|
|
#endif
|
2000-06-19 00:42:39 +00:00
|
|
|
|
#include <signal.h>
|
1999-07-23 21:43:58 +00:00
|
|
|
|
|
2000-03-09 16:00:42 +00:00
|
|
|
|
#include "libguile/validate.h"
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "guile-readline/readline.h"
|
1999-07-23 21:43:58 +00:00
|
|
|
|
|
2001-06-14 19:51:54 +00:00
|
|
|
|
scm_t_option scm_readline_opts[] = {
|
1999-07-23 21:43:58 +00:00
|
|
|
|
{ SCM_OPTION_BOOLEAN, "history-file", 1,
|
|
|
|
|
|
"Use history file." },
|
|
|
|
|
|
{ SCM_OPTION_INTEGER, "history-length", 200,
|
|
|
|
|
|
"History length." },
|
|
|
|
|
|
{ SCM_OPTION_INTEGER, "bounce-parens", 500,
|
|
|
|
|
|
"Time (ms) to show matching opening parenthesis (0 = off)."}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
extern void stifle_history (int max);
|
|
|
|
|
|
|
2000-01-05 19:06:35 +00:00
|
|
|
|
SCM_DEFINE (scm_readline_options, "readline-options-interface", 0, 1, 0,
|
1999-12-13 03:57:29 +00:00
|
|
|
|
(SCM setting),
|
|
|
|
|
|
"")
|
|
|
|
|
|
#define FUNC_NAME s_scm_readline_options
|
1999-07-23 21:43:58 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM ans = scm_options (setting,
|
|
|
|
|
|
scm_readline_opts,
|
|
|
|
|
|
SCM_N_READLINE_OPTIONS,
|
1999-12-13 03:57:29 +00:00
|
|
|
|
FUNC_NAME);
|
1999-07-23 21:43:58 +00:00
|
|
|
|
stifle_history (SCM_HISTORY_LENGTH);
|
|
|
|
|
|
return ans;
|
|
|
|
|
|
}
|
1999-12-13 03:57:29 +00:00
|
|
|
|
#undef FUNC_NAME
|
1999-07-23 21:43:58 +00:00
|
|
|
|
|
|
|
|
|
|
#ifndef HAVE_STRDUP
|
|
|
|
|
|
static char *
|
|
|
|
|
|
strdup (char *s)
|
|
|
|
|
|
{
|
* validate.h
(SCM_NUM2{SIZE,PTRDIFF,SHORT,USHORT,BITS,UBITS,INT,UINT}[_DEF]):
new macros.
* unif.h: type renaming:
scm_array -> scm_array_t
scm_array_dim -> scm_array_dim_t
the old names are deprecated, all in-Guile uses changed.
* tags.h (scm_ubits_t): new typedef, representing unsigned
scm_bits_t.
* stacks.h: type renaming:
scm_info_frame -> scm_info_frame_t
scm_stack -> scm_stack_t
the old names are deprecated, all in-Guile uses changed.
* srcprop.h: type renaming:
scm_srcprops -> scm_srcprops_t
scm_srcprops_chunk -> scm_srcprops_chunk_t
the old names are deprecated, all in-Guile uses changed.
* gsubr.c, procs.c, print.c, ports.c, read.c, rdelim.c, ramap.c,
rw.c, smob.c, sort.c, srcprop.c, stacks.c, strings.c, strop.c,
strorder.c, strports.c, struct.c, symbols.c, unif.c, values.c,
vectors.c, vports.c, weaks.c:
various int/size_t -> size_t/scm_bits_t changes.
* random.h: type renaming:
scm_rstate -> scm_rstate_t
scm_rng -> scm_rng_t
scm_i_rstate -> scm_i_rstate_t
the old names are deprecated, all in-Guile uses changed.
* procs.h: type renaming:
scm_subr_entry -> scm_subr_entry_t
the old name is deprecated, all in-Guile uses changed.
* options.h (scm_option_t.val): unsigned long -> scm_bits_t.
type renaming:
scm_option -> scm_option_t
the old name is deprecated, all in-Guile uses changed.
* objects.c: various long -> scm_bits_t changes.
(scm_i_make_class_object): flags: unsigned long -> scm_ubits_t
* numbers.h (SCM_FIXNUM_BIT): deprecated, renamed to
SCM_I_FIXNUM_BIT.
* num2integral.i.c: new file, multiply included by numbers.c, used
to "templatize" the various integral <-> num conversion routines.
* numbers.c (scm_mkbig, scm_big2num, scm_adjbig, scm_normbig,
scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl):
deprecated.
(scm_i_mkbig, scm_i_big2inum, scm_i_adjbig, scm_i_normbig,
scm_i_copybig, scm_i_short2big, scm_i_ushort2big, scm_i_int2big,
scm_i_uint2big, scm_i_long2big, scm_i_ulong2big, scm_i_bits2big,
scm_i_ubits2big, scm_i_size2big, scm_i_ptrdiff2big,
scm_i_long_long2big, scm_i_ulong_long2big, scm_i_dbl2big,
scm_i_big2dbl, scm_short2num, scm_ushort2num, scm_int2num,
scm_uint2num, scm_bits2num, scm_ubits2num, scm_size2num,
scm_ptrdiff2num, scm_num2short, scm_num2ushort, scm_num2int,
scm_num2uint, scm_num2bits, scm_num2ubits, scm_num2ptrdiff,
scm_num2size): new functions.
* modules.c (scm_module_reverse_lookup): i, n: int -> scm_bits_t.x
* load.c: change int -> size_t in various places (where the
variable is used to store a string length).
(search-path): call scm_done_free, not scm_done_malloc.
* list.c (scm_ilength): return a scm_bits_t, not long.
some other {int,long} -> scm_bits_t changes.
* hashtab.c: various [u]int -> scm_bits_t changes.
scm_ihashx_closure -> scm_ihashx_closure_t (and made a typedef).
(scm_ihashx): n: uint -> scm_bits_t
use scm_bits2num instead of scm_ulong2num.
* gsubr.c: various int -> scm_bits_t changes.
* gh_data.c (gh_scm2double): no loss of precision any more.
* gh.h (gh_str2scm): len: int -> size_t
(gh_{get,set}_substr): start: int -> scm_bits_t,
len: int -> size_t
(gh_<num>2scm): n: int -> scm_bits_t
(gh_*vector_length): return scm_[u]size_t, not unsigned long.
(gh_length): return scm_bits_t, not unsigned long.
* fports.h: type renaming:
scm_fport -> scm_fport_t
the old name is deprecated, all in-Guile uses changed.
* fports.c (fport_fill_input): count: int -> scm_bits_t
(fport_flush): init_size, remaining, count: int -> scm_bits_t
* debug.h (scm_lookup_cstr, scm_lookup_soft, scm_evstr): removed
those prototypes, as the functions they prototype don't exist.
* fports.c (default_buffer_size): int -> size_t
(scm_fport_buffer_add): read_size, write_size: int -> scm_bits_t
default_size: int -> size_t
(scm_setvbuf): csize: int -> scm_bits_t
* fluids.c (n_fluids): int -> scm_bits_t
(grow_fluids): old_length, i: int -> scm_bits_t
(next_fluid_num, scm_fluid_ref, scm_fluid_set_x): n: int ->
scm_bits_t
(scm_c_with_fluids): flen, vlen: int -> scm_bits_t
* filesys.c (s_scm_open_fdes): changed calls to SCM_NUM2LONG to
the new and shiny SCM_NUM2INT.
* extensions.c: extension -> extension_t (and made a typedef).
* eval.h (SCM_IFRAME): cast to scm_bits_t, not int. just so
there are no nasty surprises if/when the various deeply magic tag
bits move somewhere else.
* eval.c: changed the locals used to store results of SCM_IFRAME,
scm_ilength and such to be of type scm_bits_t (and not int/long).
(iqq): depth, edepth: int -> scm_bits_t
(scm_eval_stack): int -> scm_bits_t
(SCM_CEVAL): various vars are not scm_bits_t instead of int.
(check_map_args, scm_map, scm_for_each): len: long -> scm_bits_t
i: int -> scm_bits_t
* environments.c: changed the many calls to scm_ulong2num to
scm_ubits2num.
(import_environment_fold): proc_as_ul: ulong -> scm_ubits_t
* dynwind.c (scm_dowinds): delta: long -> scm_bits_t
* debug.h: type renaming:
scm_debug_info -> scm_debug_info_t
scm_debug_frame -> scm_debug_frame_t
the old names are deprecated, all in-Guile uses changed.
(scm_debug_eframe_size): int -> scm_bits_t
* debug.c (scm_init_debug): use scm_c_define instead of the
deprecated scm_define.
* continuations.h: type renaming:
scm_contregs -> scm_contregs_t
the old name is deprecated, all in-Guile uses changed.
(scm_contregs_t.num_stack_items): size_t -> scm_bits_t
(scm_contregs_t.num_stack_items): ulong -> scm_ubits_t
* continuations.c (scm_make_continuation): change the type of
stack_size form long to scm_bits_t.
* ports.h: type renaming:
scm_port_rw_active -> scm_port_rw_active_t (and made a typedef)
scm_port -> scm_port_t
scm_ptob_descriptor -> scm_ptob_descriptor_t
the old names are deprecated, all in-Guile uses changed.
(scm_port_t.entry): int -> scm_bits_t.
(scm_port_t.line_number): int -> long.
(scm_port_t.putback_buf_size): int -> size_t.
* __scm.h (long_long, ulong_long): deprecated (they pollute the
global namespace and have little value besides that).
(SCM_BITS_LENGTH): new, is the bit size of scm_bits_t (i.e. of an
SCM handle).
(ifdef spaghetti): include sys/types.h and sys/stdtypes.h, if they
exist (for size_t & ptrdiff_t)
(scm_sizet): deprecated.
* Makefile.am (noinst_HEADERS): add num2integral.i.c
2001-05-24 00:50:51 +00:00
|
|
|
|
size_t len = strlen (s);
|
1999-07-23 21:43:58 +00:00
|
|
|
|
char *new = malloc (len + 1);
|
|
|
|
|
|
strcpy (new, s);
|
|
|
|
|
|
return new;
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif /* HAVE_STRDUP */
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef HAVE_RL_CLEANUP_AFTER_SIGNAL
|
|
|
|
|
|
|
|
|
|
|
|
/* These are readline functions added in release 2.3. They will work
|
|
|
|
|
|
* together with readline-2.1 and 2.2. (The readline interface is
|
|
|
|
|
|
* disabled for earlier releases.)
|
|
|
|
|
|
* They are declared static; if we want to use them elsewhere, then
|
|
|
|
|
|
* we need external declarations for them, but at the moment, I don't
|
|
|
|
|
|
* think anything else in Guile ought to use these.
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
extern void _rl_clean_up_for_exit ();
|
|
|
|
|
|
extern void _rl_kill_kbd_macro ();
|
|
|
|
|
|
extern int _rl_init_argument ();
|
|
|
|
|
|
|
1999-08-29 18:02:19 +00:00
|
|
|
|
void
|
1999-07-23 21:43:58 +00:00
|
|
|
|
rl_cleanup_after_signal ()
|
|
|
|
|
|
{
|
|
|
|
|
|
#ifdef HAVE_RL_CLEAR_SIGNALS
|
|
|
|
|
|
_rl_clean_up_for_exit ();
|
|
|
|
|
|
#endif
|
|
|
|
|
|
(*rl_deprep_term_function) ();
|
|
|
|
|
|
#ifdef HAVE_RL_CLEAR_SIGNALS
|
|
|
|
|
|
rl_clear_signals ();
|
|
|
|
|
|
#endif
|
|
|
|
|
|
rl_pending_input = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
1999-08-29 18:02:19 +00:00
|
|
|
|
void
|
1999-07-23 21:43:58 +00:00
|
|
|
|
rl_free_line_state ()
|
|
|
|
|
|
{
|
|
|
|
|
|
register HIST_ENTRY *entry;
|
|
|
|
|
|
|
|
|
|
|
|
free_undo_list ();
|
|
|
|
|
|
|
|
|
|
|
|
entry = current_history ();
|
|
|
|
|
|
if (entry)
|
|
|
|
|
|
entry->data = (char *)NULL;
|
|
|
|
|
|
|
|
|
|
|
|
_rl_kill_kbd_macro ();
|
|
|
|
|
|
rl_clear_message ();
|
|
|
|
|
|
_rl_init_argument ();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* !HAVE_RL_CLEANUP_AFTER_SIGNAL */
|
|
|
|
|
|
|
|
|
|
|
|
static int promptp;
|
|
|
|
|
|
static SCM input_port;
|
|
|
|
|
|
static SCM before_read;
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2001-06-07 21:12:19 +00:00
|
|
|
|
current_input_getc (FILE *in SCM_UNUSED)
|
1999-07-23 21:43:58 +00:00
|
|
|
|
{
|
2004-07-10 15:25:01 +00:00
|
|
|
|
if (promptp && scm_is_true (before_read))
|
1999-07-23 21:43:58 +00:00
|
|
|
|
{
|
|
|
|
|
|
scm_apply (before_read, SCM_EOL, SCM_EOL);
|
|
|
|
|
|
promptp = 0;
|
|
|
|
|
|
}
|
2000-03-12 16:02:46 +00:00
|
|
|
|
return scm_getc (input_port);
|
1999-07-23 21:43:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int in_readline = 0;
|
2002-10-27 20:27:10 +00:00
|
|
|
|
static SCM reentry_barrier_mutex;
|
1999-07-23 21:43:58 +00:00
|
|
|
|
|
1999-12-13 03:57:29 +00:00
|
|
|
|
static SCM internal_readline (SCM text);
|
|
|
|
|
|
static SCM handle_error (void *data, SCM tag, SCM args);
|
2000-06-14 15:03:01 +00:00
|
|
|
|
static void reentry_barrier (void);
|
1999-12-13 03:57:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:06:35 +00:00
|
|
|
|
SCM_DEFINE (scm_readline, "%readline", 0, 4, 0,
|
1999-12-13 03:57:29 +00:00
|
|
|
|
(SCM text, SCM inp, SCM outp, SCM read_hook),
|
|
|
|
|
|
"")
|
|
|
|
|
|
#define FUNC_NAME s_scm_readline
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM ans;
|
|
|
|
|
|
|
|
|
|
|
|
reentry_barrier ();
|
|
|
|
|
|
|
|
|
|
|
|
before_read = SCM_BOOL_F;
|
|
|
|
|
|
|
|
|
|
|
|
if (!SCM_UNBNDP (text))
|
|
|
|
|
|
{
|
2004-08-19 17:28:53 +00:00
|
|
|
|
if (!scm_is_string (text))
|
1999-12-13 03:57:29 +00:00
|
|
|
|
{
|
|
|
|
|
|
--in_readline;
|
|
|
|
|
|
scm_wrong_type_arg (s_scm_readline, SCM_ARG1, text);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2000-11-24 10:38:57 +00:00
|
|
|
|
if (!((SCM_UNBNDP (inp) && SCM_OPINFPORTP (scm_cur_inp))
|
|
|
|
|
|
|| SCM_OPINFPORTP (inp)))
|
1999-12-13 03:57:29 +00:00
|
|
|
|
{
|
|
|
|
|
|
--in_readline;
|
|
|
|
|
|
scm_misc_error (s_scm_readline,
|
|
|
|
|
|
"Input port is not open or not a file port",
|
|
|
|
|
|
SCM_EOL);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2003-01-08 21:36:20 +00:00
|
|
|
|
if (!((SCM_UNBNDP (outp) && SCM_OPOUTFPORTP (scm_cur_outp))
|
2000-11-24 10:38:57 +00:00
|
|
|
|
|| SCM_OPOUTFPORTP (outp)))
|
1999-12-13 03:57:29 +00:00
|
|
|
|
{
|
|
|
|
|
|
--in_readline;
|
|
|
|
|
|
scm_misc_error (s_scm_readline,
|
|
|
|
|
|
"Output port is not open or not a file port",
|
|
|
|
|
|
SCM_EOL);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2004-07-10 15:25:01 +00:00
|
|
|
|
if (!(SCM_UNBNDP (read_hook) || scm_is_false (read_hook)))
|
1999-12-13 03:57:29 +00:00
|
|
|
|
{
|
2004-07-10 15:25:01 +00:00
|
|
|
|
if (scm_is_false (scm_thunk_p (read_hook)))
|
1999-12-13 03:57:29 +00:00
|
|
|
|
{
|
|
|
|
|
|
--in_readline;
|
|
|
|
|
|
scm_wrong_type_arg (s_scm_readline, SCM_ARG4, read_hook);
|
|
|
|
|
|
}
|
|
|
|
|
|
before_read = read_hook;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
scm_readline_init_ports (inp, outp);
|
|
|
|
|
|
|
|
|
|
|
|
ans = scm_internal_catch (SCM_BOOL_T,
|
2001-06-14 19:51:54 +00:00
|
|
|
|
(scm_t_catch_body) internal_readline,
|
2000-04-04 10:46:08 +00:00
|
|
|
|
(void *) SCM_UNPACK (text),
|
1999-12-13 03:57:29 +00:00
|
|
|
|
handle_error, 0);
|
|
|
|
|
|
|
2001-11-04 15:52:30 +00:00
|
|
|
|
#ifndef __MINGW32__
|
1999-12-13 03:57:29 +00:00
|
|
|
|
fclose (rl_instream);
|
|
|
|
|
|
fclose (rl_outstream);
|
2001-11-04 15:52:30 +00:00
|
|
|
|
#endif
|
1999-12-13 03:57:29 +00:00
|
|
|
|
|
|
|
|
|
|
--in_readline;
|
|
|
|
|
|
return ans;
|
|
|
|
|
|
}
|
|
|
|
|
|
#undef FUNC_NAME
|
|
|
|
|
|
|
|
|
|
|
|
|
1999-07-23 21:43:58 +00:00
|
|
|
|
static void
|
|
|
|
|
|
reentry_barrier ()
|
|
|
|
|
|
{
|
|
|
|
|
|
int reentryp = 0;
|
2002-11-02 00:59:04 +00:00
|
|
|
|
/* We should rather use scm_try_mutex when it becomes available */
|
2002-10-27 20:27:10 +00:00
|
|
|
|
scm_lock_mutex (reentry_barrier_mutex);
|
1999-07-23 21:43:58 +00:00
|
|
|
|
if (in_readline)
|
|
|
|
|
|
reentryp = 1;
|
|
|
|
|
|
else
|
|
|
|
|
|
++in_readline;
|
2002-10-27 20:27:10 +00:00
|
|
|
|
scm_unlock_mutex (reentry_barrier_mutex);
|
1999-07-23 21:43:58 +00:00
|
|
|
|
if (reentryp)
|
1999-12-13 03:57:29 +00:00
|
|
|
|
scm_misc_error (s_scm_readline, "readline is not reentrant", SCM_EOL);
|
1999-07-23 21:43:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
|
handle_error (void *data, SCM tag, SCM args)
|
|
|
|
|
|
{
|
|
|
|
|
|
rl_free_line_state ();
|
|
|
|
|
|
rl_cleanup_after_signal ();
|
1999-07-24 11:40:11 +00:00
|
|
|
|
fputc ('\n', rl_outstream); /* We don't want next output on this line */
|
2001-11-04 15:52:30 +00:00
|
|
|
|
#ifndef __MINGW32__
|
1999-07-23 21:43:58 +00:00
|
|
|
|
fclose (rl_instream);
|
|
|
|
|
|
fclose (rl_outstream);
|
2001-11-04 15:52:30 +00:00
|
|
|
|
#endif
|
1999-07-23 21:43:58 +00:00
|
|
|
|
--in_readline;
|
|
|
|
|
|
scm_handle_by_throw (data, tag, args);
|
|
|
|
|
|
return SCM_UNSPECIFIED; /* never reached */
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
|
internal_readline (SCM text)
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM ret;
|
|
|
|
|
|
char *s;
|
2004-08-19 17:28:53 +00:00
|
|
|
|
char *prompt = SCM_UNBNDP (text) ? "" : scm_to_locale_string (text);
|
1999-07-23 21:43:58 +00:00
|
|
|
|
|
|
|
|
|
|
promptp = 1;
|
|
|
|
|
|
s = readline (prompt);
|
|
|
|
|
|
if (s)
|
2004-08-19 17:28:53 +00:00
|
|
|
|
ret = scm_from_locale_string (s);
|
1999-07-23 21:43:58 +00:00
|
|
|
|
else
|
|
|
|
|
|
ret = SCM_EOF_VAL;
|
|
|
|
|
|
|
2004-08-19 17:28:53 +00:00
|
|
|
|
if (!SCM_UNBNDP (text))
|
|
|
|
|
|
free (prompt);
|
1999-07-23 21:43:58 +00:00
|
|
|
|
free (s);
|
|
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static FILE *
|
|
|
|
|
|
stream_from_fport (SCM port, char *mode, const char *subr)
|
|
|
|
|
|
{
|
|
|
|
|
|
int fd;
|
|
|
|
|
|
FILE *f;
|
|
|
|
|
|
|
2001-06-14 19:51:54 +00:00
|
|
|
|
fd = dup (((struct scm_t_fport *) SCM_STREAM (port))->fdes);
|
1999-07-23 21:43:58 +00:00
|
|
|
|
if (fd == -1)
|
|
|
|
|
|
{
|
|
|
|
|
|
--in_readline;
|
|
|
|
|
|
scm_syserror (subr);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
f = fdopen (fd, mode);
|
|
|
|
|
|
if (f == NULL)
|
|
|
|
|
|
{
|
|
|
|
|
|
--in_readline;
|
|
|
|
|
|
scm_syserror (subr);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return f;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
1999-08-29 18:02:19 +00:00
|
|
|
|
void
|
|
|
|
|
|
scm_readline_init_ports (SCM inp, SCM outp)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (SCM_UNBNDP (inp))
|
|
|
|
|
|
inp = scm_cur_inp;
|
|
|
|
|
|
|
|
|
|
|
|
if (SCM_UNBNDP (outp))
|
|
|
|
|
|
outp = scm_cur_outp;
|
|
|
|
|
|
|
2000-11-24 10:38:57 +00:00
|
|
|
|
if (!SCM_OPINFPORTP (inp)) {
|
1999-08-29 18:02:19 +00:00
|
|
|
|
scm_misc_error (0,
|
|
|
|
|
|
"Input port is not open or not a file port",
|
|
|
|
|
|
SCM_EOL);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2000-11-24 10:38:57 +00:00
|
|
|
|
if (!SCM_OPOUTFPORTP (outp)) {
|
1999-08-29 18:02:19 +00:00
|
|
|
|
scm_misc_error (0,
|
|
|
|
|
|
"Output port is not open or not a file port",
|
|
|
|
|
|
SCM_EOL);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
input_port = inp;
|
2001-11-04 15:52:30 +00:00
|
|
|
|
#ifndef __MINGW32__
|
1999-12-13 03:57:29 +00:00
|
|
|
|
rl_instream = stream_from_fport (inp, "r", s_scm_readline);
|
|
|
|
|
|
rl_outstream = stream_from_fport (outp, "w", s_scm_readline);
|
2001-11-04 15:52:30 +00:00
|
|
|
|
#endif
|
1999-08-29 18:02:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
1999-07-23 21:43:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:06:35 +00:00
|
|
|
|
SCM_DEFINE (scm_add_history, "add-history", 1, 0, 0,
|
1999-12-13 03:57:29 +00:00
|
|
|
|
(SCM text),
|
|
|
|
|
|
"")
|
|
|
|
|
|
#define FUNC_NAME s_scm_add_history
|
1999-07-23 21:43:58 +00:00
|
|
|
|
{
|
|
|
|
|
|
char* s;
|
|
|
|
|
|
|
2004-08-19 17:28:53 +00:00
|
|
|
|
s = scm_to_locale_string (text);
|
|
|
|
|
|
add_history (s);
|
1999-07-23 21:43:58 +00:00
|
|
|
|
|
|
|
|
|
|
return SCM_UNSPECIFIED;
|
|
|
|
|
|
}
|
1999-12-13 03:57:29 +00:00
|
|
|
|
#undef FUNC_NAME
|
1999-07-23 21:43:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:06:35 +00:00
|
|
|
|
SCM_DEFINE (scm_read_history, "read-history", 1, 0, 0,
|
1999-12-13 03:57:29 +00:00
|
|
|
|
(SCM file),
|
|
|
|
|
|
"")
|
|
|
|
|
|
#define FUNC_NAME s_scm_read_history
|
1999-07-23 21:43:58 +00:00
|
|
|
|
{
|
2004-08-19 17:28:53 +00:00
|
|
|
|
char *filename;
|
|
|
|
|
|
SCM ret;
|
|
|
|
|
|
|
|
|
|
|
|
filename = scm_to_locale_string (file);
|
|
|
|
|
|
ret = scm_from_bool (!read_history (filename));
|
|
|
|
|
|
free (filename);
|
|
|
|
|
|
return ret;
|
1999-07-23 21:43:58 +00:00
|
|
|
|
}
|
1999-12-13 03:57:29 +00:00
|
|
|
|
#undef FUNC_NAME
|
1999-07-23 21:43:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:06:35 +00:00
|
|
|
|
SCM_DEFINE (scm_write_history, "write-history", 1, 0, 0,
|
1999-12-13 03:57:29 +00:00
|
|
|
|
(SCM file),
|
|
|
|
|
|
"")
|
|
|
|
|
|
#define FUNC_NAME s_scm_write_history
|
1999-07-23 21:43:58 +00:00
|
|
|
|
{
|
2004-08-19 17:28:53 +00:00
|
|
|
|
char *filename;
|
|
|
|
|
|
SCM ret;
|
|
|
|
|
|
|
|
|
|
|
|
filename = scm_to_locale_string (file);
|
|
|
|
|
|
ret = scm_from_bool (!write_history (filename));
|
|
|
|
|
|
free (filename);
|
|
|
|
|
|
return ret;
|
1999-07-23 21:43:58 +00:00
|
|
|
|
}
|
1999-12-13 03:57:29 +00:00
|
|
|
|
#undef FUNC_NAME
|
1999-07-23 21:43:58 +00:00
|
|
|
|
|
2001-04-10 23:48:27 +00:00
|
|
|
|
SCM_DEFINE (scm_clear_history, "clear-history", 0, 0, 0,
|
|
|
|
|
|
(),
|
|
|
|
|
|
"Clear the history buffer of the readline machinery.")
|
|
|
|
|
|
#define FUNC_NAME s_scm_clear_history
|
|
|
|
|
|
{
|
|
|
|
|
|
clear_history();
|
|
|
|
|
|
return SCM_UNSPECIFIED;
|
|
|
|
|
|
}
|
|
|
|
|
|
#undef FUNC_NAME
|
|
|
|
|
|
|
1999-07-23 21:43:58 +00:00
|
|
|
|
|
2000-01-05 19:06:35 +00:00
|
|
|
|
SCM_DEFINE (scm_filename_completion_function, "filename-completion-function", 2, 0, 0,
|
1999-12-13 03:57:29 +00:00
|
|
|
|
(SCM text, SCM continuep),
|
|
|
|
|
|
"")
|
|
|
|
|
|
#define FUNC_NAME s_scm_filename_completion_function
|
1999-07-23 21:43:58 +00:00
|
|
|
|
{
|
|
|
|
|
|
char *s;
|
|
|
|
|
|
SCM ans;
|
2004-08-19 17:28:53 +00:00
|
|
|
|
char *c_text = scm_to_locale_string (text);
|
2001-06-14 17:42:45 +00:00
|
|
|
|
#ifdef HAVE_RL_FILENAME_COMPLETION_FUNCTION
|
2004-08-19 17:28:53 +00:00
|
|
|
|
s = rl_filename_completion_function (c_text, scm_is_true (continuep));
|
2001-06-14 17:42:45 +00:00
|
|
|
|
#else
|
2004-08-19 17:28:53 +00:00
|
|
|
|
s = filename_completion_function (c_text, scm_is_true (continuep));
|
2001-06-14 17:42:45 +00:00
|
|
|
|
#endif
|
2004-08-19 17:28:53 +00:00
|
|
|
|
ans = scm_take_locale_string (s);
|
|
|
|
|
|
free (c_text);
|
1999-07-23 21:43:58 +00:00
|
|
|
|
return ans;
|
|
|
|
|
|
}
|
1999-12-13 03:57:29 +00:00
|
|
|
|
#undef FUNC_NAME
|
1999-07-23 21:43:58 +00:00
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
* The following has been modified from code contributed by
|
|
|
|
|
|
* Andrew Archibald <aarchiba@undergrad.math.uwaterloo.ca>
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
SCM scm_readline_completion_function_var;
|
|
|
|
|
|
|
|
|
|
|
|
static char *
|
|
|
|
|
|
completion_function (char *text, int continuep)
|
|
|
|
|
|
{
|
2001-05-15 14:59:42 +00:00
|
|
|
|
SCM compfunc = SCM_VARIABLE_REF (scm_readline_completion_function_var);
|
1999-07-23 21:43:58 +00:00
|
|
|
|
SCM res;
|
|
|
|
|
|
|
2004-07-10 15:25:01 +00:00
|
|
|
|
if (scm_is_false (compfunc))
|
1999-07-23 21:43:58 +00:00
|
|
|
|
return NULL; /* #f => completion disabled */
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2004-08-19 17:28:53 +00:00
|
|
|
|
SCM t = scm_from_locale_string (text);
|
2004-07-10 15:25:01 +00:00
|
|
|
|
SCM c = scm_from_bool (continuep);
|
2001-06-30 19:28:26 +00:00
|
|
|
|
res = scm_apply (compfunc, scm_list_2 (t, c), SCM_EOL);
|
1999-07-23 21:43:58 +00:00
|
|
|
|
|
2004-07-10 15:25:01 +00:00
|
|
|
|
if (scm_is_false (res))
|
1999-07-23 21:43:58 +00:00
|
|
|
|
return NULL;
|
|
|
|
|
|
|
2004-08-19 17:28:53 +00:00
|
|
|
|
return scm_to_locale_string (res);
|
1999-07-23 21:43:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*Bouncing parenthesis (reimplemented by GH, 11/23/98, since readline is strict gpl)*/
|
|
|
|
|
|
|
2000-01-09 17:01:34 +00:00
|
|
|
|
static int match_paren (int x, int k);
|
|
|
|
|
|
static int find_matching_paren (int k);
|
|
|
|
|
|
static void init_bouncing_parens ();
|
1999-07-23 21:43:58 +00:00
|
|
|
|
|
|
|
|
|
|
static void
|
2000-01-09 17:01:34 +00:00
|
|
|
|
init_bouncing_parens ()
|
1999-07-23 21:43:58 +00:00
|
|
|
|
{
|
2000-01-09 17:01:34 +00:00
|
|
|
|
if (strncmp (rl_get_keymap_name (rl_get_keymap ()), "vi", 2))
|
|
|
|
|
|
{
|
|
|
|
|
|
rl_bind_key (')', match_paren);
|
|
|
|
|
|
rl_bind_key (']', match_paren);
|
|
|
|
|
|
rl_bind_key ('}', match_paren);
|
|
|
|
|
|
}
|
1999-07-23 21:43:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
|
find_matching_paren(int k)
|
|
|
|
|
|
{
|
|
|
|
|
|
register int i;
|
|
|
|
|
|
register char c = 0;
|
|
|
|
|
|
int end_parens_found = 0;
|
|
|
|
|
|
|
|
|
|
|
|
/* Choose the corresponding opening bracket. */
|
|
|
|
|
|
if (k == ')') c = '(';
|
|
|
|
|
|
else if (k == ']') c = '[';
|
|
|
|
|
|
else if (k == '}') c = '{';
|
|
|
|
|
|
|
|
|
|
|
|
for (i=rl_point-2; i>=0; i--)
|
|
|
|
|
|
{
|
|
|
|
|
|
/* Is the current character part of a character literal? */
|
|
|
|
|
|
if (i - 2 >= 0
|
|
|
|
|
|
&& rl_line_buffer[i - 1] == '\\'
|
|
|
|
|
|
&& rl_line_buffer[i - 2] == '#')
|
|
|
|
|
|
;
|
|
|
|
|
|
else if (rl_line_buffer[i] == k)
|
|
|
|
|
|
end_parens_found++;
|
|
|
|
|
|
else if (rl_line_buffer[i] == '"')
|
|
|
|
|
|
{
|
|
|
|
|
|
/* Skip over a string literal. */
|
|
|
|
|
|
for (i--; i >= 0; i--)
|
|
|
|
|
|
if (rl_line_buffer[i] == '"'
|
|
|
|
|
|
&& ! (i - 1 >= 0
|
|
|
|
|
|
&& rl_line_buffer[i - 1] == '\\'))
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (rl_line_buffer[i] == c)
|
|
|
|
|
|
{
|
2000-01-09 17:01:34 +00:00
|
|
|
|
if (end_parens_found==0)
|
|
|
|
|
|
return i;
|
1999-07-23 21:43:58 +00:00
|
|
|
|
else --end_parens_found;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2000-01-09 17:01:34 +00:00
|
|
|
|
static int
|
|
|
|
|
|
match_paren (int x, int k)
|
1999-07-23 21:43:58 +00:00
|
|
|
|
{
|
2001-11-04 15:52:30 +00:00
|
|
|
|
int tmp;
|
|
|
|
|
|
#ifndef __MINGW32__
|
|
|
|
|
|
int fno;
|
2000-03-08 18:43:47 +00:00
|
|
|
|
SELECT_TYPE readset;
|
1999-07-23 21:43:58 +00:00
|
|
|
|
struct timeval timeout;
|
2001-11-04 15:52:30 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2000-01-09 17:01:34 +00:00
|
|
|
|
rl_insert (x, k);
|
1999-07-23 21:43:58 +00:00
|
|
|
|
if (!SCM_READLINE_BOUNCE_PARENS)
|
2000-01-09 17:01:34 +00:00
|
|
|
|
return 0;
|
1999-07-23 21:43:58 +00:00
|
|
|
|
|
|
|
|
|
|
/* Did we just insert a quoted paren? If so, then don't bounce. */
|
|
|
|
|
|
if (rl_point - 1 >= 1
|
|
|
|
|
|
&& rl_line_buffer[rl_point - 2] == '\\')
|
2000-01-09 17:01:34 +00:00
|
|
|
|
return 0;
|
1999-07-23 21:43:58 +00:00
|
|
|
|
|
2001-11-04 15:52:30 +00:00
|
|
|
|
#ifndef __MINGW32__
|
1999-07-23 21:43:58 +00:00
|
|
|
|
tmp = 1000 * SCM_READLINE_BOUNCE_PARENS;
|
|
|
|
|
|
timeout.tv_sec = tmp / 1000000;
|
|
|
|
|
|
timeout.tv_usec = tmp % 1000000;
|
2000-01-09 17:01:34 +00:00
|
|
|
|
FD_ZERO (&readset);
|
2000-03-12 16:02:46 +00:00
|
|
|
|
fno = fileno (rl_instream);
|
|
|
|
|
|
FD_SET (fno, &readset);
|
2001-11-04 15:52:30 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2000-01-09 17:01:34 +00:00
|
|
|
|
if (rl_point > 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
tmp = rl_point;
|
|
|
|
|
|
rl_point = find_matching_paren (k);
|
|
|
|
|
|
if (rl_point > -1)
|
|
|
|
|
|
{
|
|
|
|
|
|
rl_redisplay ();
|
2001-11-04 15:52:30 +00:00
|
|
|
|
#ifndef __MINGW32__
|
2000-03-12 16:02:46 +00:00
|
|
|
|
scm_internal_select (fno + 1, &readset, NULL, NULL, &timeout);
|
2001-11-04 15:52:30 +00:00
|
|
|
|
#else
|
|
|
|
|
|
WaitForSingleObject (GetStdHandle(STD_INPUT_HANDLE),
|
|
|
|
|
|
SCM_READLINE_BOUNCE_PARENS);
|
|
|
|
|
|
#endif
|
2000-01-09 17:01:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
rl_point = tmp;
|
1999-07-23 21:43:58 +00:00
|
|
|
|
}
|
2000-01-09 17:01:34 +00:00
|
|
|
|
return 0;
|
1999-07-23 21:43:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2000-06-19 00:42:39 +00:00
|
|
|
|
#if defined (HAVE_RL_PRE_INPUT_HOOK) && defined (GUILE_SIGWINCH_SA_RESTART_CLEARED)
|
|
|
|
|
|
/* Readline disables SA_RESTART on SIGWINCH.
|
|
|
|
|
|
* This code turns it back on.
|
|
|
|
|
|
*/
|
|
|
|
|
|
static int
|
|
|
|
|
|
sigwinch_enable_restart (void)
|
|
|
|
|
|
{
|
|
|
|
|
|
#ifdef HAVE_SIGINTERRUPT
|
|
|
|
|
|
siginterrupt (SIGWINCH, 0);
|
|
|
|
|
|
#else
|
|
|
|
|
|
struct sigaction action;
|
|
|
|
|
|
|
|
|
|
|
|
sigaction (SIGWINCH, NULL, &action);
|
|
|
|
|
|
action.sa_flags |= SA_RESTART;
|
|
|
|
|
|
sigaction (SIGWINCH, &action, NULL);
|
|
|
|
|
|
#endif
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2000-06-19 00:48:35 +00:00
|
|
|
|
#endif /* HAVE_RL_GETC_FUNCTION */
|
|
|
|
|
|
|
1999-07-23 21:43:58 +00:00
|
|
|
|
void
|
|
|
|
|
|
scm_init_readline ()
|
|
|
|
|
|
{
|
2000-06-06 12:44:17 +00:00
|
|
|
|
#ifdef HAVE_RL_GETC_FUNCTION
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "guile-readline/readline.x"
|
1999-07-23 21:43:58 +00:00
|
|
|
|
scm_readline_completion_function_var
|
2001-05-15 14:59:42 +00:00
|
|
|
|
= scm_c_define ("*readline-completion-function*", SCM_BOOL_F);
|
2001-11-04 15:52:30 +00:00
|
|
|
|
#ifndef __MINGW32__
|
1999-07-23 21:43:58 +00:00
|
|
|
|
rl_getc_function = current_input_getc;
|
2001-11-04 15:52:30 +00:00
|
|
|
|
#endif
|
2001-06-14 17:42:45 +00:00
|
|
|
|
#if defined (_RL_FUNCTION_TYPEDEF)
|
|
|
|
|
|
rl_completion_entry_function = (rl_compentry_func_t*) completion_function;
|
|
|
|
|
|
#else
|
1999-07-23 21:43:58 +00:00
|
|
|
|
rl_completion_entry_function = (Function*) completion_function;
|
2001-06-14 17:42:45 +00:00
|
|
|
|
#endif
|
1999-07-23 21:43:58 +00:00
|
|
|
|
rl_basic_word_break_characters = "\t\n\"'`;()";
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
rl_readline_name = "Guile";
|
2000-06-19 00:42:39 +00:00
|
|
|
|
#if defined (HAVE_RL_PRE_INPUT_HOOK) && defined (GUILE_SIGWINCH_SA_RESTART_CLEARED)
|
|
|
|
|
|
rl_pre_input_hook = sigwinch_enable_restart;
|
|
|
|
|
|
#endif
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
|
2002-10-27 20:27:10 +00:00
|
|
|
|
reentry_barrier_mutex = scm_permanent_object (scm_make_mutex ());
|
1999-07-23 21:43:58 +00:00
|
|
|
|
scm_init_opts (scm_readline_options,
|
|
|
|
|
|
scm_readline_opts,
|
|
|
|
|
|
SCM_N_READLINE_OPTIONS);
|
|
|
|
|
|
init_bouncing_parens();
|
|
|
|
|
|
scm_add_feature ("readline");
|
2000-06-06 12:44:17 +00:00
|
|
|
|
#endif /* HAVE_RL_GETC_FUNCTION */
|
1999-07-23 21:43:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2000-03-19 19:01:16 +00:00
|
|
|
|
/*
|
|
|
|
|
|
Local Variables:
|
|
|
|
|
|
c-file-style: "gnu"
|
|
|
|
|
|
End:
|
|
|
|
|
|
*/
|