From f3c99aa589790d1f7891433ef6f3cf55945cd318 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Fri, 17 Apr 2015 15:10:00 +0300 Subject: [PATCH] Remove libwww, only keep html entitites list --- code/CMakeLists.txt | 1 - code/CMakeModules/FindLibwww.cmake | 190 ---- code/nel/include/nel/gui/group_html.h | 20 - code/nel/include/nel/gui/libwww.h | 59 - code/nel/include/nel/gui/libwww_nel_stream.h | 28 - code/nel/include/nel/gui/libwww_types.h | 1075 ++++++++++++++++++ code/nel/src/gui/CMakeLists.txt | 4 +- code/nel/src/gui/group_html.cpp | 423 +------ code/nel/src/gui/group_html_parser.cpp | 11 +- code/nel/src/gui/libwww.cpp | 411 ------- code/nel/src/gui/libwww_nel_stream.cpp | 633 ----------- code/nel/src/gui/libwww_types.cpp | 797 +++++++++++++ 12 files changed, 1889 insertions(+), 1763 deletions(-) delete mode 100644 code/CMakeModules/FindLibwww.cmake delete mode 100644 code/nel/include/nel/gui/libwww_nel_stream.h create mode 100644 code/nel/include/nel/gui/libwww_types.h delete mode 100644 code/nel/src/gui/libwww_nel_stream.cpp create mode 100644 code/nel/src/gui/libwww_types.cpp diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 05286fb4c..440a5fcd3 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -152,7 +152,6 @@ IF(WITH_NEL) ENDIF(WITH_NEL_TESTS) IF(WITH_GUI) - FIND_PACKAGE(Libwww REQUIRED) FIND_PACKAGE(Luabind REQUIRED) FIND_PACKAGE(CURL REQUIRED) diff --git a/code/CMakeModules/FindLibwww.cmake b/code/CMakeModules/FindLibwww.cmake deleted file mode 100644 index e742c6ae5..000000000 --- a/code/CMakeModules/FindLibwww.cmake +++ /dev/null @@ -1,190 +0,0 @@ -# -# Find the W3C libwww includes and library -# -# This module defines -# LIBWWW_INCLUDE_DIR, where to find tiff.h, etc. -# LIBWWW_LIBRARY, where to find the Libwww library. -# LIBWWW_FOUND, If false, do not try to use Libwww. - -OPTION(WITH_LIBWWW_STATIC "Use only static libraries for libwww" OFF) - -# also defined, but not for general use are -IF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR) - # in cache already - SET(Libwww_FIND_QUIETLY TRUE) -ENDIF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR) - -FIND_PATH(LIBWWW_INCLUDE_DIR - WWWInit.h - PATHS - /usr/local/include - /usr/include - /sw/include - /opt/local/include - /opt/csw/include - /opt/include - PATH_SUFFIXES libwww w3c-libwww -) - -# when installing libwww on mac os x using macports the file wwwconf.h resides -# in /opt/local/include and not in the real libwww include dir :/ -FIND_PATH(LIBWWW_ADDITIONAL_INCLUDE_DIR - wwwconf.h - PATHS - /usr/local/include - /usr/include - /sw/include - /opt/local/include - /opt/csw/include - /opt/include -) - -# combine both include directories into one variable -IF(LIBWWW_ADDITIONAL_INCLUDE_DIR) - SET(LIBWWW_INCLUDE_DIR ${LIBWWW_INCLUDE_DIR} ${LIBWWW_ADDITIONAL_INCLUDE_DIR}) -ENDIF(LIBWWW_ADDITIONAL_INCLUDE_DIR) - -# helper to find all the libwww sub libraries -MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION FILE) - IF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL) - SET(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES}) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") - ENDIF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL) - - FIND_LIBRARY(${MYLIBRARY}_RELEASE - NAMES ${FILE} - PATHS - /usr/local/lib - /usr/lib - /usr/lib/x86_64-linux-gnu - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 - ) - - FIND_LIBRARY(${MYLIBRARY}_DEBUG - NAMES ${FILE}d - PATHS - /usr/local/lib - /usr/lib - /usr/lib/x86_64-linux-gnu - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 - ) - - IF(CMAKE_FIND_LIBRARY_SUFFIXES_OLD) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD}) - ENDIF(CMAKE_FIND_LIBRARY_SUFFIXES_OLD) - - IF(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG) - IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} optimized ${${MYLIBRARY}_RELEASE} debug ${${MYLIBRARY}_DEBUG}) - ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - ELSEIF(${MYLIBRARY}_RELEASE) - IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}_RELEASE}) - ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - ELSEIF(${MYLIBRARY}_DEBUG) - IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}_DEBUG}) - ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - ELSE(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG) - IF(NOT Libwww_FIND_QUIETLY AND NOT WIN32) - MESSAGE(STATUS "Warning: Libwww: Library not found: ${MYLIBRARY}") - ENDIF(NOT Libwww_FIND_QUIETLY AND NOT WIN32) - ENDIF(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG) - - MARK_AS_ADVANCED(${MYLIBRARY}_RELEASE ${MYLIBRARY}_DEBUG) -ENDMACRO(FIND_WWW_LIBRARY) - -MACRO(LINK_WWW_LIBRARY MYLIBRARY OTHERLIBRARY SYMBOL) - IF(NOT WITH_LIBWWW_STATIC AND NOT WITH_STATIC_EXTERNAL) - LINK_DEPENDS(LIBWWW_LIBRARIES ${MYLIBRARY} ${OTHERLIBRARY} ${SYMBOL}) - ENDIF(NOT WITH_LIBWWW_STATIC AND NOT WITH_STATIC_EXTERNAL) -ENDMACRO(LINK_WWW_LIBRARY) - -# Find and link required libs for static or dynamic -FIND_WWW_LIBRARY(LIBWWWAPP_LIBRARY REQUIRED wwwapp) # cache core file ftp gopher html http mime news stream telnet trans utils zip xml xmlparse -FIND_WWW_LIBRARY(LIBWWWCORE_LIBRARY REQUIRED wwwcore) # utils -FIND_WWW_LIBRARY(LIBWWWFILE_LIBRARY REQUIRED wwwfile) # core trans utils html -FIND_WWW_LIBRARY(LIBWWWHTML_LIBRARY REQUIRED wwwhtml) # core utils -FIND_WWW_LIBRARY(LIBWWWHTTP_LIBRARY REQUIRED wwwhttp) # md5 core mime stream utils -FIND_WWW_LIBRARY(LIBWWWMIME_LIBRARY REQUIRED wwwmime) # core cache stream utils - -# Required for static or if underlinking -FIND_WWW_LIBRARY(LIBWWWCACHE_LIBRARY OPTIONAL wwwcache) # core trans utils -FIND_WWW_LIBRARY(LIBWWWSTREAM_LIBRARY OPTIONAL wwwstream) # core file utils - -FIND_WWW_LIBRARY(LIBWWWTRANS_LIBRARY REQUIRED wwwtrans) # core utils -FIND_WWW_LIBRARY(LIBWWWUTILS_LIBRARY REQUIRED wwwutils) - - -# Required only if underlinking - -# Unused protocols -FIND_WWW_LIBRARY(LIBWWWFTP_LIBRARY OPTIONAL wwwftp) # core file utils -FIND_WWW_LIBRARY(LIBWWWGOPHER_LIBRARY OPTIONAL wwwgopher) # core html utils file -FIND_WWW_LIBRARY(LIBWWWNEWS_LIBRARY OPTIONAL wwwnews) # core html mime stream utils -FIND_WWW_LIBRARY(LIBWWWTELNET_LIBRARY OPTIONAL wwwtelnet) # core utils - -# Other used by app -FIND_WWW_LIBRARY(LIBWWWDIR_LIBRARY OPTIONAL wwwdir) # file -FIND_WWW_LIBRARY(LIBWWWINIT_LIBRARY OPTIONAL wwwinit) # app cache core file html utils -FIND_WWW_LIBRARY(LIBWWWMUX_LIBRARY OPTIONAL wwwmux) # core stream trans utils -FIND_WWW_LIBRARY(LIBWWWXML_LIBRARY OPTIONAL wwwxml) # core utils xmlparse -FIND_WWW_LIBRARY(LIBWWWZIP_LIBRARY OPTIONAL wwwzip) # core utils -FIND_WWW_LIBRARY(LIBXMLPARSE_LIBRARY OPTIONAL xmlparse) # xmltok - -# Other used by other -FIND_WWW_LIBRARY(LIBXMLTOK_LIBRARY OPTIONAL xmltok) -FIND_WWW_LIBRARY(LIBWWWSSL_LIBRARY OPTIONAL wwwssl) -FIND_WWW_LIBRARY(LIBMD5_LIBRARY OPTIONAL md5) -FIND_WWW_LIBRARY(LIBPICS_LIBRARY OPTIONAL pics) - -# Other external libraries -FIND_PACKAGE(EXPAT QUIET) -FIND_PACKAGE(OpenSSL QUIET) -FIND_WWW_LIBRARY(LIBREGEX_LIBRARY OPTIONAL gnu_regex) - -# Now link all libs together -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWCACHE_LIBRARY HTLoadCache) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWCACHE_LIBRARY HTCacheAppend) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWFTP_LIBRARY HTLoadFTP) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWGOPHER_LIBRARY HTLoadGopher) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWNEWS_LIBRARY HTLoadNews) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWTELNET_LIBRARY HTLoadTelnet) - -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWSTREAM_LIBRARY HTStreamToChunk) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWSTREAM_LIBRARY HTGuess_new) -LINK_WWW_LIBRARY(LIBWWWFILE_LIBRARY LIBWWWDIR_LIBRARY HTDir_new) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWINIT_LIBRARY HTProtocolInit) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWXML_LIBRARY HTXML_new) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWZIP_LIBRARY HTZLib_inflate) - -# libwwwxml can be linked to xmlparse or expat -LINK_WWW_LIBRARY(LIBWWWXML_LIBRARY LIBXMLPARSE_LIBRARY XML_ParserCreate) - -IF(LIBXMLPARSE_LIBRARY_LINKED) - LINK_WWW_LIBRARY(LIBXMLPARSE_LIBRARY EXPAT_LIBRARY XmlInitEncoding) -ELSE(LIBXMLPARSE_LIBRARY_LINKED) - LINK_WWW_LIBRARY(LIBWWWXML_LIBRARY EXPAT_LIBRARY XML_ParserCreate) -ENDIF(LIBXMLPARSE_LIBRARY_LINKED) - -LINK_WWW_LIBRARY(LIBWWWHTTP_LIBRARY LIBMD5_LIBRARY MD5Init) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBREGEX_LIBRARY regexec) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY OPENSSL_LIBRARIES SSL_new) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Libwww DEFAULT_MSG - LIBWWW_LIBRARIES - LIBWWW_INCLUDE_DIR -) diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index 34105028c..76caa2caa 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -28,11 +28,6 @@ typedef std::map TStyle; -extern "C" -{ -#include "WWWInit.h" -} - namespace NLGUI { class CCtrlButton; @@ -55,15 +50,6 @@ namespace NLGUI public: DECLARE_UI_CLASS( CGroupHTML ) - friend void TextAdd (struct _HText *me, const char * buf, int len); - friend void TextBeginElement (_HText *me, int element_number, const BOOL *present, const char ** value); - friend void TextEndElement (_HText *me, int element_number); - friend void TextLink (struct _HText *me, int element_number, int attribute_number, struct _HTChildAnchor *anchor, const BOOL *present, const char **value); - friend void TextBuild (HText * me, HTextStatus status); - friend void TextBeginUnparsedElement(HText *me, const char *buffer, int length); - friend void TextEndUnparsedElement(HText *me, const char *buffer, int length); - friend int requestTerminater (HTRequest * request, HTResponse * response, void * param, int status); - /// Web browser options for CGroupHTML struct SWebOptions { @@ -360,12 +346,6 @@ namespace NLGUI bool _Object; std::string _ObjectScript; - // Someone is conecting. We got problem with libwww : 2 connection requests can deadlock the client. - static CGroupHTML *_ConnectingLock; - - // LibWWW data - class CLibWWWData *_LibWWW; - // Current paragraph std::string _DivName; CGroupParagraph* _Paragraph; diff --git a/code/nel/include/nel/gui/libwww.h b/code/nel/include/nel/gui/libwww.h index b1f070ddd..d3e4eeec9 100644 --- a/code/nel/include/nel/gui/libwww.h +++ b/code/nel/include/nel/gui/libwww.h @@ -20,11 +20,6 @@ #ifndef CL_LIB_WWW_H #define CL_LIB_WWW_H -extern "C" -{ -#include "WWWInit.h" -} - #include "nel/misc/rgba.h" namespace NLGUI @@ -38,11 +33,6 @@ namespace NLGUI // Init the libwww void initLibWWW(); - // Get an url and setup a local domain - const std::string &setCurrentDomain(const std::string &url); - - extern std::string CurrentCookie; - // *************************************************************************** // Some DTD table @@ -230,46 +220,6 @@ namespace NLGUI // *************************************************************************** - // A smart ptr for LibWWW strings - class C3WSmartPtr - { - public: - C3WSmartPtr () - { - _Ptr = NULL; - } - C3WSmartPtr (const char *ptr) - { - _Ptr = ptr; - } - ~C3WSmartPtr () - { - clear(); - } - void operator=(const char *str) - { - clear (); - _Ptr = str; - } - operator const char *() const - { - return _Ptr; - } - void clear() - { - if (_Ptr) - { - void *ptr = (void*)_Ptr; - HT_FREE(ptr); - } - _Ptr = NULL; - } - private: - const char *_Ptr; - }; - - // *************************************************************************** - // Read a width HTML parameter. "100" or "100%". Returns true if percent (0 ~ 1) else false bool getPercentage (sint32 &width, float &percent, const char *str); @@ -280,15 +230,6 @@ namespace NLGUI // *************************************************************************** - void _VerifyLibWWW(const char *function, bool ok, const char *file, int line); - #define VerifyLibWWW(a,b) _VerifyLibWWW(a,(b)!=FALSE,__FILE__,__LINE__) - - // *************************************************************************** - - // Standard request terminator - int requestTerminater (HTRequest * request, HTResponse * response, void * param, int status) ; - - // *************************************************************************** } #endif diff --git a/code/nel/include/nel/gui/libwww_nel_stream.h b/code/nel/include/nel/gui/libwww_nel_stream.h deleted file mode 100644 index 4dbadf1b8..000000000 --- a/code/nel/include/nel/gui/libwww_nel_stream.h +++ /dev/null @@ -1,28 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - - -#ifndef LIBWWW_NEL_STREAM_H -#define LIBWWW_NEL_STREAM_H - - -#include "HTProt.h" - -extern "C" HTProtCallback HTLoadNeLFile; -extern "C" PUBLIC HTInputStream * HTNeLReader_new (HTHost * host, HTChannel * ch, void * param, int mode); - -#endif // LIBWWW_NEL_STREAM_H diff --git a/code/nel/include/nel/gui/libwww_types.h b/code/nel/include/nel/gui/libwww_types.h new file mode 100644 index 000000000..27058c861 --- /dev/null +++ b/code/nel/include/nel/gui/libwww_types.h @@ -0,0 +1,1075 @@ +/** + libwww Copyright Notice + [This notice should be placed within redistributed or derivative software + code when appropriate. This particular formulation of W3C's notice for + inclusion in libwww code became active on August 14 1998.] + + LIBWWW COPYRIGHT NOTICE + + libwww: W3C's implementation of HTTP can be found at: + http://www.w3.org/Library/ + + Copyright ¨ 1995-2002 World Wide Web Consortium, + (Massachusetts Institute of Technology, Institut + National de Recherche en Informatique et en + Automatique, Keio University). All Rights Reserved. + This program is distributed under the W3C's + Intellectual Property License. This program is + distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A + PARTICULAR PURPOSE. See W3C License + http://www.w3.org/Consortium/Legal/ for more details. + + Copyright ¨ 1995 CERN. "This product includes computer + software created and made available by CERN. This + acknowledgment shall be mentioned in full in any + product which includes the CERN computer software + included herein or parts thereof." + + *****************************************************************************/ + +#ifndef CL_LIB_WWW_TYPES_H +#define CL_LIB_WWW_TYPES_H + +typedef char BOOL; + +// +// LibWWW elements +// - order must be kept for backward compatibility, new tags can be added to the end +typedef enum _HTMLElement { + HTML_A = 0, + HTML_ABBR, + HTML_ACRONYM, + HTML_ADDRESS, + HTML_APPLET, + HTML_AREA, + HTML_B, + HTML_BASE, + HTML_BASEFONT, + HTML_BDO, + HTML_BIG, + HTML_BLOCKQUOTE, + HTML_BODY, + HTML_BR, + HTML_BUTTON, + HTML_CAPTION, + HTML_CENTER, + HTML_CITE, + HTML_CODE, + HTML_COL, + HTML_COLGROUP, + HTML_DD, + HTML_DEL, + HTML_DFN, + HTML_DIR, + HTML_DIV, + HTML_DL, + HTML_DT, + HTML_EM, + HTML_FIELDSET, + HTML_FONT, + HTML_FORM, + HTML_FRAME, + HTML_FRAMESET, + HTML_H1, + HTML_H2, + HTML_H3, + HTML_H4, + HTML_H5, + HTML_H6, + HTML_HEAD, + HTML_HR, + HTML_HTML, + HTML_I, + HTML_IFRAME, + HTML_IMG, + HTML_INPUT, + HTML_INS, + HTML_ISINDEX, + HTML_KBD, + HTML_LABEL, + HTML_LEGEND, + HTML_LI, + HTML_LINK, + HTML_MAP, + HTML_MENU, + HTML_META, + HTML_NEXTID, /* !!! */ + HTML_NOFRAMES, + HTML_NOSCRIPT, + HTML_OBJECT, + HTML_OL, + HTML_OPTGROUP, + HTML_OPTION, + HTML_P, + HTML_PARAM, + HTML_PRE, + HTML_Q, + HTML_S, + HTML_SAMP, + HTML_SCRIPT, + HTML_SELECT, + HTML_SMALL, + HTML_SPAN, + HTML_STRIKE, + HTML_STRONG, + HTML_STYLE, + HTML_SUB, + HTML_SUP, + HTML_TABLE, + HTML_TBODY, + HTML_TD, + HTML_TEXTAREA, + HTML_TFOOT, + HTML_TH, + HTML_THEAD, + HTML_TITLE, + HTML_TR, + HTML_TT, + HTML_U, + HTML_UL, + HTML_VAR, + // new tags + HTML_LUA, + // this must be the last entry + HTML_ELEMENTS +} HTMLElement; + + +#define HTML_ATTR(t,a) HTML_##t##_##a +#define HTML_ATTRIBUTES(t) HTML_##t##_ATTRIBUTES + +/* + ( + A + ) + */ + +enum _HTML_A_Attributes { + HTML_ATTR(A,ACCESSKEY) = 0, + HTML_ATTR(A,CHARSET), + HTML_ATTR(A,CLASS), + HTML_ATTR(A,COORDS), + HTML_ATTR(A,DIR), + HTML_ATTR(A,HREF), + HTML_ATTR(A,HREFLANG), + HTML_ATTR(A,ID), + HTML_ATTR(A,NAME), + HTML_ATTR(A,REL), + HTML_ATTR(A,REV), + HTML_ATTR(A,SHAPE), + HTML_ATTR(A,STYLE), + HTML_ATTR(A,TABINDEX), + HTML_ATTR(A,TARGET), + HTML_ATTR(A,TYPE), + HTML_ATTR(A,TITLE), + HTML_ATTR(A,Z_ACTION_CATEGORY), // NLGUI + HTML_ATTR(A,Z_ACTION_PARANS), // NLGUI + HTML_ATTR(A,Z_ACTION_SHORTCUT), // NLGUI + HTML_ATTRIBUTES(A) +}; + +/* + ( + APPLET - Deprecated + ) + */ + +enum _HTML_APPLET_Attributes { + HTML_ATTR(APPLET,ALIGN) = 0, + HTML_ATTR(APPLET,ALT), + HTML_ATTR(APPLET,ARCHIVE), + HTML_ATTR(APPLET,CLASS), + HTML_ATTR(APPLET,CODE), + HTML_ATTR(APPLET,CODEBASE), + HTML_ATTR(APPLET,HEIGHT), + HTML_ATTR(APPLET,HSPACE), + HTML_ATTR(APPLET,ID), + HTML_ATTR(APPLET,NAME), + HTML_ATTR(APPLET,OBJECT), + HTML_ATTR(APPLET,STYLE), + HTML_ATTR(APPLET,TITLE), + HTML_ATTR(APPLET,VSPACE), + HTML_ATTR(APPLET,WIDTH), + HTML_ATTRIBUTES(APPLET) +}; + +/* + ( + AREA + ) + */ + +enum _HTML_AREA_Attributes { + HTML_ATTR(AREA,ACCESSKEY) = 0, + HTML_ATTR(AREA,ALT), + HTML_ATTR(AREA,CLASS), + HTML_ATTR(AREA,COORDS), + HTML_ATTR(AREA,DIR), + HTML_ATTR(AREA,HREF), + HTML_ATTR(AREA,ID), + HTML_ATTR(AREA,NAME), + HTML_ATTR(AREA,NOHREF), + HTML_ATTR(AREA,LANG), + HTML_ATTR(AREA,SHAPE), + HTML_ATTR(AREA,STYLE), + HTML_ATTR(AREA,TABINDEX), + HTML_ATTR(AREA,TARGET), + HTML_ATTR(AREA,TITLE), + HTML_ATTRIBUTES(AREA) +}; + + +/* + ( + BASE + ) + */ + +enum _HTML_BASE_Attributes { + HTML_ATTR(BASE,HREF) = 0, + HTML_ATTR(BASE,TARGET), + HTML_ATTRIBUTES(BASE) +}; + +/* + ( + BDO + ) + */ + +enum _HTML_BDO_Attributes { + HTML_ATTR(BDO,CLASS) = 0, + HTML_ATTR(BDO,DIR), + HTML_ATTR(BDO,ID), + HTML_ATTR(BDO,LANG), + HTML_ATTR(BDO,STYLE), + HTML_ATTR(BDO,TITLE), + HTML_ATTRIBUTES(BDO) +}; + +/* + ( + BLOCKQUOTE + ) + */ + +enum _HTML_BQ_Attributes { + HTML_ATTR(BQ,CITE) = 0, + HTML_ATTR(BQ,CLASS), + HTML_ATTR(BQ,DIR), + HTML_ATTR(BQ,ID), + HTML_ATTR(BQ,LANG), + HTML_ATTR(BQ,STYLE), + HTML_ATTR(BQ,TITLE), + HTML_ATTRIBUTES(BQ) +}; + +/* + ( + BODY + ) + */ + +enum _HTML_BODY_Attributes { + HTML_ATTR(BODY,ALINK) = 0, + HTML_ATTR(BODY,BACKGROUND), + HTML_ATTR(BODY,BGCOLOR), + HTML_ATTR(BODY,CLASS), + HTML_ATTR(BODY,DIR), + HTML_ATTR(BODY,ID), + HTML_ATTR(BODY,LANG), + HTML_ATTR(BODY,LINK), + HTML_ATTR(BODY,STYLE), + HTML_ATTR(BODY,TEXT), + HTML_ATTR(BODY,TITLE), + HTML_ATTR(BODY,VLINK), + HTML_ATTRIBUTES(BODY) +}; + +/* + ( + BR + ) + */ + +enum _HTML_BR_Attributes { + HTML_ATTR(BR,CLASS) = 0, + HTML_ATTR(BR,CLEAR), + HTML_ATTR(BR,ID), + HTML_ATTR(BR,STYLE), + HTML_ATTR(BR,TITLE), + HTML_ATTRIBUTES(BR) +}; + +/* + ( + BUTTON + ) + */ + +enum _HTML_BUTTON_Attributes { + HTML_ATTR(BUTTON,ACCESSKEY) = 0, + HTML_ATTR(BUTTON,CLASS), + HTML_ATTR(BUTTON,DIR), + HTML_ATTR(BUTTON,DISABLED), + HTML_ATTR(BUTTON,ID), + HTML_ATTR(BUTTON,LANG), + HTML_ATTR(BUTTON,NAME), + HTML_ATTR(BUTTON,STYLE), + HTML_ATTR(BUTTON,TABINDEX), + HTML_ATTR(BUTTON,TITLE), + HTML_ATTR(BUTTON,TYPE), + HTML_ATTR(BUTTON,VALUE), + HTML_ATTRIBUTES(BUTTON) +}; + +/* + ( + COL + ) + */ + +enum _HTML_COL_Attributes { + HTML_ATTR(COL,CLASS) = 0, + HTML_ATTR(COL,DIR), + HTML_ATTR(COL,ID), + HTML_ATTR(COL,LANG), + HTML_ATTR(COL,SPAN), + HTML_ATTR(COL,STYLE), + HTML_ATTR(COL,TITLE), + HTML_ATTR(COL,WIDTH), + HTML_ATTRIBUTES(COL) +}; + +/* + ( + DEL, INS + ) + */ + +enum _HTML_CHANGES_Attributes { + HTML_ATTR(CHANGES,CITE) = 0, + HTML_ATTR(CHANGES,CLASS), + HTML_ATTR(CHANGES,DATETIME), + HTML_ATTR(CHANGES,DIR), + HTML_ATTR(CHANGES,ID), + HTML_ATTR(CHANGES,LANG), + HTML_ATTR(CHANGES,STYLE), + HTML_ATTR(CHANGES,TITLE), + HTML_ATTRIBUTES(CHANGES) +}; + +/* + ( + FONT - Deprecated + ) + */ + +enum _HTML_FONT_Attributes { + HTML_ATTR(FONT,CLASS) = 0, + HTML_ATTR(FONT,COLOR), + HTML_ATTR(FONT,DIR), + HTML_ATTR(FONT,FACE), + HTML_ATTR(FONT,ID), + HTML_ATTR(FONT,LANG), + HTML_ATTR(FONT,SIZE), + HTML_ATTR(FONT,STYLE), + HTML_ATTR(FONT,TITLE), + HTML_ATTRIBUTES(FONT) +}; + +/* + ( + FORM + ) + */ + +enum _HTML_FORM_Attributes { + HTML_ATTR(FORM,ACCEPT) = 0, + HTML_ATTR(FORM,ACCEPT_CHARSET), /* { "ACCEPT-CHARSET" } */ + HTML_ATTR(FORM,ACTION), + HTML_ATTR(FORM,CLASS), + HTML_ATTR(FORM,DIR), + HTML_ATTR(FORM,ENCTYPE), + HTML_ATTR(FORM,ID), + HTML_ATTR(FORM,LANG), + HTML_ATTR(FORM,METHOD), + HTML_ATTR(FORM,STYLE), + HTML_ATTR(FORM,TARGET), + HTML_ATTR(FORM,TITLE), + HTML_ATTRIBUTES(FORM) +}; + +/* + ( + FRAME + ) + */ + +enum _HTML_FRAME_Attributes { + HTML_ATTR(FRAME,CLASS) = 0, + HTML_ATTR(FRAME,FRAMEBORDER), + HTML_ATTR(FRAME,ID), + HTML_ATTR(FRAME,NAME), + HTML_ATTR(FRAME,MARGINHEIGHT), + HTML_ATTR(FRAME,MARGINWIDTH), + HTML_ATTR(FRAME,NORESIZE), + HTML_ATTR(FRAME,LONGDESC), + HTML_ATTR(FRAME,SCROLLING), + HTML_ATTR(FRAME,SRC), + HTML_ATTR(FRAME,STYLE), + HTML_ATTR(FRAME,TARGET), + HTML_ATTR(FRAME,TITLE), + HTML_ATTRIBUTES(FRAME) +}; + +/* + ( + FRAMESET + ) + */ + +enum _HTML_FRAMESET_Attributes { + HTML_ATTR(FRAMESET,CLASS) = 0, + HTML_ATTR(FRAMESET,COLS), + HTML_ATTR(FRAMESET,ID), + HTML_ATTR(FRAMESET,ROWS), + HTML_ATTR(FRAMESET,STYLE), + HTML_ATTR(FRAMESET,TITLE), + HTML_ATTRIBUTES(FRAMESET) +}; + +/* + ( + Generic attributes + ) + */ + +enum _HTML_GEN_Attributes { + HTML_ATTR(GEN,CLASS) = 0, + HTML_ATTR(GEN,DIR), + HTML_ATTR(GEN,ID), + HTML_ATTR(GEN,LANG), + HTML_ATTR(GEN,STYLE), + HTML_ATTR(GEN,TITLE), + HTML_ATTRIBUTES(GEN) +}; + +/* + ( + BLOCK + ) + */ + +enum _HTML_BLOCK_Attributes { + HTML_ATTR(BLOCK,ALIGN) = 0, + HTML_ATTR(BLOCK,CLASS), + HTML_ATTR(BLOCK,DIR), + HTML_ATTR(BLOCK,ID), + HTML_ATTR(BLOCK,LANG), + HTML_ATTR(BLOCK,STYLE), + HTML_ATTR(BLOCK,TITLE), + HTML_ATTRIBUTES(BLOCK) +}; + +/* + ( + HEAD + ) + */ + +enum _HTML_HEAD_Attributes { + HTML_ATTR(HEAD,DIR) = 0, + HTML_ATTR(HEAD,LANG), + HTML_ATTR(HEAD,PROFILE), + HTML_ATTRIBUTES(HEAD) +}; + +/* + ( + HR + ) + */ + +enum _HTML_HR_Attributes { + HTML_ATTR(HR,ALIGN) = 0, + HTML_ATTR(HR,CLASS), + HTML_ATTR(HR,DIR), + HTML_ATTR(HR,ID), + HTML_ATTR(HR,LANG), + HTML_ATTR(HR,NOSHADE), + HTML_ATTR(HR,SIZE), + HTML_ATTR(HR,STYLE), + HTML_ATTR(HR,TITLE), + HTML_ATTR(HR,WIDTH), + HTML_ATTRIBUTES(HR) +}; + +/* + ( + HTML + ) + */ + +enum _HTML_HTML_Attributes { + HTML_ATTR(HTML,DIR) = 0, + HTML_ATTR(HTML,LANG), + HTML_ATTR(HTML,VERSION), + HTML_ATTRIBUTES(HTML) +}; + +/* + ( + IFRAME + ) + */ + +enum _HTML_IFRAME_Attributes { + HTML_ATTR(IFRAME,ALIGN) = 0, + HTML_ATTR(IFRAME,CLASS), + HTML_ATTR(IFRAME,FRAMEBORDER), + HTML_ATTR(IFRAME,HEIGHT), + HTML_ATTR(IFRAME,ID), + HTML_ATTR(IFRAME,LONGDESC), + HTML_ATTR(IFRAME,MARGINHEIGHT), + HTML_ATTR(IFRAME,MARGINWIDTH), + HTML_ATTR(IFRAME,NAME), + HTML_ATTR(IFRAME,SCROLLING), + HTML_ATTR(IFRAME,SRC), + HTML_ATTR(IFRAME,STYLE), + HTML_ATTR(IFRAME,TARGET), + HTML_ATTR(IFRAME,TITLE), + HTML_ATTR(IFRAME,WIDTH), + HTML_ATTRIBUTES(IFRAME) +}; + +/* + ( + IMG + ) + */ + +enum _HTML_IMG_Attributes { + HTML_ATTR(IMG,ALIGN) = 0, + HTML_ATTR(IMG,ALT), + HTML_ATTR(IMG,BORDER), + HTML_ATTR(IMG,CLASS), + HTML_ATTR(IMG,DIR), + HTML_ATTR(IMG,HEIGHT), + HTML_ATTR(IMG,HSPACE), + HTML_ATTR(IMG,ID), + HTML_ATTR(IMG,ISMAP), + HTML_ATTR(IMG,LANG), + HTML_ATTR(IMG,LONGDESC), + HTML_ATTR(IMG,SRC), + HTML_ATTR(IMG,STYLE), + HTML_ATTR(IMG,TITLE), + HTML_ATTR(IMG,USEMAP), + HTML_ATTR(IMG,VSPACE), + HTML_ATTR(IMG,WIDTH), + HTML_ATTRIBUTES(IMG) +}; + +/* + ( + INPUT + ) + */ + +enum _HTML_INPUT_Attributes { + HTML_ATTR(INPUT,ACCEPT) = 0, + HTML_ATTR(INPUT,ACCESSKEY), + HTML_ATTR(INPUT,ALIGN), + HTML_ATTR(INPUT,ALT), + HTML_ATTR(INPUT,CHECKED), + HTML_ATTR(INPUT,CLASS), + HTML_ATTR(INPUT,DIR), + HTML_ATTR(INPUT,DISABLED), + HTML_ATTR(INPUT,ID), + HTML_ATTR(INPUT,LANG), + HTML_ATTR(INPUT,MAXLENGTH), + HTML_ATTR(INPUT,NAME), + HTML_ATTR(INPUT,READONLY), + HTML_ATTR(INPUT,SIZE), + HTML_ATTR(INPUT,SRC), + HTML_ATTR(INPUT,STYLE), + HTML_ATTR(INPUT,TABINDEX), + HTML_ATTR(INPUT,TITLE), + HTML_ATTR(INPUT,TYPE), + HTML_ATTR(INPUT,USEMAP), + HTML_ATTR(INPUT,VALUE), + HTML_ATTRIBUTES(INPUT) +}; + +/* + ( + ) + */ + +enum _HTML_ISINDEX_Attributes { + HTML_ATTR(ISINDEX,CLASS) = 0, + HTML_ATTR(ISINDEX,DIR), + HTML_ATTR(ISINDEX,ID), + HTML_ATTR(ISINDEX,LANG), + HTML_ATTR(ISINDEX,PROMPT), + HTML_ATTR(ISINDEX,STYLE), + HTML_ATTR(ISINDEX,TITLE), + HTML_ATTRIBUTES(ISINDEX) +}; + +/* + ( + ) + */ + +enum _HTML_LABEL_Attributes { + HTML_ATTR(LABEL,ACCESSKEY) = 0, + HTML_ATTR(LABEL,CLASS), + HTML_ATTR(LABEL,DIR), + HTML_ATTR(LABEL,FOR), + HTML_ATTR(LABEL,ID), + HTML_ATTR(LABEL,LANG), + HTML_ATTR(LABEL,STYLE), + HTML_ATTR(LABEL,TITLE), + HTML_ATTRIBUTES(LABEL) +}; + +/* + ( + ) + */ + +enum _HTML_LEGEND_Attributes { + HTML_ATTR(LEGEND,ACCESSKEY) = 0, + HTML_ATTR(LEGEND,ALIGN), + HTML_ATTR(LEGEND,CLASS), + HTML_ATTR(LEGEND,DIR), + HTML_ATTR(LEGEND,ID), + HTML_ATTR(LEGEND,LANG), + HTML_ATTR(LEGEND,STYLE), + HTML_ATTR(LEGEND,TITLE), + HTML_ATTRIBUTES(LEGEND) +}; + +/* + ( + LI + ) + */ + +enum _HTML_LI_Attributes { + HTML_ATTR(LI,CLASS) = 0, + HTML_ATTR(LI,COMPACT), + HTML_ATTR(LI,DIR), + HTML_ATTR(LI,ID), + HTML_ATTR(LI,LANG), + HTML_ATTR(LI,STYLE), + HTML_ATTR(LI,TITLE), + HTML_ATTR(LI,TYPE), + HTML_ATTR(LI,VALUE), + HTML_ATTRIBUTES(LI) +}; + +/* + ( + LINK + ) + */ + +enum _HTML_LINK_Attributes { + HTML_ATTR(LINK,CHARSET) = 0, + HTML_ATTR(LINK,CLASS), + HTML_ATTR(LINK,DIR), + HTML_ATTR(LINK,HREF), + HTML_ATTR(LINK,HREFLANG), + HTML_ATTR(LINK,ID), + HTML_ATTR(LINK,LANG), + HTML_ATTR(LINK,MEDIA), + HTML_ATTR(LINK,REL), + HTML_ATTR(LINK,REV), + HTML_ATTR(LINK,STYLE), + HTML_ATTR(LINK,TARGET), + HTML_ATTR(LINK,TITLE), + HTML_ATTR(LINK,TYPE), + HTML_ATTRIBUTES(LINK) +}; + +/* + ( + MAP + ) + */ + +enum _HTML_MAP_Attributes { + HTML_ATTR(MAP,CLASS) = 0, + HTML_ATTR(MAP,DIR), + HTML_ATTR(MAP,ID), + HTML_ATTR(MAP,LANG), + HTML_ATTR(MAP,NAME), + HTML_ATTR(MAP,STYLE), + HTML_ATTR(MAP,TITLE), + HTML_ATTRIBUTES(MAP) +}; + +/* + ( + META + ) + */ + +enum _HTML_META_Attributes { + HTML_ATTR(META,CONTENT) = 0, + HTML_ATTR(META,DIR), + HTML_ATTR(META,HTTP_EQUIV), /* { "HTTP-EQUIV" ) */ + HTML_ATTR(META,LANG), + HTML_ATTR(META,NAME), + HTML_ATTR(META,SCHEME), + HTML_ATTRIBUTES(META) +}; + +/* + ( + NEXTID + ) + */ + +#define HTML_NEXTID_ATTRIBUTES 1 +#define HTML_NEXTID_N 0 + +/* + ( + OBJECT + ) + */ + +enum _HTML_OBJECT_Attributes { + HTML_ATTR(OBJECT,ALIGN) = 0, + HTML_ATTR(OBJECT,ARCHIVE), + HTML_ATTR(OBJECT,BORDER), + HTML_ATTR(OBJECT,CLASS), + HTML_ATTR(OBJECT,CLASSID), + HTML_ATTR(OBJECT,CODEBASE), + HTML_ATTR(OBJECT,CODETYPE), + HTML_ATTR(OBJECT,DATA), + HTML_ATTR(OBJECT,DECLARE), + HTML_ATTR(OBJECT,DIR), + HTML_ATTR(OBJECT,HEIGHT), + HTML_ATTR(OBJECT,HSPACE), + HTML_ATTR(OBJECT,ID), + HTML_ATTR(OBJECT,LANG), + HTML_ATTR(OBJECT,NAME), + HTML_ATTR(OBJECT,STANDBY), + HTML_ATTR(OBJECT,STYLE), + HTML_ATTR(OBJECT,TABINDEX), + HTML_ATTR(OBJECT,TITLE), + HTML_ATTR(OBJECT,TYPE), + HTML_ATTR(OBJECT,USEMAP), + HTML_ATTR(OBJECT,VSPACE), + HTML_ATTR(OBJECT,WIDTH), + HTML_ATTRIBUTES(OBJECT) +}; + +/* + ( + OL + ) + */ + +enum _HTML_OL_Attributes { + HTML_ATTR(OL,CLASS) = 0, + HTML_ATTR(OL,COMPACT), + HTML_ATTR(OL,DIR), + HTML_ATTR(OL,ID), + HTML_ATTR(OL,LANG), + HTML_ATTR(OL,START), + HTML_ATTR(OL,STYLE), + HTML_ATTR(OL,TITLE), + HTML_ATTR(OL,TYPE), + HTML_ATTRIBUTES(OL) +}; + +/* + ( + OPTGROUP + ) + */ + +enum _HTML_OPTGROUP_Attributes { + HTML_ATTR(OPTGROUP,CLASS) = 0, + HTML_ATTR(OPTGROUP,DISABLED), + HTML_ATTR(OPTGROUP,DIR), + HTML_ATTR(OPTGROUP,ID), + HTML_ATTR(OPTGROUP,LABEL), + HTML_ATTR(OPTGROUP,LANG), + HTML_ATTR(OPTGROUP,STYLE), + HTML_ATTR(OPTGROUP,TITLE), + HTML_ATTRIBUTES(OPTGROUP) +}; + +/* + ( + OPTION + ) + */ + +enum _HTML_OPTION_Attributes { + HTML_ATTR(OPTION,CLASS) = 0, + HTML_ATTR(OPTION,DISABLED), + HTML_ATTR(OPTION,DIR), + HTML_ATTR(OPTION,ID), + HTML_ATTR(OPTION,LABEL), + HTML_ATTR(OPTION,LANG), + HTML_ATTR(OPTION,SELECTED), + HTML_ATTR(OPTION,STYLE), + HTML_ATTR(OPTION,TITLE), + HTML_ATTR(OPTION,VALUE), + HTML_ATTRIBUTES(OPTION) +}; + +/* + ( + PARAM + ) + */ + +enum _HTML_PARAM_Attributes { + HTML_ATTR(PARAM,ID) = 0, + HTML_ATTR(PARAM,NAME), + HTML_ATTR(PARAM,TYPE), + HTML_ATTR(PARAM,VALUE), + HTML_ATTR(PARAM,VALUETYPE), + HTML_ATTRIBUTES(PARAM) +}; + +/* + ( + PRE + ) + */ + +enum _HTML_PRE_Attributes { + HTML_ATTR(PRE,CLASS) = 0, + HTML_ATTR(PRE,DIR), + HTML_ATTR(PRE,ID), + HTML_ATTR(PRE,LANG), + HTML_ATTR(PRE,STYLE), + HTML_ATTR(PRE,TITLE), + HTML_ATTR(PRE,WIDTH), + HTML_ATTRIBUTES(PRE) +}; + +/* + ( + SCRIPT + ) + */ + +enum _HTML_SCRIPT_Attributes { + HTML_ATTR(SCRIPT,CHARSET) = 0, + HTML_ATTR(SCRIPT,DEFER), + HTML_ATTR(SCRIPT,LANGUAGE), + HTML_ATTR(SCRIPT,SRC), + HTML_ATTR(SCRIPT,TYPE), + HTML_ATTRIBUTES(SCRIPT) +}; + +/* + ( + SELECT + ) + */ + +enum _HTML_SELECT_Attributes { + HTML_ATTR(SELECT,CLASS) = 0, + HTML_ATTR(SELECT,DIR), + HTML_ATTR(SELECT,DISABLED), + HTML_ATTR(SELECT,ID), + HTML_ATTR(SELECT,LANG), + HTML_ATTR(SELECT,MULTIPLE), + HTML_ATTR(SELECT,NAME), + HTML_ATTR(SELECT,SIZE), + HTML_ATTR(SELECT,STYLE), + HTML_ATTR(SELECT,TABINDEX), + HTML_ATTR(SELECT,TITLE), + HTML_ATTRIBUTES(SELECT) +}; + +/* + ( + STYLE + ) + */ + +enum _HTML_STYLE_Attributes { + HTML_ATTR(STYLE,DIR) = 0, + HTML_ATTR(STYLE,LANG), + HTML_ATTR(STYLE,MEDIA), + HTML_ATTR(STYLE,TITLE), + HTML_ATTR(STYLE,TYPE), + HTML_ATTRIBUTES(STYLE) +}; + +/* + ( + TABLE + ) + */ + +enum _HTML_TABLE_Attributes { + HTML_ATTR(TABLE,ALIGN) = 0, + HTML_ATTR(TABLE,BGCOLOR), + HTML_ATTR(TABLE,BORDER), + HTML_ATTR(TABLE,CELLPADDING), + HTML_ATTR(TABLE,CELLSPACING), + HTML_ATTR(TABLE,CLASS), + HTML_ATTR(TABLE,DIR), + HTML_ATTR(TABLE,FRAME), + HTML_ATTR(TABLE,ID), + HTML_ATTR(TABLE,LANG), + HTML_ATTR(TABLE,RULES), + HTML_ATTR(TABLE,SUMMARY), + HTML_ATTR(TABLE,STYLE), + HTML_ATTR(TABLE,TITLE), + HTML_ATTR(TABLE,WIDTH), + HTML_ATTRIBUTES(TABLE) +}; + +/* + ( + TABLE Elements + ) + */ + +enum _HTML_TELE_Attributes { + HTML_ATTR(TELE,ALIGN) = 0, + HTML_ATTR(TELE,CHAR), + HTML_ATTR(TELE,CHAROFF), + HTML_ATTR(TELE,CLASS), + HTML_ATTR(TELE,DIR), + HTML_ATTR(TELE,ID), + HTML_ATTR(TELE,LANG), + HTML_ATTR(TELE,STYLE), + HTML_ATTR(TELE,TITLE), + HTML_ATTR(TELE,VALIGN), + HTML_ATTRIBUTES(TELE) +}; + +/* + ( + TD + ) + */ + +enum _HTML_TD_Attributes { + HTML_ATTR(TD,ABBR) = 0, + HTML_ATTR(TD,ALIGN), + HTML_ATTR(TD,AXIS), + HTML_ATTR(TD,BGCOLOR), + HTML_ATTR(TD,CHAR), + HTML_ATTR(TD,CHAROFF), + HTML_ATTR(TD,CLASS), + HTML_ATTR(TD,COLSPAN), + HTML_ATTR(TD,DIR), + HTML_ATTR(TD,ID), + HTML_ATTR(TD,HEADERS), + HTML_ATTR(TD,HEIGHT), + HTML_ATTR(TD,LANG), + HTML_ATTR(TD,NOWRAP), + HTML_ATTR(TD,ROWSPAN), + HTML_ATTR(TD,SCOPE), + HTML_ATTR(TD,STYLE), + HTML_ATTR(TD,TITLE), + HTML_ATTR(TD,VALIGN), + HTML_ATTR(TD,WIDTH), + HTML_ATTRIBUTES(TD) +}; + +/* + ( + TEXTAREA + ) + */ + +enum _HTML_TEXTAREA_Attributes { + HTML_ATTR(TEXTAREA,CLASS) = 0, + HTML_ATTR(TEXTAREA,COLS), + HTML_ATTR(TEXTAREA,DIR), + HTML_ATTR(TEXTAREA,DISABLED), + HTML_ATTR(TEXTAREA,ID), + HTML_ATTR(TEXTAREA,LANG), + HTML_ATTR(TEXTAREA,NAME), + HTML_ATTR(TEXTAREA,READONLY), + HTML_ATTR(TEXTAREA,ROWS), + HTML_ATTR(TEXTAREA,STYLE), + HTML_ATTR(TEXTAREA,TABINDEX), + HTML_ATTR(TEXTAREA,TITLE), + HTML_ATTRIBUTES(TEXTAREA) +}; + +/* + ( + TITLE + ) + */ + +enum _HTML_TITLE_Attributes { + HTML_ATTR(TITLE,DIR) = 0, + HTML_ATTR(TITLE,LANG), + HTML_ATTRIBUTES(TITLE) +}; + +/* + ( + UL + ) + */ + +enum _HTML_UL_Attributes { + HTML_ATTR(UL,CLASS) = 0, + HTML_ATTR(UL,COMPACT), + HTML_ATTR(UL,DIR), + HTML_ATTR(UL,ID), + HTML_ATTR(UL,LANG), + HTML_ATTR(UL,STYLE), + HTML_ATTR(UL,TITLE), + HTML_ATTR(UL,TYPE), + HTML_ATTRIBUTES(UL) +}; + + +/* +** ELEMENTS +** Must match definitions in HTMLPDTD.html! +** Must be in alphabetical order. +** +** Name, Attributes, content +*/ + +// +// SGML.h +// +#define MAX_ATTRIBUTES 32 + +typedef struct _HTAttr { + char * name; +} HTAttr; + +// striped struct +typedef struct _HTTag { + std::string name; + HTAttr * attributes; + int number_of_attributes; +} HTTag; + +// entities are removed +typedef struct { + HTTag * tags; + int number_of_tags; +} SGML_dtd; + +SGML_dtd * HTML_dtd (void); + +#endif + diff --git a/code/nel/src/gui/CMakeLists.txt b/code/nel/src/gui/CMakeLists.txt index 32125791d..6e82b2240 100644 --- a/code/nel/src/gui/CMakeLists.txt +++ b/code/nel/src/gui/CMakeLists.txt @@ -6,9 +6,9 @@ SOURCE_GROUP("src" FILES ${SRC}) NL_TARGET_LIB(nelgui ${SRC} ${HEADERS}) -INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR} ${LUABIND_INCLUDE_DIR} ${LIBWWW_INCLUDE_DIR} ${CURL_INCLUDE_DIRS}) +INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR} ${LUABIND_INCLUDE_DIR} ${CURL_INCLUDE_DIRS}) -TARGET_LINK_LIBRARIES(nelgui nelmisc nel3d ${LUA_LIBRARIES} ${LUABIND_LIBRARIES} ${LIBXML2_LIBRARIES} ${LIBWWW_LIBRARIES} ${CURL_LIBRARIES}) +TARGET_LINK_LIBRARIES(nelgui nelmisc nel3d ${LUA_LIBRARIES} ${LUABIND_LIBRARIES} ${LIBXML2_LIBRARIES} ${CURL_LIBRARIES}) SET_TARGET_PROPERTIES(nelgui PROPERTIES LINK_INTERFACE_LIBRARIES "") NL_DEFAULT_PROPS(nelgui "NeL, Library: NeL GUI") NL_ADD_RUNTIME_FLAGS(nelgui) diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 8619ea878..d99d706b1 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -19,14 +19,6 @@ #include "stdpch.h" #include "nel/gui/group_html.h" -// LibWWW -extern "C" -{ -#include "WWWLib.h" /* Global Library Include file */ -#include "WWWApp.h" -#include "WWWInit.h" -} - #include #include "nel/misc/types_nl.h" #include "nel/misc/rgba.h" @@ -65,7 +57,6 @@ namespace NLGUI // Uncomment to see the log about image download //#define LOG_DL 1 - CGroupHTML *CGroupHTML::_ConnectingLock = NULL; CGroupHTML::SWebOptions CGroupHTML::options; @@ -332,7 +323,6 @@ namespace NLGUI curl_easy_cleanup(it->curl); string file; - if (it->type == ImgType) file = localImageName(it->url); else @@ -440,20 +430,6 @@ namespace NLGUI template void popIfNotEmpty(A &vect) { if(!vect.empty()) vect.pop_back(); } - // Data stored in CGroupHTML for libwww. - - class CLibWWWData - { - public: - CLibWWWData () - { - Request = NULL; - Anchor = NULL; - } - HTRequest *Request; - HTAnchor *Anchor; - }; - // *************************************************************************** void CGroupHTML::beginBuild () @@ -461,9 +437,7 @@ namespace NLGUI if (_Browsing) { nlassert (_Connecting); - nlassert (_ConnectingLock == this); _Connecting = false; - _ConnectingLock = NULL; removeContent (); } @@ -1068,30 +1042,13 @@ namespace NLGUI // Get the action name if (present[HTML_FORM_ACTION] && value[HTML_FORM_ACTION]) { - HTParentAnchor *parent = HTAnchor_parent (_LibWWW->Anchor); - HTChildAnchor *child = HTAnchor_findChildAndLink (parent, "", value[HTML_FORM_ACTION], NULL); - if (child) - { - HTAnchor *mainChild = HTAnchor_followMainLink((HTAnchor *) child); - if (mainChild) - { - C3WSmartPtr uri = HTAnchor_address(mainChild); - form.Action = (const char*)uri; - } - } - else - { - HTAnchor * dest = HTAnchor_findAddress (value[HTML_FORM_ACTION]); - if (dest) - { - C3WSmartPtr uri = HTAnchor_address(dest); - form.Action = (const char*)uri; - } - else - { - form.Action = value[HTML_FORM_ACTION]; - } - } + form.Action = getAbsoluteUrl(string(value[HTML_FORM_ACTION])); + nlinfo("(%s) form.action '%s' (converted)", _Id.c_str(), form.Action.c_str()); + } + else + { + form.Action = _URL; + nlinfo("(%s) using _URL for form.action '%s'", _Id.c_str(), form.Action.c_str()); } _Forms.push_back(form); } @@ -1881,7 +1838,6 @@ namespace NLGUI _PostNextTime = false; _Browsing = false; _Connecting = false; - _LibWWW = new CLibWWWData; _CurrentViewLink = NULL; _CurrentViewImage = NULL; _Indent = 0; @@ -1965,7 +1921,6 @@ namespace NLGUI // this is why the call to 'updateRefreshButton' has been removed from stopBrowse clearContext(); - delete _LibWWW; } std::string CGroupHTML::getProperty( const std::string &name ) const @@ -2894,15 +2849,7 @@ namespace NLGUI clearContext(); _Browsing = false; - if (_Connecting) - { - nlassert (_ConnectingLock == this); - _ConnectingLock = NULL; - } - else - nlassert (_ConnectingLock != this); _Connecting = false; - // stopBrowse (); updateRefreshButton(); #ifdef LOG_DL @@ -2970,24 +2917,6 @@ namespace NLGUI clearContext(); _Browsing = false; - - if (_Connecting) - { - nlassert (_ConnectingLock == this); - _ConnectingLock = NULL; - } - else - nlassert (_ConnectingLock != this); - _Connecting = false; - - // Request running ? - if (_LibWWW->Request) - { - // VerifyLibWWW("HTRequest_kill", HTRequest_kill(_LibWWW->Request) == TRUE); - HTRequest_kill(_LibWWW->Request); - HTRequest_delete(_LibWWW->Request); - _LibWWW->Request = NULL; - } } // *************************************************************************** @@ -3766,36 +3695,6 @@ namespace NLGUI } }; - static int timer_called = 0; - - static int - timer_callback(HTTimer * const timer , - void * const user_data , - HTEventType const event ) - { - /*---------------------------------------------------------------------------- - A handy timer callback which cancels the running event loop. - -----------------------------------------------------------------------------*/ - nlassert(event == HTEvent_TIMEOUT); - timer_called = 1; - HTEventList_stopLoop(); - - /* XXX - The meaning of this return value is undocumented, but close - ** inspection of libwww's source suggests that we want to return HT_OK. */ - return HT_OK; - } - - static void handleLibwwwEvents() - { - HTTimer *timer; - timer_called = 0; - timer = HTTimer_new(NULL, &timer_callback, NULL, - 1, YES, NO); - if (!timer_called) - HTEventList_newLoop(); - HTTimer_delete(timer); - } - // *************************************************************************** void CGroupHTML::handle () @@ -3806,8 +3705,6 @@ namespace NLGUI if (_Connecting) { - nlassert (_ConnectingLock == this); - // Check timeout if needed if (_TimeoutValue != 0 && _ConnectingTimeout <= ( times.thisFrameMs / 1000.0f ) ) { @@ -3815,296 +3712,12 @@ namespace NLGUI } } else + if (_BrowseNextTime || _PostNextTime) { - if (_ConnectingLock == NULL) - { - if (_BrowseNextTime) - { - // Stop browsing now - stopBrowse (); - updateRefreshButton(); - // Browsing - _Browsing = true; - updateRefreshButton(); - - // Home ? - if (_URL == "home") - _URL = home(); - - string finalUrl; - bool isLocal = lookupLocalFile (finalUrl, _URL.c_str(), true); - - // Reset the title - if(_TitlePrefix.empty()) - setTitle (CI18N::get("uiPleaseWait")); - else - setTitle (_TitlePrefix + " - " + CI18N::get("uiPleaseWait")); - - // Start connecting - nlassert (_ConnectingLock == NULL); - _ConnectingLock = this; - _Connecting = true; - _ConnectingTimeout = ( times.thisFrameMs / 1000.0f ) + _TimeoutValue; - - // Save new url - _URL = finalUrl; - - // file is probably from bnp (ingame help) - if (isLocal) - { - if (strlwr(finalUrl).find("file:/") == 0) - { - finalUrl = finalUrl.substr(6, finalUrl.size() - 6); - } - doBrowseLocalFile(finalUrl); - } - else - { - - CButtonFreezer freezer; - this->visit(&freezer); - - // display HTTP query - //nlinfo("WEB: GET '%s'", finalUrl.c_str()); - - // Init LibWWW - initLibWWW(); - _TrustedDomain = isTrustedDomain(setCurrentDomain(finalUrl)); - - // Add custom get params - addHTTPGetParams (finalUrl, _TrustedDomain); - - - // Get the final URL - C3WSmartPtr uri = HTParse(finalUrl.c_str(), NULL, PARSE_ALL); - - // Create an anchor - if ((_LibWWW->Anchor = HTAnchor_findAddress(uri)) == NULL) - { - browseError((string("The page address is malformed : ")+(const char*)uri).c_str()); - } - else - { - /* Add our own request terminate handler. Nb: pass as param a UID, not the ptr */ - /* FIX ME - every connection is appending a new callback to the list, and its never removed (Vinicius Arroyo)*/ - HTNet_addAfter(requestTerminater, NULL, (void*)(size_t)_GroupHtmlUID, HT_ALL, HT_FILTER_LAST); - - /* Set the timeout for long we are going to wait for a response */ - HTHost_setEventTimeout(60000); - - /* Start the first request */ - - // request = Request_new(app); - _LibWWW->Request = HTRequest_new(); - HTRequest_setContext(_LibWWW->Request, this); - - // add supported language header - HTList *langs = HTList_new(); - // set the language code used by the client - HTLanguage_add(langs, options.languageCode.c_str(), 1.0); - HTRequest_setLanguage (_LibWWW->Request, langs, 1); - - // get_document(_LibWWW->Request, _LibWWW->Anchor); - C3WSmartPtr address = HTAnchor_address(_LibWWW->Anchor); - HTRequest_setAnchor(_LibWWW->Request, _LibWWW->Anchor); - if (HTLoad(_LibWWW->Request, NO)) - { - } - else - { - browseError((string("The page cannot be displayed : ")+(const char*)uri).c_str()); - } - } - - } // !isLocal - - _BrowseNextTime = false; - } - - if (_PostNextTime) - { - /* Create a list to hold the form arguments */ - HTAssocList * formfields = HTAssocList_new(); - - // Add text area text - uint i; - - // Ref the form - CForm &form = _Forms[_PostFormId]; - - // Save new url - _URL = form.Action; - - for (i=0; igetGroup ("eb"); - if (group) - { - // Should be a CGroupEditBox - CGroupEditBox *editBox = dynamic_cast(group); - if (editBox) - { - entryData = editBox->getViewText()->getText(); - addEntry = true; - } - } - } - else if (form.Entries[i].Checkbox) - { - // todo handle unicode POST here - if (form.Entries[i].Checkbox->getPushed ()) - { - entryData = ucstring ("on"); - addEntry = true; - } - } - else if (form.Entries[i].ComboBox) - { - CDBGroupComboBox *cb = form.Entries[i].ComboBox; - entryData.fromUtf8(form.Entries[i].SelectValues[cb->getSelection()]); - addEntry = true; - } - // This is a hidden value - else - { - entryData = form.Entries[i].Value; - addEntry = true; - } - - // Add this entry - if (addEntry) - { - // Build a utf8 string - string uft8 = form.Entries[i].Name + "=" + CI18N::encodeUTF8(entryData); - - /* Parse the content and add it to the association list */ - HTParseFormInput(formfields, uft8.c_str()); - } - } - - if (_PostFormSubmitType == "image") - { - // Add the button coordinates - if (_PostFormSubmitButton.find_first_of("[") == string::npos) - { - HTParseFormInput(formfields, (_PostFormSubmitButton + "_x=" + NLMISC::toString(_PostFormSubmitX)).c_str()); - HTParseFormInput(formfields, (_PostFormSubmitButton + "_y=" + NLMISC::toString(_PostFormSubmitY)).c_str()); - } - else - { - HTParseFormInput(formfields, (_PostFormSubmitButton + "=" + NLMISC::toString(_PostFormSubmitX)).c_str()); - HTParseFormInput(formfields, (_PostFormSubmitButton + "=" + NLMISC::toString(_PostFormSubmitY)).c_str()); - } - } - else - HTParseFormInput(formfields, (_PostFormSubmitButton + "=" + _PostFormSubmitValue).c_str()); - - // Add custom params - addHTTPPostParams(formfields, _TrustedDomain); - - // Reset the title - if(_TitlePrefix.empty()) - setTitle (CI18N::get("uiPleaseWait")); - else - setTitle (_TitlePrefix + " - " + CI18N::get("uiPleaseWait")); - - // Stop previous browse - stopBrowse (); - - // Set timeout - nlassert (_ConnectingLock == NULL); - _ConnectingLock = this; - _Connecting = true; - _ConnectingTimeout = ( times.thisFrameMs / 1000.0f ) + _TimeoutValue; - - CButtonFreezer freezer; - this->visit(&freezer); - - // Browsing - _Browsing = true; - updateRefreshButton(); - - // display HTTP query with post parameters - //nlinfo("WEB: POST %s", _URL.c_str()); - - // Init LibWWW - initLibWWW(); - _TrustedDomain = isTrustedDomain(setCurrentDomain(_URL)); - - // Get the final URL - C3WSmartPtr uri = HTParse(_URL.c_str(), NULL, PARSE_ALL); - - // Create an anchor - if ((_LibWWW->Anchor = HTAnchor_findAddress(uri)) == NULL) - { - browseError((string("The page address is malformed : ")+(const char*)uri).c_str()); - } - else - { - /* Add our own request terminate handler. Nb: pass as param a UID, not the ptr */ - /* FIX ME - every connection is appending a new callback to the list, and its never removed (Vinicius Arroyo)*/ - HTNet_addAfter(requestTerminater, NULL, (void*)(size_t)_GroupHtmlUID, HT_ALL, HT_FILTER_LAST); - - /* Start the first request */ - - // request = Request_new(app); - _LibWWW->Request = HTRequest_new(); - HTRequest_setContext(_LibWWW->Request, this); - - /* - ** Dream up a source anchor (an editor can for example use this). - ** After creation we associate the data that we want to post and - ** set some metadata about what the data is. More formats can be found - ** ../src/HTFormat.html - */ - /*HTParentAnchor *src = HTTmpAnchor(NULL); - HTAnchor_setDocument(src, (void*)(data.c_str())); - HTAnchor_setFormat(src, WWW_PLAINTEXT);*/ - - /* - ** If not posting to an HTTP/1.1 server then content length MUST be - ** there. If HTTP/1.1 then it doesn't matter as we just use chunked - ** encoding under the covers - */ - // HTAnchor_setLength(src, data.size()); - - HTParentAnchor *result = HTPostFormAnchor (formfields, _LibWWW->Anchor, _LibWWW->Request); - if (result) - { - } - else - { - browseError((string("The page cannot be displayed : ")+(const char*)uri).c_str()); - } - - /* POST the source to the dest */ - /* - BOOL status = NO; - status = HTPostAnchor(src, _LibWWW->Anchor, _LibWWW->Request); - if (status) - { - } - else - { - browseError((string("The page cannot be displayed : ")+(const char*)uri).c_str()); - }*/ - } - - _PostNextTime = false; - } - } + _BrowseNextTime = false; + _PostNextTime = false; } - #ifndef NL_OS_WINDOWS - if(isBrowsing()) - handleLibwwwEvents(); - #endif } // *************************************************************************** @@ -4149,6 +3762,7 @@ namespace NLGUI // libwww would call requestTerminated() here _Browsing = false; + if (_TitleString.empty()) { setTitle(_TitlePrefix); @@ -4189,20 +3803,7 @@ namespace NLGUI void CGroupHTML::requestTerminated(HTRequest * request ) { - // this callback is being called for every request terminated - if (request == _LibWWW->Request) - { - // set the browser as complete - _Browsing = false; - updateRefreshButton(); - // check that the title is set, or reset it (in the case the page - // does not provide a title) - if (_TitleString.empty()) - { - setTitle(_TitlePrefix); - } - } - } + } // *************************************************************************** diff --git a/code/nel/src/gui/group_html_parser.cpp b/code/nel/src/gui/group_html_parser.cpp index fdb9a549f..19d1efe1a 100644 --- a/code/nel/src/gui/group_html_parser.cpp +++ b/code/nel/src/gui/group_html_parser.cpp @@ -39,8 +39,8 @@ namespace NLGUI { CXMLAutoPtr ptr; // load attributes into libwww structs - BOOL present[MAX_ATTRIBUTES]; - const char *value[MAX_ATTRIBUTES]; + BOOL present[MAX_ATTRIBUTES] = {0}; + const char *value[MAX_ATTRIBUTES] = {NULL}; std::string strvalues[MAX_ATTRIBUTES]; uint nbAttributes = std::min(MAX_ATTRIBUTES, HTML_DTD->tags[element_number].number_of_attributes); @@ -57,11 +57,6 @@ namespace NLGUI value[i] = strvalues[i].c_str(); present[i] = true; } - else - { - value[i] = NULL; - present[i] = false; - } } if (element_number == HTML_A) @@ -110,7 +105,7 @@ namespace NLGUI // find libwww tag for(element_number = 0; element_numbername, (const xmlChar *)HTML_DTD->tags[element_number].name, xmlStrlen(node->name)) == 0) + if (xmlStrncasecmp(node->name, (const xmlChar *)HTML_DTD->tags[element_number].name.c_str(), xmlStrlen(node->name)) == 0) break; } diff --git a/code/nel/src/gui/libwww.cpp b/code/nel/src/gui/libwww.cpp index 09f3a0cea..e5a587f4d 100644 --- a/code/nel/src/gui/libwww.cpp +++ b/code/nel/src/gui/libwww.cpp @@ -18,25 +18,8 @@ #include "nel/gui/group_html.h" -// LibWWW -extern "C" -{ -#include "WWWLib.h" /* Global Library Include file */ -#include "WWWApp.h" -#include "WWWInit.h" -} - -#include "nel/gui/group_html.h" -#include "nel/gui/libwww_nel_stream.h" - using namespace NLMISC; -// The HText structure for libwww -struct _HText -{ - NLGUI::CGroupHTML *Parent; -}; - namespace NLGUI { @@ -213,7 +196,6 @@ namespace NLGUI { 0 } }; - HTAttr p_attr[] = { HTML_ATTR(P,QUICK_HELP_CONDITION), @@ -243,93 +225,6 @@ namespace NLGUI // *************************************************************************** - void _VerifyLibWWW(const char *function, bool ok, const char *file, int line) - { - if (!ok) - nlwarning("%s(%d) : LIBWWW %s returned a bad status", file, line, function); - } - #define VerifyLibWWW(a,b) _VerifyLibWWW(a,(b)!=FALSE,__FILE__,__LINE__) - - // *************************************************************************** - - int NelPrinter (const char * fmt, va_list pArgs) - { - char info[1024]; - int ret; - - ret = vsnprintf(info, sizeof(info), fmt, pArgs); - nlinfo("%s", info); - return ret; - } - - // *************************************************************************** - - int NelTracer (const char * fmt, va_list pArgs) - { - char err[1024]; - int ret; - - ret = vsnprintf(err, sizeof(err), fmt, pArgs); - nlwarning ("%s", err); - return ret; - } - - // *************************************************************************** - - HText * TextNew (HTRequest * request, - HTParentAnchor * /* anchor */, - HTStream * /* output_stream */) - { - HText *text = new HText; - text->Parent = (CGroupHTML *) HTRequest_context(request); - return text; - } - - // *************************************************************************** - - BOOL TextDelete (HText * me) - { - delete me; - return YES; - } - - // *************************************************************************** - - void TextBuild (HText * me, HTextStatus status) - { - // Do the work in the class - if (status == HTEXT_BEGIN) - me->Parent->beginBuild (); - else if (status == HTEXT_END) - me->Parent->endBuild (); - } - - // *************************************************************************** - - void TextAdd (HText * me, const char * buf, int len) - { - // Do the work in the class - me->Parent->addText (buf, len); - } - - // *************************************************************************** - - void TextLink (HText * me, - int element_number, - int attribute_number, - HTChildAnchor * anchor, - const BOOL * present, - const char ** value) - { - // Do the work in the class - if (element_number == HTML_A) - { - me->Parent->addLink (element_number, present, value); - } - } - - // *************************************************************************** - // Read a width HTML parameter. "100" or "100%". Returns true if percent (0 ~ 1) else false bool getPercentage (sint32 &width, float &percent, const char *str) { @@ -386,307 +281,11 @@ namespace NLGUI return dst; } - // *************************************************************************** - - void TextBeginElement (HText *me, int element_number, const BOOL *present, const char **value) - { - // Do the work in the class - me->Parent->beginElement (element_number, present, value); - } - - // *************************************************************************** - - void TextEndElement (HText *me, int element_number) - { - // Do the work in the class - me->Parent->endElement (element_number); - } - - // *************************************************************************** - void TextBeginUnparsedElement(HText *me, const char *buffer, int length) - { - me->Parent->beginUnparsedElement(buffer, length); - } - - // *************************************************************************** - void TextEndUnparsedElement(HText *me, const char *buffer, int length) - { - me->Parent->endUnparsedElement(buffer, length); - } - - // *************************************************************************** - void TextUnparsedEntity (HText * /* HText */, const char *buffer, int length) - { - std::string str(buffer, buffer+length); - nlinfo("Unparsed entity '%s'", str.c_str()); - } - - // *************************************************************************** - int requestTerminater (HTRequest * request, HTResponse * /* response */, - void * param, int /* status */) - { - /* - Yoyo and Boris: we had to make the request terminate by UID and not by pointer (param is an uid). - Because this method was called at mainLoop time, but for GroupHTML created/deleted at login time !!! - => Memory Crash. - */ - - // TestYoyo - //nlinfo("** requestTerminater(): uid%d", (uint32)param); - - // the parameter is actually an uint32 - if (param != 0) - { - CGroupHTML::TGroupHtmlByUIDMap::iterator it= CGroupHTML::_GroupHtmlByUID.find((uint32)(size_t)param); - if(it!=CGroupHTML::_GroupHtmlByUID.end()) - { - // get the pointer. NB: the refptr should not be NULL - // since object removed from map when deleted - CGroupHTML *gh = it->second; - nlassert(gh); - - // callback the browser - gh->requestTerminated(request); - } - } - return HT_OK; - } - - - // callback called when receiving a cookie - BOOL receiveCookie (HTRequest * /* request */, HTCookie * cookie, void * /* param */) - { - if (strcmp(HTCookie_name(cookie), "ryzomId") == 0) - { - // we receive the ryzom id cookie, store it - CurrentCookie = HTCookie_value(cookie); - } - else - { - // store the id/value cookie - HTTPCookies[HTTPCurrentDomain][HTCookie_name(cookie)] = HTCookie_value(cookie); - // nlwarning("get cookie for domain %s %s=%s", HTTPCurrentDomain.c_str(), HTCookie_name(cookie), HTCookie_value(cookie)); - } - - return YES; - } - - // callback called to add cookie to a request before sending it to the server - HTAssocList *sendCookie (HTRequest * /* request */, void * /* param */) - { - HTAssocList * alist = 0; - if (!CurrentCookie.empty()) - { - if(alist == 0) alist = HTAssocList_new(); /* Is deleted by the cookie module */ - HTAssocList_addObject(alist, "ryzomId", CurrentCookie.c_str()); - } - - if(!HTTPCookies[HTTPCurrentDomain].empty()) - { - if(alist == 0) alist = HTAssocList_new(); - for(std::map::iterator it = HTTPCookies[HTTPCurrentDomain].begin(); it != HTTPCookies[HTTPCurrentDomain].end(); it++) - { - HTAssocList_addObject(alist, it->first.c_str(), it->second.c_str()); - // nlwarning("set cookie for domain '%s' %s=%s", HTTPCurrentDomain.c_str(), it->first.c_str(), it->second.c_str()); - } - } - return alist; - } - - - // *************************************************************************** - - HTAnchor * TextFindAnchor (HText * /* me */, int /* index */) - { - return NULL; - } - - int HTMIME_location_custom (HTRequest * request, HTResponse * response, char * token, char * value) - { - char * location = HTStrip(value); - - std::string finalLocation; - - //nlinfo("redirect to '%s' '%s'", value, location); - - // If not absolute URI (Error) then find the base - if (!HTURL_isAbsolute(location)) - { - char * base = HTAnchor_address((HTAnchor *) HTRequest_anchor(request)); - location = HTParse(location, base, PARSE_ALL); - //redirection = HTAnchor_findAddress(location); - finalLocation = location; - HT_FREE(base); - HT_FREE(location); - } - else - { - finalLocation = location; - } - //nlinfo("final location '%s'", finalLocation.c_str()); - - CGroupHTML *gh = (CGroupHTML *) HTRequest_context(request); - - gh->setURL(finalLocation); - - return HT_OK; - } - - - // *************************************************************************** - - const std::string &setCurrentDomain(const std::string &url) - { - if(url.find("http://") == 0) - { - HTTPCurrentDomain = url.substr(7, url.find('/', 7)-7); - // nlinfo("****cd: %s", HTTPCurrentDomain.c_str()); - } - else - { - HTTPCurrentDomain.clear(); - // nlinfo("****cd: clear the domain"); - } - return HTTPCurrentDomain; - } - - void initLibWWW() { static bool initialized = false; if (!initialized) { - //HTProfile_newNoCacheClient("Ryzom", "1.1"); - - /* Need our own trace and print functions */ - HTPrint_setCallback(NelPrinter); - HTTrace_setCallback(NelTracer); - - /* Initiate libwww */ - HTLib_setAppName( CGroupHTML::options.appName.c_str() ); - HTLib_setAppVersion( CGroupHTML::options.appVersion.c_str() ); - - /* Set up TCP as transport */ - VerifyLibWWW("HTTransport_add", HTTransport_add("buffered_tcp", HT_TP_SINGLE, HTReader_new, HTBufferWriter_new)); - VerifyLibWWW("HTTransport_add", HTTransport_add("local", HT_TP_SINGLE, HTNeLReader_new, HTWriter_new)); - // VerifyLibWWW("HTTransport_add", HTTransport_add("local", HT_TP_SINGLE, HTANSIReader_new, HTWriter_new)); - // VerifyLibWWW("HTTransport_add", HTTransport_add("local", HT_TP_SINGLE, HTReader_new, HTWriter_new)); - - /* Set up HTTP as protocol */ - VerifyLibWWW("HTProtocol_add", HTProtocol_add("http", "buffered_tcp", 80, NO, HTLoadHTTP, NULL)); - VerifyLibWWW("HTProtocol_add", HTProtocol_add("file", "local", 0, YES, HTLoadNeLFile, NULL)); - //VerifyLibWWW("HTProtocol_add", HTProtocol_add("file", "local", 0, YES, HTLoadFile, NULL)); - // HTProtocol_add("cache", "local", 0, NO, HTLoadCache, NULL); - - HTBind_init(); - // HTCacheInit(NULL, 20); - - /* Setup up transfer coders */ - HTFormat_addTransferCoding((char*)"chunked", HTChunkedEncoder, HTChunkedDecoder, 1.0); - - /* Setup MIME stream converters */ - HTFormat_addConversion("message/rfc822", "*/*", HTMIMEConvert, 1.0, 0.0, 0.0); - HTFormat_addConversion("message/x-rfc822-foot", "*/*", HTMIMEFooter, 1.0, 0.0, 0.0); - HTFormat_addConversion("message/x-rfc822-head", "*/*", HTMIMEHeader, 1.0, 0.0, 0.0); - HTFormat_addConversion("message/x-rfc822-cont", "*/*", HTMIMEContinue, 1.0, 0.0, 0.0); - HTFormat_addConversion("message/x-rfc822-partial","*/*", HTMIMEPartial, 1.0, 0.0, 0.0); - HTFormat_addConversion("multipart/*", "*/*", HTBoundary, 1.0, 0.0, 0.0); - - /* Setup HTTP protocol stream */ - HTFormat_addConversion("text/x-http", "*/*", HTTPStatus_new, 1.0, 0.0, 0.0); - - /* Setup the HTML parser */ - HTFormat_addConversion("text/html", "www/present", HTMLPresent, 1.0, 0.0, 0.0); - - /* Setup black hole stream */ - HTFormat_addConversion("*/*", "www/debug", HTBlackHoleConverter, 1.0, 0.0, 0.0); - HTFormat_addConversion("*/*", "www/present", HTBlackHoleConverter, 0.3, 0.0, 0.0); - - /* Set max number of sockets we want open simultaneously */ - HTNet_setMaxSocket(32); - - /* Register our HTML parser callbacks */ - VerifyLibWWW("HText_registerCDCallback", HText_registerCDCallback (TextNew, TextDelete)); - VerifyLibWWW("HText_registerBuildCallback", HText_registerBuildCallback (TextBuild)); - VerifyLibWWW("HText_registerTextCallback", HText_registerTextCallback(TextAdd)); - VerifyLibWWW("HText_registerLinkCallback", HText_registerLinkCallback (TextLink)); - VerifyLibWWW("HText_registerElementCallback", HText_registerElementCallback (TextBeginElement, TextEndElement)); - VerifyLibWWW("HText_registerUnparsedElementCallback", HText_registerUnparsedElementCallback(TextBeginUnparsedElement, TextEndUnparsedElement)); - VerifyLibWWW("HText_registerUnparsedEntityCallback ", HText_registerUnparsedEntityCallback (TextUnparsedEntity )); - - - /* Register the default set of MIME header parsers */ - struct { - const char * string; - HTParserCallback * pHandler; - } fixedHandlers[] = { - {"accept", &HTMIME_accept}, - {"accept-charset", &HTMIME_acceptCharset}, - {"accept-encoding", &HTMIME_acceptEncoding}, - {"accept-language", &HTMIME_acceptLanguage}, - {"accept-ranges", &HTMIME_acceptRanges}, - {"authorization", NULL}, - {"cache-control", &HTMIME_cacheControl}, - {"connection", &HTMIME_connection}, - {"content-encoding", &HTMIME_contentEncoding}, - {"content-length", &HTMIME_contentLength}, - {"content-range", &HTMIME_contentRange}, - {"content-transfer-encoding", &HTMIME_contentTransferEncoding}, - {"content-type", &HTMIME_contentType}, - {"digest-MessageDigest", &HTMIME_messageDigest}, - {"keep-alive", &HTMIME_keepAlive}, - {"link", &HTMIME_link}, - {"location", &HTMIME_location_custom}, - {"max-forwards", &HTMIME_maxForwards}, - {"mime-version", NULL}, - {"pragma", &HTMIME_pragma}, - {"protocol", &HTMIME_protocol}, - {"protocol-info", &HTMIME_protocolInfo}, - {"protocol-request", &HTMIME_protocolRequest}, - {"proxy-authenticate", &HTMIME_authenticate}, - {"proxy-authorization", &HTMIME_proxyAuthorization}, - {"public", &HTMIME_public}, - {"range", &HTMIME_range}, - {"referer", &HTMIME_referer}, - {"retry-after", &HTMIME_retryAfter}, - {"server", &HTMIME_server}, - {"trailer", &HTMIME_trailer}, - {"transfer-encoding", &HTMIME_transferEncoding}, - {"upgrade", &HTMIME_upgrade}, - {"user-agent", &HTMIME_userAgent}, - {"vary", &HTMIME_vary}, - {"via", &HTMIME_via}, - {"warning", &HTMIME_warning}, - {"www-authenticate", &HTMIME_authenticate}, - {"authentication-info", &HTMIME_authenticationInfo}, - {"proxy-authentication-info", &HTMIME_proxyAuthenticationInfo} - }; - - for (uint i = 0; i < sizeof(fixedHandlers)/sizeof(fixedHandlers[0]); i++) - HTHeader_addParser(fixedHandlers[i].string, NO, fixedHandlers[i].pHandler); - - /* Set up default event loop */ - HTEventInit(); - - /* Add our own request terminate handler */ - HTNet_addAfter(requestTerminater, NULL, 0, HT_ALL, HT_FILTER_LAST); - - /* Setup cookies */ - HTCookie_init(); - HTCookie_setCookieMode(HTCookieMode(HT_COOKIE_ACCEPT | HT_COOKIE_SEND)); - HTCookie_setCallbacks(receiveCookie, NULL, sendCookie, NULL); - - /* Start the first request */ - - /* Go into the event loop... */ - // HTEventList_newLoop(); - - // App_delete(app); - - HTBind_add("htm", "text/html", NULL, "8bit", NULL, 1.0); /* HTML */ - HTBind_add("html", "text/html", NULL, "8bit", NULL, 1.0); /* HTML */ - - HTBind_caseSensitive(NO); // Change the HTML DTD SGML_dtd *HTML_DTD = HTML_dtd (); @@ -713,16 +312,6 @@ namespace NLGUI HTML_DTD->tags[HTML_SPAN].attributes = span_attr; HTML_DTD->tags[HTML_SPAN].number_of_attributes = sizeof(span_attr) / sizeof(HTAttr) - 1; - // Set a request timeout - // HTHost_setEventTimeout (30000); - // HTHost_setActiveTimeout (30000); - // HTHost_setPersistTimeout (30000); - - // libwww default value is 2000ms for POST/PUT requests on the first and 3000 on the second, smallest allowed value is 21ms - // too small values may create timeout problems but we want it low as possible - // second value is the timeout for the second try to we set that high - HTTP_setBodyWriteDelay(250, 3000); - // Initialized initialized = true; } diff --git a/code/nel/src/gui/libwww_nel_stream.cpp b/code/nel/src/gui/libwww_nel_stream.cpp deleted file mode 100644 index b7e218b30..000000000 --- a/code/nel/src/gui/libwww_nel_stream.cpp +++ /dev/null @@ -1,633 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#include "stdpch.h" -#include - -extern "C" -{ - -/* Library Includes */ -#include "wwwsys.h" -#include "WWWUtil.h" -#include "WWWCore.h" -#include "WWWDir.h" -#include "WWWTrans.h" -#include "HTReqMan.h" -#include "HTBind.h" -#include "HTMulti.h" -#include "HTNetMan.h" -#include "HTChannl.h" -#include "nel/gui/libwww_nel_stream.h" /* Implemented here */ -} - -using namespace std; -using namespace NLMISC; - -extern "C" -{ - -/* Final states have negative value */ -typedef enum _FileState -{ - FS_RETRY = -4, - FS_ERROR = -3, - FS_NO_DATA = -2, - FS_GOT_DATA = -1, - FS_BEGIN = 0, - FS_PENDING, - FS_DO_CN, - FS_NEED_OPEN_FILE, - FS_NEED_BODY, - FS_PARSE_DIR, - FS_TRY_FTP -} FileState; - -/* This is the context structure for the this module */ -typedef struct _file_info -{ - FileState state; /* Current state of the connection */ - char * local; /* Local representation of file name */ - struct stat stat_info; /* Contains actual file chosen */ - HTNet * net; - HTTimer * timer; -} file_info; - -struct _HTStream -{ - const HTStreamClass * isa; -}; - -struct _HTInputStream -{ - const HTInputStreamClass * isa; - HTChannel * ch; - HTHost * host; - char * write; /* Last byte written */ - char * read; /* Last byte read */ - int b_read; - char data [INPUT_BUFFER_SIZE]; /* buffer */ -}; - -PRIVATE int FileCleanup (HTRequest *req, int status) -{ - HTNet * net = HTRequest_net(req); - file_info * file = (file_info *) HTNet_context(net); - HTStream * input = HTRequest_inputStream(req); - - /* Free stream with data TO Local file system */ - if (input) - { - if (status == HT_INTERRUPTED) - (*input->isa->abort)(input, NULL); - else - (*input->isa->_free)(input); - HTRequest_setInputStream(req, NULL); - } - - /* - ** Remove if we have registered a timer function as a callback - */ - if (file->timer) - { - HTTimer_delete(file->timer); - file->timer = NULL; - } - - if (file) - { - HT_FREE(file->local); - HT_FREE(file); - } - - HTNet_delete(net, status); - return YES; -} - - -PRIVATE int FileEvent (SOCKET soc, void * pVoid, HTEventType type); - -PUBLIC int HTLoadNeLFile (SOCKET soc, HTRequest * request) -{ - file_info *file; /* Specific access information */ - HTNet * net = HTRequest_net(request); - HTParentAnchor * anchor = HTRequest_anchor(request); - - HTTRACE(PROT_TRACE, "HTLoadFile.. Looking for `%s\'\n" _ HTAnchor_physical(anchor)); - if ((file = (file_info *) HT_CALLOC(1, sizeof(file_info))) == NULL) HT_OUTOFMEM("HTLoadFILE"); - file->state = FS_BEGIN; - file->net = net; - HTNet_setContext(net, file); - HTNet_setEventCallback(net, FileEvent); - HTNet_setEventParam(net, file); /* callbacks get http* */ - - return FileEvent(soc, file, HTEvent_BEGIN); /* get it started - ops is ignored */ -} - -PRIVATE int ReturnEvent (HTTimer * timer, void * param, HTEventType /* type */) -{ - file_info * file = (file_info *) param; - if (timer != file->timer) HTDEBUGBREAK("File timer %p not in sync\n" _ timer); - - HTTRACE(PROT_TRACE, "HTLoadFile.. Continuing %p with timer %p\n" _ file _ timer); - - /* - ** Delete the timer - */ - HTTimer_delete(file->timer); - file->timer = NULL; - - /* - ** Now call the event again - */ - return FileEvent(INVSOC, file, HTEvent_READ); -} - -PUBLIC int HTNeLFileOpen (HTNet * net, char * local, HTLocalMode /* mode */) -{ - HTRequest * request = HTNet_request(net); - HTHost * host = HTNet_host(net); - CIFile* fp = new CIFile; - - if (!fp->open (local)) - { - HTRequest_addSystemError(request, ERR_FATAL, errno, NO, "CIFile::open"); - return HT_ERROR; - } - - HTHost_setChannel(host, HTChannel_new(INVSOC, (FILE*)fp, YES)); - - HTHost_getInput(host, HTNet_transport(net), NULL, 0); - HTHost_getOutput(host, HTNet_transport(net), NULL, 0); - return HT_OK; -} - -PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type) -{ - file_info *file = (file_info *)pVoid; /* Specific access information */ - int status = HT_ERROR; - HTNet * net = file->net; - HTRequest * request = HTNet_request(net); - HTParentAnchor * anchor = HTRequest_anchor(request); - - if (type == HTEvent_CLOSE) - { - /* Interrupted */ - HTRequest_addError(request, ERR_FATAL, NO, HTERR_INTERRUPTED, - NULL, 0, "HTLoadFile"); - FileCleanup(request, HT_INTERRUPTED); - return HT_OK; - } - - - /* Now jump into the machine. We know the state from the previous run */ - for(;;) - { - switch (file->state) - { - case FS_BEGIN: - - /* We only support safe (GET, HEAD, etc) methods for the moment */ - if (!HTMethod_isSafe(HTRequest_method(request))) { - HTRequest_addError(request, ERR_FATAL, NO, HTERR_NOT_ALLOWED, - NULL, 0, "HTLoadFile"); - file->state = FS_ERROR; - break; - } - - /* Check whether we have access to local disk at all */ - if (HTLib_secure()) - { - HTTRACE(PROT_TRACE, "LoadFile.... No access to local file system\n"); - file->state = FS_TRY_FTP; - break; - } - - /*file->local = HTWWWToLocal(HTAnchor_physical(anchor), "", - HTRequest_userProfile(request));*/ - { - string tmp = HTAnchor_physical(anchor); - if (strlwr(tmp).find("file:/") == 0) - { - tmp = tmp.substr(6, tmp.size()-6); - } - StrAllocCopy(file->local, tmp.c_str()); - } - - if (!file->local) - { - file->state = FS_TRY_FTP; - break; - } - - /* Create a new host object and link it to the net object */ - { - HTHost * host = NULL; - if ((host = HTHost_new("localhost", 0)) == NULL) return HT_ERROR; - HTNet_setHost(net, host); - if (HTHost_addNet(host, net) == HT_PENDING) - { - HTTRACE(PROT_TRACE, "HTLoadFile.. Pending...\n"); - /* move to the hack state */ - file->state = FS_PENDING; - return HT_OK; - } - } - file->state = FS_DO_CN; - break; - - case FS_PENDING: - { - HTHost * host = NULL; - if ((host = HTHost_new((char*)"localhost", 0)) == NULL) return HT_ERROR; - HTNet_setHost(net, host); - if (HTHost_addNet(host, net) == HT_PENDING) - { - HTTRACE(PROT_TRACE, "HTLoadFile.. Pending...\n"); - file->state = FS_PENDING; - return HT_OK; - } - } - file->state = FS_DO_CN; - break; - - case FS_DO_CN: - if (HTRequest_negotiation(request) && - HTMethod_isSafe(HTRequest_method(request))) - { - HTAnchor_setPhysical(anchor, file->local); - HTTRACE(PROT_TRACE, "Load File... Found `%s\'\n" _ file->local); - } - else - { - if (HT_STAT(file->local, &file->stat_info) == -1) - { - HTTRACE(PROT_TRACE, "Load File... Not found `%s\'\n" _ file->local); - HTRequest_addError(request, ERR_FATAL, NO, HTERR_NOT_FOUND, NULL, 0, "HTLoadFile"); - file->state = FS_ERROR; - break; - } - } - - if (((file->stat_info.st_mode) & S_IFMT) == S_IFDIR) - { - if (HTRequest_method(request) == METHOD_GET) - { - file->state = FS_PARSE_DIR; - } - else - { - HTRequest_addError(request, ERR_INFO, NO, HTERR_NO_CONTENT, NULL, 0, "HTLoadFile"); - file->state = FS_NO_DATA; - } - break; - } - - { - BOOL editable = FALSE; - HTBind_getAnchorBindings(anchor); - if (editable) HTAnchor_appendAllow(anchor, METHOD_PUT); - - /* Set the file size */ - CIFile nelFile; - if (nelFile.open (file->local)) - { - file->stat_info.st_size = nelFile.getFileSize(); - } - nelFile.close(); - - if (file->stat_info.st_size) - HTAnchor_setLength(anchor, file->stat_info.st_size); - - /* Set the file last modified time stamp */ - if (file->stat_info.st_mtime > 0) - HTAnchor_setLastModified(anchor, file->stat_info.st_mtime); - - /* Check to see if we can edit it */ - if (!editable && !file->stat_info.st_size) - { - HTRequest_addError(request, ERR_INFO, NO, HTERR_NO_CONTENT, NULL, 0, "HTLoadFile"); - file->state = FS_NO_DATA; - } - else - { - file->state = (HTRequest_method(request)==METHOD_GET) ? FS_NEED_OPEN_FILE : FS_GOT_DATA; - } - } - break; - - case FS_NEED_OPEN_FILE: - status = HTNeLFileOpen(net, file->local, HT_FB_RDONLY); - if (status == HT_OK) - { - { - HTStream * rstream = HTStreamStack(HTAnchor_format(anchor), - HTRequest_outputFormat(request), - HTRequest_outputStream(request), - request, YES); - HTNet_setReadStream(net, rstream); - HTRequest_setOutputConnected(request, YES); - } - - { - HTOutputStream * output = HTNet_getOutput(net, NULL, 0); - HTRequest_setInputStream(request, (HTStream *) output); - } - - if (HTRequest_isSource(request) && !HTRequest_destinationsReady(request)) return HT_OK; - - HTRequest_addError(request, ERR_INFO, NO, HTERR_OK, NULL, 0, "HTLoadFile"); - file->state = FS_NEED_BODY; - - if (HTEvent_isCallbacksRegistered()) - { - if (!HTRequest_preemptive(request)) - { - if (!HTNet_preemptive(net)) - { - HTTRACE(PROT_TRACE, "HTLoadFile.. Returning\n"); - HTHost_register(HTNet_host(net), net, HTEvent_READ); - } - else if (!file->timer) - { - HTTRACE(PROT_TRACE, "HTLoadFile.. Returning\n"); - file->timer = HTTimer_new(NULL, ReturnEvent, file, 1, YES, NO); - } - return HT_OK; - } - } - } - else if (status == HT_WOULD_BLOCK || status == HT_PENDING) - { - return HT_OK; - } - else - { - HTRequest_addError(request, ERR_INFO, NO, HTERR_INTERNAL, NULL, 0, "HTLoadFile"); - file->state = FS_ERROR; /* Error or interrupt */ - } - break; - - case FS_NEED_BODY: - status = HTHost_read(HTNet_host(net), net); - if (status == HT_WOULD_BLOCK) - { - return HT_OK; - } - else if (status == HT_LOADED || status == HT_CLOSED) - { - file->state = FS_GOT_DATA; - } - else - { - HTRequest_addError(request, ERR_INFO, NO, HTERR_FORBIDDEN, NULL, 0, "HTLoadFile"); - file->state = FS_ERROR; - } - break; - - case FS_TRY_FTP: - { - char *url = HTAnchor_physical(anchor); - HTAnchor *anchor; - char *newname = NULL; - StrAllocCopy(newname, "ftp:"); - if (!strncmp(url, "file:", 5)) - { - StrAllocCat(newname, url+5); - } - else - { - StrAllocCat(newname, url); - } - anchor = HTAnchor_findAddress(newname); - HTRequest_setAnchor(request, anchor); - HT_FREE(newname); - FileCleanup(request, HT_IGNORE); - return HTLoad(request, YES); - } - break; - - case FS_GOT_DATA: - FileCleanup(request, HT_LOADED); - return HT_OK; - break; - - case FS_NO_DATA: - FileCleanup(request, HT_NO_DATA); - return HT_OK; - break; - - case FS_RETRY: - FileCleanup(request, HT_RETRY); - return HT_OK; - break; - - case FS_ERROR: - FileCleanup(request, HT_ERROR); - return HT_OK; - break; - - default: - break; - } - } /* End of while(1) */ -} - -// ************************************************************************* -// HTNeLReader -// ************************************************************************* - -size_t nel_fread (void *buffer, uint size, FILE *fp) -{ - CIFile *file = (CIFile *)fp; - int toRead = std::min ((int)(file->getFileSize () - file->getPos ()), (int)size); - file->serialBuffer((uint8*)buffer, toRead); - return toRead; -} - -PRIVATE int HTNeLReader_read (HTInputStream * me) -{ - FILE * fp = HTChannel_file(me->ch); - HTNet * net = HTHost_getReadNet(me->host); - int status; - - /* Read the file desriptor */ - while (fp) - { - if ((me->b_read = (int)nel_fread(me->data, FILE_BUFFER_SIZE, fp)) == 0) - { - HTAlertCallback *cbf = HTAlert_find(HT_PROG_DONE); - // HTTRACE(PROT_TRACE, "ANSI read... Finished loading file %p\n" _ fp); - if (cbf) - (*cbf)(net->request, HT_PROG_DONE, HT_MSG_NULL,NULL,NULL,NULL); - return HT_CLOSED; - } - - /* Remember how much we have read from the input socket */ - HTTRACEDATA(me->data, me->b_read, "HTANSIReader_read me->data:"); - me->write = me->data; - me->read = me->data + me->b_read; - - { - HTAlertCallback * cbf = HTAlert_find(HT_PROG_READ); - HTNet_addBytesRead(net, me->b_read); - if (cbf) - { - int tr = HTNet_bytesRead(net); - (*cbf)(net->request, HT_PROG_READ, HT_MSG_NULL, NULL, &tr, NULL); - } - } - - if (!net->readStream) - return HT_ERROR; - - /* Now push the data down the stream */ - if ((status = (*net->readStream->isa->put_block) - (net->readStream, me->data, me->b_read)) != HT_OK) - { - if (status == HT_WOULD_BLOCK) - { - HTTRACE(PROT_TRACE, "ANSI read... Target WOULD BLOCK\n"); - return HT_WOULD_BLOCK; - } - else if (status == HT_PAUSE) - { - HTTRACE(PROT_TRACE, "ANSI read... Target PAUSED\n"); - return HT_PAUSE; - } - else if (status > 0) - { - /* Stream specific return code */ - HTTRACE(PROT_TRACE, "ANSI read... Target returns %d\n" _ status); - me->write = me->data + me->b_read; - return status; - } - else - { - /* We have a real error */ - HTTRACE(PROT_TRACE, "ANSI read... Target ERROR\n"); - return status; - } - } - me->write = me->data + me->b_read; - } - HTTRACE(PROT_TRACE, "ANSI read... File descriptor is NULL...\n"); - return HT_ERROR; -} - -PRIVATE int HTNeLReader_close (HTInputStream * me) -{ - CIFile *file = (CIFile *)HTChannel_file(me->ch); - if (file) - { - file->close(); - } - - int status = HT_OK; - HTNet * net = HTHost_getReadNet(me->host); - - - if (net && net->readStream) - { - if ((status = (*net->readStream->isa->_free)(net->readStream))==HT_WOULD_BLOCK) return HT_WOULD_BLOCK; - net->readStream = NULL; - } - - HTTRACE(STREAM_TRACE, "Socket read. FREEING....\n"); - HT_FREE(me); - - return status; -} - -PUBLIC int HTNeLReader_consumed (HTInputStream * me, size_t bytes) -{ - me->write += bytes; - me->b_read -= (int)bytes; - HTHost_setRemainingRead(me->host, me->b_read); - return HT_OK; -} - -PRIVATE int HTNeLReader_flush (HTInputStream * me) -{ - HTNet * net = HTHost_getReadNet(me->host); - return net && net->readStream ? (*net->readStream->isa->flush)(net->readStream) : HT_OK; -} - -PRIVATE int HTNeLReader_free (HTInputStream * me) -{ - CIFile *file = (CIFile *)HTChannel_file(me->ch); - if (file) - { - delete file; - HTChannel_setFile (me->ch, NULL); - } - - HTNet * net = HTHost_getReadNet(me->host); - if (net && net->readStream) - { - int status = (*net->readStream->isa->_free)(net->readStream); - if (status == HT_OK) net->readStream = NULL; - return status; - } - return HT_OK; -} - -PRIVATE int HTNeLReader_abort (HTInputStream * me, HTList * /* e */) -{ - HTNet * net = HTHost_getReadNet(me->host); - if (net && net->readStream) - { - int status = (*net->readStream->isa->abort)(net->readStream, NULL); - if (status != HT_IGNORE) net->readStream = NULL; - } - return HT_ERROR; -} - -PRIVATE const HTInputStreamClass HTNeLReader = -{ - "SocketReader", - HTNeLReader_flush, - HTNeLReader_free, - HTNeLReader_abort, - HTNeLReader_read, - HTNeLReader_close, - HTNeLReader_consumed -}; - -PUBLIC HTInputStream * HTNeLReader_new (HTHost * host, HTChannel * ch, void * /* param */, int /* mode */) -{ - if (host && ch) - { - HTInputStream * me = HTChannel_input(ch); - if (me == NULL) - { - if ((me=(HTInputStream *) HT_CALLOC(1, sizeof(HTInputStream))) == NULL) HT_OUTOFMEM("HTNeLReader_new"); - me->isa = &HTNeLReader; - me->ch = ch; - me->host = host; - HTTRACE(STREAM_TRACE, "Reader...... Created reader stream %p\n" _ me); - } - return me; - } - return NULL; -} - -//PUBLIC unsigned int WWW_TraceFlag = 0; - -} // extern "C" - - diff --git a/code/nel/src/gui/libwww_types.cpp b/code/nel/src/gui/libwww_types.cpp new file mode 100644 index 000000000..31e05f456 --- /dev/null +++ b/code/nel/src/gui/libwww_types.cpp @@ -0,0 +1,797 @@ +/** + libwww Copyright Notice + [This notice should be placed within redistributed or derivative software + code when appropriate. This particular formulation of W3C's notice for + inclusion in libwww code became active on August 14 1998.] + + LIBWWW COPYRIGHT NOTICE + + libwww: W3C's implementation of HTTP can be found at: + http://www.w3.org/Library/ + + Copyright ¨ 1995-2002 World Wide Web Consortium, + (Massachusetts Institute of Technology, Institut + National de Recherche en Informatique et en + Automatique, Keio University). All Rights Reserved. + This program is distributed under the W3C's + Intellectual Property License. This program is + distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A + PARTICULAR PURPOSE. See W3C License + http://www.w3.org/Consortium/Legal/ for more details. + + Copyright ¨ 1995 CERN. "This product includes computer + software created and made available by CERN. This + acknowledgment shall be mentioned in full in any + product which includes the CERN computer software + included herein or parts thereof." + + ****************************************************************************/ + +#include "nel/gui/libwww_types.h" + +namespace NLGUI +{ + +/* + ** ATTRIBUTE DEFINITION MACROS (see HTMLPDTD.h) + */ + +/* + * redefine the macros, so that the "stringized" attribute name + * is generated + */ + +#undef HTML_ATTR +#define HTML_ATTR(t,a) { (char *) #a } +#undef HTML_ATTRIBUTES +#define HTML_ATTRIBUTES(t) { 0 } + +/* + ** ATTRIBUTE LISTS + */ + +static HTAttr no_attr[1] = { + { 0 } +}; + +static HTAttr body_attr[HTML_BODY_ATTRIBUTES+1] = { /* to catch images */ + HTML_ATTR(BODY,ALINK), + HTML_ATTR(BODY,BACKGROUND), + HTML_ATTR(BODY,BGCOLOR), + HTML_ATTR(BODY,CLASS), + HTML_ATTR(BODY,DIR), + HTML_ATTR(BODY,ID), + HTML_ATTR(BODY,LANG), + HTML_ATTR(BODY,LINK), + HTML_ATTR(BODY,STYLE), + HTML_ATTR(BODY,TEXT), + HTML_ATTR(BODY,TITLE), + HTML_ATTR(BODY,VLINK), + HTML_ATTRIBUTES(BODY) +}; + +static HTAttr frame_attr[HTML_FRAME_ATTRIBUTES+1] = { /* frame attributes */ + HTML_ATTR(FRAME,CLASS), + HTML_ATTR(FRAME,FRAMEBORDER), + HTML_ATTR(FRAME,ID), + HTML_ATTR(FRAME,NAME), + HTML_ATTR(FRAME,MARGINHEIGHT), + HTML_ATTR(FRAME,MARGINWIDTH), + HTML_ATTR(FRAME,NORESIZE), + HTML_ATTR(FRAME,LONGDESC), + HTML_ATTR(FRAME,SCROLLING), + HTML_ATTR(FRAME,SRC), + HTML_ATTR(FRAME,STYLE), + HTML_ATTR(FRAME,TARGET), + HTML_ATTR(FRAME,TITLE), + HTML_ATTRIBUTES(FRAME) +}; + +static HTAttr frameset_attr[HTML_FRAMESET_ATTRIBUTES+1] = { /* frameset attributes */ + HTML_ATTR(FRAMESET,CLASS), + HTML_ATTR(FRAMESET,COLS), + HTML_ATTR(FRAMESET,ID), + HTML_ATTR(FRAMESET,ROWS), + HTML_ATTR(FRAMESET,STYLE), + HTML_ATTR(FRAMESET,TITLE), + HTML_ATTRIBUTES(FRAMESET) +}; + +static HTAttr a_attr[HTML_A_ATTRIBUTES+1] = { /* Anchor attributes */ + HTML_ATTR(A,ACCESSKEY), + HTML_ATTR(A,CHARSET), + HTML_ATTR(A,CLASS), + HTML_ATTR(A,COORDS), + HTML_ATTR(A,DIR), + HTML_ATTR(A,HREF), + HTML_ATTR(A,HREFLANG), + HTML_ATTR(A,ID), + HTML_ATTR(A,NAME), + HTML_ATTR(A,REL), + HTML_ATTR(A,REV), + HTML_ATTR(A,SHAPE), + HTML_ATTR(A,STYLE), + HTML_ATTR(A,TABINDEX), + HTML_ATTR(A,TARGET), + HTML_ATTR(A,TYPE), + HTML_ATTR(A,TITLE), + HTML_ATTRIBUTES(A) +}; + +static HTAttr applet_attr[HTML_APPLET_ATTRIBUTES+1] = { + HTML_ATTR(APPLET,ALIGN), + HTML_ATTR(APPLET,ALT), + HTML_ATTR(APPLET,ARCHIVE), + HTML_ATTR(APPLET,CLASS), + HTML_ATTR(APPLET,CODE), + HTML_ATTR(APPLET,CODEBASE), + HTML_ATTR(APPLET,HEIGHT), + HTML_ATTR(APPLET,HSPACE), + HTML_ATTR(APPLET,ID), + HTML_ATTR(APPLET,NAME), + HTML_ATTR(APPLET,OBJECT), + HTML_ATTR(APPLET,STYLE), + HTML_ATTR(APPLET,TITLE), + HTML_ATTR(APPLET,VSPACE), + HTML_ATTR(APPLET,WIDTH), + HTML_ATTRIBUTES(APPLET) +}; + +static HTAttr area_attr[HTML_AREA_ATTRIBUTES+1] = { /* Area attributes */ + HTML_ATTR(AREA,ACCESSKEY), + HTML_ATTR(AREA,ALT), + HTML_ATTR(AREA,CLASS), + HTML_ATTR(AREA,COORDS), + HTML_ATTR(AREA,DIR), + HTML_ATTR(AREA,HREF), + HTML_ATTR(AREA,ID), + HTML_ATTR(AREA,NAME), + HTML_ATTR(AREA,NOHREF), + HTML_ATTR(AREA,LANG), + HTML_ATTR(AREA,SHAPE), + HTML_ATTR(AREA,STYLE), + HTML_ATTR(AREA,TABINDEX), + HTML_ATTR(AREA,TARGET), + HTML_ATTR(AREA,TITLE), + HTML_ATTRIBUTES(AREA) +}; + +static HTAttr base_attr[HTML_BASE_ATTRIBUTES+1] = { /* BASE attributes */ + HTML_ATTR(BASE,HREF), + HTML_ATTR(BASE,TARGET), + HTML_ATTRIBUTES(BASE) +}; + +static HTAttr bdo_attr[HTML_BDO_ATTRIBUTES+1] = { + HTML_ATTR(BDO,CLASS), + HTML_ATTR(BDO,DIR), + HTML_ATTR(BDO,ID), + HTML_ATTR(BDO,LANG), + HTML_ATTR(BDO,STYLE), + HTML_ATTR(BDO,TITLE), + HTML_ATTRIBUTES(BDO) +}; + +static HTAttr bq_attr[HTML_BQ_ATTRIBUTES+1] = { + HTML_ATTR(BQ,CITE), + HTML_ATTR(BQ,CLASS), + HTML_ATTR(BQ,DIR), + HTML_ATTR(BQ,ID), + HTML_ATTR(BQ,LANG), + HTML_ATTR(BQ,STYLE), + HTML_ATTR(BQ,TITLE), + HTML_ATTRIBUTES(BQ) +}; + +static HTAttr br_attr[HTML_BR_ATTRIBUTES+1] = { + HTML_ATTR(BR,CLASS), + HTML_ATTR(BR,CLEAR), + HTML_ATTR(BR,ID), + HTML_ATTR(BR,STYLE), + HTML_ATTR(BR,TITLE), + HTML_ATTRIBUTES(BR) +}; + +static HTAttr button_attr[HTML_BUTTON_ATTRIBUTES+1] = { + HTML_ATTR(BUTTON,ACCESSKEY), + HTML_ATTR(BUTTON,CLASS), + HTML_ATTR(BUTTON,DIR), + HTML_ATTR(BUTTON,DISABLED), + HTML_ATTR(BUTTON,ID), + HTML_ATTR(BUTTON,LANG), + HTML_ATTR(BUTTON,NAME), + HTML_ATTR(BUTTON,STYLE), + HTML_ATTR(BUTTON,TABINDEX), + HTML_ATTR(BUTTON,TITLE), + HTML_ATTR(BUTTON,TYPE), + HTML_ATTR(BUTTON,VALUE), + HTML_ATTRIBUTES(BUTTON), +}; + +static HTAttr col_attr[HTML_COL_ATTRIBUTES+1] = { + HTML_ATTR(COL,CLASS), + HTML_ATTR(COL,DIR), + HTML_ATTR(COL,ID), + HTML_ATTR(COL,LANG), + HTML_ATTR(COL,SPAN), + HTML_ATTR(COL,STYLE), + HTML_ATTR(COL,TITLE), + HTML_ATTR(COL,WIDTH), + HTML_ATTRIBUTES(COL) +}; + +static HTAttr changes_attr[HTML_CHANGES_ATTRIBUTES+1] = { + HTML_ATTR(CHANGES,CITE), + HTML_ATTR(CHANGES,CLASS), + HTML_ATTR(CHANGES,DATETIME), + HTML_ATTR(CHANGES,DIR), + HTML_ATTR(CHANGES,ID), + HTML_ATTR(CHANGES,LANG), + HTML_ATTR(CHANGES,STYLE), + HTML_ATTR(CHANGES,TITLE), + HTML_ATTRIBUTES(CHANGES) +}; + +static HTAttr font_attr[HTML_FONT_ATTRIBUTES+1] = { + HTML_ATTR(FONT,CLASS), + HTML_ATTR(FONT,COLOR), + HTML_ATTR(FONT,DIR), + HTML_ATTR(FONT,FACE), + HTML_ATTR(FONT,ID), + HTML_ATTR(FONT,LANG), + HTML_ATTR(FONT,SIZE), + HTML_ATTR(FONT,STYLE), + HTML_ATTR(FONT,TITLE), + HTML_ATTRIBUTES(FONT) +}; + +static HTAttr form_attr[HTML_FORM_ATTRIBUTES+1] = { + HTML_ATTR(FORM,ACCEPT), + { (char *) "ACCEPT-CHARSET" }, /* HTML_ATTR(FORM,ACCEPT_CHARSET) */ + HTML_ATTR(FORM,ACTION), + HTML_ATTR(FORM,CLASS), + HTML_ATTR(FORM,DIR), + HTML_ATTR(FORM,ENCTYPE), + HTML_ATTR(FORM,ID), + HTML_ATTR(FORM,LANG), + HTML_ATTR(FORM,METHOD), + HTML_ATTR(FORM,STYLE), + HTML_ATTR(FORM,TARGET), + HTML_ATTR(FORM,TITLE), + HTML_ATTRIBUTES(FORM) +}; + +static HTAttr gen_attr[HTML_GEN_ATTRIBUTES+1] = { /* General, for many things */ + HTML_ATTR(GEN,CLASS), + HTML_ATTR(GEN,DIR), + HTML_ATTR(GEN,ID), + HTML_ATTR(GEN,LANG), + HTML_ATTR(GEN,STYLE), + HTML_ATTR(GEN,TITLE), + HTML_ATTRIBUTES(GEN) +}; + +static HTAttr block_attr[HTML_BLOCK_ATTRIBUTES+1] = { /* DIV, SPAN, H1-H6 */ + HTML_ATTR(BLOCK,ALIGN), + HTML_ATTR(BLOCK,CLASS), + HTML_ATTR(BLOCK,DIR), + HTML_ATTR(BLOCK,ID), + HTML_ATTR(BLOCK,LANG), + HTML_ATTR(BLOCK,STYLE), + HTML_ATTR(BLOCK,TITLE), + HTML_ATTRIBUTES(BLOCK) +}; + +static HTAttr head_attr[HTML_HEAD_ATTRIBUTES+1] = { + HTML_ATTR(HEAD,DIR), + HTML_ATTR(HEAD,LANG), + HTML_ATTR(HEAD,PROFILE), + HTML_ATTRIBUTES(HEAD) +}; + +static HTAttr hr_attr[HTML_HR_ATTRIBUTES+1] = { + HTML_ATTR(HR,ALIGN), + HTML_ATTR(HR,CLASS), + HTML_ATTR(HR,DIR), + HTML_ATTR(HR,ID), + HTML_ATTR(HR,LANG), + HTML_ATTR(HR,NOSHADE), + HTML_ATTR(HR,SIZE), + HTML_ATTR(HR,STYLE), + HTML_ATTR(HR,TITLE), + HTML_ATTR(HR,WIDTH), + HTML_ATTRIBUTES(HR) +}; + +static HTAttr html_attr[HTML_HTML_ATTRIBUTES+1] = { + HTML_ATTR(HTML,DIR), + HTML_ATTR(HTML,LANG), + HTML_ATTR(HTML,VERSION), + HTML_ATTRIBUTES(HTML) +}; + +static HTAttr iframe_attr[HTML_IFRAME_ATTRIBUTES+1] = { + HTML_ATTR(IFRAME,ALIGN), + HTML_ATTR(IFRAME,CLASS), + HTML_ATTR(IFRAME,FRAMEBORDER), + HTML_ATTR(IFRAME,HEIGHT), + HTML_ATTR(IFRAME,ID), + HTML_ATTR(IFRAME,LONGDESC), + HTML_ATTR(IFRAME,MARGINHEIGHT), + HTML_ATTR(IFRAME,MARGINWIDTH), + HTML_ATTR(IFRAME,NAME), + HTML_ATTR(IFRAME,SCROLLING), + HTML_ATTR(IFRAME,SRC), + HTML_ATTR(IFRAME,STYLE), + HTML_ATTR(IFRAME,TARGET), + HTML_ATTR(IFRAME,TITLE), + HTML_ATTR(IFRAME,WIDTH), + HTML_ATTRIBUTES(IFRAME) +}; + +static HTAttr img_attr[HTML_IMG_ATTRIBUTES+1] = { /* IMG attributes */ + HTML_ATTR(IMG,ALIGN), + HTML_ATTR(IMG,ALT), + HTML_ATTR(IMG,BORDER), + HTML_ATTR(IMG,CLASS), + HTML_ATTR(IMG,DIR), + HTML_ATTR(IMG,HEIGHT), + HTML_ATTR(IMG,HSPACE), + HTML_ATTR(IMG,ID), + HTML_ATTR(IMG,ISMAP), + HTML_ATTR(IMG,LANG), + HTML_ATTR(IMG,LONGDESC), + HTML_ATTR(IMG,SRC), + HTML_ATTR(IMG,STYLE), + HTML_ATTR(IMG,TITLE), + HTML_ATTR(IMG,USEMAP), + HTML_ATTR(IMG,VSPACE), + HTML_ATTR(IMG,WIDTH), + HTML_ATTRIBUTES(IMG) +}; + +static HTAttr input_attr[HTML_INPUT_ATTRIBUTES+1] = { + HTML_ATTR(INPUT,ACCEPT), + HTML_ATTR(INPUT,ACCESSKEY), + HTML_ATTR(INPUT,ALIGN), + HTML_ATTR(INPUT,ALT), + HTML_ATTR(INPUT,CHECKED), + HTML_ATTR(INPUT,CLASS), + HTML_ATTR(INPUT,DIR), + HTML_ATTR(INPUT,DISABLED), + HTML_ATTR(INPUT,ID), + HTML_ATTR(INPUT,LANG), + HTML_ATTR(INPUT,MAXLENGTH), + HTML_ATTR(INPUT,NAME), + HTML_ATTR(INPUT,READONLY), + HTML_ATTR(INPUT,SIZE), + HTML_ATTR(INPUT,SRC), + HTML_ATTR(INPUT,STYLE), + HTML_ATTR(INPUT,TABINDEX), + HTML_ATTR(INPUT,TITLE), + HTML_ATTR(INPUT,TYPE), + HTML_ATTR(INPUT,USEMAP), + HTML_ATTR(INPUT,VALUE), + HTML_ATTRIBUTES(INPUT) +}; + +static HTAttr isindex_attr[HTML_ISINDEX_ATTRIBUTES+1] = { + HTML_ATTR(ISINDEX,CLASS), + HTML_ATTR(ISINDEX,DIR), + HTML_ATTR(ISINDEX,ID), + HTML_ATTR(ISINDEX,LANG), + HTML_ATTR(ISINDEX,PROMPT), + HTML_ATTR(ISINDEX,STYLE), + HTML_ATTR(ISINDEX,TITLE), + HTML_ATTRIBUTES(ISINDEX) +}; + +static HTAttr label_attr[HTML_LABEL_ATTRIBUTES+1] = { + HTML_ATTR(LABEL,ACCESSKEY), + HTML_ATTR(LABEL,CLASS), + HTML_ATTR(LABEL,DIR), + HTML_ATTR(LABEL,FOR), + HTML_ATTR(LABEL,ID), + HTML_ATTR(LABEL,LANG), + HTML_ATTR(LABEL,STYLE), + HTML_ATTR(LABEL,TITLE), + HTML_ATTRIBUTES(LABEL) +}; + +static HTAttr legend_attr[HTML_LEGEND_ATTRIBUTES+1] = { + HTML_ATTR(LEGEND,ACCESSKEY), + HTML_ATTR(LEGEND,ALIGN), + HTML_ATTR(LEGEND,CLASS), + HTML_ATTR(LEGEND,DIR), + HTML_ATTR(LEGEND,ID), + HTML_ATTR(LEGEND,LANG), + HTML_ATTR(LEGEND,STYLE), + HTML_ATTR(LEGEND,TITLE), + HTML_ATTRIBUTES(LEGEND) +}; + +static HTAttr li_attr[HTML_LI_ATTRIBUTES+1] = { + HTML_ATTR(LI,CLASS), + HTML_ATTR(LI,COMPACT), + HTML_ATTR(LI,DIR), + HTML_ATTR(LI,ID), + HTML_ATTR(LI,LANG), + HTML_ATTR(LI,STYLE), + HTML_ATTR(LI,TITLE), + HTML_ATTR(LI,TYPE), + HTML_ATTR(LI,VALUE), + HTML_ATTRIBUTES(LI) +}; + +static HTAttr link_attr[HTML_LINK_ATTRIBUTES+1] = { /* link attributes */ + HTML_ATTR(LINK,CHARSET), + HTML_ATTR(LINK,CLASS), + HTML_ATTR(LINK,DIR), + HTML_ATTR(LINK,HREF), + HTML_ATTR(LINK,HREFLANG), + HTML_ATTR(LINK,ID), + HTML_ATTR(LINK,LANG), + HTML_ATTR(LINK,MEDIA), + HTML_ATTR(LINK,REL), + HTML_ATTR(LINK,REV), + HTML_ATTR(LINK,STYLE), + HTML_ATTR(LINK,TARGET), + HTML_ATTR(LINK,TITLE), + HTML_ATTR(LINK,TYPE), + HTML_ATTRIBUTES(LINK) +}; + +static HTAttr map_attr[HTML_MAP_ATTRIBUTES+1] = { + HTML_ATTR(MAP,CLASS), + HTML_ATTR(MAP,DIR), + HTML_ATTR(MAP,ID), + HTML_ATTR(MAP,LANG), + HTML_ATTR(MAP,NAME), + HTML_ATTR(MAP,STYLE), + HTML_ATTR(MAP,TITLE), + HTML_ATTRIBUTES(MAP) +}; + +static HTAttr meta_attr[HTML_META_ATTRIBUTES+1] = { + HTML_ATTR(META,CONTENT), + HTML_ATTR(META,DIR), + { (char *)"HTTP-EQUIV" }, /* HTML_ATTR(META,HTTP_EQUIV) */ + HTML_ATTR(META,LANG), + HTML_ATTR(META,NAME), + HTML_ATTR(META,SCHEME), + HTML_ATTRIBUTES(META) +}; + +static HTAttr nextid_attr[HTML_NEXTID_ATTRIBUTES+1] = { + { (char *)"N" }, + { 0 } /* Terminate list */ +}; + +static HTAttr object_attr[HTML_OBJECT_ATTRIBUTES+1] = { /* object attributes */ + HTML_ATTR(OBJECT,ALIGN), + HTML_ATTR(OBJECT,ARCHIVE), + HTML_ATTR(OBJECT,BORDER), + HTML_ATTR(OBJECT,CLASS), + HTML_ATTR(OBJECT,CLASSID), + HTML_ATTR(OBJECT,CODEBASE), + HTML_ATTR(OBJECT,CODETYPE), + HTML_ATTR(OBJECT,DATA), + HTML_ATTR(OBJECT,DECLARE), + HTML_ATTR(OBJECT,DIR), + HTML_ATTR(OBJECT,HEIGHT), + HTML_ATTR(OBJECT,HSPACE), + HTML_ATTR(OBJECT,ID), + HTML_ATTR(OBJECT,LANG), + HTML_ATTR(OBJECT,NAME), + HTML_ATTR(OBJECT,STANDBY), + HTML_ATTR(OBJECT,STYLE), + HTML_ATTR(OBJECT,TABINDEX), + HTML_ATTR(OBJECT,TITLE), + HTML_ATTR(OBJECT,TYPE), + HTML_ATTR(OBJECT,USEMAP), + HTML_ATTR(OBJECT,VSPACE), + HTML_ATTR(OBJECT,WIDTH), + HTML_ATTRIBUTES(OBJECT) +}; + +static HTAttr ol_attr[HTML_OL_ATTRIBUTES+1] = { + HTML_ATTR(OL,CLASS), + HTML_ATTR(OL,COMPACT), + HTML_ATTR(OL,DIR), + HTML_ATTR(OL,ID), + HTML_ATTR(OL,LANG), + HTML_ATTR(OL,START), + HTML_ATTR(OL,STYLE), + HTML_ATTR(OL,TITLE), + HTML_ATTR(OL,TYPE), + HTML_ATTRIBUTES(OL) +}; + +static HTAttr optgroup_attr[HTML_OPTGROUP_ATTRIBUTES+1] = { + HTML_ATTR(OPTGROUP,CLASS), + HTML_ATTR(OPTGROUP,DISABLED), + HTML_ATTR(OPTGROUP,DIR), + HTML_ATTR(OPTGROUP,ID), + HTML_ATTR(OPTGROUP,LABEL), + HTML_ATTR(OPTGROUP,LANG), + HTML_ATTR(OPTGROUP,STYLE), + HTML_ATTR(OPTGROUP,TITLE), + HTML_ATTRIBUTES(OPTGROUP) +}; + +static HTAttr option_attr[HTML_OPTION_ATTRIBUTES+1] = { + HTML_ATTR(OPTION,CLASS), + HTML_ATTR(OPTION,DISABLED), + HTML_ATTR(OPTION,DIR), + HTML_ATTR(OPTION,ID), + HTML_ATTR(OPTION,LABEL), + HTML_ATTR(OPTION,LANG), + HTML_ATTR(OPTION,SELECTED), + HTML_ATTR(OPTION,STYLE), + HTML_ATTR(OPTION,TITLE), + HTML_ATTR(OPTION,VALUE), + HTML_ATTRIBUTES(OPTION) +}; + +static HTAttr param_attr[HTML_PARAM_ATTRIBUTES+1] = { + HTML_ATTR(PARAM,ID), + HTML_ATTR(PARAM,NAME), + HTML_ATTR(PARAM,TYPE), + HTML_ATTR(PARAM,VALUE), + HTML_ATTR(PARAM,VALUETYPE), + HTML_ATTRIBUTES(PARAM) +}; + +static HTAttr pre_attr[HTML_PRE_ATTRIBUTES+1] = { + HTML_ATTR(PRE,CLASS), + HTML_ATTR(PRE,DIR), + HTML_ATTR(PRE,ID), + HTML_ATTR(PRE,LANG), + HTML_ATTR(PRE,STYLE), + HTML_ATTR(PRE,TITLE), + HTML_ATTR(PRE,WIDTH), + HTML_ATTRIBUTES(PRE) +}; + +static HTAttr script_attr[HTML_SCRIPT_ATTRIBUTES+1] = { + HTML_ATTR(SCRIPT,CHARSET), + HTML_ATTR(SCRIPT,DEFER), + HTML_ATTR(SCRIPT,LANGUAGE), + HTML_ATTR(SCRIPT,SRC), + HTML_ATTR(SCRIPT,TYPE), + HTML_ATTRIBUTES(SCRIPT) +}; + +static HTAttr select_attr[HTML_SELECT_ATTRIBUTES+1] = { + HTML_ATTR(SELECT,CLASS), + HTML_ATTR(SELECT,DIR), + HTML_ATTR(SELECT,DISABLED), + HTML_ATTR(SELECT,ID), + HTML_ATTR(SELECT,LANG), + HTML_ATTR(SELECT,MULTIPLE), + HTML_ATTR(SELECT,NAME), + HTML_ATTR(SELECT,SIZE), + HTML_ATTR(SELECT,STYLE), + HTML_ATTR(SELECT,TABINDEX), + HTML_ATTR(SELECT,TITLE), + HTML_ATTRIBUTES(SELECT) +}; + +static HTAttr style_attr[HTML_STYLE_ATTRIBUTES+1] = { + HTML_ATTR(STYLE,DIR), + HTML_ATTR(STYLE,LANG), + HTML_ATTR(STYLE,MEDIA), + HTML_ATTR(STYLE,TITLE), + HTML_ATTR(STYLE,TYPE), + HTML_ATTRIBUTES(STYLE) +}; + +static HTAttr table_attr[HTML_TABLE_ATTRIBUTES+1] = { + HTML_ATTR(TABLE,ALIGN), + HTML_ATTR(TABLE,BGCOLOR), + HTML_ATTR(TABLE,BORDER), + HTML_ATTR(TABLE,CELLPADDING), + HTML_ATTR(TABLE,CELLSPACING), + HTML_ATTR(TABLE,CLASS), + HTML_ATTR(TABLE,DIR), + HTML_ATTR(TABLE,FRAME), + HTML_ATTR(TABLE,ID), + HTML_ATTR(TABLE,LANG), + HTML_ATTR(TABLE,RULES), + HTML_ATTR(TABLE,SUMMARY), + HTML_ATTR(TABLE,STYLE), + HTML_ATTR(TABLE,TITLE), + HTML_ATTR(TABLE,WIDTH), + HTML_ATTRIBUTES(TABLE) +}; + +static HTAttr tele_attr[HTML_TELE_ATTRIBUTES+1] = { + HTML_ATTR(TELE,ALIGN), + HTML_ATTR(TELE,CHAR), + HTML_ATTR(TELE,CHAROFF), + HTML_ATTR(TELE,CLASS), + HTML_ATTR(TELE,DIR), + HTML_ATTR(TELE,ID), + HTML_ATTR(TELE,LANG), + HTML_ATTR(TELE,STYLE), + HTML_ATTR(TELE,TITLE), + HTML_ATTR(TELE,VALIGN), + HTML_ATTRIBUTES(TELE) +}; + +static HTAttr td_attr[HTML_TD_ATTRIBUTES+1] = { + HTML_ATTR(TD,ABBR), + HTML_ATTR(TD,ALIGN), + HTML_ATTR(TD,AXIS), + HTML_ATTR(TD,BGCOLOR), + HTML_ATTR(TD,CHAR), + HTML_ATTR(TD,CHAROFF), + HTML_ATTR(TD,CLASS), + HTML_ATTR(TD,COLSPAN), + HTML_ATTR(TD,DIR), + HTML_ATTR(TD,ID), + HTML_ATTR(TD,HEADERS), + HTML_ATTR(TD,HEIGHT), + HTML_ATTR(TD,LANG), + HTML_ATTR(TD,NOWRAP), + HTML_ATTR(TD,ROWSPAN), + HTML_ATTR(TD,SCOPE), + HTML_ATTR(TD,STYLE), + HTML_ATTR(TD,TITLE), + HTML_ATTR(TD,VALIGN), + HTML_ATTR(TD,WIDTH), + HTML_ATTRIBUTES(TD) +}; + +static HTAttr textarea_attr[HTML_TEXTAREA_ATTRIBUTES+1] = { + HTML_ATTR(TEXTAREA,CLASS), + HTML_ATTR(TEXTAREA,COLS), + HTML_ATTR(TEXTAREA,DIR), + HTML_ATTR(TEXTAREA,DISABLED), + HTML_ATTR(TEXTAREA,ID), + HTML_ATTR(TEXTAREA,LANG), + HTML_ATTR(TEXTAREA,NAME), + HTML_ATTR(TEXTAREA,READONLY), + HTML_ATTR(TEXTAREA,ROWS), + HTML_ATTR(TEXTAREA,STYLE), + HTML_ATTR(TEXTAREA,TABINDEX), + HTML_ATTR(TEXTAREA,TITLE), + HTML_ATTRIBUTES(TEXTAREA) +}; + +static HTAttr title_attr[HTML_TITLE_ATTRIBUTES+1] = { + HTML_ATTR(TITLE,DIR), + HTML_ATTR(TITLE,LANG), + HTML_ATTRIBUTES(TITLE) +}; + +static HTAttr ul_attr[HTML_UL_ATTRIBUTES+1] = { + HTML_ATTR(UL,CLASS), + HTML_ATTR(UL,COMPACT), + HTML_ATTR(UL,DIR), + HTML_ATTR(UL,ID), + HTML_ATTR(UL,LANG), + HTML_ATTR(UL,STYLE), + HTML_ATTR(UL,TITLE), + HTML_ATTR(UL,TYPE), + HTML_ATTRIBUTES(UL) +}; + +/* + ** ELEMENTS + ** Must match definitions in HTMLPDTD.html! + ** Must be in alphabetical order. + ** + ** Name, Attributes, content + */ +static HTTag tags[HTML_ELEMENTS] = { + { "A" , a_attr, HTML_A_ATTRIBUTES }, + { "ABBR" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "ACRONYM" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "ADDRESS" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "APPLET" , applet_attr, HTML_APPLET_ATTRIBUTES }, + { "AREA" , area_attr, HTML_AREA_ATTRIBUTES }, + { "B" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "BASE" , base_attr, HTML_BASE_ATTRIBUTES }, + { "BASEFONT", font_attr, HTML_FONT_ATTRIBUTES }, + { "BDO" , bdo_attr, HTML_BDO_ATTRIBUTES }, + { "BIG" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "BLOCKQUOTE", bq_attr, HTML_BQ_ATTRIBUTES }, + { "BODY" , body_attr, HTML_BODY_ATTRIBUTES }, + { "BR" , br_attr, HTML_BR_ATTRIBUTES }, + { "BUTTON" , button_attr, HTML_BUTTON_ATTRIBUTES }, + { "CAPTION" , block_attr, HTML_BLOCK_ATTRIBUTES }, + { "CENTER" , no_attr, 0 }, + { "CITE" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "CODE" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "COL" , col_attr, HTML_COL_ATTRIBUTES }, + { "COLGROUP", col_attr, HTML_COL_ATTRIBUTES }, + { "DD" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "DEL" , changes_attr, HTML_CHANGES_ATTRIBUTES }, + { "DFN" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "DIR" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "DIV" , block_attr, HTML_BLOCK_ATTRIBUTES }, + { "DL" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "DT" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "EM" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "FIELDSET", gen_attr, HTML_GEN_ATTRIBUTES }, + { "FONT" , font_attr, HTML_FONT_ATTRIBUTES }, + { "FORM" , form_attr, HTML_FORM_ATTRIBUTES }, + { "FRAME" , frame_attr, HTML_FRAME_ATTRIBUTES }, + { "FRAMESET", frameset_attr,HTML_FRAMESET_ATTRIBUTES }, + { "H1" , block_attr, HTML_BLOCK_ATTRIBUTES }, + { "H2" , block_attr, HTML_BLOCK_ATTRIBUTES }, + { "H3" , block_attr, HTML_BLOCK_ATTRIBUTES }, + { "H4" , block_attr, HTML_BLOCK_ATTRIBUTES }, + { "H5" , block_attr, HTML_BLOCK_ATTRIBUTES }, + { "H6" , block_attr, HTML_BLOCK_ATTRIBUTES }, + { "HEAD" , head_attr, HTML_HEAD_ATTRIBUTES }, + { "HR" , hr_attr, HTML_HR_ATTRIBUTES }, + { "HTML" , html_attr, HTML_HTML_ATTRIBUTES }, + { "I" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "IFRAME" , iframe_attr, HTML_IFRAME_ATTRIBUTES }, + { "IMG" , img_attr, HTML_IMG_ATTRIBUTES }, + { "INPUT" , input_attr, HTML_INPUT_ATTRIBUTES }, + { "INS" , changes_attr, HTML_CHANGES_ATTRIBUTES }, + { "ISINDEX" , isindex_attr, HTML_ISINDEX_ATTRIBUTES }, + { "KBD" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "LABEL" , label_attr, HTML_LABEL_ATTRIBUTES }, + { "LEGEND" , legend_attr, HTML_LEGEND_ATTRIBUTES }, + { "LI" , li_attr, HTML_LI_ATTRIBUTES }, + { "LINK" , link_attr, HTML_LINK_ATTRIBUTES }, + { "MAP" , map_attr, HTML_MAP_ATTRIBUTES }, + { "MENU" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "META" , meta_attr, HTML_META_ATTRIBUTES }, + { "NEXTID" , nextid_attr, 1 }, + { "NOFRAMES", gen_attr, HTML_GEN_ATTRIBUTES }, + { "NOSCRIPT", gen_attr, HTML_GEN_ATTRIBUTES }, + { "OBJECT" , object_attr, HTML_OBJECT_ATTRIBUTES }, + { "OL" , ol_attr, HTML_OL_ATTRIBUTES }, + { "OPTGROUP", optgroup_attr,HTML_OPTGROUP_ATTRIBUTES }, + { "OPTION" , option_attr, HTML_OPTION_ATTRIBUTES }, + { "P" , block_attr, HTML_BLOCK_ATTRIBUTES }, + { "PARAM" , param_attr, HTML_PARAM_ATTRIBUTES }, + { "PRE" , pre_attr, HTML_PRE_ATTRIBUTES }, + { "Q" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "S" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "SAMP" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "SCRIPT" , script_attr, HTML_SCRIPT_ATTRIBUTES }, + { "SELECT" , select_attr, HTML_SELECT_ATTRIBUTES }, + { "SMALL" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "SPAN" , block_attr, HTML_BLOCK_ATTRIBUTES }, + { "STRIKE" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "STRONG" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "STYLE" , style_attr, HTML_STYLE_ATTRIBUTES }, + { "SUB" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "SUP" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "TABLE" , table_attr, HTML_TABLE_ATTRIBUTES }, + { "TBODY" , tele_attr, HTML_TELE_ATTRIBUTES }, + { "TD" , td_attr, HTML_TD_ATTRIBUTES }, + { "TEXTAREA", textarea_attr,HTML_TEXTAREA_ATTRIBUTES }, + { "TFOOT" , tele_attr, HTML_TELE_ATTRIBUTES }, + { "TH" , td_attr, HTML_TD_ATTRIBUTES }, + { "THEAD" , tele_attr, HTML_TELE_ATTRIBUTES }, + { "TITLE" , title_attr, HTML_TITLE_ATTRIBUTES }, + { "TR" , tele_attr, HTML_TELE_ATTRIBUTES }, + { "TT" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "U" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "UL" , ul_attr, HTML_UL_ATTRIBUTES }, + { "VAR" , gen_attr, HTML_GEN_ATTRIBUTES }, +}; + +static SGML_dtd HTMLP_dtd = { + tags, + HTML_ELEMENTS +}; + +static SGML_dtd * DTD = &HTMLP_dtd; + +SGML_dtd * HTML_dtd (void) +{ + return DTD; +} + +}// namespace +