diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Compiler/ExecuteC.java | 11 | ||||
-rw-r--r-- | src/Compiler/Utils.java | 13 | ||||
-rw-r--r-- | src/PythonIDE/src/esotericFORTRANIDE.py | 14 | ||||
-rw-r--r-- | src/testing/fortran_test_src/basic_tests.ft | 3 |
4 files changed, 33 insertions, 8 deletions
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 |