]> granicus.if.org Git - graphviz/commitdiff
replace global variable "xdemitState" with gvc->emit_state to fix DISABLE_CODEGENS
authorellson <devnull@localhost>
Tue, 18 Oct 2005 21:10:33 +0000 (21:10 +0000)
committerellson <devnull@localhost>
Tue, 18 Oct 2005 21:10:33 +0000 (21:10 +0000)
lib/common/arrows.c
lib/common/const.h
lib/common/emit.c
lib/common/labels.c
lib/common/output.c
lib/common/render.h
lib/common/shapes.c
lib/common/xdgen.c
lib/gvc/gvcint.h
tclpkg/tcldot/Makefile.am
tclpkg/tcldot/tcldot.c

index 61b8bb32e6759579f388a6c32aa85a0aa3063301..897233eeed4dd26226577a4421ed08c93ede0406 100644 (file)
@@ -543,10 +543,14 @@ boxf arrow_bb(pointf p, pointf u, double scale, int flag)
     return bb;
 }
 
-void arrow_newgen(GVJ_t * job, pointf p, pointf u, double scale, int flag)
+void arrow_newgen(GVJ_t * job, int state, pointf p, pointf u, double scale, int flag)
 {
     double s;
     int f;
+    int oldstate;
+
+    oldstate = job->gvc->emit_state;
+    job->gvc->emit_state = state;
 
     /* Dotted and dashed styles on the arrowhead are ugly (dds) */
     /* linewidth needs to be reset */
@@ -573,14 +577,16 @@ void arrow_newgen(GVJ_t * job, pointf p, pointf u, double scale, int flag)
     arrow_gen_type(job, p, u, f);
 
     gvrender_end_context(job);
+
+    job->gvc->emit_state = oldstate;
 }
 
 /* FIXME emit.c and output.c require wrapper for int point coords */
-void arrow_gen(GVJ_t * job, point p, point u, double scale, int flag)
+void arrow_gen(GVJ_t * job, int state, point p, point u, double scale, int flag)
 {
     pointf P, U;
 
     P2PF(p, P);
     P2PF(u, U);
-    arrow_newgen(job, P, U, scale, flag);
+    arrow_newgen(job, state, P, U, scale, flag);
 }
index 11894388559e243cdc9fb4fd45e8b5da0d3334a6..609cf33f92fcb256da2a80c61d89bf1c1b1e4523 100644 (file)
 #define RANKDIR_BT     2
 #define RANKDIR_RL     3
 
-/* values specifying emit state */
+/* value specifying emit state */
 #define EMIT_DRAW      0
-#define EMIT_LABEL     1
-#define EMIT_TDRAW     2
-#define EMIT_HDRAW     3
+#define EMIT_GDRAW     EMIT_DRAW
+#define EMIT_CDRAW     EMIT_DRAW
+#define EMIT_NDRAW     EMIT_DRAW
+#define EMIT_EDRAW     EMIT_DRAW
+
+/* values specifying emit state for arrowheads */
+#define EMIT_TDRAW     1
+#define EMIT_HDRAW     2
+
+/* values specifying emit state for labels */
+#define EMIT_LABEL     3
+#define EMIT_GLABEL    EMIT_LABEL
+#define EMIT_CLABEL    EMIT_LABEL
+#define EMIT_NLABEL    EMIT_LABEL
+#define EMIT_ELABEL    EMIT_LABEL
 #define EMIT_TLABEL    4
 #define EMIT_HLABEL    5
 
index b885d95d235e0ad07b0fc205b5c5c43736563f4c..097b8de12467c8ea27f26b12ebfb581c1ea5309f 100644 (file)
@@ -580,10 +580,13 @@ static void emit_node(GVJ_t * job, node_t * n)
 {
     GVC_t *gvc = job->gvc;
     char *s, *url = NULL, *tooltip = NULL, *target = NULL;
+    int oldstate;
 
     if (ND_shape(n) == NULL)
        return;
 
+    oldstate = gvc->emit_state;
+    gvc->emit_state = EMIT_NDRAW;
     if (node_in_layer(job, n->graph, n)
            && node_in_box(n, job->pageBoxClip)
            && (ND_state(n) != gvc->viewNum)) {
@@ -620,6 +623,7 @@ static void emit_node(GVJ_t * job, node_t * n)
        }
        gvrender_end_node(job);
     }
