+++ /dev/null
-/*\r
- * \r
- * Copyright 2002-2004 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.borland;\r
-import java.io.File;\r
-import java.util.Vector;\r
-import net.sf.antcontrib.cpptasks.CCTask;\r
-import net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler;\r
-import net.sf.antcontrib.cpptasks.compiler.CommandLineCompilerConfiguration;\r
-import net.sf.antcontrib.cpptasks.compiler.LinkType;\r
-import net.sf.antcontrib.cpptasks.compiler.Linker;\r
-import net.sf.antcontrib.cpptasks.compiler.Processor;\r
-import net.sf.antcontrib.cpptasks.compiler.ProgressMonitor;\r
-import net.sf.antcontrib.cpptasks.parser.CParser;\r
-import net.sf.antcontrib.cpptasks.parser.Parser;\r
-import net.sf.antcontrib.cpptasks.OptimizationEnum;\r
-\r
-import org.apache.tools.ant.BuildException;\r
-import org.apache.tools.ant.types.Environment;\r
-/**\r
- * Adapter for the Borland(r) brc32 Resource compiler.\r
- * \r
- * @author Curt Arnold\r
- */\r
-public class BorlandResourceCompiler extends CommandLineCompiler {\r
- private static final BorlandResourceCompiler instance = new BorlandResourceCompiler(\r
- false, null);\r
- public static BorlandResourceCompiler getInstance() {\r
- return instance;\r
- }\r
- private BorlandResourceCompiler(boolean newEnvironment, Environment env) {\r
- super("brc32", "c:\\__bogus\\__bogus.rc", new String[]{".rc"},\r
- new String[]{".h", ".hpp", ".inl"}, ".res", false, null,\r
- newEnvironment, env);\r
- }\r
- protected void addImpliedArgs(final Vector args, \r
- final boolean debug,\r
- final boolean multithreaded, \r
- final boolean exceptions, \r
- final LinkType linkType,\r
- final Boolean rtti,\r
- final OptimizationEnum optimization,\r
- final Boolean defaultflag) {\r
- //\r
- // compile only\r
- //\r
- args.addElement("-r");\r
- }\r
- protected void addWarningSwitch(Vector args, int level) {\r
- }\r
- public Processor changeEnvironment(boolean newEnvironment, Environment env) {\r
- if (newEnvironment || env != null) {\r
- return new BorlandResourceCompiler(newEnvironment, env);\r
- }\r
- return this;\r
- }\r
- public void compile(CCTask task, File outputDir, String[] sourceFiles,\r
- String[] args, String[] endArgs, boolean relentless,\r
- CommandLineCompilerConfiguration config, ProgressMonitor monitor)\r
- throws BuildException {\r
- super.compile(task, outputDir, sourceFiles, args, endArgs, relentless,\r
- config, monitor);\r
- }\r
- /**\r
- * The include parser for C will work just fine, but we didn't want to\r
- * inherit from CommandLineCCompiler\r
- */\r
- protected Parser createParser(File source) {\r
- return new CParser();\r
- }\r
- protected int getArgumentCountPerInputFile() {\r
- return 2;\r
- }\r
- protected void getDefineSwitch(StringBuffer buffer, String define,\r
- String value) {\r
- buffer.append("-d");\r
- buffer.append(define);\r
- if (value != null && value.length() > 0) {\r
- buffer.append('=');\r
- buffer.append(value);\r
- }\r
- }\r
- protected File[] getEnvironmentIncludePath() {\r
- return BorlandProcessor.getEnvironmentPath("brc32", 'i',\r
- new String[]{"..\\include"});\r
- }\r
- protected String getIncludeDirSwitch(String includeDir) {\r
- return BorlandProcessor.getIncludeDirSwitch("-i", includeDir);\r
- }\r
- protected String getInputFileArgument(File outputDir, String filename,\r
- int index) {\r
- if (index == 0) {\r
- String outputFileName = getOutputFileName(filename);\r
- String fullOutputName = new File(outputDir, outputFileName)\r
- .toString();\r
- return "-fo" + fullOutputName;\r
- }\r
- return filename;\r
- }\r
- public Linker getLinker(LinkType type) {\r
- return BorlandLinker.getInstance().getLinker(type);\r
- }\r
- public int getMaximumCommandLength() {\r
- return 1024;\r
- }\r
- protected int getMaximumInputFilesPerCommand() {\r
- return 1;\r
- }\r
- protected int getTotalArgumentLengthForInputFile(File outputDir,\r
- String inputFile) {\r
- String arg1 = getInputFileArgument(outputDir, inputFile, 0);\r
- String arg2 = getInputFileArgument(outputDir, inputFile, 1);\r
- return arg1.length() + arg2.length() + 2;\r
- }\r
- protected void getUndefineSwitch(StringBuffer buffer, String define) {\r
- }\r
-}\r