// ---------------------------------------------------------------------- autocast::AutoCastProcessor::LocalDataUnit * AutoCastProcessor:: most_urgent_DataUnit() throw() { double now = owner().world().scheduler().current_time(); std::vector<LocalDataUnit*> tmp_objects; for (DataUnitsMap::const_iterator it = complete_DataUnits_.begin(); it != complete_DataUnits_.end(); ++it){ if (it->second->last_send_time() < now && it->second->unknown_count() > 0){ for (int i = 0; i < it->second->unknown_count(); i++){ tmp_objects.push_back(it->second); } } } if (tmp_objects.size() == 0) return NULL; int idx = static_cast<int>(uniform_random(0.0,tmp_objects.size(),true,false)); return tmp_objects.at(idx); }
void CMissileProjectile::Collision() { const float h = ground->GetHeightReal(pos.x, pos.z); if (weaponDef->waterweapon && h < pos.y) { // let waterweapons travel in water return; } if (h > pos.y && fabs(speed.y) > 0.001f) { pos -= speed * std::min(1.0f, (float)((h - pos.y) / fabs(speed.y))); } if (weaponDef->visuals.smokeTrail) { new CSmokeTrailProjectile(pos, oldSmoke, dir, oldDir, owner(), false, true, 7, SMOKE_TIME, 0.6f, drawTrail, 0, weaponDef->visuals.texture2); } CWeaponProjectile::Collision(); oldSmoke = pos; }
RingHom PolyAlgebraHom(const PolyRing& Rx, const ring& Ry, const std::vector<RingElem>& IndetImages) { const char* const FnName = "PolyAlgebraHom(Rx,Ry,IndetImages)"; // Check that IndetImages are sensible... if (NumIndets(Rx) != len(IndetImages)) CoCoA_ERROR(ERR::BadPolyRingHomImages, FnName); for (long i=0; i < NumIndets(Rx); ++i) if (owner(IndetImages[i]) != Ry) CoCoA_ERROR(ERR::BadPolyRingHomImages, FnName); // // Special case: codomain is coeff ring. // if (Ry == CoeffRing(Rx)) // return Rx->myHomCtor(Ry, IdentityHom(Ry), IndetImages); // // General case: codomain must be a poly ring with same coeffs // if (!IsPolyRing(Ry)) // CoCoA_ERROR(ERR::BadCodomain, FnName); // if (CoeffRing(Rx) != CoeffRing(Ry)) // CoCoA_ERROR(ERR::MixedCoeffRings, FnName); // return Rx->myHomCtor(Ry, CoeffEmbeddingHom(Ry), IndetImages); return Rx->myHomCtor(Ry, CanonicalHom(CoeffRing(Rx),Ry), IndetImages); }
void CWeaponProjectile::Collision() { if (/* !weaponDef->noExplode || gs->frameNum & 1 */ true) { // don't do damage only on odd-numbered frames // for noExplode projectiles (it breaks coldet) float3 impactDir = speed; impactDir.Normalize(); // Dynamic Damage DamageArray dynDamages; if (weaponDef->dynDamageExp > 0) dynDamages = weaponDefHandler->DynamicDamages(weaponDef->damages, startpos, pos, (weaponDef->dynDamageRange > 0) ? weaponDef->dynDamageRange : weaponDef->range, weaponDef->dynDamageExp, weaponDef->dynDamageMin, weaponDef->dynDamageInverted); helper->Explosion(pos, (weaponDef->dynDamageExp > 0) ? dynDamages : weaponDef->damages, weaponDef->areaOfEffect, weaponDef->edgeEffectiveness, weaponDef->explosionSpeed, owner(), true, weaponDef->noExplode ? 0.3f : 1, weaponDef->noExplode || weaponDef->noSelfDamage, weaponDef->impactOnly, weaponDef->explosionGenerator, 0, impactDir, weaponDef->id); } if (weaponDef->soundhit.getID(0) > 0) { Channels::Battle.PlaySample(weaponDef->soundhit.getID(0), this, weaponDef->soundhit.getVolume(0)); } if (!weaponDef->noExplode){ CProjectile::Collision(); } else { if (TraveledRange()) { CProjectile::Collision(); } } }
::CORBA::Boolean TestValuetype::_tao_unmarshal ( TAO_InputCDR &strm, TestValuetype *&new_object ) { ::CORBA::ValueBase *base = 0; ::CORBA::Boolean is_indirected = false; ::CORBA::Boolean is_null_object = false; ::CORBA::Boolean const retval = ::CORBA::ValueBase::_tao_unmarshal_pre ( strm, base, TestValuetype::_tao_obv_static_repository_id (), is_null_object, is_indirected ); ::CORBA::ValueBase_var owner (base); if (!retval) return false; if (is_null_object) return true; if (!is_indirected && !base->_tao_unmarshal_v (strm)) return false; // Now base must point to the unmarshaled object. // Align the pointer to the right subobject. new_object = TestValuetype::_downcast (base); if (0 == new_object) return false; if (is_indirected) new_object->_add_ref (); owner._retn (); return true; }
void permission_object_t::test<5>() { LLPermissions perm,perm1; LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); perm1.init(creator,owner,lastOwner,group); U32 base = PERM_TRANSFER; U32 ownerp = PERM_TRANSFER; U32 groupp = PERM_TRANSFER; U32 everyone = PERM_TRANSFER; U32 next = PERM_NONE; perm1.initMasks(base, ownerp, everyone, groupp, next); base = PERM_ALL; ownerp = PERM_ITEM_UNRESTRICTED; //PERM_ITEM_UNRESTRICTED = PERM_MODIFY | PERM_COPY | PERM_TRANSFER; groupp = PERM_TRANSFER | PERM_COPY|PERM_MODIFY; everyone = PERM_TRANSFER; next = PERM_NONE; perm.init(creator,owner,lastOwner,group); perm.initMasks(base, ownerp, everyone, groupp, next); // restrict permissions by accumulation perm.accumulate(perm1); U32 fixedbase = PERM_TRANSFER | PERM_MOVE; U32 fixedowner = PERM_TRANSFER; U32 fixedgroup = PERM_TRANSFER; U32 fixedeveryone = PERM_TRANSFER; U32 fixednext = PERM_NONE; ensure_equals("accumulate failed ", fixedbase, perm.getMaskBase()); ensure_equals("accumulate failed ", fixedowner, perm.getMaskOwner()); ensure_equals("accumulate failed ", fixedgroup, perm.getMaskGroup()); ensure_equals("accumulate failed ", fixedeveryone, perm.getMaskEveryone()); ensure_equals("accumulate failed ", fixednext, perm.getMaskNextOwner()); }
/* **************************************************************** * Chamada ao sistema "utime" * **************************************************************** */ int utime (const char *path, const time_t *tp) { register INODE *ip; time_t tv[3]; if ((ip = owner (path)) == NOINODE) return (-1); if (ip->i_sb->sb_mntent.me_flags & SB_RONLY) { u.u_error = EROFS; goto bad; } /* * Altera os tempos */ if (tp == (time_t *)NULL) /* Tempos de acesso e modificação */ { ip->i_atime = time; ip->i_mtime = time; } else /* Os 3 tempos */ { if (unimove (tv, tp, sizeof (tv), US)) { u.u_error = EFAULT; goto bad; } ip->i_atime = tv[0]; ip->i_mtime = tv[1]; ip->i_ctime = tv[2]; } inode_dirty_inc (ip); bad: iput (ip); return (UNDEF); } /* end utime */
// ---------------------------------------------------------------------- void LocalizationIterLaterationModule:: work( void ) throw() { if ( state_ == il_finished ) return; // do initial stuff; // if anchor, send 'init-message' and set state to 'finished'; // if unknown, check whether the node is sound or not. if sound, // send messages, if not, clear estimated position. if ( state_ == il_init ) { if ( owner().is_anchor() ) { send( new LocalizationIterLaterationMessage( observer().confidence() ) ); state_ = il_finished; } else { sound_ = neighborhood().is_sound(); if ( sound_ && node().has_est_position() ) { send( new LocalizationIterLaterationMessage( observer().confidence() ) ); send( new LocalizationIterLaterationSoundMessage() ); } else { set_confidence( 0 ); node_w().clear_est_position(); } state_ = il_work; } } if ( state_ == il_work ) iter_lateration_step(); }
void t01_basic(){ INIT_LOCAL(); Onion::Dict normal; normal.add("Hello", "World"); onion_dict *d=onion_dict_new(); onion_dict_add(d, "Hello", "2", 0); Onion::Dict non_owner(d); FAIL_IF_NOT_EQUAL_STRING(non_owner.get("Hello"), "2"); Onion::Dict owner(d, true); FAIL_IF_NOT_EQUAL_STRING(owner.get("Hello"), "2"); non_owner.add("non-owner", "true"); FAIL_IF_NOT_EQUAL_STRING(owner.get("non-owner"), "true"); FAIL_IF_NOT_EQUAL_STRING(onion_dict_get(d,"non-owner"), "true"); END_LOCAL(); }
bool GScriptCoreService::loadLibrary(const char * namespaces, const GMetaVariadicParam * libraryNames) { if(! this->libraryLoader) { GScopedInterface<IScriptLibraryLoader> loader(createBuiltinLibraries(this->scriptObject)); this->libraryLoader.reset(loader.get()); } if(namespaces == NULL) { namespaces = this->bindName.c_str(); } GScopedInterface<IScriptObject> owner(scriptObjectToInterface(this->scriptObject, false)); for(size_t i = 0; i < libraryNames->paramCount; ++i) { char * name = fromVariant<char *>(*(libraryNames->params[i])); if(! this->libraryLoader->loadScriptLibrary(owner.get(), namespaces, name)) { return false; } } return true; }
/*-------------------------------------------------- * Center the window concerning his owner window *--------------------------------------------------*/ PMWindow& PMWindow::center_at() { HWND o_handle = owner (); HWND p_handle = parent (); SHAPE o_shape = PMWindow( o_handle ? o_handle : p_handle ).shape(); SHAPE shape = this->shape(); if( o_handle ) { shape.x = (o_shape.cx - shape.cx)/2 + o_shape.x; shape.y = (o_shape.cy - shape.cy)/2 + o_shape.y; } else { shape.x = (o_shape.cx - shape.cx)/2; shape.y = (o_shape.cy - shape.cy)/2; } return reshape( shape ); }
void cpc_symbiface2_device::device_start() { device_t* cpu = machine().device("maincpu"); address_space& space = cpu->memory().space(AS_IO); m_slot = dynamic_cast<cpc_expansion_slot_device *>(owner()); space.install_readwrite_handler(0xfd00,0xfd07,read8_delegate(FUNC(cpc_symbiface2_device::ide_cs1_r),this),write8_delegate(FUNC(cpc_symbiface2_device::ide_cs1_w),this)); space.install_readwrite_handler(0xfd08,0xfd0f,read8_delegate(FUNC(cpc_symbiface2_device::ide_cs0_r),this),write8_delegate(FUNC(cpc_symbiface2_device::ide_cs0_w),this)); space.install_read_handler(0xfd10,0xfd10,read8_delegate(FUNC(cpc_symbiface2_device::mouse_r),this)); space.install_readwrite_handler(0xfd14,0xfd15,read8_delegate(FUNC(cpc_symbiface2_device::rtc_r),this),write8_delegate(FUNC(cpc_symbiface2_device::rtc_w),this)); space.install_readwrite_handler(0xfd17,0xfd17,read8_delegate(FUNC(cpc_symbiface2_device::rom_rewrite_r),this),write8_delegate(FUNC(cpc_symbiface2_device::rom_rewrite_w),this)); // set up ROM space (these can be writable, when mapped to &4000, or completely disabled, allowing the built-in ROMs to be visible) // 32 banks of 16kB (512kB) m_rom_space.resize(32*16384); m_nvram->set_base(&m_rom_space[0],m_rom_space.size()); save_item(NAME(m_rom_space)); }
/// Closes the LocalConnection object. // /// This removes the advanceCallback (so we can be removed by the GC) and /// removes this object as a listener from the shared memory listeners /// section. void LocalConnection_as::close() { // We may be waiting either to send or to receive, so in both cases // make sure update() isn't called again. movie_root& mr = getRoot(owner()); mr.removeAdvanceCallback(this); if (!_connected) return; _connected = false; SharedMem::Lock lock(_shm); if (!lock.locked()) { log_error("Failed to get lock on shared memory! Will not remove " "listener"); return; } removeListener(_domain + ":" + _name, _shm); }
void msx_slot_bunsetsu_device::device_start() { msx_slot_rom_device::device_start(); if (m_bunsetsu_region_tag == nullptr) { fatalerror("msx_slot_bunsetsu_device: no bunsetsu region tag specified\n"); } m_bunsetsu_region = owner()->memregion(m_bunsetsu_region_tag); if (m_bunsetsu_region == nullptr) { fatalerror("msx_slot_bunsetsu_device: Unable to find region with tag '%s'\n", m_bunsetsu_region_tag); } if (m_bunsetsu_region->bytes() != 0x20000) { fatalerror("msx_slot_bunsetsu_device: Bunsetsu region must be 0x20000 bytes.\n"); } }
cell factor_vm::code_block_owner(code_block *compiled) { tagged<object> owner(compiled->owner); /* Cold generic word call sites point to quotations that call the inline-cache-miss and inline-cache-miss-tail primitives. */ if(owner.type_p(QUOTATION_TYPE)) { tagged<quotation> quot(owner.as<quotation>()); tagged<array> elements(quot->array); #ifdef FACTOR_DEBUG assert(array_capacity(elements.untagged()) == 5); assert(array_nth(elements.untagged(),4) == special_objects[PIC_MISS_WORD] || array_nth(elements.untagged(),4) == special_objects[PIC_MISS_TAIL_WORD]); #endif tagged<wrapper> word_wrapper(array_nth(elements.untagged(),0)); return word_wrapper->object; } else return compiled->owner; }
void permission_object_t::test<24>() { LLPermissions perm,perm1; LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); perm.init(creator,owner,lastOwner,group); U32 base = PERM_TRANSFER | PERM_COPY; U32 ownerp = PERM_TRANSFER; U32 groupp = PERM_TRANSFER; U32 everyone = PERM_TRANSFER; U32 next = PERM_NONE; perm.initMasks(base, ownerp, everyone, groupp, next); LLSD sd = ll_create_sd_from_permissions(perm); perm1 = ll_permissions_from_sd(sd); ensure_equals("ll_permissions_from_sd() and ll_create_sd_from_permissions()functions failed", perm, perm1); }
void ScroolWidget::ProxyLayout::applyLayout() { int sw = widgets().size()*spacing(), sh = sw; for( size_t i=0; i<widgets().size(); ++i ){ Tempest::Size s = sizeHint( widgets()[i] ); sw += s.w; sh += s.h; } Widget* sbox = owner()->owner(); Tempest::Size sback, stop; if( widgets().size() ){ sback = sizeHint( widgets().back() ); stop = sizeHint( widgets()[0] ); } if( orientation()==Tempest::Vertical ){ int sscroll = 0; if( scroolBeforeBegin ) sscroll = -std::max(sbox->h()-stop.h, stop.h); if( scroolAfterEnd ) scrool->setRange( sscroll, sh-std::min( sback.h, sbox->h()) ); else scrool->setRange( sscroll, sh-scrool->h() ); owner()->setPosition( 0, -scrool->value() ); owner()->resize( owner()->w(), sh ); } else { int sscroll = 0; if( scroolBeforeBegin ) sscroll = -std::max(sbox->w()-stop.w, stop.w); if( scroolAfterEnd ) scrool->setRange( sscroll, sw-std::min(sback.w, sbox->w()));else scrool->setRange( sscroll, sw-scrool->w() ); owner()->setPosition( -scrool->value(), 0 ); owner()->resize( sw, owner()->h()); } LinearLayout::applyLayout(); }
std::string makeHostname(ClassAd *machineAd, ClassAd *jobAd) { std::string hostname; std::string owner("unknown"); jobAd->LookupString(ATTR_OWNER, owner); hostname += owner; int cluster = 1; int proc = 1; jobAd->LookupInteger(ATTR_CLUSTER_ID, cluster); jobAd->LookupInteger(ATTR_PROC_ID, proc); formatstr_cat(hostname, "-%d.%d-", cluster, proc); std::string machine("host"); machineAd->LookupString(ATTR_MACHINE, machine); hostname += machine; return hostname; }
/* Might GC */ code_block *factor_vm::add_code_block(code_block_type type, cell code_, cell labels_, cell owner_, cell relocation_, cell parameters_, cell literals_) { data_root<byte_array> code(code_,this); data_root<object> labels(labels_,this); data_root<object> owner(owner_,this); data_root<byte_array> relocation(relocation_,this); data_root<array> parameters(parameters_,this); data_root<array> literals(literals_,this); cell code_length = array_capacity(code.untagged()); code_block *compiled = allot_code_block(code_length,type); compiled->owner = owner.value(); /* slight space optimization */ if(relocation.type() == BYTE_ARRAY_TYPE && array_capacity(relocation.untagged()) == 0) compiled->relocation = false_object; else compiled->relocation = relocation.value(); if(parameters.type() == ARRAY_TYPE && array_capacity(parameters.untagged()) == 0) compiled->parameters = false_object; else compiled->parameters = parameters.value(); /* code */ memcpy(compiled + 1,code.untagged() + 1,code_length); /* fixup labels */ if(to_boolean(labels.value())) fixup_labels(labels.as<array>().untagged(),compiled); /* next time we do a minor GC, we have to scan the code heap for literals */ this->code->write_barrier(compiled); this->code->uninitialized_blocks.insert(std::make_pair(compiled,literals.value())); return compiled; }
void adc083x_device::device_start() { clear_sars(); /* resolve callbacks */ m_input_callback.bind_relative_to(*owner()); /* register for state saving */ save_item( NAME(m_cs) ); save_item( NAME(m_clk) ); save_item( NAME(m_di) ); save_item( NAME(m_se) ); save_item( NAME(m_sars) ); save_item( NAME(m_do) ); save_item( NAME(m_sgl) ); save_item( NAME(m_odd) ); save_item( NAME(m_sel1) ); save_item( NAME(m_sel0) ); save_item( NAME(m_state) ); save_item( NAME(m_bit) ); save_item( NAME(m_output) ); }
// ---------------------------------------------------------------------- bool VisEnergyProcessor:: process_message( const ConstMessageHandle& mh ) throw() { const helloworld::HelloworldMessage* hmsg = dynamic_cast<const helloworld::HelloworldMessage*> ( mh.get() ); if( hmsg != NULL ) { last_time_of_receive_=simulation_round(); neighbours_.insert( &hmsg->source() ); cout << "ID '" << owner().label() << "' GOT HELLO FROM '" << hmsg->source().label() << "'" << endl; this->owner_w().remove_tag_by_name("VisBattery"); this->owner_w().add_tag(new shawn::DoubleTag("VisBattery", 0.0)); return true; } this->owner_w().remove_tag_by_name("VisBattery"); this->owner_w().add_tag(new shawn::DoubleTag("VisBattery", 0.0)); return Processor::process_message( mh ); }
// ---------------------------------------------------------------------- bool AutoCastProcessor:: send_to(const ConstDataUnitHandle& duh, shawn::Processor* creator) throw() { if (state() != Processor::Active) return false; LocalDataUnit* ldu = NULL; bool is_new = false; /// Not interested in if is a new DataUnit and disable logging ldu = handle_DataUnit(duh, is_new, false); if (ldu != NULL){ ldu->creator(creator); if (creator) ldu->refresh_before_send(true); int unknown_count = owner().world().simulation_controller().environment().optional_int_param("_unknown_count__send",10); ldu->unknown_count(unknown_count); update(); return true; } return false; }
void psxcard_device::device_start() { m_owner = dynamic_cast<psx_controller_port_device *>(owner()); m_ack_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(psxcard_device::ack_timer), this)); m_ack = true; m_disabled = false; // save state registrations save_item(NAME(pkt)); save_item(NAME(pkt_ptr)); save_item(NAME(pkt_sz)); save_item(NAME(cmd)); save_item(NAME(addr)); save_item(NAME(state)); save_item(NAME(m_disabled)); save_item(NAME(m_odata)); save_item(NAME(m_idata)); save_item(NAME(m_bit)); save_item(NAME(m_count)); save_item(NAME(m_pad)); }
void CWeaponProjectile::UpdateGroundBounce() { if((weaponDef->groundBounce || weaponDef->waterBounce) && (ttl > 0 || weaponDef->numBounce >= 0)) { float wh = 0; if(!weaponDef->waterBounce) { wh = ground->GetHeight2(pos.x, pos.z); } else if(weaponDef->groundBounce) { wh = ground->GetHeight(pos.x, pos.z); } if(pos.y < wh) { bounces++; if(!keepBouncing || (this->weaponDef->numBounce >= 0 && bounces > this->weaponDef->numBounce)) { //Collision(); keepBouncing = false; } else { float3 tempPos = pos; const float3& normal = ground->GetNormal(pos.x, pos.z); pos -= speed; float dot = speed.dot(normal); speed -= (speed + normal*fabs(dot))*(1 - weaponDef->bounceSlip); speed += (normal*(fabs(dot)))*(1 + weaponDef->bounceRebound); pos += speed; if(weaponDef->bounceExplosionGenerator) { weaponDef->bounceExplosionGenerator->Explosion(pos, speed.Length(), 1, owner(), 1, NULL, normal); } } } } }
CORBA::Boolean TAO_AMH_DSI_Exception_Holder::_tao_unmarshal ( TAO_InputCDR &strm, TAO_AMH_DSI_Exception_Holder *&new_object) { ::CORBA::ValueBase *base = 0; ::CORBA::Boolean is_indirected = 0; ::CORBA::Boolean is_null_object = 0; ::CORBA::Boolean const retval = ::CORBA::ValueBase::_tao_unmarshal_pre ( strm, base, TAO_AMH_DSI_Exception_Holder::_tao_obv_static_repository_id (), is_null_object, is_indirected ); ::CORBA::ValueBase_var owner (base); if (!retval) return 0; if (is_null_object) return 1; if (!is_indirected && base != 0 && ! base->_tao_unmarshal_v (strm)) return 0; // Now base must be null or point to the unmarshaled object. // Align the pointer to the right subobject. new_object = TAO_AMH_DSI_Exception_Holder::_downcast (base); if (is_indirected) new_object->_add_ref (); owner._retn (); return 1; }
//------------------------------------------------- // start - channel startup //------------------------------------------------- void z80sio_channel::device_start() { LOG("%s\n",FUNCNAME); m_uart = downcast<z80sio_device *>(owner()); m_index = m_uart->get_channel_index(this); m_variant = ((z80sio_device *)m_owner)->m_variant; // state saving save_item(NAME(m_rr0)); save_item(NAME(m_rr1)); save_item(NAME(m_rr2)); save_item(NAME(m_wr0)); save_item(NAME(m_wr1)); save_item(NAME(m_wr2)); save_item(NAME(m_wr3)); save_item(NAME(m_wr4)); save_item(NAME(m_wr5)); save_item(NAME(m_wr6)); save_item(NAME(m_wr7)); save_item(NAME(m_rx_data_fifo)); save_item(NAME(m_rx_error_fifo)); save_item(NAME(m_rx_error)); save_item(NAME(m_rx_fifo)); save_item(NAME(m_rx_clock)); save_item(NAME(m_rx_first)); save_item(NAME(m_rx_break)); save_item(NAME(m_rx_rr0_latch)); save_item(NAME(m_sh)); save_item(NAME(m_cts)); save_item(NAME(m_dcd)); save_item(NAME(m_tx_data)); save_item(NAME(m_tx_clock)); save_item(NAME(m_dtr)); save_item(NAME(m_rts)); save_item(NAME(m_sync)); save_item(NAME(m_variant)); device_serial_interface::register_save_state(machine().save(), this); }
int Foam::processorCyclicPolyPatch::tag() const { if (tag_ == -1) { // Get unique tag to use for all comms. Make sure that both sides // use the same tag const cyclicPolyPatch& cycPatch = refCast<const cyclicPolyPatch> ( referPatch() ); if (owner()) { tag_ = Hash<word>()(cycPatch.name()) % 32768u; } else { tag_ = Hash<word>()(cycPatch.neighbPatch().name()) % 32768u; } if (tag_ == Pstream::msgType() || tag_ == -1) { FatalErrorIn("processorCyclicPolyPatch::tag() const") << "Tag calculated from cyclic patch name " << tag_ << " is the same as the current message type " << Pstream::msgType() << " or -1" << nl << "Please set a non-conflicting, unique, tag by hand" << " using the 'tag' entry" << exit(FatalError); } if (debug) { Pout<< "processorCyclicPolyPatch " << name() << " uses tag " << tag_ << endl; } } return tag_; }
uint8_t z80dart_channel::data_read() { uint8_t data = 0; if (!m_rx_data_fifo.empty()) { // load data from the FIFO data = m_rx_data_fifo.dequeue(); // load error status from the FIFO m_rr[1] = (m_rr[1] & ~(RR1_CRC_FRAMING_ERROR | RR1_RX_OVERRUN_ERROR | RR1_PARITY_ERROR)) | m_rx_error_fifo.dequeue(); if (m_rx_data_fifo.empty()) { // no more characters available in the FIFO m_rr[0] &= ~ RR0_RX_CHAR_AVAILABLE; } } LOG("Z80DART \"%s\" Channel %c : Data Register Read '%02x'\n", owner()->tag(), 'A' + m_index, data); return data; }
void z80dart_channel::device_start() { m_uart = downcast<z80dart_device *>(owner()); m_index = m_uart->get_channel_index(this); // state saving save_item(NAME(m_rr)); save_item(NAME(m_wr)); // save_item(NAME(m_rx_data_fifo)); // save_item(NAME(m_rx_error_fifo)); save_item(NAME(m_rx_clock)); save_item(NAME(m_rx_first)); save_item(NAME(m_rx_break)); save_item(NAME(m_rx_rr0_latch)); save_item(NAME(m_ri)); save_item(NAME(m_cts)); save_item(NAME(m_dcd)); save_item(NAME(m_tx_data)); save_item(NAME(m_tx_clock)); save_item(NAME(m_dtr)); save_item(NAME(m_rts)); save_item(NAME(m_sync)); }
int main() { std::vector<uint8_t> test = { 'a', 'b', 'c' }; // test non-owning range ByteRange alias(test.data(), test.data() + test.size(), ByteRange::Refer{}); auto alias_copy = alias; VERIFY(!alias.owns() && !alias_copy.owns()); VERIFY(are_equal(alias, alias_copy) && are_identical(alias, alias_copy)); // test owning range ByteRange owner(test.data(), test.data() + test.size(), ByteRange::Copy{}); auto owner_copy = owner; VERIFY(owner.owns() && owner_copy.owns()); VERIFY(are_equal(owner, owner_copy) && !are_identical(owner, owner_copy)); // test cross-type assignments VERIFY((alias = owner, alias.owns())); VERIFY((owner = alias_copy, !owner.owns())); }