+    gvc->emit_state = oldstate;
 }
 
 #define EPSILON .0001
@@ -739,10 +743,12 @@ void emit_edge_graphics(GVJ_t * job, edge_t * e)
     bool saved = FALSE;
     double scale, numc2;
     char *p;
-    extern int xdemitState;
+    int oldstate;
 
 #define SEP 2.0
 
+    oldstate = job->gvc->emit_state;
+    job->gvc->emit_state = EMIT_EDRAW;
     style = late_string(e, E_style, "");
     /* We shortcircuit drawing an invisible edge because the arrowhead
      * code resets the style to solid, and most of the code generators
@@ -756,7 +762,6 @@ void emit_edge_graphics(GVJ_t * job, edge_t * e)
                return;
        }
     }
-    xdemitState = EMIT_DRAW;
     if (ED_spl(e)) {
        scale = late_double(e, E_arrowsz, 1.0, 0.0);
        color = late_string(e, E_color, "");
@@ -858,13 +863,14 @@ void emit_edge_graphics(GVJ_t * job, edge_t * e)
                                         FALSE, FALSE, FALSE);
                }
            }
-           xdemitState = EMIT_TDRAW;
-           if (bz.sflag)
-               arrow_gen(job, bz.sp, bz.list[0], scale, bz.sflag);
-           xdemitState = EMIT_HDRAW;
-           if (bz.eflag)
-               arrow_gen(job, bz.ep, bz.list[bz.size - 1], scale,
-                         bz.eflag);
+           if (bz.sflag) {
+               arrow_gen(job, EMIT_TDRAW, bz.sp, bz.list[0],
+                       scale, bz.sflag);
+           }
+           if (bz.eflag) {
+               arrow_gen(job, EMIT_HDRAW, bz.ep, bz.list[bz.size - 1],
+                       scale, bz.eflag);
+           }
            free(colors);
            for (i = 0; i < offspl.size; i++) {
                free(offspl.list[i].list);
@@ -895,33 +901,32 @@ void emit_edge_graphics(GVJ_t * job, edge_t * e)
                } else {
                    gvrender_beziercurve(job, bzf.list, bz.size, FALSE,
                                         FALSE, FALSE);
-                   xdemitState = EMIT_TDRAW;
-                   if (bz.sflag)
-                       arrow_gen(job, bz.sp, bz.list[0], scale, bz.sflag);
-                   xdemitState = EMIT_HDRAW;
-                   if (bz.eflag)
-                       arrow_gen(job, bz.ep, bz.list[bz.size - 1], scale,
-                                 bz.eflag);
+                   if (bz.sflag) {
+                       arrow_gen(job, EMIT_TDRAW, bz.sp, bz.list[0],
+                               scale, bz.sflag);
+                   }
+                   if (bz.eflag) {
+                       arrow_gen(job, EMIT_HDRAW, bz.ep, bz.list[bz.size - 1],
+                               scale, bz.eflag);
+                   }
                }
                free(bzf.list);
            }
        }
     }
-    xdemitState = EMIT_LABEL;
     if (ED_label(e)) {
-       emit_label(job, ED_label(e), (void *) e);
+       emit_label(job, EMIT_ELABEL, ED_label(e), (void *) e);
        if (mapbool(late_string(e, E_decorate, "false")) && ED_spl(e))
            emit_attachment(job, ED_label(e), ED_spl(e));
     }
-    xdemitState = EMIT_HLABEL;
     if (ED_head_label(e))
-       emit_label(job, ED_head_label(e), (void *) e);  /* vladimir */
-    xdemitState = EMIT_TLABEL;
+       emit_label(job, EMIT_HLABEL, ED_head_label(e), (void *) e);     /* vladimir */
     if (ED_tail_label(e))
