Invoking tcl

Scott Haneda talklists at newgeo.com
Wed Nov 4 22:43:00 PST 2009


Thanks for setting me straight on the tcl and tclsh ting

I am working on taking a large list of variants, and generating the  
conflicts dynamically.  The below works, but I think I need to eval it  
is in some way to get ports to recognize it.

set variants {english french spanish japanese dutch}

foreach variant_name $variants {
      # Quick way to remove the working variant from the list
      set no_conflicts [lsearch -all -inline -not -exact $variants  
$variant_name]
      set a [subst {variant $variant_name conflicts $no_conflicts  
description "Use $variant_name for server messages" {
                configure.args-append --with-language=$variant_name }
      }]
      puts $a
}

Better representation here: http://pastie.org/684447

Here is what it is printing out output
http://pastie.org/684449

Which I could copy and paste into the portfile, but I want to be more  
dynamic abut it.  I have tried this previous example a few ways, and  
am not getting it:

# Add langugage variants
foreach {language arg} ${languages} {
    set variant lang_[strsed ${arg} {g/-/_/}]
    set conflicts {}
    foreach {ignore conflicting_arg} ${languages} {
        if {${conflicting_arg} != ${arg}} {
            set conflicting_variant lang_[strsed ${conflicting_arg}  
{g/-/_/}]
            lappend conflicts ${conflicting_variant}
        }
    }
    eval [subst {
        variant ${variant} conflicts ${conflicts} description "Use $ 
{language} language for server messages" {
            configure.args-append   --with-language=${arg}
        }
    }]
}

Yes, I can go with the existing code, but I seem to understand the one  
I wrote, and it seems to be shorter, and better tailored to this  
case.  Thanks for any pointers.  tcl is a weird language.
-- 
Scott * If you contact me off list replace talklists@ with scott@ * 


More information about the macports-dev mailing list