* readline.c, readline.h (scm_readline_options,
authorMikael Djurfeldt <djurfeldt@nada.kth.se>
Mon, 9 Nov 1998 14:15:30 +0000 (14:15 +0000)
committerMikael Djurfeldt <djurfeldt@nada.kth.se>
Mon, 9 Nov 1998 14:15:30 +0000 (14:15 +0000)
scm_readline_opts): Moved readline options here.

libguile/readline.c
libguile/readline.h

index 63150b9..7861e0d 100644 (file)
 #include <readline/readline.h>
 #include <readline/history.h>
 
+scm_option scm_readline_opts[] = {
+  { SCM_OPTION_BOOLEAN, "history-file", 1,
+    "Use history file." },
+  { SCM_OPTION_INTEGER, "history-length", 200,
+    "History length." }
+};
+
+extern void stifle_history (int max);
+
+SCM_PROC (s_readline_options, "readline-options-interface", 0, 1, 0, scm_readline_options);
+
+SCM
+scm_readline_options (setting)
+     SCM setting;
+{
+  SCM ans = scm_options (setting,
+                        scm_readline_opts,
+                        SCM_N_READLINE_OPTIONS,
+                        s_readline_options);
+  stifle_history (SCM_HISTORY_LENGTH);
+  return ans;
+}
+
 #ifndef HAVE_STRDUP
 static char *
 strdup (char *s)
@@ -350,6 +373,9 @@ scm_init_readline ()
 #ifdef USE_THREADS
   scm_mutex_init (&reentry_barrier_mutex);
 #endif
+  scm_init_opts (scm_readline_options,
+                scm_readline_opts,
+                SCM_N_READLINE_OPTIONS);
   scm_add_feature ("readline");
 }
 
index 15901f5..c29a4ba 100644 (file)
 
 #include "libguile/__scm.h"
 
+extern scm_option scm_readline_opts[];
+
+#define SCM_HISTORY_FILE_P     scm_readline_opts[0].val
+#define SCM_HISTORY_LENGTH     scm_readline_opts[1].val
+#define SCM_N_READLINE_OPTIONS 2
+
+extern SCM scm_readline_options (SCM setting);
 extern SCM scm_readline (SCM txt, SCM inp, SCM outp, SCM read_hook);
 extern SCM scm_add_history (SCM txt);
 extern SCM scm_read_history (SCM file);