From a768153ba593d166bb290b014881d9bb9f8b3408 Mon Sep 17 00:00:00 2001 From: benfry Date: Sun, 16 May 2004 18:40:57 +0000 Subject: [PATCH] fixing compile errors --- processing/app/PdeEditor.java | 14 ++++-- processing/app/PdeSketch.java | 52 ++++++++++++++++------ processing/build/windows/make.sh | 75 +++++++++++--------------------- processing/todo.txt | 3 ++ 4 files changed, 78 insertions(+), 66 deletions(-) diff --git a/processing/app/PdeEditor.java b/processing/app/PdeEditor.java index d0ccc175a..474db7da1 100644 --- a/processing/app/PdeEditor.java +++ b/processing/app/PdeEditor.java @@ -1117,7 +1117,8 @@ public class PdeEditor extends JFrame //openingName = name; //if (!sketch.isModified()) { - if (sketch.modified) checkModified2(); + //if (sketch.modified) checkModified2(); + if (!sketch.modified) checkModified2(); String prompt = "Save changes to " + sketch.name + "? "; @@ -1150,7 +1151,7 @@ public class PdeEditor extends JFrame options[0]); if (result == JOptionPane.YES_OPTION) { - sketch.save(); + handleSave2(); checkModified2(); } else if (result == JOptionPane.NO_OPTION) { @@ -1353,15 +1354,20 @@ public class PdeEditor extends JFrame } */ + // there is no handleSave1 since there's never a need to prompt public void handleSave2() { message("Saving..."); try { sketch.save(); + } catch (Exception e) { + // show the error as a message in the window error(e); - //message("Error during export."); - //e.printStackTrace(); + + // zero out the current action, + // so that checkModified2 will just do nothing + checking = 0; } buttons.clear(); } diff --git a/processing/app/PdeSketch.java b/processing/app/PdeSketch.java index f0a508881..17ddb0693 100644 --- a/processing/app/PdeSketch.java +++ b/processing/app/PdeSketch.java @@ -254,7 +254,7 @@ public class PdeSketch { /** * Save all code in the current sketch. */ - public void save() { + public void save() throws IOException { // check if the files are read-only. // if so, need to first do a "save as". if (modified && isReadOnly()) { @@ -272,7 +272,7 @@ public class PdeSketch { } - public void saveCurrent() { + public void saveCurrent() throws IOException { current.save(); calcModified(); } @@ -327,7 +327,13 @@ public class PdeSketch { if (!dataFolder.exists()) dataFolder.mkdirs(); destFile = new File(dataFolder, filename); } - PdeBase.copyFile(sourceFile, destFile); + try { + PdeBase.copyFile(sourceFile, destFile); + } catch (IOException e) { + PdeBase.showWarning("Error adding file", + "Could not add '" + filename + + "' to the sketch.", e); + } } @@ -349,7 +355,7 @@ public class PdeSketch { // set to the text for this file // 'true' means to wipe out the undo buffer // (so they don't undo back to the other file.. whups!) - editor.changeText(current.program, true); + editor.setText(current.program, true); // and i'll personally make a note of the change //current = which; @@ -437,7 +443,12 @@ public class PdeSketch { // just drop the files in the build folder (pre-68) //PdeBase.copyDir(dataDir, buildDir); // drop the files into a 'data' subfolder of the build dir - PdeBase.copyDir(dataFolder, new File(tempBuildFolder, "data")); + try { + PdeBase.copyDir(dataFolder, new File(tempBuildFolder, "data")); + } catch (IOException e) { + e.printStackTrace(); + throw new PdeException("Problem copying files from data folder"); + } } // make up a temporary class name to suggest. @@ -562,7 +573,13 @@ public class PdeSketch { // into the build directory. uses byte stream and reader/writer // shtuff so that unicode bunk is properly handled String filename = code[i].name + ".java"; - PdeBase.saveFile(code[i].program, new File(buildPath, filename)); + try { + PdeBase.saveFile(code[i].program, new File(buildPath, filename)); + } catch (IOException e) { + e.printStackTrace(); + throw new PdeException("Problem moving " + filename + + " to the build folder"); + } code[i].preprocName = filename; } else if (code[i].flavor == PDE) { @@ -573,7 +590,7 @@ public class PdeSketch { String className = preprocessor.write(code[i].program, buildPath, (i == 0) ? suggestedClassName : null, - additionalImports); + importPackageList); if (className == null) { // TODO this is temporary for debugging System.err.println("class could not be determined for " + @@ -603,12 +620,20 @@ public class PdeSketch { // while this seems to store line and column internally, // there doesn't seem to be a method to grab it.. // so instead it's done using a regexp - PatternMatcher matcher = new Perl5Matcher(); PatternCompiler compiler = new Perl5Compiler(); // line 3:1: unexpected char: 0xA0 String mess = "^line (\\d+):(\\d+):\\s"; - Pattern pattern = compiler.compile(mess); + + Pattern pattern = null; + try { + pattern = compiler.compile(mess); + } catch (MalformedPatternException e) { + PdeBase.showWarning("Internal Problem", + "An internal error occurred while trying\n" + + "to compile the sketch. Please report\n" + + "this online at http://processing.org/bugs", e); + } PatternMatcherInput input = new PatternMatcherInput(tsre.toString()); @@ -741,7 +766,7 @@ public class PdeSketch { // create the project directory // pass null for datapath because the files shouldn't be // copied to the build dir.. that's only for the temp stuff - File appletDir = new File(directory, "applet"); + File appletDir = new File(folder, "applet"); boolean writeHtml = true; if (appletDir.exists()) { @@ -764,7 +789,7 @@ public class PdeSketch { if (!name.equals(foundName)) { PdeBase.showWarning("Error during export", "Sketch name is " + name + " but the sketch\n" + - "name in the code was " + foundName); + "name in the code was " + foundName, null); return false; } @@ -788,7 +813,8 @@ public class PdeSketch { // adds a space at the beginning, in case size() is the very // first thing in the program (very common), since the regexp // needs to check for things in front of it. - PatternMatcherInput input = new PatternMatcherInput(" " + program); + PatternMatcherInput input = + new PatternMatcherInput(" " + code[0].program); if (matcher.contains(input, pattern)) { MatchResult result = matcher.getMatch(); try { @@ -891,7 +917,7 @@ public class PdeSketch { } // add the appropriate bagel to the classpath - String jdkVersionStr = PdePreferences.get("compiler.jdk_version"); + String jdkVersion = PdePreferences.get("compiler.jdk_version"); String bagelJar = "lib/export11.jar"; // default if (jdkVersion.equals("1.3") || jdkVersion.equals("1.4")) { bagelJar = "lib/export13.jar"; diff --git a/processing/build/windows/make.sh b/processing/build/windows/make.sh index da81693eb..987902319 100755 --- a/processing/build/windows/make.sh +++ b/processing/build/windows/make.sh @@ -1,11 +1,12 @@ #!/bin/sh -### -- CHECK TO MAKE SURE BAGEL EXISTS ------------------------- - # move to base 'processing' directory cd ../.. + +### -- CHECK TO MAKE SURE BAGEL EXISTS ------------------------- + # make sure bagel exists, if not, check it out of cvs if test -d bagel then @@ -17,12 +18,12 @@ else cd .. fi -# back to where we came from -cd build/windows - ### -- SETUP WORK DIR ------------------------------------------- +# back to where we came from +cd build/windows + if test -d work then else @@ -87,15 +88,16 @@ else chmod +x work/jikes.exe fi - -### -- START BUILDING ------------------------------------------- - -# move to base 'processing' directory cd ../.. - ### -- BUILD BAGEL ---------------------------------------------- +#################### TEMPORARY ##################### +if false +then +#################### TEMPORARY ##################### + +# move to bagel inside base 'processing' directory cd bagel # clear jikespath to avoid problems if it is defined elsewhere @@ -119,47 +121,13 @@ else fi fi -#if test -d /cygdrive/c/WINNT -#then - # Windows 2000 or NT -# QT_JAVA_PATH="C:\\WINNT\\system32\\QTJava.zip" -#else - # Windows 95, 98, ME and XP (does it really run on 95?) -# QT_JAVA_PATH="C:\\WINDOWS\\system32\\QTJava.zip" -#fi - -# remove quotes from around QTJAVA env var so it can be used -#QT_JAVA_PATH=`perl -e '$qt = $ENV{'QTJAVA'}; $qt =~ s/\"//g; print $qt'`; -# (ok so i don't know awk or sed or whatever i shoulda used for that..) - -#if test -f "${QT_JAVA_PATH}" -#then -#else -# echo "QTJAVA environment variable is set to:" -# echo $QTJAVA -# echo "but that file doesn't seem to exist." -# echo "y'all need to fix that before you can compile." -# exit; -#fi - # new regular version CLASSPATH="..\\build\\windows\\work\\java\\lib\\rt.jar;..\\build\\windows\\work\\lib\\comm.jar;${QT_JAVA_PATH}" export CLASSPATH -# make version with serial for the application -#echo Building bagel with serial, sonic, video, net and jdk13 support -#perl make.pl JIKES=../build/windows/work/jikes SERIAL SONIC NETWORK VIDEO JDK13 perl make.pl JIKES=../build/windows/work/jikes JDK13 cp classes/*.class ../build/windows/work/classes/ -# still debating on whether to include jdk118 classes.. -#CLASSPATH="..\\bagel\\jdk118.jar;..\\build\\windows\\work\\lib\\comm.jar;${QT_JAVA_PATH}" - -# make simpler version for applet exporting, only 1.1 functions -#echo Building bagel for export with sonic and net support -#perl make.pl JIKES=../build/windows/work/jikes SONIC NETWORK -#cp classes/*.class ../build/windows/work/lib/export/ - echo Building export classes for 1.1 rm -f classes/*.class @@ -175,16 +143,15 @@ cd classes zip -0q ../../build/windows/work/lib/export13.jar *.class cd .. -# back to processing base dir +# back to base processing dir cd .. -### -- BUILD PDE ------------------------------------------------ +### -- BUILD PREPROC --------------------------------------------- echo Building PDE for JDK 1.4 -cd app -cd preprocessor +cd app/preprocessor # first build the default java goop ../../build/windows/work/java/bin/java \ @@ -195,7 +162,17 @@ cd preprocessor -cp "..\\..\\build\\windows\\work\\lib\\antlr.jar" antlr.Tool \ -glib java.g pde.g -cd .. +# back to base processing dir +cd ../.. + +#################### TEMPORARY ##################### +fi +#################### TEMPORARY ##################### + + +### -- BUILD PDE ------------------------------------------------ + +cd app CLASSPATH="..\\build\\windows\\work\\classes;..\\build\\windows\\work\\lib\\kjc.jar;..\\build\\windows\\work\\lib\antlr.jar;..\\build\\windows\\work\\lib\\oro.jar;..\\build\\windows\\work\\java\\lib\\rt.jar;..\\build\\windows\\work\\lib\\comm.jar;${QT_JAVA_PATH}" diff --git a/processing/todo.txt b/processing/todo.txt index 69bfbd10d..07c328b14 100644 --- a/processing/todo.txt +++ b/processing/todo.txt @@ -1,5 +1,8 @@ 0070 pde +_ problems with hanging video when not in the root of the c drive +_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1084464062;start=0 + _ casting problems in the parser _ float u = float(x)/width; works. _ float u = (float(x)/width); doesn't work: "unexpected token: float".