~ubuntu-branches/ubuntu/lucid/graphviz/lucid-updates

« back to all changes in this revision

Viewing changes to lib/cgraph/write.c

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2008-06-19 20:23:23 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080619202323-ls23h96ntj9ny94m
Tags: 2.18-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Build depend on liblualib50-dev instead of liblua5.1-0-dev.
  - Drop libttf-dev (libttf-dev is in universe) (LP: #174749).
  - Replace gs-common with ghostscript.
  - Build-depend on python-dev instead of python2.4-dev or python2.5-dev.
  - Mention the correct python version for the python bindings in the
    package description.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: write.c,v 1.2 2007/11/09 18:09:46 erg Exp $ $Revision: 1.2 $ */
 
1
/* $Id: write.c,v 1.4 2008/03/04 17:54:53 arif Exp $ $Revision: 1.4 $ */
2
2
/* vim:set shiftwidth=4 ts=8: */
3
3
 
4
4
/**********************************************************
21
21
#define EMPTY(s)                ((s == 0) || (s)[0] == '\0')
22
22
#define MAX(a,b)     ((a)>(b)?(a):(b))
23
23
 
 
24
#ifdef WIN32
 
25
extern int strcasecmp(const char *s1, const char *s2);
 
26
extern int strncasecmp(const char *s1, const char *s2, unsigned int n);
 
27
#endif
 
28
 
 
29
 
24
30
typedef void iochan_t;
25
31
 
26
32
static void ioput(Agraph_t * g, iochan_t * ofile, char *str)
258
264
    ioput(g, ofile, "{\n");
259
265
    Level++;
260
266
    write_dicts(g, ofile);
261
 
    AGATTRWF(g) = NOT(AGATTRWF(g));
 
267
        AGATTRWF(g) = TRUE;
262
268
}
263
269
 
264
270
static void write_trl(Agraph_t * g, iochan_t * ofile)
425
431
        ioput(g, ofile, "]");
426
432
        Level--;
427
433
    }
428
 
    AGATTRWF((Agobj_t *) obj) = NOT(AGATTRWF((Agobj_t *) obj));
 
434
    AGATTRWF((Agobj_t *) obj) = TRUE;
429
435
}
430
436
 
431
437
static void write_nodename(Agnode_t * n, iochan_t * ofile)
445
451
 
446
452
static int attrs_written(void *obj)
447
453
{
448
 
    return NOT(AGATTRWF((Agobj_t *) obj) == Attrs_not_written_flag);
 
454
    return (AGATTRWF((Agobj_t *) obj));
449
455
}
450
456
 
451
457
static void write_node(Agnode_t * n, iochan_t * ofile, Dict_t * d)
560
566
    }
561
567
}
562
568
 
 
569
static void set_attrwf(Agraph_t *g, int toplevel, int value)
 
570
{
 
571
    Agraph_t *subg;
 
572
        Agnode_t *n;
 
573
        Agedge_t *e;
 
574
 
 
575
    AGATTRWF(g) = value;
 
576
    for (subg = agfstsubg(g); subg; subg = agnxtsubg(subg)) {
 
577
        set_attrwf(subg, FALSE, value);
 
578
    }
 
579
    if (toplevel) {
 
580
        for (n = agfstnode(g); n; n = agnxtnode(g,n)) {
 
581
        AGATTRWF(n) = value;
 
582
        for (e = agfstout(g,n); e; e = agnxtout(g,e))
 
583
            AGATTRWF(e) = value;
 
584
        }
 
585
    }
 
586
}
 
587
 
563
588
int agwrite(Agraph_t * g, void *ofile)
564
589
{
565
590
    Level = 0; /* re-initialize tab level */
 
591
    set_attrwf(g,TRUE,FALSE);
566
592
    write_hdr(g, ofile, TRUE);
567
593
    write_body(g, ofile);
568
594
    write_trl(g, ofile);