working on build/export for multi-file sketch

This commit is contained in:
benfry
2004-01-16 19:12:52 +00:00
parent df677c10dd
commit 60698cc39d
4 changed files with 26 additions and 7 deletions
+11 -5
View File
@@ -78,8 +78,7 @@ public class PdePreprocessor {
* @return the classname of the exported Java
*/
public String write(String program, String buildPath,
String name, String imports[],
int javaVersion) throws java.lang.Exception {
String name, String imports[]) throws java.lang.Exception {
this.programReader = new StringReader(program);
this.buildPath = buildPath;
@@ -144,7 +143,7 @@ public class PdePreprocessor {
PrintStream stream = new PrintStream(
new FileOutputStream(buildPath + File.separator + name + ".java"));
writeHeader(stream, imports, javaVersion, name);
writeHeader(stream, imports, name);
emitter.setOut(stream);
emitter.print(rootNode);
@@ -172,6 +171,7 @@ public class PdePreprocessor {
return name;
}
/**
* Write any required header material (eg imports, class decl stuff)
*
@@ -180,7 +180,7 @@ public class PdePreprocessor {
* @param name Name of the class being created.
*/
void writeHeader(PrintStream out, String imports[],
int javaVersion, String className) {
String className) {
// emit emports that are needed for classes from the code folder
if (imports != null) {
@@ -191,7 +191,13 @@ public class PdePreprocessor {
// emit standard imports (read from pde.properties)
// for each language level that's being used.
for (int i = 0; i < javaVersion; i++) {
String jdkVersionStr = PdePreferences.get("compiler.jdk_version");
int jdkVersion = JDK11; // default
if (jdkVersionStr.equals("1.3")) { jdkVersion = JDK13 };
if (jdkVersionStr.equals("1.4")) { jdkVersion = JDK14 };
for (int i = 0; i < jdkVersion; i++) {
for (int j = 0; j < defaultImports[i].length; j++) {
out.print("import " + defaultImports[i][j] + ".*; ");
}
+1 -2
View File
@@ -470,11 +470,10 @@ public class Sketch {
public String getMainFilePath() {
return files[0].getAbsolutePath();
}
}
class Code {
String name;
String name; // pretty name (no extension), not the full file name
File file;
int flavor;
+12
View File
@@ -181,3 +181,15 @@ compiler.substitute_font = false
# writes out the parse tree as parseTree.xml, which can be usefully
# viewed in (at least) Mozilla or IE. useful when debugging the preprocessor.
compiler.output_parse_tree = false
# jdk version to use..
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
# 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
# additional imports when exporting to java 1.4 or higher
compiler.imports.jdk14 = javax.xml.parsers,javax.xml.transform,javax.xml.transform.dom,javax.xml.transform.sax,javax.xml.transform.stream,org.xml.sax,org.xml.sax.ext,org.xml.sax.helpers
+2
View File
@@ -35,6 +35,8 @@ X why won't loop() go bold? -> java 1.4 problem on the mac
X test what it does on the pc
X seems to be a mac-specific problem (probably because of monaco)
X removed kjc classes
X addition to pde.properties to list the imports for various jdk versions
X set jdk version for export inside pde.properties
goodbye macos9
X posted to message board about it going away