mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-22 08:22:04 +03:00
Merged upstream Arduino master branch
This commit is contained in:
@ -139,7 +139,7 @@ public class Preferences {
|
||||
"lv",
|
||||
"lt",
|
||||
"mr",
|
||||
"no",
|
||||
"no_nb",
|
||||
"fa",
|
||||
"pl",
|
||||
"pt_br",
|
||||
|
@ -127,10 +127,10 @@ public class SerialMonitor extends JFrame implements MessageConsumer {
|
||||
|
||||
serialRates = new JComboBox();
|
||||
for (int i = 0; i < serialRateStrings.length; i++)
|
||||
serialRates.addItem(serialRateStrings[i] + _(" baud"));
|
||||
serialRates.addItem(serialRateStrings[i] + " " + _("baud"));
|
||||
|
||||
serialRate = Preferences.getInteger("serial.debug_rate");
|
||||
serialRates.setSelectedItem(serialRate + _(" baud"));
|
||||
serialRates.setSelectedItem(serialRate + " " + _("baud"));
|
||||
serialRates.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
String wholeString = (String) serialRates.getSelectedItem();
|
||||
|
@ -1369,6 +1369,9 @@ public class Sketch {
|
||||
for (SketchCode sc : code) {
|
||||
if (sc.isExtension("ino") || sc.isExtension("pde")) {
|
||||
sc.setPreprocOffset(bigCount);
|
||||
// These #line directives help the compiler report errors with
|
||||
// correct the filename and line number (issue 281 & 907)
|
||||
bigCode.append("#line 1 \"" + sc.getFileName() + "\"\n");
|
||||
bigCode.append(sc.getProgram());
|
||||
bigCode.append('\n');
|
||||
bigCount += sc.getLineCount();
|
||||
@ -1541,54 +1544,16 @@ public class Sketch {
|
||||
public RunnerException placeException(String message,
|
||||
String dotJavaFilename,
|
||||
int dotJavaLine) {
|
||||
int codeIndex = 0; //-1;
|
||||
int codeLine = -1;
|
||||
|
||||
// System.out.println("placing " + dotJavaFilename + " " + dotJavaLine);
|
||||
// System.out.println("code count is " + getCodeCount());
|
||||
|
||||
// first check to see if it's a .java file
|
||||
for (int i = 0; i < getCodeCount(); i++) {
|
||||
SketchCode code = getCode(i);
|
||||
if (!code.isExtension(getDefaultExtension())) {
|
||||
if (dotJavaFilename.equals(code.getFileName())) {
|
||||
codeIndex = i;
|
||||
codeLine = dotJavaLine;
|
||||
return new RunnerException(message, codeIndex, codeLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If not the preprocessed file at this point, then need to get out
|
||||
if (!dotJavaFilename.equals(name + ".cpp")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// if it's not a .java file, codeIndex will still be 0
|
||||
// this section searches through the list of .pde files
|
||||
codeIndex = 0;
|
||||
for (int i = 0; i < getCodeCount(); i++) {
|
||||
SketchCode code = getCode(i);
|
||||
|
||||
if (code.isExtension(getDefaultExtension())) {
|
||||
// System.out.println("preproc offset is " + code.getPreprocOffset());
|
||||
// System.out.println("looking for line " + dotJavaLine);
|
||||
if (code.getPreprocOffset() <= dotJavaLine) {
|
||||
codeIndex = i;
|
||||
// System.out.println("i'm thinkin file " + i);
|
||||
codeLine = dotJavaLine - code.getPreprocOffset();
|
||||
}
|
||||
}
|
||||
}
|
||||
// could not find a proper line number, so deal with this differently.
|
||||
// but if it was in fact the .java file we're looking for, though,
|
||||
// send the error message through.
|
||||
// this is necessary because 'import' statements will be at a line
|
||||
// that has a lower number than the preproc offset, for instance.
|
||||
// if (codeLine == -1 && !dotJavaFilename.equals(name + ".java")) {
|
||||
// return null;
|
||||
// }
|
||||
return new RunnerException(message, codeIndex, codeLine);
|
||||
// Placing errors is simple, because we inserted #line directives
|
||||
// into the preprocessed source. The compiler gives us correct
|
||||
// the file name and line number. :-)
|
||||
for (int codeIndex = 0; codeIndex < getCodeCount(); codeIndex++) {
|
||||
SketchCode code = getCode(codeIndex);
|
||||
if (dotJavaFilename.equals(code.getFileName())) {
|
||||
return new RunnerException(message, codeIndex, dotJavaLine);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,6 +54,7 @@ public class Compiler implements MessageConsumer {
|
||||
|
||||
private PreferencesMap prefs;
|
||||
private boolean verbose;
|
||||
private boolean sketchIsCompiled;
|
||||
|
||||
private RunnerException exception;
|
||||
|
||||
@ -71,6 +72,7 @@ public class Compiler implements MessageConsumer {
|
||||
throws RunnerException {
|
||||
sketch = _sketch;
|
||||
verbose = _verbose;
|
||||
sketchIsCompiled = false;
|
||||
objectFiles = new ArrayList<File>();
|
||||
|
||||
prefs = createBuildPreferences(_buildPath, _primaryClassName);
|
||||
@ -87,6 +89,7 @@ public class Compiler implements MessageConsumer {
|
||||
// 1. compile the sketch (already in the buildPath)
|
||||
sketch.setCompilingProgress(30);
|
||||
compileSketch(includePaths);
|
||||
sketchIsCompiled = true;
|
||||
|
||||
// 2. compile the libraries, outputting .o files to: <buildPath>/<library>/
|
||||
// Doesn't really use configPreferences
|
||||
@ -339,10 +342,8 @@ public class Compiler implements MessageConsumer {
|
||||
boolean compiling = true;
|
||||
while (compiling) {
|
||||
try {
|
||||
if (in.thread != null)
|
||||
in.thread.join();
|
||||
if (err.thread != null)
|
||||
err.thread.join();
|
||||
in.join();
|
||||
err.join();
|
||||
result = process.waitFor();
|
||||
//System.out.println("result is " + result);
|
||||
compiling = false;
|
||||
@ -430,7 +431,7 @@ public class Compiler implements MessageConsumer {
|
||||
if (pieces[3].trim().equals("'Udp' was not declared in this scope")) {
|
||||
error = _("The Udp class has been renamed EthernetUdp.");
|
||||
msg = _("\nAs of Arduino 1.0, the Udp class in the Ethernet library " +
|
||||
"has been renamed to EthernetClient.\n\n");
|
||||
"has been renamed to EthernetUdp.\n\n");
|
||||
}
|
||||
|
||||
if (pieces[3].trim().equals("'class TwoWire' has no member named 'send'")) {
|
||||
@ -455,14 +456,20 @@ public class Compiler implements MessageConsumer {
|
||||
//msg = _("\nThe 'Keyboard' class is only supported on the Arduino Leonardo.\n\n");
|
||||
}
|
||||
|
||||
RunnerException e = sketch.placeException(error, pieces[1], PApplet.parseInt(pieces[2]) - 1);
|
||||
RunnerException e = null;
|
||||
if (!sketchIsCompiled) {
|
||||
// Place errors when compiling the sketch, but never while compiling libraries
|
||||
// or the core. The user's sketch might contain the same filename!
|
||||
e = sketch.placeException(error, pieces[1], PApplet.parseInt(pieces[2]) - 1);
|
||||
}
|
||||
|
||||
// replace full file path with the name of the sketch tab (unless we're
|
||||
// in verbose mode, in which case don't modify the compiler output)
|
||||
if (e != null && !verbose) {
|
||||
SketchCode code = sketch.getCode(e.getCodeIndex());
|
||||
String fileName = code.isExtension(sketch.getDefaultExtension()) ? code.getPrettyName() : code.getFileName();
|
||||
s = fileName + ":" + e.getCodeLine() + ": error: " + pieces[3] + msg;
|
||||
String fileName = (code.isExtension("ino") || code.isExtension("pde")) ? code.getPrettyName() : code.getFileName();
|
||||
int lineNum = e.getCodeLine() + 1;
|
||||
s = fileName + ":" + lineNum + ": error: " + pieces[3] + msg;
|
||||
}
|
||||
|
||||
if (exception == null && e != null) {
|
||||
|
@ -85,8 +85,15 @@ public class MessageSiphon implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Wait until the MessageSiphon thread is complete.
|
||||
public void join() throws java.lang.InterruptedException {
|
||||
// Grab a temp copy in case another thread nulls the "thread"
|
||||
// member variable
|
||||
Thread t = thread;
|
||||
if (t != null) t.join();
|
||||
}
|
||||
|
||||
public Thread getThread() {
|
||||
return thread;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,10 +60,8 @@ public class Sizer implements MessageConsumer {
|
||||
boolean running = true;
|
||||
while(running) {
|
||||
try {
|
||||
if (in.thread != null)
|
||||
in.thread.join();
|
||||
if (err.thread != null)
|
||||
err.thread.join();
|
||||
in.join();
|
||||
err.join();
|
||||
r = process.waitFor();
|
||||
running = false;
|
||||
} catch (InterruptedException intExc) { }
|
||||
|
@ -205,7 +205,7 @@ public class PdePreprocessor {
|
||||
for (int i = 0; i < prototypes.size(); i++) {
|
||||
out.print(prototypes.get(i) + "\n");
|
||||
}
|
||||
|
||||
out.println("#line 1");
|
||||
out.print(program.substring(prototypeInsertionPoint));
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class Archiver implements Tool {
|
||||
numberFormat.setGroupingUsed(false); // no commas
|
||||
numberFormat.setMinimumIntegerDigits(digits);
|
||||
|
||||
dateFormat = new SimpleDateFormat(_("yyMMdd"));
|
||||
dateFormat = new SimpleDateFormat("yyMMdd");
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user