Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
dtsize.c
Go to the documentation of this file.
1#include <cdt/dthdr.h>
2
3/* Return the # of objects in the dictionary
4**
5** Written by Kiem-Phong Vo (5/25/96)
6*/
7
8static int treecount(Dtlink_t* e)
9{ return e ? treecount(e->left) + treecount(e->right) + 1 : 0;
10}
11
12int dtsize(Dt_t* dt)
13{
14 UNFLATTEN(dt);
15
16 if (dt->data.size < 0) // !(dt->data.type & (DT_SET|DT_BAG))
17 { if (dt->data.type & (DT_OSET|DT_OBAG))
18 dt->data.size = treecount(dt->data.here);
19 }
20
21 return dt->data.size;
22}
#define DT_OBAG
Definition cdt.h:122
#define DT_OSET
Definition cdt.h:121
#define UNFLATTEN(dt)
Definition dthdr.h:27
int dtsize(Dt_t *dt)
Definition dtsize.c:12
static int treecount(Dtlink_t *e)
Definition dtsize.c:8
int size
Definition cdt.h:79
Dtlink_t * here
Definition cdt.h:73
int type
Definition cdt.h:72
Definition cdt.h:100
Dtdata_t data
sharable data
Definition cdt.h:102