diff options
| author | AidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com> | 2021-12-14 17:34:30 +0000 | 
|---|---|---|
| committer | AidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com> | 2021-12-14 17:34:30 +0000 | 
| commit | 2c7c11bffc7a6009a544d7838cc4f58bd723b79f (patch) | |
| tree | d291a1d61c6b298442155017df4218ebd365920f /src | |
| parent | b85a03d829d16ce053526ff46f19e19185fad992 (diff) | |
| parent | 659e0e2c125772600079854bef65806f65a5a358 (diff) | |
| download | esotericFORTRAN-2c7c11bffc7a6009a544d7838cc4f58bd723b79f.tar.gz esotericFORTRAN-2c7c11bffc7a6009a544d7838cc4f58bd723b79f.zip | |
Merge branch 'main' of https://github.com/AlfieEagleton/EsotericProjectGroup12
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 | 
