[Swift-commit] r7149 - in SwiftApps/tryswift: . config css js/ace scripts

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Fri Oct 11 11:16:10 CDT 2013


Author: davidk
Date: 2013-10-11 11:16:10 -0500 (Fri, 11 Oct 2013)
New Revision: 7149

Added:
   SwiftApps/tryswift/scripts/001-introduction.html
   SwiftApps/tryswift/scripts/001-introduction.swift
   SwiftApps/tryswift/scripts/001-introduction.txt
   SwiftApps/tryswift/scripts/002-helloworld.html
   SwiftApps/tryswift/scripts/002-helloworld.swift
   SwiftApps/tryswift/scripts/002-helloworld.txt
   SwiftApps/tryswift/scripts/formatting.css
   SwiftApps/tryswift/scripts/p1.txt
   SwiftApps/tryswift/scripts/p2.txt
   SwiftApps/tryswift/scripts/p3.txt
   SwiftApps/tryswift/scripts/p4.txt
   SwiftApps/tryswift/scripts/p5.txt
   SwiftApps/tryswift/scripts/p6.txt
Removed:
   SwiftApps/tryswift/css/tryswift-php.css
   SwiftApps/tryswift/css/tryswift.old.css
Modified:
   SwiftApps/tryswift/config/sites.xml
   SwiftApps/tryswift/config/tc.data
   SwiftApps/tryswift/css/tryswift.css
   SwiftApps/tryswift/getfiles.php
   SwiftApps/tryswift/index.php
   SwiftApps/tryswift/js/ace/theme-solarized_light.js
   SwiftApps/tryswift/scripts/p1.swift
   SwiftApps/tryswift/scripts/p2.swift
   SwiftApps/tryswift/scripts/p3.swift
   SwiftApps/tryswift/scripts/p4.swift
   SwiftApps/tryswift/scripts/p5.swift
   SwiftApps/tryswift/scripts/p6.swift
   SwiftApps/tryswift/tryswift.php
Log:
Various updates over the last few days, some new scripts, dropdown menu for selecting scripts, changes to editor, trunkification of scripts to remove warnings about @


Modified: SwiftApps/tryswift/config/sites.xml
===================================================================
--- SwiftApps/tryswift/config/sites.xml	2013-10-11 03:25:32 UTC (rev 7148)
+++ SwiftApps/tryswift/config/sites.xml	2013-10-11 16:16:10 UTC (rev 7149)
@@ -2,7 +2,7 @@
 <config xmlns="http://www.ci.uchicago.edu/swift/SwiftSites">
    <pool handle="local">
       <execution provider="local" url="none"/>
-      <profile namespace="karajan" key="jobThrottle">0</profile>
+      <profile namespace="karajan" key="jobThrottle">0.0199</profile>
       <profile namespace="karajan" key="initialScore">10000</profile>
       <filesystem provider="local"/>
       <workdirectory>/home/tryswift/swiftwork</workdirectory>

Modified: SwiftApps/tryswift/config/tc.data
===================================================================
--- SwiftApps/tryswift/config/tc.data	2013-10-11 03:25:32 UTC (rev 7148)
+++ SwiftApps/tryswift/config/tc.data	2013-10-11 16:16:10 UTC (rev 7149)
@@ -7,3 +7,5 @@
 local sleep /bin/sleep
 local simulate /home/tryswift/tryswift/bin/simulate.sh
 local stats /home/tryswift/tryswift/bin/stats.sh
+local genseed /home/tryswift/tryswift/bin/simulate.sh
+local genbias /home/tryswift/tryswift/bin/simulate.sh

