working on new build system

This commit is contained in:
benfry
2004-01-16 17:28:57 +00:00
parent 0d696971ac
commit 67d56ea482
3 changed files with 165 additions and 527 deletions

View File

@@ -74,13 +74,13 @@ public class PdePreprocessor {
// used for calling the ASTFactory to get the root node
private static final int ROOT_ID = 0;
boolean usingExternal; // use an external process to display the applet?
//boolean usingExternal; // use an external process to display the applet?
public PdePreprocessor(String program, String buildPath) {
this.programReader = new StringReader(program);
this.buildPath = buildPath;
usingExternal = PdePreferences.getBoolean("run.external"); //, false);
//usingExternal = PdePreferences.getBoolean("run.external"); //, false);
}
/**

View File

@@ -1,439 +0,0 @@
/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
PdePreprocessorOro - current oro-based preprocessor (soon to be gone)
Part of the Processing project - http://Proce55ing.net
Except where noted, code is written by Ben Fry and
Copyright (c) 2001-03 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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
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,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HELL_HAS_FROZEN_OVER
// disable this guy for a little while
import com.oroinc.text.regex.*;
import java.io.*;
public class PdePreprocessorOro extends PdePreprocessor {
String program;
public PdePreprocessorOro(String program, String buildPath) {
super(program, buildPath);
this.program = program;
}
// writes .java file into buildPath
public String writeJava(String name, /*boolean extendsNormal,*/
boolean exporting) {
//String extendsWhat = extendsNormal ? "BApplet" : "BAppletGL";
String extendsWhat = "BApplet";
try {
/*int*/ programType = BEGINNER;
// remove (encode) comments temporarily
program = commentsCodec(program /*, true*/);
// insert 'f' for all floats
// shouldn't substitute f's for: "Univers76.vlw.gz";
if (PdePreferences.getBoolean("compiler.substitute_f", true)) {
/*
a = 0.2 * 3
(3.)
(.3 * 6)
(.30*7)
float f = 0.3;
fill(0.3, 0.2, 0.1);
next to white space \s or math ops +-/*()
or , on either side,
followed by ; (might as well on either side)
// allow 3. to work (also allows x.x too)
program = substipoot(program, "(\\d+\\.\\d*)(\\D)", "$1f$2");
program = substipoot(program, "(\\d+\\.\\d*)ff", "$1f");
// allow .3 to work (also allows x.x)
program = substipoot(program, "(\\d*\\.\\d+)(\\D)", "$1f$2");
program = substipoot(program, "(\\d*\\.\\d+)ff", "$1f");
*/
program = substipoot(program, "([\\s\\,\\;\\+\\-\\/\\*\\(\\)])(\\d+\\.\\d*)([\\s\\,\\;\\+\\-\\/\\*\\(\\)])", "$1$2f$3");
program = substipoot(program, "([\\s\\,\\;\\+\\-\\/\\*\\(\\)])(\\d*\\.\\d+)([\\s\\,\\;\\+\\-\\/\\*\\(\\)])", "$1$2f$3");
}
// allow int(3.75) instead of just (int)3.75
if (PdePreferences.getBoolean("compiler.enhanced_casting", true)) {
program = substipoot(program, "([^A-Za-z0-9_])byte\\((.*)\\)", "$1(byte)($2)");
program = substipoot(program, "([^A-Za-z0-9_])char\\((.*)\\)", "$1(char)($2)");
program = substipoot(program, "([^A-Za-z0-9_])int\\((.*)\\)", "$1(int)($2)");
program = substipoot(program, "([^A-Za-z0-9_])float\\((.*)\\)", "$1(float)($2)");
}
if (PdePreferences.getBoolean("compiler.color_datatype", true)) {
// so that regexp works correctly in this strange edge case
if (program.indexOf("color") == 0) program = " " + program;
// swap 'color' with 'int' when used as a datatype
program = substipoot(program,
"([;\\s\\(])color([\\s\\[])", "$1int$2");
// had to add ( at beginning for addPixel(color c...)
//"([;\\s])color([\\s\\[])", "$1int$2");
// had to add [ to that guy for color[] stuff
//"([;\\s])color([\\s])", "$1int$2");
//"([^A-Za-z0-9_.])color([^A-Za-z0-9_\\(.])", "$1int$2");
// color(something) like int() and the rest is no good
// because there is already a function called 'color' in BGraphics
//program = substipoot(program, "([^A-Za-z0-9_])color\\((.*)\\)", "$1(int)($2)");
}
if (PdePreferences.getBoolean("compiler.inline_web_colors", true)) {
// convert "= #cc9988" into "= 0xffcc9988"
//program = substipoot(program, "(=\\s*)\\#([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])", "$1 0xff$2$3$4");
//program = substipoot(program, "#([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([;\\s])", "0xff$1$2$3$4");
//program = substipoot(program, "#([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([;\\s])", "0x$4$1$2$3$5");
program = substipoot(program, "#([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])", "0xff$1$2$3");
}
if ((program.indexOf("void setup()") != -1) ||
(program.indexOf("void loop()") != -1) ||
(program.indexOf("void draw()") != -1)) {
programType = INTERMEDIATE;
}
int index = program.indexOf("public class");
if (index != -1) {
programType = ADVANCED;
// kjc will get pissed off if i call the .java file
// something besides the name of the class.. so here goes
String s = program.substring(index + "public class".length()).trim();
index = s.indexOf(' ');
name = s.substring(0, index);
tempClass = name;
// and we're running inside
// no longer necessary, i think, since kjcapplet is gone
/*
if (!exporting) {
index = program.indexOf(extendsWhat); // ...and extends BApplet
if (index != -1) { // just extends object
String left = program.substring(0, index);
String right = program.substring(index + extendsWhat.length());
// replace with 'extends KjcApplet'
//program = left + ((usingExternal) ? EXTENDS : EXTENDS_KJC) + right;
program = left + extendsWhat + right;
}
}
*/
}
tempFilename = name + ".java";
tempClassFilename = name + ".class";
PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(buildPath + File.separator + tempFilename))));
//String eol = System.getProperties().getProperty("line.separator");
if (programType < ADVANCED) {
// spew out a bunch of java imports
if (!exporting) { // if running in environment, or exporting an app
for (int i = 0; i < application_imports.length; i++) {
writer.print("import " + application_imports[i] + ".*; ");
}
} else { // exporting an applet
for (int i = 0; i < applet_imports.length; i++) {
writer.println("import " + applet_imports[i] + ".*; ");
//writer.print("import " + applet_imports[i] + ".*; ");
//if (!kjc) writer.println();
}
}
// add serial if running inside pde
//if (kjc) writer.print("import javax.comm.*;");
if (exporting) writer.println();
writer.print("public class " + name + " extends " +
extendsWhat + " {");
//((kjc && !usingExternal) ?
//"KjcApplet" : "BApplet") + " {");
}
if (programType == BEGINNER) {
if (exporting) writer.println();
// hack so that the regexp below works
//if (program.indexOf("size(") == 0) program = " " + program;
if ((program.indexOf("size(") == 0) ||
(program.indexOf("background(") == 0)) {
program = " " + program;
}
PatternMatcher matcher = null;
PatternCompiler compiler = null;
Pattern pattern = null;
Perl5Substitution subst = null;
PatternMatcherInput input = null;
///////// grab (first) reference to size()
matcher = new Perl5Matcher();
compiler = new Perl5Compiler();
try {
pattern =
compiler.compile("[\\s\\;](size\\(\\s*\\d+,\\s*\\d+\\s*\\);)");
//compiler.compile("^([^A-Za-z0-9_]+)(size\\(\\s*\\d+,\\s*\\d+\\s*\\);)");
} catch (MalformedPatternException e){
e.printStackTrace();
//System.err.println("Bad pattern.");
//System.err.println(e.getMessage());
System.exit(1);
}
String sizeInfo = null;
input = new PatternMatcherInput(program);
if (matcher.contains(input, pattern)) {
MatchResult result = matcher.getMatch();
//int wide = Integer.parseInt(result.group(1).toString());
//int high = Integer.parseInt(result.group(2).toString());
//sizeInfo = "void setup() { " + result.group(0) + " } ";
sizeInfo = result.group(0);
} else {
// no size() defined, make it default
sizeInfo = "size(" + BApplet.DEFAULT_WIDTH + ", " +
BApplet.DEFAULT_HEIGHT + "); ";
}
// remove references to size()
// this winds up removing every reference to size()
// not really intended, but will help things work
subst = new Perl5Substitution("", Perl5Substitution.INTERPOLATE_ALL);
//subst = new Perl5Substitution("$1", Perl5Substitution.INTERPOLATE_ALL);
program = Util.substitute(matcher, pattern, subst, program,
Util.SUBSTITUTE_ALL);
/////////// grab (first) reference to background()
matcher = new Perl5Matcher();
compiler = new Perl5Compiler();
try {
pattern =
compiler.compile("[\\s\\;](background\\(.*\\);)");
//[\\s\\;]
//compiler.compile("([^A-Za-z0-9_]+)(background\\(.*\\);)");
} catch (MalformedPatternException e){
//System.err.println("Bad pattern.");
//System.err.println(e.getMessage());
e.printStackTrace();
System.exit(1);
}
String backgroundInfo = "";
input = new PatternMatcherInput(program);
if (matcher.contains(input, pattern)) {
MatchResult result = matcher.getMatch();
//int wide = Integer.parseInt(result.group(1).toString());
//int high = Integer.parseInt(result.group(2).toString());
//sizeInfo = "void setup() { " + result.group(0) + " } ";
backgroundInfo = result.group(0);
//} else {
// no size() defined, make it default
//sizeInfo = "size(" + BApplet.DEFAULT_WIDTH + ", " +
//BApplet.DEFAULT_HEIGHT + "); ";
}
// remove references to background()
// this winds up removing every reference to background()
subst = new Perl5Substitution("", Perl5Substitution.INTERPOLATE_ALL);
program = Util.substitute(matcher, pattern, subst, program,
Util.SUBSTITUTE_ALL);
//////// spew out the size and background info
writer.print("void setup() { ");
writer.print(sizeInfo);
writer.print(backgroundInfo);
writer.print("} ");
writer.print("void draw() {");
}
// decode comments to bring them back
program = commentsCodec(program /*, false*/);
// spew the actual program
// this should really add extra indents,
// especially when not in kjc mode (!kjc == export)
// things will be one line off if there's an error in the code
if (exporting) writer.println();
writer.println(program);
//System.out.println(program);
if (programType == BEGINNER) {
writer.println("}");
}
if (programType < ADVANCED) {
writer.print("}");
}
writer.flush();
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
return name;
}
protected String commentsCodec(String program /*, boolean encode*/) {
// need to preprocess class to remove comments
// so tthat they don't fool this crappy parsing below
char p[] = program.toCharArray();
char lastp = 0;
boolean insideComment = false;
boolean eolComment = false;
boolean slash = false;
boolean insideQuote = false;
for (int i = 0; i < p.length; i++) {
if (insideComment) {
if (eolComment &&
((p[i] == '\r') || (p[i] == '\n'))) {
insideComment = false;
slash = false;
} else if (!eolComment &&
(p[i] == '*') &&
(i != (p.length-1)) &&
(p[i+1] == '/')) {
insideComment = false;
slash = false;
} else {
//if ((p[i] > 32) && (p[i] < 127)) {
if ((p[i] >= 48) && (p[i] < 128)) {
p[i] = rotateTable[p[i]];
//p[i] = encode ? encodeTable[p[i]] : decodeTable[p[i]];
}
//p[i] = ' ';
}
} else { // not yet inside a comment
if (insideQuote) {
if ((p[i] == '\"') && (lastp != '\\')) {
insideQuote = !insideQuote;
} else {
if ((p[i] >= 48) && (p[i] < 128)) {
p[i] = rotateTable[p[i]];
//p[i] = encode ? encodeTable[p[i]] : decodeTable[p[i]];
}
}
} else { // not inside a quote
if (p[i] == '/') {
if (slash) {
insideComment = true;
eolComment = true;
} else {
slash = true;
}
} else if (p[i] == '\"') {
if (lastp != '\\') insideQuote = !insideQuote;
} else if (p[i] == '*') {
if (slash) {
insideComment = true;
eolComment = false;
}
} else {
slash = false;
}
}
}
lastp = p[i];
}
//System.out.println(new String(p));
return new String(p);
}
protected String substipoot(String what, String incoming, String outgoing) {
PatternMatcher matcher = new Perl5Matcher();
PatternCompiler compiler = new Perl5Compiler();
Pattern pattern = null;
try {
pattern = compiler.compile(incoming);
} catch (MalformedPatternException e){
System.err.println("Bad pattern.");
System.err.println(e.getMessage());
System.exit(1);
}
Perl5Substitution subst =
new Perl5Substitution(outgoing, Perl5Substitution.INTERPOLATE_ALL);
return Util.substitute(matcher, pattern, subst, what,
Util.SUBSTITUTE_ALL);
}
//static char encodeTable[] = new char[127];
//static char decodeTable[] = new char[127];
static char rotateTable[] = new char[128];
static {
for (int i = 0; i < 80; i++) {
rotateTable[i+48] = (char) (48 + ((i + 40) % 80));
}
/*
int rot = (123 - 65) / 2;
for (int i = 65; i < 123; i++) {
rotateTable[i] = (char) (((i - 65 + rot) % (rot*2)) + 65); // : (char)i;
}
*/
//for (int i = 33; i < 127; i++) {
//rotateTable[i] = //Character.isAlpha((char)i) ?
//(char) (((i - 33 + rot) % 94) + 33) : (char)i;
//encodeTable[i] = (char) (i+1);
//decodeTable[i] = (char) (i-1);
//encodeTable[i] = (char) (((i - 33 + rot) % 94) + 33);
//decodeTable[i] = encodeTable[i];
//encodeTable[i] = (char) (((i - 33 + rot) % 94) + 33);
//decodeTable[i] = (char) (((i + 33 + rot) % 94) + 33);
//System.out.println((int) decodeTable[i]);
//}
}
}
#endif

View File

@@ -2,7 +2,7 @@
/*
PdeSketch - stores information about files in the current sketch
Part of the Processing project - http://Proce55ing.net
Part of the Processing project - http://processing.org
Except where noted, code is written by Ben Fry
Copyright (c) 2001-03 Massachusetts Institute of Technology
@@ -22,48 +22,62 @@
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
public class PdeSketch {
public class Sketch {
String name;
File directory;
File directory;
static final int PDE = 0;
static final int JAVA = 1;
static final int JAVA = 1;
int current;
//int current;
Code current;
int codeCount;
Code code[];
int fileCount;
int hiddenCount;
Code hidden[];
/*
String names[];
File files[];
int flavor[];
String program[];
boolean modified[];
PdeHistory history[];
*/
int hiddenCount;
String hiddenNames[];
File hiddenFiles[];
//String sketchName; // name of the file (w/o pde if a sketch)
//File sketchFile; // the .pde file itself
//File sketchDir; // if a sketchbook project, the parent dir
//boolean sketchModified;
//int hiddenCount;
//String hiddenNames[];
//File hiddenFiles[];
/**
* path is location of the main .pde file, because this is also
* simplest to use when opening the file from the finder/explorer.
*/
public PdeSketch(String path) {
public Sketch(String path) {
File mainFile = new File(path);
System.out.println("main file is " + mainFile);
directory = new File(path.getParent());
System.out.println("sketch dir is " + directory);
// Build the list of files. This is only done once, rather than
// each time a change is made, because otherwise it gets to be
// a nightmare to keep track of what files went where, because
// not all the data will be saved to disk.
load();
}
/**
* Build the list of files.
*
* Generally his is only done once, rather than
* each time a change is made, because otherwise it gets to be
* a nightmare to keep track of what files went where, because
* not all the data will be saved to disk.
*
* The exception is when an external editor is in use,
* in which case the load happens each time "run" is hit.
*/
public void load() {
// get list of files in the sketch folder
String list[] = directory.list();
@@ -74,45 +88,59 @@ public class PdeSketch {
else if (list[i].endsWith(".java.x")) hiddenCount++;
}
names = new String[fileCount];
files = new File[fileCount];
modified = new boolean[fileCount];
flavor = new int[fileCount];
program = new String[fileCount];
history = new PdeHistory[fileCount];
code = new Code[codeCount];
//names = new String[fileCount];
//files = new File[fileCount];
//flavor = new int[fileCount];
hiddenNames = new String[hiddenCount];
hiddenFiles = new File[hiddenCount];
hidden = new Code[hiddenCount];
//hiddenNames = new String[hiddenCount];
//hiddenFiles = new File[hiddenCount];
int fileCounter = 0;
int hiddenCounter = 0;
for (int i = 0; i < list.length; i++) {
int sub = 0;
if (list[i].endsWith(".pde")) {
names[fileCounter] = list[i].substring(0, list[i].length() - 4);
files[fileCounter] = new File(directory, list[i]);
flavor[fileCounter] = PDE;
fileCounter++;
code[fileCounter++] =
new Code(list[i].substring(0, list[i].length() - 4),
new File(directory, list[i]),
PDE);
} else if (list[i].endsWith(".java")) {
names[fileCounter] = list[i].substring(0, list[i].length() - 5);
files[fileCounter] = new File(directory, list[i]);
flavor[fileCounter] = JAVA;
fileCounter++;
code[fileCounter++] =
new Code(list[i].substring(0, list[i].length() - 5),
new File(directory, list[i]),
JAVA);
} else if (list[i].endsWith(".pde.x")) {
names[hiddenCounter] = list[i].substring(0, list[i].length() - 6);
files[hiddenCounter] = new File(directory, list[i]);
hiddenCounter++;
hidden[hiddenCounter++] =
new Code(list[i].substring(0, list[i].length() - 6),
new File(directory, list[i]),
PDE);
} else if (list[i].endsWith(".java.x")) {
names[hiddenCounter] = list[i].substring(0, list[i].length() - 7);
files[hiddenCounter] = new File(directory, list[i]);
hiddenCounter++;
hidden[hiddenCounter++] =
new Code(list[i].substring(0, list[i].length() - 7),
new File(directory, list[i]),
JAVA);
}
}
}
// remove any entries that didn't load properly
int index = 0;
while (index < codeCount) {
if (code[index].program == null) {
//hide(index); // although will this file be hidable?
for (int i = index+1; i < codeCount; i++) {
code[i-1] = code[i];
}
codeCount--;
} else {
index++;
}
}
}
@@ -124,32 +152,41 @@ public class PdeSketch {
*/
public void setCurrent(int which) {
// get the text currently being edited
program[current] = editor.getText();
//program[current] = editor.getText();
if (current != null) {
current.program = editor.getText();
}
current = code[which];
// 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(program[which], true);
editor.changeText(current.program, true);
// i'll personally make a note of the change
current = which;
// and i'll personally make a note of the change
//current = which;
}
/**
* This is not Runnable.run(), but a handler for the run() command.
*/
public void run() {
try {
String program = textarea.getText();
history.record(program, PdeHistory.RUN);
current.history.record(program, PdeHistory.RUN);
// if an external editor is being used, need to grab the
// latest version of the code from the file.
if (PdePreferences.getBoolean("editor.external")) {
// history gets screwed by the open..
String historySaved = history.lastRecorded;
//handleOpen(sketchName, sketchFile, sketchDir);
//handleOpen(sketch.name, sketch.file, sketch.directory);
handleOpen(sketch);
history.lastRecorded = historySaved;
//String historySaved = history.lastRecorded;
//handleOpen(sketch);
//history.lastRecorded = historySaved;
// nuke previous files and settings, just get things loaded
load();
}
// temporary build folder is inside 'lib'
@@ -160,16 +197,25 @@ public class PdeSketch {
buildDir.mkdirs();
}
// copy (changed) files from data directory into build folder
sketch.updateDataDirectory(buildDir);
//sketch.updateDataDirectory(buildDir);
// copy contents of data dir.. eventually, if the files
// already exist in the target, don't' bother.
//public void updateDataDirectory(File buildDir) {
File dataDir = new File(directory, "data");
if (dataDir.exists()) {
PdeBase.copyDir(dataDir, buildDir);
}
// make up a temporary class name to suggest
int numero1 = (int) (Math.random() * 10000);
int numero2 = (int) (Math.random() * 10000);
//String className = TEMP_CLASS + "_" + numero1 + "_" + numero2;
String className = "Temporary_" + numero1 + "_" + numero2;
// only used if the code is not in ADVANCED mode
String suggestedClassName =
("Temporary_" + String.valueOf((int) (Math.random() * 10000)) +
"_" + String.valueOf((int) (Math.random() * 10000)));
// handle building the code
className = build(program, className, tempBuildPath, false);
className = build(program, suggestedClassName, tempBuildPath);
// externalPaths is magically set by build()
// if the compilation worked, run the applet
if (className != null) {
@@ -257,37 +303,28 @@ public class PdeSketch {
// in an advanced program, the returned classname could be different,
// which is why the className is set based on the return value.
// @param exporting if set, then code is cleaner,
// but line numbers won't line up properly.
// also modifies which imports (1.1 only) are included.
// @return null if compilation failed, className if not
//
protected String build(String program, String className,
String buildPath, boolean exporting)
throws PdeException, Exception {
protected String build(String program, String suggestedClassName,
String buildPath) throws PdeException, Exception {
// true if this should extend BApplet instead of BAppletGL
//boolean extendsNormal = base.normalItem.getState();
externalRuntime = false;
externalPaths = null;
String externalImports[] = null;
externalCode = new File(sketchDir, "code");
if (externalCode.exists()) {
externalRuntime = true;
externalPaths = PdeCompiler.includeFolder(externalCode);
externalPaths = PdeCompiler.contentsToClassPath(externalCode);
externalImports = PdeCompiler.magicImports(externalPaths);
} else {
externalCode = null;
}
// add the includes from the external code dir
//
String imports[] = null;
if (externalCode != null) {
imports = PdeCompiler.magicImports(externalPaths);
}
PdePreprocessor preprocessor = null;
preprocessor = new PdePreprocessor(program, buildPath);
try {
@@ -372,16 +409,6 @@ public class PdeSketch {
}
*/
// copy contents of data dir
// eventually, if the files already exist in the target, don't' bother.
public void updateDataDirectory(File buildDir) {
File dataDir = new File(directory, "data");
if (dataDir.exists()) {
PdeBase.copyDir(dataDir, buildDir);
}
}
/**
* Returns path to the main .pde file for this sketch.
@@ -389,4 +416,54 @@ public class PdeSketch {
public String getMainFilePath() {
return files[0].getAbsolutePath();
}
}
}
class Code {
String name;
File file;
int flavor;
String program;
boolean modified;
History history;
public Code(String name, File file, int flavor) {
this.name = name;
this.file = file;
this.flavor = flavor;
}
public void load() {
program = null;
try {
if (files[i].length() != 0) {
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(files[i])));
StringBuffer buffer = new StringBuffer();
String line = null;
while ((line = reader.readLine()) != null) {
buffer.append(line);
buffer.append('\n');
}
reader.close();
program = buffer.toString();
} else {
// empty code file.. no worries, might be getting filled up
program = "";
}
} catch (IOException e) {
Pdebase.showWarning("Error loading file",
"Error while opening the file\n" +
files[i].getPath(), e);
program = null; // just in case
}
if (program != null) {
history = new History(file);
}
}
}