Beispiel #1
0
int
check_dir(HWND hwnd)
{
int i;
WIZPAGE *page;
    GetDlgItemText(hwnd, ID_ANSWER, (PBYTE)destdir, sizeof(destdir));
    page = find_page_from_id(IDD_MKDIR);
    if (page)
	SetDlgItemText((page->hwnd), IDD_MKDIR_TEXT, (PCSZ)destdir);

    /* check if directory exists */
    i = strlen(destdir) - 1;
    if ((i >= 2) && (destdir[i] == '\\') )
       destdir[i] = '\0';
    if (strlen(destdir)==0)
	return IDD_DIR;

    if (!gs_chdir(destdir)) {
	if (init_temp())
            return IDD_CONFIG;
	else
	    return IDD_FINISH;
    }

    /* if it does not, continue to IDD_MKDIR */
    return 0;
}
Beispiel #2
0
int
make_dir(HWND hwnd)
{
char buf[MAXSTR];
    if (!mkdirall(destdir)) {
	/* succeeded */
	if (init_temp())
            return 0;
	else
	    return IDD_FINISH;
    }

    /* failed */ 
    load_string(IDS_MKDIRFAIL, buf, sizeof(buf)-1);
    message_box(buf, MB_OK);
    return IDD_DIR;
}
Beispiel #3
0
int main(void){
	
	init_serial();
	init_ISR();				//initialize all functions, ports...
	init_led();
	init_buttons();
	init_temp();
	get_temp();
	ht=temp;
	lt=temp;
	init_lcd();

	while(1){
		get_temp();				//recieve the temp, convert and print
		led_on();				//turn the led functions on
		get_serial();			//recieve the temp through serial
	}
	
	return 0;
}
Beispiel #4
0
main() {

   init_temp();
   lcd_init();
   delay_ms(6);
   
   reset_temp();

   while(TRUE)
   {
      current_temp = read_temp();

      if(input(RESET_BUTTON)==0)
         reset_temp();
      else if(current_temp>max_temp)
         max_temp=current_temp;
      else if(current_temp<min_temp)
         min_temp=current_temp;

      printf(lcd_putc,"\fCurrent Temp: %U F\nMin: %U Max: %U",                        current_temp,min_temp,max_temp);
      delay_ms(500);
   }
}
Beispiel #5
0
float anneal(Annealing *search) {
  unsigned int wmcount = search->pssm_count;
  unsigned int i, k, wm;
  float temperature, max_score;;
  float score = 0.0;


  init_temp(search, STARTEMP_ITERATIONS);
  temperature = search->start_temp;

  acc = 0.5;

  PSSM *best = malloc(wmcount * sizeof(PSSM));

  i = wmcount;
  while (i--) {
    best[i] = clone_pssm(WM(i));   
    search->best_cut[i] = search->cut[i];
    score = anneal_search(search, i);
/*     struct HitTable *hits = HITS(i);   */
  }

  
  max_score = score; 
  search->best_step = 0;
  search->best_pos = search->pos_score;
  search->best_neg = search->neg_score;

  i = wmcount;
  while (i--) 
    save_wm(search, i);

  /* Annealing */
  if (search->loglevel >= NORMAL) {
    printf("\nAnnealing\n=============================================\n");
  }

  wm = 0;
  i = search->maxit;
  LOG_STEP("---", NORMAL);

  while (i--) {
    if (wmcount == 2) wm = !wm;
    score = anneal_step_wm(search, temperature, score, wm);

    /* New best score => save results */
    if (score > max_score) {
      max_score = score;
      search->best_step = search->maxit - i;
      search->best_pos = search->pos_score;
      search->best_neg = search->neg_score;
      
      k = wmcount;
      while (k--) {
	copy_pssm(WM(k), best[k]);
	search->best_cut[k] = search->cut[k];
      }

      LOG_STEP("***", NORMAL);
    }

    if (!(i % 10000)){
      LOG_STEP("---", NORMAL);
    } else {
      LOG_STEP("---", TRACE);
    }
    
    /* Dynamic ratio */
    if (search->schedule == EXPONENTIAL) {
      temperature *= EXP_FACTOR;
    } else {
      temperature -= LIN_FACTOR;
    }
  }

  k = wmcount;
  while (k--) {
    copy_pssm(best[k], WM(k));
    search->cut[k] = search->best_cut[k];
  }

  search->best_score = max_score;

  /* Clean up */
  i = wmcount;
  while (i--) {
    anneal_search(search, i);
    free(best[i]);
  }
  free(best);

  score = (*search->scorefunc)(search);

  return score;
}