Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Determine package types

65 views
Skip to first unread message

ze

unread,
Oct 16, 2017, 11:12:25 PM10/16/17
to
I wonder if someone can help me with a task. I am willing to pay a reasonable fee for their efforts. With that said, here is what I would like to do:

Given a list of Tcl/Tk packages, I would like to find out which ones are binary (meaning compiled C/C++ code) and which ones are plain Tcl/Tk (as in tcllib and tklib packages). Then, given two folders named "binary" and "script", collect them into their respective folders.

The list currently contains almost 100 packages. I will send the package names to interested parties via email. If there is interest, I can post the results here or on the wiki pages.

Please email me directly if you are interested and include your requirements.

Christian Gollwitzer

unread,
Oct 17, 2017, 2:40:39 AM10/17/17
to
Am 17.10.17 um 05:12 schrieb ze:
> I wonder if someone can help me with a task. I am willing to pay a reasonable fee for their efforts. With that said, here is what I would like to do:
>
> Given a list of Tcl/Tk packages, I would like to find out which ones are binary (meaning compiled C/C++ code) and which ones are plain Tcl/Tk (as in tcllib and tklib packages).

This should be easy to find out. Fire up an interpreter which can load
the packages you need. Then "package ifneeded" tells you what it does
when you load the package. For example:

(Tests) 49 % package ifneeded Tk [package require Tk]
load {} Tk


Here, Tk is loaded using "load", which means it is a binary extension.
In contrast,

(Tests) 50 % package ifneeded fileutil [package require fileutil]
source /Users/chris/bin/wish86/lib/tcllib1.18/fileutil/fileutil.tcl

Here, a Tcl file is source'd, therefore it is a Tcl exetnsion. However,
since the sourced Tcl file can do anything - in particular "load" binary
code - it can't be automated 100%. E.g:

(Tests) 53 % package ifneeded tkdnd [package require tkdnd]
source {/Users/chris/bin/wish86/lib/tkdnd2.8/tkdnd.tcl} ;
tkdnd::initialise {/Users/chris/bin/wish86/lib/tkdnd2.8}
libtkdnd2.8.dylib tkdnd
(Tests) 54 %

-> A script runs which loads the binary library in the script code.
Another approach would be to list the directories of your extensions and
see if it contains loadable libraries (.so on Linux, .dll on Windows,
.dylib on OSX) - if you have them organised in directories already, this
should be pretty easy.

Christian

martyn....@gmail.com

unread,
Oct 17, 2017, 3:55:38 AM10/17/17
to
As this is TCL would it not be possible to overload source and load to trace their usage or use a trace.
That is what I would try first.

Martyn

Arjen Markus

unread,
Oct 17, 2017, 4:53:49 AM10/17/17
to
How about using a safe interpreter for this? You can exclude the load command then and keep the source command.

Regards,

Arjen

ze

unread,
Oct 17, 2017, 2:16:35 PM10/17/17
to
On Tuesday, October 17, 2017 at 2:40:39 AM UTC-4, Christian Gollwitzer wrote:
>
> This should be easy to find out. Fire up an interpreter which can load
> the packages you need. Then "package ifneeded" tells you what it does
> when you load the package. For example:
>
> (Tests) 49 % package ifneeded Tk [package require Tk]
> load {} Tk
>
>
> Here, Tk is loaded using "load", which means it is a binary extension.
> In contrast,
>
> (Tests) 50 % package ifneeded fileutil [package require fileutil]
> source /Users/chris/bin/wish86/lib/tcllib1.18/fileutil/fileutil.tcl
>

Thank you all so very much for these tips. With my occasional interaction with Tcl, I am not up to speed on how loading and sourcing work internally. This has been a great introduction.

I combined a couple of the suggested ideas together and came up with a script that generates a simple report on what gets loaded and what gets sourced. I renamed the load and source commands, and I am using the "package ifneeded ..." command to load the packages. At each invocation, I print a line. It seems to work fine.

