View Javadoc

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.os400;
21  
22  import java.util.Vector;
23  
24  /**
25   * A add-in class for IBM (r) OS/390 compilers and linkers
26   *
27   * @author Hiram Chirino (cojonudo14@hotmail.com)
28   */
29  public class IccProcessor {
30    public static void addWarningSwitch(final Vector<String> args, final int level) {
31      switch (level) {
32      /*
33       * case 0: args.addElement("/W0"); break;
34       * 
35       * case 1: args.addElement("/W1"); break;
36       * 
37       * case 2: break;
38       * 
39       * case 3: args.addElement("/W3"); break;
40       * 
41       * case 4: args.addElement("/W4"); break;
42       */
43      }
44    }
45  
46    public static String getCommandFileSwitch(final String cmdFile) {
47      final StringBuffer buf = new StringBuffer("@");
48      if (cmdFile.indexOf(' ') >= 0) {
49        buf.append('\"');
50        buf.append(cmdFile);
51        buf.append('\"');
52      } else {
53        buf.append(cmdFile);
54      }
55      return buf.toString();
56    }
57  
58    public static String getIncludeDirSwitch(final String includeDir) {
59      return "-I" + includeDir;
60    }
61  
62    public static String[] getOutputFileSwitch(final String outPath) {
63      final StringBuffer buf = new StringBuffer("-o ");
64      if (outPath.indexOf(' ') >= 0) {
65        buf.append('\"');
66        buf.append(outPath);
67        buf.append('\"');
68      } else {
69        buf.append(outPath);
70      }
71      final String[] retval = new String[] {
72        buf.toString()
73      };
74      return retval;
75    }
76  
77    public static boolean isCaseSensitive() {
78      return true;
79    }
80  
81    private IccProcessor() {
82    }
83  }