~ubuntu-branches/ubuntu/lucid/graphviz/lucid-security

« back to all changes in this revision

Viewing changes to dotneato/twopimemtest.c

  • Committer: Bazaar Package Importer
  • Author(s): Stephen M Moraco
  • Date: 2002-02-05 18:52:12 UTC
  • Revision ID: james.westby@ubuntu.com-20020205185212-8i04c70te00rc40y
Tags: upstream-1.7.16
ImportĀ upstreamĀ versionĀ 1.7.16

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    This software may only be used by you under license from AT&T Corp.
 
3
    ("AT&T").  A copy of AT&T's Source Code Agreement is available at
 
4
    AT&T's Internet website having the URL:
 
5
    <http://www.research.att.com/sw/tools/graphviz/license/source.html>
 
6
    If you received this software without first entering into a license
 
7
    with AT&T, you have an infringing copy of this software and cannot use
 
8
    it without violating AT&T's intellectual property rights.
 
9
*/
 
10
#pragma prototyped
 
11
 
 
12
/*
 
13
 * Written by Emden R. Gansner
 
14
 * Derived from Graham Wills' algorithm described in GD'97.
 
15
 */
 
16
 
 
17
#include    "circle.h"
 
18
#ifdef HAVE_CONFIG_H
 
19
#include "gvconfig.h"
 
20
#endif
 
21
#include        <time.h>
 
22
#ifndef MSWIN32
 
23
#include        <unistd.h>
 
24
#endif
 
25
 
 
26
#ifdef DMALLOC
 
27
#include "dmalloc.h"
 
28
#endif
 
29
 
 
30
char *Info[] = {
 
31
    "twopi",            /* Program */
 
32
    VERSION,            /* Version */
 
33
    DATE                /* Build Date */
 
34
};
 
35
 
 
36
static graph_t *G;
 
37
 
 
38
#ifndef MSWIN32
 
39
static void intr(int s)
 
40
{
 
41
        if (G) dotneato_write(G);
 
42
        dotneato_terminate();
 
43
        exit(1);
 
44
}
 
45
#endif
 
46
 
 
47
int main (int argc, char** argv)
 
48
{
 
49
  dotneato_initialize (argc, argv);
 
50
#ifndef MSWIN32
 
51
        signal (SIGUSR1, toggle);
 
52
        signal (SIGINT, intr);
 
53
#endif
 
54
 
 
55
  {
 
56
    #define NUMNODES 5
 
57
  
 
58
    Agnode_t *node[NUMNODES];
 
59
    char name[10];
 
60
    int j, k;
 
61
  
 
62
  
 
63
    int count = 0;
 
64
    while (1) {
 
65
  
 
66
      /* Create a new graph */
 
67
      G = agopen("new_graph", AGRAPH);
 
68
  
 
69
      /* Add nodes */
 
70
      for (j=0; j<NUMNODES; j++) {
 
71
        sprintf(name, "%d", j);
 
72
        node[j] = agnode(G, name);
 
73
      }
 
74
  
 
75
      /* Connect nodes */
 
76
      for (j=0; j<NUMNODES; j++) {
 
77
        for (k=j+1; k<NUMNODES; k++) {
 
78
          agedge(G,node[j],node[k]);
 
79
        }
 
80
      }
 
81
  
 
82
      /* Perform layout */
 
83
      twopi_layout(G);
 
84
  
 
85
      /* Delete graph */
 
86
      twopi_cleanup(G);
 
87
      agclose(G);
 
88
  
 
89
#ifdef DMALLOC
 
90
      /* first log is baseline, second log shows leaks. */
 
91
      dmalloc_log_unfreed();
 
92
      if (count) return 1;
 
93
#endif
 
94
      count++;
 
95
    }
 
96
  }
 
97
}