#include "ldt.h"
 
/*****************************************************************
Name: 
Description: Create callback for LDT
Author: Mircea Petrescu
Date: 7/2/98
Modified: 
*****************************************************************/
int IPO_iCreateGeneral( LDT_tdst_Link *pLink )
{
  IPO_tdxHandleToInstanciatedPhysicalObject _hInstanciatedPhysicalObject;
  int iLen;
  char sz_LongPathForLinkTable[256];
 
  _hInstanciatedPhysicalObject = IPO_fn_hAllocInstanciatedPhysicalObject();
 
  iLen=LDT_ComputeSectionName(pLink,sz_LongPathForLinkTable);
  SCR_M_v_Link_SetAdditionalLong(SCR_fnp_st_Link_SetValue(&IPO_g_stLinkTable,sz_LongPathForLinkTable,(unsigned long)_hInstanciatedPhysicalObject),1,iLen);	
 
  pLink->pObject=(void *)_hInstanciatedPhysicalObject;
  return 0;
}
 
HREF hrefIPO;
 
void IPO_PostProcessLDT(HREF hrefIPO)
{
	int iType=1;
	short shCount=1;
	long *pVal;
	LDT_tdst_Link *pObj, *pGetFrom;
 
	while (!(LDT_GetRefFromTable(hrefIPO, &pObj, &pGetFrom, &iType, &shCount, &pVal )))
		((IPO_tdxHandleToInstanciatedPhysicalObject)pObj->pObject)->_hRadiosity = (ACP_tdxHandleToRadiosity) pGetFrom->pObject;
}
 
 
/*****************************************************************
Name: 
Description: Load callback for LDT
Author: Mircea Petrescu
Date: 7/2/98
Modified: 
*****************************************************************/
int IPO_iLoadGeneral( LDT_tdst_Link *pLink )
{
  LDT_tdeParseResult result=ParseResult_BeginSection;
  IPO_tdxHandleToInstanciatedPhysicalObject _hInstanciatedPhysicalObject=( IPO_tdxHandleToInstanciatedPhysicalObject )pLink->pObject;
 
  SCR_fn_v_RdL0_SetPriorityPath(fn_szGetLevelsDataPath());
 
  while( result!=ParseResult_EndSection ) 
  {
  	result=LDT_GetNextEntry();
  	switch( result )
  	{
  	  case ParseResult_Entry: /* an entry */
  	  {
  	    char *szEntry=LDT_szGetEntryName();
 
    		if( *(short *)szEntry=='OP' ) /* PO */
		    _hInstanciatedPhysicalObject->_hPhysicalObject=CS_fn_xLoadPhysicalObject( LDT_szGetParam( 1 ) );
    		else if( *(long *)szEntry=='ILR' ) /* RLI */
		    {
				LDT_LoadSection(LDT_szGetParam( 1 ));
				LDT_AddToRefsTable( hrefIPO, pLink, 1, 0);
		    }
	    }
  	}
  }
 
  return 0;
}
