/*=========================================================================
*
* PhySave.h	- Saving functions for PHY file
*
* Version			1.0
* Revision date
*
*=======================================================================*/
#include "PhySave.h"

#include "conventi.h"
#include "system.h"		

#include "geoobj.h"


//--- Global statics --------------------------------------------------------

// retrieve the maximum index in Tbl file
long gs_lMaximumIndex; 


//--------------------------------------------------------------------


 /****************************************************************************
*		Description:	init maximum index before saving
*
*		Parameters:		
*---------------------------------------------------------------------------
*		Revision date:                                      Author:         
*****************************************************************************/
void MLT_vInitSaveTbl()
{
  gs_lMaximumIndex = 0;
}


 /****************************************************************************
*		Description:	Save TBL file header
*
*		Parameters:		p_stFile	: script file pointer
*						sFileName	: file name
*						p_vPtr		: data pointer
*						xAction		: script action
*---------------------------------------------------------------------------
*		Revision date:                                      Author:         
*****************************************************************************/
void MLT_vSaveTblFile(SCR_tdst_File_Description *p_stFile, char *sFileName, void *p_vPtr, SCR_tde_Ntfy_Action xAction)
{
  xString mes;

  if(p_vPtr != NULL)
    SCR_fn_v_SvL1_DeleteSection(p_stFile);

  sprintf(mes, "%s%s", M_TBL_HEADER, SCR_CC_sz_Cfg_SectionIdMark);
  SCR_M_SvL0_SaveBeginSection(p_stFile, mes, SCR_CC_C_Cfg_EOL);

  SCR_M_SvL0_SaveEntry(p_stFile, M_VersionNumber, SCR_CC_C_Cfg_NoChar);
  SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, "1");

  SCR_M_SvL0_SaveEntry(p_stFile, M_OBJActionMaximumIndex, SCR_CC_C_Cfg_NoChar);
  SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 2, "%d", gs_lMaximumIndex);

  SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
}


/****************************************************************************
*		Description:	Save PHY file header
*
*		Parameters:		p_stFile	: script file pointer
*						sFileName	: file name
*						p_vPtr		: data pointer
*						xAction		: script action
*---------------------------------------------------------------------------
*		Revision date:                                      Author:         
*****************************************************************************/
void MLT_vSavePhyFile(SCR_tdst_File_Description *p_stFile, char *sFileName, void *p_vPtr, SCR_tde_Ntfy_Action xAction)
{
  xString mes;

  SCR_fn_v_SvL1_DeleteSection(p_stFile);

  sprintf(mes, "%s%s", M_PHY_HEADER, SCR_CC_sz_Cfg_SectionIdMark);
  SCR_M_SvL0_SaveBeginSection(p_stFile, mes, SCR_CC_C_Cfg_EOL);

  SCR_M_SvL0_SaveEntry(p_stFile, M_VersionNumber, SCR_CC_C_Cfg_NoChar);
  SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 2, "%d", 1);

  SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
}




/****************************************************************************
*		Description:	Save TBL section
*
*		Parameters:		p_stFile	: script file pointer
*						sFileName	: file name
*						p_vPtr		: data pointer
*						xAction		: script action
*---------------------------------------------------------------------------
*		Revision date:                                      Author:         
*****************************************************************************/
void MLT_vSaveTbl(SCR_tdst_File_Description *p_stFile, char *sFileName, void *p_vPtr, SCR_tde_Ntfy_Action xAction)
{
  xString mes, sFile, sAction, sIdent, sSection, sIdent2;
  MLT_tdstGeometricObject *p_stGeometric;

  p_stGeometric = (MLT_tdstGeometricObject *)p_vPtr;
  if(xAction == SCR_EA_Ntfy_AddSection) 
  {
    SCR_fn_v_SvL1_ToEndSection(p_stFile);
  }
  else
    return;

  sprintf(sFile, "%s.tbl", g_sFileIn);
  gs_lMaximumIndex = (gs_lMaximumIndex<p_stGeometric->lNumberInTable ? p_stGeometric->lNumberInTable:gs_lMaximumIndex);
  sprintf(mes, "%d", p_stGeometric->lNumberInTable);
  SCR_fn_v_RdL0_ComputeSectionName(sSection, sFile, M_Tbl, mes);
  SCR_M_SvL0_SaveBeginSection(p_stFile, MLT_p_cGetSectionName(sSection), SCR_CC_C_Cfg_EOL);

  SCR_fn_v_RdL0_SplitSectionName(p_stGeometric->sPhysicalSection, sFile, sAction, sIdent);
  sprintf(sFile, "%s%s.phy", g_sDirectorySave, g_sFileIn);
  sprintf(sIdent2, "PO_%s", sIdent);
  SCR_fn_v_RdL0_ComputeSectionName(sSection, sFile, sAction, sIdent2);
  SCR_M_SvL0_SaveEntry(p_stFile, M_Phy, SCR_CC_C_Cfg_NoChar);
  SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, sSection);

  SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
}


