diff --git a/processing/app/PdeCompiler.java b/processing/app/PdeCompiler.java index 9b95a9889..a975a1f1e 100644 --- a/processing/app/PdeCompiler.java +++ b/processing/app/PdeCompiler.java @@ -231,6 +231,7 @@ public class PdeCompiler implements PdeMessageConsumer { partialStartIndex = s.indexOf(partialTempPath); if (partialStartIndex != -1) { fileIndex = i; + //System.out.println("fileIndex is " + fileIndex); break; } } @@ -243,8 +244,8 @@ public class PdeCompiler implements PdeMessageConsumer { // skip past the path and parse the int after the first colon // - String s1 = s.substring(partialStartIndex + partialTempPath.length() - + 1); + String s1 = s.substring(partialStartIndex + + partialTempPath.length() + 1); int colon = s1.indexOf(':'); int lineNumber = Integer.parseInt(s1.substring(0, colon)); //System.out.println("pde / line number: " + lineNumber); @@ -267,7 +268,7 @@ public class PdeCompiler implements PdeMessageConsumer { String description = s1.substring(err + "Error:".length()); description = description.trim(); //System.out.println("description = " + description); - exception = new PdeException(description, lineNumber-1); + exception = new PdeException(description, fileIndex, lineNumber-1, -1); // NOTE!! major change here, this exception will be queued // here to be thrown by the compile() function diff --git a/processing/app/PdeEditor.java b/processing/app/PdeEditor.java index 7a1f36d02..8e1b81ee0 100644 --- a/processing/app/PdeEditor.java +++ b/processing/app/PdeEditor.java @@ -567,7 +567,8 @@ public class PdeEditor extends JFrame }); menu.add(item); - menu.add(newJMenuItem("Stop", 'T')); + //menu.add(newJMenuItem("Stop", 'T')); + menu.add(new JMenuItem("Stop")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleStop(); @@ -1458,7 +1459,7 @@ public class PdeEditor extends JFrame gotBlankLine = true; } } else { - System.out.println(level); + //System.out.println(level); int idx = -1; String myline = line.substring(0); while (myline.lastIndexOf('}') != idx) { @@ -1573,6 +1574,7 @@ public class PdeEditor extends JFrame public void error(PdeException e) { + if (e.file >= 0) sketch.setCurrent(e.file); if (e.line >= 0) highlightLine(e.line); status.error(e.getMessage()); diff --git a/processing/app/PdeEditorHeader.java b/processing/app/PdeEditorHeader.java index 09b116155..254b92271 100644 --- a/processing/app/PdeEditorHeader.java +++ b/processing/app/PdeEditorHeader.java @@ -315,7 +315,10 @@ public class PdeEditorHeader extends JComponent /*implements MouseListener*/ { } JMenuItem item; - item = PdeEditor.newJMenuItem("New", 'T'); + // maybe this shouldn't have a command key anyways.. + // since we're not trying to make this a full ide.. + //item = PdeEditor.newJMenuItem("New", 'T'); + item = new JMenuItem("New"); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //System.out.println("TODO write code for New"); diff --git a/processing/app/PdeException.java b/processing/app/PdeException.java index 1aad90cb5..39327cec1 100644 --- a/processing/app/PdeException.java +++ b/processing/app/PdeException.java @@ -4,8 +4,8 @@ PdeException - an exception with a line number attached Part of the Processing project - http://processing.org - Except where noted, code is written by Ben Fry and - Copyright (c) 2001-03 Massachusetts Institute of Technology + Except where noted, code is written by Ben Fry and is + Copyright (c) 2001-04 Massachusetts Institute of Technology This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,6 +24,7 @@ public class PdeException extends Exception { + int file = -1; int line = -1; int column = -1; @@ -31,7 +32,6 @@ public class PdeException extends Exception { public PdeException(String message) { super(massage(message)); - //System.out.println("message for this error is " + message); } public PdeException(String message, int line) { @@ -39,13 +39,19 @@ public class PdeException extends Exception { this.line = line; } - // 0060 currently only used by the new preprocessor public PdeException(String message, int line, int column) { super(massage(message)); this.line = line; this.column = column; } + public PdeException(String message, int file, int line, int column) { + super(massage(message)); + this.file = file; + this.line = line; + this.column = column; + } + // make static so that super() can call it static public final String massage(String msg) { if (msg.indexOf("java.lang.") == 0) { diff --git a/processing/app/PdeRuntime.java b/processing/app/PdeRuntime.java index d6bf1c925..90fd88243 100644 --- a/processing/app/PdeRuntime.java +++ b/processing/app/PdeRuntime.java @@ -4,8 +4,8 @@ PdeRuntime - runs compiled java applet Part of the Processing project - http://processing.org - Except where noted, code is written by Ben Fry and - Copyright (c) 2001-03 Massachusetts Institute of Technology + Except where noted, code is written by Ben Fry and is + Copyright (c) 2001-04 Massachusetts Institute of Technology This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,6 +47,7 @@ public class PdeRuntime implements PdeMessageConsumer { boolean newMessage; int messageLineCount; + boolean foundMessageSource; Process process; OutputStream processOutput; @@ -356,17 +357,20 @@ public class PdeRuntime implements PdeMessageConsumer { // this is BApplet sending a message saying "i'm about to spew // a stack trace because an error occurred during BApplet.run()" if (s.indexOf(BApplet.LEECH_WAKEUP) == 0) { - //System.err.println("got wakeup"); + // newMessage being set to 'true' means that the next time + // message() is called, expect the first line of the actual + // error message & stack trace to be sent from the applet. newMessage = true; return; // this line ignored } // if s.length <=2, ignore it because that probably means - // that it's just the platform line-terminators. + // that it's just the platform line-terminators. if (newMessage && s.length() > 2) { exception = new PdeException(s); // type of java ex //System.out.println("setting ex type to " + s); newMessage = false; + foundMessageSource = false; messageLineCount = 0; } else { @@ -375,8 +379,69 @@ public class PdeRuntime implements PdeMessageConsumer { // TODO this is insufficient. need to cycle through the // different classes that are currently loaded and see if // there is an error in one of them. - String className = sketch.mainClassName; + //String className = sketch.mainClassName; + //\s+at\s([\w\d\._]+)\.([\<\w\d_]+)\(([\w\d_].java\:(\d+) + + /* +java.lang.NullPointerException + at javatest.(javatest.java:5) + at Temporary_2425_1153.draw(Temporary_2425_1153.java:11) + at BApplet.nextFrame(BApplet.java:481) + at BApplet.run(BApplet.java:428) + at java.lang.Thread.run(Unknown Source) + */ + + if (!foundMessageSource) { + // " at javatest.(javatest.java:5)" + // -> "javatest.(javatest.java:5)" + int afterAt = s.indexOf("at") + 3; + if (afterAt == -1) { + System.err.println(s); + return; + } + s = s.substring(afterAt + 1); + + // "javatest.(javatest.java:5)" + // -> "javatest." and "(javatest.java:5)" + int startParen = s.indexOf('('); + // at javatest.(javatest.java:5) + String pkgClassFxn = null; + //String fileLine = null; + int codeIndex = -1; + int lineIndex = -1; + + if (startParen == -1) { + pkgClassFxn = s; + + } else { + pkgClassFxn = s.substring(0, startParen); + // "(javatest.java:5)" + String fileAndLine = s.substring(startParen + 1); + fileAndLine = fileAndLine.substring(0, fileAndLine.length() - 1); + //if (!fileAndLine.equals("Unknown Source")) { + // "javatest.java:5" + int colonIndex = fileAndLine.indexOf(':'); + if (colonIndex != -1) { + String filename = fileAndLine.substring(0, colonIndex); + // "javatest.java" and "5" + for (int i = 0; i < sketch.codeCount; i++) { + if (sketch.code[i].preprocName.equals(filename)) { + codeIndex = i; + break; + } + } + // lineIndex is 1-indexed, but editor wants zero-indexed + lineIndex = Integer.parseInt(fileAndLine.substring(colonIndex + 1)); + //System.out.println("code/line is " + codeIndex + " " + lineIndex); + exception = new PdeException(exception.getMessage(), + codeIndex, lineIndex - 1, -1); + foundMessageSource = true; + } + } + editor.error(exception); + + /* int index = s.indexOf(className + ".java"); if (index != -1) { int len = (className + ".java").length(); @@ -385,10 +450,14 @@ public class PdeRuntime implements PdeMessageConsumer { lineNumberStr = lineNumberStr.substring(0, index); try { exception.line = Integer.parseInt(lineNumberStr) - 1; //2; - editor.error(exception); - } catch (NumberFormatException e) { - e.printStackTrace(); // a recursive error waiting to happen? - } + } catch (NumberFormatException e) { } + //e.printStackTrace(); // a recursive error waiting to happen? + // if nfe occurs, who cares, still send the error on up + editor.error(exception); + */ + + /* + // WARNING THESE ARE DISABLED!! } else if ((index = s.indexOf(className + ".class")) != -1) { // code to check for: // at Temporary_484_3845.loop(Compiled Code) @@ -412,16 +481,17 @@ public class PdeRuntime implements PdeMessageConsumer { // because pootie() (re)sets the exception title // and throws it, but then the line number gets set // because of the line that comes after - + */ + } else if (messageLineCount > 5) { // this means the class name may not be mentioned // in the stack trace.. this is just a general purpose // error, but needs to make it through anyway. // so if five lines have gone past, might as well signal - //System.out.println("signalling"); messageLineCount = -100; exception = new PdeException(exception.getMessage()); editor.error(exception); + } else { //System.err.print(s); } diff --git a/processing/app/PdeSketch.java b/processing/app/PdeSketch.java index 543b14717..5c71d5258 100644 --- a/processing/app/PdeSketch.java +++ b/processing/app/PdeSketch.java @@ -1042,7 +1042,7 @@ public class PdeSketch { } catch (antlr.RecognitionException re) { // this even returns a column - throw new PdeException(re.getMessage(), + throw new PdeException(re.getMessage(), i, re.getLine() - 1, re.getColumn()); } catch (antlr.TokenStreamRecognitionException tsre) { @@ -1071,10 +1071,11 @@ public class PdeSketch { int line = Integer.parseInt(result.group(1).toString()); int column = Integer.parseInt(result.group(2).toString()); - throw new PdeException(tsre.getMessage(), line-1, column); + throw new PdeException(tsre.getMessage(), i, line-1, column); } else { - throw new PdeException(tsre.toString()); + //throw new PdeException(tsre.toString()); + throw new PdeException(tsre.toString(), i, -1, -1); } } catch (PdeException pe) { @@ -1100,19 +1101,15 @@ public class PdeSketch { return success ? primaryClassName : null; } - /** * Called by PdeEditor to handle someone having selected 'export'. * Pops up a dialog box for export options, and then calls the * necessary function with the parameters from the window. * - * * +-------------------------------------------------------+ * + + * + Export to: [ Applet (for the web) + ] [ OK ] + * + + - * + [ ] OK to overwrite HTML file <-- gray out if no existing folder.. - * + remembers previous setting as a pref * + > Advanced + * + + * + - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/processing/todo.txt b/processing/todo.txt index 07cca4a5b..79b548f82 100644 --- a/processing/todo.txt +++ b/processing/todo.txt @@ -139,14 +139,21 @@ X nope, they aren't properly.. need to figure this out X empty files = no class name found.. that's a problem 040623 wednesday afternoon -_ continue work on multi-file compile +X continue work on multi-file compile X test that .java files can be created X allow user to type a period '.' when entering filename X but remove it again if it's not .pde or .java X clean up error handling for empty files (quiet error) +X preproc messages don't say the file -_ errors in other files aren't bubbling up +040706 first day with creas +X runtime errors not making it through +X now properly handling multiple files +X also test with multiple files / external run +X oh wait, this is only for external run.. duh +o jikes messages are getting lost (?) +_ is PdeEditorHeader one pixel too tall? _ see if sonia project can compile _ write options dialog for export _ write export-to-application @@ -157,6 +164,13 @@ _ don't force everything into a single .jar on export _ ctrl-t doesn't always work _ after using the popup menu once, it stops working +_ jikes is exporting column as well.. use it? +_ 3:23:3:25 -> line 3, col 23 to 25 +_ shut off jit errors.. make sure exceptions with .class work + +_ netscape.javascript not properly working in 1.4 +_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1088034754;start=0 + _ running present mode with a bug in the program hoses things _ make sure the program compiles before starting present mode _ make some fancy extendo things because the tabs get too big @@ -166,21 +180,78 @@ now implemented for [url=http://processing.org/discourse/yabb/YaBB.cgi?board=Col discuss with casey _ how should history be handled +X per-sketch, not per-file +X just looks like old history setup anyways +_ add a "make archive" option +_ doesn't rename sketch, just names zip file sketch + time stamp _ then re-implement history -_ is the sketch folder something that is never seen by the user? -_ i.e. flash programs 'import' all data, etc -_ same with how imovie works -_ comments -> embedding in applet text? (ala javadoc) -_ would this help casey with the examples? -_ how to handle .pde vs .java -_ how to determine what the 'main' file is -_ sun won't want us to say things are .java when they aren't -_ .pde files opened on their own -_ what should the prefs file be named? -_ horizontal buttons? need final decision -_ remove underscores from the tab title? -_ need nice yes/no dialog boxes, also showError/Message/Warning -_ does "Open" go at the beginning or end of the sketch popup +X is the sketch folder something that is never seen by the user? +X i.e. flash programs 'import' all data, etc +X same with how imovie works +X no, not for 1.0 + +_ javadoc "advanced" reference by beta +_ and then finalizing it towards 1.0 + +_ general input on ui confusion + +_ don't bother with 'advanced' on export dialog +_ that can come later, if needed +X how to handle .pde vs .java +X how to determine what the 'main' file is +X sun won't want us to say things are .java when they aren't +_ add .java to file name in the tab +X .pde files opened on their own +_ implement double-clicking from the explorer/finder +X what should the prefs file be named? +_ Processing Preferences.txt +X horizontal buttons? need final decision +_ yes, now implement them +X remove underscores from the tab title? +X nope, casey says not necessary +X need nice yes/no dialog boxes, also showError/Message/Warning +_ need design from casey +_ then implement new design (with exception trace) +o does "Open" go at the beginning or end of the sketch popup +X we need opengl support in there +X otherwise we're going to be stuck behind director +_ go with sun's jogl project +_ menu option for Renderer > to "Core" or "OpenGL" +_ on export, uses this setting to determine if jogl is added to project +X core.jar included with .class? or make one jar? +_ bring this up for discussion on the board +_ will splitting actually help.. can jars come from multiple places? +_ libraries and package naming for core & serial etc +_ processing.app -> PdeBase, PdeEditor.. +_ processing.core -> PApplet, PGraphics, PLine, PTriangle, PPolygon +_ processing.serial -> PSerial, [PUsb] +_ processing.video -> PMovie (file), PCamera (capture) +_ processing.net -> PClient, PServer +X vec3f, matrix4f classes.. our own or java3d? +_ make an example that uses the java3d classes +_ add a lighting object +_ fix lighting.. look at simon's changes + +? _ new/old graphics, explicitly stating 2d/3d, huh? +? _ what to do about anti-aliasing.. oversample 2x? + +_ api for file-based renderers +_ size(0, 0) and then ai.size(10000, 20000) +_ saveFrame(PRenderer) or saveFrame("name", PRenderer) + +major bugs +_ texture mapping bugs in graphics engine + +1 _ examples/libraries: +1 _ arcball, joystick, particles (from multip) +1 _ other phyics (collisions) + +2 _ comments -> embedding in applet text? (ala javadoc) +2 _ would this help casey with the examples? +2 _ physics library +2 _ look at the 'havoc' physics library +2 _ materials and shading +2 _ camera object for moving scene _ NullPointerException when alt is pressed _ might be something to do with the applet frame being an awt not swing