void pascal near menu_sel_move(char sel_count, char direction) { putfunc(menu_sel, TX_YELLOW); menu_sel += direction; if(!in_option && !extra_unlocked && menu_sel == 1) { menu_sel += direction; } if(menu_sel < 0) { menu_sel = sel_count; } if(menu_sel > sel_count) { menu_sel = 0; } putfunc(menu_sel, TX_WHITE); }
int syslog_flush_intbuffer(FAR const struct syslog_channel_s *channel, bool force) { syslog_putc_t putfunc; int ch; int ret = OK; /* Select which putc function to use for this flush */ putfunc = force ? channel->sc_putc : channel->sc_force; /* This logic is performed with the scheduler disabled to protect from * concurrent modification by other tasks. */ sched_lock(); do { /* Transfer one character to time. This is inefficient, but is * done in this way to: (1) Deal with concurrent modification of * the interrupt buffer from interrupt activity, (2) Avoid keeper * interrupts disabled for a long time, and (3) to handler * wraparound of the circular buffer indices. */ ch = syslog_remove_intbuffer(); if (ch != EOF) { ret = putfunc(ch); } } while (ch != EOF && ret >= 0); sched_unlock(); return ret; }