Package ghidra.pcode.exec

# Interface PcodeUseropLibrary<T>

Type Parameters:
  `T` - the type of values accepted by the p-code userops.

All Known Implementing Classes:
  `AdaptedEmulator.AdaptedPcodeUseropLibrary`, `AnnotatedPcodeUseropLibrary`, `ComposedPcodeUseropLibrary`, `DefaultPcodeThread.PcodeEmulationLibrary`, `PcodeExpression.ValueCapturingPcodeUseropLibrary`, `PcodeUseropLibrary.EmptyPcodeUseropLibrary`

public interface PcodeUseropLibrary<T>
A "library" of p-code userops available to a p-code executor

The library can provide definitions of p-code userops already declared by the executor's language as well as completely new userops accessible to Sleigh/p-code later compiled for the executor. The recommended way to implement a library is to extend `AnnotatedPcodeUseropLibrary`.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static final class`
  `PcodeUseropLibrary.EmptyPcodeUseropLibrary`
  The class of the empty userop library.
  `static interface`
  `PcodeUseropLibrary.PcodeUseropDefinition<T>`
  The definition of a p-code userop.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final PcodeUseropLibrary<?>`
  `NIL`
  The empty userop library.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default PcodeUseropLibrary<T>`
  `compose(PcodeUseropLibrary<T> lib)`
  Compose this and the given library into a new library.
  `static Type`
  `getOperandType(Class<?> cls)`
  Get the type `T` for the given class
  `default Map<Integer,ghidra.pcodeCPort.slghsymbol.UserOpSymbol>`
  `getSymbols(SleighLanguage language)`
  Get named symbols defined by this library that are not already declared in the language
  `Map<String,PcodeUseropLibrary.PcodeUseropDefinition<T>>`
  `getUserops()`
  Get all the userops defined in this library, keyed by (symbol) name.
  `static <T> PcodeUseropLibrary<T>`
  `nil()`
  The empty userop library, cast to match parameter types.

- ## Field Details

  - ### NIL

    static final PcodeUseropLibrary<?> NIL
    The empty userop library.

    Executors cannot accept `null` libraries. Instead, give it this empty library. To satisfy Java's type checker, you may use `nil()` instead.

- ## Method Details

  - ### getOperandType

    static Type getOperandType(Class<?> cls)
    Get the type `T` for the given class

    If the class does not implement `PcodeUseropLibrary`, this returns null. If it does, but no arguments are given (i.e., it implements the raw type), this return `Object`.

    Parameters:
      `cls` - the class
    Returns:
      the type, or null

  - ### nil

    static <T> PcodeUseropLibrary<T> nil()
    The empty userop library, cast to match parameter types.
    Type Parameters:
      `T` - the type required by the executor
    Returns:
      the empty userop library

  - ### getUserops

    Map<String,PcodeUseropLibrary.PcodeUseropDefinition<T>> getUserops()
    Get all the userops defined in this library, keyed by (symbol) name.
    Returns:
      the map of names to defined userops

  - ### compose

    default PcodeUseropLibrary<T> compose(PcodeUseropLibrary<T> lib)
    Compose this and the given library into a new library.
    Parameters:
      `lib` - the other library
    Returns:
      a new library having all userops defined between the two

  - ### getSymbols

    default Map<Integer,ghidra.pcodeCPort.slghsymbol.UserOpSymbol> getSymbols(SleighLanguage language)
    Get named symbols defined by this library that are not already declared in the language
    Parameters:
      `language` - the language whose existing symbols to consider
    Returns:
      a map of new userop indices to extra userop symbols