src/clipsrules/core/memalloc.h File Reference

#include <string.h>

Include dependency graph for memalloc.h:

Go to the source code of this file.

Classes

struct  chunkInfo
struct  blockInfo
struct  memoryPtr
struct  memoryData

Defines

#define MEM_TABLE_SIZE   500
#define LOCALE   extern
#define get_struct(theEnv, type)
#define rtn_struct(theEnv, type, struct_ptr)
#define rtn_sized_struct(theEnv, size, struct_ptr)
#define get_var_struct(theEnv, type, vsize)
#define rtn_var_struct(theEnv, type, vsize, struct_ptr)
#define get_mem(theEnv, size)
#define rtn_mem(theEnv, size, ptr)
#define GenCopyMemory(type, cnt, dst, src)   memcpy((void *) (dst),(void *) (src),sizeof(type) * (size_t) (cnt))
#define MEMORY_DATA   59
#define MemoryData(theEnv)   ((struct memoryData *) GetEnvironmentData(theEnv,MEMORY_DATA))
#define GetConserveMemory()   EnvGetConserveMemory(GetCurrentEnvironment())
#define MemRequests()   EnvMemRequests(GetCurrentEnvironment())
#define MemUsed()   EnvMemUsed(GetCurrentEnvironment())
#define ReleaseMem(a, b)   EnvReleaseMem(GetCurrentEnvironment(),a,b)
#define SetConserveMemory(a)   EnvSetConserveMemory(GetCurrentEnvironment(),a)
#define SetOutOfMemoryFunction(a)   EnvSetOutOfMemoryFunction(GetCurrentEnvironment(),a)

Functions

LOCALE void InitializeMemory (void *)
LOCALE void * genalloc (void *, size_t)
LOCALE int DefaultOutOfMemoryFunction (void *, size_t)
LOCALE int(*)(void *, size_t) EnvSetOutOfMemoryFunction (void *, int(*)(void *, size_t))
LOCALE int genfree (void *, void *, size_t)
LOCALE void * genrealloc (void *, void *, size_t, size_t)
LOCALE long EnvMemUsed (void *)
LOCALE long EnvMemRequests (void *)
LOCALE long UpdateMemoryUsed (void *, long int)
LOCALE long UpdateMemoryRequests (void *, long int)
LOCALE long EnvReleaseMem (void *, long, int)
LOCALE void * gm1 (void *, size_t)
LOCALE void * gm2 (void *, size_t)
LOCALE void * gm3 (void *, size_t)
LOCALE int rm (void *, void *, size_t)
LOCALE int rm3 (void *, void *, size_t)
LOCALE unsigned long PoolSize (void *)
LOCALE unsigned long ActualPoolSize (void *)
LOCALE void * RequestChunk (void *, size_t)
LOCALE int ReturnChunk (void *, void *, size_t)
LOCALE intBool EnvSetConserveMemory (void *, intBool)
LOCALE intBool EnvGetConserveMemory (void *)
LOCALE void genmemcpy (char *, char *, unsigned long)
LOCALE void ReturnAllBlocks (void *)


Define Documentation

#define GenCopyMemory ( type,
cnt,
dst,
src   )     memcpy((void *) (dst),(void *) (src),sizeof(type) * (size_t) (cnt))

Definition at line 117 of file memalloc.h.

#define get_mem ( theEnv,
size   ) 

Value:

(((size <  MEM_TABLE_SIZE) ? \
    (MemoryData(theEnv)->MemoryTable[size] == NULL) : 1) ? \
   ((struct type *) genalloc(theEnv,(size_t) (size))) :\
   ((MemoryData(theEnv)->TempMemoryPtr = MemoryData(theEnv)->MemoryTable[size]),\
    MemoryData(theEnv)->MemoryTable[size] = MemoryData(theEnv)->TempMemoryPtr->next,\
    ((struct type *) MemoryData(theEnv)->TempMemoryPtr)))

Definition at line 101 of file memalloc.h.

#define get_struct ( theEnv,
type   ) 

Value:

