[Swift-user] app argument int passed as float

Michael Wilde wilde at mcs.anl.gov
Fri Oct 21 14:38:33 CDT 2011


I tried this with an example closer to what you wrote in the initial message, Ketan.

It still seems to work OK under the trunk rev indicated:

bri$ cat km1.swift
type outfile;

app (outfile o ) myapp(string a, int b ){
 echo a b  stdout=@o;
}

outfile out<"km1.out">;

out = myapp("foo", 35 );

bri$ swift km1.swift

no sites file specified, setting to default: /home/wilde/swift/rev/trunk/etc/sites.xml
Swift svn swift-r5234 cog-r3296

RunID: 20111021-1436-z7s2z5rb
Progress:  time: Fri, 21 Oct 2011 14:37:01 -0500
Final status: Fri, 21 Oct 2011 14:37:01 -0500  Finished successfully:1
bri$ cat km1.out
foo 35
bri$ 

- Mike


----- Original Message -----
> From: "Michael Wilde" <wilde at mcs.anl.gov>
> To: "Ketan Maheshwari" <ketancmaheshwari at gmail.com>
> Cc: "Swift User" <swift-user at ci.uchicago.edu>
> Sent: Friday, October 21, 2011 2:33:48 PM
> Subject: Re: [Swift-user] app argument int passed as float
> In at least some recent version of trunk, ints seem to get passed ok,
> as below.
> 
> Now lets see where the difference is.
> 
> - Mike
> 
> bri$ cat args.swift
> type file;
> 
> app (file o) echo(int i)
> {
> echo i stdout=@o;
> }
> 
> file eo<"echo.out">;
> 
> eo=echo(123);
> bri$ which swift
> ~/swift/rev/trunk/bin/swift
> bri$ swift -version
> no sites file specified, setting to default:
> /home/wilde/swift/rev/trunk/etc/sites.xml
> Swift svn swift-r5234 cog-r3296
> 
> bri$ swift args.swift
> no sites file specified, setting to default:
> /home/wilde/swift/rev/trunk/etc/sites.xml
> Swift svn swift-r5234 cog-r3296
> 
> RunID: 20111021-1431-8mzx0ya2
> Progress: time: Fri, 21 Oct 2011 14:31:04 -0500
> Final status: Fri, 21 Oct 2011 14:31:04 -0500 Finished successfully:1
> bri$ cat echo.out
> 123
> bri$
> 
> 
> 
> ----- Original Message -----
> > From: "Ketan Maheshwari" <ketancmaheshwari at gmail.com>
> > To: "Swift User" <swift-user at ci.uchicago.edu>
> > Sent: Wednesday, October 19, 2011 8:30:24 PM
> > Subject: [Swift-user] app argument int passed as float
> > Hi,
> >
> >
> > In my app definition, I have an argument of type int that is
> > expected
> > by the executable.
> >
> >
> >
> > I define my app something like this:
> >
> >
> > (outfile o ) app myapp(string a, int b, datafile c, ...){
> > cmd a b c stdout @o;
> > }
> >
> >
> > I call this as:
> > <..mappers..>
> >
> >
> > out = myapp("foo", 35, @afile, ...);
> >
> >
> > However, it seems that at the time of the actual call, the value 35
> > which is an int get replaced by the value 35.0, a float.
> >
> >
> > I could see this from the arguments dumped by swift at the end of
> > exception message:
> >
> >
> > "
> >
> > Exception in presgt:
> > Arguments: [TEST, 35.0, .....
> > "
> >
> >
> > The underlying app binary doesn't like because apparently the java
> > is
> > calling Integer.parseInt and getting a float formatted string.
> >
> > Any ideas?
> >
> >
> > Regards, --
> > Ketan
> >
> >
> >
> > _______________________________________________
> > Swift-user mailing list
> > Swift-user at ci.uchicago.edu
> > https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user
> 
> --
> Michael Wilde
> Computation Institute, University of Chicago
> Mathematics and Computer Science Division
> Argonne National Laboratory

-- 
Michael Wilde
Computation Institute, University of Chicago
Mathematics and Computer Science Division
Argonne National Laboratory




More information about the Swift-user mailing list