Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

View File

@@ -0,0 +1,586 @@
/* ##C_FILE#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FILE : CpaError.c
DESCRIPTION : Main functions of the ERM module
VERSION : 1.00/Pierrick Crepy/ Creation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/* ##INCLUDE#----------------------------------------------------------------------------
Includes Files
---------------------------------------------------------------------------------------*/
#ifdef U64
#ifndef FINAL_VERSION
#include "ultra.h"
#include "GLD/Specif/DisplMsg.h"
extern CPA_EXPORT unsigned char GAM_fn_bIsEngineInLevelMode(void);
#endif /* FINAL_VERSION */
#endif/*U64*/
#ifdef WIN32
#include <Windows.h>
#endif
#define __DeclareGlobalVariableInCpaError_h__
#include "Erm/CpaError.h"
#undef __DeclareGlobalVariableInCpaError_h__
#include "PrivErm.h"
#ifdef PSX
#include "PSX.h"
#include "Erm.h"
#include "PSX\Erm_PSX.h"
#endif /* PSX */
void (*p_fn_ExitAppliCallBack)() = NULL;
/* ##FUNCDEF#----------------------------------------------------------------------------
Functions definition
---------------------------------------------------------------------------------------*/
/* ##F===================================================================================
NAME : Erm_fn_vSetCallBackForExit
DESCRIPTION : Set the call back use before exit after an error occur
INPUT : Pointer on the callback
=========================================================================================
CREATION : Carlos Torres 12/01/98
=======================================================================================*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void Erm_fn_vSetCallBackForExit(void (*_p_fn_ExitAppliCallBack)())
{
p_fn_ExitAppliCallBack = _p_fn_ExitAppliCallBack;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* ##F#===================================================================================
NAME : Erm_fn_ucInitErrMsg
DESCRIPTION : Init error Message
=========================================================================================
CREATION : Pierrick Crepy
=======================================================================================*/
#ifdef __ERROR_STRINGS__
unsigned char Erm_fn_ucInitErrMsg (char ** a_szModuleName, struct tdstErrorMsg_ * a_stTabErr)
#else /* no ERROR_STRINGS */
unsigned char Erm_fn_ucInitErrMsg ()
#endif/* __ERROR_STRINGS__*/
{
#if defined(__MULTI_THREAD_ERROR_MANAGEMENT__) || defined(__ERROR_STRINGS__)
unsigned char ucI;
#endif /*if defined(__MULTI_THREAD_ERROR_MANAGEMENT__) || defined(__ERROR_STRINGS__)*/
#ifdef __FATAL_ERR_ERM__
if (g_ucErmNbOfModule == C_ucNbOfMaxModule)
Erm_M_UpdateLastError(Erm, C_ucErmDefaultChannel, E_uwErmTooManyModulesErr, C_lErmNoDebugData, C_ucErmOpenInfoWindow, C_ucAllowStopForDebug, NULL);
#endif /*__FATAL_ERR_ERM__*/
#ifdef __ERROR_STRINGS__
g_a_a_szErmModuleInformationTab [g_ucErmNbOfModule] = a_szModuleName;
g_a_p_stErmGeneralTabErr[g_ucErmNbOfModule] = a_stTabErr;
#endif/* __ERROR_STRINGS__*/
if (g_ucErmNbOfModule == 0)
{
#ifdef __MULTI_THREAD_ERROR_MANAGEMENT__
{
/*Channel init */
for (ucI=0; ucI<C_ucErmNbOfErrorChannel; ucI++)
{
g_stErmTheLastErrorInfo[ucI].uwLastErr = C_uwErmNoErr;
g_stErmTheLastErrorInfo[ucI].ulChannelId = C_ucErmDefaultChannel;
}
}
#else /* not __MULTI_THREAD_ERROR_MANAGEMENT__*/
g_stErmTheLastErrorInfo.uwLastErr = C_uwErmNoErr;
#endif/*__MULTI_THREAD_ERROR_MANAGEMENT__*/
#ifdef __LOG_FILE_ERROR__
Erm_fn_v_ClearLogFile();
#endif /*__LOG_FILE_ERROR__*/
}
#ifdef __LOG_FILE_ERROR__
{
char szTxt[C_ucSizeOfErrTxt];
sprintf (szTxt,"\t\\->\tThe module : [");
Erm_M_GetModuleInformation(szTxt+strlen(szTxt), g_ucErmNbOfModule);
sprintf (szTxt+strlen(szTxt), "] is initialized with the id #%d", g_ucErmNbOfModule);
Erm_fn_v_PrintErrMsg("Just for information\n", szTxt);
}
#endif /*__LOG_FILE_ERROR__*/
return (g_ucErmNbOfModule++);
}/*Erm_fn_ucInitErrMsg*/
#ifdef __ERROR_STRINGS__
/* ##F#===================================================================================
NAME : Erm_fn_szGetLastErrorString
DESCRIPTION : Get last error string
INPUT : one structure Last error info
OUTPUT : Error string
=========================================================================================
CREATION : Pierrick Crepy
=======================================================================================*/
char *Erm_fn_szGetLastErrorString (struct tdstLastErrorInfo_ *stMyLastErrorInfo)
{
unsigned short uwI;
static char szErrTxt[C_ucSizeOfErrTxt];
for ( uwI=0;
g_a_p_stErmGeneralTabErr [stMyLastErrorInfo->ucLastFailedModuleId][uwI].uwErrorId != stMyLastErrorInfo->uwLastErr;
uwI++);/*lint !e722*/
#ifdef __MULTI_THREAD_ERROR_MANAGEMENT__
sprintf(szErrTxt,"Channel Error: %d (0x%x)\nFrom %s: '%s' of %s,\nin the source file '%s' (line:%d):\n\n-> \"%s\" <-\n",
stMyLastErrorInfo->ulChannelId,stMyLastErrorInfo->ulChannelId,
g_a_a_szErmModuleInformationTab[stMyLastErrorInfo->ucLastFailedModuleId][C_ucErmVersionAccessId],
g_a_a_szErmModuleInformationTab[stMyLastErrorInfo->ucLastFailedModuleId][C_ucErmFullNameAccessId],
g_a_a_szErmModuleInformationTab[stMyLastErrorInfo->ucLastFailedModuleId][C_ucErmDateAccessId],
stMyLastErrorInfo->szLastErrFileName, stMyLastErrorInfo->uwLastErrLineNumber,
g_a_p_stErmGeneralTabErr [stMyLastErrorInfo->ucLastFailedModuleId][uwI].szErrorText);
#else /*__MULTI_THREAD_ERROR_MANAGEMENT__*/
sprintf(szErrTxt,"\nFrom %s: '%s' of %s,\nin the source file '%s' (line:%d):\n\n-> \"%s\" <-\n",
g_a_szErmModuleNameTab[stMyLastErrorInfo->ucLastFailedModuleId][C_ucErmVersionAccessId],
g_a_szErmModuleNameTab[stMyLastErrorInfo->ucLastFailedModuleId][C_ucErmFullNameAccessId],
g_a_szErmModuleNameTab[stMyLastErrorInfo->ucLastFailedModuleId][C_ucErmDateAccessId],
stMyLastErrorInfo->szLastErrFileName, stMyLastErrorInfo->uwLastErrLineNumber,
g_a_p_stErmGeneralTabErr [stMyLastErrorInfo->ucLastFailedModuleId][uwI].szErrorText);
#endif /*__MULTI_THREAD_ERROR_MANAGEMENT__*/
Erm_M_CheckLenOfTxtWithoutUpdate (szErrTxt);
return (szErrTxt);
}/* Erm_fn_szGetLastErrorString */
#endif /*__ERROR_STRINGS__*/
/* ##F#===================================================================================
NAME : Erm_fn_uwCheckError
DESCRIPTION : Check error
INPUT : Module Id
Channel Id
OUTPUT : Last error info
=========================================================================================
CREATION : Pierrick Crepy
=======================================================================================*/
unsigned short Erm_fn_uwCheckError(unsigned char ucModuleId, unsigned long ulChannelId)
{
#ifdef __MULTI_THREAD_ERROR_MANAGEMENT__
unsigned char ucI;
for (ucI=0;
( ucI < C_ucErmNbOfErrorChannel)&&
(g_stErmTheLastErrorInfo[ucI].uwLastErr != C_uwErmNoErr) &&
(g_stErmTheLastErrorInfo[ucI].ulChannelId != ulChannelId);
ucI++){};/*lint !e722*/
if (ucI >= C_ucErmNbOfErrorChannel)
return C_uwErmNoErr;
else
{
if ((g_stErmTheLastErrorInfo[ucI].ulChannelId == ulChannelId) &&
(g_stErmTheLastErrorInfo[ucI].uwLastErr !=C_uwErmNoErr) &&
(g_stErmTheLastErrorInfo[ucI].ucLastFailedModuleId != ucModuleId))
{
char szTxt[C_ucSizeOfErrTxt];
#ifdef __ERROR_STRINGS__
sprintf (szTxt, "Strange!\nThe Erm_fn_uwCheckError macro is called for the specific Module (%s),\nbut the last error does not come from this module.", g_a_a_szErmModuleInformationTab[ucModuleId][C_ucErmFullNameAccessId]);
#endif /*__ERROR_STRINGS__*/
Erm_M_CheckLenOfTxt (szTxt);
Erm_fn_v_PrintErrMsg(szTxt,"");
Erm_M_PrintInfoWindow(szTxt,"");
}
return g_stErmTheLastErrorInfo[ucI].uwLastErr;
}
#else /* not __MULTI_THREAD_ERROR_MANAGEMENT__*/
if ((g_stErmTheLastErrorInfo.uwLastErr !=C_uwErmNoErr) && (g_stErmTheLastErrorInfo.ucLastFailedModuleId != ucModuleId))
{
char szTxt[C_ucSizeOfErrTxt];
#ifdef __ERROR_STRINGS__
sprintf (szTxt, "Strange!\nThe Erm_fn_uwCheckError macro is called for the specific Module (%s),\nbut the last error does not come from this module.", g_a_a_szErmModuleNameTab[ucModuleId][C_ucErmFullNameAccessId]);
#else /*__ERROR_STRINGS__*/
sprintf (szTxt, "Strange!\nThe Erm_fn_uwCheckError macro is called for the specific Module,\nbut the last error does not come from this module.");
#endif /*__ERROR_STRINGS__*/
Erm_M_CheckLenOfTxt (szTxt);
Erm_fn_v_PrintErrMsg(szTxt,"");
Erm_M_PrintInfoWindow(szTxt,"");
}
return (g_stErmTheLastErrorInfo.uwLastErr);
#endif /*__MULTI_THREAD_ERROR_MANAGEMENT__*/
}/*Erm_fn_uwCheckError*//*lint !e715: ulChannelId (line 94) not referenced*/
#ifdef __MULTI_THREAD_ERROR_MANAGEMENT__
/* ##F#===================================================================================
NAME : Erm_fn_p_stFindstMyLastErrorInfo
DESCRIPTION : Find structure ladt error info
INPUT : Channel Id
OUTPUT : Last error info structure
=========================================================================================
CREATION : Pierrick Crepy
=======================================================================================*/
tdstLastErrorInfo *Erm_fn_p_stFindstMyLastErrorInfo(unsigned long ulChannelId)
{
unsigned char ucI;
for ( ucI=0;
( ucI < C_ucErmNbOfErrorChannel)&&
(g_stErmTheLastErrorInfo[ucI].uwLastErr != C_uwErmNoErr) &&
(g_stErmTheLastErrorInfo[ucI].ulChannelId != ulChannelId);
ucI++){};/*lint !e722*/
if (ucI >= C_ucErmNbOfErrorChannel)
{
/* there is no error for this Channel but, there is no more space for an other error. */
return NULL;
}
else
{
/*
here, we have :
- g_stErmTheLastErrorInfo[ucI].ulChannelId = ulChannel I.e. there is already an error for the Channel
Or
- g_stErmTheLastErrorInfo[ucI].ulChannelId != ulChannel and g_stErmTheLastErrorInfo[ucI] is the last error (!= C_uwErmNoErr)
*/
return g_stErmTheLastErrorInfo+ucI;
}
}/*Erm_fn_p_stFindstMyLastErrorInfo*/
#endif /*__MULTI_THREAD_ERROR_MANAGEMENT__*/
/* ##F#===================================================================================
NAME : Erm_fn_ClearLastError
DESCRIPTION : Clear last error
INPUT : Channel Id
File Name
Line Number
=========================================================================================
CREATION : Pierrick Crepy
=======================================================================================*/
/* Oliv' */
#ifndef U64
void Erm_fn_ClearLastError(unsigned long ulChannelId, char * p_cFileName, unsigned short uwLineNumber)
#else /* U64 */
void Erm_fn_ClearLastError(unsigned long ulChannelId)
#endif /* U64 */
#ifndef __MULTI_THREAD_ERROR_MANAGEMENT__
{
tdstLastErrorInfo *p_stMyLastErrorInfo;
p_stMyLastErrorInfo = Erm_M_p_stFindstMyLastErrorInfo(ulMyChannelId);
if ((p_stMyLastErrorInfo != NULL) && (p_stMyLastErrorInfo->uwLastErr != C_uwErmNoErr))
{
p_stMyLastErrorInfo->uwLastErr = C_uwErmNoErr;
Erm_M_AffectUlChannelId(p_stMyLastErrorInfo->ulChannelId, C_ucErmDefaultChannel);
Erm_fn_v_PrintErrMsg("Explicit request for clear of the last error","");
/*Erm_M_PrintTraceClearWindow();*/
}
else
{
Erm_M_PrintTraceUnUsefullClearWindow();
Erm_fn_v_PrintErrMsg("Explicit request for clear of the last error.\nBut there is no error !","");
Erm_M_StopForDebugForTraceClear("Erm_fn_ClearLastError not necessary" ,p_cFileName, uwLineNumber);
}
}/*Erm_fn_ClearLastError without __MULTI_THREAD_ERROR_MANAGEMENT__ defined*/
#else /* __MULTI_THREAD_ERROR_MANAGEMENT__ is defined*/
{
unsigned char ucJ;
unsigned char ucI;
for ( ucI=0;
( ucI < C_ucErmNbOfErrorChannel)&&
(g_stErmTheLastErrorInfo[ucI].uwLastErr != C_uwErmNoErr) &&
(g_stErmTheLastErrorInfo[ucI].ulChannelId != ulChannelId);
ucI++){};/*lint !e722*/
if (ucI < C_ucErmNbOfErrorChannel && (g_stErmTheLastErrorInfo[ucI].uwLastErr != C_uwErmNoErr))
{
(g_stErmTheLastErrorInfo+ucI)->uwLastErr = C_uwErmNoErr;
Erm_M_AffectUlChannelId((g_stErmTheLastErrorInfo+ucI)->ulChannelId, C_ucErmDefaultChannel);
Erm_fn_v_PrintErrMsg("Explicit request for clear of the last error","");
Erm_M_PrintTraceClearWindow();
/*Move down all other errors*/
ucJ= (unsigned char) (ucI+1);
if ((ucJ < C_ucErmNbOfErrorChannel) && (g_stErmTheLastErrorInfo[ucJ].uwLastErr != C_uwErmNoErr))
{
for ( ;
( ucJ < C_ucErmNbOfErrorChannel)&&
(g_stErmTheLastErrorInfo[ucJ].uwLastErr != C_uwErmNoErr);
ucJ++)
{
g_stErmTheLastErrorInfo[ucJ-1] = g_stErmTheLastErrorInfo[ucJ];
g_stErmTheLastErrorInfo[ucJ].uwLastErr = C_uwErmNoErr;
Erm_M_AffectUlChannelId(g_stErmTheLastErrorInfo[ucJ].ulChannelId, C_ucErmDefaultChannel);
}
}
}
else
{
Erm_M_PrintTraceUnUsefullClearWindow();
Erm_fn_v_PrintErrMsg("Explicit request for clear of the last error.\n But there is no error !","");
Erm_M_StopForDebugForTraceClear("Erm_fn_ClearLastError not necessary" ,p_cFileName, uwLineNumber);
}
}/*Erm_fn_ClearLastError with __MULTI_THREAD_ERROR_MANAGEMENT__ defined*/
#endif /*__MULTI_THREAD_ERROR_MANAGEMENT__*/
/* ##F#===================================================================================
NAME : Erm_fn_v_PrintModuleList
DESCRIPTION : Actually do nothimg
=========================================================================================
CREATION : Pierrick Crepy
=======================================================================================*/
#ifndef _FIRE_DEADCODE_U64_
void Erm_fn_v_PrintModuleList()
{
#ifdef __ERROR_STRINGS__
unsigned char ucModuleId;
for (ucModuleId=0; ucModuleId < g_ucErmNbOfModule; ucModuleId++)
{
}/* end of for module*/
#endif/* __ERROR_STRINGS__*/
}/*Erm_fn_v_PrintModuleList*/
#endif /* _FIRE_DEADCODE_U64_ */
/* ##F#===================================================================================
NAME : Erm_fn_v_UpdateLastError
DESCRIPTION : Update Last Error
INPUT : Id of start of warnings
Module Id
Channel Id
Error number
Debug Data
Open Info Window flag
Stop For Debug flag
Personnal message
File Name
Line number
=========================================================================================
CREATION : Pierrick Crepy
=======================================================================================*/
#ifndef U64
void Erm_fn_v_UpdateLastError(unsigned short uwStartOfWarningsId, unsigned char ucModuleId,
unsigned long ulChannelId, unsigned short uwErrNum,
long lDebugData, unsigned char ucOpenInfoWindow,
unsigned char ucStopForDebug, char *szPersonalMsg,
char * p_cFileName, unsigned short uwLineNumber)
#else /* U64 */
void Erm_fn_v_UpdateLastError(unsigned short uwStartOfWarningsId, unsigned char ucModuleId,
unsigned long ulChannelId, unsigned short uwErrNum,
long lDebugData, unsigned char ucOpenInfoWindow,
unsigned char ucStopForDebug, char *szPersonalMsg)
#endif /* U64 */
{
tdstLastErrorInfo *p_stMyLastErrorInfo;
Erm_M_PrintSeparationBegin();
p_stMyLastErrorInfo = Erm_M_p_stFindstMyLastErrorInfo(ulChannelId);
if (p_stMyLastErrorInfo == NULL)
{
Erm_fn_v_PrintErrMsg("Error in the Erm:","There is no more Channel error to raise the new error.\nPerhaps the constant C_ucErmNbOfErrorChannel is too low.");
Erm_M_PrintInfoWindow("Error in the Erm:","There is no more Channel error to raise the new error.\nPerhaps the constant C_ucErmNbOfErrorChannel is too low.");
/*lint -save -e527*/
Erm_M_Error_Exit();
/*lint -restore*/
}
else
{
if ((*p_stMyLastErrorInfo).uwLastErr != C_uwErmNoErr)
{
Erm_fn_v_PrintErrMsg("Strange!\nThe last error was never treated","");
Erm_M_PrintInfoWindow("Strange!\tThe last error was never treated\n\nThe last error was:",Erm_M_szGetLastErrorString(*p_stMyLastErrorInfo));
}
Erm_M_AffectLastErrorInfo((*p_stMyLastErrorInfo), ModuleName, uwErrNum, ulChannelId, lDebugData, ucModuleId, p_cFileName, uwLineNumber);
if ((*p_stMyLastErrorInfo).uwLastErr < uwStartOfWarningsId)
{
/*this is a Fatal Error*/
/*lint -save -e506 -e774*/
if (szPersonalMsg == NULL)
{
/*lint -restore*/
Erm_fn_v_PrintErrMsg("Fatale error: ",Erm_M_szGetLastErrorString((*p_stMyLastErrorInfo)));
#ifndef FINAL_VERSION
#ifdef U64
M_PrintfN64(("ucModuleId=%d; uwErrNum=%d\n", ucModuleId, uwErrNum));
if((ucModuleId==1)&&(uwErrNum==35)) /* bloc full*/
{
char szDebugMessage[64];
strcpy(szDebugMessage,"Increase ");
switch(g_ucModuleIdForDebug)
{
case 0:
if(GAM_fn_bIsEngineInLevelMode())
strcat(szDebugMessage,"ACPMemory");
else
strcat(szDebugMessage,"ACPFixMemory");
break;
case 1:
strcat(szDebugMessage,"AIMemory");
break;
case 2:
if(GAM_fn_bIsEngineInLevelMode())
strcat(szDebugMessage,"GameLevelMemorySize");
else
strcat(szDebugMessage,"GameFixMemorySize");
break;
case 3:
strcat(szDebugMessage,"SAIMemorySize");
break;
case 4:
strcat(szDebugMessage,"TMPLevelMemory");
break;
default:
strcat(szDebugMessage,"???");
break;
}
GLD_fn_vDisplayMessage(szDebugMessage);
}
else
{
char szDebugMessage[64];
sprintf(szDebugMessage,"Fatal error %d in module %d",uwErrNum,ucModuleId);
GLD_fn_vDisplayMessage(szDebugMessage);
}
ASM_BREAK;
#endif /*U64*/
#endif /* !FINAL_VERSION */
Erm_M_PrintInfoWindow("Fatale error: ",Erm_M_szGetLastErrorString((*p_stMyLastErrorInfo)));
}
else
{
Erm_fn_v_PrintErrMsgWithPersonalMsg("\nFatale error: ",Erm_M_szGetLastErrorString((*p_stMyLastErrorInfo)), szPersonalMsg);
/*lint -save -e560*/
Erm_M_PrintInfoWindowWithPersonalMsg("Fatale error: ",Erm_M_szGetLastErrorString((*p_stMyLastErrorInfo)), szPersonalMsg);
/*lint -restore*/
}
/*lint -save -e527*/
Erm_M_Error_Exit();
/*lint -restore*/
}
else
{
/*this is warning error*/
/*lint -save -e506 -e774*/
if(szPersonalMsg == NULL)
{
/*lint -restore*/
Erm_fn_v_PrintErrMsg("Warning error: ",Erm_M_szGetLastErrorString((*p_stMyLastErrorInfo)));
#ifndef FINAL_VERSION
#ifdef U64
M_PrintfN64(("Warning error: %s",Erm_M_szGetLastErrorString((*p_stMyLastErrorInfo))));
M_PrintfN64(("ucModuleId=%d; uwErrNum=%d\n", ucModuleId, uwErrNum));
if((ucModuleId==1)&&(uwErrNum==35)) /* bloc full*/
{
char szDebugMessage[64];
strcpy(szDebugMessage,"Increase ");
switch(g_ucModuleIdForDebug)
{
case 0:
strcat(szDebugMessage,"ACPMemory");
break;
case 1:
strcat(szDebugMessage,"AIMemory");
break;
case 2:
strcat(szDebugMessage,"GameLevelMemorySize");
break;
case 3:
strcat(szDebugMessage,"SAIMemorySize");
break;
case 4:
strcat(szDebugMessage,"TMPLevelMemory");
break;
default:
strcat(szDebugMessage,"???");
break;
}
/* GLD_fn_vDisplayMessage(szDebugMessage);*/
M_PrintfN64(("%s\n", szDebugMessage));
}
else
{
char szDebugMessage[64];
strcpy(szDebugMessage,"Fatal error");
/* GLD_fn_vDisplayMessage(szDebugMessage);*/
M_PrintfN64(("%s\n", szDebugMessage));
}
/* ASM_BREAK;*/
#endif /*U64*/
#endif /* !FINAL_VERSION */
/*lint -save -e506 -e774*/
if (ucOpenInfoWindow)
/*lint -restore*/
{
Erm_M_PrintInfoWindow("Warning error: ",Erm_M_szGetLastErrorString((*p_stMyLastErrorInfo)));
}
}
else
{
Erm_fn_v_PrintErrMsgWithPersonalMsg("Warning error: ",Erm_M_szGetLastErrorString((*p_stMyLastErrorInfo)), szPersonalMsg);
/*lint -save -e506 -e774*/
if (ucOpenInfoWindow)
/*lint -restore*/
{
/*lint -save -e560*/
Erm_M_PrintInfoWindowWithPersonalMsg("Warning error: ",Erm_M_szGetLastErrorString((*p_stMyLastErrorInfo)), szPersonalMsg);
/*lint -restore*/
}
}
/*lint -save -e560 -e506 -e774*/
DebugIf((ucStopForDebug != C_ucNeverStopForDebug), Erm_M_AnErrorWasRaised());
/*lint -restore*/
}
}
Erm_M_PrintSeparationEnd();
}/*Erm_fn_v_UpdateLastError*/
#ifdef __ENABLE_DISPLAY_ERROR_WINDOW__
/* ##F#===================================================================================
NAME : Erm_fn_PrintInfoWindow
DESCRIPTION : Print Info in window
INPUT : string1 to print
string2 to print
=========================================================================================
CREATION : Pierrick Crepy
=======================================================================================*/
void Erm_fn_PrintInfoWindow(char * szTxt1,char * szTxt2)
{
char szMyTxt [C_ucSizeOfErrTxt];
sprintf(szMyTxt, "%s\n%s\n", szTxt1, szTxt2);
Erm_M_CheckLenOfTxtWithoutUpdate(szMyTxt);
Erm_fn_iMessageBox(szMyTxt, "Erm Information Window", MB_TOPMOST| MB_ICONEXCLAMATION | MB_OK);\
}
/* ##F#===================================================================================
NAME : Erm_fn_PrintInfoWindowWithPersonalMsg
DESCRIPTION : Print Info in window
INPUT : string1 to print
string2 to print
string3 to print
=========================================================================================
CREATION : Pierrick Crepy
=======================================================================================*/
void Erm_fn_PrintInfoWindowWithPersonalMsg(char * szTxt1,char * szTxt2,char * szTxt3)
{
char szMyTxt [C_ucSizeOfErrTxt];
sprintf(szMyTxt, "%s\n%s\n%s\n", szTxt1, szTxt2, szTxt3);
Erm_M_CheckLenOfTxtWithoutUpdate(szMyTxt);
Erm_fn_iMessageBox(szMyTxt, "Erm Information Window", MB_TOPMOST| MB_ICONEXCLAMATION | MB_OK);
}
#endif /*__ENABLE_DISPLAY_ERROR_WINDOW__*/

