├── .gitignore ├── COMPILE.txt ├── COPYING ├── COPYING.html ├── COPYRIGHT ├── ChangeLog ├── Makefile.in ├── README ├── aclocal.m4 ├── configure ├── configure.in ├── doc ├── browser.man ├── html.man ├── hv3.man ├── interface.html ├── macros.tcl ├── notes1.txt ├── simple.make ├── spec.html ├── tkhtml.html ├── tkhtml.n ├── tkhtml_requirements.tcl ├── tree.fig └── tree.gif ├── hv ├── README ├── bookmarks.html ├── bugreport.html ├── combobox.tcl ├── dom_events.html ├── hv.tcl ├── hv3.tcl ├── hv3_bookmarks.tcl ├── hv3_browser.tcl ├── hv3_bugreport.tcl ├── hv3_common.tcl ├── hv3_console.tcl ├── hv3_db.tcl ├── hv3_debug.tcl ├── hv3_doctype.tcl ├── hv3_dom.tcl ├── hv3_dom2.tcl ├── hv3_dom3.tcl ├── hv3_dom_compiler.tcl ├── hv3_dom_containers.tcl ├── hv3_dom_core.tcl ├── hv3_dom_events.tcl ├── hv3_dom_html.tcl ├── hv3_dom_ns.tcl ├── hv3_dom_style.tcl ├── hv3_dom_xmlhttp.tcl ├── hv3_download.tcl ├── hv3_encodings.tcl ├── hv3_file.tcl ├── hv3_form.tcl ├── hv3_frames.tcl ├── hv3_frameset.tcl ├── hv3_history.tcl ├── hv3_home.tcl ├── hv3_http.tcl ├── hv3_icons.tcl ├── hv3_image.tcl ├── hv3_log.tcl ├── hv3_main.tcl ├── hv3_nav.tcl ├── hv3_notebook.tcl ├── hv3_object.tcl ├── hv3_polipo.tcl ├── hv3_profile.tcl ├── hv3_prop.tcl ├── hv3_request.tcl ├── hv3_string.tcl ├── hv3_style.tcl ├── hv3_url.tcl ├── hv3_util.tcl ├── hv3_widgets.tcl ├── hv3bridge.c ├── hv3events.c ├── hv3format.c ├── hv3function.c ├── hv3see.c ├── hv3timeout.c ├── hvinit.c ├── index.html ├── license.txt ├── main.tcl ├── nogif.fig ├── nogif.gif ├── nogifsm.gif ├── snit.tcl ├── snit2.tcl ├── ss.tcl ├── ssinit.c └── tst_main.tcl ├── linux-gcc.mk ├── linux-mingw.mk ├── listvers.sh ├── main.mk ├── make_main_mk.tcl ├── makemake.tcl.in ├── mingw.mk ├── mkdll.sh ├── mkso.sh ├── nightly.sh ├── puppy.sh ├── src ├── .gitignore ├── css.c ├── css.h ├── cssInt.h ├── cssdynamic.c ├── cssparse.lem ├── cssparse.y ├── cssparser.c ├── cssprop.tcl ├── csssearch.c ├── html.css ├── html.h ├── htmlPs.c ├── htmlPsImg.c ├── htmlcmd.c ├── htmldecode.c ├── htmldraw.c ├── htmlexts.c ├── htmlfloat.c ├── htmlform.c ├── htmlhash.c ├── htmlimage.c ├── htmlindex.c ├── htmlinline.c ├── htmllayout.c ├── htmllayout.h ├── htmllib.c ├── htmlmacros.h ├── htmlparse.c ├── htmlprop.c ├── htmlprop.h ├── htmlrender.c ├── htmlsizer.c ├── htmlstyle.c ├── htmltable.c ├── htmltagdb.c ├── htmltcl.c ├── htmltest.c ├── htmltext.c ├── htmltree.c ├── htmlurl.c ├── htmlutil.c ├── htmlwidget.c ├── htmlwish.c ├── main.c ├── mkdefaultstyle.tcl ├── quirks.css ├── restrack.c ├── restrack.h ├── swproc.c ├── swproc.h ├── tkhtml.tcl └── tokenlist.txt ├── tclconfig ├── ChangeLog ├── README.txt ├── install-sh └── tcl.m4 ├── tests ├── README ├── all.tcl ├── all.test ├── autotest.test ├── browsertest.tcl ├── canvas.tcl ├── common.tcl ├── dynamic.test ├── encoding.bt ├── engine.tcl ├── events.bt ├── form.bt ├── form1.html ├── html.css ├── html1.test ├── html2.test ├── html3.test ├── html4.test ├── html5.test ├── hv.tcl ├── image.tcl ├── main.tcl ├── node.bt ├── options.test ├── page1 │ ├── image1 │ ├── image10 │ ├── image11 │ ├── image12 │ ├── image13 │ ├── image14 │ ├── image2 │ ├── image3 │ ├── image4 │ ├── image5 │ ├── image6 │ ├── image7 │ ├── image8 │ ├── image9 │ └── index.html ├── page2 │ ├── image1 │ ├── image10 │ ├── image11 │ ├── image12 │ ├── image13 │ ├── image14 │ ├── image15 │ ├── image16 │ ├── image17 │ ├── image18 │ ├── image19 │ ├── image2 │ ├── image20 │ ├── image21 │ ├── image22 │ ├── image23 │ ├── image24 │ ├── image25 │ ├── image26 │ ├── image27 │ ├── image28 │ ├── image29 │ ├── image3 │ ├── image30 │ ├── image31 │ ├── image32 │ ├── image33 │ ├── image34 │ ├── image35 │ ├── image36 │ ├── image37 │ ├── image38 │ ├── image39 │ ├── image4 │ ├── image5 │ ├── image6 │ ├── image7 │ ├── image8 │ ├── image9 │ └── index.html ├── page3 │ ├── image1 │ ├── image10 │ ├── image11 │ ├── image12 │ ├── image13 │ ├── image14 │ ├── image2 │ ├── image3 │ ├── image4 │ ├── image5 │ ├── image6 │ ├── image7 │ ├── image8 │ ├── image9 │ └── index.html ├── page4 │ ├── image1 │ ├── image2 │ ├── image3 │ ├── image4 │ ├── image5 │ ├── image6 │ ├── image7 │ ├── image8 │ ├── image9 │ └── index.html ├── reset.test ├── style.bt ├── style.test ├── syntax.test ├── test1.tcl ├── tkhtml.tcl ├── tree.tcl ├── tree.test ├── tree1.bt └── vertical_align.html ├── tools ├── browsertester.tcl ├── changelog_to_list ├── check_manifest ├── crontab.sourceforge ├── expand ├── genStubs.tcl ├── getpage.c ├── htdocs_get_sf_stats ├── htdocs_refresh ├── htdocs_regen ├── htdocs_setup ├── httpget.c ├── importicons.tcl ├── install-sh ├── lemon.c ├── lempar.c ├── makeheaders.c ├── maketokens.sh ├── maketokens.tcl ├── manpage_clean ├── manpage_regen ├── mkcsstester.tcl ├── mkinstalldirs ├── mktclapp.c ├── nroff_regen ├── rules │ ├── formatting │ ├── manpage.api │ ├── manpage.api.spec │ ├── manpage.html │ ├── manpage.html.site │ ├── manpage.list │ ├── manpage.nroff │ ├── manpage.tmml │ ├── memchan │ ├── references │ ├── site │ └── xmlrules.tcl ├── setversion ├── sgmlparse.c ├── structure ├── svfiles ├── url.c └── watch_cvs └── webpage ├── common.tcl ├── mkffaqpage.tcl ├── mkhv3page.tcl ├── mksupportpage.tcl ├── mkwebpage.tcl └── tkhtml_tcl_tk.css /.gitignore: -------------------------------------------------------------------------------- 1 | /Makefile 2 | /config.log 3 | /config.status 4 | /cssprop.c 5 | /cssprop.h 6 | /htmldefaultstyle.c 7 | /htmltokens.h 8 | /htmltokens.c 9 | /hv3-0.1.tm 10 | /tkhtml.n 11 | *.o 12 | *.so 13 | pkgIndex.tcl 14 | -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2005 Dan Kennedy. 2 | All rights reserved. 3 | 4 | This Open Source project was made possible through the financial support 5 | of Eolas Technologies Inc. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of Eolas Technologies Inc. nor the names of its 16 | contributors may be used to endorse or promote products derived from 17 | this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 2 | 2006-02-25 3 | 4 | * 3.0 Alpha 2 release. 5 | 6 | 2002-09-27 Andreas Kupries 7 | 8 | * doc/spec.html: Added two paragraph markers for paragraphs without. 9 | 10 | * src/htmltcl.c (lockcopycmd): Extended to handle HPUX and AIX. 11 | 12 | * src/htmlform.c (HtmlFormIdx, HtmlAddFormInfo): See below, this 13 | time branches in a switch. 14 | 15 | * src/htmlwidget.c (TclConfigureWidgetObj, TclConfigureWidget): 16 | Fixed syntax, HP compilers do not like label without any 17 | statement after them. Inserted semantically no-op to satisfy 18 | these demands. 19 | 20 | * started a regular change log. 21 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | This directory contains all source code files for the TkHtml 2 | widget. TkHtml renders HTML for Tcl/Tk 8.0 and later. 3 | 4 | COMPILE.txt Instructions on how to compile TkHtml. 5 | 6 | doc Other documentation about TkHtml. 7 | 8 | src All of the source code. 9 | 10 | tools Source code to tools that are used to build the widget 11 | but which do not become part of the widget. 12 | -------------------------------------------------------------------------------- /aclocal.m4: -------------------------------------------------------------------------------- 1 | # 2 | # Include the TEA standard macro set 3 | # 4 | 5 | builtin(include,tclconfig/tcl.m4) 6 | 7 | # 8 | # Add here whatever m4 macros you want to define for your package 9 | # 10 | -------------------------------------------------------------------------------- /doc/browser.man: -------------------------------------------------------------------------------- 1 | [TH ::hv3::browser n] 2 | 3 | [Section Name] 4 | ::hv3::browser - Web browser widget. 5 | 6 | [Section Synopsis] 7 | ::hv3::browser pathName ?options? 8 | 9 | [Section Standard Options] 10 | [Code { 11 | }] 12 | 13 | See the options(n) manual entry for details on the standard options. 14 | 15 | [Section Widget-Specific Options] 16 | 17 | [Option enablejavascript { 18 | If set to true and the Tclsee package can be loaded, 19 | javascript is enabled in the browser widget. 20 | 21 | The default value is false. 22 | }] 23 | [Option unsafe { 24 | This boolean option determines whether or not the javascript 25 | interpreter has access to the function window.tcl(). Because 26 | this function allows javascript programs embedded in 27 | documents to evaluate Tcl scripts in the widget's intepreter, 28 | any document loaded while this option is set should be 29 | from a trusted source. 30 | 31 | The default value is false. 32 | }] 33 | 34 | [Section Description] 35 | 36 | [Section Widget Command] 37 | 38 | -------------------------------------------------------------------------------- /doc/interface.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 19 | 20 | 21 |

Synopsis

22 |

html pathName ?options?

23 |

Widget Specific Options

24 |
-importCommand
25 | -selectionStyle

26 | Widget Command

27 |

pathName handler node tag script

28 |

pathName handler script tag script

29 |



30 |

31 |

pathName html parse ?-final? html-text

32 |

pathName html clear

33 |

Stylesheets

34 |

The following commands are used to add style information to a 35 | document, in the form of CSS stylesheets.

36 |

pathName style parse stylesheet-id stylesheet-text

37 |

Add a stylesheet 38 | to the widget. The value passed as stylesheet-text should 39 | contain a valid CSS stylesheet. If the stylesheet contains an 40 | “@import” directive, and a value has been set for the widget 41 | -importCommand option, then the callback script passed to 42 | -importCommand is invoked from within this call.

43 |

The stylesheet-id 44 | is a string used to determine the priority of the stylesheet relative 45 | to other stylesheets added to the same widget. The first part of the 46 | stylesheet-id must be either “author.”, “user.” or 47 | “agent.”, to mark the stylesheet as an author, user or agent 48 | stylesheet respectively (see CSS documentation for how this affects 49 | the priority of the stylesheet). For stylesheets where the first part 50 | of the id is identical, the id strings are compared lexographically 51 | to determine priority. A stylesheet id that occurs later in 52 | dictionary order has a higher priority.

53 |

For example, the 54 | following list of stylesheet ids is sorted from lowest to highest 55 | priority:

56 |

agent.1
agent.2
user.1
user.2
author.1
author.1.1

57 |

A stylesheet-id 58 | need not be unique. In this case the stylesheet priority is 59 | determined by the order in which the stylesheets are added.

60 |

pathName style clear ?stylesheet-id?

61 |

Remove the stylesheet(s) with the 62 | specified stylesheet-id from the widget. 63 |

64 |

pathName style apply

65 |

pathName style syntax_errs

66 |

Layout

67 |

pathName layout primitives

68 |
draw_text
69 | draw_quad 
70 | draw_image
71 | draw_window
72 | draw_origin
73 | draw_background

74 | pathName layout node ?-width width? x y

75 |

pathName layout force -width ?width? -window 76 | ?window?

77 |

Node Command

78 |

node tag

79 |

node attr attribute-name

80 |

node property property-name ?value?

81 |

node clearproperties

82 |

node parent

83 |

node numchildren

84 |

node child child-index

85 |

node html

86 |



87 |

88 | 89 | 90 | -------------------------------------------------------------------------------- /doc/notes1.txt: -------------------------------------------------------------------------------- 1 | The HTML widget uses lots of TCL callback routines. But a TCL 2 | callback can do nasty things. For example, a TCL callback 3 | could delete the HTML widget that invoked the callback. Or 4 | it could delete the TCL interpreter in which the HTML widget 5 | is running. So we have to call HtmlLock() before invoking 6 | a TCL callback and check to make sure the widget was not 7 | deleted before using any fields in the widget structure after 8 | the callback runs. 9 | 10 | The following routines can call TCL callbacks, either directly 11 | or indirectly: 12 | 13 | HtmlTokenizerAppend() 14 | HtmlParseCmd() 15 | HtmlWidgetCommand() 16 | HtmlGetImage() 17 | HtmlAddStyle() 18 | HtmlParseCmd()... 19 | HtmlSizer() 20 | HtmlLayout() 21 | HtmlRedrawCallback() 22 | GetLinkColor() 23 | HtmlAddStyle()... 24 | HtmlCallResolver() 25 | HtmlGetImage()... 26 | HtmlResolveCmd() 27 | HtmlWidgetCommand() 28 | HtmlRedrawCallback()... 29 | HtmlGetFont() 30 | DrawSelectionBackground() 31 | HtmlBlockDraw()... 32 | HtmlBlockDraw() 33 | HtmlRedrawCallback() 34 | FindIndexInBlock() 35 | DecodeBaseIndex() 36 | HtmlGetIndex() 37 | HtmlIndexCmd() 38 | HtmlWidgetCommand()... 39 | HtmlSelectionSetCmd() 40 | HtmlWidgetCommand()... 41 | HtmlInsertCmd() 42 | HtmlWidgetCommand()... 43 | Paragraph() 44 | DoBreakMarkup() 45 | HtmlLayoutBlock() 46 | HtmlLayout()... 47 | HtmlTableLayout() 48 | DoBreakMarkup()... 49 | HtmlDeleteControls() 50 | HtmlClear() 51 | HtmlWidgetCommand()... 52 | HtmlDestroyWidget() 53 | -------------------------------------------------------------------------------- /doc/simple.make: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # Trying to generate a loadable module for Tcl/Tk8.1.1 on 4 | # WindowsNT using Cygwin20 cross-compiler running under 5 | # RedHat6.0. 6 | 7 | # Step -1: 8 | # Make a copy of winsock.h into winsock2.h. "Winsock2.h" is needed by 9 | # tclWinPort.h. tclWinPort.h is included by tclStubLib.c in step 3. 10 | # 11 | 12 | # Step 0: 13 | # Make sure the cross-compiler tools are on PATH and remove 14 | # old files. 15 | # 16 | PATH=$PATH:/opt/cygwin20/bin 17 | rm -f simple.o stublib.o simple.dll 18 | 19 | # Step 1: 20 | # Generate the C source code into "simple.c" 21 | # 22 | cat >simple.c <<\END 23 | #include 24 | 25 | int Simple_Init(Tcl_Interp *interp){ 26 | Tcl_InitStubs(interp,"8.1",0); 27 | Tk_InitStubs(interp,"8.1",0); 28 | return TCL_OK; 29 | } 30 | END 31 | 32 | # Step 2: 33 | # Compile the C source code yielding simple.o 34 | # 35 | i586-cygwin32-gcc \ 36 | -I/home/drh/tcltk/tcl8.1.1/generic \ 37 | -mno-cygwin \ 38 | -DUSE_TCL_STUBS=1 \ 39 | -c simple.c 40 | 41 | # Step 3: 42 | # Compile the Stub libraries yielding tclstub.o and tkstub.o 43 | # 44 | i586-cygwin32-gcc \ 45 | -I/home/drh/tcltk/tcl8.1.1/generic \ 46 | -I/home/drh/tcltk/tcl8.1.1/win \ 47 | -mno-cygwin \ 48 | -o tclstub.o \ 49 | -c /home/drh/tcltk/tcl8.1.1/generic/tclStubLib.c 50 | i586-cygwin32-gcc \ 51 | -I/home/drh/tcltk/tcl8.1.1/generic \ 52 | -I/home/drh/tcltk/tcl8.1.1/win \ 53 | -I/home/drh/tcltk/tk8.1.1/generic \ 54 | -I/home/drh/tcltk/tk8.1.1/win \ 55 | -I/home/drh/tcltk/tk8.1.1/xlib \ 56 | -mno-cygwin \ 57 | -o tkstub.o \ 58 | -c /home/drh/tcltk/tk8.1.1/generic/tkStubLib.c 59 | 60 | # Step 4: 61 | # Generate the DEF file 62 | # 63 | cat >simple.def <<\END 64 | EXPORTS 65 | Simple_Init 66 | END 67 | 68 | # Step 5: 69 | # Use dllwrap to build the DLL. Note: tclstub81.lib is copied out 70 | # of the binary tk8.1 distribution from Scriptics. 71 | # 72 | i586-cygwin32-dllwrap \ 73 | --def simple.def \ 74 | -v \ 75 | --driver-name i586-cygwin32-gcc \ 76 | --dlltool-name i586-cygwin32-dlltool \ 77 | --as i586-cygwin32-as \ 78 | --dllname simple.dll \ 79 | --target i386-mingw32 -mno-cygwin \ 80 | simple.o tclstub.o tkstub.o 81 | -------------------------------------------------------------------------------- /doc/tree.fig: -------------------------------------------------------------------------------- 1 | #FIG 3.2 2 | Landscape 3 | Center 4 | Inches 5 | Letter 6 | 100.00 7 | Single 8 | -2 9 | 1200 2 10 | 6 6450 3150 7575 3750 11 | 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 12 | 6450 3150 7575 3150 7575 3750 6450 3750 6450 3150 13 | 4 0 0 50 -1 0 16 0.0000 4 165 345 6825 3525 \001 14 | -6 15 | 6 6600 4425 7725 5025 16 | 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 17 | 6600 4425 7725 4425 7725 5025 6600 5025 6600 4425 18 | 4 0 0 50 -1 0 16 0.0000 4 165 390 6975 4800 \001 19 | -6 20 | 6 6675 5625 7725 6225 21 | 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 22 | 6675 5625 7725 5625 7725 6225 6675 6225 6675 5625 23 | 4 0 0 50 -1 0 16 0.0000 4 165 645 6900 6000 "over"\001 24 | -6 25 | 6 7725 3150 8625 3750 26 | 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 27 | 7725 3150 8625 3150 8625 3750 7725 3750 7725 3150 28 | 4 0 0 50 -1 0 16 0.0000 4 165 450 7950 3525 " ..."\001 29 | -6 30 | 6 5175 3150 6300 3750 31 | 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 32 | 5175 3150 6300 3150 6300 3750 5175 3750 5175 3150 33 | 4 0 0 50 -1 0 16 0.0000 4 165 660 5400 3525 " fox "\001 34 | -6 35 | 6 3900 3150 5025 3750 36 | 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 37 | 3900 3150 5025 3150 5025 3750 3900 3750 3900 3150 38 | 4 0 0 50 -1 0 16 0.0000 4 165 390 4275 3525 \001 39 | -6 40 | 6 2175 3150 3750 3750 41 | 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 42 | 2175 3150 3750 3150 3750 3750 2175 3750 2175 3150 43 | 4 0 0 50 -1 0 16 0.0000 4 225 1245 2400 3525 "The quick "\001 44 | -6 45 | 6 5025 4425 6450 5025 46 | 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 47 | 5025 4425 6450 4425 6450 5025 5025 5025 5025 4425 48 | 4 0 0 50 -1 0 16 0.0000 4 225 990 5250 4800 "jumped "\001 49 | -6 50 | 6 7875 4425 8925 5025 51 | 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 52 | 7875 4425 8925 4425 8925 5025 7875 5025 7875 4425 53 | 4 0 0 50 -1 0 16 0.0000 4 165 570 8100 4800 " the"\001 54 | -6 55 | 6 3600 4425 4875 5025 56 | 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 57 | 3600 4425 4875 4425 4875 5025 3600 5025 3600 4425 58 | 4 0 0 50 -1 0 16 0.0000 4 165 840 3825 4800 "brown"\001 59 | -6 60 | 6 4425 1800 7050 2400 61 | 6 4425 1800 7050 2400 62 | 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 63 | 4425 1800 7050 1800 7050 2400 4425 2400 4425 1800 64 | -6 65 | 4 0 0 50 -1 0 16 0.0000 4 225 1965 4800 2175

