Index: trunk/src/plugins/rt_topo/crbs_route.c =================================================================== --- trunk/src/plugins/rt_topo/crbs_route.c (revision 1350) +++ trunk/src/plugins/rt_topo/crbs_route.c (revision 1351) @@ -143,6 +143,23 @@ return &a; } +/* +static void print_det(grbs_detached_addr_t *det) +{ + printf("type=%d ", det->type); + if (det->arc != NULL) printf("arc=%ld ", det->arc->uid); + if (det->pt != NULL) printf("P%ld ", det->pt->uid); + printf("u=%ld new=(r%f %f %f|%d)", det->user_long, det->new_r, det->new_sa, det->new_da, det->new_adir); +} + + +static void print_detkey(grbs_addr_key_t key) +{ + printf("ang=%d o%d conc=%d %s P%d", key.ang, key.orbit, key.is_concave, key.is_ccw ? "ccw" : "cw", key.pt_uid); +} +*/ + + /* Attempt to create a grbs path segment from curr to pt:adir. If fails, return NULL. If succeeds, remove the path segment from the grbs context, add a detached address of it to the hash and return it. */ @@ -212,11 +229,14 @@ #warning TODO: allocate this with ualloc stacks val.det = res = calloc(sizeof(grbs_detached_addr_t), 1); memcpy(val.det, &dtmp, sizeof(dtmp)); + val.det->user_long = adir; +/* printf("\nDET SET: key: "); print_detkey(key); printf(" | det: ");print_det(res); printf("\n");*/ htad_set(&crbs->addrs, key, val); - val.det->user_long = adir; } - else + else { res = e->value.det; +/* printf("\nDET S2T: key: "); print_detkey(grbs_det_addr_to_key(res)); printf(" | det: ");print_det(res); printf("\n");*/ + } grbs_path_cleanup_addr(&crbs->grbs, toa); } @@ -304,6 +324,8 @@ return NULL; } +void d1() {} + static void crbs_ast_set_mark(usrch_a_star_t *ctx, void *node, usrch_a_star_node_t *mark) { crbs_t *crbs = ctx->user_data; @@ -320,7 +342,14 @@ return; } +/* { + static dcnt=0; + dcnt++; + printf("DET get: key: "); print_detkey(grbs_det_addr_to_key(det)); printf(" | det: ");print_det(det); printf(" {%d}\n", dcnt); + }*/ e = htad_getentry(&crbs->addrs, grbs_det_addr_to_key(det)); +/* printf("DET res: e=%p\n", e);*/ + fflush(stdout); assert(e != NULL); e->value.mark = mark; } @@ -372,6 +401,16 @@ for(tn = gdl_first(&crbs->twonets); tn != NULL; tn = gdl_next(&crbs->twonets, tn)) tn->coll = 0; + /* reset address hash */ + { + htad_entry_t *e; + +/* printf("DET: --- reset ---\n");*/ + for(e = htad_first(&crbs->addrs); e != NULL; e = htad_next(&crbs->addrs, e)) + free(e->value.det); + htad_clear(&crbs->addrs); + } + ast.heuristic = crbs_ast_heuristic; ast.cost = crbs_ast_cost; ast.neighbor_pre = crbs_ast_neighbor_pre;