public void loadFromFile(String filename) throws IOException {
// make inpustream for board
Reader r = new BufferedReader(new FileReader(dir + filename));
// read board, looking for "size"
StreamTokenizer st = new StreamTokenizer(r);
st.eolIsSignificant(true);
st.commentChar('#');
st.quoteChar('"');
st.wordChars('_', '_');
while (st.nextToken() != StreamTokenizer.TT_EOF) {
String name = null;
String imageName = null;
if ((st.ttype == StreamTokenizer.TT_WORD)
&& st.sval.equalsIgnoreCase("include")) { //$NON-NLS-1$
st.nextToken();
name = st.sval;
System.out.print("Loading more unit images from "); //$NON-NLS-1$
System.out.print(name);
System.out.println("..."); //$NON-NLS-1$
try {
loadFromFile(name);
System.out.print("... finished "); //$NON-NLS-1$
System.out.print(name);
System.out.println("."); //$NON-NLS-1$
} catch (IOException ioerr) {
System.out.print("... failed: "); //$NON-NLS-1$
System.out.print(ioerr.getMessage());
System.out.println("."); //$NON-NLS-1$
}
} else if ((st.ttype == StreamTokenizer.TT_WORD)
&& st.sval.equalsIgnoreCase("chassis")) { //$NON-NLS-1$
st.nextToken();
name = st.sval;
st.nextToken();
imageName = st.sval;
// add to list
chassis.put(name.toUpperCase(), new MechEntry(name, imageName));
} else if ((st.ttype == StreamTokenizer.TT_WORD)
&& st.sval.equalsIgnoreCase("exact")) { //$NON-NLS-1$
st.nextToken();
name = st.sval;
st.nextToken();
imageName = st.sval;
// add to list
exact.put(name.toUpperCase(), new MechEntry(name, imageName));
}
}