From e9d0ba2081551b025ea2f95ed324bb7767c5d4d6 Mon Sep 17 00:00:00 2001 From: benfry Date: Tue, 3 Jun 2008 20:48:41 +0000 Subject: [PATCH] fix bug #803 include memory settings with exported applications on macosx --- app/src/processing/app/Sketch.java | 29 ++++++++++++++++++++------ build/shared/lib/export/template.plist | 4 ++-- todo.txt | 10 +++++++++ 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/app/src/processing/app/Sketch.java b/app/src/processing/app/Sketch.java index 282be3fe5..1a71cc2f5 100644 --- a/app/src/processing/app/Sketch.java +++ b/app/src/processing/app/Sketch.java @@ -1533,8 +1533,8 @@ public class Sketch { // there doesn't seem to be a method to grab it.. // so instead it's done using a regexp - // TODO not tested since removing ORO matcher.. ^ could be a problem - String mess = "^line (\\d+):(\\d+):\\s"; + // TODO not tested since removing ORO matcher.. ^ could be a problem + String mess = "^line (\\d+):(\\d+):\\s"; String[] matches = PApplet.match(tsre.toString(), mess); if (matches != null) { @@ -1673,7 +1673,7 @@ public class Sketch { Base.removeDir(appletFolder); // Create a fresh applet folder (needed before preproc is run below) appletFolder.mkdirs(); - + zipFileContents = new Hashtable(); // build the sketch @@ -1695,9 +1695,9 @@ public class Sketch { int high = PApplet.DEFAULT_HEIGHT; String renderer = ""; - // This matches against any uses of the size() function, whether numbers - // or variables or whatever. This way, no warning is shown if size() isn't - // actually used in the applet, which is the case especially for beginners + // This matches against any uses of the size() function, whether numbers + // or variables or whatever. This way, no warning is shown if size() isn't + // actually used in the applet, which is the case especially for beginners // that are cutting/pasting from the reference. String sizeRegex = "[\\s\\;^]size\\s*\\(\\s*(\\S+)\\s*,\\s*(\\d+),?\\s*([^\\)]*)\\s*\\)"; @@ -2388,6 +2388,16 @@ public class Sketch { } + /// figure out run options for the VM + + String runOptions = Preferences.get("run.options"); + if (Preferences.getBoolean("run.options.memory")) { + runOptions += " -Xms" + + Preferences.get("run.options.memory.initial") + "m"; + runOptions += " -Xmx" + + Preferences.get("run.options.memory.maximum") + "m"; + } + /// macosx: write out Info.plist (template for classpath, etc) if (exportPlatform == PConstants.MACOSX) { @@ -2404,6 +2414,10 @@ public class Sketch { if (lines[i].indexOf("@@") != -1) { StringBuffer sb = new StringBuffer(lines[i]); int index = 0; + while ((index = sb.indexOf("@@vmoptions@@")) != -1) { + sb.replace(index, index + "@@vmoptions@@".length(), + runOptions); + } while ((index = sb.indexOf("@@sketch@@")) != -1) { sb.replace(index, index + "@@sketch@@".length(), name); @@ -2424,12 +2438,15 @@ public class Sketch { File argsFile = new File(destFolder + "/lib/args.txt"); PrintStream ps = new PrintStream(new FileOutputStream(argsFile)); + /* ps.print(Preferences.get("run.options") + " "); if (Preferences.getBoolean("run.options.memory")) { ps.print("-Xms" + Preferences.get("run.options.memory.initial") + "m "); ps.print("-Xmx" + Preferences.get("run.options.memory.maximum") + "m "); } ps.println(); + */ + ps.println(runOptions); ps.println(this.name); ps.println(exportClassPath); diff --git a/build/shared/lib/export/template.plist b/build/shared/lib/export/template.plist index cd68fb08c..4c33b7a0f 100755 --- a/build/shared/lib/export/template.plist +++ b/build/shared/lib/export/template.plist @@ -25,11 +25,11 @@ Java VMOptions - -Xms128M -Xmx256M + @@vmoptions@@ MainClass @@sketch@@ JVMVersion - 1.3+ + 1.5* ClassPath @@classpath@@ diff --git a/todo.txt b/todo.txt index 2e64a47a3..bd0235272 100644 --- a/todo.txt +++ b/todo.txt @@ -1,5 +1,13 @@ 0139 pde +X update quaqua to 3.9.5 on macosx (http://www.randelshofer.ch/quaqua/) +X xml.getIntAttribute() returns a float +X http://dev.processing.org/bugs/show_bug.cgi?id=790 +_ error highlighting broken +_ http://dev.processing.org/bugs/show_bug.cgi?id=795 + +_ "Target VM failed to initialize: VM initialization failed" when trying to run +_ http://dev.processing.org/bugs/show_bug.cgi?id=796 _ slow response on file, sketchbook, and examples menus _ http://dev.processing.org/bugs/show_bug.cgi?id=786 @@ -66,6 +74,8 @@ _ need to make up a priorities/todo page for processing _ that includes projects for people to help out on reference +_ quicktime likes to crash (not just on windows) +_ http://dev.processing.org/bugs/show_bug.cgi?id=791 _ createInput, createInputRaw, createOutput _ noLoop() isn't the same as "finished", though it's sometimes used that way _ to finish, use exit() (though that will make the window close)