| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9418,16 +9418,16 @@ static public void runSketch(final String[] args, final PApplet constructedApple | |||
| 9418 | 9418 | argIndex++; | |
| 9419 | 9419 | } | |
| 9420 | 9420 | ||
| 9421 | - // Now that sketch path is passed in args after the sketch name | ||
| 9422 | - // it's not set in the above loop(the above loop breaks after | ||
| 9423 | - // finding sketch name). So setting sketch path here. | ||
| 9424 | - // https://github.com/processing/processing/commit/0a14835e6f5f4766b022e73a8fe562318636727c | ||
| 9425 | - // TODO this is a hack added for PDE X and needs to be removed [fry 141104] | ||
| 9426 | - for (int i = 0; i < args.length; i++) { | ||
| 9427 | - if (args[i].startsWith(ARGS_SKETCH_FOLDER)){ | ||
| 9428 | - folder = args[i].substring(args[i].indexOf('=') + 1); | ||
| 9429 | - } | ||
| 9430 | - } | ||
| 9421 | + // // Now that sketch path is passed in args after the sketch name | ||
| 9422 | + // // it's not set in the above loop(the above loop breaks after | ||
| 9423 | + // // finding sketch name). So setting sketch path here. | ||
| 9424 | + // // https://github.com/processing/processing/commit/0a14835e6f5f4766b022e73a8fe562318636727c | ||
| 9425 | + // // TODO this is a hack added for PDE X and needs to be removed [fry 141104] | ||
| 9426 | + // for (int i = 0; i < args.length; i++) { | ||
| 9427 | + // if (args[i].startsWith(ARGS_SKETCH_FOLDER)){ | ||
| 9428 | + // folder = args[i].substring(args[i].indexOf('=') + 1); | ||
| 9429 | + // } | ||
| 9430 | + // } | ||
| 9431 | 9431 | ||
| 9432 | 9432 | // Set this property before getting into any GUI init code | |
| 9433 | 9433 | //System.setProperty("com.apple.mrj.application.apple.menu.about.name", name); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -71,7 +71,7 @@ public class Runner implements MessageConsumer { | |||
| 71 | 71 | ||
| 72 | 72 | protected PrintStream sketchErr; | |
| 73 | 73 | protected PrintStream sketchOut; | |
| 74 | - | ||
| 74 | + | ||
| 75 | 75 | ||
| 76 | 76 | public Runner(JavaBuild build, RunnerListener listener) throws SketchException { | |
| 77 | 77 | this.listener = listener; | |
@@ -95,11 +95,11 @@ public Runner(JavaBuild build, RunnerListener listener) throws SketchException { | |||
| 95 | 95 | int opposite = (bits == 32) ? 64 : 32; | |
| 96 | 96 | if (Base.isMacOS()) { | |
| 97 | 97 | //if (library.supportsArch(PConstants.MACOSX, opposite)) { // should always be true | |
| 98 | - throw new SketchException("To use " + library.getName() + ", " + | ||
| 98 | + throw new SketchException("To use " + library.getName() + ", " + | ||
| 99 | 99 | "switch to " + opposite + "-bit mode in Preferences."); | |
| 100 | 100 | //} | |
| 101 | 101 | } else { | |
| 102 | - throw new SketchException(library.getName() + " is only compatible " + | ||
| 102 | + throw new SketchException(library.getName() + " is only compatible " + | ||
| 103 | 103 | "with the " + opposite + "-bit download of Processing."); | |
| 104 | 104 | //throw new SketchException(library.getName() + " does not run in " + bits + "-bit mode."); | |
| 105 | 105 | // "To use this library, switch to 32-bit mode in Preferences." (OS X) | |
@@ -115,8 +115,8 @@ public void launch(boolean presenting) { | |||
| 115 | 115 | generateTrace(); | |
| 116 | 116 | } | |
| 117 | 117 | } | |
| 118 | - | ||
| 119 | - | ||
| 118 | + | ||
| 119 | + | ||
| 120 | 120 | /** | |
| 121 | 121 | * Simple non-blocking launch of the virtual machine. VM starts suspended. | |
| 122 | 122 | * @return debuggee VM or null on failure | |
@@ -128,7 +128,7 @@ public VirtualMachine launchDebug() { | |||
| 128 | 128 | return vm; | |
| 129 | 129 | } | |
| 130 | 130 | ||
| 131 | - | ||
| 131 | + | ||
| 132 | 132 | /** | |
| 133 | 133 | * Redirect a VMs output and error streams to System.out and System.err | |
| 134 | 134 | */ | |
@@ -140,16 +140,16 @@ protected void redirectStreams(VirtualMachine vm) { | |||
| 140 | 140 | outThread.start(); | |
| 141 | 141 | } | |
| 142 | 142 | ||
| 143 | - | ||
| 143 | + | ||
| 144 | 144 | /** | |
| 145 | 145 | * Additional access to the virtual machine. TODO: may not be needed | |
| 146 | 146 | * @return debugge VM or null if not running | |
| 147 | 147 | */ | |
| 148 | 148 | public VirtualMachine vm() { | |
| 149 | 149 | return vm; | |
| 150 | 150 | } | |
| 151 | - | ||
| 152 | - | ||
| 151 | + | ||
| 152 | + | ||
| 153 | 153 | public boolean launchVirtualMachine(boolean presenting) { | |
| 154 | 154 | String[] vmParams = getMachineParams(); | |
| 155 | 155 | String[] sketchParams = getSketchParams(presenting); | |
@@ -158,20 +158,20 @@ public boolean launchVirtualMachine(boolean presenting) { | |||
| 158 | 158 | ||
| 159 | 159 | // Older (Java 1.5 and earlier) version, go figure | |
| 160 | 160 | // String jdwpArg = "-Xrunjdwp:transport=dt_socket,address=" + portStr + ",server=y,suspend=y"; | |
| 161 | - // String debugArg = "-Xdebug"; | ||
| 161 | + // String debugArg = "-Xdebug"; | ||
| 162 | 162 | // Newer (Java 1.5+) version that uses JVMTI | |
| 163 | 163 | String jdwpArg = "-agentlib:jdwp=transport=dt_socket,address=" + portStr + ",server=y,suspend=y"; | |
| 164 | 164 | ||
| 165 | - // Everyone works the same under Java 7 (also on OS X) | ||
| 165 | + // Everyone works the same under Java 7 (also on OS X) | ||
| 166 | 166 | String[] commandArgs = new String[] { Base.getJavaPath(), jdwpArg }; | |
| 167 | - | ||
| 167 | + | ||
| 168 | 168 | commandArgs = PApplet.concat(commandArgs, vmParams); | |
| 169 | 169 | commandArgs = PApplet.concat(commandArgs, sketchParams); | |
| 170 | 170 | // PApplet.println(commandArgs); | |
| 171 | 171 | // commandArg.setValue(commandArgs); | |
| 172 | 172 | launchJava(commandArgs); | |
| 173 | - | ||
| 174 | - AttachingConnector connector = (AttachingConnector) | ||
| 173 | + | ||
| 174 | + AttachingConnector connector = (AttachingConnector) | ||
| 175 | 175 | findConnector("com.sun.jdi.SocketAttach"); | |
| 176 | 176 | //PApplet.println(connector); // gets the defaults | |
| 177 | 177 | ||
@@ -182,7 +182,7 @@ public boolean launchVirtualMachine(boolean presenting) { | |||
| 182 | 182 | // addressArg.setValue(addr); | |
| 183 | 183 | Connector.Argument portArg = arguments.get("port"); | |
| 184 | 184 | portArg.setValue(portStr); | |
| 185 | - | ||
| 185 | + | ||
| 186 | 186 | // Connector.Argument timeoutArg = | |
| 187 | 187 | // (Connector.Argument)arguments.get("timeout"); | |
| 188 | 188 | // timeoutArg.setValue("10000"); | |
@@ -193,7 +193,7 @@ public boolean launchVirtualMachine(boolean presenting) { | |||
| 193 | 193 | ||
| 194 | 194 | //System.out.println(PApplet.javaVersion); | |
| 195 | 195 | // http://java.sun.com/j2se/1.5.0/docs/guide/jpda/conninv.html#sunlaunch | |
| 196 | - | ||
| 196 | + | ||
| 197 | 197 | try { | |
| 198 | 198 | // boolean available = false; | |
| 199 | 199 | // while (!available) { | |
@@ -376,7 +376,7 @@ protected String[] getSketchParams(boolean presenting) { | |||
| 376 | 376 | } | |
| 377 | 377 | ||
| 378 | 378 | params.add(PApplet.ARGS_DISPLAY + "=" + runDisplay); | |
| 379 | - | ||
| 379 | + | ||
| 380 | 380 | ||
| 381 | 381 | if (presenting) { | |
| 382 | 382 | params.add(PApplet.ARGS_FULL_SCREEN); | |
@@ -389,10 +389,11 @@ protected String[] getSketchParams(boolean presenting) { | |||
| 389 | 389 | Preferences.get("run.present.bgcolor")); | |
| 390 | 390 | } | |
| 391 | 391 | ||
| 392 | - params.add(build.getSketchClassName()); | ||
| 392 | + // There was a PDE X hack that put this after the class name, but it was | ||
| 393 | + // removed for 3.0a6 because it would break the args passed to sketches. | ||
| 393 | 394 | params.add(PApplet.ARGS_SKETCH_FOLDER + "=" + build.getSketchPath()); | |
| 394 | - // Adding sketch path in the end coz it's likely to | ||
| 395 | - // contain spaces and things go wrong on UNIX systems. | ||
| 395 | + | ||
| 396 | + params.add(build.getSketchClassName()); | ||
| 396 | 397 | } | |
| 397 | 398 | ||
| 398 | 399 | // String outgoing[] = new String[params.size()]; | |
@@ -414,12 +415,12 @@ public void run() { | |||
| 414 | 415 | if (result != 0) { | |
| 415 | 416 | String[] errorStrings = PApplet.loadStrings(process.getErrorStream()); | |
| 416 | 417 | String[] inputStrings = PApplet.loadStrings(process.getInputStream()); | |
| 417 | - | ||
| 418 | + | ||
| 418 | 419 | // PApplet.println("launchJava stderr:"); | |
| 419 | 420 | // PApplet.println(errorStrings); | |
| 420 | 421 | // PApplet.println("launchJava stdout:"); | |
| 421 | 422 | PApplet.printArray(inputStrings); | |
| 422 | - | ||
| 423 | + | ||
| 423 | 424 | if (errorStrings != null && errorStrings.length > 1) { | |
| 424 | 425 | if (errorStrings[0].indexOf("Invalid maximum heap size") != -1) { | |
| 425 | 426 | Base.showWarning("Way Too High", | |
@@ -464,18 +465,18 @@ protected void generateTrace() { | |||
| 464 | 465 | //vm.setDebugTraceMode(debugTraceMode); | |
| 465 | 466 | // vm.setDebugTraceMode(VirtualMachine.TRACE_ALL); | |
| 466 | 467 | // vm.setDebugTraceMode(VirtualMachine.TRACE_NONE); // formerly, seems to have no effect | |
| 467 | - | ||
| 468 | - // Calling this seems to set something internally to make the | ||
| 468 | + | ||
| 469 | + // Calling this seems to set something internally to make the | ||
| 469 | 470 | // Eclipse JDI wake up. Without it, an ObjectCollectedException | |
| 470 | - // is thrown on excReq.enable(). No idea why this works, | ||
| 471 | - // but at least exception handling has returned. (Suspect that it may | ||
| 472 | - // block until all or at least some threads are available, meaning | ||
| 473 | - // that the app has launched and we have legit objects to talk to). | ||
| 471 | + // is thrown on excReq.enable(). No idea why this works, | ||
| 472 | + // but at least exception handling has returned. (Suspect that it may | ||
| 473 | + // block until all or at least some threads are available, meaning | ||
| 474 | + // that the app has launched and we have legit objects to talk to). | ||
| 474 | 475 | vm.allThreads(); | |
| 475 | - // The bug may not have been noticed because the test suite waits for | ||
| 476 | - // a thread to be available, and queries it by calling allThreads(). | ||
| 476 | + // The bug may not have been noticed because the test suite waits for | ||
| 477 | + // a thread to be available, and queries it by calling allThreads(). | ||
| 477 | 478 | // See org.eclipse.debug.jdi.tests.AbstractJDITest for the example. | |
| 478 | - | ||
| 479 | + | ||
| 479 | 480 | EventRequestManager mgr = vm.eventRequestManager(); | |
| 480 | 481 | // get only the uncaught exceptions | |
| 481 | 482 | ExceptionRequest excReq = mgr.createExceptionRequest(null, false, true); | |
@@ -487,15 +488,15 @@ protected void generateTrace() { | |||
| 487 | 488 | // excReq.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); | |
| 488 | 489 | // excReq.setSuspendPolicy(EventRequest.SUSPEND_NONE); // another option? | |
| 489 | 490 | excReq.enable(); | |
| 490 | - | ||
| 491 | + | ||
| 491 | 492 | Thread eventThread = new Thread() { | |
| 492 | 493 | public void run() { | |
| 493 | 494 | try { | |
| 494 | 495 | boolean connected = true; | |
| 495 | 496 | while (connected) { | |
| 496 | 497 | EventQueue eventQueue = vm.eventQueue(); | |
| 497 | 498 | // remove() blocks until event(s) available | |
| 498 | - EventSet eventSet = eventQueue.remove(); | ||
| 499 | + EventSet eventSet = eventQueue.remove(); | ||
| 499 | 500 | // listener.vmEvent(eventSet); | |
| 500 | 501 | ||
| 501 | 502 | for (Event event : eventSet) { | |
@@ -510,7 +511,7 @@ public void run() { | |||
| 510 | 511 | exceptionEvent((ExceptionEvent) event); | |
| 511 | 512 | } else if (event instanceof VMDisconnectEvent) { | |
| 512 | 513 | connected = false; | |
| 513 | - } | ||
| 514 | + } | ||
| 514 | 515 | } | |
| 515 | 516 | } | |
| 516 | 517 | // } catch (VMDisconnectedException e) { | |
@@ -524,8 +525,8 @@ public void run() { | |||
| 524 | 525 | }; | |
| 525 | 526 | eventThread.start(); | |
| 526 | 527 | ||
| 527 | - | ||
| 528 | - errThread = | ||
| 528 | + | ||
| 529 | + errThread = | ||
| 529 | 530 | new MessageSiphon(process.getErrorStream(), this).getThread(); | |
| 530 | 531 | ||
| 531 | 532 | outThread = new StreamRedirectThread("JVM stdout Reader", | |
@@ -537,7 +538,7 @@ public void run() { | |||
| 537 | 538 | // Shutdown begins when event thread terminates | |
| 538 | 539 | try { | |
| 539 | 540 | if (eventThread != null) eventThread.join(); // is this the problem? | |
| 540 | - | ||
| 541 | + | ||
| 541 | 542 | // System.out.println("in here"); | |
| 542 | 543 | // Bug #852 tracked to this next line in the code. | |
| 543 | 544 | // http://dev.processing.org/bugs/show_bug.cgi?id=852 | |
@@ -561,7 +562,7 @@ public void run() { | |||
| 561 | 562 | ||
| 562 | 563 | ||
| 563 | 564 | protected Connector findConnector(String connectorName) { | |
| 564 | - // List connectors = | ||
| 565 | + // List connectors = | ||
| 565 | 566 | // com.sun.jdi.Bootstrap.virtualMachineManager().allConnectors(); | |
| 566 | 567 | List<Connector> connectors = | |
| 567 | 568 | org.eclipse.jdi.Bootstrap.virtualMachineManager().allConnectors(); | |
@@ -584,8 +585,8 @@ protected Connector findConnector(String connectorName) { | |||
| 584 | 585 | return connector; | |
| 585 | 586 | } | |
| 586 | 587 | } | |
| 587 | - Base.showError("Compiler Error", | ||
| 588 | - "findConnector() failed to find " + | ||
| 588 | + Base.showError("Compiler Error", | ||
| 589 | + "findConnector() failed to find " + | ||
| 589 | 590 | connectorName + " inside Runner", null); | |
| 590 | 591 | return null; // Not reachable | |
| 591 | 592 | } | |
@@ -618,18 +619,18 @@ public void exceptionEvent(ExceptionEvent event) { | |||
| 618 | 619 | reportException(message, or, event.thread()); | |
| 619 | 620 | // Then try to pretty it up with a better message | |
| 620 | 621 | handleCommonErrors(exceptionName, message, listener, sketchErr); | |
| 621 | - | ||
| 622 | + | ||
| 622 | 623 | if (editor != null) { | |
| 623 | 624 | editor.deactivateRun(); | |
| 624 | 625 | } | |
| 625 | 626 | } | |
| 626 | 627 | ||
| 627 | 628 | ||
| 628 | 629 | /** | |
| 629 | - * Provide more useful explanations of common error messages, perhaps with | ||
| 630 | - * a short message in the status area, and (if necessary) a longer message | ||
| 630 | + * Provide more useful explanations of common error messages, perhaps with | ||
| 631 | + * a short message in the status area, and (if necessary) a longer message | ||
| 631 | 632 | * in the console. | |
| 632 | - * | ||
| 633 | + * | ||
| 633 | 634 | * @param exceptionClass Class name causing the error (with full package name) | |
| 634 | 635 | * @param message The message from the exception | |
| 635 | 636 | * @param listener The Editor or command line interface that's listening for errors | |
@@ -658,7 +659,7 @@ public static boolean handleCommonErrors(final String exceptionClass, | |||
| 658 | 659 | } else if (exceptionClass.equals("java.lang.UnsatisfiedLinkError")) { | |
| 659 | 660 | listener.statusError("A library used by this sketch is not installed properly."); | |
| 660 | 661 | err.println("A library relies on native code that's not available."); | |
| 661 | - err.println("Or only works properly when the sketch is run as a " + | ||
| 662 | + err.println("Or only works properly when the sketch is run as a " + | ||
| 662 | 663 | ((Base.getNativeBits() == 32) ? "64-bit " : "32-bit ") + " application."); | |
| 663 | 664 | ||
| 664 | 665 | } else if (exceptionClass.equals("java.lang.StackOverflowError")) { | |
@@ -762,7 +763,7 @@ protected SketchException findException(String message, ObjectReference or, Thre | |||
| 762 | 763 | method = ((ClassType) or.referenceType()).concreteMethodByName("printStackTrace", "()V"); | |
| 763 | 764 | // System.err.println("got method " + method); | |
| 764 | 765 | or.invokeMethod(thread, method, new ArrayList<Value>(), ObjectReference.INVOKE_SINGLE_THREADED); | |
| 765 | - | ||
| 766 | + | ||
| 766 | 767 | } catch (Exception e) { | |
| 767 | 768 | e.printStackTrace(sketchErr); | |
| 768 | 769 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments