-
Notifications
You must be signed in to change notification settings - Fork 30
/
pkgIndex.tcl
74 lines (66 loc) · 2.85 KB
/
pkgIndex.tcl
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
63
64
65
66
67
68
69
70
71
72
73
74
# Tcl package index file, version 1.1
# This file is generated by the "pkg_mkIndex" command
# and sourced either when an application starts up or
# by a "package unknown" script. It invokes the
# "package ifneeded" command to set up package-related
# information so that packages will be loaded automatically
# in response to "package require" commands. When this
# script is sourced, the variable $dir must contain the
# full path name of this file's directory.
if {[namespace exists ::testcl]} {
#already loaded
return
}
set disable_interpreter_warning [ expr { [ array names env DISABLE_TESTCL_INTERPRETER_WARNING ] ne "" && $env(DISABLE_TESTCL_INTERPRETER_WARNING) eq "true"} ]
if { $::tcl_platform(platform) eq "java" } {
if { [catch { expr {"abc" starts_with "a"} } errormsg ] } {
puts stderr "WARNING"
puts stderr "WARNING The jtcl-irule extension to JTcl is not loaded"
puts stderr "WARNING"
puts stderr "WARNING The following custom iRule operators will not work:"
puts stderr "WARNING - starts_with"
puts stderr "WARNING - ends_with"
puts stderr "WARNING - contains"
puts stderr "WARNING - matches_glob"
puts stderr "WARNING - matches_regex"
puts stderr "WARNING - equals"
puts stderr "WARNING - and"
puts stderr "WARNING - or"
puts stderr "WARNING - not"
puts stderr "WARNING"
puts stderr "WARNING Please check your JTcl classpath - see TesTcl documentation"
puts stderr "WARNING for installation instructions"
puts stderr "WARNING"
}
} elseif { ! $disable_interpreter_warning } {
puts stderr "WARNING"
puts stderr "WARNING You're using a Tcl interpreter that doesn't support the jtcl-irule extension"
puts stderr "WARNING which requires the java based JTcl interpreter"
puts stderr "WARNING"
puts stderr "WARNING The following custom iRule operators will not work:"
puts stderr "WARNING - starts_with"
puts stderr "WARNING - ends_with"
puts stderr "WARNING - contains"
puts stderr "WARNING - matches_glob"
puts stderr "WARNING - matches_regex"
puts stderr "WARNING - equals"
puts stderr "WARNING - and"
puts stderr "WARNING - or"
puts stderr "WARNING - not"
puts stderr "WARNING"
puts stderr "WARNING If you require any of these operators, you'll have to use JTcl instead"
puts stderr "WARNING Please see TesTcl documentation"
puts stderr "WARNING"
}
set files { assert.tcl it.tcl on.tcl onirule.tcl irulehttp.tcl iruleuri.tcl global.tcl ip.tcl classes.tcl }
set sources {}
foreach {f} $files {
lappend sources [list source [file join $dir src $f]]
}
package ifneeded testcl 1.0.14 [join $sources "\n"]
# Disable certain Tcl commands from iRules
if { $::tcl_platform(platform) eq "java" } {
source [file join $dir src/disabled_commands_jtcl.tcl]
} else {
source [file join $dir src/disabled_commands_tclsh.tcl]
}