]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Laplace take over SourceFileReplacer.java
authoralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 6 Sep 2006 04:39:31 +0000 (04:39 +0000)
committeralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 6 Sep 2006 04:39:31 +0000 (04:39 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1472 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/MigrationTools/org/tianocore/migration/Common.java
Tools/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java

index 6b1208c7c6ad59ae7602b91a1d85b901616c781a..a7154b6129a6cc406222256c0fc90aaa35193529 100644 (file)
@@ -178,10 +178,18 @@ public final class Common {
        }\r
        \r
        public static abstract class Laplace {\r
-               public final void transform(String src, String des) throws Exception {\r
+               public void transform(String src, String des) throws Exception {\r
                        Common.string2file(operation(Common.file2string(src)), des);\r
                }\r
                \r
+               public void run() {\r
+                       \r
+               }\r
+               \r
                public abstract String operation(String wholeline);\r
+               \r
+               public abstract boolean recognize(String filename);\r
+               \r
+               public abstract String namechange(String oldname);\r
        }\r
 }\r
index 361036251eaeb38e5ac4401c6156d4c0756a9a66..5fb102091c2ca13c630eb435215ef872c077d9c5 100644 (file)
@@ -20,8 +20,17 @@ import java.util.regex.Pattern;
 public final class SourceFileReplacer implements Common.ForDoAll {\r
        private static final SourceFileReplacer SFReplacer = new SourceFileReplacer();\r
        private ModuleInfo mi;\r
-       //private static boolean showdetails = true;            // set this as default now, may be changed in the future\r
+       private static final Set<Common.Laplace> Laplaces = new HashSet<Common.Laplace>();\r
+\r
+       // these sets are used only for printing log of the changes in current file\r
+       private static final Set<r8tor9> filefunc = new HashSet<r8tor9>();\r
+       private static final Set<r8tor9> filemacro = new HashSet<r8tor9>();\r
+       private static final Set<r8tor9> fileguid = new HashSet<r8tor9>();\r
+       private static final Set<r8tor9> fileppi = new HashSet<r8tor9>();\r
+       private static final Set<r8tor9> fileprotocol = new HashSet<r8tor9>();\r
+       private static final Set<String> filer8only = new HashSet<String>();\r
        \r
+       //---------------------------------------inner classes---------------------------------------//\r
        private static class r8tor9 {\r
                r8tor9(String r8, String r9) {\r
                        r8thing = r8;\r
@@ -31,178 +40,211 @@ public final class SourceFileReplacer implements Common.ForDoAll {
                public String r9thing;\r
        }\r
        \r
-       // these sets are used only for printing log of the changes in current file\r
-       private static final Set<r8tor9> filefunc = new HashSet<r8tor9>();\r
-       private static final Set<r8tor9> filemacro = new HashSet<r8tor9>();\r
-       private static final Set<r8tor9> fileguid = new HashSet<r8tor9>();\r
-       private static final Set<r8tor9> fileppi = new HashSet<r8tor9>();\r
-       private static final Set<r8tor9> fileprotocol = new HashSet<r8tor9>();\r
-       private static final Set<String> filer8only = new HashSet<String>();\r
-       \r
-       // Caution : if there is @ in file , it will be replaced with \n , so is you use Doxygen ... God Bless you!\r
-       private final String sourcefilereplace(String wholeline) throws Exception {\r
-               boolean addr8 = false;\r
-\r
-               Pattern pat = Pattern.compile("g?(BS|RT)(\\s*->\\s*)([a-zA-Z_]\\w*)", Pattern.MULTILINE);                                       // ! only two level () bracket allowed !\r
-               //Pattern ptnpei = Pattern.compile("\\(\\*\\*?PeiServices\\)[.-][>]?\\s*(\\w*[#$]*)(\\s*\\(([^\\(\\)]*(\\([^\\(\\)]*\\))?[^\\(\\)]*)*\\))", Pattern.MULTILINE);\r
-\r
-               // replace BS -> gBS , RT -> gRT\r
-               Matcher mat = pat.matcher(wholeline);\r
-               if (mat.find()) {                                                                                               // add a library here\r
-                       MigrationTool.ui.println("Converting all BS->gBS, RT->gRT");\r
-                       wholeline = mat.replaceAll("g$1$2$3");                                                  //unknown correctiveness\r
+       private class IdleLaplace extends Common.Laplace {\r
+               public String operation(String wholeline) {\r
+                       return wholeline;\r
+               }\r
+               \r
+               public boolean recognize(String filename) {\r
+                       return filename.contains(".h") || filename.contains(".H") || filename.contains(".uni");\r
                }\r
-               mat.reset();\r
-               while (mat.find()) {\r
-                       if (mat.group(1).matches("BS")) {\r
-                               mi.hashrequiredr9libs.add("UefiBootServicesTableLib");\r
+\r
+               public String namechange(String oldname) {\r
+                       if (oldname.contains(".H")) {\r
+                               return oldname.replaceFirst(".H", ".h");\r
+                       } else {\r
+                               return oldname;\r
                        }\r
-                       if (mat.group(1).matches("RT")) {\r
-                               mi.hashrequiredr9libs.add("UefiRuntimeServicesTableLib");\r
+               }\r
+       }\r
+       private class DxsLaplace extends Common.Laplace {\r
+               public String operation(String wholeline) {\r
+                       if (mi.getModuleType().equals("PEIM")) {\r
+                               return addincludefile(wholeline, "\\<PeimDepex.h\\>");\r
+                       } else {\r
+                               return addincludefile(wholeline, "\\<DxeDepex.h\\>");\r
                        }\r
                }\r
-               // remove EFI_DRIVER_ENTRY_POINT\r
-               wholeline = wholeline.replaceAll("(EFI_\\w+_ENTRY_POINT)", MigrationTool.MIGRATIONCOMMENT + " $1");\r
                \r
-               // start replacing names\r
-               String r8thing;\r
-               String r9thing;\r
-               Iterator<String> it;\r
-               // Converting non-locla function\r
-               it = mi.hashnonlocalfunc.iterator();\r
-               while (it.hasNext()) {\r
-                       r8thing = it.next();\r
-                       if (r8thing.matches("EfiInitializeDriverLib")) {                                        //s\r
-                               mi.hashrequiredr9libs.add("UefiBootServicesTableLib");                  //p\r
-                               mi.hashrequiredr9libs.add("UefiRuntimeServicesTableLib");               //e\r
-                       } else if (r8thing.matches("DxeInitializeDriverLib")) {                         //c\r
-                               mi.hashrequiredr9libs.add("UefiBootServicesTableLib");                  //i\r
-                               mi.hashrequiredr9libs.add("UefiRuntimeServicesTableLib");               //a\r
-                               mi.hashrequiredr9libs.add("DxeServicesTableLib");                               //l\r
-                       } else {                                                                                                                        //\r
-                               mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing));                          // add a library here\r
+               public boolean recognize(String filename) {\r
+                       return filename.contains(".dxs");\r
+               }\r
+\r
+               public String namechange(String oldname) {\r
+                       return oldname;\r
+               }\r
+       }\r
+       \r
+       private class CLaplace extends Common.Laplace {\r
+               public  String operation(String wholeline) {\r
+                       boolean addr8 = false;\r
+\r
+                       Pattern pat = Pattern.compile("g?(BS|RT)(\\s*->\\s*)([a-zA-Z_]\\w*)", Pattern.MULTILINE);                                       // ! only two level () bracket allowed !\r
+                       //Pattern ptnpei = Pattern.compile("\\(\\*\\*?PeiServices\\)[.-][>]?\\s*(\\w*[#$]*)(\\s*\\(([^\\(\\)]*(\\([^\\(\\)]*\\))?[^\\(\\)]*)*\\))", Pattern.MULTILINE);\r
+\r
+                       // replace BS -> gBS , RT -> gRT\r
+                       Matcher mat = pat.matcher(wholeline);\r
+                       if (mat.find()) {                                                                                               // add a library here\r
+                               MigrationTool.ui.println("Converting all BS->gBS, RT->gRT");\r
+                               wholeline = mat.replaceAll("g$1$2$3");                                                  //unknown correctiveness\r
+                       }\r
+                       mat.reset();\r
+                       while (mat.find()) {\r
+                               if (mat.group(1).matches("BS")) {\r
+                                       mi.hashrequiredr9libs.add("UefiBootServicesTableLib");\r
+                               }\r
+                               if (mat.group(1).matches("RT")) {\r
+                                       mi.hashrequiredr9libs.add("UefiRuntimeServicesTableLib");\r
+                               }\r
                        }\r
+                       // remove EFI_DRIVER_ENTRY_POINT\r
+                       wholeline = wholeline.replaceAll("(EFI_\\w+_ENTRY_POINT)", MigrationTool.MIGRATIONCOMMENT + " $1");\r
+                       \r
+                       // start replacing names\r
+                       String r8thing;\r
+                       String r9thing;\r
+                       Iterator<String> it;\r
+                       // Converting non-locla function\r
+                       it = mi.hashnonlocalfunc.iterator();\r
+                       while (it.hasNext()) {\r
+                               r8thing = it.next();\r
+                               if (r8thing.matches("EfiInitializeDriverLib")) {                                        //s\r
+                                       mi.hashrequiredr9libs.add("UefiBootServicesTableLib");                  //p\r
+                                       mi.hashrequiredr9libs.add("UefiRuntimeServicesTableLib");               //e\r
+                               } else if (r8thing.matches("DxeInitializeDriverLib")) {                         //c\r
+                                       mi.hashrequiredr9libs.add("UefiBootServicesTableLib");                  //i\r
+                                       mi.hashrequiredr9libs.add("UefiRuntimeServicesTableLib");               //a\r
+                                       mi.hashrequiredr9libs.add("DxeServicesTableLib");                               //l\r
+                               } else {                                                                                                                        //\r
+                                       mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing));                          // add a library here\r
+                               }\r
 \r
-                       r8tor9 temp;\r
-                       if ((r9thing = MigrationTool.db.getR9Func(r8thing)) != null) {\r
-                               if (!r8thing.equals(r9thing)) {\r
-                                       if (wholeline.contains(r8thing)) {\r
-                                               wholeline = wholeline.replaceAll(r8thing, r9thing);\r
-                                               filefunc.add(new r8tor9(r8thing, r9thing));\r
-                                               Iterator<r8tor9> rt = filefunc.iterator();\r
-                                               while (rt.hasNext()) {\r
-                                                       temp = rt.next();\r
-                                                       if (MigrationTool.db.r8only.contains(temp.r8thing)) {\r
-                                                               filer8only.add(r8thing);\r
-                                                               mi.hashr8only.add(r8thing);\r
-                                                               addr8 = true;\r
+                               r8tor9 temp;\r
+                               if ((r9thing = MigrationTool.db.getR9Func(r8thing)) != null) {\r
+                                       if (!r8thing.equals(r9thing)) {\r
+                                               if (wholeline.contains(r8thing)) {\r
+                                                       wholeline = wholeline.replaceAll(r8thing, r9thing);\r
+                                                       filefunc.add(new r8tor9(r8thing, r9thing));\r
+                                                       Iterator<r8tor9> rt = filefunc.iterator();\r
+                                                       while (rt.hasNext()) {\r
+                                                               temp = rt.next();\r
+                                                               if (MigrationTool.db.r8only.contains(temp.r8thing)) {\r
+                                                                       filer8only.add(r8thing);\r
+                                                                       mi.hashr8only.add(r8thing);\r
+                                                                       addr8 = true;\r
+                                                               }\r
                                                        }\r
                                                }\r
                                        }\r
                                }\r
+                       }                                                                                                                       //is any of the guids changed?\r
+                       if (addr8 == true) {\r
+                               wholeline = addincludefile(wholeline, "\"R8Lib.h\"");\r
                        }\r
-               }                                                                                                                       //is any of the guids changed?\r
-               if (addr8 == true) {\r
-                       wholeline = addincludefile(wholeline, "\"R8Lib.h\"");\r
-               }\r
-               \r
-               // Converting macro\r
-               it = mi.hashnonlocalmacro.iterator();\r
-               while (it.hasNext()) {                                          //macros are all assumed MdePkg currently\r
-                       r8thing = it.next();\r
-                       //mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing));                \r
-                       if ((r9thing = MigrationTool.db.getR9Macro(r8thing)) != null) {\r
-                               if (wholeline.contains(r8thing)) {\r
-                                       wholeline = wholeline.replaceAll(r8thing, r9thing);\r
-                                       filemacro.add(new r8tor9(r8thing, r9thing));\r
+                       \r
+                       // Converting macro\r
+                       it = mi.hashnonlocalmacro.iterator();\r
+                       while (it.hasNext()) {                                          //macros are all assumed MdePkg currently\r
+                               r8thing = it.next();\r
+                               //mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing));                \r
+                               if ((r9thing = MigrationTool.db.getR9Macro(r8thing)) != null) {\r
+                                       if (wholeline.contains(r8thing)) {\r
+                                               wholeline = wholeline.replaceAll(r8thing, r9thing);\r
+                                               filemacro.add(new r8tor9(r8thing, r9thing));\r
+                                       }\r
                                }\r
                        }\r
-               }\r
 \r
-               // Converting guid\r
-               replaceGuid(wholeline, mi.guid, "guid", fileguid);\r
-               replaceGuid(wholeline, mi.ppi, "ppi", fileppi);\r
-               replaceGuid(wholeline, mi.protocol, "protocol", fileprotocol);\r
+                       // Converting guid\r
+                       replaceGuid(wholeline, mi.guid, "guid", fileguid);\r
+                       replaceGuid(wholeline, mi.ppi, "ppi", fileppi);\r
+                       replaceGuid(wholeline, mi.protocol, "protocol", fileprotocol);\r
+\r
+                       // Converting Pei\r
+                       // First , find all (**PeiServices)-> or (*PeiServices). with arg "PeiServices" , change name and add #%\r
+                       Pattern ptnpei = Pattern.compile("\\(\\*\\*?PeiServices\\)[.-][>]?\\s*(\\w*)(\\s*\\(\\s*PeiServices\\s*,\\s*)", Pattern.MULTILINE);\r
+                       if (mi.moduletype.contains("PEIM")) {\r
+                               Matcher mtrpei = ptnpei.matcher(wholeline);\r
+                               while (mtrpei.find()) {                                                                         // ! add a library here !\r
+                                       wholeline = mtrpei.replaceAll("PeiServices$1#%$2");\r
+                                       mi.hashrequiredr9libs.add("PeiServicesLib");\r
+                               }\r
+                               mtrpei.reset();\r
+                               if (wholeline.contains("PeiServicesCopyMem")) {\r
+                                       wholeline = wholeline.replaceAll("PeiServicesCopyMem#%", "CopyMem");\r
+                                       mi.hashrequiredr9libs.add("BaseMemoryLib");\r
+                               }\r
+                               if (wholeline.contains("PeiServicesSetMem")) {\r
+                                       wholeline = wholeline.replaceAll("PeiServicesSetMem#%", "SetMem");\r
+                                       mi.hashrequiredr9libs.add("BaseMemoryLib");\r
+                               }\r
 \r
-               // Converting Pei\r
-               // First , find all (**PeiServices)-> or (*PeiServices). with arg "PeiServices" , change name and add #%\r
-               Pattern ptnpei = Pattern.compile("\\(\\*\\*?PeiServices\\)[.-][>]?\\s*(\\w*)(\\s*\\(\\s*PeiServices\\s*,\\s*)", Pattern.MULTILINE);\r
-               if (mi.moduletype.contains("PEIM")) {\r
-                       Matcher mtrpei = ptnpei.matcher(wholeline);\r
-                       while (mtrpei.find()) {                                                                         // ! add a library here !\r
-                               wholeline = mtrpei.replaceAll("PeiServices$1#%$2");\r
-                               mi.hashrequiredr9libs.add("PeiServicesLib");\r
+                               // Second , find all #% to drop the arg "PeiServices"\r
+                               Pattern ptnpeiarg = Pattern.compile("#%+(\\s*\\(+\\s*)PeiServices\\s*,\\s*", Pattern.MULTILINE);\r
+                               Matcher mtrpeiarg = ptnpeiarg.matcher(wholeline);\r
+                               while (mtrpeiarg.find()) {\r
+                                       wholeline = mtrpeiarg.replaceAll("$1");\r
+                               }\r
+                       }\r
+                       \r
+                       Matcher mtrmac;\r
+                       mtrmac = Pattern.compile("EFI_IDIV_ROUND\\((.*), (.*)\\)").matcher(wholeline);\r
+                       if (mtrmac.find()) {\r
+                               wholeline = mtrmac.replaceAll("\\($1 \\/ $2 \\+ \\(\\(\\(2 \\* \\($1 \\% $2\\)\\) \\< $2\\) \\? 0 \\: 1\\)\\)");\r
+                       }\r
+                       mtrmac = Pattern.compile("EFI_MIN\\((.*), (.*)\\)").matcher(wholeline);\r
+                       if (mtrmac.find()) {\r
+                               wholeline = mtrmac.replaceAll("\\(\\($1 \\< $2\\) \\? $1 \\: $2\\)");\r
+                       }\r
+                       mtrmac = Pattern.compile("EFI_MAX\\((.*), (.*)\\)").matcher(wholeline);\r
+                       if (mtrmac.find()) {\r
+                               wholeline = mtrmac.replaceAll("\\(\\($1 \\> $2\\) \\? $1 \\: $2\\)");\r
                        }\r
-                       mtrpei.reset();\r
-                       if (wholeline.contains("PeiServicesCopyMem")) {\r
-                               wholeline = wholeline.replaceAll("PeiServicesCopyMem#%", "CopyMem");\r
-                               mi.hashrequiredr9libs.add("BaseMemoryLib");\r
+                       mtrmac = Pattern.compile("EFI_UINTN_ALIGNED\\((.*)\\)").matcher(wholeline);\r
+                       if (mtrmac.find()) {\r
+                               wholeline = mtrmac.replaceAll("\\(\\(\\(UINTN\\) $1\\) \\& \\(sizeof \\(UINTN\\) \\- 1\\)\\)");\r
                        }\r
-                       if (wholeline.contains("PeiServicesSetMem")) {\r
-                               wholeline = wholeline.replaceAll("PeiServicesSetMem#%", "SetMem");\r
-                               mi.hashrequiredr9libs.add("BaseMemoryLib");\r
+                       if (wholeline.contains("EFI_UINTN_ALIGN_MASK")) {\r
+                               wholeline = wholeline.replaceAll("EFI_UINTN_ALIGN_MASK", "(sizeof (UINTN) - 1)");\r
                        }\r
 \r
-                       // Second , find all #% to drop the arg "PeiServices"\r
-                       Pattern ptnpeiarg = Pattern.compile("#%+(\\s*\\(+\\s*)PeiServices\\s*,\\s*", Pattern.MULTILINE);\r
-                       Matcher mtrpeiarg = ptnpeiarg.matcher(wholeline);\r
-                       while (mtrpeiarg.find()) {\r
-                               wholeline = mtrpeiarg.replaceAll("$1");\r
+                       show(filefunc, "function");\r
+                       show(filemacro, "macro");\r
+                       show(fileguid, "guid");\r
+                       show(fileppi, "ppi");\r
+                       show(fileprotocol, "protocol");\r
+                       if (!filer8only.isEmpty()) {\r
+                               MigrationTool.ui.println("Converting r8only : " + filer8only);\r
                        }\r
+\r
+                       filefunc.clear();\r
+                       filemacro.clear();\r
+                       fileguid.clear();\r
+                       fileppi.clear();\r
+                       fileprotocol.clear();\r
+                       filer8only.clear();\r
+\r
+                       return wholeline;\r
                }\r
                \r
-               Matcher mtrmac;\r
-               mtrmac = Pattern.compile("EFI_IDIV_ROUND\\((.*), (.*)\\)").matcher(wholeline);\r
-               if (mtrmac.find()) {\r
-                       wholeline = mtrmac.replaceAll("\\($1 \\/ $2 \\+ \\(\\(\\(2 \\* \\($1 \\% $2\\)\\) \\< $2\\) \\? 0 \\: 1\\)\\)");\r
-               }\r
-               mtrmac = Pattern.compile("EFI_MIN\\((.*), (.*)\\)").matcher(wholeline);\r
-               if (mtrmac.find()) {\r
-                       wholeline = mtrmac.replaceAll("\\(\\($1 \\< $2\\) \\? $1 \\: $2\\)");\r
-               }\r
-               mtrmac = Pattern.compile("EFI_MAX\\((.*), (.*)\\)").matcher(wholeline);\r
-               if (mtrmac.find()) {\r
-                       wholeline = mtrmac.replaceAll("\\(\\($1 \\> $2\\) \\? $1 \\: $2\\)");\r
-               }\r
-               mtrmac = Pattern.compile("EFI_UINTN_ALIGNED\\((.*)\\)").matcher(wholeline);\r
-               if (mtrmac.find()) {\r
-                       wholeline = mtrmac.replaceAll("\\(\\(\\(UINTN\\) $1\\) \\& \\(sizeof \\(UINTN\\) \\- 1\\)\\)");\r
-               }\r
-               if (wholeline.contains("EFI_UINTN_ALIGN_MASK")) {\r
-                       wholeline = wholeline.replaceAll("EFI_UINTN_ALIGN_MASK", "(sizeof (UINTN) - 1)");\r
+               public boolean recognize(String filename) {\r
+                       return filename.contains(".c") || filename.contains(".C");\r
                }\r
 \r
-               show(filefunc, "function");\r
-               show(filemacro, "macro");\r
-               show(fileguid, "guid");\r
-               show(fileppi, "ppi");\r
-               show(fileprotocol, "protocol");\r
-               if (!filer8only.isEmpty()) {\r
-                       MigrationTool.ui.println("Converting r8only : " + filer8only);\r
+               public String namechange(String oldname) {\r
+                       if (oldname.contains(".C")) {\r
+                               return oldname.replaceFirst(".C", ".c");\r
+                       } else {\r
+                               return oldname;\r
+                       }\r
                }\r
-\r
-               filefunc.clear();\r
-               filemacro.clear();\r
-               fileguid.clear();\r
-               fileppi.clear();\r
-               fileprotocol.clear();\r
-               filer8only.clear();\r
-\r
-               return wholeline;\r
        }\r
-\r
+       //---------------------------------------inner classes---------------------------------------//\r
+       \r
        private static final String addincludefile(String wholeline, String hfile) {\r
                return wholeline.replaceFirst("(\\*/\\s)", "$1\n#include " + hfile + "\n");\r
        }\r
        \r
-       private final String convertdxs(String wholeline) {\r
-               if (mi.getModuleType().equals("PEIM")) {\r
-                       return addincludefile(wholeline, "\\<PeimDepex.h\\>");\r
-               } else {\r
-                       return addincludefile(wholeline, "\\<DxeDepex.h\\>");\r
-               }\r
-       }\r
-\r
        private static final void show(Set<r8tor9> hash, String sh) {\r
                Iterator<r8tor9> it = hash.iterator();\r
                r8tor9 temp;\r
@@ -267,31 +309,17 @@ public final class SourceFileReplacer implements Common.ForDoAll {
        \r
        //-----------------------------------ForDoAll-----------------------------------//\r
        public void run(String filepath) throws Exception {\r
-               String outname = null;\r
                String inname = filepath.replace(mi.modulepath + File.separator, "");\r
                String tempinpath = mi.modulepath + File.separator + "temp" + File.separator;\r
                String tempoutpath = MigrationTool.ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename + File.separator;\r
 \r
-               if (inname.contains(".c") || inname.contains(".C")) {\r
-                       if (inname.contains(".C")) {\r
-                               outname = inname.replaceFirst(".C", ".c");\r
-                       } else {\r
-                               outname = inname;\r
-                       }\r
-                       MigrationTool.ui.println("\nModifying file: " + inname);\r
-                       Common.string2file(sourcefilereplace(Common.file2string(tempinpath + inname)), tempoutpath + outname);\r
-               } else if (inname.contains(".h") || inname.contains(".H") || inname.contains(".uni")) {\r
-                       if (inname.contains(".H")) {\r
-                               outname = inname.replaceFirst(".H", ".h");\r
-                       } else {\r
-                               outname = inname;\r
+               Iterator<Common.Laplace> itLaplace = Laplaces.iterator();\r
+               while (itLaplace.hasNext()) {\r
+                       Common.Laplace lap = itLaplace.next();\r
+                       if (lap.recognize(inname)) {\r
+                               MigrationTool.ui.println("\nHandling file: " + inname);\r
+                               lap.transform(tempinpath + inname, tempoutpath + lap.namechange(inname));\r
                        }\r
-                       MigrationTool.ui.println("\nCopying file: " + inname);\r
-                       Common.string2file(Common.file2string(tempinpath + inname), tempoutpath + outname);\r
-               } else if (inname.contains(".dxs")) {\r
-                       outname = inname;\r
-                       MigrationTool.ui.println("\nModifying file: " + inname);\r
-                       Common.string2file(convertdxs(Common.file2string(tempinpath + inname)), tempoutpath + outname);\r
                }\r
        }\r
        \r
@@ -305,11 +333,17 @@ public final class SourceFileReplacer implements Common.ForDoAll {
        }\r
        \r
        private final void start() throws Exception {\r
+               Laplaces.add(new DxsLaplace());\r
+               Laplaces.add(new CLaplace());\r
+               Laplaces.add(new IdleLaplace());\r
+               \r
                Common.toDoAll(mi.localmodulesources, this);\r
                \r
                if (!mi.hashr8only.isEmpty()) {\r
                        addr8only();\r
                }\r
+               \r
+               Laplaces.clear();\r
        }\r
        \r
        public static final void fireAt(ModuleInfo moduleinfo) throws Exception {\r