X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fcom%2Fdogcows%2FEditor.java;h=eca84208ad675a66706995396744d2d821845537;hb=2950052d2276e7ec64aad1ec678e32622e3a38c5;hp=2f2896248113e30da45d75d3d68995bc04141389;hpb=28c8fae03b2294d6486233cd62f4d4d9d11603ca;p=chaz%2Fvimcoder diff --git a/src/com/dogcows/Editor.java b/src/com/dogcows/Editor.java index 2f28962..eca8420 100644 --- a/src/com/dogcows/Editor.java +++ b/src/com/dogcows/Editor.java @@ -1,12 +1,9 @@ package com.dogcows; -import java.io.BufferedReader; import java.io.File; -import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; -import java.io.InputStream; import java.util.*; import com.topcoder.client.contestant.ProblemComponentModel; @@ -92,7 +89,7 @@ public class Editor // Set up the terms used for the template expansion. HashMap terms = new HashMap(); - terms.put("RETURNTYPE", component.getReturnType().getDescriptor(language).replaceAll("\\s+", "")); + terms.put("RETURNTYPE", component.getReturnType().getDescriptor(language)); terms.put("CLASSNAME", name); terms.put("METHODNAME", component.getMethodName()); terms.put("METHODPARAMS", getMethodParams(component.getParamTypes(), @@ -100,7 +97,7 @@ public class Editor language)); terms.put("METHODPARAMNAMES", Util.join(component.getParamNames(), ", ")); terms.put("METHODPARAMSTREAMIN", Util.join(component.getParamNames(), " >> ")); - terms.put("METHODPARAMSTREAMOUT", Util.join(component.getParamNames(), " << ")); + terms.put("METHODPARAMSTREAMOUT", Util.join(component.getParamNames(), " << \", \" << ")); terms.put("METHODPARAMDECLARES", getMethodParamDeclarations(component.getParamTypes(), component.getParamNames(), language)); @@ -167,6 +164,7 @@ public class Editor // Finally, expand the Makefile template and write it. File makeFile = new File(directory, "Makefile"); + if (!makeFile.canRead()) { String text = Util.expandTemplate(readTemplate(lang + "Makefile"), terms); @@ -246,7 +244,7 @@ public class Editor * before the timeout, we will assume it is not backgrounding and * that everything worked. This works as long as the Vim server is * able to start within the stall period. */ - long expire = System.currentTimeMillis() + 250; + long expire = System.currentTimeMillis() + 1000; while (System.currentTimeMillis() < expire) { Thread.yield(); @@ -298,7 +296,7 @@ public class Editor String[] strings = new String[types.length]; for (int i = 0; i < types.length; ++i) { - strings[i] = types[i].getDescriptor(language).replaceAll("\\s+", ""); + strings[i] = types[i].getDescriptor(language); } return strings; }