reman3/Rayman_X/cpa/public/SCR/SCR_RdL0.h

434 lines
16 KiB
C

/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* SCR_RdL0.h
* Scripts, Beaudet Christophe
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
*/
#ifndef __SCR_RdL0_h__Types
#define __SCR_RdL0_h__Types
#ifndef __Only_Types__
#define __SCR_RdL0_h__Undef
#define __Only_Types__
#endif /* !__Only_Types__ */
/*
*=================================================================================================
* Includes.
*=================================================================================================
*/
#include "SCR_Anl.h"
#include "SCR_Cxt.h"
#include "SCR_Vars.h"
#ifdef __SCR_RdL0_h__Undef
#undef __Only_Types__
#undef __SCR_RdL0_h__Undef
#endif /* __SCR_RdL0_h__Undef */
/*
*=================================================================================================
* Constants.
*=================================================================================================
*/
/*
* To export code.
*/
#undef CPA_EXPORT
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else /* CPA_WANTS_IMPORT */
#define CPA_EXPORT
#endif /* CPA_WANTS_IMPORT */
/*
* For SCR_fn_v_RdL0_RegisterCallback
*/
#define SCR_CRC_c_RdL0_ForFile 0x00 /* To register a file callback */
#define SCR_CRC_c_RdL0_ForSection 0x01 /* To register a real section callback */
#define SCR_CRC_c_RdL0_ForBinFile 0x02 /* To register a BINARY file callback */
#define SCR_CRC_c_RdL0_ForBinSection 0x03 /* To register a real BINARY section callback */
/*
* For SCR_fn_v_RdL0_DeleteRegister????
*/
#define SCR_CDR_c_RdL0_Match 0x00 /* Name must exactly match */
#define SCR_CDR_c_RdL0_Contains 0x01 /* Name must contain the parameter */
#define SCR_CDR_c_RdL0_NotContains 0x02 /* Name must not contain the parameter */
#endif /* !__SCR_RdL0_h__Types */
/*
*=================================================================================================
* Macros.
*=================================================================================================
*/
#if !defined(__SCR_RdL0_h__Macros) && !defined(__Only_Types__)
#define __SCR_RdL0_h__Macros
/*
* To get some infos about a relative context.
* Caution cause this is not really protected !
*************************************************
*/
#define SCR_M_RdL0_GetActionSectionNameR(_Offset)\
(fnp_st_Cxt_Compute(_Offset)->stBuffersCopy.a_szBufferName)
#define SCR_M_RdL0_GetIdSectionNameR(_Offset)\
(fnp_st_Cxt_Compute(_Offset)->stBuffersCopy.a_szBufferNameExt)
#define SCR_M_RdL0_GetCompleteSectionNameR(_Offset)\
(fnp_st_Cxt_Compute(_Offset)->stBuffersCopy.a_szBufferCompleteName)
#define SCR_M_RdL0_GetFileNameR(_Offset)\
(fnp_st_Cxt_Compute(_Offset)->p_stOpenFile->stFile.a_szFileName)
#define SCR_M_RdL0_GetOpenFileNameR(_Offset)\
(fnp_st_Cxt_Compute(_Offset)->p_stOpenFile->stFile.a_szOpenFileName)
#define SCR_M_RdL0_ComputeOpenSectionNameR(_Offset, _Dest)\
{\
char *_p_szSectionName_;\
_p_szSectionName_ = strchr(SCR_M_RdL0_GetCompleteSectionNameR(_Offset), SCR_CC_c_Cfg_NameSeparator);\
strcpy(_Dest, SCR_M_RdL0_GetOpenFileNameR(_Offset));\
strcat(_Dest, _p_szSectionName_);\
}
/*
* With preformatted parameters...
*/
#define SCR_M_RdL0_PCHAR(_Param) ((char *) (_Param))
#define SCR_M_RdL0_CHAR(_Param) ((char) *SCR_M_RdL0_PCHAR(_Param))
#define SCR_M_RdL0_PSHORT(_Param) ((short *) (_Param))
#define SCR_M_RdL0_SHORT(_Param) ((short) *SCR_M_RdL0_PSHORT(_Param))
#define SCR_M_RdL0_PLONG(_Param) ((long *) (_Param))
#define SCR_M_RdL0_LONG(_Param) ((long) *SCR_M_RdL0_PLONG(_Param))
#define SCR_M_RdL0_PINT(_Param) ((int *) (_Param))
#define SCR_M_RdL0_INT(_Param) ((int) *SCR_M_RdL0_PINT(_Param))
#define SCR_M_RdL0_PFLOAT(_Param) ((float *) (_Param))
#define SCR_M_RdL0_FLOAT(_Param) ((float) *SCR_M_RdL0_PFLOAT(_Param))
#define SCR_M_RdL0_PDOUBLE(_Param) ((double *) (_Param))
#define SCR_M_RdL0_DOUBLE(_Param) ((double) *SCR_M_RdL0_PDOUBLE(_Param))
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*
* To set only one context value from a relative position.
* _Offset : Offset of context.
* _Num : Number of the result.
* _Value : Value to set.
*/
#define SCR_M_RdL0_SetContextLong(_Offset, _Num, _Value)\
{\
SCR_tdst_Cxt_Description *_p_stContext_;\
\
SCR_M_Dbg_Assert_D((_Num) < SCR_CV_ui_Cfg_MaxResults);\
_p_stContext_ = fnp_st_Cxt_Compute(_Offset);\
_p_stContext_->stContextValues.a_ulValues[_Num] = (unsigned long) (_Value);\
}
/*--*/
#define SCR_M_RdL0_SetContextDouble(_Offset, _Num, _Value)\
{\
SCR_tdst_Cxt_Description *_p_stContext_;\
\
SCR_M_Dbg_Assert_D((_Num) < SCR_CV_ui_Cfg_MaxResults);\
_p_stContext_ = fnp_st_Cxt_Compute(_Offset);\
_p_stContext_->stContextValues.a_dfValues[_Num] = (double) (_Value);\
}
/*
* To get only one context value from a relative position.
* _Offset : Offset of context.
* _Num : Number of the result.
* _Cast : To cast retunr value.
* _Value : To receive the value.
*/
#define SCR_M_RdL0_GetContextLong(_Offset, _Num, _Cast, _Value)\
{\
SCR_tdst_Cxt_Description *_p_stContext_;\
\
SCR_M_Dbg_Assert_D((_Num) < SCR_CV_ui_Cfg_MaxResults);\
_p_stContext_ = fnp_st_Cxt_Compute(_Offset);\
_Value = (_Cast) _p_stContext_->stContextValues.a_ulValues[_Num];\
}
/*--*/
#define SCR_M_RdL0_GetContextDouble(_Offset, _Num, _Value)\
{\
SCR_tdst_Cxt_Description *_p_stContext_;\
\
SCR_M_Dbg_Assert_D((_Num) < SCR_CV_ui_Cfg_MaxResults);\
_p_stContext_ = fnp_st_Cxt_Compute(_Offset);\
_Value = _p_stContext_->stContextValues.a_dfValues[_Num];\
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*
* To set only one file value from a relative position.
* _Offset : Offset of context.
* _Num : Number of the result.
* _Value : Value to set.
*/
#define SCR_M_RdL0_SetFileLong(_Offset, _Num, _Value)\
{\
SCR_tdst_Cxt_Description *_p_stContext_;\
\
SCR_M_Dbg_Assert_D((_Num) < SCR_CV_ui_Cfg_MaxResults);\
_p_stContext_ = fnp_st_Cxt_Compute(_Offset);\
if((_Offset) <= 0)\
{\
SCR_M_Dbg_Assert_D(_p_stContext_->p_stOpenFile != NULL);\
SCR_M_Dbg_AssertStruct_P(SCR_tdst_File_Open, _p_stContext_->p_stOpenFile);\
_p_stContext_->p_stOpenFile->stFileValues.a_ulValues[_Num] = (unsigned long) (_Value);\
}\
else\
_p_stContext_->cFileValuesValid = 1;\
_p_stContext_->stFileValues.a_ulValues[_Num] = (unsigned long) (_Value);\
}
/*--*/
#define SCR_M_RdL0_SetFileDouble(_Offset, _Num, _Value)\
{\
SCR_tdst_Cxt_Description *_p_stContext_;\
\
SCR_M_Dbg_Assert_D((_Num) < SCR_CV_ui_Cfg_MaxResults);\
_p_stContext_ = fnp_st_Cxt_Compute(_Offset);\
if((_Offset) <= 0)\
{\
SCR_M_Dbg_Assert_D(_p_stContext_->p_stOpenFile != NULL);\
SCR_M_Dbg_AssertStruct_P(SCR_tdst_File_Open, _p_stContext_->p_stOpenFile);\
_p_stContext_->p_stOpenFile->stFileValues.a_dfValues[_Num] = (double) (_Value);\
}\
else\
_p_stContext_->cFileValuesValid = 1;\
_p_stContext_->stFileValues.a_dfValues[_Num] = (double) (_Value);\
}
/*
* To get only one file value from a relative position.
* _Offset : Offset of context.
* _Num : Number of the result.
* _Cast : To cast return value.
* _Value : To receive value.
*/
#define SCR_M_RdL0_GetFileLong(_Offset, _Num, _Cast, _Value)\
{\
SCR_tdst_Cxt_Description *_p_stContext_;\
\
SCR_M_Dbg_Assert_D((_Num) < SCR_CV_ui_Cfg_MaxResults);\
_p_stContext_ = fnp_st_Cxt_Compute(_Offset);\
if((_Offset) <= 0)\
{\
SCR_M_Dbg_Assert_D(_p_stContext_->p_stOpenFile != NULL);\
SCR_M_Dbg_AssertStruct_P(SCR_tdst_File_Open, _p_stContext_->p_stOpenFile);\
_Value = (_Cast) _p_stContext_->p_stOpenFile->stFileValues.a_ulValues[_Num];\
}\
else\
_Value = (_Cast) _p_stContext_->stFileValues.a_ulValues[_Num];\
}
/*--*/
#define SCR_M_RdL0_GetFileDouble(_Offset, _Num, _Value)\
{\
SCR_tdst_Cxt_Description *_p_stContext_;\
\
SCR_M_Dbg_Assert_D((_Num) < SCR_CV_ui_Cfg_MaxResults);\
_p_stContext_ = fnp_st_Cxt_Compute(_Offset);\
if((_Offset) <= 0)\
{\
SCR_M_Dbg_Assert_D(_p_stContext_->p_stOpenFile != NULL);\
SCR_M_Dbg_AssertStruct_P(SCR_tdst_File_Open, _p_stContext_->p_stOpenFile);\
_Value = _p_stContext_->p_stOpenFile->stFileValues.a_dfValues[_Num];\
}\
else\
_Value = _p_stContext_->stFileValues.a_dfValues[_Num];\
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*
* To set only one section value from a relative position.
* _Offset : Offset of context.
* _Num : Number of the result.
* _Cast : To cast retunr value.
* _Value : Value to set.
*/
#define SCR_M_RdL0_SetSectionLong(_Offset, _Num, _Value)\
{\
SCR_tdst_Cxt_Description *_p_stContext_;\
\
SCR_M_Dbg_Assert_D((_Num) < SCR_CV_ui_Cfg_MaxResults);\
_p_stContext_ = fnp_st_Cxt_Compute(_Offset);\
if(_Offset <= 0)\
{\
SCR_M_Dbg_Assert_D(_p_stContext_->p_stOpenSection != NULL);\
SCR_M_Dbg_AssertStruct_P(SCR_tdst_Sect_Open, _p_stContext_->p_stOpenSection);\
_p_stContext_->p_stOpenSection->stSectionValues.a_ulValues[_Num] = (unsigned long) (_Value);\
}\
else\
_p_stContext_->cSectionValuesValid = 1;\
_p_stContext_->stSectionValues.a_ulValues[_Num] = (unsigned long) (_Value);\
}
/*--*/
#define SCR_M_RdL0_SetSectionDouble(_Offset, _Num, _Value)\
{\
SCR_tdst_Cxt_Description *_p_stContext_;\
\
SCR_M_Dbg_Assert_D((_Num) < SCR_CV_ui_Cfg_MaxResults);\
_p_stContext_ = fnp_st_Cxt_Compute(_Offset);\
if((_Offset) <= 0)\
{\
SCR_M_Dbg_Assert_D(_p_stContext_->p_stOpenSection != NULL);\
SCR_M_Dbg_AssertStruct_P(SCR_tdst_Sect_Open, _p_stContext_->p_stOpenSection);\
_p_stContext_->p_stOpenSection->stSectionValues.a_dfValues[_Num] = (double) (_Value);\
}\
else\
_p_stContext_->cSectionValuesValid = 1;\
_p_stContext_->stSectionValues.a_dfValues[_Num] = (double) (_Value);\
}
/*
* To correct un error in SND module
* _Offset : Offset of context.
*/
#define SCR_M_RdL0_ClearSectionContext(_Offset)\
{\
SCR_tdst_Cxt_Description *_p_stContext_;\
\
SCR_M_Dbg_Assert_D((_Offset) > 0);\
_p_stContext_ = fnp_st_Cxt_Compute(_Offset);\
_p_stContext_->cSectionValuesValid = 0;\
}
/*
* To get only one section value from a relative position.
* _Offset : Offset of context.
* _Num : Number of the result.
* _Cast : To cast return value.
* _Value : To receive value.
*/
#define SCR_M_RdL0_GetSectionLong(_Offset, _Num, _Cast, _Value)\
{\
SCR_tdst_Cxt_Description *_p_stContext_;\
\
SCR_M_Dbg_Assert_D((_Num) < SCR_CV_ui_Cfg_MaxResults);\
_p_stContext_ = fnp_st_Cxt_Compute(_Offset);\
if((_Offset) <= 0)\
{\
SCR_M_Dbg_Assert_D(_p_stContext_->p_stOpenSection != NULL);\
SCR_M_Dbg_AssertStruct_P(SCR_tdst_Sect_Open, _p_stContext_->p_stOpenSection);\
_Value = (_Cast) _p_stContext_->p_stOpenSection->stSectionValues.a_ulValues[_Num];\
}\
else\
_Value = (_Cast) _p_stContext_->stSectionValues.a_ulValues[_Num];\
}
/*--*/
#define SCR_M_RdL0_GetSectionDouble(_Offset, _Num, _Value)\
{\
SCR_tdst_Cxt_Description *_p_stContext_;\
\
SCR_M_Dbg_Assert_D((_Num) < SCR_CV_ui_Cfg_MaxResults);\
_p_stContext_ = fnp_st_Cxt_Compute(_Offset);\
if((_Offset) <= 0)\
{\
SCR_M_Dbg_Assert_D(_p_stContext_->p_stOpenSection != NULL);\
SCR_M_Dbg_AssertStruct_P(SCR_tdst_SectOpen, _p_stContext_->p_stOpenSection);\
_Value = _p_stContext_->p_stOpenSection->stSectionValues.a_dfValues[_Num];\
}\
else\
_Value = _p_stContext_->stSectionValues.a_dfValues[_Num];\
}
/*
* To access a value from a struct.
* _Struct : Structure to access.
* _Num : Number of the value.
*/
#define SCR_M_ul_RdL0_ExtractLongValue(_Struct, _Num)\
((_Struct)->a_ulValues[_Num])
#define SCR_M_df_RdL0_ExtractDoubleValue(_Struct, _Num)\
((_Struct)->a_dfValues[_Num])
/*
* To initialise a value in a struct.
* _Struct : Structure to access.
* _Num : Number of the value.
* _Value : Value to initialise.
*/
#define SCR_M_RdL0_InitialiseLongValue(_Struct, _Num, _Value)\
{(_Struct)->a_ulValues[_Num] = (_Value);}
#define SCR_M_RdL0_InitialiseDoubleValue(_Struct, _Num, _Value)\
{(_Struct)->a_dfValues[_Num] = (_Value);}
#endif /* !__SCR_RdL0_h__Macros && !__Only_Types__ */
/*
*=================================================================================================
* Protos.
*=================================================================================================
*/
#if !defined(__SCR_RdL0_h__Protos) && !defined(__Only_Types__)
#define __SCR_RdL0_h__Protos
/*ANNECY CB*/
CPA_EXPORT extern char gsz_Version[100];
CPA_EXPORT extern char gsz_Version1[100];
extern char gc_NoAsk;
/*END ANNECY*/
CPA_EXPORT extern void SCR_fn_v_RdL0_Init(void);
CPA_EXPORT extern void SCR_fn_v_RdL0_Close(void);
CPA_EXPORT extern void SCR_fn_v_RdL0_RegisterCallback(char *, SCR_tdpfn_Anl_Callback, char);
CPA_EXPORT extern void SCR_fn_v_RdL0_DeleteRegisterCallback(char *, char, char);
CPA_EXPORT extern SCR_tdst_Anl_Callback *SCR_fnp_st_RdL0_GetRegisterCallback(char *, char);
CPA_EXPORT extern void SCR_fn_v_RdL0_OpenFile(char *);
CPA_EXPORT extern void SCR_fn_v_RdL0_DeleteOpenFile(char *, char);
CPA_EXPORT extern SCR_tdst_File_Open *SCR_fnp_st_RdL0_GetOpenFile(char *);
CPA_EXPORT extern void SCR_fn_v_RdL0_SetPriorityPath(char *);
CPA_EXPORT extern void SCR_fn_v_RdL0_RegisterPath(char *);
CPA_EXPORT extern void SCR_fn_v_RdL0_DeleteRegisterPath(char *, char);
CPA_EXPORT extern SCR_tdst_File_Path *SCR_fnp_st_RdL0_GetRegisterPath(char *);
CPA_EXPORT extern void SCR_fn_v_RdL0_DeleteOpenSection(char *, char);
CPA_EXPORT extern SCR_tdst_Sect_Open *SCR_fnp_st_RdL0_GetOpenSection(char *, unsigned int);
CPA_EXPORT extern void SCR_fn_v_RdL0_RegisterVariable(char *, char *);
CPA_EXPORT extern void SCR_fn_v_RdL0_DeleteRegisterVariable(char *, char);
CPA_EXPORT extern SCR_tdst_Vars_Description *SCR_fnp_st_RdL0_GetRegisterVariable(char *);
CPA_EXPORT extern SCR_tdst_Cxt_Values *SCR_fnp_st_RdL0_AnalyseSection(char *, unsigned short);
CPA_EXPORT extern void SCR_fn_v_RdL0_SetValues(int, SCR_tdst_Cxt_Values *, SCR_tdst_Cxt_Values *, SCR_tdst_Cxt_Values *);
CPA_EXPORT extern void SCR_fn_v_RdL0_GetValues(int, SCR_tdst_Cxt_Values *, SCR_tdst_Cxt_Values *, SCR_tdst_Cxt_Values *);
CPA_EXPORT extern SCR_tdpfn_Err_Callback SCR_fnp_fn_RdL0_RegisterErrorCallback(SCR_tdpfn_Err_Callback, unsigned short);
CPA_EXPORT extern SCR_tdst_Err_GlobalError *SCR_fnp_st_RdL0_GetLastError(void);
CPA_EXPORT extern void SCR_fn_v_RdL0_ClearError(void);
CPA_EXPORT extern char SCR_fn_c_RdL0_IsSectionExists(char *);
CPA_EXPORT extern void SCR_fn_v_RdL0_ValidatePath(char *, char *);
CPA_EXPORT extern unsigned char SCR_fn_uc_RdL0_GetNumberOfParameters(char *[]);
CPA_EXPORT extern void SCR_fn_v_RdL0_SplitSectionName(char *, char *, char *, char *);
CPA_EXPORT extern void SCR_fn_v_RdL0_SplitCompletePath(char *, char *, char *);
CPA_EXPORT extern void SCR_fn_v_RdL0_ComputeSectionName(char *, char *, char *, char *);
CPA_EXPORT extern unsigned char SCR_fn_uc_RdL0_GetCurrentFilePriority(void);
CPA_EXPORT extern void SCR_fn_v_RdL0_SetCurrentFilePriority(unsigned char);
#endif /* !__SCR_RdL0_h__Protos && !__Only_Types__ */