Skip to content

Commit f016cc4

Browse files
committed
Removed core dependency from the pre-processor
1 parent 971d98b commit f016cc4

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

java/preprocessor/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ sourceSets{
2323
}
2424

2525
dependencies{
26-
implementation(project(":core"))
27-
2826
implementation(libs.antlr)
2927
implementation(libs.eclipseJDT)
3028

java/src/processing/mode/java/preproc/PdeParseTreeListener.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
import processing.app.Base;
3434
import processing.app.Preferences;
35-
import processing.core.PApplet;
3635
import processing.mode.java.preproc.PdePreprocessor.Mode;
3736

3837
/**
@@ -1237,16 +1236,16 @@ protected void writeMain(PrintWriterWithEditGen footerWriter,
12371236
boolean shouldFullScreen = Preferences.getBoolean("export.application.present");
12381237
shouldFullScreen = shouldFullScreen || Preferences.getBoolean("export.application.fullscreen");
12391238
if (shouldFullScreen) {
1240-
argsJoiner.add("\"" + PApplet.ARGS_FULL_SCREEN + "\"");
1239+
argsJoiner.add("\"--full-screen\"");
12411240

12421241
String bgColor = Preferences.get("run.present.bgcolor");
1243-
argsJoiner.add("\"" + PApplet.ARGS_BGCOLOR + "=" + bgColor + "\"");
1242+
argsJoiner.add("\"--bgcolor=" + bgColor + "\"");
12441243

12451244
if (Preferences.getBoolean("export.application.stop")) {
12461245
String stopColor = Preferences.get("run.present.stop.color");
1247-
argsJoiner.add("\"" + PApplet.ARGS_STOP_COLOR + "=" + stopColor + "\"");
1246+
argsJoiner.add("\"--stop-color=" + stopColor + "\"");
12481247
} else {
1249-
argsJoiner.add("\"" + PApplet.ARGS_HIDE_STOP + "\"");
1248+
argsJoiner.add("\"--hide-stop\"");
12501249
}
12511250
}
12521251

java/src/processing/mode/java/preproc/TextTransform.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import java.util.ListIterator;
99
import java.util.stream.Collectors;
1010

11-
import processing.core.PApplet;
12-
1311

1412
public class TextTransform {
1513

@@ -256,7 +254,7 @@ public int getInputOffset(int outputOffset) {
256254
i = -(i + 1);
257255
i -= 1;
258256
}
259-
i = PApplet.constrain(i, 0, outMap.size()-1);
257+
i = constrain(i, 0, outMap.size()-1);
260258
Edit edit = outMap.get(i);
261259
int diff = outputOffset - edit.toOffset;
262260
return edit.fromOffset + Math.min(diff, Math.max(0, edit.fromLength - 1));
@@ -271,7 +269,7 @@ public int getOutputOffset(int inputOffset) {
271269
i = -(i + 1);
272270
i -= 1;
273271
}
274-
i = PApplet.constrain(i, 0, inMap.size()-1);
272+
i = constrain(i, 0, inMap.size()-1);
275273
Edit edit = inMap.get(i);
276274
int diff = inputOffset - edit.fromOffset;
277275
return edit.toOffset + Math.min(diff, Math.max(0, edit.toLength - 1));
@@ -283,6 +281,10 @@ public OffsetMapper thenMapping(OffsetMapper mapper) {
283281
}
284282
}
285283

284+
static public final int constrain(int amt, int low, int high) {
285+
return (amt < low) ? low : ((amt > high) ? high : amt);
286+
}
287+
286288

287289
private static class CompositeOffsetMapper implements OffsetMapper {
288290
private List<OffsetMapper> mappers = new ArrayList<>();

0 commit comments

Comments
 (0)