tesseract-doxygen/ccutil/memry.h File Reference

#include <stddef.h>
#include "host.h"

Go to the source code of this file.

Defines

#define JUSTCHECKS   0
#define MEMCHECKS   1
#define FULLMEMCHECKS   2
#define NEWDELETE
#define NEWDELETE2(name)
#define ALLOC_2D_ARRAY(x, y, mem, ptrs, type)
#define FREE_2D_ARRAY(mem, ptrs)
#define ALLOC_BIG_2D_ARRAY(x, y, mem, ptrs, type)
#define FREE_BIG_2D_ARRAY(mem, ptrs)

Functions

DLLSYM void check_mem (const char *string, inT8 level)
DLLSYM char * alloc_string (inT32 count)
DLLSYM void free_string (char *string)
DLLSYM void * alloc_struct (inT32 count, const char *name=NULL)
DLLSYM void free_struct (void *deadstruct, inT32 count, const char *name=NULL)
DLLSYM void * alloc_mem_p (inT32 count)
DLLSYM void * alloc_mem (inT32 count)
DLLSYM void * alloc_big_mem (inT32 count)
DLLSYM void * alloc_big_zeros (inT32 count)
DLLSYM void free_mem (void *oldchunk)
DLLSYM void free_big_mem (void *oldchunk)

Define Documentation

#define ALLOC_2D_ARRAY ( x,
y,
mem,
ptrs,
type   ) 
Value:
/*make 2d array*/\
{ \
        inT32                                   TMP_i; \
        mem=(type*)alloc_mem((x)*(y)*sizeof(type));                     /*get memory*/\
        ptrs=(type**)alloc_mem((x)*sizeof(type*));                      /*get ptrs*/\
        for (TMP_i=0;TMP_i<(x);TMP_i++)\
                ptrs[TMP_i]=mem+(y)*TMP_i;                                              /*set ptrs*/\
} \
#define ALLOC_BIG_2D_ARRAY ( x,
y,
mem,
ptrs,
type   ) 
Value:
/*make 2d array*/\
{ \
        inT32                                   TMP_i; \
        mem=(type*)alloc_big_mem((x)*(y)*sizeof(type));         /*get memory*/\
        ptrs=(type**)alloc_big_mem((x)*sizeof(type*));          /*get ptrs*/\
        for (TMP_i=0;TMP_i<(x);TMP_i++)\
                ptrs[TMP_i]=mem+(y)*TMP_i;                                              /*set ptrs*/\
} \
#define FREE_2D_ARRAY ( mem,
ptrs   ) 
Value:
/*free a 2D array*/\
{ \
        free_mem(mem);                                                                          /*free the memory*/\
        free_mem(ptrs);                                                                         /*and the ptrs*/\
} \
#define FREE_BIG_2D_ARRAY ( mem,
ptrs   ) 
Value:
/*free a 2D array*/\
{ \
        free_big_mem(mem);                                                                      /*free the memory*/\
        free_big_mem(ptrs);                                                                     /*and the ptrs*/\
} \
#define FULLMEMCHECKS   2
#define JUSTCHECKS   0
#define MEMCHECKS   1
#define NEWDELETE
Value:
/*replace new & delete*/\
        void                                    *operator new(                          /*fast allocator*/\
        size_t                                  size)                                           /*size of object*/\
        {\
                return alloc_struct(size);                                              /*simple to do*/\
        }\
\
        void                                    operator delete(                        /*fast destructor*/\
        void                                    *deadstruct,                            /*thing to free*/\
        size_t                                  size)                                           /*sizeof struct*/\
        {\
                free_struct(deadstruct,size);                                   /*free it*/\
        }\
#define NEWDELETE2 ( name   ) 
Value:
/*replace new & delete*/\
        void                                    *operator new(                          /*fast allocator*/\
        size_t                                  size)                                           /*size of object*/\
        {\
                return alloc_struct(size,#name);                                /*simple to do*/\
        }\
\
        void                                    operator delete(                        /*fast destructor*/\
        void                                    *deadstruct,                            /*thing to free*/\
        size_t                                  size)                                           /*sizeof struct*/\
        {\
                free_struct(deadstruct,size,#name);                             /*free it*/\
        }\

Function Documentation

DLLSYM void* alloc_big_mem ( inT32  count  ) 
DLLSYM void* alloc_big_zeros ( inT32  count  ) 
DLLSYM void* alloc_mem ( inT32  count  ) 
DLLSYM void* alloc_mem_p ( inT32  count  ) 
DLLSYM char* alloc_string ( inT32  count  ) 
DLLSYM void* alloc_struct ( inT32  count,
const char *  name = NULL 
)
DLLSYM void check_mem ( const char *  string,
inT8  level 
)
DLLSYM void free_big_mem ( void *  oldchunk  ) 
DLLSYM void free_mem ( void *  oldchunk  ) 
DLLSYM void free_string ( char *  string  ) 
DLLSYM void free_struct ( void *  deadstruct,
inT32  count,
const char *  name = NULL 
)
Generated on Sun Jul 18 17:10:50 2010 for Tesseract by  doxygen 1.6.3