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,75 @@
/*///////////////////////////////////////////////////////////*/
/**/
/* Management of the Module : Scr*/
/**/
/* File Name : ErrScr.h*/
/* Date : 22/08/97*/
/* Author : CB*/
/**/
/*///////////////////////////////////////////////////////////*/
/**/
/* abbreviation of the module-name. Used in macro is 'Scr'*/
/**/
/*///////////////////////////////////////////////////////////*/
#ifndef __ERRScr_H__
#define __ERRScr_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define C_szScrVersion "SCR V5.5.2" /* The format is Scr Va.b.c with Scr is the Tag of the module */
#define C_szScrFullName "Scripts Module"/* the complete and clear name of the module */
#define C_szScrDate __DATE__ /*The format is "Mmm dd yyyy".You can use __DATE__ but be careful that you have the control of the compilation*/
/* 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
#include "ERM.h"
/*------------------*/
/* Global Variables*/
/*------------------*/
#undef __ERRScr_EXTERN
#ifndef __DeclareGlobalVariableErrScr_h__
#define __ERRScr_EXTERN extern /*external declaration*/
#else /*__DeclareGlobalVariableErrScr_h__*/
#define __ERRScr_EXTERN /*replace by nothing : we have to declare*/
#endif /*__DeclareGlobalVariableErrScr_h__*/
__ERRScr_EXTERN CPA_EXPORT unsigned char g_ucScrModuleId /*number of identification of the Erm module*/
#if defined(__DeclareGlobalVariableErrScr_h__) && !defined(CPA_WANTS_IMPORT)
= C_ucModuleNotInitialized
#endif /*__DeclareGlobalVariableErrScr_h__&& CPA_WANTS_IMPORT*/
;
#ifdef __ERROR_STRINGS__
__ERRScr_EXTERN CPA_EXPORT char * g_a_szScrInformationModule []
#if defined(__DeclareGlobalVariableErrScr_h__) && !defined(CPA_WANTS_IMPORT)
= {C_szScrVersion, C_szScrFullName, C_szScrDate}
#endif /*__DeclareGlobalVariableErrScr_h__ && CPA_WANTS_IMPORT*/
;
__ERRScr_EXTERN CPA_EXPORT struct tdstErrorMsg_ g_a_stScrTabErr [] /* Mandatory syntax 'g_a_st'+[Abbreviation of ModuleName]+'TabErr'*/
#if defined(__DeclareGlobalVariableErrScr_h__) && !defined(CPA_WANTS_IMPORT)
= {0, NULL}; /*The Erm module need this variable even if it's equal to NULL*/
#endif /*__DeclareGlobalVariableErrLgh_h__ && CPA_WANTS_IMPORT*/
;
#endif /*__ERROR_STRINGS__*/
#ifdef __cplusplus
};
#endif /* __cplusplus */
#endif /*__ERRScr_H__*/

View File

@@ -0,0 +1,63 @@
/*///////////////////////////////////////////////////////////*/
/**/
/* Memory Management of the Module : Scr*/
/**/
/* File Name : MmgScr.h*/
/* Date : 703/10/96*/
/* Author : First_Name Last_Name*/
/**/
/*///////////////////////////////////////////////////////////*/
#ifndef __MmgScr_H__
#define __MmgScr_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* 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
#include "MMG.h"
typedef enum e_ucScrStaticBlocks_
{
E_ucSCRMemoryBlock0 = 0,
E_ucSCRMemoryBlock1 = 1,
E_ucSCRMemoryBlock2 = 2,
E_ucSCRMemoryBlock3 = 3,
E_ucSCRMemoryBlock4 = 4,
E_ucSCRMemoryBlock5 = 5,
E_ucSCRMemoryBlock6 = 6,
E_ucSCRMemoryBlock7 = 7,
E_ucSCRMemoryBlock8 = 8,
E_ucScrMaxBlocksNb /* maximum number of static block, You have to follow this syntax 'E_uc+ Abbreviation Module +MaxBlocksNb'*/
} e_ucScrStaticBlocks;
#undef EXTERN
#ifdef __DeclareGlobalVariableMmgScr_h__
#define EXTERN /*nothing*/
#else /* no __DeclareGlobalVariableMmgScr_h__*/
#define EXTERN extern
#endif /*__DeclareGlobalVariableMmgScr_h__*/
EXTERN CPA_EXPORT struct tdstBlockInfo_ g_a_stScrBlocksInfo[E_ucScrMaxBlocksNb];
#ifdef __DYNAMIC_MALLOC_ALLOWED__
#ifdef __DEBUG_MALLOC_MODE__
EXTERN CPA_EXPORT struct tdstDynInfo_ g_stScrDynInfo;
#endif /*__DEBUG_MALLOC_MODE__*/
#endif /*__DYNAMIC_MALLOC_ALLOWED__*/
#ifdef __cplusplus
};
#endif /* __cplusplus */
#endif /*__MmgScr_H__*/

View File

@@ -0,0 +1,201 @@
/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* SCR_Anl.h
* Scripts, Beaudet Christophe
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
*/
#ifndef __SCR_Anl_h__Types
#define __SCR_Anl_h__Types
#ifndef __Only_Types__
#define __SCR_Anl_h__Undef
#define __Only_Types__
#endif /* !__Only_Types__ */
/*
*=================================================================================================
* Includes.
*=================================================================================================
*/
#include "SCR_Cfg.h"
#include "SCR_Cxt.h"
#include "SCR_DyAr.h"
#include "SCR_File.h"
#include "SCR_Sect.h"
#ifdef __SCR_Anl_h__Undef
#undef __Only_Types__
#undef __SCR_Anl_h__Undef
#endif /* __SCR_Anl_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 */
/*
* To describe dynamic flags.
*/
#define SCR_CDF_uw_Anl_Normal 0x0000 /* Normal analyse */
#define SCR_CDF_c_Anl_Normal 'n' /* For automatic references */
#define SCR_CDF_uw_Anl_Comments 0x0001 /* It's a comment, don't care */
#define SCR_CDF_uw_Anl_ForceAnalyse 0x0002 /* To force analyse of section */
#define SCR_CDF_c_Anl_ForceAnalyse 'f' /* For automatic references */
#define SCR_CDF_uw_Anl_NotSaveSection 0x0004 /* To not save section in memory */
#define SCR_CDF_uw_Anl_WarnIfNotHere 0x0008 /* No error if section does not exist */
/*
*=================================================================================================
* Types.
*=================================================================================================
*/
/*
* Return value for callbacks.
*/
typedef enum SCR_tde_Anl_ReturnValue_
{
SCR_ERV_Anl_NormalReturn = 0,
SCR_ERV_Anl_TerminateCurrentSection,
SCR_ERV_Anl_TerminateParentSection,
SCR_ERV_Anl_TerminateMainSection,
SCR_ERV_Anl_TerminateFile,
} SCR_tde_Anl_ReturnValue;
/*
* Value for callback action.
*/
typedef enum SCR_tde_Anl_Action_
{
SCR_EA_Anl_Invalid = 0,
SCR_EA_Anl_BeginSection,
SCR_EA_Anl_Entry,
SCR_EA_Anl_BeginSubSection,
SCR_EA_Anl_EndSubSection,
SCR_EA_Anl_EndSection,
SCR_EA_Anl_AlreadyAnalysed,
} SCR_tde_Anl_Action;
/*
* A user callback for parser.
*/
typedef SCR_tde_Anl_ReturnValue (* SCR_tdpfn_Anl_Callback)(SCR_tdst_File_Description *, char *, char *[], SCR_tde_Anl_Action);
/*
* A structure to describe a saved callback.
*/
typedef struct SCR_tdst_Anl_Callback_
{
SCR_tdst_DyAr_Header stHeader; /* Header of element */
char a_szSectionName[SCR_CV_ui_Cfg_MaxLenAtomicName]; /* Action part of name */
SCR_tdpfn_Anl_Callback pfn_eCallback; /* Address of function */
char cForSection; /* Call back for a section */
} SCR_tdst_Anl_Callback;
/*
* Structure that describe a section in a file.
*/
typedef struct SCR_tdst_Anl_SectionDes_
{
SCR_tdst_DyAr_Header stHeader; /* Header of element */
SCR_tdst_Cxt_DynBuffers stBuffers; /* Buffers to describe section title */
SCR_tdst_Cxt_Position stBeginPosition; /* Position of section in file */
SCR_tdst_Cxt_Position stEndPosition; /* Position of section in file */
unsigned short uwDynamicFlags; /* Flags of section */
struct SCR_tdst_Anl_SectionDes_ *p_stParentSection; /* Parent section description */
unsigned int uiIndexOfHashValue; /* Index in hash table of that section */
SCR_tdst_Sect_Open *p_stOpenSection; /* Address of open section */
} SCR_tdst_Anl_SectionDes;
/*
* For the parser.
*/
typedef struct SCR_tdst_Anl_ParserValues_
{
SCR_tdst_Cxt_Description *p_stContext;
SCR_tdst_Anl_Callback *p_stCallback;
SCR_tde_Anl_ReturnValue eReturnValue;
} SCR_tdst_Anl_ParserValues;
#endif /* !__SCR_Anl_h__Types */
/*
*=================================================================================================
* Global variables.
*=================================================================================================
*/
CPA_EXPORT extern SCR_tdst_DyAr_Description SCR_g_st_Anl_ArrayCallbacks;
extern int g_iExitBeforeLevel;
/*
*=================================================================================================
* Macros.
*=================================================================================================
*/
#if !defined(__SCR_Anl_h__Macros) && !defined(__Only_Types__)
#define __SCR_Anl_h__Macros
/*
* Place the current context and the current file to a given position.
*/
#define SCR_M_Anl_CxtFileToPos(_Context, _Pos)\
{\
memcpy(&((_Context)->stPosition), &(_Pos), sizeof(SCR_tdst_Cxt_Position));\
SCR_M_File_Seek(&(_Context)->p_stOpenFile->stFile, (_Context)->stPosition.lAfterSeekInFile, SEEK_SET);\
}
#endif /* __SCR_Anl_h__Macros */
/*
*=================================================================================================
* Protos.
*=================================================================================================
*/
#if !defined(__SCR_Anl_h__Protos) && !defined(__Only_Types__)
#define __SCR_Anl_h__Protos
extern void fn_v_Anl_InitModule(void);
extern void fn_v_Anl_CloseModule(void);
extern SCR_tdst_Anl_Callback *fnp_st_Anl_AddCallback(char *, SCR_tdpfn_Anl_Callback, char);
extern void fn_v_Anl_DeleteCallback(SCR_tdst_Anl_Callback *);
extern SCR_tdst_Anl_Callback *fnp_st_Anl_SearchCallback(char *, char);
extern SCR_tdst_Anl_SectionDes *fnp_st_Anl_AddSectionDes(SCR_tdst_Cxt_Description *, SCR_tdst_Anl_SectionDes *);
extern SCR_tdst_Anl_SectionDes *fnp_st_Anl_SearchSectionDes(SCR_tdst_File_Open *, char *, unsigned int, unsigned int);
extern SCR_tdst_Anl_SectionDes *fnp_st_Anl_ComputeCompleteName(SCR_tdst_Cxt_Description *, char);
extern void fn_v_Anl_ComputeSeekEnd(SCR_tdst_Cxt_Description *);
extern void fn_v_Anl_UpdateInfos(SCR_tdst_Cxt_Description *);
extern int fn_i_Anl_LineToContext(SCR_tdst_Cxt_Description *);
CPA_EXPORT extern void fn_v_Anl_ContextToSection(SCR_tdst_Cxt_Description *, char *);
CPA_EXPORT extern void fn_v_Anl_ContextToEndSection(SCR_tdst_Cxt_Description *);
CPA_EXPORT extern void fn_v_Anl_ContextToFile(SCR_tdst_Cxt_Description *);
extern char fn_c_Anl_CallToCallback(SCR_tdst_Anl_ParserValues *, SCR_tde_Anl_Action, int *);
extern void fn_v_Anl_ParseCurrentSection(unsigned short);
extern void fn_v_Anl_ReduceMemory(void);
extern void fn_v_Anl_DeleteWithMemLevel(unsigned char, unsigned char);
#endif /* !__SCR_Anl_h__Protos && !__Only_Types__ */

View File

@@ -0,0 +1,55 @@
#ifndef __SCR_BIN_HDR
#define __SCR_BIN_HDR
/* Types */
/* Constants */
#define TAG_EOF 0
#define TAG_BEGINSECTION -11
#define TAG_ENDSECTION -12
#define TAG_COMMENT -14
/* Protos */
typedef struct SCR_tdst_File_Description_ SCR_tdst_File_Description;
typedef struct SCR_tdst_Cxt_Description_ SCR_tdst_Cxt_Description;
typedef enum SCR_tde_Cxt_ParseType_ SCR_tde_Cxt_ParseType;
typedef struct SCR_tdst_Cxt_Values_ SCR_tdst_Cxt_Values;
void fn_v_Bin_Line(
SCR_tdst_File_Description *_p_stFile,
char *_p_szKeyword1,
char *_p_szKeyword2,
char *_p_szKeyword3,
char *_p_szKeyword4,
SCR_tde_Cxt_ParseType *_p_eParseType,
unsigned int *_p_uiNbRead
);
void fn_v_Bin_Read( SCR_tdst_File_Description *_File, int _Length, void *_Dest );
char SCR_fn_ch_Bin_GetCHAR( SCR_tdst_File_Description *_File );
short SCR_fn_s_Bin_GetSHORT( SCR_tdst_File_Description *_File );
long SCR_fn_l_Bin_GetLONG( SCR_tdst_File_Description *_File );
unsigned char SCR_fn_uch_Bin_GetUCHAR( SCR_tdst_File_Description *_File );
unsigned short SCR_fn_us_Bin_GetUSHORT( SCR_tdst_File_Description *_File );
unsigned long SCR_fn_ul_Bin_GetULONG( SCR_tdst_File_Description *_File );
float SCR_fn_f_Bin_GetFLOAT( SCR_tdst_File_Description *_File );
double SCR_fn_d_Bin_GetDOUBLE( SCR_tdst_File_Description *_File );
char * SCR_fn_sz_Bin_GetSTRING( SCR_tdst_File_Description *_File );
int SCR_fn_sz_Bin_GetSTRING2Buffer( SCR_tdst_File_Description *_File, char *sz );
void * SCR_fn_p_Bin_GetARRAY( SCR_tdst_File_Description *_File, short sIze );
char *SCR_fn_sz_Bin_GetREFERENCE( SCR_tdst_File_Description *_File );
void SCR_fn_sz_Bin_GetREFERENCE2Buffer( SCR_tdst_File_Description *_File, char *sz );
long fn_l_Bin_AnalyseDirective(SCR_tdst_Cxt_Description *_p_stContext);
SCR_tdst_Cxt_Values *SCR_fnp_st_Bin_GetREFERENCE( char *szName );
void SCR_fn_v_Bin_BeginSection( SCR_tdst_File_Description *_p_stFile );
void SCR_fn_v_Bin_EndSection( SCR_tdst_File_Description *_p_stFile );
long fn_l_Bin_ToEndSection( SCR_tdst_Cxt_Description *p_stContext );
#endif

View File

