more major work on megabucket, new package structure, etc

This commit is contained in:
benfry
2004-07-08 06:16:46 +00:00
parent 2b1f1f5ab8
commit 5b080f8d49
11 changed files with 118 additions and 85 deletions
+3 -1
View File
@@ -23,6 +23,8 @@
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
import processing.core.*;
import java.io.*;
import java.util.*;
import java.util.zip.*;
@@ -365,7 +367,7 @@ public class PdeCompiler implements PdeMessageConsumer {
static public String[] makeImportsFromClassPath(String path) {
Hashtable table = new Hashtable();
String pieces[] =
BApplet.split(path, File.pathSeparatorChar);
PApplet.split(path, File.pathSeparatorChar);
for (int i = 0; i < pieces.length; i++) {
//System.out.println("checking piece '" + pieces[i] + "'");
+4 -2
View File
@@ -25,6 +25,7 @@
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.lang.reflect.*;
import java.net.*;
import java.util.*;
import java.util.zip.*;
@@ -242,8 +243,9 @@ implements MRJAboutHandler, MRJQuitHandler, MRJPrefsHandler
new Class[] { Boolean.TYPE });
undecoratedMethod.invoke(presentationWindow,
new Object[] { Boolean.TRUE });
} catch (NoSuchMethodError e) { }
} catch (Exception e) { }
//} catch (NoSuchMethodException e) { }
//} catch (NoSuchMethodError e) { }
presentationWindow.setBounds(0, 0, screen.width, screen.height);
}
+2 -1
View File
@@ -22,6 +22,7 @@
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
import processing.core.*;
import java.awt.*;
import java.awt.event.*;
@@ -368,7 +369,7 @@ public class PdeFontBuilder extends JFrame {
try {
font = new Font(list[selection], Font.PLAIN, fontsize);
BFont f = new BFont(font, smooth);
PFont2 f = new PFont2(font, smooth);
// make sure the 'data' folder exists
if (!targetFolder.exists()) targetFolder.mkdirs();
+6 -4
View File
@@ -25,6 +25,8 @@
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
import processing.core.*;
import java.io.*;
import antlr.*;
import antlr.collections.*;
@@ -57,11 +59,11 @@ public class PdePreprocessor {
*/
public PdePreprocessor() {
defaultImports[JDK11] =
BApplet.split(PdePreferences.get("compiler.imports.jdk11"), ',');
PApplet.split(PdePreferences.get("compiler.imports.jdk11"), ',');
defaultImports[JDK13] =
BApplet.split(PdePreferences.get("compiler.imports.jdk13"), ',');
PApplet.split(PdePreferences.get("compiler.imports.jdk13"), ',');
defaultImports[JDK14] =
BApplet.split(PdePreferences.get("compiler.imports.jdk14"), ',');
PApplet.split(PdePreferences.get("compiler.imports.jdk14"), ',');
}
@@ -253,7 +255,7 @@ public class PdePreprocessor {
if (programType < JAVA) {
// open the class definition
out.print("public class " + className + " extends BApplet {");
out.print("public class " + className + " extends PApplet {");
if (programType == STATIC) {
// now that size() and background() can go inside of draw()
+30 -26
View File
@@ -22,21 +22,23 @@
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
import processing.core.*;
import java.awt.*; // for window
import java.awt.event.*; // also for window
import java.io.*;
import java.lang.reflect.*;
#ifndef RXTX
import javax.comm.*;
#else
import gnu.io.*;
#endif
//#ifndef RXTX
//import javax.comm.*;
//#else
//import gnu.io.*;
//#endif
public class PdeRuntime implements PdeMessageConsumer {
BApplet applet;
PApplet applet;
PdeException exception;
Window window;
PrintStream leechErr;
@@ -77,11 +79,11 @@ public class PdeRuntime implements PdeMessageConsumer {
if (sketch.externalRuntime) {
// if there was a saved location (this guy has been run more than
// once) then windowLocation will be set to the last position of
// the sketch window. this will be passed to the BApplet runner
// the sketch window. this will be passed to the PApplet runner
// using something like --external=e30,20 where the e stands for
// exact. otherwise --external=x,y for just the regular positioning.
String location = (windowLocation != null) ?
(BApplet.EXTERNAL_EXACT_LOCATION +
(PApplet.EXTERNAL_EXACT_LOCATION +
windowLocation.x + "," + windowLocation.y) :
(x1 + "," + y1);
@@ -90,8 +92,8 @@ public class PdeRuntime implements PdeMessageConsumer {
"-Djava.library.path=" + sketch.libraryPath, // might be ""
"-cp",
sketch.classPath,
"BApplet",
BApplet.EXTERNAL_FLAG + location,
"PApplet",
PApplet.EXTERNAL_FLAG + location,
sketch.mainClassName
};
@@ -103,21 +105,23 @@ public class PdeRuntime implements PdeMessageConsumer {
} else {
//Class c = Class.forName(className);
Class c = Class.forName(sketch.mainClassName);
applet = (BApplet) c.newInstance();
applet = (PApplet) c.newInstance();
// replaces setRuntime with BApplet having leechErr [fry]
// replaces setRuntime with PApplet having leechErr [fry]
applet.leechErr = leechErr;
// has to be before init
//applet.serialProperties(PdePreferences.properties);
applet.init();
if (applet.exception != null) {
/*
TODO: fix me
if (applet.exception instanceof PortInUseException) {
throw new PdeException("Another program is already " +
"using the serial port.");
} else {
throw new PdeException(applet.exception.getMessage());
}
*/
throw new PdeException(applet.exception.getMessage());
}
applet.start();
@@ -208,8 +212,8 @@ public class PdeRuntime implements PdeMessageConsumer {
int appletWidth = applet.width;
int appletHeight = applet.height;
if ((appletWidth == 0) || (appletHeight == 0)) {
appletWidth = BApplet.DEFAULT_WIDTH;
appletWidth = BApplet.DEFAULT_HEIGHT;
appletWidth = PApplet.DEFAULT_WIDTH;
appletWidth = PApplet.DEFAULT_HEIGHT;
}
*/
@@ -273,7 +277,7 @@ public class PdeRuntime implements PdeMessageConsumer {
// mod by fry for removal of KjcEngine
applet.finished = true;
leechErr.println(BApplet.LEECH_WAKEUP);
leechErr.println(PApplet.LEECH_WAKEUP);
e.printStackTrace(this.leechErr);
}
}
@@ -332,16 +336,16 @@ public class PdeRuntime implements PdeMessageConsumer {
public void message(String s) {
// this is BApplet sending a message (via System.out.println)
// this is PApplet sending a message (via System.out.println)
// that signals that the applet has been quit.
if (s.indexOf(BApplet.EXTERNAL_QUIT) == 0) {
if (s.indexOf(PApplet.EXTERNAL_QUIT) == 0) {
editor.doClose();
return;
}
// this is the BApplet sending us a message that the applet
// this is the PApplet sending us a message that the applet
// is being moved to a new window location
if (s.indexOf(BApplet.EXTERNAL_MOVE) == 0) {
if (s.indexOf(PApplet.EXTERNAL_MOVE) == 0) {
String nums = s.substring(s.indexOf(' ') + 1);
int space = nums.indexOf(' ');
int left = Integer.parseInt(nums.substring(0, space));
@@ -354,9 +358,9 @@ public class PdeRuntime implements PdeMessageConsumer {
//System.err.println("message " + s.length() + ":" + s);
if (s.length() > 2) System.err.println(s);
// 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) {
// 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) {
// 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.
@@ -387,8 +391,8 @@ public class PdeRuntime implements PdeMessageConsumer {
java.lang.NullPointerException
at javatest.<init>(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 PApplet.nextFrame(PApplet.java:481)
at PApplet.run(PApplet.java:428)
at java.lang.Thread.run(Unknown Source)
*/
+5 -3
View File
@@ -22,6 +22,8 @@
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
import processing.core.*;
import java.awt.FileDialog;
import java.io.*;
import java.util.*;
@@ -1221,8 +1223,8 @@ public class PdeSketch {
}
if (writeHtml) {
int wide = BApplet.DEFAULT_WIDTH;
int high = BApplet.DEFAULT_HEIGHT;
int wide = PApplet.DEFAULT_WIDTH;
int high = PApplet.DEFAULT_HEIGHT;
//try {
PatternMatcher matcher = new Perl5Matcher();
@@ -1447,7 +1449,7 @@ public class PdeSketch {
static public void packClassPathIntoZipFile(String path,
ZipOutputStream zos)
throws IOException {
String pieces[] = BApplet.split(path, File.pathSeparatorChar);
String pieces[] = PApplet.split(path, File.pathSeparatorChar);
for (int i = 0; i < pieces.length; i++) {
if (pieces[i].length() == 0) continue;
@@ -11,7 +11,9 @@ com.apple.mrj.application.JVMVersion=1.3.1
# this will revert back to java 1.3, since 1.4 has some issues
com.apple.mrj.application.classpath=lib/build:Contents/Resources/Java/build:Contents/Resources/Java/pde.jar:Contents/Resources/Java/kjc.jar:Contents/Resources/Java/antlr.jar:Contents/Resources/Java/oro.jar:Contents/Resources/Java/RXTXcomm.jar
#com.apple.mrj.application.classpath=Contents/Resources/Java/core.jar:Contents/Resources/Java/pde.jar:Contents/Resources/Java/antlr.jar:Contents/Resources/Java/oro.jar:lib/build:Contents/Resources/Java/RXTXcomm.jar
com.apple.mrj.application.classpath=Contents/Resources/Java/core.jar:Contents/Resources/Java/pde.jar:Contents/Resources/Java/antlr.jar:Contents/Resources/Java/oro.jar:lib/build
com.apple.mrj.application.stdin=/dev/null
+47 -34
View File
@@ -4,21 +4,21 @@
### -- CHECK TO MAKE SURE BAGEL EXISTS -------------------------
# move to base 'processing' directory
cd ../..
#cd ../..
# make sure bagel exists, if not, check it out of cvs
if test -d bagel
then
echo
else
echo Doing CVS checkout of bagel...
cvs co bagel
cd bagel
cvs update -P
cd ..
fi
#if test -d bagel
#then
# echo
#else
# echo Doing CVS checkout of bagel...
# cvs co bagel
# cd bagel
# cvs update -P
# cd ..
#fi
cd build/macosx
#cd build/macosx
### -- SETUP WORK DIR -------------------------------------------
@@ -32,6 +32,7 @@ else
echo
else
echo You need to install fink and fileutils
exit
fi
echo Setting up directories to build under Mac OS X
@@ -49,18 +50,17 @@ else
rm reference.zip
cd ..
mkdir work/lib/export
# mkdir work/lib/export
mkdir work/lib/build
mkdir work/classes
# mkdir work/classes
# get a copy of the mac-specific properties
#cp dist/lib/pde_macosx.properties work/lib/
# grab serial goodies
echo Copying serial support from bagel dir...
cp ../../bagel/serial/RXTXcomm.jar work/lib/
cp ../../bagel/serial/libSerial.jnilib work/
# echo Copying serial support from bagel dir...
# cp ../../bagel/serial/RXTXcomm.jar work/lib/
# cp ../../bagel/serial/libSerial.jnilib work/
# copy gl4java libs and jar file
# disabled till the next release when i can recompile for 1.4
@@ -103,7 +103,10 @@ cd ../..
### -- BUILD BAGEL ----------------------------------------------
cd bagel
#cd bagel
cd core
echo Building processing.core...
# rxtx comm.jar will be included by the build script
CLASSPATH=/System/Library/Frameworks/JavaVM.framework/Classes/classes.jar:/System/Library/Frameworks/JavaVM.framework/Classes/ui.jar:/System/Library/Java/Extensions/QTJava.zip:/System/Library/Java/Extensions/MRJToolkit.jar
@@ -119,19 +122,22 @@ export CLASSPATH
#perl make.pl JIKES=../build/macosx/work/jikes SONIC
#cp classes/*.class ../build/macosx/work/lib/export/
echo Building export classes for 1.1
rm -f classes/*.class
perl make.pl JIKES=../build/macosx/work/jikes
cd classes
zip -0q ../../build/macosx/work/lib/export11.jar *.class
cd ..
#echo Building export classes for 1.1
#rm -f classes/*.class
#perl make.pl JIKES=../build/macosx/work/jikes
#cd classes
#zip -0q ../../build/macosx/work/lib/export11.jar *.class
#cd ..
echo Building export classes for 1.3
rm -f classes/*.class
perl make.pl JIKES=../build/macosx/work/jikes
cd classes
zip -0q ../../build/macosx/work/lib/export13.jar *.class
cd ..
#echo Building export classes for 1.3
#rm -f classes/*.class
#perl make.pl JIKES=../build/macosx/work/jikes
#cd classes
#zip -0q ../../build/macosx/work/lib/export13.jar *.class
#cd ..
../build/macosx/work/jikes -d . +D -target 1.1 *.java
zip -r0q ../build/macosx/work/lib/core.jar processing
# head back to root "processing" dir
cd ../app
@@ -164,12 +170,16 @@ fi
### -- BUILD PDE ------------------------------------------------
echo Building PDE for JDK 1.3
#echo Building PDE for JDK 1.3
echo Building the PDE...
# new rxtx
CLASSPATH=../build/macosx/work/classes:../build/macosx/work/lib/kjc.jar:../build/macosx/work/lib/antlr.jar:../build/macosx/work/lib/oro.jar:../build/macosx/work/lib/RXTXcomm.jar:$CLASSPATH
#CLASSPATH=../build/macosx/work/classes:../build/macosx/work/lib/kjc.jar:../build/macosx/work/lib/antlr.jar:../build/macosx/work/lib/oro.jar:../build/macosx/work/lib/RXTXcomm.jar:$CLASSPATH
CLASSPATH=../build/macosx/work/lib/core.jar:../build/macosx/work/lib/antlr.jar:../build/macosx/work/lib/oro.jar:$CLASSPATH
perl ../bagel/buzz.pl "../build/macosx/work/jikes +D -classpath $CLASSPATH -d ../build/macosx/work/classes" -dJDK13 -dMACOS -dRXTX *.java jeditsyntax/*.java preprocessor/*.java
../build/macosx/work/jikes +D -classpath $CLASSPATH -d ../build/macosx/work/classes *.java jeditsyntax/*.java preprocessor/*.java
#perl ../bagel/buzz.pl "../build/macosx/work/jikes +D -classpath $CLASSPATH -d ../build/macosx/work/classes" -dJDK13 -dMACOS -dRXTX *.java jeditsyntax/*.java preprocessor/*.java
#perl ../bagel/buzz.pl "javac -classpath $CLASSPATH -d ../build/macosx/work/classes" -dJDK13 -dMACOS -dRXTX *.java jeditsyntax/*.java preprocessor/*.java
cd ../build/macosx/work/classes
@@ -179,3 +189,6 @@ cd ../..
# get the libs
cp work/lib/*.jar work/Processing.app/Contents/Resources/Java/
echo Done.
+1 -1
View File
@@ -196,7 +196,7 @@ compiler.output_parse_tree = false
compiler.jdk_version = 1.1
# base imports to include for java 1.1 (or higher)
compiler.imports.jdk11 = java.applet,java.awt,java.awt.image,java.awt.event,java.io,java.net,java.text,java.util,java.util.zip,netscape.javascript
compiler.imports.jdk11 = processing.core,java.applet,java.awt,java.awt.image,java.awt.event,java.io,java.net,java.text,java.util,java.util.zip,netscape.javascript
# additional imports when exporting to java 1.3 or higher
compiler.imports.jdk13 = javax.sound.midi,javax.sound.midi.spi,javax.sound.sampled,javax.sound.sampled.spi
+14 -12
View File
@@ -97,30 +97,32 @@ public class PApplet extends Applet
// current frame number (could this be used to replace firstFrame?)
public int frame;
boolean finished;
// true if the feller has spun down
public boolean finished;
boolean drawn;
Thread thread;
Exception exception; // the last exception thrown
public Exception exception; // the last exception thrown
static final int DEFAULT_WIDTH = 100;
static final int DEFAULT_HEIGHT = 100;
int width, height;
static public final int DEFAULT_WIDTH = 100;
static public final int DEFAULT_HEIGHT = 100;
public int width, height;
int libraryCount;
PLibrary libraries[];
// this text isn't seen unless PApplet is used on its
// own and someone takes advantage of leechErr.. not likely
static final String LEECH_WAKEUP = "Error while running applet.";
PrintStream leechErr;
static public final String LEECH_WAKEUP = "Error while running applet.";
public PrintStream leechErr;
// message to send if attached as an external vm
static final String EXTERNAL_FLAG = "--external=";
static final char EXTERNAL_EXACT_LOCATION = 'e';
static final char EXTERNAL_STOP = 's';
static final String EXTERNAL_QUIT = "__QUIT__";
static final String EXTERNAL_MOVE = "__MOVE__";
static public final String EXTERNAL_FLAG = "--external=";
static public final char EXTERNAL_EXACT_LOCATION = 'e';
static public final char EXTERNAL_STOP = 's';
static public final String EXTERNAL_QUIT = "__QUIT__";
static public final String EXTERNAL_MOVE = "__MOVE__";
boolean externalRuntime;
+3
View File
@@ -217,6 +217,9 @@ X what is set(x, y, image) -> remove it, make a copy() instead
X modify image functions to use imageMode
040707 late
X lots more work on make.sh for both mac and pc
X further tweaking of the new class structure
X trying to get the build scripts wrapped up/working
_ casting working properly.. int() maps to toInt()?
_ what is performance hit for this thing?