convert \t to

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1596 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
alfred 2006-09-22 06:25:37 +00:00
parent 6ef5feb50e
commit 372a4642fc
3 changed files with 54 additions and 54 deletions

View File

@ -66,7 +66,7 @@ public final class Common {
} }
public static final void fileCopy(String src, String des) throws Exception { public static final void fileCopy(String src, String des) throws Exception {
string2file(file2string(src), des); string2file(file2string(src), des);
} }
//-----------------------------------file&string---------------------------------------// //-----------------------------------file&string---------------------------------------//
@ -127,14 +127,14 @@ public final class Common {
} }
public static final void oneLevelDirCopy(String src, String des, String type) throws Exception { public static final void oneLevelDirCopy(String src, String des, String type) throws Exception {
String[] list = new File(src).list(); String[] list = new File(src).list();
ensureDir(des); ensureDir(des);
for (int i = 0; i < list.length; i++) { for (int i = 0; i < list.length; i++) {
if (list[i].contains(type)) { if (list[i].contains(type)) {
string2file(file2string(src + File.separator + list[i]), des + File.separator + list[i]); string2file(file2string(src + File.separator + list[i]), des + File.separator + list[i]);
} }
} }
} }
//--------------------------------------dir--------------------------------------------// //--------------------------------------dir--------------------------------------------//

View File

