File: 1767.c

package info (click to toggle)
graphviz 14.1.1-1
  • links: PTS
  • area: main
  • in suites: forky
  • size: 139,440 kB
  • sloc: ansic: 142,129; cpp: 11,960; python: 7,770; makefile: 4,043; yacc: 3,030; xml: 2,972; tcl: 2,495; sh: 1,388; objc: 1,159; java: 560; lex: 423; perl: 243; awk: 156; pascal: 139; php: 58; ruby: 49; cs: 31; sed: 1
file content (48 lines) | stat: -rw-r--r-- 859 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* test case for repeated use of Pango plugin (see
 * test_regression.py:test_1767())
 */

#include <assert.h>
#include <graphviz/cgraph.h>
#include <graphviz/gvc.h>
#include <stdio.h>
#include <stdlib.h>

static void load(const char *filename) {
  Agraph_t *g;
  GVC_t *gvc;
  FILE *file;
  int r;
  Agraph_t *sg;

  gvc = gvContext();
  assert(gvc != NULL);

  file = fopen(filename, "r");
  assert(file != NULL);

  g = agread(file, NULL);
  printf("Loaded graph:%s\n", agnameof(g));

  r = gvLayout(gvc, g, "dot");
  assert(r == 0);

  for (sg = agfstsubg(g); sg != NULL; sg = agnxtsubg(sg)) {
    printf("%s contains %d nodes\n", agnameof(sg), (int)agnnodes(sg));
  }

  gvFreeLayout(gvc, g);
  agclose(g);
  fclose(file);
  gvFreeContext(gvc);
}

int main(int argc, char **argv) {

  assert(argc == 2);

  load(argv[1]);
  load(argv[1]);

  return 0;
}