+++ /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.compaq;\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.CommandLineFortranCompiler;\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.OptimizationEnum;\r
-\r
-\r
-import org.apache.tools.ant.types.Environment;\r
-/**\r
- * Adapter for the Compaq(r) Visual Fortran compiler.\r
- * \r
- * @author Curt Arnold\r
- */\r
-public class CompaqVisualFortranCompiler extends CommandLineFortranCompiler {\r
- private static final CompaqVisualFortranCompiler[] instance = new CompaqVisualFortranCompiler[]{new CompaqVisualFortranCompiler(\r
- false, null)};\r
- public static CompaqVisualFortranCompiler getInstance() {\r
- return instance[0];\r
- }\r
- private CompaqVisualFortranCompiler(boolean newEnvironment, Environment env) {\r
- super("DF", null, new String[]{".f90", ".for", ".f"}, new String[]{\r
- ".i", ".i90", ".fpp", ".inc", ".bak", ".exe"}, ".obj", false,\r
- null, 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
- args.addElement("/nologo");\r
- args.addElement("/compile_only");\r
- if (debug) {\r
- args.addElement("/debug:full");\r
- args.addElement("/define:_DEBUG");\r
- } else {\r
- args.addElement("/debug:none");\r
- args.addElement("/define:NDEBUG");\r
- }\r
- if (multithreaded) {\r
- args.addElement("/threads");\r
- args.addElement("/define:_MT");\r
- } else {\r
- args.addElement("/nothreads");\r
- }\r
- boolean staticRuntime = linkType.isStaticRuntime();\r
- if (staticRuntime) {\r
- args.addElement("/libs:static");\r
- } else {\r
- args.addElement("/libs:dll");\r
- }\r
- if (linkType.isSharedLibrary()) {\r
- args.addElement("/dll");\r
- args.addElement("/define:_DLL");\r
- }\r
- }\r
- public void addWarningSwitch(Vector args, int level) {\r
- switch (level) {\r
- case 0 :\r
- args.addElement("/nowarn");\r
- break;\r
- case 1 :\r
- break;\r
- case 2 :\r
- break;\r
- case 3 :\r
- args.addElement("/warn:usage");\r
- break;\r
- case 4 :\r
- args.addElement("/warn:all");\r
- break;\r
- case 5 :\r
- args.addElement("/warn:errors");\r
- break;\r
- }\r
- }\r
- public Processor changeEnvironment(boolean newEnvironment, Environment env) {\r
- if (newEnvironment || env != null) {\r
- return new CompaqVisualFortranCompiler(newEnvironment, env);\r
- }\r
- return this;\r
- }\r
- protected void getDefineSwitch(StringBuffer buf, String define, String value) {\r
- buf.append("/define:");\r
- buf.append(define);\r
- if (value != null && value.length() > 0) {\r
- buf.append('=');\r
- buf.append(value);\r
- }\r
- }\r
- protected File[] getEnvironmentIncludePath() {\r
- return CUtil.getPathFromEnvironment("INCLUDE", ";");\r
- }\r
- protected String getIncludeDirSwitch(String includeDir) {\r
- StringBuffer buf = new StringBuffer("/include:");\r
- if (includeDir.indexOf(' ') >= 0) {\r
- buf.append('"');\r
- buf.append(includeDir);\r
- buf.append('"');\r
- } else {\r
- buf.append(includeDir);\r
- }\r
- return buf.toString();\r
- }\r
- public Linker getLinker(LinkType type) {\r
- return CompaqVisualFortranLinker.getInstance().getLinker(type);\r
- }\r
- public int getMaximumCommandLength() {\r
- return 1024;\r
- }\r
- protected void getUndefineSwitch(StringBuffer buf, String define) {\r
- buf.append("/undefine:");\r
- buf.append(define);\r
- }\r
-}\r