]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioResourceCompiler.java
Changed spelling to manifest
[mirror_edk2.git] / Tools / Source / Cpptasks / net / sf / antcontrib / cpptasks / devstudio / DevStudioResourceCompiler.java
1 /*
2 *
3 * Copyright 2002-2004 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.devstudio;
18 import java.io.File;
19 import java.util.Vector;
20
21 import net.sf.antcontrib.cpptasks.CUtil;
22 import net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler;
23 import net.sf.antcontrib.cpptasks.compiler.LinkType;
24 import net.sf.antcontrib.cpptasks.compiler.Linker;
25 import net.sf.antcontrib.cpptasks.compiler.Processor;
26 import net.sf.antcontrib.cpptasks.parser.CParser;
27 import net.sf.antcontrib.cpptasks.parser.Parser;
28 import net.sf.antcontrib.cpptasks.OptimizationEnum;
29
30 import org.apache.tools.ant.types.Environment;
31 /**
32 * Adapter for the Microsoft (r) Windows 32 Resource Compiler
33 *
34 * @author Curt Arnold
35 */
36 public final class DevStudioResourceCompiler extends CommandLineCompiler {
37 private static final DevStudioResourceCompiler instance = new DevStudioResourceCompiler(
38 false, null);
39 public static DevStudioResourceCompiler getInstance() {
40 return instance;
41 }
42 private String identifier;
43 private DevStudioResourceCompiler(boolean newEnvironment, Environment env) {
44 super("rc", null, new String[]{".rc"}, new String[]{".h", ".hpp",
45 ".inl"}, ".res", false, null, newEnvironment, env);
46 }
47 protected void addImpliedArgs(final Vector args,
48 final boolean debug,
49 final boolean multithreaded,
50 final boolean exceptions,
51 final LinkType linkType,
52 final Boolean rtti,
53 final OptimizationEnum optimization,
54 final Boolean defaultflag) {
55 if (debug) {
56 args.addElement("/D_DEBUG");
57 } else {
58 args.addElement("/DNDEBUG");
59 }
60 }
61 protected void addWarningSwitch(Vector args, int level) {
62 }
63 public Processor changeEnvironment(boolean newEnvironment, Environment env) {
64 if (newEnvironment || env != null) {
65 return new DevStudioResourceCompiler(newEnvironment, env);
66 }
67 return this;
68 }
69 /**
70 * The include parser for C will work just fine, but we didn't want to
71 * inherit from CommandLineCCompiler
72 */
73 protected Parser createParser(File source) {
74 return new CParser();
75 }
76 protected int getArgumentCountPerInputFile() {
77 return 2;
78 }
79 protected void getDefineSwitch(StringBuffer buffer, String define,
80 String value) {
81 DevStudioProcessor.getDefineSwitch(buffer, define, value);
82 }
83 protected File[] getEnvironmentIncludePath() {
84 return CUtil.getPathFromEnvironment("INCLUDE", ";");
85 }
86 protected String getIncludeDirSwitch(String includeDir) {
87 return DevStudioProcessor.getIncludeDirSwitch(includeDir);
88 }
89 protected String getInputFileArgument(File outputDir, String filename,
90 int index) {
91 if (index == 0) {
92 String outputFileName = getOutputFileName(filename);
93 String fullOutputName = new File(outputDir, outputFileName)
94 .toString();
95 return "/fo" + fullOutputName;
96 }
97 return filename;
98 }
99 public Linker getLinker(LinkType type) {
100 return DevStudioLinker.getInstance().getLinker(type);
101 }
102 public int getMaximumCommandLength() {
103 return 1024;
104 }
105 protected int getMaximumInputFilesPerCommand() {
106 return 1;
107 }
108 protected int getTotalArgumentLengthForInputFile(File outputDir,
109 String inputFile) {
110 String arg1 = getInputFileArgument(outputDir, inputFile, 0);
111 String arg2 = getInputFileArgument(outputDir, inputFile, 1);
112 return arg1.length() + arg2.length() + 2;
113 }
114 protected void getUndefineSwitch(StringBuffer buffer, String define) {
115 DevStudioProcessor.getUndefineSwitch(buffer, define);
116 }
117 }