[Swift-commit] r2713 - in trunk: src/org/griphyn/vdl/mapping tests/language-behaviour

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Fri Mar 20 14:42:23 CDT 2009


Author: benc
Date: 2009-03-20 14:42:22 -0500 (Fri, 20 Mar 2009)
New Revision: 2713

Added:
   trunk/tests/language-behaviour/07591-ext-mapper-multidimensional-array.sh
   trunk/tests/language-behaviour/07591-ext-mapper-multidimensional-array.swift
   trunk/tests/language-behaviour/07592-ext-mapper-multidimensional-array-structs.sh
   trunk/tests/language-behaviour/07592-ext-mapper-multidimensional-array-structs.swift
Modified:
   trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java
   trunk/src/org/griphyn/vdl/mapping/RootDataNode.java
Log:
For statically mapped data structures, close more deeply than closeShallow
but less deeply than closeDeep:  arrays through the whole structure will be
closed, but other types of data will be left unclosed.

Also adds two test cases that fail before this commit and succeed after it.

Modified: trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java	2009-03-20 19:39:40 UTC (rev 2712)
+++ trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java	2009-03-20 19:42:22 UTC (rev 2713)
@@ -483,6 +483,25 @@
 		}
 	}
 
+	/** Recursively closes arrays through a tree of arrays and complex
+ 	    types. */
+	public void closeDeepStructure() {
+		if (!this.closed && this.getType().isArray()) {
+			closeShallow();
+		}
+		synchronized (handles) {
+			Iterator i = handles.entrySet().iterator();
+			while (i.hasNext()) {
+				Map.Entry e = (Map.Entry) i.next();
+				AbstractDataNode child = (AbstractDataNode) e.getValue();
+				if(child.getType().isArray()  ||
+				   child.getType().getFields().size() > 0 ) {
+					child.closeDeepStructure();
+				}
+			}
+		}
+	}
+
 	public synchronized Path getPathFromRoot() {
 		if (pathFromRoot == null) {
 			AbstractDataNode parent = (AbstractDataNode) this.getParent();

Modified: trunk/src/org/griphyn/vdl/mapping/RootDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/RootDataNode.java	2009-03-20 19:39:40 UTC (rev 2712)
+++ trunk/src/org/griphyn/vdl/mapping/RootDataNode.java	2009-03-20 19:42:22 UTC (rev 2713)
@@ -127,7 +127,7 @@
 				}
 			}
 			if (root.isArray()) {
-				root.closeShallow();
+				root.closeDeepStructure();
 			}
 			checkConsistency(root);
 		}

Added: trunk/tests/language-behaviour/07591-ext-mapper-multidimensional-array.sh
===================================================================
--- trunk/tests/language-behaviour/07591-ext-mapper-multidimensional-array.sh	                        (rev 0)
+++ trunk/tests/language-behaviour/07591-ext-mapper-multidimensional-array.sh	2009-03-20 19:42:22 UTC (rev 2713)
@@ -0,0 +1,5 @@
+#!/bin/bash
+echo [0][0].a out.n/1foo/0/00/00/ST.TU.pdt
+echo [0][0].b out.n/1foo/0/00/00/ST.TU.rmsd
+
+


Property changes on: trunk/tests/language-behaviour/07591-ext-mapper-multidimensional-array.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/tests/language-behaviour/07591-ext-mapper-multidimensional-array.swift
===================================================================
--- trunk/tests/language-behaviour/07591-ext-mapper-multidimensional-array.swift	                        (rev 0)
+++ trunk/tests/language-behaviour/07591-ext-mapper-multidimensional-array.swift	2009-03-20 19:42:22 UTC (rev 2713)
@@ -0,0 +1,17 @@
+
+type F;
+
+type S {
+ F a;
+ F b;
+}
+
+app (S output[][]) touch() {
+touch @filenames(output);
+}
+
+S o[][] <ext; exec="07591-ext-mapper-multidimensional-array.sh">;
+
+o = touch();
+
+

Added: trunk/tests/language-behaviour/07592-ext-mapper-multidimensional-array-structs.sh
===================================================================
--- trunk/tests/language-behaviour/07592-ext-mapper-multidimensional-array-structs.sh	                        (rev 0)
+++ trunk/tests/language-behaviour/07592-ext-mapper-multidimensional-array-structs.sh	2009-03-20 19:42:22 UTC (rev 2713)
@@ -0,0 +1,6 @@
+#!/bin/bash
+echo [0][0].a out.n/1foo/0/00/00/ST.TU.pdt
+echo [0][0].b out.n/1foo/0/00/00/ST.TU.rmsd
+echo [0][0].c[0] out.n/1foo/0/00/00/ST.TU.rmsd2
+
+


Property changes on: trunk/tests/language-behaviour/07592-ext-mapper-multidimensional-array-structs.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/tests/language-behaviour/07592-ext-mapper-multidimensional-array-structs.swift
===================================================================
--- trunk/tests/language-behaviour/07592-ext-mapper-multidimensional-array-structs.swift	                        (rev 0)
+++ trunk/tests/language-behaviour/07592-ext-mapper-multidimensional-array-structs.swift	2009-03-20 19:42:22 UTC (rev 2713)
@@ -0,0 +1,18 @@
+
+type F;
+
+type S {
+ F a;
+ F b;
+ F c[];
+}
+
+app (S output[][]) touch() {
+touch @filenames(output);
+}
+
+S o[][] <ext; exec="07592-ext-mapper-multidimensional-array-structs.sh">;
+
+o = touch();
+
+




More information about the Swift-commit mailing list