diff --git a/app/build.xml b/app/build.xml
index 06cc52fd7a1..c076790a9b7 100644
--- a/app/build.xml
+++ b/app/build.xml
@@ -53,4 +53,5 @@
+
diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java
index 6f1cf5fca26..5dec9d9e9ad 100644
--- a/app/src/processing/app/Base.java
+++ b/app/src/processing/app/Base.java
@@ -25,7 +25,6 @@
import java.awt.*;
import java.awt.event.*;
import java.io.*;
-import java.nio.charset.Charset;
import java.util.*;
import java.util.regex.*;
import javax.swing.*;
@@ -63,8 +62,8 @@ public class Base {
platformIndices.put("macosx", PConstants.MACOSX);
platformIndices.put("linux", PConstants.LINUX);
}
-
- static Map archMap = new HashMap();
+
+ static Map archMap = new HashMap();
static {
archMap.put("arduino", "avr");
archMap.put("msp430", "msp430");
@@ -95,7 +94,7 @@ public class Base {
static private File hardwareFolder;
static HashSet libraries;
-
+
// maps imported packages to their library folder
static HashMap importToLibraryTable;
@@ -103,7 +102,7 @@ public class Base {
// (both those in the p5/libs folder and those with lib subfolders
// found in the sketchbook)
static public String librariesClassPath;
-
+
static public HashMap targetsTable;
// Location for untitled items
@@ -119,6 +118,16 @@ public class Base {
// ArrayList editors = Collections.synchronizedList(new ArrayList());
Editor activeEditor;
+ static private ArrayList boardsStingNames = new ArrayList();
+ static{
+ boardsStingNames.add("msp430");
+ boardsStingNames.add("lm4f");
+ boardsStingNames.add("c2000");
+ boardsStingNames.add("cc3200");
+ boardsStingNames.add("msp432");
+ boardsStingNames.add("cc3200emt");
+ boardsStingNames.add("msp432");
+ }
static public void main(String args[]) {
try {
@@ -249,92 +258,87 @@ static protected void initRequirements() {
public Base(String[] args) {
- platform.init(this);
-
- // Get paths for the libraries and examples in the Processing folder
- //String workingDirectory = System.getProperty("user.dir");
- examplesFolder = getContentFile("examples");
- String targetLibDir = new String("");
- if(Preferences.get("target").equals("msp430"))
- targetLibDir = "hardware/msp430/";
- else if (Preferences.get("target").equals("lm4f"))
- targetLibDir = "hardware/lm4f/";
- else if (Preferences.get("target").equals("c2000"))
- targetLibDir = "hardware/c2000/";
- else if (Preferences.get("target").equals("cc3200"))
- targetLibDir = "hardware/cc3200/";
- else if (Preferences.get("target").equals("cc3200emt"))
- targetLibDir = "hardware/cc3200emt/";
- else if (Preferences.get("target").equals("msp432"))
- targetLibDir = "hardware/msp432/";
- else if (Preferences.get("target").equals("cc2600emt"))
- targetLibDir = "hardware/cc2600emt/";
+ platform.init(this);
+
+ // Get paths for the libraries and examples in the Processing folder
+ //String workingDirectory = System.getProperty("user.dir");
+ examplesFolder = getContentFile("examples");
+
+ String targetLibDir = new String("");
+ String boardNameString = Preferences.get("target");
+ for (String boardName : boardsStingNames) {
+ if (boardNameString.equals(boardName)) {
+ targetLibDir = "hardware/" + boardName + "/";
+ }
+ }
+
librariesFolder = getContentFile(targetLibDir + "libraries");
toolsFolder = getContentFile("tools");
// Get the sketchbook path, and make sure it's set properly
String sketchbookPath = Preferences.get("sketchbook.path");
- // If a value is at least set, first check to see if the folder exists.
- // If it doesn't, warn the user that the sketchbook folder is being reset.
- if (sketchbookPath != null) {
- File skechbookFolder = new File(sketchbookPath);
- if (!skechbookFolder.exists()) {
- Base.showWarning(_("Sketchbook folder disappeared"),
- _("The sketchbook folder no longer exists.\n" +
- "Energia will switch to the default sketchbook\n" +
- "location, and create a new sketchbook folder if\n" +
- "necessary. Energia will then stop talking about\n" +
- "himself in the third person."), null);
- sketchbookPath = null;
+ // If a value is at least set, first check to see if the folder exists.
+ // If it doesn't, warn the user that the sketchbook folder is being reset.
+ if (sketchbookPath != null) {
+ File skechbookFolder = new File(sketchbookPath);
+ if (!skechbookFolder.exists()) {
+ Base.showWarning(_("Sketchbook folder disappeared"),
+ _("The sketchbook folder no longer exists.\n" +
+ "Energia will switch to the default sketchbook\n" +
+ "location, and create a new sketchbook folder if\n" +
+ "necessary. Energia will then stop talking about\n" +
+ "himself in the third person."), null);
+ sketchbookPath = null;
+ }
}
- }
- // If no path is set, get the default sketchbook folder for this platform
- if (sketchbookPath == null) {
- File defaultFolder = getDefaultSketchbookFolder();
- Preferences.set("sketchbook.path", defaultFolder.getAbsolutePath());
- if (!defaultFolder.exists()) {
- defaultFolder.mkdirs();
- }
- }
-
- targetsTable = new HashMap();
- loadHardware(getHardwareFolder());
- loadHardware(getSketchbookHardwareFolder());
-
- // Check if there were previously opened sketches to be restored
- boolean opened = restoreSketches();
-
- // Check if any files were passed in on the command line
- for (int i = 0; i < args.length; i++) {
- String path = args[i];
- // Fix a problem with systems that use a non-ASCII languages. Paths are
- // being passed in with 8.3 syntax, which makes the sketch loader code
- // unhappy, since the sketch folder naming doesn't match up correctly.
- // http://dev.processing.org/bugs/show_bug.cgi?id=1089
- if (isWindows()) {
- try {
- File file = new File(args[i]);
- path = file.getCanonicalPath();
- } catch (IOException e) {
- e.printStackTrace();
- }
+ // If no path is set, get the default sketchbook folder for this platform
+ if (sketchbookPath == null) {
+ File defaultFolder = getDefaultSketchbookFolder();
+ Preferences.set("sketchbook.path", defaultFolder.getAbsolutePath());
+ if (!defaultFolder.exists()) {
+ defaultFolder.mkdirs();
+ }
}
- if (handleOpen(path) != null) {
- opened = true;
+
+ targetsTable = new HashMap();
+ loadHardware(getHardwareFolder());
+ loadHardware(getSketchbookHardwareFolder());
+
+ // Check if there were previously opened sketches to be restored
+ boolean opened = restoreSketches();
+
+ // Check if any files were passed in on the command line
+ for (int i = 0; i < args.length; i++) {
+ String path = args[i];
+ // Fix a problem with systems that use a non-ASCII languages. Paths are
+ // being passed in with 8.3 syntax, which makes the sketch loader code
+ // unhappy, since the sketch folder naming doesn't match up correctly.
+ // http://dev.processing.org/bugs/show_bug.cgi?id=1089
+ if (isWindows()) {
+ try {
+ File file = new File(args[i]);
+ path = file.getCanonicalPath();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ if (handleOpen(path) != null) {
+ opened = true;
+ }
}
- }
- // Create a new empty window (will be replaced with any files to be opened)
- if (!opened) {
- handleNew();
- }
+ // Create a new empty window (will be replaced with any files to be opened)
+ if (!opened) {
+ handleNew();
+ }
- // check for updates
- if (Preferences.getBoolean("update.check")) {
- new UpdateCheck(this);
- }
+ // check for updates
+ if (Preferences.getBoolean("update.check")) {
+ new UpdateCheck(this);
+ }
+
}
@@ -606,14 +610,14 @@ private void findInsertPoint(Editor editor)
{
// Find the start point
String t = editor.getText();
-
+
try {
Pattern regex = Pattern.compile("void\\s+setup\\s*\\(\\s*\\)");
Matcher regexMatcher = regex.matcher(t);
- while (regexMatcher.find())
+ while (regexMatcher.find())
{
int totalLeftBracketsOpened = 0;
-
+
for(int i = regexMatcher.end(); i regexMatcher.end();j--)
{
int c = t.charAt(j);
-
+
if(c!=10 && c!=13)
{
editor.setSelection(++j,j);
@@ -640,7 +644,7 @@ private void findInsertPoint(Editor editor)
}
}
break;
- }
+ }
} catch (PatternSyntaxException ex) {
// Syntax error in the regular expression
}
@@ -1003,7 +1007,7 @@ public void actionPerformed(ActionEvent e) {
temp = new JMenu("Contributed Libraries");
found = addSketches(temp, getSketchbookLibrariesFolder(), true);
if (found) {menu.add(temp); n++;};
-
+
temp = new JMenu("Libraries");
addSketches(temp, librariesFolder, true);
menu.add(temp);
@@ -1011,7 +1015,7 @@ public void actionPerformed(ActionEvent e) {
} catch (IOException e) {
e.printStackTrace();
}
-
+
return n;
}
@@ -1076,63 +1080,53 @@ public void rebuildExamplesMenu(JMenu menu) {
e.printStackTrace();
}
}
-
-
+
+
public void onBoardOrPortChange() {
for (Editor editor : editors) {
editor.onBoardOrPortChange();
- }
+ }
}
-
+
public void onArchChanged() {
for (Editor editor : editors) {
editor.onArchChanged();
- }
+ }
}
-
-
public void rebuildBoardsMenu(JMenu menu) {
//System.out.println("rebuilding boards menu");
- menu.removeAll();
+ menu.removeAll();
ButtonGroup group = new ButtonGroup();
+
for (Target target : targetsTable.values()) {
for (String board : target.getBoards().keySet()) {
- AbstractAction action =
- new AbstractAction(target.getBoards().get(board).get("name")) {
- public void actionPerformed(ActionEvent actionevent) {
- //System.out.println("Switching to " + target + ":" + board);
- String n = (String)getValue("target");
- String o = Preferences.get("target");
- if(!n.equals(o)) {
- String targetLibDir = new String("");
- if(n.equals("msp430"))
- targetLibDir = "hardware/msp430/";
- else if(n.equals("lm4f"))
- targetLibDir = "hardware/lm4f/";
- else if(n.equals("c2000"))
- targetLibDir = "hardware/c2000/";
- else if(n.equals("cc3200"))
- targetLibDir = "hardware/cc3200/";
- else if(n.equals("msp432"))
- targetLibDir = "hardware/msp432/";
- else if(n.equals("cc3200emt"))
- targetLibDir = "hardware/cc3200emt/";
- else if(n.equals("cc2600emt"))
- targetLibDir = "hardware/cc2600emt/";
- librariesFolder = getContentFile(targetLibDir + "libraries");
- onArchChanged();
- }
- Preferences.set("target", (String) getValue("target"));
- Preferences.set("board", (String) getValue("board"));
- onBoardOrPortChange();
- Sketch.buildSettingChanged();
- }
- };
+ AbstractAction action =
+ new AbstractAction(target.getBoards().get(board).get("name")) {
+ public void actionPerformed(ActionEvent actionevent) {
+ String n = (String) getValue("target");
+ String o = Preferences.get("target");
+
+ if (!n.equals(o)) {
+ String targetLibDir = new String("");
+ for (String boardName : boardsStingNames){
+ if (n.equals(boardName)){
+ targetLibDir = "hardware/" + boardName + "/";
+ }
+ }
+ librariesFolder = getContentFile(targetLibDir + "libraries");
+ onArchChanged();
+ }
+ Preferences.set("target", (String) getValue("target"));
+ Preferences.set("board", (String) getValue("board"));
+ onBoardOrPortChange();
+ Sketch.buildSettingChanged();
+ }
+ };
action.putValue("target", target.getName());
action.putValue("board", board);
JMenuItem item = new JRadioButtonMenuItem(action);
if (target.getName().equals(Preferences.get("target")) &&
- board.equals(Preferences.get("board"))) {
+ board.equals(Preferences.get("board"))) {
item.setSelected(true);
}
group.add(item);
@@ -1140,9 +1134,8 @@ else if(n.equals("cc2600emt"))
}
}
}
-
-/*
+ /*
public void rebuildProgrammerMenu(JMenu menu) {
//System.out.println("rebuilding programmer menu");
menu.removeAll();
@@ -1219,7 +1212,7 @@ public void actionPerformed(ActionEvent e) {
boolean skipLibraryFolder = folder.equals((Base.getSketchbookFolder()));
for (int i = 0; i < list.length; i++) {
- if ((list[i].charAt(0) == '.') || list[i].startsWith("__disabled_") || list[i].equals("CVS") ||
+ if ((list[i].charAt(0) == '.') || list[i].startsWith("__disabled_") || list[i].equals("CVS") ||
(skipLibraryFolder && list[i].compareToIgnoreCase("libraries")==0)) continue;
File subfolder = new File(folder, list[i]);
@@ -1360,11 +1353,11 @@ public void actionPerformed(ActionEvent e) {
}
return ifound;
}
-
-
+
+
protected void loadHardware(File folder) {
if (!folder.isDirectory()) return;
-
+
String list[] = folder.list(new FilenameFilter() {
public boolean accept(File dir, String name) {
// skip .DS_Store files, .svn folders, etc
@@ -1379,9 +1372,9 @@ public boolean accept(File dir, String name) {
// alphabetize list, since it's not always alpha order
// replaced hella slow bubble sort with this feller for 0093
Arrays.sort(list, String.CASE_INSENSITIVE_ORDER);
-
+
for (String target : list) {
-
+
//Check to ensure compiler is installed before displaying C2000 Support
if(target.equals("c2000")){
if(Base.getC2000BasePath() != ""){
@@ -1393,7 +1386,7 @@ public boolean accept(File dir, String name) {
targetsTable.put(target, new Target(target, subfolder));
}
}
-
+
}
@@ -1654,12 +1647,12 @@ static public File getHardwareFolder() {
// before the other folders / paths get cached).
return getContentFile("hardware");
}
-
-
+
+
static public String getHardwarePath() {
return getHardwareFolder().getAbsolutePath();
}
-
+
static public String readFile(String fileName) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(fileName));
@@ -1672,13 +1665,13 @@ static public String readFile(String fileName) throws IOException {
sb.append("\n");
line = br.readLine();
}
-
+
return sb.toString();
} finally {
br.close();
}
}
-
+
static public String getArchCorePath() {
String arch = getArch();
String path = getHardwarePath() + File.separator + arch + File.separator +
@@ -1686,7 +1679,7 @@ static public String getArchCorePath() {
return path;
}
-
+
static public String getAvrBasePath() {
String path = getHardwarePath() + File.separator + "tools" +
File.separator + "avr" + File.separator + "bin" + File.separator;
@@ -1716,9 +1709,14 @@ static public String getLM4FBasePath() {
//TODO: check tools path
static public String getC2000BasePath() {
- String path = getHardwarePath() + File.separator + "tools" +
- File.separator + "c2000" + File.separator + "bin" + File.separator;
-
+ //String path = getHardwarePath() + File.separator + "tools" +
+ // File.separator + "c2000" + File.separator + "bin" + File.separator;
+
+String path = getHardwarePath() + File.separator +
+ "c2000" + File.separator + "bin" + File.separator;
+
+ System.out.println("getC2000BasePath:"+path);
+
if(!(new File(path)).exists()){
return ""; // use msp430-gcc and mspdebug in PATH instead of platform version
}
@@ -1728,7 +1726,7 @@ static public String getC2000BasePath() {
static public String getArch() {
return archMap.get(Preferences.get("target"));
}
-
+
static public String toShortPath(String longpath) {
String shortpath = "", sub = "";
//longpath = longpath.replaceAll("\\s", "");
@@ -1740,15 +1738,15 @@ static public String toShortPath(String longpath) {
{
int thisFile = 1;
sub = temp.substring(0, 6);
-
+
// Find if there are more files
File dir = new File(shortpath);
- for (File child : dir.listFiles())
+ for (File child : dir.listFiles())
{
String originalName = child.getName().toUpperCase();
String tempName = originalName.replaceAll("\\s", "");
int l = tempName.length();
-
+
if(tempName.substring(0, l>6 ? 6:l).compareTo(sub)==0)
{
if(originalName.compareTo(temp)==0)
@@ -1758,20 +1756,20 @@ static public String toShortPath(String longpath) {
}
}
String ext = "";
-
+
if(temp.indexOf(".")>0) // There is an extension to add
{
ext = temp.substring(temp.lastIndexOf(".")+1);
ext = "." + ext.substring(0,ext.length()>3?3:ext.length());
}
-
+
temp = sub + "~" + thisFile + ext;
}
shortpath += temp + "\\";
}
return shortpath;
}
-
+
static public String getBasePath() {
if (Base.isLinux()) {
if (getArch() == "msp430") {
@@ -1806,7 +1804,7 @@ else if (getArch() == "c2000") {
+ arch + File.separator + "bin" + File.separator;
}
}
-
+
static public String getCommonBasePath() {
return getToolsPath() +
File.separator + "common" + File.separator + "bin" + File.separator;
@@ -1815,8 +1813,8 @@ static public String getCommonBasePath() {
static public Target getTarget() {
return Base.targetsTable.get(Preferences.get("target"));
}
-
-
+
+
static public Map getBoardPreferences() {
Target target = getTarget();
if (target == null) return new LinkedHashMap();
@@ -1826,7 +1824,7 @@ static public Map getBoardPreferences() {
if (map == null) return new LinkedHashMap();
return map;
}
-
+
static public File getSketchbookFolder() {
return new File(Preferences.get("sketchbook.path"));
@@ -1853,8 +1851,8 @@ static public File getSketchbookLibrariesFolder() {
static public String getSketchbookLibrariesPath() {
return getSketchbookLibrariesFolder().getAbsolutePath();
}
-
-
+
+
static public File getSketchbookHardwareFolder() {
return new File(getSketchbookFolder(), "hardware");
}
@@ -2007,7 +2005,7 @@ static public void setIcon(Frame frame) {
// don't use the low-res icon on Mac OS X; the window should
// already have the right icon from the .app file.
if (Base.isMacOS()) return;
-
+
ArrayList images = new ArrayList();
images.add(createImageFromLib("energia_16.png"));
images.add(createImageFromLib("energia_24.png"));
@@ -2015,7 +2013,7 @@ static public void setIcon(Frame frame) {
images.add(createImageFromLib("energia_48.png"));
frame.setIconImages(images);
}
-
+
static private Image createImageFromLib(String filename)
{
return Toolkit.getDefaultToolkit().createImage(new File("lib/" + filename).getAbsolutePath());
@@ -2100,7 +2098,7 @@ static public void showTroubleshooting() {
static public void showFAQ() {
showReference(_("FAQ.html"));
}
-
+
// .................................................................
@@ -2334,7 +2332,7 @@ static public File getAppFile() {
return new File(path);
//return new File(working, name);
}
-
+
static public File getContentFile(String name) {
String path = System.getProperty("user.dir");
diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java
index 5f60e7c5d5b..ab02eacb095 100644
--- a/app/src/processing/app/Editor.java
+++ b/app/src/processing/app/Editor.java
@@ -100,7 +100,7 @@ public class Editor extends JFrame implements RunnerListener {
static SerialMenuListener serialMenuListener;
static SerialMonitor serialMonitor;
-
+
EditorHeader header;
EditorStatus status;
EditorConsole console;
@@ -116,7 +116,7 @@ public class Editor extends JFrame implements RunnerListener {
EditorLineStatus lineStatus;
//JEditorPane editorPane;
-
+
JEditTextArea textarea;
EditorListener listener;
@@ -202,7 +202,7 @@ public void windowDeactivated(WindowEvent e) {
serialMonitor = new SerialMonitor(Preferences.get("serial.port"));
serialMonitor.setIconImage(getIconImage());
}
-
+
buildMenuBar();
// For rev 0120, placing things inside a JPanel
@@ -547,7 +547,7 @@ public void actionPerformed(ActionEvent e) {
}
});
fileMenu.add(item);
-
+
item = newJMenuItem(_("Upload and then Open Serial Monitor"), 'M');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@@ -556,7 +556,7 @@ public void actionPerformed(ActionEvent e) {
});
fileMenu.add(item);
- if(!Preferences.get("target").equals("msp430")
+ if(!Preferences.get("target").equals("msp430")
|| !Preferences.get("target").equals("lm4f")) {
item = newJMenuItemShift(_("Upload Using Programmer"), 'U');
item.addActionListener(new ActionListener() {
@@ -610,7 +610,7 @@ public void actionPerformed(ActionEvent e) {
}
return fileMenu;
}
-
+
private void rebuildExamplesMenu(){
base.rebuildExamplesMenu(examplesMenu);
@@ -631,8 +631,8 @@ private void rebuildExamplesMenu(){
}
MenuScroller.setScrollerFor(examplesMenu,-1,-1,upper>0?upper+1:0,lower);
}
-
-
+
+
protected JMenu buildSketchMenu() {
JMenuItem item;
sketchMenu = new JMenu(_("Sketch"));
@@ -663,9 +663,9 @@ public void actionPerformed(ActionEvent e) {
}
});
sketchMenu.add(item);
-
-
-
+
+
+
item = newJMenuItemAlt(_("Show Compilation Folder"), 'R');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@@ -722,9 +722,9 @@ public void actionPerformed(ActionEvent e) {
MenuScroller.setScrollerFor(importMenu,-1,-1,n+1,0);
}
sketchMenu.add(importMenu);
-
+
// This is the library manager, since is not OS agnostic, for now it is disabled
- /*if(Base.isWindows())
+ /*if(Base.isWindows())
{
item = new JMenuItem(_("Manage Libraries..."));
item.addActionListener(new ActionListener() {
@@ -770,7 +770,7 @@ protected JMenu buildToolsMenu() {
JMenuItem item;
addInternalTools(menu);
-
+
item = newJMenuItemShift(_("Serial Monitor"), 'M');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@@ -778,25 +778,25 @@ public void actionPerformed(ActionEvent e) {
}
});
menu.add(item);
-
+
addTools(menu, Base.getToolsFolder());
File sketchbookTools = new File(Base.getSketchbookFolder(), "tools");
addTools(menu, sketchbookTools);
menu.addSeparator();
-
+
numTools = menu.getItemCount();
-
+
// XXX: DAM: these should probably be implemented using the Tools plugin
// API, if possible (i.e. if it supports custom actions, etc.)
-
+
if (boardsMenu == null) {
- boardsMenu = new JMenu(_("Board"));
- MenuScroller.setScrollerFor(boardsMenu);
- base.rebuildBoardsMenu(boardsMenu);
+ boardsMenu = new JMenu(_("Board"));
+ MenuScroller.setScrollerFor(boardsMenu);
+ base.rebuildBoardsMenu(boardsMenu);
}
menu.add(boardsMenu);
-
+
if (serialMenuListener == null)
serialMenuListener = new SerialMenuListener();
if (serialMenu == null)
@@ -819,7 +819,7 @@ public void actionPerformed(ActionEvent e) {
});
menu.add(item);
}
-*/
+*/
item = new JMenuItem(_("Update programmer"));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@@ -1040,7 +1040,7 @@ public void actionPerformed(ActionEvent e) {
}
*/
}
-
+
protected void selectSerialPort(String name) {
if(serialMenu == null) {
System.out.println(_("serialMenu is null"));
@@ -1074,9 +1074,9 @@ protected void populateSerialMenu() {
// getting list of ports
JMenuItem rbMenuItem;
-
+
//System.out.println("Clearing serial port menu.");
-
+
serialMenu.removeAll();
boolean empty = true;
@@ -1095,7 +1095,7 @@ protected void populateSerialMenu() {
if(curr_port.indexOf("tty.uart") == -1
&& curr_port.indexOf("tty.usbmodem") == -1
&& curr_port.indexOf("tty.usbserial") == -1
- && curr_port.indexOf("cu.usbserial") == -1) continue;
+ && curr_port.indexOf("cu.usbserial") == -1) continue;
}
rbMenuItem = new JCheckBoxMenuItem(curr_port, curr_port.equals(Preferences.get("serial.port")));
@@ -1117,7 +1117,7 @@ protected void populateSerialMenu() {
System.out.println(_("error retrieving port list"));
exception.printStackTrace();
}
-
+
if (serialMenu.getItemCount() == 0) {
serialMenu.setEnabled(false);
}
@@ -1212,7 +1212,7 @@ public void actionPerformed(ActionEvent e) {
});
menu.add(item);
menu.addSeparator();
-
+
item = new JMenuItem(_("Frequently Asked Questions"));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@@ -1549,7 +1549,7 @@ protected void updateRedoState() {
public void setHandlers(Runnable runHandler, Runnable presentHandler,
Runnable stopHandler,
- Runnable exportHandler,
+ Runnable exportHandler,
Runnable exportAppHandler,
Runnable doFetUpdateHandler) {
this.doFetUpdateHandler = doFetUpdateHandler;
@@ -1979,11 +1979,11 @@ protected void handleFindReference() {
} else {
String referenceFile = PdeKeywords.getReference(text);
- if (referenceFile == null)
+ if (referenceFile == null)
{
statusNotice(I18n.format(_("No reference available for \"{0}\""), text));
- }
- else
+ }
+ else
{
Base.showReference(I18n.format(_("{0}.html"), referenceFile));
}
@@ -2238,7 +2238,7 @@ protected boolean handleOpenInternal(String path) {
File altPdeFile = new File(parent, pdeName);
String inoName = parentName + ".ino";
File altInoFile = new File(parent, pdeName);
-
+
if (pdeName.equals(fileName) || inoName.equals(fileName)) {
// no beef with this guy
@@ -2443,8 +2443,8 @@ public boolean handleSaveAs() {
return true;
}
-
-
+
+
public boolean serialPrompt() {
int count = serialMenu.getItemCount();
Object[] names = new Object[count];
@@ -2487,26 +2487,26 @@ public boolean serialPrompt() {
* Made synchronized to (hopefully) avoid problems of people
* hitting export twice, quickly, and horking things up.
*/
-
+
synchronized public void handleExport(final boolean usingProgrammer, final boolean showSerialMonitor) {
//if (!handleExportCheckModified()) return;
toolbar.activate(EditorToolbar.EXPORT);
console.clear();
status.progress(_("Uploading to I/O Board..."));
-
+
if(!usingProgrammer)
exportHandler = new DefaultExportHandler(showSerialMonitor);
-
+
new Thread(usingProgrammer ? exportAppHandler : exportHandler).start();
}
// DAM: in Arduino, this is upload
class DefaultExportHandler implements Runnable {
- DefaultExportHandler(Boolean openSerial) {
+ DefaultExportHandler(Boolean openSerial) {
serialMonitor.isOpenPending = openSerial; // Open serial monitor when ending
}
- DefaultExportHandler() {
+ DefaultExportHandler() {
if(serialMonitor != null)
serialMonitor.isOpenPending = false; // Do not serial monitor when ending, as default
}
@@ -2515,9 +2515,9 @@ public void run() {
try {
serialMonitor.closeSerialPort();
serialMonitor.setVisible(false);
-
+
uploading = true;
-
+
boolean success = sketch.exportApplet(false);
if (success) {
statusNotice(_("Done uploading."));
@@ -2557,9 +2557,9 @@ public void run() {
try {
serialMonitor.closeSerialPort();
serialMonitor.setVisible(false);
-
+
uploading = true;
-
+
boolean success = sketch.exportApplet(true);
if (success) {
statusNotice(_("Done uploading."));
@@ -2624,7 +2624,7 @@ protected boolean handleExportCheckModified() {
public void handleSerial() {
if (uploading)
{
- serialMonitor.isOpenPending = true; // Open serial when ending
+ serialMonitor.isOpenPending = true; // Open serial when ending
return;
}
try {
@@ -2840,7 +2840,7 @@ protected void onArchChanged() {
base.rebuildImportMenu(importMenu);
base.rebuildExamplesMenu(examplesMenu);
}
-
+
protected void onBoardOrPortChange() {
Map boardPreferences = Base.getBoardPreferences();
lineStatus.setBoardName(boardPreferences.get("name"));
@@ -2848,7 +2848,7 @@ protected void onBoardOrPortChange() {
lineStatus.repaint();
}
-
+
/**
* Returns the edit popup menu.
*/
@@ -2873,10 +2873,10 @@ public void actionPerformed(ActionEvent e) {
}
});
add(openURLItem);
-
+
openURLItemSeparator = new JSeparator();
add(openURLItemSeparator);
-
+
cutItem = new JMenuItem(_("Cut"));
cutItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@@ -2976,27 +2976,27 @@ public void show(Component component, int x, int y) {
openURLItem.setVisible(false);
openURLItemSeparator.setVisible(false);
}
-
+
if (textarea.isSelectionActive()) {
// move caret if is not inside selection
int selStart = textarea.getSelectionStart();
-
+
if(!(selStartoffset2))
textarea.setCaretPosition(offset2);
} else {
textarea.setCaretPosition(offset2);
}
-
+
// Reference
referenceFile = searchReference(textarea);
referenceItem.setEnabled(referenceFile != null);
-
+
super.show(component, x, y);
}
}
- // Search a JEditTextArea for a selected reference, returning the reference is valid, or null
+ // Search a JEditTextArea for a selected reference, returning the reference is valid, or null
public String searchReference(JEditTextArea jtext)
{
return searchReference(jtext, false);
@@ -3014,16 +3014,16 @@ public String searchReference(JEditTextArea jtext, boolean returnSelection)
{
sel = jtext.getSelectedText();
}
-
+
if(ref == null)
{
// Nothing is selected so we will try to find a valid keyword from caret position
int start = Math.max(0,jtext.getCaretPosition()-1);
sel = findKeyword(t,start, start);
}
-
+
sel = sel.trim();
-
+
if(returnSelection)
return sel;
else
@@ -3031,21 +3031,21 @@ public String searchReference(JEditTextArea jtext, boolean returnSelection)
if(sel.length()>0)
ref = PdeKeywords.getReference(sel);
}
- }
+ }
return returnSelection ? "": ref;
}
-
+
// Returns true if character is valid for a reference keyword
private boolean isValid(char c)
{
return (c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9') || c=='_';
}
-
+
// Recursively finds a valid keyword
private String findKeyword(String text, int start, int end)
{
int l = text.length();
-
+
if(l>0)
{
boolean validStart = true, validEnd = true;
@@ -3054,24 +3054,24 @@ private String findKeyword(String text, int start, int end)
if(isValid(text.charAt(start)))
{
start--;
- validStart = false;
- }
+ validStart = false;
+ }
}
-
+
if(end0)
return text.substring(nstart,nend);
}
@@ -3080,7 +3080,7 @@ private String findKeyword(String text, int start, int end)
return findKeyword(text,start,end); // Keep looking
}
}
-
+
return "";
}
}
diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java
index 86eb8664880..5d1847ba4f6 100644
--- a/app/src/processing/app/debug/Compiler.java
+++ b/app/src/processing/app/debug/Compiler.java
@@ -70,6 +70,7 @@ public boolean compile(Sketch sketch,
this.verbose = verbose;
this.sketchIsCompiled = false;
+
// the pms object isn't used for anything but storage
MessageStream pms = new MessageStream(this);
@@ -77,7 +78,12 @@ public boolean compile(Sketch sketch,
Map boardPreferences = Base.getBoardPreferences();
String core = boardPreferences.get("build.core");
String arch = Base.getArch();
- if (core == null) {
+
+ System.out.println("sk="+sketch+", buildpath="+buildPath+", primaryClassName="+primaryClassName+
+ ", verbose="+verbose+", basePath="+basePath+", arch="+arch);
+
+
+ if (core == null) {
RunnerException re = new RunnerException(_("No board selected; please choose a board from the Tools > Board menu."));
re.hideStackTrace();
throw re;
@@ -165,14 +171,18 @@ public boolean compile(Sketch sketch,
String rtsLibPath = null;
if (arch == "c2000") {
- Target t = Base.getTarget();
+ Target t = Base.getTarget();
+ System.out.println("\ntarget="+t.toString());
+ //Target t = Base.getC2000BasePath();
File rtsIncFolder;
File rtsLibFolder;
- rtsIncFolder = new File(new File(new File(t.getFolder(), "..//tools"), "c2000"), "include");
- rtsLibFolder = new File(new File(new File(t.getFolder(), "..//tools"), "c2000"), "lib");
+ rtsIncFolder = new File(t.getFolder(), "//include");
+ rtsLibFolder = new File(t.getFolder(), "//lib");
rtsIncPath = rtsIncFolder.getAbsolutePath();
rtsLibPath = rtsLibFolder.getAbsolutePath();
+
+ System.out.println("inc=" + rtsIncPath + ", lib=" + rtsLibPath + ", corepath=" + corePath);
}
List objectFiles = new ArrayList();
@@ -326,6 +336,7 @@ else if(boardPreferences.get("build.mcu").equals("TMS320F28377S"))
for(File file : coreObjectFiles) {
List commandAR = new ArrayList(baseCommandAR);
commandAR.add(file.getAbsolutePath());
+ System.out.println("linker="+commandAR);
execAsynchronouslyShell(commandAR);
}
}
@@ -485,6 +496,7 @@ else if(boardPreferences.get("build.mcu").equals("TMS320F28377S"))
}
if(arch == "c2000")
{
+ System.out.println("linker=" + baseCommandLinker);
execAsynchronouslyShell(baseCommandLinker);
}
else
@@ -580,9 +592,11 @@ private List compileFiles(String basePath,
List objectPaths = new ArrayList();
if(Base.getArch() == "c2000")
{
-
-
- for (File file : sSources) {
+ System.out.println("basePath="+basePath+", buildPath="+buildPath);
+
+
+ for (File file : sSources) {
+ System.out.println("sSources");
String objectPath = buildPath + File.separator + file.getName() + ".o";
objectPaths.add(new File(objectPath));
execAsynchronouslyShell(getCommandCompilerS(basePath, includePaths,
@@ -592,6 +606,8 @@ private List compileFiles(String basePath,
}
for (File file : cSources) {
+ System.out.println("cSources");
+
String objectPath = buildPath + File.separator + file.getName() + ".o";
String dependPath = buildPath + File.separator + file.getName() + ".d";
File objectFile = new File(objectPath);
@@ -605,6 +621,8 @@ private List compileFiles(String basePath,
}
for (File file : cppSources) {
+ System.out.println("cppSources");
+
String objectPath = buildPath + File.separator + file.getName() + ".o";
String dependPath = buildPath + File.separator + file.getName() + ".d";
File objectFile = new File(objectPath);
@@ -887,7 +905,7 @@ private void execAsynchronouslyShell(List commandList) throws RunnerException {
command_line += str+" ";
}
- process = Runtime.getRuntime().exec(new String[]{"bash","-c",command_line});
+ process = Runtime.getRuntime().exec(new String[]{"bash","-c",command_line},new String[]{"PATH=/ws/devel/Energia/hardware/c2000/bin"});
System.out.println(command_line);
}
else
diff --git a/app/src/processing/app/debug/Target.java b/app/src/processing/app/debug/Target.java
index 1aa2f81bef2..bf6353126e8 100644
--- a/app/src/processing/app/debug/Target.java
+++ b/app/src/processing/app/debug/Target.java
@@ -35,7 +35,7 @@ public class Target {
private File folder;
private Map boards;
private Map programmers;
-
+
public Target(String name, File folder) {
this.name = name;
this.folder = folder;
@@ -60,6 +60,8 @@ public Target(String name, File folder) {
System.err.println("Error loading boards from " + boardsFile + ": " + e);
}
+
+
File programmersFile = new File(folder, "programmers.txt");
try {
if (programmersFile.exists()) {
@@ -79,7 +81,11 @@ public Target(String name, File folder) {
programmersFile + ": " + e);
}
}
-
+
+ public String toString() {
+ return "Target: {name="+getName()+", folder="+getFolder().toString()+"}";
+ }
+
public String getName() { return name; }
public File getFolder() { return folder; }
public Map> getBoards() {