⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rephdr.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 2 页
字号:
	return FALSE;
} /* end of ME_RepCh_List_Add */

/*========================================================================
	ME_RepCh_List_CheckEventId
==========================================================================
Purpose: Check if an element with the same EventId is stored in the RepCh_
		 List.
Params:  pvRepChList(IN) and pvEventId(IN).
Return:  (void*)(REPCHSTRUCT*)
=========================================================================*/
void* ME_RepCh_List_CheckEventId( void* pvRepChList, void* pvEventId )
{
	void*	pvListElement = NULL;
	void*	pvElementContent = NULL;
	WCHAR*	pwcharhelpEventId = NULL;
	BOOL	boolfound = FALSE;
	REPCHSTRUCT* pRepChStruct = NULL;

#ifdef WAE_DEBUG
	URL_DEBUG_PRINT("Start ME_RepCh_List_CheckEventId");
#endif

	if( pvRepChList != NULL ){

		pvListElement = SDL_GetNextListElement( pvRepChList, NULL );

		while ( (pvListElement != NULL) ) {
			
			pvElementContent = SDL_GetListElementContent( pvListElement );
			if( pvElementContent != NULL ){

				pRepChStruct = (REPCHSTRUCT*)pvElementContent;
				pwcharhelpEventId = pRepChStruct->pchEventId;

				boolfound = ME_CompareString( pwcharhelpEventId, 
					((WCHAR*)(pvEventId)) );

				if (boolfound)
					return (void*)pRepChStruct;
			}
			pvListElement = SDL_GetNextListElement( pvRepChList, pvListElement );
		}
	}
	return NULL;
} /* end of ME_RepCh_List_CheckEventId */

/*========================================================================
	ME_RepCh_List_Checkchannelid
==========================================================================
Purpose: Check if an element with the same channelid is stored in the RepCh_
		 List.
Params:  pvRepChList(IN) and pvchannelid(IN).
Return:  (void*)(REPCHSTRUCT*)
=========================================================================*/
void* ME_RepCh_List_Checkchannelid( void* pvRepChList, void* pvchannelid )
{
	void*	pvListElement = NULL;
	void*	pvElementContent = NULL;
	WCHAR*	pwcharhelpchannelid = NULL;
	BOOL	boolfound = FALSE;
	REPCHSTRUCT* pRepChStruct = NULL;

#ifdef WAE_DEBUG
	URL_DEBUG_PRINT("Start ME_RepCh_List_Checkchannelid");
#endif

	if( pvRepChList != NULL ){

		pvListElement = SDL_GetNextListElement( pvRepChList, NULL );

		while ( (pvListElement != NULL) ) {
			
			pvElementContent = SDL_GetListElementContent( pvListElement );
			if( pvElementContent != NULL ){

				pRepChStruct = (REPCHSTRUCT*)pvElementContent;
				pwcharhelpchannelid = pRepChStruct->pchchannelid;

				boolfound = ME_CompareString( pwcharhelpchannelid, 
					((WCHAR*)(pvchannelid)) );

				if (boolfound)
					return (void*)pRepChStruct;
			}
			pvListElement = SDL_GetNextListElement( pvRepChList, pvListElement );
		}
	}
	return NULL;
} /* end of ME_RepCh_List_Checkchannelid */

/*========================================================================
	ME_RepCh_List_CheckchEventid
==========================================================================
Purpose: Check if an element with the same channelid or EventId is stored 
		 in the RepCh_List.
Params:  pvRepChList(IN) and pvchannelid(IN).
Return:  (void*)(REPCHSTRUCT*)
=========================================================================*/
void* ME_RepCh_List_CheckchEventid( void* pvRepChList, void* pvchannelid, 
									void* pvEventId, UINT32 iLLRepHId, 
									UINT32 iLLRepHIdToFirstRes)
{

	REPCHSTRUCT*	pRepChStructChIdSame = NULL;
	REPCHSTRUCT*	pRepChStructEventIdSame = NULL;
	UINT32*	piList = NULL;
	UINT32*	helppiList;

#ifdef WAE_DEBUG
	URL_DEBUG_PRINT("Start ME_RepCh_List_CheckchEventid");
#endif

	if( pvRepChList != NULL ){

		pRepChStructChIdSame = (REPCHSTRUCT*)
			(ME_RepCh_List_Checkchannelid(pvRepChList, pvchannelid));
		if ( pRepChStructChIdSame == NULL ){
			
			pRepChStructEventIdSame = (REPCHSTRUCT*)
				(ME_RepCh_List_CheckEventId(pvRepChList, pvEventId));
			if ( pRepChStructEventIdSame == NULL ){	
			
			/* New channel, the channel id is unique and the event id is unique */

				ME_RepCh_List_Add(pvRepChList, pvEventId, pvchannelid, 
					iLLRepHId, iLLRepHIdToFirstRes);
			}
			else{

				/* New channel, the channel id is unique but the event id 
				   is not unique. The channel for which the event id is 
				   not unique must be removed from the RepCh list and the 
				   iLLRepHId must be stored in a list so that the channel 
				   can be removed from the memory*/

				ME_RepCh_List_Add(pvRepChList, pvEventId, pvchannelid, 
					iLLRepHId, iLLRepHIdToFirstRes);

				piList = NEWARRAY(UINT32, 2);
				helppiList = piList;
				*helppiList = (pRepChStructEventIdSame->iLLRepHId);
				helppiList++;
				*helppiList = NULL;

				ME_RepCh_List_RemoveCh(pvRepChList, (void*)(pRepChStructEventIdSame));
			} /* if (pRepChStructEventIdSame == NULL) {*/
		}
		else{
			
			pRepChStructEventIdSame = (REPCHSTRUCT*)
				(ME_RepCh_List_CheckEventId(pvRepChList, pvEventId));
			if (pRepChStructEventIdSame == NULL){

				/* Channel is already stored. The event id is unique. 
				   Update the RepChList with new values for the event id, 
				   iLLRepHId and the iLLRepHIdToFirstRes. ILLRepHId must 
				   be stored in a list so that the channel can be removed 
				   from the memory*/	

				piList = NEWARRAY(UINT32, 2);
				helppiList = piList;
				*helppiList = pRepChStructChIdSame->iLLRepHId;
				helppiList++;
				*helppiList = NULL;
				
				
				DEALLOC(&(pRepChStructChIdSame->pchEventId));
				DEALLOC(&pvchannelid);
				pRepChStructChIdSame->pchEventId = pvEventId;
				pRepChStructChIdSame->iLLRepHId = iLLRepHId;
				pRepChStructChIdSame-> iLLRepHIdToFirstRes = iLLRepHIdToFirstRes;
			}
			else{
				/* Channel is already stored. The event id is not unique. */ 
				if (pRepChStructChIdSame == pRepChStructEventIdSame){

					/*Update the RepChList with new values for the iLLRepHId and 
					the iLLRepHIdToFirstRes. ILLRepHId must be stored in a list so 
					that the channel can be removed from the memory*/	

					piList = NEWARRAY(UINT32, 2);
					helppiList = piList;
					*helppiList = pRepChStructChIdSame->iLLRepHId;
					helppiList++;
					*helppiList = NULL;

					pRepChStructChIdSame->iLLRepHId = iLLRepHId;
					pRepChStructChIdSame-> iLLRepHIdToFirstRes = iLLRepHIdToFirstRes;
					DEALLOC(&pvchannelid);
					DEALLOC(&pvEventId);

				}
				else{
					/*An old channel is stored with the same channel id and an old 
					channel is stored with the same event id. The RepChList must be 
					updated with new event id for the channel id which is already 
					stored. The channel for which the event id is the same must be 
					deleted from the RepChList. Both iLLRepHId to the old channel 
					must be stored so that these can be removed from the memory*/	

					piList = NEWARRAY(UINT32, 3);
					helppiList = piList;
					*helppiList = pRepChStructChIdSame->iLLRepHId;
					helppiList++;
					*helppiList = pRepChStructEventIdSame->iLLRepHId;
					helppiList++;
					*helppiList = NULL;

					DEALLOC(&(pRepChStructChIdSame->pchEventId));
					pRepChStructChIdSame->pchEventId = pvEventId;
					pRepChStructChIdSame->iLLRepHId = iLLRepHId;
					pRepChStructChIdSame-> iLLRepHIdToFirstRes = iLLRepHIdToFirstRes;

					ME_RepCh_List_RemoveCh(pvRepChList, (void*)(pRepChStructEventIdSame));

				} /* if (pvRepChStructChIdSame == pvRepChStructEventIdSame)... */
			} /* (pRepChStructEventIdSame == NULL){*/
		} /* if (pRepChStructChIdSame == NULL) */
	} /* if( pvRepChList != NULL ){ */	
	return piList;
} /* end of ME_RepCh_List_CheckchEventid */

/*========================================================================
	ME_RepCh_List_GetIdForChannel
==========================================================================
Purpose: Get low level Id for next channel.
Params: pvRepChList (IN), pliRepHLLId(OUT) and pvPrevChannel(IN);
Return:
=========================================================================*/
void* ME_RepCh_List_GetIdForChannel( void* pvRepChList, 
									unsigned long int* pliRepHLLId,
									void* pvPrevChannel )
{
	void*	pvListElement = NULL;
	void*	pvElementContent = NULL;
	REPCHSTRUCT* pRepChStruct = NULL;

#ifdef WAE_DEBUG
	URL_DEBUG_PRINT("Start ME_RepCh_List_GetIdForChannel");
#endif

	if( pvRepChList != NULL ){

		pvListElement = SDL_GetNextListElement( pvRepChList, pvPrevChannel );
		if (pvListElement != NULL) {

			pvElementContent = SDL_GetListElementContent( pvListElement );
			if( pvElementContent != NULL ){

				pRepChStruct = (REPCHSTRUCT*)pvElementContent;
				*pliRepHLLId = pRepChStruct->iLLRepHId;
				return (void*)(pvListElement);
			}
		}
	}
	return NULL;
} /* end of ME_RepCh_List_GetIdForChannel */

/*========================================================================
	ME_RepCh_List_RemoveCh
==========================================================================
Purpose: Remove an element (REPCHSTRUCT*) from the RepCh_List.
Params:  pvRepChList(IN) and pvRepChStruct(IN).
Return:  TRUE if ok, otherwise FALSE.
=========================================================================*/
BOOL ME_RepCh_List_RemoveCh( void* pvRepChList, void* pvRepChStruct )
{
	void*	pvListElement = NULL;
	void*	pvElementContent = NULL;
	BOOL	boolfound = FALSE;
	REPCHSTRUCT* pRepChStruct = NULL;

	/* OBS H鋜 m錽te ocks

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -