1 /*
2 * #%L
3 * Native ARchive plugin for Maven
4 * %%
5 * Copyright (C) 2002 - 2014 NAR Maven Plugin developers.
6 * %%
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * #L%
19 */
20 package com.github.maven_nar.cpptasks.openwatcom;
21
22 import java.io.File;
23
24 import org.apache.tools.ant.types.Environment;
25
26 import com.github.maven_nar.cpptasks.compiler.LinkType;
27 import com.github.maven_nar.cpptasks.compiler.Linker;
28 import com.github.maven_nar.cpptasks.parser.FortranParser;
29 import com.github.maven_nar.cpptasks.parser.Parser;
30
31 /**
32 * Adapter for the OpenWatcom Fortran compiler.
33 *
34 * @author Curt Arnold
35 */
36 public final class OpenWatcomFortranCompiler extends OpenWatcomCompiler {
37 /**
38 * Singleton.
39 */
40 private static final OpenWatcomFortranCompiler[] INSTANCE = new OpenWatcomFortranCompiler[] {
41 new OpenWatcomFortranCompiler("wfl386", false, null)
42 };
43
44 /**
45 * Get instance.
46 *
47 * @return OpenWatcomFortranCompiler compiler instance
48 */
49 public static OpenWatcomFortranCompiler getInstance() {
50 return INSTANCE[0];
51 }
52
53 /**
54 * Constructor.
55 *
56 * @param command
57 * String command
58 * @param newEnvironment
59 * boolean use new environment
60 * @param env
61 * Environment environment
62 */
63 private OpenWatcomFortranCompiler(final String command, final boolean newEnvironment, final Environment env) {
64 super(command, "/?", new String[] {
65 ".f90", ".for", ".f"
66 }, new String[] {
67 ".i", ".i90", ".fpp"
68 }, newEnvironment, env);
69 }
70
71 /**
72 * Create dependency parser.
73 *
74 * @param source
75 * File source file
76 * @return Parser parser
77 */
78 @Override
79 public Parser createParser(final File source) {
80 return new FortranParser();
81 }
82
83 /**
84 * Get linker.
85 *
86 * @param type
87 * link type
88 * @return linker
89 */
90 @Override
91 public Linker getLinker(final LinkType type) {
92 return OpenWatcomFortranLinker.getInstance().getLinker(type);
93 }
94
95 }