int naview_xy_coordinates(short *pair_table, float *X, float *Y) { int i; nbase = pair_table[0]; /* length */ bases = (struct base *) vrna_alloc(sizeof(struct base)*(nbase+1)); regions = (struct region *) vrna_alloc(sizeof(struct region)*(nbase+1)); read_in_bases(pair_table); lencut = 0.5; rlphead = NULL; find_regions(); loop_count = 0; loops = (struct loop *) vrna_alloc(sizeof(struct loop)*(nbase+1)); construct_loop(0); find_central_loop(); if (debug) dump_loops(); traverse_loop(root,NULL); for (i=0; i<nbase; i++) { X[i] = 100 + 15*bases[i+1].x; Y[i] = 100 + 15*bases[i+1].y; } free(bases); free(regions); free(loops); return nbase; }
void BuildLoopTree(void) { BLOCKLIST bl; BLOCK *b; int i; QUAD *tail; BOOL skip = FALSE; /* this is padded, but, in a really really complex program it could get to be too small */ loopArray = oAlloc(sizeof(LOOP *) * blockCount * 4); loopItems = briggsAlloc((blockCount) * 4); loopCount = 0; for (i=0; i < blockCount; i++) { if (blockArray[i]) { blockArray[i]->visiteddfst = FALSE; blockArray[i]->loopParent = NULL; blockArray[i]->loopName = oAlloc(sizeof(LOOP)); blockArray[i]->loopName->type = LT_BLOCK; blockArray[i]->loopName->entry = blockArray[i]; blockArray[i]->loopName->loopnum = loopCount; blockArray[i]->loopGenerators = NULL; loopArray[loopCount++] = blockArray[i]->loopName; } // else // loopCount++; } Loop(blockArray[0]); // CalculateSuccessors(loopArray[loopCount-1]); memset(&bl, 0, sizeof(bl)); bl.block = blockArray[exitBlock]; FindBody(&bl, blockArray[0], LT_ROOT); CalculateLoopedBlocks(loopArray[loopCount-1]); if (cparams.prm_icdfile) { fprintf(icdFile, "; loop dump\n"); dump_loops(); } tail = intermed_tail; b = tail->block; while (tail) { switch(tail->dc.opcode) { case i_skipcompare: skip = !skip; break; case i_block: b = tail->block; break; } if (tail->block) { if (skip) { tail->block->inclusiveLoopParent = b->loopParent; } else { tail->block->inclusiveLoopParent = tail->block->loopParent; } } tail = tail->back; } if (loopCount >= blockCount * 4) fatal("internal error"); }