/****************************************************************************
*		Description:	Save PHY section
*
*		Parameters:		p_stFile	: script file pointer
*						sFileName	: file name
*						p_vPtr		: data pointer
*						xAction		: script action
*---------------------------------------------------------------------------
*		Revision date:                                      Author:         
*****************************************************************************/
void MLT_vSavePhy(SCR_tdst_File_Description *p_stFile, char *sFileName, void *p_vPtr, SCR_tde_Ntfy_Action xAction)
{
  xString mes, sFile, sAction, sIdent, sIdent2;
  xString  sForme, sHabillage, sName, sSection;
  long lNoPhy, lNoLod;
  MLT_tdstGeometricObject *p_stObj;

  p_stObj = (MLT_tdstGeometricObject *)p_vPtr;
  if(xAction == SCR_EA_Ntfy_AddSection) 
  {
    SCR_fn_v_SvL1_ToEndSection(p_stFile);
  }
  else
    return;

  SCR_fn_v_RdL0_SplitSectionName(p_stObj->sPhysicalSection, sFile, sAction, sIdent);
  sprintf(sFile, "%s%s.phy", g_sDirectorySave, g_sFileIn);
  sprintf(sIdent2, "PO_%s", sIdent);
  SCR_fn_v_RdL0_ComputeSectionName(mes, sFile, sAction, sIdent2);
  SCR_M_SvL0_SaveBeginSection(p_stFile, MLT_p_cGetSectionName(mes), SCR_CC_C_Cfg_EOL);

  SCR_fn_v_RdL0_SplitSectionName(p_stObj->sPhysicalSection, sFile, sAction, sIdent);
  sprintf(sFile, "%s%s.vse", g_sDirectorySave, g_sFileIn);
  MLT_vSplitModuleSectionName(sIdent, sForme, sHabillage, &lNoPhy, &lNoLod, sName);
  MLT_vComputeVisualSetSectionName(sIdent, sForme, sHabillage, sName);
  sprintf(sIdent2, "VSE_%s", sIdent);
  SCR_fn_v_RdL0_ComputeSectionName(sSection, sFile, M_VS, sIdent2);
  SCR_M_SvL0_SaveEntry(p_stFile, M_VS, SCR_CC_C_Cfg_NoChar);
  SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, sSection);

  if (!strstr(p_stObj->sName, "!nocol") && !strstr(p_stObj->sName, "!NOCOL"))
  {
  SCR_fn_v_RdL0_SplitSectionName(p_stObj->sPhysicalSection, sFile, sAction, sIdent);
  sprintf(sFile, "%s%s.zoo", g_sDirectorySave, g_sFileIn);
  sprintf(sIdent2, "CS_%s", sIdent);
  SCR_fn_v_RdL0_ComputeSectionName(sSection, sFile, M_CS, sIdent2);
  SCR_M_SvL0_SaveEntry(p_stFile, M_CS, SCR_CC_C_Cfg_NoChar);
  SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, sSection);
  }

  SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
}


