+++ /dev/null
-/*\r
- * \r
- * Copyright 2001-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.ti;\r
-import java.io.File;\r
-import java.util.Vector;\r
-\r
-import net.sf.antcontrib.cpptasks.CUtil;\r
-import net.sf.antcontrib.cpptasks.compiler.CommandLineCCompiler;\r
-import net.sf.antcontrib.cpptasks.compiler.LinkType;\r
-import net.sf.antcontrib.cpptasks.compiler.Linker;\r
-import net.sf.antcontrib.cpptasks.OptimizationEnum;\r
-\r
-\r
-import org.apache.tools.ant.types.Environment;\r
-/**\r
- * Adapter for TI DSP compilers with cl** commands\r
- * \r
- * @author CurtA\r
- */\r
-public class ClxxCCompiler extends CommandLineCCompiler {\r
- /**\r
- * Header file extensions\r
- */\r
- private static final String[] headerExtensions = new String[]{".h", ".hpp",\r
- ".inl"};\r
- /**\r
- * Source file extensions\r
- */\r
- private static final String[] sourceExtensions = new String[]{".c", ".cc",\r
- ".cpp", ".cxx", ".c++"};\r
- /**\r
- * Singleton for TMS320C55x\r
- */\r
- private static final ClxxCCompiler cl55 = new ClxxCCompiler("cl55", false,\r
- null);\r
- /**\r
- * Singleton for TMS320C6000\r
- */\r
- private static final ClxxCCompiler cl6x = new ClxxCCompiler("cl6x", false,\r
- null);\r
- public static ClxxCCompiler getCl55Instance() {\r
- return cl55;\r
- }\r
- public static ClxxCCompiler getCl6xInstance() {\r
- return cl6x;\r
- }\r
- /**\r
- * Private constructor\r
- * \r
- * @param command\r
- * executable name\r
- * @param newEnvironment\r
- * Change environment\r
- * @param env\r
- * New environment\r
- */\r
- private ClxxCCompiler(String command, boolean newEnvironment,\r
- Environment env) {\r
- super(command, "-h", sourceExtensions, headerExtensions, ".o", false,\r
- null, newEnvironment, env);\r
- }\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler#addImpliedArgs(java.util.Vector,\r
- * boolean, boolean, boolean,\r
- * net.sf.antcontrib.cpptasks.compiler.LinkType)\r
- */\r
- protected void addImpliedArgs(\r
- 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
- if (debug) {\r
- args.addElement("-gw");\r
- }\r
- }\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler#addWarningSwitch(java.util.Vector,\r
- * int)\r
- */\r
- protected void addWarningSwitch(Vector args, int warnings) {\r
- // TODO Auto-generated method stub\r
- }\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler#getDefineSwitch(java.lang.StringBuffer,\r
- * java.lang.String, java.lang.String)\r
- */\r
- protected void getDefineSwitch(StringBuffer buffer, String define,\r
- String value) {\r
- buffer.append("-d");\r
- buffer.append(define);\r
- if (value != null) {\r
- buffer.append('=');\r
- buffer.append(value);\r
- }\r
- }\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler#getEnvironmentIncludePath()\r
- */\r
- protected File[] getEnvironmentIncludePath() {\r
- File[] c_dir = CUtil.getPathFromEnvironment("C_DIR", ";");\r
- File[] cx_dir = CUtil.getPathFromEnvironment("C6X_C_DIR", ";");\r
- if (c_dir.length == 0) {\r
- return cx_dir;\r
- }\r
- if (cx_dir.length == 0) {\r
- return c_dir;\r
- }\r
- File[] combo = new File[c_dir.length + cx_dir.length];\r
- for (int i = 0; i < cx_dir.length; i++) {\r
- combo[i] = cx_dir[i];\r
- }\r
- for (int i = 0; i < c_dir.length; i++) {\r
- combo[i + cx_dir.length] = c_dir[i];\r
- }\r
- return combo;\r
- }\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler#getIncludeDirSwitch(java.lang.String)\r
- */\r
- protected String getIncludeDirSwitch(String source) {\r
- return "-I" + source;\r
- }\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see net.sf.antcontrib.cpptasks.compiler.Processor#getLinker(net.sf.antcontrib.cpptasks.compiler.LinkType)\r
- */\r
- public Linker getLinker(LinkType type) {\r
- if (type.isStaticLibrary()) {\r
- if (this == cl6x) {\r
- return ClxxLibrarian.getCl6xInstance();\r
- }\r
- return ClxxLibrarian.getCl55Instance();\r
- }\r
- if (type.isSharedLibrary()) {\r
- if (this == cl6x) {\r
- return ClxxLinker.getCl6xDllInstance();\r
- }\r
- return ClxxLinker.getCl55DllInstance();\r
- }\r
- if (this == cl6x) {\r
- return ClxxLinker.getCl6xInstance();\r
- }\r
- return ClxxLinker.getCl55Instance();\r
- }\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler#getMaximumCommandLength()\r
- */\r
- public int getMaximumCommandLength() {\r
- return 1024;\r
- }\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler#getUndefineSwitch(java.lang.StringBuffer,\r
- * java.lang.String)\r
- */\r
- protected void getUndefineSwitch(StringBuffer buffer, String define) {\r
- buffer.append("-u");\r
- buffer.append(define);\r
- }\r
-}\r