Class DefineTable

java.lang.Object
ghidra.app.util.cparser.CPP.DefineTable

public class DefineTable extends Object
  • Constructor Details

    • DefineTable

      public DefineTable()
  • Method Details

    • get

      public ghidra.app.util.cparser.CPP.PreProcessor.PPToken get(String string)
      Parameters:
      string -
      Returns:
    • getArgs

      public Vector<ghidra.app.util.cparser.CPP.PreProcessor.PPToken> getArgs(String currKey)
      Parameters:
      currKey -
      Returns:
    • getDefineAt

      public String getDefineAt(StringBuffer buf, int pos)
      Parameters:
      buf - the buffer containing the define
      pos - the position of the define
      Returns:
      the define
    • put

      public void put(String string, ghidra.app.util.cparser.CPP.PreProcessor.PPToken val)
      Associate a define "name" with a Preprocessor parser token match.
      Parameters:
      string - - name of define
      val - - token value from parsing
    • putArg

      public void putArg(String string, Vector<ghidra.app.util.cparser.CPP.PreProcessor.PPToken> val)
      Add an args definition for a define with arguments #define bubba(a,b) (a or b)
      Parameters:
      string - name of define
      val - set of arg token names
    • containsKey

      public boolean containsKey(String def)
      See if the define table contains a definition
      Parameters:
      def -
      Returns:
    • size

      public int size()
      Size of the define table.
      Returns:
    • remove

      public ghidra.app.util.cparser.CPP.PreProcessor.PPToken remove(String string)
      Remove a definition from the known defines.
      Parameters:
      string - name of define
      Returns:
      return the defined token for the named define.
    • isArg

      public boolean isArg(String string)
      Check if a define has args.
      Parameters:
      string - name of define
      Returns:
    • removeArg

      public Vector<ghidra.app.util.cparser.CPP.PreProcessor.PPToken> removeArg(String string)
      Get rid of args for a define
      Parameters:
      string - name of define
      Returns:
    • toString

      public String toString(String string)
      display a string for the named define.
      Parameters:
      string - named define
      Returns:
    • getDefineNames

      public Iterator<String> getDefineNames()
      Returns:
      an iterator over the defined string names
    • getValue

      public String getValue(String defName)
    • isNumeric

      public boolean isNumeric(String defName)
      Check if the token that defined this define was numeric
      Parameters:
      defName -
      Returns:
    • getDefinitionPath

      public String getDefinitionPath(String defName)
    • getParams

      public String getParams(StringBuffer buf, int start, char endChar)
      Parameters:
      buf - the buffer containing the parameters
      start - the starting index of the parameters in the buffer
      endChar - the delimiter for the parameters
      Returns:
      the parameters
    • expand

      public String expand(String image, boolean join)
      do the final expansion of "##" concats in the define strings that protect normal macro substitution.
      Parameters:
      image -
      join -
      Returns:
    • expand

      public String expand(String image, boolean join, ArrayList<String> list)
      do the final expansion of "##" concats in the define strings that protect normal macro substitution.
      Parameters:
      image -
      join -
      list - of defines not to re-replace, stops recursive replacement on a define
      Returns:
    • populateDefineEquates

      public void populateDefineEquates(DataTypeManager[] openDTMgrs, DataTypeManager dtMgr)
      Given a data type manager, populate defines with constant values as Enums
    • populateDefineEquate

      public void populateDefineEquate(DataTypeManager[] openDTMgrs, DataTypeManager dtMgr, String category, String prefix, String defName, long value)
    • expandDefine

      public String expandDefine(String defName)
    • getCValue

      public static Long getCValue(String strValue)
      Parse a C format integer value
      Parameters:
      strValue - value to parse
      Returns:
      long value if parsable as an integer, null otherwise