/****************************************************************************
*		Description:	Save TBL section from OBJ file
*
*		Parameters:		p_stFile	: script file pointer
*						sFileName	: file name
*						p_vPtr		: data pointer
*						xAction		: script action
*---------------------------------------------------------------------------
*		Revision date:                                      Author:         
*****************************************************************************/
void MLT_vSaveTblFromObj(SCR_tdst_File_Description *p_stFile, char *sFileName, void *p_vPtr, SCR_tde_Ntfy_Action xAction)
{
  xString				mes, sFile, sSection;
  MLT_tdstObjElement	*p_stGeometric;

  p_stGeometric = (MLT_tdstObjElement *)p_vPtr;
  if(xAction == SCR_EA_Ntfy_AddSection) 
  {
    SCR_fn_v_SvL1_ToEndSection(p_stFile);
  }
  else
    SCR_fn_v_SvL1_DeleteSection(p_stFile);

  sprintf(mes, "%d()", p_stGeometric->lNumberInTable);

  sprintf(sFile, "%s.tbl", g_sFileIn);
  gs_lMaximumIndex = (gs_lMaximumIndex<p_stGeometric->lNumberInTable?p_stGeometric->lNumberInTable:gs_lMaximumIndex);
  sprintf(mes, "%d()", p_stGeometric->lNumberInTable);
  
  if ((p_stGeometric->iType!=0) && (p_stGeometric->iType!=6))
  {
	SCR_fn_v_RdL0_ComputeSectionName(sSection, sFile, M_Evt, mes);
	SCR_M_SvL0_SaveBeginSection(p_stFile, MLT_p_cGetSectionName(sSection), SCR_CC_C_Cfg_EOL);
  }
  else
  { 
	SCR_fn_v_RdL0_ComputeSectionName(sSection, sFile, M_Tbl, mes);
	SCR_M_SvL0_SaveBeginSection(p_stFile, MLT_p_cGetSectionName(sSection), SCR_CC_C_Cfg_EOL);
  }

  switch(p_stGeometric->iType)
  {
	case 0:  //a3dobject
		MLT_vSaveA3dObj(p_stFile, p_stGeometric);
			//save the ObjectType
		break;
	case 1:	//SoundEvent
		SCR_M_SvL0_SaveEntry(p_stFile, M_OBJActionObjectType, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 2, "%s",
			M_SoundEvent);
		MLT_vSaveSoundEvent(p_stFile, p_stGeometric);
		break;
	case 2:	//MechanicEvent
		SCR_M_SvL0_SaveEntry(p_stFile, M_OBJActionObjectType, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 2, "%s",
			M_MechanicEvent);
		MLT_vSaveMechanicEvent(p_stFile, p_stGeometric);
		break;
	case 3:	//GenericEvent
		SCR_M_SvL0_SaveEntry(p_stFile, M_OBJActionObjectType, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 2, "%s",
			M_GenericEvent);
		MLT_vSaveGenericEvent(p_stFile, p_stGeometric);
		break;
	case 4:	//GenerateEvent
		SCR_M_SvL0_SaveEntry(p_stFile, M_OBJActionObjectType, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 2, "%s",
			M_GenerateEvent);
		MLT_vSaveGenerateEvent(p_stFile, p_stGeometric);
		break;
	case 5:	//CameraEvent
		SCR_M_SvL0_SaveEntry(p_stFile, M_OBJActionObjectType, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 2, "%s",
			M_CameraEvent);
		MLT_vSaveCameraEvent(p_stFile, p_stGeometric);
		break;
	case 6:  //FakeEvent
		break;
  }

  SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
}

/****************************************************************************
*		Description:	Save PHY section from OBJ file
*
*		Parameters:		p_stFile	: script file pointer
*						sFileName	: file name
*						p_vPtr		: data pointer
*						xAction		: script action
*---------------------------------------------------------------------------
*		Revision date:                                      Author:         
*****************************************************************************/
void MLT_vSavePhyFromObj(SCR_tdst_File_Description *p_stFile, char *sFileName, void *p_vPtr, SCR_tde_Ntfy_Action xAction)
{
  xString mes, sFile, sAction, sIdent, sSection, sIdent2;
  MLT_tdstObjElement *p_stObj;

  p_stObj = (MLT_tdstObjElement *)p_vPtr;
  if(xAction == SCR_EA_Ntfy_AddSection) 
  {
    SCR_fn_v_SvL1_ToEndSection(p_stFile);
  }
  else
    return;

  SCR_fn_v_RdL0_SplitSectionName(p_stObj->sSectionObj, sFile, sAction, sIdent);
  sprintf(sFile, "%s%s.phy", g_sDirectorySave, g_sFileIn);
  sprintf(sIdent2, "PO_%s", sIdent);
  SCR_fn_v_RdL0_ComputeSectionName(mes, sFile, M_Phy, sIdent2);
  SCR_M_SvL0_SaveBeginSection(p_stFile, MLT_p_cGetSectionName(mes), SCR_CC_C_Cfg_EOL);

  SCR_fn_v_RdL0_SplitSectionName(p_stObj->sSectionMod, sFile, sAction, sIdent);
  sprintf(sFile, "%s\\%s.vse", MLT_p_cGetFileNameWithoutExt(sFile), MLT_p_cGetFileNameWithoutExt(sFile));
  sprintf(sIdent2, "VSE_%s", sIdent);
  SCR_fn_v_RdL0_ComputeSectionName(sSection, sFile, M_VS, sIdent2);
  SCR_M_SvL0_SaveEntry(p_stFile, M_VS, SCR_CC_C_Cfg_NoChar);
  SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, sSection);

  if (!p_stObj->bFlag)
  {
	SCR_fn_v_RdL0_SplitSectionName(p_stObj->sSectionObj, sFile, sAction, sIdent);
	sprintf(sFile, "%s%s.zoo", g_sDirectorySave, g_sFileIn);
	sprintf(sIdent2, "CS_%s", sIdent);
	SCR_fn_v_RdL0_ComputeSectionName(sSection, sFile, M_CS, sIdent2);
	SCR_M_SvL0_SaveEntry(p_stFile, M_CS, SCR_CC_C_Cfg_NoChar);
	SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, sSection);
  }


  SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
}



/****************************************************************************
*		Description:	save LipsSynchro and CustomZoom for a3dobject
*
*		Parameters:		p_stFile		: script file pointer
*						p_stGeometric	: geometric object
*---------------------------------------------------------------------------
*		Revision date:                                      Author:         
*****************************************************************************/
void MLT_vSaveAditional(SCR_tdst_File_Description *p_stFile, MLT_tdstObjElement *p_stGeometric)
{
  if(strlen(p_stGeometric->sTete))
  {
    SCR_M_SvL0_SaveEntry(p_stFile, M_OBJActionLipsSynchro, SCR_CC_C_Cfg_NoChar);
    SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 5, "%s,%s,%d,%s", 
	    p_stGeometric->sTete,
		p_stGeometric->sLetter,
		p_stGeometric->lValue,
		p_stGeometric->sNeutral);
  }
  
  if(p_stGeometric->bCustomZoom)
  { 
    SCR_M_SvL0_SaveEntry(p_stFile, M_OBJActionCustomZoom, SCR_CC_C_Cfg_NoChar);
    SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 10, "%f,%f,%f,%f,%f,%f,%f,%f,%f", 
	      p_stGeometric->a9_dCustomZoom[0],
	      p_stGeometric->a9_dCustomZoom[1],
	      p_stGeometric->a9_dCustomZoom[2],
	      p_stGeometric->a9_dCustomZoom[3],
	      p_stGeometric->a9_dCustomZoom[4],
	      p_stGeometric->a9_dCustomZoom[5],
	      p_stGeometric->a9_dCustomZoom[6],
	      p_stGeometric->a9_dCustomZoom[7],
	      p_stGeometric->a9_dCustomZoom[8]);
  }
}


/****************************************************************************
*		Description:	save the a3dobject
*
*		Parameters:		p_stFile		: script file pointer
*						p_stGeometric	: geometric object
*---------------------------------------------------------------------------
*		Revision date:                                      Author:         
*****************************************************************************/
void MLT_vSaveA3dObj(SCR_tdst_File_Description *p_stFile, MLT_tdstObjElement *p_stGeometric)
{
  xString sFile, sAction, sIdent, sSection, sIdent2;
  sprintf(sFile, "%s.tbl", g_sFileIn);

  SCR_fn_v_RdL0_SplitSectionName(p_stGeometric->sSectionObj, sFile, sAction, sIdent);
  sprintf(sFile, "%s%s.phy", g_sDirectorySave, g_sFileIn);
  sprintf(sIdent2, "PO_%s", sIdent);
  SCR_fn_v_RdL0_ComputeSectionName(sSection, sFile, M_Phy, sIdent2);
  SCR_M_SvL0_SaveEntry(p_stFile, M_Phy, SCR_CC_C_Cfg_NoChar);
  SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, sSection);

  MLT_vSaveAditional(p_stFile, p_stGeometric);
}


/****************************************************************************
*		Description:	save the common fields for the events
*
*		Parameters:		p_stFile		: script file pointer
*						p_stGeometric	: geometric object
*---------------------------------------------------------------------------
*		Revision date:                                      Author:         
*****************************************************************************/
void MLT_vSaveCommunEvents(SCR_tdst_File_Description *p_stFile,  MLT_tdstObjElement *p_stGeometric)
{
	//save the FirstCall entry
	SCR_M_SvL0_SaveEntry(p_stFile, M_OBJActionFirstCall, SCR_CC_C_Cfg_NoChar);
	SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 2, "%d",
		p_stGeometric->lFirstCall);

	//save the Period entry
	SCR_M_SvL0_SaveEntry(p_stFile, M_OBJActionPeriod, SCR_CC_C_Cfg_NoChar);
	SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 2, "%d",
		p_stGeometric->lPeriod);

	//save the Priority entry
	SCR_M_SvL0_SaveEntry(p_stFile, M_OBJActionPriority, SCR_CC_C_Cfg_NoChar);
	SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 2, "%d",
		p_stGeometric->lPriority);
}


