/// Construct a dynoTree at the given location DynoTree::DynoTree(glm::vec3 pos,Game* g) : Object(pos,g) { // Actually construct the triangles initialiseTriangles(); freeze(); // If we have yet to load the texture, do it if (dtreeTextureNumber == 0) dtreeTextureNumber = textureFromTGA(dtextureName,false); // And set it as this object's texture textureNumber = dtreeTextureNumber; }
void FieldPropertiesDialog::loadCollations() { wxWindowUpdateLocker freeze(choice_collate); choice_collate->Clear(); if (DatabasePtr db = tableM->getDatabase()) { wxString charset(choice_charset->GetStringSelection()); choice_collate->Append(db->getCollations(charset)); } }
void memory_session::end() { if (memory_session::current_sub_session.get() && memory_session::current_sub_session.get()->get_parent() == this) memory_session::current_sub_session.reset(); if (frozen.get()) { if (!is_frozen()) freeze(); } }
static inline void freeze_process(struct task_struct *p) { unsigned long flags; if (!freezing(p)) { freeze(p); spin_lock_irqsave(&p->sighand->siglock, flags); signal_wake_up(p, 0); spin_unlock_irqrestore(&p->sighand->siglock, flags); } }
bool PVEnumerated:: setChoices(const StringArray & choices) { if(pvIndex.get()==NULL ) { throw std::logic_error(notAttached); } if(pvChoices->isImmutable()) return false; PVStringArray::svector data(choices.size()); std::copy(choices.begin(), choices.end(), data.begin()); pvChoices->replace(freeze(data)); return true; }
void NativeTextfieldWin::OnMouseMove(UINT keys, const gfx::Point& point) { SetContainsMouse(true); // Clamp the selection to the visible text so the user can't drag to select // the "phantom newline". In theory we could achieve this by clipping the X // coordinate, but in practice the edit seems to behave nondeterministically // with similar sequences of clipped input coordinates fed to it. Maybe it's // reading the mouse cursor position directly? // // This solution has a minor visual flaw, however: if there's a visible // cursor at the edge of the text (only true when there's no selection), // dragging the mouse around outside that edge repaints the cursor on every // WM_MOUSEMOVE instead of allowing it to blink normally. To fix this, we // special-case this exact case and discard the WM_MOUSEMOVE messages instead // of passing them along. // // But even this solution has a flaw! (Argh.) In the case where the user // has a selection that starts at the edge of the edit, and proceeds to the // middle of the edit, and the user is dragging back past the start edge to // remove the selection, there's a redraw problem where the change between // having the last few bits of text still selected and having nothing // selected can be slow to repaint (which feels noticeably strange). This // occurs if you only let the edit receive a single WM_MOUSEMOVE past the // edge of the text. I think on each WM_MOUSEMOVE the edit is repainting its // previous state, then updating its internal variables to the new state but // not repainting. To fix this, we allow one more WM_MOUSEMOVE through after // the selection has supposedly been shrunk to nothing; this makes the edit // redraw the selection quickly so it feels smooth. CHARRANGE selection; GetSel(selection); const bool possibly_can_discard_mousemove = (selection.cpMin==selection.cpMax) && (((selection.cpMin==0) && (ClipXCoordToVisibleText(point.x(), false)>point.x())) || ((selection.cpMin==GetTextLength()) && (ClipXCoordToVisibleText(point.x(), false)<point.x()))); if(!can_discard_mousemove_ || !possibly_can_discard_mousemove) { can_discard_mousemove_ = possibly_can_discard_mousemove; ScopedFreeze freeze(this, GetTextObjectModel()); OnBeforePossibleChange(); // Force the Y coordinate to the center of the clip rect. The edit // behaves strangely when the cursor is dragged vertically: if the cursor // is in the middle of the text, drags inside the clip rect do nothing, // and drags outside the clip rect act as if the cursor jumped to the // left edge of the text. When the cursor is at the right edge, drags of // just a few pixels vertically end up selecting the "phantom newline"... // sometimes. RECT r; GetRect(&r); DefWindowProc(WM_MOUSEMOVE, keys, MAKELPARAM(point.x(), (r.bottom-r.top)/2)); OnAfterPossibleChange(true); } }
void NativeTextfieldWin::HandleKeystroke() { const MSG* msg = GetCurrentMessage(); ScopedFreeze freeze(this, GetTextObjectModel()); TextfieldController* controller = textfield_->GetController(); bool handled = false; if(controller) { KeyEvent event(*msg); handled = controller->HandleKeyEvent(textfield_, event); } if(!handled) { OnBeforePossibleChange(); if(msg->wParam==ui::VKEY_HOME || msg->wParam==ui::VKEY_END) { // DefWindowProc() might reset the keyboard layout when it receives a // keydown event for VKEY_HOME or VKEY_END. When the window was created // with WS_EX_LAYOUTRTL and the current keyboard layout is not a RTL one, // if the input text is pure LTR text, the layout changes to the first RTL // keyboard layout in keyboard layout queue; if the input text is // bidirectional text, the layout changes to the keyboard layout of the // first RTL character in input text. When the window was created without // WS_EX_LAYOUTRTL and the current keyboard layout is not a LTR one, if // the input text is pure RTL text, the layout changes to English; if the // input text is bidirectional text, the layout changes to the keyboard // layout of the first LTR character in input text. Such keyboard layout // change behavior is surprising and inconsistent with keyboard behavior // elsewhere, so reset the layout in this case. HKL layout = GetKeyboardLayout(0); DefWindowProc(msg->message, msg->wParam, msg->lParam); ActivateKeyboardLayout(layout, KLF_REORDER); } else { DefWindowProc(msg->message, msg->wParam, msg->lParam); } // CRichEditCtrl automatically turns on IMF_AUTOKEYBOARD when the user // inputs an RTL character, making it difficult for the user to control // what language is set as they type. Force this off to make the edit's // behavior more stable. const int lang_options = SendMessage(EM_GETLANGOPTIONS, 0, 0); if(lang_options & IMF_AUTOKEYBOARD) { SendMessage(EM_SETLANGOPTIONS, 0, lang_options&~IMF_AUTOKEYBOARD); } OnAfterPossibleChange(true); } }
bool CubeCreature::get_in_building(){ if(_stay_in_building)return true; if(in_building()){ if(in_building()->get_in(this)){ _stay_in_building=true; freeze(); return true; } } return false; }
bool Leg::changeState(State s) { if(state == s) return false; else { if(s == END_STATE) freeze(); state = s; if(remote) RemoteManager.sendState(remotePort, remoteIndex, s); return true; } }
// this method makes the widget appear to the toolkit as if it has been // destructed - all that remains to do is destroy the window and // recover the memory for the widget (delete widget). // this method is primarily used from MSWidget::destroy to allow // callback safe destruction of widgets void MSWidget::prepareForDestruction(void) { freeze(); MSWidget *pTopWidget=top(); if (_window!=0) _server->widgetHashTable()->remove(_window); // no more events if (pTopWidget!=0) pTopWidget->removeFromFocusList(this); if (pTopWidget!=0&&pTopWidget->inputFocus()==this) (void)pTopWidget->traverseFocus(0); if (focusWindow()==this) _focusWindow=0; childDestroyNotify(); activateCallback(MSWidgetCallback::destroy); removeAllCallbacks(); }
void drive_till_line_backward(){ motor(Motor_Left,-Drivespeed_middle); motor(Motor_Right,-Drivespeed_middle); printf("Start\n"); while(1){ if(analog(Sensor_Line_Left)>Sensor_Black&&analog(Sensor_Line_Right)>Sensor_Black){ printf("Abgehn\n"); break; } if(analog(Sensor_Line_Left)>Sensor_Black){ freeze(Motor_Right); freeze(Motor_Left); printf("Links\n"); motor(Motor_Right,-Drivespeed_middle); msleep(50); while(analog(Sensor_Line_Right)<Sensor_Black){} break; } if(analog(Sensor_Line_Right)>Sensor_Black){ freeze(Motor_Right); freeze(Motor_Left); printf("Right\n"); motor(Motor_Left,-Drivespeed_middle); msleep(50); while(analog(Sensor_Line_Left)<Sensor_Black){} break; } } freeze(Motor_Left); freeze(Motor_Right); }
void bringback2cube(){ //claw up motor(Motor_Up,Motor_up_speed); //zurück 1s drive(1000,-Drivespeed,-Drivespeed); //turn right 90 drive(970,Turnspeed,-Turnspeed); //vor to calibrate drive(1000,Drivespeed,Drivespeed); //back drive(500,-Drivespeed,-Drivespeed); //turn so little bit b4 cubes drive(1130,Turnspeed,-Turnspeed); //vor drive(900,Drivespeed,Drivespeed); //wait for claw up claw_up(); //camera fix camera_update(); //hide your cubes cube_is_near(); //back drive(1000,-Drivespeed,-Drivespeed); //turn left more than 90 idk drive(1330,-Turnspeed,Turnspeed); //start to down motor motor(Motor_Up,Motor_down_speed); //vor to calibrate drive(1000,Drivespeed,Drivespeed); //langsamer weil wackeldackel drive(2000,Drivespeed_middle+20,Drivespeed_middle+20); //back drive(400,-Drivespeed,-Drivespeed); //turn more than 90 lulz drive(980,-Turnspeed,Turnspeed); //light left and shit drive(5000,Drivespeed_middle*2,(Drivespeed_middle*2)-7); //light back and shit drive(1000,-Drivespeed_middle*2,(-Drivespeed_middle*2)+7); //wait for claw down while(!digital(Sensor_Down)){ if(seconds()>start+113){ claw_open(); disable_servos(); } } freeze(Motor_Up); msleep(2000); claw_open(); disable_servos(); }
void talk( void ) { freeze(1); freeze(¤t_sprite); &nut = sp_dir(1, -1); if (&talker == 0) { say_stop("`3Hi, we are the giant ducks of Koka Isle.", ¤t_sprite); wait(250); say_stop("`3Who are you?", ¤t_sprite); wait(500); sp_dir(1, 2); wait(1000); sp_dir(1, &nut); wait(250); say_stop("Uh, I'm Dink.", 1); wait(250); say_stop("`3Hello Dink.", ¤t_sprite); } unfreeze(1); unfreeze(¤t_sprite); }
void NativeTextfieldWin::OnLButtonDblClk(UINT keys, const gfx::Point& point) { // Save the double click info for later triple-click detection. tracking_double_click_ = true; double_click_point_ = point; double_click_time_ = GetCurrentMessage()->time; ScopedFreeze freeze(this, GetTextObjectModel()); OnBeforePossibleChange(); DefWindowProc(WM_LBUTTONDBLCLK, keys, MAKELPARAM(ClipXCoordToVisibleText(point.x(), false), point.y())); OnAfterPossibleChange(true); }
void lego_spin_until(int direction, int speed, int sensor, int (*comparator)(int, int), int threshold) { int left_ticks_traveled = 0; int right_ticks_traveled = 0; float right_error; float left_error; float desired_value; int left_multiplier; int right_multiplier; clear_motor_position_counter(LEFT_MOTOR); clear_motor_position_counter(RIGHT_MOTOR); motor(LEFT_MOTOR, speed * direction); motor(RIGHT_MOTOR, -speed * direction); while(TRUE) { if (comparator(analog(sensor), threshold)) { break; } display_printf(0, 0, "%4i", analog(sensor)); left_ticks_traveled = abs(get_motor_position_counter(LEFT_MOTOR)); right_ticks_traveled = abs(get_motor_position_counter(RIGHT_MOTOR)); desired_value = (left_ticks_traveled + right_ticks_traveled) / 2.0; left_error = desired_value - left_ticks_traveled; right_error = desired_value - right_ticks_traveled; left_multiplier = (int) ((left_error * spin_l_kP) + 0.5); right_multiplier = (int) ((right_error * spin_r_kP) + 0.5); motor(LEFT_MOTOR, (speed * direction) + left_multiplier); motor(RIGHT_MOTOR, (-speed * direction) + right_multiplier); } freeze(LEFT_MOTOR); freeze(RIGHT_MOTOR); }
/** * This function is required when no manager threads are present in the * pipeline, which would allow to freeze other threads before starting the * computation. * * \return TODO */ int freeze_and_run(bool=false) { freeze(); int nstages=static_cast<int>(nodes_list.size()); if (!prepared) if (prepare()<0) return -1; for(int i=0;i<nstages;++i) { nodes_list[i]->set_id(i); if (nodes_list[i]->freeze_and_run(true)<0) { error("ERROR: PIPE, (freezing and) running stage %d\n", i); return -1; } } return 0; }
int main(int argc, char **argv) { int i; int hitme; char ch; prelim(); if (argc > 1) { // look for -f option if (strcmp(argv[1], "-f")== 0) { coordfixed = 1; argc--; argv++; } } if (argc > 1) { fromcommandline = 1; line[0] = '\0'; while (--argc > 0) { strcat(line, *(++argv)); strcat(line, " "); } } else fromcommandline = 0; while (TRUE) { /* Play a game */ setup(); if (alldone) { score(0); alldone = 0; } else makemoves(); skip(2); stars(); skip(1); if (tourn && alldone) { printf("Do you want your score recorded?"); if (ja()) { chew2(); freeze(FALSE); } } printf("Do you want to play again?"); if (!ja()) break; } skip(1); prout("May the Great Bird of the Galaxy roost upon your home planet."); return 0; }
void talk( void ) { freeze(1); freeze(¤t_sprite); choice_start(); "Tell the duck to go home" "Yell at it" choice_end(); if (&result == 1) { wait(500); say_stop("Hey little duck, you gotta get home to Ethel.", 1); wait(500); say_stop("`0QUACK!!", ¤t_sprite); wait(500); } if (&result == 2) { wait(500); say_stop("You suck little duck guy, not even I run away from home.", 1); wait(250); say_stop("You should be ashamed.", 1); wait(500); say_stop("`0Bite me", ¤t_sprite); wait(250); say_stop("`0But fine, I'll go home...", ¤t_sprite); wait(500); &old_womans_duck = 2; sp_speed(¤t_sprite, 2); sp_timing(¤t_sprite, 0); move_stop(¤t_sprite, 8, -12, 1); sp_active(¤t_sprite, 0); } unfreeze(1); unfreeze(¤t_sprite); }
void talk( void ) { freeze(1); freeze(¤t_sprite); if (&story > 10) { say_stop("Hi little girl ..", 1); wait(250); say_stop("`1Hi mister, thanks for letting us all eat.", ¤t_sprite); wait(250); say_stop("You're welcome.", 1); unfreeze(1); unfreeze(¤t_sprite); return; } choice_start() "Say hi" "Ask about food" "Never mind" choice_end() if (&result == 1) { say_stop("Hi little girl ..", 1); wait(250); say_stop("`1Hi mister.", ¤t_sprite); } if (&result == 2) { say_stop("Do you get to eat much little girl?", 1); wait(250); say_stop("`1Not much lately, mommy says we can't eat that much,", ¤t_sprite); say_stop("`1because of the ducks.", ¤t_sprite); wait(250); say_stop("`1I don't like the ducks.", ¤t_sprite); } unfreeze(1); unfreeze(¤t_sprite); }
// Execute a command // Yes, this is only a bunch of hardcoded crap static void executeCommand(char *command, int argc, char **argv) { if(strcmp(command, "reboot") == 0) reboot(); else if(strcmp(command, "clear") == 0) printf("\e[H\e[2J"); else if(strcmp(command, "pid") == 0) { task_t* proc = scheduler_getCurrentTask(); if(proc != NULL) printf("procnum: %d\n", proc->pid); } else if(strcmp(command, "halt") == 0) halt(); else if(strcmp(command, "freeze") == 0) freeze(); else if(strcmp(command, "panic") == 0) panic("Test panic for debugging"); else if(strcmp(command, "kill") == 0) asm("mov %eax, 1; int 0x80;"); else if(strcmp(command, "triplefault") == 0) { struct vm_context *ctx = vm_new(); paging_apply(ctx); } else if(strcmp(command, "pagefault") == 0) *((char *)vm_faultAddress) = 0; else if(strcmp(command, "reload") == 0) paging_apply(vm_kernelContext); else if(strcmp(command, "rebuild") == 0) { vm_set_cache(vm_kernelContext, NULL); paging_apply(vm_kernelContext); } else if(strcmp(command, "dump") == 0) vm_dump(vm_currentContext); else if (strcmp(command, "kb") == 0) { if (argc != 1) { printf("usage: kb <layoutname>\n"); return; } if (keyboard_setlayout(argv[0]) == -1) { printf("unknown layout\n"); return; } } else { if(strlen(command) > 0 && command[0] != '#') printf("error: command '%s' not found.\n", command); } }
void ScopeI::delrawsrc() { freeze(false); if (scopes) scopes->setSource(QSSource(0)); if (sleeper) delete sleeper; sleeper=0; if (rawsf) delete rawsf; rawsf=0; if (rawqsn) delete rawqsn; rawqsn=0; }
void ScopeI::delspikesrc() { freeze(false); if (scopes) scopes->setSpikeSource(0); if (spikeslp) delete spikeslp; spikeslp=0; if (spikesf) delete spikesf; spikesf=0; if (spikeqsn) delete spikeqsn; spikeqsn=0; }
void click () { freeze (1); load_game (-1); // This is reached if the game didn't exist. sp_brain (g_dink, "person"); sp_base_idle (g_dink, "idle"); sp_base_walk (g_dink, "walk"); sp_timing (g_dink, 33); sp_speed (g_dink, 2); freeze (g_dink); move_stop (g_dink, 2, 400, 1); sp_dir (g_dink, 2); say_stop ("Continue?", g_dink); say_stop ("You haven't even started yet!", g_dink); say_stop ("Hmpf!", g_dink); move_stop (g_dink, 8, 350, 1); sp_y (g_dink, 350); sp_seq (g_dink, collection_code ("walk") + 3); sp_brain (g_dink, "repeat"); sp_brain (1, "pointer"); unfreeze (1); }
void halt() { log(LOG_WARN, "generic: Going to halt NOW!"); #if ARCH == ARCH_i386 || ARCH == ARCH_amd64 acpi_powerOff(); #endif /* In case we don't have an x86(_64) architecture or the ACPI * poweroff didn't work for whatever reason, display a message * to tell the user he can manually turn of the PC now. */ printf("\n\nYou may turn off your PC now.\n"); freeze(); }
void FieldPropertiesDialog::loadCharsets() { wxWindowUpdateLocker freeze(choice_charset); choice_charset->Clear(); choice_charset->Append("NONE"); if (DatabasePtr db = tableM->getDatabase()) { wxString stmt = "select rdb$character_set_name" " from rdb$character_sets order by 1"; wxArrayString charsets(db->loadIdentifiers(stmt)); charsets.Remove("NONE"); choice_charset->Append(charsets); } }
void talk( void ) { if (&story > 10) { say_stop("`%Super-Fry Chicken opening soon.", ¤t_sprite); return; } freeze(1); say_stop("`%Hear ye, hear ye ...", ¤t_sprite); say_stop("`%By order of our great ducks the monthly tax shall be doubled.", ¤t_sprite); say_stop("`%This also applies to food donations.", ¤t_sprite); say_stop("`%Long live the ducks.", ¤t_sprite; unfreeze(1); }
void NativeTextfieldWin::ExecuteCommand(int command_id) { ScopedFreeze freeze(this, GetTextObjectModel()); OnBeforePossibleChange(); switch(command_id) { case IDS_APP_UNDO: Undo(); break; case IDS_APP_CUT: Cut(); break; case IDS_APP_COPY: Copy(); break; case IDS_APP_PASTE: Paste(); break; case IDS_APP_SELECT_ALL: SelectAll(); break; default: NOTREACHED(); break; } OnAfterPossibleChange(true); }
void BadGuy::collision_tile(uint32_t tile_attributes) { if(tile_attributes & Tile::HURTS) { if (tile_attributes & Tile::FIRE) { if (is_flammable()) ignite(); } else if (tile_attributes & Tile::ICE) { if (is_freezable()) freeze(); } else { kill_fall(); } } }
void FieldPropertiesDialog::loadGeneratorNames() { wxWindowUpdateLocker freeze(choice_generator); choice_generator->Clear(); if (DatabasePtr db = tableM->getDatabase()) { GeneratorsPtr gs(db->getGenerators()); for (Generators::const_iterator it = gs->begin(); it != gs->end(); ++it) { choice_generator->Append((*it)->getName_()); } } }
void PVUnionArray::setCapacity(size_t capacity) { if(this->isCapacityMutable()) { checkLength(capacity); const_svector value; swap(value); if(value.capacity()<capacity) { svector mvalue(thaw(value)); mvalue.reserve(capacity); value = freeze(mvalue); } swap(value); } else THROW_EXCEPTION2(std::logic_error, "capacity immutable"); }