desktop *monitora_desktop(desktop *xdesktop) { if (xdesktop->lista_caixas->prox) { lista *no_ativo = busca_por_ativo(xdesktop->lista_caixas); struct termios conf; int carac; tcgetattr (0, &conf); sem_enter(conf); carac = le_caracter(); if (carac == TAB) { no_ativo->comando->ativado = false; no_ativo->comando = garante_invisib_itens(no_ativo->comando); no_ativo = proxima_caixa_disp(no_ativo); no_ativo->comando->ativado = true; } tcsetattr(0, TCSANOW, &conf); if (carac == ESC) { free_lista(&(xdesktop->lista_caixas)); free(xdesktop); restaura_tela(); exit(0); } if (carac == DEL) { clrscr(); xdesktop = gerencia_remocao(xdesktop); } no_ativo->comando->monitora(no_ativo->comando, carac); } return xdesktop; }
void push_data(short int *buf, unsigned char buf_pos) { short int i, byte; short int number; sem_enter(); for (byte = 0; byte < buf_pos; byte++) { number = buf[byte]; if ((number >= 0) && (number <= 255)) { for (i = 7; i >= 0; i--) { writepin(sdastr, 0); writepin(sclstr, 0); writepin(sdastr, (number & (1 << i)) ? 1 : 0); writepin(sclstr, 1); } } } writepin(sdastr, 1); writepin(sclstr, 0); writepin(sdastr, 0); sem_leave(); }