libdatastr/util/dsdump.c

52 lines
1.1 KiB
C
Raw Normal View History

2000-07-28 17:30:55 +02:00
#define SM_MODE 1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <node.h>
#include <shmem.h>
#include <datastr.h>
int main (int argc, char ** argv)
{
NDT_Node * Node;
SM_Library_Open (0, NULL, SMD_OPEN | SMD_DEBUG_ALL);
ND_Node_First_Get (SM_Base->MHR, &Node);
while (Node)
{
char * ptr;
SMT_MHH * MHH = ( SMT_MHH *)(Node->Value);
if ((ptr = strstr (MHH->Name, "DATASTR/")) != NULL)
{
int Locked;
SMT_Heap * Heap;
SMT_DSH * DSH;
NDT_Root * Root;
DST_RootDesc * RootDesc;
SM_Heap_Open (ptr, &Heap, 0, SMD_OPEN | SMD_READ, &Locked);
DSH = ( SMT_DSH *)(MHH->DSR->Head->Value);
Root = ( NDT_Root *)((size_t)(DSH->Start) + sizeof (NDT_Node) + sizeof (SMT_Chunk));
RootDesc = (DST_RootDesc *)(Root->User);
fprintf (stdout, "Data Structure \"%s\":\n\t- Manager = %s\n\t- Open semaphore = %d\n", ptr + strlen ("datastr/"), RootDesc->Manager_FileName, RootDesc->OpenSemID);
SM_Heap_Close (Heap);
}
ND_Node_Next_Get (Node, &Node);
}
SM_Library_Close (SMD_CLOSE);
return 0;
}