On Tue, Jun/12/2007 08:07:20AM, Jeff Squyres wrote: > On Jun 11, 2007, at 6:02 PM, Ethan Mallove wrote: > > > btls = &if("®exp("&shell("hostname")", "v440-2|v20z-2")", \ > > "&enumerate("self,sm,tcp")", \ > > "&if("®exp("&shell("hostname")", "v440-6")", \ > > "&enumerate("udapl")", \ > > "&enumerate("sm", "tcp", "sm,tcp", "udapl", > > "sm,udapl")"" \ > > ) \ > > ) > > Yowza! We really need to make this quoting situation better > somehow. :-( > > Don't you have an extra ) in there at the end? > > > How come EvaluateString() doesn't translate this: > > > > btls = &if("®exp("&shell("hostname")", "v440-2|v20z-2")", \ > > "&enumerate("self,sm,tcp")", \ > > "&if("®exp("&shell("hostname")", "v440-6")", \ > > "&enumerate("udapl")", \ > > "&enumerate("sm", "tcp", "sm,tcp", "udapl", > > "sm,udapl")"" \ > > ) \ > > ) > > > > Into one big eval block like this: > > > > eval $btls = MTT::Functions::if(MTT::Functions::regexp > > (MTT::Functions::shell("hostname"), "v440-2|v20z-2"), > > MTT::Functions::enumerate("self,sm,tcp"), > > MTT::Functions::if("MTT::Functions::regexp > > ("MTT::Functions::shell("hostname"), "v440-6"), > > MTT::Functions::enumerate("udapl"), > > MTT::Functions::enumerate("sm", "tcp", > > "sm,tcp", "udapl", "sm,udapl") > > ) > > ) > > > > So we could put the burden of the nasty recursive > > parenthesis/quote parsing on perl, rather than MTT. That > > would seem to naturally make the INI funclet syntax more > > Perl-like. > > Ah -- I had to think about this a bit before I figured it out/ > remembered. I think we won't get the expansion effect if you do it > this way.
No expansion effect? As long as the perl code evaluates to an array, couldn't it to work? E.g., exec = mpirun --mca btl @btls@ ... # Returns an array btls = ("sm", "tcp") So EvaluateString() would do only this: * Substitute all &funcs() with MTT::Functions::funcs() * Substitute all $vars with same-INI-section params * Backslash escape @ symbols so they show up as strings in the eval'd result * Perform an "eval" on the final string * Iterate over the result of the above step's string, replacing "@multiplier" strings with the corresponding element of the @multiplier array > Although it might solve some other issues (e.g., https:// > svn.open-mpi.org/trac/mtt/ticket/184)...? > The mess atop this email would simplify to: btls = if ($hostname =~ /foo/) { \ return ("self,sm,tcp"); \ } elsif ($hostname =~ /bar/) { \ return ("udapl"); \ } else { \ return ("sm", "tcp", "sm,tcp", "udapl", "sm,udapl"); \ } -Ethan > -- > Jeff Squyres > Cisco Systems > > _______________________________________________ > mtt-users mailing list > mtt-us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/mtt-users