void chmodPopup(Widget w, FileWindowRec *fw, XtPointer call_data) { char message[MAXPATHLEN]; register int i; if (fw == NULL) fw = popup_fw; if (!fw->n_selections) return; chmode.fw = fw; for (i=0;; i++) if (fw->files[i]->selected) { chmode.file = i; break; } sprintf(message, _("Changing access permissions for %s"), chmode.fw->files[chmode.file]->name); XtVaSetValues(chmode.label, XtNlabel, (XtArgVal) message, NULL); setupTicks(); freeze = True; popupByCursor(chmode.shell, XtGrabExclusive); }
// Entry point to nbavr. void nbavr(Task** tasks) { // Disable interrupts. cli(); // Check there is at least one task. if((tasks == NULL) || (tasks[0] == NULL)) { while(true); } // Enable watchdog timer with 15MS timouts. wdt_enable(WDTO_15MS); // Setup tick timer. setupTicks(halt); // If a task halts or yields, the cpu will jump back here. int jmp = setjmp(mLongJmp); // Pointer to current task. // Static to prevent being reinitialised when a task yields or halts. static Task** taskp = NULL; // If a task halted set its state to crashed and go to the next task. if(jmp == LONG_JUMP_HALT) { (*taskp)->state = TaskStateCrash; taskp++; } else if(jmp == LONG_JUMP_YIELD) { taskp++; } while(true) { Task* task = (*taskp); // Reset watchdog timer. wdt_reset(); // Enable interrupts. sei(); if(task != NULL) { if(task->sleepState == SleepStateDelay) { // Check if it is time for this task to wake up. if((int32_t)(getTicks() - task->wakeTick) >= 0) { task->sleepState = SleepStateAwake; } } if(task->sleepState == SleepStateAwake) { step(task); } // Go to next task. taskp++; } else { // Reached end of task list. // TODO Sleep the cpu. taskp = tasks; } } }
static void chmodRestoreCb(Widget w, FileWindowRec *fw, XtPointer call_data) { setupTicks(); }