/*=========================================================================
*
* VseLoad.c	- loading functions for VSE file
*
* Version			1.0
* Revision date
*
*=======================================================================*/
#include "VseLoad.h"

#include "conventi.h"


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



/****************************************************************************
*		Description:	register the loading function for the VSE file
*
*		Parameters:		
*---------------------------------------------------------------------------
*		Revision date:                                      Author:         
*****************************************************************************/
void MLT_vInitVSELoad()
{    
  SCR_fn_v_RdL0_RegisterCallback(M_LOD, MLT_xLoadLOD,SCR_CRC_c_RdL0_ForSection);  
  SCR_fn_v_RdL0_RegisterCallback(M_VS, MLT_xLoadVS,SCR_CRC_c_RdL0_ForSection);  
}


/****************************************************************************
*		Description:	load VS section in VSE file
*
*		Parameters:		p_stFile	: script file pointer
*						szAction	: section or entry name
*						szParams	: parameters
*						cType		: action type
*---------------------------------------------------------------------------
*		Revision date:                                      Author:         
*****************************************************************************/
SCR_tde_Anl_ReturnValue MLT_xLoadVS(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
  MLT_tdstVSE *p_stVSE;
	
	switch (cType)
	{
		case SCR_EA_Anl_BeginSection:
			p_stVSE = (MLT_tdstVSE*)calloc(1,sizeof(MLT_tdstVSE));
      
			SCR_M_RdL0_SetSectionLong(0,0,(unsigned long)p_stVSE);
			SCR_M_RdL0_SetContextLong(0,0,(unsigned long)p_stVSE);
			break;

		case SCR_EA_Anl_Entry:
			break;

		case SCR_EA_Anl_EndSection:
			break;
	}
  return  SCR_ERV_Anl_NormalReturn;
}

/****************************************************************************
*		Description:	load LOD sub-section in VSE file
*
*		Parameters:		p_stFile	: script file pointer
*						szAction	: section or entry name
*						szParams	: parameters
*						cType		: action type
*---------------------------------------------------------------------------
*		Revision date:                                      Author:         
*****************************************************************************/
SCR_tde_Anl_ReturnValue MLT_xLoadLOD(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
  MLT_tdstVSE *p_stVSE;
	
	switch (cType)
	{
		case SCR_EA_Anl_BeginSection:
			SCR_M_RdL0_GetContextLong(-1,0,MLT_tdstVSE*,p_stVSE);
		break;

		case SCR_EA_Anl_Entry:
			// Here is my own handle
			SCR_M_RdL0_GetContextLong(-1,0,MLT_tdstVSE*,p_stVSE);
			if (strcmp(szAction,M_VSEActionLOD_Threshold)==0)	
			{	p_stVSE->iVSE = atoi(szParams[0]);
			}
			break;

		case SCR_EA_Anl_EndSection:
			break;
	}
  return  SCR_ERV_Anl_NormalReturn;
}

