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