First skirmishes with Safe Tcl interps, pluginmgr, Tablelist and homespun package...



Hi

I am trying to create a plugin environment for my application which
will allow simple user written scripts to be run. The complication is
that I don't want to overly restrict what commands the user can run
(they are Tcl newbies and it would be hard to explain the
limitations...).

Unfortunately my code is on a restricted stand--alone machine at work
and I am at home typing from memory...

Pluginmgr
=======

I have found pluginmgr to be a very useful framework but got caught
out by the following

1) using the list subcommand caused a problem if the manager was
created with the -setup option but nothing has been loaded the sip
variable is empty. To get around this I create two managers, one to do
use for list and another to do all the heavy lifting

2) the list command doesn't show plugins that are created using the
Tcl Modules (they seem to be invisible to package names). This is a
snag only because I don't want to have to get users to create and
maintain pkgIndex.tcl files. However it is still possible to load the
module based plugins if tcl::tm::path add is used first.

Using the interpreter subcommand I can get the name of the current
slave and do a safe::loadTk which works fine and I can create simple
buttons and even a ttk::labelframe.

Tablelist
======
However when I try to use a Tablelist from within the slave I get an
error

script error
invoked from within
"source {$p(:196:)/tablelistWidget.tcl}"
(in namespace eval "::" script line 1)
invoked from within
"namespace eval :: $auto_index($name)"
(procedure "auto_load" line 13)
invoked from within
"auto_load $name [uplevel 1 {::namespace current}]"
(autoloading "tablelist::tablelist")
(procedure "::unknown" line 23)
invoked from within
"tablelist::tablelist .tl"
(procedure "run" line 8)
invoked from within
"run"
invoked from within
"$sip eval $args"
(procedure "::pluginmgr::Snit_methoddo" line 9)
invoked from within
"espresso do run"
(file "butt_plug.tcl" line 130)

My Package
=========

Inside the slave I can package require "oow", my Snit-based wrapper
around and a C based extension I have written. However, when calling
the oow command to create an oow object the oow command is not
recognised.

If I alias oow back to the master interpreter it works fine but I then
hit the following problem

oow r -file c:/thing/thang

create an object command "r" which performs operations on the
specified file ( a bespoke database)

"r' has a subcommand called "setvars" which maps field in the current
record of the database on to Tcl variables using upvar:

r setvars A B C

will create variables A B C in the calling scope and they will contain
the respective values from the database; works fine in normal scripts
but not in my slave. I assume this is because they are being upvar'd
in the scope of the master?

-------------

Sorry to dump so much out there but any guidance and insights will be
much appreciated :)

kind regards

Julian H J Loaring
.



Relevant Pages

  • Re: vi horizontal split screen
    ... efficient at processing scripts, and one way to do that was substitute ... Microsoft's work for OLE in Windows 1x through 3x. ... As more and more users come to Linux who have no desire for command line ... effectively a programming environment. ...
    (comp.editors)
  • Re: Cron to email notification of ftp file upload?
    ... or traceroute and getting "command not found" messages and then trying to ... >use sudo command when you need to make root privileged changes, ie, ... [ohmster@ohmster scripts]$ sudo crontab -l ... $ cat ftpwatch ...
    (alt.os.linux)
  • Re: Beginners questions (tcsh) 1. set histdup 2. ??
    ... > learn two shells, one for interactive, and one for scripting. ... What do you do in your scripts which is the ... SAME as what you do on the command line? ... far more comfortable than those of zsh, bash or ksh. ...
    (comp.unix.shell)
  • Re: Primary Differences: FreeBSD/Linux
    ... > shell for scripts, ... Some do, it's in ports. ... ports tree or package tools from a console command line. ...
    (comp.unix.bsd.freebsd.misc)
  • Re: Confusing stack effects
    ... Or you would have the scripts generate several ... But what you really seem to be aiming for is an easy to use GUI ... I am not one to say "Command line pwns your GUI", but instead, ... After that, call "sort" to sort the list, and then remove double ...
    (alt.lang.asm)