@@ -0,0 +1,217 @@
/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* SCR_CFil.h
* Scripts, Beaudet Christophe
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
#ifndef __SCR_CFil_h__
#define __SCR_CFil_h__
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <io.h>
/*===============================================================================================*/
/*===============================================================================================*/
#if defined(SCR_DM_OptCFiles) /*******************************************************************/
/*
* Description a C file (stream handle).
*/
typedef int SCR_FILE;
/*
* Modes for opening files.
*/
#define SCR_COM_OpenRead (O_BINARY | O_RDONLY)
#define SCR_COM_OpenWrite (O_BINARY | O_WRONLY | O_CREAT | O_TRUNC)
#define SCR_COM_OpenAppend (O_BINARY | O_APPEND)
/*
* Common macros.
*/
#define SCR_M_fopen(_FileName, _Mode) open(_FileName, _Mode, S_IREAD | S_IWRITE)
#define SCR_M_fclose(_File) close((_File)->p_stHandle->xHandle)
#define SCR_M_ftell(_File) (tell((_File)->p_stHandle->xHandle) - (_File)->p_stHandle->iCnt)
#define SCR_M_feof(_File) eof((_File)->p_stHandle->xHandle)
#define SCR_M_fread(_Buffer, _Size, _Size1, _File) read((_File)->p_stHandle->xHandle, _Buffer, _Size1)
#define SCR_M_fwrite(_Buffer, _Size, _Size1, _File) write((_File)->p_stHandle->xHandle, _Buffer, _Size1)
/*
* Macro to seek at a given position.
*/
#define SCR_M_fseek(_File, _Offset, _Origin, _iRes)\
{\
_iRes = lseek((_File)->p_stHandle->xHandle, _Offset, _Origin);\
if(_iRes == -1)\
_iRes = 1;\
else\
{\
_iRes = 0;\
(_File)->p_stHandle->p_cCurrent = (_File)->p_stHandle->p_cBase;\
(_File)->p_stHandle->iCnt = 0;\
}\
}
/*
* Macro to set internal buffer.
*/
#define SCR_M_setvbuf(_File, _Buffer, _Const, _Size)\
{\
(_File)->p_stHandle->p_cBase = (_File)->p_stHandle->p_cCurrent = _Buffer;\
(_File)->p_stHandle->iCnt = 0;\
}
/*
* Macro to set a character.
*/
#define SCR_M_fputc(_Char, _File, _iRes)\
{\
char _temp_ = _Char;\
_iRes = write((_File)->p_stHandle->xHandle, &_temp_, 1);\
}
/*
* Macro to get a character.
*/
#define SCR_M_fgetc(_File, _Char)\
{\
if(--(_File)->p_stHandle->iCnt == -1)\
{\
(_File)->p_stHandle->iCnt = SCR_M_fread((_File)->p_stHandle->p_cBase, 1, SCR_CV_ui_Cfg_SizeBufferFile, _File);\
if(((_File)->p_stHandle->iCnt == 0) || ((_File)->p_stHandle->iCnt == -1))\
{\
(_File)->p_stHandle->iCnt = 0;\
_Char = EOF;\
}\
else\
{\
(_File)->p_stHandle->p_cCurrent = (_File)->p_stHandle->p_cBase;\
(_File)->p_stHandle->iCnt--;\
_Char = 0xff & *(_File)->p_stHandle->p_cCurrent++;\
}\
}\
else\
_Char = 0xff & *(_File)->p_stHandle->p_cCurrent++;\
}
#else /* SCR_DM_OptCFiles */ /********************************************************************/
/*
*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* C Files are not optimised, so use of FILE * capabilities
*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
/*
* Description a C file.
*/
typedef FILE *SCR_FILE;
/*
* Modes for opening files.
*/
#define SCR_COM_OpenRead "rb"
#define SCR_COM_OpenWrite "wb"
#define SCR_COM_OpenAppend "ab"
/*
* Access functions.
*/
#define SCR_M_fopen(_FileName, _Mode) fopen(_FileName, _Mode)
#define SCR_M_fclose(_File) fclose((_File)->p_stHandle->xHandle)
#define SCR_M_ftell(_File) ftell((_File)->p_stHandle->xHandle)
#define SCR_M_setvbuf(_File, _Buffer, _Const, _Size) setvbuf((_File)->p_stHandle->xHandle, _Buffer, _Const, _Size)
#define SCR_M_feof(_File) feof((_File)->p_stHandle->xHandle)
#define SCR_M_fread(_Buffer, _Size, _Size1, _File) fread(_Buffer, _Size, _Size1, (_File)->p_stHandle->xHandle)
#define SCR_M_fwrite(_Buffer, _Size, _Size1, _File) fwrite(_Buffer, _Size, _Size1, (_File)->p_stHandle->xHandle)
#define SCR_M_fseek(_File, _Offset, _Origin, _iRes) {_iRes = fseek((_File)->p_stHandle->xHandle, _Offset, _Origin);}
#define SCR_M_fgetc(_File, _Char) {_Char = fgetc((_File)->p_stHandle->xHandle);}
#define SCR_M_fputc(_Char, _File, _iRes) {_iRes = fputc(_Char, (_File)->p_stHandle->xHandle); }
#endif /* SCR_DM_OptCFiles */ /*******************************************************************/
/*
* Structure that describes a file.
*/
typedef struct SCR_tdst_File_Handle_
{
SCR_FILE xHandle; /* Handle of file (can be a "FILE *") */
char *p_cBase; /* Base of buffer */
char *p_cCurrent; /* Current pointer */
int iCnt; /* Number of character from p_cBase to end of buffer */
} SCR_tdst_File_Handle;
/*
* To seek a file to a given position.
* _File : File to seek.
* _Offset : Offset to seek.
* _Origin : SEEK_SET or SEEK_END.
*/
#define SCR_M_File_Seek(_File, _Offset, _Origin)\
{\
if((_File)->d_stFirstPage != NULL)\
fn_v_Page_Seek((_File), _Offset, _Origin);\
else\
{\
int _iRes_;\
SCR_M_fseek((_File), _Offset, _Origin, _iRes_);\
if(_iRes_)\
{\
SCR_M_Err_UpdateSyntaxError();\
sprintf\
(\
g_st_Err_GlobalError.a_szBufferTmp2,\
"File is \"%s\".",\
(_File)->a_szFileName\
);\
SCR_M_Err_RaiseError(SCR_EI_Err_ReadFile);\
}\
}\
}
/*
* To close a file.
* _File : File to close.
*/
#define SCR_M_File_Close(_File)\
{\
if((_File)->p_stHandle->xHandle != (SCR_FILE) 0)\
{\
if(SCR_M_fclose(_File) == EOF)\
{\
sprintf(g_st_Err_GlobalError.a_szBufferTmp1, "File is \"%s\".", (_File)->a_szFileName);\
*g_st_Err_GlobalError.a_szBufferTmp2 = '\0';\
SCR_M_Err_RaiseError(SCR_EI_Err_CloseFile);\
}\
(_File)->p_stHandle->xHandle = (SCR_FILE) 0;\
}\
}
/*
* To open a file to read.
* To open a file to write.
* _Name : Name of file.
*/
#define SCR_M_p_x_File_OpenRead(_Name)\
(\
!access(_Name, 0) ? SCR_M_fopen(_Name, SCR_COM_OpenRead)\
: (SCR_FILE) 0\
)
#define SCR_M_p_x_File_OpenWrite(_Name)\
(\
(access(_Name, 0) || !access(_Name, 2) || !chmod(_Name, _S_IWRITE)) ? SCR_M_fopen(_Name, SCR_COM_OpenWrite)\
: (SCR_FILE) 0\
)
#define SCR_M_p_x_File_OpenAppend(_Name)\
(\
(!access(_Name, 0) && (!access(_Name, 2) || !chmod(_Name, _S_IWRITE))) ? SCR_M_fopen(_Name, SCR_COM_OpenAppend)\
: (SCR_FILE) 0\
)
#endif /* __SCR_CFil_h__ */

View File

@@ -0,0 +1,175 @@
/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* SCR_Cfg.h
* Scripts, Beaudet Christophe
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
*/
#ifndef __SCR_Cfg_h__Types
#define __SCR_Cfg_h__Types
#ifndef __Only_Types__
#define __SCR_Cfg_h__Undef
#define __Only_Types__
#endif /* !__Only_Types__ */
/*
*=================================================================================================
* Includes.
*=================================================================================================
*/
#ifdef __SCR_Cfg_h__Undef
#undef __Only_Types__
#undef __SCR_Cfg_h__Undef
#endif /* __SCR_Cfg_h__Undef */
/*
**************************************************************************************************
Dynamic allocation depending on constant and allocated structures :
Open sections :
SCR_CV_ui_Cfg_MaxLenName + 2*SCR_CV_ui_Cfg_MaxLenWord + 2*SCR_CV_ui_Cfg_MaxLenLine
long*SCR_CV_ui_Cfg_MaxResults + double*SCR_CV_ui_Cfg_MaxResults
Open files :
SCR_CV_ui_Cfg_SizeBufferFile
long*SCR_CV_ui_Cfg_MaxResults + double*SCR_CV_ui_Cfg_MaxResults
Section per file :
SCR_CV_ui_Cfg_MaxLenName + 2*SCR_CV_ui_Cfg_MaxLenWord + 2*SCR_CV_ui_Cfg_MaxLenLine
Link values :
SCR_C_ui_Link_MaxLenKey
**************************************************************************************************
*/
/*
*=================================================================================================
* Constants.
*=================================================================================================
*/
/*
* The max number of open files at a given time.
* There can be one more file to be really open a few moment !!!
* 'V' for Value.
*/
#define SCR_CV_ui_Cfg_MaxOpenFiles 50 /* Max open files at the same time */
#define SCR_CV_ui_Cfg_MaxLenLine 256 /* Max length of a script line */
#define SCR_CV_ui_Cfg_MaxLenAtomicName 150 /* Max length of an atomic section name or a directive */
#define SCR_CV_ui_Cfg_MaxLenName 512 /* Max length of a compound section name */
#define SCR_CV_ui_Cfg_MaxLenWord 150 /* Max length of a script entry or id part of section name */
#define SCR_CV_ui_Cfg_MaxLenFormat 32 /* Max length of a string format */
#define SCR_CV_ui_Cfg_MaxLenParams 256 /* Max length of string of all parameters */
#define SCR_CV_ui_Cfg_MaxResults 8 /* Max number of results per context */
#define SCR_CV_ui_Cfg_MaxNumPars 128 /* Max num of parameters */
#define SCR_CV_ui_Cfg_MaxLenVarName 128 /* Max len of a variable name */
#define SCR_CV_ui_Cfg_MaxLenVarVal 128 /* Max len of a variable value */
#if defined(SCR_DM_ProtectedVersion)
#define SCR_CV_ui_Cfg_SizePageBuf 32 /* Base size of a page buffer */
#define SCR_CV_ui_Cfg_SizePageBuf2 16 /* Base size / 2 */
#else
#define SCR_CV_ui_Cfg_SizePageBuf 1024 /* Base size of a page buffer */
#define SCR_CV_ui_Cfg_SizePageBuf2 512 /* Base size / 2 */
#endif
#define SCR_CV_ui_Cfg_SizeBufferFile 2048 /* Size of buffer to read from file */
#define SCR_CV_ui_Cfg_MaxLenError 1024 /* Max len of an error string */
#define SCR_CV_ui_Cfg_MaxErrContext 256 /* Max error context */
/*
* Current version of scripts.
* 'SV' for Script Version.
*/
#define SCR_CSV_sz_Cfg_ScriptVersion "5.5.2"
#define SCR_CSV_ui_Cfg_ScriptVersion 552
#define SCR_CSV_sz_Cfg_ScriptFileHeader "; SCR 552\n"
/*
* File name of log file.
* 'L' for Log.
*/
#define SCR_CL_sz_Cfg_LogFileName "SCR_Log.log"
/*
* Some special characters.
* 'C' for Character.
*/
#define SCR_CC_c_Cfg_NameSeparator '^'
#define SCR_CC_sz_Cfg_NameSeparator "^"
#define SCR_CC_c_Cfg_SectionBegMark '{'
#define SCR_CC_c_Cfg_SectionEndMark '}'
#define SCR_CC_c_Cfg_SectionIdMark ':'
#define SCR_CC_sz_Cfg_SectionIdMark ":"
#define SCR_CC_c_Cfg_DirectiveMark '$'
#define SCR_CC_c_Cfg_CommentMark ';'
#define SCR_CC_c_Cfg_CommentMark1 '#'
#define SCR_CC_c_Cfg_ParamSeparator ','
#define SCR_CC_c_Cfg_FormatBegMark '['
#define SCR_CC_c_Cfg_PostFormatBegMark ';'
#define SCR_CC_c_Cfg_PostFormatEndMark ';'
#define SCR_CC_c_Cfg_FormatEndMark ']'
#define SCR_CC_c_Cfg_ParamBegMark '('
#define SCR_CC_c_Cfg_ParamEndMark ')'
#define SCR_CC_c_Cfg_StringMark '"'
#define SCR_CC_c_Cfg_VarMark '@'
#define SCR_CC_C_Cfg_NoChar '\0'
#define SCR_CC_C_Cfg_EOL '\n'
#define SCR_CC_C_Cfg_EmptyParameter 0x01
/*
* Format specifiers/
* 'F' for Format.
*/
#define SCR_CF_c_Cfg_ScanfSeparator ','
#define SCR_CF_c_Cfg_FormatArray 'a'
#define SCR_CF_c_Cfg_FormatArrayByte 'c'
#define SCR_CF_c_Cfg_FormatArrayShort 'w'
#define SCR_CF_c_Cfg_FormatArrayLong 'l'
#define SCR_CF_c_Cfg_FormatArrayInt 'i'
#define SCR_CF_c_Cfg_FormatArrayFloat 'f'
#define SCR_CF_c_Cfg_FormatArrayDouble 'd'
#define SCR_CF_c_Cfg_FormatArrayBoolean 'b'
#define SCR_CF_c_Cfg_FormatArrayDisEna 'e'
#define SCR_CF_c_Cfg_FormatArrayReferences 'r'
#define SCR_CF_c_Cfg_FormatScanf '%'
/*
* Directives.
* 'D' for Directive.
*/
#define SCR_CD_sz_Cfg_Comments "Comments"
#define SCR_CD_sz_Cfg_EndComments "EndComments"
#define SCR_CD_sz_Cfg_ForceAnalyse "ForceAnalyse"
#define SCR_CD_sz_Cfg_EndForceAnalyse "EndForceAnalyse"
#define SCR_CD_sz_Cfg_NotSaveSection "NotSaveSection"
#define SCR_CD_sz_Cfg_EndNotSaveSection "EndNotSaveSection"
#define SCR_CD_sz_Cfg_SetCurrentFileLong "SetCurrentFileLong"
#define SCR_CD_sz_Cfg_SetCurrentFileDouble "SetCurrentFileDouble"
#define SCR_CD_sz_Cfg_BreakPoint "BreakPoint"
#define SCR_CD_sz_Cfg_UpdateLog "UpdateLogFile"
/* MP: BINARY */
#define SCR_CD_w_Cfg_Comments -1
#define SCR_CD_w_Cfg_EndComments -2
#define SCR_CD_w_Cfg_ForceAnalyse -3
#define SCR_CD_w_Cfg_EndForceAnalyse -4
#define SCR_CD_w_Cfg_NotSaveSection -5
#define SCR_CD_w_Cfg_EndNotSaveSection -6
#define SCR_CD_w_Cfg_SetCurrentFileLong -7
#define SCR_CD_w_Cfg_SetCurrentFileDouble -8
#define SCR_CD_w_Cfg_BreakPoint -9
#define SCR_CD_w_Cfg_UpdateLog -10
#endif /* !__SCR_Cfg_h__Types */

View File