However, some packages surprised me. Consider md5:

PACKAGE: md5
SOURCE: -encoding utf-8 C:/Tcl/lib/teapot/package/tcl/teapot/tcl8/8.2/md5-2.0.7.tm


Now, consider the weird output by md4: I doubt md4 requires such a weird collection of other packages. Perhaps it is searching everywhere to find it.
Is this normal?


PACKAGE: md4
SOURCE: -encoding utf-8 C:/Tcl/lib/teapot/package/tcl/teapot/tcl8/8.2/md4-1.0.6.tm
SOURCE: C:/Tcl/lib/tk8.5/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/Banking1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/base320.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/base32_hex0.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/bench0.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/BWidget1.9.8/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/calendar0.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/control0.1.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/critcl3.1.12/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/critcl_app3.1.12/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/critcl_class1.0.6/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/critcl_iassoc1.0.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/ctext3.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/doctools1.4.19/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/famfamfam1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/famfamfam_flags1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/famfamfam_mini1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/famfamfam_mint1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/famfamfam_silk1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/ip1.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/Iwidgets4.0.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/java1.0.0.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/json1.3.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/logger_utils1.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/math1.2.5/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/math_special0.3.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/math_statistics1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/mentry_common3.7/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/mimetype1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/nettool0.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/Plotchart2.3.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/pt_cparam_configuration_critcl1.0.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/pt_cparam_configuration_tea0.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/pt_parse_peg1.0.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/pt_rde1.0.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/snit2.3.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/struct_graph2.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/struct_queue1.4.5/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/struct_set2.2.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/struct_stack1.5.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/struct_tree2.1.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/tablelist_common5.13/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/tar0.10/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/tclcloud1.0.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/tclwinrm1.0.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/tkpiechart6.6/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/treeql1.3.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/uid1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/wcb3.5/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/widget_listentry0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/widget_listsimple0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/activestate_activetcl_demos8.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Canvas3d1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/crimp0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/crimp_bmp0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/crimp_core0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/crimp_pcx0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/crimp_pfm0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/crimp_pgm0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/crimp_ppm0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/crimp_sgi0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/crimp_sun0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/crimp_tk0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/dbus-tcl1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/dict8.5.3.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/DiffUtil0.3.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/dom_c2.6/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/dom_libxml22.6/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Expect5.43.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Ffidl0.6/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Garuda1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_base1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_bmp1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_dted1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_gif1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_ico1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_jpeg1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_pcx1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_pixmap1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_png1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_ppm1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_ps1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_raw1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_sgi1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_sun1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_tga1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_tiff1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_window1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_xbm1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_xpm1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Itcl3.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Itk3.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/jpegtcl8.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/lexec0.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/linenoise1.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Memchan2.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Mk4tcl2.4.9.7.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/newclock1.0.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Oratcl4.5/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/pngtcl1.4.12/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/ral0.10.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/rbc0.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/snack2.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/snackogg1.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/snacksphere1.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/snodbc1.2.20080522/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/sound2.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/sqlite33.8.10.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/sqlite33.8.8.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/stext0.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tcc0.4.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tcllibc0.3.14/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tclodbc2.5/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Tclode1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/TclOO1.0.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/TclScript1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tclspline1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Tclx8.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tclyaml0.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tcom3.9/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tdom0.8.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Tensor4.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tifftcl3.9.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tile0.8.4.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Tix8.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tkdnd2.8/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Tkhtml3.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/TkImageTools1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tkpath0.3.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Tktable2.11/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Tkzinc3.3.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tls1.6.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tls1.6.7.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tnc0.3.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Togl2.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/treectrl2.4.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Trf2.1.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tth0.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/twapi3.0.32/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/udp1.0.11/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/vfs1.4.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/vfs_cookfs_c1.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/vu2.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/win321.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/xml_c2.6/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/xml_expat2.6/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/XOTcl1.6.8/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/xslt2.6/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/zlibtcl1.2.8/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/pkgIndex.tcl
SOURCE: C:/Tcl/lib/tcl8.5/dde1.3/pkgIndex.tcl
SOURCE: C:/Tcl/lib/tcl8.5/http1.0/pkgIndex.tcl
SOURCE: C:/Tcl/lib/tcl8.5/opt0.4/pkgIndex.tcl
SOURCE: C:/Tcl/lib/tcl8.5/reg1.2/pkgIndex.tcl
SOURCE: C:/Tcl/lib/tcl8.5/tbcload1.7/pkgIndex.tcl
SOURCE: C:/Tcl/lib/tcl8.5/thread2.7.2/pkgIndex.tcl
SOURCE: C:/Tcl/lib/tcl8.5/trofs0.4.6/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tcllibc0.3.14/critcl-rt.tcl
LOAD: c:/Tcl/lib/teapot/package/win32-ix86/lib/tcllibc0.3.14/win32-ix86/tcllibc.dll Tcllibc





