Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Difference From ab191039017d009c To fe91db4e276040d4
2017-08-24
| ||
13:57 | Install also tdomConfig.sh. And since tdomConfig.sh is generated by configure, don't remove it with make clean but only with make distclean. Closed-Leaf check-in: 9ca8c82d0a user: rolf tags: prepare-release | |
2017-08-23
| ||
16:16 | Changed a last comma. check-in: fe91db4e27 user: rolf tags: prepare-release | |
15:52 | Hopfully final proof-reading of README. check-in: 1aaa919d6e user: rolf tags: prepare-release | |
2017-08-17
| ||
17:58 | Merged trunk. check-in: c75669c175 user: rolf tags: prepare-release | |
2017-08-14
| ||
12:51 | Merged from trunk. check-in: ab19103901 user: rolf tags: prepare-release | |
12:17 | Updated TEA to tclconfig trunk. check-in: dcb4735ca9 user: rolf tags: trunk | |
2017-08-05
| ||
12:57 | Merged from trunk. check-in: d9388d5e29 user: rolf tags: prepare-release | |
Changes to CHANGES.
1 +2017-08-21 Ashok Nadkarni 1 2 3 + Windows build system (VC and mingw) modernised. 4 + 5 +2017-08-17 Rolf Ade <rolf@pointsman.de> 6 + 7 + New feature "creating real FQ nodes with *fromScript methods", 8 + by adding option -namespace to [dom createNodeCmd]. 9 + 10 +2017-08-14 Rolf Ade <rolf@pointsman.de> 11 + 12 + Updated TEA. 13 + 14 +2017-07-29 Rolf Ade <rolf@pointsman.de> 15 + 16 + Removed hacky check on [load] time if the tclsh and tDOM are 17 + build with incompatible TCL_UTF_MAX (because it did not work 18 + anymore with recent tcl because of changes in core). 19 + 20 +2017-07-28 Rolf Ade <rolf@pointsman.de> 21 + 22 + Added JSON support. New -json option to [dom parse]. New doc 23 + method asJSON. New node method jsonType. New option -jsonType 24 + of [dom createNodeCmd]. New option -tagName of [dom 25 + createNodeCmd]. New option -jsonType to dom method 26 + createDocumentNode. 27 + 28 +2017-04-06 Rolf Ade <rolf@pointsman.de> 29 + 30 + Added HTM5 parser (new -html5 option to [dom parse]). Requires 31 + gumbo lib and must be enabled at configure time. 32 + 2 33 2016-10-01 Rolf Ade <rolf@pointsman.de> 3 34 4 35 Updated to expat 2.2.0. 5 36 6 37 2015-09-11 Rolf Ade <rolf@pointsman.de> 7 38 8 39 Added options -xmlDeclaration and -encString to the asXML
Changes to ChangeLog.
1 1 2 2 NOTICE: This file isn't kept up to date anymore. Look at the timeline 3 -of the leading fossil repository 4 -(https://46.163.78.80/cgi-bin/repros/tdom/timeline) or at the backup 3 +of the leading fossil repository (http://tdom.org) or at the backup 5 4 repository at https://core.tcl.tk/tdom/timeline for detailed lists of 6 5 code changes. 7 6 8 7 User interface changes/enhancements and other important changes will 9 8 still be documented in the CHANGES file. 10 9 11 10 2012-05-17 Rolf Ade <rolf@pointsman.de>
Changes to README.
1 1 2 2 3 - tDOM - a XML/DOM/XPath/XSLT implementation for Tcl 4 - (Version 0.8.4) 3 + tDOM - a XML/DOM/XPath/XSLT/HTML/JSON implementation for Tcl 4 + (Version 0.9.0) 5 5 6 - Jochen Loewer (loewerj@hotmail.com) 7 - Rolf Ade (rolf@pointsman.de) 8 6 9 - with some contributions by: 7 +This directory contains a freely distributable thread-safe extension 8 +to Tcl/Tk called tDOM. 10 9 11 - Zoran Vasiljevic (zv@archiware.com) 12 - 13 - 14 -This directory contains a freely distributable (under the Mozilla Public 15 -License) thread-safe extension to Tcl/Tk called tDOM. 10 +tDOM was started by Jochen Loewer (loewerj@hotmail.com) and developed 11 +by Jochen and Rolf Ade (rolf@pointsman.de) with contributions by Zoran 12 +Vasiljevic (zv@archiware.com). Since more than a decade it is 13 +maintained and developed by Rolf Ade. 16 14 17 15 18 16 tDOM contains: 19 17 20 - * the newest version of Expat, the XML parser from James Clark, 21 - including namespace and DTD support. 18 + * for convenience expat 2.2.0, the XML parser originated from 19 + James Clark, although you're able to link tDOM with other 20 + expat versions or the library provided by the system. 22 21 23 - * a modified version of Steve Ball's Tclexpat, the Tcl interface to 24 - expat, for event-like (SAX-like) XML parsing. The modifications 25 - are for performance improvements, to make the newest Expat 26 - features (XML namespace) available and for some additional features. 22 + * building a DOM tree from XML in one go implemented in C for 23 + maximum performance and minimum memory usage, and DOM I and II 24 + methods to work on such a tree using either a OO-like or a 25 + handle syntax. 27 26 28 - * a (partial) DOM I and II implementation in C for maximum 29 - performance and minimum memory need following the W3C DOM Core 30 - Level 1 recommendation using a OO-like syntax. 27 + * a Tcl interface to expat for event-like (SAX-like) XML parsing. 31 28 32 - * a very complete, compliant and fast XPath implementation in C 33 - following the November 99 W3C recommendation. 29 + * a complete, compliant and fast XPath implementation in C 30 + following the November 99 W3C recommendation for navigating and 31 + data extraction. 34 32 35 33 * a fast XSLT implementation in C following the W3C Recommendation 36 34 16 November 1999. 37 35 38 - * a (partial) implementation in C of the XPointer (97) navigational 39 - functions. 36 + * optional DTD validation. 40 37 41 - * UTF-8 to 8 bit encoding back conversion functionality to support 42 - Tcl version < 8.1x 38 + * a JSON parser which parses any possible JSON input into a DOM 39 + tree without losing information. 43 40 44 - * optional DTD validation 41 + * an efficient and Tcl'ish way to create XML and HTML documents 42 + and JSON string. 45 43 46 - * additional convenience methods 44 + * as build option an interface to the gumbo HTML5 parser, which 45 + also digests almost any other HTML. 46 + 47 + * an even faster simple XML parser for trusted XML input. 48 + 49 + * additional convenience methods. 47 50 48 - * documentation in TMML, HTML and nroff format 51 + * and more. 52 + 53 + 54 +DOCUMENTATION 55 + 56 + The documentation is included into the source distribution in HTML 57 + and man format. Alternatively, read it online starting at 58 + http://tdom.org/index.html/doc/tdom-0-9-0/doc/index.html 59 + 60 + 61 +GETTING THE CODE 62 + 63 + The development repository is hosted at http://tdom.org and is 64 + mirrored at http://core.tcl.tk/tdom. You are encouraged to use 65 + trunk. 66 + 67 + If you insist on using an older tDOM with lesser features and 68 + probably more bugs, you should use the latest release 0.9.0. Get 69 + the source code release from 70 + http://tdom.org/downloads/tdom-0.9.0-src.tgz or 71 + http://tdom.org/downloads/tdom-0.9.0-src.zip 72 + 73 + Windows binaries (32 bit as well as 64 bit) of the 0.9.0 release 74 + are also available. Get it from 75 + http://tdom.org/downloads/tdom-0.9-windows-x64.zip and 76 + http://tdom.org/downloads/tdom-0.9-windows-x86.zip 77 + 78 + The provided windows binaries include (statically linked) the 79 + HTML5 parser. 49 80 50 81 51 -COMPILING/USING tDOM 82 +COMPILING tDOM 52 83 53 - Depending on your platform, (unix or win) go to the corresponding 54 - directory and invoke the configure script: 84 + Depending on your platform (unix/mac or win), go to the 85 + corresponding directory and invoke the configure script: 55 86 56 87 ../configure 57 88 make 58 89 make test 59 90 make install 60 91 61 92 Alternatively, you can build the tDOM package in just about any 62 93 directory elsewhere on the fileystem (since TEA-compatible). 63 - 64 - Don't build against Tcl 8.6.2 (or Tcl 8.5.16). This tcl releases 65 - had bugs in the I/O system, that may bite you while using tDOM. 66 94 67 - You might also want to do "../configure --help" to get list of all 68 - supported options of the configure script. In the "unix" directory 69 - there is a "CONFIG" file containing some examples on how to invoke 70 - the "configure" script for some common cases. You can peek 71 - there. This file also includes a short description of the tDOM 72 - specific configure options. 95 + You might also want to do "../configure --help" to get a list of 96 + all supported options of the configure script. In the "unix" 97 + directory there is a "CONFIG" file containing some examples on how 98 + to invoke the "configure" script for some common cases. You can 99 + peek there. This file also includes a short description of the 100 + tDOM specific configure options. 73 101 74 102 Since tDOM is TEA-compatible you should be able to build it using 75 103 the MinGW build environment for Windows. There is also the MSVC 76 104 nmake file so you can compile the package with Microsoft tools. 105 + Refer to the README in the win directory for more details about 106 + building on Windows. 77 107 78 108 The compile process will build the tDOM shared library suitable for 79 109 loading into the Tcl shell using standard "package require" mechanism. 80 110 81 -Have fun! 111 + 112 +REPORTING BUGS 82 113 83 -- EOF - 114 + Please head to http://tdom.org/index.html/ticket and click on "New 115 + Ticket". Log in as anonymous and report your findings. If you 116 + prefer to have an individual login write Rolf a mail.
Changes to README.AOL.
1 1 2 2 3 3 tDOM - a XML/DOM/XPath/XSLT implementation for Tcl 4 - (Version 0.8.3) 4 + (Version 0.9.0) 5 5 6 6 Jochen Loewer (loewerj@hotmail.com) 7 7 Rolf Ade (rolf@pointsman.de) 8 8 9 9 with some contributions by: 10 10 11 11 Zoran Vasiljevic (zv@archiware.com)
Changes to configure.
1 1 #! /bin/sh 2 2 # Guess values for system-dependent variables and create Makefiles. 3 -# Generated by GNU Autoconf 2.69 for tdom 0.8.4. 3 +# Generated by GNU Autoconf 2.69 for tdom 0.9.0. 4 4 # 5 5 # 6 6 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. 7 7 # 8 8 # 9 9 # This configure script is free software; the Free Software Foundation 10 10 # gives unlimited permission to copy, distribute and modify it. ................................................................................ 573 573 subdirs= 574 574 MFLAGS= 575 575 MAKEFLAGS= 576 576 577 577 # Identity of this package. 578 578 PACKAGE_NAME='tdom' 579 579 PACKAGE_TARNAME='tdom' 580 -PACKAGE_VERSION='0.8.4' 581 -PACKAGE_STRING='tdom 0.8.4' 580 +PACKAGE_VERSION='0.9.0' 581 +PACKAGE_STRING='tdom 0.9.0' 582 582 PACKAGE_BUGREPORT='' 583 583 PACKAGE_URL='' 584 584 585 585 # Factoring default headers for most tests. 586 586 ac_includes_default="\ 587 587 #include <stdio.h> 588 588 #ifdef HAVE_SYS_TYPES_H ................................................................................ 1305 1305 # 1306 1306 # Report the --help message. 1307 1307 # 1308 1308 if test "$ac_init_help" = "long"; then 1309 1309 # Omit some internal or obsolete options to make the list less imposing. 1310 1310 # This message is too long to be a string in the A/UX 3.1 sh. 1311 1311 cat <<_ACEOF 1312 -\`configure' configures tdom 0.8.4 to adapt to many kinds of systems. 1312 +\`configure' configures tdom 0.9.0 to adapt to many kinds of systems. 1313 1313 1314 1314 Usage: $0 [OPTION]... [VAR=VALUE]... 1315 1315 1316 1316 To assign environment variables (e.g., CC, CFLAGS...), specify them as 1317 1317 VAR=VALUE. See below for descriptions of some of the useful variables. 1318 1318 1319 1319 Defaults for the options are specified in brackets. ................................................................................ 1366 1366 1367 1367 cat <<\_ACEOF 1368 1368 _ACEOF 1369 1369 fi 1370 1370 1371 1371 if test -n "$ac_init_help"; then 1372 1372 case $ac_init_help in 1373 - short | recursive ) echo "Configuration of tdom 0.8.4:";; 1373 + short | recursive ) echo "Configuration of tdom 0.9.0:";; 1374 1374 esac 1375 1375 cat <<\_ACEOF 1376 1376 1377 1377 Optional Features: 1378 1378 --disable-option-checking ignore unrecognized --enable/--with options 1379 1379 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) 1380 1380 --enable-FEATURE[=ARG] include FEATURE [ARG=yes] ................................................................................ 1477 1477 cd "$ac_pwd" || { ac_status=$?; break; } 1478 1478 done 1479 1479 fi 1480 1480 1481 1481 test -n "$ac_init_help" && exit $ac_status 1482 1482 if $ac_init_version; then 1483 1483 cat <<\_ACEOF 1484 -tdom configure 0.8.4 1484 +tdom configure 0.9.0 1485 1485 generated by GNU Autoconf 2.69 1486 1486 1487 1487 Copyright (C) 2012 Free Software Foundation, Inc. 1488 1488 This configure script is free software; the Free Software Foundation 1489 1489 gives unlimited permission to copy, distribute and modify it. 1490 1490 _ACEOF 1491 1491 exit ................................................................................ 1842 1842 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno 1843 1843 1844 1844 } # ac_fn_c_check_header_mongrel 1845 1845 cat >config.log <<_ACEOF 1846 1846 This file contains any messages produced by compilers while 1847 1847 running configure, to aid debugging if configure makes a mistake. 1848 1848 1849 -It was created by tdom $as_me 0.8.4, which was 1849 +It was created by tdom $as_me 0.9.0, which was 1850 1850 generated by GNU Autoconf 2.69. Invocation command line was 1851 1851 1852 1852 $ $0 $@ 1853 1853 1854 1854 _ACEOF 1855 1855 exec 5>>config.log 1856 1856 { ................................................................................ 2208 2208 2209 2209 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for correct TEA configuration" >&5 2210 2210 $as_echo_n "checking for correct TEA configuration... " >&6; } 2211 2211 if test x"${PACKAGE_NAME}" = x ; then 2212 2212 as_fn_error $? " 2213 2213 The PACKAGE_NAME variable must be defined by your TEA configure.ac" "$LINENO" 5 2214 2214 fi 2215 - if test x"3.9" = x ; then 2215 + if test x"3.10" = x ; then 2216 2216 as_fn_error $? " 2217 2217 TEA version not specified." "$LINENO" 5 2218 - elif test "3.9" != "${TEA_VERSION}" ; then 2219 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: warning: requested TEA version \"3.9\", have \"${TEA_VERSION}\"" >&5 2220 -$as_echo "warning: requested TEA version \"3.9\", have \"${TEA_VERSION}\"" >&6; } 2218 + elif test "3.10" != "${TEA_VERSION}" ; then 2219 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: warning: requested TEA version \"3.10\", have \"${TEA_VERSION}\"" >&5 2220 +$as_echo "warning: requested TEA version \"3.10\", have \"${TEA_VERSION}\"" >&6; } 2221 2221 else 2222 2222 { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (TEA ${TEA_VERSION})" >&5 2223 2223 $as_echo "ok (TEA ${TEA_VERSION})" >&6; } 2224 2224 fi 2225 2225 2226 2226 # If the user did not set CFLAGS, set it now to keep macros 2227 2227 # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2". ................................................................................ 5547 5547 if test "$tcl_ok" = "yes" ; then 5548 5548 HAVEGUMBO=`pkg-config --exists gumbo && echo "1"` 5549 5549 if test "$HAVEGUMBO" = "1" ; then 5550 5550 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 5551 5551 $as_echo "yes" >&6; } 5552 5552 $as_echo "#define TDOM_HAVE_GUMBO 1" >>confdefs.h 5553 5553 5554 - HTML5_LIBS="`pkg-config --cflags --libs gumbo`" 5554 + if test "${TEA_PLATFORM}" = "windows" ; then 5555 + HTML5_LIBS="-Wl,-Bstatic `pkg-config --static --cflags --libs gumbo` -Wl,-Bdynamic" 5556 + else 5557 + HTML5_LIBS="`pkg-config --cflags --libs gumbo`" 5558 + fi 5555 5559 else 5556 5560 as_fn_error $? "The required lib gumbo not found" "$LINENO" 5 5557 5561 fi 5558 5562 else 5559 5563 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 5560 5564 $as_echo "no" >&6; } 5561 5565 fi ................................................................................ 5697 5701 # and change Makefile.in to move it from CONFIG_CLEAN_FILES to BINARIES var. 5698 5702 # 5699 5703 # A few miscellaneous platform-specific items: 5700 5704 # TEA_ADD_* any platform specific compiler/build info here. 5701 5705 #-------------------------------------------------------------------- 5702 5706 5703 5707 if test "${TEA_PLATFORM}" = "windows" ; then 5704 - $as_echo "#define BUILD_tdom 1" >>confdefs.h 5705 - 5706 5708 CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch" 5707 5709 #TEA_ADD_SOURCES([win/winFile.c]) 5708 5710 #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"]) 5709 5711 else 5710 5712 CLEANFILES="pkgIndex.tcl tdomConfig.sh tdom.tcl tcldomsh" 5711 5713 #TEA_ADD_SOURCES([unix/unixFile.c]) 5712 5714 #TEA_ADD_LIBS([-lsuperfly]) ................................................................................ 9694 9696 test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 9695 9697 9696 9698 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 9697 9699 # Save the log message, to keep $0 and so on meaningful, and to 9698 9700 # report actual input values of CONFIG_FILES etc. instead of their 9699 9701 # values after options handling. 9700 9702 ac_log=" 9701 -This file was extended by tdom $as_me 0.8.4, which was 9703 +This file was extended by tdom $as_me 0.9.0, which was 9702 9704 generated by GNU Autoconf 2.69. Invocation command line was 9703 9705 9704 9706 CONFIG_FILES = $CONFIG_FILES 9705 9707 CONFIG_HEADERS = $CONFIG_HEADERS 9706 9708 CONFIG_LINKS = $CONFIG_LINKS 9707 9709 CONFIG_COMMANDS = $CONFIG_COMMANDS 9708 9710 $ $0 $@ ................................................................................ 9747 9749 9748 9750 Report bugs to the package provider." 9749 9751 9750 9752 _ACEOF 9751 9753 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 9752 9754 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" 9753 9755 ac_cs_version="\\ 9754 -tdom config.status 0.8.4 9756 +tdom config.status 0.9.0 9755 9757 configured by $0, generated by GNU Autoconf 2.69, 9756 9758 with options \\"\$ac_cs_config\\" 9757 9759 9758 9760 Copyright (C) 2012 Free Software Foundation, Inc. 9759 9761 This config.status script is free software; the Free Software Foundation 9760 9762 gives unlimited permission to copy, distribute and modify it." 9761 9763
Changes to configure.in.
15 15 # This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION 16 16 # set as provided. These will also be added as -D defs in your Makefile 17 17 # so you can encode the package version directly into the source files. 18 18 # This will also define a special symbol for Windows (BUILD_sample in 19 19 # this case) so that we create the export library with the dll. 20 20 #----------------------------------------------------------------------- 21 21 22 -AC_INIT([tdom], [0.8.4]) 22 +AC_INIT([tdom], [0.9.0]) 23 23 24 24 #-------------------------------------------------------------------- 25 25 # Call TEA_INIT as the first TEA_ macro to set up initial vars. 26 26 # This will define a ${TEA_PLATFORM} variable == "unix" or "windows" 27 27 # as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE. 28 28 #-------------------------------------------------------------------- 29 29 30 -TEA_INIT([3.9]) 30 +TEA_INIT([3.10]) 31 31 32 32 AC_CONFIG_AUX_DIR(tclconfig) 33 33 34 34 #-------------------------------------------------------------------- 35 35 # Load the tclConfig.sh file 36 36 #-------------------------------------------------------------------- 37 37 ................................................................................ 125 125 # and change Makefile.in to move it from CONFIG_CLEAN_FILES to BINARIES var. 126 126 # 127 127 # A few miscellaneous platform-specific items: 128 128 # TEA_ADD_* any platform specific compiler/build info here. 129 129 #-------------------------------------------------------------------- 130 130 131 131 if test "${TEA_PLATFORM}" = "windows" ; then 132 - AC_DEFINE(BUILD_tdom) 133 132 CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch" 134 133 #TEA_ADD_SOURCES([win/winFile.c]) 135 134 #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"]) 136 135 else 137 136 CLEANFILES="pkgIndex.tcl tdomConfig.sh tdom.tcl tcldomsh" 138 137 #TEA_ADD_SOURCES([unix/unixFile.c]) 139 138 #TEA_ADD_LIBS([-lsuperfly])
Changes to doc/category-index.html.
1 1 <html> 2 2 <head> 3 -<title>tDOM manual: Index</title><link rel="stylesheet" href="manpage.css"><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: category-index.xsl,v $ $Revision: 1.5 $"> 3 +<title>tDOM manual: Index</title><link rel="stylesheet" href="manpage.css"><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: category-index.xsl,v $ $Revision: 1.5 $"><meta charset="utf-8"> 4 4 </head><body> 5 5 <div class="header"> 6 6 <h1 class="title" align="center">tDOM manual: Index</h1><p class="navaid" align="center"> 7 -<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> 7 +<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> · <a class="navaid" href="http://tdom.org">Repository</a> 8 8 </p><hr class="navsep"><div class="navbar"> 9 -<a href="#cat_cmd">Tcl commands</a> · <a href="#cat_fun">C functions</a> · </div> 9 +<a href="#cat_cmd">Tcl commands</a> · <a href="#cat_fun">C functions</a> · </div> 10 10 </div><div class="body"> 11 -<h2><a name="cat_cmd">Tcl commands</a></h2><a href="dom.html">dom</a> · <a href="domDoc.html">domDoc</a> · <a href="domNode.html">domNode</a> · <a href="expat.html">expat</a> · <a href="tdomcmd.html">tdom</a> · <a href="tnc.html">tnc</a> · <a href="expat.html">xml::parser</a><h2><a name="cat_fun">C functions</a></h2><a href="expatapi.html">CheckExpatParserObj, CHandlerSetInstall, CHandlerSetRemove, 11 +<h2><a name="cat_cmd">Tcl commands</a></h2><a href="dom.html">dom</a> · <a href="domDoc.html">domDoc</a> · <a href="domNode.html">domNode</a> · <a href="expat.html">expat</a> · <a href="tdomcmd.html">tdom</a> · <a href="tnc.html">tnc</a> · <a href="expat.html">xml::parser</a><h2><a name="cat_fun">C functions</a></h2><a href="expatapi.html">CheckExpatParserObj, CHandlerSetInstall, CHandlerSetRemove, 12 12 CHandlerSetCreate, CHandlerSetGetUserData, GetExpatInfo</a> 13 13 </div><div class="footer"> 14 14 <hr class="navsep"><div class="navbar" align="center"> 15 -<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> 15 +<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> · <a class="navaid" href="http://tdom.org">Repository</a> 16 16 </div> 17 17 </div> 18 18 </body> 19 19 </html>
Changes to doc/dom.html.
1 1 <html> 2 2 <head> 3 -<link rel="stylesheet" href="manpage.css"><title>tDOM manual: dom</title><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: tmml-html.xsl,v $ $Revision: 1.11 $"> 3 +<link rel="stylesheet" href="manpage.css"><title>tDOM manual: dom</title><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: tmml-html.xsl,v $ $Revision: 1.11 $"><meta charset="utf-8"> 4 4 </head><body> 5 5 <div class="header"> 6 6 <div class="navbar" align="center"> 7 -<a href="#SECTid0xb56980">NAME</a> · <a href="#SECTid0xa76ae0">SYNOPSIS</a> · <a href="#SECTid0xb62b50">DESCRIPTION </a> · <a href="#SECTid0xb84020">KEYWORDS</a> 7 +<a href="#SECTid0x1f2bd90">NAME</a> · <a href="#SECTid0x1e4db70">SYNOPSIS</a> · <a href="#SECTid0x1f36320">DESCRIPTION </a> · <a href="#SECTid0x1f86b10">KEYWORDS</a> 8 8 </div><hr class="navsep"> 9 9 </div><div class="body"> 10 - <h2><a name="SECTid0xb56980">NAME</a></h2><p class="namesection"> 10 + <h2><a name="SECTid0x1f2bd90">NAME</a></h2><p class="namesection"> 11 11 <b class="names">dom - </b><br>Create an in-memory DOM tree from XML</p> 12 12 13 - <h2><a name="SECTid0xa76ae0">SYNOPSIS</a></h2><pre class="syntax">package require tdom 13 + <h2><a name="SECTid0x1e4db70">SYNOPSIS</a></h2><pre class="syntax">package require tdom 14 14 15 15 <b class="cmd">dom</b> <i class="m">method</i> ?<i class="m">arg arg ...</i>?</pre> 16 16 17 - <h2><a name="SECTid0xb62b50">DESCRIPTION </a></h2><p>This command provides the creation of DOM trees in memory. In 17 + <h2><a name="SECTid0x1f36320">DESCRIPTION </a></h2><p>This command provides the creation of DOM trees in memory. In 18 18 the usual case a string containing a XML information is parsed and converted 19 19 into a DOM tree. Other possible parse input may be HTML or JSON. 20 20 The <i class="m">method</i> indicates a specific subcommand. </p><p>The valid methods are:</p><dl class="commandlist"> 21 21 22 22 <dt> 23 23 <b class="cmd">dom</b> <b class="method">parse</b> ?<i class="m">options</i>? ?<i class="m">data</i>?</dt> 24 24 <dd>Parses the XML information and builds up the DOM tree in memory ................................................................................ 55 55 56 56 <dt><b>-simple</b></dt> 57 57 <dd>If <i class="m">-simple</i> is 58 58 specified, a simple but fast parser is used (conforms not fully to XML 59 59 recommendation). That should double parsing and DOM generation speed. The 60 60 encoding of the data is not transformed inside the parser. The simple parser 61 61 does not respect any encoding information in the XML declaration. It skips over 62 -the internal DTD subset and ignores any information in it. Therefor it doesn't 62 +the internal DTD subset and ignores any information in it. Therefore it doesn't 63 63 include defaulted attribute values into the tree, even if the according 64 64 attribute declaration is in the internal subset. It also doesn't expand 65 65 internal or external entity references other than the predefined entities and 66 66 character references.</dd> 67 67 68 68 69 69 ................................................................................ 70 70 <dt><b>-html</b></dt> 71 71 <dd>If <i class="m">-html</i> is specified, a fast HTML parser is 72 72 used, which tries to even parse badly formed HTML into a DOM tree.</dd> 73 73 74 74 75 75 76 76 <dt><b>-html5</b></dt> 77 - <dd>This option is only available, if tDOM was build 77 + <dd>This option is only available if tDOM was build 78 78 with --enable-html5. Try the <i class="m">featureinfo</i> method 79 - if you need to know, if this feature is build in. If 79 + if you need to know if this feature is build in. If 80 80 <i class="m">-html5</i> is specified, the gumbo lib html5 parser 81 - (https://github.com/google/gumbo-parser) is used, to 81 + (https://github.com/google/gumbo-parser) is used to 82 82 build the DOM tree. This is, as far as it goes, XML 83 - namespace aware. Since this probably isn't wanted by a 83 + namespace-aware. Since this probably isn't wanted by a 84 84 lot of users and adds only burden for no good in a lot 85 85 of use cases <i class="m">-html5</i> can be combined with 86 86 <i class="m">-ignorexmlns</i>, in which case all nodes and 87 87 attributes in the DOM tree are not in an XML 88 88 namespace. All tag and attribute names in the DOM tree 89 89 will be lower case, even for foreign elements not in 90 90 the xhtml, svg or mathml namespace. The DOM tree may 91 - include nodes, that the parser inserted, because they 91 + include nodes, that the parser inserted because they 92 92 are implied by the context (as <head>, 93 93 <tbody>, etc.).</dd> 94 94 95 95 96 96 97 97 <dt><b>-json</b></dt> 98 98 <dd>If <i class="m">-json</i> is specified, the <i class="m">data</i> is ................................................................................ 118 118 command or handle is an ordinary DOM doc, which may be 119 119 investigated or modified with the full range of the 120 120 doc and node methods. Please note that the element 121 121 node names and the text node values within the tree 122 122 may be outside of what the appropriate XML productions 123 123 allow.</dd> 124 124 125 + 125 126 127 + <dt> 128 +<b>-jsonmaxnesting</b> <i>integer</i> 129 +</dt> 130 + 131 + <dd>This options only has effect if used together 132 + with the <i class="m">-json</i> option. The current implementation uses recursive descent JSON parser. In order to avoid using excess stack space, any JSON input that has more than a certain levels of nesting is considered invalid. The default maximum nesting is 2000. The option -jsonmaxnesting allows the user to adjust that.</dd> 133 + 134 + 135 + 136 + <dt><b>--</b></dt> 137 + <dd>The option <i class="m">--</i> marks the end of options. 138 + While respected in general this option is only needed 139 + in case of parsing JSON data, which may start with a 140 + "-".</dd> 141 + 142 + 126 143 127 144 <dt><b>-keepEmpties</b></dt> 128 145 <dd>If <i class="m">-keepEmpties</i> is 129 -specified, text nodes, which contain only whitespaces, will be part of the 146 +specified then text nodes which contain only whitespaces will be part of the 130 147 resulting DOM tree. In default case (<i class="m">-keepEmpties</i> not given) those empty 131 148 text nodes are removed at parsing time.</dd> 132 149 133 150 134 151 135 152 <dt> 136 153 <b>-channel</b> <i><channel-ID></i> 137 154 </dt> 138 155 139 156 <dd>If <i class="m">-channel <channel-ID></i> is specified, the 140 157 input to be parsed is read from the specified channel. The encoding setting of 141 158 the channel (via fconfigure -encoding) is respected, ie the data read from the 142 -channel are converted to UTF-8 according to the encoding settings, befor the 159 +channel are converted to UTF-8 according to the encoding settings before the 143 160 data is parsed.</dd> 144 161 145 162 146 163 147 164 <dt> 148 165 <b>-baseurl</b> <i><baseURI></i> 149 166 </dt> 150 167 151 - <dd>If <i class="m">-baseurl <baseURI></i> is specified, the 152 -baseURI is used as the base URI of the document. External entities referenced 153 -in the document are resolved relative to this base URI. This base URI is also 154 -stored within the DOM tree.</dd> 168 + <dd>If <i class="m">-baseurl <baseURI></i> is specified, 169 + the baseURI is used as the base URI of the document. 170 + External entities references in the document are 171 + resolved relative to this base URI. This base URI is 172 + also stored within the DOM tree.</dd> 155 173 156 174 157 175 158 176 <dt> 159 177 <b>-feedbackAfter</b> <i><#bytes></i> 160 178 </dt> 161 179 162 - <dd>If <i class="m">-feedbackAfter <#bytes></i> is specified, the 163 -tcl command given by <i class="m">-feedbackcmd</i> is evaluated at the first 164 -element start within the document (or an external entity) after the 165 -start of the document or external entity or the last such call after 166 -#bytes.For backward compatibility, if no -feedbackcmd is given, but 167 -there is a tcl proc named ::dom::domParseFeedback then this proc is 168 -used as -feedbackcmd. If there isn't such a proc and -feedbackAfter is 169 -used, it is an error to not also use -feedbackcmd. If the called 170 -script raises error, then parsing will be aborted, the 171 -<i class="m">dom parse</i> call returns error, with the script 172 -error msg as error msg. If the called script <i class="m">return 173 --code break</i>, the parsing will abort and the <i class="m">dom 174 -parse</i> call will return the empty string.</dd> 180 + <dd>If <i class="m">-feedbackAfter <#bytes></i> is 181 + specified, the tcl command given by 182 + <i class="m">-feedbackcmd</i> is evaluated at the first element 183 + start within the document (or an external entity) 184 + after the start of the document or external entity or 185 + the last such call after #bytes. For backward 186 + compatibility if no -feedbackcmd is given but there is 187 + a tcl proc named ::dom::domParseFeedback this proc is 188 + used as -feedbackcmd. If there isn't such a proc and 189 + -feedbackAfter is used it is an error to not also use 190 + -feedbackcmd. If the called script raises error, then 191 + parsing will be aborted, the <i class="m">dom parse</i> call 192 + returns error, with the script error msg as error msg. 193 + If the called script <i class="m">return -code break</i>, the 194 + parsing will abort and the <i class="m">dom parse</i> call will 195 + return the empty string.</dd> 175 196 176 197 177 198 178 199 <dt> 179 200 <b>-feedbackcmd</b> <i><script></i> 180 201 </dt> 181 202 ................................................................................ 200 221 201 222 <dd>If <i class="m">-externalentitycommand <script></i> is 202 223 specified, the specified tcl script is called to resolve any external entities 203 224 of the document. The actual evaluated command consists of this option followed 204 225 by three arguments: the base uri, the system identifier of the entity and the 205 226 public identifier of the entity. The base uri and the public identifier may be 206 227 the empty list. The script has to return a tcl list consisting of three 207 -elements. The first element of this list signals, how the external entity is 208 -returned to the processor. At the moment, the two allowed types are "string" 228 +elements. The first element of this list signals how the external entity is 229 +returned to the processor. Currently the two allowed types are "string" 209 230 and "channel". The second element of the list has to be the (absolute) base URI 210 231 of the external entity to be parsed. The third element of the list are data, 211 232 either the already read data out of the external entity as string in the case 212 233 of type "string", or the name of a tcl channel, in the case of type 213 234 "channel". Note that if the script returns a tcl channel, it will not be closed 214 235 by the processor. It must be closed separately if it is no longer 215 -required.</dd> 236 +needed.</dd> 216 237 217 238 218 239 219 240 <dt> 220 241 <b>-useForeignDTD</b> <i><boolean></i> 221 242 </dt> 222 243 223 244 <dd>If <boolean> is true and the document does not have 224 245 an external subset, the parser will call the -externalentitycommand script with 225 -empty values for the systemId and publicID arguments. Pleace notice, that, if 246 +empty values for the systemId and publicID arguments. Please note that if 226 247 the document also doesn't have an internal subset, the 227 248 -startdoctypedeclcommand and -enddoctypedeclcommand scripts, if set, are not 228 249 called. The <i class="m">-useForeignDTD</i> respects </dd> 229 250 230 251 231 252 232 253 <dt> 233 254 <b>-paramentityparsing</b> <i><always|never|notstandalone></i> 234 255 </dt> 235 256 236 - <dd>The <i class="m">-paramentityparsing</i> option controls, if the 237 -parser tries to resolve the external entities (including the external DTD 238 -subset) of the document, while building the DOM 239 -tree. <i class="m">-paramentityparsing</i> requires an argument, which must be either 240 -"always", "never", or "notstandalone". The value "always" means, that the 241 -parser tries to resolves (recursively) all external entities of the XML 242 -source. This is the default, in case <i class="m">-paramentityparsing</i> is omitted. The 243 -value "never" means, that only the given XML source is parsed and no external 244 -entity (including the external subset) will be resolved and parsed. The value 245 -"notstandalone" means, that all external entities will be resolved and parsed, 246 -with the execption of documents, which explicitly states standalone="yes" in 247 -their XML declaration.</dd> 257 + <dd>The <i class="m">-paramentityparsing</i> option controls, 258 + if the parser tries to resolve the external entities 259 + (including the external DTD subset) of the document 260 + while building the DOM tree. 261 + <i class="m">-paramentityparsing</i> requires an argument, which 262 + must be either "always", "never", or "notstandalone". 263 + The value "always" means that the parser tries to 264 + resolves (recursively) all external entities of the 265 + XML source. This is the default in case 266 + <i class="m">-paramentityparsing</i> is omitted. The value 267 + "never" means that only the given XML source is 268 + parsed and no external entity (including the external 269 + subset) will be resolved and parsed. The value 270 + "notstandalone" means, that all external entities will 271 + be resolved and parsed, with the execption of 272 + documents, which explicitly states standalone="yes" in 273 + their XML declaration.</dd> 248 274 249 275 250 276 251 277 252 278 <dt><b>-ignorexmlns</b></dt> 253 279 <dd>It is recommended, that you only use this option 254 - together with the <i class="m">-html5</i> option, if ever. If 255 - this option is given, no node within the created DOM 256 - tree will be internally marked as placed into an XML 257 - Namespace, even if there is a default namespace in 258 - scope for un-prefixed elements or even if the element 259 - has a defined namespace prefix. One consequence is of 260 - this is, that XPath node expressions on such a DOM 261 - tree doesn't work as expected. Prefixed element nodes 262 - can't be selected and element nodes without prefix 263 - will be seen by XPath expressions as if they haven't 264 - any namespace (no matter if they in fact in a default 280 + with the <i class="m">-html5</i> option. If this option is 281 + given, no node within the created DOM tree will be 282 + internally marked as placed into an XML Namespace, 283 + even if there is a default namespace in scope for 284 + un-prefixed elements or even if the element has a 285 + defined namespace prefix. One consequence is that 286 + XPath node expressions on such a DOM tree doesn't work 287 + as expected. Prefixed element nodes can't be selected 288 + and element nodes without prefix will be seen by XPath 289 + expressions as if they are not in any namespace (no 290 + matter if they are in fact should be in a default 265 291 namespace). 266 292 </dd> 267 293 268 294 269 295 </dl> 270 296 <p></p> 271 297 </dd> ................................................................................ 290 316 memory handling as explained above.</dd> 291 317 292 318 293 319 294 320 <dt> 295 321 <b class="cmd">dom</b> <b class="method">createDocumentNode</b> 296 322 ?<i class="m">objVar</i>?</dt> 297 - <dd>Creates a new, 'empty' DOM document object without any element 323 + <dd>Creates a new 'empty' DOM document object without any element 298 324 node. <i class="m">objVar</i> controls the memory handling as explained above.</dd> 299 325 300 326 301 327 302 328 <dt> 303 329 <b class="cmd">dom</b> <b class="method">setResultEncoding</b> ?<i class="m">encodingName</i>?</dt> 304 - <dd>If <i class="m">encodingName</i> is not given the current global 305 -result encoding is returned. Otherwise the global result encoding is set to 306 -<i class="m">encodingName</i>. All character data, attribute values, etc. will 307 -then be converted from UTF-8, which is delivered from the Expat XML parser, to 308 -the given 8 bit encoding at XML/DOM parse time. Valid values for 309 -<i class="m">encodingName</i> are: utf-8, ascii, cp1250, cp1251, cp1252, cp1253, 310 -cp1254, cp1255, cp1256, cp437, cp850, en, iso8859-1, iso8859-2, iso8859-3, 311 -iso8859-4, iso8859-5, iso8859-6, iso8859-7, iso8859-8, iso8859-9, koi8-r.</dd> 330 + <dd>This option is for backward compatibility with Tcl 331 + 8.0. If tDOM is build with any newer Tcl version this option 332 + does not has any effect. If <i class="m">encodingName</i> is not given 333 + the current global result encoding is returned. Otherwise 334 + the global result encoding is set to <i class="m">encodingName</i>. 335 + All character data, attribute values etc. will then be 336 + converted from UTF-8, which is delivered from the Expat XML 337 + parser, to the given 8 bit encoding at XML/DOM parse time. 338 + Valid values for <i class="m">encodingName</i> are: utf-8, ascii, 339 + cp1250, cp1251, cp1252, cp1253, cp1254, cp1255, cp1256, 340 + cp437, cp850, en, iso8859-1, iso8859-2, iso8859-3, 341 + iso8859-4, iso8859-5, iso8859-6, iso8859-7, iso8859-8, 342 + iso8859-9, koi8-r.</dd> 312 343 313 344 314 345 315 346 <dt> 316 347 <b class="cmd">dom</b> <b class="method">createNodeCmd</b> 317 -<i class="m">?-returnNodeCmd?</i> <i class="m">?-tagName name?</i> <i class="m">?-jsonType jsonType</i> <i class="m">(element|comment|text|cdata|pi)Node</i> <i class="m">commandName</i> 348 +<i class="m">?-returnNodeCmd?</i> <i class="m">?-tagName name?</i> <i class="m">?-jsonType jsonType?</i> <i class="m">?-namespace URI?</i> <i class="m">(element|comment|text|cdata|pi)Node</i> <i class="m">commandName</i> 318 349 </dt> 319 350 <dd>This method creates Tcl commands, which in turn create 320 351 tDOM nodes. Tcl commands created by this command are only 321 352 avaliable inside a script given to the domNode methods 322 353 <i class="m">appendFromScript</i> or <i class="m">insertBeforeFromScript</i>. If 323 354 a command created with <i class="m">createNodeCmd</i> is invoked in 324 355 any other context, it will return error. The created command ................................................................................ 336 367 option <i class="m">-returnNodeCmd</i> was given, the command returns the 337 368 created node as Tcl command. If this option was omitted, the command 338 369 returns nothing. Each command creates always the same type of node. 339 370 Which type of node is created by the command is determined by the 340 371 first argument to the <i class="m">createNodeCmd</i>. The syntax of the created 341 372 command depends on the type of the node it creates.</p> 342 373 343 -<p>If the first argument of the method is <i class="m">elementNode</i>, the 344 -created command will create an element node. Without the 374 +<p>If the command type to create is <i class="m">elementNode</i>, the created 375 +command will create an element node, if called. Without the 345 376 <i class="m">-tagName</i> option the tag name of the created node is 346 377 <i class="m">commandName</i> without namespace qualifiers. If the 347 378 <i class="m">-tagName</i> option was given then the created command the created 348 379 elements will have this tag name. If the <i class="m">-jsonType</i> option was 349 -given then the created node elements will have the given JSON type. 350 -The syntax of the created command is:</p> 380 +given then the created node elements will have the given JSON type. If 381 +the <i class="m">-namespace</i> option is given the created element node will be 382 +XML namespaced and in the namespace given by the option. The element 383 +name will be literal as given either by the command name or the 384 +<i class="m">-tagname</i> option, if that was given. An appropriate XML 385 +namespace declaration will be automatically added, to bind the prefix 386 +(if the element name has one) or the default namespace (if the element 387 +name hasn't a prefix) to the namespace if such a binding isn't in 388 +scope.</p> 389 + 390 +<p>The syntax of the created command is:</p> 351 391 352 392 <pre class="syntax"> 353 393 <b class="cmd">elementNodeCmd</b> <i class="m">?attributeName attributeValue ...? ?script?</i> 354 394 <b class="cmd">elementNodeCmd</b> <i class="m">?-attributeName attributeValue ...? ?script?</i> 355 395 <b class="cmd">elementNodeCmd</b> <i class="m">name_value_list script</i> 356 396 </pre> 357 397 ................................................................................ 402 442 403 443 404 444 405 445 <dt> 406 446 <b class="cmd">dom</b> <b class="method">setStoreLineColumn</b> <i class="m">?boolean</i>?</dt> 407 447 <dd>If switched on, the DOM nodes will contain line and column 408 448 position information for the original XML document after parsing. The default 409 -is, not to store line and column position information.</dd> 449 +is not to store line and column position information.</dd> 410 450 411 451 412 452 413 453 <dt> 414 454 <b class="cmd">dom</b> <b class="method">setNameCheck</b> <i class="m">?boolean</i>?</dt> 415 455 <dd>If NameCheck is true, every method which expects an XML Name, 416 456 a full qualified name or a processing instructing target will check, if the 417 -given string is valid according to his production rule. For commands created 457 +given string is valid according to its production rule. For commands created 418 458 with the <i class="m">createNodeCmd</i> method to be used in the context of 419 459 <i class="m">appendFromScript</i> the status of the flag at creation time 420 460 decides. If NameCheck is true at creation time, the command will 421 -check his arguments, otherwise not. The <i class="m">setNameCheck</i> 461 +check its arguments, otherwise not. The <i class="m">setNameCheck</i> 422 462 set this flag. It returns the current NameCheck flag state. The 423 463 default state for NameCheck is true. </dd> 424 464 425 465 426 466 427 467 <dt> 428 468 <b class="cmd">dom</b> <b class="method">setTextCheck</b> <i class="m">?boolean</i>?</dt> 429 469 <dd>If TextCheck is true, every command which expects XML Chars, 430 470 a comment, a CDATA section value or a processing instructing value will check, 431 -if the given string is valid according to his production rule. For commands 471 +if the given string is valid according to its production rule. For commands 432 472 created with the <i class="m">createNodeCmd</i> method to be used in the 433 473 context of <i class="m">appendFromScript</i> the status of the flag at 434 474 creation time decides. If TextCheck is true at creation time, the 435 -command will check his arguments, otherwise not.The 436 -<i class="m">setTextCheck</i> method set this flag. It returns the current 475 +command will check its arguments, otherwise not.The 476 +<i class="m">setTextCheck</i> method sets this flag. It returns the current 437 477 TextCheck flag state. The default state for TextCheck is true.</dd> 438 478 439 479 440 480 441 481 <dt> 442 482 <b class="cmd">dom</b> <b class="method">setObjectCommands</b> ?<i class="m">(automatic|token|command)</i>?</dt> 443 - <dd>Controls, if documents and nodes are created as tcl commands or 483 + <dd>Controls if documents and nodes are created as tcl commands or 444 484 as token to be 445 485 used with the domNode and domDoc commands. If the mode is 446 486 'automatic', then methods used at tcl commands will create tcl 447 487 commands and methods used at doc or node tokes will create tokens. If 448 488 the mode is 'command' then always tcl commands will be created. If 449 489 the mode is 'token', then always token will be created. The method 450 490 returns the current mode. This method is an experimental interface.</dd> 451 491 452 492 453 493 454 494 <dt> 455 495 <b class="cmd">dom</b> <b class="method">isName</b> <i class="m">name</i> 456 496 </dt> 457 - <dd>Returns 1, if <i class="m">name</i> is a valid XML Name according to 497 + <dd>Returns 1 if <i class="m">name</i> is a valid XML Name according to 458 498 production 5 of the <a href="http://www.w3.org/TR/2004/REC-xml-20040204/#NT-NameChar">XML 459 - 1.0</a> recommendation. This means, that <i class="m">name</i> is a valid 499 + 1.0</a> recommendation. This means that <i class="m">name</i> is a valid 460 500 XML element or attribute name. Otherwise it returns 0.</dd> 461 501 462 502 463 503 464 504 <dt> 465 505 <b class="cmd">dom</b> <b class="method">isPIName</b> <i class="m">name</i> 466 506 </dt> 467 - <dd>Returns 1, if <i class="m">name</i> is a valid XML processing instruction 507 + <dd>Returns 1 if <i class="m">name</i> is a valid XML processing instruction 468 508 target according to 469 509 production 17 of the <a href="http://www.w3.org/TR/2000/REC-xml-20001006.html">XML 1.0</a> recommendation. Otherwise it returns 0.</dd> 470 510 471 511 472 512 473 513 <dt> 474 514 <b class="cmd">dom</b> <b class="method">isNCName</b> <i class="m">name</i> 475 515 </dt> 476 - <dd>Returns 1, if <i class="m">name</i> is a valid NCName according 516 + <dd>Returns 1 if <i class="m">name</i> is a valid NCName according 477 517 to production 4 of the of the <a href="http://www.w3.org/TR/1999/REC-xml-names-19990114">Namespaces in XML</a> recommendation. Otherwise it returns 478 518 0.</dd> 479 519 480 520 481 521 482 522 <dt> 483 523 <b class="cmd">dom</b> <b class="method">isQName</b> <i class="m">name</i> 484 524 </dt> 485 - <dd>Returns 1, if <i class="m">name</i> is a valid QName according 525 + <dd>Returns 1 if <i class="m">name</i> is a valid QName according 486 526 to production 6 of the of the <a href="http://www.w3.org/TR/1999/REC-xml-names-19990114">Namespaces in XML</a> recommendation. Otherwise it returns 487 527 0.</dd> 488 528 489 529 490 530 491 531 <dt> 492 532 <b class="cmd">dom</b> <b class="method">isCharData</b> 493 533 <i class="m">string</i> 494 534 </dt> 495 - <dd>Returns 1, if every character in <i class="m">string</i> is 535 + <dd>Returns 1 if every character in <i class="m">string</i> is 496 536 a valid XML Char according to production 2 of the <a href="http://www.w3.org/TR/2000/REC-xml-20001006.html">XML 1.0</a> 497 537 recommendation. Otherwise it returns 0.</dd> 498 538 499 539 500 540 501 541 <dt> 502 542 <b class="cmd">dom</b> <b class="method">isBMPCharData</b> 503 543 <i class="m">string</i> 504 544 </dt> 505 - <dd>Returns 1, if every character in <i class="m">string</i> is 545 + <dd>Returns 1 if every character in <i class="m">string</i> is 506 546 a valid XML Char with a Unicode code point within the Basic 507 547 Multilingual Plane (that means, that every character within the string 508 548 is at most 3 bytes long). Otherwise it returns 0.</dd> 509 549 510 550 511 551 512 552 <dt> 513 553 <b class="cmd">dom</b> <b class="method">isComment</b> 514 554 <i class="m">string</i> 515 555 </dt> 516 - <dd>Returns 1, if <i class="m">string</i> is 556 + <dd>Returns 1 if <i class="m">string</i> is 517 557 a valid comment according to production 15 of the <a href="http://www.w3.org/TR/2000/REC-xml-20001006.html">XML 1.0</a> 518 558 recommendation. Otherwise it returns 0.</dd> 519 559 520 560 521 561 522 562 <dt> 523 563 <b class="cmd">dom</b> <b class="method">isCDATA</b> 524 564 <i class="m">string</i> 525 565 </dt> 526 - <dd>Returns 1, if <i class="m">string</i> is 566 + <dd>Returns 1 if <i class="m">string</i> is 527 567 valid according to production 20 of the <a href="http://www.w3.org/TR/2000/REC-xml-20001006.html">XML 1.0</a> 528 568 recommendation. Otherwise it returns 0.</dd> 529 569 530 570 531 571 532 572 <dt> 533 573 <b class="cmd">dom</b> <b class="method">isPIValue</b> 534 574 <i class="m">string</i> 535 575 </dt> 536 - <dd>Returns 1, if <i class="m">string</i> is 576 + <dd>Returns 1 if <i class="m">string</i> is 537 577 valid according to production 16 of the <a href="http://www.w3.org/TR/2000/REC-xml-20001006.html">XML 1.0</a> 538 578 recommendation. Otherwise it returns 0.</dd> 539 579 540 580 541 581 542 582 <dt> 543 583 <b class="cmd">dom</b> <b class="method">featureinfo</b> <i class="m">feature</i> ................................................................................ 546 586 build options and the expat version. The valid values for 547 587 the <i class="m">feature</i> argument are: 548 588 <dl class="optlist"> 549 589 550 590 <dt><b>expatversion</b></dt> 551 591 <dd>Returns the version of the underlyling expat 552 592 version as string, something like 553 - "exapt_2.1.0". This is. what the expat API 593 + "exapt_2.1.0". This is what the expat API 554 594 function XML_ExpatVersion() returns.</dd> 555 595 556 596 557 597 <dt><b>expatmajorversion</b></dt> 558 598 <dd>Returns the major version of the underlyling 559 599 expat version as integer.</dd> 560 600 ................................................................................ 566 606 567 607 <dt><b>expatmicroversion</b></dt> 568 608 <dd>Returns the micro version of the underlyling 569 609 expat version as integer.</dd> 570 610 571 611 572 612 <dt><b>dtd</b></dt> 573 - <dd>Returns as boolean, if build with 613 + <dd>Returns as boolean if build with 574 614 <i class="m">--enable-dtd</i>.</dd> 575 615 576 616 577 617 <dt><b>ns</b></dt> 578 - <dd>Returns as boolean, if build with 618 + <dd>Returns as boolean if build with 579 619 <i class="m">--enable-ns</i>.</dd> 580 620 581 621 582 622 <dt><b>unknown</b></dt> 583 - <dd>Returns as boolean, if build with 623 + <dd>Returns as boolean if build with 584 624 <i class="m">--enable-unknown</i>.</dd> 585 625 586 626 587 627 <dt><b>tdomalloc</b></dt> 588 - <dd>Returns as boolean, if build with 628 + <dd>Returns as boolean if build with 589 629 <i class="m">--enable-tdomalloc</i>.</dd> 590 630 591 631 592 632 <dt><b>lessns</b></dt> 593 - <dd>Returns as boolean, if build with 633 + <dd>Returns as boolean if build with 594 634 <i class="m">--enable-lessns</i>.</dd> 595 635 596 636 597 637 <dt><b>TCL_UTF_MAX</b></dt> 598 638 <dd>Returns the TCL_UTF_MAX value of the tcl 599 639 core, tDOM was build with as integer</dd> 600 640 ................................................................................ 604 644 <i class="m">--enable-html5</i>.</dd> 605 645 606 646 </dl> 607 647 </dd> 608 648 609 649 </dl> 610 650 611 -<h2><a name="SECTid0xb84020">KEYWORDS</a></h2><p class="keywords"> 651 +<h2><a name="SECTid0x1f86b10">KEYWORDS</a></h2><p class="keywords"> 612 652 <a class="keyword" href="keyword-index.html#KW-XML">XML</a>, <a class="keyword" href="keyword-index.html#KW-DOM">DOM</a>, <a class="keyword" href="keyword-index.html#KW-document">document</a>, <a class="keyword" href="keyword-index.html#KW-node">node</a>, <a class="keyword" href="keyword-index.html#KW-parsing">parsing</a> 613 653 </p> 614 654 </div><hr class="navsep"><div class="navbar" align="center"> 615 -<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> 655 +<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> · <a class="navaid" href="http://tdom.org">Repository</a> 616 656 </div> 617 657 </body> 618 658 </html>
Changes to doc/dom.n.
226 226 The valid options are: 227 227 .IP "\fB-simple\fR" 228 228 If \fI-simple\fR is 229 229 specified, a simple but fast parser is used (conforms not fully to XML 230 230 recommendation). That should double parsing and DOM generation speed. The 231 231 encoding of the data is not transformed inside the parser. The simple parser 232 232 does not respect any encoding information in the XML declaration. It skips over 233 -the internal DTD subset and ignores any information in it. Therefor it doesn't 233 +the internal DTD subset and ignores any information in it. Therefore it doesn't 234 234 include defaulted attribute values into the tree, even if the according 235 235 attribute declaration is in the internal subset. It also doesn't expand 236 236 internal or external entity references other than the predefined entities and 237 237 character references. 238 238 .IP "\fB-html\fR" 239 239 If \fI-html\fR is specified, a fast HTML parser is 240 240 used, which tries to even parse badly formed HTML into a DOM tree. 241 241 .IP "\fB-html5\fR" 242 -This option is only available, if tDOM was build 242 +This option is only available if tDOM was build 243 243 with --enable-html5. Try the \fIfeatureinfo\fR method 244 -if you need to know, if this feature is build in. If 244 +if you need to know if this feature is build in. If 245 245 \&\fI-html5\fR is specified, the gumbo lib html5 parser 246 -(https://github.com/google/gumbo-parser) is used, to 246 +(https://github.com/google/gumbo-parser) is used to 247 247 build the DOM tree. This is, as far as it goes, XML 248 -namespace aware. Since this probably isn't wanted by a 248 +namespace-aware. Since this probably isn't wanted by a 249 249 lot of users and adds only burden for no good in a lot 250 250 of use cases \fI-html5\fR can be combined with 251 251 \&\fI-ignorexmlns\fR, in which case all nodes and 252 252 attributes in the DOM tree are not in an XML 253 253 namespace. All tag and attribute names in the DOM tree 254 254 will be lower case, even for foreign elements not in 255 255 the xhtml, svg or mathml namespace. The DOM tree may 256 -include nodes, that the parser inserted, because they 256 +include nodes, that the parser inserted because they 257 257 are implied by the context (as <head>, 258 258 <tbody>, etc.). 259 259 .IP "\fB-json\fR" 260 260 If \fI-json\fR is specified, the \fIdata\fR is 261 261 expected to be a valid JSON string (according to RFC 262 262 7159). The command returns an ordinary DOM document 263 263 with nesting token inside the JSON data translated ................................................................................ 279 279 from this JSON type information the returned doc 280 280 command or handle is an ordinary DOM doc, which may be 281 281 investigated or modified with the full range of the 282 282 doc and node methods. Please note that the element 283 283 node names and the text node values within the tree 284 284 may be outside of what the appropriate XML productions 285 285 allow. 286 +.IP "\fB-jsonmaxnesting \fIinteger\fP\fR" 287 +This options only has effect if used together 288 +with the \fI-json\fR option. The current implementation uses recursive descent JSON parser. In order to avoid using excess stack space, any JSON input that has more than a certain levels of nesting is considered invalid. The default maximum nesting is 2000. The option -jsonmaxnesting allows the user to adjust that. 289 +.IP "\fB--\fR" 290 +The option \fI--\fR marks the end of options. 291 +While respected in general this option is only needed 292 +in case of parsing JSON data, which may start with a 293 +"-". 286 294 .IP "\fB-keepEmpties\fR" 287 295 If \fI-keepEmpties\fR is 288 -specified, text nodes, which contain only whitespaces, will be part of the 296 +specified then text nodes which contain only whitespaces will be part of the 289 297 resulting DOM tree. In default case (\fI-keepEmpties\fR not given) those empty 290 298 text nodes are removed at parsing time. 291 299 .IP "\fB-channel \fI<channel-ID>\fP\fR" 292 300 If \fI-channel <channel-ID>\fR is specified, the 293 301 input to be parsed is read from the specified channel. The encoding setting of 294 302 the channel (via fconfigure -encoding) is respected, ie the data read from the 295 -channel are converted to UTF-8 according to the encoding settings, befor the 303 +channel are converted to UTF-8 according to the encoding settings before the 296 304 data is parsed. 297 305 .IP "\fB-baseurl \fI<baseURI>\fP\fR" 298 -If \fI-baseurl <baseURI>\fR is specified, the 299 -baseURI is used as the base URI of the document. External entities referenced 300 -in the document are resolved relative to this base URI. This base URI is also 301 -stored within the DOM tree. 306 +If \fI-baseurl <baseURI>\fR is specified, 307 +the baseURI is used as the base URI of the document. 308 +External entities references in the document are 309 +resolved relative to this base URI. This base URI is 310 +also stored within the DOM tree. 302 311 .IP "\fB-feedbackAfter \fI<#bytes>\fP\fR" 303 -If \fI-feedbackAfter <#bytes>\fR is specified, the 304 -tcl command given by \fI-feedbackcmd\fR is evaluated at the first 305 -element start within the document (or an external entity) after the 306 -start of the document or external entity or the last such call after 307 -#bytes.For backward compatibility, if no -feedbackcmd is given, but 308 -there is a tcl proc named ::dom::domParseFeedback then this proc is 309 -used as -feedbackcmd. If there isn't such a proc and -feedbackAfter is 310 -used, it is an error to not also use -feedbackcmd. If the called 311 -script raises error, then parsing will be aborted, the 312 -\&\fIdom parse\fR call returns error, with the script 313 -error msg as error msg. If the called script \fIreturn 314 --code break\fR, the parsing will abort and the \fIdom 315 -parse\fR call will return the empty string. 312 +If \fI-feedbackAfter <#bytes>\fR is 313 +specified, the tcl command given by 314 +\&\fI-feedbackcmd\fR is evaluated at the first element 315 +start within the document (or an external entity) 316 +after the start of the document or external entity or 317 +the last such call after #bytes. For backward 318 +compatibility if no -feedbackcmd is given but there is 319 +a tcl proc named ::dom::domParseFeedback this proc is 320 +used as -feedbackcmd. If there isn't such a proc and 321 +-feedbackAfter is used it is an error to not also use 322 +-feedbackcmd. If the called script raises error, then 323 +parsing will be aborted, the \fIdom parse\fR call 324 +returns error, with the script error msg as error msg. 325 +If the called script \fIreturn -code break\fR, the 326 +parsing will abort and the \fIdom parse\fR call will 327 +return the empty string. 316 328 .IP "\fB-feedbackcmd \fI<script>\fP\fR" 317 329 If \fI-feedbackcmd <script>\fR is specified, the 318 330 script \fIscript\fR is evaluated at the first 319 331 element start within the document (or an external entity) after the 320 332 start of the document or external entity or the last such call after 321 333 #bytes value given by the \fI-feedbackAfter\fR option. If 322 334 \&\fI-feedbackAfter\fR isn't given, using this option ................................................................................ 329 341 .IP "\fB-externalentitycommand \fI<script>\fP\fR" 330 342 If \fI-externalentitycommand <script>\fR is 331 343 specified, the specified tcl script is called to resolve any external entities 332 344 of the document. The actual evaluated command consists of this option followed 333 345 by three arguments: the base uri, the system identifier of the entity and the 334 346 public identifier of the entity. The base uri and the public identifier may be 335 347 the empty list. The script has to return a tcl list consisting of three 336 -elements. The first element of this list signals, how the external entity is 337 -returned to the processor. At the moment, the two allowed types are "string" 348 +elements. The first element of this list signals how the external entity is 349 +returned to the processor. Currently the two allowed types are "string" 338 350 and "channel". The second element of the list has to be the (absolute) base URI 339 351 of the external entity to be parsed. The third element of the list are data, 340 352 either the already read data out of the external entity as string in the case 341 353 of type "string", or the name of a tcl channel, in the case of type 342 354 "channel". Note that if the script returns a tcl channel, it will not be closed 343 355 by the processor. It must be closed separately if it is no longer 344 -required. 356 +needed. 345 357 .IP "\fB-useForeignDTD \fI<boolean>\fP\fR" 346 358 If <boolean> is true and the document does not have 347 359 an external subset, the parser will call the -externalentitycommand script with 348 -empty values for the systemId and publicID arguments. Pleace notice, that, if 360 +empty values for the systemId and publicID arguments. Please note that if 349 361 the document also doesn't have an internal subset, the 350 362 -startdoctypedeclcommand and -enddoctypedeclcommand scripts, if set, are not 351 363 called. The \fI-useForeignDTD\fR respects 352 364 .IP "\fB-paramentityparsing \fI<always|never|notstandalone>\fP\fR" 353 -The \fI-paramentityparsing\fR option controls, if the 354 -parser tries to resolve the external entities (including the external DTD 355 -subset) of the document, while building the DOM 356 -tree. \fI-paramentityparsing\fR requires an argument, which must be either 357 -"always", "never", or "notstandalone". The value "always" means, that the 358 -parser tries to resolves (recursively) all external entities of the XML 359 -source. This is the default, in case \fI-paramentityparsing\fR is omitted. The 360 -value "never" means, that only the given XML source is parsed and no external 361 -entity (including the external subset) will be resolved and parsed. The value 362 -"notstandalone" means, that all external entities will be resolved and parsed, 363 -with the execption of documents, which explicitly states standalone="yes" in 365 +The \fI-paramentityparsing\fR option controls, 366 +if the parser tries to resolve the external entities 367 +(including the external DTD subset) of the document 368 +while building the DOM tree. 369 +\&\fI-paramentityparsing\fR requires an argument, which 370 +must be either "always", "never", or "notstandalone". 371 +The value "always" means that the parser tries to 372 +resolves (recursively) all external entities of the 373 +XML source. This is the default in case 374 +\&\fI-paramentityparsing\fR is omitted. The value 375 +"never" means that only the given XML source is 376 +parsed and no external entity (including the external 377 +subset) will be resolved and parsed. The value 378 +"notstandalone" means, that all external entities will 379 +be resolved and parsed, with the execption of 380 +documents, which explicitly states standalone="yes" in 364 381 their XML declaration. 365 382 .IP "\fB-ignorexmlns\fR" 366 383 It is recommended, that you only use this option 367 -together with the \fI-html5\fR option, if ever. If 368 -this option is given, no node within the created DOM 369 -tree will be internally marked as placed into an XML 370 -Namespace, even if there is a default namespace in 371 -scope for un-prefixed elements or even if the element 372 -has a defined namespace prefix. One consequence is of 373 -this is, that XPath node expressions on such a DOM 374 -tree doesn't work as expected. Prefixed element nodes 375 -can't be selected and element nodes without prefix 376 -will be seen by XPath expressions as if they haven't 377 -any namespace (no matter if they in fact in a default 384 +with the \fI-html5\fR option. If this option is 385 +given, no node within the created DOM tree will be 386 +internally marked as placed into an XML Namespace, 387 +even if there is a default namespace in scope for 388 +un-prefixed elements or even if the element has a 389 +defined namespace prefix. One consequence is that 390 +XPath node expressions on such a DOM tree doesn't work 391 +as expected. Prefixed element nodes can't be selected 392 +and element nodes without prefix will be seen by XPath 393 +expressions as if they are not in any namespace (no 394 +matter if they are in fact should be in a default 378 395 namespace). 379 396 .PP 380 397 .RE 381 398 .TP 382 399 \&\fB\fBdom\fP \fBcreateDocument\fP \fIdocElemName\fB ?\fIobjVar\fB? 383 400 \&\fRCreates a new DOM document object with one element node with 384 401 node name \fIdocElemName\fR. The \fIobjVar\fR controls the ................................................................................ 387 404 \&\fB\fBdom\fP \fBcreateDocumentNS\fP \fIuri\fB \fIdocElemName\fB ?\fIobjVar\fB? 388 405 \&\fRCreates a new DOM document object with one element node with 389 406 node name \fIdocElemName\fR. \fIUri\fR gives the namespace of the 390 407 document element to create. The \fIobjVar\fR controls the 391 408 memory handling as explained above. 392 409 .TP 393 410 \&\fB\fBdom\fP \fBcreateDocumentNode\fP ?\fIobjVar\fB? 394 -\&\fRCreates a new, 'empty' DOM document object without any element 411 +\&\fRCreates a new 'empty' DOM document object without any element 395 412 node. \fIobjVar\fR controls the memory handling as explained above. 396 413 .TP 397 414 \&\fB\fBdom\fP \fBsetResultEncoding\fP ?\fIencodingName\fB? 398 -\&\fRIf \fIencodingName\fR is not given the current global 399 -result encoding is returned. Otherwise the global result encoding is set to 400 -\&\fIencodingName\fR. All character data, attribute values, etc. will 401 -then be converted from UTF-8, which is delivered from the Expat XML parser, to 402 -the given 8 bit encoding at XML/DOM parse time. Valid values for 403 -\&\fIencodingName\fR are: utf-8, ascii, cp1250, cp1251, cp1252, cp1253, 404 -cp1254, cp1255, cp1256, cp437, cp850, en, iso8859-1, iso8859-2, iso8859-3, 405 -iso8859-4, iso8859-5, iso8859-6, iso8859-7, iso8859-8, iso8859-9, koi8-r. 415 +\&\fRThis option is for backward compatibility with Tcl 416 +8.0. If tDOM is build with any newer Tcl version this option 417 +does not has any effect. If \fIencodingName\fR is not given 418 +the current global result encoding is returned. Otherwise 419 +the global result encoding is set to \fIencodingName\fR. 420 +All character data, attribute values etc. will then be 421 +converted from UTF-8, which is delivered from the Expat XML 422 +parser, to the given 8 bit encoding at XML/DOM parse time. 423 +Valid values for \fIencodingName\fR are: utf-8, ascii, 424 +cp1250, cp1251, cp1252, cp1253, cp1254, cp1255, cp1256, 425 +cp437, cp850, en, iso8859-1, iso8859-2, iso8859-3, 426 +iso8859-4, iso8859-5, iso8859-6, iso8859-7, iso8859-8, 427 +iso8859-9, koi8-r. 406 428 .TP 407 -\&\fB\fBdom\fP \fBcreateNodeCmd\fP \fI?-returnNodeCmd?\fB \fI?-tagName name?\fB \fI?-jsonType jsonType\fB \fI(element|comment|text|cdata|pi)Node\fB \fIcommandName\fB 429 +\&\fB\fBdom\fP \fBcreateNodeCmd\fP \fI?-returnNodeCmd?\fB \fI?-tagName name?\fB \fI?-jsonType jsonType?\fB \fI?-namespace URI?\fB \fI(element|comment|text|cdata|pi)Node\fB \fIcommandName\fB 408 430 \&\fRThis method creates Tcl commands, which in turn create 409 431 tDOM nodes. Tcl commands created by this command are only 410 432 avaliable inside a script given to the domNode methods 411 433 \&\fIappendFromScript\fR or \fIinsertBeforeFromScript\fR. If 412 434 a command created with \fIcreateNodeCmd\fR is invoked in 413 435 any other context, it will return error. The created command 414 436 \&\fIcommandName\fR replaces any existing command or ................................................................................ 426 448 option \fI-returnNodeCmd\fR was given, the command returns the 427 449 created node as Tcl command. If this option was omitted, the command 428 450 returns nothing. Each command creates always the same type of node. 429 451 Which type of node is created by the command is determined by the 430 452 first argument to the \fIcreateNodeCmd\fR. The syntax of the created 431 453 command depends on the type of the node it creates. 432 454 .PP 433 -If the first argument of the method is \fIelementNode\fR, the 434 -created command will create an element node. Without the 455 +If the command type to create is \fIelementNode\fR, the created 456 +command will create an element node, if called. Without the 435 457 \&\fI-tagName\fR option the tag name of the created node is 436 458 \&\fIcommandName\fR without namespace qualifiers. If the 437 459 \&\fI-tagName\fR option was given then the created command the created 438 460 elements will have this tag name. If the \fI-jsonType\fR option was 439 -given then the created node elements will have the given JSON type. 461 +given then the created node elements will have the given JSON type. If 462 +the \fI-namespace\fR option is given the created element node will be 463 +XML namespaced and in the namespace given by the option. The element 464 +name will be literal as given either by the command name or the 465 +\&\fI-tagname\fR option, if that was given. An appropriate XML 466 +namespace declaration will be automatically added, to bind the prefix 467 +(if the element name has one) or the default namespace (if the element 468 +name hasn't a prefix) to the namespace if such a binding isn't in 469 +scope. 470 +.PP 440 471 The syntax of the created command is: 441 472 442 473 443 474 444 475 .CS 445 476 446 477 \&\fBelementNodeCmd\fP \fI?attributeName attributeValue ...? ?script?\fR ................................................................................ 504 535 505 536 .CE 506 537 .RE 507 538 .TP 508 539 \&\fB\fBdom\fP \fBsetStoreLineColumn\fP \fI?boolean\fB? 509 540 \&\fRIf switched on, the DOM nodes will contain line and column 510 541 position information for the original XML document after parsing. The default 511 -is, not to store line and column position information. 542 +is not to store line and column position information. 512 543 .TP 513 544 \&\fB\fBdom\fP \fBsetNameCheck\fP \fI?boolean\fB? 514 545 \&\fRIf NameCheck is true, every method which expects an XML Name, 515 546 a full qualified name or a processing instructing target will check, if the 516 -given string is valid according to his production rule. For commands created 547 +given string is valid according to its production rule. For commands created 517 548 with the \fIcreateNodeCmd\fR method to be used in the context of 518 549 \&\fIappendFromScript\fR the status of the flag at creation time 519 550 decides. If NameCheck is true at creation time, the command will 520 -check his arguments, otherwise not. The \fIsetNameCheck\fR 551 +check its arguments, otherwise not. The \fIsetNameCheck\fR 521 552 set this flag. It returns the current NameCheck flag state. The 522 553 default state for NameCheck is true. 523 554 .TP 524 555 \&\fB\fBdom\fP \fBsetTextCheck\fP \fI?boolean\fB? 525 556 \&\fRIf TextCheck is true, every command which expects XML Chars, 526 557 a comment, a CDATA section value or a processing instructing value will check, 527 -if the given string is valid according to his production rule. For commands 558 +if the given string is valid according to its production rule. For commands 528 559 created with the \fIcreateNodeCmd\fR method to be used in the 529 560 context of \fIappendFromScript\fR the status of the flag at 530 561 creation time decides. If TextCheck is true at creation time, the 531 -command will check his arguments, otherwise not.The 532 -\&\fIsetTextCheck\fR method set this flag. It returns the current 562 +command will check its arguments, otherwise not.The 563 +\&\fIsetTextCheck\fR method sets this flag. It returns the current 533 564 TextCheck flag state. The default state for TextCheck is true. 534 565 .TP 535 566 \&\fB\fBdom\fP \fBsetObjectCommands\fP ?\fI(automatic|token|command)\fB? 536 -\&\fRControls, if documents and nodes are created as tcl commands or 567 +\&\fRControls if documents and nodes are created as tcl commands or 537 568 as token to be 538 569 used with the domNode and domDoc commands. If the mode is 539 570 \&'automatic', then methods used at tcl commands will create tcl 540 571 commands and methods used at doc or node tokes will create tokens. If 541 572 the mode is 'command' then always tcl commands will be created. If 542 573 the mode is 'token', then always token will be created. The method 543 574 returns the current mode. This method is an experimental interface. 544 575 .TP 545 576 \&\fB\fBdom\fP \fBisName\fP \fIname\fB 546 -\&\fRReturns 1, if \fIname\fR is a valid XML Name according to 577 +\&\fRReturns 1 if \fIname\fR is a valid XML Name according to 547 578 production 5 of the XML 548 -1.0 recommendation. This means, that \fIname\fR is a valid 579 +1.0 recommendation. This means that \fIname\fR is a valid 549 580 XML element or attribute name. Otherwise it returns 0. 550 581 .TP 551 582 \&\fB\fBdom\fP \fBisPIName\fP \fIname\fB 552 -\&\fRReturns 1, if \fIname\fR is a valid XML processing instruction 583 +\&\fRReturns 1 if \fIname\fR is a valid XML processing instruction 553 584 target according to 554 585 production 17 of the XML 1.0 recommendation. Otherwise it returns 0. 555 586 .TP 556 587 \&\fB\fBdom\fP \fBisNCName\fP \fIname\fB 557 -\&\fRReturns 1, if \fIname\fR is a valid NCName according 588 +\&\fRReturns 1 if \fIname\fR is a valid NCName according 558 589 to production 4 of the of the Namespaces in XML recommendation. Otherwise it returns 559 590 0. 560 591 .TP 561 592 \&\fB\fBdom\fP \fBisQName\fP \fIname\fB 562 -\&\fRReturns 1, if \fIname\fR is a valid QName according 593 +\&\fRReturns 1 if \fIname\fR is a valid QName according 563 594 to production 6 of the of the Namespaces in XML recommendation. Otherwise it returns 564 595 0. 565 596 .TP 566 597 \&\fB\fBdom\fP \fBisCharData\fP \fIstring\fB 567 -\&\fRReturns 1, if every character in \fIstring\fR is 598 +\&\fRReturns 1 if every character in \fIstring\fR is 568 599 a valid XML Char according to production 2 of the XML 1.0 569 600 recommendation. Otherwise it returns 0. 570 601 .TP 571 602 \&\fB\fBdom\fP \fBisBMPCharData\fP \fIstring\fB 572 -\&\fRReturns 1, if every character in \fIstring\fR is 603 +\&\fRReturns 1 if every character in \fIstring\fR is 573 604 a valid XML Char with a Unicode code point within the Basic 574 605 Multilingual Plane (that means, that every character within the string 575 606 is at most 3 bytes long). Otherwise it returns 0. 576 607 .TP 577 608 \&\fB\fBdom\fP \fBisComment\fP \fIstring\fB 578 -\&\fRReturns 1, if \fIstring\fR is 609 +\&\fRReturns 1 if \fIstring\fR is 579 610 a valid comment according to production 15 of the XML 1.0 580 611 recommendation. Otherwise it returns 0. 581 612 .TP 582 613 \&\fB\fBdom\fP \fBisCDATA\fP \fIstring\fB 583 -\&\fRReturns 1, if \fIstring\fR is 614 +\&\fRReturns 1 if \fIstring\fR is 584 615 valid according to production 20 of the XML 1.0 585 616 recommendation. Otherwise it returns 0. 586 617 .TP 587 618 \&\fB\fBdom\fP \fBisPIValue\fP \fIstring\fB 588 -\&\fRReturns 1, if \fIstring\fR is 619 +\&\fRReturns 1 if \fIstring\fR is 589 620 valid according to production 16 of the XML 1.0 590 621 recommendation. Otherwise it returns 0. 591 622 .TP 592 623 \&\fB\fBdom\fP \fBfeatureinfo\fP \fIfeature\fB 593 624 \&\fRThis method provides information about the used 594 625 build options and the expat version. The valid values for 595 626 the \fIfeature\fR argument are: 596 627 .RS 597 628 .IP "\fBexpatversion\fR" 598 629 Returns the version of the underlyling expat 599 630 version as string, something like 600 -"exapt_2.1.0". This is. what the expat API 631 +"exapt_2.1.0". This is what the expat API 601 632 function XML_ExpatVersion() returns. 602 633 .IP "\fBexpatmajorversion\fR" 603 634 Returns the major version of the underlyling 604 635 expat version as integer. 605 636 .IP "\fBexpatminorversion\fR" 606 637 Returns the minor version of the underlyling 607 638 expat version as integer. 608 639 .IP "\fBexpatmicroversion\fR" 609 640 Returns the micro version of the underlyling 610 641 expat version as integer. 611 642 .IP "\fBdtd\fR" 612 -Returns as boolean, if build with 643 +Returns as boolean if build with 613 644 \&\fI--enable-dtd\fR. 614 645 .IP "\fBns\fR" 615 -Returns as boolean, if build with 646 +Returns as boolean if build with 616 647 \&\fI--enable-ns\fR. 617 648 .IP "\fBunknown\fR" 618 -Returns as boolean, if build with 649 +Returns as boolean if build with 619 650 \&\fI--enable-unknown\fR. 620 651 .IP "\fBtdomalloc\fR" 621 -Returns as boolean, if build with 652 +Returns as boolean if build with 622 653 \&\fI--enable-tdomalloc\fR. 623 654 .IP "\fBlessns\fR" 624 -Returns as boolean, if build with 655 +Returns as boolean if build with 625 656 \&\fI--enable-lessns\fR. 626 657 .IP "\fBTCL_UTF_MAX\fR" 627 658 Returns the TCL_UTF_MAX value of the tcl 628 659 core, tDOM was build with as integer 629 660 .IP "\fBhtml5\fR" 630 661 Returns as boolean, if build with 631 662 \&\fI--enable-html5\fR. 632 663 .RE 633 664 .SH KEYWORDS 634 665 XML, DOM, document, node, parsing
Changes to doc/dom.xml.
329 329 cp437, cp850, en, iso8859-1, iso8859-2, iso8859-3, 330 330 iso8859-4, iso8859-5, iso8859-6, iso8859-7, iso8859-8, 331 331 iso8859-9, koi8-r.</desc> 332 332 </commanddef> 333 333 334 334 <commanddef> 335 335 <command><cmd>dom</cmd> <method>createNodeCmd</method> 336 -<m>?-returnNodeCmd?</m> <m>?-tagName name?</m> <m>?-jsonType jsonType</m> <m>(element|comment|text|cdata|pi)Node</m> <m>commandName</m></command> 336 +<m>?-returnNodeCmd?</m> <m>?-tagName name?</m> <m>?-jsonType jsonType?</m> <m>?-namespace URI?</m> <m>(element|comment|text|cdata|pi)Node</m> <m>commandName</m></command> 337 337 <desc>This method creates Tcl commands, which in turn create 338 338 tDOM nodes. Tcl commands created by this command are only 339 339 avaliable inside a script given to the domNode methods 340 340 <m>appendFromScript</m> or <m>insertBeforeFromScript</m>. If 341 341 a command created with <m>createNodeCmd</m> is invoked in 342 342 any other context, it will return error. The created command 343 343 <m>commandName</m> replaces any existing command or ................................................................................ 354 354 option <m>-returnNodeCmd</m> was given, the command returns the 355 355 created node as Tcl command. If this option was omitted, the command 356 356 returns nothing. Each command creates always the same type of node. 357 357 Which type of node is created by the command is determined by the 358 358 first argument to the <m>createNodeCmd</m>. The syntax of the created 359 359 command depends on the type of the node it creates.</p> 360 360 361 -<p>If the first argument of the method is <m>elementNode</m>, the 362 -created command will create an element node, if called. Without the 361 +<p>If the command type to create is <m>elementNode</m>, the created 362 +command will create an element node, if called. Without the 363 363 <m>-tagName</m> option the tag name of the created node is 364 364 <m>commandName</m> without namespace qualifiers. If the 365 365 <m>-tagName</m> option was given then the created command the created 366 366 elements will have this tag name. If the <m>-jsonType</m> option was 367 -given then the created node elements will have the given JSON type. 368 -The syntax of the created command is:</p> 367 +given then the created node elements will have the given JSON type. If 368 +the <m>-namespace</m> option is given the created element node will be 369 +XML namespaced and in the namespace given by the option. The element 370 +name will be literal as given either by the command name or the 371 +<m>-tagname</m> option, if that was given. An appropriate XML 372 +namespace declaration will be automatically added, to bind the prefix 373 +(if the element name has one) or the default namespace (if the element 374 +name hasn't a prefix) to the namespace if such a binding isn't in 375 +scope.</p> 376 + 377 +<p>The syntax of the created command is:</p> 369 378 370 379 <syntax> 371 380 <cmd>elementNodeCmd</cmd> <m>?attributeName attributeValue ...? ?script?</m> 372 381 <cmd>elementNodeCmd</cmd> <m>?-attributeName attributeValue ...? ?script?</m> 373 382 <cmd>elementNodeCmd</cmd> <m>name_value_list script</m> 374 383 </syntax> 375 384
Changes to doc/domDoc.html.
1 1 <html> 2 2 <head> 3 -<link rel="stylesheet" href="manpage.css"><title>tDOM manual: domDoc</title><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: tmml-html.xsl,v $ $Revision: 1.11 $"> 3 +<link rel="stylesheet" href="manpage.css"><title>tDOM manual: domDoc</title><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: tmml-html.xsl,v $ $Revision: 1.11 $"><meta charset="utf-8"> 4 4 </head><body> 5 5 <div class="header"> 6 6 <div class="navbar" align="center"> 7 -<a href="#SECTid0xa2ebe0">NAME</a> · <a href="#SECTid0xa4db80">SYNOPSIS</a> · <a href="#SECTid0xad8760">DESCRIPTION </a> · <a href="#SECTid0xb75940">SEE ALSO</a> · <a href="#SECTid0xb75cd0">KEYWORDS</a> 7 +<a href="#SECTid0x1e30210">NAME</a> · <a href="#SECTid0x1f1d4f0">SYNOPSIS</a> · <a href="#SECTid0x1f1d9d0">DESCRIPTION </a> · <a href="#SECTid0x1f7ab90">SEE ALSO</a> · <a href="#SECTid0x1f7af20">KEYWORDS</a> 8 8 </div><hr class="navsep"> 9 9 </div><div class="body"> 10 - <h2><a name="SECTid0xa2ebe0">NAME</a></h2><p class="namesection"> 10 + <h2><a name="SECTid0x1e30210">NAME</a></h2><p class="namesection"> 11 11 <b class="names">domDoc - </b><br>Manipulates an instance of a DOM document object</p> 12 12 13 - <h2><a name="SECTid0xa4db80">SYNOPSIS</a></h2><pre class="syntax">domDocObjCmd <i class="m">method</i> ?<i class="m">arg arg ...</i>?</pre> 13 + <h2><a name="SECTid0x1f1d4f0">SYNOPSIS</a></h2><pre class="syntax">domDocObjCmd <i class="m">method</i> ?<i class="m">arg arg ...</i>?</pre> 14 14 15 - <h2><a name="SECTid0xad8760">DESCRIPTION </a></h2><p>This command manipulates one particular instance of a document 15 + <h2><a name="SECTid0x1f1d9d0">DESCRIPTION </a></h2><p>This command manipulates one particular instance of a document 16 16 object. <i class="m">method</i> indicates a specific method of the document class. These 17 17 methods should closely conform to the W3C recommendation "Document Object Model 18 18 (Core) Level 1" (<a href="http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html">http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html</a>). Look 19 19 at these documents for a deeper understanding of the functionality.</p><p>The valid methods are:</p><dl class="commandlist"> 20 20 21 21 <dt> 22 22 <b class="method">documentElement</b> ?<i class="m">objVar</i>?</dt> ................................................................................ 118 118 channelId.</p> 119 119 120 120 <p>If the option <i class="m">-escapeNonASCII</i> is given, 121 121 every non 7 bit ASCII character in attribute values or element 122 122 PCDATA content will be escaped as character reference in 123 123 decimal representation.</p> 124 124 125 - <p>The flag <i class="m">-doctypeDeclaration</i> 126 - determines, whether there will be a DOCTYPE declaration 127 - emitted before the first node of the document. The default is, 128 - to do not. The DOCTYPE name will always be the element name of 129 - the document element. An external entity declaration of the 130 - external subset is only emitted, if the document has a system 131 - identifier.</p> 125 + <p>The flag <i class="m">-doctypeDeclaration</i> determines whether 126 + there will be a DOCTYPE declaration emitted before the first 127 + node of the document. The default is not to emit it. The 128 + DOCTYPE name will always be the element name of the document 129 + element. An external entity declaration of the external subset 130 + is only emitted if the document has a system identifier.</p> 132 131 133 - <p>The flag <i class="m">-xmlDeclaration</i> determines, whether there 132 + <p>The flag <i class="m">-xmlDeclaration</i> determines whether there 134 133 will be an XML Declaration and a newline emitted before 135 - anything else. The default is, to do not. If this flag is 134 + anything else. The default is not to emit one. If this flag is 136 135 given with a true argument then</p> 137 136 138 137 <p> 139 138 <i class="m">-encString</i> sets the encoding value in the XML 140 - Declaration. Otherwise, this option is ignored. Please note, 141 - that this option just enhance the string representation of the 139 + Declaration. Otherwise this option is ignored. Please note 140 + that this option just enhances the string representation of the 142 141 generated XML Declaration with an encoding information string, 143 142 nothing more. It's up to the user to handle encoding in case 144 143 of writing to a channel or reparsing.</p> 145 144 146 145 <p>If the option <i class="m">-escapeAllQuot</i> is given, 147 146 quotation marks will be escaped with &quot; even in text 148 147 content of elements.</p> ................................................................................ 156 155 157 156 158 157 159 158 <dt> 160 159 <b class="method">asHTML</b> <b class="option">?-channel 161 160 channelId?</b> <b class="option">?-escapeNonASCII?</b> <b class="option">?-htmlEntities?</b> <b class="option">?-doctypeDeclaration <boolean>?</b> 162 161 </dt> 163 - <dd>Returns the DOM tree serialized acording to HTML rules (HTML 164 -elements are recognized regardless of case, without end tags for emtpy HTML 165 -elements etc.), as string or sends the output directly to the given 166 -channelId. If the option <i class="m">-escapeNonASCII</i> is given, every non 7 bit ASCII 167 -character in attribute values or element PCDATA content will be escaped as 168 -character reference in decimal representation. If the option 169 -<i class="m">-htmlEntities</i> is given, a character is outputed using a HTML 4.01 170 -character entity reference, if one is defined for it. The flag 171 -<i class="m">-doctypeDeclaration</i> determines, whether there will be a DOCTYPE 172 -declaration emitted before the first node of the document. The default is, to 173 -do not. The DOCTYPE name will always be the element name of the document 174 -element without case normalization. An external entity declaration of the 175 -external subset is only emitted, if the document has a system identifier. The 176 -doctype declaration will be written from the avaliable informations, without 177 -check, if this is a known (w3c) HTML version information or if the document 178 -confirms to the given HTML version.</dd> 162 + <dd>Returns the DOM tree serialized acording to HTML rules 163 + (HTML elements are recognized regardless of case, without end 164 + tags for emtpy HTML elements etc.) as string or sends the 165 + output directly to the given channelId. If the option 166 + <i class="m">-escapeNonASCII</i> is given, every non 7 bit ASCII 167 + character in attribute values or element PCDATA content will 168 + be escaped as character reference in decimal representation. 169 + If the option <i class="m">-htmlEntities</i> is given, a character is 170 + written using its HTML 4.01 character entity reference, if it 171 + has one. If the flag <i class="m">-doctypeDeclaration</i> is given there 172 + will be a DOCTYPE declaration emitted before the first node of 173 + the document. The default is, to do not. The DOCTYPE name will 174 + always be the element name of the document element without 175 + case normalization. An external entity declaration of the 176 + external subset is only emitted, if the document has a system 177 + identifier. The doctype declaration will be written from the 178 + avaliable information, without check, if this is a known 179 + (w3c) HTML version information or if the document confirms to 180 + the given HTML version.</dd> 179 181 180 182 181 183 182 184 <dt><b class="method">asText</b></dt> 183 - <dd>The asText method outputs the result tree by outputting 184 -the string-value of every text node in the result tree in document 185 -order without any escaping. In effect, this is what the xslt output method 186 -"text" (XSLT 1.0 recommendation, section 16.3) does.</dd> 185 + <dd>The asText method returns the tree by serializing the 186 + string-value of every text node in document order without 187 + any escaping. In effect, this is what the xslt output method 188 + "text" (XSLT 1.0 recommendation, section 16.3) does.</dd> 187 189 188 190 189 191 190 192 <dt> 191 193 <b class="method">asJSON</b> <b class="option">?-indent none/0..8?</b> <b class="option">?-channel channelId?</b> 192 194 </dt> 193 195 <dd> 194 196 <p>The asJSON method serializes the tree into a valid 195 - JSON data string. In general this may be a lossy 197 + JSON data string. In general, this may be a lossy 196 198 serialization. For this serialization all comment, character 197 199 data sections and processing instruction nodes, all 198 200 attributes and all XML namespaces are ignored. Only element 199 201 and text nodes may be reflected in the generated JSON 200 202 serialization. Appropriate JSON data type information of a 201 203 node will be respected.</p> 202 204 203 - <p>If an element node has the JSON type OBJECT then every 204 - element node child of this element will be serializend as 205 + <p>If an element node has the JSON type OBJECT, then every 206 + element node child of this element will be serialized as 205 207 member of that object, with the node name of the child as 206 - the member name and the relevant childs of that child as the 207 - value. Every other child nodes will be ignored.</p> 208 + the member name and the relevant children of that child as 209 + the value. Every other child nodes will be ignored.</p> 208 210 209 - <p>If an element node has the JSON type ARRAY then the text 210 - and element node childs of that element node are serialized 211 - as the consecutive values of the array. Element node childs 211 + <p>If an element node has the JSON type ARRAY, then the text 212 + and element node children of that element node are serialized 213 + as the consecutive values of the array. Element node children 212 214 of an ARRAY element will be container nodes for nested ARRAY 213 215 or OBJECT values.</p> 214 216 215 217 <p>Text nodes with the JSON types TRUE, FALSE or NULL will 216 218 be serialized to the corresponding JSON token without 217 219 looking at the value of the text node. A text node without 218 220 JSON type will always be serialized as a JSON string token. 219 221 A text node with JSON type NUMBER will be serialized as JSON 220 222 number token if the text node value is in fact a valid JSON 221 223 number and as a JSON string if not.</p> 222 224 223 225 <p>If an element node doesn't has a JSON type then the 224 - serialization of its childs is determined by the following 226 + serialization of its children is determined by the following 225 227 rules:</p> 226 228 227 229 <p>Only text and element node child are relevant. If the 228 230 element node to serialize is the member of a JSON object and 229 231 there is no relevant child node the value of that member 230 232 will be an empty JSON string. If the only relevant child 231 233 node of this element node is a text node then the JSON 232 234 value of that text node will be the value of the object 233 235 member. If the element has more than one relevant child 234 236 nodes and the first one is a text node then the relevant 235 - childs will be serialized as JSON array. If the only 237 + children will be serialized as JSON array. If the only 236 238 relevant child node is an element node or the first relevant 237 239 child is an element node and the node name of that only or 238 240 first relevant child isn't equal to the array container node 239 - name all element node childs will be serialized as the 241 + name all element node children will be serialized as the 240 242 members of a JSON object (while ignoring any intermixed text 241 243 nodes). If the only or first relevant child is an element 242 244 node and the node name of this child is equal to the array 243 - container element name then all relevant childs will be 245 + container element name then all relevant children will be 244 246 serialized as the values of a JSON array.</p> 245 247 246 248 <p>If the element to serialize is a value of a JSON array 247 249 and the node name of this element isn't equal to the array 248 - container node name that element will be seen as a 249 - container node for a JSON object and all element node childs 250 - will be serialized as the members of that array while 251 - ignoring any text node childs. If the element to serialize 252 - is a value of a JSON array and the node name of this element 253 - is equal to the array container node name, all relevant 254 - childs will be serialized as JSON array.</p> 250 + container node name that element will be seen as a container 251 + node for a JSON object and all element node children will be 252 + serialized as the members of that array while ignoring any 253 + text node children. If the element to serialize is a value of 254 + a JSON array and the node name of this element is equal to 255 + the array container node name, all relevant children will be 256 + serialized as JSON array.</p> 255 257 256 258 <p>If the <i class="m">-channel</i> option is given the serialization 257 259 isn't returned as string but send directly to the channel, 258 260 given as argument to the option.</p> 259 261 260 262 <p>If the <i class="m">-indent</i> option is given and the argument 261 263 given to this option isn't "none" then the returned JSON ................................................................................ 289 291 290 292 <dt> 291 293 <b class="method">internalSubset</b> <i class="m">?internalSubset?</i> 292 294 </dt> 293 295 <dd>Returns the internal subset of the doctype declaration of the 294 296 document, if there is one, otherwise the empty string. If there is a value 295 297 given to the method, the internal subset of the document is set to this 296 -value. Note, that none of the parsing methods preserve the internal subset 298 +value. Note that none of the parsing methods preserve the internal subset 297 299 of a document; a freshly parsed document will always have an empty internal 298 300 subset. Also note, that the method doesen't do any syntactical check on a 299 301 given internal subset.</dd> 300 302 301 303 302 304 303 305 <dt> 304 306 <b class="method">cdataSectionElements</b> <i class="m">(?URI:?localname|*) ?<boolean>?</i> 305 307 </dt> 306 - <dd>This method allows to control, for which element nodes 307 -the text node childs will be serialized as CDATA sections (this affects only 308 + <dd>This method allows to control for which element nodes 309 +the text node children will be serialized as CDATA sections (this affects only 308 310 serialization with the asXML method, no text node is altered in any 309 311 way by this method). IF the method is called with an element name as 310 312 first argument and a boolean with value true as second argument, every 311 313 text node child of every element node in the document with the same 312 314 name as the first argument will be serialized as CDATA section. If the 313 315 second argument is a boolean with value false, all text nodes of all 314 316 elements with the same name as the first argument will be serialized 315 -as usual. Namespaced element names have to given in the form 317 +as usual. Namespaced element names have to be given in the form 316 318 namespace_URI:localname, not in the otherwise usual prefix:localname 317 319 form. With two arguments called, the method returns the used boolean 318 320 value. If the method is called with only an element name, it will 319 -return a boolean value, indicating, if the text nodes childs of all 321 +return a boolean value, indicating that the text node children of all 320 322 elements with that name in the document will be serialized as CDATA 321 323 section elements (return value 1) or not (return value 0). If the 322 324 method is called with only one argument and that argument is an 323 325 asterisk ('*'), then the method returns an unordered list of all 324 -element names of the document, for which the text node childs will be 326 +element names of the document, for which the text node children will be 325 327 serialized as CDATA section nodes.</dd> 326 328 327 329 328 330 329 331 <dt> 330 332 <b class="method">selectNodesNamespaces</b> <b class="option">?prefixUriList?</b> 331 333 </dt> 332 334 <dd>This method allows to control a document global prefix 333 -to namespace URI mapping, which will be used for selectNodes method 334 -calls (on document as well as on all nodes, which belongs to the 335 -document), if it is not overwritten by using the -namespaces option of 336 -the selectNodes method. Any namespace prefix within an xpath 337 -expression will be first resolved against this list. If the list bind 338 -the same prefix to different namespaces, then the first binding will 339 -win. If a prefix could not resolved against the document global prefix 340 -/ namespaces list, then the namespace definitions in scope of the 341 -context node will be used to resolve the prefix, as usual. If the 342 -optional argument <i class="m">prefixUriList</i> is given, then the global prefix / 343 -namespace list is set to this list and returns it. Without 344 -the optional argument the method returns the current list. The 345 -default is the empty list.</dd> 335 + to namespace URI mapping, which will be used for selectNodes 336 + method calls (on document as well as on all nodes, which 337 + belongs to the document) if it is not overwritten by using 338 + the -namespaces option of the selectNodes method. Any 339 + namespace prefix within an xpath expression will be first 340 + resolved against this list. If the list binds the same prefix 341 + to different namespaces, then the first binding will win. If a 342 + prefix could not resolved against the document global prefix / 343 + namespaces list, then the namespace definitions in scope of 344 + the context node will be used to resolve the prefix, as usual. 345 + If the optional argument <i class="m">prefixUriList</i> is given, then 346 + the global prefix / namespace list is set to this list and 347 + returns it. Without the optional argument the method returns 348 + the current list. The default is the empty list.</dd> 346 349 347 350 348 351 349 352 <dt> 350 353 <b class="method">xslt</b> <b class="option">?-parameters 351 354 parameterList?</b> <b class="option">?-ignoreUndeclaredParameters?</b> 352 355 <b class="option">?-maxApplyDepth int?</b> ................................................................................ 360 363 <p>The optional <i class="m">-parameters</i> option sets top level 361 364 <xsl:param> to string values. The <i class="m">parameterList</i> has to be a tcl 362 365 list consisting of parameter name and value pairs.</p> 363 366 364 367 <p>If the option <i class="m">-ignoreUndeclaredParameters</i> is given, then parameter 365 368 names in the <i class="m">parameterList</i> given to the <i class="m">-parameters</i> options that 366 369 are not declared as top-level parameters in the stylesheet are silently 367 -ignored. Without this option, an error is raised, if the user tries to set a 368 -top-level parameter, which is not declared in the stylesheet.</p> 370 +ignored. Without this option, an error is raised if the user tries to set a 371 +top-level parameter that is not declared in the stylesheet.</p> 369 372 370 373 <p>The option <i class="m">-maxApplyDepth</i> expects a positiv integer as 371 374 argument. By default, the xslt engine allows xslt templates to nest up 372 375 to 3000 levels (and raises error if they nest deeper). This limit can 373 376 be set by the <i class="m">-maxApplyDepth</i> option.</p> 374 377 375 378 <p>The <i class="m">-xsltmessagecmd</i> option sets a callback for xslt:message elements ................................................................................ 421 424 <p>The optional <i class="m">-parameters</i> option sets top level 422 425 <xsl:param> to string values. The <i class="m">parameterList</i> has to be a tcl 423 426 list consisting of parameter name and value pairs.</p> 424 427 425 428 <p>If the option <i class="m">-ignoreUndeclaredParameters</i> is given, then parameter 426 429 names in the <i class="m">parameterList</i> given to the <i class="m">-parameters</i> options that 427 430 are not declared as top-level parameters in the stylesheet are silently 428 -ignored. Without this option, an error is raised, if the user tries to set a 431 +ignored. Without this option, an error is raised if the user tries to set a 429 432 top-level parameter, which is not declared in the stylesheet.</p> 430 433 431 434 <p>The option <i class="m">-maxApplyDepth</i> expects a positiv integer as 432 435 argument. By default, the xslt engine allows xslt templates to nest up 433 436 to 3000 levels (and raises error if they nest deeper). This limit can 434 437 be set by the <i class="m">-maxApplyDepth</i> option.</p> 435 438 ................................................................................ 531 534 532 535 533 536 534 537 <dt> 535 538 <b class="method">insertBefore</b> <i class="m">newChild</i> <i class="m">refChild</i> 536 539 </dt> 537 540 <dd>Insert <i class="m">newChild</i> before the <i class="m">refChild</i> into the list of 538 -top level nodes of the document. If <i class="m">refChild</i> is the empty string, insert 541 +top level nodes of the document. If <i class="m">refChild</i> is the empty string, inserts 539 542 <i class="m">newChild</i> at the end of the top level nodes.</dd> 540 543 541 544 542 545 543 546 <dt> 544 547 <b class="method">replaceChild</b> <i class="m">newChild</i> <i class="m">oldChild</i> 545 548 </dt> 546 - <dd>Replace <i class="m">oldChild</i> with <i class="m">newChild</i> in the list of 549 + <dd>Replaces <i class="m">oldChild</i> with <i class="m">newChild</i> in the list of 547 550 children of that node. The <i class="m">oldChild</i> node will be part of the 548 551 document fragment list after this operation.</dd> 549 552 550 553 551 554 552 555 <dt> 553 556 <b class="method">appendFromList</b> <i class="m">list</i> ................................................................................ 588 591 the xpath engine. Cast the value explicitly with the according xpath 589 592 functions (number(), boolean()) to another data type, if needed.</p> 590 593 591 594 <p>The option <i class="m">-namespaces</i> expects a tcl list with prefix / 592 595 namespace pairs as argument. If this option is not given, then any 593 596 namespace prefix within the xpath expression will be first resolved 594 597 against the list of prefix / namespace pairs set with the 595 -selectNodesNamespaces method for the document, the node belongs to. If 598 +selectNodesNamespaces method for the document the node belongs to. If 596 599 this fails, then the namespace definitions in scope of the context 597 600 node will be used to resolve the prefix. If this option is given, any 598 601 namespace prefix within the xpath expression will be first resolved 599 602 against that given list (and ignoring the document global prefix / 600 -namespace list). If the list bind the same prefix to different 603 +namespace list). If the list binds the same prefix to different 601 604 namespaces, then the first binding will win. If this fails, then the 602 605 namespace definitions in scope of the context node will be used to 603 606 resolve the prefix, as usual.</p> 604 607 605 608 <p>If the <i class="m">-cache</i> option is used with a true value, then the 606 609 <i class="m">xpathQuery</i> will be looked up in a document specific cache. If 607 610 the query is found, then the stored pre-compiled query will be used. 608 611 If the query isn't found, it will be compiled and stored in the cache, 609 612 for use in further calls. Please notice, that the <i class="m">xpathQuery</i> as 610 -given as string is used as key for the cache. This means, that equal 611 -XPath expressions, which differ only in white space are treated as 612 -different cache entries. Special care is needed, if the XPath 613 +given as string is used as key for the cache. This means that equal 614 +XPath expressions, which differ only in white space, are treated as 615 +different cache entries. Special care is needed if the XPath 613 616 expression includes namespace prefixes or references to tcl variables. 614 617 Both namespace prefixes and tcl variable references will be resolved 615 618 according to the XML prefix namespace mappings and tcl variable values 616 619 at expression compilation time. If the same XPath expression is used 617 620 later on in a context with other XML prefix namespace mappings or 618 621 values of the used tcl variables, make sure to first remove the 619 622 compiled expression from the cache with the help of the ................................................................................ 672 675 from the cache, if it is there. The method always returns an 673 676 empty string.</dd> 674 677 675 678 676 679 </dl><p>Otherwise, if an unknown method name is given, the command with the 677 680 same name as the given method within the namespace <tt class="samp">::dom::domDoc</tt> is 678 681 tried to be executed. This allows quick method additions on Tcl level.</p><p>Newly created nodes are appended to a hidden fragment list. If they 679 -are not moved into the tree they are automaticaly deleted, when the whole 682 +are not moved into the tree they are automaticaly deleted as soon as the whole 680 683 document gets deleted.</p> 681 684 682 - <h2><a name="SECTid0xb75940">SEE ALSO</a></h2><p class="seealso">dom, domNode</p> 685 + <h2><a name="SECTid0x1f7ab90">SEE ALSO</a></h2><p class="seealso">dom, domNode</p> 683 686 684 - <h2><a name="SECTid0xb75cd0">KEYWORDS</a></h2><p class="keywords"> 687 + <h2><a name="SECTid0x1f7af20">KEYWORDS</a></h2><p class="keywords"> 685 688 <a class="keyword" href="keyword-index.html#KW-DOMnodecreation">DOM node creation</a>, <a class="keyword" href="keyword-index.html#KW-documentelement">document element</a> 686 689 </p> 687 690 688 691 </div><hr class="navsep"><div class="navbar" align="center"> 689 -<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> 692 +<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> · <a class="navaid" href="http://tdom.org">Repository</a> 690 693 </div> 691 694 </body> 692 695 </html>
Changes to doc/domDoc.n.
243 243 channelId. 244 244 .PP 245 245 If the option \fI-escapeNonASCII\fR is given, 246 246 every non 7 bit ASCII character in attribute values or element 247 247 PCDATA content will be escaped as character reference in 248 248 decimal representation. 249 249 .PP 250 -The flag \fI-doctypeDeclaration\fR 251 -determines, whether there will be a DOCTYPE declaration 252 -emitted before the first node of the document. The default is, 253 -to do not. The DOCTYPE name will always be the element name of 254 -the document element. An external entity declaration of the 255 -external subset is only emitted, if the document has a system 256 -identifier. 250 +The flag \fI-doctypeDeclaration\fR determines whether 251 +there will be a DOCTYPE declaration emitted before the first 252 +node of the document. The default is not to emit it. The 253 +DOCTYPE name will always be the element name of the document 254 +element. An external entity declaration of the external subset 255 +is only emitted if the document has a system identifier. 257 256 .PP 258 -The flag \fI-xmlDeclaration\fR determines, whether there 257 +The flag \fI-xmlDeclaration\fR determines whether there 259 258 will be an XML Declaration and a newline emitted before 260 -anything else. The default is, to do not. If this flag is 259 +anything else. The default is not to emit one. If this flag is 261 260 given with a true argument then 262 261 .PP 263 262 \&\fI-encString\fR sets the encoding value in the XML 264 -Declaration. Otherwise, this option is ignored. Please note, 265 -that this option just enhance the string representation of the 263 +Declaration. Otherwise this option is ignored. Please note 264 +that this option just enhances the string representation of the 266 265 generated XML Declaration with an encoding information string, 267 266 nothing more. It's up to the user to handle encoding in case 268 267 of writing to a channel or reparsing. 269 268 .PP 270 269 If the option \fI-escapeAllQuot\fR is given, 271 270 quotation marks will be escaped with " even in text 272 271 content of elements. ................................................................................ 274 273 If the option \fI-indentAttrs\fR is 275 274 given, then attributes will each be separated with newlines 276 275 and indented to the same level as the parent node plus the 277 276 value given as argument to \fI-indentAttrs\fR (0..8). 278 277 .RE 279 278 .TP 280 279 \&\fB\fBasHTML\fP \fB?-channel channelId?\fP \fB?-escapeNonASCII?\fP \fB?-htmlEntities?\fP \fB?-doctypeDeclaration <boolean>?\fP 281 -\&\fRReturns the DOM tree serialized acording to HTML rules (HTML 282 -elements are recognized regardless of case, without end tags for emtpy HTML 283 -elements etc.), as string or sends the output directly to the given 284 -channelId. If the option \fI-escapeNonASCII\fR is given, every non 7 bit ASCII 285 -character in attribute values or element PCDATA content will be escaped as 286 -character reference in decimal representation. If the option 287 -\&\fI-htmlEntities\fR is given, a character is outputed using a HTML 4.01 288 -character entity reference, if one is defined for it. The flag 289 -\&\fI-doctypeDeclaration\fR determines, whether there will be a DOCTYPE 290 -declaration emitted before the first node of the document. The default is, to 291 -do not. The DOCTYPE name will always be the element name of the document 292 -element without case normalization. An external entity declaration of the 293 -external subset is only emitted, if the document has a system identifier. The 294 -doctype declaration will be written from the avaliable informations, without 295 -check, if this is a known (w3c) HTML version information or if the document 296 -confirms to the given HTML version. 280 +\&\fRReturns the DOM tree serialized acording to HTML rules 281 +(HTML elements are recognized regardless of case, without end 282 +tags for emtpy HTML elements etc.) as string or sends the 283 +output directly to the given channelId. If the option 284 +\&\fI-escapeNonASCII\fR is given, every non 7 bit ASCII 285 +character in attribute values or element PCDATA content will 286 +be escaped as character reference in decimal representation. 287 +If the option \fI-htmlEntities\fR is given, a character is 288 +written using its HTML 4.01 character entity reference, if it 289 +has one. If the flag \fI-doctypeDeclaration\fR is given there 290 +will be a DOCTYPE declaration emitted before the first node of 291 +the document. The default is, to do not. The DOCTYPE name will 292 +always be the element name of the document element without 293 +case normalization. An external entity declaration of the 294 +external subset is only emitted, if the document has a system 295 +identifier. The doctype declaration will be written from the 296 +avaliable information, without check, if this is a known 297 +(w3c) HTML version information or if the document confirms to 298 +the given HTML version. 297 299 .TP 298 300 \&\fB\fBasText\fP 299 -\&\fRThe asText method outputs the result tree by outputting 300 -the string-value of every text node in the result tree in document 301 -order without any escaping. In effect, this is what the xslt output method 301 +\&\fRThe asText method returns the tree by serializing the 302 +string-value of every text node in document order without 303 +any escaping. In effect, this is what the xslt output method 302 304 "text" (XSLT 1.0 recommendation, section 16.3) does. 303 305 .TP 304 306 \&\fB\fBasJSON\fP \fB?-indent none/0..8?\fP \fB?-channel channelId?\fP 305 307 \&\fR 306 308 .RS 307 309 .PP 308 310 The asJSON method serializes the tree into a valid 309 -JSON data string. In general this may be a lossy 311 +JSON data string. In general, this may be a lossy 310 312 serialization. For this serialization all comment, character 311 313 data sections and processing instruction nodes, all 312 314 attributes and all XML namespaces are ignored. Only element 313 315 and text nodes may be reflected in the generated JSON 314 316 serialization. Appropriate JSON data type information of a 315 317 node will be respected. 316 318 .PP 317 -If an element node has the JSON type OBJECT then every 318 -element node child of this element will be serializend as 319 +If an element node has the JSON type OBJECT, then every 320 +element node child of this element will be serialized as 319 321 member of that object, with the node name of the child as 320 -the member name and the relevant childs of that child as the 321 -value. Every other child nodes will be ignored. 322 +the member name and the relevant children of that child as 323 +the value. Every other child nodes will be ignored. 322 324 .PP 323 -If an element node has the JSON type ARRAY then the text 324 -and element node childs of that element node are serialized 325 -as the consecutive values of the array. Element node childs 325 +If an element node has the JSON type ARRAY, then the text 326 +and element node children of that element node are serialized 327 +as the consecutive values of the array. Element node children 326 328 of an ARRAY element will be container nodes for nested ARRAY 327 329 or OBJECT values. 328 330 .PP 329 331 Text nodes with the JSON types TRUE, FALSE or NULL will 330 332 be serialized to the corresponding JSON token without 331 333 looking at the value of the text node. A text node without 332 334 JSON type will always be serialized as a JSON string token. 333 335 A text node with JSON type NUMBER will be serialized as JSON 334 336 number token if the text node value is in fact a valid JSON 335 337 number and as a JSON string if not. 336 338 .PP 337 339 If an element node doesn't has a JSON type then the 338 -serialization of its childs is determined by the following 340 +serialization of its children is determined by the following 339 341 rules: 340 342 .PP 341 343 Only text and element node child are relevant. If the 342 344 element node to serialize is the member of a JSON object and 343 345 there is no relevant child node the value of that member 344 346 will be an empty JSON string. If the only relevant child 345 347 node of this element node is a text node then the JSON 346 348 value of that text node will be the value of the object 347 349 member. If the element has more than one relevant child 348 350 nodes and the first one is a text node then the relevant 349 -childs will be serialized as JSON array. If the only 351 +children will be serialized as JSON array. If the only 350 352 relevant child node is an element node or the first relevant 351 353 child is an element node and the node name of that only or 352 354 first relevant child isn't equal to the array container node 353 -name all element node childs will be serialized as the 355 +name all element node children will be serialized as the 354 356 members of a JSON object (while ignoring any intermixed text 355 357 nodes). If the only or first relevant child is an element 356 358 node and the node name of this child is equal to the array 357 -container element name then all relevant childs will be 359 +container element name then all relevant children will be 358 360 serialized as the values of a JSON array. 359 361 .PP 360 362 If the element to serialize is a value of a JSON array 361 363 and the node name of this element isn't equal to the array 362 -container node name that element will be seen as a 363 -container node for a JSON object and all element node childs 364 -will be serialized as the members of that array while 365 -ignoring any text node childs. If the element to serialize 366 -is a value of a JSON array and the node name of this element 367 -is equal to the array container node name, all relevant 368 -childs will be serialized as JSON array. 364 +container node name that element will be seen as a container 365 +node for a JSON object and all element node children will be 366 +serialized as the members of that array while ignoring any 367 +text node children. If the element to serialize is a value of 368 +a JSON array and the node name of this element is equal to 369 +the array container node name, all relevant children will be 370 +serialized as JSON array. 369 371 .PP 370 372 If the \fI-channel\fR option is given the serialization 371 373 isn't returned as string but send directly to the channel, 372 374 given as argument to the option. 373 375 .PP 374 376 If the \fI-indent\fR option is given and the argument 375 377 given to this option isn't "none" then the returned JSON ................................................................................ 391 393 given to the method, the system identifier of the document is set to this 392 394 value. 393 395 .TP 394 396 \&\fB\fBinternalSubset\fP \fI?internalSubset?\fB 395 397 \&\fRReturns the internal subset of the doctype declaration of the 396 398 document, if there is one, otherwise the empty string. If there is a value 397 399 given to the method, the internal subset of the document is set to this 398 -value. Note, that none of the parsing methods preserve the internal subset 400 +value. Note that none of the parsing methods preserve the internal subset 399 401 of a document; a freshly parsed document will always have an empty internal 400 402 subset. Also note, that the method doesen't do any syntactical check on a 401 403 given internal subset. 402 404 .TP 403 405 \&\fB\fBcdataSectionElements\fP \fI(?URI:?localname|*) ?<boolean>?\fB 404 -\&\fRThis method allows to control, for which element nodes 405 -the text node childs will be serialized as CDATA sections (this affects only 406 +\&\fRThis method allows to control for which element nodes 407 +the text node children will be serialized as CDATA sections (this affects only 406 408 serialization with the asXML method, no text node is altered in any 407 409 way by this method). IF the method is called with an element name as 408 410 first argument and a boolean with value true as second argument, every 409 411 text node child of every element node in the document with the same 410 412 name as the first argument will be serialized as CDATA section. If the 411 413 second argument is a boolean with value false, all text nodes of all 412 414 elements with the same name as the first argument will be serialized 413 -as usual. Namespaced element names have to given in the form 415 +as usual. Namespaced element names have to be given in the form 414 416 namespace_URI:localname, not in the otherwise usual prefix:localname 415 417 form. With two arguments called, the method returns the used boolean 416 418 value. If the method is called with only an element name, it will 417 -return a boolean value, indicating, if the text nodes childs of all 419 +return a boolean value, indicating that the text node children of all 418 420 elements with that name in the document will be serialized as CDATA 419 421 section elements (return value 1) or not (return value 0). If the 420 422 method is called with only one argument and that argument is an 421 423 asterisk ('*'), then the method returns an unordered list of all 422 -element names of the document, for which the text node childs will be 424 +element names of the document, for which the text node children will be 423 425 serialized as CDATA section nodes. 424 426 .TP 425 427 \&\fB\fBselectNodesNamespaces\fP \fB?prefixUriList?\fP 426 428 \&\fRThis method allows to control a document global prefix 427 -to namespace URI mapping, which will be used for selectNodes method 428 -calls (on document as well as on all nodes, which belongs to the 429 -document), if it is not overwritten by using the -namespaces option of 430 -the selectNodes method. Any namespace prefix within an xpath 431 -expression will be first resolved against this list. If the list bind 432 -the same prefix to different namespaces, then the first binding will 433 -win. If a prefix could not resolved against the document global prefix 434 -/ namespaces list, then the namespace definitions in scope of the 435 -context node will be used to resolve the prefix, as usual. If the 436 -optional argument \fIprefixUriList\fR is given, then the global prefix / 437 -namespace list is set to this list and returns it. Without 438 -the optional argument the method returns the current list. The 439 -default is the empty list. 429 +to namespace URI mapping, which will be used for selectNodes 430 +method calls (on document as well as on all nodes, which 431 +belongs to the document) if it is not overwritten by using 432 +the -namespaces option of the selectNodes method. Any 433 +namespace prefix within an xpath expression will be first 434 +resolved against this list. If the list binds the same prefix 435 +to different namespaces, then the first binding will win. If a 436 +prefix could not resolved against the document global prefix / 437 +namespaces list, then the namespace definitions in scope of 438 +the context node will be used to resolve the prefix, as usual. 439 +If the optional argument \fIprefixUriList\fR is given, then 440 +the global prefix / namespace list is set to this list and 441 +returns it. Without the optional argument the method returns 442 +the current list. The default is the empty list. 440 443 .TP 441 444 \&\fB\fBxslt\fP \fB?-parameters parameterList?\fP \fB?-ignoreUndeclaredParameters?\fP \fB?-maxApplyDepth int?\fP \fB?-xsltmessagecmd script?\fP \fIstylesheet\fB \fI?outputVar?\fB 442 445 \&\fRApplies an XSLT transformation on the whole document of the node 443 446 object using the XSLT \fIstylesheet\fR (given as domDoc). Returns a document 444 447 object containing the result document of the transformation and stores that 445 448 document object in the optional \fIoutputVar\fR, if that was given. 446 449 .RS ................................................................................ 448 451 The optional \fI-parameters\fR option sets top level 449 452 <xsl:param> to string values. The \fIparameterList\fR has to be a tcl 450 453 list consisting of parameter name and value pairs. 451 454 .PP 452 455 If the option \fI-ignoreUndeclaredParameters\fR is given, then parameter 453 456 names in the \fIparameterList\fR given to the \fI-parameters\fR options that 454 457 are not declared as top-level parameters in the stylesheet are silently 455 -ignored. Without this option, an error is raised, if the user tries to set a 456 -top-level parameter, which is not declared in the stylesheet. 458 +ignored. Without this option, an error is raised if the user tries to set a 459 +top-level parameter that is not declared in the stylesheet. 457 460 .PP 458 461 The option \fI-maxApplyDepth\fR expects a positiv integer as 459 462 argument. By default, the xslt engine allows xslt templates to nest up 460 463 to 3000 levels (and raises error if they nest deeper). This limit can 461 464 be set by the \fI-maxApplyDepth\fR option. 462 465 .PP 463 466 The \fI-xsltmessagecmd\fR option sets a callback for xslt:message elements ................................................................................ 503 506 The optional \fI-parameters\fR option sets top level 504 507 <xsl:param> to string values. The \fIparameterList\fR has to be a tcl 505 508 list consisting of parameter name and value pairs. 506 509 .PP 507 510 If the option \fI-ignoreUndeclaredParameters\fR is given, then parameter 508 511 names in the \fIparameterList\fR given to the \fI-parameters\fR options that 509 512 are not declared as top-level parameters in the stylesheet are silently 510 -ignored. Without this option, an error is raised, if the user tries to set a 513 +ignored. Without this option, an error is raised if the user tries to set a 511 514 top-level parameter, which is not declared in the stylesheet. 512 515 .PP 513 516 The option \fI-maxApplyDepth\fR expects a positiv integer as 514 517 argument. By default, the xslt engine allows xslt templates to nest up 515 518 to 3000 levels (and raises error if they nest deeper). This limit can 516 519 be set by the \fI-maxApplyDepth\fR option. 517 520 .PP ................................................................................ 571 574 \&\fRReturns a list of the top level nodes of the document. 572 575 .TP 573 576 \&\fB\fBownerDocument\fP \fB?domObjVar?\fP 574 577 \&\fRReturns the document itself. 575 578 .TP 576 579 \&\fB\fBinsertBefore\fP \fInewChild\fB \fIrefChild\fB 577 580 \&\fRInsert \fInewChild\fR before the \fIrefChild\fR into the list of 578 -top level nodes of the document. If \fIrefChild\fR is the empty string, insert 581 +top level nodes of the document. If \fIrefChild\fR is the empty string, inserts 579 582 \&\fInewChild\fR at the end of the top level nodes. 580 583 .TP 581 584 \&\fB\fBreplaceChild\fP \fInewChild\fB \fIoldChild\fB 582 -\&\fRReplace \fIoldChild\fR with \fInewChild\fR in the list of 585 +\&\fRReplaces \fIoldChild\fR with \fInewChild\fR in the list of 583 586 children of that node. The \fIoldChild\fR node will be part of the 584 587 document fragment list after this operation. 585 588 .TP 586 589 \&\fB\fBappendFromList\fP \fIlist\fB 587 590 \&\fRParses \fIlist\fR , creates an according DOM subtree and 588 591 appends this subtree at the end of the current list of top level nodes of the document. 589 592 .TP ................................................................................ 614 617 the xpath engine. Cast the value explicitly with the according xpath 615 618 functions (number(), boolean()) to another data type, if needed. 616 619 .PP 617 620 The option \fI-namespaces\fR expects a tcl list with prefix / 618 621 namespace pairs as argument. If this option is not given, then any 619 622 namespace prefix within the xpath expression will be first resolved 620 623 against the list of prefix / namespace pairs set with the 621 -selectNodesNamespaces method for the document, the node belongs to. If 624 +selectNodesNamespaces method for the document the node belongs to. If 622 625 this fails, then the namespace definitions in scope of the context 623 626 node will be used to resolve the prefix. If this option is given, any 624 627 namespace prefix within the xpath expression will be first resolved 625 628 against that given list (and ignoring the document global prefix / 626 -namespace list). If the list bind the same prefix to different 629 +namespace list). If the list binds the same prefix to different 627 630 namespaces, then the first binding will win. If this fails, then the 628 631 namespace definitions in scope of the context node will be used to 629 632 resolve the prefix, as usual. 630 633 .PP 631 634 If the \fI-cache\fR option is used with a true value, then the 632 635 \&\fIxpathQuery\fR will be looked up in a document specific cache. If 633 636 the query is found, then the stored pre-compiled query will be used. 634 637 If the query isn't found, it will be compiled and stored in the cache, 635 638 for use in further calls. Please notice, that the \fIxpathQuery\fR as 636 -given as string is used as key for the cache. This means, that equal 637 -XPath expressions, which differ only in white space are treated as 638 -different cache entries. Special care is needed, if the XPath 639 +given as string is used as key for the cache. This means that equal 640 +XPath expressions, which differ only in white space, are treated as 641 +different cache entries. Special care is needed if the XPath 639 642 expression includes namespace prefixes or references to tcl variables. 640 643 Both namespace prefixes and tcl variable references will be resolved 641 644 according to the XML prefix namespace mappings and tcl variable values 642 645 at expression compilation time. If the same XPath expression is used 643 646 later on in a context with other XML prefix namespace mappings or 644 647 values of the used tcl variables, make sure to first remove the 645 648 compiled expression from the cache with the help of the ................................................................................ 686 689 empty string. 687 690 .PP 688 691 Otherwise, if an unknown method name is given, the command with the 689 692 same name as the given method within the namespace \fB::dom::domDoc\fR is 690 693 tried to be executed. This allows quick method additions on Tcl level. 691 694 .PP 692 695 Newly created nodes are appended to a hidden fragment list. If they 693 -are not moved into the tree they are automaticaly deleted, when the whole 696 +are not moved into the tree they are automaticaly deleted as soon as the whole 694 697 document gets deleted. 695 698 .SH "SEE ALSO" 696 699 dom, domNode 697 700 .SH KEYWORDS 698 701 DOM node creation, document element
Changes to doc/domNode.html.
1 1 <html> 2 2 <head> 3 -<link rel="stylesheet" href="manpage.css"><title>tDOM manual: domNode</title><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: tmml-html.xsl,v $ $Revision: 1.11 $"> 3 +<link rel="stylesheet" href="manpage.css"><title>tDOM manual: domNode</title><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: tmml-html.xsl,v $ $Revision: 1.11 $"><meta charset="utf-8"> 4 4 </head><body> 5 5 <div class="header"> 6 6 <div class="navbar" align="center"> 7 -<a href="#SECTid0xb275d0">NAME</a> · <a href="#SECTid0xb558b0">SYNOPSIS</a> · <a href="#SECTid0xad87e0"> DESCRIPTION </a> · <a href="#SECTid0xb81b10">SEE ALSO</a> · <a href="#SECTid0xb81ea0">KEYWORDS</a> 7 +<a href="#SECTid0x1fa3230">NAME</a> · <a href="#SECTid0x1e4dba0">SYNOPSIS</a> · <a href="#SECTid0x1f5bfd0"> DESCRIPTION </a> · <a href="#SECTid0x1f86500">SEE ALSO</a> · <a href="#SECTid0x1f86890">KEYWORDS</a> 8 8 </div><hr class="navsep"> 9 9 </div><div class="body"> 10 - <h2><a name="SECTid0xb275d0">NAME</a></h2><p class="namesection"> 10 + <h2><a name="SECTid0x1fa3230">NAME</a></h2><p class="namesection"> 11 11 <b class="names">domNode - </b><br>Manipulates an instance of a DOM node object</p> 12 12 13 13 14 14 15 - <h2><a name="SECTid0xb558b0">SYNOPSIS</a></h2><pre class="syntax"> $nodeObject <i class="m">method</i> <i class="m">arg arg ...</i> 15 + <h2><a name="SECTid0x1e4dba0">SYNOPSIS</a></h2><pre class="syntax"> $nodeObject <i class="m">method</i> <i class="m">arg arg ...</i> 16 16 </pre> 17 - <h2><a name="SECTid0xad87e0"> DESCRIPTION </a></h2><p>This command manipulates one particular instance of a DOM node object. 17 + <h2><a name="SECTid0x1f5bfd0"> DESCRIPTION </a></h2><p>This command manipulates one particular instance of a DOM node object. 18 18 <i class="m">method</i> indicates a specific method of the node class. These methods 19 19 should closely conform to the W3C recommendation "Document Object Model 20 20 (Core) Level 1" (<a href="http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html">http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html</a>) 21 21 as well to parts of the W3C draft "XML Pointer Language (XPointer)" 22 22 (<a href="http://www.w3.org/TR/1998/WD-xptr-19980303">http://www.w3.org/TR/1998/WD-xptr-19980303</a>). 23 23 Please note, that the XPointer methods are deprecated. Use DOM methods 24 24 or XPath expressions instead of them.</p><p>The selectNodes method implements the "XML Path ................................................................................ 51 51 optional argument <i class="m">newValue</i> is given, the node is set to that 52 52 value.</dd> 53 53 54 54 55 55 56 56 57 57 <dt><b class="method">hasChildNodes</b></dt> 58 - <dd>Returns 1 if the has children. Otherwise 0 is returned.</dd> 58 + <dd>Returns 1 if the node has children. Otherwise 0 is returned.</dd> 59 59 60 60 61 61 62 62 <dt> 63 63 <b class="method">parentNode</b> <b class="variable">?objVar?</b> 64 64 </dt> 65 65 <dd>Returns the parent node.</dd> ................................................................................ 73 73 74 74 <dt><b class="method">childNodesLive</b></dt> 75 75 <dd>Returns a "live" nodeList object of the child nodes of 76 76 the node in the sense of the DOM recommendation. This nodeList object is 77 77 "live" in the sense that, for instance, changes to the children of 78 78 the node object that it was created from are immediately reflected in the nodes 79 79 returned by the NodeList accessors; it is not a static snapshot of the content 80 -of the node. The both accessors know by the nodeList object are "item 80 +of the node. The two accessors known by the nodeList object are "item 81 81 <index>", which returns the indexth item in the collection, and 82 82 "length", which returns the number of nodes in the list.</dd> 83 83 84 84 85 85 86 86 <dt> 87 87 <b class="method">firstChild</b> <b class="variable">?objVar?</b> ................................................................................ 96 96 <dd>Returns the last child as a node object.</dd> 97 97 98 98 99 99 100 100 <dt> 101 101 <b class="method">nextSibling</b> <b class="variable">?objVar?</b> 102 102 </dt> 103 - <dd>Returns the next sibling relativ to the current node as a node 103 + <dd>Returns the next sibling relative to the current node as a node 104 104 object.</dd> 105 105 106 106 107 107 108 108 <dt> 109 109 <b class="method">previousSibling</b> <b class="variable">?objVar?</b> 110 110 </dt> 111 - <dd>Returns the next sibling relativ to the current node as a node 111 + <dd>Returns the next sibling relative to the current node as a node 112 112 object.</dd> 113 113 114 114 115 115 116 116 <dt> 117 117 <b class="method">getElementsByTagName</b> <i class="m">name</i> 118 118 </dt> ................................................................................ 129 129 <i class="m">uri</i>.</dd> 130 130 131 131 132 132 133 133 <dt> 134 134 <b class="method">getElementById</b> <i class="m">id</i> 135 135 </dt> 136 - <dd>Returns the node having a id attribute with value 137 -<i class="m">id</i> or the emtpy string, if no node has an id attribute with that value.</dd> 136 + <dd>Returns the node having an id attribute with value 137 +<i class="m">id</i> or the emtpy string if no node has an id attribute with that value.</dd> 138 138 139 139 140 140 141 141 <dt> 142 142 <b class="method">hasAttribute</b> <i class="m">attributeName</i> 143 143 </dt> 144 144 <dd>Returns 1 if the object node contains an attribute with name ................................................................................ 145 145 <i class="m">attributeName</i> . Otherwise 0 is returned.</dd> 146 146 147 147 148 148 149 149 <dt> 150 150 <b class="method">getAttribute</b> <i class="m">attributeName ?defaultValue?</i> 151 151 </dt> 152 - <dd>Returns the value of the attribute <i class="m">attributeName</i>. If 152 + <dd>Returns the value of the attribute <i class="m">attributeName</i>. If the 153 153 attribute is not available <i class="m">defaultValue</i> is returned.</dd> 154 154 155 155 156 156 157 157 <dt> 158 158 <b class="method">setAttribute</b> <i class="m">attributeName newValue 159 159 ?attributeName newValue ...?</i> 160 160 </dt> 161 161 <dd>Sets the value for one or more attributes. Every 162 -<i class="m">attributeName</i> is set to the corresponding <i class="m">newValue</i>. If there 163 -isn't an attribute for one or more of the <i class="m">attributeName</i> this will 164 -create that attribute.</dd> 165 - 162 + <i class="m">attributeName</i> is set to the corresponding 163 + <i class="m">newValue</i>. If there isn't an attribute for one or more 164 + of the <i class="m">attributeName</i>, this will create that attribute. 165 + It is not recommended to set attributes that look like xml 166 + namespace declarations.</dd> 166 167 167 168 168 169 169 170 <dt> 170 171 <b class="method">removeAttribute</b> <i class="m">attributeName</i> 171 172 </dt> 172 173 <dd>Removes the attribute <i class="m">attributeName</i>.</dd> ................................................................................ 208 209 <pre class="example">$node setAttributeNS "http://some.uri.com/wow" prefix:attr1 attrValue</pre> 209 210 210 211 <p>If the uri is the empty string and the attribute name hasn't a prefix, this 211 212 method has the same effect as the method <b>setAttribute</b>.</p> 212 213 213 214 <pre class="example">$node setAttributeNS "" attri "some Value"</pre> 214 215 215 -<p>XML namespace nodes are not in any namespace. Set them this way:</p> 216 - 217 - <pre class="example">$node setAttributeNS "" xmlns:myprefix "myNamespaceURI" 218 -$node setAttributeNS "" xmlns "newDefaultNamespace"</pre> 219 - 220 -<p>If your <i class="m">qualifiedName</i> has the prefix "xml" and you give the empty 221 -string as <i class="m">uri</i>, the namespace of the attribute defaults to 222 -"http://www.w3.org/XML/1998/namespace", as the DOM 2 recommendation 223 -requests. With the exceptions of the special prefixes "xmlns" and "xml" you 216 +<p>With the exceptions of the special prefixes "xmlns" and "xml" you 224 217 always must provide a non emtpy <i class="m">uri</i>, if your <i class="m">qualifiedName</i> has a 225 -prefix.</p> 226 - </dd> 218 +prefix. It is not recommended to set xml namespace declarations. The effects are complicated and not always obvious up to resulting a not well-formed serializations after further processing.</p> 219 +</dd> 227 220 228 221 229 222 230 223 <dt> 231 224 <b class="method">removeAttributeNS</b> <i class="m">uri</i> <i class="m">localName</i> 232 225 </dt> 233 226 <dd>Removes the attribute with the local name <i class="m">localName</i> within ................................................................................ 235 228 236 229 237 230 238 231 <dt> 239 232 <b class="method">attributes</b> <b class="option">?attributeNamePattern?</b> 240 233 </dt> 241 234 <dd>Returns all attributes matching the <i class="m">attributeNamePattern</i>. 242 -If <i class="m">attributeNamePattern</i> isn't given all attributes are returned as a Tcl 235 +If <i class="m">attributeNamePattern</i> isn't given, all attributes are returned as a Tcl 243 236 list.</dd> 244 237 245 238 246 239 247 240 <dt> 248 241 <b class="method">appendChild</b> <i class="m">newChild</i> 249 242 </dt> 250 - <dd>Append <i class="m">newChild</i> to the end of the child list of the 243 + <dd>Appends <i class="m">newChild</i> to the end of the child list of the 251 244 node.</dd> 252 245 253 246 254 247 255 248 <dt> 256 249 <b class="method">insertBefore</b> <i class="m">newChild</i> <i class="m">refChild</i> 257 250 </dt> 258 - <dd>Insert <i class="m">newChild</i> before the <i class="m">refChild</i> into the list of 251 + <dd>Inserts <i class="m">newChild</i> before the <i class="m">refChild</i> into the list of 259 252 children of node. If <i class="m">refChild</i> is the empty string, insert 260 253 <i class="m">newChild</i> at the end of the child nodes list of that node.</dd> 261 254 262 255 263 256 264 257 <dt> 265 258 <b class="method">replaceChild</b> <i class="m">newChild</i> <i class="m">oldChild</i> 266 259 </dt> 267 - <dd>Replace <i class="m">oldChild</i> with <i class="m">newChild</i> in the list of 260 + <dd>Replaces <i class="m">oldChild</i> with <i class="m">newChild</i> in the list of 268 261 children of that node. The <i class="m">oldChild</i> node will be part of the 269 262 document fragment list after this operation.</dd> 270 263 271 264 272 265 273 266 <dt> 274 267 <b class="method">removeChild</b> <i class="m">child</i> 275 268 </dt> 276 - <dd>Removes <i class="m">child</i> from the list of children of that node 269 + <dd>Removes <i class="m">child</i> from the list of children of that node. 277 270 <i class="m">child</i> will be part of the document fragment list after this 278 -operation. It is not physically deleted.</dd> 271 +operation.</dd> 279 272 280 273 281 274 282 275 <dt><b class="method">delete</b></dt> 283 276 <dd>Deletes the given node and its complete child tree 284 277 and frees the complete internal memory. The affected nodes are not accessible 285 278 through the document fragment list.</dd> ................................................................................ 411 404 the XPath syntax to put an XPath variable. Ignoring the syntax rules of 412 405 XPath the Tcl variable name may be any legal Tcl var name: local 413 406 variables, global variables, array entries and so on. The value will 414 407 always be seen as string literal by the xpath engine. Cast the value 415 408 explicitly with the according xpath functions (number(), boolean()) to 416 409 another data type, if needed.</p> 417 410 418 -<p>Simmilar to the above descibed way to inject literals in a secure 411 +<p>Similar to the way described above to inject literals in a secure 419 412 way into the XPath expression using tcl variable references there is a 420 413 syntax to inject element names from tcl variables. At every place 421 414 where the XPath syntax allows a node test there could be a tcl 422 415 variable reference (in any form), just the leading $ replaced with %. 423 416 This allows to select nodes with 'strange' (invalid, according to the 424 417 appropriate XML production rule) node names which may be needed in 425 418 case of working with JSON data.</p> ................................................................................ 429 422 namespace prefix within the xpath expression will be first resolved 430 423 against the list of prefix / namespace pairs set with the 431 424 selectNodesNamespaces method for the document, the node belongs to. If 432 425 this fails, then the namespace definitions in scope of the context 433 426 node will be used to resolve the prefix. If this option is given, any 434 427 namespace prefix within the xpath expression will be first resolved 435 428 against that given list (and ignoring the document global prefix / 436 -namespace list). If the list bind the same prefix to different 429 +namespace list). If the list binds the same prefix to different 437 430 namespaces, then the first binding will win. If this fails, then the 438 431 namespace definitions in scope of the context node will be used to 439 432 resolve the prefix, as usual.</p> 440 433 441 434 <p>If the <i class="m">-cache</i> option is used with a true value, then the 442 435 <i class="m">xpathQuery</i> will be looked up in a document specific cache. If 443 436 the query is found, then the stored pre-compiled query will be used. 444 437 If the query isn't found, it will be compiled and stored in the cache, 445 -for use in further calls. Please notice, that the <i class="m">xpathQuery</i> as 438 +for use in further calls. Please note that the <i class="m">xpathQuery</i> 446 439 given as string is used as key for the cache. This means, that equal 447 440 XPath expressions, which differ only in white space are treated as 448 441 different cache entries. Special care is needed, if the XPath 449 442 expression includes namespace prefixes or references to tcl variables. 450 443 Both namespace prefixes and tcl variable references will be resolved 451 444 according to the XML prefix namespace mappings and tcl variable values 452 445 at expression compilation time. If the same XPath expression is used ................................................................................ 499 492 channelId.</p> 500 493 501 494 <p>If the option <i class="m">-escapeNonASCII</i> is given, 502 495 every non 7 bit ASCII character in attribute values or element 503 496 PCDATA content will be escaped as character reference in 504 497 decimal representation.</p> 505 498 506 - <p>The flag <i class="m">-xmlDeclaration</i> determines, whether there 499 + <p>The flag <i class="m">-xmlDeclaration</i> determines whether there 507 500 will be an XML Declaration and a newline emitted before 508 501 anything else. The default is, to do not. If this flag is 509 502 given with a true argument then</p> 510 503 511 504 <p> 512 505 <i class="m">-encString</i> sets the encoding value in the XML 513 506 Declaration. Otherwise, this option is ignored. Please note, ................................................................................ 536 529 <dd>Returns the DOM substree starting from the current node as the 537 530 root node of the result serialized acording to HTML rules (HTML elements are 538 531 recognized regardless of case, without end tags for emtpy HTML elements etc.), 539 532 as string or sends the output directly to the given channelId. If the option 540 533 <i class="m">-escapeNonASCII</i> is given, every non 7 bit ASCII character in attribute 541 534 values or element PCDATA content will be escaped as character reference in 542 535 decimal representation. If the option <i class="m">-htmlEntities</i> is given, a 543 -character is outputed using a HTML 4.01 character entity reference, if one is 536 +character is written using its HTML 4.01 character entity reference, if one is 544 537 defined for it.</dd> 545 538 546 539 547 540 548 541 <dt><b class="method">asText</b></dt> 549 542 <dd>For ELEMENT_NODEs, the asText method outputs 550 543 the string-value of every text node descendant of node in document ................................................................................ 571 564 572 565 573 566 <dt> 574 567 <b class="method">insertBeforeFromScript</b> <i class="m">tclScript</i> <i class="m">refChild</i> 575 568 </dt> 576 569 <dd>Inserts the nodes created in the <i class="m">tclScript</i> by 577 570 Tcl functions, which have been built using <i class="m">dom createNodeCmd</i>, before the 578 -<i class="m">refChild</i> into to the list of children of node. If <i class="m">refChild</i> is 571 +<i class="m">refChild</i> into the list of children of node. If <i class="m">refChild</i> is 579 572 the empty string, the new nodes will be appended.</dd> 580 573 581 574 582 575 583 576 <dt> 584 577 <b class="method">appendXML</b> <i class="m">XMLstring</i> 585 578 </dt> ................................................................................ 588 581 589 582 590 583 591 584 <dt> 592 585 <b class="method">simpleTranslate</b> <i class="m">outputVar</i> 593 586 <i class="m">specifications</i> 594 587 </dt> 595 - <dd>Translate the subtree starting at the object node according to 588 + <dd>Translates the subtree starting at the object node according to 596 589 the specifications in <i class="m">specifications</i> and outputs the result in the 597 590 variable <i class="m">outputVar</i> . The translation is very similar to Cost Simple 598 591 mode.</dd> 599 592 600 593 601 594 602 595 <dt> ................................................................................ 615 608 616 609 617 610 618 611 <dt> 619 612 <b class="method">baseURI</b> <i class="m">?URI?</i> 620 613 </dt> 621 614 <dd>Returns the present baseURI of the node. If the optional 622 -argument URI is given, sets the base URI of the node and of all of its child 615 +argument URI is given, it sets the base URI of the node and of all of its child 623 616 nodes out of the same enitity as node to the given URI.</dd> 624 617 625 618 626 619 627 620 <dt> 628 621 <b class="method">disableOutputEscaping</b> <i class="m">?boolean?</i> 629 622 </dt> 630 - <dd>This method works only for text nodes; for every other nodes it 623 + <dd>This method works only for text nodes; for every other node it 631 624 returns error. Without the optional argument it returns, if disabling output 632 625 escaping is on. The return value 0 means, the characters of the text node will 633 626 be escaped, to generate valid XML, if serialized. This is the default for 634 627 every parsed or created text node (with the exception of that text nodes in a 635 628 result tree of an XSLT transformation, for which disabling output escaping was 636 629 requested explicitely in the stylesheet). The return value 1 means, that output 637 630 escaping is disabled for this text node. If such a text node is serialized 638 -(with asXML or asHTML), it is literarily written, without escaping of the 631 +(with asXML or asHTML), it is literally written, without escaping of the 639 632 special XML characters. If the optional boolean value <i class="m">boolean</i> is given, 640 -the flag is set accordingly. You should not set this flag to 1, until you 641 -really know, what you do.</dd> 633 +the flag is set accordingly. You should not set this flag to 1 until you 634 +really know what you do.</dd> 642 635 643 636 644 637 645 638 <dt> 646 639 <b class="method">precedes</b> <i class="m">refnode</i> 647 640 </dt> 648 641 <dd>Compares the relative order of the node and <i class="m">refnode</i>. Both 649 642 nodes must be part of the same documents and not out of the fragment list of 650 -the document. Returns true, if node is in document order (in the sense of the 651 -XPath 1.0 recommendation) before <i class="m">refnode</i> and false otherwise.</dd> 643 +the document. Returns true if node is in document order (in the sense of the 644 +XPath 1.0 recommendation) before <i class="m">refnode</i>, and false otherwise.</dd> 652 645 653 646 654 647 655 648 656 649 <dt> 657 650 <b class="method">normalize</b> <i class="m">?-forXPath?</i> 658 651 </dt> ................................................................................ 681 674 <p>The optional <i class="m">-parameters</i> option sets top level 682 675 <xsl:param> to string values. The <i class="m">parameterList</i> has to be a tcl 683 676 list consisting of parameter name and value pairs.</p> 684 677 685 678 <p>If the option <i class="m">-ignoreUndeclaredParameters</i> is given, then parameter 686 679 names in the <i class="m">parameterList</i> given to the <i class="m">-parameters</i> options that 687 680 are not declared as top-level parameters in the stylesheet are silently 688 -ignored. Without this option, an error is raised, if the user tries to set a 689 -top-level parameter, which is not declared in the stylesheet.</p> 681 +ignored. Without this option, an error is raised if the user tries to set a 682 +top-level parameter which is not declared in the stylesheet.</p> 690 683 691 -<p>The option <i class="m">-maxApplyDepth</i> expects a positiv integer as 684 +<p>The option <i class="m">-maxApplyDepth</i> expects a positive integer as 692 685 argument. By default, the xslt engine allows xslt templates to nest up 693 686 to 3000 levels (and raises error if they nest deeper). This limit can 694 687 be set by the <i class="m">-maxApplyDepth</i> option.</p> 695 688 696 689 <p>The <i class="m">-xsltmessagecmd</i> option sets a callback for xslt:message elements 697 690 in the stylesheet. The actual command consists of the script, given as argument 698 691 to the option, appended with the XML Fragment from instantiating the 699 692 xsl:message element content as string (as if the XPath string() function would 700 -have been applied to the XML Fragment) and a flag, which indicates, if the 693 +have been applied to the XML Fragment) and a flag, which indicates wether the 701 694 xsl:message has an attribute "terminate" with the value "yes". If the 702 695 called script returns anything else then TCL_OK then the xslt 703 696 transformation will be aborted, returning error. If the called script 704 -returns -code break, the error message is empty, otherwise the result 705 -code is reported. In case of terminated transformation, the outputVar, 697 +returns -code break the error message is empty, otherwise the result 698 +code is reported. In case of terminated transformation the outputVar, 706 699 if given, is set to the empty string.</p> 707 700 </dd> 708 701 709 702 710 703 711 704 <dt><i class="m">@attrName</i></dt> 712 705 <dd>Returns the value of the attribute <i class="m">attrName</i>. Short cut ................................................................................ 728 721 729 722 730 723 </dl><p>Otherwise, if an unknown method name is given, the command with the same 731 724 name as the given method within the namespace <tt class="l">::dom::domNode</tt> is tried to 732 725 be executed. This allows quick method additions on Tcl level.</p> 733 726 734 727 735 - <h2><a name="SECTid0xb81b10">SEE ALSO</a></h2><p class="seealso">dom, domDoc</p> 728 + <h2><a name="SECTid0x1f86500">SEE ALSO</a></h2><p class="seealso">dom, domDoc</p> 736 729 737 - <h2><a name="SECTid0xb81ea0">KEYWORDS</a></h2><p class="keywords"> 730 + <h2><a name="SECTid0x1f86890">KEYWORDS</a></h2><p class="keywords"> 738 731 <a class="keyword" href="keyword-index.html#KW-XML">XML</a>, <a class="keyword" href="keyword-index.html#KW-DOM">DOM</a>, <a class="keyword" href="keyword-index.html#KW-document">document</a>, <a class="keyword" href="keyword-index.html#KW-node">node</a>, <a class="keyword" href="keyword-index.html#KW-parsing">parsing</a> 739 732 </p> 740 733 741 734 </div><hr class="navsep"><div class="navbar" align="center"> 742 -<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> 735 +<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> · <a class="navaid" href="http://tdom.org">Repository</a> 743 736 </div> 744 737 </body> 745 738 </html>
Changes to doc/domNode.n.
200 200 the data for element nodes of type TEXT_NODE, COMMENT_NODE, 201 201 PROCESSING_INSTRUCTION_NODE or CDATA_SECTION_NODE). Otherwise it is empty. If 202 202 the node is a TEXT_NODE, COMMENT_NODE or PROCESSING_INSTRUCTION_NODE and the 203 203 optional argument \fInewValue\fR is given, the node is set to that 204 204 value. 205 205 .TP 206 206 \&\fB\fBhasChildNodes\fP 207 -\&\fRReturns 1 if the has children. Otherwise 0 is returned. 207 +\&\fRReturns 1 if the node has children. Otherwise 0 is returned. 208 208 .TP 209 209 \&\fB\fBparentNode\fP \fB?objVar?\fP 210 210 \&\fRReturns the parent node. 211 211 .TP 212 212 \&\fB\fBchildNodes\fP 213 213 \&\fRReturns a list of direct children node objects. 214 214 .TP 215 215 \&\fB\fBchildNodesLive\fP 216 216 \&\fRReturns a "live" nodeList object of the child nodes of 217 217 the node in the sense of the DOM recommendation. This nodeList object is 218 218 "live" in the sense that, for instance, changes to the children of 219 219 the node object that it was created from are immediately reflected in the nodes 220 220 returned by the NodeList accessors; it is not a static snapshot of the content 221 -of the node. The both accessors know by the nodeList object are "item 221 +of the node. The two accessors known by the nodeList object are "item 222 222 <index>", which returns the indexth item in the collection, and 223 223 "length", which returns the number of nodes in the list. 224 224 .TP 225 225 \&\fB\fBfirstChild\fP \fB?objVar?\fP 226 226 \&\fRReturns the first child as a node object. 227 227 .TP 228 228 \&\fB\fBlastChild\fP \fB?objVar?\fP 229 229 \&\fRReturns the last child as a node object. 230 230 .TP 231 231 \&\fB\fBnextSibling\fP \fB?objVar?\fP 232 -\&\fRReturns the next sibling relativ to the current node as a node 232 +\&\fRReturns the next sibling relative to the current node as a node 233 233 object. 234 234 .TP 235 235 \&\fB\fBpreviousSibling\fP \fB?objVar?\fP 236 -\&\fRReturns the next sibling relativ to the current node as a node 236 +\&\fRReturns the next sibling relative to the current node as a node 237 237 object. 238 238 .TP 239 239 \&\fB\fBgetElementsByTagName\fP \fIname\fB 240 240 \&\fRReturns a list of all elements in the subtree matching (glob 241 241 style) \fIname\fR. 242 242 .TP 243 243 \&\fB\fBgetElementsByTagNameNS\fP \fIuri\fB \fIlocalname\fB 244 244 \&\fRReturns a list of all elements in the subtree 245 245 matching (glob style) \fIlocalname\fR and having the given namespace 246 246 \&\fIuri\fR. 247 247 .TP 248 248 \&\fB\fBgetElementById\fP \fIid\fB 249 -\&\fRReturns the node having a id attribute with value 250 -\&\fIid\fR or the emtpy string, if no node has an id attribute with that value. 249 +\&\fRReturns the node having an id attribute with value 250 +\&\fIid\fR or the emtpy string if no node has an id attribute with that value. 251 251 .TP 252 252 \&\fB\fBhasAttribute\fP \fIattributeName\fB 253 253 \&\fRReturns 1 if the object node contains an attribute with name 254 254 \&\fIattributeName\fR . Otherwise 0 is returned. 255 255 .TP 256 256 \&\fB\fBgetAttribute\fP \fIattributeName ?defaultValue?\fB 257 -\&\fRReturns the value of the attribute \fIattributeName\fR. If 257 +\&\fRReturns the value of the attribute \fIattributeName\fR. If the 258 258 attribute is not available \fIdefaultValue\fR is returned. 259 259 .TP 260 260 \&\fB\fBsetAttribute\fP \fIattributeName newValue ?attributeName newValue ...?\fB 261 261 \&\fRSets the value for one or more attributes. Every 262 -\&\fIattributeName\fR is set to the corresponding \fInewValue\fR. If there 263 -isn't an attribute for one or more of the \fIattributeName\fR this will 264 -create that attribute. 262 +\&\fIattributeName\fR is set to the corresponding 263 +\&\fInewValue\fR. If there isn't an attribute for one or more 264 +of the \fIattributeName\fR, this will create that attribute. 265 +It is not recommended to set attributes that look like xml 266 +namespace declarations. 265 267 .TP 266 268 \&\fB\fBremoveAttribute\fP \fIattributeName\fB 267 269 \&\fRRemoves the attribute \fIattributeName\fR. 268 270 .TP 269 271 \&\fB\fBhasAttributeNS\fP \fIuri\fB \fIlocalName\fB 270 272 \&\fRReturns 1 if the object node contains an attribute with the 271 273 local name \fIlocalName\fR within the namespace \fIuri\fR. Otherwise 0 is ................................................................................ 300 302 301 303 302 304 303 305 .CS 304 306 $node setAttributeNS "" attri "some Value" 305 307 .CE 306 308 .PP 307 -XML namespace nodes are not in any namespace. Set them this way: 308 - 309 - 310 - 311 -.CS 312 -$node setAttributeNS "" xmlns:myprefix "myNamespaceURI" 313 -$node setAttributeNS "" xmlns "newDefaultNamespace" 314 -.CE 315 -.PP 316 -If your \fIqualifiedName\fR has the prefix "xml" and you give the empty 317 -string as \fIuri\fR, the namespace of the attribute defaults to 318 -"http://www.w3.org/XML/1998/namespace", as the DOM 2 recommendation 319 -requests. With the exceptions of the special prefixes "xmlns" and "xml" you 309 +With the exceptions of the special prefixes "xmlns" and "xml" you 320 310 always must provide a non emtpy \fIuri\fR, if your \fIqualifiedName\fR has a 321 -prefix. 311 +prefix. It is not recommended to set xml namespace declarations. The effects are complicated and not always obvious up to resulting a not well-formed serializations after further processing. 322 312 .RE 323 313 .TP 324 314 \&\fB\fBremoveAttributeNS\fP \fIuri\fB \fIlocalName\fB 325 315 \&\fRRemoves the attribute with the local name \fIlocalName\fR within 326 316 the namespace \fIuri\fR. 327 317 .TP 328 318 \&\fB\fBattributes\fP \fB?attributeNamePattern?\fP 329 319 \&\fRReturns all attributes matching the \fIattributeNamePattern\fR. 330 -If \fIattributeNamePattern\fR isn't given all attributes are returned as a Tcl 320 +If \fIattributeNamePattern\fR isn't given, all attributes are returned as a Tcl 331 321 list. 332 322 .TP 333 323 \&\fB\fBappendChild\fP \fInewChild\fB 334 -\&\fRAppend \fInewChild\fR to the end of the child list of the 324 +\&\fRAppends \fInewChild\fR to the end of the child list of the 335 325 node. 336 326 .TP 337 327 \&\fB\fBinsertBefore\fP \fInewChild\fB \fIrefChild\fB 338 -\&\fRInsert \fInewChild\fR before the \fIrefChild\fR into the list of 328 +\&\fRInserts \fInewChild\fR before the \fIrefChild\fR into the list of 339 329 children of node. If \fIrefChild\fR is the empty string, insert 340 330 \&\fInewChild\fR at the end of the child nodes list of that node. 341 331 .TP 342 332 \&\fB\fBreplaceChild\fP \fInewChild\fB \fIoldChild\fB 343 -\&\fRReplace \fIoldChild\fR with \fInewChild\fR in the list of 333 +\&\fRReplaces \fIoldChild\fR with \fInewChild\fR in the list of 344 334 children of that node. The \fIoldChild\fR node will be part of the 345 335 document fragment list after this operation. 346 336 .TP 347 337 \&\fB\fBremoveChild\fP \fIchild\fB 348 -\&\fRRemoves \fIchild\fR from the list of children of that node 338 +\&\fRRemoves \fIchild\fR from the list of children of that node. 349 339 \&\fIchild\fR will be part of the document fragment list after this 350 -operation. It is not physically deleted. 340 +operation. 351 341 .TP 352 342 \&\fB\fBdelete\fP 353 343 \&\fRDeletes the given node and its complete child tree 354 344 and frees the complete internal memory. The affected nodes are not accessible 355 345 through the document fragment list. 356 346 .TP 357 347 \&\fB\fBcloneNode\fP \fB?-deep?\fP ................................................................................ 425 415 the XPath syntax to put an XPath variable. Ignoring the syntax rules of 426 416 XPath the Tcl variable name may be any legal Tcl var name: local 427 417 variables, global variables, array entries and so on. The value will 428 418 always be seen as string literal by the xpath engine. Cast the value 429 419 explicitly with the according xpath functions (number(), boolean()) to 430 420 another data type, if needed. 431 421 .PP 432 -Simmilar to the above descibed way to inject literals in a secure 422 +Similar to the way described above to inject literals in a secure 433 423 way into the XPath expression using tcl variable references there is a 434 424 syntax to inject element names from tcl variables. At every place 435 425 where the XPath syntax allows a node test there could be a tcl 436 426 variable reference (in any form), just the leading $ replaced with %. 437 427 This allows to select nodes with 'strange' (invalid, according to the 438 428 appropriate XML production rule) node names which may be needed in 439 429 case of working with JSON data. ................................................................................ 443 433 namespace prefix within the xpath expression will be first resolved 444 434 against the list of prefix / namespace pairs set with the 445 435 selectNodesNamespaces method for the document, the node belongs to. If 446 436 this fails, then the namespace definitions in scope of the context 447 437 node will be used to resolve the prefix. If this option is given, any 448 438 namespace prefix within the xpath expression will be first resolved 449 439 against that given list (and ignoring the document global prefix / 450 -namespace list). If the list bind the same prefix to different 440 +namespace list). If the list binds the same prefix to different 451 441 namespaces, then the first binding will win. If this fails, then the 452 442 namespace definitions in scope of the context node will be used to 453 443 resolve the prefix, as usual. 454 444 .PP 455 445 If the \fI-cache\fR option is used with a true value, then the 456 446 \&\fIxpathQuery\fR will be looked up in a document specific cache. If 457 447 the query is found, then the stored pre-compiled query will be used. 458 448 If the query isn't found, it will be compiled and stored in the cache, 459 -for use in further calls. Please notice, that the \fIxpathQuery\fR as 449 +for use in further calls. Please note that the \fIxpathQuery\fR 460 450 given as string is used as key for the cache. This means, that equal 461 451 XPath expressions, which differ only in white space are treated as 462 452 different cache entries. Special care is needed, if the XPath 463 453 expression includes namespace prefixes or references to tcl variables. 464 454 Both namespace prefixes and tcl variable references will be resolved 465 455 according to the XML prefix namespace mappings and tcl variable values 466 456 at expression compilation time. If the same XPath expression is used ................................................................................ 508 498 channelId. 509 499 .PP 510 500 If the option \fI-escapeNonASCII\fR is given, 511 501 every non 7 bit ASCII character in attribute values or element 512 502 PCDATA content will be escaped as character reference in 513 503 decimal representation. 514 504 .PP 515 -The flag \fI-xmlDeclaration\fR determines, whether there 505 +The flag \fI-xmlDeclaration\fR determines whether there 516 506 will be an XML Declaration and a newline emitted before 517 507 anything else. The default is, to do not. If this flag is 518 508 given with a true argument then 519 509 .PP 520 510 \&\fI-encString\fR sets the encoding value in the XML 521 511 Declaration. Otherwise, this option is ignored. Please note, 522 512 that this option just enhance the string representation of the ................................................................................ 538 528 \&\fRReturns the DOM substree starting from the current node as the 539 529 root node of the result serialized acording to HTML rules (HTML elements are 540 530 recognized regardless of case, without end tags for emtpy HTML elements etc.), 541 531 as string or sends the output directly to the given channelId. If the option 542 532 \&\fI-escapeNonASCII\fR is given, every non 7 bit ASCII character in attribute 543 533 values or element PCDATA content will be escaped as character reference in 544 534 decimal representation. If the option \fI-htmlEntities\fR is given, a 545 -character is outputed using a HTML 4.01 character entity reference, if one is 535 +character is written using its HTML 4.01 character entity reference, if one is 546 536 defined for it. 547 537 .TP 548 538 \&\fB\fBasText\fP 549 539 \&\fRFor ELEMENT_NODEs, the asText method outputs 550 540 the string-value of every text node descendant of node in document 551 541 order without any escaping. For every other node type, this method outputs the 552 542 the XPath string value of that node. ................................................................................ 559 549 \&\fRAppends the nodes created in the \fItclScript\fR by 560 550 Tcl functions, which have been built using \fIdom createNodeCmd\fR, to the 561 551 given node. 562 552 .TP 563 553 \&\fB\fBinsertBeforeFromScript\fP \fItclScript\fB \fIrefChild\fB 564 554 \&\fRInserts the nodes created in the \fItclScript\fR by 565 555 Tcl functions, which have been built using \fIdom createNodeCmd\fR, before the 566 -\&\fIrefChild\fR into to the list of children of node. If \fIrefChild\fR is 556 +\&\fIrefChild\fR into the list of children of node. If \fIrefChild\fR is 567 557 the empty string, the new nodes will be appended. 568 558 .TP 569 559 \&\fB\fBappendXML\fP \fIXMLstring\fB 570 560 \&\fRParses \fIXMLstring\fR, creates an according DOM subtree and 571 561 appends this subtree to the current node. 572 562 .TP 573 563 \&\fB\fBsimpleTranslate\fP \fIoutputVar\fB \fIspecifications\fB 574 -\&\fRTranslate the subtree starting at the object node according to 564 +\&\fRTranslates the subtree starting at the object node according to 575 565 the specifications in \fIspecifications\fR and outputs the result in the 576 566 variable \fIoutputVar\fR . The translation is very similar to Cost Simple 577 567 mode. 578 568 .TP 579 569 \&\fB\fBtoXPath\fP \fI?-legacy?\fB 580 570 \&\fRReturns an XPath, which exactly addresses the given 581 571 node in its document. This XPath is only valid as there are no changes to DOM ................................................................................ 584 574 .TP 585 575 \&\fB\fBgetBaseURI\fP 586 576 \&\fRReturns the baseURI of the node. This method is deprecated in 587 577 favor of the \fIbaseURI\fR method. 588 578 .TP 589 579 \&\fB\fBbaseURI\fP \fI?URI?\fB 590 580 \&\fRReturns the present baseURI of the node. If the optional 591 -argument URI is given, sets the base URI of the node and of all of its child 581 +argument URI is given, it sets the base URI of the node and of all of its child 592 582 nodes out of the same enitity as node to the given URI. 593 583 .TP 594 584 \&\fB\fBdisableOutputEscaping\fP \fI?boolean?\fB 595 -\&\fRThis method works only for text nodes; for every other nodes it 585 +\&\fRThis method works only for text nodes; for every other node it 596 586 returns error. Without the optional argument it returns, if disabling output 597 587 escaping is on. The return value 0 means, the characters of the text node will 598 588 be escaped, to generate valid XML, if serialized. This is the default for 599 589 every parsed or created text node (with the exception of that text nodes in a 600 590 result tree of an XSLT transformation, for which disabling output escaping was 601 591 requested explicitely in the stylesheet). The return value 1 means, that output 602 592 escaping is disabled for this text node. If such a text node is serialized 603 -(with asXML or asHTML), it is literarily written, without escaping of the 593 +(with asXML or asHTML), it is literally written, without escaping of the 604 594 special XML characters. If the optional boolean value \fIboolean\fR is given, 605 -the flag is set accordingly. You should not set this flag to 1, until you 606 -really know, what you do. 595 +the flag is set accordingly. You should not set this flag to 1 until you 596 +really know what you do. 607 597 .TP 608 598 \&\fB\fBprecedes\fP \fIrefnode\fB 609 599 \&\fRCompares the relative order of the node and \fIrefnode\fR. Both 610 600 nodes must be part of the same documents and not out of the fragment list of 611 -the document. Returns true, if node is in document order (in the sense of the 612 -XPath 1.0 recommendation) before \fIrefnode\fR and false otherwise. 601 +the document. Returns true if node is in document order (in the sense of the 602 +XPath 1.0 recommendation) before \fIrefnode\fR, and false otherwise. 613 603 .TP 614 604 \&\fB\fBnormalize\fP \fI?-forXPath?\fB 615 605 \&\fRPuts all Text nodes in the full depth of the sub-tree underneath 616 606 this Node into a "normal" form where only structure (e.g., elements, 617 607 comments, processing instructions and CDATA 618 608 sections) separates Text nodes, i.e., there 619 609 are neither adjacent Text nodes nor empty Text nodes. If the option ................................................................................ 631 621 The optional \fI-parameters\fR option sets top level 632 622 <xsl:param> to string values. The \fIparameterList\fR has to be a tcl 633 623 list consisting of parameter name and value pairs. 634 624 .PP 635 625 If the option \fI-ignoreUndeclaredParameters\fR is given, then parameter 636 626 names in the \fIparameterList\fR given to the \fI-parameters\fR options that 637 627 are not declared as top-level parameters in the stylesheet are silently 638 -ignored. Without this option, an error is raised, if the user tries to set a 639 -top-level parameter, which is not declared in the stylesheet. 628 +ignored. Without this option, an error is raised if the user tries to set a 629 +top-level parameter which is not declared in the stylesheet. 640 630 .PP 641 -The option \fI-maxApplyDepth\fR expects a positiv integer as 631 +The option \fI-maxApplyDepth\fR expects a positive integer as 642 632 argument. By default, the xslt engine allows xslt templates to nest up 643 633 to 3000 levels (and raises error if they nest deeper). This limit can 644 634 be set by the \fI-maxApplyDepth\fR option. 645 635 .PP 646 636 The \fI-xsltmessagecmd\fR option sets a callback for xslt:message elements 647 637 in the stylesheet. The actual command consists of the script, given as argument 648 638 to the option, appended with the XML Fragment from instantiating the 649 639 xsl:message element content as string (as if the XPath string() function would 650 -have been applied to the XML Fragment) and a flag, which indicates, if the 640 +have been applied to the XML Fragment) and a flag, which indicates wether the 651 641 xsl:message has an attribute "terminate" with the value "yes". If the 652 642 called script returns anything else then TCL_OK then the xslt 653 643 transformation will be aborted, returning error. If the called script 654 -returns -code break, the error message is empty, otherwise the result 655 -code is reported. In case of terminated transformation, the outputVar, 644 +returns -code break the error message is empty, otherwise the result 645 +code is reported. In case of terminated transformation the outputVar, 656 646 if given, is set to the empty string. 657 647 .RE 658 648 .TP 659 649 \&\fB\fI@attrName\fB 660 650 \&\fRReturns the value of the attribute \fIattrName\fR. Short cut 661 651 for \fIgetAttribute\fR. 662 652 .TP
Changes to doc/domNode.xml.
64 64 optional argument <m>newValue</m> is given, the node is set to that 65 65 value.</desc> 66 66 67 67 </commanddef> 68 68 69 69 <commanddef> 70 70 <command><method>hasChildNodes</method></command> 71 - <desc>Returns 1 if the has children. Otherwise 0 is returned.</desc> 71 + <desc>Returns 1 if the node has children. Otherwise 0 is returned.</desc> 72 72 </commanddef> 73 73 74 74 <commanddef> 75 75 <command><method>parentNode</method> <variable>?objVar?</variable></command> 76 76 <desc>Returns the parent node.</desc> 77 77 </commanddef> 78 78 ................................................................................ 84 84 <commanddef> 85 85 <command><method>childNodesLive</method></command> 86 86 <desc>Returns a "live" nodeList object of the child nodes of 87 87 the node in the sense of the DOM recommendation. This nodeList object is 88 88 "live" in the sense that, for instance, changes to the children of 89 89 the node object that it was created from are immediately reflected in the nodes 90 90 returned by the NodeList accessors; it is not a static snapshot of the content 91 -of the node. The both accessors know by the nodeList object are "item 91 +of the node. The two accessors known by the nodeList object are "item 92 92 <index>", which returns the indexth item in the collection, and 93 93 "length", which returns the number of nodes in the list.</desc> 94 94 </commanddef> 95 95 96 96 <commanddef> 97 97 <command><method>firstChild</method> <variable>?objVar?</variable></command> 98 98 <desc>Returns the first child as a node object.</desc> ................................................................................ 101 101 <commanddef> 102 102 <command><method>lastChild</method> <variable>?objVar?</variable></command> 103 103 <desc>Returns the last child as a node object.</desc> 104 104 </commanddef> 105 105 106 106 <commanddef> 107 107 <command><method>nextSibling</method> <variable>?objVar?</variable></command> 108 - <desc>Returns the next sibling relativ to the current node as a node 108 + <desc>Returns the next sibling relative to the current node as a node 109 109 object.</desc> 110 110 </commanddef> 111 111 112 112 <commanddef> 113 113 <command><method>previousSibling</method> <variable>?objVar?</variable></command> 114 - <desc>Returns the next sibling relativ to the current node as a node 114 + <desc>Returns the next sibling relative to the current node as a node 115 115 object.</desc> 116 116 </commanddef> 117 117 118 118 <commanddef> 119 119 <command><method>getElementsByTagName</method> <m>name</m></command> 120 120 <desc>Returns a list of all elements in the subtree matching (glob 121 121 style) <m>name</m>.</desc> ................................................................................ 126 126 <desc>Returns a list of all elements in the subtree 127 127 matching (glob style) <m>localname</m> and having the given namespace 128 128 <m>uri</m>.</desc> 129 129 </commanddef> 130 130 131 131 <commanddef> 132 132 <command><method>getElementById</method> <m>id</m></command> 133 - <desc>Returns the node having a id attribute with value 134 -<m>id</m> or the emtpy string, if no node has an id attribute with that value.</desc> 133 + <desc>Returns the node having an id attribute with value 134 +<m>id</m> or the emtpy string if no node has an id attribute with that value.</desc> 135 135 </commanddef> 136 136 137 137 <commanddef> 138 138 <command><method>hasAttribute</method> <m>attributeName</m></command> 139 139 <desc>Returns 1 if the object node contains an attribute with name 140 140 <m>attributeName</m> . Otherwise 0 is returned.</desc> 141 141 </commanddef> 142 142 143 143 <commanddef> 144 144 <command><method>getAttribute</method> <m>attributeName ?defaultValue?</m></command> 145 - <desc>Returns the value of the attribute <m>attributeName</m>. If 145 + <desc>Returns the value of the attribute <m>attributeName</m>. If the 146 146 attribute is not available <m>defaultValue</m> is returned.</desc> 147 147 </commanddef> 148 148 149 149 <commanddef> 150 150 <command><method>setAttribute</method> <m>attributeName newValue 151 151 ?attributeName newValue ...?</m></command> 152 152 <desc>Sets the value for one or more attributes. Every 153 153 <m>attributeName</m> is set to the corresponding 154 154 <m>newValue</m>. If there isn't an attribute for one or more 155 - of the <m>attributeName</m> this will create that attribute. 155 + of the <m>attributeName</m>, this will create that attribute. 156 156 It is not recommended to set attributes that look like xml 157 157 namespace declarations.</desc> 158 - 159 158 </commanddef> 160 159 161 160 <commanddef> 162 161 <command><method>removeAttribute</method> <m>attributeName</m></command> 163 162 <desc>Removes the attribute <m>attributeName</m>.</desc> 164 163 </commanddef> 165 164 ................................................................................ 207 206 <desc>Removes the attribute with the local name <m>localName</m> within 208 207 the namespace <m>uri</m>.</desc> 209 208 </commanddef> 210 209 211 210 <commanddef> 212 211 <command><method>attributes</method> <option>?attributeNamePattern?</option></command> 213 212 <desc>Returns all attributes matching the <m>attributeNamePattern</m>. 214 -If <m>attributeNamePattern</m> isn't given all attributes are returned as a Tcl 213 +If <m>attributeNamePattern</m> isn't given, all attributes are returned as a Tcl 215 214 list.</desc> 216 215 </commanddef> 217 216 218 217 <commanddef> 219 218 <command><method>appendChild</method> <m>newChild</m></command> 220 - <desc>Append <m>newChild</m> to the end of the child list of the 219 + <desc>Appends <m>newChild</m> to the end of the child list of the 221 220 node.</desc> 222 221 </commanddef> 223 222 224 223 <commanddef> 225 224 <command><method>insertBefore</method> <m>newChild</m> <m>refChild</m></command> 226 - <desc>Insert <m>newChild</m> before the <m>refChild</m> into the list of 225 + <desc>Inserts <m>newChild</m> before the <m>refChild</m> into the list of 227 226 children of node. If <m>refChild</m> is the empty string, insert 228 227 <m>newChild</m> at the end of the child nodes list of that node.</desc> 229 228 </commanddef> 230 229 231 230 <commanddef> 232 231 <command><method>replaceChild</method> <m>newChild</m> <m>oldChild</m></command> 233 - <desc>Replace <m>oldChild</m> with <m>newChild</m> in the list of 232 + <desc>Replaces <m>oldChild</m> with <m>newChild</m> in the list of 234 233 children of that node. The <m>oldChild</m> node will be part of the 235 234 document fragment list after this operation.</desc> 236 235 </commanddef> 237 236 238 237 <commanddef> 239 238 <command><method>removeChild</method> <m>child</m></command> 240 - <desc>Removes <m>child</m> from the list of children of that node 239 + <desc>Removes <m>child</m> from the list of children of that node. 241 240 <m>child</m> will be part of the document fragment list after this 242 -operation. It is not physically deleted.</desc> 241 +operation.</desc> 243 242 </commanddef> 244 243 245 244 <commanddef> 246 245 <command><method>delete</method></command> 247 246 <desc>Deletes the given node and its complete child tree 248 247 and frees the complete internal memory. The affected nodes are not accessible 249 248 through the document fragment list.</desc> ................................................................................ 354 353 the XPath syntax to put an XPath variable. Ignoring the syntax rules of 355 354 XPath the Tcl variable name may be any legal Tcl var name: local 356 355 variables, global variables, array entries and so on. The value will 357 356 always be seen as string literal by the xpath engine. Cast the value 358 357 explicitly with the according xpath functions (number(), boolean()) to 359 358 another data type, if needed.</p> 360 359 361 -<p>Simmilar to the above descibed way to inject literals in a secure 360 +<p>Similar to the way described above to inject literals in a secure 362 361 way into the XPath expression using tcl variable references there is a 363 362 syntax to inject element names from tcl variables. At every place 364 363 where the XPath syntax allows a node test there could be a tcl 365 364 variable reference (in any form), just the leading $ replaced with %. 366 365 This allows to select nodes with 'strange' (invalid, according to the 367 366 appropriate XML production rule) node names which may be needed in 368 367 case of working with JSON data.</p> ................................................................................ 372 371 namespace prefix within the xpath expression will be first resolved 373 372 against the list of prefix / namespace pairs set with the 374 373 selectNodesNamespaces method for the document, the node belongs to. If 375 374 this fails, then the namespace definitions in scope of the context 376 375 node will be used to resolve the prefix. If this option is given, any 377 376 namespace prefix within the xpath expression will be first resolved 378 377 against that given list (and ignoring the document global prefix / 379 -namespace list). If the list bind the same prefix to different 378 +namespace list). If the list binds the same prefix to different 380 379 namespaces, then the first binding will win. If this fails, then the 381 380 namespace definitions in scope of the context node will be used to 382 381 resolve the prefix, as usual.</p> 383 382 384 383 <p>If the <m>-cache</m> option is used with a true value, then the 385 384 <m>xpathQuery</m> will be looked up in a document specific cache. If 386 385 the query is found, then the stored pre-compiled query will be used. 387 386 If the query isn't found, it will be compiled and stored in the cache, 388 -for use in further calls. Please notice, that the <m>xpathQuery</m> as 387 +for use in further calls. Please note that the <m>xpathQuery</m> 389 388 given as string is used as key for the cache. This means, that equal 390 389 XPath expressions, which differ only in white space are treated as 391 390 different cache entries. Special care is needed, if the XPath 392 391 expression includes namespace prefixes or references to tcl variables. 393 392 Both namespace prefixes and tcl variable references will be resolved 394 393 according to the XML prefix namespace mappings and tcl variable values 395 394 at expression compilation time. If the same XPath expression is used ................................................................................ 439 438 channelId.</p> 440 439 441 440 <p>If the option <m>-escapeNonASCII</m> is given, 442 441 every non 7 bit ASCII character in attribute values or element 443 442 PCDATA content will be escaped as character reference in 444 443 decimal representation.</p> 445 444 446 - <p>The flag <m>-xmlDeclaration</m> determines, whether there 445 + <p>The flag <m>-xmlDeclaration</m> determines whether there 447 446 will be an XML Declaration and a newline emitted before 448 447 anything else. The default is, to do not. If this flag is 449 448 given with a true argument then</p> 450 449 451 450 <p><m>-encString</m> sets the encoding value in the XML 452 451 Declaration. Otherwise, this option is ignored. Please note, 453 452 that this option just enhance the string representation of the ................................................................................ 472 471 <desc>Returns the DOM substree starting from the current node as the 473 472 root node of the result serialized acording to HTML rules (HTML elements are 474 473 recognized regardless of case, without end tags for emtpy HTML elements etc.), 475 474 as string or sends the output directly to the given channelId. If the option 476 475 <m>-escapeNonASCII</m> is given, every non 7 bit ASCII character in attribute 477 476 values or element PCDATA content will be escaped as character reference in 478 477 decimal representation. If the option <m>-htmlEntities</m> is given, a 479 -character is outputed using a HTML 4.01 character entity reference, if one is 478 +character is written using its HTML 4.01 character entity reference, if one is 480 479 defined for it.</desc> 481 480 </commanddef> 482 481 483 482 <commanddef> 484 483 <command><method>asText</method></command> 485 484 <desc>For ELEMENT_NODEs, the asText method outputs 486 485 the string-value of every text node descendant of node in document ................................................................................ 501 500 given node.</desc> 502 501 </commanddef> 503 502 504 503 <commanddef> 505 504 <command><method>insertBeforeFromScript</method> <m>tclScript</m> <m>refChild</m></command> 506 505 <desc>Inserts the nodes created in the <m>tclScript</m> by 507 506 Tcl functions, which have been built using <m>dom createNodeCmd</m>, before the 508 -<m>refChild</m> into to the list of children of node. If <m>refChild</m> is 507 +<m>refChild</m> into the list of children of node. If <m>refChild</m> is 509 508 the empty string, the new nodes will be appended.</desc> 510 509 </commanddef> 511 510 512 511 <commanddef> 513 512 <command><method>appendXML</method> <m>XMLstring</m></command> 514 513 <desc>Parses <m>XMLstring</m>, creates an according DOM subtree and 515 514 appends this subtree to the current node.</desc> 516 515 </commanddef> 517 516 518 517 <commanddef> 519 518 <command><method>simpleTranslate</method> <m>outputVar</m> 520 519 <m>specifications</m></command> 521 - <desc>Translate the subtree starting at the object node according to 520 + <desc>Translates the subtree starting at the object node according to 522 521 the specifications in <m>specifications</m> and outputs the result in the 523 522 variable <m>outputVar</m> . The translation is very similar to Cost Simple 524 523 mode.</desc> 525 524 </commanddef> 526 525 527 526 <commanddef> 528 527 <command><method>toXPath</method> <m>?-legacy?</m></command> ................................................................................ 537 536 <desc>Returns the baseURI of the node. This method is deprecated in 538 537 favor of the <m>baseURI</m> method.</desc> 539 538 </commanddef> 540 539 541 540 <commanddef> 542 541 <command><method>baseURI</method> <m>?URI?</m></command> 543 542 <desc>Returns the present baseURI of the node. If the optional 544 -argument URI is given, sets the base URI of the node and of all of its child 543 +argument URI is given, it sets the base URI of the node and of all of its child 545 544 nodes out of the same enitity as node to the given URI.</desc> 546 545 </commanddef> 547 546 548 547 <commanddef> 549 548 <command><method>disableOutputEscaping</method> <m>?boolean?</m></command> 550 - <desc>This method works only for text nodes; for every other nodes it 549 + <desc>This method works only for text nodes; for every other node it 551 550 returns error. Without the optional argument it returns, if disabling output 552 551 escaping is on. The return value 0 means, the characters of the text node will 553 552 be escaped, to generate valid XML, if serialized. This is the default for 554 553 every parsed or created text node (with the exception of that text nodes in a 555 554 result tree of an XSLT transformation, for which disabling output escaping was 556 555 requested explicitely in the stylesheet). The return value 1 means, that output 557 556 escaping is disabled for this text node. If such a text node is serialized 558 -(with asXML or asHTML), it is literarily written, without escaping of the 557 +(with asXML or asHTML), it is literally written, without escaping of the 559 558 special XML characters. If the optional boolean value <m>boolean</m> is given, 560 -the flag is set accordingly. You should not set this flag to 1, until you 561 -really know, what you do.</desc> 559 +the flag is set accordingly. You should not set this flag to 1 until you 560 +really know what you do.</desc> 562 561 </commanddef> 563 562 564 563 <commanddef> 565 564 <command><method>precedes</method> <m>refnode</m></command> 566 565 <desc>Compares the relative order of the node and <m>refnode</m>. Both 567 566 nodes must be part of the same documents and not out of the fragment list of 568 -the document. Returns true, if node is in document order (in the sense of the 569 -XPath 1.0 recommendation) before <m>refnode</m> and false otherwise.</desc> 567 +the document. Returns true if node is in document order (in the sense of the 568 +XPath 1.0 recommendation) before <m>refnode</m>, and false otherwise.</desc> 570 569 </commanddef> 571 570 572 571 573 572 <commanddef> 574 573 <command><method>normalize</method> <m>?-forXPath?</m></command> 575 574 <desc>Puts all Text nodes in the full depth of the sub-tree underneath 576 575 this Node into a "normal" form where only structure (e.g., elements, ................................................................................ 595 594 <p>The optional <m>-parameters</m> option sets top level 596 595 <xsl:param> to string values. The <m>parameterList</m> has to be a tcl 597 596 list consisting of parameter name and value pairs.</p> 598 597 599 598 <p>If the option <m>-ignoreUndeclaredParameters</m> is given, then parameter 600 599 names in the <m>parameterList</m> given to the <m>-parameters</m> options that 601 600 are not declared as top-level parameters in the stylesheet are silently 602 -ignored. Without this option, an error is raised, if the user tries to set a 603 -top-level parameter, which is not declared in the stylesheet.</p> 601 +ignored. Without this option, an error is raised if the user tries to set a 602 +top-level parameter which is not declared in the stylesheet.</p> 604 603 605 -<p>The option <m>-maxApplyDepth</m> expects a positiv integer as 604 +<p>The option <m>-maxApplyDepth</m> expects a positive integer as 606 605 argument. By default, the xslt engine allows xslt templates to nest up 607 606 to 3000 levels (and raises error if they nest deeper). This limit can 608 607 be set by the <m>-maxApplyDepth</m> option.</p> 609 608 610 609 <p>The <m>-xsltmessagecmd</m> option sets a callback for xslt:message elements 611 610 in the stylesheet. The actual command consists of the script, given as argument 612 611 to the option, appended with the XML Fragment from instantiating the 613 612 xsl:message element content as string (as if the XPath string() function would 614 -have been applied to the XML Fragment) and a flag, which indicates, if the 613 +have been applied to the XML Fragment) and a flag, which indicates wether the 615 614 xsl:message has an attribute "terminate" with the value "yes". If the 616 615 called script returns anything else then TCL_OK then the xslt 617 616 transformation will be aborted, returning error. If the called script 618 -returns -code break, the error message is empty, otherwise the result 619 -code is reported. In case of terminated transformation, the outputVar, 617 +returns -code break the error message is empty, otherwise the result 618 +code is reported. In case of terminated transformation the outputVar, 620 619 if given, is set to the empty string.</p> 621 620 </desc> 622 621 </commanddef> 623 622 624 623 <commanddef> 625 624 <command><m>@attrName</m></command> 626 625 <desc>Returns the value of the attribute <m>attrName</m>. Short cut
Changes to doc/expat.html.
1 1 <html> 2 2 <head> 3 -<link rel="stylesheet" href="manpage.css"><title>tDOM manual: expat</title><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: tmml-html.xsl,v $ $Revision: 1.11 $"> 3 +<link rel="stylesheet" href="manpage.css"><title>tDOM manual: expat</title><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: tmml-html.xsl,v $ $Revision: 1.11 $"><meta charset="utf-8"> 4 4 </head><body> 5 5 <div class="header"> 6 6 <div class="navbar" align="center"> 7 -<a href="#SECTid0x139ef10">NAME</a> · <a href="#SECTid0x13a60f0">SYNOPSIS</a> · <a href="#SECTid0x137dce0">DESCRIPTION</a> · <a href="#SECTid0x137ea20">COMMAND OPTIONS</a> · <a href="#SECTid0x13b9910"> COMMAND METHODS </a> · <a href="#SECTid0x13bfd70">Callback Command Return Codes</a> · <a href="#SECTid0x13c0900">SEE ALSO</a> · <a href="#SECTid0x13c0cc0">KEYWORDS</a> 7 +<a href="#SECTid0x1f2bd90">NAME</a> · <a href="#SECTid0x1e4da40">SYNOPSIS</a> · <a href="#SECTid0x1f36860">DESCRIPTION</a> · <a href="#SECTid0x1f375a0">COMMAND OPTIONS</a> · <a href="#SECTid0x1f75430"> COMMAND METHODS </a> · <a href="#SECTid0x1f7f8a0">Callback Command Return Codes</a> · <a href="#SECTid0x1f80430">SEE ALSO</a> · <a href="#SECTid0x1f807f0">KEYWORDS</a> 8 8 </div><hr class="navsep"> 9 9 </div><div class="body"> 10 - <h2><a name="SECTid0x139ef10">NAME</a></h2><p class="namesection"> 10 + <h2><a name="SECTid0x1f2bd90">NAME</a></h2><p class="namesection"> 11 11 <b class="names">expat - </b><br>Creates an instance of an expat parser object</p> 12 12 13 13 14 14 15 - <h2><a name="SECTid0x13a60f0">SYNOPSIS</a></h2><pre class="syntax">package require tdom 15 + <h2><a name="SECTid0x1e4da40">SYNOPSIS</a></h2><pre class="syntax">package require tdom 16 16 17 17 <b class="cmd">expat</b> ?<i class="m">parsername</i>? ?<i class="m">-namespace</i>? ?<i class="m">arg arg ..</i> 18 18 19 19 <b class="cmd">xml::parser</b> ?<i class="m">parsername</i>? ?<i class="m">-namespace</i>? ?<i class="m">arg arg ..</i> 20 20 </pre> 21 - <h2><a name="SECTid0x137dce0">DESCRIPTION</a></h2><p>The parser created with <i class="m">expat</i> or <i class="m">xml::parser</i> 21 + <h2><a name="SECTid0x1f36860">DESCRIPTION</a></h2><p>The parser created with <i class="m">expat</i> or <i class="m">xml::parser</i> 22 22 (which is just another name for the same command in an own namespace) are able 23 23 to parse any kind of well-formed XML. The parsers are stream oriented XML 24 24 parser. This means that you register handler scripts with the parser prior to 25 25 starting the parse. These handler scripts are called when the parser discovers 26 26 the associated structures in the document being parsed. A start tag is an 27 27 example of the kind of structures for which you may register a handler 28 28 script.</p><p>The parsers do not validate the XML document. They do parse the internal DTD ................................................................................ 31 31 there).</p><p>Additionly, the Tcl extension code that implements this command provides an 32 32 API for adding C level coded handlers. Up to now, there exists the parser 33 33 extension command "tdom". The handler set installed by this extension build an 34 34 in memory "tDOM" DOM tree, while the parser is parsing the input.</p><p>It is possible to register an arbitrary amount of different handler scripts 35 35 and C level handlers for most of the events. If the event occurs, they are 36 36 called in turn.</p> 37 37 38 - <h2><a name="SECTid0x137ea20">COMMAND OPTIONS</a></h2><dl class="optlist"> 38 + <h2><a name="SECTid0x1f375a0">COMMAND OPTIONS</a></h2><dl class="optlist"> 39 39 40 40 <dt><b>-namespace</b></dt> 41 41 42 42 <dd> 43 43 <p>Enables namespace parsing. You must use this option while 44 44 creating the parser with the <tt class="samp">expat</tt> or <tt class="samp">xml::parser</tt> 45 45 command. You can't enable (nor disable) namespace parsing with ................................................................................ 611 611 -paramentityparsing value of "never" (which is the default) suppresses any call 612 612 to the -externalentitycommand script. Pleace notice, that, if the document also 613 613 doesn't have an internal subset, the -startdoctypedeclcommand and 614 614 enddoctypedeclcommand scripts, if set, are not called.</dd> 615 615 616 616 617 617 </dl> 618 - <h2><a name="SECTid0x13b9910"> COMMAND METHODS </a></h2><dl class="commandlist"> 618 + <h2><a name="SECTid0x1f75430"> COMMAND METHODS </a></h2><dl class="commandlist"> 619 619 620 620 <dt> 621 621 <b class="cmd">parser</b> <b class="method">configure</b> <i class="m">option value ?option value?</i> 622 622 </dt> 623 623 624 624 <dd><p>Sets configuration options for the parser. Every command 625 625 option, except <i class="m">-namespace</i> can be set or modified with this method.</p></dd> ................................................................................ 762 762 <dd><p>Resets the parser in preparation for parsing another 763 763 document. A parser cannot be reseted from within one of its handler callbacks 764 764 (neither directly nor indirectly) and will raise a tcl error in this 765 765 cases.</p></dd> 766 766 767 767 </dl> 768 768 769 - <h2><a name="SECTid0x13bfd70">Callback Command Return Codes</a></h2><p>A script invoked for any of the parser callback commands, such as 769 + <h2><a name="SECTid0x1f7f8a0">Callback Command Return Codes</a></h2><p>A script invoked for any of the parser callback commands, such as 770 770 -elementstartcommand, -elementendcommand, etc, may return an error code other 771 771 than "ok" or "error". All callbacks may in addition return 772 772 "break" or "continue".</p><p>If a callback script returns an "error" error code then 773 773 processing of the document is terminated and the error is propagated in the 774 774 usual fashion.</p><p>If a callback script returns a "break" error code then all 775 775 further processing of every handler script out of this Tcl handler set is 776 776 suppressed for the further parsing. This does not influence any other handler 777 777 set.</p><p>If a callback script returns a "continue" error code then 778 778 processing of the current element, and its children, ceases for every handler 779 779 script out of this Tcl handler set and processing continues with the next 780 780 (sibling) element. This does not influence any other handler set.</p><p>If a callback script returns a "return" error 781 781 code then parsing is canceled altogether, but no error is raised.</p> 782 782 783 - <h2><a name="SECTid0x13c0900">SEE ALSO</a></h2><p class="seealso"> 783 + <h2><a name="SECTid0x1f80430">SEE ALSO</a></h2><p class="seealso"> 784 784 <a href="expatapi.html">expatapi</a>, <a href="tdomcmd.html">tdom</a> 785 785 </p> 786 786 787 - <h2><a name="SECTid0x13c0cc0">KEYWORDS</a></h2><p class="keywords"><a class="keyword" href="keyword-index.html#KW-SAX">SAX</a></p> 787 + <h2><a name="SECTid0x1f807f0">KEYWORDS</a></h2><p class="keywords"><a class="keyword" href="keyword-index.html#KW-SAX">SAX</a></p> 788 788 </div><hr class="navsep"><div class="navbar" align="center"> 789 -<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> 789 +<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> · <a class="navaid" href="http://tdom.org">Repository</a> 790 790 </div> 791 791 </body> 792 792 </html>
Changes to doc/expatapi.html.
1 1 <html> 2 2 <head> 3 -<link rel="stylesheet" href="manpage.css"><title>tDOM manual: expatapi</title><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: tmml-html.xsl,v $ $Revision: 1.11 $"> 3 +<link rel="stylesheet" href="manpage.css"><title>tDOM manual: expatapi</title><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: tmml-html.xsl,v $ $Revision: 1.11 $"><meta charset="utf-8"> 4 4 </head><body> 5 5 <div class="header"> 6 6 <div class="navbar" align="center"> 7 -<a href="#SECTid0x139c8b0">NAME</a> · <a href="#SECTid0x13eb870">SYNOPSIS</a> · <a href="#SECTid0x137b620">ARGUMENTS</a> · <a href="#SECTid0x137d6e0">DESCRIPTION</a> · <a href="#SECTid0x13b1f40">SEE ALSO</a> · <a href="#SECTid0x13b21e0">KEYWORDS</a> 7 +<a href="#SECTid0x1fa3230">NAME</a> · <a href="#SECTid0x1f5add0">SYNOPSIS</a> · <a href="#SECTid0x1f1ee50">ARGUMENTS</a> · <a href="#SECTid0x1f20f10">DESCRIPTION</a> · <a href="#SECTid0x1f2e6c0">SEE ALSO</a> · <a href="#SECTid0x1f2e960">KEYWORDS</a> 8 8 </div><hr class="navsep"> 9 9 </div><div class="body"> 10 - <h2><a name="SECTid0x139c8b0">NAME</a></h2><p class="namesection"> 10 + <h2><a name="SECTid0x1fa3230">NAME</a></h2><p class="namesection"> 11 11 <b class="names">CheckExpatParserObj, CHandlerSetInstall, CHandlerSetRemove, 12 12 CHandlerSetCreate, CHandlerSetGetUserData, GetExpatInfo - </b><br>Functions to create, install and remove expat parser object 13 13 extensions.</p> 14 - <h2><a name="SECTid0x13eb870">SYNOPSIS</a></h2><pre class="syntax">#include <tclexpat.h> 14 + <h2><a name="SECTid0x1f5add0">SYNOPSIS</a></h2><pre class="syntax">#include <tclexpat.h> 15 15 16 16 int 17 17 <b class="fun">CheckExpatParserObj</b> (<a href="#ARG-interp"><i>interp</i></a>, <a href="#ARG-nameObj"><i>nameObj</i></a>) 18 18 19 19 int 20 20 <b class="fun">CHandlerSetInstall</b> (<a href="#ARG-interp"><i>interp</i></a>, <a href="#ARG-expatObj"><i>expatObj</i></a>, <a href="#ARG-handlerSet"><i>handlerSet</i></a>) 21 21 ................................................................................ 31 31 void* 32 32 <b class="fun">CHandlerSetGetUserData</b> (<a href="#ARG-interp"><i>interp</i></a>, <a href="#ARG-expatObj"><i>expatObj</i></a>, <a href="#ARG-handlerSetName"><i>handlerSetName</i></a>) 33 33 34 34 TclGenExpatInfo* 35 35 <b class="fun">GetExpatInfo</b> (<a href="#ARG-interp"><i>interp</i></a>, <a href="#ARG-expatObj"><i>expatObj</i></a>) 36 36 </pre> 37 37 38 - <h2><a name="SECTid0x137b620">ARGUMENTS</a></h2><div class="arglist"><table width="100%" rules="none" cellpadding="5%"> 38 + <h2><a name="SECTid0x1f1ee50">ARGUMENTS</a></h2><div class="arglist"><table width="100%" rules="none" cellpadding="5%"> 39 39 <thead><tr class="heading"> 40 40 <th width="20%">Type</th><th width="70%">Name</th><th width="10%">Mode</th> 41 41 </tr></thead><tr class="syntax"> 42 42 <td class="type" width="20%" align="left">Tcl_Interp</td><td class="name" width="70%" align="left"><a name="ARG-interp">*interp</a></td><td class="mode" width="10%" align="center">in</td> 43 43 </tr><tr class="desc"> 44 44 <td class="padding" width="20%"> </td><td class="argdesc" width="80%" align="left" colspan="2">Interpreter with the expat parser object.</td> 45 45 </tr><tr class="syntax"> ................................................................................ 57 57 </tr><tr class="syntax"> 58 58 <td class="type" width="20%" align="left">Tcl_Obj</td><td class="name" width="70%" align="left"><a name="ARG-nameObj">*nameObj</a></td><td class="mode" width="10%" align="center"></td> 59 59 </tr><tr class="desc"> 60 60 <td class="padding" width="20%"> </td><td class="argdesc" width="80%" align="left" colspan="2">A Tcl Object containing the name of a expat parser object</td> 61 61 </tr> 62 62 </table></div> 63 63 64 - <h2><a name="SECTid0x137d6e0">DESCRIPTION</a></h2><p>The functions described in this manual allows to add C level coded event 64 + <h2><a name="SECTid0x1f20f10">DESCRIPTION</a></h2><p>The functions described in this manual allows to add C level coded event 65 65 handler to an tDOM Tcl expat parser objects. A tDOM Tcl expat parser object is 66 66 able to have several Tcl scripts and C functions associated with an specific 67 67 event. If the event occurs, first the Tcl scripts then the C functions 68 68 associated with the event are called in turn.</p><p>A tDOM Tcl expat parser extension is an ordinary Tcl extension and loaded 69 69 like every other Tcl extension. It must install at least one new Tcl Level 70 70 command, that manipulates a tDOM Tcl expat parser object.</p><p>A C level handler set is a data structure like this:</p><pre class="example"> 71 71 typedef struct CHandlerSet { ................................................................................ 195 195 TclGenExpatInfo structure of the tDOM Tcl expat parser object 196 196 <i class="m">expatObj</i>. The <i class="m">expatObj</i> has to be a tDOM Tcl expat parser object 197 197 in the interpreter <i class="m">interp</i>. This is most useful, to set the application 198 198 status of the parser object.</p><p>See the simple but full functionally example in the extensions/example 199 199 dir or the more complex example tnc in the extensions/tnc dir (a simple DTD 200 200 validation extension).</p> 201 201 202 - <h2><a name="SECTid0x13b1f40">SEE ALSO</a></h2><p class="seealso">expat</p> 202 + <h2><a name="SECTid0x1f2e6c0">SEE ALSO</a></h2><p class="seealso">expat</p> 203 203 204 - <h2><a name="SECTid0x13b21e0">KEYWORDS</a></h2><p class="keywords"><a class="keyword" href="keyword-index.html#KW-Chandlerset">C handler set</a></p> 204 + <h2><a name="SECTid0x1f2e960">KEYWORDS</a></h2><p class="keywords"><a class="keyword" href="keyword-index.html#KW-Chandlerset">C handler set</a></p> 205 205 </div><hr class="navsep"><div class="navbar" align="center"> 206 -<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> 206 +<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> · <a class="navaid" href="http://tdom.org">Repository</a> 207 207 </div> 208 208 </body> 209 209 </html>
Changes to doc/index.html.
1 1 <html> 2 2 <head> 3 -<title>tDOM manual</title><link rel="stylesheet" href="manpage.css"><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: master-index.xsl,v $ $Revision: 1.6 $"> 3 +<title>tDOM manual</title><link rel="stylesheet" href="manpage.css"><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: master-index.xsl,v $ $Revision: 1.6 $"><meta charset="utf-8"> 4 4 </head><body> 5 5 <div class="header"> 6 6 <h1 class="title" align="center">tDOM manual: Contents</h1><p class="navaid" align="center"> 7 -<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> 7 +<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> · <a class="navaid" href="http://tdom.org">Repository</a> 8 8 </p><hr class="navsep"> 9 9 </div><div class="body"><ul class="toc"> 10 10 <li class="tocentry"><a href="dom.html">dom - Create an in-memory DOM tree from XML</a></li><li class="tocentry"><a href="domDoc.html">domDoc - Manipulates an instance of a DOM document object</a></li><li class="tocentry"><a href="domNode.html">domNode - Manipulates an instance of a DOM node object</a></li><li class="tocentry"><a href="expat.html">expat - Creates an instance of an expat parser object</a></li><li class="tocentry"><a href="expatapi.html">expatapi - Functions to create, install and remove expat parser object 11 11 extensions.</a></li><li class="tocentry"><a href="tdomcmd.html">tdom - tdom is an expat parser object extension to create an in-memory 12 12 DOM tree from the input while parsing.</a></li><li class="tocentry"><a href="tnc.html">tnc - tnc is an expat parser object extension, that validates the XML 13 13 stream against the document DTD while parsing.</a></li> 14 14 </ul></div><div class="footer"> 15 15 <hr class="navsep"><div class="navbar" align="center"> 16 -<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> 16 +<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> · <a class="navaid" href="http://tdom.org">Repository</a> 17 17 </div> 18 18 </div> 19 19 </body> 20 20 </html>
Changes to doc/keyword-index.html.
1 1 <html> 2 2 <head> 3 -<title>tDOM manual: Keyword Index</title><link rel="stylesheet" href="manpage.css"><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: make-keywords.xsl,v $ $Revision: 1.5 $"> 3 +<title>tDOM manual: Keyword Index</title><link rel="stylesheet" href="manpage.css"><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: make-keywords.xsl,v $ $Revision: 1.5 $"><meta charset="utf-8"> 4 4 </head><body> 5 5 <div class="header"> 6 6 <h1 class="title" align="center">tDOM manual: Keywords</h1><p class="navaid" align="center"> 7 -<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> 7 +<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> · <a class="navaid" href="http://tdom.org">Repository</a> 8 8 </p><hr class="navsep"><div class="navbar"> 9 -<a href="#KEYWORDS-C">C</a> · <a href="#KEYWORDS-D">D</a> · <a href="#KEYWORDS-E">E</a> · <a href="#KEYWORDS-N">N</a> · <a href="#KEYWORDS-P">P</a> · <a href="#KEYWORDS-S">S</a> · <a href="#KEYWORDS-T">T</a> · <a href="#KEYWORDS-V">V</a> · <a href="#KEYWORDS-X">X</a> · </div> 9 +<a href="#KEYWORDS-C">C</a> · <a href="#KEYWORDS-D">D</a> · <a href="#KEYWORDS-E">E</a> · <a href="#KEYWORDS-N">N</a> · <a href="#KEYWORDS-P">P</a> · <a href="#KEYWORDS-S">S</a> · <a href="#KEYWORDS-T">T</a> · <a href="#KEYWORDS-V">V</a> · <a href="#KEYWORDS-X">X</a> · </div> 10 10 </div><div class="body"><div class="table"><table width="100%"> 11 11 <tr class="header"><th colspan="2"><a name="KEYWORDS-C">Keywords: C</a></th></tr><tr class="row1"> 12 12 <td width="35%"><a name="KW-Chandlerset">C handler set</a></td><td width="65%"> 13 -<a href="expatapi.html">expatapi</a> · <a href="tdomcmd.html">tdom</a> 13 +<a href="expatapi.html">expatapi</a> · <a href="tdomcmd.html">tdom</a> 14 14 </td> 15 15 </tr><tr class="row0"> 16 16 <td width="35%"><a name="KW-CheckExpatParserObj,CHandlerSetInstall,CHandlerSetRemove,CHandlerSetCreate,CHandlerSetGetUserData,GetExpatInfo">CheckExpatParserObj, CHandlerSetInstall, CHandlerSetRemove, 17 17 CHandlerSetCreate, CHandlerSetGetUserData, GetExpatInfo</a></td><td width="65%"><a href="expatapi.html">expatapi</a></td> 18 18 </tr><tr class="header"><th colspan="2"><a name="KEYWORDS-D">Keywords: D</a></th></tr><tr class="row1"> 19 19 <td width="35%"><a name="KW-document">document</a></td><td width="65%"> 20 -<a href="dom.html">dom</a> · <a href="domNode.html">domNode</a> 20 +<a href="dom.html">dom</a> · <a href="domNode.html">domNode</a> 21 21 </td> 22 22 </tr><tr class="row0"> 23 23 <td width="35%"><a name="KW-documentelement">document element</a></td><td width="65%"><a href="domDoc.html">domDoc</a></td> 24 24 </tr><tr class="row1"> 25 25 <td width="35%"><a name="KW-dom">dom</a></td><td width="65%"> 26 -<a href="dom.html">dom</a> · <a href="domNode.html">domNode</a> · <a href="tdomcmd.html">tdom</a> 26 +<a href="dom.html">dom</a> · <a href="domNode.html">domNode</a> · <a href="tdomcmd.html">tdom</a> 27 27 </td> 28 28 </tr><tr class="row0"> 29 29 <td width="35%"><a name="KW-DOMnodecreation">DOM node creation</a></td><td width="65%"><a href="domDoc.html">domDoc</a></td> 30 30 </tr><tr class="row1"> 31 31 <td width="35%"><a name="KW-domDoc">domDoc</a></td><td width="65%"><a href="domDoc.html">domDoc</a></td> 32 32 </tr><tr class="row0"> 33 33 <td width="35%"><a name="KW-domNode">domNode</a></td><td width="65%"><a href="domNode.html">domNode</a></td> ................................................................................ 35 35 <td width="35%"><a name="KW-DTD">DTD</a></td><td width="65%"><a href="tnc.html">tnc</a></td> 36 36 </tr><tr class="header"><th colspan="2"><a name="KEYWORDS-E">Keywords: E</a></th></tr><tr class="row0"> 37 37 <td width="35%"><a name="KW-expat">expat</a></td><td width="65%"><a href="expat.html">expat</a></td> 38 38 </tr><tr class="row1"> 39 39 <td width="35%"><a name="KW-expatapi">expatapi</a></td><td width="65%"><a href="expatapi.html">expatapi</a></td> 40 40 </tr><tr class="header"><th colspan="2"><a name="KEYWORDS-N">Keywords: N</a></th></tr><tr class="row0"> 41 41 <td width="35%"><a name="KW-node">node</a></td><td width="65%"> 42 -<a href="dom.html">dom</a> · <a href="domNode.html">domNode</a> 42 +<a href="dom.html">dom</a> · <a href="domNode.html">domNode</a> 43 43 </td> 44 44 </tr><tr class="header"><th colspan="2"><a name="KEYWORDS-P">Keywords: P</a></th></tr><tr class="row1"> 45 45 <td width="35%"><a name="KW-parsing">parsing</a></td><td width="65%"> 46 -<a href="dom.html">dom</a> · <a href="domNode.html">domNode</a> 46 +<a href="dom.html">dom</a> · <a href="domNode.html">domNode</a> 47 47 </td> 48 48 </tr><tr class="header"><th colspan="2"><a name="KEYWORDS-S">Keywords: S</a></th></tr><tr class="row0"> 49 49 <td width="35%"><a name="KW-SAX">SAX</a></td><td width="65%"> 50 -<a href="expat.html">expat</a> · <a href="tdomcmd.html">tdom</a> 50 +<a href="expat.html">expat</a> · <a href="tdomcmd.html">tdom</a> 51 51 </td> 52 52 </tr><tr class="header"><th colspan="2"><a name="KEYWORDS-T">Keywords: T</a></th></tr><tr class="row1"> 53 53 <td width="35%"><a name="KW-tdom">tdom</a></td><td width="65%"><a href="tdomcmd.html">tdom</a></td> 54 54 </tr><tr class="row0"> 55 55 <td width="35%"><a name="KW-tdomcmd">tdomcmd</a></td><td width="65%"><a href="tdomcmd.html">tdom</a></td> 56 56 </tr><tr class="row1"> 57 57 <td width="35%"><a name="KW-tnc">tnc</a></td><td width="65%"><a href="tnc.html">tnc</a></td> 58 58 </tr><tr class="header"><th colspan="2"><a name="KEYWORDS-V">Keywords: V</a></th></tr><tr class="row0"> 59 59 <td width="35%"><a name="KW-Validation">Validation</a></td><td width="65%"><a href="tnc.html">tnc</a></td> 60 60 </tr><tr class="header"><th colspan="2"><a name="KEYWORDS-X">Keywords: X</a></th></tr><tr class="row1"> 61 61 <td width="35%"><a name="KW-XML">XML</a></td><td width="65%"> 62 -<a href="dom.html">dom</a> · <a href="domNode.html">domNode</a> 62 +<a href="dom.html">dom</a> · <a href="domNode.html">domNode</a> 63 63 </td> 64 64 </tr><tr class="row0"> 65 65 <td width="35%"><a name="KW-xml::parser">xml::parser</a></td><td width="65%"><a href="expat.html">expat</a></td> 66 66 </tr> 67 67 </table></div></div><div class="footer"> 68 68 <hr class="navsep"><div class="navbar" align="center"> 69 -<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> 69 +<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> · <a class="navaid" href="http://tdom.org">Repository</a> 70 70 </div> 71 71 </div> 72 72 </body> 73 73 </html>
Changes to doc/tdomcmd.html.
1 1 <html> 2 2 <head> 3 -<link rel="stylesheet" href="manpage.css"><title>tDOM manual: tdom</title><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: tmml-html.xsl,v $ $Revision: 1.11 $"> 3 +<link rel="stylesheet" href="manpage.css"><title>tDOM manual: tdom</title><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: tmml-html.xsl,v $ $Revision: 1.11 $"><meta charset="utf-8"> 4 4 </head><body> 5 5 <div class="header"> 6 6 <div class="navbar" align="center"> 7 -<a href="#SECTid0x1402f70">NAME</a> · <a href="#SECTid0x12a9d60">SYNOPSIS</a> · <a href="#SECTid0x12d0010">DESCRIPTION</a> · <a href="#SECTid0x13bd260">SEE ALSO</a> · <a href="#SECTid0x13bd5c0">KEYWORDS</a> 7 +<a href="#SECTid0x1e30200">NAME</a> · <a href="#SECTid0x1f5add0">SYNOPSIS</a> · <a href="#SECTid0x1e4db90">DESCRIPTION</a> · <a href="#SECTid0x1f20b70">SEE ALSO</a> · <a href="#SECTid0x1f20f00">KEYWORDS</a> 8 8 </div><hr class="navsep"> 9 9 </div><div class="body"> 10 - <h2><a name="SECTid0x1402f70">NAME</a></h2><p class="namesection"> 10 + <h2><a name="SECTid0x1e30200">NAME</a></h2><p class="namesection"> 11 11 <b class="names">tdom - </b><br>tdom is an expat parser object extension to create an in-memory 12 12 DOM tree from the input while parsing.</p> 13 13 14 14 15 - <h2><a name="SECTid0x12a9d60">SYNOPSIS</a></h2><pre class="syntax">package require tdom 15 + <h2><a name="SECTid0x1f5add0">SYNOPSIS</a></h2><pre class="syntax">package require tdom 16 16 17 17 set parser [expat] 18 18 19 19 tdom $parser enable</pre> 20 20 21 - <h2><a name="SECTid0x12d0010">DESCRIPTION</a></h2><p> 21 + <h2><a name="SECTid0x1e4db90">DESCRIPTION</a></h2><p> 22 22 <i class="m">tdom</i> adds the C handler set "tdom" to an tcl expat 23 23 parser obj. This handler set builds an in-memory DOM tree out of the input, 24 24 parsed by the parser. A DOM tree created this way behave exactly like a DOM 25 25 tree created by the "dom" command (see there). In fact, tdom is only 26 26 another interface to the same functionality; it uses the code behind the 27 27 <tt class="samp">dom</tt> code for building the DOM tree.</p><dl class="commandlist"> 28 28 ................................................................................ 82 82 <b class="cmd">tdom</b> <i class="m">parserObj</i> <b class="method">setExternalEntityResolver</b> <i class="m">script</i> 83 83 </dt> 84 84 <dd></dd> 85 85 86 86 87 87 </dl> 88 88 89 - <h2><a name="SECTid0x13bd260">SEE ALSO</a></h2><p class="seealso">dom, expat</p> 89 + <h2><a name="SECTid0x1f20b70">SEE ALSO</a></h2><p class="seealso">dom, expat</p> 90 90 91 - <h2><a name="SECTid0x13bd5c0">KEYWORDS</a></h2><p class="keywords"> 91 + <h2><a name="SECTid0x1f20f00">KEYWORDS</a></h2><p class="keywords"> 92 92 <a class="keyword" href="keyword-index.html#KW-DOM">DOM</a>, <a class="keyword" href="keyword-index.html#KW-SAX">SAX</a>, <a class="keyword" href="keyword-index.html#KW-Chandlerset">C handler set</a> 93 93 </p> 94 94 95 95 </div><hr class="navsep"><div class="navbar" align="center"> 96 -<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> 96 +<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> · <a class="navaid" href="http://tdom.org">Repository</a> 97 97 </div> 98 98 </body> 99 99 </html>
Changes to doc/tnc.html.
1 1 <html> 2 2 <head> 3 -<link rel="stylesheet" href="manpage.css"><title>tDOM manual: tnc</title><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: tmml-html.xsl,v $ $Revision: 1.11 $"> 3 +<link rel="stylesheet" href="manpage.css"><title>tDOM manual: tnc</title><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: tmml-html.xsl,v $ $Revision: 1.11 $"><meta charset="utf-8"> 4 4 </head><body> 5 5 <div class="header"> 6 6 <div class="navbar" align="center"> 7 -<a href="#SECTid0x1409a40">NAME</a> · <a href="#SECTid0x132e810">SYNOPSIS</a> · <a href="#SECTid0x132e670">DESCRIPTION</a> · <a href="#SECTid0x13bdd50">BUGS</a> · <a href="#SECTid0x13be6c0">KEYWORDS</a> 7 +<a href="#SECTid0x1f21840">NAME</a> · <a href="#SECTid0x1e300b0">SYNOPSIS</a> · <a href="#SECTid0x1f31680">DESCRIPTION</a> · <a href="#SECTid0x1f677e0">BUGS</a> · <a href="#SECTid0x1f2af70">KEYWORDS</a> 8 8 </div><hr class="navsep"> 9 9 </div><div class="body"> 10 - <h2><a name="SECTid0x1409a40">NAME</a></h2><p class="namesection"> 10 + <h2><a name="SECTid0x1f21840">NAME</a></h2><p class="namesection"> 11 11 <b class="names">tnc - </b><br>tnc is an expat parser object extension, that validates the XML 12 12 stream against the document DTD while parsing.</p> 13 13 14 - <h2><a name="SECTid0x132e810">SYNOPSIS</a></h2><pre class="syntax">package require tdom 14 + <h2><a name="SECTid0x1e300b0">SYNOPSIS</a></h2><pre class="syntax">package require tdom 15 15 package require tnc 16 16 17 17 set parser [expat] 18 18 19 19 tnc $parser enable</pre> 20 20 21 - <h2><a name="SECTid0x132e670">DESCRIPTION</a></h2><p> 21 + <h2><a name="SECTid0x1f31680">DESCRIPTION</a></h2><p> 22 22 <i class="m">tnc</i> adds the C handler set "tnc" to a tcl expat parser 23 23 obj. This handler set is a simple DTD validator. If the validator detects a 24 24 validation error, it sets the interp result, signals error and stops 25 25 parsing. There isn't any validation error recovering. As a consequence, only 26 26 valid documents are completely parsed.</p><p>This handler set has only three methods:</p><dl class="commandlist"> 27 27 28 28 <dt> ................................................................................ 116 116 117 117 118 118 </dl> 119 119 </dd> 120 120 121 121 </dl> 122 122 123 - <h2><a name="SECTid0x13bdd50">BUGS</a></h2><p>The validation error reports could be much more informative and 123 + <h2><a name="SECTid0x1f677e0">BUGS</a></h2><p>The validation error reports could be much more informative and 124 124 user-friendly.</p><p>The validator doesn't detect ambiguous content models (see XML 125 125 recomendation Section 3.2.1 and Appendix E). Most Java validators also doesn't, 126 126 but handle such content models right anyhow. Tnc does not; if your DTD has 127 127 such ambiguous content models, tnc can not used to validate documents against 128 128 such (not completely XML spec compliant) DTDs.</p><p>It isn't possible to validate XML documents with standalone="yes" in the 129 129 XML Declaration</p><p>Violations of the validity constraints Proper Group/PE Nesting and 130 130 Proper Conditional Section/PE Nesting are not detected. They could only happen 131 131 inside a invalid DTD, not in the content of a document.</p> 132 - <h2><a name="SECTid0x13be6c0">KEYWORDS</a></h2><p class="keywords"> 132 + <h2><a name="SECTid0x1f2af70">KEYWORDS</a></h2><p class="keywords"> 133 133 <a class="keyword" href="keyword-index.html#KW-Validation">Validation</a>, <a class="keyword" href="keyword-index.html#KW-DTD">DTD</a> 134 134 </p> 135 135 136 136 </div><hr class="navsep"><div class="navbar" align="center"> 137 -<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> 137 +<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> · <a class="navaid" href="http://tdom.org">Repository</a> 138 138 </div> 139 139 </body> 140 140 </html>
Changes to expat/winconfig.h.
20 20 #define XML_NS 1 21 21 #define XML_DTD 1 22 22 #define XML_CONTEXT_BYTES 1024 23 23 24 24 /* we will assume all Windows platforms are little endian */ 25 25 #define BYTEORDER 1234 26 26 27 -/* Windows has memmove() available. */ 28 -#define HAVE_MEMMOVE 29 - 30 27 #endif /* ndef WINCONFIG_H */
Changes to extensions/example/configure.
638 638 STLIB_LD 639 639 CFLAGS_WARNING 640 640 CFLAGS_OPTIMIZE 641 641 CFLAGS_DEBUG 642 642 RC 643 643 CELIB_DIR 644 644 AR 645 +STUBS_BUILD 645 646 SHARED_BUILD 646 647 TCL_THREADS 647 648 TCL_INCLUDES 648 649 PKG_OBJECTS 649 650 PKG_SOURCES 650 651 TDOM_SRC_DIR 651 652 TDOM_STUB_LIB_SPEC 652 653 TDOM_VERSION 653 654 MATH_LIBS 654 655 EGREP 655 656 GREP 656 657 RANLIB 657 658 SET_MAKE 659 +INSTALL_LIBRARY 660 +INSTALL_SCRIPT 661 +INSTALL_PROGRAM 662 +INSTALL_DATA 663 +INSTALL_DATA_DIR 664 +INSTALL 658 665 CPP 659 666 TCL_SHLIB_LD_LIBS 660 667 TCL_LD_FLAGS 661 668 TCL_EXTRA_CFLAGS 662 669 TCL_DEFS 663 670 TCL_LIBS 664 671 CLEANFILES ................................................................................ 731 738 ac_user_opts=' 732 739 enable_option_checking 733 740 with_tcl 734 741 with_tdom 735 742 with_tclinclude 736 743 enable_threads 737 744 enable_shared 745 +enable_stubs 738 746 enable_64bit 739 747 enable_64bit_vis 740 748 enable_rpath 741 749 enable_wince 742 750 with_celib 743 751 enable_symbols 744 752 ' ................................................................................ 1358 1366 1359 1367 Optional Features: 1360 1368 --disable-option-checking ignore unrecognized --enable/--with options 1361 1369 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) 1362 1370 --enable-FEATURE[=ARG] include FEATURE [ARG=yes] 1363 1371 --enable-threads build with threads 1364 1372 --enable-shared build and link with shared libraries (default: on) 1373 + --enable-stubs build and link with stub libraries. Always true for 1374 + shared builds (default: on) 1365 1375 --enable-64bit enable 64bit support (default: off) 1366 1376 --enable-64bit-vis enable 64bit Sparc VIS support (default: off) 1367 1377 --disable-rpath disable rpath support (default: on) 1368 1378 --enable-wince enable Win/CE support (where applicable) 1369 1379 --enable-symbols build with debugging symbols (default: off) 1370 1380 1371 1381 Optional Packages: ................................................................................ 2173 2183 # This will define a ${TEA_PLATFORM} variable == "unix" or "windows" 2174 2184 # as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE. 2175 2185 #-------------------------------------------------------------------- 2176 2186 2177 2187 2178 2188 # TEA extensions pass this us the version of TEA they think they 2179 2189 # are compatible with. 2180 - TEA_VERSION="3.9" 2190 + TEA_VERSION="3.10" 2181 2191 2182 2192 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for correct TEA configuration" >&5 2183 2193 $as_echo_n "checking for correct TEA configuration... " >&6; } 2184 2194 if test x"${PACKAGE_NAME}" = x ; then 2185 2195 as_fn_error $? " 2186 -The PACKAGE_NAME variable must be defined by your TEA configure.in" "$LINENO" 5 2196 +The PACKAGE_NAME variable must be defined by your TEA configure.ac" "$LINENO" 5 2187 2197 fi 2188 - if test x"3.9" = x ; then 2198 + if test x"3.10" = x ; then 2189 2199 as_fn_error $? " 2190 2200 TEA version not specified." "$LINENO" 5 2191 - elif test "3.9" != "${TEA_VERSION}" ; then 2192 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: warning: requested TEA version \"3.9\", have \"${TEA_VERSION}\"" >&5 2193 -$as_echo "warning: requested TEA version \"3.9\", have \"${TEA_VERSION}\"" >&6; } 2201 + elif test "3.10" != "${TEA_VERSION}" ; then 2202 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: warning: requested TEA version \"3.10\", have \"${TEA_VERSION}\"" >&5 2203 +$as_echo "warning: requested TEA version \"3.10\", have \"${TEA_VERSION}\"" >&6; } 2194 2204 else 2195 2205 { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (TEA ${TEA_VERSION})" >&5 2196 2206 $as_echo "ok (TEA ${TEA_VERSION})" >&6; } 2197 2207 fi 2198 2208 2199 2209 # If the user did not set CFLAGS, set it now to keep macros 2200 2210 # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2". ................................................................................ 2217 2227 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 2218 2228 for as_dir in $PATH 2219 2229 do 2220 2230 IFS=$as_save_IFS 2221 2231 test -z "$as_dir" && as_dir=. 2222 2232 for ac_exec_ext in '' $ac_executable_extensions; do 2223 2233 if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then 2224 - ac_cv_prog_CYGPATH="cygpath -w" 2234 + ac_cv_prog_CYGPATH="cygpath -m" 2225 2235 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 2226 2236 break 2 2227 2237 fi 2228 2238 done 2229 2239 done 2230 2240 IFS=$as_save_IFS 2231 2241 ................................................................................ 2242 2252 fi 2243 2253 2244 2254 2245 2255 EXEEXT=".exe" 2246 2256 TEA_PLATFORM="windows" 2247 2257 ;; 2248 2258 *CYGWIN_*) 2249 - CYGPATH=echo 2250 2259 EXEEXT=".exe" 2251 - # TEA_PLATFORM is determined later in LOAD_TCLCONFIG 2260 + # CYGPATH and TEA_PLATFORM are determined later in LOAD_TCLCONFIG 2252 2261 ;; 2253 2262 *) 2254 2263 CYGPATH=echo 2255 2264 # Maybe we are cross-compiling.... 2256 2265 case ${host_alias} in 2257 2266 *mingw32*) 2258 2267 EXEEXT=".exe" ................................................................................ 2427 2436 fi 2428 2437 2429 2438 # check in a few common install locations 2430 2439 if test x"${ac_cv_c_tclconfig}" = x ; then 2431 2440 for i in `ls -d ${libdir} 2>/dev/null` \ 2432 2441 `ls -d ${exec_prefix}/lib 2>/dev/null` \ 2433 2442 `ls -d ${prefix}/lib 2>/dev/null` \ 2434 - `ls -d /usr/local/lib 2>/dev/null` \ 2435 2443 `ls -d /usr/contrib/lib 2>/dev/null` \ 2444 + `ls -d /usr/local/lib 2>/dev/null` \ 2445 + `ls -d /usr/pkg/lib 2>/dev/null` \ 2436 2446 `ls -d /usr/lib 2>/dev/null` \ 2437 2447 `ls -d /usr/lib64 2>/dev/null` \ 2448 + `ls -d /usr/lib/tcl8.6 2>/dev/null` \ 2449 + `ls -d /usr/lib/tcl8.5 2>/dev/null` \ 2438 2450 ; do 2439 2451 if test -f "$i/tclConfig.sh" ; then 2440 2452 ac_cv_c_tclconfig="`(cd $i; pwd)`" 2441 2453 break 2442 2454 fi 2443 2455 done 2444 2456 fi ................................................................................ 3350 3362 #endif 3351 3363 3352 3364 ; 3353 3365 return 0; 3354 3366 } 3355 3367 _ACEOF 3356 3368 if ac_fn_c_try_compile "$LINENO"; then : 3357 - TEA_PLATFORM="unix" 3369 + 3370 + TEA_PLATFORM="unix" 3371 + CYGPATH=echo 3372 + 3358 3373 else 3359 - TEA_PLATFORM="windows" 3374 + 3375 + TEA_PLATFORM="windows" 3376 + # Extract the first word of "cygpath", so it can be a program name with args. 3377 +set dummy cygpath; ac_word=$2 3378 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 3379 +$as_echo_n "checking for $ac_word... " >&6; } 3380 +if ${ac_cv_prog_CYGPATH+:} false; then : 3381 + $as_echo_n "(cached) " >&6 3382 +else 3383 + if test -n "$CYGPATH"; then 3384 + ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test. 3385 +else 3386 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 3387 +for as_dir in $PATH 3388 +do 3389 + IFS=$as_save_IFS 3390 + test -z "$as_dir" && as_dir=. 3391 + for ac_exec_ext in '' $ac_executable_extensions; do 3392 + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then 3393 + ac_cv_prog_CYGPATH="cygpath -m" 3394 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 3395 + break 2 3396 + fi 3397 +done 3398 + done 3399 +IFS=$as_save_IFS 3400 + 3401 + test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo" 3402 +fi 3403 +fi 3404 +CYGPATH=$ac_cv_prog_CYGPATH 3405 +if test -n "$CYGPATH"; then 3406 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGPATH" >&5 3407 +$as_echo "$CYGPATH" >&6; } 3408 +else 3409 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 3410 +$as_echo "no" >&6; } 3411 +fi 3412 + 3413 + 3360 3414 3361 3415 fi 3362 3416 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 3363 3417 CC=$hold_cc 3364 3418 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TEA_PLATFORM" >&5 3365 3419 $as_echo "$TEA_PLATFORM" >&6; } 3366 3420 ................................................................................ 4107 4161 fi 4108 4162 4109 4163 ac_ext=c 4110 4164 ac_cpp='$CPP $CPPFLAGS' 4111 4165 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' 4112 4166 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' 4113 4167 ac_compiler_gnu=$ac_cv_c_compiler_gnu 4168 + 4169 + 4170 + INSTALL='$(SHELL) $(srcdir)/tclconfig/install-sh -c' 4171 + INSTALL_DATA_DIR='${INSTALL} -d -m 755' 4172 + INSTALL_DATA='${INSTALL} -m 644' 4173 + INSTALL_PROGRAM='${INSTALL}' 4174 + INSTALL_SCRIPT='${INSTALL}' 4175 + INSTALL_LIBRARY='${INSTALL_DATA}' 4176 + 4177 + 4178 + 4179 + 4180 + 4181 + 4114 4182 4115 4183 4116 4184 #-------------------------------------------------------------------- 4117 4185 # Checks to see if the make program sets the $MAKE variable. 4118 4186 #-------------------------------------------------------------------- 4119 4187 4120 4188 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 ................................................................................ 5938 6006 #-------------------------------------------------------------------- 5939 6007 5940 6008 5941 6009 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to build libraries" >&5 5942 6010 $as_echo_n "checking how to build libraries... " >&6; } 5943 6011 # Check whether --enable-shared was given. 5944 6012 if test "${enable_shared+set}" = set; then : 5945 - enableval=$enable_shared; tcl_ok=$enableval 6013 + enableval=$enable_shared; shared_ok=$enableval 5946 6014 else 5947 - tcl_ok=yes 6015 + shared_ok=yes 5948 6016 fi 5949 6017 5950 6018 5951 6019 if test "${enable_shared+set}" = set; then 5952 6020 enableval="$enable_shared" 5953 - tcl_ok=$enableval 6021 + shared_ok=$enableval 6022 + else 6023 + shared_ok=yes 6024 + fi 6025 + 6026 + # Check whether --enable-stubs was given. 6027 +if test "${enable_stubs+set}" = set; then : 6028 + enableval=$enable_stubs; stubs_ok=$enableval 6029 +else 6030 + stubs_ok=yes 6031 +fi 6032 + 6033 + 6034 + if test "${enable_stubs+set}" = set; then 6035 + enableval="$enable_stubs" 6036 + stubs_ok=$enableval 5954 6037 else 5955 - tcl_ok=yes 6038 + stubs_ok=yes 5956 6039 fi 5957 6040 5958 - if test "$tcl_ok" = "yes" ; then 6041 + # Stubs are always enabled for shared builds 6042 + if test "$shared_ok" = "yes" ; then 5959 6043 { $as_echo "$as_me:${as_lineno-$LINENO}: result: shared" >&5 5960 6044 $as_echo "shared" >&6; } 5961 6045 SHARED_BUILD=1 6046 + STUBS_BUILD=1 5962 6047 else 5963 6048 { $as_echo "$as_me:${as_lineno-$LINENO}: result: static" >&5 5964 6049 $as_echo "static" >&6; } 5965 6050 SHARED_BUILD=0 5966 6051 5967 6052 $as_echo "#define STATIC_BUILD 1" >>confdefs.h 5968 6053 6054 + if test "$stubs_ok" = "yes" ; then 6055 + STUBS_BUILD=1 6056 + else 6057 + STUBS_BUILD=0 6058 + fi 5969 6059 fi 6060 + if test "${STUBS_BUILD}" = "1" ; then 6061 + 6062 +$as_echo "#define USE_TCL_STUBS 1" >>confdefs.h 6063 + 6064 + 6065 +$as_echo "#define USE_TCLOO_STUBS 1" >>confdefs.h 6066 + 6067 + if test "${TEA_WINDOWINGSYSTEM}" != ""; then 6068 + 6069 +$as_echo "#define USE_TK_STUBS 1" >>confdefs.h 6070 + 6071 + fi 6072 + fi 6073 + 6074 + 5970 6075 5971 6076 5972 6077 5973 6078 #-------------------------------------------------------------------- 5974 6079 # This macro figures out what flags to use with the compiler/linker 5975 6080 # when building shared/static debug/optimized objects. This information 5976 6081 # can be taken from the tclConfig.sh file, but this figures it all out. ................................................................................ 6138 6243 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_visibility_hidden" >&5 6139 6244 $as_echo "$tcl_cv_cc_visibility_hidden" >&6; } 6140 6245 if test $tcl_cv_cc_visibility_hidden = yes; then : 6141 6246 6142 6247 6143 6248 $as_echo "#define MODULE_SCOPE extern __attribute__((__visibility__(\"hidden\")))" >>confdefs.h 6144 6249 6250 + 6251 +$as_echo "#define HAVE_HIDDEN 1" >>confdefs.h 6252 + 6145 6253 6146 6254 fi 6147 6255 6148 6256 # Step 0.d: Disable -rpath support? 6149 6257 6150 6258 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if rpath support is requested" >&5 6151 6259 $as_echo_n "checking if rpath support is requested... " >&6; } ................................................................................ 6332 6440 else 6333 6441 AR="$ac_cv_prog_AR" 6334 6442 fi 6335 6443 6336 6444 STLIB_LD='${AR} cr' 6337 6445 LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" 6338 6446 if test "x$SHLIB_VERSION" = x; then : 6339 - SHLIB_VERSION="1.0" 6447 + SHLIB_VERSION="" 6448 +else 6449 + SHLIB_VERSION=".$SHLIB_VERSION" 6340 6450 fi 6341 6451 case $system in 6342 6452 # TEA specific: 6343 6453 windows) 6344 6454 # This is a 2-stage check to make sure we have the 64-bit SDK 6345 6455 # We have to know where the SDK is installed. 6346 6456 # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs ................................................................................ 6496 6606 6497 6607 if test "$GCC" != "yes" ; then 6498 6608 if test "${SHARED_BUILD}" = "0" ; then 6499 6609 runtime=-MT 6500 6610 else 6501 6611 runtime=-MD 6502 6612 fi 6613 + case "x`echo \${VisualStudioVersion}`" in 6614 + x1[4-9]*) 6615 + lflags="${lflags} -nodefaultlib:libucrt.lib" 6616 + 6617 + vars="ucrt.lib" 6618 + for i in $vars; do 6619 + if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then 6620 + # Convert foo.lib to -lfoo for GCC. No-op if not *.lib 6621 + i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'` 6622 + fi 6623 + PKG_LIBS="$PKG_LIBS $i" 6624 + done 6625 + 6626 + 6627 + ;; 6628 + *) 6629 + ;; 6630 + esac 6503 6631 6504 6632 if test "$do64bit" != "no" ; then 6505 6633 # All this magic is necessary for the Win64 SDK RC1 - hobbs 6506 6634 CC="\"${PATH64}/cl.exe\"" 6507 6635 CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\"" 6508 6636 RC="\"${MSSDK}/bin/rc.exe\"" 6509 - lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\"" 6637 + lflags="${lflags} -nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\"" 6510 6638 LINKBIN="\"${PATH64}/link.exe\"" 6511 6639 CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d" 6512 6640 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" 6513 6641 # Avoid 'unresolved external symbol __security_cookie' 6514 6642 # errors, c.f. http://support.microsoft.com/?id=894573 6515 6643 6516 6644 vars="bufferoverflowU.lib" ................................................................................ 6554 6682 cat >>confdefs.h <<_ACEOF 6555 6683 #define UNDER_CE $CEVERSION 6556 6684 _ACEOF 6557 6685 6558 6686 CFLAGS_DEBUG="-nologo -Zi -Od" 6559 6687 CFLAGS_OPTIMIZE="-nologo -Ox" 6560 6688 lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'` 6561 - lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo" 6689 + lflags="${lflags} -MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo" 6562 6690 LINKBIN="\"${CEBINROOT}/link.exe\"" 6563 6691 6564 6692 else 6565 6693 RC="rc" 6566 - lflags="-nologo" 6567 - LINKBIN="link" 6694 + lflags="${lflags} -nologo" 6695 + LINKBIN="link" 6568 6696 CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d" 6569 6697 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" 6570 6698 fi 6571 6699 fi 6572 6700 6573 6701 if test "$GCC" = "yes"; then 6574 6702 # mingw gcc mode ................................................................................ 6675 6803 $as_echo_n "checking for cross-compile version of gcc... " >&6; } 6676 6804 if ${ac_cv_cross+:} false; then : 6677 6805 $as_echo_n "(cached) " >&6 6678 6806 else 6679 6807 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 6680 6808 /* end confdefs.h. */ 6681 6809 6682 - #ifdef __WIN32__ 6810 + #ifdef _WIN32 6683 6811 #error cross-compiler 6684 6812 #endif 6685 6813 6686 6814 int 6687 6815 main () 6688 6816 { 6689 6817 ................................................................................ 6882 7010 LDFLAGS="$LDFLAGS -export-dynamic" 6883 7011 CC_SEARCH_FLAGS="" 6884 7012 LD_SEARCH_FLAGS="" 6885 7013 ;; 6886 7014 CYGWIN_*) 6887 7015 SHLIB_CFLAGS="" 6888 7016 SHLIB_LD='${CC} -shared' 7017 + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--out-implib,\$@.a" 6889 7018 SHLIB_SUFFIX=".dll" 6890 7019 EXEEXT=".exe" 7020 + do64bit_ok=yes 6891 7021 CC_SEARCH_FLAGS="" 6892 7022 LD_SEARCH_FLAGS="" 6893 7023 ;; 6894 7024 Haiku*) 6895 7025 LDFLAGS="$LDFLAGS -Wl,--export-dynamic" 6896 7026 SHLIB_CFLAGS="-fPIC" 6897 7027 SHLIB_SUFFIX=".so" ................................................................................ 7194 7324 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 7195 7325 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 7196 7326 fi 7197 7327 ;; 7198 7328 OpenBSD-*) 7199 7329 arch=`arch -s` 7200 7330 case "$arch" in 7201 - m88k|vax) 7202 - SHLIB_SUFFIX="" 7203 - SHARED_LIB_SUFFIX="" 7331 + alpha|sparc64) 7332 + SHLIB_CFLAGS="-fPIC" 7204 7333 ;; 7205 7334 *) 7206 - SHLIB_CFLAGS="-fPIC" 7207 - SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' 7208 - SHLIB_SUFFIX=".so" 7209 - if test $doRpath = yes; then : 7210 - 7211 - CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 7212 -fi 7213 - LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} 7214 - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' 7335 + SHLIB_CFLAGS="-fpic" 7215 7336 ;; 7216 7337 esac 7217 - case "$arch" in 7218 - m88k|vax) 7219 - CFLAGS_OPTIMIZE="-O1" 7220 - ;; 7221 - *) 7222 - CFLAGS_OPTIMIZE="-O2" 7223 - ;; 7224 - esac 7225 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ELF" >&5 7226 -$as_echo_n "checking for ELF... " >&6; } 7227 -if ${tcl_cv_ld_elf+:} false; then : 7228 - $as_echo_n "(cached) " >&6 7229 -else 7230 - 7231 - cat confdefs.h - <<_ACEOF >conftest.$ac_ext 7232 -/* end confdefs.h. */ 7233 - 7234 -#ifdef __ELF__ 7235 - yes 7236 -#endif 7237 - 7238 -_ACEOF 7239 -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 7240 - $EGREP "yes" >/dev/null 2>&1; then : 7241 - tcl_cv_ld_elf=yes 7242 -else 7243 - tcl_cv_ld_elf=no 7244 -fi 7245 -rm -f conftest* 7246 - 7247 -fi 7248 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_elf" >&5 7249 -$as_echo "$tcl_cv_ld_elf" >&6; } 7250 - if test $tcl_cv_ld_elf = yes; then : 7251 - 7252 - LDFLAGS=-Wl,-export-dynamic 7253 - 7254 -else 7255 - LDFLAGS="" 7256 -fi 7338 + SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' 7339 + SHLIB_SUFFIX=".so" 7340 + if test $doRpath = yes; then : 7341 + 7342 + CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 7343 +fi 7344 + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} 7345 + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}' 7346 + LDFLAGS="-Wl,-export-dynamic" 7347 + CFLAGS_OPTIMIZE="-O2" 7257 7348 if test "${TCL_THREADS}" = "1"; then : 7258 7349 7259 7350 # On OpenBSD: Compile with -pthread 7260 7351 # Don't link with -lpthread 7261 7352 LIBS=`echo $LIBS | sed s/-lpthread//` 7262 7353 CFLAGS="$CFLAGS -pthread" 7263 7354 ................................................................................ 7286 7377 7287 7378 fi 7288 7379 ;; 7289 7380 FreeBSD-*) 7290 7381 # This configuration from FreeBSD Ports. 7291 7382 SHLIB_CFLAGS="-fPIC" 7292 7383 SHLIB_LD="${CC} -shared" 7293 - TCL_SHLIB_LD_EXTRAS="-Wl,-soname \$@" 7384 + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,-soname,\$@" 7294 7385 SHLIB_SUFFIX=".so" 7295 7386 LDFLAGS="" 7296 7387 if test $doRpath = yes; then : 7297 7388 7298 7389 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 7299 - LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' 7390 + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 7300 7391 fi 7301 7392 if test "${TCL_THREADS}" = "1"; then : 7302 7393 7303 7394 # The -pthread needs to go in the LDFLAGS, not LIBS 7304 7395 LIBS=`echo $LIBS | sed s/-pthread//` 7305 7396 CFLAGS="$CFLAGS $PTHREAD_CFLAGS" 7306 7397 LDFLAGS="$LDFLAGS $PTHREAD_LIBS" 7307 7398 fi 7308 - # Version numbers are dot-stripped by system policy. 7309 - TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .` 7310 - UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' 7311 - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1' 7312 - TCL_LIB_VERSIONS_OK=nodots 7399 + case $system in 7400 + FreeBSD-3.*) 7401 + # Version numbers are dot-stripped by system policy. 7402 + TCL_TRIM_DOTS=`echo ${PACKAGE_VERSION} | tr -d .` 7403 + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' 7404 + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1' 7405 + TCL_LIB_VERSIONS_OK=nodots 7406 + ;; 7407 + esac 7313 7408 ;; 7314 7409 Darwin-*) 7315 7410 CFLAGS_OPTIMIZE="-Os" 7316 7411 SHLIB_CFLAGS="-fno-common" 7317 7412 # To avoid discrepancies between what headers configure sees during 7318 7413 # preprocessing tests and compiling tests, move any -isysroot and 7319 7414 # -mmacosx-version-min flags from CFLAGS to CPPFLAGS: ................................................................................ 7667 7762 if test "$GCC" = yes; then : 7668 7763 7669 7764 SHLIB_CFLAGS="-fPIC -melf" 7670 7765 LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" 7671 7766 7672 7767 else 7673 7768 7674 - SHLIB_CFLAGS="-Kpic -belf" 7675 - LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" 7769 + SHLIB_CFLAGS="-Kpic -belf" 7770 + LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" 7676 7771 7677 7772 fi 7678 7773 SHLIB_LD="ld -G" 7679 7774 SHLIB_LD_LIBS="" 7680 7775 SHLIB_SUFFIX=".so" 7681 7776 CC_SEARCH_FLAGS="" 7682 7777 LD_SEARCH_FLAGS="" ................................................................................ 7927 8022 fi 7928 8023 7929 8024 if test "$tcl_cv_cc_visibility_hidden" != yes; then : 7930 8025 7931 8026 7932 8027 $as_echo "#define MODULE_SCOPE extern" >>confdefs.h 7933 8028 7934 - 7935 -$as_echo "#define NO_VIZ /**/" >>confdefs.h 7936 - 7937 8029 7938 8030 fi 7939 8031 7940 8032 if test "$SHARED_LIB_SUFFIX" = ""; then : 7941 8033 7942 8034 # TEA specific: use PACKAGE_VERSION instead of VERSION 7943 8035 SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}' ................................................................................ 7944 8036 fi 7945 8037 if test "$UNSHARED_LIB_SUFFIX" = ""; then : 7946 8038 7947 8039 # TEA specific: use PACKAGE_VERSION instead of VERSION 7948 8040 UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a' 7949 8041 fi 7950 8042 7951 - if test "${GCC}" = "yes" ; then 8043 + if test "${GCC}" = "yes" -a ${SHLIB_SUFFIX} = ".dll"; then 7952 8044 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SEH support in compiler" >&5 7953 8045 $as_echo_n "checking for SEH support in compiler... " >&6; } 7954 8046 if ${tcl_cv_seh+:} false; then : 7955 8047 $as_echo_n "(cached) " >&6 7956 8048 else 7957 8049 if test "$cross_compiling" = yes; then : 7958 8050 tcl_cv_seh=no 7959 8051 else 7960 8052 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 7961 8053 /* end confdefs.h. */ 7962 8054 7963 - #define WIN32_LEAN_AND_MEAN 7964 - #include <windows.h> 7965 - #undef WIN32_LEAN_AND_MEAN 8055 +#define WIN32_LEAN_AND_MEAN 8056 +#include <windows.h> 8057 +#undef WIN32_LEAN_AND_MEAN 7966 8058 7967 8059 int main(int argc, char** argv) { 7968 8060 int a, b = 0; 7969 8061 __try { 7970 8062 a = 666 / b; 7971 8063 } 7972 8064 __except (EXCEPTION_EXECUTE_HANDLER) { ................................................................................ 8047 8139 $as_echo_n "checking for winnt.h that ignores VOID define... " >&6; } 8048 8140 if ${tcl_cv_winnt_ignore_void+:} false; then : 8049 8141 $as_echo_n "(cached) " >&6 8050 8142 else 8051 8143 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 8052 8144 /* end confdefs.h. */ 8053 8145 8054 - #define VOID void 8055 - #define WIN32_LEAN_AND_MEAN 8056 - #include <windows.h> 8057 - #undef WIN32_LEAN_AND_MEAN 8146 +#define VOID void 8147 +#define WIN32_LEAN_AND_MEAN 8148 +#include <windows.h> 8149 +#undef WIN32_LEAN_AND_MEAN 8058 8150 8059 8151 int 8060 8152 main () 8061 8153 { 8062 8154 8063 8155 CHAR c; 8064 8156 SHORT s; ................................................................................ 8079 8171 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_winnt_ignore_void" >&5 8080 8172 $as_echo "$tcl_cv_winnt_ignore_void" >&6; } 8081 8173 if test "$tcl_cv_winnt_ignore_void" = "yes" ; then 8082 8174 8083 8175 $as_echo "#define HAVE_WINNT_IGNORE_VOID 1" >>confdefs.h 8084 8176 8085 8177 fi 8178 + fi 8086 8179 8087 8180 # See if the compiler supports casting to a union type. 8088 8181 # This is used to stop gcc from printing a compiler 8089 8182 # warning when initializing a union member. 8090 8183 8091 8184 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cast to union support" >&5 8092 8185 $as_echo_n "checking for cast to union support... " >&6; } ................................................................................ 8118 8211 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cast_to_union" >&5 8119 8212 $as_echo "$tcl_cv_cast_to_union" >&6; } 8120 8213 if test "$tcl_cv_cast_to_union" = "yes"; then 8121 8214 8122 8215 $as_echo "#define HAVE_CAST_TO_UNION 1" >>confdefs.h 8123 8216 8124 8217 fi 8125 - fi 8126 8218 8127 8219 8128 8220 8129 8221 8130 8222 8131 8223 8132 8224 ................................................................................ 8366 8458 if ${tcl_cv_struct_dirent64+:} false; then : 8367 8459 $as_echo_n "(cached) " >&6 8368 8460 else 8369 8461 8370 8462 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 8371 8463 /* end confdefs.h. */ 8372 8464 #include <sys/types.h> 8373 -#include <sys/dirent.h> 8465 +#include <dirent.h> 8374 8466 int 8375 8467 main () 8376 8468 { 8377 8469 struct dirent64 p; 8378 8470 ; 8379 8471 return 0; 8380 8472 } ................................................................................ 8575 8667 8576 8668 CLEANFILES="$CLEANFILES *.manifest" 8577 8669 8578 8670 8579 8671 fi 8580 8672 rm -f conftest* 8581 8673 8582 - MAKE_STUB_LIB="\${STLIB_LD} -out:\$@ \$(PKG_STUB_OBJECTS)" 8674 + MAKE_STUB_LIB="\${STLIB_LD} -nodefaultlib -out:\$@ \$(PKG_STUB_OBJECTS)" 8583 8675 else 8584 8676 MAKE_STATIC_LIB="\${STLIB_LD} \$@ \$(PKG_OBJECTS)" 8585 8677 MAKE_SHARED_LIB="\${SHLIB_LD} -o \$@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}" 8586 8678 MAKE_STUB_LIB="\${STLIB_LD} \$@ \$(PKG_STUB_OBJECTS)" 8587 8679 fi 8588 8680 8589 8681 if test "${SHARED_BUILD}" = "1" ; then ................................................................................ 8598 8690 # substituted. (@@@ Might not be necessary anymore) 8599 8691 #-------------------------------------------------------------------- 8600 8692 8601 8693 if test "${TEA_PLATFORM}" = "windows" ; then 8602 8694 if test "${SHARED_BUILD}" = "1" ; then 8603 8695 # We force the unresolved linking of symbols that are really in 8604 8696 # the private libraries of Tcl and Tk. 8605 - SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\"" 8606 8697 if test x"${TK_BIN_DIR}" != x ; then 8607 8698 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\"" 8608 8699 fi 8609 - eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" 8700 + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\"" 8701 + if test "$GCC" = "yes"; then 8702 + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -static-libgcc" 8703 + fi 8704 + eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" 8610 8705 else 8611 - eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" 8706 + eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" 8707 + if test "$GCC" = "yes"; then 8708 + PKG_LIB_FILE=lib${PKG_LIB_FILE} 8709 + fi 8612 8710 fi 8613 8711 # Some packages build their own stubs libraries 8614 - eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" 8712 + eval eval "PKG_STUB_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" 8615 8713 if test "$GCC" = "yes"; then 8616 8714 PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE} 8617 8715 fi 8618 8716 # These aren't needed on Windows (either MSVC or gcc) 8619 8717 RANLIB=: 8620 8718 RANLIB_STUB=: 8621 8719 else 8622 8720 RANLIB_STUB="${RANLIB}" 8623 8721 if test "${SHARED_BUILD}" = "1" ; then 8624 8722 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}" 8625 8723 if test x"${TK_BIN_DIR}" != x ; then 8626 8724 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}" 8627 8725 fi 8628 - eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" 8726 + eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" 8629 8727 RANLIB=: 8630 8728 else 8631 - eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" 8729 + eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" 8632 8730 fi 8633 8731 # Some packages build their own stubs libraries 8634 - eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" 8732 + eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" 8635 8733 fi 8636 8734 8637 8735 # These are escaped so that only CFLAGS is picked up at configure time. 8638 8736 # The other values will be substituted at make time. 8639 8737 CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}" 8640 8738 if test "${SHARED_BUILD}" = "1" ; then 8641 8739 CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}" ................................................................................ 8660 8758 8661 8759 8662 8760 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tclsh" >&5 8663 8761 $as_echo_n "checking for tclsh... " >&6; } 8664 8762 if test -f "${TCL_BIN_DIR}/Makefile" ; then 8665 8763 # tclConfig.sh is in Tcl build directory 8666 8764 if test "${TEA_PLATFORM}" = "windows"; then 8765 + if test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}" ; then 8667 8766 TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}" 8767 + elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}s${EXEEXT}" ; then 8768 + TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}s${EXEEXT}" 8769 + elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}t${EXEEXT}" ; then 8770 + TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}t${EXEEXT}" 8771 + elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}st${EXEEXT}" ; then 8772 + TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}st${EXEEXT}" 8773 + fi 8668 8774 else 8669 8775 TCLSH_PROG="${TCL_BIN_DIR}/tclsh" 8670 8776 fi 8671 8777 else 8672 8778 # tclConfig.sh is in install location 8673 8779 if test "${TEA_PLATFORM}" = "windows"; then 8674 8780 TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
Changes to extensions/example/configure.in.
23 23 24 24 #-------------------------------------------------------------------- 25 25 # Call TEA_INIT as the first TEA_ macro to set up initial vars. 26 26 # This will define a ${TEA_PLATFORM} variable == "unix" or "windows" 27 27 # as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE. 28 28 #-------------------------------------------------------------------- 29 29 30 -TEA_INIT([3.9]) 30 +TEA_INIT([3.10]) 31 31 32 32 AC_CONFIG_AUX_DIR(../../tclconfig) 33 33 34 34 #-------------------------------------------------------------------- 35 35 # Load the tclConfig.sh file 36 36 #-------------------------------------------------------------------- 37 37
Added extensions/tdomhtml/win/makefile.vc.
1 +# Simple makefile for pure Tcl package 2 + 3 +PROJECT = tdomhtml 4 +DOTVERSION = 0.1.0 5 +VERSION = $(DOTVERSION:.=) 6 + 7 +CPY = echo y | xcopy /i >NUL 8 + 9 +!ifndef INSTALLDIR 10 +### Assume the normal default. 11 +_INSTALLDIR = C:\Program Files\Tcl\lib 12 +!else 13 +### Fix the path separators. 14 +_INSTALLDIR = $(INSTALLDIR:/=\)\lib 15 +!endif 16 + 17 + 18 +PRJ_INSTALL_DIR = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION) 19 +DOC_INSTALL_DIR = $(PRJ_INSTALL_DIR) 20 +SCRIPT_INSTALL_DIR = $(PRJ_INSTALL_DIR) 21 + 22 +all: 23 + @echo This is a pure Tcl package. Just run 'make /f makefile.vc install INSTALLDIR=path\to\tcl\root' 24 + 25 +install: install-libraries 26 + 27 +install-libraries: 28 + @if not exist $(SCRIPT_INSTALL_DIR)\nul mkdir $(SCRIPT_INSTALL_DIR) 29 + @echo Installing libraries to '$(SCRIPT_INSTALL_DIR)' 30 + $(CPY) ..\tdomhtml.tcl "$(SCRIPT_INSTALL_DIR)" >NUL 31 + @echo Installing package index in '$(SCRIPT_INSTALL_DIR)' 32 + @type << >"$(SCRIPT_INSTALL_DIR)\pkgIndex.tcl" 33 + package ifneeded tdomhtml $(DOTVERSION) "set _V_ $(DOTVERSION); source [list [file join $$dir tdomhtml.tcl]]" 34 +<< 35 + 36 +install-docs: 37 +# @echo Installing documentation files to '$(DOC_INSTALL_DIR)' 38 +# @if exist $(DOCDIR) $(CPY) $(DOCDIR)\*.n "$(DOC_INSTALL_DIR)"
Changes to extensions/tnc/Makefile.in.
82 82 pkgdatadir = $(datadir)/$(PKG_DIR) 83 83 pkglibdir = $(libdir)/$(PKG_DIR) 84 84 pkgincludedir = $(includedir)/$(PKG_DIR) 85 85 86 86 top_builddir = . 87 87 88 88 INSTALL_OPTIONS = 89 -INSTALL = $(SHELL) $(srcdir)/tclconfig/install-sh -c ${INSTALL_OPTIONS} 89 +INSTALL = $(SHELL) $(srcdir)/../../tclconfig/install-sh -c ${INSTALL_OPTIONS} 90 90 INSTALL_DATA_DIR = ${INSTALL} -d -m 755 91 91 INSTALL_PROGRAM = ${INSTALL} -m 555 92 92 INSTALL_DATA = ${INSTALL} -m 444 93 93 INSTALL_SCRIPT = ${INSTALL_PROGRAM} 94 94 INSTALL_LIBRARY = ${INSTALL_DATA} 95 95 96 96 PACKAGE_NAME = @PACKAGE_NAME@ ................................................................................ 177 177 # TEA TARGETS. Please note that the "libraries:" target refers to platform 178 178 # independent files, and the "binaries:" target includes executable programs and 179 179 # platform-dependent libraries. Modify these targets so that they install 180 180 # the various pieces of your package. The make and install rules 181 181 # for the BINARIES that you specified above have already been done. 182 182 #======================================================================== 183 183 184 -all: binaries libraries doc 184 +all: binaries libraries 185 185 186 186 #======================================================================== 187 187 # The binaries target builds executable programs, Windows .dll's, unix 188 188 # shared/static libraries, and any other platform-dependent files. 189 189 # The list of targets to build for "binaries:" is specified at the top 190 190 # of the Makefile, in the "BINARIES" variable. 191 191 #======================================================================== 192 192 193 -binaries: $(BINARIES) 193 +binaries: $(BINARIES) pkgIndex.tcl-hand 194 194 195 195 libraries: 196 196 197 197 #======================================================================== 198 198 # Your doc target should differentiate from doc builds (by the developer) 199 199 # and doc installs (see install-doc), which just install the docs on the 200 200 # end user machine when building from source. 201 201 #======================================================================== 202 202 203 203 doc: 204 - @echo "If you have documentation to create, place the commands to" 205 - @echo "build the docs in the 'doc:' target. For example:" 206 - @echo " xml2nroff sample.xml > sample.n" 207 - @echo " xml2html sample.xml > sample.html" 208 204 209 -install: all install-binaries install-libraries install-doc 205 +install: all install-binaries install-libraries 210 206 211 207 install-binaries: binaries install-lib-binaries install-bin-binaries 212 208 213 209 #======================================================================== 214 210 # This rule installs platform-independent files, such as header files. 215 211 # The list=...; for p in $$list handles the empty list case x-platform. 216 212 #======================================================================== 217 213 218 214 install-libraries: libraries 219 215 @$(INSTALL_DATA_DIR) $(DESTDIR)$(includedir) 220 - @echo "Installing header files in $(DESTDIR)$(includedir)" 221 - @list='$(PKG_HEADERS)'; for i in $$list; do \ 222 - echo "Installing $(srcdir)/$$i" ; \ 223 - $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir) ; \ 224 - done; 225 216 226 217 #======================================================================== 227 218 # Install documentation. Unix manpages should go in the $(mandir) 228 219 # directory. 229 220 #======================================================================== 230 221 231 222 install-doc: doc ................................................................................ 292 283 # As necessary, add $(srcdir):$(srcdir)/compat:.... 293 284 #======================================================================== 294 285 295 286 VPATH = $(srcdir):$(srcdir)/generic:$(srcdir)/unix:$(srcdir)/win:$(srcdir)/macosx 296 287 297 288 .c.@OBJEXT@: 298 289 $(COMPILE) -c `@CYGPATH@ $<` -o $@ 290 + 291 +#======================================================================== 292 +# Create the pkgIndex.tcl file. 293 +#======================================================================== 294 + 295 +pkgIndex.tcl-hand: 296 + @(echo 'package ifneeded $(PACKAGE_NAME) $(PACKAGE_VERSION) \ 297 + "package require tdom;\ 298 + load [list [file join $$dir $(PKG_LIB_FILE)]];"'\ 299 + ) > pkgIndex.tcl 299 300 300 301 #======================================================================== 301 302 # Distribution creation 302 303 # You may need to tweak this target to make it work correctly. 303 304 #======================================================================== 304 305 305 306 #COMPRESS = tar cvf $(PKG_DIR).tar $(PKG_DIR); compress $(PKG_DIR).tar
Changes to extensions/tnc/configure.
638 638 STLIB_LD 639 639 CFLAGS_WARNING 640 640 CFLAGS_OPTIMIZE 641 641 CFLAGS_DEBUG 642 642 RC 643 643 CELIB_DIR 644 644 AR 645 +STUBS_BUILD 645 646 SHARED_BUILD 646 647 TCL_THREADS 647 648 TCL_INCLUDES 648 649 PKG_OBJECTS 649 650 PKG_SOURCES 650 651 TDOM_SRC_DIR 651 652 TDOM_STUB_LIB_SPEC 652 653 TDOM_VERSION 653 654 MATH_LIBS 654 655 EGREP 655 656 GREP 656 657 RANLIB 657 658 SET_MAKE 659 +INSTALL_LIBRARY 660 +INSTALL_SCRIPT 661 +INSTALL_PROGRAM 662 +INSTALL_DATA 663 +INSTALL_DATA_DIR 664 +INSTALL 658 665 CPP 659 666 TCL_SHLIB_LD_LIBS 660 667 TCL_LD_FLAGS 661 668 TCL_EXTRA_CFLAGS 662 669 TCL_DEFS 663 670 TCL_LIBS 664 671 CLEANFILES ................................................................................ 731 738 ac_user_opts=' 732 739 enable_option_checking 733 740 with_tcl 734 741 with_tdom 735 742 with_tclinclude 736 743 enable_threads 737 744 enable_shared 745 +enable_stubs 738 746 enable_64bit 739 747 enable_64bit_vis 740 748 enable_rpath 741 749 enable_wince 742 750 with_celib 743 751 enable_symbols 744 752 ' ................................................................................ 1358 1366 1359 1367 Optional Features: 1360 1368 --disable-option-checking ignore unrecognized --enable/--with options 1361 1369 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) 1362 1370 --enable-FEATURE[=ARG] include FEATURE [ARG=yes] 1363 1371 --enable-threads build with threads 1364 1372 --enable-shared build and link with shared libraries (default: on) 1373 + --enable-stubs build and link with stub libraries. Always true for 1374 + shared builds (default: on) 1365 1375 --enable-64bit enable 64bit support (default: off) 1366 1376 --enable-64bit-vis enable 64bit Sparc VIS support (default: off) 1367 1377 --disable-rpath disable rpath support (default: on) 1368 1378 --enable-wince enable Win/CE support (where applicable) 1369 1379 --enable-symbols build with debugging symbols (default: off) 1370 1380 1371 1381 Optional Packages: ................................................................................ 2173 2183 # This will define a ${TEA_PLATFORM} variable == "unix" or "windows" 2174 2184 # as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE. 2175 2185 #-------------------------------------------------------------------- 2176 2186 2177 2187 2178 2188 # TEA extensions pass this us the version of TEA they think they 2179 2189 # are compatible with. 2180 - TEA_VERSION="3.9" 2190 + TEA_VERSION="3.10" 2181 2191 2182 2192 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for correct TEA configuration" >&5 2183 2193 $as_echo_n "checking for correct TEA configuration... " >&6; } 2184 2194 if test x"${PACKAGE_NAME}" = x ; then 2185 2195 as_fn_error $? " 2186 -The PACKAGE_NAME variable must be defined by your TEA configure.in" "$LINENO" 5 2196 +The PACKAGE_NAME variable must be defined by your TEA configure.ac" "$LINENO" 5 2187 2197 fi 2188 - if test x"3.9" = x ; then 2198 + if test x"3.10" = x ; then 2189 2199 as_fn_error $? " 2190 2200 TEA version not specified." "$LINENO" 5 2191 - elif test "3.9" != "${TEA_VERSION}" ; then 2192 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: warning: requested TEA version \"3.9\", have \"${TEA_VERSION}\"" >&5 2193 -$as_echo "warning: requested TEA version \"3.9\", have \"${TEA_VERSION}\"" >&6; } 2201 + elif test "3.10" != "${TEA_VERSION}" ; then 2202 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: warning: requested TEA version \"3.10\", have \"${TEA_VERSION}\"" >&5 2203 +$as_echo "warning: requested TEA version \"3.10\", have \"${TEA_VERSION}\"" >&6; } 2194 2204 else 2195 2205 { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (TEA ${TEA_VERSION})" >&5 2196 2206 $as_echo "ok (TEA ${TEA_VERSION})" >&6; } 2197 2207 fi 2198 2208 2199 2209 # If the user did not set CFLAGS, set it now to keep macros 2200 2210 # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2". ................................................................................ 2217 2227 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 2218 2228 for as_dir in $PATH 2219 2229 do 2220 2230 IFS=$as_save_IFS 2221 2231 test -z "$as_dir" && as_dir=. 2222 2232 for ac_exec_ext in '' $ac_executable_extensions; do 2223 2233 if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then 2224 - ac_cv_prog_CYGPATH="cygpath -w" 2234 + ac_cv_prog_CYGPATH="cygpath -m" 2225 2235 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 2226 2236 break 2 2227 2237 fi 2228 2238 done 2229 2239 done 2230 2240 IFS=$as_save_IFS 2231 2241 ................................................................................ 2242 2252 fi 2243 2253 2244 2254 2245 2255 EXEEXT=".exe" 2246 2256 TEA_PLATFORM="windows" 2247 2257 ;; 2248 2258 *CYGWIN_*) 2249 - CYGPATH=echo 2250 2259 EXEEXT=".exe" 2251 - # TEA_PLATFORM is determined later in LOAD_TCLCONFIG 2260 + # CYGPATH and TEA_PLATFORM are determined later in LOAD_TCLCONFIG 2252 2261 ;; 2253 2262 *) 2254 2263 CYGPATH=echo 2255 2264 # Maybe we are cross-compiling.... 2256 2265 case ${host_alias} in 2257 2266 *mingw32*) 2258 2267 EXEEXT=".exe" ................................................................................ 2427 2436 fi 2428 2437 2429 2438 # check in a few common install locations 2430 2439 if test x"${ac_cv_c_tclconfig}" = x ; then 2431 2440 for i in `ls -d ${libdir} 2>/dev/null` \ 2432 2441 `ls -d ${exec_prefix}/lib 2>/dev/null` \ 2433 2442 `ls -d ${prefix}/lib 2>/dev/null` \ 2434 - `ls -d /usr/local/lib 2>/dev/null` \ 2435 2443 `ls -d /usr/contrib/lib 2>/dev/null` \ 2444 + `ls -d /usr/local/lib 2>/dev/null` \ 2445 + `ls -d /usr/pkg/lib 2>/dev/null` \ 2436 2446 `ls -d /usr/lib 2>/dev/null` \ 2437 2447 `ls -d /usr/lib64 2>/dev/null` \ 2448 + `ls -d /usr/lib/tcl8.6 2>/dev/null` \ 2449 + `ls -d /usr/lib/tcl8.5 2>/dev/null` \ 2438 2450 ; do 2439 2451 if test -f "$i/tclConfig.sh" ; then 2440 2452 ac_cv_c_tclconfig="`(cd $i; pwd)`" 2441 2453 break 2442 2454 fi 2443 2455 done 2444 2456 fi ................................................................................ 3350 3362 #endif 3351 3363 3352 3364 ; 3353 3365 return 0; 3354 3366 } 3355 3367 _ACEOF 3356 3368 if ac_fn_c_try_compile "$LINENO"; then : 3357 - TEA_PLATFORM="unix" 3369 + 3370 + TEA_PLATFORM="unix" 3371 + CYGPATH=echo 3372 + 3358 3373 else 3359 - TEA_PLATFORM="windows" 3374 + 3375 + TEA_PLATFORM="windows" 3376 + # Extract the first word of "cygpath", so it can be a program name with args. 3377 +set dummy cygpath; ac_word=$2 3378 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 3379 +$as_echo_n "checking for $ac_word... " >&6; } 3380 +if ${ac_cv_prog_CYGPATH+:} false; then : 3381 + $as_echo_n "(cached) " >&6 3382 +else 3383 + if test -n "$CYGPATH"; then 3384 + ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test. 3385 +else 3386 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 3387 +for as_dir in $PATH 3388 +do 3389 + IFS=$as_save_IFS 3390 + test -z "$as_dir" && as_dir=. 3391 + for ac_exec_ext in '' $ac_executable_extensions; do 3392 + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then 3393 + ac_cv_prog_CYGPATH="cygpath -m" 3394 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 3395 + break 2 3396 + fi 3397 +done 3398 + done 3399 +IFS=$as_save_IFS 3400 + 3401 + test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo" 3402 +fi 3403 +fi 3404 +CYGPATH=$ac_cv_prog_CYGPATH 3405 +if test -n "$CYGPATH"; then 3406 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGPATH" >&5 3407 +$as_echo "$CYGPATH" >&6; } 3408 +else 3409 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 3410 +$as_echo "no" >&6; } 3411 +fi 3412 + 3413 + 3360 3414 3361 3415 fi 3362 3416 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 3363 3417 CC=$hold_cc 3364 3418 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TEA_PLATFORM" >&5 3365 3419 $as_echo "$TEA_PLATFORM" >&6; } 3366 3420 ................................................................................ 4107 4161 fi 4108 4162 4109 4163 ac_ext=c 4110 4164 ac_cpp='$CPP $CPPFLAGS' 4111 4165 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' 4112 4166 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' 4113 4167 ac_compiler_gnu=$ac_cv_c_compiler_gnu 4168 + 4169 + 4170 + INSTALL='$(SHELL) $(srcdir)/tclconfig/install-sh -c' 4171 + INSTALL_DATA_DIR='${INSTALL} -d -m 755' 4172 + INSTALL_DATA='${INSTALL} -m 644' 4173 + INSTALL_PROGRAM='${INSTALL}' 4174 + INSTALL_SCRIPT='${INSTALL}' 4175 + INSTALL_LIBRARY='${INSTALL_DATA}' 4176 + 4177 + 4178 + 4179 + 4180 + 4181 + 4114 4182 4115 4183 4116 4184 #-------------------------------------------------------------------- 4117 4185 # Checks to see if the make program sets the $MAKE variable. 4118 4186 #-------------------------------------------------------------------- 4119 4187 4120 4188 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 ................................................................................ 5492 5560 # You can add more files to clean if your extension creates any extra 5493 5561 # files. 5494 5562 # 5495 5563 # TEA_ADD_* any platform specific compiler/build info here. 5496 5564 #-------------------------------------------------------------------- 5497 5565 5498 5566 if test "${TEA_PLATFORM}" = "windows" ; then 5499 - 5500 -$as_echo "#define BUILD_tnc 1" >>confdefs.h 5501 - 5567 + #AC_DEFINE(BUILD_tnc, 1, [Build windows export dll]) 5502 5568 CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch" 5503 5569 #TEA_ADD_SOURCES([win/winFile.c]) 5504 5570 #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"]) 5505 5571 else 5506 5572 CLEANFILES="pkgIndex.tcl" 5507 5573 #TEA_ADD_SOURCES([unix/unixFile.c]) 5508 5574 #TEA_ADD_LIBS([-lsuperfly]) ................................................................................ 5941 6007 #-------------------------------------------------------------------- 5942 6008 5943 6009 5944 6010 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to build libraries" >&5 5945 6011 $as_echo_n "checking how to build libraries... " >&6; } 5946 6012 # Check whether --enable-shared was given. 5947 6013 if test "${enable_shared+set}" = set; then : 5948 - enableval=$enable_shared; tcl_ok=$enableval 6014 + enableval=$enable_shared; shared_ok=$enableval 5949 6015 else 5950 - tcl_ok=yes 6016 + shared_ok=yes 5951 6017 fi 5952 6018 5953 6019 5954 6020 if test "${enable_shared+set}" = set; then 5955 6021 enableval="$enable_shared" 5956 - tcl_ok=$enableval 6022 + shared_ok=$enableval 6023 + else 6024 + shared_ok=yes 6025 + fi 6026 + 6027 + # Check whether --enable-stubs was given. 6028 +if test "${enable_stubs+set}" = set; then : 6029 + enableval=$enable_stubs; stubs_ok=$enableval 6030 +else 6031 + stubs_ok=yes 6032 +fi 6033 + 6034 + 6035 + if test "${enable_stubs+set}" = set; then 6036 + enableval="$enable_stubs" 6037 + stubs_ok=$enableval 5957 6038 else 5958 - tcl_ok=yes 6039 + stubs_ok=yes 5959 6040 fi 5960 6041 5961 - if test "$tcl_ok" = "yes" ; then 6042 + # Stubs are always enabled for shared builds 6043 + if test "$shared_ok" = "yes" ; then 5962 6044 { $as_echo "$as_me:${as_lineno-$LINENO}: result: shared" >&5 5963 6045 $as_echo "shared" >&6; } 5964 6046 SHARED_BUILD=1 6047 + STUBS_BUILD=1 5965 6048 else 5966 6049 { $as_echo "$as_me:${as_lineno-$LINENO}: result: static" >&5 5967 6050 $as_echo "static" >&6; } 5968 6051 SHARED_BUILD=0 5969 6052 5970 6053 $as_echo "#define STATIC_BUILD 1" >>confdefs.h 5971 6054 6055 + if test "$stubs_ok" = "yes" ; then 6056 + STUBS_BUILD=1 6057 + else 6058 + STUBS_BUILD=0 6059 + fi 5972 6060 fi 6061 + if test "${STUBS_BUILD}" = "1" ; then 6062 + 6063 +$as_echo "#define USE_TCL_STUBS 1" >>confdefs.h 6064 + 6065 + 6066 +$as_echo "#define USE_TCLOO_STUBS 1" >>confdefs.h 6067 + 6068 + if test "${TEA_WINDOWINGSYSTEM}" != ""; then 6069 + 6070 +$as_echo "#define USE_TK_STUBS 1" >>confdefs.h 6071 + 6072 + fi 6073 + fi 6074 + 6075 + 5973 6076 5974 6077 5975 6078 5976 6079 #-------------------------------------------------------------------- 5977 6080 # This macro figures out what flags to use with the compiler/linker 5978 6081 # when building shared/static debug/optimized objects. This information 5979 6082 # can be taken from the tclConfig.sh file, but this figures it all out. ................................................................................ 6141 6244 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_visibility_hidden" >&5 6142 6245 $as_echo "$tcl_cv_cc_visibility_hidden" >&6; } 6143 6246 if test $tcl_cv_cc_visibility_hidden = yes; then : 6144 6247 6145 6248 6146 6249 $as_echo "#define MODULE_SCOPE extern __attribute__((__visibility__(\"hidden\")))" >>confdefs.h 6147 6250 6251 + 6252 +$as_echo "#define HAVE_HIDDEN 1" >>confdefs.h 6253 + 6148 6254 6149 6255 fi 6150 6256 6151 6257 # Step 0.d: Disable -rpath support? 6152 6258 6153 6259 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if rpath support is requested" >&5 6154 6260 $as_echo_n "checking if rpath support is requested... " >&6; } ................................................................................ 6335 6441 else 6336 6442 AR="$ac_cv_prog_AR" 6337 6443 fi 6338 6444 6339 6445 STLIB_LD='${AR} cr' 6340 6446 LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" 6341 6447 if test "x$SHLIB_VERSION" = x; then : 6342 - SHLIB_VERSION="1.0" 6448 + SHLIB_VERSION="" 6449 +else 6450 + SHLIB_VERSION=".$SHLIB_VERSION" 6343 6451 fi 6344 6452 case $system in 6345 6453 # TEA specific: 6346 6454 windows) 6347 6455 # This is a 2-stage check to make sure we have the 64-bit SDK 6348 6456 # We have to know where the SDK is installed. 6349 6457 # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs ................................................................................ 6499 6607 6500 6608 if test "$GCC" != "yes" ; then 6501 6609 if test "${SHARED_BUILD}" = "0" ; then 6502 6610 runtime=-MT 6503 6611 else 6504 6612 runtime=-MD 6505 6613 fi 6614 + case "x`echo \${VisualStudioVersion}`" in 6615 + x1[4-9]*) 6616 + lflags="${lflags} -nodefaultlib:libucrt.lib" 6617 + 6618 + vars="ucrt.lib" 6619 + for i in $vars; do 6620 + if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then 6621 + # Convert foo.lib to -lfoo for GCC. No-op if not *.lib 6622 + i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'` 6623 + fi 6624 + PKG_LIBS="$PKG_LIBS $i" 6625 + done 6626 + 6627 + 6628 + ;; 6629 + *) 6630 + ;; 6631 + esac 6506 6632 6507 6633 if test "$do64bit" != "no" ; then 6508 6634 # All this magic is necessary for the Win64 SDK RC1 - hobbs 6509 6635 CC="\"${PATH64}/cl.exe\"" 6510 6636 CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\"" 6511 6637 RC="\"${MSSDK}/bin/rc.exe\"" 6512 - lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\"" 6638 + lflags="${lflags} -nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\"" 6513 6639 LINKBIN="\"${PATH64}/link.exe\"" 6514 6640 CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d" 6515 6641 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" 6516 6642 # Avoid 'unresolved external symbol __security_cookie' 6517 6643 # errors, c.f. http://support.microsoft.com/?id=894573 6518 6644 6519 6645 vars="bufferoverflowU.lib" ................................................................................ 6557 6683 cat >>confdefs.h <<_ACEOF 6558 6684 #define UNDER_CE $CEVERSION 6559 6685 _ACEOF 6560 6686 6561 6687 CFLAGS_DEBUG="-nologo -Zi -Od" 6562 6688 CFLAGS_OPTIMIZE="-nologo -Ox" 6563 6689 lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'` 6564 - lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo" 6690 + lflags="${lflags} -MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo" 6565 6691 LINKBIN="\"${CEBINROOT}/link.exe\"" 6566 6692 6567 6693 else 6568 6694 RC="rc" 6569 - lflags="-nologo" 6570 - LINKBIN="link" 6695 + lflags="${lflags} -nologo" 6696 + LINKBIN="link" 6571 6697 CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d" 6572 6698 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" 6573 6699 fi 6574 6700 fi 6575 6701 6576 6702 if test "$GCC" = "yes"; then 6577 6703 # mingw gcc mode ................................................................................ 6678 6804 $as_echo_n "checking for cross-compile version of gcc... " >&6; } 6679 6805 if ${ac_cv_cross+:} false; then : 6680 6806 $as_echo_n "(cached) " >&6 6681 6807 else 6682 6808 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 6683 6809 /* end confdefs.h. */ 6684 6810 6685 - #ifdef __WIN32__ 6811 + #ifdef _WIN32 6686 6812 #error cross-compiler 6687 6813 #endif 6688 6814 6689 6815 int 6690 6816 main () 6691 6817 { 6692 6818 ................................................................................ 6885 7011 LDFLAGS="$LDFLAGS -export-dynamic" 6886 7012 CC_SEARCH_FLAGS="" 6887 7013 LD_SEARCH_FLAGS="" 6888 7014 ;; 6889 7015 CYGWIN_*) 6890 7016 SHLIB_CFLAGS="" 6891 7017 SHLIB_LD='${CC} -shared' 7018 + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--out-implib,\$@.a" 6892 7019 SHLIB_SUFFIX=".dll" 6893 7020 EXEEXT=".exe" 7021 + do64bit_ok=yes 6894 7022 CC_SEARCH_FLAGS="" 6895 7023 LD_SEARCH_FLAGS="" 6896 7024 ;; 6897 7025 Haiku*) 6898 7026 LDFLAGS="$LDFLAGS -Wl,--export-dynamic" 6899 7027 SHLIB_CFLAGS="-fPIC" 6900 7028 SHLIB_SUFFIX=".so" ................................................................................ 7197 7325 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 7198 7326 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 7199 7327 fi 7200 7328 ;; 7201 7329 OpenBSD-*) 7202 7330 arch=`arch -s` 7203 7331 case "$arch" in 7204 - m88k|vax) 7205 - SHLIB_SUFFIX="" 7206 - SHARED_LIB_SUFFIX="" 7332 + alpha|sparc64) 7333 + SHLIB_CFLAGS="-fPIC" 7207 7334 ;; 7208 7335 *) 7209 - SHLIB_CFLAGS="-fPIC" 7210 - SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' 7211 - SHLIB_SUFFIX=".so" 7212 - if test $doRpath = yes; then : 7213 - 7214 - CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 7215 -fi 7216 - LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} 7217 - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' 7336 + SHLIB_CFLAGS="-fpic" 7218 7337 ;; 7219 7338 esac 7220 - case "$arch" in 7221 - m88k|vax) 7222 - CFLAGS_OPTIMIZE="-O1" 7223 - ;; 7224 - *) 7225 - CFLAGS_OPTIMIZE="-O2" 7226 - ;; 7227 - esac 7228 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ELF" >&5 7229 -$as_echo_n "checking for ELF... " >&6; } 7230 -if ${tcl_cv_ld_elf+:} false; then : 7231 - $as_echo_n "(cached) " >&6 7232 -else 7233 - 7234 - cat confdefs.h - <<_ACEOF >conftest.$ac_ext 7235 -/* end confdefs.h. */ 7236 - 7237 -#ifdef __ELF__ 7238 - yes 7239 -#endif 7240 - 7241 -_ACEOF 7242 -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 7243 - $EGREP "yes" >/dev/null 2>&1; then : 7244 - tcl_cv_ld_elf=yes 7245 -else 7246 - tcl_cv_ld_elf=no 7247 -fi 7248 -rm -f conftest* 7249 - 7250 -fi 7251 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_elf" >&5 7252 -$as_echo "$tcl_cv_ld_elf" >&6; } 7253 - if test $tcl_cv_ld_elf = yes; then : 7254 - 7255 - LDFLAGS=-Wl,-export-dynamic 7256 - 7257 -else 7258 - LDFLAGS="" 7259 -fi 7339 + SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' 7340 + SHLIB_SUFFIX=".so" 7341 + if test $doRpath = yes; then : 7342 + 7343 + CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 7344 +fi 7345 + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} 7346 + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}' 7347 + LDFLAGS="-Wl,-export-dynamic" 7348 + CFLAGS_OPTIMIZE="-O2" 7260 7349 if test "${TCL_THREADS}" = "1"; then : 7261 7350 7262 7351 # On OpenBSD: Compile with -pthread 7263 7352 # Don't link with -lpthread 7264 7353 LIBS=`echo $LIBS | sed s/-lpthread//` 7265 7354 CFLAGS="$CFLAGS -pthread" 7266 7355 ................................................................................ 7289 7378 7290 7379 fi 7291 7380 ;; 7292 7381 FreeBSD-*) 7293 7382 # This configuration from FreeBSD Ports. 7294 7383 SHLIB_CFLAGS="-fPIC" 7295 7384 SHLIB_LD="${CC} -shared" 7296 - TCL_SHLIB_LD_EXTRAS="-Wl,-soname \$@" 7385 + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,-soname,\$@" 7297 7386 SHLIB_SUFFIX=".so" 7298 7387 LDFLAGS="" 7299 7388 if test $doRpath = yes; then : 7300 7389 7301 7390 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 7302 - LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' 7391 + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 7303 7392 fi 7304 7393 if test "${TCL_THREADS}" = "1"; then : 7305 7394 7306 7395 # The -pthread needs to go in the LDFLAGS, not LIBS 7307 7396 LIBS=`echo $LIBS | sed s/-pthread//` 7308 7397 CFLAGS="$CFLAGS $PTHREAD_CFLAGS" 7309 7398 LDFLAGS="$LDFLAGS $PTHREAD_LIBS" 7310 7399 fi 7311 - # Version numbers are dot-stripped by system policy. 7312 - TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .` 7313 - UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' 7314 - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1' 7315 - TCL_LIB_VERSIONS_OK=nodots 7400 + case $system in 7401 + FreeBSD-3.*) 7402 + # Version numbers are dot-stripped by system policy. 7403 + TCL_TRIM_DOTS=`echo ${PACKAGE_VERSION} | tr -d .` 7404 + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' 7405 + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1' 7406 + TCL_LIB_VERSIONS_OK=nodots 7407 + ;; 7408 + esac 7316 7409 ;; 7317 7410 Darwin-*) 7318 7411 CFLAGS_OPTIMIZE="-Os" 7319 7412 SHLIB_CFLAGS="-fno-common" 7320 7413 # To avoid discrepancies between what headers configure sees during 7321 7414 # preprocessing tests and compiling tests, move any -isysroot and 7322 7415 # -mmacosx-version-min flags from CFLAGS to CPPFLAGS: ................................................................................ 7670 7763 if test "$GCC" = yes; then : 7671 7764 7672 7765 SHLIB_CFLAGS="-fPIC -melf" 7673 7766 LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" 7674 7767 7675 7768 else 7676 7769 7677 - SHLIB_CFLAGS="-Kpic -belf" 7678 - LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" 7770 + SHLIB_CFLAGS="-Kpic -belf" 7771 + LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" 7679 7772 7680 7773 fi 7681 7774 SHLIB_LD="ld -G" 7682 7775 SHLIB_LD_LIBS="" 7683 7776 SHLIB_SUFFIX=".so" 7684 7777 CC_SEARCH_FLAGS="" 7685 7778 LD_SEARCH_FLAGS="" ................................................................................ 7930 8023 fi 7931 8024 7932 8025 if test "$tcl_cv_cc_visibility_hidden" != yes; then : 7933 8026 7934 8027 7935 8028 $as_echo "#define MODULE_SCOPE extern" >>confdefs.h 7936 8029 7937 - 7938 -$as_echo "#define NO_VIZ /**/" >>confdefs.h 7939 - 7940 8030 7941 8031 fi 7942 8032 7943 8033 if test "$SHARED_LIB_SUFFIX" = ""; then : 7944 8034 7945 8035 # TEA specific: use PACKAGE_VERSION instead of VERSION 7946 8036 SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}' ................................................................................ 7947 8037 fi 7948 8038 if test "$UNSHARED_LIB_SUFFIX" = ""; then : 7949 8039 7950 8040 # TEA specific: use PACKAGE_VERSION instead of VERSION 7951 8041 UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a' 7952 8042 fi 7953 8043 7954 - if test "${GCC}" = "yes" ; then 8044 + if test "${GCC}" = "yes" -a ${SHLIB_SUFFIX} = ".dll"; then 7955 8045 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SEH support in compiler" >&5 7956 8046 $as_echo_n "checking for SEH support in compiler... " >&6; } 7957 8047 if ${tcl_cv_seh+:} false; then : 7958 8048 $as_echo_n "(cached) " >&6 7959 8049 else 7960 8050 if test "$cross_compiling" = yes; then : 7961 8051 tcl_cv_seh=no 7962 8052 else 7963 8053 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 7964 8054 /* end confdefs.h. */ 7965 8055 7966 - #define WIN32_LEAN_AND_MEAN 7967 - #include <windows.h> 7968 - #undef WIN32_LEAN_AND_MEAN 8056 +#define WIN32_LEAN_AND_MEAN 8057 +#include <windows.h> 8058 +#undef WIN32_LEAN_AND_MEAN 7969 8059 7970 8060 int main(int argc, char** argv) { 7971 8061 int a, b = 0; 7972 8062 __try { 7973 8063 a = 666 / b; 7974 8064 } 7975 8065 __except (EXCEPTION_EXECUTE_HANDLER) { ................................................................................ 8050 8140 $as_echo_n "checking for winnt.h that ignores VOID define... " >&6; } 8051 8141 if ${tcl_cv_winnt_ignore_void+:} false; then : 8052 8142 $as_echo_n "(cached) " >&6 8053 8143 else 8054 8144 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 8055 8145 /* end confdefs.h. */ 8056 8146 8057 - #define VOID void 8058 - #define WIN32_LEAN_AND_MEAN 8059 - #include <windows.h> 8060 - #undef WIN32_LEAN_AND_MEAN 8147 +#define VOID void 8148 +#define WIN32_LEAN_AND_MEAN 8149 +#include <windows.h> 8150 +#undef WIN32_LEAN_AND_MEAN 8061 8151 8062 8152 int 8063 8153 main () 8064 8154 { 8065 8155 8066 8156 CHAR c; 8067 8157 SHORT s; ................................................................................ 8082 8172 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_winnt_ignore_void" >&5 8083 8173 $as_echo "$tcl_cv_winnt_ignore_void" >&6; } 8084 8174 if test "$tcl_cv_winnt_ignore_void" = "yes" ; then 8085 8175 8086 8176 $as_echo "#define HAVE_WINNT_IGNORE_VOID 1" >>confdefs.h 8087 8177 8088 8178 fi 8179 + fi 8089 8180 8090 8181 # See if the compiler supports casting to a union type. 8091 8182 # This is used to stop gcc from printing a compiler 8092 8183 # warning when initializing a union member. 8093 8184 8094 8185 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cast to union support" >&5 8095 8186 $as_echo_n "checking for cast to union support... " >&6; } ................................................................................ 8121 8212 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cast_to_union" >&5 8122 8213 $as_echo "$tcl_cv_cast_to_union" >&6; } 8123 8214 if test "$tcl_cv_cast_to_union" = "yes"; then 8124 8215 8125 8216 $as_echo "#define HAVE_CAST_TO_UNION 1" >>confdefs.h 8126 8217 8127 8218 fi 8128 - fi 8129 8219 8130 8220 8131 8221 8132 8222 8133 8223 8134 8224 8135 8225 ................................................................................ 8369 8459 if ${tcl_cv_struct_dirent64+:} false; then : 8370 8460 $as_echo_n "(cached) " >&6 8371 8461 else 8372 8462 8373 8463 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 8374 8464 /* end confdefs.h. */ 8375 8465 #include <sys/types.h> 8376 -#include <sys/dirent.h> 8466 +#include <dirent.h> 8377 8467 int 8378 8468 main () 8379 8469 { 8380 8470 struct dirent64 p; 8381 8471 ; 8382 8472 return 0; 8383 8473 } ................................................................................ 8578 8668 8579 8669 CLEANFILES="$CLEANFILES *.manifest" 8580 8670 8581 8671 8582 8672 fi 8583 8673 rm -f conftest* 8584 8674 8585 - MAKE_STUB_LIB="\${STLIB_LD} -out:\$@ \$(PKG_STUB_OBJECTS)" 8675 + MAKE_STUB_LIB="\${STLIB_LD} -nodefaultlib -out:\$@ \$(PKG_STUB_OBJECTS)" 8586 8676 else 8587 8677 MAKE_STATIC_LIB="\${STLIB_LD} \$@ \$(PKG_OBJECTS)" 8588 8678 MAKE_SHARED_LIB="\${SHLIB_LD} -o \$@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}" 8589 8679 MAKE_STUB_LIB="\${STLIB_LD} \$@ \$(PKG_STUB_OBJECTS)" 8590 8680 fi 8591 8681 8592 8682 if test "${SHARED_BUILD}" = "1" ; then ................................................................................ 8601 8691 # substituted. (@@@ Might not be necessary anymore) 8602 8692 #-------------------------------------------------------------------- 8603 8693 8604 8694 if test "${TEA_PLATFORM}" = "windows" ; then 8605 8695 if test "${SHARED_BUILD}" = "1" ; then 8606 8696 # We force the unresolved linking of symbols that are really in 8607 8697 # the private libraries of Tcl and Tk. 8608 - SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\"" 8609 8698 if test x"${TK_BIN_DIR}" != x ; then 8610 8699 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\"" 8611 8700 fi 8612 - eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" 8701 + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\"" 8702 + if test "$GCC" = "yes"; then 8703 + SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -static-libgcc" 8704 + fi 8705 + eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" 8613 8706 else 8614 - eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" 8707 + eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" 8708 + if test "$GCC" = "yes"; then 8709 + PKG_LIB_FILE=lib${PKG_LIB_FILE} 8710 + fi 8615 8711 fi 8616 8712 # Some packages build their own stubs libraries 8617 - eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" 8713 + eval eval "PKG_STUB_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" 8618 8714 if test "$GCC" = "yes"; then 8619 8715 PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE} 8620 8716 fi 8621 8717 # These aren't needed on Windows (either MSVC or gcc) 8622 8718 RANLIB=: 8623 8719 RANLIB_STUB=: 8624 8720 else 8625 8721 RANLIB_STUB="${RANLIB}" 8626 8722 if test "${SHARED_BUILD}" = "1" ; then 8627 8723 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}" 8628 8724 if test x"${TK_BIN_DIR}" != x ; then 8629 8725 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}" 8630 8726 fi 8631 - eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" 8727 + eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" 8632 8728 RANLIB=: 8633 8729 else 8634 - eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" 8730 + eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" 8635 8731 fi 8636 8732 # Some packages build their own stubs libraries 8637 - eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" 8733 + eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" 8638 8734 fi 8639 8735 8640 8736 # These are escaped so that only CFLAGS is picked up at configure time. 8641 8737 # The other values will be substituted at make time. 8642 8738 CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}" 8643 8739 if test "${SHARED_BUILD}" = "1" ; then 8644 8740 CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}" ................................................................................ 8663 8759 8664 8760 8665 8761 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tclsh" >&5 8666 8762 $as_echo_n "checking for tclsh... " >&6; } 8667 8763 if test -f "${TCL_BIN_DIR}/Makefile" ; then 8668 8764 # tclConfig.sh is in Tcl build directory 8669 8765 if test "${TEA_PLATFORM}" = "windows"; then 8766 + if test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}" ; then 8670 8767 TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}" 8768 + elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}s${EXEEXT}" ; then 8769 + TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}s${EXEEXT}" 8770 + elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}t${EXEEXT}" ; then 8771 + TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}t${EXEEXT}" 8772 + elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}st${EXEEXT}" ; then 8773 + TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}st${EXEEXT}" 8774 + fi 8671 8775 else 8672 8776 TCLSH_PROG="${TCL_BIN_DIR}/tclsh" 8673 8777 fi 8674 8778 else 8675 8779 # tclConfig.sh is in install location 8676 8780 if test "${TEA_PLATFORM}" = "windows"; then 8677 8781 TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
Changes to extensions/tnc/configure.in.
21 21 22 22 #-------------------------------------------------------------------- 23 23 # Call TEA_INIT as the first TEA_ macro to set up initial vars. 24 24 # This will define a ${TEA_PLATFORM} variable == "unix" or "windows" 25 25 # as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE. 26 26 #-------------------------------------------------------------------- 27 27 28 -TEA_INIT([3.9]) 28 +TEA_INIT([3.10]) 29 29 30 30 AC_CONFIG_AUX_DIR(../../tclconfig) 31 31 32 32 #-------------------------------------------------------------------- 33 33 # Load the tclConfig.sh file 34 34 #-------------------------------------------------------------------- 35 35 ................................................................................ 95 95 # You can add more files to clean if your extension creates any extra 96 96 # files. 97 97 # 98 98 # TEA_ADD_* any platform specific compiler/build info here. 99 99 #-------------------------------------------------------------------- 100 100 101 101 if test "${TEA_PLATFORM}" = "windows" ; then 102 - AC_DEFINE(BUILD_tnc, 1, [Build windows export dll]) 102 + #AC_DEFINE(BUILD_tnc, 1, [Build windows export dll]) 103 103 CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch" 104 104 #TEA_ADD_SOURCES([win/winFile.c]) 105 105 #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"]) 106 106 else 107 107 CLEANFILES="pkgIndex.tcl" 108 108 #TEA_ADD_SOURCES([unix/unixFile.c]) 109 109 #TEA_ADD_LIBS([-lsuperfly])
Deleted extensions/tnc/makefile.vc.
1 -#---------------------------------------------------------------------------- 2 -# This is derivated from the tcl8.3 win makefile and surely not 3 -# perfect. It works for me. 4 -# rolf ade, 2001 (rolf@pointsman.de) 5 -# 6 -# 7 -# 8 -# Project directories 9 -# 10 -# ROOT = top of source tree 11 -# 12 -# TOOLS32 = location of VC++ 32-bit development tools. 13 -# 14 -# INSTALLDIR = where the install- targets should copy the binaries and 15 -# support files 16 -# 17 -#---------------------------------------------------------------------------- 18 - 19 -!if "$(MSVCDIR)" == "" 20 -MSG = ^ 21 -You'll need to run vcvars32.bat from Developer Studio, first, to setup^ 22 -the environment. 23 -!error $(MSG) 24 -!endif 25 - 26 - 27 -# VC++ 2.0 header files are broken, so you need to use the 28 -# ones that come with the developer network CD's, or later 29 -# versions of VC++. 30 -# 31 -# INSTALLDIR = where the install- targets should copy the binaries and 32 -# support files 33 -# 34 - 35 -# Set this to the appropriate value of /MACHINE: for your platform 36 -MACHINE = IX86 37 -ROOT = ..\.. 38 -INSTALLDIR = c:\Progra~1\Tcl 39 - 40 -TOOLS32 = $(MSVCDIR) 41 -TOOLS32_rc = $(MSVCDIR)\..\common\MSDev98 42 - 43 -# Uncomment the following line to compile with thread support 44 -#THREADDEFINES = -DTCL_THREADS=1 45 - 46 -# Set NODEBUG to 0 to compile with symbols 47 -NODEBUG = 1 48 - 49 -# The following defines can be used to control the amount of debugging 50 -# code that is added to the compilation. 51 -# 52 -# -DTCL_MEM_DEBUG Enables the debugging memory allocator. 53 -# -DTCL_COMPILE_DEBUG Enables byte compilation logging. 54 -# -DTCL_COMPILE_STATS Enables byte compilation statistics gathering. 55 -# -DUSE_TCLALLOC=0 Disables the Tcl memory allocator in favor 56 -# of the native malloc implementation. This is 57 -# 58 -# DEBUGDEFINES = -DTCL_MEM_DEBUG -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS 59 -# DEBUGDEFINES = -DUSE_TCLALLOC=0 60 - 61 - 62 -#------------------------------------------------------------------------- 63 -# 64 -# Do not modify below this line 65 -# 66 -#------------------------------------------------------------------------- 67 - 68 -NAMEPREFIX = libtnc 69 -STUBPREFIX = $(NAMEPREFIX)stub 70 -DOTVERSION = 0.3 71 -PACKAGE_VERSION = \"0.3.0\" 72 -VERSION = \"0.3\" 73 -W32VERSION = 03 74 -TDOMVER = 082 75 - 76 -BINROOT = . 77 -!IF "$(NODEBUG)" == "1" 78 -TMPDIRNAME = 79 -DBGX = 80 -!ELSE 81 -TMPDIRNAME = Debug 82 -DBGX = d 83 -!ENDIF 84 -TMPDIR = $(BINROOT) 85 -OUTDIRNAME = $(TMPDIRNAME) 86 -OUTDIR = $(TMPDIR) 87 -TOP_DIR = $(BINROOT)\.. 88 - 89 -TNCLIB = $(OUTDIR)\$(NAMEPREFIX)$(W32VERSION)$(DBGX).lib 90 -TNCDLLNAME = $(NAMEPREFIX)$(W32VERSION)$(DBGX).dll 91 -TNCDLL = $(OUTDIR)\$(TNCDLLNAME) 92 - 93 -# MKDIR = .\mkd.bat 94 -RM = del 95 - 96 -LIB_INSTALL_DIR = $(INSTALLDIR)\lib 97 -BIN_INSTALL_DIR = $(INSTALLDIR)\bin 98 -SCRIPT_INSTALL_DIR = $(INSTALLDIR)\lib\tcl$(DOTVERSION) 99 -INCLUDE_INSTALL_DIR = $(INSTALLDIR)\include 100 - 101 - 102 -TNCOBJS = $(TMPDIR)\tnc.obj 103 - 104 -cc32 = "$(TOOLS32)\bin\cl.exe" 105 -link32 = "$(TOOLS32)\bin\link.exe" 106 -rc32 = "$(TOOLS32_rc)\bin\rc.exe" 107 -include32 = -I"$(TOOLS32)\include" 108 -libpath32 = /LIBPATH:"$(TOOLS32)\lib" 109 -tcllibpath = /LIBPATH:"$(INSTALLDIR)\lib" 110 -tdomlibpath = /LIBPATH:"$(ROOT)\win\Release" 111 -lib32 = "$(TOOLS32)\bin\lib.exe" 112 - 113 -TNCDIR = $(ROOT)\extensions\tnc 114 -GENERICDIR = $(ROOT)\generic 115 -EXPATINCDIR = $(ROOT)\expat 116 -TCLINCDIR = $(INSTALLDIR)\Include 117 - 118 -TCL_INCLUDES = -I"$(TNCDIR)" -I"$(GENERICDIR)" -I"$(EXPATINCDIR)" -I"$(TCLINCDIR)" 119 -TCL_DEFINES = $(DEBUGDEFINES) $(THREADDEFINES) 120 - 121 -#------------------------------------------------------------------------- 122 -# 123 -# Compile flags 124 -# 125 -#------------------------------------------------------------------------- 126 - 127 -!IF "$(NODEBUG)" == "1" 128 -# This cranks the optimization level to maximize speed 129 -cdebug = -O2 -Gs -GD 130 -!ELSE 131 -!IF "$(MACHINE)" == "IA64" 132 -cdebug = -Od -Zi 133 -!ELSE 134 -cdebug = -Z7 -Od 135 -!ENDIF 136 -!ENDIF 137 - 138 -# declarations common to all compiler options 139 -cflags = -c -nologo -Fp$(TMPDIR)\ -YX -DXML_DTD -DXML_NS -DUSE_TCL_STUBS -DUSE_TDOM_STUBS -DVERSION=$(VERSION) -DPACKAGE_VERSION=$(PACKAGE_VERSION) 140 -cvarsdll = -MD$(DBGX) 141 - 142 -TCL_CFLAGS = $(cdebug) $(cflags) $(cvarsdll) $(include32) \ 143 - $(TCL_INCLUDES) $(TCL_DEFINES) 144 -CON_CFLAGS = $(cdebug) $(cflags) $(include32) -DCONSOLE 145 - 146 -#------------------------------------------------------------------------- 147 -# 148 -# Link flags 149 -# 150 -#------------------------------------------------------------------------- 151 - 152 -!IF "$(NODEBUG)" == "1" 153 -ldebug = /RELEASE 154 -!ELSE 155 -ldebug = -debug:full -debugtype:cv 156 -!ENDIF 157 - 158 -# declarations common to all linker options 159 -lflags = /NODEFAULTLIB /NOLOGO /MACHINE:$(MACHINE) $(libpath32) $(tcllibpath) $(tdomlibpath) 160 - 161 -# declarations for use on Intel i386, i486, and Pentium systems 162 -DLLENTRY = @12 163 -dlllflags = $(lflags) -entry:_DllMainCRTStartup$(DLLENTRY) -dll 164 - 165 - 166 -conlflags = $(lflags) -subsystem:console -entry:mainCRTStartup 167 -guilflags = $(lflags) -subsystem:windows -entry:WinMainCRTStartup 168 - 169 -libc = libc$(DBGX).lib oldnames.lib 170 -libcdll = msvcrt$(DBGX).lib oldnames.lib 171 - 172 -baselibs = kernel32.lib $(optlibs) advapi32.lib user32.lib tclstub84$(DBGX).lib tdomstub$(TDOMVER).lib 173 -winlibs = $(baselibs) gdi32.lib comdlg32.lib winspool.lib 174 - 175 - 176 -guilibs = $(libc) $(winlibs) 177 -conlibs = $(libc) $(baselibs) 178 -guilibsdll = $(libcdll) $(winlibs) 179 -conlibsdll = $(libcdll) $(baselibs) 180 - 181 -#------------------------------------------------------------------------- 182 -# 183 -# Project specific targets 184 -# 185 -#------------------------------------------------------------------------- 186 - 187 -release: setup dlls 188 -dlls: setup $(TNCDLL) 189 -all: setup dlls $(CAT32) 190 - 191 -setup: 192 -# @$(MKDIR) $(TMPDIR) 193 -# @$(MKDIR) $(OUTDIR) 194 - 195 -$(TNCLIB): $(TNCDLL) 196 - 197 -$(TNCDLL): $(TNCOBJS) 198 - $(link32) $(ldebug) $(dlllflags) \ 199 - -out:$@ $(guilibsdll) @<< 200 -$(TNCOBJS) 201 -<< 202 - 203 -#------------------------------------------------------------------------- 204 -# Implicit rules 205 -#------------------------------------------------------------------------- 206 - 207 -{$(TNCDIR)}.c{$(TMPDIR)}.obj: 208 - $(cc32) -DBUILD_tcl $(TCL_CFLAGS) -Fo$(TMPDIR)\ $< 209 - 210 -clean: 211 - -@$(RM) $(OUTDIR)\*.exp 2>nul 212 - -@$(RM) $(OUTDIR)\*.lib 2>nul 213 - -@$(RM) $(OUTDIR)\*.dll 2>nul 214 - -@$(RM) $(TMPDIR)\*.pch 2>nul 215 - -@$(RM) $(TMPDIR)\*.obj 2>nul 216 - -@$(RM) $(TMPDIR)\*.ilk 2>nul 217 - -@$(RM) $(TMPDIR)\*.pdb 2>nul
Changes to extensions/tnc/tests/loadtnc.tcl.
1 -catch {load ../../../unix/libtdom0.8.4.so} 1 +catch {load ../../../unix/libtdom0.9.0.so} 2 2 catch {load ../libtnc0.3.0.so} 3 -catch {load ../../unix/libtdom0.8.4.so} 3 +catch {load ../../unix/libtdom0.9.0.so} 4 4 catch {load libtnc0.3.0.so} 5 5 # loadtnc.tcl -- 6 6 # 7 7 # This file is [source]d by all.tcl and all test files, to ensure, that 8 8 # the tcltest package and the lastest tnc build is present. 9 9 10 10 if {[lsearch [namespace children] ::tcltest] == -1} {
Changes to extensions/tnc/tests/tnc.test.
130 130 <!ELEMENT b EMPTY> 131 131 ]> 132 132 <!-- This not well-formed document doesn't have a root element -->}} errMsg] 133 133 $parser free 134 134 set result 135 135 } {1} 136 136 137 +test tnc-2.7 {not valid document} { 138 + set parser [expat] 139 + tnc $parser enable 140 + set result [catch {$parser parse {<!DOCTYPE root [ 141 + <!ELEMENT root (a,b)> 142 + <!ELEMENT a (#PCDATA)> 143 + <!ELEMENT b EMPTY> 144 +]> 145 +<root><a>text</a></root>}} errMsg] 146 + $parser free 147 + set errMsg 148 +} {Validation error at line 6, character 17: Element can not end here (required element(s) missing).} 149 + 137 150 test tnc-3.1 {validate cmd} { 138 151 set parser [expat] 139 152 tnc $parser enable 140 153 set result [catch {$parser parse $xml}] 141 154 set validator [tnc $parser getValidateCmd] 142 155 rename $validator {} 143 156 $parser free
Changes to extensions/tnc/tnc.c.
2089 2089 Tcl_HashSearch search; 2090 2090 2091 2091 #ifdef TNC_DEBUG 2092 2092 printf ("TncElementEndCommand start\n"); 2093 2093 printContentStack (tncdata); 2094 2094 #endif 2095 2095 while (1) { 2096 - if (!TncProbeElementEnd (tncdata, 0)) { 2096 + if (!TncProbeElementEnd (tncdata)) { 2097 2097 signalNotValid (userData, TNC_ERROR_ELEMENT_CAN_NOT_END_HERE); 2098 2098 return; 2099 2099 } 2100 2100 if (tncdata->contentStack[tncdata->contentStackPtr - 1].deep == 0) { 2101 2101 break; 2102 2102 } 2103 2103 tncdata->contentStackPtr--; ................................................................................ 2968 2968 } 2969 2969 #endif 2970 2970 #ifdef USE_TDOM_STUBS 2971 2971 if (Tdom_InitStubs(interp, "0.8", 0) == NULL) { 2972 2972 return TCL_ERROR; 2973 2973 } 2974 2974 #endif 2975 - Tcl_PkgRequire (interp, "tdom", "0.8.0", 0); 2975 + Tcl_PkgRequire (interp, "tdom", NULL, 0); 2976 2976 Tcl_CreateObjCommand (interp, "tnc", TclTncObjCmd, NULL, NULL ); 2977 2977 Tcl_PkgProvide (interp, "tnc", PACKAGE_VERSION); 2978 2978 return TCL_OK; 2979 2979 } 2980 2980
Added extensions/tnc/win/makefile.vc.
1 +# makefile.vc -- -*- Makefile -*- 2 +# 3 +# Microsoft Visual C++ makefile for use with nmake.exe v1.62+ (VC++ 5.0+) 4 +# 5 +# This makefile is based upon the Tcl 8.4 Makefile.vc and modified to 6 +# make it suitable as a general package makefile. Look for the word EDIT 7 +# which marks sections that may need modification. As a minumum you will 8 +# need to change the PROJECT, DOTVERSION and DLLOBJS variables to values 9 +# relevant to your package. 10 +# 11 +# See the file "license.terms" for information on usage and redistribution 12 +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. 13 +# 14 +# Copyright (c) 1995-1996 Sun Microsystems, Inc. 15 +# Copyright (c) 1998-2000 Ajuba Solutions. 16 +# Copyright (c) 2001 ActiveState Corporation. 17 +# Copyright (c) 2001-2002 David Gravereaux. 18 +# Copyright (c) 2003-2006 Pat Thoyts 19 +# 20 +#------------------------------------------------------------------------- 21 +# RCS: @(#)$Id$ 22 +#------------------------------------------------------------------------- 23 + 24 +# Check to see we are configured to build with MSVC (MSDEVDIR or MSVCDIR) 25 +# or with the MS Platform SDK (MSSDK). Visual Studio .NET 2003 and 2005 define 26 +# VCINSTALLDIR instead. The MSVC Toolkit release defines yet another. 27 +!if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(MSSDK) && !defined(VCINSTALLDIR) && !defined(VCToolkitInstallDir) 28 +MSG = ^ 29 +You need to run vcvars32.bat from Developer Studio or setenv.bat from the^ 30 +Platform SDK first to setup the environment. Jump to this line to read^ 31 +the build instructions. 32 +!error $(MSG) 33 +!endif 34 + 35 +#------------------------------------------------------------------------------ 36 +# HOW TO USE this makefile: 37 +# 38 +# 1) It is now necessary to have %MSVCDir% set in the environment. This is 39 +# used as a check to see if vcvars32.bat had been run prior to running 40 +# nmake or during the installation of Microsoft Visual C++, MSVCDir had 41 +# been set globally and the PATH adjusted. Either way is valid. 42 +# 43 +# You'll need to run vcvars32.bat contained in the MsDev's vc(98)/bin 44 +# directory to setup the proper environment, if needed, for your current 45 +# setup. This is a needed bootstrap requirement and allows the swapping of 46 +# different environments to be easier. 47 +# 48 +# 2) To use the Platform SDK (not expressly needed), run setenv.bat after 49 +# vcvars32.bat according to the instructions for it. This can also turn on 50 +# the 64-bit compiler, if your SDK has it. 51 +# 52 +# 3) Targets are: 53 +# all -- Builds everything. 54 +# <project> -- Builds the project (eg: nmake sample) 55 +# test -- Builds and runs the test suite. 56 +# install -- Installs the built binaries and libraries to $(INSTALLDIR) 57 +# in an appropriate subdirectory. 58 +# clean/realclean/distclean -- varying levels of cleaning. 59 +# 60 +# 4) Macros usable on the commandline: 61 +# INSTALLDIR=<path> 62 +# Sets where to install Tcl from the built binaries. 63 +# C:\Progra~1\Tcl is assumed when not specified. 64 +# 65 +# OPTS=static,msvcrt,staticpkg,threads,symbols,profile,loimpact,none 66 +# Sets special options for the core. The default is for none. 67 +# Any combination of the above may be used (comma separated). 68 +# 'none' will over-ride everything to nothing. 69 +# 70 +# static = Builds a static library of the core instead of a 71 +# dll. The shell will be static (and large), as well. 72 +# msvcrt = Effects the static option only to switch it from 73 +# using libcmt(d) as the C runtime [by default] to 74 +# msvcrt(d). This is useful for static embedding 75 +# support. 76 +# staticpkg = Effects the static option only to switch 77 +# tclshXX.exe to have the dde and reg extension linked 78 +# inside it. 79 +# nothreads = Turns off multithreading support (not recommended) 80 +# thrdalloc = Use the thread allocator (shared global free pool). 81 +# symbols = Adds symbols for step debugging. 82 +# profile = Adds profiling hooks. Map file is assumed. 83 +# loimpact = Adds a flag for how NT treats the heap to keep memory 84 +# in use, low. This is said to impact alloc performance. 85 +# 86 +# STATS=memdbg,compdbg,none 87 +# Sets optional memory and bytecode compiler debugging code added 88 +# to the core. The default is for none. Any combination of the 89 +# above may be used (comma separated). 'none' will over-ride 90 +# everything to nothing. 91 +# 92 +# memdbg = Enables the debugging memory allocator. 93 +# compdbg = Enables byte compilation logging. 94 +# 95 +# MACHINE=(IX86|IA64|ALPHA|AMD64) 96 +# Set the machine type used for the compiler, linker, and 97 +# resource compiler. This hook is needed to tell the tools 98 +# when alternate platforms are requested. IX86 is the default 99 +# when not specified. If the CPU environment variable has been 100 +# set (ie: recent Platform SDK) then MACHINE is set from CPU. 101 +# 102 +# TMP_DIR=<path> 103 +# OUT_DIR=<path> 104 +# Hooks to allow the intermediate and output directories to be 105 +# changed. $(OUT_DIR) is assumed to be 106 +# $(BINROOT)\(Release|Debug) based on if symbols are requested. 107 +# $(TMP_DIR) will de $(OUT_DIR)\<buildtype> by default. 108 +# 109 +# TESTPAT=<file> 110 +# Reads the tests requested to be run from this file. 111 +# 112 +# CFG_ENCODING=encoding 113 +# name of encoding for configuration information. Defaults 114 +# to cp1252 115 +# 116 +# 5) Examples: 117 +# 118 +# Basic syntax of calling nmake looks like this: 119 +# nmake [-nologo] -f makefile.vc [target|macrodef [target|macrodef] [...]] 120 +# 121 +# Standard (no frills) 122 +# c:\tcl_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat 123 +# Setting environment for using Microsoft Visual C++ tools. 124 +# c:\tcl_src\win\>nmake -f makefile.vc all 125 +# c:\tcl_src\win\>nmake -f makefile.vc install INSTALLDIR=c:\progra~1\tcl 126 +# 127 +# Building for Win64 128 +# c:\tcl_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat 129 +# Setting environment for using Microsoft Visual C++ tools. 130 +# c:\tcl_src\win\>c:\progra~1\platfo~1\setenv.bat /pre64 /RETAIL 131 +# Targeting Windows pre64 RETAIL 132 +# c:\tcl_src\win\>nmake -f makefile.vc MACHINE=IA64 133 +# 134 +#------------------------------------------------------------------------------ 135 +#============================================================================== 136 +############################################################################### 137 +#------------------------------------------------------------------------------ 138 + 139 +!if !exist("makefile.vc") 140 +MSG = ^ 141 +You must run this makefile only from the directory it is in.^ 142 +Please `cd` to its location first. 143 +!error $(MSG) 144 +!endif 145 + 146 +#------------------------------------------------------------------------- 147 +# Project specific information (EDIT) 148 +# 149 +# You should edit this with the name and version of your project. This 150 +# information is used to generate the name of the package library and 151 +# it's install location. 152 +# 153 +# For example, the sample extension is going to build sample04.dll and 154 +# would install it into $(INSTALLDIR)\lib\sample04 155 +# 156 +# You need to specify the object files that need to be linked into your 157 +# binary here. 158 +# 159 +#------------------------------------------------------------------------- 160 + 161 +PROJECT = tnc 162 +!include "..\..\..\win\rules.vc" 163 + 164 +DOTVERSION = 0.3.0 165 +VERSION = $(DOTVERSION:.=) 166 +STUBPREFIX = $(PROJECT)stub 167 + 168 +DLLOBJS = $(TMP_DIR)\tnc.obj 169 + 170 +TDOM_DOTVERSION = 0.8.3 171 +TDOMVER = $(TDOM_DOTVERSION:.=) 172 + 173 +BINROOT = . 174 +# tdom root 175 +ROOT = ..\..\.. 176 + 177 +PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib 178 +PRJLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT) 179 +PRJLIB = $(OUT_DIR)\$(PRJLIBNAME) 180 + 181 +### Make sure we use backslash only. 182 +PRJ_INSTALL_DIR = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION) 183 +LIB_INSTALL_DIR = $(PRJ_INSTALL_DIR) 184 +BIN_INSTALL_DIR = $(PRJ_INSTALL_DIR) 185 +DOC_INSTALL_DIR = $(PRJ_INSTALL_DIR) 186 +SCRIPT_INSTALL_DIR = $(PRJ_INSTALL_DIR) 187 +INCLUDE_INSTALL_DIR = $(_TCLDIR)\include 188 + 189 +#--------------------------------------------------------------------- 190 +# Compile flags 191 +#--------------------------------------------------------------------- 192 + 193 +!if !$(DEBUG) 194 +!if $(OPTIMIZING) 195 +### This cranks the optimization level to maximize speed 196 +cdebug = $(OPTIMIZATIONS) 197 +!else 198 +cdebug = 199 +!endif 200 +!else if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64" 201 +### Warnings are too many, can't support warnings into errors. 202 +cdebug = -Zi -Od $(DEBUGFLAGS) 203 +!else 204 +cdebug = -Zi -WX $(DEBUGFLAGS) 205 +!endif 206 + 207 +### Declarations common to all compiler options 208 +cwarn = -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE 209 +cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\ 210 + 211 +!if $(MSVCRT) 212 +!if $(DEBUG) && !$(UNCHECKED) 213 +crt = -MDd 214 +!else 215 +crt = -MD 216 +!endif 217 +!else 218 +!if $(DEBUG) && !$(UNCHECKED) 219 +crt = -MTd 220 +!else 221 +crt = -MT 222 +!endif 223 +!endif 224 + 225 +!if !$(STATIC_BUILD) 226 +cflags = $(cflags) -DUSE_TCL_STUBS -DUSE_TDOM_STUBS 227 +!if defined(TKSTUBLIB) 228 +cflags = $(cflags) -DUSE_TK_STUBS 229 +!endif 230 +!endif 231 + 232 +TDOMLIBPATH = "$(ROOT)\win\$(BUILDDIRTOP)" 233 + 234 +TNCDIR = $(ROOT)\extensions\tnc 235 +WINDIR = $(TNCDIR)\win 236 +GENERICDIR = $(ROOT)\generic 237 +EXPATDIR = $(ROOT)\expat 238 +TCLINCDIR = $(INSTALLDIR)\Include 239 + 240 +DEFS = -DHAVE_MEMMOVE=1 -DXML_DTD=1 -DXML_NS=1 -DTDOM_NO_UNKNOWN_CMD=1 241 +INCLUDES = -I"$(WINDIR)" -I"$(TNCDIR)" -I"$(GENERICDIR)" -I"$(EXPATDIR)" $(TCL_INCLUDES) 242 +BASE_CFLAGS = $(cflags) $(cdebug) $(crt) $(INCLUDES) 243 +CON_CFLAGS = $(cflags) $(cdebug) $(crt) -DCONSOLE 244 +TCL_CFLAGS = -DPACKAGE_NAME="\"$(PROJECT)\"" \ 245 + -DPACKAGE_VERSION="\"$(DOTVERSION)\"" \ 246 + -DTDOM_PACKAGE_VERSION="\"$(TDOM_DOTVERSION)\"" \ 247 + $(BASE_CFLAGS) $(OPTDEFINES) $(DEFS) $(DEFS_EXPAT) 248 + 249 + 250 +#--------------------------------------------------------------------- 251 +# Link flags 252 +#--------------------------------------------------------------------- 253 + 254 +!if $(DEBUG) 255 +ldebug = -debug:full -debugtype:cv 256 +!if $(MSVCRT) 257 +ldebug = $(ldebug) -nodefaultlib:msvcrt 258 +!endif 259 +!else 260 +ldebug = -release -opt:ref -opt:icf,3 261 +!endif 262 + 263 +### Declarations common to all linker options 264 +lflags = -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug) 265 + 266 +!if $(PROFILE) 267 +lflags = $(lflags) -profile 268 +!endif 269 + 270 +!if $(ALIGN98_HACK) && !$(STATIC_BUILD) 271 +### Align sections for PE size savings. 272 +lflags = $(lflags) -opt:nowin98 273 +!else if !$(ALIGN98_HACK) && $(STATIC_BUILD) 274 +### Align sections for speed in loading by choosing the virtual page size. 275 +lflags = $(lflags) -align:4096 276 +!endif 277 + 278 +!if $(LOIMPACT) 279 +lflags = $(lflags) -ws:aggressive 280 +!endif 281 + 282 +dlllflags = $(lflags) -dll 283 +conlflags = $(lflags) -subsystem:console 284 +guilflags = $(lflags) -subsystem:windows 285 +!if !$(STATIC_BUILD) 286 +baselibs = $(TCLSTUBLIB) $(TDOMLIBPATH)\tdomstub$(TDOMVER).lib 287 +!if defined(TKSTUBLIB) 288 +baselibs = $(baselibs) $(TKSTUBLIB) 289 +!endif 290 +!endif 291 + 292 +# Avoid 'unresolved external symbol __security_cookie' errors. 293 +# c.f. http://support.microsoft.com/?id=894573 294 +!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64" 295 +baselibs = $(baselibs) bufferoverflowU.lib 296 +!endif 297 + 298 +#--------------------------------------------------------------------- 299 +# TclTest flags 300 +#--------------------------------------------------------------------- 301 + 302 +!IF "$(TESTPAT)" != "" 303 +TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT) 304 +!ENDIF 305 + 306 +#--------------------------------------------------------------------- 307 +# Project specific targets (EDIT) 308 +#--------------------------------------------------------------------- 309 + 310 +all: setup $(PROJECT) 311 +$(PROJECT): setup $(PRJLIB) 312 +install: install-binaries install-libraries install-docs 313 + 314 +# Tests need to ensure we load the right dll file we 315 +# have to handle the output differently on Win9x. 316 +# 317 +!if "$(OS)" == "Windows_NT" || "$(MSVCDIR)" == "IDE" 318 +test: setup $(PROJECT) 319 + set TCL_LIBRARY=$(ROOT)/library 320 + $(TCLSH) << 321 +load $(PRJLIB:\=/) 322 +source [file join $(LIBDIR:\=/) tdom.tcl] 323 +cd "$(ROOT)/tests" 324 +set argv "$(TESTFLAGS)" 325 +source all.tcl 326 +<< 327 +!else 328 +test: setup $(PROJECT) 329 + echo Please wait while the test results are collected 330 + set TCL_LIBRARY=$(ROOT)/library 331 + $(TCLSH) << >tests.log 332 +load $(PRJLIB:\=/) 333 +source [file join $(LIBDIR:\=/) tdom.tcl] 334 +cd "$(ROOT)/tests" 335 +set argv "$(TESTFLAGS)" 336 +source all.tcl 337 +<< 338 + type tests.log | more 339 +!endif 340 + 341 +setup: 342 + @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) 343 + @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) 344 + 345 +# See <tcl>/win/coffbase.txt for extension base addresses. 346 +$(PRJLIB): $(DLLOBJS) 347 +!if $(STATIC_BUILD) 348 + $(lib32) -nologo -out:$@ @<< 349 +$** 350 +<< 351 +!else 352 + $(link32) $(dlllflags) -out:$@ $(baselibs) @<< 353 +$** 354 +<< 355 + $(_VC_MANIFEST_EMBED_DLL) 356 + -@del $*.exp 357 +!endif 358 + 359 +#--------------------------------------------------------------------- 360 +# Implicit rules 361 +#--------------------------------------------------------------------- 362 + 363 +{$(WINDIR)}.c{$(TMP_DIR)}.obj:: 364 + $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<< 365 +$< 366 +<< 367 + 368 +{$(TNCDIR)}.c{$(TMP_DIR)}.obj:: 369 + $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<< 370 +$< 371 +<< 372 + 373 +{$(WINDIR)}.rc{$(TMP_DIR)}.res: 374 + $(rc32) -fo $@ -r -i "$(GENERICDIR)" -D__WIN32__ \ 375 + -DCOMMAVERSION=$(DOTVERSION:.=,),0 \ 376 + -DDOTVERSION=\"$(DOTVERSION)\" \ 377 + -DVERSION=\"$(VERSION)$(SUFX)\" \ 378 +!if $(DEBUG) 379 + -d DEBUG \ 380 +!endif 381 +!if $(TCL_THREADS) 382 + -d TCL_THREADS \ 383 +!endif 384 +!if $(STATIC_BUILD) 385 + -d STATIC_BUILD \ 386 +!endif 387 + $< 388 + 389 +.SUFFIXES: 390 +.SUFFIXES:.c .rc 391 + 392 +#------------------------------------------------------------------------- 393 +# Explicit dependency rules 394 +# 395 +#------------------------------------------------------------------------- 396 + 397 + 398 +#--------------------------------------------------------------------- 399 +# Installation. (EDIT) 400 +# 401 +# You may need to modify this section to reflect the final distribution 402 +# of your files and possibly to generate documentation. 403 +# 404 +#--------------------------------------------------------------------- 405 + 406 +install-binaries: 407 + @echo Installing binaries to '$(SCRIPT_INSTALL_DIR)' 408 + @if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)" 409 + @$(CPY) $(PRJLIB) "$(SCRIPT_INSTALL_DIR)" >NUL 410 + @$(CPY) $(PRJSTUBLIB) "$(SCRIPT_INSTALL_DIR)" >NUL 411 + 412 +install-libraries: 413 + @echo Installing package index in '$(SCRIPT_INSTALL_DIR)' 414 + @type << >"$(SCRIPT_INSTALL_DIR)\pkgIndex.tcl" 415 + package ifneeded $(PROJECT) $(DOTVERSION) "[list load [file join $$dir $(PROJECT)$(VERSION)$(SUFX).$(EXT)] $(PROJECT)]" 416 +<< 417 + 418 +install-docs: 419 +# @echo Installing documentation files to '$(DOC_INSTALL_DIR)' 420 +# @if exist $(DOCDIR) $(CPY) $(DOCDIR)\*.n "$(DOC_INSTALL_DIR)" 421 + 422 +#--------------------------------------------------------------------- 423 +# Clean up 424 +#--------------------------------------------------------------------- 425 + 426 +clean: 427 + @if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR) 428 + @if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc 429 + @if exist $(WINDIR)\vercl.i del $(WINDIR)\vercl.i 430 + @if exist $(WINDIR)\vercl.x del $(WINDIR)\vercl.x 431 + @if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch 432 + 433 +realclean: clean 434 + @if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR) 435 + 436 +distclean: realclean 437 + @if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe 438 + @if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj
Added extensions/tnc/win/nmakehlp.c.
1 +/* 2 + * ---------------------------------------------------------------------------- 3 + * nmakehlp.c -- 4 + * 5 + * This is used to fix limitations within nmake and the environment. 6 + * 7 + * Copyright (c) 2002 by David Gravereaux. 8 + * Copyright (c) 2006 by Pat Thoyts 9 + * 10 + * See the file "license.terms" for information on usage and redistribution of 11 + * this file, and for a DISCLAIMER OF ALL WARRANTIES. 12 + * ---------------------------------------------------------------------------- 13 + */ 14 + 15 +#define _CRT_SECURE_NO_DEPRECATE 16 +#include <windows.h> 17 +#define NO_SHLWAPI_GDI 18 +#define NO_SHLWAPI_STREAM 19 +#define NO_SHLWAPI_REG 20 +#include <shlwapi.h> 21 +#pragma comment (lib, "user32.lib") 22 +#pragma comment (lib, "kernel32.lib") 23 +#pragma comment (lib, "shlwapi.lib") 24 +#include <stdio.h> 25 +#include <math.h> 26 + 27 +/* 28 + * This library is required for x64 builds with _some_ versions of MSVC 29 + */ 30 +#if defined(_M_IA64) || defined(_M_AMD64) 31 +#if _MSC_VER >= 1400 && _MSC_VER < 1500 32 +#pragma comment(lib, "bufferoverflowU") 33 +#endif 34 +#endif 35 + 36 +/* ISO hack for dumb VC++ */ 37 +#ifdef _MSC_VER 38 +#define snprintf _snprintf 39 +#endif 40 + 41 + 42 + 43 +/* protos */ 44 + 45 +static int CheckForCompilerFeature(const char *option); 46 +static int CheckForLinkerFeature(const char **options, int count); 47 +static int IsIn(const char *string, const char *substring); 48 +static int SubstituteFile(const char *substs, const char *filename); 49 +static int QualifyPath(const char *path); 50 +static const char *GetVersionFromFile(const char *filename, const char *match, int numdots); 51 +static DWORD WINAPI ReadFromPipe(LPVOID args); 52 + 53 +/* globals */ 54 + 55 +#define CHUNK 25 56 +#define STATICBUFFERSIZE 1000 57 +typedef struct { 58 + HANDLE pipe; 59 + char buffer[STATICBUFFERSIZE]; 60 +} pipeinfo; 61 + 62 +pipeinfo Out = {INVALID_HANDLE_VALUE, '\0'}; 63 +pipeinfo Err = {INVALID_HANDLE_VALUE, '\0'}; 64 + 65 +/* 66 + * exitcodes: 0 == no, 1 == yes, 2 == error 67 + */ 68 + 69 +int 70 +main( 71 + int argc, 72 + char *argv[]) 73 +{ 74 + char msg[300]; 75 + DWORD dwWritten; 76 + int chars; 77 + 78 + /* 79 + * Make sure children (cl.exe and link.exe) are kept quiet. 80 + */ 81 + 82 + SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); 83 + 84 + /* 85 + * Make sure the compiler and linker aren't effected by the outside world. 86 + */ 87 + 88 + SetEnvironmentVariable("CL", ""); 89 + SetEnvironmentVariable("LINK", ""); 90 + 91 + if (argc > 1 && *argv[1] == '-') { 92 + switch (*(argv[1]+1)) { 93 + case 'c': 94 + if (argc != 3) { 95 + chars = snprintf(msg, sizeof(msg) - 1, 96 + "usage: %s -c <compiler option>\n" 97 + "Tests for whether cl.exe supports an option\n" 98 + "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]); 99 + WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, 100 + &dwWritten, NULL); 101 + return 2; 102 + } 103 + return CheckForCompilerFeature(argv[2]); 104 + case 'l': 105 + if (argc < 3) { 106 + chars = snprintf(msg, sizeof(msg) - 1, 107 + "usage: %s -l <linker option> ?<mandatory option> ...?\n" 108 + "Tests for whether link.exe supports an option\n" 109 + "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]); 110 + WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, 111 + &dwWritten, NULL); 112 + return 2; 113 + } 114 + return CheckForLinkerFeature(&argv[2], argc-2); 115 + case 'f': 116 + if (argc == 2) { 117 + chars = snprintf(msg, sizeof(msg) - 1, 118 + "usage: %s -f <string> <substring>\n" 119 + "Find a substring within another\n" 120 + "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]); 121 + WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, 122 + &dwWritten, NULL); 123 + return 2; 124 + } else if (argc == 3) { 125 + /* 126 + * If the string is blank, there is no match. 127 + */ 128 + 129 + return 0; 130 + } else { 131 + return IsIn(argv[2], argv[3]); 132 + } 133 + case 's': 134 + if (argc == 2) { 135 + chars = snprintf(msg, sizeof(msg) - 1, 136 + "usage: %s -s <substitutions file> <file>\n" 137 + "Perform a set of string map type substutitions on a file\n" 138 + "exitcodes: 0\n", 139 + argv[0]); 140 + WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, 141 + &dwWritten, NULL); 142 + return 2; 143 + } 144 + return SubstituteFile(argv[2], argv[3]); 145 + case 'V': 146 + if (argc != 4) { 147 + chars = snprintf(msg, sizeof(msg) - 1, 148 + "usage: %s -V filename matchstring\n" 149 + "Extract a version from a file:\n" 150 + "eg: pkgIndex.tcl \"package ifneeded http\"", 151 + argv[0]); 152 + WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, 153 + &dwWritten, NULL); 154 + return 0; 155 + } 156 + printf("%s\n", GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0')); 157 + return 0; 158 + case 'Q': 159 + if (argc != 3) { 160 + chars = snprintf(msg, sizeof(msg) - 1, 161 + "usage: %s -Q path\n" 162 + "Emit the fully qualified path\n" 163 + "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]); 164 + WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, 165 + &dwWritten, NULL); 166 + return 2; 167 + } 168 + return QualifyPath(argv[2]); 169 + } 170 + } 171 + chars = snprintf(msg, sizeof(msg) - 1, 172 + "usage: %s -c|-f|-l|-Q|-s|-V ...\n" 173 + "This is a little helper app to equalize shell differences between WinNT and\n" 174 + "Win9x and get nmake.exe to accomplish its job.\n", 175 + argv[0]); 176 + WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL); 177 + return 2; 178 +} 179 + 180 +static int 181 +CheckForCompilerFeature( 182 + const char *option) 183 +{ 184 + STARTUPINFO si; 185 + PROCESS_INFORMATION pi; 186 + SECURITY_ATTRIBUTES sa; 187 + DWORD threadID; 188 + char msg[300]; 189 + BOOL ok; 190 + HANDLE hProcess, h, pipeThreads[2]; 191 + char cmdline[100]; 192 + 193 + hProcess = GetCurrentProcess(); 194 + 195 + ZeroMemory(&pi, sizeof(PROCESS_INFORMATION)); 196 + ZeroMemory(&si, sizeof(STARTUPINFO)); 197 + si.cb = sizeof(STARTUPINFO); 198 + si.dwFlags = STARTF_USESTDHANDLES; 199 + si.hStdInput = INVALID_HANDLE_VALUE; 200 + 201 + ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES)); 202 + sa.nLength = sizeof(SECURITY_ATTRIBUTES); 203 + sa.lpSecurityDescriptor = NULL; 204 + sa.bInheritHandle = FALSE; 205 + 206 + /* 207 + * Create a non-inheritible pipe. 208 + */ 209 + 210 + CreatePipe(&Out.pipe, &h, &sa, 0); 211 + 212 + /* 213 + * Dupe the write side, make it inheritible, and close the original. 214 + */ 215 + 216 + DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, 0, TRUE, 217 + DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); 218 + 219 + /* 220 + * Same as above, but for the error side. 221 + */ 222 + 223 + CreatePipe(&Err.pipe, &h, &sa, 0); 224 + DuplicateHandle(hProcess, h, hProcess, &si.hStdError, 0, TRUE, 225 + DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); 226 + 227 + /* 228 + * Base command line. 229 + */ 230 + 231 + lstrcpy(cmdline, "cl.exe -nologo -c -TC -Zs -X -Fp.\\_junk.pch "); 232 + 233 + /* 234 + * Append our option for testing 235 + */ 236 + 237 + lstrcat(cmdline, option); 238 + 239 + /* 240 + * Filename to compile, which exists, but is nothing and empty. 241 + */ 242 + 243 + lstrcat(cmdline, " .\\nul"); 244 + 245 + ok = CreateProcess( 246 + NULL, /* Module name. */ 247 + cmdline, /* Command line. */ 248 + NULL, /* Process handle not inheritable. */ 249 + NULL, /* Thread handle not inheritable. */ 250 + TRUE, /* yes, inherit handles. */ 251 + DETACHED_PROCESS, /* No console for you. */ 252 + NULL, /* Use parent's environment block. */ 253 + NULL, /* Use parent's starting directory. */ 254 + &si, /* Pointer to STARTUPINFO structure. */ 255 + &pi); /* Pointer to PROCESS_INFORMATION structure. */ 256 + 257 + if (!ok) { 258 + DWORD err = GetLastError(); 259 + int chars = snprintf(msg, sizeof(msg) - 1, 260 + "Tried to launch: \"%s\", but got error [%u]: ", cmdline, err); 261 + 262 + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS| 263 + FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars], 264 + (300-chars), 0); 265 + WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL); 266 + return 2; 267 + } 268 + 269 + /* 270 + * Close our references to the write handles that have now been inherited. 271 + */ 272 + 273 + CloseHandle(si.hStdOutput); 274 + CloseHandle(si.hStdError); 275 + 276 + WaitForInputIdle(pi.hProcess, 5000); 277 + CloseHandle(pi.hThread); 278 + 279 + /* 280 + * Start the pipe reader threads. 281 + */ 282 + 283 + pipeThreads[0] = CreateThread(NULL, 0, ReadFromPipe, &Out, 0, &threadID); 284 + pipeThreads[1] = CreateThread(NULL, 0, ReadFromPipe, &Err, 0, &threadID); 285 + 286 + /* 287 + * Block waiting for the process to end. 288 + */ 289 + 290 + WaitForSingleObject(pi.hProcess, INFINITE); 291 + CloseHandle(pi.hProcess); 292 + 293 + /* 294 + * Wait for our pipe to get done reading, should it be a little slow. 295 + */ 296 + 297 + WaitForMultipleObjects(2, pipeThreads, TRUE, 500); 298 + CloseHandle(pipeThreads[0]); 299 + CloseHandle(pipeThreads[1]); 300 + 301 + /* 302 + * Look for the commandline warning code in both streams. 303 + * - in MSVC 6 & 7 we get D4002, in MSVC 8 we get D9002. 304 + */ 305 + 306 + return !(strstr(Out.buffer, "D4002") != NULL 307 + || strstr(Err.buffer, "D4002") != NULL 308 + || strstr(Out.buffer, "D9002") != NULL 309 + || strstr(Err.buffer, "D9002") != NULL 310 + || strstr(Out.buffer, "D2021") != NULL 311 + || strstr(Err.buffer, "D2021") != NULL); 312 +} 313 + 314 +static int 315 +CheckForLinkerFeature( 316 + const char **options, 317 + int count) 318 +{ 319 + STARTUPINFO si; 320 + PROCESS_INFORMATION pi; 321 + SECURITY_ATTRIBUTES sa; 322 + DWORD threadID; 323 + char msg[300]; 324 + BOOL ok; 325 + HANDLE hProcess, h, pipeThreads[2]; 326 + int i; 327 + char cmdline[255]; 328 + 329 + hProcess = GetCurrentProcess(); 330 + 331 + ZeroMemory(&pi, sizeof(PROCESS_INFORMATION)); 332 + ZeroMemory(&si, sizeof(STARTUPINFO)); 333 + si.cb = sizeof(STARTUPINFO); 334 + si.dwFlags = STARTF_USESTDHANDLES; 335 + si.hStdInput = INVALID_HANDLE_VALUE; 336 + 337 + ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES)); 338 + sa.nLength = sizeof(SECURITY_ATTRIBUTES); 339 + sa.lpSecurityDescriptor = NULL; 340 + sa.bInheritHandle = TRUE; 341 + 342 + /* 343 + * Create a non-inheritible pipe. 344 + */ 345 + 346 + CreatePipe(&Out.pipe, &h, &sa, 0); 347 + 348 + /* 349 + * Dupe the write side, make it inheritible, and close the original. 350 + */ 351 + 352 + DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, 0, TRUE, 353 + DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); 354 + 355 + /* 356 + * Same as above, but for the error side. 357 + */ 358 + 359 + CreatePipe(&Err.pipe, &h, &sa, 0); 360 + DuplicateHandle(hProcess, h, hProcess, &si.hStdError, 0, TRUE, 361 + DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); 362 + 363 + /* 364 + * Base command line. 365 + */ 366 + 367 + lstrcpy(cmdline, "link.exe -nologo "); 368 + 369 + /* 370 + * Append our option for testing. 371 + */ 372 + 373 + for (i = 0; i < count; i++) { 374 + lstrcat(cmdline, " \""); 375 + lstrcat(cmdline, options[i]); 376 + lstrcat(cmdline, "\""); 377 + } 378 + 379 + ok = CreateProcess( 380 + NULL, /* Module name. */ 381 + cmdline, /* Command line. */ 382 + NULL, /* Process handle not inheritable. */ 383 + NULL, /* Thread handle not inheritable. */ 384 + TRUE, /* yes, inherit handles. */ 385 + DETACHED_PROCESS, /* No console for you. */ 386 + NULL, /* Use parent's environment block. */ 387 + NULL, /* Use parent's starting directory. */ 388 + &si, /* Pointer to STARTUPINFO structure. */ 389 + &pi); /* Pointer to PROCESS_INFORMATION structure. */ 390 + 391 + if (!ok) { 392 + DWORD err = GetLastError(); 393 + int chars = snprintf(msg, sizeof(msg) - 1, 394 + "Tried to launch: \"%s\", but got error [%u]: ", cmdline, err); 395 + 396 + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS| 397 + FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars], 398 + (300-chars), 0); 399 + WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL); 400 + return 2; 401 + } 402 + 403 + /* 404 + * Close our references to the write handles that have now been inherited. 405 + */ 406 + 407 + CloseHandle(si.hStdOutput); 408 + CloseHandle(si.hStdError); 409 + 410 + WaitForInputIdle(pi.hProcess, 5000); 411 + CloseHandle(pi.hThread); 412 + 413 + /* 414 + * Start the pipe reader threads. 415 + */ 416 + 417 + pipeThreads[0] = CreateThread(NULL, 0, ReadFromPipe, &Out, 0, &threadID); 418 + pipeThreads[1] = CreateThread(NULL, 0, ReadFromPipe, &Err, 0, &threadID); 419 + 420 + /* 421 + * Block waiting for the process to end. 422 + */ 423 + 424 + WaitForSingleObject(pi.hProcess, INFINITE); 425 + CloseHandle(pi.hProcess); 426 + 427 + /* 428 + * Wait for our pipe to get done reading, should it be a little slow. 429 + */ 430 + 431 + WaitForMultipleObjects(2, pipeThreads, TRUE, 500); 432 + CloseHandle(pipeThreads[0]); 433 + CloseHandle(pipeThreads[1]); 434 + 435 + /* 436 + * Look for the commandline warning code in the stderr stream. 437 + */ 438 + 439 + return !(strstr(Out.buffer, "LNK1117") != NULL || 440 + strstr(Err.buffer, "LNK1117") != NULL || 441 + strstr(Out.buffer, "LNK4044") != NULL || 442 + strstr(Err.buffer, "LNK4044") != NULL || 443 + strstr(Out.buffer, "LNK4224") != NULL || 444 + strstr(Err.buffer, "LNK4224") != NULL); 445 +} 446 + 447 +static DWORD WINAPI 448 +ReadFromPipe( 449 + LPVOID args) 450 +{ 451 + pipeinfo *pi = (pipeinfo *) args; 452 + char *lastBuf = pi->buffer; 453 + DWORD dwRead; 454 + BOOL ok; 455 + 456 + again: 457 + if (lastBuf - pi->buffer + CHUNK > STATICBUFFERSIZE) { 458 + CloseHandle(pi->pipe); 459 + return (DWORD)-1; 460 + } 461 + ok = ReadFile(pi->pipe, lastBuf, CHUNK, &dwRead, 0L); 462 + if (!ok || dwRead == 0) { 463 + CloseHandle(pi->pipe); 464 + return 0; 465 + } 466 + lastBuf += dwRead; 467 + goto again; 468 + 469 + return 0; /* makes the compiler happy */ 470 +} 471 + 472 +static int 473 +IsIn( 474 + const char *string, 475 + const char *substring) 476 +{ 477 + return (strstr(string, substring) != NULL); 478 +} 479 + 480 +/* 481 + * GetVersionFromFile -- 482 + * Looks for a match string in a file and then returns the version 483 + * following the match where a version is anything acceptable to 484 + * package provide or package ifneeded. 485 + */ 486 + 487 +static const char * 488 +GetVersionFromFile( 489 + const char *filename, 490 + const char *match, 491 + int numdots) 492 +{ 493 + size_t cbBuffer = 100; 494 + static char szBuffer[100]; 495 + char *szResult = NULL; 496 + FILE *fp = fopen(filename, "rt"); 497 + 498 + if (fp != NULL) { 499 + /* 500 + * Read data until we see our match string. 501 + */ 502 + 503 + while (fgets(szBuffer, cbBuffer, fp) != NULL) { 504 + LPSTR p, q; 505 + 506 + p = strstr(szBuffer, match); 507 + if (p != NULL) { 508 + /* 509 + * Skip to first digit after the match. 510 + */ 511 + 512 + p += strlen(match); 513 + while (*p && !isdigit(*p)) { 514 + ++p; 515 + } 516 + 517 + /* 518 + * Find ending whitespace. 519 + */ 520 + 521 + q = p; 522 + while (*q && (strchr("0123456789.ab", *q)) && ((!strchr(".ab", *q) 523 + && (!strchr("ab", q[-1])) || --numdots))) { 524 + ++q; 525 + } 526 + 527 + memcpy(szBuffer, p, q - p); 528 + szBuffer[q-p] = 0; 529 + szResult = szBuffer; 530 + break; 531 + } 532 + } 533 + fclose(fp); 534 + } 535 + return szResult; 536 +} 537 + 538 +/* 539 + * List helpers for the SubstituteFile function 540 + */ 541 + 542 +typedef struct list_item_t { 543 + struct list_item_t *nextPtr; 544 + char * key; 545 + char * value; 546 +} list_item_t; 547 + 548 +/* insert a list item into the list (list may be null) */ 549 +static list_item_t * 550 +list_insert(list_item_t **listPtrPtr, const char *key, const char *value) 551 +{ 552 + list_item_t *itemPtr = malloc(sizeof(list_item_t)); 553 + if (itemPtr) { 554 + itemPtr->key = strdup(key); 555 + itemPtr->value = strdup(value); 556 + itemPtr->nextPtr = NULL; 557 + 558 + while(*listPtrPtr) { 559 + listPtrPtr = &(*listPtrPtr)->nextPtr; 560 + } 561 + *listPtrPtr = itemPtr; 562 + } 563 + return itemPtr; 564 +} 565 + 566 +static void 567 +list_free(list_item_t **listPtrPtr) 568 +{ 569 + list_item_t *tmpPtr, *listPtr = *listPtrPtr; 570 + while (listPtr) { 571 + tmpPtr = listPtr; 572 + listPtr = listPtr->nextPtr; 573 + free(tmpPtr->key); 574 + free(tmpPtr->value); 575 + free(tmpPtr); 576 + } 577 +} 578 + 579 +/* 580 + * SubstituteFile -- 581 + * As windows doesn't provide anything useful like sed and it's unreliable 582 + * to use the tclsh you are building against (consider x-platform builds - 583 + * eg compiling AMD64 target from IX86) we provide a simple substitution 584 + * option here to handle autoconf style substitutions. 585 + * The substitution file is whitespace and line delimited. The file should 586 + * consist of lines matching the regular expression: 587 + * \s*\S+\s+\S*$ 588 + * 589 + * Usage is something like: 590 + * nmakehlp -S << $** > $@ 591 + * @PACKAGE_NAME@ $(PACKAGE_NAME) 592 + * @PACKAGE_VERSION@ $(PACKAGE_VERSION) 593 + * << 594 + */ 595 + 596 +static int 597 +SubstituteFile( 598 + const char *substitutions, 599 + const char *filename) 600 +{ 601 + size_t cbBuffer = 1024; 602 + static char szBuffer[1024], szCopy[1024]; 603 + char *szResult = NULL; 604 + list_item_t *substPtr = NULL; 605 + FILE *fp, *sp; 606 + 607 + fp = fopen(filename, "rt"); 608 + if (fp != NULL) { 609 + 610 + /* 611 + * Build a list of substutitions from the first filename 612 + */ 613 + 614 + sp = fopen(substitutions, "rt"); 615 + if (sp != NULL) { 616 + while (fgets(szBuffer, cbBuffer, sp) != NULL) { 617 + unsigned char *ks, *ke, *vs, *ve; 618 + ks = (unsigned char*)szBuffer; 619 + while (ks && *ks && isspace(*ks)) ++ks; 620 + ke = ks; 621 + while (ke && *ke && !isspace(*ke)) ++ke; 622 + vs = ke; 623 + while (vs && *vs && isspace(*vs)) ++vs; 624 + ve = vs; 625 + while (ve && *ve && !(*ve == '\r' || *ve == '\n')) ++ve; 626 + *ke = 0, *ve = 0; 627 + list_insert(&substPtr, (char*)ks, (char*)vs); 628 + } 629 + fclose(sp); 630 + } 631 + 632 + /* debug: dump the list */ 633 +#ifdef _DEBUG 634 + { 635 + int n = 0; 636 + list_item_t *p = NULL; 637 + for (p = substPtr; p != NULL; p = p->nextPtr, ++n) { 638 + fprintf(stderr, "% 3d '%s' => '%s'\n", n, p->key, p->value); 639 + } 640 + } 641 +#endif 642 + 643 + /* 644 + * Run the substitutions over each line of the input 645 + */ 646 + 647 + while (fgets(szBuffer, cbBuffer, fp) != NULL) { 648 + list_item_t *p = NULL; 649 + for (p = substPtr; p != NULL; p = p->nextPtr) { 650 + char *m = strstr(szBuffer, p->key); 651 + if (m) { 652 + char *cp, *op, *sp; 653 + cp = szCopy; 654 + op = szBuffer; 655 + while (op != m) *cp++ = *op++; 656 + sp = p->value; 657 + while (sp && *sp) *cp++ = *sp++; 658 + op += strlen(p->key); 659 + while (*op) *cp++ = *op++; 660 + *cp = 0; 661 + memcpy(szBuffer, szCopy, sizeof(szCopy)); 662 + } 663 + } 664 + printf(szBuffer); 665 + } 666 + 667 + list_free(&substPtr); 668 + } 669 + fclose(fp); 670 + return 0; 671 +} 672 + 673 +/* 674 + * QualifyPath -- 675 + * 676 + * This composes the current working directory with a provided path 677 + * and returns the fully qualified and normalized path. 678 + * Mostly needed to setup paths for testing. 679 + */ 680 + 681 +static int 682 +QualifyPath( 683 + const char *szPath) 684 +{ 685 + char szCwd[MAX_PATH + 1]; 686 + char szTmp[MAX_PATH + 1]; 687 + char *p; 688 + GetCurrentDirectory(MAX_PATH, szCwd); 689 + while ((p = strchr(szPath, '/')) && *p) 690 + *p = '\\'; 691 + PathCombine(szTmp, szCwd, szPath); 692 + PathCanonicalize(szCwd, szTmp); 693 + printf("%s\n", szCwd); 694 + return 0; 695 +} 696 + 697 +/* 698 + * Local variables: 699 + * mode: c 700 + * c-basic-offset: 4 701 + * fill-column: 78 702 + * indent-tabs-mode: t 703 + * tab-width: 8 704 + * End: 705 + */
Changes to generic/dom.c.
1198 1198 if (!info->ignorexmlns) { 1199 1199 for (atPtr = atts; atPtr[0] && atPtr[1]; atPtr += 2) { 1200 1200 1201 1201 if (strncmp(atPtr[0], "xmlns", 5) == 0) { 1202 1202 xmlns = atPtr[0]; 1203 1203 newNS = 1; 1204 1204 if (xmlns[5] == ':') { 1205 + if (atPtr[1][0] == '\0') { 1206 + Tcl_SetResult (info->interp, "Missing URI in Namespace " 1207 + "declaration", NULL); 1208 + XML_StopParser(info->parser, 0); 1209 + return; 1210 + } 1205 1211 if (domIsNamespaceInScope (info->activeNS, info->activeNSpos, 1206 1212 &(xmlns[6]), atPtr[1])) { 1207 1213 ns = domLookupPrefix (info->currentNode, &(xmlns[6])); 1208 1214 newNS = 0; 1209 1215 } 1210 1216 else { 1211 1217 ns = domNewNamespace(info->document, &xmlns[6], atPtr[1]); ................................................................................ 2492 2498 if (prefix[0] != '\0') { 2493 2499 if (!domIsNCNAME (prefix)) { 2494 2500 if (interp) { 2495 2501 Tcl_SetObjResult(interp, 2496 2502 Tcl_NewStringObj("invalid prefix name", -1)); 2497 2503 } 2498 2504 return NULL; 2505 + } 2506 + if (uri[0] == '\0') { 2507 + Tcl_SetObjResult(interp, 2508 + Tcl_NewStringObj("Missing URI in " 2509 + "Namespace declaration", -1)); 2510 + return NULL; 2499 2511 } 2500 2512 } 2501 2513 if (!domIsNCNAME (localName)) { 2502 2514 if (interp) { 2503 2515 Tcl_SetObjResult(interp, 2504 2516 Tcl_NewStringObj("invalid local name", -1)); 2505 2517 } ................................................................................ 4564 4576 node->nodeFlags = 0; 4565 4577 node->namespace = 0; 4566 4578 node->nodeNumber = NODE_NO(doc); 4567 4579 node->ownerDocument = doc; 4568 4580 node->nodeName = (char *)&(h->key); 4569 4581 4570 4582 domSplitQName (tagName, prefix, &localname); 4583 + if (prefix[0] == '\0' && uri[0] == '\0') { 4584 + return NULL; 4585 + } 4571 4586 ns = domNewNamespace(doc, prefix, uri); 4572 4587 node->namespace = ns->index; 4573 4588 4574 4589 if (doc->fragments) { 4575 4590 node->nextSibling = doc->fragments; 4576 4591 doc->fragments->previousSibling = node; 4577 4592 doc->fragments = node;
Changes to generic/domjson.c.
333 333 DBG(fprintf(stderr, "Next array value node '%s'\n", &json[i]);); 334 334 skipspace(i); 335 335 i = jsonParseValue (node, json, i, jparse); 336 336 rc(i); 337 337 skipspace(i); 338 338 if (json[i] == ']') { 339 339 jparse->within = savedWithin; 340 + jparse->nestingDepth--; 340 341 return i+1; 341 342 } 342 343 if (json[i] == ',') { 343 344 i++; 344 345 continue; 345 346 } 346 347 errReturn(i,JSON_SYNTAX_ERR);
Changes to generic/domxpath.c.
2313 2313 newlen = strlen(xpath); 2314 2314 *errMsg = (char*)REALLOC(*errMsg, len+newlen+10); 2315 2315 memmove(*errMsg + len, " for '", 6); 2316 2316 memmove(*errMsg + len+6, xpath, newlen); 2317 2317 memmove(*errMsg + len+6+newlen, "' ", 3); 2318 2318 2319 2319 for (i=0; tokens[i].token != EOS; i++) { 2320 - sprintf(tmp, "%s\n%3s%3d %-12s %5ld %.3e %5d ", 2320 + sprintf(tmp, "%s\n%3s%3d %-12s %5ld %09.3f %5d ", 2321 2321 (i==0) ? "\n\nParsed symbols:" : "", 2322 2322 (i==l) ? "-->" : " ", 2323 2323 i, 2324 2324 token2str[tokens[i].token-LPAR], 2325 2325 tokens[i].intvalue, 2326 2326 tokens[i].realvalue, 2327 2327 tokens[i].pos ................................................................................ 2372 2372 if (!(step->child)) return 1; 2373 2373 if (step->child->type == IsElement) { 2374 2374 if (node->nodeType == ELEMENT_NODE) { 2375 2375 if ((step->child->strvalue[0] == '*') && 2376 2376 (step->child->strvalue[1] == '\0') && 2377 2377 (node->ownerDocument->rootNode != node) && 2378 2378 (step->child->intvalue == 0)) return 1; 2379 - if (node->namespace) return 0; 2379 + if (node->namespace 2380 + && (node->ownerDocument->namespaces[node->namespace-1]->prefix[0] != '\0' 2381 + || node->ownerDocument->namespaces[node->namespace-1]->uri[0] != '\0') 2382 + ) return 0; 2380 2383 return (strcmp(node->nodeName, step->child->strvalue)==0); 2381 2384 } 2382 2385 return 0; 2383 2386 } else 2384 2387 if (step->child->type == IsAttr) { 2385 2388 if (node->nodeType == ATTRIBUTE_NODE) { 2386 2389 if (node->nodeFlags & IS_NS_NODE) return 0;
Changes to generic/nodecmd.c.
411 411 break; 412 412 } 413 413 } 414 414 } else { 415 415 tag = nodeInfo->tagName; 416 416 } 417 417 418 - newNode = domAppendNewElementNode (parent, tag, NULL); 418 + newNode = domAppendNewElementNode (parent, tag, nodeInfo->namespace); 419 419 newNode->info = nodeInfo->jsonType; 420 420 421 421 /* 422 422 * Allow for following syntax: 423 423 * cmd ?-option value ...? ?script? 424 424 * cmd ?opton value ...? ?script? 425 425 * cmd key_value_list script ................................................................................ 522 522 Tcl_Obj *CONST objv[]; /* Argument objects. */ 523 523 int checkName; /* Flag: Name checks? */ 524 524 int checkCharData; /* Flag: Data checks? */ 525 525 { 526 526 int index, ret, type, nodecmd = 0, jsonType = 0, haveJsonType = 0; 527 527 int isElement = 0; 528 528 char *nsName, buf[64]; 529 - Tcl_Obj *tagName = NULL; 529 + Tcl_Obj *tagName = NULL, *namespace = NULL; 530 530 Tcl_DString cmdName; 531 531 NodeInfo *nodeInfo; 532 532 533 533 /* 534 534 * Syntax: 535 535 * 536 536 * dom createNodeCmd ?-returnNodeCmd? nodeType commandName ................................................................................ 542 542 543 543 static CONST84 char *subcmds[] = { 544 544 "elementNode", "textNode", "cdataNode", "commentNode", "piNode", 545 545 "parserNode", NULL 546 546 }; 547 547 548 548 static CONST84 char *options[] = { 549 - "-returnNodeCmd", "-jsonType", "-tagName", NULL 549 + "-returnNodeCmd", "-jsonType", "-tagName", "-namespace", NULL 550 550 }; 551 551 552 552 enum option { 553 - o_returnNodeCmd, o_jsonType, o_tagName 553 + o_returnNodeCmd, o_jsonType, o_tagName, o_namespace 554 554 }; 555 555 556 556 static const char *jsonTypes[] = { 557 557 "NONE", 558 558 "ARRAY", 559 559 "OBJECT", 560 560 "NULL", ................................................................................ 591 591 break; 592 592 593 593 case o_tagName: 594 594 tagName = objv[2]; 595 595 objc -= 2; 596 596 objv += 2; 597 597 break; 598 + 599 + case o_namespace: 600 + namespace = objv[2]; 601 + objc -= 2; 602 + objv += 2; 603 + break; 598 604 599 605 } 600 606 } 601 607 if (objc != 3) { 602 608 goto usage; 603 609 } 604 610 ................................................................................ 664 670 } 665 671 } else { 666 672 if (jsonType < 3 && jsonType > 0) { 667 673 Tcl_SetResult(interp, "For a text node the jsonType " 668 674 "argument must be one out of this list: " 669 675 "TRUE FALSE NULL NUMBER STRING NONE", 670 676 NULL); 677 + return TCL_ERROR; 671 678 } 672 679 type = TEXT_NODE; 673 680 } 674 681 break; 675 682 case CDS_NODE: 676 683 if (checkCharData) { 677 684 type = CDATA_SECTION_NODE_CHK; ................................................................................ 703 710 } 704 711 705 712 if (tagName && !isElement) { 706 713 Tcl_SetResult(interp, "The -tagName option is allowed only for " 707 714 "element node commands.", NULL); 708 715 return TCL_ERROR; 709 716 } 717 + 718 + if (namespace && !isElement) { 719 + Tcl_SetResult(interp, "The -namespace option is allowed only for " 720 + "element node commands.", NULL); 721 + return TCL_ERROR; 722 + } 710 723 711 724 if (haveJsonType && type != ELEMENT_NODE && type != TEXT_NODE) { 712 725 Tcl_SetResult(interp, "Only element and text nodes may have a " 713 726 "JSON type.", NULL); 714 727 return TCL_ERROR; 715 728 } 716 729 ................................................................................ 718 731 nodeInfo->namespace = NULL; 719 732 nodeInfo->type = type; 720 733 if (nodecmd) { 721 734 nodeInfo->type *= -1; /* Signal this fact */ 722 735 } 723 736 nodeInfo->jsonType = jsonType; 724 737 nodeInfo->tagName = NULL; 738 + if (namespace) { 739 + nodeInfo->namespace = tdomstrdup (Tcl_GetString(namespace)); 740 + } 725 741 if (tagName) { 726 742 nodeInfo->tagName = tdomstrdup (Tcl_GetString(tagName)); 727 743 } 728 744 Tcl_CreateObjCommand(interp, Tcl_DStringValue(&cmdName), NodeObjCmd, 729 745 (ClientData)nodeInfo, NodeObjCmdDeleteProc); 730 746 Tcl_DStringResult(interp, &cmdName); 731 747 Tcl_DStringFree(&cmdName);
Changes to generic/tcldom.c.
210 210 " createDocument docElemName ?objVar? \n" 211 211 " createDocumentNS uri docElemName ?objVar? \n" 212 212 " createDocumentNode ?objVar? \n" 213 213 TDomThreaded( 214 214 " attachDocument domDoc ?objVar? \n" 215 215 " detachDocument domDoc \n" 216 216 ) 217 - " createNodeCmd ?-returnNodeCmd? (element|comment|text|cdata|pi)Node cmdName \n" 217 + " createNodeCmd ?-returnNodeCmd? ?-tagName name? ?-jsonType jsonType? ?-namespace URI? (element|comment|text|cdata|pi)Node cmdName \n" 218 218 " setResultEncoding ?encodingName? \n" 219 219 " setStoreLineColumn ?boolean? \n" 220 220 " setNameCheck ?boolean? \n" 221 221 " setTextCheck ?boolean? \n" 222 222 " setObjectCommands ?(automatic|token|command)? \n" 223 223 " isCharData string \n" 224 224 " isComment string \n" ................................................................................ 1646 1646 int objc, 1647 1647 Tcl_Obj *CONST objv[] 1648 1648 ) 1649 1649 { 1650 1650 char *xpathQuery, *typeVar, *option; 1651 1651 char *errMsg = NULL, **mappings = NULL; 1652 1652 int rc, i, len, optionIndex, localmapping = 0, cache = 0; 1653 - int mappingListObjLen; 1653 + int mappingListObjLen = 0; 1654 1654 xpathResultSet rs; 1655 - Tcl_Obj *type, *objPtr, *objPtr1, *mappingListObj; 1655 + Tcl_Obj *type, *objPtr, *objPtr1, *mappingListObj = NULL; 1656 1656 xpathCBs cbs; 1657 1657 xpathParseVarCB parseVarCB; 1658 1658 1659 1659 static CONST84 char *selectNodesOptions[] = { 1660 1660 "-namespaces", "-cache", NULL 1661 1661 }; 1662 1662 enum selectNodesOption { ................................................................................ 5586 5586 5587 5587 case m_createElementNS: 5588 5588 CheckArgs(4,5,2,"elementName uri ?newObjVar?"); 5589 5589 uri = Tcl_GetString(objv[2]); 5590 5590 tag = Tcl_GetString(objv[3]); 5591 5591 CheckName (interp, tag, "full qualified tag", 1); 5592 5592 n = domNewElementNodeNS(doc, tag, uri); 5593 + if (n == NULL) { 5594 + SetResult("Missing URI in Namespace declaration"); 5595 + return TCL_ERROR; 5596 + } 5593 5597 return tcldom_setInterpAndReturnVar(interp, n, (objc == 5), 5594 5598 (objc == 5) ? objv[4] : NULL); 5595 5599 5596 5600 case m_createTextNode: 5597 5601 CheckArgs(3,4,2,"data ?newObjVar?"); 5598 5602 data = Tcl_GetStringFromObj(objv[2], &data_length); 5599 5603 CheckText (interp, data, "text");
Changes to tdom.m4.
239 239 fi 240 240 HTML5_LIBS="" 241 241 if test "$tcl_ok" = "yes" ; then 242 242 HAVEGUMBO=`pkg-config --exists gumbo && echo "1"` 243 243 if test "$HAVEGUMBO" = "1" ; then 244 244 AC_MSG_RESULT([yes]) 245 245 AC_DEFINE(TDOM_HAVE_GUMBO) 246 - HTML5_LIBS="`pkg-config --cflags --libs gumbo`" 246 + if test "${TEA_PLATFORM}" = "windows" ; then 247 + HTML5_LIBS="-Wl,-Bstatic `pkg-config --static --cflags --libs gumbo` -Wl,-Bdynamic" 248 + else 249 + HTML5_LIBS="`pkg-config --cflags --libs gumbo`" 250 + fi 247 251 else 248 252 AC_MSG_ERROR([The required lib gumbo not found]) 249 253 fi 250 254 else 251 255 AC_MSG_RESULT([no]) 252 256 fi 253 257 ])
Changes to tests/all.tcl.
16 16 ::tcltest::testConstraint] == -1} { 17 17 set ::tcltest::testConfig(need_i18n) 1 18 18 set ::tcltest::testConstraints(need_i18n) 1 19 19 if {[info procs ::tDOM::extRefHandler] != ""} { 20 20 set ::tcltest::testConfig(need_uri) 1 21 21 set ::tcltest::testConstraints(need_uri) 1 22 22 } 23 - } else { 23 + } else { 24 24 ::tcltest::testConstraint need_i18n 1 25 - if {[info procs ::tDOM::extRefHandler] != ""} { 26 - ::tcltest::testConstraint need_uri 1 27 - } 25 + if {[info procs ::tDOM::extRefHandler] != ""} { 26 + ::tcltest::testConstraint need_uri 1 27 + } 28 28 } 29 29 } 30 30 31 31 set timeCmd {clock format [clock seconds]} 32 32 33 33 set ::tcltest::testSingleFile false 34 34
Changes to tests/dom.test.
113 113 } 114 114 set nrOfCommands [llength [info commands]] 115 115 set doc [dom createDocument root] 116 116 rename $doc fooCmd 117 117 fooCmd delete 118 118 expr {[llength [info commands]] == $nrOfCommands} 119 119 } {1} 120 + 121 +test dom-1.16 {createDocumentNS - empty namespace, no prefix} { 122 + dom createDocumentNS "" doc doc 123 + set result [$doc asXML -indent none] 124 + $doc delete 125 + set result 126 +} {<doc/>} 127 + 128 +test dom-1.17 {createDocumentNS - namespace, no prefix} { 129 + dom createDocumentNS "uri" doc doc 130 + set result [$doc asXML -indent none] 131 + $doc delete 132 + set result 133 +} {<doc xmlns="uri"/>} 134 + 135 +test dom-1.18 {createDocumentNS - namespace, no prefix} { 136 + dom createDocumentNS "uri" doc doc 137 + set result [$doc selectNodes -namespaces {ns uri} count(/ns:doc)] 138 + $doc delete 139 + set result 140 +} 1 141 + 142 +test dom-1.19 {createDocumentNS - namespace, prefix} { 143 + dom createDocumentNS "uri" n1:doc doc 144 + set result [$doc selectNodes -namespaces {ns uri} count(/ns:doc)] 145 + $doc delete 146 + set result 147 +} 1 148 + 149 +test dom-1.20 {createDocumentNS - empty namespace, prefix} { 150 + catch {dom createDocumentNS "" n1:doc doc} errMsg 151 + set errMsg 152 +} {Missing URI in Namespace declaration} 120 153 121 154 test dom-2.1 {Don't quash white space at start or end of non white space content} { 122 155 set doc [dom parse {<root> 123 156 some content 124 157 </root>}] 125 158 set root [$doc documentElement] 126 159 $root text ................................................................................ 485 518 test dom-2.28 {parse document with undeclared xml prefix} { 486 519 catch {dom parse {<doc><foo:e/></doc>}} errMsg 487 520 string range $errMsg 0 30 488 521 } {Namespace prefix is not defined} 489 522 490 523 # This is an expat bug. If XML_StopParser is called in the 491 524 # elementstarthandler function for the document element and there 492 -# isn't anything else in the document then this document element, then 525 +# isn't anything else in the document than this document element, then 493 526 # the XML_Parse() return code doesn't reflects this. This is an edge 494 527 # case, see the next test below. 495 528 test dom-2.29 {parse not well-formed document with undeclared xml prefix} {knownBug} { 496 529 catch {dom parse {<foo:e/>}} errMsg 497 530 string range $errMsg 0 30 498 531 } {Namespace prefix is not defined} 499 532 ................................................................................ 532 565 test dom-2.33 {end of options option} { 533 566 set doc [dom parse -json -- -0.123] 534 567 set result [$doc asXML -indent none] 535 568 $doc delete 536 569 set result 537 570 } -0.123 538 571 572 +test dom-2.34 {XML prefix declaration with empty namespace} { 573 + catch {dom parse {<foo:doc xmlns:foo=""><e1/></foo:doc>}} errMsg 574 + set errMsg 575 +} {Missing URI in Namespace declaration, referenced at line 1 character 22} 576 + 539 577 test dom-3.1 {isName} { 540 578 dom isName ":foo" 541 579 } {1} 542 580 543 581 test dom-3.2 {isName} { 544 582 dom isName "_foo" 545 583 } {1}
Changes to tests/domDoc.test.
27 27 # domDoc-21.*: baseURI 28 28 # domDoc-22.*: appendFromScript 29 29 # domDoc-23.*: getElementsByTagNameNS 30 30 # domDoc-24.*: cdataSectionElements 31 31 # domDoc-25.*: selectNodesNamespaces 32 32 # domDoc-26.*: fragments list 33 33 # domDoc-27.*: deleteXPathCache 34 +# domDoc-28.*: createElementNS 34 35 # 35 36 # Copyright (c) 2004 - 2007 Rolf Ade. 36 37 37 38 source [file join [file dir [info script]] loadtdom.tcl] 38 39 39 40 test domDoc-1.1 {asXML -escapeNonASCII} {need_i18n} { 40 41 set doc [dom parse [tDOM::xmlReadFile \ ................................................................................ 1394 1395 set node [$doc selectNodes default1:root/default2:elem1] 1395 1396 set result [list [$node prefix] [$node localName]] 1396 1397 set node [$doc selectNodes default1:root/default2:elem1/elem11] 1397 1398 lappend result [$node nodeName] [$node namespaceURI] 1398 1399 $doc delete 1399 1400 set result 1400 1401 } {{} elem1 elem11 {}} 1402 + 1403 +test domDoc-25.7.1 {selectNodesNamespaces} { 1404 + set doc [dom parse {<root xmlns="rootdefaultNS"> 1405 + <elem1 xmlns="elem1NS"/> 1406 + <elem2 xmlns="elem2NS"/> 1407 + </root>}] 1408 + $doc documentElement root 1409 + $root firstChild elem1 1410 + $doc createElement elem11 elem11 1411 + $elem1 appendChild $elem11 1412 + $doc selectNodesNamespaces {default2 elem1NS default1 rootdefaultNS} 1413 + set node [$doc selectNodes default1:root/default2:elem1] 1414 + set result [list [$node prefix] [$node localName]] 1415 + set node [$doc selectNodes default1:root/default2:elem1/elem11] 1416 + lappend result [$node nodeName] [$node namespaceURI] 1417 + $doc delete 1418 + set result 1419 +} {{} elem1 elem11 {}} 1401 1420 1402 1421 test domDoc-25.8 {selectNodesNamespaces} { 1403 1422 set doc [dom parse {<root xmlns="rootdefaultNS"> 1404 1423 <elem1 xmlns="elem1NS"><elem11 xmlns=""/></elem1> 1405 1424 <elem2 xmlns="elem2NS"/> 1406 1425 </root>}] 1407 1426 $doc selectNodesNamespaces {default2 elem1NS default1 rootdefaultNS} ................................................................................ 1457 1476 lappend result [$doc deleteXPathCache foo/bar] 1458 1477 lappend result [$doc deleteXPathCache 2+2] 1459 1478 lappend result [$doc deleteXPathCache] 1460 1479 $doc selectNodes -cache 1 2+2 1461 1480 $doc delete 1462 1481 set result 1463 1482 } {{} {} {} {}} 1483 + 1484 +test domDoc-28.1 {createElementNS} { 1485 + set doc [dom createDocument doc] 1486 + set newElem [$doc createElementNS uri ns:e] 1487 + $doc documentElement root 1488 + $root appendChild $newElem 1489 + set result [$doc asXML -indent none] 1490 + $doc delete 1491 + set result 1492 +} {<doc><ns:e xmlns:ns="uri"/></doc>} 1493 + 1494 +test domDoc-28.2 {createElementNS} { 1495 + set doc [dom createDocument doc] 1496 + set newElem [$doc createElementNS uri ns:e] 1497 + $newElem setAttributeNS uri ns:att value 1498 + $doc documentElement root 1499 + $root appendChild $newElem 1500 + set result [$doc selectNodes -namespaces {ns uri} string(/doc/ns:e/@ns:att)] 1501 + $doc delete 1502 + set result 1503 +} {value} 1504 + 1505 +test domDoc-28.3 {createElementNS} { 1506 + set doc [dom createDocument doc] 1507 + catch {$doc createElementNS "" e} errMsg 1508 + $doc delete 1509 + set errMsg 1510 +} {Missing URI in Namespace declaration} 1511 + 1464 1512 1465 1513 # cleanup 1466 1514 ::tcltest::cleanupTests 1467 1515 return
Changes to tests/domNode.test.
393 393 $root setAttributeNS uri1 p1:a1 1 "" xmlns uri3 uri1 p1:a2 2 "" xmlns:p4 uri4 uri4 p4:a1 a1 uri2 p2:a3 3 "" a4 4 394 394 set result [$root asXML] 395 395 $doc delete 396 396 set result 397 397 } {<p1:root xmlns:p1="uri1" xmlns:p2="uri2" xmlns="uri3" xmlns:p4="uri4" p1:a1="1" p1:a2="2" p4:a1="a1" p2:a3="3" a4="4"/> 398 398 } 399 399 400 +test domNode-4.18 {setAttributeNS - prefixed attribute name with empty namespace} { 401 + set doc [dom createDocument "root"] 402 + set root [$doc documentElement] 403 + catch {$root setAttributeNS "" ns:att attvalue} errMsg 404 + $doc delete 405 + set errMsg 406 +} {For all prefixed attributes with prefixes other than 'xml' or 'xmlns' you have to provide a namespace URI} 407 + 400 408 test domNode-5.1 {removeChild} { 401 409 dom parse {<root><child/></root>} doc 402 410 $doc documentElement root 403 411 $root removeChild [$root firstChild] 404 412 set result [$doc asXML -indent none] 405 413 $doc delete 406 414 set result
Added tests/domjson.test.
1 +# Features covered: JSON parser 2 +# 3 +# This file contains a collection of tests for the JSON parser. 4 +# Tested functionalities: 5 +# json-1.*: JSON syntax tests 6 +# json-2.*: Valid JSON, that could not parsed into DOM 7 +# json-3.*: JSON unescaping 8 +# json-4.*: Unicode 9 +# json-5.*: Max nesting 10 +# json-6.*: asJSON 11 +# json-7.*: jsonType 12 +# json-7.*: appendFromScript 13 +# Copyright (c) 2017 Rolf Ade. 14 + 15 +source [file join [file dir [info script]] loadtdom.tcl] 16 + 17 + 18 +namespace eval nodeCmds { 19 + dom createNodeCmd elementNode e1 20 + dom createNodeCmd -jsonType ARRAY elementNode jae1 21 + dom createNodeCmd elementNode e2 22 + dom createNodeCmd commentNode c 23 + dom createNodeCmd textNode t 24 + dom createNodeCmd -jsonType TRUE textNode true 25 + dom createNodeCmd -jsonType FALSE textNode false 26 + dom createNodeCmd -jsonType NULL textNode null 27 + dom createNodeCmd -jsonType NUMBER textNode number 28 + dom createNodeCmd cdataNode cdata 29 + dom createNodeCmd piNode pi 30 +} 31 + 32 +test json-1.1 {Parse JSON} { 33 + set doc [dom parse -json {{"a":"avalue","b":"bvalue","c":0.123}}] 34 + set result [$doc asXML -indent none] 35 + $doc delete 36 + set result 37 +} "<a>avalue</a><b>bvalue</b><c>0.123</c>" 38 + 39 +test json-1.2 {Parse JSON} { 40 + set doc [dom parse -json { {"a" : [ "avalue" ] } }] 41 + set result [$doc asXML -indent none] 42 + $doc delete 43 + set result 44 +} {<a>avalue</a>} 45 + 46 +test json-1.3 {Parse JSON} { 47 + set doc [dom parse -json {{"a":"a value","b":"1value"}}] 48 + set result [$doc asXML -indent none] 49 + $doc delete 50 + set result 51 +} "<a>a value</a><b>1value</b>" 52 + 53 +test json-1.4 {Parse JSON - nested object} { 54 + set doc [dom parse -json {{"a":{"aa":"aavalue","bb":"bbvalue"},"b":"bvalue","c":0.123}}] 55 + set result [$doc asXML -indent none] 56 + $doc delete 57 + set result 58 +} "<a><aa>aavalue</aa><bb>bbvalue</bb></a><b>bvalue</b><c>0.123</c>" 59 + 60 +test json-1.5 {Parse JSON - array} { 61 + set doc [dom parse -json {{"a": [1,2,3,4,"abc"]}}] 62 + set result [$doc asXML -indent none] 63 + $doc delete 64 + set result 65 +} "<a>1234abc</a>" 66 + 67 +test json-1.6 {Parse JSON - true, false, null} { 68 + set doc [dom parse -json {{"a":true,"b":false,"c":null,"d":"true","e":""}}] 69 + set result [$doc asXML -indent none] 70 + $doc delete 71 + set result 72 +} {<a>true</a><b>false</b><c>null</c><d>true</d><e></e>} 73 + 74 +test json-1.7 {Parse JSON - array in nested object} { 75 + set doc [dom parse -json {{"a":{"aa":[1,2,3,4,"abc"]},"b":"bvalue"}}] 76 + set result [$doc asXML -indent none] 77 + $doc delete 78 + set result 79 +} "<a><aa>1234abc</aa></a><b>bvalue</b>" 80 + 81 +test json-1.8 {Parse JSON - true, false, null} { 82 + set doc [dom parse -json -jsonroot "JSONObject" {{"a":true,"b":false,"c":null,"d":"true","e":""}}] 83 + set result [$doc asXML -indent none] 84 + $doc delete 85 + set result 86 +} {<JSONObject><a>true</a><b>false</b><c>null</c><d>true</d><e></e></JSONObject>} 87 + 88 +test json-1.9 {JSON syntax error} { 89 + set result [catch {dom parse -json {{"a" "a value"}}} errMsg] 90 + list $result $errMsg 91 +} {1 {error "JSON syntax error" at position 5 92 +"{"a" " <--Error-- a value"}"}} 93 + 94 +test json-1.10 {JSON syntax error} { 95 + set result [catch {dom parse -json {{"a":00.23}}} errMsg] 96 + list $result $errMsg 97 +} {1 {error "JSON syntax error" at position 6 98 +"{"a":00 <--Error-- .23}"}} 99 + 100 +test json-1.11 {JSON syntax error} { 101 + set result [catch {dom parse -json {{"a":-00.23}}} errMsg] 102 + list $result $errMsg 103 +} {1 {error "JSON syntax error" at position 7 104 +"{"a":-00 <--Error-- .23}"}} 105 + 106 +test json-1.12 {JSON syntax error} { 107 + set result [catch {dom parse -json {{"a":.23}}} errMsg] 108 + list $result $errMsg 109 +} {1 {error "JSON syntax error" at position 5 110 +"{"a":. <--Error-- 23}"}} 111 + 112 +test json-1.13 {JSON syntax error} { 113 + set result [catch {dom parse -json {{"a":-.23}}} errMsg] 114 + list $result $errMsg 115 +} {1 {error "JSON syntax error" at position 6 116 +"{"a":-. <--Error-- 23}"}} 117 + 118 +test json-1.14 {JSON syntax error} { 119 + set result [catch {dom parse -json {{"a":-}}} errMsg] 120 + list $result $errMsg 121 +} {1 {error "JSON syntax error" at position 5 122 +"{"a":- <--Error-- }"}} 123 + 124 +test json-1.15 {Parse JSON - nested object} { 125 + set doc [dom parse -json {["a",["aa","bb"],"b"]}] 126 + set result [$doc asXML -indent none] 127 + $doc delete 128 + set result 129 +} "a<arraycontainer>aabb</arraycontainer>b" 130 + 131 +set notJsons { 132 + {{null}} 133 + {{1.23}} 134 + {{"string"}} 135 + {{"e":}} 136 +} 137 +test json-1.16 {Invalid input} { 138 + set result "" 139 + set ind 0 140 + foreach notJson $notJsons { 141 + if {![catch {dom parse -json $notJson docNode} errMsg]} { 142 + lappend result $errMsg 143 + } 144 + } 145 + set result 146 +} "" 147 + 148 +test json-1.17 {Literal binary 0 (NUL, '\0') is not allowed in input} { 149 + catch {dom parse -json "\"a\u0000\""} 150 +} 1 151 + 152 +test json-1.18 {Escaped binary 0 (NUL, '\0') is OK} { 153 + dom parse -json "\"a\\u0000\"" doc 154 + set result [$doc asJSON] 155 + $doc delete 156 + set result 157 +} "\"a\\u0000\"" 158 + 159 +test json-1.19 {Invalid input - uncompled \u escape} { 160 + catch {dom parse -json {"ab\u00"}} 161 +} 1 162 + 163 +test json-1.20 {Escaped binary 0} { 164 + dom parse -json "\"a\\u0000\"" doc 165 + set textvalue [$doc selectNodes string(node())] 166 + set result [string length $textvalue] 167 + binary scan $textvalue c2 result2 168 + lappend result {*}$result2 169 + $doc delete 170 + set result 171 +} {2 97 0} 172 + 173 +test json-2.1 {invalid xml name} { 174 + set doc [dom parse -json {{"a":"a value","1b":"1value", "a\nb":"a\nb", "":"empty string"}}] 175 + set result [$doc asXML -indent none] 176 + $doc delete 177 + set result 178 +} {<a>a value</a><1b>1value</1b><a 179 +b>a 180 +b</a 181 +b><>empty string</>} 182 + 183 +test json-3.1 {Unescaping} { 184 + set doc [dom parse -json {{"a":"a\nvalue","b":"value\tvalue"}}] 185 + set result [$doc asXML -indent none] 186 + $doc delete 187 + set result 188 +} "<a>a 189 +value</a><b>value\tvalue</b>" 190 + 191 +test json-3.2 {Unescaping} { 192 + set doc [dom parse -json {{"a":"a\nvalue", "b":"12\u0077\u2221ec"}}] 193 + set result [$doc asXML -indent none -escapeNonASCII] 194 + $doc delete 195 + set result 196 +} "<a>a 197 +value</a><b>12w∡ec</b>" 198 + 199 +test json-3.3 {Unescaping} { 200 + set doc [dom parse -json {{"a":"\u0077\u2221"}}] 201 + set result [$doc asXML -indent none -escapeNonASCII] 202 + $doc delete 203 + set result 204 +} "<a>w∡</a>" 205 + 206 +test json-3.4 {unescaping} { 207 + set doc [dom parse -jsonroot json -json {["\\a"]}] 208 + set result [$doc asXML -indent none] 209 + $doc delete 210 + set result 211 +} {<json>\a</json>} 212 + 213 +test json-3.4.1 {unescaping} { 214 + set doc [dom parse -jsonroot json -json {["\\a","\u0071"]}] 215 + set result [$doc asXML -indent none] 216 + $doc delete 217 + set result 218 +} {<json>\aq</json>} 219 + 220 +test json-3.5 {unescaping} { 221 + set result [catch {dom parse -json {{"this":"a\lb"}}} errMsg] 222 + list $result $errMsg 223 +} {1 {error "JSON syntax error" at position 11 224 +"{"this":"a\l <--Error-- b"}"}} 225 + 226 +test json-3.6 {unescaping} { 227 + set doc [dom parse -json {{"this":"a\nbc"}}] 228 + set result [$doc asXML -indent none] 229 + $doc delete 230 + set result 231 +} {<this>a 232 +bc</this>} 233 + 234 +test json-3.7 {unescaping} { 235 + set doc [dom parse -json {{"this":"a\u0077\t\u0078bc"}}] 236 + set result [$doc asXML -indent none] 237 + $doc delete 238 + set result 239 +} "<this>aw\txbc</this>" 240 + 241 +test json-3.8 {unescaping} { 242 + set doc [dom parse -json {{"this":"a\u000b"}}] 243 + set result [$doc asXML -indent none] 244 + $doc delete 245 + set result 246 +} "<this>a\u000b</this>" 247 + 248 +test json-3.9 {unescaping} { 249 + set doc [dom parse -json {{"this":"a\u0077","that":"\t\u0078bc"}}] 250 + set result [$doc asXML -indent none] 251 + $doc delete 252 + set result 253 +} "<this>aw</this><that>\txbc</that>" 254 + 255 +test json-5.1 {-jsonmaxnesting 0} { 256 + set result [catch {dom parse -json -jsonmaxnesting 0 {{"this":"that"}}} errMsg] 257 + list $result $errMsg 258 +} {1 {error "Maximum JSON object/array nesting depth exceeded" at position 0 259 +"{ <--Error-- "this":"that"}"}} 260 + 261 +test json-5.2 {-jsonmaxnesting 0} { 262 + set result [catch {dom parse -json -jsonmaxnesting 0 {["this","that"]}} errMsg] 263 + list $result $errMsg 264 +} {1 {error "Maximum JSON object/array nesting depth exceeded" at position 0 265 +"[ <--Error-- "this","that"]"}} 266 + 267 +test json-5.3 {-jsonmaxnesting 0} { 268 + set result [catch {dom parse -jsonroot o -json -jsonmaxnesting 0 {["this","that"]}} errMsg] 269 + list $result $errMsg 270 +} {1 {error "Maximum JSON object/array nesting depth exceeded" at position 0 271 +"[ <--Error-- "this","that"]"}} 272 + 273 +test json-5.4 {-jsonmaxnesting} { 274 + set doc [dom parse -json -jsonmaxnesting 2 {{"this":{"foo":"that"}}}] 275 + set result [$doc asXML -indent none] 276 + $doc delete 277 + set result 278 +} {<this><foo>that</foo></this>} 279 + 280 +test json-5.5 {-jsonmaxnesting} { 281 + set result [catch {dom parse -json -jsonmaxnesting 1 \ 282 + {{"this":{"foo":"that"}}}} errMsg] 283 + list $result $errMsg 284 +} {1 {error "Maximum JSON object/array nesting depth exceeded" at position 8 285 +"{"this":{ <--Error-- "foo":"that"}}"}} 286 + 287 +test json-5.6 {-jsonmaxnesting} { 288 + set doc [dom parse -json -jsonmaxnesting 2 { 289 + { 290 + "this": { 291 + "foo":"that", 292 + "bar":"grill" 293 + }, 294 + "two": "value", 295 + "three": { 296 + "t1":"t1value", 297 + "t2":"t2value" 298 + }, 299 + "four": ["a","b","c"] 300 + }}] 301 + set result [$doc asXML] 302 + $doc delete 303 + set result 304 +} {<this> 305 + <foo>that</foo> 306 + <bar>grill</bar> 307 +</this> 308 +<two>value</two> 309 +<three> 310 + <t1>t1value</t1> 311 + <t2>t2value</t2> 312 +</three> 313 +<four>abc</four> 314 +} 315 + 316 +set jsons { 317 + {{"a":"avalue","b":"bvalue","c":0.123}} 318 + {{"a":["avalue"]}} 319 + {{"a":"a value","b":"1value"}} 320 + {{"a":{"aa":"aavalue","bb":"bbvalue"},"b":"bvalue","c":0.123}} 321 + {{"a":[1,2,3,4,"abc"]}} 322 + {{"a":true,"b":false,"c":null,"d":"true","e":""}} 323 + {{"a":{"aa":[1,2,3,4,"abc"]},"b":"bvalue"}} 324 + {{"a":true,"b":false,"c":null,"d":"true","e":""}} 325 + {["a",["aa","bb"],"b"]} 326 + {{"a":"a\nvalue","b":"value\tvalue"}} 327 + {["\\\\a"]} 328 + {["a\"b"]} 329 + {{"b":"a \"b c\" d","b":"a \"b c\" d"}} 330 + {{"this":"a\nbc"}} 331 + {{"this":{"foo":"that"}}} 332 + {{"this":{"foo":"that","bar":"grill"},"two":"value","three":{"t1":"t1value","t2":"t2value"},"four":["a","b","c"]}} 333 + {"only a string"} 334 + {null} 335 + {1.23} 336 + {true} 337 + {false} 338 + {{}} 339 + {[]} 340 + {[[]]} 341 + {[["x"]]} 342 + {""} 343 + {[[[[["a"]]]]]} 344 + {{"x":[{"id":"foo"}]}} 345 + {"http://foo.bar"} 346 +} 347 +test json-6.1 {asJSON} { 348 + set failedlist [list] 349 + set ind 0 350 + foreach json $jsons { 351 + set doc [dom parse -json $json] 352 + set out [$doc asJSON] 353 + if {$json ne $out} { 354 + lappend failedlist "$ind : '$json' : '$out'" 355 + } 356 + incr ind 357 + } 358 + set failedlist 359 +} {} 360 + 361 +test json-6.2 {asJSON - slash will not be escaped while serializing} { 362 + set doc [dom parse -json {"http:\/\/foo.bar"}] 363 + set result [$doc asJSON] 364 + $doc delete 365 + set result 366 +} {"http://foo.bar"} 367 + 368 +test json-6.3 {asJSON - docNode serialization} { 369 + dom createDocumentNode docNode 370 + set result [$docNode asJSON] 371 + $docNode delete 372 + set result 373 +} {{}} 374 + 375 +test json-6.4 {asJSON - doc serialization} { 376 + dom createDocument root docNode 377 + set result [$docNode asJSON] 378 + $docNode delete 379 + set result 380 +} {{"root":""}} 381 + 382 +test json-6.5 {asJSON - serialization of control characters} { 383 + set doc [dom parse -json "\"a\\u0000\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\u0008\\u0009\\u000A\\u000B\\u000C\\u000D\\u000E\\u000F\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018\\u0019\\u001A\\u001B\\u001C\\u001D\\u001E\\u001F\\u0020b\""] 384 + set result [$doc asJSON] 385 + $doc delete 386 + set result 387 +} {"a\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f b"} 388 + 389 +test json-7.1 {jsonType} { 390 + set doc [dom parse {<j>foo</j>}] 391 + set root [$doc documentElement] 392 + set result [list] 393 + lappend result [$root asJSON] 394 + lappend result [$root jsonType] 395 + $root jsonType ARRAY 396 + lappend result [$root asJSON] 397 + $doc delete 398 + set result 399 +} {{"foo"} NONE {["foo"]}} 400 + 401 +test json-7.2 {jsonType} { 402 + set doc [dom createDocumentNode] 403 + set result [$doc jsonType] 404 + lappend result [$doc asJSON] 405 + lappend result [catch {$doc jsonType foo}] 406 + $doc jsonType ARRAY 407 + lappend result [$doc asJSON] 408 + $doc jsonType OBJECT 409 + lappend result [$doc asJSON] 410 + $doc delete 411 + set result 412 +} {NONE {{}} 1 {[]} {{}}} 413 + 414 +test json-8.1 {appendFromScript} { 415 + set doc [dom createDocumentNode] 416 + $doc appendFromScript { 417 + nodeCmds::e1 418 + } 419 + set result [list] 420 + lappend result [$doc asJSON] 421 + set root [$doc documentElement] 422 + lappend result [$root asJSON] 423 + $doc removeChild [$doc firstChild] 424 + $doc appendFromScript { 425 + nodeCmds::jae1 426 + } 427 + lappend result [$doc asJSON] 428 + set root [$doc documentElement] 429 + lappend result [$root asJSON] 430 + lappend result [$root jsonType] 431 + $doc delete 432 + set result 433 +} {{{"e1":""}} {{}} {{"jae1":[]}} {[]} ARRAY} 434 + 435 +test json-8.2 {appendFromScript} { 436 + set doc [dom createDocumentNode] 437 + $doc appendFromScript { 438 + nodeCmds::t "some string" 439 + } 440 + set result [$doc asJSON] 441 + $doc delete 442 + set result 443 +} {"some string"} 444 + 445 +test json-8.3 {appendFromScript} { 446 + set doc [dom createDocumentNode] 447 + $doc appendFromScript { 448 + nodeCmds::t "" 449 + nodeCmds::true "" 450 + nodeCmds::false "" 451 + nodeCmds::null "" 452 + } 453 + set result [$doc asJSON] 454 + $doc delete 455 + set result 456 +} {["",true,false,null]} 457 + 458 +test json-8.4 {appendFromScript - text node with type NUMBER} { 459 + set doc [dom createDocumentNode] 460 + $doc appendFromScript { 461 + nodeCmds::number "" 462 + nodeCmds::number "0" 463 + nodeCmds::number "123456789012345678901234567890.12345679e-0003" 464 + nodeCmds::number "42 " 465 + nodeCmds::number " 42" 466 + nodeCmds::number "-" 467 + } 468 + set result [$doc asJSON] 469 + $doc delete 470 + set result 471 +} {["",0,123456789012345678901234567890.12345679e-0003,"42 "," 42","-"]} 472 + 473 +test json-8.5 {createNodeCmd - wrong jsonType} { 474 + catch {dom createNodeCmd -jsonType OBJECT textNode textNodeWithJsonTypeObject} 475 +} 1
Changes to tests/domnamespace.test.
2 2 # 3 3 # This file contains a collection of tests for some namespace related 4 4 # actions. 5 5 # 6 6 # domnamespace-1.*: misc tests 7 7 # domnamespace-2.*: moving namespaced nodes from one document to another 8 8 # domnamespace-3.*: moving namespaced nodes within a document 9 +# domnamespace-4.*: createNodeCmd and namespaces 9 10 # 10 11 # Copyright (c) 2002 Rolf Ade. 11 12 # 12 13 # RCS: @(#) $Id$ 13 14 14 15 source [file join [file dir [info script]] loadtdom.tcl] 15 16 ................................................................................ 310 311 set newParent [$doc selectNodes {/doc/node()[2]}] 311 312 $newParent appendChild $nodeToMove 312 313 set result [$doc asXML -indent none] 313 314 $doc delete 314 315 set result 315 316 } {<doc><e xmlns="foo"/><e xmlns="bar"><ee xmlns="foo"/></e></doc>} 316 317 318 + 319 +namespace eval nodeCmds { 320 + dom createNodeCmd -namespace foo.bar elementNode ns1:e1 321 + dom createNodeCmd -namespace foo.bar elementNode e1 322 + dom createNodeCmd textNode t 323 + dom createNodeCmd -tagName e1 elementNode e1NoNS 324 +} 325 + 326 +test domnamespace-4.1 {createNodeCmd and namespace} { 327 + dom createDocument doc doc 328 + $doc documentElement root 329 + $root appendFromScript { 330 + nodeCmds::ns1:e1 {nodeCmds::t "this"} 331 + } 332 + set result [$doc asXML -indent none] 333 + $doc delete 334 + set result 335 +} {<doc><ns1:e1 xmlns:ns1="foo.bar">this</ns1:e1></doc>} 336 + 337 +test domnamespace-4.2 {createNodeCmd and namespace} { 338 + dom createDocumentNS foo.bar ns1:doc doc 339 + $doc documentElement root 340 + $root appendFromScript { 341 + nodeCmds::ns1:e1 {nodeCmds::t "this"} 342 + } 343 + set result [$doc asXML -indent none] 344 + $doc delete 345 + set result 346 +} {<ns1:doc xmlns:ns1="foo.bar"><ns1:e1>this</ns1:e1></ns1:doc>} 347 + 348 +test domnamespace-4.3 {createNodeCmd and namespace} { 349 + dom createDocumentNS foo.bar doc doc 350 + $doc documentElement root 351 + $root appendFromScript { 352 + nodeCmds::ns1:e1 {nodeCmds::t "this"} 353 + } 354 + set result [$doc asXML -indent none] 355 + $doc delete 356 + set result 357 +} {<doc xmlns="foo.bar"><ns1:e1 xmlns:ns1="foo.bar">this</ns1:e1></doc>} 358 + 359 +test domnamespace-4.4 {createNodeCmd and namespace} { 360 + dom createDocumentNS foo.bar doc doc 361 + $doc documentElement root 362 + $root appendFromScript { 363 + nodeCmds::e1 { 364 + nodeCmds::e1NoNS att attValue {nodeCmds::t "this"} 365 + } 366 + } 367 + set result [$doc asXML -indent none] 368 + $doc delete 369 + set result 370 +} {<doc xmlns="foo.bar"><e1><e1 xmlns="" att="attValue">this</e1></e1></doc>} 371 + 372 +test domnamespace-4.5 {createNodeCmd and namespace} { 373 + dom createDocumentNS foo.bar doc doc 374 + $doc documentElement root 375 + $root appendFromScript { 376 + nodeCmds::e1 { 377 + nodeCmds::e1NoNS att attValue {nodeCmds::t "this"} 378 + } 379 + } 380 + set result [$doc selectNodes -namespaces {fb foo.bar} string(/fb:doc/fb:e1/e1/@att)] 381 + $doc delete 382 + set result 383 +} {attValue} 384 + 385 + 317 386 # cleanup 318 387 ::tcltest::cleanupTests 319 388 return
Deleted tests/jsonreader.test.
1 -# Features covered: JSON parser 2 -# 3 -# This file contains a collection of tests for the JSON parser. 4 -# Tested functionalities: 5 -# json-1.*: JSON syntax tests 6 -# json-2.*: Valid JSON, that could not parsed into DOM 7 -# json-3.*: JSON unescaping 8 -# json-4.*: Unicode 9 -# json-5.*: Max nesting 10 -# json-6.*: asJSON 11 -# json-7.*: jsonType 12 -# json-7.*: appendFromScript 13 -# Copyright (c) 2017 Rolf Ade. 14 - 15 -source [file join [file dir [info script]] loadtdom.tcl] 16 - 17 - 18 -namespace eval nodeCmds { 19 - dom createNodeCmd elementNode e1 20 - dom createNodeCmd -jsonType ARRAY elementNode jae1 21 - dom createNodeCmd elementNode e2 22 - dom createNodeCmd commentNode c 23 - dom createNodeCmd textNode t 24 - dom createNodeCmd -jsonType TRUE textNode true 25 - dom createNodeCmd -jsonType FALSE textNode false 26 - dom createNodeCmd -jsonType NULL textNode null 27 - dom createNodeCmd -jsonType NUMBER textNode number 28 - dom createNodeCmd cdataNode cdata 29 - dom createNodeCmd piNode pi 30 -} 31 - 32 -test json-1.1 {Parse JSON} { 33 - set doc [dom parse -json {{"a":"avalue","b":"bvalue","c":0.123}}] 34 - set result [$doc asXML -indent none] 35 - $doc delete 36 - set result 37 -} "<a>avalue</a><b>bvalue</b><c>0.123</c>" 38 - 39 -test json-1.2 {Parse JSON} { 40 - set doc [dom parse -json { {"a" : [ "avalue" ] } }] 41 - set result [$doc asXML -indent none] 42 - $doc delete 43 - set result 44 -} {<a>avalue</a>} 45 - 46 -test json-1.3 {Parse JSON} { 47 - set doc [dom parse -json {{"a":"a value","b":"1value"}}] 48 - set result [$doc asXML -indent none] 49 - $doc delete 50 - set result 51 -} "<a>a value</a><b>1value</b>" 52 - 53 -test json-1.4 {Parse JSON - nested object} { 54 - set doc [dom parse -json {{"a":{"aa":"aavalue","bb":"bbvalue"},"b":"bvalue","c":0.123}}] 55 - set result [$doc asXML -indent none] 56 - $doc delete 57 - set result 58 -} "<a><aa>aavalue</aa><bb>bbvalue</bb></a><b>bvalue</b><c>0.123</c>" 59 - 60 -test json-1.5 {Parse JSON - array} { 61 - set doc [dom parse -json {{"a": [1,2,3,4,"abc"]}}] 62 - set result [$doc asXML -indent none] 63 - $doc delete 64 - set result 65 -} "<a>1234abc</a>" 66 - 67 -test json-1.6 {Parse JSON - true, false, null} { 68 - set doc [dom parse -json {{"a":true,"b":false,"c":null,"d":"true","e":""}}] 69 - set result [$doc asXML -indent none] 70 - $doc delete 71 - set result 72 -} {<a>true</a><b>false</b><c>null</c><d>true</d><e></e>} 73 - 74 -test json-1.7 {Parse JSON - array in nested object} { 75 - set doc [dom parse -json {{"a":{"aa":[1,2,3,4,"abc"]},"b":"bvalue"}}] 76 - set result [$doc asXML -indent none] 77 - $doc delete 78 - set result 79 -} "<a><aa>1234abc</aa></a><b>bvalue</b>" 80 - 81 -test json-1.8 {Parse JSON - true, false, null} { 82 - set doc [dom parse -json -jsonroot "JSONObject" {{"a":true,"b":false,"c":null,"d":"true","e":""}}] 83 - set result [$doc asXML -indent none] 84 - $doc delete 85 - set result 86 -} {<JSONObject><a>true</a><b>false</b><c>null</c><d>true</d><e></e></JSONObject>} 87 - 88 -test json-1.9 {JSON syntax error} { 89 - set result [catch {dom parse -json {{"a" "a value"}}} errMsg] 90 - list $result $errMsg 91 -} {1 {error "JSON syntax error" at position 5 92 -"{"a" " <--Error-- a value"}"}} 93 - 94 -test json-1.10 {JSON syntax error} { 95 - set result [catch {dom parse -json {{"a":00.23}}} errMsg] 96 - list $result $errMsg 97 -} {1 {error "JSON syntax error" at position 6 98 -"{"a":00 <--Error-- .23}"}} 99 - 100 -test json-1.11 {JSON syntax error} { 101 - set result [catch {dom parse -json {{"a":-00.23}}} errMsg] 102 - list $result $errMsg 103 -} {1 {error "JSON syntax error" at position 7 104 -"{"a":-00 <--Error-- .23}"}} 105 - 106 -test json-1.12 {JSON syntax error} { 107 - set result [catch {dom parse -json {{"a":.23}}} errMsg] 108 - list $result $errMsg 109 -} {1 {error "JSON syntax error" at position 5 110 -"{"a":. <--Error-- 23}"}} 111 - 112 -test json-1.13 {JSON syntax error} { 113 - set result [catch {dom parse -json {{"a":-.23}}} errMsg] 114 - list $result $errMsg 115 -} {1 {error "JSON syntax error" at position 6 116 -"{"a":-. <--Error-- 23}"}} 117 - 118 -test json-1.14 {JSON syntax error} { 119 - set result [catch {dom parse -json {{"a":-}}} errMsg] 120 - list $result $errMsg 121 -} {1 {error "JSON syntax error" at position 5 122 -"{"a":- <--Error-- }"}} 123 - 124 -test json-1.15 {Parse JSON - nested object} { 125 - set doc [dom parse -json {["a",["aa","bb"],"b"]}] 126 - set result [$doc asXML -indent none] 127 - $doc delete 128 - set result 129 -} "a<arraycontainer>aabb</arraycontainer>b" 130 - 131 -set notJsons { 132 - {{null}} 133 - {{1.23}} 134 - {{"string"}} 135 - {{"e":}} 136 -} 137 -test json-1.16 {Invalid input} { 138 - set result "" 139 - set ind 0 140 - foreach notJson $notJsons { 141 - if {![catch {dom parse -json $notJson docNode} errMsg]} { 142 - lappend result $errMsg 143 - } 144 - } 145 - set result 146 -} "" 147 - 148 -test json-1.17 {Literal binary 0 (NUL, '\0') is not allowed in input} { 149 - catch {dom parse -json "\"a\u0000\""} 150 -} 1 151 - 152 -test json-1.18 {Escaped binary 0 (NUL, '\0') is OK} { 153 - dom parse -json "\"a\\u0000\"" doc 154 - set result [$doc asJSON] 155 - $doc delete 156 - set result 157 -} "\"a\\u0000\"" 158 - 159 -test json-1.19 {Invalid input - uncompled \u escape} { 160 - catch {dom parse -json {"ab\u00"}} 161 -} 1 162 - 163 -test json-1.20 {Escaped binary 0} { 164 - dom parse -json "\"a\\u0000\"" doc 165 - set textvalue [$doc selectNodes string(node())] 166 - set result [string length $textvalue] 167 - binary scan $textvalue c2 result2 168 - lappend result {*}$result2 169 - $doc delete 170 - set result 171 -} {2 97 0} 172 - 173 -test json-2.1 {invalid xml name} { 174 - set doc [dom parse -json {{"a":"a value","1b":"1value", "a\nb":"a\nb", "":"empty string"}}] 175 - set result [$doc asXML -indent none] 176 - $doc delete 177 - set result 178 -} {<a>a value</a><1b>1value</1b><a 179 -b>a 180 -b</a 181 -b><>empty string</>} 182 - 183 -test json-3.1 {Unescaping} { 184 - set doc [dom parse -json {{"a":"a\nvalue","b":"value\tvalue"}}] 185 - set result [$doc asXML -indent none] 186 - $doc delete 187 - set result 188 -} "<a>a 189 -value</a><b>value\tvalue</b>" 190 - 191 -test json-3.2 {Unescaping} { 192 - set doc [dom parse -json {{"a":"a\nvalue", "b":"12\u0077\u2221ec"}}] 193 - set result [$doc asXML -indent none -escapeNonASCII] 194 - $doc delete 195 - set result 196 -} "<a>a 197 -value</a><b>12w∡ec</b>" 198 - 199 -test json-3.3 {Unescaping} { 200 - set doc [dom parse -json {{"a":"\u0077\u2221"}}] 201 - set result [$doc asXML -indent none -escapeNonASCII] 202 - $doc delete 203 - set result 204 -} "<a>w∡</a>" 205 - 206 -test json-3.4 {unescaping} { 207 - set doc [dom parse -jsonroot json -json {["\\a"]}] 208 - set result [$doc asXML -indent none] 209 - $doc delete 210 - set result 211 -} {<json>\a</json>} 212 - 213 -test json-3.4.1 {unescaping} { 214 - set doc [dom parse -jsonroot json -json {["\\a","\u0071"]}] 215 - set result [$doc asXML -indent none] 216 - $doc delete 217 - set result 218 -} {<json>\aq</json>} 219 - 220 -test json-3.5 {unescaping} { 221 - set result [catch {dom parse -json {{"this":"a\lb"}}} errMsg] 222 - list $result $errMsg 223 -} {1 {error "JSON syntax error" at position 11 224 -"{"this":"a\l <--Error-- b"}"}} 225 - 226 -test json-3.6 {unescaping} { 227 - set doc [dom parse -json {{"this":"a\nbc"}}] 228 - set result [$doc asXML -indent none] 229 - $doc delete 230 - set result 231 -} {<this>a 232 -bc</this>} 233 - 234 -test json-3.7 {unescaping} { 235 - set doc [dom parse -json {{"this":"a\u0077\t\u0078bc"}}] 236 - set result [$doc asXML -indent none] 237 - $doc delete 238 - set result 239 -} "<this>aw\txbc</this>" 240 - 241 -test json-3.8 {unescaping} { 242 - set doc [dom parse -json {{"this":"a\u000b"}}] 243 - set result [$doc asXML -indent none] 244 - $doc delete 245 - set result 246 -} "<this>a\u000b</this>" 247 - 248 -test json-3.9 {unescaping} { 249 - set doc [dom parse -json {{"this":"a\u0077","that":"\t\u0078bc"}}] 250 - set result [$doc asXML -indent none] 251 - $doc delete 252 - set result 253 -} "<this>aw</this><that>\txbc</that>" 254 - 255 -test json-5.1 {-jsonmaxnesting 0} { 256 - set result [catch {dom parse -json -jsonmaxnesting 0 {{"this":"that"}}} errMsg] 257 - list $result $errMsg 258 -} {1 {error "Maximum JSON object/array nesting depth exceeded" at position 0 259 -"{ <--Error-- "this":"that"}"}} 260 - 261 -test json-5.2 {-jsonmaxnesting 0} { 262 - set result [catch {dom parse -json -jsonmaxnesting 0 {["this","that"]}} errMsg] 263 - list $result $errMsg 264 -} {1 {error "Maximum JSON object/array nesting depth exceeded" at position 0 265 -"[ <--Error-- "this","that"]"}} 266 - 267 -test json-5.3 {-jsonmaxnesting 0} { 268 - set result [catch {dom parse -jsonroot o -json -jsonmaxnesting 0 {["this","that"]}} errMsg] 269 - list $result $errMsg 270 -} {1 {error "Maximum JSON object/array nesting depth exceeded" at position 0 271 -"[ <--Error-- "this","that"]"}} 272 - 273 -test json-5.4 {-jsonmaxnesting} { 274 - set doc [dom parse -json -jsonmaxnesting 2 {{"this":{"foo":"that"}}}] 275 - set result [$doc asXML -indent none] 276 - $doc delete 277 - set result 278 -} {<this><foo>that</foo></this>} 279 - 280 -test json-5.5 {-jsonmaxnesting} { 281 - set result [catch {dom parse -json -jsonmaxnesting 1 \ 282 - {{"this":{"foo":"that"}}}} errMsg] 283 - list $result $errMsg 284 -} {1 {error "Maximum JSON object/array nesting depth exceeded" at position 8 285 -"{"this":{ <--Error-- "foo":"that"}}"}} 286 - 287 -test json-5.6 {-jsonmaxnesting} { 288 - set doc [dom parse -json -jsonmaxnesting 2 { 289 - { 290 - "this": { 291 - "foo":"that", 292 - "bar":"grill" 293 - }, 294 - "two": "value", 295 - "three": { 296 - "t1":"t1value", 297 - "t2":"t2value" 298 - }, 299 - "four": ["a","b","c"] 300 - }}] 301 - set result [$doc asXML] 302 - $doc delete 303 - set result 304 -} {<this> 305 - <foo>that</foo> 306 - <bar>grill</bar> 307 -</this> 308 -<two>value</two> 309 -<three> 310 - <t1>t1value</t1> 311 - <t2>t2value</t2> 312 -</three> 313 -<four>abc</four> 314 -} 315 - 316 -set jsons { 317 - {{"a":"avalue","b":"bvalue","c":0.123}} 318 - {{"a":["avalue"]}} 319 - {{"a":"a value","b":"1value"}} 320 - {{"a":{"aa":"aavalue","bb":"bbvalue"},"b":"bvalue","c":0.123}} 321 - {{"a":[1,2,3,4,"abc"]}} 322 - {{"a":true,"b":false,"c":null,"d":"true","e":""}} 323 - {{"a":{"aa":[1,2,3,4,"abc"]},"b":"bvalue"}} 324 - {{"a":true,"b":false,"c":null,"d":"true","e":""}} 325 - {["a",["aa","bb"],"b"]} 326 - {{"a":"a\nvalue","b":"value\tvalue"}} 327 - {["\\\\a"]} 328 - {["a\"b"]} 329 - {{"b":"a \"b c\" d","b":"a \"b c\" d"}} 330 - {{"this":"a\nbc"}} 331 - {{"this":{"foo":"that"}}} 332 - {{"this":{"foo":"that","bar":"grill"},"two":"value","three":{"t1":"t1value","t2":"t2value"},"four":["a","b","c"]}} 333 - {"only a string"} 334 - {null} 335 - {1.23} 336 - {true} 337 - {false} 338 - {{}} 339 - {[]} 340 - {[[]]} 341 - {[["x"]]} 342 - {""} 343 - {[[[[["a"]]]]]} 344 - {{"x":[{"id":"foo"}]}} 345 - {"http://foo.bar"} 346 -} 347 -test json-6.1 {asJSON} { 348 - set failedlist [list] 349 - set ind 0 350 - foreach json $jsons { 351 - set doc [dom parse -json $json] 352 - set out [$doc asJSON] 353 - if {$json ne $out} { 354 - lappend failedlist "$ind : '$json' : '$out'" 355 - } 356 - incr ind 357 - } 358 - set failedlist 359 -} {} 360 - 361 -test json-6.2 {asJSON - slash will not be escaped while serializing} { 362 - set doc [dom parse -json {"http:\/\/foo.bar"}] 363 - set result [$doc asJSON] 364 - $doc delete 365 - set result 366 -} {"http://foo.bar"} 367 - 368 -test json-6.3 {asJSON - docNode serialization} { 369 - dom createDocumentNode docNode 370 - set result [$docNode asJSON] 371 - $docNode delete 372 - set result 373 -} {{}} 374 - 375 -test json-6.4 {asJSON - doc serialization} { 376 - dom createDocument root docNode 377 - set result [$docNode asJSON] 378 - $docNode delete 379 - set result 380 -} {{"root":""}} 381 - 382 -test json-6.5 {asJSON - serialization of control characters} { 383 - set doc [dom parse -json "\"a\\u0000\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\u0008\\u0009\\u000A\\u000B\\u000C\\u000D\\u000E\\u000F\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018\\u0019\\u001A\\u001B\\u001C\\u001D\\u001E\\u001F\\u0020b\""] 384 - set result [$doc asJSON] 385 - $doc delete 386 - set result 387 -} {"a\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f b"} 388 - 389 -test json-7.1 {jsonType} { 390 - set doc [dom parse {<j>foo</j>}] 391 - set root [$doc documentElement] 392 - set result [list] 393 - lappend result [$root asJSON] 394 - lappend result [$root jsonType] 395 - $root jsonType ARRAY 396 - lappend result [$root asJSON] 397 - $doc delete 398 - set result 399 -} {{"foo"} NONE {["foo"]}} 400 - 401 -test json-7.2 {jsonType} { 402 - set doc [dom createDocumentNode] 403 - set result [$doc jsonType] 404 - lappend result [$doc asJSON] 405 - lappend result [catch {$doc jsonType foo}] 406 - $doc jsonType ARRAY 407 - lappend result [$doc asJSON] 408 - $doc jsonType OBJECT 409 - lappend result [$doc asJSON] 410 - $doc delete 411 - set result 412 -} {NONE {{}} 1 {[]} {{}}} 413 - 414 -test json-8.1 {appendFromScript} { 415 - set doc [dom createDocumentNode] 416 - $doc appendFromScript { 417 - nodeCmds::e1 418 - } 419 - set result [list] 420 - lappend result [$doc asJSON] 421 - set root [$doc documentElement] 422 - lappend result [$root asJSON] 423 - $doc removeChild [$doc firstChild] 424 - $doc appendFromScript { 425 - nodeCmds::jae1 426 - } 427 - lappend result [$doc asJSON] 428 - set root [$doc documentElement] 429 - lappend result [$root asJSON] 430 - lappend result [$root jsonType] 431 - $doc delete 432 - set result 433 -} {{{"e1":""}} {{}} {{"jae1":[]}} {[]} ARRAY} 434 - 435 -test json-8.2 {appendFromScript} { 436 - set doc [dom createDocumentNode] 437 - $doc appendFromScript { 438 - nodeCmds::t "some string" 439 - } 440 - set result [$doc asJSON] 441 - $doc delete 442 - set result 443 -} {"some string"} 444 - 445 -test json-8.3 {appendFromScript} { 446 - set doc [dom createDocumentNode] 447 - $doc appendFromScript { 448 - nodeCmds::t "" 449 - nodeCmds::true "" 450 - nodeCmds::false "" 451 - nodeCmds::null "" 452 - } 453 - set result [$doc asJSON] 454 - $doc delete 455 - set result 456 -} {["",true,false,null]} 457 - 458 -test json-8.4 {appendFromScript - text node with type NUMBER} { 459 - set doc [dom createDocumentNode] 460 - $doc appendFromScript { 461 - nodeCmds::number "" 462 - nodeCmds::number "0" 463 - nodeCmds::number "123456789012345678901234567890.12345679e-0003" 464 - nodeCmds::number "42 " 465 - nodeCmds::number " 42" 466 - nodeCmds::number "-" 467 - } 468 - set result [$doc asJSON] 469 - $doc delete 470 - set result 471 -} {["",0,123456789012345678901234567890.12345679e-0003,"42 "," 42","-"]}
Changes to tests/loadtdom.tcl.
4 4 # the tcltest package and the lastest tdom build is present. 5 5 # 6 6 # RCS: @(#) $Id$ 7 7 # 8 8 9 9 package require tcltest 10 10 namespace import ::tcltest::* 11 -package require -exact tdom 0.8.3 11 +package require -exact tdom 0.9.0 12 12 if {[lsearch [namespace children] ::tDOM] == -1} { 13 13 # tcldomsh without the script library. Source the lib. 14 14 source [file join [file dir [info script]] ../lib tdom.tcl] 15 15 } 16 16
Changes to tests/xpath.test.
544 544 545 545 test xpath-5.1 {erroneous XPath expr: missing right brace in predicate} { 546 546 set result [catch {$root selectNodes {*[1}} errMsg] 547 547 list $result $errMsg 548 548 } {1 {Predicate: Expected "RBRACKET" for '*[1' 549 549 550 550 Parsed symbols: 551 - 0 WCARDNAME 0 0.000e+00 0 * 552 - 1 LBRACKET 0 0.000e+00 1 553 - 2 INTNUMBER 1 1.000e+00 2 }} 551 + 0 WCARDNAME 0 00000.000 0 * 552 + 1 LBRACKET 0 00000.000 1 553 + 2 INTNUMBER 1 00001.000 2 }} 554 554 555 555 test xpath-5.2 {erroneous XPath expr: missing right brace in predicate} { 556 556 set result [catch {$root selectNodes {*[1][@attr}} errMsg] 557 557 list $result $errMsg 558 558 } {1 {Predicate: Expected "RBRACKET" for '*[1][@attr' 559 559 560 560 Parsed symbols: 561 - 0 WCARDNAME 0 0.000e+00 0 * 562 - 1 LBRACKET 0 0.000e+00 1 563 - 2 INTNUMBER 1 1.000e+00 2 564 - 3 RBRACKET 0 0.000e+00 3 565 - 4 LBRACKET 0 0.000e+00 4 566 - 5 ATTRIBUTE 0 0.000e+00 9 attr}} 561 + 0 WCARDNAME 0 00000.000 0 * 562 + 1 LBRACKET 0 00000.000 1 563 + 2 INTNUMBER 1 00001.000 2 564 + 3 RBRACKET 0 00000.000 3 565 + 4 LBRACKET 0 00000.000 4 566 + 5 ATTRIBUTE 0 00000.000 9 attr}} 567 567 568 568 test xpath-5.3 {erroneous XPath expr: missing left brace in predicate} { 569 569 catch {$root selectNodes {*1]}} 570 570 } {1} 571 571 572 572 test xpath-5.4 {erroneous XPath expr} { 573 573 catch {$root selectNodes {myNS: bar}} errMsg ................................................................................ 1070 1070 set result [catch {$doc selectNodes {a[b %nodeName='another value']}} errMsg] 1071 1071 lappend result $errMsg 1072 1072 $doc delete 1073 1073 set result 1074 1074 } {1 {Predicate: Expected "RBRACKET" for 'a[b %nodeName='another value']' 1075 1075 1076 1076 Parsed symbols: 1077 - 0 WCARDNAME 0 0.000e+00 0 a 1078 - 1 LBRACKET 0 0.000e+00 1 1079 - 2 WCARDNAME 0 0.000e+00 2 b 1080 ---> 3 WCARDNAME 1 0.000e+00 12 with spaces 1081 - 4 EQUAL 0 0.000e+00 13 1082 - 5 LITERAL 0 0.000e+00 28 another value 1083 - 6 RBRACKET 0 0.000e+00 29 }} 1077 + 0 WCARDNAME 0 00000.000 0 a 1078 + 1 LBRACKET 0 00000.000 1 1079 + 2 WCARDNAME 0 00000.000 2 b 1080 +--> 3 WCARDNAME 1 00000.000 12 with spaces 1081 + 4 EQUAL 0 00000.000 13 1082 + 5 LITERAL 0 00000.000 28 another value 1083 + 6 RBRACKET 0 00000.000 29 }} 1084 1084 1085 1085 test xpath-5.47 {Element name injected with tcl variable} { 1086 1086 set doc [dom parse -json {{"a":{"":"the value"},"a":{"":"another value"}}}] 1087 1087 set nodeName "" 1088 1088 set node [$doc selectNodes {a[%nodeName='another value']}] 1089 1089 set result [list] 1090 1090 lappend result [$node nodeName]
Changes to tests/xslt.test.
1149 1149 catch {$xmldoc xslt $xsltdoc resultDoc} errMsg 1150 1150 $xmldoc delete 1151 1151 $xsltdoc delete 1152 1152 set errMsg 1153 1153 } {The 'current' function is not allowed in Pattern. for '*[current() != 'notthis']' 1154 1154 1155 1155 Parsed symbols: 1156 - 0 WCARDNAME 0 0.000e+00 0 * 1157 - 1 LBRACKET 0 0.000e+00 1 1158 - 2 FUNCTION 0 0.000e+00 8 current 1159 - 3 LPAR 0 0.000e+00 9 1160 - 4 RPAR 0 0.000e+00 10 1161 - 5 NOTEQ 0 0.000e+00 13 1162 - 6 LITERAL 0 0.000e+00 23 notthis 1163 - 7 RBRACKET 0 0.000e+00 24 } 1156 + 0 WCARDNAME 0 00000.000 0 * 1157 + 1 LBRACKET 0 00000.000 1 1158 + 2 FUNCTION 0 00000.000 8 current 1159 + 3 LPAR 0 00000.000 9 1160 + 4 RPAR 0 00000.000 10 1161 + 5 NOTEQ 0 00000.000 13 1162 + 6 LITERAL 0 00000.000 23 notthis 1163 + 7 RBRACKET 0 00000.000 24 } 1164 1164 1165 1165 set xslt-8.2.xml {<?xml version="1.0"?> 1166 1166 <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40"> 1167 1167 <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"> 1168 1168 </DocumentProperties> 1169 1169 <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"> 1170 1170 </OfficeDocumentSettings>
Added win/README.
1 +This file contains instructions for building tdom on Windows platforms. 2 + 3 +Windows builds may be done with either the MingW-W64 tool chain 4 +comprising of gcc and friends, or with the Microsoft Visual C++ and 5 +nmake tools. Each is described below. 6 + 7 +IMPORTANT NOTE: 8 +Building with either tool chain requires that the Tcl libraries that 9 +are linked have also been built with the same tool chain. The resulting 10 +binaries however can be loaded into a Tcl shell compiled with any 11 +tool chain provided the requisite C runtimes are present on the system. 12 + 13 +Building With The Mingw-W64 Tool Chain 14 +====================================== 15 + 16 +Building with the MingW follows a similar process to the autoconf/TEA 17 +based Unix builds. 18 + 19 +1. Start a shell using mingw32.exe or mingw64.exe for 32- and 64-bit 20 +fields respectively. Do NOT use msys2.exe directly. 21 + 22 +2. Assuming you want to include HTML5 support using the Gumbo libraries, 23 +build the Gumbo libraries by running these commands in the top level 24 +directory where you extracted the Gumbo distribution. Note these 25 +shell commands must be run in the mingw32.exe or mingw64.exe shells 26 +as appropriate. 27 + 28 + ./autogen.sh 29 + ./configure 30 + make 31 + make install 32 + 33 +This will install the Gumbo libraries in the mingw32/mingw64 system 34 +directories as appropriate. 35 + 36 +3. Change to a build directory and run the configure at the top level 37 +tdom directory. For example, if doing a 64-bit build in the win/build64 38 +directory within a mingw64.exe shell, 39 + 40 + mkdir win/build 41 + cd win/build 42 + ../../configure --enable-threads --enable-html5 --enable-64bit --prefix=/c/tcl/mingw/85/x64 --with-tcl=/c/tcl/mingw/85/x64/lib 43 + make 44 + make install 45 + 46 +In the above sequence, we are building against Tcl 8.5 installed under 47 +c:\tcl\mingw\85\x64 on the system. The Gumbo libraries built in the 48 +previous step are automatically picked up from the mingw64.exe directories. 49 +Note that tdom on Windows binds against the static Gumbo library so 50 +there is no additional DLL to distribute. 51 + 52 +The 32-bit build is similar except omitting the --enable-64bit option 53 +(and of course pointing configure to a 32-bit installation of Tcl. 54 + 55 +4. Build the tnc and tdomhtml extensions in similar fashion to the above 56 +except that the --enable-html5 option should be left out in both cases, 57 +and an additional option --with-tdom=path/to/tdom/build needs to be 58 +specified for the tnc configure step. 59 + 60 +IMPORTANT NOTE: 61 +Because the MinGW-built binaries link to the msvcrt 6.0 runtimes that 62 +is present on all Windows systems, the built tdom is usable on all 63 +Windows systems with a Tcl built with any tool chain without needing 64 +additional runtime libraries to be installed. 65 + 66 + 67 + 68 + 69 +Building with Visual Studio 2017 Community Edition (free) 70 +========================================================= 71 + 72 +1. Build the Gumbo libraries if HTML5 support is desired. 73 + 74 +1a. Check out the git repository from 75 +https://github.com/apnadkarni/gumbo-parser. Do NOT use the original 76 +Gumbo repository as that does not contain a complete Visual Studio 77 +project file required for tdom. 78 + 79 +1b. Switch to the tdom-libs branch. 80 +Open the visualc/gumbo.sln solution file in Visual Studio. Click the 81 +Batch Build... item under the Build menu. In the dialog box, select 82 +the Win32|Release|x86 and x64|Release|x64 project configurations and 83 +then click the Build or Rebuild button. This will build the 32-bit 84 +and 64-bit gumbo.lib libraries under visualc/Win32/Release and 85 +visualc/x64/Release respectively. 86 + 87 +2. Next start a Visual Studio build command shell for 64-bit builds, 88 +usually from 89 + Windows Start menu->Visual Studio 2017 Folder->x64 Native Command shell 90 + 91 +3. Change to the tdom\win directory and type the command 92 + 93 + nmake /s /nologo /f makefile.vc INSTALLDIR=c:\tcl\85-vs2017\x64 GUMBODIR=C:\src\gumbo 94 + nmake /s /nologo /f makefile.vc INSTALLDIR=c:\tcl\85-vs2017\x64 GUMBODIR=C:\src\gumbo install 95 + 96 +Here INSTALLDIR is the path to your Tcl installation and GUMBODIR is 97 +the path to the top level of the Gumbo sources. If GUMBODIR is not 98 +specified, tdom will build without HTML5 support. 99 + 100 +The 32-bit builds are similar except that 101 + 102 +- the commands need to be run from the Visual Studio x86 Native Tools 103 +command shell, and 104 +- the INSTALLDIR needs to point to a 32-bit Tcl installation 105 +- (Note GUMBODIR need not change) 106 + 107 +4a. To build the tnc and tdomhtml extensions, 108 + 109 + cd extensions/tnc/win 110 + nmake /s /nologo /f makefile.vc INSTALLDIR=c:\tcl\85-vs2017\x64 111 + nmake /s /nologo /f makefile.vc INSTALLDIR=c:\tcl\85-vs2017\x64 install 112 + 113 + cd extensions/tdomhtml/win 114 + nmake /s /nologo /f makefile.vc INSTALLDIR=c:\tcl\85-vs2017\x64 install 115 + 116 +Note no build step necessary for tdomhtml as it is pure Tcl. 117 + 118 +Similar steps for 32-bit builds with appropriate changes. 119 + 120 +IMPORTANT NOTE: 121 +The Visual Studio 2017 runtimes are not guaranteed to be installed on 122 +all Windows systems. Thus the built tdom package should only be used 123 +with a Tcl that is also built with Visual Studio 2017. 124 + 125 + 126 + 127 +# Building with Visual C++ 6 (32-bit) or Windows 2003 SDK (for 64-bit) 128 +====================================================================== 129 + 130 +Steps similar to above except that HTML5 support is not available due 131 +to Gumbo needing C99 support. The GUMBODIR option should be left out 132 +on the nmake build commands. 133 + 134 +IMPORTANT NOTE: 135 +Because the VC++ 6 and 2003 SDK link to the msvcrt 6.0 runtimes that 136 +is present on all Windows systems, the built tdom is usable on all 137 +Windows systems with a Tcl built with any tool chain without needing 138 +additional runtime libraries to be installed. 139 + 140 + 141 +
Changes to win/makefile.vc.
157 157 # binary here. 158 158 # 159 159 #------------------------------------------------------------------------- 160 160 161 161 PROJECT = tdom 162 162 !include "rules.vc" 163 163 164 -DOTVERSION = 0.8.4 164 +DOTVERSION = 0.9.0 165 165 VERSION = $(DOTVERSION:.=) 166 166 STUBPREFIX = $(PROJECT)stub 167 167 168 168 DLLOBJS = \ 169 169 $(TMP_DIR)\xmlrole.obj \ 170 170 $(TMP_DIR)\xmltok.obj \ 171 171 $(TMP_DIR)\xmlparse.obj \ 172 172 $(TMP_DIR)\xmlsimple.obj \ 173 173 $(TMP_DIR)\utf8conv.obj \ 174 174 $(TMP_DIR)\dom.obj \ 175 175 $(TMP_DIR)\domalloc.obj \ 176 176 $(TMP_DIR)\domhtml.obj \ 177 + $(TMP_DIR)\domhtml5.obj \ 177 178 $(TMP_DIR)\domxslt.obj \ 178 179 $(TMP_DIR)\nodecmd.obj \ 179 180 $(TMP_DIR)\domxpath.obj \ 180 181 $(TMP_DIR)\domlock.obj \ 181 182 $(TMP_DIR)\domjson.obj \ 182 183 $(TMP_DIR)\tclexpat.obj \ 183 184 $(TMP_DIR)\tcldom.obj \ ................................................................................ 217 218 GENERICDIR = $(ROOT)\generic 218 219 WINDIR = $(ROOT)\win 219 220 LIBDIR = $(ROOT)\lib 220 221 DOCDIR = $(ROOT)\doc 221 222 TOOLSDIR = $(ROOT)\tools 222 223 COMPATDIR = $(ROOT)\compat 223 224 EXPATDIR = $(ROOT)\expat 225 + 224 226 225 227 #--------------------------------------------------------------------- 226 228 # Compile flags 227 229 #--------------------------------------------------------------------- 228 230 229 231 !if !$(DEBUG) 230 232 !if $(OPTIMIZING) ................................................................................ 237 239 ### Warnings are too many, can't support warnings into errors. 238 240 cdebug = -Zi -Od $(DEBUGFLAGS) 239 241 !else 240 242 cdebug = -Zi -WX $(DEBUGFLAGS) 241 243 !endif 242 244 243 245 ### Declarations common to all compiler options 244 -cwarn = -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE 246 +cwarn = $(WARNINGS) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE 245 247 cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\ 246 248 247 -# Warning level 248 -!if $(FULLWARNINGS) 249 -cflags = $(cflags) -W4 250 -!else 251 -cflags = $(cflags) -W3 252 -!endif 249 +# TBD - some of the code, like expat checks for Windows using the 250 +# WIN32 macro. This should really be changed to check _WIN32. For now, 251 +# define WIN32 ourselves 252 +cflags = $(cflags) -DWIN32 253 253 254 254 !if $(MSVCRT) 255 255 !if $(DEBUG) && !$(UNCHECKED) 256 256 crt = -MDd 257 257 !else 258 258 crt = -MD 259 259 !endif ................................................................................ 268 268 !if !$(STATIC_BUILD) 269 269 cflags = $(cflags) -DUSE_TCL_STUBS 270 270 !if defined(TKSTUBLIB) 271 271 cflags = $(cflags) -DUSE_TK_STUBS 272 272 !endif 273 273 !endif 274 274 275 -DEFS =-DHAVE_MEMMOVE -DXML_DTD -DXML_NS -DTDOM_NO_UNKNOWN_CMD 275 +DEFS =-DHAVE_MEMMOVE=1 -DXML_DTD=1 -DXML_NS=1 -DTDOM_NO_UNKNOWN_CMD=1 276 276 DEFS_EXPAT =-DXMLIMPORT=__declspec(dllexport) 277 -INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(EXPATDIR)" $(TCL_INCLUDES) 277 +INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(EXPATDIR)" $(TCL_INCLUDES) 278 +!if "$(GUMBODIR)" != "" 279 +DEFS = $(DEFS) -DTDOM_HAVE_GUMBO=1 280 +INCLUDES = $(INCLUDES) -I"$(GUMBODIR)\src" 281 +!endif 278 282 BASE_CFLAGS = $(cflags) $(cdebug) $(crt) $(INCLUDES) 279 283 CON_CFLAGS = $(cflags) $(cdebug) $(crt) -DCONSOLE 280 284 TCL_CFLAGS = -DPACKAGE_NAME="\"$(PROJECT)\"" \ 281 285 -DPACKAGE_VERSION="\"$(DOTVERSION)\"" \ 282 286 $(BASE_CFLAGS) $(OPTDEFINES) $(DEFS) $(DEFS_EXPAT) 283 287 284 288 #--------------------------------------------------------------------- ................................................................................ 293 297 !else 294 298 ldebug = -release -opt:ref -opt:icf,3 295 299 !endif 296 300 297 301 ### Declarations common to all linker options 298 302 lflags = -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug) 299 303 300 -!if $(FULLWARNINGS) 301 -lflags = $(lflags) -warn:3 302 -!endif 303 - 304 304 !if $(PROFILE) 305 305 lflags = $(lflags) -profile 306 306 !endif 307 307 308 308 !if $(ALIGN98_HACK) && !$(STATIC_BUILD) 309 309 ### Align sections for PE size savings. 310 310 lflags = $(lflags) -opt:nowin98 ................................................................................ 322 322 guilflags = $(lflags) -subsystem:windows 323 323 !if !$(STATIC_BUILD) 324 324 baselibs = $(TCLSTUBLIB) 325 325 !if defined(TKSTUBLIB) 326 326 baselibs = $(baselibs) $(TKSTUBLIB) 327 327 !endif 328 328 !endif 329 + 330 +!if "$(GUMBODIR)" != "" 331 +!if "$(MACHINE)" == "AMD64" 332 +baselibs = $(baselibs) "$(GUMBODIR)\visualc\x64\Release\gumbo.lib" 333 +!else 334 +baselibs = $(baselibs) "$(GUMBODIR)\visualc\Win32\Release\gumbo.lib" 335 +!endif 336 +!endif 329 337 330 338 # Avoid 'unresolved external symbol __security_cookie' errors. 331 339 # c.f. http://support.microsoft.com/?id=894573 332 340 !if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64" 333 341 baselibs = $(baselibs) bufferoverflowU.lib 334 342 !endif 335 343 ................................................................................ 391 399 $** 392 400 << 393 401 $(_VC_MANIFEST_EMBED_DLL) 394 402 -@del $*.exp 395 403 !endif 396 404 397 405 $(PRJSTUBLIB): $(PRJSTUBOBJS) 398 - $(lib32) -nologo -out:$@ $(PRJSTUBOBJS) 406 + $(lib32) -ltcg -nologo -out:$@ $(PRJSTUBOBJS) 399 407 400 408 #--------------------------------------------------------------------- 401 409 # Implicit rules 402 410 #--------------------------------------------------------------------- 403 411 404 412 {$(WINDIR)}.c{$(TMP_DIR)}.obj:: 405 413 $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<< ................................................................................ 441 449 .SUFFIXES:.c .rc 442 450 443 451 #------------------------------------------------------------------------- 444 452 # Explicit dependency rules 445 453 # 446 454 #------------------------------------------------------------------------- 447 455 448 -$(OUT_DIR)\pkgIndex.tcl: $(ROOT)\pkgIndex.tcl.in 449 - nmakehlp -s << $** > $@ 450 -@PACKAGE_VERSION@ $(DOTVERSION) 451 -@PACKAGE_NAME@ $(PROJECT) 452 -@PKG_LIB_FILE@ $(PRJLIBNAME) 453 -<< 454 456 455 457 #--------------------------------------------------------------------- 456 458 # Installation. (EDIT) 457 459 # 458 460 # You may need to modify this section to reflect the final distribution 459 461 # of your files and possibly to generate documentation. 460 462 # ................................................................................ 467 469 @$(CPY) $(PRJSTUBLIB) "$(SCRIPT_INSTALL_DIR)" >NUL 468 470 469 471 install-libraries: 470 472 @echo Installing libraries to '$(SCRIPT_INSTALL_DIR)' 471 473 @if exist $(LIBDIR)\NUL $(CPY) $(LIBDIR)\*.tcl "$(SCRIPT_INSTALL_DIR)" >NUL 472 474 @echo Installing package index in '$(SCRIPT_INSTALL_DIR)' 473 475 @type << >"$(SCRIPT_INSTALL_DIR)\pkgIndex.tcl" 474 -if {[info exists ::tcl_platform(debug)]} { 475 - package ifneeded $(PROJECT) $(DOTVERSION) "[list load [file join $$dir $(PROJECT)$(VERSION)g.$(EXT)] tdom]; [list source [file join $$dir tdom.tcl]]" 476 -} else { 477 - package ifneeded $(PROJECT) $(DOTVERSION) "[list load [file join $$dir $(PROJECT)$(VERSION).$(EXT)] tdom]; [list source [file join $$dir tdom.tcl]]" 478 -} 476 + package ifneeded $(PROJECT) $(DOTVERSION) "[list load [file join $$dir $(PROJECT)$(VERSION)$(SUFX).$(EXT)] tdom]; [list source [file join $$dir tdom.tcl]]" 479 477 << 480 478 481 479 install-docs: 482 480 # @echo Installing documentation files to '$(DOC_INSTALL_DIR)' 483 481 # @if exist $(DOCDIR) $(CPY) $(DOCDIR)\*.n "$(DOC_INSTALL_DIR)" 484 482 485 483 #--------------------------------------------------------------------- 486 484 # Clean up 487 485 #--------------------------------------------------------------------- 488 486 489 487 clean: 490 488 @if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR) 491 - @if exist $(WINDIR)\version.vc del $(WINDIR)\version.vc 489 + @if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc 492 490 @if exist $(WINDIR)\vercl.i del $(WINDIR)\vercl.i 493 491 @if exist $(WINDIR)\vercl.x del $(WINDIR)\vercl.x 494 492 @if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch 495 493 496 494 realclean: clean 497 495 @if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR) 498 496 499 497 distclean: realclean 500 498 @if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe 501 499 @if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj
Changes to win/nmakehlp.c.
5 5 * This is used to fix limitations within nmake and the environment. 6 6 * 7 7 * Copyright (c) 2002 by David Gravereaux. 8 8 * Copyright (c) 2006 by Pat Thoyts 9 9 * 10 10 * See the file "license.terms" for information on usage and redistribution of 11 11 * this file, and for a DISCLAIMER OF ALL WARRANTIES. 12 - * 13 - * ---------------------------------------------------------------------------- 14 - * RCS: @(#) $Id$ 15 12 * ---------------------------------------------------------------------------- 16 13 */ 17 14 18 15 #define _CRT_SECURE_NO_DEPRECATE 19 16 #include <windows.h> 17 +#define NO_SHLWAPI_GDI 18 +#define NO_SHLWAPI_STREAM 19 +#define NO_SHLWAPI_REG 20 +#include <shlwapi.h> 20 21 #pragma comment (lib, "user32.lib") 21 22 #pragma comment (lib, "kernel32.lib") 23 +#pragma comment (lib, "shlwapi.lib") 22 24 #include <stdio.h> 23 25 #include <math.h> 26 + 27 +/* 28 + * This library is required for x64 builds with _some_ versions of MSVC 29 + */ 24 30 #if defined(_M_IA64) || defined(_M_AMD64) 31 +#if _MSC_VER >= 1400 && _MSC_VER < 1500 25 32 #pragma comment(lib, "bufferoverflowU") 33 +#endif 26 34 #endif 27 35 28 36 /* ISO hack for dumb VC++ */ 29 37 #ifdef _MSC_VER 30 38 #define snprintf _snprintf 31 39 #endif 32 40 33 41 34 42 35 43 /* protos */ 36 44 37 -int CheckForCompilerFeature(const char *option); 38 -int CheckForLinkerFeature(const char *option); 39 -int IsIn(const char *string, const char *substring); 40 -int GrepForDefine(const char *file, const char *string); 41 -int SubstituteFile(const char *substs, const char *filename); 42 -const char * GetVersionFromFile(const char *filename, const char *match); 43 -DWORD WINAPI ReadFromPipe(LPVOID args); 45 +static int CheckForCompilerFeature(const char *option); 46 +static int CheckForLinkerFeature(const char **options, int count); 47 +static int IsIn(const char *string, const char *substring); 48 +static int SubstituteFile(const char *substs, const char *filename); 49 +static int QualifyPath(const char *path); 50 +static const char *GetVersionFromFile(const char *filename, const char *match, int numdots); 51 +static DWORD WINAPI ReadFromPipe(LPVOID args); 44 52 45 53 /* globals */ 46 54 47 55 #define CHUNK 25 48 56 #define STATICBUFFERSIZE 1000 49 57 typedef struct { 50 58 HANDLE pipe; ................................................................................ 90 98 "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]); 91 99 WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, 92 100 &dwWritten, NULL); 93 101 return 2; 94 102 } 95 103 return CheckForCompilerFeature(argv[2]); 96 104 case 'l': 97 - if (argc != 3) { 105 + if (argc < 3) { 98 106 chars = snprintf(msg, sizeof(msg) - 1, 99 - "usage: %s -l <linker option>\n" 107 + "usage: %s -l <linker option> ?<mandatory option> ...?\n" 100 108 "Tests for whether link.exe supports an option\n" 101 109 "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]); 102 110 WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, 103 111 &dwWritten, NULL); 104 112 return 2; 105 113 } 106 - return CheckForLinkerFeature(argv[2]); 114 + return CheckForLinkerFeature(&argv[2], argc-2); 107 115 case 'f': 108 116 if (argc == 2) { 109 117 chars = snprintf(msg, sizeof(msg) - 1, 110 118 "usage: %s -f <string> <substring>\n" 111 119 "Find a substring within another\n" 112 120 "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]); 113 121 WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, ................................................................................ 118 126 * If the string is blank, there is no match. 119 127 */ 120 128 121 129 return 0; 122 130 } else { 123 131 return IsIn(argv[2], argv[3]); 124 132 } 125 - case 'g': 126 - if (argc == 2) { 127 - chars = snprintf(msg, sizeof(msg) - 1, 128 - "usage: %s -g <file> <string>\n" 129 - "grep for a #define\n" 130 - "exitcodes: integer of the found string (no decimals)\n", 131 - argv[0]); 132 - WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, 133 - &dwWritten, NULL); 134 - return 2; 135 - } 136 - return GrepForDefine(argv[2], argv[3]); 137 133 case 's': 138 134 if (argc == 2) { 139 135 chars = snprintf(msg, sizeof(msg) - 1, 140 136 "usage: %s -s <substitutions file> <file>\n" 141 137 "Perform a set of string map type substutitions on a file\n" 142 138 "exitcodes: 0\n", 143 139 argv[0]); ................................................................................ 153 149 "Extract a version from a file:\n" 154 150 "eg: pkgIndex.tcl \"package ifneeded http\"", 155 151 argv[0]); 156 152 WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, 157 153 &dwWritten, NULL); 158 154 return 0; 159 155 } 160 - printf("%s\n", GetVersionFromFile(argv[2], argv[3])); 156 + printf("%s\n", GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0')); 161 157 return 0; 158 + case 'Q': 159 + if (argc != 3) { 160 + chars = snprintf(msg, sizeof(msg) - 1, 161 + "usage: %s -Q path\n" 162 + "Emit the fully qualified path\n" 163 + "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]); 164 + WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, 165 + &dwWritten, NULL); 166 + return 2; 167 + } 168 + return QualifyPath(argv[2]); 162 169 } 163 170 } 164 171 chars = snprintf(msg, sizeof(msg) - 1, 165 - "usage: %s -c|-l|-f|-g|-V ...\n" 172 + "usage: %s -c|-f|-l|-Q|-s|-V ...\n" 166 173 "This is a little helper app to equalize shell differences between WinNT and\n" 167 174 "Win9x and get nmake.exe to accomplish its job.\n", 168 175 argv[0]); 169 176 WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL); 170 177 return 2; 171 178 } 172 179 173 -int 180 +static int 174 181 CheckForCompilerFeature( 175 182 const char *option) 176 183 { 177 184 STARTUPINFO si; 178 185 PROCESS_INFORMATION pi; 179 186 SECURITY_ATTRIBUTES sa; 180 187 DWORD threadID; ................................................................................ 251 258 DWORD err = GetLastError(); 252 259 int chars = snprintf(msg, sizeof(msg) - 1, 253 260 "Tried to launch: \"%s\", but got error [%u]: ", cmdline, err); 254 261 255 262 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS| 256 263 FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars], 257 264 (300-chars), 0); 258 - WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg,lstrlen(msg), &err,NULL); 265 + WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL); 259 266 return 2; 260 267 } 261 268 262 269 /* 263 270 * Close our references to the write handles that have now been inherited. 264 271 */ 265 272 ................................................................................ 295 302 * Look for the commandline warning code in both streams. 296 303 * - in MSVC 6 & 7 we get D4002, in MSVC 8 we get D9002. 297 304 */ 298 305 299 306 return !(strstr(Out.buffer, "D4002") != NULL 300 307 || strstr(Err.buffer, "D4002") != NULL 301 308 || strstr(Out.buffer, "D9002") != NULL 302 - || strstr(Err.buffer, "D9002") != NULL); 309 + || strstr(Err.buffer, "D9002") != NULL 310 + || strstr(Out.buffer, "D2021") != NULL 311 + || strstr(Err.buffer, "D2021") != NULL); 303 312 } 304 313 305 -int 314 +static int 306 315 CheckForLinkerFeature( 307 - const char *option) 316 + const char **options, 317 + int count) 308 318 { 309 319 STARTUPINFO si; 310 320 PROCESS_INFORMATION pi; 311 321 SECURITY_ATTRIBUTES sa; 312 322 DWORD threadID; 313 323 char msg[300]; 314 324 BOOL ok; 315 325 HANDLE hProcess, h, pipeThreads[2]; 316 - char cmdline[100]; 326 + int i; 327 + char cmdline[255]; 317 328 318 329 hProcess = GetCurrentProcess(); 319 330 320 331 ZeroMemory(&pi, sizeof(PROCESS_INFORMATION)); 321 332 ZeroMemory(&si, sizeof(STARTUPINFO)); 322 333 si.cb = sizeof(STARTUPINFO); 323 334 si.dwFlags = STARTF_USESTDHANDLES; ................................................................................ 355 366 356 367 lstrcpy(cmdline, "link.exe -nologo "); 357 368 358 369 /* 359 370 * Append our option for testing. 360 371 */ 361 372 362 - lstrcat(cmdline, option); 373 + for (i = 0; i < count; i++) { 374 + lstrcat(cmdline, " \""); 375 + lstrcat(cmdline, options[i]); 376 + lstrcat(cmdline, "\""); 377 + } 363 378 364 379 ok = CreateProcess( 365 380 NULL, /* Module name. */ 366 381 cmdline, /* Command line. */ 367 382 NULL, /* Process handle not inheritable. */ 368 383 NULL, /* Thread handle not inheritable. */ 369 384 TRUE, /* yes, inherit handles. */ ................................................................................ 377 392 DWORD err = GetLastError(); 378 393 int chars = snprintf(msg, sizeof(msg) - 1, 379 394 "Tried to launch: \"%s\", but got error [%u]: ", cmdline, err); 380 395 381 396 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS| 382 397 FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars], 383 398 (300-chars), 0); 384 - WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg,lstrlen(msg), &err,NULL); 399 + WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL); 385 400 return 2; 386 401 } 387 402 388 403 /* 389 404 * Close our references to the write handles that have now been inherited. 390 405 */ 391 406 ................................................................................ 420 435 /* 421 436 * Look for the commandline warning code in the stderr stream. 422 437 */ 423 438 424 439 return !(strstr(Out.buffer, "LNK1117") != NULL || 425 440 strstr(Err.buffer, "LNK1117") != NULL || 426 441 strstr(Out.buffer, "LNK4044") != NULL || 427 - strstr(Err.buffer, "LNK4044") != NULL); 442 + strstr(Err.buffer, "LNK4044") != NULL || 443 + strstr(Out.buffer, "LNK4224") != NULL || 444 + strstr(Err.buffer, "LNK4224") != NULL); 428 445 } 429 446 430 -DWORD WINAPI 447 +static DWORD WINAPI 431 448 ReadFromPipe( 432 449 LPVOID args) 433 450 { 434 451 pipeinfo *pi = (pipeinfo *) args; 435 452 char *lastBuf = pi->buffer; 436 453 DWORD dwRead; 437 454 BOOL ok; ................................................................................ 448 465 } 449 466 lastBuf += dwRead; 450 467 goto again; 451 468 452 469 return 0; /* makes the compiler happy */ 453 470 } 454 471 455 -int 472 +static int 456 473 IsIn( 457 474 const char *string, 458 475 const char *substring) 459 476 { 460 477 return (strstr(string, substring) != NULL); 461 478 } 462 - 463 -/* 464 - * Find a specified #define by name. 465 - * 466 - * If the line is '#define TCL_VERSION "8.5"', it returns 85 as the result. 467 - */ 468 - 469 -int 470 -GrepForDefine( 471 - const char *file, 472 - const char *string) 473 -{ 474 - char s1[51], s2[51], s3[51]; 475 - FILE *f = fopen(file, "rt"); 476 - 477 - if (f == NULL) { 478 - return 0; 479 - } 480 - 481 - do { 482 - int r = fscanf(f, "%50s", s1); 483 - 484 - if (r == 1 && !strcmp(s1, "#define")) { 485 - /* 486 - * Get next two words. 487 - */ 488 - 489 - r = fscanf(f, "%50s %50s", s2, s3); 490 - if (r != 2) { 491 - continue; 492 - } 493 - 494 - /* 495 - * Is the first word what we're looking for? 496 - */ 497 - 498 - if (!strcmp(s2, string)) { 499 - double d1; 500 - 501 - fclose(f); 502 - 503 - /* 504 - * Add 1 past first double quote char. "8.5" 505 - */ 506 - 507 - d1 = atof(s3 + 1); /* 8.5 */ 508 - while (floor(d1) != d1) { 509 - d1 *= 10.0; 510 - } 511 - return ((int) d1); /* 85 */ 512 - } 513 - } 514 - } while (!feof(f)); 515 - 516 - fclose(f); 517 - return 0; 518 -} 519 479 520 480 /* 521 481 * GetVersionFromFile -- 522 482 * Looks for a match string in a file and then returns the version 523 483 * following the match where a version is anything acceptable to 524 484 * package provide or package ifneeded. 525 485 */ 526 486 527 -const char * 487 +static const char * 528 488 GetVersionFromFile( 529 489 const char *filename, 530 - const char *match) 490 + const char *match, 491 + int numdots) 531 492 { 532 493 size_t cbBuffer = 100; 533 494 static char szBuffer[100]; 534 495 char *szResult = NULL; 535 496 FILE *fp = fopen(filename, "rt"); 536 497 537 498 if (fp != NULL) { ................................................................................ 541 502 542 503 while (fgets(szBuffer, cbBuffer, fp) != NULL) { 543 504 LPSTR p, q; 544 505 545 506 p = strstr(szBuffer, match); 546 507 if (p != NULL) { 547 508 /* 548 - * Skip to first digit. 509 + * Skip to first digit after the match. 549 510 */ 550 511 512 + p += strlen(match); 551 513 while (*p && !isdigit(*p)) { 552 514 ++p; 553 515 } 554 516 555 517 /* 556 518 * Find ending whitespace. 557 519 */ 558 520 559 521 q = p; 560 - while (*q && (isalnum(*q) || *q == '.')) { 522 + while (*q && (strchr("0123456789.ab", *q)) && ((!strchr(".ab", *q) 523 + && (!strchr("ab", q[-1])) || --numdots))) { 561 524 ++q; 562 525 } 563 526 564 527 memcpy(szBuffer, p, q - p); 565 528 szBuffer[q-p] = 0; 566 529 szResult = szBuffer; 567 530 break; ................................................................................ 626 589 * Usage is something like: 627 590 * nmakehlp -S << $** > $@ 628 591 * @PACKAGE_NAME@ $(PACKAGE_NAME) 629 592 * @PACKAGE_VERSION@ $(PACKAGE_VERSION) 630 593 * << 631 594 */ 632 595 633 -int 596 +static int 634 597 SubstituteFile( 635 598 const char *substitutions, 636 599 const char *filename) 637 600 { 638 601 size_t cbBuffer = 1024; 639 602 static char szBuffer[1024], szCopy[1024]; 640 603 char *szResult = NULL; ................................................................................ 647 610 /* 648 611 * Build a list of substutitions from the first filename 649 612 */ 650 613 651 614 sp = fopen(substitutions, "rt"); 652 615 if (sp != NULL) { 653 616 while (fgets(szBuffer, cbBuffer, sp) != NULL) { 654 - char *ks, *ke, *vs, *ve; 655 - ks = szBuffer; 617 + unsigned char *ks, *ke, *vs, *ve; 618 + ks = (unsigned char*)szBuffer; 656 619 while (ks && *ks && isspace(*ks)) ++ks; 657 620 ke = ks; 658 621 while (ke && *ke && !isspace(*ke)) ++ke; 659 622 vs = ke; 660 623 while (vs && *vs && isspace(*vs)) ++vs; 661 624 ve = vs; 662 625 while (ve && *ve && !(*ve == '\r' || *ve == '\n')) ++ve; 663 626 *ke = 0, *ve = 0; 664 - list_insert(&substPtr, ks, vs); 627 + list_insert(&substPtr, (char*)ks, (char*)vs); 665 628 } 666 629 fclose(sp); 667 630 } 668 631 669 632 /* debug: dump the list */ 670 633 #ifdef _DEBUG 671 634 { ................................................................................ 672 635 int n = 0; 673 636 list_item_t *p = NULL; 674 637 for (p = substPtr; p != NULL; p = p->nextPtr, ++n) { 675 638 fprintf(stderr, "% 3d '%s' => '%s'\n", n, p->key, p->value); 676 639 } 677 640 } 678 641 #endif 679 - 642 + 680 643 /* 681 644 * Run the substitutions over each line of the input 682 645 */ 683 - 646 + 684 647 while (fgets(szBuffer, cbBuffer, fp) != NULL) { 685 648 list_item_t *p = NULL; 686 649 for (p = substPtr; p != NULL; p = p->nextPtr) { 687 650 char *m = strstr(szBuffer, p->key); 688 651 if (m) { 689 652 char *cp, *op, *sp; 690 653 cp = szCopy; ................................................................................ 696 659 while (*op) *cp++ = *op++; 697 660 *cp = 0; 698 661 memcpy(szBuffer, szCopy, sizeof(szCopy)); 699 662 } 700 663 } 701 664 printf(szBuffer); 702 665 } 703 - 666 + 704 667 list_free(&substPtr); 705 668 } 706 669 fclose(fp); 707 670 return 0; 708 671 } 672 + 673 +/* 674 + * QualifyPath -- 675 + * 676 + * This composes the current working directory with a provided path 677 + * and returns the fully qualified and normalized path. 678 + * Mostly needed to setup paths for testing. 679 + */ 680 + 681 +static int 682 +QualifyPath( 683 + const char *szPath) 684 +{ 685 + char szCwd[MAX_PATH + 1]; 686 + char szTmp[MAX_PATH + 1]; 687 + char *p; 688 + GetCurrentDirectory(MAX_PATH, szCwd); 689 + while ((p = strchr(szPath, '/')) && *p) 690 + *p = '\\'; 691 + PathCombine(szTmp, szCwd, szPath); 692 + PathCanonicalize(szCwd, szTmp); 693 + printf("%s\n", szCwd); 694 + return 0; 695 +} 709 696 710 697 /* 711 698 * Local variables: 712 699 * mode: c 713 700 * c-basic-offset: 4 714 701 * fill-column: 78 715 702 * indent-tabs-mode: t 716 703 * tab-width: 8 717 704 * End: 718 705 */
Changes to win/pkgIndex.tcl.
1 1 # tDOM Tcl package index file 2 2 3 -package ifneeded tdom 0.8.4 \ 4 - "[list load [file join $dir tdom084[info sharedlibextension] ] tdom];\ 3 +package ifneeded tdom 0.9.0 \ 4 + "[list load [file join $dir tdom090[info sharedlibextension] ] tdom];\ 5 5 [list source [file join $dir tdom.tcl]]"
Changes to win/rules.vc.
29 29 ### Assume the normal default. 30 30 _INSTALLDIR = C:\Program Files\Tcl 31 31 !else 32 32 ### Fix the path separators. 33 33 _INSTALLDIR = $(INSTALLDIR:/=\) 34 34 !endif 35 35 36 -!ifndef MACHINE 37 -!if "$(CPU)" == "" || "$(CPU)" == "i386" 38 -MACHINE = IX86 39 -!else 40 -MACHINE = $(CPU) 41 -!endif 42 -!endif 43 - 44 -!ifndef CFG_ENCODING 45 -CFG_ENCODING = \"cp1252\" 46 -!endif 47 - 48 36 #---------------------------------------------------------- 49 37 # Set the proper copy method to avoid overwrite questions 50 38 # to the user when copying files and selecting the right 51 39 # "delete all" method. 52 40 #---------------------------------------------------------- 53 41 54 42 !if "$(OS)" == "Windows_NT" ................................................................................ 65 53 CPY = xcopy /i >_JUNK.OUT # On Win98 NUL does not work here. 66 54 COPY = copy >_JUNK.OUT # On Win98 NUL does not work here. 67 55 RMDIR = deltree /Y 68 56 NULL = \NUL # Used in testing directory existence 69 57 ERRNULL = >NUL # Win9x shell cannot redirect stderr 70 58 !endif 71 59 MKDIR = mkdir 60 + 61 +#------------------------------------------------------------------------------ 62 +# Determine the host and target architectures and compiler version. 63 +#------------------------------------------------------------------------------ 64 + 65 +_HASH=^# 66 +_VC_MANIFEST_EMBED_EXE= 67 +_VC_MANIFEST_EMBED_DLL= 68 +VCVER=0 69 +!if ![echo VCVERSION=_MSC_VER > vercl.x] \ 70 + && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \ 71 + && ![echo ARCH=IX86 >> vercl.x] \ 72 + && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \ 73 + && ![echo ARCH=AMD64 >> vercl.x] \ 74 + && ![echo $(_HASH)endif >> vercl.x] \ 75 + && ![cl -nologo -TC -P vercl.x $(ERRNULL)] 76 +!include vercl.i 77 +!if ![echo VCVER= ^\> vercl.vc] \ 78 + && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc] 79 +!include vercl.vc 80 +!endif 81 +!endif 82 +!if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc] 83 +!endif 84 + 85 +!if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86] 86 +NATIVE_ARCH=IX86 87 +!else 88 +NATIVE_ARCH=AMD64 89 +!endif 90 + 91 +# Since MSVC8 we must deal with manifest resources. 92 +!if $(VCVERSION) >= 1400 93 +_VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1 94 +_VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2 95 +!endif 96 + 97 +!ifndef MACHINE 98 +MACHINE=$(ARCH) 99 +!endif 100 + 101 +!ifndef CFG_ENCODING 102 +CFG_ENCODING = \"cp1252\" 103 +!endif 72 104 73 105 !message =============================================================================== 74 106 75 107 #---------------------------------------------------------- 76 108 # build the helper app we need to overcome nmake's limiting 77 109 # environment. 78 110 #---------------------------------------------------------- ................................................................................ 129 161 130 162 !if [nmakehlp -c -RTC1] 131 163 DEBUGFLAGS = $(DEBUGFLAGS) -RTC1 132 164 !elseif [nmakehlp -c -GZ] 133 165 DEBUGFLAGS = $(DEBUGFLAGS) -GZ 134 166 !endif 135 167 136 -COMPILERFLAGS =-W3 168 +COMPILERFLAGS =-W3 /D_ATL_XP_TARGETING 137 169 138 170 # In v13 -GL and -YX are incompatible. 139 171 !if [nmakehlp -c -YX] 140 172 !if ![nmakehlp -c -GL] 141 173 OPTIMIZATIONS = $(OPTIMIZATIONS) -YX 142 174 !endif 143 175 !endif ................................................................................ 157 189 !if [nmakehlp -c -QIA64_Bx] 158 190 !message *** Compiler has 'B-stepping errata workarounds' 159 191 COMPILERFLAGS = $(COMPILERFLAGS) -QIA64_Bx 160 192 !else 161 193 !message *** Compiler does not have 'B-stepping errata workarounds' 162 194 !endif 163 195 !endif 196 + 197 +# Prevents "LNK1561: entry point must be defined" error compiling from VS-IDE: 198 +!ifndef LINKER_TESTFLAGS 199 +LINKER_TESTFLAGS = /DLL /NOENTRY /OUT:nmhlp-out.txt 200 +!endif 164 201 165 202 !if "$(MACHINE)" == "IX86" 166 203 ### test for -align:4096, when align:512 will do. 167 204 !if [nmakehlp -l -opt:nowin98] 168 205 !message *** Linker has 'Win98 alignment problem' 169 206 ALIGN98_HACK = 1 170 207 !else ................................................................................ 173 210 !endif 174 211 !else 175 212 ALIGN98_HACK = 0 176 213 !endif 177 214 178 215 LINKERFLAGS = 179 216 180 -!if [nmakehlp -l -ltcg] 217 +!if [nmakehlp -l -ltcg $(LINKER_TESTFLAGS)] 181 218 LINKERFLAGS =-ltcg 182 -!endif 183 - 184 -#---------------------------------------------------------- 185 -# MSVC8 (ships with Visual Studio 2005) generates a manifest 186 -# file that we should link into the binaries. This is how. 187 -#---------------------------------------------------------- 188 - 189 -_VC_MANIFEST_EMBED_EXE= 190 -_VC_MANIFEST_EMBED_DLL= 191 -VCVER=0 192 -!if ![echo VCVERSION=_MSC_VER > vercl.x] \ 193 - && ![cl -nologo -TC -P vercl.x $(ERRNULL)] 194 -!include vercl.i 195 -!if $(VCVERSION) >= 1400 196 -VCVER=8 197 -_VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1 198 -_VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2 199 -!elseif $(VCVERSION) >= 1300 200 -VCVER=7 201 -!elseif $(VCVERSION) >= 1200 202 -VCVER=6 203 -!endif 204 219 !endif 205 220 206 221 #---------------------------------------------------------- 207 222 # Decode the options requested. 208 223 #---------------------------------------------------------- 209 224 210 225 !if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"] 211 226 STATIC_BUILD = 0 212 227 TCL_THREADS = 1 213 228 DEBUG = 0 229 +SYMBOLS = 0 214 230 PROFILE = 0 215 -MSVCRT = 0 231 +PGO = 0 232 +MSVCRT = 1 216 233 LOIMPACT = 0 217 234 TCL_USE_STATIC_PACKAGES = 0 218 235 USE_THREAD_ALLOC = 1 219 -USE_THREAD_STORAGE = 1 220 236 UNCHECKED = 0 221 237 !else 222 238 !if [nmakehlp -f $(OPTS) "static"] 223 239 !message *** Doing static 224 240 STATIC_BUILD = 1 225 241 !else 226 242 STATIC_BUILD = 0 227 243 !endif 244 +!if [nmakehlp -f $(OPTS) "nomsvcrt"] 245 +!message *** Doing nomsvcrt 246 +MSVCRT = 0 247 +!else 228 248 !if [nmakehlp -f $(OPTS) "msvcrt"] 229 249 !message *** Doing msvcrt 230 250 MSVCRT = 1 231 251 !else 252 +!if !$(STATIC_BUILD) 253 +MSVCRT = 1 254 +!else 232 255 MSVCRT = 0 233 256 !endif 234 -!if [nmakehlp -f $(OPTS) "staticpkg"] 257 +!endif 258 +!endif 259 +!if [nmakehlp -f $(OPTS) "staticpkg"] && $(STATIC_BUILD) 235 260 !message *** Doing staticpkg 236 261 TCL_USE_STATIC_PACKAGES = 1 237 262 !else 238 263 TCL_USE_STATIC_PACKAGES = 0 239 264 !endif 240 265 !if [nmakehlp -f $(OPTS) "nothreads"] 241 266 !message *** Compile explicitly for non-threaded tcl 242 267 TCL_THREADS = 0 268 +USE_THREAD_ALLOC= 0 243 269 !else 244 270 TCL_THREADS = 1 271 +USE_THREAD_ALLOC= 1 245 272 !endif 246 273 !if [nmakehlp -f $(OPTS) "symbols"] 247 274 !message *** Doing symbols 248 275 DEBUG = 1 249 276 !else 250 277 DEBUG = 0 278 +!endif 279 +!if [nmakehlp -f $(OPTS) "pdbs"] 280 +!message *** Doing pdbs 281 +SYMBOLS = 1 282 +!else 283 +SYMBOLS = 0 251 284 !endif 252 285 !if [nmakehlp -f $(OPTS) "profile"] 253 286 !message *** Doing profile 254 287 PROFILE = 1 255 288 !else 256 289 PROFILE = 0 290 +!endif 291 +!if [nmakehlp -f $(OPTS) "pgi"] 292 +!message *** Doing profile guided optimization instrumentation 293 +PGO = 1 294 +!elseif [nmakehlp -f $(OPTS) "pgo"] 295 +!message *** Doing profile guided optimization 296 +PGO = 2 297 +!else 298 +PGO = 0 257 299 !endif 258 300 !if [nmakehlp -f $(OPTS) "loimpact"] 259 301 !message *** Doing loimpact 260 302 LOIMPACT = 1 261 303 !else 262 304 LOIMPACT = 0 263 305 !endif 264 306 !if [nmakehlp -f $(OPTS) "thrdalloc"] 265 307 !message *** Doing thrdalloc 266 308 USE_THREAD_ALLOC = 1 267 -!else 309 +!endif 310 +!if [nmakehlp -f $(OPTS) "tclalloc"] 311 +!message *** Doing tclalloc 268 312 USE_THREAD_ALLOC = 0 269 313 !endif 270 -!if [nmakehlp -f $(OPTS) "thrdstorage"] 271 -!message *** Doing thrdstorage 272 -USE_THREAD_STORAGE = 1 273 -!else 274 -USE_THREAD_STORAGE = 0 275 -!endif 276 314 !if [nmakehlp -f $(OPTS) "unchecked"] 277 315 !message *** Doing unchecked 278 316 UNCHECKED = 1 279 317 !else 280 318 UNCHECKED = 0 281 319 !endif 282 320 !endif 283 - 284 - 285 -!if !$(STATIC_BUILD) 286 -# Make sure we don't build overly fat DLLs. 287 -MSVCRT = 1 288 -# We shouldn't statically put the extensions inside the shell when dynamic. 289 -TCL_USE_STATIC_PACKAGES = 0 290 -!endif 291 - 292 321 293 322 #---------------------------------------------------------- 294 323 # Figure-out how to name our intermediate and output directories. 295 324 # We wouldn't want different builds to use the same .obj files 296 325 # by accident. 297 326 #---------------------------------------------------------- 298 327 ................................................................................ 302 331 # s = static library (as opposed to an 303 332 # import library) 304 333 # g = linked to the debug enabled C 305 334 # run-time. 306 335 # x = special static build when it 307 336 # links to the dynamic C run-time. 308 337 #---------------------------------------- 309 -SUFX = sgx 338 +SUFX = tsgx 310 339 311 340 !if $(DEBUG) 312 341 BUILDDIRTOP = Debug 313 342 !else 314 343 BUILDDIRTOP = Release 315 344 !endif 316 345 ................................................................................ 327 356 328 357 TMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_ThreadedDynamicStaticX 329 358 330 359 !if !$(STATIC_BUILD) 331 360 TMP_DIRFULL = $(TMP_DIRFULL:Static=) 332 361 SUFX = $(SUFX:s=) 333 362 EXT = dll 334 -!if $(MSVCRT) 335 363 TMP_DIRFULL = $(TMP_DIRFULL:X=) 336 364 SUFX = $(SUFX:x=) 337 -!endif 338 365 !else 339 366 TMP_DIRFULL = $(TMP_DIRFULL:Dynamic=) 340 367 EXT = lib 341 368 !if !$(MSVCRT) 342 369 TMP_DIRFULL = $(TMP_DIRFULL:X=) 343 370 SUFX = $(SUFX:x=) 344 371 !endif ................................................................................ 386 413 387 414 #---------------------------------------------------------- 388 415 # Decode the checks requested. 389 416 #---------------------------------------------------------- 390 417 391 418 !if "$(CHECKS)" == "" || [nmakehlp -f "$(CHECKS)" "none"] 392 419 TCL_NO_DEPRECATED = 0 393 -FULLWARNINGS = 0 420 +WARNINGS = -W3 394 421 !else 395 422 !if [nmakehlp -f $(CHECKS) "nodep"] 396 423 !message *** Doing nodep check 397 424 TCL_NO_DEPRECATED = 1 398 425 !else 399 426 TCL_NO_DEPRECATED = 0 400 427 !endif 401 428 !if [nmakehlp -f $(CHECKS) "fullwarn"] 402 429 !message *** Doing full warnings check 403 -FULLWARNINGS = 1 430 +WARNINGS = -W4 431 +!if [nmakehlp -l -warn:3 $(LINKER_TESTFLAGS)] 432 +LINKERFLAGS = $(LINKERFLAGS) -warn:3 433 +!endif 434 +!else 435 +WARNINGS = -W3 436 +!endif 437 +!if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64] 438 +!message *** Doing 64bit portability warnings 439 +WARNINGS = $(WARNINGS) -Wp64 440 +!endif 441 +!endif 442 + 443 +!if $(PGO) > 1 444 +!if [nmakehlp -l -ltcg:pgoptimize $(LINKER_TESTFLAGS)] 445 +LINKERFLAGS = $(LINKERFLAGS:-ltcg=) -ltcg:pgoptimize 446 +!else 447 +MSG=^ 448 +This compiler does not support profile guided optimization. 449 +!error $(MSG) 450 +!endif 451 +!elseif $(PGO) > 0 452 +!if [nmakehlp -l -ltcg:pginstrument $(LINKER_TESTFLAGS)] 453 +LINKERFLAGS = $(LINKERFLAGS:-ltcg=) -ltcg:pginstrument 404 454 !else 405 -FULLWARNINGS = 0 455 +MSG=^ 456 +This compiler does not support profile guided optimization. 457 +!error $(MSG) 406 458 !endif 407 459 !endif 408 - 409 460 410 461 #---------------------------------------------------------- 411 462 # Set our defines now armed with our options. 412 463 #---------------------------------------------------------- 413 464 414 -OPTDEFINES = -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) 465 +OPTDEFINES = -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) -DSTDC_HEADERS 415 466 416 467 !if $(TCL_MEM_DEBUG) 417 468 OPTDEFINES = $(OPTDEFINES) -DTCL_MEM_DEBUG 418 469 !endif 419 470 !if $(TCL_COMPILE_DEBUG) 420 471 OPTDEFINES = $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS 421 472 !endif 422 473 !if $(TCL_THREADS) 423 474 OPTDEFINES = $(OPTDEFINES) -DTCL_THREADS=1 424 475 !if $(USE_THREAD_ALLOC) 425 476 OPTDEFINES = $(OPTDEFINES) -DUSE_THREAD_ALLOC=1 426 477 !endif 427 -!if $(USE_THREAD_STORAGE) 428 -OPTDEFINES = $(OPTDEFINES) -DUSE_THREAD_STORAGE=1 429 -!endif 430 478 !endif 431 479 !if $(STATIC_BUILD) 432 480 OPTDEFINES = $(OPTDEFINES) -DSTATIC_BUILD 433 481 !endif 434 482 !if $(TCL_NO_DEPRECATED) 435 483 OPTDEFINES = $(OPTDEFINES) -DTCL_NO_DEPRECATED 436 484 !endif 437 485 438 -!if $(DEBUG) 439 -OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DEBUG 440 -!elseif $(OPTIMIZING) 486 +!if !$(DEBUG) 487 +OPTDEFINES = $(OPTDEFINES) -DNDEBUG 488 +!if $(OPTIMIZING) 441 489 OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_OPTIMIZED 490 +!endif 442 491 !endif 443 492 !if $(PROFILE) 444 493 OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_PROFILED 445 494 !endif 446 -!if "$(MACHINE)" == "IA64" 495 +!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64" 447 496 OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT 448 497 !endif 498 +!if $(VCVERSION) < 1300 499 +OPTDEFINES = $(OPTDEFINES) -DNO_STRTOI64 500 +!endif 449 501 450 502 451 503 #---------------------------------------------------------- 452 -# Get common info used when building extensions. 504 +# Locate the Tcl headers to build against 453 505 #---------------------------------------------------------- 454 506 455 -!if "$(PROJECT)" != "tcl" 507 +!if "$(PROJECT)" == "tcl" 508 + 509 +_TCL_H = ..\generic\tcl.h 510 + 511 +!else 456 512 457 513 # If INSTALLDIR set to tcl root dir then reset to the lib dir. 458 514 !if exist("$(_INSTALLDIR)\include\tcl.h") 459 515 _INSTALLDIR=$(_INSTALLDIR)\lib 460 516 !endif 461 517 462 518 !if !defined(TCLDIR) ................................................................................ 480 536 _TCL_H = $(_TCLDIR)\generic\tcl.h 481 537 !else 482 538 MSG =^ 483 539 Failed to find tcl.h. The TCLDIR macro does not appear correct. 484 540 !error $(MSG) 485 541 !endif 486 542 !endif 543 +!endif 544 + 545 +#-------------------------------------------------------------- 546 +# Extract various version numbers from tcl headers 547 +# The generated file is then included in the makefile. 548 +#-------------------------------------------------------------- 487 549 488 550 !if [echo REM = This file is generated from rules.vc > version.vc] 489 551 !endif 490 -!if exist("$(_TCL_H)") 491 -!if [echo TCL_DOTVERSION = \>> version.vc] \ 492 - && [nmakehlp -V "$(_TCL_H)" TCL_VERSION >> version.vc] 552 +!if [echo TCL_MAJOR_VERSION = \>> versions.vc] \ 553 + && [nmakehlp -V "$(_TCL_H)" TCL_MAJOR_VERSION >> versions.vc] 554 +!endif 555 +!if [echo TCL_MINOR_VERSION = \>> versions.vc] \ 556 + && [nmakehlp -V "$(_TCL_H)" TCL_MINOR_VERSION >> versions.vc] 557 +!endif 558 +!if [echo TCL_PATCH_LEVEL = \>> versions.vc] \ 559 + && [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc] 493 560 !endif 494 -!endif 495 -!include version.vc 496 -TCL_VERSION = $(TCL_DOTVERSION:.=) 561 + 562 +!include versions.vc 563 + 564 +#-------------------------------------------------------------- 565 +# Setup tcl version dependent stuff headers 566 +#-------------------------------------------------------------- 567 + 568 +!if "$(PROJECT)" != "tcl" 569 + 570 +TCL_VERSION = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION) 497 571 498 572 !if $(TCLINSTALL) 499 573 TCLSH = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe" 500 574 !if !exist($(TCLSH)) && $(TCL_THREADS) 501 575 TCLSH = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe" 502 576 !endif 503 577 TCLSTUBLIB = "$(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib" ................................................................................ 511 585 !endif 512 586 TCLSTUBLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib" 513 587 TCLIMPLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib" 514 588 TCL_LIBRARY = $(_TCLDIR)\library 515 589 TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win" 516 590 !endif 517 591 518 -!endif 519 - 520 -#---------------------------------------------------------- 521 -# Optionally check for Tk info for building extensions. 522 -#---------------------------------------------------------- 523 - 524 -!ifdef PROJECT_REQUIRES_TK 525 -!if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk" 526 - 527 -!if !defined(TKDIR) 528 -!if exist("$(_INSTALLDIR)\..\include\tk.h") 529 -TKINSTALL = 1 530 -_TKDIR = $(_INSTALLDIR)\.. 531 -_TK_H = $(_TKDIR)\include\tk.h 532 -TKDIR = $(_TKDIR) 533 -!elseif exist("$(_TCLDIR)\include\tk.h") 534 -TKINSTALL = 1 535 -_TKDIR = $(_TCLDIR) 536 -_TK_H = $(_TKDIR)\include\tk.h 537 -TKDIR = $(_TKDIR) 538 -!endif 539 -!else 540 -_TKDIR = $(TKDIR:/=\) 541 -!if exist("$(_TKDIR)\include\tk.h") 542 -TKINSTALL = 1 543 -_TK_H = $(_TKDIR)\include\tk.h 544 -!elseif exist("$(_TKDIR)\generic\tk.h") 545 -TKINSTALL = 0 546 -_TK_H = $(_TKDIR)\generic\tk.h 547 -!else 548 -MSG =^ 549 -Failed to find tk.h. The TKDIR macro does not appear correct. 550 -!error $(MSG) 551 -!endif 552 -!endif 553 - 554 -!if defined(TKDIR) 555 -TK_DOTVERSION = 8.4 556 -!if exist("$(_TK_H)") 557 -!if [echo TK_DOTVERSION = \>> version.vc] \ 558 - && [nmakehlp -V "$(_TK_H)" TK_VERSION >> version.vc] 559 -!endif 560 -!endif 561 -!include version.vc 562 -TK_VERSION = $(TK_DOTVERSION:.=) 563 - 564 -!if $(TKINSTALL) 565 -WISH = "$(_TKDIR)\bin\wish$(TK_VERSION)$(SUFX).exe" 566 -TKSTUBLIB = "$(_TKDIR)\lib\tkstub$(TK_VERSION).lib" 567 -TKIMPLIB = "$(_TKDIR)\lib\tk$(TK_VERSION)$(SUFX).lib" 568 -TK_INCLUDES = -I"$(_TKDIR)\include" 569 -!else 570 -WISH = "$(_TKDIR)\win\$(BUILDDIRTOP)\wish$(TCL_VERSION)$(SUFX).exe" 571 -TKSTUBLIB = "$(_TKDIR)\win\$(BUILDDIRTOP)\tkstub$(TCL_VERSION).lib" 572 -TKIMPLIB = "$(_TKDIR)\win\$(BUILDDIRTOP)\tk$(TCL_VERSION)$(SUFX).lib" 573 -TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" 574 -!endif 575 - 576 -!endif 577 -!endif 578 592 !endif 579 593 580 594 #---------------------------------------------------------- 581 595 # Display stats being used. 582 596 #---------------------------------------------------------- 583 597 584 598 !message *** Intermediate directory will be '$(TMP_DIR)'