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.
16
/* Get statistics of a dictionary
18
** Written by Kiem-Phong Vo (5/25/96)
22
static void dttstat(Dtstat_t* ds, Dtlink_t* root, int depth, int* level)
24
static void dttstat(ds,root,depth,level)
32
dttstat(ds,root->left,depth+1,level);
34
dttstat(ds,root->right,depth+1,level);
42
static void dthstat(reg Dtdata_t* data, Dtstat_t* ds, reg int* count)
44
static void dthstat(data, ds, count)
53
for(h = data->ntab-1; h >= 0; --h)
55
for(t = data->htab[h]; t; t = t->right)
68
int dtstat(reg Dt_t* dt, Dtstat_t* ds, int all)
70
int dtstat(dt, ds, all)
77
static int *Count, Size;
81
ds->dt_n = ds->dt_max = 0;
82
ds->dt_count = NIL(int*);
83
ds->dt_size = dtsize(dt);
84
ds->dt_meth = dt->data->type&DT_METHODS;
89
if(dt->data->type&(DT_SET|DT_BAG))
90
{ dthstat(dt->data,ds,NIL(int*));
91
if(ds->dt_max+1 > Size)
94
if(!(Count = (int*)malloc((ds->dt_max+1)*sizeof(int))) )
98
for(i = ds->dt_max; i >= 0; --i)
100
dthstat(dt->data,ds,Count);
102
else if(dt->data->type&(DT_OSET|DT_OBAG))
104
{ dttstat(ds,dt->data->here,0,NIL(int*));
105
if(ds->dt_n+1 > Size)
108
if(!(Count = (int*)malloc((ds->dt_n+1)*sizeof(int))) )
113
for(i = ds->dt_n; i >= 0; --i)
115
dttstat(ds,dt->data->here,0,Count);
116
for(i = ds->dt_n; i >= 0; --i)
117
if(Count[i] > ds->dt_max)
118
ds->dt_max = Count[i];
121
ds->dt_count = Count;