player * loadScore(int score, int color, char logo[23][35]){ erase(); int tmarg=35, lmarg=(winw-12)/2,i; player * newplayer=(player*)calloc(sizeof(player),1); char * buffer; chtype names[4][10]={{'B','l','u','e','b','e','l','l',0},{'G','r','e','e','n','l','e','e',0},{'F','r','e','d',0},{'G','r','e','y','d','o','n',0}}; int color_options[]={BLUE_BLACK,GREEN_BLACK,RED_BLACK,WHITE_BLACK}; add_logo(5, 18, logo); mvaddch(tmarg+3,lmarg,ACS_ULCORNER|COLOR_PAIR(YELLOW_BLACK)|A_BOLD); mvaddch(tmarg+4,lmarg,ACS_VLINE|COLOR_PAIR(YELLOW_BLACK)|A_BOLD); mvaddch(tmarg+5,lmarg,ACS_LLCORNER|COLOR_PAIR(YELLOW_BLACK)|A_BOLD); mvaddch(tmarg+3,lmarg+12,ACS_URCORNER|COLOR_PAIR(YELLOW_BLACK)|A_BOLD); mvaddch(tmarg+4,lmarg+12,ACS_VLINE|COLOR_PAIR(YELLOW_BLACK)|A_BOLD); mvaddch(tmarg+5,lmarg+12,ACS_LRCORNER|COLOR_PAIR(YELLOW_BLACK)|A_BOLD); for(i=1;i<12;i++){ mvaddch(tmarg+3,lmarg+i,ACS_HLINE|COLOR_PAIR(YELLOW_BLACK)|A_BOLD); mvaddch(tmarg+5,lmarg+i,ACS_HLINE|COLOR_PAIR(YELLOW_BLACK)|A_BOLD); } chtype hs[]={'N','e','w',' ', 'h','i','g','h','s','c','o','r','e',' ',':', ' ', 0}; add_chstring(tmarg,lmarg,hs,color_options[color],1); add_chstring(tmarg,lmarg+16,names[color],color_options[color],1); buffer=name_input(lmarg+1,tmarg+4,10,color_options[color]); strcpy(newplayer->name,buffer); free(buffer); newplayer->score=score; return newplayer; }
void init_entries(cell *up) { xsp = &ps[META_PS_SIZE]; name_input(INIT_FILENAME, up); while (1) { query(up); cinterpret(up); } }
symbol_exprt local_SSAt::name( const ssa_objectt &object, const ssa_domaint::deft &def) const { if(def.is_input()) return name_input(object); else if(def.is_phi()) return name(object, PHI, def.loc); else return name(object, OUT, def.loc); }
symbol_exprt local_SSAt::read_rhs( const ssa_objectt &object, locationt loc) const { const irep_idt &identifier=object.get_identifier(); const ssa_domaint &ssa_domain=ssa_analysis[loc]; ssa_domaint::def_mapt::const_iterator d_it= ssa_domain.def_map.find(identifier); if(d_it==ssa_domain.def_map.end()) { // not written so far, it's input return name_input(object); } else return name(object, d_it->second.def); }
exprt local_SSAt::read_node_in( const ssa_objectt &object, locationt loc) const { // This reads: // * LOOP_BACK if there is a LOOP node at 'loc' for symbol // * OUT otherwise const irep_idt &identifier=object.get_identifier(); const ssa_domaint &ssa_domain=ssa_analysis[loc]; ssa_domaint::def_mapt::const_iterator d_it= ssa_domain.def_map.find(identifier); if(d_it==ssa_domain.def_map.end()) return name_input(object); // not written so far const ssa_domaint::phi_nodest &phi_nodes=ssa_analysis[loc].phi_nodes; ssa_domaint::phi_nodest::const_iterator p_it= phi_nodes.find(identifier); bool has_phi=false; if(p_it!=phi_nodes.end()) { const std::map<locationt, ssa_domaint::deft> &incoming=p_it->second; for(std::map<locationt, ssa_domaint::deft>::const_iterator incoming_it=incoming.begin(); incoming_it!=incoming.end(); incoming_it++) { if(incoming_it->first->location_number > loc->location_number) has_phi=true; } } if(has_phi) return name(object, LOOP_BACK, loc); else return read_rhs(object, loc); }
void doload(cell *up) { V(BOUNDARY) = V(DP) - V(TORIGIN); V(NUM_USER) = NEXT_VAR*sizeof(cell); name_input(infile, up); }
exprt local_SSAt::read_rhs_rec(const exprt &expr, locationt loc) const { if(expr.id()==ID_side_effect) { throw "unexpected side effect in read_rhs_rec"; } else if(expr.id()==ID_address_of) { address_of_exprt tmp=to_address_of_expr(expr); tmp.object()=read_rhs_address_of_rec(tmp.object(), loc); return address_canonizer(tmp, ns); } else if(expr.id()==ID_dereference) { throw "unexpected dereference in read_rhs_rec"; } else if(expr.id()==ID_index) { const index_exprt &index_expr=to_index_expr(expr); return index_exprt(read_rhs(index_expr.array(), loc), read_rhs(index_expr.index(), loc), expr.type()); } ssa_objectt object(expr, ns); // is it an object identifier? if(!object) { exprt tmp=expr; // copy Forall_operands(it, tmp) *it=read_rhs(*it, loc); return tmp; } // Argument is a struct-typed ssa object? // May need to split up into members. const typet &type=ns.follow(expr.type()); if(type.id()==ID_struct) { // build struct constructor struct_exprt result(expr.type()); const struct_typet &struct_type=to_struct_type(type); const struct_typet::componentst &components=struct_type.components(); result.operands().resize(components.size()); for(struct_typet::componentst::const_iterator it=components.begin(); it!=components.end(); it++) { result.operands()[it-components.begin()]= read_rhs(member_exprt(expr, it->get_name(), it->type()), loc); } return result; } // is this an object we track? if(ssa_objects.objects.find(object)!= ssa_objects.objects.end()) { return read_rhs(object, loc); } else { return name_input(object); } }