|
Graphviz 2.29.20120208.0545
|
00001 #include "dthdr.h" 00002 00003 /* Return the # of objects in the dictionary 00004 ** 00005 ** Written by Kiem-Phong Vo (5/25/96) 00006 */ 00007 00008 #if __STD_C 00009 static int treecount(reg Dtlink_t* e) 00010 #else 00011 static int treecount(e) 00012 reg Dtlink_t* e; 00013 #endif 00014 { return e ? treecount(e->left) + treecount(e->right) + 1 : 0; 00015 } 00016 00017 #if __STD_C 00018 int dtsize(Dt_t* dt) 00019 #else 00020 int dtsize(dt) 00021 Dt_t* dt; 00022 #endif 00023 { 00024 reg Dtlink_t* t; 00025 reg int size; 00026 00027 UNFLATTEN(dt); 00028 00029 if(dt->data->size < 0) /* !(dt->data->type&(DT_SET|DT_BAG)) */ 00030 { if(dt->data->type&(DT_OSET|DT_OBAG)) 00031 dt->data->size = treecount(dt->data->here); 00032 else if(dt->data->type&(DT_LIST|DT_STACK|DT_QUEUE)) 00033 { for(size = 0, t = dt->data->head; t; t = t->right) 00034 size += 1; 00035 dt->data->size = size; 00036 } 00037 } 00038 00039 return dt->data->size; 00040 }
1.7.4