--- /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.ibm;\r
+import java.io.File;\r
+import java.util.Vector;\r
+\r
+import net.sf.antcontrib.cpptasks.compiler.LinkType;\r
+import net.sf.antcontrib.cpptasks.compiler.Linker;\r
+import net.sf.antcontrib.cpptasks.gcc.GccCompatibleCCompiler;\r
+import net.sf.antcontrib.cpptasks.OptimizationEnum;\r
+\r
+import org.apache.tools.ant.types.Environment;\r
+/**\r
+ * Adapter for the IBM(r) Visual Age(tm) C++ compiler for AIX(tm)\r
+ * \r
+ * @author Curt Arnold\r
+ */\r
+public final class VisualAgeCCompiler extends GccCompatibleCCompiler {\r
+ private static final VisualAgeCCompiler instance = new VisualAgeCCompiler(\r
+ "xlC", false, null);\r
+ /**\r
+ * Gets singleton instance of this class\r
+ */\r
+ public static VisualAgeCCompiler getInstance() {\r
+ return instance;\r
+ }\r
+ private String identifier;\r
+ private File[] includePath;\r
+ /**\r
+ * Private constructor. Use getInstance() to get singleton instance of this\r
+ * class.\r
+ */\r
+ private VisualAgeCCompiler(String command, boolean newEnvironment,\r
+ Environment env) {\r
+ super(command, "-help", false, null, newEnvironment, env);\r
+ }\r
+ public 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
+ args.addElement("-c");\r
+ if (debug) {\r
+ args.addElement("-g");\r
+ }\r
+ if (linkType.isSharedLibrary()) {\r
+ args.addElement("-fpic");\r
+ }\r
+ if (rtti != null) {\r
+ if (rtti.booleanValue()) {\r
+ args.addElement("-qrtti=all");\r
+ } else {\r
+ args.addElement("-qnortti");\r
+ }\r
+ }\r
+ }\r
+ public void addWarningSwitch(Vector args, int level) {\r
+ switch (level) {\r
+ case 0 :\r
+ args.addElement("-w");\r
+ break;\r
+ case 1 :\r
+ args.addElement("-qflag=s:s");\r
+ break;\r
+ case 2 :\r
+ args.addElement("-qflag=e:e");\r
+ break;\r
+ case 3 :\r
+ args.addElement("-qflag=w:w");\r
+ break;\r
+ case 4 :\r
+ args.addElement("-qflag=i:i");\r
+ break;\r
+ case 5 :\r
+ args.addElement("-qhalt=w:w");\r
+ break;\r
+ }\r
+ }\r
+ public Linker getLinker(LinkType linkType) {\r
+ return VisualAgeLinker.getInstance().getLinker(linkType);\r
+ }\r
+ public int getMaximumCommandLength() {\r
+ return Integer.MAX_VALUE;\r
+ }\r
+ /**\r
+ * Gets identifier for the compiler.\r
+ * \r
+ * Initial attempt at extracting version information\r
+ * would lock up. Using a stock response.\r
+ */\r
+ public String getIdentifier() {\r
+ return "VisualAge compiler - unidentified version";\r
+ }\r
+ \r
+}\r