Skip to content

Commit 21082f8

Browse files
committed
Merge branch 'release-2.6.2' into release
2 parents e387dc4 + be0f7f2 commit 21082f8

File tree

35 files changed

+268
-340
lines changed

35 files changed

+268
-340
lines changed

BuiltInChips/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.nand2tetris</groupId>
77
<artifactId>parent</artifactId>
8-
<version>2.6.1</version>
8+
<version>2.6.2</version>
99
</parent>
1010

1111
<artifactId>BuiltInChips</artifactId>

BuiltInVMCode/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.nand2tetris</groupId>
77
<artifactId>parent</artifactId>
8-
<version>2.6.1</version>
8+
<version>2.6.2</version>
99
</parent>
1010

1111
<artifactId>BuiltInVMCode</artifactId>

CPUEmulator/pom.xml

Lines changed: 48 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,55 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3-
<modelVersion>4.0.0</modelVersion>
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
44

5-
<parent>
6-
<groupId>org.nand2tetris</groupId>
7-
<artifactId>parent</artifactId>
8-
<version>2.6.1</version>
9-
</parent>
5+
<parent>
6+
<groupId>org.nand2tetris</groupId>
7+
<artifactId>parent</artifactId>
8+
<version>2.6.2</version>
9+
</parent>
1010

11-
<artifactId>CPUEmulator</artifactId>
12-
<packaging>jar</packaging>
11+
<artifactId>CPUEmulator</artifactId>
12+
<packaging>jar</packaging>
1313

14-
<name>CPU emulator</name>
15-
<url>http://nand2tetris.org</url>
14+
<name>CPU emulator</name>
15+
<url>http://nand2tetris.org</url>
1616

17-
<build>
18-
<plugins>
19-
<plugin>
20-
<groupId>org.apache.maven.plugins</groupId>
21-
<artifactId>maven-shade-plugin</artifactId>
22-
<version>2.3</version>
23-
<executions>
24-
<execution>
25-
<phase>package</phase>
26-
<goals>
27-
<goal>shade</goal>
28-
</goals>
29-
<configuration>
30-
<transformers>
31-
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
32-
<mainClass>CPUEmulatorMain</mainClass>
33-
</transformer>
34-
</transformers>
35-
</configuration>
36-
</execution>
37-
</executions>
38-
</plugin>
39-
</plugins>
40-
</build>
17+
<build>
18+
<resources>
19+
<resource>
20+
<directory>src/main/resources</directory>
21+
<filtering>true</filtering>
22+
</resource>
23+
</resources>
24+
<plugins>
25+
<plugin>
26+
<groupId>org.apache.maven.plugins</groupId>
27+
<artifactId>maven-shade-plugin</artifactId>
28+
<version>2.3</version>
29+
<executions>
30+
<execution>
31+
<phase>package</phase>
32+
<goals>
33+
<goal>shade</goal>
34+
</goals>
35+
<configuration>
36+
<transformers>
37+
<transformer
38+
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
39+
<mainClass>CPUEmulatorMain</mainClass>
40+
</transformer>
41+
</transformers>
42+
</configuration>
43+
</execution>
44+
</executions>
45+
</plugin>
46+
</plugins>
47+
</build>
4148

42-
<dependencies>
43-
<dependency>
44-
<groupId>org.nand2tetris</groupId>
45-
<artifactId>SimulatorsGUIPackage</artifactId>
46-
</dependency>
47-
</dependencies>
49+
<dependencies>
50+
<dependency>
51+
<groupId>org.nand2tetris</groupId>
52+
<artifactId>SimulatorsGUIPackage</artifactId>
53+
</dependency>
54+
</dependencies>
4855
</project>

CPUEmulator/src/main/java/CPUEmulatorMain.java

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,43 @@
1515
* mark your changes clearly, for the benefit of others. *
1616
********************************************************************************/
1717

18-
import Hack.Controller.*;
19-
import Hack.CPUEmulator.*;
20-
import HackGUI.*;
21-
import SimulatorsGUI.*;
18+
import Hack.CPUEmulator.CPUEmulator;
19+
import Hack.CPUEmulator.CPUEmulatorApplication;
20+
import Hack.CPUEmulator.CPUEmulatorGUI;
21+
import Hack.Controller.ControllerGUI;
22+
import Hack.Controller.HackController;
23+
import HackGUI.ControllerComponent;
24+
import SimulatorsGUI.CPUEmulatorComponent;
25+
2226
import javax.swing.*;
2327

