]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Adjust code format and remove unused code.
authorwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 3 Aug 2006 04:34:39 +0000 (04:34 +0000)
committerwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 3 Aug 2006 04:34:39 +0000 (04:34 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1181 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java
Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineArgument.java
Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineCompiler.java
Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineDef.java
Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineMapping.java

index 682c9ac7022901c7b3d90f4848388133a9e077d1..00e3ac620a6330be0bfebf1ddef58db958a15cf7 100644 (file)
@@ -32,23 +32,25 @@ import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.DirectoryScanner;\r
 import org.apache.tools.ant.Project;\r
 \r
 import org.apache.tools.ant.DirectoryScanner;\r
 import org.apache.tools.ant.Project;\r
 \r
+/**\r
+ * \r
+ */\r
 public class CommandLineUserDefine {\r
 \r
     String includePathDelimiter = null;\r
 public class CommandLineUserDefine {\r
 \r
     String includePathDelimiter = null;\r
-    \r
+\r
     String outputDelimiter = null;\r
     String outputDelimiter = null;\r
-    \r
-    public void command(CCTask cctask, UserDefineDef userdefine){\r
+\r
+    public void command(CCTask cctask, UserDefineDef userdefine) {\r
         boolean isGccCommand = userdefine.getFamily().equalsIgnoreCase("GCC");\r
         File workdir;\r
         Project project = cctask.getProject();\r
         boolean isGccCommand = userdefine.getFamily().equalsIgnoreCase("GCC");\r
         File workdir;\r
         Project project = cctask.getProject();\r
-        if(userdefine.getWorkdir() == null) {\r
+        if (userdefine.getWorkdir() == null) {\r
             workdir = new File(".");\r
             workdir = new File(".");\r
-        }\r
-        else {\r
+        } else {\r
             workdir = userdefine.getWorkdir();\r
             workdir = userdefine.getWorkdir();\r
-        } \r
-        \r
+        }\r
+\r
         //\r
         // generate cmdline= command + args + includepath + endargs + outfile\r
         // \r
         //\r
         // generate cmdline= command + args + includepath + endargs + outfile\r
         // \r
@@ -57,15 +59,7 @@ public class CommandLineUserDefine {
         Vector endargs = new Vector();\r
         Vector endargsWithoutSpace = new Vector();\r
         Vector includePath = new Vector();\r
         Vector endargs = new Vector();\r
         Vector endargsWithoutSpace = new Vector();\r
         Vector includePath = new Vector();\r
-        \r
-        //\r
-        // Generate cmdline = command        + \r
-        //                    general args   + \r
-        //                    outputflag     + outputfile\r
-        //                    includpath            + \r
-        //                    endargs                          + \r
-        // \r
-        \r
+\r
         //\r
         // get Args.\r
         //\r
         //\r
         // get Args.\r
         //\r
@@ -77,168 +71,155 @@ public class CommandLineUserDefine {
                 endargs.addElement(argument[j].getValue());\r
             }\r
         }\r
                 endargs.addElement(argument[j].getValue());\r
             }\r
         }\r
-        \r
+\r
         //\r
         // get include path.\r
         //\r
         String[] incPath = userdefine.getActiveIncludePaths();\r
         for (int j = 0; j < incPath.length; j++) {\r
         //\r
         // get include path.\r
         //\r
         String[] incPath = userdefine.getActiveIncludePaths();\r
         for (int j = 0; j < incPath.length; j++) {\r
-            if(incPath[j].indexOf(' ') >= 0) {\r
-                includePath.addElement( includePathDelimiter + incPath[j]);\r
-                //includePath.addElement( includePathDelimiter + "\"" + incPath[j] + "\"");\r
-            }\r
-            else {\r
-                includePath.addElement( includePathDelimiter + incPath[j]);\r
-            }\r
+            includePath.addElement(includePathDelimiter + incPath[j]);\r
         }\r
         }\r
-        \r
+\r
         //\r
         // Remove space in args and endargs.\r
         //\r
         //\r
         // Remove space in args and endargs.\r
         //\r
-        for ( int i=0; i < args.size(); i++) {\r
-            String str = (String)args.get(i);\r
+        for (int i = 0; i < args.size(); i++) {\r
+            String str = (String) args.get(i);\r
             StringTokenizer st = new StringTokenizer(str, " \t");\r
             StringTokenizer st = new StringTokenizer(str, " \t");\r
-            while(st.hasMoreTokens()) {\r
+            while (st.hasMoreTokens()) {\r
                 argsWithoutSpace.addElement(st.nextToken());\r
             }\r
         }\r
                 argsWithoutSpace.addElement(st.nextToken());\r
             }\r
         }\r
-        for ( int i=0; i < endargs.size(); i++) {\r
-            String str = (String)endargs.get(i);\r
+        for (int i = 0; i < endargs.size(); i++) {\r
+            String str = (String) endargs.get(i);\r
             StringTokenizer st = new StringTokenizer(str, " \t");\r
             StringTokenizer st = new StringTokenizer(str, " \t");\r
-            while(st.hasMoreTokens()) {\r
+            while (st.hasMoreTokens()) {\r
                 endargsWithoutSpace.addElement(st.nextToken());\r
             }\r
         }\r
                 endargsWithoutSpace.addElement(st.nextToken());\r
             }\r
         }\r
-        \r
+\r
         int cmdLen = 0;\r
         //\r
         // command + args + endargs + includepath + sourcefile\r
         //\r
         int cmdLen = 0;\r
         //\r
         // command + args + endargs + includepath + sourcefile\r
         //\r
-        cmdLen = 1 + argsWithoutSpace.size() + endargsWithoutSpace.size() + includePath.size() + 1;\r
-        String[] libSet = userdefine.get_libset();\r
-        if (libSet != null && libSet.length > 0){\r
+        cmdLen = 1 + argsWithoutSpace.size() + endargsWithoutSpace.size()\r
+                        + includePath.size() + 1;\r
+        String[] libSet = userdefine.getLibset();\r
+        if (libSet != null && libSet.length > 0) {\r
             cmdLen = cmdLen + libSet.length;\r
             if (isGccCommand) {\r
             cmdLen = cmdLen + libSet.length;\r
             if (isGccCommand) {\r
-                cmdLen += 2;    // we need -( and -) to group libs for GCC\r
+                cmdLen += 2; // we need -( and -) to group libs for GCC\r
             }\r
         }\r
 \r
         //\r
             }\r
         }\r
 \r
         //\r
-        // In gcc the "cr" flag should follow space then add outputfile name, otherwise\r
-        // it will pop error. \r
+        // In gcc the "cr" flag should follow space then add outputfile name,\r
+        // otherwise\r
+        // it will pop error.\r
         // TBD\r
         // TBD\r
-        if (outputDelimiter != null && userdefine.getOutputFile() != null && outputDelimiter.trim().length() > 0){\r
-            if (outputDelimiter.trim().equalsIgnoreCase("-cr")){\r
+        if (outputDelimiter != null && userdefine.getOutputFile() != null\r
+                        && outputDelimiter.trim().length() > 0) {\r
+            if (outputDelimiter.trim().equalsIgnoreCase("-cr")) {\r
                 cmdLen = cmdLen + 2;\r
                 cmdLen = cmdLen + 2;\r
-            }else {\r
+            } else {\r
                 cmdLen++;\r
             }\r
         }\r
                 cmdLen++;\r
             }\r
         }\r
-        \r
+\r
         //\r
         //\r
-        //  for every source file\r
-        //  if file is header file, just skip it (add later)\r
+        // for every source file\r
+        // if file is header file, just skip it (add later)\r
         //\r
         Vector srcSets = userdefine.getSrcSets();\r
         //\r
         Vector srcSets = userdefine.getSrcSets();\r
-//        System.out.println("##" + userdefine.getSrcSets());\r
-        \r
+\r
         //\r
         //\r
-        // if have source file append source file in command land.\r
+        // if have source file append source file in command line.\r
         //\r
         Set allSrcFiles = new LinkedHashSet();\r
         for (int i = 0; i < srcSets.size(); i++) {\r
             ConditionalFileSet srcSet = (ConditionalFileSet) srcSets\r
         //\r
         Set allSrcFiles = new LinkedHashSet();\r
         for (int i = 0; i < srcSets.size(); i++) {\r
             ConditionalFileSet srcSet = (ConditionalFileSet) srcSets\r
-                    .elementAt(i);\r
+                            .elementAt(i);\r
             if (srcSet.isActive()) {\r
             if (srcSet.isActive()) {\r
+                //\r
                 // Find matching source files\r
                 // Find matching source files\r
+                //\r
                 DirectoryScanner scanner = srcSet.getDirectoryScanner(project);\r
                 DirectoryScanner scanner = srcSet.getDirectoryScanner(project);\r
+                \r
+                //\r
                 // Check each source file - see if it needs compilation\r
                 // Check each source file - see if it needs compilation\r
+                //\r
                 String[] fileNames = scanner.getIncludedFiles();\r
                 String[] fileNames = scanner.getIncludedFiles();\r
-                for (int j = 0; j < fileNames.length; j++){\r
-                    // execute the command\r
+                for (int j = 0; j < fileNames.length; j++) {\r
                     allSrcFiles.add(scanner.getBasedir() + "/" + fileNames[j]);\r
                     if (isGccCommand) {\r
                     allSrcFiles.add(scanner.getBasedir() + "/" + fileNames[j]);\r
                     if (isGccCommand) {\r
-                        System.out.println("[" + userdefine.getType() + "] " + fileNames[j]);\r
+                        System.out.println("[" + userdefine.getType() + "] "\r
+                                        + fileNames[j]);\r
                     }\r
                 }\r
             }\r
         }\r
 \r
                     }\r
                 }\r
             }\r
         }\r
 \r
-        String[] fileNames = (String[])allSrcFiles.toArray(new String[allSrcFiles.size()]);\r
+        String[] fileNames = (String[]) allSrcFiles\r
+                        .toArray(new String[allSrcFiles.size()]);\r
         String[] cmd = new String[cmdLen - 1 + fileNames.length];\r
         int index = 0;\r
         cmd[index++] = userdefine.getCmd();\r
         String[] cmd = new String[cmdLen - 1 + fileNames.length];\r
         int index = 0;\r
         cmd[index++] = userdefine.getCmd();\r
-        \r
+\r
         Iterator iter = argsWithoutSpace.iterator();\r
         while (iter.hasNext()) {\r
         Iterator iter = argsWithoutSpace.iterator();\r
         while (iter.hasNext()) {\r
-            cmd[index++] = project.replaceProperties((String)iter.next());\r
+            cmd[index++] = project.replaceProperties((String) iter.next());\r
         }\r
         }\r
-        \r
+\r
         iter = endargsWithoutSpace.iterator();\r
         while (iter.hasNext()) {\r
         iter = endargsWithoutSpace.iterator();\r
         while (iter.hasNext()) {\r
-            cmd[index++] = project.replaceProperties((String)iter.next());\r
+            cmd[index++] = project.replaceProperties((String) iter.next());\r
         }\r
         }\r
-        \r
+\r
         //\r
         // Add outputFileFlag and output file to cmd\r
         //\r
         //\r
         // Add outputFileFlag and output file to cmd\r
         //\r
-        if (outputDelimiter != null && userdefine.getOutputFile() != null && outputDelimiter.length()> 0){\r
-            if (outputDelimiter.trim().equalsIgnoreCase("-cr")){\r
+        if (outputDelimiter != null && userdefine.getOutputFile() != null\r
+                        && outputDelimiter.length() > 0) {\r
+            if (outputDelimiter.trim().equalsIgnoreCase("-cr")) {\r
                 cmd[index++] = outputDelimiter;\r
                 cmd[index++] = userdefine.getOutputFile();\r
                 cmd[index++] = outputDelimiter;\r
                 cmd[index++] = userdefine.getOutputFile();\r
-            }else {\r
-                cmd[index++] =  outputDelimiter + userdefine.getOutputFile();\r
+            } else {\r
+                cmd[index++] = outputDelimiter + userdefine.getOutputFile();\r
             }\r
         }\r
             }\r
         }\r
-        \r
+\r
         iter = includePath.iterator();\r
         while (iter.hasNext()) {\r
         iter = includePath.iterator();\r
         while (iter.hasNext()) {\r
-            cmd[index++] = (String)iter.next();\r
+            cmd[index++] = (String) iter.next();\r
         }\r
         }\r
-        \r
-        if (libSet != null && libSet.length > 0){\r
+\r
+        if (libSet != null && libSet.length > 0) {\r
             if (isGccCommand) {\r
                 cmd[index++] = "-(";\r
             }\r
             if (isGccCommand) {\r
                 cmd[index++] = "-(";\r
             }\r
-            for (int k = 0; k < libSet.length ; k++){\r
+            for (int k = 0; k < libSet.length; k++) {\r
                 cmd[index++] = libSet[k];\r
             }\r
             if (isGccCommand) {\r
                 cmd[index++] = "-)";\r
             }\r
         }\r
                 cmd[index++] = libSet[k];\r
             }\r
             if (isGccCommand) {\r
                 cmd[index++] = "-)";\r
             }\r
         }\r
-        for (int j = 0; j < fileNames.length; j++){\r
-            // execute the command\r
+        for (int j = 0; j < fileNames.length; j++) {\r
             cmd[index++] = fileNames[j];\r
         }\r
             cmd[index++] = fileNames[j];\r
         }\r
-        \r
+\r
         int retval = runCommand(cctask, workdir, cmd);\r
         int retval = runCommand(cctask, workdir, cmd);\r
-        // if with monitor, add more code\r
+        \r
         if (retval != 0) {\r
         if (retval != 0) {\r
-           throw new BuildException(userdefine.getCmd()\r
-                   + " failed with return code " + retval,\r
-                   cctask.getLocation());\r
+            throw new BuildException(userdefine.getCmd()\r
+                            + " failed with return code " + retval, cctask\r
+                            .getLocation());\r
         }\r
     }\r
         }\r
     }\r
-    \r
+\r
     protected int runCommand(CCTask task, File workingDir, String[] cmdline)\r
                     throws BuildException {\r
         return CUtil.runCommand(task, workingDir, cmdline, false, null);\r
 \r
     }\r
     protected int runCommand(CCTask task, File workingDir, String[] cmdline)\r
                     throws BuildException {\r
         return CUtil.runCommand(task, workingDir, cmdline, false, null);\r
 \r
     }\r
-\r
-    protected String getInputFileArgument(File outputDir, String filename,\r
-                    int index) {\r
-        //\r
-        // if there is an embedded space,\r
-        // must enclose in quotes\r
-        if (filename.indexOf(' ') >= 0) {\r
-            StringBuffer buf = new StringBuffer("\"");\r
-            buf.append(filename);\r
-            buf.append("\"");\r
-            return buf.toString();\r
-        }\r
-        return filename;\r
-    }\r
-\r
 }\r
 }\r
index 5d7c63f939ca65680afc86cc6fe1cebcffdf302b..96d274ad9a8697f825cbd3beab4e3fd0d1e8087b 100644 (file)
@@ -18,6 +18,10 @@ package net.sf.antcontrib.cpptasks.userdefine;
 \r
 import net.sf.antcontrib.cpptasks.types.CommandLineArgument;\r
 \r
 \r
 import net.sf.antcontrib.cpptasks.types.CommandLineArgument;\r
 \r
+/**\r
+ * Collect Arguments. \r
+ *\r
+ */\r
 public class UserDefineArgument extends CommandLineArgument {\r
     \r
     public UserDefineArgument() {\r
 public class UserDefineArgument extends CommandLineArgument {\r
     \r
     public UserDefineArgument() {\r
index 616e9cbbf5178f71c54dab4ce96408cac0a68728..47431e84a0128129208aa48b4b05e8a98a5208ab 100644 (file)
@@ -18,24 +18,28 @@ package net.sf.antcontrib.cpptasks.userdefine;
 \r
 import net.sf.antcontrib.cpptasks.CCTask;\r
 \r
 \r
 import net.sf.antcontrib.cpptasks.CCTask;\r
 \r
+/**\r
+ * Adapter for the User-Defined Compiler\r
+ */\r
 public class UserDefineCompiler extends CommandLineUserDefine {\r
 \r
 public class UserDefineCompiler extends CommandLineUserDefine {\r
 \r
-    public UserDefineCompiler(CCTask cctask, UserDefineDef userdefineDef) {\r
+    public UserDefineCompiler (CCTask cctask, UserDefineDef userdefineDef) {\r
         String cmdType = userdefineDef.getType();\r
         String toolchainFamily = userdefineDef.getFamily();\r
         String cmdType = userdefineDef.getType();\r
         String toolchainFamily = userdefineDef.getFamily();\r
-        UserDefineMapping mapping = new UserDefineMapping();\r
-        \r
-        if (userdefineDef.getIncludepathDelimiter() == null) {\r
-            includePathDelimiter = mapping.getIncludePathDelimiter(toolchainFamily, cmdType); \r
+\r
+        if (userdefineDef.getIncludePathDelimiter() == null) {\r
+            includePathDelimiter = UserDefineMapping.getIncludePathDelimiter(\r
+                            toolchainFamily, cmdType);\r
         } else {\r
         } else {\r
-            includePathDelimiter = userdefineDef.getIncludepathDelimiter();\r
+            includePathDelimiter = userdefineDef.getIncludePathDelimiter();\r
         }\r
         }\r
-        \r
+\r
         if (userdefineDef.getOutputDelimiter() == null) {\r
         if (userdefineDef.getOutputDelimiter() == null) {\r
-            outputDelimiter = mapping.getOutputFileFlag(toolchainFamily, cmdType);\r
+            outputDelimiter = UserDefineMapping.getOutputFileFlag(\r
+                            toolchainFamily, cmdType);\r
         } else {\r
             outputDelimiter = userdefineDef.getOutputDelimiter();\r
         }\r
         } else {\r
             outputDelimiter = userdefineDef.getOutputDelimiter();\r
         }\r
-        \r
+\r
     }\r
 }\r
     }\r
 }\r
index 6c03e73919840d1d6693bdef405ee62b74268d01..bf045d1e58f2a91ab73beb846efad1b30105a5a3 100644 (file)
@@ -32,28 +32,36 @@ import net.sf.antcontrib.cpptasks.types.ConditionalPath;
 import net.sf.antcontrib.cpptasks.types.IncludePath;\r
 import net.sf.antcontrib.cpptasks.types.LibrarySet;\r
 \r
 import net.sf.antcontrib.cpptasks.types.IncludePath;\r
 import net.sf.antcontrib.cpptasks.types.LibrarySet;\r
 \r
-public class UserDefineDef extends ProcessorDef{\r
-    \r
-    public UserDefineDef () {}\r
-    \r
+/**\r
+ * A userdefinedef definition. userdefine elements may be placed either as\r
+ * children of a cc element or the project element. A userdefine element with an\r
+ * id attribute may be referenced by userdefine elements with refid or extends\r
+ * attributes.\r
+ * \r
+ */\r
+public class UserDefineDef extends ProcessorDef {\r
+\r
+    public UserDefineDef () {\r
+    }\r
+\r
     private String type = "CC";\r
     private String type = "CC";\r
-    \r
+\r
     private String family = "MSFT";\r
     private String family = "MSFT";\r
-    \r
+\r
     private String cmd;\r
     private String cmd;\r
-    \r
-    private String includepathDelimiter;\r
-    \r
+\r
+    private String includePathDelimiter;\r
+\r
     private String outputDelimiter;\r
     private String outputDelimiter;\r
-    \r
+\r
     private File workdir;\r
     private File workdir;\r
-    \r
-    private Vector includePaths= new Vector();\r
-    \r
+\r
+    private Vector includePaths = new Vector();\r
+\r
     private String outputFile;\r
     private String outputFile;\r
-    \r
-    private Vector _libset = new Vector();\r
-    \r
+\r
+    private Vector allLibraries = new Vector();\r
+\r
     public void addLibset(LibrarySet libset) {\r
         if (isReference()) {\r
             throw noChildrenAllowed();\r
     public void addLibset(LibrarySet libset) {\r
         if (isReference()) {\r
             throw noChildrenAllowed();\r
@@ -61,31 +69,27 @@ public class UserDefineDef extends ProcessorDef{
         if (libset == null) {\r
             throw new NullPointerException("libset");\r
         }\r
         if (libset == null) {\r
             throw new NullPointerException("libset");\r
         }\r
-        \r
-        _libset.add(libset);\r
+\r
+        allLibraries.add(libset);\r
     }\r
     }\r
-    \r
+\r
     public void execute() throws org.apache.tools.ant.BuildException {\r
         throw new org.apache.tools.ant.BuildException(\r
                         "Not an actual task, but looks like one for documentation purposes");\r
     }\r
 \r
     public void execute() throws org.apache.tools.ant.BuildException {\r
         throw new org.apache.tools.ant.BuildException(\r
                         "Not an actual task, but looks like one for documentation purposes");\r
     }\r
 \r
-\r
     public void addConfiguredArgument(UserDefineArgument arg) {\r
         if (isReference()) {\r
             throw noChildrenAllowed();\r
         }\r
         addConfiguredProcessorArg(arg);\r
     }\r
     public void addConfiguredArgument(UserDefineArgument arg) {\r
         if (isReference()) {\r
             throw noChildrenAllowed();\r
         }\r
         addConfiguredProcessorArg(arg);\r
     }\r
-    \r
+\r
     /**\r
      * Creates an include path.\r
      */\r
     public IncludePath createIncludePath() {\r
         Project p = getProject();\r
     /**\r
      * Creates an include path.\r
      */\r
     public IncludePath createIncludePath() {\r
         Project p = getProject();\r
-        if (p == null) {\r
-            throw new java.lang.IllegalStateException("project must be set");\r
-        }\r
         if (isReference()) {\r
             throw noChildrenAllowed();\r
         }\r
         if (isReference()) {\r
             throw noChildrenAllowed();\r
         }\r
@@ -93,11 +97,14 @@ public class UserDefineDef extends ProcessorDef{
         includePaths.addElement(path);\r
         return path;\r
     }\r
         includePaths.addElement(path);\r
         return path;\r
     }\r
-    \r
-    \r
+\r
     /**\r
      * Add a <includepath> if specify the file attribute\r
      * \r
     /**\r
      * Add a <includepath> if specify the file attribute\r
      * \r
+     * @param activePath\r
+     *            Active Path Vector\r
+     * @param file\r
+     *            File with multiple path\r
      * @throws BuildException\r
      *             if the specify file not exist\r
      */\r
      * @throws BuildException\r
      *             if the specify file not exist\r
      */\r
@@ -112,7 +119,7 @@ public class UserDefineDef extends ProcessorDef{
             fileReader = new FileReader(file);\r
             in = new BufferedReader(fileReader);\r
             while ((str = in.readLine()) != null) {\r
             fileReader = new FileReader(file);\r
             in = new BufferedReader(fileReader);\r
             while ((str = in.readLine()) != null) {\r
-                if (str.trim() == "") {\r
+                if (str.trim().endsWith("")) {\r
                     continue;\r
                 }\r
                 str = getProject().replaceProperties(str);\r
                     continue;\r
                 }\r
                 str = getProject().replaceProperties(str);\r
@@ -122,9 +129,11 @@ public class UserDefineDef extends ProcessorDef{
             throw new BuildException(e.getMessage());\r
         }\r
     }\r
             throw new BuildException(e.getMessage());\r
         }\r
     }\r
-    \r
+\r
     /**\r
      * Returns the specific include path.\r
     /**\r
      * Returns the specific include path.\r
+     * \r
+     * @return All active include paths\r
      */\r
     public String[] getActiveIncludePaths() {\r
         if (isReference()) {\r
      */\r
     public String[] getActiveIncludePaths() {\r
         if (isReference()) {\r
@@ -133,14 +142,12 @@ public class UserDefineDef extends ProcessorDef{
         }\r
         return getActivePaths(includePaths);\r
     }\r
         }\r
         return getActivePaths(includePaths);\r
     }\r
-    \r
+\r
     private String[] getActivePaths(Vector paths) {\r
         Project p = getProject();\r
     private String[] getActivePaths(Vector paths) {\r
         Project p = getProject();\r
-        if (p == null) {\r
-            throw new java.lang.IllegalStateException("project not set");\r
-        }\r
         Vector activePaths = new Vector(paths.size());\r
         Vector activePaths = new Vector(paths.size());\r
-        for (int i = 0; i < paths.size(); i++) {\r
+        int length = paths.size();\r
+        for (int i = 0; i < length; i++) {\r
             ConditionalPath path = (ConditionalPath) paths.elementAt(i);\r
             if (path.isActive(p)) {\r
                 if (path.getFile() == null) {\r
             ConditionalPath path = (ConditionalPath) paths.elementAt(i);\r
             if (path.isActive(p)) {\r
                 if (path.getFile() == null) {\r
@@ -157,22 +164,38 @@ public class UserDefineDef extends ProcessorDef{
         activePaths.copyInto(pathNames);\r
         return pathNames;\r
     }\r
         activePaths.copyInto(pathNames);\r
         return pathNames;\r
     }\r
-    \r
-    public String getIncludepathDelimiter() {\r
+\r
+    /**\r
+     * Get include path delimiter.\r
+     * \r
+     * @return Include Path Delimiter\r
+     */\r
+    public String getIncludePathDelimiter() {\r
         if (isReference()) {\r
             return ((UserDefineDef) getCheckedRef(UserDefineDef.class,\r
         if (isReference()) {\r
             return ((UserDefineDef) getCheckedRef(UserDefineDef.class,\r
-                            "UserDefineDef")).getIncludepathDelimiter();\r
+                            "UserDefineDef")).getIncludePathDelimiter();\r
         }\r
         }\r
-        return includepathDelimiter;\r
+        return includePathDelimiter;\r
     }\r
 \r
     }\r
 \r
-    public void setIncludepathDelimiter(String includepathDelimiter) {\r
+    /**\r
+     * Set include path delimiter.\r
+     * \r
+     * @param includePathDelimiter\r
+     *            include path delimiter\r
+     */\r
+    public void setIncludePathDelimiter(String includePathDelimiter) {\r
         if (isReference()) {\r
             throw tooManyAttributes();\r
         }\r
         if (isReference()) {\r
             throw tooManyAttributes();\r
         }\r
-        this.includepathDelimiter = includepathDelimiter;\r
+        this.includePathDelimiter = includePathDelimiter;\r
     }\r
 \r
     }\r
 \r
+    /**\r
+     * Get type.\r
+     * \r
+     * @return type\r
+     */\r
     public String getType() {\r
         if (isReference()) {\r
             return ((UserDefineDef) getCheckedRef(UserDefineDef.class,\r
     public String getType() {\r
         if (isReference()) {\r
             return ((UserDefineDef) getCheckedRef(UserDefineDef.class,\r
@@ -181,6 +204,12 @@ public class UserDefineDef extends ProcessorDef{
         return type;\r
     }\r
 \r
         return type;\r
     }\r
 \r
+    /**\r
+     * Set type.\r
+     * \r
+     * @param type\r
+     *            Type\r
+     */\r
     public void setType(String type) {\r
         if (isReference()) {\r
             throw tooManyAttributes();\r
     public void setType(String type) {\r
         if (isReference()) {\r
             throw tooManyAttributes();\r
@@ -232,29 +261,28 @@ public class UserDefineDef extends ProcessorDef{
         this.workdir = workdir;\r
     }\r
 \r
         this.workdir = workdir;\r
     }\r
 \r
-    public String[] get_libset() {\r
+    public String[] getLibset() {\r
         Set libs = new LinkedHashSet();\r
         Set libs = new LinkedHashSet();\r
-        Iterator iter = _libset.iterator();\r
+        Iterator iter = allLibraries.iterator();\r
         while (iter.hasNext()) {\r
         while (iter.hasNext()) {\r
-            LibrarySet librarySet = (LibrarySet)iter.next();\r
+            LibrarySet librarySet = (LibrarySet) iter.next();\r
             File basedir = librarySet.getDir(getProject());\r
             String[] libStrArray = librarySet.getLibs();\r
             File basedir = librarySet.getDir(getProject());\r
             String[] libStrArray = librarySet.getLibs();\r
-            for (int i = 0 ; i < libStrArray.length; i ++) {\r
+            for (int i = 0; i < libStrArray.length; i++) {\r
                 if (basedir != null) {\r
                     File libFile = new File(libStrArray[i]);\r
                     if (libFile.isAbsolute()) {\r
                         libs.add(libFile.getPath());\r
                 if (basedir != null) {\r
                     File libFile = new File(libStrArray[i]);\r
                     if (libFile.isAbsolute()) {\r
                         libs.add(libFile.getPath());\r
+                    } else {\r
+                        libs.add(basedir.getPath() + File.separatorChar\r
+                                        + libFile.getPath());\r
                     }\r
                     }\r
-                    else {\r
-                        libs.add(basedir.getPath() + File.separatorChar + libFile.getPath());\r
-                    }\r
-                }\r
-                else {\r
+                } else {\r
                     libs.add(libStrArray[i]);\r
                 }\r
             }\r
         }\r
                     libs.add(libStrArray[i]);\r
                 }\r
             }\r
         }\r
-        return (String[])libs.toArray(new String[libs.size()]);\r
+        return (String[]) libs.toArray(new String[libs.size()]);\r
     }\r
 \r
     public String getOutputDelimiter() {\r
     }\r
 \r
     public String getOutputDelimiter() {\r
index 282bf689d16609fda65b7097b2d865a3d69af567..491cadd7f52393f97527ca10bbb12583e0c4cb72 100644 (file)
  *  limitations under the License.\r
  */\r
 package net.sf.antcontrib.cpptasks.userdefine;\r
  *  limitations under the License.\r
  */\r
 package net.sf.antcontrib.cpptasks.userdefine;\r
-public class UserDefineMapping {\r
-\r
-\r
-    // list of Vendor: Microsoft, Intel, Gcc\r
-    public final String[] families = { "MSFT", "INTEL", "GCC"};\r
 \r
 \r
-    // list of Command Type: CC, SLINK, DLINK, ASL, ASM, ASMLINK, PP\r
-    public final String[] commandType = { "CC", "SLINK", "DLINK", "ASL",\r
-            "ASM", "ASMLINK", "PP" };\r
+/**\r
+ * Relationship between {family, command type} and flags\r
+ * \r
+ */\r
+public class UserDefineMapping {\r
 \r
 \r
-    public final String[][] includePathFlag = { { "MSFT_CC", "/I" },\r
-            { "GCC_CC", "-I" }, { "INTEL_CC", "/I" }, { "WINDDK_CC", "/I" },\r
-            { "MSFT_ASM", "/I" }, { "GCC_ASM", "-I" }, { "WINDDK_CC", "/I" },\r
-            { "MSFT_PP", "/I" }, { "GCC_PP", "-I" }, { "WINDDK_PP", "/I" } };\r
+    /**\r
+     * Mapping info: include path delimiter <--> family (vendor) + command type\r
+     */\r
+    public static final String[][] includePathFlag = { { "MSFT_CC", "/I" },\r
+                    { "GCC_CC", "-I" }, { "INTEL_CC", "/I" },\r
+                    { "WINDDK_CC", "/I" }, { "MSFT_ASM", "/I" },\r
+                    { "GCC_ASM", "-I" }, { "WINDDK_CC", "/I" },\r
+                    { "MSFT_PP", "/I" }, { "GCC_PP", "-I" },\r
+                    { "WINDDK_PP", "/I" } };\r
 \r
 \r
-    public final String[][] outputFileFlag = { { "MSFT_CC", "/Fo" },\r
-            { "GCC_CC", "-o" }, { "INTEL_CC", "/Fo" }, { "WINDDK_CC", "/Fo" },\r
-            { "MSFT_SLINK", "/OUT:" }, { "GCC_SLINK", "-cr" },\r
-            { "INTEL_SLINK", "/OUT:" }, { "WINDDK_SLINK", "/OUT:" },\r
-            { "MSFT_DLINK", "/OUT:" }, { "GCC_DLINK", "-o" },\r
-            { "INTEL_DLINK", "/OUT:" }, { "WINDDK_DLINK", "/OUT:" },\r
-            { "MSFT_ASM", "/Fo" }, { "GCC_ASM", "-o" },\r
-            { "WINDDK_ASM", "/Fo" },{"WINDDK_IPF_ASM", "-o"} };\r
+    /**\r
+     * Mapping info: output file flag <--> family (vendor) + command type\r
+     */\r
+    public static final String[][] outputFileFlag = { { "MSFT_CC", "/Fo" },\r
+                    { "GCC_CC", "-o" }, { "INTEL_CC", "/Fo" },\r
+                    { "WINDDK_CC", "/Fo" }, { "MSFT_SLINK", "/OUT:" },\r
+                    { "GCC_SLINK", "-cr" }, { "INTEL_SLINK", "/OUT:" },\r
+                    { "WINDDK_SLINK", "/OUT:" }, { "MSFT_DLINK", "/OUT:" },\r
+                    { "GCC_DLINK", "-o" }, { "INTEL_DLINK", "/OUT:" },\r
+                    { "WINDDK_DLINK", "/OUT:" }, { "MSFT_ASM", "/Fo" },\r
+                    { "GCC_ASM", "-o" }, { "WINDDK_ASM", "/Fo" },\r
+                    { "WINDDK_IPF_ASM", "-o" } };\r
 \r
 \r
-    public String getIncludePathDelimiter(String vendor,\r
-            String commandType) {\r
+    /**\r
+     * Get include delimiter with vendow and command type.\r
+     * \r
+     * @param vendor\r
+     *            Vendor\r
+     * @param commandType\r
+     *            Command Type\r
+     * @return include path delimiter\r
+     */\r
+    public static String getIncludePathDelimiter(String vendor,\r
+                    String commandType) {\r
         String key = vendor + "_" + commandType;\r
         for (int i = 0; i < includePathFlag.length; i++) {\r
             if (includePathFlag[i][0].equalsIgnoreCase(key)) {\r
         String key = vendor + "_" + commandType;\r
         for (int i = 0; i < includePathFlag.length; i++) {\r
             if (includePathFlag[i][0].equalsIgnoreCase(key)) {\r
@@ -50,7 +65,16 @@ public class UserDefineMapping {
         return "/I";\r
     }\r
 \r
         return "/I";\r
     }\r
 \r
-    public String getOutputFileFlag(String vendor, String commandType) {\r
+    /**\r
+     * Get Output Flag with vendor and command type.\r
+     * \r
+     * @param vendor\r
+     *            Vendor\r
+     * @param commandType\r
+     *            Command Type\r
+     * @return Output File Flag\r
+     */\r
+    public static String getOutputFileFlag(String vendor, String commandType) {\r
         String key = vendor + "_" + commandType;\r
         for (int i = 0; i < outputFileFlag.length; i++) {\r
             if (outputFileFlag[i][0].equalsIgnoreCase(key)) {\r
         String key = vendor + "_" + commandType;\r
         for (int i = 0; i < outputFileFlag.length; i++) {\r
             if (outputFileFlag[i][0].equalsIgnoreCase(key)) {\r