From: ellson Date: Tue, 1 Feb 2005 19:34:14 +0000 (+0000) Subject: Remove some unused #include from emit.c X-Git-Tag: LAST_LIBGRAPH~32^2~7959 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3041a7b5dd7ab43e0185b13309550c0ff74abcd0;p=graphviz Remove some unused #include from emit.c Be consistent about some more globals (until I can eliminate them altogether). Move some macros using globals to macros.h, and rename them to be less likely to collide. --- diff --git a/lib/common/emit.c b/lib/common/emit.c index f78ccee3b..bfd42e794 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -18,14 +18,11 @@ * graphics code generator */ +#include + #include "render.h" #include "agxbuf.h" -#include "utils.h" -#include "htmltable.h" #include "gvc.h" -#include - -static attrsym_t *G_peripheries; static char *defaultlinestyle[3] = { "solid\0", "setlinewidth\0001\0", 0 }; diff --git a/lib/common/globals.h b/lib/common/globals.h index 7de767dc1..b5907c7cc 100644 --- a/lib/common/globals.h +++ b/lib/common/globals.h @@ -57,7 +57,6 @@ extern "C" { EXTERN char *specificFlags; EXTERN char *specificItems; external char *Gvfilepath; /* Path of files allowed in 'shapefile' attrib (also ps libs) */ - external int y_invert; /* invert y in dot & plain output */ #ifndef DISABLE_CODEGENS EXTERN int Output_lang; /* POSTSCRIPT, DOT, etc. */ @@ -71,7 +70,6 @@ extern "C" { #ifdef QUARTZ_RENDER extern codegen_t QPDF_CodeGen, QEPDF_CodeGen, QBM_CodeGen; #endif - #endif EXTERN boolean Verbose, Reduce, UseRankdir, MemTest; @@ -97,37 +95,35 @@ extern "C" { EXTERN int State; /* last finished phase */ EXTERN double Initial_dist; EXTERN double Damping; - EXTERN int y_invert; /* invert y in bounding box */ - EXTERN int y_off; /* ymin + ymax */ - EXTERN double yf_off; /* y_off in inches */ + EXTERN int Y_invert; /* invert y in dot & plain output */ + EXTERN int Y_off; /* ymin + ymax */ + EXTERN double YF_off; /* Y_off in inches */ EXTERN attrsym_t *g_draw; EXTERN attrsym_t *g_l_draw; EXTERN attrsym_t - * N_height, *N_width, *N_shape, *N_color, *N_fillcolor, + *G_peripheries; + EXTERN attrsym_t + *N_height, *N_width, *N_shape, *N_color, *N_fillcolor, *N_fontsize, *N_fontname, *N_fontcolor, *N_label, *N_nojustify, *N_style, *N_showboxes, *N_sides, *N_peripheries, *N_orientation, *N_skew, *N_distortion, *N_fixed, *N_layer, *N_group, *N_comment, *N_vertices, *N_z; - - EXTERN attrsym_t *E_weight, *E_minlen, *E_color, + EXTERN attrsym_t + *E_weight, *E_minlen, *E_color, *E_fontsize, *E_fontname, *E_fontcolor, *E_label, *E_dir, *E_style, *E_decorate, *E_showboxes, *E_arrowsz, *E_constr, *E_layer, - *E_comment, *E_label_float; -/* vladimir */ - EXTERN attrsym_t *E_samehead, *E_sametail, + *E_comment, *E_label_float, + *E_samehead, *E_sametail, *E_arrowhead, *E_arrowtail, *E_headlabel, *E_taillabel, *E_labelfontsize, *E_labelfontname, *E_labelfontcolor, - *E_labeldistance, *E_labelangle; - -/* north */ - EXTERN attrsym_t *E_tailclip, *E_headclip; + *E_labeldistance, *E_labelangle, + *E_tailclip, *E_headclip; #undef external - #ifdef __cplusplus } #endif diff --git a/lib/common/input.c b/lib/common/input.c index d7d21e8f3..2decf1bf6 100644 --- a/lib/common/input.c +++ b/lib/common/input.c @@ -294,7 +294,7 @@ void dotneato_initialize(GVC_t * gvc, int argc, char **argv) Reduce = TRUE; break; case 'y': - y_invert = TRUE; + Y_invert = TRUE; break; case '?': dotneato_usage(0); diff --git a/lib/common/macros.h b/lib/common/macros.h index 039ff1cbc..078d32664 100644 --- a/lib/common/macros.h +++ b/lib/common/macros.h @@ -121,4 +121,6 @@ ((side & 0x8) ? BOTTOM : (side << 1)) : \ ((side & 0x1) ? LEFT : (side >> 1))) +#define YDIR(y) (Y_invert ? (Y_off - (y)) : (y)) +#define YFDIR(y) (Y_invert ? (YF_off - (y)) : (y)) #endif diff --git a/lib/common/output.c b/lib/common/output.c index e726c81f1..46dfbf5ad 100644 --- a/lib/common/output.c +++ b/lib/common/output.c @@ -23,26 +23,22 @@ static int s_arrows; /* graph has edges with start arrows */ static agxbuf outbuf; static agxbuf charbuf; -/* macros for inverting the y coordinate with the bounding box */ -#define Y(y) (y_invert ? (y_off - (y)) : (y)) -#define YF(y) (y_invert ? (yf_off - (y)) : (y)) - static void printptf(FILE * f, point pt) { - fprintf(f, " %.3f %.3f", PS2INCH(pt.x), PS2INCH(Y(pt.y))); + fprintf(f, " %.3f %.3f", PS2INCH(pt.x), PS2INCH(YDIR(pt.y))); } /* setYInvert: * Set parameters used to flip coordinate system (y=0 at top). - * Values do not need to be unset, since if y_invert is set, it's + * Values do not need to be unset, since if Y_invert is set, it's * set for * all graphs during current run, so each will * reinitialize the values for its bbox. */ static void setYInvert(graph_t * g) { - if (y_invert) { - y_off = GD_bb(g).UR.y + GD_bb(g).LL.y; - yf_off = PS2INCH(y_off); + if (Y_invert) { + Y_off = GD_bb(g).UR.y + GD_bb(g).LL.y; + YF_off = PS2INCH(Y_off); } } @@ -339,9 +335,9 @@ static void set_record_rects(node_t * n, field_t * f, agxbuf * xb) if (f->n_flds == 0) { sprintf(buf, "%d,%d,%d,%d ", f->b.LL.x + ND_coord_i(n).x, - Y(f->b.LL.y + ND_coord_i(n).y), + YDIR(f->b.LL.y + ND_coord_i(n).y), f->b.UR.x + ND_coord_i(n).x, - Y(f->b.UR.y + ND_coord_i(n).y)); + YDIR(f->b.UR.y + ND_coord_i(n).y)); agxbput(xb, buf); } for (i = 0; i < f->n_flds; i++) @@ -354,12 +350,12 @@ static void rec_attach_bb(graph_t * g) char buf[32]; point pt; - sprintf(buf, "%d,%d,%d,%d", GD_bb(g).LL.x, Y(GD_bb(g).LL.y), - GD_bb(g).UR.x, Y(GD_bb(g).UR.y)); + sprintf(buf, "%d,%d,%d,%d", GD_bb(g).LL.x, YDIR(GD_bb(g).LL.y), + GD_bb(g).UR.x, YDIR(GD_bb(g).UR.y)); agset(g, "bb", buf); if (GD_label(g) && GD_label(g)->text[0]) { pt = GD_label(g)->p; - sprintf(buf, "%d,%d", pt.x, Y(pt.y)); + sprintf(buf, "%d,%d", pt.x, YDIR(pt.y)); agset(g, "lp", buf); } for (c = 1; c <= GD_n_cluster(g); c++) @@ -394,13 +390,13 @@ void attach_attrs(graph_t * g) safe_dcl(g, g, "lp", "", agraphattr); if (GD_label(g)->text[0]) { pt = GD_label(g)->p; - sprintf(buf, "%d,%d", pt.x, Y(pt.y)); + sprintf(buf, "%d,%d", pt.x, YDIR(pt.y)); agset(g, "lp", buf); } } safe_dcl(g, g, "bb", "", agraphattr); for (n = agfstnode(g); n; n = agnxtnode(g, n)) { - sprintf(buf, "%d,%d", ND_coord_i(n).x, Y(ND_coord_i(n).y)); + sprintf(buf, "%d,%d", ND_coord_i(n).x, YDIR(ND_coord_i(n).y)); agset(n, "pos", buf); sprintf(buf, "%.2f", PS2INCH(ND_ht_i(n))); agxset(n, N_height->index, buf); @@ -431,13 +427,13 @@ void attach_attrs(graph_t * g) if (poly->sides >= 3) sprintf(buf, "%.3f %.3f", PS2INCH(poly->vertices[i].x), - YF(PS2INCH(poly->vertices[i].y))); + YFDIR(PS2INCH(poly->vertices[i].y))); else sprintf(buf, "%.3f %.3f", ND_width(n) / 2.0 * cos(i / (double) sides * PI * 2.0), - YF(ND_height(n) / 2.0 * + YFDIR(ND_height(n) / 2.0 * sin(i / (double) sides * PI * 2.0))); agxbput(&xb, buf); } @@ -457,38 +453,38 @@ void attach_attrs(graph_t * g) s_arrows = 1; sprintf(buf, "s,%d,%d ", ED_spl(e)->list[i].sp.x, - Y(ED_spl(e)->list[i].sp.y)); + YDIR(ED_spl(e)->list[i].sp.y)); agxbput(&xb, buf); } if (ED_spl(e)->list[i].eflag) { e_arrows = 1; sprintf(buf, "e,%d,%d ", ED_spl(e)->list[i].ep.x, - Y(ED_spl(e)->list[i].ep.y)); + YDIR(ED_spl(e)->list[i].ep.y)); agxbput(&xb, buf); } for (j = 0; j < ED_spl(e)->list[i].size; j++) { if (j > 0) agxbputc(&xb, ' '); pt = ED_spl(e)->list[i].list[j]; - sprintf(buf, "%d,%d", pt.x, Y(pt.y)); + sprintf(buf, "%d,%d", pt.x, YDIR(pt.y)); agxbput(&xb, buf); } } agset(e, "pos", agxbuse(&xb)); if (ED_label(e)) { pt = ED_label(e)->p; - sprintf(buf, "%d,%d", pt.x, Y(pt.y)); + sprintf(buf, "%d,%d", pt.x, YDIR(pt.y)); agset(e, "lp", buf); } if (ED_head_label(e)) { pt = ED_head_label(e)->p; - sprintf(buf, "%d,%d", pt.x, Y(pt.y)); + sprintf(buf, "%d,%d", pt.x, YDIR(pt.y)); agset(e, "head_lp", buf); } if (ED_tail_label(e)) { pt = ED_tail_label(e)->p; - sprintf(buf, "%d,%d", pt.x, Y(pt.y)); + sprintf(buf, "%d,%d", pt.x, YDIR(pt.y)); agset(e, "tail_lp", buf); } } diff --git a/lib/common/xdgen.c b/lib/common/xdgen.c index dd395e397..7a3419551 100644 --- a/lib/common/xdgen.c +++ b/lib/common/xdgen.c @@ -18,9 +18,6 @@ #include "gvc.h" #include "agxbuf.h" -/* macros for inverting the y coordinate with the bounding box */ -#define Y(y) (y_invert ? (y_off - (y)) : (y)) - static agxbuf charbuf; static agxbuf outbuf; static Agraph_t *cluster_g; @@ -43,7 +40,7 @@ static void xd_textline(point p, textline_t * line) j = 0; break; } - sprintf(buf, " %d %d %d %d %d -", p.x, Y(p.y), j, + sprintf(buf, " %d %d %d %d %d -", p.x, YDIR(p.y), j, (int) line->width, (int) strlen(line->str)); agxbput(&charbuf, buf); agxbput(&charbuf, line->str); @@ -55,7 +52,7 @@ static void xd_ellipse(point p, int rx, int ry, int filled) char buf[BUFSIZ]; agxbputc(&outbuf, (filled ? 'E' : 'e')); - sprintf(buf, " %d %d %d %d ", p.x, Y(p.y), rx, ry); + sprintf(buf, " %d %d %d %d ", p.x, YDIR(p.y), rx, ry); agxbput(&outbuf, buf); } @@ -70,7 +67,7 @@ static void xd_points(char c, point * A, int n) agxbput(&outbuf, buf); for (i = 0; i < n; i++) { p = A[i]; - sprintf(buf, "%d %d ", p.x, Y(p.y)); + sprintf(buf, "%d %d ", p.x, YDIR(p.y)); agxbput(&outbuf, buf); } }