Corrected some comments for the changed code.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2194 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jwang36 2007-01-08 10:16:40 +00:00
parent bc33b23da1
commit 2384947051
2 changed files with 34 additions and 14 deletions

View File

@ -76,12 +76,11 @@ public class AutogenLibOrder {
String[] libClassDeclList = null; String[] libClassDeclList = null;
String[] libClassConsmList = null; String[] libClassConsmList = null;
libInstanceList = new ModuleIdentification[libraryList.length]; libInstanceList = libraryList;
for (int i = 0; i < libraryList.length; i++) { for (int i = 0; i < libraryList.length; i++) {
libInstance = libraryList[i]; libInstance = libraryList[i];
libInstanceList[i] = libInstance;
// //
// Add libraryInstance in to libInstanceList. // Fetch the constructor & destructor.
// //
Map<String, XmlObject> libDoc = GlobalData.getDoc(libInstance, arch); Map<String, XmlObject> libDoc = GlobalData.getDoc(libInstance, arch);
SurfaceAreaQuery saq = new SurfaceAreaQuery(libDoc); SurfaceAreaQuery saq = new SurfaceAreaQuery(libDoc);
@ -89,17 +88,10 @@ public class AutogenLibOrder {
libInstance.setDestructor(saq.getLibDestructorName()); libInstance.setDestructor(saq.getLibDestructorName());
// //
// Add library instance and consumed library class list to // Create library class consume database.
// libInstanceConsumes.
// //
libClassConsmList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, arch); libClassConsmList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, arch);
if (libClassConsmList != null) { if (libClassConsmList != null) {
/*
String[] classStr = new String[libClassConsmList.length];
for (int k = 0; k < libClassConsmList.length; k++) {
classStr[k] = libClassConsmList[k];
}
*/
if (this.libInstanceConsumes.containsKey(libInstance)) { if (this.libInstanceConsumes.containsKey(libInstance)) {
throw new AutoGenException( throw new AutoGenException(
libraryList[i].getName() libraryList[i].getName()
@ -110,7 +102,7 @@ public class AutogenLibOrder {
} }
// //
// Add library class and library instance map. // Create library class implementer database
// //
libClassDeclList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, arch); libClassDeclList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, arch);
if (libClassDeclList != null) { if (libClassDeclList != null) {
@ -129,6 +121,9 @@ public class AutogenLibOrder {
} }
} }
//
// Create a consumed-by database
//
for (Iterator it = libClassProducer.keySet().iterator(); it.hasNext();) { for (Iterator it = libClassProducer.keySet().iterator(); it.hasNext();) {
String className = (String)it.next(); String className = (String)it.next();
libInstance = libClassProducer.get(className); libInstance = libClassProducer.get(className);
@ -151,7 +146,7 @@ public class AutogenLibOrder {
orderLibInstance orderLibInstance
This function reorder the library instance according the library class This function reorder the library instance according the library class
dependency. dependency, using DAG anaylysis algothim
@return List which content the ordered library instance. @return List which content the ordered library instance.
**/ **/
@ -159,6 +154,9 @@ public class AutogenLibOrder {
LinkedList<ModuleIdentification> orderList = new LinkedList<ModuleIdentification>(); LinkedList<ModuleIdentification> orderList = new LinkedList<ModuleIdentification>();
LinkedList<ModuleIdentification> noConsumerList = new LinkedList<ModuleIdentification>(); LinkedList<ModuleIdentification> noConsumerList = new LinkedList<ModuleIdentification>();
//
// First, add the library instance without consumers to the Q
//
for (int i = 0; i < libInstanceList.length; ++i) { for (int i = 0; i < libInstanceList.length; ++i) {
if (libInstanceConsumedBy.get(libInstanceList[i]).size() == 0) { if (libInstanceConsumedBy.get(libInstanceList[i]).size() == 0) {
noConsumerList.add(libInstanceList[i]); noConsumerList.add(libInstanceList[i]);
@ -221,6 +219,9 @@ public class AutogenLibOrder {
} }
} }
//
// Append the remaining library instance to the end of sorted list
//
for (int i = 0; i < libInstanceList.length; ++i) { for (int i = 0; i < libInstanceList.length; ++i) {
if (!orderList.contains(libInstanceList[i])) { if (!orderList.contains(libInstanceList[i])) {
orderList.add(libInstanceList[i]); orderList.add(libInstanceList[i]);

View File

@ -189,25 +189,44 @@ public class ModuleIdentification extends Identification {
public void setModuleType(String moduleType) { public void setModuleType(String moduleType) {
this.moduleType = moduleType; this.moduleType = moduleType;
} }
/**
@return String The module name
**/
public String getName() { public String getName() {
return name; return name;
} }
/**
@return boolean
**/
public boolean hasConstructor() { public boolean hasConstructor() {
return constructor != ""; return constructor != "";
} }
/**
@return boolean
*/
public boolean hasDestructor() { public boolean hasDestructor() {
return destructor != ""; return destructor != "";
} }
/**
Set the constructor function name if this module is a library
@param name
*/
public void setConstructor(String name) { public void setConstructor(String name) {
if (name != null) { if (name != null) {
constructor = name; constructor = name;
} }
} }
/**
Set the destructor function name if this module is a library
@param name
*/
public void setDestructor(String name) { public void setDestructor(String name) {
if (name != null) { if (name != null) {
destructor = name; destructor = name;