diagrams is a package of tklib to draw diagrams in a DSL similar to PIC
I can see in my tcl system (Magicsplat, windows) I have a diagrams folder under C:\Users\XX\AppData\Local\Apps\Tcl86\lib\tklib0.6\diagrams
So it is supposed you should use
% package require diagrams
in order to use the package, but:
% package require diagrams
can't find package diagrams
and auto_path points to the right path
Looking for info in Tklib source code I find examples of the use of diagrams package and surprinsingly for me the examples refer to the package as "Diagrams", i.e. [1] :
---
package require Tk
package require Diagrams
namespace import ::Diagrams::*
pack [canvas .c -width 200 -height 120 -bg white]
drawin .c
direction southeast
currentpos [position 20 20]
arrow "" 40
box " A "
direction southeast
currentpos [position 120 20]
arrow "" 40
attach northwest
box " B "
saveps
anchor.ps
---
but requiring Diagrams package doesn't work for me:
% package require Diagrams
can't find package Diagrams
So, looking into sources [2] to view the pkgIndex.tcl and there I see the package depends on several "subpackages" (diagram, basic, core...):
---
if {![package vsatisfies [package provide Tcl] 8.5-]} {
# PRAGMA: returnok
return
}
package ifneeded diagram::navigation 1 [list source [file join $dir navigation.tcl]]
package ifneeded diagram::direction 1 [list source [file join $dir direction.tcl]]
package ifneeded diagram::element 1 [list source [file join $dir element.tcl]]
package ifneeded diagram::attribute 1 [list source [file join $dir attributes.tcl]]
package ifneeded diagram::point 1 [list source [file join $dir point.tcl]]
package ifneeded diagram::core 1 [list source [file join $dir core.tcl]]
package ifneeded diagram::basic 1.0.1 [list source [file join $dir basic.tcl]]
package ifneeded diagram 1 [list source [file join $dir diagram.tcl]]
package ifneeded diagram::application 1.2 [list source [file join $dir application.tcl]]
---
What I understand is that when you code:
% package require diagrams
(or package require Diagrams attending the examples)
it should load all those files, but attending the content of pkgIndex.tcl it seems you have to require the right subpackage, not diagrams as a hole
in fact if I do
% package require diagram
1
(in fact this was the problem I talked about in a previous post)
and the same with any other subpackage:
% package require diagram::basic
1.0.1
So I don't understand how to use this package, are the example wrong?
do you have to "package require Diagrams" as stated in examples? or do you have to require each "subpackage" you're going to use in your code?
regards
[1]
https://core.tcl-lang.org/tklib/file?name=examples/diagrams/draw_anchor.tcl&ci=tip
[2]
https://core.tcl-lang.org/tklib/dir?ci=tip&name=modules/diagrams