[Swift-commit] r7150 - in SwiftApps/tryswift: . css scripts

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Fri Oct 11 12:30:57 CDT 2013


Author: davidk
Date: 2013-10-11 12:30:56 -0500 (Fri, 11 Oct 2013)
New Revision: 7150

Added:
   SwiftApps/tryswift/scripts/003-foreach.html
   SwiftApps/tryswift/scripts/003-foreach.swift
   SwiftApps/tryswift/scripts/003-foreach.txt
Removed:
   SwiftApps/tryswift/scripts/build_docs.sh
   SwiftApps/tryswift/scripts/p1.html
   SwiftApps/tryswift/scripts/p1.swift
   SwiftApps/tryswift/scripts/p1.txt
   SwiftApps/tryswift/scripts/p2.html
   SwiftApps/tryswift/scripts/p2.swift
   SwiftApps/tryswift/scripts/p2.txt
   SwiftApps/tryswift/scripts/part01.png
   SwiftApps/tryswift/scripts/part02.png
   SwiftApps/tryswift/scripts/part1.txt
   SwiftApps/tryswift/scripts/part2.txt
Modified:
   SwiftApps/tryswift/css/tryswift.css
   SwiftApps/tryswift/index.php
Log:
Some css fixes, new foreach example, some cleanup


Modified: SwiftApps/tryswift/css/tryswift.css
===================================================================
--- SwiftApps/tryswift/css/tryswift.css	2013-10-11 16:16:10 UTC (rev 7149)
+++ SwiftApps/tryswift/css/tryswift.css	2013-10-11 17:30:56 UTC (rev 7150)
@@ -2,13 +2,10 @@
    text-align: center;
 }
 
-#scriptCount {
-   text-align: center;
-}
-
 #infoFrame {
    width: 100%;
    background: white;
+   overflow-y: scroll;
 }
 
 #editor {
@@ -18,12 +15,16 @@
 
 #scriptNav {
    position: relative;
-   top: 5px; 
    left: 25%;
    right: 25%;
    width: 100%;
 }
 
