📄 vcg.c
字号:
ce->red_cp = red_cp; ce->green_cp = green_cp; ce->blue_cp = blue_cp; ce->next = g->colorentry; g->colorentry = ce;}/*-------------------------------------.| Open and close functions (formatted) |`-------------------------------------*/voidopen_edge (edge *e, FILE *fout){ switch (e->type) { case normal_edge: fputs ("\tedge: {\n", fout); break; case back_edge: fputs ("\tbackedge: {\n", fout); break; case near_edge: fputs ("\tnearedge: {\n", fout); break; case bent_near_edge: fputs ("\tbentnearedge: {\n", fout); break; default: fputs ("\tedge: {\n", fout); }}voidclose_edge (FILE *fout){ fputs ("\t}\n", fout);}voidopen_node (FILE *fout){ fputs ("\tnode: {\n", fout);}voidclose_node (FILE *fout){ fputs ("\t}\n", fout);}voidopen_graph (FILE *fout){ fputs ("graph: {\n", fout);}voidclose_graph (graph *g, FILE *fout){ fputc ('\n', fout); /* FIXME: Unallocate nodes and edges if required. */ { node *n; for (n = g->node_list; n; n = n->next) { open_node (fout); output_node (n, fout); close_node (fout); } } fputc ('\n', fout); { edge *e; for (e = g->edge_list; e; e = e->next) { open_edge (e, fout); output_edge (e, fout); close_edge (fout); } } fputs ("}\n", fout);}/*-------------------------------------------.| Output functions (formatted) in file FOUT |`-------------------------------------------*/voidoutput_node (node *n, FILE *fout){ if (n->title != N_TITLE) fprintf (fout, "\t\ttitle:\t%s\n", quote (n->title)); if (n->label != N_LABEL) fprintf (fout, "\t\tlabel:\t%s\n", quote (n->label)); if ((n->locx != N_LOCX) && (n->locy != N_LOCY)) fprintf (fout, "\t\tloc { x: %d y: %d }\t\n", n->locx, n->locy); if (n->vertical_order != N_VERTICAL_ORDER) fprintf (fout, "\t\tvertical_order:\t%d\n", n->vertical_order); if (n->horizontal_order != N_HORIZONTAL_ORDER) fprintf (fout, "\t\thorizontal_order:\t%d\n", n->horizontal_order); if (n->width != N_WIDTH) fprintf (fout, "\t\twidth:\t%d\n", n->width); if (n->height != N_HEIGHT) fprintf (fout, "\t\theight:\t%d\n", n->height); if (n->shrink != N_SHRINK) fprintf (fout, "\t\tshrink:\t%d\n", n->shrink); if (n->stretch != N_STRETCH) fprintf (fout, "\t\tstretch:\t%d\n", n->stretch); if (n->folding != N_FOLDING) fprintf (fout, "\t\tfolding:\t%d\n", n->folding); if (n->textmode != N_TEXTMODE) fprintf (fout, "\t\ttextmode:\t%s\n", get_textmode_str (n->textmode)); if (n->shape != N_SHAPE) fprintf (fout, "\t\tshape:\t%s\n", get_shape_str (n->shape)); if (n->borderwidth != N_BORDERWIDTH) fprintf (fout, "\t\tborderwidth:\t%d\n", n->borderwidth); if (n->color != N_COLOR) fprintf (fout, "\t\tcolor:\t%s\n", get_color_str (n->color)); if (n->textcolor != N_TEXTCOLOR) fprintf (fout, "\t\ttextcolor:\t%s\n", get_color_str (n->textcolor)); if (n->bordercolor != N_BORDERCOLOR) fprintf (fout, "\t\tbordercolor:\t%s\n", get_color_str (n->bordercolor)); { int i; for (i = 0; i < 3; ++i) if (n->infos[i]) fprintf (fout, "\t\tinfo%d:\t%s\n", i, quote (n->infos[i])); }}voidoutput_edge (edge *e, FILE *fout){ /* FIXME: SOURCENAME and TARGETNAME are mandatory so it has to be fatal not to give these informations. */ if (e->sourcename != E_SOURCENAME) fprintf (fout, "\t\tsourcename:\t%s\n", quote (e->sourcename)); if (e->targetname != E_TARGETNAME) fprintf (fout, "\t\ttargetname:\t%s\n", quote (e->targetname)); if (e->label != E_LABEL) fprintf (fout, "\t\tlabel:\t%s\n", quote (e->label)); if (e->linestyle != E_LINESTYLE) fprintf (fout, "\t\tlinestyle:\t%s\n", quote (get_linestyle_str (e->linestyle))); if (e->thickness != E_THICKNESS) fprintf (fout, "\t\tthickness:\t%d\n", e->thickness); if (e->class != E_CLASS) fprintf (fout, "\t\tclass:\t%d\n", e->class); if (e->color != E_COLOR) fprintf (fout, "\t\tcolor:\t%s\n", get_color_str (e->color)); if (e->color != E_TEXTCOLOR) fprintf (fout, "\t\ttextcolor:\t%s\n", get_color_str (e->textcolor)); if (e->arrowcolor != E_ARROWCOLOR) fprintf (fout, "\t\tarrowcolor:\t%s\n", get_color_str (e->arrowcolor)); if (e->backarrowcolor != E_BACKARROWCOLOR) fprintf (fout, "\t\tbackarrowcolor:\t%s\n", get_color_str (e->backarrowcolor)); if (e->arrowsize != E_ARROWSIZE) fprintf (fout, "\t\tarrowsize:\t%d\n", e->arrowsize); if (e->backarrowsize != E_BACKARROWSIZE) fprintf (fout, "\t\tbackarrowsize:\t%d\n", e->backarrowsize); if (e->arrowstyle != E_ARROWSTYLE) fprintf (fout, "\t\tarrowstyle:\t%s\n", get_arrowstyle_str (e->arrowstyle)); if (e->backarrowstyle != E_BACKARROWSTYLE) fprintf (fout, "\t\tbackarrowstyle:\t%s\n", get_arrowstyle_str (e->backarrowstyle)); if (e->priority != E_PRIORITY) fprintf (fout, "\t\tpriority:\t%d\n", e->priority); if (e->anchor != E_ANCHOR) fprintf (fout, "\t\tanchor:\t%d\n", e->anchor); if (e->horizontal_order != E_HORIZONTAL_ORDER) fprintf (fout, "\t\thorizontal_order:\t%d\n", e->horizontal_order);}voidoutput_graph (graph *g, FILE *fout){ if (g->title) fprintf (fout, "\ttitle:\t%s\n", quote (g->title)); if (g->label) fprintf (fout, "\tlabel:\t%s\n", quote (g->label)); { int i; for (i = 0; i < 3; ++i) if (g->infos[i]) fprintf (fout, "\tinfo%d:\t%s\n", i, quote (g->infos[i])); } if (g->color != G_COLOR) fprintf (fout, "\tcolor:\t%s\n", get_color_str (g->color)); if (g->textcolor != G_TEXTCOLOR) fprintf (fout, "\ttextcolor:\t%s\n", get_color_str (g->textcolor)); if (g->bordercolor != G_BORDERCOLOR) fprintf (fout, "\tbordercolor:\t%s\n", get_color_str (g->bordercolor)); if (g->width != G_WIDTH) fprintf (fout, "\twidth:\t%d\n", g->width); if (g->height != G_HEIGHT) fprintf (fout, "\theight:\t%d\n", g->height); if (g->borderwidth != G_BORDERWIDTH) fprintf (fout, "\tborderwidth:\t%d\n", g->borderwidth); if (g->x != G_X) fprintf (fout, "\tx:\t%d\n", g->x); if (g->y != G_Y) fprintf (fout, "\ty:\t%d\n", g->y); if (g->folding != G_FOLDING) fprintf (fout, "\tfolding:\t%d\n", g->folding); if (g->shrink != G_SHRINK) fprintf (fout, "\tshrink:\t%d\n", g->shrink); if (g->stretch != G_STRETCH) fprintf (fout, "\tstretch:\t%d\n", g->stretch); if (g->textmode != G_TEXTMODE) fprintf (fout, "\ttextmode:\t%s\n", get_textmode_str (g->textmode)); if (g->shape != G_SHAPE) fprintf (fout, "\tshape:\t%s\n", get_shape_str (g->shape)); if (g->vertical_order != G_VERTICAL_ORDER) fprintf (fout, "\tvertical_order:\t%d\n", g->vertical_order); if (g->horizontal_order != G_HORIZONTAL_ORDER) fprintf (fout, "\thorizontal_order:\t%d\n", g->horizontal_order); if (g->xmax != G_XMAX) fprintf (fout, "\txmax:\t%d\n", g->xmax); if (g->ymax != G_YMAX) fprintf (fout, "\tymax:\t%d\n", g->ymax); if (g->xbase != G_XBASE) fprintf (fout, "\txbase:\t%d\n", g->xbase); if (g->ybase != G_YBASE) fprintf (fout, "\tybase:\t%d\n", g->ybase); if (g->xspace != G_XSPACE) fprintf (fout, "\txspace:\t%d\n", g->xspace); if (g->yspace != G_YSPACE) fprintf (fout, "\tyspace:\t%d\n", g->yspace); if (g->xlspace != G_XLSPACE) fprintf (fout, "\txlspace:\t%d\n", g->xlspace); if (g->xraster != G_XRASTER) fprintf (fout, "\txraster:\t%d\n", g->xraster); if (g->yraster != G_YRASTER) fprintf (fout, "\tyraster:\t%d\n", g->yraster); if (g->xlraster != G_XLRASTER) fprintf (fout, "\txlraster:\t%d\n", g->xlraster); if (g->hidden != G_HIDDEN) fprintf (fout, "\thidden:\t%d\n", g->hidden); /* FIXME: Unallocate struct list if required. Maybe with a little function. */ if (g->classname != G_CLASSNAME) { struct classname *ite; for (ite = g->classname; ite; ite = ite->next) fprintf (fout, "\tclassname %d :\t%s\n", ite->no, ite->name); } if (g->infoname != G_INFONAME) { struct infoname *ite; for (ite = g->infoname; ite; ite = ite->next) fprintf (fout, "\tinfoname %d :\t%s\n", ite->integer, ite->chars); } if (g->colorentry != G_COLORENTRY) { struct colorentry *ite; for (ite = g->colorentry; ite; ite = ite->next) { fprintf (fout, "\tcolorentry %d :\t%d %d %d\n", ite->color_index, ite->red_cp, ite->green_cp, ite->blue_cp); } } if (g->layout_downfactor != G_LAYOUT_DOWNFACTOR) fprintf (fout, "\tlayout_downfactor:\t%d\n", g->layout_downfactor); if (g->layout_upfactor != G_LAYOUT_UPFACTOR) fprintf (fout, "\tlayout_upfactor:\t%d\n", g->layout_upfactor); if (g->layout_nearfactor != G_LAYOUT_NEARFACTOR) fprintf (fout, "\tlayout_nearfactor:\t%d\n", g->layout_nearfactor); if (g->layout_splinefactor != G_LAYOUT_SPLINEFACTOR) fprintf (fout, "\tlayout_splinefactor:\t%d\n", g->layout_splinefactor); if (g->late_edge_labels != G_LATE_EDGE_LABELS) fprintf (fout, "\tlate_edge_labels:\t%s\n", get_decision_str (g->late_edge_labels)); if (g->display_edge_labels != G_DISPLAY_EDGE_LABELS) fprintf (fout, "\tdisplay_edge_labels:\t%s\n", get_decision_str (g->display_edge_labels)); if (g->dirty_edge_labels != G_DIRTY_EDGE_LABELS) fprintf (fout, "\tdirty_edge_labels:\t%s\n", get_decision_str (g->dirty_edge_labels)); if (g->finetuning != G_FINETUNING) fprintf (fout, "\tfinetuning:\t%s\n", get_decision_str (g->finetuning)); if (g->ignore_singles != G_IGNORE_SINGLES) fprintf (fout, "\tignore_singles:\t%s\n", get_decision_str (g->ignore_singles)); if (g->priority_phase != G_PRIORITY_PHASE) fprintf (fout, "\tpriority_phase:\t%s\n", get_decision_str (g->priority_phase)); if (g->manhattan_edges != G_MANHATTAN_EDGES) fprintf (fout, "\tmanhattan_edges:\t%s\n", get_decision_str (g->manhattan_edges)); if (g->smanhattan_edges != G_SMANHATTAN_EDGES) fprintf (fout, "\tsmanhattan_edges:\t%s\n", get_decision_str (g->smanhattan_edges)); if (g->near_edges != G_NEAR_EDGES) fprintf (fout, "\tnear_edges:\t%s\n", get_decision_str (g->near_edges)); if (g->orientation != G_ORIENTATION) fprintf (fout, "\torientation:\t%s\n", get_orientation_str (g->orientation)); if (g->node_alignment != G_NODE_ALIGNMENT) fprintf (fout, "\tnode_alignment:\t%s\n", get_node_alignment_str (g->node_alignment)); if (g->port_sharing != G_PORT_SHARING) fprintf (fout, "\tport_sharing:\t%s\n", get_decision_str (g->port_sharing)); if (g->arrow_mode != G_ARROW_MODE) fprintf (fout, "\tarrow_mode:\t%s\n", get_arrow_mode_str (g->arrow_mode)); if (g->treefactor != G_TREEFACTOR) fprintf (fout, "\ttreefactor:\t%f\n", g->treefactor); if (g->spreadlevel != G_SPREADLEVEL) fprintf (fout, "\tspreadlevel:\t%d\n", g->spreadlevel); if (g->crossing_weight != G_CROSSING_WEIGHT) fprintf (fout, "\tcrossing_weight:\t%s\n", get_crossing_type_str (g->crossing_weight)); if (g->crossing_phase2 != G_CROSSING_PHASE2) fprintf (fout, "\tcrossing_phase2:\t%s\n", get_decision_str (g->crossing_phase2)); if (g->crossing_optimization != G_CROSSING_OPTIMIZATION) fprintf (fout, "\tcrossing_optimization:\t%s\n", get_decision_str (g->crossing_optimization)); if (g->view != G_VIEW) fprintf (fout, "\tview:\t%s\n", get_view_str (g->view)); if (g->edges != G_EDGES) fprintf (fout, "\tedges:\t%s\n", get_decision_str (g->edges)); if (g->nodes != G_NODES) fprintf (fout,"\tnodes:\t%s\n", get_decision_str (g->nodes)); if (g->splines != G_SPLINES) fprintf (fout, "\tsplines:\t%s\n", get_decision_str (g->splines)); if (g->bmax != G_BMAX) fprintf (fout, "\tbmax:\t%d\n", g->bmax); if (g->cmin != G_CMIN) fprintf (fout, "\tcmin:\t%d\n", g->cmin); if (g->cmax != G_CMAX) fprintf (fout, "\tcmax:\t%d\n", g->cmax); if (g->pmin != G_PMIN) fprintf (fout, "\tpmin:\t%d\n", g->pmin); if (g->pmax != G_PMAX) fprintf (fout, "\tpmax:\t%d\n", g->pmax); if (g->rmin != G_RMIN) fprintf (fout, "\trmin:\t%d\n", g->rmin); if (g->rmax != G_RMAX) fprintf (fout, "\trmax:\t%d\n", g->rmax); if (g->smax != G_SMAX) fprintf (fout, "\tsmax:\t%d\n", g->smax);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -