📄 p_contif.c
字号:
((SI_ITEMELEMENT *)(pItem))->pwchClass);
}
}
return NULL;
}
/*========================================================================
Si_GetItemText
======================================================================== */
WCHAR *Si_GetItemText (pDECSTR pDecStr, pELEMENTTYPE pItem)
{
pELEMENTTYPE pContent=NULL;
if (pItem!=NULL)
{
pContent=Si_GetContent(pItem);
/* Content is #PCDATA */
if (pContent!=NULL)
{
return XML_GetString (pContent,pDecStr);
}
}
return NULL;
}
/*========================================================================
Service Loading Functions
=========================================================================*/
/*========================================================================
Sl_BuildStructure
======================================================================== */
pDECSTR Sl_BuildStructure (BYTE *pbData, BYTE *pbEnd, INT16 iCharset,
UINT8 iContentLevel, UINT8 iViewID)
{
pWBXMLDECODESTR pDecStr=NULL;
pELEMENTTYPE pStructure=NULL;
BOOL finished;
/* IS THIS PARAMETER NEEDED? (Error handling) */
iViewID=iViewID;
/* Create tWBXMLDECODESTR and init the attributes */
pDecStr=WBXML_CreateWBXMLDecStr();
if (pDecStr!=NULL)
{
/* Set the function pointers */
pDecStr->DTD_CreateElement=Sl_CreateElement;
pDecStr->DTD_DeleteElement=Sl_DeleteElement;
pDecStr->DTD_ValidContent=Sl_ValidContent;
pDecStr->DTD_GetContent=Sl_GetContent;
pDecStr->DTD_AppSpecParseMod=Sl_AppSpecParseMod;
pDecStr->DTD_StoreAttributeValue=Sl_StoreAttributeValue;
pDecStr->DTD_GetAttributeValue=Sl_GetAttributeValue;
pDecStr->DTD_LiteralAttributeToToken=Sl_LiteralAttributeToToken;
pDecStr->DTD_LiteralTagToToken=Sl_LiteralTagToToken;
pDecStr->DTD_CheckPublicID=Sl_CheckPublicID;
/* Store data in the decode struct */
pDecStr->bContentType='\x30'; /* text/vnd.wap.slc */
pDecStr->iCharset=iCharset;
pDecStr->iContentLevel=iContentLevel;
pDecStr->pbCurByte=pbData;
pDecStr->pbEnd=pbEnd;
pDecStr->iDecodeResult=0;
pDecStr->pAppSpec=NULL;
/* Parse prolog */
if (WBXML_DecodeProlog(pDecStr))
{
/* Step past all PI:s */
WBXML_StepPastAllPIs (pDecStr);
/* Parse channel */
WBXML_InitDecode(pDecStr, FALSE);
pStructure = WBXML_Decode(pDecStr, &finished);
/* Step past all PI:s */
WBXML_StepPastAllPIs (pDecStr);
}
/* Check if any (fatal) errors or warnings */
if ( pDecStr->iDecodeResult == 0 )
{
/* Store the structure under the application specific pointer
in the decode struct. */
pDecStr->pAppSpec=pStructure;
}
else
{
/* Error - delete */
Sl_DeleteElement(pDecStr,&pStructure);
/* Delete decode struct */
WBXML_DeleteWBXMLDecStr(&pDecStr);
}
}
/* Return the decode struct */
return pDecStr;
}
/*========================================================================
Sl_DeleteStructure
======================================================================== */
void Sl_DeleteStructure (pDECSTR *ppDecStr)
{
if (*ppDecStr!=NULL)
{
/* Get the top element */
pELEMENTTYPE pStructure=(*ppDecStr)->pAppSpec;
/* Delete structure */
Sl_DeleteElement(*ppDecStr,&pStructure);
(*ppDecStr)->pAppSpec=NULL;
/* Delete decode struct */
WBXML_DeleteWBXMLDecStr(ppDecStr);
}
}
/*========================================================================
Sl_GetSl
======================================================================== */
pELEMENTTYPE Sl_GetSl (pDECSTR pDecStr)
{
if (pDecStr!=NULL)
{
return (pELEMENTTYPE)pDecStr->pAppSpec;
}
return NULL;
}
/*========================================================================
Sl_GetHref
======================================================================== */
BYTE *Sl_GetHref (pELEMENTTYPE pSl)
{
if (pSl!=NULL)
{
/* Check type */
if (pSl->iType==Sl_Type_sl)
{
if (((SL_SLELEMENT *)(pSl))->pbHref!=NULL)
{
/* Get copy of href */
return B_CopyByteString (((SL_SLELEMENT *)(pSl))->pbHref,-1);
}
}
}
return NULL;
}
/*========================================================================
Sl_GetAction
======================================================================== */
UINT8 Sl_GetAction (pELEMENTTYPE pSl)
{
if (pSl!=NULL)
{
/* Check type */
if (pSl->iType==Sl_Type_sl)
{
/* Return action */
return (((SL_SLELEMENT *)(pSl))->iAction);
}
}
/* Default value */
return SL_EXECUTE_LOW;
}
/*========================================================================
Cache Operation Functions
=========================================================================*/
/*========================================================================
Co_BuildStructure
======================================================================== */
pDECSTR Co_BuildStructure (BYTE *pbData, BYTE *pbEnd, INT16 iCharset,
UINT8 iContentLevel, UINT8 iViewID)
{
pWBXMLDECODESTR pDecStr=NULL;
pELEMENTTYPE pStructure=NULL;
BOOL finished;
/* IS THIS PARAMETER NEEDED? (Error handling) */
iViewID=iViewID;
/* Create tWBXMLDECODESTR and init the attributes */
pDecStr=WBXML_CreateWBXMLDecStr();
if (pDecStr!=NULL)
{
/* Set the function pointers */
pDecStr->DTD_CreateElement=Co_CreateElement;
pDecStr->DTD_DeleteElement=Co_DeleteElement;
pDecStr->DTD_ValidContent=Co_ValidContent;
pDecStr->DTD_GetContent=Co_GetContent;
pDecStr->DTD_AppSpecParseMod=Co_AppSpecParseMod;
pDecStr->DTD_StoreAttributeValue=Co_StoreAttributeValue;
pDecStr->DTD_GetAttributeValue=Co_GetAttributeValue;
pDecStr->DTD_LiteralAttributeToToken=Co_LiteralAttributeToToken;
pDecStr->DTD_LiteralTagToToken=Co_LiteralTagToToken;
pDecStr->DTD_CheckPublicID=Co_CheckPublicID;
/* Store data in the decode struct */
pDecStr->bContentType='\x32'; /* text/vnd.wap.coc */
pDecStr->iCharset=iCharset;
pDecStr->iContentLevel=iContentLevel;
pDecStr->pbCurByte=pbData;
pDecStr->pbEnd=pbEnd;
pDecStr->iDecodeResult=0;
pDecStr->pAppSpec=NULL;
/* Parse prolog */
if (WBXML_DecodeProlog(pDecStr))
{
/* Step past all PI:s */
WBXML_StepPastAllPIs (pDecStr);
/* Parse channel */
WBXML_InitDecode(pDecStr, FALSE);
pStructure = WBXML_Decode(pDecStr, &finished);
/* Step past all PI:s */
WBXML_StepPastAllPIs (pDecStr);
}
/* Check if any (fatal) errors or warnings */
if ( pDecStr->iDecodeResult == 0 )
{
/* Store the structure under the application specific pointer
in the decode struct. */
pDecStr->pAppSpec=pStructure;
}
else
{
/* Error - delete */
Co_DeleteElement(pDecStr,&pStructure);
/* Delete decode struct */
WBXML_DeleteWBXMLDecStr(&pDecStr);
}
}
/* Return the decode struct */
return pDecStr;
}
/*========================================================================
Co_DeleteStructure
======================================================================== */
void Co_DeleteStructure (pDECSTR *ppDecStr)
{
if (*ppDecStr!=NULL)
{
/* Get the top element */
pELEMENTTYPE pStructure=(*ppDecStr)->pAppSpec;
/* Delete structure */
Co_DeleteElement(*ppDecStr,&pStructure);
(*ppDecStr)->pAppSpec=NULL;
/* Delete decode struct */
WBXML_DeleteWBXMLDecStr(ppDecStr);
}
}
/*========================================================================
Co_GetCo
======================================================================== */
pELEMENTTYPE Co_GetCo (pDECSTR pDecStr)
{
if (pDecStr!=NULL)
{
return (pELEMENTTYPE)pDecStr->pAppSpec;
}
return NULL;
}
/*========================================================================
Co_GetInvalidateURI
======================================================================== */
BYTE *Co_GetInvalidateURI (pELEMENTTYPE pElement)
{
if (pElement!=NULL)
{
/* Check type */
if (pElement->iType==Co_Type_invalidateobject)
{
if (((CO_INVOBJELEMENT *)(pElement))->pbURI!=NULL)
{
/* Get copy of href */
return B_CopyByteString (((CO_INVOBJELEMENT *)(pElement))->pbURI,-1);
}
}
else if (pElement->iType==Co_Type_invalidateservice)
{
if (((CO_INVSERVELEMENT *)(pElement))->pbURI!=NULL)
{
/* Get copy of href */
return B_CopyByteString (((CO_INVSERVELEMENT *)(pElement))->pbURI,-1);
}
}
}
return NULL;
}
/*========================================================================
Co_GetInvalidateType
======================================================================== */
UINT8 Co_GetInvalidateType (pELEMENTTYPE pElement)
{
if (pElement!=NULL)
{
/* Check type */
if (pElement->iType==Co_Type_invalidateobject)
{
return 1;
}
else if (pElement->iType==Co_Type_invalidateservice)
{
return 2;
}
}
/* Error */
return 0;
}
/*========================================================================
Co_GetNextInvElem
======================================================================== */
pELEMENTTYPE Co_GetNextInvElem (pELEMENTTYPE pCo, pELEMENTTYPE pElement)
{
pELEMENTTYPE pElem;
if (pElement!=NULL)
{
/* Use pElement as starting point */
pElem = pElement->pNextElement;
}
else
{
/* Use pCo as starting point */
pElem = Co_GetContent(pCo);
}
return pElem;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -