Discussion:
how to use diagram-viewer and the diagram pkg
(too old to reply)
Mark Summerfield
2024-07-17 07:33:22 UTC
Permalink
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.
Mark Summerfield
2024-07-17 07:35:54 UTC
Permalink
Post by Mark Summerfield
I would like to try out the diagram-viewer app and the diagram pkg.
I am using Tcl/Tk 9.0b2 on Linux.
[snip]
Post by Mark Summerfield
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
Andreas Leitgeb
2024-07-17 08:15:36 UTC
Permalink
Post by Mark Summerfield
$ 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.
Harald Oehlmann
2024-07-17 11:16:04 UTC
Permalink
Post by Andreas Leitgeb
Post by Mark Summerfield
$ 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
Mark Summerfield
2024-07-19 07:22:06 UTC
Permalink
On Wed, 17 Jul 2024 13:16:04 +0200, Harald Oehlmann wrote:
[snip]
Post by Harald Oehlmann
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.
Andreas Leitgeb
2024-07-19 12:26:50 UTC
Permalink
Post by Harald Oehlmann
Post by Andreas Leitgeb
Post by Mark Summerfield
$ 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.

Loading...