176 lines
6.7 KiB
C
176 lines
6.7 KiB
C
/*
|
|
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
* 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__ */
|