]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /*\r |
2 | * \r | |
3 | * Copyright 2001-2005 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.devstudio;\r | |
18 | \r | |
19 | import java.io.File;\r | |
20 | import java.util.Vector;\r | |
21 | \r | |
22 | import net.sf.antcontrib.cpptasks.CUtil;\r | |
23 | import net.sf.antcontrib.cpptasks.compiler.CommandLineAssembler;\r | |
24 | import net.sf.antcontrib.cpptasks.compiler.LinkType;\r | |
25 | import net.sf.antcontrib.cpptasks.compiler.Linker;\r | |
26 | \r | |
27 | /**\r | |
28 | * Adaptor for Microsoft MASM\r | |
29 | * \r | |
30 | */\r | |
31 | public final class DevStudioAssembler extends CommandLineAssembler {\r | |
32 | private final static String[] sourceExtensions = new String[] { ".asm" };\r | |
33 | \r | |
34 | private final static String[] headerExtensions = new String[] { ".h",\r | |
35 | ".inc" };\r | |
36 | \r | |
37 | private final static String[] defaultflags = new String[] { "/nologo", "/c" };\r | |
38 | \r | |
39 | private static final DevStudioAssembler instance = new DevStudioAssembler(\r | |
40 | "ml", sourceExtensions, headerExtensions, false);\r | |
41 | \r | |
42 | /**\r | |
43 | * Gets masm adapter\r | |
44 | */\r | |
45 | public static DevStudioAssembler getInstance() {\r | |
46 | return instance;\r | |
47 | }\r | |
48 | \r | |
49 | /**\r | |
50 | * Private constructor. Use DevStudioAssembler.getInstance() to get\r | |
51 | * singleton instance of this class.\r | |
52 | */\r | |
53 | private DevStudioAssembler (String command, String[] sourceExtensions,\r | |
54 | String[] headerExtensions, boolean isLibtool) {\r | |
55 | super(command, null, sourceExtensions, headerExtensions, ".obj");\r | |
56 | }\r | |
57 | \r | |
58 | public void addImpliedArgs(Vector args, boolean debug, Boolean defaultflag) {\r | |
59 | if (defaultflag != null && defaultflag.booleanValue()) {\r | |
60 | for (int i = 0; i < defaultflags.length; i++) {\r | |
61 | args.addElement(defaultflags[i]);\r | |
62 | }\r | |
63 | }\r | |
64 | if (debug) {\r | |
65 | args.addElement("Zi");\r | |
66 | }\r | |
67 | }\r | |
68 | \r | |
69 | public int getMaximumCommandLength() {\r | |
70 | return Integer.MAX_VALUE;\r | |
71 | }\r | |
72 | \r | |
73 | public Linker getLinker(LinkType linkType) {\r | |
74 | return DevStudioLinker.getInstance().getLinker(linkType);\r | |
75 | }\r | |
76 | \r | |
77 | protected File[] getEnvironmentIncludePath() {\r | |
78 | return CUtil.getPathFromEnvironment("INCLUDE", ";");\r | |
79 | }\r | |
80 | \r | |
81 | protected String getIncludeDirSwitch(String includeDir) {\r | |
82 | return "/I" + includeDir.replace('/', '\\');\r | |
83 | }\r | |
84 | }\r |