Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

1 + 1 = 3, for large values of 1.


devel / comp.lang.tcl / tklib diagrams package

SubjectAuthor
o tklib diagrams packagepd

1
tklib diagrams package

<5aeccb17-5239-459b-afdc-8edf8b9a035fn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12918&group=comp.lang.tcl#12918

  copy link   Newsgroups: comp.lang.tcl
X-Forwarded-Encrypted: i=1; AJvYcCXPVJIbqTzPb+Uur7AnvtX6i7dOvCD5lMuwWkiOnnZEPjK7Dn51lw/gZHyak0JUQIVSSWYsdNuAfZ9T1UWm1+PyNBP9/9WgYLVSp87UjaONitEm
X-Received: by 2002:a05:622a:204:b0:42c:3f74:3716 with SMTP id b4-20020a05622a020400b0042c3f743716mr16577qtx.4.1707341847029;
Wed, 07 Feb 2024 13:37:27 -0800 (PST)
X-Forwarded-Encrypted: i=1; AJvYcCXG/W+8xqdfZJIfhXp64pq3AexX0RGebJERNKRd25dvtIm23Fxg8t6EALgdA3SE+0JWHmnvDNyVOU8sTJ765utMmJUZiUp7CfvxQfr94PeK
X-Received: by 2002:ac8:7e8e:0:b0:42c:2b33:8e51 with SMTP id
w14-20020ac87e8e000000b0042c2b338e51mr537302qtj.12.1707341846634; Wed, 07 Feb
2024 13:37:26 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Wed, 7 Feb 2024 13:37:26 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=207.188.184.151; posting-account=fwjo5QoAAAAcS9TSqEAQL1VEl7b8nCOq
NNTP-Posting-Host: 207.188.184.151
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5aeccb17-5239-459b-afdc-8edf8b9a035fn@googlegroups.com>
Subject: tklib diagrams package
From: eukel...@gmail.com (pd)
Injection-Date: Wed, 07 Feb 2024 21:37:27 +0000
Content-Type: text/plain; charset="UTF-8"
 by: pd - Wed, 7 Feb 2024 21:37 UTC

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

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor