mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-18 07:52:14 +01:00
Merge pull request #3227 from ffissore/editor-assembly-support
Allowing editing .S files
This commit is contained in:
commit
6f48a4083d
@ -836,7 +836,7 @@ public class Sketch {
|
|||||||
destFile = new File(data.getCodeFolder(), filename);
|
destFile = new File(data.getCodeFolder(), filename);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
for (String extension : data.getExtensions()) {
|
for (String extension : SketchData.EXTENSIONS) {
|
||||||
String lower = filename.toLowerCase();
|
String lower = filename.toLowerCase();
|
||||||
if (lower.endsWith("." + extension)) {
|
if (lower.endsWith("." + extension)) {
|
||||||
destFile = new File(data.getFolder(), filename);
|
destFile = new File(data.getFolder(), filename);
|
||||||
@ -1345,7 +1345,7 @@ public class Sketch {
|
|||||||
* extensions.
|
* extensions.
|
||||||
*/
|
*/
|
||||||
public boolean validExtension(String what) {
|
public boolean validExtension(String what) {
|
||||||
return data.getExtensions().contains(what);
|
return SketchData.EXTENSIONS.contains(what);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
package processing.app;
|
package processing.app;
|
||||||
|
|
||||||
|
import com.google.common.collect.FluentIterable;
|
||||||
|
|
||||||
import static processing.app.I18n._;
|
import static processing.app.I18n._;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class SketchData {
|
public class SketchData {
|
||||||
|
|
||||||
|
public static final List<String> SKETCH_EXTENSIONS = Arrays.asList("ino", "pde");
|
||||||
|
public static final List<String> OTHER_ALLOWED_EXTENSIONS = Arrays.asList("c", "cpp", "h", "s");
|
||||||
|
public static final List<String> EXTENSIONS = new LinkedList<String>(FluentIterable.from(SKETCH_EXTENSIONS).append(OTHER_ALLOWED_EXTENSIONS).toList());
|
||||||
|
|
||||||
/** main pde file for this sketch. */
|
/** main pde file for this sketch. */
|
||||||
private File primaryFile;
|
private File primaryFile;
|
||||||
|
|
||||||
@ -105,8 +107,6 @@ public class SketchData {
|
|||||||
clearCodeDocs();
|
clearCodeDocs();
|
||||||
// data.setCodeDocs(codeDocs);
|
// data.setCodeDocs(codeDocs);
|
||||||
|
|
||||||
List<String> extensions = getExtensions();
|
|
||||||
|
|
||||||
for (String filename : list) {
|
for (String filename : list) {
|
||||||
// Ignoring the dot prefix files is especially important to avoid files
|
// Ignoring the dot prefix files is especially important to avoid files
|
||||||
// with the ._ prefix on Mac OS X. (You'll see this with Mac files on
|
// with the ._ prefix on Mac OS X. (You'll see this with Mac files on
|
||||||
@ -119,7 +119,7 @@ public class SketchData {
|
|||||||
// figure out the name without any extension
|
// figure out the name without any extension
|
||||||
String base = filename;
|
String base = filename;
|
||||||
// now strip off the .pde and .java extensions
|
// now strip off the .pde and .java extensions
|
||||||
for (String extension : extensions) {
|
for (String extension : EXTENSIONS) {
|
||||||
if (base.toLowerCase().endsWith("." + extension)) {
|
if (base.toLowerCase().endsWith("." + extension)) {
|
||||||
base = base.substring(0, base.length() - (extension.length() + 1));
|
base = base.substring(0, base.length() - (extension.length() + 1));
|
||||||
|
|
||||||
@ -173,13 +173,6 @@ public class SketchData {
|
|||||||
return "ino";
|
return "ino";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a String[] array of proper extensions.
|
|
||||||
*/
|
|
||||||
public List<String> getExtensions() {
|
|
||||||
return Arrays.asList("ino", "pde", "c", "cpp", "h");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a file object for the primary .pde of this sketch.
|
* Returns a file object for the primary .pde of this sketch.
|
||||||
*/
|
*/
|
||||||
|
@ -1201,7 +1201,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
StringBuffer bigCode = new StringBuffer();
|
StringBuffer bigCode = new StringBuffer();
|
||||||
int bigCount = 0;
|
int bigCount = 0;
|
||||||
for (SketchCode sc : sketch.getCodes()) {
|
for (SketchCode sc : sketch.getCodes()) {
|
||||||
if (sc.isExtension("ino") || sc.isExtension("pde")) {
|
if (sc.isExtension(SketchData.SKETCH_EXTENSIONS)) {
|
||||||
sc.setPreprocOffset(bigCount);
|
sc.setPreprocOffset(bigCount);
|
||||||
// These #line directives help the compiler report errors with
|
// These #line directives help the compiler report errors with
|
||||||
// correct the filename and line number (issue 281 & 907)
|
// correct the filename and line number (issue 281 & 907)
|
||||||
@ -1272,7 +1272,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
// 3. then loop over the code[] and save each .java file
|
// 3. then loop over the code[] and save each .java file
|
||||||
|
|
||||||
for (SketchCode sc : sketch.getCodes()) {
|
for (SketchCode sc : sketch.getCodes()) {
|
||||||
if (sc.isExtension("c") || sc.isExtension("cpp") || sc.isExtension("h")) {
|
if (sc.isExtension(SketchData.OTHER_ALLOWED_EXTENSIONS)) {
|
||||||
// no pre-processing services necessary for java files
|
// no pre-processing services necessary for java files
|
||||||
// just write the the contents of 'program' to a .java file
|
// just write the the contents of 'program' to a .java file
|
||||||
// into the build directory. uses byte stream and reader/writer
|
// into the build directory. uses byte stream and reader/writer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user