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