Invoking tcl

Scott Haneda talklists at newgeo.com
Thu Nov 5 20:09:42 PST 2009


Any takers?  This is the last thing from getting me to port  
submission, or I can go the sloppy way and allow copy and paste, which  
makes the portfile about 50 lines more than it need be.

Thanks all.
-- 
Scott * If you contact me off list replace talklists@ with scott@ *

On Nov 4, 2009, at 10:43 PM, Scott Haneda wrote:

> 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.



More information about the macports-dev mailing list