Skip to content

Process user-specific information into different forms #33

@wildlarva

Description

@wildlarva

Is your feature request related to a problem? Please describe.
Some users need to define user-specific information for generating a decoder and process it into different forms before generation. Currently, the mcdecoder cannot process user-specific information before generation,

Describe the solution you'd like
Add a functionality to import user code to process user-specific information into a different form.

Possible implementations for this are:

  • Define a python hook function to process user-specific information and refer it from MC description
    • python config file
      from mcdecoder.core import InstructionDecoder
      
      def process_instruction(instruction: InstructionDecoder) -> None:
        instruction.extras = ...
    • MC description
      decoder:
        process_instruction_hook: process_instruction
  • Define a python hook function to process user-specific information and register to mcdecoder
    • python config file
      from mcdecoder.core import InstructionDecoder, Environment
      
      # define a hook function
      def process_instruction(instruction: InstructionDecoder) -> None:
        instruction.extras = ...
      
      # register a hook function to the environment
      Environment.add_process_instruction_hook(process_instruction)

Describe alternatives you've considered
N/A

Additional context
N/A

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions