diff --git a/app/Compiler.java b/app/Compiler.java index ac1684b7d..23579110b 100644 --- a/app/Compiler.java +++ b/app/Compiler.java @@ -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 diff --git a/app/Editor.java b/app/Editor.java index 80e0e39a1..df9779eec 100644 --- a/app/Editor.java +++ b/app/Editor.java @@ -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); } diff --git a/app/Sketch.java b/app/Sketch.java index a8e628b6e..d64ff30a5 100644 --- a/app/Sketch.java +++ b/app/Sketch.java @@ -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) { diff --git a/app/preproc/PdePreprocessor.java b/app/preproc/PdePreprocessor.java index df99e9cf0..37262f4c9 100755 --- a/app/preproc/PdePreprocessor.java +++ b/app/preproc/PdePreprocessor.java @@ -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) * diff --git a/build/macosx/Arduino.xcodeproj/project.pbxproj b/build/macosx/Arduino.xcodeproj/project.pbxproj index 6907c45e7..6169f0d53 100644 --- a/build/macosx/Arduino.xcodeproj/project.pbxproj +++ b/build/macosx/Arduino.xcodeproj/project.pbxproj @@ -362,6 +362,7 @@ /* Begin PBXFileReference section */ 330B21530968180400345666 /* librxtxSerial.jnilib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; path = librxtxSerial.jnilib; sourceTree = ""; }; + 333269E1099BB1FC007D3AE2 /* tools.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = tools.zip; sourceTree = ""; }; 33AF620A0965D67800B514A9 /* antlr.jar */ = {isa = PBXFileReference; lastKnownFileType = archive.jar; path = antlr.jar; sourceTree = ""; }; 33AF620B0965D67900B514A9 /* applet.html */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.html; path = applet.html; sourceTree = ""; }; 33AF620C0965D67900B514A9 /* mrj.jar */ = {isa = PBXFileReference; lastKnownFileType = archive.jar; path = mrj.jar; sourceTree = ""; }; @@ -517,7 +518,6 @@ 33FFFEB50965BD110016AC38 /* DS_Store */ = {isa = PBXFileReference; lastKnownFileType = file; path = DS_Store; sourceTree = ""; }; 33FFFEB60965BD110016AC38 /* jikes */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = jikes; sourceTree = ""; }; 33FFFEB90965BD110016AC38 /* macosx_setup.command */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = macosx_setup.command; sourceTree = ""; }; - 33FFFEBC0965BD110016AC38 /* tools.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = tools.zip; sourceTree = ""; }; 33FFFEBD0965BD110016AC38 /* dist.sh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = dist.sh; sourceTree = ""; }; 33FFFEBE0965BD110016AC38 /* make.sh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = make.sh; sourceTree = ""; }; 33FFFEBF0965BD110016AC38 /* mkdmg */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = mkdmg; sourceTree = ""; }; @@ -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 = ""; @@ -969,13 +968,6 @@ path = drivers; sourceTree = ""; }; - 33FFFEBA0965BD110016AC38 /* serial */ = { - isa = PBXGroup; - children = ( - ); - path = serial; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXJavaArchiveBuildPhase section */ diff --git a/build/macosx/dist/tools.zip b/build/macosx/dist/tools.zip index 8212a1c08..fea7869fc 100644 Binary files a/build/macosx/dist/tools.zip and b/build/macosx/dist/tools.zip differ