class="normal"\001 66 | -6 67 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 68 | 5775 2400 3000 3150 69 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 70 | 5775 2400 4425 3150 71 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 72 | 5775 2400 5700 3150 73 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 74 | 5775 2400 6975 3150 75 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 76 | 5775 2400 8175 3150 77 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 78 | 6975 3750 5700 4425 79 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 80 | 6975 3750 7125 4425 81 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 82 | 6975 3750 8475 4425 83 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 84 | 7200 5025 7200 5625 85 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 86 | 4425 3750 4275 4425 87 | -------------------------------------------------------------------------------- /doc/tree.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/doc/tree.gif -------------------------------------------------------------------------------- /hv/README: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /hv/dom_events.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/hv/dom_events.html -------------------------------------------------------------------------------- /hv/hv3_common.tcl: -------------------------------------------------------------------------------- 1 | 2 | ########################################################################### 3 | # Some handy utilities used by the rest of the hv3 app. The public 4 | # interface to this file consists of the commands: 5 | # 6 | # swproc 7 | # 8 | 9 | # swproc -- 10 | # 11 | # swproc NAME ARGS BODY 12 | # 13 | # [swproc] is very similar to the proc command, except any procedure 14 | # arguments with default values must be specified with switches instead 15 | # of on the command line. For example, the following are equivalent: 16 | # 17 | # proc abc {a {b hello} {c goodbye}} {...} 18 | # abc one two 19 | # 20 | # swproc swabc {a {b hello} {c goodbye}} {...} 21 | # swabc one -b two 22 | # 23 | # This means, in the above example, that it is possible to call [swabc] 24 | # and supply a value for parameter "c" but not "b". This is not 25 | # possible with commands created by regular Tcl [proc]. 26 | # 27 | # Commands created with [swproc] may also accept switches that do not 28 | # take arguments. These should be specified as a list of three elements. 29 | # The first is the name of the switch (and variable). The second is the 30 | # default value of the variable (if the switch is not present), and the 31 | # third is the value if the switch is present. For example, the 32 | # following two blocks are equivalent: 33 | # 34 | # proc abc {a} {...} 35 | # abc b 36 | # abc c 37 | # 38 | # swproc abc {{a b c}} {...} 39 | # abc 40 | # abc -a 41 | # 42 | proc swproc {procname arguments script} { 43 | uplevel [subst { 44 | proc $procname {args} { 45 | ::tkhtml::swproc_rt [list $arguments] \$args 46 | $script 47 | } 48 | }] 49 | } 50 | -------------------------------------------------------------------------------- /hv/hv3_console.tcl: -------------------------------------------------------------------------------- 1 | namespace eval hv3 { set {version($Id: hv3_console.tcl,v 1.2 2007/12/18 15:05:56 danielk1977 Exp $)} 1 } 2 | 3 | # -*- mode: tcl; tab-width: 8 -*- 4 | # 5 | # Make sure [::console show] is available. 6 | # 7 | 8 | return 9 | 10 | if {![catch {package require tclreadline}]} { 11 | proc ::console method { 12 | if {[info exists ::tclreadline::_in_loop]} return 13 | set ::tclreadline::_in_loop 1 14 | switch -- $method { 15 | show { 16 | after idle tclreadline::Loop 17 | } 18 | default { 19 | error "Not implemented: console $method" 20 | } 21 | } 22 | } 23 | } else { 24 | namespace eval ::hv3::tinyconsole { 25 | namespace export console 26 | 27 | variable buffer "" 28 | proc NS args { namespace code $args } 29 | proc K {x y} { set x } 30 | 31 | variable prompt "\n% " 32 | 33 | proc prompt {} { 34 | variable prompt 35 | puts -nonewline stdout [subst $prompt] 36 | } 37 | 38 | proc console {method args} { 39 | switch -- $method { 40 | show { 41 | prompt 42 | set chan stdin 43 | fileevent $chan readable [NS listener $chan] 44 | } 45 | default { 46 | error "Not implemented: console $method" 47 | } 48 | } 49 | } 50 | 51 | proc listener chan { 52 | append buffer [gets $chan] 53 | if {[info complete $buffer]} { 54 | puts -nonewline [uplevel #0 [K $buffer [set buffer ""]]] 55 | prompt 56 | } 57 | } 58 | } 59 | 60 | namespace import ::hv3::tinyconsole::console 61 | } 62 | -------------------------------------------------------------------------------- /hv/hv3_doctype.tcl: -------------------------------------------------------------------------------- 1 | namespace eval hv3 { set {version($Id: hv3_doctype.tcl,v 1.9 2007/12/17 07:27:11 danielk1977 Exp $)} 1 } 2 | 3 | namespace eval hv3 {} 4 | 5 | -------------------------------------------------------------------------------- /hv/hv3_dom3.tcl: -------------------------------------------------------------------------------- 1 | package require snit 2 | 3 | namespace eval ::hv3::dom { 4 | # This array is a map between the DOM name of a CSS property 5 | # and the CSS name. 6 | array set CSS_PROPERTY_MAP [list \ 7 | display display \ 8 | height height \ 9 | width width \ 10 | ] 11 | } 12 | 13 | #----------------------------------------------------------------------- 14 | # ::hv3::dom::InlineStyle 15 | # 16 | # This Snit type implements a javascript element.style object, used to 17 | # provide access to the "style" attribute of an HTML element. 18 | # 19 | set InlineStyleDefn { 20 | js_init {dom node} { 21 | set myNode $node 22 | } 23 | } 24 | foreach p [array names ::hv3::dom::CSS_PROPERTY_MAP] { 25 | append InlineStyleDefn [subst -nocommands { 26 | js_get $p { [set self] GetStyleProp $p } 27 | js_put $p v { [set self] PutStyleProp $p [set v] } 28 | }] 29 | } 30 | append InlineStyleDefn { 31 | 32 | variable myNode 33 | 34 | method GetStyleProp {prop} { 35 | list string [$myNode prop -inline $hv3::dom::CSS_PROPERTY_MAP($prop)] 36 | } 37 | 38 | method PutStyleProp {property js_value} { 39 | set value [[$self see] tostring $js_value] 40 | 41 | array set current [$myNode prop -inline] 42 | 43 | if {$value ne ""} { 44 | set current($::hv3::dom::CSS_PROPERTY_MAP($property)) $value 45 | } else { 46 | unset -nocomplain current($::hv3::dom::CSS_PROPERTY_MAP($property)) 47 | } 48 | 49 | set style "" 50 | foreach prop [array names current] { 51 | append style "$prop : $current($prop); " 52 | } 53 | 54 | $myNode attribute style $style 55 | } 56 | 57 | js_finish {} 58 | } 59 | ::snit::type ::hv3::dom::InlineStyle $InlineStyleDefn 60 | unset InlineStyleDefn 61 | # 62 | # End of DOM class InlineStyle. 63 | #----------------------------------------------------------------------- 64 | 65 | 66 | namespace eval ::hv3::dom { 67 | 68 | # List of DOM Level 0 events. 69 | # 70 | set DOM0Events_EventList [list \ 71 | onclick ondblclick onmousedown onmouseup onmouseover \ 72 | onmousemove onmouseout onkeypress onkeydown onkeyup onfocus onblur \ 73 | onsubmit onreset onselect onchange \ 74 | ] 75 | 76 | # Variable DOM0Events_ElementCode contains code to insert into the 77 | # ::hv3::dom::HTMLElement type for DOM Level 0 event support. 78 | # 79 | set DOM0Events_ElementCode { 80 | variable myEventFunctionsCompiled 0 81 | 82 | # This method loops through all the DOM Level 0 event attributes of 83 | # html widget node $myNode (onclick, onfocus etc.). For each defined 84 | # attribute, compile the value of the attribute into the body of 85 | # a javascript function object. Set the event property of the 86 | # parent object to the compiled function object. 87 | # 88 | method CompileEventFunctions {} { 89 | if {$myEventFunctionsCompiled} return 90 | set see [$self see] 91 | foreach event $::hv3::dom::DOM0Events_EventList { 92 | set body [$myNode attr -default "" $event] 93 | if {$body ne ""} { 94 | set ref [$see function $body] 95 | $myJavascriptParent Put $event [list object $ref] 96 | eval $see $ref Finalize 97 | } 98 | } 99 | set myEventFunctionsCompiled 1 100 | } 101 | } 102 | 103 | foreach event $::hv3::dom::DOM0Events_EventList { 104 | append DOM0Events_ElementCode [subst -nocommands { 105 | js_get $event { 106 | [set self] CompileEventFunctions 107 | [set myJavascriptParent] Get $event 108 | } 109 | js_put $event value { 110 | [set self] CompileEventFunctions 111 | [set myJavascriptParent] Put $event [set value] 112 | } 113 | }] 114 | } 115 | } 116 | 117 | 118 | -------------------------------------------------------------------------------- /hv/hv3_encodings.tcl: -------------------------------------------------------------------------------- 1 | 2 | # hv3_encodings.tcl 3 | # 4 | # This file contains wrappers around the Tcl built-in commands 5 | # [fconfigure] and [encoding]. The purpose is to support identifiers 6 | # like "windows-1257" as an alias for "cp1257". We need to replace 7 | # the original commands so that the http package sees our encoding 8 | # database. 9 | # 10 | # To add new encoding aliases, entries should be added to the 11 | # global ::Hv3EncodingMap array. This array maps from identifiers 12 | # commonly used on the web to the cannonical name used by Tcl. For 13 | # example, some Japanese websites use "shift_jis", but Tcl calls 14 | # this encoding "shiftjis". To work around this, we add the following 15 | # entry to ::Hv3EncodingMap: 16 | # 17 | # set ::Hv3EncodingMap(shift_jis) shiftjis 18 | # 19 | # Entries may be added to ::Hv3EncodingMap at any time (even before 20 | # this file is [source]ed). 21 | # 22 | 23 | 24 | rename encoding encoding_orig 25 | rename fconfigure fconfigure_orig 26 | 27 | # encoding convertfrom ?encoding? data 28 | # encoding convertto ?encoding? string 29 | # encoding names 30 | # 31 | proc encoding {args} { 32 | set argv $args 33 | 34 | # Handle [encoding names] 35 | # 36 | if {[llength $argv] == 1 && [lindex $argv 0] eq "names"} { 37 | return [concat [array names ::Hv3EncodingMap] [encoding_orig names]] 38 | } 39 | 40 | # Map any explicitly specified encoding. 41 | # 42 | if {[llength $argv] == 3} { 43 | set enc [string tolower [lindex $argv 1]] 44 | if {[info exists ::Hv3EncodingMap($enc)]} { 45 | lset argv 1 $::Hv3EncodingMap($enc) 46 | } 47 | } 48 | 49 | # Call the real [encoding] command. 50 | eval encoding_orig $argv 51 | } 52 | 53 | # fconfigure channelId name value ?name value ...? 54 | # 55 | proc fconfigure {args} { 56 | set argv $args 57 | for {set ii 1} {($ii+1) < [llength $argv]} {incr ii 2} { 58 | if {[lindex $argv $ii] eq "-encoding"} { 59 | set enc [string tolower [lindex $argv [expr {$ii+1}]]] 60 | if {[info exists ::Hv3EncodingMap($enc)]} { 61 | lset argv [expr {$ii+1}] $::Hv3EncodingMap($enc) 62 | } 63 | } 64 | } 65 | 66 | # Call the real [fconfigure] command. 67 | eval fconfigure_orig $argv 68 | } 69 | 70 | namespace eval ::hv3 { 71 | 72 | # The argument is an encoding name, which may or may not be known to Tcl. 73 | # Return the name of the Tcl encoding that will be used by Hv3. 74 | # 75 | proc encoding_resolve {enc} { 76 | set encoding [string tolower $enc] 77 | if {[info exists ::Hv3EncodingMap($encoding)]} { 78 | set ::Hv3EncodingMap($encoding) 79 | } else { 80 | encoding system 81 | } 82 | } 83 | 84 | # The two arguments are encoding names. This proc returns true if the 85 | # two encodings are handled identically by Hv3. 86 | # 87 | proc ::hv3::encoding_isequal {enc1 enc2} { 88 | string equal [::hv3::encoding_resolve $enc1] [::hv3::encoding_resolve $enc2] 89 | } 90 | } 91 | 92 | ########################################################################## 93 | # Below this point is where new encoding alias' can be added. See 94 | # the comment in the file header for instructions. 95 | # 96 | 97 | # Build the mappings "database". 98 | # 99 | foreach name [encoding_orig names] { 100 | set ::Hv3EncodingMap($name) $name 101 | if {[string match cp* $name]} { 102 | set name2 "windows-[string range $name 2 end]" 103 | set ::Hv3EncodingMap($name2) $name 104 | } 105 | if {[string match iso* $name]} { 106 | set name2 "iso-[string range $name 3 end]" 107 | set ::Hv3EncodingMap($name2) $name 108 | } 109 | } 110 | 111 | # Deal with some Japanese encodings. Because of the dominance of 112 | # Microsoft, websites that specify "shift_jis" or "shiftjis" as an 113 | # encoding are usually better handled with cp932. So, if cp932 is 114 | # present, use it in preference to the encoding Tcl calls shiftjis. 115 | # 116 | if {[lsearch [encoding_orig names] cp932]>=0} { 117 | set ::Hv3EncodingMap(shiftjis) cp932 118 | set ::Hv3EncodingMap(shift_jis) cp932 119 | } else { 120 | set ::Hv3EncodingMap(shift_jis) shiftjis 121 | } 122 | 123 | # Various encodings best handled by pretending they are utf-8. 124 | set ::Hv3EncodingMap(us-ascii) utf-8 125 | set ::Hv3EncodingMap(iso-8559-1) utf-8 126 | 127 | # Thai encoding. 128 | set ::Hv3EncodingMap(windows-874) tis-620 129 | 130 | -------------------------------------------------------------------------------- /hv/hv3_home.tcl: -------------------------------------------------------------------------------- 1 | namespace eval hv3 { set {version($Id: hv3_home.tcl,v 1.41 2008/02/02 17:15:02 danielk1977 Exp $)} 1 } 2 | 3 | # Register the home: scheme handler with ::hv3::protocol $protocol. 4 | # 5 | proc ::hv3::home_scheme_init {hv3 protocol} { 6 | set dir $::hv3::maindir 7 | $protocol schemehandler home [list ::hv3::home_request $protocol $hv3 $dir] 8 | } 9 | 10 | # When a URI with the scheme "home:" is requested, this proc is invoked. 11 | # 12 | proc ::hv3::home_request {http hv3 dir downloadHandle} { 13 | 14 | set obj [::tkhtml::uri [$downloadHandle cget -uri]] 15 | set authority [$obj authority] 16 | set path [$obj path] 17 | $obj destroy 18 | 19 | set data {} 20 | 21 | switch -exact -- $authority { 22 | 23 | blank { } 24 | 25 | about { 26 | set tkhtml_version [::tkhtml::version] 27 | set hv3_version "" 28 | foreach version [lsort [array names ::hv3::version]] { 29 | set t [string trim [string range $version 4 end-1]] 30 | append hv3_version "$t\n" 31 | } 32 | 33 | set data [subst { 34 | 35 |

Tkhtml Source Code Versions

36 |
$tkhtml_version
37 |

Hv3 Source Code Versions

