summaryrefslogtreecommitdiffstats
path: root/src/Compiler
diff options
context:
space:
mode:
authorAidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com>2021-12-14 17:34:30 +0000
committerAidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com>2021-12-14 17:34:30 +0000
commit2c7c11bffc7a6009a544d7838cc4f58bd723b79f (patch)
treed291a1d61c6b298442155017df4218ebd365920f /src/Compiler
parentb85a03d829d16ce053526ff46f19e19185fad992 (diff)
parent659e0e2c125772600079854bef65806f65a5a358 (diff)
downloadesotericFORTRAN-2c7c11bffc7a6009a544d7838cc4f58bd723b79f.tar.gz
esotericFORTRAN-2c7c11bffc7a6009a544d7838cc4f58bd723b79f.zip
Merge branch 'main' of https://github.com/AlfieEagleton/EsotericProjectGroup12
Diffstat (limited to 'src/Compiler')
-rw-r--r--src/Compiler/ExecuteC.java11
-rw-r--r--src/Compiler/Utils.java13
2 files changed, 18 insertions, 6 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");
+ }
+
}