summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md24
-rw-r--r--src/Compiler/ExecuteC.java11
-rw-r--r--src/Compiler/Utils.java13
-rw-r--r--src/PythonIDE/src/esotericFORTRANIDE.py14
-rw-r--r--src/testing/fortran_test_src/basic_tests.ft3
5 files changed, 41 insertions, 24 deletions
diff --git a/README.md b/README.md
index f08365f..ef91990 100644
--- a/README.md
+++ b/README.md
@@ -2,18 +2,11 @@
Advanced Programming Project
## Old / code todo
-- [ ] Sort out dir structure further (rename example dir to fortran_src, make separate dir for c source files and out files)
- [x] Implement functions
- [x] UI work
- [ ] Add section to report about compiler pipeline (ft -> c -> c object -> native binary)
-- [ ] Interpretter does not remember variables between lines. This might need sorting
-
-
-
-
-How compiler works
-How implemented
+Seciton about how compiler works, how implemented
There is overlap between chapters 3, 6, 7 and 8
Split sprints
@@ -30,7 +23,7 @@ Chapter 3 (Chris):
- [ ] Abstract concepts
- [ ] Compilers etc
- [ ] How C compiler works
-- [ ] Talk about recursive decsent compiling
+- [ ] Talk about recursive descent compiling
Chapter 4:
@@ -43,7 +36,7 @@ Combine chapter 4 and 5 under full language design section
Chapter 5 and 6 (Alfie):
- [ ] Merge chapter 5 and 6
- [ ] Put stuff about java files in sprint talk
-- [ ] Move absract stuff i.e. how files were changed into to chapter 3
+- [ ] Move abstract stuff i.e. how files were changed into to chapter 3
- [ ] Unit testing - Chris - talk about sprint 1-3 unit testing abandoned
Chapter 7 (Testing) (Chris)
@@ -56,13 +49,12 @@ Dicussion section:
- [ ] Expand this section of the report
Conclusion (Aiden):
-- [ ] Write conclusion
+- [x] Write conclusion
Extra stuff:
-- [ ] UML diagrams: one for each sprint, one final one. Spint 3 adds execute C
-- [ ] String stuff
-- [ ] Character from string
-- [ ] Modify strings
-- [ ] Add strings
+- [x] UML diagrams: one for each sprint, one final one. Sprint 3 adds execute C
+- [x] String stuff
+- [x] Add strings
+- [ ] Grab screenshots, and make point the software is cross-platform
diff --git a/src/Compiler/ExecuteC.java b/src/Compiler/ExecuteC.java
index 128f541..ede9bd6 100644
--- a/src/Compiler/ExecuteC.java
+++ b/src/Compiler/ExecuteC.java
@@ -70,14 +70,15 @@ public class ExecuteC {
public Boolean compileC(){
try{
Process p;
+ // -lm to links maths library that is not included by default
if (System.getProperty("os.name").equals("Linux")) {
p = Runtime.getRuntime().exec(String.format(
- "gcc %s/%s.c -o %s/%s",
+ "gcc %s/%s.c -o %s/%s -lm",
buildToDir.toString(), filename, buildToDir.toString(), filename
));
} else {
p = Runtime.getRuntime().exec(String.format(
- "cmd /C gcc %s -o %s",
+ "cmd /C gcc %s -o %s -lm",
Paths.get(buildToDir.toString(), String.format("%s.c", filename)).toString(),
Paths.get(buildToDir.toString(), String.format("%s.exe", filename)).toString()
));
@@ -121,5 +122,9 @@ public class ExecuteC {
}
System.out.println();
return null;
- }
+ }
+
+ public static void main(String[] args) {
+ System.out.println("ExecuteC class testing");
+ }
}
diff --git a/src/Compiler/Utils.java b/src/Compiler/Utils.java
index d0206c1..b19320e 100644
--- a/src/Compiler/Utils.java
+++ b/src/Compiler/Utils.java
@@ -27,10 +27,17 @@ public class Utils {
public static void main(String[] args) throws Exception {
String currentPath = new java.io.File(".").getCanonicalPath();
- System.out.println("Current dir:" + currentPath);
- String helpfile = readFile("Compiler/helpfile.txt");
- System.out.println(helpfile);
+ System.out.println("Util class testing");
+
+ try {
+ String helpfile = readFile("Compiler/helpfile.txt");
+ System.out.println("File read success");
+ }
+ catch (Exception e) {
+ System.out.println("File read failure");
+ }
+
}
diff --git a/src/PythonIDE/src/esotericFORTRANIDE.py b/src/PythonIDE/src/esotericFORTRANIDE.py
index 721e629..054d131 100644
--- a/src/PythonIDE/src/esotericFORTRANIDE.py
+++ b/src/PythonIDE/src/esotericFORTRANIDE.py
@@ -44,6 +44,7 @@ class Application(tk.Tk):
self.bind('<Control-o>', lambda a: self.open_file())
self.bind('<Control-s>', lambda a: self.save_file())
self.bind('<Control-S>', lambda a: self.save_file_as())
+ self.bind('<F3>', lambda a: self.reload_file())
self.bind('<F4>', lambda a: self.results_pane.clear_results())
self.bind('<F5>', lambda a: self.execute())
self.protocol("WM_DELETE_WINDOW", self.exit)
@@ -54,7 +55,7 @@ class Application(tk.Tk):
def open_file(self):
"""Called when the user selects the button to open a file or the
- nessicary keyboard shortcuts. File is opened and inserted into the tk.Text
+ necessary keyboard shortcuts. File is opened and inserted into the tk.Text
"""
dia = filedialogue.askopenfilename(
initialdir = self.__get_initial_dir(),
@@ -84,6 +85,10 @@ class Application(tk.Tk):
self.current_file = f.name
self.title("esotericFORTRAN IDE - %s" % str(f.name))
+ def reload_file(self):
+ with open(self.current_file, "r") as f:
+ self.fortran_frame.replace_text_with("".join(f.readlines()))
+
def exit(self):
print("exit")
exit()
@@ -174,6 +179,11 @@ class ApplicationMenu(tk.Menu):
accelerator = "Ctrl+Shift+S",
command = self.parent.save_file_as
)
+ self.file_menu.add_command(
+ label = "Reload File From Disk",
+ accelerator = "F3",
+ command = self.parent.reload_file
+ )
self.file_menu.add_separator()
self.file_menu.add_command(
label = "Exit",
@@ -185,7 +195,7 @@ class ApplicationMenu(tk.Menu):
self.add_cascade(label = "Run", menu = self.run_menu)
self.run_menu.add_command(
label = "Clear results",
- command = self.parent.results_pane.clear_results(),
+ command = self.parent.results_pane.clear_results,
accelerator = "F4"
)
self.run_menu.add_command(
diff --git a/src/testing/fortran_test_src/basic_tests.ft b/src/testing/fortran_test_src/basic_tests.ft
new file mode 100644
index 0000000..1529dc2
--- /dev/null
+++ b/src/testing/fortran_test_src/basic_tests.ft
@@ -0,0 +1,3 @@
+character (len=11)::test
+test = "hello world"
+print*,test