Skip to content
Browse files

create the procedure for a variant earlier in the process.

trying to store it as a variable made the quoting un-manageable.

git-svn-id: d073be05-634f-4543-b044-5fe20cf6d1d6
  • Loading branch information
Kevin Van Vechten
Kevin Van Vechten committed Oct 10, 2002
1 parent 74c0232 commit 64176aaec5e667323f36e5992847c3baa7d471c1
Showing with 7 additions and 4 deletions.
  1. +7 −4 src/port1.0/portutil.tcl
@@ -234,7 +234,10 @@ proc variant {args} {
set obj [variant_new $name]
$obj append provides $provides
$obj append requires $requires
$obj set code $code

# make a user procedure named variant-blah-blah
# well will call this procedure during variant-run
makeuserproc $name \{$code\}
lappend all_variants $obj

# Export provided variant to PortInfo
@@ -379,7 +382,7 @@ proc include {fname} {
# all the globals in its scope. This is undeniably ugly, but I haven't
# thought of any other way to do this.
proc makeuserproc {name body} {
regsub -- "^\{(.*?)" $body "\{ \n eval \"global \[info globals\]\" \n \\1" body
regsub -- "^\{(.*?)" $body "\{ \n foreach g \[info globals\] \{ \n global \$g \n \} \n \\1" body
eval "proc $name {} $body"

@@ -742,8 +745,8 @@ proc choose_variants {dlist variations} {
proc variant_run {this} {
set name [$this get name]
ui_debug "Executing $name provides [$this get provides]"
makeuserproc ${name}-code "[$this get code]"
if ([catch ${name}-code result]) {
# execute proc with same name as variant.
if {[catch ${name} result]} {
ui_error "Error executing $name: $result"
return 1

0 comments on commit 64176aa

Please sign in to comment.
You can’t perform that action at this time.