1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package com.github.maven_nar.cpptasks.openwatcom;
21
22 import java.util.Vector;
23
24 import com.github.maven_nar.cpptasks.types.LibraryTypeEnum;
25
26
27
28
29
30
31 public final class OpenWatcomProcessor {
32
33
34
35
36
37
38
39
40 public static void addWarningSwitch(final Vector<String> args, final int level) {
41 switch (level) {
42 case 0:
43 args.addElement("/w0");
44 break;
45 case 1:
46 args.addElement("/w1");
47 break;
48 case 2:
49 break;
50 case 3:
51 args.addElement("/w2");
52 break;
53 case 4:
54 args.addElement("/w3");
55 break;
56 case 5:
57 args.addElement("/we");
58 break;
59 default:
60 args.addElement("/w1");
61 break;
62 }
63 }
64
65
66
67
68
69
70
71
72 public static String getCommandFileSwitch(final String cmdFile) {
73 final StringBuffer buf = new StringBuffer("@");
74 if (cmdFile.indexOf(' ') >= 0) {
75 buf.append('\"');
76 buf.append(cmdFile.replace('/', '\\'));
77 buf.append('\"');
78 } else {
79 buf.append(cmdFile);
80 }
81 return buf.toString();
82 }
83
84
85
86
87
88
89
90
91
92
93
94 public static void getDefineSwitch(final StringBuffer buffer, final String define, final String value) {
95 buffer.append("/d");
96 buffer.append(define);
97 if (value != null && value.length() > 0) {
98 buffer.append('=');
99 buffer.append(value);
100 }
101 }
102
103
104
105
106
107
108
109
110 public static String getIncludeDirSwitch(final String includeDir) {
111 return "/i=" + includeDir.replace('/', '\\');
112 }
113
114
115
116
117
118
119
120
121
122
123 public static String[] getLibraryPatterns(final String[] libnames, final LibraryTypeEnum libType) {
124 final StringBuffer buf = new StringBuffer();
125 final String[] patterns = new String[libnames.length];
126 for (int i = 0; i < libnames.length; i++) {
127 buf.setLength(0);
128 buf.append(libnames[i]);
129 buf.append(".lib");
130 patterns[i] = buf.toString();
131 }
132 return patterns;
133 }
134
135
136
137
138
139
140
141
142 public static String[] getOutputFileSwitch(final String outPath) {
143 final StringBuffer buf = new StringBuffer("/fo=");
144 if (outPath.indexOf(' ') >= 0) {
145 buf.append('\"');
146 buf.append(outPath);
147 buf.append('\"');
148 } else {
149 buf.append(outPath);
150 }
151 final String[] retval = new String[] {
152 buf.toString()
153 };
154 return retval;
155 }
156
157
158
159
160
161
162
163
164
165 public static void getUndefineSwitch(final StringBuffer buffer, final String define) {
166 buffer.append("/u");
167 buffer.append(define);
168 }
169
170
171
172
173
174
175 public static boolean isCaseSensitive() {
176 return false;
177 }
178
179
180
181
182 private OpenWatcomProcessor() {
183 }
184
185 }