38 |
$hv3_version
39 | 40 | }] 41 | } 42 | 43 | bug { 44 | set uri [::tkhtml::decode [string range $path 1 end]] 45 | after idle [list \ 46 | ::hv3::bugreport::init [$downloadHandle cget -hv3] $uri 47 | ] 48 | } 49 | 50 | dom { 51 | if {$path eq "/style.css"} { 52 | $downloadHandle append { 53 | .overview { 54 | margin: 0 20px; 55 | } 56 | .spacer { 57 | width: 3ex; 58 | background-color: white; 59 | } 60 | 61 | .refs A[href] { display:block } 62 | .refs { padding-left: 1.5cm } 63 | .superclass { font-style: italic; padding: 0 1.5cm; } 64 | PRE { margin: 0 1.5cm } 65 | 66 | .property,.method { 67 | font-family: monospace; 68 | white-space: nowrap; 69 | } 70 | TD { padding: 0 1ex; vertical-align: top;} 71 | .stripe0 { 72 | background-color: #EEEEEE; 73 | } 74 | } 75 | } else { 76 | set obj [string range $path 1 end] 77 | set data [::hv3::DOM::docs::${obj}] 78 | } 79 | } 80 | 81 | downloads { 82 | ::hv3::the_download_manager request $downloadHandle 83 | return 84 | } 85 | 86 | bookmarks_left { } 87 | bookmarks { 88 | if {$path eq "" || $path eq "/"} { 89 | $downloadHandle append { 90 | 91 | 92 | 93 | } 94 | ::hv3::bookmarks::ensure_initialized 95 | after idle [list ::hv3::bookmarks::init [$downloadHandle cget -hv3]] 96 | } else { 97 | set data [::hv3::bookmarks::requestpage $path] 98 | } 99 | } 100 | } 101 | 102 | $downloadHandle finish $data 103 | } 104 | 105 | proc ::hv3::hv3_version {} { 106 | set src [split [::tkhtml::version] "\n"] 107 | foreach version [lsort [array names ::hv3::version]] { 108 | set t [string trim [string range $version 5 end-1]] 109 | lappend src $t 110 | } 111 | foreach s $src { 112 | lappend datelist [lrange $s 2 3] 113 | } 114 | return [lindex [lsort -decreasing $datelist] 0] 115 | } 116 | 117 | -------------------------------------------------------------------------------- /hv/hv3_image.tcl: -------------------------------------------------------------------------------- 1 | 2 | ########################################################################### 3 | # hv3_image.tcl -- 4 | # 5 | # This file contains code to add image capabilities to the widget. 6 | # The public interface to this file are the commands: 7 | # 8 | # image_init HTML 9 | # 10 | 11 | 12 | #-------------------------------------------------------------------------- 13 | # Global variables section 14 | set ::hv3_image_name 0 15 | 16 | #-------------------------------------------------------------------------- 17 | 18 | # imageCallback -- 19 | # 20 | # imageCmd IMAGE-NAME DATA 21 | # 22 | # This proc is called when an image requested by the -imagecmd callback 23 | # ([imageCmd]) has finished downloading. The first argument is the name of 24 | # a Tk image. The second argument is the downloaded data (presumably a 25 | # binary image format like gif). This proc sets the named Tk image to 26 | # contain the downloaded data. 27 | # 28 | proc imageCallback {name data} { 29 | if {[info commands $name] == ""} return 30 | $name put $data 31 | } 32 | 33 | # imageCmd -- 34 | # 35 | # imageCmd HTML URL 36 | # 37 | # This proc is registered as the -imagecmd script for the Html widget. 38 | # 39 | proc imageCmd {HTML url} { 40 | set name hv3_image[incr ::hv3_image_name] 41 | image create photo $name 42 | 43 | set fullurl [url_resolve [$HTML var url] $url] 44 | url_fetch $fullurl -script [list imageCallback $name] -binary -type Image 45 | 46 | return [list $name [list image delete $name]] 47 | } 48 | 49 | 50 | set ::html_image_format jpeg 51 | 52 | proc image_to_serial {img} { 53 | return [$img data -format $::html_image_format] 54 | } 55 | 56 | proc image_savefile {HTML} { 57 | set t [time {set img [$HTML image]}] 58 | # puts "IMAGE-TIME: $t" 59 | $img write tkhtml.$::html_image_format -format $::html_image_format 60 | image delete $img 61 | } 62 | 63 | proc image_savetest {HTML} { 64 | set url [$HTML var url] 65 | puts "SAVING $url..." 66 | 67 | catch { 68 | [.html var cache] eval {CREATE TABLE tests(url PRIMARY KEY, data BLOB);} 69 | } 70 | set t [time {set img [$HTML image]}] 71 | # puts "IMAGE-TIME: $t" 72 | 73 | set data [image_to_serial $img] 74 | [$HTML var cache] eval {REPLACE INTO tests VALUES($url, $data);} 75 | image delete $img 76 | puts "DONE" 77 | } 78 | 79 | proc image_runtests {HTML} { 80 | image_800x600 81 | set db [.html var cache] 82 | set runtime [time { 83 | $db eval {SELECT oid as id, url, data FROM tests order by url} v { 84 | gui_goto $v(url) 85 | 86 | #after 100 {set ::hv3_runtests_var 0} 87 | #vwait ::hv3_runtests_var 88 | 89 | set t [time {set img [$HTML image]}] 90 | # puts "IMAGE-TIME: ($url) $t" 91 | set newdata [image_to_serial $img] 92 | 93 | if {$v(data) != $newdata} { 94 | puts "TEST FAILURE: ($v(url)) -> $v(id).$::html_image_format" 95 | $img write $v(id)_2.$::html_image_format -format $::html_image_format 96 | } else { 97 | puts "TEST SUCCESSFUL: ($v(url)) $v(id)" 98 | } 99 | image delete $img 100 | } 101 | }] 102 | 103 | puts "RUNTESTS FINISHED - $runtime" 104 | } 105 | 106 | proc image_800x600 {} { 107 | wm geometry . 800x600 108 | update 109 | } 110 | 111 | proc image_init {HTML} { 112 | .m add cascade -label {Image Tests} -menu [menu .m.image] 113 | if {0 == [catch {uplevel #0 {package require Img}}]} { 114 | .m.image add command -label {800x600} -command "image_800x600" 115 | .m.image add separator 116 | .m.image add command -label {Save file...} -command "image_savefile $HTML" 117 | .m.image add command -label {Save test case} -command "image_savetest $HTML" 118 | .m.image add separator 119 | .m.image add command -label {Run all tests} -command "image_runtests $HTML" 120 | } else { 121 | .m add command -label "Image tests require Tcl package Img" 122 | } 123 | 124 | $HTML configure -imagecmd [list imageCmd $HTML] 125 | } 126 | -------------------------------------------------------------------------------- /hv/hv3_log.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # This file contains code to implement the dynamic logging window. 3 | # 4 | namespace eval hv3 { set {version($Id: hv3_log.tcl,v 1.18 2007/09/28 14:14:56 danielk1977 Exp $)} 1 } 5 | 6 | snit::widget ::hv3::dynamiclog { 7 | component myText 8 | 9 | # The Tkhtml3 widget producing events to log. 10 | variable myHtml "" 11 | 12 | # The DOM widget producing events to log. 13 | variable myDom "" 14 | 15 | variable myState -array { 16 | LAYOUTENGINE 0 17 | STYLEENGINE 0 18 | ACTION 0 19 | EVENT 0 20 | "ECMASCRIPT Get" 1 21 | "ECMASCRIPT Put" 1 22 | } 23 | 24 | constructor {html} { 25 | set myHtml $html 26 | $html configure -logcmd [mymethod log] 27 | 28 | set myDom [[winfo parent [winfo parent $html]] dom] 29 | $myDom configure -logcmd [mymethod log] 30 | 31 | set myText ${win}.text 32 | ::hv3::scrolled ::hv3::text $myText -width 400 -height 300 -wrap none 33 | 34 | set f ${win}.checkbutton 35 | frame $f 36 | 37 | foreach key [array names myState] { 38 | set w [string tolower ${f}.${key}] 39 | checkbutton $w -variable [myvar myState($key)] -text $key 40 | pack $w -side left 41 | } 42 | 43 | frame ${win}.button 44 | ::hv3::button ${win}.button.dismiss -text Dismiss 45 | ::hv3::button ${win}.button.clear -text Clear 46 | ${win}.button.dismiss configure -command [mymethod Dismiss] 47 | ${win}.button.clear configure -command [mymethod Clear] 48 | 49 | pack ${win}.button.dismiss -side left -fill x -expand true 50 | pack ${win}.button.clear -side left -fill x -expand true 51 | 52 | pack ${win}.button -fill x -side bottom 53 | pack ${win}.checkbutton -fill x -side bottom 54 | pack ${win}.text -fill both -expand true 55 | } 56 | 57 | method log {args} { 58 | set subject [lindex $args 0] 59 | if {[info exists myState($subject)]} { 60 | if {$myState($subject)} { 61 | $myText insert end "$args\n" 62 | } 63 | } 64 | } 65 | 66 | method Clear {} { 67 | $myText delete 0.0 end 68 | } 69 | method Dismiss {} { 70 | destroy [winfo parent ${win}] 71 | } 72 | 73 | destructor { 74 | $myHtml configure -logcmd "" 75 | if {$myDom ne ""} {$myDom configure -logcmd ""} 76 | } 77 | } 78 | 79 | proc ::hv3::log_window {html} { 80 | toplevel .event_log 81 | ::hv3::dynamiclog .event_log.log $html 82 | pack .event_log.log -expand 1 -fill both 83 | } 84 | 85 | set ::hv3::event_log_subjects { ACTION } 86 | 87 | -------------------------------------------------------------------------------- /hv/hv3_nav.tcl: -------------------------------------------------------------------------------- 1 | 2 | ########################################################################### 3 | # hv3_nav.tcl -- 4 | # 5 | # The public interface to this file is the commands: 6 | # 7 | # nav_init HTML 8 | # nav_add HTML URL 9 | # 10 | 11 | #-------------------------------------------------------------------------- 12 | # Global variables section 13 | set ::html_nav_doclist [list] 14 | set ::html_nav_where -1 15 | 16 | #-------------------------------------------------------------------------- 17 | 18 | proc nav_init {HTML} { 19 | .m add cascade -label {Navigation} -menu [menu .m.nav] 20 | .m.nav add command -label {Forward} -command [list navForward $HTML] 21 | .m.nav add command -label {Back} -command [list navBack $HTML] 22 | .m.nav add separator 23 | 24 | set ::html_nav_doclist [list] 25 | navEnableDisable 26 | } 27 | 28 | proc nav_add {HTML url} { 29 | if {$url == [lindex $::html_nav_doclist $::html_nav_where]} return 30 | 31 | if {$url != [lindex $::html_nav_doclist [expr $::html_nav_where + 1]]} { 32 | set ::html_nav_doclist [lrange $::html_nav_doclist 0 $::html_nav_where] 33 | lappend ::html_nav_doclist $url 34 | } 35 | incr ::html_nav_where 36 | navEnableDisable 37 | } 38 | 39 | proc navForward {HTML} { 40 | navGoto [expr $::html_nav_where + 1] 41 | } 42 | 43 | proc navBack {HTML} { 44 | navGoto [expr $::html_nav_where - 1] 45 | } 46 | 47 | proc navGoto {where} { 48 | set ::html_nav_where $where 49 | gui_goto [lindex $::html_nav_doclist $::html_nav_where] 50 | navEnableDisable 51 | } 52 | 53 | proc navEnableDisable {} { 54 | if {$::html_nav_where < 1} { 55 | .m.nav entryconfigure Back -state disabled 56 | } else { 57 | .m.nav entryconfigure Back -state normal 58 | } 59 | if {$::html_nav_where == ([llength $::html_nav_doclist] - 1)} { 60 | .m.nav entryconfigure Forward -state disabled 61 | } else { 62 | .m.nav entryconfigure Forward -state normal 63 | } 64 | 65 | if {[.m.nav index end] > 3} { 66 | .m.nav delete 4 end 67 | } 68 | for {set ii 0} {$ii < [llength $::html_nav_doclist]} {incr ii} { 69 | set doc [lindex $::html_nav_doclist $ii] 70 | .m.nav add command -label $doc -command [list navGoto $ii] 71 | } 72 | 73 | if {[.m.nav index end] > 3} { 74 | set idx [expr $::html_nav_where + 4] 75 | .m.nav entryconfigure $idx -background white -state disabled 76 | } 77 | } 78 | 79 | -------------------------------------------------------------------------------- /hv/hv3_profile.tcl: -------------------------------------------------------------------------------- 1 | 2 | namespace eval ::hv3::profile { 3 | 4 | variable isEnabled 0 5 | 6 | proc enabled {} { 7 | variable isEnabled 8 | return $isEnabled 9 | } 10 | 11 | proc init {argv} { 12 | variable isEnabled 13 | 14 | if {[lsearch -exact $argv -profile]>=0} { 15 | set isEnabled 1 16 | 17 | # The following block creates a wrapper around the [proc] command 18 | # so that all new [proc]s instrumented. 19 | # 20 | uplevel #0 { 21 | rename proc real_proc 22 | real_proc proc {name arglist body} { 23 | uplevel [list real_proc $name $arglist $body] 24 | uplevel [list ::tkhtml::instrument command $name] 25 | } 26 | } 27 | } 28 | } 29 | 30 | proc instrument {cmd} { 31 | variable isEnabled 32 | if {$isEnabled == 0} return 33 | uplevel [list ::tkhtml::instrument command $cmd] 34 | } 35 | 36 | proc zero {} { 37 | set msg "Profile statistics will be zeroed after pressing OK" 38 | set i [tk_dialog .alert $msg $msg "" 0 OK] 39 | ::tkhtml::instrument zero 40 | } 41 | 42 | proc cache {} { 43 | set db ::hv3::sqlitedb 44 | $db transaction { 45 | catch {$db eval {DROP TABLE vectors}} 46 | $db eval {CREATE TEMP TABLE vectors(caller, proc, calls, clicks)} 47 | foreach {c p n clicks} [::tkhtml::instrument vectors] { 48 | $db eval { INSERT INTO vectors VALUES($c, $p, $n, $clicks) } 49 | } 50 | $db eval {CREATE INDEX v_index1 ON vectors(caller)} 51 | $db eval {CREATE INDEX v_index2 ON vectors(proc)} 52 | } 53 | } 54 | 55 | proc Report_line {chan zIndent nCall nClick zProc {zPercent ""}} { 56 | set iClicksPerCall [expr {int(double($nClick) / double($nCall))}] 57 | 58 | puts $chan [format {%s%7s %10s %s %-20s %s} \ 59 | $zIndent \ 60 | $nCall \ 61 | $nClick \ 62 | $zPercent \ 63 | "($iClicksPerCall us/call)" \ 64 | $zProc \ 65 | ] 66 | 67 | } 68 | 69 | proc report {chan} { 70 | set db ::hv3::sqlitedb 71 | 72 | set total_clicks [$db eval { 73 | SELECT sum(clicks) FROM vectors WHERE caller = '' 74 | }] 75 | puts $chan "Total clicks: $total_clicks" 76 | puts $chan "" 77 | 78 | puts $chan [format "%7s %10s %10s %s" Calls Self Children Proc] 79 | $db eval { 80 | SELECT proc, 81 | sum(calls) AS calls, 82 | sum(clicks) - COALESCE( 83 | (SELECT sum(clicks) FROM vectors WHERE caller = v1.proc), 0) AS self, 84 | (SELECT sum(clicks) FROM vectors WHERE caller = v1.proc) AS children 85 | FROM vectors AS v1 86 | GROUP BY proc 87 | ORDER BY self DESC 88 | } { 89 | puts $chan [format "%7s %10s %10s %s" $calls $self $children $proc] 90 | } 91 | 92 | puts $chan "" 93 | puts $chan "" 94 | 95 | set idx 1 96 | $db eval { 97 | SELECT proc, 98 | sum(calls) AS calls, 99 | sum(clicks) AS clicks 100 | FROM vectors 101 | GROUP BY proc 102 | ORDER BY sum(clicks) DESC 103 | } { 104 | 105 | puts $chan "" 106 | 107 | $db eval { 108 | SELECT 109 | caller, calls, clicks 110 | FROM vectors 111 | WHERE proc = $proc 112 | ORDER BY clicks ASC 113 | } p { 114 | set percent [format {% 6s} [format %.1f [expr { 115 | 100.0*double($p(clicks))/double($clicks) 116 | }]]] 117 | Report_line $chan " " $p(calls) $p(clicks) $p(caller) ${percent}% 118 | } 119 | 120 | Report_line $chan "" $calls $clicks "$proc (${idx})" 121 | 122 | $db eval { 123 | SELECT 124 | proc AS cproc, 125 | calls AS ccalls, 126 | clicks AS cclicks 127 | FROM vectors 128 | WHERE caller = $proc 129 | ORDER BY clicks DESC 130 | } { 131 | set percent [format {% 6s} [format %.1f [expr { 132 | 100.0*double($cclicks)/double($clicks) 133 | }]]] 134 | Report_line $chan " " $ccalls $cclicks $cproc ${percent}% 135 | } 136 | 137 | incr idx 138 | } 139 | } 140 | 141 | proc report_to_file {} { 142 | cache 143 | set f [tk_getSaveFile -initialfile profile] 144 | if {$f eq ""} return 145 | set chan [open $f w] 146 | report $chan 147 | close $chan 148 | } 149 | } 150 | 151 | proc children {cmd} { 152 | cache_vectors 153 | set db ::hv3::sqlitedb 154 | set ret "" 155 | $db eval { 156 | SELECT proc, calls, clicks FROM vectors WHERE caller = $cmd 157 | ORDER BY clicks desc 158 | } { 159 | append ret [ 160 | format "%8d %12d %s\n" $calls $clicks $proc 161 | ] 162 | } 163 | set ret 164 | } 165 | 166 | 167 | -------------------------------------------------------------------------------- /hv/hv3_string.tcl: -------------------------------------------------------------------------------- 1 | namespace eval hv3 { set {version($Id: hv3_string.tcl,v 1.9 2007/12/17 07:27:11 danielk1977 Exp $)} 1 } 2 | 3 | 4 | -------------------------------------------------------------------------------- /hv/hv3_style.tcl: -------------------------------------------------------------------------------- 1 | 2 | ########################################################################### 3 | # hv3_style.tcl -- 4 | # 5 | # This file contains code to implement stylesheet functionality. 6 | # The public interface to this file are the commands: 7 | # 8 | # style_init HTML 9 | # style_newdocument HTML 10 | # 11 | 12 | #-------------------------------------------------------------------------- 13 | # Global variables section 14 | set ::hv3_style_count 0 15 | 16 | #-------------------------------------------------------------------------- 17 | 18 | # style_init -- 19 | # 20 | # style_init HTML 21 | # 22 | # This is called just after the html widget ($HTML) is created. The two 23 | # handler commands are registered. 24 | # 25 | proc style_init {HTML} { 26 | $HTML handler node link "styleHandleLink $HTML" 27 | $HTML handler script style "styleHandleStyle $HTML" 28 | } 29 | 30 | # style_newdocument -- 31 | # 32 | # style_newdocument HTML 33 | # 34 | # This should be called before each new document begins loading (i.e. from 35 | # [gui_goto]). 36 | # 37 | proc style_newdocument {HTML} { 38 | set ::hv3_style_count 0 39 | } 40 | 41 | # styleHandleStyle -- 42 | # 43 | # styleHandleStyle HTML SCRIPT 44 | # 45 | proc styleHandleStyle {HTML script} { 46 | set id author.[format %.4d [incr ::hv3_style_count]] 47 | styleCallback $HTML [$HTML var url] $id $script 48 | } 49 | 50 | # styleUrl -- 51 | # 52 | # styleUrl BASE-URL URL 53 | # 54 | proc styleUrl {baseurl url} { 55 | return [url_resolve $baseurl $url] 56 | } 57 | 58 | # styleCallback -- 59 | # 60 | # styleCallback HTML URL ID STYLE-TEXT 61 | # 62 | proc styleCallback {HTML url id style} { 63 | $HTML style \ 64 | -id $id \ 65 | -importcmd [list styleImport $HTML $id] \ 66 | -urlcmd [list styleUrl $url] \ 67 | $style 68 | } 69 | 70 | # styleImport -- 71 | # 72 | # styleImport HTML PARENTID URL 73 | # 74 | proc styleImport {HTML parentid url} { 75 | set id ${parentid}.[format %.4d [incr ::hv3_style_count]] 76 | url_fetch $url -script [list styleCallback $HTML $url $id] -type Stylesheet 77 | } 78 | 79 | # styleHandleLink -- 80 | # 81 | # styleHandleLink HTML NODE 82 | # 83 | proc styleHandleLink {HTML node} { 84 | if {[$node attr rel] == "stylesheet"} { 85 | # Check if the media is Ok. If so, download and apply the style. 86 | set media [$node attr -default "" media] 87 | if {$media == "" || [regexp all $media] || [regexp screen $media]} { 88 | set id author.[format %.4d [incr ::hv3_style_count]] 89 | set url [url_resolve [$HTML var url] [$node attr href]] 90 | set cmd [list styleCallback $HTML $url $id] 91 | url_fetch $url -script $cmd -type Stylesheet 92 | } 93 | } 94 | } 95 | 96 | -------------------------------------------------------------------------------- /hv/hv3function.c: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The code in this file overloads the default Function constructor 4 | * object provided by SEE. This is because in ECMAscript proper, 5 | * functions declared using the "new Function()" syntax are created 6 | * with only the Global object in scope. However in browsers, 7 | * it is necessary to create them with the Global object and the 8 | * current Window context. 9 | * 10 | * The hackish fix here is to add a "Function" property to the Window 11 | * object that acts exactly like the "Function" property of the 12 | * Global object, except that functions are created in the Window 13 | * scope. 14 | * 15 | * Much of the code here is cut'n'paste from the SEE source file 16 | * obj_Function.c. 17 | */ 18 | 19 | 20 | /* Internal SEE functions we need for this hack */ 21 | struct function *SEE_parse_function( 22 | struct SEE_interpreter *i, 23 | struct SEE_string *name, 24 | struct SEE_input *param_input, 25 | struct SEE_input *body_input 26 | ); 27 | struct SEE_object *SEE_function_inst_create( 28 | struct SEE_interpreter *i, 29 | struct function *f, 30 | struct SEE_scope *scope 31 | ); 32 | 33 | 34 | /* 15.3.2.1 new Function(...) */ 35 | static void 36 | function_construct(interp, self, thisobj, argc, argv, res) 37 | struct SEE_interpreter *interp; 38 | struct SEE_object *self, *thisobj; 39 | int argc; 40 | struct SEE_value **argv, *res; 41 | { 42 | struct SEE_string *P, *body; 43 | struct SEE_value r9, r13; 44 | struct SEE_input *paraminp, *bodyinp; 45 | int k; 46 | 47 | struct function *f; 48 | struct SEE_object *pFunction; 49 | struct SEE_scope *pScope = ((SeeInterp *)interp)->pScope; 50 | if (!pScope) { 51 | pScope = interp->Global_scope; 52 | } 53 | 54 | P = SEE_string_new(interp, 0); 55 | for (k = 0; k < argc - 1; k++) { 56 | if (k) 57 | SEE_string_addch(P, ','); 58 | SEE_ToString(interp, argv[k], &r9); 59 | SEE_string_append(P, r9.u.string); 60 | } 61 | if (argc) { 62 | SEE_ToString(interp, argv[argc - 1], &r13); 63 | body = r13.u.string; 64 | } else 65 | body = SEE_string_new(interp, 0); 66 | 67 | paraminp = SEE_input_string(interp, P); 68 | bodyinp = SEE_input_string(interp, body); 69 | 70 | f = SEE_parse_function(interp, NULL, paraminp, bodyinp); 71 | pFunction = SEE_function_inst_create(interp, f, pScope); 72 | SEE_SET_OBJECT(res, pFunction); 73 | SEE_INPUT_CLOSE(bodyinp); 74 | SEE_INPUT_CLOSE(paraminp); 75 | } 76 | 77 | /* object class for Function constructor */ 78 | static struct SEE_objectclass function_const_class = { 79 | "FunctionConstructor", /* Class */ 80 | SEE_native_get, /* Get */ 81 | SEE_native_put, /* Put */ 82 | SEE_native_canput, /* CanPut */ 83 | SEE_native_hasproperty, /* HasProperty */ 84 | SEE_native_delete, /* Delete */ 85 | SEE_native_defaultvalue, /* DefaultValue */ 86 | SEE_native_enumerator, /* Enumerator */ 87 | function_construct, /* Construct */ 88 | function_construct /* Call */ 89 | }; 90 | 91 | static void 92 | interpFunctionInit(pInterp, pObj) 93 | SeeInterp *pInterp; 94 | SeeTclObject *pObj; 95 | { 96 | struct SEE_interpreter *interp = &pInterp->interp; 97 | struct SEE_object *pFunction; 98 | struct SEE_object *pNative = (struct SEE_object *)(pObj->pNative); 99 | 100 | struct SEE_value v; 101 | 102 | pFunction = (struct SEE_object *)SEE_NEW(interp, struct SEE_native); 103 | SEE_native_init( 104 | (struct SEE_native *)(pFunction), 105 | &pInterp->interp, 106 | &function_const_class, 107 | interp->Function_prototype 108 | ); 109 | 110 | SEE_SET_OBJECT(&v, pFunction); 111 | SEE_OBJECT_PUTA(interp, pNative, "Function", &v, SEE_ATTR_DONTENUM); 112 | 113 | SEE_SET_NUMBER(&v, 1); 114 | SEE_OBJECT_PUTA(interp, pFunction, "length", &v, SEE_ATTR_LENGTH); 115 | } 116 | 117 | -------------------------------------------------------------------------------- /hv/hvinit.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hv.h" 3 | 4 | int Et_AppInit(Tcl_Interp *interp){ 5 | extern int Tkhtml_Init(Tcl_Interp*); 6 | return Tkhtml_Init(interp); 7 | } 8 | -------------------------------------------------------------------------------- /hv/license.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | The license in this file applies to the unaltered snit code found 4 | in the file "snit.tcl" distributed with Tkhtml only. Other files 5 | in this directory are governed by Tkhtml's license. 6 | 7 | 8 | 9 | 10 | This software is copyrighted by William H. Duquette. The following 11 | terms apply to all files associated with the software unless 12 | explicitly disclaimed in individual files. 13 | 14 | The authors hereby grant permission to use, copy, modify, distribute, 15 | and license this software and its documentation for any purpose, provided 16 | that existing copyright notices are retained in all copies and that this 17 | notice is included verbatim in any distributions. No written agreement, 18 | license, or royalty fee is required for any of the authorized uses. 19 | Modifications to this software may be copyrighted by their authors 20 | and need not follow the licensing terms described here, provided that 21 | the new terms are clearly indicated on the first page of each file where 22 | they apply. 23 | 24 | IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 25 | FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 26 | ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 27 | DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | 30 | THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 31 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 33 | IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 34 | NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 35 | MODIFICATIONS. 36 | 37 | GOVERNMENT USE: If you are acquiring this software on behalf of the 38 | U.S. government, the Government shall have only "Restricted Rights" 39 | in the software and related documentation as defined in the Federal 40 | Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you 41 | are acquiring the software on behalf of the Department of Defense, the 42 | software shall be classified as "Commercial Computer Software" and the 43 | Government shall have only "Restricted Rights" as defined in Clause 44 | 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the 45 | authors grant the U.S. Government and others acting in its behalf 46 | permission to use and distribute the software in accordance with the 47 | terms specified in this license. 48 | -------------------------------------------------------------------------------- /hv/main.tcl: -------------------------------------------------------------------------------- 1 | namespace eval hv3 {set {version($Id: main.tcl,v 1.7 2006/06/10 15:25:37 danielk1977 Exp $)} 1} 2 | 3 | package require starkit 4 | starkit::startup 5 | set ::HV3_STARKIT 1 6 | source [file join [file dirname [info script]] hv3_main.tcl] 7 | 8 | -------------------------------------------------------------------------------- /hv/nogif.fig: -------------------------------------------------------------------------------- 1 | #FIG 3.2 2 | Landscape 3 | Center 4 | Inches 5 | Letter 6 | 100.00 7 | Single 8 | -2 9 | 1200 2 10 | 2 2 0 1 15 17 100 0 20 0.000 0 0 -1 0 0 5 11 | 2400 1800 2925 1800 2925 2325 2400 2325 2400 1800 12 | 2 1 0 5 4 7 100 0 -1 0.000 0 1 -1 0 0 2 13 | 2475 1875 2850 2250 14 | 2 1 0 5 4 7 100 0 -1 0.000 0 1 -1 0 0 2 15 | 2475 2250 2850 1875 16 | 2 2 0 1 15 17 100 0 20 0.000 0 1 -1 0 0 5 17 | 3675 2100 3900 2100 3900 2325 3675 2325 3675 2100 18 | 2 1 0 3 4 7 100 0 -1 0.000 0 1 -1 0 0 2 19 | 3717 2141 3856 2284 20 | 2 1 0 3 4 7 100 0 -1 0.000 0 1 -1 0 0 2 21 | 3714 2287 3856 2137 22 | -------------------------------------------------------------------------------- /hv/nogif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/hv/nogif.gif -------------------------------------------------------------------------------- /hv/nogifsm.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/hv/nogifsm.gif -------------------------------------------------------------------------------- /hv/ssinit.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "ss.h" 3 | 4 | int Et_AppInit(Tcl_Interp *interp){ 5 | extern int Tkhtml_Init(Tcl_Interp*); 6 | return Tkhtml_Init(interp); 7 | } 8 | -------------------------------------------------------------------------------- /linux-gcc.mk: -------------------------------------------------------------------------------- 1 | 2 | ##### Top of the Tkhtml source tree - the directory with this file in it. 3 | # 4 | TOP = $(HOME)/work/tkhtml/htmlwidget 5 | 6 | ##### BUILD can be DEBUG, RELEASE or MEMDEBUG. 7 | # 8 | BUILD = DEBUG 9 | # BUILD = RELEASE 10 | # BUILD = MEMDEBUG 11 | # BUILD = PROFILE 12 | 13 | ##### Path to hv3_polipo binary to include in starkit builds. 14 | # 15 | HV3_POLIPO = $(HOME)/bin/hv3_polipo 16 | 17 | ##### Version of and path to the Tcl installation to use. 18 | # 19 | TCLVERSION = 8.5 20 | 21 | TCL_RELEASE = $(HOME)/tcl 22 | TCL_DEBUG = $(HOME)/tcl 23 | TCL_PROFILE = $(HOME)/tcl_profile 24 | #TCL_PROFILE = $(HOME)/tcl 25 | TCL_MEMDEBUG = $(HOME)/memtcl 26 | TCL = $(TCL_$(BUILD)) 27 | 28 | # MKSTARKIT = ~/tcl/bin/tclkit-linux-x86-xft ~/bin/sdx.kit wrap 29 | MKSTARKIT = ~/bin/tclkit ~/bin/sdx.kit wrap 30 | STARKITRT = ~/bin/tclkit 31 | 32 | ##### Javascript libaries - libgc.a and libsee.a 33 | # 34 | JS_SHARED_LIB = libTclsee.so 35 | 36 | JSLIB = $(HOME)/work/tkhtml/js/lib/libgc.a 37 | JSLIB += $(HOME)/work/tkhtml/js/lib/libsee.a -lpthread 38 | JSFLAGS = -I$(HOME)/work/tkhtml/js/include 39 | 40 | #JSLIB = $(HOME)/javascript/install_nogc/lib/libsee.a 41 | #JSFLAGS = -I$(HOME)/javascript/install_nogc/include -DNO_HAVE_GC 42 | 43 | ##### Flags passed to the C-compiler to link to Tcl. 44 | # 45 | # TCLLIB_DEBUG = -L$(TCL)/lib -ltcl$(TCLVERSION)g -ltk$(TCLVERSION)g 46 | TCLLIB_RELEASE = -L$(TCL)/lib -ltcl$(TCLVERSION) -ltk$(TCLVERSION) 47 | TCLLIB_DEBUG = -L$(TCL)/lib -ltcl$(TCLVERSION) -ltk$(TCLVERSION) 48 | 49 | TCLLIB_PROFILE = $(TCL_PROFILE)/lib/libtcl8.5.a $(TCL_PROFILE)/lib/libtk8.5.a 50 | TCLLIB_PROFILE += -lX11 -lXft -lXss 51 | 52 | TCLLIB_MEMDEBUG = $(TCLLIB_DEBUG) 53 | TCLLIB_MEMDEBUG += $(TCL)/lib/libtclstub$(TCLVERSION).a 54 | TCLLIB_MEMDEBUG += $(TCL)/lib/libtkstub$(TCLVERSION).a 55 | 56 | TCLLIB = -L/usr/X11R6/lib/ -lX11 -ldl -lm $(TCLLIB_$(BUILD)) 57 | 58 | ##### The C-compiler to use and the flags to pass to it. 59 | # 60 | CC_RELEASE = gcc 61 | CC_DEBUG = gcc 62 | CC_MEMDEBUG = $(CC_DEBUG) 63 | CC_PROFILE = $(CC_DEBUG) 64 | CC = $(CC_$(BUILD)) 65 | BCC = $(CC_$(BUILD)) 66 | 67 | CFLAGS_RELEASE = -O2 -Wall -DNDEBUG -DHTML_MACROS -DTKHTML_ENABLE_PROFILE 68 | CFLAGS_DEBUG = -g -Wall -DHTML_DEBUG -DTKHTML_ENABLE_PROFILE 69 | CFLAGS_PROFILE = -g -pg -Wall -DNDEBUG -DTKHTML_ENABLE_PROFILE 70 | CFLAGS_MEMDEBUG = -g -Wall -DRES_DEBUG -DHTML_DEBUG -DTCL_MEM_DEBUG=1 71 | CFLAGS = $(CFLAGS_$(BUILD)) 72 | 73 | ##### The name of the shared library file to build. 74 | # 75 | SHARED_LIB_DEBUG = libTkhtml3g.so 76 | SHARED_LIB_PROFILE = libTkhtml3pg.so 77 | SHARED_LIB_MEMDEBUG = $(SHARED_LIB_DEBUG) 78 | SHARED_LIB_RELEASE = libTkhtml3.so 79 | SHARED_LIB = $(SHARED_LIB_$(BUILD)) 80 | 81 | ##### Command to build a shared library from a set of object files. The 82 | # command executed will be: 83 | # 84 | # $(MKSHLIB) $(OBJS) -o $(SHARED_LIB) 85 | # 86 | MKSHLIB = $(CC) -shared 87 | TCLSTUBSLIB_MEMDEBUG = "/home/dan/memtcl/lib/libtclstub8.5.a" 88 | TCLSTUBSLIB_MEMDEBUG += "/home/dan/memtcl/lib/libtkstub8.5.a" 89 | 90 | TCLSTUBSLIB = $(TCLSTUBSLIB_$(BUILD)) 91 | 92 | STRIP_RELEASE = strip 93 | STRIP_DEBUG = true 94 | STRIP_MEMDEBUG = $(STRIP_DEBUG) 95 | STRIP_PROFILE = $(STRIP_DEBUG) 96 | STRIP = $(STRIP_$(BUILD)) 97 | 98 | ##### Commands to run tclsh and wish. 99 | # 100 | TCLSH = $(TCL)/bin/tclsh$(TCLVERSION) 101 | WISH = $(TCL)/bin/wish$(TCLVERSION) 102 | 103 | ##### Installation directories used by the 'install' target. 104 | # 105 | INSTALLDIR = $(TCL)/lib/Tkhtml3.0 106 | MANINSTALLDIR = $(TCL)/man/mann 107 | 108 | # 109 | # End of configuration section. 110 | # You should not need to change anything below this line 111 | ########################################################################### 112 | 113 | default: binaries hwish 114 | 115 | install: binaries 116 | mkdir -p $(INSTALLDIR) 117 | mkdir -p $(MANINSTALLDIR) 118 | cp -f $(BINARIES) $(INSTALLDIR) 119 | 120 | hv3-linux-x86: hv3_img.kit 121 | cp $(STARKITRT) starkit_runtime 122 | $(MKSTARKIT) hv3_img.bin -runtime ./starkit_runtime 123 | mv hv3_img.bin hv3-linux-x86 124 | 125 | hv3-linux-x86.gz: hv3-linux-x86 126 | gzip hv3-linux-x86 127 | chmod 644 hv3-linux-x86.gz 128 | 129 | ############################################################################### 130 | include $(TOP)/main.mk 131 | -------------------------------------------------------------------------------- /linux-mingw.mk: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make 2 | # 3 | #### The toplevel directory of the source tree. 4 | # 5 | SRCDIR = /home/drh/tkhtml/htmlwidget 6 | 7 | #### C Compiler and options for use in building executables that 8 | # will run on the platform that is doing the build. 9 | # 10 | BCC = gcc -g -O2 11 | 12 | #### Name of the generated static library file 13 | # 14 | LIBNAME = libtkhtml.a 15 | 16 | #### The suffix to add to executable files. ".exe" for windows. 17 | # Nothing for unix. 18 | # 19 | E = 20 | 21 | #### C Compile and options for use in building executables that 22 | # will run on the target platform. This is usually the same 23 | # as BCC, unless you are cross-compiling. 24 | # 25 | #TCC = gcc -O6 26 | #TCC = gcc -g -O0 -Wall 27 | #TCC = gcc -g -O0 -Wall -fprofile-arcs -ftest-coverage 28 | TCC = /opt/mingw/bin/i386-mingw32msvc-gcc -O6 -DSTATIC_BUILD=1 29 | 30 | #### Include file directories for Tcl and Tk. 31 | # 32 | INC = -I/home/drh/tcltk/8.4win 33 | 34 | #### Extra arguments for linking 35 | # 36 | LIBS = 37 | 38 | #### Command used to build a static library 39 | # 40 | AR = /opt/mingw/bin/i386-mingw32msvc-ar r 41 | RANLIB = /opt/mingw/bin/i386-mingw32msvc-ranlib 42 | 43 | #### The TCLSH command 44 | # 45 | TCLSH = tclsh 46 | 47 | # You should not need to change anything below this line 48 | ############################################################################### 49 | include $(SRCDIR)/main.mk 50 | -------------------------------------------------------------------------------- /listvers.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # This script extracts version information from all the source files. 4 | # Run this script in the top-level directory of the source tree. 5 | # 6 | 7 | grep Revision: `find . -type f -print` | 8 | sed -e 's,^./,,' -e 's,:[^ ]*, ,' | 9 | awk '/[1-9]\.[1-9]/ { printf "%-20s %s\n",$1,$3 }' 10 | -------------------------------------------------------------------------------- /make_main_mk.tcl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/tclsh 2 | # 3 | # Run this TCL script to generate the "main.mk" makefile. 4 | # 5 | 6 | # Basenames of all source files: 7 | # 8 | set src { 9 | htmlcmd 10 | htmldraw 11 | htmlexts 12 | htmlform 13 | htmlimage 14 | htmlindex 15 | htmllayout 16 | htmlparse 17 | htmlPs 18 | htmlPsImg 19 | htmlsizer 20 | htmltable 21 | htmltcl 22 | htmltest 23 | htmlurl 24 | htmlwidget 25 | } 26 | 27 | # Generated files 28 | # 29 | set gen { 30 | htmltokens 31 | } 32 | 33 | puts {# This file is included by linux-gcc.mk or linux-mingw.mk or possible 34 | # some other makefiles. This file contains the rules that are common 35 | # to building regardless of the target. 36 | # 37 | 38 | XTCC = $(TCC) $(CFLAGS) $(INC) -I. -I$(SRCDIR) 39 | 40 | } 41 | puts -nonewline "SRC =" 42 | foreach s [lsort $src] { 43 | puts -nonewline " \\\n \$(SRCDIR)/src/$s.c" 44 | } 45 | puts "\n" 46 | puts -nonewline "OBJ =" 47 | foreach s [lsort [concat $src $gen]] { 48 | puts -nonewline " \\\n $s.o" 49 | } 50 | puts "\n" 51 | 52 | puts { 53 | all: $(LIBNAME) 54 | 55 | makeheaders: $(SRCDIR)/tools/makeheaders.c 56 | $(BCC) -o makeheaders $(SRCDIR)/tools/makeheaders.c 57 | 58 | $(LIBNAME): headers $(OBJ) 59 | $(AR) $(LIBNAME) $(OBJ) 60 | $(RANLIB) $(LIBNAME) 61 | 62 | htmltokens.c: $(SRCDIR)/src/tokenlist.txt $(SRCDIR)/tools/maketokens.tcl 63 | $(TCLSH) $(SRCDIR)/tools/maketokens.tcl \ 64 | $(SRCDIR)/src/tokenlist.txt >htmltokents.c 65 | 66 | headers: makeheaders htmltokens.c $(SRC) 67 | ./makeheaders $(SRCDIR)/src/html.h htmltokens.c $(SRC) 68 | touch headers 69 | 70 | srcdir: headers htmltokens.c 71 | mkdir -p srcdir 72 | rm -f srcdir/* 73 | cp $(SRC) htmltokens.c *.h srcdir 74 | 75 | clean: 76 | rm -f *.o $(LIBNAME) 77 | rm -f makeheaders headers} 78 | 79 | set hfiles {} 80 | foreach s [lsort [concat $src $gen]] {lappend hfiles $s.h} 81 | puts "\trm -f $hfiles\n" 82 | 83 | foreach s [lsort $src] { 84 | puts "$s.o:\t\$(SRCDIR)/src/${s}.c $s.h" 85 | puts "\t\$(XTCC) -o $s.o -c \$(SRCDIR)/src/${s}.c\n" 86 | } 87 | foreach s [lsort $gen] { 88 | puts "$s.o:\t${s}.c $s.h" 89 | puts "\t\$(XTCC) -o $s.o -c ${s}.c\n" 90 | } 91 | -------------------------------------------------------------------------------- /makemake.tcl.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/makemake.tcl.in -------------------------------------------------------------------------------- /mingw.mk: -------------------------------------------------------------------------------- 1 | 2 | ##### Top of the Tkhtml source tree - the directory with this file in it. 3 | # 4 | TOP = /home/dan/work/tkhtml/htmlwidget/ 5 | 6 | ##### BUILD can be DEBUG or RELEASE. 7 | # 8 | # BUILD = DEBUG 9 | BUILD = RELEASE 10 | 11 | HV3_POLIPO = /home/dan/work/polipo/hv3_polipo.exe 12 | 13 | ##### Version of and path to the Tcl installation to use. 14 | # 15 | TCLVERSION = 85 16 | TCL = /home/dan/work/tkhtml/mingwtcl/install 17 | 18 | ##### Flags passed to the C-compiler to link to Tcl. 19 | # 20 | # TCLLIB = -L$(TCL)/lib -ltclstub$(TCLVERSION) -ltkstub$(TCLVERSION) 21 | TCLLIB = -L$(TCL)/lib -ltcl$(TCLVERSION) -ltk$(TCLVERSION) -ltclstub$(TCLVERSION) -ltkstub$(TCLVERSION) 22 | 23 | ##### Extra libraries used by Tcl on Linux. These flags are only required to 24 | # staticly link Tcl into an executable 25 | # 26 | # TCLLIB_DEBUG += -L/usr/X11R6/lib/ -lX11 -ldl -lm 27 | 28 | BCC = gcc 29 | CC = i386-mingw32-gcc 30 | 31 | CFLAGS_RELEASE = -O2 -DNDEBUG 32 | CFLAGS_DEBUG = -g 33 | CFLAGS = $(CFLAGS_$(BUILD)) 34 | CFLAGS += -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1 35 | 36 | ##### The name of the shared library file to build. 37 | # 38 | SHARED_LIB_DEBUG = libTkhtml3g.dll 39 | SHARED_LIB_RELEASE = libTkhtml3.dll 40 | SHARED_LIB = $(SHARED_LIB_$(BUILD)) 41 | 42 | ##### Command to build a shared library from a set of object files. The 43 | # command executed will be: 44 | # 45 | # $(MKSHLIB) $(OBJS) $(TCLSTUBSLIB) -o $(SHARED_LIB) 46 | # 47 | MKSHLIB = $(CC) -shared 48 | TCLSTUBSLIB = "/home/dan/work/tkhtml/mingwtcl/install/lib/libtclstub85.a" 49 | TCLSTUBSLIB += "/home/dan/work/tkhtml/mingwtcl/install/lib/libtkstub85.a" 50 | TCLSTUBSLIB += -LC:/Tcl/lib 51 | 52 | ##### Commands to run tclsh on the build platform (to generate C files 53 | # to be passed to $(CC) from tcl scripts). 54 | # 55 | TCLSH = tclsh 56 | 57 | ##### Strip the shared library 58 | # 59 | STRIP = i386-mingw32-strip 60 | 61 | MKSTARKIT = tclkit /home/dan/bin/sdx.kit wrap 62 | STARKITRT = /home/dan/work/tclkit-win32.upx.exe 63 | 64 | ##### Javascript libaries - libgc.a and libsee.a 65 | # 66 | JS_SHARED_LIB = libTclsee.dll 67 | 68 | JSLIB = $(HOME)/work/tkhtml/jswin/lib/libsee.a 69 | JSLIB += $(HOME)/work/tkhtml/jswin/lib/libgc.a 70 | JSFLAGS = -I$(HOME)/work/tkhtml/jswin/include 71 | 72 | # 73 | # End of configuration section. 74 | ########################################################################### 75 | 76 | default: binaries 77 | 78 | hv3-win32.exe: hv3_img.kit 79 | cp $(STARKITRT) starkit_runtime 80 | $(MKSTARKIT) hv3_img.bin -runtime ./starkit_runtime 81 | mv hv3_img.bin hv3-win32.exe 82 | chmod 644 hv3-win32.exe 83 | 84 | ############################################################################### 85 | include $(TOP)/main.mk 86 | 87 | -------------------------------------------------------------------------------- /mkdll.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # This script builds "tkhtml.dll" for Win95/NT and Tcl/Tk8.1.1-stubs. 4 | # First do "make srcdir; cd srcdir". Then run this script. 5 | # 6 | # Notes: 7 | # 8 | # The tclstub.o and tkstub.o files were obtained by compiling the 9 | # tclStubLib.c and tkStubLib.c files from the Tk8.1.1 distribution 10 | # using cygwin/mingw. Do not use the tclstub81.lib and tkstub81.lib 11 | # files that come with Tcl/Tk from scripts. They won't work. 12 | # 13 | # $Revision: 1.10 $ 14 | # 15 | 16 | LIBHOME=/u/pcmacdon/Tcl8.3/win32/lib 17 | TCLBASE=/u/pcmacdon/Tcl8.3/tcl8.3 18 | TKBASE=/u/pcmacdon/Tcl8.3/tk8.3 19 | TKLIB="$LIBHOME/tkStubLib.a" 20 | TCLLIB="$LIBHOME/tclStubLib.a" 21 | 22 | PATH=$PATH:/usr/local/cygb20/bin 23 | 24 | CC='i586-cygwin32-gcc -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS -mno-cygwin -O2' 25 | INC="-I. -I$TCLBASE/generic -I$TKBASE/xlib -I$TKBASE/generic" 26 | 27 | CMD="rm *.o" 28 | echo $CMD 29 | #$CMD 30 | for i in *.c; do 31 | CMD="$CC $INC -c $i" 32 | echo $CMD 33 | $CMD 34 | done 35 | echo 'EXPORTS' >tkhtml.def 36 | echo 'Tkhtml_Init' >>tkhtml.def 37 | #-lcomdlg32 -luser32 -ladvapi32 -lgdi32. 38 | 39 | CMD="i586-cygwin32-dllwrap \ 40 | --def tkhtml.def -v --export-all \ 41 | --driver-name i586-cygwin32-gcc \ 42 | --dlltool-name i586-cygwin32-dlltool \ 43 | --as i586-cygwin32-as \ 44 | --target i386-mingw32 -mno-cygwin \ 45 | -dllname tkhtml.dll *.o $TKLIB $TCLLIB -luser32" 46 | echo $CMD 47 | $CMD 48 | -------------------------------------------------------------------------------- /mkso.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # This script builds "libtkhtml.so" for Linux and Tcl/Tk8.3.3-stubs. 4 | # First do "make srcdir; cd srcdir; ../tkhtml/configure; make headers" 5 | # Then run this script. 6 | # 7 | # $Revision: 1.8 $ 8 | # 9 | 10 | SVER=8.3 11 | VER=8.3.2 12 | 13 | TCLBASE=../tcl$VER 14 | TKBASE=../tk$VER 15 | TKHTML=../tkhtml 16 | TKLIB="/usr/lib/libtkstub$SVER.a -L/usr/X11R6/lib -lX11" 17 | TCLLIB="/usr/lib/libtclstub$SVER.a -lm -ldl" 18 | 19 | CC='gcc -g -fPIC -O2' 20 | STUBS='-DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1' 21 | INC="-I. -I$TCLBASE/generic -I$TKBASE/generic" 22 | 23 | CMD="rm *.o" 24 | echo $CMD 25 | $CMD 26 | for i in $TKHTML/src/html[a-z]*.c htmltokens.c; do 27 | if [ `basename $i` != htmlwish.c ]; then 28 | CMD="$CC $STUBS $INC -c $i" 29 | echo $CMD 30 | $CMD 31 | fi 32 | done 33 | CMD="gcc -g -o tkhtml.so -shared *.o $TKLIB $TCLLIB" 34 | echo $CMD 35 | $CMD 36 | 37 | CMD="$CC $INC -c $TKHTML/src/htmlPs.c" 38 | echo $CMD 39 | $CMD 40 | CMD="gcc -g -o tkhtmlpr.so -shared htmlPs.o $TKLIB $TCLLIB" 41 | echo $CMD 42 | $CMD 43 | -------------------------------------------------------------------------------- /nightly.sh: -------------------------------------------------------------------------------- 1 | 2 | export VERSION=nightly-`date +"%y_%m%d"` 3 | #export VERSION=alpha-16 4 | 5 | HERE=`pwd` 6 | 7 | export SRC=/home/dan/work/tkhtml/htmlwidget/ 8 | BLD1=/tmp/bld1 9 | BLD2=/tmp/bld2 10 | BLD3=/tmp/bld3 11 | 12 | rm -rf $BLD1 $BLD2 $BLD3 13 | mkdir $BLD1 14 | mkdir $BLD2 15 | mkdir $BLD3 16 | 17 | # Make the linux build. 18 | # 19 | cd ${BLD1} 20 | make -f ${SRC}/linux-gcc.mk tclsee hv3-linux-x86.gz BUILD=RELEASE 21 | 22 | # Make the win32 build. 23 | # 24 | cd ${BLD2} 25 | make -f ${SRC}/mingw.mk tclsee hv3-win32.exe BUILD=RELEASE 26 | 27 | # Create the puppy package. 28 | # 29 | export BUILD=${BLD1} 30 | cd ${BLD3} 31 | sh ${SRC}/puppy.sh 32 | 33 | cd ${HERE} 34 | mv ${BLD1}/hv3_img.kit ./hv3-linux-${VERSION}.kit 35 | mv ${BLD1}/hv3-linux-x86.gz ./hv3-linux-${VERSION}.gz 36 | mv ${BLD2}/hv3-win32.exe ./hv3-win32-${VERSION}.exe 37 | mv ${BLD2}/hv3_img.kit ./hv3-win32-${VERSION}.kit 38 | mv ${BLD3}/hv3-${VERSION}.pet . 39 | 40 | chmod 644 ./hv3-linux-${VERSION}.kit 41 | chmod 644 ./hv3-win32-${VERSION}.kit 42 | chmod 644 ./hv3-win32-${VERSION}.exe 43 | chmod 644 ./hv3-${VERSION}.pet 44 | chmod 644 ./hv3-linux-${VERSION}.gz 45 | 46 | tclsh ${SRC}/webpage/mkhv3page.tcl > hv3.html 47 | 48 | -------------------------------------------------------------------------------- /puppy.sh: -------------------------------------------------------------------------------- 1 | 2 | # Script to build puppy linux package. 3 | # 4 | 5 | if test "${VERSION}" = "" ; then VERSION=16 ; fi 6 | if test "${BUILD}" = "" ; then BUILD=/home/dan/work/tkhtml/bld ; fi 7 | if test "${SRC}" = "" ; then SRC=/home/dan/work/tkhtml/htmlwidget ; fi 8 | 9 | TCL=/home/dan/tcl/lib 10 | 11 | rm -rf hv3-$VERSION 12 | mkdir -p hv3-$VERSION/usr/lib/hv3/ 13 | mkdir -p hv3-$VERSION/usr/bin 14 | 15 | cp -R $TCL/*tls* hv3-$VERSION/usr/lib/ 16 | 17 | strip $BUILD/libTkhtml3.so 18 | cp $BUILD/libTkhtml3.so hv3-$VERSION/usr/lib/hv3/ 19 | cp $BUILD/pkgIndex.tcl hv3-$VERSION/usr/lib/hv3/ 20 | 21 | strip $BUILD/tclsee0.1/libTclsee.so 22 | cp $BUILD/tclsee0.1/libTclsee.so hv3-$VERSION/usr/lib/hv3/ 23 | cat $BUILD/tclsee0.1/pkgIndex.tcl >> hv3-$VERSION/usr/lib/hv3/pkgIndex.tcl 24 | 25 | cp $SRC/hv/*.tcl hv3-$VERSION/usr/lib/hv3/ 26 | rm hv3-$VERSION/usr/lib/hv3/tst_main.tcl 27 | rm hv3-$VERSION/usr/lib/hv3/main.tcl 28 | 29 | cp /home/dan/bin/hv3_polipo hv3-$VERSION/usr/bin 30 | 31 | HV3=hv3-$VERSION/usr/bin/hv3 32 | echo '#!/bin/sh' > $HV3 33 | echo 'exec wish /usr/lib/hv3/hv3_main.tcl "$@"' >> $HV3 34 | chmod 755 $HV3 35 | 36 | tar -czf hv3-$VERSION.tgz hv3-$VERSION 37 | tgz2pet hv3-$VERSION.tgz 38 | 39 | -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | /htmltokens.c 2 | /htmltokens.h 3 | -------------------------------------------------------------------------------- /src/cssdynamic.c: -------------------------------------------------------------------------------- 1 | 2 | #include "html.h" 3 | #include "cssInt.h" 4 | 5 | static const char rcsid[] = "$Id: cssdynamic.c,v 1.12 2007/06/10 07:53:03 danielk1977 Exp $"; 6 | 7 | /* 8 | * How dynamic CSS selectors are implemented: 9 | * 10 | * The implementation of dynamic CSS selectors serves two purposes. 11 | * Firstly, they are a feature in and of themselves. Secondly, they 12 | * exercise the same dynamic-update code that an external scripting 13 | * implementation someday might. 14 | * 15 | * A "dynamic selector", according to Tkhtml, is any selector that 16 | * includes an :active, :focus, or :hover pseudo class. 17 | */ 18 | 19 | struct CssDynamic { 20 | int isSet; /* True when the condition is set */ 21 | CssSelector *pSelector; /* The selector for this condition */ 22 | CssDynamic *pNext; 23 | }; 24 | 25 | void 26 | HtmlCssAddDynamic(pElem, pSelector, isSet) 27 | HtmlElementNode *pElem; 28 | CssSelector *pSelector; 29 | int isSet; 30 | { 31 | CssDynamic *pNew; 32 | for (pNew = pElem->pDynamic; pNew ; pNew = pNew->pNext) { 33 | if (pNew->pSelector == pSelector) return; 34 | } 35 | pNew = 0; 36 | 37 | pNew = HtmlNew(CssDynamic); 38 | pNew->isSet = (isSet ? 1 : 0); 39 | pNew->pSelector = pSelector; 40 | pNew->pNext = pElem->pDynamic; 41 | pElem->pDynamic = pNew; 42 | } 43 | 44 | void 45 | HtmlCssFreeDynamics(pElem) 46 | HtmlElementNode *pElem; 47 | { 48 | CssDynamic *p = pElem->pDynamic; 49 | while (p) { 50 | CssDynamic *pTmp = p; 51 | p = p->pNext; 52 | HtmlFree(pTmp); 53 | } 54 | pElem->pDynamic = 0; 55 | } 56 | 57 | 58 | static int 59 | checkDynamicCb(pTree, pNode, clientData) 60 | HtmlTree *pTree; 61 | HtmlNode *pNode; 62 | ClientData clientData; 63 | { 64 | if (!HtmlNodeIsText(pNode)) { 65 | HtmlElementNode *pElem = (HtmlElementNode *)pNode; 66 | CssDynamic *p; 67 | for (p = pElem->pDynamic; p; p = p->pNext) { 68 | int res = HtmlCssSelectorTest(p->pSelector, pNode, 0) ? 1 : 0; 69 | if (res != p->isSet) { 70 | HtmlCallbackRestyle(pTree, pNode); 71 | } 72 | p->isSet = res; 73 | } 74 | } 75 | return HTML_WALK_DESCEND; 76 | } 77 | 78 | void 79 | HtmlCssCheckDynamic(pTree) 80 | HtmlTree *pTree; 81 | { 82 | if (pTree->cb.pDynamic) { 83 | HtmlNode *pParent = HtmlNodeParent(pTree->cb.pDynamic); 84 | if (pParent) { 85 | int i; 86 | int nChild = HtmlNodeNumChildren(pParent); 87 | for (i = 0; HtmlNodeChild(pParent, i) != pTree->cb.pDynamic; i++); 88 | for ( ; i < nChild; i++) { 89 | HtmlWalkTree(pTree,HtmlNodeChild(pParent,i),checkDynamicCb,0); 90 | } 91 | } else { 92 | HtmlWalkTree(pTree, pTree->cb.pDynamic, checkDynamicCb, 0); 93 | } 94 | pTree->cb.pDynamic = 0; 95 | } 96 | } 97 | 98 | int 99 | HtmlCssTclNodeDynamics(interp, pNode) 100 | Tcl_Interp *interp; 101 | HtmlNode *pNode; 102 | { 103 | Tcl_Obj *pRet = Tcl_NewObj(); 104 | if (!HtmlNodeIsText(pNode)) { 105 | CssDynamic *p; 106 | HtmlElementNode *pElem = (HtmlElementNode *)pNode; 107 | for (p = pElem->pDynamic; p ; p = p->pNext) { 108 | Tcl_Obj *pOther = Tcl_NewObj(); 109 | HtmlCssSelectorToString(p->pSelector, pOther); 110 | Tcl_ListObjAppendElement(0, pRet, pOther); 111 | } 112 | } 113 | Tcl_SetObjResult(interp, pRet); 114 | return TCL_OK; 115 | } 116 | 117 | -------------------------------------------------------------------------------- /src/htmllib.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/src/htmllib.c -------------------------------------------------------------------------------- /src/htmlrender.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/src/htmlrender.c -------------------------------------------------------------------------------- /src/htmltest.c: -------------------------------------------------------------------------------- 1 | static char const rcsid[] = 2 | "@(#) $Id: htmltest.c,v 1.15 2005/03/23 01:36:54 danielk1977 Exp $"; 3 | 4 | /* 5 | ** This file contains the TestPoint routines used for profiling 6 | ** and coverage analysis of the code. 7 | ** 8 | ** This source code is released into the public domain by the author, 9 | ** D. Richard Hipp, on 2002 December 17. Instead of a license, here 10 | ** is a blessing: 11 | ** 12 | ** May you do good and not evil. 13 | ** May you find forgiveness for yourself and forgive others. 14 | ** May you share freely, never taking more than you give. 15 | */ 16 | 17 | /* 18 | ** A macro named "TestPoint" is defined which increments a counter 19 | ** whenever it is encountered. This is very efficient, and should 20 | ** not impact performance of the system. For delivery, the macro 21 | ** can be nulled out by recompiling without the COVERAGE_TEST macro 22 | ** defined. 23 | ** 24 | ** See also the "renumber.c" program which can be used 25 | ** to assign unique numbers to all of the TestPoint(0) macros. 26 | */ 27 | #include "tcl.h" 28 | #include "html.h" 29 | 30 | #if INTERFACE 31 | 32 | #endif /* INTERFACE */ 33 | 34 | /* 35 | ** The following global array keeps track of the number of visits to 36 | ** each testpoint. The size of the array must be set manually to the 37 | ** be at least one greater than the largest TestPoint number. 38 | */ 39 | #if defined(COVERAGE_TEST) 40 | int HtmlTPArray[2000]; 41 | #endif 42 | 43 | /* Needed by the EslTestPointDump routine 44 | */ 45 | #include 46 | 47 | /* 48 | ** Recursion depth 49 | */ 50 | #if defined(DEBUG) 51 | int HtmlDepth = 0; 52 | #endif 53 | #if INTERFACE 54 | #if defined(DEBUG) 55 | #define HtmlPush HtmlDepth+=2 56 | #define HtmlPop HtmlDepth-=2 57 | #else 58 | #define HtmlPush 59 | #define HtmlPop 60 | #endif 61 | #endif 62 | 63 | /* This function is called to print the values of all elements of the 64 | ** TP_Array to the given file. Values are printed in decimal, one per line. 65 | */ 66 | void 67 | HtmlTestPointDump(filename) 68 | char *filename; 69 | { 70 | #if defined(COVERAGE_TEST) 71 | FILE *fp; 72 | 73 | fp = fopen(filename, "a"); 74 | if (fp) { 75 | int i; 76 | for (i = 0; i < sizeof(HtmlTPArray) / sizeof(HtmlTPArray[0]); i++) { 77 | if (HtmlTPArray[i] > 0) { 78 | fprintf(fp, "%d %d\n", i, HtmlTPArray[i]); 79 | } 80 | } 81 | } 82 | fclose(fp); 83 | #endif 84 | } 85 | 86 | /* This function reports an error to stderr when code that is marked 87 | ** UNTESTED gets executed. 88 | */ 89 | void 90 | HtmlTPUntested(zFile, line) 91 | const char *zFile; 92 | int line; 93 | { 94 | #ifndef USE_TCL_STUBS 95 | fprintf(stderr, "Untested HTML Widget code executed in file %s line %d\n", 96 | zFile, line); 97 | #endif 98 | } 99 | 100 | /* This function reports an error to stderr when safety code that should 101 | ** never execute is called. 102 | */ 103 | void 104 | HtmlTPCantHappen(zFile, line) 105 | const char *zFile; 106 | int line; 107 | { 108 | #ifndef USE_TCL_STUBS 109 | fprintf(stderr, 110 | "Unplanned behavior in the HTML Widget in file %s line %d\n", zFile, 111 | line); 112 | #endif 113 | } 114 | -------------------------------------------------------------------------------- /src/htmlwish.c: -------------------------------------------------------------------------------- 1 | static char const rcsid[] = 2 | "@(#) $Id: htmlwish.c,v 1.10 2005/03/23 23:56:27 danielk1977 Exp $"; 3 | 4 | /* 5 | ** Make a "wish" that includes the html widget. 6 | ** 7 | ** This source code is released into the public domain by the author, 8 | ** D. Richard Hipp, on 2002 December 17. Instead of a license, here 9 | ** is a blessing: 10 | ** 11 | ** May you do good and not evil. 12 | ** May you find forgiveness for yourself and forgive others. 13 | ** May you share freely, never taking more than you give. 14 | */ 15 | #include "appinit.h" 16 | 17 | #ifndef _TCLHTML_ 18 | int Et_AppInit(interp) 19 | Tcl_Interp *interp; 20 | { 21 | extern int Tkhtml_Init(Tcl_Interp *); 22 | Tkhtml_Init(interp); 23 | return TCL_OK; 24 | } 25 | #endif 26 | -------------------------------------------------------------------------------- /src/mkdefaultstyle.tcl: -------------------------------------------------------------------------------- 1 | 2 | proc FileToDefine {file define} { 3 | set fd [open $file] 4 | append ret "#define $define \\" 5 | while {![eof $fd]} { 6 | set line [string map [list \" \\\" \\ \\\\] [gets $fd]] 7 | append ret "\n \"$line\\n\" \\" 8 | } 9 | append ret "\n\n\n" 10 | 11 | return $ret 12 | } 13 | 14 | proc VersionsToDefine {glob define} { 15 | set ret "#define $define \\\n" 16 | foreach file [glob $glob] { 17 | set fd [open $file] 18 | set contents [read $fd] 19 | close $fd 20 | set DOLLAR $ 21 | set expression \\${DOLLAR}Id:(\[^${DOLLAR}\]*)\\${DOLLAR} 22 | if {[regexp $expression $contents dummy match]} { 23 | append ret " \"[string trim $match]\\n\" \\\n" 24 | } 25 | } 26 | return $ret 27 | } 28 | 29 | set css_file [file join [file dirname [info script]] .. src html.css] 30 | set tcl_file [file join [file dirname [info script]] .. src tkhtml.tcl] 31 | set quirks_file [file join [file dirname [info script]] quirks.css] 32 | set src_files [file join [file dirname [info script]] {*.c}] 33 | 34 | puts "" 35 | puts [FileToDefine $tcl_file HTML_DEFAULT_TCL] 36 | puts [FileToDefine $css_file HTML_DEFAULT_CSS] 37 | puts [FileToDefine $quirks_file HTML_DEFAULT_QUIRKS] 38 | puts [VersionsToDefine $src_files HTML_SOURCE_FILES] 39 | 40 | -------------------------------------------------------------------------------- /src/quirks.css: -------------------------------------------------------------------------------- 1 | 2 | /*------------------------------*/ 3 | /* QUIRKS MODE RULES */ 4 | /*------------------------------*/ 5 | 6 | /* Tables are historically special. All font attributes except font-family, 7 | * text-align, white-space and line-height) take their initial values. 8 | */ 9 | TABLE { 10 | white-space: normal; 11 | line-height: normal; 12 | font-size: medium; 13 | font-weight: normal; 14 | font-style: normal; 15 | font-variant: normal; 16 | text-align: left; 17 | } 18 | 19 | TABLE[align] { 20 | text-align: left; 21 | } 22 | 23 | /* Vertical margins of

elements do not collapse against the top or 24 | * bottom of containing table cells. 25 | */ 26 | TH > P:first-child, TD > P:first-child { 27 | margin-top: 0px; 28 | } 29 | TH > P:last-child, TD > P:last-child { 30 | margin-bottom: 0px; 31 | } 32 | 33 | FORM { 34 | margin-bottom: 1em; 35 | } 36 | -------------------------------------------------------------------------------- /src/restrack.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef __RESTRACK_H__ 4 | #define __RESTRACK_H__ 5 | 6 | #include 7 | 8 | char * Rt_Alloc(const char * ,int); 9 | char * Rt_Realloc(const char *, char *, int); 10 | void Rt_Free(char *); 11 | int HtmlHeapDebug(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); 12 | 13 | Tcl_ObjCmdProc Rt_AllocCommand; 14 | Tcl_ObjCmdProc HtmlHeapDebug; 15 | 16 | #endif 17 | 18 | -------------------------------------------------------------------------------- /src/swproc.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __SWPROC_H__ 3 | #define __SWPROC_H__ 4 | 5 | #define SWPROC_END 0 6 | #define SWPROC_ARG 1 7 | #define SWPROC_OPT 2 8 | #define SWPROC_SWITCH 3 9 | 10 | struct SwprocConf { 11 | int eType; 12 | const char *zSwitch; 13 | const char *zDefault; 14 | const char *zTrue; 15 | }; 16 | typedef struct SwprocConf SwprocConf; 17 | 18 | int SwprocRt(Tcl_Interp *, int, Tcl_Obj *CONST[], SwprocConf *, Tcl_Obj **); 19 | void SwprocCleanup(Tcl_Obj **, int); 20 | 21 | int SwprocInit(Tcl_Interp *); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /tclconfig/README.txt: -------------------------------------------------------------------------------- 1 | These files comprise the basic building blocks for a Tcl Extension 2 | Architecture (TEA) extension. For more information on TEA see: 3 | 4 | http://www.tcl.tk/doc/tea/ 5 | 6 | This package is part of the Tcl project at SourceForge, and latest 7 | sources should be available there: 8 | 9 | http://tcl.sourceforge.net/ 10 | 11 | This package is a freely available open source package. You can do 12 | virtually anything you like with it, such as modifying it, redistributing 13 | it, and selling it either in whole or in part. 14 | 15 | CONTENTS 16 | ======== 17 | The following is a short description of the files you will find in 18 | the sample extension. 19 | 20 | README.txt This file 21 | 22 | install-sh Program used for copying binaries and script files 23 | to their install locations. 24 | 25 | tcl.m4 Collection of Tcl autoconf macros. Included by a package's 26 | aclocal.m4 to define TEA_* macros. 27 | -------------------------------------------------------------------------------- /tclconfig/install-sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # install - install a program, script, or datafile 5 | # This comes from X11R5; it is not part of GNU. 6 | # 7 | # $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ 8 | # 9 | # This script is compatible with the BSD install script, but was written 10 | # from scratch. 11 | # 12 | 13 | 14 | # set DOITPROG to echo to test this script 15 | 16 | # Don't use :- since 4.3BSD and earlier shells don't like it. 17 | doit="${DOITPROG-}" 18 | 19 | 20 | # put in absolute paths if you don't have them in your path; or use env. vars. 21 | 22 | mvprog="${MVPROG-mv}" 23 | cpprog="${CPPROG-cp}" 24 | chmodprog="${CHMODPROG-chmod}" 25 | chownprog="${CHOWNPROG-chown}" 26 | chgrpprog="${CHGRPPROG-chgrp}" 27 | stripprog="${STRIPPROG-strip}" 28 | rmprog="${RMPROG-rm}" 29 | 30 | instcmd="$mvprog" 31 | chmodcmd="" 32 | chowncmd="" 33 | chgrpcmd="" 34 | stripcmd="" 35 | rmcmd="$rmprog -f" 36 | mvcmd="$mvprog" 37 | src="" 38 | dst="" 39 | 40 | while [ x"$1" != x ]; do 41 | case $1 in 42 | -c) instcmd="$cpprog" 43 | shift 44 | continue;; 45 | 46 | -m) chmodcmd="$chmodprog $2" 47 | shift 48 | shift 49 | continue;; 50 | 51 | -o) chowncmd="$chownprog $2" 52 | shift 53 | shift 54 | continue;; 55 | 56 | -g) chgrpcmd="$chgrpprog $2" 57 | shift 58 | shift 59 | continue;; 60 | 61 | -s) stripcmd="$stripprog" 62 | shift 63 | continue;; 64 | 65 | *) if [ x"$src" = x ] 66 | then 67 | src=$1 68 | else 69 | dst=$1 70 | fi 71 | shift 72 | continue;; 73 | esac 74 | done 75 | 76 | if [ x"$src" = x ] 77 | then 78 | echo "install: no input file specified" 79 | exit 1 80 | fi 81 | 82 | if [ x"$dst" = x ] 83 | then 84 | echo "install: no destination specified" 85 | exit 1 86 | fi 87 | 88 | 89 | # If destination is a directory, append the input filename; if your system 90 | # does not like double slashes in filenames, you may need to add some logic 91 | 92 | if [ -d $dst ] 93 | then 94 | dst="$dst"/`basename $src` 95 | fi 96 | 97 | # Make a temp file name in the proper directory. 98 | 99 | dstdir=`dirname $dst` 100 | dsttmp=$dstdir/#inst.$$# 101 | 102 | # Move or copy the file name to the temp name 103 | 104 | $doit $instcmd $src $dsttmp 105 | 106 | # and set any options; do chmod last to preserve setuid bits 107 | 108 | if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi 109 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi 110 | if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi 111 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi 112 | 113 | # Now rename the file to the real destination. 114 | 115 | $doit $rmcmd $dst 116 | $doit $mvcmd $dsttmp $dst 117 | 118 | 119 | exit 0 120 | -------------------------------------------------------------------------------- /tests/README: -------------------------------------------------------------------------------- 1 | 2 | This directory contains tests for Tkhtml3 and Hv3. 3 | 4 | -------------------------------------------------------------------------------- /tests/all.tcl: -------------------------------------------------------------------------------- 1 | 2 | proc sourcefile {file} { 3 | set fname [file join [file dirname [info script]] $file] 4 | uplevel #0 [list source $fname] 5 | } 6 | sourcefile common.tcl 7 | 8 | sourcefile tree.test 9 | sourcefile style.test 10 | sourcefile dynamic.test 11 | sourcefile options.test 12 | 13 | catch { destroy . } 14 | 15 | -------------------------------------------------------------------------------- /tests/all.test: -------------------------------------------------------------------------------- 1 | # Run all tests 2 | # 3 | cd [file dirname $argv0] 4 | set me [file tail $argv0] 5 | foreach file [lsort -dictionary [glob *.test]] { 6 | if {$file==$me} continue 7 | source $file 8 | } 9 | -------------------------------------------------------------------------------- /tests/autotest.test: -------------------------------------------------------------------------------- 1 | 2 | if {[info exists INAUTOTEST]} return 3 | set testdir [file dirname [info script]] 4 | 5 | set files [list \ 6 | tree.test \ 7 | style.test \ 8 | ] 9 | 10 | ########################################################################### 11 | 12 | catch {memory init on} 13 | 14 | set auto_path [concat . $auto_path] 15 | package require Tkhtml 16 | package require tcltest 17 | tcltest::configure -verbose {body error pass} 18 | 19 | set INAUTOTEST 1 20 | if {![info exists INTEST]} { 21 | foreach f $files { 22 | if {[catch {source $testdir/$f} msg]} { 23 | puts stderr $msg 24 | } 25 | } 26 | exit 27 | } 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tests/common.tcl: -------------------------------------------------------------------------------- 1 | 2 | package require Tkhtml 3 | package require tcltest 4 | tcltest::verbose {pass body error} 5 | 6 | catch {rename finish_test ""} 7 | 8 | if {[catch {incr ::nested_test_count}]} {set ::nested_test_count 1} 9 | 10 | proc finish_test {} { 11 | catch { 12 | destroy .h 13 | } 14 | incr ::nested_test_count -1 15 | if {$::nested_test_count == 0} { 16 | catch { 17 | destroy . 18 | catch {::tkhtml::htmlalloc} 19 | } 20 | } 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /tests/dynamic.test: -------------------------------------------------------------------------------- 1 | 2 | # Test script for Tkhtml 3 | proc sourcefile {file} { 4 | set fname [file join [file dirname [info script]] $file] 5 | uplevel #0 [list source $fname] 6 | } 7 | sourcefile common.tcl 8 | 9 | html .h 10 | .h handler script style styleHandler 11 | proc styleHandler {data} { 12 | .h style $data 13 | } 14 | 15 | proc property {node prop} { 16 | array set properties [$node prop] 17 | return $properties($prop) 18 | } 19 | 20 | tcltest::test dynamic-1.0 {} -body { 21 | .h reset 22 | .h parse -final { 23 | 24 | 25 | Some Text 26 | Some Text 27 | 28 | } 29 | 30 | set ::node_a [lindex [.h search a] 0] 31 | set ::node_b [lindex [.h search b] 0] 32 | 33 | $::node_a dynamic set 34 | } -result {} 35 | 36 | tcltest::test dynamic-1.1 {} -body { 37 | $::node_b dynamic set 38 | } -result {} 39 | 40 | tcltest::test dynamic-1.2 {} -body { 41 | $::node_a dynamic set hover 42 | } -result {hover} 43 | 44 | tcltest::test dynamic-1.3 {} -body { 45 | $::node_a dynamic set 46 | } -result {hover} 47 | 48 | tcltest::test dynamic-2.0 {} -body { 49 | .h reset 50 | .h parse -final { 51 | 52 | 55 | 56 | Some Text 57 | 58 | } 59 | 60 | set ::node [lindex [.h search a] 0] 61 | property $::node color 62 | } -result {black} 63 | 64 | tcltest::test dynamic-2.1 {} -body { 65 | $::node dynamic set hover 66 | $::node dynamic set 67 | } -result {hover} 68 | 69 | tcltest::test dynamic-2.2 {} -body { 70 | property $::node color 71 | } -result {white} 72 | 73 | tcltest::test dynamic-3.0 {} -body { 74 | .h reset 75 | .h parse -final { 76 | 77 | 82 | 83 | Some Text 84 | 85 | } 86 | 87 | set ::node [lindex [.h search a] 0] 88 | property $::node color 89 | } -result {black} 90 | 91 | tcltest::test dynamic-3.1 {} -body { 92 | $::node dynamic set visited 93 | $::node dynamic set 94 | } -result visited 95 | 96 | tcltest::test dynamic-3.2 {} -body { 97 | property $::node color 98 | } -result {blue} 99 | 100 | tcltest::test dynamic-3.3 {} -body { 101 | $::node dynamic set link 102 | property $::node color 103 | } -result {blue} 104 | tcltest::test dynamic-3.4 {} -body { 105 | $::node dynamic clear visited 106 | property $::node color 107 | } -result {white} 108 | tcltest::test dynamic-3.5 {} -body { 109 | $::node dynamic clear link 110 | $::node dynamic set 111 | } -result {} 112 | tcltest::test dynamic-3.6 {} -body { 113 | property $::node color 114 | } -result {black} 115 | 116 | tcltest::test dynamic-4.0 {} -body { 117 | .h reset 118 | .h parse -final { 119 | 120 | 123 | 124 | Some Text 125 | 126 | } 127 | set ::node [lindex [.h search a] 0] 128 | $::node dynamic conditions 129 | } -result {:link {body a:hover}} 130 | 131 | finish_test 132 | 133 | -------------------------------------------------------------------------------- /tests/encoding.bt: -------------------------------------------------------------------------------- 1 | 2 | # This test script tests some browser behaviour related to encodings 3 | # (charsets). Test plan is as follows: 4 | # 5 | # encoding.1.* - Test that charsets specified as both HTTP 6 | # Content-Type headers or their tag equivalents 7 | # are handled. 8 | # 9 | # encoding.2.* - Test that Hv3 works around the polipo bug. This is 10 | # only really important for Hv3. 11 | # 12 | 13 | set str "\xC0\xC1" 14 | 15 | set encoding.1.javascript { 16 | var div = document.getElementById("div"); 17 | var str = div.firstChild.data 18 | return str.charCodeAt(0) + "." + str.charCodeAt(1) 19 | } 20 | 21 | #-------------------------------------------------------------------------- 22 | # START encoding.1.* 23 | # 24 | # Test with no tag and no Content-Type header. 25 | # 26 | do_browser_test encoding.1.1 -html [subst { 27 |

[encoding convertto iso8859-1 $str]
28 | }] -javascript ${encoding.1.javascript} 29 | 30 | # Test with a tag only. 31 | # 32 | do_browser_test encoding.1.2 -html [subst { 33 | 34 |
[encoding convertto utf-8 $str]
35 | }] -javascript ${encoding.1.javascript} 36 | 37 | # Test with Content-Type header only. 38 | # 39 | do_browser_test encoding.1.3 -encoding utf-8 -html [subst { 40 |
[encoding convertto utf-8 $str]
41 | }] -javascript ${encoding.1.javascript} 42 | 43 | # Test with Content-Type and matching tag. 44 | # 45 | do_browser_test encoding.1.4 -encoding utf-8 -html [subst { 46 | 47 |
[encoding convertto utf-8 $str]
48 | }] -javascript ${encoding.1.javascript} 49 | 50 | # Test with Content-Type and conflicting tag. In this case the 51 | # Content-Type should take precedence. Previous versions of Hv3 had 52 | # this wrong. 53 | # 54 | do_browser_test encoding.1.5 -encoding utf-8 -html [subst { 55 | 56 |
[encoding convertto utf-8 $str]
57 | }] -javascript ${encoding.1.javascript} 58 | 59 | # Test with an incorrect tag only. In this case firefox does not 60 | # do any encoding detection - it just uses the explicitly specified 61 | # one in the same way as Hv3. 62 | # 63 | do_browser_test encoding.1.6 -html [subst { 64 | 65 |
[encoding convertto utf-8 $str]
66 | }] -javascript ${encoding.1.javascript} 67 | # 68 | # END encoding.1.* 69 | #-------------------------------------------------------------------------- 70 | 71 | 72 | proc enc_slow_css {channel} { 73 | enc_slow_part1 $channel { 74 | HTTP/1.1 200 OK 75 | Content-type: text/css 76 | Cache-Control: s-maxage=10 77 | 78 | .hello { color: green } 79 | } { 80 | .tall { height: 500px } 81 | } 82 | } 83 | 84 | proc enc_slow_part1 {channel data1 data2} { 85 | puts -nonewline $channel [string trimleft $data1] 86 | flush $channel 87 | after 1000 [list enc_slow_part2 $channel $data2] 88 | } 89 | 90 | proc enc_slow_part2 {channel data} { 91 | puts -nonewline $channel $data 92 | flush $channel 93 | close $channel 94 | } 95 | 96 | do_browser_test encoding.2.1 -html { 97 | 98 | 99 | 100 | 101 |
... 102 |
103 | } -javascript { 104 | return document.getElementById("div").offsetHeight 105 | } 106 | 107 | -------------------------------------------------------------------------------- /tests/engine.tcl: -------------------------------------------------------------------------------- 1 | # This file contains the test driver for the html widget. It defines 2 | # a special version of the test procedure to use for testing the 3 | # html widget. 4 | # 5 | 6 | # $Id: engine.tcl,v 1.2 2003/01/28 05:01:05 hkoba Exp $ 7 | 8 | # Make sure the html widget is loaded into 9 | # our interpreter 10 | # 11 | if {[info command html]==""} { 12 | if {[catch {package require Tkhtml} error]} { 13 | foreach f { 14 | ./libTkhtml*.so 15 | ../libTkhtml*.so 16 | /usr/lib/libTkhtml*.so 17 | /usr/local/lib/libTkhtml*.so 18 | ./tkhtml.dll 19 | } { 20 | if {[set f [lindex [glob -nocomplain $f] end]] != ""} { 21 | if {[catch {load $f Tkhtml}]==0} break 22 | } 23 | } 24 | } 25 | } 26 | 27 | # Initialize variables 28 | # 29 | namespace eval tcltest { 30 | set mode run 31 | set current {} 32 | set passed 0 33 | set failed 0 34 | set total 0 35 | set status {} 36 | } 37 | 38 | # Arguments: 39 | # 40 | # tag A symbolic tag for this test. Ex: html-1.0 41 | # 42 | # desc A human-readable description of what this test does. 43 | # 44 | # script Tcl code to implement the test 45 | # 46 | # result The expected result from this test. If the actual result 47 | # is different the test fails. 48 | # 49 | proc ::tcltest::test {tag desc script result} { 50 | ::tcltest::change-desc $tag $desc 51 | if {[info exists ::tcltest::idle]} { 52 | catch {after cancel $::tcltest::idle} 53 | catch {unset ::tcltest::idle} 54 | } 55 | set rc [catch {uplevel #0 $script} msg] 56 | set r [list $rc $msg] 57 | if {$r==$result} { 58 | incr ::tcltest::passed 59 | puts "---- Test $tag passed" 60 | } else { 61 | incr ::tcltest::failed 62 | puts "**** Test $tag failed" 63 | puts "Expected: [list $result]" 64 | puts "Got: [list $r]" 65 | } 66 | incr ::tcltest::total 67 | ::tcltest::update-status 68 | set ::tcltest::idle [after 100 ::tcltest::testing-complete] 69 | } 70 | 71 | # Create the test control window 72 | # 73 | proc ::tcltest::mainwin {} { 74 | set w .testinfo 75 | toplevel $w 76 | wm title $w {Html Widget Test Information} 77 | wm iconname $w {Html-Test} 78 | set f $w.f1 79 | frame $f 80 | pack $f -side top -fill x 81 | label $f.l -text {Status: } 82 | label $f.v -textvariable ::tcltest::status 83 | pack $f.l $f.v -side left 84 | set f $w.f2 85 | frame $f 86 | pack $f -side top -fill x 87 | label $f.l -text {Current Test: } 88 | label $f.v -textvariable ::tcltest::current 89 | pack $f.l $f.v -side left 90 | set f $w.b 91 | frame $f 92 | pack $f -side bottom -fill x 93 | button $f.pause -text Pause -command ::tcltest::pause 94 | button $f.pass -text {Pass} -command {::tcltest::set-result pass} 95 | button $f.fail -text {Fail} -command {::tcltest::set-result fail} 96 | button $f.exit -text Exit -command exit 97 | pack $f.pause $f.pass $f.fail $f.exit -side right -pady 10 -expand 1 98 | scrollbar $w.sb -orient vertical -command "$w.t yview" 99 | pack $w.sb -side right -fill y 100 | html $w.t -yscrollcommand "$w.sb set" -width 400 -height 150 \ 101 | -bd 2 -relief sunken -padx 5 -pady 5 102 | pack $w.t -side right -fill both -expand 1 103 | ::tcltest::update-status 104 | } 105 | 106 | # Change the test description in the control window 107 | # 108 | proc ::tcltest::change-desc {tag desc} { 109 | if {![winfo exists .testinfo]} ::tcltest::mainwin 110 | .testinfo.t clear 111 | .testinfo.t parse $desc\n 112 | set ::tcltest::current $tag 113 | } 114 | 115 | # Update the status line 116 | # 117 | proc ::tcltest::update-status {} { 118 | set v "$::tcltest::passed passed $::tcltest::failed failed " 119 | append v "$::tcltest::total total" 120 | set ::tcltest::status $v 121 | } 122 | 123 | # Wait for the user to press either the pass or failed buttons. 124 | # 125 | proc ::tcltest::user-result {} { 126 | .testinfo.b.pass config -state normal 127 | .testinfo.b.fail config -state normal 128 | update 129 | raise .testinfo 130 | focus .testinfo.b.pass 131 | set ::tcltest::result {} 132 | vwait ::tcltest::result 133 | .testinfo.b.pass config -state disabled 134 | .testinfo.b.fail config -state disabled 135 | return $::tcltest::result 136 | } 137 | 138 | # Called when the user presses either the failed or passed buttons. 139 | # 140 | proc ::tcltest::set-result v { 141 | set ::tcltest::result $v 142 | } 143 | 144 | # Call this routine at the end of all tests 145 | # 146 | proc ::tcltest::testing-complete {} { 147 | ::tcltest::change-desc {} {Testing is now complete} 148 | } 149 | 150 | # Construct an HTML widget to use for testing. 151 | # 152 | proc tkhtml_test_widget {} { 153 | set w .tkhtml_test 154 | if {[winfo exists $w]} { 155 | return $w.h 156 | } 157 | toplevel $w 158 | wm title $w {TkHtml Test Widget} 159 | wm iconname $w {TkHtml Test} 160 | scrollbar $w.sb -orient vertical -command "$w.h yview" 161 | pack $w.sb -side right -fill y 162 | html $w.h -yscrollcommand "$w.sb set" 163 | pack $w.h -side right -fill both -expand 1 164 | return $w.h 165 | } 166 | -------------------------------------------------------------------------------- /tests/events.bt: -------------------------------------------------------------------------------- 1 | 2 | if 0 {_ 3 | 4 | #------------------------------------------------------------------------ 5 | # This is a "warm-body" test for the events module. 6 | # 7 | ::browsertest::do_test events.1 -timeout 10000000 -html { 8 | 9 | 18 |
19 |
20 |
21 | Hello Hello 22 | 23 | } -javascript { 24 | 25 | /* Create a synthetic mouse event. */ 26 | var e = document.createEvent("MouseEvents") 27 | e.initMouseEvent( 28 | "click", true, true, window, 0, 0, 0, 0, 0, 29 | false, false, false, false, 0, null 30 | ); 31 | 32 | /* Dispatch the event to the
element. It should 33 | * bubble up through
and
Paragraph 1

50 | } { 51 |

Paragraph 2

52 | } 53 | } 54 | 55 | proc slow_css {channel} { 56 | slow_part1 $channel { 57 | HTTP/1.1 200 OK 58 | Content-type: text/css 59 | Cache-Control: no-cache 60 | 61 | } { 62 | .tall { height: 500px } 63 | } 64 | } 65 | 66 | proc slow_part1 {channel data1 data2} { 67 | puts -nonewline $channel [string trimleft $data1] 68 | flush $channel 69 | after 1000 [list slow_part2 $channel $data2] 70 | } 71 | 72 | proc slow_part2 {channel data} { 73 | puts -nonewline $channel $data 74 | flush $channel 75 | close $channel 76 | } 77 | 78 | # This is to test that the browser waits until all stylesheets are 79 | # downloaded and applied before firing the "onload" event. 80 | # 81 | do_browser_test events.1 -timeout 10000000 -html { 82 | 86 | 87 |
hello
88 | } -javascript { 89 | var div = document.getElementById("me") 90 | return div.offsetHeight 91 | } 92 | 93 | 94 | -------------------------------------------------------------------------------- /tests/form.bt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # The focus of this module is the HTMLFormElement object - the 4 | # thing created by a
tag in a document. 5 | # 6 | set ::Doc { 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | } 20 | 21 | # forms.one.i_one -> NodeList 22 | # forms.one.i_two -> HTMLInputElement 23 | # forms.one.i_three -> HTMLInputElement 24 | # forms.one.i_four -> NodeList 25 | 26 | # The reference to forms[0].i_one is a collection, because 27 | # there is more than one element named i_one. 28 | # 29 | do_browser_test forms.1 -html $::Doc -javascript { 30 | return document.forms.one.i_one.length 31 | } -expected 2 32 | 33 | # But forms[0].i_two is the HTMLInputElement. 34 | # 35 | do_browser_test forms.2 -html $::Doc -javascript { 36 | return document.forms[0].i_two.type 37 | } -expected "text" 38 | 39 | do_browser_test forms.3 -html $::Doc -javascript { 40 | return document.forms[0].i_three.type 41 | } -expected "text" 42 | 43 | do_browser_test forms.4 -html $::Doc -javascript { 44 | return document.forms[0].i_four.length 45 | } -expected 2 46 | 47 | -------------------------------------------------------------------------------- /tests/form1.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/form1.html -------------------------------------------------------------------------------- /tests/html1.test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/html1.test -------------------------------------------------------------------------------- /tests/html2.test: -------------------------------------------------------------------------------- 1 | # 2 | # Test script for the Tk HTML widget 3 | # 4 | wm withdraw . 5 | if {[lsearch [namespace children] ::tcltest] == -1} { 6 | source [file dirname $argv0]/engine.tcl 7 | namespace import ::tcltest::* 8 | cd [file dirname $argv0] 9 | } 10 | 11 | 12 | # in image to use for all GIFs. 13 | # 14 | image create photo nogifsm -data { 15 | R0lGODdhEAAQAPEAAACQkADQ0PgAAAAAACwAAAAAEAAQAAACNISPacHtD4IQz80QJ60as25d 16 | 3idKZdR0IIOm2ta0Lhw/Lz2S1JqvK8ozbTKlEIVYceWSjwIAO/// 17 | } 18 | 19 | # A callback to handle image requests 20 | # 21 | proc ImageCmd {args} { 22 | set fn [lindex $args 0] 23 | if {[catch {image create photo -file $fn} img]} { 24 | set img nogifsm 25 | } 26 | return $img 27 | } 28 | 29 | # Free all images 30 | # 31 | proc FreeImages {} { 32 | foreach img [image names] { 33 | image delete $img 34 | } 35 | } 36 | 37 | # Create the HTML widget to use for all testing. 38 | # 39 | set h [tkhtml_test_widget] 40 | $h config -imagecommand ImageCmd 41 | 42 | ::tcltest::test html-2.1 { 43 | A snapshot of Slashdot on Jan 29, 2000. 44 | } { 45 | set file page1/index.html 46 | $h clear 47 | set f [open $file r] 48 | $h config -base $file 49 | $h parse [read $f [file size $file]] 50 | close $f 51 | set r [::tcltest::user-result] 52 | $h clear 53 | FreeImages 54 | return $r 55 | } {2 pass} 56 | 57 | ::tcltest::test html-2.2 { 58 | A snapshot of a page from the Scriptics website on Jan 29, 2000. 59 | } { 60 | set file page2/index.html 61 | $h clear 62 | set f [open $file r] 63 | $h config -base $file 64 | $h parse [read $f [file size $file]] 65 | close $f 66 | set r [::tcltest::user-result] 67 | $h clear 68 | FreeImages 69 | return $r 70 | } {2 pass} 71 | 72 | ::tcltest::test html-2.3 { 73 | A snapshot of freshmeat on Jan 29, 2000 74 | } { 75 | set file page4/index.html 76 | $h clear 77 | set f [open $file r] 78 | $h config -base $file 79 | $h parse [read $f [file size $file]] 80 | close $f 81 | set r [::tcltest::user-result] 82 | $h clear 83 | FreeImages 84 | return $r 85 | } {2 pass} 86 | 87 | ::tcltest::test html-2.4 { 88 | A slide show about mktclapp 89 | } { 90 | set file page3/index.html 91 | $h clear 92 | set f [open $file r] 93 | $h config -base $file 94 | $h parse [read $f [file size $file]] 95 | close $f 96 | set r [::tcltest::user-result] 97 | $h clear 98 | FreeImages 99 | return $r 100 | } {2 pass} 101 | -------------------------------------------------------------------------------- /tests/html4.test: -------------------------------------------------------------------------------- 1 | #!/usr/bin/wish 2 | if {[info commands html] == ""} { 3 | if {[file exists libTkhtml2.0.so]} { 4 | load ./libTkhtml2.0.so 5 | } else { 6 | package require Tkhtml 7 | } 8 | } 9 | package require tcltest 10 | 11 | ::tcltest::test html-4.1 {textarea space after dot} { 12 | set ::RESULT {} 13 | proc FormCmd {n cmd args} { 14 | if {$cmd != "textarea"} return 15 | set ::RESULT [lindex $args end] 16 | } 17 | html .html -formcommand FormCmd 18 | pack .html 19 | .html parse { 20 |
21 | 22 |
23 | } 24 | # To force all FormCmd is executed... 25 | update 26 | 27 | set ::RESULT 28 | } {A.B. C. D.} 29 | 30 | ::tcltest::test html-4.2 {pre space after dot} { 31 | catch {destroy .html} 32 | pack [html .html] 33 | .html parse {BEGIN
A.B. C.  D.
END} 34 | .html text ascii 1 end 35 | } {BEGINA.B. C. D.END} 36 | 37 | ::tcltest::test html-4.3 {SentencePadding A. B. C.} { 38 | catch {destroy .html} 39 | pack [html .html -sentencepadding 1] 40 | .html parse {

A. B. C.

} 41 | set result [.html text ascii 1 end] 42 | destroy .html 43 | set result 44 | } {A. B. C.} 45 | 46 | ::tcltest::test html-4.4 {SentencePadding for D.C...} { 47 | catch {destroy .html} 48 | pack [html .html] 49 | catch {.html configure -sentencepadding 1} 50 | .html parse {

Today Washington D.C. is ...

} 51 | set result [.html text ascii 1 end] 52 | destroy .html 53 | set result 54 | } {Today Washington D.C. is ...} 55 | 56 | ::tcltest::test html-4.5 {No SentencePadding for "A. B."} { 57 | catch {destroy .html} 58 | pack [html .html] 59 | catch {.html configure -sentencepadding 1} 60 | .html parse {

A. B.

} 61 | set result [.html text ascii 1 end] 62 | destroy .html 63 | set result 64 | } {A. B.} 65 | -------------------------------------------------------------------------------- /tests/html5.test: -------------------------------------------------------------------------------- 1 | #!/usr/bin/wish 2 | if {[info commands html] == ""} { 3 | if {[file exists libTkhtml2.0.so]} { 4 | load ./libTkhtml2.0.so 5 | } else { 6 | package require Tkhtml 7 | } 8 | } 9 | package require tcltest 10 | 11 | tcltest::test html-5.1 {gzip -> gunzip roundtrip} { 12 | html gunzip data [html gzip data abc] 13 | } {abc} 14 | -------------------------------------------------------------------------------- /tests/main.tcl: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # This is the main.tcl file used to create a starkit from the hv.tcl 4 | # application. 5 | # 6 | 7 | package require starkit 8 | if {[starkit::startup] eq "sourced"} return 9 | 10 | if {[llength $argv] == 0} { 11 | set argv [file join [file dirname [info script]] index.html] 12 | } 13 | 14 | rename exit exit_original 15 | proc exit {args} { 16 | ::tk::htmlexit 17 | } 18 | 19 | package require app-hv3 20 | 21 | -------------------------------------------------------------------------------- /tests/node.bt: -------------------------------------------------------------------------------- 1 | 2 | 3 | do_browser_test node.1 -javascript { 4 | return Node.ELEMENT_NODE 5 | } 6 | 7 | do_browser_test node.2 -javascript { 8 | Node.prop = "hello" 9 | return Node.prop 10 | } 11 | 12 | # This test does not work. Firefox allows the Node.ELEMENT_NODE 13 | # constant to be overwritten, whereas Hv3 throws an exception. 14 | # 15 | # ::browsertest::do_test node.3 -timeout 10000000 -javascript { 16 | # Node.ELEMENT_NODE = "hello" 17 | # return Node.ELEMENT_NODE 18 | # } -expected hello 19 | 20 | do_browser_test node.3 -javascript { 21 | try { 22 | document.body.nodeType = 10 23 | } catch (e) { 24 | return e 25 | } 26 | return "" 27 | } 28 | 29 | do_browser_test node.4 -html {} -javascript { 30 | return "" + document.body.ELEMENT_NODE 31 | } 32 | 33 | -------------------------------------------------------------------------------- /tests/options.test: -------------------------------------------------------------------------------- 1 | # Test script for Tkhtml 2 | proc sourcefile {file} { 3 | set fname [file join [file dirname [info script]] $file] 4 | uplevel #0 [list source $fname] 5 | } 6 | sourcefile common.tcl 7 | 8 | html .h 9 | 10 | #-------------------------------------------------------------------------- 11 | # Test cases option-1.* test the parsing of the '-fonttable' option. 12 | # 13 | tcltest::test option-1.0 {} -body { 14 | .h cget -fonttable 15 | } -result {8 9 10 11 13 15 17} 16 | tcltest::test option-1.1 {} -body { 17 | set rc [catch { 18 | .h configure -fonttable hello 19 | } msg] 20 | list $rc $msg 21 | } -result {1 {expected list of 7 integers but got "hello"}} 22 | tcltest::test option-1.2 {} -body { 23 | .h cget -fonttable 24 | } -result {8 9 10 11 13 15 17} 25 | tcltest::test option-1.3 {} -body { 26 | .h configure -fonttable {1 2 3 4 5 6 7} 27 | .h cget -fonttable 28 | } -result {1 2 3 4 5 6 7} 29 | 30 | 31 | finish_test 32 | 33 | 34 | -------------------------------------------------------------------------------- /tests/page1/image1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page1/image1 -------------------------------------------------------------------------------- /tests/page1/image10: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page1/image10 -------------------------------------------------------------------------------- /tests/page1/image11: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page1/image11 -------------------------------------------------------------------------------- /tests/page1/image12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page1/image12 -------------------------------------------------------------------------------- /tests/page1/image13: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page1/image13 -------------------------------------------------------------------------------- /tests/page1/image14: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page1/image14 -------------------------------------------------------------------------------- /tests/page1/image2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page1/image2 -------------------------------------------------------------------------------- /tests/page1/image3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page1/image3 -------------------------------------------------------------------------------- /tests/page1/image4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page1/image4 -------------------------------------------------------------------------------- /tests/page1/image5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page1/image5 -------------------------------------------------------------------------------- /tests/page1/image6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page1/image6 -------------------------------------------------------------------------------- /tests/page1/image7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page1/image7 -------------------------------------------------------------------------------- /tests/page1/image8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page1/image8 -------------------------------------------------------------------------------- /tests/page1/image9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page1/image9 -------------------------------------------------------------------------------- /tests/page2/image1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image1 -------------------------------------------------------------------------------- /tests/page2/image10: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image10 -------------------------------------------------------------------------------- /tests/page2/image11: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image11 -------------------------------------------------------------------------------- /tests/page2/image12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image12 -------------------------------------------------------------------------------- /tests/page2/image13: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image13 -------------------------------------------------------------------------------- /tests/page2/image14: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image14 -------------------------------------------------------------------------------- /tests/page2/image15: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image15 -------------------------------------------------------------------------------- /tests/page2/image16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image16 -------------------------------------------------------------------------------- /tests/page2/image17: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image17 -------------------------------------------------------------------------------- /tests/page2/image18: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image18 -------------------------------------------------------------------------------- /tests/page2/image19: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image19 -------------------------------------------------------------------------------- /tests/page2/image2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image2 -------------------------------------------------------------------------------- /tests/page2/image20: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image20 -------------------------------------------------------------------------------- /tests/page2/image21: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image21 -------------------------------------------------------------------------------- /tests/page2/image22: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image22 -------------------------------------------------------------------------------- /tests/page2/image23: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image23 -------------------------------------------------------------------------------- /tests/page2/image24: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image24 -------------------------------------------------------------------------------- /tests/page2/image25: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image25 -------------------------------------------------------------------------------- /tests/page2/image26: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image26 -------------------------------------------------------------------------------- /tests/page2/image27: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image27 -------------------------------------------------------------------------------- /tests/page2/image28: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image28 -------------------------------------------------------------------------------- /tests/page2/image29: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image29 -------------------------------------------------------------------------------- /tests/page2/image3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image3 -------------------------------------------------------------------------------- /tests/page2/image30: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image30 -------------------------------------------------------------------------------- /tests/page2/image31: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image31 -------------------------------------------------------------------------------- /tests/page2/image32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image32 -------------------------------------------------------------------------------- /tests/page2/image33: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image33 -------------------------------------------------------------------------------- /tests/page2/image34: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image34 -------------------------------------------------------------------------------- /tests/page2/image35: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image35 -------------------------------------------------------------------------------- /tests/page2/image36: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image36 -------------------------------------------------------------------------------- /tests/page2/image37: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image37 -------------------------------------------------------------------------------- /tests/page2/image38: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image38 -------------------------------------------------------------------------------- /tests/page2/image39: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image39 -------------------------------------------------------------------------------- /tests/page2/image4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image4 -------------------------------------------------------------------------------- /tests/page2/image5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image5 -------------------------------------------------------------------------------- /tests/page2/image6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image6 -------------------------------------------------------------------------------- /tests/page2/image7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image7 -------------------------------------------------------------------------------- /tests/page2/image8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image8 -------------------------------------------------------------------------------- /tests/page2/image9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page2/image9 -------------------------------------------------------------------------------- /tests/page3/image1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page3/image1 -------------------------------------------------------------------------------- /tests/page3/image10: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page3/image10 -------------------------------------------------------------------------------- /tests/page3/image11: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page3/image11 -------------------------------------------------------------------------------- /tests/page3/image12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page3/image12 -------------------------------------------------------------------------------- /tests/page3/image13: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page3/image13 -------------------------------------------------------------------------------- /tests/page3/image14: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page3/image14 -------------------------------------------------------------------------------- /tests/page3/image2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page3/image2 -------------------------------------------------------------------------------- /tests/page3/image3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page3/image3 -------------------------------------------------------------------------------- /tests/page3/image4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page3/image4 -------------------------------------------------------------------------------- /tests/page3/image5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page3/image5 -------------------------------------------------------------------------------- /tests/page3/image6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page3/image6 -------------------------------------------------------------------------------- /tests/page3/image7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page3/image7 -------------------------------------------------------------------------------- /tests/page3/image8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page3/image8 -------------------------------------------------------------------------------- /tests/page3/image9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page3/image9 -------------------------------------------------------------------------------- /tests/page3/index.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page3/index.html -------------------------------------------------------------------------------- /tests/page4/image1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page4/image1 -------------------------------------------------------------------------------- /tests/page4/image2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page4/image2 -------------------------------------------------------------------------------- /tests/page4/image3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page4/image3 -------------------------------------------------------------------------------- /tests/page4/image4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page4/image4 -------------------------------------------------------------------------------- /tests/page4/image5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page4/image5 -------------------------------------------------------------------------------- /tests/page4/image6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page4/image6 -------------------------------------------------------------------------------- /tests/page4/image7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page4/image7 -------------------------------------------------------------------------------- /tests/page4/image8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page4/image8 -------------------------------------------------------------------------------- /tests/page4/image9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page4/image9 -------------------------------------------------------------------------------- /tests/page4/index.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/page4/index.html -------------------------------------------------------------------------------- /tests/reset.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | # This test script tests that Tkhtml3 behaves well when the 4 | # [$widget reset] method is called from with a node-handler 5 | # callback. This happens in Hv3 when a node specifies 6 | # a charset for the document. 7 | # 8 | 9 | proc sourcefile {file} { 10 | set fname [file join [file dirname [info script]] $file] 11 | uplevel "#0" [list source $fname] 12 | } 13 | sourcefile common.tcl 14 | 15 | set ::DocumentOne { 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
123
25 | 26 | 27 | } 28 | 29 | set ::DocumentTwo { 30 | 31 | 32 |
456
33 | 34 | } 35 | 36 | html .h 37 | .h handler node meta meta_node_handler 38 | 39 | proc meta_node_handler {n} { 40 | if {[$n attr id] eq $::iReset} { 41 | .h reset 42 | if {$::doParse == 1} { 43 | .h parse -final $::DocumentTwo 44 | } elseif {$::doParse == 2} { 45 | set ::doParse 1 46 | .h parse -final $::DocumentOne 47 | } 48 | } 49 | } 50 | 51 | proc get_div_contents {} { 52 | set n [.h search div -index 0] 53 | if {$n eq ""} { 54 | set res "" 55 | } else { 56 | set res [[lindex [$n children] 0] text] 57 | } 58 | set res 59 | } 60 | 61 | # Run some tests with a few different values for global variables 62 | # ::doParse and ::iReset (used by proc [meta_node_handler] above). 63 | # 64 | foreach {test_number ::iReset ::doParse result} [list \ 65 | 1 n/a n/a 123 \ 66 | 2 1 0 "" \ 67 | 3 1 1 456 \ 68 | 4 1 2 456 \ 69 | 5 2 0 "" \ 70 | 6 2 1 456 \ 71 | 7 1 2 456 \ 72 | ] { 73 | tcltest::test reset-1.$test_number {} -body { 74 | .h reset 75 | .h parse -final $::DocumentOne 76 | get_div_contents 77 | } -result $result 78 | } 79 | 80 | finish_test 81 | 82 | -------------------------------------------------------------------------------- /tests/style.bt: -------------------------------------------------------------------------------- 1 | 2 | #------------------------------------------------------------------------ 3 | # This is a "warm-body" test for the events module. 4 | # 5 | do_browser_test style.1 -timeout 10000000 -html { 6 | 7 |
8 |
9 | 10 | } -javascript { 11 | var div = document.getElementById("div"); 12 | return div.style.borderTopWidth 13 | } -expected "" 14 | 15 | do_browser_test style.2 -timeout 10000000 -html { 16 | 17 |
18 |
19 | 20 | } -javascript { 21 | var div = document.getElementById("div"); 22 | return div.style.borderTopWidth 23 | } -expected 22px 24 | 25 | do_browser_test style.3 -timeout 10000000 -javascript { 26 | return parseInt("") 27 | } -expected NaN 28 | do_browser_test style.4 -timeout 10000000 -javascript { 29 | var b = 8911 30 | b = b - parseInt("") 31 | return b 32 | } -expected NaN 33 | 34 | -------------------------------------------------------------------------------- /tests/syntax.test: -------------------------------------------------------------------------------- 1 | 2 | # Test script for Tkhtml 3 | # 4 | # This file contains test cases that ensure the handling of syntax 5 | # errors in stylesheets is consistent with other interpretations of 6 | # the various CSS specs. 7 | # 8 | # Interfaces: 9 | # 10 | # pathName style TEXT 11 | # pathName parse -final TEXT 12 | # pathName search SELECTOR 13 | # nodeHandle property PROPERTY-NAME 14 | # 15 | 16 | # Standard test file code. 17 | proc sourcefile {file} { 18 | set fname [file join [file dirname [info script]] $file] 19 | uplevel #0 [list source $fname] 20 | } 21 | sourcefile common.tcl 22 | html .h -defaultstyle "" 23 | 24 | proc syntaxtest {name args} { 25 | array set a $args 26 | .h reset 27 | .h parse -final $a(-document) 28 | .h style $a(-style) 29 | tcltest::test $name {} -body $a(-body) -result $a(-result) 30 | } 31 | 32 | #--------------------------------------------------------------------- 33 | # The following tests - syntax-1.* - come from the selectors 34 | # in the acid2 page. 35 | # 36 | syntaxtest syntax-1.0 -style { 37 | div { 38 | background: yellow /* comment */ no-repeat /* comment */ ; 39 | } 40 | } -document { 41 |
42 | } -body { 43 | set node [lindex [.h search div] 0] 44 | $node property background-color 45 | } -result yellow 46 | 47 | syntaxtest syntax-1.1 -style { 48 | [class~=one].first.one {color: red} 49 | } -document { 50 |
51 | } -body { 52 | set node [lindex [.h search div] 0] 53 | $node property color 54 | } -result red 55 | 56 | syntaxtest syntax-1.2 -style { 57 | [class~=one][class~=first] [class=second\ two][class="second two"] 58 | {color : red} 59 | } -document { 60 |
61 |
62 | } -body { 63 | set node [lindex [.h search {#1}] 0] 64 | $node property color 65 | } -result red 66 | 67 | syntaxtest syntax-1.4 -style { 68 | /* Note the syntax error in the next line! */ 69 | [class=second two] { background: red; } 70 | .eyes { position: absolute } 71 | } -document { 72 |
73 | } -body { 74 | set node [lindex [.h search .eyes] 0] 75 | $node property position 76 | } -result absolute 77 | 78 | #--------------------------------------------------------------------- 79 | # The selector in this test case - syntax-2.0 - comes from 80 | # "http://www.freenigma.com". This should just be handled as a 81 | # syntax error (ignore the whole declaration): 82 | # 83 | # a:* { 84 | # text-decoration: none; 85 | # color: #436976; 86 | # } 87 | # 88 | syntaxtest syntax-2.0 -style { 89 | * {color: black;} 90 | a:* { 91 | text-decoration: none; 92 | color: #436976; 93 | } 94 | } -document { 95 | Hello 96 | } -body { 97 | set node [lindex [.h search a] 0] 98 | $node property color 99 | } -result black 100 | # 101 | # Also from www.freenigma.com: 102 | # 103 | # @CHARSET "UTF-8"; 104 | # 105 | # div.content h1 { color: red } 106 | # 107 | 108 | #--------------------------------------------------------------------- 109 | # The selector in this test case - syntax-3.0 - tests a problem found at 110 | # "http://www.yahoo.com". The lines prefixed with "*" should be skipped, 111 | # the others respected. 112 | # 113 | # Apparently people have figured out that the following are all legal 114 | # ways of commenting out a property/value pair in CSS: 115 | # 116 | # selector { 117 | # *prop: value; 118 | # # prop: value; 119 | # // prop: value; 120 | # } 121 | # 122 | syntaxtest syntax-3.0 -style { 123 | div { 124 | text-decoration:underline; 125 | *color:red; 126 | color:green; 127 | *text-decoration:strikethrough; 128 | } 129 | } -document { 130 |
Hello
131 | } -body { 132 | set node [lindex [.h search div] 0] 133 | list [$node property color] [$node property text-decoration] 134 | } -result {green underline} 135 | syntaxtest syntax-3.1 -style { 136 | div { 137 | text-decoration:underline; 138 | // color:red; 139 | color:green; 140 | # text-decoration:strikethrough; 141 | } 142 | } -document { 143 |
Hello
144 | } -body { 145 | set node [lindex [.h search div] 0] 146 | list [$node property color] [$node property text-decoration] 147 | } -result {green underline} 148 | #--------------------------------------------------------------------- 149 | 150 | syntaxtest syntax-4.0 -style { 151 | @media all and (min-width: 0px) { 152 | #primary { 153 | margin-left: 0px; 154 | padding-left: 0; 155 | } 156 | } 157 | div {color:green} 158 | } -document { 159 |
Hello
160 | } -body { 161 | set node [lindex [.h search div] 0] 162 | $node property color 163 | } -result {green} 164 | 165 | finish_test 166 | 167 | -------------------------------------------------------------------------------- /tests/test1.tcl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tests/test1.tcl -------------------------------------------------------------------------------- /tests/tkhtml.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkhtml.tcl -- 3 | # 4 | # This file contains: 5 | # 6 | # - The default bindings for the Html widget, and 7 | # - Some Tcl functions used by the stylesheet html.css. 8 | # 9 | # ------------------------------------------------------------------------ 10 | # 11 | # Copyright (c) 2005 Eolas Technologies Inc. 12 | # All rights reserved. 13 | # 14 | # This Open Source project was made possible through the financial support 15 | # of Eolas Technologies Inc. 16 | # 17 | # Redistribution and use in source and binary forms, with or without 18 | # modification, are permitted provided that the following conditions are met: 19 | # 20 | # * Redistributions of source code must retain the above copyright 21 | # notice, this list of conditions and the following disclaimer. 22 | # * Redistributions in binary form must reproduce the above copyright 23 | # notice, this list of conditions and the following disclaimer in the 24 | # documentation and/or other materials provided with the distribution. 25 | # * Neither the name of the nor the names of its 26 | # contributors may be used to endorse or promote products derived from 27 | # this software without specific prior written permission. 28 | # 29 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 30 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 31 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 32 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 33 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 34 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 35 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 36 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 37 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 38 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 39 | # POSSIBILITY OF SUCH DAMAGE. 40 | # 41 | 42 | # Default bindings 43 | # 44 | # bind Html { focus %W } 45 | bind Html { %W yview scroll -1 units } 46 | bind Html { %W yview scroll 1 units } 47 | bind Html { %W yview scroll 1 units } 48 | bind Html { %W xview scroll 1 units } 49 | bind Html { %W xview scroll -1 units } 50 | bind Html { %W yview scroll 1 pages } 51 | bind Html { %W yview scroll 1 pages } 52 | bind Html { %W yview scroll -1 pages } 53 | bind Html { %W yview scroll -4 units } 54 | bind Html { %W yview scroll 4 units } 55 | 56 | 57 | # Some Tcl procs used by html.css 58 | # 59 | namespace eval tkhtml { 60 | proc len {val} { 61 | if {[regexp {^[0-9]+$} $val]} { 62 | append val px 63 | } 64 | return $val 65 | } 66 | 67 | proc color {val} { 68 | set len [string length $val] 69 | if {0==($len % 3) && [regexp {^[0-9a-fA-F]*$} $val]} { 70 | return "#$val" 71 | } 72 | return $val 73 | } 74 | 75 | swproc attr {attr {len 0 1} {color 0 1}} { 76 | upvar N node 77 | set val [$node attr -default "" $attr] 78 | if {$val == ""} {error ""} 79 | if {$len} {return [len $val]} 80 | if {$color} {return [color $val]} 81 | return $val 82 | } 83 | 84 | swproc aa {tag attr {len 0 1} {if NULL} {color 0 1}} { 85 | upvar N node 86 | for {} {$node != ""} {set node [$node parent]} { 87 | if {[$node tag] == $tag} { 88 | if {[catch {$node attr $attr} val]} {error ""} 89 | 90 | if {$if != "NULL"} {return $if} 91 | if {$val == ""} {error ""} 92 | if {$len} {return [len $val]} 93 | if {$color} {return [color $val]} 94 | return $val 95 | } 96 | } 97 | error "No such ancestor attribute: $tag $attr" 98 | } 99 | 100 | proc create_image_tile {img} { 101 | set w [image width $img] 102 | set h [image width $img] 103 | if {$w <= 0 || $h <= 0} {error "empty image"} 104 | 105 | set tw [expr int(200 / $w) * $w] 106 | set th [expr int(200 / $h) * $h] 107 | if {$tw == 0} {set tw $w} 108 | if {$th == 0} {set th $h} 109 | 110 | set newimg [image create photo] 111 | $newimg copy $img -from 0 0 -to 0 0 $tw $th 112 | return $newimg 113 | } 114 | } 115 | 116 | -------------------------------------------------------------------------------- /tests/tree.tcl: -------------------------------------------------------------------------------- 1 | 2 | set auto_path [concat . $auto_path] 3 | package require Tkhtml 4 | 5 | # Procedure to return the contents of a file-system entry 6 | proc readFile {fname} { 7 | set ret {} 8 | catch { 9 | set fd [open $fname] 10 | set ret [read $fd] 11 | close $fd 12 | } 13 | return $ret 14 | } 15 | 16 | proc print_tree {node {indent 0}} { 17 | if {[$node tag]=="text"} { 18 | if {[regexp {^ *$} [$node text]]==0} { 19 | puts -nonewline [string repeat " " $indent] 20 | puts [$node text] 21 | } 22 | } else { 23 | puts -nonewline [string repeat " " $indent] 24 | puts "<[$node tag]>" 25 | for {set i 0} {$i < [$node nChildren]} {incr i} { 26 | print_tree [$node child $i] [expr $indent+2] 27 | } 28 | puts -nonewline [string repeat " " $indent] 29 | puts "" 30 | } 31 | } 32 | 33 | html .h 34 | .h parse [readFile [lindex $argv 0]] 35 | .h tree build 36 | set root [.h tree root] 37 | print_tree $root 38 | 39 | exit 40 | 41 | 42 | -------------------------------------------------------------------------------- /tests/vertical_align.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 17 | 18 | 19 | 20 |
21 |       .sub   {vertical-align: sub ; color: red}
22 |       .super {vertical-align: super ; color: red}
23 | 
24 |       .percent50  {vertical-align: 50% ; color: green}
25 |       .bigfont    {font-size: 1cm}
26 | 
27 |       .drop1cm    {vertical-align: -1cm ; color: blue}
28 |       .raise1cm   {vertical-align: 1cm ; color: blue}
29 |     
30 | 31 |
32 |

33 | Smoke test: This paragraph contains superscript 34 | and subscript text. The subscript text in the 35 | previous sentence should cause the following line to shift down 36 | a little to make room. Fill this paragraph up with text so that 37 | this is more obvious. Fill this paragraph up with text so that 38 | this is more obvious. Fill this paragraph up with text so that 39 | this is more obvious. 40 |

41 | 42 |
43 |

44 | Test for percentage values of vertical-align. Both the green 45 | elements in this paragraph have a 46 | vertical-align of 50%. But one element occurs in a 47 | taller line box than the other. Is the 50% 48 | based on the actual height of the line-box? 49 |

50 |

51 | A similar test to the previous. What if the text with the vertical 52 | align is itself rendered in a 53 | really big font? Again, put some filler 54 | text in this paragraph to make the effects easier to observe. Again, put 55 | some filler text in this paragraph to make the effects easier to observe. 56 | Again, put some filler text in this paragraph to make the effects easier 57 | to observe. Again, put some filler text in this paragraph to make the 58 | effects easier to observe. 59 |

60 |

61 | According to Mozilla and Konqueror, percentage values for 62 | vertical align are calculated relative to the line-height of the 63 | inline element itself. Opera calculates relative to the line-height of 64 | the parent block. It seems to me M and K have it right. 65 |

66 | 67 |
68 |

69 | When text is dropped or raised, the size of 70 | the line box should be increased so that the lines do not bleed 71 | into each other. I first noticed this problem with 72 | dropped text. xx xx xx xx xx xx xx xx xx 73 | xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx 74 | xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx 75 | xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx 76 | xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx 77 |

78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /tools/changelog_to_list: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # -*-tcl-*- 3 | # the next line restarts using tclsh \ 4 | exec tclsh "${0}" "${@}" 5 | 6 | #################################### 7 | # Parse a ChangeLog files into a tcl structure. 8 | 9 | proc main {} { 10 | global argv 11 | set in [lindex $argv 0] 12 | set out [cl:parse [read [set fh [open $in r]]][close $fh]] 13 | 14 | #puts [join $out \n] -- Test code 15 | #exit 16 | puts $out 17 | } 18 | 19 | proc cl:parse {data} { 20 | set state unknown 21 | set chunk(date) {} 22 | set chunk(person) {} 23 | set chunk(items) {} 24 | set idata {} 25 | 26 | foreach line [split $data \n] { 27 | if {[cl:parse:chunk_intro $line date person]} { 28 | cl:parse:close_last_item 29 | cl:parse:close_last_chunk 30 | cl:parse:init_chunk $date $person 31 | continue 32 | } 33 | if {[cl:parse:item_line $line data]} { 34 | cl:parse:close_last_item 35 | cl:parse:init_item $data 36 | continue 37 | } 38 | if {[cl:parse:item_followup $line data]} { 39 | cl:parse:add2item $data 40 | continue 41 | } 42 | # ignore all other lines. 43 | } 44 | 45 | cl:parse:close_last_item 46 | cl:parse:close_last_chunk 47 | 48 | return $result 49 | } 50 | 51 | proc cl:parse:chunk_intro {line datevar personvar} { 52 | if {![regexp "^\[^\t \]" $line]} { 53 | return 0 54 | } 55 | 56 | upvar $datevar d $personvar p 57 | 58 | if {[regexp -indices -- {^([0-9]+-[0-9-]+)} $line -> di]} { 59 | foreach {da de} $di break ; # lassign 60 | 61 | regsub -all "\[ \t\]+" [string trim [string range $line $da $de]] { } d 62 | regsub -all "\[ \t\]+" [string trim [string range $line [incr de] end]] { } p 63 | 64 | #puts stderr "$line +--> ($d | $p)" 65 | 66 | return 1 67 | } 68 | 69 | regsub -all "\[\t \]+" $line { } line 70 | 71 | set line [split $line] 72 | set d [join [lrange $line 0 4]] 73 | set p [join [lrange $line 5 end]] 74 | 75 | #puts stderr "$line |--> ($d | $p)" 76 | 77 | return 1 78 | } 79 | 80 | proc cl:parse:close_last_chunk {} { 81 | upvar result r chunk c 82 | 83 | if {$c(date) != {}} { 84 | lappend r [list $c(date) $c(person) $c(items)] 85 | set c(date) {} 86 | set c(person) {} 87 | set c(items) {} 88 | 89 | } 90 | return 91 | } 92 | 93 | proc cl:parse:init_chunk {date person} { 94 | upvar chunk c 95 | set c(date) $date 96 | set c(person) $person 97 | set c(items) {} 98 | return 99 | } 100 | 101 | proc cl:parse:item_line {line itemvar} { 102 | if {![regexp "^\[\t \]+\\*" $line]} { 103 | return 0 104 | } 105 | 106 | upvar $itemvar i 107 | 108 | set line [string trimleft [string trimright $line] "\t *"] 109 | set i $line 110 | return 1 111 | } 112 | 113 | if {0} { 114 | return 1 115 | } 116 | 117 | proc cl:parse:close_last_item {} { 118 | upvar chunk c idata i 119 | 120 | if {$i != {}} { 121 | set ke [string first : $i] 122 | if {$ke < 0} { 123 | set ke -1 ; # No key at all, pure comment 124 | } 125 | 126 | set k [string trim [string range $i 0 [incr ke -1]]] 127 | set co [string trim [string range $i [incr ke 2] end]] 128 | 129 | lappend c(items) [list $k $co] 130 | set i {} 131 | 132 | } 133 | return 134 | } 135 | 136 | proc cl:parse:init_item {comment} { 137 | upvar idata i 138 | set i $comment 139 | return 140 | } 141 | 142 | proc cl:parse:item_followup {line commentvar} { 143 | upvar $commentvar c 144 | 145 | set line [string trim $line] 146 | if {$line == {}} { 147 | return 0 148 | } 149 | 150 | set c $line 151 | return 1 152 | } 153 | 154 | proc cl:parse:add2item {comment} { 155 | upvar idata i 156 | append i " $comment" 157 | } 158 | 159 | ########################################################## 160 | 161 | main 162 | exit 0 163 | -------------------------------------------------------------------------------- /tools/check_manifest: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/tclsh 2 | # -*- tcl -*- 3 | # check the manifest against the current contents of the directory 4 | 5 | set manifest [lindex $argv 0] 6 | 7 | rename file ori_file 8 | proc file {name} { 9 | global files 10 | set files($name) 1 11 | if {! [ori_file exists $name]} { 12 | puts stdout "missing: $name" 13 | } 14 | } 15 | 16 | # read manifest and check existence of all listed files 17 | source $manifest 18 | 19 | 20 | # now backwards: find all files and check 21 | # for files not listed in the manifest 22 | 23 | set list [exec find . -print] 24 | regsub -all "\n" $list { } list 25 | 26 | foreach f $list { 27 | if {[catch {set files($f)}]} { 28 | puts stdout "new: $f" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tools/crontab.sourceforge: -------------------------------------------------------------------------------- 1 | # 2 | # (c) 2001, Andreas Kupries 3 | # 4 | # Hourly cron job to regenerate the dynamic parts of the 5 | # memchan website. 6 | # 7 | 8 | 28 * * * * /home/groups/m/me/memchan/tools/htdocs_refresh 9 | 17 6 * * * /home/groups/m/me/memchan/tools/watch_cvs 10 | -------------------------------------------------------------------------------- /tools/getpage.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** This is a simple program used to retrieve an HTML document using 3 | ** HTTP. The program also fetches all images that the document 4 | ** references. 5 | */ 6 | #include 7 | #include 8 | #include "getpage.h" 9 | 10 | #define stricmp strcasecmp 11 | 12 | 13 | /* 14 | ** Each image to be loaded is an instance of the following structure. 15 | */ 16 | typedef struct Image Image; 17 | struct Image { 18 | char *zUrl; /* The URL for this image */ 19 | char *zLocal; /* The local filename */ 20 | Image *pNext; /* Next in a list of them all */ 21 | }; 22 | 23 | static FILE *html; /* Html output to this file. */ 24 | static int nImage = 0; /* Number of images loaded so far */ 25 | static Image *pImage; /* List of all images */ 26 | static global_nErr = 0; /* System wide errors */ 27 | static char baseUrl[1000];/* The base URL */ 28 | static int quiet = 0; /* The quiet flag */ 29 | 30 | /* 31 | ** Make sure the given URL is loaded as a local file. Return the 32 | ** name of the local file. 33 | */ 34 | static char *GetImage(char *zUrl){ 35 | Image *p; 36 | for(p=pImage; p; p=p->pNext){ 37 | if( strcmp(p->zUrl,zUrl)==0 ){ 38 | return p->zLocal; 39 | } 40 | } 41 | p = malloc( sizeof(*p) + strlen(zUrl) + 100 ); 42 | p->zUrl = (char*)&p[1]; 43 | strcpy(p->zUrl, zUrl); 44 | p->zLocal = &p->zUrl[strlen(zUrl)+1]; 45 | sprintf(p->zLocal,"image%d", ++nImage); 46 | p->pNext = pImage; 47 | pImage = p; 48 | HttpFetch(zUrl, p->zLocal, quiet, 0, 0); 49 | return p->zLocal; 50 | } 51 | 52 | /* 53 | ** Print a usage comment and exit 54 | */ 55 | void usage(char *argv0){ 56 | fprintf(stderr,"Usage: %s URL\n",argv0); 57 | exit(1); 58 | } 59 | 60 | /* 61 | ** Handle anything that isn't markup 62 | */ 63 | static void WordHandler(const char *zText, void *notUsed){ 64 | fprintf(html, zText); 65 | } 66 | 67 | /* 68 | ** Handle all markup that we don't care about. 69 | */ 70 | static void DefaultMarkup(int argc, const char **argv, void *notUsed){ 71 | int i; 72 | fprintf(html,"<%s",argv[0]); 73 | for(i=1; i"); 77 | } 78 | 79 | /* 80 | ** Handler for markup 81 | */ 82 | static void ImageMarkup(int argc, const char **argv, void *notUsed){ 83 | int i; 84 | for(i=1; i (%s)\n",baseUrl, azUrl[0], zResolved); 93 | } 94 | argv[i+1] = GetImage(zResolved); 95 | /* printf("%s -> %s -> argv[i+1]\n",argv[i+1], zResolved); */ 96 | free(zResolved); 97 | } 98 | } 99 | DefaultMarkup(argc, argv, 0); 100 | } 101 | 102 | /* 103 | ** Handler for markup 104 | */ 105 | static void BaseMarkup(int argc, const char **argv, void *notUsed){ 106 | int i; 107 | for(i=1; i $destination" 25 | exec /usr/bin/wget -q -O $destination [set $urlvar] >/dev/null 26 | } 27 | 28 | puts "Remembering time --> state/sn.time" 29 | puts [set fh [open state/sn.time w]] $now; close $fh 30 | 31 | ### Future ### Edit the delivered HTML to fit them better into our site. 32 | ### Done inside of the page generation templates ! 33 | 34 | exit 35 | -------------------------------------------------------------------------------- /tools/htdocs_refresh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd `dirname $0`/../htdocs 4 | 5 | out=$HOME/logs/crontab 6 | mkdir -p `dirname $out` 7 | 8 | ../tools/htdocs_get_sf_stats >> $out 2>&1 9 | ../tools/htdocs_regen >> $out 2>&1 10 | 11 | exit 12 | -------------------------------------------------------------------------------- /tools/htdocs_regen: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Assume call with pwd = 'htdocs'. 4 | 5 | for i in `ls raw/*.exp` 6 | do 7 | echo $i '-->' `basename $i .exp`.html 8 | ../tools/expand -rules ../tools/rules/memchan $i > `basename $i .exp`.html 9 | done 10 | 11 | rm index.php 12 | ln -s index.html index.php 13 | -------------------------------------------------------------------------------- /tools/htdocs_setup: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Called in response to changes in the cvs repository of memchan 4 | # Assumes that the changed files were already retrieved. Uses them to 5 | # regenerate the whole website. 6 | 7 | # pwd = /home/groups/m/me/memchan/ 8 | 9 | # Remove old temporary information. 10 | 11 | rm -rf doc 12 | mkdir doc 13 | 14 | cp -r memchan/doc/* doc/ 15 | cp -r memchan/htdocs/* htdocs/ 16 | 17 | # Regenerate the external representatons of all manpages, and the site 18 | # itself. At last generate bundles of the documentation for download. 19 | 20 | out=$HOME/logs/crontab 21 | mkdir -p `dirname $out` 22 | rm $out ; touch $out 23 | 24 | cd doc ; ../tools/manpage_regen >>$out ; cd .. 25 | cd htdocs ; ../tools/htdocs_refresh ; cd .. 26 | 27 | tar cf - doc/*.n | gzip -9 > memchan.nroff.tar.gz 28 | tar cf - doc/*.n | bzip2 > memchan.nroff.tar.bz2 29 | zip memchan.nroff.tar.zip doc/*.n > /dev/null 30 | tar cf - doc/*.html | gzip -9 > memchan.html.tar.gz 31 | tar cf - doc/*.html | bzip2 > memchan.html.tar.bz2 32 | zip memchan.html.tar.zip doc/*.html > /dev/null 33 | tar cf - doc/*.tmml | gzip -9 > memchan.tmml.tar.gz 34 | tar cf - doc/*.tmml | bzip2 > memchan.tmml.tar.bz2 35 | zip memchan.tmml.tar.zip doc/*.tmml > /dev/null 36 | 37 | mkdir -p htdocs/doc 38 | mv memchan.* htdocs/doc/ 39 | 40 | (sleep 5 ; cp -r memchan/tools/* tools/) & 41 | 42 | exit 43 | -------------------------------------------------------------------------------- /tools/importicons.tcl: -------------------------------------------------------------------------------- 1 | package require base64 2 | 3 | set dir /Users/dan/tmp/tango-icon-theme-0.8.1/32x32/ 4 | 5 | set A(hv3_previmg) actions/go-previous.png 6 | set A(hv3_nextimg) actions/go-next.png 7 | set A(hv3_stopimg) actions/process-stop.png 8 | set A(hv3_newimg) actions/tab-new.png 9 | set A(hv3_reloadimg) actions/view-refresh.png 10 | set A(hv3_homeimg) actions/go-home.png 11 | set A(hv3_bugimg) actions/mail-message-new.png 12 | 13 | puts "proc color_icons {} {" 14 | foreach {key value} [array get A] { 15 | set fd [open [file join $dir $value]] 16 | fconfigure $fd -translation binary -encoding binary 17 | set data [read $fd] 18 | close $fd 19 | 20 | puts "image create photo $key -data {" 21 | puts [base64 -mode encode $data] 22 | puts "}" 23 | } 24 | puts "}" 25 | -------------------------------------------------------------------------------- /tools/install-sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # install - install a program, script, or datafile 5 | # This comes from X11R5; it is not part of GNU. 6 | # 7 | # $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ 8 | # 9 | # This script is compatible with the BSD install script, but was written 10 | # from scratch. 11 | # 12 | 13 | 14 | # set DOITPROG to echo to test this script 15 | 16 | # Don't use :- since 4.3BSD and earlier shells don't like it. 17 | doit="${DOITPROG-}" 18 | 19 | 20 | # put in absolute paths if you don't have them in your path; or use env. vars. 21 | 22 | mvprog="${MVPROG-mv}" 23 | cpprog="${CPPROG-cp}" 24 | chmodprog="${CHMODPROG-chmod}" 25 | chownprog="${CHOWNPROG-chown}" 26 | chgrpprog="${CHGRPPROG-chgrp}" 27 | stripprog="${STRIPPROG-strip}" 28 | rmprog="${RMPROG-rm}" 29 | 30 | instcmd="$mvprog" 31 | chmodcmd="" 32 | chowncmd="" 33 | chgrpcmd="" 34 | stripcmd="" 35 | rmcmd="$rmprog -f" 36 | mvcmd="$mvprog" 37 | src="" 38 | dst="" 39 | 40 | while [ x"$1" != x ]; do 41 | case $1 in 42 | -c) instcmd="$cpprog" 43 | shift 44 | continue;; 45 | 46 | -m) chmodcmd="$chmodprog $2" 47 | shift 48 | shift 49 | continue;; 50 | 51 | -o) chowncmd="$chownprog $2" 52 | shift 53 | shift 54 | continue;; 55 | 56 | -g) chgrpcmd="$chgrpprog $2" 57 | shift 58 | shift 59 | continue;; 60 | 61 | -s) stripcmd="$stripprog" 62 | shift 63 | continue;; 64 | 65 | *) if [ x"$src" = x ] 66 | then 67 | src=$1 68 | else 69 | dst=$1 70 | fi 71 | shift 72 | continue;; 73 | esac 74 | done 75 | 76 | if [ x"$src" = x ] 77 | then 78 | echo "install: no input file specified" 79 | exit 1 80 | fi 81 | 82 | if [ x"$dst" = x ] 83 | then 84 | echo "install: no destination specified" 85 | exit 1 86 | fi 87 | 88 | 89 | # If destination is a directory, append the input filename; if your system 90 | # does not like double slashes in filenames, you may need to add some logic 91 | 92 | if [ -d $dst ] 93 | then 94 | dst="$dst"/`basename $src` 95 | fi 96 | 97 | # Make a temp file name in the proper directory. 98 | 99 | dstdir=`dirname $dst` 100 | dsttmp=$dstdir/#inst.$$# 101 | 102 | # Move or copy the file name to the temp name 103 | 104 | $doit $instcmd $src $dsttmp 105 | 106 | # and set any options; do chmod last to preserve setuid bits 107 | 108 | if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi 109 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi 110 | if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi 111 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi 112 | 113 | # Now rename the file to the real destination. 114 | 115 | $doit $rmcmd $dst 116 | $doit $mvcmd $dsttmp $dst 117 | 118 | 119 | exit 0 120 | -------------------------------------------------------------------------------- /tools/maketokens.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olebole/tkhtml3/e6bf0ab04a8cf967452283be23533154c1982978/tools/maketokens.sh -------------------------------------------------------------------------------- /tools/maketokens.tcl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This script is a replacement for the maketokens.sh shell script. 3 | # The shell script required GNU awk. This script should work with 4 | # any old version of tclsh. 5 | # \ 6 | exec tclsh "$0" ${1+"$@"} 7 | 8 | if {$argc!=1} { 9 | puts stderr "Usage: $argv0 tokenlist.txt" 10 | exit 1 11 | } 12 | if {[catch {open [lindex $argv 0] r} f]} { 13 | puts stderr "$argv0: can not open \"[lindex $argv 0]\": $f" 14 | exit 1 15 | } 16 | set tokenlist {} 17 | while {![eof $f]} { 18 | set line [string trim [gets $f]] 19 | if {$line==""} continue 20 | if {[string index $line 0]=="#"} continue 21 | if {[llength $line]!=2 && [llength $line]!=3} continue 22 | lappend tokenlist [lindex $line 0] 23 | lappend tokenlist [lindex $line 1] 24 | lappend tokenlist [lindex $line 2] 25 | } 26 | close $f 27 | 28 | # Open the two files that will be generated. 29 | set h_file [open htmltokens2.h w] 30 | set c_file [open htmltokens.c w] 31 | 32 | set warning { 33 | /* 34 | * DO NOT EDIT! 35 | * 36 | * The code in this file was automatically generated. See the files 37 | * src/tokenlist.txt and tools/maketokens.tcl from the tkhtml source 38 | * distribution. 39 | */ 40 | } 41 | puts $h_file $warning 42 | puts $c_file $warning 43 | 44 | puts $h_file { 45 | #define Html_Text 1 46 | #define Html_Space 2 47 | #define Html_Unknown 3 48 | #define Html_Block 4 49 | #define HtmlIsMarkup(X) ((X)->base.type>Html_Block) 50 | } 51 | 52 | set count 5 53 | set fmt {#define %-20s %d} 54 | 55 | foreach {name start end} $tokenlist { 56 | set upr [string toupper $name] 57 | puts $h_file [format $fmt Html_$upr $count] 58 | incr count 59 | if {$end!=""} { 60 | puts $h_file [format $fmt Html_End$upr $count] 61 | incr count 62 | } 63 | } 64 | 65 | puts $h_file [format $fmt Html_TypeCount [expr $count-1]] 66 | puts $h_file "#define HTML_MARKUP_HASH_SIZE [expr $count+11]" 67 | puts $h_file "#define HTML_MARKUP_COUNT [expr $count-5]" 68 | puts $c_file "HtmlTokenMap HtmlMarkupMap\[\] = {" 69 | 70 | set fmt " { %-15s %-25s %-30s }," 71 | 72 | foreach {name start end} $tokenlist { 73 | set upr [string toupper $name] 74 | set nm "\"$name\"," 75 | set val Html_$upr, 76 | if {$start=="0"} { 77 | set size "0," 78 | } else { 79 | set size "sizeof($start)," 80 | } 81 | puts $c_file [format $fmt $nm $val $size] 82 | if {$end==""} continue 83 | set nm "\"/$name\"," 84 | set val Html_End$upr, 85 | if {$end=="0"} { 86 | set size "0," 87 | } else { 88 | set size "sizeof($end)," 89 | } 90 | puts $c_file [format $fmt $nm $val $size] 91 | } 92 | 93 | puts $c_file "};" 94 | 95 | close $c_file 96 | close $h_file 97 | -------------------------------------------------------------------------------- /tools/manpage_clean: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Assume call with pwd = 'doc'. 3 | # Remove all files generated by 'manpage_regen' 4 | 5 | rm ../tools/rules/manpages 6 | rm *.n 7 | rm *.html 8 | rm ../htdocs/mp.*.html 9 | -------------------------------------------------------------------------------- /tools/manpage_regen: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Assume call with pwd = 'doc'. 4 | 5 | # Phase I ... List known manpages ... 6 | 7 | rm ../tools/rules/manpages 8 | touch ../tools/rules/manpages 9 | 10 | for i in `ls *.man` 11 | do 12 | echo $i '-->' manpages 13 | ../tools/expand -rules ../tools/rules/manpage.list $i >> ../tools/rules/manpages 14 | done 15 | 16 | # Phase II .. Generate true output ... 17 | 18 | for i in `ls *.man` 19 | do 20 | echo $i '-->' `basename $i .man`.n 21 | ../tools/expand -rules ../tools/rules/manpage.nroff $i > `basename $i .man`.n 22 | 23 | echo $i '-->' `basename $i .man`.html 24 | ../tools/expand -rules ../tools/rules/manpage.html $i > `basename $i .man`.html 25 | 26 | echo $i '-->' `basename $i .man`.html 27 | ../tools/expand -rules ../tools/rules/manpage.html.site $i > ../htdocs/mp.`basename $i .man`.html 28 | 29 | echo $i '-->' `basename $i .man`.tmml 30 | ../tools/expand -rules ../tools/rules/manpage.tmml $i > `basename $i .man`.tmml 31 | done 32 | -------------------------------------------------------------------------------- /tools/mkinstalldirs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | # Author: Noah Friedman 4 | # Created: 1993-05-16 5 | # Last modified: 1994-03-25 6 | # Public domain 7 | 8 | errstatus=0 9 | 10 | for file in ${1+"$@"} ; do 11 | set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` 12 | shift 13 | 14 | pathcomp= 15 | for d in ${1+"$@"} ; do 16 | pathcomp="$pathcomp$d" 17 | case "$pathcomp" in 18 | -* ) pathcomp=./$pathcomp ;; 19 | esac 20 | 21 | if test ! -d "$pathcomp"; then 22 | echo "mkdir $pathcomp" 1>&2 23 | mkdir "$pathcomp" || errstatus=$? 24 | fi 25 | 26 | pathcomp="$pathcomp/" 27 | done 28 | done 29 | 30 | exit $errstatus 31 | 32 | # mkinstalldirs ends here 33 | -------------------------------------------------------------------------------- /tools/nroff_regen: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Assume call with pwd = 'doc'. 4 | 5 | # Phase I ... List known manpages ... 6 | 7 | rm -f ../tools/rules/manpages 8 | touch ../tools/rules/manpages 9 | 10 | for i in `ls *.man` 11 | do 12 | echo $i '-->' manpages 13 | ../tools/expand -rules ../tools/rules/manpage.list $i >> ../tools/rules/manpages 14 | done 15 | 16 | # Phase II .. Generate true output ... 17 | 18 | for i in `ls *.man` 19 | do 20 | echo $i '-->' `basename $i .man`.n 21 | ../tools/expand -rules ../tools/rules/manpage.nroff $i > `basename $i .man`.n 22 | done 23 | -------------------------------------------------------------------------------- /tools/rules/formatting: -------------------------------------------------------------------------------- 1 | # -*- tcl -*- 2 | # Helper rules for the creation of the memchan website from the .exp files. 3 | # General formatting instructions ... 4 | 5 | proc state {} [list return [file join [pwd] state]] 6 | 7 | proc use_bg {} { 8 | set c [bgcolor] 9 | #puts stderr "using $c" 10 | if {$c == {}} {return ""} 11 | return bgcolor=$c 12 | } 13 | 14 | 15 | proc nbsp {} {return " "} 16 | proc p {} {return

} 17 | proc ptop {} {return "

"} 18 | proc td {} {return ""} 19 | proc trtop {} {return ""} 20 | proc tr {} {return ""} 21 | proc sect {s} {return "$s


"} 22 | proc link {text url} {return "$text"} 23 | proc table {} {return ""} 24 | proc btable {} {return "
"} 25 | proc stable {} {return "
"} 26 | 27 | 28 | proc tcl_cmd {cmd} {return "\[$cmd]"} 29 | proc wget {url} {exec /usr/bin/wget -q -O - $url 2>/dev/null} 30 | 31 | proc url {tag text url} { 32 | set body { 33 | switch -exact -- $what { 34 | link {return {%text%}} 35 | text {return {%text%}} 36 | url {return {%url%}} 37 | } 38 | } 39 | proc $tag {{what link}} [string map [list %text% $text %url% $url] $body] 40 | } 41 | 42 | proc img {tag alt img} { 43 | proc $tag {} [list return "\"$alt\""] 44 | } 45 | 46 | proc header {title} { 47 | proc pagetitle {} [list return $title] 48 | return "[sfproject] @ SourceForge : $title" 49 | } 50 | 51 | proc trailer {} { 52 | return "
[table][tr]
[copyright][me]
Last update at [clock format [clock seconds]]
" 53 | } 54 | 55 | proc protect {text} {return [string map [list & "&" < "<" > ">"] $text]} 56 | 57 | proc get_changelog {} { 58 | set cl [exec [file join [here] .. changelog_to_list] [file join [pwd] .. memchan ChangeLog]] 59 | proc get_changelog {} [list return $cl] 60 | return $cl 61 | } 62 | 63 | proc changelog {} { 64 | set cl [get_changelog] 65 | set html "
    " 66 | 67 | foreach chunk $cl { 68 | foreach {date person items} $chunk break ; # lassign 69 | append html "

  • [protect $date]

    [protect $person] ...


    [p][changelog_items $items][p]\n" 70 | } 71 | 72 | return $html
73 | } 74 | 75 | proc changelog_items {items} { 76 | set dlopen 0 77 | set onlykey 0 78 | 79 | set html "" 80 | foreach item $items { 81 | set key [set com {}] 82 | foreach {key com} $item break 83 | 84 | if {$key != {}} { 85 | if {!$dlopen} { 86 | if {$onlykey} { 87 | append html [p] 88 | set onlykey 0 89 | } 90 | append html
\n 91 | } 92 | set dlopen 1 93 | 94 | append html
[protect $key]
95 | if {$com != {}} { 96 | append html
[protect $com]
\n 97 | } 98 | } else { 99 | if {$com != {}} { 100 | if {$dlopen} {append html
[p]\n} 101 | set dlopen 0 102 | append html [protect $com] 103 | set onlykey 1 104 | } 105 | } 106 | 107 | } 108 | if {$dlopen} {append html \n} 109 | return $html 110 | } 111 | 112 | proc news {} { 113 | set nfile [file join [state] news] 114 | set data [read [set fh [open $nfile r]]][close $fh] 115 | return [string trim $data]\n 116 | } 117 | 118 | proc stats {} { 119 | set nfile [file join [state] statistics] 120 | set data [read [set fh [open $nfile r]]][close $fh] 121 | 122 | set data [string trim $data] 123 | 124 | regsub -all {BGCOLOR="[^"]*"} $data "[use_bg]" data 125 | regsub -all {bgcolor="[^"]*"} $data "[use_bg]" data 126 | 127 | return [string trim $data]\n 128 | } 129 | -------------------------------------------------------------------------------- /tools/rules/manpage.api: -------------------------------------------------------------------------------- 1 | # -*- tcl -*- 2 | # rules/manpage.api 3 | # 4 | # (c) 2001 Andreas Kupries 5 | 6 | # Defines the procedures a manpage rules file has to support for good 7 | # manpages. The procedures here return errors. 8 | 9 | proc __ {command} {return "return -code error \"Unimplemented command $command\""} 10 | ################################################################ 11 | 12 | proc manpage_begin {command section version module shortdesc description} [__ manpage] 13 | 14 | proc manpage_end {} [__ manpage_end] 15 | proc require {pkg {version {}}} [__ require] 16 | proc description {} [__ description] 17 | proc section {name} [__ section] 18 | proc para {} [__ para] 19 | proc list_begin {what} [__ list_begin] 20 | proc list_end {} [__ list_end] 21 | proc lst_item {{text {}}} [__ lst_item] 22 | proc call {cmd args} [__ call] 23 | proc bullet {} [__ bullet] 24 | proc enum {} [__ enum] 25 | proc see_also {args} [__ see_also] 26 | proc keywords {args} [__ keywords] 27 | proc nl {} [__ nl] 28 | proc arg {text} [__ arg] 29 | proc cmd {text} [__ cmd] 30 | proc opt {text} [__ opt] 31 | proc emph {text} [__ emph] 32 | proc strong {text} [__ strong] 33 | 34 | ################################################################ 35 | rename __ {} 36 | -------------------------------------------------------------------------------- /tools/rules/manpage.api.spec: -------------------------------------------------------------------------------- 1 | Specification of the API a manpage/tcl has to conform to so that rule 2 | files are able to process it properly. 3 | ====================================================================== 4 | 5 | The available commands are listed in the file 'manpage.api' too. The 6 | definitions in that file return errors. They should be loaded before 7 | the actual definitions so that usage of an unimplemented command 8 | causes a proper error message. 9 | 10 | ---------------------------------------------------------------------- 11 | 12 | The main commands are "manpage_begin", "manpage_end" and 13 | "description". All three are required. The first two are the first and 14 | last commands in a manpage. Neither text nor other commands may 15 | precede "manpage_begin" nor follow "manpage_end". The command 16 | "description" separates header and body of the manpage and may not be 17 | omitted. 18 | 19 | The only allowed text between "manpage_begin" and "description" is the 20 | command "require". Other commands or normal text are not 21 | permitted. "require" is used to list the packages the described 22 | command(s) depend(s) on for its operation. This list can be empty. 23 | 24 | After "description" text all other commands are allowed. The text can 25 | be separated into highlevel blocks using named "section"s. Each block 26 | can be further divided into paragraphs via "para". 27 | 28 | The commands "see_also" and "keywords" define whole sections named 29 | "SEE ALSO" and "KEYWORDS". They can occur everywhere in the manpage 30 | but making them the last section is the usual thing to do. They can be 31 | omitted. 32 | 33 | There are four commands available to mark words, "arg", "cmd", "emph" 34 | and "strong". The first two are used to mark words as command 35 | arguments and as command names. The other two are visual markup to 36 | emphasize words. 37 | 38 | Another set of four commands is available to construct (nested) 39 | lists. These are "list_begin", "list_end", "lst_item" and "call". The 40 | first two of these begin and end a list respectively. The argument to 41 | the first command is either 'bullet' or 'enum' denoting the type of 42 | the list (unordered vs. ordered). The third command starts list 43 | items. Each item has some text directly associated with the bullet but 44 | the major bulk of the item is the text following the item until the 45 | next list command. 46 | 47 | The last list command, "call" is special. It is used to describe the 48 | syntax of a command and its arguments. It should not only cause the 49 | appropriate markup of a list item at its place but also add the syntax 50 | to the table of contents (synopsis) if supported by the output format 51 | in question. nroff and HTML for example do. A logical format like TMML 52 | doesn't. 53 | 54 | 55 | I currently use the ?...? notation in my example to mark optional 56 | arguments. This should better be done through a command. This command 57 | is "opt". _Not_ "optarg" as it may span several arguments. 58 | 59 | ====================================================================== 60 | 61 | [list_begin "bullet"] -- 62 | Starts a bulleted (unordered) list. 63 | [bullet] -- 64 | Starts a new item in a bulleted list. 65 | 66 | [list_begin "enum"] -- 67 | Starts a numbered list. 68 | [enum] -- 69 | Starts a new item in a numbered (ordered) list. Successive list 70 | items are numbered [1], [2], ... etc. 71 | 72 | [list_begin "definitions"] -- 73 | Starts a definition list. 74 | [lst_item _text_] -- 75 | Starts a new entry in a definition list. _text_ is 76 | the list item header. 77 | 78 | [list_begin commands] -- 79 | Starts a command list, for describing the syntax of a 80 | command and its arguments. 81 | [call _cmd_ ? _arg_ _arg_ ... ? ] -- 82 | Starts an entry in a command list. In addition, adds the 83 | command syntax summary "_cmd_ _args_..." to the SYNOPSIS section. 84 | -------------------------------------------------------------------------------- /tools/rules/manpage.list: -------------------------------------------------------------------------------- 1 | # -*- tcl -*- 2 | # rules/manpage.api 3 | # 4 | # (c) 2001 Andreas Kupries 5 | 6 | # Defines the procedures a manpage rules file has to support for good 7 | # manpages. The procedures here return errors. 8 | 9 | ################################################################ 10 | 11 | proc manpage_begin {command section version module shortdesc description} { 12 | puts [list manpage mem/mp/$command $command mp.$command.html] 13 | setoutput nul 14 | return 15 | } 16 | 17 | ################################################################ 18 | 19 | proc manpage_end {} {} 20 | proc require {pkg {version {}}} {} 21 | proc description {} {} 22 | proc section {name} {} 23 | proc para {} {} 24 | proc call {cmd args} {} 25 | proc list_begin {what} {} 26 | proc list_end {} {} 27 | proc lst_item {text} {} 28 | proc see_also {args} {} 29 | proc keywords {args} {} 30 | proc nl {} {} 31 | proc bullet {} {} 32 | proc enum {} {} 33 | proc arg {text} {} 34 | proc cmd {text} {} 35 | proc emph {text} {} 36 | proc strong {text} {} 37 | proc setx {v string} {} 38 | proc appendx {v string} {} 39 | proc opt {text} {} 40 | 41 | ################################################################ 42 | 43 | -------------------------------------------------------------------------------- /tools/rules/manpage.tmml: -------------------------------------------------------------------------------- 1 | # -*- tcl -*- 2 | # 3 | # $Id: manpage.tmml,v 1.1 2002/12/17 18:31:05 drh Exp $ 4 | # 5 | # [expand] definitions to convert a tcl based manpage definition 6 | # into TMML. 7 | # 8 | # Copyright (C) 2001 Joe English . 9 | # Freely redistributable. 10 | # 11 | # See also 12 | # 13 | # BUGS: 14 | # + XML markup characters in [expand] macro arguments 15 | # are not properly escaped. (Plain text outside of 16 | # [...] is handled correctly however.) 17 | # 18 | # + Text must be preceded by [para] or one of the 19 | # list item macros, or else the output will be invalid. 20 | # 21 | ###################################################################### 22 | 23 | proc here {} [list return [file dirname [info script]]] 24 | source [file join [here] manpage.api] 25 | source [file join [here] xmlrules.tcl] 26 | 27 | ###################################################################### 28 | # Utilities. 29 | # 30 | 31 | proc NOP {args} { } ;# do nothing 32 | proc NYI {{message {}}} { 33 | return -code error [append $message " Not Yet Implemented"] 34 | } 35 | 36 | set this [file tail [info script]] 37 | proc provenance {} { 38 | return "Generated from [expand::expfile] by EXPAND with $::this" 39 | } 40 | 41 | ###################################################################### 42 | # Expand hooks. 43 | # 44 | proc init_hook {} { setpasses 2 } 45 | proc raw_text_hook {text} { xmlEscape $text } 46 | proc begin_hook {} { setPassProcs [expand::exppass] } 47 | 48 | ###################################################################### 49 | # Conversion specification. 50 | # 51 | # Two-pass processing. The first pass collects text for the 52 | # SYNOPSIS, SEE ALSO, and KEYWORDS sections, and the second pass 53 | # produces output. 54 | # 55 | 56 | holdBuffers synopsis see_also keywords 57 | 58 | proc nl {} { emptyElement br } 59 | proc arg {text} { wrap $text m } 60 | proc cmd {text} { wrap $text cmd } 61 | proc emph {text} { wrap $text emph } 62 | proc strong {text} { wrap $text emph } 63 | proc opt {text} { wrap $text o } 64 | 65 | pass 1 manpage_begin {args} NOP 66 | pass 2 manpage_begin {command section version module shortdesc description} { 67 | sequence \ 68 | [xmlComment [provenance]] \ 69 | [start manpage \ 70 | id [file root [file tail [expand::expfile]]] \ 71 | cat cmd \ 72 | title $command \ 73 | version $version \ 74 | package $module] \ 75 | [start namesection] \ 76 | [wrap $command name] \ 77 | [wrap $description desc] \ 78 | [end namesection] \ 79 | ; 80 | } 81 | 82 | pass 1 description {} NOP 83 | pass 2 description {} { 84 | sequence \ 85 | [xmlContext manpage] \ 86 | [wrapLines? [held synopsis] syntax synopsis] \ 87 | [start section] \ 88 | [wrap "DESCRIPTION" title] \ 89 | ; 90 | } 91 | 92 | pass 1 section {name} NOP 93 | pass 2 section {name} { 94 | sequence \ 95 | [xmlContext manpage] \ 96 | [start section] \ 97 | [wrap [string toupper $name] title] \ 98 | ; 99 | } 100 | pass 1 para {} NOP 101 | pass 2 para {} { sequence [xmlContext section] [start p] } 102 | 103 | array set listTypes { 104 | bullet ul 105 | enum ol 106 | definitions dl 107 | } 108 | pass 1 list_begin {what} NOP 109 | pass 1 list_end {} NOP 110 | pass 2 list_begin {what} { 111 | sequence \ 112 | [xmlContext {section dd li}] \ 113 | [start $::listTypes($what)] \ 114 | ; 115 | } 116 | pass 2 list_end {} { 117 | sequence \ 118 | [xmlContext {ul ol dl}] \ 119 | [end] \ 120 | ; 121 | } 122 | 123 | pass 1 bullet {} NOP 124 | pass 1 enum {} NOP 125 | pass 2 bullet {} { sequence [xmlContext {ul ol}] [start li] } 126 | pass 2 enum {} { sequence [xmlContext {ul ol}] [start li] } 127 | 128 | pass 1 lst_item {text} NOP 129 | pass 2 lst_item {text} { 130 | sequence \ 131 | [xmlContext dl] \ 132 | [start dle] \ 133 | [wrap $text dt] \ 134 | [start dd] \ 135 | ; 136 | } 137 | 138 | pass 1 call {cmd args} { hold synopsis [formatCall $cmd $args] } 139 | pass 2 call {cmd args} { 140 | sequence \ 141 | [xmlContext dl] \ 142 | [start dle] \ 143 | [wrap [formatCall $cmd $args] dt] \ 144 | [start dd] \ 145 | ; 146 | } 147 | proc formatCall {cmd arglist} { 148 | return "$cmd [join $arglist { }]" ;# OR: wrap "..." command 149 | } 150 | 151 | pass 1 require {pkg {version {}}} { 152 | hold synopsis [formatRequire $pkg $version] 153 | } 154 | pass 2 require {pkg {version {}}} NOP 155 | proc formatRequire {pkg version} { 156 | return "package require [wrap $pkg package] [wrap? $version l]" 157 | } 158 | 159 | pass 1 see_also {args} { holdWrapped see_also $args ref } 160 | pass 1 keywords {args} { holdWrapped keywords $args keyword } 161 | pass 2 see_also {args} NOP 162 | pass 2 keywords {args} NOP 163 | 164 | # holdWrapped -- 165 | # Common factor of [see_also] and [keywords]. 166 | # 167 | proc holdWrapped {buffer arglist gi} { 168 | foreach arg $arglist { hold $buffer [wrap $arg $gi] } 169 | return 170 | } 171 | 172 | pass 1 manpage_end {} NOP 173 | pass 2 manpage_end {} { 174 | sequence \ 175 | [xmlContext manpage] \ 176 | [wrapLines? [held see_also] seealso] \ 177 | [wrapLines? [held keywords] keywords] \ 178 | [end manpage] \ 179 | ; 180 | } 181 | 182 | #*EOF* 183 | 184 | -------------------------------------------------------------------------------- /tools/rules/memchan: -------------------------------------------------------------------------------- 1 | # -*- tcl -*- 2 | # configures the site policy with some variant information, like colors. 3 | 4 | # Rules for the creation of the memchan website from the .exp files. 5 | 6 | proc here {} [list return [file dirname [info script]]] 7 | 8 | source [file join [here] site] ; # load policy, defines template interface too. 9 | source [file join [here] references] ; # load references used by the site. 10 | source [file join [here] manpages] ; # load list of known manpages. 11 | 12 | 13 | proc sfproject {} {return Memchan} 14 | proc sfgroup {} {return 34191} 15 | 16 | proc bgcolor {} {return lightsteelblue} 17 | proc hlcolor {} {return lightyellow} 18 | 19 | proc author {} {return "\"Andreas Kupries,,,\""} 20 | proc border {} {return border=0} 21 | 22 | # Declare the pages of this site upfront ... 23 | 24 | sitepage mem/home "Homepage" index.html 25 | sitepage mem/releases "Releases" [releases/url] 26 | sitepage mem/images "Logos" images.html 27 | sitepage mem/anim "Animations" animations.html 28 | sitepage mem/doc "Documentation" documentation.html 29 | sitepage mem/clog "ChangeLog" changelog.html 30 | sitepage mem/copyright "© Disclaimer" disclaimer.html 31 | sitepage mem/event/gen "Event generation" mem_event.html 32 | 33 | # memchan specific commands 34 | 35 | proc mem/latest-release {} { 36 | set nfile [file join [state] latest.release] 37 | foreach {version date} [split [read [set fh [open $nfile r]]][close $fh] \n] break ; # lassign 38 | 39 | set releasepage [wget [releases/url]] 40 | 41 | regexp {release_id=([0-9]+)} $releasepage -> release_id 42 | 43 | return "[link "version $version" [releases/url]&release_id=$release_id] as of $date" 44 | } 45 | 46 | url mc/doc/nroff/gz "Archive" doc/memchan.nroff.tar.gz 47 | url mc/doc/nroff/bz "Archive" doc/memchan.nroff.tar.bz2 48 | url mc/doc/nroff/zip "Archive" doc/memchan.nroff.tar.zip 49 | url mc/doc/html/gz "Archive" doc/memchan.html.tar.gz 50 | url mc/doc/html/bz "Archive" doc/memchan.html.tar.bz2 51 | url mc/doc/html/zip "Archive" doc/memchan.html.tar.zip 52 | url mc/doc/tmml/gz "Archive" doc/memchan.tmml.tar.gz 53 | url mc/doc/tmml/bz "Archive" doc/memchan.tmml.tar.bz2 54 | url mc/doc/tmml/zip "Archive" doc/memchan.tmml.tar.zip 55 | -------------------------------------------------------------------------------- /tools/rules/references: -------------------------------------------------------------------------------- 1 | # -*- tcl -*- 2 | # Helper rules for the creation of the memchan website from the .exp files. 3 | 4 | proc releases/url {} {return http://sourceforge.net/project/showfiles.php?group_id=[sfgroup]} 5 | 6 | img sf/logo "SourceForge Logo" http://sourceforge.net/sflogo.php?group_id=34191 7 | img tcl/logo "Tcl Logo" http://tcl.sourceforge.net/images/logo125.gif 8 | 9 | img mem/logo/520 "Memchan Logo" art/logo520.jpg 10 | img mem/logo/100 "Memchan Logo" art/logo100.gif 11 | img mem/logo/64 "Memchan Logo" art/logo64.gif 12 | img mem/logo/100a "Animated Memchan Logo" art/logo100a.gif 13 | img mem/logo/64a "Animated Memchan Logo" art/logo64a.gif 14 | 15 | url sf/img [sf/logo] http://sourceforge.net 16 | url tcl/sf/img [tcl/logo] http://sourceforge.net/projects/tcl 17 | url tcl/sf/txt Tcl http://sourceforge.net/projects/tcl 18 | url tcl/sf/txt/home "Tcl Homepage" http://sourceforge.net/projects/tcl 19 | url trf/txt Trf http://www.purl.org/net/akupries/soft/trf 20 | url trf/txt/home "Trf Homepage" http://www.purl.org/net/akupries/soft/trf 21 | 22 | url mem/sf/txt "Memchan SF Project" http://sourceforge.net/projects/memchan 23 | url mem/txt Memchan http://www.purl.org/net/akupries/soft/memchan 24 | url mem/txt/old "Old Memchan page" http://www.purl.org/net/akupries/soft/memchan 25 | url mem/txt/old/2 "old Memchan homepage" http://www.purl.org/net/akupries/soft/memchan 26 | 27 | url copyright "©" disclaimer.html 28 | 29 | if {0} { 30 | url mem/images "Logos" images.html 31 | url mem/home "Homepage" index.html 32 | url mem/anim "Animations" animations.html 33 | url mem/releases "Releases" [releases/url] 34 | url mem/doc "Documentation" documentation.html 35 | url mem/clog "ChangeLog" changelog.html 36 | } 37 | 38 | url tcl/foundry "Tcl Foundry" http://sourceforge.net/foundry/tcl-foundry/ 39 | 40 | 41 | url me "Andreas Kupries" http://www.purl.org/net/akupries/ 42 | 43 | ## Future ## Try to make this automatic ... 44 | 45 | url andreas_kupries/home "Andreas Kupries" http://www.purl.org/net/akupries/ 46 | url stevel/home "Steve Landers" http://www.digital-smarties.com/ 47 | 48 | 49 | url jo "John Ousterhout" http://www.scriptics.com/people/john.ousterhout 50 | url jcw "Jean-Claude Wippler" http://www.equi4.com/jcw/ 51 | url tclwiki "Tcl'ers Wiki" http://www.purl.org/tcl/wiki/ 52 | url lvirden "Larry W. Virden" http://www.purl.org/net/lvirden/ 53 | url jan "Jan Nijtmans" http://www.purl.org/net/nijtmans/ 54 | 55 | url tcl/io/fevent "Interaction of I/O system and notifier in the Tcl core" \ 56 | http://sourceforge.net/docman/display_doc.php?docid=6710&group_id=10894 57 | -------------------------------------------------------------------------------- /tools/rules/site: -------------------------------------------------------------------------------- 1 | # -*- tcl -*- 2 | # site wide definitions _____________________________ 3 | # the general layout of the website. Change this to 4 | # adjust the layout. also imposes the interfaces between 5 | # site policy and templates 6 | 7 | source [file join [here] formatting] ; # Make general formatting available. 8 | 9 | # Rules for the creation of the website from the .exp files. 10 | # 11 | # General layout __________________________ 12 | 13 | # Header | [page_begin tag] 14 | # - Navigation - | 15 | # Interlude | [page_content] 16 | # - Content - | 17 | # Footer | [page_end] 18 | 19 | 20 | proc sitepage {tag text url} { 21 | global pages 22 | if {[info exists pages(t,$tag)]} { 23 | error "Page $tag already defined" 24 | } 25 | 26 | set pages(t,$tag) . 27 | lappend pages(tags) $tag 28 | 29 | url $tag $text $url 30 | return 31 | } 32 | 33 | proc manpage {tag text url} { 34 | global pages 35 | if {[info exists pages(t,$tag)]} { 36 | error "Page $tag already defined" 37 | } 38 | 39 | set pages(t,$tag) . 40 | lappend pages(mp) $tag 41 | url $tag $text $url 42 | return 43 | } 44 | 45 | proc page_begin {tag} { 46 | global pages 47 | if {![info exists pages(t,$tag)]} { 48 | error "Unknown page $tag" 49 | } 50 | 51 | set title [$tag text] 52 | set pages(_) $tag 53 | 54 | set data [header $title] 55 | append data "[table][trtop]" 56 | append data "[td]