Deleted: SwiftApps/tryswift/css/tryswift-php.css
===================================================================
--- SwiftApps/tryswift/css/tryswift-php.css	2013-10-11 03:25:32 UTC (rev 7148)
+++ SwiftApps/tryswift/css/tryswift-php.css	2013-10-11 16:16:10 UTC (rev 7149)
@@ -1,65 +0,0 @@
-html,body 
-{
-   margin:0;
-   padding:0;
-   width: 400px;
-   background: #fff;
-   margin-left: auto;
-   margin-right: auto;
-}
-
-a {
-text-decoration: none;
-}
-
-table { 
-border: 0; 
-border-bottom: 1px solid black;
-border-left: 1px solid black;
-border-right: 1px solid black;
-background-color:#f6f6f6
-font-family: monospace;
-width: 900px;
-}
-
-#style1 td {
-border-left: 1px solid black;
-border-right: 1px solid black;
-border-top: 0;
-border-bottom: 0;
-background-color:#f6f6f6
-padding-left: 0px;
-padding-right: 0px;
-padding-top: 2px;
-padding-bottom: 2px;
-}
-
-#style2 td {
-border-top: 0;
-border-bottom: 0;
-border-left: 1px solid black;
-background-color:#f6f6f6
-padding-left: 10px;
-padding-right: 0;
-padding-top: 0px;
-padding-bottom: 0px;
-}
-
-#header {
-font-family:courier-new,monospace;
-font-size:150%;
-color:#2c1f8e;
-vertical-align:sub;
-text-align: center;
-}
-
-caption {
-background:#e3e3e3;
-border-right: 1px solid black;
-border-left: 1px solid black;
-border-top: 1px solid black;
-border-bottom: 1px solid black;
-margin-top: 10px;
-padding: 2px;
-}
-

Modified: SwiftApps/tryswift/css/tryswift.css
===================================================================
--- SwiftApps/tryswift/css/tryswift.css	2013-10-11 03:25:32 UTC (rev 7148)
+++ SwiftApps/tryswift/css/tryswift.css	2013-10-11 16:16:10 UTC (rev 7149)
@@ -11,21 +11,6 @@
    background: white;
 }
 
-#next {
-   float: left;
-   width: 100px;
-}
-
-#scriptCount {
-   float: left;
-   width: 100px;
-}
-
-#back {
-   float: left;
-   width: 100px;
-}
-
 #editor {
    width: 100%;
    height: 50%;
@@ -33,6 +18,7 @@
 
 #scriptNav {
    position: relative;
+   top: 5px; 
    left: 25%;
    right: 25%;
    width: 100%;
@@ -63,7 +49,7 @@
 }
 
 #editorButtons {
-   background: #ebebeb;
+   background: #fbf1d3;
 }
 
 #pre {

Deleted: SwiftApps/tryswift/css/tryswift.old.css
===================================================================
--- SwiftApps/tryswift/css/tryswift.old.css	2013-10-11 03:25:32 UTC (rev 7148)
+++ SwiftApps/tryswift/css/tryswift.old.css	2013-10-11 16:16:10 UTC (rev 7149)
@@ -1,61 +0,0 @@
-html, body {
-   height: 100%;
-}
-
-#outputWrapper {
-   display: table;
-   height: 25%;
-   width: 100%;
-}
-
-#swiftOutput {
-   height: 100px;
-   width: 100%;
-   border: 1px solid black;
-   overflow-y: scroll;
-}
-
-#editorInfoWrapper {
-   display: table;
-   width: 100%;
-   height: 70%;
-}
-
-#info {
-   width: 100%;
-   height: 100%;
-   display: table;
-}
-
-#infoFrame {
-   width: 100%;
-   height: 95%;
-   display: table-cell;
-}
-
-#editor {
-   width: 50%;
-   height: 100%;
-   display: table-cell;
-}
-
-#scriptNav {
-   display: table;
-   text-align: center;
-   height: 5%;
-   width: 100%;
-   border: 1px solid red;
-   background: #B0B0B0;
-}
-
-#next {
-   display: table-cell;
-}
-
-#previous {
-   display: table-cell;
-}
-
-#scriptCount {
-   display: table-cell;
-}

