]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/AslcompilerDef.java
Changed spelling to manifest
[mirror_edk2.git] / Tools / Source / Cpptasks / net / sf / antcontrib / cpptasks / AslcompilerDef.java
1 /*
2 *
3 * Copyright 2001-2005 The Ant-Contrib project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package net.sf.antcontrib.cpptasks;
18
19 import net.sf.antcontrib.cpptasks.compiler.Aslcompiler;
20 import net.sf.antcontrib.cpptasks.compiler.Processor;
21 import net.sf.antcontrib.cpptasks.intel.IntelWin32Aslcompiler;
22 import net.sf.antcontrib.cpptasks.types.AslcompilerArgument;
23
24 import org.apache.tools.ant.BuildException;
25
26 /**
27 * A asl compiler definition. asl compiler elements may be placed either as
28 * children of a cc element or the project element. A asl compiler element with
29 * an id attribute may be referenced from asl compiler elements with refid or
30 * extends attributes.
31 *
32 */
33 public final class AslcompilerDef extends ProcessorDef {
34
35 private Boolean defaultflag = new Boolean(true);
36
37 public AslcompilerDef () {
38 }
39
40 /**
41 * Adds a asl compiler command-line arg.
42 */
43 public void addConfiguredAslcompilerArg(AslcompilerArgument arg) {
44 if (isReference()) {
45 throw noChildrenAllowed();
46 }
47 addConfiguredProcessorArg(arg);
48 }
49
50 public void execute() throws org.apache.tools.ant.BuildException {
51 throw new org.apache.tools.ant.BuildException(
52 "Not an actual task, but looks like one for documentation purposes");
53 }
54
55 public final Boolean getDefaultflag(AslcompilerDef[] defaultProviders,
56 int index) {
57 if (isReference()) {
58 return ((AslcompilerDef) getCheckedRef(AslcompilerDef.class,
59 "AslcompilerDef")).getDefaultflag(defaultProviders,
60 index);
61 }
62 return defaultflag;
63 }
64
65 public Processor getProcessor() {
66 Processor processor = super.getProcessor();
67 if (processor == null) {
68 processor = IntelWin32Aslcompiler.getInstance();
69 }
70 return processor;
71 }
72
73 /**
74 * Sets r type.
75 *
76 * <table width="100%" border="1"> <thead>Supported ASL Compilers</thead>
77 * <tr>
78 * <td>iasl (default)</td>
79 * <td>Intel ACPI Source Language</td>
80 * </tr>
81 * <tr>
82 * <td>asl</td>
83 * <td>Microsoft ACPI Source Language</td>
84 * </tr>
85 * </table>
86 *
87 */
88 public void setName(AslcompilerEnum name) throws BuildException {
89 if (isReference()) {
90 throw tooManyAttributes();
91 }
92 Aslcompiler aslcompiler = name.getAslcompiler();
93 setProcessor(aslcompiler);
94 }
95
96 protected void setProcessor(Processor proc) throws BuildException {
97 try {
98 super.setProcessor((Aslcompiler) proc);
99 } catch (ClassCastException ex) {
100 throw new BuildException(ex);
101 }
102 }
103
104 /**
105 * Enables or disables default flags.
106 *
107 * @param defaultflag
108 * if true, default flags will add to command line.
109 *
110 */
111 public void setDefaultflag(boolean defaultflag) {
112 if (isReference()) {
113 throw tooManyAttributes();
114 }
115 this.defaultflag = booleanValueOf(defaultflag);
116 }
117
118 }