void tarjan_local_deinit (run_t *run, wctx_t *ctx) { alg_local_t *loc = ctx->local; dfs_stack_destroy (loc->search_stack); dfs_stack_destroy (loc->tarjan_stack); fset_free (loc->visited_states); RTfree (loc); (void) run; }
void cndfs_local_deinit (run_t *run, wctx_t *ctx) { cndfs_alg_local_t *cloc = (cndfs_alg_local_t *) ctx->local; if (run->shared->rec != NULL) { alg_local_deinit (run->shared->rec, ctx->global->rec); wctx_deinit (ctx->global->rec); // see cndfs_local_init } dfs_stack_destroy (cloc->in_stack); dfs_stack_destroy (cloc->out_stack); RTdeleteTimer (cloc->timer); fset_free (cloc->pink); ndfs_local_deinit (run, ctx); }
void ndfs_local_deinit (run_t *run, wctx_t *ctx) { alg_local_t *loc = ctx->local; if (all_red) bitvector_free (&loc->stackbits); bitvector_free (&loc->color_map); dfs_stack_destroy (loc->stack); RTfree (loc); (void) run; }
int main() { dfs_stack_t stack = dfs_stack_create (ARRAY_SIZE); size_t x; printf("Filling stack\n"); for (x = 0; x<NUM; x++) { int ar[ARRAY_SIZE]; ar[0] = x; ar[ARRAY_SIZE-1] = -x; dfs_stack_push(stack, ar); if (x%(NUM/FRAMES)==0) { printf("entered frame after: %zu - %zu\n", x, -x); dfs_stack_enter(stack); } } char tmp[256]; ssize_t tmpsz = sizeof tmp; printf("%s\n", dfs_stack_to_string(stack, tmp, &tmpsz)); for (x = 0; x<=FRAMES; x++) { int* ar = dfs_stack_peek_top(stack, x); printf("peek_top(%zu): %d - %d\n", x, ar[0], ar[ARRAY_SIZE-1]); } printf("Emptying stack stack\n"); for (x = 0; x<NUM; x++) { int* ar; if ((ar = dfs_stack_top(stack))==NULL) { dfs_stack_leave(stack); ar = dfs_stack_top(stack); printf("leave frame before: %d - %d\n", ar[0], ar[ARRAY_SIZE-1]); } ar = dfs_stack_pop(stack); } printf("DONE\n"); //pop(stack); dfs_stack_destroy(stack); return 0; }