123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593 |
- /*
- * Copyright 2021
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * These are the four essential freedoms with GNU GPL software:
- * 1: freedom to run the program, for any purpose
- * 2: freedom to study how the program works, and change it to make it do what you wish
- * 3: freedom to redistribute copies to help your Free Software friends
- * 4: freedom to distribute copies of your modified versions to your Free Software friends
- * , ,
- * / \
- * ((__-^^-,-^^-__))
- * `-_---' `---_-'
- * `--|o` 'o|--'
- * \ ` /
- * ): :(
- * :o_o:
- * "-"
- *
- * SPDX-License-Identifier: GPL-3.0+
- * License-Filename: LICENSE
- */
- /*
- * the dp*.c files are about DotParsing
- * and dpif.c is the interface to the rest of the program
- */
- #include "config.h"
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <time.h>
- #include <zlib.h>
- #include "splay-tree.h"
- #include "main.h"
- #include "hier.h"
- #include "dp.h"
- #include "dpun.h"
- #include "dpus.h"
- #include "dpif.h"
- #include "dpmisc.h"
- #include "lex.yy.h"
- #include "uniqstr.h"
- #include "uniqgraph.h"
- #include "dot.tab.h"
- #include "dpmem.h"
- #include "dphl.h"
- /* change \n \r \l \N chars */
- static char *dolabel(struct dpnode *node, char *str)
- {
- char *ret = NULL;
- char *res = NULL;
- char *res2 = NULL;
- char *p = NULL;
- char *p2 = NULL;
- char *q = NULL;
- int len = 0;
- int nn = 0;
- char *nname = NULL;
- if (str == NULL) {
- return (NULL);
- }
- len = strlen(str);
- if (len == 0) {
- /* fixme todo at "" return " " */
- return (" ");
- }
- if (len < 2) {
- return (uniqstr(str));
- }
- res = (char *)dp_calloc(1, (len + 1));
- p = str;
- q = res;
- while (*p) {
- if (*p == '\\') {
- if (*(p + 1) == 'n') {
- (*q) = '\n';
- q++;
- p++;
- p++;
- } else if (*(p + 1) == 'l') {
- (*q) = '\n';
- q++;
- p++;
- p++;
- } else if (*(p + 1) == 'r') {
- (*q) = '\n';
- q++;
- p++;
- p++;
- } else if (*(p + 1) == 'N') {
- /* first only count number of \N */
- nn++;
- (*q) = (*p);
- p++;
- q++;
- } else {
- (*q) = (*p);
- p++;
- q++;
- }
- } else {
- /* regular char */
- (*q) = (*p);
- p++;
- q++;
- }
- }
- /* translate \N nn times */
- if (nn) {
- if (node) {
- if (node->name == NULL) {
- /* shouldnothappen */
- printf("%s(): node %d name is (char *)0 and label is \"%s\"\n", __func__, node->nr, str);
- nname = "<nil-node-name>";
- } else {
- nname = node->name;
- }
- res2 = (char *)dp_calloc(1, ((len + 1) + (nn * strlen(nname))));
- /* substitute \N with node name */
- p = res;
- q = res2;
- while (*p) {
- if (*p == '\\') {
- if (*(p + 1) == 'N') {
- p2 = node->name;
- if (yydebug || 0) {
- printf("%s(): node name to substitute is \"%s\"\n", __func__, node->name);
- }
- while ((*p2)) {
- (*q) = (*p2);
- p2++;
- q++;
- }
- p++;
- p++;
- } else {
- (*q) = (*p);
- p++;
- q++;
- }
- } else {
- (*q) = (*p);
- p++;
- q++;
- }
- }
- ret = uniqstr(res2);
- res2 = dp_free(res2);
- if (res2) {
- }
- res = dp_free(res);
- if (res) {
- }
- } else {
- /* no node. then no node name. */
- ret = uniqstr(res);
- res = dp_free(res);
- if (res) {
- }
- }
- } else {
- /* no \N chars replaced */
- ret = uniqstr(res);
- res = dp_free(res);
- if (res) {
- }
- }
- return (ret);
- }
- /* */
- static void prrl(struct gml_rl *info, int prrlind)
- {
- int i = 0;
- if (info == NULL) {
- return;
- }
- for (i = 0; i < prrlind; i++) {
- printf(" ");
- }
- printf("hd=%d dir=%d `%s' `%s' nparts=%d\n", info->hd, info->dir, info->port, info->label, info->nparts);
- for (i = 0; i < info->nparts; i++) {
- prrlind++;
- prrl(info->parts[i], (prrlind + 1));
- prrlind--;
- }
- return;
- }
- /* copy record label data */
- static struct gml_rl *rlcopy(struct dppart *info)
- {
- struct gml_rl *nrec = NULL;
- int i = 0;
- if (info == NULL) {
- return (NULL);
- }
- nrec = (struct gml_rl *)dp_calloc(1, sizeof(struct gml_rl));
- /* number of sub parts can be 0 */
- nrec->hd = info->hd;
- nrec->nparts = info->ndpparts;
- nrec->dir = info->dir;
- nrec->port = uniqstr(info->id);
- nrec->label = uniqstr(info->lp);
- /* copy sub parts if any */
- if (info->ndpparts) {
- nrec->parts = (struct gml_rl **)dp_calloc(1, info->ndpparts * sizeof(struct gml_rl *));
- for (i = 0; i < info->ndpparts; i++) {
- nrec->parts[i] = rlcopy(info->parts[i]);
- }
- }
- return (nrec);
- }
- /* check number of elements actually */
- static void rlcheck(struct gml_rl *info)
- {
- int i = 0;
- int count = 0;
- count = 0;
- /* null value can happen */
- if (info == NULL) {
- return;
- }
- for (i = 0; i < info->nparts; i++) {
- if (info->parts[i]) {
- count++;
- rlcheck(info->parts[i]);
- }
- }
- info->nparts = count;
- return;
- }
- /* add subgraphs */
- static void sp_addsg_r(struct dpgraph *sg)
- {
- struct dpglink *eg = NULL;
- struct dpgraph *cursg = NULL;
- struct gml_graph *rg = NULL;
- struct gml_graph *cg = NULL;
- struct gml_glist *gl = NULL;
- if (sg == NULL) {
- return;
- }
- eg = sg->dpsubg;
- while (eg) {
- cursg = eg->sg;
- /* recurse into current subgraph */
- sp_addsg_r(cursg);
- if (cursg) {
- /* get graph of rooted-on and current subgraph */
- rg = uniqgraph(cursg->rootedon->nr);
- cg = uniqgraph(cursg->nr);
- if (rg && cg) {
- if (yydebug || 0) {
- printf
- ("%s(): subgraph %d `%s' is rooted on subgraph %d `%s'\n",
- __func__, cursg->nr, cursg->graphname, cursg->rootedon->nr, cursg->rootedon->graphname);
- }
- gl = dp_calloc(1, sizeof(struct gml_glist));
- /* set current graph as subgraph */
- gl->sg = cg;
- /* link the list of subgraphs */
- if (rg->subglist == NULL) {
- rg->subglist = gl;
- rg->subglistend = gl;
- } else {
- rg->subglistend->next = gl;
- rg->subglistend = gl;
- }
- } else {
- /* both rg and cg must be found */
- printf("%s(): rg=%p cg=%p shouldnothappen\n", __func__, (void *)rg, (void *)cg);
- }
- }
- eg = eg->next;
- }
- return;
- }
- /* create subgraphs */
- static void sp_crsg_r(struct dpgraph *sg)
- {
- struct dpglink *eg = NULL;
- struct dpgraph *cursg = NULL;
- int ttype = 0;
- char *stype = NULL;
- if (sg == NULL) {
- return;
- }
- eg = sg->dpsubg;
- while (eg) {
- cursg = eg->sg;
- /* recurse into current subgraph */
- sp_crsg_r(cursg);
- if (cursg) {
- switch (cursg->type) {
- case DP_SG_ROOT: /* 0 root graph type */
- stype = "root-subgraph";
- ttype = SG_ROOT;
- break;
- case DP_SG_CO: /* 1 compound subgraph {} */
- stype = "compound-subgraph";
- ttype = SG_COMPOUND;
- break;
- case DP_SG_NM: /* 2 named subgrph */
- stype = "named-subgraph";
- ttype = SG_SUBG;
- break;
- case DP_SG_CL: /* 3 cluster subgraph */
- stype = "cluster-subgraph";
- ttype = SG_CLUSTER;
- break;
- case DP_SG_NN: /* 4 no name subgraph */
- stype = "unnamed-subgraph";
- ttype = SG_SUBG;
- break;
- default:
- /* shouldnothappen */
- stype = "unknown";
- ttype = 0;
- break;
- }
- if (yydebug || 0) {
- printf("%s(): creating subgraph %d `%s' `%s' type %d %s\n",
- __func__, cursg->nr, cursg->graphname, cursg->label, ttype, stype);
- }
- create_sg(cursg->nr, uniqstr(cursg->graphname), uniqstr(cursg->label), ttype);
- }
- eg = eg->next;
- }
- return;
- }
- /* copy 1 html item */
- static struct gml_hitem *hlimakecopy(struct item *item, struct dpnode *node)
- {
- struct gml_hitem *ret = NULL;
- ret = dp_calloc(1, sizeof(struct gml_hitem));
- ret->text = NULL; /* text to display */
- ret->fontname = NULL; /* optional font */
- ret->fontsize = (-1); /* optional pointsize */
- ret->fontcolor = (-1); /* optional color of text */
- ret->ncolor = (-1); /* optional background color from <td> or <table> */
- /* set modified text if any */
- if (item->atext) {
- ret->text = uniqstr(item->atext);
- } else {
- ret->text = uniqstr(item->text);
- }
- if (yydebug || 0) {
- printf("%s(): copy \"%s\" bgcolor 0x%x\n", __func__, ret->text, item->ncolor);
- }
- /* set original text */
- ret->otext = uniqstr(item->text);
- /* set fontname if specified */
- if (item->fontname == NULL) {
- /* not specified */
- if (node->bitflags0.fontnameset) {
- ret->fontname = uniqstr(node->fontname);
- } else {
- /* not specified */
- ret->fontname = NULL;
- }
- } else {
- ret->fontname = uniqstr(item->fontname);
- }
- /* set fontsize if specified */
- if (item->fontsize < 0) {
- /* not specified */
- if (node->bitflags0.fontsizeset) {
- ret->fontsize = (int)node->fontsize;
- } else {
- /* not specified */
- ret->fontsize = 0;
- }
- } else {
- ret->fontsize = item->fontsize;
- }
- /* set fontcolor if specified */
- if (item->fontcolor < 0) {
- /* not specified */
- if (node->bitflags0.fontcolorset) {
- ret->fontcolor = node->fontcolor;
- } else {
- /* not specified default to black font color */
- ret->fontcolor = 0;
- }
- } else {
- ret->fontcolor = item->fontcolor;
- }
- /* set background color */
- if (item->ncolor < 0) {
- /* not specified */
- if (node->bitflags0.fcolorset) {
- /* fillcolor of node */
- ret->ncolor = node->fcolor;
- } else {
- /* not specified default white background color */
- ret->ncolor = 0x00ffffff;
- }
- } else {
- ret->ncolor = item->ncolor;
- }
- /* copy bitflags */
- if (item->bitflags.at) {
- /* set if str has a '&' */
- ret->bitflags.at = 1;
- }
- if (item->bitflags.br) {
- /* set if str is a <br/> token */
- ret->bitflags.br = 1;
- }
- if (item->bitflags.img) {
- /* set if str is a <img> */
- ret->bitflags.img = 1;
- }
- if (item->bitflags.b) {
- /* set if str is <b> bold */
- ret->bitflags.b = 1;
- }
- if (item->bitflags.i) {
- /* set if str is <i> italic */
- ret->bitflags.i = 1;
- }
- if (item->bitflags.u) {
- /* set if str is <u> underline */
- ret->bitflags.u = 1;
- }
- if (item->bitflags.o) {
- /* set if str is <o> overline */
- ret->bitflags.o = 1;
- }
- if (item->bitflags.s) {
- /* set if str is <s> strike-through */
- ret->bitflags.s = 1;
- }
- if (item->bitflags.sub) {
- /* set if str is <sub> subscript */
- ret->bitflags.sub = 1;
- }
- if (item->bitflags.sup) {
- /* set if str is <sup> superscript */
- ret->bitflags.sup = 1;
- }
- if (item->bitflags.hr) {
- /* set if str is a <hr> token */
- ret->bitflags.hr = 1;
- }
- if (item->bitflags.vr) {
- /* set if str is a <vr> token */
- ret->bitflags.vr = 1;
- }
- if (item->bitflags.table) {
- /* set if str is a <table> token */
- ret->bitflags.table = 1;
- if (item->table) {
- /* get the copied <table> */
- ret->table = item->table->alt;
- if (yydebug || 0) {
- printf("%s(): got table %p\n", __func__, (void *)ret->table);
- }
- } else {
- /* shouldnothappen */
- printf("%s(): nil table\n", __func__);
- }
- }
- return (ret);
- }
- /* */
- static void hlicopy_pr(struct gml_hl *h, struct dpnode *node)
- {
- struct gml_hilist *hil = NULL;
- struct gml_hitem *ph = NULL;
- int i = 1;
- if (h == NULL) { /* shouldnothappen */
- return;
- }
- if (node == NULL) { /* shoulnothappen */
- return;
- }
- printf("%s(): items in node \"%s\" \"%s\":\n", __func__, node->name, node->label);
- hil = h->il;
- while (hil) {
- ph = hil->items;
- if (ph) {
- printf(" item %d \"%s\"\n", i, ph->text);
- } else {
- printf(" item %d nil string\n", i);
- }
- i++;
- hil = hil->next;
- }
- printf("%s(): end of items in node \"%s\"\n", __func__, node->name);
- return;
- }
- /* copy html items list */
- static struct gml_hl *hlicopy(struct dpnode *node)
- {
- struct gml_hl *ret = NULL;
- struct ilist *il = NULL;
- struct gml_hilist *hil = NULL;
- struct hlpart *pp = NULL;
- if (node == NULL) {
- return (NULL);
- }
- ret = dp_calloc(1, sizeof(struct gml_hl));
- ret->mode = 0;
- pp = node->hlinfo;
- if (pp == NULL) {
- /* shouldnothappen */
- printf("%s(): nil hlinfo for node \"%s\"\n", __func__, node->name);
- return (ret);
- }
- il = pp->il;
- while (il) {
- if (il->items == NULL) {
- /* shouldnothappen */
- printf("%s(): nil item in node \"%s\" \"%s\"\n", __func__, node->name, node->label);
- } else {
- hil = dp_calloc(1, sizeof(struct gml_hilist));
- /* create copy of html item */
- hil->items = hlimakecopy(il->items, node);
- /* link in */
- if (ret->il == NULL) {
- ret->il = hil;
- ret->ilend = hil;
- } else {
- ret->ilend->next = hil;
- ret->ilend = hil;
- }
- }
- il = il->next;
- }
- /* print the item data */
- if (yydebug || 0) {
- hlicopy_pr(ret, node);
- }
- return (ret);
- }
- /* zzz */
- /* copy html tables list */
- static struct gml_htlist *hltcopy_r(struct tlist *tl, struct gml_htlist *htl, struct dpnode *node)
- {
- struct trlist *trptr = NULL;
- struct tlist *tlptr = NULL; /* list of table items */
- struct tdldata *tdptr = NULL; /* td items in tr */
- struct ilist *ilptr = NULL;
- struct gml_titem *tinew = NULL;
- struct gml_htlist *tlnew = NULL; /* list of sub table items */
- struct gml_tritemlist *tritemlistnew = NULL;
- struct gml_tritem *tritemnew = NULL;
- struct gml_tditem *tditemnew = NULL;
- struct gml_hilist *hilistnew = NULL;
- int numtr = 0;
- int numtd = 0;
- if (htl == NULL) {
- return (NULL);
- }
- if (tl->titem == NULL) {
- return (NULL);
- }
- if (tl->titem->tabdata == NULL) {
- return (NULL);
- }
- /* new gml table data */
- tinew = dp_calloc(1, sizeof(struct gml_titem));
- /* set the alt tbel in dp table data */
- tl->titem->tabdata->alt = tinew;
- htl->titem = tinew;
- /* first copy sub tables if any */
- if (tl->titem->tabdata->tl) {
- tlptr = tl->titem->tabdata->tl;
- while (tlptr) {
- /* */
- tlnew = (struct gml_htlist *)dp_calloc(1, sizeof(struct gml_htlist));
- tlnew = hltcopy_r(tlptr, tlnew, node);
- if (tlnew == NULL) { /* shouldnothappen */
- return (NULL);
- }
- if (tlnew->titem) {
- /* */
- if (htl->titem->tl == NULL) {
- htl->titem->tl = tlnew;
- htl->titem->tlend = tlnew;
- } else {
- htl->titem->tlend->next = tlnew;
- htl->titem->tlend = tlnew;
- }
- }
- tlptr = tlptr->next;
- }
- }
- /* copy the <tr> data if any */
- if (tl->titem->tabdata->tr) {
- numtr = 0;
- trptr = tl->titem->tabdata->tr;
- while (trptr) {
- tritemlistnew = dp_calloc(1, sizeof(struct gml_tritemlist));
- /* if there are <tr> items */
- if (trptr->tritem) {
- /* are there <td> in <tr> */
- if (trptr->tritem->td) {
- tritemnew = dp_calloc(1, sizeof(struct gml_tritem));
- tritemlistnew->tritem = tritemnew;
- /* set if <tr> has a <td> with a <table> */
- tritemnew->hastab = trptr->tritem->hastab;
- numtd = 0;
- tdptr = trptr->tritem->td;
- while (tdptr) {
- /* if actual <td> data */
- if (tdptr->tdd) {
- /* a <td> can have no items as in <td></td> then do not copy data */
- /* il list in <td> */
- if (tdptr->tdd->il) {
- tditemnew = dp_calloc(1, sizeof(struct gml_tditem));
- /* set if <td> is a <table> */
- tditemnew->istab = tdptr->tdd->istab;
- /* copy the il data */
- ilptr = tdptr->tdd->il;
- while (ilptr) {
- hilistnew = dp_calloc(1, sizeof(struct gml_hilist));
- hilistnew->items = hlimakecopy(ilptr->items, node);
- if (yydebug || 0) {
- printf("%s(): copy item \"%s\" bgcolor 0x%x\n",
- __func__, ilptr->items->text, ilptr->items->ncolor);
- }
- /* set which <table> this item is part of */
- hilistnew->items->rootedon = tinew;
- if (tditemnew->il == NULL) {
- tditemnew->il = hilistnew;
- tditemnew->ilend = hilistnew;
- } else {
- tditemnew->ilend->next = hilistnew;
- tditemnew->ilend = hilistnew;
- }
- ilptr = ilptr->next;
- }
- /* */
- /* set <table> of this <td> */
- tditemnew->rootedon = tinew;
- /* set data from input */
- tditemnew->bgcolor = tdptr->tdd->bgcolor; /* ="colorname" */
- tditemnew->border = tdptr->tdd->border; /* ="int-value" */
- tditemnew->cellpadding = tdptr->tdd->cellpadding; /* ="int-value" */
- tditemnew->cellspacing = tdptr->tdd->cellspacing; /* ="int-value" */
- tditemnew->color = tdptr->tdd->color; /* ="colorname" */
- tditemnew->colspan = tdptr->tdd->colspan; /* ="int-value" */
- tditemnew->height = tdptr->tdd->height; /* ="int-value" */
- tditemnew->rowspan = tdptr->tdd->rowspan; /* ="int-value" */
- tditemnew->width = tdptr->tdd->width; /* ="int-value" */
- /* */
- if (tritemnew->tdi == NULL) {
- tritemnew->tdi = tditemnew;
- tritemnew->tdiend = tditemnew;
- } else {
- tritemnew->tdiend->next = tditemnew;
- tritemnew->tdiend = tditemnew;
- }
- /* */
- numtd++;
- }
- }
- /* */
- tdptr = tdptr->next;
- }
- /* */
- if (yydebug || 0) {
- printf("%s(): %d <td> in <tr>\n", __func__, numtd);
- }
- /* set number of <td> in this <tr> */
- tritemnew->numtd = numtd;
- /* set <table> of this <tr> */
- tritemnew->rootedon = tinew;
- /* */
- }
- }
- /* */
- if (htl->titem->tr == NULL) {
- htl->titem->tr = tritemlistnew;
- htl->titem->trend = tritemlistnew;
- } else {
- htl->titem->trend->next = tritemlistnew;
- htl->titem->trend = tritemlistnew;
- }
- /* */
- numtr++; /* update count of <tr> in this <table> */
- trptr = trptr->next;
- }
- htl->titem->numtr = numtr;
- }
- /* copy input parms from <table> */
- htl->titem->bgcolor = tl->titem->tabdata->bgcolor; /* background color */
- htl->titem->color = tl->titem->tabdata->color; /* fontcolor */
- htl->titem->cellborder = tl->titem->tabdata->cellborder; /* ="int-value" */
- htl->titem->cellpadding = tl->titem->tabdata->cellpadding; /* ="int-value" */
- htl->titem->cellspacing = tl->titem->tabdata->cellspacing; /* ="int-value" */
- htl->titem->height = tl->titem->tabdata->height; /* ="int-value" */
- htl->titem->width = tl->titem->tabdata->width; /* ="int-value" */
- return (htl);
- }
- /* copy html tables list */
- static struct gml_hl *hltcopy(struct dpnode *node)
- {
- struct gml_hl *ret = NULL;
- struct tlist *tl = NULL; /* list of table items */
- struct gml_htlist *tlnew = NULL; /* list of sub table items */
- struct gml_htlist *tlnew2 = NULL; /* list of sub table items */
- if (node->hlinfo == NULL) {
- /* shouldnothappen */
- return (NULL);
- }
- if (node->hlinfo->tl == NULL) {
- /* shouldnothappen */
- return (NULL);
- }
- ret = dp_calloc(1, sizeof(struct gml_hl));
- /* this is table data */
- ret->mode = 1;
- /* scan the tables */
- tl = node->hlinfo->tl;
- if (yydebug || 0) {
- printf("%s(): node \"%s\" node->hlinfo=%p node->hlinfo->tl=%p\n", __func__, node->name, (void *)node->hlinfo, (void *)tl);
- }
- while (tl) {
- tlnew = dp_calloc(1, sizeof(struct gml_htlist));
- tlnew2 = hltcopy_r(tl, tlnew, node);
- if (tlnew2) {
- if (ret->tl == NULL) {
- ret->tl = tlnew2;
- ret->tlend = tlnew2;
- } else {
- ret->tlend->next = tlnew2;
- ret->tlend = tlnew2;
- }
- } else {
- /* shouldnothappen */
- tlnew = dp_free(tlnew);
- if (tlnew) {
- }
- }
- tl = tl->next;
- }
- return (ret);
- }
- /* */
- static void dpif_pr_out_sp(int ind)
- {
- int i = 0;
- for (i = 0; i < ind; i++) {
- printf(" ");
- }
- return;
- }
- /* */
- static void dpif_pr_out_t_r(struct gml_htlist *tl, int ind, int tabnum)
- {
- struct gml_htlist *tlptr = NULL; /* list of table items */
- struct gml_htlist *tlptrnext = NULL; /* list of table items */
- int nts = 0;
- if (tl == NULL) {
- /* shouldnothappen */
- return;
- }
- nts = tabnum;
- dpif_pr_out_sp(ind);
- printf("<table>[%d]\n", tabnum);
- if (tl->titem == NULL) {
- printf("%s(): tl->titem is nil\n", __func__);
- /* shouldnothappen */
- return;
- }
- if (0) {
- printf("%s(): tl->titem->tl=%p\n", __func__, (void *)tl->titem->tl);
- }
- /* sub tables if any */
- if (tl->titem->tl) {
- tlptr = tl->titem->tl;
- while (tlptr) {
- tlptrnext = tlptr->next;
- dpif_pr_out_t_r(tlptr, (ind + 2), nts);
- nts++;
- tlptr = tlptrnext;
- }
- }
- /* <tr> data if any */
- if (tl->titem->tr) {
- dpif_pr_out_sp(ind);
- printf("has %d <tr>\n", tl->titem->numtr);
- }
- return;
- }
- /* print list data if any */
- static void dpif_pr_out_tl(struct gml_hl *hl, struct dpnode *node)
- {
- struct gml_htlist *tlptr; /* list of table items */
- struct gml_htlist *tlptrnext; /* list of table items */
- printf("%s(): copied table data of node\"%s\" with hl=%p\n", __func__, node->name, (void *)hl);
- if (hl == NULL) {
- return;
- }
- if (hl->tl == NULL) {
- printf("%s(): html table data is nil at node \"%s\"\n", __func__, node->name);
- return;
- }
- tlptr = hl->tl;
- while (tlptr) {
- tlptrnext = tlptr->next;
- dpif_pr_out_t_r(tlptr, 0, 1);
- tlptr = tlptrnext;
- }
- printf("%s(): end copied table data of node\"%s\"\n", __func__, node->name);
- return;
- }
- /* */
- static void dpif_pr_in_sp(int ind)
- {
- int i = 0;
- for (i = 0; i < ind; i++) {
- printf(" ");
- }
- return;
- }
- /* */
- static void dpif_pr_in_1il(struct ilist *ildata, int ind, int tinum)
- {
- char *iltext = NULL;
- if (ildata == NULL) {
- return;
- }
- dpif_pr_in_sp(ind);
- printf("<item>[%d]\n", tinum);
- if (ildata->items == NULL) {
- printf("%s(): ildata->items is nil\n", __func__);
- return;
- }
- if (ildata->items->text == NULL) {
- if (ildata->items->bitflags.br) {
- /* set if str is a <br/> token */
- iltext = "<br/>";
- } else if (ildata->items->bitflags.img) {
- /* set if str is a <img> */
- iltext = "<img>";
- } else if (ildata->items->bitflags.i) {
- /* set if str is <i> italic */
- iltext = "<i>";
- } else if (ildata->items->bitflags.u) {
- /* set if str is <u> underline */
- iltext = "<u>";
- } else if (ildata->items->bitflags.o) {
- /* set if str is <o> overline */
- iltext = "<o>";
- } else if (ildata->items->bitflags.s) {
- /* set if str is <s> strike-through */
- iltext = "<s>";
- } else if (ildata->items->bitflags.sub) {
- /* set if str is <sub> subscript */
- iltext = "<sub>";
- } else if (ildata->items->bitflags.sup) {
- /* set if str is <sup> superscript */
- iltext = "<sump>";
- } else if (ildata->items->bitflags.hr) {
- /* set if str is a <hr> token */
- iltext = "<hr>";
- } else if (ildata->items->bitflags.vr) {
- /* set if str is a <vr> token */
- iltext = "<vr>";
- } else if (ildata->items->bitflags.b) {
- /* set if str is <b> bold */
- iltext = "<b>";
- } else if (ildata->items->bitflags.table) {
- /* set if str is <table> */
- iltext = "<table>";
- } else {
- iltext = "unknown ildata->items->bitflags";
- }
- } else {
- iltext = ildata->items->text;
- }
- dpif_pr_in_sp(ind + 2);
- printf("\"%s\"\n", iltext);
- return;
- }
- /* free ilist */
- static void dpif_pr_in_il(struct tdldata *td, int ind, int tdnum)
- {
- struct ilist *ilptr = NULL; /* text items in td or 0 */
- struct ilist *ilptrnext = NULL; /* text items in td or 0 */
- int nti = 0;
- if (td == NULL) {
- return;
- }
- dpif_pr_in_sp(ind);
- printf("<td>[%d]\n", tdnum);
- if (td->tdd == NULL) {
- printf("%s(): td->tdd is nil\n", __func__);
- return;
- }
- if (td->tdd->il == NULL) {
- printf("%s(): td->tdd->il is nil\n", __func__);
- }
- nti++;
- ilptr = td->tdd->il;
- while (ilptr) {
- ilptrnext = ilptr->next;
- /* print 1 il */
- dpif_pr_in_1il(ilptr, (ind + 2), nti);
- ilptr = ilptrnext;
- }
- return;
- }
- /* free <tr> */
- static void dpif_pr_in_tr(struct trlist *tr, int ind, int trnum)
- {
- struct tdldata *tdlptr = NULL; /* td items in tr */
- struct tdldata *tdlptrnext = NULL;
- int ntd = 0;
- if (tr == NULL) {
- return;
- }
- dpif_pr_in_sp(ind);
- printf("<tr>[%d]\n", trnum);
- if (tr->tritem == NULL) {
- printf("%s(): tr->tritem is nil\n", __func__);
- return;
- }
- if (tr->tritem->td == NULL) {
- printf("%s(): tr->tritem->td is nil\n", __func__);
- return;
- }
- ntd++;
- /* <td> data */
- tdlptr = tr->tritem->td;
- while (tdlptr) {
- tdlptrnext = tdlptr->next;
- dpif_pr_in_il(tdlptr, (ind + 2), ntd);
- ntd++;
- tdlptr = tdlptrnext;
- }
- return;
- }
- /* */
- static void dpif_pr_in_t_r(struct tlist *tl, int ind, int tabnum)
- {
- struct tlist *tlptr = NULL; /* list of table items */
- struct tlist *tlptrnext = NULL; /* list of table items */
- struct trlist *trptr = NULL; /* tr items */
- struct trlist *trptrnext = NULL; /* end tr items */
- int ntr = 0;
- int nts = 0;
- if (tl == NULL) {
- /* shouldnothappen */
- return;
- }
- nts = tabnum;
- dpif_pr_in_sp(ind);
- printf("<table>[%d]\n", tabnum);
- if (tl->titem == NULL) {
- printf("%s(): tl->titem is nil\n", __func__);
- /* shouldnothappen */
- return;
- }
- if (tl->titem->tabdata == NULL) {
- printf("%s(): tl->titem->tabdata is nil\n", __func__);
- return;
- }
- /* sub tables if any */
- if (tl->titem->tabdata->tl) {
- tlptr = tl->titem->tabdata->tl;
- while (tlptr) {
- tlptrnext = tlptr->next;
- dpif_pr_in_t_r(tlptr, (ind + 2), nts);
- nts++;
- tlptr = tlptrnext;
- }
- }
- /* <tr> data */
- if (tl->titem->tabdata->tr == NULL) {
- printf("%s(): tl->titem->tabdata->tr is nil\n", __func__);
- return;
- }
- ntr++;
- trptr = tl->titem->tabdata->tr;
- while (trptr) {
- trptrnext = trptr->next;
- dpif_pr_in_tr(trptr, (ind + 2), ntr);
- ntr++;
- trptr = trptrnext;
- }
- return;
- }
- /* print list data if any */
- static void dpif_pr_in_tl(struct dpnode *node)
- {
- struct tlist *tlptr; /* list of table items */
- struct tlist *tlptrnext; /* list of table items */
- if (node->hlinfo == NULL) {
- return;
- }
- if (node->hlinfo->tl == NULL) {
- printf("%s(): input html table data is nil at node \"%s\"\n", __func__, node->name);
- return;
- }
- printf("%s(): input html table data from node \"%s\" is:\n", __func__, node->name);
- tlptr = node->hlinfo->tl;
- while (tlptr) {
- tlptrnext = tlptr->next;
- dpif_pr_in_t_r(tlptr, 0, 1);
- tlptr = tlptrnext;
- }
- printf("%s(): input html table data end from node \"%s\"\n", __func__, node->name);
- return;
- }
- /* return node name with rand() chars */
- static char *dp_randnname(void)
- {
- char *ret = NULL;
- char buf[9];
- int i = 0;
- int count = 0;
- int rn = 0;
- struct dpnode *n = NULL;
- for (count = 0; count < 10; count++) {
- memset(buf, 0, 9);
- for (i = 0; i < 8; i++) {
- rn = (rand() & 0x07);
- if (rand() & 0x01) {
- buf[i] = ('a' + rn);
- } else {
- buf[i] = ('0' + rn);
- }
- }
- n = dpuniqnode(buf);
- if (n == NULL) {
- break;
- }
- }
- if (n) {
- return (NULL);
- }
- ret = dp_uniqstr(buf);
- return (ret);
- }
- /* parse dot file, 0 return if oke. */
- int dotparse(struct gml_graph *g, gzFile f, char *fname, char *argv0)
- {
- struct dpnlink *nss = NULL;
- struct dpnode *node = NULL;
- struct dpelink *es = NULL;
- struct dpedge *edge = NULL;
- struct gml_rl *rl = NULL;
- struct gml_hl *hl = NULL;
- struct gml_graph *ro = NULL;
- int foundsource = 0;
- int foundtarget = 0;
- int foundid = 0;
- char *nodelabel = NULL;
- char *nodename = NULL;
- int ncolor = 0;
- int nbcolor = 0;
- char *elabel = NULL;
- int econstraint = 0;
- int status = 0;
- int ecolor = 0;
- int style = 0;
- int bgcolor = 0x00ffffff; /* default white node background */
- int fontcolor = 0; /* default black text color */
- char *fc = NULL;
- char *tc = NULL;
- int nr = 0;
- int ishtml = 0;
- int nodehasrootname = 0;
- if (g) {
- }
- if (fname) {
- }
- yydebug = 0;
- /* optional turn on debug */
- if (argv0) {
- if (strcmp(argv0, "gml4gtkd") == 0) {
- yydebug = 1;
- }
- }
- /* static buffer for parser error message */
- memset(parsermessage, 0, 256);
- memset(dp_errmsg, 0, 256);
- dp_lex_init(f, yydebug);
- /* run bison */
- status = yyparse();
- if (yydebug || 0) {
- printf("%s(): status %d `%s' for dot file `%s'\n", __func__, status, dp_errmsg, fname);
- fflush(stdout);
- }
- dp_lex_deinit();
- if (strlen(dp_errmsg)) {
- strncpy(parsermessage, dp_errmsg, (256 - 1));
- /* set error status */
- status = 1;
- dp_clearall();
- fflush(stdout);
- fflush(stderr);
- return (status);
- }
- /* check data parsed and handle record labels */
- status = dp_datachk();
- if (status) {
- strncpy(parsermessage, dp_errmsg, (256 - 1));
- /* set error status */
- status = 1;
- dp_clearall();
- fflush(stdout);
- fflush(stderr);
- return (status);
- }
- /* create copy of subgraphs */
- sp_crsg_r(dp_groot);
- /* add subgraphs to root graph */
- sp_addsg_r(dp_groot);
- /* list with all nodes */
- nss = dp_anodes;
- while (nss) {
- /* get node data */
- node = nss->n;
- /* graph where node is located */
- ro = uniqgraph(nss->n->root->nr);
- /* count how many nodes have a subgraph with actual name */
- if (ro->label) {
- if (strlen(ro->label)) {
- nodehasrootname++;
- }
- }
- /* node number as in gml graph
- * node->nr;
- * using -1 does not apply the gml id check
- */
- foundid = (-1);
- nodename = node->name;
- /* check if html label */
- if (nss->n->htmllabel) {
- ishtml = 1;
- } else {
- ishtml = 0;
- /* translate \n \r \l \N chars */
- nodelabel = dolabel(nss->n, nss->n->label);
- }
- /* node fill color white and bordercolor black */
- ncolor = 0x00ffffff;
- nbcolor = 0;
- fontcolor = 0;
- /* color for text label */
- if (node->bitflags0.fontcolorset) {
- fontcolor = node->fontcolor;
- }
- if (node->bitflags0.fcolorset || node->bitflags0.colorset) {
- if (node->bitflags1.filled) {
- /* style is filled */
- if (node->bitflags0.fcolorset && node->bitflags0.colorset) {
- ncolor = node->fcolor;
- nbcolor = node->color;
- } else if (node->bitflags0.fcolorset && node->bitflags0.colorset == 0) {
- ncolor = node->fcolor;
- nbcolor = 0;
- } else if (node->bitflags0.fcolorset == 0 && node->bitflags0.colorset) {
- ncolor = node->color;
- nbcolor = node->color;
- } else {
- ncolor = 0x00a9a9a9;
- nbcolor = 0;
- }
- } else {
- /* not style is filled */
- if (node->bitflags0.fcolorset && node->bitflags0.colorset) {
- ncolor = 0x00ffffff;
- nbcolor = node->color;
- } else if (node->bitflags0.fcolorset && node->bitflags0.colorset == 0) {
- ncolor = 0x00ffffff;
- nbcolor = 0;
- } else if (node->bitflags0.fcolorset == 0 && node->bitflags0.colorset) {
- ncolor = 0x00ffffff;
- nbcolor = node->color;
- } else {
- ncolor = 0x00ffffff;
- nbcolor = 0;
- }
- }
- } else {
- /* no colors specified, but style=filled, then grey node */
- if (node->bitflags1.filled) {
- ncolor = 0x00a9a9a9;
- nbcolor = 0;
- }
- }
- /* record or html data */
- rl = NULL;
- hl = NULL;
- /* this is a html label */
- if (ishtml == 1 && nss->n->hlinfo == NULL) {
- /* shouldnothappen */
- printf("%s(): ishtml is 1 but ns->n->hlinfo=%p for node \"%s\"\n", __func__, (void *)nss->n->hlinfo, nss->n->name);
- }
- if (nss->n->hlinfo) {
- if (yydebug || 0) {
- printf("%s(): before-copy node \"%s\" mode=%d hlinfo=%p il=%p tl=%p\n", __func__,
- node->name, nss->n->hlinfo->mode, (void *)nss->n->hlinfo,
- (void *)nss->n->hlinfo->il, (void *)nss->n->hlinfo->tl);
- }
- /* this is a html label */
- if (ishtml == 0) {
- /* shouldnothappen */
- printf("%s(): ishtml is 0 but ns->n->hlinfo=%p\n", __func__, (void *)nss->n->hlinfo);
- }
- /* create copy of html items or tables */
- if (nss->n->hlinfo->mode == 0) {
- /* html items list */
- hl = hlicopy(nss->n);
- ishtml = 1;
- } else if (nss->n->hlinfo->mode == 1) {
- /* html tables list rooted on basis */
- /* print input html table data */
- if (yydebug || 0) {
- dpif_pr_in_tl(nss->n);
- }
- /* html tables not-yet supported */
- hl = hltcopy(nss->n);
- if (yydebug || 0) {
- dpif_pr_out_tl(hl, nss->n);
- }
- if (nss->n->name == NULL) {
- /* shouldnothappen */
- nss->n->name = uniqstr("nil-node-name");
- }
- } else {
- printf("%s(): wrong html mode %d for node \"%s\"\n", __func__, nss->n->hlinfo->mode, nss->n->name);
- }
- } else if (nss->n->labelinfo) {
- /* this is a record label */
- if (nss->n->shape == DPSHAPE_RECORD || nss->n->shape == DPSHAPE_MRECORD) {
- /* can also be html label */
- if (ishtml) {
- /* todo copy html info in record hape */
- if (nss->n->labelinfo) {
- }
- printf("%s(): html in record node not yet supported ns->n->labelinfo=%p\n", __func__,
- (void *)nss->n->labelinfo);
- } else {
- if (nss->n->labelinfo) {
- rl = rlcopy(nss->n->labelinfo);
- rlcheck(rl);
- }
- }
- } else {
- /* this is not a record shape */
- if (nss->n->labelinfo) {
- printf("%s(): ns->n->labelinfo=%p should be 0\n", __func__, (void *)nss->n->labelinfo);
- }
- rl = NULL;
- }
- } else {
- /* not html label, not record label, but other label */
- }
- /* print record label data */
- if (yydebug) {
- if (rl) {
- printf("%s(): record label data for node \"%s\" is:\n", __func__, nss->n->name);
- prrl(rl, 0);
- printf("%s(): end of record label data for node \"%s\"\n", __func__, nss->n->name);
- }
- /* if html, print html label */
- }
- /* uniq node number starting at 1 */
- maingraph->nodenum++;
- nr = maingraph->nodenum;
- add_new_node(g, ro, nr, foundid, nodename, nodelabel, ncolor, nbcolor, rl, hl, fontcolor, ishtml);
- /* free dphl data at html label if any */
- if (hl) {
- dphl_freemem();
- }
- /* to next node. */
- nss = nss->next;
- }
- /* all edges */
- es = dp_aedges;
- /* ishtml is set if edge label is a html label
- * todo not implemented yet
- */
- ishtml = 0;
- while (es) {
- edge = es->e;
- /* graph where edge is located */
- ro = uniqgraph(es->e->rootedon->nr);
- if (edge->dir == DP_DIR_BACK) {
- /* backward edge */
- foundsource = edge->tn->nr;
- foundtarget = edge->fn->nr;
- } else {
- /* regular edge */
- foundsource = edge->fn->nr;
- foundtarget = edge->tn->nr;
- }
- /* update in/outdegree of nodes */
- if (edge->dir == DP_DIR_BACK) {
- /* backward edge */
- edge->fn->indegree++;
- edge->tn->outdegree++;
- } else {
- /* regular edge */
- edge->fn->outdegree++;
- edge->tn->indegree++;
- }
- if (edge->bitflags0.constraint) {
- econstraint = 1;
- } else {
- econstraint = 0;
- }
- /* econstraint is normally 1 */
- /* todo html record label support for edge label
- * parse label here in components and copy data
- * add as param in add_new_edge()
- */
- /* transform \n \l \r chars */
- elabel = dolabel(NULL, edge->label);
- /* check if html <> string */
- if (elabel) {
- if (strlen(elabel)) {
- /* todo edge html labels */
- elabel = uniqstr(elabel);
- } else {
- /* edgelabel "" is same as no-edge-label */
- elabel = NULL;
- }
- }
- /* at self-edge the edge color is put in the node ecolor
- * if(edge->fn==edge->tn) this is a self-edge
- */
- ecolor = edge->ecolor;
- /* edge line style */
- style = edge->style;
- fc = uniqstr(edge->fcompass);
- tc = uniqstr(edge->tcompass);
- /* in hier.c copy to the layouter */
- add_new_edge(g, ro, foundsource, foundtarget, elabel, ecolor, style, fc, tc, econstraint, ishtml);
- es = es->next;
- }
- /* todo this is a way to add graph name but should be different */
- if (1) {
- /* add artificial node for starter nodes when the rooted
- * subgraph cluster has a label and add edge to startnode.
- * this is needed for gcc rtl/tree/ipa data
- */
- if (nodehasrootname) {
- /* init rand() */
- srand((unsigned int)time(NULL));
- /* list with all nodes */
- nss = dp_anodes;
- while (nss) {
- /* get node data */
- node = nss->n;
- /* check the starter nodes */
- if ((node->indegree == 0) && (node->outdegree != 0)) {
- if (node->root) {
- if (node->root->label) {
- if (strlen(node->root->label)) {
- /* todo html label for subgraph labels */
- if (yydebug || 0) {
- printf
- ("%s(): node \"%s\" is rooted in cluster with label \"%s\" and adding artificial node\n",
- __func__, node->name, node->root->label);
- }
- /* this node is a starter node with cluster label
- * now add artifical node with cluster label
- * add edge from artificial node to this node
- */
- /* graph where node is located */
- ro = uniqgraph(node->root->nr);
- /* node name with rand() chars */
- nodename = dp_randnname();
- if (yydebug || 0) {
- printf
- ("%s(): generating artificial startnode \"%s\" to point to node \"%s\"\n",
- __func__, nodename, node->name);
- }
- /* set cluster label as node label */
- nodelabel = dolabel(NULL, node->root->label);
- /* node fill color white and bordercolor black */
- ncolor = 0x00ffffff;
- nbcolor = 0;
- fontcolor = 0;
- /* record or html data is currently not supported in cluster labels */
- rl = NULL;
- hl = NULL;
- ishtml = 0;
- /* uniq node number starting at 1 */
- maingraph->nodenum++;
- nr = maingraph->nodenum;
- /* node number as in gml graph
- * using -1 does not apply the gml id check.
- */
- foundid = (-1);
- add_new_node(g, ro, nr, foundid, nodename, nodelabel, ncolor, nbcolor, rl, hl, fontcolor, ishtml);
- /* add edge from artifical node to startnode */
- /* regular edge */
- foundsource = maingraph->nodenum;
- foundtarget = node->nr;
- econstraint = 1;
- elabel = NULL;
- ishtml = 0;
- ecolor = 0;
- style = 0;
- fc = NULL;
- tc = NULL;
- /* graph where edge is located */
- ro = uniqgraph(node->root->nr);
- add_new_edge(g, ro, foundsource, foundtarget, elabel, ecolor, style, fc, tc, econstraint, ishtml);
- }
- }
- }
- }
- nss = nss->next;
- }
- }
- } /* if(1) */
- /* background r/g/b of drawing */
- if (dp_groot) {
- bgcolor = dp_groot->bgcolor;
- bgcr = (bgcolor & 0x00ff0000) >> 16;
- bgcg = (bgcolor & 0x0000ff00) >> 8;
- bgcb = (bgcolor & 0x000000ff);
- } else {
- /* white */
- bgcr = 0xff;
- bgcg = 0xff;
- bgcb = 0xff;
- }
- /* */
- dp_clearall();
- fflush(stdout);
- fflush(stderr);
- return (status);
- }
- /* end */
|