@@ -0,0 +1,222 @@
/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* SCR_Cxt.h
* Scripts, Beaudet Christophe
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
*/
#ifndef __SCR_Cxt_h__Types
#define __SCR_Cxt_h__Types
#ifndef __Only_Types__
#define __SCR_Cxt_h__Undef
#define __Only_Types__
#endif /* !__Only_Types__ */
/*
*=================================================================================================
* Includes.
*=================================================================================================
*/
#include "SCR_Cfg.h"
#include "SCR_DyAr.h"
#include "SCR_Bin.h"
#ifdef __SCR_Cxt_h__Undef
#undef __Only_Types__
#undef __SCR_Cxt_h__Undef
#endif /* __SCR_Cxt_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 */
/*
*=================================================================================================
* Types.
*=================================================================================================
*/
/*
* To define a current position in file.
*/
typedef struct SCR_tdst_Cxt_Position_
{
unsigned int uiLineInFile; /* Line in script file */
long lAfterSeekInFile; /* Position after line in file */
unsigned int uiLevel; /* Level of section */
} SCR_tdst_Cxt_Position;
/*
* All buffers.
* Static ones.
*/
typedef struct SCR_tdst_Cxt_Buffers_
{
char a_szBufferCompleteName[SCR_CV_ui_Cfg_MaxLenName];
char a_szBufferName[SCR_CV_ui_Cfg_MaxLenAtomicName];
char a_szBufferNameExt[SCR_CV_ui_Cfg_MaxLenWord];
char a_szBufferFormat[SCR_CV_ui_Cfg_MaxLenFormat];
char a_szBufferParams[SCR_CV_ui_Cfg_MaxLenParams];
} SCR_tdst_Cxt_Buffers;
/* Dynmamic ones : When size of data inside won't change */
typedef struct SCR_tdst_Cxt_DynBuffers_
{
char *p_szBufferCompleteName;
char *p_szBufferName;
char *p_szBufferNameExt;
char a_szBufferFormat[SCR_CV_ui_Cfg_MaxLenFormat]; /* Always static */
char a_szBufferParams[SCR_CV_ui_Cfg_MaxLenParams]; /* Always static */
} SCR_tdst_Cxt_DynBuffers;
/*
* Structure that describes a result.
*/
typedef struct SCR_tdst_Cxt_Values_
{
unsigned long a_ulValues[SCR_CV_ui_Cfg_MaxResults]; /* Unsigned long values */
double a_dfValues[SCR_CV_ui_Cfg_MaxResults]; /* Double values */
} SCR_tdst_Cxt_Values;
/*
* To describe what is in the buffers of parser.
*/
typedef enum SCR_tde_Cxt_ParseType_
{
SCR_EPT_Cxt_None,
SCR_EPT_Cxt_EOF, /* MP: BINARY*/
SCR_EPT_Cxt_BeginSection,
SCR_EPT_Cxt_EndSection,
SCR_EPT_Cxt_Entry,
SCR_EPT_Cxt_Directive,
} SCR_tde_Cxt_ParseType;
/*
* Structure that describes a context.
*/
typedef struct SCR_tdst_Cxt_Description_
{
SCR_tdst_DyAr_Header stHeader; /* Header of element */
char cForSection; /* It's a file or a section */
SCR_tdst_Cxt_Buffers stBuffers; /* All buffers */
SCR_tdst_Cxt_Buffers stBuffersCopy; /* All buffers */
SCR_tdst_Cxt_Position stPosition; /* Current position in file */
struct SCR_tdst_File_Open_ *p_stOpenFile; /* Current open file */
struct SCR_tdst_Anl_SectionDes_ *p_stSectionDes; /* Current section description */
struct SCR_tdst_Sect_Open_ *p_stOpenSection; /* Current open section */
SCR_tdst_Cxt_Values stContextValues; /* Results for that context */
SCR_tdst_Cxt_Values stFileValues; /* Results for open file */
SCR_tdst_Cxt_Values stSectionValues; /* Results for open section */
char cFileValuesValid; /* Values for file are valid */
char cSectionValuesValid; /* Values for section are valid */
unsigned short uwDynamicFlags; /* Current dynamic flags */
SCR_tde_Cxt_ParseType eParseType; /* Type of parsing results */
} SCR_tdst_Cxt_Description;
#endif /* !__SCR_Cxt_h__Types */
/*
*=================================================================================================
* Global variables.
*=================================================================================================
*/
#if !defined(__SCR_Cxt_h__Globals) && !defined(__Only_Types__)
#define __SCR_Cxt_h__Globals
CPA_EXPORT extern SCR_tdst_DyAr_Description SCR_g_st_Cxt_Array;
#endif /* !__SCR_Cxt_h__Globals && !__Only_Types__ */
/*
*=================================================================================================
* Macros.
*=================================================================================================
*/
#if !defined(__SCR_Cxt_h__Macros) && !defined(__Only_Types__)
#define __SCR_Cxt_h__Macros
/*
* Copy a buffer to another.
*/
#define SCR_M_Cxt_CopyBuffers(_Dest, _Src)\
{\
strcpy((_Dest)->a_szBufferCompleteName, (_Src)->a_szBufferCompleteName);\
strcpy((_Dest)->a_szBufferName, (_Src)->a_szBufferName);\
strcpy((_Dest)->a_szBufferNameExt, (_Src)->a_szBufferNameExt);\
memcpy((_Dest)->a_szBufferFormat, (_Src)->a_szBufferFormat, SCR_CV_ui_Cfg_MaxLenLine * sizeof(char));\
memcpy((_Dest)->a_szBufferParams, (_Src)->a_szBufferParams, SCR_CV_ui_Cfg_MaxLenLine * sizeof(char));\
}
/* With allocations */
#define SCR_M_Cxt_CopyBuffersToDyn(_Dest, _Src)\
{\
SCR_M_Mem_Alloc(char, (_Dest)->p_szBufferCompleteName, strlen((_Src)->a_szBufferCompleteName) + 1);\
SCR_M_Mem_Alloc(char, (_Dest)->p_szBufferName, strlen((_Src)->a_szBufferName) + 1);\
SCR_M_Mem_Alloc(char, (_Dest)->p_szBufferNameExt, strlen((_Src)->a_szBufferNameExt) + 1);\
strcpy((_Dest)->p_szBufferCompleteName, (_Src)->a_szBufferCompleteName);\
strcpy((_Dest)->p_szBufferName, (_Src)->a_szBufferName);\
strcpy((_Dest)->p_szBufferNameExt, (_Src)->a_szBufferNameExt);\
memcpy((_Dest)->a_szBufferFormat, (_Src)->a_szBufferFormat, SCR_CV_ui_Cfg_MaxLenLine * sizeof(char));\
memcpy((_Dest)->a_szBufferParams, (_Src)->a_szBufferParams, SCR_CV_ui_Cfg_MaxLenLine * sizeof(char));\
}
#define SCR_M_Cxt_FreeDynBuffers(_Src)\
{\
SCR_M_Mem_Free((_Src)->p_szBufferCompleteName);\
SCR_M_Mem_Free((_Src)->p_szBufferName);\
SCR_M_Mem_Free((_Src)->p_szBufferNameExt);\
}
#define SCR_M_Cxt_CopyDynToBuffers(_Dest, _Src)\
{\
strcpy((_Dest)->a_szBufferCompleteName, (_Src)->p_szBufferCompleteName);\
strcpy((_Dest)->a_szBufferName, (_Src)->p_szBufferName);\
strcpy((_Dest)->a_szBufferNameExt, (_Src)->p_szBufferNameExt);\
memcpy((_Dest)->a_szBufferFormat, (_Src)->a_szBufferFormat, SCR_CV_ui_Cfg_MaxLenLine * sizeof(char));\
memcpy((_Dest)->a_szBufferParams, (_Src)->a_szBufferParams, SCR_CV_ui_Cfg_MaxLenLine * sizeof(char));\
}
/*
* Get current context.
*/
#define SCR_M_Cxt_GetCurrentContext() ((int) (SCR_g_st_Cxt_Array.uiNumValues - 1))
#endif /* !__SCR_Cxt_h__Macros && !__Only_Types__ */
/*
*=================================================================================================
* Protos.
*=================================================================================================
*/
#if !defined(__SCR_Cxt_h__Protos) && !defined(__Only_Types__)
#define __SCR_Cxt_h__Protos
extern void fn_v_Cxt_InitModule(void);
extern void fn_v_Cxt_CloseModule(void);
extern SCR_tdst_Cxt_Description *fnp_st_Cxt_Add(void);
extern void fn_v_Cxt_DeleteLast(void);
CPA_EXPORT extern SCR_tdst_Cxt_Description *fnp_st_Cxt_Compute(int);
#endif /* !__SCR_Cxt_h__Protos && !__Only_Types__ */

View File