-       emit_label(job, ED_tail_label(e), (void *) e);  /* vladimir */
+       emit_label(job, EMIT_TLABEL, ED_tail_label(e), (void *) e);     /* vladimir */
 
     if (saved)
        gvrender_end_context(job);
+    job->gvc->emit_state = oldstate;
 }
 
 static bool edge_in_box(edge_t *e, boxf b)
@@ -944,10 +949,13 @@ static void emit_edge(GVJ_t * job, edge_t * e)
 {
     char *s, *url = NULL, *label = NULL, *tooltip = NULL, *target = NULL;
     textlabel_t *lab = NULL;
+    int oldstate;
 
     if (! edge_in_box(e, job->pageBoxClip) || ! edge_in_layer(job, e->head->graph, e))
        return;
 
+    oldstate = job->gvc->emit_state;
+    job->gvc->emit_state = EMIT_EDRAW;
     s = malloc(strlen(e->tail->name) + 2 + strlen(e->head->name) + 1);
     strcpy(s,e->tail->name);
     if (AG_IS_DIRECTED(e->tail->graph))
@@ -987,6 +995,7 @@ static void emit_edge(GVJ_t * job, edge_t * e)
            free(target);
     }
     gvrender_end_edge(job);
+    job->gvc->emit_state = oldstate;
 }
 
 static void init_gvc_from_graph(GVC_t * gvc, graph_t * g)
@@ -1202,7 +1211,7 @@ void emit_view(GVJ_t * job, graph_t * g, int flags)
        gvrender_begin_anchor(job, url, tooltip, target);
     }
     if (GD_label(g))
-       emit_label(job, GD_label(g), (void *) g);
+       emit_label(job, EMIT_GLABEL, GD_label(g), (void *) g);
     /* when drawing, lay clusters down before nodes and edges */
     if (!(flags & EMIT_CLUSTERS_LAST))
        emit_clusters(job, g, flags);
@@ -1400,8 +1409,10 @@ void emit_clusters(GVJ_t * job, Agraph_t * g, int flags)
     node_t *n;
     edge_t *e;
     char *s, *url = NULL, *tooltip = NULL, *target = NULL;
-    extern int xdemitState;
+    int oldstate;
 
+    oldstate = job->gvc->emit_state;
+    job->gvc->emit_state = EMIT_CDRAW;
     for (c = 1; c <= GD_n_cluster(g); c++) {
        sg = GD_clust(g)[c];
        if (clust_in_layer(job, sg) == FALSE)
@@ -1424,7 +1435,6 @@ void emit_clusters(GVJ_t * job, Agraph_t * g, int flags)
        gvrender_begin_context(job);
        filled = FALSE;
        istyle = 0;
-       xdemitState = EMIT_DRAW;
        if ((style = checkClusterStyle(sg, &istyle))) {
            gvrender_set_style(job, style);
            if (istyle & FILLED)
@@ -1490,9 +1500,8 @@ void emit_clusters(GVJ_t * job, Agraph_t * g, int flags)
                gvrender_polygon(job, A, 4, filled);
            }
        }
-       xdemitState = EMIT_DRAW;
        if (GD_label(sg))
-           emit_label(job, GD_label(sg), (void *) sg);
+           emit_label(job, EMIT_GLABEL, GD_label(sg), (void *) sg);
 
        if (flags & EMIT_PREORDER) {
            for (n = agfstnode(sg); n; n = agnxtnode(sg, n)) {
@@ -1521,6 +1530,7 @@ void emit_clusters(GVJ_t * job, Agraph_t * g, int flags)
        if (!(flags & EMIT_CLUSTERS_LAST))
            emit_clusters(job, sg, flags);
     }
+    job->gvc->emit_state = oldstate;
 }
 
 static bool is_style_delim(int c)
@@ -1679,6 +1689,7 @@ static void emit_job(GVJ_t * job, graph_t * g)
     init_job_viewport(job, g);
     init_job_pagination(job, g);
 
