Sun, 12 Jan 2025 16:28:08 +0100
improve toolchain detection to also get the wordsize and stdc version, issue #439, issue #508
package de.unixwork.uwproj; import org.w3c.dom.Element; import java.util.LinkedList; import java.util.List; import java.util.stream.Collectors; import static de.unixwork.uwproj.Util.shId; public final class Option { private final String arg; private final LinkedList<OptionValue> values = new LinkedList<>(); private final LinkedList<OptionDefault> defaults = new LinkedList<>(); public Option(Element element) { arg = element.getAttribute("arg"); Util.getChildElements(element).forEach(elm -> { switch (elm.getNodeName()) { case "value" -> values.add(new OptionValue(this, elm.getAttribute("str"), new TargetData(elm))); case "default" -> defaults.add(new OptionDefault(this, elm.getAttribute("value"), elm.getAttribute("platform"))); } }); } public String getArgument() { return arg; } public String getVarName() { return shId("OPT_" + arg.toUpperCase()); } public String getArgValue() { return "${ARG:" + (3 + arg.length()) + "}"; } public List<OptionValue> getValues() { return values; } public List<OptionDefault> getDefaults() { return defaults; } public String getValueFunc(String value) { return shId("checkopt_" + arg + "_" + value); } public String getValuesString() { if (values.size() == 1) { return values.get(0).getValue(); } else { return "(" + values.stream().map(OptionValue::getValue).collect(Collectors.joining("|")) + ")"; } } }