]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/C89Processor.java
3 * Copyright 2002-2004 The Ant-Contrib project
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 package net
.sf
.antcontrib
.cpptasks
.sun
;
18 import java
.util
.Vector
;
19 import net
.sf
.antcontrib
.cpptasks
.types
.LibraryTypeEnum
;
22 * A add-in class for Sun C89 compilers and linkers
24 * @author Hiram Chirino (cojonudo14@hotmail.com)
26 public class C89Processor
{
27 private static int addLibraryPatterns(String
[] libnames
, StringBuffer buf
,
28 String prefix
, String extension
, String
[] patterns
, int offset
) {
29 for (int i
= 0; i
< libnames
.length
; i
++) {
32 buf
.append(libnames
[i
]);
33 buf
.append(extension
);
34 patterns
[offset
+ i
] = buf
.toString();
36 return offset
+ libnames
.length
;
38 public static void addWarningSwitch(Vector args
, int level
) {
41 * case 0: args.addElement("/W0"); break;
43 * case 1: args.addElement("/W1"); break;
47 * case 3: args.addElement("/W3"); break;
49 * case 4: args.addElement("/W4"); break;
53 public static String
getCommandFileSwitch(String cmdFile
) {
54 StringBuffer buf
= new StringBuffer("@");
55 if (cmdFile
.indexOf(' ') >= 0) {
62 return buf
.toString();
64 public static void getDefineSwitch(StringBuffer buf
, String define
,
69 if (value
!= null && value
.length() > 0) {
74 public static String
getIncludeDirSwitch(String includeDir
) {
75 return "-I" + includeDir
;
77 public static String
[] getLibraryPatterns(String
[] libnames
, LibraryTypeEnum libType
) {
78 StringBuffer buf
= new StringBuffer();
79 int patternCount
= libnames
.length
*2;
80 if (libType
!= null) {
81 patternCount
= libnames
.length
;
83 String
[] patterns
= new String
[patternCount
];
85 if (libType
== null || "static".equals(libType
.getValue())) {
86 offset
= addLibraryPatterns(libnames
, buf
, "lib", ".a", patterns
, 0);
88 if (libType
== null || !"static".equals(libType
.getValue())) {
89 offset
= addLibraryPatterns(libnames
, buf
, "lib", ".so", patterns
,
94 public static String
[] getOutputFileSwitch(String outPath
) {
95 StringBuffer buf
= new StringBuffer("-o ");
96 if (outPath
.indexOf(' ') >= 0) {
103 String
[] retval
= new String
[]{buf
.toString()};
106 public static void getUndefineSwitch(StringBuffer buf
, String define
) {
111 public static boolean isCaseSensitive() {
114 private C89Processor() {