cscm.CmdArgument¶
-
class
cscm.CmdArgument¶ -
Bases:
objectEncapsulates a command argument object generated by a compiler model.
Command argument objects have one of the following classes.
CmdArgumentStringCmdArgumentFileCmdArgumentConfCmdArgumentGTHomeFileCmdArgumentEnvVarPrefixCmdArgumentWarningFileCmdArgumentVector
A frontend process could be any executable. For example, the frontend process for C and C++ analyses is cprocess and the frontend process for Java analyses is java. The order in which the front end process accepts arguments is arbitrary, and the frontend executable may not be started on the same machine that runs the native compiler and compiler model. When the frontend process is called in parser_main, it will fill in the blanks left in the encapsulated command argument object.
For example, for:
CmdArgumentEnvVarPrefix("JAVA_HOME", "bin/java" )
the JAVA_HOME environment variable is evaluated on the machine that runs the frontend and used to construct the path to java.
Methods
__init__()Initialize a CmdArgument containing a command argument object. get_cmd_type()Get the type of the command argument object stored in self. value()Get the value stored in self. -
__init__(s)¶ -
Initialize a CmdArgument containing a command argument object.
Parameters: arg (str | CmdArgumentConf|CmdArgumentEnvVarPrefix|CmdArgumentFile|CmdArgumentGTHomeFile|CmdArgumentHubParams|CmdArgumentPrjFilesDirectory|CmdArgumentString|CmdArgumentTagUID|CmdArgumentVector|CmdArgumentUID|CmdArgumentWarningFile) – The value to initialize from. If arg is a str the new CmdArgument object will contain a newCmdArgumentStringwhich in turn contains arg. In all other cases,the new CmdArgument object will contain arg.
-
get_cmd_type()¶ -
Get the type of the command argument object stored in self.
Return type: command argument type value
-
value()¶ -
Get the value stored in a
CmdArgumentobject.Return type: str | (str,str) | NoneType|CmdArgumentConf|CmdArgumentVector|CmdArgumentWarningFileReturns: Return values depends on the type of information stored as shown in the following table. Note that in several cases the class of the stored command argument type object provides all necessary information. In these cases None is returned: use get_cmd_type()to identify the command argument type.self.get_cmd_type() value() return type value() return value CMD_CONF_FILECmdArgumentConfThe stored CmdArgumentConfobject.CMD_ENV_PREFIX(str,str) A pair (pref,suff), where pref is the name of the environment variable used as the path prefix and suff is the remainder of the path. CMD_FILEstr The stored file contents. CMD_GTHOME_PREFIXstr The path suffix: the part of the path that follows the path to the CodeSonar installation. CMD_HUB_PARAMSNoneTypeNone CMD_NULLNoneTypeNone CMD_PRJ_DIRNoneTypeNone CMD_STRINGstr The stored string. CMD_TAG_UIDNoneTypeNone CMD_UIDNoneTypeNone CMD_VECTORCmdArgumentVectorThe stored CmdArgumentVectorobject.CMD_WARNING_FILECmdArgumentWarningFileThe stored CmdArgumentWarningFileobject.