Modified: SwiftApps/tryswift/getfiles.php
===================================================================
--- SwiftApps/tryswift/getfiles.php	2013-10-11 03:25:32 UTC (rev 7148)
+++ SwiftApps/tryswift/getfiles.php	2013-10-11 16:16:10 UTC (rev 7149)
@@ -29,7 +29,9 @@
            substr($file, -7) != ".swiftx" &&
            substr($file, -4) != ".log"
 	) {
-           print "<div class=\"span2\"><a href=\"$dir/$file\" target=\"_blank\">$file</a> [" . filesize($file) . " bytes]</div>\n";
+           $size = filesize($file);
+           #$type = shell_exec("file -b $file");
+           print "<div class=\"span2\"><a href=\"$dir/$file\" target=\"_blank\">$file</a> [$size bytes]</div>\n";
          }
 }
 ?>

Modified: SwiftApps/tryswift/index.php
===================================================================
--- SwiftApps/tryswift/index.php	2013-10-11 03:25:32 UTC (rev 7148)
+++ SwiftApps/tryswift/index.php	2013-10-11 16:16:10 UTC (rev 7149)
@@ -13,117 +13,107 @@
          <div class="row-fluid">
             <div id="infoContainer" class="span4 b0b0">
                <div id="scriptNav">
-                  <button id="back">Back</button>
-                  <div id="scriptCount"></div>
-                  <button id="next">Next</button>
+                  <select id="scriptDropdown">
+                  </select>
                </div> <!-- scriptNav -->
                <iframe id="infoFrame"></iframe>
             </div> <!-- infoContainer -->
+         
+            <!-- Code editor -->
+            <div id="editorContainer" class="span8">
+               <div id="editor">
+                  <script src="js/ace/ace.js" type="text/javascript" charset="utf-8"></script>
+                  <script>
+                     var editor = ace.edit("editor");
+                     editor.setFontSize('13px');
+                     editor.setTheme("ace/theme/solarized_light");
+                     editor.getSession().setMode("ace/mode/text");
+                     editor.setShowPrintMargin(false);
+                     editor.setHighlightActiveLine(false);
+                     editor.setDisplayIndentGuides(false);
+                  </script>
+               </div> <!-- editor -->
 
-      <!-- Code editor -->
-      <div id="editorContainer" class="span8">
-         <div id="editor">
-         <script src="js/ace/ace.js" type="text/javascript" charset="utf-8"></script>
-         <script>
-            var editor = ace.edit("editor");
-            editor.setTheme("ace/theme/eclipse");
-            editor.getSession().setMode("ace/mode/text");
-            editor.setShowPrintMargin(false);
-            editor.setHighlightActiveLine(false);
-            editor.setDisplayIndentGuides(false);
-            var emacs = require("ace/keyboard/emacs").handler;
-            ace.setKeyboardHandler(emacs);
-            editor.setFontSize('2em');
-         </script>
-         </div> <!-- editor -->
-
-         <div id="editorButtons">
-            <button id="executeButton">Execute</button>
-            <button id="resetButton">Reset</button>
-         </div> <!-- editorButtons -->
-      </div> <!-- editorContainer -->
-      </div> <!-- row -->
+               <div id="editorButtons">
+                  <button id="executeButton">Execute</button>
+                  <button id="resetButton">Reset</button>
+               </div> <!-- editorButtons -->
+            </div> <!-- editorContainer -->
+         </div> <!-- row -->
             
-            <div class="row-fluid"> 
-               <div class="span12">
-                  <pre id="swiftOutput">Swift output</pre> 
-               </div>
-            </div>
+         <div class="row-fluid"> 
+            <div class="span12">
+               <pre id="swiftOutput">Swift output</pre> 
+            </div> <!-- span12 -->
+         </div> <!-- row -->
             
-            <div class="row-fluid">
-               <div class="span12">
-                  <div id="fileOutput">Output files</div>
-               </div>
-            </div>  
-</div>
+         <div class="row-fluid">
+            <div class="span12">
+               <div id="fileOutput"> Output files</div>
+            </div> <!-- span12 -->
+         </div> <!-- row-fluid -->
+      </div> <!-- container -->
 
