]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractLinker.java
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Java / Source / Cpptasks / net / sf / antcontrib / cpptasks / compiler / AbstractLinker.java
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractLinker.java
new file mode 100644 (file)
index 0000000..20580e5
--- /dev/null
@@ -0,0 +1,85 @@
+/*\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.compiler;\r
+import java.io.File;\r
+\r
+import net.sf.antcontrib.cpptasks.CCTask;\r
+import net.sf.antcontrib.cpptasks.LinkerDef;\r
+import net.sf.antcontrib.cpptasks.ProcessorDef;\r
+import net.sf.antcontrib.cpptasks.TargetDef;\r
+\r
+\r
+import org.apache.tools.ant.types.Environment;\r
+/**\r
+ * An abstract Linker implementation.\r
+ * \r
+ * @author Adam Murdoch\r
+ */\r
+public abstract class AbstractLinker extends AbstractProcessor\r
+        implements\r
+            Linker {\r
+    public AbstractLinker(String[] objExtensions, String[] ignoredExtensions) {\r
+        super(objExtensions, ignoredExtensions);\r
+    }\r
+    /**\r
+     * Returns the bid of the processor for the file.\r
+     * \r
+     * A linker will bid 1 on any unrecognized file type.\r
+     * \r
+     * @param inputFile\r
+     *            filename of input file\r
+     * @return bid for the file, 0 indicates no interest, 1 indicates that the\r
+     *         processor recognizes the file but doesn't process it (header\r
+     *         files, for example), 100 indicates strong interest\r
+     */\r
+    public int bid(String inputFile) {\r
+        int bid = super.bid(inputFile);\r
+        switch (bid) {\r
+            //\r
+            //  unrecognized extension, take the file\r
+            //\r
+            case 0 :\r
+                return 1;\r
+            //\r
+            //   discard the ignored extensions\r
+            //\r
+            case 1 :\r
+                return 0;\r
+        }\r
+        return bid;\r
+    }\r
+    public Processor changeEnvironment(boolean newEnvironment, Environment env) {\r
+        return this;\r
+    }\r
+    abstract protected LinkerConfiguration createConfiguration(CCTask task,\r
+            LinkType linkType, ProcessorDef[] baseConfigs,\r
+            LinkerDef specificConfig, TargetDef targetPlatform);\r
+    public ProcessorConfiguration createConfiguration(CCTask task,\r
+            LinkType linkType, ProcessorDef[] baseConfigs,\r
+            ProcessorDef specificConfig,\r
+                       TargetDef targetPlatform) {\r
+        if (specificConfig == null) {\r
+            throw new NullPointerException("specificConfig");\r
+        }\r
+        return createConfiguration(task, linkType, baseConfigs,\r
+                (LinkerDef) specificConfig, targetPlatform);\r
+    }\r
+    public String getLibraryKey(File libfile) {\r
+        return libfile.getName();\r
+    }\r
+    public abstract String getOutputFileName(String fileName);\r
+}\r