functions in moduleinfo 2 migrationtool
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1356 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
		@@ -28,8 +28,6 @@ public class ModuleInfo {
 | 
				
			|||||||
			outputpath = modulepath; 
 | 
								outputpath = modulepath; 
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		ModuleInfo.ui.println(outputpath);
 | 
							ModuleInfo.ui.println(outputpath);
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		mainFlow();
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public String modulepath = null;
 | 
						public String modulepath = null;
 | 
				
			||||||
@@ -56,47 +54,7 @@ public class ModuleInfo {
 | 
				
			|||||||
	public Set<String> guid = new HashSet<String>();
 | 
						public Set<String> guid = new HashSet<String>();
 | 
				
			||||||
	public Set<String> protocol = new HashSet<String>();
 | 
						public Set<String> protocol = new HashSet<String>();
 | 
				
			||||||
	public Set<String> ppi = new HashSet<String>();
 | 
						public Set<String> ppi = new HashSet<String>();
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	private void mainFlow() throws Exception {
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		ModuleReader.ModuleScan(this);
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		SourceFileReplacer.flush(this);	// some adding library actions are taken here,so it must be put before "MsaWriter"
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		// show result
 | 
					 | 
				
			||||||
		if (ModuleInfo.printModuleInfo) {
 | 
					 | 
				
			||||||
			ModuleInfo.ui.println("\nModule Information : ");
 | 
					 | 
				
			||||||
			ModuleInfo.ui.println("Entrypoint : " + entrypoint);
 | 
					 | 
				
			||||||
			show(protocol, "Protocol : ");
 | 
					 | 
				
			||||||
			show(ppi, "Ppi : ");
 | 
					 | 
				
			||||||
			show(guid, "Guid : ");
 | 
					 | 
				
			||||||
			show(hashfuncc, "call : ");
 | 
					 | 
				
			||||||
			show(hashfuncd, "def : ");
 | 
					 | 
				
			||||||
			show(hashEFIcall, "EFIcall : ");
 | 
					 | 
				
			||||||
			show(hashnonlocalmacro, "macro : ");
 | 
					 | 
				
			||||||
			show(hashnonlocalfunc, "nonlocal : ");
 | 
					 | 
				
			||||||
			show(hashr8only, "hashr8only : ");
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		new MsaWriter(this).flush();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (ModuleInfo.doCritic) {
 | 
					 | 
				
			||||||
    		Critic.fireAt(outputpath + File.separator + "Migration_" + modulename);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		Common.deleteDir(modulepath + File.separator + "temp");
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		ModuleInfo.ui.println("Errors Left : " + ModuleInfo.db.error);
 | 
					 | 
				
			||||||
		ModuleInfo.ui.println("Complete!");
 | 
					 | 
				
			||||||
		ModuleInfo.ui.println("Your R9 module was placed here: " + modulepath + File.separator + "result");
 | 
					 | 
				
			||||||
		ModuleInfo.ui.println("Your logfile was placed here: " + modulepath);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	private void show(Set<String> hash, String show) {
 | 
					 | 
				
			||||||
		ModuleInfo.ui.println(show + hash.size());
 | 
					 | 
				
			||||||
		ModuleInfo.ui.println(hash);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public final void enroll(String filepath) throws Exception {
 | 
						public final void enroll(String filepath) throws Exception {
 | 
				
			||||||
		String[] temp;
 | 
							String[] temp;
 | 
				
			||||||
		if (filepath.contains(".c") || filepath.contains(".C") || filepath.contains(".h") || 
 | 
							if (filepath.contains(".c") || filepath.contains(".C") || filepath.contains(".h") || 
 | 
				
			||||||
@@ -109,12 +67,6 @@ public class ModuleInfo {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public static final void seekModule(String filepath) throws Exception {
 | 
					 | 
				
			||||||
		if (isModule(filepath)) {
 | 
					 | 
				
			||||||
			new ModuleInfo(filepath);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private static final boolean isModule(String path) {
 | 
						private static final boolean isModule(String path) {
 | 
				
			||||||
		String[] list = new File(path).list();
 | 
							String[] list = new File(path).list();
 | 
				
			||||||
		for (int i = 0 ; i < list.length ; i++) {
 | 
							for (int i = 0 ; i < list.length ; i++) {
 | 
				
			||||||
@@ -127,14 +79,60 @@ public class ModuleInfo {
 | 
				
			|||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						//---------------------------------------------------------------------------//
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						private static final void manipulate(ModuleInfo mi) throws Exception {
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							ModuleReader.ModuleScan(mi);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							SourceFileReplacer.flush(mi);	// some adding library actions are taken here,so it must be put before "MsaWriter"
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							// show result
 | 
				
			||||||
 | 
							if (ModuleInfo.printModuleInfo) {
 | 
				
			||||||
 | 
								ModuleInfo.ui.println("\nModule Information : ");
 | 
				
			||||||
 | 
								ModuleInfo.ui.println("Entrypoint : " + mi.entrypoint);
 | 
				
			||||||
 | 
								show(mi.protocol, "Protocol : ");
 | 
				
			||||||
 | 
								show(mi.ppi, "Ppi : ");
 | 
				
			||||||
 | 
								show(mi.guid, "Guid : ");
 | 
				
			||||||
 | 
								show(mi.hashfuncc, "call : ");
 | 
				
			||||||
 | 
								show(mi.hashfuncd, "def : ");
 | 
				
			||||||
 | 
								show(mi.hashEFIcall, "EFIcall : ");
 | 
				
			||||||
 | 
								show(mi.hashnonlocalmacro, "macro : ");
 | 
				
			||||||
 | 
								show(mi.hashnonlocalfunc, "nonlocal : ");
 | 
				
			||||||
 | 
								show(mi.hashr8only, "hashr8only : ");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							new MsaWriter(mi).flush();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (ModuleInfo.doCritic) {
 | 
				
			||||||
 | 
					    		Critic.fireAt(mi.outputpath + File.separator + "Migration_" + mi.modulename);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							Common.deleteDir(mi.modulepath + File.separator + "temp");
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							ModuleInfo.ui.println("Errors Left : " + ModuleInfo.db.error);
 | 
				
			||||||
 | 
							ModuleInfo.ui.println("Complete!");
 | 
				
			||||||
 | 
							ModuleInfo.ui.println("Your R9 module was placed here: " + mi.modulepath + File.separator + "result");
 | 
				
			||||||
 | 
							ModuleInfo.ui.println("Your logfile was placed here: " + mi.modulepath);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						private static final void show(Set<String> hash, String show) {
 | 
				
			||||||
 | 
							ModuleInfo.ui.println(show + hash.size());
 | 
				
			||||||
 | 
							ModuleInfo.ui.println(hash);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						public static final void seekModule(String filepath) throws Exception {
 | 
				
			||||||
 | 
							if (ModuleInfo.isModule(filepath)) {
 | 
				
			||||||
 | 
								manipulate(new ModuleInfo(filepath));
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public static final void triger(String path) throws Exception {
 | 
						public static final void triger(String path) throws Exception {
 | 
				
			||||||
		ModuleInfo.ui.println("Project Migration");
 | 
							ModuleInfo.ui.println("Project Migration");
 | 
				
			||||||
		ModuleInfo.ui.println("Copyright (c) 2006, Intel Corporation");
 | 
							ModuleInfo.ui.println("Copyright (c) 2006, Intel Corporation");
 | 
				
			||||||
		Common.toDoAll(path, ModuleInfo.class.getMethod("seekModule", String.class), null, null, Common.DIR);
 | 
							Common.toDoAll(path, ModuleInfo.class.getMethod("seekModule", String.class), null, null, Common.DIR);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	//---------------------------------------------------------------------------//
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public static UI ui = null;
 | 
						public static UI ui = null;
 | 
				
			||||||
	public static Database db = null;
 | 
						public static Database db = null;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user