/****************************************************************************
*		Description:	save the SoundEvent
*
*		Parameters:		p_stFile		: script file pointer
*						p_stGeometric	: geometric object
*---------------------------------------------------------------------------
*		Revision date:                                      Author:         
*****************************************************************************/
void MLT_vSaveSoundEvent(SCR_tdst_File_Description *p_stFile, MLT_tdstObjElement *p_stGeometric)
{
	xString sFile, sAction, sIdent;

	//save the SoundEvent with the parameters
	SCR_M_SvL0_SaveEntry(p_stFile, M_SoundEvent, SCR_CC_C_Cfg_NoChar);
	SCR_fn_v_RdL0_SplitSectionName(p_stGeometric->sSectionMod, sFile, sAction, sIdent);
	strcat(sFile, "^SndEventM:");
	sprintf(sFile, "%s%d", sFile, p_stGeometric->lSoundReference);
	SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 2, "%s",
		sFile);

	MLT_vSaveCommunEvents(p_stFile, p_stGeometric);
}


/****************************************************************************
*		Description:	save the MechanicEvent
*
*		Parameters:		p_stFile		: script file pointer
*						p_stGeometric	: geometric object
*---------------------------------------------------------------------------
*		Revision date:                                      Author:         
*****************************************************************************/
void MLT_vSaveMechanicEvent(SCR_tdst_File_Description *p_stFile, MLT_tdstObjElement *p_stGeometric)
{
	//save the second parameter from Object to MechanicEvent
	SCR_M_SvL0_SaveEntry(p_stFile, M_MechanicEvent, SCR_CC_C_Cfg_NoChar);
	SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 2, "%s",
		p_stGeometric->sObject);

	MLT_vSaveCommunEvents(p_stFile, p_stGeometric);
}


/****************************************************************************
*		Description:	save the GenericEvent
*
*		Parameters:		p_stFile		: script file pointer
*						p_stGeometric	: geometric object
*---------------------------------------------------------------------------
*		Revision date:                                      Author:         
*****************************************************************************/
void MLT_vSaveGenericEvent(SCR_tdst_File_Description *p_stFile, MLT_tdstObjElement *p_stGeometric)
{
	//save the parameter of Data to GenericEvent
	SCR_M_SvL0_SaveEntry(p_stFile, M_GenericEvent, SCR_CC_C_Cfg_NoChar);
	SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 2, "%s",
		p_stGeometric->sData);

	MLT_vSaveCommunEvents(p_stFile, p_stGeometric);
}


/****************************************************************************
*		Description:	save the GenerateEvent
*
*		Parameters:		p_stFile		: script file pointer
*						p_stGeometric	: geometric object
*---------------------------------------------------------------------------
*		Revision date:                                      Author:         
*****************************************************************************/
void MLT_vSaveGenerateEvent(SCR_tdst_File_Description *p_stFile, MLT_tdstObjElement *p_stGeometric)
{
	//save the parameter of Data to GenerateEvent
	SCR_M_SvL0_SaveEntry(p_stFile, M_GenerateEvent, SCR_CC_C_Cfg_NoChar);
	SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 2, "%s",
		p_stGeometric->sData);

	MLT_vSaveCommunEvents(p_stFile, p_stGeometric);
}


/****************************************************************************
*		Description:	save the CameraEvent
*
*		Parameters:		p_stFile		: script file pointer
*						p_stGeometric	: geometric object
*---------------------------------------------------------------------------
*		Revision date:                                      Author:         
*****************************************************************************/
void MLT_vSaveCameraEvent(SCR_tdst_File_Description *p_stFile, MLT_tdstObjElement *p_stGeometric)
{
	//save the parameter of Data to CameraEvent
	SCR_M_SvL0_SaveEntry(p_stFile, M_CameraEvent, SCR_CC_C_Cfg_NoChar);
	SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 2, "\"%s\"",
		p_stGeometric->sData);

	MLT_vSaveCommunEvents(p_stFile, p_stGeometric);
}




