Livt packages
Eccelerators.Cli
Version 1.4.1
Transport-independent, bounded command-line input, parsing, editing, and output for Livt FPGA applications.
Published files (23)
src/CommandRegistration.lvt
namespace Eccelerators.Cli
/**
* Registers one existing command before the remainder of the registry.
* All links are wired during construction; no runtime allocation or mutation.
*/
component CommandRegistration : ICommandRegistry
{
// Borrowed command and continuation; the application owns their hardware.
command: ICommand
next: ICommandRegistry
new(command: ICommand, next: ICommandRegistry)
{
this.command = command
this.next = next
}
/**
* The first matching command wins, even when its output is blocked.
*/
override fn TryRespond() bool
{
if (this.command.Matches()) {
return this.command.TryExecute()
}
return this.next.TryRespond()
}
}