Thread from comp.lang.tcl (5 replies)

how to use diagram-viewer and the diagram pkg
Posted by Mark Summerfield <mark@qtrac.eu> 2 months 2 weeks ago

I would like to try out the diagram-viewer app and the diagram pkg.
I am using Tcl/Tk 9.0b2 on Linux.

Given file /tmp/a.dia (copied from the tclwiki):

box A
arrow "" 40
circle B
direction SE

I tried this at the command line:

$ wish9 ~/opt/tcl9/bin/diagram-viewer show /tmp/a.dia 
Creating safe environment, please wait...
/home/mark/opt/tcl9/bin/diagram-viewer: can't find package diagram
$ wish9
% package require diagram
1

As you can see, diagram-viewer can't find the diagram package even though 
it is there.

Nor can I find any other examples of the diagram language nor what file 
extension one should use.

Click on article to view all threads in comp.lang.tcl
Re: how to use diagram-viewer and the diagram pkg
Posted by Mark Summerfield <mark@qtrac.eu> 2 months 2 weeks ago

On Wed, 17 Jul 2024 07:33:22 +0000, Mark Summerfield wrote:

> I would like to try out the diagram-viewer app and the diagram pkg.
> I am using Tcl/Tk 9.0b2 on Linux.
[snip]
> As you can see, diagram-viewer can't find the diagram package even
> though it is there.
> 
> Nor can I find any other examples of the diagram language nor what file
> extension one should use.

Sorry, keep forgetting that the Pan newsreader's editor eats (selected) 
newlines:

The file /tmp/a.dia is (with no blank lines):

box A

arrow "" 40

circle B

direction SE

And the console interaction (again with no blank lines):

$ wish9 ~/opt/tcl9/bin/diagram-viewer show /tmp/a.dia

Creating safe environment, please wait...

/home/mark/opt/tcl9/bin/diagram-viewer: can't find package diagram

$ wish9

% package require diagram

1

Click on article to view all threads in comp.lang.tcl
Re: how to use diagram-viewer and the diagram pkg
Posted by Andreas Leitgeb <avl@logic.at> 2 months 2 weeks ago

Mark Summerfield <mark@qtrac.eu> wrote:
> $ wish9 ~/opt/tcl9/bin/diagram-viewer show /tmp/a.dia
> Creating safe environment, please wait...
> /home/mark/opt/tcl9/bin/diagram-viewer: can't find package diagram
> $ wish9
> % package require diagram
> 1

The "Creating safe environment, please wait..." might be the key here.
Check what the diagram viewer does after emitting that line, and see
if you can still "package require diagram" in that context.

If the "safe environment" is related to a safe interpreter, 
you might need to add more code to the diagram-viewer to 
allow the safe interp to load that particular package.

If I had it in my head, I'd write it - I hope someone else
can describe the extra "magic" needed to enable a package
in a safe interp.

Click on article to view all threads in comp.lang.tcl
Re: how to use diagram-viewer and the diagram pkg
Posted by Harald Oehlmann <wortkarg3@yahoo.com> 2 months 2 weeks ago

Am 17.07.2024 um 10:15 schrieb Andreas Leitgeb:
> Mark Summerfield <mark@qtrac.eu> wrote:
>> $ wish9 ~/opt/tcl9/bin/diagram-viewer show /tmp/a.dia
>> Creating safe environment, please wait...
>> /home/mark/opt/tcl9/bin/diagram-viewer: can't find package diagram
>> $ wish9
>> % package require diagram
>> 1
> 
> The "Creating safe environment, please wait..." might be the key here.
> Check what the diagram viewer does after emitting that line, and see
> if you can still "package require diagram" in that context.
> 
> If the "safe environment" is related to a safe interpreter,
> you might need to add more code to the diagram-viewer to
> allow the safe interp to load that particular package.
> 
> If I had it in my head, I'd write it - I hope someone else
> can describe the extra "magic" needed to enable a package
> in a safe interp.
> 

May you identify the "pckIndex.tcl" file of the package and post it here?
It may contain code to exclude TCL9...

Take care,
Harald

Click on article to view all threads in comp.lang.tcl
Re: how to use diagram-viewer and the diagram pkg
Posted by Mark Summerfield <mark@qtrac.eu> 2 months 2 weeks ago

On Wed, 17 Jul 2024 13:16:04 +0200, Harald Oehlmann wrote:
[snip]
> May you identify the "pckIndex.tcl" file of the package and post it
> here?
> It may contain code to exclude TCL9...


I installed Tcl 9.0b2 in ~/opt/tcl9, then installed Tk 9.0b2 in the same 
place then installed the trunk versions of Tcllib and Tklib using their 
installers run using wish9 (my link to ~/opt/tcl9/bin/wish9.0).

The diagram-viewer was installed by this process in ~/opt/tcl9/bin and 
that dir has no pkgIndex.tcl file.

In other words I just did a standard install.

Click on article to view all threads in comp.lang.tcl
Re: how to use diagram-viewer and the diagram pkg
Posted by Andreas Leitgeb <avl@logic.at> 2 months 2 weeks ago

Harald Oehlmann <wortkarg3@yahoo.com> wrote:
> Am 17.07.2024 um 10:15 schrieb Andreas Leitgeb:
>> Mark Summerfield <mark@qtrac.eu> wrote:
>>> $ wish9 ~/opt/tcl9/bin/diagram-viewer show /tmp/a.dia
>>> Creating safe environment, please wait...
>>> /home/mark/opt/tcl9/bin/diagram-viewer: can't find package diagram
>>> $ wish9
>>> % package require diagram
>>> 1
>> 
>> The "Creating safe environment, please wait..." might be the key here.
>> Check what the diagram viewer does after emitting that line, and see
>> if you can still "package require diagram" in that context.
>> 
>> If the "safe environment" is related to a safe interpreter,
>> you might need to add more code to the diagram-viewer to
>> allow the safe interp to load that particular package.
>> 
>> If I had it in my head, I'd write it - I hope someone else
>> can describe the extra "magic" needed to enable a package
>> in a safe interp.
>
> May you identify the "pckIndex.tcl" file of the package and post it here?
> It may contain code to exclude TCL9...

I think we can exclude that possibility, because the package apparently
does load successfully in an interactive wish9.

Mark, if you skipped a few post and just read the last one, consider
what I wrote about safe interpreters.

Click on article to view all threads in comp.lang.tcl