fix the bug in revision 1746

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1747 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jjin9 2006-10-14 11:50:20 +00:00
parent f337986f8e
commit f15e135965
2 changed files with 98 additions and 47 deletions

View File

@ -94,9 +94,15 @@ public class ParseParameter {
//
if(argstr.length() < 6 && argstr.charAt(3) == '0'){
curpstr = pstr;
npflag = true;
continue;
}
curpstr = mergeSetting(curpstr, argstr);
if(curpstr == null){
curpstr = pstr.concat(argstr.substring(2));
}else{
curpstr = mergeSetting(curpstr, argstr);
}
npflag = true;
} else if (argstr.charAt(1) == 't') {
if(argstr.length() < 4 && argstr.charAt(2) == ' '){
System.out.printf("%s\n", curtstr);
@ -108,9 +114,15 @@ public class ParseParameter {
}
if(argstr.length() < 6 && argstr.charAt(3) == '0'){
curtstr = tstr;
ntflag = true;
continue;
}
curtstr = mergeSetting(curtstr, argstr);
if(curtstr == null){
curtstr = tstr.concat(argstr.substring(2));
}else{
curtstr = mergeSetting(curtstr, argstr);
}
ntflag = true;
} else if (argstr.charAt(1) == 'a') {
if(argstr.length() < 4 && argstr.charAt(2) == ' '){
System.out.printf("%s\n", curastr);
@ -122,9 +134,15 @@ public class ParseParameter {
}
if(argstr.length() < 6 && argstr.charAt(3) == '0'){
curastr = astr;
naflag = true;
continue;
}
curastr = mergeSetting(curastr, argstr);
if(curastr == null){
curastr = astr.concat(argstr.substring(2));
}else{
curastr = mergeSetting(curastr, argstr);
}
naflag = true;
} else if (argstr.charAt(1) == 'c') {
if(argstr.length() < 4 && argstr.charAt(2) == ' '){
System.out.printf("%s\n", curcstr);
@ -136,9 +154,15 @@ public class ParseParameter {
}
if(argstr.length() < 6 && argstr.charAt(3) == '0'){
curcstr = cstr;
ncflag = true;
continue;
}
curcstr = mergeSetting(curcstr, argstr);
if(curcstr == null){
curcstr = pstr.concat(argstr.substring(2));
}else{
curcstr = mergeSetting(curcstr, argstr);
}
ncflag = true;
} else if (argstr.charAt(1) == 'n') {
if(argstr.length() < 4 && argstr.charAt(2) == ' '){
System.out.printf("%s\n", curnstr);
@ -150,9 +174,15 @@ public class ParseParameter {
}
if(argstr.length() < 6 && argstr.charAt(3) == '0'){
curnstr = nstr;
nnflag = true;
continue;
}
curnstr = mergeSetting(curnstr, argstr);
if(curnstr == null){
curnstr = nstr.concat(argstr.substring(2));
}else{
curnstr = mergeSetting(curnstr, argstr);
}
nnflag = true;
} else if (argstr.charAt(1) == 'm') {
if(argstr.length() < 4 && argstr.charAt(2) == ' '){
System.out.printf("%s\n", curmstr);
@ -164,12 +194,14 @@ public class ParseParameter {
}
mstr += argstr.substring(2);
curmstr = mstr;
nmflag = true;
if (argstr.charAt(3) == '0'){
mestr += " Disable";
} else {
mestr += " Enable";
}
curmestr = mestr;
nmeflag = true;
}
}
@ -180,13 +212,10 @@ public class ParseParameter {
public static String mergeSetting( String S1, String S2){
String[] S = S2.split(" ");
if(S1 == null){
S1 = tstr.concat(S2.substring(2));
}else{
for(int i = 1; i < S.length; i++){
if( S1.contains(S[i]) == false ){
S1 = S1.concat(S[i]).concat(" ");
}
for(int i = 1; i < S.length; i++){
if(S1.contains(S[i]) == false){
S1 = S1.concat(" ").concat(S[i]);
}
}
@ -231,5 +260,13 @@ public class ParseParameter {
public static int nlength = 0;
public static int mlength = 0;
public static int melength = 0;
public static boolean npflag = false;
public static boolean ntflag = false;
public static boolean naflag = false;
public static boolean ncflag = false;
public static boolean nnflag = false;
public static boolean nmflag = false;
public static boolean nmeflag = false;
}

View File

@ -157,14 +157,16 @@ public class TargetFile {
if (textLine.indexOf("ACTIVE_PLATFORM") != -1) {
if(pflag == true){
if(textLine.trim().charAt(0) == '#'){
if(ParseParameter.curpstr.length() >= ParseParameter.plength) {
if(ParseParameter.npflag == true) {
bw.write(ParseParameter.curpstr);
bw.newLine();
pflag = false;
}else{
bw.write(textLine);
}
bw.newLine();
pflag = false;
continue;
}
if(ParseParameter.curpstr.length() >= ParseParameter.plength) {
if(ParseParameter.npflag == true) {
bw.write(ParseParameter.curpstr);
} else {
bw.write(textLine);
@ -175,14 +177,16 @@ public class TargetFile {
} else if (textLine.indexOf("TARGET_ARCH") != -1) {
if(aflag == true){
if(textLine.trim().charAt(0) == '#'){
if(ParseParameter.curastr.length() >= ParseParameter.alength) {
if(ParseParameter.naflag == true) {
bw.write(ParseParameter.curastr);
bw.newLine();
aflag = false;
}else{
bw.write(textLine);
}
bw.newLine();
aflag = false;
continue;
}
if(ParseParameter.curastr.length() >= ParseParameter.alength) {
if(ParseParameter.naflag == true) {
bw.write(ParseParameter.curastr);
} else {
bw.write(textLine);
@ -193,14 +197,16 @@ public class TargetFile {
} else if (textLine.indexOf("TARGET") != -1) {
if(tflag == true){
if(textLine.trim().charAt(0) == '#'){
if(ParseParameter.curtstr.length() >= ParseParameter.tlength) {
if(ParseParameter.ntflag == true) {
bw.write(ParseParameter.curtstr);
bw.newLine();
tflag = false;
}else{
bw.write(textLine);
}
bw.newLine();
tflag = false;
continue;
}
if(ParseParameter.curtstr.length() >= ParseParameter.tlength) {
if(ParseParameter.ntflag == true) {
bw.write(ParseParameter.curtstr);
} else {
bw.write(textLine);
@ -211,14 +217,16 @@ public class TargetFile {
} else if (textLine.indexOf("TOOL_CHAIN_CONF") != -1) {
if(cflag == true){
if(textLine.trim().charAt(0) == '#'){
if(ParseParameter.curcstr.length() >= ParseParameter.clength) {
if(ParseParameter.ncflag == true) {
bw.write(ParseParameter.curcstr);
bw.newLine();
cflag = false;
}else{
bw.write(textLine);
}
bw.newLine();
cflag = false;
continue;
}
if(ParseParameter.curcstr.length() >= ParseParameter.clength) {
if(ParseParameter.ncflag == true) {
bw.write(ParseParameter.curcstr);
} else {
bw.write(textLine);
@ -229,14 +237,16 @@ public class TargetFile {
} else if (textLine.indexOf("TOOL_CHAIN_TAG") != -1) {
if(nflag == true){
if(textLine.trim().charAt(0) == '#'){
if(ParseParameter.curnstr.length() >= ParseParameter.nlength) {
if(ParseParameter.nnflag == true) {
bw.write(ParseParameter.curnstr);
bw.newLine();
nflag = false;
}else{
bw.write(textLine);
}
bw.newLine();
nflag = false;
continue;
}
if(ParseParameter.curnstr.length() >= ParseParameter.nlength) {
if(ParseParameter.nnflag == true) {
bw.write(ParseParameter.curnstr);
} else {
bw.write(textLine);
@ -247,14 +257,16 @@ public class TargetFile {
} else if (textLine.indexOf("MAX_CONCURRENT_THREAD_NUMBER") != -1) {
if(mflag == true){
if(textLine.trim().charAt(0) == '#'){
if(ParseParameter.curmstr.length() >= ParseParameter.mlength) {
if(ParseParameter.nmflag == true) {
bw.write(ParseParameter.curmstr);
bw.newLine();
mflag = false;
}else{
bw.write(textLine);
}
bw.newLine();
mflag = false;
continue;
}
if(ParseParameter.curmstr.length() >= ParseParameter.mlength) {
if(ParseParameter.nmflag == true) {
bw.write(ParseParameter.curmstr);
} else {
bw.write(textLine);
@ -265,14 +277,16 @@ public class TargetFile {
}else if (textLine.indexOf("MULTIPLE_THREAD") != -1) {
if(meflag == true){
if(textLine.trim().charAt(0) == '#'){
if(ParseParameter.curmestr.length() >= ParseParameter.melength) {
if(ParseParameter.nmeflag == true) {
bw.write(ParseParameter.curmestr);
bw.newLine();
meflag = false;
}else{
bw.write(textLine);
}
bw.newLine();
meflag = false;
continue;
}
if(ParseParameter.curmestr.length() >= ParseParameter.melength) {
if(ParseParameter.nmeflag == true) {
bw.write(ParseParameter.curmestr);
} else {
bw.write(textLine);
@ -286,25 +300,25 @@ public class TargetFile {
//
//user maybe delete the line *ACTIVE_PLATFORM*=*
//
if( (pflag == true) && (ParseParameter.curpstr.length() >= ParseParameter.plength) ){
if( (pflag == true) && (ParseParameter.npflag == true) ){
bw.write(ParseParameter.curpstr);
bw.newLine();
} else if ( (tflag == true) && (ParseParameter.curtstr.length() >= ParseParameter.tlength) ){
} else if ( (tflag == true) && (ParseParameter.ntflag == true) ){
bw.write(ParseParameter.curtstr);
bw.newLine();
} else if ( (aflag == true) && (ParseParameter.curastr.length() >= ParseParameter.alength) ){
} else if ( (aflag == true) && (ParseParameter.naflag == true) ){
bw.write(ParseParameter.curastr);
bw.newLine();
} else if ( (cflag == true) && (ParseParameter.curcstr.length() >= ParseParameter.clength) ){
} else if ( (cflag == true) && (ParseParameter.ncflag == true) ){
bw.write(ParseParameter.curcstr);
bw.newLine();
} else if ( (nflag == true) && (ParseParameter.curnstr.length() >= ParseParameter.nlength) ){
} else if ( (nflag == true) && (ParseParameter.nnflag == true) ){
bw.write(ParseParameter.curnstr);
bw.newLine();
} else if ( (meflag == true) && (ParseParameter.curmestr.length() >= ParseParameter.melength) ){
} else if ( (meflag == true) && (ParseParameter.nmeflag == true) ){
bw.write(ParseParameter.curmestr);
bw.newLine();
} else if ( (mflag == true) && (ParseParameter.curmstr.length() >= ParseParameter.mlength) ){
} else if ( (mflag == true) && (ParseParameter.nmflag == true) ){
bw.write(ParseParameter.curmstr);
bw.newLine();
}