[Swift-commit] r4720 - trunk/docs/userguide

jonmon at ci.uchicago.edu jonmon at ci.uchicago.edu
Thu Jun 30 19:01:43 CDT 2011


Author: jonmon
Date: 2011-06-30 19:01:43 -0500 (Thu, 30 Jun 2011)
New Revision: 4720

Modified:
   trunk/docs/userguide/app_procedures
Log:
o updated docs: renamed readData2 to readStructured


Modified: trunk/docs/userguide/app_procedures
===================================================================
--- trunk/docs/userguide/app_procedures	2011-06-30 23:59:17 UTC (rev 4719)
+++ trunk/docs/userguide/app_procedures	2011-07-01 00:01:43 UTC (rev 4720)
@@ -18,14 +18,14 @@
 In this section, this example SwiftScript program is used for reference:
 
 ----
-type file;  
-  
-app (file o) count(file i) {  
-  wc @i stdout=@o;  
-}  
-  
-file q <"input.txt">;  
-file r <"output.txt">;  
+type file;
+
+app (file o) count(file i) {
+  wc @i stdout=@o;
+}
+
+file q <"input.txt">;
+file r <"output.txt">;
 ----
 
 The executable for wc will be looked up in tc.data.
@@ -278,9 +278,9 @@
 For example:
 
 ----
-trace(@arg("myparam"));  
-trace(@arg("optionalparam", "defaultvalue"));  
-----              
+trace(@arg("myparam"));
+trace(@arg("optionalparam", "defaultvalue"));
+----
 
 ----
 $ swift arg.swift -myparam=hello
@@ -289,7 +289,7 @@
 RunID: 20080220-1548-ylc4pmda
 SwiftScript trace: defaultvalue
 SwiftScript trace: hello
-----			
+----
 
 @extractint
 ~~~~~~~~~~~
@@ -319,7 +319,7 @@
 For example:
 
 ----
-string v =  @regexp("abcdefghi", "c(def)g","monkey");  
+string v =  @regexp("abcdefghi", "c(def)g","monkey");
 ----
 
 will assign the value "abmonkeyhi" to the variable v.
@@ -341,12 +341,12 @@
 
 For example:
 ----
-string t = "my name is John and i like puppies.";  
-string name = @strcut(t, "my name is ([^ ]*) ");  
-string out = @strcat("Your name is ",name);  
+string t = "my name is John and i like puppies.";
+string name = @strcut(t, "my name is ([^ ]*) ");
+string out = @strcat("Your name is ",name);
 trace(out);
-----  
-              
+----
+
 will output the message: Your name is John.
 
 @strsplit
@@ -357,12 +357,12 @@
 
 Example:
 ----
-string t = "my name is John and i like puppies.";  
-string words[] = @strsplit(t, "\\s");  
-foreach word in words {  
-    trace(word);  
-}  
-----              
+string t = "my name is John and i like puppies.";
+string words[] = @strsplit(t, "\\s");
+foreach word in words {
+    trace(word);
+}
+----
 
 will output one word of the sentence on each line (though not
 necessarily in order, due to the fact that foreach iterations execute in
@@ -415,9 +415,9 @@
 the same order as the header row and separated by whitespace. (since
 Swift 0.4)
 
-readData2
-~~~~~~~~~
-readData2 will read data from a specified file, like readdata, but
+readStructured
+~~~~~~~~~~~~~~
+readStructured will read data from a specified file, like readdata, but
 using a different file format more closely related to that used by the
 ext mapper.
 
@@ -425,32 +425,32 @@
 and the value for that position in the structure:
 
 ----
-rows[0].columns[0] = 0                                                          
-rows[0].columns[1] = 2                                                          
-rows[0].columns[2] = 4                                                          
-rows[1].columns[0] = 1                                                          
-rows[1].columns[1] = 3                                                          
+rows[0].columns[0] = 0
+rows[0].columns[1] = 2
+rows[0].columns[2] = 4
+rows[1].columns[0] = 1
+rows[1].columns[1] = 3
 rows[1].columns[2] = 5
-----			
+----
 
 which can be read into a structure defined like this:
 
 ----
-type vector {                                                                     
-        int columns[];                                                            
-}                                                                                 
-                                                                                  
-type matrix {                                                                     
-        vector rows[];                                                            
-}                                                                                 
-                                                                                  
-matrix m;                                                                         
-                                                                                  
-m = readData2("readData2.in");      
-----                  
+type vector {
+        int columns[];
+}
 
-(since Swift 0.7)
+type matrix {
+        vector rows[];
+}
 
+matrix m;
+
+m = readStructured("readStructured.in");
+----
+
+(since Swift 0.7, was readData2(deprecated))
+
 trace
 ~~~~~
 trace will log its parameters. By default these will appear on both




More information about the Swift-commit mailing list