Browse Source

+ Added web interface

git-svn-id: trunk@4977 -
michael 19 years ago
parent
commit
ae29d531d6

+ 19 - 1
.gitattributes

@@ -872,6 +872,7 @@ fcl/inc/fpasync.pp svneol=native#text/plain
 fcl/inc/fpmake.inc svneol=native#text/plain
 fcl/inc/fpmake.pp svneol=native#text/plain
 fcl/inc/gettext.pp svneol=native#text/plain
+fcl/inc/htmldefs.pp svneol=native#text/plain
 fcl/inc/idea.pp svneol=native#text/plain
 fcl/inc/inicol.pp svneol=native#text/plain
 fcl/inc/inifiles.pp svneol=native#text/plain
@@ -1054,6 +1055,24 @@ fcl/unix/pipes.inc svneol=native#text/plain
 fcl/unix/process.inc svneol=native#text/plain
 fcl/unix/resolve.inc svneol=native#text/plain
 fcl/unix/simpleipc.inc svneol=native#text/plain
+fcl/web/Makefile svneol=native#text/plain
+fcl/web/Makefile.fpc svneol=native#text/plain
+fcl/web/custcgi.pp svneol=native#text/plain
+fcl/web/fpcgi.pp svneol=native#text/plain
+fcl/web/fpdatasetform.pp svneol=native#text/plain
+fcl/web/fphtml.pp svneol=native#text/plain
+fcl/web/fphttp.pp svneol=native#text/plain
+fcl/web/fptemplate.pp svneol=native#text/plain
+fcl/web/fpweb.pp svneol=native#text/plain
+fcl/web/htmlelements.pp svneol=native#text/plain
+fcl/web/htmlwriter.pp svneol=native#text/plain
+fcl/web/httpdefs.pp svneol=native#text/plain
+fcl/web/tagsimpl.inc svneol=native#text/plain
+fcl/web/tagsintf.inc svneol=native#text/plain
+fcl/web/websession.pp svneol=native#text/plain
+fcl/web/webutil.pp svneol=native#text/plain
+fcl/web/wtagsimpl.inc svneol=native#text/plain
+fcl/web/wtagsintf.inc svneol=native#text/plain
 fcl/win/eventlog.inc svneol=native#text/plain
 fcl/win/fclel.mc -text
 fcl/win/fclel.rc -text
@@ -1080,7 +1099,6 @@ fcl/xml/dom.pp svneol=native#text/plain
 fcl/xml/dom_html.pp svneol=native#text/plain
 fcl/xml/fpmake.inc svneol=native#text/plain
 fcl/xml/fpmake.pp svneol=native#text/plain
-fcl/xml/htmldefs.pp svneol=native#text/plain
 fcl/xml/htmwrite.pp svneol=native#text/plain
 fcl/xml/names.inc svneol=native#text/plain
 fcl/xml/sax.pp svneol=native#text/plain

+ 41 - 41
fcl/Makefile

@@ -356,127 +356,127 @@ ifeq ($(FULL_TARGET),powerpc64-linux)
 override TARGET_DIRS+=xml image db shedit passrc net fpcunit
 endif
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process resolve ssockets fpasync syncobjs simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process resolve ssockets fpasync syncobjs simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process fileinfo resolve ssockets syncobjs simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process fileinfo resolve ssockets syncobjs simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  resolve ssockets
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  resolve ssockets
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process ssockets resolve fpasync simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process ssockets resolve fpasync simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  resolve ssockets
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  resolve ssockets
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process ssockets resolve fpasync simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process ssockets resolve fpasync simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  resolve ssockets
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  resolve ssockets
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  resolve ssockets syncobjs
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  resolve ssockets syncobjs
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process fileinfo resolve ssockets syncobjs simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process fileinfo resolve ssockets syncobjs simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process resolve ssockets fpasync syncobjs simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process resolve ssockets fpasync syncobjs simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process ssockets resolve fpasync simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process ssockets resolve fpasync simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process ssockets resolve fpasync simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process ssockets resolve fpasync simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process resolve ssockets fpasync syncobjs simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process resolve ssockets fpasync syncobjs simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process ssockets resolve fpasync simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process ssockets resolve fpasync simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process resolve ssockets fpasync syncobjs simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process resolve ssockets fpasync syncobjs simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process ssockets resolve fpasync simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process ssockets resolve fpasync simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process resolve ssockets fpasync syncobjs simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process resolve ssockets fpasync syncobjs simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process fileinfo resolve ssockets syncobjs simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process fileinfo resolve ssockets syncobjs simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process resolve ssockets fpasync syncobjs simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process resolve ssockets fpasync syncobjs simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process fileinfo resolve ssockets syncobjs simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process fileinfo resolve ssockets syncobjs simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm  process resolve ssockets fpasync syncobjs simpleipc dbugmsg dbugintf
+override TARGET_UNITS+=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio inicol pooledmm htmldefs  process resolve ssockets fpasync syncobjs simpleipc dbugmsg dbugintf
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_RSTS+=ssockets cachecls resolve custapp cgiapp eventlog registry simpleipc

+ 1 - 1
fcl/Makefile.fpc

@@ -29,7 +29,7 @@ dirs=xml image db shedit passrc net fpcunit
 units=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext \
       iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp \
       wformat whtml wtex rttiutils bufstream streamex blowfish zipper streamio \
-      inicol pooledmm
+      inicol pooledmm htmldefs
 units_freebsd=process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf
 units_darwin=process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf
 units_solaris=process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf

+ 1 - 1
fcl/inc/gettext.pp

@@ -224,7 +224,7 @@ end;
 
 procedure TranslateUnitResourceStrings(const AUnitName:string; AFile: TMOFile);
 begin
-  SetUnitResourceStrings(AUnitName,@Translate,AFile);
+//  SetUnitResourceStrings(AUnitName,@Translate,AFile);
 end;
 
 

+ 632 - 0
fcl/inc/htmldefs.pp

@@ -0,0 +1,632 @@
+{
+    $Id: htmldefs.pp,v 1.2 2006/01/03 23:33:23 lukvdl Exp $
+    This file is part of the Free Component Library
+
+    HTML definitions and utility functions
+    Copyright (c) 2000-2002 by
+      Areca Systems GmbH / Sebastian Guenther, [email protected]
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    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.
+
+ **********************************************************************}
+
+
+unit HTMLDefs;
+
+{$MODE objfpc}
+{$H+}
+
+interface
+
+type
+
+  THTMLCData = string;
+  THTMLID = string;
+  THTMLName = string;
+  THTMLIDRef = string;
+  THTMLIDRefs = string;
+  THTMLNumber = longint;
+
+  THTMLText = THTMLCData;
+  THTMLCharsets = THTMLCData;
+  THTMLContentTypes = THTMLCData;
+  THTMLURI = string;
+  THTMLCharacter = char;
+
+  THTMLDir = (dirEmpty,dirLeftToRight,dirRightToLeft);
+  THTMLalign = (alEmpty,alleft,alcenter,alright,aljustify,alchar);
+  THTMLvalign = (vaEmpty,vatop,vamiddle,vabottom,vabaseline);
+  THTMLframe = (frEmpty,frvoid,frabove,frbelow,frhsides,frvsides,frlefthandsise,frrighthandside,frbox,frborder);
+  THTMLrules = (ruEmpty,runone,rugroups,rurows,rucols,ruall);
+  THTMLvaluetype = (vtEmpty,vtdata,vtref,vtobject);
+  THTMLshape = (shEmpty,shdefault,shrect,shcircle,shpoly);
+  THTMLinputtype = (itEmpty,ittext,itpassword,itcheckbox,itradio,itsubmit,itreset,itfile,ithidden,itimage,itbutton);
+  THTMLbuttontype = (btEmpty,btsubmit,btreset,btbutton);
+
+  THTMLColor = (
+      clHTMLBlack, clHTMLSilver, clHTMLGray,   clHTMLWhite, clHTMLMaroon,
+    //  #000000      #C0C0C0       #808080       #FFFFFF      #800000
+      clHTMLRed,   clHTMLPurple, clHTMLFuchsia,clHTMLGreen, clHTMLLime, clHTMLOlive,
+    //  #FF0000      #800080       #FF00FF       #008000      #00FF00     #808000
+      clHTMLYellow,clHTMLNavy,   clHTMLBlue,   clHTMLTeal,  clHTMLAqua
+    //  #FFFF00      #000080       #0000FF       #008080      #00FFFF
+      );
+
+  THTMLAttributeTag = (
+      atabbr, atacceptcharset, ataccept, ataccesskey, ataction, atalign, atalt, atarchive,
+      ataxis, atborder, atcellpadding, atcellspacing, atchar, atcharoff, atcharset,
+      atchecked, atcite, atclass, atclassid, atcodebase, atcodetype, atcols,
+      atcolspan, atcontent, atcoords, atdata, atdatetime, atdeclare,atdefer,
+      atdir, atdisabled, atenctype, atfor, atframe, atframeborder, atheaders,
+      atheight, athref, athreflang, athttpequiv, atid, atismap, atlabel, atlang,
+      atlongdesc, atmarginheight, atmarginwidth, atmaxlength, atmedia, atmethod,
+      atmultiple, atname, atnohref, atnoresize, atonblur, atonchange, atonclick,
+      atondblclick, atonfocus, atonkeydown, atonkeypress, atonkeyup, atonload,
+      atonmousedown, atonmousemove, atonmouseout, atonmouseover, atonmouseup,
+      atonreset, atonselect, atonsubmit, atonunload, atprofile, atreadonly,
+      atrel, atrev, atrows, atrowspan, atrules, atscheme, atscope, atscrolling,
+      atselected, atshape, atsize, atspan, atsrc, atstandby, atstyle, atsummary,
+      attabindex, attarget, attitle, attype, atusemap, atvalign, atvalue,
+      atvaluetype, atwidth
+      );
+  THTMLAttributeSet = set of THTMLAttributeTag;
+
+  THTMLElementTag = (
+      eta, etabbr, etacronym, etaddress, etapplet, etarea, etb, etbase,
+      etbasefont, etbdo, etbig, etblockquote, etbody, etbr, etbutton,
+      etcaption, etcenter, etcite, etcode, etcol, etcolgroup, etdd, etdel,
+      etdfn, etdir, etdiv, etdl, etdt, etem, etfieldset, etfont, etform,
+      etframe, etframeset, eth1, eth2, eth3, eth4, eth5, eth6, ethead, ethr,
+      ethtml, eti, etiframe, etimg, etinput, etins, etisindex, etkbd, etlabel,
+      etlegend, etli, etlink, etmap, etmenu, etmeta, etnoframes, etnoscript,
+      etobject, etol, etoptgroup, etoption, etp, etparam, etpre, etq, ets,
+      etsamp, etscript, etselect, etsmall, etspan, etstrike, etstrong,
+      etstyle, etsub, etsup, ettable, ettbody, ettd, ettextarea, ettfoot,
+      etth, etthead, ettitle, ettr, ettt, etu, etul, etvar,
+      etText, etUnknown
+      );
+  THTMLElementTagSet = set of THTMLElementTag;
+
+  THTMLElementFlag = (
+    efSubelementContent,                // may have subelements
+    efPCDATAContent,                    // may have PCDATA content
+    efPreserveWhitespace,               // preserve all whitespace
+    efDeprecated,                       // can be dropped in future versions
+    efNoChecks                          // Checks (attributes,subtags,...) can only be implemented in descendants
+    );
+  THTMLElementFlags = set of THTMLElementFlag;
+
+  PHTMLElementProps = ^THTMLElementProps;
+  THTMLElementProps = record
+    Name: String;
+    Flags: THTMLElementFlags;
+    Attributes: THTMLAttributeSet;
+  end;
+
+
+const
+
+  BooleanAttributes = [atchecked,atdeclare,atdefer,atdisabled,atnohref,atnoresize,
+                    atmultiple,atreadonly,atselected];
+
+  efSubcontent = [efSubelementContent, efPCDATAContent];
+
+  atsi18n = [atlang, atdir];
+  atscoreattrs = [atid,atclass,atstyle,attitle];
+  atsevents = [atonclick,atondblclick,atonmousedown,atonmouseup,atonmouseover,
+               atonmousemove,atonmouseout,atonkeypress,atonkeydown,atonkeyup];
+  atsattrs = atsevents + atscoreattrs + atsi18n;
+  atscellhalign = [atalign, atchar, atcharoff];
+
+{  etsStructured := [];
+  etsDivisions := [];
+  etsLists := [];
+  etsLinks := [];
+  etsObjects := [etImg, etObject, etApplet, etMap, etArea];
+  etsForms := [etForm];
+
+  etsText = etsStructured + etsDivisions + etsLists + etsLinks + etsObjects +
+          etsForms +
+          etTable + etText + etScript + ;      }
+
+  HTMLElementProps: array[THTMLElementTag] of THTMLElementProps = (
+    (Name: 'a';         Flags: efSubcontent;
+     Attributes: atsattrs+[atcharset,attype,atname,athref,athreflang,atrel,atrev,
+                 ataccesskey,atshape,atcoords,attabindex,atonfocus,atonblur]),
+
+    (Name: 'abbr';      Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'acronym';   Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'address';   Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'applet';    Flags: efSubcontent+[efDeprecated];
+     Attributes: atscoreattrs+[atcodebase,atarchive,atalt,atname,atwidth,atheight]),
+
+    (Name: 'area';      Flags: [];
+     Attributes: atsattrs+[atshape,atcoords,athref,atnohref,atalt,attabindex,
+     ataccesskey,atonfocus,atonblur]),
+
+    (Name: 'b';         Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'base';      Flags: []; Attributes: [athref]),
+
+    (Name: 'basefont';  Flags: [efDeprecated]; Attributes: [atid]),
+
+    (Name: 'bdo';       Flags: efSubcontent; Attributes: atscoreattrs+[atlang,atdir]),
+
+    (Name: 'big';       Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'blockquote';Flags: [efSubelementContent]; Attributes: atsattrs+[atcite]),
+
+    (Name: 'body';      Flags: [efSubelementContent];
+     Attributes: atsAttrs+[atonload, atonunload]),
+
+    (Name: 'br';        Flags: []; Attributes: atscoreattrs),
+
+    (Name: 'button';    Flags: efSubcontent;
+     Attributes: atsattrs+[atname,atvalue,attype,atdisabled,attabindex,
+                 ataccesskey,atonfocus,atonblur]),
+
+    (Name: 'caption';   Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'center';    Flags: [efSubelementContent,efDeprecated]; Attributes: []),
+
+    (Name: 'cite';      Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'code';      Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'col';       Flags: [];
+     Attributes: atsattrs+atscellhalign+[atvalign,atspan,atwidth]),
+
+    (Name: 'colgroup';  Flags: [efSubelementContent];
+     Attributes: atsattrs+atscellhalign+[atvalign,atspan,atwidth]),
+
+    (Name: 'dd';        Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'del';       Flags: [efSubelementContent]; Attributes: atsattrs+[atcite,atdatetime]),
+
+    (Name: 'dfn';       Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'dir';       Flags: [efSubelementContent,efDeprecated]; Attributes: atsattrs),
+
+    (Name: 'div';       Flags: [efSubelementContent]; Attributes: atsattrs),
+
+    (Name: 'dl';        Flags: [efSubelementContent]; Attributes: atsattrs),
+
+    (Name: 'dt';        Flags: [efPCDataContent]; Attributes: atsattrs),
+
+    (Name: 'em';        Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'fieldset';  Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'font';      Flags: efSubcontent+[efDeprecated]; Attributes: atscoreattrs+atsi18n),
+
+    (Name: 'form';      Flags: [efSubelementContent];
+     Attributes: atsattrs+[ataction,atmethod,atenctype,atonsubmit,atonreset,atacceptcharset]),
+
+    (Name: 'frame';     Flags: [];
+     Attributes: atscoreattrs+[atlongdesc,atname,atsrc,atframeborder,
+                 atmarginwidth,atmarginheight,atnoresize,atscrolling]),
+
+    (Name: 'frameset';  Flags: efSubcontent;
+     Attributes: atsCoreattrs+[atrows,atcols,atonload,atonunload]),
+
+    (Name: 'h1';        Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'h2';        Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'h3';        Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'h4';        Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'h5';        Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'h6';        Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'head';      Flags: [efSubelementContent]; Attributes: atsi18n+[atprofile]),
+
+    (Name: 'hr';        Flags: []; Attributes: atscoreattrs+atsevents),
+
+    (Name: 'html';      Flags: [efSubelementContent]; Attributes: atsi18n),
+
+    (Name: 'i';         Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'iframe';    Flags: [efSubelementContent];
+     Attributes: atscoreattrs+[atlongdesc,atname,atsrc,atframeborder,atmarginwidth,
+                 atmarginheight,atscrolling,atalign,atheight,atwidth]),
+
+    (Name: 'img';       Flags: [];
+     Attributes: atsattrs+[atsrc,atalt,atlongdesc,atheight,atwidth,atusemap,atismap]),
+
+    (Name: 'input';     Flags: [];
+     Attributes: atsattrs+[attype,atname,atvalue,atchecked,atdisabled,
+                 atreadonly,atsize,atmaxlength,atsrc,atalt,atusemap,attabindex,
+                 ataccesskey,atonfocus,atonblur,atonselect,atonchange,ataccept]),
+
+    (Name: 'ins';       Flags: [efSubelementContent]; Attributes: atsattrs+[atcite,atdatetime]),
+
+    (Name: 'isindex';   Flags: [efDeprecated]; Attributes: atscoreattrs+atsi18n),
+
+    (Name: 'kbd';       Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'label';     Flags: efSubcontent;
+     Attributes: atsattrs+[atfor,ataccesskey,atonfocus,atonblur]),
+
+    (Name: 'legend';    Flags: efSubcontent; Attributes: atsattrs+[ataccesskey]),
+
+    (Name: 'li';        Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'link';      Flags: [];
+     Attributes: atsattrs+[atcharset,athref,athreflang,attype,atrel,atrev,atmedia]),
+
+    (Name: 'map';       Flags: [efSubelementContent]; Attributes: atsattrs+[atname]),
+
+    (Name: 'menu';      Flags: [efSubelementContent,efDeprecated]; Attributes: atsattrs),
+
+    (Name: 'meta';      Flags: []; Attributes: atsi18n+[athttpequiv,atname,atcontent,atscheme]),
+
+    (Name: 'noframes';  Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'noscript';  Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'object';    Flags: efSubcontent;
+     Attributes: atsattrs+[atdeclare,atclassid,atcodebase,atdata,attype,atcodetype,
+                 atarchive,atstandby,atheight,atwidth,atusemap,atname,attabindex]),
+
+    (Name: 'ol';        Flags: [efSubelementContent]; Attributes: atsattrs),
+
+    (Name: 'optgroup';  Flags: efSubcontent; Attributes: atsattrs+[atdisabled,atlabel]),
+
+    (Name: 'option';    Flags: efSubcontent;
+     Attributes: atsattrs+[atselected,atdisabled,atlabel,atvalue]),
+
+    (Name: 'p';         Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'param';     Flags: []; Attributes: [atid,atname,atvalue,atvaluetype,attype]),
+
+    (Name: 'pre';       Flags: efSubcontent + [efPreserveWhitespace]; Attributes: atsattrs),
+
+    (Name: 'q';         Flags: efSubcontent; Attributes: atsattrs+[atcite]),
+
+    (Name: 's';         Flags: efSubcontent+[efDeprecated]; Attributes: atsattrs),
+
+    (Name: 'samp';      Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'script';    Flags: [efPCDATAContent]; Attributes: [atcharset,attype,atsrc,atdefer]),
+
+    (Name: 'select';    Flags: [efSubelementContent];
+     Attributes: atsattrs+[atname,atsize,atmultiple,atdisabled,attabindex,atonfocus,
+                 atonblur,atonchange]),
+
+    (Name: 'small';     Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'span';      Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'strike';    Flags: efSubcontent+[efDeprecated]; Attributes: atsattrs),
+
+    (Name: 'strong';    Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'style';     Flags: [efPCDATAContent];
+     Attributes: atsi18n+[attype,atmedia,attitle]),
+
+    (Name: 'sub';       Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'sup';       Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'table';     Flags: [efSubelementContent];
+     Attributes: atsattrs+[atsummary,atwidth,atborder,atframe,atrules,atcellspacing,atcellpadding]),
+
+    (Name: 'tbody';     Flags: [efSubelementContent]; Attributes: atsattrs+atscellhalign+[atvalign]),
+
+    (Name: 'td';        Flags: efSubcontent;
+     Attributes: atsattrs+atscellhalign+[atvalign,atabbr,ataxis,atheaders,atscope,atrowspan,atcolspan]),
+
+    (Name: 'textarea';  Flags: [efPCDATAContent];
+     Attributes: atsattrs+[atname,atrows,atcols,atdisabled,atreadonly,attabindex,
+                 ataccesskey,atonfocus,atonblur,atonselect,atonchange]),
+
+    (Name: 'tfoot';     Flags: [efSubelementContent]; Attributes: atsattrs+atscellhalign+[atvalign]),
+
+    (Name: 'th';        Flags: efSubcontent;
+     Attributes: atsattrs+atscellhalign+[atvalign,atabbr,ataxis,atheaders,atscope,atrowspan,atcolspan]),
+
+    (Name: 'thead';     Flags: [efSubelementContent]; Attributes: atsattrs+atscellhalign+[atvalign]),
+
+    (Name: 'title';     Flags: efSubcontent; Attributes: atsi18n),
+
+    (Name: 'tr';        Flags: [efSubelementContent];
+     Attributes: atsattrs+atscellhalign+[atvalign]),
+
+    (Name: 'tt';        Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'u';         Flags: efSubcontent+[efDeprecated]; Attributes: atsattrs),
+
+    (Name: 'ul';        Flags: [efSubelementContent]; Attributes: atsattrs),
+
+    (Name: 'var';       Flags: efSubcontent; Attributes: atsattrs),
+
+    (Name: 'text';      Flags: efSubcontent; Attributes: []),
+
+    (Name: 'unknown';   Flags: efSubcontent+[efNoChecks]; Attributes: [])
+
+    );
+
+  HTMLAttributeTag : array [THTMLAttributeTag] of string = (
+      'abbr', 'accept-charset', 'accept', 'accesskey', 'action', 'align', 'alt', 'archive',
+      'axis', 'border', 'cellpadding', 'cellspacing', 'char', 'charoff', 'charset',
+      'checked', 'cite', 'class', 'classid', 'codebase', 'codetype', 'cols',
+      'colspan', 'content', 'coords', 'data', 'datetime', 'declare', 'defer',
+      'dir', 'disabled', 'enctype', 'for', 'frame', 'frameborder', 'headers',
+      'height', 'href', 'hreflang', 'http-equiv', 'id', 'ismap', 'label', 'lang',
+      'longdesc', 'marginheight', 'marginwidth', 'maxlength', 'media', 'method',
+      'multiple', 'name', 'nohref', 'noresize', 'onblur', 'onchange', 'onclick',
+      'ondblclick', 'onfocus', 'onkeydown', 'onkeypress', 'onkeyup', 'onload',
+      'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup',
+      'onreset', 'onselect', 'onsubmit', 'onunload', 'profile', 'readonly',
+      'rel', 'rev', 'rows', 'rowspan', 'rules', 'scheme', 'scope', 'scrolling',
+      'selected', 'shape', 'size', 'span', 'src', 'standby', 'style', 'summary',
+      'tabindex', 'target', 'title', 'type', 'usemap', 'valign', 'value',
+      'valuetype', 'width');
+
+  HTMLColor : array [THTMLColor] of string =
+    ('Black', 'Silver', 'Gray', 'White', 'Maroon', 'Red', 'Purple', 'Fuchsia',
+     'Green', 'Lime', 'Olive', 'Yellow', 'Navy', 'Blue', 'Teal', 'Aqua');
+  HTMLDir : array [THTMLDir] of string = ('','LTR','RTL');
+  HTMLAlign : array [THTMLalign] of string = ('','left','center','right','justify','char');
+  HTMLvalign : array [THTMLvalign] of string = ('','top','middle','bottom','baseline');
+  HTMLframe : array [THTMLframe] of string =
+      ('','void','above','below','hsides','vsides','lhs','rhs','box','border');
+  HTMLrules : array [THTMLrules] of string = ('','none','groups','rows','cols','all');
+  HTMLvaluetype : array [THTMLvaluetype] of string = ('','data','ref','object');
+  HTMLshape : array [THTMLshape] of string = ('','default','rect','circle','poly');
+  HTMLinputtype : array [THTMLinputtype] of string = ('','text','password','checkbox',
+      'radio','submit','reset','file','hidden','image','button');
+  HTMLbuttontype : array [THTMLbuttontype] of string = ('','submit','reset','button');
+
+
+  // ISO8859-1 mapping:
+  HTMLEntities: array[#160..#255] of String = (
+    // 160-191
+    'nbsp', 'iexcl', 'cent', 'pound', 'curren', 'yen', 'brvbar', 'sect',
+    'uml', 'copy', 'ordf', 'laquo', 'not', 'shy', 'reg', 'macr',
+    'deg', 'plusmn', 'sup2', 'sup3', 'acute', 'micro', 'para', 'middot',
+    'cedil', 'sup1', 'ordm', 'raquo', 'frac14', 'frac12', 'frac34', 'iquest',
+    // 192-223
+    'Agrave', 'Aacute', 'Acirc', 'Atilde', 'Auml', 'Aring', 'AElig', 'Ccedil',
+    'Egrave', 'Eacute', 'Ecirc', 'Euml', 'Igrave', 'Iacute', 'Icirc', 'Iuml',
+    'ETH', 'Ntilde', 'Ograve', 'Oacute', 'Ocirc', 'Otilde', 'Ouml', 'times',
+    'Oslash', 'Ugrave', 'Uacute', 'Ucirc', 'Uuml', 'Yacute', 'THORN', 'szlig',
+    // 224-255
+    'agrave', 'aacute', 'acirc', 'atilde', 'auml', 'aring', 'aelig', 'ccedil',
+    'egrave', 'eacute', 'ecirc', 'euml', 'igrave', 'iacute', 'icirc', 'iuml',
+    'eth', 'ntilde', 'ograve', 'oacute', 'ocirc', 'otilde', 'ouml', 'divide',
+    'oslash', 'ugrave', 'uacute', 'ucirc', 'uuml', 'yacute', 'thorn', 'yuml');
+
+
+  UnicodeHTMLEntities: array[0..141] of String = (
+    'Alpha',    // #913
+    'Beta',     // #914
+    'Gamma',    // #915
+    'Delta',    // #916
+    'Epsilon',  // #917
+    'Zeta',     // #918
+    'Eta',      // #919
+    'Theta',    // #920
+    'Iota',     // #921
+    'Kappa',    // #922
+    'Lambda',   // #923
+    'Mu',       // #924
+    'Nu',       // #925
+    'Xi',       // #926
+    'Omicron',  // #927
+    'Pi',       // #928
+    'Rho',      // #929
+    'Sigma',    // #931
+    'Tau',      // #932
+    'Upsilon',  // #933
+    'Phi',      // #934
+    'Chi',      // #935
+    'Psi',      // #936
+    'Omega',    // #937
+    'alpha',    // #945
+    'beta',     // #946
+    'gamma',    // #947
+    'delta',    // #948
+    'epsilon',  // #949
+    'zeta',     // #950
+    'eta',      // #951
+    'theta',    // #952
+    'iota',     // #953
+    'kappa',    // #954
+    'lambda',   // #955
+    'mu',       // #956
+    'nu',       // #957
+    'xi',       // #958
+    'omicron',  // #959
+    'pi',       // #960
+    'rho',      // #961
+    'sigmaf',   // #962
+    'sigma',    // #963
+    'tau',      // #964
+    'upsilon',  // #965
+    'phi',      // #966
+    'chi',      // #967
+    'psi',      // #968
+    'omega',    // #969
+    'thetasym', // #977
+    'upsih',    // #978
+    'piv',      // #982
+    'ensp',     // #8194
+    'emsp',     // #8195
+    'thinsp',   // #8201
+    'zwnj',     // #8204
+    'zwj',      // #8205
+    'lrm',      // #8206
+    'rlm',      // #8207
+    'ndash',    // #8211
+    'mdash',    // #8212
+    'lsquo',    // #8216
+    'rsquo',    // #8217
+    'sbquo',    // #8218
+    'ldquo',    // #8220
+    'rdquo',    // #8221
+    'bdquo',    // #8222
+    'dagger',   // #8224
+    'Dagger',   // #8225
+    'bull',     // #8226
+    'hellip',   // #8230
+    'permil',   // #8240
+    'prime',    // #8242
+    'lsaquo',   // #8249
+    'rsaquo',   // #8250
+    'oline',    // #8254
+    'frasl',    // #8260
+    'image',    // #8465
+    'weierp',   // #8472
+    'real',     // #8476
+    'trade',    // #8482
+    'alefsym',  // #8501
+    'larr',     // #8592
+    'uarr',     // #8593
+    'rarr',     // #8594
+    'darr',     // #8595
+    'harr',     // #8596
+    'crarr',    // #8629
+    'lArr',     // #8656
+    'uArr',     // #8657
+    'rArr',     // #8658
+    'dArr',     // #8659
+    'hArr',     // #8660
+    'forall',   // #8704
+    'part',     // #8706
+    'exist',    // #8707
+    'empty',    // #8709
+    'nabla',    // #8711
+    'isin',     // #8712
+    'notin',    // #8713
+    'ni',       // #8715
+    'prod',     // #8719
+    'sum',      // #8721
+    'minus',    // #8722
+    'lowast',   // #8727
+    'radic',    // #8730
+    'prop',     // #8733
+    'infin',    // #8734
+    'ang',      // #8736
+    'and',      // #8743
+    'or',       // #8744
+    'cap',      // #8745
+    'cup',      // #8746
+    'int',      // #8747
+    'there4',   // #8756
+    'sim',      // #8764
+    'cong',     // #8773
+    'asymp',    // #8776
+    'ne',       // #8800
+    'equiv',    // #8801
+    'le',       // #8804
+    'ge',       // #8805
+    'sub',      // #8834
+    'sup',      // #8835
+    'nsub',     // #8836
+    'sube',     // #8838
+    'supe',     // #8839
+    'oplus',    // #8853
+    'otimes',   // #8855
+    'perp',     // #8869
+    'sdot',     // #8901
+    'lceil',    // #8968
+    'rceil',    // #8969
+    'lfloor',   // #8970
+    'rfloor',   // #8971
+    'lang',     // #9001
+    'rang',     // #9002
+    'loz',      // #9674
+    'spades',   // #9824
+    'clubs',    // #9827
+    'hearts',   // #9829
+    'diams'     // #9830
+  );
+
+
+
+function ResolveHTMLEntityReference(const Name: String;
+  var Entity: Char): Boolean;
+
+
+
+implementation
+
+uses SysUtils;
+
+function ResolveHTMLEntityReference(const Name: String;
+  var Entity: Char): Boolean;
+var
+  Ent: Char;
+  i: Integer;
+begin
+  if Name = 'quot' then
+  begin
+    Entity := '"';
+    Result := True;
+  end else if Name = 'apos' then
+  begin
+    Entity := '''';
+    Result := True;
+  end else if Name = 'amp' then
+  begin
+    Entity := '&';
+    Result := True;
+  end else if Name = 'lt' then
+  begin
+    Entity := '<';
+    Result := True;
+  end else if Name = 'gt' then
+  begin
+    Entity := '>';
+    Result := True;
+  end else if (Length(Name) > 0) and (Name[1] = '#') then
+  begin
+    for i := 2 to Length(Name) do
+      if (Name[i] < '0') or (Name[i] > '9') then
+        break;
+    if i > 2 then
+    begin
+      Entity := Chr(StrToInt(Copy(Name, 2, i - 1)));
+      Result := True;
+    end else
+      Result := False;
+  end else
+  begin
+    for Ent := Low(HTMLEntities) to High(HTMLEntities) do
+      if HTMLEntities[Ent] = Name then
+      begin
+        Entity := Ent;
+        Result := True;
+        exit;
+      end;
+    Result := False;
+  end;
+end;
+
+end.
+
+
+{
+  $Log: htmldefs.pp,v $
+  Revision 1.2  2006/01/03 23:33:23  lukvdl
+  + TH: properties forgotten added
+
+  Revision 1.1  2005/11/22 21:04:37  michael
+  + Initial import
+
+  Revision 1.4  2005/02/14 17:13:18  peter
+    * truncate log
+
+}

+ 1992 - 0
fcl/web/Makefile

@@ -0,0 +1,1992 @@
+#
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/08/20]
+#
+default: all
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince arm-gba powerpc64-linux
+BSDs = freebsd netbsd openbsd darwin
+UNIXs = linux $(BSDs) solaris qnx
+LIMIT83fs = go32v2 os2 emx watcom
+FORCE:
+.PHONY: FORCE
+override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH)))
+ifneq ($(findstring darwin,$(OSTYPE)),)
+inUnix=1 #darwin
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+ifeq ($(findstring ;,$(PATH)),)
+inUnix=1
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+SEARCHPATH:=$(subst ;, ,$(PATH))
+endif
+endif
+SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE))))
+PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))
+ifeq ($(PWD),)
+PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))
+ifeq ($(PWD),)
+$(error You need the GNU utils package to use this Makefile)
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=
+endif
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=.exe
+endif
+ifndef inUnix
+ifeq ($(OS),Windows_NT)
+inWinNT=1
+else
+ifdef OS2_SHELL
+inOS2=1
+endif
+endif
+else
+ifneq ($(findstring cygdrive,$(PATH)),)
+inCygWin=1
+endif
+endif
+ifdef inUnix
+SRCBATCHEXT=.sh
+else
+ifdef inOS2
+SRCBATCHEXT=.cmd
+else
+SRCBATCHEXT=.bat
+endif
+endif
+ifdef inUnix
+PATHSEP=/
+else
+PATHSEP:=$(subst /,\,/)
+ifdef inCygWin
+PATHSEP=/
+endif
+endif
+ifdef PWD
+BASEDIR:=$(subst \,/,$(shell $(PWD)))
+ifdef inCygWin
+ifneq ($(findstring /cygdrive/,$(BASEDIR)),)
+BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR))
+BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR)))
+BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR))
+endif
+endif
+else
+BASEDIR=.
+endif
+ifdef inOS2
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO=echo
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+endif
+override DEFAULT_FPCDIR=../..
+ifndef FPC
+ifdef PP
+FPC=$(PP)
+endif
+endif
+ifndef FPC
+FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
+ifneq ($(FPCPROG),)
+FPCPROG:=$(firstword $(FPCPROG))
+FPC:=$(shell $(FPCPROG) -PB)
+ifneq ($(findstring Error,$(FPC)),)
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
+else
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
+endif
+override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
+override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
+FOUNDFPC:=$(strip $(wildcard $(FPC)))
+ifeq ($(FOUNDFPC),)
+FOUNDFPC=$(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))
+ifeq ($(FOUNDFPC),)
+$(error Compiler $(FPC) not found)
+endif
+endif
+ifndef FPC_COMPILERINFO
+FPC_COMPILERINFO:=$(shell $(FPC) -iVSPTPSOTO)
+endif
+ifndef FPC_VERSION
+FPC_VERSION:=$(word 1,$(FPC_COMPILERINFO))
+endif
+export FPC FPC_VERSION FPC_COMPILERINFO
+unexport CHECKDEPEND ALLDEPENDENCIES
+ifndef CPU_TARGET
+ifdef CPU_TARGET_DEFAULT
+CPU_TARGET=$(CPU_TARGET_DEFAULT)
+endif
+endif
+ifndef OS_TARGET
+ifdef OS_TARGET_DEFAULT
+OS_TARGET=$(OS_TARGET_DEFAULT)
+endif
+endif
+ifneq ($(words $(FPC_COMPILERINFO)),5)
+FPC_COMPILERINFO+=$(shell $(FPC) -iSP)
+FPC_COMPILERINFO+=$(shell $(FPC) -iTP)
+FPC_COMPILERINFO+=$(shell $(FPC) -iSO)
+FPC_COMPILERINFO+=$(shell $(FPC) -iTO)
+endif
+ifndef CPU_SOURCE
+CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO))
+endif
+ifndef CPU_TARGET
+CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO))
+endif
+ifndef OS_SOURCE
+OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO))
+endif
+ifndef OS_TARGET
+OS_TARGET:=$(word 5,$(FPC_COMPILERINFO))
+endif
+FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
+FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
+ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
+TARGETSUFFIX=$(OS_TARGET)
+SOURCESUFFIX=$(OS_SOURCE)
+else
+TARGETSUFFIX=$(FULL_TARGET)
+SOURCESUFFIX=$(FULL_SOURCE)
+endif
+ifneq ($(FULL_TARGET),$(FULL_SOURCE))
+CROSSCOMPILE=1
+endif
+ifeq ($(findstring makefile,$(MAKECMDGOALS)),)
+ifeq ($(findstring $(FULL_TARGET),$(MAKEFILETARGETS)),)
+$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first)
+endif
+endif
+ifneq ($(findstring $(OS_TARGET),$(BSDs)),)
+BSDhier=1
+endif
+ifeq ($(OS_TARGET),linux)
+linuxHier=1
+endif
+export OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE
+ifdef FPCDIR
+override FPCDIR:=$(subst \,/,$(FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+else
+override FPCDIR=wrong
+endif
+ifdef DEFAULT_FPCDIR
+ifeq ($(FPCDIR),wrong)
+override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+endif
+endif
+ifeq ($(FPCDIR),wrong)
+ifdef inUnix
+override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
+ifeq ($(wildcard $(FPCDIR)/units),)
+override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
+endif
+else
+override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(BASEDIR)
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=c:/pp
+endif
+endif
+endif
+endif
+endif
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX))
+endif
+ifndef BINUTILSPREFIX
+ifndef CROSSBINDIR
+ifdef CROSSCOMPILE
+BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)-
+endif
+endif
+endif
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX))
+ifeq ($(UNITSDIR),)
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
+endif
+PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
+override PACKAGE_NAME=fcl
+PACKAGEDIR_MAIN:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR))))))
+ifeq ($(FULL_TARGET),i386-linux)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override TARGET_UNITS+=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb htmlelements  htmlwriter webutil fpdatasetform
+endif
+ifeq ($(FULL_TARGET),i386-linux)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override TARGET_RSTS+=fpcgi fphtml fpweb htmlwriter websession
+endif
+override INSTALL_FPCPACKAGE=y
+ifeq ($(FULL_TARGET),i386-linux)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override COMPILER_OPTIONS+=-S2
+endif
+ifdef REQUIRE_UNITSDIR
+override UNITSDIR+=$(REQUIRE_UNITSDIR)
+endif
+ifdef REQUIRE_PACKAGESDIR
+override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR)
+endif
+ifdef ZIPINSTALL
+ifneq ($(findstring $(OS_TARGET),$(UNIXs)),)
+UNIXHier=1
+endif
+else
+ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),)
+UNIXHier=1
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef PREFIX
+INSTALL_PREFIX=$(PREFIX)
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef UNIXHier
+INSTALL_PREFIX=/usr/local
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=/pp
+else
+INSTALL_BASEDIR:=/$(PACKAGE_NAME)
+endif
+endif
+endif
+export INSTALL_PREFIX
+ifdef INSTALL_FPCSUBDIR
+export INSTALL_FPCSUBDIR
+endif
+ifndef DIST_DESTDIR
+DIST_DESTDIR:=$(BASEDIR)
+endif
+export DIST_DESTDIR
+ifndef COMPILER_UNITTARGETDIR
+ifdef PACKAGEDIR_MAIN
+COMPILER_UNITTARGETDIR=$(PACKAGEDIR_MAIN)/units/$(TARGETSUFFIX)
+else
+COMPILER_UNITTARGETDIR=units/$(TARGETSUFFIX)
+endif
+endif
+ifndef COMPILER_TARGETDIR
+COMPILER_TARGETDIR=.
+endif
+ifndef INSTALL_BASEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION)
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME)
+endif
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)
+endif
+endif
+ifndef INSTALL_BINDIR
+ifdef UNIXHier
+INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin
+else
+INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin
+ifdef INSTALL_FPCPACKAGE
+ifdef CROSSCOMPILE
+ifdef CROSSINSTALL
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(SOURCESUFFIX)
+else
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
+endif
+else
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
+endif
+endif
+endif
+endif
+ifndef INSTALL_UNITDIR
+INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX)
+ifdef INSTALL_FPCPACKAGE
+ifdef PACKAGE_NAME
+INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME)
+endif
+endif
+endif
+ifndef INSTALL_LIBDIR
+ifdef UNIXHier
+INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib
+else
+INSTALL_LIBDIR:=$(INSTALL_UNITDIR)
+endif
+endif
+ifndef INSTALL_SOURCEDIR
+ifdef UNIXHier
+ifdef BSDhier
+SRCPREFIXDIR=share/src
+else
+ifdef linuxHier
+SRCPREFIXDIR=share/src
+else
+SRCPREFIXDIR=src
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source
+endif
+endif
+endif
+ifndef INSTALL_DOCDIR
+ifdef UNIXHier
+ifdef BSDhier
+DOCPREFIXDIR=share/doc
+else
+ifdef linuxHier
+DOCPREFIXDIR=share/doc
+else
+DOCPREFIXDIR=doc
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc
+endif
+endif
+endif
+ifndef INSTALL_EXAMPLEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME)
+endif
+endif
+else
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+endif
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples
+endif
+endif
+endif
+ifndef INSTALL_DATADIR
+INSTALL_DATADIR=$(INSTALL_BASEDIR)
+endif
+ifndef INSTALL_SHAREDDIR
+INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib
+endif
+ifdef CROSSCOMPILE
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX))
+ifeq ($(CROSSBINDIR),)
+CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE))
+endif
+endif
+else
+CROSSBINDIR=
+endif
+BATCHEXT=.bat
+LOADEREXT=.as
+EXEEXT=.exe
+PPLEXT=.ppl
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.so
+SHAREDLIBPREFIX=libfp
+STATICLIBPREFIX=libp
+IMPORTLIBPREFIX=libimp
+RSTEXT=.rst
+ifeq ($(findstring 1.0.,$(FPC_VERSION)),)
+ifeq ($(OS_TARGET),go32v1)
+STATICLIBPREFIX=
+SHORTSUFFIX=v1
+endif
+ifeq ($(OS_TARGET),go32v2)
+STATICLIBPREFIX=
+SHORTSUFFIX=dos
+endif
+ifeq ($(OS_TARGET),watcom)
+STATICLIBPREFIX=
+OEXT=.obj
+ASMEXT=.asm
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=wat
+endif
+ifeq ($(OS_TARGET),linux)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
+ifeq ($(OS_TARGET),freebsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=fbs
+endif
+ifeq ($(OS_TARGET),netbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=nbs
+endif
+ifeq ($(OS_TARGET),openbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=obs
+endif
+ifeq ($(OS_TARGET),win32)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=w32
+endif
+ifeq ($(OS_TARGET),os2)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=os2
+ECHO=echo
+endif
+ifeq ($(OS_TARGET),emx)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=emx
+ECHO=echo
+endif
+ifeq ($(OS_TARGET),amiga)
+EXEEXT=
+SHAREDLIBEXT=.library
+SHORTSUFFIX=amg
+endif
+ifeq ($(OS_TARGET),morphos)
+EXEEXT=
+SHAREDLIBEXT=.library
+SHORTSUFFIX=mos
+endif
+ifeq ($(OS_TARGET),atari)
+EXEEXT=.ttp
+SHORTSUFFIX=ata
+endif
+ifeq ($(OS_TARGET),beos)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=be
+endif
+ifeq ($(OS_TARGET),solaris)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=sun
+endif
+ifeq ($(OS_TARGET),qnx)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=qnx
+endif
+ifeq ($(OS_TARGET),netware)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+SHORTSUFFIX=nw
+endif
+ifeq ($(OS_TARGET),netwlibc)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+SHORTSUFFIX=nwl
+endif
+ifeq ($(OS_TARGET),macos)
+BATCHEXT=
+EXEEXT=
+DEBUGSYMEXT=.xcoff
+SHORTSUFFIX=mac
+endif
+ifeq ($(OS_TARGET),darwin)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=dwn
+endif
+ifeq ($(OS_TARGET),gba)
+EXEEXT=.gba
+SHAREDLIBEXT=.so
+SHORTSUFFIX=gba
+endif
+else
+ifeq ($(OS_TARGET),go32v1)
+PPUEXT=.pp1
+OEXT=.o1
+ASMEXT=.s1
+SMARTEXT=.sl1
+STATICLIBEXT=.a1
+SHAREDLIBEXT=.so1
+STATICLIBPREFIX=
+SHORTSUFFIX=v1
+endif
+ifeq ($(OS_TARGET),go32v2)
+STATICLIBPREFIX=
+SHORTSUFFIX=dos
+endif
+ifeq ($(OS_TARGET),watcom)
+STATICLIBPREFIX=
+SHORTSUFFIX=wat
+endif
+ifeq ($(OS_TARGET),linux)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
+ifeq ($(OS_TARGET),freebsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=fbs
+endif
+ifeq ($(OS_TARGET),netbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=nbs
+endif
+ifeq ($(OS_TARGET),openbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=obs
+endif
+ifeq ($(OS_TARGET),win32)
+PPUEXT=.ppw
+OEXT=.ow
+ASMEXT=.sw
+SMARTEXT=.slw
+STATICLIBEXT=.aw
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=w32
+endif
+ifeq ($(OS_TARGET),os2)
+BATCHEXT=.cmd
+PPUEXT=.ppo
+ASMEXT=.so2
+OEXT=.oo2
+AOUTEXT=.out
+SMARTEXT=.sl2
+STATICLIBPREFIX=
+STATICLIBEXT=.ao2
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=os2
+ECHO=echo
+endif
+ifeq ($(OS_TARGET),amiga)
+EXEEXT=
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.library
+SHORTSUFFIX=amg
+endif
+ifeq ($(OS_TARGET),atari)
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=.ttp
+SHORTSUFFIX=ata
+endif
+ifeq ($(OS_TARGET),beos)
+BATCHEXT=.sh
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+SHORTSUFFIX=be
+endif
+ifeq ($(OS_TARGET),solaris)
+BATCHEXT=.sh
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+SHORTSUFFIX=sun
+endif
+ifeq ($(OS_TARGET),qnx)
+BATCHEXT=.sh
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+SHORTSUFFIX=qnx
+endif
+ifeq ($(OS_TARGET),netware)
+STATICLIBPREFIX=
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.nlm
+EXEEXT=.nlm
+SHORTSUFFIX=nw
+endif
+ifeq ($(OS_TARGET),netwlibc)
+STATICLIBPREFIX=
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.nlm
+EXEEXT=.nlm
+SHORTSUFFIX=nwl
+endif
+ifeq ($(OS_TARGET),macos)
+BATCHEXT=
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+DEBUGSYMEXT=.xcoff
+SHORTSUFFIX=mac
+endif
+endif
+ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
+FPCMADE=fpcmade.$(SHORTSUFFIX)
+ZIPSUFFIX=$(SHORTSUFFIX)
+ZIPCROSSPREFIX=
+ZIPSOURCESUFFIX=src
+ZIPEXAMPLESUFFIX=exm
+else
+FPCMADE=fpcmade.$(TARGETSUFFIX)
+ZIPSOURCESUFFIX=.source
+ZIPEXAMPLESUFFIX=.examples
+ifdef CROSSCOMPILE
+ZIPSUFFIX=.$(SOURCESUFFIX)
+ZIPCROSSPREFIX=$(TARGETSUFFIX)-
+else
+ZIPSUFFIX=.$(TARGETSUFFIX)
+ZIPCROSSPREFIX=
+endif
+endif
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO= __missing_command_ECHO
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+ifndef DATE
+DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE= __missing_command_DATE
+else
+DATE:=$(firstword $(DATE))
+endif
+else
+DATE:=$(firstword $(DATE))
+endif
+endif
+export DATE
+ifndef GINSTALL
+GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL= __missing_command_GINSTALL
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+endif
+export GINSTALL
+ifndef CPPROG
+CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(CPPROG),)
+CPPROG= __missing_command_CPPROG
+else
+CPPROG:=$(firstword $(CPPROG))
+endif
+endif
+export CPPROG
+ifndef RMPROG
+RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(RMPROG),)
+RMPROG= __missing_command_RMPROG
+else
+RMPROG:=$(firstword $(RMPROG))
+endif
+endif
+export RMPROG
+ifndef MVPROG
+MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MVPROG),)
+MVPROG= __missing_command_MVPROG
+else
+MVPROG:=$(firstword $(MVPROG))
+endif
+endif
+export MVPROG
+ifndef MKDIRPROG
+MKDIRPROG:=$(strip $(wildcard $(addsuffix /gmkdir$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MKDIRPROG),)
+MKDIRPROG:=$(strip $(wildcard $(addsuffix /mkdir$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MKDIRPROG),)
+MKDIRPROG= __missing_command_MKDIRPROG
+else
+MKDIRPROG:=$(firstword $(MKDIRPROG))
+endif
+else
+MKDIRPROG:=$(firstword $(MKDIRPROG))
+endif
+endif
+export MKDIRPROG
+ifndef ECHOREDIR
+ifndef inUnix
+ECHOREDIR=echo
+else
+ECHOREDIR=$(ECHO)
+endif
+endif
+ifndef COPY
+COPY:=$(CPPROG) -fp
+endif
+ifndef COPYTREE
+COPYTREE:=$(CPPROG) -Rfp
+endif
+ifndef MKDIRTREE
+MKDIRTREE:=$(MKDIRPROG) -p
+endif
+ifndef MOVE
+MOVE:=$(MVPROG) -f
+endif
+ifndef DEL
+DEL:=$(RMPROG) -f
+endif
+ifndef DELTREE
+DELTREE:=$(RMPROG) -rf
+endif
+ifndef INSTALL
+ifdef inUnix
+INSTALL:=$(GINSTALL) -c -m 644
+else
+INSTALL:=$(COPY)
+endif
+endif
+ifndef INSTALLEXE
+ifdef inUnix
+INSTALLEXE:=$(GINSTALL) -c -m 755
+else
+INSTALLEXE:=$(COPY)
+endif
+endif
+ifndef MKDIR
+MKDIR:=$(GINSTALL) -m 755 -d
+endif
+export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
+ifndef PPUMOVE
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUMOVE),)
+PPUMOVE= __missing_command_PPUMOVE
+else
+PPUMOVE:=$(firstword $(PPUMOVE))
+endif
+endif
+export PPUMOVE
+ifndef FPCMAKE
+FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(FPCMAKE),)
+FPCMAKE= __missing_command_FPCMAKE
+else
+FPCMAKE:=$(firstword $(FPCMAKE))
+endif
+endif
+export FPCMAKE
+ifndef ZIPPROG
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ZIPPROG),)
+ZIPPROG= __missing_command_ZIPPROG
+else
+ZIPPROG:=$(firstword $(ZIPPROG))
+endif
+endif
+export ZIPPROG
+ifndef TARPROG
+TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG= __missing_command_TARPROG
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+endif
+export TARPROG
+ASNAME=$(BINUTILSPREFIX)as
+LDNAME=$(BINUTILSPREFIX)ld
+ARNAME=$(BINUTILSPREFIX)ar
+RCNAME=$(BINUTILSPREFIX)rc
+ifneq ($(findstring 1.0.,$(FPC_VERSION)),)
+ifeq ($(OS_TARGET),win32)
+ifeq ($(CROSSBINDIR),)
+ASNAME=asw
+LDNAME=ldw
+ARNAME=arw
+endif
+endif
+endif
+ifndef ASPROG
+ifdef CROSSBINDIR
+ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT)
+else
+ASPROG=$(ASNAME)
+endif
+endif
+ifndef LDPROG
+ifdef CROSSBINDIR
+LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT)
+else
+LDPROG=$(LDNAME)
+endif
+endif
+ifndef RCPROG
+ifdef CROSSBINDIR
+RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT)
+else
+RCPROG=$(RCNAME)
+endif
+endif
+ifndef ARPROG
+ifdef CROSSBINDIR
+ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT)
+else
+ARPROG=$(ARNAME)
+endif
+endif
+AS=$(ASPROG)
+LD=$(LDPROG)
+RC=$(RCPROG)
+AR=$(ARPROG)
+PPAS=ppas$(SRCBATCHEXT)
+ifdef inUnix
+LDCONFIG=ldconfig
+else
+LDCONFIG=
+endif
+ifdef DATE
+DATESTR:=$(shell $(DATE) +%Y%m%d)
+else
+DATESTR=
+endif
+ifndef UPXPROG
+ifeq ($(OS_TARGET),go32v2)
+UPXPROG:=1
+endif
+ifeq ($(OS_TARGET),win32)
+UPXPROG:=1
+endif
+ifdef UPXPROG
+UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(UPXPROG),)
+UPXPROG=
+else
+UPXPROG:=$(firstword $(UPXPROG))
+endif
+else
+UPXPROG=
+endif
+endif
+export UPXPROG
+ZIPOPT=-9
+ZIPEXT=.zip
+ifeq ($(USETAR),bz2)
+TAROPT=vj
+TAREXT=.tar.bz2
+else
+TAROPT=vz
+TAREXT=.tar.gz
+endif
+override REQUIRE_PACKAGES=rtl 
+ifeq ($(FULL_TARGET),i386-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifdef REQUIRE_PACKAGES_RTL
+PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_RTL),)
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),)
+UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)
+else
+UNITDIR_RTL=$(PACKAGEDIR_RTL)
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_RTL)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_RTL) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_RTL)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_RTL=
+UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_RTL),)
+UNITDIR_RTL:=$(firstword $(UNITDIR_RTL))
+else
+UNITDIR_RTL=
+endif
+endif
+ifdef UNITDIR_RTL
+override COMPILER_UNITDIR+=$(UNITDIR_RTL)
+endif
+endif
+ifndef NOCPUDEF
+override FPCOPTDEF=$(CPU_TARGET)
+endif
+ifneq ($(OS_TARGET),$(OS_SOURCE))
+override FPCOPT+=-T$(OS_TARGET)
+endif
+ifneq ($(CPU_TARGET),$(CPU_SOURCE))
+override FPCOPT+=-P$(CPU_TARGET)
+endif
+ifeq ($(OS_SOURCE),openbsd)
+override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
+endif
+ifndef CROSSBOOTSTRAP
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-XP$(BINUTILSPREFIX) -Xc
+endif
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-Xr$(RLINKPATH)
+endif
+endif
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+endif
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+endif
+ifdef LINKSMART
+override FPCOPT+=-XX
+endif
+ifdef CREATESMART
+override FPCOPT+=-CX
+endif
+ifdef DEBUG
+override FPCOPT+=-gl
+override FPCOPTDEF+=DEBUG
+endif
+ifdef RELEASE
+ifneq ($(findstring 2.0.,$(FPC_VERSION)),)
+ifeq ($(CPU_TARGET),i386)
+FPCCPUOPT:=-OG2p3
+endif
+ifeq ($(CPU_TARGET),powerpc)
+FPCCPUOPT:=-O1r
+endif
+else
+FPCCPUOPT:=-O1r
+endif
+override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n
+override FPCOPTDEF+=RELEASE
+endif
+ifdef STRIP
+override FPCOPT+=-Xs
+endif
+ifdef OPTIMIZE
+override FPCOPT+=-O2
+endif
+ifdef VERBOSE
+override FPCOPT+=-vwni
+endif
+ifdef COMPILER_OPTIONS
+override FPCOPT+=$(COMPILER_OPTIONS)
+endif
+ifdef COMPILER_UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR))
+endif
+ifdef COMPILER_LIBRARYDIR
+override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR))
+endif
+ifdef COMPILER_OBJECTDIR
+override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR))
+endif
+ifdef COMPILER_INCLUDEDIR
+override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR))
+endif
+ifdef CROSSBINDIR
+override FPCOPT+=-FD$(CROSSBINDIR)
+endif
+ifdef COMPILER_TARGETDIR
+override FPCOPT+=-FE$(COMPILER_TARGETDIR)
+ifeq ($(COMPILER_TARGETDIR),.)
+override TARGETDIRPREFIX=
+else
+override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/
+endif
+endif
+ifdef COMPILER_UNITTARGETDIR
+override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR)
+ifeq ($(COMPILER_UNITTARGETDIR),.)
+override UNITTARGETDIRPREFIX=
+else
+override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/
+endif
+else
+ifdef COMPILER_TARGETDIR
+override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR)
+override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
+endif
+endif
+ifdef CREATESHARED
+override FPCOPT+=-Cg
+ifeq ($(CPU_TARGET),i386)
+override FPCOPT+=-Aas
+endif
+endif
+ifdef LINKSHARED
+endif
+ifdef OPT
+override FPCOPT+=$(OPT)
+endif
+ifdef FPCOPTDEF
+override FPCOPT+=$(addprefix -d,$(FPCOPTDEF))
+endif
+ifdef CFGFILE
+override FPCOPT+=@$(CFGFILE)
+endif
+ifdef USEENV
+override FPCEXTCMD:=$(FPCOPT)
+override FPCOPT:=!FPCEXTCMD
+export FPCEXTCMD
+endif
+override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
+override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
+ifneq ($(AFULL_TARGET),$(AFULL_SOURCE))
+override ACROSSCOMPILE=1
+endif
+ifdef ACROSSCOMPILE
+override FPCOPT+=$(CROSSOPT)
+endif
+override COMPILER:=$(FPC) $(FPCOPT)
+ifeq (,$(findstring -s ,$(COMPILER)))
+EXECPPAS=
+else
+ifeq ($(FULL_SOURCE),$(FULL_TARGET))
+EXECPPAS:=@$(PPAS)
+endif
+endif
+.PHONY: fpc_units
+ifneq ($(TARGET_UNITS),)
+override ALLTARGET+=fpc_units
+override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS))
+override IMPLICITUNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_IMPLICITUNITS))
+override INSTALLPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)
+override CLEANPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)
+endif
+fpc_units: $(COMPILER_UNITTARGETDIR) $(UNITPPUFILES)
+ifdef TARGET_RSTS
+override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS))
+override CLEANRSTFILES+=$(RSTFILES)
+endif
+.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared
+$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET)
+	@$(ECHOREDIR) Compiled > $(FPCMADE)
+fpc_all: $(FPCMADE)
+fpc_smart:
+	$(MAKE) all LINKSMART=1 CREATESMART=1
+fpc_debug:
+	$(MAKE) all DEBUG=1
+fpc_release:
+	$(MAKE) all RELEASE=1
+.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res
+$(COMPILER_UNITTARGETDIR):
+	$(MKDIRTREE) $(COMPILER_UNITTARGETDIR)
+$(COMPILER_TARGETDIR):
+	$(MKDIRTREE) $(COMPILER_TARGETDIR)
+%$(PPUEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(PPUEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.lpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.dpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%.res: %.rc
+	windres -i $< -o $@
+vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %$(OEXT) $(COMPILER_UNITTARGETDIR)
+vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
+.PHONY: fpc_shared
+override INSTALLTARGET+=fpc_shared_install
+ifndef SHARED_LIBVERSION
+SHARED_LIBVERSION=$(FPC_VERSION)
+endif
+ifndef SHARED_LIBNAME
+SHARED_LIBNAME=$(PACKAGE_NAME)
+endif
+ifndef SHARED_FULLNAME
+SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT)
+endif
+ifndef SHARED_LIBUNITS
+SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS)
+override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS))
+endif
+fpc_shared:
+ifdef HASSHAREDLIB
+	$(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1
+ifneq ($(SHARED_BUILD),n)
+	$(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR)
+endif
+else
+	@$(ECHO) Shared Libraries not supported
+endif
+fpc_shared_install:
+ifneq ($(SHARED_BUILD),n)
+ifneq ($(SHARED_LIBUNITS),)
+ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),)
+	$(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR)
+endif
+endif
+endif
+.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
+ifdef INSTALL_UNITS
+override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
+endif
+ifdef INSTALL_BUILDUNIT
+override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES))
+endif
+ifdef INSTALLPPUFILES
+override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
+ifneq ($(UNITTARGETDIRPREFIX),)
+override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES)))
+override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES))))
+endif
+override INSTALL_CREATEPACKAGEFPC=1
+endif
+ifdef INSTALLEXEFILES
+ifneq ($(TARGETDIRPREFIX),)
+override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES)))
+endif
+endif
+fpc_install: all $(INSTALLTARGET)
+ifdef INSTALLEXEFILES
+	$(MKDIR) $(INSTALL_BINDIR)
+ifdef UPXPROG
+	-$(UPXPROG) $(INSTALLEXEFILES)
+endif
+	$(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
+endif
+ifdef INSTALL_CREATEPACKAGEFPC
+ifdef FPCMAKE
+ifdef PACKAGE_VERSION
+ifneq ($(wildcard Makefile.fpc),)
+	$(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) Package.fpc $(INSTALL_UNITDIR)
+endif
+endif
+endif
+endif
+ifdef INSTALLPPUFILES
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR)
+ifneq ($(INSTALLPPULINKFILES),)
+	$(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR)
+endif
+ifneq ($(wildcard $(LIB_FULLNAME)),)
+	$(MKDIR) $(INSTALL_LIBDIR)
+	$(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR)
+ifdef inUnix
+	ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME)
+endif
+endif
+endif
+ifdef INSTALL_FILES
+	$(MKDIR) $(INSTALL_DATADIR)
+	$(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR)
+endif
+fpc_sourceinstall: distclean
+	$(MKDIR) $(INSTALL_SOURCEDIR)
+	$(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR)
+fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))
+ifdef HASEXAMPLES
+	$(MKDIR) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef EXAMPLESOURCEFILES
+	$(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR)
+endif
+.PHONY: fpc_clean fpc_cleanall fpc_distclean
+ifdef EXEFILES
+override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
+endif
+ifdef CLEAN_UNITS
+override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS))
+endif
+ifdef CLEANPPUFILES
+override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))
+ifdef DEBUGSYMEXT
+override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES))
+endif
+override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
+override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)))
+endif
+fpc_clean: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+ifdef CLEAN_FILES
+	-$(DEL) $(CLEAN_FILES)
+endif
+ifdef LIB_NAME
+	-$(DEL) $(LIB_NAME) $(LIB_FULLNAME)
+endif
+	-$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT)
+fpc_cleanall: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef COMPILER_UNITTARGETDIR
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+endif
+	-$(DELTREE) units
+	-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
+ifneq ($(PPUEXT),.ppu)
+	-$(DEL) *.o *.ppu *.a
+endif
+	-$(DELTREE) *$(SMARTEXT)
+	-$(DEL) fpcmade.* Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *_ppas$(BATCHEXT)
+ifdef AOUTEXT
+	-$(DEL) *$(AOUTEXT)
+endif
+ifdef DEBUGSYMEXT
+	-$(DEL) *$(DEBUGSYMEXT)
+endif
+fpc_distclean: cleanall
+.PHONY: fpc_baseinfo
+override INFORULES+=fpc_baseinfo
+fpc_baseinfo:
+	@$(ECHO)
+	@$(ECHO)  == Package info ==
+	@$(ECHO)  Package Name..... $(PACKAGE_NAME)
+	@$(ECHO)  Package Version.. $(PACKAGE_VERSION)
+	@$(ECHO)
+	@$(ECHO)  == Configuration info ==
+	@$(ECHO)
+	@$(ECHO)  FPC.......... $(FPC)
+	@$(ECHO)  FPC Version.. $(FPC_VERSION)
+	@$(ECHO)  Source CPU... $(CPU_SOURCE)
+	@$(ECHO)  Target CPU... $(CPU_TARGET)
+	@$(ECHO)  Source OS.... $(OS_SOURCE)
+	@$(ECHO)  Target OS.... $(OS_TARGET)
+	@$(ECHO)  Full Source.. $(FULL_SOURCE)
+	@$(ECHO)  Full Target.. $(FULL_TARGET)
+	@$(ECHO)  SourceSuffix. $(SOURCESUFFIX)
+	@$(ECHO)  TargetSuffix. $(TARGETSUFFIX)
+	@$(ECHO)
+	@$(ECHO)  == Directory info ==
+	@$(ECHO)
+	@$(ECHO)  Required pkgs... $(REQUIRE_PACKAGES)
+	@$(ECHO)
+	@$(ECHO)  Basedir......... $(BASEDIR)
+	@$(ECHO)  FPCDir.......... $(FPCDIR)
+	@$(ECHO)  CrossBinDir..... $(CROSSBINDIR)
+	@$(ECHO)  UnitsDir........ $(UNITSDIR)
+	@$(ECHO)  PackagesDir..... $(PACKAGESDIR)
+	@$(ECHO)
+	@$(ECHO)  GCC library..... $(GCCLIBDIR)
+	@$(ECHO)  Other library... $(OTHERLIBDIR)
+	@$(ECHO)
+	@$(ECHO)  == Tools info ==
+	@$(ECHO)
+	@$(ECHO)  As........ $(AS)
+	@$(ECHO)  Ld........ $(LD)
+	@$(ECHO)  Ar........ $(AR)
+	@$(ECHO)  Rc........ $(RC)
+	@$(ECHO)
+	@$(ECHO)  Mv........ $(MVPROG)
+	@$(ECHO)  Cp........ $(CPPROG)
+	@$(ECHO)  Rm........ $(RMPROG)
+	@$(ECHO)  GInstall.. $(GINSTALL)
+	@$(ECHO)  Echo...... $(ECHO)
+	@$(ECHO)  Shell..... $(SHELL)
+	@$(ECHO)  Date...... $(DATE)
+	@$(ECHO)  FPCMake... $(FPCMAKE)
+	@$(ECHO)  PPUMove... $(PPUMOVE)
+	@$(ECHO)  Upx....... $(UPXPROG)
+	@$(ECHO)  Zip....... $(ZIPPROG)
+	@$(ECHO)
+	@$(ECHO)  == Object info ==
+	@$(ECHO)
+	@$(ECHO)  Target Loaders........ $(TARGET_LOADERS)
+	@$(ECHO)  Target Units.......... $(TARGET_UNITS)
+	@$(ECHO)  Target Implicit Units. $(TARGET_IMPLICITUNITS)
+	@$(ECHO)  Target Programs....... $(TARGET_PROGRAMS)
+	@$(ECHO)  Target Dirs........... $(TARGET_DIRS)
+	@$(ECHO)  Target Examples....... $(TARGET_EXAMPLES)
+	@$(ECHO)  Target ExampleDirs.... $(TARGET_EXAMPLEDIRS)
+	@$(ECHO)
+	@$(ECHO)  Clean Units......... $(CLEAN_UNITS)
+	@$(ECHO)  Clean Files......... $(CLEAN_FILES)
+	@$(ECHO)
+	@$(ECHO)  Install Units....... $(INSTALL_UNITS)
+	@$(ECHO)  Install Files....... $(INSTALL_FILES)
+	@$(ECHO)
+	@$(ECHO)  == Install info ==
+	@$(ECHO)
+	@$(ECHO)  DateStr.............. $(DATESTR)
+	@$(ECHO)  ZipName.............. $(ZIPNAME)
+	@$(ECHO)  ZipPrefix............ $(ZIPPREFIX)
+	@$(ECHO)  ZipCrossPrefix....... $(ZIPCROSSPREFIX)
+	@$(ECHO)  ZipSuffix............ $(ZIPSUFFIX)
+	@$(ECHO)  FullZipName.......... $(FULLZIPNAME)
+	@$(ECHO)  Install FPC Package.. $(INSTALL_FPCPACKAGE)
+	@$(ECHO)
+	@$(ECHO)  Install base dir..... $(INSTALL_BASEDIR)
+	@$(ECHO)  Install binary dir... $(INSTALL_BINDIR)
+	@$(ECHO)  Install library dir.. $(INSTALL_LIBDIR)
+	@$(ECHO)  Install units dir.... $(INSTALL_UNITDIR)
+	@$(ECHO)  Install source dir... $(INSTALL_SOURCEDIR)
+	@$(ECHO)  Install doc dir...... $(INSTALL_DOCDIR)
+	@$(ECHO)  Install example dir.. $(INSTALL_EXAMPLEDIR)
+	@$(ECHO)  Install data dir..... $(INSTALL_DATADIR)
+	@$(ECHO)
+	@$(ECHO)  Dist destination dir. $(DIST_DESTDIR)
+	@$(ECHO)  Dist zip name........ $(DIST_ZIPNAME)
+	@$(ECHO)
+.PHONY: fpc_info
+fpc_info: $(INFORULES)
+.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \
+	fpc_makefile_dirs
+fpc_makefile:
+	$(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc
+fpc_makefile_sub1:
+ifdef TARGET_DIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS))
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS))
+endif
+fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
+fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
+fpc_makefiles: fpc_makefile fpc_makefile_dirs
+all: fpc_all
+debug: fpc_debug
+smart: fpc_smart
+release: fpc_release
+units: fpc_units
+examples:
+shared: fpc_shared
+install: fpc_install
+sourceinstall: fpc_sourceinstall
+exampleinstall: fpc_exampleinstall
+distinstall:
+zipinstall:
+zipsourceinstall:
+zipexampleinstall:
+zipdistinstall:
+clean: fpc_clean
+distclean: fpc_distclean
+cleanall: fpc_cleanall
+info: fpc_info
+makefiles: fpc_makefiles
+.PHONY: all debug smart release units examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles
+ifneq ($(wildcard fpcmake.loc),)
+include fpcmake.loc
+endif

+ 21 - 0
fcl/web/Makefile.fpc

@@ -0,0 +1,21 @@
+#
+#   Makefile.fpc for TDataSet for FCL
+#
+
+[package]
+main=fcl
+
+[target]
+units=httpdefs fphttp custcgi fpcgi fptemplate fphtml websession fpweb \
+      htmlelements  htmlwriter webutil fpdatasetform
+rsts=fpcgi fphtml fpweb htmlwriter websession
+
+[compiler]
+options=-S2
+
+[install]
+fpcpackage=y
+
+[default]
+fpcdir=../..
+

+ 626 - 0
fcl/web/custcgi.pp

@@ -0,0 +1,626 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2000 by the Free Pascal development team
+
+    TCGIApplication class.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    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.
+
+ **********************************************************************}
+{$define CGIDEBUG}
+{$mode objfpc}
+{$H+}
+
+unit custcgi;
+
+Interface
+
+uses
+  CustApp,Classes,SysUtils, httpdefs;
+
+Const
+  CGIVarCount = 34;
+
+Type
+  TCGIVarArray = Array[1..CGIVarCount] of String;
+
+Const
+  CgiVarNames : TCGIVarArray =
+   ({ 1  } 'AUTH_TYPE',
+    { 2  } 'CONTENT_LENGTH',
+    { 3  } 'CONTENT_TYPE',
+    { 4  } 'GATEWAY_INTERFACE',
+    { 5  } 'PATH_INFO',
+    { 6  } 'PATH_TRANSLATED',
+    { 7  } 'QUERY_STRING',
+    { 8  } 'REMOTE_ADDR',
+    { 9  } 'REMOTE_HOST',
+    { 10 } 'REMOTE_IDENT',
+    { 11 } 'REMOTE_USER',
+    { 12 } 'REQUEST_METHOD',
+    { 13 } 'SCRIPT_NAME',
+    { 14 } 'SERVER_NAME',
+    { 15 } 'SERVER_PORT',
+    { 16 } 'SERVER_PROTOCOL',
+    { 17 } 'SERVER_SOFTWARE',
+    { 18 } 'HTTP_ACCEPT',
+    { 19 } 'HTTP_ACCEPT_CHARSET',
+    { 20 } 'HTTP_ACCEPT_ENCODING',
+    { 21 } 'HTTP_IF_MODIFIED_SINCE',
+    { 22 } 'HTTP_REFERER',
+    { 23 } 'HTTP_USER_AGENT',
+    { 24 } 'HTTP_COOKIE',
+     // Additional Apache vars
+    { 24 } 'HTTP_CONNECTION',
+    { 25 } 'HTTP_ACCEPT_LANGUAGE',
+    { 26 } 'HTTP_HOST',
+    { 27 } 'SERVER_SIGNATURE',
+    { 28 } 'SERVER_ADDR',
+    { 29 } 'DOCUMENT_ROOT',
+    { 30 } 'SERVER_ADMIN',
+    { 31 } 'SCRIPT_FILENAME',
+    { 32 } 'REMOTE_PORT',
+    { 33 } 'REQUEST_URI'
+    );
+    
+
+Type
+  { TCGIRequest }
+  TCustomCGIApplication = Class;
+
+  TCGIRequest = Class(TRequest)
+  Private
+    FCGI : TCustomCGIApplication;
+    function GetCGIVar(Index: integer): String;
+  Protected
+    Function GetFieldValue(Index : Integer) : String; override;
+    Procedure InitFromEnvironment;
+    Procedure InitPostVars;
+    Procedure InitGetVars;
+  Public
+    Constructor CreateCGI(ACGI : TCustomCGIApplication);
+    Property GatewayInterface : String Index 1 Read GetCGIVar;
+    Property RemoteIdent : String Index 2 read GetCGIVar;
+    Property RemoteUser : String Index 3 read GetCGIVar;
+    Property RequestMethod : String Index 4 read GetCGIVar;
+    Property ServerName : String Index 5 read GetCGIVar;
+    Property ServerProtocol : String Index 6 read GetCGIVar;
+    Property ServerSoftware : String Index 7 read GetCGIVar;
+  end;
+  
+  { TCGIResponse }
+
+  TCGIResponse = Class(TResponse)
+  private
+    FCGI : TCustomCGIApplication;
+    FOutput : TStream;
+  Protected
+    Procedure DoSendHeaders(Headers : TStrings); override;
+    Procedure DoSendContent; override;
+  Public
+    Constructor CreateCGI(ACGI : TCustomCGIApplication; AStream : TStream);
+  end;
+
+  { TCustomCgiApplication }
+
+  TCustomCGIApplication = Class(TCustomApplication)
+  Private
+    FResponse : TCGIResponse;
+    FRequest : TCGIRequest;
+    FEmail : String;
+    FAdministrator : String;
+    FOutput : TStream;
+    Procedure InitRequestVars;
+    Function GetEmail : String;
+    Function GetAdministrator : String;
+    Function GetRequestVariable(Const VarName : String) : String;
+    Function GetRequestVariableCount : Integer;
+  Public
+    Destructor Destroy; override;
+    Property Request : TCGIRequest read FRequest;
+    Property Response: TCGIResponse Read FResponse;
+    Procedure AddResponse(Const S : String);
+    Procedure AddResponse(Const Fmt : String; Args : Array of const);
+    Procedure AddResponseLn(Const S : String);
+    Procedure AddResponseLn(Const Fmt : String; Args : Array of const);
+    Procedure Initialize; override;
+    Procedure GetCGIVarList(List : TStrings);
+    Procedure ShowException(E: Exception);override;
+    Procedure DeleteFormFiles;
+    Procedure DoRun; override;
+    Procedure handleRequest(ARequest : TRequest; AResponse : TResponse); virtual;
+    Function GetTempCGIFileName : String;
+    Function VariableIsUploadedFile(Const VarName : String) : boolean;
+    Function UploadedFileName(Const VarName : String) : String;
+    Property Email : String Read GetEmail Write FEmail;
+    Property Administrator : String Read GetAdministrator Write FAdministrator;
+    Property RequestVariables[VarName : String] : String Read GetRequestVariable;
+    Property RequestVariableCount : Integer Read GetRequestVariableCount;
+  end;
+
+ResourceString
+  SWebMaster = 'webmaster';
+  SCGIError  = 'CGI Error';
+  SAppEncounteredError = 'The application encountered the following error:';
+  SError     = 'Error: ';
+  SNotify    = 'Notify: ';
+  SErrNoContentLength = 'No content length passed from server!';
+  SErrUnsupportedContentType = 'Unsupported content type: "%s"';
+  SErrNoRequestMethod = 'No REQUEST_METHOD passed from server.';
+  SErrInvalidRequestMethod = 'Invalid REQUEST_METHOD passed from server.';
+
+Implementation
+
+uses
+{$ifdef CGIDEBUG}
+  dbugintf,
+{$endif}
+  iostream;
+
+Const
+  MapCgiToHTTP : TCGIVarArray =
+   ({ 1: 'AUTH_TYPE'               } fieldWWWAuthenticate, // ?
+    { 2: 'CONTENT_LENGTH'          } FieldContentLength,
+    { 3: 'CONTENT_TYPE'            } FieldContentType,
+    { 4: 'GATEWAY_INTERFACE'       } '',
+    { 5: 'PATH_INFO'               } '',
+    { 6: 'PATH_TRANSLATED'         } '',
+    { 7: 'QUERY_STRING'            } '',
+    { 8: 'REMOTE_ADDR'             } '',
+    { 9: 'REMOTE_HOST'             } '',
+    { 10: 'REMOTE_IDENT'           } '',
+    { 11: 'REMOTE_USER'            } '',
+    { 12: 'REQUEST_METHOD'         } '',
+    { 13: 'SCRIPT_NAME'            } '',
+    { 14: 'SERVER_NAME'            } '',
+    { 15: 'SERVER_PORT'            } '',
+    { 16: 'SERVER_PROTOCOL'        } '',
+    { 17: 'SERVER_SOFTWARE'        } '',
+    { 18: 'HTTP_ACCEPT'            } FieldAccept,
+    { 19: 'HTTP_ACCEPT_CHARSET'    } FieldAcceptCharset,
+    { 20: 'HTTP_ACCEPT_ENCODING'   } FieldAcceptEncoding,
+    { 21: 'HTTP_IF_MODIFIED_SINCE' } FieldIfModifiedSince,
+    { 22: 'HTTP_REFERER'           } FieldReferer,
+    { 23: 'HTTP_USER_AGENT'        } FieldUserAgent,
+    { 23: 'HTTP_USER_AGENT'        } FieldCookie,
+     // Additional Apache vars
+    { 24: 'HTTP_CONNECTION'        } FieldConnection,
+    { 25: 'HTTP_ACCEPT_LANGUAGE'   } FieldAcceptLanguage,
+    { 26: 'HTTP_HOST'              } '',
+    { 27: 'SERVER_SIGNATURE'       } '',
+    { 28: 'SERVER_ADDR'            } '',
+    { 29: 'DOCUMENT_ROOT'          } '',
+    { 30: 'SERVER_ADMIN'           } '',
+    { 31: 'SCRIPT_FILENAME'        } '',
+    { 32: 'REMOTE_PORT'            } '',
+    { 33: 'REQUEST_URI'            } ''
+  );
+
+
+Destructor TCustomCGIApplication.Destroy;
+
+begin
+  DeleteFormFiles;
+  FreeAndNil(FRequest);
+  FreeAndNil(FResponse);
+  FreeAndNil(FOutPut);
+  Inherited;
+end;
+
+Function TCustomCGIApplication.GetTempCGIFileName : String;
+
+begin
+  Result:=GetTempFileName('/tmp/','CGI')
+end;
+
+Procedure TCustomCGIApplication.DeleteFormFiles;
+
+Var
+  I : Integer;
+  FN : String;
+
+begin
+  If Assigned(FRequest) then
+    For I:=0 to FRequest.Files.Count-1 do
+      begin
+      FN:=FRequest.Files[I].LocalFileName;
+      If FileExists(FN) then
+        DeleteFile(FN);
+      end;
+end;
+
+procedure TCustomCGIApplication.DoRun;
+begin
+  HandleRequest(FRequest,FResponse);
+  If Not FResponse.ContentSent then
+    begin
+    FResponse.SendContent;
+    end;
+  Terminate;
+end;
+
+procedure TCustomCGIApplication.HandleRequest(ARequest: TRequest; AResponse: TResponse);
+begin
+  // Needs overriding;
+end;
+
+Procedure TCustomCGIApplication.Initialize;
+
+begin
+  StopOnException:=True;
+  Inherited;
+  FRequest:=TCGIRequest.CreateCGI(Self);
+  InitRequestVars;
+  FOutput:=TIOStream.Create(iosOutput);
+  FResponse:=TCGIResponse.CreateCGI(Self,Self.FOutput);
+end;
+
+Procedure TCustomCGIApplication.GetCGIVarList(List : TStrings);
+
+Var
+  I : Integer;
+
+begin
+  List.Clear;
+  For I:=1 to cgiVarCount do
+    List.Add(CGIVarNames[i]+'='+GetEnvironmentVariable(CGIVarNames[i]));
+end;
+
+
+Procedure TCustomCGIApplication.ShowException(E: Exception);
+
+Var
+  TheEmail : String;
+  FrameCount: integer;
+  Frames: PPointer;
+  FrameNumber:Integer;
+  S : TStrings;
+
+begin
+  If not FResponse.HeadersSent then
+    FResponse.ContentType:='text/html';
+  If (FResponse.ContentType='text/html') then
+    begin
+    S:=TStringList.Create;
+    Try
+      With S do
+        begin
+        Add('<html><head><title>'+Title+': '+SCGIError+'</title></head>'+LineEnding);
+        Add('<body>');
+        Add('<center><hr><h1>'+Title+': ERROR</h1><hr></center><br><br>');
+        Add(SAppEncounteredError+'<br>');
+        Add('<ul>');
+        Add('<li>'+SError+' <b>'+E.Message+'</b>');
+        Add('<li> Stack trace:<br>');
+        Add(BackTraceStrFunc(ExceptAddr)+'<br>');
+        FrameCount:=ExceptFrameCount;
+        Frames:=ExceptFrames;
+        for FrameNumber := 0 to FrameCount-1 do
+          Add(BackTraceStrFunc(Frames[FrameNumber])+'<br>');
+        Add('</ul><hr>');
+        TheEmail:=Email;
+        If (TheEmail<>'') then
+          Add('<h5><p><i>'+SNotify+Administrator+': <a href="mailto:'+TheEmail+'">'+TheEmail+'</a></i></p></h5>');
+        Add('</body></html>');
+        end;
+      FResponse.Content:=S.Text;
+      FResponse.SendContent;
+    Finally
+      FreeAndNil(S);
+    end;
+    end;
+end;
+
+Function TCustomCGIApplication.GetEmail : String;
+
+Var
+  H : String;
+
+begin
+  If (FEmail='') then
+    begin
+    H:=Request.ServerName;
+    If (H<>'') then
+      Result:=Administrator+'@'+H
+    else
+      Result:='';
+    end
+  else
+    Result:=Email;
+end;
+
+Function TCustomCGIApplication.GetAdministrator : String;
+
+begin
+  If (FADministrator<>'') then
+    Result:=FAdministrator
+  else
+    Result:=SWebMaster;
+end;
+
+Procedure TCustomCGIApplication.InitRequestVars;
+
+var
+  R : String;
+
+begin
+  R:=GetEnvironmentVariable('REQUEST_METHOD');
+  if (R='') then
+    Raise Exception.Create(SErrNoRequestMethod);
+  FRequest.InitFromEnvironment;
+  if CompareText(R,'POST')=0 then
+    Request.InitPostVars
+  else if CompareText(R,'GET')=0 then
+    Request.InitGetVars
+  else
+    Raise Exception.CreateFmt(SErrInvalidRequestMethod,[R]);
+end;
+
+
+constructor TCGIRequest.CreateCGI(ACGI: TCustomCGIApplication);
+begin
+  Inherited Create;
+  FCGI:=ACGI;
+end;
+
+
+Type
+  TCapacityStream = Class(TMemoryStream)
+  Public
+    Property Capacity;
+  end;
+
+Procedure TCGIRequest.InitPostVars;
+
+Var
+  M  : TCapacityStream;
+  I  : TIOStream;
+  Cl : Integer;
+  B  : Byte;
+  CT : String;
+
+begin
+{$ifdef CGIDEBUG}
+  SendMethodEnter('InitPostVars');
+{$endif}
+  CL:=ContentLength;
+  M:=TCapacityStream.Create;
+  Try
+    I:=TIOStream.Create(iosInput);
+    Try
+      if (CL<>0) then
+        begin
+        M.Capacity:=Cl;
+        M.CopyFrom(I,Cl);
+        end
+      else
+        begin
+        While (I.Read(B,1)>0) do
+          M.Write(B,1)
+        end;
+    Finally
+      I.Free;
+    end;
+    M.Position:=0;
+    With TFileStream.Create('/tmp/query',fmCreate) do
+      try
+        CopyFrom(M,0);
+        M.Position:=0;
+      Finally
+        Free;
+      end;
+    CT:=ContentType;
+    if Pos('MULTIPART/FORM-DATA',Uppercase(CT))<>0 then
+      ProcessMultiPart(M,CT)
+    else if CompareText('APPLICATION/X-WWW-FORM-URLENCODED',CT)=0 then
+      ProcessUrlEncoded(M)
+    else
+      begin
+{$ifdef CGIDEBUG}
+      SendDebug('InitPostVars: unsupported content type:'+CT);
+{$endif}
+      Raise Exception.CreateFmt(SErrUnsupportedContentType,[CT]);
+      end;
+  finally
+    M.Free;
+  end;
+{$ifdef CGIDEBUG}
+  SendMethodExit('InitPostVars');
+{$endif}
+end;
+
+Procedure TCGIRequest.InitGetVars;
+
+Var
+  FQueryString : String;
+
+begin
+{$ifdef CGIDEBUG}
+  SendMethodEnter('InitGetVars');
+{$endif}
+  FQueryString:=GetEnvironmentVariable('QUERY_STRING');
+  If (FQueryString<>'') then
+    ProcessQueryString(FQueryString);
+{$ifdef CGIDEBUG}
+  SendMethodExit('InitGetVars');
+{$endif}
+end;
+
+
+Function TCustomCGIApplication.GetRequestVariable(Const VarName : String) : String;
+
+begin
+ If Assigned(Request) then
+   Result:=FRequest.QueryFields.Values[VarName]
+ else
+   Result:='';
+end;
+
+Function TCustomCGIApplication.GetRequestVariableCount : Integer;
+
+begin
+ If Assigned(Request) then
+    Result:=FRequest.QueryFields.Count
+  else
+    Result:=0;
+end;
+
+Procedure TCustomCGIApplication.AddResponse(Const S : String);
+
+Var
+  L : Integer;
+
+begin
+  L:=Length(S);
+  If L>0 then
+    Response.Content:=Response.Content+S;
+end;
+
+Procedure TCustomCGIApplication.AddResponse(Const Fmt : String; Args : Array of const);
+
+begin
+  AddResponse(Format(Fmt,Args));
+end;
+
+Procedure TCustomCGIApplication.AddResponseLN(Const S : String);
+
+
+begin
+  AddResponse(S+LineEnding);
+end;
+
+Procedure TCustomCGIApplication.AddResponseLN(Const Fmt : String; Args : Array of const);
+
+begin
+  AddResponseLN(Format(Fmt,Args));
+end;
+
+Function TCustomCGIApplication.VariableIsUploadedFile(Const VarName : String) : boolean;
+
+begin
+  Result:=FRequest.Files.IndexOfFile(VarName)<>-1;
+end;
+
+Function TCustomCGIApplication.UploadedFileName(Const VarName : String) : String;
+
+begin
+  If VariableIsUploadedFile(VarName) then
+    Result:=FRequest.Files.FileByName(VarName).LocalFileName
+  else
+    Result:='';
+end;
+
+{ TCGIHTTPRequest }
+
+function TCGIRequest.GetCGIVar(Index: integer): String;
+
+Var
+  R : String;
+
+begin
+  Case Index of
+   1 : R:=GetEnvironmentVariable(CGIVarNames[4]); // Property GatewayInterface : String Index 1 Read GetCGIVar;
+   2 : R:=GetEnvironmentVariable(CGIVarNames[10]); // Property RemoteIdent : String Index 2 read GetCGIVar;
+   3 : R:=GetEnvironmentVariable(CGIVarNames[11]); // Property RemoteUser : String Index 3 read GetCGIVar;
+   4 : R:=GetEnvironmentVariable(CGIVarNames[12]); // Property RequestMethod : String Index 4 read GetCGIVar;
+   5 : R:=GetEnvironmentVariable(CGIVarNames[14]); // Property ServerName : String Index 5 read GetCGIVar;
+   6 : R:=GetEnvironmentVariable(CGIVarNames[16]); // Property ServerProtocol : String Index 6 read GetCGIVar;
+   7 : R:=GetEnvironmentVariable(CGIVarNames[17]); // Property ServerSoftware : String Index 7 read GetCGIVar;
+  end;
+  Result:=HTTPDecode(R);
+end;
+
+Procedure TCGIRequest.InitFromEnvironment;
+
+
+Var
+  I : Integer;
+  N,V,OV : String;
+  
+  
+begin
+  For I:=1 to CGIVarCount do
+    begin
+    N:=MapCgiToHTTP[i];
+    if (N<>'') then
+      begin
+      OV:=GetFieldByName(N);
+      V:=GetEnvironmentVariable(CGIVarNames[I]);
+      If (OV='') or (V<>'') then
+        SetFieldByName(N,HTTPDecode(V));
+      end;
+    end;
+end;
+
+
+Function TCGIRequest.GetFieldValue(Index : Integer) : String;
+
+  Function DecodeVar(I : Integer) : String;
+  
+  begin
+    Result:=HTTPDecode(GetEnvironmentVariable(CGIVarNames[I]));
+  end;
+
+begin
+  Case Index of
+    25 : Result:=Decodevar(5); // Property PathInfo
+    26 : Result:=DecodeVar(6); // Property PathTranslated
+    27 : Result:=DecodeVar(8); // Property RemoteAddress
+    28 : Result:=DecodeVar(9); // Property RemoteHost
+    29 : Result:=DecodeVar(13); // Property ScriptName
+    30 : Result:=DecodeVar(15); // Property ServerPort
+  else
+    Result:=Inherited GetFieldValue(Index);
+  end;
+end;
+
+
+{ TCGIResponse }
+
+procedure TCGIResponse.DoSendHeaders(Headers : TStrings);
+begin
+{$ifdef CGIDEBUG}
+  SendMethodEnter('TCGIResponse.DoSendHeaders');
+  SendDebug('Headers: '+Headers.Text);
+{$endif}
+  if Assigned(FOutput) then
+    Headers.SaveToStream(FOutput);
+{$ifdef CGIDEBUG}
+  SendMethodExit('TCGIResponse.DoSendHeaders');
+{$endif}
+end;
+
+procedure TCGIResponse.DoSendContent;
+begin
+{$ifdef CGIDEBUG}
+  SendMethodEnter('TCGIResponse.DoSendContent');
+{$endif}
+  If Assigned(ContentStream) then
+    FOutput.CopyFrom(ContentStream,0)
+  else
+    Contents.SaveToStream(FOutput);
+{$ifdef CGIDEBUG}
+  SendMethodExit('TCGIResponse.DoSendContent');
+{$endif}
+end;
+
+constructor TCGIResponse.CreateCGI(ACGI: TCustomCGIApplication; AStream: TStream);
+begin
+  inherited Create(ACGI.Request);
+  FCGI:=ACGI;
+  FOutput:=AStream;
+end;
+
+initialization
+
+finalization
+{$ifdef CGIDEBUG}
+  if (SendError<>'') then
+    Writeln('Debug failed: ',SendError);
+{$endif}
+end.

+ 139 - 0
fcl/web/fpcgi.pp

@@ -0,0 +1,139 @@
+{$mode objfpc}
+{$H+}
+unit fpcgi;
+
+interface
+
+uses SysUtils,Classes,CustCgi,httpDefs,fpHTTP;
+
+Type
+
+  { TCGIApplication }
+  TGetModuleEvent = Procedure (Sender : TObject; ARequest : TRequest;
+                               Var ModuleClass : TCustomHTTPModuleClass) of object;
+
+  TCGIApplication = Class(TCustomCGIApplication)
+  private
+    FModuleVar: String;
+    FOnGetModule: TGetModuleEvent;
+    FAllowDefaultModule: Boolean;
+  Protected
+    Function GetModuleName(Arequest : TRequest) : string;
+    function FindModule(ModuleClass : TCustomHTTPModuleClass): TCustomHTTPModule;
+  Public
+    Constructor Create(AOwner : TComponent); override;
+    Procedure CreateForm(AClass : TComponentClass; Var Reference : TComponent);
+    Procedure handleRequest(ARequest : TRequest; AResponse : TResponse); override;
+    Property OnGetModule : TGetModuleEvent Read FOnGetModule Write FOnGetModule;
+    Property ModuleVariable : String Read FModuleVar Write FModuleVar;
+    Property AllowDefaultModule : Boolean Read FAllowDefaultModule Write FAllowDefaultModule;
+  end;
+
+  EFPCGIError = Class(Exception);
+  
+Var
+  Application : TCGIApplication;
+  ShowCleanUpErrors : Boolean = False;
+  
+Implementation
+
+resourcestring
+  SErrNoModuleNameForRequest = 'Could not determine HTTP module name for request';
+  SErrNoModuleForRequest = 'Could not determine HTTP module for request "%s"';
+
+Procedure InitCGI;
+
+begin
+  Application:=TCGIApplication.Create(Nil);
+end;
+
+Procedure DoneCGI;
+
+begin
+  Try
+    FreeAndNil(Application);
+  except
+    if ShowCleanUpErrors then
+      Raise;
+  end;
+end;
+
+{ TCGIApplication }
+
+function TCGIApplication.GetModuleName(Arequest: TRequest): string;
+
+
+begin
+  If (FModuleVar<>'') then
+    Result:=ARequest.QueryFields.Values[FModuleVar];
+  If (Result='') then
+    Result:=ARequest.GetNextPathInfo;
+end;
+
+function TCGIApplication.FindModule(ModuleClass : TCustomHTTPModuleClass): TCustomHTTPModule;
+
+Var
+  I : Integer;
+
+begin
+  I:=ComponentCount-1;
+  While (I>=0) and (Not (Components[i] is ModuleClass)) do
+    Dec(i);
+  if (I>=0) then
+    Result:=Components[i] as TCustomHTTPModule
+  else
+    Result:=Nil;
+end;
+
+constructor TCGIApplication.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+  FModuleVar:='Module'; // Do not localize
+  FAllowDefaultModule:=True;
+end;
+
+procedure TCGIApplication.CreateForm(AClass: TComponentClass;
+  var Reference: TComponent);
+begin
+  Reference:=AClass.Create(Self);
+end;
+
+procedure TCGIApplication.HandleRequest(ARequest: TRequest; AResponse: TResponse);
+
+Var
+  MC : TCustomHTTPModuleClass;
+  M  : TCustomHTTPModule;
+  MN : String;
+  MI : TModuleItem;
+  
+begin
+  MC:=Nil;
+  If (OnGetModule<>Nil) then
+    OnGetModule(Self,ARequest,MC);
+  If (MC=Nil) then
+    begin
+    MN:=GetModuleName(ARequest);
+    If (MN='') and Not AllowDefaultModule then
+      Raise EFPCGIError.Create(SErrNoModuleNameForRequest);
+    MI:=ModuleFactory.FindModule(MN);
+    If (MI=Nil) and (ModuleFactory.Count=1) then
+      MI:=ModuleFactory[0];
+    if (MI=Nil) then
+      begin
+      Raise EFPCGIError.CreateFmt(SErrNoModuleForRequest,[MN]);
+      end;
+    MC:=MI.ModuleClass;
+    M:=FindModule(MC); // Check if a module exists already
+    end;
+  If (M=Nil) then
+    M:=MC.Create(Self);
+  M.HandleRequest(ARequest,AResponse);
+end;
+
+Initialization
+  InitCGI;
+  
+Finalization
+  DoneCGI;
+  
+end.

+ 1171 - 0
fcl/web/fpdatasetform.pp

@@ -0,0 +1,1171 @@
+unit fpdatasetform;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, fphtml, htmldefs, htmlwriter, db, htmlelements;
+
+type
+
+  THTMLDatasetFormProducer = class;
+  TFormFieldItem = class;
+  TFormButtonItem = class;
+
+  TFieldCellEvent = procedure (Sender:THTMLDatasetFormProducer; FieldDef:TFormFieldItem;
+                      IsLabel:boolean; Cell : THTMLCustomelement) of object;
+  TButtonEvent = procedure (Sender:THTMLDatasetFormProducer; ButtonDef:TFormButtonItem;
+                      Button : THTML_button) of object;
+  TProducerEvent = procedure (Sender:THTMLDatasetFormProducer;  FieldDef:TFormFieldItem;
+                      Producer:THTMLContentProducer) of object;
+  THTMLElementEvent = procedure (Sender:THTMLDatasetFormProducer; element : THTMLCustomElement) of object;
+  TFieldCheckEvent = procedure (aField:TField; var check:boolean) of object;
+  
+  TFormInputType = (fittext,fitpassword,fitcheckbox,fitradio,fitfile,fithidden,
+                    fitproducer,fittextarea,fitrecordselection);
+
+  { TTablePosition }
+
+  TTablePosition = class (TPersistent)
+  private
+    FAlignHor: THTMLalign;
+    FAlignVer: THTMLvalign;
+    FColSpan: integer;
+    FLeft: integer;
+    FRowSpan: integer;
+    FTop: integer;
+  protected
+    procedure AssignTo(Dest: TPersistent); override;
+  public
+    constructor create;
+  published
+    property Left : integer read FLeft write FLeft;
+    property Top : integer read FTop write FTop;
+    property ColSpan : integer read FColSpan write FColSpan default 1;
+    property RowSpan : integer read FRowSpan write FRowSpan default 1;
+    property AlignVertical : THTMLvalign read FAlignVer write FAlignVer default vaEmpty;
+    property AlignHorizontal : THTMLalign read FAlignHor write FAlignHor default alEmpty;
+  end;
+
+  { TFormFieldItem }
+
+  TFormFieldItem = class (TCollectionItem)
+  private
+    FAction: string;
+    FField: TField;
+    FFieldName: string;
+    FInputType: TFormInputType;
+    FLabelCaption: string;
+    FLabelAbove : boolean;
+    FLabelPos: TTablePosition;
+    FProducer: THTMLContentProducer;
+    FValuePos: TTablePosition;
+    procedure SetLabelPos(const AValue: TTablePosition);
+    procedure SetValuePos(const AValue: TTablePosition);
+  protected
+    procedure AssignTo(Dest: TPersistent); override;
+  public
+    constructor Create(ACollection: TCollection); override;
+    destructor Destroy; override;
+    property Field : TField read FField;
+  published
+    property Fieldname : string read FFieldName write FFieldname;
+      // the field to show/edit
+    property LabelCaption : string read FLabelCaption write FLabelCaption;
+      // the text to show for the control
+    property LabelPos : TTablePosition read FLabelPos write SetLabelPos;
+      // place of the label in the table-grid
+    property LabelAbove : boolean read FLabelAbove write FLabelAbove default false;
+      // if not SeparateLabel then place a <BR> between label and edit/value
+    property ValuePos : TTablePosition read FValuePos write SetValuePos;
+      // place of the value in the table-grid
+    { only when editting: }
+    property InputType : TFormInputType read FInputType write FInputType default fittext;
+      // the type of form control to use
+    property Producer : THTMLContentProducer read FProducer write FProducer;
+      // the producer to include when generating the value
+    { only when showing: }
+    property Action : string read FAction write FAction;
+      // the link to include in the value
+  end;
+
+  { TFormFieldCollection }
+
+  TFormFieldCollection = class (TCollection)
+  private
+    function GetItem(index : integer): TFormFieldItem;
+    procedure SetItem(index : integer; const AValue: TFormFieldItem);
+  public
+    constructor create;
+    function AddField (afieldname, acaption : string) : TFormFieldItem;
+    property Items [index : integer] : TFormFieldItem read GetItem write SetItem;
+  end;
+
+  TFormButtonType = (fbtSubmit, fbtReset, fbtPushbutton);
+  TImagePlace = (ipOnly, ipBefore, ipAfter, ipUnder, ipAbove);
+
+  { TFormButtonItem }
+
+  TFormButtonItem = class (TCollectionItem)
+  private
+    FButtonType: TFormButtonType;
+    FCaption: string;
+    FImage: string;
+    FName: string;
+    FImagePlace: TImagePlace;
+    FValue: string;
+  protected
+    procedure AssignTo(Dest: TPersistent); override;
+  public
+    constructor create (ACollection : TCollection); override;
+  published
+    property Name : string read FName write FName;
+    property Value : string read FValue write FValue;
+    property Caption : string read FCaption write FCaption;
+      // Text on button, or as hint with image
+    property Image : string read FImage write FImage;
+      // Image to show on the button
+    property ImagePlace : TImagePlace read FImagePlace write FImagePlace;
+      // where the image is placed regarding from the caption.
+      // if ipOnly; the caption is placed in the alternate text of the image (hint)
+    property ButtonType : TFormButtonType read FButtonType write FButtonType default fbtPushButton;
+      // Where the button is used for
+  end;
+
+  { TFormButtonCollection }
+
+  TFormButtonCollection = class (TCollection)
+  private
+    function GetItem(index : integer): TFormButtonItem;
+    procedure SetItem(index : integer; const AValue: TFormButtonItem);
+  public
+    constructor create;
+    function AddButton (aname, avalue, acaption : string) : TFormButtonItem;
+    function AddButton (aname, acaption : string) : TFormButtonItem;
+    function AddButton (acaption : string) : TFormButtonItem;
+    property Items [index : integer] : TFormButtonItem read GetItem write SetItem;
+  end;
+
+  TCellType = (ctEmpty, ctInput, ctLabel, ctProducer, ctSpanned);
+
+  { TTableCell }
+
+  TTableCell = class (TCollectionItem)
+  private
+    FAlignHor: THTMLalign;
+    FAlignVer: THTMLvalign;
+    FCaption: string;
+    FCellType: TCellType;
+    FChecked: boolean;
+    FColSpan: integer;
+    FEndRow: boolean;
+    FFormField: TFormFieldItem;
+    FIncludeBreak: boolean;
+    FInputType: TFormInputType;
+    FIsLabel: boolean;
+    FLink: string;
+    FMaxLength: integer;
+    FName: string;
+    FProducer: THTMLContentProducer;
+    FRowSpan: integer;
+    FSize: integer;
+    FSpanned: boolean;
+    FValue: string;
+  public
+    function WriteContent (aWriter : THTMLWriter) : THTMLCustomElement;
+    function WriteHeader (aWriter : THTMLWriter) : THTMLCustomElement;
+    property FormField : TFormFieldItem read FFormField write FFormField;
+      // field definition that origintated this cell
+    property IsLabel : boolean read FIsLabel write FIsLabel;
+      // Label or Value ?
+    property Caption : string read FCaption write FCaption;
+      // label to place with the edit/value if not separateLabel
+    property IncludeBreak : boolean read FIncludeBreak write FIncludeBreak;
+      // place <br> between label and edit/value if label is included in cell
+    property CellType : TCellType read FCellType write FCellType;
+    { Cell properties: }
+    property ColSpan : integer read FColSpan write FColSpan;
+    property RowSpan : integer read FRowSpan write FRowSpan;
+    property AlignVertical : THTMLvalign read FAlignVer write FAlignVer default vaEmpty;
+    property AlignHorizontal : THTMLalign read FAlignHor write FAlignHor default alEmpty;
+    property Value : string read FValue write FValue;
+          // Contains the text for labels, or the value for input, or unused for producer and empty
+    { properties to correctly generate the rows and the table ends }
+    property EndOfRow : boolean read FEndRow write FEndRow;
+    property SpannedOut : boolean read FSpanned write FSpanned;
+    { only for input: }
+    property Name : string read FName write FName;
+          // name of the control
+    property InputType : TFormInputType read FInputType write FInputType;
+          // type of the input element
+    property Size : integer read FSize write FSize;
+          // size of text input element
+    property MaxLength : integer read FMaxLength write FMaxLength;
+          // MaxLength of text input element
+    property Checked : boolean read FChecked write FChecked;
+          // checked or not for radio,checkbox
+    { only for labels: }
+    property Link : string read FLink write FLink;
+          // link to place around the text
+    { only for producers: }
+    property Producer : THTMLContentProducer read FProducer write FProducer;
+          // producer to include
+  end;
+
+  { TTableDef }
+
+  TTableDef = class (TCollection)
+  private
+    fCols, fRows : integer;
+    function GetCell(x, y : integer): TTableCell;
+    function GetItem(index: integer): TTableCell;
+  public
+    Constructor Create (acols, arows : integer);
+    function CopyTablePosition (position : TTablePosition) : TTableCell;
+    property Cells [x,y : integer] : TTableCell read GetCell; default;
+    property items [index:integer] : TTableCell read GetItem;
+  end;
+
+  TButtonVerPosition = (bvpTop, bvpBottom);
+  TButtonVerPositionSet = set of TButtonVerPosition;
+  TButtonHorPosition = (bhpLeft, bhpCenter, bhpJustify, bhpRight);
+  TFormMethod = (fmGet, fmPost);
+
+  { THTMLDatasetFormProducer }
+
+  THTMLDatasetFormProducer = class (THTMLContentProducer)
+  private
+    FOnInitializeProducer : TProducerEvent;
+    FOnFieldChecked : TFieldCheckEvent;
+    FAfterTBodyCreate,
+    FAfterTableCreate : THTMLElementEvent;
+    FAfterButtonCreate: TButtonEvent;
+    FAfterCellCreate: TFieldCellEvent;
+    Fbuttonrow: TFormButtonCollection;
+    FButtonsHor: TButtonHorPosition;
+    FButtonsVer: TButtonVerPositionSet;
+    FControls: TFormFieldCollection;
+    FDatasource: TDatasource;
+    FFormAction: string;
+    FFormMethod: TFormMethod;
+    FIncludeHeader: boolean;
+    FSeparateLabel: boolean;
+    FTableCols: integer;
+    FTableRows: integer;
+    FTableDef : TTableDef;
+    FPage: integer;
+    FRecordsPerPage: integer;
+    procedure SetIncludeHeader(const AValue: boolean);
+    procedure SetSeparateLabel(const AValue: boolean);
+    procedure WriteButtons (aWriter : THTMLWriter);
+    procedure WriteTableDef (aWriter : THTMLWriter);
+    procedure WriteHeaderTableDef (aWriter : THTMLWriter);
+    procedure CorrectCellSpans;
+    procedure SearchControlFields;
+  protected
+    function WriteContent (aWriter : THTMLWriter) : THTMLCustomElement; override;
+    procedure FillTableDef (IsHeader:boolean); virtual;
+    procedure ControlToTableDef (aControldef : TFormFieldItem; IsHeader:boolean); virtual; abstract;
+    function StartForm (aWriter : THTMLWriter) : THTMLCustomElement; virtual;
+    procedure EndForm (aWriter : THTMLWriter); virtual;
+    property TableDef : TTableDef read FTableDef;
+    function SingleRecord : boolean; dynamic;
+      // generate form for 1 record or for the selected pages
+    property RecordsPerPage : integer read FRecordsPerPage write FRecordsPerPage default 20;
+      // number of records to show
+    property Page : integer read FPage write FPage default -1;
+      // page to show. -1 shows all records. zero based
+    property IncludeHeader : boolean read FIncludeHeader write SetIncludeHeader;
+      // create a header cell for each control
+  public
+    constructor create (aOwner : TComponent); override;
+    destructor destroy; override;
+  published
+    property FormAction : string read FFormAction write FFormAction;
+      // action of the form (link), if not given; don't use a form element
+    property FormMethod : TFormMethod read FFormMethod write FFormMethod;
+      // method of the form, Get or Post
+    Property DataSource : TDataSource read FDataSource write FDataSource;
+      // the data to use
+    property Controls : TFormFieldCollection read FControls;
+      // configuration of the fields and how to generate the html
+    property SeparateLabel : boolean read FSeparateLabel write SetSeparateLabel;
+      // place label and value/edit in same table cell
+    property buttonrow : TFormButtonCollection read Fbuttonrow;
+      // buttons to place in the form
+    property TableCols : integer read FTableCols write FTableCols default 2;
+      // number columns in the grid for 1 record
+    property TableRows : integer read FTableRows write FTableRows;
+      // number of rows in the grid for 1 record
+    property ButtonsHorizontal : TButtonHorPosition read FButtonsHor write FButtonsHor default bhpleft;
+      // where to place the buttons horizontally
+    property ButtonsVertical : TButtonVerPositionSet read FButtonsVer write FButtonsVer default [bvpTop,bvpBottom];
+      // where to place the buttons vertically
+    property OnInitializeProducer : TProducerEvent read FOnInitializeProducer write FOnInitializeProducer;
+      // Called before the producer creates it's HTML code
+    property AfterCellCreate : TFieldCellEvent read FAfterCellCreate write FAfterCellCreate;
+      // Called after each creation of a cell in the table makeup in the form
+    property AfterButtonCreate : TButtonEvent read FAfterButtonCreate write FAfterButtonCreate;
+      // Called after each creation of a button
+    property AfterTableCreate : THTMLElementEvent read FAfterTableCreate write FAfterTableCreate;
+      // Called after the creation of the table
+    property AfterTBodyCreate : THTMLElementEvent read FAfterTBodyCreate write FAfterTBodyCreate;
+      // Called after finishing the tbody of each record
+    property OnFieldChecked : TFieldCheckEvent read FOnFieldChecked write FOnFieldChecked;
+      // return if the field is true or false if the false string differs from '0','false','-'
+  end;
+
+  { THTMLDatasetFormEditProducer }
+
+  THTMLDatasetFormEditProducer = class (THTMLDatasetFormProducer)
+    procedure ControlToTableDef (aControldef : TFormFieldItem; IsHeader:boolean); override;
+  end;
+
+  { THTMLDatasetFormShowProducer }
+
+  THTMLDatasetFormShowProducer = class (THTMLDatasetFormProducer)
+  protected
+    procedure ControlToTableDef (aControldef : TFormFieldItem; IsHeader:boolean); override;
+  end;
+
+  { THTMLDatasetFormGridProducer }
+
+  THTMLDatasetFormGridProducer = class (THTMLDatasetFormProducer)
+  protected
+    procedure ControlToTableDef (aControldef : TFormFieldItem; IsHeader:boolean); override;
+    function SingleRecord : boolean; override;
+  public
+    constructor Create (aOwner : TComponent); override;
+  published
+    property RecordsPerPage;
+    property Page;
+    property IncludeHeader;
+  end;
+  
+implementation
+
+{ TTableDef }
+
+function TTableDef.GetItem(index: integer): TTableCell;
+begin
+  result := TTableCell (inherited items[index]);
+end;
+
+function TTableDef.GetCell(x, y : integer): TTableCell;
+var r : integer;
+begin
+  r := x + (y * fcols);
+  result := getItem (r);
+end;
+
+constructor TTableDef.Create(acols, arows: integer);
+var r, t : integer;
+begin
+  inherited create (TTableCell);
+  fRows := aRows;
+  fCols := aCols;
+  for r := 1 to aRows do
+    begin
+    for t := 1 to aCols-1 do
+      Add;
+    TTableCell(Add).EndOfRow := True;
+    end;
+end;
+
+function TTableDef.CopyTablePosition(position: TTablePosition): TTableCell;
+begin
+  result := Cells[position.left,position.top];
+  with result do
+    begin
+    AlignHorizontal := position.AlignHorizontal;
+    AlignVertical := position.FAlignVer;
+    ColSpan := position.ColSpan;
+    RowSpan := position.RowSpan;
+    end;
+end;
+
+{ TTablePosition }
+
+procedure TTablePosition.AssignTo(Dest: TPersistent);
+begin
+  inherited AssignTo(Dest);
+  if dest is TTablePosition then
+    with TTablePosition(Dest) do
+      begin
+      FTop := self.FTop;
+      FLeft := self.FLeft;
+      FColSpan := self.FColSpan;
+      FRowSpan := self.FRowSpan;
+      FAlignVer := self.FAlignVer;
+      FalignHor := self.FAlignHor;
+      end;
+end;
+
+constructor TTablePosition.create;
+begin
+  inherited create;
+  FColSpan := 1;
+  FRowSpan := 1;
+  FAlignVer := vaEmpty;
+  FAlignHor := alEmpty;
+end;
+
+{ TFormFieldItem }
+
+procedure TFormFieldItem.SetLabelPos(const AValue: TTablePosition);
+begin
+  FLabelPos.assign(AValue);
+end;
+
+procedure TFormFieldItem.SetValuePos(const AValue: TTablePosition);
+begin
+  FValuePos.assign(AValue);
+end;
+
+procedure TFormFieldItem.AssignTo(Dest: TPersistent);
+begin
+  inherited AssignTo(Dest);
+  if dest is TFormFieldItem then
+    with TFormFIeldItem(Dest) do
+      begin
+      FAction := self.FAction;
+      FFieldName := self.FFieldName;
+      FInputType := self.FInputType;
+      FLabelCaption := self.FLabelCaption;
+      FLabelPos.assign (self.FLabelPos);
+      FProducer := self.FProducer;
+      FValuePos.assign(self.FValuePos);
+      end;
+end;
+
+constructor TFormFieldItem.Create(ACollection: TCollection);
+begin
+  inherited Create(ACollection);
+  FLabelPos := TTablePosition.Create;
+  FValuePos := TTablePosition.Create;
+end;
+
+destructor TFormFieldItem.Destroy;
+begin
+  FLabelPos.Free;
+  FValuePos.Free;
+  inherited Destroy;
+end;
+
+{ TFormFieldCollection }
+
+function TFormFieldCollection.GetItem(index : integer): TFormFieldItem;
+begin
+  result := TFormFieldItem(inherited items[index]);
+end;
+
+procedure TFormFieldCollection.SetItem(index : integer;
+  const AValue: TFormFieldItem);
+begin
+  inherited items[index] := AValue;
+end;
+
+constructor TFormFieldCollection.create;
+begin
+  inherited create (TFormFieldItem);
+end;
+
+function TFormFieldCollection.AddField(afieldname, acaption: string): TFormFieldItem;
+begin
+  result := TFormFieldItem (Add);
+  result.fieldname := afieldname;
+  result.labelcaption := acaption;
+end;
+
+{ TFormButtonItem }
+
+procedure TFormButtonItem.AssignTo(Dest: TPersistent);
+begin
+  inherited AssignTo(Dest);
+  if dest is TFormButtonItem then
+    with TFormButtonItem(Dest) do
+      begin
+      FButtonType := self.FButtonType;
+      FCaption := self.FCaption;
+      FImage := self.FImage;
+      FImagePlace := self.FImagePlace;
+      FName := self.FName;
+      FValue := self.FValue;
+      end;
+end;
+
+constructor TFormButtonItem.create(ACollection: TCollection);
+begin
+  inherited create(ACollection);
+  ButtonType := fbtPushButton;
+end;
+
+{ TFormButtonCollection }
+
+function TFormButtonCollection.GetItem(index: integer): TFormButtonItem;
+begin
+  result := TFormButtonItem(inherited items[index]);
+end;
+
+procedure TFormButtonCollection.SetItem(index: integer;
+  const AValue: TFormButtonItem);
+begin
+  inherited items[index] := AValue;
+end;
+
+constructor TFormButtonCollection.create;
+begin
+  inherited create (TFormButtonItem);
+end;
+
+function TFormButtonCollection.AddButton(aname, avalue, acaption: string): TFormButtonItem;
+begin
+  result := TFormButtonItem(Add);
+  with result do
+    begin
+    name := aname;
+    value := avalue;
+    caption := acaption;
+    end;
+end;
+
+function TFormButtonCollection.AddButton(aname, acaption: string): TFormButtonItem;
+begin
+  result := AddButton (aName, aCaption, acaption);
+end;
+
+function TFormButtonCollection.AddButton(acaption: string): TFormButtonItem;
+begin
+  result := AddButton (acaption, acaption, acaption);
+end;
+
+{ THTMLDatasetFormProducer }
+
+procedure THTMLDatasetFormProducer.WriteButtons(aWriter: THTMLWriter);
+
+  procedure WriteButton (aButton : TFormButtonItem);
+  const ButtonTypes : array[TFormButtontype] of THTMLbuttontype = (btsubmit,btreset,btbutton);
+  var b : THTML_Button;
+  begin
+    with aWriter do
+      begin
+      b := Startbutton;
+      with b do
+        begin
+        Name := aButton.name;
+        Value := aButton.value;
+        TheType := ButtonTypes[aButton.ButtonType];
+        if aButton.Image = '' then
+          Text (aButton.Caption)
+        else
+          begin
+          if aButton.ImagePlace in [ipAfter, ipUnder] then
+            begin
+            Text (aButton.Caption);
+            if aButton.ImagePlace = ipUnder then
+              linebreak;
+            end;
+          with image do
+            begin
+            src := aButton.image;
+            if aButton.ImagePlace = ipOnly then
+              alt := aButton.Caption;
+            end;
+          if aButton.ImagePlace in [ipBefore, ipAbove] then
+            begin
+            if aButton.ImagePlace = ipAbove then
+              linebreak;
+            Text (aButton.Caption);
+            end;
+          end;
+        if assigned (FAfterButtonCreate) then
+          FAfterButtonCreate (self, aButton, b);
+        Endbutton;
+        end;
+      end;
+  end;
+
+const ButHorAlign : array[TButtonHorPosition] of THTMLalign = (alleft,alcenter,aljustify,alright);
+var r : integer;
+begin
+  with aWriter do
+    begin
+    StartTableRow;
+    with StartTableCell do
+      begin
+      ColSpan := inttostr(FTableCols);
+      align := ButHorAlign[ButtonsHorizontal];
+      end;
+    for r := 0 to buttonrow.count-1 do
+      WriteButton (buttonrow.Items[r]);
+    EndTableCell;
+    EndTableRow;
+    end;
+end;
+
+procedure THTMLDatasetFormProducer.SetSeparateLabel(const AValue: boolean);
+begin
+  if AValue <> FSeparateLabel then
+    begin
+    FSeparateLabel := AValue;
+    if AValue then
+      FIncludeHeader := false;
+    end;
+end;
+
+procedure THTMLDatasetFormProducer.SetIncludeHeader(const AValue: boolean);
+begin
+  if FIncludeHeader <> AValue then
+    begin
+    FIncludeHeader := AValue;
+    if AValue then
+      SeparateLabel := false;
+    end;
+end;
+
+procedure THTMLDatasetFormProducer.WriteTableDef(aWriter: THTMLWriter);
+var r : integer;
+    c : THTMLCustomelement;
+begin
+  c := aWriter.Starttablebody;
+  if assigned (FAfterTBodyCreate) then
+    FAfterTBodyCreate (self, c);
+  aWriter.StartTableRow;
+  with tabledef do
+    begin
+    for r := 0 to count-2 do
+      with TTableCell (Items[r]) do
+        begin
+        if CellType <> ctSpanned then
+          begin
+          if (CellType = ctProducer) and assigned (FOnInitializeProducer) then
+            FOnInitializeProducer (self, FFormField, Producer);
+          c := WriteContent(aWriter);
+          if assigned (FAfterCellCreate) then
+            FAfterCellCreate(self, Items[r].FormField, IsLabel, c);
+          end;
+        if EndOfRow then
+          begin
+          aWriter.EndTableRow;
+          aWriter.StartTableRow;
+          end;
+        end;
+    TTableCell(Items[Count-1]).WriteContent(aWriter);
+    end;
+  aWriter.EndTableRow;
+  aWriter.Endtablebody;
+end;
+
+procedure THTMLDatasetFormProducer.WriteHeaderTableDef(aWriter: THTMLWriter);
+var r : integer;
+    c : THTMLCustomelement;
+begin
+  aWriter.Starttablehead;
+  aWriter.StartTableRow;
+  with tabledef do
+    begin
+    for r := 0 to count-2 do
+      with TTableCell (Items[r]) do
+        begin
+        c := WriteHeader(aWriter);
+        if assigned (FAfterCellCreate) then
+          FAfterCellCreate(self, Items[r].FormField, true, c);
+        if EndOfRow then
+          begin
+          aWriter.EndTableRow;
+          aWriter.StartTableRow;
+          end;
+        end;
+    TTableCell(Items[Count-1]).WriteContent(aWriter);
+    end;
+  aWriter.EndTableRow;
+  aWriter.Endtablehead;
+end;
+
+procedure THTMLDatasetFormProducer.CorrectCellSpans;
+var r, s, t : integer;
+    c : TTableCell;
+    ReachedEnd : boolean;
+begin
+  for r := 0 to TableDef.count-1 do
+    with TableDef.items[r] do
+      if CellType <> ctSpanned then
+        begin
+        // CollSpan marking other cells as spanned
+        s := 1;
+        c := TableDef.Items[r];
+        while (s < ColSpan) and not c.EndOfRow do
+          begin
+          c := TableDef.Items[r+s];
+          c.celltype := ctSpanned;
+          inc (s);
+          end;
+        // the same for rowsapn
+        s := 1;
+        t := r + (s*tablecols);
+        while (s < rowspan) and (t < TableDef.count) do
+          begin
+          TableDef.items[t].CellType := ctSpanned;
+          inc (s);
+          inc (t, tablecols);
+          end;
+        end;
+end;
+
+procedure THTMLDatasetFormProducer.SearchControlFields;
+var r : integer;
+begin
+  for r := 0 to FControls.count-1 do
+    with FControls.items[r] do
+      FField := datasource.dataset.FindField(FFieldname);
+end;
+
+function THTMLDatasetFormProducer.StartForm(aWriter: THTMLWriter) : THTMLCustomElement;
+const MethodAttribute : array[TFormMethod] of string = ('GET','POST');
+var t : THTMLCustomElement;
+begin
+  if FormAction <> '' then
+    begin
+    result := aWriter.Startform;
+    with THTML_Form(result) do
+      begin
+      method := MethodAttribute[self.FormMethod];
+      action := FormAction;
+      end;
+    t := aWriter.Starttable;
+    end
+  else
+    begin
+    t := aWriter.Starttable;
+    result := t;
+    end;
+  if assigned (FAfterTableCreate) then
+    FAfterTableCreate (self, t);
+end;
+
+procedure THTMLDatasetFormProducer.EndForm(aWriter: THTMLWriter);
+begin
+  with aWriter do
+    begin
+    EndTable;
+    if FormAction <> '' then
+      Endform;
+    end;
+end;
+
+function THTMLDatasetFormProducer.WriteContent(aWriter: THTMLWriter): THTMLCustomElement;
+var r : integer;
+begin
+  if assigned (datasource) and assigned(datasource.dataset) then
+    begin
+    Ftabledef := TTableDef.Create (TableCols, TableRows);
+    try
+      SearchControlFields;
+      result := StartForm (aWriter);
+      if bvpTop in ButtonsVertical then
+        WriteButtons (aWriter);
+      if SingleRecord then
+        begin
+        FillTableDef (false);
+        CorrectCellSpans;
+        WriteTableDef (aWriter);
+        end
+      else
+        with datasource.dataset do
+          begin
+          if FIncludeHeader then
+            begin
+            FillTableDef (true);
+            CorrectCellSpans;
+            WriteHeaderTableDef (aWriter);
+            end;
+          if Page < 0 then
+            first
+          else
+            RecNo := ((Page-1) * RecordsPerPage) + 1; // zero based? yes: + 1 has to be deleted
+          r := 0;
+          while not eof and (r < RecordsPerPage) do
+            begin
+            FillTableDef (false);
+            CorrectCellSpans;
+            WriteTableDef (aWriter);
+            Next;
+            inc (r);
+            end;
+          end;
+      if bvpBottom in ButtonsVertical then
+        WriteButtons (aWriter);
+      EndForm (aWriter)
+    finally
+      tabledef.Free;
+    end;
+    end;
+end;
+
+procedure THTMLDatasetFormProducer.FillTableDef (IsHeader:boolean);
+var r : integer;
+begin
+  for r := 0 to Controls.Count-1 do
+    ControlToTableDef (Controls.items[r], IsHeader);
+end;
+
+function THTMLDatasetFormProducer.SingleRecord: boolean;
+begin
+  result := true;
+end;
+
+constructor THTMLDatasetFormProducer.create(aOwner: TComponent);
+begin
+  inherited create(aOwner);
+  FTableCols := 2;
+  FButtonsHor := bhpLeft;
+  FButtonsVer := [bvpTop, bvpBottom];
+  Fbuttonrow := TFormButtonCollection.create;
+  FControls := TFormFieldCollection.Create;
+end;
+
+destructor THTMLDatasetFormProducer.destroy;
+begin
+  Fbuttonrow.Free;
+  FControls.Free;
+  inherited destroy;
+end;
+
+{ THTMLDatasetFormEditProducer }
+
+procedure THTMLDatasetFormEditProducer.ControlToTableDef (aControldef : TFormFieldItem; IsHeader:boolean);
+
+  procedure PlaceFieldValue;
+  var check : boolean;
+  begin
+    with TableDef.CopyTablePosition(aControlDef.ValuePos) do
+      begin
+      case aControlDef.inputtype of
+        fittext,
+        fitpassword,
+        fitcheckbox,
+        fitradio,
+        fitfile,
+        fithidden,
+        fittextarea :
+          begin
+          CellType := ctInput;
+          InputType := aControlDef.InputType;
+          Name := aControlDef.Field.FieldName;
+          Size := aControlDef.Field.DisplayWidth;
+          MaxLength := aControldef.Field.Size;
+          if aControlDef.inputType in [fitcheckbox,fitradio] then
+            begin
+            with aControlDef.Field do
+              Checked := not isnull and (asstring <> '0') and (asstring <> '-')
+                         and (comparetext(asstring,'false') <> 0);
+            if assigned (FOnFieldChecked) then
+              FOnFieldChecked (aControlDef.Field, check);
+            Checked := check;
+            end;
+          end;
+        fitproducer :
+          begin
+          CellType := ctProducer;
+          Producer := aControlDef.Producer;
+          end;
+        fitrecordselection : ;
+      end;
+      IsLabel := false;
+      Value := aControlDef.FField.asstring;
+      if not FSeparateLabel and not FIncludeHeader then
+        begin
+        Caption := aControldef.LabelCaption;
+        IncludeBreak := aControldef.LabelAbove;
+        end;
+      end;
+  end;
+
+  procedure PlaceLabel;
+  begin
+    with TableDef.CopyTablePosition(aControlDef.LabelPos) do
+      begin
+      CellType := ctLabel;
+      IsLabel := true;
+      Value := aControldef.labelcaption;
+      end;
+  end;
+
+begin
+  if assigned (aControlDef.FField) then
+    PlaceFieldValue;
+  if FSeparateLabel and (aControlDef.LabelCaption <> '') then
+    PlaceLabel;
+end;
+
+{ THTMLDatasetFormShowProducer }
+
+(**** TTableCell *****
+    property IsLabel : boolean read FIsLabel write FIsLabel;
+      // Label or Value ?
+    property CellType : TCellType read FCellType write FCellType;
+      ctEmpty, ctInput, ctLabel, ctProducer, ctSpanned
+    { Cell properties: }
+    property ColSpan : integer read FColSpan write FColSpan;
+    property RowSpan : integer read FRowSpan write FRowSpan;
+    property AlignVertical : THTMLvalign read FAlignVer write FAlignVer default vaEmpty;
+    property AlignHorizontal : THTMLalign read FAlignHor write FAlignHor default alEmpty;
+    property Value : string read FValue write FValue;
+          // Contains the text for labels, or the value for input, or unused for producer and empty
+    { only for input: }
+    property Name : string read FName write FName;
+          // name of the control
+    property InputType : TFormInputType read FInputType write FInputType;
+          // type of the input element
+    property Size : integer read FSize write FSize;
+          // size of text input element
+    property MaxLength : integer read FMaxLength write FMaxLength;
+          // MaxLength of text input element
+    property Checked : boolean read FChecked write FChecked;
+          // checked or not for radio,checkbox
+    { only for labels: }
+    property Link : string read FLink write FLink;
+          // link to place around the text
+    { only for producers: }
+    property Producer : THTMLContentProducer read FProducer write FProducer;
+          // producer to include
+
+***** TFormFieldItem *****
+    property Fieldname : string read FFieldName write FFieldname;
+    property Field : TField
+      // the field to show/edit
+    property LabelCaption : string read FLabelCaption write FLabelCaption;
+      // the text to show for the control
+    property InputType : TFormInputType read FInputType write FInputType default fittext;
+      // the type of form control to use
+      (fittext,fitpassword,fitcheckbox,fitradio,fitfile,fithidden,fitproducer,fittextarea,fitrecordselection)
+    property Producer : THTMLContentProducer read FProducer write FProducer;
+      // the producer to include when generating the value
+    property Action : string read FAction write FAction;
+      // when showing the link to include in the value
+    property LabelPos : TTablePosition read FLabelPos write SetLabelPos;
+      // place of the label in the table-grid
+    property ValuePos : TTablePosition read FValuePos write SetValuePos;
+      // place of the value in the table-grid   *)
+
+procedure THTMLDatasetFormShowProducer.ControlToTableDef (aControldef : TFormFieldItem; IsHeader:boolean);
+
+  procedure PlaceFieldValue;
+  begin
+    with TableDef.CopyTablePosition(aControlDef.ValuePos) do
+      begin
+      CellType := ctLabel;
+      IsLabel := false;
+      Value := aControlDef.FField.asstring;
+      if not FSeparateLabel and not FIncludeHeader then
+        begin
+        Caption := aControldef.LabelCaption;
+        IncludeBreak := aControldef.LabelAbove;
+        end;
+      end;
+  end;
+  
+  procedure PlaceLabel;
+  begin
+    with TableDef.CopyTablePosition(aControlDef.LabelPos) do
+      begin
+      CellType := ctLabel;
+      IsLabel := true;
+      Value := aControldef.labelcaption;
+      end;
+  end;
+
+begin
+  if assigned (aControlDef.FField) then
+    PlaceFieldValue;
+  if FSeparateLabel and (aControlDef.LabelCaption <> '') then
+    PlaceLabel;
+end;
+
+{ THTMLDatasetFormGridProducer }
+
+procedure THTMLDatasetFormGridProducer.ControlToTableDef (aControldef : TFormFieldItem; IsHeader:boolean);
+
+  procedure PlaceFieldValue;
+  begin
+    with TableDef.CopyTablePosition(aControlDef.ValuePos) do
+      begin
+      CellType := ctLabel;
+      IsLabel := false;
+      Value := aControlDef.FField.asstring;
+      if not FSeparateLabel and not FIncludeHeader then
+        begin
+        Caption := aControldef.LabelCaption;
+        IncludeBreak := aControldef.LabelAbove;
+        end;
+      end;
+  end;
+
+  procedure PlaceLabel;
+  begin
+    with TableDef.CopyTablePosition(aControlDef.LabelPos) do
+      begin
+      CellType := ctLabel;
+      IsLabel := true;
+      Value := aControldef.labelcaption;
+      end;
+  end;
+
+begin
+  if assigned (aControlDef.FField) then
+    PlaceFieldValue;
+  if FSeparateLabel and (aControlDef.LabelCaption <> '') then
+    PlaceLabel;
+end;
+
+function THTMLDatasetFormGridProducer.SingleRecord: boolean;
+begin
+  Result := false;
+end;
+
+constructor THTMLDatasetFormGridProducer.Create(aOwner: TComponent);
+begin
+  inherited create(aOwner);
+  RecordsPerPage := 20;
+  Page := -1;
+end;
+
+{ TTableCell }
+
+function TTableCell.WriteContent(aWriter: THTMLWriter) : THTMLCustomElement;
+
+  procedure WriteLabel;
+  var HasLink : boolean;
+  begin
+    HasLink := (Link <> '');
+    if HasLink then
+      aWriter.Anchor(Value).href := Link
+    else
+      aWriter.Text (Value);
+  end;
+
+  procedure WriteTextArea;
+  begin
+    aWriter.textarea(value).name := Name;
+  end;
+
+  procedure WriteInput;
+  var s, m : string;
+  begin
+    if size > 0 then
+      s := inttostr(size)
+    else
+      s := '';
+    if MaxLength > 0 then
+      m := inttostr(MaxLength)
+    else
+      m := '';
+    case InputType of
+      fittext :
+        with aWriter.FormText (Name, Value) do
+          begin
+          Size := s;
+          MaxLength := m;
+          end;
+      fitpassword :
+          with aWriter.FormPasswd (Name) do
+          begin
+          if self.Value <> '' then
+            Value := self.value;
+          Size := s;
+          MaxLength := m;
+          end;
+      fitcheckbox, fitrecordselection :
+        aWriter.FormCheckbox (Name, Value, checked);
+      fitradio :
+        aWriter.FormRadio(Name, Value, checked);
+      fitfile :
+        aWriter.FormFile(Name, Value);
+      fithidden :
+        aWriter.FormHidden (Name, Value);
+    end;
+  end;
+
+  procedure WriteProducer;
+  begin
+    with Producer do
+      begin
+      ParentElement := aWriter.CurrentElement;
+      HTMLDocument := aWriter.Document;
+      WriteContent (aWriter);
+      end;
+  end;
+
+var c : THTML_td;
+
+begin
+  if CellType <> ctSpanned then
+    with aWriter do
+      begin
+      c := Starttablecell;
+      with c do
+        begin
+        if self.ColSpan > 1 then
+          colspan := IntToStr(self.Colspan);
+        if self.RowSpan > 1 then
+          Rowspan := IntToStr(self.Rowspan);
+        align := AlignHorizontal;
+        valign := AlignVertical;
+        end;
+      if Self.Caption <> '' then
+        begin
+        span(self.caption);
+        if IncludeBreak then
+          linebreak;
+        end;
+      case CellType of
+        ctEmpty : ;
+        ctInput :
+          if InputType = fittextarea then
+            WriteTextArea
+          else
+            WriteInput;
+        ctLabel : WriteLabel;
+        ctProducer : WriteProducer;
+      end;
+      Endtablecell;
+      result := c;
+      end
+  else
+    result := nil;
+end;
+
+function TTableCell.WriteHeader(aWriter: THTMLWriter) : THTMLCustomElement;
+var c : THTML_th;
+    s : string;
+begin
+    with aWriter do
+      begin
+      c := Starttableheadcell;
+      with c do
+        begin
+        if self.ColSpan > 1 then
+          ColSpan := IntToStr(self.Colspan);
+        if self.RowSpan > 1 then
+          RowSpan := IntToStr(self.Rowspan);
+        align := AlignHorizontal;
+        valign := AlignVertical;
+        end;
+      if CellType <> ctLabel then
+        begin
+        s := FormField.LabelCaption;
+        if self.Link <> '' then
+          aWriter.Anchor(s).href := self.Link
+        else
+          aWriter.Text (s);
+        end
+      else
+        aWriter.Text ('');
+      Endtablecell;
+      result := c;
+      end;
+end;
+
+end.
+

+ 460 - 0
fcl/web/fphtml.pp

@@ -0,0 +1,460 @@
+unit fphtml; 
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, htmlelements, htmlwriter, httpdefs, fphttp, db;
+
+type
+
+  { THTMLContentProducer }
+
+  THTMLContentProducer = Class(THTTPContentProducer)
+  private
+    FDocument: THTMLDocument;
+    FElement: THTMLCustomElement;
+    FWriter: THTMLWriter;
+    procedure SetDocument(const AValue: THTMLDocument);
+    procedure SetWriter(const AValue: THTMLWriter);
+  Protected
+    function CreateWriter (Doc : THTMLDocument) : THTMLWriter; virtual;
+  public
+    function WriteContent (aWriter : THTMLWriter) : THTMLCustomElement; virtual; abstract;
+    Function ProduceContent : String; override; // Here to test the output. Replace to protected after tests
+    property ParentElement : THTMLCustomElement read FElement write FElement;
+    property Writer : THTMLWriter read FWriter write SetWriter;
+  published
+    Property HTMLDocument : THTMLDocument read FDocument write SetDocument;
+  end;
+
+  TWriterElementEvent = procedure (Sender:THTMLContentProducer; aWriter : THTMLWriter; var anElement : THTMLCustomElement) of object;
+  TAfterElementEvent = procedure (Sender:THTMLContentProducer; anElement : THTMLCustomElement) of object;
+  TWriterEvent = procedure (Sender:THTMLContentProducer; aWriter : THTMLWriter) of object;
+  TBooleanEvent = procedure (Sender:THTMLContentProducer; var flag : boolean) of object;
+
+  { THTMLCustomDatasetContentProducer }
+
+  THTMLCustomDatasetContentProducer = class (THTMLContentProducer)
+  private
+    FDatasource: TDatasource;
+    FOnWriteFooter: TWriterEvent;
+    FOnWriteHeader: TWriterElementEvent;
+    FOnWriteRecord: TWriterEvent;
+    function WriteHeader (aWriter : THTMLWriter) : THTMLCustomElement;
+    procedure WriteFooter (aWriter : THTMLWriter);
+    procedure WriteRecord (aWriter : THTMLWriter);
+  protected
+    function WriteContent (aWriter : THTMLWriter) : THTMLCustomElement; override;
+    procedure DoWriteHeader (aWriter : THTMLWriter; var el : THTMLCustomElement); virtual;
+    procedure DoWriteFooter (aWriter : THTMLWriter); virtual;
+    procedure DoWriteRecord (aWriter : THTMLWriter); virtual;
+  public
+    Property OnWriteHeader : TWriterElementEvent read FOnWriteHeader write FOnWriteHeader;
+    Property OnWriteFooter : TWriterEvent read FOnWriteFooter write FOnWriteFooter;
+    Property OnWriteRecord : TWriterEvent read FOnWriteRecord write FOnWriteRecord;
+  published
+    Property DataSource : TDataSource read FDataSource write FDataSource;
+  end;
+
+  { THTMLDatasetContentProducer }
+
+  THTMLDatasetContentProducer = class (THTMLCustomDatasetContentProducer)
+  published
+    Property OnWriteHeader;
+    Property OnWriteFooter;
+    Property OnWriteRecord;
+  end;
+  
+  { THTMLSelectProducer }
+
+  THTMLSelectProducer = class (THTMLContentProducer)
+  private
+    FControlName: string;
+    FItems: TStrings;
+    FPreSelected: string;
+    FSize: integer;
+    FUseValues: boolean;
+    procedure SetItems(const AValue: TStrings);
+  protected
+    function WriteContent (aWriter : THTMLWriter) : THTMLCustomElement; override;
+  public
+    constructor create (aOwner : TComponent); override;
+    destructor destroy; override;
+  published
+    property Items : TStrings read FItems write SetItems;
+    property UseValues : boolean read FUseValues write FUseValues default false;
+    property PreSelected : string read FPreSelected write FPreSelected;
+    property Size : integer read FSize write FSize default 1;
+    property ControlName : string read FControlName write FControlName;
+  end;
+
+  { THTMLDatasetSelectProducer }
+
+  THTMLDatasetSelectProducer = class (THTMLCustomDatasetContentProducer)
+  private
+    FControlName: string;
+    FIsPreSelected: TBooleanEvent;
+    FItemField: string;
+    FSize: string;
+    FValueField: string;
+    FValue, FItem : TField;
+  protected
+    procedure DoWriteHeader (aWriter : THTMLWriter; var el : THTMLCustomElement); override;
+    procedure DoWriteFooter (aWriter : THTMLWriter); override;
+    procedure DoWriteRecord (aWriter : THTMLWriter); override;
+  public
+    constructor create (aOwner : TComponent); override;
+  published
+    property ItemField : string read FItemField write FItemField;
+    property ValueField : string read FValueField write FValueField;
+    property OnIsPreSelected : TBooleanEvent read FIsPreSelected write FIsPreSelected;
+    property Size : string read FSize write FSize;
+    property ControlName : string read FControlName write FControlName;
+    property OnWriteHeader;
+  end;
+  
+  { THTMLDataModule }
+  THTMLGetContentEvent = Procedure (Sender : TObject; ARequest : TRequest; HTMLPage : THTMLWriter; Var Handled : Boolean) of object;
+  TCreateDocumentEvent = Procedure(Sender : TObject; var ADocument : THTMLDocument) of object;
+  TCreateWriterEvent = Procedure(Sender : TObject; ADocument : THTMLDocument; Var AWriter : THTMLWriter) of object;
+
+  { THTMLContentAction }
+
+  THTMLContentAction = Class(TCustomWebAction)
+  private
+    FOnGetContent: THTMLGetContentEvent;
+  Public
+    Procedure HandleRequest(ARequest : TRequest; HTMLPage : THTMLWriter; Var Handled : Boolean);
+  Published
+    Property OnGetContent : THTMLGetContentEvent Read FOnGetContent Write FOnGetContent;
+  end;
+  
+  { THTMLContentActions }
+
+  THTMLContentActions = Class(TCustomWebActions)
+    Procedure HandleRequest(ARequest : TRequest; HTMLPage : THTMLWriter; Var Handled : Boolean);
+  end;
+
+
+  { TCustomHTMLDataModule }
+
+  { TCustomHTMLModule }
+
+  TCustomHTMLModule = Class(TCustomHTTPModule)
+  private
+    FDocument : THTMLDocument;
+    FActions: THTMLContentActions;
+    FOnCreateDocument: TCreateDocumentEvent;
+    FOnCreateWriter: TCreateWriterEvent;
+    FOnGetContent: THTMLGetContentEvent;
+    procedure SetActions(const AValue: THTMLContentActions);
+  Protected
+    Function CreateWriter(ADocument : THTMLDocument) : THTMLWriter;
+    Function CreateDocument : THTMLDocument;
+    Property OnGetContent : THTMLGetContentEvent Read FOnGetContent Write FOnGetContent;
+    Property Actions : THTMLContentActions Read FActions Write SetActions;
+    Property OnCreateDocument : TCreateDocumentEvent Read FOnCreateDocument Write FOnCreateDocument;
+    Property OnCreateWriter : TCreateWriterEvent Read FOnCreateWriter Write FOnCreateWriter;
+  Public
+    Constructor Create(AOwner : TComponent);override;
+    Procedure HandleRequest(ARequest : TRequest; AResponse : TResponse); override;
+  end;
+  
+  TFPHTMLModule=Class(TCustomHTMLModule)
+  Published
+    Property OnGetContent;
+    Property Actions;
+    Property OnCreateDocument;
+    Property OnCreateWriter;
+  end;
+  
+  EHTMLError = Class(Exception);
+  
+implementation
+
+{$ifdef cgidebug}
+Uses dbugintf;
+{$endif cgidebug}
+
+resourcestring
+  SErrRequestNotHandled = 'Web request was not handled by actions.';
+
+{ THTMLContentProducer }
+
+procedure THTMLContentProducer.SetWriter(const AValue: THTMLWriter);
+begin
+  FWriter := AValue;
+  if not assigned (FDocument) then
+    FDocument := AValue.Document
+  else if FDocument <> AValue.Document then
+    AValue.document := FDocument;
+end;
+
+procedure THTMLContentProducer.SetDocument(const AValue: THTMLDocument);
+begin
+  FDocument := AValue;
+  if assigned (FWriter) and (AValue <> FWriter.Document) then
+    FWriter.Document := AValue;
+end;
+
+function THTMLContentProducer.ProduceContent: String;
+var WCreated, created : boolean;
+    el : THtmlCustomElement;
+begin
+  created := not assigned (FDocument);
+  if created then
+    FDocument := THTMLDocument.Create;
+  try
+    WCreated := not assigned(FWriter);
+    if WCreated then
+      FWriter := CreateWriter (FDocument);
+    try
+      FWriter.CurrentElement := ParentElement;
+      el := WriteContent (FWriter);
+      result := el.asstring;
+    finally
+      if WCreated then
+        FWriter.Free;
+    end;
+  finally
+    if created then
+      FDocument.Free;
+  end;
+end;
+
+function THTMLContentProducer.CreateWriter (Doc : THTMLDocument): THTMLWriter;
+begin
+  FDocument := Doc;
+  result := THTMLWriter.Create (Doc);
+end;
+
+{ THTMLCustomDatasetContentProducer }
+
+function THTMLCustomDatasetContentProducer.WriteHeader(aWriter: THTMLWriter): THTMLCustomElement;
+var el : THTmlCustomElement;
+begin
+  el := nil;
+  DoWriteHeader (aWriter, el);
+  result := el;
+end;
+
+procedure THTMLCustomDatasetContentProducer.WriteFooter(aWriter: THTMLWriter);
+begin
+  DoWriteFooter (aWriter);
+end;
+
+procedure THTMLCustomDatasetContentProducer.WriteRecord(aWriter: THTMLWriter);
+begin
+  DoWriteRecord (aWriter);
+end;
+
+function THTMLCustomDatasetContentProducer.WriteContent(aWriter: THTMLWriter): THTMLCustomElement;
+var opened : boolean;
+begin
+  if assigned (FDataSource) and assigned(datasource.dataset) then
+    begin
+    result := WriteHeader (aWriter);
+    try
+        with FDataSource.dataset do
+          try
+            opened := Active;
+            if not opened then
+              Open;
+            first;
+            while not eof do
+              begin
+              WriteRecord(aWriter);
+              next;
+              end;
+          finally
+            if opened then
+              close;
+          end;
+    finally
+      WriteFooter (aWriter);
+    end;
+    end;
+end;
+
+procedure THTMLCustomDatasetContentProducer.DoWriteHeader(aWriter: THTMLWriter; var el : THTMLCustomElement);
+begin
+  if assigned (FOnWriteHeader) then
+    FOnWriteHeader (self, aWriter, el);
+end;
+
+procedure THTMLCustomDatasetContentProducer.DoWriteFooter(aWriter: THTMLWriter);
+begin
+  if assigned (FOnWriteFooter) then
+    FOnWriteFooter (self, aWriter);
+end;
+
+procedure THTMLCustomDatasetContentProducer.DoWriteRecord(aWriter: THTMLWriter);
+begin
+  if assigned (FOnWriteRecord) then
+    FOnWriteRecord (self, aWriter);
+end;
+
+{ THTMLSelectProducer }
+
+procedure THTMLSelectProducer.SetItems(const AValue: TStrings);
+begin
+  if FItems<>AValue then
+    FItems.assign(AValue);
+end;
+
+function THTMLSelectProducer.WriteContent(aWriter: THTMLWriter): THTMLCustomElement;
+begin
+  result := aWriter.FormSelect(FControlName, FPreselected, FSize, FItems, FUseValues);
+end;
+
+constructor THTMLSelectProducer.create(aOwner: TComponent);
+begin
+  inherited create (aOwner);
+  FItems := TStringlist.Create;
+  size := 1;
+end;
+
+destructor THTMLSelectProducer.destroy;
+begin
+  FItems.Free;
+  inherited;
+end;
+
+{ THTMLDatasetSelectProducer }
+
+procedure THTMLDatasetSelectProducer.DoWriteHeader (aWriter : THTMLWriter; var el : THTMLCustomElement);
+var s : THTML_Select;
+begin
+  s := aWriter.StartSelect;
+  s.size := FSize;
+  s.name := FControlName;
+  el := s;
+  if FValueField <> '' then
+    FValue := datasource.dataset.findfield (FValueField);
+  if FItemField <> '' then
+    FItem := DataSource.dataset.findfield (FItemField);
+  inherited DoWriteHeader(aWriter, el);
+end;
+
+procedure THTMLDatasetSelectProducer.DoWriteFooter(aWriter: THTMLWriter);
+begin
+  inherited DoWriteFooter(aWriter);
+  aWriter.EndSelect;
+end;
+
+procedure THTMLDatasetSelectProducer.DoWriteRecord(aWriter: THTMLWriter);
+var sel : boolean;
+begin
+  if assigned (FItem) then
+    with aWriter.Option(FItem.asstring) do
+      begin
+      if assigned (FIsPreSelected) then
+        begin
+        sel := false;
+        FIsPreSelected (self, sel);
+        selected := sel;
+        end;
+      if assigned (FValue) then
+        Value := FValue.Asstring;
+      end;
+end;
+
+constructor THTMLDatasetSelectProducer.create(aOwner: TComponent);
+begin
+  inherited create(aOwner);
+  Size := '1';
+end;
+
+{ TCustomHTMLDataModule }
+
+Function TCustomHTMLModule.CreateDocument : THTMLDocument;
+
+begin
+  If Assigned(FOnCreateDocument) then
+    FOnCreateDocument(Self,Result);
+  If (Result=Nil) then
+    Result:=THTMLDocument.Create;
+end;
+
+constructor TCustomHTMLModule.Create(AOwner: TComponent);
+begin
+  FActions:=THTMLContentActions.Create(THTMLContentAction);
+  inherited Create(AOwner);
+end;
+
+procedure TCustomHTMLModule.SetActions(const AValue: THTMLContentActions);
+begin
+
+end;
+
+Function TCustomHTMLModule.CreateWriter(ADocument : THTMLDocument) : THTMLWriter;
+
+begin
+  If Assigned(FOnCreateWriter) then
+    FOnCreateWriter(Self,ADocument,Result);
+  if (Result=Nil) then
+    Result:=THTMLWriter.Create(ADocument);
+end;
+
+
+procedure TCustomHTMLModule.HandleRequest(ARequest: TRequest; AResponse: TResponse);
+
+Var
+  FWriter : THTMLWriter;
+  B : Boolean;
+  M : TMemoryStream;
+  
+begin
+  CreateDocument;
+  Try
+    FWriter:=CreateWriter(FDocument);
+    Try
+      B:=False;
+      If Assigned(OnGetContent) then
+        OnGetContent(Self,ARequest,FWriter,B);
+      If Not B then
+        Raise EHTMLError.Create(SErrRequestNotHandled);
+      If (AResponse.ContentStream=Nil) then
+        begin
+        M:=TMemoryStream.Create;
+        AResponse.ContentStream:=M;
+        end;
+      FDocument.SaveToStream(AResponse.ContentStream);
+    Finally
+      FWriter.Free;
+    end;
+  Finally
+    FDocument.Free;
+  end;
+end;
+
+{ THTMLContentActions }
+
+procedure THTMLContentActions.HandleRequest(ARequest: TRequest;
+  HTMLPage: THTMLWriter; var Handled: Boolean);
+  
+Var
+  A : TCustomWebAction;
+
+begin
+{$ifdef cgidebug}SendMethodEnter('HTMLContentWebActions.handlerequest');{$endif cgidebug}
+  A:=GetRequestAction(ARequest);
+  if Assigned(A) then
+    (A as THTMLContentAction).HandleRequest(ARequest,HTMLPage,Handled);
+{$ifdef cgidebug}SendMethodEnter('HTMLContentWebActions.handlerequest');{$endif cgidebug}
+end;
+
+
+{ THTMLContentAction }
+
+procedure THTMLContentAction.HandleRequest(ARequest: TRequest;
+  HTMLPage: THTMLWriter; var Handled: Boolean);
+begin
+  If Assigned(FOngetContent) then
+    FOnGetContent(Self,ARequest,HTMLPage,Handled);
+end;
+
+end.
+

+ 396 - 0
fcl/web/fphttp.pp

@@ -0,0 +1,396 @@
+{$mode objfpc}
+{$H+}
+unit fphttp;
+
+Interface
+
+uses sysutils,classes,httpdefs;
+
+Type
+
+  { THTTPContentProducer }
+  TWebActionEvent = Procedure (Sender : TObject;
+                               ARequest : TRequest;
+                               AResponse : TResponse;
+                               Var Handled : Boolean) of object;
+
+  THTTPContentProducer = Class(TComponent)
+  private
+    FAfterResponse: TResponseEvent;
+    FBeforeRequest: TRequestEvent;
+  Protected
+    Procedure DoHandleRequest(ARequest : TRequest; AResponse : TResponse; Var Handled : Boolean); virtual;
+    Procedure DoGetContent(ARequest : TRequest; Content : TStream; Var Handled : Boolean); virtual;
+    Procedure HandleRequest(ARequest : TRequest; AResponse : TResponse; Var Handled : Boolean);
+    Function ProduceContent : String; virtual;
+  Protected
+    Property BeforeRequest : TRequestEvent Read FBeforeRequest Write FBeforeRequest;
+    Property AfterResponse : TResponseEvent Read FAfterResponse Write FAfterResponse;
+  Public
+    Procedure GetContent(ARequest : TRequest; Content : TStream; Var Handled : Boolean);
+    Function  HaveContent : Boolean; virtual;
+    Procedure ContentToStream(Stream : TStream); virtual;
+  end;
+  
+  { TCustomWebAction }
+  TCustomWebAction = Class(TCollectionItem)
+  private
+    FAfterResponse: TResponseEvent;
+    FBeforeRequest: TRequestEvent;
+    FContentproducer: THTTPContentProducer;
+    FDefault: Boolean;
+    FName : String;
+  Protected
+    procedure SetContentProducer(const AValue: THTTPContentProducer);virtual;
+    Function  GetDisplayName : String; override;
+    Procedure SetDisplayName(AValue : String);
+    Procedure HandleRequest(ARequest : TRequest; AResponse : TResponse; Var Handled : Boolean);
+    Procedure DoHandleRequest(ARequest : TRequest; AResponse : TResponse; Var Handled : Boolean); virtual;
+  published
+    Property Name : String Read GetDisplayName Write SetDisplayName;
+    Property ContentProducer : THTTPContentProducer Read FContentproducer Write SetContentProducer;
+    Property Default : Boolean Read FDefault Write FDefault;
+    Property BeforeRequest : TRequestEvent Read FBeforeRequest Write FBeforeRequest;
+    Property AfterResponse : TResponseEvent Read FAfterResponse Write FAfterResponse;
+  end;
+
+  { TCustomWebActions }
+  TGetActionEvent = Procedure (Sender : TObject; ARequest : TRequest; Var ActionName : String) of object;
+
+  TCustomWebActions = Class(TCollection)
+  private
+    FActionVar : String;
+    FOnGetAction: TGetActionEvent;
+    function GetActions(Index : Integer): TCustomWebAction;
+    procedure SetActions(Index : Integer; const AValue: TCustomWebAction);
+  Protected
+    Function  GetRequestAction(ARequest: TRequest) : TCustomWebAction;
+    Function  GetActionName(ARequest : TRequest) : String;
+    Property  ActionVar : String Read FactionVar Write FActionVar;
+  public
+    Procedure Assign(Source : TPersistent); override;
+    Function Add : TCustomWebAction;
+    Function ActionByName(AName : String) : TCustomWebAction;
+    Function FindAction(AName : String): TCustomWebAction;
+    Function IndexOfAction(AName : String) : Integer;
+    Property OnGetAction : TGetActionEvent Read FOnGetAction Write FOnGetAction;
+    Property Actions[Index : Integer] : TCustomWebAction Read GetActions Write SetActions; Default;
+  end;
+  
+  TCustomHTTPModule = Class(TDataModule)
+  public
+    Procedure HandleRequest(ARequest : TRequest; AResponse : TResponse); virtual; abstract;
+  end;
+  
+  TCustomHTTPModuleClass = Class of TCustomHTTPModule;
+
+  { TModuleItem }
+
+  TModuleItem = Class(TCollectionItem)
+  private
+    FModuleClass: TCustomHTTPModuleClass;
+    FModuleName: String;
+  Public
+    Property ModuleClass : TCustomHTTPModuleClass Read FModuleClass Write FModuleClass;
+    Property ModuleName : String Read FModuleName Write FModuleName;
+  end;
+
+  { TModuleFactory }
+
+  TModuleFactory = Class(TCollection)
+  private
+    function GetModule(Index : Integer): TModuleItem;
+    procedure SetModule(Index : Integer; const AValue: TModuleItem);
+  Public
+    Function FindModule(AModuleName : String) : TModuleItem;
+    Function ModuleByName(AModuleName : String) : TModuleItem;
+    Function IndexOfModule(AModuleName : String) : Integer;
+    Property Modules [Index : Integer]: TModuleItem Read GetModule Write SetModule;default;
+  end;
+
+  EFPHTTPError = Class(Exception);
+
+Procedure RegisterHTTPModule(ModuleClass : TCustomHTTPModuleClass);
+Procedure RegisterHTTPModule(Const ModuleName : String; ModuleClass : TCustomHTTPModuleClass);
+
+Var
+  ModuleFactory : TModuleFactory;
+  
+Resourcestring
+  SErrNosuchModule = 'No such module registered: "%s"';
+  SErrNoSuchAction = 'No action found for action: "%s"';
+  SErrUnknownAction = 'Unknown action: "%s"';
+  SErrNoDefaultAction = 'No action name and no default action';
+  SErrRequestNotHandled = 'Web request was not handled by actions.';
+
+Implementation
+
+{$ifdef cgidebug}
+uses dbugintf;
+{$endif}
+
+
+{ TModuleFactory }
+
+function TModuleFactory.GetModule(Index : Integer): TModuleItem;
+begin
+  Result:=TModuleItem(Items[Index]);
+end;
+
+procedure TModuleFactory.SetModule(Index : Integer; const AValue: TModuleItem);
+begin
+  Items[Index]:=AValue;
+end;
+
+function TModuleFactory.FindModule(AModuleName: String): TModuleItem;
+
+Var
+  I : Integer;
+
+begin
+  I:=IndexOfModule(AModuleName);
+  If (I=-1) then
+    Result:=Nil
+  else
+    Result:=GetModule(I);
+end;
+
+function TModuleFactory.ModuleByName(AModuleName: String): TModuleItem;
+begin
+  Result:=FindModule(AModuleName);
+  If (Result=Nil) then
+    Raise EFPHTTPError.CreateFmt(SErrNosuchModule,[AModuleName]);
+end;
+
+function TModuleFactory.IndexOfModule(AModuleName: String): Integer;
+
+begin
+  Result:=Count-1;
+  While (Result>=0) and (CompareText(Modules[Result].ModuleName,AModuleName)<>0) do
+    Dec(Result);
+end;
+
+
+procedure RegisterHTTPModule(ModuleClass: TCustomHTTPModuleClass);
+begin
+  RegisterHTTPModule(ModuleClass.ClassName,ModuleClass);
+end;
+
+procedure RegisterHTTPModule(const ModuleName: String;
+  ModuleClass: TCustomHTTPModuleClass);
+  
+Var
+  I : Integer;
+  MI : TModuleItem;
+  
+begin
+  I:=ModuleFactory.IndexOfModule(ModuleName);
+  If (I=-1) then
+    begin
+    MI:=ModuleFactory.Add as TModuleItem;
+    MI.ModuleName:=ModuleName;
+    end
+  else
+    MI:=ModuleFactory[I];
+  MI.ModuleClass:=ModuleClass;
+end;
+
+{ THTTPContentProducer }
+
+
+procedure THTTPContentProducer.HandleRequest(ARequest: TRequest;
+  AResponse: TResponse; Var Handled : Boolean);
+  
+begin
+  If Assigned(FBeforeRequest) then
+    FBeforeRequest(Self,ARequest);
+  DoHandleRequest(Arequest,AResponse,Handled);
+  If Assigned(FAfterResponse) then
+    FAfterResponse(Self,AResponse);
+end;
+
+procedure THTTPContentProducer.GetContent(ARequest: TRequest; Content: TStream; Var Handled : Boolean);
+begin
+  If Assigned(FBeforeRequest) then
+    FBeforeRequest(Self,ARequest);
+  DoGetContent(Arequest,Content,Handled);
+end;
+  
+procedure THTTPContentProducer.DoHandleRequest(ARequest: TRequest;
+  AResponse: TResponse; Var Handled : Boolean);
+
+Var
+  M : TMemoryStream;
+  
+begin
+  M:=TMemoryStream.Create;
+  DoGetContent(ARequest,M,Handled);
+  AResponse.ContentStream:=M;
+end;
+
+procedure THTTPContentProducer.DoGetContent(ARequest: TRequest; Content: TStream; Var Handled : Boolean);
+begin
+  Handled:=HaveContent;
+  If Handled then
+    ContentToStream(Content);
+end;
+
+function THTTPContentProducer.ProduceContent: String;
+begin
+  Result:='';
+end;
+
+function THTTPContentProducer.HaveContent: Boolean;
+begin
+  Result:=(ProduceContent<>'');
+end;
+
+procedure THTTPContentProducer.ContentToStream(Stream: TStream);
+
+Var
+  S : String;
+
+begin
+  S:=ProduceContent;
+  If length(S)>0 then
+    Stream.WriteBuffer(S[1],Length(S));
+end;
+
+{ TCustomWebAction }
+
+procedure TCustomWebAction.SetContentProducer(const AValue: THTTPContentProducer
+  );
+begin
+  FContentProducer:=AValue;
+end;
+
+function TCustomWebAction.GetDisplayName: String;
+begin
+  If (FName='') then
+    FName:=ClassName+IntToStr(self.Index);
+  Result:=FName;
+end;
+
+procedure TCustomWebAction.SetDisplayName(AValue: String);
+begin
+  Inherited;
+  FName:=AValue;
+end;
+
+procedure TCustomWebAction.HandleRequest(ARequest: TRequest; AResponse: TResponse; Var Handled : Boolean);
+
+begin
+  If Assigned(FBeforeRequest) then
+    FBeforeRequest(Self,ARequest);
+  DoHandleRequest(Arequest,AResponse,Handled);
+  If Assigned(FAfterResponse) then
+    FAfterResponse(Self,AResponse);
+end;
+
+procedure TCustomWebAction.DoHandleRequest(ARequest: TRequest; AResponse: TResponse; Var Handled : Boolean);
+
+begin
+  If Assigned(FContentProducer) then
+   FContentProducer.HandleRequest(ARequest,AResponse,Handled)
+end;
+
+
+{ TCustomWebActions }
+
+function TCustomWebActions.GetActions(Index : Integer): TCustomWebAction;
+begin
+  Result:=TCustomWebAction(Items[Index]);
+end;
+
+procedure TCustomWebActions.SetActions(Index : Integer; const AValue: TCustomWebAction);
+begin
+  Items[Index]:=AValue;
+end;
+
+Function TCustomWebActions.GetRequestAction(ARequest: TRequest) : TCustomWebAction;
+
+Var
+  I : Integer;
+  S : String;
+
+begin
+  Result:=Nil;
+  S:=GetActionName(ARequest);
+  If (S<>'') then
+    Result:=FindAction(S)
+  else
+    begin
+    I:=0;
+    While (Result=Nil) and (I<Count) do
+      begin
+      If Actions[i].Default then
+        Result:=Actions[i];
+      Inc(i);
+      end;
+    If (Result=Nil) then
+      Raise EFPHTTPError.Create(SErrNoDefaultAction);
+    end;
+end;
+
+
+function TCustomWebActions.GetActionName(ARequest: TRequest): String;
+
+begin
+  If Assigned(FOnGetAction) then
+    FOnGetAction(Self,ARequest,Result);
+  If (Result='') then
+    begin
+    If (FActionVar<>'') then
+      Result:=ARequest.QueryFields.Values[FActionVar];
+    If (Result='') then
+      Result:=ARequest.GetNextPathInfo;
+    end;
+end;
+
+procedure TCustomWebActions.Assign(Source: TPersistent);
+begin
+  If (Source is TCustomWebActions) then
+    ActionVar:=(Source as TCustomWebActions).ActionVar
+  else
+    inherited Assign(Source);
+end;
+
+function TCustomWebActions.Add: TCustomWebAction;
+begin
+  Result:=TCustomWebAction(Inherited Add);
+end;
+
+function TCustomWebActions.ActionByName(AName: String): TCustomWebAction;
+begin
+  Result:=FindAction(AName);
+  If (Result=Nil) then
+    Raise HTTPError.CreateFmt(SErrUnknownAction,[AName]);
+end;
+
+function TCustomWebActions.FindAction(AName: String): TCustomWebAction;
+
+Var
+  I : Integer;
+
+begin
+  I:=IndexOfAction(AName);
+  If (I=-1) then
+    Result:=Nil
+  else
+    Result:=Actions[I];
+end;
+
+function TCustomWebActions.IndexOfAction(AName: String): Integer;
+
+begin
+  Result:=Count-1;
+  While (Result>=0) and (CompareText(Actions[Result].Name,AName)<>0) do
+    Dec(Result);
+end;
+
+Initialization
+  ModuleFactory:=TModuleFactory.Create(TModuleItem);
+
+Finalization
+  FreeAndNil(ModuleFactory);
+end.

+ 460 - 0
fcl/web/fptemplate.pp

@@ -0,0 +1,460 @@
+{$mode objfpc}
+{$H+}
+{$define NOCONTNRS}
+unit fpTemplate;
+
+
+interface
+
+uses
+  SysUtils,
+  Classes;
+
+Const
+  DefaultParseDepth = 100;
+  MaxDelimLength    = 5;
+  
+Type
+  TParseDelimiter = String[5];
+  
+Var
+  DefaultStartDelimiter : TParseDelimiter = '{';
+  DefaultEndDelimiter  : TParseDelimiter = '}';
+
+Type
+  TGetParamEvent = Procedure(Sender : TObject; Const ParamName : String; Out AValue : String) Of Object;
+
+  { TTemplateParser }
+
+  TTemplateParser = Class(TObject)
+  Private
+    FParseLevel : Integer;
+    FMaxParseDepth : Integer;
+    FEndDelimiter: TParseDelimiter;
+    FStartDelimiter: TParseDelimiter;
+    FRecursive: Boolean;
+    FValues : TStringList;
+    FOnGetParam: TGetParamEvent;
+    function GetDelimiter(Index: integer): TParseDelimiter;
+    function GetValue(Key : String): String;
+    procedure SetDelimiter(Index: integer; const AValue: TParseDelimiter);
+    procedure SetValue(Key : String; const AValue: String);
+  Public
+    Constructor Create;
+    Destructor Destroy; override;
+    Procedure Clear;
+    Function GetParam(Const Key : String; Out AValue : String) : Boolean;
+    Function ParseString(Src : String) : String;
+    Function ParseStream(Src : TStream; Dest : TStream) : Integer; // Wrapper, Returns number of bytes written.
+    Procedure ParseStrings(Src : TStrings; Dest : TStrings) ; // Wrapper
+    Property OnGetParam : TGetParamEvent Read FOnGetParam Write FOnGetParam;  // Called if not found in values
+    Property StartDelimiter : TParseDelimiter Index 1 Read GetDelimiter Write SetDelimiter; // Start char/string, default '}'
+    Property EndDelimiter : TParseDelimiter Index 2 Read GetDelimiter Write SetDelimiter;  // end char/string, default '}'
+    Property Values[Key : String] : String Read GetValue Write SetValue; // Contains static values.
+    Property Recursive : Boolean Read FRecursive Write FRecursive;
+  end;
+
+  { TFPCustomTemplate }
+
+  TFPCustomTemplate = Class(TPersistent)
+  private
+    FEndDelimiter: TParseDelimiter;
+    FStartDelimiter: TParseDelimiter;
+    FFileName: String;
+    FTemplate: String;
+    FOnGetParam: TGetParamEvent;
+  Protected
+    Procedure GetParam(Sender : TObject; Const ParamName : String; Out AValue : String);virtual;
+    Function CreateParser : TTemplateParser; virtual;
+  Public
+    Function HasContent : Boolean;
+    Function GetContent : String;
+    Procedure Assign(Source : TPersistent); override;
+    Property StartDelimiter : TParseDelimiter Read FStartDelimiter Write FStartDelimiter;
+    Property EndDelimiter : TParseDelimiter Read FEndDelimiter Write FEndDelimiter;
+    Property FileName : String Read FFileName Write FFileName;
+    Property Template : String Read FTemplate Write FTemplate;
+    Property OnGetParam : TGetParamEvent Read FOnGetParam Write FOnGetParam;
+  end;
+  
+  TFPTemplate = Class(TFPCustomTemplate)
+  Published
+    Property FileName;
+    Property Template;
+  end;
+  
+  ETemplateParser = Class(Exception);
+
+Var
+  MaxParseDepth : Integer = DefaultParseDepth;
+
+
+implementation
+
+Resourcestring
+  SErrParseDepthExceeded = 'Maximum parse level (%d) exceeded.';
+  SErrNoEmptyDelimiters = 'Delimiters cannot be empty';
+  
+{ TTemplateParser }
+Type
+
+  { TStringItem }
+
+  TStringItem = Class(TObject)
+  Private
+    FValue : String;
+  Public
+    Constructor Create(AValue : String);
+    Property Value : String Read FValue Write FValue;
+  end;
+
+{ TStringItem }
+
+constructor TStringItem.Create(AValue: String);
+begin
+  FValue:=AValue;
+end;
+
+function TTemplateParser.GetValue(Key : String): String;
+
+Var
+  I : Integer;
+
+begin
+  Result:='';
+  If Assigned(FValues) then
+    begin
+    I:=FValues.IndexOf(Key);
+    If (I<>-1) then
+      Result:=TStringItem(FValues.Objects[i]).Value;
+    end;
+end;
+
+function TTemplateParser.GetDelimiter(Index: integer): TParseDelimiter;
+begin
+  If Index=1 then
+    Result:=FStartDelimiter
+  else
+    Result:=FEndDelimiter;
+end;
+
+procedure TTemplateParser.SetDelimiter(Index: integer;
+  const AValue: TParseDelimiter);
+begin
+  If Length(AValue)=0 then
+    Raise ETemplateParser.Create(SErrNoEmptyDelimiters);
+  If Index=1 then
+    FStartDelimiter:=AValue
+  else
+    FEndDelimiter:=AValue;
+
+end;
+
+procedure TTemplateParser.SetValue(Key : String; const AValue: String);
+
+Var
+  I : Integer;
+  SI : TStringItem;
+  
+begin
+  If (AValue='') then
+    begin
+    If Assigned(FValues) then
+      begin
+      I:=FValues.IndexOf(Key);
+      If (I<>-1) then
+        begin
+        FValues.Objects[i].Free;
+        FValues.Delete(I);
+        end;
+      end;
+    end
+  else
+    begin
+    if Not Assigned(FValues) then
+      begin
+      FVAlues:=TStringList.Create;
+      FValues.Sorted:=True;
+      end;
+    I:=FValues.IndexOf(Key);
+    If (I=-1) then
+      FValues.AddObject(Key,TStringItem.Create(AValue))
+    else
+      TStringItem(FValues.Objects[I]).Value:=AValue;
+    end;
+end;
+
+constructor TTemplateParser.Create;
+
+begin
+  FMaxParseDepth:=MaxParseDepth;
+  FStartDelimiter:=DefaultStartDelimiter;
+  FEndDelimiter:=DefaultEndDelimiter;
+end;
+
+destructor TTemplateParser.Destroy;
+
+begin
+  Clear;
+  inherited Destroy;
+end;
+
+procedure TTemplateParser.Clear;
+
+Var
+  I : Integer;
+  
+begin
+  If Assigned(FValues) then
+    For I:=0 to FValues.Count-1 do
+      FValues.Objects[i].Free;
+  FreeAndNil(FValues);
+end;
+
+function TTemplateParser.GetParam(const Key: String; out AValue: String): Boolean;
+  
+Var
+  I : Integer;
+  
+begin
+  If Assigned(FValues) then
+    I:=FValues.IndexOf(Key)
+  else
+    I:=-1;
+  Result:=(I<>-1);
+  If Result then
+    AValue:=TStringItem(FValues.Objects[i]).Value
+  else
+    begin
+    Result:=Assigned(FOnGetParam);
+    If Result then
+      FOnGetParam(Self,Key,AValue);
+    end;
+  If Result and Recursive then
+    AValue:=ParseString(AValue);
+end;
+
+Function FindDelimiter(SP : PChar; D : TParseDelimiter; MaxLen : Integer) : PChar; Inline;
+
+Var
+  P,P2 : PChar;
+  I,DLen : Integer;
+
+begin
+  Result:=Nil;
+  DLen:=Length(D);
+  Dec(MaxLen,(DLen-1));
+  If MaxLen<=0 then
+   exit;
+  P:=SP;
+  While (Result=Nil) and (P-SP<=MaxLen) do
+    begin
+    While (P-SP<=MaxLen) and (P^<>D[1]) do
+      Inc(P);
+    If ((P-SP)<=MaxLen) then
+      begin
+      Result:=P;
+      P2:=P+1;
+      // Check Other characters
+      I:=2;
+      While (I<=DLen) and (Result<>Nil) do
+        If (P2^=D[i]) then
+          begin
+          inc(i);
+          Inc(p2);
+          end
+        else
+          begin
+          P:=Result;
+          Result:=Nil;
+          end;
+      // Either result<>Nil -> match or result=nil -> no match
+      inc(P);
+      end;
+    end;
+end;
+
+Procedure AddToString(Var S : String; P : PChar; NChars : Integer);inline;
+
+Var
+  SLen : Integer;
+
+begin
+  SLen:=Length(S);
+  SetLength(S,SLen+NChars);
+  Move(P^,S[Slen+1],NChars);
+end;
+
+function TTemplateParser.ParseString(Src: String): String;
+
+Var
+  PN,PV : String;
+  i,RLen,SLen,STlen : Integer;
+  TS,TE,SP,P : PChar;
+
+begin
+  Inc(FParseLevel);
+  If FParseLevel>FMaxParseDepth then
+    Raise ETemplateParser.CreateFmt(SErrParseDepthExceeded,[FMaxParseDepth]);
+  SLen:=Length(Src); // Minimum
+  If SLen=0 then
+    exit;
+  STLen:=Length(FStartDelimiter);
+  Result:='';
+  SP:=PChar(Src);
+  P:=SP;
+  While (P-SP<SLen) do
+    begin
+    TS:=FindDelimiter(P,FStartDelimiter,SLen-(P-SP));
+    If (TS=Nil) then
+      begin
+      TS:=P;
+      P:=SP+SLen
+      end
+    else
+      begin
+      I:=TS-P;
+      TE:=FindDelimiter(TS,FendDelimiter,SLen-I+1);
+      If (TE=Nil) then
+        begin
+        TS:=P;
+        P:=SP+SLen;
+        end
+      else
+        begin
+        // Add text prior to template to result
+        AddToString(Result,P,I);
+        // retrieve template name
+        inc(TS,Length(FendDelimiter));
+        I:=TE-TS;
+        Setlength(PN,I);
+        Move(TS^,PN[1],I);
+        If GetParam(PN,PV) then
+          begin
+          Result:=Result+PV;
+          end;
+        P:=TE+Length(FEndDelimiter);
+        TS:=P;
+        end;
+      end
+    end;
+  I:=P-TS;
+  If (I>0) then
+    AddToString(Result,TS,I);
+end;
+
+function TTemplateParser.ParseStream(Src: TStream; Dest: TStream): Integer;
+
+Var
+  SS : TStringStream;
+  S,R : String;
+  
+begin
+  SS:=TStringStream.Create('');
+  Try
+    SS.CopyFrom(Src,0);
+    S:=SS.DataString;
+  Finally
+    SS.Free;
+  end;
+  R:=ParseString(S);
+  Result:=Length(R);
+  If (Result>0) then
+    Dest.Write(R[1],Result);
+end;
+
+procedure TTemplateParser.ParseStrings(Src: TStrings; Dest: TStrings);
+
+Var
+  I : Integer;
+
+begin
+  For I:=0 to Src.Count-1 do
+    Dest.Add(ParseString(Src[i]));
+end;
+
+{ TFPCustomTemplate }
+
+procedure TFPCustomTemplate.GetParam(Sender: TObject; const ParamName: String;
+  out AValue: String);
+  
+begin
+  If Assigned(FOnGetParam) then
+   FOnGetParam(Self,ParamName,AValue);
+end;
+
+function TFPCustomTemplate.CreateParser: TTemplateParser;
+
+begin
+  Result:=TTemplateParser.Create;
+  If (FStartDelimiter<>'') then
+    Result.StartDelimiter:=FStartDelimiter;
+  If (FEndDelimiter<>'') then
+    Result.EndDelimiter:=FEndDelimiter;
+  Result.OnGetParam:=@GetParam;
+end;
+
+function TFPCustomTemplate.HasContent: Boolean;
+
+begin
+  Result:=(FTemplate<>'') or (FFileName<>'');
+end;
+
+function TFPCustomTemplate.GetContent: String;
+
+Var
+  P : TTemplateParser;
+  S : TStringStream;
+  F : TFileStream;
+  
+begin
+  F:=Nil;
+  S:=Nil;
+  If HasContent then
+    begin
+    if (FFileName<>'') then
+      begin
+      F:=TFileStream.Create(FFileName,fmOpenRead);
+      S:=TStringStream.Create('');
+      end;
+    Try
+      P:=CreateParser;
+      Try
+        If (F=Nil) then
+          begin
+          P.ParseStream(F,S);
+          Result:=S.DataString;
+          end
+        else
+          Result:=P.ParseString(FTemplate);
+      Finally
+        P.Free;
+      end;
+    Finally
+      F.Free;
+      S.Free;
+    end;
+    end;
+end;
+
+procedure TFPCustomTemplate.Assign(Source: TPersistent);
+
+Var
+  T : TFPCustomTemplate;
+
+begin
+  If Source is TFPCustomTemplate then
+    begin
+    T:=Source as TFPCustomTemplate;
+    FEndDelimiter:=T.EndDelimiter;
+    FStartDelimiter:=T.StartDelimiter;
+    FFileName:=T.FileName;
+    FTemplate:=T.Template;
+    FOnGetParam:=T.OnGetParam;
+    end
+  else
+    inherited Assign(Source);
+end;
+
+end.
+

+ 523 - 0
fcl/web/fpweb.pp

@@ -0,0 +1,523 @@
+{$mode objfpc}
+{$H+}
+unit fpWeb;
+
+interface
+
+uses
+  Classes, SysUtils, httpdefs, fphttp, inifiles, fptemplate, websession;
+
+Type
+
+  { TFPWebAction }
+
+  TFPWebAction = Class(TCustomWebAction)
+  Private
+    FOnrequest: TWebActionEvent;
+    FContents : TStrings;
+    FTemplate : TFPTemplate;
+    function  GetStringContent: String;
+    function  GetContents: TStrings;
+    procedure SetContent(const AValue: String);
+    procedure SetContents(const AValue: TStrings);
+    Procedure SetTemplate(const AValue : TFPTemplate);
+  Protected  
+    Procedure DoHandleRequest(ARequest : TRequest; AResponse : TResponse; Var Handled : Boolean); override;
+    Procedure DoGetContent(ARequest : TRequest; Content : TStream; Var Handled : Boolean); virtual;
+    Procedure GetContent(ARequest : TRequest; Content : TStream; Var Handled : Boolean);
+    Procedure Assign(Source : TPersistent); override;
+  Public
+    Constructor create(ACollection : TCollection); override;
+    Destructor destroy; override;
+  published
+    Property Content : String Read GetStringContent Write SetContent;
+    Property Contents : TStrings Read GetContents Write SetContents;
+    Property OnRequest: TWebActionEvent Read FOnrequest Write FOnrequest;
+    Property Template : TFPTemplate Read FTemplate Write SetTemplate;
+  end;  
+
+  { TFPWebActions }
+
+  TFPWebActions = Class(TCustomWebActions)
+    Procedure HandleRequest(ARequest : TRequest; AResponse : TResponse; Var Handled : Boolean); virtual;
+    Procedure GetContent(ARequest : TRequest; Content : TStream; Var Handled : Boolean); virtual;
+  Public
+    Property ActionVar;
+  end;
+
+  { TTemplateVar }
+
+
+  TTemplateVar = Class(TCollectionItem)
+  Private
+    FName: String;
+    FValue: String;
+  Public
+    Procedure Assign(Source : TPersistent); override;
+    Function GetDisplayName : String; override;
+  Published
+    Property Name : String Read FName Write FName;
+    Property Value : String Read FValue Write FValue;
+  end;
+
+  { TTemplateVars }
+
+  TTemplateVars = Class(TCollection)
+  Private
+    function GetVar(I : Integer): TTemplateVar;
+    procedure Setvar(I : Integer; const AValue: TTemplateVar);
+  Public
+    Function IndexOfVar(AName : String) : Integer;
+    Function VarByName(AName : String) : TTemplateVar;
+    Function FindVar(AName : String) : TTemplateVar;
+    Property Variables[I : Integer] : TTemplateVar Read GetVar Write Setvar; default;
+  end;
+
+  TContentEvent = Procedure (Sender : TObject; Content : TStream) of object;
+
+  { TCustomFPWebModule }
+
+  TCustomFPWebModule = Class(TSessionHTTPModule)
+  private
+    FActions: TFPWebActions;
+    FAfterResponse: TResponseEvent;
+    FBeforeRequest: TRequestEvent;
+    FOnGetParam: TGetParamEvent;
+    FOnRequest: TWebActionEvent;
+    FTemplate: TFPTemplate;
+    FTemplateVars : TTemplateVars;
+    function GetActionVar: String;
+    function GetOnGetAction: TGetActionEvent;
+    procedure SetActions(const AValue: TFPWebActions);
+    procedure SetActionVar(const AValue: String);
+    procedure SetOnGetAction(const AValue: TGetActionEvent);
+    procedure SetTemplate(const AValue: TFPTemplate);
+
+  Protected
+    Procedure DoBeforeRequest(ARequest : TRequest); virtual;
+    Procedure DoAfterResponse(AResponse : TResponse); virtual;
+    Procedure GetParam(Const ParamName : String; Out Value : String); virtual; // Called by template
+    Procedure GetTemplateContent(ARequest : TRequest; AResponse : TResponse); virtual;
+    function GetContent: String;virtual;
+  Public
+    Constructor CreateNew(AOwner : TComponent; CreateMode : Integer); override;
+    Destructor Destroy; override;
+    Procedure HandleRequest(ARequest : TRequest; AResponse : TResponse); override;
+    Property Actions : TFPWebActions Read FActions Write SetActions;
+    Property ActionVar : String Read GetActionVar Write SetActionVar;
+    Property BeforeRequest : TRequestEvent Read FBeforeRequest Write FBeforeRequest;
+    Property OnRequest : TWebActionEvent Read FOnRequest Write FOnRequest;
+    Property AfterResponse : TResponseEvent Read FAfterResponse Write FAfterResponse;
+    Property OnGetAction : TGetActionEvent Read GetOnGetAction Write SetOnGetAction;
+    Property Template : TFPTemplate Read FTemplate Write SetTemplate;
+    Property OnGetParam : TGetParamEvent Read FOnGetParam Write FOnGetParam;
+    Property OnTemplateContent : TGetParamEvent Read FOnGetParam Write FOnGetParam;
+  end;
+  
+  { TFPWebModule }
+
+  TFPWebModule = Class(TCustomFPWebModule)
+  Published
+    Property Actions;
+    Property ActionVar;
+    Property BeforeRequest;
+    Property OnRequest;
+    Property AfterResponse;
+    Property OnGetAction;
+    Property CreateSession;
+    Property Session;
+    Property OnNewSession;
+    Property OnSessionExpired;
+  end;
+  
+  EFPWebError = Class(HTTPError);
+
+resourcestring
+  SErrInvalidVar        = 'Invalid template variable name : "%s"';
+  SErrInvalidWebAction  = 'Invalid action for "%s".';
+  SErrNoContentProduced = 'No template content was produced.';
+
+implementation
+
+{$ifdef cgidebug}
+uses dbugintf;
+{$endif cgidebug}
+
+procedure TFPWebAction.GetContent(ARequest: TRequest; Content: TStream; Var Handled : Boolean);
+
+begin
+
+end;
+
+procedure TFPWebAction.Assign(Source: TPersistent);
+
+Var
+  A : TFPWebAction;
+
+begin
+  If (Source is TFPWebAction) then
+    begin
+    A:=Source as TFPWebAction;
+    Name:=A.Name;
+    Content:=A.Content;
+    AfterResponse:=A.AfterResponse;
+    BeforeRequest:=A.BeforeRequest;
+    Default:=A.default;
+    ContentProducer:=A.ContentProducer;
+    OnRequest:=A.OnRequest;
+    FTemplate.Assign(A.Template);
+    end
+  else
+    inherited Assign(Source);
+end;
+
+constructor TFPWebAction.create(ACollection: TCollection);
+begin
+  inherited create(ACollection);
+  FTemplate:=TFPtemplate.Create;
+end;
+
+destructor TFPWebAction.destroy;
+begin
+  FreeAndNil(FTemplate);
+  inherited destroy;
+end;
+
+function TFPWebAction.GetStringContent: String;
+begin
+  Result:=Contents.Text;
+end;
+
+function TFPWebAction.GetContents: TStrings;
+begin
+  If Not Assigned(FContents) then
+    FContents:=TStringList.Create;
+  Result:=FContents;
+end;
+
+procedure TFPWebAction.SetContent(const AValue: String);
+begin
+  If (AValue='') then
+    FreeAndNil(FContents)
+  else
+    Contents.Text:=AValue;
+end;
+
+procedure TFPWebAction.SetContents(const AValue: TStrings);
+begin
+  Contents.Assign(AValue);
+end;
+
+procedure TFPWebAction.SetTemplate(const AValue: TFPTemplate);
+begin
+  If Assigned(AValue) then
+    FTemplate.Assign(AValue);
+end;
+
+
+procedure TFPWebAction.DoHandleRequest(ARequest: TRequest; AResponse: TResponse; Var Handled : Boolean);
+
+begin
+{$ifdef cgidebug}
+  SendMethodEnter('TFPWebAction('+Name+').Dohandlerequest');
+  If Handled then
+    SendDebug('Handled !!')
+  else
+    SendDebug('Not yet handled.');
+{$endif cgidebug}
+  If Assigned(FOnRequest) then
+    begin
+{$ifdef cgidebug}
+    SendDebug('Executing user action');
+{$endif cgidebug}
+    FOnrequest(Self,Arequest,AResponse,Handled);
+    end;
+  If Not Handled then
+    begin
+{$ifdef cgidebug}
+    SendDebug('Executing inherited');
+{$endif cgidebug}
+    Inherited DoHandleRequest(ARequest,AResponse,Handled);
+    If not Handled then
+      begin
+      AResponse.Content:=Self.Content;
+      Handled:=(AResponse.Content<>'');
+      end;
+    end;
+{$ifdef cgidebug}
+  SendMethodExit('TFPWebAction('+Name+').Dohandlerequest');
+{$endif cgidebug}
+end;
+
+procedure TFPWebAction.DoGetContent(ARequest: TRequest; Content: TStream; Var Handled : Boolean);
+
+begin
+  If Assigned(ContentProducer) then
+    ContentProducer.GetContent(ARequest,Content,Handled)
+  else
+    If (Self.Content<>'') then
+      Content.Write(Self.Content[1],Length(Self.Content));
+end;
+
+
+{ TFPWebTemplate }
+Type
+  TFPWebTemplate = Class(TFPTemplate)
+  Private
+    FOwner: TCustomFPWebModule;
+    FRequest : TRequest;
+  Public
+    Constructor Create(AOwner :TCustomFPWebModule);
+    Procedure GetParam(Sender : TObject; Const ParamName : String; Out AValue : String);override;
+    Property Owner : TCustomFPWebModule Read FOwner;
+    Property Request : TRequest Read FRequest Write FRequest;
+  end;
+
+constructor TFPWebTemplate.Create(AOwner: TCustomFPWebModule);
+begin
+  Inherited create;
+  FOwner:=AOwner;
+end;
+
+procedure TFPWebTemplate.GetParam(Sender: TObject; const ParamName: String;
+  out AValue: String);
+begin
+  FOwner.GetParam(ParamName, AValue);
+end;
+
+{ TFPWebModule }
+
+function TCustomFPWebModule.GetActionVar: String;
+begin
+  Result:=FActions.ActionVar;
+end;
+
+function TCustomFPWebModule.GetOnGetAction: TGetActionEvent;
+begin
+  Result:=FActions.OnGetAction;
+end;
+
+
+procedure TCustomFPWebModule.SetActions(const AValue: TFPWebActions);
+begin
+  if (FActions<>AValue) then;
+    FActions.Assign(AValue);
+end;
+
+procedure TCustomFPWebModule.SetActionVar(const AValue: String);
+begin
+  FActions.ActionVar:=AValue;
+end;
+
+procedure TCustomFPWebModule.SetOnGetAction(const AValue: TGetActionEvent);
+begin
+  FActions.OnGetAction:=AValue;
+end;
+
+
+procedure TCustomFPWebModule.SetTemplate(const AValue: TFPTemplate);
+begin
+  if FTemplate<>AValue then
+    FTemplate.Assign(AValue);
+end;
+
+procedure TCustomFPWebModule.DoBeforeRequest(ARequest : TRequest);
+begin
+  If Assigned(FBeforeRequest) then
+    FBeforeRequest(Self,ARequest);
+end;
+
+procedure TCustomFPWebModule.DoAfterResponse(AResponse : TResponse);
+begin
+  If Assigned(FAfterResponse) then
+    FAfterResponse(Self,AResponse);
+end;
+
+procedure TCustomFPWebModule.GetParam(const ParamName: String; out Value: String);
+  
+Var
+  T : TTemplateVar;
+  
+begin
+  If (0=CompareText(ParamName,'CONTENT')) then
+    Value:=GetContent
+  else
+    begin
+    T:=FTemplateVars.FindVar(ParamName);
+    If (T<>Nil) then
+      Value:=T.Value
+    else
+      If Assigned(FOnGetParam) then
+        FOngetParam(Self,ParamName,Value);
+    end;
+end;
+
+procedure TCustomFPWebModule.GetTemplateContent(ARequest: TRequest;
+  AResponse: TResponse);
+  
+begin
+  TFPWebTemplate(FTemplate).Request:=ARequest;
+  AResponse.Content:=FTemplate.GetContent;
+end;
+
+function TCustomFPWebModule.GetContent: String;
+
+Var
+  S : TStringStream;
+  B : Boolean;
+  
+begin
+  S:=TStringStream.Create('');
+  Try
+    FActions.GetContent(TFPWebTemplate(FTemplate).Request,S,B);
+    If Not B then
+      Raise EFPWebError.Create(SErrNoContentProduced);
+    Result:=S.DataString;
+  finally
+    S.Free;
+  end;
+end;
+
+constructor TCustomFPWebModule.CreateNew(AOwner: TComponent; CreateMode : Integer);
+begin
+  inherited;
+  FActions:=TFPWebActions.Create(TFPWebAction);
+  FTemplate:=TFPWebTemplate.Create(Self);
+  FTemplateVars:=TTemplateVars.Create(TTemplateVar);
+end;
+
+destructor TCustomFPWebModule.Destroy;
+begin
+  FreeAndNil(FTemplateVars);
+  FreeAndNil(FTemplate);
+  FreeAndNil(FActions);
+  inherited Destroy;
+end;
+
+
+procedure TCustomFPWebModule.HandleRequest(ARequest: TRequest; AResponse: TResponse);
+
+Var
+  B : Boolean;
+
+begin
+{$ifdef cgidebug}
+  SendMethodEnter('WebModule('+Name+').handlerequest');
+{$endif cgidebug}
+  CheckSession(ARequest);
+  DoBeforeRequest(ARequest);
+  B:=False;
+  InitSession(AResponse);
+  If Assigned(FOnRequest) then
+    FOnRequest(Self,ARequest,AResponse,B);
+  If Not B then
+    if FTemplate.HasContent then
+      GetTemplateContent(ARequest,AResponse)
+    else
+      begin
+      Actions.HandleRequest(ARequest,AResponse,B);
+      If Not B then
+        Raise EFPWebError.Create(SErrRequestNotHandled);
+      end;
+  DoAfterResponse(AResponse);
+  UpdateSession(AResponse);
+{$ifdef cgidebug}
+  SendMethodExit('WebModule('+Name+').handlerequest');
+{$endif cgidebug}
+end;
+
+
+
+
+{ TTemplateVar }
+
+procedure TTemplateVar.Assign(Source: TPersistent);
+begin
+  if Source is TTemplateVar then
+    With Source as TTemplateVar do
+      begin
+      Self.Name:=Name;
+      Self.Value:=Value;
+      end
+  else
+    inherited Assign(Source);
+end;
+
+function TTemplateVar.GetDisplayName: String;
+begin
+  Result:=FName;
+end;
+
+{ TTemplateVars }
+
+function TTemplateVars.GetVar(I : Integer): TTemplateVar;
+begin
+  Result:=TTemplateVar(Items[I])
+end;
+
+procedure TTemplateVars.Setvar(I : Integer; const AValue: TTemplateVar);
+begin
+  Items[i]:=AValue;
+end;
+
+function TTemplateVars.IndexOfVar(AName: String): Integer;
+
+begin
+  Result:=Count-1;
+  While (Result>=0) and (CompareText(AName,GetVar(Result).Name)<>0) do
+    Dec(Result);
+end;
+
+function TTemplateVars.VarByName(AName: String): TTemplateVar;
+begin
+  Result:=FindVar(AName);
+  If (Result=Nil) then
+    Raise EFPWebError.CreateFmt(SErrInvalidVar,[AName]);
+end;
+
+function TTemplateVars.FindVar(AName: String): TTemplateVar;
+
+Var
+  I : Integer;
+
+begin
+  I:=IndexOfVar(AName);
+  If (I=-1) then
+    Result:=Nil
+  else
+    Result:=GetVar(I);
+end;
+
+{ TFPWebActions }
+
+procedure TFPWebActions.HandleRequest(ARequest: TRequest; AResponse: TResponse; Var Handled : Boolean);
+
+Var
+  A : TCustomWebAction;
+
+begin
+{$ifdef cgidebug}SendMethodEnter('FPWebActions.handlerequest');{$endif cgidebug}
+  A:=GetRequestAction(ARequest);
+  if Assigned(A) then
+    (A as TFPWebAction).HandleRequest(ARequest,AResponse,Handled);
+{$ifdef cgidebug}SendMethodExit('FPWebActions.handlerequest');{$endif cgidebug}
+end;
+
+procedure TFPWebActions.GetContent(ARequest: TRequest; Content: TStream;
+  var Handled: Boolean);
+
+Var
+  A : TCustomWebAction;
+
+begin
+{$ifdef cgidebug}SendMethodEnter('WebActions.GetContent');{$endif cgidebug}
+  A:=GetRequestAction(ARequest);
+  If A is TFPWebAction then
+   TFPWebAction(A).GetContent(ARequest,Content,Handled)
+  else
+    Raise EFPWebError.CreateFmt(SErrInvalidWebAction,[A.ClassName]);
+{$ifdef cgidebug}SendMethodExit('WebActions.GetContent');{$endif cgidebug}
+end;
+
+end.
+

+ 334 - 0
fcl/web/htmlelements.pp

@@ -0,0 +1,334 @@
+unit htmlelements;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, DOM, HtmlDefs;
+
+type
+
+  TURI = string;
+
+  { THtmlCustomElement }
+
+  THtmlCustomElement = class (TDOMElement)
+  private
+    FElementTag: THTMLElementTag;
+    function GetAttributeName(index:integer): DOMString;
+    function GetAttributeValue(index:integer): DOMString;
+    function GetTagName: DOMString;
+    procedure WriteAttributes (const aStream : TStream);
+    procedure WriteSubNodes (const aStream : TStream);
+  protected
+    procedure StringToStream (const aStream : TStream; s : string);
+    procedure StringToStream (const aStream : TStream; Fmt : string; Args : array of const);
+    function EscapeString (s : string) : string;
+  public
+    constructor create (AOwner: TDOMDocument); virtual;
+
+    function AsString : string;
+    procedure WriteToStream (const aStream : TStream);  virtual;
+
+    function  GetAttribute(const name: THTMLAttributeTag): DOMString;
+    procedure SetAttribute(const name:THTMLAttributeTag; const value: DOMString);
+    procedure RemoveAttribute(const name: THTMLAttributeTag);
+
+    property ElementTag : THTMLElementTag read FElementTag write FElementTag;
+    property TagName : DOMString read GetTagName;
+    property NodeName : DOMstring read GetTagName;
+    property AttrubuteNames [index:integer] : DOMString read GetAttributeName;
+    property AttrubuteValues [index:integer] : DOMString read GetAttributeValue;
+  end;
+  THTMLElementClass = class of THTMLCustomELement;
+
+
+  { THTMLDocument }
+
+  THTMLDocument = class (TDOMDocument)
+  public
+    procedure SaveToStream (const aStream : TStream);
+    procedure SaveToFile (const afilename : string);
+    function Asstring : string;
+  end;
+
+  { THTMLIDElement }
+  
+  THTMLIDElement = class (THTMLCustomElement)
+  public
+    property ID : DOMString index atID read GetAttribute write SetAttribute;
+  end;
+  
+  { THTMLs18nElement }
+
+  THTMLs18nElement = class (THTMLCustomElement)
+  private
+    function GetDir: THTMLDir;
+    procedure SetDir(const AValue: THTMLDir);
+  public
+    property Dir : THTMLDir read GetDir write SetDir;
+    property Lang : DOMString index atLang read GetAttribute write SetAttribute;
+  end;
+  
+  THTMLCoreAttrsElement = class (THTMLIDElement)
+  public
+    property elementclass : DOMString index atclass read GetAttribute write SetAttribute;
+    property style : DOMString index atstyle read GetAttribute write SetAttribute;
+    property title : DOMString index attitle read GetAttribute write SetAttribute;
+  end;
+  
+  THTMLCores18nElement = class (THTMLCoreAttrsElement)
+  private
+    function GetDir: THTMLDir;
+    procedure SetDir(const AValue: THTMLDir);
+  public
+    property Dir : THTMLDir read GetDir write SetDir;
+    property Lang : DOMString index atLang read GetAttribute write SetAttribute;
+  end;
+  
+  THTMLAttrsElement = class (THTMLCores18nElement)
+    property onclick : DOMString index atonclick read GetAttribute write SetAttribute;
+    property ondblclick : DOMString index atondblclick read GetAttribute write SetAttribute;
+    property onmousedown : DOMString index atonmousedown read GetAttribute write SetAttribute;
+    property onmouseup : DOMString index atonmouseup read GetAttribute write SetAttribute;
+    property onmouseover : DOMString index atonmouseover read GetAttribute write SetAttribute;
+    property onmousemove : DOMString index atonmousemove read GetAttribute write SetAttribute;
+    property onmouseout : DOMString index atonmouseout read GetAttribute write SetAttribute;
+    property onkeypress : DOMString index atonkeypress read GetAttribute write SetAttribute;
+    property onkeydown : DOMString index atonkeydown read GetAttribute write SetAttribute;
+    property onkeyup : DOMString index atonkeyup read GetAttribute write SetAttribute;
+  end;
+  
+// Descendants for all the elements, generated
+{$i tagsintf.inc}
+
+  { THTML_text }
+
+  THTML_text = class (THTMLCustomElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    procedure WriteToStream (const aStream : TStream);  override;
+  end;
+
+implementation
+
+
+{ THtmlCustomElement }
+
+function THtmlCustomElement.GetAttributeName(index:integer): DOMString;
+var d : TDOMNode;
+begin
+  d := TDOMNode(Attributes[index]);
+  result := d.NodeName;
+end;
+
+function THtmlCustomElement.GetAttributeValue(index:integer): DOMString;
+var d : TDOMNode;
+begin
+  d := TDOMNode(Attributes[index]);
+  result := d.NodeValue;
+end;
+
+function THtmlCustomElement.GetTagName: DOMString;
+begin
+  result := HTMLElementProps[FElementTag].Name
+end;
+
+procedure THtmlCustomElement.WriteAttributes(const aStream: TStream);
+var a : THTMLAttributeTag;
+    attrs : THTMLAttributeSet;
+    s : DOMstring;
+begin
+  attrs := HTMLElementProps[ElementTag].Attributes;
+  for a := low(THTMLAttributeTag) to high(THTMLAttributeTag) do
+    if a in attrs then
+      begin
+      s := GetAttribute (a);
+      if s <> '' then
+        if a in booleanAttributes then
+          StringToStream (aStream, ' %s', [HTMLAttributeTag[a]])
+        else
+          StringToStream (aStream, ' %s="%s"', [HTMLAttributeTag[a], s]);
+      end;
+end;
+
+procedure THtmlCustomElement.WriteSubNodes(const aStream: TStream);
+var d : TDomNode;
+begin
+  d := GetFirstChild;
+  while assigned (d) do
+    begin
+    if d is THtmlCustomElement then
+      THtmlCustomElement(d).writetostream (aStream);
+    d := d.NextSibling;
+    end;
+end;
+
+procedure THtmlCustomElement.StringToStream(const aStream: TStream; s: string);
+begin
+  if s <> '' then
+    astream.WriteBuffer (s[1], length(s));
+end;
+
+procedure THtmlCustomElement.StringToStream(const aStream: TStream; Fmt: string;
+  Args: array of const);
+begin
+  StringToStream (aStream, format (Fmt, args));
+end;
+
+function THtmlCustomElement.EscapeString(s: string): string;
+begin
+  result := s;
+  //TODO: Needs to convert all the special signs to their html names ("<" has to be "&lt;" etc.)
+end;
+
+constructor THtmlCustomElement.create(AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  FElementTag := etUnknown;
+end;
+
+function THtmlCustomElement.AsString: string;
+var s : TStringStream;
+begin
+  s := TStringStream.Create ('');
+  try
+    WriteToStream (s);
+    result := s.datastring;
+  finally
+    s.free;
+  end;
+end;
+
+procedure THtmlCustomElement.WriteToStream(const aStream: TStream);
+var f : THTMLElementFlags;
+begin
+  StringToStream (aStream, '<%s', [TagName]);
+  WriteAttributes (aStream);
+  StringToStream (aStream, '>'#13#10);
+  f := HTMLElementProps[FELementTag].flags;
+  if (efSubelementContent in f) or (efPCDATAContent in f) then
+    begin
+    WriteSubNodes (aStream);
+    StringToStream (aStream, '</%s>'#13#10, [TagName]);
+    end;
+end;
+
+function THtmlCustomElement.GetAttribute(const name: THTMLAttributeTag): DOMString;
+begin
+  result := inherited GetAttribute (HTMLAttributeTag[name]);
+end;
+
+procedure THtmlCustomElement.SetAttribute(const name: THTMLAttributeTag;
+  const value: DOMString);
+begin
+  inherited SetAttribute (HTMLAttributeTag[name], value);
+end;
+
+procedure THtmlCustomElement.RemoveAttribute(const name: THTMLAttributeTag);
+begin
+  inherited RemoveAttribute (HTMLAttributeTag[name]);
+end;
+
+{ THTMLs18nElement }
+
+function THTMLs18nElement.GetDir: THTMLDir;
+var r : THTMLDir;
+    s : DOMString;
+begin
+  s := GetAttribute (atDir);
+  r := high(THTMLdir);
+  while (r > low(THTMLDir)) and (comparetext(s,HTMLDir[r]) <> 0) do
+    begin
+    dec (r);
+    end;
+  result := r;
+end;
+
+procedure THTMLs18nElement.SetDir(const AValue: THTMLDir);
+begin
+  if AValue = dirEmpty then
+    RemoveAttribute(atDir)
+  else
+    SetAttribute (atDir, HTMLDir[AValue]);
+end;
+
+{ THTMLCores18nElement }
+
+function THTMLCores18nElement.GetDir: THTMLDir;
+var r : THTMLDir;
+    s : DOMString;
+begin
+  s := GetAttribute (atDir);
+  r := high(THTMLdir);
+  while (r > low(THTMLDir)) and (comparetext(s,HTMLDir[r]) <> 0) do
+    begin
+    dec (r);
+    end;
+  result := r;
+end;
+
+procedure THTMLCores18nElement.SetDir(const AValue: THTMLDir);
+begin
+  if AValue = dirEmpty then
+    RemoveAttribute(atDir)
+  else
+    SetAttribute (atDir, HTMLDir[AValue]);
+end;
+
+// generated implementations
+{$i tagsimpl.inc}
+
+{ THTML_text }
+
+constructor THTML_text.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag := ettext;
+end;
+
+procedure THTML_text.WriteToStream(const aStream: TStream);
+begin
+  StringToStream (aStream, NodeValue+#13#10);
+end;
+
+{ THTMLDocument }
+
+procedure THTMLDocument.SaveToStream(const aStream: TStream);
+var d : TDOMNode;
+begin
+  d := FirstChild;
+  while assigned(d) do
+    begin
+    if d is THTMLCustomElement then
+      THTMLCustomELement(d).WriteToStream(aStream);
+    d := d.NextSibling;
+    end;
+end;
+
+procedure THTMLDocument.SaveToFile(const afilename: string);
+var f : TFileStream;
+begin
+  f := TFileStream.Create (afilename, fmCreate);
+  try
+    SaveToStream (f);
+  finally
+    f.Free;
+  end;
+end;
+
+function THTMLDocument.Asstring: string;
+var s : TStringStream;
+begin
+  s := TStringStream.Create ('');
+  try
+    SaveToStream (s);
+    result := s.DataString;
+  finally
+    s.Free;
+  end;
+end;
+
+end.
+

+ 346 - 0
fcl/web/htmlwriter.pp

@@ -0,0 +1,346 @@
+unit htmlwriter; 
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, DOM, htmlelements;
+
+type
+
+  HTMLWriterException = class (exception);
+
+  { THTMLwriter }
+
+  THTMLwriter = class
+  private
+    FCurrentElement : THTMLCustomElement;
+    FDocument: THTMLDocument;
+    procedure SetDocument(const AValue: THTMLDocument);
+    procedure SetCurrentElement (AValue : THTMLCustomElement);
+  protected
+    function CreateElement (tag : THTMLElementClass; s : string) : THTMLCustomElement;
+    function CreateElement (tag : THTMLElementClass; sub : THTMLCustomElement) : THTMLCustomElement;
+    function CreateElement (tag : THTMLElementClass; subs : Array of THTMLCustomElement) : THTMLCustomElement;
+    function CreateElement (tag : THTMLElementClass; subs : TDOMNodelist) : THTMLCustomElement;
+    function StartElement (tag : THTMLElementClass) : THTMLCustomElement;
+    function EndElement (tag : THTMLElementClass) : THTMLCustomElement;
+    function AddElement (tag : THTMLElementClass) : THTMLCustomElement;
+  public
+    constructor create (aDocument : THTMLDocument);
+    procedure AddElement (el : THTMLCustomElement);
+    procedure AddElements (subs : TDOMNodelist);
+    procedure AddElements (subs : array of THTMLCustomElement);
+    function Text (s : string) : THTML_Text;
+    function Text (Fmt : string; args : array of const) : THTML_Text;
+    { Form input elements }
+    function FormText (aname, avalue: DOMstring) : THTML_Input;
+    function FormText (aname, avalue: DOMstring; alength : integer) : THTML_Input;
+    function FormMemo (aname, avalue: DOMstring; arows,acols: integer) : THTML_Textarea;
+    function FormSelect (aname: DOMstring; preselect, size: integer; Options: TStrings; UseValues:boolean) : THTML_Select;
+    function FormSelect (aname, preselect: DOMstring; size: integer; Options: TStrings; UseValues:boolean) : THTML_Select;
+    function FormPasswd (aname: DOMstring) : THTML_Input;
+    function FormCheckbox (aname, avalue: DOMstring; achecked: boolean) : THTML_Input;
+    function FormRadio (aname, avalue: DOMstring; achecked: boolean) : THTML_Input;
+    function FormSubmit (aname, avalue: DOMstring) : THTML_Input;
+    function FormImage (aname, imagesrc, ausemap: DOMstring) : THTML_Input;
+    function FormReset : THTML_Input;
+    function FormButton (aname, caption, aOnClick: DOMstring) : THTML_Input;
+    function FormHidden (aname, aValue: DOMstring) : THTML_Input;
+    function FormFile (aname, aValue:DOMstring) : THTML_Input;
+    {$i wtagsintf.inc}
+    property Document : THTMLDocument read FDocument write SetDocument;
+    property CurrentElement : THTMLCustomElement read FCurrentElement write SetCurrentElement;
+  end;
+
+implementation
+
+uses HTMLDefs;
+
+resourcestring
+  sErrNoCorespondingParent = 'No open element found with tag "%s"';
+
+{ THTMLwriter }
+
+procedure THTMLwriter.SetDocument(const AValue: THTMLDocument);
+begin
+  if FDocument <> AValue then
+    begin
+    FDocument := AValue;
+    FCurrentElement := nil;
+    end;
+end;
+
+function THTMLwriter.CreateElement(tag: THTMLElementClass; s: string): THTMLCustomElement;
+begin
+  result := StartElement (tag);
+  Text (s);
+  EndElement (tag);
+end;
+
+function THTMLwriter.CreateElement(tag: THTMLElementClass; sub: THTMLCustomElement): THTMLCustomElement;
+begin
+  result := StartElement (tag);
+  AddElement (sub);
+  EndElement (tag);
+end;
+
+function THTMLwriter.CreateElement(tag: THTMLElementClass; subs: array of THTMLCustomElement): THTMLCustomElement;
+begin
+  result := StartElement (tag);
+  AddElements (subs);
+  EndElement (tag);
+end;
+
+function THTMLwriter.CreateElement(tag: THTMLElementClass; subs: TDOMNodelist): THTMLCustomElement;
+begin
+  result := StartElement (tag);
+  AddElements (subs);
+  EndElement (tag);
+end;
+
+function THTMLwriter.StartElement(tag: THTMLElementClass): THTMLCustomElement;
+begin
+  result := AddElement (tag);
+  FCurrentElement := result;
+end;
+
+function THTMLwriter.EndElement(tag: THTMLElementClass): THTMLCustomElement;
+var d : TDOMNode;
+begin
+  d := FCurrentElement;
+  while assigned(d) and not (d is tag) do
+    d := d.ParentNode;
+  if assigned (d) then
+    begin
+    result := THTMLCustomElement(d);
+    FCurrentElement := THTMLCustomElement(result.ParentNode);
+    end
+  else
+    raise HTMLWriterException.CreateFmt (sErrNoCorespondingParent, [tag.ClassName]);
+end;
+
+constructor THTMLwriter.create(aDocument: THTMLDocument);
+begin
+  inherited create;
+  FDocument := aDocument;
+end;
+
+procedure THTMLwriter.SetCurrentElement(AValue: THTMLCustomElement);
+begin
+  if not assigned (AValue) then
+    FCurrentElement := nil
+  else
+    if AValue.OwnerDocument = FDocument then
+      FCurrentElement := AValue;
+end;
+
+function THTMLwriter.AddElement(tag: THTMLElementClass): THTMLCustomElement;
+begin
+  result := tag.Create (Document);
+  AddElement (result);
+end;
+
+procedure THTMLwriter.AddElement(el: THTMLCustomElement);
+begin
+  if assigned (FCurrentElement) then
+    FCurrentElement.AppendChild (el)
+  else
+    FDocument.AppendChild (el);
+end;
+
+procedure THTMLwriter.AddElements(subs: TDOMNodelist);
+var r : integer;
+    d : TDOMNode;
+begin
+  for r := 0 to subs.count-1 do
+    begin
+    d := subs.item[r];
+    if d is THTMLCustomElement then
+      AddElement (THTMLCustomElement(d));
+    end;
+end;
+
+procedure THTMLwriter.AddElements(subs: array of THTMLCustomElement);
+var r : integer;
+begin
+  for r := 0 to high(subs) do
+    AddElement (subs[r]);
+end;
+
+function THTMLwriter.Text (s : string): THTML_Text;
+begin
+  result := THTML_text(AddElement(THTML_Text));
+  result.NodeValue := s;
+end;
+
+function THTMLwriter.Text(Fmt: string; args: array of const): THTML_Text;
+begin
+  result := text(format(fmt, args));
+end;
+
+{ Form input elements }
+
+function THTMLwriter.FormText(aname, avalue: DOMstring): THTML_Input;
+begin
+  result := input;
+  with result do
+    begin
+    thetype := itText;
+    name := aname;
+    value := avalue;
+    end;
+end;
+
+function THTMLwriter.FormText(aname, avalue: DOMstring; alength: integer): THTML_Input;
+begin
+  result := FormText (aname, avalue);
+  result.size := inttostr(alength);
+end;
+
+function THTMLwriter.FormMemo(aname, avalue: DOMstring; arows, acols: integer): THTML_Textarea;
+begin
+  result := textarea(avalue);
+  with result do
+    begin
+    name := aname;
+    rows := inttostr(arows);
+    cols := inttostr(acols);
+    end;
+end;
+
+function THTMLwriter.FormSelect(aname: DOMstring; preselect, size: integer;
+  Options: TStrings; UseValues:boolean): THTML_Select;
+var r : integer;
+    n,v : string;
+begin
+  result := StartSelect;
+  result.size := inttostr(size);
+  result.name := aname;
+  if UseValues then
+    for r := 0 to options.count-1 do
+      begin
+      Options.GetNameValue (r, v, n);
+      with Option (n) do
+        begin
+        selected := (preselect = r);
+        Value := v;
+        end;
+      end
+  else
+    for r := 0 to options.count-1 do
+      Option (Options[r]).selected := (preselect = r);
+  EndSelect;
+end;
+
+function THTMLwriter.FormSelect(aname, preselect: DOMstring; size: integer;
+  Options: TStrings; UseValues:boolean): THTML_Select;
+begin
+  if UseValues then
+    result := FormSelect (aname, Options.IndexOfName(preselect), size, Options, UseValues)
+  else
+    result := FormSelect (aname, Options.IndexOf(preselect), size, Options, UseValues);
+end;
+
+function THTMLwriter.FormPasswd(aname: DOMstring): THTML_Input;
+begin
+  result := input;
+  with result do
+    begin
+    thetype := itPassword;
+    name := aname;
+    end;
+end;
+
+function THTMLwriter.FormCheckbox(aname, avalue: DOMstring; achecked: boolean): THTML_Input;
+begin
+  result := input;
+  with result do
+    begin
+    thetype := itCheckbox;
+    name := aname;
+    value := avalue;
+    checked := achecked;
+    end;
+end;
+
+function THTMLwriter.FormRadio(aname, avalue: DOMstring; achecked: boolean): THTML_Input;
+begin
+  result := input;
+  with result do
+    begin
+    thetype := itCheckbox;
+    name := aname;
+    value := avalue;
+    checked := achecked;
+    end;
+end;
+
+function THTMLwriter.FormSubmit(aname, avalue: DOMstring): THTML_Input;
+begin
+  result := input;
+  with result do
+    begin
+    thetype := itSubmit;
+    name := aname;
+    value := avalue;
+    end;
+end;
+
+function THTMLwriter.FormImage(aname, imagesrc, ausemap: DOMstring): THTML_Input;
+begin
+  result := input;
+  with result do
+    begin
+    thetype := itimage;
+    name := aname;
+    src := imagesrc;
+    usemap := ausemap;
+    end;
+end;
+
+function THTMLwriter.FormReset: THTML_Input;
+begin
+  result := input;
+  result.thetype := itReset;
+end;
+
+function THTMLwriter.FormButton(aname, caption, aOnClick: DOMstring): THTML_Input;
+begin
+  result := input;
+  with result do
+    begin
+    thetype := itButton;
+    name := aname;
+    value := caption;
+    onclick := aonclick;
+    end;
+end;
+
+function THTMLwriter.FormHidden(aname, aValue: DOMstring): THTML_Input;
+begin
+  result := Input;
+  with result do
+    begin
+    thetype := itHidden;
+    name := aname;
+    value := avalue;
+    end;
+end;
+
+function THTMLwriter.FormFile(aname, aValue: DOMstring): THTML_Input;
+begin
+  result := Input;
+  with result do
+    begin
+    thetype := itFile;
+    name := aname;
+    value := aValue;
+    end;
+end;
+
+{$i wtagsimpl.inc}
+
+end.
+

+ 1478 - 0
fcl/web/httpdefs.pp

@@ -0,0 +1,1478 @@
+{
+
+    HTTPDefs: Basic HTTP protocol declarations and classes
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    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.
+}
+{$mode objfpc}
+{$H+}
+{$DEFINE CGIDEBUG}
+unit HTTPDefs;
+
+interface
+
+uses Classes,Sysutils;
+
+const
+  fieldAccept          = 'Accept';
+  fieldAcceptCharset   = 'Accept-Charset';
+  fieldAcceptEncoding  = 'Accept-Encoding';
+  fieldAcceptLanguage  = 'Accept-Language';
+  fieldAuthorization   = 'Authorization';
+  fieldConnection      = 'Connection';
+  fieldContentEncoding = 'Content-Encoding';
+  fieldContentLanguage = 'Content-Language';
+  fieldContentLength   = 'Content-Length';
+  fieldContentType     = 'Content-Type';
+  fieldCookie          = 'Cookie';
+  fieldDate            = 'Date';
+  fieldExpires         = 'Expires';
+  fieldFrom            = 'From';
+  fieldIfModifiedSince = 'If-Modified-Since';
+  fieldLastModified    = 'Last-Modified';
+  fieldLocation        = 'Location';
+  fieldPragma          = 'Pragma';
+  fieldReferer         = 'Referer';
+  fieldRetryAfter      = 'Retry-After';
+  fieldServer          = 'Server';
+  fieldSetCookie       = 'Set-Cookie';
+  fieldUserAgent       = 'User-Agent';
+  fieldWWWAuthenticate = 'WWW-Authenticate';
+
+  NoHTTPFields = 24;
+
+  HTTPDateFmt   = '"%s", dd "%s" yyyy hh:mm:ss'; // For use in FormatDateTime
+  SCookieExpire = ' "expires="'+HTTPDateFmt+' "GMT;"';
+  SCookieDomain = ' domain=%s;';
+  SCookiePath   = ' path=%s;';
+  SCookieSecure = ' secure';
+
+  HTTPMonths: array[1..12] of string[3] = (
+    'Jan', 'Feb', 'Mar', 'Apr',
+    'May', 'Jun', 'Jul', 'Aug',
+    'Sep', 'Oct', 'Nov', 'Dec');
+  HTTPDays: array[1..7] of string[3] = (
+    'Sun', 'Mon', 'Tue', 'Wed',
+    'Thu', 'Fri', 'Sat');
+
+
+Type
+  TTHttpFields = Array[1..NoHTTPFields] of string; 
+
+Const
+  HTTPFieldNames : TTHttpFields
+             = (fieldAccept, fieldAcceptCharset, fieldAcceptEncoding, 
+                fieldAcceptLanguage, fieldAuthorization, fieldConnection,
+                fieldContentEncoding, fieldContentLanguage, fieldContentLength,
+                fieldContentType, fieldCookie, fieldDate, fieldExpires, 
+                fieldFrom, fieldIfModifiedSince, fieldLastModified, fieldLocation,
+                fieldPragma, fieldReferer, fieldRetryAfter, fieldServer, 
+                fieldSetCookie, fieldUserAgent, fieldWWWAuthenticate);
+                
+
+type
+
+  { TCookie }
+
+  TCookie = class(TCollectionItem)
+  private
+    FName: string;
+    FValue: string;
+    FPath: string;
+    FDomain: string;
+    FExpires: TDateTime;
+    FSecure: Boolean;
+  protected
+    Function GetAsString: string;
+  public
+    constructor Create(ACollection: TCollection); override;
+    procedure Assign(Source: TPersistent); override;
+    property Name: string read FName write FName;
+    property Value: string read FValue write FValue;
+    property Domain: string read FDomain write FDomain;
+    property Path: string read FPath write FPath;
+    property Expires: TDateTime read FExpires write FExpires;
+    property Secure: Boolean read FSecure write FSecure;
+    Property AsString : String Read GetAsString;
+  end;
+
+{ TCookies }
+
+  TCookies = class(TCollection)
+  private
+  protected
+    function GetCookie(Index: Integer): TCookie;
+    procedure SetCookie(Index: Integer; Value: TCookie);
+  public
+    function  Add: TCookie;
+    Function CookieByName(AName : String) : TCookie;
+    Function FindCookie(AName : String): TCookie;
+    Function IndexOfCookie(AName : String) : Integer;
+    property Items[Index: Integer]: TCookie read GetCookie write SetCookie; default;
+  end;
+  { TUploadedFile }
+
+  TUploadedFile = Class(TCollectionItem)
+  Private
+    FContentType: String;
+    FDisposition: String;
+    FFieldName: String;
+    FFileName: String;
+    FLocalFileName: String;
+    FSize: Int64;
+    FStream : TStream;
+  Protected
+    function GetStream: TStream; virtual;
+  Public
+    Destructor Destroy; override;
+    Property FieldName : String Read FFieldName Write FFieldName;
+    Property FileName : String Read FFileName Write FFileName;
+    Property Stream : TStream Read GetStream;
+    Property Size : Int64 Read FSize Write FSize;
+    Property ContentType : String Read FContentType Write FContentType;
+    Property Disposition : String Read FDisposition Write FDisposition;
+    Property LocalFileName : String Read FLocalFileName Write FLocalFileName;
+  end;
+  
+  { TUploadedFiles }
+
+  TUploadedFiles = Class(TCollection)
+  private
+    function GetFile(Index : Integer): TUploadedFile;
+    procedure SetFile(Index : Integer; const AValue: TUploadedFile);
+  public
+    Function IndexOfFile(AName : String) : Integer;
+    Function FileByName(AName : String) : TUploadedFile;
+    Function FindFile(AName : String) : TUploadedFile;
+    Property Files[Index : Integer] : TUploadedFile read GetFile Write SetFile; default;
+  end;
+
+  { THTTPHeader }
+
+  THTTPHeader = class(TObject)
+  private
+    FContentFields: TStrings;
+    FCookieFields: TStrings;
+    FHTTPVersion : String;
+    FFields : TTHttpFields;
+    FQueryFields: TStrings;
+    function GetSetField(AIndex: Integer): String;
+    function GetSetFieldName(AIndex: Integer): String;
+    procedure SetCookieFields(const AValue: TStrings);
+    Function GetFieldCount : Integer;
+    Function GetFieldName(Index : Integer) : String;
+    Function GetContentLength : Integer;
+    Procedure SetContentLength(Value : Integer);
+    Function GetFieldIndex(AIndex : Integer) : Integer;
+    Function GetServerPort : Word;
+    Function GetSetFieldValue(Index : Integer) : String; virtual;
+  Protected
+    Function GetFieldValue(Index : Integer) : String; virtual;
+    Procedure SetFieldValue(Index : Integer; Value : String); virtual;
+    procedure ParseFirstHeaderLine(const line: String);virtual;
+    Procedure ParseCookies; virtual;
+  public
+    constructor Create; virtual;
+    destructor Destroy; override;
+    procedure SetFieldByName(const AName, AValue: String);
+    function  GetFieldByName(const AName: String): String;
+    Function LoadFromStream(Stream : TStream; IncludeCommand : Boolean) : integer;
+    Function LoadFromStrings(Strings: TStrings; IncludeCommand : Boolean) : integer; virtual;
+    // Common access
+    property FieldCount: Integer read GetFieldCount;
+    property Fields[AIndex: Integer]: String read GetSetField;
+    property FieldNames[AIndex: Integer]: String read GetSetFieldName;
+    property FieldValues[AIndex: Integer]: String read GetSetFieldValue;
+    // Various properties.
+    Property HttpVersion : String Index 0 Read GetFieldValue Write SetFieldValue;
+    Property ProtocolVersion : String Index 0 Read GetFieldValue Write SetFieldValue;
+    property Accept: String Index 1 read GetFieldValue write SetFieldValue;
+    property AcceptCharset: String Index 2 Read GetFieldValue Write SetFieldValue;
+    property AcceptEncoding: String Index 3 Read GetFieldValue Write SetFieldValue;
+    property AcceptLanguage: String Index 4 Read GetFieldValue Write SetFieldValue;
+    property Authorization: String Index 5 Read GetFieldValue Write SetFieldValue;
+    property Connection: String Index 6 Read GetFieldValue Write SetFieldValue;
+    property ContentEncoding: String Index 7 Read GetFieldValue Write SetFieldValue;
+    property ContentLanguage: String Index 8 Read GetFieldValue Write SetFieldValue;
+    property ContentLength: Integer Read GetContentLength Write SetContentLength;
+    property ContentType: String Index 10 Read GetFieldValue Write SetFieldValue;
+    property Cookie: String Index 11 Read GetFieldValue Write SetFieldValue;
+    property Date: String Index 12 Read GetFieldValue Write SetFieldValue;
+    property Expires: String Index 13 Read GetFieldValue Write SetFieldValue;
+    property From: String Index 14 Read GetFieldValue Write SetFieldValue;
+    property IfModifiedSince: String Index 15 Read GetFieldValue Write SetFieldValue;
+    property LastModified: String Index 16 Read GetFieldValue Write SetFieldValue;
+    property Location: String Index 17 Read GetFieldValue Write SetFieldValue;
+    property Pragma: String Index 18 Read GetFieldValue Write SetFieldValue;
+    property Referer: String Index 19 Read GetFieldValue Write SetFieldValue;
+    property RetryAfter: String Index 20 Read GetFieldValue Write SetFieldValue;
+    property Server: String Index 21 Read GetFieldValue Write SetFieldValue;
+    property SetCookie: String Index 22 Read GetFieldValue Write SetFieldValue;
+    property UserAgent: String Index 23 Read GetFieldValue Write SetFieldValue;
+    property WWWAuthenticate: String Index 24 Read GetFieldValue Write SetFieldValue;
+    // Various aliases, for compatibility
+    Property PathInfo : String index 25 read GetFieldValue Write SetFieldValue;
+    Property PathTranslated : String Index 26 read GetFieldValue Write SetFieldValue;
+    Property RemoteAddress : String Index 27 read GetFieldValue Write SetFieldValue;
+    Property RemoteHost : String Index 28 read  GetFieldValue Write SetFieldValue;
+    Property ScriptName : String Index 29 read  GetFieldValue Write SetFieldValue;
+    Property ServerPort : Word Read GetServerPort; // Index 30
+    Property HTTPAccept : String Index 1 read GetFieldValue Write SetFieldValue;
+    Property HTTPAcceptCharset : String Index 2 read GetFieldValue Write SetFieldValue;
+    Property HTTPAcceptEncoding : String Index 3 read GetFieldValue Write SetFieldValue;
+    Property HTTPIfModifiedSince : String Index 15 read GetFieldValue Write SetFieldValue; // Maybe change to TDateTime ??
+    Property HTTPReferer : String Index 19 read GetFieldValue Write SetFieldValue;
+    Property HTTPUserAgent : String Index 23 read GetFieldValue Write SetFieldValue;
+    // Lists
+    Property CookieFields : TStrings Read FCookieFields Write SetCookieFields;
+    Property ContentFields: TStrings read FContentFields;
+    property QueryFields : TStrings read FQueryFields;
+  end;
+
+
+  { TRequest }
+
+  TRequest = class(THttpHeader)
+  private
+    FCommand: String;
+    FCommandLine: String;
+    FQuery: String;
+    FURI: String;
+    FFiles : TUploadedFiles;
+    FReturnedPathInfo : String;
+    procedure ParseFirstHeaderLine(const line: String);override;
+    function  GetFirstHeaderLine: String;
+  Protected
+    Procedure ProcessMultiPart(Stream : TStream; Const Boundary : String); virtual;
+    Procedure ProcessQueryString(Const FQueryString : String); virtual;
+    procedure ProcessURLEncoded(Stream : TStream); virtual;
+    Function  GetTempUploadFileName : String; virtual;
+  public
+    constructor Create; override;
+    destructor destroy; override;
+    Function  GetNextPathInfo : String;
+    Property  CommandLine : String Read FCommandLine;
+    Property  Command : String read FCommand;
+    Property  URI : String read FURI;                // Uniform Resource Identifier
+    Property  Query : String Read FQuery;
+    Property  QueryString : String Read FQuery; // Alias
+    Property  HeaderLine : String read GetFirstHeaderLine;
+    Property  Files : TUploadedFiles Read FFiles;
+  end;
+
+
+  { TResponse }
+
+  TResponse = class(THttpHeader)
+  private
+    FContents: TStrings;
+    FContentStream : TStream;
+    FCode: Integer;
+    FCodeText: String;
+    FHeadersSent: Boolean;
+    FContentSent: Boolean;
+    FRequest : TRequest;
+    FCookies : TCookies;
+    function GetContent: String;
+    procedure SetContent(const AValue: String);
+    procedure SetContents(AValue: TStrings);
+    procedure SetContentStream(const AValue: TStream);
+    procedure SetFirstHeaderLine(const line: String);
+    function  GetFirstHeaderLine: String;
+    procedure ContentsChanged(Sender : TObject);
+  Protected
+    Procedure DoSendHeaders(Headers : TStrings); virtual; abstract;
+    Procedure DoSendContent; virtual; abstract;
+    Procedure CollectHeaders(Headers : TStrings); virtual;
+  public
+    constructor Create(ARequest : TRequest);
+    destructor destroy; override;
+    Procedure SendContent;
+    Procedure SendHeaders;
+    Procedure SendResponse; // Delphi compatibility
+    Property Request : TRequest Read FRequest;
+    Property Code: Integer Read FCode Write FCode;
+    Property CodeText: String Read FCodeText Write FCodeText;
+    Property FirstHeaderLine : String Read GetFirstHeaderLine Write SetFirstHeaderLine;
+    Property ContentStream : TStream Read FContentStream Write SetContentStream;
+    Property Content : String Read GetContent Write SetContent;
+    property Contents : TStrings read FContents Write SetContents;
+    Property HeadersSent : Boolean Read FHeadersSent;
+    Property ContentSent : Boolean Read FContentSent;
+    property Cookies: TCookies read FCookies;
+  end;
+  
+  { TSessionVariable }
+
+
+  { TCustomSession }
+
+  TCustomSession = Class(TComponent)
+  Private
+    FTimeOut: Integer;
+  Protected
+    Function GetSessionID : String; virtual;
+    Function GetSessionVariable(VarName : String) : String; Virtual; abstract;
+    procedure SetSessionVariable(VarName : String; const AValue: String);Virtual;abstract;
+  Public
+    Constructor Create(AOwner : TComponent); override;
+    // Init session from request.
+    Procedure InitSession(ARequest : TRequest; OnNewSession,OnExpired : TNotifyEvent); virtual;
+    // Init response from session (typically, add cookie to response).
+    Procedure InitResponse(AResponse : TResponse); virtual;
+    // Update response from session (typically, change cookie to response and write session data).
+    Procedure UpdateResponse(AResponse : TResponse); virtual; Abstract;
+    Procedure RemoveVariable(VariableName : String); virtual; abstract;
+    Procedure Terminate; virtual; abstract;
+    Property TimeOutMinutes : Integer Read FTimeOut Write FTimeOut;
+    Property SessionID : String Read GetSessionID;
+    Property Variables[VarName : String] : String Read GetSessionVariable Write SetSessionVariable;
+  end;
+
+  TRequestEvent = Procedure (Sender: TObject; ARequest : TRequest) of object;
+  TResponseEvent = Procedure (Sender: TObject; AResponse : TResponse) of object;
+  
+  HTTPError = Class(Exception);
+
+Function HTTPDecode(const AStr: String): String;
+Function HTTPEncode(const AStr: String): String;
+
+implementation
+
+{$ifdef CGIDEBUG}
+uses dbugintf;
+{$endif}
+
+Resourcestring
+  SErrContentAlreadySent        = 'HTTP Response content was already sent';
+  SErrHeadersAlreadySent        = 'HTTP headers were already sent';
+  SErrInternalUploadedFileError = 'Internal uploaded file configuration error';
+  SErrNoSuchUploadedFile        = 'No such uploaded file : "%s"';
+  SErrUnknownCookie             = 'Unknown cookie: "%s"';
+  
+const
+   hexTable = '0123456789ABCDEF';
+
+{ ---------------------------------------------------------------------
+  Auxiliary functions
+  ---------------------------------------------------------------------}
+  
+Function GetFieldNameIndex(AName : String) : Integer;
+
+var
+  Name: String;
+begin
+  Name := UpperCase(AName);
+  Result:=NoHTTPFields;
+  While (Result>0) and (UpperCase(HTTPFieldNames[Result])<>Name) do
+    Dec(Result);
+end;
+
+function HTTPDecode(const AStr: String): String;
+
+var
+  S,SS, R : PChar;
+  H : String[3];
+  L,C : Integer;
+
+begin
+  L:=Length(Astr);
+  SetLength(Result,L);
+  If (L=0) then
+    exit;
+  S:=PChar(AStr);
+  SS:=S;
+  R:=PChar(Result);
+  while (S-SS)<L do
+    begin
+    case S^ of
+      '+': R^ := ' ';
+      '%': begin
+           Inc(S);
+           if ((S-SS)<L) then
+             begin
+             if (S^='%') then
+               R^:='%'
+             else
+               begin
+               H:='$00';
+               H[2]:=S^;
+               Inc(S);
+               If (S-SS)<L then
+                 begin
+                 H[3]:=S^;
+                 Val(H,PByte(R)^,C);
+                 If (C<>0) then
+                   R^:=' ';
+                 end;
+               end;
+             end;
+           end;
+      else
+        R^ := S^;
+      end;
+    Inc(R);
+    Inc(S);
+    end;
+  SetLength(Result,R-PChar(Result));
+end;
+
+function HTTPEncode(const AStr: String): String;
+
+const
+  HTTPAllowed = ['A'..'Z','a'..'z',
+                 '*','@','.','_','-',
+                 '0'..'9',
+                 '$','!','''','(',')'];
+                 
+var
+  SS,S,R: PChar;
+  H : String[2];
+  L : Integer;
+  
+begin
+  L:=Length(AStr);
+  SetLength(Result,L*3); // Worst case scenario
+  if (L=0) then
+    exit;
+  R:=PChar(Result);
+  S:=PChar(AStr);
+  SS:=S; // Avoid #0 limit !!
+  while ((S-SS)<L) do
+    begin
+    if S^ in HTTPAllowed then
+      R^:=S^
+    else if (S^=' ') then
+      R^:='+'
+    else
+      begin
+      R^:='%';
+      H:=HexStr(Ord(S^),2);
+      Inc(R);
+      R^:=H[1];
+      Inc(R);
+      R^:=H[2];
+      end;
+    Inc(R);
+    Inc(S);
+    end;
+  SetLength(Result,R-PChar(Result));
+end;
+
+
+{ ---------------------------------------------------------------------
+  THTTPHeader
+  ---------------------------------------------------------------------}
+
+function THttpHeader.GetFieldCount: Integer;
+
+Var
+  I : Integer;
+
+begin
+  Result:=0;
+  For I:=1 to NoHTTPFields do
+    If (FFields[i]<>'') then
+      Inc(Result);
+end;
+
+function THTTPHeader.GetContentLength: Integer;
+begin
+  Result:=StrToIntDef(FFields[9],0);
+end;
+
+procedure THTTPHeader.SetContentLength(Value: Integer);
+begin
+  FFields[9]:=IntToStr(Value);
+end;
+
+
+Function THttpHeader.GetFieldIndex(AIndex : Integer) : Integer;
+
+var
+  I : Integer;
+   
+begin
+  I:=1;
+  While (I<=NoHTTPFields) and (AIndex>=0) do
+    begin
+    If (FFields[i]<>'') then
+      Dec(AIndex);
+    Inc(I);
+    end;
+  If (AIndex=-1) then
+    Result:=I-1
+  else
+    Result:=-1;  
+end;
+
+function THTTPHeader.GetServerPort: Word;
+begin
+  Result:=StrToIntDef(GetFieldValue(30),0);
+end;
+
+function THTTPHeader.GetSetFieldValue(Index: Integer): String;
+
+Var
+  I : Integer;
+
+begin
+  I:=GetFieldIndex(Index);
+  If (I<>-1) then
+    Result:=FFields[I];
+end;
+
+function THTTPHeader.GetSetField(AIndex: Integer): String;
+var
+  I : Integer;
+
+begin
+  I:=GetFieldIndex(AIndex);
+  If (I<>-1) then
+    Result := HTTPFieldNames[I] + ': ' + FFields[I];
+end;
+
+function THTTPHeader.GetSetFieldName(AIndex: Integer): String;
+var
+  I : Integer;
+
+begin
+  I:=GetFieldIndex(AIndex);
+  if (I<>-1) then
+    Result:=HTTPFieldNames[I];
+end;
+
+
+function THttpHeader.GetFieldName(Index: Integer): String;
+
+Var
+  I : Integer;
+
+begin
+  I:=GetFieldIndex(Index);
+  If (I<>-1) then
+    Result := HTTPFieldNames[i];
+end;
+
+Function THttpHeader.GetFieldValue(Index : Integer) : String;
+
+begin
+  if (Index>1) and (Index<NoHTTPFields) then
+    Result:=FFields[Index]
+  else
+    case Index of
+      0  : Result:=FHTTPVersion;
+      25 : Result:=''; // Property PathInfo
+      26 : Result:=''; // Property PathTranslated
+      27 : Result:=''; // Property RemoteAddress
+      28 : Result:=''; // Property RemoteHost
+      29 : Result:=''; // Property ScriptName
+      30 : Result:=''; // Property ServerPort
+    end;
+end;
+
+procedure THTTPHeader.SetCookieFields(const AValue: TStrings);
+begin
+  FCookieFields.Assign(AValue);
+end;
+
+
+Procedure THttpHeader.SetFieldValue(Index : Integer; Value : String);
+
+begin
+  if (Index>1) and (Index<NoHTTPFields) then
+    begin
+    FFields[Index]:=Value;
+    If (Index=11) then
+      ParseCookies;
+    end
+  else
+    case Index of
+      0  : FHTTPVersion:=Value;
+      25 : ; // Property PathInfo : String index 25 read GetFieldValue Write SetFieldValue;
+      26 : ; // Property PathTranslated : String Index 26 read GetFieldValue Write SetFieldValue;
+      27 : ; // Property RemoteAddress : String Index 27 read GetFieldValue Write SetFieldValue;
+      28 : ; // Property RemoteHost : String Index 28 read  GetFieldValue Write SetFieldValue;
+      29 : ; // Property ScriptName : String Index 29 read  GetFieldValue Write SetFieldValue;
+      30 : ; // Property ServerPort : Word Read GetServerPort; // Index 30
+    end;
+end;
+
+procedure THTTPHeader.ParseFirstHeaderLine(const line: String);
+begin
+  // Do nothing.
+end;
+
+procedure THTTPHeader.ParseCookies;
+
+Var
+  P : Integer;
+  S,C : String;
+  
+begin
+{$ifdef cgidebug}  SendMethodEnter('Parsecookies');{$endif}
+  S:=Cookie;
+  While (S<>'') do
+    begin
+    P:=Pos(';',S);
+    If (P=0) then
+      P:=length(S)+1;
+    C:=Copy(S,1,P-1);
+    While (P<Length(S)) and (S[P+1]=' ') do
+      Inc(P);
+    System.Delete(S,1,P);
+    FCookieFields.Add(HTTPDecode(C));
+    end;
+{$ifdef cgidebug}  SendMethodExit('Parsecookies done');{$endif}
+end;
+
+constructor THttpHeader.Create;
+begin
+  FCookieFields:=TStringList.Create;
+  FQueryFields:=TStringList.Create;
+  FHttpVersion := '1.1';
+end;
+
+destructor THttpHeader.Destroy;
+
+begin
+  FreeAndNil(FCookieFields);
+  FreeAndNil(FQueryFields);
+  inherited Destroy;
+end;
+
+
+function THttpHeader.GetFieldByName(const AName: String): String;
+var
+  i: Integer;
+
+begin
+  I:=GetFieldNameIndex(AName);
+  If (I<>0) then
+    Result:=FFields[i];
+end;
+
+Function THTTPHeader.LoadFromStream(Stream: TStream; IncludeCommand : Boolean) : Integer;
+
+Var
+  S : TStrings;
+
+begin
+  S:=TStringList.Create;
+  Try
+    S.LoadFromStream(Stream);
+    Result:=LoadFromStrings(S,IncludeCommand);
+  Finally
+    S.Free;
+  end;
+end;
+
+Function THTTPHeader.LoadFromStrings(Strings: TStrings; IncludeCommand : Boolean) : integer;
+
+Var
+  P  : Integer;
+  S,VN : String;
+
+begin
+  Result:=0;
+  if (Strings.Count>0) then
+    begin
+    if IncludeCommand then
+      begin
+      ParseFirstHeaderLine(Strings[0]);
+      Inc(Result);
+      end;
+    While (Result<Strings.Count) and (Strings[Result]<>'') do
+      begin
+      S:=Strings[Result];
+      P:=Pos(':',S);
+      if (P<>0) then
+        begin
+        VN:=Copy(S,1,P-1);
+        Delete(S,1,P);
+        P:=GetFieldNameIndex(VN);
+        If (P<>-1) then
+          SetFieldValue(P,S);
+        end;
+      Inc(Result);
+      end;
+    end;
+end;
+
+procedure THttpHeader.SetFieldByName(const AName, AValue: String);
+var
+  i: Integer;
+
+begin
+  I:=GetFieldNameIndex(AName);
+  If (I<>0) then
+    SetFieldValue(i,AValue);
+end;
+
+{ -------------------------------------------------------------------
+  TFormItem, used by TRequest to process Multipart-encoded data.
+  -------------------------------------------------------------------}
+
+Type
+  TFormItem = Class(TObject)
+    Disposition : String;
+    Name : String;
+    IsFile : Boolean;
+    FileName : String;
+    ContentType : String;
+    DLen : Integer;
+    Data : String;
+    Procedure Process;
+  end;
+
+Procedure TFormItem.Process;
+
+  Function GetLine(Var S : String) : String;
+
+  Var
+    P : Integer;
+
+  begin
+    P:=Pos(#13#10,S);
+    If (P<>0) then
+      begin
+      Result:=Copy(S,1,P-1);
+      Delete(S,1,P+1);
+      end;
+  end;
+
+  Function GetWord(Var S : String) : String;
+
+  Var
+    I,len : Integer;
+    Quoted : Boolean;
+    C : Char;
+
+  begin
+    len:=length(S);
+    quoted:=false;
+    Result:='';
+    for i:=1 to len do
+      Begin
+      c:=S[i];
+      if (c='"') then
+        Quoted:=Not Quoted
+      else
+        begin
+        if not (c in [' ','=',';',':']) or Quoted then
+          Result:=Result+C;
+        if (c in [';',':','=']) and (not quoted) then
+          begin
+          Delete(S,1,I);
+          Exit;
+          end;
+        end;
+      end;
+     S:='';
+  end;
+
+Var
+  Line : String;
+  len : integer;
+  S : string;
+
+begin
+  Line:=GetLine(Data);
+  While (Line<>'') do
+    begin
+    S:=GetWord(Line);
+    While (S<>'') do
+      begin
+      If CompareText(S,'Content-Disposition')=0 then
+        Disposition:=GetWord(Line)
+      else if CompareText(S,'name')=0 Then
+        Name:=GetWord(Line)
+      else if CompareText(S,'filename')=0 then
+        begin
+        FileName:=GetWord(Line);
+        isFile:=True;
+        end
+      else if CompareText(S,'Content-Type')=0 then
+        ContentType:=GetWord(Line);
+      S:=GetWord(Line);
+      end;
+    Line:=GetLine(Data);
+    end;
+  // Now Data contains the rest of the data, plus a CR/LF. Strip the CR/LF
+  Len:=Length(Data);
+  If (len>2) then
+    Data:=Copy(Data,1,Len-2);
+end;
+
+{
+  This needs MASSIVE improvements for large files.
+  Best would be to do this directly from the input stream
+  and save the files at once if needed. (e.g. when a
+  certain size is reached.)
+}
+
+procedure FormSplit(var Cnt : String; boundary: String; List : TList);
+
+// Splits the form into items
+var
+  Sep : string;
+  Clen,slen, p:longint;
+  FI : TFormItem;
+
+begin
+  Sep:='--'+boundary+#13+#10;
+  Slen:=length(Sep);
+  CLen:=Pos('--'+Boundary+'--',Cnt);
+  // Cut last marker
+  Cnt:=Copy(Cnt,1,Clen-1);
+  // Cut first marker
+  Delete(Cnt,1,Slen);
+  Clen:=Length(Cnt);
+  While Clen>0 do
+    begin
+    Fi:=TFormItem.Create;
+    List.Add(Fi);
+    P:=pos(Sep,Cnt);
+    If (P=0) then
+      P:=CLen+1;
+    FI.Data:=Copy(Cnt,1,P-1);
+    delete(Cnt,1,P+SLen-1);
+    CLen:=Length(Cnt);
+    end;
+end;
+
+{ -------------------------------------------------------------------
+  TRequest
+  -------------------------------------------------------------------}
+  
+constructor TRequest.create;
+begin
+  inherited create;
+  FFiles:=TUploadedFiles.Create(TUPloadedFile);
+end;
+
+destructor TRequest.destroy;
+begin
+  FreeAndNil(FFiles);
+  inherited destroy;
+end;
+
+function TRequest.GetNextPathInfo: String;
+
+Var
+  P : String;
+  i : Integer;
+  
+begin
+  P:=PathInfo;
+  If (P<>'') and (P[1]='/') then
+    Delete(P,1,1);
+  Delete(P,1,Length(FReturnedPathInfo));
+  I:=Pos('/',P);
+  If (I=0) then
+    I:=Length(P)+1;
+  Result:=Copy(P,1,I-1);
+  FReturnedPathInfo:=FReturnedPathInfo+'/'+Result;
+end;
+
+procedure TRequest.ParseFirstHeaderLine(const line: String);
+var
+  i: Integer;
+begin
+  FCommandLine := line;
+  i := Pos(' ', line);
+  FCommand := UpperCase(Copy(line, 1, i - 1));
+  FURI := Copy(line, i + 1, Length(line));
+
+  // Extract HTTP version
+  i := Pos(' ', URI);
+  if i > 0 then
+  begin
+    FHttpVersion := Copy(URI, i + 1, Length(URI));
+    FURI := Copy(URI, 1, i - 1);
+    FHttpVersion := Copy(HttpVersion, Pos('/', HttpVersion) + 1, Length(HttpVersion));
+  end;
+
+  // Extract query string
+  i := Pos('?', URI);
+  if i > 0 then
+  begin
+    FQuery:= Copy(URI, i + 1, Length(URI));
+    FURI := Copy(URI, 1, i - 1);
+  end;
+end;
+
+function TRequest.GetFirstHeaderLine: String;
+begin
+  Result := Command + ' ' + URI;
+  if Length(HttpVersion) > 0 then
+    Result := Result + ' HTTP/' + HttpVersion;
+end;
+
+Procedure TRequest.ProcessQueryString(Const FQueryString : String);
+
+
+var
+  queryItem : String;
+  delimiter : Char;
+  aString : String;
+  aSepStr : String;
+  aPos    : Integer;
+  aLenStr : Integer;
+  aLenSep : Integer;
+
+  function hexConverter(h1, h2 : Char) : Char;
+
+  var
+    B : Byte;
+
+  begin
+    B:=(Pos(upcase(h1),hexTable)-1)*16;
+    B:=B+Pos(upcase(h2),hexTable)-1;
+    Result:=chr(B);
+  end;
+
+
+  procedure InitToken(aStr, aSep : String);
+
+  begin
+    aString := aStr;
+    aSepStr := aSep;
+    aPos    := 1;
+    aLenStr := Length(aString);
+    aLenSep := Length(aSepStr);
+  end;
+
+  function NextToken(var aToken : String; out aSepChar : Char) : Boolean;
+
+  var
+    i : Integer;
+    j : Integer;
+    BoT : Integer;
+    EoT : Integer;
+    isSep : Boolean;
+
+  begin
+    BoT:=aPos;
+    EoT:=aPos;
+    for i:=aPos to aLenStr do
+      begin
+      IsSep := false;
+      for j := 1 to aLenSep do
+        begin
+        if aString[i] = aSepStr[j] then
+          begin
+          IsSep := true;
+          Break;
+          end;
+        end;
+      if IsSep then
+        begin
+        EoT  := i;
+        aPos := i + 1;
+        aSepChar := aString[i];
+        Break;
+        end
+      else
+        begin
+        if i = aLenStr then
+          begin
+          EoT  := i;
+          aPos := i;
+          Break;
+          end;
+        end;
+      end;
+    if aPos < aLenStr then
+      begin
+      aToken := Copy(aString, BoT, EoT - BoT);
+      Result := true;
+      end
+    else
+      begin
+      if aPos = aLenStr then
+        begin
+        aToken := Copy(aString, BoT, EoT - BoT + 1);
+        Result := true;
+        aPos   := aPos + 1;
+        end
+      else
+        begin
+        Result := false;
+       end;
+    end;
+  end;
+
+
+begin
+{$ifdef CGIDEBUG}SendMethodEnter('ProcessQueryString');{$endif CGIDEBUG}
+  InitToken(FQueryString, '&');
+  while NextToken(QueryItem, delimiter) do
+    begin
+    if (QueryItem<>'') then
+      begin
+      QueryItem:=HTTPDecode(QueryItem);
+      FQueryFields.Add(QueryItem);
+      end;
+    end;
+{$ifdef CGIDEBUG}SendMethodExit('ProcessQueryString');{$endif CGIDEBUG}
+end;
+
+function TRequest.GetTempUploadFileName: String;
+begin
+  Result:=GetTempFileName('/tmp/','CGI')
+end;
+
+
+Procedure TRequest.ProcessMultiPart(Stream : TStream; Const Boundary : String);
+
+Var
+  L : TList;
+  B : String;
+  I : Integer;
+  S,FF,key, Value : String;
+  FI : TFormItem;
+  F : TStream;
+
+begin
+{$ifdef CGIDEBUG} SendMethodEnter('ProcessMultiPart');{$endif CGIDEBUG}
+  i:=Pos('=',Boundary);
+  B:=Copy(Boundary,I+1,Length(Boundary)-I);
+  I:=Length(B);
+  If (I>0) and (B[1]='"') then
+    B:=Copy(B,2,I-2);
+  L:=TList.Create;
+  Try
+    SetLength(S,Stream.Size);
+    If Length(S)>0 then
+      if Stream is TCustomMemoryStream then
+        // Faster.
+        Move(TCustomMemoryStream(Stream).Memory^,S[1],Length(S))
+      else
+        begin
+        Stream.Read(S[1],Length(S));
+        Stream.Position:=0;
+        end;
+    FormSplit(S,B,L);
+    For I:=L.Count-1 downto 0 do
+      begin
+      FI:=TFormItem(L[i]);
+      FI.Process;
+      If (FI.Name='') then
+        Raise Exception.CreateFmt('Invalid multipart encoding: %s',[FI.Data]);
+{$ifdef CGIDEBUG}
+      With FI Do
+        begin
+        SendSeparator;
+        SendDebug  ('PMP item Name        : '+Name);
+        SendDebug  ('PMP item Disposition : '+Disposition);
+        SendDebug  ('PMP item FileName    : '+FileName);
+        SendBoolean('PMP item IsFile      : ',IsFile);
+        SendDebug  ('PMP item ContentType : '+ContentType);
+        SendInteger('PMP item DLen        : ',DLen);
+        SendDebug  ('PMP item Data        : '+Data);
+        end;
+{$endif CGIDEBUG}
+      Key:=FI.Name;
+      If Not FI.IsFile Then
+        Value:=FI.Data
+      else
+        begin
+        Value:=FI.FileName;
+        if Length(FI.Data)=0 then
+          FF:=''
+        else
+          begin
+          FF:=GetTempUploadFileName;
+          F:=TFileStream.Create(FF,fmCreate);
+          Try
+            F.Write(FI.Data[1],Length(FI.Data));
+          finally
+            F.Free;
+          end;
+          end;
+        With Files.Add as TUploadedFile do
+          begin
+          FieldName:=FI.Name;
+          FileName:=FI.FileName;
+          ContentType:=FI.ContentType;
+          Disposition:=FI.Disposition;
+          Size:=FI.DLen;
+          LocalFileName:=FF;
+          end;
+        end;
+      FI.Free;
+      L[i]:=Nil;
+      QueryFields.Add(Key+'='+Value)
+      end;
+  Finally
+    For I:=0 to L.Count-1 do
+      TObject(L[i]).Free;
+    L.Free;
+  end;
+{$ifdef CGIDEBUG}  SendMethodExit('ProcessMultiPart');{$endif CGIDEBUG}
+end;
+
+Procedure TRequest.ProcessURLEncoded(Stream: TStream);
+
+var
+  S : String;
+
+begin
+{$ifdef CGIDEBUG} SendMethodEnter('ProcessURLEncoded');{$endif CGIDEBUG}
+  SetLength(S,Stream.Size); // Skip added Null.
+  Stream.ReadBuffer(S[1],Stream.Size);
+{$ifdef CGIDEBUG}SendDebugFmt('Query string : %s',[s]);{$endif CGIDEBUG}
+  ProcessQueryString(S);
+{$ifdef CGIDEBUG} SendMethodEnter('ProcessURLEncoded');{$endif CGIDEBUG}
+end;
+
+{ ---------------------------------------------------------------------
+  TUploadedFiles
+  ---------------------------------------------------------------------}
+
+function TUploadedFiles.GetFile(Index : Integer): TUploadedFile;
+begin
+  Result:=TUPloadedFile(Items[Index]);
+end;
+
+procedure TUploadedFiles.SetFile(Index : Integer; const AValue: TUploadedFile);
+begin
+  Items[Index]:=AValue;
+end;
+
+function TUploadedFiles.IndexOfFile(AName: String): Integer;
+
+begin
+  Result:=Count-1;
+  While (Result>=0) and (CompareText(Files[Result].FieldName,AName)<>0) do
+    Dec(Result);
+end;
+
+function TUploadedFiles.FileByName(AName: String): TUploadedFile;
+
+
+begin
+  Result:=FindFile(AName);
+  If (Result=Nil) then
+    Raise HTTPError.CreateFmt(SErrNoSuchUploadedFile,[AName]);
+end;
+
+Function TUploadedFiles.FindFile(AName: String): TUploadedFile;
+
+Var
+  I : Integer;
+  
+begin
+  I:=IndexOfFile(AName);
+  If (I=-1) then
+    Result:=Nil
+  else
+    Result:=Files[I];
+end;
+
+{ ---------------------------------------------------------------------
+  TUploadedFile
+  ---------------------------------------------------------------------}
+
+function TUploadedFile.GetStream: TStream;
+begin
+  If (FStream=Nil) then
+    begin
+    If (FLocalFileName='') then
+      Raise HTTPError.Create(SErrInternalUploadedFileError);
+    FStream:=TFileStream.Create(FLocalFileName,fmOpenRead);
+    end;
+  Result:=FStream;
+end;
+
+destructor TUploadedFile.Destroy;
+begin
+  FreeAndNil(FStream);
+  Inherited;
+end;
+
+{ ---------------------------------------------------------------------
+  TResponse
+  ---------------------------------------------------------------------}
+
+constructor TResponse.Create(ARequest : TRequest);
+begin
+  inherited Create;
+  FRequest:=ARequest;
+  FCode := 200;
+  FCodeText := 'OK';
+  ContentType:='text/html';
+  FContents:=TStringList.Create;
+  TStringList(FContents).OnChange:=@ContentsChanged;
+  FCookies:=TCookies.Create(TCookie);
+end;
+
+destructor TResponse.destroy;
+begin
+  FreeAndNil(FContents);
+  inherited destroy;
+end;
+
+
+procedure TResponse.SendContent;
+begin
+  if ContentSent then
+    Raise HTTPError.Create(SErrContentAlreadySent);
+  if Not HeadersSent then
+    SendHeaders;
+  DoSendContent;
+  FContentSent:=True;
+end;
+
+procedure TResponse.SendHeaders;
+
+Var
+  FHeaders  : TStringList;
+
+begin
+  if HeadersSent then
+    Raise HTTPError.Create(SErrHeadersAlreadySent);
+  FHeaders:=TStringList.Create;
+  CollectHeaders(FHeaders);
+  With Fheaders do
+  If (Count>0) and (Strings[Count-1]<>'') then
+    Add('');
+  Try
+    DoSendHeaders(FHeaders);
+    FHeadersSent:=True;
+  Finally
+    FHeaders.Free;
+  end;
+end;
+
+procedure TResponse.SendResponse;
+begin
+  SendContent;
+end;
+
+procedure TResponse.SetFirstHeaderLine(const line: String);
+var
+  i: Integer;
+  s: String;
+begin
+  i := Pos('/', line);
+  s := Copy(line, i + 1, Length(line));
+  i := Pos(' ', s);
+  FHttpVersion := Copy(s, 1, i - 1);
+  s := Copy(s, i + 1, Length(s));
+  i := Pos(' ', s);
+  if i > 0 then begin
+    FCodeText := Copy(s, i + 1, Length(s));
+    s := Copy(s, 1, i - 1);
+  end;
+  FCode := StrToInt(s);
+end;
+
+procedure TResponse.SetContents(AValue: TStrings);
+begin
+  FContentStream:=Nil;
+  FContents.Assign(AValue);
+end;
+
+function TResponse.GetContent: String;
+begin
+  Result:=Contents.Text;
+end;
+
+procedure TResponse.SetContent(const AValue: String);
+begin
+  FContentStream:=Nil;
+  FContents.Text:=AValue;
+end;
+
+procedure TResponse.SetContentStream(const AValue: TStream);
+begin
+  If (FContentStream<>AValue) then
+    begin
+    FContentStream:=AValue;
+    If (FContentStream<>Nil) then
+      ContentLength:=FContentStream.Size
+    else
+      ContentLength:=0;
+    end;
+end;
+
+function TResponse.GetFirstHeaderLine: String;
+begin
+  Result := Format('HTTP/%s %d %s', [HttpVersion, Code, CodeText]);
+end;
+
+procedure TResponse.ContentsChanged(Sender: TObject);
+
+Var
+  I,L,LE : Integer;
+
+begin
+  L:=0;
+  LE:=Length(LineEnding);
+  For I:=0 to FContents.Count-1 do
+    L:=L+Length(FContents[i])+LE;
+  ContentLength:=L;
+end;
+
+procedure TResponse.CollectHeaders(Headers: TStrings);
+
+Var
+  I : Integer;
+
+begin
+  Headers.add(Format('Status: %d %s',[Code,CodeText]));
+{$ifdef cgidebug}
+  SendMethodEnter('Collectheaders');
+  If Not Assigned(FCookies) then
+    SendDebug('No cookies')
+  else
+    SendInteger('Nr of cookies',FCookies.Count);
+{$endif}
+  For I:=0 to FCookies.Count-1 do
+    Headers.Add('Set-Cookie: '+FCookies[i].AsString);
+  For I:=0 to FieldCount-1 do
+    Headers.Add(Fields[i]);
+  Headers.Add('');
+{$ifdef cgidebug} SendMethodExit('Collectheaders');{$endif}
+end;
+
+
+{ TCookie }
+
+
+function TCookie.GetAsString: string;
+
+Var
+  Y,M,D : Word;
+
+begin
+{$ifdef cgidebug}SendMethodEnter('TCookie.GetAsString');{$endif}
+  try
+    Result:=Format('%s=%s;',[HTTPEncode(FName),HTTPEncode(FValue)]);
+    if (Length(FDomain)>0) then
+      Result:=Result+Format(SCookieDomain,[FDomain]);
+    if (Length(FPath)>0) then
+      Result:=Result+Format(SCookiePath,[FPath]);
+    if (FExpires>-1) then
+      begin
+      DecodeDate(Expires,Y,M,D);
+      Result:=Result+Format(FormatDateTime(SCookieExpire,Expires),
+                          [HTTPDays[DayOfWeek(Expires)],HTTPMonths[M]]);
+      end;
+    if Secure then
+      Result:=Result+SCookieSecure;
+  except
+{$ifdef cgidebug}
+    On E : Exception do
+      SendDebug('Exception in cookie asstring : '+E.Message)
+{$endif}
+  end;
+{$ifdef cgidebug}SendMethodExit('TCookie.GetAsString');{$endif}
+end;
+
+constructor TCookie.Create(ACollection: TCollection);
+begin
+  inherited Create(ACollection);
+  FExpires:=-1;
+end;
+
+procedure TCookie.Assign(Source: TPersistent);
+begin
+  if Source is TCookie then
+    with TCookie(Source) do
+      begin
+      Self.FName:=Name;
+      Self.FValue:=Value;
+      Self.FDomain:=Domain;
+      Self.FPath:=Path;
+      Self.FExpires:=Expires;
+      Self.FSecure:=Secure;
+      end
+  else
+    inherited Assign(Source);
+end;
+
+{ TCookieCollection }
+
+function TCookies.GetCookie(Index: Integer): TCookie;
+begin
+{$ifdef cgidebug}SendMethodExit('TCookies.GetCookie');{$endif}
+  Result:=TCookie(inherited Items[Index]);
+{$ifdef cgidebug}SendMethodExit('TCookies.GetCookie');{$endif}
+end;
+
+procedure TCookies.SetCookie(Index: Integer; Value: TCookie);
+begin
+  Items[Index]:=Value
+end;
+
+function TCookies.Add: TCookie;
+begin
+  Result:=TCookie(Inherited Add);
+end;
+
+function TCookies.CookieByName(AName: String): TCookie;
+begin
+  Result:=FindCookie(AName);
+  If (Result=Nil) then
+    Raise HTTPError.CreateFmt(SErrUnknownCookie,[AName]);
+end;
+
+function TCookies.FindCookie(AName: String): TCookie;
+Var
+  I : Integer;
+
+begin
+  I:=IndexOfCookie(AName);
+  If (I=-1) then
+    Result:=Nil
+  else
+    Result:=GetCookie(I);
+end;
+
+function TCookies.IndexOfCookie(AName: String): Integer;
+
+begin
+  Result:=Count-1;
+  While (Result>=0) and (CompareText(GetCookie(Result).Name,AName)<>0) do
+    Dec(Result);
+end;
+
+{ TCustomSession }
+
+
+function TCustomSession.GetSessionID: String;
+
+Var
+  G : TGUID;
+
+begin
+  CreateGUID(G);
+  Result:=GuiDToString(G);
+end;
+
+constructor TCustomSession.Create(AOwner: TComponent);
+begin
+  FTimeOut:=15;
+  inherited Create(AOwner);
+end;
+
+procedure TCustomSession.InitResponse(AResponse: TResponse);
+begin
+  // do nothing
+end;
+
+procedure TCustomSession.InitSession(ARequest: TRequest; OnNewSession,OnExpired : TNotifyEvent);
+begin
+  // Do nothing
+end;
+
+
+end.

+ 1379 - 0
fcl/web/tagsimpl.inc

@@ -0,0 +1,1379 @@
+{ THTML_a }
+
+constructor THTML_a.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  eta;
+end;
+
+function THTML_a.Getshape: THTMLshape;
+var r : THTMLshape;
+    s : DOMString;
+begin
+  s := GetAttribute (atshape);
+  r := high(THTMLshape);
+  while (r > low(THTMLshape)) and (comparetext(s,HTMLshape[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_a.Setshape(const AValue: THTMLshape);
+begin
+  if AValue = shEmpty then
+    RemoveAttribute(atshape)
+  else
+    SetAttribute (atshape, HTMLshape[AValue]);
+end;
+
+{ THTML_abbr }
+
+constructor THTML_abbr.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etabbr;
+end;
+
+{ THTML_acronym }
+
+constructor THTML_acronym.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etacronym;
+end;
+
+{ THTML_address }
+
+constructor THTML_address.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etaddress;
+end;
+
+{ THTML_applet }
+
+constructor THTML_applet.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etapplet;
+end;
+
+{ THTML_area }
+
+constructor THTML_area.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etarea;
+end;
+
+function THTML_area.Getnohref: boolean;
+begin
+  result := GetAttribute (atnohref) <> '';
+end;
+
+procedure THTML_area.Setnohref(const AValue: boolean);
+begin
+  if AValue then
+    SetAttribute (atnohref, 'nohref')
+  else
+    RemoveAttribute(atnohref);
+end;
+
+function THTML_area.Getshape: THTMLshape;
+var r : THTMLshape;
+    s : DOMString;
+begin
+  s := GetAttribute (atshape);
+  r := high(THTMLshape);
+  while (r > low(THTMLshape)) and (comparetext(s,HTMLshape[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_area.Setshape(const AValue: THTMLshape);
+begin
+  if AValue = shEmpty then
+    RemoveAttribute(atshape)
+  else
+    SetAttribute (atshape, HTMLshape[AValue]);
+end;
+
+{ THTML_b }
+
+constructor THTML_b.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etb;
+end;
+
+{ THTML_base }
+
+constructor THTML_base.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etbase;
+end;
+
+{ THTML_basefont }
+
+constructor THTML_basefont.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etbasefont;
+end;
+
+{ THTML_bdo }
+
+constructor THTML_bdo.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etbdo;
+end;
+
+{ THTML_big }
+
+constructor THTML_big.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etbig;
+end;
+
+{ THTML_blockquote }
+
+constructor THTML_blockquote.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etblockquote;
+end;
+
+{ THTML_body }
+
+constructor THTML_body.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etbody;
+end;
+
+{ THTML_br }
+
+constructor THTML_br.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etbr;
+end;
+
+{ THTML_button }
+
+constructor THTML_button.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etbutton;
+end;
+
+function THTML_button.Getdisabled: boolean;
+begin
+  result := GetAttribute (atdisabled) <> '';
+end;
+
+procedure THTML_button.Setdisabled(const AValue: boolean);
+begin
+  if AValue then
+    SetAttribute (atdisabled, 'disabled')
+  else
+    RemoveAttribute(atdisabled);
+end;
+
+function THTML_button.Gettype: THTMLbuttontype;
+var r : THTMLbuttontype;
+    s : DOMString;
+begin
+  s := GetAttribute (attype);
+  r := high(THTMLbuttontype);
+  while (r > low(THTMLbuttontype)) and (comparetext(s,HTMLbuttontype[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_button.Settype(const AValue: THTMLbuttontype);
+begin
+  if AValue = btEmpty then
+    RemoveAttribute(attype)
+  else
+    SetAttribute (attype, HTMLbuttontype[AValue]);
+end;
+
+{ THTML_caption }
+
+constructor THTML_caption.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etcaption;
+end;
+
+{ THTML_center }
+
+constructor THTML_center.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etcenter;
+end;
+
+{ THTML_cite }
+
+constructor THTML_cite.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etcite;
+end;
+
+{ THTML_code }
+
+constructor THTML_code.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etcode;
+end;
+
+{ THTML_col }
+
+constructor THTML_col.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etcol;
+end;
+
+function THTML_col.Getalign: THTMLalign;
+var r : THTMLalign;
+    s : DOMString;
+begin
+  s := GetAttribute (atalign);
+  r := high(THTMLalign);
+  while (r > low(THTMLalign)) and (comparetext(s,HTMLalign[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_col.Setalign(const AValue: THTMLalign);
+begin
+  if AValue = alEmpty then
+    RemoveAttribute(atalign)
+  else
+    SetAttribute (atalign, HTMLalign[AValue]);
+end;
+
+function THTML_col.Getvalign: THTMLvalign;
+var r : THTMLvalign;
+    s : DOMString;
+begin
+  s := GetAttribute (atvalign);
+  r := high(THTMLvalign);
+  while (r > low(THTMLvalign)) and (comparetext(s,HTMLvalign[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_col.Setvalign(const AValue: THTMLvalign);
+begin
+  if AValue = vaEmpty then
+    RemoveAttribute(atvalign)
+  else
+    SetAttribute (atvalign, HTMLvalign[AValue]);
+end;
+
+{ THTML_colgroup }
+
+constructor THTML_colgroup.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etcolgroup;
+end;
+
+function THTML_colgroup.Getalign: THTMLalign;
+var r : THTMLalign;
+    s : DOMString;
+begin
+  s := GetAttribute (atalign);
+  r := high(THTMLalign);
+  while (r > low(THTMLalign)) and (comparetext(s,HTMLalign[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_colgroup.Setalign(const AValue: THTMLalign);
+begin
+  if AValue = alEmpty then
+    RemoveAttribute(atalign)
+  else
+    SetAttribute (atalign, HTMLalign[AValue]);
+end;
+
+function THTML_colgroup.Getvalign: THTMLvalign;
+var r : THTMLvalign;
+    s : DOMString;
+begin
+  s := GetAttribute (atvalign);
+  r := high(THTMLvalign);
+  while (r > low(THTMLvalign)) and (comparetext(s,HTMLvalign[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_colgroup.Setvalign(const AValue: THTMLvalign);
+begin
+  if AValue = vaEmpty then
+    RemoveAttribute(atvalign)
+  else
+    SetAttribute (atvalign, HTMLvalign[AValue]);
+end;
+
+{ THTML_dd }
+
+constructor THTML_dd.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etdd;
+end;
+
+{ THTML_del }
+
+constructor THTML_del.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etdel;
+end;
+
+{ THTML_dfn }
+
+constructor THTML_dfn.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etdfn;
+end;
+
+{ THTML_dir }
+
+constructor THTML_dir.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etdir;
+end;
+
+{ THTML_div }
+
+constructor THTML_div.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etdiv;
+end;
+
+{ THTML_dl }
+
+constructor THTML_dl.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etdl;
+end;
+
+{ THTML_dt }
+
+constructor THTML_dt.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etdt;
+end;
+
+{ THTML_em }
+
+constructor THTML_em.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etem;
+end;
+
+{ THTML_fieldset }
+
+constructor THTML_fieldset.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etfieldset;
+end;
+
+{ THTML_font }
+
+constructor THTML_font.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etfont;
+end;
+
+{ THTML_form }
+
+constructor THTML_form.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etform;
+end;
+
+{ THTML_frame }
+
+constructor THTML_frame.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etframe;
+end;
+
+function THTML_frame.Getnoresize: boolean;
+begin
+  result := GetAttribute (atnoresize) <> '';
+end;
+
+procedure THTML_frame.Setnoresize(const AValue: boolean);
+begin
+  if AValue then
+    SetAttribute (atnoresize, 'noresize')
+  else
+    RemoveAttribute(atnoresize);
+end;
+
+{ THTML_frameset }
+
+constructor THTML_frameset.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etframeset;
+end;
+
+{ THTML_h1 }
+
+constructor THTML_h1.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  eth1;
+end;
+
+{ THTML_h2 }
+
+constructor THTML_h2.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  eth2;
+end;
+
+{ THTML_h3 }
+
+constructor THTML_h3.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  eth3;
+end;
+
+{ THTML_h4 }
+
+constructor THTML_h4.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  eth4;
+end;
+
+{ THTML_h5 }
+
+constructor THTML_h5.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  eth5;
+end;
+
+{ THTML_h6 }
+
+constructor THTML_h6.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  eth6;
+end;
+
+{ THTML_head }
+
+constructor THTML_head.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  ethead;
+end;
+
+{ THTML_hr }
+
+constructor THTML_hr.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  ethr;
+end;
+
+{ THTML_html }
+
+constructor THTML_html.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  ethtml;
+end;
+
+{ THTML_i }
+
+constructor THTML_i.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  eti;
+end;
+
+{ THTML_iframe }
+
+constructor THTML_iframe.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etiframe;
+end;
+
+function THTML_iframe.Getalign: THTMLalign;
+var r : THTMLalign;
+    s : DOMString;
+begin
+  s := GetAttribute (atalign);
+  r := high(THTMLalign);
+  while (r > low(THTMLalign)) and (comparetext(s,HTMLalign[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_iframe.Setalign(const AValue: THTMLalign);
+begin
+  if AValue = alEmpty then
+    RemoveAttribute(atalign)
+  else
+    SetAttribute (atalign, HTMLalign[AValue]);
+end;
+
+{ THTML_img }
+
+constructor THTML_img.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etimg;
+end;
+
+{ THTML_input }
+
+constructor THTML_input.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etinput;
+end;
+
+function THTML_input.Getchecked: boolean;
+begin
+  result := GetAttribute (atchecked) <> '';
+end;
+
+procedure THTML_input.Setchecked(const AValue: boolean);
+begin
+  if AValue then
+    SetAttribute (atchecked, 'checked')
+  else
+    RemoveAttribute(atchecked);
+end;
+
+function THTML_input.Getdisabled: boolean;
+begin
+  result := GetAttribute (atdisabled) <> '';
+end;
+
+procedure THTML_input.Setdisabled(const AValue: boolean);
+begin
+  if AValue then
+    SetAttribute (atdisabled, 'disabled')
+  else
+    RemoveAttribute(atdisabled);
+end;
+
+function THTML_input.Getreadonly: boolean;
+begin
+  result := GetAttribute (atreadonly) <> '';
+end;
+
+procedure THTML_input.Setreadonly(const AValue: boolean);
+begin
+  if AValue then
+    SetAttribute (atreadonly, 'readonly')
+  else
+    RemoveAttribute(atreadonly);
+end;
+
+function THTML_input.Gettype: THTMLinputtype;
+var r : THTMLinputtype;
+    s : DOMString;
+begin
+  s := GetAttribute (attype);
+  r := high(THTMLinputtype);
+  while (r > low(THTMLinputtype)) and (comparetext(s,HTMLinputtype[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_input.Settype(const AValue: THTMLinputtype);
+begin
+  if AValue = itEmpty then
+    RemoveAttribute(attype)
+  else
+    SetAttribute (attype, HTMLinputtype[AValue]);
+end;
+
+{ THTML_ins }
+
+constructor THTML_ins.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etins;
+end;
+
+{ THTML_isindex }
+
+constructor THTML_isindex.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etisindex;
+end;
+
+{ THTML_kbd }
+
+constructor THTML_kbd.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etkbd;
+end;
+
+{ THTML_label }
+
+constructor THTML_label.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etlabel;
+end;
+
+{ THTML_legend }
+
+constructor THTML_legend.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etlegend;
+end;
+
+{ THTML_li }
+
+constructor THTML_li.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etli;
+end;
+
+{ THTML_link }
+
+constructor THTML_link.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etlink;
+end;
+
+{ THTML_map }
+
+constructor THTML_map.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etmap;
+end;
+
+{ THTML_menu }
+
+constructor THTML_menu.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etmenu;
+end;
+
+{ THTML_meta }
+
+constructor THTML_meta.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etmeta;
+end;
+
+{ THTML_noframes }
+
+constructor THTML_noframes.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etnoframes;
+end;
+
+{ THTML_noscript }
+
+constructor THTML_noscript.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etnoscript;
+end;
+
+{ THTML_object }
+
+constructor THTML_object.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etobject;
+end;
+
+function THTML_object.Getdeclare: boolean;
+begin
+  result := GetAttribute (atdeclare) <> '';
+end;
+
+procedure THTML_object.Setdeclare(const AValue: boolean);
+begin
+  if AValue then
+    SetAttribute (atdeclare, 'declare')
+  else
+    RemoveAttribute(atdeclare);
+end;
+
+{ THTML_ol }
+
+constructor THTML_ol.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etol;
+end;
+
+{ THTML_optgroup }
+
+constructor THTML_optgroup.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etoptgroup;
+end;
+
+function THTML_optgroup.Getdisabled: boolean;
+begin
+  result := GetAttribute (atdisabled) <> '';
+end;
+
+procedure THTML_optgroup.Setdisabled(const AValue: boolean);
+begin
+  if AValue then
+    SetAttribute (atdisabled, 'disabled')
+  else
+    RemoveAttribute(atdisabled);
+end;
+
+{ THTML_option }
+
+constructor THTML_option.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etoption;
+end;
+
+function THTML_option.Getdisabled: boolean;
+begin
+  result := GetAttribute (atdisabled) <> '';
+end;
+
+procedure THTML_option.Setdisabled(const AValue: boolean);
+begin
+  if AValue then
+    SetAttribute (atdisabled, 'disabled')
+  else
+    RemoveAttribute(atdisabled);
+end;
+
+function THTML_option.Getselected: boolean;
+begin
+  result := GetAttribute (atselected) <> '';
+end;
+
+procedure THTML_option.Setselected(const AValue: boolean);
+begin
+  if AValue then
+    SetAttribute (atselected, 'selected')
+  else
+    RemoveAttribute(atselected);
+end;
+
+{ THTML_p }
+
+constructor THTML_p.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etp;
+end;
+
+{ THTML_param }
+
+constructor THTML_param.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etparam;
+end;
+
+function THTML_param.Getvaluetype: THTMLvaluetype;
+var r : THTMLvaluetype;
+    s : DOMString;
+begin
+  s := GetAttribute (atvaluetype);
+  r := high(THTMLvaluetype);
+  while (r > low(THTMLvaluetype)) and (comparetext(s,HTMLvaluetype[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_param.Setvaluetype(const AValue: THTMLvaluetype);
+begin
+  if AValue = vtEmpty then
+    RemoveAttribute(atvaluetype)
+  else
+    SetAttribute (atvaluetype, HTMLvaluetype[AValue]);
+end;
+
+{ THTML_pre }
+
+constructor THTML_pre.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etpre;
+end;
+
+{ THTML_q }
+
+constructor THTML_q.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etq;
+end;
+
+{ THTML_s }
+
+constructor THTML_s.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  ets;
+end;
+
+{ THTML_samp }
+
+constructor THTML_samp.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etsamp;
+end;
+
+{ THTML_script }
+
+constructor THTML_script.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etscript;
+end;
+
+function THTML_script.Getdefer: boolean;
+begin
+  result := GetAttribute (atdefer) <> '';
+end;
+
+procedure THTML_script.Setdefer(const AValue: boolean);
+begin
+  if AValue then
+    SetAttribute (atdefer, 'defer')
+  else
+    RemoveAttribute(atdefer);
+end;
+
+{ THTML_select }
+
+constructor THTML_select.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etselect;
+end;
+
+function THTML_select.Getdisabled: boolean;
+begin
+  result := GetAttribute (atdisabled) <> '';
+end;
+
+procedure THTML_select.Setdisabled(const AValue: boolean);
+begin
+  if AValue then
+    SetAttribute (atdisabled, 'disabled')
+  else
+    RemoveAttribute(atdisabled);
+end;
+
+function THTML_select.Getmultiple: boolean;
+begin
+  result := GetAttribute (atmultiple) <> '';
+end;
+
+procedure THTML_select.Setmultiple(const AValue: boolean);
+begin
+  if AValue then
+    SetAttribute (atmultiple, 'multiple')
+  else
+    RemoveAttribute(atmultiple);
+end;
+
+{ THTML_small }
+
+constructor THTML_small.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etsmall;
+end;
+
+{ THTML_span }
+
+constructor THTML_span.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etspan;
+end;
+
+{ THTML_strike }
+
+constructor THTML_strike.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etstrike;
+end;
+
+{ THTML_strong }
+
+constructor THTML_strong.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etstrong;
+end;
+
+{ THTML_style }
+
+constructor THTML_style.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etstyle;
+end;
+
+{ THTML_sub }
+
+constructor THTML_sub.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etsub;
+end;
+
+{ THTML_sup }
+
+constructor THTML_sup.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etsup;
+end;
+
+{ THTML_table }
+
+constructor THTML_table.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  ettable;
+end;
+
+function THTML_table.Getframe: THTMLframe;
+var r : THTMLframe;
+    s : DOMString;
+begin
+  s := GetAttribute (atframe);
+  r := high(THTMLframe);
+  while (r > low(THTMLframe)) and (comparetext(s,HTMLframe[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_table.Setframe(const AValue: THTMLframe);
+begin
+  if AValue = frEmpty then
+    RemoveAttribute(atframe)
+  else
+    SetAttribute (atframe, HTMLframe[AValue]);
+end;
+
+function THTML_table.Getrules: THTMLrules;
+var r : THTMLrules;
+    s : DOMString;
+begin
+  s := GetAttribute (atrules);
+  r := high(THTMLrules);
+  while (r > low(THTMLrules)) and (comparetext(s,HTMLrules[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_table.Setrules(const AValue: THTMLrules);
+begin
+  if AValue = ruEmpty then
+    RemoveAttribute(atrules)
+  else
+    SetAttribute (atrules, HTMLrules[AValue]);
+end;
+
+{ THTML_tbody }
+
+constructor THTML_tbody.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  ettbody;
+end;
+
+function THTML_tbody.Getalign: THTMLalign;
+var r : THTMLalign;
+    s : DOMString;
+begin
+  s := GetAttribute (atalign);
+  r := high(THTMLalign);
+  while (r > low(THTMLalign)) and (comparetext(s,HTMLalign[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_tbody.Setalign(const AValue: THTMLalign);
+begin
+  if AValue = alEmpty then
+    RemoveAttribute(atalign)
+  else
+    SetAttribute (atalign, HTMLalign[AValue]);
+end;
+
+function THTML_tbody.Getvalign: THTMLvalign;
+var r : THTMLvalign;
+    s : DOMString;
+begin
+  s := GetAttribute (atvalign);
+  r := high(THTMLvalign);
+  while (r > low(THTMLvalign)) and (comparetext(s,HTMLvalign[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_tbody.Setvalign(const AValue: THTMLvalign);
+begin
+  if AValue = vaEmpty then
+    RemoveAttribute(atvalign)
+  else
+    SetAttribute (atvalign, HTMLvalign[AValue]);
+end;
+
+{ THTML_td }
+
+constructor THTML_td.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  ettd;
+end;
+
+function THTML_td.Getalign: THTMLalign;
+var r : THTMLalign;
+    s : DOMString;
+begin
+  s := GetAttribute (atalign);
+  r := high(THTMLalign);
+  while (r > low(THTMLalign)) and (comparetext(s,HTMLalign[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_td.Setalign(const AValue: THTMLalign);
+begin
+  if AValue = alEmpty then
+    RemoveAttribute(atalign)
+  else
+    SetAttribute (atalign, HTMLalign[AValue]);
+end;
+
+function THTML_td.Getvalign: THTMLvalign;
+var r : THTMLvalign;
+    s : DOMString;
+begin
+  s := GetAttribute (atvalign);
+  r := high(THTMLvalign);
+  while (r > low(THTMLvalign)) and (comparetext(s,HTMLvalign[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_td.Setvalign(const AValue: THTMLvalign);
+begin
+  if AValue = vaEmpty then
+    RemoveAttribute(atvalign)
+  else
+    SetAttribute (atvalign, HTMLvalign[AValue]);
+end;
+
+{ THTML_textarea }
+
+constructor THTML_textarea.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  ettextarea;
+end;
+
+function THTML_textarea.Getdisabled: boolean;
+begin
+  result := GetAttribute (atdisabled) <> '';
+end;
+
+procedure THTML_textarea.Setdisabled(const AValue: boolean);
+begin
+  if AValue then
+    SetAttribute (atdisabled, 'disabled')
+  else
+    RemoveAttribute(atdisabled);
+end;
+
+function THTML_textarea.Getreadonly: boolean;
+begin
+  result := GetAttribute (atreadonly) <> '';
+end;
+
+procedure THTML_textarea.Setreadonly(const AValue: boolean);
+begin
+  if AValue then
+    SetAttribute (atreadonly, 'readonly')
+  else
+    RemoveAttribute(atreadonly);
+end;
+
+{ THTML_tfoot }
+
+constructor THTML_tfoot.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  ettfoot;
+end;
+
+function THTML_tfoot.Getalign: THTMLalign;
+var r : THTMLalign;
+    s : DOMString;
+begin
+  s := GetAttribute (atalign);
+  r := high(THTMLalign);
+  while (r > low(THTMLalign)) and (comparetext(s,HTMLalign[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_tfoot.Setalign(const AValue: THTMLalign);
+begin
+  if AValue = alEmpty then
+    RemoveAttribute(atalign)
+  else
+    SetAttribute (atalign, HTMLalign[AValue]);
+end;
+
+function THTML_tfoot.Getvalign: THTMLvalign;
+var r : THTMLvalign;
+    s : DOMString;
+begin
+  s := GetAttribute (atvalign);
+  r := high(THTMLvalign);
+  while (r > low(THTMLvalign)) and (comparetext(s,HTMLvalign[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_tfoot.Setvalign(const AValue: THTMLvalign);
+begin
+  if AValue = vaEmpty then
+    RemoveAttribute(atvalign)
+  else
+    SetAttribute (atvalign, HTMLvalign[AValue]);
+end;
+
+{ THTML_th }
+
+constructor THTML_th.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etth;
+end;
+
+function THTML_th.Getalign: THTMLalign;
+var r : THTMLalign;
+    s : DOMString;
+begin
+  s := GetAttribute (atalign);
+  r := high(THTMLalign);
+  while (r > low(THTMLalign)) and (comparetext(s,HTMLalign[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_th.Setalign(const AValue: THTMLalign);
+begin
+  if AValue = alEmpty then
+    RemoveAttribute(atalign)
+  else
+    SetAttribute (atalign, HTMLalign[AValue]);
+end;
+
+function THTML_th.Getvalign: THTMLvalign;
+var r : THTMLvalign;
+    s : DOMString;
+begin
+  s := GetAttribute (atvalign);
+  r := high(THTMLvalign);
+  while (r > low(THTMLvalign)) and (comparetext(s,HTMLvalign[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_th.Setvalign(const AValue: THTMLvalign);
+begin
+  if AValue = vaEmpty then
+    RemoveAttribute(atvalign)
+  else
+    SetAttribute (atvalign, HTMLvalign[AValue]);
+end;
+
+{ THTML_thead }
+
+constructor THTML_thead.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etthead;
+end;
+
+function THTML_thead.Getalign: THTMLalign;
+var r : THTMLalign;
+    s : DOMString;
+begin
+  s := GetAttribute (atalign);
+  r := high(THTMLalign);
+  while (r > low(THTMLalign)) and (comparetext(s,HTMLalign[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_thead.Setalign(const AValue: THTMLalign);
+begin
+  if AValue = alEmpty then
+    RemoveAttribute(atalign)
+  else
+    SetAttribute (atalign, HTMLalign[AValue]);
+end;
+
+function THTML_thead.Getvalign: THTMLvalign;
+var r : THTMLvalign;
+    s : DOMString;
+begin
+  s := GetAttribute (atvalign);
+  r := high(THTMLvalign);
+  while (r > low(THTMLvalign)) and (comparetext(s,HTMLvalign[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_thead.Setvalign(const AValue: THTMLvalign);
+begin
+  if AValue = vaEmpty then
+    RemoveAttribute(atvalign)
+  else
+    SetAttribute (atvalign, HTMLvalign[AValue]);
+end;
+
+{ THTML_title }
+
+constructor THTML_title.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  ettitle;
+end;
+
+{ THTML_tr }
+
+constructor THTML_tr.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  ettr;
+end;
+
+function THTML_tr.Getalign: THTMLalign;
+var r : THTMLalign;
+    s : DOMString;
+begin
+  s := GetAttribute (atalign);
+  r := high(THTMLalign);
+  while (r > low(THTMLalign)) and (comparetext(s,HTMLalign[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_tr.Setalign(const AValue: THTMLalign);
+begin
+  if AValue = alEmpty then
+    RemoveAttribute(atalign)
+  else
+    SetAttribute (atalign, HTMLalign[AValue]);
+end;
+
+function THTML_tr.Getvalign: THTMLvalign;
+var r : THTMLvalign;
+    s : DOMString;
+begin
+  s := GetAttribute (atvalign);
+  r := high(THTMLvalign);
+  while (r > low(THTMLvalign)) and (comparetext(s,HTMLvalign[r]) <> 0) do
+    dec (r);
+  result := r;
+end;
+
+procedure THTML_tr.Setvalign(const AValue: THTMLvalign);
+begin
+  if AValue = vaEmpty then
+    RemoveAttribute(atvalign)
+  else
+    SetAttribute (atvalign, HTMLvalign[AValue]);
+end;
+
+{ THTML_tt }
+
+constructor THTML_tt.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  ettt;
+end;
+
+{ THTML_u }
+
+constructor THTML_u.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etu;
+end;
+
+{ THTML_ul }
+
+constructor THTML_ul.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etul;
+end;
+
+{ THTML_var }
+
+constructor THTML_var.create (AOwner: TDOMDocument);
+begin
+  inherited create (AOwner);
+  ElementTag :=  etvar;
+end;
+

+ 774 - 0
fcl/web/tagsintf.inc

@@ -0,0 +1,774 @@
+  THTML_a = class (THTMLAttrsElement)
+  private
+    function Getshape: THTMLshape;
+    procedure Setshape(const AValue: THTMLshape);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property accesskey : DOMString index ataccesskey read GetAttribute write SetAttribute;
+    property charset : DOMString index atcharset read GetAttribute write SetAttribute;
+    property coords : DOMString index atcoords read GetAttribute write SetAttribute;
+    property href : DOMString index athref read GetAttribute write SetAttribute;
+    property hreflang : DOMString index athreflang read GetAttribute write SetAttribute;
+    property name : DOMString index atname read GetAttribute write SetAttribute;
+    property onblur : DOMString index atonblur read GetAttribute write SetAttribute;
+    property onfocus : DOMString index atonfocus read GetAttribute write SetAttribute;
+    property rel : DOMString index atrel read GetAttribute write SetAttribute;
+    property rev : DOMString index atrev read GetAttribute write SetAttribute;
+    property shape : THTMLshape read Getshape write Setshape;
+    property tabindex : DOMString index attabindex read GetAttribute write SetAttribute;
+    property thetype : DOMString index attype read GetAttribute write SetAttribute;
+  end;
+
+  THTML_abbr = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_acronym = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_address = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_applet = class (THTMLCoreattrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property alt : DOMString index atalt read GetAttribute write SetAttribute;
+    property archive : DOMString index atarchive read GetAttribute write SetAttribute;
+    property codebase : DOMString index atcodebase read GetAttribute write SetAttribute;
+    property height : DOMString index atheight read GetAttribute write SetAttribute;
+    property name : DOMString index atname read GetAttribute write SetAttribute;
+    property width : DOMString index atwidth read GetAttribute write SetAttribute;
+  end;
+
+  THTML_area = class (THTMLAttrsElement)
+  private
+    function Getnohref: boolean;
+    procedure Setnohref(const AValue: boolean);
+    function Getshape: THTMLshape;
+    procedure Setshape(const AValue: THTMLshape);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property accesskey : DOMString index ataccesskey read GetAttribute write SetAttribute;
+    property alt : DOMString index atalt read GetAttribute write SetAttribute;
+    property coords : DOMString index atcoords read GetAttribute write SetAttribute;
+    property href : DOMString index athref read GetAttribute write SetAttribute;
+    property nohref : boolean read Getnohref write Setnohref;
+    property onblur : DOMString index atonblur read GetAttribute write SetAttribute;
+    property onfocus : DOMString index atonfocus read GetAttribute write SetAttribute;
+    property shape : THTMLshape read Getshape write Setshape;
+    property tabindex : DOMString index attabindex read GetAttribute write SetAttribute;
+  end;
+
+  THTML_b = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_base = class (THTMLCustomElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property href : DOMString index athref read GetAttribute write SetAttribute;
+  end;
+
+  THTML_basefont = class (THTMLIDElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_bdo = class (THTMLCores18nElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_big = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_blockquote = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property cite : DOMString index atcite read GetAttribute write SetAttribute;
+  end;
+
+  THTML_body = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property onload : DOMString index atonload read GetAttribute write SetAttribute;
+    property onunload : DOMString index atonunload read GetAttribute write SetAttribute;
+  end;
+
+  THTML_br = class (THTMLCoreattrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_button = class (THTMLAttrsElement)
+  private
+    function Getdisabled: boolean;
+    procedure Setdisabled(const AValue: boolean);
+    function Gettype: THTMLbuttontype;
+    procedure Settype(const AValue: THTMLbuttontype);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property accesskey : DOMString index ataccesskey read GetAttribute write SetAttribute;
+    property disabled : boolean read Getdisabled write Setdisabled;
+    property name : DOMString index atname read GetAttribute write SetAttribute;
+    property onblur : DOMString index atonblur read GetAttribute write SetAttribute;
+    property onfocus : DOMString index atonfocus read GetAttribute write SetAttribute;
+    property tabindex : DOMString index attabindex read GetAttribute write SetAttribute;
+    property thetype : THTMLbuttontype read Gettype write Settype;
+    property value : DOMString index atvalue read GetAttribute write SetAttribute;
+  end;
+
+  THTML_caption = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_center = class (THTMLCustomElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_cite = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_code = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_col = class (THTMLAttrsElement)
+  private
+    function Getalign: THTMLalign;
+    procedure Setalign(const AValue: THTMLalign);
+    function Getvalign: THTMLvalign;
+    procedure Setvalign(const AValue: THTMLvalign);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property align : THTMLalign read Getalign write Setalign;
+    property char : DOMString index atchar read GetAttribute write SetAttribute;
+    property charoff : DOMString index atcharoff read GetAttribute write SetAttribute;
+    property span : DOMString index atspan read GetAttribute write SetAttribute;
+    property valign : THTMLvalign read Getvalign write Setvalign;
+    property width : DOMString index atwidth read GetAttribute write SetAttribute;
+  end;
+
+  THTML_colgroup = class (THTMLAttrsElement)
+  private
+    function Getalign: THTMLalign;
+    procedure Setalign(const AValue: THTMLalign);
+    function Getvalign: THTMLvalign;
+    procedure Setvalign(const AValue: THTMLvalign);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property align : THTMLalign read Getalign write Setalign;
+    property char : DOMString index atchar read GetAttribute write SetAttribute;
+    property charoff : DOMString index atcharoff read GetAttribute write SetAttribute;
+    property span : DOMString index atspan read GetAttribute write SetAttribute;
+    property valign : THTMLvalign read Getvalign write Setvalign;
+    property width : DOMString index atwidth read GetAttribute write SetAttribute;
+  end;
+
+  THTML_dd = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_del = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property cite : DOMString index atcite read GetAttribute write SetAttribute;
+    property datetime : DOMString index atdatetime read GetAttribute write SetAttribute;
+  end;
+
+  THTML_dfn = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_dir = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_div = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_dl = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_dt = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_em = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_fieldset = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_font = class (THTMLCores18nElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_form = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property acceptcharset : DOMString index atacceptcharset read GetAttribute write SetAttribute;
+    property action : DOMString index ataction read GetAttribute write SetAttribute;
+    property enctype : DOMString index atenctype read GetAttribute write SetAttribute;
+    property method : DOMString index atmethod read GetAttribute write SetAttribute;
+    property onreset : DOMString index atonreset read GetAttribute write SetAttribute;
+    property onsubmit : DOMString index atonsubmit read GetAttribute write SetAttribute;
+  end;
+
+  THTML_frame = class (THTMLCoreattrsElement)
+  private
+    function Getnoresize: boolean;
+    procedure Setnoresize(const AValue: boolean);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property frameborder : DOMString index atframeborder read GetAttribute write SetAttribute;
+    property longdesc : DOMString index atlongdesc read GetAttribute write SetAttribute;
+    property marginheight : DOMString index atmarginheight read GetAttribute write SetAttribute;
+    property marginwidth : DOMString index atmarginwidth read GetAttribute write SetAttribute;
+    property name : DOMString index atname read GetAttribute write SetAttribute;
+    property noresize : boolean read Getnoresize write Setnoresize;
+    property scrolling : DOMString index atscrolling read GetAttribute write SetAttribute;
+    property src : DOMString index atsrc read GetAttribute write SetAttribute;
+  end;
+
+  THTML_frameset = class (THTMLCoreattrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property cols : DOMString index atcols read GetAttribute write SetAttribute;
+    property onload : DOMString index atonload read GetAttribute write SetAttribute;
+    property onunload : DOMString index atonunload read GetAttribute write SetAttribute;
+    property rows : DOMString index atrows read GetAttribute write SetAttribute;
+  end;
+
+  THTML_h1 = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_h2 = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_h3 = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_h4 = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_h5 = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_h6 = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_head = class (THTMLs18nElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property profile : DOMString index atprofile read GetAttribute write SetAttribute;
+  end;
+
+  THTML_hr = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_html = class (THTMLs18nElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_i = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_iframe = class (THTMLCoreattrsElement)
+  private
+    function Getalign: THTMLalign;
+    procedure Setalign(const AValue: THTMLalign);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property align : THTMLalign read Getalign write Setalign;
+    property frameborder : DOMString index atframeborder read GetAttribute write SetAttribute;
+    property height : DOMString index atheight read GetAttribute write SetAttribute;
+    property longdesc : DOMString index atlongdesc read GetAttribute write SetAttribute;
+    property marginheight : DOMString index atmarginheight read GetAttribute write SetAttribute;
+    property marginwidth : DOMString index atmarginwidth read GetAttribute write SetAttribute;
+    property name : DOMString index atname read GetAttribute write SetAttribute;
+    property scrolling : DOMString index atscrolling read GetAttribute write SetAttribute;
+    property src : DOMString index atsrc read GetAttribute write SetAttribute;
+    property width : DOMString index atwidth read GetAttribute write SetAttribute;
+  end;
+
+  THTML_img = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property alt : DOMString index atalt read GetAttribute write SetAttribute;
+    property height : DOMString index atheight read GetAttribute write SetAttribute;
+    property ismap : DOMString index atismap read GetAttribute write SetAttribute;
+    property longdesc : DOMString index atlongdesc read GetAttribute write SetAttribute;
+    property src : DOMString index atsrc read GetAttribute write SetAttribute;
+    property usemap : DOMString index atusemap read GetAttribute write SetAttribute;
+    property width : DOMString index atwidth read GetAttribute write SetAttribute;
+  end;
+
+  THTML_input = class (THTMLAttrsElement)
+  private
+    function Getchecked: boolean;
+    procedure Setchecked(const AValue: boolean);
+    function Getdisabled: boolean;
+    procedure Setdisabled(const AValue: boolean);
+    function Getreadonly: boolean;
+    procedure Setreadonly(const AValue: boolean);
+    function Gettype: THTMLinputtype;
+    procedure Settype(const AValue: THTMLinputtype);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property accept : DOMString index ataccept read GetAttribute write SetAttribute;
+    property accesskey : DOMString index ataccesskey read GetAttribute write SetAttribute;
+    property alt : DOMString index atalt read GetAttribute write SetAttribute;
+    property checked : boolean read Getchecked write Setchecked;
+    property disabled : boolean read Getdisabled write Setdisabled;
+    property maxlength : DOMString index atmaxlength read GetAttribute write SetAttribute;
+    property name : DOMString index atname read GetAttribute write SetAttribute;
+    property onblur : DOMString index atonblur read GetAttribute write SetAttribute;
+    property onchange : DOMString index atonchange read GetAttribute write SetAttribute;
+    property onfocus : DOMString index atonfocus read GetAttribute write SetAttribute;
+    property onselect : DOMString index atonselect read GetAttribute write SetAttribute;
+    property readonly : boolean read Getreadonly write Setreadonly;
+    property size : DOMString index atsize read GetAttribute write SetAttribute;
+    property src : DOMString index atsrc read GetAttribute write SetAttribute;
+    property tabindex : DOMString index attabindex read GetAttribute write SetAttribute;
+    property thetype : THTMLinputtype read Gettype write Settype;
+    property usemap : DOMString index atusemap read GetAttribute write SetAttribute;
+    property value : DOMString index atvalue read GetAttribute write SetAttribute;
+  end;
+
+  THTML_ins = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property cite : DOMString index atcite read GetAttribute write SetAttribute;
+    property datetime : DOMString index atdatetime read GetAttribute write SetAttribute;
+  end;
+
+  THTML_isindex = class (THTMLCores18nElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_kbd = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_label = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property accesskey : DOMString index ataccesskey read GetAttribute write SetAttribute;
+    property forinput : DOMString index atfor read GetAttribute write SetAttribute;
+    property onblur : DOMString index atonblur read GetAttribute write SetAttribute;
+    property onfocus : DOMString index atonfocus read GetAttribute write SetAttribute;
+  end;
+
+  THTML_legend = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property accesskey : DOMString index ataccesskey read GetAttribute write SetAttribute;
+  end;
+
+  THTML_li = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_link = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property charset : DOMString index atcharset read GetAttribute write SetAttribute;
+    property href : DOMString index athref read GetAttribute write SetAttribute;
+    property hreflang : DOMString index athreflang read GetAttribute write SetAttribute;
+    property media : DOMString index atmedia read GetAttribute write SetAttribute;
+    property rel : DOMString index atrel read GetAttribute write SetAttribute;
+    property rev : DOMString index atrev read GetAttribute write SetAttribute;
+    property thetype : DOMString index attype read GetAttribute write SetAttribute;
+  end;
+
+  THTML_map = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property name : DOMString index atname read GetAttribute write SetAttribute;
+  end;
+
+  THTML_menu = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_meta = class (THTMLs18nElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property content : DOMString index atcontent read GetAttribute write SetAttribute;
+    property httpequiv : DOMString index athttpequiv read GetAttribute write SetAttribute;
+    property name : DOMString index atname read GetAttribute write SetAttribute;
+    property scheme : DOMString index atscheme read GetAttribute write SetAttribute;
+  end;
+
+  THTML_noframes = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_noscript = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_object = class (THTMLAttrsElement)
+  private
+    function Getdeclare: boolean;
+    procedure Setdeclare(const AValue: boolean);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property archive : DOMString index atarchive read GetAttribute write SetAttribute;
+    property classid : DOMString index atclassid read GetAttribute write SetAttribute;
+    property codebase : DOMString index atcodebase read GetAttribute write SetAttribute;
+    property codetype : DOMString index atcodetype read GetAttribute write SetAttribute;
+    property data : DOMString index atdata read GetAttribute write SetAttribute;
+    property declare : boolean read Getdeclare write Setdeclare;
+    property height : DOMString index atheight read GetAttribute write SetAttribute;
+    property name : DOMString index atname read GetAttribute write SetAttribute;
+    property standby : DOMString index atstandby read GetAttribute write SetAttribute;
+    property tabindex : DOMString index attabindex read GetAttribute write SetAttribute;
+    property thetype : DOMString index attype read GetAttribute write SetAttribute;
+    property usemap : DOMString index atusemap read GetAttribute write SetAttribute;
+    property width : DOMString index atwidth read GetAttribute write SetAttribute;
+  end;
+
+  THTML_ol = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_optgroup = class (THTMLAttrsElement)
+  private
+    function Getdisabled: boolean;
+    procedure Setdisabled(const AValue: boolean);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property disabled : boolean read Getdisabled write Setdisabled;
+    property thelabel : DOMString index atlabel read GetAttribute write SetAttribute;
+  end;
+
+  THTML_option = class (THTMLAttrsElement)
+  private
+    function Getdisabled: boolean;
+    procedure Setdisabled(const AValue: boolean);
+    function Getselected: boolean;
+    procedure Setselected(const AValue: boolean);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property disabled : boolean read Getdisabled write Setdisabled;
+    property thelabel : DOMString index atlabel read GetAttribute write SetAttribute;
+    property selected : boolean read Getselected write Setselected;
+    property value : DOMString index atvalue read GetAttribute write SetAttribute;
+  end;
+
+  THTML_p = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_param = class (THTMLIDElement)
+  private
+    function Getvaluetype: THTMLvaluetype;
+    procedure Setvaluetype(const AValue: THTMLvaluetype);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property name : DOMString index atname read GetAttribute write SetAttribute;
+    property thetype : DOMString index attype read GetAttribute write SetAttribute;
+    property value : DOMString index atvalue read GetAttribute write SetAttribute;
+    property valuetype : THTMLvaluetype read Getvaluetype write Setvaluetype;
+  end;
+
+  THTML_pre = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_q = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property cite : DOMString index atcite read GetAttribute write SetAttribute;
+  end;
+
+  THTML_s = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_samp = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_script = class (THTMLCustomElement)
+  private
+    function Getdefer: boolean;
+    procedure Setdefer(const AValue: boolean);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property charset : DOMString index atcharset read GetAttribute write SetAttribute;
+    property defer : boolean read Getdefer write Setdefer;
+    property src : DOMString index atsrc read GetAttribute write SetAttribute;
+    property thetype : DOMString index attype read GetAttribute write SetAttribute;
+  end;
+
+  THTML_select = class (THTMLAttrsElement)
+  private
+    function Getdisabled: boolean;
+    procedure Setdisabled(const AValue: boolean);
+    function Getmultiple: boolean;
+    procedure Setmultiple(const AValue: boolean);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property disabled : boolean read Getdisabled write Setdisabled;
+    property multiple : boolean read Getmultiple write Setmultiple;
+    property name : DOMString index atname read GetAttribute write SetAttribute;
+    property onblur : DOMString index atonblur read GetAttribute write SetAttribute;
+    property onchange : DOMString index atonchange read GetAttribute write SetAttribute;
+    property onfocus : DOMString index atonfocus read GetAttribute write SetAttribute;
+    property size : DOMString index atsize read GetAttribute write SetAttribute;
+    property tabindex : DOMString index attabindex read GetAttribute write SetAttribute;
+  end;
+
+  THTML_small = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_span = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_strike = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_strong = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_style = class (THTMLs18nElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property media : DOMString index atmedia read GetAttribute write SetAttribute;
+    property thetype : DOMString index attype read GetAttribute write SetAttribute;
+  end;
+
+  THTML_sub = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_sup = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_table = class (THTMLAttrsElement)
+  private
+    function Getframe: THTMLframe;
+    procedure Setframe(const AValue: THTMLframe);
+    function Getrules: THTMLrules;
+    procedure Setrules(const AValue: THTMLrules);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property border : DOMString index atborder read GetAttribute write SetAttribute;
+    property cellpadding : DOMString index atcellpadding read GetAttribute write SetAttribute;
+    property cellspacing : DOMString index atcellspacing read GetAttribute write SetAttribute;
+    property frame : THTMLframe read Getframe write Setframe;
+    property rules : THTMLrules read Getrules write Setrules;
+    property summary : DOMString index atsummary read GetAttribute write SetAttribute;
+    property width : DOMString index atwidth read GetAttribute write SetAttribute;
+  end;
+
+  THTML_tbody = class (THTMLAttrsElement)
+  private
+    function Getalign: THTMLalign;
+    procedure Setalign(const AValue: THTMLalign);
+    function Getvalign: THTMLvalign;
+    procedure Setvalign(const AValue: THTMLvalign);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property align : THTMLalign read Getalign write Setalign;
+    property char : DOMString index atchar read GetAttribute write SetAttribute;
+    property charoff : DOMString index atcharoff read GetAttribute write SetAttribute;
+    property valign : THTMLvalign read Getvalign write Setvalign;
+  end;
+
+  THTML_td = class (THTMLAttrsElement)
+  private
+    function Getalign: THTMLalign;
+    procedure Setalign(const AValue: THTMLalign);
+    function Getvalign: THTMLvalign;
+    procedure Setvalign(const AValue: THTMLvalign);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property abbr : DOMString index atabbr read GetAttribute write SetAttribute;
+    property align : THTMLalign read Getalign write Setalign;
+    property axis : DOMString index ataxis read GetAttribute write SetAttribute;
+    property char : DOMString index atchar read GetAttribute write SetAttribute;
+    property charoff : DOMString index atcharoff read GetAttribute write SetAttribute;
+    property colspan : DOMString index atcolspan read GetAttribute write SetAttribute;
+    property headers : DOMString index atheaders read GetAttribute write SetAttribute;
+    property rowspan : DOMString index atrowspan read GetAttribute write SetAttribute;
+    property scope : DOMString index atscope read GetAttribute write SetAttribute;
+    property valign : THTMLvalign read Getvalign write Setvalign;
+  end;
+
+  THTML_textarea = class (THTMLAttrsElement)
+  private
+    function Getdisabled: boolean;
+    procedure Setdisabled(const AValue: boolean);
+    function Getreadonly: boolean;
+    procedure Setreadonly(const AValue: boolean);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property accesskey : DOMString index ataccesskey read GetAttribute write SetAttribute;
+    property cols : DOMString index atcols read GetAttribute write SetAttribute;
+    property disabled : boolean read Getdisabled write Setdisabled;
+    property name : DOMString index atname read GetAttribute write SetAttribute;
+    property onblur : DOMString index atonblur read GetAttribute write SetAttribute;
+    property onchange : DOMString index atonchange read GetAttribute write SetAttribute;
+    property onfocus : DOMString index atonfocus read GetAttribute write SetAttribute;
+    property onselect : DOMString index atonselect read GetAttribute write SetAttribute;
+    property readonly : boolean read Getreadonly write Setreadonly;
+    property rows : DOMString index atrows read GetAttribute write SetAttribute;
+    property tabindex : DOMString index attabindex read GetAttribute write SetAttribute;
+  end;
+
+  THTML_tfoot = class (THTMLAttrsElement)
+  private
+    function Getalign: THTMLalign;
+    procedure Setalign(const AValue: THTMLalign);
+    function Getvalign: THTMLvalign;
+    procedure Setvalign(const AValue: THTMLvalign);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property align : THTMLalign read Getalign write Setalign;
+    property char : DOMString index atchar read GetAttribute write SetAttribute;
+    property charoff : DOMString index atcharoff read GetAttribute write SetAttribute;
+    property valign : THTMLvalign read Getvalign write Setvalign;
+  end;
+
+  THTML_th = class (THTMLAttrsElement)
+  private
+    function Getalign: THTMLalign;
+    procedure Setalign(const AValue: THTMLalign);
+    function Getvalign: THTMLvalign;
+    procedure Setvalign(const AValue: THTMLvalign);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property abbr : DOMString index atabbr read GetAttribute write SetAttribute;
+    property align : THTMLalign read Getalign write Setalign;
+    property axis : DOMString index ataxis read GetAttribute write SetAttribute;
+    property char : DOMString index atchar read GetAttribute write SetAttribute;
+    property charoff : DOMString index atcharoff read GetAttribute write SetAttribute;
+    property colspan : DOMString index atcolspan read GetAttribute write SetAttribute;
+    property headers : DOMString index atheaders read GetAttribute write SetAttribute;
+    property rowspan : DOMString index atrowspan read GetAttribute write SetAttribute;
+    property scope : DOMString index atscope read GetAttribute write SetAttribute;
+    property valign : THTMLvalign read Getvalign write Setvalign;
+  end;
+
+  THTML_thead = class (THTMLAttrsElement)
+  private
+    function Getalign: THTMLalign;
+    procedure Setalign(const AValue: THTMLalign);
+    function Getvalign: THTMLvalign;
+    procedure Setvalign(const AValue: THTMLvalign);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property align : THTMLalign read Getalign write Setalign;
+    property char : DOMString index atchar read GetAttribute write SetAttribute;
+    property charoff : DOMString index atcharoff read GetAttribute write SetAttribute;
+    property valign : THTMLvalign read Getvalign write Setvalign;
+  end;
+
+  THTML_title = class (THTMLs18nElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_tr = class (THTMLAttrsElement)
+  private
+    function Getalign: THTMLalign;
+    procedure Setalign(const AValue: THTMLalign);
+    function Getvalign: THTMLvalign;
+    procedure Setvalign(const AValue: THTMLvalign);
+  public
+    constructor create (AOwner: TDOMDocument); override;
+    property align : THTMLalign read Getalign write Setalign;
+    property char : DOMString index atchar read GetAttribute write SetAttribute;
+    property charoff : DOMString index atcharoff read GetAttribute write SetAttribute;
+    property valign : THTMLvalign read Getvalign write Setvalign;
+  end;
+
+  THTML_tt = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_u = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_ul = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+
+  THTML_var = class (THTMLAttrsElement)
+  public
+    constructor create (AOwner: TDOMDocument); override;
+  end;
+

+ 359 - 0
fcl/web/websession.pp

@@ -0,0 +1,359 @@
+unit websession;
+
+{$mode objfpc}{$H+}
+{$define cgidebug}
+interface
+
+uses
+  Classes, SysUtils, fphttp, inifiles, httpdefs;
+  
+Type
+
+  { TSessionHTTPModule }
+
+  TSessionHTTPModule = Class(TCustomHTTPModule)
+  Private
+    FCreateSession : Boolean;
+    FOnNewSession: TNotifyEvent;
+    FOnSessionExpired: TNotifyEvent;
+    FSession: TCustomSession;
+    function GetSession: TCustomSession;
+    procedure SetSession(const AValue: TCustomSession);
+  Protected
+    Procedure CheckSession(ARequest : TRequest);
+    Procedure InitSession(AResponse : TResponse);
+    Procedure UpdateSession(AResponse : TResponse);
+  Public
+    Procedure Notification(AComponent : TComponent;Operation : TOperation); override;
+    Procedure Loaded; Override;
+    Property CreateSession : Boolean Read FCreateSession Write FCreateSession;
+    Property Session : TCustomSession Read GetSession Write SetSession;
+    Property OnNewSession : TNotifyEvent Read FOnNewSession Write FOnNewSession;
+    Property OnSessionExpired : TNotifyEvent Read FOnSessionExpired Write FOnSessionExpired;
+  end;
+  
+  { TIniWebSession }
+
+  TIniWebSession = Class(TCustomSession)
+  Private
+    FSessionStarted : Boolean;
+    FCached: Boolean;
+    FIniFile : TMemInifile;
+    FSessionCookie: String;
+    FSessionDir: String;
+    FTerminated :Boolean;
+    SID : String;
+  Protected
+    Procedure CheckSession;
+    Function GetSessionID : String; override;
+    Function GetSessionVariable(VarName : String) : String; override;
+    procedure SetSessionVariable(VarName : String; const AValue: String); override;
+    Property Cached : Boolean Read FCached Write FCached;
+    property SessionCookie : String Read FSessionCookie Write FSessionCookie;
+    Property SessionDir : String Read FSessionDir Write FSessionDir;
+  Public
+    Destructor Destroy; override;
+    Procedure Terminate; override;
+    Procedure UpdateResponse(AResponse : TResponse); override;
+    Procedure InitSession(ARequest : TRequest; OnNewSession, OnExpired: TNotifyEvent); override;
+    Procedure InitResponse(AResponse : TResponse); override;
+    Procedure RemoveVariable(VariableName : String); override;
+  end;
+
+  TFPWebSession = Class(TIniWebSession)
+  Public
+    Property Cached;
+    property SessionCookie;
+    Property SessionDir;
+  end;
+
+  EWebSessionError = Class(HTTPError);
+  TGetSessionEvent = Procedure(Var ASession : TCustomSession) of object;
+
+
+Var
+  GlobalSessionDir : String;
+  OnGetDefaultSession : TGetSessionEvent;
+
+Function GetDefaultSession : TCustomSession;
+
+implementation
+
+{$ifdef cgidebug}
+uses dbugintf;
+{$endif}
+
+Const
+  // Sections in ini file
+  SSession   = 'Session';
+  SData      = 'Data';
+
+  KeyStart   = 'Start';         // Start time of session
+  KeyLast    = 'Start';         // Last seen time of session
+  KeyTimeOut = 'Timeout';       // Timeout in seconds;
+
+  SFPWebSession = 'FPWebSession'; // Cookie name for session.
+
+resourcestring
+  SErrSessionTerminated = 'No web session active: Session was terminated';
+  SErrNoSession         = 'No web session active: Session was not started';
+
+Function GetDefaultSession : TCustomSession;
+
+Var
+  W : TFPWebSession;
+
+begin
+{$ifdef cgidebug}SendMethodEnter('GetDefaultSession');{$endif}
+  Result:=Nil;
+  If (GlobalSessionDir='') then
+    GlobalSessionDir:=IncludeTrailingPathDelimiter(GetTempDir(True));
+  If Assigned(OnGetDefaultSession) then
+    OnGetDefaultSession(Result);
+  if (Result=Nil) then
+    begin
+    {$ifdef cgidebug}Senddebug('Creating iniwebsession');{$endif}
+    W:=TFPWebSession.Create(Nil);
+    W.SessionDir:=GlobalSessionDir;
+    Result:=W;
+    end;
+{$ifdef cgidebug}SendMethodExit('GetDefaultSession');{$endif}
+end;
+
+{ TIniWebSession }
+
+function TIniWebSession.GetSessionID: String;
+begin
+  If (SID='') then
+    SID:=inherited GetSessionID;
+  Result:=SID;
+end;
+
+Procedure TIniWebSession.CheckSession;
+
+begin
+  If Not Assigned(FInifile) then
+    if FTerminated then
+      Raise EWebSessionError.Create(SErrSessionTerminated)
+    else
+      Raise EWebSessionError.Create(SErrNoSession)
+
+end;
+
+function TIniWebSession.GetSessionVariable(VarName: String): String;
+begin
+  CheckSession;
+  Result:=FIniFile.ReadString(SData,VarName,'');
+end;
+
+procedure TIniWebSession.SetSessionVariable(VarName: String;
+  const AValue: String);
+begin
+  CheckSession;
+  FIniFile.WriteString(SData,VarName,AValue);
+  If Not Cached then
+    TMemIniFile(FIniFile).UpdateFile;
+end;
+
+destructor TIniWebSession.Destroy;
+begin
+  If Cached and Assigned(FIniFile) then
+    TMemIniFile(FIniFile).UpdateFile;
+  FreeAndNil(FIniFile);
+  inherited Destroy;
+end;
+
+procedure TIniWebSession.Terminate;
+begin
+  FTerminated:=True;
+  If Assigned(FIniFile) Then
+    begin
+    DeleteFile(Finifile.FileName);
+    FreeAndNil(FIniFile);
+    end;
+end;
+
+procedure TIniWebSession.UpdateResponse(AResponse: TResponse);
+begin
+  // Do nothing. Init has done the job.
+  If Cached and Assigned(FIniFile) then
+    TMemIniFile(FIniFile).UpdateFile;
+end;
+
+procedure TIniWebSession.InitSession(ARequest: TRequest; OnNewSession,OnExpired: TNotifyEvent);
+
+Var
+  L,D   : TDateTime;
+  T   : Integer;
+  S : String;
+begin
+{$ifdef cgidebug}SendMethodEnter('TIniWebSession.InitSession');{$endif}
+  If (SessionCookie='') then
+    SessionCookie:=SFPWebSession;
+  S:=ARequest.CookieFields.Values[SessionCookie];
+  // have session cookie ?
+  If (S<>'') then
+    begin
+{$ifdef cgidebug}SendDebug('Reading ini file:'+S);{$endif}
+    FiniFile:=TMemIniFile.Create(IncludeTrailingPathDelimiter(SessionDir)+S);
+    L:=Finifile.ReadDateTime(SSession,KeyLast,0);
+{$ifdef cgidebug}
+    If (L=0) then
+    SendDebug('No datetime in inifile');
+{$endif}
+    T:=FIniFile.ReadInteger(SSession,KeyTimeOut,Self.TimeOutMinutes);
+{$ifdef cgidebug}SendDebug('Timeout :'+IntToStr(t));{$endif}
+{$ifdef cgidebug}SendDebug('Last    :'+FormatDateTime('yyyy/mm/dd hh:nn:ss.zzz',L));{$endif}
+    If ((Now-L)>(T/(24*60))) then
+      begin
+{$ifdef cgidebug}SendDebug('Timeout :'+FloatToStr(T/(24*60)));{$endif}
+{$ifdef cgidebug}SendDebug('Timeout :'+FormatDateTime('hh:nn:ss.zzz',(T/(24*60))));{$endif}
+{$ifdef cgidebug}SendDebug('Diff    :'+FormatDateTime('hh:nn:ss.zzz',Now-L));{$endif}
+{$ifdef cgidebug}SendDebug('Ini file session expired: '+S);{$endif}
+      // Expire session.
+      If Assigned(OnExpired) then
+        OnExpired(Self);
+      DeleteFile(FIniFIle.FileName);
+      FreeAndNil(FInifile);
+      S:='';
+      end
+    else
+      SID:=S;
+    end;
+  If (S='') then
+    begin
+    If Assigned(OnNewSession) then
+      OnNewSession(Self);
+    GetSessionID;
+{$ifdef cgidebug}SendDebug('Creating new Ini file : '+SessionID);{$endif}
+    FIniFile:=TMemIniFile.Create(IncludeTrailingPathDelimiter(SessionDir)+SessionID);
+    FIniFile.WriteDateTime(SSession,KeyStart,Now);
+    FIniFile.WriteInteger(SSession,KeyTimeOut,Self.TimeOutMinutes);
+    end;
+  FIniFile.WriteDateTime(SSession,KeyLast,Now);
+  If not FCached then
+    FIniFile.UpdateFile;
+  FSessionStarted:=True;
+{$ifdef cgidebug}SendMethodExit('TIniWebSession.InitSession');{$endif}
+end;
+
+procedure TIniWebSession.InitResponse(AResponse: TResponse);
+
+Var
+  C : TCookie;
+
+begin
+{$ifdef cgidebug}SendMethodEnter('TIniWebSession.InitResponse');{$endif}
+  If FSessionStarted then
+    begin
+{$ifdef cgidebug}SendDebug('Session started');{$endif}
+    C:=AResponse.Cookies.Add;
+    C.Name:=SessionCookie;
+    C.Value:=SID;
+     end
+  else If FTerminated then
+    begin
+{$ifdef cgidebug}SendDebug('Session terminated');{$endif}
+    C:=AResponse.Cookies.Add;
+    C.Name:=SessionCookie;
+    C.Value:='';
+    end;
+{$ifdef cgidebug}SendMethodExit('TIniWebSession.InitResponse');{$endif}
+end;
+
+procedure TIniWebSession.RemoveVariable(VariableName: String);
+begin
+{$ifdef cgidebug}SendMethodEnter('TIniWebSession.RemoveVariable');{$endif}
+  CheckSession;
+  FIniFile.DeleteKey(SData,VariableName);
+  If Not Cached then
+    TMemIniFile(FIniFile).UpdateFile;
+{$ifdef cgidebug}SendMethodExit('TIniWebSession.RemoveVariable');{$endif}
+end;
+
+
+function TSessionHTTPModule.GetSession: TCustomSession;
+begin
+{$ifdef cgidebug}SendMethodEnter('SessionHTTPModule.GetSession');{$endif}
+  If (csDesigning in ComponentState) then
+    begin
+{$ifdef cgidebug}SendDebug('Sending session');{$endif}
+    Result:=FSession
+    end
+  else
+    begin
+    If (FSession=Nil) then
+      begin
+{$ifdef cgidebug}SendDebug('Getting default session');{$endif}
+      FSession:=GetDefaultSession;
+      end;
+    Result:=FSession
+    end;
+{$ifdef cgidebug}SendMethodExit('SessionHTTPModule.GetSession');{$endif}
+end;
+
+procedure TSessionHTTPModule.SetSession(const AValue: TCustomSession);
+
+begin
+  if FSession<>AValue then
+    begin
+    If Assigned(FSession) then
+      FSession.RemoveFreeNotification(Self);
+    FSession:=AValue;
+    If Assigned(FSession) then
+      FSession.FreeNotification(Self);
+    end;
+end;
+
+procedure TSessionHTTPModule.CheckSession(ARequest : TRequest);
+
+Var
+  S : TCustomSession;
+
+begin
+{$ifdef cgidebug}SendMethodEnter('SessionHTTPModule('+Name+').CheckSession');{$endif}
+  If CreateSession and Assigned(FSession) then
+    begin
+    S:=FSession;
+    FSession.InitSession(ARequest,FOnNewSession,FOnSessionExpired);
+    end;
+{$ifdef cgidebug}SendMethodExit('SessionHTTPModule('+Name+').CheckSession');{$endif}
+end;
+
+procedure TSessionHTTPModule.InitSession(AResponse: TResponse);
+begin
+{$ifdef cgidebug}SendMethodEnter('SessionHTTPModule('+Name+').InitSession');{$endif}
+  If CreateSession and Assigned(FSession) then
+    FSession.InitResponse(AResponse);
+{$ifdef cgidebug}SendMethodExit('SessionHTTPModule('+Name+').InitSession');{$endif}
+end;
+
+procedure TSessionHTTPModule.UpdateSession(AResponse: TResponse);
+begin
+  If CreateSession And Assigned(FSession) then
+    FSession.UpdateResponse(AResponse);
+end;
+
+procedure TSessionHTTPModule.Notification(AComponent: TComponent;
+  Operation: TOperation);
+begin
+{$ifdef cgidebug}SendMethodEnter('SessionHTTPModule('+Name+').Notification');{$endif}
+  inherited Notification(AComponent, Operation);
+  If (Operation=opRemove) then
+    if (AComponent=FSession) Then
+      FSession:=Nil;
+{$ifdef cgidebug}SendMethodExit('SessionHTTPModule('+Name+').Notification');{$endif}
+end;
+
+procedure TSessionHTTPModule.Loaded;
+
+begin
+{$ifdef cgidebug}SendMethodEnter('SessionHTTPModule.Loaded');{$endif}
+  inherited Loaded;
+  If CreateSession And (FSession=Nil) then
+    FSession:=GetDefaultSession;
+{$ifdef cgidebug}SendMethodExit('SessionHTTPModule.Loaded');{$endif}
+end;
+
+end.
+

+ 92 - 0
fcl/web/webutil.pp

@@ -0,0 +1,92 @@
+unit webutil;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, httpdefs;
+
+procedure DumpRequest (ARequest : TRequest; Dump : TStrings);
+
+implementation
+
+
+
+procedure DumpRequest (ARequest : TRequest; Dump : TStrings);
+
+  Procedure AddNV(Const N,V : String);
+  
+  begin
+    Dump.Add('<TR><TD>'+N+'</TD><TD>'+V+'</TD></TR>');
+  end;
+
+Var
+  I   : integer;
+  N,V : String;
+begin
+  With ARequest, Dump do
+    begin
+    // All possible headers
+    Add('<H1>All possible request headers:</H1>');
+    Add('<TABLE BORDER="1"><TR><TD>Header</TD><TD>Value</TD></TR>');
+    For I:=1 to NoHTTPFields do
+      begin
+      AddNV(HTTPFieldNames[i],GetFieldByName(HTTPFieldNames[i]));
+      end;
+    Add('</TABLE><P>');
+
+    // Actually sent headers
+    Add('<H1>Actually sent request headers:</H1>');
+    Add('<TABLE BORDER="1"><TR><TD>Header</TD><TD>Value</TD></TR>');
+    For I:=0 to FieldCount-1 do
+      AddNV(FieldNames[I],FieldValues[I]);
+    Add('</TABLE><P>');
+
+    // Actually sent headers, as text
+    Add('<H1>Actually sent request headers as text:</H1>');
+    For I:=0 to FieldCount-1 do
+      Add(Fields[I]+'<BR>');
+      
+    // Additional headers
+    Add('<H1>Additional headers:</H1>');
+    Add('<TABLE BORDER="1"><TR><TD>Header</TD><TD>Value</TD></TR>');
+    AddNV('PathInfo',PathInfo);
+    AddNV('PathTranslated',PathTranslated);
+    AddNV('RemoteAddress',RemoteAddress);
+    AddNV('RemoteHost',RemoteHost);
+    AddNV('ScriptName',ScriptName);
+    AddNV('ServerPort',IntToStr(ServerPort));
+    Add('</TABLE><P>');
+    // Additional headers
+    If (QueryFields.Count>0) then
+      begin
+      Add('<H1>Request variables: ('+IntToStr(QueryFields.Count)+') </H1>');
+      Add('<TABLE BORDER="1"><TR><TD>Name</TD><TD>Value</TD></TR>');
+      For I:=0 to QueryFields.Count-1 do
+        begin
+        QueryFields.GetNameValue(i,N,V);
+        AddNV(N,V);
+        end;
+      Add('</TABLE><P>');
+      end;
+    If (Files.Count>0) then
+      begin
+      Add('<H1>Uploaded files: ('+IntToStr(Files.Count)+') </H1>');
+      Add('<TABLE BORDER="1">');
+      Add('<TR><TD>Name</TD><TD>FileName</TD><TD>Size</TD>');
+      Add('<TD>Temp FileName</TD><TD>Disposition</TD><TD>Content-Type</TD></TR>');
+      For I:=0 to Files.Count-1 do
+        With Files[i] do
+          begin
+          Add('<TR><TD>'+FieldName+'</TD><TD>'+FileName+'</TD>');
+          Add('<TD>'+IntToStr(Size)+'</TD><TD>'+LocalFileName+'</TD>');
+          Add('<TD>'+Disposition+'</TD><TD>'+ContentType+'</TD></TR>');
+          end;
+      Add('</TABLE><P>');
+      end;
+    end;
+end;
+
+end.
+

+ 4632 - 0
fcl/web/wtagsimpl.inc

@@ -0,0 +1,4632 @@
+{ tag "a", alias "anchor" }
+
+function THTMLWriter.taga (s : string) : THTML_a;
+begin
+  result := THTML_a (CreateElement (THTML_a, s));
+end;
+
+function THTMLWriter.taga (sub : THTMLCustomElement) : THTML_a;
+begin
+  result := THTML_a (CreateElement (THTML_a, sub));
+end;
+
+function THTMLWriter.taga (subs : Array of THTMLCustomElement) : THTML_a;
+begin
+  result := THTML_a (CreateElement (THTML_a, subs));
+end;
+
+function THTMLWriter.taga (subs : TDOMNodelist) : THTML_a;
+begin
+  result := THTML_a (CreateElement (THTML_a, subs));
+end;
+
+function THTMLWriter.anchor (s : string) : THTML_a;
+begin
+  result := taga (s);
+end;
+
+function THTMLWriter.anchor (sub : THTMLCustomElement) : THTML_a;
+begin
+  result := taga (sub);
+end;
+
+function THTMLWriter.anchor (subs : Array of THTMLCustomElement) : THTML_a;
+begin
+  result := taga (subs);
+end;
+
+function THTMLWriter.anchor (subs : TDOMNodelist) : THTML_a;
+begin
+  result := taga (subs);
+end;
+
+function THTMLWriter.Starta : THTML_a;
+begin
+  result := THTML_a (StartElement (THTML_a));
+end;
+
+function THTMLWriter.Enda : THTML_a;
+begin
+  result := THTML_a (EndElement (THTML_a));
+end;
+
+function THTMLWriter.Startanchor : THTML_a;
+begin
+  result := Starta;
+end;
+
+function THTMLWriter.Endanchor : THTML_a;
+begin
+  result := Enda;
+end;
+
+{ tag "abbr", alias "abbr" }
+
+function THTMLWriter.tagabbr (s : string) : THTML_abbr;
+begin
+  result := THTML_abbr (CreateElement (THTML_abbr, s));
+end;
+
+function THTMLWriter.tagabbr (sub : THTMLCustomElement) : THTML_abbr;
+begin
+  result := THTML_abbr (CreateElement (THTML_abbr, sub));
+end;
+
+function THTMLWriter.tagabbr (subs : Array of THTMLCustomElement) : THTML_abbr;
+begin
+  result := THTML_abbr (CreateElement (THTML_abbr, subs));
+end;
+
+function THTMLWriter.tagabbr (subs : TDOMNodelist) : THTML_abbr;
+begin
+  result := THTML_abbr (CreateElement (THTML_abbr, subs));
+end;
+
+function THTMLWriter.abbr (s : string) : THTML_abbr;
+begin
+  result := tagabbr (s);
+end;
+
+function THTMLWriter.abbr (sub : THTMLCustomElement) : THTML_abbr;
+begin
+  result := tagabbr (sub);
+end;
+
+function THTMLWriter.abbr (subs : Array of THTMLCustomElement) : THTML_abbr;
+begin
+  result := tagabbr (subs);
+end;
+
+function THTMLWriter.abbr (subs : TDOMNodelist) : THTML_abbr;
+begin
+  result := tagabbr (subs);
+end;
+
+function THTMLWriter.Startabbr : THTML_abbr;
+begin
+  result := THTML_abbr (StartElement (THTML_abbr));
+end;
+
+function THTMLWriter.Endabbr : THTML_abbr;
+begin
+  result := THTML_abbr (EndElement (THTML_abbr));
+end;
+
+{ tag "acronym", alias "acronym" }
+
+function THTMLWriter.tagacronym (s : string) : THTML_acronym;
+begin
+  result := THTML_acronym (CreateElement (THTML_acronym, s));
+end;
+
+function THTMLWriter.tagacronym (sub : THTMLCustomElement) : THTML_acronym;
+begin
+  result := THTML_acronym (CreateElement (THTML_acronym, sub));
+end;
+
+function THTMLWriter.tagacronym (subs : Array of THTMLCustomElement) : THTML_acronym;
+begin
+  result := THTML_acronym (CreateElement (THTML_acronym, subs));
+end;
+
+function THTMLWriter.tagacronym (subs : TDOMNodelist) : THTML_acronym;
+begin
+  result := THTML_acronym (CreateElement (THTML_acronym, subs));
+end;
+
+function THTMLWriter.acronym (s : string) : THTML_acronym;
+begin
+  result := tagacronym (s);
+end;
+
+function THTMLWriter.acronym (sub : THTMLCustomElement) : THTML_acronym;
+begin
+  result := tagacronym (sub);
+end;
+
+function THTMLWriter.acronym (subs : Array of THTMLCustomElement) : THTML_acronym;
+begin
+  result := tagacronym (subs);
+end;
+
+function THTMLWriter.acronym (subs : TDOMNodelist) : THTML_acronym;
+begin
+  result := tagacronym (subs);
+end;
+
+function THTMLWriter.Startacronym : THTML_acronym;
+begin
+  result := THTML_acronym (StartElement (THTML_acronym));
+end;
+
+function THTMLWriter.Endacronym : THTML_acronym;
+begin
+  result := THTML_acronym (EndElement (THTML_acronym));
+end;
+
+{ tag "address", alias "address" }
+
+function THTMLWriter.tagaddress (s : string) : THTML_address;
+begin
+  result := THTML_address (CreateElement (THTML_address, s));
+end;
+
+function THTMLWriter.tagaddress (sub : THTMLCustomElement) : THTML_address;
+begin
+  result := THTML_address (CreateElement (THTML_address, sub));
+end;
+
+function THTMLWriter.tagaddress (subs : Array of THTMLCustomElement) : THTML_address;
+begin
+  result := THTML_address (CreateElement (THTML_address, subs));
+end;
+
+function THTMLWriter.tagaddress (subs : TDOMNodelist) : THTML_address;
+begin
+  result := THTML_address (CreateElement (THTML_address, subs));
+end;
+
+function THTMLWriter.address (s : string) : THTML_address;
+begin
+  result := tagaddress (s);
+end;
+
+function THTMLWriter.address (sub : THTMLCustomElement) : THTML_address;
+begin
+  result := tagaddress (sub);
+end;
+
+function THTMLWriter.address (subs : Array of THTMLCustomElement) : THTML_address;
+begin
+  result := tagaddress (subs);
+end;
+
+function THTMLWriter.address (subs : TDOMNodelist) : THTML_address;
+begin
+  result := tagaddress (subs);
+end;
+
+function THTMLWriter.Startaddress : THTML_address;
+begin
+  result := THTML_address (StartElement (THTML_address));
+end;
+
+function THTMLWriter.Endaddress : THTML_address;
+begin
+  result := THTML_address (EndElement (THTML_address));
+end;
+
+{ tag "applet", alias "applet" }
+
+function THTMLWriter.tagapplet (s : string) : THTML_applet;
+begin
+  result := THTML_applet (CreateElement (THTML_applet, s));
+end;
+
+function THTMLWriter.tagapplet (sub : THTMLCustomElement) : THTML_applet;
+begin
+  result := THTML_applet (CreateElement (THTML_applet, sub));
+end;
+
+function THTMLWriter.tagapplet (subs : Array of THTMLCustomElement) : THTML_applet;
+begin
+  result := THTML_applet (CreateElement (THTML_applet, subs));
+end;
+
+function THTMLWriter.tagapplet (subs : TDOMNodelist) : THTML_applet;
+begin
+  result := THTML_applet (CreateElement (THTML_applet, subs));
+end;
+
+function THTMLWriter.applet (s : string) : THTML_applet;
+begin
+  result := tagapplet (s);
+end;
+
+function THTMLWriter.applet (sub : THTMLCustomElement) : THTML_applet;
+begin
+  result := tagapplet (sub);
+end;
+
+function THTMLWriter.applet (subs : Array of THTMLCustomElement) : THTML_applet;
+begin
+  result := tagapplet (subs);
+end;
+
+function THTMLWriter.applet (subs : TDOMNodelist) : THTML_applet;
+begin
+  result := tagapplet (subs);
+end;
+
+function THTMLWriter.Startapplet : THTML_applet;
+begin
+  result := THTML_applet (StartElement (THTML_applet));
+end;
+
+function THTMLWriter.Endapplet : THTML_applet;
+begin
+  result := THTML_applet (EndElement (THTML_applet));
+end;
+
+{ tag "area", alias "area" }
+
+function THTMLWriter.tagarea : THTML_area;
+begin
+  result := THTML_area (AddElement (THTML_area));
+end;
+
+function THTMLWriter.area : THTML_area;
+begin
+  result := tagarea;
+end;
+
+{ tag "b", alias "bold" }
+
+function THTMLWriter.tagb (s : string) : THTML_b;
+begin
+  result := THTML_b (CreateElement (THTML_b, s));
+end;
+
+function THTMLWriter.tagb (sub : THTMLCustomElement) : THTML_b;
+begin
+  result := THTML_b (CreateElement (THTML_b, sub));
+end;
+
+function THTMLWriter.tagb (subs : Array of THTMLCustomElement) : THTML_b;
+begin
+  result := THTML_b (CreateElement (THTML_b, subs));
+end;
+
+function THTMLWriter.tagb (subs : TDOMNodelist) : THTML_b;
+begin
+  result := THTML_b (CreateElement (THTML_b, subs));
+end;
+
+function THTMLWriter.bold (s : string) : THTML_b;
+begin
+  result := tagb (s);
+end;
+
+function THTMLWriter.bold (sub : THTMLCustomElement) : THTML_b;
+begin
+  result := tagb (sub);
+end;
+
+function THTMLWriter.bold (subs : Array of THTMLCustomElement) : THTML_b;
+begin
+  result := tagb (subs);
+end;
+
+function THTMLWriter.bold (subs : TDOMNodelist) : THTML_b;
+begin
+  result := tagb (subs);
+end;
+
+function THTMLWriter.Startb : THTML_b;
+begin
+  result := THTML_b (StartElement (THTML_b));
+end;
+
+function THTMLWriter.Endb : THTML_b;
+begin
+  result := THTML_b (EndElement (THTML_b));
+end;
+
+function THTMLWriter.Startbold : THTML_b;
+begin
+  result := Startb;
+end;
+
+function THTMLWriter.Endbold : THTML_b;
+begin
+  result := Endb;
+end;
+
+{ tag "base", alias "base" }
+
+function THTMLWriter.tagbase : THTML_base;
+begin
+  result := THTML_base (AddElement (THTML_base));
+end;
+
+function THTMLWriter.base : THTML_base;
+begin
+  result := tagbase;
+end;
+
+{ tag "basefont", alias "basefont" }
+
+function THTMLWriter.tagbasefont : THTML_basefont;
+begin
+  result := THTML_basefont (AddElement (THTML_basefont));
+end;
+
+function THTMLWriter.basefont : THTML_basefont;
+begin
+  result := tagbasefont;
+end;
+
+{ tag "bdo", alias "bdo" }
+
+function THTMLWriter.tagbdo (s : string) : THTML_bdo;
+begin
+  result := THTML_bdo (CreateElement (THTML_bdo, s));
+end;
+
+function THTMLWriter.tagbdo (sub : THTMLCustomElement) : THTML_bdo;
+begin
+  result := THTML_bdo (CreateElement (THTML_bdo, sub));
+end;
+
+function THTMLWriter.tagbdo (subs : Array of THTMLCustomElement) : THTML_bdo;
+begin
+  result := THTML_bdo (CreateElement (THTML_bdo, subs));
+end;
+
+function THTMLWriter.tagbdo (subs : TDOMNodelist) : THTML_bdo;
+begin
+  result := THTML_bdo (CreateElement (THTML_bdo, subs));
+end;
+
+function THTMLWriter.bdo (s : string) : THTML_bdo;
+begin
+  result := tagbdo (s);
+end;
+
+function THTMLWriter.bdo (sub : THTMLCustomElement) : THTML_bdo;
+begin
+  result := tagbdo (sub);
+end;
+
+function THTMLWriter.bdo (subs : Array of THTMLCustomElement) : THTML_bdo;
+begin
+  result := tagbdo (subs);
+end;
+
+function THTMLWriter.bdo (subs : TDOMNodelist) : THTML_bdo;
+begin
+  result := tagbdo (subs);
+end;
+
+function THTMLWriter.Startbdo : THTML_bdo;
+begin
+  result := THTML_bdo (StartElement (THTML_bdo));
+end;
+
+function THTMLWriter.Endbdo : THTML_bdo;
+begin
+  result := THTML_bdo (EndElement (THTML_bdo));
+end;
+
+{ tag "big", alias "big" }
+
+function THTMLWriter.tagbig (s : string) : THTML_big;
+begin
+  result := THTML_big (CreateElement (THTML_big, s));
+end;
+
+function THTMLWriter.tagbig (sub : THTMLCustomElement) : THTML_big;
+begin
+  result := THTML_big (CreateElement (THTML_big, sub));
+end;
+
+function THTMLWriter.tagbig (subs : Array of THTMLCustomElement) : THTML_big;
+begin
+  result := THTML_big (CreateElement (THTML_big, subs));
+end;
+
+function THTMLWriter.tagbig (subs : TDOMNodelist) : THTML_big;
+begin
+  result := THTML_big (CreateElement (THTML_big, subs));
+end;
+
+function THTMLWriter.big (s : string) : THTML_big;
+begin
+  result := tagbig (s);
+end;
+
+function THTMLWriter.big (sub : THTMLCustomElement) : THTML_big;
+begin
+  result := tagbig (sub);
+end;
+
+function THTMLWriter.big (subs : Array of THTMLCustomElement) : THTML_big;
+begin
+  result := tagbig (subs);
+end;
+
+function THTMLWriter.big (subs : TDOMNodelist) : THTML_big;
+begin
+  result := tagbig (subs);
+end;
+
+function THTMLWriter.Startbig : THTML_big;
+begin
+  result := THTML_big (StartElement (THTML_big));
+end;
+
+function THTMLWriter.Endbig : THTML_big;
+begin
+  result := THTML_big (EndElement (THTML_big));
+end;
+
+{ tag "blockquote", alias "blockquote" }
+
+function THTMLWriter.tagblockquote (s : string) : THTML_blockquote;
+begin
+  result := THTML_blockquote (CreateElement (THTML_blockquote, s));
+end;
+
+function THTMLWriter.tagblockquote (sub : THTMLCustomElement) : THTML_blockquote;
+begin
+  result := THTML_blockquote (CreateElement (THTML_blockquote, sub));
+end;
+
+function THTMLWriter.tagblockquote (subs : Array of THTMLCustomElement) : THTML_blockquote;
+begin
+  result := THTML_blockquote (CreateElement (THTML_blockquote, subs));
+end;
+
+function THTMLWriter.tagblockquote (subs : TDOMNodelist) : THTML_blockquote;
+begin
+  result := THTML_blockquote (CreateElement (THTML_blockquote, subs));
+end;
+
+function THTMLWriter.blockquote (s : string) : THTML_blockquote;
+begin
+  result := tagblockquote (s);
+end;
+
+function THTMLWriter.blockquote (sub : THTMLCustomElement) : THTML_blockquote;
+begin
+  result := tagblockquote (sub);
+end;
+
+function THTMLWriter.blockquote (subs : Array of THTMLCustomElement) : THTML_blockquote;
+begin
+  result := tagblockquote (subs);
+end;
+
+function THTMLWriter.blockquote (subs : TDOMNodelist) : THTML_blockquote;
+begin
+  result := tagblockquote (subs);
+end;
+
+function THTMLWriter.Startblockquote : THTML_blockquote;
+begin
+  result := THTML_blockquote (StartElement (THTML_blockquote));
+end;
+
+function THTMLWriter.Endblockquote : THTML_blockquote;
+begin
+  result := THTML_blockquote (EndElement (THTML_blockquote));
+end;
+
+{ tag "body", alias "body" }
+
+function THTMLWriter.tagbody (s : string) : THTML_body;
+begin
+  result := THTML_body (CreateElement (THTML_body, s));
+end;
+
+function THTMLWriter.tagbody (sub : THTMLCustomElement) : THTML_body;
+begin
+  result := THTML_body (CreateElement (THTML_body, sub));
+end;
+
+function THTMLWriter.tagbody (subs : Array of THTMLCustomElement) : THTML_body;
+begin
+  result := THTML_body (CreateElement (THTML_body, subs));
+end;
+
+function THTMLWriter.tagbody (subs : TDOMNodelist) : THTML_body;
+begin
+  result := THTML_body (CreateElement (THTML_body, subs));
+end;
+
+function THTMLWriter.body (s : string) : THTML_body;
+begin
+  result := tagbody (s);
+end;
+
+function THTMLWriter.body (sub : THTMLCustomElement) : THTML_body;
+begin
+  result := tagbody (sub);
+end;
+
+function THTMLWriter.body (subs : Array of THTMLCustomElement) : THTML_body;
+begin
+  result := tagbody (subs);
+end;
+
+function THTMLWriter.body (subs : TDOMNodelist) : THTML_body;
+begin
+  result := tagbody (subs);
+end;
+
+function THTMLWriter.Startbody : THTML_body;
+begin
+  result := THTML_body (StartElement (THTML_body));
+end;
+
+function THTMLWriter.Endbody : THTML_body;
+begin
+  result := THTML_body (EndElement (THTML_body));
+end;
+
+{ tag "br", alias "linebreak" }
+
+function THTMLWriter.tagbr : THTML_br;
+begin
+  result := THTML_br (AddElement (THTML_br));
+end;
+
+function THTMLWriter.linebreak : THTML_br;
+begin
+  result := tagbr;
+end;
+
+{ tag "button", alias "button" }
+
+function THTMLWriter.tagbutton (s : string) : THTML_button;
+begin
+  result := THTML_button (CreateElement (THTML_button, s));
+end;
+
+function THTMLWriter.tagbutton (sub : THTMLCustomElement) : THTML_button;
+begin
+  result := THTML_button (CreateElement (THTML_button, sub));
+end;
+
+function THTMLWriter.tagbutton (subs : Array of THTMLCustomElement) : THTML_button;
+begin
+  result := THTML_button (CreateElement (THTML_button, subs));
+end;
+
+function THTMLWriter.tagbutton (subs : TDOMNodelist) : THTML_button;
+begin
+  result := THTML_button (CreateElement (THTML_button, subs));
+end;
+
+function THTMLWriter.button (s : string) : THTML_button;
+begin
+  result := tagbutton (s);
+end;
+
+function THTMLWriter.button (sub : THTMLCustomElement) : THTML_button;
+begin
+  result := tagbutton (sub);
+end;
+
+function THTMLWriter.button (subs : Array of THTMLCustomElement) : THTML_button;
+begin
+  result := tagbutton (subs);
+end;
+
+function THTMLWriter.button (subs : TDOMNodelist) : THTML_button;
+begin
+  result := tagbutton (subs);
+end;
+
+function THTMLWriter.Startbutton : THTML_button;
+begin
+  result := THTML_button (StartElement (THTML_button));
+end;
+
+function THTMLWriter.Endbutton : THTML_button;
+begin
+  result := THTML_button (EndElement (THTML_button));
+end;
+
+{ tag "caption", alias "caption" }
+
+function THTMLWriter.tagcaption (s : string) : THTML_caption;
+begin
+  result := THTML_caption (CreateElement (THTML_caption, s));
+end;
+
+function THTMLWriter.tagcaption (sub : THTMLCustomElement) : THTML_caption;
+begin
+  result := THTML_caption (CreateElement (THTML_caption, sub));
+end;
+
+function THTMLWriter.tagcaption (subs : Array of THTMLCustomElement) : THTML_caption;
+begin
+  result := THTML_caption (CreateElement (THTML_caption, subs));
+end;
+
+function THTMLWriter.tagcaption (subs : TDOMNodelist) : THTML_caption;
+begin
+  result := THTML_caption (CreateElement (THTML_caption, subs));
+end;
+
+function THTMLWriter.caption (s : string) : THTML_caption;
+begin
+  result := tagcaption (s);
+end;
+
+function THTMLWriter.caption (sub : THTMLCustomElement) : THTML_caption;
+begin
+  result := tagcaption (sub);
+end;
+
+function THTMLWriter.caption (subs : Array of THTMLCustomElement) : THTML_caption;
+begin
+  result := tagcaption (subs);
+end;
+
+function THTMLWriter.caption (subs : TDOMNodelist) : THTML_caption;
+begin
+  result := tagcaption (subs);
+end;
+
+function THTMLWriter.Startcaption : THTML_caption;
+begin
+  result := THTML_caption (StartElement (THTML_caption));
+end;
+
+function THTMLWriter.Endcaption : THTML_caption;
+begin
+  result := THTML_caption (EndElement (THTML_caption));
+end;
+
+{ tag "center", alias "center" }
+
+function THTMLWriter.tagcenter (s : string) : THTML_center;
+begin
+  result := THTML_center (CreateElement (THTML_center, s));
+end;
+
+function THTMLWriter.tagcenter (sub : THTMLCustomElement) : THTML_center;
+begin
+  result := THTML_center (CreateElement (THTML_center, sub));
+end;
+
+function THTMLWriter.tagcenter (subs : Array of THTMLCustomElement) : THTML_center;
+begin
+  result := THTML_center (CreateElement (THTML_center, subs));
+end;
+
+function THTMLWriter.tagcenter (subs : TDOMNodelist) : THTML_center;
+begin
+  result := THTML_center (CreateElement (THTML_center, subs));
+end;
+
+function THTMLWriter.center (s : string) : THTML_center;
+begin
+  result := tagcenter (s);
+end;
+
+function THTMLWriter.center (sub : THTMLCustomElement) : THTML_center;
+begin
+  result := tagcenter (sub);
+end;
+
+function THTMLWriter.center (subs : Array of THTMLCustomElement) : THTML_center;
+begin
+  result := tagcenter (subs);
+end;
+
+function THTMLWriter.center (subs : TDOMNodelist) : THTML_center;
+begin
+  result := tagcenter (subs);
+end;
+
+function THTMLWriter.Startcenter : THTML_center;
+begin
+  result := THTML_center (StartElement (THTML_center));
+end;
+
+function THTMLWriter.Endcenter : THTML_center;
+begin
+  result := THTML_center (EndElement (THTML_center));
+end;
+
+{ tag "cite", alias "cite" }
+
+function THTMLWriter.tagcite (s : string) : THTML_cite;
+begin
+  result := THTML_cite (CreateElement (THTML_cite, s));
+end;
+
+function THTMLWriter.tagcite (sub : THTMLCustomElement) : THTML_cite;
+begin
+  result := THTML_cite (CreateElement (THTML_cite, sub));
+end;
+
+function THTMLWriter.tagcite (subs : Array of THTMLCustomElement) : THTML_cite;
+begin
+  result := THTML_cite (CreateElement (THTML_cite, subs));
+end;
+
+function THTMLWriter.tagcite (subs : TDOMNodelist) : THTML_cite;
+begin
+  result := THTML_cite (CreateElement (THTML_cite, subs));
+end;
+
+function THTMLWriter.cite (s : string) : THTML_cite;
+begin
+  result := tagcite (s);
+end;
+
+function THTMLWriter.cite (sub : THTMLCustomElement) : THTML_cite;
+begin
+  result := tagcite (sub);
+end;
+
+function THTMLWriter.cite (subs : Array of THTMLCustomElement) : THTML_cite;
+begin
+  result := tagcite (subs);
+end;
+
+function THTMLWriter.cite (subs : TDOMNodelist) : THTML_cite;
+begin
+  result := tagcite (subs);
+end;
+
+function THTMLWriter.Startcite : THTML_cite;
+begin
+  result := THTML_cite (StartElement (THTML_cite));
+end;
+
+function THTMLWriter.Endcite : THTML_cite;
+begin
+  result := THTML_cite (EndElement (THTML_cite));
+end;
+
+{ tag "code", alias "code" }
+
+function THTMLWriter.tagcode (s : string) : THTML_code;
+begin
+  result := THTML_code (CreateElement (THTML_code, s));
+end;
+
+function THTMLWriter.tagcode (sub : THTMLCustomElement) : THTML_code;
+begin
+  result := THTML_code (CreateElement (THTML_code, sub));
+end;
+
+function THTMLWriter.tagcode (subs : Array of THTMLCustomElement) : THTML_code;
+begin
+  result := THTML_code (CreateElement (THTML_code, subs));
+end;
+
+function THTMLWriter.tagcode (subs : TDOMNodelist) : THTML_code;
+begin
+  result := THTML_code (CreateElement (THTML_code, subs));
+end;
+
+function THTMLWriter.code (s : string) : THTML_code;
+begin
+  result := tagcode (s);
+end;
+
+function THTMLWriter.code (sub : THTMLCustomElement) : THTML_code;
+begin
+  result := tagcode (sub);
+end;
+
+function THTMLWriter.code (subs : Array of THTMLCustomElement) : THTML_code;
+begin
+  result := tagcode (subs);
+end;
+
+function THTMLWriter.code (subs : TDOMNodelist) : THTML_code;
+begin
+  result := tagcode (subs);
+end;
+
+function THTMLWriter.Startcode : THTML_code;
+begin
+  result := THTML_code (StartElement (THTML_code));
+end;
+
+function THTMLWriter.Endcode : THTML_code;
+begin
+  result := THTML_code (EndElement (THTML_code));
+end;
+
+{ tag "col", alias "column" }
+
+function THTMLWriter.tagcol : THTML_col;
+begin
+  result := THTML_col (AddElement (THTML_col));
+end;
+
+function THTMLWriter.column : THTML_col;
+begin
+  result := tagcol;
+end;
+
+{ tag "colgroup", alias "colgroup" }
+
+function THTMLWriter.tagcolgroup (s : string) : THTML_colgroup;
+begin
+  result := THTML_colgroup (CreateElement (THTML_colgroup, s));
+end;
+
+function THTMLWriter.tagcolgroup (sub : THTMLCustomElement) : THTML_colgroup;
+begin
+  result := THTML_colgroup (CreateElement (THTML_colgroup, sub));
+end;
+
+function THTMLWriter.tagcolgroup (subs : Array of THTMLCustomElement) : THTML_colgroup;
+begin
+  result := THTML_colgroup (CreateElement (THTML_colgroup, subs));
+end;
+
+function THTMLWriter.tagcolgroup (subs : TDOMNodelist) : THTML_colgroup;
+begin
+  result := THTML_colgroup (CreateElement (THTML_colgroup, subs));
+end;
+
+function THTMLWriter.colgroup (s : string) : THTML_colgroup;
+begin
+  result := tagcolgroup (s);
+end;
+
+function THTMLWriter.colgroup (sub : THTMLCustomElement) : THTML_colgroup;
+begin
+  result := tagcolgroup (sub);
+end;
+
+function THTMLWriter.colgroup (subs : Array of THTMLCustomElement) : THTML_colgroup;
+begin
+  result := tagcolgroup (subs);
+end;
+
+function THTMLWriter.colgroup (subs : TDOMNodelist) : THTML_colgroup;
+begin
+  result := tagcolgroup (subs);
+end;
+
+function THTMLWriter.Startcolgroup : THTML_colgroup;
+begin
+  result := THTML_colgroup (StartElement (THTML_colgroup));
+end;
+
+function THTMLWriter.Endcolgroup : THTML_colgroup;
+begin
+  result := THTML_colgroup (EndElement (THTML_colgroup));
+end;
+
+{ tag "dd", alias "defdescr" }
+
+function THTMLWriter.tagdd (s : string) : THTML_dd;
+begin
+  result := THTML_dd (CreateElement (THTML_dd, s));
+end;
+
+function THTMLWriter.tagdd (sub : THTMLCustomElement) : THTML_dd;
+begin
+  result := THTML_dd (CreateElement (THTML_dd, sub));
+end;
+
+function THTMLWriter.tagdd (subs : Array of THTMLCustomElement) : THTML_dd;
+begin
+  result := THTML_dd (CreateElement (THTML_dd, subs));
+end;
+
+function THTMLWriter.tagdd (subs : TDOMNodelist) : THTML_dd;
+begin
+  result := THTML_dd (CreateElement (THTML_dd, subs));
+end;
+
+function THTMLWriter.defdescr (s : string) : THTML_dd;
+begin
+  result := tagdd (s);
+end;
+
+function THTMLWriter.defdescr (sub : THTMLCustomElement) : THTML_dd;
+begin
+  result := tagdd (sub);
+end;
+
+function THTMLWriter.defdescr (subs : Array of THTMLCustomElement) : THTML_dd;
+begin
+  result := tagdd (subs);
+end;
+
+function THTMLWriter.defdescr (subs : TDOMNodelist) : THTML_dd;
+begin
+  result := tagdd (subs);
+end;
+
+function THTMLWriter.Startdd : THTML_dd;
+begin
+  result := THTML_dd (StartElement (THTML_dd));
+end;
+
+function THTMLWriter.Enddd : THTML_dd;
+begin
+  result := THTML_dd (EndElement (THTML_dd));
+end;
+
+function THTMLWriter.Startdefdescr : THTML_dd;
+begin
+  result := Startdd;
+end;
+
+function THTMLWriter.Enddefdescr : THTML_dd;
+begin
+  result := Enddd;
+end;
+
+{ tag "del", alias "deleted" }
+
+function THTMLWriter.tagdel (s : string) : THTML_del;
+begin
+  result := THTML_del (CreateElement (THTML_del, s));
+end;
+
+function THTMLWriter.tagdel (sub : THTMLCustomElement) : THTML_del;
+begin
+  result := THTML_del (CreateElement (THTML_del, sub));
+end;
+
+function THTMLWriter.tagdel (subs : Array of THTMLCustomElement) : THTML_del;
+begin
+  result := THTML_del (CreateElement (THTML_del, subs));
+end;
+
+function THTMLWriter.tagdel (subs : TDOMNodelist) : THTML_del;
+begin
+  result := THTML_del (CreateElement (THTML_del, subs));
+end;
+
+function THTMLWriter.deleted (s : string) : THTML_del;
+begin
+  result := tagdel (s);
+end;
+
+function THTMLWriter.deleted (sub : THTMLCustomElement) : THTML_del;
+begin
+  result := tagdel (sub);
+end;
+
+function THTMLWriter.deleted (subs : Array of THTMLCustomElement) : THTML_del;
+begin
+  result := tagdel (subs);
+end;
+
+function THTMLWriter.deleted (subs : TDOMNodelist) : THTML_del;
+begin
+  result := tagdel (subs);
+end;
+
+function THTMLWriter.Startdel : THTML_del;
+begin
+  result := THTML_del (StartElement (THTML_del));
+end;
+
+function THTMLWriter.Enddel : THTML_del;
+begin
+  result := THTML_del (EndElement (THTML_del));
+end;
+
+function THTMLWriter.Startdeleted : THTML_del;
+begin
+  result := Startdel;
+end;
+
+function THTMLWriter.Enddeleted : THTML_del;
+begin
+  result := Enddel;
+end;
+
+{ tag "dfn", alias "definition" }
+
+function THTMLWriter.tagdfn (s : string) : THTML_dfn;
+begin
+  result := THTML_dfn (CreateElement (THTML_dfn, s));
+end;
+
+function THTMLWriter.tagdfn (sub : THTMLCustomElement) : THTML_dfn;
+begin
+  result := THTML_dfn (CreateElement (THTML_dfn, sub));
+end;
+
+function THTMLWriter.tagdfn (subs : Array of THTMLCustomElement) : THTML_dfn;
+begin
+  result := THTML_dfn (CreateElement (THTML_dfn, subs));
+end;
+
+function THTMLWriter.tagdfn (subs : TDOMNodelist) : THTML_dfn;
+begin
+  result := THTML_dfn (CreateElement (THTML_dfn, subs));
+end;
+
+function THTMLWriter.definition (s : string) : THTML_dfn;
+begin
+  result := tagdfn (s);
+end;
+
+function THTMLWriter.definition (sub : THTMLCustomElement) : THTML_dfn;
+begin
+  result := tagdfn (sub);
+end;
+
+function THTMLWriter.definition (subs : Array of THTMLCustomElement) : THTML_dfn;
+begin
+  result := tagdfn (subs);
+end;
+
+function THTMLWriter.definition (subs : TDOMNodelist) : THTML_dfn;
+begin
+  result := tagdfn (subs);
+end;
+
+function THTMLWriter.Startdfn : THTML_dfn;
+begin
+  result := THTML_dfn (StartElement (THTML_dfn));
+end;
+
+function THTMLWriter.Enddfn : THTML_dfn;
+begin
+  result := THTML_dfn (EndElement (THTML_dfn));
+end;
+
+function THTMLWriter.Startdefinition : THTML_dfn;
+begin
+  result := Startdfn;
+end;
+
+function THTMLWriter.Enddefinition : THTML_dfn;
+begin
+  result := Enddfn;
+end;
+
+{ tag "dir", alias "dir" }
+
+function THTMLWriter.tagdir (s : string) : THTML_dir;
+begin
+  result := THTML_dir (CreateElement (THTML_dir, s));
+end;
+
+function THTMLWriter.tagdir (sub : THTMLCustomElement) : THTML_dir;
+begin
+  result := THTML_dir (CreateElement (THTML_dir, sub));
+end;
+
+function THTMLWriter.tagdir (subs : Array of THTMLCustomElement) : THTML_dir;
+begin
+  result := THTML_dir (CreateElement (THTML_dir, subs));
+end;
+
+function THTMLWriter.tagdir (subs : TDOMNodelist) : THTML_dir;
+begin
+  result := THTML_dir (CreateElement (THTML_dir, subs));
+end;
+
+function THTMLWriter.dir (s : string) : THTML_dir;
+begin
+  result := tagdir (s);
+end;
+
+function THTMLWriter.dir (sub : THTMLCustomElement) : THTML_dir;
+begin
+  result := tagdir (sub);
+end;
+
+function THTMLWriter.dir (subs : Array of THTMLCustomElement) : THTML_dir;
+begin
+  result := tagdir (subs);
+end;
+
+function THTMLWriter.dir (subs : TDOMNodelist) : THTML_dir;
+begin
+  result := tagdir (subs);
+end;
+
+function THTMLWriter.Startdir : THTML_dir;
+begin
+  result := THTML_dir (StartElement (THTML_dir));
+end;
+
+function THTMLWriter.Enddir : THTML_dir;
+begin
+  result := THTML_dir (EndElement (THTML_dir));
+end;
+
+{ tag "div", alias "divider" }
+
+function THTMLWriter.tagdiv (s : string) : THTML_div;
+begin
+  result := THTML_div (CreateElement (THTML_div, s));
+end;
+
+function THTMLWriter.tagdiv (sub : THTMLCustomElement) : THTML_div;
+begin
+  result := THTML_div (CreateElement (THTML_div, sub));
+end;
+
+function THTMLWriter.tagdiv (subs : Array of THTMLCustomElement) : THTML_div;
+begin
+  result := THTML_div (CreateElement (THTML_div, subs));
+end;
+
+function THTMLWriter.tagdiv (subs : TDOMNodelist) : THTML_div;
+begin
+  result := THTML_div (CreateElement (THTML_div, subs));
+end;
+
+function THTMLWriter.divider (s : string) : THTML_div;
+begin
+  result := tagdiv (s);
+end;
+
+function THTMLWriter.divider (sub : THTMLCustomElement) : THTML_div;
+begin
+  result := tagdiv (sub);
+end;
+
+function THTMLWriter.divider (subs : Array of THTMLCustomElement) : THTML_div;
+begin
+  result := tagdiv (subs);
+end;
+
+function THTMLWriter.divider (subs : TDOMNodelist) : THTML_div;
+begin
+  result := tagdiv (subs);
+end;
+
+function THTMLWriter.Startdiv : THTML_div;
+begin
+  result := THTML_div (StartElement (THTML_div));
+end;
+
+function THTMLWriter.Enddiv : THTML_div;
+begin
+  result := THTML_div (EndElement (THTML_div));
+end;
+
+function THTMLWriter.Startdivider : THTML_div;
+begin
+  result := Startdiv;
+end;
+
+function THTMLWriter.Enddivider : THTML_div;
+begin
+  result := Enddiv;
+end;
+
+{ tag "dl", alias "deflist" }
+
+function THTMLWriter.tagdl (s : string) : THTML_dl;
+begin
+  result := THTML_dl (CreateElement (THTML_dl, s));
+end;
+
+function THTMLWriter.tagdl (sub : THTMLCustomElement) : THTML_dl;
+begin
+  result := THTML_dl (CreateElement (THTML_dl, sub));
+end;
+
+function THTMLWriter.tagdl (subs : Array of THTMLCustomElement) : THTML_dl;
+begin
+  result := THTML_dl (CreateElement (THTML_dl, subs));
+end;
+
+function THTMLWriter.tagdl (subs : TDOMNodelist) : THTML_dl;
+begin
+  result := THTML_dl (CreateElement (THTML_dl, subs));
+end;
+
+function THTMLWriter.deflist (s : string) : THTML_dl;
+begin
+  result := tagdl (s);
+end;
+
+function THTMLWriter.deflist (sub : THTMLCustomElement) : THTML_dl;
+begin
+  result := tagdl (sub);
+end;
+
+function THTMLWriter.deflist (subs : Array of THTMLCustomElement) : THTML_dl;
+begin
+  result := tagdl (subs);
+end;
+
+function THTMLWriter.deflist (subs : TDOMNodelist) : THTML_dl;
+begin
+  result := tagdl (subs);
+end;
+
+function THTMLWriter.Startdl : THTML_dl;
+begin
+  result := THTML_dl (StartElement (THTML_dl));
+end;
+
+function THTMLWriter.Enddl : THTML_dl;
+begin
+  result := THTML_dl (EndElement (THTML_dl));
+end;
+
+function THTMLWriter.Startdeflist : THTML_dl;
+begin
+  result := Startdl;
+end;
+
+function THTMLWriter.Enddeflist : THTML_dl;
+begin
+  result := Enddl;
+end;
+
+{ tag "dt", alias "defterm" }
+
+function THTMLWriter.tagdt (s : string) : THTML_dt;
+begin
+  result := THTML_dt (CreateElement (THTML_dt, s));
+end;
+
+function THTMLWriter.tagdt (sub : THTMLCustomElement) : THTML_dt;
+begin
+  result := THTML_dt (CreateElement (THTML_dt, sub));
+end;
+
+function THTMLWriter.tagdt (subs : Array of THTMLCustomElement) : THTML_dt;
+begin
+  result := THTML_dt (CreateElement (THTML_dt, subs));
+end;
+
+function THTMLWriter.tagdt (subs : TDOMNodelist) : THTML_dt;
+begin
+  result := THTML_dt (CreateElement (THTML_dt, subs));
+end;
+
+function THTMLWriter.defterm (s : string) : THTML_dt;
+begin
+  result := tagdt (s);
+end;
+
+function THTMLWriter.defterm (sub : THTMLCustomElement) : THTML_dt;
+begin
+  result := tagdt (sub);
+end;
+
+function THTMLWriter.defterm (subs : Array of THTMLCustomElement) : THTML_dt;
+begin
+  result := tagdt (subs);
+end;
+
+function THTMLWriter.defterm (subs : TDOMNodelist) : THTML_dt;
+begin
+  result := tagdt (subs);
+end;
+
+function THTMLWriter.Startdt : THTML_dt;
+begin
+  result := THTML_dt (StartElement (THTML_dt));
+end;
+
+function THTMLWriter.Enddt : THTML_dt;
+begin
+  result := THTML_dt (EndElement (THTML_dt));
+end;
+
+function THTMLWriter.Startdefterm : THTML_dt;
+begin
+  result := Startdt;
+end;
+
+function THTMLWriter.Enddefterm : THTML_dt;
+begin
+  result := Enddt;
+end;
+
+{ tag "em", alias "emphasis" }
+
+function THTMLWriter.tagem (s : string) : THTML_em;
+begin
+  result := THTML_em (CreateElement (THTML_em, s));
+end;
+
+function THTMLWriter.tagem (sub : THTMLCustomElement) : THTML_em;
+begin
+  result := THTML_em (CreateElement (THTML_em, sub));
+end;
+
+function THTMLWriter.tagem (subs : Array of THTMLCustomElement) : THTML_em;
+begin
+  result := THTML_em (CreateElement (THTML_em, subs));
+end;
+
+function THTMLWriter.tagem (subs : TDOMNodelist) : THTML_em;
+begin
+  result := THTML_em (CreateElement (THTML_em, subs));
+end;
+
+function THTMLWriter.emphasis (s : string) : THTML_em;
+begin
+  result := tagem (s);
+end;
+
+function THTMLWriter.emphasis (sub : THTMLCustomElement) : THTML_em;
+begin
+  result := tagem (sub);
+end;
+
+function THTMLWriter.emphasis (subs : Array of THTMLCustomElement) : THTML_em;
+begin
+  result := tagem (subs);
+end;
+
+function THTMLWriter.emphasis (subs : TDOMNodelist) : THTML_em;
+begin
+  result := tagem (subs);
+end;
+
+function THTMLWriter.Startem : THTML_em;
+begin
+  result := THTML_em (StartElement (THTML_em));
+end;
+
+function THTMLWriter.Endem : THTML_em;
+begin
+  result := THTML_em (EndElement (THTML_em));
+end;
+
+function THTMLWriter.Startemphasis : THTML_em;
+begin
+  result := Startem;
+end;
+
+function THTMLWriter.Endemphasis : THTML_em;
+begin
+  result := Endem;
+end;
+
+{ tag "fieldset", alias "fieldset" }
+
+function THTMLWriter.tagfieldset (s : string) : THTML_fieldset;
+begin
+  result := THTML_fieldset (CreateElement (THTML_fieldset, s));
+end;
+
+function THTMLWriter.tagfieldset (sub : THTMLCustomElement) : THTML_fieldset;
+begin
+  result := THTML_fieldset (CreateElement (THTML_fieldset, sub));
+end;
+
+function THTMLWriter.tagfieldset (subs : Array of THTMLCustomElement) : THTML_fieldset;
+begin
+  result := THTML_fieldset (CreateElement (THTML_fieldset, subs));
+end;
+
+function THTMLWriter.tagfieldset (subs : TDOMNodelist) : THTML_fieldset;
+begin
+  result := THTML_fieldset (CreateElement (THTML_fieldset, subs));
+end;
+
+function THTMLWriter.fieldset (s : string) : THTML_fieldset;
+begin
+  result := tagfieldset (s);
+end;
+
+function THTMLWriter.fieldset (sub : THTMLCustomElement) : THTML_fieldset;
+begin
+  result := tagfieldset (sub);
+end;
+
+function THTMLWriter.fieldset (subs : Array of THTMLCustomElement) : THTML_fieldset;
+begin
+  result := tagfieldset (subs);
+end;
+
+function THTMLWriter.fieldset (subs : TDOMNodelist) : THTML_fieldset;
+begin
+  result := tagfieldset (subs);
+end;
+
+function THTMLWriter.Startfieldset : THTML_fieldset;
+begin
+  result := THTML_fieldset (StartElement (THTML_fieldset));
+end;
+
+function THTMLWriter.Endfieldset : THTML_fieldset;
+begin
+  result := THTML_fieldset (EndElement (THTML_fieldset));
+end;
+
+{ tag "font", alias "font" }
+
+function THTMLWriter.tagfont (s : string) : THTML_font;
+begin
+  result := THTML_font (CreateElement (THTML_font, s));
+end;
+
+function THTMLWriter.tagfont (sub : THTMLCustomElement) : THTML_font;
+begin
+  result := THTML_font (CreateElement (THTML_font, sub));
+end;
+
+function THTMLWriter.tagfont (subs : Array of THTMLCustomElement) : THTML_font;
+begin
+  result := THTML_font (CreateElement (THTML_font, subs));
+end;
+
+function THTMLWriter.tagfont (subs : TDOMNodelist) : THTML_font;
+begin
+  result := THTML_font (CreateElement (THTML_font, subs));
+end;
+
+function THTMLWriter.font (s : string) : THTML_font;
+begin
+  result := tagfont (s);
+end;
+
+function THTMLWriter.font (sub : THTMLCustomElement) : THTML_font;
+begin
+  result := tagfont (sub);
+end;
+
+function THTMLWriter.font (subs : Array of THTMLCustomElement) : THTML_font;
+begin
+  result := tagfont (subs);
+end;
+
+function THTMLWriter.font (subs : TDOMNodelist) : THTML_font;
+begin
+  result := tagfont (subs);
+end;
+
+function THTMLWriter.Startfont : THTML_font;
+begin
+  result := THTML_font (StartElement (THTML_font));
+end;
+
+function THTMLWriter.Endfont : THTML_font;
+begin
+  result := THTML_font (EndElement (THTML_font));
+end;
+
+{ tag "form", alias "form" }
+
+function THTMLWriter.tagform (s : string) : THTML_form;
+begin
+  result := THTML_form (CreateElement (THTML_form, s));
+end;
+
+function THTMLWriter.tagform (sub : THTMLCustomElement) : THTML_form;
+begin
+  result := THTML_form (CreateElement (THTML_form, sub));
+end;
+
+function THTMLWriter.tagform (subs : Array of THTMLCustomElement) : THTML_form;
+begin
+  result := THTML_form (CreateElement (THTML_form, subs));
+end;
+
+function THTMLWriter.tagform (subs : TDOMNodelist) : THTML_form;
+begin
+  result := THTML_form (CreateElement (THTML_form, subs));
+end;
+
+function THTMLWriter.form (s : string) : THTML_form;
+begin
+  result := tagform (s);
+end;
+
+function THTMLWriter.form (sub : THTMLCustomElement) : THTML_form;
+begin
+  result := tagform (sub);
+end;
+
+function THTMLWriter.form (subs : Array of THTMLCustomElement) : THTML_form;
+begin
+  result := tagform (subs);
+end;
+
+function THTMLWriter.form (subs : TDOMNodelist) : THTML_form;
+begin
+  result := tagform (subs);
+end;
+
+function THTMLWriter.Startform : THTML_form;
+begin
+  result := THTML_form (StartElement (THTML_form));
+end;
+
+function THTMLWriter.Endform : THTML_form;
+begin
+  result := THTML_form (EndElement (THTML_form));
+end;
+
+{ tag "frame", alias "frame" }
+
+function THTMLWriter.tagframe : THTML_frame;
+begin
+  result := THTML_frame (AddElement (THTML_frame));
+end;
+
+function THTMLWriter.frame : THTML_frame;
+begin
+  result := tagframe;
+end;
+
+{ tag "frameset", alias "frameset" }
+
+function THTMLWriter.tagframeset (s : string) : THTML_frameset;
+begin
+  result := THTML_frameset (CreateElement (THTML_frameset, s));
+end;
+
+function THTMLWriter.tagframeset (sub : THTMLCustomElement) : THTML_frameset;
+begin
+  result := THTML_frameset (CreateElement (THTML_frameset, sub));
+end;
+
+function THTMLWriter.tagframeset (subs : Array of THTMLCustomElement) : THTML_frameset;
+begin
+  result := THTML_frameset (CreateElement (THTML_frameset, subs));
+end;
+
+function THTMLWriter.tagframeset (subs : TDOMNodelist) : THTML_frameset;
+begin
+  result := THTML_frameset (CreateElement (THTML_frameset, subs));
+end;
+
+function THTMLWriter.frameset (s : string) : THTML_frameset;
+begin
+  result := tagframeset (s);
+end;
+
+function THTMLWriter.frameset (sub : THTMLCustomElement) : THTML_frameset;
+begin
+  result := tagframeset (sub);
+end;
+
+function THTMLWriter.frameset (subs : Array of THTMLCustomElement) : THTML_frameset;
+begin
+  result := tagframeset (subs);
+end;
+
+function THTMLWriter.frameset (subs : TDOMNodelist) : THTML_frameset;
+begin
+  result := tagframeset (subs);
+end;
+
+function THTMLWriter.Startframeset : THTML_frameset;
+begin
+  result := THTML_frameset (StartElement (THTML_frameset));
+end;
+
+function THTMLWriter.Endframeset : THTML_frameset;
+begin
+  result := THTML_frameset (EndElement (THTML_frameset));
+end;
+
+{ tag "h1", alias "heading1" }
+
+function THTMLWriter.tagh1 (s : string) : THTML_h1;
+begin
+  result := THTML_h1 (CreateElement (THTML_h1, s));
+end;
+
+function THTMLWriter.tagh1 (sub : THTMLCustomElement) : THTML_h1;
+begin
+  result := THTML_h1 (CreateElement (THTML_h1, sub));
+end;
+
+function THTMLWriter.tagh1 (subs : Array of THTMLCustomElement) : THTML_h1;
+begin
+  result := THTML_h1 (CreateElement (THTML_h1, subs));
+end;
+
+function THTMLWriter.tagh1 (subs : TDOMNodelist) : THTML_h1;
+begin
+  result := THTML_h1 (CreateElement (THTML_h1, subs));
+end;
+
+function THTMLWriter.heading1 (s : string) : THTML_h1;
+begin
+  result := tagh1 (s);
+end;
+
+function THTMLWriter.heading1 (sub : THTMLCustomElement) : THTML_h1;
+begin
+  result := tagh1 (sub);
+end;
+
+function THTMLWriter.heading1 (subs : Array of THTMLCustomElement) : THTML_h1;
+begin
+  result := tagh1 (subs);
+end;
+
+function THTMLWriter.heading1 (subs : TDOMNodelist) : THTML_h1;
+begin
+  result := tagh1 (subs);
+end;
+
+function THTMLWriter.Starth1 : THTML_h1;
+begin
+  result := THTML_h1 (StartElement (THTML_h1));
+end;
+
+function THTMLWriter.Endh1 : THTML_h1;
+begin
+  result := THTML_h1 (EndElement (THTML_h1));
+end;
+
+function THTMLWriter.Startheading1 : THTML_h1;
+begin
+  result := Starth1;
+end;
+
+function THTMLWriter.Endheading1 : THTML_h1;
+begin
+  result := Endh1;
+end;
+
+{ tag "h2", alias "heading2" }
+
+function THTMLWriter.tagh2 (s : string) : THTML_h2;
+begin
+  result := THTML_h2 (CreateElement (THTML_h2, s));
+end;
+
+function THTMLWriter.tagh2 (sub : THTMLCustomElement) : THTML_h2;
+begin
+  result := THTML_h2 (CreateElement (THTML_h2, sub));
+end;
+
+function THTMLWriter.tagh2 (subs : Array of THTMLCustomElement) : THTML_h2;
+begin
+  result := THTML_h2 (CreateElement (THTML_h2, subs));
+end;
+
+function THTMLWriter.tagh2 (subs : TDOMNodelist) : THTML_h2;
+begin
+  result := THTML_h2 (CreateElement (THTML_h2, subs));
+end;
+
+function THTMLWriter.heading2 (s : string) : THTML_h2;
+begin
+  result := tagh2 (s);
+end;
+
+function THTMLWriter.heading2 (sub : THTMLCustomElement) : THTML_h2;
+begin
+  result := tagh2 (sub);
+end;
+
+function THTMLWriter.heading2 (subs : Array of THTMLCustomElement) : THTML_h2;
+begin
+  result := tagh2 (subs);
+end;
+
+function THTMLWriter.heading2 (subs : TDOMNodelist) : THTML_h2;
+begin
+  result := tagh2 (subs);
+end;
+
+function THTMLWriter.Starth2 : THTML_h2;
+begin
+  result := THTML_h2 (StartElement (THTML_h2));
+end;
+
+function THTMLWriter.Endh2 : THTML_h2;
+begin
+  result := THTML_h2 (EndElement (THTML_h2));
+end;
+
+function THTMLWriter.Startheading2 : THTML_h2;
+begin
+  result := Starth2;
+end;
+
+function THTMLWriter.Endheading2 : THTML_h2;
+begin
+  result := Endh2;
+end;
+
+{ tag "h3", alias "heading3" }
+
+function THTMLWriter.tagh3 (s : string) : THTML_h3;
+begin
+  result := THTML_h3 (CreateElement (THTML_h3, s));
+end;
+
+function THTMLWriter.tagh3 (sub : THTMLCustomElement) : THTML_h3;
+begin
+  result := THTML_h3 (CreateElement (THTML_h3, sub));
+end;
+
+function THTMLWriter.tagh3 (subs : Array of THTMLCustomElement) : THTML_h3;
+begin
+  result := THTML_h3 (CreateElement (THTML_h3, subs));
+end;
+
+function THTMLWriter.tagh3 (subs : TDOMNodelist) : THTML_h3;
+begin
+  result := THTML_h3 (CreateElement (THTML_h3, subs));
+end;
+
+function THTMLWriter.heading3 (s : string) : THTML_h3;
+begin
+  result := tagh3 (s);
+end;
+
+function THTMLWriter.heading3 (sub : THTMLCustomElement) : THTML_h3;
+begin
+  result := tagh3 (sub);
+end;
+
+function THTMLWriter.heading3 (subs : Array of THTMLCustomElement) : THTML_h3;
+begin
+  result := tagh3 (subs);
+end;
+
+function THTMLWriter.heading3 (subs : TDOMNodelist) : THTML_h3;
+begin
+  result := tagh3 (subs);
+end;
+
+function THTMLWriter.Starth3 : THTML_h3;
+begin
+  result := THTML_h3 (StartElement (THTML_h3));
+end;
+
+function THTMLWriter.Endh3 : THTML_h3;
+begin
+  result := THTML_h3 (EndElement (THTML_h3));
+end;
+
+function THTMLWriter.Startheading3 : THTML_h3;
+begin
+  result := Starth3;
+end;
+
+function THTMLWriter.Endheading3 : THTML_h3;
+begin
+  result := Endh3;
+end;
+
+{ tag "h4", alias "heading4" }
+
+function THTMLWriter.tagh4 (s : string) : THTML_h4;
+begin
+  result := THTML_h4 (CreateElement (THTML_h4, s));
+end;
+
+function THTMLWriter.tagh4 (sub : THTMLCustomElement) : THTML_h4;
+begin
+  result := THTML_h4 (CreateElement (THTML_h4, sub));
+end;
+
+function THTMLWriter.tagh4 (subs : Array of THTMLCustomElement) : THTML_h4;
+begin
+  result := THTML_h4 (CreateElement (THTML_h4, subs));
+end;
+
+function THTMLWriter.tagh4 (subs : TDOMNodelist) : THTML_h4;
+begin
+  result := THTML_h4 (CreateElement (THTML_h4, subs));
+end;
+
+function THTMLWriter.heading4 (s : string) : THTML_h4;
+begin
+  result := tagh4 (s);
+end;
+
+function THTMLWriter.heading4 (sub : THTMLCustomElement) : THTML_h4;
+begin
+  result := tagh4 (sub);
+end;
+
+function THTMLWriter.heading4 (subs : Array of THTMLCustomElement) : THTML_h4;
+begin
+  result := tagh4 (subs);
+end;
+
+function THTMLWriter.heading4 (subs : TDOMNodelist) : THTML_h4;
+begin
+  result := tagh4 (subs);
+end;
+
+function THTMLWriter.Starth4 : THTML_h4;
+begin
+  result := THTML_h4 (StartElement (THTML_h4));
+end;
+
+function THTMLWriter.Endh4 : THTML_h4;
+begin
+  result := THTML_h4 (EndElement (THTML_h4));
+end;
+
+function THTMLWriter.Startheading4 : THTML_h4;
+begin
+  result := Starth4;
+end;
+
+function THTMLWriter.Endheading4 : THTML_h4;
+begin
+  result := Endh4;
+end;
+
+{ tag "h5", alias "heading5" }
+
+function THTMLWriter.tagh5 (s : string) : THTML_h5;
+begin
+  result := THTML_h5 (CreateElement (THTML_h5, s));
+end;
+
+function THTMLWriter.tagh5 (sub : THTMLCustomElement) : THTML_h5;
+begin
+  result := THTML_h5 (CreateElement (THTML_h5, sub));
+end;
+
+function THTMLWriter.tagh5 (subs : Array of THTMLCustomElement) : THTML_h5;
+begin
+  result := THTML_h5 (CreateElement (THTML_h5, subs));
+end;
+
+function THTMLWriter.tagh5 (subs : TDOMNodelist) : THTML_h5;
+begin
+  result := THTML_h5 (CreateElement (THTML_h5, subs));
+end;
+
+function THTMLWriter.heading5 (s : string) : THTML_h5;
+begin
+  result := tagh5 (s);
+end;
+
+function THTMLWriter.heading5 (sub : THTMLCustomElement) : THTML_h5;
+begin
+  result := tagh5 (sub);
+end;
+
+function THTMLWriter.heading5 (subs : Array of THTMLCustomElement) : THTML_h5;
+begin
+  result := tagh5 (subs);
+end;
+
+function THTMLWriter.heading5 (subs : TDOMNodelist) : THTML_h5;
+begin
+  result := tagh5 (subs);
+end;
+
+function THTMLWriter.Starth5 : THTML_h5;
+begin
+  result := THTML_h5 (StartElement (THTML_h5));
+end;
+
+function THTMLWriter.Endh5 : THTML_h5;
+begin
+  result := THTML_h5 (EndElement (THTML_h5));
+end;
+
+function THTMLWriter.Startheading5 : THTML_h5;
+begin
+  result := Starth5;
+end;
+
+function THTMLWriter.Endheading5 : THTML_h5;
+begin
+  result := Endh5;
+end;
+
+{ tag "h6", alias "heading6" }
+
+function THTMLWriter.tagh6 (s : string) : THTML_h6;
+begin
+  result := THTML_h6 (CreateElement (THTML_h6, s));
+end;
+
+function THTMLWriter.tagh6 (sub : THTMLCustomElement) : THTML_h6;
+begin
+  result := THTML_h6 (CreateElement (THTML_h6, sub));
+end;
+
+function THTMLWriter.tagh6 (subs : Array of THTMLCustomElement) : THTML_h6;
+begin
+  result := THTML_h6 (CreateElement (THTML_h6, subs));
+end;
+
+function THTMLWriter.tagh6 (subs : TDOMNodelist) : THTML_h6;
+begin
+  result := THTML_h6 (CreateElement (THTML_h6, subs));
+end;
+
+function THTMLWriter.heading6 (s : string) : THTML_h6;
+begin
+  result := tagh6 (s);
+end;
+
+function THTMLWriter.heading6 (sub : THTMLCustomElement) : THTML_h6;
+begin
+  result := tagh6 (sub);
+end;
+
+function THTMLWriter.heading6 (subs : Array of THTMLCustomElement) : THTML_h6;
+begin
+  result := tagh6 (subs);
+end;
+
+function THTMLWriter.heading6 (subs : TDOMNodelist) : THTML_h6;
+begin
+  result := tagh6 (subs);
+end;
+
+function THTMLWriter.Starth6 : THTML_h6;
+begin
+  result := THTML_h6 (StartElement (THTML_h6));
+end;
+
+function THTMLWriter.Endh6 : THTML_h6;
+begin
+  result := THTML_h6 (EndElement (THTML_h6));
+end;
+
+function THTMLWriter.Startheading6 : THTML_h6;
+begin
+  result := Starth6;
+end;
+
+function THTMLWriter.Endheading6 : THTML_h6;
+begin
+  result := Endh6;
+end;
+
+{ tag "head", alias "header" }
+
+function THTMLWriter.taghead (s : string) : THTML_head;
+begin
+  result := THTML_head (CreateElement (THTML_head, s));
+end;
+
+function THTMLWriter.taghead (sub : THTMLCustomElement) : THTML_head;
+begin
+  result := THTML_head (CreateElement (THTML_head, sub));
+end;
+
+function THTMLWriter.taghead (subs : Array of THTMLCustomElement) : THTML_head;
+begin
+  result := THTML_head (CreateElement (THTML_head, subs));
+end;
+
+function THTMLWriter.taghead (subs : TDOMNodelist) : THTML_head;
+begin
+  result := THTML_head (CreateElement (THTML_head, subs));
+end;
+
+function THTMLWriter.header (s : string) : THTML_head;
+begin
+  result := taghead (s);
+end;
+
+function THTMLWriter.header (sub : THTMLCustomElement) : THTML_head;
+begin
+  result := taghead (sub);
+end;
+
+function THTMLWriter.header (subs : Array of THTMLCustomElement) : THTML_head;
+begin
+  result := taghead (subs);
+end;
+
+function THTMLWriter.header (subs : TDOMNodelist) : THTML_head;
+begin
+  result := taghead (subs);
+end;
+
+function THTMLWriter.Starthead : THTML_head;
+begin
+  result := THTML_head (StartElement (THTML_head));
+end;
+
+function THTMLWriter.Endhead : THTML_head;
+begin
+  result := THTML_head (EndElement (THTML_head));
+end;
+
+function THTMLWriter.Startheader : THTML_head;
+begin
+  result := Starthead;
+end;
+
+function THTMLWriter.Endheader : THTML_head;
+begin
+  result := Endhead;
+end;
+
+{ tag "hr", alias "horrule" }
+
+function THTMLWriter.taghr : THTML_hr;
+begin
+  result := THTML_hr (AddElement (THTML_hr));
+end;
+
+function THTMLWriter.horrule : THTML_hr;
+begin
+  result := taghr;
+end;
+
+{ tag "html", alias "html" }
+
+function THTMLWriter.taghtml (s : string) : THTML_html;
+begin
+  result := THTML_html (CreateElement (THTML_html, s));
+end;
+
+function THTMLWriter.taghtml (sub : THTMLCustomElement) : THTML_html;
+begin
+  result := THTML_html (CreateElement (THTML_html, sub));
+end;
+
+function THTMLWriter.taghtml (subs : Array of THTMLCustomElement) : THTML_html;
+begin
+  result := THTML_html (CreateElement (THTML_html, subs));
+end;
+
+function THTMLWriter.taghtml (subs : TDOMNodelist) : THTML_html;
+begin
+  result := THTML_html (CreateElement (THTML_html, subs));
+end;
+
+function THTMLWriter.html (s : string) : THTML_html;
+begin
+  result := taghtml (s);
+end;
+
+function THTMLWriter.html (sub : THTMLCustomElement) : THTML_html;
+begin
+  result := taghtml (sub);
+end;
+
+function THTMLWriter.html (subs : Array of THTMLCustomElement) : THTML_html;
+begin
+  result := taghtml (subs);
+end;
+
+function THTMLWriter.html (subs : TDOMNodelist) : THTML_html;
+begin
+  result := taghtml (subs);
+end;
+
+function THTMLWriter.Starthtml : THTML_html;
+begin
+  result := THTML_html (StartElement (THTML_html));
+end;
+
+function THTMLWriter.Endhtml : THTML_html;
+begin
+  result := THTML_html (EndElement (THTML_html));
+end;
+
+{ tag "i", alias "italic" }
+
+function THTMLWriter.tagi (s : string) : THTML_i;
+begin
+  result := THTML_i (CreateElement (THTML_i, s));
+end;
+
+function THTMLWriter.tagi (sub : THTMLCustomElement) : THTML_i;
+begin
+  result := THTML_i (CreateElement (THTML_i, sub));
+end;
+
+function THTMLWriter.tagi (subs : Array of THTMLCustomElement) : THTML_i;
+begin
+  result := THTML_i (CreateElement (THTML_i, subs));
+end;
+
+function THTMLWriter.tagi (subs : TDOMNodelist) : THTML_i;
+begin
+  result := THTML_i (CreateElement (THTML_i, subs));
+end;
+
+function THTMLWriter.italic (s : string) : THTML_i;
+begin
+  result := tagi (s);
+end;
+
+function THTMLWriter.italic (sub : THTMLCustomElement) : THTML_i;
+begin
+  result := tagi (sub);
+end;
+
+function THTMLWriter.italic (subs : Array of THTMLCustomElement) : THTML_i;
+begin
+  result := tagi (subs);
+end;
+
+function THTMLWriter.italic (subs : TDOMNodelist) : THTML_i;
+begin
+  result := tagi (subs);
+end;
+
+function THTMLWriter.Starti : THTML_i;
+begin
+  result := THTML_i (StartElement (THTML_i));
+end;
+
+function THTMLWriter.Endi : THTML_i;
+begin
+  result := THTML_i (EndElement (THTML_i));
+end;
+
+function THTMLWriter.Startitalic : THTML_i;
+begin
+  result := Starti;
+end;
+
+function THTMLWriter.Enditalic : THTML_i;
+begin
+  result := Endi;
+end;
+
+{ tag "iframe", alias "inlineframe" }
+
+function THTMLWriter.tagiframe (s : string) : THTML_iframe;
+begin
+  result := THTML_iframe (CreateElement (THTML_iframe, s));
+end;
+
+function THTMLWriter.tagiframe (sub : THTMLCustomElement) : THTML_iframe;
+begin
+  result := THTML_iframe (CreateElement (THTML_iframe, sub));
+end;
+
+function THTMLWriter.tagiframe (subs : Array of THTMLCustomElement) : THTML_iframe;
+begin
+  result := THTML_iframe (CreateElement (THTML_iframe, subs));
+end;
+
+function THTMLWriter.tagiframe (subs : TDOMNodelist) : THTML_iframe;
+begin
+  result := THTML_iframe (CreateElement (THTML_iframe, subs));
+end;
+
+function THTMLWriter.inlineframe (s : string) : THTML_iframe;
+begin
+  result := tagiframe (s);
+end;
+
+function THTMLWriter.inlineframe (sub : THTMLCustomElement) : THTML_iframe;
+begin
+  result := tagiframe (sub);
+end;
+
+function THTMLWriter.inlineframe (subs : Array of THTMLCustomElement) : THTML_iframe;
+begin
+  result := tagiframe (subs);
+end;
+
+function THTMLWriter.inlineframe (subs : TDOMNodelist) : THTML_iframe;
+begin
+  result := tagiframe (subs);
+end;
+
+function THTMLWriter.Startiframe : THTML_iframe;
+begin
+  result := THTML_iframe (StartElement (THTML_iframe));
+end;
+
+function THTMLWriter.Endiframe : THTML_iframe;
+begin
+  result := THTML_iframe (EndElement (THTML_iframe));
+end;
+
+function THTMLWriter.Startinlineframe : THTML_iframe;
+begin
+  result := Startiframe;
+end;
+
+function THTMLWriter.Endinlineframe : THTML_iframe;
+begin
+  result := Endiframe;
+end;
+
+{ tag "img", alias "image" }
+
+function THTMLWriter.tagimg : THTML_img;
+begin
+  result := THTML_img (AddElement (THTML_img));
+end;
+
+function THTMLWriter.image : THTML_img;
+begin
+  result := tagimg;
+end;
+
+{ tag "input", alias "input" }
+
+function THTMLWriter.taginput : THTML_input;
+begin
+  result := THTML_input (AddElement (THTML_input));
+end;
+
+function THTMLWriter.input : THTML_input;
+begin
+  result := taginput;
+end;
+
+{ tag "ins", alias "inserted" }
+
+function THTMLWriter.tagins (s : string) : THTML_ins;
+begin
+  result := THTML_ins (CreateElement (THTML_ins, s));
+end;
+
+function THTMLWriter.tagins (sub : THTMLCustomElement) : THTML_ins;
+begin
+  result := THTML_ins (CreateElement (THTML_ins, sub));
+end;
+
+function THTMLWriter.tagins (subs : Array of THTMLCustomElement) : THTML_ins;
+begin
+  result := THTML_ins (CreateElement (THTML_ins, subs));
+end;
+
+function THTMLWriter.tagins (subs : TDOMNodelist) : THTML_ins;
+begin
+  result := THTML_ins (CreateElement (THTML_ins, subs));
+end;
+
+function THTMLWriter.inserted (s : string) : THTML_ins;
+begin
+  result := tagins (s);
+end;
+
+function THTMLWriter.inserted (sub : THTMLCustomElement) : THTML_ins;
+begin
+  result := tagins (sub);
+end;
+
+function THTMLWriter.inserted (subs : Array of THTMLCustomElement) : THTML_ins;
+begin
+  result := tagins (subs);
+end;
+
+function THTMLWriter.inserted (subs : TDOMNodelist) : THTML_ins;
+begin
+  result := tagins (subs);
+end;
+
+function THTMLWriter.Startins : THTML_ins;
+begin
+  result := THTML_ins (StartElement (THTML_ins));
+end;
+
+function THTMLWriter.Endins : THTML_ins;
+begin
+  result := THTML_ins (EndElement (THTML_ins));
+end;
+
+function THTMLWriter.Startinserted : THTML_ins;
+begin
+  result := Startins;
+end;
+
+function THTMLWriter.Endinserted : THTML_ins;
+begin
+  result := Endins;
+end;
+
+{ tag "isindex", alias "isindex" }
+
+function THTMLWriter.tagisindex : THTML_isindex;
+begin
+  result := THTML_isindex (AddElement (THTML_isindex));
+end;
+
+function THTMLWriter.isindex : THTML_isindex;
+begin
+  result := tagisindex;
+end;
+
+{ tag "kbd", alias "enteredtext" }
+
+function THTMLWriter.tagkbd (s : string) : THTML_kbd;
+begin
+  result := THTML_kbd (CreateElement (THTML_kbd, s));
+end;
+
+function THTMLWriter.tagkbd (sub : THTMLCustomElement) : THTML_kbd;
+begin
+  result := THTML_kbd (CreateElement (THTML_kbd, sub));
+end;
+
+function THTMLWriter.tagkbd (subs : Array of THTMLCustomElement) : THTML_kbd;
+begin
+  result := THTML_kbd (CreateElement (THTML_kbd, subs));
+end;
+
+function THTMLWriter.tagkbd (subs : TDOMNodelist) : THTML_kbd;
+begin
+  result := THTML_kbd (CreateElement (THTML_kbd, subs));
+end;
+
+function THTMLWriter.enteredtext (s : string) : THTML_kbd;
+begin
+  result := tagkbd (s);
+end;
+
+function THTMLWriter.enteredtext (sub : THTMLCustomElement) : THTML_kbd;
+begin
+  result := tagkbd (sub);
+end;
+
+function THTMLWriter.enteredtext (subs : Array of THTMLCustomElement) : THTML_kbd;
+begin
+  result := tagkbd (subs);
+end;
+
+function THTMLWriter.enteredtext (subs : TDOMNodelist) : THTML_kbd;
+begin
+  result := tagkbd (subs);
+end;
+
+function THTMLWriter.Startkbd : THTML_kbd;
+begin
+  result := THTML_kbd (StartElement (THTML_kbd));
+end;
+
+function THTMLWriter.Endkbd : THTML_kbd;
+begin
+  result := THTML_kbd (EndElement (THTML_kbd));
+end;
+
+function THTMLWriter.Startenteredtext : THTML_kbd;
+begin
+  result := Startkbd;
+end;
+
+function THTMLWriter.Endenteredtext : THTML_kbd;
+begin
+  result := Endkbd;
+end;
+
+{ tag "label", alias "alabel" }
+
+function THTMLWriter.taglabel (s : string) : THTML_label;
+begin
+  result := THTML_label (CreateElement (THTML_label, s));
+end;
+
+function THTMLWriter.taglabel (sub : THTMLCustomElement) : THTML_label;
+begin
+  result := THTML_label (CreateElement (THTML_label, sub));
+end;
+
+function THTMLWriter.taglabel (subs : Array of THTMLCustomElement) : THTML_label;
+begin
+  result := THTML_label (CreateElement (THTML_label, subs));
+end;
+
+function THTMLWriter.taglabel (subs : TDOMNodelist) : THTML_label;
+begin
+  result := THTML_label (CreateElement (THTML_label, subs));
+end;
+
+function THTMLWriter.alabel (s : string) : THTML_label;
+begin
+  result := taglabel (s);
+end;
+
+function THTMLWriter.alabel (sub : THTMLCustomElement) : THTML_label;
+begin
+  result := taglabel (sub);
+end;
+
+function THTMLWriter.alabel (subs : Array of THTMLCustomElement) : THTML_label;
+begin
+  result := taglabel (subs);
+end;
+
+function THTMLWriter.alabel (subs : TDOMNodelist) : THTML_label;
+begin
+  result := taglabel (subs);
+end;
+
+function THTMLWriter.Startlabel : THTML_label;
+begin
+  result := THTML_label (StartElement (THTML_label));
+end;
+
+function THTMLWriter.Endlabel : THTML_label;
+begin
+  result := THTML_label (EndElement (THTML_label));
+end;
+
+function THTMLWriter.Startalabel : THTML_label;
+begin
+  result := Startlabel;
+end;
+
+function THTMLWriter.Endalabel : THTML_label;
+begin
+  result := Endlabel;
+end;
+
+{ tag "legend", alias "legend" }
+
+function THTMLWriter.taglegend (s : string) : THTML_legend;
+begin
+  result := THTML_legend (CreateElement (THTML_legend, s));
+end;
+
+function THTMLWriter.taglegend (sub : THTMLCustomElement) : THTML_legend;
+begin
+  result := THTML_legend (CreateElement (THTML_legend, sub));
+end;
+
+function THTMLWriter.taglegend (subs : Array of THTMLCustomElement) : THTML_legend;
+begin
+  result := THTML_legend (CreateElement (THTML_legend, subs));
+end;
+
+function THTMLWriter.taglegend (subs : TDOMNodelist) : THTML_legend;
+begin
+  result := THTML_legend (CreateElement (THTML_legend, subs));
+end;
+
+function THTMLWriter.legend (s : string) : THTML_legend;
+begin
+  result := taglegend (s);
+end;
+
+function THTMLWriter.legend (sub : THTMLCustomElement) : THTML_legend;
+begin
+  result := taglegend (sub);
+end;
+
+function THTMLWriter.legend (subs : Array of THTMLCustomElement) : THTML_legend;
+begin
+  result := taglegend (subs);
+end;
+
+function THTMLWriter.legend (subs : TDOMNodelist) : THTML_legend;
+begin
+  result := taglegend (subs);
+end;
+
+function THTMLWriter.Startlegend : THTML_legend;
+begin
+  result := THTML_legend (StartElement (THTML_legend));
+end;
+
+function THTMLWriter.Endlegend : THTML_legend;
+begin
+  result := THTML_legend (EndElement (THTML_legend));
+end;
+
+{ tag "li", alias "listitem" }
+
+function THTMLWriter.tagli (s : string) : THTML_li;
+begin
+  result := THTML_li (CreateElement (THTML_li, s));
+end;
+
+function THTMLWriter.tagli (sub : THTMLCustomElement) : THTML_li;
+begin
+  result := THTML_li (CreateElement (THTML_li, sub));
+end;
+
+function THTMLWriter.tagli (subs : Array of THTMLCustomElement) : THTML_li;
+begin
+  result := THTML_li (CreateElement (THTML_li, subs));
+end;
+
+function THTMLWriter.tagli (subs : TDOMNodelist) : THTML_li;
+begin
+  result := THTML_li (CreateElement (THTML_li, subs));
+end;
+
+function THTMLWriter.listitem (s : string) : THTML_li;
+begin
+  result := tagli (s);
+end;
+
+function THTMLWriter.listitem (sub : THTMLCustomElement) : THTML_li;
+begin
+  result := tagli (sub);
+end;
+
+function THTMLWriter.listitem (subs : Array of THTMLCustomElement) : THTML_li;
+begin
+  result := tagli (subs);
+end;
+
+function THTMLWriter.listitem (subs : TDOMNodelist) : THTML_li;
+begin
+  result := tagli (subs);
+end;
+
+function THTMLWriter.Startli : THTML_li;
+begin
+  result := THTML_li (StartElement (THTML_li));
+end;
+
+function THTMLWriter.Endli : THTML_li;
+begin
+  result := THTML_li (EndElement (THTML_li));
+end;
+
+function THTMLWriter.Startlistitem : THTML_li;
+begin
+  result := Startli;
+end;
+
+function THTMLWriter.Endlistitem : THTML_li;
+begin
+  result := Endli;
+end;
+
+{ tag "link", alias "link" }
+
+function THTMLWriter.taglink : THTML_link;
+begin
+  result := THTML_link (AddElement (THTML_link));
+end;
+
+function THTMLWriter.link : THTML_link;
+begin
+  result := taglink;
+end;
+
+{ tag "map", alias "map" }
+
+function THTMLWriter.tagmap (s : string) : THTML_map;
+begin
+  result := THTML_map (CreateElement (THTML_map, s));
+end;
+
+function THTMLWriter.tagmap (sub : THTMLCustomElement) : THTML_map;
+begin
+  result := THTML_map (CreateElement (THTML_map, sub));
+end;
+
+function THTMLWriter.tagmap (subs : Array of THTMLCustomElement) : THTML_map;
+begin
+  result := THTML_map (CreateElement (THTML_map, subs));
+end;
+
+function THTMLWriter.tagmap (subs : TDOMNodelist) : THTML_map;
+begin
+  result := THTML_map (CreateElement (THTML_map, subs));
+end;
+
+function THTMLWriter.map (s : string) : THTML_map;
+begin
+  result := tagmap (s);
+end;
+
+function THTMLWriter.map (sub : THTMLCustomElement) : THTML_map;
+begin
+  result := tagmap (sub);
+end;
+
+function THTMLWriter.map (subs : Array of THTMLCustomElement) : THTML_map;
+begin
+  result := tagmap (subs);
+end;
+
+function THTMLWriter.map (subs : TDOMNodelist) : THTML_map;
+begin
+  result := tagmap (subs);
+end;
+
+function THTMLWriter.Startmap : THTML_map;
+begin
+  result := THTML_map (StartElement (THTML_map));
+end;
+
+function THTMLWriter.Endmap : THTML_map;
+begin
+  result := THTML_map (EndElement (THTML_map));
+end;
+
+{ tag "menu", alias "menu" }
+
+function THTMLWriter.tagmenu (s : string) : THTML_menu;
+begin
+  result := THTML_menu (CreateElement (THTML_menu, s));
+end;
+
+function THTMLWriter.tagmenu (sub : THTMLCustomElement) : THTML_menu;
+begin
+  result := THTML_menu (CreateElement (THTML_menu, sub));
+end;
+
+function THTMLWriter.tagmenu (subs : Array of THTMLCustomElement) : THTML_menu;
+begin
+  result := THTML_menu (CreateElement (THTML_menu, subs));
+end;
+
+function THTMLWriter.tagmenu (subs : TDOMNodelist) : THTML_menu;
+begin
+  result := THTML_menu (CreateElement (THTML_menu, subs));
+end;
+
+function THTMLWriter.menu (s : string) : THTML_menu;
+begin
+  result := tagmenu (s);
+end;
+
+function THTMLWriter.menu (sub : THTMLCustomElement) : THTML_menu;
+begin
+  result := tagmenu (sub);
+end;
+
+function THTMLWriter.menu (subs : Array of THTMLCustomElement) : THTML_menu;
+begin
+  result := tagmenu (subs);
+end;
+
+function THTMLWriter.menu (subs : TDOMNodelist) : THTML_menu;
+begin
+  result := tagmenu (subs);
+end;
+
+function THTMLWriter.Startmenu : THTML_menu;
+begin
+  result := THTML_menu (StartElement (THTML_menu));
+end;
+
+function THTMLWriter.Endmenu : THTML_menu;
+begin
+  result := THTML_menu (EndElement (THTML_menu));
+end;
+
+{ tag "meta", alias "meta" }
+
+function THTMLWriter.tagmeta : THTML_meta;
+begin
+  result := THTML_meta (AddElement (THTML_meta));
+end;
+
+function THTMLWriter.meta : THTML_meta;
+begin
+  result := tagmeta;
+end;
+
+{ tag "noframes", alias "noframes" }
+
+function THTMLWriter.tagnoframes (s : string) : THTML_noframes;
+begin
+  result := THTML_noframes (CreateElement (THTML_noframes, s));
+end;
+
+function THTMLWriter.tagnoframes (sub : THTMLCustomElement) : THTML_noframes;
+begin
+  result := THTML_noframes (CreateElement (THTML_noframes, sub));
+end;
+
+function THTMLWriter.tagnoframes (subs : Array of THTMLCustomElement) : THTML_noframes;
+begin
+  result := THTML_noframes (CreateElement (THTML_noframes, subs));
+end;
+
+function THTMLWriter.tagnoframes (subs : TDOMNodelist) : THTML_noframes;
+begin
+  result := THTML_noframes (CreateElement (THTML_noframes, subs));
+end;
+
+function THTMLWriter.noframes (s : string) : THTML_noframes;
+begin
+  result := tagnoframes (s);
+end;
+
+function THTMLWriter.noframes (sub : THTMLCustomElement) : THTML_noframes;
+begin
+  result := tagnoframes (sub);
+end;
+
+function THTMLWriter.noframes (subs : Array of THTMLCustomElement) : THTML_noframes;
+begin
+  result := tagnoframes (subs);
+end;
+
+function THTMLWriter.noframes (subs : TDOMNodelist) : THTML_noframes;
+begin
+  result := tagnoframes (subs);
+end;
+
+function THTMLWriter.Startnoframes : THTML_noframes;
+begin
+  result := THTML_noframes (StartElement (THTML_noframes));
+end;
+
+function THTMLWriter.Endnoframes : THTML_noframes;
+begin
+  result := THTML_noframes (EndElement (THTML_noframes));
+end;
+
+{ tag "noscript", alias "noscript" }
+
+function THTMLWriter.tagnoscript (s : string) : THTML_noscript;
+begin
+  result := THTML_noscript (CreateElement (THTML_noscript, s));
+end;
+
+function THTMLWriter.tagnoscript (sub : THTMLCustomElement) : THTML_noscript;
+begin
+  result := THTML_noscript (CreateElement (THTML_noscript, sub));
+end;
+
+function THTMLWriter.tagnoscript (subs : Array of THTMLCustomElement) : THTML_noscript;
+begin
+  result := THTML_noscript (CreateElement (THTML_noscript, subs));
+end;
+
+function THTMLWriter.tagnoscript (subs : TDOMNodelist) : THTML_noscript;
+begin
+  result := THTML_noscript (CreateElement (THTML_noscript, subs));
+end;
+
+function THTMLWriter.noscript (s : string) : THTML_noscript;
+begin
+  result := tagnoscript (s);
+end;
+
+function THTMLWriter.noscript (sub : THTMLCustomElement) : THTML_noscript;
+begin
+  result := tagnoscript (sub);
+end;
+
+function THTMLWriter.noscript (subs : Array of THTMLCustomElement) : THTML_noscript;
+begin
+  result := tagnoscript (subs);
+end;
+
+function THTMLWriter.noscript (subs : TDOMNodelist) : THTML_noscript;
+begin
+  result := tagnoscript (subs);
+end;
+
+function THTMLWriter.Startnoscript : THTML_noscript;
+begin
+  result := THTML_noscript (StartElement (THTML_noscript));
+end;
+
+function THTMLWriter.Endnoscript : THTML_noscript;
+begin
+  result := THTML_noscript (EndElement (THTML_noscript));
+end;
+
+{ tag "object", alias "anobject" }
+
+function THTMLWriter.tagobject (s : string) : THTML_object;
+begin
+  result := THTML_object (CreateElement (THTML_object, s));
+end;
+
+function THTMLWriter.tagobject (sub : THTMLCustomElement) : THTML_object;
+begin
+  result := THTML_object (CreateElement (THTML_object, sub));
+end;
+
+function THTMLWriter.tagobject (subs : Array of THTMLCustomElement) : THTML_object;
+begin
+  result := THTML_object (CreateElement (THTML_object, subs));
+end;
+
+function THTMLWriter.tagobject (subs : TDOMNodelist) : THTML_object;
+begin
+  result := THTML_object (CreateElement (THTML_object, subs));
+end;
+
+function THTMLWriter.anobject (s : string) : THTML_object;
+begin
+  result := tagobject (s);
+end;
+
+function THTMLWriter.anobject (sub : THTMLCustomElement) : THTML_object;
+begin
+  result := tagobject (sub);
+end;
+
+function THTMLWriter.anobject (subs : Array of THTMLCustomElement) : THTML_object;
+begin
+  result := tagobject (subs);
+end;
+
+function THTMLWriter.anobject (subs : TDOMNodelist) : THTML_object;
+begin
+  result := tagobject (subs);
+end;
+
+function THTMLWriter.Startobject : THTML_object;
+begin
+  result := THTML_object (StartElement (THTML_object));
+end;
+
+function THTMLWriter.Endobject : THTML_object;
+begin
+  result := THTML_object (EndElement (THTML_object));
+end;
+
+function THTMLWriter.Startanobject : THTML_object;
+begin
+  result := Startobject;
+end;
+
+function THTMLWriter.Endanobject : THTML_object;
+begin
+  result := Endobject;
+end;
+
+{ tag "ol", alias "orderedlist" }
+
+function THTMLWriter.tagol (s : string) : THTML_ol;
+begin
+  result := THTML_ol (CreateElement (THTML_ol, s));
+end;
+
+function THTMLWriter.tagol (sub : THTMLCustomElement) : THTML_ol;
+begin
+  result := THTML_ol (CreateElement (THTML_ol, sub));
+end;
+
+function THTMLWriter.tagol (subs : Array of THTMLCustomElement) : THTML_ol;
+begin
+  result := THTML_ol (CreateElement (THTML_ol, subs));
+end;
+
+function THTMLWriter.tagol (subs : TDOMNodelist) : THTML_ol;
+begin
+  result := THTML_ol (CreateElement (THTML_ol, subs));
+end;
+
+function THTMLWriter.orderedlist (s : string) : THTML_ol;
+begin
+  result := tagol (s);
+end;
+
+function THTMLWriter.orderedlist (sub : THTMLCustomElement) : THTML_ol;
+begin
+  result := tagol (sub);
+end;
+
+function THTMLWriter.orderedlist (subs : Array of THTMLCustomElement) : THTML_ol;
+begin
+  result := tagol (subs);
+end;
+
+function THTMLWriter.orderedlist (subs : TDOMNodelist) : THTML_ol;
+begin
+  result := tagol (subs);
+end;
+
+function THTMLWriter.Startol : THTML_ol;
+begin
+  result := THTML_ol (StartElement (THTML_ol));
+end;
+
+function THTMLWriter.Endol : THTML_ol;
+begin
+  result := THTML_ol (EndElement (THTML_ol));
+end;
+
+function THTMLWriter.Startorderedlist : THTML_ol;
+begin
+  result := Startol;
+end;
+
+function THTMLWriter.Endorderedlist : THTML_ol;
+begin
+  result := Endol;
+end;
+
+{ tag "optgroup", alias "optiongroup" }
+
+function THTMLWriter.tagoptgroup (s : string) : THTML_optgroup;
+begin
+  result := THTML_optgroup (CreateElement (THTML_optgroup, s));
+end;
+
+function THTMLWriter.tagoptgroup (sub : THTMLCustomElement) : THTML_optgroup;
+begin
+  result := THTML_optgroup (CreateElement (THTML_optgroup, sub));
+end;
+
+function THTMLWriter.tagoptgroup (subs : Array of THTMLCustomElement) : THTML_optgroup;
+begin
+  result := THTML_optgroup (CreateElement (THTML_optgroup, subs));
+end;
+
+function THTMLWriter.tagoptgroup (subs : TDOMNodelist) : THTML_optgroup;
+begin
+  result := THTML_optgroup (CreateElement (THTML_optgroup, subs));
+end;
+
+function THTMLWriter.optiongroup (s : string) : THTML_optgroup;
+begin
+  result := tagoptgroup (s);
+end;
+
+function THTMLWriter.optiongroup (sub : THTMLCustomElement) : THTML_optgroup;
+begin
+  result := tagoptgroup (sub);
+end;
+
+function THTMLWriter.optiongroup (subs : Array of THTMLCustomElement) : THTML_optgroup;
+begin
+  result := tagoptgroup (subs);
+end;
+
+function THTMLWriter.optiongroup (subs : TDOMNodelist) : THTML_optgroup;
+begin
+  result := tagoptgroup (subs);
+end;
+
+function THTMLWriter.Startoptgroup : THTML_optgroup;
+begin
+  result := THTML_optgroup (StartElement (THTML_optgroup));
+end;
+
+function THTMLWriter.Endoptgroup : THTML_optgroup;
+begin
+  result := THTML_optgroup (EndElement (THTML_optgroup));
+end;
+
+function THTMLWriter.Startoptiongroup : THTML_optgroup;
+begin
+  result := Startoptgroup;
+end;
+
+function THTMLWriter.Endoptiongroup : THTML_optgroup;
+begin
+  result := Endoptgroup;
+end;
+
+{ tag "option", alias "option" }
+
+function THTMLWriter.tagoption (s : string) : THTML_option;
+begin
+  result := THTML_option (CreateElement (THTML_option, s));
+end;
+
+function THTMLWriter.tagoption (sub : THTMLCustomElement) : THTML_option;
+begin
+  result := THTML_option (CreateElement (THTML_option, sub));
+end;
+
+function THTMLWriter.tagoption (subs : Array of THTMLCustomElement) : THTML_option;
+begin
+  result := THTML_option (CreateElement (THTML_option, subs));
+end;
+
+function THTMLWriter.tagoption (subs : TDOMNodelist) : THTML_option;
+begin
+  result := THTML_option (CreateElement (THTML_option, subs));
+end;
+
+function THTMLWriter.option (s : string) : THTML_option;
+begin
+  result := tagoption (s);
+end;
+
+function THTMLWriter.option (sub : THTMLCustomElement) : THTML_option;
+begin
+  result := tagoption (sub);
+end;
+
+function THTMLWriter.option (subs : Array of THTMLCustomElement) : THTML_option;
+begin
+  result := tagoption (subs);
+end;
+
+function THTMLWriter.option (subs : TDOMNodelist) : THTML_option;
+begin
+  result := tagoption (subs);
+end;
+
+function THTMLWriter.Startoption : THTML_option;
+begin
+  result := THTML_option (StartElement (THTML_option));
+end;
+
+function THTMLWriter.Endoption : THTML_option;
+begin
+  result := THTML_option (EndElement (THTML_option));
+end;
+
+{ tag "p", alias "paragraph" }
+
+function THTMLWriter.tagp (s : string) : THTML_p;
+begin
+  result := THTML_p (CreateElement (THTML_p, s));
+end;
+
+function THTMLWriter.tagp (sub : THTMLCustomElement) : THTML_p;
+begin
+  result := THTML_p (CreateElement (THTML_p, sub));
+end;
+
+function THTMLWriter.tagp (subs : Array of THTMLCustomElement) : THTML_p;
+begin
+  result := THTML_p (CreateElement (THTML_p, subs));
+end;
+
+function THTMLWriter.tagp (subs : TDOMNodelist) : THTML_p;
+begin
+  result := THTML_p (CreateElement (THTML_p, subs));
+end;
+
+function THTMLWriter.paragraph (s : string) : THTML_p;
+begin
+  result := tagp (s);
+end;
+
+function THTMLWriter.paragraph (sub : THTMLCustomElement) : THTML_p;
+begin
+  result := tagp (sub);
+end;
+
+function THTMLWriter.paragraph (subs : Array of THTMLCustomElement) : THTML_p;
+begin
+  result := tagp (subs);
+end;
+
+function THTMLWriter.paragraph (subs : TDOMNodelist) : THTML_p;
+begin
+  result := tagp (subs);
+end;
+
+function THTMLWriter.Startp : THTML_p;
+begin
+  result := THTML_p (StartElement (THTML_p));
+end;
+
+function THTMLWriter.Endp : THTML_p;
+begin
+  result := THTML_p (EndElement (THTML_p));
+end;
+
+function THTMLWriter.Startparagraph : THTML_p;
+begin
+  result := Startp;
+end;
+
+function THTMLWriter.Endparagraph : THTML_p;
+begin
+  result := Endp;
+end;
+
+{ tag "param", alias "parameter" }
+
+function THTMLWriter.tagparam : THTML_param;
+begin
+  result := THTML_param (AddElement (THTML_param));
+end;
+
+function THTMLWriter.parameter : THTML_param;
+begin
+  result := tagparam;
+end;
+
+{ tag "pre", alias "preformatted" }
+
+function THTMLWriter.tagpre (s : string) : THTML_pre;
+begin
+  result := THTML_pre (CreateElement (THTML_pre, s));
+end;
+
+function THTMLWriter.tagpre (sub : THTMLCustomElement) : THTML_pre;
+begin
+  result := THTML_pre (CreateElement (THTML_pre, sub));
+end;
+
+function THTMLWriter.tagpre (subs : Array of THTMLCustomElement) : THTML_pre;
+begin
+  result := THTML_pre (CreateElement (THTML_pre, subs));
+end;
+
+function THTMLWriter.tagpre (subs : TDOMNodelist) : THTML_pre;
+begin
+  result := THTML_pre (CreateElement (THTML_pre, subs));
+end;
+
+function THTMLWriter.preformatted (s : string) : THTML_pre;
+begin
+  result := tagpre (s);
+end;
+
+function THTMLWriter.preformatted (sub : THTMLCustomElement) : THTML_pre;
+begin
+  result := tagpre (sub);
+end;
+
+function THTMLWriter.preformatted (subs : Array of THTMLCustomElement) : THTML_pre;
+begin
+  result := tagpre (subs);
+end;
+
+function THTMLWriter.preformatted (subs : TDOMNodelist) : THTML_pre;
+begin
+  result := tagpre (subs);
+end;
+
+function THTMLWriter.Startpre : THTML_pre;
+begin
+  result := THTML_pre (StartElement (THTML_pre));
+end;
+
+function THTMLWriter.Endpre : THTML_pre;
+begin
+  result := THTML_pre (EndElement (THTML_pre));
+end;
+
+function THTMLWriter.Startpreformatted : THTML_pre;
+begin
+  result := Startpre;
+end;
+
+function THTMLWriter.Endpreformatted : THTML_pre;
+begin
+  result := Endpre;
+end;
+
+{ tag "q", alias "quotation" }
+
+function THTMLWriter.tagq (s : string) : THTML_q;
+begin
+  result := THTML_q (CreateElement (THTML_q, s));
+end;
+
+function THTMLWriter.tagq (sub : THTMLCustomElement) : THTML_q;
+begin
+  result := THTML_q (CreateElement (THTML_q, sub));
+end;
+
+function THTMLWriter.tagq (subs : Array of THTMLCustomElement) : THTML_q;
+begin
+  result := THTML_q (CreateElement (THTML_q, subs));
+end;
+
+function THTMLWriter.tagq (subs : TDOMNodelist) : THTML_q;
+begin
+  result := THTML_q (CreateElement (THTML_q, subs));
+end;
+
+function THTMLWriter.quotation (s : string) : THTML_q;
+begin
+  result := tagq (s);
+end;
+
+function THTMLWriter.quotation (sub : THTMLCustomElement) : THTML_q;
+begin
+  result := tagq (sub);
+end;
+
+function THTMLWriter.quotation (subs : Array of THTMLCustomElement) : THTML_q;
+begin
+  result := tagq (subs);
+end;
+
+function THTMLWriter.quotation (subs : TDOMNodelist) : THTML_q;
+begin
+  result := tagq (subs);
+end;
+
+function THTMLWriter.Startq : THTML_q;
+begin
+  result := THTML_q (StartElement (THTML_q));
+end;
+
+function THTMLWriter.Endq : THTML_q;
+begin
+  result := THTML_q (EndElement (THTML_q));
+end;
+
+function THTMLWriter.Startquotation : THTML_q;
+begin
+  result := Startq;
+end;
+
+function THTMLWriter.Endquotation : THTML_q;
+begin
+  result := Endq;
+end;
+
+{ tag "s", alias "strikethrough" }
+
+function THTMLWriter.tags (s : string) : THTML_s;
+begin
+  result := THTML_s (CreateElement (THTML_s, s));
+end;
+
+function THTMLWriter.tags (sub : THTMLCustomElement) : THTML_s;
+begin
+  result := THTML_s (CreateElement (THTML_s, sub));
+end;
+
+function THTMLWriter.tags (subs : Array of THTMLCustomElement) : THTML_s;
+begin
+  result := THTML_s (CreateElement (THTML_s, subs));
+end;
+
+function THTMLWriter.tags (subs : TDOMNodelist) : THTML_s;
+begin
+  result := THTML_s (CreateElement (THTML_s, subs));
+end;
+
+function THTMLWriter.strikethrough (s : string) : THTML_s;
+begin
+  result := tags (s);
+end;
+
+function THTMLWriter.strikethrough (sub : THTMLCustomElement) : THTML_s;
+begin
+  result := tags (sub);
+end;
+
+function THTMLWriter.strikethrough (subs : Array of THTMLCustomElement) : THTML_s;
+begin
+  result := tags (subs);
+end;
+
+function THTMLWriter.strikethrough (subs : TDOMNodelist) : THTML_s;
+begin
+  result := tags (subs);
+end;
+
+function THTMLWriter.Starts : THTML_s;
+begin
+  result := THTML_s (StartElement (THTML_s));
+end;
+
+function THTMLWriter.Ends : THTML_s;
+begin
+  result := THTML_s (EndElement (THTML_s));
+end;
+
+function THTMLWriter.Startstrikethrough : THTML_s;
+begin
+  result := Starts;
+end;
+
+function THTMLWriter.Endstrikethrough : THTML_s;
+begin
+  result := Ends;
+end;
+
+{ tag "samp", alias "sample" }
+
+function THTMLWriter.tagsamp (s : string) : THTML_samp;
+begin
+  result := THTML_samp (CreateElement (THTML_samp, s));
+end;
+
+function THTMLWriter.tagsamp (sub : THTMLCustomElement) : THTML_samp;
+begin
+  result := THTML_samp (CreateElement (THTML_samp, sub));
+end;
+
+function THTMLWriter.tagsamp (subs : Array of THTMLCustomElement) : THTML_samp;
+begin
+  result := THTML_samp (CreateElement (THTML_samp, subs));
+end;
+
+function THTMLWriter.tagsamp (subs : TDOMNodelist) : THTML_samp;
+begin
+  result := THTML_samp (CreateElement (THTML_samp, subs));
+end;
+
+function THTMLWriter.sample (s : string) : THTML_samp;
+begin
+  result := tagsamp (s);
+end;
+
+function THTMLWriter.sample (sub : THTMLCustomElement) : THTML_samp;
+begin
+  result := tagsamp (sub);
+end;
+
+function THTMLWriter.sample (subs : Array of THTMLCustomElement) : THTML_samp;
+begin
+  result := tagsamp (subs);
+end;
+
+function THTMLWriter.sample (subs : TDOMNodelist) : THTML_samp;
+begin
+  result := tagsamp (subs);
+end;
+
+function THTMLWriter.Startsamp : THTML_samp;
+begin
+  result := THTML_samp (StartElement (THTML_samp));
+end;
+
+function THTMLWriter.Endsamp : THTML_samp;
+begin
+  result := THTML_samp (EndElement (THTML_samp));
+end;
+
+function THTMLWriter.Startsample : THTML_samp;
+begin
+  result := Startsamp;
+end;
+
+function THTMLWriter.Endsample : THTML_samp;
+begin
+  result := Endsamp;
+end;
+
+{ tag "script", alias "script" }
+
+function THTMLWriter.tagscript (s : string) : THTML_script;
+begin
+  result := THTML_script (CreateElement (THTML_script, s));
+end;
+
+function THTMLWriter.tagscript (sub : THTMLCustomElement) : THTML_script;
+begin
+  result := THTML_script (CreateElement (THTML_script, sub));
+end;
+
+function THTMLWriter.tagscript (subs : Array of THTMLCustomElement) : THTML_script;
+begin
+  result := THTML_script (CreateElement (THTML_script, subs));
+end;
+
+function THTMLWriter.tagscript (subs : TDOMNodelist) : THTML_script;
+begin
+  result := THTML_script (CreateElement (THTML_script, subs));
+end;
+
+function THTMLWriter.script (s : string) : THTML_script;
+begin
+  result := tagscript (s);
+end;
+
+function THTMLWriter.script (sub : THTMLCustomElement) : THTML_script;
+begin
+  result := tagscript (sub);
+end;
+
+function THTMLWriter.script (subs : Array of THTMLCustomElement) : THTML_script;
+begin
+  result := tagscript (subs);
+end;
+
+function THTMLWriter.script (subs : TDOMNodelist) : THTML_script;
+begin
+  result := tagscript (subs);
+end;
+
+function THTMLWriter.Startscript : THTML_script;
+begin
+  result := THTML_script (StartElement (THTML_script));
+end;
+
+function THTMLWriter.Endscript : THTML_script;
+begin
+  result := THTML_script (EndElement (THTML_script));
+end;
+
+{ tag "select", alias "select" }
+
+function THTMLWriter.tagselect (s : string) : THTML_select;
+begin
+  result := THTML_select (CreateElement (THTML_select, s));
+end;
+
+function THTMLWriter.tagselect (sub : THTMLCustomElement) : THTML_select;
+begin
+  result := THTML_select (CreateElement (THTML_select, sub));
+end;
+
+function THTMLWriter.tagselect (subs : Array of THTMLCustomElement) : THTML_select;
+begin
+  result := THTML_select (CreateElement (THTML_select, subs));
+end;
+
+function THTMLWriter.tagselect (subs : TDOMNodelist) : THTML_select;
+begin
+  result := THTML_select (CreateElement (THTML_select, subs));
+end;
+
+function THTMLWriter.select (s : string) : THTML_select;
+begin
+  result := tagselect (s);
+end;
+
+function THTMLWriter.select (sub : THTMLCustomElement) : THTML_select;
+begin
+  result := tagselect (sub);
+end;
+
+function THTMLWriter.select (subs : Array of THTMLCustomElement) : THTML_select;
+begin
+  result := tagselect (subs);
+end;
+
+function THTMLWriter.select (subs : TDOMNodelist) : THTML_select;
+begin
+  result := tagselect (subs);
+end;
+
+function THTMLWriter.Startselect : THTML_select;
+begin
+  result := THTML_select (StartElement (THTML_select));
+end;
+
+function THTMLWriter.Endselect : THTML_select;
+begin
+  result := THTML_select (EndElement (THTML_select));
+end;
+
+{ tag "small", alias "small" }
+
+function THTMLWriter.tagsmall (s : string) : THTML_small;
+begin
+  result := THTML_small (CreateElement (THTML_small, s));
+end;
+
+function THTMLWriter.tagsmall (sub : THTMLCustomElement) : THTML_small;
+begin
+  result := THTML_small (CreateElement (THTML_small, sub));
+end;
+
+function THTMLWriter.tagsmall (subs : Array of THTMLCustomElement) : THTML_small;
+begin
+  result := THTML_small (CreateElement (THTML_small, subs));
+end;
+
+function THTMLWriter.tagsmall (subs : TDOMNodelist) : THTML_small;
+begin
+  result := THTML_small (CreateElement (THTML_small, subs));
+end;
+
+function THTMLWriter.small (s : string) : THTML_small;
+begin
+  result := tagsmall (s);
+end;
+
+function THTMLWriter.small (sub : THTMLCustomElement) : THTML_small;
+begin
+  result := tagsmall (sub);
+end;
+
+function THTMLWriter.small (subs : Array of THTMLCustomElement) : THTML_small;
+begin
+  result := tagsmall (subs);
+end;
+
+function THTMLWriter.small (subs : TDOMNodelist) : THTML_small;
+begin
+  result := tagsmall (subs);
+end;
+
+function THTMLWriter.Startsmall : THTML_small;
+begin
+  result := THTML_small (StartElement (THTML_small));
+end;
+
+function THTMLWriter.Endsmall : THTML_small;
+begin
+  result := THTML_small (EndElement (THTML_small));
+end;
+
+{ tag "span", alias "span" }
+
+function THTMLWriter.tagspan (s : string) : THTML_span;
+begin
+  result := THTML_span (CreateElement (THTML_span, s));
+end;
+
+function THTMLWriter.tagspan (sub : THTMLCustomElement) : THTML_span;
+begin
+  result := THTML_span (CreateElement (THTML_span, sub));
+end;
+
+function THTMLWriter.tagspan (subs : Array of THTMLCustomElement) : THTML_span;
+begin
+  result := THTML_span (CreateElement (THTML_span, subs));
+end;
+
+function THTMLWriter.tagspan (subs : TDOMNodelist) : THTML_span;
+begin
+  result := THTML_span (CreateElement (THTML_span, subs));
+end;
+
+function THTMLWriter.span (s : string) : THTML_span;
+begin
+  result := tagspan (s);
+end;
+
+function THTMLWriter.span (sub : THTMLCustomElement) : THTML_span;
+begin
+  result := tagspan (sub);
+end;
+
+function THTMLWriter.span (subs : Array of THTMLCustomElement) : THTML_span;
+begin
+  result := tagspan (subs);
+end;
+
+function THTMLWriter.span (subs : TDOMNodelist) : THTML_span;
+begin
+  result := tagspan (subs);
+end;
+
+function THTMLWriter.Startspan : THTML_span;
+begin
+  result := THTML_span (StartElement (THTML_span));
+end;
+
+function THTMLWriter.Endspan : THTML_span;
+begin
+  result := THTML_span (EndElement (THTML_span));
+end;
+
+{ tag "strike", alias "strike" }
+
+function THTMLWriter.tagstrike (s : string) : THTML_strike;
+begin
+  result := THTML_strike (CreateElement (THTML_strike, s));
+end;
+
+function THTMLWriter.tagstrike (sub : THTMLCustomElement) : THTML_strike;
+begin
+  result := THTML_strike (CreateElement (THTML_strike, sub));
+end;
+
+function THTMLWriter.tagstrike (subs : Array of THTMLCustomElement) : THTML_strike;
+begin
+  result := THTML_strike (CreateElement (THTML_strike, subs));
+end;
+
+function THTMLWriter.tagstrike (subs : TDOMNodelist) : THTML_strike;
+begin
+  result := THTML_strike (CreateElement (THTML_strike, subs));
+end;
+
+function THTMLWriter.strike (s : string) : THTML_strike;
+begin
+  result := tagstrike (s);
+end;
+
+function THTMLWriter.strike (sub : THTMLCustomElement) : THTML_strike;
+begin
+  result := tagstrike (sub);
+end;
+
+function THTMLWriter.strike (subs : Array of THTMLCustomElement) : THTML_strike;
+begin
+  result := tagstrike (subs);
+end;
+
+function THTMLWriter.strike (subs : TDOMNodelist) : THTML_strike;
+begin
+  result := tagstrike (subs);
+end;
+
+function THTMLWriter.Startstrike : THTML_strike;
+begin
+  result := THTML_strike (StartElement (THTML_strike));
+end;
+
+function THTMLWriter.Endstrike : THTML_strike;
+begin
+  result := THTML_strike (EndElement (THTML_strike));
+end;
+
+{ tag "strong", alias "strong" }
+
+function THTMLWriter.tagstrong (s : string) : THTML_strong;
+begin
+  result := THTML_strong (CreateElement (THTML_strong, s));
+end;
+
+function THTMLWriter.tagstrong (sub : THTMLCustomElement) : THTML_strong;
+begin
+  result := THTML_strong (CreateElement (THTML_strong, sub));
+end;
+
+function THTMLWriter.tagstrong (subs : Array of THTMLCustomElement) : THTML_strong;
+begin
+  result := THTML_strong (CreateElement (THTML_strong, subs));
+end;
+
+function THTMLWriter.tagstrong (subs : TDOMNodelist) : THTML_strong;
+begin
+  result := THTML_strong (CreateElement (THTML_strong, subs));
+end;
+
+function THTMLWriter.strong (s : string) : THTML_strong;
+begin
+  result := tagstrong (s);
+end;
+
+function THTMLWriter.strong (sub : THTMLCustomElement) : THTML_strong;
+begin
+  result := tagstrong (sub);
+end;
+
+function THTMLWriter.strong (subs : Array of THTMLCustomElement) : THTML_strong;
+begin
+  result := tagstrong (subs);
+end;
+
+function THTMLWriter.strong (subs : TDOMNodelist) : THTML_strong;
+begin
+  result := tagstrong (subs);
+end;
+
+function THTMLWriter.Startstrong : THTML_strong;
+begin
+  result := THTML_strong (StartElement (THTML_strong));
+end;
+
+function THTMLWriter.Endstrong : THTML_strong;
+begin
+  result := THTML_strong (EndElement (THTML_strong));
+end;
+
+{ tag "style", alias "style" }
+
+function THTMLWriter.tagstyle (s : string) : THTML_style;
+begin
+  result := THTML_style (CreateElement (THTML_style, s));
+end;
+
+function THTMLWriter.tagstyle (sub : THTMLCustomElement) : THTML_style;
+begin
+  result := THTML_style (CreateElement (THTML_style, sub));
+end;
+
+function THTMLWriter.tagstyle (subs : Array of THTMLCustomElement) : THTML_style;
+begin
+  result := THTML_style (CreateElement (THTML_style, subs));
+end;
+
+function THTMLWriter.tagstyle (subs : TDOMNodelist) : THTML_style;
+begin
+  result := THTML_style (CreateElement (THTML_style, subs));
+end;
+
+function THTMLWriter.style (s : string) : THTML_style;
+begin
+  result := tagstyle (s);
+end;
+
+function THTMLWriter.style (sub : THTMLCustomElement) : THTML_style;
+begin
+  result := tagstyle (sub);
+end;
+
+function THTMLWriter.style (subs : Array of THTMLCustomElement) : THTML_style;
+begin
+  result := tagstyle (subs);
+end;
+
+function THTMLWriter.style (subs : TDOMNodelist) : THTML_style;
+begin
+  result := tagstyle (subs);
+end;
+
+function THTMLWriter.Startstyle : THTML_style;
+begin
+  result := THTML_style (StartElement (THTML_style));
+end;
+
+function THTMLWriter.Endstyle : THTML_style;
+begin
+  result := THTML_style (EndElement (THTML_style));
+end;
+
+{ tag "sub", alias "subscript" }
+
+function THTMLWriter.tagsub (s : string) : THTML_sub;
+begin
+  result := THTML_sub (CreateElement (THTML_sub, s));
+end;
+
+function THTMLWriter.tagsub (sub : THTMLCustomElement) : THTML_sub;
+begin
+  result := THTML_sub (CreateElement (THTML_sub, sub));
+end;
+
+function THTMLWriter.tagsub (subs : Array of THTMLCustomElement) : THTML_sub;
+begin
+  result := THTML_sub (CreateElement (THTML_sub, subs));
+end;
+
+function THTMLWriter.tagsub (subs : TDOMNodelist) : THTML_sub;
+begin
+  result := THTML_sub (CreateElement (THTML_sub, subs));
+end;
+
+function THTMLWriter.subscript (s : string) : THTML_sub;
+begin
+  result := tagsub (s);
+end;
+
+function THTMLWriter.subscript (sub : THTMLCustomElement) : THTML_sub;
+begin
+  result := tagsub (sub);
+end;
+
+function THTMLWriter.subscript (subs : Array of THTMLCustomElement) : THTML_sub;
+begin
+  result := tagsub (subs);
+end;
+
+function THTMLWriter.subscript (subs : TDOMNodelist) : THTML_sub;
+begin
+  result := tagsub (subs);
+end;
+
+function THTMLWriter.Startsub : THTML_sub;
+begin
+  result := THTML_sub (StartElement (THTML_sub));
+end;
+
+function THTMLWriter.Endsub : THTML_sub;
+begin
+  result := THTML_sub (EndElement (THTML_sub));
+end;
+
+function THTMLWriter.Startsubscript : THTML_sub;
+begin
+  result := Startsub;
+end;
+
+function THTMLWriter.Endsubscript : THTML_sub;
+begin
+  result := Endsub;
+end;
+
+{ tag "sup", alias "superscript" }
+
+function THTMLWriter.tagsup (s : string) : THTML_sup;
+begin
+  result := THTML_sup (CreateElement (THTML_sup, s));
+end;
+
+function THTMLWriter.tagsup (sub : THTMLCustomElement) : THTML_sup;
+begin
+  result := THTML_sup (CreateElement (THTML_sup, sub));
+end;
+
+function THTMLWriter.tagsup (subs : Array of THTMLCustomElement) : THTML_sup;
+begin
+  result := THTML_sup (CreateElement (THTML_sup, subs));
+end;
+
+function THTMLWriter.tagsup (subs : TDOMNodelist) : THTML_sup;
+begin
+  result := THTML_sup (CreateElement (THTML_sup, subs));
+end;
+
+function THTMLWriter.superscript (s : string) : THTML_sup;
+begin
+  result := tagsup (s);
+end;
+
+function THTMLWriter.superscript (sub : THTMLCustomElement) : THTML_sup;
+begin
+  result := tagsup (sub);
+end;
+
+function THTMLWriter.superscript (subs : Array of THTMLCustomElement) : THTML_sup;
+begin
+  result := tagsup (subs);
+end;
+
+function THTMLWriter.superscript (subs : TDOMNodelist) : THTML_sup;
+begin
+  result := tagsup (subs);
+end;
+
+function THTMLWriter.Startsup : THTML_sup;
+begin
+  result := THTML_sup (StartElement (THTML_sup));
+end;
+
+function THTMLWriter.Endsup : THTML_sup;
+begin
+  result := THTML_sup (EndElement (THTML_sup));
+end;
+
+function THTMLWriter.Startsuperscript : THTML_sup;
+begin
+  result := Startsup;
+end;
+
+function THTMLWriter.Endsuperscript : THTML_sup;
+begin
+  result := Endsup;
+end;
+
+{ tag "table", alias "table" }
+
+function THTMLWriter.tagtable (s : string) : THTML_table;
+begin
+  result := THTML_table (CreateElement (THTML_table, s));
+end;
+
+function THTMLWriter.tagtable (sub : THTMLCustomElement) : THTML_table;
+begin
+  result := THTML_table (CreateElement (THTML_table, sub));
+end;
+
+function THTMLWriter.tagtable (subs : Array of THTMLCustomElement) : THTML_table;
+begin
+  result := THTML_table (CreateElement (THTML_table, subs));
+end;
+
+function THTMLWriter.tagtable (subs : TDOMNodelist) : THTML_table;
+begin
+  result := THTML_table (CreateElement (THTML_table, subs));
+end;
+
+function THTMLWriter.table (s : string) : THTML_table;
+begin
+  result := tagtable (s);
+end;
+
+function THTMLWriter.table (sub : THTMLCustomElement) : THTML_table;
+begin
+  result := tagtable (sub);
+end;
+
+function THTMLWriter.table (subs : Array of THTMLCustomElement) : THTML_table;
+begin
+  result := tagtable (subs);
+end;
+
+function THTMLWriter.table (subs : TDOMNodelist) : THTML_table;
+begin
+  result := tagtable (subs);
+end;
+
+function THTMLWriter.Starttable : THTML_table;
+begin
+  result := THTML_table (StartElement (THTML_table));
+end;
+
+function THTMLWriter.Endtable : THTML_table;
+begin
+  result := THTML_table (EndElement (THTML_table));
+end;
+
+{ tag "tbody", alias "tablebody" }
+
+function THTMLWriter.tagtbody (s : string) : THTML_tbody;
+begin
+  result := THTML_tbody (CreateElement (THTML_tbody, s));
+end;
+
+function THTMLWriter.tagtbody (sub : THTMLCustomElement) : THTML_tbody;
+begin
+  result := THTML_tbody (CreateElement (THTML_tbody, sub));
+end;
+
+function THTMLWriter.tagtbody (subs : Array of THTMLCustomElement) : THTML_tbody;
+begin
+  result := THTML_tbody (CreateElement (THTML_tbody, subs));
+end;
+
+function THTMLWriter.tagtbody (subs : TDOMNodelist) : THTML_tbody;
+begin
+  result := THTML_tbody (CreateElement (THTML_tbody, subs));
+end;
+
+function THTMLWriter.tablebody (s : string) : THTML_tbody;
+begin
+  result := tagtbody (s);
+end;
+
+function THTMLWriter.tablebody (sub : THTMLCustomElement) : THTML_tbody;
+begin
+  result := tagtbody (sub);
+end;
+
+function THTMLWriter.tablebody (subs : Array of THTMLCustomElement) : THTML_tbody;
+begin
+  result := tagtbody (subs);
+end;
+
+function THTMLWriter.tablebody (subs : TDOMNodelist) : THTML_tbody;
+begin
+  result := tagtbody (subs);
+end;
+
+function THTMLWriter.Starttbody : THTML_tbody;
+begin
+  result := THTML_tbody (StartElement (THTML_tbody));
+end;
+
+function THTMLWriter.Endtbody : THTML_tbody;
+begin
+  result := THTML_tbody (EndElement (THTML_tbody));
+end;
+
+function THTMLWriter.Starttablebody : THTML_tbody;
+begin
+  result := Starttbody;
+end;
+
+function THTMLWriter.Endtablebody : THTML_tbody;
+begin
+  result := Endtbody;
+end;
+
+{ tag "td", alias "tablecell" }
+
+function THTMLWriter.tagtd (s : string) : THTML_td;
+begin
+  result := THTML_td (CreateElement (THTML_td, s));
+end;
+
+function THTMLWriter.tagtd (sub : THTMLCustomElement) : THTML_td;
+begin
+  result := THTML_td (CreateElement (THTML_td, sub));
+end;
+
+function THTMLWriter.tagtd (subs : Array of THTMLCustomElement) : THTML_td;
+begin
+  result := THTML_td (CreateElement (THTML_td, subs));
+end;
+
+function THTMLWriter.tagtd (subs : TDOMNodelist) : THTML_td;
+begin
+  result := THTML_td (CreateElement (THTML_td, subs));
+end;
+
+function THTMLWriter.tablecell (s : string) : THTML_td;
+begin
+  result := tagtd (s);
+end;
+
+function THTMLWriter.tablecell (sub : THTMLCustomElement) : THTML_td;
+begin
+  result := tagtd (sub);
+end;
+
+function THTMLWriter.tablecell (subs : Array of THTMLCustomElement) : THTML_td;
+begin
+  result := tagtd (subs);
+end;
+
+function THTMLWriter.tablecell (subs : TDOMNodelist) : THTML_td;
+begin
+  result := tagtd (subs);
+end;
+
+function THTMLWriter.Starttd : THTML_td;
+begin
+  result := THTML_td (StartElement (THTML_td));
+end;
+
+function THTMLWriter.Endtd : THTML_td;
+begin
+  result := THTML_td (EndElement (THTML_td));
+end;
+
+function THTMLWriter.Starttablecell : THTML_td;
+begin
+  result := Starttd;
+end;
+
+function THTMLWriter.Endtablecell : THTML_td;
+begin
+  result := Endtd;
+end;
+
+{ tag "textarea", alias "textarea" }
+
+function THTMLWriter.tagtextarea (s : string) : THTML_textarea;
+begin
+  result := THTML_textarea (CreateElement (THTML_textarea, s));
+end;
+
+function THTMLWriter.tagtextarea (sub : THTMLCustomElement) : THTML_textarea;
+begin
+  result := THTML_textarea (CreateElement (THTML_textarea, sub));
+end;
+
+function THTMLWriter.tagtextarea (subs : Array of THTMLCustomElement) : THTML_textarea;
+begin
+  result := THTML_textarea (CreateElement (THTML_textarea, subs));
+end;
+
+function THTMLWriter.tagtextarea (subs : TDOMNodelist) : THTML_textarea;
+begin
+  result := THTML_textarea (CreateElement (THTML_textarea, subs));
+end;
+
+function THTMLWriter.textarea (s : string) : THTML_textarea;
+begin
+  result := tagtextarea (s);
+end;
+
+function THTMLWriter.textarea (sub : THTMLCustomElement) : THTML_textarea;
+begin
+  result := tagtextarea (sub);
+end;
+
+function THTMLWriter.textarea (subs : Array of THTMLCustomElement) : THTML_textarea;
+begin
+  result := tagtextarea (subs);
+end;
+
+function THTMLWriter.textarea (subs : TDOMNodelist) : THTML_textarea;
+begin
+  result := tagtextarea (subs);
+end;
+
+function THTMLWriter.Starttextarea : THTML_textarea;
+begin
+  result := THTML_textarea (StartElement (THTML_textarea));
+end;
+
+function THTMLWriter.Endtextarea : THTML_textarea;
+begin
+  result := THTML_textarea (EndElement (THTML_textarea));
+end;
+
+{ tag "tfoot", alias "tablefoot" }
+
+function THTMLWriter.tagtfoot (s : string) : THTML_tfoot;
+begin
+  result := THTML_tfoot (CreateElement (THTML_tfoot, s));
+end;
+
+function THTMLWriter.tagtfoot (sub : THTMLCustomElement) : THTML_tfoot;
+begin
+  result := THTML_tfoot (CreateElement (THTML_tfoot, sub));
+end;
+
+function THTMLWriter.tagtfoot (subs : Array of THTMLCustomElement) : THTML_tfoot;
+begin
+  result := THTML_tfoot (CreateElement (THTML_tfoot, subs));
+end;
+
+function THTMLWriter.tagtfoot (subs : TDOMNodelist) : THTML_tfoot;
+begin
+  result := THTML_tfoot (CreateElement (THTML_tfoot, subs));
+end;
+
+function THTMLWriter.tablefoot (s : string) : THTML_tfoot;
+begin
+  result := tagtfoot (s);
+end;
+
+function THTMLWriter.tablefoot (sub : THTMLCustomElement) : THTML_tfoot;
+begin
+  result := tagtfoot (sub);
+end;
+
+function THTMLWriter.tablefoot (subs : Array of THTMLCustomElement) : THTML_tfoot;
+begin
+  result := tagtfoot (subs);
+end;
+
+function THTMLWriter.tablefoot (subs : TDOMNodelist) : THTML_tfoot;
+begin
+  result := tagtfoot (subs);
+end;
+
+function THTMLWriter.Starttfoot : THTML_tfoot;
+begin
+  result := THTML_tfoot (StartElement (THTML_tfoot));
+end;
+
+function THTMLWriter.Endtfoot : THTML_tfoot;
+begin
+  result := THTML_tfoot (EndElement (THTML_tfoot));
+end;
+
+function THTMLWriter.Starttablefoot : THTML_tfoot;
+begin
+  result := Starttfoot;
+end;
+
+function THTMLWriter.Endtablefoot : THTML_tfoot;
+begin
+  result := Endtfoot;
+end;
+
+{ tag "th", alias "tableheadcell" }
+
+function THTMLWriter.tagth (s : string) : THTML_th;
+begin
+  result := THTML_th (CreateElement (THTML_th, s));
+end;
+
+function THTMLWriter.tagth (sub : THTMLCustomElement) : THTML_th;
+begin
+  result := THTML_th (CreateElement (THTML_th, sub));
+end;
+
+function THTMLWriter.tagth (subs : Array of THTMLCustomElement) : THTML_th;
+begin
+  result := THTML_th (CreateElement (THTML_th, subs));
+end;
+
+function THTMLWriter.tagth (subs : TDOMNodelist) : THTML_th;
+begin
+  result := THTML_th (CreateElement (THTML_th, subs));
+end;
+
+function THTMLWriter.tableheadcell (s : string) : THTML_th;
+begin
+  result := tagth (s);
+end;
+
+function THTMLWriter.tableheadcell (sub : THTMLCustomElement) : THTML_th;
+begin
+  result := tagth (sub);
+end;
+
+function THTMLWriter.tableheadcell (subs : Array of THTMLCustomElement) : THTML_th;
+begin
+  result := tagth (subs);
+end;
+
+function THTMLWriter.tableheadcell (subs : TDOMNodelist) : THTML_th;
+begin
+  result := tagth (subs);
+end;
+
+function THTMLWriter.Startth : THTML_th;
+begin
+  result := THTML_th (StartElement (THTML_th));
+end;
+
+function THTMLWriter.Endth : THTML_th;
+begin
+  result := THTML_th (EndElement (THTML_th));
+end;
+
+function THTMLWriter.Starttableheadcell : THTML_th;
+begin
+  result := Startth;
+end;
+
+function THTMLWriter.Endtableheadcell : THTML_th;
+begin
+  result := Endth;
+end;
+
+{ tag "thead", alias "tablehead" }
+
+function THTMLWriter.tagthead (s : string) : THTML_thead;
+begin
+  result := THTML_thead (CreateElement (THTML_thead, s));
+end;
+
+function THTMLWriter.tagthead (sub : THTMLCustomElement) : THTML_thead;
+begin
+  result := THTML_thead (CreateElement (THTML_thead, sub));
+end;
+
+function THTMLWriter.tagthead (subs : Array of THTMLCustomElement) : THTML_thead;
+begin
+  result := THTML_thead (CreateElement (THTML_thead, subs));
+end;
+
+function THTMLWriter.tagthead (subs : TDOMNodelist) : THTML_thead;
+begin
+  result := THTML_thead (CreateElement (THTML_thead, subs));
+end;
+
+function THTMLWriter.tablehead (s : string) : THTML_thead;
+begin
+  result := tagthead (s);
+end;
+
+function THTMLWriter.tablehead (sub : THTMLCustomElement) : THTML_thead;
+begin
+  result := tagthead (sub);
+end;
+
+function THTMLWriter.tablehead (subs : Array of THTMLCustomElement) : THTML_thead;
+begin
+  result := tagthead (subs);
+end;
+
+function THTMLWriter.tablehead (subs : TDOMNodelist) : THTML_thead;
+begin
+  result := tagthead (subs);
+end;
+
+function THTMLWriter.Startthead : THTML_thead;
+begin
+  result := THTML_thead (StartElement (THTML_thead));
+end;
+
+function THTMLWriter.Endthead : THTML_thead;
+begin
+  result := THTML_thead (EndElement (THTML_thead));
+end;
+
+function THTMLWriter.Starttablehead : THTML_thead;
+begin
+  result := Startthead;
+end;
+
+function THTMLWriter.Endtablehead : THTML_thead;
+begin
+  result := Endthead;
+end;
+
+{ tag "title", alias "title" }
+
+function THTMLWriter.tagtitle (s : string) : THTML_title;
+begin
+  result := THTML_title (CreateElement (THTML_title, s));
+end;
+
+function THTMLWriter.tagtitle (sub : THTMLCustomElement) : THTML_title;
+begin
+  result := THTML_title (CreateElement (THTML_title, sub));
+end;
+
+function THTMLWriter.tagtitle (subs : Array of THTMLCustomElement) : THTML_title;
+begin
+  result := THTML_title (CreateElement (THTML_title, subs));
+end;
+
+function THTMLWriter.tagtitle (subs : TDOMNodelist) : THTML_title;
+begin
+  result := THTML_title (CreateElement (THTML_title, subs));
+end;
+
+function THTMLWriter.title (s : string) : THTML_title;
+begin
+  result := tagtitle (s);
+end;
+
+function THTMLWriter.title (sub : THTMLCustomElement) : THTML_title;
+begin
+  result := tagtitle (sub);
+end;
+
+function THTMLWriter.title (subs : Array of THTMLCustomElement) : THTML_title;
+begin
+  result := tagtitle (subs);
+end;
+
+function THTMLWriter.title (subs : TDOMNodelist) : THTML_title;
+begin
+  result := tagtitle (subs);
+end;
+
+function THTMLWriter.Starttitle : THTML_title;
+begin
+  result := THTML_title (StartElement (THTML_title));
+end;
+
+function THTMLWriter.Endtitle : THTML_title;
+begin
+  result := THTML_title (EndElement (THTML_title));
+end;
+
+{ tag "tr", alias "tablerow" }
+
+function THTMLWriter.tagtr (s : string) : THTML_tr;
+begin
+  result := THTML_tr (CreateElement (THTML_tr, s));
+end;
+
+function THTMLWriter.tagtr (sub : THTMLCustomElement) : THTML_tr;
+begin
+  result := THTML_tr (CreateElement (THTML_tr, sub));
+end;
+
+function THTMLWriter.tagtr (subs : Array of THTMLCustomElement) : THTML_tr;
+begin
+  result := THTML_tr (CreateElement (THTML_tr, subs));
+end;
+
+function THTMLWriter.tagtr (subs : TDOMNodelist) : THTML_tr;
+begin
+  result := THTML_tr (CreateElement (THTML_tr, subs));
+end;
+
+function THTMLWriter.tablerow (s : string) : THTML_tr;
+begin
+  result := tagtr (s);
+end;
+
+function THTMLWriter.tablerow (sub : THTMLCustomElement) : THTML_tr;
+begin
+  result := tagtr (sub);
+end;
+
+function THTMLWriter.tablerow (subs : Array of THTMLCustomElement) : THTML_tr;
+begin
+  result := tagtr (subs);
+end;
+
+function THTMLWriter.tablerow (subs : TDOMNodelist) : THTML_tr;
+begin
+  result := tagtr (subs);
+end;
+
+function THTMLWriter.Starttr : THTML_tr;
+begin
+  result := THTML_tr (StartElement (THTML_tr));
+end;
+
+function THTMLWriter.Endtr : THTML_tr;
+begin
+  result := THTML_tr (EndElement (THTML_tr));
+end;
+
+function THTMLWriter.Starttablerow : THTML_tr;
+begin
+  result := Starttr;
+end;
+
+function THTMLWriter.Endtablerow : THTML_tr;
+begin
+  result := Endtr;
+end;
+
+{ tag "tt", alias "teletype" }
+
+function THTMLWriter.tagtt (s : string) : THTML_tt;
+begin
+  result := THTML_tt (CreateElement (THTML_tt, s));
+end;
+
+function THTMLWriter.tagtt (sub : THTMLCustomElement) : THTML_tt;
+begin
+  result := THTML_tt (CreateElement (THTML_tt, sub));
+end;
+
+function THTMLWriter.tagtt (subs : Array of THTMLCustomElement) : THTML_tt;
+begin
+  result := THTML_tt (CreateElement (THTML_tt, subs));
+end;
+
+function THTMLWriter.tagtt (subs : TDOMNodelist) : THTML_tt;
+begin
+  result := THTML_tt (CreateElement (THTML_tt, subs));
+end;
+
+function THTMLWriter.teletype (s : string) : THTML_tt;
+begin
+  result := tagtt (s);
+end;
+
+function THTMLWriter.teletype (sub : THTMLCustomElement) : THTML_tt;
+begin
+  result := tagtt (sub);
+end;
+
+function THTMLWriter.teletype (subs : Array of THTMLCustomElement) : THTML_tt;
+begin
+  result := tagtt (subs);
+end;
+
+function THTMLWriter.teletype (subs : TDOMNodelist) : THTML_tt;
+begin
+  result := tagtt (subs);
+end;
+
+function THTMLWriter.Starttt : THTML_tt;
+begin
+  result := THTML_tt (StartElement (THTML_tt));
+end;
+
+function THTMLWriter.Endtt : THTML_tt;
+begin
+  result := THTML_tt (EndElement (THTML_tt));
+end;
+
+function THTMLWriter.Startteletype : THTML_tt;
+begin
+  result := Starttt;
+end;
+
+function THTMLWriter.Endteletype : THTML_tt;
+begin
+  result := Endtt;
+end;
+
+{ tag "u", alias "underlined" }
+
+function THTMLWriter.tagu (s : string) : THTML_u;
+begin
+  result := THTML_u (CreateElement (THTML_u, s));
+end;
+
+function THTMLWriter.tagu (sub : THTMLCustomElement) : THTML_u;
+begin
+  result := THTML_u (CreateElement (THTML_u, sub));
+end;
+
+function THTMLWriter.tagu (subs : Array of THTMLCustomElement) : THTML_u;
+begin
+  result := THTML_u (CreateElement (THTML_u, subs));
+end;
+
+function THTMLWriter.tagu (subs : TDOMNodelist) : THTML_u;
+begin
+  result := THTML_u (CreateElement (THTML_u, subs));
+end;
+
+function THTMLWriter.underlined (s : string) : THTML_u;
+begin
+  result := tagu (s);
+end;
+
+function THTMLWriter.underlined (sub : THTMLCustomElement) : THTML_u;
+begin
+  result := tagu (sub);
+end;
+
+function THTMLWriter.underlined (subs : Array of THTMLCustomElement) : THTML_u;
+begin
+  result := tagu (subs);
+end;
+
+function THTMLWriter.underlined (subs : TDOMNodelist) : THTML_u;
+begin
+  result := tagu (subs);
+end;
+
+function THTMLWriter.Startu : THTML_u;
+begin
+  result := THTML_u (StartElement (THTML_u));
+end;
+
+function THTMLWriter.Endu : THTML_u;
+begin
+  result := THTML_u (EndElement (THTML_u));
+end;
+
+function THTMLWriter.Startunderlined : THTML_u;
+begin
+  result := Startu;
+end;
+
+function THTMLWriter.Endunderlined : THTML_u;
+begin
+  result := Endu;
+end;
+
+{ tag "ul", alias "unorederedlist" }
+
+function THTMLWriter.tagul (s : string) : THTML_ul;
+begin
+  result := THTML_ul (CreateElement (THTML_ul, s));
+end;
+
+function THTMLWriter.tagul (sub : THTMLCustomElement) : THTML_ul;
+begin
+  result := THTML_ul (CreateElement (THTML_ul, sub));
+end;
+
+function THTMLWriter.tagul (subs : Array of THTMLCustomElement) : THTML_ul;
+begin
+  result := THTML_ul (CreateElement (THTML_ul, subs));
+end;
+
+function THTMLWriter.tagul (subs : TDOMNodelist) : THTML_ul;
+begin
+  result := THTML_ul (CreateElement (THTML_ul, subs));
+end;
+
+function THTMLWriter.unorederedlist (s : string) : THTML_ul;
+begin
+  result := tagul (s);
+end;
+
+function THTMLWriter.unorederedlist (sub : THTMLCustomElement) : THTML_ul;
+begin
+  result := tagul (sub);
+end;
+
+function THTMLWriter.unorederedlist (subs : Array of THTMLCustomElement) : THTML_ul;
+begin
+  result := tagul (subs);
+end;
+
+function THTMLWriter.unorederedlist (subs : TDOMNodelist) : THTML_ul;
+begin
+  result := tagul (subs);
+end;
+
+function THTMLWriter.Startul : THTML_ul;
+begin
+  result := THTML_ul (StartElement (THTML_ul));
+end;
+
+function THTMLWriter.Endul : THTML_ul;
+begin
+  result := THTML_ul (EndElement (THTML_ul));
+end;
+
+function THTMLWriter.Startunorederedlist : THTML_ul;
+begin
+  result := Startul;
+end;
+
+function THTMLWriter.Endunorederedlist : THTML_ul;
+begin
+  result := Endul;
+end;
+
+{ tag "var", alias "variable" }
+
+function THTMLWriter.tagvar (s : string) : THTML_var;
+begin
+  result := THTML_var (CreateElement (THTML_var, s));
+end;
+
+function THTMLWriter.tagvar (sub : THTMLCustomElement) : THTML_var;
+begin
+  result := THTML_var (CreateElement (THTML_var, sub));
+end;
+
+function THTMLWriter.tagvar (subs : Array of THTMLCustomElement) : THTML_var;
+begin
+  result := THTML_var (CreateElement (THTML_var, subs));
+end;
+
+function THTMLWriter.tagvar (subs : TDOMNodelist) : THTML_var;
+begin
+  result := THTML_var (CreateElement (THTML_var, subs));
+end;
+
+function THTMLWriter.variable (s : string) : THTML_var;
+begin
+  result := tagvar (s);
+end;
+
+function THTMLWriter.variable (sub : THTMLCustomElement) : THTML_var;
+begin
+  result := tagvar (sub);
+end;
+
+function THTMLWriter.variable (subs : Array of THTMLCustomElement) : THTML_var;
+begin
+  result := tagvar (subs);
+end;
+
+function THTMLWriter.variable (subs : TDOMNodelist) : THTML_var;
+begin
+  result := tagvar (subs);
+end;
+
+function THTMLWriter.Startvar : THTML_var;
+begin
+  result := THTML_var (StartElement (THTML_var));
+end;
+
+function THTMLWriter.Endvar : THTML_var;
+begin
+  result := THTML_var (EndElement (THTML_var));
+end;
+
+function THTMLWriter.Startvariable : THTML_var;
+begin
+  result := Startvar;
+end;
+
+function THTMLWriter.Endvariable : THTML_var;
+begin
+  result := Endvar;
+end;
+

+ 1072 - 0
fcl/web/wtagsintf.inc

@@ -0,0 +1,1072 @@
+
+    // tag "a", alias "anchor"
+    function taga (s : string) : THTML_a;
+    function taga (sub : THTMLCustomElement) : THTML_a;
+    function taga (subs : Array of THTMLCustomElement) : THTML_a;
+    function taga (subs : TDOMNodelist) : THTML_a;
+    function anchor (s : string) : THTML_a;
+    function anchor (sub : THTMLCustomElement) : THTML_a;
+    function anchor (subs : Array of THTMLCustomElement) : THTML_a;
+    function anchor (subs : TDOMNodelist) : THTML_a;
+    function Starta : THTML_a;
+    function Enda : THTML_a;
+    function Startanchor : THTML_a;
+    function Endanchor : THTML_a;
+
+    // tag "abbr", alias "abbr"
+    function tagabbr (s : string) : THTML_abbr;
+    function tagabbr (sub : THTMLCustomElement) : THTML_abbr;
+    function tagabbr (subs : Array of THTMLCustomElement) : THTML_abbr;
+    function tagabbr (subs : TDOMNodelist) : THTML_abbr;
+    function abbr (s : string) : THTML_abbr;
+    function abbr (sub : THTMLCustomElement) : THTML_abbr;
+    function abbr (subs : Array of THTMLCustomElement) : THTML_abbr;
+    function abbr (subs : TDOMNodelist) : THTML_abbr;
+    function Startabbr : THTML_abbr;
+    function Endabbr : THTML_abbr;
+
+    // tag "acronym", alias "acronym"
+    function tagacronym (s : string) : THTML_acronym;
+    function tagacronym (sub : THTMLCustomElement) : THTML_acronym;
+    function tagacronym (subs : Array of THTMLCustomElement) : THTML_acronym;
+    function tagacronym (subs : TDOMNodelist) : THTML_acronym;
+    function acronym (s : string) : THTML_acronym;
+    function acronym (sub : THTMLCustomElement) : THTML_acronym;
+    function acronym (subs : Array of THTMLCustomElement) : THTML_acronym;
+    function acronym (subs : TDOMNodelist) : THTML_acronym;
+    function Startacronym : THTML_acronym;
+    function Endacronym : THTML_acronym;
+
+    // tag "address", alias "address"
+    function tagaddress (s : string) : THTML_address;
+    function tagaddress (sub : THTMLCustomElement) : THTML_address;
+    function tagaddress (subs : Array of THTMLCustomElement) : THTML_address;
+    function tagaddress (subs : TDOMNodelist) : THTML_address;
+    function address (s : string) : THTML_address;
+    function address (sub : THTMLCustomElement) : THTML_address;
+    function address (subs : Array of THTMLCustomElement) : THTML_address;
+    function address (subs : TDOMNodelist) : THTML_address;
+    function Startaddress : THTML_address;
+    function Endaddress : THTML_address;
+
+    // tag "applet", alias "applet"
+    function tagapplet (s : string) : THTML_applet;
+    function tagapplet (sub : THTMLCustomElement) : THTML_applet;
+    function tagapplet (subs : Array of THTMLCustomElement) : THTML_applet;
+    function tagapplet (subs : TDOMNodelist) : THTML_applet;
+    function applet (s : string) : THTML_applet;
+    function applet (sub : THTMLCustomElement) : THTML_applet;
+    function applet (subs : Array of THTMLCustomElement) : THTML_applet;
+    function applet (subs : TDOMNodelist) : THTML_applet;
+    function Startapplet : THTML_applet;
+    function Endapplet : THTML_applet;
+
+    // tag "area", alias "area"
+    function tagarea : THTML_area;
+    function area : THTML_area;
+
+    // tag "b", alias "bold"
+    function tagb (s : string) : THTML_b;
+    function tagb (sub : THTMLCustomElement) : THTML_b;
+    function tagb (subs : Array of THTMLCustomElement) : THTML_b;
+    function tagb (subs : TDOMNodelist) : THTML_b;
+    function bold (s : string) : THTML_b;
+    function bold (sub : THTMLCustomElement) : THTML_b;
+    function bold (subs : Array of THTMLCustomElement) : THTML_b;
+    function bold (subs : TDOMNodelist) : THTML_b;
+    function Startb : THTML_b;
+    function Endb : THTML_b;
+    function Startbold : THTML_b;
+    function Endbold : THTML_b;
+
+    // tag "base", alias "base"
+    function tagbase : THTML_base;
+    function base : THTML_base;
+
+    // tag "basefont", alias "basefont"
+    function tagbasefont : THTML_basefont;
+    function basefont : THTML_basefont;
+
+    // tag "bdo", alias "bdo"
+    function tagbdo (s : string) : THTML_bdo;
+    function tagbdo (sub : THTMLCustomElement) : THTML_bdo;
+    function tagbdo (subs : Array of THTMLCustomElement) : THTML_bdo;
+    function tagbdo (subs : TDOMNodelist) : THTML_bdo;
+    function bdo (s : string) : THTML_bdo;
+    function bdo (sub : THTMLCustomElement) : THTML_bdo;
+    function bdo (subs : Array of THTMLCustomElement) : THTML_bdo;
+    function bdo (subs : TDOMNodelist) : THTML_bdo;
+    function Startbdo : THTML_bdo;
+    function Endbdo : THTML_bdo;
+
+    // tag "big", alias "big"
+    function tagbig (s : string) : THTML_big;
+    function tagbig (sub : THTMLCustomElement) : THTML_big;
+    function tagbig (subs : Array of THTMLCustomElement) : THTML_big;
+    function tagbig (subs : TDOMNodelist) : THTML_big;
+    function big (s : string) : THTML_big;
+    function big (sub : THTMLCustomElement) : THTML_big;
+    function big (subs : Array of THTMLCustomElement) : THTML_big;
+    function big (subs : TDOMNodelist) : THTML_big;
+    function Startbig : THTML_big;
+    function Endbig : THTML_big;
+
+    // tag "blockquote", alias "blockquote"
+    function tagblockquote (s : string) : THTML_blockquote;
+    function tagblockquote (sub : THTMLCustomElement) : THTML_blockquote;
+    function tagblockquote (subs : Array of THTMLCustomElement) : THTML_blockquote;
+    function tagblockquote (subs : TDOMNodelist) : THTML_blockquote;
+    function blockquote (s : string) : THTML_blockquote;
+    function blockquote (sub : THTMLCustomElement) : THTML_blockquote;
+    function blockquote (subs : Array of THTMLCustomElement) : THTML_blockquote;
+    function blockquote (subs : TDOMNodelist) : THTML_blockquote;
+    function Startblockquote : THTML_blockquote;
+    function Endblockquote : THTML_blockquote;
+
+    // tag "body", alias "body"
+    function tagbody (s : string) : THTML_body;
+    function tagbody (sub : THTMLCustomElement) : THTML_body;
+    function tagbody (subs : Array of THTMLCustomElement) : THTML_body;
+    function tagbody (subs : TDOMNodelist) : THTML_body;
+    function body (s : string) : THTML_body;
+    function body (sub : THTMLCustomElement) : THTML_body;
+    function body (subs : Array of THTMLCustomElement) : THTML_body;
+    function body (subs : TDOMNodelist) : THTML_body;
+    function Startbody : THTML_body;
+    function Endbody : THTML_body;
+
+    // tag "br", alias "linebreak"
+    function tagbr : THTML_br;
+    function linebreak : THTML_br;
+
+    // tag "button", alias "button"
+    function tagbutton (s : string) : THTML_button;
+    function tagbutton (sub : THTMLCustomElement) : THTML_button;
+    function tagbutton (subs : Array of THTMLCustomElement) : THTML_button;
+    function tagbutton (subs : TDOMNodelist) : THTML_button;
+    function button (s : string) : THTML_button;
+    function button (sub : THTMLCustomElement) : THTML_button;
+    function button (subs : Array of THTMLCustomElement) : THTML_button;
+    function button (subs : TDOMNodelist) : THTML_button;
+    function Startbutton : THTML_button;
+    function Endbutton : THTML_button;
+
+    // tag "caption", alias "caption"
+    function tagcaption (s : string) : THTML_caption;
+    function tagcaption (sub : THTMLCustomElement) : THTML_caption;
+    function tagcaption (subs : Array of THTMLCustomElement) : THTML_caption;
+    function tagcaption (subs : TDOMNodelist) : THTML_caption;
+    function caption (s : string) : THTML_caption;
+    function caption (sub : THTMLCustomElement) : THTML_caption;
+    function caption (subs : Array of THTMLCustomElement) : THTML_caption;
+    function caption (subs : TDOMNodelist) : THTML_caption;
+    function Startcaption : THTML_caption;
+    function Endcaption : THTML_caption;
+
+    // tag "center", alias "center"
+    function tagcenter (s : string) : THTML_center;
+    function tagcenter (sub : THTMLCustomElement) : THTML_center;
+    function tagcenter (subs : Array of THTMLCustomElement) : THTML_center;
+    function tagcenter (subs : TDOMNodelist) : THTML_center;
+    function center (s : string) : THTML_center;
+    function center (sub : THTMLCustomElement) : THTML_center;
+    function center (subs : Array of THTMLCustomElement) : THTML_center;
+    function center (subs : TDOMNodelist) : THTML_center;
+    function Startcenter : THTML_center;
+    function Endcenter : THTML_center;
+
+    // tag "cite", alias "cite"
+    function tagcite (s : string) : THTML_cite;
+    function tagcite (sub : THTMLCustomElement) : THTML_cite;
+    function tagcite (subs : Array of THTMLCustomElement) : THTML_cite;
+    function tagcite (subs : TDOMNodelist) : THTML_cite;
+    function cite (s : string) : THTML_cite;
+    function cite (sub : THTMLCustomElement) : THTML_cite;
+    function cite (subs : Array of THTMLCustomElement) : THTML_cite;
+    function cite (subs : TDOMNodelist) : THTML_cite;
+    function Startcite : THTML_cite;
+    function Endcite : THTML_cite;
+
+    // tag "code", alias "code"
+    function tagcode (s : string) : THTML_code;
+    function tagcode (sub : THTMLCustomElement) : THTML_code;
+    function tagcode (subs : Array of THTMLCustomElement) : THTML_code;
+    function tagcode (subs : TDOMNodelist) : THTML_code;
+    function code (s : string) : THTML_code;
+    function code (sub : THTMLCustomElement) : THTML_code;
+    function code (subs : Array of THTMLCustomElement) : THTML_code;
+    function code (subs : TDOMNodelist) : THTML_code;
+    function Startcode : THTML_code;
+    function Endcode : THTML_code;
+
+    // tag "col", alias "column"
+    function tagcol : THTML_col;
+    function column : THTML_col;
+
+    // tag "colgroup", alias "colgroup"
+    function tagcolgroup (s : string) : THTML_colgroup;
+    function tagcolgroup (sub : THTMLCustomElement) : THTML_colgroup;
+    function tagcolgroup (subs : Array of THTMLCustomElement) : THTML_colgroup;
+    function tagcolgroup (subs : TDOMNodelist) : THTML_colgroup;
+    function colgroup (s : string) : THTML_colgroup;
+    function colgroup (sub : THTMLCustomElement) : THTML_colgroup;
+    function colgroup (subs : Array of THTMLCustomElement) : THTML_colgroup;
+    function colgroup (subs : TDOMNodelist) : THTML_colgroup;
+    function Startcolgroup : THTML_colgroup;
+    function Endcolgroup : THTML_colgroup;
+
+    // tag "dd", alias "defdescr"
+    function tagdd (s : string) : THTML_dd;
+    function tagdd (sub : THTMLCustomElement) : THTML_dd;
+    function tagdd (subs : Array of THTMLCustomElement) : THTML_dd;
+    function tagdd (subs : TDOMNodelist) : THTML_dd;
+    function defdescr (s : string) : THTML_dd;
+    function defdescr (sub : THTMLCustomElement) : THTML_dd;
+    function defdescr (subs : Array of THTMLCustomElement) : THTML_dd;
+    function defdescr (subs : TDOMNodelist) : THTML_dd;
+    function Startdd : THTML_dd;
+    function Enddd : THTML_dd;
+    function Startdefdescr : THTML_dd;
+    function Enddefdescr : THTML_dd;
+
+    // tag "del", alias "deleted"
+    function tagdel (s : string) : THTML_del;
+    function tagdel (sub : THTMLCustomElement) : THTML_del;
+    function tagdel (subs : Array of THTMLCustomElement) : THTML_del;
+    function tagdel (subs : TDOMNodelist) : THTML_del;
+    function deleted (s : string) : THTML_del;
+    function deleted (sub : THTMLCustomElement) : THTML_del;
+    function deleted (subs : Array of THTMLCustomElement) : THTML_del;
+    function deleted (subs : TDOMNodelist) : THTML_del;
+    function Startdel : THTML_del;
+    function Enddel : THTML_del;
+    function Startdeleted : THTML_del;
+    function Enddeleted : THTML_del;
+
+    // tag "dfn", alias "definition"
+    function tagdfn (s : string) : THTML_dfn;
+    function tagdfn (sub : THTMLCustomElement) : THTML_dfn;
+    function tagdfn (subs : Array of THTMLCustomElement) : THTML_dfn;
+    function tagdfn (subs : TDOMNodelist) : THTML_dfn;
+    function definition (s : string) : THTML_dfn;
+    function definition (sub : THTMLCustomElement) : THTML_dfn;
+    function definition (subs : Array of THTMLCustomElement) : THTML_dfn;
+    function definition (subs : TDOMNodelist) : THTML_dfn;
+    function Startdfn : THTML_dfn;
+    function Enddfn : THTML_dfn;
+    function Startdefinition : THTML_dfn;
+    function Enddefinition : THTML_dfn;
+
+    // tag "dir", alias "dir"
+    function tagdir (s : string) : THTML_dir;
+    function tagdir (sub : THTMLCustomElement) : THTML_dir;
+    function tagdir (subs : Array of THTMLCustomElement) : THTML_dir;
+    function tagdir (subs : TDOMNodelist) : THTML_dir;
+    function dir (s : string) : THTML_dir;
+    function dir (sub : THTMLCustomElement) : THTML_dir;
+    function dir (subs : Array of THTMLCustomElement) : THTML_dir;
+    function dir (subs : TDOMNodelist) : THTML_dir;
+    function Startdir : THTML_dir;
+    function Enddir : THTML_dir;
+
+    // tag "div", alias "divider"
+    function tagdiv (s : string) : THTML_div;
+    function tagdiv (sub : THTMLCustomElement) : THTML_div;
+    function tagdiv (subs : Array of THTMLCustomElement) : THTML_div;
+    function tagdiv (subs : TDOMNodelist) : THTML_div;
+    function divider (s : string) : THTML_div;
+    function divider (sub : THTMLCustomElement) : THTML_div;
+    function divider (subs : Array of THTMLCustomElement) : THTML_div;
+    function divider (subs : TDOMNodelist) : THTML_div;
+    function Startdiv : THTML_div;
+    function Enddiv : THTML_div;
+    function Startdivider : THTML_div;
+    function Enddivider : THTML_div;
+
+    // tag "dl", alias "deflist"
+    function tagdl (s : string) : THTML_dl;
+    function tagdl (sub : THTMLCustomElement) : THTML_dl;
+    function tagdl (subs : Array of THTMLCustomElement) : THTML_dl;
+    function tagdl (subs : TDOMNodelist) : THTML_dl;
+    function deflist (s : string) : THTML_dl;
+    function deflist (sub : THTMLCustomElement) : THTML_dl;
+    function deflist (subs : Array of THTMLCustomElement) : THTML_dl;
+    function deflist (subs : TDOMNodelist) : THTML_dl;
+    function Startdl : THTML_dl;
+    function Enddl : THTML_dl;
+    function Startdeflist : THTML_dl;
+    function Enddeflist : THTML_dl;
+
+    // tag "dt", alias "defterm"
+    function tagdt (s : string) : THTML_dt;
+    function tagdt (sub : THTMLCustomElement) : THTML_dt;
+    function tagdt (subs : Array of THTMLCustomElement) : THTML_dt;
+    function tagdt (subs : TDOMNodelist) : THTML_dt;
+    function defterm (s : string) : THTML_dt;
+    function defterm (sub : THTMLCustomElement) : THTML_dt;
+    function defterm (subs : Array of THTMLCustomElement) : THTML_dt;
+    function defterm (subs : TDOMNodelist) : THTML_dt;
+    function Startdt : THTML_dt;
+    function Enddt : THTML_dt;
+    function Startdefterm : THTML_dt;
+    function Enddefterm : THTML_dt;
+
+    // tag "em", alias "emphasis"
+    function tagem (s : string) : THTML_em;
+    function tagem (sub : THTMLCustomElement) : THTML_em;
+    function tagem (subs : Array of THTMLCustomElement) : THTML_em;
+    function tagem (subs : TDOMNodelist) : THTML_em;
+    function emphasis (s : string) : THTML_em;
+    function emphasis (sub : THTMLCustomElement) : THTML_em;
+    function emphasis (subs : Array of THTMLCustomElement) : THTML_em;
+    function emphasis (subs : TDOMNodelist) : THTML_em;
+    function Startem : THTML_em;
+    function Endem : THTML_em;
+    function Startemphasis : THTML_em;
+    function Endemphasis : THTML_em;
+
+    // tag "fieldset", alias "fieldset"
+    function tagfieldset (s : string) : THTML_fieldset;
+    function tagfieldset (sub : THTMLCustomElement) : THTML_fieldset;
+    function tagfieldset (subs : Array of THTMLCustomElement) : THTML_fieldset;
+    function tagfieldset (subs : TDOMNodelist) : THTML_fieldset;
+    function fieldset (s : string) : THTML_fieldset;
+    function fieldset (sub : THTMLCustomElement) : THTML_fieldset;
+    function fieldset (subs : Array of THTMLCustomElement) : THTML_fieldset;
+    function fieldset (subs : TDOMNodelist) : THTML_fieldset;
+    function Startfieldset : THTML_fieldset;
+    function Endfieldset : THTML_fieldset;
+
+    // tag "font", alias "font"
+    function tagfont (s : string) : THTML_font;
+    function tagfont (sub : THTMLCustomElement) : THTML_font;
+    function tagfont (subs : Array of THTMLCustomElement) : THTML_font;
+    function tagfont (subs : TDOMNodelist) : THTML_font;
+    function font (s : string) : THTML_font;
+    function font (sub : THTMLCustomElement) : THTML_font;
+    function font (subs : Array of THTMLCustomElement) : THTML_font;
+    function font (subs : TDOMNodelist) : THTML_font;
+    function Startfont : THTML_font;
+    function Endfont : THTML_font;
+
+    // tag "form", alias "form"
+    function tagform (s : string) : THTML_form;
+    function tagform (sub : THTMLCustomElement) : THTML_form;
+    function tagform (subs : Array of THTMLCustomElement) : THTML_form;
+    function tagform (subs : TDOMNodelist) : THTML_form;
+    function form (s : string) : THTML_form;
+    function form (sub : THTMLCustomElement) : THTML_form;
+    function form (subs : Array of THTMLCustomElement) : THTML_form;
+    function form (subs : TDOMNodelist) : THTML_form;
+    function Startform : THTML_form;
+    function Endform : THTML_form;
+
+    // tag "frame", alias "frame"
+    function tagframe : THTML_frame;
+    function frame : THTML_frame;
+
+    // tag "frameset", alias "frameset"
+    function tagframeset (s : string) : THTML_frameset;
+    function tagframeset (sub : THTMLCustomElement) : THTML_frameset;
+    function tagframeset (subs : Array of THTMLCustomElement) : THTML_frameset;
+    function tagframeset (subs : TDOMNodelist) : THTML_frameset;
+    function frameset (s : string) : THTML_frameset;
+    function frameset (sub : THTMLCustomElement) : THTML_frameset;
+    function frameset (subs : Array of THTMLCustomElement) : THTML_frameset;
+    function frameset (subs : TDOMNodelist) : THTML_frameset;
+    function Startframeset : THTML_frameset;
+    function Endframeset : THTML_frameset;
+
+    // tag "h1", alias "heading1"
+    function tagh1 (s : string) : THTML_h1;
+    function tagh1 (sub : THTMLCustomElement) : THTML_h1;
+    function tagh1 (subs : Array of THTMLCustomElement) : THTML_h1;
+    function tagh1 (subs : TDOMNodelist) : THTML_h1;
+    function heading1 (s : string) : THTML_h1;
+    function heading1 (sub : THTMLCustomElement) : THTML_h1;
+    function heading1 (subs : Array of THTMLCustomElement) : THTML_h1;
+    function heading1 (subs : TDOMNodelist) : THTML_h1;
+    function Starth1 : THTML_h1;
+    function Endh1 : THTML_h1;
+    function Startheading1 : THTML_h1;
+    function Endheading1 : THTML_h1;
+
+    // tag "h2", alias "heading2"
+    function tagh2 (s : string) : THTML_h2;
+    function tagh2 (sub : THTMLCustomElement) : THTML_h2;
+    function tagh2 (subs : Array of THTMLCustomElement) : THTML_h2;
+    function tagh2 (subs : TDOMNodelist) : THTML_h2;
+    function heading2 (s : string) : THTML_h2;
+    function heading2 (sub : THTMLCustomElement) : THTML_h2;
+    function heading2 (subs : Array of THTMLCustomElement) : THTML_h2;
+    function heading2 (subs : TDOMNodelist) : THTML_h2;
+    function Starth2 : THTML_h2;
+    function Endh2 : THTML_h2;
+    function Startheading2 : THTML_h2;
+    function Endheading2 : THTML_h2;
+
+    // tag "h3", alias "heading3"
+    function tagh3 (s : string) : THTML_h3;
+    function tagh3 (sub : THTMLCustomElement) : THTML_h3;
+    function tagh3 (subs : Array of THTMLCustomElement) : THTML_h3;
+    function tagh3 (subs : TDOMNodelist) : THTML_h3;
+    function heading3 (s : string) : THTML_h3;
+    function heading3 (sub : THTMLCustomElement) : THTML_h3;
+    function heading3 (subs : Array of THTMLCustomElement) : THTML_h3;
+    function heading3 (subs : TDOMNodelist) : THTML_h3;
+    function Starth3 : THTML_h3;
+    function Endh3 : THTML_h3;
+    function Startheading3 : THTML_h3;
+    function Endheading3 : THTML_h3;
+
+    // tag "h4", alias "heading4"
+    function tagh4 (s : string) : THTML_h4;
+    function tagh4 (sub : THTMLCustomElement) : THTML_h4;
+    function tagh4 (subs : Array of THTMLCustomElement) : THTML_h4;
+    function tagh4 (subs : TDOMNodelist) : THTML_h4;
+    function heading4 (s : string) : THTML_h4;
+    function heading4 (sub : THTMLCustomElement) : THTML_h4;
+    function heading4 (subs : Array of THTMLCustomElement) : THTML_h4;
+    function heading4 (subs : TDOMNodelist) : THTML_h4;
+    function Starth4 : THTML_h4;
+    function Endh4 : THTML_h4;
+    function Startheading4 : THTML_h4;
+    function Endheading4 : THTML_h4;
+
+    // tag "h5", alias "heading5"
+    function tagh5 (s : string) : THTML_h5;
+    function tagh5 (sub : THTMLCustomElement) : THTML_h5;
+    function tagh5 (subs : Array of THTMLCustomElement) : THTML_h5;
+    function tagh5 (subs : TDOMNodelist) : THTML_h5;
+    function heading5 (s : string) : THTML_h5;
+    function heading5 (sub : THTMLCustomElement) : THTML_h5;
+    function heading5 (subs : Array of THTMLCustomElement) : THTML_h5;
+    function heading5 (subs : TDOMNodelist) : THTML_h5;
+    function Starth5 : THTML_h5;
+    function Endh5 : THTML_h5;
+    function Startheading5 : THTML_h5;
+    function Endheading5 : THTML_h5;
+
+    // tag "h6", alias "heading6"
+    function tagh6 (s : string) : THTML_h6;
+    function tagh6 (sub : THTMLCustomElement) : THTML_h6;
+    function tagh6 (subs : Array of THTMLCustomElement) : THTML_h6;
+    function tagh6 (subs : TDOMNodelist) : THTML_h6;
+    function heading6 (s : string) : THTML_h6;
+    function heading6 (sub : THTMLCustomElement) : THTML_h6;
+    function heading6 (subs : Array of THTMLCustomElement) : THTML_h6;
+    function heading6 (subs : TDOMNodelist) : THTML_h6;
+    function Starth6 : THTML_h6;
+    function Endh6 : THTML_h6;
+    function Startheading6 : THTML_h6;
+    function Endheading6 : THTML_h6;
+
+    // tag "head", alias "header"
+    function taghead (s : string) : THTML_head;
+    function taghead (sub : THTMLCustomElement) : THTML_head;
+    function taghead (subs : Array of THTMLCustomElement) : THTML_head;
+    function taghead (subs : TDOMNodelist) : THTML_head;
+    function header (s : string) : THTML_head;
+    function header (sub : THTMLCustomElement) : THTML_head;
+    function header (subs : Array of THTMLCustomElement) : THTML_head;
+    function header (subs : TDOMNodelist) : THTML_head;
+    function Starthead : THTML_head;
+    function Endhead : THTML_head;
+    function Startheader : THTML_head;
+    function Endheader : THTML_head;
+
+    // tag "hr", alias "horrule"
+    function taghr : THTML_hr;
+    function horrule : THTML_hr;
+
+    // tag "html", alias "html"
+    function taghtml (s : string) : THTML_html;
+    function taghtml (sub : THTMLCustomElement) : THTML_html;
+    function taghtml (subs : Array of THTMLCustomElement) : THTML_html;
+    function taghtml (subs : TDOMNodelist) : THTML_html;
+    function html (s : string) : THTML_html;
+    function html (sub : THTMLCustomElement) : THTML_html;
+    function html (subs : Array of THTMLCustomElement) : THTML_html;
+    function html (subs : TDOMNodelist) : THTML_html;
+    function Starthtml : THTML_html;
+    function Endhtml : THTML_html;
+
+    // tag "i", alias "italic"
+    function tagi (s : string) : THTML_i;
+    function tagi (sub : THTMLCustomElement) : THTML_i;
+    function tagi (subs : Array of THTMLCustomElement) : THTML_i;
+    function tagi (subs : TDOMNodelist) : THTML_i;
+    function italic (s : string) : THTML_i;
+    function italic (sub : THTMLCustomElement) : THTML_i;
+    function italic (subs : Array of THTMLCustomElement) : THTML_i;
+    function italic (subs : TDOMNodelist) : THTML_i;
+    function Starti : THTML_i;
+    function Endi : THTML_i;
+    function Startitalic : THTML_i;
+    function Enditalic : THTML_i;
+
+    // tag "iframe", alias "inlineframe"
+    function tagiframe (s : string) : THTML_iframe;
+    function tagiframe (sub : THTMLCustomElement) : THTML_iframe;
+    function tagiframe (subs : Array of THTMLCustomElement) : THTML_iframe;
+    function tagiframe (subs : TDOMNodelist) : THTML_iframe;
+    function inlineframe (s : string) : THTML_iframe;
+    function inlineframe (sub : THTMLCustomElement) : THTML_iframe;
+    function inlineframe (subs : Array of THTMLCustomElement) : THTML_iframe;
+    function inlineframe (subs : TDOMNodelist) : THTML_iframe;
+    function Startiframe : THTML_iframe;
+    function Endiframe : THTML_iframe;
+    function Startinlineframe : THTML_iframe;
+    function Endinlineframe : THTML_iframe;
+
+    // tag "img", alias "image"
+    function tagimg : THTML_img;
+    function image : THTML_img;
+
+    // tag "input", alias "input"
+    function taginput : THTML_input;
+    function input : THTML_input;
+
+    // tag "ins", alias "inserted"
+    function tagins (s : string) : THTML_ins;
+    function tagins (sub : THTMLCustomElement) : THTML_ins;
+    function tagins (subs : Array of THTMLCustomElement) : THTML_ins;
+    function tagins (subs : TDOMNodelist) : THTML_ins;
+    function inserted (s : string) : THTML_ins;
+    function inserted (sub : THTMLCustomElement) : THTML_ins;
+    function inserted (subs : Array of THTMLCustomElement) : THTML_ins;
+    function inserted (subs : TDOMNodelist) : THTML_ins;
+    function Startins : THTML_ins;
+    function Endins : THTML_ins;
+    function Startinserted : THTML_ins;
+    function Endinserted : THTML_ins;
+
+    // tag "isindex", alias "isindex"
+    function tagisindex : THTML_isindex;
+    function isindex : THTML_isindex;
+
+    // tag "kbd", alias "enteredtext"
+    function tagkbd (s : string) : THTML_kbd;
+    function tagkbd (sub : THTMLCustomElement) : THTML_kbd;
+    function tagkbd (subs : Array of THTMLCustomElement) : THTML_kbd;
+    function tagkbd (subs : TDOMNodelist) : THTML_kbd;
+    function enteredtext (s : string) : THTML_kbd;
+    function enteredtext (sub : THTMLCustomElement) : THTML_kbd;
+    function enteredtext (subs : Array of THTMLCustomElement) : THTML_kbd;
+    function enteredtext (subs : TDOMNodelist) : THTML_kbd;
+    function Startkbd : THTML_kbd;
+    function Endkbd : THTML_kbd;
+    function Startenteredtext : THTML_kbd;
+    function Endenteredtext : THTML_kbd;
+
+    // tag "label", alias "alabel"
+    function taglabel (s : string) : THTML_label;
+    function taglabel (sub : THTMLCustomElement) : THTML_label;
+    function taglabel (subs : Array of THTMLCustomElement) : THTML_label;
+    function taglabel (subs : TDOMNodelist) : THTML_label;
+    function alabel (s : string) : THTML_label;
+    function alabel (sub : THTMLCustomElement) : THTML_label;
+    function alabel (subs : Array of THTMLCustomElement) : THTML_label;
+    function alabel (subs : TDOMNodelist) : THTML_label;
+    function Startlabel : THTML_label;
+    function Endlabel : THTML_label;
+    function Startalabel : THTML_label;
+    function Endalabel : THTML_label;
+
+    // tag "legend", alias "legend"
+    function taglegend (s : string) : THTML_legend;
+    function taglegend (sub : THTMLCustomElement) : THTML_legend;
+    function taglegend (subs : Array of THTMLCustomElement) : THTML_legend;
+    function taglegend (subs : TDOMNodelist) : THTML_legend;
+    function legend (s : string) : THTML_legend;
+    function legend (sub : THTMLCustomElement) : THTML_legend;
+    function legend (subs : Array of THTMLCustomElement) : THTML_legend;
+    function legend (subs : TDOMNodelist) : THTML_legend;
+    function Startlegend : THTML_legend;
+    function Endlegend : THTML_legend;
+
+    // tag "li", alias "listitem"
+    function tagli (s : string) : THTML_li;
+    function tagli (sub : THTMLCustomElement) : THTML_li;
+    function tagli (subs : Array of THTMLCustomElement) : THTML_li;
+    function tagli (subs : TDOMNodelist) : THTML_li;
+    function listitem (s : string) : THTML_li;
+    function listitem (sub : THTMLCustomElement) : THTML_li;
+    function listitem (subs : Array of THTMLCustomElement) : THTML_li;
+    function listitem (subs : TDOMNodelist) : THTML_li;
+    function Startli : THTML_li;
+    function Endli : THTML_li;
+    function Startlistitem : THTML_li;
+    function Endlistitem : THTML_li;
+
+    // tag "link", alias "link"
+    function taglink : THTML_link;
+    function link : THTML_link;
+
+    // tag "map", alias "map"
+    function tagmap (s : string) : THTML_map;
+    function tagmap (sub : THTMLCustomElement) : THTML_map;
+    function tagmap (subs : Array of THTMLCustomElement) : THTML_map;
+    function tagmap (subs : TDOMNodelist) : THTML_map;
+    function map (s : string) : THTML_map;
+    function map (sub : THTMLCustomElement) : THTML_map;
+    function map (subs : Array of THTMLCustomElement) : THTML_map;
+    function map (subs : TDOMNodelist) : THTML_map;
+    function Startmap : THTML_map;
+    function Endmap : THTML_map;
+
+    // tag "menu", alias "menu"
+    function tagmenu (s : string) : THTML_menu;
+    function tagmenu (sub : THTMLCustomElement) : THTML_menu;
+    function tagmenu (subs : Array of THTMLCustomElement) : THTML_menu;
+    function tagmenu (subs : TDOMNodelist) : THTML_menu;
+    function menu (s : string) : THTML_menu;
+    function menu (sub : THTMLCustomElement) : THTML_menu;
+    function menu (subs : Array of THTMLCustomElement) : THTML_menu;
+    function menu (subs : TDOMNodelist) : THTML_menu;
+    function Startmenu : THTML_menu;
+    function Endmenu : THTML_menu;
+
+    // tag "meta", alias "meta"
+    function tagmeta : THTML_meta;
+    function meta : THTML_meta;
+
+    // tag "noframes", alias "noframes"
+    function tagnoframes (s : string) : THTML_noframes;
+    function tagnoframes (sub : THTMLCustomElement) : THTML_noframes;
+    function tagnoframes (subs : Array of THTMLCustomElement) : THTML_noframes;
+    function tagnoframes (subs : TDOMNodelist) : THTML_noframes;
+    function noframes (s : string) : THTML_noframes;
+    function noframes (sub : THTMLCustomElement) : THTML_noframes;
+    function noframes (subs : Array of THTMLCustomElement) : THTML_noframes;
+    function noframes (subs : TDOMNodelist) : THTML_noframes;
+    function Startnoframes : THTML_noframes;
+    function Endnoframes : THTML_noframes;
+
+    // tag "noscript", alias "noscript"
+    function tagnoscript (s : string) : THTML_noscript;
+    function tagnoscript (sub : THTMLCustomElement) : THTML_noscript;
+    function tagnoscript (subs : Array of THTMLCustomElement) : THTML_noscript;
+    function tagnoscript (subs : TDOMNodelist) : THTML_noscript;
+    function noscript (s : string) : THTML_noscript;
+    function noscript (sub : THTMLCustomElement) : THTML_noscript;
+    function noscript (subs : Array of THTMLCustomElement) : THTML_noscript;
+    function noscript (subs : TDOMNodelist) : THTML_noscript;
+    function Startnoscript : THTML_noscript;
+    function Endnoscript : THTML_noscript;
+
+    // tag "object", alias "anobject"
+    function tagobject (s : string) : THTML_object;
+    function tagobject (sub : THTMLCustomElement) : THTML_object;
+    function tagobject (subs : Array of THTMLCustomElement) : THTML_object;
+    function tagobject (subs : TDOMNodelist) : THTML_object;
+    function anobject (s : string) : THTML_object;
+    function anobject (sub : THTMLCustomElement) : THTML_object;
+    function anobject (subs : Array of THTMLCustomElement) : THTML_object;
+    function anobject (subs : TDOMNodelist) : THTML_object;
+    function Startobject : THTML_object;
+    function Endobject : THTML_object;
+    function Startanobject : THTML_object;
+    function Endanobject : THTML_object;
+
+    // tag "ol", alias "orderedlist"
+    function tagol (s : string) : THTML_ol;
+    function tagol (sub : THTMLCustomElement) : THTML_ol;
+    function tagol (subs : Array of THTMLCustomElement) : THTML_ol;
+    function tagol (subs : TDOMNodelist) : THTML_ol;
+    function orderedlist (s : string) : THTML_ol;
+    function orderedlist (sub : THTMLCustomElement) : THTML_ol;
+    function orderedlist (subs : Array of THTMLCustomElement) : THTML_ol;
+    function orderedlist (subs : TDOMNodelist) : THTML_ol;
+    function Startol : THTML_ol;
+    function Endol : THTML_ol;
+    function Startorderedlist : THTML_ol;
+    function Endorderedlist : THTML_ol;
+
+    // tag "optgroup", alias "optiongroup"
+    function tagoptgroup (s : string) : THTML_optgroup;
+    function tagoptgroup (sub : THTMLCustomElement) : THTML_optgroup;
+    function tagoptgroup (subs : Array of THTMLCustomElement) : THTML_optgroup;
+    function tagoptgroup (subs : TDOMNodelist) : THTML_optgroup;
+    function optiongroup (s : string) : THTML_optgroup;
+    function optiongroup (sub : THTMLCustomElement) : THTML_optgroup;
+    function optiongroup (subs : Array of THTMLCustomElement) : THTML_optgroup;
+    function optiongroup (subs : TDOMNodelist) : THTML_optgroup;
+    function Startoptgroup : THTML_optgroup;
+    function Endoptgroup : THTML_optgroup;
+    function Startoptiongroup : THTML_optgroup;
+    function Endoptiongroup : THTML_optgroup;
+
+    // tag "option", alias "option"
+    function tagoption (s : string) : THTML_option;
+    function tagoption (sub : THTMLCustomElement) : THTML_option;
+    function tagoption (subs : Array of THTMLCustomElement) : THTML_option;
+    function tagoption (subs : TDOMNodelist) : THTML_option;
+    function option (s : string) : THTML_option;
+    function option (sub : THTMLCustomElement) : THTML_option;
+    function option (subs : Array of THTMLCustomElement) : THTML_option;
+    function option (subs : TDOMNodelist) : THTML_option;
+    function Startoption : THTML_option;
+    function Endoption : THTML_option;
+
+    // tag "p", alias "paragraph"
+    function tagp (s : string) : THTML_p;
+    function tagp (sub : THTMLCustomElement) : THTML_p;
+    function tagp (subs : Array of THTMLCustomElement) : THTML_p;
+    function tagp (subs : TDOMNodelist) : THTML_p;
+    function paragraph (s : string) : THTML_p;
+    function paragraph (sub : THTMLCustomElement) : THTML_p;
+    function paragraph (subs : Array of THTMLCustomElement) : THTML_p;
+    function paragraph (subs : TDOMNodelist) : THTML_p;
+    function Startp : THTML_p;
+    function Endp : THTML_p;
+    function Startparagraph : THTML_p;
+    function Endparagraph : THTML_p;
+
+    // tag "param", alias "parameter"
+    function tagparam : THTML_param;
+    function parameter : THTML_param;
+
+    // tag "pre", alias "preformatted"
+    function tagpre (s : string) : THTML_pre;
+    function tagpre (sub : THTMLCustomElement) : THTML_pre;
+    function tagpre (subs : Array of THTMLCustomElement) : THTML_pre;
+    function tagpre (subs : TDOMNodelist) : THTML_pre;
+    function preformatted (s : string) : THTML_pre;
+    function preformatted (sub : THTMLCustomElement) : THTML_pre;
+    function preformatted (subs : Array of THTMLCustomElement) : THTML_pre;
+    function preformatted (subs : TDOMNodelist) : THTML_pre;
+    function Startpre : THTML_pre;
+    function Endpre : THTML_pre;
+    function Startpreformatted : THTML_pre;
+    function Endpreformatted : THTML_pre;
+
+    // tag "q", alias "quotation"
+    function tagq (s : string) : THTML_q;
+    function tagq (sub : THTMLCustomElement) : THTML_q;
+    function tagq (subs : Array of THTMLCustomElement) : THTML_q;
+    function tagq (subs : TDOMNodelist) : THTML_q;
+    function quotation (s : string) : THTML_q;
+    function quotation (sub : THTMLCustomElement) : THTML_q;
+    function quotation (subs : Array of THTMLCustomElement) : THTML_q;
+    function quotation (subs : TDOMNodelist) : THTML_q;
+    function Startq : THTML_q;
+    function Endq : THTML_q;
+    function Startquotation : THTML_q;
+    function Endquotation : THTML_q;
+
+    // tag "s", alias "strikethrough"
+    function tags (s : string) : THTML_s;
+    function tags (sub : THTMLCustomElement) : THTML_s;
+    function tags (subs : Array of THTMLCustomElement) : THTML_s;
+    function tags (subs : TDOMNodelist) : THTML_s;
+    function strikethrough (s : string) : THTML_s;
+    function strikethrough (sub : THTMLCustomElement) : THTML_s;
+    function strikethrough (subs : Array of THTMLCustomElement) : THTML_s;
+    function strikethrough (subs : TDOMNodelist) : THTML_s;
+    function Starts : THTML_s;
+    function Ends : THTML_s;
+    function Startstrikethrough : THTML_s;
+    function Endstrikethrough : THTML_s;
+
+    // tag "samp", alias "sample"
+    function tagsamp (s : string) : THTML_samp;
+    function tagsamp (sub : THTMLCustomElement) : THTML_samp;
+    function tagsamp (subs : Array of THTMLCustomElement) : THTML_samp;
+    function tagsamp (subs : TDOMNodelist) : THTML_samp;
+    function sample (s : string) : THTML_samp;
+    function sample (sub : THTMLCustomElement) : THTML_samp;
+    function sample (subs : Array of THTMLCustomElement) : THTML_samp;
+    function sample (subs : TDOMNodelist) : THTML_samp;
+    function Startsamp : THTML_samp;
+    function Endsamp : THTML_samp;
+    function Startsample : THTML_samp;
+    function Endsample : THTML_samp;
+
+    // tag "script", alias "script"
+    function tagscript (s : string) : THTML_script;
+    function tagscript (sub : THTMLCustomElement) : THTML_script;
+    function tagscript (subs : Array of THTMLCustomElement) : THTML_script;
+    function tagscript (subs : TDOMNodelist) : THTML_script;
+    function script (s : string) : THTML_script;
+    function script (sub : THTMLCustomElement) : THTML_script;
+    function script (subs : Array of THTMLCustomElement) : THTML_script;
+    function script (subs : TDOMNodelist) : THTML_script;
+    function Startscript : THTML_script;
+    function Endscript : THTML_script;
+
+    // tag "select", alias "select"
+    function tagselect (s : string) : THTML_select;
+    function tagselect (sub : THTMLCustomElement) : THTML_select;
+    function tagselect (subs : Array of THTMLCustomElement) : THTML_select;
+    function tagselect (subs : TDOMNodelist) : THTML_select;
+    function select (s : string) : THTML_select;
+    function select (sub : THTMLCustomElement) : THTML_select;
+    function select (subs : Array of THTMLCustomElement) : THTML_select;
+    function select (subs : TDOMNodelist) : THTML_select;
+    function Startselect : THTML_select;
+    function Endselect : THTML_select;
+
+    // tag "small", alias "small"
+    function tagsmall (s : string) : THTML_small;
+    function tagsmall (sub : THTMLCustomElement) : THTML_small;
+    function tagsmall (subs : Array of THTMLCustomElement) : THTML_small;
+    function tagsmall (subs : TDOMNodelist) : THTML_small;
+    function small (s : string) : THTML_small;
+    function small (sub : THTMLCustomElement) : THTML_small;
+    function small (subs : Array of THTMLCustomElement) : THTML_small;
+    function small (subs : TDOMNodelist) : THTML_small;
+    function Startsmall : THTML_small;
+    function Endsmall : THTML_small;
+
+    // tag "span", alias "span"
+    function tagspan (s : string) : THTML_span;
+    function tagspan (sub : THTMLCustomElement) : THTML_span;
+    function tagspan (subs : Array of THTMLCustomElement) : THTML_span;
+    function tagspan (subs : TDOMNodelist) : THTML_span;
+    function span (s : string) : THTML_span;
+    function span (sub : THTMLCustomElement) : THTML_span;
+    function span (subs : Array of THTMLCustomElement) : THTML_span;
+    function span (subs : TDOMNodelist) : THTML_span;
+    function Startspan : THTML_span;
+    function Endspan : THTML_span;
+
+    // tag "strike", alias "strike"
+    function tagstrike (s : string) : THTML_strike;
+    function tagstrike (sub : THTMLCustomElement) : THTML_strike;
+    function tagstrike (subs : Array of THTMLCustomElement) : THTML_strike;
+    function tagstrike (subs : TDOMNodelist) : THTML_strike;
+    function strike (s : string) : THTML_strike;
+    function strike (sub : THTMLCustomElement) : THTML_strike;
+    function strike (subs : Array of THTMLCustomElement) : THTML_strike;
+    function strike (subs : TDOMNodelist) : THTML_strike;
+    function Startstrike : THTML_strike;
+    function Endstrike : THTML_strike;
+
+    // tag "strong", alias "strong"
+    function tagstrong (s : string) : THTML_strong;
+    function tagstrong (sub : THTMLCustomElement) : THTML_strong;
+    function tagstrong (subs : Array of THTMLCustomElement) : THTML_strong;
+    function tagstrong (subs : TDOMNodelist) : THTML_strong;
+    function strong (s : string) : THTML_strong;
+    function strong (sub : THTMLCustomElement) : THTML_strong;
+    function strong (subs : Array of THTMLCustomElement) : THTML_strong;
+    function strong (subs : TDOMNodelist) : THTML_strong;
+    function Startstrong : THTML_strong;
+    function Endstrong : THTML_strong;
+
+    // tag "style", alias "style"
+    function tagstyle (s : string) : THTML_style;
+    function tagstyle (sub : THTMLCustomElement) : THTML_style;
+    function tagstyle (subs : Array of THTMLCustomElement) : THTML_style;
+    function tagstyle (subs : TDOMNodelist) : THTML_style;
+    function style (s : string) : THTML_style;
+    function style (sub : THTMLCustomElement) : THTML_style;
+    function style (subs : Array of THTMLCustomElement) : THTML_style;
+    function style (subs : TDOMNodelist) : THTML_style;
+    function Startstyle : THTML_style;
+    function Endstyle : THTML_style;
+
+    // tag "sub", alias "subscript"
+    function tagsub (s : string) : THTML_sub;
+    function tagsub (sub : THTMLCustomElement) : THTML_sub;
+    function tagsub (subs : Array of THTMLCustomElement) : THTML_sub;
+    function tagsub (subs : TDOMNodelist) : THTML_sub;
+    function subscript (s : string) : THTML_sub;
+    function subscript (sub : THTMLCustomElement) : THTML_sub;
+    function subscript (subs : Array of THTMLCustomElement) : THTML_sub;
+    function subscript (subs : TDOMNodelist) : THTML_sub;
+    function Startsub : THTML_sub;
+    function Endsub : THTML_sub;
+    function Startsubscript : THTML_sub;
+    function Endsubscript : THTML_sub;
+
+    // tag "sup", alias "superscript"
+    function tagsup (s : string) : THTML_sup;
+    function tagsup (sub : THTMLCustomElement) : THTML_sup;
+    function tagsup (subs : Array of THTMLCustomElement) : THTML_sup;
+    function tagsup (subs : TDOMNodelist) : THTML_sup;
+    function superscript (s : string) : THTML_sup;
+    function superscript (sub : THTMLCustomElement) : THTML_sup;
+    function superscript (subs : Array of THTMLCustomElement) : THTML_sup;
+    function superscript (subs : TDOMNodelist) : THTML_sup;
+    function Startsup : THTML_sup;
+    function Endsup : THTML_sup;
+    function Startsuperscript : THTML_sup;
+    function Endsuperscript : THTML_sup;
+
+    // tag "table", alias "table"
+    function tagtable (s : string) : THTML_table;
+    function tagtable (sub : THTMLCustomElement) : THTML_table;
+    function tagtable (subs : Array of THTMLCustomElement) : THTML_table;
+    function tagtable (subs : TDOMNodelist) : THTML_table;
+    function table (s : string) : THTML_table;
+    function table (sub : THTMLCustomElement) : THTML_table;
+    function table (subs : Array of THTMLCustomElement) : THTML_table;
+    function table (subs : TDOMNodelist) : THTML_table;
+    function Starttable : THTML_table;
+    function Endtable : THTML_table;
+
+    // tag "tbody", alias "tablebody"
+    function tagtbody (s : string) : THTML_tbody;
+    function tagtbody (sub : THTMLCustomElement) : THTML_tbody;
+    function tagtbody (subs : Array of THTMLCustomElement) : THTML_tbody;
+    function tagtbody (subs : TDOMNodelist) : THTML_tbody;
+    function tablebody (s : string) : THTML_tbody;
+    function tablebody (sub : THTMLCustomElement) : THTML_tbody;
+    function tablebody (subs : Array of THTMLCustomElement) : THTML_tbody;
+    function tablebody (subs : TDOMNodelist) : THTML_tbody;
+    function Starttbody : THTML_tbody;
+    function Endtbody : THTML_tbody;
+    function Starttablebody : THTML_tbody;
+    function Endtablebody : THTML_tbody;
+
+    // tag "td", alias "tablecell"
+    function tagtd (s : string) : THTML_td;
+    function tagtd (sub : THTMLCustomElement) : THTML_td;
+    function tagtd (subs : Array of THTMLCustomElement) : THTML_td;
+    function tagtd (subs : TDOMNodelist) : THTML_td;
+    function tablecell (s : string) : THTML_td;
+    function tablecell (sub : THTMLCustomElement) : THTML_td;
+    function tablecell (subs : Array of THTMLCustomElement) : THTML_td;
+    function tablecell (subs : TDOMNodelist) : THTML_td;
+    function Starttd : THTML_td;
+    function Endtd : THTML_td;
+    function Starttablecell : THTML_td;
+    function Endtablecell : THTML_td;
+
+    // tag "textarea", alias "textarea"
+    function tagtextarea (s : string) : THTML_textarea;
+    function tagtextarea (sub : THTMLCustomElement) : THTML_textarea;
+    function tagtextarea (subs : Array of THTMLCustomElement) : THTML_textarea;
+    function tagtextarea (subs : TDOMNodelist) : THTML_textarea;
+    function textarea (s : string) : THTML_textarea;
+    function textarea (sub : THTMLCustomElement) : THTML_textarea;
+    function textarea (subs : Array of THTMLCustomElement) : THTML_textarea;
+    function textarea (subs : TDOMNodelist) : THTML_textarea;
+    function Starttextarea : THTML_textarea;
+    function Endtextarea : THTML_textarea;
+
+    // tag "tfoot", alias "tablefoot"
+    function tagtfoot (s : string) : THTML_tfoot;
+    function tagtfoot (sub : THTMLCustomElement) : THTML_tfoot;
+    function tagtfoot (subs : Array of THTMLCustomElement) : THTML_tfoot;
+    function tagtfoot (subs : TDOMNodelist) : THTML_tfoot;
+    function tablefoot (s : string) : THTML_tfoot;
+    function tablefoot (sub : THTMLCustomElement) : THTML_tfoot;
+    function tablefoot (subs : Array of THTMLCustomElement) : THTML_tfoot;
+    function tablefoot (subs : TDOMNodelist) : THTML_tfoot;
+    function Starttfoot : THTML_tfoot;
+    function Endtfoot : THTML_tfoot;
+    function Starttablefoot : THTML_tfoot;
+    function Endtablefoot : THTML_tfoot;
+
+    // tag "th", alias "tableheadcell"
+    function tagth (s : string) : THTML_th;
+    function tagth (sub : THTMLCustomElement) : THTML_th;
+    function tagth (subs : Array of THTMLCustomElement) : THTML_th;
+    function tagth (subs : TDOMNodelist) : THTML_th;
+    function tableheadcell (s : string) : THTML_th;
+    function tableheadcell (sub : THTMLCustomElement) : THTML_th;
+    function tableheadcell (subs : Array of THTMLCustomElement) : THTML_th;
+    function tableheadcell (subs : TDOMNodelist) : THTML_th;
+    function Startth : THTML_th;
+    function Endth : THTML_th;
+    function Starttableheadcell : THTML_th;
+    function Endtableheadcell : THTML_th;
+
+    // tag "thead", alias "tablehead"
+    function tagthead (s : string) : THTML_thead;
+    function tagthead (sub : THTMLCustomElement) : THTML_thead;
+    function tagthead (subs : Array of THTMLCustomElement) : THTML_thead;
+    function tagthead (subs : TDOMNodelist) : THTML_thead;
+    function tablehead (s : string) : THTML_thead;
+    function tablehead (sub : THTMLCustomElement) : THTML_thead;
+    function tablehead (subs : Array of THTMLCustomElement) : THTML_thead;
+    function tablehead (subs : TDOMNodelist) : THTML_thead;
+    function Startthead : THTML_thead;
+    function Endthead : THTML_thead;
+    function Starttablehead : THTML_thead;
+    function Endtablehead : THTML_thead;
+
+    // tag "title", alias "title"
+    function tagtitle (s : string) : THTML_title;
+    function tagtitle (sub : THTMLCustomElement) : THTML_title;
+    function tagtitle (subs : Array of THTMLCustomElement) : THTML_title;
+    function tagtitle (subs : TDOMNodelist) : THTML_title;
+    function title (s : string) : THTML_title;
+    function title (sub : THTMLCustomElement) : THTML_title;
+    function title (subs : Array of THTMLCustomElement) : THTML_title;
+    function title (subs : TDOMNodelist) : THTML_title;
+    function Starttitle : THTML_title;
+    function Endtitle : THTML_title;
+
+    // tag "tr", alias "tablerow"
+    function tagtr (s : string) : THTML_tr;
+    function tagtr (sub : THTMLCustomElement) : THTML_tr;
+    function tagtr (subs : Array of THTMLCustomElement) : THTML_tr;
+    function tagtr (subs : TDOMNodelist) : THTML_tr;
+    function tablerow (s : string) : THTML_tr;
+    function tablerow (sub : THTMLCustomElement) : THTML_tr;
+    function tablerow (subs : Array of THTMLCustomElement) : THTML_tr;
+    function tablerow (subs : TDOMNodelist) : THTML_tr;
+    function Starttr : THTML_tr;
+    function Endtr : THTML_tr;
+    function Starttablerow : THTML_tr;
+    function Endtablerow : THTML_tr;
+
+    // tag "tt", alias "teletype"
+    function tagtt (s : string) : THTML_tt;
+    function tagtt (sub : THTMLCustomElement) : THTML_tt;
+    function tagtt (subs : Array of THTMLCustomElement) : THTML_tt;
+    function tagtt (subs : TDOMNodelist) : THTML_tt;
+    function teletype (s : string) : THTML_tt;
+    function teletype (sub : THTMLCustomElement) : THTML_tt;
+    function teletype (subs : Array of THTMLCustomElement) : THTML_tt;
+    function teletype (subs : TDOMNodelist) : THTML_tt;
+    function Starttt : THTML_tt;
+    function Endtt : THTML_tt;
+    function Startteletype : THTML_tt;
+    function Endteletype : THTML_tt;
+
+    // tag "u", alias "underlined"
+    function tagu (s : string) : THTML_u;
+    function tagu (sub : THTMLCustomElement) : THTML_u;
+    function tagu (subs : Array of THTMLCustomElement) : THTML_u;
+    function tagu (subs : TDOMNodelist) : THTML_u;
+    function underlined (s : string) : THTML_u;
+    function underlined (sub : THTMLCustomElement) : THTML_u;
+    function underlined (subs : Array of THTMLCustomElement) : THTML_u;
+    function underlined (subs : TDOMNodelist) : THTML_u;
+    function Startu : THTML_u;
+    function Endu : THTML_u;
+    function Startunderlined : THTML_u;
+    function Endunderlined : THTML_u;
+
+    // tag "ul", alias "unorederedlist"
+    function tagul (s : string) : THTML_ul;
+    function tagul (sub : THTMLCustomElement) : THTML_ul;
+    function tagul (subs : Array of THTMLCustomElement) : THTML_ul;
+    function tagul (subs : TDOMNodelist) : THTML_ul;
+    function unorederedlist (s : string) : THTML_ul;
+    function unorederedlist (sub : THTMLCustomElement) : THTML_ul;
+    function unorederedlist (subs : Array of THTMLCustomElement) : THTML_ul;
+    function unorederedlist (subs : TDOMNodelist) : THTML_ul;
+    function Startul : THTML_ul;
+    function Endul : THTML_ul;
+    function Startunorederedlist : THTML_ul;
+    function Endunorederedlist : THTML_ul;
+
+    // tag "var", alias "variable"
+    function tagvar (s : string) : THTML_var;
+    function tagvar (sub : THTMLCustomElement) : THTML_var;
+    function tagvar (subs : Array of THTMLCustomElement) : THTML_var;
+    function tagvar (subs : TDOMNodelist) : THTML_var;
+    function variable (s : string) : THTML_var;
+    function variable (sub : THTMLCustomElement) : THTML_var;
+    function variable (subs : Array of THTMLCustomElement) : THTML_var;
+    function variable (subs : TDOMNodelist) : THTML_var;
+    function Startvar : THTML_var;
+    function Endvar : THTML_var;
+    function Startvariable : THTML_var;
+    function Endvariable : THTML_var;

+ 43 - 43
fcl/xml/Makefile

@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/08/02]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/08/20]
 #
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince arm-gba powerpc64-linux
@@ -233,127 +233,127 @@ PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/ext
 override PACKAGE_NAME=fcl
 PACKAGEDIR_MAIN:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR))))))
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+override TARGET_UNITS+=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_RSTS+=sax xpath
@@ -1546,7 +1546,7 @@ ifeq ($(CPU_TARGET),powerpc)
 FPCCPUOPT:=-O1r
 endif
 else
-FPCCPUOPT:=-O2
+FPCCPUOPT:=-O1r
 endif
 override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n
 override FPCOPTDEF+=RELEASE

+ 1 - 1
fcl/xml/Makefile.fpc

@@ -6,7 +6,7 @@
 main=fcl
 
 [target]
-units=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmldefs htmwrite xpath
+units=sax dom sax_html dom_html xmlcfg xmlread xmlstreaming xmlwrite xhtml htmwrite xpath
 rsts=sax xpath
 
 [compiler]

+ 0 - 348
fcl/xml/htmldefs.pp

@@ -1,348 +0,0 @@
-{
-    This file is part of the Free Component Library
-
-    HTML definitions and utility functions
-    Copyright (c) 2000-2002 by
-      Areca Systems GmbH / Sebastian Guenther, [email protected]
-
-    See the file COPYING.FPC, included in this distribution,
-    for details about the copyright.
-
-    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.
-
- **********************************************************************}
-
-
-unit HTMLDefs;
-
-{$MODE objfpc}
-{$H+}
-
-interface
-
-type
-
-  THTMLElementFlags = set of (
-    efSubelementContent,                // may have subelements
-    efPCDATAContent,                    // may have PCDATA content
-    efPreserveWhitespace);              // preserve all whitespace
-
-  PHTMLElementProps = ^THTMLElementProps;
-  THTMLElementProps = record
-    Name: String;
-    Flags: THTMLElementFlags;
-  end;
-
-
-const
-
-  HTMLElProps: array[0..78] of THTMLElementProps = (
-    (Name: 'a';         Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'abbr';      Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'acronym';   Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'address';   Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'applet';    Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'b';         Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'basefont';  Flags: []),
-    (Name: 'bdo';       Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'big';       Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'blockquote';Flags: [efSubelementContent]),
-    (Name: 'body';      Flags: [efSubelementContent]),
-    (Name: 'br';        Flags: []),
-    (Name: 'button';    Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'caption';   Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'center';    Flags: [efSubelementContent]),
-    (Name: 'cite';      Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'code';      Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'col';       Flags: []),
-    (Name: 'colgroup';  Flags: [efSubelementContent]),
-    (Name: 'del';       Flags: [efSubelementContent]),
-    (Name: 'dfn';       Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'dir';       Flags: [efSubelementContent]),
-    (Name: 'div';       Flags: [efSubelementContent]),
-    (Name: 'dl';        Flags: [efSubelementContent]),
-    (Name: 'em';        Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'fieldset';  Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'font';      Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'form';      Flags: [efSubelementContent]),
-    (Name: 'h1';        Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'h2';        Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'h3';        Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'h4';        Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'h5';        Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'h6';        Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'head';      Flags: [efSubelementContent]),
-    (Name: 'hr';        Flags: []),
-    (Name: 'html';      Flags: [efSubelementContent]),
-    (Name: 'i';         Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'iframe';    Flags: [efSubelementContent]),
-    (Name: 'img';       Flags: []),
-    (Name: 'input';     Flags: []),
-    (Name: 'ins';       Flags: [efSubelementContent]),
-    (Name: 'isindex';   Flags: []),
-    (Name: 'kbd';       Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'label';     Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'link';      Flags: []),
-    (Name: 'map';       Flags: [efSubelementContent]),
-    (Name: 'menu';      Flags: [efSubelementContent]),
-    (Name: 'meta';      Flags: []),
-    (Name: 'noframes';  Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'noscript';  Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'object';    Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'ol';        Flags: [efSubelementContent]),
-    (Name: 'p';         Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'pre';       Flags: [efSubelementContent, efPCDATAContent, efPreserveWhitespace]),
-    (Name: 'q';         Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 's';         Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'samp';      Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'script';    Flags: [efPCDATAContent]),
-    (Name: 'select';    Flags: [efSubelementContent]),
-    (Name: 'small';     Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'span';      Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'strike';    Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'strong';    Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'style';     Flags: [efPCDATAContent]),
-    (Name: 'sub';       Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'sup';       Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'table';     Flags: [efSubelementContent]),
-    (Name: 'textarea';  Flags: [efPCDATAContent]),
-    (Name: 'tbody';     Flags: [efSubelementContent]),
-    (Name: 'td';        Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'tfoot';     Flags: [efSubelementContent]),
-    (Name: 'th';        Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'thead';     Flags: [efSubelementContent]),
-    (Name: 'tr';        Flags: [efSubelementContent]),
-    (Name: 'tt';        Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'u';         Flags: [efSubelementContent, efPCDATAContent]),
-    (Name: 'ul';        Flags: [efSubelementContent]),
-    (Name: 'var';       Flags: [efSubelementContent, efPCDATAContent]));
-
-
-  // ISO8859-1 mapping:
-  HTMLEntities: array[#160..#255] of String = (
-    // 160-191
-    'nbsp', 'iexcl', 'cent', 'pound', 'curren', 'yen', 'brvbar', 'sect',
-    'uml', 'copy', 'ordf', 'laquo', 'not', 'shy', 'reg', 'macr',
-    'deg', 'plusmn', 'sup2', 'sup3', 'acute', 'micro', 'para', 'middot',
-    'cedil', 'sup1', 'ordm', 'raquo', 'frac14', 'frac12', 'frac34', 'iquest',
-    // 192-223
-    'Agrave', 'Aacute', 'Acirc', 'Atilde', 'Auml', 'Aring', 'AElig', 'Ccedil',
-    'Egrave', 'Eacute', 'Ecirc', 'Euml', 'Igrave', 'Iacute', 'Icirc', 'Iuml',
-    'ETH', 'Ntilde', 'Ograve', 'Oacute', 'Ocirc', 'Otilde', 'Ouml', 'times',
-    'Oslash', 'Ugrave', 'Uacute', 'Ucirc', 'Uuml', 'Yacute', 'THORN', 'szlig',
-    // 224-255
-    'agrave', 'aacute', 'acirc', 'atilde', 'auml', 'aring', 'aelig', 'ccedil',
-    'egrave', 'eacute', 'ecirc', 'euml', 'igrave', 'iacute', 'icirc', 'iuml',
-    'eth', 'ntilde', 'ograve', 'oacute', 'ocirc', 'otilde', 'ouml', 'divide',
-    'oslash', 'ugrave', 'uacute', 'ucirc', 'uuml', 'yacute', 'thorn', 'yuml');
-
-
-  UnicodeHTMLEntities: array[0..141] of String = (
-    'Alpha',    // #913
-    'Beta',     // #914
-    'Gamma',    // #915
-    'Delta',    // #916
-    'Epsilon',  // #917
-    'Zeta',     // #918
-    'Eta',      // #919
-    'Theta',    // #920
-    'Iota',     // #921
-    'Kappa',    // #922
-    'Lambda',   // #923
-    'Mu',       // #924
-    'Nu',       // #925
-    'Xi',       // #926
-    'Omicron',  // #927
-    'Pi',       // #928
-    'Rho',      // #929
-    'Sigma',    // #931
-    'Tau',      // #932
-    'Upsilon',  // #933
-    'Phi',      // #934
-    'Chi',      // #935
-    'Psi',      // #936
-    'Omega',    // #937
-    'alpha',    // #945
-    'beta',     // #946
-    'gamma',    // #947
-    'delta',    // #948
-    'epsilon',  // #949
-    'zeta',     // #950
-    'eta',      // #951
-    'theta',    // #952
-    'iota',     // #953
-    'kappa',    // #954
-    'lambda',   // #955
-    'mu',       // #956
-    'nu',       // #957
-    'xi',       // #958
-    'omicron',  // #959
-    'pi',       // #960
-    'rho',      // #961
-    'sigmaf',   // #962
-    'sigma',    // #963
-    'tau',      // #964
-    'upsilon',  // #965
-    'phi',      // #966
-    'chi',      // #967
-    'psi',      // #968
-    'omega',    // #969
-    'thetasym', // #977
-    'upsih',    // #978
-    'piv',      // #982
-    'ensp',     // #8194
-    'emsp',     // #8195
-    'thinsp',   // #8201
-    'zwnj',     // #8204
-    'zwj',      // #8205
-    'lrm',      // #8206
-    'rlm',      // #8207
-    'ndash',    // #8211
-    'mdash',    // #8212
-    'lsquo',    // #8216
-    'rsquo',    // #8217
-    'sbquo',    // #8218
-    'ldquo',    // #8220
-    'rdquo',    // #8221
-    'bdquo',    // #8222
-    'dagger',   // #8224
-    'Dagger',   // #8225
-    'bull',     // #8226
-    'hellip',   // #8230
-    'permil',   // #8240
-    'prime',    // #8242
-    'lsaquo',   // #8249
-    'rsaquo',   // #8250
-    'oline',    // #8254
-    'frasl',    // #8260
-    'image',    // #8465
-    'weierp',   // #8472
-    'real',     // #8476
-    'trade',    // #8482
-    'alefsym',  // #8501
-    'larr',     // #8592
-    'uarr',     // #8593
-    'rarr',     // #8594
-    'darr',     // #8595
-    'harr',     // #8596
-    'crarr',    // #8629
-    'lArr',     // #8656
-    'uArr',     // #8657
-    'rArr',     // #8658
-    'dArr',     // #8659
-    'hArr',     // #8660
-    'forall',   // #8704
-    'part',     // #8706
-    'exist',    // #8707
-    'empty',    // #8709
-    'nabla',    // #8711
-    'isin',     // #8712
-    'notin',    // #8713
-    'ni',       // #8715
-    'prod',     // #8719
-    'sum',      // #8721
-    'minus',    // #8722
-    'lowast',   // #8727
-    'radic',    // #8730
-    'prop',     // #8733
-    'infin',    // #8734
-    'ang',      // #8736
-    'and',      // #8743
-    'or',       // #8744
-    'cap',      // #8745
-    'cup',      // #8746
-    'int',      // #8747
-    'there4',   // #8756
-    'sim',      // #8764
-    'cong',     // #8773
-    'asymp',    // #8776
-    'ne',       // #8800
-    'equiv',    // #8801
-    'le',       // #8804
-    'ge',       // #8805
-    'sub',      // #8834
-    'sup',      // #8835
-    'nsub',     // #8836
-    'sube',     // #8838
-    'supe',     // #8839
-    'oplus',    // #8853
-    'otimes',   // #8855
-    'perp',     // #8869
-    'sdot',     // #8901
-    'lceil',    // #8968
-    'rceil',    // #8969
-    'lfloor',   // #8970
-    'rfloor',   // #8971
-    'lang',     // #9001
-    'rang',     // #9002
-    'loz',      // #9674
-    'spades',   // #9824
-    'clubs',    // #9827
-    'hearts',   // #9829
-    'diams'     // #9830
-  );
-
-
-
-function ResolveHTMLEntityReference(const Name: String;
-  var Entity: Char): Boolean;
-
-
-
-implementation
-
-uses SysUtils;
-
-function ResolveHTMLEntityReference(const Name: String;
-  var Entity: Char): Boolean;
-var
-  Ent: Char;
-  i: Integer;
-begin
-  if Name = 'quot' then
-  begin
-    Entity := '"';
-    Result := True;
-  end else if Name = 'apos' then
-  begin
-    Entity := '''';
-    Result := True;
-  end else if Name = 'amp' then
-  begin
-    Entity := '&';
-    Result := True;
-  end else if Name = 'lt' then
-  begin
-    Entity := '<';
-    Result := True;
-  end else if Name = 'gt' then
-  begin
-    Entity := '>';
-    Result := True;
-  end else if (Length(Name) > 0) and (Name[1] = '#') then
-  begin
-    for i := 2 to Length(Name) do
-      if (Name[i] < '0') or (Name[i] > '9') then
-        break;
-    if i > 2 then
-    begin
-      Entity := Chr(StrToInt(Copy(Name, 2, i - 1)));
-      Result := True;
-    end else
-      Result := False;
-  end else
-  begin
-    for Ent := Low(HTMLEntities) to High(HTMLEntities) do
-      if HTMLEntities[Ent] = Name then
-      begin
-        Entity := Ent;
-        Result := True;
-        exit;
-      end;
-    Result := False;
-  end;
-end;
-
-end.