222 lines
9.7 KiB
C
222 lines
9.7 KiB
C
/* ##H_FILE#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
FILE : ErrMmg.h
|
|
|
|
DESCRIPTION : this file contain constant and variables to manage error
|
|
in the module Mmg
|
|
|
|
VERSION : 5.1.0/Pierrick Crepy/Creation
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
#ifndef __ERRMMG_H__
|
|
#define __ERRMMG_H__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif /* __cplusplus */
|
|
|
|
/* ##CONSTANTE#--------------------------------------------------------------------------
|
|
Constantes declaration
|
|
---------------------------------------------------------------------------------------*/
|
|
#define D_CheckSystemForBlockWithoutFree
|
|
|
|
#define C_szMmgVersion "MMG V6.0.1" /* The format is XXX Va.b.c with Xxx is the Tag of the module */
|
|
#define C_szMmgFullName "Memory Manager"/* the complete and clear name of the module */
|
|
#define C_szMmgDate "Mar 12 1998" /*The format is "Mmm dd yyyy".You can use __DATE__ but be careful that you have the control of the compilation*/
|
|
|
|
/* break the compatibility with the old syntaxe (mem)*/
|
|
/* modification of all the message error in order to give the maximum accurate information*/
|
|
/* testMalloc function work propely.*/
|
|
/* strong the initialization of block.*/
|
|
|
|
/* For DLLs who are using this module : */
|
|
#undef CPA_EXPORT
|
|
#if defined(CPA_WANTS_IMPORT)
|
|
#define CPA_EXPORT __declspec(dllimport)
|
|
#elif defined(CPA_WANTS_EXPORT)
|
|
#define CPA_EXPORT __declspec(dllexport)
|
|
#else
|
|
#define CPA_EXPORT
|
|
#endif
|
|
|
|
#ifndef __ERM_H__
|
|
#include "ERM.h"
|
|
#endif /*__ERM_H__*/
|
|
|
|
|
|
#define __FATAL_ERR_MMG__
|
|
#define __FATAL_DEBUG_ERR_MMG__ /* disable the definition if __DEBUG_MALLOC_MODE__ is not defined*/
|
|
#define __WARNING1_ERR_MMG__
|
|
#define __WARNING2_ERR_MMG__
|
|
#define __WARNING3_ERR_MMG__
|
|
/* error of the Mmg Module*/
|
|
typedef enum e_uwMmgErrNumber_{
|
|
E_uwMmgFatalErr,
|
|
#ifdef __FATAL_ERR_MMG__
|
|
/* -----------------*/
|
|
/* E_uwMmgPbDataAlignment,*/
|
|
E_uwMmgPbInvalidMallocInfo,
|
|
E_uwMmgPbAlignmentBlock,
|
|
E_uwMmgPbDynAllacationAlignment,
|
|
E_uwMmgPbDynOverflowBefore,
|
|
E_uwMmgPbDynOverflowAfter,
|
|
E_uwMmgPbStaOverflowBefore,
|
|
E_uwMmgPbStaOverflowAfter,
|
|
E_uwMmgPbOverflowBefore,
|
|
E_uwMmgPbOverflowAfter,
|
|
E_uwMmgPbTooManyAllacation,
|
|
E_uwMmgPbVirtualAlloc,
|
|
E_uwMmgPbInvalidBlock,
|
|
E_uwMmgPbInvalidStaticAddress,
|
|
E_uwMmgPbInvalidModuleId,
|
|
E_uwMmgPbInvalidBlockId,
|
|
E_uwMmgPbNoStaticMemory,
|
|
E_uwMmgPbAccessMemoryDenied,
|
|
E_uwMmgPbInvalNbOfChannel,
|
|
E_uwMmgPbTooManyChannel,
|
|
E_uwMmgPbInFirstInitMmgModule,
|
|
E_uwMmgPbInInitMmg,
|
|
E_uwMmgPbInInitBlock,
|
|
#endif /*__FATAL_ERR_MMG__*/
|
|
#ifdef __FATAL_DEBUG_ERR_MMG__
|
|
/* ---------------------*/
|
|
E_uwMmgPbCanNotInitMmg,
|
|
E_uwMmgPbCanNotUseDynMode,
|
|
E_uwMmgPbBagMode,
|
|
#endif /*__FATAL_DEBUG_ERR_MMG__*/
|
|
#ifdef D_CheckSystemForBlockWithoutFree
|
|
/* ----------------------------------*/
|
|
E_uwMmgPbAlignmentAllocationRequested,
|
|
E_uwMmgPbOverFlowBeforeOnTheRemainTag,
|
|
E_uwMmgPbNoAvailableFunctionForBlockWithoutFree,
|
|
|
|
#endif /*D_CheckSystemForBlockWithoutFree*/
|
|
E_uwMmgStartOfWarning,
|
|
#ifdef __WARNING1_ERR_MMG__
|
|
/* -------------------*/
|
|
#endif /*__WARNING1_ERR_MMG__*/
|
|
#ifdef __WARNING2_ERR_MMG__
|
|
/* -------------------*/
|
|
E_uwMmgPbDynamicFree,
|
|
#endif /*__WARNING2_ERR_MMG__*/
|
|
#ifdef __WARNING3_ERR_MMG__
|
|
/* -------------------*/
|
|
E_uwMmgPbAllocateBlock,
|
|
E_uwMmgPbDynAllacateMemory,
|
|
E_uwMmgPbDynAddressNotValid,
|
|
E_uwMmgPbStaAddressNotValid,
|
|
E_uwMmgPbBLockFull,
|
|
E_uwMmgPbSpaceForDebugInformationIsFull,
|
|
E_uwMmgPbDeleteBlock,
|
|
E_uwMmgPbSizeOfAllocIs0,
|
|
E_uwMmgPbFreeofNULL,
|
|
E_uwMmgPbBbFree,
|
|
E_uwMmgPbDftChannelCannotBeFree,
|
|
E_uwMmgPbInvalChannel,
|
|
E_uwMmgInvalidGroup,
|
|
#endif /*__WARNING3_ERR_MMG__*/
|
|
E_uwMmgErrNumber
|
|
} e_uwMmgErrNumber;
|
|
|
|
/* ##GLOBVAR#----------------------------------------------------------------------------
|
|
Globale variable declaration
|
|
---------------------------------------------------------------------------------------*/
|
|
#undef __ERRMMG_EXTERN
|
|
#ifndef __DeclareGlobalVariableErrMmg_h__
|
|
#define __ERRMMG_EXTERN extern /*external declaration*/
|
|
#else /*__DeclareGlobalVariableErrMmg_h__*/
|
|
#define __ERRMMG_EXTERN /*replace by nothing : we have to declare*/
|
|
#endif /*__DeclareGlobalVariableErrMmg_h__*/
|
|
|
|
__ERRMMG_EXTERN CPA_EXPORT unsigned char g_ucMmgModuleId /* number of identification of the Erm module*/
|
|
#if defined(__DeclareGlobalVariableErrMmg_h__) && !defined(CPA_WANTS_IMPORT)
|
|
= C_ucModuleNotInitialized
|
|
#endif /*__DeclareGlobalVariableErrMmg_h__ && CPA_WANTS_IMPORT*/
|
|
;
|
|
|
|
#ifdef __ERROR_STRINGS__
|
|
|
|
__ERRMMG_EXTERN CPA_EXPORT char * g_a_szMmgInformationModule []
|
|
#if defined(__DeclareGlobalVariableErrMmg_h__) && !defined(CPA_WANTS_IMPORT)
|
|
= {C_szMmgVersion, C_szMmgFullName, C_szMmgDate}
|
|
#endif /*__DeclareGlobalVariableErrMmg_h__ && CPA_WANTS_IMPORT*/
|
|
;
|
|
|
|
__ERRMMG_EXTERN CPA_EXPORT struct tdstErrorMsg_ g_a_stMmgTabErr [] /* Obliged syntax 'g_a_st'+[Abbreviation of ModuleName]+'TabErr'*/
|
|
#if defined(__DeclareGlobalVariableErrMmg_h__) && !defined(CPA_WANTS_IMPORT)
|
|
={
|
|
#ifdef __FATAL_ERR_MMG__
|
|
/* -------------*/
|
|
/* E_uwMmgPbDataAlignment, "the alignment information are not valid (in Mmg_fn_cCheckAlignmentValidity)",*/
|
|
E_uwMmgPbInvalidMallocInfo, "The block tested by testMalloc is not valid, it's should be not initialize !",
|
|
E_uwMmgPbAlignmentBlock, "Alignment error of the beginning address of my block\n(from the 'malloc' system function, in Mmg_fn_vInitblock)",
|
|
E_uwMmgPbDynAllacationAlignment, "the dynamic memory allocated is not aligned\n(from the 'malloc' system function, in fn_p_vDynAlloc)",
|
|
E_uwMmgPbDynOverflowBefore, "Overflow before a dynamic malloc",
|
|
E_uwMmgPbDynOverflowAfter, "Overflow after a dynamic malloc",
|
|
E_uwMmgPbStaOverflowBefore,"Overflow before a static malloc",
|
|
E_uwMmgPbStaOverflowAfter, "Overflow after a static malloc",
|
|
E_uwMmgPbOverflowBefore,"Overflow before an allocation",
|
|
E_uwMmgPbOverflowAfter, "Overflow after an allocation",
|
|
E_uwMmgPbTooManyAllacation, "There is too many allocation",
|
|
E_uwMmgPbVirtualAlloc, "The virtualAlloc function failed (return NULL). Is that enough memory ??",
|
|
E_uwMmgPbInvalidBlock, "The static block that you try to use, is not valid, it's should be not well initialize !",
|
|
E_uwMmgPbInvalidStaticAddress, "The address is not a static address",
|
|
E_uwMmgPbInvalidModuleId, "The moduleId is impossible",
|
|
E_uwMmgPbInvalidBlockId, "The BlockId is impossible",
|
|
E_uwMmgPbNoStaticMemory, "There is no static memory",
|
|
E_uwMmgPbAccessMemoryDenied, "You've try to access to the memory through Mmg module.\nBut the memory have been locked with Mmg_fn_vLockAlloaction!",
|
|
E_uwMmgPbInvalNbOfChannel, "Invalid number of channel",
|
|
E_uwMmgPbTooManyChannel, "Sorry, too much channels are used",
|
|
E_uwMmgPbInFirstInitMmgModule, "Malloc system failed in FirstInitMmgModule function",
|
|
E_uwMmgPbInInitMmg, "Malloc system failed in InitMmg function",
|
|
E_uwMmgPbInInitBlock, "Malloc system failed in Mmg_fn_vInitBlock function",
|
|
#endif /*__FATAL_ERR_MMG__*/
|
|
#ifdef __FATAL_DEBUG_ERR_MMG__
|
|
E_uwMmgPbCanNotInitMmg, "The Mmg initialization have to be done before the Erm initialization",
|
|
E_uwMmgPbCanNotUseDynMode, "You have selected the Dynamic mode.\nBut __DYNAMIC_MALLOC_ALLOWED__ is not defined",
|
|
E_uwMmgPbBagMode, "Problem the Mmg_M_SetModeAlloc is not appropriate \nExample: you try to use Dynamic memory but Mmg_M_SetModeAlloc is set for the Static memory",
|
|
#endif /*__FATAL_DEBUG_ERR_MMG__*/
|
|
|
|
#ifdef D_CheckSystemForBlockWithoutFree
|
|
/* ----------------------------------*/
|
|
E_uwMmgPbAlignmentAllocationRequested, "The size of the allocation is not compatible with the alignment requested duing the initialization of the block",
|
|
E_uwMmgPbOverFlowBeforeOnTheRemainTag, "The last Allocation Overwrite the Remain check Key, just after the p_cMaxMen",
|
|
E_uwMmgPbNoAvailableFunctionForBlockWithoutFree,"You can NOT use this function with this kind of block: block without Free management",
|
|
#endif /*D_CheckSystemForBlockWithoutFree*/
|
|
|
|
|
|
#ifdef __WARNING1_ERR_MMG__
|
|
/* ----------------*/
|
|
#endif /*__WARNING1_ERR_MMG__*/
|
|
#ifdef __WARNING2_ERR_MMG__
|
|
/* ----------------*/
|
|
E_uwMmgPbDynamicFree, "Can not free the dynamic memory",
|
|
#endif /*__WARNING2_ERR_MMG__*/
|
|
#ifdef __WARNING3_ERR_MMG__
|
|
/* ----------------*/
|
|
E_uwMmgPbAllocateBlock, "Impossible to Allocate the block (in Mmg_fn_vInitblock),\nthe system function for allocation failed (return NULL)",
|
|
E_uwMmgPbDynAllacateMemory, "Can not allocate dynamic memory (in fn_p_vDynAlloc),\nthe system function for allocation failed (return NULL)",
|
|
E_uwMmgPbDynAddressNotValid, "The dynamic memory address is not valid (not referenced in the debug table)",
|
|
E_uwMmgPbStaAddressNotValid, "The Static memory address is not valid (not referenced in the debug table), or using a wrong static block",
|
|
E_uwMmgPbBLockFull, "Can not allocate (the block is full)",
|
|
E_uwMmgPbSpaceForDebugInformationIsFull, "The number of requested allocation are too high, the debug information memory is full",
|
|
E_uwMmgPbDeleteBlock, "Can not free the Block (in Mmg_fn_vDeleteblock)",
|
|
E_uwMmgPbSizeOfAllocIs0, "Strange, you have request an allocation of 0 Byte, the return value Will be NULL, please change",
|
|
E_uwMmgPbFreeofNULL, "Strange, you have request a free with a NULL pointer, please change that",
|
|
E_uwMmgPbBbFree, "Strange, the number of free was not valid.\nThe debug function TestMalloc has repaired this data.\nPlease warn the developper of Mmg to fix the Bug",
|
|
E_uwMmgPbDftChannelCannotBeFree,"You try to release the default channel (0), you not allow to do that !",
|
|
E_uwMmgPbInvalChannel, "Invalid number of channel",
|
|
E_uwMmgInvalidGroup,"You are not allow to use another group to the default",
|
|
#endif /*__WARNING3_ERR_MMG__*/
|
|
0xFFFF, "\0"/*fin*/
|
|
}
|
|
#endif /*__DeclareGlobalVariableErrMmg_h__ && CPA_WANTS_IMPORT*/
|
|
;
|
|
|
|
#endif /*__ERROR_STRINGS__*/
|
|
|
|
#ifdef __cplusplus
|
|
};
|
|
#endif /* __cplusplus */
|
|
|
|
#endif /*__ERRMMG_H__*/
|