Commit 9f33ef86 authored by Iustin Pop's avatar Iustin Pop
Browse files

Enhance cli.SubmitOpcode to use custom parameters

This patch allows the SubmitOpcode function to take a pre-created
Processor instance and a different feedback function. This is helpful
when submitting more than one opcode from a shell script.

Reviewed-by: imsnah
parent 3ef10550
......@@ -336,7 +336,7 @@ def AskUser(text, choices=None):
return answer
def SubmitOpCode(op):
def SubmitOpCode(op, proc=None, feedback_fn=None):
"""Function to submit an opcode.
This is just a simple wrapper over the construction of the processor
......@@ -344,8 +344,11 @@ def SubmitOpCode(op):
interaction functions.
"""
proc = mcpu.Processor()
return proc.ExecOpCode(op, logger.ToStdout)
if proc is None:
proc = mcpu.Processor()
if feedback_fn is None:
feedback_fn = logger.ToStdout
return proc.ExecOpCode(op, feedback_fn)
def GenericMain(commands, override=None):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment