tclsh, wish: am missing editable command line via libreadline 
Author Message
 tclsh, wish: am missing editable command line via libreadline

Hi !

Does somebody had time and demand to think about adding hooks
for libreadline in tclsh ?

I'd like to have an editable commandline interface, when trying
out things in tclsh.

Many tools are using libreadline, even "bc" and "dc".
Getting a "standard" editable command line interface saves you time.

Any ideas how to implement this ?

If you want to see how to implement this, you can create/get cvs
diffs from FreeBSDs "bc" utility via cgi script which shows you,
what changes have been necessary to get it work.

If somebody has the time and interest I could create thos diffs
and send it to you in e-mail.

BTW, does somebody have the e-mail address from John Ousterhout ?
Is he reading this newsgroup ?

        Andreas ///

--
Andreas Klemm                                   http://www.*-*-*.com/ ~andreas
                                      http://www.*-*-*.com/ ~fsmp/SMP/SMP.html
                                   powered by Symmetric MultiProcessor FreeBSD
New APSFILTER 5.2.0 and songs from our band -> http://www.*-*-*.com/ ~andreas



Fri, 06 Sep 2002 03:00:00 GMT  
 tclsh, wish: am missing editable command line via libreadline

Quote:

> Does somebody had time and demand to think about adding hooks
> for libreadline in tclsh ?

> I'd like to have an editable commandline interface, when trying
> out things in tclsh.

In the short term, you can try out tkcon:
        http://www.purl.org/net/hobbs/tcl/script/tkcon/

