/** * @brief * mark 2 eus as a reserve of 2 other eu's, and try reading the second one * @return 1 if succesful, 0 otherwise */ error_t logicalAddressToReservePhysicalTest2(){ uint32_t seg_num0 = 1, eu_offset0 = 1, page_offset0 = 0; uint32_t seg_num1 = 3, eu_offset1 = 2, page_offset1 = 7; uint32_t res,phy_addr, orig_phy_addr; INIT_LOGICAL_ADDRESS_STRUCT_AND_PTR(log_address); INIT_FLAGS_STRUCT_AND_PTR(flags); init_logical_address(log_address); SET_LOGICAL_SEGMENT(log_address, seg_num1); SET_LOGICAL_OFFSET(log_address, page_offset1); // write first time orig_phy_addr = CALC_ADDRESS(seg_map_ptr->seg_to_slot_map[seg_num0],eu_offset0,page_offset0); phy_addr = write_to_reserve_eu(orig_phy_addr); // write second time orig_phy_addr = CALC_ADDRESS(seg_map_ptr->seg_to_slot_map[seg_num1],eu_offset1,page_offset1); phy_addr = write_to_reserve_eu(orig_phy_addr); init_flags(flags); // remember to compare to phy_addr+page offset (since phy_addr is the address of the EU containg the actual page...) res = COMPARE(logicalAddressToReservePhysical(flags, orig_phy_addr) , phy_addr + page_offset1); return res; }
int ft_printf(const char *format, ...) { va_list args; t_env *env; va_start(args, format); env = init_env(); while (format[env->i]) { if (format[env->i] == '%' && env->flag == 0) init_flags(env); if (env->flag == 1 && check_flag(format[env->i]) != 0) add_flag(env, format[env->i], env->i); else if (ft_isdigit(format[env->i]) == 1 && env->flag == 1) env->i = get_width(format, env->i, env); else if (format[env->i] == '.' && env->flag == 1 && ft_isdigit(format[++(env->i)]) == 1) env->i = get_precision(format, env->i, env); else if (env->flag == 1 && check_length(format[env->i]) != 0) add_length(env, format, &(env->i)); else if (env->flag == 1 && check_specifier(format[env->i]) != 0) process(args, env, format[env->i]); else env->size += ft_putchar(format[env->i]); env->i++; } return (env->size); }
BoxLockNode::BoxLockNode( int slot ) : Node( Compile::current()->root() ), _slot(slot), _is_eliminated(false) { init_class_id(Class_BoxLock); init_flags(Flag_rematerialize); OptoReg::Name reg = OptoReg::stack2reg(_slot); _inmask.Insert(reg); }
MachSpillCopyNode( Node *n, const RegMask &in, const RegMask &out ) : MachIdealNode(), _in(&in), _out(&out), _type(n->bottom_type()) { init_class_id(Class_MachSpillCopy); init_flags(Flag_is_Copy); add_req(NULL); add_req(n); }
unsigned int check_print(t_struct_arg *args, const char *str, unsigned int i, unsigned schars) { t_params *params; t_tmp_arg *tmp; unsigned int cwrite; if ((params = (t_params*)malloc(sizeof(*params))) == NULL || (tmp = (t_tmp_arg*)malloc(sizeof(*tmp))) == NULL) return (i); init_params(params); if (is_params_nbr(str + i)) i = find_good_param(params, &(args->arg_tmp), str, i); i = init_flags(params, str, i + 1); i = init_len(params, str, i); if (params->is_size == 1) params->width = va_arg(args->arg, int); if (params->is_prec == 1) params->precision = va_arg(args->arg, int); if (params->is_other == 1) stock_arg(&(args->arg_tmp), tmp, str[i]); else if (params->is_other == 0) stock_arg(&(args->arg), tmp, str[i]); cwrite = print_it(tmp, params, str[i], schars); free(params); free(tmp); return (cwrite); }
ProjNode( Node *src, uint con, bool io_use = false ) : Node( src ), _con(con), _is_io_use(io_use) { init_class_id(Class_Proj); // Optimistic setting. Need additional checks in Node::is_dead_loop_safe(). if (con != TypeFunc::Memory || src->is_Start()) init_flags(Flag_is_dead_loop_safe); debug_only(check_con()); }
CallNode(const TypeFunc*tf,address addr,const TypePtr*adr_type, CPData*cpd,bool cloned_in_citypeflow) :SafePointNode(tf->domain()->cnt(),NULL,adr_type,cpd), _tf(tf), _entry_point(addr), _cloned_in_citypeflow(cloned_in_citypeflow) { init_class_id(Class_Call); init_flags(Flag_is_Call); _escape_state = PointsToNode::UnknownEscape; }
MonsterGenerator::MonsterGenerator() { mon_templates["mon_null"] = new mtype(); mon_species["spec_null"] = new species_type(); //ctor init_phases(); init_attack(); init_death(); init_flags(); init_trigger(); init_sizes(); }
MonsterGenerator::MonsterGenerator() { mon_templates[mtype_id::NULL_ID] = new mtype(); mon_species[species_id::NULL_ID] = new species_type(); //ctor init_phases(); init_attack(); init_defense(); init_death(); init_flags(); init_trigger(); }
MonsterGenerator::MonsterGenerator() : mon_templates( "monster type", "id", "alias" ) , mon_species( "species" ) { mon_templates->insert( mtype() ); mon_species->insert( species_type() ); init_phases(); init_attack(); init_defense(); init_death(); init_flags(); init_trigger(); }
MonsterGenerator::MonsterGenerator() : mon_templates( new generic_factory<mtype>( "monster type" ) ) , mon_species( new generic_factory<species_type>( "species" ) ) { mon_templates->insert( mtype() ); mon_species->insert( species_type() ); //ctor init_phases(); init_attack(); init_defense(); init_death(); init_flags(); init_trigger(); }
/** * @brief * mark an eu as a reserve of some eu, and try reading it * write to phy_addr a reserve eu replacing the eu of orig_phy_addr * and try to calculate it again using logicalAddressToReservePhysical * @return 1 if succesful, 0 otherwise */ error_t logicalAddressToReservePhysicalTest1(){ uint32_t slot_num = 1, eu_offset = 7, page_offset = 0; uint32_t res,phy_addr, orig_phy_addr; INIT_LOGICAL_ADDRESS_STRUCT_AND_PTR(log_address); INIT_FLAGS_STRUCT_AND_PTR(flags); init_logical_address(log_address); // PRINT("\nlogicalAddressToReservePhysicalTest1() - starting"); SET_LOGICAL_SEGMENT(log_address, 0); SET_LOGICAL_OFFSET(log_address, page_offset); orig_phy_addr = CALC_ADDRESS(slot_num,eu_offset,page_offset); phy_addr = write_to_reserve_eu(orig_phy_addr); init_flags(flags); // remember to compare to phy_addr+page offset (since phy_addr is the address of the EU containg the actual page...) res = COMPARE(logicalAddressToReservePhysical(flags, orig_phy_addr), phy_addr ); // PRINT("\nlogicalAddressToReservePhysicalTest1() - finished"); return res; }
t_format *type_opt(char **str) { t_format *format; char *opts; char *tmp; opts = "c%sdiuxXonp"; if ((format = (t_format *)malloc(sizeof(t_format))) == NULL) return (NULL); init_format(format); init_flags(str, format); if (init_width(str, format) == -1 || init_prec(str, format) == -1) { free(format); return (NULL); } if ((tmp = ft_strchr(opts, **str)) == NULL) format->type = -1; else format->type = ft_strchr(opts, **str) - opts; if (format->flags & 2 && format->flags & 8 && format->type < 3) format->flags ^= 8; return (format); }
/** * @brief * write SEQ_EUS_PER_SLOT reserve eu's. this will write * SEQ_EUS_PER_SLOT-1 reserve eu's to the first segment, and 1 to the next * verify one of the first EUs, and one in the second reserve segment * @return 1 if succesful, 0 otherwise */ error_t logicalAddressToReservePhysicalTest4(){ uint32_t phy_addr_mid = 0, seg_num1 = 3, eu_offset1 = 2, page_offset1 = 7; uint32_t i, res,phy_addr0, orig_phy_addr0,phy_addr1, orig_phy_addr1, i_mid = 2; INIT_LOGICAL_ADDRESS_STRUCT_AND_PTR(log_address); INIT_FLAGS_STRUCT_AND_PTR(flags); init_logical_address(log_address); /* write SEQ_EUS_PER_SLOT reserve EUs*/ for(i=0; i<SEQ_EUS_PER_SLOT; i++){ orig_phy_addr0 = CALC_ADDRESS(seg_map_ptr->seg_to_slot_map[i],i,i); phy_addr0 = write_to_reserve_eu(orig_phy_addr0); if(i==i_mid){ phy_addr_mid = phy_addr0; } } res = compare_expected_and_reserve(i_mid,i_mid,i_mid,phy_addr_mid); // PRINT_MSG_AND_NUM("\nres=", res); if(!res) return res; /* write another time*/ orig_phy_addr1 = CALC_ADDRESS(seg_map_ptr->seg_to_slot_map[seg_num1],eu_offset1,page_offset1); phy_addr1 = write_to_reserve_eu(orig_phy_addr1); init_flags(flags); SET_LOGICAL_SEGMENT(log_address, seg_num1); SET_LOGICAL_OFFSET(log_address, page_offset1); /* remember to compare to phy_addr+page offset (since phy_addr is the address of the EU containg the actual page...)*/ res = COMPARE(logicalAddressToReservePhysical(flags, orig_phy_addr1) , phy_addr1 + page_offset1); return res; }
ConNode( const Type *t ) : TypeNode(t->remove_speculative(),1) { init_req(0, (Node*)Compile::current()->root()); init_flags(Flag_is_Con); }
LoopLimitNode( Compile* C, Node *init, Node *limit, Node *stride ) : Node(0,init,limit,stride) { // Put it on the Macro nodes list to optimize during macro nodes expansion. init_flags(Flag_is_macro); C->add_macro_node(this); }
int main(int argc, char **argv) { /* Used variables */ MagtiSunFlags msf; MagtiSunLib msl; char answer[8]; /* Greet users */ greet(); /* Initialise everything */ init_flags(&msf); msl_init(&msl); /* Parse Commandline Arguments */ if (parse_arguments(argc, argv, &msf) < 0) { usage(); return 0; } if (msf.logout) { slog(0, SLOG_LIVE, "Logging out"); msl_logout(); } if (msl.logged) slog(0, SLOG_INFO, "Logged in as: %s", msl.usr); /* Login user */ if (msf.login) { /* Check logged user */ if (msl.logged) { slog(0, SLOG_LIVE, "Please log out first"); exit(0); } /* User input info */ init_info(&msl); if(msl_login(&msl)) slog(0, SLOG_INFO, "Logged in as: %s", msl.usr); exit(0); } /* Check valid username and password */ if (strlen(msl.usr) < 4 || strlen(msl.pwd) < 4) { slog(0, SLOG_INFO, "Not logged in"); init_info(&msl); } /* Check info */ if (msf.info) { /* Get info */ if(msl_get_info(&msl) >= 0) { slog(0, SLOG_LIVE, "User: %s", msl.name); slog(0, SLOG_LIVE, "Messages left: %d", msl.mleft); exit(0); } else err_exit("Can not get info"); } /* Read sms info from user input */ init_sms(&msl); /* Send sms */ slog(0, SLOG_LIVE, "Sending message..."); if (msl_send(&msl) >= 0) { slog(0, SLOG_LIVE, "Message sent"); /* Stay logged */ if (!msl.logged) { /* User input answer */ printf("%s", ret_slog("[LIVE] Do you want to stay logged? (y/n): ")); scanf("%s", answer); /* Check answer answer */ if (strcmp(answer, "y") == 0 || strcmp(answer, "Y") == 0) if(msl_login(&msl)) slog(0, SLOG_LIVE, "Saved logged session"); } } else err_exit("Can not send sms"); return 0; }
int main(int argc,char**argv) { //this is now an array mtt::TargetList targetList; t_config config; t_data full_data; t_flag flags; vector<t_clustersPtr> clusters; vector<t_objectPtr> object; vector<t_listPtr> list; visualization_msgs::MarkerArray markersMsg; // Initialize ROS init(argc,argv,"mtt"); NodeHandle nh("~"); Subscriber subs_points = nh.subscribe("/points", 1000, PointsHandler); Publisher target_publisher = nh.advertise<mtt::TargetList>("/targets", 1000); Publisher markers_publisher= nh.advertise<visualization_msgs::MarkerArray>("/markers", 1000); Publisher arrow_publisher= nh.advertise<visualization_msgs::MarkerArray>("/arrows", 1000); init_flags(&flags); //Inits flags values init_config(&config); //Inits configuration values cout<<"Start to spin"<<endl; Rate r(100); while(ok()) { spinOnce(); r.sleep(); if(!new_data) continue; new_data=false; //Get data from PointCloud2 to full_data PointCloud2ToData(pointData,full_data); //clustering clustering(full_data,clusters,&config,&flags); //calc_cluster_props calc_cluster_props(clusters,full_data); //clusters2objects clusters2objects(object,clusters,full_data,config); calc_object_props(object); //AssociateObjects AssociateObjects(list,object,config,flags); //MotionModelsIteration MotionModelsIteration(list,config); //cout<<"Number of targets "<<list.size()<<endl; clean_objets(object);//clean current objects //clear target list array targetList.Targets.clear(); //structure to be fed to array mtt::Target target; //build header target.header.stamp = ros::Time::now(); target.header.frame_id = pointData.header.frame_id; //trying to draw arrows visualization_msgs::MarkerArray arrow_arrray; for(uint i=0; i<list.size(); i++) { geometry_msgs::Pose pose; geometry_msgs::Twist vel; //header target.header.seq = list[i]->id; target.id = list[i]->id; //velocity vel.linear.x=list[i]->velocity.velocity_x; vel.linear.y=list[i]->velocity.velocity_y; vel.linear.z=0; target.velocity = vel; //compute orientation based on velocity. double theta = atan2(vel.linear.y,vel.linear.x); geometry_msgs::Quaternion target_orientation = tf::createQuaternionMsgFromYaw(theta); //pose pose.position.x = list[i]->position.estimated_x; pose.position.y = list[i]->position.estimated_y; pose.position.z = 0; pose.orientation = target_orientation; target.pose = pose; //feed array with current target //condition to accept as valit target (procopio change) double velocity = sqrt(pow(vel.linear.x,2)+ pow(vel.linear.y,2)); if(/*velocity > 0.5 &&*/ velocity < 3.0) targetList.Targets.push_back(target); ////////////////////////// //drawing arrow part if(list[i]->velocity.velocity_module > 0.2 && list[i]->velocity.velocity_module < 5.0) { visualization_msgs::Marker arrow_marker; arrow_marker.type = visualization_msgs::Marker::ARROW; arrow_marker.action = visualization_msgs::Marker::ADD; // Set the frame ID and timestamp. arrow_marker.header.frame_id = pointData.header.frame_id; arrow_marker.header.stamp = ros::Time::now(); arrow_marker.color.r = 0; arrow_marker.color.g = 1; arrow_marker.color.b = 0; arrow_marker.color.a = 1; // arrow_marker.scale.x = ; arrow_marker.scale.x = list[i]->velocity.velocity_module; //length arrow_marker.scale.y = 0.1; //width arrow_marker.scale.z = 0.1; //height arrow_marker.lifetime = ros::Duration(1.0); arrow_marker.id = list[i]->id; // Set the pose of the arrow_marker. This is a full 6DOF pose relative to the frame/time specified in the header arrow_marker.pose = pose; arrow_arrray.markers.push_back(arrow_marker); ////////////////////////// } } target_publisher.publish(targetList); CreateMarkers(markersMsg.markers,targetList,list); markers_publisher.publish(markersMsg); arrow_publisher.publish(arrow_arrray); flags.fi=false; } return 0; }
int main(int argc,char**argv) { mtt::TargetListPC targetList; t_config config; t_data full_data; t_flag flags; vector<t_clustersPtr> clusters; vector<t_objectPtr> object; vector<t_listPtr> list; visualization_msgs::MarkerArray markersMsg; // Initialize ROS init(argc,argv,"mtt"); NodeHandle nh("~"); Subscriber subs_points = nh.subscribe("/points", 1000, PointsHandler); Publisher target_publisher = nh.advertise<mtt::TargetList>("/targets", 1000); Publisher markers_publisher= nh.advertise<visualization_msgs::MarkerArray>("/markers", 1000); Publisher marker_publisher= nh.advertise<visualization_msgs::Marker>("/marker", 1000); init_flags(&flags); //Inits flags values init_config(&config); //Inits configuration values cout<<"Start to spin"<<endl; Rate r(100); while(ok()) { spinOnce(); r.sleep(); if(!new_data) continue; new_data=false; //Get data from PointCloud2 to full_data PointCloud2ToData(pointData,full_data); //clustering clustering(full_data,clusters,&config,&flags); //calc_cluster_props calc_cluster_props(clusters,full_data); //clusters2objects clusters2objects(object,clusters,full_data,config); calc_object_props(object); //AssociateObjects AssociateObjects(list,object,config,flags); //MotionModelsIteration MotionModelsIteration(list,config); // cout<<"Number of targets "<<list.size()<<endl; clean_objets(object);//clean current objects targetList.id.clear(); targetList.obstacle_lines.clear();//clear all lines pcl::PointCloud<pcl::PointXYZ> target_positions; pcl::PointCloud<pcl::PointXYZ> velocity; target_positions.header.frame_id = pointData.header.frame_id; velocity.header.frame_id = pointData.header.frame_id; targetList.header.stamp = ros::Time::now(); targetList.header.frame_id = pointData.header.frame_id; for(uint i=0;i<list.size();i++) { targetList.id.push_back(list[i]->id); pcl::PointXYZ position; position.x = list[i]->position.estimated_x; position.y = list[i]->position.estimated_y; position.z = 0; target_positions.points.push_back(position); pcl::PointXYZ vel; vel.x=list[i]->velocity.velocity_x; vel.y=list[i]->velocity.velocity_y; vel.z=0; velocity.points.push_back(vel); pcl::PointCloud<pcl::PointXYZ> shape; pcl::PointXYZ line_point; uint j; for(j=0;j<list[i]->shape.lines.size();j++) { line_point.x=list[i]->shape.lines[j]->xi; line_point.y=list[i]->shape.lines[j]->yi; shape.points.push_back(line_point); } line_point.x=list[i]->shape.lines[j-1]->xf; line_point.y=list[i]->shape.lines[j-1]->yf; sensor_msgs::PointCloud2 shape_cloud; pcl::toROSMsg(shape,shape_cloud); targetList.obstacle_lines.push_back(shape_cloud); } pcl::toROSMsg(target_positions, targetList.position); pcl::toROSMsg(velocity, targetList.velocity); target_publisher.publish(targetList); CreateMarkers(markersMsg.markers,targetList,list); //markersMsg.header.frame_id=targetList.header.frame_id; markers_publisher.publish(markersMsg); flags.fi=false; } return 0; }
VectorLoadNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const Type *rt) : LoadNode(c,mem,adr,at,rt) { init_flags(Flag_is_Vector); }
VectorNode(Node* n1, Node* n2, uint vlen) : Node(NULL, n1, n2), _length(vlen) { init_flags(Flag_is_Vector); }
Opaque2Node( Compile* C, Node *n ) : Node(0,n) { // Put it on the Macro nodes list to removed during macro nodes expansion. init_flags(Flag_is_macro); C->add_macro_node(this); }
MachNullCheckNode( Node *ctrl, Node *memop, uint vidx ) : MachIdealNode(), _vidx(vidx) { init_class_id(Class_MachNullCheck); init_flags(Flag_is_Branch | Flag_is_pc_relative); add_req(ctrl); add_req(memop); }
MachSafePointNode() : MachReturnNode(), _oop_map(NULL), _jvms(NULL), _jvmadj(0) { init_class_id(Class_MachSafePoint); init_flags(Flag_is_safepoint_node); }
int main(int argc,char *argv[]) { int i; char *gamefile; fc_type fc, fc_out; end_cmd_options=0; init_flags(); no_auxsyn=1; fix_ascii_flag=0; /* We don't want to translate the character set when we're converting files */ /* Mark all of the purity settings as "undecided" */ PURE_ANSWER=PURE_TIME=PURE_ROOMTITLE=2; PURE_AND=PURE_METAVERB=PURE_SYN=PURE_NOUN=PURE_ADJ=2; PURE_DUMMY=PURE_SUBNAME=PURE_PROSUB=PURE_HOSTILE=2; PURE_GETHOSTILE=PURE_DISAMBIG=PURE_ALL=2; irun_mode=verboseflag=2; build_trans_ascii(); printf("agt2agx: Convert AGT game files into AGX files\n"); printf("%s\n",version_str); printf(" Copyright (C) 1996-1999,2001 Robert Masenten\n"); printf("[%s]\n\n",portstr); outname=gamefile=NULL; for(i=1;i<argc;i++) if (argv[i][0]=='-' && !end_cmd_options) i+=parse_options(argv[i]+1,argv[i+1]); else if (gamefile==NULL) gamefile=argv[i]; else {helpmsg();exit(EXIT_FAILURE);} if (gamefile==NULL) {helpmsg();exit(EXIT_FAILURE);} if (outname==NULL) outname=gamefile; /* By default use gamefile name for output name */ fc=init_file_context(gamefile,fDA1); fc_out=init_file_context(outname,fAGX); text_file=1; read_config(openfile(fc,fCFG,NULL,0),0); text_file=0; printf("Reading AGT file...\n"); if (!readagt(fc,0)) fatal("Unable to open info (DA1) or AGX file."); text_file=1; read_config(openfile(fc,fCFG,NULL,0),1); text_file=0; sort_cmd(); truncate_cmd(); printf("Opening AGX file and copying description text...\n"); agx_create(fc_out); descr_out(fc); printf("Writing AGX file...\n"); agx_write(); agx_wclose(); free_all_agtread(); return 0; }
VectorStoreNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val) : StoreNode(c,mem,adr,at,val) { init_flags(Flag_is_Vector); }
ConNode( const Type *t ) : TypeNode(t,1) { init_req(0, (Node*)Compile::current()->root()); init_flags(Flag_is_Con); }
MachCallNode() : MachSafePointNode() { init_class_id(Class_MachCall); init_flags(Flag_is_Call); }
PowDNode(Compile* C, Node *c, Node *in1, Node *in2 ) : Node(c, in1, in2) { init_flags(Flag_is_expensive); C->add_expensive_node(this); }
StartNode( Node *root, const TypeTuple *domain ) : MultiNode(2), _domain(domain) { init_class_id(Class_Start); init_flags(Flag_is_block_start); init_req(0,this); init_req(1,root); }