From: Rene S. <sa...@us...> - 2004-09-10 22:02:24
|
Update of /cvsroot/jake2/jake2/src/jake2/sys In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11120/src/jake2/sys Modified Files: Sys.java Log Message: did some cource cleanups Index: Sys.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/sys/Sys.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Sys.java 29 Aug 2004 21:39:26 -0000 1.7 --- Sys.java 10 Sep 2004 19:02:56 -0000 1.8 *************** *** 58,82 **** public static File[] FindAll(String path, int musthave, int canthave) { ! int index = path.lastIndexOf('/'); if (index != -1) { ! findbase = path.substring(0, index); ! findpattern = path.substring(index + 1, path.length()); } else { ! findbase = path; ! findpattern = "*"; } if (findpattern.equals("*.*")) { ! findpattern = "*"; } ! File fdir = new File(findbase); if (!fdir.exists()) return null; ! FilenameFilter filter = new FileFilter(findpattern, musthave, canthave); return fdir.listFiles(filter); --- 58,82 ---- public static File[] FindAll(String path, int musthave, int canthave) { ! int index= path.lastIndexOf('/'); if (index != -1) { ! findbase= path.substring(0, index); ! findpattern= path.substring(index + 1, path.length()); } else { ! findbase= path; ! findpattern= "*"; } if (findpattern.equals("*.*")) { ! findpattern= "*"; } ! File fdir= new File(findbase); if (!fdir.exists()) return null; ! FilenameFilter filter= new FileFilter(findpattern, musthave, canthave); return fdir.listFiles(filter); *************** *** 102,108 **** FileFilter(String findpattern, int musthave, int canthave) { ! this.regexpr = convert2regexpr(findpattern); ! this.musthave = musthave; ! this.canthave = canthave; } --- 102,108 ---- FileFilter(String findpattern, int musthave, int canthave) { ! this.regexpr= convert2regexpr(findpattern); ! this.musthave= musthave; ! this.canthave= canthave; } *************** *** 120,156 **** String convert2regexpr(String pattern) { ! StringBuffer sb = new StringBuffer(); char c; ! boolean escape = false; String subst; // convert pattern ! for (int i = 0; i < pattern.length(); i++) { ! c = pattern.charAt(i); ! subst = null; switch (c) { case '*' : ! subst = (!escape) ? ".*" : "*"; break; case '.' : ! subst = (!escape) ? "\\." : "."; break; case '!' : ! subst = (!escape) ? "^" : "!"; break; case '?' : ! subst = (!escape) ? "." : "?"; break; case '\\' : ! escape = !escape; break; default : ! escape = false; } if (subst != null) { sb.append(subst); ! escape = false; } else --- 120,156 ---- String convert2regexpr(String pattern) { ! StringBuffer sb= new StringBuffer(); char c; ! boolean escape= false; String subst; // convert pattern ! for (int i= 0; i < pattern.length(); i++) { ! c= pattern.charAt(i); ! subst= null; switch (c) { case '*' : ! subst= (!escape) ? ".*" : "*"; break; case '.' : ! subst= (!escape) ? "\\." : "."; break; case '!' : ! subst= (!escape) ? "^" : "!"; break; case '?' : ! subst= (!escape) ? "." : "?"; break; case '\\' : ! escape= !escape; break; default : ! escape= false; } if (subst != null) { sb.append(subst); ! escape= false; } else *************** *** 159,163 **** // the converted pattern ! String regexpr = sb.toString(); //Com.DPrintf("pattern: " + pattern + " regexpr: " + regexpr + '\n'); --- 159,163 ---- // the converted pattern ! String regexpr= sb.toString(); //Com.DPrintf("pattern: " + pattern + " regexpr: " + regexpr + '\n'); *************** *** 174,178 **** boolean CompareAttributes(File dir, int musthave, int canthave) { // . and .. never match ! String name = dir.getName(); if (name.equals(".") || name.equals("..")) --- 174,178 ---- boolean CompareAttributes(File dir, int musthave, int canthave) { // . and .. never match ! String name= dir.getName(); if (name.equals(".") || name.equals("..")) *************** *** 184,190 **** } ! private static long secbase = System.currentTimeMillis(); public static int Milliseconds() { ! return Globals.curtime = (int) (System.currentTimeMillis() - secbase); } --- 184,190 ---- } ! private static long secbase= System.currentTimeMillis(); public static int Milliseconds() { ! return Globals.curtime= (int) (System.currentTimeMillis() - secbase); } *************** *** 204,211 **** // COM_FilePath (path, findbase); ! fdir = FindAll(path, canthave, musthave); ! fileindex =0; ! ! if (fdir == null) return null; return FindNext(); --- 204,212 ---- // COM_FilePath (path, findbase); ! fdir= FindAll(path, canthave, musthave); ! fileindex= 0; ! ! if (fdir == null) ! return null; return FindNext(); *************** *** 221,235 **** public static void FindClose() { ! ! if (fdir != null) ! fdir = null; ! } ! public static void SendKeyEvents() { KBD.Update(); ! // grab frame time ! Globals.sys_frame_time = Sys.Milliseconds(); } --- 222,233 ---- public static void FindClose() { ! fdir= null; } ! public static void SendKeyEvents() { KBD.Update(); ! // grab frame time ! Globals.sys_frame_time= Sys.Milliseconds(); } *************** *** 239,244 **** } ! public static void ConsoleOutput(String msg) ! { if (Globals.nostdout != null && Globals.nostdout.value != 0) return; --- 237,241 ---- } ! public static void ConsoleOutput(String msg) { if (Globals.nostdout != null && Globals.nostdout.value != 0) return; |