@@ -0,0 +1,201 @@
/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* SCR_Dbg.h
*
* Contains macro for debugging capabilities.
*
* SCR_DM_ProtectedVersion must be define in project makefile for assertion macros.
* _DEBUG must be define in project makefile for other macros.
*
* Scripts, Beaudet Christophe
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
*/
#ifndef __SCR_Dbg_h__Types
#define __SCR_Dbg_h__Types
#ifndef __Only_Types__
#define __SCR_Dbg_h__Undef
#define __Only_Types__
#endif /* !__Only_Types__ */
/*
*=================================================================================================
* Includes.
*=================================================================================================
*/
#include "SCR_Err.h"
#ifdef __SCR_Dbg_h__Undef
#undef __Only_Types__
#undef __SCR_Dbg_h__Undef
#endif /* __SCR_Dbg_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 */
#endif /* !__SCR_Dbg_h__Types */
/*
*=================================================================================================
* Macros.
*=================================================================================================
*/
#if !defined(__SCR_Dbg_h__Macros) && !defined(__Only_Types__)
#define __SCR_Dbg_h__Macros
/*
*-------------------------------------------------------------------------------------------------
* Macros if _DEBUG.
*-------------------------------------------------------------------------------------------------
*/
#ifdef _DEBUG
/*
* A break point.
*/
#ifndef WATCOM
#define SCR_M_Dbg_BreakForDebug() {__asm {int 3h}}
#else /* !WATCOM */
#pragma aux SCR_M_Dbg_BreakForDebug = "int 0x03" value [eax] modify [eax];
#endif /* !WATCOM */
#else /* _DEBUG */
#define SCR_M_Dbg_BreakForDebug()
#endif /* _DEBUG */
/*
*-------------------------------------------------------------------------------------------------
* Macros if SCR_DM_ProtectedVersion.
*-------------------------------------------------------------------------------------------------
*/
#ifdef SCR_DM_ProtectedVersion
/*
* A normal assertion.
*/
#define SCR_M_Dbg_Assert_P(_Expression)\
{\
if(!(_Expression))\
{\
sprintf(g_st_Err_GlobalError.a_szBufferTmp1, "Incorrect expression is \""#_Expression"\".\n");\
*g_st_Err_GlobalError.a_szBufferTmp2 = '\0';\
SCR_M_Err_RaiseError(SCR_EI_Err_AssertionFailed);\
}\
}
/*
* A normal assertion but expression is always kept.
*/
#define SCR_M_Dbg_Verify_P(_Expression)\
{\
if(!(_Expression))\
{\
sprintf(g_st_Err_GlobalError.a_szBufferTmp1, "Incorrect expression is \""#_Expression"\".\n");\
*g_st_Err_GlobalError.a_szBufferTmp2 = '\0';\
SCR_M_Err_RaiseError(SCR_EI_Err_AssertionFailed);\
}\
}
/*
* To check validity of a structure.
*/
#define SCR_M_Dbg_AssertStruct_P(_Cast, _Pointer)\
{\
SCR_M_Dbg_Assert_P((_Pointer) != NULL);\
SCR_M_Dbg_Assert_P(((_Cast *) (_Pointer))->stHeader.uiSizeOf == sizeof(_Cast));\
}
/*
* Update uiSizeOf field of a structure.
*/
#define SCR_M_Dbg_UpdateSizeOf_P(_Cast, _Pointer)\
{\
(_Pointer)->stHeader.uiSizeOf = sizeof(_Cast);\
}
/*
*-------------------------------------------------------------------------------------------------
* Macros if not SCR_DM_ProtectedVersion.
*-------------------------------------------------------------------------------------------------
*/
#else /* SCR_DM_ProtectedVersion */
#define SCR_M_Dbg_Assert_P(_Expression)
#define SCR_M_Dbg_Verify_P(_Expression) _Expression
#define SCR_M_Dbg_AssertStruct_P(_Cast, _Pointer)
#define SCR_M_Dbg_UpdateSizeOf_P(_Cast, _Pointer)
#endif /* SCR_DM_ProtectedVersion */
/*
*-------------------------------------------------------------------------------------------------
* Macros if _DEBUG.
*-------------------------------------------------------------------------------------------------
*/
#ifdef _DEBUG
/*
* A normal assertion.
*/
#define SCR_M_Dbg_Assert_D(_Expression)\
{\
if(!(_Expression))\
{\
strcpy(g_st_Err_GlobalError.a_szBufferTmp1, "Expression is \""#_Expression"\".\n");\
*g_st_Err_GlobalError.a_szBufferTmp2 = '\0';\
SCR_M_Err_RaiseError(SCR_EI_Err_AssertionFailed);\
}\
}
/*
* A normal assertion but expression is always kept.
*/
#define SCR_M_Dbg_Verify_D(_Expression)\
{\
if(!(_Expression))\
{\
sprintf(g_st_Err_GlobalError.a_szBufferTmp1, "Incorrect expression is \""#_Expression"\".\n");\
*g_st_Err_GlobalError.a_szBufferTmp2 = '\0';\
SCR_M_Err_RaiseError(SCR_EI_Err_AssertionFailed);\
}\
}
/*
*-------------------------------------------------------------------------------------------------
* Macros if not _DEBUG.
*-------------------------------------------------------------------------------------------------
*/
#else /* _DEBUG */
#define SCR_M_Dbg_Assert_D(_Expression)
#define SCR_M_Dbg_Verify_D(_Expression) _Expression
#endif /* _DEBUG */
#endif /* !__SCR_Dbg_h__Macros && !__Only_Types__ */

View File

@@ -0,0 +1,482 @@
/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* SCR_DyAr.h
* Scripts, Beaudet Christophe
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
*/
#ifndef __SCR_DyAr_h__Types
#define __SCR_DyAr_h__Types
#ifndef __Only_Types__
#define __SCR_DyAr_h__Undef
#define __Only_Types__
#endif /* !__Only_Types__ */
/*
*=================================================================================================
* Includes.
*=================================================================================================
*/
#ifdef __SCR_DyAr_h__Undef
#undef __Only_Types__
#undef __SCR_DyAr_h__Undef
#endif /* __SCR_DyAr_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 */
/*
* Base allocation (and reallocation) of a dynamic array
*/
#define SCR_C_ui_DyAr_BaseForAllocation 100
/*
*=================================================================================================
* Types.
*=================================================================================================
*/
/*
* Header of a dynamic element.
*/
typedef struct SCR_tdst_DyAr_Header_
{
#ifdef SCR_DM_ProtectedVersion
unsigned int uiSizeOf; /* Size of this structure for test in debug mod */
#endif /* SCR_DM_ProtectedVersion */
unsigned int uiIndexInArray; /* Index in dynamic array */
unsigned char ucMemLevel; /* Memory level */
} SCR_tdst_DyAr_Header;
/*
* State of an element.
*/
typedef enum SCR_tde_DyAr_State
{
SCR_EDAS_DyAr_Invalid = 0, /* Invalid entry : Error */
SCR_EDAS_DyAr_Free, /* Entry free */
SCR_EDAS_DyAr_Occupy, /* Entry occupy */
} SCR_tde_DyAr_State;
/*
* Structure that describes an element of a dynamic array.
*/
typedef struct SCR_tdst_DyAr_Element_
{
void *d_vElement; /* Real element */
SCR_tde_DyAr_State eState; /* State of the element */
} SCR_tdst_DyAr_Element;
/*
* Structure that describes the dynamic array
*/
typedef struct SCR_tdst_DyAr_Description_
{
SCR_tdst_DyAr_Element *d_stDynArray; /* Address of dynamic array */
unsigned int uiNumValues; /* Number of values in array */
unsigned int uiMaxValues; /* Max number of values in array */
} SCR_tdst_DyAr_Description;
#endif /* !__SCR_DyAr_h__Types */
/*
*=================================================================================================
* Macros.
*=================================================================================================
*/
#if !defined(__SCR_DyAr_h__Macros) && !defined(__Only_Types__)
#define __SCR_DyAr_h__Macros
/*
* To add a new element of a specific type in a dynamic array.
* _Cast : Cast of structure to add.
* _Pos : To receive position of new allocated structure in dynamic array.
* _Pointer : To receive address of new allocated structure.
* _Array : Array concerned.
* _InitMem : Must reset memory allocation ?
*
* ALLOCATION IS IN BLOCK 0 FOR STATIC ELEMENTS.
*/
#define SCR_M_DyAr_AddElementStatic(_Cast, _Pos, _Pointer, _Array)\
{\
/*
* Allocate a place in dynamic array.
*/\
fn_v_Mem_SetMode(0);\
_Pos = fn_ui_DyAr_AllocateElement(&_Array, 1);\
/*
* Allocate a new structure if it's not already here.
*/\
/* Init current memory level of element */\
if((_Array).d_stDynArray[_Pos].d_vElement == NULL)\
{\
fn_v_Mem_SetMode(0);\
SCR_M_Mem_AllocAndSet(_Cast, _Pointer, 1);\
/*
* Initialize context in array.
*/\
(_Array).d_stDynArray[_Pos].d_vElement = _Pointer;\
SCR_M_Dbg_UpdateSizeOf_P(_Cast, _Pointer);\
}\
/*
* We initialize _Pointer with already allocated structure.
*/\
else\
{\
_Pointer = (_Cast *) (_Array).d_stDynArray[_Pos].d_vElement;\
SCR_M_Dbg_AssertStruct_P(_Cast, _Pointer);\
}\
/*
* It is now occupy...
*/\
(_Pointer)->stHeader.uiIndexInArray = _Pos;\
(_Pointer)->stHeader.ucMemLevel = 0;\
(_Array).d_stDynArray[_Pos].eState = SCR_EDAS_DyAr_Occupy;\
}
#define SCR_M_DyAr_AddElement(_Cast, _Pos, _Pointer, _Array)\
{\
/*
* Allocate a place in dynamic array.
*/\
fn_v_Mem_SetMode(0);\
_Pos = fn_ui_DyAr_AllocateElement(&_Array, 0);\
/*
* Allocate a new structure.
* Allocation depend on current memory level.
*/\
fn_v_Mem_SetMode(g_uc_Mem_CurrentMemLevel);\
SCR_M_Mem_Alloc(_Cast, _Pointer, 1);\
/*
* Initialize context in array.
*/\
(_Array).d_stDynArray[_Pos].d_vElement = (_Pointer);\
SCR_M_Dbg_UpdateSizeOf_P(_Cast, _Pointer);\
/*
* It is now occupy...
*/\
(_Pointer)->stHeader.uiIndexInArray = _Pos;\
(_Pointer)->stHeader.ucMemLevel = g_uc_Mem_CurrentMemLevel;\
(_Array).d_stDynArray[_Pos].eState = SCR_EDAS_DyAr_Occupy;\
}
#define SCR_M_DyAr_AddElementNoAlloc(_Pos, _Pointer, _Array)\
{\
/*
* Allocate a place in dynamic array.
*/\
fn_v_Mem_SetMode(0);\
_Pos = fn_ui_DyAr_AllocateElement(&_Array, 0);\
/*
* Initialize context in array.
*/\
(_Array).d_stDynArray[_Pos].d_vElement = (_Pointer);\
/*
* It is now occupy...
*/\
(_Pointer)->stHeader.uiIndexInArray = _Pos;\
(_Array).d_stDynArray[_Pos].eState = SCR_EDAS_DyAr_Occupy;\
}
/*
* To delete an element.
* _Cast : Cast of an element in array.
* _Pos : Position of element to delete.
* _Array : Array to delete the element.
* _Code : Code to free inside the element.
*/
#define SCR_M_DyAr_DeleteElement(_Cast, _Pos, _Array, _Code)\
{\
SCR_tdst_DyAr_Element *_p_stElement_;\
_Cast *_p_stPointer_;\
unsigned int _uiDPos_ = _Pos;\
/*
* Mark the element to be free.
*/\
_p_stElement_ = &(_Array)->d_stDynArray[_uiDPos_];\
_p_stElement_->eState = SCR_EDAS_DyAr_Free;\
_p_stPointer_ = (_Cast *) _p_stElement_->d_vElement;\
/*
* Really delete element if we can.
*/\
{_Code}\
fn_v_Mem_SetMode(_p_stPointer_->stHeader.ucMemLevel);\
SCR_M_Mem_Free(_p_stElement_->d_vElement);\
/*
* Reduce num of values if we delete last one.
*/\
if(_uiDPos_ == (_Array)->uiNumValues - 1)\
(_Array)->uiNumValues--;\
}
#define SCR_M_DyAr_DeleteElementNoAlloc(_Pos, _Array, _Code)\
{\
SCR_tdst_DyAr_Element *_p_stElement_;\
unsigned int _uiDPos_ = _Pos;\
/*
* Mark the element to be free.
*/\
_p_stElement_ = &(_Array)->d_stDynArray[_uiDPos_];\
_p_stElement_->eState = SCR_EDAS_DyAr_Free;\
{_Code}\
_p_stElement_->d_vElement = NULL;\
/*
* Reduce num of values if we delete last one.
*/\
if(_uiDPos_ == (_Array)->uiNumValues - 1)\
(_Array)->uiNumValues--;\
}
/*
* To delete all elements of a dynamic array.
* _Cast : Cast of element to delete.
* _Array : Array to delete the element.
* _Code : Code to free inside the element.
* _Borne : Borne to stop deletion.
*
* _Code MUST SET ALLOCATION MODE FOR ELEMENT !!!
*/
#define _SCR_M_DyAr_DeleteAllElements(_Cast, _Array, _Code, _Borne)\
{\
unsigned int _uiIndex_;\
/*
* Delete all elements.
*/\
for(_uiIndex_ = 0; _uiIndex_ < (_Array)->##_Borne; _uiIndex_++)\
if((_Array)->d_stDynArray[_uiIndex_].d_vElement != NULL)\
SCR_M_DyAr_DeleteElement(_Cast, _uiIndex_, _Array, _Code);\
/*
* Free array.
*/\
if((_Array)->d_stDynArray)\
{\
fn_v_Mem_SetMode(0);\
SCR_M_Mem_Free((_Array)->d_stDynArray);\
}\
(_Array)->uiNumValues = (_Array)->uiMaxValues = 0;\
}
#define SCR_M_DyAr_DeleteAllElements(_Cast, _Array, _Code)\
_SCR_M_DyAr_DeleteAllElements(_Cast, _Array, _Code, uiNumValues);
#define SCR_M_DyAr_DeleteAllElementsStatic(_Cast, _Array, _Code)\
_SCR_M_DyAr_DeleteAllElements(_Cast, _Array, _Code, uiMaxValues);
/*
* A macro to delete an element depending on its priority.
* For a static allocation, element is not deleted but is erased from the dynamic array.
* So we assume that static block will be destroyed later.
*/
#define SCR_M_DyAr_DeleteElementWithMemLevel(_Cast, _Array, _Code, _PrioMin, _PrioMax)\
{\
_Cast *_p_stPointer_;\
unsigned int _uiPos_;\
char _cMode_;\
_uiPos_ = 0;\
SCR_M_DyAr_GetNextElement(_Cast, _uiPos_, _p_stPointer_, _Array);\
while(_p_stPointer_)\
{\
if\
(\
((_p_stPointer_)->stHeader.ucMemLevel >= (_PrioMin))\
&& ((_p_stPointer_)->stHeader.ucMemLevel <= (_PrioMax))\
)\
{\
if\
(\
((_p_stPointer_)->stHeader.ucMemLevel >= E_ucScrMaxBlocksNb)\
|| (g_a_ul_Mem_BlocAllocationSize[(_p_stPointer_)->stHeader.ucMemLevel] == 0)\
)\
{\
_cMode_ = 0;\
SCR_M_DyAr_DeleteElement(_Cast, _uiPos_, &(_Array), _Code);\
}\
else\
{\
_cMode_ = 1;\
SCR_M_DyAr_DeleteElementNoAlloc(_uiPos_, &(_Array), _Code);\
}\
}\
_uiPos_++;\
SCR_M_DyAr_GetNextElement(_Cast, _uiPos_, _p_stPointer_, _Array);\
}\
}
/*
* A macro to get an element.
* _Cast : Cast of structure to get.
* _Pos : Position of element to get.
* _Pointer : To receive address of element.
* _Array : Array concerned.
*/
#define SCR_M_DyAr_GetElement(_Cast, _Pos, _Pointer, _Array)\
{\
_Pointer = ((_Cast *) (_Array.d_stDynArray[_Pos].d_vElement));\
SCR_M_Dbg_AssertStruct_P(_Cast, _Pointer);\
}
/*
* A macro to search the first valid element of a dynamic array.
* _Cast : Cast of element to return.
* _Pos : Pos of found element and current position to search.
* _Pointer : To receive address of element (NULL if not).
* _Array : Array to search.
*/
#define SCR_M_DyAr_GetNextElement(_Cast, _Pos, _Pointer, _Array)\
{\
while((_Pos) < (_Array).uiNumValues)\
{\
if((_Array).d_stDynArray[_Pos].eState != SCR_EDAS_DyAr_Free)\
{\
SCR_M_DyAr_GetElement(_Cast, _Pos, _Pointer, _Array);\
break;\
}\
(_Pos)++;\
}\
if((_Pos) >= (_Array).uiNumValues)\
_Pointer = NULL;\
}
/*
* A macro to search an element in an array.
* _Cast : Cast of structure to get.
* _Pos : Position of element to get.
* _Pointer : To receive address of element.
* _Array : Array concerned.
* _Test : Lines to test if this is the good element.
*/
#define SCR_M_DyAr_SearchElement(_Cast, _Pos, _Pointer, _Array, _Test)\
{\
_Pos = 0;\
SCR_M_DyAr_GetNextElement(_Cast, _Pos, _Pointer, _Array);\
while((_Pointer) != NULL)\
{\
if(_Test)\
break;\
(_Pos)++;\
SCR_M_DyAr_GetNextElement(_Cast, _Pos, _Pointer, _Array);\
}\
}
/*
* Simply pack an array by just adjusting its size.
* _Cast : Cast of an element in array.
* _Array : Array to realloc.
*/
#define SCR_M_DyAr_SimplePackArray(_Cast, _Array)\
{\
/* Realloc array */\
if((_Array).uiNumValues != (_Array).uiMaxValues)\
{\
if((_Array).uiNumValues == 0)\
{\
fn_v_Mem_SetMode(0);\
SCR_M_Mem_Free((_Array).d_stDynArray);\
}\
else\
{\
fn_v_Mem_SetMode(0);\
SCR_M_Mem_Realloc(SCR_tdst_DyAr_Element, (_Array).d_stDynArray, (_Array).d_stDynArray, (_Array).uiNumValues, 0);\
}\
(_Array).uiMaxValues = (_Array).uiNumValues;\
}\
}
/*
* To reduce the size of a dynamic array by filliing the free places.
* _Cast : Cast of an element.
* _Array : Dynamic array to reduce.
* _Code : Eventual code to execute.
*/
#define SCR_M_DyAr_PackArray(_Cast, _Array, _Code)\
{\
_Cast *_p_stPointer_;\
int _DyAr_iEndPos_;\
int _DyAr_iBegPos_ = (_Array).uiNumValues - 1;\
if(_Array.uiNumValues)\
{\
/* Search the last non free place of array */\
while\
(\
(_DyAr_iBegPos_ >= 0)\
&& ((_Array).d_stDynArray[_DyAr_iBegPos_].eState == SCR_EDAS_DyAr_Free)\
)\
{\
_DyAr_iBegPos_--;\
(_Array).uiNumValues--;\
}\
_DyAr_iEndPos_ = _DyAr_iBegPos_;\
while(_DyAr_iBegPos_ >= 0)\
{\
/* Search the last free place in array */\
while\
(\
(_DyAr_iBegPos_ >= 0)\
&& ((_Array).d_stDynArray[_DyAr_iBegPos_].eState != SCR_EDAS_DyAr_Free)\
)\
{\
_DyAr_iBegPos_--;\
}\
/* We find a home and must fill it with the last non free of array */\
if(_DyAr_iBegPos_ >= 0)\
{\
memcpy\
(\
&((_Array).d_stDynArray[_DyAr_iBegPos_]),\
&((_Array).d_stDynArray[_DyAr_iEndPos_]),\
sizeof(SCR_tdst_DyAr_Element)\
);\
(_Array).uiNumValues--;\
{_Code;}\
_DyAr_iBegPos_--;\
_DyAr_iEndPos_--;\
}\
}\
}\
if(_Array.uiMaxValues)\
{\
/* Simple pack array */\
SCR_M_DyAr_SimplePackArray(_Cast, _Array);\
/* Recompute "uiIndexInArray" field */\
for(_DyAr_iBegPos_ = 0; (unsigned int) _DyAr_iBegPos_ < (_Array).uiNumValues; _DyAr_iBegPos_++)\
{\
SCR_M_DyAr_GetElement(_Cast, _DyAr_iBegPos_, _p_stPointer_, _Array);\
_p_stPointer_->stHeader.uiIndexInArray = _DyAr_iBegPos_;\
}\
}\
}
#endif /* !__SCR_DyAr_h__Macros && !__Only_Types__ */
/*
*=================================================================================================
* Protos.
*=================================================================================================
*/
#if !defined(__SCR_DyAr_h__Protos) && !defined(__Only_Types__)
#define __SCR_DyAr_h__Protos
extern void fn_v_DyAr_InitArray(SCR_tdst_DyAr_Description *);
extern unsigned int fn_ui_DyAr_AllocateElement(SCR_tdst_DyAr_Description *, char);
#endif /* !__SCR_DyAr_h__Protos && !__Only_Types__ */

View File

@@ -0,0 +1,302 @@
/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* SCR_Err.h
* Scripts, Beaudet Christophe
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
*/
#ifndef __SCR_Err_h__Types
#define __SCR_Err_h__Types
#ifndef __Only_Types__
#define __SCR_Err_h__Undef
#define __Only_Types__
#endif /* !__Only_Types__ */
/*
*=================================================================================================
* Includes.
*=================================================================================================
*/
#include <setjmp.h>
#include "SCR_Cfg.h"
#ifdef __SCR_Err_h__Undef
#undef __Only_Types__
#undef __SCR_Err_h__Undef
#endif /* __SCR_Err_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 */
/*
* Mode for errors.
*/
#define SCR_CM_Err_Normal 0x0000 /* Normal mode */
#define SCR_CM_Err_NotDisplayInfos 0x0001 /* Not display info to user */
#define SCR_CM_Err_NotUpdateLog 0x0002 /* Not update log file */
/*
*=================================================================================================
* Types.
*=================================================================================================
*/
/*
* Enum that describes the list of all errors Id.
*/
typedef enum SCR_tde_Err_Identification_
{
SCR_EI_Err_None,
/*
* Errors.
*/
#ifdef _DEBUG
SCR_EI_Err_AssertionFailed,
#endif /* _DEBUG */
SCR_EI_Err_EndSectionAlone,
SCR_EI_Err_MissingEndSection,
SCR_EI_Err_MissingEndSectionMark,
SCR_EI_Err_MissingEndFormatMark,
SCR_EI_Err_MissingEndPostFormatMark,
SCR_EI_Err_MissingEndStringMark,
SCR_EI_Err_MissingEndVarMark,
SCR_EI_Err_MissingEndParamsMark,
SCR_EI_Err_MissingParameters,
SCR_EI_Err_MissingDirectiveName,
SCR_EI_Err_CorruptEndOfLine,
SCR_EI_Err_ReadFile,
SCR_EI_Err_OpenFile,
SCR_EI_Err_CloseFile,
SCR_EI_Err_WriteFile,
SCR_EI_Err_CreatePath,
SCR_EI_Err_UnknownSection,
SCR_EI_Err_NotEnoughMemory,
SCR_EI_Err_AlreadyRegistered,
SCR_EI_Err_UnknownDirective,
SCR_EI_Err_UnknownVariable,
SCR_EI_Err_UnknownFormat,
SCR_EI_Err_BadCharacter,
SCR_EI_Err_BadNumParamsAR,
SCR_EI_Err_UnknownDynamicFlag,
SCR_EI_Err_CantConvertScanfFormat,
SCR_EI_Err_BadNumParamsScanf,
/*
* Warnings.
* Error callback is not called.
* Dialog box not appeared.
. .LOG file is update if it is not disable.
*/
SCR_EI_Err_UnnecessaryDirective,
SCR_EI_Err_SectionWithoutCallback,
/*
* Others...
*/
SCR_EI_Err_BadFileName, /* Fatal error */
} SCR_tde_Err_Identification;
/*
* Structure that associated an error to an info string.
*/
typedef struct SCR_tdst_Err_Description_
{
SCR_tde_Err_Identification eErrorId; /* Id of error */
char *p_szInfoString; /* Info string of error */
} SCR_tdst_Err_Description;
/*
* To describe an error.
*/
typedef struct SCR_tdst_Err_GlobalError_
{
SCR_tde_Err_Identification eErrorId; /* Id of error */
char *p_szFileName; /* Source file where error occured */
int iLineInFile; /* Line in source file where error occured */
char a_szBufferOut[SCR_CV_ui_Cfg_MaxLenError]; /* To print all optionnal infos */
char a_szBufferTmp[SCR_CV_ui_Cfg_MaxLenError];
char a_szBufferTmp1[SCR_CV_ui_Cfg_MaxLenError]; /* Optionnal infos temp */
char a_szBufferTmp2[SCR_CV_ui_Cfg_MaxLenError]; /* Optionnal infos temp */
} SCR_tdst_Err_GlobalError;
/*
* To describe a script error handler.
*/
typedef void (* SCR_tdpfn_Err_Callback)(SCR_tdst_Err_GlobalError *);
/*
* An error context.
*/
typedef struct SCR_tdst_Err_Context_
{
unsigned int uiCurrentContext;
jmp_buf stMark;
} SCR_tdst_Err_Context;
#endif /* !__SCR_Err_h__Types */
/*
*=================================================================================================
* Global variables.
*=================================================================================================
*/
#if !defined(__SCR_Err_h__Globals) && !defined(__Only_Types__)
#define __SCR_Err_h__Globals
extern SCR_tdst_Err_Description g_a_st_Err_ListErrors[];
CPA_EXPORT extern SCR_tdst_Err_GlobalError g_st_Err_GlobalError;
extern SCR_tdst_Err_Context g_a_st_Err_Context[];
extern int g_i_Err_CurrentContext;
CPA_EXPORT extern SCR_tdpfn_Err_Callback SCR_g_pfn_Err_Callback;
CPA_EXPORT extern unsigned short SCR_g_uw_Err_Mode;
CPA_EXPORT extern int g_i_Err_GlobalReturn;
#endif /* !__SCR_Err_h__Globals && !__Only_Types__ */
/*
*=================================================================================================
* Macros.
*=================================================================================================
*/
#if !defined(__SCR_Err_h__Macros) && !defined(__Only_Types__)
#define __SCR_Err_h__Macros
/*
* To raise an error.
* _Error : Error id.
*/
#define SCR_M_Err_RaiseError(_Error)\
{\
g_st_Err_GlobalError.eErrorId = _Error;\
g_st_Err_GlobalError.p_szFileName = __FILE__;\
g_st_Err_GlobalError.iLineInFile = __LINE__;\
fn_v_Err_SetError();\
}
/*
* To raise a warning.
* _Error : Error id.
*/
#define SCR_M_Err_RaiseWarning(_Error)\
{\
g_st_Err_GlobalError.eErrorId = _Error;\
g_st_Err_GlobalError.p_szFileName = __FILE__;\
g_st_Err_GlobalError.iLineInFile = __LINE__;\
fn_v_Err_SetWarning();\
}
/*
* To update a_szBufferTmp of global error with the current parsed
* file.
*/
#define SCR_M_Err_UpdateSyntaxError()\
{\
SCR_tdst_Cxt_Description *_p_stContext_;\
_p_stContext_ = fnp_st_Cxt_Compute(0);\
SCR_M_Dbg_AssertStruct_P(SCR_tdst_Cxt_Description, _p_stContext_);\
sprintf\
(\
g_st_Err_GlobalError.a_szBufferTmp1,\
"Parser stopped in file \"%s\" at line \"%d\".\n",\
_p_stContext_->p_stOpenFile->stFile.a_szFileName,\
_p_stContext_->stPosition.uiLineInFile\
);\
*g_st_Err_GlobalError.a_szBufferTmp2 = '\0';\
}
/*
* Equivalent to try and catch of C++.
*/
#define SCR_BEGIN \
{\
g_i_Err_CurrentContext++;\
g_a_st_Err_Context[g_i_Err_CurrentContext].uiCurrentContext = SCR_g_st_Cxt_Array.uiNumValues;\
if(setjmp(g_a_st_Err_Context[g_i_Err_CurrentContext].stMark) == 0)\
{
/*--*/
#define SCR_CATCH \
}\
else\
{
/*--*/
#define SCR_END(_Return)\
if(g_i_Err_CurrentContext != -1)\
SCR_M_Err_RestoreContext();\
SCR_RETURN(_Return);\
}\
SCR_RETURN(_Return);\
}
/*--*/
#define SCR_CEND(_Return)\
SCR_CATCH\
if(g_i_Err_CurrentContext != -1)\
SCR_M_Err_RestoreContext();\
return _Return;\
}\
SCR_RETURN(_Return);\
}
/*--*/
#define SCR_RETURN(_Return)\
{\
g_i_Err_CurrentContext--;\
return _Return;\
}
/*
* To restore error context.
*/
#define SCR_M_Err_RestoreContext()\
{\
g_i_Err_CurrentContext--;\
SCR_g_st_Cxt_Array.uiNumValues = g_a_st_Err_Context[g_i_Err_CurrentContext + 1].uiCurrentContext;\
longjmp(g_a_st_Err_Context[g_i_Err_CurrentContext + 1].stMark, 1);\
}
#endif /* !__SCR_Err_h__Macros && !__Only_Types__ */
/*
*=================================================================================================
* Protos.
*=================================================================================================
*/
#if !defined(__SCR_Err_h__Protos) && !defined(__Only_Types__)
#define __SCR_Err_h__Protos
extern void fn_v_Err_InitModule(void);
extern void fn_v_Err_CloseModule(void);
extern void fn_v_Err_InitGlobalError(void);
CPA_EXPORT extern void fn_v_Err_SetError(void);
CPA_EXPORT extern void fn_v_Err_SetWarning(void);
extern void fn_v_Err_UpdateLogFile(void);
extern int fn_i_Err_DisplayError(char *, char *);
#endif /* !__SCR_Err_h__Protos && !__Only_Types__ */

View File

@@ -0,0 +1,175 @@
/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* SCR_File.h
* Scripts, Beaudet Christophe
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
#ifndef __SCR_File_h__Types
#define __SCR_File_h__Types
#ifndef __Only_Types__
#define __SCR_File_h__Undef
#define __Only_Types__
#endif /* !__Only_Types__ */
/*
*=================================================================================================
* Includes.
*=================================================================================================
*/
#include <io.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "SCR_DyAr.h"
#include "SCR_Hash.h"
#include "SCR_Page.h"
#include "SCR_Pars.h"
#include "SCR_CFil.h"
#ifdef __SCR_File_h__Undef
#undef __Only_Types__
#undef __SCR_File_h__Undef
#endif /* __SCR_File_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 */
/*
*=================================================================================================
* Types.
*=================================================================================================
*/
/* MP: BINARY */
typedef struct SCR_tdst_Refs_
{
char **a_szRefName; /* MP BINARY : array of strings for refs */
short sRefCount;
} SCR_tdst_Refs;
/*
* Structure that describes a file to parse.
*/
typedef struct SCR_tdst_File_Description_
{
SCR_tdst_File_Handle *p_stHandle; /* Handle of file (address of stHandle field) */
char a_szFileName[_MAX_PATH]; /* User file name */
char a_szOpenFileName[_MAX_PATH]; /* Open file name */
SCR_tdst_Page_Description *d_stFirstPage; /* First page of list */
SCR_tdst_Page_Description *d_stLastPage; /* Last page of list */
SCR_tdst_Page_Description *d_stCurPage; /* Current page */
long iCurPosInPage; /* Current position in page */
char bBinaryMode; /* MP - FALSE if file is TEXT, True if BINARY */
SCR_tdst_Refs *p_stRefs;
long lChangeInPos;
long lToEndSection;
long lCountEndSections;
} SCR_tdst_File_Description;
/*
* Structure that describes an open file.
*/
typedef struct SCR_tdst_File_Open_
{
SCR_tdst_DyAr_Header stHeader; /* Header of element */
char a_szBuffer[SCR_CV_ui_Cfg_SizeBufferFile];
struct SCR_tdst_File_Description_ stFile; /* File */
SCR_tda_st_Hash_Table a_stHashSectionsDes; /* To retrieve sections */
/* !!! When delete this field, all clients will need to be compile !!! */
SCR_tda_st_Hash_Table DUMMY;
struct SCR_tdst_DyAr_Description_ stSectionsDes; /* Array of sections in file */
struct SCR_tdst_Pars_Infos_ stParsingInfos; /* Parsing infos for that file */
SCR_tdst_Cxt_Values stFileValues; /* Values for that file */
SCR_tdx_Hash_Key xHashKey; /* Hash key code */
unsigned int uiIndexOfHashValue; /* Index of hash value in table */
long lSeekWhenClosed; /* Seek when file was closed */
} SCR_tdst_File_Open;
/*
* Structure that describes a path.
*/
typedef struct SCR_tdst_File_Path_
{
SCR_tdst_DyAr_Header stHeader; /* Header of element */
char a_szPathName[_MAX_PATH]; /* Name of path */
} SCR_tdst_File_Path;
#endif /* !__SCR_File_h__Types */
/*
*=================================================================================================
* Global variables.
*=================================================================================================
*/
#if !defined(__SCR_File_h__Globals) && !defined(__Only_Types__)
#define __SCR_File_h__Globals
CPA_EXPORT extern SCR_tdst_DyAr_Description SCR_g_st_File_ArrayOpen;
CPA_EXPORT extern SCR_tda_st_Hash_Table SCR_g_a_st_File_HashTableOpen;
CPA_EXPORT extern SCR_tdst_DyAr_Description SCR_g_st_File_ArrayPaths;
CPA_EXPORT extern char SCR_g_a_sz_File_PriorityPath[_MAX_PATH];
CPA_EXPORT extern unsigned char SCR_g_uc_File_CurrentPriority;
#endif /* !__SCR_File_h__Globals && !__OnlyTypes */
/*
*=================================================================================================
* Protos.
*=================================================================================================
*/
#if !defined(__SCR_File_h__Protos) && !defined(__Only_Types__)
#define __SCR_File_h__Protos
extern void fn_v_File_InitModule(void);
extern void fn_v_File_CloseModule(void);
CPA_EXPORT extern void SCR_fn_v_File_InitFileDes(SCR_tdst_File_Description *, char *, SCR_FILE);
CPA_EXPORT extern void SCR_fn_v_File_CloseFileDes(SCR_tdst_File_Description *);
extern SCR_tdst_File_Open *fnp_st_File_AddOpen(char *, SCR_tdx_Hash_Key);
extern void fn_v_File_DeleteInsideOpen(SCR_tdst_File_Open *);
extern void fn_v_File_DeleteInsideOpenWithMemLevel(SCR_tdst_File_Open *, unsigned char, unsigned char);
extern void fn_v_File_DeleteOpen(SCR_tdst_File_Open *);
extern SCR_tdst_File_Open *fnp_st_File_SearchOpen(char *, SCR_tdx_Hash_Key);
extern SCR_tdst_File_Open *fnp_st_File_SearchOpenWithPath(char *, SCR_tdx_Hash_Key);
extern void fn_v_File_ClearPath(char *, char *);
extern SCR_tdst_File_Path *fnp_st_File_AddPath(char *);
extern void fn_v_File_DeletePath(SCR_tdst_File_Path *);
extern SCR_tdst_File_Path *fnp_st_File_SearchPath(char *);
extern void fn_v_File_ForceOpenFile(SCR_tdst_File_Open *);
extern SCR_tdst_File_Open *fnp_st_File_OpenFile(char *);
extern void fn_v_File_CloseAllHandles(void);
extern char fn_c_File_TryToOpen(SCR_tdst_File_Open *);
extern void fn_v_File_ReallyOpen(SCR_tdst_File_Open *);
extern void fn_v_File_TransformFileName(char *);
extern void fn_v_File_ComputeFileSectionName(char *, char *, char *);
extern void fn_v_File_ReduceMemory(void);
extern void fn_v_File_DeleteWithMemLevel(unsigned char, unsigned char);
#endif /* !__SCR_File_h__Protos && !__Only_Types__ */

View File

@@ -0,0 +1,174 @@
/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* SCR_Hash.h
* Scripts, Beaudet Christophe
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
#ifndef __SCR_Hash_h__Types
#define __SCR_Hash_h__Types
#ifndef __Only_Types__
#define __SCR_Hash_h__Undef
#define __Only_Types__
#endif /* !__Only_Types__ */
/*
*=================================================================================================
* Includes.
*=================================================================================================
*/
#include "SCR_DyAr.h"
#ifdef __SCR_Hash_h__Undef
#undef __Only_Types__
#undef __SCR_Hash_h__Undef
#endif /* __HSH_Hash_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 */
/*
* To define hash size.
*/
#define SCR_C_ui_Hash_Modulo 256
#define SCR_C_ui_Hash_Size SCR_C_ui_Hash_Modulo
/*
*=================================================================================================
* Types.
*=================================================================================================
*/
/*
* Structure that describes a value associated to an hash key code
*/
typedef struct SCR_tdst_Hash_Value_
{
SCR_tdst_DyAr_Header stHeader; /* Header of element */
unsigned long ulValue; /* Hash value */
} SCR_tdst_Hash_Value;
/*
* Type that describes an hash table.
* It's an array of entries.
*/
typedef SCR_tdst_DyAr_Description SCR_tda_st_Hash_Table[SCR_C_ui_Hash_Size];
/*
* Type that describes an hash key.
* It's a indice in a hash table.
*/
typedef unsigned int SCR_tdx_Hash_Key;
#endif /* !__HSH_Hash_h__Types */
/*
*=================================================================================================
* Macros.
*=================================================================================================
*/
#if !defined(__SCR_Hash_h__Macros) && !defined(__Only_Types__)
#define __SCR_Hash_h__Macros
/*
* Simply pack an hash table by just adjusting its size.
* _Array : Array to realloc.
*/
#define SCR_M_Hash_SimplePackArray(_Array)\
{\
unsigned int _Hash_uiPos_;\
for(_Hash_uiPos_ = 0; _Hash_uiPos_ < SCR_C_ui_Hash_Size; _Hash_uiPos_++)\
{\
SCR_M_DyAr_SimplePackArray(SCR_tdst_Hash_Value, _Array[_Hash_uiPos_]);\
}\
}
/*
* A macro to reduce the size of an hash table.
* _Array : Hash table to reduce.
* _Cast : Cast of an element of linked array.
* _Array2 : Linked array.
*/
#define SCR_M_Hash_PackArray(_Array, _Cast, _Array2, _Field1, _Field2)\
{\
unsigned int _Hash_uiPos_, _Hash_uiPos1_;\
_Cast *p_stPointer;\
for(_Hash_uiPos_ = 0; _Hash_uiPos_ < SCR_C_ui_Hash_Size; _Hash_uiPos_++)\
{\
SCR_M_DyAr_PackArray\
(\
SCR_tdst_Hash_Value,\
_Array[_Hash_uiPos_],\
for(_Hash_uiPos1_ = 0; _Hash_uiPos1_ < (_Array2).uiNumValues; _Hash_uiPos1_++)\
{\
SCR_M_DyAr_GetElement(_Cast, _Hash_uiPos1_, p_stPointer, _Array2);\
if(p_stPointer)\
{\
if\
(\
(p_stPointer->##_Field1 == _Hash_uiPos_)\
&& (p_stPointer->##_Field2 == (unsigned int) _DyAr_iEndPos_)\
)\
p_stPointer->##_Field2 = _DyAr_iBegPos_;\
}\
}\
);\
}\
}
/*
* A macro delete hash values depending on memory level.
*/
#define SCR_M_Hash_DeleteWithMemLevel(_Array, _ucMin, _ucMax)\
{\
unsigned int _Hash_uiPos_;\
for(_Hash_uiPos_ = 0; _Hash_uiPos_ < SCR_C_ui_Hash_Size; _Hash_uiPos_++)\
{\
SCR_M_DyAr_DeleteElementWithMemLevel\
(\
SCR_tdst_Hash_Value,\
_Array[_Hash_uiPos_],\
;,\
_ucMin,\
_ucMax\
);\
}\
}
#endif /* !__SCR_Hash_h__Macros && !__OnlyTypes */
/*
*=================================================================================================
* Protos.
*=================================================================================================
*/
#if !defined(__SCR_Hash_h__Protos) && !defined(__Only_Types__)
#define __SCR_Hash_h__Protos
extern void fn_v_Hash_InitTable(SCR_tda_st_Hash_Table);
extern void fn_v_Hash_CloseTable(SCR_tda_st_Hash_Table);
CPA_EXPORT extern SCR_tdx_Hash_Key SCR_fn_x_Hash_ComputeHashKeyForString(char *);
CPA_EXPORT extern SCR_tdx_Hash_Key SCR_fn_x_Hash_ComputeHashKeyForLong(long);
extern SCR_tdst_Hash_Value *fnp_st_Hash_AddValue(SCR_tdx_Hash_Key, SCR_tda_st_Hash_Table, unsigned long, unsigned int *);
#endif /* !__HSH_Hash_h__Protos && !__Only_Types__ */

View File

@@ -0,0 +1,173 @@
/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* SCR_Link.h
* Link tables, Beaudet Christophe
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
#ifndef __SCR_Link_h__Types
#define __SCR_Link_h__Types
#ifndef __Only_Types__
#define __SCR_Link_h__Undef
#define __Only_Types__
#endif /* !__Only_Types__ */
/*
*=================================================================================================
* Includes.
*=================================================================================================
*/
#include "SCR_DyAr.h"
#include "SCR_Hash.h"
#ifdef __SCR_Link_h__Undef
#undef __Only_Types__
#undef __SCR_Link_h__Undef
#endif /* __SCR_Link_h__Undef */
/*
*=================================================================================================
* Types.
*=================================================================================================
*/
/*
* Enum that describes a link state
*/
typedef enum SCR_tde_Link_State_
{
SCR_ELS_Link_NotInitialized = 0, /* Value not yet initialized */
SCR_ELS_Link_Initialized, /* Value initialized */
} SCR_tde_Link_State;
/*
* An additional structure for link values.
*/
typedef struct SCR_tdst_Link_AdditionalInfos_
{
unsigned long ulLong1;
unsigned long ulLong2;
unsigned long ulLong3;
unsigned long ulLong4;
} SCR_tdst_Link_AdditionalInfos;
/*
* Type to describe a value to link
*/
typedef struct SCR_tdst_Link_Value_
{
SCR_tdst_DyAr_Header stHeader; /* Header of element */
char *p_szKey; /* Character key */
unsigned long ulValue; /* Value */
SCR_tdx_Hash_Key xHashKeyForKey; /* To save hash key code of szKey */
unsigned int uiIndexHashKeyKey; /* Index of key hash key */
SCR_tdx_Hash_Key xHashKeyForValue; /* To save hash key code of ulValue */
unsigned int uiIndexHashKeyValue; /* Index of value hash key */
SCR_tde_Link_State eState; /* State of this link, initialized or not */
SCR_tdst_Link_AdditionalInfos stInfos; /* Additional informations */
} SCR_tdst_Link_Value;
/*
* Type to describe a link table.
*/
typedef struct SCR_tdst_Link_Table_
{
SCR_tdst_DyAr_Header stHeader; /* Header of element */
SCR_tdst_DyAr_Description stLinkArray; /* Array of links */
SCR_tda_st_Hash_Table a_stHashTableForValues; /* Hash table to find link from value */
SCR_tda_st_Hash_Table a_stHashTableForKeys; /* Hash table to find link from char key */
} SCR_tdst_Link_Table;
/*
* Callback for loading a linktable.
*/
typedef void (* SCR_tdpfn_Link_Callback)(SCR_tdst_Link_Value *);
#endif /* !__SCR_Link_h__Types */
/*
*=================================================================================================
* Global variables.
*=================================================================================================
*/
#if !defined(__SCR_Link_h__Globals) && !defined(__Only_Types__)
#define __SCR_Link_h__Globals
CPA_EXPORT extern SCR_tdst_DyAr_Description SCR_g_st_Link_Array;
#endif /* !__SCR_Link_h__Globals && !__OnlyTypes */
/*
*=================================================================================================
* Macros.
*=================================================================================================
*/
#if !defined(__SCR_Link_h__Macros) && !defined(__Only_Types__)
#define __SCR_Link_h__Macros
/*
* To access field of the link structure.
* _Struct : Structure to access.
*/
#define SCR_M_ul_Link_GetValue(_Struct)\
((_Struct)->ulValue)
#define SCR_M_p_sz_Link_GetKey(_Struct)\
((_Struct)->p_szKey)
#define SCR_M_e_Link_GetState(_Struct)\
((_Struct)->eState)
#define SCR_M_uc_Link_GetMemLevel(_Struct)\
((_Struct)->stHeader.ucMemLevel)
/*
* For additional informations.
*/
#define SCR_M_v_Link_SetAdditionalLong(_Struct, _Num, _Long)\
{(_Struct)->stInfos.ulLong##_Num = (_Long);}
#define SCR_M_ul_Link_GetAdditionalLong(_Struct, _Num)\
((_Struct)->stInfos.ulLong##_Num)
/*
* To get a link table dynamic array
*/
#define SCR_M_st_Link_GetDynamicArray(_LinkTable)\
((_LinkTable)->stLinkArray)
#endif /* __SCR_Link_h__Macros */
/*
*=================================================================================================
* Protos.
*=================================================================================================
*/
#if !defined(__SCR_Link_h__Protos) && !defined(__Only_Types__)
#define __SCR_Link_h__Protos
extern void fn_v_Link_InitModule(void);
extern void fn_v_Link_CloseModule(void);
CPA_EXPORT extern void SCR_fn_v_Link_InitTable(SCR_tdst_Link_Table *);
CPA_EXPORT extern void SCR_fn_v_Link_CloseTable(SCR_tdst_Link_Table *);
CPA_EXPORT extern SCR_tdst_Link_Value *SCR_fnp_st_Link_AddEntry(SCR_tdst_Link_Table *, char *, unsigned long, SCR_tde_Link_State);
CPA_EXPORT extern SCR_tdst_Link_Value *SCR_fnp_st_Link_CreateOrGetLinkFromKey(SCR_tdst_Link_Table *, char *);
CPA_EXPORT extern SCR_tdst_Link_Value *SCR_fnp_st_Link_SetValue(SCR_tdst_Link_Table *, char *, unsigned long);
CPA_EXPORT extern SCR_tdst_Link_Value *SCR_fnp_st_Link_SearchKey(SCR_tdst_Link_Table *, char *);
CPA_EXPORT extern SCR_tdst_Link_Value *SCR_fnp_st_Link_SearchValue(SCR_tdst_Link_Table *, unsigned long);
CPA_EXPORT extern void SCR_fn_v_Link_DeleteEntry(SCR_tdst_Link_Table *, SCR_tdst_Link_Value *);
CPA_EXPORT extern void SCR_fn_v_Link_SaveOnDisk(char *_p_szName, SCR_tdst_Link_Table *_p_stLink);
CPA_EXPORT extern void SCR_fn_v_Link_SaveOnDiskWithCallBack(char *_p_szName, SCR_tdst_Link_Table *_p_stLink, SCR_tdpfn_Link_Callback);
CPA_EXPORT extern void SCR_fn_v_Link_LoadFromDisk(char *_p_szName, SCR_tdst_Link_Table *_p_stLink);
CPA_EXPORT extern void SCR_fn_v_Link_LoadFromDiskWithCallBack(char *_p_szName, SCR_tdst_Link_Table *_p_stLink, SCR_tdpfn_Link_Callback);
extern void fn_v_Link_ReduceMemory(void);
extern void fn_v_Link_DeleteWithMemLevel(unsigned char, unsigned char);
#endif /* !__SCR_Link_h__Protos && !__Only_Types__ */

View File

@@ -0,0 +1,173 @@
/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* SCR_Mem.h
* Scripts, Beaudet Christophe
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
*/
#ifndef __SCR_Mem_h__Types
#define __SCR_Mem_h__Types
#ifndef __Only_Types__
#define __SCR_Mem_h__Undef
#define __Only_Types__
#endif /* !__Only_Types__ */
/*
*=================================================================================================
* Includes.
*=================================================================================================
*/
#include "ErrScr.h" /* ERM */
#include "MmgScr.h" /* MMG */
#include "Malloc.h"
#ifdef __SCR_Mem_h__Undef
#undef __Only_Types__
#undef __SCR_Mem_h__Undef
#endif /* __SCR_Mem_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 */
#endif /* !__SCR_Mem_h__Types */
/*
*=================================================================================================
* Global variables.
*=================================================================================================
*/
#if !defined(__SCR_Mem_h__Globals) && !defined(__Only_Types__)
#define __SCR_Mem_h__Globals
extern unsigned char g_uc_Mem_CurrentAllocationType;
extern unsigned long g_a_ul_Mem_BlocAllocationSize[E_ucScrMaxBlocksNb];
extern unsigned long g_a_ul_Mem_MemoryAllocated[256];
extern unsigned char g_uc_Mem_CurrentMemLevel;
extern unsigned char g_uc_Mem_CurrentLinkLevel;
extern unsigned char g_uc_Mem_LastMemLevel;
#endif /* !__SCR_Mem_h__Globals && !__Only_Types__ */
/*
*=================================================================================================
* Macros.
*=================================================================================================
*/
#if !defined(__SCR_Mem_h__Macros) && !defined(__Only_Types__)
#define __SCR_Mem_h__Macros
/*
* A macro for a simple malloc.
* A macro for a simple malloc with an init of allocated memory.
* A macro for a realloc.
* A macro to free.
*/
#define SCR_M_Mem_Alloc(_Cast, _Pointer, _Size)\
{\
_Pointer = NULL;\
if(_Size)\
{\
g_a_ul_Mem_MemoryAllocated[g_uc_Mem_LastMemLevel] += (_Size * sizeof(_Cast));\
Mmg_M_SetModeAlloc4Ch(Scr, g_uc_Mem_CurrentAllocationType, C_ucMmgDefaultChannel);\
MMG_fn_vAddMemoryInfo(MMG_C_lTypeScript, MMG_C_lSubTypeScript, NULL);\
_Pointer = (_Cast *) Mmg_fn_p_vAlloc4Ch(_Size * sizeof(_Cast), C_ucMmgDefaultChannel);\
if(Erm_M_uwCheckError(Mmg, C_ucErmDefaultChannel))\
Erm_M_ClearLastError(C_ucErmDefaultChannel);\
if(_Pointer == NULL)\
{\
*g_st_Err_GlobalError.a_szBufferTmp1 = '\0';\
*g_st_Err_GlobalError.a_szBufferTmp2 = '\0';\
SCR_M_Err_RaiseError(SCR_EI_Err_NotEnoughMemory);\
}\
}\
}
#define SCR_M_Mem_AllocAndSet(_Cast, _Pointer, _Size)\
{\
SCR_M_Mem_Alloc(_Cast, _Pointer, _Size);\
if(_Pointer == NULL)\
{\
*g_st_Err_GlobalError.a_szBufferTmp1 = '\0';\
*g_st_Err_GlobalError.a_szBufferTmp2 = '\0';\
SCR_M_Err_RaiseError(SCR_EI_Err_NotEnoughMemory);\
}\
memset(_Pointer, 0, _Size * sizeof(_Cast));\
}
#define SCR_M_Mem_Realloc(_Cast, _PointerSrc, _PointerDest, _Size, _AddSize)\
{\
g_a_ul_Mem_MemoryAllocated[g_uc_Mem_LastMemLevel] += (_AddSize * sizeof(_Cast));\
Mmg_M_SetModeAlloc4Ch(Scr, g_uc_Mem_CurrentAllocationType, C_ucMmgDefaultChannel);\
_PointerSrc = (_Cast *) Mmg_fn_p_vRealloc4Ch(_PointerDest, _Size * sizeof(_Cast), C_ucMmgDefaultChannel);\
if(Erm_M_uwCheckError(Mmg, C_ucErmDefaultChannel))\
Erm_M_ClearLastError(C_ucErmDefaultChannel);\
if(_PointerSrc == NULL)\
{\
*g_st_Err_GlobalError.a_szBufferTmp1 = '\0';\
*g_st_Err_GlobalError.a_szBufferTmp2 = '\0';\
SCR_M_Err_RaiseError(SCR_EI_Err_NotEnoughMemory);\
}\
}
#define SCR_M_Mem_Free(_Pointer)\
{\
if(_Pointer)\
{\
/*g_a_ul_Mem_MemoryAllocated[g_uc_Mem_LastMemLevel] -= _msize(((char *) _Pointer) - 1);*/\
Mmg_M_SetModeAlloc4Ch(Scr, g_uc_Mem_CurrentAllocationType, C_ucMmgDefaultChannel);\
if(Erm_M_uwCheckError(Mmg, C_ucErmDefaultChannel))\
Erm_M_ClearLastError(C_ucErmDefaultChannel);\
Mmg_fn_vFree4Ch(_Pointer, C_ucMmgDefaultChannel);\
_Pointer = NULL;\
}\
}
#endif /* !__SCR_Mem_h__Macros && !__Only_Types__ */
/*
*=================================================================================================
* Protos.
*=================================================================================================
*/
#if !defined(__SCR_Mem_h__Protos) && !defined(__Only_Types__)
#define __SCR_Mem_h__Protos
extern void fn_v_Mem_InitModule(void);
extern void fn_v_Mem_CloseModule(void);
CPA_EXPORT extern void SCR_fn_v_Mem_InitWithMemLevel(unsigned long *);
CPA_EXPORT extern void SCR_fn_v_Mem_DeleteWithMemLevel(unsigned char, unsigned char);
CPA_EXPORT extern void SCR_fn_v_Mem_ReduceMemory(void);
CPA_EXPORT extern unsigned char SCR_fn_uc_Mem_GetCurrentLevel(void);
CPA_EXPORT extern void SCR_fn_v_Mem_SetCurrentLevel(unsigned char);
CPA_EXPORT extern unsigned char SCR_fn_uc_Mem_GetCurrentLinkLevel(void);
CPA_EXPORT extern void SCR_fn_v_Mem_SetCurrentLinkLevel(unsigned char);
extern void fn_v_Mem_SetMode(unsigned char);
CPA_EXPORT extern unsigned long SCR_fn_ul_Mem_GetAllocationSize(unsigned char, unsigned long);
CPA_EXPORT extern void Scr_PrintUsedStaticMemory(void);
#endif /* !__SCR_Mem_h__Protos && !__Only_Types__ */

View File

@@ -0,0 +1,131 @@
/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* SCR_Ntfy.h
* Scripts, Beaudet Christophe
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
*/
#ifndef __SCR_Ntfy_h__Types
#define __SCR_Ntfy_h__Types
#ifndef __Only_Types__
#define __SCR_Ntfy_h__Undef
#define __Only_Types__
#endif /* !__Only_Types__ */
/*
*=================================================================================================
* Includes.
*=================================================================================================
*/
#include "SCR_File.h"
#ifdef __SCR_Ntfy_h__Undef
#undef __Only_Types__
#undef __SCR_Ntfy_h__Undef
#endif /* __SCR_Ntfy_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 */
/*
*=================================================================================================
* Types.
*=================================================================================================
*/
/*
* To describe an action to the high level saver.
*/
typedef enum SCR_tde_Ntfy_Action_
{
SCR_EA_Ntfy_AddSection, /* To add a new section in a file */
SCR_EA_Ntfy_DeleteSection, /* To delete an existing section */
SCR_EA_Ntfy_ModifySection, /* To modify a section */
SCR_EA_Ntfy_RebuildSection, /* To delete and rewrite a section */
SCR_EA_Ntfy_Dummy, /* When a notification has been done */
SCR_EA_Ntfy_AddOrModifySection, /* Modify section if exists, add else */
SCR_EA_Ntfy_AddOrRebuildSection, /* Rebuild section if exists, add else */
SCR_EA_Ntfy_DeleteIfExists, /* Delete section if it exits */
} SCR_tde_Ntfy_Action;
/*
* Type that describes a callback for saver.
*/
typedef void (* SCR_tdpfn_Ntfy_Callback)(SCR_tdst_File_Description *, char *, void *, SCR_tde_Ntfy_Action);
/*
* Structure that describes a notify saving action.
*/
typedef struct SCR_tdst_Ntfy_Description_
{
SCR_tdst_DyAr_Header stHeader; /* Header of element */
char a_szSectionName[_MAX_PATH]; /* Notification string */
SCR_tdpfn_Ntfy_Callback pfn_vCallback; /* Associated callback */
void *p_vData; /* Additional data */
SCR_tde_Ntfy_Action eAction; /* Notification action */
} SCR_tdst_Ntfy_Description;
#endif /* !__SCR_Ntfy_h__Types */
/*
*=================================================================================================
* Global variables.
*=================================================================================================
*/
#if !defined(__SCR_Ntfy_h__Globals) && !defined(__Only_Types__)
#define __SCR_Ntfy_h__Globals
extern SCR_tdst_DyAr_Description SCR_g_st_Ntfy_Array;
#endif /* !__SCR_Ntfy_h__Globals && !__Only_Types__ */
/*
*=================================================================================================
* Macros.
*=================================================================================================
*/
#if !defined(__SCR_Ntfy_h__Macros) && !defined(__Only_Types__)
#define __SCR_Ntfy_h__Macros
#endif /* !__SCR_Ntfy_h__Macros && !__Only_Types__ */
/*
*=================================================================================================
* Protos.
*=================================================================================================
*/
#if !defined(__SCR_Ntfy_h__Protos) && !defined(__Only_Types__)
#define __SCR_Ntfy_h__Protos
extern void fn_v_Ntfy_InitModule(void);
extern void fn_v_Ntfy_CloseModule(void);
extern void fn_v_Ntfy_Add(char *, SCR_tdpfn_Ntfy_Callback, void *, SCR_tde_Ntfy_Action);
extern void fn_v_Ntfy_Delete(SCR_tdst_Ntfy_Description *);
extern SCR_tdst_Ntfy_Description *fnp_st_Ntfy_Search(char *);
extern void fn_v_Ntfy_ReduceMemory(void);
extern void fn_v_Ntfy_DeleteWithMemLevel(unsigned char, unsigned char);
#endif /* !__SCR_Ntfy_h__Protos && !__Only_Types__ */

View File

@@ -0,0 +1,94 @@
/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* SCR_Page.h
* Scripts, Beaudet Christophe
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
*/
#ifndef __SCR_Page_h__Types
#define __SCR_Page_h__Types
#ifndef __Only_Types__
#define __SCR_Page_h__Undef
#define __Only_Types__
#endif /* !__Only_Types__ */
/*
*=================================================================================================
* Includes.
*=================================================================================================
*/
#ifdef __SCR_Mode_h__Undef
#undef __Only_Types__
#undef __SCR_Mode_h__Undef
#endif /* __SCR_Mode_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 */
/*
*=================================================================================================
* Types.
*=================================================================================================
*/
/*
* Structure that describes a memory page.
*/
typedef struct SCR_tdst_Page_Description_
{
SCR_tdst_DyAr_Header stHeader; /* Header of element */
struct SCR_tdst_Page_Description_ *p_stNext; /* Next page */
struct SCR_tdst_Page_Description_ *p_stPrev; /* Previous page */
char *d_cBuffer; /* Buffer of page */
int iNumOfChars; /* Number of characters in page */
} SCR_tdst_Page_Description;
#endif /* !__SCR_Mode_h__Types */
/*
*=================================================================================================
* Protos.
*=================================================================================================
*/
#if !defined(__SCR_Page_h__Protos) && !defined(__Only_Types__)
#define __SCR_Page_h__Protos
extern SCR_tdst_Page_Description *fnp_st_Page_Allocate(void);
extern void fn_v_Page_Free(SCR_tdst_Page_Description *);
extern void fn_v_Page_DeleteAll(SCR_tdst_File_Description *);
extern void fn_v_Page_LinkAfter(SCR_tdst_File_Description *, SCR_tdst_Page_Description *, SCR_tdst_Page_Description *);
extern void fn_v_Page_Unlink(SCR_tdst_File_Description *, SCR_tdst_Page_Description *);
extern void fn_v_Page_Split(SCR_tdst_File_Description *, SCR_tdst_Page_Description *);
extern void fn_v_Page_InsertChar(SCR_tdst_File_Description *, char);
extern void fn_v_Page_DeleteChar(SCR_tdst_File_Description *);
extern void fn_v_Page_ToNextChar(SCR_tdst_File_Description *);
extern void fn_v_Page_ToPrevChar(SCR_tdst_File_Description *);
extern void fn_v_Page_LoadFile(SCR_tdst_File_Description *);
extern void fn_v_Page_SaveFile(SCR_tdst_File_Description *);
extern void fn_v_Page_Seek(SCR_tdst_File_Description *, long, int);
#endif /* !__SCR_Page_h__Protos && !__Only_Types__ */

View File

@@ -0,0 +1,201 @@
/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* SCR_Pars.h
* Scripts, Beaudet Christophe
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
#ifndef __SCR_Pars_h__Types
#define __SCR_Pars_h__Types
#ifndef __Only_Types__
#define __SCR_Pars_h__Undef
#define __Only_Types__
#endif /* !__Only_Types__ */
/*
*=================================================================================================
* Includes.
*=================================================================================================
*/
#include "SCR_Cxt.h"
#ifdef __SCR_Pars_h__Undef
#undef __Only_Types__
#undef __SCR_Pars_h__Undef
#endif /* __SCR_Pars_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 */
/*
*=================================================================================================
* Types.
*=================================================================================================
*/
/*
* Structure that describes file parsing infos.
*/
typedef struct SCR_tdst_Pars_Infos_
{
struct SCR_tdst_Cxt_Position_ stPosition; /* Last position of parser */
unsigned short uwDynamicFlags; /* Flags depending on directives */
} SCR_tdst_Pars_Infos;
#endif /* __SCR_Pars_h__Types */
/*
*=================================================================================================
* Macros.
*=================================================================================================
*/
/*
* To get a character from a file.
* _File : File to read from.
* If d_stCurPage is NULL, then file is a real one (p_xHandle correct).
* Else, file is took from memory.
* _Read : To get read character.
*/
#define SCR_M_Pars_ReadChar(_File, _Read)\
{\
SCR_M_Dbg_Assert_P((_File) != NULL);\
/*
* Update gs_ui_Pars_NbRead.
*/\
SCR_g_ui_Pars_NbRead++;\
/*
* Normal read from file if d_stFirstPage is NULL.
*/\
if((_File)->d_stFirstPage == NULL)\
{\
SCR_M_fgetc(_File, _Read);\
}\
else\
{\
/*
* Read from a special save file if not.
* Pass to next character.
*/\
_Read = (_File)->d_stCurPage->d_cBuffer[(_File)->iCurPosInPage];\
if(_Read == 0)\
_Read = EOF;\
fn_v_Page_ToNextChar(_File);\
}\
}
/*
* Is a character is a space ?
* _Char : Character to test.
*/
#define SCR_M_Pars_IsSpace(_iChar) ((_iChar == ' ') || (_iChar == '\t') || (_iChar == '\r'))
/*
* To obtain next character except blanks.
* _File : File to read characters
* _Read : To receive next character
*/
#define SCR_M_Pars_GetNextNonSpaceChar(_File, _Read)\
{\
SCR_M_Dbg_Assert_P((_File) != NULL);\
do\
{\
SCR_M_Pars_ReadChar(_File, _Read);\
} while(SCR_M_Pars_IsSpace(_Read));\
}
/*
* Zap blanks if _Read is a blank character.
* _File : File to read characters
* _Read : To receive next character. Must be correct when call.
*/
#define SCR_M_Pars_ZapIfSpace(_File, _Read)\
{\
SCR_M_Dbg_Assert_P((_File) != NULL);\
while(SCR_M_Pars_IsSpace(iRead))\
{\
SCR_M_Pars_ReadChar(_File, _Read);\
};\
}
/*
* A macro to free parameters.
*/
#define SCR_M_Pars_FreeParameters(_ap_szParameters)\
{\
SCR_M_Dbg_Assert_P(_ap_szParameters != NULL);\
if(_ap_szParameters[0])\
gs_p_cNewFreePlace = _ap_szParameters[0];\
}
/*
* Basic functions.
*/
#define strstri(a, b) SCR_strstri(a, b)
/*
* Macros to determin if a given character is valid.
*/
#define SCR_M_Pars_CharValidForWord(_Char)\
(gs_a256_cIsCharValidForWord[_Char])
/*
*=================================================================================================
* Global variables.
*=================================================================================================
*/
#if !defined(__SCR_Pars_h__Globals) && !defined(__Only_Types__)
#define __SCR_Pars_h__Globals
CPA_EXPORT extern unsigned int SCR_g_ui_Pars_NbRead;
CPA_EXPORT extern char gs_a256_cIsCharValidForWord[256];
extern char *gs_p_cNewFreePlace;
#endif /* !__SCR_Pars_h__Globals && !__Only_Types__ */
/*
*=================================================================================================
* Protos.
*=================================================================================================
*/
#if !defined(__SCR_Pars_h__Protos) && !defined(__Only_Types__)
#define __SCR_Pars_h__Protos
extern int fn_i_Pars_Word(struct SCR_tdst_File_Description_ *, char *);
extern int fn_i_Pars_SectionName(struct SCR_tdst_File_Description_ *, char *, char *);
extern int fn_i_Pars_FormatArray(struct SCR_tdst_File_Description_ *, char **);
extern int fn_i_Pars_FormatScanf(struct SCR_tdst_File_Description_ *, char **);
extern int fn_i_Pars_Format(struct SCR_tdst_File_Description_ *, char *);
extern int fn_i_Pars_Parameters(struct SCR_tdst_File_Description_ *, char *);
extern int fn_i_Pars_FormatParameters(struct SCR_tdst_File_Description_ *, int, char *, char *);
extern int fn_i_Pars_Line(struct SCR_tdst_File_Description_ *, char *, char *, char *, char *, SCR_tde_Cxt_ParseType *, unsigned int *);
extern void fn_v_Pars_ConvertNormalParameters(char *, char *[]);
extern void fn_v_Pars_ConvertReferencesParameters(char *, char *, char *[]);
extern void fn_v_Pars_ConvertArrayParameters(char *, char *, char *[]);
extern void fn_v_Pars_ConvertScanfParameters(char *, char *, char *[]);
extern void fn_v_Pars_ConvertParameters(char *, char *, char *[]);
extern char *SCR_strstri(char *, char *);
extern int SCR_strcmpi(char *, char *);
#endif /* !__SCR_Pars_h__Protos && !__Only_Types__ */

View File

@@ -0,0 +1,433 @@
/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* 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__ */

View File

@@ -0,0 +1,122 @@
/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* SCR_Sect.h
* Scripts, Beaudet Christophe
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
*/
#ifndef __SCR_Sect_h__Types
#define __SCR_Sect_h__Types
#ifndef __Only_Types__
#define __SCR_Sect_h__Undef
#define __Only_Types__
#endif /* !__Only_Types__ */
/*
*=================================================================================================
* Includes.
*=================================================================================================
*/
#include "SCR_Cxt.h"
#include "SCR_Hash.h"
#ifdef __SCR_Sect_h__Undef
#undef __Only_Types__
#undef __SCR_Sect_h__Undef
#endif /* __SCR_Sect_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 */
/*
*=================================================================================================
* Types.
*=================================================================================================
*/
/*
* Structure that describes an open section.
*/
typedef struct SCR_tdst_Sect_Open_
{
SCR_tdst_DyAr_Header stHeader; /* Header of element */
SCR_tdst_Cxt_Buffers stBuffers; /* Buffers to describe section name */
SCR_tdst_Cxt_Values stSectionValues; /* Values for that section */
unsigned int uiIndexOfHashValue; /* Index of hash value in table */
unsigned int uiLineInFile; /* Line in file of section header */
SCR_tdx_Hash_Key xHashKey; /* Hash key code */
} SCR_tdst_Sect_Open;
#endif /* !__SCR_Sect_h__Types */
/*
*=================================================================================================
* Global variables.
*=================================================================================================
*/
#if !defined(__SCR_Sect_h__Globals) && !defined(__Only_Types__)
#define __SCR_Sect_h__Globals
CPA_EXPORT extern SCR_tdst_DyAr_Description SCR_g_st_Sect_ArrayOpen;
CPA_EXPORT extern SCR_tda_st_Hash_Table SCR_g_a_st_Sect_HashTableOpen;
#endif /* !__SCR_Sect_h__Globals && !__Only_Types__ */
/*
*=================================================================================================
* Macros.
*=================================================================================================
*/
#if !defined(__SCR_Sect_h__Macros) && !defined(__Only_Types__)
#define __SCR_Sect_h__Macros
/*
* To compute hash key of an open section.
*/
#define SCR_M_Sect_ComputeHashKey(_HashKey, _Name)\
{\
_HashKey = SCR_fn_x_Hash_ComputeHashKeyForString(_Name);\
}
#endif /* !__SCR_Sect_h__Macros && !__Only_Types__ */
/*
*=================================================================================================
* Protos.
*=================================================================================================
*/
#if !defined(__SCR_Sect_h__Protos) && !defined(__Only_Types__)
#define __SCR_Sect_h__Protos
extern void fn_v_Sect_InitModule(void);
extern void fn_v_Sect_CloseModule(void);
extern SCR_tdst_Sect_Open *fnp_st_Sect_AddOpen(SCR_tdst_Cxt_Description *, SCR_tdx_Hash_Key);
extern void fn_v_Sect_DeleteOpen(SCR_tdst_Sect_Open *);
extern SCR_tdst_Sect_Open *fnp_st_Sect_SearchOpen(char *, unsigned int, SCR_tdx_Hash_Key);
extern void fn_v_Sect_ReduceMemory(void);
extern void fn_v_Sect_DeleteWithMemLevel(unsigned char, unsigned char);
#endif /* !__SCR_Sect_h__Protos && !__Only_Types__ */

View File

@@ -0,0 +1,220 @@
/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* SCR_SvL0.h
* Scripts, Beaudet Christophe
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
*/
#ifndef __SCR_SvL0_h__Types
#define __SCR_SvL0_h__Types
#ifndef __Only_Types__
#define __SCR_SvL0_h__Undef
#define __Only_Types__
#endif /* !__Only_Types__ */
/*
*=================================================================================================
* Includes.
*=================================================================================================
*/
#ifdef __SCR_SvL0_h__Undef
#undef __Only_Types__
#undef __SCR_SvL0_h__Undef
#endif /* __SCR_SvL0_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 */
/*
*=================================================================================================
* Types.
*=================================================================================================
*/
/*
* Format specifiers for saving functions.
*/
typedef enum SCR_tde_SvL0_Format_
{
SCR_EF_SvL0_Normal,
SCR_EF_SvL0_ArrayByte,
SCR_EF_SvL0_ArrayShort,
SCR_EF_SvL0_ArrayLong,
SCR_EF_SvL0_ArrayFloat,
SCR_EF_SvL0_ArrayDouble,
SCR_EF_SvL0_ArrayInt,
SCR_EF_SvL0_ArrayBoolean,
SCR_EF_SvL0_ArrayDisEna,
SCR_EF_SvL0_ArrayReferences,
SCR_EF_SvL0_Scanf,
} SCR_tde_SvL0_Format;
#endif /* !__SCR_SvL0_h__Types */
/*
*=================================================================================================
* Global variables.
*=================================================================================================
*/
#if !defined(__SCR_SvL0_h__Globals) && !defined(__Only_Types__)
#define __SCR_SvL0_h__Globals
/* Indentation level for saving functions */
CPA_EXPORT extern unsigned int SCR_g_ui_SvL0_IndentationLevel;
#endif /* !__SCR_SvL0_h__Globals && !__Only_Types__ */
/*
*=================================================================================================
* Macros.
*=================================================================================================
*/
#if !defined(__SCR_SvL0_h__Macros) && !defined(__Only_Types__)
#define __SCR_SvL0_h__Macros
/*
* To save indent level.
* _File : File to save.
*/
#define SCR_M_SvL0_SaveIndentLevel(_File)\
{\
unsigned int _uiIndex_;\
for(_uiIndex_ = 0; _uiIndex_ < SCR_g_ui_SvL0_IndentationLevel; _uiIndex_++)\
fn_v_SvL0_fputc(_File, '\t');\
}
/*
* To save a begin of section.
* _File : File to save.
* _Name : Complete name of section.
* _LChar : Character to write after the name.
*/
#define SCR_M_SvL0_SaveBeginSection(_File, _Name, _LChar)\
{\
SCR_M_SvL0_SaveIndentLevel(_File);\
SCR_fn_v_SvL0_SaveWord(_File, SCR_CC_c_Cfg_SectionBegMark, _Name, _LChar);\
SCR_g_ui_SvL0_IndentationLevel++;\
}
/*
* To save a end of section.
* _File : File to save.
* _LChar : Character to write after the name.
*/
#define SCR_M_SvL0_SaveEndSection(_File, _LChar)\
{\
if(SCR_g_ui_SvL0_IndentationLevel)\
SCR_g_ui_SvL0_IndentationLevel--;\
SCR_M_SvL0_SaveIndentLevel(_File);\
SCR_fn_v_SvL0_SaveWord(_File, SCR_CC_c_Cfg_SectionEndMark, NULL, _LChar);\
}
/*
* To save an entry.
* _File : File to save.
* _Name : Name of entry.
* _LChar : Character to write after the name.
*/
#define SCR_M_SvL0_SaveEntry(_File, _Name, _LChar)\
{\
SCR_M_SvL0_SaveIndentLevel(_File);\
SCR_fn_v_SvL0_SaveWord(_File, SCR_CC_C_Cfg_NoChar, _Name, _LChar);\
}
/*
* To save a comment.
* _File : File to save.
* _Name : Comment to write.
*/
#define SCR_M_SvL0_SaveComment(_File, _Name)\
{\
SCR_M_SvL0_SaveIndentLevel(_File);\
SCR_fn_v_SvL0_SaveWord(_File, SCR_CC_c_Cfg_CommentMark, _Name, '\n');\
}
/*
* To save a directive.
* _File : File to save.
* _Name : Directive to write.
* _LChar : Character to write after the name.
*/
#define SCR_M_SvL0_SaveDirective(_File, _Name, _LChar)\
{\
SCR_M_SvL0_SaveIndentLevel(_File);\
SCR_fn_v_SvL0_SaveWord(_File, SCR_CC_c_Cfg_DirectiveMark, _Name, _LChar);\
}
/*
* To save a blank line.
* _File : File to save.
*/
#define SCR_M_SvL0_SaveBlankLine(_File)\
{\
SCR_fn_v_SvL0_SaveWord(_File, SCR_CC_C_Cfg_NoChar, NULL, SCR_CC_C_Cfg_EOL);\
}
/*
* To save the first line description of a script file.
*/
#define SCR_M_SvL0_SaveScriptFileHeader(_File)\
{\
SCR_fn_v_SvL0_SaveWord(_File, SCR_CC_C_Cfg_NoChar, SCR_CSV_sz_Cfg_ScriptFileHeader, SCR_CC_C_Cfg_NoChar);\
SCR_fn_v_SvL0_SaveWord(_File, SCR_CC_c_Cfg_CommentMark, " Scripts Parser Version ", SCR_CC_C_Cfg_NoChar);\
SCR_fn_v_SvL0_SaveWord(_File, SCR_CC_C_Cfg_NoChar, SCR_CSV_sz_Cfg_ScriptVersion, '\n');\
SCR_fn_v_SvL0_SaveWord(_File, SCR_CC_c_Cfg_CommentMark, " (c) Ubi Simulations 1997", '\n');\
SCR_M_SvL0_SaveBlankLine(_File);\
}
/*
* To save the post format of a line.
*/
#define SCR_M_SvL0_SavePostFormat(_File, _String)\
{\
SCR_fn_v_SvL0_SaveWord(_File, SCR_CC_c_Cfg_PostFormatBegMark, _String, SCR_CC_c_Cfg_PostFormatEndMark);\
}
#endif /* !__SCR_SvL0_h__Macros && !__Only_Types__ */
/*
*=================================================================================================
* Protos.
*=================================================================================================
*/
#if !defined(__SCR_SvL0_h__Protos) && !defined(__Only_Types__)
#define __SCR_SvL0_h__Protos
CPA_EXPORT extern void fn_v_SvL0_fputc(SCR_tdst_File_Description *, char);
CPA_EXPORT extern void fn_v_SvL0_fputs(SCR_tdst_File_Description *, char *);
extern void fn_v_SvL0_SaveNormalFormat(SCR_tdst_File_Description *, unsigned int, char *[]);
extern void fn_v_SvL0_SaveArrayFormat(SCR_tdst_File_Description *, SCR_tde_SvL0_Format, char *[]);
extern void fn_v_SvL0_SaveFormatSpecifier(SCR_tdst_File_Description *, SCR_tde_SvL0_Format, char *[]);
CPA_EXPORT extern void SCR_fn_v_SvL0_SaveWord(SCR_tdst_File_Description *, char, char *, char);
CPA_EXPORT extern void SCR_fn_v_SvL0_SaveFormat(SCR_tdst_File_Description *, SCR_tde_SvL0_Format);
CPA_EXPORT extern void SCR_fn_v_SvL0_SaveParameters_AP(SCR_tdst_File_Description *, SCR_tde_SvL0_Format, unsigned int, char *[]);
CPA_EXPORT extern void SCR_fn_v_SvL0_SaveParameters_MP(SCR_tdst_File_Description *, SCR_tde_SvL0_Format, unsigned int, ...);
#endif /* !__SCR_SvL0_h__Protos && !__Only_Types__ */

View File

@@ -0,0 +1,119 @@
/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* SCR_SvL1.h
* Scripts, Beaudet Christophe
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
*/
#ifndef __SCR_SvL1_h__Types
#define __SCR_SvL1_h__Types
#ifndef __Only_Types__
#define __SCR_SvL1_h__Undef
#define __Only_Types__
#endif /* !__Only_Types__ */
/*
*=================================================================================================
* Includes.
*=================================================================================================
*/
#include "SCR_Ntfy.h"
#ifdef __SCR_SvL1_h__Undef
#undef __Only_Types__
#undef __SCR_SvL1_h__Undef
#endif /* __SCR_SvL1_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 */
#endif /* __SCR_SvL1_h__Types */
/*
*=================================================================================================
* Global variables.
*=================================================================================================
*/
#if !defined(__SCR_SvL1_h__Globals) && !defined(__Only_Types__)
#define __SCR_SvL1_h__Globals
CPA_EXPORT extern char gs_a_szModifyFileName[_MAX_PATH];
#endif /* !__SCR_SvL1_h__Globals && !__Only_Types__ */
/*
*=================================================================================================
* Macros.
*=================================================================================================
*/
#if !defined(__SCR_SvL1_h__Macros) && !defined(__Only_Types__)
#define __SCR_SvL1_h__Macros
/*
* Update modify file.
* _String : String to write.
*/
#define SCR_M_v_SvL1_UpdateModify(_String)\
{\
FILE *p_xFile;\
p_xFile = fopen(gs_a_szModifyFileName, "at");\
if(p_xFile == NULL)\
p_xFile = fopen(gs_a_szModifyFileName, "wt");\
if(p_xFile)\
fprintf(p_xFile, "%s", _String);\
/*ANNECY CB*/\
if(p_xFile)\
/*ENDANNECY*/\
fclose(p_xFile);\
}
#endif /* !__SCR_SvL1_h__Macros && !__Only_Types__ */
/*
*=================================================================================================
* Protos.
*=================================================================================================
*/
#if !defined(__SCR_SvL1_h__Protos) && !defined(__Only_Types__)
#define __SCR_SvL1_h__Protos
CPA_EXPORT extern void SCR_fn_v_SvL1_RegisterNotify(char *, SCR_tdpfn_Ntfy_Callback, void *, SCR_tde_Ntfy_Action);
CPA_EXPORT extern void SCR_fn_v_SvL1_DeleteRegisterNotify(char *, char);
CPA_EXPORT extern SCR_tdst_Ntfy_Description *SCR_fnp_st_SvL1_GetRegisterNotify(char *);
CPA_EXPORT extern void SCR_fn_v_SvL1_ToPrevLine(SCR_tdst_File_Description *);
CPA_EXPORT extern void SCR_fn_v_SvL1_ToNextLine(SCR_tdst_File_Description *);
CPA_EXPORT extern void SCR_fn_v_SvL1_ToNextSection(SCR_tdst_File_Description *);
CPA_EXPORT extern void SCR_fn_v_SvL1_ToEndSection(SCR_tdst_File_Description *);
CPA_EXPORT extern unsigned int SCR_fn_ui_SvL1_GetLine(SCR_tdst_File_Description *, char *);
CPA_EXPORT extern void SCR_fn_v_SvL1_DeleteLine(SCR_tdst_File_Description *);
CPA_EXPORT extern void SCR_fn_v_SvL1_DeleteSection(SCR_tdst_File_Description *);
CPA_EXPORT extern void fn_v_SvL1_UpdateOneNotify(SCR_tdst_Ntfy_Description *, SCR_tde_Ntfy_Action);
CPA_EXPORT extern void SCR_fn_v_SvL1_UpdateAllNotify(void);
CPA_EXPORT extern void SCR_fn_v_SvL1_SetModificationFileName(char *);
#endif /* !__SCR_SvL1_h__Protos && !__Only_Types__ */

View File

@@ -0,0 +1,99 @@
/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* SCR_Vars.h
* Scripts, Beaudet Christophe
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
*/
#ifndef __SCR_Vars_h__Types
#define __SCR_Vars_h__Types
#ifndef __Only_Types__
#define __SCR_Vars_h__Undef
#define __Only_Types__
#endif /* !__Only_Types__ */
/*
*=================================================================================================
* Includes.
*=================================================================================================
*/
#include "SCR_Cfg.h"
#ifdef __SCR_Vars_h__Undef
#undef __Only_Types__
#undef __SCR_Vars_h__Undef
#endif /* __SCR_Vars_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 */
/*
*=================================================================================================
* Types.
*=================================================================================================
*/
/*
* To describe a global variable.
*/
typedef struct SCR_tdst_Vars_Description_
{
SCR_tdst_DyAr_Header stHeader; /* Header of element */
char a_szVarName[SCR_CV_ui_Cfg_MaxLenVarName]; /* Name of variable */
char a_szVarValue[SCR_CV_ui_Cfg_MaxLenVarVal]; /* Value of variable */
} SCR_tdst_Vars_Description;
#endif /* !__SCR_Vars_h__Types */
/*
*=================================================================================================
* Global variables.
*=================================================================================================
*/
#if !defined(__SCR_Vars_h__Globals) && !defined(__Only_Types__)
#define __SCR_Vars_h__Globals
CPA_EXPORT extern SCR_tdst_DyAr_Description SCR_g_st_Vars_Array;
#endif /* !__SCR_Vars_h__Globals && !__Only_Types__ */
/*
*=================================================================================================
* Protos.
*=================================================================================================
*/
#if !defined(__SCR_Vars_h__Protos) && !defined(__Only_Types__)
#define __SCR_Vars_h__Protos
extern void fn_v_Vars_InitModule(void);
extern void fn_v_Vars_CloseModule(void);
extern SCR_tdst_Vars_Description *fnp_st_Vars_Add(char *, char *);
extern void fn_v_Vars_Delete(SCR_tdst_Vars_Description *);
extern SCR_tdst_Vars_Description *fnp_st_Vars_Search(char *);
extern void fn_v_Vars_ReduceMemory(void);
extern void fn_v_Vars_DeleteWithMemLevel(unsigned char, unsigned char);
#endif /* !__SCR_Vars_h__Protos && !__Only_Types__ */

View File

@@ -0,0 +1,166 @@
/*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* SCR_XXXX.h
* Compatibility file with version 1.8.X of script parser.
*
* Scripts, Beaudet Christophe
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
*/
#ifndef __SCR_XXXX_h__
#define __SCR_XXXX_h__
/*
*=================================================================================================
* Constants.
*=================================================================================================
*/
/*
* Actions in callbacks.
*/
#define C_SCRIPT_AlreadyAnalysed SCR_EA_Anl_AlreadyAnalysed
#define C_SCRIPT_Section SCR_EA_Anl_BeginSection
#define C_SCRIPT_BegSubSection SCR_EA_Anl_BeginSubSection
#define C_SCRIPT_EndSection SCR_EA_Anl_EndSection
#define C_SCRIPT_EndSubSection SCR_EA_Anl_EndSubSection
#define C_SCRIPT_Entry SCR_EA_Anl_Entry
/*
* Global values.
*/
#define C_SCRIPT_uiMaxLenID SCR_CV_Cfg_MaxLenWord
#define C_SCRIPT_uiMaxLenLine SCR_CV_Cfg_MaxLenLine
#define C_SCRIPT_cRefSubSection SCR_CC_c_Cfg_NameSeparator
#define C_SCRIPT_szRefSubSection SCR_CC_sz_Cfg_NameSeparator
/*
* Return values.
*/
#define R_SCRIPT_NormalReturn SCR_ERV_Anl_NormalReturn
#define R_SCRIPT_TerminateCurrentSection SCR_ERV_Anl_TerminateCurrentSection
#define R_SCRIPT_TerminateFile SCR_ERV_Anl_TerminateFile
#define R_SCRIPT_TerminateMainSection SCR_ERV_Anl_TerminateMainSection
/*
* Format to save.
*/
#define F_SCRIPT_NoFormat SCR_EF_SvL0_Normal
#define F_SCRIPT_ArrayByte SCR_EF_SvL0_ArrayByte
#define F_SCRIPT_ArrayShort SCR_EF_SvL0_ArrayShort
#define F_SCRIPT_ArrayLong SCR_EF_SvL0_ArrayLong
#define F_SCRIPT_ArrayFloat SCR_EF_SvL0_ArrayFloat
#define F_SCRIPT_ArrayDouble SCR_EF_SvL0_ArrayDouble
#define F_SCRIPT_ArrayInt SCR_EF_SvL0_ArrayInt
#define F_SCRIPT_ArrayBoolean SCR_EF_SvL0_ArrayBoolean
#define F_SCRIPT_ArrayDisEna SCR_EF_SvL0_ArrayDisEna
#define F_SCRIPT_ArrayReference SCR_EF_SvL0_ArrayReferences
#define F_SCRIPT_Scanf SCR_EF_SvL0_Scanf
/*
* For hash and link.
*/
#define S_REF_Valid SCR_ELS_Link_NotInitialized
#define S_REF_Free SCR_ELS_Link_Initialized
/*
*=================================================================================================
* Macros.
*=================================================================================================
*/
#define SCRIPT_PCHAR(_Exp) SCR_M_RdL0_PCHAR(_Exp)
#define SCRIPT_CHAR(_Exp) SCR_M_RdL0_CHAR(_Exp)
#define SCRIPT_PSHORT(_Exp) SCR_M_RdL0_PSHORT(_Exp)
#define SCRIPT_SHORT(_Exp) SCR_M_RdL0_SHORT(_Exp)
#define SCRIPT_PLONG(_Exp) SCR_M_RdL0_PLONG(_Exp)
#define SCRIPT_LONG(_Exp) SCR_M_RdL0_LONG(_Exp)
#define SCRIPT_PINT(_Exp) SCR_M_RdL0_PINT(_Exp)
#define SCRIPT_INT(_Exp) SCR_M_RdL0_INT(_Exp)
#define SCRIPT_PFLOAT(_Exp) SCR_M_RdL0_PFLOAT(_Exp)
#define SCRIPT_FLOAT(_Exp) SCR_M_RdL0_FLOAT(_Exp)
#define SCRIPT_PDOUBLE(_Exp) SCR_M_RdL0_PDOUBLE(_Exp)
#define SCRIPT_DOUBLE(_Exp) SCR_M_RdL0_DOUBLE(_Exp)
/*
*=================================================================================================
* Types.
*=================================================================================================
*/
#define SCRIPT_tdeAction SCR_tde_Anl_Action
#define SCRIPT_tdeReturnValue SCR_tde_Anl_ReturnValue
#define SCRIPT_tdstSaveFile SCR_tdst_File_Description
#define REF_tdstLinkTable SCR_tdst_Link_Table
#define REF_tdxLinkId SCR_tdst_Link_Value *
/*
*=================================================================================================
* Functions (macros).
*=================================================================================================
*/
#define SCRIPT_vFirstInit() SCR_fn_v_RdL0_Init()
#define SCRIPT_vLastClose() SCR_fn_v_RdL0_Close()
#define SCRIPT_p_stGetLastError() SCR_fnp_st_RdL0_GetLastError()
#define SCRIPT_vClearError() SCR_fn_v_RdL0_ClearError()
#define SCRIPT_vDelAllOpenSections SCR_fn_v_RdL0_DeleteOpenSection("", SCR_CDR_c_RdL0_Contains)
#define SCRIPT_vDelOpenSection(a) SCR_fn_v_RdL0_DeleteOpenSection(a, SCR_CDR_c_RdL0_Contains)
#define SCRIPT_vRegisterPath(a) SCR_fn_v_RdL0_RegisterPath(a)
#define SCRIPT_vDelAllPathNames() SCR_fn_v_RdL0_DeleteRegisterPath("", SCR_CDR_c_RdL0_Contains)
#define SCRIPT_vRegisterSection(a, b) SCR_fn_v_RegisterCallback(a, (SCR_tdpfn_Anl_Callback) b, SCR_CRC_c_RdL0_ForSection)
#define SCRIPT_p_stGetRegisterSection(a) SCR_fn_p_st_RdL0_GetRegisterCallback(a, SCR_CRC_c_RdL0_ForSection)
#define SCRIPT_vDelAllRegSections() SCR_fn_v_RdL0_DeleteRegisterCallback("", SCR_CDR_c_RdL0_Contains)
#define SCRIPT_vDelRegisterSection(a) SCR_fn_v_RdL0_DeleteRegisterCallback(a, SCR_CDR_c_RdL0_Contains)
#define SCRIPT_ucGetNumberOfArgs(a) SCR_fn_uc_RdL0_GetNumberOfParameters(a)
#define SCRIPT_vSplitSectionName(a, b, c) SCR_fn_v_RdL0_SplitSectionName(a, NULL, b, c)
#define SCRIPT_p_szGetFileName(a) SCR_M_RdL0_GetOpenFileNameR(a)
#define SCRIPT_p_szGetSectionName(a) SCR_M_RdL0_GetCompleteSectionNameR(a)
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#define REF_fn_uiComputeHashKeyForString(a) SCR_fn_x_Hash_ComputeHashKeyForString(a)
#define REF_fn_vInitLinkTable(a) SCR_fn_v_Link_InitTable(a)
#define REF_fn_vDelReallyLinkTable(a) SCR_fn_v_Link_CloseTable(a)
#define REF_fn_vAddEntryToLinkTable(a, b, c, d, e) SCR_fnp_st_Link_AddEntryToLinkTable(a, b, d, e)
#define REF_fn_xSearchKeyInLinkTable(a, b, c) SCR_fnp_st_Link_SearchKey(a, b)
#define REF_fn_xCreateOrGetIdFromKey(a, b, c) SCR_fnp_st_Link_CreateOrGetLinkFromKey(a, b)
#define REF_fn_xSetValue(a, b, c, d) SCR_fnp_st_Link_SetValue(a, b, d)
#define REF_fn_ulGetValueFromId(a, b) ((b)->ulValue)
#define REF_fn_uiGetHashKeyFromId(a, b) ((b)->xHashKeyForKey)
#define REF_fn_eGetStateFromId(a, b) ((b)->eState)
#define REF_fn_xGetIdFromValue(a, b) SCR_fnp_st_Link_SearchValue(a, b)
#define REF_fnp_szGetKeyFromId(a, b) ((b)->szKey)
#define REF_fn_vInvalidateMyObject(a, b) {*(b) = NULL;}
#define REF_fn_cIsMyObjectValid(a, b) ((b) != NULL)
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#define SCRIPT_vSaveEndSection(a) SCR_M_SvL0_SaveEndSection(a, SCR_CC_C_Cfg_EOL)
#define SCRIPT_vSaveCommentLine(a, b) SCR_M_SvL0_SaveComment(a, b)
#define SCRIPT_vSaveEmptyLine(a) SCR_M_SvL0_SaveBlankLine(a)
#define SCRIPT_vSaveCharacters(a, b) SCR_fn_v_SvL0_SaveWord(a, SCR_CC_C_Cfg_NoChar, b, SCR_CC_C_Cfg_NoChar)
#define SCRIPT_uiGetSaveIndentLevel(void) (SCR_g_ui_SvL0_IndentationLevel)
#define SCRIPT_vSetSaveIndentLevel(a) {SCR_g_ui_SvL0_IndentationLevel = (a);}
#define SCRIPT_vSaveBeginSection(a, b, c, d, e, f)
#define SCRIPT_vSaveEntryInSection(a, b, c, d, e, f)
#define SCRIPT_vSaveFileDescription(a, b, c)
#define SCR_fn_v_RdL0_DelOpenFile(a, b) SCR_fn_v_RdL0_DeleteOpenFile(a, b)
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/* SCR V5.4.1 */
#define SCR_fn_v_RdL0_InitWithMem(a) SCR_fn_v_RdL0_Init()
#define SCR_fn_v_RdL0_ReduceMemory() SCR_fn_v_Mem_ReduceMemory()
#define SCR_fn_v_RdL0_SetCurrentFilePriority(a) SCR_fn_v_Mem_SetCurrentLevel(a)
#define SCR_fn_uc_RdL0_GetCurrentFilePriority() SCR_fn_uc_Mem_GetCurrentLevel()
#define SCR_M_uc_Link_GetPriority(a) SCR_M_uc_Link_GetMemLevel(a)
#define SCR_fn_v_Link_DeleteEntryWithPriority(a, b, c)
#define SCR_fn_v_RdL0_DeleteOpenWithPriority(a, b)
#endif /* __SCR_XXXX_h__ */