net.sf.antcontrib.cpptasks.mozilla
Class XpidlCompiler

java.lang.Object
  extended by net.sf.antcontrib.cpptasks.compiler.AbstractProcessor
      extended by net.sf.antcontrib.cpptasks.compiler.AbstractCompiler
          extended by net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler
              extended by net.sf.antcontrib.cpptasks.mozilla.XpidlCompiler
All Implemented Interfaces:
java.lang.Cloneable, Compiler, Processor

public final class XpidlCompiler
extends CommandLineCompiler

Adapter for the Mozilla Xpidl Compiler.

Author:
Curt Arnold

Field Summary
 
Fields inherited from class net.sf.antcontrib.cpptasks.compiler.AbstractProcessor
DEFAULT_DISCARD_BID, DEFAULT_PROCESS_BID
 
Method Summary
protected  void addImpliedArgs(java.util.Vector args, boolean debug, boolean multithreaded, boolean exceptions, LinkType linkType, java.lang.Boolean rtti, OptimizationEnum optimization)
          Add arguments for debug, etc.
protected  void addIncludes(java.lang.String baseDirPath, java.io.File[] includeDirs, java.util.Vector args, java.util.Vector relativeArgs, java.lang.StringBuffer includePathId)
          Adds command line arguments for include paths.
protected  void addWarningSwitch(java.util.Vector args, int level)
          Add arguments for specified warning level.
 Processor changeEnvironment(boolean newEnvironment, org.apache.tools.ant.types.Environment env)
          Change enviroment (deprecated).
 void compile(CCTask task, java.io.File outputDir, java.lang.String[] sourceFiles, java.lang.String[] args, java.lang.String[] endArgs, boolean relentless, CommandLineCompilerConfiguration config, ProgressMonitor monitor)
          Compiles an .idl file into the corresponding .h and .xpt files.
protected  Parser createParser(java.io.File source)
          Gets dependency parser.
protected  int getArgumentCountPerInputFile()
          Gets number of command line arguments per input file.
protected  void getDefineSwitch(java.lang.StringBuffer buffer, java.lang.String define, java.lang.String value)
          Gets switch to define preprocessor macro.
protected  java.io.File[] getEnvironmentIncludePath()
          Gets standard include paths.
 java.lang.String getIdentifier()
          Gets compiler identifier.
protected  java.lang.String getIncludeDirSwitch(java.lang.String includeDir)
          Gets include directory switch.
protected  java.lang.String getInputFileArgument(java.io.File outputDir, java.lang.String filename, int index)
          Gets input file arguments.
static XpidlCompiler getInstance()
          Gets singleton instance of compiler.
 Linker getLinker(LinkType type)
          Gets linker associated with this type.
 int getMaximumCommandLength()
          Gets maximum length of command line.
protected  int getMaximumInputFilesPerCommand()
          Gets maximum number of input files processed per command.
 java.lang.String[] getOutputFileNames(java.lang.String inputFile, VersionInfo versionInfo)
          Gets output file names.
protected  int getTotalArgumentLengthForInputFile(java.io.File outputDir, java.lang.String inputFile)
          Get total command line length due to the input file.
protected  void getUndefineSwitch(java.lang.StringBuffer buffer, java.lang.String define)
          Gets switch to undefine preprocessor macro.
 
Methods inherited from class net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler
buildDefineArguments, createConfiguration, getCommand, getLibtool, getLibtoolCompiler, runCommand, setCommand
 
Methods inherited from class net.sf.antcontrib.cpptasks.compiler.AbstractCompiler
canParse, createConfiguration, getBaseOutputName, parseIncludes, resolveInclude
 
Methods inherited from class net.sf.antcontrib.cpptasks.compiler.AbstractProcessor
bid, clone, getHeaderExtensions, getIdentifier, getOSArch, getOSName, getSourceExtensions, isDarwin, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.antcontrib.cpptasks.compiler.Processor
bid
 

Method Detail

getInstance

public static XpidlCompiler getInstance()
Gets singleton instance of compiler.

Returns:
XpidlCompiler singleton instance

addImpliedArgs

protected void addImpliedArgs(java.util.Vector args,
                              boolean debug,
                              boolean multithreaded,
                              boolean exceptions,
                              LinkType linkType,
                              java.lang.Boolean rtti,
                              OptimizationEnum optimization)
Add arguments for debug, etc.

Specified by:
addImpliedArgs in class CommandLineCompiler
Parameters:
args - Vector command argument list
debug - boolean build for debug if true
multithreaded - boolean build for multithreading if true
exceptions - boolean enable exceptions if true
linkType - LinkType output and runtime type
rtti - Boolean enable run-time type identification if true
optimization - OptimizationEnum optimization

addWarningSwitch

protected void addWarningSwitch(java.util.Vector args,
                                int level)
Add arguments for specified warning level.

Specified by:
addWarningSwitch in class CommandLineCompiler
Parameters:
args - Vector command line arguments
level - int warning level value

changeEnvironment

public Processor changeEnvironment(boolean newEnvironment,
                                   org.apache.tools.ant.types.Environment env)
Change enviroment (deprecated).