+#scriptDropdown {
+   position: relative;
+   top: 5px;
+}
+
 .b0b0 {
    background: #b0b0b0;
    border: 1px solid black;

Modified: SwiftApps/tryswift/index.php
===================================================================
--- SwiftApps/tryswift/index.php	2013-10-11 16:16:10 UTC (rev 7149)
+++ SwiftApps/tryswift/index.php	2013-10-11 17:30:56 UTC (rev 7150)
@@ -90,7 +90,7 @@
       function resize() {
          $('#editor').height( $(document).height() / 2 );
          $('#infoContainer').height( $('#editorContainer').height() );
-         $('#infoFrame').height( $('#infoContainer').height() - $('#back').height()-5 );
+         $('#infoFrame').height( $('#infoContainer').height() - $('#scriptDropdown').height()-5 );
          $('#swiftOutput').height( $(document).height() * .20 );
          $('#fileOutput').height( $(document).height() * .19 );
          $('#fileOutput').width( $(document).width() );

Added: SwiftApps/tryswift/scripts/003-foreach.html
===================================================================
--- SwiftApps/tryswift/scripts/003-foreach.html	                        (rev 0)
+++ SwiftApps/tryswift/scripts/003-foreach.html	2013-10-11 17:30:56 UTC (rev 7150)
@@ -0,0 +1,72 @@
+<html>
+
+<head>
+<link href="formatting.css" rel="stylesheet" media="screen">
+</head>
+
+<body>
+<h2>Foreach</h2>
+
+In this example, we first change our application. Instead of using "echo",
+we use an app called simulate. The simulate application serves as a trivial 
+proxy for any more complex scientific simulation application. It generates 
+and prints a set of one or more random integers
+
+<pre>
+app (file o) simulate ()
+{
+  simulate stdout=filename(o);
+}
+</pre>
+
+Swift is a simple scripting language for executing many instances of
+ordinary application programs on distributed parallel resources.
+Swift scripts run many copies of ordinary programs concurrently, using
+statements like this:
+
+<pre>
+foreach i in [1:10] {
+  string fname=strcat("output/sim_", i, ".out");
+  file f &ltsingle_file_mapper; file=fname>;
+  f = simulate();
+}
+</pre>
+
+<p>
+In this example the foreach loop will iterate over a range of numbers from 0 to 9. 
+It will then map an output file and run the simulate app. The important thing to realize
+about this example is that every iteration will run in parallel (up to a user defined
+throttle).
+</p>
+
+<p>
+Another new feature in this example is the file mapper. In the first hello world example, 
+we saw a simplified version of a file mapper with the line:
+</p>
+
+<pre>
+file out &lt"out.txt">;
+</pre>
+
+This is the same as saying
+<pre>
+file out &ltsingle_file_mapper; file="output.txt">;
+</pre>
+
+<p>
+Defining a file mapper in this way allows a file name to be the content of a string 
+or the output of another function. The strcat function combines multiple strings into a single 
+string.
+</p>
+
+Execute the script and examine the results. You should see 10 files creates with random numbers.
+
+<h3>Exercises</h3>
+<ul>
+<li>Create 20 files instead of 10</li>
+<li>Set the output files to be created in a directory called results</li>
+</ul>
+
+
+</body>
+</html>

Added: SwiftApps/tryswift/scripts/003-foreach.swift
===================================================================
--- SwiftApps/tryswift/scripts/003-foreach.swift	                        (rev 0)
+++ SwiftApps/tryswift/scripts/003-foreach.swift	2013-10-11 17:30:56 UTC (rev 7150)
@@ -0,0 +1,12 @@
+type file;
+
+app (file o) simulate ()
+{
+  simulate stdout=filename(o);
+}
+
+foreach i in [1:10] {
+  string fname=strcat("output/sim_", i, ".out");
+  file f <single_file_mapper; file=fname>;
+  f = simulate();
+}

Added: SwiftApps/tryswift/scripts/003-foreach.txt
===================================================================
--- SwiftApps/tryswift/scripts/003-foreach.txt	                        (rev 0)
+++ SwiftApps/tryswift/scripts/003-foreach.txt	2013-10-11 17:30:56 UTC (rev 7150)
@@ -0,0 +1 @@
+Foreach

Deleted: SwiftApps/tryswift/scripts/build_docs.sh
===================================================================
--- SwiftApps/tryswift/scripts/build_docs.sh	2013-10-11 16:16:10 UTC (rev 7149)
+++ SwiftApps/tryswift/scripts/build_docs.sh	2013-10-11 17:30:56 UTC (rev 7150)
@@ -1,8 +0,0 @@
-#!/bin/bash
-
-asciidoc -a icons -a stylesheet=$PWD/asciidoc.css -a max-width=800px -o p1.html part1.txt
-asciidoc -a icons -a stylesheet=$PWD/asciidoc.css -a max-width=800px -o p2.html part2.txt
-asciidoc -a icons -a stylesheet=$PWD/asciidoc.css -a max-width=800px -o p3.html part3.txt
-asciidoc -a icons -a stylesheet=$PWD/asciidoc.css -a max-width=800px -o p4.html part4.txt 
-asciidoc -a icons -a stylesheet=$PWD/asciidoc.css -a max-width=800px -o p5.html part5.txt 
-asciidoc -a icons -a stylesheet=$PWD/asciidoc.css -a max-width=800px -o p6.html part6.txt 

Deleted: SwiftApps/tryswift/scripts/p1.html
===================================================================
--- SwiftApps/tryswift/scripts/p1.html	2013-10-11 16:16:10 UTC (rev 7149)
+++ SwiftApps/tryswift/scripts/p1.html	2013-10-11 17:30:56 UTC (rev 7150)
@@ -1,631 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
-    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
-<head>
-<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
-<meta name="generator" content="AsciiDoc 8.6.4" />
-<title>Part 1: Run a single application under Swift</title>
-<style type="text/css">
-/* Sans-serif font. */
-h1, h2, h3, h4, h5, h6,
-div.title, caption.title,
-thead, p.table.header,
-div#toctitle,
-span#author, span#revnumber, span#revdate, span#revremark,
-div#footer {
-  font-family: Arial,Helvetica,sans-serif;
-}
-
-/* Serif font. */
-div.sectionbody {
-  font-family: Georgia,"Times New Roman",Times,serif;
-}
-
-/* Monospace font. */
-tt {
-  font-size: inherit;
-}
-
-body {
-  margin: 1em 5% 1em 5%;
-}
-
-a {
-  color: blue;
-  text-decoration: underline;
-}
-a:visited {
-  color: fuchsia;
-}
-
-em {
-  font-style: italic;
-  color: navy;
-}
-
-strong {
-  font-weight: bold;
-  color: #083194;
-}
-
-tt {
-  font-size: inherit;
-  color: navy;
-}
-
-h1, h2, h3, h4, h5, h6 {
-  color: #527bbd;
-  margin-top: 1.2em;
-  margin-bottom: 0.5em;
-  line-height: 1.3;
-}
-
-h1, h2, h3 {
-  border-bottom: 2px solid silver;
-}
-h2 {
-  padding-top: 0.5em;
-}
-h3 {
-  float: left;
-}
-h3 + * {
-  clear: left;
-}
-
-div.sectionbody {
-  margin-left: 0;
-}
-
-hr {
-  border: 1px solid silver;
-}
-
-p {
-  margin-top: 0.5em;
-  margin-bottom: 0.5em;
-}
-
-ul, ol, li > p {
-  margin-top: 0;
-}
-ul > li     { color: #aaa; }
-ul > li > * { color: black; }
-
-pre {
-  padding: 0;
-  margin: 0;
-}
-
-span#author {
-  color: #527bbd;
-  font-weight: bold;
-  font-size: 1.1em;
-}
-span#email {
-}
-span#revnumber, span#revdate, span#revremark {
-}
-
-div#footer {
-  font-size: small;
-  border-top: 2px solid silver;
-  padding-top: 0.5em;
-  margin-top: 4.0em;
-}
-div#footer-text {
-  float: left;
-  padding-bottom: 0.5em;
-}
-div#footer-badges {
-  float: right;
-  padding-bottom: 0.5em;
-}
-
-div#preamble {
-  margin-top: 1.5em;
-  margin-bottom: 1.5em;
-}
-div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
-div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
-div.admonitionblock {
-  margin-top: 1.0em;
-  margin-bottom: 1.5em;
-}
-div.admonitionblock {
-  margin-top: 2.0em;
-  margin-bottom: 2.0em;
-  margin-right: 10%;
-  color: #606060;
-}
-
-div.content { /* Block element content. */
-  padding: 0;
-}
-
-/* Block element titles. */
-div.title, caption.title {
-  color: #527bbd;
-  font-weight: bold;
-  text-align: left;
-  margin-top: 1.0em;
-  margin-bottom: 0.5em;
-}
-div.title + * {
-  margin-top: 0;
-}
-
-td div.title:first-child {
-  margin-top: 0.0em;
-}
-div.content div.title:first-child {
-  margin-top: 0.0em;
-}
-div.content + div.title {
-  margin-top: 0.0em;
-}
-
-div.sidebarblock > div.content {
-  background: #ffffee;
-  border: 1px solid #dddddd;
-  border-left: 4px solid #f0f0f0;
-  padding: 0.5em;
-}
-
-div.listingblock > div.content {
-  border: 1px solid #dddddd;
-  border-left: 5px solid #f0f0f0;
-  background: #f8f8f8;
-  padding: 0.5em;
-}
-
-div.quoteblock, div.verseblock {
-  padding-left: 1.0em;
-  margin-left: 1.0em;
-  margin-right: 10%;
-  border-left: 5px solid #f0f0f0;
-  color: #777777;
-}
-
-div.quoteblock > div.attribution {
-  padding-top: 0.5em;
-  text-align: right;
-}
-
-div.verseblock > pre.content {
-  font-family: inherit;
-  font-size: inherit;
-}
-div.verseblock > div.attribution {
-  padding-top: 0.75em;
-  text-align: left;
-}
-/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
-div.verseblock + div.attribution {
-  text-align: left;
-}
-
-div.admonitionblock .icon {
-  vertical-align: top;
-  font-size: 1.1em;
-  font-weight: bold;
-  text-decoration: underline;
-  color: #527bbd;
-  padding-right: 0.5em;
-}
-div.admonitionblock td.content {
-  padding-left: 0.5em;
-  border-left: 3px solid #dddddd;
-}
-
-div.exampleblock > div.content {
-  border-left: 3px solid #dddddd;
-  padding-left: 0.5em;
-}
-
-div.imageblock div.content { padding-left: 0; }
-span.image img { border-style: none; }
-a.image:visited { color: white; }
-
-dl {
-  margin-top: 0.8em;
-  margin-bottom: 0.8em;
-}
-dt {
-  margin-top: 0.5em;
-  margin-bottom: 0;
-  font-style: normal;
-  color: navy;
-}
-dd > *:first-child {
-  margin-top: 0.1em;
-}
-
-ul, ol {
-    list-style-position: outside;
-}
-ol.arabic {
-  list-style-type: decimal;
-}
-ol.loweralpha {
-  list-style-type: lower-alpha;
-}
-ol.upperalpha {
-  list-style-type: upper-alpha;
-}
-ol.lowerroman {
-  list-style-type: lower-roman;
-}
-ol.upperroman {
-  list-style-type: upper-roman;
-}
-
-div.compact ul, div.compact ol,
-div.compact p, div.compact p,
-div.compact div, div.compact div {
-  margin-top: 0.1em;
-  margin-bottom: 0.1em;
-}
-
-div.tableblock > table {
-  border: 3px solid #527bbd;
-}
-thead, p.table.header {
-  font-weight: bold;
-  color: #527bbd;
-}
-tfoot {
-  font-weight: bold;
-}
-td > div.verse {
-  white-space: pre;
-}
-p.table {
-  margin-top: 0;
-}
-/* Because the table frame attribute is overriden by CSS in most browsers. */
-div.tableblock > table[frame="void"] {
-  border-style: none;
-}
-div.tableblock > table[frame="hsides"] {
-  border-left-style: none;
-  border-right-style: none;
-}
-div.tableblock > table[frame="vsides"] {
-  border-top-style: none;
-  border-bottom-style: none;
-}
-
-
-div.hdlist {
-  margin-top: 0.8em;
-  margin-bottom: 0.8em;
-}
-div.hdlist tr {
-  padding-bottom: 15px;
-}
-dt.hdlist1.strong, td.hdlist1.strong {
-  font-weight: bold;
-}
-td.hdlist1 {
-  vertical-align: top;
-  font-style: normal;
-  padding-right: 0.8em;
-  color: navy;
-}
-td.hdlist2 {
-  vertical-align: top;
-}
-div.hdlist.compact tr {
-  margin: 0;
-  padding-bottom: 0;
-}
-
-.comment {
-  background: yellow;
-}
-
-.footnote, .footnoteref {
-  font-size: 0.8em;
-}
-
-span.footnote, span.footnoteref {
-  vertical-align: super;
-}
-
-#footnotes {
-  margin: 20px 0 20px 0;
-  padding: 7px 0 0 0;
-}
-
-#footnotes div.footnote {
-  margin: 0 0 5px 0;
-}
-
-#footnotes hr {
-  border: none;
-  border-top: 1px solid silver;
-  height: 1px;
-  text-align: left;
-  margin-left: 0;
-  width: 20%;
-  min-width: 100px;
-}
-
-div.colist td {
-  padding-right: 0.5em;
-  padding-bottom: 0.3em;
-  vertical-align: top;
-}
-div.colist td img {
-  margin-top: 0.3em;
-}
-
- at media print {
-  div#footer-badges { display: none; }
-}
-
-div#toc {
-  margin-bottom: 2.5em;
-}
-
-div#toctitle {
-  color: #527bbd;
-  font-size: 1.1em;
-  font-weight: bold;
-  margin-top: 1.0em;
-  margin-bottom: 0.1em;
-}
-
-div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
-  margin-top: 0;
-  margin-bottom: 0;
-}
-div.toclevel2 {
-  margin-left: 2em;
-  font-size: 0.9em;
-}
-div.toclevel3 {
-  margin-left: 4em;
-  font-size: 0.9em;
-}
-div.toclevel4 {
-  margin-left: 6em;
-  font-size: 0.9em;
-}
-
-span.aqua { color: aqua; }
-span.black { color: black; }
-span.blue { color: blue; }
-span.fuchsia { color: fuchsia; }
-span.gray { color: gray; }
-span.green { color: green; }
-span.lime { color: lime; }
-span.maroon { color: maroon; }
-span.navy { color: navy; }
-span.olive { color: olive; }
-span.purple { color: purple; }
-span.red { color: red; }
-span.silver { color: silver; }
-span.teal { color: teal; }
-span.white { color: white; }
-span.yellow { color: yellow; }
-
-span.aqua-background { background: aqua; }
-span.black-background { background: black; }
-span.blue-background { background: blue; }
-span.fuchsia-background { background: fuchsia; }
-span.gray-background { background: gray; }
-span.green-background { background: green; }
-span.lime-background { background: lime; }
-span.maroon-background { background: maroon; }
-span.navy-background { background: navy; }
-span.olive-background { background: olive; }
-span.purple-background { background: purple; }
-span.red-background { background: red; }
-span.silver-background { background: silver; }
-span.teal-background { background: teal; }
-span.white-background { background: white; }
-span.yellow-background { background: yellow; }
-
-span.big { font-size: 2em; }
-span.small { font-size: 0.6em; }
-a:link { color:navy; }
-a:visited { color:navy; }
-
-.monospaced, code, pre {
-  font-family: "Courier New", Courier, monospace;
-  font-size: medium; /* inherit; */
-  color: black;
-  padding: 0;
-  margin: 0;
-}
-
-/*
-  background: #f8f8f8;
-  border: 1px solid #dddddd;
-  border-left: 5px solid #f0f0f0;
-  margin-right: 10%;
-*/
-
-div.listingblock > div.content {
-  padding: 0.5em;
-  background: none;
-  border: none;
-  border-left: none;
-  margin-right: none;
-}
-
-</style>
-<script type="text/javascript">
-/*<![CDATA[*/
-window.onload = function(){asciidoc.footnotes();}
-var asciidoc = {  // Namespace.
-
-/////////////////////////////////////////////////////////////////////
-// Table Of Contents generator
-/////////////////////////////////////////////////////////////////////
-
-/* Author: Mihai Bazon, September 2002
- * http://students.infoiasi.ro/~mishoo
- *
- * Table Of Content generator
- * Version: 0.4
- *
- * Feel free to use this script under the terms of the GNU General Public
- * License, as long as you do not remove or alter this notice.
- */
-
- /* modified by Troy D. Hanson, September 2006. License: GPL */
- /* modified by Stuart Rackham, 2006, 2009. License: GPL */
-
-// toclevels = 1..4.
-toc: function (toclevels) {
-
-  function getText(el) {
-    var text = "";
-    for (var i = el.firstChild; i != null; i = i.nextSibling) {
-      if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
-        text += i.data;
-      else if (i.firstChild != null)
-        text += getText(i);
-    }
-    return text;
-  }
-
-  function TocEntry(el, text, toclevel) {
-    this.element = el;
-    this.text = text;
-    this.toclevel = toclevel;
-  }
-
-  function tocEntries(el, toclevels) {
-    var result = new Array;
-    var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
-    // Function that scans the DOM tree for header elements (the DOM2
-    // nodeIterator API would be a better technique but not supported by all
-    // browsers).
-    var iterate = function (el) {
-      for (var i = el.firstChild; i != null; i = i.nextSibling) {
-        if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
-          var mo = re.exec(i.tagName);
-          if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
-            result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
-          }
-          iterate(i);
-        }
-      }
-    }
-    iterate(el);
-    return result;
-  }
-
-  var toc = document.getElementById("toc");
-  var entries = tocEntries(document.getElementById("content"), toclevels);
-  for (var i = 0; i < entries.length; ++i) {
-    var entry = entries[i];
-    if (entry.element.id == "")
-      entry.element.id = "_toc_" + i;
-    var a = document.createElement("a");
-    a.href = "#" + entry.element.id;
-    a.appendChild(document.createTextNode(entry.text));
-    var div = document.createElement("div");
-    div.appendChild(a);
-    div.className = "toclevel" + entry.toclevel;
-    toc.appendChild(div);
-  }
-  if (entries.length == 0)
-    toc.parentNode.removeChild(toc);
-},
-
-
-/////////////////////////////////////////////////////////////////////
-// Footnotes generator
-/////////////////////////////////////////////////////////////////////
-
-/* Based on footnote generation code from:
- * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
- */
-
-footnotes: function () {
-  var cont = document.getElementById("content");
-  var noteholder = document.getElementById("footnotes");
-  var spans = cont.getElementsByTagName("span");
-  var refs = {};
-  var n = 0;
-  for (i=0; i<spans.length; i++) {
-    if (spans[i].className == "footnote") {
-      n++;
-      // Use [\s\S] in place of . so multi-line matches work.
-      // Because JavaScript has no s (dotall) regex flag.
-      note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
-      noteholder.innerHTML +=
-        "<div class='footnote' id='_footnote_" + n + "'>" +
-        "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
-        n + "</a>. " + note + "</div>";
-      spans[i].innerHTML =
-        "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
-        "' title='View footnote' class='footnote'>" + n + "</a>]";
-      var id =spans[i].getAttribute("id");
-      if (id != null) refs["#"+id] = n;
-    }
-  }
-  if (n == 0)
-    noteholder.parentNode.removeChild(noteholder);
-  else {
-    // Process footnoterefs.
-    for (i=0; i<spans.length; i++) {
-      if (spans[i].className == "footnoteref") {
-        var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
-        href = href.match(/#.*/)[0];  // Because IE return full URL.
-        n = refs[href];
-        spans[i].innerHTML =
-          "[<a href='#_footnote_" + n +
-          "' title='View footnote' class='footnote'>" + n + "</a>]";
-      }
-    }
-  }
-}
-
-}
-/*]]>*/
-</script>
-</head>
-<body class="article" style="max-width:800px">
-<div id="header">
-<h1>Part 1: Run a single application under Swift</h1>
-</div>
-<div id="content">
-<div id="preamble">
-<div class="sectionbody">
-<div class="paragraph"><p>The first swift script, p1.swift, runs simulate.sh to generate a
-single random number. It writes the number to a file.</p></div>
-<div class="imageblock" style="text-align:center;">
-<div class="content">
-<img src="part01.png" alt="p1 workflow" />
-</div>
-</div>
-<div class="listingblock">
-<div class="title">p1.swift</div>
-<div class="content">
-<pre><tt>type file;
-
-app (file o) simulation ()
-{
-  simulate stdout=@filename(o);
-}
-
-file f <"sim.out">;
-f = simulation();</tt></pre>
-</div></div>
-</div>
-</div>
-</div>
-<div id="footnotes"><hr /></div>
-<div id="footer">
-<div id="footer-text">
-Last updated 2013-09-11 13:12:25 CDT
-</div>
-</div>
-</body>
-</html>

