/*------------------------------------------------------------------------------ FILE : Link.h CREATED : 98/05/19 AUTHOR : Catalin Cocos CONTENTS: linktable/position structures & functions ------------------------------------------------------------------------------*/ #ifndef __LDT_LINK__ #define __LDT_LINK__ #include "Hash.h" #include "Interface.h" #include "File.h" /* Structures ----------------*/ /* section position inside the containing file */ typedef struct LDT_tdst_Position_ LDT_tdst_Position; struct LDT_tdst_Position_ { char* szName; /* the section name */ char* szParent; /* the section parent */ LDT_tdst_CallbackEntry* Type; /* the type of the section */ unsigned short uwFlags; /* flags */ unsigned long dwPos; /* the offset inside the file */ unsigned long nLine; /* the text line */ int iLevel; /*the level in file*/ }; /* Reference Collection for a File */ typedef struct LDT_tdst_Refs_ LDT_tdst_Refs; struct LDT_tdst_Refs_ { char* szFile; /* the file */ LDT_tdst_DSArray Links; /* the references */ LDT_tdst_Refs* p_NextReferencedFile;/* the next file */ #ifdef LDT_MULTITHREADED LDT_tdst_MemFile* pFile; /* the opened file */ #endif }; /* Link associated value */ typedef struct LDT_tdst_LinkValue_ LDT_tdst_LinkValue; struct LDT_tdst_LinkValue_ { LDT_tdst_Link* pLink; unsigned long value; }; /* Globals -------------*/ extern LDT_tdst_DSHash g_HashLinks; /* the linktable */ extern LDT_tdst_DSArray g_ArRefs; /* thereferences, grouped by file */ extern LDT_tdst_DSArray g_ArFilenames; /* thefilename strings */ extern char LDT_EMPTY_STR[1]; extern LDT_tdst_Refs* g_pFileToProcess; /* the file to load */ extern LDT_tdst_Refs* g_pLastFileQueued; /* the last fiel referenced */ #ifdef LDT_MULTITHREADED extern LDT_tdst_Refs* g_pFileToRead; /* the file to read */ #endif /* Functions --------------*/ /* Link - related */ int LDT_Link_Dispersion( LDT_tdst_Link*); int LDT_Compare_Links(const void**, const void** ); int LDT_Compare_LinkValues(const void**, const void** ); LDT_tdst_Link* LDT_CreateLinkFromReference( char* szSection ); LDT_tdst_Link* LDT_Create_Link( char* szName, /* the section name */ char* szParent, /* the section parent */ char* szFile, /* the file containing the section - stored in a string table */ LDT_tdst_CallbackEntry* Type, unsigned long dwFlags, /* flags */ void* pObject, /* the allocated memory structure or NULL */ LDT_tdst_Link* pParent); /* the section that requested the loading */ void LDT_Delete_Link( LDT_tdst_Link *); /* Position - related */ int LDT_Compare_Positions(const void**, const void** ); LDT_tdst_Position *LDT_Create_Position( char *szName, char *szParent, LDT_tdst_CallbackEntry* Type, unsigned short uwFlags, unsigned long ulPos, unsigned long nLine, int iLevel ); void LDT_Delete_Position( LDT_tdst_Position *pos ); /* String - related */ int LDT_Compare_Strings(const void**, const void** ); /* Reference - related */ void AddReference( LDT_tdst_Link* ); int LDT_Compare_Refs(const void**, const void** ); #endif