3

(just wanted to document this; self-answer to follow)

I just found Visual REGEXP : a graphical explorer for your regexps, which is a Tck/Tk application, so I wanted to try it on Ubuntu 11.04 natty.

First I tried that 3.0 version:

$ wget http://laurent.riesterer.free.fr/regexp/visual_regexp-3.0.tar.gz
$ tar xzvf visual_regexp-3.0.tar.gz
$ cd visual_regexp-3.0/
$ ./visual_regexp.tcl 
./visual_regexp.tcl: 48: Syntax error: word unexpected (expecting ")")
$ bash visual_regexp.tcl 
visual_regexp.tcl: line 48: syntax error near unexpected token `platform'
visual_regexp.tcl: line 48: `if {$tcl_platform(platform) == "windows"} {'
$ sh visual_regexp.tcl 
visual_regexp.tcl: 48: Syntax error: word unexpected (expecting ")")
$ tclsh visual_regexp.tcl 
0
invalid command name "toplevel"
    while executing
"toplevel .history"
    (procedure "regexp::history:init" line 5)
    invoked from within
"regexp::history:init"
    (file "visual_regexp.tcl" line 1080)
$ wish visual_regexp.tcl      # finally works
$ readlink -f $(which wish)
/usr/bin/wish8.4
$ wish8.5 visual_regexp.tcl   # works too, better fonts
$ cd ..

OK, so now I want to try the 3.1 version:

$ wget http://laurent.riesterer.free.fr/regexp/visual_regexp-3.1.tcl
$ wish8.4 visual_regexp-3.1.tcl
Error in startup script: can't find package starkit
    while executing
"package require starkit"
    (file "visual_regexp-3.1.tcl" line 1)
$ tclsh visual_regexp-3.1.tcl
can't find package starkit
    while executing
"package require starkit"
    (file "visual_regexp-3.1.tcl" line 1)

Looking for this error, the most relevant hits I can find are:

Build Your First Starkit

STEP 1: Get Tclkit and sdx
[...]
If this command responds with the error "can't find package starkit" then you need to add read permissions to your tclkit binary. On UNIX/Linux type systems, this would be via: chmod u+r tclkit

Ok ... first I thought there is an Ubuntu package for this tclkit, but couldn't find one; and so ended up doing this:

$ wget http://tclkit.googlecode.com/files/tclkit-8.5.9-linux-ix86.gz
$ gzip -d tclkit-*.gz
$ chmod +x tclkit-8.5.9-linux-ix86
$ sudo ln -s $(readlink -f ./tclkit-8.5.9-linux-ix86) /usr/bin/
$ which tclkit
/usr/bin/tclkit
$

$ wget http://tclkit.googlecode.com/files/sdx-20110317.kit
$ chmod +x sdx-20110317.kit
$ sudo ln -s $(readlink -f ./sdx-20110317.kit) /usr/bin/sdx.kit
$ which sdx.kit
/usr/bin/sdx.kit

$ tclkit sdx.kit
couldn't read file "sdx.kit": no such file or directory

$ tclkit $(which sdx.kit)
Specify one of the following commands:
 addtoc    eval      fetch     ftpd      httpd     httpdist  ls        lsk       md5sum    mkinfo    mkpack    mkshow    mksplit   mkzipkit  qwrap     ratarx    rexecd    starsync  sync      tgz2kit   treetime  unwrap    update    version   wrap
For more information, type:  /usr/bin/sdx.kit help ?command?

$ tclkit visual_regexp-3.1.tcl
0
invalid command name "toplevel"
    while executing
"toplevel .history"
    (procedure "regexp::history:init" line 5)
    invoked from within
"regexp::history:init"
    (file "visual_regexp-3.1.tcl" line 1510)

$ wish8.4 visual_regexp-3.1.tcl
Error in startup script: can't find package starkit
    while executing
"package require starkit"
    (file "visual_regexp-3.1.tcl" line 1)
$ tclsh visual_regexp-3.1.tcl
can't find package starkit
    while executing
"package require starkit"
    (file "visual_regexp-3.1.tcl" line 1)

So, apparently I got tclkit and sdx.kit running - but still I cannot visual_regexp-3.1.tcl to run? How do I get to run this on Ubuntu?

sdaau
  • 3,056

1 Answers1

3

Answer: the missing thing was the tclvfs package.

Namely, after all that, I tried looking up visual_regexp-3.1.tcl - and realized there is an Ubuntu package for it. So I did

$ sudo apt-get install visual-regexp
The following extra packages will be installed:
  tclvfs
...
The following NEW packages will be installed:
  tclvfs visual-regexp
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 136 kB of archives.
After this operation, 590 kB of additional disk space will be used.
Do you want to continue [Y/n]? ...

$ which visual-regexp
/usr/bin/visual-regexp

After this, both visual-regexp works fine, and wish8.5 visual_regexp-3.1.tcl; however, note that visual_regexp-3.1.tcl doesn't work with wish8.4:

$ wish8.4 visual_regexp-3.1.tcl 
0
Error in startup script: unknown option "-tristatevalue"
    while executing
"checkbutton    .top.regexp.options.$option  -text              $label   -borderwidth   1   -underline      $underline  -variable       regexp::data(v:$option)  -offvalue      "" ..."
    (procedure "regexp::gui" line 33)
    invoked from within
"regexp::gui"
    (file "visual_regexp-3.1.tcl" line 1511)

Finally, note that visual_regexp-3.1.tcl apparently is still marked as 3.0:

visual_regexp-3.1.tcl

Olli
  • 8,971
sdaau
  • 3,056
  • Regarding the version string being incorrect in the visual_regexp-3.1.tcl file, it happens to be defined on line 4 in plain text, correcting that single instance will then load the application window as 'Visual REGEXP 3.1'. If one does decide to edit the file, it's also highly advisable to add a shebang line at the top pointing to the location of your Tcl/Tk shell interpreter, such as #!/usr/bin/wish, while you have the file open in the editor, thus making it an eponymous executable. – Peter J. Mello Feb 20 '21 at 19:17