[Swift-commit] r7583 - SwiftApps/swift-galaxy/swift
ketan at ci.uchicago.edu
ketan at ci.uchicago.edu
Mon Feb 10 16:33:10 CST 2014
Author: ketan
Date: 2014-02-10 16:33:10 -0600 (Mon, 10 Feb 2014)
New Revision: 7583
Modified:
SwiftApps/swift-galaxy/swift/swiftforeach.xml
SwiftApps/swift-galaxy/swift/swiftforeachlist.sh
SwiftApps/swift-galaxy/swift/swiftforeachrange.sh
Log:
test case with file as arg works
Modified: SwiftApps/swift-galaxy/swift/swiftforeach.xml
===================================================================
--- SwiftApps/swift-galaxy/swift/swiftforeach.xml 2014-02-10 21:52:59 UTC (rev 7582)
+++ SwiftApps/swift-galaxy/swift/swiftforeach.xml 2014-02-10 22:33:10 UTC (rev 7583)
@@ -23,9 +23,12 @@
$outloc
$logfile
$outlist
- #for $a in $arg
- ${a.argname}
+ #for $a in $stringarg
+ ${a.stringargname}
#end for
+ #for $a in $filearg
+ ${a.fileargname}
+ #end for
#else
swiftforeachlist.sh
$site
Modified: SwiftApps/swift-galaxy/swift/swiftforeachlist.sh
===================================================================
--- SwiftApps/swift-galaxy/swift/swiftforeachlist.sh 2014-02-10 21:52:59 UTC (rev 7582)
+++ SwiftApps/swift-galaxy/swift/swiftforeachlist.sh 2014-02-10 22:33:10 UTC (rev 7583)
@@ -50,7 +50,7 @@
type file;
app (file _out, file _err) anapp(file _exec, int _i, string _stringargs[], file _fileargs[]){
- $interpreter @_exec _i _stringargs _fileargs stdout=@_out stderr=@_err;
+ $interpreter @_exec _i _stringargs @_fileargs stdout=@_out stderr=@_err;
}
$stringarrayexpr
$filearrayexpr
Modified: SwiftApps/swift-galaxy/swift/swiftforeachrange.sh
===================================================================
--- SwiftApps/swift-galaxy/swift/swiftforeachrange.sh 2014-02-10 21:52:59 UTC (rev 7582)
+++ SwiftApps/swift-galaxy/swift/swiftforeachrange.sh 2014-02-10 22:33:10 UTC (rev 7583)
@@ -23,34 +23,57 @@
logfile=$1
shift
-a=()
+stringargs=()
while [ $# -gt 0 ] ; do
- a+=("\"$1\"")
+ stringargs+=("\"$1\"")
shift
done
#workout the array only if user adds args else make it blank
-if [ ${#a[@]} -gt 0 ] ; then
- tmp=$(printf -- '%s,' "${a[@]}")
- arrayexpr='string args[]=['$(echo $tmp | sed s/,$//)'];';
+stringargs=()
+while [ $# -gt 0 ] ; do
+ stringargs+=("\"$1\"")
+ shift
+done
+
+#workout the array only if user adds args else make it blank
+if [ ${#stringargs[@]} -gt 0 ] ; then
+ tmp=$(printf -- '%s,' "${stringargs[@]}")
+ stringarrayexpr='string stringargs[]=['$(echo $tmp | sed s/,$//)'];';
else
- arrayexpr='string args[];'
+ stringarrayexpr='string stringargs[];'
fi
+fileargs=()
+while [ $# -gt 0 ] ; do
+ fileargs+=("\"$1\"")
+ shift
+done
+
+#workout the array only if user adds file args else make it blank
+if [ ${#fileargs[@]} -gt 0 ] ; then
+ tmp=$(printf -- '%s,' "${fileargs[@]}")
+ filearrayexpr='file fileargs[]=['$(echo $tmp | sed s/,$//)'];';
+else
+ filearrayexpr='file fileargs[];'
+fi
+
#Build Swift source code
cat << EOF > $wdir/script.swift
type file;
-app (file _out, file _err) anapp(file _exec, int _i, string _args[]){
- $interpreter @_exec _i _args stdout=@_out stderr=@_err;
+app (file _out, file _err) anapp(file _exec, int _i, string _stringargs[], file _fileargs[]){
+ $interpreter @_exec _i _stringargs @_fileargs stdout=@_out stderr=@_err;
}
-$arrayexpr
+$stringarrayexpr
+$filearrayexpr
+
file exec<"$executable">;
foreach i in [$rstart:$rend:$stepsize]{
file out <single_file_mapper; file=@strcat("$outloc", "/", i, ".out")>;
file err <single_file_mapper; file=@strcat("$outloc", "/", i, ".err")>;
- (out,err) = anapp(exec, i, args);
+ (out,err) = anapp(exec, i, stringargs, fileargs);
}
EOF
More information about the Swift-commit
mailing list