[Swift-devel] terrain example

Ben Clifford benc at hawaga.org.uk
Sun Dec 9 09:38:46 CST 2007



On Fri, 7 Dec 2007, Dr. Raffaele Montella wrote:

> The terrain script produces a TERRAIN_DOMAINx.gz file (with x=1..nests) in
> the ./output directory.

At the moment, Swift cannot deal with variable numbers of output files 
from a program.

In your code, you map this:

  terrainDomainType terrainDomains[] <filesys_mapper;
     location="./output/", 
     prefix="TERRAIN_DOMAIN",
     suffix=".gz">;

and then try to use this as a return value, like this:

  (terrainDomainType terrainDomains[])terrain(string lon, string lat, int 
   nests) {

At the moment, Swift doesn't know how to deal with that - it does not know 
how to deal with output files where the names are not known before 
invocation.

You might be able to hack around in certain cases by explicitly listing 
the files - declare terrainDomains like this:

terrainDomainType terrainDomains[] <fixed_array_mapper;
  files="output/TERRAIN_DOMAIN1.gz output/TERRAIN_DOMAIN2.gz">;

However, this needs to a different declaration for every different value 
of nests, so is not a very good solution.

Better handling of this kind of situation is on the to-do list, but it 
won't happen soon.

-- 



More information about the Swift-devel mailing list