+    job->gvc->emit_state = EMIT_GDRAW;
     gvrender_begin_job(job);
 
     switch (job->output_lang) {
index 45d0c72d5c92479cbe7dcbfafe179506ebc76533..dda9a57ae78dae7ccd71ec48129b0386026f3b1e 100644 (file)
@@ -206,10 +206,14 @@ emit_textlines(GVJ_t* job, int nlines, textline_t lines[], pointf p,
     gvrender_end_context(job);
 }
 
-void emit_label(GVJ_t * job, textlabel_t * lp, void *obj)
+void emit_label(GVJ_t * job, int state, textlabel_t * lp, void *obj)
 {
     double halfwidth_x;
     pointf p;
+    int oldstate;
+
+    oldstate = job->gvc->emit_state;
+    job->gvc->emit_state = state;
 
     if (lp->html) {
        emit_html_label(job, lp->u.html, lp, obj);
@@ -228,6 +232,7 @@ void emit_label(GVJ_t * job, textlabel_t * lp, void *obj)
 
     emit_textlines(job, lp->u.txt.nlines, lp->u.txt.line, p,
               halfwidth_x, lp->fontname, lp->fontsize, lp->fontcolor);
+    job->gvc->emit_state = oldstate;
 }
 
 
index 18b51dfbdbedfd75e86d554c430fb1c0df772501..a3820a895492f033a32e8a3b8fa8f46e0bef9f76 100644 (file)
@@ -140,9 +140,11 @@ void write_plain_ext(GVJ_t * job, graph_t * g, FILE * f)
 
 void write_extended_dot(GVJ_t *job, graph_t *g, FILE *f)
 {
+#ifndef DISABLE_CODEGENS
        attach_attrs(g);
        extend_attrs(job, g, s_arrows, e_arrows);
        agwrite(g, f);
+#endif
 }
 
 void write_attributed_dot(graph_t *g, FILE *f)
index 35a220571e7ce45123bdeb54b9ce51d4acaa1cb1..839169ccde71b37d6bda749f5145227aba7812af 100644 (file)
@@ -74,8 +74,8 @@ extern "C" {
     extern void add_box(path *, box);
     extern void arrow_flags(Agedge_t * e, int *sflag, int *eflag);
     extern boxf arrow_bb(pointf p, pointf u, double scale, int flag);
-    extern void arrow_gen(GVJ_t * job, point p, point u, double scale,
-                         int flag);
+    extern void arrow_gen(GVJ_t * job, int state, point p, point u,
+                         double scale, int flag);
     extern double arrow_length(edge_t * e, int flag);
     extern int arrowEndClip(edge_t*, point*, int, int , bezier*, int eflag);
     extern int arrowStartClip(edge_t*, point* ps, int, int, bezier*, int sflag);
@@ -105,7 +105,7 @@ extern "C" {
     extern void emit_clusters(GVJ_t * job, Agraph_t * g, int flags);
     extern void emit_edge_graphics(GVJ_t * job, edge_t * e);
     extern void emit_graph(GVJ_t * job, graph_t * g);
-    extern void emit_label(GVJ_t * job, textlabel_t *, void *obj);
+    extern void emit_label(GVJ_t * job, int state, textlabel_t *, void *obj);
     extern int emit_once(char *message);
     extern void emit_jobs_eof(GVC_t * gvc);
     extern void emit_textlines(GVJ_t*, int, textline_t*, pointf,
index d05c7a2c8fccb2ce8dd6838b0c0a6008559f29f2..d5e50888ddb75720ba3a1d1b427c89c1b5d041d7 100644 (file)
@@ -1199,10 +1199,8 @@ static void poly_gencode(GVJ_t * job, node_t * n)
     static point *A;
     static int A_size;
     bool filled;
-    extern int xdemitState;
     char *color;
 
-    xdemitState = EMIT_DRAW;
     poly = (polygon_t *) ND_shape_info(n);
     vertices = poly->vertices;
     sides = poly->sides;
@@ -1323,8 +1321,7 @@ static void poly_gencode(GVJ_t * job, node_t * n)
        filled = FALSE;
     }
 
-    xdemitState = EMIT_LABEL;
-    emit_label(job, ND_label(n), (void *) n);
+    emit_label(job, EMIT_NLABEL, ND_label(n), (void *) n);
 }
 
 /*=======================end poly======================================*/
@@ -1840,7 +1837,7 @@ static void gen_fields(GVJ_t * job, node_t * n, field_t * f)
        cx = (f->b.LL.x + f->b.UR.x) / 2.0 + ND_coord_i(n).x;
        cy = (f->b.LL.y + f->b.UR.y) / 2.0 + ND_coord_i(n).y;
        f->lp->p = pointof((int) cx, (int) cy);
-       emit_label(job, f->lp, (void *) n);
+       emit_label(job, EMIT_NLABEL, f->lp, (void *) n);
     }
 
     for (i = 0; i < f->n_flds; i++) {
@@ -1867,9 +1864,7 @@ static void record_gencode(GVJ_t * job, node_t * n)
     point A[4];
     int i, style;
     field_t *f;
-    extern int xdemitState;
 
-    xdemitState = EMIT_DRAW;
     f = (field_t *) ND_shape_info(n);
     A[0] = f->b.LL;
     A[2] = f->b.UR;
@@ -1889,7 +1884,6 @@ static void record_gencode(GVJ_t * job, node_t * n)
        node_round_corners(job, n, A, 4, ROUNDED);
     else
        gvrender_polygon(job, A, 4, style & FILLED);
-    xdemitState = EMIT_LABEL;
     gen_fields(job, n, f);
 }
 
@@ -1976,5 +1970,5 @@ static void epsf_gencode(GVJ_t * job, node_t * n)
                ND_coord_i(n).y + desc->offset.y, desc->macro_id);
     ND_label(n)->p = ND_coord_i(n);
     gvrender_end_context(job);
-    emit_label(job, ND_label(n), (void *) n);
+    emit_label(job, EMIT_NLABEL, ND_label(n), (void *) n);
 }
