summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Davis <jrcd83@gmail.com>2012-02-13 03:01:47 +0100
committerJustin Davis <jrcd83@gmail.com>2012-02-13 03:01:47 +0100
commitf4ee30a61b018afd61b67b8a7269a826e2a98281 (patch)
tree8c34dd62fc2a26e50a3c2b7a03d7c9ecff6fb73b
parentba97a989c2228e4840a0c58173b0d8f541911c69 (diff)
downloadgenpkg-f4ee30a61b018afd61b67b8a7269a826e2a98281.tar.gz
genpkg-f4ee30a61b018afd61b67b8a7269a826e2a98281.tar.xz
Start of Io version of modpkgmeta.
-rwxr-xr-x[-rw-r--r--]bin/modpkgmeta74
1 files changed, 74 insertions, 0 deletions
diff --git a/bin/modpkgmeta b/bin/modpkgmeta
index e69de29..8d8066e 100644..100755
--- a/bin/modpkgmeta
+++ b/bin/modpkgmeta
@@ -0,0 +1,74 @@
+#!/usr/bin/env io
+
+PFieldVal := Object clone
+PFieldVal do(
+ stringValue := nil
+ ownerField := nil
+
+ moveTo := method(newOwner,
+ ownerField removeValue(self)
+ ownerField = newOwner addValue(self)
+ self
+ )
+ matches := method(start,
+ stringValue beginsWithSeq(start)
+ )
+ asString := method(stringValue)
+)
+
+PFieldValMux := Object clone
+PFieldValMux do(
+ init := method(
+ self fieldVals := List clone
+ )
+ addValue := method(fv,
+ fieldVals append(fv)
+ self
+ )
+ moveTo := method(destField,
+ fieldVals foreach(fv,
+ fv moveTo(destField)
+ )
+ self
+ )
+ asList := method(
+ fieldVals
+ )
+)
+
+PField := Object clone
+PField do(
+ init := method(
+ self fieldVals := List clone
+ )
+ match := method(
+ mux := PFieldValMux clone
+ call evalArgs foreach(arg,
+ fieldVals foreach(fv,
+ fv matches(arg) ifTrue(mux addValue(fv))
+ )
+ )
+ mux
+ )
+ addValue := method(newFV,
+ fieldVals append(newFV)
+ newFV ownerField = self
+ self
+ )
+ removeValue := method(fv,
+ fieldVals remove(fv)
+ self
+ )
+)
+
+depends := PField clone
+list("foo", "bar") foreach(str,
+ val := PFieldVal clone
+ val stringValue = str
+ depends addValue(val)
+)
+
+checkdepends := PField clone
+depends match("foo", "bar") moveTo(checkdepends)
+checkdepends fieldVals foreach(fv, fv asString println)
+checkdepends println