nocbreak(void) { int result = ERR; T((T_CALLED("nocbreak()"))); if (SP != 0 && cur_term != 0) { TTY buf; BEFORE("nocbreak"); _nc_setmode(O_TEXT); buf = cur_term->Nttyb; #ifdef TERMIOS buf.c_lflag |= ICANON; buf.c_iflag |= ICRNL; #else buf.sg_flags &= ~CBREAK; #endif if ((result = _nc_set_tty_mode(&buf)) == OK) { SP->_cbreak = 0; cur_term->Nttyb = buf; } AFTER("nocbreak"); } returnCode(result); }
raw(void) { int result = ERR; T((T_CALLED("raw()"))); if (SP != 0 && cur_term != 0) { TTY buf; BEFORE("raw"); _nc_setmode(O_BINARY); buf = cur_term->Nttyb; #ifdef TERMIOS buf.c_lflag &= ~(ICANON | ISIG | IEXTEN); buf.c_iflag &= ~(COOKED_INPUT); buf.c_cc[VMIN] = 1; buf.c_cc[VTIME] = 0; #else buf.sg_flags |= RAW; #endif if ((result = _nc_set_tty_mode(&buf)) == OK) { SP->_raw = TRUE; SP->_cbreak = 1; cur_term->Nttyb = buf; } AFTER("raw"); } returnCode(result); }
cbreak(void) { int result = ERR; T((T_CALLED("cbreak()"))); if (SP != 0 && cur_term != 0) { TTY buf; BEFORE("cbreak"); _nc_setmode(O_BINARY); buf = cur_term->Nttyb; #ifdef TERMIOS buf.c_lflag &= ~ICANON; buf.c_iflag &= ~ICRNL; buf.c_lflag |= ISIG; buf.c_cc[VMIN] = 1; buf.c_cc[VTIME] = 0; #else buf.sg_flags |= CBREAK; #endif if ((result = _nc_set_tty_mode(&buf)) == OK) { SP->_cbreak = 1; cur_term->Nttyb = buf; } AFTER("cbreak"); } returnCode(result); }
noraw(void) { int result = ERR; T((T_CALLED("noraw()"))); if (SP != 0 && cur_term != 0) { TTY buf; BEFORE("noraw"); _nc_setmode(O_TEXT); buf = cur_term->Nttyb; #ifdef TERMIOS buf.c_lflag |= ISIG | ICANON | (cur_term->Ottyb.c_lflag & IEXTEN); buf.c_iflag |= COOKED_INPUT; #else buf.sg_flags &= ~(RAW | CBREAK); #endif if ((result = _nc_set_tty_mode(&buf)) == OK) { SP->_raw = FALSE; SP->_cbreak = 0; cur_term->Nttyb = buf; } AFTER("noraw"); } returnCode(result); }
void repeat(HELP* self, int incordec){ PULSEGEN* pulse; if(self->gui->pulseUsed == 0){ pulse = self->gui->pulse1; }else{ pulse = self->gui->pulse2; } if(self->firstpress){ self->firstpress = 0; AFTER(MSEC(1000), self, repeat, 0); } if((((PINB >> 6) & 1) == 0 && incordec == 0)){ //Up SYNC(pulse, pulseInc, 0); SYNC(self->gui, update, 0); AFTER(MSEC(400), self, repeat, 0); }else if (((PINB >> 7) == 0) && incordec == 1){ //Down
static void * _smalloc(size_t size) { TREE *tp; size_t i; ASSERT(size % WORDSIZE == 0); /* want to return a unique pointer on malloc(0) */ if (size == 0) size = WORDSIZE; /* list to use */ i = size / WORDSIZE - 1; if (List[i] == NULL) { TREE *np; int n; /* number of blocks to get at one time */ #define NPS (WORDSIZE*8) ASSERT((size + WORDSIZE) * NPS >= MINSIZE); /* get NPS of these block types */ if ((List[i] = _malloc_unlocked((size + WORDSIZE) * NPS)) == 0) return (0); /* make them into a link list */ for (n = 0, np = List[i]; n < NPS; ++n) { tp = np; SIZE(tp) = size; np = NEXT(tp); AFTER(tp) = np; } AFTER(tp) = NULL; } /* allocate from the head of the queue */ tp = List[i]; List[i] = AFTER(tp); SETBIT0(SIZE(tp)); return (DATA(tp)); }
static void blink(Blinker *self, int flag) { if(self->period > 0) { if(flag) { SYNC(self->lcd, segmentOn, self->segment); } else { SYNC(self->lcd, segmentOff, self->segment); } AFTER(MSEC(self->period), self, blink, !flag); // BEFORE(MSEC(self->period), self, blink, nothing); } }
qiflush(void) { int result = ERR; T((T_CALLED("qiflush()"))); if (cur_term != 0) { TTY buf; BEFORE("qiflush"); buf = cur_term->Nttyb; #ifdef TERMIOS buf.c_lflag &= ~(NOFLSH); result = _nc_set_tty_mode(&buf); #else /* FIXME */ #endif if (result == OK) cur_term->Nttyb = buf; AFTER("qiflush"); } returnVoid; }
NCURSES_SP_NAME(noqiflush) (NCURSES_SP_DCL0) { int result = ERR; T((T_CALLED("noqiflush()"))); if (cur_term != 0) { TTY buf; BEFORE("noqiflush"); buf = cur_term->Nttyb; #ifdef TERMIOS buf.c_lflag |= NOFLSH; result = _nc_set_tty_mode(&buf); #else /* FIXME */ #endif if (result == OK) { cur_term->Nttyb = buf; } AFTER("noqiflush"); } returnVoid; }
void generateTone(ToneGenerator *self,int unused){ (self -> flip)=(self -> flip)^0x01; PARALLEL_PORT_WRITE(&portDevice,(int)(self -> flip)); //SEND(self -> period,self -> deadline,self,generateTone,0); AFTER(self -> period,self,generateTone,0); } //private function