Deleted: SwiftApps/tryswift/scripts/p1.swift
===================================================================
--- SwiftApps/tryswift/scripts/p1.swift	2013-10-11 16:16:10 UTC (rev 7149)
+++ SwiftApps/tryswift/scripts/p1.swift	2013-10-11 17:30:56 UTC (rev 7150)
@@ -1,9 +0,0 @@
-type file;
-
-app (file o) simulation ()
-{
-  simulate stdout=filename(o);
-}
-
-file f <"sim.out">;
-f = simulation();

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

Deleted: SwiftApps/tryswift/scripts/p2.html
===================================================================
--- SwiftApps/tryswift/scripts/p2.html	2013-10-11 16:16:10 UTC (rev 7149)
+++ SwiftApps/tryswift/scripts/p2.html	2013-10-11 17:30:56 UTC (rev 7150)
@@ -1,656 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
-    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
-<head>
-<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
-<meta name="generator" content="AsciiDoc 8.6.4" />
-<title></title>
-<style type="text/css">
-/* Sans-serif font. */
-h1, h2, h3, h4, h5, h6,
-div.title, caption.title,
-thead, p.table.header,
-div#toctitle,
-span#author, span#revnumber, span#revdate, span#revremark,
-div#footer {
-  font-family: Arial,Helvetica,sans-serif;
-}
-
-/* Serif font. */
-div.sectionbody {
-  font-family: Georgia,"Times New Roman",Times,serif;
-}
-
-/* Monospace font. */
-tt {
-  font-size: inherit;
-}
-
-body {
-  margin: 1em 5% 1em 5%;
-}
-
-a {
-  color: blue;
-  text-decoration: underline;
-}
-a:visited {
-  color: fuchsia;
-}
-
-em {
-  font-style: italic;
-  color: navy;
-}
-
-strong {
-  font-weight: bold;
-  color: #083194;
-}
-
-tt {
-  font-size: inherit;
-  color: navy;
-}
-
-h1, h2, h3, h4, h5, h6 {
-  color: #527bbd;
-  margin-top: 1.2em;
-  margin-bottom: 0.5em;
-  line-height: 1.3;
-}
-
-h1, h2, h3 {
-  border-bottom: 2px solid silver;
-}
-h2 {
-  padding-top: 0.5em;
-}
-h3 {
-  float: left;
-}
-h3 + * {
-  clear: left;
-}
-
-div.sectionbody {
-  margin-left: 0;
-}
-
-hr {
-  border: 1px solid silver;
-}
-
-p {
-  margin-top: 0.5em;
-  margin-bottom: 0.5em;
-}
-
-ul, ol, li > p {
-  margin-top: 0;
-}
-ul > li     { color: #aaa; }
-ul > li > * { color: black; }
-
-pre {
-  padding: 0;
-  margin: 0;
-}
-
-span#author {
-  color: #527bbd;
-  font-weight: bold;
-  font-size: 1.1em;
-}
-span#email {
-}
-span#revnumber, span#revdate, span#revremark {
-}
-
-div#footer {
-  font-size: small;
-  border-top: 2px solid silver;
-  padding-top: 0.5em;
-  margin-top: 4.0em;
-}
-div#footer-text {
-  float: left;
-  padding-bottom: 0.5em;
-}
-div#footer-badges {
-  float: right;
-  padding-bottom: 0.5em;
-}
-
-div#preamble {
-  margin-top: 1.5em;
-  margin-bottom: 1.5em;
-}
-div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
-div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
-div.admonitionblock {
-  margin-top: 1.0em;
-  margin-bottom: 1.5em;
-}
-div.admonitionblock {
-  margin-top: 2.0em;
-  margin-bottom: 2.0em;
-  margin-right: 10%;
-  color: #606060;
-}
-
-div.content { /* Block element content. */
-  padding: 0;
-}
-
-/* Block element titles. */
-div.title, caption.title {
-  color: #527bbd;
-  font-weight: bold;
-  text-align: left;
-  margin-top: 1.0em;
-  margin-bottom: 0.5em;
-}
-div.title + * {
-  margin-top: 0;
-}
-
-td div.title:first-child {
-  margin-top: 0.0em;
-}
-div.content div.title:first-child {
-  margin-top: 0.0em;
-}
-div.content + div.title {
-  margin-top: 0.0em;
-}
-
-div.sidebarblock > div.content {
-  background: #ffffee;
-  border: 1px solid #dddddd;
-  border-left: 4px solid #f0f0f0;
-  padding: 0.5em;
-}
-
-div.listingblock > div.content {
-  border: 1px solid #dddddd;
-  border-left: 5px solid #f0f0f0;
-  background: #f8f8f8;
-  padding: 0.5em;
-}
-
-div.quoteblock, div.verseblock {
-  padding-left: 1.0em;
-  margin-left: 1.0em;
-  margin-right: 10%;
-  border-left: 5px solid #f0f0f0;
-  color: #777777;
-}
-
-div.quoteblock > div.attribution {
-  padding-top: 0.5em;
-  text-align: right;
-}
-
-div.verseblock > pre.content {
-  font-family: inherit;
-  font-size: inherit;
-}
-div.verseblock > div.attribution {
-  padding-top: 0.75em;
-  text-align: left;
-}
-/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
-div.verseblock + div.attribution {
-  text-align: left;
-}
-
-div.admonitionblock .icon {
-  vertical-align: top;
-  font-size: 1.1em;
-  font-weight: bold;
-  text-decoration: underline;
-  color: #527bbd;
-  padding-right: 0.5em;
-}
-div.admonitionblock td.content {
-  padding-left: 0.5em;
-  border-left: 3px solid #dddddd;
-}
-
-div.exampleblock > div.content {
-  border-left: 3px solid #dddddd;
-  padding-left: 0.5em;
-}
-
-div.imageblock div.content { padding-left: 0; }
-span.image img { border-style: none; }
-a.image:visited { color: white; }
-
-dl {
-  margin-top: 0.8em;
-  margin-bottom: 0.8em;
-}
-dt {
-  margin-top: 0.5em;
-  margin-bottom: 0;
-  font-style: normal;
-  color: navy;
-}
-dd > *:first-child {
-  margin-top: 0.1em;
-}
-
-ul, ol {
-    list-style-position: outside;
-}
-ol.arabic {
-  list-style-type: decimal;
-}
-ol.loweralpha {
-  list-style-type: lower-alpha;
-}
-ol.upperalpha {
-  list-style-type: upper-alpha;
-}
-ol.lowerroman {
-  list-style-type: lower-roman;
-}
-ol.upperroman {
-  list-style-type: upper-roman;
-}
-
-div.compact ul, div.compact ol,
-div.compact p, div.compact p,
-div.compact div, div.compact div {
-  margin-top: 0.1em;
-  margin-bottom: 0.1em;
-}
-
-div.tableblock > table {
-  border: 3px solid #527bbd;
-}
-thead, p.table.header {
-  font-weight: bold;
-  color: #527bbd;
-}
-tfoot {
-  font-weight: bold;
-}
-td > div.verse {
-  white-space: pre;
-}
-p.table {
-  margin-top: 0;
-}
-/* Because the table frame attribute is overriden by CSS in most browsers. */
-div.tableblock > table[frame="void"] {
-  border-style: none;
-}
-div.tableblock > table[frame="hsides"] {
-  border-left-style: none;
-  border-right-style: none;
-}
-div.tableblock > table[frame="vsides"] {
-  border-top-style: none;
-  border-bottom-style: none;
-}
-
-
-div.hdlist {
-  margin-top: 0.8em;
-  margin-bottom: 0.8em;
-}
-div.hdlist tr {
-  padding-bottom: 15px;
-}
-dt.hdlist1.strong, td.hdlist1.strong {
-  font-weight: bold;
-}
-td.hdlist1 {
-  vertical-align: top;
-  font-style: normal;
-  padding-right: 0.8em;
-  color: navy;
-}
-td.hdlist2 {
-  vertical-align: top;
-}
-div.hdlist.compact tr {
-  margin: 0;
-  padding-bottom: 0;
-}
-
-.comment {
-  background: yellow;
-}
-
-.footnote, .footnoteref {
-  font-size: 0.8em;
-}
-
-span.footnote, span.footnoteref {
-  vertical-align: super;
-}
-
-#footnotes {
-  margin: 20px 0 20px 0;
-  padding: 7px 0 0 0;
-}
-
-#footnotes div.footnote {
-  margin: 0 0 5px 0;
-}
-
-#footnotes hr {
-  border: none;
-  border-top: 1px solid silver;
-  height: 1px;
-  text-align: left;
-  margin-left: 0;
-  width: 20%;
-  min-width: 100px;
-}
-
-div.colist td {
-  padding-right: 0.5em;
-  padding-bottom: 0.3em;
-  vertical-align: top;
-}
-div.colist td img {
-  margin-top: 0.3em;
-}
-
- at media print {
-  div#footer-badges { display: none; }
-}
-
-div#toc {
-  margin-bottom: 2.5em;
-}
-
-div#toctitle {
-  color: #527bbd;
-  font-size: 1.1em;
-  font-weight: bold;
-  margin-top: 1.0em;
-  margin-bottom: 0.1em;
-}
-
-div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
-  margin-top: 0;
-  margin-bottom: 0;
-}
-div.toclevel2 {
-  margin-left: 2em;
-  font-size: 0.9em;
-}
-div.toclevel3 {
-  margin-left: 4em;
-  font-size: 0.9em;
-}
-div.toclevel4 {
-  margin-left: 6em;
-  font-size: 0.9em;
-}
-
-span.aqua { color: aqua; }
-span.black { color: black; }
-span.blue { color: blue; }
-span.fuchsia { color: fuchsia; }
-span.gray { color: gray; }
-span.green { color: green; }
-span.lime { color: lime; }
-span.maroon { color: maroon; }
-span.navy { color: navy; }
-span.olive { color: olive; }
-span.purple { color: purple; }
-span.red { color: red; }
-span.silver { color: silver; }
-span.teal { color: teal; }
-span.white { color: white; }
-span.yellow { color: yellow; }
-
-span.aqua-background { background: aqua; }
-span.black-background { background: black; }
-span.blue-background { background: blue; }
-span.fuchsia-background { background: fuchsia; }
-span.gray-background { background: gray; }
-span.green-background { background: green; }
-span.lime-background { background: lime; }
-span.maroon-background { background: maroon; }
-span.navy-background { background: navy; }
-span.olive-background { background: olive; }
-span.purple-background { background: purple; }
-span.red-background { background: red; }
-span.silver-background { background: silver; }
-span.teal-background { background: teal; }
-span.white-background { background: white; }
-span.yellow-background { background: yellow; }
-
-span.big { font-size: 2em; }
-span.small { font-size: 0.6em; }
-a:link { color:navy; }
-a:visited { color:navy; }
-
-.monospaced, code, pre {
-  font-family: "Courier New", Courier, monospace;
-  font-size: medium; /* inherit; */
-  color: black;
-  padding: 0;
-  margin: 0;
-}
-
-/*
-  background: #f8f8f8;
-  border: 1px solid #dddddd;
-  border-left: 5px solid #f0f0f0;
-  margin-right: 10%;
-*/
-
-div.listingblock > div.content {
-  padding: 0.5em;
-  background: none;
-  border: none;
-  border-left: none;
-  margin-right: none;
-}
-
-</style>
-<script type="text/javascript">
-/*<![CDATA[*/
-window.onload = function(){asciidoc.footnotes();}
-var asciidoc = {  // Namespace.
-
-/////////////////////////////////////////////////////////////////////
-// Table Of Contents generator
-/////////////////////////////////////////////////////////////////////
-
-/* Author: Mihai Bazon, September 2002
- * http://students.infoiasi.ro/~mishoo
- *
- * Table Of Content generator
- * Version: 0.4
- *
- * Feel free to use this script under the terms of the GNU General Public
- * License, as long as you do not remove or alter this notice.
- */
-
- /* modified by Troy D. Hanson, September 2006. License: GPL */
- /* modified by Stuart Rackham, 2006, 2009. License: GPL */
-
-// toclevels = 1..4.
-toc: function (toclevels) {
-
-  function getText(el) {
-    var text = "";
-    for (var i = el.firstChild; i != null; i = i.nextSibling) {
-      if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
-        text += i.data;
-      else if (i.firstChild != null)
-        text += getText(i);
-    }
-    return text;
-  }
-
-  function TocEntry(el, text, toclevel) {
-    this.element = el;
-    this.text = text;
-    this.toclevel = toclevel;
-  }
-
-  function tocEntries(el, toclevels) {
-    var result = new Array;
-    var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
-    // Function that scans the DOM tree for header elements (the DOM2
-    // nodeIterator API would be a better technique but not supported by all
-    // browsers).
-    var iterate = function (el) {
-      for (var i = el.firstChild; i != null; i = i.nextSibling) {
-        if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
-          var mo = re.exec(i.tagName);
-          if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
-            result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
-          }
-          iterate(i);
-        }
-      }
-    }
-    iterate(el);
-    return result;
-  }
-
-  var toc = document.getElementById("toc");
-  var entries = tocEntries(document.getElementById("content"), toclevels);
-  for (var i = 0; i < entries.length; ++i) {
-    var entry = entries[i];
-    if (entry.element.id == "")
-      entry.element.id = "_toc_" + i;
-    var a = document.createElement("a");
-    a.href = "#" + entry.element.id;
-    a.appendChild(document.createTextNode(entry.text));
-    var div = document.createElement("div");
-    div.appendChild(a);
-    div.className = "toclevel" + entry.toclevel;
-    toc.appendChild(div);
-  }
-  if (entries.length == 0)
-    toc.parentNode.removeChild(toc);
-},
-
-
-/////////////////////////////////////////////////////////////////////
-// Footnotes generator
-/////////////////////////////////////////////////////////////////////
-
-/* Based on footnote generation code from:
- * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
- */
-
-footnotes: function () {
-  var cont = document.getElementById("content");
-  var noteholder = document.getElementById("footnotes");
-  var spans = cont.getElementsByTagName("span");
-  var refs = {};
-  var n = 0;
-  for (i=0; i<spans.length; i++) {
-    if (spans[i].className == "footnote") {
-      n++;
-      // Use [\s\S] in place of . so multi-line matches work.
-      // Because JavaScript has no s (dotall) regex flag.
-      note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
-      noteholder.innerHTML +=
-        "<div class='footnote' id='_footnote_" + n + "'>" +
-        "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
-        n + "</a>. " + note + "</div>";
-      spans[i].innerHTML =
-        "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
-        "' title='View footnote' class='footnote'>" + n + "</a>]";
-      var id =spans[i].getAttribute("id");
-      if (id != null) refs["#"+id] = n;
-    }
-  }
-  if (n == 0)
-    noteholder.parentNode.removeChild(noteholder);
-  else {
-    // Process footnoterefs.
-    for (i=0; i<spans.length; i++) {
-      if (spans[i].className == "footnoteref") {
-        var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
-        href = href.match(/#.*/)[0];  // Because IE return full URL.
-        n = refs[href];
-        spans[i].innerHTML =
-          "[<a href='#_footnote_" + n +
-          "' title='View footnote' class='footnote'>" + n + "</a>]";
-      }
-    }
-  }
-}
-
-}
-/*]]>*/
-</script>
-</head>
-<body class="article" style="max-width:800px">
-<div id="header">
-</div>
-<div id="content">
-<div class="sect2">
-<h3 id="_part_2_running_an_ensemble_of_many_apps_in_parallel_with_a_foreach_loop">Part 2: Running an ensemble of many apps in parallel with a "foreach" loop</h3>
-<div class="paragraph"><p>The <tt>p2.swift</tt> script introduces the <tt>foreach</tt> parallel iteration
-construct to run many concurrent simulations.</p></div>
-<div class="imageblock" style="text-align:center;">
-<div class="content">
-<img src="part02.png" alt="part02.png" />
-</div>
-</div>
-<div class="listingblock">
-<div class="title">p2.swift</div>
-<div class="content">
-<pre><tt>type file;
-
-app (file o) simulation ()
-{
-  simulate stdout=@filename(o);
-}
-
-foreach i in [0:9] {
-  file f <single_file_mapper; file=@strcat("output/sim_",i,".out")>;
-  f = simulation();
-}</tt></pre>
-</div></div>
-<div class="paragraph"><p>The script also shows an
-example of naming the output files of an ensemble run. In this case, the output files will be named
-<tt>output/sim_N.out</tt>.</p></div>
-<div class="paragraph"><p>To run the script and view the output:</p></div>
-<div class="listingblock">
-<div class="content">
-<pre><tt>$ cd ../part02
-$ swift p2.swift
-$ ls output
-sim_0.out  sim_1.out  sim_2.out  sim_3.out  sim_4.out  sim_5.out  sim_6.out  sim_7.out  sim_8.out  sim_9.out
-$ more output/*
-::::::::::::::
-output/sim_0.out
-::::::::::::::
-      44
-::::::::::::::
-output/sim_1.out
-::::::::::::::
-      55
-...
-::::::::::::::
-output/sim_9.out
-::::::::::::::
-      82</tt></pre>
-</div></div>
-</div>
-</div>
-<div id="footnotes"><hr /></div>
-<div id="footer">
-<div id="footer-text">
-Last updated 2013-09-11 13:05:49 CDT
-</div>
-</div>
-</body>
-</html>

Deleted: SwiftApps/tryswift/scripts/p2.swift
===================================================================
--- SwiftApps/tryswift/scripts/p2.swift	2013-10-11 16:16:10 UTC (rev 7149)
+++ SwiftApps/tryswift/scripts/p2.swift	2013-10-11 17:30:56 UTC (rev 7150)
@@ -1,11 +0,0 @@
-type file;
-
-app (file o) simulation ()
-{
-  simulate stdout=filename(o);
-}
-
-foreach i in [0:9] {
-  file f <single_file_mapper; file=strcat("output/sim_",i,".out")>;
-  f = simulation();
-}

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

Deleted: SwiftApps/tryswift/scripts/part01.png
===================================================================
(Binary files differ)

Deleted: SwiftApps/tryswift/scripts/part02.png
===================================================================
(Binary files differ)

Deleted: SwiftApps/tryswift/scripts/part1.txt
===================================================================
--- SwiftApps/tryswift/scripts/part1.txt	2013-10-11 16:16:10 UTC (rev 7149)
+++ SwiftApps/tryswift/scripts/part1.txt	2013-10-11 17:30:56 UTC (rev 7150)
@@ -1,13 +0,0 @@
-Part 1: Run a single application under Swift
-============================================
-
-The first swift script, p1.swift, runs simulate.sh to generate a
-single random number. It writes the number to a file.
-
-image::part01.png["p1 workflow",align="center"]
-
-.p1.swift
------
-sys::[cat ../part01/p1.swift]
------
-

Deleted: SwiftApps/tryswift/scripts/part2.txt
===================================================================
--- SwiftApps/tryswift/scripts/part2.txt	2013-10-11 16:16:10 UTC (rev 7149)
+++ SwiftApps/tryswift/scripts/part2.txt	2013-10-11 17:30:56 UTC (rev 7150)
@@ -1,38 +0,0 @@
-Part 2: Running an ensemble of many apps in parallel with a "foreach" loop
-==========================================================================
-
-The `p2.swift` script introduces the `foreach` parallel iteration
-construct to run many concurrent simulations.
-
-image::part02.png[align="center"]
-
-.p2.swift
------
-sys::[cat ../part02/p2.swift]
------
-
-The script also shows an
-example of naming the output files of an ensemble run. In this case, the output files will be named
-`output/sim_N.out`.
-
-To run the script and view the output:
------
-$ cd ../part02
-$ swift p2.swift
-$ ls output
-sim_0.out  sim_1.out  sim_2.out  sim_3.out  sim_4.out  sim_5.out  sim_6.out  sim_7.out  sim_8.out  sim_9.out
-$ more output/*
-::::::::::::::
-output/sim_0.out
-::::::::::::::
-      44
-::::::::::::::
-output/sim_1.out
-::::::::::::::
-      55
-...
-::::::::::::::
-output/sim_9.out
-::::::::::::::
-      82
------




More information about the Swift-commit mailing list