Graphviz 2.29.20120208.0545
lib/cdt/dtwalk.c
Go to the documentation of this file.
00001 #include        "dthdr.h"
00002 
00003 /*      Walk a dictionary and all dictionaries viewed through it.
00004 **      userf:  user function
00005 **
00006 **      Written by Kiem-Phong Vo (5/25/96)
00007 */
00008 
00009 #if __STD_C
00010 int dtwalk(reg Dt_t* dt, int (*userf)(Dt_t*, Void_t*, Void_t*), Void_t* data)
00011 #else
00012 int dtwalk(dt,userf,data)
00013 reg Dt_t*       dt;
00014 int(*           userf)();
00015 Void_t*         data;
00016 #endif
00017 {
00018         reg Void_t      *obj, *next;
00019         reg Dt_t*       walk;
00020         reg int         rv;
00021 
00022         for(obj = dtfirst(dt); obj; )
00023         {       if(!(walk = dt->walk) )
00024                         walk = dt;
00025                 next = dtnext(dt,obj);
00026                 if((rv = (*userf)(walk, obj, data )) < 0)
00027                         return rv;
00028                 obj = next;
00029         }
00030         return 0;
00031 }