+++ /dev/null
-/*\r
- * \r
- * Copyright 2001-2005 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
-\r
-import java.io.File;\r
-\r
-import net.sf.antcontrib.cpptasks.AslcompilerDef;\r
-import net.sf.antcontrib.cpptasks.CCTask;\r
-import net.sf.antcontrib.cpptasks.ProcessorDef;\r
-import net.sf.antcontrib.cpptasks.TargetDef;\r
-\r
-/**\r
- * An abstract asl compiler implementation.\r
- * \r
- */\r
-public abstract class AbstractAslcompiler extends AbstractProcessor\r
-implements Aslcompiler {\r
- private String outputSuffix;\r
- protected AbstractAslcompiler(String[] sourceExtensions,\r
- String[] headerExtensions, String outputSuffix) {\r
- super(sourceExtensions, headerExtensions);\r
- this.outputSuffix = outputSuffix;\r
- } \r
- abstract protected AslcompilerConfiguration createConfiguration(CCTask task,\r
- LinkType linkType, ProcessorDef[] baseConfigs,\r
- AslcompilerDef specificConfig, TargetDef targetPlatform);\r
- \r
- public ProcessorConfiguration createConfiguration(CCTask task,\r
- LinkType linkType, ProcessorDef[] baseConfigs,\r
- ProcessorDef specificConfig, TargetDef targetPlatform) {\r
- if (specificConfig == null) {\r
- throw new NullPointerException("specificConfig");\r
- }\r
- return createConfiguration(task, linkType, baseConfigs,\r
- (AslcompilerDef) specificConfig, targetPlatform);\r
- }\r
- \r
- public String getOutputFileName(String inputFile) {\r
- if (bid(inputFile) > 1) {\r
- String baseName = getBaseOutputName(inputFile);\r
- return baseName + outputSuffix;\r
- }\r
- return null;\r
- }\r
- protected String getBaseOutputName(String inputFile) {\r
- int lastSlash = inputFile.lastIndexOf('/');\r
- int lastReverse = inputFile.lastIndexOf('\\');\r
- int lastSep = inputFile.lastIndexOf(File.separatorChar);\r
- if (lastReverse > lastSlash) {\r
- lastSlash = lastReverse;\r
- }\r
- if (lastSep > lastSlash) {\r
- lastSlash = lastSep;\r
- }\r
- int lastPeriod = inputFile.lastIndexOf('.');\r
- if (lastPeriod < 0) {\r
- lastPeriod = inputFile.length();\r
- }\r
- return inputFile.substring(lastSlash + 1, lastPeriod);\r
- }\r
-}
\ No newline at end of file