Arjen Markus

unread,
Oct 17, 2017, 3:07:49 PM10/17/17
to
On Tuesday, October 17, 2017 at 8:16:35 PM UTC+2, ze wrote:
> On Tuesday, October 17, 2017 at 2:40:39 AM UTC-4, Christian Gollwitzer wrote:
> >
> > This should be easy to find out. Fire up an interpreter which can load
> > the packages you need. Then "package ifneeded" tells you what it does
> > when you load the package. For example:
> >
> > (Tests) 49 % package ifneeded Tk [package require Tk]
> > load {} Tk
> >
> >
> > Here, Tk is loaded using "load", which means it is a binary extension.
> > In contrast,
> >
> > (Tests) 50 % package ifneeded fileutil [package require fileutil]
> > source /Users/chris/bin/wish86/lib/tcllib1.18/fileutil/fileutil.tcl
> >
>
> Thank you all so very much for these tips. With my occasional interaction with Tcl, I am not up to speed on how loading and sourcing work internally. This has been a great introduction.
>
> I combined a couple of the suggested ideas together and came up with a script that generates a simple report on what gets loaded and what gets sourced. I renamed the load and source commands, and I am using the "package ifneeded ..." command to load the packages. At each invocation, I print a line. It seems to work fine.
>
> However, some packages surprised me. Consider md5:
>
> PACKAGE: md5
> SOURCE: -encoding utf-8 C:/Tcl/lib/teapot/package/tcl/teapot/tcl8/8.2/md5-2.0.7.tm
>
>
> Now, consider the weird output by md4: I doubt md4 requires such a weird collection of other packages. Perhaps it is searching everywhere to find it.
> Is this normal?
>
>
> PACKAGE: md4
> SOURCE: -encoding utf-8 C:/Tcl/lib/teapot/package/tcl/teapot/tcl8/8.2/md4-1.0.6.tm
> SOURCE: C:/Tcl/lib/tk8.5/pkgIndex.tcl
...

Most files in the list are pkgIndex.tcl files - these files are sourced to examine what packages they belong to. Once these have been sourced, Tcl has a catalogue of packages that is used for any further requests.

I suspect that you first required the md4 package and then the md5 one. At least that is an explanation for the difference.

Regards,

Arjen

ze

unread,
Oct 17, 2017, 5:42:07 PM10/17/17
to
On Tuesday, October 17, 2017 at 3:07:49 PM UTC-4, Arjen Markus wrote:
> Most files in the list are pkgIndex.tcl files - these files are sourced to examine what packages they belong to. Once these have been sourced, Tcl has a catalogue of packages that is used for any further requests.
>
> I suspect that you first required the md4 package and then the md5 one. At least that is an explanation for the difference.
>

I agree with you that this looks like a possible explanation. However, there seems to be more to it. The order of md4 and md5 does not matter: I tested them individually, and one after another with the same results. Interestingly some other packages (like blowfish) also do this checking of a bunch of pkgIndex files.

In any case, the suggestions in this thread produced a solution. Thanks to all!

0 new messages