View File

@@ -0,0 +1,129 @@
# Microsoft Developer Studio Project File - Name="ERM" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=ERM - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "ERM.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "ERM.mak" CFG="ERM - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "ERM - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "ERM - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "ERM - Win32 Retail" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""$/cpa/tempgrp/ERM", VLCAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
!IF "$(CFG)" == "ERM - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:\cpa\lib"
# PROP Intermediate_Dir "Tmp\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G5 /W3 /GX /O2 /I "x:\cpa\Public" /D "NDEBUG" /D "VISUAL" /D "WIN32" /D "USE_PROFILER" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"x:\cpa\lib\ERMP5_vr.lib"
!ELSEIF "$(CFG)" == "ERM - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "x:\CPa\Lib"
# PROP Intermediate_Dir "Tmp\Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G5 /W3 /GX /Z7 /Od /I "x:\cpa\public" /D "_DEBUG" /D "VISUAL" /D "WIN32" /D "USE_PROFILER" /D "MTH_CHECK" /D "CPA_WANTS_EXPORT" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"x:\CPa\Lib\ERMP5_vd.lib"
!ELSEIF "$(CFG)" == "ERM - Win32 Retail"
# PROP BASE Use_MFC 2
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ERM___Wi"
# PROP BASE Intermediate_Dir "ERM___Wi"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:/cpa/lib"
# PROP Intermediate_Dir "tmp/retail"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G5 /MD /W3 /GX /O2 /I "x:\cpa\Public" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "VISUAL" /D "CPA_WANTS_EXPORT" /D "_AFXDLL" /FD /c
# SUBTRACT BASE CPP /Fr /YX
# ADD CPP /nologo /G5 /W3 /GX /O2 /I "x:\cpa\Public" /D "NDEBUG" /D "VISUAL" /D "WIN32" /D "RETAIL" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"x:\cpa\lib\ERMP5_vr.lib"
# ADD LIB32 /nologo /out:"x:\cpa\lib\ERMP5_vf.lib"
!ENDIF
# Begin Target
# Name "ERM - Win32 Release"
# Name "ERM - Win32 Debug"
# Name "ERM - Win32 Retail"
# Begin Source File
SOURCE=.\Specif\CpaErPC.c
# End Source File
# Begin Source File
SOURCE=.\CpaError.c
# End Source File
# Begin Source File
SOURCE=..\..\Public\Erm\CpaError.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\ERM.h
# End Source File
# Begin Source File
SOURCE=.\ERM.mak
# End Source File
# Begin Source File
SOURCE=.\PrivErm.h
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,237 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="ERM"
ProjectGUID="{518766C8-D49C-43F8-A70F-E5D7C6D20401}"
SccProjectName="&quot;$/cpa/tempgrp/ERM&quot;, VLCAAAAA"
SccAuxPath=""
SccLocalPath="."
SccProvider="MSSCCI:NXN alienbrain">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Retail|Win32"
OutputDirectory="x:/cpa/lib"
IntermediateDirectory=".\tmp/retail"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="x:\cpa\Public"
PreprocessorDefinitions="NDEBUG;VISUAL;WIN32;RETAIL"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\tmp/retail/ERM.pch"
AssemblerListingLocation=".\tmp/retail/"
ObjectFile=".\tmp/retail/"
ProgramDataBaseFileName=".\tmp/retail/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="x:\cpa\lib\ERMP5_vf.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory="x:\CPa\Libd"
IntermediateDirectory=".\Tmp\Debug"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="x:\cpa\public"
PreprocessorDefinitions="_DEBUG;VISUAL;WIN32;USE_PROFILER;MTH_CHECK;CPA_WANTS_EXPORT"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\Tmp\Debug/ERM.pch"
AssemblerListingLocation=".\Tmp\Debug/"
ObjectFile=".\Tmp\Debug/"
ProgramDataBaseFileName=".\Tmp\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="1"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="x:\CPa\Libd\ERMP5_vd.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="x:\cpa\lib"
IntermediateDirectory=".\Tmp\Release"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="x:\cpa\Public"
PreprocessorDefinitions="NDEBUG;VISUAL;WIN32;USE_PROFILER"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\Tmp\Release/ERM.pch"
AssemblerListingLocation=".\Tmp\Release/"
ObjectFile=".\Tmp\Release/"
ProgramDataBaseFileName=".\Tmp\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="x:\cpa\lib\ERMP5_vr.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="Specif\CpaErPC.c">
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="CpaError.c">
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\Public\Erm\CpaError.h">
</File>
<File
RelativePath="..\..\Public\ERM.h">
</File>
<File
RelativePath="ERM.mak">
</File>
<File
RelativePath="PrivErm.h">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,441 @@
/* ##H_FILE#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FILE : PrivErm.h
DESCRIPTION : Module : Error Manager (Erm)
This a private header file in witch there are all the traget(define) that
you can change as you like inside of the library.
Without any problem for the outside.
-> __STOP_ON_ERROR_RAISED__ : this define will open
a window in order to ask you if you want to stop and debug
-> __LOG_FILE_ERROR__ : write every error (independently of its type).
-> __ENABLE_DISPLAY_ERROR_WINDOW__ Display errors on the screen in a window
-> __TRACE_CLEAR__ : this define will open a information window for
every call of ClearLastError (if __ENABLE_DISPLAY_ERROR_WINDOW__ is defined)
CREATION DATE : 08/97
VERSION : 1.00/Crepy Pierrick/ Creation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/* ##CONSTANTE#--------------------------------------------------------------------------
Constantes declaration
---------------------------------------------------------------------------------------*/
/*this define will open a window in order to ask you if you want to stop and debug.*/
#define __STOP_ON_ERROR_RAISED__
/* write every error (independently of its type)*/
#define __LOG_FILE_ERROR__
/*Display errors on the screen in a window*/
#define __ENABLE_DISPLAY_ERROR_WINDOW__
/*this define will open a information window for every call of ClearLastError (if __ENABLE_DISPLAY_ERROR_WINDOW__ is defined)*/
/*#define __TRACE_CLEAR__*/
#if !defined(__DEBUG_ERROR__)
/* yes you can define __STOP_ON_ERROR_RAISED__ without __DEBUG_ERROR__ and _DEBUG*/
#undef __STOP_ON_ERROR_RAISED__
#endif /*!defined(__DEBUG_ERROR__)*/
#if !defined(__ERROR_STRINGS__)
#undef __LOG_FILE_ERROR__
/*Display errors on the screen in a window*/
#undef __ENABLE_DISPLAY_ERROR_WINDOW__
/*this define will open a information window for every call of ClearLastError (if __ENABLE_DISPLAY_ERROR_WINDOW__ is defined)*/
#undef __TRACE_CLEAR__
#endif /*!defined(__ERROR_STRINGS__)*/
#if !defined(_DEBUG)
/* yes you can define __STOP_ON_ERROR_RAISED__ without __DEBUG_ERROR__ and _DEBUG*/
#undef __STOP_ON_ERROR_RAISED__
/*#undef __LOG_FILE_ERROR__ */
/*Display errors on the screen in a window*/
#undef __ENABLE_DISPLAY_ERROR_WINDOW__
/*this define will open a information window for every call of ClearLastError (if __ENABLE_DISPLAY_ERROR_WINDOW__ is defined)*/
#undef __TRACE_CLEAR__
#endif /*!defined(_DEBUG)*/
/* macro definition*/
#ifdef __ENABLE_DISPLAY_ERROR_WINDOW__
/* ##M#===================================================================================
NAME : Erm_M_PrintInfoWindow version asm
DESCRIPTION : Print two string in a window
INPUT : string1 to print
string2 to print
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
/*
#define Erm_M_PrintInfoWindow(szTxt1, szTxt2) \
{ \
char *szMyTxt; \
szMyTxt = Erm_fn_p_cGiveNewErrorString(); \
sprintf(szMyTxt, "%s\n%s\n", szTxt1, szTxt2); \
Erm_M_CheckLenOfTxtWithoutUpdate(szMyTxt); \
Erm_M_MessageBox(NULL, (LPCTSTR) szMyTxt, "Erm Information Window", MB_TOPMOST| MB_ICONEXCLAMATION | MB_OK);\
Erm_fn_vFreeErrorString(szMyTxt); \
}
*/
/*##M#===================================================================================
NAME : Erm_M_PrintInfoWindow version asm
DESCRIPTION : Print three string in a window
INPUT : string1 to print
string2 to print
string3 to print
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
/*
#define Erm_M_PrintInfoWindowWithPersonalMsg(szTxt1, szTxt2, szTxt3) \
{ \
char *szMyTxt; \
szMyTxt=Erm_fn_p_cGiveNewErrorString(); \
szMyTxt [C_ucSizeOfErrTxt]; \
sprintf(szMyTxt, "%s\n%s\n%s\n", szTxt1, szTxt2, szTxt3); \
Erm_M_CheckLenOfTxtWithoutUpdate(szMyTxt); \
Erm_M_MessageBox(NULL, (LPCTSTR) szMyTxt, "Erm Information Window", MB_TOPMOST| MB_ICONEXCLAMATION | MB_OK);\
Erm_fn_vFreeErrorString(szMyTxt); \
}
*/
/* ##M#===================================================================================
NAME : Erm_M_PrintInfoWindow
DESCRIPTION : Print two string in a window
INPUT : string1 to print
string2 to print
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
#define Erm_M_PrintInfoWindow(szTxt1, szTxt2) Erm_fn_PrintInfoWindow(szTxt1, szTxt2)
/* ##M#===================================================================================
NAME : Erm_M_PrintInfoWindowWithPersonalMsg
DESCRIPTION : Print three string in a window
INPUT : string1 to print
string2 to print
string3 to print
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
#define Erm_M_PrintInfoWindowWithPersonalMsg(szTxt1, szTxt2, szTxt3) Erm_fn_PrintInfoWindowWithPersonalMsg(szTxt1, szTxt2, szTxt3)
#else /* no __ENABLE_DISPLAY_ERROR_WINDOW__*/
/* ##M#===================================================================================
NAME : Erm_M_PrintInfoWindow version no __ENABLE_DISPLAY_ERROR_WINDOW__
DESCRIPTION : Do nothing
INPUT : string1
string2
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
#define Erm_M_PrintInfoWindow(szTxt1, szTxt2)
/* ##M#===================================================================================
NAME : Erm_M_PrintInfoWindowWithPersonalMsg version no __ENABLE_DISPLAY_ERROR_WINDOW__
DESCRIPTION : Do nothing
INPUT : string1
string2
string3
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
#define Erm_M_PrintInfoWindowWithPersonalMsg(szTxt1, szTxt2, szTxt3)
#endif /*__ENABLE_DISPLAY_ERROR_WINDOW__*/
#ifdef __TRACE_CLEAR__
#ifdef __ENABLE_DISPLAY_ERROR_WINDOW__
/* ##M#===================================================================================
NAME : Erm_M_PrintTraceClearWindow version TRACE_CLEAR & ENABLE_DISPLAY_ERROR_WINDOW
DESCRIPTION : Message box with "request for clearance of the last error"
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
#define Erm_M_PrintTraceClearWindow() \
{ \
Erm_fn_iMessageBox("Explicit request for clearance of the last error", "Erm Information Window", MB_TOPMOST| MB_ICONEXCLAMATION | MB_OK);\
}
/* ##M#===================================================================================
NAME : Erm_M_PrintTraceUnUsefullClearWindow version TRACE_CLEAR & ENABLE_DISPLAY_ERROR_WINDOW
DESCRIPTION : Message box with "request for clearance of all error"
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
#define Erm_M_PrintTraceUnUsefullClearWindow() \
{ \
Erm_fn_iMessageBox("Explicit request for clearance of the last error\nBut there is no error !", "Erm Information Window", MB_TOPMOST| MB_ICONEXCLAMATION | MB_OK);\
}
#else /* no __ENABLE_DISPLAY_ERROR_WINDOW__ */
/* ##M#===================================================================================
NAME : Erm_M_PrintTraceClearWindow version TRACE_CLEAR & no ENABLE_DISPLAY_ERROR_WINDOW
DESCRIPTION : Do Nothing
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
#define Erm_M_PrintTraceClearWindow()
/* ##M#===================================================================================
NAME : Erm_M_PrintTraceUnUsefullClearWindow version TRACE_CLEAR & no ENABLE_DISPLAY_ERROR_WINDOW
DESCRIPTION : Do nothing
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
#define Erm_M_PrintTraceUnUsefullClearWindow()
#endif /*__ENABLE_DISPLAY_ERROR_WINDOW__*/
#else /*__TRACE_CLEAR__*/
/* ##M#===================================================================================
NAME : Erm_M_PrintTraceClearWindow version no TRACE_CLEAR & no ENABLE_DISPLAY_ERROR_WINDOW
DESCRIPTION : Do Nothing
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
#define Erm_M_PrintTraceClearWindow()
/* ##M#===================================================================================
NAME : Erm_M_PrintTraceUnUsefullClearWindow version no TRACE_CLEAR & no ENABLE_DISPLAY_ERROR_WINDOW
DESCRIPTION : Do nothing
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
#define Erm_M_PrintTraceUnUsefullClearWindow()
#endif /*__TRACE_CLEAR__*/
#ifdef __ENABLE_DISPLAY_ERROR_WINDOW__
#ifndef WATCOM
/* ##M#===================================================================================
NAME : Erm_M_StopForDebug version no WATCOM & ENABLE_DISPLAY_ERROR_WINDOW
DESCRIPTION : Allow stop for debug
INPUT : string
File Name
Line number
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
#define Erm_M_StopForDebug(szTxt ,p_cFileName, uwLineNumber) \
{ \
char *szMyDbTxt; \
szMyDbTxt = Erm_fn_p_cGiveNewErrorString(); \
sprintf (szMyDbTxt, "%s\nStop in '%s' source file (line:%d).\nDo you want to stop for debug ?", szTxt ,p_cFileName, uwLineNumber);\
Erm_M_CheckLenOfTxtWithoutUpdate(szMyDbTxt); \
if (Erm_fn_iMessageBox(szMyDbTxt, "Erm Information Window", MB_TOPMOST| MB_ICONEXCLAMATION |MB_YESNO)==IDYES)\
{ \
__asm \
{ \
int 3h \
} \
} \
Erm_fn_vFreeErrorString(szMyDbTxt); \
}
#else /* WATCOM */
/* ##M#===================================================================================
NAME : Erm_M_StopForDebug version WATCOM & ENABLE_DISPLAY_ERROR_WINDOW
DESCRIPTION : Allow stop for debug
INPUT : string
File Name
Line number
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
void Watcom_Interupt3h(void);
#pragma aux Watcom_Interupt3h = "int 0x03" value [eax] modify [eax];
#define Erm_M_StopForDebug(szTxt ,p_cFileName, uwLineNumber) \
{ \
char *szMyDbTxt; \
szMyDbTxt= Erm_fn_p_cGiveNewErrorString(); \
sprintf (szMyDbTxt, "%s\nStop in '%s' source file (line:%d).\nDo you want to stop for debug ?", szTxt, p_cFileName, uwLineNumber);\
Erm_M_CheckLenOfTxtWithoutUpdate(szMyDbTxt); \
if (Erm_fn_iMessageBox(szMyDbTxt, "Erm Information Window", MB_TOPMOST| MB_ICONEXCLAMATION |MB_YESNO)==IDYES)\
{ \
Watcom_Interupt3h();/*Interruption*/ \
} \
Erm_fn_vFreeErrorString(szMyDbTxt); \
}
#endif /* _VISUAL*/
#else /*__ENABLE_DISPLAY_ERROR_WINDOW__*/
/* ##M#===================================================================================
NAME : Erm_M_StopForDebug version no ENABLE_DISPLAY_ERROR_WINDOW
DESCRIPTION : Do nothing
INPUT : string
File Name
Line number
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
#define Erm_M_StopForDebug(szTxt, p_cFileName, uwLineNumber)
#endif /*__ENABLE_DISPLAY_ERROR_WINDOW__*/
#ifdef __TRACE_CLEAR__
/* ##M#===================================================================================
NAME : Erm_M_StopForDebugForTraceClear version TRACE_CLEAR
DESCRIPTION : Do Stop for debug
INPUT : string
File Name
Line number
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
#define Erm_M_StopForDebugForTraceClear(szTxt ,p_cFileName, uwLineNumber) Erm_M_StopForDebug(szTxt ,p_cFileName, uwLineNumber)
#else /*__TRACE_CLEAR__*/
/* ##M#===================================================================================
NAME : Erm_M_StopForDebugForTraceClear version no TRACE_CLEAR
DESCRIPTION : Do nothing
INPUT : string
File Name
Line number
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
#define Erm_M_StopForDebugForTraceClear(szTxt ,p_cFileName, uwLineNumber)
#endif /*__TRACE_CLEAR__*/
#ifdef __ENABLE_DISPLAY_ERROR_WINDOW__
/* ##M#===================================================================================
NAME : Erm_M_CheckLenOfTxtWithoutUpdate version ENABLE_DISPLAY_ERROR_WINDOW
DESCRIPTION : Check lenght of text
INPUT : string
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
/*this macro sould be use in the macro because Erm_M_CheckLenOfTxt use Erm_M_update and Erm_M_update have to test the overflow string*/
#define Erm_M_CheckLenOfTxtWithoutUpdate(szTxt) \
{ \
if (strlen(szTxt)>C_ucSizeOfErrTxt-1 /*-1 for the '\0'*/) \
{ \
Erm_fn_iMessageBox("The string for The Error message is too short, please change C_ucSizeOfErrTxt", "Erm Information Window", MB_TOPMOST| MB_ICONEXCLAMATION | MB_OK);\
Erm_fn_v_PrintErrMsg("Error in the Erm:","The string for The Error message is too short, please change C_ucSizeOfErrTxt");\
} \
}
#else /*__ENABLE_DISPLAY_ERROR_WINDOW__*/
/* ##M#===================================================================================
NAME : Erm_M_CheckLenOfTxtWithoutUpdate version no ENABLE_DISPLAY_ERROR_WINDOW
DESCRIPTION : Do nothing
INPUT : string
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
#define Erm_M_CheckLenOfTxtWithoutUpdate(szTxt)
#endif /*__ENABLE_DISPLAY_ERROR_WINDOW__*/
#ifdef __STOP_ON_ERROR_RAISED__
/* ##M#===================================================================================
NAME : Erm_M_AnErrorWasRaised version STOP_ON_ERROR_RAISED
DESCRIPTION : Function an error was raised
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
#define Erm_M_AnErrorWasRaised() Erm_fn_vAnErrorWasRaised ()
#else /*__STOP_ON_ERROR_RAISED__*/
/* ##M#===================================================================================
NAME : Erm_M_AnErrorWasRaised version no STOP_ON_ERROR_RAISED
DESCRIPTION : Do nothing
=========================================================================================
CREATION : Crepy Pierrick
=======================================================================================*/
#define Erm_M_AnErrorWasRaised()
#endif /*__STOP_ON_ERROR_RAISED__*/
/* ##M===================================================================================
NAME : Erm_M_Error_Exit
DESCRIPTION : Do an error was raised and exit
=========================================================================================
CREATION : Pierrick Crepy
MODIFICATION : Carlos Torres 12/01/98 -> Call a callback before exit
=======================================================================================*/
#define Erm_M_Error_Exit(){ \
Erm_M_AnErrorWasRaised(); \
if(p_fn_ExitAppliCallBack) \
p_fn_ExitAppliCallBack(); \
exit(-1); \
}
/* ##FUNCDEF#----------------------------------------------------------------------------
Functions definition
---------------------------------------------------------------------------------------*/
/* prototype definition*/
#ifdef __STOP_ON_ERROR_RAISED__
/* ##F#===================================================================================
NAME : Erm_fn_vAnErrorWasRaised version STOP_ON_ERROR_RAISED
DESCRIPTION : Call when an error was raised
=========================================================================================
CREATION : Pierrick Crepy
=======================================================================================*/
void Erm_fn_vAnErrorWasRaised(void);
#endif /*__STOP_ON_ERROR_RAISED__*/
#ifdef __ENABLE_DISPLAY_ERROR_WINDOW__
/* ##F#===================================================================================
NAME : Erm_fn_PrintInfoWindow version ENABLE_DISPLAY_ERROR_WINDOW
DESCRIPTION : Print Info in window
INPUT : string1 to print
string2 to print
=========================================================================================
CREATION : Pierrick Crepy
=======================================================================================*/
void Erm_fn_PrintInfoWindow(char *,char *);
/* ##F#===================================================================================
NAME : Erm_fn_PrintInfoWindowWithPersonalMsg version ENABLE_DISPLAY_ERROR_WINDOW
DESCRIPTION : Print Info in window
INPUT : string1 to print
string2 to print
string3 to print
=========================================================================================
CREATION : Pierrick Crepy
=======================================================================================*/
void Erm_fn_PrintInfoWindowWithPersonalMsg(char *,char *,char *);
#endif /*__ENABLE_DISPLAY_ERROR_WINDOW__*/
/* ##GLOBVAR#----------------------------------------------------------------------------
Globale variable declaration
---------------------------------------------------------------------------------------*/
/* Thread Id to request message box*/
#ifdef WIN32
extern HWND g_hWndHdl4Request;
#endif
/*CallBack de fermeture de l'appli */
extern void (*p_fn_ExitAppliCallBack)();

