Skip to content

stmhal: Allow event-driven readline() operation by refactoring function using coroutine design #1052

@pfalcon

Description

@pfalcon

Following up to #992 (comment)

I prototyped this refactor on raw_repl, and it worked. @dpgeorge, I'd like to be sure you're ok with going forward with this. For friendly_repl, core of which in readline() function, following changes would be needed:

Loop body

    for (;;) {
        int c = stdin_rx_chr();
        ...
   }

should be extracted to a separate function, accepting "c". Any state which was previously kept in stack variable should be made persistent between function calls (top-level static variable puts into structure). Code before the loop should be turned into "init" function. All other functions calling readline() should undergo similar transformation. More changes will be needed later to actually supporting event-driven operation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    rfcRequest for Comment

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions