summaryrefslogtreecommitdiff
path: root/lib/app-critcl/critcl.tcl
diff options
context:
space:
mode:
authorAndrej Shadura <andrewsh@debian.org>2018-06-05 17:58:52 +0200
committerAndrej Shadura <andrewsh@debian.org>2018-06-05 17:58:52 +0200
commit9af9c3a6a9e4b6a304a779c1b8985848c35c3936 (patch)
tree0ff68485f683ae31648273a83ab75e1eccf875dd /lib/app-critcl/critcl.tcl
parent887f6cfe7452b4ee442d1f3cd46d9648236fc28c (diff)
New upstream version 3.1.17
Diffstat (limited to 'lib/app-critcl/critcl.tcl')
-rw-r--r--lib/app-critcl/critcl.tcl52
1 files changed, 43 insertions, 9 deletions
diff --git a/lib/app-critcl/critcl.tcl b/lib/app-critcl/critcl.tcl
index 28c3796..5d8eb0e 100644
--- a/lib/app-critcl/critcl.tcl
+++ b/lib/app-critcl/critcl.tcl
@@ -33,9 +33,8 @@ package require cmdline
namespace eval ::critcl::app {}
# # ## ### ##### ######## ############# #####################
-
-# Intercept 'package' calls.
-
+## Intercept 'package' calls.
+#
# This code is present to handle the possibility of building multiple
# different versions of the same package, or of different packages
# having dependencies on different versions of a 3rd party
@@ -100,6 +99,32 @@ proc ::critcl::msg {args} {
}
# # ## ### ##### ######## ############# #####################
+##
+# Rewrite the hook handling declarations found after the build.
+# The default of clearing state for a new build is not the right
+# thing to do in mode "precompile". Here we want to see an ERROR.
+
+proc ::critcl::HandleDeclAfterBuild {} {
+ if {![done]} return
+ set cloc {}
+ if {![catch {
+ array set loc [info frame -2]
+ } msg]} {
+ if {$loc(type) eq "source"} {
+ set cloc "@$loc(file):$loc(line)"
+ } else {
+ set cloc " ([array get loc])"
+ }
+ } ;#else { set cloc " ($msg)" }
+
+ append err [lindex [info level -1] 0]
+ append err $cloc
+ append err ": Illegal attempt to define C code in [This] after it was built."
+ append err \n [at::SHOWFRAMES]
+ error $err
+}
+
+# # ## ### ##### ######## ############# #####################
proc ::critcl::app::main {argv} {
Cmdline $argv
@@ -111,6 +136,7 @@ proc ::critcl::app::main {argv} {
if {$v::mode eq "pkg"} {
set pkgcache [PackageCache]
critcl::cache $pkgcache
+ critcl::fastuuid
}
ProcessInput
@@ -238,6 +264,12 @@ proc ::critcl::app::Cmdline {argv} {
#critcl::config lines 0
set v::keep 1
}
+ trace-commands {
+ critcl::config trace 1
+ }
+ trace {
+ critcl::cflags -DCRITCL_TRACER
+ }
help { incr help }
libdir {
set v::libdir $arg
@@ -738,7 +770,7 @@ proc ::critcl::app::ProcessInput {} {
array set r $results
append v::edecls "extern Tcl_AppInitProc $r(initname)_Init;\n"
- append v::initnames " if ($r(initname)_Init(ip) != TCL_OK) return TCL_ERROR;\n"
+ append v::initnames " if ($r(initname)_Init(interp) != TCL_OK) return TCL_ERROR;\n"
append v::license [License $f $r(license)]
lappend v::pkgs $r(pkgname)
@@ -818,7 +850,7 @@ proc ::critcl::app::BuildBracket {} {
eval $lib
set lib critcl::clibraries
- critcl::lappendlist lib [lsort -unique $v::clibraries]
+ critcl::lappendlist lib $v::clibraries
eval $lib
eval [linsert [lsort -unique $v::ldflags] 0 critcl::ldflags]
@@ -1248,14 +1280,16 @@ proc ::critcl::app::PlaceTclCompanionFiles {pkgdir} {
set tcldir [file join $pkgdir tcl]
file mkdir $tcldir
set files {}
+ set id 0
foreach t $v::tsources {
- file copy -force $t $tcldir
+ set dst [file tail $t]
+ set dst [file rootname $dst]_[incr id][file extension $dst]
- set t [file tail $t]
- lappend files $t
+ file copy -force $t $tcldir/$dst
+ lappend files $dst
# Metadata management
- lappend v::meta [list included tcl/$t]
+ lappend v::meta [list included tcl/$dst]
}
return $files
}