From: yu.dongliang <18588496441@163.com> Date: Wed, 1 Nov 2023 06:36:51 +0000 (+0800) Subject: ses_cross() X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=3571dd693ff5e860313f5b1f37965f62ab5e2572;p=ses.git ses_cross() --- diff --git a/ses_layout.c b/ses_layout.c index 1f311e5..0134c0d 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -859,7 +859,7 @@ next: n_crosses += edge0->crosses->size; } - scf_loge("n_crosses: %ld\n\n", n_crosses); + scf_loge("edge->size: %d, n_crosses: %ld\n\n", edges->size, n_crosses); #endif return 0; @@ -1253,24 +1253,31 @@ int ses_cross(ScfEfunction* f, int d) { scf_vector_t* graph = scf_vector_alloc(); scf_vector_t* colors = scf_vector_alloc(); + ses_edge_t* edge; + intptr_t N = 4; + intptr_t i; + scf_loge("\n"); __ses_get_crosses(f, d, graph); - scf_vector_add(colors, (void*)1); - scf_vector_add(colors, (void*)2); + for (i = 0; i < graph->size; i++) { + edge = graph->data[i]; + scf_logi("i: %ld, c%ld->color: %ld\n", i, edge->c->id, edge->color); + } + + for (i = 1; i <= N; i++) + scf_vector_add(colors, (void*)i); - int ret = ses_cross_graph_kcolor(graph, 2, colors); + int ret = ses_cross_graph_kcolor(graph, N, colors); if (ret < 0) { scf_loge("\n"); } - int i; for (i = 0; i < graph->size; i++) { edge = graph->data[i]; - - scf_logi("i: %d, c%ld->color: %ld\n", i, edge->c->id, edge->color); + scf_logi("i: %ld, c%ld->color: %ld\n", i, edge->c->id, edge->color); } scf_vector_clear(graph, ( void (*)(void*) )ses_edge_free); @@ -1305,14 +1312,14 @@ int ses_layout_function(ScfEfunction* f, int d) qsort(f->elines, f->n_elines, sizeof(ScfEline*), eline_cmp_id); + ses_cross(f, d); + __ses_de_cross(f, d); __ses_setc_xy(f, d); __ses_xchg_cx(f, d); __ses_xchg_ce(f, d); - ses_cross(f, d); - __ses_mov_pos(f, d); __ses_layout_cx(f, d);