/// Asynchronously get the \a memory_block_data maintained by this /// memory_block lcos::future<memory_block_data> get_data_async() { return this->base_type::get_data_async(get_id()); }
/* * * parc number of arguments ('sender' counted as one!) * parv[0] pointer to 'sender' (may point to empty string) (not used) * parv[1]..parv[parc-1] * pointers to additional parameters, this is a NULL * terminated list (parv[parc] == NULL). * * *WARNING* * Numerics are mostly error reports. If there is something * wrong with the message, just *DROP* it! Don't even think of * sending back a neat error message -- big danger of creating * a ping pong error message... */ static void do_numeric(char numeric[], struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { struct Client *target_p; struct Channel *chptr; if(parc < 2 || !IsServer(source_p)) return; /* Remap low number numerics. */ if(numeric[0] == '0') numeric[0] = '1'; /* * Prepare the parameter portion of the message into 'buffer'. * (Because the buffer is twice as large as the message buffer * for the socket, no overflow can occur here... ...on current * assumptions--bets are off, if these are changed --msa) * Note: if buffer is non-empty, it will begin with SPACE. */ if(parc > 1) { char *t = buffer; /* Current position within the buffer */ int i; int tl; /* current length of presently being built string in t */ for (i = 2; i < (parc - 1); i++) { tl = ircsprintf(t, " %s", parv[i]); t += tl; } ircsprintf(t, " :%s", parv[parc - 1]); } if((target_p = find_client(parv[1])) != NULL) { if(IsMe(target_p)) { /* * We shouldn't get numerics sent to us, * any numerics we do get indicate a bug somewhere.. */ /* ugh. this is here because of nick collisions. when two servers * relink, they burst each other their nicks, then perform collides. * if there is a nick collision, BOTH servers will kill their own * nicks, and BOTH will kill the other servers nick, which wont exist, * because it will have been already killed by the local server. * * unfortunately, as we cant guarantee other servers will do the * "right thing" on a nick collision, we have to keep both kills. * ergo we need to ignore ERR_NOSUCHNICK. --fl_ */ /* quick comment. This _was_ tried. i.e. assume the other servers * will do the "right thing" and kill a nick that is colliding. * unfortunately, it did not work. --Dianora */ /* note, now we send PING on server connect, we can * also get ERR_NOSUCHSERVER.. */ if(atoi(numeric) != ERR_NOSUCHNICK && atoi(numeric) != ERR_NOSUCHSERVER) sendto_realops_flags(UMODE_ALL, L_ADMIN, "*** %s(via %s) sent a %s numeric to me: %s", source_p->name, client_p->name, numeric, buffer); return; } else if(target_p->from == client_p) { /* This message changed direction (nick collision?) * ignore it. */ return; } /* csircd will send out unknown umode flag for +a (admin), drop it here. */ if((atoi(numeric) == ERR_UMODEUNKNOWNFLAG) && MyClient(target_p)) return; /* Fake it for server hiding, if its our client */ sendto_one(target_p, ":%s %s %s%s", get_id(source_p, target_p), numeric, get_id(target_p, target_p), buffer); return; } else if((chptr = find_channel(parv[1])) != NULL) sendto_channel_local(ALL_MEMBERS, chptr, ":%s %s %s %s", source_p->name, numeric, chptr->chname, buffer); }
void attach_shader(const shader<T>& shader) { gl::AttachShader(id.get(), get_id(shader)); }
int main(int argc, char **args) { bool verbose = false; bool use_ftd2xx = false; struct cable_t cable; char const *dev = 0; char const *serial = 0; char const *cablename = 0; unsigned int jtag_freq = 0; byte idata[8]; byte odata[8]; int chainpos =0; char *devicedb = NULL; std::auto_ptr<IOBase> io; DeviceDB db(devicedb); int i, res; // Start from parsing command line arguments while(true) { switch(getopt(argc, args, "?hvc:d:J:L")) { case -1: goto args_done; case 'v': verbose = true; break; case 'J': jtag_freq = atoi(optarg); break; case 'L': use_ftd2xx = true; break; case 'c': cablename = optarg; break; case 'd': dev = optarg; break; case 's': serial = optarg; break; case '?': case 'h': default: usage(); } } args_done: // Get rid of options //printf("argc: %d\n", argc); argc -= optind; args += optind; //printf("argc: %d\n", argc); if((argc != 0) || (cablename == 0)) usage(); if (verbose) fprintf(stderr, "Using %s\n", db.getFile().c_str()); CableDB cabledb(0); res = cabledb.getCable(cablename, &cable); res = getIO( &io, &cable, dev, serial, verbose, use_ftd2xx, jtag_freq); if (res) /* some error happend*/ { if (res == 1) exit(1); else usage(); } io.get()->setVerbose(verbose); Jtag jtag(io.get()); jtag.setVerbose(verbose); get_id (jtag, db, chainpos, verbose); if (verbose) fprintf(stderr, "Using %s\n", db.getFile().c_str()); #define CFG_IN 0x05 #define ISC_ENABLE 0x10 #define ISC_DISABLE 0x16 #define JPROGRAM 0x0b #define ISC_DNA 0x31 #define BYPASS 0x3f jtag.selectDevice(chainpos); idata[0] = JPROGRAM; jtag.shiftIR(idata); idata[0] = CFG_IN; do jtag.shiftIR(idata, odata); while (! (odata[0] & 0x10)); /* wait until configuration cleared */ /* As ISC_DNA only works on a unconfigured device, see AR #29977*/ idata[0] = ISC_ENABLE; jtag.shiftIR(idata); idata[0] = ISC_DNA; jtag.shiftIR(idata); jtag.shiftDR(0, odata, 64); if (*(long long*)odata != -1LL) printf("DNA is 0x%02x%02x%02x%02x%02x%02x%02x%02x\n", odata[0], odata[1], odata[2], odata[3], odata[4], odata[5], odata[6], odata[7]); idata[0] = ISC_DISABLE; jtag.shiftIR(idata); /* Release JTAG control over configuration (AR 16829)*/ jtag.tapTestLogicReset(); idata[0] = JPROGRAM; jtag.shiftIR(idata); /* Now device will reconfigure from standard configuration source */ idata[0] = BYPASS; fprintf(stderr, "Will wait up to 10 seconds for device to reconfigure."); fflush(stderr); do { jtag.Usleep(1000); jtag.shiftIR(idata, odata); if(i%250 == 249) { fprintf(stderr, "."); fflush(stderr); } i++; } while ((( odata[0] & 0x23) != 0x21) && (i <10000)); fprintf(stderr, "\n"); return 0; }
twindow* tgame_save_message::build_window(CVideo& video) { return build(video, get_id(GAME_SAVE_MESSAGE)); }
void slot_button::draw(const viewing_gui_context& context, const const_this_in_container& this_id, augs::gui::draw_info info) { if (!this_id->get_flag(augs::gui::flag::ENABLE_DRAWING)) { return; } const auto& step = context.get_step(); const auto& cosmos = step.get_cosmos(); const auto slot_id = cosmos[this_id.get_location().slot_id]; const bool is_hand_slot = slot_id.is_hand_slot(); const auto& detector = this_id->detector; rgba inside_col, border_col; if (slot_id->for_categorized_items_only) { inside_col = violet; } else { inside_col = cyan; } border_col = inside_col; inside_col.a = 4 * 5; border_col.a = 220; if (detector.is_hovered || detector.current_appearance == augs::gui::appearance_detector::appearance::pushed) { inside_col.a = 12 * 5; border_col.a = 255; } const auto inside_tex = assets::texture_id::ATTACHMENT_CIRCLE_FILLED; const auto border_tex = assets::texture_id::ATTACHMENT_CIRCLE_BORDER; const augs::gui::material inside_mat(inside_tex, inside_col); const augs::gui::material border_mat(border_tex, border_col); if (slot_id->always_allow_exactly_one_item) { draw_centered_texture(context, this_id, info, inside_mat); draw_centered_texture(context, this_id, info, border_mat); const auto slot_type = slot_id.get_id().type; if (slot_type == slot_function::PRIMARY_HAND) { draw_centered_texture(context, this_id, info, augs::gui::material(assets::texture_id::PRIMARY_HAND_ICON, border_col), vec2i(1, 0)); } if (slot_type == slot_function::SECONDARY_HAND) { draw_centered_texture(context, this_id, info, augs::gui::material(assets::texture_id::SECONDARY_HAND_ICON, border_col)); } if (slot_type == slot_function::SHOULDER_SLOT) { draw_centered_texture(context, this_id, info, augs::gui::material(assets::texture_id::SHOULDER_SLOT_ICON, border_col)); } if (slot_type == slot_function::TORSO_ARMOR_SLOT) { draw_centered_texture(context, this_id, info, augs::gui::material(assets::texture_id::ARMOR_SLOT_ICON, border_col)); } if (slot_type == slot_function::GUN_CHAMBER) { draw_centered_texture(context, this_id, info, augs::gui::material(assets::texture_id::CHAMBER_SLOT_ICON, border_col)); } if (slot_type == slot_function::GUN_MUZZLE) { draw_centered_texture(context, this_id, info, augs::gui::material(assets::texture_id::GUN_MUZZLE_SLOT_ICON, border_col)); } if (slot_type == slot_function::GUN_DETACHABLE_MAGAZINE) { draw_centered_texture(context, this_id, info, augs::gui::material(assets::texture_id::DETACHABLE_MAGAZINE_ICON, border_col)); } } else { draw_centered_texture(context, this_id, info, inside_mat); draw_centered_texture(context, this_id, info, border_mat); const auto space_available_text = augs::gui::text::format(to_wstring(slot_id.calculate_free_space_with_parent_containers() / long double(SPACE_ATOMS_PER_UNIT), 2, true) , augs::gui::text::style(assets::font_id::GUI_FONT, border_col)); augs::gui::text_drawer space_caption; space_caption.set_text(space_available_text); space_caption.center(context.get_tree_entry(this_id).get_absolute_rect()); space_caption.draw(info); draw_children(context, this_id, info); } if (slot_id.get_container().get_owning_transfer_capability() != slot_id.get_container()) { const_dereferenced_location<item_button_in_item> child_item_button = context.dereference_location(item_button_in_item{ slot_id.get_container().get_id() }); draw_pixel_line_connector(context.get_tree_entry(this_id).get_absolute_rect(), context.get_tree_entry(child_item_button).get_absolute_rect(), info, border_col); } }
void cScreenCentreManagement::set_ids() { ids_set = true; back_id = get_id("BackButton"); curcentre_id = get_id("Centre"); girllist_id = get_id("GirlList"); girlimage_id = get_id("GirlImage"); girldesc_id = get_id("GirlDescription"); viewdetails_id = get_id("ViewDetailsButton"); freeslave_id = get_id("FreeSlaveButton"); transfer_id = get_id("TransferButton"); jobtypehead_id = get_id("JobTypeHeader"); jobtypelist_id = get_id("JobTypeList"); jobtypedesc_id = get_id("JobTypeDescription"); jobhead_id = get_id("JobHeader"); joblist_id = get_id("JobList"); jobdesc_id = get_id("JobDescription"); day_id = get_id("DayButton"); night_id = get_id("NightButton"); //Set the default sort order for columns, so listbox knows the order in which data will be sent SortColumns(girllist_id, m_ListBoxes[girllist_id]->m_ColumnName, m_ListBoxes[girllist_id]->m_ColumnCount); }
lcos::future<void> checkin_async( components::access_memory_block<T> const& data) { return this->base_type::checkin_async(get_id(), data); }
input_subscriber_type get_subscriber() const { return make_subscriber<T>(get_id(), get_subscription(), observer<T, detail::multicast_observer<T>>(*this)); }
/// Asynchronously clone the \a memory_block_data maintained by this /// memory_block lcos::future<naming::id_type> clone_async() { return this->base_type::clone_async(get_id()); }
void checkin(components::access_memory_block<T> const& data) { this->base_type::checkin(get_id(), data); }
/////////////////////////////////////////////////////////////////////// /// Clone the \a memory_block_data maintained by this memory_block naming::id_type clone() { return this->base_type::clone(get_id()); }
/// Asynchronously get the \a memory_block_data maintained by this /// memory_block. Use given data for serialization configuration (will /// be passed to the save() function exposed by the datatype instance /// wrapped in the return value of this get()) lcos::future<memory_block_data> get_data_async( memory_block_data const& config) { return this->base_type::get_data_async(get_id(), config); }
/// Get the \a memory_block_data maintained by this memory_block, use /// given data for serialization configuration (will be passed to the /// save() function exposed by the datatype instance wrapped in the /// return value of this get()) memory_block_data get_data(memory_block_data const& config) { return this->base_type::get_data(get_id(), config); }
twindow* ttransient_message::build_window(CVideo& video) { return build(video, get_id(TRANSIENT_MESSAGE)); }
void override_enable(bool on) { tomato::enable_toolbar_button(m_toolbar, get_id(), on); }
std::string Addon::get_filename() const { return get_id() + ".zip"; }
void override_set_check(int state) { BOOST_ASSERT(0 <= state && state <= 2); // 0=>off, 1=>on, 2=>indeterminate tomato::check_toolbar_button(m_toolbar, get_id(), state); }
/* * m_topic * parv[1] = channel name * parv[2] = new topic, if setting topic */ static int m_topic(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { struct Channel *chptr = NULL; struct membership *msptr; char *p = NULL; const char *name; int operspy = 0; if((p = strchr(parv[1], ','))) *p = '\0'; name = parv[1]; if(IsOperAuspex(source_p) && parv[1][0] == '!') { name++; operspy = 1; if(EmptyString(name)) { sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "TOPIC"); return 0; } } if(MyClient(source_p) && !IsFloodDone(source_p)) flood_endgrace(source_p); if(!IsChannelName(name)) { sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name); return 0; } chptr = find_channel(name); if(chptr == NULL) { sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name); return 0; } /* setting topic */ if(parc > 2) { char topic_info[USERHOST_REPLYLEN]; char topic[BUFSIZE]; msptr = find_channel_membership(chptr, source_p); if(msptr == NULL) { sendto_one_numeric(source_p, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL), name); return 0; } if(MyClient(source_p) && (chptr->mode.mode & MODE_TOPICLIMIT) && !is_chanop(msptr)) { if(IsOverride(source_p)) sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s is overriding TOPIC on [%s]", get_oper_name(source_p), chptr->chname); else { sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), get_id(&me, source_p), get_id(source_p, source_p), name); return 0; } } rb_strlcpy(topic, parv[2], BUFSIZE); /* strip_colour(topic); -- draco */ rb_sprintf(topic_info, "%s!%s@%s", source_p->name, source_p->username, source_p->host); set_channel_topic(chptr, topic, topic_info, rb_current_time()); sendto_server(client_p, chptr, CAP_TS6, NOCAPS, ":%s TOPIC %s :%s", use_id(source_p), chptr->chname, chptr->topic == NULL ? "" : chptr->topic); sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s TOPIC %s :%s", source_p->name, source_p->username, source_p->host, chptr->chname, chptr->topic == NULL ? "" : chptr->topic); } else if(MyClient(source_p)) { if(operspy) report_operspy(source_p, "TOPIC", chptr->chname); if(!IsMember(source_p, chptr) && SecretChannel(chptr) && !operspy) { sendto_one_numeric(source_p, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL), name); return 0; } if(chptr->topic == NULL) sendto_one(source_p, form_str(RPL_NOTOPIC), me.name, source_p->name, name); else { sendto_one(source_p, form_str(RPL_TOPIC), me.name, source_p->name, chptr->chname, chptr->topic); sendto_one(source_p, form_str(RPL_TOPICWHOTIME), me.name, source_p->name, chptr->chname, chptr->topic_info, chptr->topic_time); } } return 0; }
void editor_palette<Item>::draw_contents() { toolkit_.set_mouseover_overlay(gui_); std::shared_ptr<gui::button> palette_menu_button = gui_.find_menu_button("menu-editor-terrain"); if (palette_menu_button) { t_string& name = groups_[active_group_index()].name; std::string& icon = groups_[active_group_index()].icon; palette_menu_button->set_tooltip_string(name); palette_menu_button->set_overlay(icon); } unsigned int y = palette_y_; unsigned int x = palette_x_; int starting = items_start_; int ending = std::min<int>(starting + nitems_, num_items()); std::shared_ptr<gui::button> upscroll_button = gui_.find_action_button("upscroll-button-editor"); if (upscroll_button) upscroll_button->enable(starting != 0); std::shared_ptr<gui::button> downscroll_button = gui_.find_action_button("downscroll-button-editor"); if (downscroll_button) downscroll_button->enable(ending != num_items()); int counter = starting; for (int i = 0, size = num_visible_items(); i < size ; ++i) { //TODO check if the conditions still hold for the counter variable //for (unsigned int counter = starting; counter < ending; counter++) gui::tristate_button& tile = buttons_[i]; tile.hide(true); if (i >= ending) continue; const std::string item_id = active_group()[counter]; //typedef std::map<std::string, Item> item_map_wurscht; typename item_map::iterator item = item_map_.find(item_id); surface item_image(nullptr); std::stringstream tooltip_text; draw_item((*item).second, item_image, tooltip_text); bool is_core = non_core_items_.find(get_id((*item).second)) == non_core_items_.end(); if (!is_core) { tooltip_text << " " << font::span_color(font::BAD_COLOR) << _("(non-core)") << "\n" << _("Will not work in game without extra care.") << "</span>"; } const int counter_from_zero = counter - starting; SDL_Rect dstrect; dstrect.x = x + (counter_from_zero % item_width_) * item_space_; dstrect.y = y; dstrect.w = item_size_ + 2; dstrect.h = item_size_ + 2; tile.set_location(dstrect); tile.set_tooltip_string(tooltip_text.str()); tile.set_item_image(item_image); tile.set_item_id(item_id); // if (get_id((*item).second) == selected_bg_item_ // && get_id((*item).second) == selected_fg_item_) { // tile.set_pressed(gui::tristate_button::BOTH); // } else if (get_id((*item).second) == selected_bg_item_) { // tile.set_pressed(gui::tristate_button::RIGHT); // } else if (get_id((*item).second) == selected_fg_item_) { // tile.set_pressed(gui::tristate_button::LEFT); // } else { // tile.set_pressed(gui::tristate_button::NONE); // } if (is_selected_bg_item(get_id(item->second)) && is_selected_fg_item(get_id(item->second))) { tile.set_pressed(gui::tristate_button::BOTH); } else if (is_selected_bg_item(get_id(item->second))) { tile.set_pressed(gui::tristate_button::RIGHT); } else if (is_selected_fg_item(get_id(item->second))) { tile.set_pressed(gui::tristate_button::LEFT); } else { tile.set_pressed(gui::tristate_button::NONE); } tile.set_dirty(true); tile.hide(false); tile.draw(); // Adjust location if (counter_from_zero % item_width_ == item_width_ - 1) y += item_space_; ++counter; } }
int main(int argc, char ** argv) { int anum; char *ctmp; int i; int flag; int state1; FILE *inf; struct dentry *etmp; struct dentry *eroot; struct dentry *elast; anum=1; state1=0; eroot=0; elast=0; etmp=0; while (anum<argc) { #ifdef DEBUG printf("reading file %s\n",argv[anum]); #endif inf=fopen(argv[anum],"r"); if (!inf) { printf("error opening file\n"); printf("warning: file \"%s\" skipped\n",argv[anum]); continue; } while (fgets(buf,BUF_LEN,inf)) { /* ignore empty lines */ if ((i=eat_spaces(0))<0) continue; switch (state1) { case 0: { /* wait for new function header */ if ((i=str_chk(";;",i))<0) break; if ((i=str_chk("function:",i))>0) { ctmp=get_id(i); etmp=(struct dentry*) malloc(sizeof(struct dentry)); if (!etmp) { printf("out of memory\n"); exit(1); } etmp->function=str_dup(ctmp); etmp->in_list=0; etmp->out_list=0; etmp->comment=0; etmp->changes=0; etmp->calls=0; etmp->next=0; state1=1; } break; } case 1: { /* read rest of function header */ if ((i=str_chk(";;",i))<0) { /* end of function header reached */ #ifdef DEBUG printf("==> add function\n"); printf(" name =%s\n",etmp->function); /* printf(" inputs =%s\n",etmp->in_list); */ /* printf(" outputs =%s\n",etmp->out_list); */ /* printf(" comment =%s\n",etmp->comment); */ printf(" calls =%s\n",etmp->calls); printf(" changes =%s\n",etmp->changes); #endif if (elast) elast->next=etmp; else eroot=etmp; elast=etmp; state1=0; } else { int k; if ((k=str_chk("<",i))>0) { /* add to in_list */ ctmp=add_str(etmp->in_list,&buf[k]); REPL(etmp->in_list,ctmp); break; } if ((k=str_chk(">",i))>0) { /* add to out_list */ ctmp=add_str(etmp->out_list,&buf[k]); REPL(etmp->out_list,ctmp); break; } if ((k=str_chk("calls:",i))>0) { /* add to calls */ ctmp=get_id(k); k=strlen(ctmp); ctmp[k]='\n'; ctmp[k+1]=0; ctmp=add_str(etmp->calls,ctmp); REPL(etmp->calls,ctmp); break; } if ((k=str_chk("changes:",i))>0) { /* add to changes */ ctmp=get_id(k); k=strlen(ctmp); ctmp[k]='\n'; ctmp[k+1]=0; ctmp=add_str(etmp->changes,ctmp); REPL(etmp->changes,ctmp); break; } /* add to comment */ ctmp=add_str(etmp->comment,&buf[i]); REPL(etmp->comment,ctmp); } break; } default: ; } } fclose(inf); anum++; } /* expand all elements in changes sections */ etmp=eroot; while (etmp) { int bp; int l,k; bp=0; ctmp=etmp->changes; if (ctmp) { #ifdef DEBUG printf("\"%s\" expands to\n",ctmp); #endif while (*ctmp) { i=0; while (ctmp[i]!='\n' && ctmp[i]!='(') i++; k=i; if (ctmp[i]!='\n') { while (ctmp[i]!=')') { i++; for (l=0; l<k; l++) buf[bp++]=ctmp[l]; while (isalnum(ctmp[i])) buf[bp++]=ctmp[i++]; buf[bp++]='\n'; } i++; } else { for (l=0; l<k; l++) buf[bp++]=ctmp[l]; buf[bp++]='\n'; } ctmp=&ctmp[i+1]; } buf[bp]='\0'; #ifdef DEBUG printf("\"%s\"\n",buf); #endif ctmp=str_dup(buf); REPL(etmp->changes,ctmp); } etmp=etmp->next; } /* expand all calls */ flag=1; while (flag) { int k,l; #ifdef DEBUG printf("<--- new pass --->\n"); #endif flag=0; etmp=eroot; while (etmp) { char calls_buf[BUF_LEN]; char changes_buf[BUF_LEN]; char ch_tmp[32]; char ca_tmp[32]; int calls_bp; int changes_bp; #ifdef DEBUG printf("working on %s\n",etmp->function); #endif if (etmp->changes) { strcpy(changes_buf,etmp->changes); changes_bp=strlen(changes_buf); } else { *changes_buf=0; changes_bp=0; } *calls_buf=0; calls_bp=0; ctmp=etmp->calls; while (ctmp && *ctmp) { struct dentry *etmp2; i=0; while (ctmp[i]!='\n') { ca_tmp[i]=ctmp[i]; i++; } ca_tmp[i]='\0'; ctmp=&ctmp[i+1]; #ifdef DEBUG printf("examine \"%s\"\n",ca_tmp); #endif etmp2=eroot; while (etmp2) { if (!strcmp(etmp2->function,ca_tmp) && etmp2->calls==0) { char *ctmp2; char *ctmp3; #ifdef DEBUG printf("expanding function %s for %s\n",ca_tmp,etmp->function); #endif ctmp2=etmp2->changes; while (ctmp2 && *ctmp2) { int flag2; k=0; while (ctmp2[k]!='\n') { ch_tmp[k]=ctmp2[k]; k++; } ch_tmp[k]='\0'; ctmp3=changes_buf; flag2=0; while (*ctmp3) { l=0; while (ch_tmp[l] && ch_tmp[l]==ctmp3[l]) l++; if (!ch_tmp[l] && ctmp3[l]=='\n') { printf("warning: %s->%s might cause inconsistency in %s\n", etmp->function, ca_tmp, ch_tmp); flag2=1; } while (*ctmp3++!='\n'); } if (!flag2) { /* adding changes */ printf(" <= %s\n",ch_tmp); l=0; while (ch_tmp[l]) changes_buf[changes_bp++]=ch_tmp[l++]; changes_buf[changes_bp++]='\n'; changes_buf[changes_bp]=0; } ctmp2=&ctmp2[k+1]; } flag=1; break; } etmp2=etmp2->next; } if (!etmp2) { /* function has not been expanded, so keep its name in the list */ i=0; while (ca_tmp[i]) calls_buf[calls_bp++]=ca_tmp[i++]; calls_buf[calls_bp++]='\n'; calls_buf[calls_bp]=0; } } if (etmp->calls) free(etmp->calls); if (calls_buf[0]) etmp->calls=str_dup(calls_buf); else etmp->calls=0; if (etmp->changes) free(etmp->changes); if (changes_buf[0]) etmp->changes=str_dup(changes_buf); else etmp->changes=0; etmp=etmp->next; } } /* dump results */ printf("\nSummary\n=======\n"); etmp=eroot; while (etmp) { printf("\n Name = %s",etmp->function); printf("\n inputs = %s",etmp->in_list); printf("\n outputs = %s",etmp->out_list); printf("\n comment = %s",etmp->comment); printf("\n Changes = "); print_str(etmp->changes); if (etmp->calls) printf("\n Unresolved calls = "); print_str(etmp->calls); printf("\n"); etmp=etmp->next; } return 0; }
void remider_remover_from_history(char *ID){ int iID = get_id(ID); ReminderTable.reminder[iID].in_use = FALSE; roadmap_history_delete_entry(ReminderTable.reminder[iID].history); }
static int forward_query(int udpfd, union mysockaddr *udpaddr, struct all_addr *dst_addr, unsigned int dst_iface, struct dns_header *header, size_t plen, time_t now, struct frec *forward) { char *domain = NULL; int type = 0, norebind = 0; struct all_addr *addrp = NULL; unsigned int crc = questions_crc(header, plen, daemon->namebuff); unsigned int flags = 0; unsigned int gotname = extract_request(header, plen, daemon->namebuff, NULL); struct server *start = NULL; /* RFC 4035: sect 4.6 para 2 */ header->hb4 &= ~HB4_AD; /* may be no servers available. */ if (!daemon->servers) forward = NULL; else if (forward || (forward = lookup_frec_by_sender(ntohs(header->id), udpaddr, crc))) { /* retry on existing query, send to all available servers */ domain = forward->sentto->domain; forward->sentto->failed_queries++; if (!option_bool(OPT_ORDER)) { forward->forwardall = 1; daemon->last_server = NULL; } type = forward->sentto->flags & SERV_TYPE; if (!(start = forward->sentto->next)) start = daemon->servers; /* at end of list, recycle */ header->id = htons(forward->new_id); } else { if (gotname) flags = search_servers(now, &addrp, gotname, daemon->namebuff, &type, &domain, &norebind); if (!flags && !(forward = get_new_frec(now, NULL))) /* table full - server failure. */ flags = F_NEG; if (forward) { forward->source = *udpaddr; forward->dest = *dst_addr; forward->iface = dst_iface; forward->orig_id = ntohs(header->id); forward->new_id = get_id(crc); forward->fd = udpfd; forward->crc = crc; forward->forwardall = 0; if (norebind) forward->flags |= FREC_NOREBIND; if (header->hb4 & HB4_CD) forward->flags |= FREC_CHECKING_DISABLED; header->id = htons(forward->new_id); /* In strict_order mode, always try servers in the order specified in resolv.conf, if a domain is given always try all the available servers, otherwise, use the one last known to work. */ if (type == 0) { if (option_bool(OPT_ORDER)) start = daemon->servers; else if (!(start = daemon->last_server) || daemon->forwardcount++ > FORWARD_TEST || difftime(now, daemon->forwardtime) > FORWARD_TIME) { start = daemon->servers; forward->forwardall = 1; daemon->forwardcount = 0; daemon->forwardtime = now; } } else { start = daemon->servers; if (!option_bool(OPT_ORDER)) forward->forwardall = 1; } } } /* check for send errors here (no route to host) if we fail to send to all nameservers, send back an error packet straight away (helps modem users when offline) */ if (!flags && forward) { struct server *firstsentto = start; int forwarded = 0; if (udpaddr && option_bool(OPT_ADD_MAC)) plen = add_mac(header, plen, ((char *) header) + PACKETSZ, udpaddr); while (1) { /* only send to servers dealing with our domain. domain may be NULL, in which case server->domain must be NULL also. */ if (type == (start->flags & SERV_TYPE) && (type != SERV_HAS_DOMAIN || hostname_isequal(domain, start->domain)) && !(start->flags & SERV_LITERAL_ADDRESS)) { int fd; /* find server socket to use, may need to get random one. */ if (start->sfd) fd = start->sfd->fd; else { #ifdef HAVE_IPV6 if (start->addr.sa.sa_family == AF_INET6) { if (!forward->rfd6 && !(forward->rfd6 = allocate_rfd(AF_INET6))) break; daemon->rfd_save = forward->rfd6; fd = forward->rfd6->fd; } else #endif { if (!forward->rfd4 && !(forward->rfd4 = allocate_rfd(AF_INET))) break; daemon->rfd_save = forward->rfd4; fd = forward->rfd4->fd; } #ifdef HAVE_CONNTRACK /* Copy connection mark of incoming query to outgoing connection. */ if (option_bool(OPT_CONNTRACK)) { unsigned int mark; if (get_incoming_mark(udpaddr, dst_addr, 0, &mark)) setsockopt(fd, SOL_SOCKET, SO_MARK, &mark, sizeof(unsigned int)); } #endif } if (sendto(fd, (char *)header, plen, 0, &start->addr.sa, sa_len(&start->addr)) == -1) { if (retry_send()) continue; } else { /* Keep info in case we want to re-send this packet */ daemon->srv_save = start; daemon->packet_len = plen; if (!gotname) strcpy(daemon->namebuff, "query"); if (start->addr.sa.sa_family == AF_INET) log_query(F_SERVER | F_IPV4 | F_FORWARD, daemon->namebuff, (struct all_addr *)&start->addr.in.sin_addr, NULL); #ifdef HAVE_IPV6 else log_query(F_SERVER | F_IPV6 | F_FORWARD, daemon->namebuff, (struct all_addr *)&start->addr.in6.sin6_addr, NULL); #endif start->queries++; forwarded = 1; forward->sentto = start; if (!forward->forwardall) break; forward->forwardall++; } } if (!(start = start->next)) start = daemon->servers; if (start == firstsentto) break; } if (forwarded) return 1; /* could not send on, prepare to return */ header->id = htons(forward->orig_id); free_frec(forward); /* cancel */ } /* could not send on, return empty answer or address if known for whole domain */ if (udpfd != -1) { plen = setup_reply(header, plen, addrp, flags, daemon->local_ttl); send_from(udpfd, option_bool(OPT_NOWILD), (char *)header, plen, udpaddr, dst_addr, dst_iface, NULL); } return 0; }
static void OnReminderShortClick (const char *name, const char *sprite, const char *image, const RoadMapGpsPosition *gps_position, const RoadMapGuiPoint *offset, BOOL is_visible, int scale, int opacity, const char *id, const char *text){ SsdWidget button; SsdWidget spacer; SsdWidget txt; SsdWidget bg; RoadMapPosition Pos; Pos.latitude = gps_position->latitude; Pos.longitude = gps_position->longitude; if (ssd_dialog_is_currently_active() && (!strcmp(ssd_dialog_currently_active_name(), REMINDER_POP_DLG_NAME))) ssd_dialog_hide_current(dec_close); bg = create_reminder_dlg(); if (get_id(id) != -1){ char msg[250]; int rem_distance; Reminder reminder; SsdWidget container; container = ssd_container_new( "container_txt", "", SSD_MIN_SIZE, SSD_MIN_SIZE, 0 ); ssd_widget_set_color( container, NULL, NULL ); reminder = ReminderTable.reminder[get_id(id)]; txt = ssd_text_new("reminder_title",&reminder.title[0] ,22, SSD_END_ROW); ssd_text_set_color(txt, "#ab5939"); ssd_widget_set_offset(txt, 25, 0); ssd_widget_add(container, txt); spacer = ssd_container_new( "space", "", SSD_MIN_SIZE, 10, SSD_END_ROW ); ssd_widget_set_color( spacer, NULL, NULL ); ssd_widget_add( container, spacer ); txt = ssd_text_new("reminder_desc",&reminder.description[0] ,18, SSD_END_ROW); ssd_text_set_color(txt, "#ab5939"); ssd_widget_set_offset(txt, 30, 0); ssd_widget_add(container, txt); spacer = ssd_container_new( "space", "", SSD_MIN_SIZE, 10, SSD_END_ROW ); ssd_widget_set_color( spacer, NULL, NULL ); ssd_widget_add( container, spacer ); rem_distance = roadmap_math_to_trip_distance_tenths(reminder.distance); sprintf(msg, roadmap_lang_get("Distance to remind: %.1f %s"),rem_distance/10.0, roadmap_lang_get(roadmap_math_trip_unit()) ); txt = ssd_text_new("reminder_dist",&msg[0] ,14, SSD_END_ROW); ssd_text_set_color(txt, "#ab5939"); ssd_widget_set_offset(txt, 30, 0); ssd_widget_add(container, txt); ssd_widget_add( bg, container ); } #ifdef TOUCH_SCREEN button = create_close_button(); ssd_widget_add(bg, button); button = create_del_button(); ssd_widget_set_offset(button, 0, -20); button->context = strdup(id); ssd_widget_add(bg, button); #endif //TOUCH_SCREEN show_reminder_dlg(); }
twindow* tgame_save_oos::build_window(CVideo& video) { return build(video, get_id(GAME_SAVE_OOS)); }
int func1() { hpx::cout << "func1 thread id: " << hpx::this_thread::get_id() << hpx::endl; return get_id(1) ? 123 : 0; }
void actor::broadcast_message(message& msg) { _Imp->mgr->broadcast_message(get_id(), msg); }
bool CheckMKServer::loadModuleEx(std::string alias, NSCAPI::moduleLoadMode mode) { root_ = get_base_path(); nscp_runtime_.reset(new scripts::nscp::nscp_runtime_impl(get_id(), get_core())); lua_runtime_.reset(new lua::lua_runtime(utf8::cvt<std::string>(root_.string()))); lua_runtime_->register_plugin(boost::shared_ptr<check_mk::check_mk_plugin>(new check_mk::check_mk_plugin())); scripts_.reset(new scripts::script_manager<lua::lua_traits>(lua_runtime_, nscp_runtime_, get_id(), utf8::cvt<std::string>(alias))); handler_.reset(new handler_impl(scripts_)); sh::settings_registry settings(get_settings_proxy()); settings.set_alias("check_mk", alias, "server"); settings.alias().add_path_to_settings() ("CHECK MK SERVER SECTION", "Section for check_mk (CheckMKServer.dll) protocol options.") ("scripts", sh::fun_values_path(boost::bind(&CheckMKServer::add_script, this, _1, _2)), "REMOTE TARGET DEFINITIONS", "", "TARGET", "For more configuration options add a dedicated section") ; settings.alias().add_key_to_settings() ("port", sh::string_key(&info_.port_, "6556"), "PORT NUMBER", "Port to use for check_mk.") ; socket_helpers::settings_helper::add_core_server_opts(settings, info_); socket_helpers::settings_helper::add_ssl_server_opts(settings, info_, false); settings.register_all(); settings.notify(); if (scripts_->empty()) { add_script("default", "default_check_mk.lua"); } #ifndef USE_SSL if (info_.use_ssl) { NSC_LOG_ERROR_STD(_T("SSL not avalible! (not compiled with openssl support)")); return false; } #endif NSC_LOG_ERROR_LISTS(info_.validate()); std::list<std::string> errors; info_.allowed_hosts.refresh(errors); NSC_LOG_ERROR_LISTS(errors); NSC_DEBUG_MSG_STD("Allowed hosts definition: " + info_.allowed_hosts.to_string()); boost::asio::io_service io_service_; scripts_->load_all(); if (mode == NSCAPI::normalStart) { server_.reset(new check_mk::server::server(info_, handler_)); if (!server_) { NSC_LOG_ERROR_STD("Failed to create server instance!"); return false; } server_->start(); } return true; }
void detach_shader(const shader<T>& shader) { gl::DetachShader(id.get(), get_id(shader)); }
/// Get the \a memory_block_data maintained by this memory_block memory_block_data get_data() { return this->base_type::get_data(get_id()); }