From 372a4642fc1bdaf185b0c3a1620f3733b331254c Mon Sep 17 00:00:00 2001 From: alfred Date: Fri, 22 Sep 2006 06:25:37 +0000 Subject: [PATCH] convert \t to git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1596 6f19259b-4bc3-4df7-8a09-765794883524 --- .../org/tianocore/migration/Common.java | 16 ++-- .../tianocore/migration/MigrationTool.java | 4 +- .../org/tianocore/migration/ModuleReader.java | 88 +++++++++---------- 3 files changed, 54 insertions(+), 54 deletions(-) diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/Common.java b/Tools/Source/MigrationTools/org/tianocore/migration/Common.java index 0ca7ca8cb3..b2265c0c5e 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/Common.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/Common.java @@ -66,7 +66,7 @@ public final class Common { } public static final void fileCopy(String src, String des) throws Exception { - string2file(file2string(src), des); + string2file(file2string(src), des); } //-----------------------------------file&string---------------------------------------// @@ -127,14 +127,14 @@ public final class Common { } public static final void oneLevelDirCopy(String src, String des, String type) throws Exception { - String[] list = new File(src).list(); - - ensureDir(des); - for (int i = 0; i < list.length; i++) { - if (list[i].contains(type)) { + String[] list = new File(src).list(); + + ensureDir(des); + for (int i = 0; i < list.length; i++) { + if (list[i].contains(type)) { string2file(file2string(src + File.separator + list[i]), des + File.separator + list[i]); - } - } + } + } } //--------------------------------------dir--------------------------------------------// diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java b/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java index 004950f96b..cb1e886009 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java @@ -74,7 +74,7 @@ public class MigrationTool { } 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) { @@ -92,7 +92,7 @@ public class MigrationTool { } public static final void startMigrateAll(String path) throws Exception { - startpath = path; + startpath = path; MigrationTool.ui.println("Project Migration"); MigrationTool.ui.println("Copyright (c) 2006, Intel Corporation"); diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/ModuleReader.java b/Tools/Source/MigrationTools/org/tianocore/migration/ModuleReader.java index 5467b3eff4..7880f2bd6c 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/ModuleReader.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/ModuleReader.java @@ -19,7 +19,7 @@ import java.util.regex.*; import org.tianocore.*; 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 final CommentLaplace commentlaplace = new CommentLaplace(); @@ -113,7 +113,7 @@ public final class ModuleReader implements Common.ForDoAll { if (mtrsection.group(1).contains("sources.")) { mtrfilename = ptnfilename.matcher(mtrsection.group(2)); while (mtrfilename.find()) { - mi.infsources.add(mtrfilename.group()); + mi.infsources.add(mtrfilename.group()); if (!mi.localmodulesources.contains(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.")) { mtrfilename = ptnfilename.matcher(mtrsection.group(2)); while (mtrfilename.find()) { - mi.infincludes.add(mtrfilename.group()); + mi.infincludes.add(mtrfilename.group()); } } } } private final void preProcessModule() throws Exception { - // according to .inf file, add extraordinary includes and sourcefiles - Common.dirCopy(mi.modulepath, mi.temppath); // collect all Laplace.namechange to here??? + // according to .inf file, add extraordinary includes and sourcefiles + Common.dirCopy(mi.modulepath, mi.temppath); // collect all Laplace.namechange to here??? - if (!mi.infincludes.isEmpty()) { + if (!mi.infincludes.isEmpty()) { Iterator it = mi.infincludes.iterator(); String tempincludename = null; - while (it.hasNext()) { - tempincludename = it.next(); - if (tempincludename.contains("..")) { - Matcher mtr = Common.PTNSEPARATER.matcher(tempincludename); - if (mtr.find() && !mtr.group(2).matches(".")) { - Common.oneLevelDirCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1") + File.separator + mtr.group(2), mi.temppath, ".h"); - } else { - Common.oneLevelDirCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1"), mi.temppath, ".h"); - } - } - } - } - if (!mi.infsources.isEmpty()) { + while (it.hasNext()) { + tempincludename = it.next(); + if (tempincludename.contains("..")) { + Matcher mtr = Common.PTNSEPARATER.matcher(tempincludename); + if (mtr.find() && !mtr.group(2).matches(".")) { + Common.oneLevelDirCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1") + File.separator + mtr.group(2), mi.temppath, ".h"); + } else { + Common.oneLevelDirCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1"), mi.temppath, ".h"); + } + } + } + } + if (!mi.infsources.isEmpty()) { Iterator it = mi.infsources.iterator(); String tempsourcename = null; while (it.hasNext()) { - tempsourcename = it.next(); - if (tempsourcename.contains("..")) { - Common.ensureDir(mi.temppath + File.separator + "MT_Parent_Sources"); - Matcher mtr = Common.PTNSEPARATER.matcher(tempsourcename); - 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)); - } - } + tempsourcename = it.next(); + if (tempsourcename.contains("..")) { + Common.ensureDir(mi.temppath + File.separator + "MT_Parent_Sources"); + Matcher mtr = Common.PTNSEPARATER.matcher(tempsourcename); + 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)); + } + } } - } + } //CommentOutNonLocalHFile(); 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 String operation(String wholeline) { - StringBuffer wholebuffer = new StringBuffer(); - String templine = null; + StringBuffer wholebuffer = new StringBuffer(); + String templine = null; Pattern ptnincludefile = Pattern.compile("[\"<](.*[.]h)[\">]"); Pattern ptninclude = Pattern.compile("#include\\s*(.*)"); Matcher mtrinclude = ptninclude.matcher(wholeline); Matcher mtrincludefile = null; while (mtrinclude.find()) { - mtrincludefile = ptnincludefile.matcher(mtrinclude.group(1)); - if (mtrincludefile.find() && mi.localmodulesources.contains(mtrincludefile.group(1))) { - templine = mtrinclude.group(); - } else { - templine = MigrationTool.MIGRATIONCOMMENT + mtrinclude.group(); - } - mtrinclude.appendReplacement(wholebuffer, templine); + mtrincludefile = ptnincludefile.matcher(mtrinclude.group(1)); + if (mtrincludefile.find() && mi.localmodulesources.contains(mtrincludefile.group(1))) { + templine = mtrinclude.group(); + } else { + templine = MigrationTool.MIGRATIONCOMMENT + mtrinclude.group(); + } + mtrinclude.appendReplacement(wholebuffer, templine); } mtrinclude.appendTail(wholebuffer); return wholebuffer.toString(); } public boolean recognize(String filename) { - return filename.contains(".c") || filename.contains(".h"); + return filename.contains(".c") || filename.contains(".h"); } public String namechange(String oldname) { - return oldname; + return oldname; } } //-----------------------------------ForDoAll-----------------------------------// public void run(String filepath) throws Exception { - String name = mi.temppath + File.separator + filepath.replace(mi.temppath + File.separator, ""); - commentlaplace.transform(name, name); + String name = mi.temppath + File.separator + filepath.replace(mi.temppath + File.separator, ""); + commentlaplace.transform(name, name); } public boolean filter(File dir) { @@ -308,11 +308,11 @@ public final class ModuleReader implements Common.ForDoAll { //-----------------------------------ForDoAll-----------------------------------// public final void setModuleInfo(ModuleInfo m) { - mi = m; + mi = m; } public static final void aimAt(ModuleInfo mi) throws Exception { - modulereader.setModuleInfo(mi); - modulereader.ModuleScan(); + modulereader.setModuleInfo(mi); + modulereader.ModuleScan(); } }