1
#---------------------------------------------------------------------
2
# Support for unknown command
3
#---------------------------------------------------------------------
5
proc unknown {proname args} {
6
upvar #0 __PLTcl_unknown_support_plan_modname p_mod
7
upvar #0 __PLTcl_unknown_support_plan_modsrc p_src
9
#-----------------------------------------------------------
10
# On first call prepare the plans
11
#-----------------------------------------------------------
12
if {![info exists p_mod]} {
13
set p_mod [spi_prepare \
14
"select modname from pltcl_modfuncs \
15
where funcname = \$1" name]
16
set p_src [spi_prepare \
17
"select modseq, modsrc from pltcl_modules \
19
order by modseq" name]
22
#-----------------------------------------------------------
23
# Lookup the requested function in pltcl_modfuncs
24
#-----------------------------------------------------------
25
set n [spi_execp -count 1 $p_mod [list [quote $proname]]]
27
#-----------------------------------------------------------
28
# Not found there either - now it's really unknown
29
#-----------------------------------------------------------
30
return -code error "unknown command '$proname'"
33
#-----------------------------------------------------------
34
# Collect the source pieces from pltcl_modules
35
#-----------------------------------------------------------
37
spi_execp $p_src [list [quote $modname]] {
41
#-----------------------------------------------------------
42
# Load the source into the interpreter
43
#-----------------------------------------------------------
47
elog NOTICE "pltcl unknown: error while loading module $modname"
51
#-----------------------------------------------------------
52
# This should never happen
53
#-----------------------------------------------------------
54
if {[catch {info args $proname}]} {
56
"unknown command '$proname' (still after loading module $modname)"
59
#-----------------------------------------------------------
60
# Finally simulate the initial procedure call
61
#-----------------------------------------------------------
62
return [uplevel 1 $proname $args]