Exemple #1
0
void Ge::activate_new()
{
    if ( graph->is_modified()) {
        int rv = create_modal_dialog( "New", "Graph is not saved.\nDo you want to continue?", "Yes", "Cancel", NULL, NULL);
        if ( rv == wow_eModalDialogReturn_Button1)
            clear_all();
    }
    else
        clear_all();
}
void LIR_OopMapGenerator::process_move(LIR_Op* op) {
  LIR_Op1* op1 = op->as_Op1();
  LIR_Opr src = op1->in_opr();
  LIR_Opr dst = op1->result_opr();
  
  assert(!src->is_stack() || !dst->is_stack(), "No memory-memory moves allowed");
  if ((src->is_stack() && frame_map()->is_spill_pos(src)) ||
      (dst->is_stack() && frame_map()->is_spill_pos(dst))) {
    // Oops in the spill area are handled by another mechanism (see
    // CodeEmitInfo::record_spilled_oops)
    return;
  }
  if (dst->is_oop()) {
    assert((src->is_oop() &&
            (src->is_stack() || src->is_register() || src->is_constant())
           ) ||
           src->is_address(), "Wrong tracking of oops/non-oops in LIR");
    assert(!src->is_stack() || is_marked(src->single_stack_ix()),
           "Error in tracking of oop stores to stack");
    if (dst->is_stack()) {
      mark(dst->single_stack_ix());
    } else if (dst->is_register()) {
      if (LIRCacheLocals) {
        if (local_mapping()->is_cache_reg(dst)) {
          mark(dst);
        }
      } else {
        assert(local_mapping() == NULL, "expected no local mapping");
      }
    }
  } else {
    // !dst->is_oop()
    // Note that dst may be an address
    assert(!src->is_single_stack() || !is_marked(src->single_stack_ix()), "Error in tracking of oop stores to stack");
    assert(!src->is_double_stack() || !is_marked(src->double_stack_ix()), "Error in tracking of oop stores to stack");
    assert(!src->is_double_stack() || !is_marked(1 + src->double_stack_ix()), "Error in tracking of oop stores to stack");
    if (dst->is_stack()) {
      if (dst->is_single_stack()) {
        clear_all(dst->single_stack_ix());
      } else {
        clear_all(dst->double_stack_ix());
        clear_all(1 + dst->double_stack_ix());
      }
    } else if (dst->is_register()) {
      if (LIRCacheLocals) {
        if (local_mapping()->is_cache_reg(dst)) {
          clear_all(dst);
        }
      } else {
        assert(local_mapping() == NULL, "expected no local mapping");
      }
    }
  }
}
Exemple #3
0
void test_colors(){
    PORTB |= (1<<PB3) | (1<<PB2) | (1<<PB1);
    _delay_ms(2500);
    clear_all();
    PORTB |= (1<<PB3);
    _delay_ms(2500);
    clear_all();
    PORTB |= (1<<PB2);
    _delay_ms(2500);
    clear_all();
    PORTB |= (1<<PB1);
    _delay_ms(2500);
    clear_all();
}
Exemple #4
0
void *recv_line(void *arg) {
    recv_info_t *info = (recv_info_t *)arg;
    int sockfd = info->sockfd;
    Display* display = info->display;
    GC gc = info->gc;
    GC his_gc = info->his_gc;
    GC refresh_gc = info->refresh_gc;
    int window = info->window;
    int i = 0;
    while(sending) {
        int data[5];
        int n = read(sockfd,data,5*sizeof(int));
        if(n < 0) error("ERROR reading from socket");
        if(data[4] == 0) {
            if(is_OK2(data[2], data[3])) {
                XDrawLine(display, window, his_gc, data[0], data[1], data[2], data[3]);
                XDrawLine(display, back_buffer, his_gc, data[0], data[1], data[2], data[3]);
            }
        }
        else if(data[4] == 1) XSetLineAttributes(display, his_gc, data[0], line_style, cap_style, join_style);
        else if(data[4] == 2) XSetForeground(display, his_gc, data[0]);
        else if(data[4] == 3) clear_all(display, window, refresh_gc);
        else if(data[4] == -1) sending = 0; //Our friend died
        XFlush(display);
    }
}
Exemple #5
0
EdbusMessage::~EdbusMessage() {
	if(!dm)
		return;

	clear_all();
	delete dm;
}
		void set_device_map(const device_option_map_t& devmap)
		{
			clear_all();
			for (device_option_map_t::const_iterator iter = devmap.begin(); iter != devmap.end(); ++iter) {
				this->add_new_row(iter->first, iter->second, false);
			}
		}
