From feccee87a78e68d575dbdf44b34ca0cb5a21ea8d Mon Sep 17 00:00:00 2001 From: lhauch Date: Thu, 5 Oct 2006 23:12:07 +0000 Subject: Restructuring for better separation of Tool packages. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1674 6f19259b-4bc3-4df7-8a09-765794883524 --- .../compaq/CompaqVisualFortranCompiler.java | 138 +++++++++++++++++++++ .../compaq/CompaqVisualFortranLibrarian.java | 82 ++++++++++++ .../cpptasks/compaq/CompaqVisualFortranLinker.java | 77 ++++++++++++ 3 files changed, 297 insertions(+) create mode 100644 Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranCompiler.java create mode 100644 Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLibrarian.java create mode 100644 Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLinker.java (limited to 'Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq') diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranCompiler.java new file mode 100644 index 0000000000..e1d3deb8b6 --- /dev/null +++ b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranCompiler.java @@ -0,0 +1,138 @@ +/* + * + * 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, + final Boolean defaultflag) { + 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:"); + if (includeDir.indexOf(' ') >= 0) { + buf.append('"'); + buf.append(includeDir); + buf.append('"'); + } else { + buf.append(includeDir); + } + 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/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLibrarian.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLibrarian.java new file mode 100644 index 0000000000..eb4a40769e --- /dev/null +++ b/Tools/Java/Source/Cpptasks/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, Boolean defaultflag) { + 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/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLinker.java new file mode 100644 index 0000000000..d83e3b213d --- /dev/null +++ b/Tools/Java/Source/Cpptasks/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()}; + } +} -- cgit v1.2.3