コード例 #1
0
ファイル: tool_create_entity.cpp プロジェクト: mixxit/solinia
//***************************************************************
void CToolCreateEntity::updateAfterRender()
{
	//H_AUTO(R2_CToolCreateEntity_updateAfterRender)
	if (_CreateState != DrawArray)
	{
		CToolChoosePos::updateAfterRender();
		return;
	}
	switch(_ArrayWantedAction)
	{
		case ArrayActionNone:
		break;
		case ArrayActionValidate:
		{
			commitArray();
			CTool::TSmartPtr hold(this);
			getUI().runActionHandler("r2ed_create_entity", NULL, "PaletteId="+_PaletteId);
			return;
		}
		break;
		case ArrayActionCancel:
		{
			CTool::TSmartPtr hold(this);
			cancel();
			getEditor().setCurrentTool(NULL);
			return;
		}
		break;
	}
	updateArray(NULL);
}
コード例 #2
0
ファイル: sim_process.C プロジェクト: jinyh99/NoC-sim
void process_parse_trace()
{
    char proc_name[MAX_PROCESS_NAME_STR_LEN];
    sprintf(proc_name, "trace proc");
    create(proc_name);
    g_sim.m_num_CSIM_process++;

    // stream net_stream;

    WorkloadTrace* wkldTrace = (WorkloadTrace*) g_Workload;

    ((WorkloadTrace*) g_Workload)->skipTraceFile();
    hold(g_cfg.wkld_trace_skip_cycles);
    fprintf(stderr, "skipped %.0lf cycles (trace_file_id=%d).\n", g_cfg.wkld_trace_skip_cycles, wkldTrace->trace_file_id());

    double last_pkt_inject_clk = simtime();

    while (!g_EOS) {
        vector< Packet* > pkt_vec = wkldTrace->readTrace();

        if (pkt_vec.size() == 0)	
            continue;

        if (pkt_vec.size() == 1 && pkt_vec[0] == 0) // no more trace?
            break;

        if (pkt_vec[0]->m_clk_gen > last_pkt_inject_clk) {
            double hold_tm = pkt_vec[0]->m_clk_gen - last_pkt_inject_clk;
            if (hold_tm > 0.0)
                hold(hold_tm);
            last_pkt_inject_clk = simtime();
        }

        for (unsigned int n=0; n<pkt_vec.size(); n++) {
            Packet* p_pkt = pkt_vec[n];
#ifdef _DEBUG_ROUTER
printf("clk=%0.lf GEN p=%lld C:%d->%d R:%d/%d->%d/%d #flits=%d gen_clk=%.0lf\n", simtime(), p_pkt->id(), p_pkt->getSrcCoreID(), p_pkt->getDestCoreID(), p_pkt->getSrcRouterID(), p_pkt->m_NI_in_pos, p_pkt->getDestRouterID(), p_pkt->m_NI_out_pos, p_pkt->m_num_flits, p_pkt->m_clk_gen);
#endif

            // choose one network if multiple networks exist.
            if (g_cfg.net_networks > 1)
                select_network(p_pkt);

            assert(p_pkt->m_NI_in_pos < g_Core_vec[p_pkt->getSrcCoreID()]->num_NIInput());
            g_Core_vec[p_pkt->getSrcCoreID()]->forwardPkt2NI(p_pkt->m_NI_in_pos, p_pkt);
            g_sim.m_num_pkt_inj++;
        }
    }

    // After the last trace is processed, terminate simulation.
    if (!g_EOS) {
        g_EOS = true;
        g_ev_sim_done->set();
        g_sim.m_clk_sim_end = simtime();
    }

#ifdef _DEBUG_ROUTER_PROCESS
    printf("PROCESS COMPLETE: process_parse_trace\n");
#endif
}
コード例 #3
0
ファイル: tesselate.cpp プロジェクト: jzrake/luview
void Tesselation3D::__init_lua_objects()
{
  hold(__output_ds["triangles"] = create<DataSource>(__lua_state));
  hold(__output_ds["segments"] = create<DataSource>(__lua_state));
  __output_ds["triangles"]->set_input(this);
  __output_ds["segments"]->set_input(this);
}
コード例 #4
0
ファイル: dialercontrol.cpp プロジェクト: muromec/qtopia-ezx
/*!
  Accepts an incoming call.  Has no effect if there is no incoming call.
*/
void DialerControl::accept()
{
    QList<QPhoneCall> incomingCalls = findCalls( QPhoneCall::Incoming );
    if( incomingCalls.count() )
    {
        QPhoneCall incoming = incomingCalls.first();
        if ( incoming.incoming() ) {
            //put active calls on hold
            if ( incoming.callType() == "Voice" ) {   // No tr
                // GSM calls will be put on hold automatically by the accept().
                // Other call types need to be put on hold explicitly.
                if( hasActiveCalls() ) {
                    if ( activeCalls().first().callType() == "Voice" ) {  // No tr
                        incoming.accept();
                    } else {
                        hold();
                        incoming.accept();
                    }
                } else {
                    incoming.accept();
                }
            } else {
                if( hasActiveCalls() )
                    hold();
                incoming.accept();
                incoming.activate();
            }
        }
    }
}
コード例 #5
0
ファイル: editor.cpp プロジェクト: ChristophKuhfuss/supertux
void Editor::update_keyboard() {

  if (!enabled){
    return;
  }

  auto controller = InputManager::current()->get_controller();

  if (controller->pressed(Controller::ESCAPE)) {
    esc_press();
    return;
  }

  if (controller->hold(Controller::LEFT)) {
    scroll_left();
  }

  if (controller->hold(Controller::RIGHT)) {
    scroll_right();
  }

  if (controller->hold(Controller::UP)) {
    scroll_up();
  }

  if (controller->hold(Controller::DOWN)) {
    scroll_down();
  }
}
コード例 #6
0
/* Boolean types */
static value op_boolean(value f, int flag)
	{
	if (!f->L || !f->L->L) return 0;
	{
	value x = flag ? hold(f->L->R) : hold(f->R);
	return reduce(f,x);
	}
	}