[sfproject]


[td][nbsp][td]

[pagetitle]

" 57 | append data [page_navigation_begin] 58 | } 59 | 60 | proc page_content {} { 61 | global pages 62 | unset pages(_) 63 | page_navigation_end 64 | } 65 | 66 | proc page_end {} { 67 | set last_update [readFile [file join [state] sn.time]] 68 | 69 | set data "
" 70 | append data "Last updated @ $last_update" 71 | append data "" 72 | append data "[table][trtop][td][news][td][stats]" 73 | append data "" 74 | append data "[trailer]" 75 | return $data 76 | } 77 | 78 | proc page_navigation_begin {} { 79 | set data "[trtop][td][table][trtop][table][trtop]" 80 | append data "[td]

[sf/img]

[mem/logo/100]

[tcl/sf/img]" 81 | append data "[td][nbsp][td][sect Crossreferences]" 82 | return $data 83 | } 84 | 85 | proc page_navigation_end {} { 86 | return "[td][nbsp][td]" 87 | } 88 | 89 | proc nav_link {link} { 90 | return $link
91 | } 92 | 93 | proc site_xref {} { 94 | global pages 95 | 96 | set data "" 97 | foreach tag $pages(tags) { 98 | if {0 == [string compare $tag $pages(_)]} { 99 | append data [nav_link "[$tag text]"] 100 | } else { 101 | append data [nav_link [$tag]] 102 | } 103 | } 104 | 105 | return $data 106 | } 107 | 108 | proc mp_xref {} { 109 | global pages 110 | 111 | set data "


[sect Manpages]" 112 | foreach tag $pages(mp) { 113 | if {0 == [string compare $tag $pages(_)]} { 114 | append data [nav_link "[$tag text]"] 115 | } else { 116 | append data [nav_link [$tag]] 117 | } 118 | } 119 | 120 | return $data 121 | } 122 | -------------------------------------------------------------------------------- /tools/setversion: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # -*- tcl -*- \ 3 | exec tclsh "$0" ${1+"$@"} 4 | 5 | # Insert version and other information into a number of files. 6 | 7 | global trouble 8 | set trouble 0 9 | 10 | # ============================================================ 11 | # Generate the substitution map. 12 | 13 | proc mapdef {k v} { 14 | global map 15 | set map(@${k}@) $v 16 | return 17 | } 18 | 19 | proc map {} { 20 | global map 21 | set res [list] 22 | foreach k [lsort [array names map]] { 23 | lappend res $k $map($k) 24 | } 25 | return $res 26 | } 27 | 28 | # ============================================================ 29 | 30 | proc svfile {fname patternlist} { 31 | global trouble subst out 32 | if {![file exists $fname]} { 33 | puts stderr "File $fname: Does not exist" 34 | set trouble 1 35 | return 36 | } 37 | 38 | puts "Updating file $fname ..." 39 | 40 | set fh [open $fname r] 41 | set contents [read $fh] 42 | close $fh 43 | 44 | puts $out "svfile [list $fname] \{" 45 | 46 | foreach {pattern current} $patternlist { 47 | set newvalue [string map $subst $pattern] 48 | 49 | puts $out " [list $pattern]" 50 | puts $out " [list $newvalue]" 51 | 52 | set contents [string map [list $current $newvalue] $contents] 53 | } 54 | 55 | puts $out "\}" 56 | 57 | if {[catch { 58 | set fh [open ${fname}.new w] 59 | puts -nonewline $fh $contents 60 | close $fh 61 | }]} { 62 | file delete -force ${fname}.new 63 | puts stderr "Unable to write new contents of $fname" 64 | set trouble 1 65 | return 66 | } 67 | file rename -force ${fname}.new $fname 68 | return 69 | } 70 | 71 | proc extension {name data} { 72 | global pname 73 | set pname $name 74 | } 75 | 76 | # ============================================================ 77 | 78 | set v [lindex $argv 0] 79 | if {$v == {}} { 80 | puts stderr "Usage: $argv0 major.minor(\[abp.\]patchlevel)?" 81 | exit -1 82 | } 83 | 84 | regexp {([0-9]+)\.([0-9+])(([abp.])([0-9]+))?} $v \ 85 | -> major minor __ detail patchlevel 86 | 87 | source DESCRIPTION 88 | 89 | mapdef mDate [string toupper \ 90 | [clock format \ 91 | [clock seconds] -format "%b-%d-%Y"]] 92 | mapdef mFullVersion $v 93 | mapdef mMajor $major 94 | mapdef mMinor $minor 95 | mapdef mShortDosVersion $major$minor 96 | mapdef mVersion ${major}.$minor 97 | mapdef mName $pname 98 | 99 | 100 | # ============================================================ 101 | 102 | set flistfile [file join [file dirname [info script]] svfiles] 103 | set newflist ${flistfile}.new 104 | set out [open ${flistfile}.new w] 105 | set subst [map] 106 | source $flistfile 107 | close $out 108 | 109 | ## set trouble 1 ; # enforce that new file does not overwrite old 110 | if {!$trouble} { 111 | file rename -force ${flistfile}.new ${flistfile} 112 | } 113 | -------------------------------------------------------------------------------- /tools/structure: -------------------------------------------------------------------------------- 1 | 2 | /home/groups/m/me/memchan/ 3 | htdocs 4 | art 5 | raw 6 | state 7 | tools 8 | 9 | memchan - cvs watch copy 10 | 11 | -------------------------------------------------------------------------------- /tools/svfiles: -------------------------------------------------------------------------------- 1 | svfile DESCRIPTION { 2 | { version @mFullVersion@} 3 | { version 2.2a4} 4 | { date {@mDate@}} 5 | { date {AUG-20-2002}} 6 | } 7 | svfile LSM { 8 | {Version: @mFullVersion@} 9 | {Version: 2.2a4} 10 | {Entered-date: @mDate@} 11 | {Entered-date: AUG-20-2002} 12 | } 13 | svfile ANNOUNCE { 14 | {I hereby announce @mName@ @mFullVersion@.} 15 | {I hereby announce memchan 2.2a4.} 16 | { @mDate@} 17 | { AUG-20-2002} 18 | } 19 | svfile ANNOUNCE.MAIL { 20 | {Subject: @mName@ @mFullVersion@} 21 | {Subject: memchan 2.2a4} 22 | } 23 | svfile README { 24 | { (Version @mFullVersion@ / @mDate@)} 25 | { (Version 2.2a4 / AUG-20-2002)} 26 | {Memchan @mFullVersion@ is developed for} 27 | {Memchan 2.2a4 is developed for} 28 | } 29 | svfile win/README { 30 | { (Version @mFullVersion@ / @mDate@)} 31 | { (Version 2.2a4 / AUG-20-2002)} 32 | { Memchan @mFullVersion@ Source Distribution} 33 | { Memchan 2.2a4 Source Distribution} 34 | } 35 | svfile mac/README { 36 | { (Version @mFullVersion@ / @mDate@)} 37 | { (Version 2.2a4 / AUG-20-2002)} 38 | } 39 | svfile unix/configure.in { 40 | MEMCHAN_VERSION=@mFullVersion@ 41 | MEMCHAN_VERSION=2.2a4 42 | MEMCHAN_MAJOR_VERSION=@mMajor@ 43 | MEMCHAN_MAJOR_VERSION=2 44 | MEMCHAN_MINOR_VERSION=@mMinor@ 45 | MEMCHAN_MINOR_VERSION=2 46 | } 47 | svfile unix/Makefile.in { 48 | {# This file is a Makefile for MEMCHAN @mFullVersion@.} 49 | {# This file is a Makefile for MEMCHAN 2.2a4.} 50 | {# Distribution as of @mDate@} 51 | {# Distribution as of AUG-20-2002} 52 | {VERSION = @mFullVersion@} 53 | {VERSION = 2.2a4} 54 | } 55 | svfile configure.in { 56 | {# Configure script for package '@mName@', as distributed at @mDate@.} 57 | {# Configure script for package 'memchan', as distributed at AUG-20-2002.} 58 | MAJOR_VERSION=@mMajor@ 59 | MAJOR_VERSION=2 60 | MINOR_VERSION=@mMinor@ 61 | MINOR_VERSION=2 62 | } 63 | svfile pkgIndex.tcl { 64 | {bin Memchan@mShortDosVersion@} 65 | {bin Memchan22} 66 | {dir libMemchan@mVersion@} 67 | {dir libMemchan2.2} 68 | {ifneeded Memchan @mVersion@} 69 | {ifneeded Memchan 2.2} 70 | } 71 | svfile win/mc.rc { 72 | {VALUE "OriginalFilename", "Memchan@mShortDosVersion@.dll\0"} 73 | {VALUE "OriginalFilename", "Memchan22.dll\0"} 74 | {VALUE "FileVersion", "@mVersion@"} 75 | {VALUE "FileVersion", "2.2"} 76 | {VALUE "ProductName", "Memchan @mVersion@ for Windows\0"} 77 | {VALUE "ProductName", "Memchan 2.2 for Windows\0"} 78 | {VALUE "ProductVersion", "@mVersion@"} 79 | {VALUE "ProductVersion", "2.2"} 80 | } 81 | svfile win/Makefile.gnu { 82 | {Memchan @mFullVersion@ (as of @mDate@)} 83 | {Memchan 2.2a4 (as of AUG-20-2002)} 84 | {VERSION = @mFullVersion@} 85 | {VERSION = 2.2a4} 86 | {MEMCHAN_DLL_FILE= memchan@mShortDosVersion@.dll} 87 | {MEMCHAN_DLL_FILE= memchan22.dll} 88 | } 89 | svfile win/makefile.vc { 90 | {makefile for memchan @mFullVersion@ (as of @mDate@)} 91 | {makefile for memchan 2.2a4 (as of AUG-20-2002)} 92 | {MC = memchan@mShortDosVersion@} 93 | {MC = memchan22} 94 | {DMEMCHAN_VERSION=\"@mFullVersion@\"} 95 | {DMEMCHAN_VERSION=\"2.2a4\"} 96 | } 97 | svfile win/makefile.vc5 { 98 | {makefile for Memchan @mFullVersion@ (@mDate@)} 99 | {makefile for Memchan 2.2a4 (AUG-20-2002)} 100 | {MC = memchan@mShortDosVersion@} 101 | {MC = memchan22} 102 | {DMEMCHAN_VERSION=\"@mFullVersion@\"} 103 | {DMEMCHAN_VERSION=\"2.2a4\"} 104 | } 105 | svfile win/pkgIndex.tcl { 106 | {ifneeded Memchan @mVersion@} 107 | {ifneeded Memchan 2.2} 108 | {dir memchan@mShortDosVersion@} 109 | {dir memchan22} 110 | } 111 | -------------------------------------------------------------------------------- /tools/watch_cvs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Watch the CVS repository for changes in memchan, retrieve the 3 | # changed files and invoke the handler script which propagate the 4 | # changes to other parts of the system. 5 | 6 | cd `dirname $0`/.. 7 | 8 | export CVSROOT 9 | CVSROOT=:pserver:anonymous@cvs.memchan.sourceforge.net:/cvsroot/memchan 10 | 11 | if [ 0 -lt `cvs diff memchan 2>/dev/null | wc -l` ] 12 | then 13 | out=$HOME/logs/memchan 14 | mkdir -p `dirname $out` 15 | 16 | cvs co memchan >$out 2>&1 17 | mkdir -p memchan/htdocs/state 18 | 19 | # Use a new htdocs_setup script immediately. 20 | # Without this copying it would take effect 21 | # only after with the change after the current 22 | # one. 23 | 24 | cp ./memchan/tools/htdocs_setup ./tools_setup 25 | 26 | (sleep 60 ; ./tools/htdocs_setup ) & 27 | fi 28 | exit 29 | -------------------------------------------------------------------------------- /webpage/common.tcl: -------------------------------------------------------------------------------- 1 | 2 | # This file contains Tcl code used by the scripts that generate web-pages 3 | # (mkwebpage.tcl, mksupportpage.tcl) to generate the boxes on the left-hand 4 | # side of the pages. 5 | # 6 | 7 | # This global variable contains the complete html text of the 8 | # "Site Contents" box. 9 | set ::SiteMap { 10 | 16 |
17 |

Site Contents

18 |
    19 |
  • Home 20 | Front page of this site 21 |
  • Standards 22 | 23 | Summary of support for CSS and HTML standards 24 |
  • Man page 25 | 26 | Unix style manual page for the widget. 27 | 28 |
  • Hv3 29 | 30 | Page for the demo/test application hv3. Screenshots and 31 | starpacks for windows and linux are available here. 32 | 33 |
  • Cvstrac 34 | 35 | Cvstrac is used for project change-log, wiki and bug 36 | tracking. 37 | 38 |
39 |
40 | } 41 | 42 | proc getTabs {idx} { 43 | set ret "
" 44 | append ret {
} 45 | append ret 46 | set ii 0 47 | foreach {label href caption} [list \ 48 | Home index.html "Front page of this site" \ 49 | Standards support.html "Summary of support for CSS and HTML standards" \ 50 | "Tkhtml3" tkhtml.html "Unix style manual page for the Tkhtml3 widget." \ 51 | "Hv3" hv3.html { 52 | Page for the web browser application hv3. Screenshots and 53 | starpacks for windows and linux are available here. } \ 54 | "Hv3 Widget" hv3_widget.html { 55 | Page for the Hv3 mega-widget, a Snit based pure Tcl widget 56 | that adds some commonly requested functionality to Tkhtml3. } \ 57 | FFAQ ffaq.html "tkhtml.tcl.tk FFAQ" \ 58 | Cvstrac http://tkhtml.tcl.tk/cvstrac/timeline { 59 | Cvstrac is used for project change-log, wiki and bug 60 | tracking. } 61 | ] { 62 | if {$ii==$idx} { 63 | append ret [subst { 64 | } 71 | incr ii 72 | } 73 | append ret
$label}] 65 | } else { 66 | append ret "$label" 67 | } 68 | append ret "$caption" 69 | 70 | append ret {
74 | append ret
75 | return $ret 76 | } 77 | 78 | set ::PageSectionList [list] 79 | proc addPageSection {title name} { 80 | lappend ::PageSectionList [list $title $name] 81 | } 82 | 83 | proc getToc {} { 84 | append ret { 85 | 89 |
90 |

Page Contents

91 |
    92 | } 93 | foreach entry $::PageSectionList { 94 | foreach {caption href} $entry {} 95 | append ret "
  • $caption
  • \n" 96 | } 97 | append ret "
\n
" 98 | 99 | return $ret 100 | } 101 | -------------------------------------------------------------------------------- /webpage/mkffaqpage.tcl: -------------------------------------------------------------------------------- 1 | 2 | source [file join [file dirname [info script]] common.tcl] 3 | 4 | addPageSection "Download" download 5 | addPageSection "Source Code/Hacking" source 6 | addPageSection "More Information" info 7 | 8 | proc VERSION {} { 9 | if {[info exists ::env(VERSION)]} {return $::env(VERSION)} 10 | return "alpha-15" 11 | } 12 | 13 | set idx 1 14 | 15 | proc Q {id Question Answer} { 16 | global idx 17 | 18 | append ::BODY "

${idx}. $Question

" 19 | append ::BODY $Answer 20 | append ::TOC "
  • ${idx}. $Question" 21 | incr idx 22 | } 23 | 24 | Q statefile {How can I save my options/cookies/history-list etc.?} { 25 |

    26 | By default, Hv3 saves absolutely no data to the file system. 27 | After the Hv3 window has been closed, it is not possible for anyone else 28 | using the same computer to discover which websites you have visited or 29 | logged in to. 30 |

    31 |

    32 | However, although this preserves your privacy, sometimes it is not 33 | conveniant. If a "state file" is enabled, Hv3 stores the following 34 | data to a file on disk: 35 | 36 |

      37 |
    • HTTP cookies. 38 |
    • The list of visited URIs (used for auto-completion in the location 39 | bar and for coloring visited hyperlinks). 40 |
    • The values of the settings configured in the "Options" pull-down menu, 41 | except for the "Hide GUI" option. 42 |
    • User bookmarks. 43 |
    44 |

    45 | To use a state file, specify the "-statefile" option as part of the command 46 | line used to start Hv3. The -statefile option is used to specify a file on 47 | disk used to persistently store various elements of the browser application 48 | state. Windows users may need to create a "batch file" to achieve this. For 49 | example, assuming that the Hv3 binary is named 50 | "hv3-linux-nightly-07_0723" and you wish to use the file 51 | "/home/dan/hv3_state.db" as the statefile, the full command line would be: 52 |

    53 | 54 |
     55 |     hv3-linux-nightly-07_0723 -statefile /home/dan/hv3_state.db
     56 | 
    57 |

    58 | Because the state file is actually an 59 | SQLite database, there is no problem with two or more Hv3 processes 60 | using the same state file simultaneously. Bookmarked and configuration 61 | settings are propagated between instances automatically. 62 |

    63 | 64 | } 65 | 66 | Q hv3_polipo {What is this hv3_polipo?} { 67 |

    68 | hv3_polipo is a very slightly modified version of the standard 69 | polipo program by Juliusz Chroboczek, available at 70 | 71 | http://www.pps.jussieu.fr/~jch/software/polipo/. The modifications 72 | are designed to make sure that no hv3_polipo processes are 73 | left running if hv3 crashes or is terminated by the operating system. 74 | The patch used to create the custom version is available 75 | here. 76 |

    77 |

    78 | If building Hv3 from source code, you probably want to obtain hv3_polipo 79 | as well. The starkit and other pre-built packages 80 | available here already include 81 | pre-compiled versions. 82 |

    83 | } 84 | 85 | puts [subst { 86 | 87 | 88 | 89 | 90 | tkhtml.tcl.tk FFAQ 91 | 92 | 93 | 94 | [getTabs 5] 95 | 96 |
    97 |

    tkhtml.tcl.tk FFAQ

    98 |
    99 |
      100 | $::TOC 101 |
    102 | $::BODY 103 | 104 | }] 105 | 106 | -------------------------------------------------------------------------------- /webpage/tkhtml_tcl_tk.css: -------------------------------------------------------------------------------- 1 | 2 | #toc { 3 | float: right; 4 | margin: 1em 1em 1em 1em; 5 | padding: 1em; 6 | border: 1px solid black; 7 | } 8 | 9 | #toc ul, #toc li { 10 | display: block; 11 | margin: 0; 12 | padding: 0; 13 | } 14 | #toc li { 15 | margin-left: 3ex; 16 | display: list-item; 17 | list-style-type: decimal; 18 | } 19 | #toc h3 { 20 | margin-top: 0; 21 | } 22 | 23 | body { 24 | background-color: #d9d9d9; 25 | } 26 | h1 { 27 | text-align: center; 28 | margin: 1em; 29 | } 30 | 31 | table { 32 | margin: 1em auto; 33 | } 34 | 35 | #sitemap { 36 | max-width:720px; 37 | margin:auto; 38 | position: relative; 39 | } 40 | 41 | #sitemap h3 { 42 | display: none; 43 | } 44 | #sitemap table { 45 | overflow: auto; 46 | margin:auto; 47 | line-height: 1.5em; 48 | padding: 0px; 49 | border-spacing: 0px; 50 | } 51 | #sitemap tr { 52 | border-spacing: 0px; 53 | } 54 | #sitemap td { 55 | border: black 1px solid; 56 | border-bottom: none; 57 | } 58 | #sitemap td.spacer { 59 | border: none; 60 | } 61 | #sitemap a[href] { 62 | display: block; 63 | padding: 0.5em 1em 0px 1em; 64 | text-decoration: none; 65 | color: black 66 | } 67 | #sitemap .caption { 68 | display: none; 69 | } 70 | 71 | #sitemap td:hover .caption { 72 | display: block; 73 | position: absolute; 74 | top: 110%; 75 | left: 25%; 76 | right: 25%; 77 | display: block; 78 | border: 1px solid black; 79 | background-color: #ececec; 80 | padding: 0px 0.5em; 81 | } 82 | #sitemap #active .caption { 83 | display: none; 84 | position: static; 85 | } 86 | 87 | a[href]:hover { 88 | background-color: #ececec; 89 | color: black; 90 | border-bottom: solid black 1px; 91 | text-decoration: none; 92 | } 93 | 94 | #sitemap a[href] { 95 | border-bottom: none; 96 | background-color: transparent; 97 | } 98 | #sitemap td:hover { 99 | background-color: #ececec; 100 | } 101 | #sitemap #active { 102 | background-color: white; 103 | } 104 | 105 | #body { 106 | text-align: left; 107 | border: black 1px solid; 108 | padding: 0px 0.5em; 109 | max-width: 720px; 110 | margin: auto; 111 | background-color: white; 112 | } 113 | 114 | .bigred { 115 | font-size: 1.6em; 116 | /* color:red; 117 | text-decoration:none; 118 | */ 119 | } 120 | 121 | .screenshot { 122 | border: solid 1px black; 123 | margin: 1em; 124 | } 125 | 126 | --------------------------------------------------------------------------------