Index: Makefile.in ================================================================== --- Makefile.in +++ Makefile.in @@ -1,8 +1,8 @@ # -*- make -*- # FILE: "/diska/home/joze/src/tclreadline/Makefile.in" -# LAST MODIFICATION: "Mon Aug 23 17:55:26 1999 (joze)" +# LAST MODIFICATION: "Wed Aug 25 16:41:11 1999 (joze)" # (C) 1998, 1999 by Johannes Zellner, # $Id$ # --- # # tclreadline -- gnu readline for tcl @@ -29,10 +29,13 @@ MAJOR_VERSION = @TCLREADLINE_MAJOR_VERSION@ MINOR_VERSION = @TCLREADLINE_MINOR_VERSION@ VERSION = @TCLREADLINE_VERSION@ +# NOTE, that PATCHLEVEL is the complete version string +# +PATCHLEVEL = $(VERSION).@TCLREADLINE_PATCHLEVEL@ #host = @host@ #host_cpu = @host_cpu@ #host_vendor = @host_vendor@ #host_os = @host_os@ @@ -267,12 +270,12 @@ co: $(SOURCES) co -l $^ distribution: $(SOURCES) configure $(AUXILIARY) tclreadline.n.html - - mkdir -p dist/tclreadline-$(VERSION)/aux - - cp $(SOURCES) configure tclreadline.n.html dist/tclreadline-$(VERSION) - - cp $(AUXILIARY) dist/tclreadline-$(VERSION)/aux - (cd dist; tar zcvf tclreadline-$(VERSION).tar.gz tclreadline-$(VERSION); rm -rf tclreadline-$(VERSION)) + - mkdir -p dist/tclreadline-$(PATCHLEVEL)/aux + - cp $(SOURCES) configure tclreadline.n.html dist/tclreadline-$(PATCHLEVEL) + - cp $(AUXILIARY) dist/tclreadline-$(PATCHLEVEL)/aux + (cd dist; tar zcvf tclreadline-$(PATCHLEVEL).tar.gz tclreadline-$(PATCHLEVEL); rm -rf tclreadline-$(PATCHLEVEL)) # DO NOT DELETE THIS LINE -- make depend depends on it. Index: configure.in ================================================================== --- configure.in +++ configure.in @@ -1,8 +1,8 @@ # -*- autoconf -*- -# FILE: "/home/joze/src/tclreadline/configure.in" -# LAST MODIFICATION: "Mon Aug 23 21:54:31 1999 (joze)" +# FILE: "/diska/home/joze/src/tclreadline/configure.in" +# LAST MODIFICATION: "Wed Aug 25 16:17:27 1999 (joze)" # (C) 1998, 1999 by Johannes Zellner, # $Id$ # --- # # tclreadline -- gnu readline for tcl @@ -35,10 +35,11 @@ AC_INIT(tclreadline.c) TCLREADLINE_MAJOR_VERSION=0 TCLREADLINE_MINOR_VERSION=9 +TCLREADLINE_PATCHLEVEL=1 TCLREADLINE_VERSION=$TCLREADLINE_MAJOR_VERSION.$TCLREADLINE_MINOR_VERSION VERSION=$TCLREADLINE_VERSION AC_PREREQ(2.13) @@ -333,11 +334,11 @@ AC_MSG_ERROR([ Can't find libreadline$SHLIB_SUFFIX. Use --with-readline-library to specify the directory containing libreadline$SHLIB_SUFFIX on your system.]) else - AC_MSG_RESULT({READLINE_LIB_DIR}/libreadline${SHLIB_SUFFIX}${READLINE_VERSION_SUFFIX}) + AC_MSG_RESULT(${READLINE_LIB_DIR}/libreadline${SHLIB_SUFFIX}${READLINE_VERSION_SUFFIX}) fi # --- @@ -375,14 +376,14 @@ # (older versions of gnu readline don't have # rl_callback_read_char ()). #-------------------------------------------------------------------- save=$LIBS -LIBS="-L$READLINE_LIB_DIR -lreadline" +LIBS="-L$READLINE_LIB_DIR -lreadline $TERM_LIB" alternate=no -AC_CHECK_LIB( - readline, rl_callback_read_char, alternate=yes, alternate=no, $TERM_LIB +AC_CHECK_FUNC( + rl_callback_read_char, alternate=yes, alternate=no ) if test "$alternate" = "no"; then AC_MSG_ERROR(alternate interface not supported by this readline version.) fi @@ -414,10 +415,11 @@ # (link testprogram with -lreadline) AC_SUBST(TCLREADLINE_MAJOR_VERSION) AC_SUBST(TCLREADLINE_MINOR_VERSION) AC_SUBST(TCLREADLINE_VERSION) +AC_SUBST(TCLREADLINE_PATCHLEVEL) AC_SUBST(TCL_LIB_DIR) AC_SUBST(TCL_INCLUDE_DIR) AC_SUBST(READLINE_INCLUDE_DIR) Index: tclreadline.h.in ================================================================== --- tclreadline.h.in +++ tclreadline.h.in @@ -1,10 +1,10 @@ /* ================================================================== - FILE: "/krispc6/home/joze/src/tclreadline/tclreadline.h.in" - LAST MODIFICATION: "Sat May 8 14:03:02 1999 (joze)" + FILE: "/diska/home/joze/src/tclreadline/tclreadline.h.in" + LAST MODIFICATION: "Wed Aug 25 16:25:25 1999 (joze)" (C) 1998, 1999 by Johannes Zellner, $Id$ --- tclreadline -- gnu readline for tcl @@ -29,5 +29,12 @@ ================================================================== */ static char *TCLREADLINE_VERSION = "@TCLREADLINE_VERSION@"; +/** + * NOTE, that PATCHLEVEL is the complete version string. + * (PATCHLEVEL is not really used here). + */ +static char *TCLREADLINE_PATCHLEVEL + = "@TCLREADLINE_VERSION@.@TCLREADLINE_PATCHLEVEL@"; + Index: tclreadline.n.in ================================================================== --- tclreadline.n.in +++ tclreadline.n.in @@ -1,10 +1,10 @@ -.TH tclreadline n "@TCLREADLINE_VERSION@" "Johannes Zellner" +.TH tclreadline n "@TCLREADLINE_VERSION@.@TCLREADLINE_PATCHLEVEL@" "Johannes Zellner" .\" (C) 1999 by Johannes Zellner -.\" FILE: "/home/joze/src/tclreadline/tclreadline.n.in" -.\" LAST MODIFICATION: "Mon Aug 23 22:31:24 1999 (joze)" +.\" FILE: "/diska/home/joze/src/tclreadline/tclreadline.n.in" +.\" LAST MODIFICATION: "Wed Aug 25 16:32:02 1999 (joze)" .\" (C) 1998, 1999 by Johannes Zellner, .\" $Id$ .\" --- .\" .\" tclreadline -- gnu readline for the tcl scripting language @@ -178,16 +178,19 @@ as the tclsh w/o tclreadline. Turning off might be useful, when reading binary data for example. If \fB::tclreadline::Print\fP is called w/o arguments, it returns the current setting. .TP 5 -\fB::tclreadline::Loop\fP +\fB::tclreadline::Loop\fP [\fIhistoryfile\fP] enter the tclreadline main loop. This command is typically called from the startup resource file (something .tclshrc, depending on the interpreter you use, see the file `sample.tclshrc'). The main loop sets up some completion characteristics as variable -- try something like "puts $b" -- and command completion -- try "puts [in". +If the optional argument \fIhistoryfile\fP is given, this file will +be used for reading and writing the command history instead of the +default \fB.tclsh-history\fP. \fB::tclreadline::Loop\fP will normally not return. If you want to write your own main loop and/or own custom completers, it is probably a good idea to start with tclreadline::Loop (see the file tclreadlineSetup.tcl). @@ -222,12 +225,23 @@ .\" .SH "ENVIRONMENT VARIABLES" .SH "VARIABLES" -The global variable \fBtclreadline_version\fP holds the version number -of the tclreadline package. +\fItclreadline\fP defines the following variables in the global namespace: + +.TP 5 +\fBtclreadline_version\fP +holds the version string "@TCLREADLINE_VERSION@". + +.TP 5 +\fBtclreadline_patchLevel\fP +holds the patch level string "@TCLREADLINE_VERSION@.@TCLREADLINE_PATCHLEVEL@". + +.TP 5 +\fBtclreadline_library\fP +holds the library string "@TCLREADLINE_LIBRARY@". .SH "FILES" the \fB.tclshrc\fP file in the HOME directory, which is read on tclsh startup. Alternatively, the name of this initialization Index: tclreadlineConfig.sh.in ================================================================== --- tclreadlineConfig.sh.in +++ tclreadlineConfig.sh.in @@ -1,8 +1,8 @@ #!/bin/sh -# FILE: "/krispc6/home/joze/src/tclreadline/tclreadlineConfig.sh.in" -# LAST MODIFICATION: "Sat May 8 14:03:17 1999 (joze)" +# FILE: "/diska/home/joze/src/tclreadline/tclreadlineConfig.sh.in" +# LAST MODIFICATION: "Wed Aug 25 16:23:10 1999 (joze)" # (C) 1998, 1999 by Johannes Zellner, # $Id$ # --- # # tclreadline -- gnu readline for tcl @@ -40,10 +40,12 @@ # tclreadline's version number. TCLREADLINE_VERSION='@TCLREADLINE_VERSION@' TCLREADLINE_MAJOR_VERSION='@TCLREADLINE_MAJOR_VERSION@' TCLREADLINE_MINOR_VERSION='@TCLREADLINE_MINOR_VERSION@' +# there's no leading dot here as in tclConfig.sh! +TCLREADLINE_PATCHLEVEL='@TCLREADLINE_PATCHLEVEL@' # The name of the tclreadline library # (may be either a .a file or a shared library): TCLREADLINE_LIB_FILE=@TCLREADLINE_LIB_FILE@ Index: tclreadlineInit.tcl.in ================================================================== --- tclreadlineInit.tcl.in +++ tclreadlineInit.tcl.in @@ -1,8 +1,8 @@ #!/usr/local/bin/tclsh # FILE: "/diska/home/joze/src/tclreadline/tclreadlineInit.tcl.in" -# LAST MODIFICATION: "Fri Aug 20 15:37:08 1999 (joze)" +# LAST MODIFICATION: "Wed Aug 25 16:27:19 1999 (joze)" # (C) 1998, 1999 by Johannes Zellner, # $Id$ # --- # # tclreadline -- gnu readline for tcl @@ -35,13 +35,17 @@ proc ::tclreadline::Init {} { global tclreadline_version global tclreadline_library + global tclreadline_patchLevel set tclreadline_version @TCLREADLINE_VERSION@ set tclreadline_library @TCLREADLINE_LIBRARY@ + # NOTE, that tclreadline_patchLevel is the complete patchlevel string. + # + set tclreadline_patchLevel @TCLREADLINE_VERSION@.@TCLREADLINE_PATCHLEVEL@ if [catch {load @TCLREADLINE_LIBRARY@/@TCLREADLINE_LIB_FILE@} msg] { puts stderr $msg exit 2 } Index: tclreadlineSetup.tcl.in ================================================================== --- tclreadlineSetup.tcl.in +++ tclreadlineSetup.tcl.in @@ -1,8 +1,8 @@ #!/usr/local/bin/tclsh # FILE: "/diska/home/joze/src/tclreadline/tclreadlineSetup.tcl.in" -# LAST MODIFICATION: "Wed Aug 25 11:12:19 1999 (joze)" +# LAST MODIFICATION: "Wed Aug 25 14:49:37 1999 (joze)" # (C) 1998, 1999 by Johannes Zellner, # $Id$ # --- # # tclreadline -- gnu readline for tcl @@ -322,11 +322,11 @@ } else { eval exec ls -FC [::tclreadline::Glob $args] } } -proc ::tclreadline::Setup {} { +proc ::tclreadline::Setup {args} { uplevel #0 { if {[info commands ::tclreadline::readline] == ""} { ::tclreadline::Init @@ -390,14 +390,24 @@ } global env variable historyfile - if [info exists env(HOME)] { - set historyfile $env(HOME)/.tclsh-history + if {[string trim [llength ${args}]]} { + set historyfile "" + catch { + set historyfile [file nativename [lindex ${args} 0]] + } + if {"" == [string trim $historyfile]} { + set historyfile [lindex ${args} 0] + } } else { - set historyfile .tclsh-history + if [info exists env(HOME)] { + set historyfile $env(HOME)/.tclsh-history + } else { + set historyfile .tclsh-history + } } set msg [::tclreadline::readline initialize $historyfile] if {$msg != ""} { puts stderr "$msg" } @@ -428,13 +438,13 @@ return [eval concat $commandstring] } -proc ::tclreadline::Loop {} { +proc ::tclreadline::Loop {args} { - ::tclreadline::Setup + eval ::tclreadline::Setup ${args} uplevel #0 { while {1} {