mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
major fix to get code folder working, more error messages coming through
properly
This commit is contained in:
+53
-51
@@ -4,8 +4,8 @@
|
||||
PdeCompiler - default compiler class that connects to jikes
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2001-03
|
||||
Ben Fry, Massachusetts Institute of Technology and
|
||||
Copyright (c) 2001-03
|
||||
Ben Fry, Massachusetts Institute of Technology and
|
||||
Casey Reas, Interaction Design Institute Ivrea
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -18,8 +18,8 @@
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
@@ -31,9 +31,9 @@ import java.util.zip.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class PdeCompiler implements PdeMessageConsumer {
|
||||
static final String BUGS_URL =
|
||||
static final String BUGS_URL =
|
||||
"http://processing.org/bugs/";
|
||||
static final String SUPER_BADNESS =
|
||||
static final String SUPER_BADNESS =
|
||||
"Compiler error, please submit this code to " + BUGS_URL;
|
||||
|
||||
PdeSketch sketch;
|
||||
@@ -46,7 +46,7 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
//PdeEditor editor;
|
||||
|
||||
/*
|
||||
public PdeCompiler(String buildPath, String className,
|
||||
public PdeCompiler(String buildPath, String className,
|
||||
File includeFolder, PdeEditor editor) {
|
||||
this.buildPath = buildPath;
|
||||
this.includeFolder = includeFolder;
|
||||
@@ -61,12 +61,12 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
public PdeCompiler() { } // consider this a warning, you werkin soon.
|
||||
|
||||
|
||||
public boolean compile(PdeSketch sketch, String buildPath)
|
||||
public boolean compile(PdeSketch sketch, String buildPath)
|
||||
throws PdeException {
|
||||
|
||||
this.sketch = sketch;
|
||||
this.buildPath = buildPath;
|
||||
|
||||
|
||||
// the pms object isn't used for anything but storage
|
||||
PdeMessageStream pms = new PdeMessageStream(this);
|
||||
|
||||
@@ -80,7 +80,7 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
// this doesn't help much.. also java 1.4 seems to not support
|
||||
// -source 1.1 for javac, and jikes seems to also have dropped it.
|
||||
// for versions of jikes that don't complain, "final int" inside
|
||||
// a function doesn't throw an error, so it could just be a
|
||||
// a function doesn't throw an error, so it could just be a
|
||||
// ms jvm error that this sort of thing doesn't work. blech.
|
||||
//"-source",
|
||||
//"1.1",
|
||||
@@ -120,16 +120,17 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
System.arraycopy(baseCommand, 0, command, 0, baseCommand.length);
|
||||
// append each of the files to the command string
|
||||
for (int i = 0; i < preprocCount; i++) {
|
||||
command[baseCommand.length + i] =
|
||||
command[baseCommand.length + i] =
|
||||
buildPath + File.separator + preprocNames[i];
|
||||
}
|
||||
//PApplet.printarr(command);
|
||||
|
||||
/*
|
||||
String command[] = new String[baseCommand.length + sketch.codeCount];
|
||||
System.arraycopy(baseCommand, 0, command, 0, baseCommand.length);
|
||||
// append each of the files to the command string
|
||||
for (int i = 0; i < sketch.codeCount; i++) {
|
||||
command[baseCommand.length + i] =
|
||||
command[baseCommand.length + i] =
|
||||
buildPath + File.separator + sketch.code[i].preprocName;
|
||||
}
|
||||
*/
|
||||
@@ -142,15 +143,15 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
secondErrorFound = false;
|
||||
|
||||
int result = 0; // pre-initialized to quiet a bogus warning from jikes
|
||||
try {
|
||||
// execute the compiler, and create threads to deal
|
||||
try {
|
||||
// execute the compiler, and create threads to deal
|
||||
// with the input and error streams
|
||||
//
|
||||
Process process = Runtime.getRuntime().exec(command);
|
||||
new PdeMessageSiphon(process.getInputStream(), this);
|
||||
new PdeMessageSiphon(process.getErrorStream(), this);
|
||||
|
||||
// wait for the process to finish. if interrupted
|
||||
// wait for the process to finish. if interrupted
|
||||
// before waitFor returns, continue waiting
|
||||
//
|
||||
boolean compiling = true;
|
||||
@@ -184,7 +185,7 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
// to digest it, and the fact that they have five stomaches.
|
||||
//
|
||||
//System.out.println("throwing up " + exception);
|
||||
if (exception != null) throw exception;
|
||||
if (exception != null) throw exception;
|
||||
|
||||
// if the result isn't a known, expected value it means that something
|
||||
// is fairly wrong, one possibility is that jikes has crashed.
|
||||
@@ -205,20 +206,20 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
boolean secondErrorFound;
|
||||
|
||||
/**
|
||||
* Part of the PdeMessageConsumer interface, this is called
|
||||
* whenever a piece (usually a line) of error message is spewed
|
||||
* Part of the PdeMessageConsumer interface, this is called
|
||||
* whenever a piece (usually a line) of error message is spewed
|
||||
* out from the compiler. The errors are parsed for their contents
|
||||
* and line number, which is then reported back to PdeEditor.
|
||||
*/
|
||||
public void message(String s) {
|
||||
// This receives messages as full lines, so a newline needs
|
||||
// This receives messages as full lines, so a newline needs
|
||||
// to be added as they're printed to the console.
|
||||
System.err.println(s);
|
||||
|
||||
// ignore cautions
|
||||
if (s.indexOf("Caution") != -1) return;
|
||||
|
||||
// jikes always uses a forward slash character as its separator,
|
||||
// jikes always uses a forward slash character as its separator,
|
||||
// so replace any platform-specific separator characters before
|
||||
// attemping to compare
|
||||
//
|
||||
@@ -249,7 +250,7 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
|
||||
// skip past the path and parse the int after the first colon
|
||||
//
|
||||
String s1 = s.substring(partialStartIndex +
|
||||
String s1 = s.substring(partialStartIndex +
|
||||
partialTempPath.length() + 1);
|
||||
int colon = s1.indexOf(':');
|
||||
int lineNumber = Integer.parseInt(s1.substring(0, colon));
|
||||
@@ -287,14 +288,14 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
//err += "error:".length();
|
||||
String description = s1.substring(err + "Error:".length());
|
||||
description = description.trim();
|
||||
|
||||
|
||||
String hasLoop = "The method \"void loop();\" with default access";
|
||||
if (description.indexOf(hasLoop) != -1) {
|
||||
description =
|
||||
description =
|
||||
"Rename loop() to draw() in Processing 0070 and higher";
|
||||
}
|
||||
|
||||
String constructorProblem =
|
||||
String constructorProblem =
|
||||
"No applicable overload was found for a constructor of type";
|
||||
if (description.indexOf(constructorProblem) != -1) {
|
||||
//"simong.particles.ParticleSystem". Perhaps you wanted the overloaded version "ParticleSystem();" instead?
|
||||
@@ -313,17 +314,17 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
if (description.indexOf(classpathProblem) != -1) {
|
||||
if (description.indexOf("quicktime/std") != -1) {
|
||||
// special case for the quicktime libraries
|
||||
description =
|
||||
description =
|
||||
"To run sketches that use the Processing video library, " +
|
||||
"you must first install QuickTime for Java.";
|
||||
|
||||
} else {
|
||||
int nextSentence = description.indexOf(". Package") + 2;
|
||||
description =
|
||||
description.substring(nextSentence, description.indexOf(':')) +
|
||||
description =
|
||||
description.substring(nextSentence, description.indexOf(':')) +
|
||||
" the code folder or in any libraries.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//System.out.println("description = " + description);
|
||||
//System.out.println("creating exception " + exception);
|
||||
@@ -341,9 +342,9 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
// this isn't the start of an error line, so don't attempt to parse
|
||||
// a line number out of it.
|
||||
|
||||
// if the second error hasn't been discovered yet, these lines
|
||||
// are probably associated with the first error message,
|
||||
// which is already in the status bar, and are likely to be
|
||||
// if the second error hasn't been discovered yet, these lines
|
||||
// are probably associated with the first error message,
|
||||
// which is already in the status bar, and are likely to be
|
||||
// of interest to the user, so spit them to the console.
|
||||
//
|
||||
if (!secondErrorFound) {
|
||||
@@ -359,7 +360,7 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
if (bootClassPath == null) {
|
||||
String additional = "";
|
||||
if (PdeBase.platform == PdeBase.MACOSX) {
|
||||
additional =
|
||||
additional =
|
||||
contentsToClassPath(new File("/System/Library/Java/Extensions/"));
|
||||
}
|
||||
bootClassPath = System.getProperty("sun.boot.class.path") + additional;
|
||||
@@ -368,16 +369,16 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
///
|
||||
|
||||
|
||||
/**
|
||||
* Return the path for a folder, with appended paths to
|
||||
* Return the path for a folder, with appended paths to
|
||||
* any .jar or .zip files inside that folder.
|
||||
* This will prepend a colon (or whatever the path separator is)
|
||||
* so that it can be directly appended to another path string.
|
||||
*
|
||||
* This will always add the root folder as well, and doesn't bother
|
||||
* This will always add the root folder as well, and doesn't bother
|
||||
* checking to see if there are any .class files in the folder or
|
||||
* within a subfolder.
|
||||
*/
|
||||
@@ -407,7 +408,7 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
abuffer.append(list[i]);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace(); // this would be odd
|
||||
}
|
||||
//System.out.println("included path is " + abuffer.toString());
|
||||
@@ -426,14 +427,14 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
*/
|
||||
static public String[] packageListFromClassPath(String path) {
|
||||
Hashtable table = new Hashtable();
|
||||
String pieces[] =
|
||||
String pieces[] =
|
||||
PApplet.split(path, File.pathSeparatorChar);
|
||||
|
||||
for (int i = 0; i < pieces.length; i++) {
|
||||
//System.out.println("checking piece '" + pieces[i] + "'");
|
||||
if (pieces[i].length() == 0) continue;
|
||||
|
||||
if (pieces[i].toLowerCase().endsWith(".jar") ||
|
||||
if (pieces[i].toLowerCase().endsWith(".jar") ||
|
||||
pieces[i].toLowerCase().endsWith(".zip")) {
|
||||
packageListFromZip(pieces[i], table);
|
||||
|
||||
@@ -441,8 +442,8 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
File dir = new File(pieces[i]);
|
||||
if (dir.exists() && dir.isDirectory()) {
|
||||
packageListFromFolder(dir, null, table);
|
||||
//importCount = magicImportsRecursive(dir, null,
|
||||
// table);
|
||||
//importCount = magicImportsRecursive(dir, null,
|
||||
// table);
|
||||
//imports, importCount);
|
||||
}
|
||||
}
|
||||
@@ -455,6 +456,7 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
output[index++] = ((String) e.nextElement()).replace('/', '.');
|
||||
}
|
||||
//System.arraycopy(imports, 0, output, 0, importCount);
|
||||
//PApplet.printarr(output);
|
||||
return output;
|
||||
}
|
||||
|
||||
@@ -471,7 +473,7 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
|
||||
if (name.endsWith(".class")) {
|
||||
int slash = name.lastIndexOf('/');
|
||||
if (slash == -1) continue;
|
||||
if (slash == -1) continue;
|
||||
|
||||
String pname = name.substring(0, slash);
|
||||
if (table.get(pname) == null) {
|
||||
@@ -489,13 +491,13 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
|
||||
/**
|
||||
* Make list of package names by traversing a directory hierarchy.
|
||||
* Each time a class is found in a folder, add its containing set
|
||||
* of folders to the package list. If another folder is found,
|
||||
* Each time a class is found in a folder, add its containing set
|
||||
* of folders to the package list. If another folder is found,
|
||||
* walk down into that folder and continue.
|
||||
*/
|
||||
static private void packageListFromFolder(File dir, String sofar,
|
||||
static private void packageListFromFolder(File dir, String sofar,
|
||||
Hashtable table) {
|
||||
//String imports[],
|
||||
//String imports[],
|
||||
//int importCount) {
|
||||
//System.err.println("checking dir '" + dir + "'");
|
||||
boolean foundClass = false;
|
||||
@@ -506,12 +508,12 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
|
||||
File sub = new File(dir, files[i]);
|
||||
if (sub.isDirectory()) {
|
||||
String nowfar =
|
||||
String nowfar =
|
||||
(sofar == null) ? files[i] : (sofar + "." + files[i]);
|
||||
packageListFromFolder(sub, nowfar, table);
|
||||
//System.out.println(nowfar);
|
||||
//imports[importCount++] = nowfar;
|
||||
//importCount = magicImportsRecursive(sub, nowfar,
|
||||
//importCount = magicImportsRecursive(sub, nowfar,
|
||||
// imports, importCount);
|
||||
} else if (!foundClass) { // if no classes found in this folder yet
|
||||
if (files[i].endsWith(".class")) {
|
||||
@@ -525,9 +527,9 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
}
|
||||
|
||||
/*
|
||||
static public int magicImportsRecursive(File dir, String sofar,
|
||||
static public int magicImportsRecursive(File dir, String sofar,
|
||||
Hashtable table) {
|
||||
//String imports[],
|
||||
//String imports[],
|
||||
//int importCount) {
|
||||
System.err.println("checking dir '" + dir + "'");
|
||||
String files[] = dir.list();
|
||||
@@ -536,12 +538,12 @@ public class PdeCompiler implements PdeMessageConsumer {
|
||||
|
||||
File sub = new File(dir, files[i]);
|
||||
if (sub.isDirectory()) {
|
||||
String nowfar = (sofar == null) ?
|
||||
String nowfar = (sofar == null) ?
|
||||
files[i] : (sofar + "." + files[i]);
|
||||
//System.out.println(nowfar);
|
||||
imports[importCount++] = nowfar;
|
||||
|
||||
importCount = magicImportsRecursive(sub, nowfar,
|
||||
importCount = magicImportsRecursive(sub, nowfar,
|
||||
imports, importCount);
|
||||
}
|
||||
}
|
||||
|
||||
+19
-4
@@ -24,9 +24,10 @@
|
||||
|
||||
|
||||
public class PdeException extends Exception {
|
||||
int file = -1;
|
||||
int line = -1;
|
||||
int column = -1;
|
||||
public int file = -1;
|
||||
public int line = -1;
|
||||
public int column = -1;
|
||||
public boolean hideStackTrace;
|
||||
|
||||
public PdeException() { }
|
||||
|
||||
@@ -52,7 +53,14 @@ public class PdeException extends Exception {
|
||||
this.column = column;
|
||||
}
|
||||
|
||||
// make static so that super() can call it
|
||||
|
||||
/**
|
||||
* Nix the java.lang crap out of an exception message
|
||||
* because it scares the children.
|
||||
*
|
||||
* This function must be static to be used with super()
|
||||
* in each of the constructors above.
|
||||
*/
|
||||
static public final String massage(String msg) {
|
||||
if (msg.indexOf("java.lang.") == 0) {
|
||||
//int dot = msg.lastIndexOf('.');
|
||||
@@ -61,4 +69,11 @@ public class PdeException extends Exception {
|
||||
return msg;
|
||||
//return (dot == -1) ? msg : msg.substring(dot+1);
|
||||
}
|
||||
|
||||
|
||||
public void printStackTrace() {
|
||||
if (!hideStackTrace) {
|
||||
super.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+52
-31
@@ -7,7 +7,7 @@
|
||||
Except where noted, code is written by Ben Fry and
|
||||
Copyright (c) 2001-03 Massachusetts Institute of Technology
|
||||
|
||||
ANTLR-generated parser and several supporting classes written
|
||||
ANTLR-generated parser and several supporting classes written
|
||||
by Dan Mosedale via funding from the Interaction Institute IVREA.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -20,8 +20,8 @@
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
@@ -50,11 +50,15 @@ public class PdePreprocessor {
|
||||
// it to produce a package name consistently.
|
||||
String extraImports[];
|
||||
|
||||
// imports just from the code folder, treated differently
|
||||
// than the others, since the imports are auto-generated.
|
||||
String codeFolderImports[];
|
||||
|
||||
static final int STATIC = 0; // formerly BEGINNER
|
||||
static final int ACTIVE = 1; // formerly INTERMEDIATE
|
||||
static final int JAVA = 2; // formerly ADVANCED
|
||||
// static to make it easier for the antlr preproc to get at it
|
||||
static int programType = -1;
|
||||
static int programType = -1;
|
||||
|
||||
Reader programReader;
|
||||
String buildPath;
|
||||
@@ -67,12 +71,12 @@ public class PdePreprocessor {
|
||||
* These may change in-between (if the prefs panel adds this option)
|
||||
* so grab them here on construction.
|
||||
*/
|
||||
public PdePreprocessor() {
|
||||
defaultImports[JDK11] =
|
||||
public PdePreprocessor() {
|
||||
defaultImports[JDK11] =
|
||||
PApplet.split(PdePreferences.get("preproc.imports.jdk11"), ',');
|
||||
defaultImports[JDK13] =
|
||||
defaultImports[JDK13] =
|
||||
PApplet.split(PdePreferences.get("preproc.imports.jdk13"), ',');
|
||||
defaultImports[JDK14] =
|
||||
defaultImports[JDK14] =
|
||||
PApplet.split(PdePreferences.get("preproc.imports.jdk14"), ',');
|
||||
}
|
||||
|
||||
@@ -87,9 +91,10 @@ public class PdePreprocessor {
|
||||
* preprocesses a pde file and write out a java file
|
||||
* @return the classname of the exported Java
|
||||
*/
|
||||
//public String write(String program, String buildPath, String name,
|
||||
//public String write(String program, String buildPath, String name,
|
||||
// String extraImports[]) throws java.lang.Exception {
|
||||
public String write(String program, String buildPath, String name)
|
||||
public String write(String program, String buildPath,
|
||||
String name, String codeFolderPackages[])
|
||||
throws java.lang.Exception {
|
||||
// if the program ends with no CR or LF an OutOfMemoryError will happen.
|
||||
// not gonna track down the bug now, so here's a hack for it:
|
||||
@@ -107,7 +112,7 @@ public class PdePreprocessor {
|
||||
}
|
||||
// if non-ascii chars are in there, convert to unicode escapes
|
||||
if (unicodeCount != 0) {
|
||||
// add unicodeCount * 5.. replacing each unicode char
|
||||
// add unicodeCount * 5.. replacing each unicode char
|
||||
// with six digit uXXXX sequence (xxxx is in hex)
|
||||
// (except for nbsp chars which will be a replaced with a space)
|
||||
int index = 0;
|
||||
@@ -135,7 +140,7 @@ public class PdePreprocessor {
|
||||
}
|
||||
}
|
||||
|
||||
// if this guy has his own imports, need to remove them
|
||||
// if this guy has his own imports, need to remove them
|
||||
// just in case it's not an advanced mode sketch
|
||||
PatternMatcher matcher = new Perl5Matcher();
|
||||
PatternCompiler compiler = new Perl5Compiler();
|
||||
@@ -163,7 +168,7 @@ public class PdePreprocessor {
|
||||
int len = piece.length();
|
||||
|
||||
//imports.add(piece);
|
||||
imports.add(piece2);
|
||||
imports.add(piece2);
|
||||
int idx = program.indexOf(piece);
|
||||
// just remove altogether?
|
||||
program = program.substring(0, idx) + program.substring(idx + len);
|
||||
@@ -172,26 +177,43 @@ public class PdePreprocessor {
|
||||
|
||||
} while (true);
|
||||
|
||||
//if (imports.size() > 0) {
|
||||
extraImports = new String[imports.size()];
|
||||
int importsCount = imports.size();
|
||||
extraImports = new String[importsCount];
|
||||
imports.copyInto(extraImports);
|
||||
//}
|
||||
|
||||
//
|
||||
/*
|
||||
if (codeFolderPackages != null) {
|
||||
extraImports = new String[importsCount + codeFolderPackages.length];
|
||||
imports.copyInto(extraImports);
|
||||
for (int i = 0; i < codeFolderPackages.length; i++) {
|
||||
extraImports[importsCount + i] = codeFolderPackages[i] + ".*";
|
||||
}
|
||||
codeFolderImports = null;
|
||||
}
|
||||
*/
|
||||
|
||||
if (codeFolderPackages != null) {
|
||||
codeFolderImports = new String[codeFolderPackages.length];
|
||||
for (int i = 0; i < codeFolderPackages.length; i++) {
|
||||
codeFolderImports[i] = codeFolderPackages[i] + ".*";
|
||||
}
|
||||
} else {
|
||||
codeFolderImports = null;
|
||||
}
|
||||
|
||||
// do this after the program gets re-combobulated
|
||||
this.programReader = new StringReader(program);
|
||||
this.buildPath = buildPath;
|
||||
|
||||
// create a lexer with the stream reader, and tell it to handle
|
||||
// create a lexer with the stream reader, and tell it to handle
|
||||
// hidden tokens (eg whitespace, comments) since we want to pass these
|
||||
// through so that the line numbers when the compiler reports errors
|
||||
// match those that will be highlighted in the PDE IDE
|
||||
//
|
||||
//
|
||||
PdeLexer lexer = new PdeLexer(programReader);
|
||||
lexer.setTokenObjectClass("antlr.CommonHiddenStreamToken");
|
||||
|
||||
// create the filter for hidden tokens and specify which tokens to
|
||||
// create the filter for hidden tokens and specify which tokens to
|
||||
// hide and which to copy to the hidden text
|
||||
//
|
||||
filter = new TokenStreamCopyingHiddenTokenFilter(lexer);
|
||||
@@ -238,9 +260,9 @@ public class PdePreprocessor {
|
||||
name = getFirstClassName(parserAST);
|
||||
}
|
||||
|
||||
// if 'null' was passed in for the name, but this isn't
|
||||
// if 'null' was passed in for the name, but this isn't
|
||||
// a 'java' mode class, then there's a problem, so punt.
|
||||
//
|
||||
//
|
||||
if (name == null) return null;
|
||||
|
||||
// output the code
|
||||
@@ -281,7 +303,7 @@ public class PdePreprocessor {
|
||||
|
||||
/**
|
||||
* Write any required header material (eg imports, class decl stuff)
|
||||
*
|
||||
*
|
||||
* @param out PrintStream to write it to.
|
||||
* @param exporting Is this being exported from PDE?
|
||||
* @param name Name of the class being created.
|
||||
@@ -297,13 +319,12 @@ public class PdePreprocessor {
|
||||
out.print("import " + extraImports[i] + "; ");
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (imports != null) {
|
||||
for (int i = 0; i < imports.length; i++) {
|
||||
out.print(imports[i]);
|
||||
}
|
||||
|
||||
if (codeFolderImports != null) {
|
||||
for (int i = 0; i < codeFolderImports.length; i++) {
|
||||
out.print("import " + codeFolderImports[i] + "; ");
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// emit standard imports (read from pde.properties)
|
||||
// for each language level that's being used.
|
||||
@@ -315,7 +336,7 @@ public class PdePreprocessor {
|
||||
|
||||
for (int i = 0; i <= jdkVersion; i++) {
|
||||
for (int j = 0; j < defaultImports[i].length; j++) {
|
||||
out.print("import " + defaultImports[i][j] + ".*; ");
|
||||
out.print("import " + defaultImports[i][j] + ".*; ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,7 +357,7 @@ public class PdePreprocessor {
|
||||
|
||||
/**
|
||||
* Write any necessary closing text.
|
||||
*
|
||||
*
|
||||
* @param out PrintStream to write it to.
|
||||
*/
|
||||
void writeFooter(PrintStream out) {
|
||||
|
||||
+19
-11
@@ -111,6 +111,7 @@ public class PdeRuntime implements PdeMessageConsumer {
|
||||
//, "1>", "C:\\net1.txt"
|
||||
//, "2>", "C:\\net2.txt"
|
||||
};
|
||||
//PApplet.printarr(command);
|
||||
|
||||
//for (int i = 0; i < command.length; i++) {
|
||||
// System.out.println(i + " = " + command[i]);
|
||||
@@ -121,7 +122,6 @@ public class PdeRuntime implements PdeMessageConsumer {
|
||||
processInput = new SystemOutSiphon(process.getInputStream());
|
||||
processError = new PdeMessageSiphon(process.getErrorStream(), this);
|
||||
processOutput = process.getOutputStream();
|
||||
//process.waitFor();
|
||||
|
||||
} else { // !externalRuntime
|
||||
//Class c = Class.forName(className);
|
||||
@@ -302,8 +302,9 @@ public class PdeRuntime implements PdeMessageConsumer {
|
||||
// this handles errors that happen inside setup()
|
||||
e.printStackTrace();
|
||||
|
||||
// mod by fry for removal of KjcEngine
|
||||
applet.finished = true;
|
||||
// make sure applet is in use
|
||||
if (applet != null) applet.finished = true;
|
||||
|
||||
leechErr.println(PApplet.LEECH_WAKEUP);
|
||||
e.printStackTrace(this.leechErr);
|
||||
}
|
||||
@@ -383,14 +384,6 @@ public class PdeRuntime implements PdeMessageConsumer {
|
||||
return;
|
||||
}
|
||||
|
||||
// these are used for debugging, in case there are concerns
|
||||
// that som errors aren't coming through properly
|
||||
/*
|
||||
if (s.length() > 2) {
|
||||
System.err.println("message " + s.length() + ":" + s);
|
||||
}
|
||||
*/
|
||||
|
||||
// this is PApplet sending a message saying "i'm about to spew
|
||||
// a stack trace because an error occurred during PApplet.run()"
|
||||
if (s.indexOf(PApplet.LEECH_WAKEUP) == 0) {
|
||||
@@ -401,10 +394,23 @@ public class PdeRuntime implements PdeMessageConsumer {
|
||||
return; // this line ignored
|
||||
}
|
||||
|
||||
// these are used for debugging, in case there are concerns
|
||||
// that some errors aren't coming through properly
|
||||
/*
|
||||
if (s.length() > 2) {
|
||||
System.err.println(newMessage);
|
||||
System.err.println("message " + s.length() + ":" + s);
|
||||
}
|
||||
*/
|
||||
// always shove out the mesage, since it might not fall under
|
||||
// the same setup as we're expecting
|
||||
System.err.print(s);
|
||||
|
||||
// if s.length <=2, ignore it because that probably means
|
||||
// that it's just the platform line-terminators.
|
||||
if (newMessage && s.length() > 2) {
|
||||
exception = new PdeException(s); // type of java ex
|
||||
exception.hideStackTrace = true;
|
||||
//System.out.println("setting ex type to " + s);
|
||||
newMessage = false;
|
||||
foundMessageSource = false;
|
||||
@@ -470,6 +476,7 @@ java.lang.NullPointerException
|
||||
//System.out.println("code/line is " + codeIndex + " " + lineIndex);
|
||||
exception = new PdeException(exception.getMessage(),
|
||||
codeIndex, lineIndex - 1, -1);
|
||||
exception.hideStackTrace = true;
|
||||
foundMessageSource = true;
|
||||
}
|
||||
}
|
||||
@@ -525,6 +532,7 @@ java.lang.NullPointerException
|
||||
// so if five lines have gone past, might as well signal
|
||||
messageLineCount = -100;
|
||||
exception = new PdeException(exception.getMessage());
|
||||
exception.hideStackTrace = true;
|
||||
editor.error(exception);
|
||||
|
||||
} else {
|
||||
|
||||
+29
-11
@@ -1007,7 +1007,7 @@ public class PdeSketch {
|
||||
protected String build(String buildPath, String suggestedClassName)
|
||||
throws PdeException {
|
||||
|
||||
//String importPackageList[] = null;
|
||||
String codeFolderPackages[] = null;
|
||||
|
||||
String javaClassPath = System.getProperty("java.class.path");
|
||||
// remove quotes if any.. this is an annoying thing on windows
|
||||
@@ -1025,10 +1025,28 @@ public class PdeSketch {
|
||||
//File codeFolder = new File(folder, "code");
|
||||
if (codeFolder.exists()) {
|
||||
externalRuntime = true;
|
||||
classPath += File.pathSeparator +
|
||||
PdeCompiler.contentsToClassPath(codeFolder);
|
||||
//importPackageList = PdeCompiler.packageListFromClassPath(classPath);
|
||||
|
||||
//classPath += File.pathSeparator +
|
||||
//PdeCompiler.contentsToClassPath(codeFolder);
|
||||
classPath =
|
||||
PdeCompiler.contentsToClassPath(codeFolder) +
|
||||
File.pathSeparator + classPath;
|
||||
|
||||
//codeFolderPackages = PdeCompiler.packageListFromClassPath(classPath);
|
||||
//codeFolderPackages = PdeCompiler.packageListFromClassPath(codeFolder);
|
||||
libraryPath = codeFolder.getAbsolutePath();
|
||||
|
||||
// get a list of .jar files in the "code" folder
|
||||
// (class files in subfolders should also be picked up)
|
||||
String codeFolderClassPath =
|
||||
PdeCompiler.contentsToClassPath(codeFolder);
|
||||
// get list of packages found in those jars
|
||||
codeFolderPackages =
|
||||
PdeCompiler.packageListFromClassPath(codeFolderClassPath);
|
||||
//PApplet.println(libraryPath);
|
||||
//PApplet.println("packages:");
|
||||
//PApplet.printarr(codeFolderPackages);
|
||||
|
||||
} else {
|
||||
// check to see if multiple files that include a .java file
|
||||
externalRuntime = false;
|
||||
@@ -1036,7 +1054,7 @@ public class PdeSketch {
|
||||
if (code[i].flavor == JAVA) externalRuntime = true;
|
||||
}
|
||||
//externalRuntime = (codeCount > 1); // may still be set true later
|
||||
//importPackageList = null;
|
||||
//codeFolderPackages = null;
|
||||
libraryPath = "";
|
||||
}
|
||||
|
||||
@@ -1074,10 +1092,10 @@ public class PdeSketch {
|
||||
// if (i != 0) preproc will fail if a pde file is not
|
||||
// java mode, since that's required
|
||||
String className =
|
||||
// preprocessor.write(bigCode.toString(), buildPath,
|
||||
// suggestedClassName);
|
||||
preprocessor.write(bigCode.toString(), buildPath,
|
||||
suggestedClassName);
|
||||
//preprocessor.write(bigCode.toString(), buildPath,
|
||||
// suggestedClassName, importPackageList);
|
||||
suggestedClassName, codeFolderPackages);
|
||||
if (className == null) {
|
||||
throw new PdeException("Could not find main class");
|
||||
// this situation might be perfectly fine,
|
||||
@@ -1179,10 +1197,10 @@ public class PdeSketch {
|
||||
String entry = imports[i].substring(0, imports[i].lastIndexOf('.'));
|
||||
//System.out.println("found package " + entry);
|
||||
File libFolder = (File) PdeSketchbook.importToLibraryTable.get(entry);
|
||||
//System.out.println(" found lib folder " + libFolder);
|
||||
|
||||
if (libFolder == null) {
|
||||
throw new PdeException("Could not find library for " + entry);
|
||||
//return null;
|
||||
//throw new PdeException("Could not find library for " + entry);
|
||||
continue;
|
||||
}
|
||||
|
||||
importedLibraries.add(libFolder);
|
||||
|
||||
@@ -7,6 +7,24 @@ X they weren't properly resetting
|
||||
|
||||
_ loadImage() is mostly broken
|
||||
|
||||
_ uv coords > 1 shouldn't clamp, they should just repeat ala opengl
|
||||
_ actually i think opengl has a setting for it
|
||||
_ textureMode(NORMAL_SPACE) screws up the image() command
|
||||
_ image() appears to require IMAGE_SPACE to function properly.
|
||||
|
||||
_ fishwick bug with text() and shapes
|
||||
_ ellipses no longer completed when g.dimensions = 2 or 3,
|
||||
_ or not even drawn.. what a mess.
|
||||
|
||||
_ renderers can plug in:
|
||||
_ at direct api level
|
||||
_ taking over all color() functions and vertex collection
|
||||
_ at endShape() level
|
||||
_ where vertices are collected by core and blit on endShape()
|
||||
_ (takes polygons and lines)
|
||||
_ at post tesselation level
|
||||
_ takes only line segments and triangles to blit (dxf writer)
|
||||
|
||||
_ vertices max out at 512.. make it grow
|
||||
|
||||
_ getAllFonts() not quite working for many fonts
|
||||
|
||||
@@ -4,6 +4,14 @@ o particle examples c & d don't have their extra files
|
||||
o let's not call it 'expert', let's just say w/o java
|
||||
X new thread-safer version of the PdeEditorConsole
|
||||
X add build for particles lib
|
||||
X fix a bug where 'code' folder was no longer working
|
||||
X code folder had been completely disabled
|
||||
X some error messages (i.e. DLL missing) not propogating up
|
||||
X change PdeRuntime to pass all messages, parse later
|
||||
|
||||
//
|
||||
|
||||
MESS TO SORT
|
||||
|
||||
_ make sure that the preproc stuff gets built once
|
||||
_ especially straight out of cvs
|
||||
@@ -15,9 +23,6 @@ macosx
|
||||
_ resize box intrudes on the scroller for the console area
|
||||
_ horizontal scroller is always present
|
||||
|
||||
|
||||
//
|
||||
|
||||
_ creating sketchbook / lab situations
|
||||
_ test to see if it's possible to write to "My Documents"
|
||||
_ if not, should bring up a prompt asking where to put sketchbook
|
||||
@@ -378,6 +383,9 @@ BUGS / Preprocessor
|
||||
1 _ but right now there's a hack to add a CR in PdePreprocessor
|
||||
1 _ return (int(5.5)) causes an error
|
||||
1 _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1083624993;start=0
|
||||
1 _ random, single slash in the code doesn't throw an error
|
||||
1 _ (just gets removed by the preprocessor)
|
||||
1 _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1099371066;start=0
|
||||
|
||||
|
||||
PDE / Font Builder
|
||||
|
||||
Reference in New Issue
Block a user