2428
/**
2529
* The CPU Emulator.
2630
*/
27-
public class CPUEmulatorMain
28-
{
29-
/**
30-
* The command line CPU Emulator program.
31-
*/
32-
public static void main(String[] args) {
33-
if (args.length > 1)
34-
System.err.println("Usage: java CPUEmulatorMain [script name]");
35-
else if (args.length == 0) {
36-
try {
37-
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
38-
} catch (Exception e) {
39-
}
31+
public class CPUEmulatorMain {
32+
/**
33+
* The command line CPU Emulator program.
34+
*/
35+
public static void main(String[] args) {
36+
switch (args.length) {
37+
case 0:
38+
try {
39+
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
40+
} catch (Exception ignored) {
41+
}
42+
43+
final CPUEmulatorGUI simulatorGUI = new CPUEmulatorComponent();
44+
final ControllerGUI controllerGUI = new ControllerComponent();
45+
new CPUEmulatorApplication(controllerGUI, simulatorGUI, "bin/scripts/defaultCPU.txt");
46+
break;
4047

41-
CPUEmulatorGUI simulatorGUI = new CPUEmulatorComponent();
48+
case 1:
49+
new HackController(new CPUEmulator(), args[0]);
50+
break;
4251

43-
ControllerGUI controllerGUI = new ControllerComponent();
44-
CPUEmulatorApplication application =
45-
new CPUEmulatorApplication(controllerGUI, simulatorGUI, "bin/scripts/defaultCPU.txt",
46-
"bin/help/cpuUsage.html", "bin/help/cpuAbout.html");
52+
default:
53+
System.err.printf("Usage: java %s [script name]%n", CPUEmulatorMain.class.getName());
54+
System.exit(1);
4755
}
48-
else
49-
new HackController(new CPUEmulator(), args[0]);
5056
}
5157
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<div class=Section1>
6868

6969
<p class=MsoBodyText align=center style='text-align:center'><b><span
70-
style='font-size:12.0pt'>CPU Emulator, Version 2.6</span></b></p>
70+
style='font-size:12.0pt'>CPU Emulator, Version ${project.version}</span></b></p>
7171

7272
<p class=MsoBodyText align=center style='text-align:center'><span
7373
style='font-size:12.0pt'>&nbsp;</span></p>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#Default properties, when building without git info
2+
git.dirty=true
3+
git.commit.id.describe-short=unknown
4+
git.build.version=${project.version}

CompilersPackage/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.nand2tetris</groupId>
77
<artifactId>parent</artifactId>
8-
<version>2.6.1</version>
8+
<version>2.6.2</version>
99
</parent>
1010

1111
<artifactId>CompilersPackage</artifactId>

HackGUIPackage/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.nand2tetris</groupId>
77
<artifactId>parent</artifactId>
8-
<version>2.6.1</version>
8+
<version>2.6.2</version>
99
</parent>
1010

1111
<artifactId>HackGUIPackage</artifactId>

HackGUIPackage/src/main/java/HackGUI/ControllerComponent.java

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,19 @@
1818
package HackGUI;
1919

2020
import Hack.Controller.*;
21-
import java.io.*;
21+
2222
import javax.swing.*;
23-
import javax.swing.event.*;
24-
import java.awt.event.*;
23+
import javax.swing.event.ChangeEvent;
24+
import javax.swing.event.ChangeListener;
2525
import java.awt.*;
26-
import java.util.*;
26+
import java.awt.event.ActionEvent;
27+
import java.awt.event.ActionListener;
28+
import java.awt.event.InputEvent;
29+
import java.awt.event.KeyEvent;
30+
import java.io.File;
31+
import java.util.Collection;
32+
import java.util.Hashtable;
33+
import java.util.Vector;
2734

2835
/**
2936
* This class represents the GUI of the controller component.
@@ -112,7 +119,7 @@ public class ControllerComponent extends JFrame implements ControllerGUI,
112119
protected JRadioButtonMenuItem partAnimMenuItem, fullAnimMenuItem, noAnimMenuItem;
113120

114121
// the message label (status line)
115-
protected JLabel messageLbl = new JLabel();
122+
private JTextField messageLbl = new JTextField();
116123

117124
// component for displaying the script, output file and comparison file.
118125
protected FileDisplayComponent scriptComponent;
@@ -126,6 +133,7 @@ public class ControllerComponent extends JFrame implements ControllerGUI,
126133
* Constructs a new ControllerComponent.
127134
*/
128135
public ControllerComponent() {
136+
messageLbl.setEditable(false);
129137
listeners = new Vector<ControllerEventListener>();
130138
formatCombo = new TitledComboBox("Format:", "Numeric display format",
131139
new String[]{"Decimal", "Hexa", "Binary"}, 75);
@@ -153,15 +161,11 @@ public void setSimulator(HackSimulatorGUI simulator) {
153161
((JComponent)simulator).revalidate();
154162
repaint();
155163

156-
if (simulator.getUsageFileName() != null) {
157-
usageWindow = new HTMLViewFrame(simulator.getUsageFileName());
158-
usageWindow.setSize(450, 430);
159-
}
164+
usageWindow = new HTMLViewFrame(getClass().getResource("/usage.html"));
165+
usageWindow.setSize(450, 430);
160166

161-
if (simulator.getAboutFileName() != null) {
162-
aboutWindow = new HTMLViewFrame(simulator.getAboutFileName());
163-
aboutWindow.setSize(450, 420);
164-
}
167+
aboutWindow = new HTMLViewFrame(getClass().getResource("/about.html"));
168+
aboutWindow.setSize(450, 420);
165169
}
166170

167171

0 commit comments

Comments
 (0)