summaryrefslogtreecommitdiff
path: root/src/main/java/net/sf/antcontrib/cpptasks/compaq
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/sf/antcontrib/cpptasks/compaq')
-rw-r--r--src/main/java/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranCompiler.java139
-rw-r--r--src/main/java/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLibrarian.java82
-rw-r--r--src/main/java/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLinker.java77
3 files changed, 298 insertions, 0 deletions
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranCompiler.java
new file mode 100644
index 0000000..ca3c3e3
--- /dev/null
+++ b/src/main/java/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranCompiler.java
@@ -0,0 +1,139 @@
+/*
+ *
+ * Copyright 2002-2004 The Ant-Contrib project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.cpptasks.compaq;
+import java.io.File;
+import java.util.Vector;
+
+import net.sf.antcontrib.cpptasks.CUtil;
+import net.sf.antcontrib.cpptasks.compiler.CommandLineFortranCompiler;
+import net.sf.antcontrib.cpptasks.compiler.LinkType;
+import net.sf.antcontrib.cpptasks.compiler.Linker;
+import net.sf.antcontrib.cpptasks.compiler.Processor;
+import net.sf.antcontrib.cpptasks.OptimizationEnum;
+
+
+import org.apache.tools.ant.types.Environment;
+/**
+ * Adapter for the Compaq(r) Visual Fortran compiler.
+ *
+ * @author Curt Arnold
+ */
+public class CompaqVisualFortranCompiler extends CommandLineFortranCompiler {
+ private static final CompaqVisualFortranCompiler[] instance = new CompaqVisualFortranCompiler[]{new CompaqVisualFortranCompiler(
+ false, null)};
+ public static CompaqVisualFortranCompiler getInstance() {
+ return instance[0];
+ }
+ private CompaqVisualFortranCompiler(boolean newEnvironment, Environment env) {
+ super("DF", null, new String[]{".f90", ".for", ".f"}, new String[]{
+ ".i", ".i90", ".fpp", ".inc", ".bak", ".exe"}, ".obj", false,
+ null, newEnvironment, env);
+ }
+ protected void addImpliedArgs(final Vector args,
+ final boolean debug,
+ final boolean multithreaded,
+ final boolean exceptions,
+ final LinkType linkType,
+ final Boolean rtti,
+ final OptimizationEnum optimization) {
+ args.addElement("/nologo");
+ args.addElement("/compile_only");
+ if (debug) {
+ args.addElement("/debug:full");
+ args.addElement("/define:_DEBUG");
+ } else {
+ args.addElement("/debug:none");
+ args.addElement("/define:NDEBUG");
+ }
+ if (multithreaded) {
+ args.addElement("/threads");
+ args.addElement("/define:_MT");
+ } else {
+ args.addElement("/nothreads");
+ }
+ boolean staticRuntime = linkType.isStaticRuntime();
+ if (staticRuntime) {
+ args.addElement("/libs:static");
+ } else {
+ args.addElement("/libs:dll");
+ }
+ if (linkType.isSharedLibrary()) {
+ args.addElement("/dll");
+ args.addElement("/define:_DLL");
+ }
+ }
+ public void addWarningSwitch(Vector args, int level) {
+ switch (level) {
+ case 0 :
+ args.addElement("/nowarn");
+ break;
+ case 1 :
+ break;
+ case 2 :
+ break;
+ case 3 :
+ args.addElement("/warn:usage");
+ break;
+ case 4 :
+ args.addElement("/warn:all");
+ break;
+ case 5 :
+ args.addElement("/warn:errors");
+ break;
+ }
+ }
+ public Processor changeEnvironment(boolean newEnvironment, Environment env) {
+ if (newEnvironment || env != null) {
+ return new CompaqVisualFortranCompiler(newEnvironment, env);
+ }
+ return this;
+ }
+ protected void getDefineSwitch(StringBuffer buf, String define, String value) {
+ buf.append("/define:");
+ buf.append(define);
+ if (value != null && value.length() > 0) {
+ buf.append('=');
+ buf.append(value);
+ }
+ }
+ protected File[] getEnvironmentIncludePath() {
+ return CUtil.getPathFromEnvironment("INCLUDE", ";");
+ }
+ protected String getIncludeDirSwitch(String includeDir) {
+ StringBuffer buf = new StringBuffer("/include:");
+// BEGINFREEHEP quotes seem to confuse the compiler
+// if (includeDir.indexOf(' ') >= 0) {
+// buf.append('"');
+// buf.append(includeDir);
+// buf.append('"');
+// } else {
+ buf.append(includeDir);
+// }
+// ENDFREEHEP
+ return buf.toString();
+ }
+ public Linker getLinker(LinkType type) {
+ return CompaqVisualFortranLinker.getInstance().getLinker(type);
+ }
+ public int getMaximumCommandLength() {
+ return 1024;
+ }
+ protected void getUndefineSwitch(StringBuffer buf, String define) {
+ buf.append("/undefine:");
+ buf.append(define);
+ }
+}
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLibrarian.java b/src/main/java/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLibrarian.java
new file mode 100644
index 0000000..2488619
--- /dev/null
+++ b/src/main/java/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLibrarian.java
@@ -0,0 +1,82 @@
+/*
+ *
+ * Copyright 2002-2004 The Ant-Contrib project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.cpptasks.compaq;
+import java.io.File;
+import java.util.Vector;
+
+import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
+import net.sf.antcontrib.cpptasks.compiler.LinkType;
+import net.sf.antcontrib.cpptasks.compiler.Linker;
+import net.sf.antcontrib.cpptasks.devstudio.DevStudioLibrarian;
+import net.sf.antcontrib.cpptasks.devstudio.DevStudioProcessor;
+import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
+
+/**
+ * Adapter for the Compaq(r) Visual Fortran Librarian
+ *
+ * @author Curt Arnold
+ */
+public class CompaqVisualFortranLibrarian extends CommandLineLinker {
+ private static final CompaqVisualFortranLibrarian instance = new CompaqVisualFortranLibrarian();
+ public static CompaqVisualFortranLibrarian getInstance() {
+ return instance;
+ }
+ private CompaqVisualFortranLibrarian() {
+ super("lib", "/bogus", new String[]{".obj"}, new String[0], ".lib",
+ false, null);
+ }
+ protected void addBase(long base, Vector args) {
+ }
+ protected void addFixed(Boolean fixed, Vector args) {
+ }
+ protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args) {
+ args.addElement("/nologo");
+ }
+ protected void addIncremental(boolean incremental, Vector args) {
+ }
+ protected void addMap(boolean map, Vector args) {
+ }
+ protected void addStack(int stack, Vector args) {
+ }
+ /* (non-Javadoc)
+ * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)
+ */
+ protected void addEntry(String entry, Vector args) {
+ }
+
+ protected String getCommandFileSwitch(String commandFile) {
+ return DevStudioProcessor.getCommandFileSwitch(commandFile);
+ }
+ public File[] getLibraryPath() {
+ return new File[0];
+ }
+ public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
+ return new String[0];
+ }
+ public Linker getLinker(LinkType type) {
+ return CompaqVisualFortranLinker.getInstance().getLinker(type);
+ }
+ protected int getMaximumCommandLength() {
+ return DevStudioLibrarian.getInstance().getMaximumCommandLength();
+ }
+ protected String[] getOutputFileSwitch(String outputFile) {
+ return DevStudioLibrarian.getInstance().getOutputFileSwitch(outputFile);
+ }
+ public boolean isCaseSensitive() {
+ return false;
+ }
+}
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLinker.java
new file mode 100644
index 0000000..c8930f9
--- /dev/null
+++ b/src/main/java/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLinker.java
@@ -0,0 +1,77 @@
+/*
+ *
+ * Copyright 2002-2004 The Ant-Contrib project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.cpptasks.compaq;
+import java.util.Vector;
+
+import net.sf.antcontrib.cpptasks.compiler.LinkType;
+import net.sf.antcontrib.cpptasks.compiler.Linker;
+import net.sf.antcontrib.cpptasks.devstudio.DevStudioCompatibleLinker;
+/**
+ * Adapter for the Compaq(r) Visual Fortran linker.
+ *
+ * @author Curt Arnold
+ */
+public final class CompaqVisualFortranLinker extends DevStudioCompatibleLinker {
+ private static final CompaqVisualFortranLinker dllLinker = new CompaqVisualFortranLinker(
+ ".dll");
+ private static final CompaqVisualFortranLinker instance = new CompaqVisualFortranLinker(
+ ".exe");
+ public static CompaqVisualFortranLinker getInstance() {
+ return instance;
+ }
+ private CompaqVisualFortranLinker(String outputSuffix) {
+ super("DF", "__bogus__.xxx", outputSuffix);
+ }
+ protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args) {
+ args.addElement("/NOLOGO");
+ boolean staticRuntime = linkType.isStaticRuntime();
+ if (staticRuntime) {
+ args.addElement("/libs:static");
+ } else {
+ args.addElement("/libs:dll");
+ }
+ if (debug) {
+ args.addElement("/debug");
+ } else {
+ }
+ if (linkType.isSharedLibrary()) {
+ args.addElement("/dll");
+ } else {
+ args.addElement("/exe");
+ }
+ }
+ public Linker getLinker(LinkType type) {
+ if (type.isStaticLibrary()) {
+ return CompaqVisualFortranLibrarian.getInstance();
+ }
+ if (type.isSharedLibrary()) {
+ return dllLinker;
+ }
+ return instance;
+ }
+ public String[] getOutputFileSwitch(String outputFile) {
+ StringBuffer buf = new StringBuffer("/OUT:");
+ if (outputFile.indexOf(' ') >= 0) {
+ buf.append('"');
+ buf.append(outputFile);
+ buf.append('"');
+ } else {
+ buf.append(outputFile);
+ }
+ return new String[]{buf.toString()};
+ }
+}