]> granicus.if.org Git - graphviz/commitdiff
General cleanup:
authorellson <devnull@localhost>
Thu, 25 May 2006 00:09:15 +0000 (00:09 +0000)
committerellson <devnull@localhost>
Thu, 25 May 2006 00:09:15 +0000 (00:09 +0000)
- eliminate types.h from plugins
- newheaders: texpara.h usershape.h
- rename textline_t to textpara_t in preparation for the use of pango paragraph formatting.
- rename various related "*line*" variables to "*para*"
- remove some unused builtin.c files
- fix builtins so that dot_static always works
- change !DISABLE_CODEGENS to WITH_CODEGENS
-support configure options:
--without-codegens
--without-pangocairo
--without-libgd
(all enabled by default if requirements met)

31 files changed:
lib/common/htmltable.c
lib/common/htmltable.h
lib/common/input.c
lib/common/labels.c
lib/common/mifgen.c
lib/common/mpgen.c
lib/common/output.c
lib/common/picgen.c
lib/common/render.h
lib/common/shapes.c
lib/common/textpara.h [moved from tclpkg/gv/builtins.c with 60% similarity]
lib/common/types.h
lib/common/usershape.h [moved from tclpkg/tcldot/builtins.c with 60% similarity]
lib/common/vtxgen.c
lib/gvc/dot_builtins.c
lib/gvc/gvcext.h
lib/gvc/gvcjob.h
lib/gvc/gvconfig.c
lib/gvc/gvcproc.h
lib/gvc/gvdevice.c
lib/gvc/gvplugin_render.h
lib/gvc/gvplugin_textlayout.h
lib/gvc/gvrender.c
lib/gvc/gvtextlayout.c
lib/gvc/no_builtins.c
plugin/gd/gvrender_gd.c
plugin/gd/gvtextlayout_gd.c
tclpkg/tcldot/Makefile.am
tclpkg/tcldot/tcldot.c
tclpkg/tcldot/tkgen.c
windows/config.h

index 96ce658069dc64a6ef1035baf7e023ced7289a9d..3445394871318cbf71473c4465c3c25d5e9dcf9b 100644 (file)
@@ -110,7 +110,7 @@ emit_html_txt(GVJ_t * job, htmltxt_t * tp, htmlenv_t * env, void *obj)
     double fsize;
 
     /* make sure that there is something to do */
-    if (tp->nlines < 1)
+    if (tp->nparas < 1)
       return;
 
       /* set font attributes */
@@ -136,20 +136,20 @@ emit_html_txt(GVJ_t * job, htmltxt_t * tp, htmlenv_t * env, void *obj)
      p.x = env->p.x + ((double)(tp->box.UR.x + tp->box.LL.x))/2.0;
      p.y = env->p.y + ((double)(tp->box.UR.y + tp->box.LL.y))/2.0;
 
-     emit_textlines(job, tp->nlines, tp->line, p,
+     emit_textparas(job, tp->nparas, tp->para, p,
      halfwidth_x, fname, fsize, fcolor);
      }
 #endif
 
 static void 
