Updated Sourceforge username and host.
[tangerine.git] / compiler / purify / src / hash.h
blob8d0e80c508402c791f200b7b42355325932d29ae
1 #ifndef _HASH
2 #define _HASH
4 #define PURIFY_MemType_Heap 0 /* malloc()'d data */
5 #define PURIFY_MemType_Stack 1 /* data on stack */
6 #define PURIFY_MemType_Code 2 /* code memory */
7 #define PURIFY_MemType_Data 3 /* data segment */
9 #define PURIFY_MemFlag_Readable 1 /* Flag: May read */
10 #define PURIFY_MemFlag_Writable 2 /* Flag: May write */
11 #define PURIFY_MemFlag_Free 4 /* Flag: Free memory */
12 #define PURIFY_MemFlag_Empty 8 /* Flag: Not yet written to */
14 #define PURIFY_MemAccess_Read 0
15 #define PURIFY_MemAccess_Write 1
17 typedef struct _MemHash MemHash;
19 struct _MemHash
21 MemHash * next;
22 void * mem; /* This memory is purified */
23 char * flags; /* These are the flags for the memory */
24 int size; /* The size of the memory */
25 int type; /* Type of this memory */
26 const void * data; /* Userdata. If type == normal, then
27 points to PMemoryNode.
28 If type == stack, points to name of
29 variable.
30 If type == code, points to filename.
31 If type == data, points to file- or
32 variablename.
36 typedef MemHash * MemHashTable[256];
38 extern MemHash * Purify_LastNode;
40 /* Prototypes */
41 MemHash * Purify_AddMemory (void * mem, int size, int flag, int type);
42 void Purify_RemMemory (const void * mem);
43 void Purify_SetMemoryFlags (MemHash * mem, int offset, int size, int flag);
44 void Purify_ModifyMemoryFlags (MemHash * mem, int offset, int size, int flag,
45 int mask);
46 MemHash * Purify_FindMemory (const void * mem);
47 MemHash * Purify_FindNextMemory (const void * mem, int * offset);
48 int Purify_CheckMemoryAccess (const void * mem, int size, int access);
49 void Purify_PrintMemory (void);
51 #endif /* _HASH */