[Swift-commit] r7944 - trunk/libexec

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Fri Jul 4 01:13:23 CDT 2014


Author: hategan
Date: 2014-07-04 01:13:22 -0500 (Fri, 04 Jul 2014)
New Revision: 7944

Modified:
   trunk/libexec/swift-xs.k
   trunk/libexec/swift.k
Log:
move type definitions to java (to allow compile-time optimizations) and removed some noops

Modified: trunk/libexec/swift-xs.k
===================================================================
--- trunk/libexec/swift-xs.k	2014-07-04 06:10:58 UTC (rev 7943)
+++ trunk/libexec/swift-xs.k	2014-07-04 06:13:22 UTC (rev 7944)
@@ -1,85 +1,10 @@
 import(sys)
 
 namespace(xs) {
-	import(java)
-	
-	UnresolvedType := function(name, isArray) {
-		java:new("org.griphyn.vdl.type.impl.UnresolvedType", types=["String"], name)
-	}
-	
-	typesST := function() {
-		types = ["String", "org.griphyn.vdl.type.Type"]
-	}
-	
-	newSimpleNode := function(name, type) {
-		x := java:new("org.griphyn.vdl.type.impl.TypeImpl", types=["String"], name)
-		invokeMethod("setBaseType", object=x, types=["org.griphyn.vdl.type.Type"]
-			invokeMethod("getType", classname="org.griphyn.vdl.type.Types", type)
-		)
-		x
-	}
-	
-	newComplexNode := function(name) {
-		java:new("org.griphyn.vdl.type.impl.TypeImpl", types=["String"], name)
-	}
-	
-	addNode := function(node) {
-		invokeMethod("addType", classname="org.griphyn.vdl.type.Types"
-			types=["org.griphyn.vdl.type.Type"]
-			node
-		)
-	}
-	
-	addField := function(node, name, type) {
-		invokeMethod("addField", object=node, typesST(), name, type)
-	}
-	
-	export(schema, 
-		function() {
-			invokeMethod("resolveTypes", classname="org.griphyn.vdl.type.Types")
-		}
-	)
-	
-	export(simpleType,
-		function(name, type) {
-			addNode(newSimpleNode(name, type))
-		}
-	)
-	
-	export(restriction,	
-		function(base) {
-			type = last(split(base, ":"))
-		}
-	)
-	
-	export(complexType,	
-		function(name, ...) {
-			node := newComplexNode(name)
-			for(field, ...) {
-				(name, type) := each(field)
-				addField(node, name, type)
-			}
-			addNode(node)
-		}
-	)
-	
-	export(sequence,
-		function(minOccurs = 0, maxOccurs = 0, ...) {
-			(name, type) := each(first(...))
-			if (maxOccurs == "unbounded") {
-				list(name, UnresolvedType(type, true))
-			}
-			else {
-				each(...)
-			}
-		}
-	)
-		
-		//should be noted that we're dealing with type names here
-	export(element,
-		function(name, type) {
-		    type := last(split(type, ":"))
-		    list(name, UnresolvedType(type, false))
-		}
-	)
+	export(schema, def("org.griphyn.vdl.karajan.lib.XS$Schema"))
+	export(simpleType, def("org.griphyn.vdl.karajan.lib.XS$SimpleType"))
+	export(restriction, def("org.griphyn.vdl.karajan.lib.XS$Restriction"))
+	export(complexType, def("org.griphyn.vdl.karajan.lib.XS$ComplexType"))
+	export(sequence, def("org.griphyn.vdl.karajan.lib.XS$Sequence"))
+	export(element, def("org.griphyn.vdl.karajan.lib.XS$Element"))
 }

Modified: trunk/libexec/swift.k
===================================================================
--- trunk/libexec/swift.k	2014-07-04 06:10:58 UTC (rev 7943)
+++ trunk/libexec/swift.k	2014-07-04 06:13:22 UTC (rev 7944)
@@ -52,42 +52,10 @@
 		}
 	)
 
-	export(mapping,
-		function(descriptor, ...) {
-			mapping=map(map:entry("swift#descriptor", descriptor), each(...))
-		}
-	)
+	export(mapping, def("org.griphyn.vdl.karajan.lib.Mapping$Cons"))
+	export(parameter, def("org.griphyn.vdl.karajan.lib.Mapping$Parameter"))
 
-	export(parameter,
-		function(name, value) {
-			map:entry(name, value)
-		}
-	)
 
-	export(stdout,
-		function(file) {
-			stdout = file
-		}
-	)
-	
-	export(stdin,
-		function(file) {
-			stdin = file
-		}
-	)
-
-	export(stderr,
-		function(file) {
-			stderr = file
-		}
-	)
-
-	export(tr,
-		function(name) {
-			tr = name
-		}
-	)
-
 	export(attributes,
 	    function(attrs) {
 	    	attributes = attrs




More information about the Swift-commit mailing list