View File

@@ -0,0 +1,250 @@
#include "Erm/CpaError.h"
#include "..\PrivErm.h"
int Erm_fn_iMessageBox(char * _szText,char * _szTitle,unsigned int _uiStyle);
void Erm_fn_vSetWndHdl4Request(HWND hWin);
HWND Erm_fn_hGetWndHdl4Request();
void Erm_fn_vAnErrorWasRaised();
HWND g_hWndHdl4Request = C_hNoWindowTreatment;
/* ##F===================================================================================
NAME : Erm_fn_iMessageBox
DESCRIPTION : Display a message box sending
+ sending a message to the window application
+ or build a message box
INPUT : Text to display in the box
Title
Style (ex : MB_OK | MB_ICONSTOP )
OUTPUT : Result of the message box, depends on style
=========================================================================================
CREATION : Carlos Torres
=======================================================================================*/
int Erm_fn_iMessageBox(char * _szText,char * _szTitle,unsigned int _uiStyle) {
/* Send a display box request message*/
if (g_hWndHdl4Request != C_hNoWindowTreatment) {
tdstMsgBox stMsgBox;
stMsgBox.szText = _szText;
stMsgBox.szTitle = _szTitle;
stMsgBox.uiStyle = _uiStyle;
/* request the display of a message box + block until treatment of message*/
SendMessage(g_hWndHdl4Request,WM_MESSAGEBOX,C_uiWinCm_RequestMessageBox, (LPARAM)&stMsgBox);
return stMsgBox.iResult;
}
/* display a message box*/
else
return MessageBox(NULL,_szText,_szTitle,_uiStyle);
}
/* ##F===================================================================================
NAME : Erm_fn_vSetWndHdl4Request
DESCRIPTION : set Window Handle that receive the request
(it is used to send message for creating message box)
INPUT : Window Handle
=========================================================================================
LAST MODIFICATION : Carlos Torres / 04/12/1997
=======================================================================================*/
void Erm_fn_vSetWndHdl4Request(HWND hWin) {
g_hWndHdl4Request = hWin;
}
/* ##F===================================================================================
NAME : Erm_fn_hGetWndHdl4Request
DESCRIPTION : get window handle use for message box request
(it is used to send message for creating message box)
OUTPUT : Thread Id
=========================================================================================
LAST MODIFICATION : Carlos Torres / 04/12/1997
=======================================================================================*/
HWND Erm_fn_hGetWndHdl4Request() {
return g_hWndHdl4Request;
}
/* ##F#===================================================================================
NAME : Erm_fn_vAnErrorWasRaised
DESCRIPTION : Call when an error was raised
=========================================================================================
CREATION : Pierrick Crepy
=======================================================================================*/
void Erm_fn_vAnErrorWasRaised()
{
#ifdef __STOP_ON_ERROR_RAISED__
#if defined(_DEBUG)
#ifdef __ENABLE_DISPLAY_ERROR_WINDOW__
if (Erm_fn_iMessageBox("Do you want to Debug ?", "Erm Information Window", MB_TOPMOST| MB_ICONEXCLAMATION |MB_YESNO)==IDYES)
#endif /*__ENABLE_DISPLAY_ERROR_WINDOW__*/
{
#ifndef WATCOM
__asm
{
int 3h
}
#else /* WATCOM*/
/*This management for Watcon is new since ERM V5.0.7*/
Watcom_Interupt3h();/*Interruption*/
#endif /*WATCOM*/
}
#endif /*_DEBUG*/
#endif /*__STOP_ON_ERROR_RAISED__*/
}/*Erm_fn_vAnErrorWasRaised*/
/* ##F#===================================================================================
NAME : Erm_fn_v_ClearLogFile
DESCRIPTION : Clear log file
=========================================================================================
CREATION : Pierrick Crepy
=======================================================================================*/
#ifndef _FIRE_DEADCODE_U64_
void Erm_fn_v_ClearLogFile()
{
#ifdef __LOG_FILE_ERROR__
FILE *hpErmLogFile;
DWORD dwError;
remove (C_szErrorLogFileName);/*lint !e534*/
hpErmLogFile = fopen( C_szErrorLogFileName, "w" );
#ifdef _DEBUG
dwError = GetLastError();
if ( dwError && dwError != ERROR_ALREADY_EXISTS)
{
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language*/
(LPTSTR) &lpMsgBuf,
0,
NULL
);/*lint !e534*/
/* Display the string.*/
Erm_fn_iMessageBox(lpMsgBuf, C_szErrorLogFileName, MB_OK|MB_ICONINFORMATION );
/* Free the buffer.*/
LocalFree( lpMsgBuf );
}
#endif /*_DEBUG*/
if (hpErmLogFile)
fclose(hpErmLogFile);
#endif /*__LOG_FILE_ERROR__*/
}/*Erm_fn_v_ClearLogFile*/
#endif /* _FIRE_DEADCODE_U64_ */
/* ##F#===================================================================================
NAME : Erm_fn_v_Printsz
DESCRIPTION : Print String in log file
INPUT : string to be print
=========================================================================================
CREATION : Pierrick Crepy
=======================================================================================*/
void Erm_fn_v_Printsz(char *szTxt)
{
#if !defined(U64)
#ifdef __LOG_FILE_ERROR__
FILE *hpErmLogFile;
hpErmLogFile = fopen( C_szErrorLogFileName, "a" );
if (hpErmLogFile)
{
fprintf (hpErmLogFile, szTxt);
fclose(hpErmLogFile);
}
#endif /*__LOG_FILE_ERROR__*/
#else /* U64 */
M_PrintfN64((szTxt));
#endif /* U64 */
}/*lint !e715*/
/* ##F#===================================================================================
NAME : Erm_fn_v_PrintErrMsg
DESCRIPTION : Print Message in file log
INPUT : string1 to be print
string2 to be print
=========================================================================================
CREATION : Pierrick Crepy
=======================================================================================*/
void Erm_fn_v_PrintErrMsg(char *p_cTxt1, char *p_cTxt2)
{
#ifdef __LOG_FILE_ERROR__
FILE *hpErmLogFile;
hpErmLogFile = fopen( C_szErrorLogFileName, "a" );
if (hpErmLogFile)
{
fprintf (hpErmLogFile, "%s%s\n\n", p_cTxt1, p_cTxt2);
fclose(hpErmLogFile);
}
#endif /*__LOG_FILE_ERROR__*/
}/*lint !e715*/
/* ##F#===================================================================================
NAME : Erm_fn_v_PrintErrMsgWithPersonalMsg
DESCRIPTION : Print Message in file log
INPUT : string1 to be print
string2 to be print
string3 to be print on a new line
=========================================================================================
CREATION : Pierrick Crepy
=======================================================================================*/
void Erm_fn_v_PrintErrMsgWithPersonalMsg(char *p_cTxt1, char *p_cTxt2, char *p_cTxt3)
{
#ifdef __LOG_FILE_ERROR__
FILE *hpErmLogFile;
hpErmLogFile = fopen( C_szErrorLogFileName, "a" );
if (hpErmLogFile)
{
fprintf (hpErmLogFile, "%s%s\n%s\n\n", p_cTxt1, p_cTxt2, p_cTxt3);
fclose(hpErmLogFile);
}
#endif /*__LOG_FILE_ERROR__*/
}/*lint !e715*/
/* ##F#===================================================================================
NAME : Erm_fn_vPrintNameOfAllModules
DESCRIPTION : Print Name Of All Modules
INPUT : File name
=========================================================================================
CREATION : Pierrick Crepy
=======================================================================================*/
#ifndef _FIRE_DEADCODE_U64_
void Erm_fn_vPrintNameOfAllModules(char *szFileName)
{
#ifdef __LOG_FILE_ERROR__
unsigned char ucI;
char szModuleInfo[C_ucSizeOfModuleInformation];
FILE *hpErmLogFile;
hpErmLogFile = fopen( szFileName, "a" );
if (hpErmLogFile)
{
fprintf (hpErmLogFile, "\nList of all initialized modules:\n");
for (ucI=0; ucI<g_ucErmNbOfModule; ucI++)
{
Erm_M_GetModuleInformation (szModuleInfo, ucI);
fprintf (hpErmLogFile, "\t\\->%d\t:%s\n", ucI, szModuleInfo);/*the fprintf is not used with multiple parametrer because U64, then we use sprintf*/
}
fprintf (hpErmLogFile, "\n");
fclose(hpErmLogFile);
}
#endif /*__LOG_FILE_ERROR__*/
}
#endif /* _FIRE_DEADCODE_U64_ */

View File

@@ -0,0 +1,5 @@
SCC = This is a source code control file
[ERM.vcproj]
SCC_Aux_Path = "P4SCC#srvperforce-ma:1666##raymandata##Editor"
SCC_Project_Name = Perforce Project