fix logfile.close(), trim \n

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1490 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
alfred 2006-09-07 07:19:39 +00:00
parent 02c768ee72
commit 99b0f0e6b2
4 changed files with 11 additions and 12 deletions

View File

@ -184,10 +184,6 @@ public final class Common {
Common.string2file(operation(Common.file2string(src)), des); Common.string2file(operation(Common.file2string(src)), des);
} }
public void run() {
}
public abstract String operation(String wholeline); public abstract String operation(String wholeline);
public abstract boolean recognize(String filename); public abstract boolean recognize(String filename);

View File

@ -63,7 +63,7 @@ public final class Critic {
templine.append(line + "\n"); templine.append(line + "\n");
} else if (line.matches("\\*\\*\\/")) { } else if (line.matches("\\*\\*\\/")) {
incomment = false; incomment = false;
templine.append(line + "\n"); templine.append("\n" + line + "\n");
} else if (incomment) { } else if (incomment) {
if (line.contains("Routine Description:")) { if (line.contains("Routine Description:")) {
description = true; description = true;
@ -73,10 +73,12 @@ public final class Critic {
description = false; description = false;
arguments = true; arguments = true;
returns = false; returns = false;
templine.append("\n");
} else if (line.contains("Returns:")) { } else if (line.contains("Returns:")) {
description = false; description = false;
arguments = false; arguments = false;
returns = true; returns = true;
templine.append("\n");
} else if (description) { } else if (description) {
if (line.trim().length() != 0) { if (line.trim().length() != 0) {
templine.append(" " + line.trim() + "\n"); templine.append(" " + line.trim() + "\n");
@ -88,11 +90,12 @@ public final class Critic {
templine.append(" @param " + mtrcommentequation.group(1) + " " + mtrcommentequation.group(2) + "\n"); templine.append(" @param " + mtrcommentequation.group(1) + " " + mtrcommentequation.group(2) + "\n");
} else if (inequation && line.trim().length() == 0) { } else if (inequation && line.trim().length() == 0) {
inequation = false; inequation = false;
templine.append(line + "\n");
} else if (inequation && line.trim().length() != 0) { } else if (inequation && line.trim().length() != 0) {
templine.append("#%#%" + line + "\n"); templine.append("#%#%" + line + "\n");
} else { } else {
templine.append(" " + line.trim() + "\n"); if (line.trim().length() != 0) {
templine.append(" " + line.trim() + "\n");
}
} }
} else if (returns) { } else if (returns) {
mtrcommentequation = ptncommentequation.matcher(line); mtrcommentequation = ptncommentequation.matcher(line);
@ -101,13 +104,10 @@ public final class Critic {
templine.append(" @retval " + mtrcommentequation.group(1) + " " + mtrcommentequation.group(2) + "\n"); templine.append(" @retval " + mtrcommentequation.group(1) + " " + mtrcommentequation.group(2) + "\n");
} else if (inequation && line.trim().length() == 0) { } else if (inequation && line.trim().length() == 0) {
inequation = false; inequation = false;
templine.append(line + "\n");
} else if (inequation && line.trim().length() != 0) { } else if (inequation && line.trim().length() != 0) {
templine.append("#%#%" + line + "\n"); templine.append("#%#%" + line + "\n");
} else { } else {
if (line.trim().length() == 0) { if (line.trim().length() != 0) {
templine.append(" " + line.trim() + "\n");
} else {
templine.append(" @return " + line.trim() + "\n"); templine.append(" @return " + line.trim() + "\n");
} }
} }

View File

@ -183,6 +183,7 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList
logfile = new PrintWriter(new BufferedWriter(new FileWriter(startpath.replaceAll(Common.strseparate, "$1") + File.separator + "migration.log"))); logfile = new PrintWriter(new BufferedWriter(new FileWriter(startpath.replaceAll(Common.strseparate, "$1") + File.separator + "migration.log")));
MigrationTool.startMigrateAll(startpath); MigrationTool.startMigrateAll(startpath);
logfile.flush(); logfile.flush();
logfile.close();
} catch (Exception en) { } catch (Exception en) {
println(en.getMessage()); println(en.getMessage());
} }

View File

@ -240,7 +240,8 @@ public final class SourceFileReplacer implements Common.ForDoAll {
} }
} }
//---------------------------------------inner classes---------------------------------------// //---------------------------------------inner classes---------------------------------------//
//-------------------------------------process functions-------------------------------------//
private static final String addincludefile(String wholeline, String hfile) { private static final String addincludefile(String wholeline, String hfile) {
return wholeline.replaceFirst("(\\*/\\s)", "$1\n#include " + hfile + "\n"); return wholeline.replaceFirst("(\\*/\\s)", "$1\n#include " + hfile + "\n");
} }
@ -315,6 +316,7 @@ public final class SourceFileReplacer implements Common.ForDoAll {
mi.localmodulesources.add("R8Lib.h"); mi.localmodulesources.add("R8Lib.h");
mi.localmodulesources.add("R8Lib.c"); mi.localmodulesources.add("R8Lib.c");
} }
//-------------------------------------process functions-------------------------------------//
//-----------------------------------ForDoAll-----------------------------------// //-----------------------------------ForDoAll-----------------------------------//
public void run(String filepath) throws Exception { public void run(String filepath) throws Exception {