1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-29 10:24:12 +01:00

Updating to C++, new Mac avr tools, Windows to be updated.

This commit is contained in:
David A. Mellis 2006-02-24 15:52:58 +00:00
parent c8711cd2fd
commit 18fc6d6875
6 changed files with 38 additions and 26 deletions

View File

@ -526,14 +526,14 @@ public class Compiler implements MessageConsumer {
String s1 = s.substring(partialStartIndex +
partialTempPath.length() + 1);
//System.out.println(s1);
if (s1.indexOf("In function")!= -1) {
int colon = s1.indexOf(':');
if (s1.indexOf("In function") != -1 || colon == -1) {
System.err.print(s1);
//firstErrorFound = true;
return;
}
int colon = s1.indexOf(':');
int lineNumber = Integer.parseInt(s1.substring(0, colon));
// the "1" corresponds to the amount of lines written to the main code

View File

@ -776,6 +776,15 @@ public class Editor extends JFrame
// });
// menu.add(item);
item = new JMenuItem("Howto");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Base.openURL(System.getProperty("user.dir") + File.separator +
"reference" + File.separator + "howto.html");
}
});
menu.add(item);
item = new JMenuItem("Reference");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@ -1961,14 +1970,14 @@ public class Editor extends JFrame
cutItem.setEnabled(true);
copyItem.setEnabled(true);
referenceFile = PdeKeywords.getReference(textarea.getSelectedText());
if (referenceFile != null) {
referenceItem.setEnabled(true);
}
//referenceFile = PdeKeywords.getReference(textarea.getSelectedText());
//if (referenceFile != null) {
//referenceItem.setEnabled(true);
//}
} else {
cutItem.setEnabled(false);
copyItem.setEnabled(false);
referenceItem.setEnabled(false);
//referenceItem.setEnabled(false);
}
super.show(component, x, y);
}

View File

@ -1382,7 +1382,8 @@ public class Sketch {
//System.out.println();
} else {
code[0].preprocName = className + "." + Preferences.get("build.extension");
//code[0].preprocName = className + "." + Preferences.get("build.extension");
code[0].preprocName = className + ".cpp";
}
// store this for the compiler and the runtime
@ -1511,7 +1512,8 @@ public class Sketch {
// just write the the contents of 'program' to a .java file
// into the build directory. uses byte stream and reader/writer
// shtuff so that unicode bunk is properly handled
String filename = code[i].name + "." + Preferences.get("build.extension");
//String filename = code[i].name + "." + Preferences.get("build.extension");
String filename = code[i].name + ".cpp";
try {
Base.saveFile(code[i].program, new File(buildPath, filename));
} catch (IOException e) {

View File

@ -236,7 +236,7 @@ public class PdePreprocessor {
String returntype, functioname, parameterlist, prototype;
java.util.LinkedList prototypes = new java.util.LinkedList();
//System.out.println("prototypes:");
if (Preferences.get("build.extension").equals("cpp")) {
//if (Preferences.get("build.extension").equals("cpp")) {
while(matcher.contains(input, pattern)){
result = matcher.getMatch();
//System.out.println(result);
@ -253,7 +253,7 @@ public class PdePreprocessor {
prototypes.add(prototype);
//System.out.println(prototype);
}
}
//}
// store # of prototypes so that line number reporting can be adjusted
prototypeCount = prototypes.size();
@ -299,7 +299,7 @@ public class PdePreprocessor {
// start parsing at the compilationUnit non-terminal
//
//parser.pdeProgram();
parser.translationUnit();
//parser.translationUnit();
// set up the AST for traversal by PdeEmitter
//
@ -329,16 +329,19 @@ public class PdePreprocessor {
// output the code
//
WEmitter emitter = new WEmitter(lexer.getPreprocessorInfoChannel());
File streamFile = new File(buildPath, name + "." + Preferences.get("build.extension"));
//File streamFile = new File(buildPath, name + "." + Preferences.get("build.extension"));
File streamFile = new File(buildPath, name + ".cpp");
PrintStream stream = new PrintStream(new FileOutputStream(streamFile));
//writeHeader(stream, extraImports, name);
writeHeader(stream, name, prototypes);
//added to write the pde code to the cpp file
writeProgram(stream, name, program);
emitter.setASTNodeType(TNode.class.getName());
emitter.setOut(stream);
emitter.printDeclarations(rootNode);
//emitter.printDeclarations(rootNode);
//emitter.print(rootNode);
emitter.translationUnit(parser.getAST());
//emitter.translationUnit(parser.getAST());
writeFooter(stream);
stream.close();
@ -363,6 +366,12 @@ public class PdePreprocessor {
return name;
}
// Write the pde program to the cpp file
void writeProgram(PrintStream out, String className, String program) {
out.print(program);
}
/**
* Write any required header material (eg imports, class decl stuff)
*

View File

@ -362,6 +362,7 @@
/* Begin PBXFileReference section */
330B21530968180400345666 /* librxtxSerial.jnilib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; path = librxtxSerial.jnilib; sourceTree = "<group>"; };
333269E1099BB1FC007D3AE2 /* tools.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = tools.zip; sourceTree = "<group>"; };
33AF620A0965D67800B514A9 /* antlr.jar */ = {isa = PBXFileReference; lastKnownFileType = archive.jar; path = antlr.jar; sourceTree = "<group>"; };
33AF620B0965D67900B514A9 /* applet.html */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.html; path = applet.html; sourceTree = "<group>"; };
33AF620C0965D67900B514A9 /* mrj.jar */ = {isa = PBXFileReference; lastKnownFileType = archive.jar; path = mrj.jar; sourceTree = "<group>"; };
@ -517,7 +518,6 @@
33FFFEB50965BD110016AC38 /* DS_Store */ = {isa = PBXFileReference; lastKnownFileType = file; path = DS_Store; sourceTree = "<group>"; };
33FFFEB60965BD110016AC38 /* jikes */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = jikes; sourceTree = "<group>"; };
33FFFEB90965BD110016AC38 /* macosx_setup.command */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = macosx_setup.command; sourceTree = "<group>"; };
33FFFEBC0965BD110016AC38 /* tools.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = tools.zip; sourceTree = "<group>"; };
33FFFEBD0965BD110016AC38 /* dist.sh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = dist.sh; sourceTree = "<group>"; };
33FFFEBE0965BD110016AC38 /* make.sh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = make.sh; sourceTree = "<group>"; };
33FFFEBF0965BD110016AC38 /* mkdmg */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = mkdmg; sourceTree = "<group>"; };
@ -940,14 +940,13 @@
33FFFEAC0965BD110016AC38 /* dist */ = {
isa = PBXGroup;
children = (
333269E1099BB1FC007D3AE2 /* tools.zip */,
330B21530968180400345666 /* librxtxSerial.jnilib */,
33FFFEAE0965BD110016AC38 /* bootloader */,
33FFFEB20965BD110016AC38 /* drivers */,
33FFFEB50965BD110016AC38 /* DS_Store */,
33FFFEB60965BD110016AC38 /* jikes */,
33FFFEB90965BD110016AC38 /* macosx_setup.command */,
33FFFEBA0965BD110016AC38 /* serial */,
33FFFEBC0965BD110016AC38 /* tools.zip */,
);
path = dist;
sourceTree = "<group>";
@ -969,13 +968,6 @@
path = drivers;
sourceTree = "<group>";
};
33FFFEBA0965BD110016AC38 /* serial */ = {
isa = PBXGroup;
children = (
);
path = serial;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXJavaArchiveBuildPhase section */

Binary file not shown.