-
Notifications
You must be signed in to change notification settings - Fork 24
/
pkgIndex.tcl.in
62 lines (56 loc) · 2.02 KB
/
pkgIndex.tcl.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#
# Tcl package index file
#
namespace eval ::tkdnd {
## Check if a debug level must be set...
if {[info exists ::TKDND_DEBUG_LEVEL]} {
variable _debug_level $::TKDND_DEBUG_LEVEL
} elseif {[info exists ::env(TKDND_DEBUG_LEVEL)]} {
variable _debug_level $::env(TKDND_DEBUG_LEVEL)
} else {
variable _debug_level 0
}
# ----------------------------------------------------------------------------
# Command tkdnd::debug_enabled: returns the requested debug level (0 = no debug).
# ----------------------------------------------------------------------------
proc debug_enabled { {level {}} } {
variable _debug_level
if {$level != {}} {
if {[string is integer -strict $level]} {
set _debug_level $level
} elseif {[string is true $level]} {
set _debug_level 1
}
}
return $_debug_level
};# debug_enabled
# ----------------------------------------------------------------------------
# Command tkdnd::source: source a Tcl fileInitialise the TkDND package.
# ----------------------------------------------------------------------------
proc source { filename { encoding utf-8 } } {
variable _package_dir
# If in debug mode, enable debug statements...
set dbg_lvl [debug_enabled]
if {$dbg_lvl} {
puts "tkdnd::source (debug level $dbg_lvl) $filename"
set fd [open $filename r]
fconfigure $fd -encoding $encoding
set script [read $fd]
close $fd
set map {}
for {set lvl 0} {$lvl <= $dbg_lvl} {incr lvl} {
lappend map "#DBG$lvl " {}
}
lappend map {#DBG } {}
set script [string map $map $script]
return [eval $script]
}
::source -encoding $encoding $filename
};# source
}; # namespace ::tkdnd
package ifneeded tkdnd @PACKAGE_VERSION@ \
"tkdnd::source \{$dir/tkdnd.tcl\} ; \
tkdnd::initialise \{$dir\} @PKG_LIB_FILE@ @PACKAGE_NAME@"
package ifneeded tkdnd::utils @PACKAGE_VERSION@ \
"tkdnd::source \{$dir/tkdnd_utils.tcl\} ; \
package provide tkdnd::utils @PACKAGE_VERSION@"