-emit_htextlines(GVJ_t* job, int nlines, htextline_t* lines, pointf p,
+emit_htextparas(GVJ_t* job, int nparas, htextpara_t* paras, pointf p,
          double halfwidth_x, char* fname, double fsize, char* fcolor, box b)
 {
     int i,j;
     double tmp, center_x, left_x, right_x, fsize_;
     double offset=0.0;
     char *fname_ , *fcolor_;
-    textline_t tl;
+    textpara_t tl;
     pointf p_ = {0.0, 0.0};
     textitem_t* ti;
        
@@ -158,8 +158,8 @@ emit_htextlines(GVJ_t* job, int nlines, htextline_t* lines, pointf p,
     right_x = center_x + halfwidth_x;
 
     gvrender_begin_context(job);
-    for(i=0; i<nlines; i++) {
-       switch (lines[i].just) {
+    for(i=0; i<nparas; i++) {
+       switch (paras[i].just) {
        case 'l':
            p_.x = left_x;
            p.x = left_x;
@@ -176,13 +176,13 @@ emit_htextlines(GVJ_t* job, int nlines, htextline_t* lines, pointf p,
        }
 
        if (i == 0) {
-           p_.y = p.y + (double)(b.UR.y-b.LL.y)/2 - lines[i].lfsize * 0.9 ;
+           p_.y = p.y + (double)(b.UR.y-b.LL.y)/2 - paras[i].lfsize * 0.9 ;
            tmp = ROUND(p_.y);  /* align with integer points */
            p_.y = (double)tmp;
        }
 
-       ti = lines[i].items;
-       for(j=0; j<lines[i].nitems; j++) {
+       ti = paras[i].items;
+       for(j=0; j<paras[i].nitems; j++) {
            if (ti->font && (ti->font->size > 0))
                fsize_ = ti->font->size;
            else
@@ -202,18 +202,18 @@ emit_htextlines(GVJ_t* job, int nlines, htextline_t* lines, pointf p,
            tl.str = ti->str;
            tl.xshow = ti->xshow;
            tl.layout = ti->layout;
-           tl.dimen.x = lines[i].size;
-           tl.dimen.y = lines[i].lfsize;
-           tl.just = lines[i].just;
+           tl.width = paras[i].size;
+           tl.height = paras[i].lfsize;
+           tl.just = paras[i].just;
 
-           gvrender_textline(job, p_, &tl);
+           gvrender_textpara(job, p_, &tl);
            offset += ti->size;
            p_.x = p.x + offset;
             ti++;
        }
-       /* position for next line */
-       if(i != nlines-1)
-           p_.y -= lines[i+1].lfsize * LINESPACING;
+       /* position for next para */
+       if(i != nparas-1)
+           p_.y -= paras[i+1].lfsize * LINESPACING;
        offset = 0.0;
     }
 
@@ -230,7 +230,7 @@ emit_html_txt(GVJ_t* job, htmltxt_t* tp, htmlenv_t* env, void* obj)
     double fsize;
 
     /* make sure that there is something to do */
-    if (tp->nlines < 1)
+    if (tp->nparas < 1)
        return;
 
     fsize = env->finfo.size;
@@ -241,7 +241,7 @@ emit_html_txt(GVJ_t* job, htmltxt_t* tp, htmlenv_t* env, void* obj)
     p.x = env->p.x + ((double) (tp->box.UR.x + tp->box.LL.x)) / 2.0;
     p.y = env->p.y + ((double) (tp->box.UR.y + tp->box.LL.y)) / 2.0;
 
-    emit_htextlines(job, tp->nlines, tp->lines, p, halfwidth_x, fname,
+    emit_htextparas(job, tp->nparas, tp->paras, p, halfwidth_x, fname,
                    fsize, fcolor, tp->box);
 }
 
@@ -486,16 +486,16 @@ void free_html_data(htmldata_t * dp)
 #ifdef OLD
 void free_html_text(htmltxt_t * tp)
 {
-    textline_t *lp;
+    textpara_t *lp;
 
     if (!tp)
        return;
-    lp = tp->line;
+    lp = tp->para;
     while (lp->str) {
        free(lp->str);
        lp++;
     }
-    free(tp->line);
+    free(tp->para);
     if (tp->font)
        free_html_font(tp->font);
     free(tp);
@@ -504,14 +504,14 @@ void free_html_text(htmltxt_t * tp)
 
 void free_html_text(htmltxt_t* t)
 {
-    htextline_t *tl;
+    htextpara_t *tl;
     textitem_t *ti;
     int i, j;
 
     if (!t) return;
 
-    tl = t->lines;
-    for (i = 0; i < t->nlines; i++) {
+    tl = t->paras;
+    for (i = 0; i < t->nparas; i++) {
        ti = tl->items;
        for (j = 0; j < tl->nitems; j++) {
            if (ti->str) free (ti->str);
@@ -523,7 +523,7 @@ void free_html_text(htmltxt_t* t)
        tl++;
     }
     free(tl->items);
-    free(t->lines);
+    free(t->paras);
     free(t);
 }
 
@@ -711,7 +711,7 @@ size_html_txt(graph_t *g, htmltxt_t * txt, htmlenv_t * env)
     double fsize;
     char *fname;
     char *news = NULL;
-    textline_t *lp = txt->line;
+    textpara_t *lp = txt->para;
     pointf size;
 
     if (txt->font) {
@@ -751,10 +751,10 @@ size_html_txt(graph_t *g, htmltxt_t * txt, htmlenv_t * env)
        lp++;
     }
     txt->box.UR.x = xsize;
-    if (txt->nlines == 1)
+    if (txt->nparas == 1)
        txt->box.UR.y = (int) (size.y);
     else
-       txt->box.UR.y = txt->nlines * (int) (size.y * LINESPACING);
+       txt->box.UR.y = txt->nparas * (int) (size.y * LINESPACING);
     return 0;
 }
 #endif
@@ -785,7 +785,7 @@ size_html_txt(graph_t *g, htmltxt_t* ftxt, htmlenv_t* env)
     pointf sz;
     int i, j, w = 0, width = 0;
     char *fname;
-    textline_t lp;
+    textpara_t lp;
     char* (*substrFn) (char*, htmlenv_t* env);
 
     switch (agobjkind(env->obj)) {
@@ -802,16 +802,16 @@ size_html_txt(graph_t *g, htmltxt_t* ftxt, htmlenv_t* env)
        substrFn = NULL;
     }
 
-    for (i = 0; i < ftxt->nlines; i++) {
-       for (j = 0; j < ftxt->lines[i].nitems; j++) {
-           lp.str = substrFn (ftxt->lines[i].items[j].str, env);
-           if (ftxt->lines[i].items[j].font) {
-               if (ftxt->lines[i].items[j].font->size > 0)
-                   fsize = ftxt->lines[i].items[j].font->size;
+    for (i = 0; i < ftxt->nparas; i++) {
+       for (j = 0; j < ftxt->paras[i].nitems; j++) {
+           lp.str = substrFn (ftxt->paras[i].items[j].str, env);
+           if (ftxt->paras[i].items[j].font) {
+               if (ftxt->paras[i].items[j].font->size > 0)
+                   fsize = ftxt->paras[i].items[j].font->size;
                else
                    fsize = env->finfo.size;
-               if (ftxt->lines[i].items[j].font->name)
-                   fname = ftxt->lines[i].items[j].font->name;
+               if (ftxt->paras[i].items[j].font->name)
+                   fname = ftxt->paras[i].items[j].font->name;
                else
                    fname = env->finfo.name;
            } else {
@@ -820,18 +820,18 @@ size_html_txt(graph_t *g, htmltxt_t* ftxt, htmlenv_t* env)
            }
            sz = textsize(g, &lp, fname, fsize);
            w = sz.x;
-           free (ftxt->lines[i].items[j].str);
-           ftxt->lines[i].items[j].str = lp.str;
-           ftxt->lines[i].items[j].size = sz.x;
-           ftxt->lines[i].items[j].xshow = lp.xshow;
-           ftxt->lines[i].items[j].layout = lp.layout;
-           ftxt->lines[i].items[j].free_layout = lp.free_layout;
+           free (ftxt->paras[i].items[j].str);
+           ftxt->paras[i].items[j].str = lp.str;
+           ftxt->paras[i].items[j].size = sz.x;
+           ftxt->paras[i].items[j].xshow = lp.xshow;
+           ftxt->paras[i].items[j].layout = lp.layout;
+           ftxt->paras[i].items[j].free_layout = lp.free_layout;
            width += w;
-           ftxt->lines[i].size = (double) width;
+           ftxt->paras[i].size = (double) width;
            if (fsize > lsize)
                lsize = fsize;
        }
-       ftxt->lines[i].lfsize = lsize;
+       ftxt->paras[i].lfsize = lsize;
        if (width > xsize)
            xsize = width;
        ysize += lsize * LINESPACING;
@@ -1254,9 +1254,9 @@ pos_html_txt(htmltxt_t* ftxt, char c)
 {
     int i;
 
-    for (i = 0; i < ftxt->nlines; i++) {
-       if (ftxt->lines[i].just == UNSET_ALIGN)  /* unset */
-           ftxt->lines[i].just = c;
+    for (i = 0; i < ftxt->nparas; i++) {
+       if (ftxt->paras[i].just == UNSET_ALIGN)  /* unset */
+           ftxt->paras[i].just = c;
     }
 }
 
@@ -1578,10 +1578,10 @@ void printTxt(htmltxt_t * tp, int ind)
     fprintf(stderr, "txt ");
     printBox(tp->box);
     fputs("\n", stderr);
-    for (i = 0; i < tp->nlines; i++) {
+    for (i = 0; i < tp->nparas; i++) {
        indent(ind + 1);
-       fprintf(stderr, "(%c) \"%s\"\n", tp->line[i].just,
-               tp->line[i].str);
+       fprintf(stderr, "(%c) \"%s\"\n", tp->para[i].just,
+               tp->para[i].str);
     }
 }
 #endif
@@ -1591,20 +1591,20 @@ void printTxt(htmltxt_t * txt, int ind)
     int i, j;
 
     indent(ind);
-    fprintf (stderr, "txt lines = %d \n", txt->nlines);
-    for (i = 0; i < txt->nlines; i++) {
+    fprintf (stderr, "txt paras = %d \n", txt->nparas);
+    for (i = 0; i < txt->nparas; i++) {
        indent(ind+1);
-       fprintf (stderr, "[%d] %d items\n", i, txt->lines[i].nitems);
-       for (j = 0; j < txt->lines[i].nitems; j++) {
+       fprintf (stderr, "[%d] %d items\n", i, txt->paras[i].nitems);
+       for (j = 0; j < txt->paras[i].nitems; j++) {
            indent(ind+2);
            fprintf (stderr, "[%d] (%f) \"%s\" ",
-                  j, txt->lines[i].items[j].size,
-                  txt->lines[i].items[j].str);
-           if (txt->lines[i].items[j].font)
+                  j, txt->paras[i].items[j].size,
+                  txt->paras[i].items[j].str);
+           if (txt->paras[i].items[j].font)
              fprintf (stderr, "font %s color %s size %f\n",
-                  txt->lines[i].items[j].font->name,
-                  txt->lines[i].items[j].font->color,
-                  txt->lines[i].items[j].font->size);
+                  txt->paras[i].items[j].font->name,
+                  txt->paras[i].items[j].font->color,
+                  txt->paras[i].items[j].font->size);
            else fprintf (stderr, "\n");
        }
     }
index 5f0465b579d5d576abd1488a82efda591e3e9653..176bd982ac9a5fb65ecc5cd80e33a8719ba8791c 100644 (file)
@@ -49,14 +49,14 @@ extern "C" {
        int    cnt;   /* reference count */
     } htmlfont_t;
 
-    /* lines of text within a cell
-     * NOTE: As required, the str field in line is utf-8.
+    /* paras of text within a cell
+     * NOTE: As required, the str field in para is utf-8.
      * This translation is done when libexpat scans the input.
      */
 #ifdef OLD
     typedef struct {
-       textline_t *line;
-       short nlines;
+       textpara_t *para;
+       short nparas;
        box box;
        htmlfont_t *font;       /* font info */
     } htmltxt_t;
@@ -75,13 +75,13 @@ extern "C" {
        textitem_t *items;
        short nitems;
        char just;
-       double size;   /* size of line */
-       double lfsize; /* size of largest font in line */
-    } htextline_t;
+       double size;   /* size of para */
+       double lfsize; /* size of largest font in para */
+    } htextpara_t;
        
     typedef struct {
-       htextline_t *lines;
-       short nlines;
+       htextpara_t *paras;
+       short nparas;
        box box;
     } htmltxt_t;
 
index be6276657596e91b0880e67e55a94fb9dcca6a07..ba38895269a6e6dd74ece5a193ab03ea1d7fedcd 100644 (file)
@@ -20,7 +20,7 @@
 
 char *Gvfilepath;
 
-#if !defined(DISABLE_CODEGENS) && !defined(HAVE_GD_FREETYPE)
+#if defined(WITH_CODEGENS) && !defined(HAVE_GD_FREETYPE)
 codegen_t *Output_codegen;
 #endif
 
@@ -302,7 +302,7 @@ void dotneato_args_initialize(GVC_t * gvc, int argc, char **argv)
        assert(v);  /* "dot" should always be available as an output format */
     }
 
-#if !defined(DISABLE_CODEGENS) && !defined(HAVE_GD_FREETYPE)
+#if defined(WITH_CODEGENS) && !defined(HAVE_GD_FREETYPE)
     Output_codegen = gvc->jobs->codegen;
 #endif
 
index bf80b99a7266905c6bbcd5badddd81636221b807..7e8a251988fce47a793e441d6f815d672a013c37 100644 (file)
@@ -23,18 +23,18 @@ static void storeline(graph_t *g, textlabel_t *lp, char *line, char terminator)
 {
     pointf size;
 
-    lp->u.txt.line =
-       ALLOC(lp->u.txt.nlines + 2, lp->u.txt.line, textline_t);
-    lp->u.txt.line[lp->u.txt.nlines].str = line;
-    size = textsize(g, &(lp->u.txt.line[lp->u.txt.nlines]),
+    lp->u.txt.para =
+       ALLOC(lp->u.txt.nparas + 2, lp->u.txt.para, textpara_t);
+    lp->u.txt.para[lp->u.txt.nparas].str = line;
+    size = textsize(g, &(lp->u.txt.para[lp->u.txt.nparas]),
            lp->fontname, lp->fontsize);
-    lp->u.txt.line[lp->u.txt.nlines].just = terminator;
-    lp->u.txt.nlines++;
+    lp->u.txt.para[lp->u.txt.nparas].just = terminator;
+    lp->u.txt.nparas++;
     /* total width = max line width */
     if (lp->dimen.x < size.x)
        lp->dimen.x = size.x;
     /* recalculate total height */
-    lp->dimen.y = lp->u.txt.nlines * (int) (size.y * LINESPACING);
+    lp->dimen.y = lp->u.txt.nparas * (int) (size.y * LINESPACING);
 }
 
 /* compiles <str> into a label <lp> and returns its bounding box size.  */
@@ -132,7 +132,7 @@ textlabel_t *make_label(graph_t *g, int html, char *str, double fontsize,
     return rv;
 }
 
-static void free_textline(textline_t * tl)
+static void free_textpara(textpara_t * tl)
 {
     if (tl) {
        if (tl->str)
@@ -152,28 +152,28 @@ void free_label(textlabel_t * p)
        if (p->html) {
            free_html_label(p->u.html, 1);
        } else {
-           free_textline(p->u.txt.line);
+           free_textpara(p->u.txt.para);
        }
        free(p);
     }
 }
 
 void 
-emit_textlines(GVJ_t* job, int nlines, textline_t lines[], pointf p,
+emit_textparas(GVJ_t* job, int nparas, textpara_t paras[], pointf p,
               double halfwidth_x, char* fname, double fsize, char* fcolor)
 {
-    int i, linespacing;
+    int i, paraspacing;
     double tmp, center_x, left_x, right_x;
 
     center_x = p.x;
     left_x = center_x - halfwidth_x;
     right_x = center_x + halfwidth_x;
 
-    /* set linespacing to an exact no. of pixelrows */
-    linespacing = (int) (fsize * LINESPACING);
+    /* set paraspacing to an exact no. of pixelrows */
+    paraspacing = (int) (fsize * LINESPACING);
 
-    /* position for first line */
-    p.y += linespacing * (nlines - 1) / 2      /* cl of topline */
+    /* position for first para */
+    p.y += paraspacing * (nparas - 1) / 2      /* cl of toppara */
                        - fsize * 0.30; /* Empirically determined fudge factor */
 
     tmp = ROUND(p.y);  /* align with integer points */
@@ -183,8 +183,8 @@ emit_textlines(GVJ_t* job, int nlines, textline_t lines[], pointf p,
     gvrender_set_pencolor(job, fcolor);
     gvrender_set_font(job, fname, fsize);
 
-    for (i = 0; i < nlines; i++) {
-       switch (lines[i].just) {
+    for (i = 0; i < nparas; i++) {
+       switch (paras[i].just) {
        case 'l':
            p.x = left_x;
            break;
@@ -196,10 +196,10 @@ emit_textlines(GVJ_t* job, int nlines, textline_t lines[], pointf p,
            p.x = center_x;
            break;
        }
-       gvrender_textline(job, p, &(lines[i]));
+       gvrender_textpara(job, p, &(paras[i]));
 
-       /* position for next line */
-       p.y -= linespacing;
+       /* position for next para */
+       p.y -= paraspacing;
     }
 
     gvrender_end_context(job);
@@ -220,7 +220,7 @@ void emit_label(GVJ_t * job, int state, textlabel_t * lp, void *obj)
     }
 
     /* make sure that there is something to do */
-    if (lp->u.txt.nlines < 1)
+    if (lp->u.txt.nparas < 1)
        return;
 
     p.x = lp->p.x;
@@ -229,7 +229,7 @@ void emit_label(GVJ_t * job, int state, textlabel_t * lp, void *obj)
     /* dimensions of box for label, no padding, adjusted for resizing */
     halfwidth_x = (lp->dimen.x + lp->d.x) / 2.0;
 
-    emit_textlines(job, lp->u.txt.nlines, lp->u.txt.line, p,
+    emit_textparas(job, lp->u.txt.nparas, lp->u.txt.para, p,
               halfwidth_x, lp->fontname, lp->fontsize, lp->fontcolor);
     job->gvc->emit_state = oldstate;
 }
index 70fdcd815c981e7477b419544d3efc71a301960d..afc9936c395a727052fd72045855a12c898c8b17 100644 (file)
@@ -480,15 +480,14 @@ static char *mif_string(char *s)
     return buf;
 }
 
-static void mif_textline(point p, textline_t * line)
+static void mif_textpara(point p, textpara_t * para)
 {
     pointf mp;
-    char *str = line->str;
     char *anchor;
 
     mp.x = p.x;
     mp.y = p.y - cstk[SP].fontsz / 2 + 2;
-    switch (line->just) {
+    switch (para->just) {
     case 'l':
        anchor = "Left";
        break;
@@ -504,7 +503,7 @@ static void mif_textline(point p, textline_t * line)
     fprintf(Output_file,
            "<TextLine <Angle %d> <TLOrigin %.2f %.2f> <TLAlignment %s>",
            Rot, mp.x, mp.y, anchor);
-    fprintf(Output_file, " <String `%s'>>\n", mif_string(str));
+    fprintf(Output_file, " <String `%s'>>\n", mif_string(para->str));
 }
 
 static void mif_bezier(point * A, int n, int arrow_at_start,
@@ -569,7 +568,7 @@ codegen_t MIF_CodeGen = {
     0, /* mif_begin_edge */  0,        /* mif_end_edge */
     mif_begin_context, mif_end_context,
     0, /* mif_begin_anchor */ 0,       /* mif_end_anchor */
-    mif_set_font, mif_textline,
+    mif_set_font, mif_textpara,
     mif_set_color, mif_set_color, mif_set_style,
     mif_ellipse, mif_polygon,
     mif_bezier, mif_polyline,
index a8c94919a5d7be3dc360eb64c017cc4a3d22c5c3..ce1d8c8aeb60b52ed0be8787eb1d95c932b56b19 100644 (file)
@@ -189,10 +189,10 @@ static char *mp_string(char *s)
     return buf;
 }
 
-static void mp_textline(point p, textline_t * line)
+static void mp_textpara(point p, textpara_t * para)
 {
     fprintf(Output_file, "label(btex %s etex,(%dbp,%dbp)) withcolor %s;\n",
-           mp_string(line->str), p.x, p.y, S[SP].color);
+           mp_string(para->str), p.x, p.y, S[SP].color);
 }
 
 static void
@@ -270,7 +270,7 @@ codegen_t MP_CodeGen = {
     0, /* mp_begin_edge */  0, /* mp_end_edge */
     mp_begin_context, mp_end_context,
     0, /* mp_begin_anchor */ 0,        /* mp_end_anchor */
-    mp_set_font, mp_textline,
+    mp_set_font, mp_textpara,
     mp_set_color, mp_set_color, mp_set_style,
     mp_ellipse, mp_polygon,
     mp_bezier, mp_polyline,
index a3820a895492f033a32e8a3b8fa8f46e0bef9f76..5332bae7dd3e56568e5bf35676f343e8fec7d762 100644 (file)
@@ -140,7 +140,7 @@ 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
+#ifdef WITH_CODEGENS
        attach_attrs(g);
        extend_attrs(job, g, s_arrows, e_arrows);
        agwrite(g, f);
index 0cf398cae494c9b056d5869c2cd397cc17ee66ea..1f2c2c8d4ef45bb7ac5f5aeb06ec296f8760d113 100644 (file)
@@ -407,22 +407,22 @@ static char *pic_string(char *s)
     return buf;
 }
 
-static void pic_textline(point p, textline_t * line)
+static void pic_textpara(point p, textpara_t * para)
 {
     pointf pf;
     short flag = 0;
     double fontsz = S[SP].size;
 
-    switch (line->just) {
+    switch (para->just) {
     case 'l':
        p.x = p.x;
        break;
     case 'r':
-       p.x = p.x - line->dimen.x;
+       p.x = p.x - para->width;
        break;
     default:
     case 'n':
-       p.x = p.x - line->dimen.x / 2;
+       p.x = p.x - para->width / 2;
        break;
     }
     pf = cvt2ptf(p);
@@ -432,7 +432,7 @@ static void pic_textline(point p, textline_t * line)
 #endif
     /* Why on earth would we do this either. But it works. SCN 2/26/2002 */
     pf.y += fontsz / (3.0 * POINTS_PER_INCH);
-    pf.x += line->dimen.x / (2.0 * POINTS_PER_INCH);
+    pf.x += para->width / (2.0 * POINTS_PER_INCH);
     if (!(S[SP].size)) {       /* size was never set in this or hierarchically higher context */
        pic_set_font(S[SP].font, fontsz);       /* primarily to output font and/or size directives */
        for (flag = SP; ((S[flag].size = fontsz), flag); flag--)        /* set size in contexts */
@@ -445,7 +445,7 @@ static void pic_textline(point p, textline_t * line)
        pic_set_font(S[SP - 1].font, fontsz);
     }
     fprintf(Output_file, "\"%s\" at (%.5f,%.5f);\n",
-           pic_string(line->str), Scale * pf.x, Scale * pf.y);
+           pic_string(para->str), Scale * pf.x, Scale * pf.y);
     if (flag)
        pic_end_context();
 }
@@ -609,7 +609,7 @@ codegen_t PIC_CodeGen = {
     pic_begin_edge, 0,         /* pic_end_edge */
     pic_begin_context, pic_end_context,
     0, /* pic_begin_anchor */ 0,       /* pic_end_anchor */
-    pic_set_font, pic_textline,
+    pic_set_font, pic_textpara,
     pic_set_color, pic_set_color, pic_set_style,
     pic_ellipse, pic_polygon,
     pic_bezier, pic_polyline,
index 88c1bdd3848793970bfdb1eb9decb6527ef64f1c..92a2131a8879ba8bec9dffe2ef4897a652ff5b90 100644 (file)
@@ -109,7 +109,7 @@ extern "C" {
     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,
+    extern void emit_textparas(GVJ_t*, int, textpara_t*, pointf,
               double, char*, double, char*);
     extern void enqueue_neighbors(nodequeue *, Agnode_t *, int);
     extern void endpath(path *, Agedge_t *, int, pathend_t *, bool);
@@ -117,10 +117,10 @@ extern "C" {
     extern void epsf_free(node_t * n);
     extern void extend_attrs(GVJ_t * job, graph_t *g, int s_arrows, int e_arrows);
     extern shape_desc *find_user_shape(char *);
-    extern void free_line(textline_t *);
+    extern void free_line(textpara_t *);
     extern void free_label(textlabel_t *);
     extern char *gd_alternate_fontlist(char *font);
-    extern char *gd_textsize(textline_t * textline, char *fontname,
+    extern char *gd_textsize(textpara_t * textpara, char *fontname,
                             double fontsz, char **fontpath);
     extern void getdouble(graph_t * g, char *name, double *result);
     extern splines *getsplinepoints(edge_t * e);
@@ -158,7 +158,7 @@ extern "C" {
     extern void shape_clip(node_t * n, point curve[4]);
     extern void size_label (graph_t* g, textlabel_t* rv);
     extern void start_timer(void);
-    extern pointf textsize(graph_t *g, textline_t * textline,
+    extern pointf textsize(graph_t *g, textpara_t * para,
                            char *fontname, double fontsz);
     extern void translate_bb(Agraph_t *, int);
     extern void use_library(char *);
@@ -172,7 +172,7 @@ extern "C" {
 #   define extern __EXPORT__
 #endif
 
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
 #ifndef HAVE_GD_FREETYPE
     extern void initDPI(graph_t *);
     extern double textheight(int nlines, double fontsz);
index 68d68400755149de32d464572ce32b74131a9faa..9331ee129b5504306840d8d3ebb1d304c4355f1c 100644 (file)
@@ -18,7 +18,7 @@
 #include "htmltable.h"
 #include <limits.h>
 
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
 extern codegen_t VRML_CodeGen;
 #endif
 
@@ -252,7 +252,7 @@ char *findFill(node_t * n)
            if (ND_shape(n) == point_desc) {
                color = "black";
            }
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
            else {
                color = (Output_lang == MIF ? "black" : DEFAULT_FILL);
            }
@@ -1217,7 +1217,7 @@ static void poly_gencode(GVJ_t * job, node_t * n)
     xsize = (16.0 * (ND_lw_i(n) + ND_rw_i(n)) / POINTS(ND_width(n)));
     ysize = (16.0 * ND_ht_i(n) / POINTS(ND_height(n)));
 
-#if !defined(DISABLE_CODEGENS) && defined(HAVE_GD_PNG)
+#if defined(WITH_CODEGENS) && defined(HAVE_GD_PNG)
     /* this is bad, but it's because of how the VRML driver works */
     if ((job->codegen == &VRML_CodeGen) && (peripheries == 0)) {
        peripheries = 1;
similarity index 60%
rename from tclpkg/gv/builtins.c
rename to lib/common/textpara.h
index 75046cd3ef08b9282a27f98439cde3ef265030fc..af74abe2d6d259259b498f494a04ca100a238253 100644 (file)
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-#include "gvplugin.h"
+#ifndef TEXTPARA_H
+#define TEXTPARA_H
 
-struct lt_symlist
-{
-    const char *name;
-    void* address;
-};
+#ifdef __cplusplus
+extern "C" {
+#endif
 
-#if 1
-extern gvplugin_library_t gvplugin_dot_layout_LTX_library;
-extern gvplugin_library_t gvplugin_neato_layout_LTX_library;
+#include "geom.h"
 
-const struct lt_symlist lt_preloaded_symbols[] = {
-    { "gvplugin_dot_layout_LTX_library", (void*)(&gvplugin_dot_layout_LTX_library) },
-    { "gvplugin_neato_layout_LTX_library", (void*)(&gvplugin_neato_layout_LTX_library) },
-    { 0, 0 }
-};
-#else
-const struct lt_symlist lt_preloaded_symbols[] = {{0,0,},};
-#endif
+    typedef struct textpara_t {
+       char *str;      /* stored in utf-8 */
+       char *xshow;
+       void *layout;
+       void (*free_layout) (void *layout);   /* FIXME - this is ugly */
+       double width, height;
+       char just;
+    } textpara_t;
 
+#ifdef __cplusplus
+}
+#endif
+#endif
index fa218a2c77d508ef8b91d68b9f58bff7154d4971..2e8d07f1b9024bb4a558f8eb720868d1aed056fb 100644 (file)
@@ -25,6 +25,8 @@
 #include "pathplan.h"
 #include "color.h"
 #include "gvcext.h"
+#include "textpara.h"
+#include "usershape.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -114,26 +116,6 @@ extern "C" {
        int size;
     } splinesf;
 
-    typedef enum { FT_BMP, FT_GIF, FT_PNG, FT_JPEG, FT_PDF, FT_PS, FT_EPS } imagetype_t;
-
-    typedef struct usershape_s {
-       char *name;
-        FILE *f;
-        imagetype_t type;
-        unsigned int w, h, dpi;
-        void *data;                   /* data loaded by a renderer */
-        void (*datafree)(void *data); /* renderer's function for freeing data */
-    } usershape_t;
-
-    typedef struct textline_t {
-       char *str;      /* stored in utf-8 */
-       char *xshow;
-       void *layout;
-       void (*free_layout) (void *layout);   /* FIXME - this is ugly */
-       pointf dimen;
-       char just;
-    } textline_t;
-
     typedef struct textlabel_t {
        char *text, *fontname, *fontcolor;
        double fontsize;
@@ -142,8 +124,8 @@ extern "C" {
        pointf d;               /* delta from resizing */
        union {
            struct {
-               textline_t *line;
-               short nlines;
+               textpara_t *para;
+               short nparas;
            } txt;
            htmllabel_t *html;
        } u;
@@ -201,7 +183,7 @@ extern "C" {
        bool usershape;
     } shape_desc;
 
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     struct codegen_s {
        void (*reset) (void);
        void (*begin_job) (FILE * ofp, graph_t * g, char **lib, char *user,
@@ -229,7 +211,7 @@ extern "C" {
        void (*begin_anchor) (char *href, char *tooltip, char *target);
        void (*end_anchor) (void);
        void (*set_font) (char *fontname, double fontsize);
-       void (*textline) (point p, textline_t * str);
+       void (*textpara) (point p, textpara_t * str);
        void (*set_pencolor) (char *name);
        void (*set_fillcolor) (char *name);
        void (*set_style) (char **s);
similarity index 60%
rename from tclpkg/tcldot/builtins.c
rename to lib/common/usershape.h
index 75046cd3ef08b9282a27f98439cde3ef265030fc..912a668353214a659378198251afed208829cfab 100644 (file)
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-#include "gvplugin.h"
+#ifndef USERSHAPE_H
+#define USERSHAPE_H
 
-struct lt_symlist
-{
-    const char *name;
-    void* address;
-};
+#ifdef __cplusplus
+extern "C" {
+#endif
 
-#if 1
-extern gvplugin_library_t gvplugin_dot_layout_LTX_library;
-extern gvplugin_library_t gvplugin_neato_layout_LTX_library;
+    typedef enum { FT_BMP, FT_GIF, FT_PNG, FT_JPEG, FT_PDF, FT_PS, FT_EPS } imagetype_t;
 
-const struct lt_symlist lt_preloaded_symbols[] = {
-    { "gvplugin_dot_layout_LTX_library", (void*)(&gvplugin_dot_layout_LTX_library) },
-    { "gvplugin_neato_layout_LTX_library", (void*)(&gvplugin_neato_layout_LTX_library) },
-    { 0, 0 }
-};
-#else
-const struct lt_symlist lt_preloaded_symbols[] = {{0,0,},};
-#endif
+    typedef struct usershape_s {
+       char *name;
+        FILE *f;
+        imagetype_t type;
+        unsigned int w, h, dpi;
+        void *data;                   /* data loaded by a renderer */
+        void (*datafree)(void *data); /* renderer's function for freeing data */
+    } usershape_t;
 
+#ifdef __cplusplus
+}
+#endif
+#endif
index f326bdbf9faa77a10c770eef1f7c47ce7bf86987..1cd430675ef3f32356cb2af39866041dd8e8339a 100644 (file)
@@ -492,7 +492,7 @@ static char *vtx_string(char *s)
     return buf;
 }
 
-static void vtx_textline(point p, textline_t * line)
+static void vtx_textpara(point p, textpara_t * para)
 {
     pointf mp;
     double fontsz = Scale * cstk[SP].fontsz;
@@ -514,7 +514,7 @@ static void vtx_textline(point p, textline_t * line)
                "{\\fonttbl{\\f0\\fnil helvetica medium;}}\n"
                "{\\colortbl\\red0\\green0\\blue0;}\n"
                "\\cf0\\plain\\pard {\\fs%d %s}})\n",
-               (int) ((fontsz * 2) - 8), vtx_string(line->str));
+               (int) ((fontsz * 2) - 8), vtx_string(para->str));
     } else {
        fprintf(Output_file, "    (showText T)\n"
                "    (textVerticalAlignment \"left\")\n"
@@ -522,7 +522,7 @@ static void vtx_textline(point p, textline_t * line)
                "{\\fonttbl{\\f0\\fnil helvetica medium;}}\n"
                "{\\colortbl\\red0\\green0\\blue0;}\n"
                "\\cf0\\plain\\pard {\\fs%d %s}})\n",
-               (int) ((fontsz * 2) - 8), vtx_string(line->str));
+               (int) ((fontsz * 2) - 8), vtx_string(para->str));
     }
 }
 
@@ -640,7 +640,7 @@ codegen_t VTX_CodeGen = {
     vtx_begin_edge, vtx_end_edge,
     vtx_begin_context, vtx_end_context,
     0, /* vtx_begin_anchor */ 0,       /* vtx_end_anchor */
-    vtx_set_font, vtx_textline,
+    vtx_set_font, vtx_textpara,
     vtx_set_color, vtx_set_color, vtx_set_style,
     vtx_ellipse, vtx_polygon,
     vtx_bezier, vtx_polyline,
index 5c3ecfd55098283fccc2335fca66b24192cfa208..2e8610f6499c1e7aeb9a92da9449d677532a3920 100644 (file)
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "gvplugin.h"
 
 extern gvplugin_library_t *gvplugin_dot_layout_LTX_library;
 extern gvplugin_library_t *gvplugin_neato_layout_LTX_library;
 extern gvplugin_library_t *gvplugin_gd_LTX_library;
+extern gvplugin_library_t *gvplugin_pango_LTX_library;
 
 const lt_symlist_t lt_preloaded_symbols[] = {
        { "gvplugin_dot_layout_LTX_library", (void*)(&gvplugin_dot_layout_LTX_library) },
        { "gvplugin_neato_layout_LTX_library", (void*)(&gvplugin_neato_layout_LTX_library) },
+       { "gvplugin_pango_LTX_library", (void*)(&gvplugin_gd_LTX_library) },
        { "gvplugin_gd_LTX_library", (void*)(&gvplugin_gd_LTX_library) },
        { 0, 0 }
 };
index 77bc91c05c69634121c2a6c89fb1842d9ea4e52c..822085d9e5ed1b219e0631251582b67eac0339c6 100644 (file)
@@ -23,7 +23,7 @@
 extern "C" {
 #endif
 
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     typedef struct codegen_s codegen_t;
     typedef struct codegen_info_s codegen_info_t;
 #endif
index 152d14a6e421984619473dcc2ce3391b6a31cf5c..0c3a7c361191b252a3ba4ba061287b68c42db3aa 100644 (file)
@@ -152,7 +152,7 @@ extern "C" {
        gvplugin_active_device_t device;
        gvdevice_callbacks_t *callbacks;
 
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
        codegen_t *codegen;     /* current  codegen */
 #endif
 
index caae72a109db0b04a60c648831d87f1fc26b9329..c196a8054cd0f48934305a9a5a441514ea457cd2 100644 (file)
@@ -38,7 +38,7 @@
 #include       "gvcint.h"
 #include        "gvcproc.h"
 
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
 #ifdef QUARTZ_RENDER
 #include <QuickTime/QuickTime.h>
 
@@ -356,7 +356,7 @@ static void config_rescan(GVC_t *gvc, char *config_path)
 }
 #endif
 
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
 
 #define MAX_CODEGENS 100
 
@@ -498,7 +498,7 @@ void gvconfig(GVC_t * gvc, bool rescan)
 #define MAX_SZ_CONFIG 100000
 #endif
     
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     codegen_info_t *p;
 
     for (p = cg; p->name; ++p)
index 26561706cdd64fd20c72d999d7d7bfd4f5efdcc7..d969c50d2d7fa615ef0a7c77f33611cf357e6f75 100644 (file)
@@ -57,7 +57,7 @@ extern "C" {
 /* textlayout */
 
     extern int gvtextlayout_select(GVC_t * gvc);
-    extern bool gvtextlayout(GVC_t *gvc, textline_t *textline,
+    extern bool gvtextlayout(GVC_t *gvc, textpara_t *para,
                       char *fontname, double fontsize, char **fontpath);
 
 /* usershapes */
@@ -100,7 +100,7 @@ extern "C" {
     extern void gvrender_end_anchor(GVJ_t * job);
     extern void gvrender_set_font(GVJ_t * job, char *fontname,
                        double fontsize);
-    extern void gvrender_textline(GVJ_t * job, pointf p, textline_t * str);
+    extern void gvrender_textpara(GVJ_t * job, pointf p, textpara_t * para);
     extern void gvrender_set_pencolor(GVJ_t * job, char *name);
     extern void gvrender_set_fillcolor(GVJ_t * job, char *name);
     extern void gvrender_set_style(GVJ_t * job, char **s);
index 86cbf43aaefac102f726ddf6aac95848d8edcd4c..5c9880a99045d49d84cb76f471cecc1c7fec8d77 100644 (file)
@@ -40,13 +40,13 @@ int gvdevice_select(GVJ_t * job, char *str)
     GVC_t *gvc = job->gvc;
     gvplugin_available_t *plugin;
     gvplugin_installed_t *typeptr;
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     codegen_info_t *cg_info;
 #endif
 
     plugin = gvplugin_load(gvc, API_device, str);
     if (plugin) {
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
        if (strcmp(plugin->packagename, "cg") == 0) {
            cg_info = (codegen_info_t *) (plugin->typeptr);
            job->codegen = cg_info->cg;
@@ -59,7 +59,7 @@ int gvdevice_select(GVJ_t * job, char *str)
                (gvdevice_features_t *) (typeptr->features);
            job->device.id = typeptr->id;
            return GVRENDER_PLUGIN;
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
        }
 #endif
     }
@@ -88,7 +88,7 @@ void gvdevice_finalize(GVC_t * gvc)
            gvde->finalize(firstjob);
        }
     }
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = firstjob->codegen;
 
index 9d95f33df79a9f5b198763d1b8e1f518f64e0c5c..a30a6fab167ac6ac658b41021e1135a533cb67b6 100644 (file)
@@ -19,6 +19,9 @@
 
 #include "gvplugin.h"
 #include "gvcjob.h"
+#include "color.h"
+#include "textpara.h"
+#include "usershape.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -48,7 +51,7 @@ extern "C" {
        void (*begin_anchor) (GVJ_t * job, char *href, char *tooltip,
                              char *target);
        void (*end_anchor) (GVJ_t * job);
-       void (*textline) (GVJ_t * job, pointf p, textline_t * str);
+       void (*textpara) (GVJ_t * job, pointf p, textpara_t * str);
        void (*resolve_color) (GVJ_t * job, gvcolor_t * color);
        void (*ellipse) (GVJ_t * job, pointf * A, int filled);
        void (*polygon) (GVJ_t * job, pointf * A, int n, int filled);
index 52741d6757f30c36dc332c40b5e1347452f89947..b61c0d5c3ab448c8e98e5c71f81660e32553cfa5 100644 (file)
 #define GVTEXTLAYOUT_PLUGIN_H
 
 #include "gvplugin.h"
-#include "gvcint.h"
+#include "gvcjob.h"
+#include "textpara.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
     struct gvtextlayout_engine_s {
-       void (*textlayout) (textline_t *textline, char *fontname, double fontsize, char** fontpath);
+       void (*textlayout) (textpara_t *para, char *fontname, double fontsize, char** fontpath);
     };
 
 #ifdef __cplusplus
index 74c9e99f2228d1303549ff999c8fce9171c6c230..c2325d34b34ef10702e6a5f586b2a91f0a104b27 100644 (file)
 
 extern int emit_once(char *str);
 
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
 extern codegen_t PS_CodeGen;
 #endif
 
 /* storage for temporary hacks until client API is FP */
 static pointf *AF;
 static int sizeAF;
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
 static point *A;
 static int sizeA;
 #endif
@@ -57,13 +57,13 @@ int gvrender_select(GVJ_t * job, char *str)
     gvplugin_available_t *plugin;
     gvplugin_installed_t *typeptr;
     char *device;
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     codegen_info_t *cg_info;
 #endif
 
     plugin = gvplugin_load(gvc, API_render, str);
     if (plugin) {
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
        if (strcmp(plugin->packagename, "cg") == 0) {
            cg_info = (codegen_info_t *) (plugin->typeptr);
            job->codegen = cg_info->cg;
@@ -89,7 +89,7 @@ int gvrender_select(GVJ_t * job, char *str)
                job->device.id = typeptr->id;
            }
            return GVRENDER_PLUGIN;
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
        }
 #endif
     }
@@ -104,7 +104,7 @@ int gvrender_features(GVJ_t * job)
     if (gvre) {
        features = job->render.features->flags;
     }
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -127,8 +127,8 @@ void gvrender_begin_job(GVJ_t * job)
     GVC_t *gvc = job->gvc;
     gvrender_engine_t *gvre = job->render.engine;
     if (gvc->gvg) {
-        job->input_filename = gvc->gvg->input_filename;
-       job->graph_index = gvc->gvg->graph_index;
+       job->input_filename = gvc->gvg->input_filename;
+       job->graph_index = gvc->gvg->graph_index;
     }
     else {
         job->input_filename = NULL;
@@ -142,7 +142,7 @@ void gvrender_begin_job(GVJ_t * job)
         if (gvre->begin_job)
            gvre->begin_job(job);
     }
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -159,7 +159,7 @@ void gvrender_end_job(GVJ_t * job)
 
     if (gvre && gvre->end_job)
        gvre->end_job(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -305,7 +305,7 @@ void gvrender_begin_graph(GVJ_t * job, graph_t * g)
        job->style->fill = FILL_NONE;
        job->style->penwidth = PENWIDTH_NORMAL;
     }
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
        
@@ -331,7 +331,7 @@ void gvrender_end_graph(GVJ_t * job)
 
     if (gvre && gvre->end_graph)
        gvre->end_graph(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -349,7 +349,7 @@ void gvrender_begin_page(GVJ_t * job)
     if (gvre && gvre->begin_page)
        gvre->begin_page(job);
 
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
        point offset;
@@ -368,7 +368,7 @@ void gvrender_end_page(GVJ_t * job)
 
     if (gvre && gvre->end_page)
        gvre->end_page(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -384,7 +384,7 @@ void gvrender_begin_layer(GVJ_t * job)
 
     if (gvre && gvre->begin_layer)
        gvre->begin_layer(job, job->gvc->layerIDs[job->layerNum], job->layerNum, job->numLayers);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -400,7 +400,7 @@ void gvrender_end_layer(GVJ_t * job)
 
     if (gvre && gvre->end_layer)
        gvre->end_layer(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -415,12 +415,12 @@ void gvrender_begin_cluster(GVJ_t * job, graph_t * sg)
     gvrender_engine_t *gvre = job->render.engine;
 
     job->gvc->sg = sg;  /* set current cluster graph object */
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     Obj = CLST;
 #endif
     if (gvre && gvre->begin_cluster)
        gvre->begin_cluster(job, sg->name, sg->meta_node->id);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -436,7 +436,7 @@ void gvrender_end_cluster(GVJ_t * job, graph_t *g)
 
     if (gvre && gvre->end_cluster)
        gvre->end_cluster(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -454,7 +454,7 @@ void gvrender_begin_nodes(GVJ_t * job)
 
     if (gvre && gvre->begin_nodes)
        gvre->begin_nodes(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -470,7 +470,7 @@ void gvrender_end_nodes(GVJ_t * job)
 
     if (gvre && gvre->end_nodes)
        gvre->end_nodes(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -486,7 +486,7 @@ void gvrender_begin_edges(GVJ_t * job)
 
     if (gvre && gvre->begin_edges)
        gvre->begin_edges(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -502,7 +502,7 @@ void gvrender_end_edges(GVJ_t * job)
 
     if (gvre && gvre->end_edges)
        gvre->end_edges(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -516,13 +516,13 @@ void gvrender_begin_node(GVJ_t * job, node_t * n)
 {
     gvrender_engine_t *gvre = job->render.engine;
 
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     Obj = NODE;
 #endif
     job->gvc->n = n; /* set current node */
     if (gvre && gvre->begin_node)
        gvre->begin_node(job, n->name, n->id);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -538,7 +538,7 @@ void gvrender_end_node(GVJ_t * job)
 
     if (gvre && gvre->end_node)
        gvre->end_node(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -554,7 +554,7 @@ void gvrender_begin_edge(GVJ_t * job, edge_t * e)
 {
     gvrender_engine_t *gvre = job->render.engine;
 
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     Obj = EDGE;
 #endif
     job->gvc->e = e; /* set current edge */
@@ -562,7 +562,7 @@ void gvrender_begin_edge(GVJ_t * job, edge_t * e)
        gvre->begin_edge(job, e->tail->name,
                         e->tail->graph->root->kind & AGFLAG_DIRECTED,
                         e->head->name, e->id);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -578,7 +578,7 @@ void gvrender_end_edge(GVJ_t * job)
 
     if (gvre && gvre->end_edge)
        gvre->end_edge(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -601,7 +601,7 @@ void gvrender_begin_context(GVJ_t * job)
        gvc->styles[gvc->SP] = gvc->styles[(gvc->SP) - 1];
        job->style = &(gvc->styles[gvc->SP]);
     }
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -621,7 +621,7 @@ void gvrender_end_context(GVJ_t * job)
        assert(gvc->SP >= 0);
        job->style = &(gvc->styles[gvc->SP]);
     }
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -638,7 +638,7 @@ void gvrender_begin_anchor(GVJ_t * job, char *href, char *tooltip,
 
     if (gvre && gvre->begin_anchor)
        gvre->begin_anchor(job, href, tooltip, target);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -654,7 +654,7 @@ void gvrender_end_anchor(GVJ_t * job)
 
     if (gvre && gvre->end_anchor)
        gvre->end_anchor(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -672,7 +672,7 @@ void gvrender_set_font(GVJ_t * job, char *fontname, double fontsize)
        job->style->fontfam = fontname;
        job->style->fontsz = fontsize;
     }
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -682,24 +682,24 @@ void gvrender_set_font(GVJ_t * job, char *fontname, double fontsize)
 #endif
 }
 
-void gvrender_textline(GVJ_t * job, pointf p, textline_t * line)
+void gvrender_textpara(GVJ_t * job, pointf p, textpara_t * para)
 {
     gvrender_engine_t *gvre = job->render.engine;
 
-    if (line->str && line->str[0]) {
-       if (gvre && gvre->textline) {
+    if (para->str && para->str[0]) {
+       if (gvre && gvre->textpara) {
            if (job->style->pen != PEN_NONE) {
-               gvre->textline(job, gvrender_ptf(job, p), line);
+               gvre->textpara(job, gvrender_ptf(job, p), para);
            }
        }
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
        else {
            codegen_t *cg = job->codegen;
            point P;
 
            PF2P(p, P);
-           if (cg && cg->textline)
-               cg->textline(P, line);
+           if (cg && cg->textpara)
+               cg->textpara(P, para);
        }
 #endif
     }
@@ -715,7 +715,7 @@ void gvrender_set_pencolor(GVJ_t * job, char *name)
        if (gvre->resolve_color)
            gvre->resolve_color(job, color);
     }
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -735,7 +735,7 @@ void gvrender_set_fillcolor(GVJ_t * job, char *name)
        if (gvre->resolve_color)
            gvre->resolve_color(job, color);
     }
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -779,7 +779,7 @@ void gvrender_set_style(GVJ_t * job, char **s)
            }
        }
     }
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -808,7 +808,7 @@ void gvrender_ellipsef(GVJ_t * job, pointf pf, double rx, double ry, bool filled
            gvre->ellipse(job, af, filled);
        }
     }
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -844,7 +844,7 @@ void gvrender_ellipse(GVJ_t * job, point p, int rx, int ry, bool filled)
            gvre->ellipse(job, AF, filled);
        }
     }
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -870,7 +870,7 @@ void gvrender_polygonf(GVJ_t * job, pointf * af, int n, bool filled)
            gvre->polygon(job, AF, n, filled);
        }
     }
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -902,7 +902,7 @@ void gvrender_polygon(GVJ_t * job, point * A, int n, bool filled)
            gvre->polygon(job, AF, n, filled);
        }
     }
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -929,7 +929,7 @@ void gvrender_beziercurve(GVJ_t * job, pointf * af, int n,
            gvre->beziercurve(job, AF, n, arrow_at_start, arrow_at_end,filled);
        }
     }
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
        int i;
@@ -961,7 +961,7 @@ void gvrender_polylinef(GVJ_t * job, pointf * af, int n)
            gvre->polyline(job, AF, n);
        }
     }
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -993,7 +993,7 @@ void gvrender_polyline(GVJ_t * job, point * a, int n)
            gvre->polyline(job, AF, n);
        }
     }
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -1013,7 +1013,7 @@ void gvrender_comment(GVJ_t * job, char *str)
     if (gvre && gvre->comment) {
        gvre->comment(job, str);
     }
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
 
@@ -1068,7 +1068,7 @@ void gvrender_usershape(GVJ_t * job, char *name, point * a, int n, bool filled)
 
     if (gvre && gvre->usershape)
         gvre->usershape(job, us, b, filled);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     else {
         codegen_t *cg = job->codegen;
 
index 186b5e3648133f0c459b7d961b5e895aee0f1887..4dbb6191aec7d73e9f89c1e21966df2446031bf7 100644 (file)
@@ -25,6 +25,7 @@
 #include "const.h"
 #include "types.h"
 #include "gvplugin_textlayout.h"
+#include "gvcint.h"
 #include "gvcproc.h"
 
 int gvtextlayout_select(GVC_t * gvc)
@@ -41,12 +42,12 @@ int gvtextlayout_select(GVC_t * gvc)
     return NO_SUPPORT;
 }
 
-bool gvtextlayout(GVC_t *gvc, textline_t *textline, char *fontname, double fontsize, char **fontpath)
+bool gvtextlayout(GVC_t *gvc, textpara_t *para, char *fontname, double fontsize, char **fontpath)
 {
     gvtextlayout_engine_t *gvte = gvc->textlayout.engine;
 
     if (gvte && gvte->textlayout) {
-       gvte->textlayout(textline, fontname, fontsize, fontpath);
+       gvte->textlayout(para, fontname, fontsize, fontpath);
        return TRUE;
     }
     return FALSE;
index 1b3889c7db1d972e369ebe903ca181ca7f54733b..02d7c23795542565dce79da38d5c756b603b0942 100644 (file)
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "gvplugin.h"
 
 const lt_symlist_t lt_preloaded_symbols[] = { { 0, 0 } };
index 6f6c9a2e1dcf0b794f0a71f0f7ffc10f4cf765fe..eaf3db4b5ac6bb37f3512050e0211b8fa8e6e512 100644 (file)
 #include <string.h>
 #include <fcntl.h>
 #include <math.h>
-#include <gd.h>
-
-#include "color.h"
-#include "types.h"
 
 #include "gvplugin_render.h"
 
+#ifdef HAVE_LIBGD
+#include "gd.h"
+
 typedef enum { FORMAT_GD, FORMAT_GD2, FORMAT_GIF, FORMAT_JPEG, FORMAT_PNG,
        FORMAT_WBMP, FORMAT_XBM, } format_type;
 
@@ -408,15 +407,15 @@ int builtinFontWd(double fontsz)
 }
 #endif
 
-static void gdgen_textline(GVJ_t * job, pointf p, textline_t * line)
+static void gdgen_textpara(GVJ_t * job, pointf p, textpara_t * para)
 {
     gvstyle_t *style = job->style;
     gdImagePtr im = (gdImagePtr) job->surface;
     char *fontlist, *err;
     pointf mp, ep;
     int brect[8];
-    char *str = line->str;
-    double linewidth = line->dimen.x * job->compscale.x;
+    char *str = para->str;
+    double parawidth = para->width * job->compscale.x;
     double fontsz = style->fontsz;
     gdFTStringExtra strex;
 
@@ -433,19 +432,19 @@ static void gdgen_textline(GVJ_t * job, pointf p, textline_t * line)
 
     fontlist = gdgen_alternate_fontlist(style->fontfam);
 
-    switch (line->just) {
+    switch (para->just) {
     case 'l':
        mp.x = 0.0;
        break;
     case 'r':
-       mp.x = -linewidth;
+       mp.x = -parawidth;
        break;
     default:
     case 'n':
-       mp.x = -linewidth / 2;
+       mp.x = -parawidth / 2;
        break;
     }
-    ep.x = mp.x + linewidth;
+    ep.x = mp.x + parawidth;
 
     if (job->rotation) {
        mp.y = -mp.x + p.y;
@@ -461,7 +460,7 @@ static void gdgen_textline(GVJ_t * job, pointf p, textline_t * line)
     if (fontsz * job->compscale.x <= FONTSIZE_MUCH_TOO_SMALL) {
        /* ignore entirely */
     } else if (fontsz * job->compscale.x <= FONTSIZE_TOO_SMALL) {
-       /* draw line in place of text */
+       /* draw para in place of text */
        gdImageLine(im, ROUND(mp.x), ROUND(mp.y),
                    ROUND(ep.x), ROUND(ep.y),
                    style->pencolor.u.index);
@@ -476,7 +475,7 @@ static void gdgen_textline(GVJ_t * job, pointf p, textline_t * line)
 #endif
 #if 0
        fprintf(stderr,
-               "textline: font=%s size=%g pos=%g,%g width=%g dpi=%d width/dpi=%g\n",
+               "textpara: font=%s size=%g pos=%g,%g width=%g dpi=%d width/dpi=%g\n",
                fontlist, fontsz, mp.x, mp.y, (double) (brect[4] - brect[0]),
                strex.hdpi,
                (((double) (brect[4] - brect[0])) / strex.hdpi));
@@ -848,7 +847,7 @@ gvrender_engine_t gdgen_engine = {
     0,                         /* gdgen_end_edge */
     0,                         /* gdgen_begin_anchor */
     0,                         /* gdgen_end_anchor */
-    gdgen_textline,
+    gdgen_textpara,
     gdgen_resolve_color,
     gdgen_ellipse,
     gdgen_polygon,
@@ -879,7 +878,10 @@ gvrender_features_t gdgen_features = {
     NULL,                      /* device */
 };
 
+#endif
+
 gvplugin_installed_t gvrender_gd_types[] = {
+#ifdef HAVE_LIBGD
 #if 0
     {FORMAT_GD, "gd", 1, &gdgen_engine, &gdgen_features_tc},
     {FORMAT_GD2, "gd2", 1, &gdgen_engine, &gdgen_features_tc},
@@ -897,6 +899,7 @@ gvplugin_installed_t gvrender_gd_types[] = {
     {FORMAT_WBMP, "wbmp", 1, &gdgen_engine, &gdgen_features},
 #ifdef HAVE_GD_XPM
     {FORMAT_XBM, "xbm", 1, &gdgen_engine, &gdgen_features},
+#endif
 #endif
     {0, NULL, 0, NULL, NULL}
 };
index af3049636052c4e7a55e7240821baeb1a994ecf0..d81e5e0aeecb0458df484810ca89a0f83ef1a191 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include "gvplugin_textlayout.h"
 
+#ifdef HAVE_LIBGD
 #include "gd.h"
 
-/* FIXME - shouldn't need this */
-#include "types.h"
-
-#include "gvplugin_textlayout.h"
-
 /* fontsize at which text is omitted entirely */
 #define FONTSIZE_MUCH_TOO_SMALL 0.15
 /* fontsize at which text is rendered by a simple line */
@@ -96,7 +93,7 @@ char *gd_alternate_fontlist(char *font)
 #endif                         /* HAVE_GD_FONTCONFIG */
 }
 
-void textlayout(textline_t * textline, char *fontname, double fontsize, char **fontpath)
+void textlayout(textpara_t * para, char *fontname, double fontsize, char **fontpath)
 {
     static char *fntpath;
     char *fontlist, *err;
@@ -113,13 +110,13 @@ void textlayout(textline_t * textline, char *fontname, double fontsize, char **f
     else
        strex.flags |= gdFTEX_FONTCONFIG;
 
-    textline->dimen.x = 0.0;
-    textline->dimen.y = 0.0;
-    textline->xshow = NULL;
+    para->width = 0.0;
+    para->width = 0.0;
+    para->xshow = NULL;
 
     fontlist = gd_alternate_fontlist(fontname);
-    textline->layout = (void*)fontlist;
-    textline->free_layout = NULL; /* no need to free fontlist (??) */
+    para->layout = (void*)fontlist;
+    para->free_layout = NULL; /* no need to free fontlist (??) */
 
 
     if (fontlist) {
@@ -133,14 +130,14 @@ void textlayout(textline_t * textline, char *fontname, double fontsize, char **f
        }
        /* call gdImageStringFT with null *im to get brect and to set font cache */
        err = gdImageStringFTEx(NULL, brect, -1, fontlist,
-                               fontsize, 0, 0, 0, textline->str, &strex);
+                               fontsize, 0, 0, 0, para->str, &strex);
 
        if (err)
            return;
 
        if (strex.xshow) {
-           /* transfer malloc'ed xshow string to textline */
-           textline->xshow = strex.xshow;
+           /* transfer malloc'ed xshow string to para */
+           para->xshow = strex.xshow;
            strex.xshow = NULL;
        }
 
@@ -148,10 +145,10 @@ void textlayout(textline_t * textline, char *fontname, double fontsize, char **f
            free(fntpath);
        *fontpath = fntpath = strex.fontpath;
 
-       if (textline->str && textline->str[0]) {
+       if (para->str && para->str[0]) {
            /* can't use brect on some archtectures if strlen 0 */
-           textline->dimen.x = (double) (brect[4] - brect[0]);
-           textline->dimen.y = (double) (brect[5] - brect[1]);
+           para->width = (double) (brect[4] - brect[0]);
+           para->height = (double) (brect[5] - brect[1]);
        }
     }
 }
@@ -159,8 +156,11 @@ void textlayout(textline_t * textline, char *fontname, double fontsize, char **f
 gvtextlayout_engine_t textlayout_engine = {
     textlayout,
 };
+#endif
 
 gvplugin_installed_t gvtextlayout_gd_types[] = {
+#ifdef HAVE_LIBGD
     {0, "textlayout", 2, &textlayout_engine, NULL},
+#endif
     {0, NULL, 0, NULL, NULL}
 };
index 851674dc69df8f1f4befbf7db8440423d7d65b5d..a9b67eaf719893bf2f7fd44579a369aec0400577 100644 (file)
@@ -33,7 +33,7 @@ pdf_DATA = $(pdf)
 html_DATA = $(html)
 endif
 
-if !DISABLE_CODEGENS
+if WITH_CODEGENS
 CODEGENS = tkgen.c
 endif
 
index b1cc3fc14c4d5e705795351df1b892262eb162c9..45a3cc6855a62ff252a107512935a94c4cfe47a8 100644 (file)
@@ -50,7 +50,7 @@ extern void *GDHandleTable;
 extern int Gdtclft_Init(Tcl_Interp *);
 #endif
 
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
 extern codegen_t TK_CodeGen;
 static codegen_info_t cg[] = { {&TK_CodeGen, "tk", TK},
                                {NULL, NULL, 0}, };
@@ -1629,7 +1629,7 @@ __EXPORT__
 int Tcldot_Init(Tcl_Interp * interp)
 {
     GVC_t *gvc;
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     codegen_info_t *p;
 #endif
 
@@ -1659,7 +1659,7 @@ int Tcldot_Init(Tcl_Interp * interp)
 
     /* configure for available plugins and codegens */
     gvconfig(gvc, FALSE);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
     /* additional codegens */
     for (p = cg; p->name; ++p)
         gvplugin_install(gvc, API_render, p->name, 0, "cg", NULL,
index b2c8f7a1f9f78867f909df3daf595cb8787fe98a..2588e3f62462b516b4f9cea196326f3b4fc094d4 100644 (file)
@@ -385,9 +385,9 @@ static void tk_set_style(char **s)
     }
 }
 
-static void tk_textline(point p, textline_t * line)
+static void tk_textpara(point p, textpara_t * para)
 {
-    char *str = line->str;
+    char *str = para->str;
     double fontsz = cstk[SP].fontsz;
 
     tkgen_start_item("text");
@@ -397,7 +397,7 @@ static void tk_textline(point p, textline_t * line)
     if (cstk[SP].pencolor[0])
        tkgen_append_attribute("-fill", cstk[SP].pencolor);
     tkgen_append_attribute("-font", fontname);
-    switch (line->just) {
+    switch (para->just) {
     case 'l':
        tkgen_append_attribute("-anchor", "w");
        break;
@@ -545,7 +545,7 @@ codegen_t TK_CodeGen = {
     tk_begin_edge, 0,          /* tk_end_edge */
     tk_begin_context, tk_end_context,
     0, /* tk_begin_anchor */ 0,        /* tk_end_anchor */
-    tk_set_font, tk_textline,
+    tk_set_font, tk_textpara,
     tk_set_pencolor, tk_set_fillcolor, tk_set_style,
     tk_ellipse, tk_polygon,
     tk_bezier, tk_polyline,
index 57844fb8204ef72c3667fb2c152a0c67b709e2f1..02d619df504d9dfee142c890b6a1ac60996c94c5 100644 (file)
@@ -238,8 +238,8 @@ extern "C" {
 /* <stdlib.h> <stdarg.h> <string.h> <float.h> */
 #define STDC_HEADERS 1
 
-/* Set to 0 if you don't want the old codegens */
-#define ENABLE_CODEGENS 1
+/* Define to 1 if you the old codegens */
+#define WITH_CODEGENS 1
 
 /* Define if you don't want on-demand plugin loading */
 #define DISABLE_LTDL 1