diff -r 79859ed3eea9 -r 919f36ff910f webengine/wmlengine/src/htmlp/include/CHtmlpParser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webengine/wmlengine/src/htmlp/include/CHtmlpParser.h Wed Sep 01 12:28:30 2010 +0100 @@ -0,0 +1,509 @@ +/* +* Copyright (c) 2000 - 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +/** ----------------------------------------------------------------------- ** + @package: NW_HTMLP + + @synopsis: default + + @description: HTML Parser + + ** ----------------------------------------------------------------------- **/ +#ifndef CHTMLP_PARSER_H +#define CHTMLP_PARSER_H + +#include +#include "nw_htmlp_lexer.h" +#include "BrsrStatusCodes.h" +#include "nwx_buffer.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Next two govern allocation/reallocation of the open element stack. */ +#ifndef NW_HTMLP_OPEN_ELEMENT_INITIAL_STACK_CAPACITY +#define NW_HTMLP_OPEN_ELEMENT_INITIAL_STACK_CAPACITY 16 +#endif +#ifndef NW_HTMLP_OPEN_ELEMENT_STACK_GROW_BY +#define NW_HTMLP_OPEN_ELEMENT_STACK_GROW_BY 8 +#endif + +//Non DTD elements are not found in the HTMLP dictionary and index is stored in +//the upper 16 bits. + +#ifndef NW_HTMLP_DTD_ElementTableMask +#define NW_HTMLP_DTD_ElementTableMask 0xffff0000 +#endif + +//Initialize the Non DTD value as actual index will always be greated than this. + +#ifndef NW_HTMLP_DTD_ElementTableInit +#define NW_HTMLP_DTD_ElementTableInit 0x00009999 +#endif + + typedef struct { + void* contentHandler; + void* response; +} NW_Htmlp_CharsetConvContext; + + +/* RME Documentation tools do not support callback syntax. */ +/* * ----------------------------------------------------------------------- ** + @struct: NW_HTMLP_EventCallbacks + + @synopsis: default + + @scope: public + @variables: + TBrowserStatusCode (*beginDocumentCB) (NW_HTMLP_Lexer_t*, void*) + default + + TBrowserStatusCode (*endDocumentCB) (NW_HTMLP_Lexer_t*, NW_Bool failed, void*) + default + + TBrowserStatusCode (*startTagCB) (NW_Uint8 asciiCharCount, const NW_Uint8* pBuf, + void*) + default + + TBrowserStatusCode (*endTagCB) (NW_Uint8 asciiCharCount, const NW_Uint8* pBuf, + NW_Bool emptyTag, void*) + default + + TBrowserStatusCode (*contentCB) (NW_HTMLP_Lexer_t*, const NW_HTMLP_Interval_t*, + void*) + default + + TBrowserStatusCode (*cdataCB) (NW_HTMLP_Lexer_t*, const NW_HTMLP_Interval_t*, + void*) + default + + TBrowserStatusCode (*attributeStartCB) (void*) + default + + TBrowserStatusCode (*attributeNameAndValueCB) (NW_HTMLP_Lexer_t*, + const NW_HTMLP_Interval_t* pName, + NW_Bool missingValue, + const NW_HTMLP_Interval_t* pValue, + void*) + default + + TBrowserStatusCode (*attributesEndCB) (NW_Uint32 attributeCount, void*) + default + + void* pClientPointer + Passed back in each callback. + + @description: default + ** ----------------------------------------------------------------------- **/ +typedef struct NW_HTMLP_EventCallbacks_s { + TBrowserStatusCode (*beginDocumentCB) (NW_HTMLP_Lexer_t*, void*); + + TBrowserStatusCode (*endDocumentCB) (NW_HTMLP_Lexer_t*, TBrowserStatusCode e, void*); + TBrowserStatusCode (*startTagCB) (NW_Uint8 byteCount, const NW_Uint8* pBuf, + void*, NW_Bool isLiteral); + TBrowserStatusCode (*endTagCB) (NW_Uint8 asciiCharCount, const NW_Uint8* pBuf, + NW_Bool emptyTag, void*); + TBrowserStatusCode (*contentCB) (NW_HTMLP_Lexer_t*, const NW_HTMLP_Interval_t*, + void*); + TBrowserStatusCode (*cdataCB) (NW_HTMLP_Lexer_t*, const NW_HTMLP_Interval_t*, + void*); + TBrowserStatusCode (*attributeStartCB) (void*); + // cp_count to track the attribute code page switch count. + TBrowserStatusCode (*attributeNameAndValueCB) (NW_HTMLP_Lexer_t*, + const NW_HTMLP_Interval_t* pName, + NW_Bool missingValue, + const NW_HTMLP_Interval_t* pValue, + void*, + NW_Uint32* cp_count); + TBrowserStatusCode (*attributesEndCB) (NW_Uint32 attributeCount, void*); + // cp_count to track the attribute code page switch count. + TBrowserStatusCode (*piFormCB) (NW_HTMLP_Lexer_t*, + const NW_HTMLP_Interval_t* pPITarget, + const NW_HTMLP_Interval_t* pArguments, + void*, + NW_Uint32* cp_count); + void* pClientPointer; /* passed back in each callback */ + + + TBrowserStatusCode (*charsetConvertCallback) (void* context, + NW_Uint32 charsetLength, + NW_Uint32 charsetOffset, + NW_Buffer_t* body, + NW_Int32* numUnconvertible, + NW_Int32* indexFirstUnconvertible, + NW_Buffer_t** outBuf, + NW_Uint32 *selectedCharset); + void* charsetContext; + +} NW_HTMLP_EventCallbacks_t; + +/* Added for handling special cases for elements. It is good idea to document + * each special case here. In other words, this is small state machine to handle + * all such cases. + * + + * + * 1)