コード例 #7
0
ファイル: hold.c プロジェクト: CTSRD-TESLA/TESLA
int
perform_operation(int op, struct object *o)
{
	TESLA_WITHIN(example_syscall, previously(call(hold(o))));
	TESLA_WITHIN(example_syscall, previously(returnfrom(hold(o))));

	return 0;
}
コード例 #8
0
ファイル: drill.c プロジェクト: sumsarj/xcc
int DrillHole(){
	unsigned int res;
	DrillDown();
	res = DrillDownTest();
	hold((time_type)250);
	DrillUp();
	hold((time_type)250);
	return res;
}
コード例 #9
0
ファイル: drill.c プロジェクト: sumsarj/xcc
void Alarm(int a){
	int i;
	for(i=0; i<a ;i++){
		hold((time_type)500);
		OutOne(4);
		hold((time_type)1000); //delat 1 sekund
		OutZero(4);
	}
	
}
コード例 #10
0
ファイル: a1c.c プロジェクト: llevar/uoft
void cust(){
  /* If simulation hasn't ended yet. */
	if(clock < MAX_TIME){
		TIME t1, t2, t3, t4;

		create("cust");

		/* Customer enters queue at facility 1. */
		t1 = enter_box(queue_box);
		reserve(f1);

		/* Customer exits queue at facility 1. */
		exit_box(queue_box, t1);

		/* Customer enters service at facility 1. */
		t2 = enter_box(service_box);

		/* Service customer at facility 1. */
		hold(exponential(SVTM1));

		/* Customer finished service at facility 1. */
		exit_box(service_box, t2);

		/* Customer enters queue at facility 2. */
		t3 = enter_box(queue_box2);

		/* Request facility 2 without releasing facility 1. */	
		reserve(f2);

		/* Customer exits queue at facility 2. */
		exit_box(queue_box2, t3);

		/* Customer enters service at facility 2. */
		t4 = enter_box(service_box2);

		/* Customer has been granted facility 2 so can now release facility 1. */
		release(f1);

		/* Service customer at facility 2. */
		hold(exponential(SVTM2));

		release(f2);

		/* Customer finished service at facility 2. */
		exit_box(service_box2, t4);

		/* Check if time to terminate. */
		if(clock >= 1000){
			set(done);
		}
	/* If time to end simulation, signal the main process. */
	}else{
		set(done);
	}
}
コード例 #11
0
ファイル: sim_process.C プロジェクト: jinyh99/NoC-sim
void process_link_dvs_set()
{
    char proc_name[MAX_PROCESS_NAME_STR_LEN];
    double last_profile_clk = 0.0;

    sprintf(proc_name, "link-dvs proc");
    create(proc_name);
    g_sim.m_num_CSIM_process++;

    switch (g_cfg.link_dvs_method) {
    case LINK_DVS_NODVS:
        return;
    case LINK_DVS_HISTORY:
        break;
    case LINK_DVS_FLIT_RATE_PREDICT:
        g_LinkDVSer.open_flit_rate_predict_file();
        g_LinkDVSer.skip_flit_rate_predict_file((int) (g_cfg.wkld_trace_skip_cycles/UNIT_MEGA) + 1);
        break;
    }

    double hold_time = g_cfg.sim_clk_start + g_cfg.link_dvs_interval/2.0;
    assert(hold_time > 0.0);
    hold(hold_time);

    while (!g_EOS) {
        switch (g_cfg.link_dvs_method) {
        case LINK_DVS_HISTORY:
            g_LinkDVSer.link_dvs_select_vf();
            break;
        case LINK_DVS_FLIT_RATE_PREDICT:
            g_LinkDVSer.read_flit_rate_predict_interval();
            g_LinkDVSer.estimate_link_utilz_from_flit_rate_predict();
            g_LinkDVSer.link_dvs_select_vf_predicted_flit_rate();

#ifdef LINK_DVS_DEBUG
            printf("read (%.0lf~%.0lf) rate info for DVS at clk=%.0lf\n",
            (g_LinkDVSer.predict_line_num()-1)*g_cfg.link_dvs_interval,
            (g_LinkDVSer.predict_line_num())*g_cfg.link_dvs_interval,
            simtime());
#endif

            break;
        default:
            assert(0);
        }

        hold(g_cfg.link_dvs_interval);
    }

    switch (g_cfg.link_dvs_method) {
    case LINK_DVS_FLIT_RATE_PREDICT:
        g_LinkDVSer.close_flit_rate_predict_file();
        break;
    }
}
コード例 #12
0
ファイル: tux.cpp プロジェクト: Karkus476/supertux
void
Tux::updateInputDirection()
{
  auto controller_ = InputManager::current()->get_controller();
  if(controller_->hold(Controller::UP))
    input_direction = D_NORTH;
  else if(controller_->hold(Controller::DOWN))
    input_direction = D_SOUTH;
  else if(controller_->hold(Controller::LEFT))
    input_direction = D_WEST;
  else if(controller_->hold(Controller::RIGHT))
    input_direction = D_EAST;
}
コード例 #13
0
ファイル: drill.c プロジェクト: Rektorn/GruDreit
void Alarm(int amount){
	int i;
	for(i = 0; i < amount;i++){
		Outone(4);
		hold(1000);
		Outzero(4);
		if(!(i == amount - 1)){
			//skippa sista iterationen av delay
			hold(500);
		}
	}

}
コード例 #14
0
ファイル: drill.c プロジェクト: Rektorn/GruDreit
//vrider borren 1 steg
int step(void){
	if(ML4IN &(2)){
		//är i toppläge
		Outone(1);
		Outone(0);
		hold((time_type)250);
		Outzero(0);
		hold((time_type)500);
		return 1; 
	}
	Alarm(2);
	return 0;
}
コード例 #15
0
ファイル: drill.c プロジェクト: Pungsnigel/DAT015-assignments
void alarm(int counter)
{
	while (counter)
	{
		set(dcShadow,0x10);
		DrillControl = dcShadow;
		
		hold(1000UL);
		
		clear(dcShadow,0x10);
		DrillControl = dcShadow;
		hold(500UL);
		counter--;
	}
}
コード例 #16
0
ファイル: sim_process.C プロジェクト: jinyh99/NoC-sim
void process_profile_cycle()
{
    char proc_name[MAX_PROCESS_NAME_STR_LEN];
    sprintf(proc_name, "profile proc");
    create(proc_name);
    g_sim.m_num_CSIM_process++;

    double clk_start_profile = 0.0;

    if (g_cfg.sim_clk_start > 0.0) {
        clk_start_profile = g_cfg.sim_clk_start;
        assert(g_cfg.sim_clk_start >= g_cfg.wkld_trace_skip_cycles);
    } else if (g_cfg.wkld_trace_skip_cycles > 0.0) {
        clk_start_profile = g_cfg.wkld_trace_skip_cycles;
    }
    assert(clk_start_profile >= 0.0);
    
    hold(clk_start_profile);

    if (g_cfg.profile_perf) {
        profile_perf_reset();
        profile_perf_header_print();
    }

    if (g_cfg.profile_power) {
        profile_power_header_print();
    }

    while (!g_EOS) {
        hold(g_cfg.profile_interval);

        // performance
        if (g_cfg.profile_perf) {
            profile_perf_print();
            profile_perf_reset();
        }

        // power
        if (g_cfg.profile_power) {
            profile_power_print();
            profile_power_reset();
        }
    }

#ifdef _DEBUG_ROUTER_PROCESS
    printf("PROCESS COMPLETE: process_profile cycle\n");
#endif
}
コード例 #17
0
ファイル: LightFlash.cpp プロジェクト: mohamedsakhri/se2p
void LightFlash::stopFlashing(){
	HALAktorik::getInstance()->red_Light_off();
	HALAktorik::getInstance()->yellow_Light_off();
	is_flashing_ = false;
	hold();

}
コード例 #18
0
ファイル: UnitMng.cpp プロジェクト: b4rdos/StarBard
void UnitMng::issueCommands()
{
	if(conUnit)
	{
		//double *inputs,*outputs;
		//inputs=generateInputs();
		generateInputs();
		//outputs=generateOutputs(inputs);
		generateOutputs();
		//Keep Last Command incase of CONTINUE
		lastCommand=act;
		if(outputs[0]>outputs[1]&&outputs[0]>outputs[2])//&&outputs[0]>=outputs[3])
		{
			act=ATTACK;
			attack();
		}
		else if(outputs[1]>outputs[0]&&outputs[1]>outputs[2])//&&outputs[1]>=outputs[3])
		{
			act=MOVE;
			move();
		}
		else if(outputs[2]>outputs[0]&&outputs[2]>outputs[1])//&&outputs[2]>=outputs[3])
		{
			act=HOLD;
			hold();
		}
		else
		{ 
			Continue();
		}
	}

}
コード例 #19
0
ファイル: type_limit.c プロジェクト: chkoreff/Fexl
static value op_limit(value f, void op(unsigned long))
	{
	if (!f->L) return 0;
	{
	value x = arg(f->R);
	if (x->T == type_num)
		{
		op(get_ulong(x));
		f = hold(QI);
		}
	else
		f = hold(Qvoid);
	drop(x);
	return f;
	}
	}
