VALUE rb_struct_alloc_noinit(VALUE klass) { return struct_alloc(klass); }
static struct loop *construct_loop(int ibase) /* * Starting at residue ibase, recursively constructs the loop containing * said base and all deeper bases. */ { int i,mate; struct loop *retloop,*lp; struct connection *cp; struct region *rp; struct radloop *rlp; retloop = &loops[loop_count++]; retloop->nconnection = 0; retloop->connections = (struct connection **) vrna_alloc(sizeof(struct connection *)); retloop->depth = 0; retloop->number = loop_count; retloop->radius = 0.0; for (rlp = rlphead; rlp; rlp = rlp->next) if (rlp->loopnumber == loop_count) retloop->radius = rlp->radius; i = ibase; do { if ((mate = bases[i].mate) != 0) { rp = bases[i].region; if (!bases[rp->start1].extracted) { if (i == rp->start1) { bases[rp->start1].extracted = true; bases[rp->end1].extracted = true; bases[rp->start2].extracted = true; bases[rp->end2].extracted = true; lp = construct_loop(rp->end1 < nbase ? rp->end1+1 : 0); } else if (i == rp->start2){ bases[rp->start2].extracted = true; bases[rp->end2].extracted = true; bases[rp->start1].extracted = true; bases[rp->end1].extracted = true; lp = construct_loop(rp->end2 < nbase ? rp->end2+1 : 0); } else { fprintf(stderr, "naview: Error detected in construct_loop. i = %d not found in region table.\n",i); exit(FATAL_ERROR); } retloop->connections = (struct connection **) realloc(retloop->connections, (++retloop->nconnection+1) * sizeof(struct connection *)); retloop->connections[retloop->nconnection-1] = cp = struct_alloc(connection); retloop->connections[retloop->nconnection] = NULL; cp->loop = lp; cp->region = rp; if (i == rp->start1) { cp->start = rp->start1; cp->end = rp->end2; } else { cp->start = rp->start2; cp->end = rp->end1; } cp->extruded = false; cp->broken = false; lp->connections = (struct connection **) realloc(lp->connections, (++lp->nconnection+1) * sizeof(struct connection *)); lp->connections[lp->nconnection-1] = cp = struct_alloc(connection); lp->connections[lp->nconnection] = NULL; cp->loop = retloop; cp->region = rp; if (i == rp->start1) { cp->start = rp->start2; cp->end = rp->end1; } else { cp->start = rp->start1; cp->end = rp->end2; } cp->extruded = false; cp->broken = false; } i = mate; } if (++i > nbase) i = 0; } while (i != ibase); return retloop; }