From: bbahnsen Date: Mon, 5 Jun 2006 23:37:30 +0000 (+0000) Subject: Remove the prototype code. X-Git-Tag: edk2-stable201903~25316 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=6c756d64634904e9e4dc7b9a6e9302fe0394a534 Remove the prototype code. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@423 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/Tools/Source/Prototype/Auto.java b/Tools/Source/Prototype/Auto.java deleted file mode 100644 index 07d609406e..0000000000 --- a/Tools/Source/Prototype/Auto.java +++ /dev/null @@ -1,8 +0,0 @@ -import java.util.*; - -public class Auto -{ - public static void main(String args[]) - { - } -} diff --git a/Tools/Source/Prototype/Component.java b/Tools/Source/Prototype/Component.java deleted file mode 100644 index 4e4e3a178c..0000000000 --- a/Tools/Source/Prototype/Component.java +++ /dev/null @@ -1,43 +0,0 @@ -import java.util.*; - -public class Component extends Module -{ - Component() - { - } - Component(String n) - { - name=n; - } - String name; - - // These are the libs we want to build with. - public Set buildLibs; - - public String name() { return name; } - - public boolean autoBuild() - { - // buildLibs must contain a list of libInstances. We need to check that - // These libs meet certain criterea. - if(!duplicateLibClasses(buildLibs).isEmpty()) - { - // Error: The lib instance implement the same lib twice. - return false; - } - if(! libClassesProduced(buildLibs).containsAll(consumesLibClasses)) - { - // We can not cover the libclasses consumed with these instances. - return false; - } - getConstructorOrder(buildLibs); - getDestructorOrder(buildLibs); - - // Get PPI, Protocol, GUID, PCDs from the lib instances. These are all simple unions of - // the corresponding sets in the modules. There is no ordering needed. - // TODO - - return true; - } - -} diff --git a/Tools/Source/Prototype/DAG.java b/Tools/Source/Prototype/DAG.java deleted file mode 100644 index 1edad27887..0000000000 --- a/Tools/Source/Prototype/DAG.java +++ /dev/null @@ -1,176 +0,0 @@ -import java.util.*; - -// A directed Acyclic Graph class. The main purpose is to provide a set of nodes -// and the dependency relations between them. Then ask for a topological sort of -// the nodes. - -public class DAG -{ - // Constructor. - DAG() - { - children = new HashMap>(); - } - - public Set nodes() { return children.keySet(); } - public Set children(Node parent) { return children.get(parent); } - - // Add the relations from a compatible DAG to this one. - public void add(DAG newDag) - { - for(Node parent : newDag.children.keySet()) - { - children.put(parent, newDag.children(parent)); - } - } - - // The central data structure is a one-to-many map. Each node is - // treated as a parent. It is mapped to a list of its children. Leaf - // nodes are also treated as parents and map to an empty list of - // children. - Map> children; - - public void remove(Collection nodes) - { - // Remove it as a parent - for(Node node : nodes) - { - children.remove(node); - } - - for(Set childlist : children.values()) - { - // Remove it as a child - childlist.removeAll(nodes); - } - } - - // Remove every occurrence of node from the DAG. - public void remove(Node node) - { - // Remove it as a parent - children.remove(node); - - for(Set childlist : children.values()) - { - // Remove it as a child - childlist.remove(node); - } - } - - // Return true iff parent is a direct parent of child. - public boolean directDepends(Node parent, Node child) - { - return children.containsKey(parent) ? - children(parent).contains(child) : - false; - } - - // Return true iff parent is a direct or indirect parent of child. - // This is the transitive closure of the dependency relation. - public boolean depends(Node parent, Node child) - { - if(!children.containsKey(parent)) - { - return false; - } - if( directDepends(parent, child) ) - { - return true; - } - else - { - for(Node descendent : children(parent) ) - { - // Recursively call depends() to compute the transitive closure of - // the relation. - if(depends(descendent, child)) - { - return true; - } - } - return false; - } - } - - // Add a parent child relation to the dag. Fail if there is already - // a dependency from the child to the parent. This implies a cycle. - // Our invariant is that the DAG must never contain a cycle. That - // way it lives up to its name. - public void add(Node parent, Node child) - { - if(depends(child, parent)) - { - System.out.format("Error: There is a cycle from %s to %s.\n", parent, child); - return; - } - if(children.containsKey(parent)) - { - children(parent).add(child); - } - else - { - Set cs = new HashSet(); - cs.add(child); - children.put(parent, cs); - } - if(!children.containsKey(child)) - { - children.put(child,new HashSet()); - } - } - - // Perform a topological sort on the DAG. - public List sort() - { - // Make an ordered list to hold the topo sort. - List sorted = new LinkedList(); - - // We add the leaves to the beginning of the list until - // the sorted list contains all the nodes in the DAG. - while(!sorted.containsAll(nodes())) - { - // Ignoring the ones we have found, what are the leaves of this - // DAG? - Set leaves = leaves(sorted); - // Put the new leaves at the beginning of the list. - sorted.addAll(0, leaves); - } - return sorted; - } - - // Return the set of nodes that have no children. Pretend - // the nodes in the exclude list are not present. - public Set leaves(Collection exclude) - { - Set leaves=new HashSet(); - for(Node parent : children.keySet()) - { - if(exclude.contains(parent)) - { - continue; - } - // If the children of parent are a subset of the exclude set, - // then parent is a leaf. - if(exclude.containsAll(children(parent))) - { - leaves.add(parent); - } - } - return leaves; - } - - // Return the set of nodes that have no children. - public Set leaves() - { - Set leaves=new HashSet(); - for(Node parent : children.keySet()) - { - if( children(parent).isEmpty()) - { - leaves.add(parent); - } - } - return leaves; - } -} diff --git a/Tools/Source/Prototype/Database.java b/Tools/Source/Prototype/Database.java deleted file mode 100644 index bc0a7b0c44..0000000000 --- a/Tools/Source/Prototype/Database.java +++ /dev/null @@ -1,14 +0,0 @@ -import java.util.*; - -public class Database -{ - Database() - { - } - Database(String n) - { - name=n; - } - public String name; - Map> packages; -} diff --git a/Tools/Source/Prototype/GuidDecl.java b/Tools/Source/Prototype/GuidDecl.java deleted file mode 100644 index 7aa928f9ed..0000000000 --- a/Tools/Source/Prototype/GuidDecl.java +++ /dev/null @@ -1,16 +0,0 @@ -import java.util.*; - -public class GuidDecl -{ - GuidDecl() - { - } - GuidDecl(String n) - { - name=n; - } - public String name; - public String cName; - public String guid; - public String name() { return name; } -} diff --git a/Tools/Source/Prototype/LibClass.java b/Tools/Source/Prototype/LibClass.java deleted file mode 100644 index c49f7ddb36..0000000000 --- a/Tools/Source/Prototype/LibClass.java +++ /dev/null @@ -1,14 +0,0 @@ -import java.util.*; - -public class LibClass -{ - LibClass() - { - } - LibClass(String n) - { - name=n; - } - String name; - public String name() { return name; } -} diff --git a/Tools/Source/Prototype/LibInst.java b/Tools/Source/Prototype/LibInst.java deleted file mode 100644 index 3e4dac32f3..0000000000 --- a/Tools/Source/Prototype/LibInst.java +++ /dev/null @@ -1,22 +0,0 @@ -import java.util.*; - -public class LibInst extends Module -{ - LibInst() - { - } - LibInst(String n) - { - name=n; - } - - public Set producesLibClasses; - - public String constructorName, destructorName; - - public boolean autoBuild() - { - // A simple compile, without link. - return true; - } -} diff --git a/Tools/Source/Prototype/Module.java b/Tools/Source/Prototype/Module.java deleted file mode 100644 index 79557f4de2..0000000000 --- a/Tools/Source/Prototype/Module.java +++ /dev/null @@ -1,178 +0,0 @@ -import java.util.*; - -public class Module -{ - Module() - { - } - Module(String n) - { - name=n; - } - String name; - - public String name() { return name; } - - public Set consumesLibClasses; - - // The set of packages that this module depends upon. - Set packageDepends; - public Set packageDeps() { return packageDepends; } - - public boolean autoBuild() - { - // This should be implemented in the derived class. - return true; - } - - // Make sure that each class in this set of libclasses is declared in one - // of the packages that this module depends on. - public boolean validateLibClasses(Set classes) - { - for(LibClass lc : classes) - { - // Assume we will not find it. - boolean found = false; - - for(Package p : packageDepends) - { - if(p.libClassDecls.contains(lc)) - { - found=true; - break; - } - } - if(found == false) - { - // Error: This LibClass is not found in any of our Packages. - return false; - } - } - // Well, we never came up empty handed, so it looks good. - return true; - } - - public Set libClassesProduced(Collection instances) - { - // given a set of lib instances, what is the set of lib classes produced? - - Set classes = new HashSet(); - - for(LibInst li : instances) - { - classes.addAll(li.producesLibClasses); - } - return classes; - } - - // Search the given set of lib instance to see if, among them, they - // produce the same LibClass more than once. - public Set duplicateLibClasses(Set libs) - { - // Return true iff each class produced is produced only once. - - List classes = new LinkedList(); - Set dups = new HashSet(); - - for(LibInst li : libs) - { - classes.addAll(li.producesLibClasses); - } - - for(LibClass c : classes) - { - for(LibClass inner : classes) - { - if(c.equals(inner)) - { - dups.add(c); - } - } - } - return dups; - } - - public Set getProducers(LibClass lc, Set libs) - { - // Return the subset of the given libs that produce this LibClass. - - Set producers = new HashSet(); - - for(LibInst li : libs) - { - if(li.producesLibClasses.contains(lc)) - { - producers.add(li); - } - } - return producers; - } - - // - // The central dependency relationship between library instances is as follows. - // A LibInst "A" depends upon LibInst "B" if, and only if, there exists a LibClass - // "C" such that A consumes C and B produces C. This is the partial order over which - // we construct a Directed Acyclic Graph (DAG). The DAG can be used to detect - // cycles in the depends relation (which are illegal) and it can be used to implement a - // topological sort which is a total ordering over LibInstances. This total order on - // lib instances is what is needed in order to call the constructors and destructors - // in the proper sequence. - // - public DAG makeDAG(Set libs) - { - DAG dag = new DAG(); - - if(duplicateLibClasses(libs).size()>0) - { - System.out.format("Error: The library instances implement at least one " - + "library class more than once.\n"); - } - - for(LibInst consumer : libs) - { - // Find all the producers for each LC that li consumes. - for(LibClass lc : consumer.consumesLibClasses ) - { - Set producers = getProducers(lc, libs); - if(producers.isEmpty()) - { - System.out.format("Error: Unmet dependency libclass:%s .", lc.name() ); - return null; - } - - // There is exactly one lib inst that produces this class. - LibInst producer = producers.iterator().next(); - - // Now we are ready to add the dependency to the dag. It will flag - // circular dependencies for us. - dag.add(consumer, producer); - } - } - return dag; - } - - // As you evaluate each node in the graph (starting with the module node), you - // must call the constructors for all the child nodes before you call the - // constructor for the current node. - public List getConstructorOrder(Set libs) - { - List rev = new LinkedList(); - - for(LibInst li : getDestructorOrder(libs)) - rev.add(0, li); - - return rev; - } - - // The destructor order is exactly the reverese of the constructor order. - // As you evaluate each node in the graph (starting with the module node), you - // must call the destructor for the all the parent nodes before calling the - // destructors for the current node, and then call the destructors for all the - // child nodes. - public List getDestructorOrder(Set libs) - { - DAG dag = makeDAG(libs); - - return dag.sort(); - } -} diff --git a/Tools/Source/Prototype/Package.java b/Tools/Source/Prototype/Package.java deleted file mode 100644 index dac0802d6c..0000000000 --- a/Tools/Source/Prototype/Package.java +++ /dev/null @@ -1,44 +0,0 @@ -import java.util.*; - -public class Package -{ - Package() - { - } - Package(String n) - { - name=n; - } - public String name; - - public Set libClassDecls; - public Set guidDecls; - public Set ppiDecls; - public Set protocolDecls; - public Set modules; - public Set depends; - - public void genBuild() - { - for(Module m : modules) - { - m.autoBuild(); - } - } - - // Figure out what this package depends on based on what the modules - // depend on. - public void calculateDependencies() - { - depends = new HashSet(); - for(Module m : modules) - { - depends.addAll(m.packageDeps()); - } - } - - public void makeJar(String name) {}; - - public void addModule(Module m) {}; - public void removeModule(Module m) {}; -} diff --git a/Tools/Source/Prototype/PpiDecl.java b/Tools/Source/Prototype/PpiDecl.java deleted file mode 100644 index 581fb13f76..0000000000 --- a/Tools/Source/Prototype/PpiDecl.java +++ /dev/null @@ -1,16 +0,0 @@ -import java.util.*; - -public class PpiDecl -{ - PpiDecl() - { - } - PpiDecl(String n) - { - name=n; - } - public String name; - public String cName; - public String guid; - public String name() { return name; } -} diff --git a/Tools/Source/Prototype/ProtocolDecl.java b/Tools/Source/Prototype/ProtocolDecl.java deleted file mode 100644 index 62a45e6fef..0000000000 --- a/Tools/Source/Prototype/ProtocolDecl.java +++ /dev/null @@ -1,16 +0,0 @@ -import java.util.*; - -public class ProtocolDecl -{ - ProtocolDecl() - { - } - ProtocolDecl(String n) - { - name=n; - } - public String name; - public String cName; - public String guid; - public String name() { return name; } -} diff --git a/Tools/Source/Prototype/TSort.java b/Tools/Source/Prototype/TSort.java deleted file mode 100644 index 88765e17fc..0000000000 --- a/Tools/Source/Prototype/TSort.java +++ /dev/null @@ -1,24 +0,0 @@ -import java.util.*; - -public class TSort -{ - public static void main(String args[]) - { - DAG dag = new DAG(); - int i; - - if(args.length % 2==1) - { - System.out.println("Error: Odd number of elements"); - return; - } - for(i=0; i< args.length/2; i++) - { - dag.add(args[i*2], args[i*2+1]); - // System.out.println(pair.left); - // System.out.println(pair.right); - } - System.out.println(dag.sort().toString()); - System.out.println(dag.sort().toString()); - } -} diff --git a/Tools/Source/Prototype/build.xml b/Tools/Source/Prototype/build.xml deleted file mode 100644 index de4cde9248..0000000000 --- a/Tools/Source/Prototype/build.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - -