Skip to content

Commit 37602cc

Browse files
committed
remove unused CLI arguments, add a new argument for LText text
1 parent 087b249 commit 37602cc

4 files changed

Lines changed: 22 additions & 24 deletions

File tree

build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="NAMControllerCompiler" default="dist" basedir=".">
33
<property name="targetversion" value="8" />
4-
<property name="project.version" value="1.3.1" />
4+
<property name="project.version" value="2.0.0-SNAPSHOT" />
55
<property name="MyApp" value="${ant.project.name}" />
66
<property name="MyApp-zipname" value="${ant.project.name}_${project.version}" />
77
<property name="MyApp.jar" value="${MyApp}.jar" />

src/controller/CommandLineArguments.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,8 @@ public enum ArgumentID {
5454

5555
INPUT_DIR(0, ""),
5656
OUTPUT_DIR(1, ""),
57-
RHD_FLAG(2, "1"),
58-
PS_FLAG(3, "0"),
59-
NWM_FLAGS(4, defaultWord),
60-
RHW_L0_FLAGS(5, "0x01FF"),
61-
RHW_L1_FLAGS(6, "0x01FF"),
62-
RHW_L2_FLAGS(7, "0x01FF"),
63-
RHW_L3_FLAGS(8, "0x001C"),
64-
RHW_L4_FLAGS(9, "0x001C"),
65-
RHW_DDRHW_FLAGS(10, "0x0008"),
66-
RHW_FA_FLAGS(11, "0x0001"),
67-
SAM_FLAGS(12, defaultWord); // TODO or 0x03FF ?
57+
RHD_FLAG(2, "1"), // 1=RHD, 0=LHD
58+
LTEXT(3, "");
6859

6960
private final int index;
7061
private final String defaultValue;

src/controller/Compiler.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ public abstract class Compiler extends AbstractCompiler {
4141

4242
private final File RESOURCE_DIR, XML_DIR, XML_FILE, XML_FILE_TEMP;
4343
private final File[] DATA_FILES;
44-
private final CompilerSettingsManager settingsManager ;
44+
private final CompilerSettingsManager settingsManager;
45+
private final String markerText;
4546

4647
private File inputDir, outputDir;
4748
private File[] rulDirs;
@@ -91,6 +92,7 @@ private Compiler(File resourceDir, CompileMode mode, View view, CommandLineArgum
9192
new File(RESOURCE_DIR, "NAMControllerCompilerSettings.txt~1"),
9293
new File(RESOURCE_DIR, "NAMControllerCompilerSettings.txt~2")};
9394
this.settingsManager = new CompilerSettingsManager(DATA_FILES, args);
95+
this.markerText = args.getArgument(CommandLineArguments.ArgumentID.LTEXT);
9496
}
9597

9698
@Override
@@ -277,7 +279,7 @@ public boolean writeSettings() {
277279

278280
@Override
279281
public void writeControllerFile() {
280-
ExecutableTask writeTask = WriteControllerTask.getInstance(mode, collectRULsTask, isLHD, patterns, inputDir.toURI(), outputFile, view);
282+
ExecutableTask writeTask = WriteControllerTask.getInstance(mode, collectRULsTask, isLHD, markerText, patterns, inputDir.toURI(), outputFile, view);
281283
writeTask.execute();
282284
// result will be handled by determineResult in writeTask
283285
}

src/controller/tasks/WriteControllerTask.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public abstract class WriteControllerTask implements ExecutableTask {
4747

4848
private final CollectRULsTask collectRULsTask;
4949
private final boolean isLHD;
50+
private final String markerText;
5051
private final Queue<Pattern> patterns;
5152
private final URI inputURI;
5253
private final File outputFile;
@@ -56,20 +57,21 @@ public abstract class WriteControllerTask implements ExecutableTask {
5657
private long starttime;
5758

5859
public static ExecutableTask getInstance(CompileMode mode, CollectRULsTask collectRULsTask,
59-
boolean isLHD, Queue<Pattern> patterns, URI inputURI, File outputFile, View view) {
60+
boolean isLHD, String markerText, Queue<Pattern> patterns, URI inputURI, File outputFile, View view) {
6061
if (mode.isInteractive()) {
61-
return new GUITask(collectRULsTask, isLHD, patterns, inputURI, outputFile, view);
62+
return new GUITask(collectRULsTask, isLHD, markerText, patterns, inputURI, outputFile, view);
6263
} else {
63-
return new CommandLineTask(collectRULsTask, isLHD, patterns, inputURI, outputFile, view);
64+
return new CommandLineTask(collectRULsTask, isLHD, markerText, patterns, inputURI, outputFile, view);
6465
}
6566
}
6667

6768
public abstract boolean get() throws InterruptedException, ExecutionException;
6869

6970
private WriteControllerTask(CollectRULsTask collectRULsTask,
70-
boolean isLHD, Queue<Pattern> patterns, URI inputURI, File outputFile, View view) {
71+
boolean isLHD, String markerText, Queue<Pattern> patterns, URI inputURI, File outputFile, View view) {
7172
this.collectRULsTask = collectRULsTask;
7273
this.isLHD = isLHD;
74+
this.markerText = markerText;
7375
this.patterns = patterns;
7476
this.inputURI = inputURI;
7577
this.outputFile = outputFile;
@@ -123,7 +125,10 @@ public void stateChanged(ChangeEvent e) {
123125
// LText (Controller marker)
124126
LOGGER.info("Adding Controller marker description text");
125127
DBPFLText ltext = new DBPFLText(new byte[0], LTEXT_TGI, false);
126-
ltext.setString(getControllerMarkerText(lastModf, WriteControllerTask.this.isLHD));
128+
ltext.setString(
129+
WriteControllerTask.this.markerText.isEmpty()
130+
? getDefaultControllerMarkerText(lastModf, WriteControllerTask.this.isLHD)
131+
: WriteControllerTask.this.markerText);
127132
writeList.add(ltext);
128133
}
129134
// write to file
@@ -169,7 +174,7 @@ private void determineResult() {
169174
* @param isLHD
170175
* @return
171176
*/
172-
private String getControllerMarkerText(long date, boolean isLHD) {
177+
private String getDefaultControllerMarkerText(long date, boolean isLHD) {
173178
DateFormat dateFormat = new SimpleDateFormat("yyyy MMM dd - HH:mm:ss (z)", Locale.ENGLISH);
174179
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
175180
// return "Version: " + (isLHD ? "LHD " : "RHD ") + (isESeries ? "(e-series) - " : "(s-series) - ") + dateFormat.format(new Date(date));
@@ -187,8 +192,8 @@ private static class GUITask extends WriteControllerTask {
187192
private final SwingWorker<Boolean, String> worker;
188193

189194
private GUITask(CollectRULsTask collectRULsTask,
190-
boolean isLHD, Queue<Pattern> patterns, URI inputURI, File outputFile, View view) {
191-
super(collectRULsTask, isLHD, patterns, inputURI, outputFile, view);
195+
boolean isLHD, String markerText, Queue<Pattern> patterns, URI inputURI, File outputFile, View view) {
196+
super(collectRULsTask, isLHD, markerText, patterns, inputURI, outputFile, view);
192197
worker = new MyWorker();
193198
}
194199

@@ -230,8 +235,8 @@ private static class CommandLineTask extends WriteControllerTask implements Publ
230235
private Exception executionExceptionCause = null;
231236

232237
private CommandLineTask(CollectRULsTask collectRULsTask,
233-
boolean isLHD, Queue<Pattern> patterns, URI inputURI, File outputFile, View view) {
234-
super(collectRULsTask, isLHD, patterns, inputURI, outputFile, view);
238+
boolean isLHD, String markerText, Queue<Pattern> patterns, URI inputURI, File outputFile, View view) {
239+
super(collectRULsTask, isLHD, markerText, patterns, inputURI, outputFile, view);
235240
}
236241

237242
@Override

0 commit comments

Comments
 (0)