[Swift-user] Re: Swift app question

Jonathan Monette jon.monette at gmail.com
Wed Sep 8 22:32:48 CDT 2010


Here is my actual code I was referencing:

( Image diff_imgs[] ) mDiffBatch( Table diff_tbl, MosaicData hdr )
{
     DiffStruct diffs[] <csv_mapper; file = diff_tbl, skip = 1, 
hdelim="| ">;

     tracef( "%s is closed %k\n", @filename( hdr ), hdr 
);                                             //1
     tracef( "Mapped %i files from the csv_mapper and \"%s\"\n", 
@length( diffs ), @diff_tbl );      //2

     foreach d_entry, i in diffs
     {
         tracef( "%s is closed on iteration %i%k\n", @d_entry.plus, i, 
d_entry.plus );                    //3
         tracef( "%s is closed onn iteration %i%k\n", @d_entry.minus,  
i, d_entry.minus );           //4

         Image proj_1 <single_file_mapper; file = @strcat( "proj_dir/", 
@d_entry.plus )>;
         Image proj_2 <single_file_mapper; file = @strcat( "proj_dir/", 
@d_entry.minus )>;

         tracef( "%s is closed on iteration %i%k\n", @proj_1, i, proj_1 
);                                       //5
         tracef( "%s is closed on iteration %i%k\n", @proj_2, i ,proj_2 
);                                      //6

         Image diff_img <single_file_mapper; file = @strcat( 
"diff_dir/", @d_entry.diff )>;
         tracef( "diff_img was mapped to %s on iteration %i\n" 
, at diff_img, i );                           //7
         diff_img = mDiff( proj_1, proj_2, hdr );

         tracef( "DIFFERENCED %s on iteration %i%k\n", @filename( 
diff_img ), i ,diff_img );   //8
         diff_imgs[ i ] = diff_img;
     }
}

tracef 1 and 2 always print out.  tracef 3, 4, 5, 6, and 7 print out 
some of the iterations but never all.  And the tracef 8 never gets 
printed because the script hangs and the app mDiff is never executed.   
This is what I have been trying to recreate.  But simply taking out the 
mDiff app and replacing it with a script that basically does a cat has 
the script complete to the end.  So I have been trying to understand 
what Swift is actually doing.
This code hangs.

On 09/08/2010 10:24 PM, Mihael Hategan wrote:
> On Wed, 2010-09-08 at 21:40 -0500, Jonathan Monette wrote:
>    
>> Ok.  And like I said this was a dumbed down example.  I just needed to
>> show a mappings and didn't want to use a fancy mapper.  In my code x
>> will be a different value for each iteration.  Thanks though.  That
>> clears things up.
>>      
> I was a bit confused. If there is a dependency relation between y and
> the inputs to an app (whether though a mapper or directly) than it has
> to be satisfied for the app to run. However, when it comes to mappers,
> swift allows some hidden dependencies to be expressed. For example when
> some app produces "a.txt" and somewhere you say f<"a.txt">. Swift won't
> enforce that.
>
> Mihael
>
> [...]
>
>    



More information about the Swift-user mailing list