コード例 #20
0
ファイル: ports.c プロジェクト: elek/avr-home
uint8_t i2c_start(uint8_t addr) {
//    sclLo();
    hold();
//    sclHi();
    sdaOut(0);
    return i2c_write(addr);
}
コード例 #21
0
ファイル: job.cpp プロジェクト: Skiles/aseprite
Job::~Job()
{
  // The job was canceled by the user?
  {
    ScopedLock hold(*m_mutex);
    if (!m_done_flag)
      m_canceled_flag = true;
  }

  if (m_monitor) {
    remove_gui_monitor(m_monitor);
    m_monitor = NULL;
  }

  if (m_thread) {
    m_thread->join();
    delete m_thread;
  }

  if (m_progress)
    delete m_progress;

  if (m_mutex)
    delete m_mutex;
}
コード例 #22
0
ファイル: standard.c プロジェクト: chkoreff/Fexl
/* Evaluate main.fxl located relative to the executable given by argv[0].  The
main.fxl script then evaluates the user's script given by argv[1]. */
static void eval_script(void)
	{
	value f;
	/* Get the name of the currently running executable. */
	f = Qstr0(main_argv[0]);
	/* Go two directories up, right above the bin directory. */
	f = A(Q(type_dirname),f);
	f = A(Q(type_dirname),f);
	/* Concatenate the name of the main script. */
	f = A(A(Q(type_concat),f),Qstr0("/src/main.fxl"));
	/* Now evaluate the main script. */
	f = A(hold(Qparse_file),f);
	f = A(A(hold(Qevaluate),Q(type_standard)),f);
	f = eval(f);
	drop(f);
	}
コード例 #23
0
ファイル: previously.c プロジェクト: CTSRD-TESLA/TESLA
int
perform_operation(struct object *o)
{
    /*
     * CHECK: digraph automaton_0 {
     *
     * TODO: when we switch to LLVM 3.4, use CHECK-DAG here:
     *
     * CHECK: 0 [ label = "state 0\n{{.*}}(&#8902;)" ];
     * CHECK: [[INIT:[0-9]+]] [ label = "state [[INIT]]\n{{.*}}(&#8902;)" ];
     * CHECK: [[HOLD:[0-9]+]] [ label = "state [[HOLD]]\n{{.*}}(o)" ];
     * CHECK: [[DONE:[0-9]+]] [ label = "state [[DONE]]\n{{.*}}", shape = doublecircle ];
     * CHECK: [[ASRT:[0-9]+]] [ label = "state [[ASRT]]\n{{.*}}(o)" ];
     *
     * CHECK: example_syscall(X): Entry
     * CHECK: 0 -> [[INIT]];
     *
     * CHECK: hold(o): Entry
     * CHECK: [[INIT]] -> [[HOLD]];
     * CHECK: [[HOLD]] -> [[HOLD]];
     *
     * CHECK: example_syscall(X) == X
     * CHECK: [[INIT]] -> [[DONE]];
     * CHECK: [[HOLD]] -> [[DONE]];
     * CHECK: [[ASRT]] -> [[DONE]];
     *
     * CHECK: assertion
     * CHECK: [[HOLD]] -> [[ASRT]];
     *
     * CHECK: }
     */
    TESLA_WITHIN(example_syscall, previously(call(hold(o))));

    return 0;
}
コード例 #24
0
ファイル: sim_process.C プロジェクト: jinyh99/NoC-sim
void process_router(Router* p_router)
{
    char proc_name[MAX_PROCESS_NAME_STR_LEN];

    sprintf(proc_name, "r_%d proc", p_router->id());
    create(proc_name);
    g_sim.m_num_CSIM_process++;

    while (1) {
#ifdef _DEBUG_ROUTER_SNAPSHOT
        if (simtime() >= _DEBUG_ROUTER_SNAPSHOT_CLK)
            take_network_snapshot(stdout);
#endif

        // 03/15/06 fast simulation
        if (p_router->hasNoFlitsInside() && p_router->hasNoCreditDepositsInside()) {
            p_router->sleep();
        }

        p_router->router_sim();
        hold(ONE_CYCLE);
    }

#ifdef _DEBUG_ROUTER_PROCESS
    printf("PROCESS COMPLETE: process_router(router=%d)\n", p_router->id());
#endif
}
コード例 #25
0
ファイル: WorkloadSynthetic.C プロジェクト: jinyh99/NoC-sim
double WorkloadSynthetic::temporalSelfSimilar(int src_core_id)
{
    double off_time = 0.0;

    if (m_SS_OnMode_vec[src_core_id]) {
        if (simtime() > m_SS_last_OnTimeStamp_vec[src_core_id]) {
            double x = m_stream_temporal_vec[src_core_id]->uniform(0.0, 1.0);
            double off_time = pow((1.0 - x), -1.0/1.25);
// printf("src_core_id=%d off_time=%lf\n", src_core_id, off_time);
            if (off_time < 1.0)
                off_time = 1.0;

            hold(off_time);
            m_SS_OnMode_vec[src_core_id] = false;
        }
    } else {
        double x = m_stream_temporal_vec[src_core_id]->uniform(0.0, 1.0);
        double on_time = pow((1.0 - x), (-1.0)/1.9);
// printf("src_core_id=%d on_time=%lf\n", src_core_id, on_time);
        m_SS_last_OnTimeStamp_vec[src_core_id] = simtime() + on_time;
        m_SS_OnMode_vec[src_core_id] = true;
    }

    return (off_time + temporalPoisson(src_core_id));
}
コード例 #26
0
ファイル: UnitMng.cpp プロジェクト: b4rdos/StarBard
void UnitMng::Continue()
{
	if(lastCommand==NOCOMMMAND)
	{
		
		lastCommand=MOVE;
		act=lastCommand;
		move();
	}
	else
	{
		act=lastCommand;
		switch (lastCommand)
		{
		case ATTACK:
			attack();
			break;
		case MOVE:
			move();
			break;
		case HOLD:
			hold();
		}
	}

}
コード例 #27
0
ファイル: job.cpp プロジェクト: eledot/aseprite
Job::~Job()
{
  if (m_alert_window != NULL)
    m_alert_window->closeWindow(NULL);

  // The job was canceled by the user?
  {
    ScopedLock hold(*m_mutex);
    if (!m_done_flag)
      m_canceled_flag = true;
  }

  if (m_timer->isRunning())
    m_timer->stop();

  if (m_thread) {
    m_thread->join();
    delete m_thread;
  }

  if (m_progress)
    delete m_progress;

  if (m_mutex)
    delete m_mutex;
}
コード例 #28
0
ファイル: drill.c プロジェクト: sumsarj/xcc
int Nstep(int a){   //a == antal steg att steppa
	int i;
	for(i = 0; i<a; i++){	//steppa a gånger
		if(0 == (BORR_STATUS & 0x2)){	//borren uppe?
			Alarm(2);
			return 0;
		}
		OutOne(1);
		hold((time_type)250);    //250 ms delay
		OutOne(0);
		hold((time_type)500);
		OutZero(0);
		
	}
	return 1;
}
コード例 #29
0
ファイル: a1c.c プロジェクト: llevar/uoft
void sim(){
	
	create("sim");
	
	/* Initialize simulation. */
	init();
	
	/* For the duration of the simulation generate customers with 
	   exponential inter-arrival times with mean IATM. */
	while(simtime() < 1000){
		hold(exponential(IATM));
		cust();
		
	}
	wait(done);
	
	/* Print reports. */
	printf("Server 1, expected average delay in queue of a customer: %f\n",
	table_mean(box_time_table(queue_box)));
	printf("Server 1, expected time-average number of customers in queue: %f\n",
	qtable_mean(box_number_qtable(queue_box)));
	printf("Server 1, expected utilization: %f\n\n",
	qtable_mean(box_number_qtable(service_box)));
	
	printf("Server 2, expected average delay in queue of a customer: %f\n",
	table_mean(box_time_table(queue_box2)));
	printf("Server 2, expected time-average number of customers in queue: %f\n",
	qtable_mean(box_number_qtable(queue_box2)));
	printf("Server 2, expected utilization: %f\n\n",
	qtable_mean(box_number_qtable(service_box2)));

}
コード例 #30
0
ファイル: main.c プロジェクト: netl/toaster
int main(void)
{
    //set outputs
    DDRB=0xff;	//all out for now
    PORTB=0b000;	//all output low

    //make sure heater is OFF and the slot is not held down
    heater(0);

    //set inputs
    DDRA=0x00;	//all in
    PORTA=0b011;	//no pull-up for the trimmer

    //setup interupt for counting time
    TCCR1A=(1<<WGM12); //clear counter on compare match
    TCCR1B=(1<<CS11)|(1<CS10); //1MHZ/64=15.625kHz
    OCR1A=15625; //compare match at 1Hz
    TIMSK1=(1<<OCIE1A); //interupt on compare match a

    //setup adc for trimmer
    ADMUX=(1<<MUX1); //set PA2 for adc
    ADCSRB=(1<<ADLAR);	//set for reading of highest bits
    ADCSRA=(1<<ADEN)|(1<<ADSC)|(1<<ADATE);	//start free run mode

    //setup SPI slave
    DDRA|=(1<<5);
    USICR = (1<<USIWM0)|(1<<USICS1)|(1<<USIOIE);
    USISR = (1<<USICNT0);
    sei();//enable interrupt

    //end of setup
    while(1) //be stuck forever.
    {
        if(!slot())     //hold the toast down
        {
            time=trimmer();	//set timer according to knob
            heater(1);
            debug(1);
            hold(1);
            while(button());        //wait for user input
            heater(0);
            hold(0);
            debug(0);
            while(!button());       //wait untill button is released
        }
    }
}