index cbacb8c115b474f0710bb711f60a156a6bccced3..21f61feadb792ec9ac823823b2263e35d0eebf4c 100644 (file)
@@ -17,7 +17,7 @@
 #include "render.h"
 #include "agxbuf.h"
 
-int    xdemitState;
+static GVC_t *gvc;
 static agxbuf xbuf0;
 static agxbuf xbuf1;
 static agxbuf xbuf2;
@@ -81,6 +81,8 @@ void extend_attrs(GVJ_t * job, graph_t *g, int s_arrows, int e_arrows)
     unsigned char buf4[BUFSIZ];
     unsigned char buf5[BUFSIZ];
 
+    gvc = job->gvc;
+
     if (GD_has_labels(g) & GRAPH_LABEL)
        g_l_draw = safe_dcl(g, g, "_ldraw_", "", agraphattr);
     if (GD_n_cluster(g))
@@ -111,8 +113,8 @@ void extend_attrs(GVJ_t * job, graph_t *g, int s_arrows, int e_arrows)
     for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
        if (ND_shape(n) && !isInvis(late_string(n, N_style, ""))) {
            ND_shape(n)->fns->codefn(job, n);
-           agxset(n, n_draw->index, agxbuse(xbufs[EMIT_DRAW]));
-           agxset(n, n_l_draw->index, agxbuse(xbufs[EMIT_LABEL]));
+           agxset(n, n_draw->index, agxbuse(xbufs[EMIT_NDRAW]));
+           agxset(n, n_l_draw->index, agxbuse(xbufs[EMIT_NLABEL]));
        }
        if (State < GVSPLINES)
            continue;
@@ -125,26 +127,24 @@ void extend_attrs(GVJ_t * job, graph_t *g, int s_arrows, int e_arrows)
                continue;
 
            emit_edge_graphics (job, e);
-           agxset(e, e_draw->index, agxbuse(xbufs[EMIT_DRAW]));
+           agxset(e, e_draw->index, agxbuse(xbufs[EMIT_EDRAW]));
            if (t_draw) agxset(e, t_draw->index, agxbuse(xbufs[EMIT_TDRAW]));
            if (h_draw) agxset(e, h_draw->index, agxbuse(xbufs[EMIT_HDRAW]));