((MemoryData(theEnv)->MemoryTable[sizeof(struct type)] == NULL) ? \
   ((struct type *) genalloc(theEnv,sizeof(struct type))) :\
   ((MemoryData(theEnv)->TempMemoryPtr = MemoryData(theEnv)->MemoryTable[sizeof(struct type)]),\
    MemoryData(theEnv)->MemoryTable[sizeof(struct type)] = MemoryData(theEnv)->TempMemoryPtr->next,\
    ((struct type *) MemoryData(theEnv)->TempMemoryPtr)))

Definition at line 68 of file memalloc.h.

#define get_var_struct ( theEnv,
type,
vsize   ) 

Value:

((((sizeof(struct type) + vsize) <  MEM_TABLE_SIZE) ? \
    (MemoryData(theEnv)->MemoryTable[sizeof(struct type) + vsize] == NULL) : 1) ? \
   ((struct type *) genalloc(theEnv,(sizeof(struct type) + vsize))) :\
   ((MemoryData(theEnv)->TempMemoryPtr = MemoryData(theEnv)->MemoryTable[sizeof(struct type) + vsize]),\
    MemoryData(theEnv)->MemoryTable[sizeof(struct type) + vsize] = MemoryData(theEnv)->TempMemoryPtr->next,\
    ((struct type *) MemoryData(theEnv)->TempMemoryPtr)))

Definition at line 85 of file memalloc.h.

 
#define GetConserveMemory (  )     EnvGetConserveMemory(GetCurrentEnvironment())

Definition at line 141 of file memalloc.h.

#define LOCALE   extern

Definition at line 44 of file memalloc.h.

#define MEM_TABLE_SIZE   500

Definition at line 35 of file memalloc.h.

#define MEMORY_DATA   59

Definition at line 120 of file memalloc.h.

#define MemoryData ( theEnv   )     ((struct memoryData *) GetEnvironmentData(theEnv,MEMORY_DATA))

Definition at line 139 of file memalloc.h.

 
#define MemRequests (  )     EnvMemRequests(GetCurrentEnvironment())

Definition at line 142 of file memalloc.h.

 
#define MemUsed (  )     EnvMemUsed(GetCurrentEnvironment())

Definition at line 143 of file memalloc.h.

#define ReleaseMem ( a,
 )     EnvReleaseMem(GetCurrentEnvironment(),a,b)

Definition at line 144 of file memalloc.h.

#define rtn_mem ( theEnv,
size,
ptr   ) 

Value:

(MemoryData(theEnv)->TempSize = size, \
   ((MemoryData(theEnv)->TempSize < MEM_TABLE_SIZE) ? \
    (MemoryData(theEnv)->TempMemoryPtr = (struct memoryPtr *) ptr,\
     MemoryData(theEnv)->TempMemoryPtr->next = MemoryData(theEnv)->MemoryTable[MemoryData(theEnv)->TempSize], \
     MemoryData(theEnv)->MemoryTable[MemoryData(theEnv)->TempSize] =  MemoryData(theEnv)->TempMemoryPtr) : \
    (genfree(theEnv,(void *) ptr,MemoryData(theEnv)->TempSize),(struct memoryPtr *) ptr)))

Definition at line 109 of file memalloc.h.

#define rtn_sized_struct ( theEnv,
size,
struct_ptr   ) 

Value:

(MemoryData(theEnv)->TempMemoryPtr = (struct memoryPtr *) struct_ptr,\
   MemoryData(theEnv)->TempMemoryPtr->next = MemoryData(theEnv)->MemoryTable[size], \
   MemoryData(theEnv)->MemoryTable[size] = MemoryData(theEnv)->TempMemoryPtr)

Definition at line 80 of file memalloc.h.

#define rtn_struct ( theEnv,
type,
struct_ptr   ) 

Value:

(MemoryData(theEnv)->TempMemoryPtr = (struct memoryPtr *) struct_ptr,\
   MemoryData(theEnv)->TempMemoryPtr->next = MemoryData(theEnv)->MemoryTable[sizeof(struct type)], \
   MemoryData(theEnv)->MemoryTable[sizeof(struct type)] = MemoryData(theEnv)->TempMemoryPtr)