There are also readline extensions to Tcl in the Tcl FAQs.
However, if someone were to provide us with patches that
would use and load the readline .so if it is available on
the system at compile time, I'd be interested in adding them
to the core (assuming it doesn't goof anything else up).

--
   Jeffrey Hobbs                          The Tcl Guy
   jeffrey.hobbs at scriptics.com         Scriptics Corp.



Fri, 06 Sep 2002 03:00:00 GMT  
 tclsh, wish: am missing editable command line via libreadline
And this would work on Windows?

Isn't readline GPL? If  so, wouldn't it taint Tcl?

Dave LeBlanc

On Mon, 20 Mar 2000 09:46:55 -0800, Jeffrey Hobbs

Quote:


>> Does somebody had time and demand to think about adding hooks
>> for libreadline in tclsh ?

>> I'd like to have an editable commandline interface, when trying
>> out things in tclsh.

>In the short term, you can try out tkcon:
>    http://www.purl.org/net/hobbs/tcl/script/tkcon/

>There are also readline extensions to Tcl in the Tcl FAQs.
>However, if someone were to provide us with patches that
>would use and load the readline .so if it is available on
>the system at compile time, I'd be interested in adding them
>to the core (assuming it doesn't goof anything else up).

>--
>   Jeffrey Hobbs                          The Tcl Guy
>   jeffrey.hobbs at scriptics.com         Scriptics Corp.



Sun, 08 Sep 2002 03:00:00 GMT  
 tclsh, wish: am missing editable command line via libreadline
readline is GPL, which is why we couldn't include it directly.
However, loading it in if found prevents any taint.  In general,
perhaps this is just best left as a totally separate extension,
if it is easily available for download.

Quote:

> And this would work on Windows?

> Isn't readline GPL? If  so, wouldn't it taint Tcl?

> Dave LeBlanc

> On Mon, 20 Mar 2000 09:46:55 -0800, Jeffrey Hobbs


> >> Does somebody had time and demand to think about adding hooks
> >> for libreadline in tclsh ?

> >> I'd like to have an editable commandline interface, when trying
> >> out things in tclsh.

> >In the short term, you can try out tkcon:
> >       http://www.purl.org/net/hobbs/tcl/script/tkcon/

> >There are also readline extensions to Tcl in the Tcl FAQs.
> >However, if someone were to provide us with patches that
> >would use and load the readline .so if it is available on
> >the system at compile time, I'd be interested in adding them
> >to the core (assuming it doesn't goof anything else up).

--
   Jeffrey Hobbs                          The Tcl Guy
   jeffrey.hobbs at scriptics.com         Scriptics Corp.


Sun, 08 Sep 2002 03:00:00 GMT  
 tclsh, wish: am missing editable command line via libreadline

Quote:

> readline is GPL, which is why we couldn't include it directly.  However,
> loading it in if found prevents any taint.  In general, perhaps this is
> just best left as a totally separate extension, if it is easily
> available for download.

I remember that some time ago, there was another library out there called
getline, which did stuff similar to readline.... I just found a copy on
ftp://ftp.sco.com/skunkwar/src/lib. This is the copyright:

/*

 *
 * Permission to use, copy, modify, and distribute this software
 * for any purpose and without fee is hereby granted, provided
 * that the above copyright notices appear in all copies and that both the
 * copyright notice and this permission notice appear in supporting
 * documentation.  This software is provided "as is" without express or
 * implied warranty.
 *
 * Thanks to the following people who have provided enhancements and fixes:
 *   Ron Ueberschaer, Christoph Keller, Scott Schwartz, Steven List,
 *   DaviD W. Sanderson, Goran Bostrom, Michael Gleason, Glenn Kasten,
 *   Edin Hodzic, Eric J Bivona, Kai Uwe Rommel, Danny Quah, Ulrich Betzler
 */

I don't know if it's the latest version, though.

L



Sun, 08 Sep 2002 03:00:00 GMT  
 tclsh, wish: am missing editable command line via libreadline

Quote:

> In general,
> perhaps this is just best left as a totally separate extension,
> if it is easily available for download.

My $0.02:

I've tried at two different jobs ( = two different Solaris SPARC
installations ) to get tclreadline to work, and failed both times.
(Maybe that says more about me, but I have successfully built pine,
emacs, gdb, gcc, Tk, Tcl, BLT, Tix TclX ... even before stubs ;-) I
can't remember if it was libreadline itself or tclreadline that gave me
problems...

My personal opinion is that the CLI for Tcl on UNIX is the worst daily
annoyance Tcl has altogether. I always run tclsh in a emacs shell just
because of that. I know about tkcon, and it does give me even more than
readline or emacs, but what I'm longing for is for it to work right
there in the xterm...

I know I give up my right to complain when I'm not volunteering to do
the work, but I just hope and pray it will become easier to get readline
to work with tclsh and wish sometime in the future...

Peter



Sun, 08 Sep 2002 03:00:00 GMT  
 tclsh, wish: am missing editable command line via libreadline

Quote:


> > In general,
> > perhaps this is just best left as a totally separate extension,
> > if it is easily available for download.

> My $0.02:

> I've tried at two different jobs ( = two different Solaris SPARC
> installations ) to get tclreadline to work, and failed both times.
> (Maybe that says more about me, but I have successfully built pine,
> emacs, gdb, gcc, Tk, Tcl, BLT, Tix TclX ... even before stubs ;-) I
> can't remember if it was libreadline itself or tclreadline that gave me
> problems...

Well, I found that readline was a static lib on my Sol7 machine, so
I grabbed the readline (v4.1) from ftp.gnu.org.  configure, make,
oh, that's a static one too.  OK, make shared, make install-shared.
Grab tclreadline (1.0.3), configure, make, make install.

Copy over sample tclsh, a few mods to make sure it gets the right
auto_path and only acts on Sol5.7...  works just fine.  15-20 min
of work...  It built against 8.2, and works with 8.1 and 8.2.  It
seg faults with 8.3...  Hmmm, bummer.

I think it would be useful as well, it's just too bad that readline
is GPL in general.  I'm personally not going to put more work in
than that because I always use tkcon (funny that...).

--
   Jeffrey Hobbs                          The Tcl Guy
   jeffrey.hobbs at scriptics.com         Scriptics Corp.



Sun, 08 Sep 2002 03:00:00 GMT  
 tclsh, wish: am missing editable command line via libreadline
Hi Jeff,

I got *so* embarrassed when I saw your reply post, so I tried it for
myself again. And I got an error while attemting to `make shared` the
readline v1.4. Of course this has nothing to do with any code in the tcl
community.... (But it still does prevent me from being able to get tcl
readline to work.)

Hey, maybe there just indeed is something peculiar about the solaris
installations at both my present and previous employer...

Anyway, sorry to have wasted over 20 mins of your time, and now another
2!

Peter

******** GNU readline v1.4 make shared failure output ************
<snip>
rm -f tilde.so
gcc -c -DHAVE_CONFIG_H   -I. -I.. -I.. -I -DRL_LIBRARY_VERSION='"4.1"'
-g -O -fpic -o tilde.o ../tilde.c
mv tilde.o tilde.so
rm -f libreadline.so.4
gcc -shared -Wl,-i -Wl,-h,libreadline.so.4  -o libreadline.so.4
readline.so vi_mode.so funmap.so keymaps.so parens.so search.so rltty.so
complete.so bind.so isearch.so display.so signals.so util.so kill.so
undo.so macro.so input.so callback.so terminal.so nls.so xmalloc.so
history.so histexpand.so histfile.so histsearch.so shell.so tilde.so
/sw/packages/cygnus/progressive-98r1-v0/H-sparc-sun-solaris2.6/bin/../lib/gcc-lib/sparc-sun-solaris2.6/2.9-cisco-98r1/../../../../sparc-sun-solaris2.6/bin/ld:
-r and -shared may not be used together
collect2: ld returned 1 exit status
make[1]: *** [libreadline.so.4] Error 1
make[1]: Leaving directory `/users/pmorch/work/readline-4.1/shlib'
make: [shared] Error 2 (ignored)

Comment: -r is not mentioned anywhere in the make output except in the
ld error message.



Sun, 08 Sep 2002 03:00:00 GMT  
 tclsh, wish: am missing editable command line via libreadline

Quote:

> readline is GPL, which is why we couldn't include it directly.  However,
> loading it in if found prevents any taint.  In general, perhaps this is
> just best left as a totally separate extension, if it is easily
> available for download.

It exists already. Search for tclreadline on
http://www.purl.org/net/tcl-faq/part5.html

L



Sun, 08 Sep 2002 03:00:00 GMT  
 tclsh, wish: am missing editable command line via libreadline


Quote:
> gcc -shared -Wl,-i -Wl,-h,libreadline.so.4  -o libreadline.so.4 ...
> /sw/.../ld: -r and -shared may not be used together
> collect2: ld returned 1 exit status
[...]
> Comment: -r is not mentioned anywhere in the make output except in the
> ld error message.

Try passing the option -v to gcc so it prints out exactly how it is
calling the linker.  You could then try calling the linker yourself
directly instead of through the gcc wrapper, allowing the options to
be specified *right*.  However, it is quite possible that what you
need to do is to drop the -shared option since it is figuring out for
itself that it need to do shared lib output...

Donal (*GRR* Linkers...)
--

-- The small advantage of not having California being part of my country would
   be overweighed by having California as a heavily-armed rabid weasel on our



Mon, 09 Sep 2002 03:00:00 GMT  
 tclsh, wish: am missing editable command line via libreadline

Quote:


>> gcc -shared -Wl,-i -Wl,-h,libreadline.so.4  -o libreadline.so.4 ...
>> /sw/.../ld: -r and -shared may not be used together
>> collect2: ld returned 1 exit status
> [...]
>> Comment: -r is not mentioned anywhere in the make output except in the
>> ld error message.
> Try passing the option -v to gcc so it prints out exactly how it is
> calling the linker.  You could then try calling the linker yourself
> directly instead of through the gcc wrapper, allowing the options to
> be specified *right*.  However, it is quite possible that what you
> need to do is to drop the -shared option since it is figuring out for
> itself that it need to do shared lib output...

What platform is this on? Sorry I've got a really bad newsfeed. One thing to
watch for is that libreadline is compile with -fPIC. Judging from the output,
it seems unlikely. Tell you what, during my lunch hour, I'll get the
extension, compile it on HPUX 10.20 and give you my feedback.

L

--
Laurent Duperval                 "Montreal winters are an intelligence test,

                                                                -Don Camilli
Penguin Power!         ***Nothing I say reflects the views of my employer***



Mon, 09 Sep 2002 03:00:00 GMT  
 tclsh, wish: am missing editable command line via libreadline

Quote:

> What platform is this on? Sorry I've got a really bad newsfeed. One thing to
> watch for is that libreadline is compile with -fPIC. Judging from the output,
> it seems unlikely. Tell you what, during my lunch hour, I'll get the
> extension, compile it on HPUX 10.20 and give you my feedback.

Ok, here's what I did:

1- get readline-4.1
2- get ncurses-5.0
3- install readline:
   ./configure
   fudge the makefile to use "ld" as linker instead of gcc
   make shared
   make install-shared
4- install ncurses
5- get and install tclreadline
6- make sure you copy the sample tclshrc to ~/.tclshrc. Modify it as needed.
7- run tclsh (8.3.0, if it matters).

Works like a charm. I'm gonna have to do the same at home tonight. BTW, I had
to install ncurses to get tclreadline to work properly. THe reason is that the
termcap (temlib) libraries on my machine are dynamically linked and HPUX
doesn't like to mix static and non-static libraries. Or mayne I just don'
tknow how to do it right.

L

--
Laurent Duperval                 "Montreal winters are an intelligence test,

                                                                -Don Camilli
Penguin Power!         ***Nothing I say reflects the views of my employer***



Mon, 09 Sep 2002 03:00:00 GMT  
 tclsh, wish: am missing editable command line via libreadline

Quote:

> > I think it would be useful as well, it's just too bad that readline
> > is GPL in general.  I'm personally not going to put more work in
> > than that because I always use tkcon (funny that...).
> What is wrong with GPL?

> I put an updated version of tclreadline at
>     http://www.zellner.org/tclreadline/download/
> The latest version is 1.1.0.

GPL is viral in the worst sense.  If you add GPL stuff to a project,
all other things become GPL'ed.  Adding readline to Tcl would cause
it to be GPL, and so on to all users of Tcl.  Very very very bad, IMO.
It's like the communist version of software licensing.  I prefer true
free licenses like BSD (which Tcl has, and which I release all my
software under).

--
   Jeffrey Hobbs                          The Tcl Guy
   jeffrey.hobbs at scriptics.com         Scriptics Corp.



Mon, 09 Sep 2002 03:00:00 GMT  
 tclsh, wish: am missing editable command line via libreadline

Quote:



> > > In general,
> > > perhaps this is just best left as a totally separate extension,
> > > if it is easily available for download.

> > My $0.02:

> > I've tried at two different jobs ( = two different Solaris SPARC
> > installations ) to get tclreadline to work, and failed both times.
> > (Maybe that says more about me, but I have successfully built pine,
> > emacs, gdb, gcc, Tk, Tcl, BLT, Tix TclX ... even before stubs ;-) I
> > can't remember if it was libreadline itself or tclreadline that gave me
> > problems...

> Well, I found that readline was a static lib on my Sol7 machine, so
> I grabbed the readline (v4.1) from ftp.gnu.org.  configure, make,
> oh, that's a static one too.  OK, make shared, make install-shared.
> Grab tclreadline (1.0.3), configure, make, make install.

> Copy over sample tclsh, a few mods to make sure it gets the right
> auto_path and only acts on Sol5.7...  works just fine.  15-20 min
> of work...  It built against 8.2, and works with 8.1 and 8.2.  It
> seg faults with 8.3...  Hmmm, bummer.

I did some (very few) code cleanup and compiled with tcl8.3 on
DEC/OSF1, various SGI/IRIX's, HP-UX's, and Linux (debian potato).
Works w/o segfault on the mentioned systems (different readline
versions 2.2 - 4.1).

Quote:
> I think it would be useful as well, it's just too bad that readline
> is GPL in general.  I'm personally not going to put more work in
> than that because I always use tkcon (funny that...).

What is wrong with GPL?

I put an updated version of tclreadline at

    http://www.zellner.org/tclreadline/download/

The latest version is 1.1.0.

--
   Johannes



Tue, 10 Sep 2002 03:00:00 GMT  
 tclsh, wish: am missing editable command line via libreadline
ftp://ftp.sco.com/skunkwar/src/lib returns no such directory.

Dave LeBlanc

On Wed, 22 Mar 2000 18:46:23 -0500, Laurent Duperval

.

Quote:
>I remember that some time ago, there was another library out there called
>getline, which did stuff similar to readline.... I just found a copy on
>ftp://ftp.sco.com/skunkwar/src/lib. This is the copyright:



Tue, 10 Sep 2002 03:00:00 GMT  
 
 [ 28 post ]  Go to page: [1] [2]

 Relevant Pages 

1. TIP #216: Handling Command-Line Options in Tclsh and Wish

2. TIP #151: Remove -e: Command Line Option from tclsh and wish

3. Parsing command line options with tclsh or wish

4. Controlling a program via a pipe works with tclsh but not with wish (on Windows XP)

5. ANNOUNCE: Three WISHes for 2006 (WISH Supernotepad 2006, WISH Command Center 2006, WISH CD-Writer 2006)

6. Tcsh/Emacs-like line-editing for Tclsh/Wish

7. Catching cntrl-c from the tclsh command line.

8. command line editing on tclsh

9. Tclsh in command line

10. Edit command line in interactive tclsh

11. Command Line Editing in tclsh

12. editable tclsh or tk replacement for xterm

 

 
Powered by phpBB® Forum Software