void string_write(char *mystring) { int i; get_current_address(); //printf("writing string\n"); for (i=0; i<strlen(mystring); i++) { char_write(mystring[i]); get_current_address(); } }
//write a substring to the LCD void string_write_numchars(char *mystring, int num_chars) { int i; get_current_address(); //printf("writing string\n"); for (i=0; i<num_chars; i++) { if (i >= strlen(mystring)) break; char_write(mystring[i]); get_current_address(); } }
/// \brief Create a new GID (if called for the first time), assign this /// GID to this instance of a component and register this gid /// with the AGAS service /// /// \returns The global id (GID) assigned to this instance of a /// component naming::gid_type get_base_gid( naming::gid_type const& assign_gid = naming::invalid_gid) const { if (!gid_) { naming::address addr(get_current_address()); if (!assign_gid) { gid_ = hpx::detail::get_next_id(); if (!applier::bind_gid_local(gid_, addr)) { std::ostringstream strm; strm << "failed to bind id " << gid_ << "to locality: " << hpx::get_locality(); gid_ = naming::invalid_gid; // invalidate GID HPX_THROW_EXCEPTION(duplicate_component_address, "simple_component_base<Component>::get_base_gid", strm.str()); } } else { applier::applier& appl = hpx::applier::get_applier(); gid_ = assign_gid; naming::detail::strip_credits_from_gid(gid_); if (!agas::bind_sync(gid_, addr, appl.get_locality_id())) { std::ostringstream strm; strm << "failed to rebind id " << gid_ << "to locality: " << hpx::get_locality(); gid_ = naming::invalid_gid; // invalidate GID HPX_THROW_EXCEPTION(duplicate_component_address, "simple_component_base<Component>::get_base_gid", strm.str()); } } } naming::gid_type::mutex_type::scoped_lock l(gid_.get_mutex()); if (!naming::detail::has_credits(gid_)) { naming::gid_type gid = gid_; return gid; } // on first invocation take all credits to avoid a self reference naming::gid_type gid = gid_; naming::detail::strip_credits_from_gid( const_cast<naming::gid_type&>(gid_)); HPX_ASSERT(naming::detail::has_credits(gid)); // We have to assume this credit was split as otherwise the gid // returned at this point will control the lifetime of the // component. naming::detail::set_credit_split_mask_for_gid(gid); return gid; }