Refine the code for PCD tools.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1282 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2
2006-08-15 18:33:53 +00:00
parent 5f907e4a5b
commit 11eb278ae5
6 changed files with 171 additions and 92 deletions

View File

@@ -362,7 +362,7 @@ public class AutoGen {
//
if (this.myPcdAutogen != null) {
fileBuffer.append("\r\n");
fileBuffer.append(this.myPcdAutogen.OutputH());
fileBuffer.append(this.myPcdAutogen.getHAutoGenString());
}
//
@@ -496,7 +496,7 @@ public class AutoGen {
if (this.myPcdAutogen != null) {
fileBuffer.append("\r\n");
fileBuffer.append(this.myPcdAutogen.OutputC());
fileBuffer.append(this.myPcdAutogen.getCAutoGenString());
}
if (!saveFile(outputPath + File.separatorChar + "AutoGen.c", fileBuffer)) {
@@ -599,7 +599,7 @@ public class AutoGen {
//
if (this.myPcdAutogen != null) {
fileBuffer.append("\r\n");
fileBuffer.append(this.myPcdAutogen.OutputH());
fileBuffer.append(this.myPcdAutogen.getHAutoGenString());
}
//
@@ -650,7 +650,7 @@ public class AutoGen {
if (this.myPcdAutogen != null) {
fileBuffer.append("\r\n");
fileBuffer.append(this.myPcdAutogen.OutputC());
fileBuffer.append(this.myPcdAutogen.getCAutoGenString());
}
if (!saveFile(outputPath + File.separatorChar + "AutoGen.c", fileBuffer)) {

View File

@@ -34,8 +34,9 @@ import org.tianocore.pcd.entity.UsageIdentification;
import org.tianocore.pcd.entity.UsageInstance;
import org.tianocore.pcd.exception.BuildActionException;
/** This class is to manage how to generate the PCD information into Autogen.c and
Autogen.h.
/**
This class is to manage how to generate the PCD information into Autogen.c
and Autogen.h.
**/
public class PCDAutoGenAction extends BuildAction {
///
@@ -113,7 +114,7 @@ public class PCDAutoGenAction extends BuildAction {
@return the string of header file for PCD
**/
public String OutputH() {
public String getHAutoGenString() {
return hAutoGenString;
}
@@ -122,7 +123,7 @@ public class PCDAutoGenAction extends BuildAction {
@return the string of C code file for PCD
**/
public String OutputC() {
public String getCAutoGenString() {
return cAutoGenString;
}
@@ -317,10 +318,6 @@ public class PCDAutoGenAction extends BuildAction {
cAutoGenString += usageInstance.getCAutogenStr();
}
//
// Work around code, In furture following code should be modified that get
// these information from Uplevel Autogen tools.
//
if (pcdDriverType == CommonDefinition.PCD_DRIVER_TYPE.PEI_PCD_DRIVER) {
hAutoGenString += MemoryDatabaseManager.PcdPeimHString;
cAutoGenString += MemoryDatabaseManager.PcdPeimCString;
@@ -329,29 +326,4 @@ public class PCDAutoGenAction extends BuildAction {
cAutoGenString += MemoryDatabaseManager.PcdDxeCString;
}
}
/**
Test case function
@param argv paramter from command line
**/
public static void main(String argv[]) {
String WorkSpace = "X:/edk2";
String logFilePath = WorkSpace + "/EdkNt32Pkg/Nt32.fpd";
//
// At first, CollectPCDAction should be invoked to collect
// all PCD information from SPD, MSA, FPD.
//
PlatformPcdPreprocessActionForBuilding collectionAction = new PlatformPcdPreprocessActionForBuilding();
GlobalData.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db",
WorkSpace,null);
try {
collectionAction.perform(logFilePath, ActionMessage.MAX_MESSAGE_LEVEL);
} catch(Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -19,7 +19,6 @@ package org.tianocore.build.pcd.action;
import java.io.File;
import java.io.IOException;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -50,7 +49,7 @@ import org.tianocore.pcd.exception.PlatformPcdPreprocessException;
**/
public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreprocessAction {
///
/// FPD file is the root file.
/// FPD file path.
///
private String fpdFilePath;
@@ -88,7 +87,7 @@ public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreproces
/**
Common function interface for outer.
@param fpdFilePath The fpd file path of current build or analysis.
@param fpdFilePath The fpd file path of current build or processing.
@param messageLevel The message level for this Action.
@throws PlatformPreprocessBuildException
@@ -98,7 +97,7 @@ public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreproces
**/
public void perform(String fpdFilePath, int messageLevel)
throws PlatformPcdPreprocessBuildException {
setFPDFilePath(fpdFilePath);
this.fpdFilePath = fpdFilePath;
setActionMessageLevel(messageLevel);
checkParameter();
execute();
@@ -152,7 +151,7 @@ public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreproces
try {
genPcdDatabaseSourceCode ();
} catch (EntityException exp) {
throw new PlatformPcdPreprocessBuildException(errorMessageHeader + exp.getMessage());
throw new PlatformPcdPreprocessBuildException(errorMessageHeader + "\r\n" + exp.getMessage());
}
}
@@ -323,7 +322,7 @@ public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreproces
dynamicPrimaryKey = Token.getPrimaryKeyString(dynamicPcdBuildDataArray.get(index).getCName(),
tokenSpaceStrRet);
if (dynamicPrimaryKey.equalsIgnoreCase(token.getPrimaryKeyString())) {
if (dynamicPrimaryKey.equals(token.getPrimaryKeyString())) {
return dynamicPcdBuildDataArray.get(index);
}
}
@@ -374,11 +373,11 @@ public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreproces
File file = null;
if (fpdFilePath == null) {
throw new PlatformPcdPreprocessBuildException("WorkspacePath and FPDFileName should be empty for CollectPCDAtion!");
throw new PlatformPcdPreprocessBuildException("FPDFileName should be empty for CollectPCDAtion!");
}
if (fpdFilePath.length() == 0) {
throw new PlatformPcdPreprocessBuildException("WorkspacePath and FPDFileName should be empty for CollectPCDAtion!");
throw new PlatformPcdPreprocessBuildException("FPDFileName should be empty for CollectPCDAtion!");
}
file = new File(fpdFilePath);
@@ -387,23 +386,4 @@ public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreproces
throw new PlatformPcdPreprocessBuildException("FPD File " + fpdFilePath + " does not exist!");
}
}
/**
Test case function
@param argv parameter from command line
**/
public static void main(String argv[]) throws PlatformPcdPreprocessBuildException {
PlatformPcdPreprocessActionForBuilding ca = new PlatformPcdPreprocessActionForBuilding();
String projectDir = "x:/edk2";
ca.setFPDFilePath(projectDir + "/EdkNt32Pkg/Nt32.fpd");
ca.setActionMessageLevel(ActionMessage.MAX_MESSAGE_LEVEL);
GlobalData.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db",
projectDir,
"tools_def.txt");
System.out.println("After initInfo!");
FpdParserTask fpt = new FpdParserTask();
fpt.parseFpdFile(new File(projectDir + "/EdkNt32Pkg/Nt32.fpd"));
ca.execute();
}
}