-            <script>
-               var scriptCounter=0;
-               var scripts=[
-               <?php
-                  $scriptFiles = array();
-                  $directory = opendir("scripts");
-                  while($script = readdir($directory)) {
-                     if(substr($script, -6) == ".swift") {
-                        $scriptFiles[] = $script;
-                     }   
-                  }   
-                  closedir($directory);
-                  sort($scriptFiles);
-                  foreach($scriptFiles as $script) {
-                     echo "\"scripts/$script\", ";
-                  }   
-               ?>  
-               ];
-            </script>
-
+      <script>
+         var scriptCounter=0;
+         var scripts=[
+         <?php
+            $scriptFiles = array();
+            $directory = opendir("scripts");
+            while($script = readdir($directory)) {
+               if(substr($script, -6) == ".swift") {
+                  $scriptFiles[] = $script;
+               }   
+            }   
+            closedir($directory);
+            sort($scriptFiles);
+            foreach($scriptFiles as $script) {
+               $description = file_get_contents(str_replace(".swift", ".txt", "scripts/$script"));
+               $description = preg_replace('~[\r\n]+~', '', $description);
+               $info = str_replace(".swift", ".html", $script);
+               echo "[ \"scripts/$script\", \"$description\", \"scripts/$info\" ],";
+            }
+         ?> ];
+      </script>
       <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
       <script src="js/logtail.js"></script>
       <script type="text/javascript">
       