-           if (e_l_draw) agxset(e, e_l_draw->index,agxbuse(xbufs[EMIT_LABEL]));
+           if (e_l_draw) agxset(e, e_l_draw->index,agxbuse(xbufs[EMIT_ELABEL]));
            if (tl_draw) agxset(e, tl_draw->index, agxbuse(xbufs[EMIT_TLABEL]));
            if (hl_draw) agxset(e, hl_draw->index, agxbuse(xbufs[EMIT_HLABEL]));
        }
     }
   
-    xdemitState = EMIT_DRAW;
     emit_background(job, g);
-    if (agxblen(xbufs[EMIT_DRAW])) {
+    if (agxblen(xbufs[EMIT_GDRAW])) {
        if (!g_draw)
            g_draw = safe_dcl(g, g, "_draw_", "", agraphattr);
-       agxset(g, g_draw->index, agxbuse(xbufs[EMIT_DRAW]));
+       agxset(g, g_draw->index, agxbuse(xbufs[EMIT_GDRAW]));
     }
-    xdemitState = EMIT_LABEL;
     if (GD_label(g)) {
-       emit_label(job, GD_label(g), (void *) g);
-       agxset(g, g_l_draw->index, agxbuse(xbufs[EMIT_LABEL]));
+       emit_label(job, EMIT_GLABEL, GD_label(g), (void *) g);
+       agxset(g, g_l_draw->index, agxbuse(xbufs[EMIT_GLABEL]));
     }
     emit_clusters(job, g, 0);
     agxbfree(&xbuf0);
@@ -160,9 +160,9 @@ static void xd_str (char* pfx, char* s)
     char buf[BUFSIZ];
 
     sprintf (buf, "%s%d -", pfx, (int)strlen(s));
-    agxbput(xbufs[xdemitState], buf);
-    agxbput(xbufs[xdemitState], s);
-    agxbputc(xbufs[xdemitState], ' ');
+    agxbput(xbufs[gvc->emit_state], buf);
+    agxbput(xbufs[gvc->emit_state], s);
+    agxbputc(xbufs[gvc->emit_state], ' ');
 }
 
 static void xd_textline(point p, textline_t * line)
@@ -183,7 +183,7 @@ static void xd_textline(point p, textline_t * line)
        break;
     }
     sprintf(buf, "T %d %d %d %d ", p.x, YDIR(p.y), j, (int) line->width);
-    agxbput(xbufs[xdemitState], buf);
+    agxbput(xbufs[gvc->emit_state], buf);
     xd_str ("", line->str);
 }
 
@@ -191,9 +191,9 @@ static void xd_ellipse(point p, int rx, int ry, int filled)
 {
     char buf[BUFSIZ];
 
-    agxbputc(xbufs[xdemitState], (filled ? 'E' : 'e'));
+    agxbputc(xbufs[gvc->emit_state], (filled ? 'E' : 'e'));
     sprintf(buf, " %d %d %d %d ", p.x, YDIR(p.y), rx, ry);
-    agxbput(xbufs[xdemitState], buf);
+    agxbput(xbufs[gvc->emit_state], buf);
 }
 
 static void xd_points(char c, point * A, int n)
@@ -202,13 +202,13 @@ static void xd_points(char c, point * A, int n)
     int i;
     point p;
 
-    agxbputc(xbufs[xdemitState], c);
+    agxbputc(xbufs[gvc->emit_state], c);
     sprintf(buf, " %d ", n);
-    agxbput(xbufs[xdemitState], buf);
+    agxbput(xbufs[gvc->emit_state], buf);
     for (i = 0; i < n; i++) {
        p = A[i];
        sprintf(buf, "%d %d ", p.x, YDIR(p.y));
-       agxbput(xbufs[xdemitState], buf);
+       agxbput(xbufs[gvc->emit_state], buf);
     }
 }
 