Exemple #7
0
/**
 * Enable/disable vidmix source
 *
 * @param src    Video mixer source
 * @param enable True to enable, false to disable
 */
void vidmix_source_enable(struct vidmix_source *src, bool enable)
{
	if (!src)
		return;

	if (src->le.list && enable)
		return;

	if (!src->le.list && !enable)
		return;

	pthread_rwlock_wrlock(&src->mix->rwlock);

	if (enable) {
		if (src->frame_rx)
			clear_frame(src->frame_rx);

		list_append(&src->mix->srcl, &src->le, src);
	}
	else {
		list_unlink(&src->le);
	}

	clear_all(src->mix);

	pthread_rwlock_unlock(&src->mix->rwlock);
}
Exemple #8
0
/**
 * Put a video frame into the video mixer
 *
 * @param src   Video source
 * @param frame Video frame
 */
void vidmix_source_put(struct vidmix_source *src, const struct vidframe *frame)
{
	if (!src || !frame || frame->fmt != VID_FMT_YUV420P)
		return;

	if (!src->frame_rx || !vidsz_cmp(&src->frame_rx->size, &frame->size)) {

		struct vidframe *frm;
		int err;

		err = vidframe_alloc(&frm, VID_FMT_YUV420P, &frame->size);
		if (err)
			return;

		pthread_rwlock_wrlock(&src->mix->rwlock);

		mem_deref(src->frame_rx);
		src->frame_rx = frm;

		clear_all(src->mix);

		pthread_rwlock_unlock(&src->mix->rwlock);
	}

	vidframe_copy(src->frame_rx, frame);
}
Exemple #9
0
int main( void )
{
  // Stop watchdog timer to prevent time out reset
	
  unsigned char i,j;
  WDTCTL = WDTPW + WDTHOLD;
  init_fstn();
  clear_all();
  show_hanzi(hanzi_table,0,0);
  show_hanzi(hanzi_table+32,0,16);
  show_hanzi(hanzi_table+64,0,32);
  
  for(i=0;i<4;i++)
  {
	  for(j=0;j<6;j++)
	  {
		  show_hanzi(poem_table+(6*i+j)*32,2*(i+1),j*16);
	  }	  
  }
  
  show_str("123456",//ASCII字符
			   8,//参数page取值为0~11,从上到下
			   120,//参数col取值为0~127从左到右
			   1//是否反显呢?1是0否
			   );
  while(1)
  {
	
  }
}
Exemple #10
0
int main(void){
  int count, v, i, j, start;
  
  pi = atan(1)*4;
  count = 0;
  while (scanf("%d\n", &num_edges) == 1 && num_edges > 0) {
    if (count > 0) printf("\n");
    printf("Case %d\n", ++count);
    clear_all();
    build_graph();
    while ((v = next_node(&start)) != -1) {
      traverse(v, 1, start, start);

      /* DEBUG */      
      printf("\nGraph:\n\n");
      for (i = 0; i < num_nodes; i++) {
	for (j = 0; j < num_nodes; j++) {
	  printf("%3d", graph[i][j]);
	}
	printf("\n");
      }
      printf("\n");
      /* End of DEBUG */
    }
    print_freq();
  }
  return 0;
}
Exemple #11
0
control *
whatdoto_1_svc(control *argp, struct svc_req *rqstp)
{
	static control  result;
	if(reset) //se host atual detectou que coordenador caiu
	{
		clear_all();
		result.action = 100;
		reset = 0;
	}
	else if((current_user == manager && was_send == 0) || has_new_player) //envia perguntas caso seja coordenador e nao envio as perguntas
	{									// ou se existe um novo usuario
		result.action = 1;
		has_new_player = 0;
	}
	else if(has_ask == 3 && questions_answered < 3) // requisita resposta quando tem as perguntas e nao forao todas respondidas
	{
		result.action = 2;
	}
	else if(questions_answered == 3 && finished == 0) // requita fim de jogo
	{
		finished = 1;
		result.action = 3;
	}
	//else if(current_user == manager)
	//{
	//	result.action = 4;
	//}
	else
	{
		result.action = 0;
	}

	return &result;
}
Exemple #12
0
int module_reset()
{
  if (!win_anthy)
    return 0;
  int v = !is_empty();

  clear_all();
  return v;
}
Exemple #13
0
void test_atoi_not_good_string()
{
	clear_all();
	//not int value in string for atoi
	strcpy(a,"142c123");
	int x;
	int f = myAtoi(a,&x);
	assert(f==-1);
}
Exemple #14
0
void test_atoi_empty()
{
	clear_all();
	//empty string 
	a[0]='\0';
	int x;
	int f=myAtoi(a,&x);
	assert(f==-1);
}
Exemple #15
0
Fichier : calc.c Projet : zerist/c-
//当小数点按下时
void on_dot_clicked(GtkButton * button, gpointer data){
    gint i;
    if(have_result)
        clear_all(); //全部清除
    if(have_dot == FALSE){
        have_dot = TRUE;
        i = g_strlcat(number, ".", 100);
        gtk_entry_set_text(GTK_ENTRY(entry), number);
    }
}
Exemple #16
0
void test_reverse_empty()
{
	clear_all();
	//reverse of emtpy string
	a[0]='\0';
	reverse(a);
	assert(strlen(a)==0);
	assert(a[0]=='\0');
	//accepted
}
Exemple #17
0
void test_strcmp_e2()
{
	clear_all();
	//compare 2 empty strings
	a[0]='\0';
	b[0]='\0';
	int x=myStrcmp(a,b,20);
	assert(x==0);
	//accepted
}
Exemple #18
0
void SpriteFrames::_set_frames(const Array &p_frames) {

	clear_all();
	Map<StringName, Anim>::Element *E = animations.find(SceneStringNames::get_singleton()->_default);
	ERR_FAIL_COND(!E);

	E->get().frames.resize(p_frames.size());
	for (int i = 0; i < E->get().frames.size(); i++)
		E->get().frames.write[i] = p_frames[i];
}
Exemple #19
0
void test_strcmp_same()
{
	clear_all();
	//same strings. n>strlen()
	strcpy(a,"abc");
	strcpy(b,"abc");
	int x=myStrcmp(a,b,5);
	assert(x==0);
	//accepted
}
Exemple #20
0
void test_strcat_over()
{
	//very long string to very short string
	clear_all();
	int n=70;
	strcpy(e,"petya");
	strcpy(d,"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
	int f = myStrcat(e,d,n);
	assert(f==-1);
	assert(strlen(e)==5);
}
Exemple #21
0
void test_itoa_negative()
{
	clear_all();
	//negative int value
	int x=-980;
	int f = myItoa(x,a);
	assert(strlen(a)==4);
	assert(a[0]=='-' && a[1]=='9' && a[2]=='8' && a[3]=='0');
	assert(f == 0);
	//accepted
}
Exemple #22
0
void test_itoa_zero()
{
	clear_all();
	//ITOA for 0
	int f = 0;
	myItoa(f, b);
	assert(b != 0);
	assert(strlen(b) == 1);
	assert(b[0] == '0');
	//accepted
}
Exemple #23
0
void test_strcmp_e1()
{
	clear_all();
	//compare an empty string and non-empty string
	a[0]='\0';
	b[0]='1';
	b[1]='a';
	int x=myStrcmp(a,b,20);
	assert(x==-1);
	//accepted
}
Exemple #24
0
void test_strcmp_d()
{
	clear_all();
	//different strings
	strcpy(a,"lol");
	strcpy(b,"aol");
	int x=myStrcmp(a,b,3);
	assert(x==1);
	//accepted
	
}
Exemple #25
0
void test_strcat_etn()
{
	clear_all();
	//strcat empty to non-empty string
	a[0]='1';
	b[0]='\0';
	myStrcat(a,b,12);
	assert(strlen(a)==1 && strlen(b)==0);
	assert(a[0]=='1');
	//accepted
}
Exemple #26
0
void test_stridx()
{
	clear_all();
	//non-empty char
	char l='g';
	a[0]='1';
	a[1]='g';
	a[2]='g';
	int idx=stridx(l,a);
	assert(idx==1);
	//accepted
}
Exemple #27
0
void test_cpy_nte()
{
	clear_all();
	//copy non-empty string to empty
	int n=12;
	a[0]='\0';
	b[0]='1';
	int f = myStrcpy(a,b,n);
	assert(strlen(a)==1);
	assert(f == 0);
	//accepted
}
Exemple #28
0
void test_atoi_negative()
{
	clear_all();
	//negative int value in string for atoi
	a[0]='-';
	a[1]='2';
	int x;
	int f = myAtoi(a,&x);
	assert(x==-2);
	assert(f==0);
	//accepted
}
Exemple #29
0
void test_atoi_positive()
{
	clear_all();
	//positive int value in string for atoi
	a[0]='+';
	a[1]='1';
	int x;
	int f = myAtoi(a,&x);
	assert(x==1);
	assert(f==0);
	//accepted
}
void map_labels::read(const config &cfg)
{
	clear_all();

	BOOST_FOREACH(const config &i, cfg.child_range("label"))
	{
		const map_location loc(i, resources::state_of_game);
		terrain_label *label = new terrain_label(*this, i);
		add_label(loc, label);
	}
	recalculate_labels();
}