Definition at line 75 of file memalloc.h.

#define rtn_var_struct ( theEnv,
type,
vsize,
struct_ptr   ) 

Value:

(MemoryData(theEnv)->TempSize = sizeof(struct type) + vsize, \
   ((MemoryData(theEnv)->TempSize < MEM_TABLE_SIZE) ? \
    (MemoryData(theEnv)->TempMemoryPtr = (struct memoryPtr *) struct_ptr,\
     MemoryData(theEnv)->TempMemoryPtr->next = MemoryData(theEnv)->MemoryTable[MemoryData(theEnv)->TempSize], \
     MemoryData(theEnv)->MemoryTable[MemoryData(theEnv)->TempSize] =  MemoryData(theEnv)->TempMemoryPtr) : \
    (genfree(theEnv,(void *) struct_ptr,MemoryData(theEnv)->TempSize),(struct memoryPtr *) struct_ptr)))

Definition at line 93 of file memalloc.h.

#define SetConserveMemory (  )     EnvSetConserveMemory(GetCurrentEnvironment(),a)

Definition at line 145 of file memalloc.h.

#define SetOutOfMemoryFunction (  )     EnvSetOutOfMemoryFunction(GetCurrentEnvironment(),a)

Definition at line 146 of file memalloc.h.


Function Documentation

LOCALE unsigned long ActualPoolSize ( void *   ) 

Definition at line 489 of file memalloc.c.

LOCALE int DefaultOutOfMemoryFunction ( void *  ,
size_t   
)

Definition at line 152 of file memalloc.c.

LOCALE intBool EnvGetConserveMemory ( void *   ) 

Definition at line 537 of file memalloc.c.

LOCALE long EnvMemRequests ( void *   ) 

Definition at line 246 of file memalloc.c.

LOCALE long EnvMemUsed ( void *   ) 

Definition at line 236 of file memalloc.c.

LOCALE long EnvReleaseMem ( void *  ,
long  ,
int   
)

LOCALE intBool EnvSetConserveMemory ( void *  ,
intBool   
)

Definition at line 522 of file memalloc.c.

LOCALE int(*)(void *, size_t) EnvSetOutOfMemoryFunction ( void *  ,
int(*)(void *, size_t)   
)

Definition at line 170 of file memalloc.c.

LOCALE void* genalloc ( void *  ,
size_t   
)

Definition at line 94 of file memalloc.c.

LOCALE int genfree ( void *  ,
void *  ,
size_t   
)

Definition at line 182 of file memalloc.c.

LOCALE void genmemcpy ( char *  ,
char *  ,
unsigned  long 
)

Definition at line 546 of file memalloc.c.

LOCALE void* genrealloc ( void *  ,
void *  ,
size_t  ,
size_t   
)

Definition at line 207 of file memalloc.c.

LOCALE void* gm1 ( void *  ,
size_t   
)

Definition at line 325 of file memalloc.c.

LOCALE void* gm2 ( void *  ,
size_t   
)

Definition at line 364 of file memalloc.c.

LOCALE void* gm3 ( void *  ,
size_t   
)

Definition at line 388 of file memalloc.c.

LOCALE void InitializeMemory ( void *   ) 

Definition at line 69 of file memalloc.c.

LOCALE unsigned long PoolSize ( void *   ) 

Definition at line 465 of file memalloc.c.

LOCALE void* RequestChunk ( void *  ,
size_t   
)

LOCALE void ReturnAllBlocks ( void *   ) 

LOCALE int ReturnChunk ( void *  ,
void *  ,
size_t   
)

LOCALE int rm ( void *  ,
void *  ,
size_t   
)

Definition at line 411 of file memalloc.c.

LOCALE int rm3 ( void *  ,
void *  ,
size_t   
)

Definition at line 439 of file memalloc.c.

LOCALE long UpdateMemoryRequests ( void *  ,
long  int 
)

Definition at line 268 of file memalloc.c.

LOCALE long UpdateMemoryUsed ( void *  ,
long  int 
)

Definition at line 256 of file memalloc.c.


Generated on Mon Jan 10 22:33:41 2011 by  doxygen 1.5.6