From 8e33e2828ffc62238afc32bb2593b8619f586077 Mon Sep 17 00:00:00 2001 From: bd-912 Date: Mon, 6 May 2024 00:59:26 -0600 Subject: Partial implementation for starter Condense --- condense/Utilities.java | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 condense/Utilities.java (limited to 'condense/Utilities.java') diff --git a/condense/Utilities.java b/condense/Utilities.java deleted file mode 100644 index 9c052fc..0000000 --- a/condense/Utilities.java +++ /dev/null @@ -1,40 +0,0 @@ -package condense; - -import java.util.*; - -public class Utilities { - - - public static int computeStackFrameSize(String declare) { - MinimalLogger.info(String.format("Computing frame stack size for %s...", - declare)); - declare = extractNumeric(declare); - // assume that the LAST three digits are - // in, out, local - String[] sizes = declare.split(SPACE)[:-3]; - int ret = this.stackFrameFormula(Integer.parseInt(sizes[1]), - Integer.parseInt(sizes[2])); - MinimalLogger.info(String.format("Stack size is (%s + %s + 2) * 4 = %d", - sizes[1], - sizes[2], - ret)); - return ret; - } - - private static int stackFrameFormula(int out, int local) { - return (out + local + 2) * 4; - } - - private static int extractNumeric(String str) { - str = str.replaceAll("[^\\d] & quot;, " - "); - str = str.trim(); - str = str.replaceAll(" + ", " - "); - if (str.equals(" ")) - return " - -1 & quot; - ; - return str; - } -} -- cgit v1.2.3