feat(v4.0.0): a line from the console breaks a wait
Text for a node from its console, arriving while the node waits for an answer (AWAIT), is kept as any message is; the wait ends in error 21, Interrupted; and the text is then done as usual. Console text for another node, passing through a node that is waiting, does not end its wait. On the hosted program 5 AWAIT ended the program with "the node stopped". The boot now reports that the line is waiting, the host reads the next line and hands it over, which breaks the wait, and then has the kept line done. The bare-metal host does the same; it is booted in the commit that follows. test_host_mesh.c: 76 checks, both widths and the sanitizers. hosted-check types 5 AWAIT and two more lines: Interrupted, then 3 and 56. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9efe8aad3a
commit
cbe1cd5e44
@@ -75,6 +75,21 @@ int main(void)
|
||||
len = strlen(line);
|
||||
if (len && line[len - 1] == '\n') len--;
|
||||
how = v4_boot_line(&boot, line, (unsigned)len);
|
||||
/* The line is waiting for an answer no one here can send. The next
|
||||
* line typed breaks the wait: the line that was waiting ends in an
|
||||
* error, and then the line just typed is done (boot.h). */
|
||||
while (how == V4_BOOT_LINE_WAITING) {
|
||||
fflush(stdout);
|
||||
if (!fgets(line, sizeof line, stdin)) { putchar('\n'); return 0; }
|
||||
len = strlen(line);
|
||||
if (len && line[len - 1] == '\n') len--;
|
||||
how = v4_boot_line(&boot, line, (unsigned)len);
|
||||
if (how == V4_BOOT_LINE_TOO_LONG) { fputs("Line too long\n ERROR\n", stdout); how = V4_BOOT_LINE_WAITING; continue; }
|
||||
if (how == V4_TEXT_ERROR) fputs(" ERROR\nok> ", stdout);
|
||||
else if (how == V4_TEXT_COMPLETED) fputs(" ok\nok> ", stdout);
|
||||
else break;
|
||||
how = v4_boot_line(&boot, 0, 0);
|
||||
}
|
||||
if (how == V4_TEXT_COMPLETED) fputs(" ok\n", stdout);
|
||||
if (leaving) { fflush(stdout); return 0; }
|
||||
else if (how == V4_TEXT_ERROR) fputs(" ERROR\n", stdout);
|
||||
|
||||
Reference in New Issue
Block a user