Specified by:
changeEnvironment in interface Processor
Overrides:
changeEnvironment in class AbstractProcessor
Parameters:
newEnvironment - boolean use new environment.
env - Environment environment
Returns:
Processor modified processor

createParser

protected Parser createParser(java.io.File source)
Gets dependency parser.

Specified by:
createParser in class AbstractCompiler
Parameters:
source - source file
Returns:
parser

getArgumentCountPerInputFile

protected int getArgumentCountPerInputFile()
Gets number of command line arguments per input file.

Overrides:
getArgumentCountPerInputFile in class CommandLineCompiler
Returns:
int number of command line arguments per input file.

getOutputFileNames

public java.lang.String[] getOutputFileNames(java.lang.String inputFile,
                                             VersionInfo versionInfo)
Gets output file names.

Specified by:
getOutputFileNames in interface Processor
Overrides:
getOutputFileNames in class AbstractCompiler
Parameters:
inputFile - String input file name
versionInfo - version info, not used by this compiler.
Returns:
String[] output file names

getInputFileArgument

protected java.lang.String getInputFileArgument(java.io.File outputDir,
                                                java.lang.String filename,
                                                int index)
Gets input file arguments.

Overrides:
getInputFileArgument in class CommandLineCompiler
Parameters:
outputDir - File output directory
filename - String input file name.
index - int argument index, 0 to getNumberOfArgumentsPerInputFile() -1
Returns:
String input file argument

getMaximumCommandLength

public int getMaximumCommandLength()
Gets maximum length of command line.

Specified by:
getMaximumCommandLength in class CommandLineCompiler
Returns:
int maximum length of command line

getMaximumInputFilesPerCommand

protected int getMaximumInputFilesPerCommand()
Gets maximum number of input files processed per command.

Overrides:
getMaximumInputFilesPerCommand in class CommandLineCompiler
Returns:
int maximum number of input files processed per command.

addIncludes

protected void addIncludes(java.lang.String baseDirPath,
                           java.io.File[] includeDirs,
                           java.util.Vector args,
                           java.util.Vector relativeArgs,
                           java.lang.StringBuffer includePathId)
Adds command line arguments for include paths.

Overrides:
addIncludes in class CommandLineCompiler
Parameters:
baseDirPath - String base directory
includeDirs - File[] include directories
args - Vector command line arguments
relativeArgs - Vector arguments for configuration identification
includePathId - StringBuffer buffer for configuration identification

getIncludeDirSwitch

protected java.lang.String getIncludeDirSwitch(java.lang.String includeDir)
Gets include directory switch.

Specified by:
getIncludeDirSwitch in class CommandLineCompiler
Parameters:
includeDir - String include directory
Returns:
String command switch to add specified directory to search path

getDefineSwitch

protected void getDefineSwitch(java.lang.StringBuffer buffer,
                               java.lang.String define,
                               java.lang.String value)
Gets switch to define preprocessor macro.

Specified by:
getDefineSwitch in class CommandLineCompiler
Parameters:
buffer - StringBuffer command line argument
define - String macro name
value - String macro value, may be null.

getUndefineSwitch

protected void getUndefineSwitch(java.lang.StringBuffer buffer,
                                 java.lang.String define)
Gets switch to undefine preprocessor macro.

Specified by:
getUndefineSwitch in class CommandLineCompiler
Parameters:
buffer - StringBuffer command line argument
define - String macro name

getEnvironmentIncludePath

protected java.io.File[] getEnvironmentIncludePath()
Gets standard include paths.

Specified by:
getEnvironmentIncludePath in class CommandLineCompiler
Returns:
File[] standard include paths

getLinker

public Linker getLinker(LinkType type)
Gets linker associated with this type.

Parameters:
type - LinkType linker, returns ld.
Returns:
Linker

compile

public void compile(CCTask task,
                    java.io.File outputDir,
                    java.lang.String[] sourceFiles,
                    java.lang.String[] args,
                    java.lang.String[] endArgs,
                    boolean relentless,
                    CommandLineCompilerConfiguration config,
                    ProgressMonitor monitor)
Compiles an .idl file into the corresponding .h and .xpt files.

Overrides:
compile in class CommandLineCompiler
Parameters:
task - current cc task
outputDir - output directory
sourceFiles - source files
args - command line arguments that appear before input files
endArgs - command line arguments that appear after input files
relentless - if true, do not stop at first compilation error
config - compiler configuration
monitor - progress monitor

getTotalArgumentLengthForInputFile

protected int getTotalArgumentLengthForInputFile(java.io.File outputDir,
                                                 java.lang.String inputFile)
Get total command line length due to the input file.

Overrides:
getTotalArgumentLengthForInputFile in class CommandLineCompiler
Parameters:
outputDir - File output directory
inputFile - String input file
Returns:
int characters added to command line for the input file.

getIdentifier

public java.lang.String getIdentifier()
Gets compiler identifier.

Specified by:
getIdentifier in interface Processor
Overrides:
getIdentifier in class CommandLineCompiler
Returns:
String compiler identification string


Copyright © 2001-2008 Ant-Contrib Project. All Rights Reserved.