]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AslcompilerDef.java
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Java / Source / Cpptasks / net / sf / antcontrib / cpptasks / AslcompilerDef.java
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AslcompilerDef.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AslcompilerDef.java
new file mode 100644 (file)
index 0000000..f69d3fd
--- /dev/null
@@ -0,0 +1,118 @@
+/*\r
+ * \r
+ * Copyright 2001-2005 The Ant-Contrib project\r
+ *\r
+ *  Licensed under the Apache License, Version 2.0 (the "License");\r
+ *  you may not use this file except in compliance with the License.\r
+ *  You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+package net.sf.antcontrib.cpptasks;\r
+\r
+import net.sf.antcontrib.cpptasks.compiler.Aslcompiler;\r
+import net.sf.antcontrib.cpptasks.compiler.Processor;\r
+import net.sf.antcontrib.cpptasks.intel.IntelWin32Aslcompiler;\r
+import net.sf.antcontrib.cpptasks.types.AslcompilerArgument;\r
+\r
+import org.apache.tools.ant.BuildException;\r
+\r
+/**\r
+ * A asl compiler definition. asl compiler elements may be placed either as\r
+ * children of a cc element or the project element. A asl compiler element with\r
+ * an id attribute may be referenced from asl compiler elements with refid or\r
+ * extends attributes.\r
+ * \r
+ */\r
+public final class AslcompilerDef extends ProcessorDef {\r
+\r
+    private Boolean defaultflag = new Boolean(true);\r
+\r
+    public AslcompilerDef () {\r
+    }\r
+\r
+    /**\r
+     * Adds a asl compiler command-line arg.\r
+     */\r
+    public void addConfiguredAslcompilerArg(AslcompilerArgument arg) {\r
+        if (isReference()) {\r
+            throw noChildrenAllowed();\r
+        }\r
+        addConfiguredProcessorArg(arg);\r
+    }\r
+\r
+    public void execute() throws org.apache.tools.ant.BuildException {\r
+        throw new org.apache.tools.ant.BuildException(\r
+                        "Not an actual task, but looks like one for documentation purposes");\r
+    }\r
+\r
+    public final Boolean getDefaultflag(AslcompilerDef[] defaultProviders,\r
+                    int index) {\r
+        if (isReference()) {\r
+            return ((AslcompilerDef) getCheckedRef(AslcompilerDef.class,\r
+                            "AslcompilerDef")).getDefaultflag(defaultProviders,\r
+                            index);\r
+        }\r
+        return defaultflag;\r
+    }\r
+\r
+    public Processor getProcessor() {\r
+        Processor processor = super.getProcessor();\r
+        if (processor == null) {\r
+            processor = IntelWin32Aslcompiler.getInstance();\r
+        }\r
+        return processor;\r
+    }\r
+\r
+    /**\r
+     * Sets r type.\r
+     * \r
+     * <table width="100%" border="1"> <thead>Supported ASL Compilers</thead>\r
+     * <tr>\r
+     * <td>iasl (default)</td>\r
+     * <td>Intel ACPI Source Language</td>\r
+     * </tr>\r
+     * <tr>\r
+     * <td>asl</td>\r
+     * <td>Microsoft ACPI Source Language</td>\r
+     * </tr>\r
+     * </table>\r
+     * \r
+     */\r
+    public void setName(AslcompilerEnum name) throws BuildException {\r
+        if (isReference()) {\r
+            throw tooManyAttributes();\r
+        }\r
+        Aslcompiler aslcompiler = name.getAslcompiler();\r
+        setProcessor(aslcompiler);\r
+    }\r
+\r
+    protected void setProcessor(Processor proc) throws BuildException {\r
+        try {\r
+            super.setProcessor((Aslcompiler) proc);\r
+        } catch (ClassCastException ex) {\r
+            throw new BuildException(ex);\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Enables or disables default flags.\r
+     * \r
+     * @param defaultflag\r
+     *            if true, default flags will add to command line.\r
+     * \r
+     */\r
+    public void setDefaultflag(boolean defaultflag) {\r
+        if (isReference()) {\r
+            throw tooManyAttributes();\r
+        }\r
+        this.defaultflag = booleanValueOf(defaultflag);\r
+    }\r
+\r
+}\r