]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /*\r |
2 | * \r | |
3 | * Copyright 2001-2004 The Ant-Contrib project\r | |
4 | *\r | |
5 | * Licensed under the Apache License, Version 2.0 (the "License");\r | |
6 | * you may not use this file except in compliance with the License.\r | |
7 | * You may obtain a copy of the License at\r | |
8 | *\r | |
9 | * http://www.apache.org/licenses/LICENSE-2.0\r | |
10 | *\r | |
11 | * Unless required by applicable law or agreed to in writing, software\r | |
12 | * distributed under the License is distributed on an "AS IS" BASIS,\r | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r | |
14 | * See the License for the specific language governing permissions and\r | |
15 | * limitations under the License.\r | |
16 | */\r | |
17 | package net.sf.antcontrib.cpptasks.hp;\r | |
18 | import java.io.File;\r | |
19 | import java.util.Vector;\r | |
20 | \r | |
21 | import net.sf.antcontrib.cpptasks.CUtil;\r | |
22 | import net.sf.antcontrib.cpptasks.compiler.LinkType;\r | |
23 | import net.sf.antcontrib.cpptasks.compiler.Linker;\r | |
24 | import net.sf.antcontrib.cpptasks.gcc.GccCompatibleCCompiler;\r | |
25 | import net.sf.antcontrib.cpptasks.OptimizationEnum;\r | |
26 | \r | |
27 | import org.apache.tools.ant.types.Environment;\r | |
28 | /**\r | |
29 | * Adapter for the HP aC++ C++ compiler\r | |
30 | * \r | |
31 | * @author Curt Arnold\r | |
32 | */\r | |
33 | public final class aCCCompiler extends GccCompatibleCCompiler {\r | |
34 | private static final aCCCompiler instance = new aCCCompiler("aCC", false,\r | |
35 | null);\r | |
36 | /**\r | |
37 | * Gets singleton instance of this class\r | |
38 | */\r | |
39 | public static aCCCompiler getInstance() {\r | |
40 | return instance;\r | |
41 | }\r | |
42 | private String identifier;\r | |
43 | private File[] includePath;\r | |
44 | /**\r | |
45 | * Private constructor. Use GccCCompiler.getInstance() to get singleton\r | |
46 | * instance of this class.\r | |
47 | */\r | |
48 | private aCCCompiler(String command, boolean newEnvironment, Environment env) {\r | |
49 | super(command, "-help", false, null, newEnvironment, env);\r | |
50 | }\r | |
51 | public void addImpliedArgs(Vector args, boolean debug,\r | |
52 | boolean multithreaded, boolean exceptions, LinkType linkType,\r | |
53 | final Boolean rtti,\r | |
54 | final OptimizationEnum optimization) {\r | |
55 | args.addElement("-c");\r | |
56 | if (debug) {\r | |
57 | args.addElement("-g");\r | |
58 | }\r | |
59 | /*\r | |
60 | * if (multithreaded) { args.addElement("-mt"); }\r | |
61 | */\r | |
62 | if (linkType.isSharedLibrary()) {\r | |
63 | args.addElement("+z");\r | |
64 | }\r | |
65 | }\r | |
66 | public void addWarningSwitch(Vector args, int level) {\r | |
67 | switch (level) {\r | |
68 | case 0 :\r | |
69 | args.addElement("-w");\r | |
70 | break;\r | |
71 | case 1 :\r | |
72 | case 2 :\r | |
73 | args.addElement("+w");\r | |
74 | break;\r | |
75 | /*\r | |
76 | * case 3: case 4: case 5: args.addElement("+w2"); break;\r | |
77 | */\r | |
78 | }\r | |
79 | }\r | |
80 | public File[] getEnvironmentIncludePath() {\r | |
81 | if (includePath == null) {\r | |
82 | File ccLoc = CUtil.getExecutableLocation("aCC");\r | |
83 | if (ccLoc != null) {\r | |
84 | File compilerIncludeDir = new File(\r | |
85 | new File(ccLoc, "../include").getAbsolutePath());\r | |
86 | if (compilerIncludeDir.exists()) {\r | |
87 | includePath = new File[2];\r | |
88 | includePath[0] = compilerIncludeDir;\r | |
89 | }\r | |
90 | }\r | |
91 | if (includePath == null) {\r | |
92 | includePath = new File[1];\r | |
93 | }\r | |
94 | includePath[includePath.length - 1] = new File("/usr/include");\r | |
95 | }\r | |
96 | return includePath;\r | |
97 | }\r | |
98 | public Linker getLinker(LinkType linkType) {\r | |
99 | return aCCLinker.getInstance().getLinker(linkType);\r | |
100 | }\r | |
101 | public int getMaximumCommandLength() {\r | |
102 | return Integer.MAX_VALUE;\r | |
103 | }\r | |
104 | }\r |