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);
}
public void run() {
}
public abstract String operation(String wholeline);
public abstract boolean recognize(String filename);

View File

@ -63,7 +63,7 @@ public final class Critic {
templine.append(line + "\n");
} else if (line.matches("\\*\\*\\/")) {
incomment = false;
templine.append(line + "\n");
templine.append("\n" + line + "\n");
} else if (incomment) {
if (line.contains("Routine Description:")) {
description = true;
@ -73,10 +73,12 @@ public final class Critic {
description = false;
arguments = true;
returns = false;
templine.append("\n");
} else if (line.contains("Returns:")) {
description = false;
arguments = false;
returns = true;
templine.append("\n");
} else if (description) {
if (line.trim().length() != 0) {
templine.append(" " + line.trim() + "\n");
@ -88,11 +90,12 @@ public final class Critic {
templine.append(" @param " + mtrcommentequation.group(1) + " " + mtrcommentequation.group(2) + "\n");
} else if (inequation && line.trim().length() == 0) {
inequation = false;
templine.append(line + "\n");
} else if (inequation && line.trim().length() != 0) {
templine.append("#%#%" + line + "\n");
} else {
templine.append(" " + line.trim() + "\n");
if (line.trim().length() != 0) {
templine.append(" " + line.trim() + "\n");
}
}
} else if (returns) {
mtrcommentequation = ptncommentequation.matcher(line);
@ -101,13 +104,10 @@ public final class Critic {
templine.append(" @retval " + mtrcommentequation.group(1) + " " + mtrcommentequation.group(2) + "\n");
} else if (inequation && line.trim().length() == 0) {
inequation = false;
templine.append(line + "\n");
} else if (inequation && line.trim().length() != 0) {
templine.append("#%#%" + line + "\n");
} else {
if (line.trim().length() == 0) {
templine.append(" " + line.trim() + "\n");
} else {
if (line.trim().length() != 0) {
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")));
MigrationTool.startMigrateAll(startpath);
logfile.flush();
logfile.close();
} catch (Exception en) {
println(en.getMessage());
}

View File

@ -240,7 +240,8 @@ public final class SourceFileReplacer implements Common.ForDoAll {
}
}
//---------------------------------------inner classes---------------------------------------//
//-------------------------------------process functions-------------------------------------//
private static final String addincludefile(String wholeline, String hfile) {
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.c");
}
//-------------------------------------process functions-------------------------------------//
//-----------------------------------ForDoAll-----------------------------------//
public void run(String filepath) throws Exception {