#include "Rts.h" #define Node 1 #define Cycle 2 #define Thunk 3 #define Char 4 #define Int 5 #define SmallInteger 6 #define LargeInteger 7 #define Float 8 #define Double 9 #define Exception 10 #define Ap_Upd 11 /* only in GHC versions prior to 6.0 */ #define Fun 12 #define Unknown 13 typedef struct _graphNode GraphNode; typedef union _val Val; typedef char Tag; union _val { char character; int machineInt; float machineFloat; char * descriptor; StgStablePtr largeIntegerSPtr; double machineDouble; }; struct _graphNode { unsigned int unique; /* unique number for this node */ Val val; /* value at this node */ Tag tag; /* node type */ short int numChildren; /* the number of children, 16 bits should be plenty */ GraphNode **children; /* children arcs, zero or more */ }; typedef struct _listNode List; struct _listNode { unsigned int val; List *next; }; typedef enum {False=0, True=1} Bool; GraphNode *makeGraphNode (int unique, Tag tag, char *descriptor, int numChildren); void freeGraph (GraphNode *node); List *cons (int val, List *l); List *freeListNode (List *l); GraphNode *makeHeapGraph (StgStablePtr obj); StgStablePtr reifyC ( StgStablePtr ptrObj , StgStablePtr ptrAppNode , StgStablePtr ptrCharNode , StgStablePtr ptrIntNode , StgStablePtr ptrIntegerNode , StgStablePtr ptrFloatNode , StgStablePtr ptrDoubleNode , StgStablePtr ptrNullNode , StgStablePtr ptrNil , StgStablePtr ptrCons );