221 lines
6.9 KiB
C
221 lines
6.9 KiB
C
/*
|
|
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
* 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__ */
|