-      function updateScript() {
-         $.get(scripts[scriptCounter], null, function (data) {
+      function updateScript(index) {
+         $.get(scripts[index][0], null, function (data) {
             editor.setValue(data);
             editor.gotoLine(1);
          }, "text");
-         $('#scriptCount').html( (scriptCounter+1) + " of " + scripts.length );
-         $('#infoFrame').attr('src', scripts[scriptCounter].replace(/\.swift$/g, ".html"));
+         $('#infoFrame').attr('src', scripts[index][2]);
       }         
     
-      function refreshIframe() {
-         $("#fileOutput").src = $("#fileOutput").src;
-      }
-
-      $(document).ready(function() {
-
+      function resize() {
          $('#editor').height( $(document).height() / 2 );
          $('#infoContainer').height( $('#editorContainer').height() );
          $('#infoFrame').height( $('#infoContainer').height() - $('#back').height()-5 );
          $('#swiftOutput').height( $(document).height() * .20 );
          $('#fileOutput').height( $(document).height() * .19 );
          $('#fileOutput').width( $(document).width() );
-         // $('#header').height( $(document).height() * .06 );
-         updateScript();
-         
-         $('#next').click(function() {
-            if((scriptCounter + 1) <= (scripts.length - 1)) {
-               scriptCounter++;
-               updateScript();
-            }
-         })
+      }
 
-        $('#back').click(function() {
-           if ((scriptCounter - 1) >= 0) {
-              scriptCounter=scriptCounter-1;
-              updateScript();
-           }
-        })
-  
-        $('#resetButton').click(function() {
-           updateScript();
-        })
-              
-        $('#executeButton').click(function() {
+      $(document).ready(function() {
+         resize();
+         updateScript(0);
+         $(window).resize(function() { resize(); });
+         $('#resetButton').click(function() { updateScript(); })
+
+         $.each(scripts, function(key, value) {   
+            $('#scriptDropdown')
+               .append($("<option></option>")
+               .attr("value",key[0])
+               .text(value[1])); 
+         });
+
+         $('#scriptDropdown').change(function() {
+            updateScript($(this).find('option:selected').index());
+         });
+ 
+         $('#executeButton').click(function() {
            sourceCode=editor.getSession().getValue();
            if(!sourceCode) {
               alert("Source text is empty!");
@@ -138,7 +128,6 @@
                  $('#fileOutput').html(filedata);
               });
            });
-
         })
      })
      </script>

Modified: SwiftApps/tryswift/js/ace/theme-solarized_light.js
===================================================================
--- SwiftApps/tryswift/js/ace/theme-solarized_light.js	2013-10-11 03:25:32 UTC (rev 7148)
+++ SwiftApps/tryswift/js/ace/theme-solarized_light.js	2013-10-11 16:16:10 UTC (rev 7149)
@@ -42,7 +42,7 @@
 }\
 .ace-solarized-light {\
 background-color: #FDF6E3;\
-color: #586E75\
+color: #000;\
 }\
 .ace-solarized-light .ace_cursor {\
 border-left: 2px solid #000000\

Added: SwiftApps/tryswift/scripts/001-introduction.html
===================================================================
--- SwiftApps/tryswift/scripts/001-introduction.html	                        (rev 0)
+++ SwiftApps/tryswift/scripts/001-introduction.html	2013-10-11 16:16:10 UTC (rev 7149)
@@ -0,0 +1,19 @@
+<html>
+   <head>
+      <link href="formatting.css" rel="stylesheet" media="screen">
+   </head>
+
+   <body>
+      <h2>Welcome to Try Swift!</h2>
+      <p>
+         If you are an existing Swift user, and would like to try testing your code, 
+         please enter your code in the editor on the right and click "execute".
+      </p>
+
+      <p>
+         If you would like to learn Swift, select an example script above to learn more.
+      <p>
+
+   </body>
+
+</html>

Added: SwiftApps/tryswift/scripts/001-introduction.swift
===================================================================
--- SwiftApps/tryswift/scripts/001-introduction.swift	                        (rev 0)
+++ SwiftApps/tryswift/scripts/001-introduction.swift	2013-10-11 16:16:10 UTC (rev 7149)
@@ -0,0 +1,3 @@
+// Welcome to tryswift!
+// Feel free to enter your code below, or select an existing script from the menu on the left
+

Added: SwiftApps/tryswift/scripts/001-introduction.txt
===================================================================
--- SwiftApps/tryswift/scripts/001-introduction.txt	                        (rev 0)
+++ SwiftApps/tryswift/scripts/001-introduction.txt	2013-10-11 16:16:10 UTC (rev 7149)
@@ -0,0 +1 @@
+Introduction

Added: SwiftApps/tryswift/scripts/002-helloworld.html
===================================================================
--- SwiftApps/tryswift/scripts/002-helloworld.html	                        (rev 0)
+++ SwiftApps/tryswift/scripts/002-helloworld.html	2013-10-11 16:16:10 UTC (rev 7149)
@@ -0,0 +1,55 @@
+<html>
+
+<head>
+<link href="formatting.css" rel="stylesheet" media="screen">
+</head>
+
+<body>
+<h2>Hello world!</h2>
+<p>Let's take a closer look at this script and go through it line by line.</p>
+
+<pre>
+type file;
+</pre>
+
+<p>Most Swift scripts will make extensive use of files. This line
+   allows us to use the file datatype and will be the first line of
+   most scripts.</p>
+
+<pre>
+app (file o) echo (string s)
+{
+   echo s stdout=filename(o);
+}
+</pre>
+
+<p>The code above defines an application. In this case, the app is the 
+unix utility echo. Every app function can define an input and an output. 
+Outputs are defined to the left of the app name (file o). Inputs are defined
+to the right of the app name (string s).</p>
+
+<pre>
+echo s stdout=filename(o);
+</pre>
+The echo command by itself does not create any files. Instead, what we do
+in this example is redirect the output of the command to a file by using
+stdout=filename(o).
+
+<p>Now that our app function is defined, let's create a file and call echo.<p>
+
+<pre>
+file out <"out.txt">;
+out = echo("Hello world!");
+</pre>
+
+<p>Try running the program. When it is finished, you should see a file called out.txt get created that contains the text "Hello world!"</p>
+
+<h3>Exercises</h3>
+<ul>
+<li>Change the text from "Hello world!" to "Hello Swift!"</li>
+<li>Pass an int to echo instead of a string</li>
+<li>Change the name of the output file</li>
+</ul>
+
+</body>
+</html>

Added: SwiftApps/tryswift/scripts/002-helloworld.swift
===================================================================
--- SwiftApps/tryswift/scripts/002-helloworld.swift	                        (rev 0)
+++ SwiftApps/tryswift/scripts/002-helloworld.swift	2013-10-11 16:16:10 UTC (rev 7149)
@@ -0,0 +1,9 @@
+type file;
+
+app (file out) echo (string s)
+{
+   echo s stdout=filename(out);
+}
+
+file out <"out.txt">;
+out = echo("Testing");

Added: SwiftApps/tryswift/scripts/002-helloworld.txt
===================================================================
--- SwiftApps/tryswift/scripts/002-helloworld.txt	                        (rev 0)
+++ SwiftApps/tryswift/scripts/002-helloworld.txt	2013-10-11 16:16:10 UTC (rev 7149)
@@ -0,0 +1 @@
+Hello world!

Added: SwiftApps/tryswift/scripts/formatting.css
===================================================================
--- SwiftApps/tryswift/scripts/formatting.css	                        (rev 0)
+++ SwiftApps/tryswift/scripts/formatting.css	2013-10-11 16:16:10 UTC (rev 7149)
@@ -0,0 +1,3 @@
+pre {
+   background: #D9D9F3;
+}

Modified: SwiftApps/tryswift/scripts/p1.swift
===================================================================
--- SwiftApps/tryswift/scripts/p1.swift	2013-10-11 03:25:32 UTC (rev 7148)
+++ SwiftApps/tryswift/scripts/p1.swift	2013-10-11 16:16:10 UTC (rev 7149)
@@ -2,7 +2,7 @@
 
 app (file o) simulation ()
 {
-  simulate stdout=@filename(o);
+  simulate stdout=filename(o);
 }
 
 file f <"sim.out">;

Added: SwiftApps/tryswift/scripts/p1.txt
===================================================================
--- SwiftApps/tryswift/scripts/p1.txt	                        (rev 0)
+++ SwiftApps/tryswift/scripts/p1.txt	2013-10-11 16:16:10 UTC (rev 7149)
@@ -0,0 +1 @@
+p1

Modified: SwiftApps/tryswift/scripts/p2.swift
===================================================================
--- SwiftApps/tryswift/scripts/p2.swift	2013-10-11 03:25:32 UTC (rev 7148)
+++ SwiftApps/tryswift/scripts/p2.swift	2013-10-11 16:16:10 UTC (rev 7149)
@@ -2,10 +2,10 @@
 
 app (file o) simulation ()
 {
-  simulate stdout=@filename(o);
+  simulate stdout=filename(o);
 }
 
 foreach i in [0:9] {
-  file f <single_file_mapper; file=@strcat("output/sim_",i,".out")>;
+  file f <single_file_mapper; file=strcat("output/sim_",i,".out")>;
   f = simulation();
 }

Added: SwiftApps/tryswift/scripts/p2.txt
===================================================================
--- SwiftApps/tryswift/scripts/p2.txt	                        (rev 0)
+++ SwiftApps/tryswift/scripts/p2.txt	2013-10-11 16:16:10 UTC (rev 7149)
@@ -0,0 +1 @@
+p2

Modified: SwiftApps/tryswift/scripts/p3.swift
===================================================================
--- SwiftApps/tryswift/scripts/p3.swift	2013-10-11 03:25:32 UTC (rev 7148)
+++ SwiftApps/tryswift/scripts/p3.swift	2013-10-11 16:16:10 UTC (rev 7149)
@@ -2,23 +2,23 @@
 
 app (file o) simulation (int sim_steps, int sim_range, int sim_values)
 {
-  simulate "--timesteps" sim_steps "--range" sim_range "--nvalues" sim_values stdout=@filename(o);
+  simulate "--timesteps" sim_steps "--range" sim_range "--nvalues" sim_values stdout=filename(o);
 }
 
 app (file o) analyze (file s[])
 {
-  stats @filenames(s) stdout=@filename(o);
+  stats filenames(s) stdout=filename(o);
 }
 
-int nsim   = @toInt(@arg("nsim","10"));
-int steps  = @toInt(@arg("steps","1"));
-int range  = @toInt(@arg("range","100"));
-int values = @toInt(@arg("values","5"));
+int nsim   = toInt(arg("nsim","10"));
+int steps  = toInt(arg("steps","1"));
+int range  = toInt(arg("range","100"));
+int values = toInt(arg("values","5"));
 
 file sims[];
 
 foreach i in [0:nsim-1] {
-  file simout <single_file_mapper; file=@strcat("output/sim_",i,".out")>;
+  file simout <single_file_mapper; file=strcat("output/sim_",i,".out")>;
   simout = simulation(steps,range,values);
   sims[i] = simout;
 }

Added: SwiftApps/tryswift/scripts/p3.txt
===================================================================
--- SwiftApps/tryswift/scripts/p3.txt	                        (rev 0)
+++ SwiftApps/tryswift/scripts/p3.txt	2013-10-11 16:16:10 UTC (rev 7149)
@@ -0,0 +1 @@
+p3

Modified: SwiftApps/tryswift/scripts/p4.swift
===================================================================
--- SwiftApps/tryswift/scripts/p4.swift	2013-10-11 03:25:32 UTC (rev 7148)
+++ SwiftApps/tryswift/scripts/p4.swift	2013-10-11 16:16:10 UTC (rev 7149)
@@ -7,19 +7,19 @@
 
 app (file out, file log) analyze (file s[])
 {
-  stats @filenames(s) stdout=@out stderr=@log;
+  stats filenames(s) stdout=@out stderr=@log;
 }
 
-int nsim   = @toInt(@arg("nsim",   "10"));
-int steps  = @toInt(@arg("steps",  "1"));
-int range  = @toInt(@arg("range",  "100"));
-int values = @toInt(@arg("values", "5"));
+int nsim   = toInt(arg("nsim",   "10"));
+int steps  = toInt(arg("steps",  "1"));
+int range  = toInt(arg("range",  "100"));
+int values = toInt(arg("values", "5"));
 
 file sims[];
 
 foreach i in [0:nsim-1] {
-  file simout <single_file_mapper; file=@strcat("output/sim_",i,".out")>;
-  file simlog <single_file_mapper; file=@strcat("output/sim_",i,".log")>;
+  file simout <single_file_mapper; file=strcat("output/sim_",i,".out")>;
+  file simlog <single_file_mapper; file=strcat("output/sim_",i,".log")>;
   (simout,simlog) = simulation(steps,range,values);
   sims[i] = simout;
 }

Added: SwiftApps/tryswift/scripts/p4.txt
===================================================================
--- SwiftApps/tryswift/scripts/p4.txt	                        (rev 0)
+++ SwiftApps/tryswift/scripts/p4.txt	2013-10-11 16:16:10 UTC (rev 7149)
@@ -0,0 +1 @@
+p4

Modified: SwiftApps/tryswift/scripts/p5.swift
===================================================================
--- SwiftApps/tryswift/scripts/p5.swift	2013-10-11 03:25:32 UTC (rev 7148)
+++ SwiftApps/tryswift/scripts/p5.swift	2013-10-11 16:16:10 UTC (rev 7149)
@@ -7,19 +7,19 @@
 
 app (file out, file log) analyze (file s[])
 {
-  stats @filenames(s) stdout=@out stderr=@log;
+  stats filenames(s) stdout=@out stderr=@log;
 }
 
-int nsim   = @toInt(@arg("nsim",   "10"));
-int steps  = @toInt(@arg("steps",  "1"));
-int range  = @toInt(@arg("range",  "100"));
-int values = @toInt(@arg("values", "5"));
+int nsim   = toInt(arg("nsim",   "10"));
+int steps  = toInt(arg("steps",  "1"));
+int range  = toInt(arg("range",  "100"));
+int values = toInt(arg("values", "5"));
 
 file sims[];
 
 foreach i in [0:nsim-1] {
-  file simout <single_file_mapper; file=@strcat("output/sim_",i,".out")>;
-  file simlog <single_file_mapper; file=@strcat("output/sim_",i,".log")>;
+  file simout <single_file_mapper; file=strcat("output/sim_",i,".out")>;
+  file simlog <single_file_mapper; file=strcat("output/sim_",i,".log")>;
   (simout,simlog) = simulation(steps,range,values);
   sims[i] = simout;
 }

Added: SwiftApps/tryswift/scripts/p5.txt
===================================================================
--- SwiftApps/tryswift/scripts/p5.txt	                        (rev 0)
+++ SwiftApps/tryswift/scripts/p5.txt	2013-10-11 16:16:10 UTC (rev 7149)
@@ -0,0 +1 @@
+p5

Modified: SwiftApps/tryswift/scripts/p6.swift
===================================================================
--- SwiftApps/tryswift/scripts/p6.swift	2013-10-11 03:25:32 UTC (rev 7148)
+++ SwiftApps/tryswift/scripts/p6.swift	2013-10-11 16:16:10 UTC (rev 7149)
@@ -21,15 +21,15 @@
 
 app (file out, file log) analyze (file s[])
 {
-  stats @filenames(s) stdout=@out stderr=@log;
+  stats filenames(s) stdout=@out stderr=@log;
 }
 
 # Command line arguments
 
-int  nsim  = @toInt(@arg("nsim",   "10"));  # number of simulation programs to run
-int  steps = @toInt(@arg("steps",  "1"));   # number of timesteps (seconds) per simulation
-int  range = @toInt(@arg("range",  "100")); # range of the generated random numbers
-int  values = @toInt(@arg("values", "10"));  # number of values generated per simulation
+int  nsim  = toInt(arg("nsim",   "10"));  # number of simulation programs to run
+int  steps = toInt(arg("steps",  "1"));   # number of timesteps (seconds) per simulation
+int  range = toInt(arg("range",  "100")); # range of the generated random numbers
+int  values = toInt(arg("values", "10"));  # number of values generated per simulation
 
 # Main script and data
 
@@ -44,9 +44,9 @@
 file sims[];                      # Array of files to hold each simulation output
 
 foreach i in [0:nsim-1] {
-  file biasfile <single_file_mapper; file=@strcat("output/bias_",i,".dat")>;
-  file simout   <single_file_mapper; file=@strcat("output/sim_",i,".out")>;
-  file simlog   <single_file_mapper; file=@strcat("output/sim_",i,".log")>;
+  file biasfile <single_file_mapper; file=strcat("output/bias_",i,".dat")>;
+  file simout   <single_file_mapper; file=strcat("output/sim_",i,".out")>;
+  file simlog   <single_file_mapper; file=strcat("output/sim_",i,".log")>;
   biasfile = genbias(1000, 20);
   (simout,simlog) = simulation(steps, range, biasfile, 1000000, values);
   sims[i] = simout;

Added: SwiftApps/tryswift/scripts/p6.txt
===================================================================
--- SwiftApps/tryswift/scripts/p6.txt	                        (rev 0)
+++ SwiftApps/tryswift/scripts/p6.txt	2013-10-11 16:16:10 UTC (rev 7149)
@@ -0,0 +1 @@
+p6


Property changes on: SwiftApps/tryswift/tryswift.php
___________________________________________________________________
Deleted: svn:executable
   - *




More information about the Swift-commit mailing list