@@ -237,7 +237,7 @@ xd_set_font (char *fontname, double fontsize)
     char buf[BUFSIZ];
 
     sprintf(buf, "F %f ", fontsize);
-    agxbput(xbufs[xdemitState], buf);
+    agxbput(xbufs[gvc->emit_state], buf);
     xd_str ("", fontname);
 }
 
@@ -292,9 +292,9 @@ static void xd_begin_cluster(Agraph_t * sg)
 
 static void xd_end_cluster(void)
 {
-    agxset(cluster_g, g_draw->index, agxbuse(xbufs[EMIT_DRAW]));
+    agxset(cluster_g, g_draw->index, agxbuse(xbufs[EMIT_CDRAW]));
     if (GD_label(cluster_g))
-       agxset(cluster_g, g_l_draw->index, agxbuse(xbufs[EMIT_LABEL]));
+       agxset(cluster_g, g_l_draw->index, agxbuse(xbufs[EMIT_CLABEL]));
 }
 
 codegen_t XDot_CodeGen = {
index 7f02900ef65b3ba71d7b15bfa3c8f39ffee753b7..70d33f593b49a3c137f9a720f3643382cba6e668 100644 (file)
@@ -79,6 +79,7 @@ extern "C" {
        GVJ_t *job;     /* current job */
        void (*errorfn) (char *fmt, ...);
 
+       int emit_state; /* current emit_state */
        graph_t *g;     /* current graph */
        graph_t *sg;    /* current subgraph/cluster */
        node_t *n;      /* current node */
index 6825d4b8070f89ed55f5fb649c4aaf310cac9881..75fbf0cce1dc69fa93fa5bb6976ca387ea2c945f 100644 (file)
@@ -32,7 +32,11 @@ pdf_DATA = $(pdf)
 html_DATA = $(html)
 endif
 
-libtcldot_la_SOURCES = tcldot.c tkgen.c $(top_srcdir)/tclpkg/gdtclft/gdtclft.c
+if !DISABLE_CODEGENS
+CODEGENS = tkgen.c
+endif
+
+libtcldot_la_SOURCES = tcldot.c $(CODEGENS) $(top_srcdir)/tclpkg/gdtclft/gdtclft.c
 libtcldot_la_LIBADD = \
        $(top_builddir)/tclpkg/tclhandle/libtclhandle.la \
        $(top_builddir)/tclpkg/tclstubs/libtclstubs.la \
index 2b71492a09ad878791beb8322f1873c5804802e8..ca428f264de14cc9ff16e0646656a859d990465f 100644 (file)
@@ -45,12 +45,14 @@ Tcl_GetString(Tcl_Obj *obj) {
 #endif
 ********* */
 
-extern codegen_t TK_CodeGen;
 extern void *GDHandleTable;
 extern int Gdtclft_Init(Tcl_Interp *);
 
+#ifndef DISABLE_CODEGENS
+extern codegen_t TK_CodeGen;
 static codegen_info_t cg[] = { {&TK_CodeGen, "tk", TK},
                                {NULL, NULL, 0}, };
+#endif
 
 static void *graphTblPtr, *nodeTblPtr, *edgeTblPtr;
 static tkgendata_t tkgendata;
@@ -1623,7 +1625,9 @@ __EXPORT__
 int Tcldot_Init(Tcl_Interp * interp)
 {
     GVC_t *gvc;
+#ifndef DISABLE_CODEGENS
     codegen_info_t *p;
+#endif
 
 #ifdef USE_TCL_STUBS
     if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
@@ -1649,10 +1653,12 @@ int Tcldot_Init(Tcl_Interp * interp)
 
     /* configure for available plugins and codegens */
     gvconfig(gvc, FALSE);
+#ifndef DISABLE_CODEGENS
     /* additional codegens */
     for (p = cg; p->name; ++p)
         gvplugin_install(gvc, API_render, p->name, 0, "cg", NULL,
                          (gvplugin_installed_t *) p);
+#endif
 
 #ifndef TCLOBJ
     Tcl_CreateCommand(interp, "dotnew", dotnew,