@ -74,7 +74,7 @@ public class MigrationTool {
} }
public static final String getTempDir(String modulepath) { public static final String getTempDir(String modulepath) {
return "C:" + File.separator + "MigrationTool_Temp" + modulepath.replace(startpath, ""); return "C:" + File.separator + "MigrationTool_Temp" + modulepath.replace(startpath, "");
} }
private static final String assignOutPutPath(String inputpath) { private static final String assignOutPutPath(String inputpath) {
@ -92,7 +92,7 @@ public class MigrationTool {
} }
public static final void startMigrateAll(String path) throws Exception { public static final void startMigrateAll(String path) throws Exception {
startpath = path; startpath = path;
MigrationTool.ui.println("Project Migration"); MigrationTool.ui.println("Project Migration");
MigrationTool.ui.println("Copyright (c) 2006, Intel Corporation"); MigrationTool.ui.println("Copyright (c) 2006, Intel Corporation");

View File

@ -19,7 +19,7 @@ import java.util.regex.*;
import org.tianocore.*; import org.tianocore.*;
public final class ModuleReader implements Common.ForDoAll { public final class ModuleReader implements Common.ForDoAll {
private static final ModuleReader modulereader = new ModuleReader(); private static final ModuleReader modulereader = new ModuleReader();
private ModuleInfo mi; private ModuleInfo mi;
private final CommentLaplace commentlaplace = new CommentLaplace(); private final CommentLaplace commentlaplace = new CommentLaplace();
@ -113,7 +113,7 @@ public final class ModuleReader implements Common.ForDoAll {
if (mtrsection.group(1).contains("sources.")) { if (mtrsection.group(1).contains("sources.")) {
mtrfilename = ptnfilename.matcher(mtrsection.group(2)); mtrfilename = ptnfilename.matcher(mtrsection.group(2));
while (mtrfilename.find()) { while (mtrfilename.find()) {
mi.infsources.add(mtrfilename.group()); mi.infsources.add(mtrfilename.group());
if (!mi.localmodulesources.contains(mtrfilename.group())) { if (!mi.localmodulesources.contains(mtrfilename.group())) {
MigrationTool.ui.println("Warn: Source File Missing! : " + mtrfilename.group()); MigrationTool.ui.println("Warn: Source File Missing! : " + mtrfilename.group());
} }
@ -122,45 +122,45 @@ public final class ModuleReader implements Common.ForDoAll {
if (mtrsection.group(1).matches("includes.")) { if (mtrsection.group(1).matches("includes.")) {
mtrfilename = ptnfilename.matcher(mtrsection.group(2)); mtrfilename = ptnfilename.matcher(mtrsection.group(2));
while (mtrfilename.find()) { while (mtrfilename.find()) {
mi.infincludes.add(mtrfilename.group()); mi.infincludes.add(mtrfilename.group());
} }
} }
} }
} }
private final void preProcessModule() throws Exception { private final void preProcessModule() throws Exception {
// according to .inf file, add extraordinary includes and sourcefiles // according to .inf file, add extraordinary includes and sourcefiles
Common.dirCopy(mi.modulepath, mi.temppath); // collect all Laplace.namechange to here??? Common.dirCopy(mi.modulepath, mi.temppath); // collect all Laplace.namechange to here???
if (!mi.infincludes.isEmpty()) { if (!mi.infincludes.isEmpty()) {
Iterator<String> it = mi.infincludes.iterator(); Iterator<String> it = mi.infincludes.iterator();
String tempincludename = null; String tempincludename = null;
while (it.hasNext()) { while (it.hasNext()) {
tempincludename = it.next(); tempincludename = it.next();
if (tempincludename.contains("..")) { if (tempincludename.contains("..")) {
Matcher mtr = Common.PTNSEPARATER.matcher(tempincludename); Matcher mtr = Common.PTNSEPARATER.matcher(tempincludename);
if (mtr.find() && !mtr.group(2).matches(".")) { if (mtr.find() && !mtr.group(2).matches(".")) {
Common.oneLevelDirCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1") + File.separator + mtr.group(2), mi.temppath, ".h"); Common.oneLevelDirCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1") + File.separator + mtr.group(2), mi.temppath, ".h");
} else { } else {
Common.oneLevelDirCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1"), mi.temppath, ".h"); Common.oneLevelDirCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1"), mi.temppath, ".h");
} }
} }
} }
} }
if (!mi.infsources.isEmpty()) { if (!mi.infsources.isEmpty()) {
Iterator<String> it = mi.infsources.iterator(); Iterator<String> it = mi.infsources.iterator();
String tempsourcename = null; String tempsourcename = null;
while (it.hasNext()) { while (it.hasNext()) {
tempsourcename = it.next(); tempsourcename = it.next();
if (tempsourcename.contains("..")) { if (tempsourcename.contains("..")) {
Common.ensureDir(mi.temppath + File.separator + "MT_Parent_Sources"); Common.ensureDir(mi.temppath + File.separator + "MT_Parent_Sources");
Matcher mtr = Common.PTNSEPARATER.matcher(tempsourcename); Matcher mtr = Common.PTNSEPARATER.matcher(tempsourcename);
if (mtr.find()) { if (mtr.find()) {
Common.fileCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1") + File.separator + mtr.group(2), mi.temppath + File.separator + "MT_Parent_Sources" + File.separator + mtr.group(2)); Common.fileCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1") + File.separator + mtr.group(2), mi.temppath + File.separator + "MT_Parent_Sources" + File.separator + mtr.group(2));
} }
} }
} }
} }
//CommentOutNonLocalHFile(); //CommentOutNonLocalHFile();
Common.toDoAll(mi.temppath, this, Common.FILE); Common.toDoAll(mi.temppath, this, Common.FILE);
@ -268,38 +268,38 @@ public final class ModuleReader implements Common.ForDoAll {
public class CommentLaplace extends Common.Laplace { public class CommentLaplace extends Common.Laplace {
public String operation(String wholeline) { public String operation(String wholeline) {
StringBuffer wholebuffer = new StringBuffer(); StringBuffer wholebuffer = new StringBuffer();
String templine = null; String templine = null;
Pattern ptnincludefile = Pattern.compile("[\"<](.*[.]h)[\">]"); Pattern ptnincludefile = Pattern.compile("[\"<](.*[.]h)[\">]");
Pattern ptninclude = Pattern.compile("#include\\s*(.*)"); Pattern ptninclude = Pattern.compile("#include\\s*(.*)");
Matcher mtrinclude = ptninclude.matcher(wholeline); Matcher mtrinclude = ptninclude.matcher(wholeline);
Matcher mtrincludefile = null; Matcher mtrincludefile = null;
while (mtrinclude.find()) { while (mtrinclude.find()) {
mtrincludefile = ptnincludefile.matcher(mtrinclude.group(1)); mtrincludefile = ptnincludefile.matcher(mtrinclude.group(1));
if (mtrincludefile.find() && mi.localmodulesources.contains(mtrincludefile.group(1))) { if (mtrincludefile.find() && mi.localmodulesources.contains(mtrincludefile.group(1))) {
templine = mtrinclude.group(); templine = mtrinclude.group();
} else { } else {
templine = MigrationTool.MIGRATIONCOMMENT + mtrinclude.group(); templine = MigrationTool.MIGRATIONCOMMENT + mtrinclude.group();
} }
mtrinclude.appendReplacement(wholebuffer, templine); mtrinclude.appendReplacement(wholebuffer, templine);
} }
mtrinclude.appendTail(wholebuffer); mtrinclude.appendTail(wholebuffer);
return wholebuffer.toString(); return wholebuffer.toString();
} }
public boolean recognize(String filename) { public boolean recognize(String filename) {
return filename.contains(".c") || filename.contains(".h"); return filename.contains(".c") || filename.contains(".h");
} }
public String namechange(String oldname) { public String namechange(String oldname) {
return oldname; return oldname;
} }
} }
//-----------------------------------ForDoAll-----------------------------------// //-----------------------------------ForDoAll-----------------------------------//
public void run(String filepath) throws Exception { public void run(String filepath) throws Exception {
String name = mi.temppath + File.separator + filepath.replace(mi.temppath + File.separator, ""); String name = mi.temppath + File.separator + filepath.replace(mi.temppath + File.separator, "");
commentlaplace.transform(name, name); commentlaplace.transform(name, name);
} }
public boolean filter(File dir) { public boolean filter(File dir) {
@ -308,11 +308,11 @@ public final class ModuleReader implements Common.ForDoAll {
//-----------------------------------ForDoAll-----------------------------------// //-----------------------------------ForDoAll-----------------------------------//
public final void setModuleInfo(ModuleInfo m) { public final void setModuleInfo(ModuleInfo m) {
mi = m; mi = m;
} }
public static final void aimAt(ModuleInfo mi) throws Exception { public static final void aimAt(ModuleInfo mi) throws Exception {
modulereader.setModuleInfo(mi); modulereader.setModuleInfo(mi);
modulereader.ModuleScan(); modulereader.ModuleScan();
} }
} }