\r
private static final int totallinelength = 82;\r
\r
- public static final void critic(String filepath) throws Exception {\r
+ public static final void run(String filepath) throws Exception {\r
+ if (MigrationTool.doCritic) {\r
+ critic(filepath);\r
+ }\r
+ }\r
+ \r
+ private static final void critic(String filepath) throws Exception {\r
if (filepath.contains(".c") || filepath.contains(".h")) {\r
BufferedReader rd = null;\r
String line = null;\r
}\r
wholeline = templine.toString();\r
//\r
- \r
- /* -----slow edition of replacefirst with stringbuffer-----\r
- line.append(wholeline);\r
- mtrfunccomment = ptnfunccomment.matcher(line);\r
- while (mtrfunccomment.find()) {\r
- line.replace(0, line.length()-1, mtrfunccomment.replaceFirst("$2$4$3$1$5"));\r
- }\r
- */\r
- /* -----slow edition of replacefirst with string-----\r
- while ((mtrfunccomment = ptnfunccomment.matcher(wholeline)).find()) {\r
- //funccomment = mtrfunccomment.group(2);\r
- //mtrcommentstructure = ptncommentstructure.matcher(funccomment);\r
- wholeline = mtrfunccomment.replaceFirst("$2$4$3$1$5");\r
- }\r
- */\r
- /*\r
- // edit func comment\r
- mtrtempcomment = ptntempcomment.matcher(wholeline);\r
- while (mtrtempcomment.find()) {\r
- System.out.println("-----------------------------");\r
- System.out.println(mtrtempcomment.group());\r
- System.out.println("-----------------------------");\r
- }\r
- */\r
+\r
Common.string2file(wholeline, filepath);\r
}\r
}\r
\r
public static final void fireAt(String path) throws Exception {\r
//Common.toDoAll(Common.dirCopy_(path), Critic.class.getMethod("critic", String.class), null, null, Common.FILE);\r
- Common.toDoAll(path, Critic.class.getMethod("critic", String.class), null, null, Common.FILE);\r
+ Common.toDoAll(path, Critic.class.getMethod("run", String.class), null, null, Common.FILE);\r
//Common.toDoAll(Common.dirCopy_(path), critic, Common.FILE);\r
System.out.println("Critic Done");\r
}\r
-}\r
-//analyze func comment\r
-/*if (mtrcommentstructure.find()) {\r
- newcomment.append("/*++\n\n" + mtrcommentstructure.group(1) + "\n\n");\r
- \r
- //System.out.println("-------1-------");\r
- //System.out.println(mtrcommentstructure.group(1));\r
- \r
- // arg\r
- //System.out.println("-------2-------");\r
- //System.out.println(mtrcommentstructure.group(2));\r
- mtrinfequation = ptninfequation.matcher(mtrcommentstructure.group(2));\r
- while (mtrinfequation.find()) {\r
- newcomment.append("@param " + mtrinfequation.group(1) + " " + mtrinfequation.group(2) + "\n");\r
- //System.out.println("@param " + mtrinfequation.group(1) + " " + mtrinfequation.group(2));\r
- }\r
- newcomment.append("\n");\r
- // return\r
- //System.out.println("-------3-------");\r
- //System.out.println(mtrcommentstructure.group(3));\r
- mtrinfequation = ptninfequation.matcher(mtrcommentstructure.group(3));\r
- while (mtrinfequation.find()) {\r
- newcomment.append("@retval " + mtrinfequation.group(1) + " " + mtrinfequation.group(2) + "\n");\r
- //System.out.println("@retval " + mtrinfequation.group(1) + " " + mtrinfequation.group(2));\r
- }\r
- System.out.println(newcomment);\r
-} else {\r
- System.out.println("Error: Comment Style Incorrect");\r
-}*/
\ No newline at end of file
+}
\ No newline at end of file
\r
String outname = null;\r
String inname = null;\r
- /*\r
- if (MigrationTool.ui.yesOrNo("Changes will be made to the Source Code. View details?")) {\r
- showdetails = true;\r
- }\r
- */\r
+\r
showdetails = true; // set this as default now, may be changed in the future\r
\r
Iterator<String> di = mi.localmodulesources.iterator();\r
private static final void addr8only() throws Exception {\r
String paragraph = null;\r
String line = Common.file2string(MigrationTool.db.DatabasePath + File.separator + "R8Lib.c");\r
- //Common.ensureDir(mi.modulepath + File.separator + "Migration_" + mi.modulename + File.separator + "R8Lib.c");\r
PrintWriter outfile1 = new PrintWriter(new BufferedWriter(new FileWriter(MigrationTool.ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename + File.separator + "R8Lib.c")));\r
PrintWriter outfile2 = new PrintWriter(new BufferedWriter(new FileWriter(MigrationTool.ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename + File.separator + "R8Lib.h")));\r
Pattern ptnr8only = Pattern.compile("////#?(\\w*)?.*?R8_(\\w*).*?////~", Pattern.DOTALL);\r
BufferedReader rd = new BufferedReader(new FileReader(filename));\r
StringBuffer wholefile = new StringBuffer();\r
String line;\r
- String r8thing;\r
- String r9thing;\r
- r8tor9 temp;\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
}\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
} else { //\r
mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing)); // add a library here\r
}\r
- \r
+\r
+ r8tor9 temp;\r
if ((r9thing = MigrationTool.db.getR9Func(r8thing)) != null) {\r
if (!r8thing.equals(r9thing)) {\r
if (line.contains(r8thing)) {\r