[Swift-commit] r7722 - SwiftApps/swift-galaxy/swift

ketan at ci.uchicago.edu ketan at ci.uchicago.edu
Mon Mar 17 14:21:50 CDT 2014


Author: ketan
Date: 2014-03-17 14:21:50 -0500 (Mon, 17 Mar 2014)
New Revision: 7722

Modified:
   SwiftApps/swift-galaxy/swift/swiftforeach.xml
   SwiftApps/swift-galaxy/swift/swiftforeachlist.sh
   SwiftApps/swift-galaxy/swift/swiftforeachrange.sh
Log:
stdin file

Modified: SwiftApps/swift-galaxy/swift/swiftforeach.xml
===================================================================
--- SwiftApps/swift-galaxy/swift/swiftforeach.xml	2014-03-17 18:06:27 UTC (rev 7721)
+++ SwiftApps/swift-galaxy/swift/swiftforeach.xml	2014-03-17 19:21:50 UTC (rev 7722)
@@ -18,6 +18,7 @@
         "${swiftargs}"
         "${interpret}"
         "${exec}"
+        "${stdin}"
         "${rangeorlist.rngstart}"
         "${rangeorlist.rend}"
         "${rangeorlist.stepsize}"
@@ -34,6 +35,7 @@
         "${swiftargs}"
         "${interpret}"
         "${exec}"
+        "${stdin}"
         "${rangeorlist.listfile}"
         "${outloc}"
         "${logfile}"
@@ -48,6 +50,7 @@
         "${swiftargs}"
         "${interpret}"
         "${exec}"
+        "${stdin}"
         "${rangeorlist.rngstart}"
         "${rangeorlist.rend}"
         "${rangeorlist.stepsize}"
@@ -89,6 +92,7 @@
 
         <!--<param format="sh,binexec" name="exec" type="data" label="Executable"/>-->
         <param name="exec" type="data" label="Executable" help="select executable" />
+        <param name="stdin" type="data" label="Standard input file" help="select standard input" />
 
         <conditional name="rangeorlist">
         <param name="rl" type="select" label="Select range or list">

Modified: SwiftApps/swift-galaxy/swift/swiftforeachlist.sh
===================================================================
--- SwiftApps/swift-galaxy/swift/swiftforeachlist.sh	2014-03-17 18:06:27 UTC (rev 7721)
+++ SwiftApps/swift-galaxy/swift/swiftforeachlist.sh	2014-03-17 19:21:50 UTC (rev 7722)
@@ -11,6 +11,8 @@
 shift
 executable=$1
 shift
+stdin=$1
+shift
 listfile=$1
 shift
 outloc=$1
@@ -19,7 +21,6 @@
 shift
 logfile=$1
 shift
-
 stringargs=$1
 shift 
 
@@ -30,6 +31,13 @@
     stringarrayexpr='string stringargs[];'
 fi
 
+#workout standard input file
+if [ "${stdin}" ] ; then
+    stdinfile="${stdin}"
+else
+    stdinfile="/dev/null"
+fi
+
 fileargs=()
 while [ $# -gt 0 ] ; do
   fileargs+=("\"$1\"")
@@ -56,8 +64,8 @@
 
 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;
+app (file _out, file _err) anapp(file _exec, int _i, string _stringargs[], file _fileargs[], file _stdin){
+    $interpreter @_exec _i _stringargs @_fileargs stdin=@_stdin stdout=@_out stderr=@_err;
 }
 $stringarrayexpr
 $filearrayexpr
@@ -68,7 +76,7 @@
 foreach l, i in list{
     file out <single_file_mapper; file=@strcat("$outloc", "/", l, ".", i, ".out")>;
     file err <single_file_mapper; file=@strcat("$outloc", "/", l, ".", i, ".err")>;
-    (out,err) = anapp(exec, i, stringargs, fileargs);
+    (out,err) = anapp(exec, i, stringargs, fileargs,"${stdinfile}");
 }
 EOF
 

Modified: SwiftApps/swift-galaxy/swift/swiftforeachrange.sh
===================================================================
--- SwiftApps/swift-galaxy/swift/swiftforeachrange.sh	2014-03-17 18:06:27 UTC (rev 7721)
+++ SwiftApps/swift-galaxy/swift/swiftforeachrange.sh	2014-03-17 19:21:50 UTC (rev 7722)
@@ -12,6 +12,8 @@
 shift
 executable=$1
 shift
+stdin=$1
+shift
 rstart=$1
 shift
 rend=$1
@@ -35,6 +37,13 @@
     stringarrayexpr='string stringargs[];'
 fi
 
+#workout standard input file
+if [ "${stdin}" ] ; then
+    stdinfile="${stdin}"
+else
+    stdinfile="/dev/null"
+fi
+
 fileargs=()
 while [ $# -gt 0 ] ; do
     fileargs+=("\"$1\"")
@@ -63,8 +72,8 @@
 
 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;
+app (file _out, file _err) anapp(file _exec, int _i, string _stringargs[], file _fileargs[], file _stdin){
+    $interpreter @_exec _i _stringargs @_fileargs stdin=@_stdin stdout=@_out stderr=@_err;
 }
 
 $stringarrayexpr
@@ -74,7 +83,7 @@
 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, stringargs, fileargs);
+    (out,err) = anapp(exec, i, stringargs, fileargs, "${stdinfile}");
 }
 EOF
 




More information about the Swift-commit mailing list