1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

Now appending main() to the user's sketch in preparation for making the Arduino core a library (.a) file.

This commit is contained in:
David A. Mellis
2007-01-12 17:58:39 +00:00
parent 2e1776862e
commit 41d50ae572
5 changed files with 37 additions and 26 deletions

View File

@ -104,7 +104,8 @@ public class PdePreprocessor {
//public String write(String program, String buildPath, String name,
// String extraImports[]) throws java.lang.Exception {
public String write(String program, String buildPath,
String name, String codeFolderPackages[])
String name, String codeFolderPackages[],
Target target)
throws java.lang.Exception {
// if the program ends with no CR or LF an OutOfMemoryError will happen.
// not gonna track down the bug now, so here's a hack for it:
@ -344,7 +345,7 @@ public class PdePreprocessor {
//emitter.print(rootNode);
//emitter.translationUnit(parser.getAST());
writeFooter(stream);
writeFooter(stream, target);
stream.close();
// if desired, serialize the parse tree to an XML file. can
@ -457,20 +458,23 @@ public class PdePreprocessor {
*
* @param out PrintStream to write it to.
*/
void writeFooter(PrintStream out) {
//out.print("}");
void writeFooter(PrintStream out, Target target) throws java.lang.Exception {
// Open the file main.cxx and copy its entire contents to the bottom of the
// generated sketch .cpp file...
/* if (programType == STATIC) {
// close off draw() definition
out.print("noLoop(); ");
out.print("}");
String mainFileName = target.getPath() + File.separator + "main.cxx";
FileReader reader = null;
reader = new FileReader(mainFileName);
LineNumberReader mainfile = new LineNumberReader(reader);
String line;
while ((line = mainfile.readLine()) != null) {
out.print(line + "\n");
}
if (programType < JAVA) {
// close off the class definition
out.print("}");
}
*/ }
mainfile.close();
}
static String advClassName = "";