Ejemplo n.º 1
0
int GFastaIndex::storeIndex(FILE* fai) {
  int rcount=0;
  GList<GFastaRec> reclist(true,false,true); //sorted, don't free members, unique
  records.startIterate();
  GFastaRec* rec=NULL;
  while ((rec=records.NextData())!=NULL) {
    reclist.Add(rec);
    }
  //reclist has records sorted by file offset
  for (int i=0;i<reclist.Count();i++) {
#ifdef __WIN32__
    int written=fprintf(fai, "%s\t%d\t%ld\t%d\t%d\n",
            reclist[i]->seqname,reclist[i]->seqlen,(long)reclist[i]->fpos,
              reclist[i]->line_len, reclist[i]->line_blen);
#else
    int written=fprintf(fai, "%s\t%d\t%lld\t%d\t%d\n",
            reclist[i]->seqname, reclist[i]->seqlen, (long long)(reclist[i]->fpos),
              reclist[i]->line_len, reclist[i]->line_blen);
#endif
    if (written>0) rcount++;
       else break; //couldn't write anymore
    }
  fclose(fai);
  haveFai=(rcount>0);
  return rcount;
}
Ejemplo n.º 2
0
static void grid_init()
{
	snake *temp = NULL;
	ps.s = reclist(0, NULL);
	for (temp = ps.s; temp->next; temp = temp->next);
/* Circular list: first elem has a ptr to last elem */
		ps.s->previous = temp;
	fruit_gen();
}
Ejemplo n.º 3
0
static snake *reclist(int i, snake *previous)
{
	snake *s = malloc(sizeof(snake));
	if ((s) && (i != STARTING_SIZE)) {
		s->x = ROWS/2;
		s->y = COLS/2 - i;
		s->direction = RIGHT;
		ps.grid[s->x][s->y] = 'O';
		wattron(ps.field, COLOR_PAIR(2));
		mvwprintw(ps.field, s->x + 1, s->y + 1, "%c", ps.grid[s->x][s->y]);
		wattroff(ps.field, COLOR_PAIR);
		s->previous = previous;
		s->next = reclist(i + 1, s);
	} else {
		s = NULL;
	}
	return s;
}
Ejemplo n.º 4
0
void
O2DatDB::
UpdateThread(void)
{
	time_t t = time(NULL);

	while (UpdateThreadLoop) {
		if (time(NULL) - t >= UPDATE_THREAD_INTERVAL_S) {
			UpdateQueueLock.Lock();
			O2DatRecList reclist(UpdateQueue);
			UpdateQueue.clear();
			UpdateQueueLock.Unlock();

			if (!reclist.empty())
				update(reclist);
			t = time(NULL);
			CLEAR_WORKSET;
			//TRACEA("+++++ UPDATE +++++\n");
		}
		Sleep(3000);
	}
}