Since I haven't installed XTC yet, my guess is that the XC code:
Code: Select all
void dsp_task_y (
chanend ch_logger,
// Other params
)
{
task_y_ctx_t ctx; // Context
// Init etc.
while (1) {
[[ordered]] // Excludes [[combinable]]
select {
// Other channel or timer or or cases
case ch_logger :> ctx.next_curve_logger_state : {
// Handle the select case channel event
} break;
// No common code here
}
// Unreachable
} // dsp_task_y
Code: Select all
DECLARE_JOB(dsp_task_y, (chanend_t));
void dsp_task_y (chanend_t ch_logger) {
SELECT_RES(
CASE_THEN(ch_logger, on_logger_input))
{
on_logger_input: {
// Handle logger input event
continue;
}
}
}
}
The reason I ask is that I downloaded the AI-based editor Cursor the other day, and gave it my present project. I zoomed in on some coincidental code and asked it to make lib_xcore code out of it.
Even if it was correctly able to tell me which task that sent on this channel (ie. the other side), on this one it gave me busy polling and even made up some lib_xcore calls.
I have documented this in An encounter with AI-powered Cursor text editor and XC. There you may see the full chat which I had with Claude-3.5-Sonnet (by reading in a graphics file).
I assume there will be corrections here in my attempt at lib_xcore. I hope it would be ok if I could use that more correct pseudo-code in the blog note. (Blog disclaimer)